Tintware Documentation : Tint Emacs : TRACTRACTint can now run TRAC programs. The support is based on the Specification of the TRAC T2001 Programming Language last revised 9/01/2001. See The TRAC Foundation for more information. At this point, the easiest way to get at the TRAC support is through Tint Emacs. The command M-x trac-interaction will create a buffer and put it in TRAC Interaction mode. In this mode, C-j (which is bound to eval-print-last-trac-sexp) will evaluate the expression before the point and print the result in the buffer. M-Tab (which is bound to trac-complete-symbol) will complete the symbol before the point if possible. Finally, C-c ; (which is bound to trac-eval-region) will evaluate the region as TRAC code and C-c : (which is bound to trac-eval-current-buffer) will evaluate the current buffer as TRAC code. If you want to stop your script prematurely, such as if it gets into an infinite loop, press Esc Esc Esc. All of the TRAC primitives are supported (as defined in the above mentioned specification) except for ps and all of the bit manipulation primitives. The goal is to make the primitives work exactly the same as specified. This goal will never be reached in a couple of places. The memory layout is different; Tint arranges nodes alphabetically rather than using a LIFO (or visa versa) layout. This is a consequence of two different implementations. The file layout is different. Again this is a consequence of two different implementations. Finally, the only limit there is on the number of channels that you can have open is memory. :(fg123456,foo.bar) is perfectly legal, though very inefficient since in Tint arrays are not sparse. There could easily be a limit on the number of channels, but it is less work not to have a limit and besides, the limit seems pretty arbitrary. The input from channel (i) primitive deserves a bit of explination. When the primitive is encountered, the current location of the point in the current buffer is saved in a marker. The meta character is temporarily bound to exit-recursive-edit in the current mode. The dump character is temporarily bound to trac-input-dump. Finally, Tint Emacs goes into a recursive edit. Within the recursive edit, you can do pretty much anything you want. When the recursive edit ends and if was not aborted, everything between the marker and the current location of point is considered to be the input. If a number of characters was specified, then only that many characters are returned. Whether or not a number was specified, inputting continues until the meta character or M-C-c is pressed. Aborting the recursive edit (via C-] or M-x top-level) will also abort your TRAC script. The TRAC primitives are implemented in Tint; see the file trac.tnt. The TRAC primitives are defined in the Tint namespace at trac.primitives and trac.forms contains all TRAC forms that you have defined. When the TRAC interpreter evaluates an expression and needs to determine whether a name is the name of a primitive or the name of a form, first it checks trac.primitives and then it checks in trac.forms. Adding more TRAC primitives should be reasonably straight forward. Calling TRAC primitives is a bit complex since the i, d, and channel suffixes must be dealt with. Before calling a TRAC primitive all of the suffixes are stripped and saved in the current context. $.trac-suffix will return the suffix used to call the primitive; if no suffix was specified, then p will be returned. $.no-trac-channel will return an empty result if there was a channel explicitly specified. $.channel will return the channel; if no channel was explicitly specified, then 1 will be returned. The Tint primitive, trac.mm takes the same arguments as the TRAC primitive mm except the formname can be anywhere in the Tint namespace. To evaluate some TRAC code from Tint, use trac.evaluate; it takes a single argument, the code to be evaluated. Tint procedures can arbitrarily call TRAC macros. TRAC macros can call Tint procedures only if they are defined in trac.primitives or trac.forms. For example, define a TRAC macro (in a TRAC Interaction buffer). :(mm,example,(:(aa,<1>,<2>))) And then evaluate the follwing Tint expression (in a Tint Interaction buffer). #(trac.forms.example,10,20) You should get 30 as the result. |