TclAE

TclAE is a Tcl extension giving Tcl access to the Apple Event Manager, it is written by Jon Guyer and distributed as open-source under the BSD Licence.

TclAE is at the core of Alpha8's interaction with the rest of the machine, in Alpha, TclAE's routines are simulated in Tcl.


Jon Guyer's post to the mac-tcl list:

I've just posted my Tcl-AppleEvent shared library at

   http://www.his.com/jguyer/Alpha/TclAE2b7.sit.bin

TclAE enables Tcl applications on the Macintosh to use AppleEvents for communication with other programs and for the AppleEvent Manager to communicate with Tcl applications.

The nature of the MacOS (at least prior to MacOS X) makes it impossible to implement any meaningful exec command. Between agreeable applications, however, AppleEvents allow communication of anything that can be passed as an argument to a command-line application, and much more. The key is to make the applications agreeable. TclAE is an attempt to get Tcl to support its end of the bargain.

TclAE is complementary to Jim Ingham's Tclapplescript.shlb (included in the Tcl distributions). Depending on your task and your relative familiarity with AppleScript and raw AppleEvents, you may find one tool or the other preferable.

Caveat emptor: Despite the version number, this is the first public beta release of this shared library. _Please_ tell me about any problems (or successes) you encounter. Carbon is (hopefully) forthcoming and CFM68k is completely untested.

TclAE is released under the BSD license.


From TclAE Help:

TclAE - What is it?

TclAE enables Tcl applications on the Macintosh to use AppleEvents for communication with other programs and for the AppleEvent Manager to communicate with Tcl applications. The nature of the MacOS (at least prior to MacOS X) makes it impossible to implement any meaningful exec command. Between agreeable applications, AppleEvents allow communication of anything that can be passed as an argument to a command-line application and much more. The key is to make the applications agreeable. TclAE is an attempt to get Tcl to support its end of the bargain. TclAE is complementary to Jim InghamAE's Tclapplescript.shlb (included in the Tcl distributions). Depending on your task and your relative familiarity with AppleScript and raw AppleEvents, you may find one tool or the other preferable.

TclAE inherits directly from the AppleEvent facilities in the Alpha text editor, as written by Pete Keleher and Tim Endres. For many years, Alpha has used Jens AlfkeAE's AEGizmos to render the pathologically-typed binary data in AppleEvents into a Tcl-manageable string form. Unfortunately, while AEGizmos are reasonably easy for humans to read, they're not the most convenient format for a computer to interpret. Alpha programmers wishing to interact with other programs have generally applied regular expressions to these strings (with varying degrees of success), in order to extract the information they were interested in. Several years ago, I got tired of writing the same regexp expressions and sanity checks over and over, so I set out to write a complete AEGizmo parser. This parser, in one form or another, has been a part of Alpha for a few years.

While this Tcl-based AEGizmo parser works well, it can be incredibly slow. A while back, a small group of AlphaAE's users and I formed the Alpha Cabal to assume development tasks from AlphaAE's originator, Pete Keleher (Pete has irresponsibly decided to procreate and pursue tenure, rather than work on Alpha like heAE's supposed to). One of my prime interests was in improving AlphaAE's AppleEvent capabilities. After some initial efforts at speeding up the parser, my dain bramage cleared up and I set out to simply expose as much of the AppleEvent Manager API to Tcl as possible. By avoiding the parsing step, speedups of a hundred-fold are typical. As the project progressed, it became clear that this could be a useful tool for any Tcl-based program, so I generalized the shared library to work with any Tcl 8 installation, and Pete generously agreed to let me open-source what was left of his code. Many of the design decisions in TclAE (see Memory Leaks) reflect the need to achieve (nearly) the same results with Alpha 7, Alpha 8, and Wish.


Copyright (c) 1999-2000 Jonathan E. Guyer All rights reserved.

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that the copyright notice and warranty disclaimer appear in supporting documentation.

The Authors disclaim all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the Authors be liable for any special, indirect or consequential damages or any damages whatsoever resulting from loss of use, data or profits, whether in an action of contract, negligence or other tortuous action, arising out of or in connection with the use or performance of this software.


[ das 1/4/01 ]

Category Software