IMPORTANT NOTE: This package has been customized for Linux to support the desired directory structure and the automatic generation of shared libraries. See the README.linux file for details. If you do not plan on compiling this package under Linux, you should get an unmodified version from your favorite Tcl/Tk archive site. ------------------------------------------------------------------------ [incr Tcl] - version 1.5 ------------------------------------------------------------------------ This version will only work with Tcl version 7.0 and beyond. At this point, it has only been tested with versions 7.0-7.3. Please send comments or suggestions to michael.mclennan@att.com. ======================================================================== Copyright (c) 1993 AT&T Bell Laboratories ======================================================================== Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that the copyright notice and warranty disclaimer appear in supporting documentation, and that the names of AT&T Bell Laboratories any of their entities not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. AT&T disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall AT&T be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortuous action, arising out of or in connection with the use or performance of this software. ======================================================================== Implementation Notes: [incr Tcl] adds object-oriented programming facilities to Tcl. It was NOT designed as yet another whiz-bang object-oriented programming language; indeed, it is patterned somewhat after C++. It was designed to support more structured programming in Tcl. Scripts that grow beyond a few thousand lines become extremely difficult to maintain. [incr Tcl] attacks this problem in the same way that any object- oriented programming language would, by providing mechanisms for data encapsulation behind well-defined interfaces. In many cases, ideas for new widgets or objects can be prototyped using [incr Tcl], and if necessary, the code can be translated to C for more efficient execution; the public (Tcl) interface, however, could remain unchanged. READ THE INTRO: A tutorial explanation of [incr Tcl] is presented in the PostScipt file "Intro.ps". This tutorial describes a family of "Toaster" classes that illustrate many of the features available in this package. Source code for the example classes is provided in "demos/toasters". INSTALLATION AND TESTING: 1) Obtain this distribution from harbor.ecn.purdue.edu: ftp harbor.ecn.purdue.edu cd pub/tcl/extensions binary get itcl-1.5.tar.gz quit 2) Uncompress and untar the distribution: uncompress itcl-1.5.tar.Z tar xvf itcl-1.5.tar 3) Run the configuration script: cd itcl-1.5 ./configure or, for systems that don't recognize "#!" in shell scripts: cd itcl-1.5 /bin/sh ./configure By default, the configuration script will set things up to be installed in "/usr/local". You can change this by specifying a different "prefix" in the "configure" command: ./configure --prefix=/your/install/path You may be queried for the location of Tcl/Tk include files and libraries. Note that this package also requires the path to the Tcl source code, since it requires "tclInt.h" and this file is not usually installed with the standard include files. The "configure" script generates new Makefiles from their respective templates (Makefile.in). If "configure" can't find something, you can make changes to the intermediate "config.status" script, and invoke this script to reconfigure the Makefiles: vi config.status ./config.status As a last resort, you can edit the Makefiles in "src/", "man/" and "library/" by hand and insert the proper paths. 4) Build the libraries and the executables: make all 5) Test by running the demos: cd demos ../src/itcl_wish -f coloredit ../src/itcl_wish -f listboxes 6) Install the libraries (libitcl.a and libitcl.so.1.5) and the executables (itcl_sh and itcl_wish), along with the man page and library scripts onto your system: make install ADDING [incr Tcl] TO YOUR OWN APPLICATION: To add [incr Tcl] facilities to a Tcl application, modify the Tcl_AppInit() routine as follows: 1) Include the "itcl.h" header file near the top of the file containing Tcl_AppInit(): #include "itcl.h" 2) Within the body of Tcl_AppInit(), add the following lines: if (Itcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } 3) Link your application with libitcl.a NOTE: Example files "tclAppInit.c" and "tkAppInit.c" containing the changes shown above above are included in this distribution. DEMO CLASSES: Example classes in the "demos/widgets" directory illustrate how [incr Tcl] can be used to create new widgets that look (from a programming standpoint) like normal widgets but are written entirely in Tcl. These widgets are defined as object classes, and pack primitive widgets together to provide higher-level functionality. Two demos are provided which illustrate how these "mega-widgets" could be used in a real application: demos/listboxes .... Illustrates high-level listboxes: - ListBox - SelectBox - FilteredBox demos/coloredit .... Allows colors to be changed in another Tk application. Illustrates: - FilteredBox - ColorEditor Once you have created and installed the "itcl_wish" application which recognizes [incr Tcl] facilities, you can invoke these demos as: % cd demos % itcl_wish -f listboxes % itcl_wish -f coloredit It is necessary to sit in the "demos" directory when running these scripts, since they need to access the class definition files that reside in the "widgets" directory below. LIBRARY ROUTINES: The "library" directory contains a few useful Tcl procedures: library/itcl_mkindex.tcl .... the usual "auto_mkindex" proc updated to include [incr Tcl] classes when building an index library/itcl_reload.tcl ..... a series of procedures for unloading and reloading class definitions; useful when debugging [incr Tcl] applications. SUMMARY: Widgets provide a natural domain for object-oriented programming techniques. They are not, however, the only domain. I believe that [incr Tcl] can be used in more diverse applications to add structure to Tcl programs. The "itcl_class" mechanism should be used to group related procedures and their shared data into a neat little package with a well-defined interface. Please experiment with this facility and send me your comments. --Michael =--=== /////////////////////////////////////////////////////////// =-----==== Michael J. McLennan 2C-226 michael.mclennan@att.com =------===== AT&T Bell Laboratories ==----====== 1247 S Cedar Crest Blvd Phone: (610) 712-2842 ========== Allentown, PA 18103 FAX: (610) 712-3843 ====== ///////////////////////////////////////////////////////////