DEFSTRUCT
The :PRINT-FUNCTION
option should contain a lambda expression
(
This lambda expression names a LAMBDA
(object stream depth) (declare (ignore depth)) ...)FUNCTION
whose task is to output the
external representation of the STRUCTURE-OBJECT
object
onto the
STREAM
stream
. This may be done by outputting text onto the
stream using WRITE-CHAR
, WRITE-STRING
, WRITE
, PRIN1
, PRINC
,
PRINT
, PPRINT
, FORMAT
and the like.
The following rules must be obeyed:
*PRINT-ESCAPE*
must be
respected.*PRINT-PRETTY*
is up to you.
*PRINT-CIRCLE*
need not be
respected. This is managed by the system. (But the print-circle
mechanism handles only those objects that are direct or indirect
components of the structure.)*PRINT-LEVEL*
is respected by
WRITE
, PRIN1
, PRINC
, PRINT
, PPRINT
, FORMAT
instructions
~A
, ~S
, ~W
, and FORMAT
instructions
~R
, ~D
, ~B
, ~O
, ~X
, ~F
,
~E
, ~G
, ~$
with not-numerical arguments.
Therefore the print-level mechanism works automatically if only these
functions are used for outputting objects and if they are not called
on objects with nesting level > 1. (The print-level mechanism does
not recognize how many parentheses you have output. It only counts how
many times it was called recursively.)*PRINT-LENGTH*
must be respected,
especially if you are outputting an arbitrary number of components.
*PRINT-READABLY*
must be
respected. Remember that the values of *PRINT-ESCAPE*
,
*PRINT-LEVEL*
, *PRINT-LENGTH*
are ignored if
*PRINT-READABLY*
is true. The value of *PRINT-READABLY*
is
respected by PRINT-UNREADABLE-OBJECT
, WRITE
, PRIN1
, PRINC
,
PRINT
, PPRINT
, FORMAT
instructions ~A
, ~S
,
~W
, and FORMAT
instructions ~R
, ~D
,
~B
, ~O
, ~X
, ~F
, ~E
,
~G
, ~$
with not-numerical arguments. Therefore
*PRINT-READABLY*
will be respected automatically if only these
functions are used for printing objects.*PRINT-BASE*
, *PRINT-RADIX*
, *PRINT-CASE*
,
*PRINT-GENSYM*
, *PRINT-ARRAY*
, CUSTOM:*PRINT-CLOSURE*
,
CUSTOM:*PRINT-RPARS*
, CUSTOM:*PRINT-INDENT-LISTS*
.The :INHERIT
option is exactly like :INCLUDE
except that it
does not create new accessors for the inherited slots (this is a
CLISP extension).
These notes document CLISP version 2.49 | Last modified: 2010-07-07 |