[Tcl/Tk Home] Tcl 8.1 and Tk 8.1 [|] [Overview] [|] This page contains information about Tcl 8.1 and Tk 8.1, [Download] which are the most recent releases of the Tcl scripting [|] language and the Tk toolkit. These releases are still in [Tcl Plug-in] experimental form and are intended for expert early [|] adopters who are willing to help us find and fix problems; [Tcl & Java] there are likely to be many bugs. The current release level [|] is a2 (alpha 2), released on February 24, 1998. If you are [Tech Corner] looking for the most stable Tcl and Tk releases, we [|] recommend Tcl/Tk 8.0. [More Links] [|] When you download Tcl and Tk you get two programs, wish and Download: tclsh, supporting script libraries, and on-line reference documentation. These programs are general purpose platforms [+] Tcl/Tk for writing applications with Tcl. Wish includes the graphical user interface toolkit Tk. The packages are ready 8.1 to use after installation. [+] Tcl/Tk Table of Contents 8.0 Downloading Binary Releases for Windows and Macintosh [+] Tcl Downloading Source Releases for UNIX, Windows and Macintosh 7.6/Tk 4.2 What's New in Tcl 8.1 What's New in Tk 8.1 [+] Browser Incompatibilities Plugin Known Problems [+] Tcl / Downloading Binary Releases for Windows and Macintosh Java Pre-compiled releases are available for the following Windows and Macintosh platforms. [+] TclHttpd * Windows 3.1, Windows 95 and Windows NT self-extracting [+] SpecTcl installer (tcl81a2.exe) (about 1.7 Mbytes). The file is a self-extracting executable. It will install the Tcl and Tk libraries, the wish and tclsh programs, and [+] WebTk documentation. This file works on Windows 3.1 if you have the Win32s subsystem installed. If you use OS/2, [+] exmh you need an older version of Win32s. * Macintosh 68K and PowerPC self-extracting installer (mactk8.1a2.sea.hqx) (about 3.1 Mbytes). The file is Search in binhex format, which is understood by Fetch, Sunscript StuffIt, and many other Mac utilities. The unpacked file is a self-installing executable: double-click on it and it will create a folder containing all that you need to run Tcl and Tk. Downloading Source Releases for Windows, Macintosh, and UNIX If you're running on a platform other than the ones listed above, or if you want to make modifications to Tcl and Tk, you'll need to retrieve the source releases. These are available separately for Tcl and Tk in several different forms: Windows Source Releases: * Tcl sources for Windows (tcl81a2.zip): zip file (about 2.4 Mbytes). This is identical to the Tcl file listed under UNIX sources, but just in ZIP format instead of compressed tar. * Tk sources for windows (tk81a2.zip): zip file (about 2.6 Mbytes). This is identical to the Tk file listed under UNIX sources, but just in ZIP format instead of compressed tar. Macintosh Source Releases: Download one of the following files: * Macintosh Tcl sources (mactcl-source-8.1a2.sea.hqx): contains the source for the Tcl language. * Macintosh Tk sources (mactk-source-8.1a2.sea.hqx): contains the source for the Tk toolkit. * Full Macintosh Source and Libraries (mactcltk-full-8.1a2.sea.hqx): contains the source for both the Tcl language and the Tk Toolkit as well as the binaries and the MoreFiles package which is needed to compile the Tcl language. These files are in binhex format, which is understood by Fetch, StuffIt, and many other Mac utilities. The unpacked file is a self-installing executable: double-click on it and it will create a folder containing sources files used to build Tcl and Tk. UNIX Source Releases: You'll want both Tcl and Tk sources. Choose between compressed tar and gzipped tar format. The ZIP files listed under the Windows sources contain the same information, too. Compressed Tar Files * Tcl sources (tcl8.1a2.tar.Z): compressed tar file (about 3.1 Mbytes). * Tk sources (tk8.1a2.tar.Z): compressed tar file (about 3.5 Mbytes). Gzip'ed Tar Files * Tcl sources (tcl8.1a2.tar.gz): gzip'ed tar file (about 2.0 Mbytes). * Tk sources (tk8.1a2.tar.gz): gzip'ed tar file (about 2.2 Mbytes). When you retrieve one of these files, you'll get a compressed tar file with a name like tcl8.1a2.tar.gz or tcl8.1a2.tar.Z. The files are identical except for the technique used to compress them (.gz files are generally smaller than .Z files). To unpack the distribution, invoke shell commands like the following, depending on which version of the release you retrieved: gunzip -c tcl8.1a2.tar.gz | tar xf - zcat tcl8.1a2.tar.Z | tar xf - unzip tcl81a2.zip Each of these commands will create a directory named tcl8.1, which includes the sources for all platforms, documentation, and the script library for Tcl 8.1. To compile and install the distribution, follow the instructions in the README file in the distribution directory. Be sure to compile Tcl before Tk, since Tk depends on information in Tcl. Tcl and Tk should compile with little or no effort on any platform that runs a UNIX-like operating system and the X Window System. This includes workstations from Sun, HP, IBM, SGI, and DEC, PCs running a number of Unix operating systems such as Solaris, Linux, SCO UNIX, and FreeBSD, plus many other platforms such as Cray and NEC supercomputers. These releases should also compile with little or no effort on Windows and Macintosh platforms. More Information * See the comp.lang.tcl newsgroup for more user information. * Visit the Tech Corner page for many other technical sources. * See Jeff Hobbs' Tcl page, which collects patches posted to comp.lang.tcl. What's new in Tcl 8.1 The most important changes in Tcl 8.1 are summarized below. See the README and changes files in the distribution for more complete information on what has changed, including both feature changes and bug fixes. 1. Internationalization. Tcl has undergone a major revision to support international character sets: o All strings in Tcl are now represented in UTF-8 instead of ASCII, so that Tcl now supports the full Unicode character set. The representation of ASCII characters is unchanged (in UTF-8 anything that looks like an ASCII character is an ASCII character), but characters with the high-order bit set, such as those in ISO-8859, are represented with multi-byte sequences, as are all Unicode characters with values greater than 127. This change does not affect Tcl scripts but it does affect C code that parses strings. Tcl automatically translates between UTF-8 and the normal encoding for the platform during interactions with the system. o In Tcl scripts the backslash sequence \u can be used to enter 16-bit Unicode characters. \o and \x generate only 8-bit characters as before. o The fconfigure command now supports a -encoding option for specifying the encoding of an open file or socket. Tcl will automatically translate between the specified encoding and UTF-8 during I/O. See the directory library/encoding to find out what encodings are supported (eventually there will be an encoding command that makes this information more accessible). o There are several new C APIs that support UTF-8 and various encodings. See the manual entry Utf.3 for procedures that translate between Unicode and UTF-8 and manipulate UTF-8 strings. See Encoding.3 for procedures that create new encodings and translate between encodings. See ToUpper.3 for procedures that perform case conversions on UTF-8 strings. 2. Binary data. Binary data is handled differently in Tcl 8.1 than in Tcl 8.0. Tcl 8.1 uses the UTF-8 facilities to represent binary data: the character value zero is represented with a multi-byte sequence, so that (once again) strings in Tcl 8.1 never contain null bytes. This means that binary data is now accepted everywhere in Tcl and Tk (in Tcl 8.0 the support for binary data was incomplete). If you have C code that needs to manipulate the bytes of binary data (as opposed to just passing the data through) you should use a new object type called "byte array". See the manual entry ByteArrObj.3 for information about procedures such as Tcl_GetByteArrayFromObj. 3. New regular expressions. Tcl 8.1 contains a brand new implementation of regular expressions from Henry Spencer. This new version supports almost all of the Perl extensions and it also handles UTF-8 and binary data. 4. Multi-Threading. Tcl 8.1 is multi-thread safe. Each thread can contain several Tcl interpreters, but a given interpreter can not be accessed from more than one thread. Each thread runs its own event loop, and you can post events to other threads. There is not yet support for tcl level use of threading except for a test command. (Compile tcltest and try testthread.) Tk 8.1 is not yet multi-thread safe, and may never be due to limitations of Xlib. What's new in Tk 8.1 The most important changes in Tk 8.1 are summarized below. See the README and changes files in the distribution for more complete information on what has changed, including both feature changes and bug fixes. 1. Internationalization. Tk has undergone a major overhaul to support the new internationalization features of Tcl. The font package has been rewritten to support arbitrary Unicode characters; when you specify a particular font such as "Times 12" Tk may actually use additional fonts to display Unicode characters that don't exist in the font you chose. Tk guarantees to find a way to display any Unicode character regardless of the font you selected, as long as there is some font in the system that contains the Unicode character. The input method support in Tk has also been modified to support full Unicode characters. 2. Send/DDE support. The send command now works on Windows platforms. It is implemented using DDE and there is a new dde command that allows Tk applications to use DDE to communicate with other Windows applications. send still doesn't work on the Macintosh. 3. Embedding. Application embedding now works on the Macintosh, as long as both the container and embedded application are in the same process. 4. Configuration options. There is a new library of C procedures for manipulating widget configuration options using Tcl_Objs instead of strings. This should eventually make Tk much more efficient. Label, button, checkbutton, radiobutton, and menu widgets have been modified to use the new library. See SetOptions.3 for information on the new C APIs. 5. More Tcl_Obj support. Several additional C library procedures have been added to support Tcl_Objs. See the manual entries 3DBorder.3, GetAnchor.3, GetBitmap.3, GetColor.3, GetCursor.3, GetFont.3, GetJustify.3, and GetPixels.3. Incompatibilities Although the 8.1 releases involve substantial changes to the implementation of Tcl and Tk, the changes should introduce few if any compatibility problems for Tcl scripts or extensions. Here are the compatibility problems that we know of: 1. The changes to the regular expression package required a few minor syntax changes in order to support all the new features: o Backslash inside brackets is an escape whereas before it was a literal character. To specify a literal \ in brackets you must write \\. o Some escapes, such as \d, \s, and \w, now mean special things in a bracket expression. Other escapes , such as \D, \S, \W, \A and \Z, are illegal. o A { followed by a digit will no longer match those two characters. Instead, it will start a bound. Such sequences should be rare and will often result in an error because the following characters will not look like a valid bound. o Backslash followed by an alphanumeric character is either an escape or an error. Several of the new escapes were treated as literal characters in earlier versions of Tcl. o The matching order has changed slightly. Here is an explanation from Henry Spencer: Both the old package and the new package find the match that starts earliest in the string. Where things get tricky is when there is more than one possible match starting at that point, different in either length or internal details (that is, which subexpressions match where). The old package examines possible matches in a complex but well-defined order, and simply reports the first one it finds. The new package examines all possible matches simultaneously, and reports the longest. For example, (week|wee)(night|knights) matches all of "weeknights". When two possible matches are of the same length, priority is decided based on getting the longest possible matches for early subexpressions, with later subexpressions accepting whatever they can get. This means that either (wee|week)(kly|ly) or (week*)(k?ly) matches "weekly" as week-ly, not wee-kly. More subtly, when .*|a.c matches "abc", the .* matches the whole string and the a.c doesn't even get a chance to participate. When non-greedy quantifiers are used, things get more complicated. If all quantifiers in a regular expression are non-greedy, the exact same rules apply except with "longest" replaced by "shortest" everywhere. When greedy and non-greedy quantifiers are mixed, it's complicated and difficult to explain. 2. The procedure Tcl_EvalObj has a new argument flags, and the procedure Tcl_GlobalEvalObj has been removed (Tcl_EvalObj now provides all of its functionality). 3. The procedures Tcl_ObjSetVar2 and Tcl_ObjGetVar2 have been renamed Tcl_SetObjVar2 and Tcl_GetObjVar2 for consistency with other C APIs; the name arguments have been changed from objects to strings. Known Problems With These Releases Both the internationalization support and the new regular expression package are large, complicated, and young, which means there are likely to be lots of bugs. We need your help in finding and fixing problems. This is particularly important for internationalization, since we don't have the right equipment or knowledge to test under very many conditions. Here are some of the most glaring bugs or missing features that we know of: 1. In the scan command, the %c conversion character doesn't properly handle characters with Unicode value greater than 255 (i.e., those outside the ISO-8859-1 subset). 2. Tcl doesn't currently handle case conversion or collation order properly for characters with Unicode value greater than 255 (i.e., those outside the ISO-8859-1 subset). For characters in the ISO-8859-1 subset, collation and case conversion should work the same as in Tcl 8.0. 3. We haven't been able to test input methods in Tk under Unix to be sure that the full Unicode character set is being substituted properly in %A substitutions. This means that it probably doesn't work. We have been able to test under Windows and the Macintosh. 4. In Tk, PostScript generation does not work correctly for characters outside the ASCII subset. 5. In several places in Tk, strings are not being converted from UTF-8 to the native platform encoding before passing them to Windows and Macintosh library procedures. This includes menu text, window manager text (such as window titles), and text for native dialog boxes. As a result, non-ASCII characters may not display properly in these cases. Conversion should be happening properly everywhere under Unix. 6. The threading for Tcl is brand new so there are likely to be bugs, although it is based on early work done by Richard Hipp. We have done some testing on a multiprocessor Solaris machine, but none on Windows or other flavors of UNIX on a multiprocessor. 7. Tk is not thread safe, and may never be. You may be OK if you only have Tk in one thread and run other Tcl-only threads, but this is not officially supported yet. ------------------------------------------------------------ Home | Overview | Download | Tcl Plug-in | Tcl & Java | Tech Corner | More Links | Search Last modified: Wed Mar 11 1998, 10:40