XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next

:tmacro


Type:   -   keyword
Source:   -   xlread.c

Syntax

(:tmacro . function)
function - a function

Description

':tmacro' is an entry that is used in the *readtable* system variable that contains XLISP's data structures relating to the processing of characters from the user [or files] and read-macro expansions. The existance of the ':tmacro' keyword means that the specified character is the start of a terminal read macro. For ':tmacro', the form of the *readtable* entry is a dotted pair like:

(:tmacro . function)

The 'function' can 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. The 'function' will probably read additional characters from the input stream.

Examples

(defun look-at (table)                ; define a function to look in a table
  (dotimes (ch 127)                   ; and print out any :TMACRO entries
    (prog ((entry (aref table ch)))
      (if (and (consp entry)
               (equal (car entry) ':TMACRO))
          (princ (int-char ch)))))
  (terpri))

(look-at *readtable*)                 ;  prints "'(),;`

Note: The system defines that the following are ':tmacro' characters:

   \  "  `  ,  ( )  ;

[backslash, double quote, backquote, comma, opening parenthesis, closing parenthesis, semicolon.]

Caution: If you experiment with *readtable* , it is useful to save the old value in a variable, so that you can restore the system state.

See the :tmacro keyword in the XLISP 2.0 manual.

  Back to Top


XLISP > XLISP 2.0  -  Contents  -  Reference  -  Previous | Next