type: defined function (closure) location: extension source file: init.lsp Common LISP compatible: related supported on: all machines
(get-macro-character <char-num> ) <char-num> - an integer expression
The GET-MACRO-CHARACTER function returns the code that will be executed when the specified character <char-num> is encountered by the XLISP reader. The returned value is taken from 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 GET-MACRO-CHARACTER function will return a NIL value if the table entry is NIL, :CONSTITUENT, :SESCAPE, :MESCAPE or :WHITE-SPACE. If the table entry is :TMACRO or :NMACRO, then the code associated with the entry is returned. :TMACRO is used for a terminating read-macro. :NMACRO is used for a non-terminating read-macro. GET-MACRO-CHARACTER does not differentiate whether the code returned is a :TMACRO or an :NMACRO. The function returned may be a built-in read-macro function or a user defined 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.
(get-macro-character #\( ) ; returns #<Subr-: #2401e> (get-macro-character #\# ) ; returns #<Subr-: #24082> (get-macro-character #\Space ) ; returns NIL
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 COMPATIBILITY: The GET-MACRO-CHARACTER function is somewhat related to the Common LISP GET-DISPATCH-MACRO-CHARACTER function.