1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
------------------------------------------------------------------------
[incr Tcl] - version 3.3 for Tcl/Tk 8.0.3 and beyond
------------------------------------------------------------------------
This is a bug-fix release in the itcl3.x series.
As much as possible, I've tried to make itcl3.x backward-compatible
with earlier releases. The class definition syntax has not changed
at all from itcl2.2, and the old itcl1.x syntax is still supported.
But you'll notice changes related to the new namespace mechanism in
Tcl 8.0. For information on incompatibilities and porting to itcl3.x,
read the INCOMPATIBLE file in this directory, or check out the itcl
web site:
http://incrtcl.sourceforge.net/
http://www.tcltk.com/itcl/
Many people through the years have helped me with [incr Tcl]
development, and I thank them for their contributions. Please
read the acknowledgements section below.
Send comments or suggestions to the [incr Tcl] mailing list
(itcl@scriptics.com) or directly to me (mmc@cadence.com).
If you want to subscribe to the mailing list, send a message
with the subject "subscribe" to "itcl-request@tcltk.com".
========================================================================
Copyright (c) 1993-1998 Lucent Technologies, Inc.
Copyright (c) 1998-2000 Cadence Design Systems, Inc.
========================================================================
OVERVIEW
------------------------------------------------------------------------
- What is [incr Tcl]?
- Getting started
- Installation
- Integrating [incr Tcl] with other extensions
- Acknowledgements
------------------------------------------------------------------------
What is [incr Tcl]?
------------------------------------------------------------------------
[incr Tcl] is an object-oriented extension of the Tcl language. It
was created 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
50 widget classes, and can be used right out of the box to create:
- fileselectiondialog
- tabnotebook
- panedwindow
- scrolledhtml
- 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
------------------------------------------------------------------------
If you're just getting started with [incr Tcl], check out these
useful resources:
- FREE TUTORIAL on our web site: http://www.tcltk.com/itcl/
- BOOK: "[incr Tcl/Tk] from the Ground Up," by Chad Smith
(ISBN 0-07-212106-8)
- BOOK: "Tcl/Tk Tools," edited by Mark Harrison
(ISBN 1-56592-218-2)
Also, run the "catalog" demo to get an overview of the [incr Widgets]
package. On Windows and Macintosh systems, this is installed as one
of the executables. On Unix systems, this is installed in the
"lib/itcl/iwidgets3.0.0/demos" library directory.
The file "iwidgets3.0.0/doc/iwidgets.ps" contains a tutorial
introduction to the [incr Widgets] package. The mega-widget classes
in [incr Widgets] show off most of the functionality in this release.
You can use them as a pattern to create your own widget classes.
If you're a seasoned itcl professional, check the CHANGES file for a
summary of recent enhancements. Consult the man pages for detailed
information on particular commands.
Check out our web site for the latest news:
http://incrtcl.sourceforge.net/
Installation on Unix Systems
------------------------------------------------------------------------
1) Obtain this distribution from an archive site like this:
http://incrtcl.sourceforge.net/
http://sourceforge.net/project/showfiles.php?group_id=13244
2) Uncompress and untar the distribution:
gunzip itcl<version>.tar.gz
tar xvf itcl<version>.tar
3) Run the configuration script:
cd itcl<version>
./configure
or, for systems that don't recognize "#!" in shell scripts:
cd itcl<version>
/bin/sh ./configure
The "configure" script finds the appropriate compiler flags and
generates new Makefiles from template files (Makefile.in).
By default, the configuration script will set things up so
that everything is installed in "/usr/local". You can change
this by specifying a different "prefix" in the "configure" command:
./configure --prefix=/your/install/path
If your Tcl installation is sitting somewhere other than right
next to this package, you may have to tell configure where to
find it:
./configure --with-tcl=/usr/local/tcl/lib
If you want to debug, you can add this option as well:
./configure --enable-symbols
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) Use the final product:
$ tclsh
% package require Itcl
% itcl::class Foo { method testing {} { return "testing!" } }
If you don't like the itcl:: prefix, you can import the itcl
commands into the global namespace:
% namespace import -force itcl::*
% class Foo { ... }
Note that you'll find the same behavior with [incr Widgets]:
$ wish
% package require Iwidgets
% iwidgets::optionmenu .om
% namespace import -force iwidgets::*
% optionmenu .om
Installation on Windows
------------------------------------------------------------------------
Follow the usual TEA instructions for building under Windows.
Requires Cygwin and Visual C++ 6.0.
Installation on Macintosh Systems
------------------------------------------------------------------------
Many thanks to Jim Ingham for putting up Macintosh binaries for
various releases. Check out http://www.tcltk.com/itcl for downloads.
Integrating [incr Tcl] with other extensions
------------------------------------------------------------------------
[incr Tcl] is now a pure extension to Tcl/Tk. Therefore, if you
build the Tcl/Tk core and this package with the "--enable-shared"
option, you can load [incr Tcl] into a vanilla tclsh, as follows:
package require Itcl
Similarly, you can load [incr Tcl] along with the [incr Tk] mega-widget
facility into a vanilla wish, as follows:
package require Itk
You can load [incr Tcl], [incr Tk], and the [incr Widgets] package
like this:
package require Iwidgets
If you require the earlier release of [incr Widgets] for some reason,
you can specify the version number:
package require Iwidgets 2.2
Other packages should plug-and-play in the same fashion.
>> NOTE: If you have any trouble with dynamic loading on UNIX
>> systems, you may need to set your LD_LIBRARY_PATH environment
>> variable to include the "lib" directory for your Tcl/Tk
>> installation. For example:
>>
>> LD_LIBRARY_PATH="/usr/local/tcl/lib:$LD_LIBRARY_PATH"
>> export LD_LIBRARY_PATH
Acknowledgements
------------------------------------------------------------------------
Thanks to Chad Smith for writing an excellent, comprehensive
book "[incr Tcl/Tk] from the Ground Up," for many helpful bug
reports, and for nudging me along to fix things.
Thanks to Matt Newman for providing the Tcl-only "tcl++" package
that helped so many people move forward while waiting for the
itcl3.0 release.
Thanks to John Ousterhout and the Scriptics team for bundling this
package with their TclPro product. It's gratifying to see [incr Tcl]
accepted as a mainstream product.
Thanks to Mark Ulferts, Sue Yockey, John Sigler, Bill Scott, Alfredo
Jahn, Bret Schuhmacher, Tako Schotanus and Kris Raney for building
the [incr Widgets] package. 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 especially to Mark Ulferts for keeping things up over the past
few years, and for streamlining the package for itcl3.0.
Thanks to Jan Nijtmans, Karel Zuiderveld, and Vince Darley for helping
to keep up with Tcl/Tk releases, and for supporting the "plus" and
"dash" patches under [incr Tcl].
Thanks to Forest Rouse and ICEM CFD Engineering for integrating
[incr Tcl] into their Tcl/Tk compiler. This is a large undertaking,
and they have done an excellent job.
Thanks to Alfredo Jahn and Bret Schuhmacher at WebNet for helping
to create the [incr Tcl] web site, and for maintaining the
[incr Tcl] mailing list for many years.
Thanks to extension writers like Mark Diekhans (tclX) and Ioi Lam (Tix)
for making their packages compatible with [incr Tcl].
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, added many nice features to [incr Tk],
and has helped tremendously with porting. Lee Bernhard worked on
distributed systems with Iclient/Iserver, and also helped with porting.
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 all of the alpha-testers that helped me polish this release.
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 children Maxwell and Katie
for putting up with all of this.
--Michael
. . . . . . . . . . . . . . . . . ---_-----------
. . . . . . . . . | c a d e n c e |
Michael McLennan . ---------------
mmc@cadence.com . Cadence Design Systems, Inc.
phone: 610-398-6348 . 7535 Windsor Dr. Suite A-200
fax: 610-530-7985 . Allentown, PA 18195
|