153 lines
6.3 KiB
HTML
153 lines
6.3 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
|
<HTML>
|
|
<HEAD>
|
|
<META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.9">
|
|
<TITLE>The Linux Tcl and Tk HOWTO: What is Tcl/Tk</TITLE>
|
|
<LINK HREF="TclTk-HOWTO-4.html" REL=next>
|
|
<LINK HREF="TclTk-HOWTO-2.html" REL=previous>
|
|
<LINK HREF="TclTk-HOWTO.html#toc3" REL=contents>
|
|
</HEAD>
|
|
<BODY>
|
|
<A HREF="TclTk-HOWTO-4.html">Next</A>
|
|
<A HREF="TclTk-HOWTO-2.html">Previous</A>
|
|
<A HREF="TclTk-HOWTO.html#toc3">Contents</A>
|
|
<HR>
|
|
<H2><A NAME="s3">3. What is Tcl/Tk</A></H2>
|
|
|
|
<P>
|
|
<H2><A NAME="ss3.1">3.1 What is Tcl?</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Tcl is the acronym for "Tool Command Language" (it is pronounced "tickle").
|
|
Tcl is actually divided into two things: a language and a library.
|
|
<P>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.
|
|
<P>Tcl users can write command procedures to provide more powerful commands
|
|
than those given in the built-in set.
|
|
<P>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.
|
|
<P>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.
|
|
<P>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:
|
|
<UL>
|
|
<LI>Tcl provides a standard syntax: once users know Tcl, they will be able
|
|
to issue commands easily to any Tcl-based application.</LI>
|
|
<LI>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.
|
|
</LI>
|
|
<LI>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.</LI>
|
|
</UL>
|
|
<P>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.
|
|
<P>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.
|
|
<P>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.
|
|
<P>One answer to "What is Tcl?" can be found at
|
|
<A HREF="http://www.NeoSoft.com/tcl/whatistcl.html ">www.NeoSoft.com/tcl /whatistcl.html</A>
|
|
.
|
|
<H2><A NAME="ss3.2">3.2 What is Tk?</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>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.
|
|
<P>
|
|
<P>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.
|
|
<P>At present Tcl/Tk cannot handle Japanese, Chinese, Korean, .... language
|
|
fonts.
|
|
<H2><A NAME="ss3.3">3.3 Extensions</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>Since Tcl is so easy to extend, many try to share extensions, including
|
|
the popular itcl,
|
|
<A HREF="http://www.tcltk.com/itcl/">[incr Tcl]</A>,
|
|
ObjectTcl, TclX,
|
|
<A HREF="http://tix.mne.com/">Tix </A>, and
|
|
<A HREF="http://www.tcltk.com/blt/">BLT</A>.
|
|
<P>These extensions, of course, require an extended Tcl interpreter. Moreover,
|
|
many Tcl free applications require a particular Tcl extension to run.
|
|
<P>One of the most popular extension is called
|
|
<A HREF="http://expect.nist.gov">Expect</A>.
|
|
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.
|
|
<P>A complete list of Tcl/Tk extensions can be found at URL
|
|
<A HREF="http://www.scriptics.com/resource/software/extensions/">www.scr iptics.com/resource/software/extensions/</A>.
|
|
<H2><A NAME="ss3.4">3.4 Supported Platforms</A>
|
|
</H2>
|
|
|
|
<P>
|
|
<P>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.
|
|
<P>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.
|
|
<P>
|
|
<P>Tcl 8.0 and Tk 8.0 run on most releases of the following operating systems:
|
|
<P>
|
|
<UL>
|
|
<LI>Windows 95</LI>
|
|
<LI>Windows NT</LI>
|
|
<LI>Solaris and SunOS</LI>
|
|
<LI>Linux</LI>
|
|
<LI>HP-UX</LI>
|
|
<LI>SGI</LI>
|
|
<LI>IRIX</LI>
|
|
<LI>Digital Unix</LI>
|
|
<LI>AIX</LI>
|
|
<LI>SCO Unix</LI>
|
|
<LI>Most other Unix-like operating systems Macintosh (68K and Power Mac)</LI>
|
|
<LI>Pre-compiled releases are available for different Linux distribution.</LI>
|
|
</UL>
|
|
<HR>
|
|
<A HREF="TclTk-HOWTO-4.html">Next</A>
|
|
<A HREF="TclTk-HOWTO-2.html">Previous</A>
|
|
<A HREF="TclTk-HOWTO.html#toc3">Contents</A>
|
|
</BODY>
|
|
</HTML>
|