addinput-3.6b This patch for Tk 3.6 implements two new commands for Tk. They allow you to associate a callback command with a file id directly from Tcl. When data is available on the file, the command is executed. This command greatly simplifies building multi-process applications under Tk. The only change is since the 3.6a release is adding support for the latest Linux (GNU) stdio. This patch is only compatible with Tk 3.6. When Tk 4.0 is available, this functionallity will be a standard part of Tk via the "fileevent" command. The latest version of this patch should be available from: ftp.neosoft.com:~ftp/pub/tcl/distrib or harbor.ecn.purdue.edu:~ftp/pub/tcl/extensions The implementation of addinput has been changed so only Tk is patched, Tcl (and TclX if you are using it) are no longer modified. No code C beyond Tk needs to be modified to use these commands. Please report any bugs or comments to markd@grizzly.com The Tk event handling code has been modified to be smart enough look into a stdio buffer for pending input, so the input files can be buffered. I have observed over an order of magnitude performance degradation when unbuffered files are used, so this change is important. The commands are: addinput ?-read? ?-write? ?-exception? fileid cmd Associate cmd with fileid. If -read is specified, the callback is run when the file is ready for input. If -write is specified, the callback is run when the file is ready for output. If -exception is specified, the callback is run when an exception occures on fileid. If no flag is specified, then -read is assumed. The following substitutions are performed on cmd. %% Replaced with a single percent. %F Replaced with the fileid. %E Replaced with a list indicating which events occurred. The list will contain one or more of the following strings: READ WRITE EXCEPTION removeinput fileid Remove the callback from fileid. This must be done before the file is closed. A file, library/demo/addinput.tcl is provided as a demo/test of these commands. This program uses a shell script addinput.sh that must be in the directory that addinput.tcl is run in.