Tcl is the creation of Dr. John K. Ousterhout. Tcl was designed as an embeddable command language, but is strong enough to stand as a general programming language. Tcl is often associated with its primary extension Tk, which provides an elegantly simple interface for X Window System programming.
One of Tcl's design features is that it is easily extended. I've written two Tcl extensions for two popular relational database systems, Sybase and Oracle. My extensions are named Sybtcl and Oratcl respectively.
Other Tcl software distributions I've published are TclRobots, a Tcl programming game, Tcl-my-fancy, a Tcl extension configuration utility, and MSTCL7.3, a port of Tcl/Tk to MS-DOS. Mpexpr, a multiple precision math package, and Fcgi.tcl, an interface to the FastCGI protocol.
There's serveral Web pages on Tcl, including ones at the Tcl Consortium, SCO and Scriptics. A very nice Tcl index of sources, code, extensions, FAQs, etc. is Procplace, which holds the historical Tcl Internet archives. All of my software listed here can be found at ftp://ftp.procplace.com/pub/tcl , or follow the http links listed below.
I have authored two chapters on Sybtcl and Oratcl for Tcl/Tk Tools. My chapters provide detail on Sybtcl and Oratcl programming, plus coverage of Wisqlite and Wosql.
You can read more about Sybtcl in Tcl/Tk Tools.
Here is a small sample of Sybtcl code that connects to a Sybase server, sends an SQL query, then prints the results:
set hand [sybconnect "mysybid" "mysybpasswd"] sybuse $hand pubs2 sybsql $hand "select au_lname, au_fname from authors order by au_lname" sybnext $hand { puts [format "%s, %s" @1 @2] } sybclose $hand
Together with Tk, Sybtcl can be a rapid development tool for building X Window based Sybase applications.
The Sybtcl distribution includes Wisqlite, an X Window based SQL processor. A sample screen shot is here (15k).
One of the first Sybtcl programmers, De Clarke, has extended Wisqlite into a very extensive tool, called UCO/Wisql. De has also done work with Sybtcl and interfacing with WWW to serve campus phone numbers via a web page, and another application to browse star catalogs. Check out De's Sybtcl-to-WWW demo page and home page.
The current beta version is 3.0b3 released April, 1999, and can be found at
ftp://ftp.procplace.com/pub/tcl/sorted/databases/Sybtcl-3.0b3/3.0b3/sybtcl-3.0b3.tar.gz Sybtcl-3.0b3 supports Tcl 8.0 and higher.
The current stable version is 2.5 released January, 1998, and can be found at ftp://ftp.procplace.com/pub/tcl/sorted/databases/sybtcl-2.5/sybtcl-2.5.tar.gz See the README for additional information. Sybtcl 2.5 supports Tcl 8.0.
Oratcl is a Tcl extension that adds an interface to the Oracle relational database system. Oratcl creates several new commands in Tcl to connect to a Oracle server, send SQL statements, fetch return rows, read and write image columns to files, and query return column names, types, and lengths. Oracle PL/SQL procedures can also be executed and output variables accessed. Full access to Oracle server return codes and error message are also available.
I wrote Oratcl after writing Sybtcl, and I used Sybtcl as a model. Not surprisingly, Oratcl shares many features and overall look and feel with Sybtcl.
You can read more about Oratcl in Tcl/Tk Tools.
Here is a small sample of Oratcl code that connects to an Oracle server, sends an SQL query, then prints the results:
set logon [oralogon "myoraid/myorapasswd"] set hand [oraopen $logon] orasql $hand "select ename, job from emp order by ename" orafetch $hand { puts [format "%s, %s" @1 @2] } oralogoff $hand
Together with Tk, Oratcl can be a rapid development tool for building X Window based Oracle applications.
The Oratcl distribution includes Wosql, an X Window based SQL processor. A sample screen shot is here (15k). Actually, the screen shot is of Wisqlite, the SQL processor shipped with Sybtcl. Wosql has only cosmetic differences, and Oracle specific functions. All other features of the interface are shared with Wisqlite.
The current version is 2.5 released January, 1998, and can be found at
ftp://ftp.procplace.com/pub/tcl/sorted/databases/oratcl-2.5/oratcl-2.5.tar.gz
See the README for additional information.
Oratcl 2.5 supports Tcl 8.0.
I've had reports that some systems have trouble building Oratcl as a shared library. In that case, try building static libraries and executables, configure options --disable-shared
A sample screen shot is here (15k).
Here is a sample TclRobots control program. This program takes the strategy of finding an opponent, then driving toward and shooting at the target.
# # TclRobots - sample robot control program # Tom Poindexter # # charger.tr set dir [rand 360] set nothing 0 set closest 0 # start of main code while {1} { # look for an opponet set rng [scanner $dir 10] # if found and inrange if {$rng > 0 && $rng < 700} { # begin narrow scan set start [expr ($dir+20)%360] for {set limit 1} {$limit <= 40} {incr limit} { set dir [expr ($start-($limit)+360)%360] set rng [scanner $dir 1] if {$rng > 0 && $rng < 700} { # fire a shell, and backup scan so not to miss a moving target set nothing 0 # charge! cannon $dir $rng drive $dir 70 incr limit -4 } } } else { incr nothing if {$rng > 700} {set closest $dir} } drive 0 0 # check for nothing found in reasonable time if {$nothing >= 30} { set nothing 0 drive $closest 100 after 10000 drive 0 0 } set dir [expr ($dir-20+360)%360] }
The current version is 2.0 released March, 1996,
and can be found at
ftp://ftp.procplace.com/pub/tcl/sorted/games/tclrobots-2.0/tclrobots-2.0.tar.gz
TclRobots is currently based on Tcl 7.6 and Tk 4.2.
I sponsored a TclRobots tournament on the net September, 1994, and again in May, 1996. Results of the first two TclRobots Challenges are in ftp://ftp.procplace.com/pub/tcl/sorted/misc/TclRobots/
The current version is 3.0 released March, 1998, and can be found at
ftp://ftp.procplace.com/pub/tcl/sorted/packages-7.6/devel/tcl-my-fancy-3.0.tar.gz
.
For more information, check the
README.
Tcl-my-fancy is NOT associated with the Make-A-Wish Foundation of America, Inc.
Tcl-my-fancy is currently based on Tcl 8.0 and Tk 8.0.
The port is unsupported and was released December, 1993, and can
be found at
ftp://ftp.procplace.com/pub/tcl/sorted/distrib/mstcl73s.zip
for source and
ftp://ftp.procplace.com/pub/tcl/sorted/distrib/mstcl73e.zip
for executables.
README has additional information and porting notes. If you are looking to
run Tcl/Tk under Windows, see
Sun's Tcl/Tk.
home page for the official Windows (and Mac) ports.
For example:
% set mp_precision 50 50 % mpexpr 2.0/3.0 0.66666666666666666666666666666666666666666666666667 % mpexpr atan(1.0)*4 ;# common pi approximation 3.14159265358979323846264338327950288419716939937511 % mpexpr fact(34) ;# factorial 295232799039604140847618609643520000000
Mpexpr is based on Tcl's expr command, and David Bell's fine Calc program, which is now enhanced and maintained by Landon Curt Noll.
The current release of Mpexpr is 1.0, and can be found at ftp://ftp.procplace.com/pub/tcl/sorted/math/Mpexpr-1.0/1.0/mpexpr-1.0.tar.gz . Here is the README. Mpexpr supports Tcl 8.0
Fcgi.tcl comes in two flavors: a 100% Tcl flavor, and a C extension flavor. Both flavors offer the same programming interface for Tcl CGI programs.
Fcgi.tcl is designed to work with Don Libes' excellent cgi.tcl package.
Here is an example FastCGI program that echoes the CGI environment. It also uses cgi.tcl.
#!/bin/sh # restart using tcl \ exec /usr/local/bin/tclsh8.0 "$0" "$@" # # echo-cgi -- # package require cgi package require Fcgi set count 0 while {[FCGI_Accept] >= 0 } { cgi_eval { incr count cgi_title "fcgi.tcl: echo-cgi.fcg" cgi_body { cgi_h1 "fcgi.tcl" cgi_h2 "echo-cgi.fcg: request number $count" cgi_parray env } } }
You will also need a web server that support FastCGI, such as Apache compiled with the mod_fastcgi module. Other web servers support FastCGI (Netscape, NCSA, etc.); see the Fcgi.tcl README for additional pointers.
The current release of Fcgi.tcl is 0.4, and can be found at ftp://ftp.procplace.com/pub/tcl/sorted/net/fcgi.tcl-0.4/fcgi.tcl-0.4.tar.gz . Here is the README. Fcgi.tcl supports Tcl 8.0
The current release of Sockspy is 1.0, and can be found at ftp://ftp.procplace.com/pub/tcl/sorted/net/sockspy-1.0/1.0/sockspy-1.0.tar.gz
A sample screen shot is here (37k). This snapshot show sockspy examining the HTTP protocol between Netscape and a web site.
Here is the README
The current release of TclTicker is 1.3, and can be found at ftp://ftp.procplace.com/pub/tcl/sorted/apps/tclticker/1.3/tclticker-1.3.tar.gz
A sample screen shot is here (11k). TclTicker's configuration window is opened.
Here is the README
Another stock ticker application you might want to check out is Show Me the Money (also known as "smtm".) It's written by Dirk Eddelbuettel .
A sample screen shot is here (15k) (Ok, this is really wisqlite from Sybtcl, but odbcisql looks basically the same.)
The current release of Odbcisql is 1.0, and can be found at ftp://ftp.procplace.com/pub/tcl/sorted/databases/odbcisql/1.0/odbcisql-1.0.tar.gz
Here is the README