Plus patches

references since Mar 8 1996
New files available:
tcl8.0a2plus.patch.gz (updated: 3/17/97)
A patch for Tcl8.0a2, which adds more support for Shared libraries and Standalone applications. See below.
tk8.0a2plus.patch.gz (updated: 3/17/97)
A patch for Tk8.0a2, which adds more support for Shared libraries and Standalone applications. See below.
patch-2.1.tar.gz
Patch utility for UNIX.
patch.zip
Patch utility for Windows. (hopefully it works)
Further on the following files are available:

itcl2.2plus.patch.gz (updated: 3/17/97)
A patch for Itcl2.2, which adds more support for Shared libraries and Standalone applications. See below.
tcl7.6p2plus.patch.gz (updated: 4/29/97)
A patch for Tcl7.6p2, which adds more support for Shared libraries and Standalone applications. See below.
tcl7.6p2plus.tar.gz (updated: 4/29/97)
Complete distribution of Tcl7.6p2+ (with above patch already applied)
tk4.2p2plus.patch.gz (updated: 4/29/97)
A patch for Tk4.2p2, which adds more support for Shared libraries and Standalone applications. See below.
tk4.2p2plus.tar.gz (updated: 4/29/97)
Complete distribution of Tk4.2p2+ (with above patch and dash-patch already applied)
tclX7.6.0plus.patch.gz (updated: 3/18/97)
A patch for TclX7.6.0, which adds more support for Shared libraries and Standalone applications. See below. Requires either Itcl 2.2 or Tcl7.6(p2)/Tk4.2(p2) with the corresponding plus-patches.
tcl7.5p1plus.patch.gz (updated: 8/14/96)
No longer supported, but still kept as is
tk4.1p1plus.patch.gz (updated: 8/14/96)
No longer supported, but still kept as is

About the "Plus"-patches

These patches currently are supported only for Tcl8.0a2/Tk8.0a2, Tcl7.6/Tk4.2, Itcl2.2 and TclX7.6.0. They contains serveral enhancements (which are summarized below) and a few small bug fixes. The most changes are in the configure script and the Makefile, but also some minimal changes are made in the code. All changes are 100% upwards compatible with the corresponding offical Tcl/Tk releases.

TkCon console

Jeffrey Hobbs' TkCon console (version 0.71) is now the standard console. If this console cannot be initialized for some reason, or if stdin/stdout is no tty, the default console (stdin/stdout) will start up. Another way to disable this console is add the line "set NoTkCon 1" to your .tclshrc file.

Shared library support

If the option "--enable-shared" is given to the configure script both the static and shared libraries are created. Also in all directories where shared libraries are a pkgIndex.tcl file is created which contains references to all functions in these shared libraries.

Standalone Applications

In addition to Tcl_Init() and Tk_Init (or Xxx_Init in general) there are now additional functions Tcl_InitStandAlone() and Tk_InitStandAlone() (or Xxx_InitStandAlone in general). These perform the same function, only the Tcl and Tk libraries are compiled into the executable. This makes the executable larger, of course, but they will run on any system no matter if Tcl/Tk (or blt or Tix) is installed or not. Included is a program tcl2c, which translates tcl scripts into C source code. Compiling this code and linking with the necessary static libraries (it doesn't work with shared libraries) results in a standalone executable.

For example:

This compiles your script into C-code (with support for Tk and TclX). Compiling this code with the static libraries will produce the standalone executable.

Event Loop

Tclsh is now fully event-driven. That means that after the script is finished the application will start an event-loop which is compatible with the Tk event-loop. The application will end as soon as there are no active event handlers any more. By default, all event handlers will be passive, except the console and the X11 handler. So, if there is no console and no X11-handler the application will still end immediately. As a result, this is fully upwards compatible with the official Tcl/Tk distributions

This is implemented by defining the flag TCL_ACTIVE, which is from the same type as TCL_READABLE, TCL_WRITEABLE and TCL_EXCEPTION. If this flag is used in the Tcl_CreateFileHandler() or Tcl_CreateChannelHandler() functions, this is a request to the application to continue handling events as long as these event handlers are active. There is also a new option active to the fileevent command. This option is equivalent to readable, only the application will not exit as long as the file is not closed. For example:

	#!/usr/local/bin/tclsh8.0
	set f [open "test.tcl" r]
	fconfigure $f -blocking 0
	fileevent $f active {
	    set num [gets $f line]
	    puts stdout "$num: \"$line\""
	    if {[eof $f]} {
		close $f
	    }
	}

C++-support

Now the following files are changed such that they now can be compiled by any C or C++ compiler (both K&R and ANSI).

Tcl
tclAppInit.c
tclTest.c
tclUnixTest.c
pkga.c
pkgb.c
pkgc.c
pkgd.c
pkge.c
pkgf.c
Tk
tkAppInit.c
tkTest.c
tkSquare.c

Loadable extensions

If loading is enabled, the executables tcltest and tktest are no longer created for testing purposes. In stead, loadable libraries Tcltest.so, Tclobjtest.so, Tclptest.so, Tktest.so and Tksquare.so are created which only contain the additional test functions. These loadable libraries will be used to test tclsh and wish.

Make

Additional make-options are added:
make tclsh
Shared version of tclsh (default)
make tclsh++
C++ version of tclsh
make tclsh.static
Static version of tclsh
make tclsh.standalone
Standalone version of tclsh
make test
Execute tests using tclsh and Tcltest.so
make test++
Execute tests using tclsh++ and Tcltest.so
make test.static
Execute tests using tclsh.static and Tcltest.so
make test.standalone
Execute tests using tclsh.standalone and Tcltest.so
make hello.c
Create C source code from "hello.tcl"
make hello
Create executable from "hello.tcl"
make hello++
Create executable from "hello.tcl" (using C++ compiler)
The same options are available for Tk too.

Additionally, you can now run make in a sub-directory of tcl8.0a2/ or tk8.0a2/.


Written by:Updated: Mar 17, 1997
Jan Nijtmans
NICI (Nijmegen Institute of Cognition and Information)
email: nijtmans@nici.kun.nl
url: http://www.cogsci.kun.nl/~nijtmans/