home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / CLISP / _CLISP.TAR / usr / doc / clisp / impnotes.txt < prev    next >
Encoding:
Text File  |  1995-01-16  |  87.5 KB  |  2,430 lines

  1.                 Implementation Notes for CLISP
  2.                 ==============================
  3.                 Last modified: 8 December 1994.
  4.  
  5. This implementation is mostly compatible to the standard reference
  6.  
  7.        Guy L. Steele Jr.: Common Lisp - The Language (1st ed.).
  8.        Digital Press 1984, 465 pages.
  9.        ("CLtL1" for short)
  10.  
  11. and to the older parts of
  12.  
  13.        Guy L. Steele Jr.: Common Lisp - The Language (2nd ed.).
  14.        Digital Press 1990, 1032 pages.
  15.        ("CLtL2" for short)
  16.  
  17.  
  18. These notes document the differences of the CLISP implementation of Common
  19. Lisp to the standard CLtL1, and some implementation details.
  20.  
  21. The differences between CLtL1 and CLtL2 are made up of X3J13 votes. CLISP's
  22. position with respect to these votes is listed in cltl2.txt.
  23.  
  24.  
  25.                       CHAPTER 1: Introduction
  26.                       -----------------------
  27.  
  28. No notes.
  29.  
  30.  
  31.                        CHAPTER 2: Data Types
  32.                        ---------------------
  33.  
  34. All the data types are implemented: numbers, characters, symbols, lists,
  35. arrays, hash tables, readtables, packages, pathnames, streams, random
  36. states, structures and functions.
  37.  
  38. 2.1.3.
  39. ------
  40.  
  41. There are four floating point types: short-float, single-float, double-float
  42. and long-float:
  43.                   sign    mantissa   exponent
  44.    short-float    1 bit   16+1 bits   8 bits
  45.    single-float   1 bit   23+1 bits   8 bits   CLISP uses IEEE format
  46.    double-float   1 bit   52+1 bits  11 bits   CLISP uses IEEE format
  47.    long-float     1 bit   >=64 bits  32 bits
  48.  
  49. The single and double float formats are those of the IEEE standard (1981),
  50. except that CLISP does not support features like +0, -0, +inf, -inf, gradual
  51. underflow, NaN, etc. (Common Lisp does not make use of these features.)
  52.  
  53. Long floats have variable mantissa length, which is a multiple of 16 (or 32,
  54. depending on the word size of the processor). The default length used when
  55. long floats are read is given by the place (LONG-FLOAT-DIGITS). It can be
  56. set by (SETF (LONG-FLOAT-DIGITS) nnn), where nnn is a positive integer.
  57.  
  58. 2.1.4.
  59. ------
  60.  
  61. Complex numbers can have a real part and an imaginary part of different
  62. types. For example, (SQRT -9.0) evaluates to the number #C(0 3.0), which has
  63. a real part of exactly 0, not only 0.0 (which would mean "approximately 0").
  64. The type specifier for this is (COMPLEX INTEGER SINGLE-FLOAT), and
  65.  
  66.            (COMPLEX type-of-real-part type-of-imaginary-part)
  67.  
  68. in general.
  69. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  70.  
  71. 2.2.1.
  72. ------
  73.  
  74. The characters are ordered according to the ASCII encoding.
  75.  
  76. #ifdef ATARI_CHS
  77. More precisely, CLISP uses the Atari character set:
  78.              $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F
  79.          $00 **             ** ** ** ** ** ** ** ** **      
  80.          $10                               ** **            
  81.          $20     !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /
  82.          $30  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
  83.          $40  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
  84.          $50  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
  85.          $60  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
  86.          $70  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~  
  87.          $80  ╟  ⁿ  Θ  Γ  Σ  α  σ  τ  Ω  δ  Φ  ∩  ε  ∞  ─  ┼
  88.          $90  ╔  µ  ╞  ⌠  ÷  ≥  √  ∙     ╓  ▄  ó  ú  Ñ  ▀   
  89.          $A0  ß  φ  ≤  ·  ±  ╤  ¬  ║  ┐     ¼  ╜  ╝  í  ½  ╗
  90.          $B0  π  ⌡  ╪  °        └  ├  ╒  ¿  ┤  +  ╢  ⌐  «   
  91.          $C0                                                
  92.          $D0                                         º      
  93.          $E0                    ╡                           
  94.          $F0     ▒              ≈     ░              ▓  │  »
  95. Here ** are control characters, not graphic characters. (The characters left
  96. blank here cannot be represented in this character set).
  97.  
  98. #endif
  99. #ifdef IBMPC_CHS
  100. More precisely, CLISP uses the IBM PC character set (code page 437):
  101.              $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F
  102.          $00 **                   ** ** ** ** ** ** **  ╢  º
  103.          $10                               ** **            
  104.          $20     !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /
  105.          $30  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
  106.          $40  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
  107.          $50  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
  108.          $60  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
  109.          $70  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~  
  110.          $80  ╟  ⁿ  Θ  Γ  Σ  α  σ  τ  Ω  δ  Φ  ∩  ε  ∞  ─  ┼
  111.          $90  ╔  µ  ╞  ⌠  ÷  ≥  √  ∙     ╓  ▄  ó  ú  Ñ      
  112.          $A0  ß  φ  ≤  ·  ±  ╤  ¬  ║  ┐     ¼  ╜  ╝  í  ½  ╗
  113.          $B0                                                
  114.          $C0                                                
  115.          $D0                                                
  116.          $E0     ▀              ╡                           
  117.          $F0     ▒              ≈     ░     ╖        ▓      
  118. Here ** are control characters, not graphic characters. (The characters left
  119. blank here cannot be represented in this character set).
  120.  
  121. #endif
  122. #ifdef ISOLATIN_CHS
  123. More precisely, CLISP uses the ISO Latin-1 (ISO 8859-1) character set:
  124.              $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F
  125.          $00 ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **
  126.          $10 ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **
  127.          $20     !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /
  128.          $30  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
  129.          $40  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
  130.          $50  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
  131.          $60  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
  132.          $70  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~   
  133.          $80                                                
  134.          $90                                                
  135.          $A0  á  í  ó  ú  ñ  Ñ  ª  º  ¿  ⌐  ¬  ½  ¼  ¡  «  »
  136.          $B0  ░  ▒  ▓  │  ┤  ╡  ╢  ╖  ╕  ╣  ║  ╗  ╝  ╜  ╛  ┐
  137.          $C0  └  ┴  ┬  ├  ─  ┼  ╞  ╟  ╚  ╔  ╩  ╦  ╠  ═  ╬  ╧
  138.          $D0  ╨  ╤  ╥  ╙  ╘  ╒  ╓  ╫  ╪  ┘  ┌  █  ▄  ▌  ▐  ▀
  139.          $E0  α  ß  Γ  π  Σ  σ  µ  τ  Φ  Θ  Ω  δ  ∞  φ  ε  ∩
  140.          $F0  ≡  ±  ≥  ≤  ⌠  ⌡  ÷  ≈  °  ∙  ·  √  ⁿ  ²  ■   
  141. Here ** are control characters, not graphic characters. (The characters left
  142. blank here cannot be represented in this character set).
  143.  
  144. #endif
  145. #ifdef NEXTSTEP_CHS
  146. More precisely, CLISP uses the NextStep character set:
  147.              $0 $1 $2 $3 $4 $5 $6 $7 $8 $9 $A $B $C $D $E $F
  148.          $00 ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **
  149.          $10 ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **
  150.          $20     !  "  #  $  %  &  '  (  )  *  +  ,  -  .  /
  151.          $30  0  1  2  3  4  5  6  7  8  9  :  ;  <  =  >  ?
  152.          $40  @  A  B  C  D  E  F  G  H  I  J  K  L  M  N  O
  153.          $50  P  Q  R  S  T  U  V  W  X  Y  Z  [  \  ]  ^  _
  154.          $60  `  a  b  c  d  e  f  g  h  i  j  k  l  m  n  o
  155.          $70  p  q  r  s  t  u  v  w  x  y  z  {  |  }  ~   
  156.          $80  á  └  ┴  ┬  ├  ─  ┼  ╟  ╚  ╔  ╩  ╦  ╠  ═  ╬  ╧
  157.          $90  ╨  ╤  ╥  ╙  ╘  ╒  ╓  ┘  ┌  █  ▄  ▌  ▐  ╡  ╫  ≈
  158.          $A0  ⌐  í  ó  ú     Ñ     º  ñ        ½            
  159.          $B0  «           ╖  ª  ╢              ╗        ¼  ┐
  160.          $C0  ╣     ┤        »        ¿  ▓  ░  ╕  │         
  161.          $D0     ▒  ╝  ╜  ╛  α  ß  Γ  π  Σ  σ  τ  Φ  Θ  Ω  δ
  162.          $E0  ∞  ╞  φ  ¬  ε  ∩  ≡  ±     ╪     ║  ≥  ≤  ⌠  ⌡
  163.          $F0  ÷  µ  ∙  ·  √     ⁿ  ²     °     ▀  ■         
  164. Here ** are control characters, not graphic characters. (The characters left
  165. blank here cannot be represented in this character set).
  166.  
  167. #endif
  168. The following are standard characters:
  169.   #\Space               $20
  170.   #\Newline             $0A
  171. The following are semi-standard characters:
  172.   #\Backspace           $08
  173.   #\Tab                 $09
  174.   #\Linefeed            $0A
  175.   #\Page                $0C
  176.   #\Return              $0D
  177. #if defined(ATARI_CHARNAMES) || defined(MSDOS_CHARNAMES)
  178.   #\Rubout              $08
  179. #endif
  180. #if defined(UNIX_CHARNAMES) || defined(AMIGA_CHARNAMES)
  181.   #\Rubout              $7F
  182. #endif
  183.  
  184. 2.2.2.
  185. ------
  186.  
  187. #\Newline is the delimiter between lines.
  188.  
  189. #if defined(ATARI) || defined(MSDOS)
  190. When writing to a file, #\Newline is converted to CR/LF. (This is the usual
  191. convention on ATARI and DOS.) For example, #\Return #\Newline is written
  192. as CR/CR/LF.
  193. #endif
  194. When reading from a file, CR/LF is converted to #\Newline, and CR not
  195. followed by LF is read as #\Return.
  196.  
  197. 2.2.3.
  198. ------
  199.  
  200. There are the following additional characters with names:
  201.   #\Null                $00
  202.   #\Bell                $07
  203.   #\Escape              $1B
  204.  
  205. 2.2.4.
  206. ------
  207.  
  208. The code of a character is >=0, <256. CHAR-CODE-LIMIT = 256.
  209.  
  210. There are fonts 0 to 15, and CHAR-FONT-LIMIT = 16. But the system itself
  211. uses only font 0.
  212.  
  213. The following bits attributes are implemented: :CONTROL, :META, :SUPER,
  214. :HYPER. Therefore CHAR-BITS-LIMIT = 16.
  215. #ifdef KEYBOARD
  216. The system itself uses these bits only to mention special keys and
  217. Control/Alternate/Shift key status on return from
  218. (READ-CHAR *KEYBOARD-INPUT*).
  219. #endif
  220.  
  221. 2.5.
  222. ----
  223.  
  224. The maximum rank (number of dimensions) of an array is 65535 on 16-bit
  225. processors, 4294967295 on 32-bit processors.
  226.  
  227. 2.13.
  228. -----
  229.  
  230. All the functions built by FUNCTION, COMPILE and the like are atoms. There
  231. are built-in functions written in C, compiled functions (both of type
  232. COMPILED-FUNCTION) and interpreted functions (of type FUNCTION).
  233. The possible function names (CLtL1 p. 59) are symbols and lambda expressions.
  234.  
  235. 2.14.
  236. -----
  237.  
  238. This is the list of objects whose external representation can not be
  239. meaningfully read in:
  240.   * all structures lacking a keyword constructor.
  241.   * all arrays except strings, if *PRINT-ARRAY* = NIL.
  242.   * #<SYSTEM-FUNCTION name>     built-in function written in C
  243.   * #<FOREIGN-FUNCTION name>    other function written in C
  244.   * #<SPECIAL-FORM name>        special form handler
  245.   * #<COMPILED-CLOSURE name>    compiled function, if *PRINT-CLOSURE* = NIL
  246.   * #<CLOSURE name ...>         interpreted function
  247.   * #<FRAME-POINTER #x...>      pointer to a stack frame
  248.   * #<DISABLED POINTER>         frame pointer which has become invalid on
  249.                                 exit from the corresponding BLOCK or TAGBODY
  250.   * #<...-STREAM ...>           stream
  251.   * #<PACKAGE name>             package
  252.   * #<HASH-TABLE #x...>         hash table, if *PRINT-ARRAY* = NIL
  253.   * #<READTABLE #x...>          readtable
  254.   * #<UNBOUND>                  "value" of a symbol without value, "value"
  255.                                 of an unsupplied optional or keyword argument
  256.   * #<SPECIAL REFERENCE>        environment marker for variables declared
  257.                                 SPECIAL
  258.   * #<DOT>                      internal READ result for "."
  259.   * #<END OF FILE>              internal READ result, when the end of file
  260.                                 is reached
  261.   * #<READ-LABEL ...>           intermediate READ result for #n#
  262.   * #<ADDRESS #x...>            machine address, should not occur
  263.   * #<SYSTEM-POINTER #x...>     should not occur
  264.  
  265. 2.15.
  266. -----
  267.  
  268. The type NUMBER is the disjoint union of the types REAL and COMPLEX. (CLtL
  269. wording: "exhaustive partition")
  270. The type REAL is the disjoint union of the types RATIONAL and FLOAT.
  271. The type RATIONAL is the disjoint union of the types INTEGER and RATIO.
  272. The type INTEGER is the disjoint union of the types FIXNUM and BIGNUM.
  273. The type FLOAT is the disjoint union of the types SHORT-FLOAT, SINGLE-FLOAT,
  274. DOUBLE-FLOAT and LONG-FLOAT.
  275.  
  276.  
  277.                      CHAPTER 3: Scope and Extent
  278.                      ---------------------------
  279.  
  280. is implemented as described.
  281.  
  282.  
  283.                       CHAPTER 4: Type Specifiers
  284.                       --------------------------
  285.  
  286. 4.4.
  287. ----
  288.  
  289. The CLtL2 type specifier (EQL object) denotes the singleton set {object}.
  290.  
  291. 4.5.
  292. ----
  293.  
  294. The general form of the COMPLEX type specifier is
  295. (COMPLEX type-of-real-part type-of-imaginary-part).
  296. The type specifier (COMPLEX type) is equivalent to (COMPLEX type type).
  297.  
  298. 4.6.
  299. ----
  300.  
  301. The CLtL2 type specifier (REAL low high) denotes the real numbers between low
  302. and high.
  303.  
  304. 4.7.
  305. ----
  306.  
  307. DEFTYPE lambda lists are subject to destructuring (nested lambda lists are
  308. allowed, as in DEFMACRO) and may contain a &WHOLE marker, but no
  309. &ENVIRONMENT marker.
  310.  
  311. 4.9.
  312. ----
  313.  
  314. The possible results of TYPE-OF are:
  315.  CONS
  316.  SYMBOL NULL
  317.  FIXNUM BIGNUM RATIO SHORT-FLOAT SINGLE-FLOAT DOUBLE-FLOAT LONG-FLOAT COMPLEX
  318.  CHARACTER
  319.  (ARRAY element-type dimensions), (SIMPLE-ARRAY element-type dimensions)
  320.  (VECTOR T size), (SIMPLE-VECTOR size)
  321.  (STRING size), (SIMPLE-STRING size)
  322.  (BIT-VECTOR size), (SIMPLE-BIT-VECTOR size)
  323.  FUNCTION COMPILED-FUNCTION
  324.  STREAM PACKAGE HASH-TABLE READTABLE PATHNAME LOGICAL-PATHNAME RANDOM-STATE
  325.  BYTE LOAD-TIME-EVAL SYMBOL-MACRO READ-LABEL FRAME-POINTER SYSTEM-INTERNAL
  326.  ADDRESS (should not occur)
  327.  any other symbol (structure types or CLOS classes)
  328.  a class (CLOS classes without proper name)
  329.  
  330.  
  331.                        CHAPTER 5: Program Structure
  332.                        ----------------------------
  333.  
  334. 5.1.3.
  335. ------
  336.  
  337. In addition to the 24 special forms listed on p. 57 (CLtL2: p. 73), the
  338. CLtL2 special forms LOCALLY, SYMBOL-MACROLET, LOAD-TIME-VALUE are implemented,
  339. and the macros
  340. PSETQ, PROG1, PROG2, WHEN, UNLESS, COND, MULTIPLE-VALUE-LIST,
  341. MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ, AND, OR
  342. are implemented as special forms.
  343.  
  344. Constants may not be bound dynamically or lexically.
  345.  
  346. 5.2.2.
  347. ------
  348.  
  349. LAMBDA-LIST-KEYWORDS =
  350.     (&OPTIONAL &REST &KEY &ALLOW-OTHER-KEYS &AUX &BODY &WHOLE &ENVIRONMENT)
  351.  
  352. LAMBDA-PARAMETERS-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  353. processors.
  354.  
  355. 5.3.
  356. ----
  357.  
  358. DEFUN and DEFMACRO are allowed in non-toplevel positions.
  359. As an example, consider the definition of GENSYM:
  360. (let ((gensym-prefix "G")
  361.       (gensym-count 1))
  362.   (defun gensym (&optional (x nil s))
  363.     (when s
  364.       (cond ((stringp x) (setq gensym-prefix x))
  365.             ((integerp x)
  366.              (if (minusp x)
  367.                (error "~S: index ~S is negative" 'gensym x)
  368.                (setq gensym-count x)
  369.             ))
  370.             (t (error "~S: argument ~S of wrong type" 'gensym x))
  371.     ) )
  372.     (prog1
  373.       (make-symbol
  374.         (concatenate 'string
  375.           gensym-prefix
  376.           (write-to-string gensym-count :base 10 :radix nil)
  377.       ) )
  378.       (incf gensym-count)
  379. ) )
  380.  
  381. 5.3.2.
  382. ------
  383.  
  384. (PROCLAIM '(SPECIAL var)) declarations may not be undone. The same holds
  385. for DEFVAR, DEFPARAMETER and DEFCONSTANT declarations.
  386.  
  387. It is an error if a DEFCONSTANT variable is bound at the moment the
  388. DEFCONSTANT is executed, but DEFCONSTANT does not check this.
  389.  
  390. Constants may not be bound dynamically or lexically.
  391.  
  392. 5.3.3.
  393. ------
  394.  
  395. EVAL-WHEN also accepts the situations (NOT EVAL) and (NOT COMPILE).
  396.  
  397.  
  398.                       CHAPTER 6: Predicates
  399.                       ---------------------
  400.  
  401. 6.2.2.
  402. ------
  403.  
  404. REALP returns T is its argument is a real number, NIL otherwise.
  405.  
  406. COMPILED-FUNCTION-P returns T on built-in functions written in C, compiled
  407. functions and special form handlers. Therefore COMPILED-FUNCTION is not a
  408. subtype of FUNCTION.
  409.  
  410. 6.3.
  411. ----
  412.  
  413. EQ compares characters and fixnums as EQL does. No unnecessary copies are
  414. made of characters and numbers. Nevertheless, one should use EQL.
  415.  
  416. (let ((x y)) (eq x x)) always returns T, regardless of y.
  417.  
  418. 6.4.
  419. ----
  420.  
  421. AND and OR are implemented as special forms and, as such, rather efficient.
  422.  
  423.  
  424.                       CHAPTER 7: Control Structure
  425.                       ----------------------------
  426.  
  427. 7.1.1.
  428. ------
  429.  
  430. #ifdef IMMUTABLE
  431. Attempts to modify read-only data will signal an error. Program text and
  432. quoted constants loaded from files are considered read-only data. This check
  433. is only performed for conses and arrays, not for user-defined data types.
  434.  
  435. #endif
  436. (FUNCTION symbol) returns the local function definition established by FLET
  437. or LABELS, if it exists, otherwise the global function definition.
  438.  
  439. The CLtL2 place (FDEFINITION function-name) is implemented.
  440.  
  441. (SPECIAL-FORM-P symbol) returns NIL or T. If it returns T, then
  442. (SYMBOL-FUNCTION symbol) returns the (useless) special form handler.
  443.  
  444. 7.1.2.
  445. ------
  446.  
  447. PSETQ is implemented as a special form and, as such, rather efficient.
  448.  
  449. 7.2.
  450. ----
  451.  
  452. (SETF (SYMBOL-FUNCTION symbol) object) requires object to be either a
  453. function, a SYMBOL-FUNCTION return value or a lambda expression. A lambda
  454. expression is thereby immediately converted to a function.
  455.  
  456. SETF also accepts places yielding multiple values.
  457.  
  458. Additional places:
  459.  
  460. * FUNCALL:
  461.   (SETF (FUNCALL #'symbol ...) object) and
  462.   (SETF (FUNCALL 'symbol ...) object)
  463.   are equivalent to (SETF (symbol ...) object).
  464.  
  465. * GET-DISPATCH-MACRO-CHARACTER:
  466.   (SETF (GET-DISPATCH-MACRO-CHARACTER ...) ...)
  467.   performs a SET-DISPATCH-MACRO-CHARACTER.
  468.  
  469. * LONG-FLOAT-DIGITS:
  470.   (SETF (LONG-FLOAT-DIGITS) digits) sets the default mantissa length of long
  471.   floats to digits bits.
  472.  
  473. * VALUES:
  474.   (SETF (VALUES place1 ... placek) form)
  475.   is approximately equivalent to
  476.      (MULTIPLE-VALUE-BIND (dummy1 ... dummyk) form
  477.        (SETF place1 dummy1 ... placek dummyk)
  478.        (VALUES dummy1 ... dummyk)
  479.      )
  480.   Example:
  481.     (SETF (VALUES A B) (VALUES B A)) interchanges the values of A and B.
  482.  
  483. * VALUES-LIST:
  484.   (SETF (VALUES-LIST list) form)  is equivalent to
  485.   (VALUES-LIST (SETF list (MULTIPLE-VALUE-LIST form)))
  486.  
  487. &KEY markers in DEFSETF lambda lists are supported, but the corresponding
  488. keywords must appear literally in the program text.
  489.  
  490. (GET-SETF-METHOD form &optional env) and
  491. (GET-SETF-METHOD-MULTIPLE-VALUE form &optional env)
  492. receives as optional argument the environment necessary for macro expansions.
  493. In DEFINE-SETF-METHOD lambda lists, one can specify &ENVIRONMENT and a
  494. variable, which will be bound to the environment. This environment should be
  495. passed to all calls of GET-SETF-METHOD and GET-SETF-METHOD-MULTIPLE-VALUE.
  496. If this is done, even local macros will be interpreted as places correctly.
  497.  
  498. 7.3.
  499. ----
  500.  
  501. CALL-ARGUMENTS-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  502. processors.
  503.  
  504. 7.4.
  505. ----
  506.  
  507. PROG1 and PROG2 are implemented as special forms and, as such, rather
  508. efficient.
  509.  
  510. 7.5.
  511. ----
  512.  
  513. The CLtL2 special form SYMBOL-MACROLET is implemented.
  514.  
  515. The macro DEFINE-SYMBOL-MACRO establishes symbol macros with global scope
  516. (as opposed to symbol macros defined with SYMBOL-MACROLET, which have local
  517. scope): (DEFINE-SYMBOL-MACRO symbol expansion). Calling BOUNDP, SYMBOL-VALUE
  518. or MAKUNBOUND on symbols defined as symbol macros is not allowed.
  519.  
  520. If using the optional package MACROS3:
  521.   The macros LETF and LETF* are like LET and LET*, resp., except that they
  522.   can bind places, even places with multiple values.
  523.   Example:
  524.   (LETF (((VALUES A B) form)) ...)
  525.     is equivalent to
  526.     (MULTIPLE-VALUE-BIND (A B) form ...)
  527.   (LETF (((FIRST L) 7)) ...)
  528.     is approximately equivalent to
  529.     (LET* ((#:G1 L) (#:G2 (FIRST #:G1)))
  530.       (UNWIND-PROTECT (PROGN (SETF (FIRST #:G1) 7) ...)
  531.                       (SETF (FIRST #:G1) #:G2)
  532.     ) )
  533.  
  534. 7.6.
  535. ----
  536.  
  537. WHEN, UNLESS, COND are implemented as special forms and, as such, rather
  538. efficient.
  539.  
  540. 7.8.4.
  541. ------
  542.  
  543. The function MAPCAP is like MAPCAN, except that it concatenates the
  544. resulting lists with APPEND instead of NCONC:
  545.   (MAPCAP fun x1 ... xn) == (apply #'append (mapcar fun x1 ... xn))
  546. (Actually a bit more efficient that this would be.)
  547.  
  548. The function MAPLAP is like MAPCON, except that it concatenates the
  549. resulting lists with APPEND instead of NCONC:
  550.   (MAPLAP fun x1 ... xn) = (apply #'append (maplist fun x1 ... xn))
  551. (Actually a bit more efficient that this would be.)
  552.  
  553. 7.9.1.
  554. ------
  555.  
  556. MULTIPLE-VALUES-LIMIT = 128
  557.  
  558. MULTIPLE-VALUE-LIST, MULTIPLE-VALUE-BIND, MULTIPLE-VALUE-SETQ are
  559. implemented as special forms and, as such, rather efficient.
  560.  
  561. The macro NTH-VALUE:
  562. (NTH-VALUE n form) returns the (n+1)st value (n>=0) of form.
  563.  
  564.  
  565.                         CHAPTER 8: Macros
  566.                         -----------------
  567.  
  568. 8.3.
  569. ----
  570.  
  571. The CLtL2 macro DESTRUCTURING-BIND is implemented. It does not perform full
  572. error checking.
  573.  
  574.  
  575.                      CHAPTER 9: Declarations
  576.                      -----------------------
  577.  
  578. 9.1.
  579. ----
  580.  
  581. The CLtL2 macro DECLAIM is implemented.
  582.  
  583. 9.2.
  584. ----
  585.  
  586. The declarations (TYPE type var ...), (FTYPE type fun ...),
  587. (FUNCTION name arglist result-type), (OPTIMIZE (quality value) ...)
  588. are ignored by the interpreter and the compiler.
  589.  
  590. The CLtL2 declaration (OPTIMIZE (DEBUG ...)) is legal.
  591.  
  592. Additional declarations:
  593.  
  594. * The declaration (COMPILE) has the effect that the current form is compiled
  595.   prior to execution.
  596.   Examples:
  597.   (LOCALLY (DECLARE (COMPILE)) form)
  598.   executes a compiled version of form.
  599.   (let ((x 0))
  600.     (flet ((inc () (declare (compile)) (incf x))
  601.            (dec () (decf x)))
  602.       (values #'inc #'dec)
  603.   ) )
  604.   returns two functions. The first is compiled and increments x, the second
  605.   is interpreted (slower) and decrements the same x.
  606.  
  607. 9.3.
  608. ----
  609.  
  610. The type assertion (THE value-type form) enforces a type check in
  611. interpreted code. No type check is done in compiled code.
  612.  
  613. If using the optional package MACROS3:
  614. (ETHE value-type form) enforces a type check in both interpreted and
  615. compiled code.
  616.  
  617.  
  618.                          CHAPTER 10: Symbols
  619.                          -------------------
  620.  
  621. No notes.
  622.  
  623.  
  624.                          CHAPTER 11: Packages
  625.                          --------------------
  626.  
  627. 11.6.
  628. -----
  629.  
  630. The package SYSTEM has the nicknames "SYS" and, additionally, "COMPILER".
  631.  
  632. The CLtL2 packages
  633. * COMMON-LISP with nickname "CL" and
  634. * COMMON-LISP-USER with nickname "CL-USER"
  635. are implemented. The package COMMON-LISP exports only those symbols
  636. from the proposed ANSI CL draft that are actually implemented.
  637.  
  638. 11.7.
  639. -----
  640.  
  641. The CLtL2 macro DEFPACKAGE is implemented.
  642.  
  643. 11.8.
  644. -----
  645.  
  646. The function REQUIRE receives as optional argument either a pathname or a
  647. list of pathnames: files to be loaded if the required module is not already
  648. in memory.
  649.  
  650.  
  651.                            CHAPTER 12: Numbers
  652.                            -------------------
  653.  
  654. The single and double float formats are those of the IEEE standard (1981),
  655. except that CLISP does not support features like +0, -0, +inf, -inf, gradual
  656. underflow, NaN, etc. (Common Lisp does not make use of these features.)
  657.  
  658. The default number of mantissa bits in long floats is given by the place
  659. (LONG-FLOAT-DIGITS).
  660. Example: (SETF (LONG-FLOAT-DIGITS) 3322) sets the default precision of long
  661. floats to 1000 decimal digits.
  662.  
  663. 12.1.
  664. -----
  665.  
  666. Complex numbers can have a real part and an imaginary part of different
  667. types. If the imaginary part is EQL to 0, the number is automatically
  668. converted to a real number. (Cf. CLtL1 p. 195)
  669. This has the advantage that  (let ((x (sqrt -9.0))) (* x x))
  670. - instead of evaluting to #C(-9.0 0.0), with x = #C(0.0 3.0) -
  671. evaluates to #C(-9.0 0) = -9.0, with x = #C(0 3.0).
  672.  
  673. Coercions on operations involving different types:
  674. The result of an arithmetic operation whose arguments are of different float
  675. types is rounded to the float format of the shortest (least precise) of the
  676. arguments.
  677.     rational -> long float -> double float -> single float -> short float
  678. (in contrast to CLtL1 p. 195!)
  679. Rationale:
  680.   See it mathematically. Add intervals:
  681.   {1.0 +/- 1e-8} + {1.0 +/- 1e-16} = {2.0 +/- 1e-8}
  682.   So, if we add 1.0s0 and 1.0d0, we should get 2.0s0.
  683. Shortly:
  684.   Do not suggest accuracy of a result by giving it a precision that is
  685.   greater than its accuracy.
  686. Example:
  687.   (- (+ 1.7 pi) pi)  should not return  1.700000726342836417234L0,
  688.   it should return 1.7f0 (or 1.700001f0 if there were rounding errors).
  689. Experience:
  690.   If in a computation using thousands of short floats, a long float (like pi)
  691.   happens to be used, the long precision should not propagate throughout all
  692.   the intermediate values. Otherwise, the long result would look precise,
  693.   but its accuracy is only that of a short float; furthermore much
  694.   computation time would be lost by calculating with long floats when only
  695.   short floats would be needed.
  696.  
  697. When rational numbers are to be converted to floats (due to FLOAT, COERCE,
  698. SQRT or a transcendental function), the result type is given by the variable
  699. *DEFAULT-FLOAT-FORMAT*.
  700.  
  701. The macro WITHOUT-FLOATING-POINT-UNDERFLOW:
  702.   (without-floating-point-underflow {form}*)
  703. executes the forms, with errors of type FLOATING-POINT-UNDERFLOW inhibited.
  704. Floating point operations will silently return zero instead of signalling
  705. an error of type FLOATING-POINT-UNDERFLOW.
  706.  
  707. 12.4.
  708. -----
  709.  
  710. (LCM), called without arguments, returns 1, which is the neutral element of
  711. composition with LCM.
  712.  
  713. (! n) returns the factorial of n, n a nonnegative integer.
  714.  
  715. (EXQUO x y) returns the quotient x/y of two integers x,y, and checks that it
  716. is an integer. (This is more efficient than /.)
  717.  
  718. (XGCD x1 ... xn) returns the values g, c1, ..., cn, where
  719. g is the greatest common divisor of the integers x1,...,xn,
  720. and c1,...,cn are integer coefficients such that
  721.   g = (GCD x1 ... xn) = (+ (* c1 x1) ... (* cn xn))
  722.  
  723. 12.5.1.
  724. -------
  725.  
  726. (EXPT base exponent) is not very precise if exponent has large absolute
  727. value.
  728.  
  729. (LOG number base) signals an error if base = 1.
  730.  
  731. 12.5.2.
  732. -------
  733.  
  734. The value of PI is a long float with the precision given by
  735. (LONG-FLOAT-DIGITS). When this precision is changed, the value of PI is
  736. automatically recomputed. Therefore PI is a variable, not a constant.
  737.  
  738. 12.6.
  739. -----
  740.  
  741. FLOAT-RADIX always returns 2.
  742.  
  743. (FLOAT-DIGITS number digits) coerces `number' (a real number) to a floating
  744. point number with at least `digits' mantissa digits. The following holds:
  745.    (>= (FLOAT-DIGITS (FLOAT-DIGITS number digits)) digits)
  746.  
  747. 12.7.
  748. -----
  749.  
  750. BOOLE-CLR   =  0
  751. BOOLE-SET   = 15
  752. BOOLE-1     = 10
  753. BOOLE-2     = 12
  754. BOOLE-C1    =  5
  755. BOOLE-C2    =  3
  756. BOOLE-AND   =  8
  757. BOOLE-IOR   = 14
  758. BOOLE-XOR   =  6
  759. BOOLE-EQV   =  9
  760. BOOLE-NAND  =  7
  761. BOOLE-NOR   =  1
  762. BOOLE-ANDC1 =  4
  763. BOOLE-ANDC2 =  2
  764. BOOLE-ORC1  = 13
  765. BOOLE-ORC2  = 11
  766.  
  767. 12.10.
  768. ------
  769.  
  770. MOST-POSITIVE-FIXNUM = 2^24-1 = 16777215
  771. MOST-NEGATIVE-FIXNUM = -2^24 = -16777216
  772.  
  773. Together with PI, the other long float constants MOST-POSITIVE-LONG-FLOAT,
  774. LEAST-POSITIVE-LONG-FLOAT, LEAST-NEGATIVE-LONG-FLOAT,
  775. MOST-NEGATIVE-LONG-FLOAT, LONG-FLOAT-EPSILON, LONG-FLOAT-NEGATIVE-EPSILON
  776. are recomputed whenever (LONG-FLOAT-DIGITS) is changed. They are variables,
  777. not constants.
  778.  
  779.  
  780.                          CHAPTER 13: Characters
  781.                          ----------------------
  782.  
  783. See first above: 2.2.
  784.  
  785. 13.1.
  786. -----
  787.  
  788. CHAR-CODE-LIMIT = 256
  789. CHAR-FONT-LIMIT = 16
  790. CHAR-BITS-LIMIT = 16
  791.  
  792. 13.2.
  793. -----
  794.  
  795. String-chars are those characters with font = 0 and bits = 0.
  796.  
  797. The graphic characters have been described above.
  798.  
  799. The standard characters are #\Newline and those graphic characters with a
  800. code between 32 and 126 (inclusive).
  801.  
  802. The alphabetic characters are these string-chars:
  803.              ABCDEFGHIJKLMNOPQRSTUVWXYZ
  804.              abcdefghijklmnopqrstuvwxyz
  805. and the international alphabetic characters from the character set:
  806.              ╟ⁿΘΓΣαστΩδΦ∩ε∞─┼╔µ╞⌠÷≥√∙ ╓▄▀ßφ≤·±╤¬║π⌡╪°└├╒ etc.
  807.  
  808. The functions CHAR-EQUAL, CHAR-NOT-EQUAL, CHAR-LESSP, CHAR-GREATERP,
  809. CHAR-NOT-GREATERP, CHAR-NOT-LESSP ignore bits and font attributes of their
  810. arguments.
  811.  
  812. 13.4.
  813. -----
  814.  
  815. The string chars that are not graphic chars and the space character have
  816. names:
  817. #ifdef ATARI_CHARNAMES
  818.   (code-char #x00) = #\Null
  819.   (code-char #x05) = #\Code5
  820.   (code-char #x06) = #\Code6
  821.   (code-char #x07) = #\Bell
  822.   (code-char #x08) = #\Backspace = #\Rubout
  823.   (code-char #x09) = #\Tab
  824.   (code-char #x0A) = #\Newline = #\Linefeed
  825.   (code-char #x0B) = #\Code11
  826.   (code-char #x0C) = #\Page
  827.   (code-char #x0D) = #\Return
  828.   (code-char #x1A) = #\Code26
  829.   (code-char #x1B) = #\Escape
  830.   (code-char #x20) = #\Space
  831. #endif
  832. #ifdef AMIGA_CHARNAMES
  833.   (code-char #x00) = #\Null
  834.   (code-char #x01) = #\Code1
  835.   (code-char #x02) = #\Code2
  836.   (code-char #x03) = #\Code3
  837.   (code-char #x04) = #\Code4
  838.   (code-char #x05) = #\Code5
  839.   (code-char #x06) = #\Code6
  840.   (code-char #x07) = #\Bell = #\Bel
  841.   (code-char #x08) = #\Backspace = #\Bs
  842.   (code-char #x09) = #\Tab = #\Ht
  843.   (code-char #x0A) = #\Newline = #\Linefeed = #\Lf
  844.   (code-char #x0B) = #\Vt
  845.   (code-char #x0C) = #\Page = #\Ff
  846.   (code-char #x0D) = #\Return = #\Cr
  847.   (code-char #x0E) = #\So
  848.   (code-char #x0F) = #\Si
  849.   (code-char #x10) = #\Code16
  850.   (code-char #x11) = #\Code17
  851.   (code-char #x12) = #\Code18
  852.   (code-char #x13) = #\Code19
  853.   (code-char #x14) = #\Code20
  854.   (code-char #x15) = #\Code21
  855.   (code-char #x16) = #\Code22
  856.   (code-char #x17) = #\Code23
  857.   (code-char #x18) = #\Code24
  858.   (code-char #x19) = #\Code25
  859.   (code-char #x1A) = #\Code26
  860.   (code-char #x1B) = #\Escape = #\Esc
  861.   (code-char #x1C) = #\Code28
  862.   (code-char #x1D) = #\Code29
  863.   (code-char #x1E) = #\Code30
  864.   (code-char #x1F) = #\Code31
  865.   (code-char #x20) = #\Space
  866.   (code-char #x7F) = #\Rubout
  867.   (code-char #x9B) = #\Csi
  868. #endif
  869. #ifdef MSDOS_CHARNAMES
  870.   (code-char #x00) = #\Null
  871.   (code-char #x07) = #\Bell
  872.   (code-char #x08) = #\Backspace = #\Rubout
  873.   (code-char #x09) = #\Tab
  874.   (code-char #x0A) = #\Newline = #\Linefeed
  875.   (code-char #x0B) = #\Code11
  876.   (code-char #x0C) = #\Page
  877.   (code-char #x0D) = #\Return
  878.   (code-char #x1A) = #\Code26
  879.   (code-char #x1B) = #\Escape
  880.   (code-char #x20) = #\Space
  881. #endif
  882. #ifdef UNIX_CHARNAMES
  883.   (code-char #x00) = #\Null = #\Nul
  884.   (code-char #x01) = #\Soh
  885.   (code-char #x02) = #\Stx
  886.   (code-char #x03) = #\Etx
  887.   (code-char #x04) = #\Eot
  888.   (code-char #x05) = #\Enq
  889.   (code-char #x06) = #\Ack
  890.   (code-char #x07) = #\Bell = #\Bel
  891.   (code-char #x08) = #\Backspace = #\Bs
  892.   (code-char #x09) = #\Tab = #\Ht
  893.   (code-char #x0A) = #\Newline = #\Nl = #\Linefeed
  894.   (code-char #x0B) = #\Vt
  895.   (code-char #x0C) = #\Page = #\Np
  896.   (code-char #x0D) = #\Return = #\Cr
  897.   (code-char #x0E) = #\So
  898.   (code-char #x0F) = #\Si
  899.   (code-char #x10) = #\Dle
  900.   (code-char #x11) = #\Dc1
  901.   (code-char #x12) = #\Dc2
  902.   (code-char #x13) = #\Dc3
  903.   (code-char #x14) = #\Dc4
  904.   (code-char #x15) = #\Nak
  905.   (code-char #x16) = #\Syn
  906.   (code-char #x17) = #\Etb
  907.   (code-char #x18) = #\Can
  908.   (code-char #x19) = #\Em
  909.   (code-char #x1A) = #\Sub
  910.   (code-char #x1B) = #\Escape = #\Esc
  911.   (code-char #x1C) = #\Fs
  912.   (code-char #x1D) = #\Gs
  913.   (code-char #x1E) = #\Rs
  914.   (code-char #x1F) = #\Us
  915.   (code-char #x20) = #\Space = #\Sp
  916.   (code-char #x7F) = #\Rubout = #\Delete = #\Del
  917. #endif
  918.  
  919. 13.5.
  920. -----
  921.  
  922. CHAR-CONTROL-BIT = 1
  923. CHAR-META-BIT    = 2
  924. CHAR-SUPER-BIT   = 4
  925. CHAR-HYPER-BIT   = 8
  926.  
  927.  
  928.                          CHAPTER 14: Sequences
  929.                          ---------------------
  930.  
  931. 14.1.
  932. -----
  933.  
  934. The result of NREVERSE is always EQ to the argument. NREVERSE on a vector
  935. swaps pairs of elements. NREVERSE on a list swaps the first and the last
  936. element and reverses the list chaining between them.
  937.  
  938. 14.2.
  939. -----
  940.  
  941. For iteration through a sequence, a macro DOSEQ, analogous to DOLIST, may be
  942. used instead of MAP :
  943.   (doseq (var seqform [resultform]) {declaration}* {tag|statement}* )
  944.  
  945. The CLtL2 function MAP-INTO is implemented.
  946.  
  947. 14.3.
  948. -----
  949.  
  950. REMOVE, REMOVE-IF, REMOVE-IF-NOT, REMOVE-DUPLICATES return their argument
  951. unchanged, if no element has to be removed.
  952.  
  953. DELETE, DELETE-IF, DELETE-IF-NOT, DELETE-DUPLICATES destructively modify
  954. their argument: If the argument is a list, the CDR parts are modified. If
  955. the argument is a vector with fill pointer, the fill pointer is lowered and
  956. the remaining elements are compacted below the new fill pointer.
  957.  
  958. 14.5.
  959. -----
  960.  
  961. SORT and STABLE-SORT have two additional keywords :START and :END :
  962.   (SORT sequence predicate &key :key :start :end)
  963.   (STABLE-SORT sequence predicate &key :key :start :end)
  964.  
  965. SORT and STABLE-SORT are identical. They implement the mergesort algorithm.
  966.  
  967.  
  968.                          CHAPTER 15: Lists
  969.                          -----------------
  970.  
  971. 15.4.
  972. -----
  973.  
  974. SUBLIS and NSUBLIS apply the :KEY argument to the nodes of the cons tree and
  975. not to the keys of the alist.
  976.  
  977.  
  978.                       CHAPTER 16: Hash Tables
  979.                       -----------------------
  980.  
  981. 16.1.
  982. -----
  983.  
  984. MAKE-HASH-TABLE has an additional keyword :INITIAL-CONTENTS :
  985.   (MAKE-HASH-TABLE &key :test :initial-contents :size :rehash-size
  986.                         :rehash-threshold)
  987. The :INITIAL-CONTENTS argument is an alist that is used to initialize the
  988. new hash table.
  989. The :REHASH-THRESHOLD argument is ignored.
  990.  
  991. For iteration through a hash table, a macro DOHASH, analogous to DOLIST, can
  992. be used instead of MAPHASH :
  993.   (dohash (key-var value-var hash-table-form [resultform])
  994.     {declaration}* {tag|statement}*
  995.   )
  996.  
  997.  
  998.                      CHAPTER 17: Arrays
  999.                      ------------------
  1000.  
  1001. 17.1.
  1002. -----
  1003.  
  1004. MAKE-ARRAY can return specialized arrays for the element types
  1005. (UNSIGNED-BYTE 2), (UNSIGNED-BYTE 4), (UNSIGNED-BYTE 8), (UNSIGNED-BYTE 16),
  1006. (UNSIGNED-BYTE 32) and of course BIT and STRING-CHAR.
  1007.  
  1008. ARRAY-RANK-LIMIT is 65536 on 16-bit processors, 4294967296 on 32-bit
  1009. processors.
  1010.  
  1011. ARRAY-DIMENSION-LIMIT  = 2^24 = 16777216
  1012. ARRAY-TOTAL-SIZE-LIMIT = 2^24 = 16777216
  1013.  
  1014. 17.6.
  1015. -----
  1016.  
  1017. An array to which another array is displaced should not be shrunk (using
  1018. ADJUST-ARRAY) in such a way that the other array points into void space.
  1019. This is not checked at the time ADJUST-ARRAY is called!
  1020.  
  1021.  
  1022.                        CHAPTER 18: Strings
  1023.                        -------------------
  1024.  
  1025. 18.2.
  1026. -----
  1027.  
  1028. String comparison is based on the function CHAR<=. Therefore diphtongs do
  1029. not obey the usual national rules. Example: "o" < "oe" < "z" < "÷".
  1030.  
  1031.  
  1032.                         CHAPTER 19: Structures
  1033.                         ----------------------
  1034.  
  1035. 19.5.
  1036. -----
  1037.  
  1038. The :PRINT-FUNCTION option should contain a lambda expression
  1039.   (lambda (structure stream depth) (declare (ignore depth)) ...)
  1040. This lambda expression names a function whose task is to output the external
  1041. representation of structure onto the stream. This may be done by outputting
  1042. text onto the stream using WRITE-CHAR, WRITE-STRING, WRITE, PRIN1, PRINC,
  1043. PRINT, PPRINT, FORMAT and the like. The following rules must be obeyed:
  1044. * The value of *PRINT-ESCAPE* must be respected.
  1045. * The value of *PRINT-PRETTY* should not and cannot be respected, since the
  1046.   pretty-print mechanism is not accessible from outside.
  1047. * The value of *PRINT-CIRCLE* need not to be respected. This is managed by
  1048.   the system. (But the print-circle mechanism handles only those objects that
  1049.   are (direct or indirect) components of structure.)
  1050. * The value of *PRINT-LEVEL* is respected by
  1051.   WRITE, PRIN1, PRINC, PRINT, PPRINT, FORMAT ~A, FORMAT ~S, FORMAT ~W and
  1052.   FORMAT ~D,~B,~O,~X,~R,~F,~E,~G,~$ with not-numerical arguments.
  1053.   Therefore the print-level mechanism works automatically if only these
  1054.   functions are used for outputting objects and if they are not called on
  1055.   objects with nesting level > 1. (The print-level mechanism does not
  1056.   recognize how many parentheses you have output. It only counts how many
  1057.   times it was called recursively.)
  1058. * The value of *PRINT-LENGTH* must be respected, especially if you are
  1059.   outputting an arbitrary number of components.
  1060. * The value of *PRINT-READABLY* must be respected. Remember that the values
  1061.   of *PRINT-ESCAPE*, *PRINT-LEVEL*, *PRINT-LENGTH* don't matter if
  1062.   *PRINT-READABLY* is true.
  1063.   The value of *PRINT-READABLY* is respected by PRINT-UNREADABLE-OBJECT,
  1064.   WRITE, PRIN1, PRINC, PRINT, PPRINT, FORMAT ~A, FORMAT ~S, FORMAT ~W and
  1065.   FORMAT ~D,~B,~O,~X,~R,~F,~E,~G,~$ with not-numerical arguments.
  1066.   Therefore *PRINT-READABLY* will be respected automatically if only these
  1067.   functions are used for outputting objects.
  1068. * You need not bother about the values of *PRINT-BASE*, *PRINT-RADIX*,
  1069.   *PRINT-CASE*, *PRINT-GENSYM*, *PRINT-ARRAY*, *PRINT-CLOSURE*, *PRINT-RPARS*.
  1070.  
  1071. The :INHERIT option is exactly like :INCLUDE except that it doesn't create
  1072. new accessors for the inherited slots. Use this option to avoid the problems
  1073. that occur when using the same :CONC-NAME for the new and the inherited
  1074. structure.
  1075.  
  1076.  
  1077.                        CHAPTER 20: The Evaluator
  1078.                        -------------------------
  1079.  
  1080. As in Scheme, the Macro (THE-ENVIRONMENT) returns the current lexical
  1081. environment. This works only in interpreted code and is not compilable!
  1082.  
  1083. (EVAL-ENV form [env]) evaluates a form in a given lexical environment, just
  1084. if the form had been part of the program text that environment came from.
  1085.  
  1086.  
  1087.                          CHAPTER 21: Streams
  1088.                          -------------------
  1089.  
  1090. 21.1.
  1091. -----
  1092.  
  1093. #ifdef GNU_READLINE
  1094. Input through *TERMINAL-IO* uses the GNU readline library. Arrow keys can be
  1095. used to move within the input history. The Tab key completes the symbol's
  1096. name that is being typed.
  1097. See readline.dvi for a complete description of the key bindings.
  1098. The GNU readline library is not used if standard input and standard output do
  1099. not both refer to the same terminal.
  1100.  
  1101. #endif
  1102. #ifdef KEYBOARD
  1103. *TERMINAL-IO* is not the only stream that communicates directly with the
  1104. user: During execution of the body of a (WITH-KEYBOARD . body) form,
  1105. *KEYBOARD-INPUT* is the stream that reads the keystrokes from the keyboard.
  1106. It returns every keystroke in detail, as character with the following bits:
  1107. #if defined(ATARI) || defined(MSDOS) || defined(AMIGAOS)
  1108.   HYPER        if a non-standard key. These are:
  1109. #ifdef ATARI
  1110.                  function keys, cursor keypad, numeric keypad, Delete key.
  1111. #endif
  1112. #ifdef MSDOS
  1113.                  function keys, cursor keypads, numeric keypad.
  1114. #endif
  1115. #ifdef AMIGAOS
  1116.                  function keys, cursor keypad.
  1117. #endif
  1118. #endif
  1119.   CHAR-CODE    the Ascii code for standard keys,
  1120.                for non-standard keys:
  1121. #ifdef ATARI
  1122.                  F1 -> #\F1, ..., F9 -> #\F9, F10 -> #\F10,
  1123.                  Help -> #\Help, Undo -> #\Undo,
  1124.                  Insert -> #\Insert, Delete -> #\Delete,
  1125.                  ClrHome -> #\Home,
  1126.                  Arrow keys -> #\Up, #\Down, #\Left, #\Right.
  1127. #endif
  1128. #ifdef MSDOS
  1129.                  F1 -> #\F1, ..., F10 -> #\F10, F11 -> #\F11, F12 -> #\F12,
  1130.                  Insert -> #\Insert, Delete -> #\Delete,
  1131.                  Home -> #\Home, End -> #\End, PgUp -> #\PgUp, PgDn -> #\PgDn,
  1132.                  Arrow keys -> #\Up, #\Down, #\Left, #\Right.
  1133. #endif
  1134. #ifdef UNIX
  1135.                  F1 -> #\F1, ..., F10 -> #\F10, F11 -> #\F11, F12 -> #\F12,
  1136.                  Insert -> #\Insert, Delete -> #\Delete, Center -> #\Center,
  1137.                  Home -> #\Home, End -> #\End, PgUp -> #\PgUp, PgDn -> #\PgDn,
  1138.                  Arrow keys -> #\Up, #\Down, #\Left, #\Right.
  1139. #endif
  1140. #ifdef AMIGAOS
  1141.                  F1 -> #\F1, ..., F9 -> #\F9, F10 -> #\F10,
  1142.                  Help -> #\Help,
  1143.                  Arrow keys -> #\Up, #\Down, #\Left, #\Right.
  1144. #endif
  1145. #if defined(ATARI) || defined(MSDOS) || defined(AMIGAOS)
  1146.   SUPER        if pressed together with Shift key(s) and if the keystroke
  1147.                would have been an other without Shift.
  1148. #endif
  1149.   CONTROL      if pressed together with the Control key.
  1150. #if defined(ATARI) || defined(MSDOS)
  1151.   META         if pressed together with the Alternate key.
  1152. #endif
  1153. This keyboard input is not echoed on the screen.
  1154. During execution of a (WITH-KEYBOARD . body) form, no input from *TERMINAL-IO*
  1155. or any synonymous stream should be requested.
  1156. #ifdef ATARI
  1157. The stream *KEYBOARD-INPUT* is used by *TERMINAL-IO*.
  1158. #endif
  1159. #endif
  1160. #ifdef PRINTER_ATARI
  1161.  
  1162. The stream *PRINTER-OUTPUT* outputs characters to the printer. When the
  1163. printer is not ready, it is waited for, upto a delay of *PRINTER-TIMEOUT*
  1164. times 0.005 sec. (which defaults to 5 sec.).
  1165. Use WITH-OUTPUT-TO-PRINTER preferrably, for portability.
  1166. #endif
  1167.  
  1168. 21.2.
  1169. -----
  1170.  
  1171. The macro WITH-OUTPUT-TO-PRINTER
  1172.        (with-output-to-printer (var) {declaration}* {form}*)
  1173. binds the variable var to an output stream that sends its output to the
  1174. printer.
  1175. #ifdef PIPES
  1176.  
  1177. (MAKE-PIPE-INPUT-STREAM command) returns an input stream that will supply the
  1178. output from the execution of the given operating system command.
  1179. See also (SHELL command).
  1180.  
  1181. (MAKE-PIPE-OUTPUT-STREAM command) returns an output stream that will pass its
  1182. output as input to the execution of the given operating system command.
  1183. See also (SHELL command).
  1184. #ifdef PIPES2
  1185.  
  1186. (MAKE-PIPE-IO-STREAM command) returns three values. The first value is a
  1187. bidirectional stream that will simultaneously pass its output as input to
  1188. the execution of the given operating system command and supply the output
  1189. from this command as input. The second and third value will be the input
  1190. stream and the output stream that make up the I/O stream, respectively.
  1191. Note that they must be closed individually.
  1192. Warning: Improper use of this function can lead to deadlocks. You use it at
  1193. your own risk!
  1194. A deadlock occurs if the command and your program either both try to read
  1195. read from each other at the same time or both try to write to each other at
  1196. the same time. To avoid deadlocks, it is recommended that you fix a protocol
  1197. between the command and your program and avoid any hidden buffering: Use
  1198. READ-CHAR, READ-CHAR-NO-HANG, LISTEN instead of READ-LINE and READ on the
  1199. input side, and complete every output operation by a FINISH-OUTPUT. The same
  1200. cautions must apply to the called command as well.
  1201. See also (SHELL command).
  1202. #endif
  1203. #endif
  1204. #ifdef GENERIC_STREAMS
  1205.  
  1206. Generic streams are user programmable streams. The programmer interface:
  1207.  
  1208.   (MAKE-GENERIC-STREAM controller) returns a generic stream.
  1209.  
  1210.   (GENERIC-STREAM-CONTROLLER stream)
  1211.      returns a private object to which generic stream methods dispatch.
  1212.      The typical usage is to retrieve the object originally provided by the
  1213.      user in MAKE-GENERIC-STREAM.
  1214.  
  1215.   (GENERIC-STREAM-P stream)
  1216.     determines whether a stream is a generic stream, returning T if it is,
  1217.     NIL otherwise.
  1218.  
  1219. In order to specify the behaviour of a generic stream, the user must define
  1220. CLOS methods on the following CLOS generic functions. The function
  1221. GENERIC-STREAM-XYZ corresponds to the Common Lisp function XYZ. They all
  1222. take a controller and some number of arguments.
  1223.  
  1224.   (GENERIC-STREAM-READ-CHAR    controller)
  1225.   (GENERIC-STREAM-READ-BYTE    controller)
  1226.          These generic functions should return NIL at end of file.
  1227.          Takes one argument, the controller object.
  1228.   (GENERIC-STREAM-LISTEN       controller)
  1229.          Returns -1 for EOF, 0 for character pending, and 1 for none.
  1230.          Takes one argument, the controller object.
  1231.   (GENERIC-STREAM-WRITE-CHAR   controller ch)
  1232.          First argument is the controller object.
  1233.          Second argument is the character to be written.
  1234.   (GENERIC-STREAM-WRITE-BYTE   controller by)
  1235.          First argument is the controller object.
  1236.          Second argument is the integer to be written.
  1237.   (GENERIC-STREAM-WRITE-STRING controller string start len)
  1238.          Called with argument list (controller string start len),
  1239.          this function shall write
  1240.            (subseq (the string string) start (+ start len))
  1241.          First argument is the controller object.
  1242.   (GENERIC-STREAM-CLEAR-INPUT   controller)
  1243.   (GENERIC-STREAM-CLEAR-OUTPUT  controller)
  1244.   (GENERIC-STREAM-FINISH-OUTPUT controller)
  1245.   (GENERIC-STREAM-FORCE-OUTPUT  controller)
  1246.   (GENERIC-STREAM-CLOSE         controller)
  1247.          Takes one argument, the controller object.
  1248. #endif
  1249.  
  1250. 21.3.
  1251. -----
  1252.  
  1253. CLOSE ignores its :ABORT argument.
  1254.  
  1255.  
  1256.                      CHAPTER 22: Input/Output
  1257.                      ------------------------
  1258.  
  1259. 22.1.2.
  1260. -------
  1261.  
  1262. A "reserved token", i.e. a token that has potential number syntax but cannot
  1263. be interpreted as a number, is interpreted as symbol when being read. (CLtL1
  1264. p. 341)
  1265.  
  1266. When a token with package markers is read, then (CLtL1 p. 343/344) no
  1267. checking is done whether the package part and the symbol-name part do not
  1268. have number syntax. (What's the purpose of this check?) So we consider
  1269. tokens like USER:: or :1 or LISP::4711 or 21:3 as symbols.
  1270.  
  1271. 22.1.3.
  1272. -------
  1273.  
  1274. The backquote read macro also works when nested. Example:
  1275.  (eval ``(,#'(lambda () ',a) ,#'(lambda () ',b)))
  1276.  = (eval `(list #'(lambda () ',a) #'(lambda () ',b)))
  1277.  = (eval (list 'list (list 'function (list 'lambda nil (list 'quote a)))
  1278.                      (list 'function (list 'lambda nil (list 'quote b)))
  1279.    )     )
  1280.  
  1281. Multiple backquote combinations like ,,@ or ,@,@ are not implemented. Their
  1282. use would be confusing anyway.
  1283.  
  1284. 22.1.4.
  1285. -------
  1286.  
  1287. #\ allows inputting characters of arbitrary code: #\Code231 yields the
  1288. character (code-char 231.).
  1289.  
  1290. Additional read dispatch macros:
  1291. * #Y is used to read compiled functions.
  1292. * #" is used to read pathnames:
  1293.      #"test.lsp" is the value of (pathname "test.lsp")
  1294. #if defined(ATARI) || defined(MSDOS)
  1295.      As in all strings, backslashes must be written twice here:
  1296.      #"A:\\programs\\test.lsp"
  1297. #endif
  1298.  
  1299. 22.1.5.
  1300. -------
  1301.  
  1302. Is it impossible to get the read macro function of a dispatch macro
  1303. character like #\# using GET-MACRO-CHARACTER.
  1304.  
  1305. The CLtL2 place READTABLE-CASE is implemented. The possible values of
  1306. (READTABLE-CASE readtable) are :UPCASE, :DOWNCASE and :PRESERVE.
  1307.  
  1308. 22.1.6.
  1309. -------
  1310.  
  1311. In absence of SYS::WRITE-FLOAT, floating point numbers are output in radix 2.
  1312.  
  1313. If *PRINT-READABLY* is true, *READ-DEFAULT-FLOAT-FORMAT* has no influence on
  1314. the way floating point numbers are printed.
  1315.  
  1316. Pathnames are written according to the syntax #"namestring" if
  1317. *PRINT-ESCAPE* /= NIL. If *PRINT-ESCAPE* = NIL, only the namestring is
  1318. printed.
  1319.  
  1320. *PRINT-CASE* controls the output not only of symbols, but also of characters
  1321. and some #<...> objects.
  1322.  
  1323. #ifndef AMIGAOS
  1324. *PRINT-PRETTY* is initially = NIL.
  1325. #else
  1326. *PRINT-PRETTY* is initially = NIL but set to T in config.lsp. This makes
  1327. unbuffered screen output much faster.
  1328. #endif
  1329.  
  1330. *PRINT-ARRAY* is initially = T.
  1331.  
  1332. An additional variable *PRINT-CLOSURE* controls whether compiled and
  1333. interpreted functions (closures) are output in detailed form. If
  1334. *PRINT-CLOSURE* /= NIL, compiled closures are output in #Y syntax the reader
  1335. understands. *PRINT-CLOSURE* is initially = NIL.
  1336.  
  1337. An additional variable *PRINT-RPARS* controls the output of right (closing)
  1338. parentheses. If *PRINT-RPARS* /= NIL, closing parentheses which don't fit
  1339. onto the same line as the the corresponding opening parenthesis are output
  1340. just below their corresponding opening parenthesis, in the same column.
  1341. *PRINT-RPARS* is initially = T.
  1342.  
  1343. 22.2.1.
  1344. -------
  1345.  
  1346. The function READ-CHAR-SEQUENCE performs multiple READ-CHAR operations:
  1347. (READ-CHAR-SEQUENCE sequence stream [:start] [:end]) fills the
  1348. subsequence of sequence specified by :start and :end with characters
  1349. consecutively read from stream. It returns the index of the first element
  1350. of sequence that was not updated (= end or < end if the stream reached its
  1351. end).
  1352. This function is especially efficient if sequence is a string and stream is
  1353. a file stream with element type STRING-CHAR, a pipe stream or a string input
  1354. stream.
  1355.  
  1356. 22.2.2.
  1357. -------
  1358.  
  1359. The function READ-BYTE-SEQUENCE performs multiple READ-BYTE operations:
  1360. (READ-BYTE-SEQUENCE sequence stream [:start] [:end]) fills the
  1361. subsequence of sequence specified by :start and :end with integers
  1362. consecutively read from stream. It returns the index of the first element
  1363. of sequence that was not updated (= end or < end if the stream reached its
  1364. end).
  1365. This function is especially efficient if sequence is a
  1366. (VECTOR (UNSIGNED-BYTE 8)) and stream is a file stream with element type
  1367. (UNSIGNED-BYTE 8) or a pipe stream.
  1368.  
  1369. 22.3.1.
  1370. -------
  1371.  
  1372. The functions WRITE and WRITE-TO-STRING have an additional keyword :CLOSURE
  1373. that can be used to bind *PRINT-CLOSURE*.
  1374.  
  1375. The CLtL2 macro PRINT-UNREADABLE-OBJECT is implemented.
  1376.  
  1377. The function WRITE-CHAR-SEQUENCE performs multiple WRITE-CHAR operations:
  1378. (WRITE-CHAR-SEQUENCE sequence stream [:start] [:end]) outputs the characters
  1379. of the subsequence of sequence specified by :start and :end to stream.
  1380. It returns sequence.
  1381. This function is especially efficient if sequence is a string and stream is
  1382. a file stream with element type STRING-CHAR or a pipe stream.
  1383.  
  1384. 22.3.2.
  1385. -------
  1386.  
  1387. The function WRITE-BYTE-SEQUENCE performs multiple WRITE-BYTE operations:
  1388. (WRITE-BYTE-SEQUENCE sequence stream [:start] [:end]) outputs the integers
  1389. of the subsequence of sequence specified by :start and :end to stream.
  1390. It returns sequence.
  1391. This function is especially efficient if sequence is a
  1392. (VECTOR (UNSIGNED-BYTE 8)) and stream is a file stream with element type
  1393. (UNSIGNED-BYTE 8) or a pipe stream.
  1394.  
  1395. 22.3.3.
  1396. -------
  1397.  
  1398. The FORMAT option ~W is analogous to ~A and ~S, but avoids binding of
  1399. *PRINT-ESCAPE*. (FORMAT stream "~W" object) is equivalent to
  1400. (WRITE object :stream stream).
  1401.  
  1402. FORMAT ~R and FORMAT ~:R can output only integers in the range |n| < 10^66.
  1403. The output is in English, according to the American conventions, and these
  1404. conventions are identical to the British conventions only in the range
  1405. |n| < 10^9.
  1406.  
  1407. FORMAT ~:@C does not output the character itself, only the instruction how
  1408. to type the character.
  1409.  
  1410. For FORMAT ~E and FORMAT ~G, the value of *READ-DEFAULT-FLOAT-FORMAT* doesn't
  1411. matter if *PRINT-READABLY* is true.
  1412.  
  1413. FORMAT ~T can determine the current column of any stream.
  1414.  
  1415.  
  1416.                     CHAPTER 23: File System Interface
  1417.                     ---------------------------------
  1418.  
  1419. 23.1.
  1420. -----
  1421.  
  1422. For most operations, pathnames denoting files and pathnames denoting
  1423. directories can not be used interchangeably.
  1424. #if defined(PATHNAME_UNIX) || defined(PATHNAME_AMIGAOS)
  1425. For example, #"FOO/BAR" denotes the file BAR in the directory FOO, while
  1426. #"FOO/BAR/" denotes the subdirectory BAR of the directory FOO.
  1427. #endif
  1428. This is especially important for the functions DIRECTORY, DIR, CD, MAKE-DIR,
  1429. DELETE-DIR.
  1430.  
  1431. The minimum filename syntax that may be used portably is:
  1432.   "xxx"       for a file with name xxx,
  1433.   "xxx.yy"    for a file with name xxx and type yy,
  1434.   ".yy"       for a pathname with type yy and no name specified.
  1435. Hereby xxx denote 1 to 8 characters, and yy denote 1 to 3 characters, each of
  1436. which being either alphanumerical or the underscore #\_.
  1437. Other properties of pathname syntax vary between operating systems.
  1438.  
  1439. 23.1.1.
  1440. -------
  1441.  
  1442. #ifdef PATHNAME_ATARI
  1443. Pathname components:
  1444. HOST          always NIL
  1445. DEVICE        NIL or :WILD or "A"|...|"Z"
  1446. DIRECTORY     (disknumber startpoint . subdirs) where
  1447.                disknumber = NIL or the serial number of the diskette,
  1448.                startpoint = :RELATIVE | :ABSOLUTE
  1449.                subdirs = () | (subdir . subdirs)
  1450.                subdir = :CURRENT (means ".") or
  1451.                subdir = :PARENT (means "..") or
  1452.                subdir = :WILD-INFERIORS (means "...", all subdirectories) or
  1453.                subdir = (name . type)
  1454.                 name = :WILD or a simple string with 8 characters maximum
  1455.                 type = :WILD or a simple string with 3 characters maximum
  1456. NAME          NIL or :WILD or a simple string with 8 characters maximum
  1457. TYPE          NIL or :WILD or a simple string with 3 characters maximum
  1458. VERSION       always NIL (may also be specified as :WILD or :NEWEST)
  1459.  
  1460. When a pathname is to be fully specified (no wildcards), that means that
  1461. no :WILD, :WILD-INFERIORS is allowed, and NAME = NIL may not be allowed either.
  1462.  
  1463. External notation:  A123456:\sub1.typ\sub2.typ\name.typ
  1464. using defaults:             \sub1.typ\sub2.typ\name.typ
  1465. or                                             name.typ
  1466. or                        *:\sub1.typ\*.*\name.*
  1467. or similar.
  1468. #endif
  1469. #ifdef PATHNAME_MSDOS
  1470. Pathname components:
  1471. HOST          always NIL
  1472. DEVICE        NIL or :WILD or "A"|...|"Z"
  1473. DIRECTORY     (startpoint . subdirs) where
  1474.                startpoint = :RELATIVE | :ABSOLUTE
  1475.                subdirs = () | (subdir . subdirs)
  1476.                subdir = :CURRENT (means ".") or
  1477.                subdir = :PARENT (means "..") or
  1478.                subdir = :WILD-INFERIORS (means "...", all subdirectories) or
  1479.                subdir = (name . type)
  1480.                 name = :WILD or a simple string with 8 characters maximum
  1481.                 type = :WILD or a simple string with 3 characters maximum
  1482. NAME          NIL or :WILD or a simple string with 8 characters maximum
  1483. TYPE          NIL or :WILD or a simple string with 3 characters maximum
  1484. VERSION       always NIL (may also be specified as :WILD or :NEWEST)
  1485.  
  1486. When a pathname is to be fully specified (no wildcards), that means that
  1487. no :WILD, :WILD-INFERIORS is allowed, and NAME = NIL may not be allowed either.
  1488.  
  1489. External notation:        A:\sub1.typ\sub2.typ\name.typ
  1490. using defaults:             \sub1.typ\sub2.typ\name.typ
  1491. or                                             name.typ
  1492. or                        *:\sub1.typ\*.*\name.*
  1493. or similar.
  1494. Instead of '\' one may use '/', as usual for DOS calls.
  1495. #endif
  1496. #ifdef PATHNAME_AMIGAOS
  1497. Pathname components:
  1498. HOST          always NIL
  1499. DEVICE        NIL or a simple string
  1500. DIRECTORY     (startpoint . subdirs) where
  1501.                startpoint = :RELATIVE | :ABSOLUTE
  1502.                subdirs = () | (subdir . subdirs)
  1503.                subdir = :WILD-INFERIORS (means "**" or "...", all subdirectories) or
  1504.                subdir = :PARENT (means "/" instead of "subdir/") or
  1505.                subdir = simple string, may contain wildcard characters ? and *
  1506. NAME          NIL or
  1507.               simple string, may contain wildcard characters ? and *
  1508.               (may also be specified as :WILD)
  1509. TYPE          NIL or
  1510.               simple string, may contain wildcard characters ? and *
  1511.               (may also be specified as :WILD)
  1512. VERSION       always NIL (may also be specified as :WILD or :NEWEST)
  1513.  
  1514. Constraint: startpoint = :RELATIVE only if device = NIL. If the device is
  1515. specified, the pathname must be absolute!
  1516.  
  1517. A filename from AMIGAOS is split into name and type according to the
  1518. following rule:
  1519.   if there is no '.' in the filename, then the name is everything, type = NIL;
  1520.   if there is a '.', then name is the part before and type the part after
  1521.      the last dot.
  1522.  
  1523. Case is ignored in the strings on comparison. No case conversions are
  1524. performed.
  1525.  
  1526. When a pathname is to be fully specified (no wildcards), that means that
  1527. no :WILD, :WILD-INFERIORS is allowed, no wildcard characters are allowed in
  1528. the strings, and NAME = NIL may not be allowed either.
  1529.  
  1530. External notation:      dev:sub1.typ/sub2.typ/name.typ
  1531. using defaults:             sub1.typ/sub2.typ/name.typ
  1532. or                                            name.typ
  1533. or                          sub1.typ/**/sub3.typ/x*.lsp
  1534. or similar.
  1535.  
  1536. Formal specification of the external notation:
  1537.   ch ::= any character except ':','/' and '*','?'
  1538.   name ::= {ch}+
  1539.   device ::= [ <empty> | ':' | name ':' ]
  1540.              ; empty = current device, relative to current directory
  1541.              ; ':'   = current device, absolute (relative to root for disks)
  1542.              ; name ':' = specified device, absolute (relative to root for disks)
  1543.   subdir ::= [ <empty> | name ]                ; empty means parent directory
  1544.   pathname ::= device { subdir '/' }* name
  1545.  
  1546. Examples:
  1547. String       Device    Directory                our pathname
  1548. ------       ------    ---------                --------------
  1549. 'c:foo'      'C',     device->foo               "c" (:ABSOLUTE "foo")
  1550. 'c:foo/'     'C',     device->foo               "c" (:ABSOLUTE "foo")
  1551. 'c:foo/bar'  'C',     device->foo->bar          "c" (:ABSOLUTE "foo" "bar")
  1552. 'c:/foo'     'C',     device->up->foo           "c" (:ABSOLUTE :PARENT "foo")
  1553. 'c:'         'C',     device                    "c" (:ABSOLUTE)
  1554. ':foo'       current, device->root->foo         NIL (:ABSOLUTE "foo")
  1555. 'foo'        current, device->foo               NIL (:RELATIVE "foo")
  1556. '/foo'       current, device->up->foo           NIL (:RELATIVE :PARENT "foo")
  1557. '//foo/bar'  current, device->up->up->foo->bar  NIL (:RELATIVE :PARENT :PARENT "foo" "bar")
  1558. ''           current, device                    NIL (:RELATIVE)
  1559.  
  1560. Appending a '/' to a path string that is non-empty and does not end with ':'
  1561. or '/' does not change its meaning. This '/' must be appended before another
  1562. non-empty component can be appended.
  1563. But appending a '/' to a path string that is empty or ends with ':' or '/'
  1564. means going up to the parent directory!
  1565. We interpret any path string that is empty or ends with ':' or '/' as
  1566. pathname of a directory (with name = NIL and type = NIL).
  1567. #endif
  1568. #ifdef PATHNAME_UNIX
  1569. Pathname components:
  1570. HOST          always NIL
  1571. DEVICE        always NIL
  1572. DIRECTORY     (startpoint . subdirs) where
  1573.                startpoint = :RELATIVE | :ABSOLUTE
  1574.                subdirs = () | (subdir . subdirs)
  1575.                subdir = :WILD-INFERIORS (means "**" or "...", all subdirectories) or
  1576.                subdir = simple string, may contain wildcard characters ? and *
  1577. NAME          NIL or
  1578.               simple string, may contain wildcard characters ? and *
  1579.               (may also be specified as :WILD)
  1580. TYPE          NIL or
  1581.               simple string, may contain wildcard characters ? and *
  1582.               (may also be specified as :WILD)
  1583. VERSION       always NIL (may also be specified as :WILD or :NEWEST)
  1584.  
  1585. A UNIX filename is split into name and type according to the following rule:
  1586.   if there is no '.' in the filename, then the name is everything, type = NIL;
  1587.   if there is a '.', then name is the part before and type the part after
  1588.      the last dot.
  1589.  
  1590. When a pathname is to be fully specified (no wildcards), that means that
  1591. no :WILD, :WILD-INFERIORS is allowed, no wildcard characters are allowed in
  1592. the strings, and NAME = NIL may not be allowed either.
  1593.  
  1594. External notation:   server:sub1.typ/sub2.typ/name.typ
  1595. using defaults:             sub1.typ/sub2.typ/name.typ
  1596. or                                            name.typ
  1597. or                          sub1.typ/**/sub3.typ/x*.lsp
  1598. or similar.
  1599. #endif
  1600. #ifdef PATHNAME_OS2
  1601. Pathname components:
  1602. HOST          always NIL
  1603. DEVICE        NIL or :WILD or "A"|...|"Z"
  1604. DIRECTORY     (startpoint . subdirs) where
  1605.                startpoint = :RELATIVE | :ABSOLUTE
  1606.                subdirs = () | (subdir . subdirs)
  1607.                subdir = :WILD-INFERIORS (means "**" or "...", all subdirectories) or
  1608.                subdir = simple string, may contain wildcard characters ? and *
  1609. NAME          NIL or
  1610.               simple string, may contain wildcard characters ? and *
  1611.               (may also be specified as :WILD)
  1612. TYPE          NIL or
  1613.               simple string, may contain wildcard characters ? and *
  1614.               (may also be specified as :WILD)
  1615. VERSION       always NIL (may also be specified as :WILD or :NEWEST)
  1616.  
  1617. An OS/2 filename is split into name and type according to the following rule:
  1618.   if there is no '.' in the filename, then the name is everything, type = NIL;
  1619.   if there is a '.', then name is the part before and type the part after
  1620.      the last dot.
  1621.  
  1622. When a pathname is to be fully specified (no wildcards), that means that
  1623. no :WILD, :WILD-INFERIORS is allowed, no wildcard characters are allowed in
  1624. the strings, and NAME = NIL may not be allowed either.
  1625.  
  1626. External notation:       A:\sub1.typ\sub2.typ\name.typ
  1627. using defaults:            \sub1.typ\sub2.typ\name.typ
  1628. or                                            name.typ
  1629. or                       *:\sub1.typ\**\sub3.typ\x*.lsp
  1630. or similar.
  1631. Instead of '\' one may use '/', as usual for DOS calls.
  1632. #endif
  1633. #ifdef PATHNAME_NOEXT
  1634.  
  1635. The wildcard characters: '*' matches any sequence of characters, '?' matches
  1636. any one character.
  1637. #endif
  1638. #ifdef PATHNAME_NOEXT
  1639.  
  1640. Due to the name/type splitting rule, there are pathnames that can't result
  1641. from PARSE-NAMESTRING. To get a pathname whose type contains a dot or whose
  1642. name contains a dot and whose type is NIL, MAKE-PATHNAME must be used.
  1643. Example: (MAKE-PATHNAME :NAME ".profile").
  1644. #endif
  1645.  
  1646. 23.1.2.
  1647. -------
  1648.  
  1649. External notation of pathnames (cf. PARSE-NAMESTRING and NAMESTRING),
  1650. of course without spaces, [,],{,}:
  1651. #ifdef PATHNAME_ATARI
  1652.  [ [drivespec]         a letter '*'|'A'|...|'Z'|'a'|...|'z'
  1653.    [Seriennummer]      an integer >=0, <2^24 in decimal notation
  1654.    :
  1655.  ]
  1656.  { name [. type] \ }   each one a subdirectory
  1657.  [ name [. type] ]     filename with type (extension)
  1658.  
  1659. Name and type may be character sequences of any length (consisting of
  1660. alphanumeric characters and '-', '_'). They are shortened to 8 resp. 3
  1661. characters and converted to upper case. A single '*' is allowed for :WILD.
  1662. #endif
  1663. #ifdef PATHNAME_MSDOS
  1664.  [ [drivespec]         a letter '*'|'A'|...|'Z'|'a'|...|'z'
  1665.    :
  1666.  ]
  1667.  { name [. type] \ }   each one a subdirectory, '\' may be replaced by '/'
  1668.  [ name [. type] ]     filename with type (extension)
  1669.  
  1670. Name and type may be character sequences of any length (consisting of
  1671. alphanumeric characters and '-', '_'). They are shortened to 8 resp. 3
  1672. characters and converted to upper case. A single '*' is allowed for :WILD.
  1673. #endif
  1674. #ifdef PATHNAME_AMIGAOS
  1675. see above.
  1676. #endif
  1677. #ifdef PATHNAME_UNIX
  1678.  [ / ]                 / denotes absolute pathnames
  1679.  { name / }            each one a subdirectory
  1680.  [ name [. type] ]     filename with type (extension)
  1681.  
  1682. Name and type may be character sequences of any length (consisting of
  1683. printing ASCII characters, except '/').
  1684. #endif
  1685. #ifdef PATHNAME_OS2
  1686.  [ [drivespec]         a letter '*'|'A'|...|'Z'|'a'|...|'z'
  1687.    :
  1688.  ]
  1689.  { name [. type] \ }   each one a subdirectory, '\' may be replaced by '/'
  1690.  [ name [. type] ]     filename with type (extension)
  1691.  
  1692. Name and type may be character sequences of any length (consisting of
  1693. printing ASCII characters, except '/', '\', ':').
  1694. #endif
  1695.  
  1696. NAMESTRING has an optional flag argument: (NAMESTRING pathname T) returns an
  1697. external notation suitable for passing to the operating system or other
  1698. programs.
  1699. #if !defined(USER_HOMEDIR)
  1700.  
  1701. The function USER-HOMEDIR-PATHNAME is not implemented.
  1702. #if defined(MSDOS) || defined(ATARI)
  1703. If you really need that function, you might define it like this:
  1704.   (DEFUN USER-HOMEDIR-PATHNAME (&OPTIONAL HOST)
  1705.     (DECLARE (IGNORE HOST))
  1706.     (OR (SYSTEM::GETENV "HOME") "\\")
  1707.   )
  1708. #endif
  1709. #endif
  1710.  
  1711. 23.1.4.
  1712. -------
  1713.  
  1714. The CLtL2 functions WILD-PATHNAME-P, PATHNAME-MATCH-P and TRANSLATE-PATHNAME
  1715. are implemented.
  1716.  
  1717. PATHNAME-MATCH-P does not interpret missing components as wild.
  1718.  
  1719. TRANSLATE-PATHNAME has two additional keywords:
  1720.   (TRANSLATE-PATHNAME source from-wildname to-wildname &key :all :merge)
  1721. If :ALL is specified and non-NIL, a list of all resulting pathnames,
  1722. corresponding to all matches of (PATHNAME-MATCH-P source from-wildname),
  1723. is returned. If :MERGE is specified and NIL, unspecified pieces of to-pathname
  1724. are not replaced by corresponding pieces of source.
  1725.  
  1726. 23.1.5.
  1727. -------
  1728.  
  1729. #ifndef LOGICAL_PATHNAMES
  1730. The function COMPILE-FILE-PATHNAME is implemented.
  1731. #endif
  1732. #ifdef LOGICAL_PATHNAMES
  1733. The functions LOGICAL-PATHNAME, TRANSLATE-LOGICAL-PATHNAME,
  1734. LOGICAL-PATHNAME-TRANSLATIONS, (SETF LOGICAL-PATHNAME-TRANSLATIONS),
  1735. LOAD-LOGICAL-PATHNAME-TRANSLATIONS, COMPILE-FILE-PATHNAME are implemented.
  1736.  
  1737. RENAME-FILE always returns a non-logical pathname as its first value.
  1738.  
  1739. 23.1.6.
  1740. -------
  1741.  
  1742. (PARSE-NAMESTRING string [host [defaults]]) returns a logical pathname only
  1743. if host is a logical host or host is NIL and defaults is a logical pathname.
  1744. To construct a logical pathname from a string, the function LOGICAL-PATHNAME
  1745. can be used.
  1746.  
  1747. (MERGE-PATHNAMES string [defaults]) returns a logical pathname only if
  1748. defaults is a logical pathname. To construct a logical pathname from a string,
  1749. the function LOGICAL-PATHNAME can be used.
  1750. #endif
  1751.  
  1752. 23.2.
  1753. -----
  1754.  
  1755. #ifdef HANDLES
  1756. The file streams returned by OPEN are buffered for regular files and
  1757. unbuffered for special files.
  1758. #else
  1759. The file streams returned by OPEN are always buffered.
  1760. #endif
  1761.  
  1762. 23.3.
  1763. -----
  1764.  
  1765. FILE-AUTHOR always returns NIL.
  1766. #if defined(ATARI) || defined(MSDOS)
  1767.  
  1768. FILE-POSITION works on any file stream. When a Newline is output to resp.
  1769. input from a file stream, its file position is increased by 2 since Newline
  1770. is encoded as CR/LF in the file.
  1771. #endif
  1772.  
  1773. 23.4.
  1774. -----
  1775.  
  1776. LOAD has two additional keywords :ECHO and :COMPILING.
  1777. (LOAD filename &key :verbose :print :echo :if-does-not-exist :compiling)
  1778. :VERBOSE T   causes LOAD to emit a short message that a file is being loaded.
  1779.              The default is *LOAD-VERBOSE*, which is initially = T.
  1780. :PRINT T     causes LOAD to print the value of each form.
  1781.              The default is *LOAD-PRINT*, which is initially = NIL.
  1782. :ECHO T      causes the input from the file to be echoed to *STANDARD-OUTPUT*
  1783.              (normally to the screen). Should there be an error in the file,
  1784.              you can see at one glance where it is.
  1785.              The default is *LOAD-ECHO*, which is initially = NIL.
  1786. :COMPILING T causes each form read to be compiled on the fly. The compiled
  1787.              code is executed at once and - in contrast to COMPILE-FILE -
  1788.              not written to a file.
  1789.  
  1790. The CLtL2 variables *LOAD-PATHNAME* and *LOAD-TRUENAME* are implemented.
  1791.  
  1792. The variable *LOAD-PATHS* contains a list of directories where program files
  1793. are searched - additionally to the specified or current directory - by LOAD,
  1794. REQUIRE, COMPILE-FILE.
  1795.  
  1796. 23.5.
  1797. -----
  1798.  
  1799. (DIRECTORY [pathname [:full] [:circle]]) can run in two modes:
  1800. * If pathname contains no name or type component, a list of all matching
  1801.   directories is produced.
  1802. * Otherwise a list of all matching files is returned. If the :FULL argument
  1803.   is /= NIL, this contains additional information: for each matching file
  1804.   you get a list of at least four elements
  1805.   (file-pathname file-truename file-write-date-as-decoded-time file-length).
  1806. #ifdef UNIX
  1807. If the :CIRCLE argument is /= NIL, the function avoids endless loops that
  1808. may result from symbolic links.
  1809. #endif
  1810.  
  1811. (DIR [pathname]) is like DIRECTORY, but displays the pathnames instead of
  1812. returning them. (DIR) shows the contents of the current directory.
  1813.  
  1814. #if defined(PATHNAME_UNIX) || defined(PATHNAME_AMIGAOS)
  1815. (CD [pathname]) manages the current directory.
  1816. #else
  1817. (CD [pathname]) manages the current device and the current directory.
  1818. #endif
  1819. (CD pathname) sets it, (CD) returns it.
  1820. #ifdef PATHNAME_ATARI
  1821. Note that this current directory is handled inside Lisp. When you call
  1822. programs, they will not know about this current directory. We don't modify
  1823. GEMDOS' current directory.
  1824. #endif
  1825.  
  1826. (DEFAULT-DIRECTORY) is equivalent to (CD), (SETF (DEFAULT-DIRECTORY) pathname)
  1827. is equivalent to (CD pathname).
  1828.  
  1829. (MAKE-DIR directory-pathname) creates a new subdirectory.
  1830.  
  1831. (DELETE-DIR directory-pathname) removes an (empty) subdirectory.
  1832. #ifdef ATARI
  1833.  
  1834. (EXECUTE programfile [args [space]])  executes an external program. Its name
  1835. is programfile. args is the string of arguments (also called "command tail")
  1836. and defaults to "". space is the amount of memory (in bytes) that is to be
  1837. placed at the program's disposal. The default for space is the bare minimum
  1838. the program may need, but this guess is often too low.
  1839. #endif
  1840. #if defined(UNIX) || defined(MSDOS)
  1841.  
  1842. (EXECUTE programfile arg1 arg2 ...)  executes an external program. Its name
  1843. is programfile. It is given the strings arg1, arg2, ... as arguments.
  1844. #endif
  1845. #ifdef AMIGAOS
  1846.  
  1847. (EXECUTE command)  executes a given command using the operating system's shell.
  1848. #endif
  1849. #ifdef HAVE_SHELL
  1850.  
  1851. (SHELL [command])  calls the operating system's shell.
  1852. (SHELL) calls the shell for interactive use. (SHELL command) calls the shell
  1853. only for execution of the one given command.
  1854. #endif
  1855. #ifdef PIPES2
  1856.  
  1857. The functions RUN-SHELL-COMMAND and RUN-PROGRAM are a general interface to
  1858. SHELL and the above:
  1859.   (RUN-SHELL-COMMAND command [:input] [:output] [:if-output-exists])
  1860.     runs a shell command.
  1861.   (RUN-PROGRAM program [:arguments] [:input] [:output] [:if-output-exists])
  1862.     runs an external program.
  1863. The command argument     specifies the shell command.
  1864. The program argument     specifies the program. The directories listed in the
  1865.                          PATH environment veriable will be searched for it.
  1866. The :arguments argument  specifies a list of arguments (strings) that are
  1867.                          given to the program.
  1868. The :input argument      specifies where the program's input is to come from:
  1869.                          either :TERMINAL (the standard input) or :STREAM
  1870.                          (a Lisp stream to be created) or a pathname (an
  1871.                          input file) or NIL (no input at all).
  1872. The :output argument     specifies where the program's output is to be sent
  1873.                          to: either :TERMINAL (the standard output) or :STREAM
  1874.                          (a Lisp stream to be created) or a pathname (an
  1875.                          output file) or NIL (ignore the output).
  1876. The :if-output-exists argument specifies what to do if the :output file
  1877.                          already exists. The possible values are :overwrite,
  1878.                          :append, :error, with the same meaning as for OPEN.
  1879. If :STREAM was specified for :input or :output, a Lisp stream is returned.
  1880. If :STREAM was specified for :input and :output, three Lisp streams are
  1881. returned, as for the function MAKE-PIPE-IO-STREAM. This use of RUN-PROGRAM
  1882. can cause deadlocks, see MAKE-PIPE-IO-STREAM.
  1883. #endif
  1884.  
  1885.  
  1886.                         CHAPTER 24: Errors
  1887.                         ------------------
  1888.  
  1889. 24.1.
  1890. -----
  1891.  
  1892. When an error occurred, you are in a break loop. You can evaluate forms as
  1893. usual. The HELP command (or help key if there is one) lists the available
  1894. debugging commands.
  1895.  
  1896.  
  1897.                   CHAPTER 25: Miscellaneous Features
  1898.                   ----------------------------------
  1899.  
  1900. 25.1.
  1901. -----
  1902.  
  1903. The compiler can be called not only by the functions COMPILE, COMPILE-FILE
  1904. and DISASSEMBLE, also by the declaration (COMPILE).
  1905.  
  1906. (COMPILE-FILE input-file [:output-file] [:listing]
  1907.                          [:warnings] [:verbose] [:print])
  1908. compiles a file to bytecode.
  1909.     input-file                should be a pathname/string/symbol.
  1910. The :output-file argument     should be NIL or T or a pathname/string/symbol
  1911.                               or an output-stream. The default is T.
  1912. The :listing argument         should be NIL or T or a pathname/string/symbol
  1913.                               or an output-stream. The default is NIL.
  1914. The :warnings argument        specifies whether warnings should also appear
  1915.                               on the screen.
  1916. The :verbose argument         specifies whether error messages should also
  1917.                               appear on the screen.
  1918. The :print argument           specifies whether an indication which forms are
  1919.                               being compiled should appear on the screen.
  1920. The variables *COMPILE-WARNINGS*, *COMPILE-VERBOSE*, *COMPILE-PRINT* provide
  1921. defaults for the :warnings, :verbose, :print keyword arguments, respectively.
  1922.  
  1923. The CLtL2 variables *COMPILE-FILE-PATHNAME* and *COMPILE-FILE-TRUENAME* are
  1924. implemented.
  1925.  
  1926. The CLtL2 special form LOAD-TIME-VALUE is implemented. (LOAD-TIME-VALUE form)
  1927. is like (QUOTE #,form) except that the former can be generated by macros.
  1928.  
  1929. The CLtL2 function FUNCTION-LAMBDA-EXPRESSION is implemented.
  1930. (FUNCTION-LAMBDA-EXPRESSION function) returns information about the source
  1931. of an interpreted function: lambda-expression, lexical environment, name.
  1932.  
  1933. 25.2.
  1934. -----
  1935.  
  1936. No on-line documentation is available for the system functions (yet).
  1937.  
  1938. 25.3.
  1939. -----
  1940.  
  1941. (TRACE fun ...) makes the functions fun, ... traced. Syntax of fun:
  1942. Either a symbol:
  1943.        symbol
  1944. or a list of a symbol and some keywords and arguments (which must come in
  1945. pairs!):
  1946.        (symbol
  1947.          [:suppress-if form]   ; no trace output as long as form is true
  1948.          [:step-if form]       ; invokes the stepper as soon as form is true
  1949.          [:pre form]           ; evaluates form before calling the function
  1950.          [:post form]          ; evaluates form after return from the function
  1951.          [:pre-break-if form]  ; goes into the break loop before calling the
  1952.                                ; function if form is true
  1953.          [:post-break-if form] ; goes into the break loop after return from
  1954.                                ; the function if form is true
  1955.          [:pre-print form]     ; prints the values of form before calling the
  1956.                                ; function
  1957.          [:post-print form]    ; prints the values of form after return from
  1958.                                ; the function
  1959.          [:print form]         ; prints the values of form both before
  1960.                                ; calling and after return from the function
  1961.        )
  1962. In all these forms you can access
  1963.   the function itself               as *TRACE-FUNCTION*,
  1964.   the arguments to the function     as *TRACE-ARGS*,
  1965.   the function/macro call as form   as *TRACE-FORM*,
  1966. and after return from the function
  1967.   the list of return values from the function call  as *TRACE-VALUES*,
  1968. and you can leave the function call with specified values by using RETURN.
  1969.  
  1970. TRACE and UNTRACE are also applicable to functions (SETF symbol) and to macros,
  1971. but not to locally defined functions and macros.
  1972.  
  1973. The function INSPECT is not implemented.
  1974.  
  1975. The function ROOM can only be called without arguments. It returns two values:
  1976. the number of bytes currently occupied by Lisp objects, and the number of
  1977. bytes that can be allocated before the next regular garbage collection occurs.
  1978.  
  1979. The function ED calls the external editor specified by the variable *EDITOR*
  1980. (see config.lsp).
  1981. #if defined(ATARI) || defined(MSDOS) || defined(UNIX)
  1982. If using the optional package EDITOR:
  1983.   ED behaves like this only if the variable *USE-ED* is NIL.
  1984.   Otherwise ED uses an Emacs-like screen editor with multiple windows.
  1985. #endif
  1986.  
  1987. The function UNCOMPILE does the converse of COMPILE: (UNCOMPILE function-name)
  1988. reverts an interpreted function that has been entered or loaded in the same
  1989. session and then compiled back to its interpreted form.
  1990.  
  1991. 25.4.1.
  1992. -------
  1993.  
  1994. #ifndef TIME_UNIX
  1995. The variable *DEFAULT-TIME-ZONE* contains the default time zone used by
  1996. ENCODE-UNIVERSAL-TIME and DECODE-UNIVERSAL-TIME. It is initially set to -1
  1997. (which means 1 hour east of Greenwich, i.e. Mid European Time).
  1998.  
  1999. #endif
  2000. The timezone in a decoded time must not necessarily be an integer, but (as
  2001. float or rational number) it should be a multiple of 1/4.
  2002.  
  2003. #ifdef TIME_ATARI
  2004. INTERNAL-TIME-UNITS-PER-SECOND = 200.
  2005. #endif
  2006. #ifdef TIME_MSDOS
  2007. INTERNAL-TIME-UNITS-PER-SECOND = 100.
  2008. #endif
  2009. #ifdef TIME_AMIGAOS
  2010. INTERNAL-TIME-UNITS-PER-SECOND = 50.
  2011. #endif
  2012. #ifdef TIME_UNIX
  2013. INTERNAL-TIME-UNITS-PER-SECOND = 1000000.
  2014. #endif
  2015.  
  2016. 25.4.2.
  2017. -------
  2018.  
  2019. #if defined(UNIX) && !defined(UNIX_LINUX)
  2020. The functions SHORT-SITE-NAME, LONG-SITE-NAME should be defined in a site-
  2021. specific CONFIG.LSP file.
  2022. #else
  2023. The functions MACHINE-TYPE, MACHINE-VERSION, MACHINE-INSTANCE and
  2024. SHORT-SITE-NAME, LONG-SITE-NAME should be defined by every user in his
  2025. site-specific CONFIG.LSP file.
  2026. #endif
  2027.  
  2028. The variable *FEATURES* initially contains the symbols
  2029.    CLISP            ; this implementation
  2030.    COMMON-LISP
  2031.    CLTL1
  2032.    INTERPRETER
  2033.    COMPILER
  2034. #ifdef LOGICAL_PATHNAMES
  2035.    LOGICAL-PATHNAMES
  2036. #endif
  2037.    LOOP
  2038.    CLOS
  2039.    ATARI            ; if hardware = Atari ST/TT and operating system = TOS
  2040.    AMIGA            ; if hardware = Amiga and operating system = Exec/AmigaDOS
  2041.    DOS              ; if hardware = PC (clone) and operating system = DOS
  2042.    OS/2             ; if hardware = PC (clone) and operating system = OS/2
  2043.    PC386            ; if hardware = PC (clone) with a 386/486
  2044.    UNIX             ; if                            operating system = Unix
  2045.                     ;                               (yes, in this case the
  2046.                     ;                               hardware is irrelevant!)
  2047.  
  2048.  
  2049.                            CHAPTER 26: Loop
  2050.                            ----------------
  2051.  
  2052. The CLtL2 macros LOOP and LOOP-FINISH are implemented.
  2053.  
  2054.  
  2055.                  CHAPTER 28: Common Lisp Object System
  2056.                  -------------------------------------
  2057.  
  2058. To use CLOS, do (USE-PACKAGE "CLOS").
  2059.  
  2060. The functions
  2061.   SLOT-VALUE, SLOT-BOUNDP, SLOT-MAKUNBOUND, SLOT-EXISTS-P,
  2062.   FIND-CLASS, (SETF FIND-CLASS), CLASS-OF, CALL-NEXT-METHOD, NEXT-METHOD-P,
  2063.   CLASS-NAME, (SETF CLASS-NAME), NO-APPLICABLE-METHOD, NO-NEXT-METHOD,
  2064.   FIND-METHOD, ADD-METHOD, REMOVE-METHOD, COMPUTE-APPLICABLE-METHODS,
  2065.   METHOD-QUALIFIERS, FUNCTION-KEYWORDS, SLOT-MISSING, SLOT-UNBOUND,
  2066.   PRINT-OBJECT, DESCRIBE-OBJECT, MAKE-INSTANCE, INITIALIZE-INSTANCE,
  2067.   REINITIALIZE-INSTANCE, SHARED-INITIALIZE,
  2068. the macros
  2069.   WITH-SLOTS, WITH-ACCESSORS, DEFCLASS, DEFMETHOD, DEFGENERIC,
  2070.   GENERIC-FUNCTION, GENERIC-FLET, GENERIC-LABELS,
  2071. the classes
  2072.   STANDARD-CLASS, STRUCTURE-CLASS, BUILT-IN-CLASS, STANDARD-OBJECT,
  2073.   STANDARD-GENERIC-FUNCTION, STANDARD-METHOD and all predefined classes,
  2074. and the method combination
  2075.   STANDARD
  2076. are implemented.
  2077.  
  2078. Deviations from CLtL2 chapter 28:
  2079.  
  2080. DEFCLASS : It *is* required that the superclasses of a class be defined before
  2081. the DEFCLASS form for the class is evaluated.
  2082.  
  2083. The REAL type is added to the predefined classes listed in table 28-1.
  2084.  
  2085. Only STANDARD method combination is implemented.
  2086.  
  2087. When CALL-NEXT-METHOD is called with arguments, the rule that the ordered
  2088. set of applicable methods must be the same as for the original arguments
  2089. is not enforced by the implementation.
  2090.  
  2091. CALL-NEXT-METHOD and NEXT-METHOD-P are local macros, not local functions.
  2092. Use #'(lambda () (call-next-method)) instead of #'call-next-method if you
  2093. really need it as a function.
  2094.  
  2095. There is a generic function NO-PRIMARY-METHOD (analogous to
  2096. NO-APPLICABLE-METHOD) which is called when a generic function of the class
  2097. STANDARD-GENERIC-FUNCTION is invoked and no primary method on that generic
  2098. function is applicable.
  2099.  
  2100. GENERIC-FLET and GENERIC-LABELS are implemented as macros, not as special
  2101. forms.
  2102.  
  2103. The function ENSURE-GENERIC-FUNCTION is not implemented.
  2104.  
  2105. ADD-METHOD can put methods into other generic functions than the one the method
  2106. came from.
  2107.  
  2108. PRINT-OBJECT and DESCRIBE-OBJECT are only called on objects of type
  2109. STANDARD-OBJECT.
  2110.  
  2111. DESCRIBE-OBJECT should not call DESCRIBE recursively as this would produce
  2112. more information than is likely to be useful to a human reader.
  2113.  
  2114. DOCUMENTATION still has the CLtL1 implementation.
  2115.  
  2116. User-defined method combination is not supported.
  2117. The sections 28.1.7.3., 28.1.7.4., the macros DEFINE-METHOD-COMBINATION,
  2118. CALL-METHOD and the functions INVALID-METHOD-ERROR, METHOD-COMBINATION-ERROR,
  2119. METHOD-QUALIFIERS are not implemented.
  2120.  
  2121. The special form WITH-ADDED-METHODS is not implemented.
  2122.  
  2123. Redefining classes is not supported.
  2124. The sections 28.1.10., 28.1.10.1., 28.1.10.2., 28.1.10.3., 28.1.10.4. and the
  2125. function UPDATE-INSTANCE-FOR-REDEFINED-CLASS are not implemented.
  2126.  
  2127. Changing the class of a given instance is not supported.
  2128. The sections 28.1.11., 28.1.11.1., 28.1.11.2., 28.1.11.3. and the functions
  2129. CHANGE-CLASS, UPDATE-INSTANCE-FOR-DIFFERENT-CLASS, MAKE-INSTANCES-OBSOLETE are
  2130. not implemented.
  2131.  
  2132.  
  2133.                         CHAPTER 29: Conditions
  2134.                         ----------------------
  2135.  
  2136. 29.4.1.
  2137. -------
  2138.  
  2139. The default condition type for conditions created by SIGNAL is
  2140. SIMPLE-CONDITION, not SIMPLE-ERROR.
  2141.  
  2142. 29.4.7.
  2143. -------
  2144.  
  2145. In RESTART-CASE clauses the argument list can also be specified after the
  2146. keyword/value pairs instead of before them. The syntax therefore is
  2147.   (RESTART-CASE form {restart-clause}*)
  2148. with
  2149.   restart-clause ::=   (restart-name arglist {keyword value}* {form}*)
  2150.                      | (restart-name {keyword value}* arglist {form}*)
  2151.  
  2152. The macro WITH-RESTARTS is like RESTART-CASE, except that the forms are
  2153. specified after the restart clauses instead of before them, and the
  2154. restarts created are not implicitly associated to any condition.
  2155.   (WITH-RESTARTS ({restart-clause}*) {form}*)
  2156. is therefore equivalent to (RESTART-CASE (PROGN {form}*) {restart-clause}*).
  2157.  
  2158. 29.4.8.
  2159. -------
  2160.  
  2161. COMPUTE-RESTARTS and FIND-RESTART behave as specified in dpANS: If the
  2162. optional condition argument is not NIL, only restarts associated with that
  2163. condition and restarts associated to no condition at all are considered.
  2164. Therefore the effect of associating a restart to a condition is not to
  2165. activate it, but to hide it from other conditions. This makes the syntax
  2166. dependent implicit association performed by RESTART-CASE nearly obsolete.
  2167.  
  2168. 29.4.9.
  2169. -------
  2170.  
  2171. The default condition type for conditions created by WARN is SIMPLE-WARNING,
  2172. not SIMPLE-ERROR.
  2173.  
  2174.  
  2175.                CHAPTER 90: Platform independent Extensions
  2176.                -------------------------------------------
  2177.  
  2178. 90.1. Saving an Image
  2179. ---------------------
  2180.  
  2181. The function (SAVEINITMEM [filename [:quiet] [:init-function]]) saves the
  2182. running CLISP's memory to a file. The filename defaults to "lispinit.mem".
  2183. If the :QUIET argument is not NIL, the startup banner and the good-bye
  2184. message will be suppressed. The :INIT-FUNCTION argument specifies a function
  2185. that will be executed at startup of the saved image.
  2186.  
  2187. 90.2. Quitting Lisp
  2188. -------------------
  2189.  
  2190. The functions (EXIT [errorp]), (QUIT [errorp]) and (BYE [errorp])
  2191. - all synonymous - terminate CLISP. If errorp is not NIL, CLISP aborts with
  2192. error status, i.e. the environment is informed that the CLISP session didn't
  2193. succeed.
  2194.  
  2195. 90.3. The Language
  2196. ------------------
  2197.  
  2198. The language CLISP uses to communicate with the user can be either
  2199. ENGLISH or DEUTSCH (i.e. german) or FRANCAIS (i.e. french). The macros
  2200. ENGLISH, DEUTSCH, FRANCAIS and LANGUAGE-CASE produce code that depends on
  2201. the language:
  2202. (ENGLISH english-form DEUTSCH deutsch-form FRANCAIS francais-form)
  2203. - and all permutations of this - evaluates all of english-form, deutsch-form,
  2204. francais-form in no particular order and returns the evaluation result
  2205. corresponding to the user language.
  2206. (LANGUAGE-CASE {clause}*) executes the clause (analogous to CASE) that
  2207. corresponds to the user language.
  2208. The language itself is the value of
  2209. (ENGLISH 'ENGLISH DEUTSCH 'DEUTSCH FRANCAIS 'FRANCAIS).
  2210.  
  2211.  
  2212.                   CHAPTER 91: The Debugger and Stepper
  2213.                   ------------------------------------
  2214.  
  2215. The debugger may be invoked through the functions INVOKE-DEBUGGER, BREAK,
  2216. SIGNAL, ERROR, CERROR, WARN. The stepper is invoked through the macro STEP.
  2217. Debugger and stepper execute subordinate READ - EVAL - PRINT loops (called
  2218. "break loops") which are analogous to the main READ - EVAL - PRINT loop except
  2219. for the prompt and the set of available commands. Commands must be typed
  2220. literally, without surrounding quotes or white space.
  2221.  
  2222. Commands common to the main loop, the debugger and the stepper:
  2223.   Help       prints a list of available commands.
  2224.  
  2225. Commands common to the debugger and the stepper:
  2226.   Abort      and
  2227.   Unwind     abort to the next most recent READ - EVAL - PRINT loop.
  2228.  
  2229. The stack is organized into frames and other stack elements. Usually every
  2230. invocation of an interpreted function and every evaluation of an interpreted
  2231. form corresponds to one stack frame. Special forms such as LET, LET*,
  2232. UNWIND-PROTECT and CATCH produce special kinds of stack frames.
  2233.  
  2234. In a break loop there is a current stack frame, which is initially the most
  2235. recent stack frame but can be moved using the debugger commands Up and Down.
  2236.  
  2237. Evaluation of forms in a break loop occurs in the lexical environment of the
  2238. current stack frame but in the dynamic environment of the debugger's caller.
  2239. This means that to inspect or modify a lexical variable all you have to do
  2240. is to move to the current stack frame just below the frame that corresponds
  2241. to the form or the function call that binds that variable.
  2242.  
  2243. There is a current "stack mode" which defines in how much detail the stack
  2244. is shown by the stack related debugger commands.
  2245.  
  2246. Commands common to the debugger and the stepper:
  2247.   Mode-1      sets the current mode to 1: all the stack elements are
  2248.               considered. This mode is fine for debugging compiled functions.
  2249.   Mode-2      sets the current mode to 2: all the frames are considered.
  2250.   Mode-3      sets the current mode to 3: only lexical frames (frames that
  2251.               correspond to special forms that modify the lexical environment)
  2252.               are considered.
  2253.   Mode-4      sets the current mode to 4 (the default): only EVAL and APPLY
  2254.               frames are considered. Every evaluation of a form in the
  2255.               interpreter corresponds to an EVAL frame.
  2256.   Mode-5      sets the current mode to 5: only APPLY frames are considered.
  2257.               Every invocation of an interpreted function corresponds to one
  2258.               APPLY frame.
  2259.   Where       shows the current stack frame.
  2260.   Up          goes up one frame, i.e. to the caller if in mode-5
  2261.   Down        does down one frame, i.e. to the callee if in mode-5
  2262.   Top         goes to top frame, i.e. to the top-level form if in mode-4
  2263.   Bottom      goes to bottom (most recent) frame, i.e. most probably to the
  2264.               form or function that caused the debugger to be entered.
  2265.   Backtrace   lists the stack in current mode, bottom frame first, top frame
  2266.               last.
  2267.   Backtrace-1 lists the stack in mode 1.
  2268.   Backtrace-2 lists the stack in mode 2.
  2269.   Backtrace-3 lists the stack in mode 3.
  2270.   Backtrace-4 lists the stack in mode 4.
  2271.   Backtrace-5 lists the stack in mode 5.
  2272. If the current stack frame is an EVAL or APPLY frame, the following commands
  2273. are available as well:
  2274.   Break+      sets a breakpoint in the current frame. When the corresponding
  2275.               form or function will be left, the debugger will be entered
  2276.               again, with the variable *TRACE-VALUES* containing a list of
  2277.               its values.
  2278.   Break-      removes a breakpoint from the current frame.
  2279.   Redo        re-evaluates the corresponding form or function call. This
  2280.               command can be used to restart parts of a computation without
  2281.               aborting it entirely.
  2282.   Return      leaves the current frame. You will be prompted for the
  2283.               return values.
  2284.  
  2285. Commands specific to the debugger:
  2286.   Continue    continues evaluation of the program.
  2287.  
  2288. Commands specific to the stepper:
  2289.   Step        step into a form: evaluate this form in single step mode
  2290.   Next        step over a form: evaluate this form at once
  2291.   Over        step over this level: evaluate at once up to the next return
  2292.   Continue    switch off single step mode, continue evaluation
  2293.  
  2294. The stepper is usually used like this: If some form returns a strange value
  2295. or results in an error, call  (STEP form)  and navigate using the commands
  2296. Step  and  Next  until you reach the form you regard as responsible. If you
  2297. are too fast (execute Next once and get the error), there is no way back; you
  2298. have to restart the entire stepper session. If you are too slow (stepped into
  2299. a function or a form which certainly is OK), a couple of Next commands or one
  2300. Over command will help.
  2301.  
  2302. #if defined(SCREEN) || defined(AMIGAOS)
  2303.  
  2304.                 CHAPTER 99: Platform specific Extensions
  2305.                 ----------------------------------------
  2306.  
  2307. #if 0
  2308. 99.1. The Editor
  2309. ----------------
  2310.  
  2311. #endif
  2312. #if defined(SCREEN) || defined(AMIGAOS)
  2313. 99.2. Random Screen Access
  2314. --------------------------
  2315.  
  2316. (SCREEN:MAKE-WINDOW)
  2317.   returns a "window stream". As long as this stream is open, the terminal
  2318.   is in cbreak/noecho mode. *TERMINAL-IO* shouldn't be used for input or
  2319.   output during this time. (Use WITH-KEYBOARD and *KEYBOARD-INPUT* instead.)
  2320.  
  2321. (SCREEN:WITH-WINDOW . body)
  2322.   binds SCREEN:*WINDOW* to a window stream and executes body. The stream is
  2323.   guaranteed to be closed when the body is left. During its execution,
  2324.   *TERMINAL-IO* shouldn't be used, as above.
  2325.  
  2326. (SCREEN:WINDOW-SIZE window-stream)
  2327.   returns the window's size, as two values:
  2328.   height (= Ymax+1) and width (= Xmax+1).
  2329.  
  2330. (SCREEN:WINDOW-CURSOR-POSITION window-stream)
  2331.   returns the position of the cursor in the window, as two values:
  2332.   line (>=0, <=Ymax, 0 means top), column (>=0, <=Xmax, 0 means left margin).
  2333.  
  2334. (SCREEN:SET-WINDOW-CURSOR-POSITION window-stream line column)
  2335.   sets the position of the cursor in the window.
  2336.  
  2337. (SCREEN:CLEAR-WINDOW window-stream)
  2338.   clears the window's contents and puts the cursor in the upper left corner.
  2339.  
  2340. (SCREEN:CLEAR-WINDOW-TO-EOT window-stream)
  2341.   clears the window's contents from the cursor position to the end of window.
  2342.  
  2343. (SCREEN:CLEAR-WINDOW-TO-EOL window-stream)
  2344.   clears the window's contents from the cursor position to the end of line.
  2345.  
  2346. (SCREEN:DELETE-WINDOW-LINE window-stream)
  2347.   removes the cursor's line, moves the lines below it up by one line and
  2348.   clears the window's last line.
  2349.  
  2350. (SCREEN:INSERT-WINDOW-LINE window-stream)
  2351.   inserts a line at the cursor's line, moving the lines below it down by
  2352.   one line.
  2353.  
  2354. (SCREEN:HIGHLIGHT-ON window-stream)
  2355.   switches highlighted output on.
  2356.  
  2357. (SCREEN:HIGHLIGHT-OFF window-stream)
  2358.   switches highlighted output off.
  2359.  
  2360. (SCREEN:WINDOW-CURSOR-ON window-stream)
  2361.   makes the cursor visible, a cursor block in most implementations.
  2362.  
  2363. (SCREEN:WINDOW-CURSOR-OFF window-stream)
  2364.   makes the cursor invisible, in implementations where this is possible.
  2365.  
  2366. #endif
  2367. #ifdef AMIGAOS
  2368. 99.3. ARexx
  2369. -----------
  2370.  
  2371. CLISP comes with a small yet extensible and powerful ARexx interface.
  2372.  
  2373. (REXX-DO-COMMAND "return address()" :STRING T :RESULT T) tells you the
  2374. name of the CLISP ARexx port. The default extension for CLISP ARexx
  2375. scripts is "cl".
  2376.  
  2377. (REXX-DO-COMMAND command &KEY :string :result :token :io)
  2378.   -> (RC &OPTIONAL RESULT), or NIL on failure
  2379.  
  2380. (REXX-RUN-COMMAND command &KEY :string :token)
  2381.   -> T, or NIL on failure
  2382.  
  2383. (REXX-SEND-COMMAND command &KEY :string :result :token :io :async)
  2384.   -> arexx-msg-handle, or NIL on failure
  2385.  
  2386. (REXX-WAIT-SENT-COMMAND arexx-msg-handle)
  2387.   -> (RC &OPTIONAL RESULT), or NIL on failure
  2388.  
  2389. (REXX-LOOP)
  2390.   -> no return
  2391.  
  2392. Command may be a string denoting a command with optional arguments or a
  2393. vector of strings thus denoting an ARexx function call. The first
  2394. element in the vector is the function name, the others are the up to 15
  2395. arguments.
  2396.  
  2397. ARexx server mode: Like Ispell, Csh and SKsh, you can run it in server
  2398. mode by calling (REXX-LOOP). You can then only exit with the ARexx
  2399. exit-loop.cl script.
  2400.  
  2401. Restrictions: Currently CLISP is not able to wait for input from
  2402. several sources, e.g. both a console and ARexx, at the same time.
  2403.  
  2404. #endif
  2405. #ifdef AMIGAOS
  2406. 99.9. Other
  2407. -----------
  2408.  
  2409. To have *DEBUG-IO* and *ERROR-OUTPUT* point to separate console windows
  2410. (thus keeping your standard console window clean from error messages)
  2411. you can use
  2412.   (SETQ *ERROR-OUTPUT*
  2413.     (SETQ *DEBUG-IO*
  2414.       (OPEN "CON:0/0/500/300/CLISP-Debugger/AUTO/CLOSE" :DIRECTION :IO)
  2415.   ) )
  2416. at startup.
  2417.  
  2418. #endif
  2419. #endif
  2420.  
  2421. Authors:
  2422. --------
  2423.  
  2424.         Bruno Haible                    Michael Stoll
  2425.         Augartenstra▀e 40               Gallierweg 39
  2426.     D - 76137 Karlsruhe             D - 53117 Bonn
  2427.         Germany                         Germany
  2428.  
  2429. Email:  haible@ma2s2.mathematik.uni-karlsruhe.de
  2430.