TclX, or Extended Tcl, provides access to the features exposed by API of POSIX systems such Unix.
FlightAware hosts a github repository for an updated TclX. The repository describes itself as "Official home of the TclX extension for Tcl", and is currently working on version 8.6 of TclX.
This package provides:
TclX is oriented towards system programming tasks and large application development. It provides a variety of additional interfaces to the underlying operating system, as well as many new programming constructs, text manipulation tools, and debugging capabilities.
Over the years, a variety of features originally appeared in TclX, and then, as the ideas were proven, migrated to the Tcl core. These features include:
TclX includes documentation on:
(Give an alternate description of TclX as Tcl augmented with POSIX stuff, such as fork, plus other conveniences common among Unixoids, including keyed lists, profiling, signal and kill, ...)
On SourceForge it can be found at http://sourceforge.net/projects/tclx
see ftp://ftp.tcl.tk/pub/tcl/nightly-cvs/ for a tar file of the sf.net cvs head .
The ActiveTcl Batteries Included distribution includes TclX.
TclX Future contains discussion about the interface and interaction between Tcl and TclX.
TclX Commands has a list of TclX's commands.
Karl Lehenbauer first wrote TclX, and he and Mark Diekhans maintained it for a long time. In spring 2002, Jeffrey Hobbs is "reforming" TclX, although he doesn't "own" it.
JH: TclX was not always an extension as it currently is. Before 8.4.0 released on Nov 21, 2005, there was a TkX (aka wishx) component or stand-alone binary ('tcl' exe) support, and was not portable and clean as it is nowadays.
Put this script, called wishx and marked executable, in your path:
#!/bin/sh #\ exec wish "$0" ${1+"$@"} package require Tk package require Tclx set argv [lassign $argv argv0] source $argv0
Note: script fixed by MS after a bug report in clt [L1 ]
LV: I would replace the wish in the above script with tclsh myself. Also note that sometimes, when one installs the Tcl package in one of its variations, instead of a command called tclsh or wish, a version number will be attached to the command name. For instance, one might find they have tclsh8.5.exe installed after installing a package. The simpler tclsh or tclsh.exe are often just shortcuts/symbolic links/copies of the other executable name, and in some cases, may not even exist.
Also, note that the above script won't replace ALL the functionality of the original wishx. That is because in the old days when Tclx installed tcl and wishx, there was an interactive command line command called help that was installed, that provided a relatively simple interface to man page like information. The above script doesn't implement that. Shouldn't make a difference for programs expecting to run using wishx (or tcl) but if you are following an old tutorial from a book or some electronic source, you may notice the difference.
Using tclsh or wish, just use the man command to look up information about tcl sub-commands.
How many people use TclX for Unix System Programming?
See also scanxxx without tclx
DKF: TclX is useful when you're running tclsh in setuid or setgid mode, since its id command can be used to perform the uid/gid changing often required when doing such things.
TR: The manual 'ObjCmdWrite.3' (TclCommandWriting - Writing C language extensions to Tcl) is a nice introduction to writing Tcl commands in C. In the 8.4 version there is an example for the reversal of a list, which is not only incomplete but also wrong. I liked the example as such, so here comes a correct version (not targeted at TclX but Tcl in general):
int lreverseCmd(ClientData notUsed, Tcl_Interp *interp, int objc,Tcl_Obj *const objv[]) { int listObjc, listIndex; Tcl_Obj **listObjv; char *temp, *resultList; Tcl_Obj *newListObjv; /* Verify argument count. Since we take only one argument, argument * count must be 2 (command plus one argument). */ if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "list"); return TCL_ERROR; } /* Create an object to handle the new list we're creating */ newListObjv = Tcl_NewObj(); /* Crack the list at objv[1] into its own count and array of object * pointers. */ if (Tcl_ListObjGetElements(interp, objv[1], &listObjc, &listObjv) != TCL_OK) { return TCL_ERROR; } /* For each element in the source list from last to first, append an * element to the new list. */ for (listIndex = listObjc - 1; listIndex >= 0; listIndex--) { Tcl_ListObjAppendElement (interp, newListObjv, listObjv[listIndex]); } Tcl_SetObjResult(interp,newListObjv); return TCL_OK; }
LV: you should submit the above as a bug fix on http://tclx.sf.net/ .
Speaking of which - does anyone know if the TclX code is ever going to be updated so it no longer crashes when tested with tcl 8.5? Bug reports have been submitted. Perhaps the only real problem is in the test suite - it would be nice if the test suite didn't crash tcl though.
dirs — commandloop — echo — infox — for_array_keys — for_recursive_glob — loop — popd — pushd — recursive_glob — showproc — try_eval
cmdtrace — edprocs — profile — profrep — saveprocs
alarm — execl — chroot — fork — id — kill — link — nice — readdir — signal — sleep — system — sync — times — umask — wait
bsearch — chmod — chown — chgrp — dup — fcntl — flock — for_file — funlock — fstat — ftruncate — lgets — pipe — read_file — select — write_file
scancontext — scanfile — scanmatch
intersect — intersect3 — lassign — lcontain — lempty — lmatch — lrmdups — lvarcat — lvarpop — lvarpush — union
keyldel — keylget — keylkeys — keylset
ccollate — cconcat — cequal — cindex — clength — crange — csubstr — ctoken — ctype — replicate — translit
help — helpcd — helppwd — apropos
auto_commands — buildpackageindex — convert_lib — loadlibindex — auto_packages — auto_load_file — searchpath