|Title:||Summary of Changes to Generic Tcl/Tk Code to Enable Mac OS X Port|
|Version:||$Revision: 1.2 $|
|Author:||Jim Ingham <jingham at apple dot com>|
|Created:||Thursday, 29 August 2002|
The submission of the changes to generic Tcl/Tk necessary for the Mac OS X port was discussed on the Tcl Core mailing list. In light of the very minor changes to shared code involved, and to facilitate including the port in the 8.4 release, it was decided that we would not hold a formal vote. This informational TIP is offered to summarize the work done, however, and to maintain a more complete record.
These fall into two parts: macosx only changes, and changes that effect generic code.
The Mac OS X-only changes again fall into two parts. On the one hand, we introduced new macosx directories to the Tcl and Tk trees, at the same level as the win, unix and mac directories. At present, the tcl/macosx directory only contains one .c file and a project file. The tk/macosx directory is much more substantial. This set of changes manifestly only effects this port, and since something is better than nothing, should be uncontroversial.
The other Mac OS X-only part is the addition of Mac OS X specific elements to the .decls files. This should also be uncontroversial, though I had to add some slightly non-trivial code to the genStubs.tcl file to handle the fact that Tk loosely uses "unix" to mean "X11", which for Mac OS X is not the case.
The Tcl side of Mac OS X is clearly unix, but the same Tcl can in fact be used with X11 (there is a native X Server in quite common use on Mac OS X) and with the Aqua based Tk port.
In the end, however, the stubs generated for the generic, mac, win & X11 parts of Tcl/Tk are the same, and there is just some extra logic for the aqua part, so the result effects only Mac OS X code.
The generic code changes are quite small - a testament to the design of the Tcl/Tk porting layers.
We changed the configure.in, Makefile.in and tcl.m4 to handle building Tcl in a the Framework form that is common on Mac OS X.
I added a bit of code (conditionalized to Mac OS X) to tclUnixInit.c (in the TclpSetVariables function) to support looking for script files embedded in the Mac OS X Framework bundle. This fits the Mac OS X model better than putting files in /usr/local or such-like.
I added a few more elements to the notifierProcPtr. For the aqua Tk, we need to swap the Unix notifier with our own, and so we needed more control over the notifier than was allowed. This change has no effect if you don't use it, however.
I added a function, TkGetFirstTextLayout, which gets the run of text up the the first wrap. I have to get this because the Mac OS X button control doesn't like a newline in the button text. It is a private function, however, so it doesn't cause any incompatibilities.
We had to change various places in the Tk script code and the demos where the implicit assumption was made that [string equal $tcl_platform(platform) "unix"] meant you were using X11. To this end, we will add a windowingsystem subcommand to the tk command, and then using it to replace the cases where tcl_platform was being erroneously checked. This command will return "x11" for an X11 server, "aqua" for the native Mac OS X window manager, "win32" for Windows, and "classic" for Classic MacOS.
The reference implementation is on the macosx-8-4-branch in the SourceForge CVS repository.
This document has been placed in the public domain.
[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]TIP AutoGenerator - written by Donal K. Fellows