Tcl 7.5/Tk 4.1 Release Announcement April 21, 1996 John Ousterhout Sun Microsystems, Inc. john.ousterhout@eng.sun.com This message is to announce new releases of the Tcl scripting language and the Tk toolkit. The new releases are Tcl 7.5 and Tk 4.1. These releases contain many new features described below, the most important of which is the ability to execute on Windows and Macintosh platforms in addition to UNIX. The new releases are backwards compatible with Tcl scripts written for Tcl 7.4 and Tk 4.0, but there are a few small incompatibilities visible at the C level. Where to get the new releases: ------------------------------ Tcl 7.5 and Tk 4.1 are currently available by public FTP from ftp.smli.com in the directory /pub/tcl. The releases should appear on the usual mirror sites within a few days. The following files are available: - tcl7.5.tar.gz and tk4.1.tar.gz contain the unified source releases for all platforms (there are also .Z and .zip versions of these files). - win41.exe contains a binary release for the PC. This file contains compiled versions of Tcl, Tk, tclsh, and wish, along with libraries, demos, and manual pages (but no sources). The file is a self-extracting executable (run it and it installs everything). - PC sources are also available in the "win" subdirectory of the release area. See the README file in that directory for details. - mactk4.1.sea.hqx contains a binary release for the Mac. The file is in binhex format, which is understood by Fetch, StuffIt, and other Mac utilities. The unpacked file is a self-installing archive: double-click on it and it will create a folder containing everything you need to run Tcl and Tk. - Macintosh sources are also available in the "mac" subdirectory of the release area. See the README file in that directory for details. For additional information: --------------------------- There is a set of Web pages on Tcl and Tk maintained by the Tcl/Tk group at Sun Laboratories. They can be accessed via the following URL: http://www.sunlabs.com/research/tcl Credits: -------- Although I'm posting this message, most of the new features in this release are due to other people. Credit for the PC port goes to Scott Stanton (scott.stanton@eng.sun.com) and credit for the Macintosh port goes to Ray Johnson (raymond.johnson@eng.sun.com). The new "interp" command and the new I/O system are the handiwork of Jacob Levy (jacob.levy@eng.sun.com). Stephen Uhler (stephen.uhler@eng.sun.com) is responsible for the new "grid" geometry manager. Changes in Tcl 7.5: ------------------- Below is a list of the most important changes in Tcl 7.5, relative to Tcl 7.4. Besides these changes, there have been numerous bug fixes. For a complete list of absolutely every visible change, see the "changes" file in the distribution. 1. Dynamic loading. There is a new "load" command for loading binary extensions into Tcl on the fly. This works now on most of the major UNIX platforms as well as PCs and Macintoshes. Three new "info" commands, "info loaded", "info sharedlibextension", and "info nameofexecutable", were also added as part of the dynamic loading implementation. You can also create Tcl and Tk themselves as shared libraries with the --enable-shared switch to the configure script. 2. Packages and versions. There is a new "package" command for package and version management. See the manual entries for "package" and "pkg_mkIndex" for details on how to use it. There are also C APIs to the package mechanism. See PkgRequire.3. 3. Multiple interpreters and Safe-Tcl. There is a new "interp" command that allows you to create multiple interpreters within a single application and set up communication between them with "aliases". The mechanism also supports "safe" interpreters, which provide a generalized version of the security mechanisms in Borenstein and Rose's Safe-Tcl. There are still a few missing security features, such as resource control. You can use "load" to add extensions (including Tk) into slave interpreters. 4. The event loop from Tk has been moved to Tcl. Tcl now has commands "after", "fileevent", "update", and "vwait" (which replaces tkwait). The "tkerror" command has been renamed to "bgerror". "Tkerror" is still supported for backwards compatibility, but you should switch ASAP to using "bgerror" instead. Many C procedures that used to be in Tk have been moved to Tcl and renamed, such as Tcl_DoOneEvent, Tcl_DoWhenIdle, Tcl_CreateFileHandler, and Tcl_CreateTimerHandler. 5. Tcl has a whole new I/O system. All of the Tcl commands like "open" and "puts" should continue to operate as before, but there is a totally new implementation that doesn't use the C stdio library: - The new I/O system is more portable, and it can be extended with new kinds of I/O channels; see CrtChannel.3 for details. - Nonblocking I/O is supported on all platforms and there is a new command "fconfigure" to enable it and other channel options; see fconfigure.n for details. There is also a new "fblocked" command. - The I/O system automatically translates between different end-of-line representations (such as CR on Macs and CRLF on PC's) to the newline form used in UNIX and in all Tcl scripts; the "fconfigure" command can be used to control this feature. - There is a set of C APIs for manipulating Tcl_Channel's, which are analogous to UNIX FILE's. The C procedures have roughly the same functionality as the stdio procedures. See OpenFileChnl.3, CrtCloseHdlr.3, and CrtChnlHdlr.3 for details. - There is a new structure Tcl_File that provides platform- independent access to file handles such as UNIX fd's. See GetFile.3 for details. - There are new procedures Tcl_GetErrno and Tcl_SetErrno for accessing the "errno" variable in a safe and portable fashion. See SetErrno.3. 6. There are new commands "file split", "file join", and "file pathtype", which make it possible to handle file names in a way that will work on all platforms. See the manual entries file.n and filename.n for details. 7. There is a new "socket" command for network communication via TCP sockets. It works for both the client and server sides. There is also C-level support for sockets; see OpenTcp.3. 8. There is a new "clock" command, which contains the functionality of the TclX clock-handling commands. 9. The "foreach" command has been generalized significantly to support multiple lists and multiple variables iterating over each list. 10. There is a new "notifier" mechanism, which was added as part of the ports. This allows the basic mechanisms for reporting events to be implemented in different ways on different platforms. It may also be useful for other purposes, such as merging the Tk and Xt event loops so that Tk and Xt widgets can coexist in a single application. See the manual entry Notifier.3 for more information. 11. There is an "AssocData" mechanism that allows extensions to store their own data in an interpreter and get called back when the interpreter is deleted. This is visible at C level via the procedures Tcl_SetAssocData and Tcl_GetAssocData. 12. When manual pages are installed, additional links are created for each of the procedures described in the manual page, so that it's easier to invoke the "man" command. 13. There is a new variable "tcl_platform" with platform information. This is an associative array with elements like "os" and "machine" that contain various pieces of information about the platform. 14. There is a new procedure Tcl_CreateExitHandler that you can use to make sure a C procedure is called before the Tcl application exits. 15. There is a new procedure Tcl_UpdateLinkedVar to force the Tcl-level variable to be updated after you've changed the corresponding C-level variable. 16. The procedures Tk_Preserve, Tk_Release, and Tk_EventuallyFree have been moved from Tk to Tcl and given names like Tcl_Preserve. Three incompatibilities were introduced by the changes. All of these are at C-level, and only the first one should have much impact. Existing scripts for Tcl 7.4 should run unchanged under Tcl 7.5. 1. The procedure Tcl_EnterFile no longer exists. However, a new procedure Tcl_MakeFileChannel provides similar functionality. Tcl_GetOpenFile still exists but only works under UNIX. Tcl_CreatePipeline also remains, but it too works only under UNIX now; use Tcl_OpenCommandChannel for better portability. 2. Tcl doesn't export any global C variables anymore, because this doesn't work with Windows DLLs. The C variables tcl_AsyncReady and tcl_FileCloseProc have been replaced with procedures Tcl_AsyncReady() and Tcl_SetFileCloseProc(). The C variable tcl_RcFileName has been replaced with a Tcl variable tcl_rcFileName (use Tcl_SetVar to set the Tcl variable, instead of assigning to the old C variable). 3. Files are no longer shared between interpreters by default: if a file is opened in one interpreter, it cannot normally be used in other interpreters. However, the new procedure Tcl_ShareHandle allows files to be shared between interpreters if requested explicitly. Changes in Tk 4.1: -------------------- Below is a list of the most important changes in Tk 4.1, relative to Tk 4.0. Besides these changes, there have been numerous bug fixes. For a complete list of absolutely every visible change, see the "changes" file in the distribution. 1. There is a new command "grid" that implements a table style of geometry management. This will be used by future releases of the SpecTcl GUI builder. 2. The wish main program now supports -visual and -colormap command- line arguments. 3. Text widgets have been improved in several ways: - Performance when there are many tags should be much better now; tags should only be slow if there are a very large number of tags on an individual character. - There are new "dump", "mark next", "mark prev" and "tag prevrange" widget commands for extracting information out of a text widget. 4. Tk is now a first-class Tcl package (in the sense of the new Tcl "package" command). You can load Tk into a slave interpreter "foo" with the command "load {} Tk foo" if Tk is statically linked. Tk can also be compiled as a shared library using the --enable-shared switch for "configure". 5. The event loop has moved to Tcl. Many procedures and #defines have been renamed, such as the "tkerror" command (now "bgerror"), TK_READABLE (now TCL_READABLE), and Tk_DoOneEvent (now Tcl_DoOneEvent). All of the old Tk names are still supported for backwards compatibility but you should switch over ASAP to the new ones. 6. Tk_Preserve, Tk_Release, and Tk_Eventually have been moved to Tcl. There are #defines in tk.h for backward compatibility, but you should switch ASAP to the new Tcl APIs. 7. There is a new command "after info" that allows you to find out about pending "after" handlers that haven't yet fired. 8. Scrollbars and scales now have proper button 2 support as required by Motif. 9. Menus have two new options, -transient and -tearoffcommand. 10. Entries have a new "bbox" widget command. 11. When manual pages are installed, additional links are created for each of the procedures described in the manual page, so that it's easier to invoke the "man" command. 12. Wish supports a new "--" option: it will only process options up through the --; anything after that will be passed through to the application in the argc and argv variables. Although Tk 4.1 is compatible with Tk 4.0 scripts at the Tcl level, there are a few incompatible changes in Tk's C APIs. These will only affect C code, not Tcl/Tk scripts, and they are obscure enough that they probably won't affect many existing extensions. If there are any potential problems, they will be detected by an ANSI-compliant C compiler such as gcc. 1. The procedure Tk_CreateMainWindow no longer exists. Instead, Tk_Init does everything that Tk_CreateMainWindow used to do. 2. The procedures Tk_EventInit and Tk_CreateFileHandler2 have been eliminated. Tk_EventInit is no longer needed since the event loop is always available. Tk_CreateFileHandler doesn't make sense with the new notifier in Tcl, but you can get the same effect with the new "event source" mechanism (see the Notifier.3 manual entry in Tcl). 3. Tk doesn't export any global C variables anymore, because this doesn't work with Windows DLLs. The C variable tk_NumMainWindows has been replaced with the procedures Tk_GetNumMainWindows(), and the variable tk_CanvasTagsOption has been replaced with the procedures Tk_CanvasTagsParseProc and Tk_CanvasTagsPrintProc. 4. The interface to Tk_RestrictProc has changed so that the restrict procedure can ask for an event to be discarded, as well as processed or deferred.