Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!sdd.hp.com!hplabs!hpfcso!hpfcbig!tim From: tim@hpfcbig.SDE.HP.COM (Tim Mikkelsen) Newsgroups: comp.lang.lisp.x Subject: Re: Accessing READTABLE in Xlisp 2.1 Message-ID: <1170011@hpfcbig.SDE.HP.COM> Date: 21 Sep 90 02:57:54 GMT References: <1990Sep20.003513.14808@cs.utk.edu> Organization: HP SESD, Fort Collins, CO Lines: 68 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 [ ] ) - an integer expression - a function definition - an expression - NIL or non-NIL DESCRIPTION The SET-MACRO-CHARACTER function installs the code that will be executed when the specified character is encountered by the XLISP reader. The 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 is present and non-NIL, then the will be put in *READTABLE* as a :TMACRO entry. If is not present or NIL, then will be put in *READTABLE* as a :NMACRO entry. The can be a built-in read-macro function or a user defined defun symbol or a lambda expression. The takes two parameters, an input stream specification, and an integer that is the character value. The 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.