------------------------------------------------------------------------ [incr Tcl] - version 2.0 ------------------------------------------------------------------------ This version includes tcl7.4p3 / tk4.0p3 upgraded to support namespaces, along with [incr Tk] and [incr Widgets]. Please send comments or suggestions to michael.mclennan@att.com. ======================================================================== Copyright (c) 1993-1995 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. ======================================================================== OVERVIEW ------------------------------------------------------------------------ - What is [incr Tcl]? - Getting started - Installation - Integrating [incr Tcl] with other extensions - Acknowledgements ------------------------------------------------------------------------ What is [incr Tcl]? ------------------------------------------------------------------------ [incr Tcl] started as a small, object-oriented extension of the Tcl language. It was originally conceived to support more structured programming in Tcl. Tcl scripts that grow beyond a few thousand lines become extremely difficult to maintain. This is because the building blocks of vanilla Tcl are procedures and global variables, and all of these building blocks must reside in a single global namespace. There is no support for protection or encapsulation. [incr Tcl] introduces the notion of objects. Each object is a bag of data with a set of procedures or "methods" that are used to manipulate it. Objects are organized into "classes" with identical characteristics, and classes can inherit functionality from one another. This object-oriented paradigm adds another level of organization on top of the basic variable/procedure elements, and the resulting code is easier to understand and maintain. Among other things, [incr Tcl] can be used to create new widgets that look and work like the usual Tk widgets, but are written entirely at the Tcl language level (C code is optional). These "mega-widgets" can be created using [incr Tk], a set of base classes which provide the core mega-widget functionality. [incr Widgets] is a set of high-level mega-widgets built using [incr Tk]. It has more than 30 widget classes, and can be used right out of the box to create: - fileselectiondialog - tabnotebook - panedwindow - combobox - optionmenu - scrolledlistbox - scrolledframe - messagedialog - and many others... Classes and/or related procedures can also be encapsulated in their own "namespace". A namespace is a collection of commands, variables, classes and other namespaces that is set apart from the usual global scope. Elements within a namespace can be "private" or "protected", so that access to them is restricted. An "import" command allows all of the elements from one namespace to be integrated into another. Extension writers will immediately see the benefit of namespaces. With vanilla Tcl, each extension must add its commands and variables at the global scope. Extension writers are encouraged to add a unique prefix to all of the names in their package, to avoid naming collisions. Extensions can now sit in their own namespace of commands and variables, and sensitive elements can be protected from accidental access. For example, the current release of [incr Tcl] has a namespace "::itcl" for object-oriented support, a namespace "::itk" for mega-widget support, and a namespace "::iwidgets" for the [incr Widgets] package. Each of these namespaces has its own collection of commands and variables. Developers can then pick and choose among the extensions, and integrate the parts that they need for their application by importing various namespaces at the global scope. Getting started ------------------------------------------------------------------------ Read the first part of the CHANGES file for a brief overview of new commands, and a summary of important changes. Consult the man pages for detailed information on particular commands. Check out our web site on WebNet for extra doc and the latest news: http://www.wn.com/biz/itcl/ Build and install the package as described below, then check out the "catalog" demo in the "iwidgets2.0.0/demos" directory. This shows off all of the mega-widgets available in the [incr Widgets] package. The file "iwidgets2.0.0/doc/iwidgets.ps" contains a tutorial introduction to the [incr Widgets] package. The mega-widget classes in the "iwidgets2.0.0" directory show off most of the functionality in this release. They are excellent code examples for creating new widget classes. Installation ------------------------------------------------------------------------ 1) Obtain this distribution from an archive site like this: ftp ftp.aud.alcatel.com cd pub/tcl/extensions binary get itcl2.0.tar.gz quit 2) Uncompress and untar the distribution: gunzip itcl2.0.tar.gz tar xvf itcl2.0.tar 3) Run the configuration script: cd itcl2.0 ./configure or, for systems that don't recognize "#!" in shell scripts: cd itcl2.0 /bin/sh ./configure By default, the configuration script will set things up to be installed in "/usr/local/itcl". You can change this by specifying a different "prefix" in the "configure" command: ./configure --prefix=/your/install/path You can also add options for a particular "cc" compiler and compiler flags: ./configure --with-cc=gcc --with-cflags=-g 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. From the toplevel directory type: make all 5) Install the libraries, executables, man pages and script files. From the toplevel directory type: make install 6) [incr Tcl] and [incr Tk] can also be built and installed as shared libraries on some systems. If you want to do this, you must do an extra step: cd itcl make shared cd ../itk make shared Integrating [incr Tcl] with other extensions ------------------------------------------------------------------------ [incr Tcl] now requires its own version of Tcl/Tk with support for namespaces. Therefore, you must use the version of Tcl/Tk that comes in this distribution as a basis for other applications. Hopefully, the namespace support will become a part of the standard distribution some day. You can add other extensions into the [incr Tcl] package by following the usual instructions for Tcl/Tk: 1) Put the source code for the extension in the directory "itcl2.0", at the same level as the directories "tcl7.4" and "tk4.0". You must compile the extension with the include files and libraries for the version of Tcl/Tk included in this release. 2) Copy "tclAppInit.c" or "tkAppInit.c" from the standard distribution. Choose the appropriate version according to your needs: tcl7.4/tclAppInit.c .... Tcl with namespaces tk4.0/tkAppInit.c ...... Tcl/Tk with namespaces itcl/tclAppInit.c ...... Tcl with namespaces and [incr Tcl] itk/tkAppInit.c ........ Tcl/Tk with namespaces and [incr Tcl]/[incr Tk] 3) Each extension should have an initialization function with a name like "XXX_Init()". The BLT package, for example, has a function "Blt_Init()". a) Include the declarations for any initialization routines at the top of the tclAppInit.c or tkAppInit.c file. b) Within the body of Tcl_AppInit(), add a call to the initialization routine. It should look something like this: if (Itcl_Init(interp) == TCL_ERROR) { return TCL_ERROR; } if (Itk_Init(interp) == TCL_ERROR) { return TCL_ERROR; } if (Blt_Init(interp) == TCL_ERROR) { return TCL_ERROR; } In this example we have integrated BLT in with [incr Tcl] and [incr Tk]. 4) Link your application with the appropriate libraries: libtcl.a ............ Tcl with namespaces libtk.a ............. Tk with namespaces libitcl.a ........... [incr Tcl] libitk.a ............ [incr Tk] -lX11 ............... X11 library Acknowledgements ------------------------------------------------------------------------ Thanks to George Howlett for teaching me how namespaces should really work. He has been a constant source of inspiration, and has kept a careful watch against many bad ideas. Jim Ingham fleshed out the notion of explicit scoping, and added many nice features to [incr Tk]. Bill Scott, with a steady stream of bug reports, helped me understand the questions that a typical user might have. He forced me to reinvent the paradigm on more than one occasion. Thanks to Mark Ulferts, Bill Scott, Bret Schuhmacher, Sue Yockey, Alfredo Jahn, John Sigler and other cohorts at DSC Communications Corp. With a sketchy overview and a crappy prototype of [incr Tk], they managed to build a nice set of mega-widgets. Their initial designs helped me smooth out the rough spots in [incr Tk]. Thanks to more than 100 beta-testers that helped me polish this release. Thanks to Alfredo Jahn and Bret Schuhmacher at WebNet for helping to create the [incr Tcl] web site. Thanks to Mark Harrison for his enthusiasm and support. Due in large part to his evangelism, I have been able to make [incr Tcl] development a mainstream activity. And many thanks to my wife Maria and my son Maxwell for putting up with all of this. --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-2773 ====== ///////////////////////////////////////////////////////////