Comp.Lang.Tcl FAQ (Frequently Asked Questions)

Skip to first unread message

Larry W. Virden

Feb 24, 1992, 11:34:55 AM2/24/92

Well, here is my first public attempt at generating a FAQ for this group.
Please be gentle out there!

If you have additions, deletions, corrections, expansions, new questions
to be added, new answers to be answered, or other comments, feel free
to drop them by.

Note that this is going to be an infrequent posting. After 2 weeks of
comments, I will upload a corrected version to if
it is thought to be useful. If someone out there has a burning desire
to maintain this over the long haul, I would be happy, happy, happy to
let you.

Version 0.3, February 24, 1992

Index of questions:

1. What is Tcl? Tk? Extended Tcl? How does Tcl compare against language XXX?
2. Do these packages run on my machine?
a. Unix
b. MacOS
d. C++
3. Where can I get these packages?
a. Retrieving the sources for Tcl and Tk:
b. What about the Tcl/Tk Contrib Archive?
c. Tcl/Tk Code Index (last updated Jan 2 1992)
d. Tcl/Tk Extensions Index (last updated Feb 15 1992)
4. What are some examples of applications using Tcl and/or Tk?
a. arTCLs
b. Expect
c. Extended Tcl 6.1a
d. ForumNet
e. hp-tcl-cdplay
f. Modules
g. Mx
h. Point
i. Tcl 6.2
j. tclbot
k. tcltt
l. Tx
m. smaillog.tcl
n. tupact.tcl
5. Since Tcl/Tk appear to be extensible, are there any common extensions?
a. debugger
b. tclTCP
c. tclText
d. tclsockets
e. tclvogle
f. wmstuff
g. xygraph
6. Is there a bibliography of material relating to these programs?
7. Where do I report problems, bugs, or enhancements - or - What is comp.lang.tcl?
8. Questions on building Tcl and friends on your system

1. What is Tcl? Tk? Extended Tcl? How does Tcl compare against language XXX?

Tcl (version 6.2) stands for ``tool command language'' and is
pronounced ``tickle.'' It is actually two things: a language and a library.
First, Tcl is a simple textual language, intended primarily for issuing
commands to interactive programs such as text editors, debuggers,
illustrators, and shells. It has a simple syntax and is also programmable,
so Tcl users can write command procedures to provide more powerful commands
than those in the built-in set.

Second, Tcl is a library package that can be embedded in application
programs. The Tcl library consists of a parser for the Tcl language,
routines to implement the Tcl built-in commands, and procedures that allow
each application to extend Tcl with additional commands specific to that
application. The application program generates Tcl commands and passes them
to the Tcl parser for execution. Commands may be generated by reading
characters from an input source, or by associating command strings with
elements of the application's user interface, such as menu entries, buttons,
or keystrokes. When the Tcl library receives commands it parses them into
component fields and executes built-in commands directly. For commands
implemented by the application, Tcl calls back to the application to execute
the commands. In many cases commands will invoke recursive invocations of
the Tcl interpreter by passing in additional strings to execute (procedures,
looping commands, and conditional commands all work in this way).

An application program gains three advantages by using Tcl for its
command language. First, Tcl provides a standard syntax: once users know
Tcl, they will be able to issue commands easily to any Tcl-based application.
Second, Tcl provides programmability. All a Tcl application needs to do is
to implement a few application-specific low-level commands. Tcl provides
many utility commands plus a general programming interface for building up
complex command procedures. By using Tcl, applications need not re-implement
these features. Third, extensions to Tcl, such as the Tk toolkit,
provide mechanisms for communicating between applications by sending
Tcl commands back and forth. The common Tcl language framework makes it
easier for applications to communicate with one another.

Tk 1.4 - an extension to Tcl which provides the programmer with an
interface to the X11 windowing system. Note that many users will encounter
Tk via the ``wish'' command. Wish is a simple windowing shell which permits
the user to write Tcl applications in a prototyping environment.

Extended Tcl 6.1A - This extended set of commands are provided by
NeoSoft, and provide additional Unix system interfaces to the Tcl programmer.
Many users will encounter Tcl via the ``tcl'' command - an interactive Tcl
command interpreter.

2. Do these packages run on my machine?

a. Unix

Tcl runs on Suns and SunOS, DECstations running Ultrix, Dec VAXen
running Ultrix or BSD, 386s running SCO Unix, Xenix, Bell-Tech, Silicon
Graphics running IRIX, HPs running HP-UX, Sequent Symmetry running Dynix.
See the porting section below for info on porting the code to VMS as well.

