[incr Tcl] (the humorous name for the Tcl package "Itcl") is one of the most widely used O-O system for Tcl. The name is a play on C++, and [incr Tcl] provides a similar object model, including multiple inheritence and public and private classes and variables.
While there are over a dozen OO extensions for Tcl, [incr Tcl] is one of the compiled C extensions, which results in better performance than other, all-Tcl object systems.
[incr Tcl] is also the foundation of [incr Tk] and the Iwidgets megawidgets. The home page is http://incrtcl.sourceforge.net/itcl/ , and source code is available at http://sourceforge.net/projects/incrtcl
Debugging via trace is slightly more complex than for plain Tcl Itcl trace.
The script level commands made available by the itcl extension are:
See http://www.tcl.tk/man/itcl3.1/ for more doc references.
Marty Backe posted an apt testimonial to comp.lang.tcl: "I've been using Iwidgets for awhile now, and recently completed a project that was fully implemented in itcl (including Iwidgets). I'm converted. Once you write a program based on objects, you might be hard pressed to go back to the straight tcl way. It becomes VERY easyto write clear, concise code. Of course you can do the same with namespaces (that's what I've been doing), but it takes a lot more work, and the result isn't as satisfying (IMHO).
My current approach is to have one file that contains the main application, which primarily creates objects via class files sourced from a class/ directory. Each object is defined in one class file. This facilitates testing of the objects prior to integration into the application.
Arguably, Itcl is probably one of the most mature extensions available for Tcl. I think that should be your least concern.
Michael McLennan pointed out on the Incr Tcl Users' mailing list that you can create auto-load index files for Incr Tcl packages, so that class files only get sourced as needed. (Lazy loading.)
$ tclsh % package require Itcl % cd /dir/containing/tcl/files % auto_mkindex . *.tcl *.itcl *.itk
Note that the trick for making Itcl index files is just to load Itcl before calling auto_mkindex. That way, it will recognize your itcl::class definitions and add them to the index.
In the past, there were web pages and an old porting guide for itcl on the http://purl.org/tcl/package/itcl/ web site. That site does not seem to respond any longer. Also, a lot of the same information from the web site used to be found at http://sf.net/projects/tclweb/ . However, it has not changed for quite some time.
The itcl3.2 source distribution does have information on porting from 2.2 to 3.2. See these two files:
The latest version of Itcl from the http://incrtcl.sf.net/ CVS appears to be version 3.3 . A beta and release candidate download of this code is now available from the sourceforge project page.
A TIP was passed to include the code for itcl in the tcl core tar file, but as an extension which one can load or not depending on the need. Options for getting itk and Iwidgets seperately were planned quite a long time ago, but activity relating to this extension appears to be low - watch http://sourceforge.net/projects/incrtcl/ for more details. Alas, no one who likes itcl has stepped forward to implement this action.
Note - it appears that when building incr tcl from source, one needs to install before doing the test suite. That rather is annoying - one must overwrite one's current installation before testing a patch to see if the resulting extension even works ...
Persistent incr-Tcl objects describes how to add the capability to write out a script which will restore the state of the objects in a program at a later date. This is also refered to as the serialisation of objects.
What: tydoc Where: http://ptolemy.eecs.berkeley.edu/tycho/ http://ptolemy.eecs.berkeley.edu/tycho/tycho0.2.1/tycho0.2.1/util/tydoc/doc/ ftp://ptolemy.eecs.berkeley.edu/pub/tycho/tycho0.3/tydoc3.0.src.tar.gz Description: A part of Tycho, tydoc takes itcl source code and generates html. Expects you to maintain classes and procs in separate files. Does not generate an entire source tree recursively - you provide the specific file names that you want doc generated. Has a few javadoc like tags. Updated: 11/2005 Contact: http://ptolemy.eecs.berkeley.edu/~cxh (Christopher Brooks)
An archive for the distributed processing incr tcl discussion may be found at gopher://nisp.ncl.ac.uk/11/lists-a-e/distinct/ .
Information about the use of Tcl and incr Tcl during prototyping of the Mars PathFinder project can be found at ftp://ftp.procplace.com/pub/tcl/sorted/misc/Tcl_on_Pathfinder/ .
At http://www.stsci.edu/public/sst/rps2/rps2-paper.html an interesting paper resides regarding an interactive tool using incr tcl/incr tk to aid in proposal preparation for the Hubble Space Telescope.
At http://www.doitnow.com/%7Eiliad/Tcl/tea/tea_faq.html , the author of the Tea OO Tcl extension provides a comparison between Tea and incr tcl.
A mailing list for users of itcl is managed at the sourceforge project site. It is, however, nearly comotose.
A mailing list for the incr tcl distributed version - aka Distinct - can be joined by sending send a message to mailto:[email protected] where the body contains the line
join distinct firstname lastname
To send to the list, mail mailto:[email protected] .
Some applications which make use of incr tcl include:
What: ADAM (Affordable Desktop Application Manager) Where: http://wwwcn.cern.ch/umtf/adam.html Description: A itcl package which can be used to organize the applications on your desktop. Updated: 09/1996 Contact: mailto:[email protected] What: AutoDOC Where: http://www.uni-muenster.de/informatik/u/reiberg/autodoc Description: Automatic man page HTML documentation for C++ classes. Requires itcl 2.2. Updated: 09/1997 Contact: mailto:[email protected] (Joerg Reiberg) What: boob Where: From the contact Description: Tool Object oriented objection builder which manages SCM builds and repository duties. Written in itcl and uses itcl files as dependencies and build scripts. Rules based dependencies with on the fly scanning of c/c++ files. Updated: 10/1998 Contact: mailto:[email protected] (Bob McWhirter) What: CC2Itcl Where: http://wwwmath.uni-muenster.de/informatik/u/mam/IMAM/imamvrs-generator.htm Description: Generate bindings to get C++ classes integrated into Itcl. Updated: 02/2000 Contact: Unknown What: cpp2itcl Where: From the contact Description: Program to parse C++ header files and automaticallty extract C++ bindings. Updated: Contact: mailto:[email protected] (Karel Zuiderveld) What: HTCLtoTCL Where: ftp://www.lbl.gov/pub/htcl.tar http://www.lbl.gov/%7Eclarsen/projects/htcl.tar http://www.lbl.gov/%7Eclarsen/projects/htcl.html Description: Extracts Tcl from HTML/Tcl merged file. Requires [incr tcl]/itcl. Also has contains program which parses arguments passed by httpd type server from FORM input. Updated: Contact: mailto:[email protected] (Case Larsen) What: InfoPrism Where: http://www.linuxia.de/InfoPrism/ http://www.han.de/%7Eracke/InfoPrism/ http://www.han.de/%7Eracke/InfoPrism/infism.tar.gz Description: A general document processing system that translates SGML comforming to the InfoPrism DTD to different output formats, such as HTML, Texinfo, LaTeX and plain text. Latest version now supports SGML scripts - that is, microscripted SGML documents (with embedded Tcl code that gets processed in a preprocessor manner). Uses itcl 3.0, an SGML parser (such as sgmls v1.1.91 and nsgmls v1.1.1), and Jultaf library v0.0.9 or newer. It uses the GPL. At this time it is alpha quality. Updated: 04/1999 Contact: mailto:[email protected] (Stefan Hornburg) What: knews Where: http://avonlea.kanga.org/tcl/ Description: Proof of concept NNTP server written in itcl. Updated: 05/2000 Contact: mailto:[email protected] What: moonshine Where: http://www.rednecksoft.com/ Description: Source code editor which recognizes most of the Tcl/Tk, Itcl, and Expect commands. Has customizable syntax highlighting Updated: 02/2000 Contact: mailto:[email protected] What: newsflash Where: ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/net/newsflash-0.2/newsflash-0.2.tar.gz Description: A NNTP newsreader written using Tcl/Tk. It has article threading, multiple newsrc files, article decoding. It does not yet support killfiles, moderated newsgroup posting, email replies, multi-article save/uudecode, searching, or documentation. Requires Tcl 7.4/Tk 4.0, BLT 1.7, [incr tcl] 1.5 and tcl-dp 3.2. Updated: 02/1997 Contact: mailto:[email protected] (Koert Zeilstra) What: nntp server Where: http://avonlea.kanga.org/tcl/ Description: A proof-of-concept NNTP server (written in Itcl). Updated: 06/2000 Contact: mailto:[email protected]
What: Point repulsion demonstration Where: ftp://ftp.cs.unc.edu/pub/users/leech/points.tar.gz Description: Two C++ programs designed to answer the question of how to distribute N points on a spere and how to tesselate a sphere. Uses Tk and itcl to display results. Updated: Contact: mailto:[email protected] (Jon Leech) What: Qba Where: http://www.hsdi.com/qddb/applications/qba-docs ftp://ftp.ms.uky.edu/pub/unix/qddb/fx-examples/Qba-1.0beta.tar.gz http://www.hsdi.com/qddb Description: Qba is the Qddb Business Application. It provides a Qddb/Fx interface for managing clients, inventory, invoices, payments, and the like. Requires Tcl 7.4/Tk 4.0/itcl-1.5/BLT 1.8/Tix 4.0/Qddb-1.42.6 and tktable. Updated: 04/1997 Contact: mailto:[email protected] (Qba author) mailto:[email protected] (Qddb mailing list) What: Qddb Where: http://www.hsdi.com/qddb/ http://www.hsdi.com/qddb/applications http://www.hsdi.com/qddb/reports.html http://www.hsdi.com/qddb/usersguide http://www.hsdi.com/qddb/orders ftp://ftp.hsdi.com/pub/qddb/sources/ ftp://ftp.ms.uky.edu/pub/unix/qddb/qddb-1.44.tar.gz ftp://ftp.ms.uky.edu/pub/unix/qddb/qddb-examples.tar.gz ftp://ftp.ms.uky.edu/pub/unix/qddb/255-95.ps.gz ftp://ftp.ms.uky.edu/pub/unix/qddb/qhelp-0.3.tar.gz ftp://ftp.hsdi.com/pub/qddb/sources/ ftp://ftp.hsdi.com/pub/qddb/docs/usersguide-1.43-html.tar.gz ftp://ftp.hsdi.com/pub/qddb/docs/usersguide-1.43.ps.gz ftp://ftp.denet.dk/pub/unix/qddb/qddb/ Description: A Quick and Dirty DataBase (Qddb) package. It uses Tcl as a configuration language. Also has a Tk interface with TkTable extension. qhelp is a sample hypertext help system. Under the qddb/applications web site listed above are a set of example applications such as a Web guestbook, an address book, music albums tracking system, runner's log, recipe management system, bug tracker, client information database, and animal hospital software package. Supports Tk 4.2/itcl 2.2. Requires itcl, BLT 2.1 and tclX is recommended. Also supports Tix. While at one time this was free, it apparently is now commercial. Currently at version 2.0.0 . Updated: 09/2001 Contact: mailto:[email protected] (Qddb user mailing list) mailto:[email protected] (Qddb bugs only) What: TSIPP Work Bench Where: http://tsippwb.sourceforge.net/ Description: A point-and-click editor for 3D pictures and animations. Originally targeted at the software rendering engine TSIPP developed by Mark Diekhans, but is in the process of being enhanced to drive OpenGL using the TkOGL package by Claudio Esperanca. Updated: 08/2002 Contact: mailto:[email protected] (Paul Welton) What: [incr Tcl] class browser Where: ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/devel/class-browser1.0.tar.gz Description: A very simple iTcl graphical class browser. V1.2 is now available from the contact. Updated: 10/1998 Contact: mailto:[email protected] (Drew J. Asson) ???
Add on classes for incr tcl include
(JULY 28, 2003)
I'm interested in learning about iTCL, what is the best source for a tutorial? I would greatly appreciate any input...
lv did you read here on the wiki about incr tcl? The book about incr tcl is the best tutorial there is; alas, incr tcl, like tclx, as well as a number of other quite widely used extensions, do not seem as widely documented as they could be. And the book may be difficult to locate.
I'm learning Itcl and enjoy reading the well-written two chapters in the Tools book.
But I'm new at it and have a question. Even a good teacher has students who need raise their hand once in a while.
My confusion is about the DELETE code.
Itcl, it says, is designed to follow the tk paradigm.
On page 9 the delete statement reads:
$canvas delete $this
On page 12, however, the delete looks structurally different:
delete object bullet1
What am I missing?
Much obliged, and thanks.
I don't have access to the book, but '$canvas delete $this' looks to be a standard tk command. $canvas represents a canvas widget and $this represents something drawn on the canvas. Therefore, that statement is simply deleting something from the canvas widget. The 'delete object bullet1' is an itcl command, deleting the itcl object 'bullet1'
FPX 20080306: Yes. [incr Tcl] is very stable and robust, and it is still actively maintained to work with the latest versions of Tcl. Its Web presence may not always be up to date, but the code base in CVS is.
FPX 20080306: [incr Tcl] 3.4 is required with Tcl 8.5 and later. At the moment, this version is not available from the [incr Tcl] homepage. You will need to use CVS to download the latest code as described on http://sourceforge.net/cvs/?group_id=13244 or you can get the latest package from ftp://tcl.activestate.com/pub/tcl/nightly-cvs -- itcl-20080207.tar.gz worked for me.