Next Previous Contents

## 3. What is Tcl/Tk

## 3.1 What is Tcl?

Tcl is the acronym for "Tool Command Language" (it is pronounced "tickle"). Tcl is actually divided into two things: a language and a library.

Tcl is a simple textual programming language, intended for issuing commands to interactive programs such as text editors, debuggers and shells. It has a simple syntax and it is also programmable.

Tcl users can write command procedures to provide more powerful commands than those given in the built-in set.

Second, Tcl is a library package embeddable in applications. The Tcl library consists of a parser for the Tcl language, routines to implement the Tcl built -in commands, and procedures which allow each application to extend Tcl with addit ional 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 interfa ce, such as menu entries, buttons, and other widgets. When the Tcl library receive s 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 make recursive invocation s of the Tcl interpreter by passing in additional strings to execute (in fact procedures and conditional-looping commands all work in this way). An applicat ion program can obtain many advantages by using Tcl for its command language:

- Tcl provides a standard syntax: once users know Tcl, they will be able to issue commands easily to any Tcl-based application.
- Tcl succeeds to provides programmability. All a Tcl application needs to do is to implement a few application-specific low-level commands. Tcl provides many utility commands and a general programming interface for building up comp lex command procedures. By using Tcl, applications need not reimplement these feat ures.
- Extensions to Tcl, such as the Tk toolkit, provide mechanisms for communi cating between applications by sending Tcl commands back and forth. The common Tcl language framework makes it easier for applications to communicate with one another.

It is important to note that Tcl was designed thinking that the programmer should actually use two or more languages when designing large software system s. One for manipulating complex internal data structures, or where performance is important, and another, such as Tcl, for writing very small scripts that glue together the other pieces, providing hooks for the user to extend.

For the Tcl script writer, ease of learning, ease of programming and ease of gluing are more important than performance or facilities for complex data structures and algorithms.

Tcl was designed to make it easy to drop into a lower language when you come across tasks that make more sense at a lower level. In this way, the basi c core functionality can remain small and one need only bring along pieces that one particular wants or needs.

One answer to "What is Tcl?" can be found at www.NeoSoft.com/tcl /whatistcl.html .

## 3.2 What is Tk?

Tk (pronounced "tee-kay") is an extension to Tcl which provides the programmer with an interface to the X11 windowing system . Note that Tk has been successf ully compiled under X11 R4, X11 R5, X11 R6, as well as Sun's NeWS/X11 environments.

Many users will encounter Tcl/Tk via the "wish" command. Wish is a simple windowing shell which permits the user to write Tcl/Tk applications in a proto typing environment.

At present Tcl/Tk cannot handle Japanese, Chinese, Korean, .... language fonts.

## 3.3 Extensions

Since Tcl is so easy to extend, many try to share extensions, including the popular itcl, [incr Tcl], ObjectTcl, TclX, Tix , and BLT.

These extensions, of course, require an extended Tcl interpreter. Moreover, many Tcl free applications require a particular Tcl extension to run.

One of the most popular extension is called Expect. It allows you to place a friendly front-end inside most command-line based UNIX applications, such as ftp, telnet, rlogin, passwd, fsck, and so on.

A complete list of Tcl/Tk extensions can be found at URL www.scr iptics.com/resource/software/extensions/.

## 3.4 Supported Platforms

This section contains information about Tcl 8.0 and Tk 8.0, the most recent version of Tcl/Tk. They were originally released on August 18, 1997 and the most recent patch releases (8.0.3) were made on September 3, 1998.

When you download Tcl and Tk you get two programs, wish and tclsh, supporting script libraries, and on-line reference documentation. These programs are gene ral purpose platforms for writing applications with Tcl. Wish includes the graphic al user interface toolkit Tk. The packages are ready to use after installation.

Tcl 8.0 and Tk 8.0 run on most releases of the following operating systems:

- Windows 95
- Windows NT
- Solaris and SunOS
- Linux
- HP-UX
- SGI
- IRIX
- Digital Unix
- AIX
- SCO Unix
- Most other Unix-like operating systems Macintosh (68K and Power Mac)
- Pre-compiled releases are available for different Linux distribution.

Next Previous Contents