Tk (being based on Tcl) requires X11R4 or better as the only additional
software requirement.

b. MacOS

Contact for the current status of the Tcl MacOS port.


Several people have worked on this, including Greg Noel
(gr...@harvey.Qualcomm.COM), Olav Schettler ( and Stephen
Trier (

This version is available on

d. C++

Check out tcl++.h in Extended Tcl. Based on an original
implementation by Parag Patel, it defines a Tcl interpreter class by which
Tcl interpreters can be created as objects under C++.

Mark Diekhans and Karl Lehenbauer have used this, in combination with
the handle facility in Extended Tcl, to build Tcl commands around C++ classes.

The Tcl handle facility provides a way to manage table entries that
can be referenced by a textual handle from Tcl code. This is provided for
applications that need to create data structures in one command, return a
reference (i.e. pointer) to that particular data structure and then access
that data structure in other commands. An example application is file

A handle table was built containing pointers to the instances of a
class that were to be accessed from Tcl, say a class `foo_cl', and then a
"new" command defined that created an instance of that class and returned a
Tcl handle to it. The handle could then passed among Tcl commands that
accessed each member kfunction. The handle is in effect an explicit `this'

For example:

set obj [foo_cl::new]
foo_cl::baz $obj "Hello world"
foo_cl::delete $obj

It's not totally object-oriented, but it's still very usable.

3. Where can I get these packages?

The "home site" for Tcl on the Internet is
Sprite is an experimental research machine whose IP servers
occasionally flake out. If you find that sprite is refusing
connections, send mail to "", wait a few
hours, and try again.

Tcl and Extended Tcl were posted to comp.sources.misc, appearing
November 14th, 1991, and can be found at most comp.sources.misc
archive sites in the tcl and tclx directories.

a. Tcl - available on
b. Tk - available on
c. Extended Tcl - available on and

From: ous...@sprite.Berkeley.EDU (John Ousterhout)
Newsgroups: comp.lang.tcl
Subject: Obtaining Tcl/Tk sources
Message-ID: <>
Date: 20 Dec 91 17:00:41 GMT

For people new to the Tcl/Tk community, here is information on how
to obtain Tcl and Tk sources. The information below describes what
I distribute; other information is available from other machines
also, such as

a. Retrieving the sources for Tcl and Tk:

The sources and documentation for the Tcl command
language library, for the Tk toolkit, and for a few Tcl-based
applications, are in the public FTP area on
All of these files are in the "tcl" subdirectory of the FTP area.
Here is a catalog of what's available. Most of the files are
compressed tar files ("xxx.tar.Z"). There is some overlap
between the contents of the various packages.

tcl/tk1.4.tar.Z - This is the latest release of the Tk toolkit, released
in January 1992. It includes a complete copy of the
Tcl 6.2 release (the version of Tcl with which it is
compatible) plus a simple windowing shell called
"wish". If you retrieve this file you don't need to
retrieve Tcl separately.

tcl/tk1.4.patch.Z - A patch file to upgrade from the 1.3 release of Tk
to 1.4. Invoke patch in the top-level Tk directory
with the "-p" switch and an uncompressed version of
this file, e.g. "patch -p tk1.4.patch".

tcl/tcl6.2.tar.Z - This is the newest release of the Tcl library.
It became available in January 1992. This
package includes only the Tcl library and its
documentation, plus a simple main program for

tcl/tcl6.2.patch.Z - A patch file to upgrade from the 6.1 release of Tcl
to 6.2. Invoke patch in the top-level Tcl directory
with the "-p" switch and an uncompressed version of
this file, e.g. "patch -p tcl6.1.patch".

tcl/tcl6.1Xa.tar.Z - Extended Tcl (or NeoSoft Tcl), created by Mark
Diekhans and Karl Lehenbauer, which adds a number
of useful facilities to the base Tcl release.
Among the things in Extended Tcl are a Tcl shell,
many new commands for things like UNIX kernel
call access and math library routines, and an
on-line help facility. This file is based on Tcl
6.1 but will probably work just fine with 6.2

tcl/mx.tar.Z - Sources and documentation for a mouse-based text
editor (mx) and terminal emulator (tx) based on
Tcl. This is a very old release: it uses an old
version of Tcl (which is included) and doesn't
even use Tk; it uses an ancient toolkit called
"Sx". These tools will eventually be replaced
with new tools based on Tk and the newest Tcl.

tcl/ - Postscript for a paper on Tcl that appeared in the
Winter 1990 USENIX Conference. This paper is also
included in the Tcl and Tk distributions.

tcl/ - Postscript for a paper on Tk that appeared in the
Winter 1991 USENIX Conference. This paper is also
included in the Tk distribution.

tcl/ - Postscript for Figure 10 of the Tk paper. - Postscript for viewgraphs from first of five talks
in the Tcl tutorial at the 1992 X Conference (the
same talk was also given at the 1992 USENIX Winter
Conference). This talk gives an overview of Tcl
and Tk. - Postscript for viewgraphs from second of five talks
in the Tcl tutorial at the 1992 X Conference. This
talk describes how to write scripts in the Tcl
language. - Postscript for viewgraphs from third of five talks
in the Tcl tutorial at the 1992 X Conference. This
talk describes how to program the Tk toolkit using
Tcl scripts. - Postscript for viewgraphs from fourth of five talks
in the Tcl tutorial at the 1992 X Conference. This
talk describes how to write new Tcl-based applications
in C. - Postscript for viewgraphs from last of five talks
in the Tcl tutorial at the 1992 X Conference. This
talk describes how to write implement widgets in C
using the Tk library. This talk uses a simple
"square" widget as an example; the code for the
widget is in tkSquare.c.

tkSquare.c - Sample code for use in conjunction with

tcl/tcl.archive - An archive of messages posted to the Tcl mailing
list. Now that there is a comp.lang.tcl newsgroup
the mailing list is defunct so this file is becoming
out of date.

To retrieve any or all of these packages, use anonymous FTP to (Internet address Use user
"anonymous"; when asked for a password, type your login name. Then
retrieve the relevant file(s) with the commands like the following:
type image (try "type binary" if this command is rejected)
cd pub/tcl
get tcl6.2.tar.Z
get tk1.4.tar.Z
get mx.tar.Z

What you'll get in most cases are compressed tar files; to get back the
original directory hierarchies, type commands like the following for
each file you retrieved:
uncompress tk1.4.tar.Z
tar xf tk1.4.tar
This will create a directory named tk1.4 with all the source files and
documentation for that release. There will be a README file in the
tk1.4 subdirectory that tells what to do next.

If you don't have access to Sprite, you can also retrieve some or
all of the above files from other FTP repositories. Here is a
sampler of machines that store some or all of the Tcl/Tk information,
plus the directories in which to check: languages/tcl/* contrib/tk* tcl/*

The barkley FTP area also contains a number of extensions and contributed
Tcl scripts.

If you cannot use FTP at all, there is a service called "ftpmail"
available from you can send e-mail to this
machine and it will use FTP to retrieve files for you and send you
the files back again via e-mail. To find out more about the ftpmail
service, send a message to "" whose body
consists of the single line "help".

There is also a network newsgroup, comp.lang.tcl, for the exchange of
information about Tcl and Tk and related applications.

Good luck! Although I can't promise a lot of direct support, I'm very
interested in getting bug reports and suggestions for improvement.
Serious bugs are likely to get fixed fairly quickly, and I expect to
produce a series of new releases that incorporate new features and
minor bug fixes.
-John Ousterhout-

b. What about the Tcl/Tk Contrib Archive?

Contributions to the Tcl/Tk Contrib Archive are most welcome --
please upload them to: []

send the archive maintainer ( a note stating
the names of the files you uploaded and a brief description of the whole

WARNING! The archive maintainer will NOT be automatically archiving anything
posted to comp.lang.tcl or previously to the mailing list. So if you want
your nifty porting instructions for getting Tcl up on your Seiko wrist watch
or your pen computer to be saved for others benefit, be sure to ftp them into
the archive.

Appended are the Indexes for the archives as of Jan 2 1992:

c. Tcl/Tk Code Index (last updated Jan 7 1992)
Directory: /tcl/code

artcls.tar.Z A Wish-based newsreader
Mike Hoegeman (

lisp2wish.tar.Z Wish/Common Lisp interface package
Jonathan Kaye (

showproc.tcl A new showproc
Lance Ellinghouse (

d. Tcl/Tk Extensions Index (last updated Feb 15 1992)
Directory: /tcl/extensions

dostcl.README Experimental MS-DOS Tcl 6.0a port
dostcl.zoo Karl Lehenbauer (

hp-tcl-cdplay.tar.Z Tk HP CD-Rom interface
Mike Hoegeman (

tcl6.1Xa.tar.Z Extended Tcl 6.1a
Karl Lehenbauer (
Mark Diekhans (

tclTCP.tar.Z Socket library interface
Kevin B. Kenny (

tcl.debugger Extended Tcl source level debugger (source patch)
Karl Lehenbauer (

tclvogle.tar.Z Tk 2D/3D drawing widget (alpha)
gdocs.tar.Z Mike Hoegeman (
tclvogle.patch1 Patch 1 for above

tkText.shar.Z An unfinished Tk 1.3 text widget
M. G. Christenson (

wmstuff.tar.Z Tk support for ICCCM WM_PROTOCOLS & WM_DELETE
wmstuff.README Mike Hoegeman (

xygraph-0.9.tar.Z XY graph and hypertext widgets
George Howlett (

4. What are some examples of applications using Tcl and Tk?

What: arTCLs
Description: a USENET news reader
Author: (Mike Hoegeman)

What: Expect
Description: a programmable scripting language
Author: (Don Libes)

What: Extended Tcl
Description: a series of extension for Tcl
Authors: (Mark Diekhans) & (Karl Lehenbauer)

What: fn and ForumNet
Description: ForumNet - teleconferencing system, fn - client to access ForumNet
Author: (Sean Casey)

What: hp-tcl-cdplay.tar.Z
Description: an interface to the HP CD-ROM player
Author: Mike Hoegeman <>

What: Modules
Description: a dynamic user environment customization package
Author: John L. Furlani <john.f...@East.Sun.COM>

What: Mx
Description: a Tk based text editor
Author: John Ousterhout <>

What: Point
Where: as pub/pt0.4.tar.Z
Description: a Tk based text editor
Author: Charlie Crowley <>

What: Tcl 6.2
Description: the complete base package for Tcl
Author: John Ousterhout <>

What: tclbot
Where: as
Description: MUD robot for Tcl programmers
Author: Rusty C. Wright <>

What: tcltt
Description: Tcl TinyTalk -
Author: Chris Siebenmann <>

What: Tx
Description: a Tk based terminal emulator
Author: John Ousterhout <>

What: smaillog.tcl
Where: alt.sources
Description: email activity report for smail 2.5
Author: (Karl Lehenbauer)

What: topact.tcl
Where: alt.sources
Description: 9X faster C-news active file "minimum article" updater
Author: (Karl Lehenbauer)


5. Since Tcl/Tk appear to be extensible, are there any common extensions?

Name - Brief description - Location

a. debugger - Extended Tcl trace mode - Tcl archive
b. tclTCP - Extended Tcl interface to BSD TCP/IP - Tcl archive library
c. tclText - Tk text widget - Tcl archive library
d. tclsockets - Extended Tcl interface to BSD sockets -
e. tclvogle - graphical data widgets for Tk - Tcl archive library
f. wmstuff - window manager hints for Tk - Tcl archive library
g. xygraph - graphic plot widgets for Tk - Tcl archive library

6. Is there a bibliography of material relating to these programs?

With the Tcl distribution there is a Postscript version of a Usenix paper
introducing Tcl. With the Tk distribution, there is a Postscript version
of a Usenix paper introducing Tk. With the Expect distribution, there are
several Postscript documents available which have been published.

Specific bibliographic info still needed.

``TCL: An Embeddable Command Language'', in the Proceedings of the
1990 Winter USENIX Conference, pages 133-146.

``An X11 Toolkit Based on the TCL Language'', in the Proceedings of the
1991 Winter USENIX Conference, pages 105-115.

Postscript file for introductory papers on Tcl and Tk are available
in the public FTP area on (Internet address To retrieve them, ftp to sprite (login "anonymous",
password "guest") and type the following commands:


(The last of these files is the contents of Figure 10 of the Tk

If you have trouble retrieving the papers via FTP or printing them,
send your U.S. Mail address and
he'll mail you paper copies.

7. Where do I report problems, bugs, or enhancements - or - What is comp.lang.tcl?

There are two alternatives for reporting bugs and problems. The first is the
USENET news group comp.lang.tcl, an unmoderated USENET newsgroup, created for
the discussion of the Tcl programming language and tools that embed it, such
as the Tk toolkit for X-windows, expect, and Extended Tcl.

The second would be to report things to the author. See question 4 above
for a pointer to some of the appropriate authors and their email addresses.

8. Questions on building Tcl and friends on your system

Q0. Is there anywhere I can find help with the details of getting Tcl to
work on my machine?

A0. Glad you asked! Look in the Tcl distribution for the file called
"porting". This will contain a collection of notes that various people
have provided about porting Tcl to various machines and operating systems.

Q1. When I am trying to build Tcl, the link step says that some of the
functions Tcl needs are missing.

A1. Did you run the "config" program first, by doing a "csh ./config" or

Tcl includes equivalents for the following functions and include files
which may not be found on some systems:

dirent.h limits.h stdlib.h string.h

opendir.c strerror.c strstr.c strtol.c strtoul.c


Q2. Has anyone built Tcl 6.1 on an RS/6000 AIX 3.1?

A2. One user got Tcl to compile with a few minor source modifications
(#ifdef'ing out a redeclaration of open() in tclUnix.h and duplicate case
statements for errno and signal symbols in tclUnixStr.c).

However, a serious bug in the version of strtoul distributed with AIX was
also discovered. The workaround for this is to use the strtoul function
supplied in the "compat" directory of tcl6.1.

Another change that needs to be made is to change the nm -p line in
the config file to nm -en.

A few other problems arose in the tests. One is caused by AIX printf not
formatting %#x and %#o correctly when the value to be printed is zero: they
print "0x0" and "00" instead of "0" and "0" respectively. This was reported
as not a problem in earlier releases. No fixes have been posted.

Finally, a problem occurs in open.test ... test 13.6 hangs because "cat"
on the RS6000 is unbuffered. A workaround is to change the execution
of "cat" in open.test to do a "cat -u".

Q3. Has anyone gotten Tcl to compile under HP-UX?

A3. One user was trying to compile tcl6.1 on an HP 9000/840 (HP-UX 7.0) and
was getting "Incompatible types in cast" errors. Someone else reported
that setting the CFLAGS in the Makefile to do a "-DBSD=1" fixed that error.
The TCL_UNION_WAIT define must be forced to a value of 0.


Information from: (Gillmer J. Derge)
Date: 8 Jan 92 13:44:18 GMT
Organization: GE Corporate R&D Center, Schenectady, NY

Here's a rough approximation of what I needed to do (pretty minor changes).

1. As discussed in the Makefile, do not compile the files that make UNIX_OBJS
(panic.c, tclEnv.c, tclGlob.c, tclUnixAZ.c, tclUnixStr.c and tclUnixUtil.c).
Furthermore, define the constant TCL_GENERIC_ONLY at compile-time.

2. Don't believe everything you read in Makefiles :-) -- TCL_GENERIC_ONLY
doesn't really work. You need to add an ifndef in tclCkalloc.c before the
"#include tclUnix.h". Also, in tclExpr.c, there's a reference to TCL_NO_UNIX
that should be changed to TCL_GENERIC_ONLY.

3. Finally, in order to run the test program (the test suite won't work, see
below), you'll need to change the definition of initCmd in tclTest.c. I
chose the following, which should be more or less compatible with non-VAX

char *initCmd =
"if [file exists [info library]/init.tcl] {source [info
char *initCmd =
"format {There is no Tcl library at this installation. Continuing

There are a number of caveats to all this. First of all, I did not
port tk or Extended Tcl. Furthermore, I think there may have been a release
that I missed since I did it (6.1 vs 6.0). Here's the RCS ID from my
tclExpr.c, in case you want to compare yours.

static char rcsid[] = "$Header: /sprite/src/lib/tcl/RCS/tclExpr.c,v 1.29
4 15:08:28 ouster Exp $ SPRITE (Berkeley)";

And perhaps most importantly of all, as you may have gleaned from the
compilation instructions, I did not do anything to port the Unix-related
functions. As a result, the standard test suite will not work. You have to
just try commands on your own. I recently got mail from (John Kimball) indicating that he may be working
on just that problem.

I've assumed a certain amount of C knowledge in the above. If that's
an invalid assumption, or your confused for any other reason, let me know,
and I'll try to clear things up. I'm guessing since you asked about porting
tk and Extended Tcl that I probably haven't taken this as you would have
liked, but maybe I've saved you at least a little effort. I hope so.

Larry W. Virden UUCP: osu-cis!chemabs!lwv26
Same Mbox: BITNET: lwv26@cas INET:
Personal: 674 Falls Place, Reynoldsburg,OH 43068-1614
America Online: lvirden

jason downs

Feb 28, 1992, 12:17:34 AM2/28/92
In article <>, (Larry W. Virden) writes:
>4. What are some examples of applications using Tcl and Tk?
>What: tclbot
>Where: as
>Description: MUD robot for Tcl programmers
>Author: Rusty C. Wright <>
>What: tcltt
>Description: Tcl TinyTalk -
>Author: Chris Siebenmann <>

..and i am incorporating TCL 6.2 into a MUD. TCL 'bots, TCL clients, and
now TCL servers.. whee..

\ - jason downs - /\ - dow...@atlantis.CS.ORST.EDU - /
/ zeppelin/cryvortex/amiga/insane guy \/ led/vasudeva/lord of fear of death \

Reply all
Reply to author
0 new messages