Tcl 7.3, TclX7.3a, Tk3.6 for MSDOS & Desqview/X Tom Poindexter tpoind@advtech.uswest.com December, 1993 I did a quick port/hack of Tcl 7.3, TclX7.3a, and Tk3.6 to MSDOS. "Yes Virginia, you can run Wish under MSDOS!" (see below) Where to get the files: harbor.ecn.purdue.edu /pub/tcl/distrib/mstcl73s.zip source code /pub/tcl/distrib/mstcl73e.zip executables To unpack the files: cd \ pkunzip -d mstcl73s.zip (unpacks in \src) pkunzip -d mstcl73e.zip (unpacks in \usr) The executables included are: tclsh The standard Tcl shell (Tcl7.3) tcl The Extended Tcl shell (Tcl7.3 + TclX7.3a) wish The standard Windowing Shell (Tcl7.3 + Tk3.6) wishx The Extended Windowing Shell (Tcl7.3 + TclX7.3a + Tk3.6) Tclsh and tcl run under MSDOS, and use a 32 bit extender (DJ Delorie's GO32). Wish and wishx are linked with Quarterdeck's libraries for Desqview/X. ** Desqview/X is required to run wish and wishx! ** If you are unfamiliar with Desqview/X, it's an X server and also a Dos multitasker. You run the X server *and* X clients on Dos; additional networking support from Quarterdeck allows TCP/IP support. For more info, see comp.os.msdos.desqview, or email to info@qdeck.com, or ftp to qdeck.com. This port is NOT the much requested "Wish for Windows" The wish/wishx executables DO NOT RUN IN MS-WINDOWS!!! (You can run MS-Windows in Desqview/X, however.) The tclsh/tcl interpreters run fine under MS-Windows inside a Dos window. COPYRIGHTS: There are plenty. See the files \src\copying.* or \usr\copying.*, plus each file's headers. Also see \src\readme.* or \usr\readme.* for info on Dj Delorie's GNU C port. I did very little of the work here, and I don't claim any copyright on my changes or additions. Do respect the copyrights of others. SUPPORT: I'm not supporting this port as an ongoing project. I hacked too many files and made numerous small tweaks here and there to keep track of in neat diff files. When the next versions of the base code come out, don't expect to see new versions of this port. Bug reports are kindly accepted, and will probably be just filed away with a thank you. Bug reports with fixes are indeed welcome. Complaints that "xxx" (some feature) doesn't work right will just be tossed away without reply. RUNTIME NOTES: I used the normal Unix directory names for library files. \usr\local\lib\tcl, \usr\local\lib\tk for standard UCB Tcl, and \usr\local\tclx\7.3a, \usr\local\tkx\3.6a for TclX. Some library code was changed, particularly TclX package library code. The executables in the zip file unpack to \usr\local\bin. You could move these to where ever you want. Filenames: Inside of tcl, use forward slashes. The C library takes care of munging to backslashes. But, of course, if you "exec" something that expects a filename, you'll need (quoted) backslashes. A few other enviroment variables are needed: set HOME= where Tcl will expand ~, and looks for Tcl rc files there, e.g., tclsh.rc, tcl.rc, wish.rc set GO32= info for the GO32 dos extender set GO32TMP= where GO32 will create files for virtual memory set TMPDIR= compiler temp files set TCL_LIBRARY= if you want to override where you put the Tcl library code. set TZ= if you want your timezone to appear correctly, otherwise the library assumes EDT These environment variables need forward slashes, e.g., SET TMPDIR=c:/ If you recompile the sources, you will need a set of environment variables for DJ's GCC. I've included a copy of my enviroment variables, that I used for DJGPP. I've only tested the executables on 486 cpus. For 386 machines without a 387 math cpu, the "emu387" file is supposed to provide floating point emulation. I've included it in \usr\local\bin. PORTING NOTES: Base source was untarred from the normal Tcl distributions. I did take some working Tcl library code from my Unix installation (e.g. tcl.tlib) instead of rebuilding it on MSDOS. COMPILER & LIBRARIES I used DJ Delorie's 1.11 distribution of GNU C 2.5.4 to compile the source. The relevant zip files are available on oak.oakland.edu:/pub/msdos/djgpp, omnigate.clarkson.edu:/pub/msdos/djgpp, and probably elsehere. Use archie for a site near you. djeoe111.zip (Minimum runtime stuff - required) djdev111.zip (Minimum development stuff - required) gcc254bn.zip (The C compiler - required) gas211bn.zip (The assembler - required) bnu22bn.zip (The linker etc - required) bsn121bn.zip (bison exe if you rebuild TclX from scratch) mak369bn.zip (make exe) qddvx102.zip (Desqview/X libraries for GNU C, X11 + sockets) There's lots of other zip files: sources, docs, graphic libs, curses, flex, etc. You may want to grab more of these goodies for your own use. The final executables are made by appending the linker output to the go32.exe program. Thus, each executable has a copy of go32.exe, and runs without other .exe support. I unpacked all of the Delorie GNU files in c:\djgpp. I'm also including Delorie's README in the zip files. TCL 7.3 SOURCE CHANGES I configured the Makefile by hand. The `all' target compiles all the source, builds libtcl.a, and then links tclsh.exe. MSDOS has a limit of 128 characters on a command line. To circumvent this problem with command line defines, I made a file `tclmsdos.h' that contains most of the configuration defines. I hacked the "exec" command quite heavily (tclunixa.c). MSDOS lacks Unix styles pipes, but I wanted to make "exec" work mostly like Unix for stdin/stdout. I used a system() library call, and redirect stdin/stdout to temp files, writing and reading the temp files before and after exec as needed. This seems to work for most simple things; exec's output (if not redirect) will come back as the interpreter result, and Tcl variables can be used for stdin, e.g.: set dirlist [exec dir] set odout [exec od -c << $dirlist] I didn't try doing the same for "open" redirection. "set fd [open |dir r]" will fail because pipe() is just a dummy call in the C library. Other places I had to hack were in tclunixu.c, so that Tcl_EvalFile wouldn't complain if the amount of file read is less that the file's stat() size. The reason being MSDOS text lines are normally ended with CR NL, and the library crunches this to just NL during read() unless you set _fmode. Other small changes were made to satisfy GNU C or DJ's C library. TCLX 7.3a SOURCE CHANGES Since one of TclX's main features is access to Unix system calls, you should expect that much of that is missing or just doesn't work. Some other system calls are faked by the C library to return constant results, so the TclX commands that invoke these system calls just return error. A few other TclX system-type commands return "NOOP" if invoked. TclX's top level Makefile is unfinished. I customized src/Makefile and tksrc/Makefile by hand. Just as in UCB Tcl, I tweaked many items in tclxconf.h instead of passing cc command line arguments. I also installed TclX library code by hand. Much of the porting effort was done to get TclX packages working, due to the MSDOS 8 + 3, case insensitive filesnames. Packages in MSDOS have an extension of ".tli", with indexes of ".tnd". This was really a pain to track down, mostly in tclXlib.c. Tclxunix.c was gutted for commands that have no meaning in MSDOS (nice, alarm, chroot, etc. Signal handling had to be excised from several files, because of the way TclX handles signals. There's still quite a usable bit of code in TclX: echo, for_*, loop, convertclock/fmtclock/getclock, sleep, scancontext, extra list commands, keyed lists, ctype string commands, help. TK 3.6 SOURCE CHANGES What pleasant surprise! Porting here was very easy. A few things I changed are: Use a default display name of ":0.0" if none was specified on the command line, add the defines as tkmsdos.h, and added the patch to tkTextDisp.c recently posted (12/15/93). The first time I type "wish" under Desqview/X and saw that familiar beige window I was quite amazed. TESTING: Minimal, at best. Anything that relies on Unix features won't work, but the core Tcl tests pass fine. Notable problems are: "expr", usual math lib problems related to old BSD library code; "format", (same). Wish and Wishx run the "widget" demo. A small change was made to the demo directory "tclindex" file because of MSDOS filenames. KNOWN PROBLEMS: I can't seem to get wish/wishx to read commands from stdin when started in a Desqview/X Dos window.