brown@hydra2e.cs.utk.edu (Lance A. Brown) (09/20/90)
Is there any means of accessing and inserting READmacro stuff in Xlisp 2.1 on the PC? I am interested in doing some readmacro work with Xlisp, but cannot figure out how to modify the *READTABLE*. -- ------------------------------------------------------------------------------ Lance A. Brown brown@cs.utk.edu 3500 Sutherland Avenue, Apt. L-303 Graduate Student in Computer Science Knoxville, TN 37919 Sun SparcStaions are Neat! ------------------------------------------------------------------------------
tim@hpfcbig.SDE.HP.COM (Tim Mikkelsen) (09/21/90)
set-macro-character ________________________________________________________________________ type: defined function (closure) location: extension source file: init.lsp Common LISP compatible: related supported on: all machines SYNTAX (set-macro-character <char-num> <function> [ <termflag> ] ) <char-num> - an integer expression <function> - a function definition <termflag> - an expression - NIL or non-NIL DESCRIPTION The SET-MACRO-CHARACTER function installs the code that will be executed when the specified character <char-num> is encountered by the XLISP reader. The <function> is placed in the *READTABLE* system variable which contains the reader table array. The table is 128 entries (0..127) for each of the 7-bit ASCII characters that XLISP can read. Each entry in the table must be one of NIL, :CONSTITUENT, :SESCAPE, :MESCAPE, :WHITE-SPACE, a :TMACRO dotted pair or a :NMACRO dotted pair. The SET-MACRO-CHARACTER function only allows you to put in a terminating read-macro function (:TMACRO) or a non-terminating read-macro-function (:NMACRO). If the <termflag> is present and non-NIL, then the <function> will be put in *READTABLE* as a :TMACRO entry. If <termflag> is not present or NIL, then <function> will be put in *READTABLE* as a :NMACRO entry. The <function> can be a built-in read-macro function or a user defined defun symbol or a lambda expression. The <function> takes two parameters, an input stream specification, and an integer that is the character value. The <function> should return NIL if the character is 'white-space' or a value CONSed with NIL to return the value. The function SET-MACRO-CHARACTER always returns T. EXAMPLES (print "hi") % comment ; prints "hi" and gives ; error: unbound variable - % ; because percent is viewed ; as a variable ; (setq semi (get-macro-character #\;)) ; get semi-colon code ; (SET-MACRO-CHARACTER #\% semi T) ; set % to work as a comment ; (print "hi") % comment ; prints "hi" and no error ; because % is now a comment ; character in *READTABLE* NOTE: In the normal XLISP system the following characters have code associated with them in the *READTABLE*: " # ' ( ) , ; ` NOTE: The functions GET-MACRO-CHARACTER and SET-MACRO-CHARACTER are created in the INIT.LSP file. If they do not exist in your XLISP system, you might be having a problem with INIT.LSP. Before you start XLISP, look in the directory you are currently in, and check to see if there is an INIT.LSP. COMMON LISP COMPATABILITY: The SET-MACRO-CHARACTER function is somewhat related to the Common LISP SET-DISPATCH-MACRO-CHARACTER function.
tim@hpfcbig.SDE.HP.COM (Tim Mikkelsen) (09/21/90)
The previous entry is for xlisp 2.0. I would hope (but have not checked) that this would be the same in 2.1. Tim M