BSD 4 development
authorBill Joy <wnj@ucbvax.Berkeley.EDU>
Wed, 22 Oct 1980 17:08:13 +0000 (09:08 -0800)
committerBill Joy <wnj@ucbvax.Berkeley.EDU>
Wed, 22 Oct 1980 17:08:13 +0000 (09:08 -0800)
Work on file usr/lib/lisp/manual/ch0.r
Work on file usr/lib/lisp/manual/ch1.r
Work on file usr/lib/lisp/manual/ch10.r
Work on file usr/lib/lisp/manual/ch11.r
Work on file usr/lib/lisp/manual/ch12.r
Work on file usr/lib/lisp/manual/ch2.r
Work on file usr/lib/lisp/manual/ch3.r
Work on file usr/lib/lisp/manual/ch4.r
Work on file usr/lib/lisp/manual/ch5.r
Work on file usr/lib/lisp/manual/ch6.r
Work on file usr/lib/lisp/manual/ch7.r
Work on file usr/lib/lisp/manual/ch8.r
Work on file usr/lib/lisp/manual/ch9.r
Work on file usr/lib/lisp/manual/chb.r
Work on file usr/lib/lisp/manual/chc.r
Work on file usr/lib/lisp/manual/helpindex

Synthesized-from: CSRG//cd1/4.0

16 files changed:
usr/lib/lisp/manual/ch0.r [new file with mode: 0644]
usr/lib/lisp/manual/ch1.r [new file with mode: 0644]
usr/lib/lisp/manual/ch10.r [new file with mode: 0644]
usr/lib/lisp/manual/ch11.r [new file with mode: 0644]
usr/lib/lisp/manual/ch12.r [new file with mode: 0644]
usr/lib/lisp/manual/ch2.r [new file with mode: 0644]
usr/lib/lisp/manual/ch3.r [new file with mode: 0644]
usr/lib/lisp/manual/ch4.r [new file with mode: 0644]
usr/lib/lisp/manual/ch5.r [new file with mode: 0644]
usr/lib/lisp/manual/ch6.r [new file with mode: 0644]
usr/lib/lisp/manual/ch7.r [new file with mode: 0644]
usr/lib/lisp/manual/ch8.r [new file with mode: 0644]
usr/lib/lisp/manual/ch9.r [new file with mode: 0644]
usr/lib/lisp/manual/chb.r [new file with mode: 0644]
usr/lib/lisp/manual/chc.r [new file with mode: 0644]
usr/lib/lisp/manual/helpindex [new file with mode: 0644]

diff --git a/usr/lib/lisp/manual/ch0.r b/usr/lib/lisp/manual/ch0.r
new file mode 100644 (file)
index 0000000..609792b
--- /dev/null
@@ -0,0 +1,261 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                           The FRANZ LISP Manual
+
+                                    by
+
+                             _\bJ_\bo_\bh_\bn _\bK_\b. _\bF_\bo_\bd_\be_\br_\ba_\br_\bo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                                                              A document in
+                                                             four movements
+
+
+
+
+
+
+
+
+\e9
+
+\e9
+
+
+
+
+
+
+
+
+
+
+                       _\bO_\bv_\be_\br_\bt_\bu_\br_\be
+
+
+     _\bA _\bc_\bh_\bo_\br_\bu_\bs  _\bo_\bf  _\bs_\bt_\bu_\bd_\be_\bn_\bt_\bs,  _\bu_\bn_\bd_\be_\br  _\bt_\bh_\be  _\bd_\bi_\br_\be_\bc_\bt_\bi_\bo_\bn  _\bo_\bf
+     _\bR_\bi_\bc_\bh_\ba_\br_\bd  _\bF_\ba_\bt_\be_\bm_\ba_\bn,  _\bh_\ba_\bv_\be  _\bc_\bo_\bn_\bt_\br_\bi_\bb_\bu_\bt_\be_\bd  _\bt_\bo  _\bb_\bu_\bi_\bl_\bd_\bi_\bn_\bg
+     _\bF_\bR_\bA_\bN_\bZ _\bL_\bI_\bS_\bP _\bf_\br_\bo_\bm _\ba _\bm_\be_\br_\be _\bm_\be_\bl_\bo_\bd_\by _\bi_\bn_\bt_\bo _\ba _\bf_\bu_\bl_\bl _\bs_\by_\bm_\bp_\bh_\bo_\bn_\by
+     .   _\bT_\bh_\be  _\bm_\ba_\bj_\bo_\br  _\bc_\bo_\bn_\bt_\br_\bi_\bb_\bu_\bt_\bo_\br_\bs _\bt_\bo _\bt_\bh_\be _\bi_\bn_\bi_\bt_\bi_\ba_\bl _\bs_\by_\bs_\bt_\be_\bm
+     _\bw_\be_\br_\be _\bM_\bi_\bk_\be _\bC_\bu_\br_\br_\by,  _\bJ_\bo_\bh_\bn _\bB_\br_\be_\be_\bd_\bl_\bo_\bv_\be _\ba_\bn_\bd  _\bJ_\be_\bf_\bf  _\bL_\be_\bv_\bi_\bn_\b-
+     _\bs_\bk_\by.   _\bB_\bi_\bl_\bl  _\bR_\bo_\bw_\ba_\bn _\ba_\bd_\bd_\be_\bd _\bt_\bh_\be _\bg_\ba_\br_\bb_\ba_\bg_\be _\bc_\bo_\bl_\bl_\be_\bc_\bt_\bo_\br _\ba_\bn_\bd
+     _\ba_\br_\br_\ba_\by _\bp_\ba_\bc_\bk_\ba_\bg_\be.  _\bT_\bo_\bm _\bL_\bo_\bn_\bd_\bo_\bn _\bw_\bo_\br_\bk_\be_\bd _\bo_\bn _\ba_\bn _\be_\ba_\br_\bl_\by _\bc_\bo_\bm_\b-
+     _\bp_\bi_\bl_\be_\br  _\ba_\bn_\bd _\bh_\be_\bl_\bp_\be_\bd _\bi_\bn _\bo_\bv_\be_\br_\ba_\bl_\bl _\bs_\by_\bs_\bt_\be_\bm _\bd_\be_\bs_\bi_\bg_\bn.  _\bK_\be_\bi_\bt_\bh
+     _\bS_\bk_\bl_\bo_\bw_\be_\br _\bh_\ba_\bs _\bc_\bo_\bn_\bt_\br_\bi_\bb_\bu_\bt_\be_\bd _\bm_\bu_\bc_\bh _\bt_\bo _\bF_\bR_\bA_\bN_\bZ _\bL_\bI_\bS_\bP, _\ba_\bd_\bd_\bi_\bn_\bg
+     _\bt_\bh_\be  _\bb_\bi_\bg_\bn_\bu_\bm  _\bp_\ba_\bc_\bk_\ba_\bg_\be _\ba_\bn_\bd _\br_\be_\bw_\br_\bi_\bt_\bi_\bn_\bg _\bm_\bo_\bs_\bt _\bo_\bf _\bc_\bo_\bd_\be _\bt_\bo
+     _\bi_\bn_\bc_\br_\be_\ba_\bs_\be _\bi_\bt_\bs _\be_\bf_\bf_\bi_\bc_\bi_\be_\bn_\bc_\by _\ba_\bn_\bd _\bc_\bl_\ba_\br_\bi_\bt_\by.  _\bK_\bi_\bp_\bp _\bH_\bi_\bc_\bk_\bm_\ba_\bn
+     _\ba_\bn_\bd  _\bC_\bh_\ba_\br_\bl_\be_\bs  _\bK_\bo_\be_\bs_\bt_\be_\br  _\ba_\bd_\bd_\be_\bd  _\bh_\bu_\bn_\bk_\bs.  _\bM_\bi_\bt_\bc_\bh _\bM_\ba_\br_\bc_\bu_\bs
+     _\ba_\bd_\bd_\be_\bd *_\br_\bs_\be_\bt, _\be_\bv_\ba_\bl_\bh_\bo_\bo_\bk _\ba_\bn_\bd  _\be_\bv_\ba_\bl_\bf_\br_\ba_\bm_\be.   _\bD_\bo_\bn  _\bC_\bo_\bh_\be_\bn
+     _\ba_\bn_\bd  _\bo_\bt_\bh_\be_\br_\bs  _\ba_\bt _\bC_\ba_\br_\bn_\be_\bg_\bi_\be-_\bM_\be_\bl_\bl_\bo_\bn _\bm_\ba_\bd_\be _\bs_\bo_\bm_\be _\bi_\bm_\bp_\br_\bo_\bv_\be_\b-
+     _\bm_\be_\bn_\bt_\bs _\bt_\bo _\be_\bv_\ba_\bl_\bf_\br_\ba_\bm_\be _\ba_\bn_\bd _\bm_\ba_\bi_\bn_\bt_\ba_\bi_\bn  _\bt_\bh_\be  _\bs_\bo_\bf_\bt_\bw_\ba_\br_\be  _\bt_\bo
+     _\bu_\bs_\be _\bi_\bt.  _\bJ_\bo_\bh_\bn _\bF_\bo_\bd_\be_\br_\ba_\br_\bo _\bw_\br_\bo_\bt_\be _\bt_\bh_\be _\bc_\bo_\bm_\bp_\bi_\bl_\be_\br, _\ba_\bd_\bd_\be_\bd _\ba
+     _\bf_\be_\bw _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs, _\ba_\bn_\bd _\bw_\br_\bo_\bt_\be _\bt_\bh_\bi_\bs _\bm_\bo_\bd_\be_\bs_\bt _\bm_\ba_\bn_\bu_\ba_\bl.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e8c\e9 1980 by the Regents of the University of California.
+All rights reserved.
+
+
+Work reported herein was supported in part by the U.  S.  Depart-
+ment  of  Energy,  Contract  DE-AT03-76SF00034, Project Agreement
+DE-AS03-79ER10358, and  the  National  Science  Foundation  under
+Grant No.  MCS 7807291
+
+
+UNIX is a trademark of Bell Laboratories.
+
+
+
+\e9
+
+\e9
+
+
+
+
+
+
+
+
+
+
+                              Score
+
+
+
+                    First Movement (_\ba_\bl_\bl_\be_\bg_\br_\bo _\bn_\bo_\bn _\bt_\br_\bo_\bp_\bp_\bo)
+
+     1. FRANZ LISZT
+          _\bI_\bn_\bt_\br_\bo_\bd_\bu_\bc_\bt_\bi_\bo_\bn _\bt_\bo _\bF_\bR_\bA_\bN_\bZ _\bL_\bI_\bS_\bP, _\bd_\be_\bt_\ba_\bi_\bl_\bs _\bo_\bf _\bd_\ba_\bt_\ba _\bt_\by_\bp_\be_\bs,  _\ba_\bn_\bd
+          _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn _\bo_\bf _\bn_\bo_\bt_\ba_\bt_\bi_\bo_\bn
+     2. Data Structure Access
+          _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs _\bf_\bo_\br _\bt_\bh_\be _\bc_\br_\be_\ba_\bt_\bi_\bo_\bn, _\bd_\be_\bs_\bt_\br_\bu_\bc_\bt_\bi_\bo_\bn _\ba_\bn_\bd   _\bm_\ba_\bn_\bi_\bp_\bu_\bl_\ba_\b-
+          _\bt_\bi_\bo_\bn _\bo_\bf _\bl_\bi_\bs_\bp _\bd_\ba_\bt_\ba _\bo_\bb_\bj_\be_\bc_\bt_\bs.
+     3. Arithmetic Functions
+          _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs _\bt_\bo _\bp_\be_\br_\bf_\bo_\br_\bm _\ba_\br_\bi_\bt_\bh_\bm_\be_\bt_\bi_\bc _\bo_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn_\bs.
+     4. Special Functions
+          _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs _\bf_\bo_\br _\ba_\bl_\bt_\be_\br_\bi_\bn_\bg _\bf_\bl_\bo_\bw _\bo_\bf _\bc_\bo_\bn_\bt_\br_\bo_\bl.  _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs  _\bf_\bo_\br
+          _\bm_\ba_\bp_\bp_\bi_\bn_\bg _\bo_\bt_\bh_\be_\br _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs _\bo_\bv_\be_\br _\bl_\bi_\bs_\bt_\bs.
+     5. I/O Functions
+          _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs _\bf_\bo_\br _\br_\be_\ba_\bd_\bi_\bn_\bg _\ba_\bn_\bd _\bw_\br_\bi_\bt_\bi_\bn_\bg  _\bf_\br_\bo_\bm  _\bp_\bo_\br_\bt_\bs.   _\bF_\bu_\bn_\bc_\b-
+          _\bt_\bi_\bo_\bn_\bs _\bf_\bo_\br _\bt_\bh_\be _\bm_\bo_\bd_\bi_\bf_\bi_\bc_\ba_\bt_\bi_\bo_\bn _\bo_\bf _\bt_\bh_\be _\br_\be_\ba_\bd_\be_\br'_\bs _\bs_\by_\bn_\bt_\ba_\bx.
+     6. System Functions
+          _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs _\bf_\bo_\br _\bs_\bt_\bo_\br_\ba_\bg_\be _\bm_\ba_\bn_\ba_\bg_\be_\bm_\be_\bn_\bt,  _\bd_\be_\bb_\bu_\bg_\bg_\bi_\bn_\bg,  _\ba_\bn_\bd  _\bf_\bo_\br
+          _\bt_\bh_\be  _\br_\be_\ba_\bd_\bi_\bn_\bg  _\ba_\bn_\bd  _\bs_\be_\bt_\bt_\bi_\bn_\bg  _\bo_\bf _\bg_\bl_\bo_\bb_\ba_\bl _\bL_\bi_\bs_\bp _\bs_\bt_\ba_\bt_\bu_\bs _\bv_\ba_\br_\bi_\b-
+          _\ba_\bb_\bl_\be_\bs.  _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs _\bf_\bo_\br _\bd_\bo_\bi_\bn_\bg _\bU_\bN_\bI_\bX _\bs_\bp_\be_\bc_\bi_\bf_\bi_\bc _\bt_\ba_\bs_\bk_\bs _\bs_\bu_\bc_\bh _\ba_\bs
+          _\bp_\br_\bo_\bc_\be_\bs_\bs _\bc_\bo_\bn_\bt_\br_\bo_\bl.
+
+
+                    Second Movement (_\bL_\ba_\br_\bg_\bo)
+
+     7. The Reader
+          _\bA _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn _\bo_\bf _\bt_\bh_\be _\bs_\by_\bn_\bt_\ba_\bx _\bc_\bo_\bd_\be_\bs _\bu_\bs_\be_\bd _\bb_\by  _\bt_\bh_\be  _\br_\be_\ba_\bd_\be_\br.
+          _\bA_\bn _\be_\bx_\bp_\bl_\ba_\bn_\ba_\bt_\bi_\bo_\bn _\bo_\bf _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br _\bm_\ba_\bc_\br_\bo_\bs.
+     8. Functions and Macros
+          _\bA _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn _\bo_\bf _\bt_\bh_\be _\bv_\ba_\br_\bi_\bo_\bu_\bs  _\bt_\by_\bp_\be_\bs  _\bo_\bf  _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs  _\ba_\bn_\bd
+          _\bm_\ba_\bc_\br_\bo_\bs.  _\bA_\bn _\be_\bx_\ba_\bm_\bp_\bl_\be _\bo_\bf _\bt_\bh_\be _\bu_\bs_\be _\bo_\bf _\bf_\bo_\br_\be_\bi_\bg_\bn _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs.
+     9. Arrays
+          _\bA _\bd_\be_\bt_\ba_\bi_\bl_\be_\bd _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn _\bo_\bf _\bt_\bh_\be _\bp_\ba_\br_\bt_\bs _\bo_\bf _\ba_\bn _\ba_\br_\br_\ba_\by _\ba_\bn_\bd  _\bo_\bf
+          _\bM_\ba_\bc_\bl_\bi_\bs_\bp _\bc_\bo_\bm_\bp_\ba_\bt_\bi_\bb_\bl_\be _\ba_\br_\br_\ba_\by_\bs.
+     10. Exception Handling
+          _\bA _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn _\bo_\bf _\bt_\bh_\be _\be_\br_\br_\bo_\br  _\bh_\ba_\bn_\bd_\bl_\bi_\bn_\bg  _\bs_\be_\bq_\bu_\be_\bn_\bc_\be  _\ba_\bn_\bd  _\bo_\bf
+          _\ba_\bu_\bt_\bo_\bl_\bo_\ba_\bd_\bi_\bn_\bg.
+
+
+                    Third Movement (_\bS_\bc_\bh_\be_\br_\bz_\bo)
+
+     11. The Joseph Lister Trace Package
+          _\bA _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn _\bo_\bf _\ba _\bv_\be_\br_\by _\bu_\bs_\be_\bf_\bu_\bl _\bd_\be_\bb_\bu_\bg_\bg_\bi_\bn_\bg _\ba_\bi_\bd.
+     12. Liszt, the lisp compiler
+          _\bA _\bd_\be_\bs_\bc_\br_\bi_\bp_\bt_\bi_\bo_\bn _\bo_\bf _\bt_\bh_\be  _\bo_\bp_\be_\br_\ba_\bt_\bi_\bo_\bn  _\bo_\bf  _\bt_\bh_\be  _\bc_\bo_\bm_\bp_\bi_\bl_\be_\br  _\ba_\bn_\bd
+          _\bh_\bi_\bn_\bt_\bs _\bf_\bo_\br _\bm_\ba_\bk_\bi_\bn_\bg _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs _\bc_\bo_\bm_\bp_\bi_\bl_\ba_\bb_\bl_\be.
+
+
+                    Final Movement (_\ba_\bl_\bl_\be_\bg_\br_\bo)
+
+
+
+
+
+
+
+
+
+
+
+
+
+     Appendix A - Function Index
+     Appendix B - List of Special Symbols
+     Appendix C - Short Subjects
+          _\bG_\ba_\br_\bb_\ba_\bg_\be _\bc_\bo_\bl_\bl_\be_\bc_\bt_\bo_\br, _\bD_\be_\bb_\bu_\bg_\bg_\bi_\bn_\bg, _\bT_\bo_\bp _\bL_\be_\bv_\be_\bl
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9
+
+
+
diff --git a/usr/lib/lisp/manual/ch1.r b/usr/lib/lisp/manual/ch1.r
new file mode 100644 (file)
index 0000000..e4e88e7
--- /dev/null
@@ -0,0 +1,734 @@
+
+
+
+
+
+
+
+                                CHAPTER  1
+
+
+                                FRANZ LISP
+
+
+
+
+
+
+
+   _\b1._\b1.  FRANZ LISP[] was created as a tool to further research in Symbolic
+      Algebraic  Manipulation,  Artificial  Intelligence,  and  programming
+      languages at the University of California at Berkeley.  Its roots are
+      in  the PDP-11 Lisp system which originally came from Harvard.  As it
+      grew it adopted features of  Maclisp  and  Lisp  Machine  Lisp  which
+      enables  our  work to be shared with colleagues at the Laboratory for
+      Computer Science at M.I.T.  It is written almost entirely in the pro-
+      gramming  language  C.   A  small  part  is  written in the assembler
+      language for the current host machine, a  VAX  11/780,  and  part  is
+      written  in Lisp.  Because FRANZ LISP is written in C, it is portable
+      and easy to comprehend.
+
+           FRANZ LISP is capable  of  running  large  lisp  programs  in  a
+      timesharing  environment,  has facilities for arrays and user defined
+      structures, has a user controlled  reader  with  character  and  word
+      macro  capabilities, and can interact directly with compiled Lisp, C,
+      Fortran, and Pascal code.
+
+
+
+
+   _\b1._\b2.  This document is a reference manual for the FRANZ LISP system.  It
+      is  not  a  Lisp  primer or introduction to the language.  Some parts
+      will be of interest only to those maintaining  FRANZ  LISP  at  their
+      computer site.  This document is divided into four Movements.  In the
+      first one we will attempt to describe the language of FRANZ LISP pre-
+      cisely  and completely as it now stands (Opus 33b, October 1980).  In
+      the second Movement we will  look  at  the  reader,  function  types,
+      arrays and exception handling.  In the third Movement we will look at
+      several large support packages written to help the FRANZ  LISP  user,
+      namely  the  trace package and compiler.  Finally the fourth movement
+      contains  an index into the other movements.  In  the  rest  of  this
+      chapter  we  shall examine the data types of FRANZ LISP.  The conven-
+      tions used in the description of the FRANZ  LISP  functions  will  be
+      given  in  section 1.4 -- it is very important that these conventions
+      are  understood.
+____________________
+\e9   []It is rumored that this name has something  to  do  with  Franz  Liszt
+[F_\brants List] (1811-1886) a Hungarian composer and keyboard virtuoso. These
+allegations have never been proven.
+
+
+
+\e9FRANZ LISP                                                              1-1
+
+
+
+
+
+
+
+FRANZ LISP                                                              1-2
+
+
+   _\b1._\b3.  _\bD_\ba_\bt_\ba _\bT_\by_\bp_\be_\bs   FRANZ LISP has eleven data types.  In this section we
+      shall look in detail at each type and if a type is divisible we shall
+      look inside it.  There is a Lisp function _\bt_\by_\bp_\be which will return  the
+      type name of a lisp object.  This is the official FRANZ LISP name for
+      that type and we will use this name and this name only in the  manual
+      to  avoid  confusing  the  reader.   The types are listed in terms of
+      importance rather than alphabetically.
+
+
+
+
+      _\b1._\b3._\b0.  _\bl_\bi_\bs_\bp_\bv_\ba_\bl   This is the  name  we  use  to  describe  any  lisp
+         object.  The function _\bt_\by_\bp_\be will never return `lispval'.
+
+
+
+
+      _\b1._\b3._\b1.  _\bs_\by_\bm_\bb_\bo_\bl   This object corresponds to a variable in most  other
+         programming  languages.   It may have a value or may be `unbound'.
+         A symbol may be _\bl_\ba_\bm_\bb_\bd_\ba _\bb_\bo_\bu_\bn_\bd meaning that  its  current  value  is
+         stored away somewhere and the symbol  is given a new value for the
+         duration of a certain context.  When the  Lisp  processor   leaves
+         that  context,  the  symbol's current value is thrown away and its
+         old value is restored.
+\e9         A symbol may also have a _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn _\bb_\bi_\bn_\bd_\bi_\bn_\bg.  This function  binding
+         is static; it cannot be lambda bound.  Whenever the symbol is used
+         in the functional position of a Lisp expression the function bind-
+         ing  of the symbol is examined (see 4 for more details on  evalua-
+         tion).
+\e9         A symbol may also have a _\bp_\br_\bo_\bp_\be_\br_\bt_\by _\bl_\bi_\bs_\bt, another static data struc-
+         ture.   The  property list consists of a list of an even number of
+         elements, considered to be grouped as pairs. The first element  of
+         the pair is the _\bi_\bn_\bd_\bi_\bc_\ba_\bt_\bo_\br the second the _\bv_\ba_\bl_\bu_\be of that indicator.
+\e9         Each symbol has a print name (_\bp_\bn_\ba_\bm_\be) which is how this  symbol  is
+         accessed from input and referred to on  (printed) output.  This is
+         also used when one tests for equality of symbols using  the  func-
+         tion _\be_\bq_\bu_\ba_\bl.
+\e9         A symbol also has a hashlink used to link symbols together in  the
+         oblist -- this field is inaccessible to the lisp user.
+\e9         Symbols are created by the reader and  by  the  functions  _\bc_\bo_\bn_\bc_\ba_\bt,
+         _\bm_\ba_\bk_\bn_\ba_\bm  and  their derivatives.  Most symbols live on FRANZ LISP's
+         sole _\bo_\bb_\bl_\bi_\bs_\bt, and therefore two symbols with the  same  print  name
+         are  usually  the  exact same object (they are _\be_\bq).  Symbols which
+         are not on the oblist are said to  be  _\bu_\bn_\bi_\bn_\bt_\be_\br_\bn_\be_\bd.   The  function
+         _\bm_\ba_\bk_\bn_\ba_\bm  creates  uninterned  symbols while _\bc_\bo_\bn_\bc_\ba_\bt creates _\bi_\bn_\bt_\be_\br_\bn_\be_\bd
+         ones.
+
+
+
+
+
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+FRANZ LISP                                                              1-3
+
+
+\e8            ____________________________________________________________
+             Subpart name   Get value   Set value          Type
+
+\e8            ____________________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b____________________________________________________________
+                value         eval         set            lispval
+                                          setq
+\e8            ____________________________________________________________
+               property       plist     setplist        list or nil
+                 list          get       putprop
+\e8            ____________________________________________________________
+               function       getd        putd      array, binary, list
+               binding                     def            or nil
+\e8            ____________________________________________________________
+              print name    get_pname                     string
+\e8            ____________________________________________________________
+              hash link
+\e8            ____________________________________________________________
+\e7           |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+                         |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+                                     |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+                                                 |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+                                                                       |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+      _\b1._\b3._\b2.  _\bl_\bi_\bs_\bt   A list cell has two parts, called  the  car  and  cdr.
+         List cells are created by the function _\bc_\bo_\bn_\bs.
+
+
+\e8                  ________________________________________________
+                   Subpart name   Get value   Set value    Type
+
+\e8                  ________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b________________________________________________
+                       car           car       rplaca     lispval
+\e8                  ________________________________________________
+                       cdr           cdr       rplacd     lispval
+\e8                  ________________________________________________
+\e7                 |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+\e9                               |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+\e9                                           |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+\e9                                                       |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+\e9                                                                 |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+\e9
+
+
+
+      _\b1._\b3._\b3.  _\bb_\bi_\bn_\ba_\br_\by   This type acts as  a  function  header  for  machine
+         coded  functions.  It has two parts, a pointer to the start of the
+         function and a symbol whose print name describes the argument _\bd_\bi_\bs_\b-
+         _\bc_\bi_\bp_\bl_\bi_\bn_\be.   The discipline (if _\bl_\ba_\bm_\bb_\bd_\ba, _\bm_\ba_\bc_\br_\bo or _\bn_\bl_\ba_\bm_\bb_\bd_\ba) determines
+         whether the arguments to this function will be  evaluated  by  the
+         caller  before  this  function  is called.  If the discipline is a
+         string (either "_\bs_\bu_\bb_\br_\bo_\bu_\bt_\bi_\bn_\be",  "_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn",  "_\bi_\bn_\bt_\be_\bg_\be_\br-_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn",  or
+         "_\br_\be_\ba_\bl-_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn")  then  this  function  is a foreign subroutine or
+         function (see 8.4 for more details on this).  Although the type of
+         the  _\be_\bn_\bt_\br_\by  field of a binary type object is either string or fix-
+         num, the object pointed to  is  actually  a  sequence  of  machine
+         instructions.
+         Objects of type binary are created by _\bm_\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn.
+
+
+
+
+
+
+
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+FRANZ LISP                                                              1-4
+
+
+\e8             _________________________________________________________
+              Subpart name   Get value   Set value         Type
+
+\e8             _________________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b_________________________________________________________
+                 entry       getentry                string or fixnum
+\e8             _________________________________________________________
+               discipline     getdisc     putdisc    symbol or fixnum
+\e8             _________________________________________________________
+\e7            |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+\e9                          |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+\e9                                      |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+\e9                                                  |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+\e9                                                                     |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+\e9
+
+
+
+      _\b1._\b3._\b4.  _\bf_\bi_\bx_\bn_\bu_\bm   A fixnum is an integer constant in the range  -2[31]
+         to 2[31]-1.  Small fixnums (-1024 to 1023) are stored in a special
+         table so they needn't be allocated each time one is needed.
+
+
+
+
+      _\b1._\b3._\b5.  _\bf_\bl_\bo_\bn_\bu_\bm   A flonum is a double precision real  number  in  the
+         range  +\b_2.9x10[-37]  to +\b_1.7x10[38].  There are approximately six-
+         teen decimal digits of precision.
+
+
+
+
+      _\b1._\b3._\b6.  _\bb_\bi_\bg_\bn_\bu_\bm   A bignum is  an  integer  of  potentially  unbounded
+         size.   When integer arithmetic exceeds the limits mentioned above
+         the calculation is automatically  done with bignums.  Should  cal-
+         culation  with bignums give a result which can be represented as a
+         fixnum, then the fixnum representation will be used[].  This  con-
+         traction  is  known as _\bi_\bn_\bt_\be_\bg_\be_\br _\bn_\bo_\br_\bm_\ba_\bl_\bi_\bz_\ba_\bt_\bi_\bo_\bn.  Many Lisp functions
+         assume that integers are  normalized.   If  the  user  chooses  to
+         rewrite the bignum package he should take this into account.
+
+
+
+         The functions used for the extraction and modification of parts of
+         bignums may change from what is shown in the table sometime in the
+         future.
+
+
+
+
+
+
+
+____________________
+\e9   []The current algorithms for integer arithmetic operations  will  return
+(in  certain  cases) a result between +\b_2[30] and 2[31] as a bignum although
+this could be represented as a fixnum.
+
+
+
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+FRANZ LISP                                                              1-5
+
+
+\e8              ________________________________________________________
+               Subpart name   Get value   Set value        Type
+
+\e8              ________________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b________________________________________________________
+                    i            car       rplaca     unboxed integer
+\e8              ________________________________________________________
+                   CDR           cdr       rplacd        bignum or
+                                                      the symbol nil
+\e8              ________________________________________________________
+\e7             |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+\e9                           |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+\e9                                       |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+\e9                                                   |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+\e9                                                                     |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+\e9
+
+
+
+      _\b1._\b3._\b7.  _\bs_\bt_\br_\bi_\bn_\bg   A string is a null terminated  sequence  of  charac-
+         ters.   Most  functions  of  symbols which operate on the symbol's
+         print name will also work on strings.  The default  reader  syntax
+         is set so that a string object is surrounded by double quotes.
+
+
+
+
+      _\b1._\b3._\b8.  _\bp_\bo_\br_\bt   A port is a structure which the  system  I/O  routines
+         can  reference to transfer data between the Lisp system and exter-
+         nal media.  Unlike other Lisp objects there  are  a  very  limited
+         number  of  ports (20).  Ports are allocated by _\bi_\bn_\bf_\bi_\bl_\be and _\bo_\bu_\bt_\bf_\bi_\bl_\be
+         and deallocated by _\bc_\bl_\bo_\bs_\be and _\br_\be_\bs_\be_\bt_\bi_\bo.
+
+
+
+
+      _\b1._\b3._\b9.  _\ba_\br_\br_\ba_\by   Arrays are rather complicated  types  and  are  fully
+         described  in 9.  An array consists of a block of contiguous data,
+         a function to reference that data and auxiliary fields for use  by
+         the  referencing  function.  Since an array's referencing function
+         is created by the user, an  array  can  have  any  form  the  user
+         chooses (e.g. n-dimensional, triangular, or hash table).
+         Arrays are created by the function _\bm_\ba_\br_\br_\ba_\by.
+
+
+\e8          _______________________________________________________________
+            Subpart name     Get value   Set value          Type
+
+\e8          _______________________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b_______________________________________________________________
+           access function   getaccess   putaccess      binary, list
+                                                          or symbol
+\e8          _______________________________________________________________
+              auxiliary       getaux      putaux           lispval
+\e8          _______________________________________________________________
+                data         arrayref     replace    block of contiguous
+                                            set            lispval
+\e8          _______________________________________________________________
+               length        getlength   putlength         fixnum
+\e8          _______________________________________________________________
+                delta        getdelta    putdelta          fixnum
+\e8          _______________________________________________________________
+\e7         |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+                          |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+                                      |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+                                                  |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+                                                                        |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+FRANZ LISP                                                              1-6
+
+
+      _\b1._\b3._\b1_\b0.  _\bv_\ba_\bl_\bu_\be   A value cell contains a pointer to a lispval.   This
+         type  is  used  mainly  by  arrays of general lisp objects.  Value
+         cells are created with the _\bp_\bt_\br function.
+
+
+
+
+      _\b1._\b3._\b1_\b1.  _\bh_\bu_\bn_\bk   A hunk is a vector of from 1 to 128 lispvals.  Once a
+         hunk  is  created  (by  _\bh_\bu_\bn_\bk or _\bm_\ba_\bk_\bh_\bu_\bn_\bk) it cannot grow or shrink.
+         The access time for an element of a hunk is  slower  than  a  list
+         cell  element  but  faster  than  an array.  Hunks are really only
+         allocated in sizes which are powers of two, but can appear to  the
+         user  to  be  any size in the 1 to 128 range.  Users of hunks must
+         realize that (_\bn_\bo_\bt (_\ba_\bt_\bo_\bm '_\bl_\bi_\bs_\bp_\bv_\ba_\bl)) will return true if _\bl_\bi_\bs_\bp_\bv_\ba_\bl  is
+         a  hunk.   Most  lisp systems do not have a direct test for a list
+         cell and instead use the above test and assume that a true  result
+         means  _\bl_\bi_\bs_\bp_\bv_\ba_\bl  is a list cell.  In FRANZ LISP you can use _\bd_\bt_\bp_\br to
+         check for a list cell.  Although hunks are not list cells, you can
+         still  access the first two hunk elements with _\bc_\bd_\br and _\bc_\ba_\br and you
+         can access any hunk element with _\bc_\bx_\br[].  You can set the value  of
+         the  first  two  elements of a hunk with _\br_\bp_\bl_\ba_\bc_\bd and _\br_\bp_\bl_\ba_\bc_\ba and you
+         can set the value of any element of the hunk with _\br_\bp_\bl_\ba_\bc_\bx.  A  hunk
+         is  printed  by printing its contents surrounded by { and }.  How-
+         ever a hunk cannot be read in in this way  in  the  standard  lisp
+         system.  It is easy to write a reader macro to do this if desired.
+
+
+
+
+   _\b1._\b4.  _\bD_\bo_\bc_\bu_\bm_\be_\bn_\bt_\ba_\bt_\bi_\bo_\bn   The conventions used  in  the  following  chapters
+      were  designed  to give a great deal of information in a brief space.
+      The first line of a function description contains the  function  name
+      in bold face and then lists the arguments, if any.  The arguments all
+      have names which begin with a letter and an underscore.   The  letter
+      gives  the  allowable  type(s)  for  that  argument according to this
+      table.
+
+
+
+
+
+
+
+
+
+
+
+____________________
+\e9   []In a hunk, the function _\bc_\bd_\br references the first element and  _\bc_\ba_\br  the
+second.
+
+
+
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+FRANZ LISP                                                              1-7
+
+
+\e8             _______________________________________________________
+              Letter                Allowable type(s)
+
+\e8             _______________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b_______________________________________________________
+              g        any type
+\e8             _______________________________________________________
+              s        symbol (although nil may not be allowed)
+\e8             _______________________________________________________
+              t        string
+\e8             _______________________________________________________
+              l        list (although nil may be allowed)
+\e8             _______________________________________________________
+              n        number (fixnum, flonum, bignum)
+\e8             _______________________________________________________
+              i        integer (fixnum, bignum)
+\e8             _______________________________________________________
+              x        fixnum
+\e8             _______________________________________________________
+              b        bignum
+\e8             _______________________________________________________
+              f        flonum
+\e8             _______________________________________________________
+              u        function type (either binary or lambda body)
+\e8             _______________________________________________________
+              y        binary
+\e8             _______________________________________________________
+              a        array
+\e8             _______________________________________________________
+              v        value
+\e8             _______________________________________________________
+              p        port (or nil)
+\e8             _______________________________________________________
+              h        hunk
+\e8             _______________________________________________________
+\e7            |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                    |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+                                                                   |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+      In the first line of a function description those arguments  preceded
+      by  a  quote  mark  are  evaluated  (usually  before  the function is
+      called).  The quoting convention is used so that we can give  a  name
+      to  the  result  of  evaluating  the argument and we can describe the
+      allowable types.  If an argument is not quoted it does not mean  that
+      that  argument  will  not  be  evaluated,  but  rather  that if it is
+      evaluated the time at which it is evaluated will be specifically men-
+      tioned  in  the  function  description.   Optional arguments are sur-
+      rounded  by  square  brackets.   An  ellipsis  means  zero  or   more
+      occurrences of an argument of the directly preceding type.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9                                                  Printed: October 21, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch10.r b/usr/lib/lisp/manual/ch10.r
new file mode 100644 (file)
index 0000000..ddf8b1b
--- /dev/null
@@ -0,0 +1,328 @@
+
+
+
+
+
+
+
+                        CHAPTER  10
+
+
+                     Exception Handling
+
+
+
+
+
+
+
+   _\b1_\b0._\b1.  _\bE_\br_\br_\bs_\be_\bt _\ba_\bn_\bd _\bE_\br_\br_\bo_\br _\bH_\ba_\bn_\bd_\bl_\be_\br _\bF_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs
+
+           FRANZ LISP allows the user to handle in a  number
+      of  ways  the  errors  which arise during computation.
+      One way is through the use of the _\be_\br_\br_\bs_\be_\bt function.  If
+      an  error occurs during the evaluation of the _\be_\br_\br_\bs_\be_\bt's
+      first argument, then the locus of control will  return
+      to the errset which will return nil (except in special
+      cases, such as _\be_\br_\br).  The other method of  error  han-
+      dling  is  through an error handler function.  When an
+      error occurs, the interrupt handler is called  and  is
+      given as an argument a description  of the error which
+      just occured.  The error handler may take one  of  the
+      following actions:
+
+      (1)  it could take some drastic action like a _\br_\be_\bs_\be_\bt or
+           a _\bt_\bh_\br_\bo_\bw.
+
+      (2)  it could, assuming that the error is continuable,
+           cause  a   value  to  be  returned from the error
+           handler to the function which noticed the  error.
+           The  error  handler  indicates  that  it wants to
+           return a value from the error by returning a list
+           whose _\bc_\ba_\br is the value it wants to return.
+
+      (3)  it could decide  not  to  handle  the  error  and
+           return a non-list to indicate this fact.
+
+
+
+
+   _\b1_\b0._\b2.  _\bT_\bh_\be _\bA_\bn_\ba_\bt_\bo_\bm_\by _\bo_\bf _\ba_\bn _\be_\br_\br_\bo_\br
+
+           Each error is described by a list of these items:
+
+      (1)  error type - This is a symbol which indicates the
+           general  classification of the error.  This clas-
+           sification may determine which  function  handles
+           this error.
+
+      (2)  unique id - This  is  a  fixnum  unique  to  this
+           error.
+
+
+Exception Handling                                      10-1
+
+
+
+
+
+
+
+Exception Handling                                      10-2
+
+
+      (3)  continuable - If this is non-nil then this  error
+           is  continuable.   There  are  some who feel that
+           every error should be continuable and the  reason
+           that some (in fact most) errors in FRANZ LISP are
+           not continuable is due to  the  laziness  of  the
+           programmers.
+
+      (4)  message string - This is  a  symbol  whose  print
+           name is  a message describing the error.
+
+      (5)  data - There may  be  from  zero  to  three  lisp
+           values   which   help  describe  this  particular
+           error.  For example, the unbound  variable  error
+           contains  one datum value, the symbol whose value
+           is unbound.  The list describing that error might
+           look like:
+               (ER%misc 0 t |Unbound Variable:| foobar)
+
+
+
+
+   _\b1_\b0._\b3.  _\bE_\br_\br_\bo_\br _\bh_\ba_\bn_\bd_\bl_\bi_\bn_\bg _\ba_\bl_\bg_\bo_\br_\bi_\bt_\bh_\bm
+
+           This is the sequence of operations which is  done
+      when an error occurs:
+
+      (1)  If the symbol _\bE_\bR%_\ba_\bl_\bl has a  non  nil  value  then
+           this  value is the name of an error handler func-
+           tion.  That function is called with a description
+           of  the  error.  If that function returns (and of
+           course it may choose not to) and the value  is  a
+           list  and  this  error  is  continuable,  then we
+           return the _\bc_\ba_\br of the list to the function  which
+           called  the error.  Presumably the function  will
+           use this value to retry the  operation.   On  the
+           other  hand,  if  the error handler returns a non
+           list, then it  has  chosen  not  to  handle  this
+           error,  so  we go on to step (2).  Something spe-
+           cial happens before  we  call  the  _\bE_\bR%_\ba_\bl_\bl  error
+           handler which does not happen in any of the other
+           cases we will describe  below.   To  help  insure
+           that we don't get infinitely recursive errors  if
+           _\bE_\bR%_\ba_\bl_\bl is set to a bad value, the value of _\bE_\bR%_\ba_\bl_\bl
+           is set to nil before the handler is called.  Thus
+           it is the responsibility of the _\bE_\bR%_\ba_\bl_\bl handler to
+           `reenable' itself by storing its name in _\bE_\bR%_\ba_\bl_\bl.
+
+      (2)  Next the specific error handler for the  type  of
+           error  which  just  occured  is  called   (if one
+           exists) to see if it wants to handle  the  error.
+           The  names of the handlers for the specific types
+           of errors are stored as the values of the symbols
+           whose  names  are  the  types.   For  example the
+
+
+                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Exception Handling                                      10-3
+
+
+           handler for miscellaneous errors is stored as the
+           value  of  _\bE_\bR%_\bm_\bi_\bs_\bc.   Of course, if _\bE_\bR%_\bm_\bi_\bs_\bc has a
+           value of nil, then there is not error handler for
+           this  type of error.  Appendix B contains list of
+           all error types.  The process of classifying  the
+           errors  is  not complete and thus most errors are
+           lumped into the ER%misc  category.   Just  as  in
+           step  (1),  the error handler function may choose
+           not to handle the error by returning a  non-list,
+           and then we go to step (3).
+
+      (3)  Next a check is made to see if there is an _\be_\br_\br_\bs_\be_\bt
+           surrounding  this  error.  If so the second argu-
+           ment to the  _\be_\br_\br_\bs_\be_\bt  call  is  examined.  If  the
+           second  argument was not given or is non nil then
+           the error message associated with this  error  is
+           printed  Finally  the stack is popped to the con-
+           text of the _\be_\br_\br_\bs_\be_\bt and then  the  _\be_\br_\br_\bs_\be_\bt  returns
+           nil.  If there was no _\be_\br_\br_\bs_\be_\bt we go to step (4).
+
+      (4)  If the symbol _\bE_\bR%_\bt_\bp_\bl has a value then it  is  the
+           name  of  and  error handler which is called in a
+           manner similar to the that discussed  above.   If
+           it chooses not to handle the error, we go to step
+           (5).
+
+      (5)  At this point it has  been  determined  that  the
+           user doesn't want to handle this error.  Thus the
+           error message is printed out and a _\br_\be_\bs_\be_\bt is  done
+           to send the flow of control to the top-level.
+
+           To summarize the error handling system:  When  an
+      error occurs, you have two chances to handle it before
+      the search for an _\be_\br_\br_\bs_\be_\bt is done.  Then, if  there  is
+      no  _\be_\br_\br_\bs_\be_\bt,  you  have  one  more chance to handle the
+      error before control jumps to the  top  level.   Every
+      error  handler  works  in  the same way: It is given a
+      description of the error (as described in the previous
+      section).   It  may or may not return.  If it returns,
+      then it returns either a list or a  non-list.   If  it
+      returns  a list and the error is continuable, then the
+      _\bc_\ba_\br of the list is  returned  to  the  function  which
+      noticed  the  error.   Otherwise the error handler has
+      decided not to handle the error and we go on to  some-
+      thing else.
+
+
+
+
+   _\b1_\b0._\b4.  _\bD_\be_\bf_\ba_\bu_\bl_\bt _\ba_\bi_\bd_\bs
+
+           There are two standard error handlers  which will
+      probably handle the needs of most users.  One of these
+
+
+                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Exception Handling                                      10-4
+
+
+      is the lisp coded function _\bb_\br_\be_\ba_\bk-_\be_\br_\br-_\bh_\ba_\bn_\bd_\bl_\be_\br which  is
+      the  default  value  of  _\bE_\bR%_\bt_\bp_\bl.   Thus when all other
+      handlers have ignored an error, _\bb_\br_\be_\ba_\bk-_\be_\br_\br-_\bh_\ba_\bn_\bd_\bl_\be_\br will
+      take over.  It will print out the error message and go
+      into a read-eval-print loop.  For a further discussion
+      of _\bb_\br_\be_\ba_\bk-_\be_\br_\br-_\bh_\ba_\bn_\bd_\bl_\be_\br, see section xx.  The other stan-
+      dard error handler is _\bd_\be_\bb_\bu_\bg-_\be_\br_\br-_\bh_\ba_\bn_\bd_\bl_\be_\br.  This handler
+      is  designed  to be connected to _\bE_\bR%_\ba_\bl_\bl.  It is useful
+      if your program uses _\be_\br_\br_\bs_\be_\bt and you want  to  look  at
+      the error it is thrown up to the _\be_\br_\br_\bs_\be_\bt.
+
+
+
+
+   _\b1_\b0._\b5.  _\bA_\bu_\bt_\bo_\bl_\bo_\ba_\bd_\bi_\bn_\bg
+
+           When _\be_\bv_\ba_\bl, _\ba_\bp_\bp_\bl_\by or _\bf_\bu_\bn_\bc_\ba_\bl_\bl are told to  call  an
+      undefined  function,  an  ER%undef  error is signaled.
+      The default handler  for  this  error  is  _\bu_\bn_\bd_\be_\bf-_\bf_\bu_\bn_\bc-
+      _\bh_\ba_\bn_\bd_\bl_\be_\br.   This  function  checks the property list of
+      the undefined function for the indicator autoload.  If
+      present,  the  value  of  that indicator should be the
+      name of the file which contains the definition of  the
+      undefined  function.  _\bU_\bn_\bd_\be_\bf-_\bf_\bu_\bn_\bc-_\bh_\ba_\bn_\bd_\bl_\be_\br will load the
+      file and check if it has defined  the  function  which
+      caused  the  error.  If it has, the error handler will
+      return and the computation will  continue  as  if  the
+      error did not occur.  This provides a way for the user
+      to tell the lisp system about the location of commonly
+      used functions.  The trace package sets up an autoload
+      property to point to /usr/lib/lisp/trace.
+
+
+
+
+   _\b1_\b0._\b6.  _\bI_\bn_\bt_\be_\br_\br_\bu_\bp_\bt _\bp_\br_\bo_\bc_\be_\bs_\bs_\bi_\bn_\bg
+
+           The  UNIX  operating  system  provides  one  user
+      interrupt character which defaults to ^C.[].  The user
+      may  select  a  lisp function to run when an interrupt
+      occurs.  Since this interrupt could occur at any time,
+      and  in  particular  could  occur  at  a time when the
+      internal stack pointers were in an inconsistent state,
+      the processing of the interrupt may be delayed until a
+      safe time.  When the first ^C is typed, the lisp  sys-
+      tem  sets a flag that an interrupt has been requested.
+      This flag is  checked at safe places within the inter-
+      preter  and  in  the  _\bq_\bl_\bi_\bn_\bk_\be_\br  function.   If the lisp
+____________________
+\e9   []Actually there are two but the lisp system does not al-
+low you to catch the QUIT interrupt.
+
+
+
+\e9                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Exception Handling                                      10-5
+
+
+      system doesn't respond to the  first  ^C,  another  ^C
+      should  be typed.  This will cause all of the transfer
+      tables to be cleared forcing all calls  from  compiled
+      code  to  go  through  the  _\bq_\bl_\bi_\bn_\bk_\be_\br function where the
+      interrupt flag will be checked.  If  the  lisp  system
+      still  doesn't  respond,  a  third  ^C  will  cause an
+      immediate interrupt.  This interrupt will  not  neces-
+      sarily be in a safe place so the user should _\br_\be_\bs_\be_\bt the
+      lisp system as soon as possible.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                   Printed: October 21, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch11.r b/usr/lib/lisp/manual/ch11.r
new file mode 100644 (file)
index 0000000..4095354
--- /dev/null
@@ -0,0 +1,261 @@
+
+
+
+
+
+
+
+                        CHAPTER  11
+
+
+              The Joseph Lister Trace Package
+
+
+
+
+     The Joseph Lister[] Trace package is an important  tool
+for the interactive debugging of a Lisp program.  It  allows
+you  to  examine selected  calls to a function or functions,
+and optionally to stop execution  of  the  Lisp  program  to
+examine the values of variables.
+
+     The trace package is a set of Lisp programs located  in
+the    Lisp   program   library   (usually   in   the   file
+/usr/lib/lisp/trace.l).  There are two user  callable  func-
+tions   in  the trace package: _\bt_\br_\ba_\bc_\be and _\bu_\bn_\bt_\br_\ba_\bc_\be.  The trace
+package will be loaded automatically when you first use  the
+_\bt_\br_\ba_\bc_\be  function.  Both  _\bt_\br_\ba_\bc_\beand _\bu_\bn_\bt_\br_\ba_\bc_\be are nlambdas (their
+arguments are not evaluated).  The form of a call  to  _\bt_\br_\ba_\bc_\be
+is
+                   (trace _\ba_\br_\bg_\b1 _\ba_\br_\bg_\b2 _\b._\b._\b.)
+where the _\ba_\br_\bg_\bi have one of the following forms:
+
+
+  foo - when foo is entered and exited, the  trace  informa-
+       tion will be printed.
+
+
+  (foo break) - when foo is entered  and  exited  the  trace
+       information  will  be  printed.  Also, just after the
+       trace information for foo is printed upon entry,  you
+       will  be put in  a special break loop.  The prompt is
+       `T>' and you may type any Lisp  expression,  and  see
+       its  value printed.  The _\bith argument to the function
+       just called can be accessed as (arg _\bi).  To leave the
+       trace  loop, just type ^D or (tracereturn) and execu-
+       tion will continue.  Note that ^D will work  only  on
+       UNIX systems.
+
+
+  (foo if expression) - when foo is entered and the  expres-
+       sion evaluates to non-nil, then the trace information
+       will be printed for both exit and entry.  If  expres-
+       sion evaluates to nil, then no trace information will
+       be printed.
+
+____________________
+\e9   []_\bL_\bi_\bs_\bt_\be_\br, _\bJ_\bo_\bs_\be_\bp_\bh     1st  Baron  Lister  of  Lyme  Regis,
+1827-1912; English surgeon: introduced antiseptic surgery.
+
+
+
+\e9The Joseph Lister Trace Package                         11-1
+
+
+
+
+
+
+
+The Joseph Lister Trace Package                         11-2
+
+
+  (foo ifnot expression) -  when  foo  is  entered  and  the
+       expression  evaluates to nil, then the trace informa-
+       tion will be printed for both  entry  and  exit.   If
+       both  if and _\bi_\bf_\bn_\bo_\bt are specified, then the _\bi_\bf expres-
+       sion must evaluate to non nil AND the  _\bi_\bf_\bn_\bo_\bt  expres-
+       sion  must  evaluate to nil for the trace information
+       to be printed out.
+
+
+  (foo evalin expression) - when foo is  entered  and  after
+       the  entry  trace  information is printed, expression
+       will be evaluated. Exit  trace  information  will  be
+       printed when foo exits.
+
+
+  (foo evalout expression) -  when  foo  is  entered,  entry
+       trace  information  will be printed.  When foo exits,
+       and before the exit  trace  information  is  printed,
+       expression will be evaluated.
+
+
+  (foo evalinout expression) - this has the same  effect  as
+       (trace (foo evalin expression evalout expression)).
+
+
+  (foo lprint) - this tells _\bt_\br_\ba_\bc_\be to use the  level  printer
+       when  printing  the arguments to and the result of  a
+       call to foo.  The level printer prints only  the  top
+       levels  of  list structure. Any structure below three
+       levels is printed as a &.  This allows you  to  trace
+       functions with massive arguments or results.
+
+
+
+     The following trace options permit one to have  greater
+control  over  each action which takes place when a function
+is traced.  These options are only meant to be used by  peo-
+ple  who  need  special  hooks into the trace package.  Most
+people should skip reading this section.
+
+
+  (foo traceenter tefunc) - this tells _\bt_\br_\ba_\bc_\be that the  func-
+       tion  to  be  called  when  foo is entered is tefunc.
+       tefunc should be a lambda of two arguments, the first
+       argument  will  be  bound to the name of the function
+       being traced, foo in this case.  The second  argument
+       will  be  bound to the list of arguments to which foo
+       should be applied.  The function tefunc should  print
+       some  sort  of "entering foo" message.  It should not
+       apply foo to the arguments,  however.  That  is  done
+       later on.
+
+\e9
+
+\e9                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+The Joseph Lister Trace Package                         11-3
+
+
+  (foo traceexit txfunc) - this tells _\bt_\br_\ba_\bc_\be that  the  func-
+       tion  to  be  called  when  foo  is exited is txfunc.
+       txfunc should be a lambda of two arguments, the first
+       argument  will  be  bound to the name of the function
+       being traced, foo in this case.  The second  argument
+       will  be bound to the result of the call to foo.  The
+       function txfunc should print some  sort  of  "exiting
+       foo" message.
+
+
+  (foo evfcn evfunc) - this tells _\bt_\br_\ba_\bc_\be that the form evfunc
+       should  be  evaluated to get the value of foo applied
+       to its arguments. This option is a bit different from
+       the  other  special options since evfunc will usually
+       be an expression, not just the name  of  a  function,
+       and  that  expression will be specific to the evalua-
+       tion of  function  foo.   The  argument  list  to  be
+       applied will be available as T-arglist.
+
+
+  (foo printargs prfunc) - this tells _\bt_\br_\ba_\bc_\be to  used  prfunc
+       to print the arguments  to be applied to the function
+       foo.  prfunc should be a lambda of one argument.  You
+       might  want  to use this option if you wanted a print
+       function which could  handle  circular  lists.   This
+       option  will work only if you do not specify your own
+       _\bt_\br_\ba_\bc_\be_\be_\bn_\bt_\be_\br function.  Specifying the option _\bl_\bp_\br_\bi_\bn_\bt is
+       just  a simple way of changing the printargs function
+       to the level printer.
+
+
+  (foo printres prfunc) - this tells _\bt_\br_\ba_\bc_\be to use prfunc  to
+       print the result of evaluating foo.  prfunc should be
+       a lambda of one argument.  This option will work only
+       if  you  do  not specify your own _\bt_\br_\ba_\bc_\be_\be_\bx_\bi_\bt function.
+       Specifying the option _\bl_\bp_\br_\bi_\bn_\bt changes printres to  the
+       level printer.
+
+
+
+     You may specify more than one option for each  function
+traced. For example:
+
+     (_\bt_\br_\ba_\bc_\be (_\bf_\bo_\bo _\bi_\bf (_\be_\bq _\b3 (_\ba_\br_\bg _\b1)) _\bb_\br_\be_\ba_\bk _\bl_\bp_\br_\bi_\bn_\bt) (_\bb_\ba_\br _\be_\bv_\ba_\bl_\bi_\bn
+(_\bp_\br_\bi_\bn_\bt _\bx_\by_\bz_\bz_\by)))
+
+This tells _\bt_\br_\ba_\bc_\be to trace two more functions, foo  and  bar.
+Should  foo  be called with the first argument _\be_\bq to 3, then
+the entering foo message will  be  printed  with  the  level
+printer.   Next  it  will enter a trace break loop, allowing
+you to evaluate any lisp expressions.   When  you  exit  the
+trace  break  loop, foo will be applied to its arguments and
+the resulting value will be printed, again using  the  level
+
+
+                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+The Joseph Lister Trace Package                         11-4
+
+
+printer.   Bar is also traced, and each time bar is entered,
+an entering bar message will be printed and then  the  value
+of  xyzzy  will be printed.  Next bar will be applied to its
+arguments and the result will be printed.  If you tell _\bt_\br_\ba_\bc_\be
+to  trace  a function which is already traced, it will first
+_\bu_\bn_\bt_\br_\ba_\bc_\be it.  Thus if you want to specify more than one trace
+option for a function, you must do it all at once.  The fol-
+lowing is _\bn_\bo_\bt equivalent to the preceding call to _\bt_\br_\ba_\bc_\be  for
+foo:
+
+(_\bt_\br_\ba_\bc_\be (_\bf_\bo_\bo _\bi_\bf (_\be_\bq _\b3 (_\ba_\br_\bg _\b1))) (_\bf_\bo_\bo _\bb_\br_\be_\ba_\bk) (_\bf_\bo_\bo _\bl_\bp_\br_\bi_\bn_\bt))
+
+In this example, only the last option, lprint,  will  be  in
+effect.
+
+     The function _\bt_\br_\ba_\bc_\be returns a list of functions  is  was
+able  to  trace.   The function _\bu_\bn_\bt_\br_\ba_\bc_\be untraces those func-
+tions its is argument list.  If the argument list  is  empty
+then  all  functions  being  traced  are  untraced.  _\bU_\bn_\bt_\br_\ba_\bc_\be
+returns a list of functions untraced.
+
+     Generally the trace package has its own internal  names
+for  the  the  lisp  functions it uses, so that you can feel
+free to trace system functions like _\bc_\bo_\bn_\bd and not worry about
+adverse  interaction  with the actions of the trace package.
+You can trace any type of function: lambda,  nlambda,  lexpr
+or  macro  whether  compiled or interpreted and you can even
+trace array references (however you should  not  attempt  to
+store in an array which has been traced).
+
+     When tracing compiled code keep in mind that many func-
+tion  calls  are translated directly to machine language  or
+other equivalent  function calls.  A full list of open coded
+functions  is  listed at the beginning of the liszt compiler
+source.  _\bT_\br_\ba_\bc_\be will do a (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk _\bn_\bi_\bl)  to  insure
+that  the  new  traced  definitions  it  defines  are called
+instead of the old untraced ones.  You may notice that  com-
+piled code will run slower after this is done.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                   Printed: October 21, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch12.r b/usr/lib/lisp/manual/ch12.r
new file mode 100644 (file)
index 0000000..f08add7
--- /dev/null
@@ -0,0 +1,655 @@
+
+
+
+
+
+
+
+                        CHAPTER  12
+
+
+                 Liszt - the lisp compiler
+
+
+
+
+
+
+
+   _\b1_\b2._\b1.  _\bG_\be_\bn_\be_\br_\ba_\bl _\bs_\bt_\br_\ba_\bt_\be_\bg_\by _\bo_\bf _\bt_\bh_\be _\bc_\bo_\bm_\bp_\bi_\bl_\be_\br
+
+           The purpose of the lisp compiler,  Liszt,  is  to
+      create  an  object  module which when brought into the
+      lisp system using _\bf_\ba_\bs_\bl will have the  same  effect  as
+      bringing in the corresponding lisp coded source module
+      with _\bl_\bo_\ba_\bd with one important exception, functions will
+      be  defined  as sequences of machine language instruc-
+      tions, instead of lisp S-expressions.  Liszt is not  a
+      function compiler, it is a _\bf_\bi_\bl_\be compiler.  Such a file
+      can contain more than  function  definitions;  it  can
+      contain  other  lisp S-expressions which are evaluated
+      at load time.  These other S-expressions will also  be
+      stored in the object module produced by Liszt and will
+      be evaluated at fasl time.
+
+           As is almost universally true of Lisp  compilers,
+      the  main  pass of Liszt is written in Lisp.  A subse-
+      quent pass is the assembler,  for  which  we  use  the
+      standard UNIX assembler.
+
+
+
+
+   _\b1_\b2._\b2.  _\bR_\bu_\bn_\bn_\bi_\bn_\bg _\bt_\bh_\be _\bc_\bo_\bm_\bp_\bi_\bl_\be_\br
+
+           The compiler is normally run in this manner:
+      % liszt foo
+      will compile the file foo.l or foo (the preferred  way
+      to indicate a lisp source file is to end the file name
+      with `.l').  The result of  the  compilation  will  be
+      placed  in  the  file  foo.o   if no fatal errors were
+      detected.  All messages which Liszt  generates  go  to
+      the  standard  output.  Normally each function name is
+      printed  before  it  is  compiled   (the   -q   option
+      suppresses this).
+
+
+
+
+
+\e9
+
+\e9Liszt - the lisp compiler                               12-1
+
+
+
+
+
+
+
+Liszt - the lisp compiler                               12-2
+
+
+   _\b1_\b2._\b3.  _\bS_\bp_\be_\bc_\bi_\ba_\bl _\bf_\bo_\br_\bm_\bs
+
+           Liszt makes one pass over  the  source  file.  It
+      processes each form in this way:
+
+
+
+
+      _\b1_\b2._\b3._\b1.  _\bm_\ba_\bc_\br_\bo_\be_\bx_\bp_\ba_\bn_\bs_\bi_\bo_\bn   If the form is a macro invo-
+         cation  (i.e  it  is  a  list whose car is a symbol
+         whose function binding is a macro), then that macro
+         invocation is expanded.  This is repeated until the
+         top level form is not  a  macro  invocation.   When
+         Liszt   begins,   there  are  already  some  macros
+         defined, in fact some functions (such as defun) are
+         actually  macros.  The user may define his own mac-
+         ros as well.  For a macro to be  used  it  must  be
+         defined in the Lisp system in which Liszt runs.
+
+
+
+
+      _\b1_\b2._\b3._\b2.  _\bc_\bl_\ba_\bs_\bs_\bi_\bf_\bi_\bc_\ba_\bt_\bi_\bo_\bn   After all macro expansion is
+         done,  the  form is classified according to its _\bc_\ba_\br
+         (if the form is not a list, then it  is  classified
+         as an _\bo_\bt_\bh_\be_\br).
+
+
+
+
+         _\b1_\b2._\b3._\b2._\b1.  _\be_\bv_\ba_\bl-_\bw_\bh_\be_\bn   The  form  of  eval-when  is
+            (_\be_\bv_\ba_\bl-_\bw_\bh_\be_\bn (_\bt_\bi_\bm_\be_\b1 _\bt_\bi_\bm_\be_\b2 ...) _\bf_\bo_\br_\bm_\b1 _\bf_\bo_\br_\bm_\b2 ...)
+            where the time_\bi are one  of  _\be_\bv_\ba_\bl,  _\bc_\bo_\bm_\bp_\bi_\bl_\be,  or
+            _\bl_\bo_\ba_\bd.    The  compiler  examines  the  form_\bi  in
+            sequence and the action taken depends on what is
+            in  the  time  list.   If _\bc_\bo_\bm_\bp_\bi_\bl_\be is in the list
+            then the compiler will invoke _\be_\bv_\ba_\bl on each form_\bi
+            as  it examines it.  If _\bl_\bo_\ba_\bd is in the list then
+            the compile will recursively call itself to com-
+            pile each form_\bi as it examines it.  Note that if
+            _\bc_\bo_\bm_\bp_\bi_\bl_\be and _\bl_\bo_\ba_\bd are in the time list, then  the
+            compiler  will  both  evaluate  and compile each
+            form.  This is useful if you need a function  to
+            be  defined in the compiler at both compile time
+            (perhaps to aid macro expansion) and at run time
+            (after the file is _\bf_\ba_\bs_\bled in).
+
+
+
+
+
+
+\e9
+
+\e9                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Liszt - the lisp compiler                               12-3
+
+
+         _\b1_\b2._\b3._\b2._\b2.  _\bd_\be_\bc_\bl_\ba_\br_\be   Declare  is  used  to  provide
+            information about functions and variables to the
+            compiler. It is (almost)  equivalent  to  (_\be_\bv_\ba_\bl-
+            _\bw_\bh_\be_\bn (_\bc_\bo_\bm_\bp_\bi_\bl_\be) ...).   You may declare functions
+            to  be  one  of  three  types:  lambda  (*expr),
+            nlambda  (*fexpr), lexpr (*lexpr).  The names in
+            parenthesis  are  the  Maclisp  names  and   are
+            accepted  by  the compiler as well (and not just
+            when the compiler is in  Maclisp  mode).   Func-
+            tions  are  assumed to be lambdas until they are
+            declared otherwise or are  defined  differently.
+            The  compiler treats calls to lambdas and lexprs
+            equivalently, so you needn't worry about declar-
+            ing  lexprs  either.  It is important to declare
+            nlambdas or define  them  before  calling  them.
+            Another attribute you can declare for a function
+            is localf which makes the function  `local'.   A
+            local function's name is known only to the func-
+            tions  defined  within  the  file  itself.   The
+            advantage  of a local function is that is can be
+            entered and exited very quickly and it can  have
+            the  same name as a function in another file and
+            there will be no name conflict.
+
+                 Variables may be declared special or unspe-
+            cial.   When  a special variable is lambda bound
+            (either in a lambda, prog or do expression), its
+            old  value  is  stored  away  on a stack for the
+            duration of the lambda, prog or  do  expression.
+            This  takes  time  and  is  often not necessary.
+            Therefore the default classification  for  vari-
+            ables  is  unspecial.  Space for unspecial vari-
+            ables is dynamically allocated on a  stack.   An
+            unspecial  variable  can  only  be accessed from
+            within the function where it is created  by  its
+            presence  in  a  lambda,  prog  or do expression
+            variable list.  It is possible to  declare  that
+            all  variables  are  special  as  will  be shown
+            below.
+
+                 You may declare any  number  of  things  in
+            each declare statement.  A sample declaration is
+            (_\bd_\be_\bc_\bl_\ba_\br_\be
+                 (_\bl_\ba_\bm_\bb_\bd_\ba _\bf_\bu_\bn_\bc_\b1 _\bf_\bu_\bn_\bc_\b2)
+                 (*_\bf_\be_\bx_\bp_\br _\bf_\bu_\bn_\bc_\b3)
+                 (*_\bl_\be_\bx_\bp_\br _\bf_\bu_\bn_\bc_\b4)
+                 (_\bl_\bo_\bc_\ba_\bl_\bf _\bf_\bu_\bn_\bc_\b5)
+                 (_\bs_\bp_\be_\bc_\bi_\ba_\bl _\bv_\ba_\br_\b1 _\bv_\ba_\br_\b2 _\bv_\ba_\br_\b3)
+                 (_\bu_\bn_\bs_\bp_\be_\bc_\bi_\ba_\bl _\bv_\ba_\br_\b4))
+
+                 You may also declare all  variables  to  be
+            special  with  (_\bd_\be_\bc_\bl_\ba_\br_\be (_\bs_\bp_\be_\bc_\bi_\ba_\bl_\bs _\bt)).   You may
+            declare  that  macro   definitions   should   be
+
+
+                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Liszt - the lisp compiler                               12-4
+
+
+            compiled as well as evaluated at compile time by
+            (_\bd_\be_\bc_\bl_\ba_\br_\be (_\bm_\ba_\bc_\br_\bo_\bs _\bt)).  In fact, as was mentioned
+            above,    declare    is    much    like   (_\be_\bv_\ba_\bl-
+            _\bw_\bh_\be_\bn (_\bc_\bo_\bm_\bp_\bi_\bl_\be) ...).  Thus if the compiler  sees
+            (_\bd_\be_\bc_\bl_\ba_\br_\be (_\bf_\bo_\bo _\bb_\ba_\br))  and foo is defined, then it
+            will evaluate (_\bf_\bo_\bo _\bb_\ba_\br).  If foo is not  defined
+            then an undefined declare attribute warning will
+            be issued.
+
+
+
+
+         _\b1_\b2._\b3._\b2._\b3.  (_\bp_\br_\bo_\bg_\bn '_\bc_\bo_\bm_\bp_\bi_\bl_\be form1 form2 ... formn)
+
+                 When the compiler sees this it simply  com-
+            piles  form1  through  formn as if they too were
+            seen at top level.  One use for this is to allow
+            a  macro  at  top-level to expand into more than
+            one function definition for the compiler to com-
+            pile.
+
+
+
+
+         _\b1_\b2._\b3._\b2._\b4.  _\bi_\bn_\bc_\bl_\bu_\bd_\be/_\bi_\bn_\bc_\bl_\bu_\bd_\be_\bf
+
+                 _\bI_\bn_\bc_\bl_\bu_\bd_\be and _\bi_\bn_\bc_\bl_\bu_\bd_\be_\bf cause another file  to
+            be  read  and  compiled  by  the  compiler.  The
+            result is the same as if the included file  were
+            textually  inserted into the original file.  The
+            only difference between _\bi_\bn_\bc_\bl_\bu_\bd_\be and _\bi_\bn_\bc_\bl_\bu_\bd_\be_\bf  is
+            that  include  doesn't evaluate its argument and
+            includef does.  Nested includes are allowed.
+
+
+
+
+         _\b1_\b2._\b3._\b2._\b5.  _\bd_\be_\bf
+
+                 A def form is used to  define  a  function.
+            The  macros  _\bd_\be_\bf_\bu_\bn  and _\bd_\be_\bf_\bm_\ba_\bc_\br_\bo expand to a def
+            form.   If  the  function  being  defined  is  a
+            lambda,  nlambda or lexpr then the compiler con-
+            verts the  lisp  definition  to  a  sequence  of
+            machine  language instructions.  If the function
+            being defined is a macro, then the compiler will
+            evaluate the definition, thus defining the macro
+            withing the running Lisp compiler.  Furthermore,
+            if  the  variable  _\bm_\ba_\bc_\br_\bo_\bs  is  set  to a non nil
+            value, then the macro definition  will  also  be
+            translated  to machine language and thus will be
+            defined when the object file is fasled in.   The
+            variable    _\bm_\ba_\bc_\br_\bo_\bs    is    set    to    t    by
+
+
+                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Liszt - the lisp compiler                               12-5
+
+
+            (_\bd_\be_\bc_\bl_\ba_\br_\be (_\bm_\ba_\bc_\br_\bo_\bs _\bt)).
+
+                 When a function or macro definition is com-
+            piled,  macro  expansion is done whenever possi-
+            ble.  If the compiler can determine that a  form
+            would  be evaluated if this function were inter-
+            preted then it will macro expand  it.   It  will
+            not  macro  expand arguments to a nlambda unless
+            the characteristics of the nlambda is known  (as
+            is  the  case  with  _\bc_\bo_\bn_\bd).  The map functions (
+            _\bm_\ba_\bp, _\bm_\ba_\bp_\bc, _\bm_\ba_\bp_\bc_\ba_\br, and so on) are expanded to  a
+            _\bd_\bo statement.  This allows the first argument to
+            the map function to be a lambda expression which
+            references local variables of the function being
+            defined.
+
+
+
+
+         _\b1_\b2._\b3._\b2._\b6.  _\bo_\bt_\bh_\be_\br _\bf_\bo_\br_\bm_\bs
+
+                 All other forms are simply  stored  in  the
+            object  file  and are evaluated when the file is
+            _\bf_\ba_\bs_\bled in.
+
+
+
+
+   _\b1_\b2._\b4.  _\bU_\bs_\bi_\bn_\bg _\bt_\bh_\be _\bc_\bo_\bm_\bp_\bi_\bl_\be_\br
+
+           The previous section describes exactly  what  the
+      compiler  does  with  its  input.  Generally you won't
+      have to worry about all that  detail  as  files  which
+      work  interpreted  will work compiled.  Following is a
+      list of steps you should follow to insure that a  file
+      will compile correctly.
+
+      [1]  Make sure all macro definitions precede their use
+           in  functions or other macro definitions.  If you
+           want the macros to be around when you _\bf_\ba_\bs_\bl in the
+           object  file you should include this statement at
+           the beginning of the file: (_\bd_\be_\bc_\bl_\ba_\br_\be (_\bm_\ba_\bc_\br_\bo_\bs _\bt))
+
+      [2]  Make sure all nlambdas are  defined  or  declared
+           before  they  are  used.   If  the compiler comes
+           across a call to a function which  has  not  been
+           defined  in  the  current  file,  which  does not
+           currently have a function binding, and whose type
+           has  not  been  declared then it will assume that
+           the function needs  its arguments evaluated (i.e.
+           it  is  a lambda or lexpr) and will generate code
+           accordingly.  This means that you do not have  to
+           declare  nlambda functions like _\bs_\bt_\ba_\bt_\bu_\bs since they
+
+
+                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Liszt - the lisp compiler                               12-6
+
+
+           have an nlambda function binding.
+
+      [3]  Locate all variables which are used for  communi-
+           cating values between functions.  These variables
+           must be declared special at the  beginning  of  a
+           file.   In most cases there won't be many special
+           declarations but if you fail to declare  a  vari-
+           able  special  that  should be, the compiled code
+           could fail in mysterious ways.  Let's look  at  a
+           common  problem, assume that a file contains just
+           these three lines:
+
+
+           (_\bd_\be_\bf _\ba_\ba_\ba (_\bl_\ba_\bm_\bb_\bd_\ba (_\bg_\bl_\bo_\bb _\bl_\bo_\bc) (_\bb_\bb_\bb _\bl_\bo_\bc)))
+           (_\bd_\be_\bf _\bb_\bb_\bb (_\bl_\ba_\bm_\bb_\bd_\ba (_\bm_\by_\bl_\bo_\bc) (_\ba_\bd_\bd _\bg_\bl_\bo_\bb _\bm_\by_\bl_\bo_\bc)))
+           (_\bd_\be_\bf _\bc_\bc_\bc (_\bl_\ba_\bm_\bb_\bd_\ba (_\bg_\bl_\bo_\bb _\bl_\bo_\bc) (_\bb_\bb_\bb _\bl_\bo_\bc)))
+
+
+           We can see that if we load in these  two  defini-
+           tions then (aaa 3 4) is the same as (add 3 4) and
+           will give us 7.  Suppose we compile the file con-
+           taining  these  definitions.  When Liszt compiles
+           aaa, it will assume that both glob  and  loc  are
+           local  variables  and  will allocate space on the
+           temporary stack for  their  values  when  aaa  is
+           called.   Thus  the values of the local variables
+           glob and loc will not affect the  values  of  the
+           symbols  glob  and  loc  in the Lisp system.  Now
+           Liszt moves on to function bbb.  Myloc is assumed
+           to  be local.  When it sees the add statement, it
+           find a reference to a variable called glob.  This
+           variable is not a local variable to this function
+           and therefore glob must refer to the value of the
+           symbol  glob.   Liszt  will automatically declare
+           glob to be special and it will print a warning to
+           that  effect.   Thus subsequent uses of glob will
+           always refer to the symbol glob.  Next Liszt com-
+           piles ccc and treats glob as a special and loc as
+           a local.  When the object file is _\bf_\ba_\bs_\bl'ed in, and
+           (ccc  3  4) is evaluated, the symbol glob will be
+           lambda bound to 3 bbb will  be  called  and  will
+           return 7.  However (aaa 3 4) will fail since when
+           bbb is called, glob will be unbound.  What should
+           be done here is to put (_\bd_\be_\bc_\bl_\ba_\br_\be (_\bs_\bp_\be_\bc_\bi_\ba_\bl _\bg_\bl_\bo_\bb) at
+           the beginning of the file.
+
+      [4]  Make sure that all calls to _\ba_\br_\bg  are  within  the
+           lexpr  whose arguments they reference.  If _\bf_\bo_\bo is
+           a compiled lexpr and it calls _\bb_\ba_\br then _\bb_\ba_\br cannot
+           use  _\ba_\br_\bg  to get at _\bf_\bo_\bo's arguments.  If both _\bf_\bo_\bo
+           and _\bb_\ba_\br are interpreted this will  work  however.
+           The  macro _\bl_\bi_\bs_\bt_\bi_\bf_\by can be used to put all of some
+           of a lexprs arguments in a list which then can be
+
+
+                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Liszt - the lisp compiler                               12-7
+
+
+           passed to other functions.
+
+
+
+
+   _\b1_\b2._\b5.  _\bC_\bo_\bm_\bp_\bi_\bl_\be_\br _\bo_\bp_\bt_\bi_\bo_\bn_\bs
+
+           The compiler recognizes a number of options which
+      are  described  below.  The options are typed anywhere
+      on the command line preceded by  a  minus  sign.   The
+      entire   command  line  is  scanned  and  all  options
+      recorded before any action is taken.  Thus
+      % liszt -mx foo
+      % liszt -m -x foo
+      % liszt foo -mx
+      are all equivalent. The meaning of the options are:
+
+      C    The assembler language output of the compiler  is
+           commented.   This  is  useful  when debugging the
+           compiler and is not normally done since it  slows
+           down compilation.
+
+      i    Compile this program in  interlisp  compatibility
+           mode. This is not implemented yet.
+
+      m    Compile this program in Maclisp mode.  The reader
+           syntax  will be changed to the Maclisp syntax and
+           a file of macro definitions  will  be  loaded  in
+           (usually   named  /usr/lib/lisp/machacks).   This
+           switch brings us sufficiently close to Maclisp to
+           allow us to compile Macsyma, a large Maclisp pro-
+           gram.  However Maclisp is a moving target and  we
+           can't  guarantee  that this switch will allow you
+           to compile any given program.
+
+      o    Select a different object file name.  This is the
+           only  switch  with an argument, which must follow
+           the switch.  For example
+           % liszt foo -o xxx.o
+           will compile foo and into xxx.o  instead  of  the
+           default foo.o.
+
+      q    Run in quiet mode. The names of  functions  being
+           compiled and various "Note"'s are not printed.
+
+      S    Create an assembler language file only.
+           % liszt -S foo
+           will create  the  file  assembler  language  file
+           foo.s  and  will  not attempt to assemble it.  If
+           this  option  is  not  specified,  the  assembler
+           language  file  will be put in the temporary disk
+           area under a automatically generated  name  based
+           on the lisp compiler's process id.  Then if there
+
+
+                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Liszt - the lisp compiler                               12-8
+
+
+           are no compilation errors, the assembler will  be
+           invoked to assemble the file.
+
+      T    Print the assembler language output on the  stan-
+           dard  output file.  This is useful when debugging
+           the compiler.
+
+      u    Run in UCI-Lisp mode.  The  character  syntax  is
+           changed to that of UCI-Lisp and a UCI-Lisp compa-
+           tibility package of macros is read in.
+
+      w    Suppress warning messages.
+
+      x    Create an cross reference file.
+           % liszt -x foo
+           not only compiles foo into foo.o  but  also  gen-
+           erates  the file foo.x .  The file foo.x  is lisp
+           readable and lists for each  function  all  func-
+           tions  which  that function could call.  The pro-
+           gram lxref reads one or more of these ".x"  files
+           and  produces  a  human  readable cross reference
+           listing.
+
+
+
+
+   _\b1_\b2._\b6.  _\bt_\br_\ba_\bn_\bs_\bf_\be_\br _\bt_\ba_\bb_\bl_\be_\bs   A transfer  table  is  setup  by
+      _\bf_\ba_\bs_\bl  when the object file is loaded in.  There is one
+      entry in the transfer table for each function which is
+      called  in  that object file.  The entry for a call to
+      the function _\bf_\bo_\bo has two parts whose contents are:
+
+      [1]  function address - This will initially  point  to
+           the internal  function _\bq_\bl_\bi_\bn_\bk_\be_\br.  It may some time
+           in the future point to the function _\bf_\bo_\bo  if  cer-
+           tain  conditions  are  satisfied  (more  on  this
+           below).
+
+      [2]  function name - This is a pointer to  the  symbol
+           _\bf_\bo_\bo.  This will be used by _\bq_\bl_\bi_\bn_\bk_\be_\br.
+
+
+
+      When a call is made to the function _\bf_\bo_\bo the call  will
+      actually  be made to the address in the transfer table
+      entry  and  will  end  up  in  the  _\bq_\bl_\bi_\bn_\bk_\be_\br  function.
+      _\bQ_\bl_\bi_\bn_\bk_\be_\br will determine that _\bf_\bo_\bo was the function being
+      called by locating the  function  name  entry  in  the
+      transfer table[].  If the function being called is not
+____________________
+\e9   []_\bQ_\bl_\bi_\bn_\bk_\be_\br does this by tracing back the call stack  until
+it finds the _\bc_\ba_\bl_\bl_\bs machine instruction which called it.  The
+
+
+\e9                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Liszt - the lisp compiler                               12-9
+
+
+      compiled then _\bq_\bl_\bi_\bn_\bk_\be_\br just calls  _\bf_\bu_\bn_\bc_\ba_\bl_\bl  to  perform
+      the   function  call.   If  _\bf_\bo_\bo  is  compiled  and  if
+      (_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk)  is  non  nil,  then  _\bq_\bl_\bi_\bn_\bk_\be_\br  will
+      modify the function address part of the transfer table
+      to  point  directly  to  the  function  _\bf_\bo_\bo.   Finally
+      _\bq_\bl_\bi_\bn_\bk_\be_\br will call _\bf_\bo_\bo directly .  The next time a call
+      is made to _\bf_\bo_\bo the call will go directly  to  _\bf_\bo_\bo  and
+      not  through  _\bq_\bl_\bi_\bn_\bk_\be_\br.  This will result in a substan-
+      tial  speedup  in  compiled  code  to  compiled   code
+      transfers.  A disadvantage is that no debugging infor-
+      mation is left on the stack, so _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk and _\bb_\ba_\bk_\bt_\br_\ba_\bc_\be
+      are  useless.   Another  disadvantage  is  that if you
+      redefine a compiled function either through loading in
+      a  new  version or interactively defining it, then the
+      old version may still be called from compiled code  if
+      the  fast  linking  described  above  has already been
+      done.  The  solution  to  these  problems  is  to  use
+      (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk _\bv_\ba_\bl_\bu_\be).  If value is
+
+      _\bn_\bi_\bl  All transfer tables will  be  cleared,  i.e.  all
+           function  addresses  will  be  set  to  point  to
+           _\bq_\bl_\bi_\bn_\bk_\be_\br.  This means that the next time  a  func-
+           tion  is  called  _\bq_\bl_\bi_\bn_\bk_\be_\br will be called and will
+           look at the current definition.   Also,  no  fast
+           links  will  be  set  up since (_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk)
+           will be nil.  The end result  is  that  _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk
+           and  _\bb_\ba_\bk_\bt_\br_\ba_\bc_\be  will work and the function defini-
+           tion at the time of call will always be used.
+
+      _\bo_\bn   This causes the lisp system  to  go  through  all
+           transfer  tables  and  set up fast links wherever
+           possible.  This is normally used after  you  have
+           _\bf_\ba_\bs_\bled  in  all  of your files. Furthermore since
+           (_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk) is not nil, _\bq_\bl_\bi_\bn_\bk_\be_\br will  make
+           new  fast  links  if  the situation arises (which
+           isn't likely unless you _\bf_\ba_\bs_\bl in another file).
+
+      _\bt    This or any other value not previously  mentioned
+           will just make (_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk) be non nil, and
+           as a result fast links will be made   by  _\bq_\bl_\bi_\bn_\bk_\be_\br
+           if the called function is compiled.
+
+
+
+
+
+
+
+____________________
+\e9address field of the  _\bc_\ba_\bl_\bl_\bs  contains  the  address  of  the
+transfer table entry.
+
+
+
+\e9                                   Printed: October 21, 1980
+
+
+
+
+
+
+
+Liszt - the lisp compiler                              12-10
+
+
+   _\b1_\b2._\b7.  _\bF_\bi_\bx_\bn_\bu_\bm _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs
+
+           The compiler will generate inline arithmetic code
+      for  fixnum only functions.  Such functions include +,
+      -, *,  /, 1+ and 1-.  The code generated will be  much
+      faster  than  using  _\ba_\bd_\bd, _\bd_\bi_\bf_\bf_\be_\br_\be_\bn_\bc_\be, etc.  However it
+      will only work if the arguments to and results of  the
+      functions are fixnums.  No type checking is done.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                   Printed: October 21, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch2.r b/usr/lib/lisp/manual/ch2.r
new file mode 100644 (file)
index 0000000..6b19d96
--- /dev/null
@@ -0,0 +1,1431 @@
+
+
+
+
+
+
+
+                                CHAPTER  2
+
+
+                           Data Structure Access
+
+
+
+
+     The following functions allow one to create and manipulate the various
+types of lisp data structures.  Refer to 1.3 for details of the data struc-
+tures known to FRANZ LISP.
+
+
+
+
+
+(*array 's_name 's_type 'x_dim1 ... x_dim_\bn)
+
+     WHERE:   s_type may be one of t, nil, fixnum, flonum, fixnum-block and
+              flonum-block.
+
+     RETURNS: an array of type s_type with n dimensions of extents given by
+              the x_dim_\bi.
+
+     SIDE EFFECT: If s_name is non nil, the function definition  of  s_name
+                  is set to the array structure returned.
+
+     NOTE: The *_\ba_\br_\br_\ba_\by function creates a Maclisp compatible array.   Arrays
+           are  fully described in 9.  In FRANZ LISP arrays of type t, nil,
+           fixnum and flonum are  equivalent  and  the  elements  of  these
+           arrays  can  be  any  type  of  lisp  object.   Fixnum-block and
+           flonum-block  arrays  are  restricted  to  fixnums  and  flonums
+           respectively  and  are  used  mainly to communicate with foreign
+           functions (see 8.4).
+
+
+(aexplode 's_arg)
+
+     RETURNS: a list of single character symbols which _\bp_\br_\bi_\bn_\bt would  use  to
+              print out g_arg, that is the list returned will contain quot-
+              ing characters if _\bp_\br_\bi_\bn_\bt would have used them to print s_arg.
+
+     NOTE: this is restricted to symbols and is mainly for use by explode.
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9Data Structure Access                                                   2-1
+
+
+
+
+
+
+
+Data Structure Access                                                   2-2
+
+
+(aexplodec 's_arg)
+
+     RETURNS: a list of symbols whose pnames are the characters in  s_arg's
+              pname.
+
+
+(aexploden 's_arg)
+
+     RETURNS: a list of fixnums which represent the characters  of  s_arg's
+              pname.
+
+
+    ___________________________________________________________________
+
+    -> (_\bs_\be_\bt_\bq _\bx '|_\bq_\bu_\bo_\bt_\be _\bt_\bh_\bi_\bs _\b\| _\bo_\bk?|)
+    |quote this \| ok?|
+    -> (_\ba_\be_\bx_\bp_\bl_\bo_\bd_\be _\bx)
+    (q u o t e |\\| | | t h i s |\\| | | |\\| |\|| |\\| | | o k ?)
+    ; note that |\\| just means the single character: backslash.
+    ; and |\|| just means the single character: vertical bar
+
+    -> (_\ba_\be_\bx_\bp_\bl_\bo_\bd_\be_\bc _\bx)
+    (q u o t e | | t h i s | | |\|| | | o k ?)
+    -> (_\ba_\be_\bx_\bp_\bl_\bo_\bd_\be_\bn _\bx)
+    (113 117 111 116 101 32 116 104 105 115 32 124 32 111 107 63)
+    ___________________________________________________________________
+
+
+
+
+
+(alphalessp 's_arg1 's_arg2)
+
+     RETURNS: t iff the print name of s_arg1 is  alphabetically  less  than
+              the print name of s_arg2.
+
+
+(append 'l_arg1 'l_arg2)
+
+     RETURNS: a list containing the elements of l_arg1 followed by l_arg2.
+
+     NOTE: To generate the result, the top level list cells of  l_arg1  are
+           duplicated  and the cdr of the last list cell is set to point to
+           l_arg2.  Thus this is an expensive operation if l_arg1 is large.
+           See  the  description  of  nconc  for a cheaper way of doing the
+           append.
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                   2-3
+
+
+(append1 'l_arg1 'g_arg2)
+
+     RETURNS: a list like l_arg1 with g_arg2 as the last element.
+
+     NOTE: this is equivalent to (append 'l_arg1 (list 'g_arg2)).
+
+
+    ___________________________________________________________________
+
+    ; A common mistake is using append to add one element to the end of a list
+    -> (_\ba_\bp_\bp_\be_\bn_\bd '(_\ba _\bb _\bc _\bd) '_\be)
+    (a b c d . e)
+    ; better is append1
+    -> (_\ba_\bp_\bp_\be_\bn_\bd_\b1 '(_\ba _\bb _\bc _\bd) '_\be)
+    (a b c d e)
+    ->
+    ___________________________________________________________________
+
+
+
+
+
+(array s_name s_type x_dim1 ... x_dim_\bi)
+
+     NOTE: this is  the  same  as  *array  except  the  arguments  are  not
+           evaluated.
+
+
+(arraycall s_type 'as_array 'x_ind1 ... )
+
+     RETURNS: the element selected by  the indicies from the array  a_array
+              of type s_type.
+
+     NOTE: if as_array is a symbol then the function binding of this symbol
+           should contain an array object.
+           s_type is ignored by _\ba_\br_\br_\ba_\by_\bc_\ba_\bl_\bl but is included for compatibility
+           with Maclisp.
+
+
+(arraydims 's_name)
+
+     RETURNS: a list of the type and bounds of the array s_name.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                   2-4
+
+
+(arrayp 'g_arg)
+
+     RETURNS: t iff g_arg is of type array.
+
+
+(arrayref 'a_name 'x_ind)
+
+     RETURNS: the x_ind_\bt_\bh element of the array  object  a_name.   x_ind  of
+              zero accesses the first element.
+
+     NOTE: _\ba_\br_\br_\ba_\by_\br_\be_\bf used the data, length and delta  fields  of  a_name  to
+           determine which object to return.
+
+
+    ___________________________________________________________________
+
+    ; We will create a 3 by 4 array of general lisp objects
+    -> (_\ba_\br_\br_\ba_\by _\be_\br_\bn_\bi_\be _\bt _\b3 _\b4)
+    array[12]
+
+    ; the array header is stored in the function definition slot of the
+    ; symbol ernie
+    -> (_\ba_\br_\br_\ba_\by_\bp (_\bg_\be_\bt_\bd '_\be_\br_\bn_\bi_\be))
+    t
+    -> (_\ba_\br_\br_\ba_\by_\bd_\bi_\bm_\bs (_\bg_\be_\bt_\bd '_\be_\br_\bn_\bi_\be))
+    (t 3 4)
+
+    ; store in ernie[2][2] the list (test list)
+    -> (_\bs_\bt_\bo_\br_\be (_\be_\br_\bn_\bi_\be _\b2 _\b2) '(_\bt_\be_\bs_\bt _\bl_\bi_\bs_\bt))
+    (test list)
+
+    ; check to see if it is there
+    -> (_\be_\br_\bn_\bi_\be _\b2 _\b2)
+    (test list)
+
+    ; now use the low level function _\ba_\br_\br_\ba_\by_\br_\be_\bf to find the same element
+    ; arrays are 0 based and row-major (the last subscript varies the fastest)
+    ; thus element [2][2] is the 10th element , (starting at 0).
+    -> (_\ba_\br_\br_\ba_\by_\br_\be_\bf (_\bg_\be_\bt_\bd '_\be_\br_\bn_\bi_\be) _\b1_\b0)
+    (ptr to)(test list)    ; the result is a value cell (thus the (ptr to))
+    ___________________________________________________________________
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                   2-5
+
+
+(ascii x_charnum)
+
+     WHERE:   x_charnum is between 0 and 255.
+
+     RETURNS: a symbol whose print name is the single character whose  fix-
+              num representation is x_charnum.
+
+
+(assoc 'g_arg1 'l_arg2)
+
+     RETURNS: the first top level element of l_arg2 whose _\bc_\ba_\br is  _\be_\bq_\bu_\ba_\bl  to
+              g_arg1.
+
+     NOTE: the test is make with the lisp function equal.   Usually  l_arg2
+           has an _\ba-_\bl_\bi_\bs_\bt structure and g_arg1 acts as key.
+
+
+(assq 'g_arg1 'l_arg2)
+
+     RETURNS: the first top level element of l_arg2 whose _\bc_\ba_\br is  equal  to
+              g_arg1 using the lisp function _\be_\bq.
+
+     NOTE: This is faster than assoc since eq is faster than equal but lisp
+           objects  which  print alike are not always _\be_\bq.  See the descrip-
+           tion of eq for more details.
+
+
+    ___________________________________________________________________
+
+    ; an `assoc list' (or alist) is a common lisp data structure.  It has the
+    ; form ((key1 . value1) (key2 . value2) (key3 . value3) ... (keyn . valuen))
+    ; _\ba_\bs_\bs_\bo_\bc or _\ba_\bs_\bs_\bq is given a key and an assoc list and returns
+    ; the key and value item if it exists, they differ only in how they test
+    ; for equality of the keys.
+
+    -> (_\bs_\be_\bt_\bq _\ba_\bl_\bi_\bs_\bt '((_\ba_\bl_\bp_\bh_\ba . _\ba) ( (_\bc_\bo_\bm_\bp_\bl_\be_\bx _\bk_\be_\by) . _\bb) (_\bj_\bu_\bn_\bk . _\bx)))
+    ((alpha . a) ((complex key) . b) (junk . x))
+
+    ; we should use _\ba_\bs_\bs_\bq when the key is an atom
+    -> (_\ba_\bs_\bs_\bq '_\ba_\bl_\bp_\bh_\ba _\ba_\bl_\bi_\bs_\bt)
+    (alpha . a)
+
+    ; but it may not work when the key is a list
+    -> (_\ba_\bs_\bs_\bq '(_\bc_\bo_\bm_\bp_\bl_\be_\bx _\bk_\be_\by) _\ba_\bl_\bi_\bs_\bt)
+    nil
+
+    ; however _\ba_\bs_\bs_\bo_\bc will always work
+    -> (_\ba_\bs_\bs_\bo_\bc '(_\bc_\bo_\bm_\bp_\bl_\be_\bx _\bk_\be_\by) _\ba_\bl_\bi_\bs_\bt)
+    ((complex key) . b)
+    ___________________________________________________________________
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                   2-6
+
+
+(atom 'g_arg)
+
+     RETURNS: t iff g_arg is not a list or hunk object.
+
+     NOTE: (atom '()) returns t.
+
+
+(bcdad 's_funcname)
+
+     RETURNS: a fixnum which is the address in memory  where  the  function
+              s_funcname  begins.   If  s_funcname  is  not a machine coded
+              function (binary) then bcdad returns nil.
+
+
+(bcdp 'g_arg)
+
+     RETURNS: t iff g_arg is a data object of type binary.
+
+     NOTE: the name of this function is a throwback to the PDP-11 Lisp sys-
+           tem.
+
+
+(bigp 'g_arg)
+
+     RETURNS: t iff g_arg is a bignum.
+
+
+(c..r 'lh_arg)
+
+     WHERE:   the .. represents any positive number of a's and d's.
+
+     RETURNS: the result of accessing the list structure in the way  deter-
+              mined  by  the  function name.  The a's and d's are read from
+              right to left, a _\bd directing the access down the cdr part  of
+              the list cell and an _\ba down the car part.
+
+     NOTE: lh_arg may also be nil, and it is guaranteed that  the  car  and
+           cdr of nil is nil.
+           Currently one may dissect hunks and bignums with  c..r  as  well
+           although this is subject to change.
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                   2-7
+
+
+(concat ['stn_arg1 ... ])
+
+     RETURNS: a symbol whose print name is the result of concatenating  the
+              print  names,  string characters or numerical representations
+              of the sn_arg_\bi.
+
+     NOTE: If no arguments are  given,  a  symbol  with  a  null  pname  is
+           returned.   Concat  places the symbol created on the oblist, the
+           function uconcat does the same thing but does not place the  new
+           symbol on the oblist.
+
+     EXAMPLE: (_\bc_\bo_\bn_\bc_\ba_\bt '_\ba_\bb_\bc (_\ba_\bd_\bd _\b3 _\b4) "_\bd_\be_\bf") ==> abc7def
+
+
+(cons 'g_arg1 'g_arg2)
+
+     RETURNS: a new list cell whose car is g_arg1 and whose cdr is g_arg2.
+
+
+(copy 'g_arg)
+
+     RETURNS: A structure _\be_\bq_\bu_\ba_\bl to g_arg but with new list cells.
+
+
+(copysymbol 's_arg 'g_pred)
+
+     RETURNS: an uninterned symbol with the same print name as  s_arg.   If
+              g_pred  is non nil, then the value, function binding and pro-
+              perty list of the new symbol are made _\be_\bq to those of s_arg.
+
+
+(cpy1 'xvt_arg)
+
+     RETURNS: a new cell of the same type as xvt_arg with the same value as
+              xvt_arg.
+
+
+(cxr 'x_ind 'h_hunk)
+
+     RETURNS: element x_ind (starting at 0) of hunk h_hunk.
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                   2-8
+
+
+(defprop ls_name g_val g_ind)
+
+     RETURNS: g_val.
+
+     SIDE EFFECT: The property list of ls_name is updated by  adding  g_val
+                  as the value of indicator g_ind.
+
+     NOTE: this is similar to putprop except that the arguments to  defprop
+           are  not evaluated.  ls_name may be a disembodied property list,
+           see _\bg_\be_\bt.
+
+
+(delete 'g_val 'l_list ['x_count])
+
+     RETURNS: the result of splicing g_val from the top level of l_list  no
+              more than x_count times.
+
+     NOTE: x_count defaults to a very large number, thus if x_count is  not
+           given, all occurances of g_val are removed from the top level of
+           l_list.  g_val is compared with successive _\bc_\ba_\br's of l_list using
+           the function _\be_\bq_\bu_\ba_\bl.
+
+     SIDE EFFECT: l_list is modified using rplacd, no new  list  cells  are
+                  used.
+
+
+(delq 'g_val 'l_list ['x_count])
+
+     RETURNS: the result of splicing g_val from the top level of l_list  no
+              more than x_count times.
+
+     NOTE: _\bd_\be_\bl_\bq is the same as _\bd_\be_\bl_\be_\bt_\be except that _\be_\bq is used for comparison
+           instead of _\be_\bq_\bu_\ba_\bl.
+
+
+    ___________________________________________________________________
+
+    ; note that you should use the value returned by _\bd_\be_\bl_\be_\bt_\be or _\bd_\be_\bl_\bq
+    ; and not assume that g_val will always show the deletions.
+    ; For example
+
+    -> (_\bs_\be_\bt_\bq _\bt_\be_\bs_\bt '(_\ba _\bb _\bc _\ba _\bd _\be))
+    (a b c a d e)
+    -> (_\bd_\be_\bl_\be_\bt_\be '_\ba _\bt_\be_\bs_\bt)
+    (b c d e)         ; the value returned is what we would expect
+    -> _\bt_\be_\bs_\bt
+    (a b c d e)       ; but test still has the first a in the list!
+    ___________________________________________________________________
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                   2-9
+
+
+(dtpr 'g_arg)
+
+     RETURNS: t iff g_arg is a list cell.
+
+     NOTE: that (dtpr '()) is nil.
+
+
+(eq 'g_arg1 'g_arg2)
+
+     RETURNS: t if g_arg1 and g_arg2 are the exact same lisp object.
+
+     NOTE: _\bE_\bq simply tests if g_arg1 and g_arg2 are located  in  the  exact
+           same place in memory.  Lisp objects which print the same are not
+           necessarily _\be_\bq.  The  only  objects  guaranteed  to  be  _\be_\bq  are
+           interned  symbols with the same print name.  [Unless a symbol is
+           created in a special way (such as with  uconcat  or  maknam)  it
+           will be interned.]
+
+
+(equal 'g_arg1 'g_arg2)
+
+     RETURNS: t iff g_arg1 and g_arg2 have the same structure as  described
+              below.
+
+     NOTE: g_arg and g_arg2 are _\be_\bq_\bu_\ba_\bl if
+
+     (1)  they are eq.
+
+     (2)  they are both fixnums with the same value
+
+     (3)  they are both flonums with the same value
+
+     (4)  they are both bignums with the same value
+
+     (5)  they are both strings and are identical.
+
+     (6)  they are both lists and their cars and cdrs are _\be_\bq_\bu_\ba_\bl.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-10
+
+
+
+    ___________________________________________________________________
+
+    ; _\be_\bq is much faster than _\be_\bq_\bu_\ba_\bl, especially in compiled code,
+    ; however you cannot use _\be_\bq to test for equality of numbers outside
+    ; of the range -1024 to 1023.  _\be_\bq_\bu_\ba_\bl will always work.
+    -> (_\be_\bq _\b1_\b0_\b2_\b3 _\b1_\b0_\b2_\b3)
+    t
+    -> (_\be_\bq _\b1_\b0_\b2_\b4 _\b1_\b0_\b2_\b4)
+    nil
+    -> (_\be_\bq_\bu_\ba_\bl _\b1_\b0_\b2_\b4 _\b1_\b0_\b2_\b4)
+    t
+    ___________________________________________________________________
+
+
+
+
+
+(explode 'g_arg)
+
+     RETURNS: a list of single character symbols which _\bp_\br_\bi_\bn_\bt would  use  to
+              print g_arg.
+
+
+(explodec 'g_val)
+
+     RETURNS: the list of characters which print would use to  print  g_val
+              except  that  special  characters  in symbols are not escaped
+              (just as if patom were used to print them).
+
+
+(exploden 'g_val)
+
+     RETURNS: a list of fixnums which print would use to print g_val except
+              that  special  characters in symbols are not escaped (just as
+              if patom were used to print them).
+
+
+(fillarray 's_array 'l_itms)
+
+     RETURNS: s_array
+
+     SIDE EFFECT: the array s_array is filled with  elements  from  l_itms.
+                  If  there  are  not enough elements in l_itms to fill the
+                  entire array, then the last element of l_itms is used  to
+                  fill the remaining parts of the array.
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-11
+
+
+(gensym 's_leader)
+
+     RETURNS: a new uninterned atom beginning with the first  character  of
+              s_leader's  pname,  or  beginning  with  g if s_leader is not
+              given.
+
+     NOTE: The symbol looks like x0nnnnn where x is s_leader's first  char-
+           acter and nnnnn is the number of times you have called gensym.
+
+
+(get 'ls_name 'g_ind)
+
+     RETURNS: the value under indicator g_ind in ls_name's property list if
+              ls_name is a symbol.
+
+     NOTE: If there is no indicator g_ind in ls_name's property list nil is
+           returned.   If  ls_name  is  a list of an odd number of elements
+           then it is a disembodied property list. _\bg_\be_\bt searches a  disembo-
+           died  property list by  starting at its _\bc_\bd_\br and looking at every
+           other element for g_ind.
+
+
+    ___________________________________________________________________
+
+    -> (_\bp_\bu_\bt_\bp_\br_\bo_\bp '_\bx_\bl_\ba_\bt_\be '_\ba '_\ba_\bl_\bp_\bh_\ba)
+    a
+    -> (_\bp_\bu_\bt_\bp_\br_\bo_\bp '_\bx_\bl_\ba_\bt_\be '_\bb '_\bb_\be_\bt_\ba)
+    b
+    -> (_\bp_\bl_\bi_\bs_\bt '_\bx_\bl_\ba_\bt_\be)
+    (alpha a beta b)
+    -> (_\bg_\be_\bt '_\bx_\bl_\ba_\bt_\be '_\ba_\bl_\bp_\bh_\ba)
+    a
+    -> (_\bg_\be_\bt '(_\bn_\bi_\bl _\bf_\ba_\bt_\be_\bm_\ba_\bn _\br_\bj_\bf _\bs_\bk_\bl_\bo_\bw_\be_\br _\bk_\bl_\bs _\bf_\bo_\bd_\be_\br_\ba_\br_\bo _\bj_\bk_\bf) '_\bs_\bk_\bl_\bo_\bw_\be_\br)
+    kls
+    ___________________________________________________________________
+
+
+
+
+
+(get_pname 's_arg)
+
+     RETURNS: the string which is the print name of s_arg.
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-12
+
+
+(getaccess 'a_array)
+
+     RETURNS: the access function for the array a_array.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+(getaddress 's_entry1 's_binder1 'st_discipline1 [... ...])
+
+     RETURNS: the binary object  which s_binder1's  function field  is  set
+              to.
+
+     NOTE: This looks in the running lisp's symbol table for a symbol  with
+           the  same  name  as  s_entry_\bi.   It then creates a binary object
+           whose entry field points to s_entry_\bi  and  whose  discipline  is
+           st_discipline_\bi.   This  binary  object is stored in the function
+           field of s_binder_\bi.  If st_discipline_\bi is nil, then "subroutine"
+           is used by default.  This is especially useful for _\bc_\bf_\ba_\bs_\bl users.
+
+
+(getaux 'a_array)
+
+     RETURNS: the auxiliary field for the array a_array.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+(getchar 's_arg 'x_index)
+
+     RETURNS: the x_index'th character of the print name of s_arg or nil if
+              x_index  is less than 1 or greater than the length of s_arg's
+              print name.
+
+
+(getcharn 's_arg 'x_index)
+
+     RETURNS: the fixnum representation of the x_index'th character of  the
+              print  name  of  s_arg  or  nil  if x_index is less than 1 or
+              greater than the length of s_arg's print name.
+
+
+(getd 's_arg)
+
+     RETURNS: the function definition of s_arg or nil if there is no  func-
+              tion definition.
+
+     NOTE: the function definition may turn out to be an array header.
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-13
+
+
+(getdelta 'a_array)
+
+     RETURNS: the delta field for a_array.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+(getentry 'y_funchd)
+
+     RETURNS: the entry field of the binary y_funchd.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+(getlength 'a_array)
+
+     RETURNS: the length field of the array a_array.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+(hunk 'g_val1 ['g_val2 ... 'g_val_\bn])
+
+     RETURNS: a hunk of length n whose  elements  are  initialized  to  the
+              g_val_\bi.
+
+     NOTE: the maximum size of a hunk is 128.
+
+     EXAMPLE: (_\bh_\bu_\bn_\bk _\b4 '_\bs_\bh_\ba_\br_\bp '_\bk_\be_\by_\bs) ==> {4 sharp keys}
+
+
+(hunksize 'h_arg)
+
+     RETURNS: the size of the hunk h_arg.
+
+     EXAMPLE: (_\bh_\bu_\bn_\bk_\bs_\bi_\bz_\be (_\bh_\bu_\bn_\bk _\b1 _\b2 _\b3)) ==> 3
+
+
+(implode 'l_arg)
+
+     WHERE:   l_arg is a list of symbols and small fixnums.
+
+     RETURNS: The symbol whose print name is the  result  of  concatenating
+              the  print names of the symbols in the list.  Any fixnums are
+              converted to the equivalent ascii character.
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-14
+
+
+(intern 's_arg)
+
+     RETURNS: s_arg
+
+     SIDE EFFECT: s_arg is put on the oblist if it is not already there.
+
+
+(last 'l_arg)
+
+     RETURNS: the last list cell in the list l_arg.
+
+     EXAMPLE: _\bl_\ba_\bs_\bt does NOT return the last element of a list!
+              (_\bl_\ba_\bs_\bt '(_\ba _\bb)) ==>  (b)
+
+
+(length 'l_arg)
+
+     RETURNS: the number of elements in the top level of list l_arg.
+
+
+(list ['g_arg1 ... ])
+
+     RETURNS: a list whose elements are the g_arg_\bi.
+
+
+(makhunk 'xl_arg)
+
+     RETURNS: a hunk of length xl_arg initialized to all nils if xl_arg  is
+              a fixnum.  If xl_arg is a list, then we return a hunk of size
+              (_\bl_\be_\bn_\bg_\bt_\bh '_\bx_\bl__\ba_\br_\bg) initialized to the elements in xl_arg.
+
+     NOTE: (_\bm_\ba_\bk_\bh_\bu_\bn_\bk '(_\ba _\bb _\bc)) is equivalent to (_\bh_\bu_\bn_\bk '_\ba '_\bb '_\bc).
+
+     EXAMPLE: (_\bm_\ba_\bk_\bh_\bu_\bn_\bk _\b4) ==> {nil nil nil nil}
+
+
+(*makhunk 'x_arg)
+
+     RETURNS: a hunk of size 2[x_arg] initialized to EMPTY.
+
+     NOTE: This is only to be used by such functions as  _\bh_\bu_\bn_\bk  and  _\bm_\ba_\bk_\bh_\bu_\bn_\bk
+           which create and initialize hunks for users.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-15
+
+
+(maknam 'l_arg)
+
+     RETURNS: what implode would return  except  the  resulting  symbol  is
+              uninterned.
+
+
+(makunbound 's_arg)
+
+     RETURNS: s_arg
+
+     SIDE EFFECT: the value of s_arg is made `unbound'.  If the interpreter
+                  attempts  to  evaluate  s_arg  before it is again given a
+                  value, an unbound variable error will occur.
+
+
+(marray 'g_data 's_access 'g_aux 'x_length 'x_delta)
+
+     RETURNS: an array type with the fields set up from the above arguments
+              in the obvious way (see  1.3.9).
+
+
+(member 'g_arg1 'l_arg2)
+
+     RETURNS: that part of the l_arg2 beginning with the  first  occurrence
+              of  g_arg1.  If g_arg1 is not in the top level of l_arg2, nil
+              is returned.
+
+     NOTE: the test for equality is made with _\be_\bq_\bu_\ba_\bl.
+
+
+(memq 'g_arg1 'l_arg2)
+
+     RETURNS: that part of the l_arg2 beginning with the first occurance of
+              g_arg1.   If g_arg1 is not in the top level of l_arg2, nil is
+              returned.
+
+     NOTE: the test for equality is made with _\be_\bq.
+
+
+(nconc 'l_arg1 'l_arg2 ['l_arg3 ...])
+
+     RETURNS: A list consisting of the elements of l_arg1 followed  by  the
+              elements of l_arg2 followed by l_arg3 and so on.
+
+     NOTE: The _\bc_\bd_\br of the last list cell of l_arg_\bi is changed to  point  to
+           l_arg_\bi+_\b1.
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-16
+
+
+
+    ___________________________________________________________________
+
+    ; _\bn_\bc_\bo_\bn_\bc is faster than _\ba_\bp_\bp_\be_\bn_\bd because it doesn't allocate new list
+    ; cells.
+    -> (_\bs_\be_\bt_\bq _\bl_\bi_\bs_\b1 '(_\ba _\bb _\bc))
+    (a b c)
+    -> (_\bs_\be_\bt_\bq _\bl_\bi_\bs_\b2 '(_\bd _\be _\bf))
+    (d e f)
+    -> (_\ba_\bp_\bp_\be_\bn_\bd _\bl_\bi_\bs_\b1 _\bl_\bi_\bs_\b2)
+    (a b c d e f)
+    -> _\bl_\bi_\bs_\b1
+    (a b c)       ; note that lis1 has not been changed by _\ba_\bp_\bp_\be_\bn_\bd
+    -> (_\bn_\bc_\bo_\bn_\bc _\bl_\bi_\bs_\b1 _\bl_\bi_\bs_\b2)
+    (a b c d e f) ; _\bn_\bc_\bo_\bn_\bc returns the same value as _\ba_\bp_\bp_\be_\bn_\bd
+    -> _\bl_\bi_\bs_\b1
+    (a b c d e f) ; but in doing so alters lis1
+    ___________________________________________________________________
+
+
+
+
+
+(ncons 'g_arg)
+
+     RETURNS: a new list cell with g_arg as car and nil as cdr.
+
+
+(not 'g_arg)
+
+     RETURNS: t iff g_arg is nil.
+
+
+(nreverse 'l_arg)
+
+     RETURNS: the reverse of l_arg.
+
+     NOTE: The reverse is done in place, that  is  the  list  structure  is
+           modified.  No new list cells are allocated.
+
+
+(nthelem 'n_arg1 'l_arg2)
+
+     RETURNS: The n_arg1'_\bs_\bt element of the list l_arg2.
+
+     NOTE: If n_arg1 is non-positive or greater  than  the  length  of  the
+           list, nil is returned.
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-17
+
+
+(null 'g_arg)
+
+     RETURNS: t iff g_arg is nil.
+
+     EQUIVALENT TO: not.
+
+
+(plist 's_name)
+
+     RETURNS: the property list of s_name.
+
+
+(ptr 'g_arg)
+
+     RETURNS: a value cell initialize to point to g_arg.
+
+
+(putaccess 'a_array 's_func)
+
+     RETURNS: s_func.
+
+     SIDE EFFECT: replaces the access field of a_array with s_func.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+(putaux 'a_array 'g_aux)
+
+     RETURNS: s_aux.
+
+     SIDE EFFECT: replaces the auxillary field of a_array with g_aux.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+(putdelta 'a_array 'x_delta)
+
+     RETURNS: x_delta.
+
+     SIDE EFFECT: replaces the delta field of a_array with x_delta.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-18
+
+
+(putdisc 'y_func 's_discipline)
+
+     RETURNS: s_discipline
+
+     SIDE EFFECT: the discipline field of y_func is set to s_discipline.
+
+
+(putlength 'a_array 'x_length)
+
+     RETURNS: x_length
+
+     SIDE EFFECT: replaces the length field of a_array with x_length.
+
+     NOTE: this function will most likely disappear in future releases.
+
+
+(putprop 'ls_name 'g_val 'g_ind)
+
+     RETURNS: g_val.
+
+     SIDE EFFECT: Adds to the property list  of  ls_name  the  value  g_val
+                  under the indicator g_ind.
+
+     NOTE: this is similar to _\bd_\be_\bf_\bp_\br_\bo_\bp except the arguments are evaluated to
+           _\bp_\bu_\bt_\bp_\br_\bo_\bp.  ls_name may be a disembodied property list, see _\bg_\be_\bt.
+
+
+(quote g_arg)
+
+     RETURNS: g_arg.
+
+     NOTE: the reader allows you to abbreviate (quote foo) as 'foo.
+
+
+(rematom 's_arg)
+
+     RETURNS: t if s_arg is indeed an atom.
+
+     SIDE EFFECT: s_arg is put on the free atoms list, effectively reclaim-
+                  ing an atom cell.
+
+     NOTE: This function does _\bn_\bo_\bt check to see if s_arg is on the oblist or
+           is  referenced anywhere.  Thus calling _\br_\be_\bm_\ba_\bt_\bo_\bm on an atom in the
+           oblist may result in disaster when that atom cell is reused!
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-19
+
+
+(remob 's_symbol)
+
+     RETURNS: s_symbol
+
+     SIDE EFFECT: s_symbol is removed from the oblist.
+
+
+(remprop 'ls_name 'g_ind)
+
+     RETURNS: the portion of  ls_name's property list  beginning  with  the
+              property  under  the  indicator  g_ind.  If there is no g_ind
+              indicator in ls_name's plist, nil is returned.
+
+     SIDE EFFECT: the value under  indicator  g_ind  and  g_ind  itself  is
+                  removed from the property list of ls_name.
+
+     NOTE: ls_name may be a disembodied property list, see _\bg_\be_\bt.
+
+
+(replace 'g_arg1 'g_arg2)
+
+     WHERE:   g_arg1 and g_arg2 must be the same type of  lispval  and  not
+              symbols or hunks.
+
+     RETURNS: g_arg2.
+
+     SIDE EFFECT: The effect of _\br_\be_\bp_\bl_\ba_\bc_\be is dependent on  the  type  of  the
+                  g_arg_\bi  although  one  will  notice  a  similarity in the
+                  effects.  To understand what _\br_\be_\bp_\bl_\ba_\bc_\be does to  fixnum  and
+                  flonum  arguments  you  must  first  understand that such
+                  numbers are `boxed' in FRANZ LISP.  What  this  means  is
+                  that  if  the  symbol x has a value 32412, then in memory
+                  the value element of x's symbol  structure  contains  the
+                  address  of  another  word  of memory (called a box) with
+                  32412 in it.  Thus there are two  ways  of  changing  the
+                  value  of  x,  one  is to change the value element of x's
+                  symbol structure to point to a word of memory with a dif-
+                  ferent  value.  Another way is to change the value in the
+                  box which x points to.  The former method is used  almost
+                  all  of  the time, the latter is used very rarely and has
+                  the potential to cause  great  confusion.   The  function
+                  _\br_\be_\bp_\bl_\ba_\bc_\be  allows you to do the latter, that is to actually
+                  change the value in the box.  You should  watch  out  for
+                  these  situations.  If you do (_\bs_\be_\bt_\bq _\by _\bx) then both  x and
+                  y  will  point   to   the   same   box.    If   you   now
+                  (_\br_\be_\bp_\bl_\ba_\bc_\be _\bx _\b1_\b2_\b3_\b4_\b5)  then y will also have the value 12345.
+                  And in fact there may be many other pointers to that box.
+                  Another problem with replacing fixnums is that some boxes
+                  are read only.  The fixnums between -1024  and  1023  are
+                  stored  in  a read only area and attempts to replace them
+                  will result in an "Illegal memory reference"  error  (see
+                  the  description  of _\bc_\bo_\bp_\by_\bi_\bn_\bt* for a way around this prob-
+                  lem)..  For the other valid types, the effect of  _\br_\be_\bp_\bl_\ba_\bc_\be
+
+
+                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-20
+
+
+                  is  easy to understand.  The fields of g_val1's structure
+                  are made eq  to  the  corresponding  fields  of  g_val2's
+                  structure.   For  example,  if  x   and   y have lists as
+                  values then the effect of (_\br_\be_\bp_\bl_\ba_\bc_\be _\bx _\by) is  the  same  as
+                  (_\br_\bp_\bl_\ba_\bc_\ba _\bx (_\bc_\ba_\br _\by)) and (_\br_\bp_\bl_\ba_\bc_\bd _\bx (_\bc_\bd_\br _\by)).
+
+
+(reverse 'l_arg)
+
+     RETURNS: the reverse of the list l_arg.
+
+     NOTE: The _\br_\be_\bv_\be_\br_\bs_\be is performed by allocating new list cells to  dupli-
+           cate  the  top level of l_arg. This can be expensive if l_arg is
+           large.  The function nreverse  will  reverse  the  list  without
+           allocating new list cells.
+
+
+(rplaca 'lh_arg1 'g_arg2)
+
+     RETURNS: the modified lh_arg1.
+
+     SIDE EFFECT: the car of lh_arg1 is set to  g_arg2.  If  lh_arg1  is  a
+                  hunk  then  the  second  element  of  the  hunk is set to
+                  g_arg2.
+
+
+(rplacd 'lh_arg1 'g_arg2)
+
+     RETURNS: the modified lh_arg1.
+
+     SIDE EFFECT: the cdr of lh_arg2 is set to g_arg2.   If  lh_arg1  is  a
+                  hunk then the first element of the hunk is set to g_arg2.
+
+
+(rplacx 'x_ind 'h_hunk 'g_val)
+
+     RETURNS: h_hunk
+
+     SIDE EFFECT: Element x_ind (starting at 0) of h_hunk is set to g_val.
+
+
+(*rplacx 'x_ind 'h_hunk 'g_val)
+
+     RETURNS: h_hunk
+
+     SIDE EFFECT: Element x_ind (starting at 0) of h_hunk is set to g_val.
+
+     NOTE: This is the same as _\br_\bp_\bl_\ba_\bc_\bx except you may replace  uninitialized
+           hunk  entries. This is only to be used by functions such as _\bh_\bu_\bn_\bk
+           and _\bm_\ba_\bk_\bh_\bu_\bn_\bk which create hunks of sizes which are not powers  of
+           two.
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-21
+
+
+(sassoc 'g_arg1 'l_arg2 'sl_func)
+
+     RETURNS: the                         result                         of
+              (_\bc_\bo_\bn_\bd ((_\ba_\bs_\bs_\bo_\bc '_\bg__\ba_\br_\bg '_\bl__\ba_\br_\bg_\b2) (_\ba_\bp_\bp_\bl_\by '_\bs_\bl__\bf_\bu_\bn_\bc _\bn_\bi_\bl)))
+
+     NOTE: sassoc is written as a macro.
+
+
+(sassq 'g_arg1 'l_arg2 'sl_func)
+
+     RETURNS: the                         result                         of
+              (_\bc_\bo_\bn_\bd ((_\ba_\bs_\bs_\bq '_\bg__\ba_\br_\bg '_\bl__\ba_\br_\bg_\b2) (_\ba_\bp_\bp_\bl_\by '_\bs_\bl__\bf_\bu_\bn_\bc _\bn_\bi_\bl)))
+
+     NOTE: sassq is written as a macro.
+
+
+(set 's_arg1 'g_arg2)
+
+     RETURNS: g_arg2.
+
+     SIDE EFFECT: the value of s_arg1 is set to g_arg2.
+
+
+(setplist 's_atm 'l_plist)
+
+     RETURNS: l_plist.
+
+     SIDE EFFECT: the property list of s_atm is set to l_plist.
+
+
+(setq s_atm1 'g_val1 [ s_atm2 'g_val2 ... ... ])
+
+     WHERE:   the arguments are pairs of atom names and expressions.
+
+     RETURNS: the last g_val_\bi.
+
+     SIDE EFFECT: each s_atm_\bi is set to have the value g_val_\bi.
+
+
+(stringp 'g_arg)
+
+     RETURNS: t iff g_arg is a string.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Data Structure Access                                                  2-22
+
+
+(symbolp 'g_arg)
+
+     RETURNS: t iff g_arg is a symbol.
+
+
+(type 'g_arg)
+
+     RETURNS: a symbol whose pname describes the type of g_arg.
+
+
+(typep 'g_arg)
+
+     EQUIVALENT TO: type.
+
+
+(uconcat ['s_arg1 ... ])
+
+     RETURNS: a symbol whose pname is the result of concatenating the print
+              names (pnames) of the s_arg_\bi.
+
+     NOTE: If no arguments are  given,  a  symbol  with  a  null  pname  is
+           returned.   _\bu_\bc_\bo_\bn_\bc_\ba_\bt  does  not  place  the symbol created on the
+           oblist, the function concat does the same thing but  does  place
+           the new symbol on the oblist.
+
+
+(valuep 'g_arg)
+
+     RETURNS: t iff g_arg is a value cell
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch3.r b/usr/lib/lisp/manual/ch3.r
new file mode 100644 (file)
index 0000000..b31782c
--- /dev/null
@@ -0,0 +1,604 @@
+
+
+
+
+
+
+
+                                CHAPTER  3
+
+
+                           Arithmetic Functions
+
+
+
+
+
+
+
+   _\b3._\b1.  This chapter describes FRANZ LISP's  functions  for  doing  arith-
+      metic.   Often  the  same function is know by many names, such as _\ba_\bd_\bd
+      which is also _\bp_\bl_\bu_\bs, _\bs_\bu_\bm, and +.  This is due to our desire to be com-
+      patible  with  other  Lisps.  The FRANZ LISP user is advised to avoid
+      using functions with names such as + and * unless their arguments are
+      fixnums.   The  lisp  compiler takes advantage of the fact that their
+      arguments are fixnums.
+
+           An attempt to divide by zero will  cause  a  floating  exception
+      signal  from  the UNIX operating system.  The user can catch and pro-
+      cess this interrupt if he wishes (see the description of  the  _\bs_\bi_\bg_\bn_\ba_\bl
+      function).
+
+
+
+(abs 'n_arg)
+
+     RETURNS: the absolute value of n_arg.
+
+
+(absval 'n_arg)
+
+     EQUIVALENT TO: abs.
+
+
+(add ['n_arg1 ...])
+
+     RETURNS: the sum of the arguments. If no arguments  are  given,  0  is
+              returned.
+
+     NOTE: if the size of the partial sum exceeds the limit  of  a  fixnum,
+           the  partial  sum  will be converted to a bignum.  If any of the
+           arguments are flonums, the partial sum will be  converted  to  a
+           flonum  when that argument is processed and the result will thus
+           be a flonum.  Currently, if in the process of doing the addition
+           a  bignum  must be converted into a flonum an error message will
+           result.
+
+
+
+
+\e9
+
+\e9Arithmetic Functions                                                    3-1
+
+
+
+
+
+
+
+Arithmetic Functions                                                    3-2
+
+
+(add1 'n-arg)
+
+     RETURNS: n_arg plus 1.
+
+
+(acos 'fx_arg)
+
+     RETURNS: the arc cosine of fx_arg in the range 0 to \ eJ\ fi.
+
+
+(asin 'fx_arg)
+
+     RETURNS: the arc sine of fx_arg in the range -\ eJ\ f/2 to \ eJ\ f/2.
+
+
+(atan 'fx_arg1 'fx_arg2)
+
+     RETURNS: the arc tangent of fx_arg1/fx_arg2 in the range -\ eJ\ f to \ eJ\ f.
+
+
+(boole 'x_key 'x_v1 'x_v2 ...)
+
+     RETURNS: the result of the bitwise boolean operation as  described  in
+              the following table.
+
+     NOTE: If there are more than 3  arguments,  then  evaluation  proceeds
+           left to right with each partial result becoming the new value of
+           x_v1.  That is,
+                (_\bb_\bo_\bo_\bl_\be '_\bk_\be_\by '_\bv_\b1 '_\bv_\b2 '_\bv_\b3) =\b_ (_\bb_\bo_\bo_\bl_\be '_\bk_\be_\by (_\bb_\bo_\bo_\bl_\be '_\bk_\be_\by '_\bv_\b1 '_\bv_\b2) '_\bv_\b3).
+           In  the  following table, * represents bitwise and, + represents
+           bitwise or, O\b+ represents bitwise xor and  \ e_\ f  represents  bitwise
+           negation and is the highest precedence operator.
+
+\e8___________________________________________________________________________________________
+                                    (boole 'key 'x 'y)
+
+\e8___________________________________________________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b___________________________________________________________________________________________
+  key         0          1          2         3         4         5          6         7
+ result       0        x * y     \ e_\ f x * y      y      x * \ e_\ f y      x        x O\b+ y     x + y
+
+\e8___________________________________________________________________________________________
+
+  key         8          9         10        11        12        13         14        15
+ result   \ e_\ f (x + y)   \ e_\ f(x O\b+ y)     \ e_\ f x     \ e_\ f x + y     \ e_\ f y     x + \ e_\ f y   \ e_\ f x + \ e_\ f y    -1
+\e8___________________________________________________________________________________________
+\e7\b|\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+\e9                                                                                          |\b\e8|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+\e9
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Arithmetic Functions                                                    3-3
+
+
+(cos 'fx_angle)
+
+     RETURNS: the cosine of fx_angle (which is assumed to be in radians).
+
+
+(diff ['n_arg1 ... ])
+
+     RETURNS: the result of subtracting from n_arg1  all  subsequent  argu-
+              ments. If no arguments are given, 0 is returned.
+
+     NOTE: See the description of add for details on data type  conversions
+           and restrictions.
+
+
+(difference ['n_arg1 ...])
+
+     EQUIVALENT TO: diff.
+
+
+(Divide 'i_dividend 'i_divisor)
+
+     RETURNS: a list whose car is  the  quotient  and  whose  cadr  is  the
+              remainder of the division of i_dividend by i_divisor.
+
+     NOTE: this is restricted to integer division.
+
+
+(Emuldiv 'x_fact1 'x_fact2 'x_addn 'x_divisor)
+
+     RETURNS: a list of the  quotient  and  remainder  of  this  operation:
+              ((x_fact1 * x_fact2) + (sign extended) x_addn) / x_divisor.
+
+     NOTE: this is useful for creating a bignum arithmetic package in Lisp.
+
+
+(exp 'fx_arg)
+
+     RETURNS: _\be raised to the fx_arg power.
+
+
+(expt 'n_base 'n_power)
+
+     RETURNS: n_base raised to the i_power power.
+
+     NOTE: if either of the arguments are flonums, the calculation will  be
+           done using _\bl_\bo_\bg and _\be_\bx_\bp.
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Arithmetic Functions                                                    3-4
+
+
+(fact 'x_arg)
+
+     RETURNS: x_arg factorial.
+
+
+(fix 'n_arg)
+
+     RETURNS: a fixnum as close as we can get to n_arg.
+
+     NOTE: _\bf_\bi_\bx will round down.  Currently, if n_arg  is  a  flonum  larger
+           than the size of a fixnum, this will fail.
+
+
+(fixp 'g_arg)
+
+     RETURNS: t iff g_arg is a fixnum or bignum.
+
+
+(float 'n_arg)
+
+     RETURNS: a flonum as close as we can get to n_arg.
+
+     NOTE: if n_arg is a bignum larger than the maximum size of  a  flonum,
+           then a floating exception will occur.
+
+
+(floatp 'g_arg)
+
+     RETURNS: t iff g_arg is a flonum.
+
+
+(greaterp ['n_arg1 ...])
+
+     RETURNS: t iff the arguments are in a strictly decreasing order.
+
+     NOTE: the function difference is used to compare adjacent  values.  If
+           any  of  the  arguments  are non numbers, the error message will
+           come from the difference function.
+
+
+(haipart bx_number x_bits)
+
+     RETURNS: the x_bits high bits of |bx_number| if  x_bits  is  positive,
+              otherwise it returns the |x_bits| low bits of |bx_number|.
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Arithmetic Functions                                                    3-5
+
+
+(haulong bx_number)
+
+     RETURNS: the number of significant bits in bx_number.
+
+     NOTE: the result is equal to the least integer greater to or equal  to
+           the base two logarithm of |bx_number| + 1.
+
+
+(lessp ['n_arg1 ...])
+
+     RETURNS: t iff the arguments are in a strictly increasing order.
+
+     NOTE: the function _\bd_\bi_\bf_\bf_\be_\br_\be_\bn_\bc_\be is used to compare adjacent  values.  If
+           any  of  the  arguments  are non numbers, the error message will
+           come from the _\bd_\bi_\bf_\bf_\be_\br_\be_\bn_\bc_\be function.
+
+
+(log 'fx_arg)
+
+     RETURNS: the natural logarithm of fx_arg.
+
+
+(lsh 'x_val 'x_amt)
+
+     RETURNS: x_val shifted left by x_amt if x_amt is positive.   If  x_amt
+              is negative, then _\bl_\bs_\bh returns x_val shifted right by the mag-
+              nitude if x_amt.
+
+
+(max 'n_arg1 ... )
+
+     RETURNS: the maximum value in the list of arguments.
+
+
+(min 'n_arg1 ... )
+
+     RETURNS: the minimum value in the list of arguments.
+
+
+(minus 'n_arg)
+
+     RETURNS: zero minus n_arg.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Arithmetic Functions                                                    3-6
+
+
+(minusp 'g_arg)
+
+     RETURNS: t iff g_arg is a negative number.
+
+
+(mod 'i_dividend 'i_divisor)
+
+     RETURNS: the remainder when i_dividend is divided by i_divisor.
+
+
+(numberp 'g_arg)
+
+     RETURNS: t iff g_arg is a number (fixnum, flonum or bignum).
+
+
+(numbp 'g_arg)
+
+     EQUIVALENT TO: numberp.
+
+
+(onep 'g_arg)
+
+     RETURNS: t iff g_arg is a number equal to 1.
+
+
+(plus ['n_arg ...])
+
+     EQUIVALENT TO: to add.
+
+
+(plusp 'n_arg)
+
+     RETURNS: t iff n_arg is greater than zero.
+
+
+(product ['n_arg1 ... ])
+
+     RETURNS: the product of all of its arguments.  It returns 1  if  there
+              are no arguments.
+
+     NOTE: See the description of the function _\ba_\bd_\bd for details and restric-
+           tions to the automatic data type coercion.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Arithmetic Functions                                                    3-7
+
+
+(quotient ['n_arg1 ...])
+
+     RETURNS: the result of dividing the first argument by succeeding ones.
+
+     NOTE: If there are no arguments, 1 is returned.  See  the  description
+           of  the  function  _\ba_\bd_\bd for details and restrictions of data type
+           coercion.  A divide by zero  will  cause  a  floating  exception
+           interrupt -- see the description of the _\bs_\bi_\bg_\bn_\ba_\bl function.
+
+
+(random ['x_limit])
+
+     RETURNS: a fixnum between 0 and x_limit  1 if x_limit  is  given.   If
+              x_limit is not given, any fixnum, positive or negative, might
+              be returned.
+
+
+(remainder 'i_dividend 'i_divisor)
+
+     EQUIVALENT TO: mod.
+
+
+(rot 'x_val 'x_amt)
+
+     RETURNS: x_val rotated left by x_amt if x_amt is positive. If x_amt is
+              negative,  then  x_val  is  rotated right by the magnitude of
+              x_amt.
+
+
+(sin 'fx_angle)
+
+     RETURNS: the sine of fx_angle (which is assumed to be in radians).
+
+
+(sqrt 'fx_arg)
+
+     RETURNS: the square root of fx_arg.
+
+
+(sub1 'n_arg)
+
+     RETURNS: n_arg minus 1.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Arithmetic Functions                                                    3-8
+
+
+(sum ['n_arg1 ...])
+
+     EQUIVALENT TO: add and plus.
+
+
+(times ['n_arg1 ... ])
+
+     EQUIVALENT TO: product.
+
+
+(zerop 'g_arg)
+
+     RETURNS: t iff g_arg is a number equal to 0.
+
+
+
+
+     _\b3._\b2.  These functions are restricted to fixnum arguments  in  Maclisp.
+     The  lisp compiler will assume the arguments are fixnums and open code
+     most of these functions.
+
+
+(1+ 'n_arg)
+
+     EQUIVALENT TO: add1.
+
+
+(1- 'n_arg)
+
+     EQUIVALENT TO: sub1.
+
+
+(+ 'n_arg)
+
+     EQUIVALENT TO: add.
+
+
+(* 'n_arg)
+
+     EQUIVALENT TO: times.
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+Arithmetic Functions                                                    3-9
+
+
+(- 'n_arg)
+
+     EQUIVALENT TO: difference.
+
+
+(/ 'n_arg1 'n_arg2)
+
+     EQUIVALENT TO: quotient
+
+
+(< 'n_arg1 'n_arg2)
+
+     EQUIVALENT TO: lessp.
+
+
+(= 'g_arg1 'g_arg2)
+
+     EQUIVALENT TO: equal.
+
+
+(> 'n_arg1 'n_arg2)
+
+     EQUIVALENT TO: greaterp.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch4.r b/usr/lib/lisp/manual/ch4.r
new file mode 100644 (file)
index 0000000..7eadbcd
--- /dev/null
@@ -0,0 +1,847 @@
+
+
+
+
+
+
+
+                                CHAPTER  4
+
+
+                                 Special Functions
+
+
+
+
+
+(and [g_arg1 ...])
+
+     RETURNS: the value of the last argument if all arguments evaluate to a
+              non  nil  value,  otherwise _\ba_\bn_\bd returns nil.  It returns t if
+              there are no arguments.
+
+     NOTE: the arguments are evaluated left to right  and  evaluation  will
+           cease with the first nil encountered
+
+
+(apply 'u_func 'l_args)
+
+     RETURNS: the result of applying function u_func to  the  arguments  in
+              the list l_args.
+
+     NOTE: If u_func is a lambda, then the (_\bl_\be_\bn_\bg_\bt_\bh _\bl__\ba_\br_\bg_\bs) should equal the
+           number  of  formal  parameters  for  the u_func.  If u_func is a
+           nlambda or macro, then l_args is  bound  to  the  single  formal
+           parameter.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9   Special Functions                                                    4-1
+
+
+
+
+
+
+
+   Special Functions                                                    4-2
+
+
+
+    ___________________________________________________________________
+
+    ; _\ba_\bd_\bd_\b1 is a lambda of 1 argument
+    -> (_\ba_\bp_\bp_\bl_\by '_\ba_\bd_\bd_\b1 '(_\b3))
+    4
+
+    ; we will define _\bp_\bl_\bu_\bs_\b1 as a macro which will be equivalent to _\ba_\bd_\bd_\b1
+    -> (_\bd_\be_\bf _\bp_\bl_\bu_\bs_\b1 (_\bm_\ba_\bc_\br_\bo (_\ba_\br_\bg) (_\bl_\bi_\bs_\bt '_\ba_\bd_\bd_\b1 (_\bc_\ba_\bd_\br _\ba_\br_\bg))))
+    plus1
+    -> (_\bp_\bl_\bu_\bs_\b1 _\b3)
+    4
+
+    ; now if we _\ba_\bp_\bp_\bl_\by a macro we obtain the form it changes to.
+    -> (_\ba_\bp_\bp_\bl_\by '_\bp_\bl_\bu_\bs_\b1 '(_\bp_\bl_\bu_\bs_\b1 _\b3))
+    (add1 3)
+
+    ; if we _\bf_\bu_\bn_\bc_\ba_\bl_\bl a macro however, the result of the macro is _\be_\bv_\ba_\bled
+    ; before it is returned.
+    -> (_\bf_\bu_\bn_\bc_\ba_\bl_\bl '_\bp_\bl_\bu_\bs_\b1 '(_\bp_\bl_\bu_\bs_\b1 _\b3))
+    4
+    ___________________________________________________________________
+
+
+
+
+
+(arg ['x_numb])
+
+     RETURNS: if x_numb is specified then the  x_numb'_\bt_\bh  argument  to  the
+              enclosing  lexpr If x_numb is not specified then this returns
+              the number of arguments to the enclosing lexpr.
+
+     NOTE: it is an error to the interpreter if x_numb is given and out  of
+           range.
+
+
+(break [g_message ['g_pred]])
+
+     WHERE:   if g_message is not given  it  is  assumed  to  be  the  null
+              string, and if g_pred is not given it is assumed to be t.
+
+     RETURNS: the value of (*break 'g_pred 'g_message)
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                    4-3
+
+
+(*break 'g_pred 'g_message)
+
+     RETURNS: nil immediately if g_pred is nil, else the value of the  next
+              (return 'value) expression typed in at top level.
+
+     SIDE EFFECT: If the predicate, g_pred, evaluates to non nil, the  lisp
+                  system   stops  and  prints  out  `Break  '  followed  by
+                  g_message. It then enters a break loop which  allows  one
+                  to  interactively debug a program.  To continue execution
+                  from a break you can use the _\br_\be_\bt_\bu_\br_\bn function.  to  return
+                  to  top  level or another break level, you can use _\br_\be_\bt_\bb_\br_\bk
+                  or _\br_\be_\bs_\be_\bt.
+
+
+(catch g_exp [ls_tag])
+
+     WHERE:   if ls_tag is not given, it is assumed to be nil.
+
+     RETURNS: the result of (*catch 'ls_tag g_exp)
+
+     NOTE: catch is defined as a macro.
+
+
+(*catch 'ls_tag g_exp)
+
+     WHERE:   ls_tag is either a symbol or a list of symbols.
+
+     RETURNS: the result of evaluating g_exp or the value thrown during the
+              evaluation of g_exp.
+
+     SIDE EFFECT: this first sets up a `catch frame' on  the  lisp  runtime
+                  stack.   Then  it  begins  to  evaluate  g_exp.  If g_exp
+                  evaluates normally, its value is returned.  If, however a
+                  _\bt_\bh_\br_\bo_\bw  is  done  during  the  evaluation of g_exp we will
+                  catch the value thrown iff one of these cases is true:
+
+     (1)  the tag thrown to is ls_tag
+
+     (2)  ls_tag is a list and the tag thrown to is a member of this list
+
+     (3)  ls_tag is nil.
+
+     NOTE: Errors are implemented as a special kind of throw.  A catch with
+           no  tag  will  not  catch  an error but a catch whose tag is the
+           error type will catch that type  of  error.   See  10  for  more
+           information.
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                    4-4
+
+
+(comment [g_arg ...])
+
+     RETURNS: the symbol comment.
+
+     NOTE: This does absolutely nothing.
+
+
+(cond [l_clause1 ...])
+
+     RETURNS: the last value evaluated in the first clause  satisfied.   If
+              no clauses are satisfied then nil is returned.
+
+     NOTE: This is the basic conditional `statement' in lisp.  The  clauses
+           are processed from left to right.  The first element of a clause
+           is evaluated.  If it evaluated to a  non  nil  value  then  that
+           clause  is  satisfied  and all following elements of that clause
+           are evaluated.  The last value computed is returned as the value
+           of  the  cond.   If there is just one element in the clause then
+           its value is returned.  If the first element of a clause  evalu-
+           ates  to  nil,  then  the  other elements of that clause are not
+           evaluated and the system moves to the next clause.
+
+
+(declare [g_arg ...])
+
+     RETURNS: nil
+
+     NOTE: this is a no-op to the evaluator.  It has special meaning to the
+           compiler.
+
+
+(def s_name (s_type l_argl g_exp1 ...))
+
+     WHERE:   s_type is one of lambda, nlambda, macro or lexpr.
+
+     RETURNS: s_name
+
+     SIDE EFFECT: This defines the function s_name to the lisp system.   If
+                  s_type  is nlambda or macro then the argument list l_argl
+                  must contain exactly one non-nil symbol.
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                    4-5
+
+
+(defun s_name [s_mtype] ls_argl g_exp1 ... )
+
+     WHERE:   s_mtype is one of fexpr, expr, args or macro.
+
+     RETURNS: s_name
+
+     SIDE EFFECT: This defines the function s_name.
+
+     NOTE: this exists for MAClisp compatibility, it is just a macro  which
+           changes  the defun form to the def form.  An s_mtype of fexpr is
+           converted to nlambda and of expr to lambda.  Macro  remains  the
+           same.   If ls_arg1 is a non-nil symbol, then the type is assumed
+           to be lexpr and ls_arg1 is the symbol  which  is  bound  to  the
+           number of args when the function is entered.
+
+
+    ___________________________________________________________________
+
+    ; _\bd_\be_\bf and _\bd_\be_\bf_\bu_\bn here are used to define identical functions
+    ; you can decide for yourself which is easier to use.
+    -> (_\bd_\be_\bf _\ba_\bp_\bp_\be_\bn_\bd_\b1 (_\bl_\ba_\bm_\bb_\bd_\ba (_\bl_\bi_\bs _\be_\bx_\bt_\br_\ba) (_\ba_\bp_\bp_\be_\bn_\bd _\bl_\bi_\bs (_\bl_\bi_\bs_\bt _\be_\bx_\bt_\br_\ba))))
+    append1
+
+    -> (_\bd_\be_\bf_\bu_\bn _\ba_\bp_\bp_\be_\bn_\bd_\b1 (_\bl_\bi_\bs _\be_\bx_\bt_\br_\ba) (_\ba_\bp_\bp_\be_\bn_\bd _\bl_\bi_\bs (_\bl_\bi_\bs_\bt _\be_\bx_\bt_\br_\ba)))
+    append1
+    ___________________________________________________________________
+
+
+
+
+
+(do l_vrbs l_test g_exp1 ...)
+
+     RETURNS: the last form in the cdr of  l_test  evaluated,  or  a  value
+              explicitly given by a return evaluated within the do body.
+
+     NOTE: This is the basic iteration form for FRANZ LISP.   l_vrbs  is  a
+           list  of  zero or more var-init-repeat forms.  A var-init-repeat
+           form looks like:
+                       (s_name [g_init [g_repeat]])
+           There are three cases depending on what is present in the  form.
+           If  just  s_name  is  present,  this  means  that when the do is
+           entered, s_name is lambda-bound to nil and is never modified  by
+           the  system  (though the program is certainly free to modify its
+           value).  If the form is (s_name 'g_init) then the  only  differ-
+           ence  is  that  s_name  is  lambda-bound  to the value of g_init
+           instead of nil.  If g_repeat is  also  present  then  s_name  is
+           lambda-bound  to  g_init when the loop is entered and after each
+           pass through the do body  s_name  is   bound  to  the  value  of
+           g_repeat.
+           l_test is either nil or has the form of a cond clause.  If it is
+           nil then the do body will be evaluated only once and the do will
+           return nil.  Otherwise, before the do body is evaluated the  car
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                    4-6
+
+
+           of l_test is evaluated and if the result is non nil this signals
+           an end to the looping.  Then the rest of the forms in l_test are
+           evaluated and the value of the last one is returned as the value
+           of the do.  If the cdr of l_test is nil, then nil is returned --
+           thus this is not exactly like a cond clause.
+           g_exp1 and those forms which follow constitute the do  body.   A
+           do body is like a prog body and thus may have labels and one may
+           use the functions go and return.
+           The sequence of evaluations is this:
+
+     (1)  the init forms are evaluated left to right and   stored  in  tem-
+          porary locations.
+
+     (2)  Simultaneously all do variables are lambda bound to the value  of
+          their init forms or nil.
+
+     (3)  If l_test is non nil then the car is evaluated and if it  is  non
+          nil  the  rest  of the forms in l_test are evaluated and the last
+          value is returned as the value of the do.
+
+     (4)  The forms in the do body are evaluated left to right.
+
+     (5)  If l_test is nil the do function returns with the value nil.
+
+     (6)  The repeat forms are evaluated and saved in temporary locations.
+
+     (7)  The variables with repeat forms are simultaneously bound  to  the
+          values of those forms.
+
+     (8)  Go to step 3.
+
+     NOTE: there is an alternate form of do which can be used when there is
+           only one do variable.  It is described next.
+
+
+(do s_name g_init g_repeat g_test g_exp1 ...)
+
+     NOTE: this is another, less general,  form of do.  It is evaluated by:
+
+     (1)  evaluating g_init
+
+     (2)  lambda binding s_name to value of g_init
+
+     (3)  g_test is evaluated and if it is not nil the do function  returns
+          with nil.
+
+     (4)  the do body is evaluated beginning at g_exp1.
+
+     (5)  the repeat form is evaluated and stored in s_name.
+
+     (6)  go to step 3.
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                    4-7
+
+
+(err ['s_value [nil]])
+
+     RETURNS: nothing (it never returns).
+
+     SIDE EFFECT: This causes an error and if this error is  caught  by  an
+                  _\be_\br_\br_\bs_\be_\bt  then  that  _\be_\br_\br_\bs_\be_\bt will return s_value instead of
+                  nil.  If the second arg is given, then  it  must  be  nil
+                  (MAClisp compatibility).
+
+
+(error ['s_message1 ['s_message2]])
+
+     RETURNS: nothing (it never returns).
+
+     SIDE EFFECT: s_message1 and s_message2 are _\bp_\ba_\bt_\bo_\bmed if they  are  given
+                  and then _\be_\br_\br is called which causes an error.
+
+
+(errset g_expr [s_flag])
+
+     RETURNS: a list of one element, which  is  the  value  resulting  from
+              evaluating  g_expr.  If an error occurs during the evaluation
+              of g_expr, then the locus  of  control  will  return  to  the
+              _\be_\br_\br_\bs_\be_\bt  which  will  then  return  nil  (unless the error was
+              caused by a call to _\be_\br_\br).
+
+     SIDE EFFECT: S_flag is evaluated before g_expr is evaluated. If s_flag
+                  is  not  given,  then it is assumed to be t.  If an error
+                  occurs  during  the  evaluation  of  g_expr,  and  s_flag
+                  evaluated  to  a  non  nil  value, then the error message
+                  associated with  the  error  is  printed  before  control
+                  returns to the errset.
+
+
+(eval 'g_val)
+
+     RETURNS: the result of evaluating g_val.
+
+     NOTE: The evaluator evaluates g_val in this way:
+           If g_val is a symbol, then the evaluator returns its value.   If
+           g_val  had  never  been  assigned  a  value, then this causes an
+           'Unbound Variable' error.  If g_val is of type value,  then  its
+           value  is  returned.   If  g_val  is a list object then g_val is
+           either a function call or array reference.   Let  g_car  be  the
+           first  element of g_val.  We continually evaluate g_car until we
+           end up with a symbol with a non nil function binding or  a  non-
+           symbol.   Call  what we end up with: g_func.  g_func must be one
+           of three types: list, binary or array.  If it is a list then the
+           first  element of the list, which we shall call g_functype, must
+           be either lambda, nlambda, macro  or  lexpr.   If  g_func  is  a
+           binary,  then its discipline, which we shall call g_functype, is
+           either lambda, nlambda, macro or a string  "subroutine",  "func-
+           tion",  "integer-function"  or "real-function".  If g_func is an
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                    4-8
+
+
+           array then this form is evaluated specially, see  9  on  arrays.
+           If  g_func  is  a list or binary, then g_functype will determine
+           how the arguments to this function, the cdr of g_val,  are  pro-
+           cessed.  If g_functype is a string, then this is a foreign func-
+           tion call (see 8.4 for more details).  If g_functype  is  lambda
+           or  lexpr,  the arguments are  evaluated (by calling _\be_\bv_\ba_\bl recur-
+           sively) and stacked.  If g_functype is nlambda then the argument
+           list  is  stacked.  If g_functype is macro then the entire form,
+           g_val is stacked.  Next the formal variables are  lambda  bound.
+           The  formal  variables are the cadr of g_func - if g_functype is
+           nlambda, lexpr or macro, there should only be one  formal  vari-
+           able.   The  values  on the stack are lambda bound to the formal
+           variables except in the case of a lexpr,  where  the  number  of
+           actual  arguments  is  bound  to the formal variable.  After the
+           binding is done, the function is invoked, either by  jumping  to
+           the  entry  point  in  the case of a binary or by evaluating the
+           list of forms beginning at cddr  g_func.   The  result  of  this
+           function  invocation  is  returned  as  the value of the call to
+           eval.
+
+
+(eval-when l_times g_exp1 ... g_expn)
+
+     WHERE:   l_times is a list containing any combination of compile, eval
+              and load.
+
+     RETURNS: nil if the symbol  eval  is  not   member  of  l_times,  else
+              returns the value of g_expn.
+
+     SIDE EFFECT: If eval is a member of l_times, then the forms g_exp_\bi are
+                  evaluated.
+
+     NOTE: this is used mainly  to  control  when  the  compiler  evaluates
+           forms.
+
+
+(exec s_arg1 ...)
+
+     RETURNS: the result of forking and executing the command named by con-
+              catenating the s_arg_\bi together with spaces in between.
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                    4-9
+
+
+(exece 's_fname ['l_args ['l_envir]])
+
+     RETURNS: the error code from the system if it was  unable  to  execute
+              the  command  s_fname  with  arguments  l_args  and  with the
+              environment set up as specified in l_envir.  If this function
+              is  successful,  it  will not return, instead the lisp system
+              will be overlaid by the new command.
+
+
+(funcall 'u_func ['g_arg1 ...])
+
+     RETURNS: the value of applying function u_func to the arguments g_arg_\bi
+              and then evaluating that result if u_func is a macro.
+
+     NOTE: If u_func is a macro or nlambda then there should  be  only  one
+           g_arg.   _\bf_\bu_\bn_\bc_\ba_\bl_\bl  is  the  function  which the evaluator uses to
+           evaluate lists.  If _\bf_\bo_\bo is a lambda  or  lexpr  or  array,  then
+           (_\bf_\bu_\bn_\bc_\ba_\bl_\bl '_\bf_\bo_\bo '_\ba '_\bb '_\bc) is equivalent to (_\bf_\bo_\bo '_\ba '_\bb '_\bc).  If _\bf_\bo_\bo
+           is a nlambda then (_\bf_\bu_\bn_\bc_\ba_\bl_\bl '_\bf_\bo_\bo '(_\ba _\bb _\bc)) is equivalent to  (_\bf_\bo_\bo
+           _\ba    _\bb    _\bc).     Finally,    if    _\bf_\bo_\bo    is   a   macro   then
+           (_\bf_\bu_\bn_\bc_\ba_\bl_\bl '_\bf_\bo_\bo '(_\bf_\bo_\bo _\ba _\bb _\bc)) is equivalent to (_\bf_\bo_\bo _\ba _\bb _\bc).
+
+
+(function u_func)
+
+     RETURNS: the function binding of u_func if it  is  an  symbol  with  a
+              function binding otherwise u_func is returned.
+
+
+(getdisc 't_func)
+
+     RETURNS: the discipline of the machine coded function (either  lambda,
+              nlambda or macro).
+
+
+(go g_labexp)
+
+     WHERE:   g_labexp is either a symbol or an expression.
+
+     SIDE EFFECT: If  g_labexp  is  an  expression,  that   expression   is
+                  evaluated  and  should  result in a symbol.  The locus of
+                  control moves to just following the  symbol  g_labexp  in
+                  the current prog or do body.
+
+     NOTE: this is only valid in the context of a prog  or  do  body.   The
+           interpreter  and compiler will allow non-local _\bg_\bo's although the
+           compiler won't allow a _\bg_\bo to leave a function  body.   The  com-
+           piler will not allow g_labexp to be an expression.
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                   4-10
+
+
+(map 'u_func 'l_arg1 ...)
+
+     RETURNS: l_arg1
+
+     NOTE: The function u_func is applied to  successive  sublists  of  the
+           l_arg_\bi.  All sublists should have the same length.
+
+
+(mapc 'u_func 'l_arg1 ...)
+
+     RETURNS: l_arg1.
+
+     NOTE: The function u_func is applied to  successive  elements  of  the
+           argument lists.  All of the lists should have the same length.
+
+
+(mapcan 'u_func 'l_arg1 ...)
+
+     RETURNS: nconc applied to the results of the functional evaluations.
+
+     NOTE: The function u_func is applied to  successive  elements  of  the
+           argument lists.  All sublists should have the same length.
+
+
+(mapcar 'u_func 'l_arg1 ...)
+
+     RETURNS: a list of the values returned from  the  functional  applica-
+              tion.
+
+     NOTE: the function u_func is applied to  successive  elements  of  the
+           argument lists.  All sublists should have the same length.
+
+
+(mapcon 'u_func 'l_arg1 ...)
+
+     RETURNS: nconc applied to the results of the functional evaluation.
+
+     NOTE: the function u_func is applied to  successive  sublists  of  the
+           argument lists.  All sublists should have the same length.
+
+
+(maplist 'u_func 'l_arg1 ...)
+
+     RETURNS: a list of the results of the functional evaluations.
+
+     NOTE: the function u_func is applied to  successive  sublists  of  the
+           arguments lists.  All sublists should have the same length.
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                   4-11
+
+
+(mfunction entry 's_disc)
+
+     RETURNS: a lisp object of type binary composed of entry and s_disc.
+
+     NOTE: entry is a pointer to the  machine  code  for  a  function,  and
+           s_disc is the discipline (e.g. lambda).
+
+
+(oblist)
+
+     RETURNS: a list of all symbols on the oblist.
+
+
+(or [g_arg1 ... ])
+
+     RETURNS: the value of the first non nil argument  or nil if all  argu-
+              ments evaluate to nil.
+
+     NOTE: Evaluation proceeds left to right and stops as soon  as  one  of
+           the arguments evaluates to a non nil value.
+
+
+(prog l_vrbls g_exp1 ...)
+
+     RETURNS: the value explicitly given in a return form or else nil if no
+              return is done by the time the last g_exp_\bi is evaluated.
+
+     NOTE: the local variables are lambda bound to nil then the  g_exp  are
+           evaluated  from  left to right.  This is a prog body (obviously)
+           and this means than any symbols seen are not evaluated,  instead
+           they  are  treated  as labels.  This also means that returns and
+           go's are allowed.
+
+
+(prog2 g_exp1 g_exp2 [g_exp3 ...])
+
+     RETURNS: the value of g_exp2.
+
+     NOTE: the forms are evaluated from left to  right  and  the  value  of
+           g_exp2 is returned.
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                   4-12
+
+
+(progn g_exp1 [g_exp2 ...])
+
+     RETURNS: the value of the last g_exp_\bi.
+
+     NOTE: the forms are evaluated from left to right and the value of  the
+           last one is returned.
+
+
+(progv 'l_locv 'l_initv g_exp1 ...)
+
+     WHERE:   l_locv is a list of symbols and l_initv is a list of  expres-
+              sions.
+
+     RETURNS: the value of the last g_exp_\bi evaluated.
+
+     NOTE: The expressions in l_initv are evaluated from left to right  and
+           then lambda-bound to the symbols in _locv.  If there are too few
+           expressions in l_initv then the missing values are assumed to be
+           nil.   If  there  are  too  many expressions in l_initv then the
+           extra ones are ignored (although they are evaluated).  Then  the
+           g_exp_\bi are evaluated left to right.  The body of a progv is like
+           the body of a progn, it is _\bn_\bo_\bt a prog body.
+
+
+(putd 's_name 'u_func)
+
+     RETURNS: this sets the function binding of symbol s_name to u_func.
+
+
+(return ['g_val])
+
+     RETURNS: g_val (or nil if g_val is not  present)  from  the  enclosing
+              prog or do body.
+
+     NOTE: this form is only valid in the context of a prog or do body.
+
+
+(setarg 'x_argnum 'g_val)
+
+     WHERE:   x_argnum is greater than zero and less than or equal  to  the
+              number of arguments to the lexpr.
+
+     RETURNS: g_val
+
+     SIDE EFFECT: the lexpr's x_argnum'th argument is set to g-val.
+
+     NOTE: this can only be used within the body of a lexpr.
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+   Special Functions                                                   4-13
+
+
+(throw 'g_val [s_tag])
+
+     WHERE:   if s_tag is not given, it is assumed to be nil.
+
+     RETURNS: the value of (*_\bt_\bh_\br_\bo_\bw '_\bs__\bt_\ba_\bg '_\bg__\bv_\ba_\bl).
+
+
+(*throw 's_tag 'g_val)
+
+     RETURNS: g_val from the first enclosing catch with the  tag  s_tag  or
+              with no tag at all.
+
+     NOTE: this is used in conjunction with *_\bc_\ba_\bt_\bc_\bh to cause a clean jump to
+           an enclosing context.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch5.r b/usr/lib/lisp/manual/ch5.r
new file mode 100644 (file)
index 0000000..86263a1
--- /dev/null
@@ -0,0 +1,587 @@
+
+
+
+
+
+
+
+                                CHAPTER  5
+
+
+                               Input/Output
+
+
+
+The following functions are used to read and write  to  and  from  external
+devices  and  programs (through pipes).  All I/O goes through the lisp data
+type called the port.  A port may be open for either reading or writing but
+not both simultaneously.  There are only a limited number of ports (20) and
+they will not be reclaimed unless you _\bc_\bl_\bo_\bs_\be them.  All ports are  reclaimed
+by  a  _\br_\be_\bs_\be_\bt_\bi_\bo call but this drastic step won't be necessary if the program
+closes what it uses.  If you don't supply a port  argument  to  a  function
+which  requires one or if you supply a bad port argument (such as nil) then
+FRANZ LISP will use the default port according to this scheme.  If you  are
+reading  then the default port is the value of the symbol _\bp_\bi_\bp_\bo_\br_\bt and if you
+are writing it is the value of the symbol _\bp_\bo_\bp_\bo_\br_\bt.  Furthermore if the value
+of piport or poport is not a valid port then the standard input or standard
+output will be used, respectively.  The standard input and standard  output
+are usually the keyboard and terminal display unless your job is running in
+the background and its input or output is connected to a pipe.  All  output
+which  goes to the standard output will also go to the port _\bp_\bt_\bp_\bo_\br_\bt if it is
+a valid port.  Output destined for the standard output will not reach it if
+the  symbol ^_\bw is non nil (although it will still go to _\bp_\bt_\bp_\bo_\br_\bt if _\bp_\bt_\bp_\bo_\br_\bt is
+a valid port).
+
+
+(cfasl 'st_file 'st_entry 's_funcname ['st_disc ['st_library]])
+
+     RETURNS: t
+
+     SIDE EFFECT: This is use to load in a foreign function (see 8.4).  The
+                  object  file  st_file  is  loaded  into  the lisp system.
+                  St_entry should be  an  entry  point  in  the  file  just
+                  loaded.   The  function  binding of the symbol s_funcname
+                  will be set to point to st_entry, so that when  the  lisp
+                  function  s_funcname  is  called,  st_entry  will be run.
+                  st_disc is the discipline  to  be  given  to  s_funcname.
+                  st_disc defaults to "subroutine" if it is not given or if
+                  it is given as nil.  If st_library is non nil, then after
+                  st_file is loaded, the libraries given in st_library will
+                  be searched to resolve external references.  The form  of
+                  st_library  should  be  something  like "-lS -lm".  The c
+                  library  (" -lc " ) is always searched so when loading in
+                  a  C  file  you probably won't need to specify a library.
+                  For Fortran files, you should specify "-lF77" and if  you
+                  are  doing  any  I/O  that should be "-lF77 -lIf77".  For
+                  Pascal files "-lpc" is required.
+
+     NOTE: This function may be used to load the output of the assembler, C
+           compiler,  Fortran  compiler,  and  Pascal compiler  but NOT the
+           lisp compiler (use _\bf_\ba_\bs_\bl for that).  If a file has more than  one
+
+
+Input/Output                                                            5-1
+
+
+
+
+
+
+
+Input/Output                                                            5-2
+
+
+           entry  point,  then  use  _\bg_\be_\bt_\ba_\bd_\bd_\br_\be_\bs_\bs  to  locate and setup other
+           foreign functions.
+
+
+(close 'p_port)
+
+     RETURNS:
+
+     SIDE EFFECT: the specified port is drained and closed,  releasing  the
+                  port.
+
+     NOTE: The standard defaults are not used in this case since you  prob-
+           ably never want to close the standard output or standard input.
+
+
+(cprintf 'st_format 'xfst_val ['p_port])
+
+     RETURNS: xfst_val
+
+     SIDE EFFECT: The UNIX formatted output function printf is called  with
+                  arguments  st_format and xfst_val.  If xfst_val is a sym-
+                  bol then its print name is passed to printf.  The  format
+                  string  may  contain  characters  which  are just printed
+                  literally and it may contain special formatting  commands
+                  preceded  by a percent sign.  The complete set of format-
+                  ting characters is described in the  UNIX  manual.   Some
+                  useful  ones  are %d for printing a fixnum in decimal, %f
+                  or %e for printing a flonum, and %s for printing a  char-
+                  acter string (or print name of a symbol).
+
+     EXAMPLE: (_\bc_\bp_\br_\bi_\bn_\bt_\bf "_\bP_\bi _\be_\bq_\bu_\ba_\bl_\bs %_\bf" _\b3._\b1_\b4_\b1_\b5_\b9) prints `Pi equals 3.14159'
+
+
+(drain ['p_port])
+
+     RETURNS: nil
+
+     SIDE EFFECT: If this is an output port then the characters in the out-
+                  put  buffer  are  all  sent to the device.  If this is an
+                  input port then all pending characters are flushed.   The
+                  default  port  for  this  function  is the default output
+                  port.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Input/Output                                                            5-3
+
+
+(fasl 'st_name ['st_mapf ['g_warn]])
+
+     WHERE:   st_mapf and g_warn default to nil.
+
+     RETURNS: t if the function succeeded, nil otherwise.
+
+     SIDE EFFECT: this function is designed to load in an object file  gen-
+                  erated by the lisp compiler Liszt.  File names for object
+                  files usually end in `.o', so _\bf_\ba_\bs_\bl will append   `.o'  to
+                  st_name  (if  it  is not already present).  If st_mapf is
+                  non nil, then it is the name of the map file  to  create.
+                  _\bF_\ba_\bs_\bl  writes  in  the map file the names and addresses of
+                  the functions it loads and  defines.   Normally  the  map
+                  file  is  created  (i.e.  truncated if it exists), but if
+                  (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\ba_\bp_\bp_\be_\bn_\bd_\bm_\ba_\bp _\bt) is done then the map file  will  be
+                  appended.   If  g_warn  is  non nil and if  a function is
+                  loaded from  the file which is already  defined,  then  a
+                  warning message will be printed.
+
+
+(ffasl 'st_file 'st_entry 'st_funcname ['st_discipline])
+
+     RETURNS: the binary object created.
+
+     SIDE EFFECT: the fortran object file st_file is loaded into  the  lisp
+                  system.   St_entry  should  be an entry point in the file
+                  just loaded. A binary object  will  be  created  and  its
+                  entry  field  will be set to point to st_entry.  The dis-
+                  cipline field of the binary will be set to  st_discipline
+                  or "subroutine" by default.  After st_file is loaded, the
+                  standard fortran libraries will be  searched  to  resolve
+                  external references.
+
+     NOTE: in F77 on Unix, the entry point for the fortran function foo  is
+           named `_foo_'.
+
+
+(flatc 'g_form ['x_max])
+
+     RETURNS: the number of  characters  required  to  print  g_form  using
+              _\bp_\ba_\bt_\bo_\bm.   If  x_max is given, and the _\bf_\bl_\ba_\bt_\bc determines that it
+              will return a value greater than x_max, then it gives up  and
+              returns the current value it has computed.  This is useful if
+              you just want to see if an expression is larger than  a  cer-
+              tain size.
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Input/Output                                                            5-4
+
+
+(flatsize 'g_form ['x_max])
+
+     RETURNS: the number of  characters  required  to  print  g_form  using
+              _\bp_\br_\bi_\bn_\bt.  The meaning of x_max is the same as for flatc.
+
+     NOTE: Currently this just _\be_\bx_\bp_\bl_\bo_\bd_\be's g_form and checks its length.
+
+
+(fseek 'p_port 'x_offset 'x_flag)
+
+     RETURNS: the position in the file after the function is performed.
+
+     SIDE EFFECT: this function position the read/write  pointer  before  a
+                  certain  byte  in  the  file.   If  x_flag  is 0 then the
+                  pointer is set to x_offset bytes from  the  beginning  of
+                  the  file.   If  x_flag  is  1 then the pointer is set to
+                  x_offset bytes from the current location in the file.  If
+                  x_flag  is  2  then  the pointer is set to x_offset bytes
+                  from the end of the file (the bytes between  the  end  of
+                  the  file  and  the  new  position  will  be  filled with
+                  zeroes).
+
+
+(infile 's_filename)
+
+     RETURNS: a port ready to read s_filename.
+
+     SIDE EFFECT: this tries to open s_filename and  if  it  cannot  or  if
+                  there are no ports available it gives an error message.
+
+     NOTE: to allow your program to continue on a file not found error  you
+           can use something like:
+           (_\bc_\bo_\bn_\bd ((_\bn_\bu_\bl_\bl (_\bs_\be_\bt_\bq _\bm_\by_\bp_\bo_\br_\bt (_\bc_\ba_\br (_\be_\br_\br_\bs_\be_\bt (_\bi_\bn_\bf_\bi_\bl_\be _\bn_\ba_\bm_\be) _\bn_\bi_\bl))))
+                       (_\bp_\ba_\bt_\bo_\bm '"_\bc_\bo_\bu_\bl_\bd_\bn'_\bt _\bo_\bp_\be_\bn _\bt_\bh_\be _\bf_\bi_\bl_\be")))
+           which will set myport to the port  to  read  from  if  the  file
+           exists  or  will print a message if it couldn't open it and also
+           set myport to nil.
+
+
+(load 's_filename ['st_map ['g_warn]])
+
+     RETURNS: t
+
+     NOTE: The function of _\bl_\bo_\ba_\bd has  changed  since  previous  releases  of
+           FRANZ  LISP  and  the following description should be read care-
+           fully.
+
+     SIDE EFFECT: _\bl_\bo_\ba_\bd now serves the function of both  _\bf_\ba_\bs_\bl  and  the  old
+                  _\bl_\bo_\ba_\bd.   _\bL_\bo_\ba_\bd will search a user defined search path for a
+                  lisp source or object file with the  filename  s_filename
+                  (with  the extension .l or .o added as appropriate).  The
+                  search  path  which   _\bl_\bo_\ba_\bd   uses   is   the   value   of
+                  (_\bs_\bt_\ba_\bt_\bu_\bs _\bl_\bo_\ba_\bd-_\bs_\be_\ba_\br_\bc_\bh-_\bp_\ba_\bt_\bh).       The      default      is
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Input/Output                                                            5-5
+
+
+                  (|.| /usr/lib/lisp)  which  means  look  in  the  current
+                  directory  first  and then /usr/lib/lisp.  The file which
+                  _\bl_\bo_\ba_\bd looks for depends on  the  last  two  characters  of
+                  s_filename.   If s_filename ends with ".l" then _\bl_\bo_\ba_\bd will
+                  only look for a file name s_filename and will assume that
+                  this  is  a  FRANZ  LISP source file.  If s_filename ends
+                  with ".o" then _\bl_\bo_\ba_\bd will  only  look  for  a  file  named
+                  s_filename  and  will  assume  that  this is a FRANZ LISP
+                  object file to be _\bf_\ba_\bs_\bled in.  Otherwise, _\bl_\bo_\ba_\bd will  first
+                  look  for  s_filename.o,  then  s_filename.l  and finally
+                  s_filename itself.  If  it  finds  s_filename.o  it  will
+                  assume  that  this  is  an object file, otherwise it will
+                  assume that it is a  source  file.   An  object  file  is
+                  loaded  using _\bf_\ba_\bs_\bl and a source file is loaded by reading
+                  and evaluating each form in the file.  The optional argu-
+                  ments st_map and g_warn are passed to _\bf_\ba_\bs_\bl should _\bf_\ba_\bs_\bl be
+                  called.
+
+     NOTE: _\bl_\bo_\ba_\bd requires a port to  open  the  file  s_filename.   It  then
+           lambda binds the symbol piport to this port and reads and evalu-
+           ates the forms.
+
+
+(makereadtable ['s_flag])
+
+     WHERE:   if s_flag is not present it is assumed to be nil.
+
+     RETURNS: a readtable equal to the original readtable if s_flag is  non
+              nil,  or  else equal to the current readtable.  See chapter 7
+              for a description of readtables and their uses.
+
+
+(nwritn ['p_port])
+
+     RETURNS: the number of characters in the buffer of the given port  but
+              not  yet  written  out  to the file or device.  The buffer is
+              flushed automatically after the buffer (of 512 characters) is
+              filled or when _\bt_\be_\br_\bp_\br is called.
+
+
+(outfile 's_filename)
+
+     RETURNS: a port or nil
+
+     SIDE EFFECT: this opens a port to write s_filename.  The  file  opened
+                  is truncated by the _\bo_\bu_\bt_\bf_\bi_\bl_\be if it existed beforehand.  If
+                  there are no free ports, outfile returns nil.
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Input/Output                                                            5-6
+
+
+(patom 'g_exp ['p_port])
+
+     RETURNS: g_exp
+
+     SIDE EFFECT: g_exp is printed to the given port or the  default  port.
+                  If  g_exp  is  a  symbol  then  the print name is printed
+                  without any escape characters around  special  characters
+                  in the print name.  If g_exp is a list then _\bp_\ba_\bt_\bo_\bm has the
+                  same effect as _\bp_\br_\bi_\bn_\bt.
+
+
+(pntlen 'xfs_arg)
+
+     WHERE:   xfs_arg is a fixnum, flonum or symbol.
+
+     RETURNS: the number of characters needed to print  xfs_arg.
+
+
+(portp 'g_arg)
+
+     RETURNS: t iff g_arg is a port.
+
+
+(pp [l_option] s_name1 ...)
+
+     RETURNS: t
+
+     SIDE EFFECT: If s_name_\bi has a function binding, it is pretty  printed,
+                  otherwise  if  s_name_\bi  has  a  value then that is pretty
+                  printed.  Normally the output of the pretty printer  goes
+                  to  the  standard  output port poport.  The options allow
+                  you to redirect it.  The option (_\bF _\bf_\bi_\bl_\be_\bn_\ba_\bm_\be) causes  out-
+                  put  to go to the file filename.  The option (_\bP _\bp_\bo_\br_\bt_\bn_\ba_\bm_\be)
+                  causes output to go to the  port  portname  which  should
+                  have been opened previously.
+
+
+(princ 'g_arg ['p_port])
+
+     EQUIVALENT TO: patom.
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Input/Output                                                            5-7
+
+
+(print 'g_arg ['p_port])
+
+     RETURNS: nil
+
+     SIDE EFFECT: prints g_arg on the port p_port or the default port.
+
+
+(probef 'st_file)
+
+     RETURNS: t iff the file st_file exists.
+
+     NOTE: Just because it exists doesn't mean you can read it.
+
+
+(ratom ['p_port ['g_eof]])
+
+     RETURNS: the next atom read from the given or default port.  On end of
+              file, g_eof (default nil) is returned.
+
+
+(read ['p_port ['g_eof]])
+
+     RETURNS: the next lisp expression read from the given or default port.
+              On end of file, g_eof (default nil) is returned.
+
+
+(readc ['p_port ['g_eof]])
+
+     RETURNS: the next character read from the given or default  port.   On
+              end of file, g_eof (default nil) is returned.
+
+
+(readlist 'l_arg)
+
+     RETURNS: the lisp expression read  from  the  list  of  characters  in
+              l_arg.
+
+
+(resetio)
+
+     RETURNS: nil
+
+     SIDE EFFECT: all ports except the standard input, output and error are
+                  closed.
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Input/Output                                                            5-8
+
+
+(setsyntax 's_symbol 'sx_code ['ls_func])
+
+     RETURNS: t
+
+     SIDE EFFECT: this sets the code for s_symbol to sx_code in the current
+                  readtable.   If sx_code is _\bm_\ba_\bc_\br_\bo or _\bs_\bp_\bl_\bi_\bc_\bi_\bn_\bg then ls_func
+                  is the associated function.  See section 7 on the  reader
+                  for more details.
+
+
+(terpr ['p_port])
+
+     RETURNS: nil
+
+     SIDE EFFECT: a terminate line  character sequence is sent to the given
+                  port  or  the  default  port.   This  will also flush the
+                  buffer.
+
+
+(terpri ['p_port])
+
+     EQUIVALENT TO: terpr.
+
+
+(tyi ['p_port])
+
+     RETURNS: the fixnum representation of the next character read.  On end
+              of file, -1 is returned.
+
+
+(tyipeek ['p_port])
+
+     RETURNS: the fixnum representation of the next character to be read.
+
+     NOTE: This does not actually read the character, it just peeks at it.
+
+
+(tyo 'x_char ['p_port])
+
+     RETURNS: x_char.
+
+     SIDE EFFECT: the fixnum representation  of  a  character,  x_code,  is
+                  printed  as  a  character on the given output port or the
+                  default output port.
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Input/Output                                                            5-9
+
+
+(zapline)
+
+     RETURNS: nil
+
+     SIDE EFFECT: all characters up to and including the  line  termination
+                  character  are read and discarded from the last port used
+                  for input.
+
+     NOTE: this is used as the macro function for the  semicolon  character
+           when it acts as a comment character.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch6.r b/usr/lib/lisp/manual/ch6.r
new file mode 100644 (file)
index 0000000..40bf9f0
--- /dev/null
@@ -0,0 +1,715 @@
+
+
+
+
+
+
+
+                                CHAPTER  6
+
+
+                             System Functions
+
+
+
+This chapter describes the functions which one uses to interact with  FRANZ
+LISP running in the UNIX environment.
+
+
+(allocate 's_type 'x_pages)
+
+     WHERE:   s_type is one of the FRANZ LISP data types described in 1.3.
+
+     RETURNS: x_pages.
+
+     SIDE EFFECT: FRANZ LISP attempts to allocate x_pages of  type  s_type.
+                  It  allocates  pages  one  at  a time so that if an error
+                  occurs this means that all free storage  has  been  allo-
+                  cated.  The storage that is allocated is not given to the
+                  caller, instead it is added to the free storage  list  of
+                  s_type.  The functions _\bs_\be_\bg_\bm_\be_\bn_\bt and _\bs_\bm_\ba_\bl_\bl-_\bs_\be_\bg_\bm_\be_\bn_\bt allocate
+                  blocks  of storage and return it to the caller.
+
+
+(argv 'x_argnumb)
+
+     RETURNS: a symbol whose pname is the x_argnumb_\bt_\bh argument (starting at
+              0) on the command line which invoked the current lisp.
+
+     NOTE: if x_argnumb is less that zero, a  fixnum  whose  value  is  the
+           number  of  arguments on the command line is returned.  (_\ba_\br_\bg_\bv _\b0)
+           returns the name of the lisp you are running.
+
+
+(baktrace)
+
+     RETURNS: nil
+
+     SIDE EFFECT: the lisp runtime stack is examined and the name of (most)
+                  of the functions currently in execution are printed, most
+                  active first.
+
+     NOTE: this will occasionally miss the names of compiled lisp functions
+           due  to incomplete information on the stack.  If you are tracing
+           compiled code, then _\bb_\ba_\bk_\bt_\br_\ba_\bc_\be won't  be  able  to  interpret  the
+           stack unless (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk _\bn_\bi_\bl) was done.  See the function
+           _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk for another way of printing the lisp runtime stack.
+
+
+
+\e9
+
+\e9System Functions                                                        6-1
+
+
+
+
+
+
+
+System Functions                                                        6-2
+
+
+(boundp 's_name)
+
+     RETURNS: nil  if s_name is unbound, that is it has never  be  given  a
+              value.   If x_name has the value g_val, then (nil . g_val) is
+              returned.
+
+
+(chdir 's_path)
+
+     RETURNS: t iff the system call succeeds.
+
+     SIDE EFFECT: the current directory set to s_path. Among other  things,
+                  this   will   affect   the  default  location  where  the
+                  input/output functions look for and create files.
+
+     NOTE: _\bc_\bh_\bd_\bi_\br follows the standard UNIX conventions, if s_path does  not
+           begin  with  a slash, the default path is changed to the current
+           path with s_path appended.
+
+
+(dumplisp s_name)
+
+     RETURNS: nil
+
+     SIDE EFFECT: the current lisp is dumped to the disk with the file name
+                  s_name.   When  s_name is executed, you will be in a lisp
+                  in the same state as when the dumplisp was done.
+
+     NOTE: dumplisp will fail if  one tries to write over the current  run-
+           ning  file.  UNIX  does not allow you to modify the file you are
+           running.
+
+
+(eval-when l_time g_exp1 ...)
+
+     SIDE EFFECT: l_time may contain any combination of the  symbols  _\bl_\bo_\ba_\bd,
+                  _\be_\bv_\ba_\bl,  and _\bc_\bo_\bm_\bp_\bi_\bl_\be.  The effects of load and compile will
+                  is discussed in the section on the compiler.  If eval  is
+                  present  however,  this simply means that the expressions
+                  g_exp1 and so on are evaluated from left  to  right.   If
+                  eval is not present, the forms are not evaluated.
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                        6-3
+
+
+(exit ['x_code])
+
+     RETURNS: nothing (it never returns).
+
+     SIDE EFFECT: the lisp system dies with exit code x_code or 0 if x_code
+                  is not specified.
+
+
+(fake 'x_addr)
+
+     RETURNS: the lisp object at address x_addr.
+
+     NOTE: This is intended to be used by people debugging the lisp system.
+
+
+(gc)
+
+     RETURNS: nil
+
+     SIDE EFFECT: this causes a garbage collection.
+
+     NOTE: garbage collection occurs automatically whenever  internal  free
+           lists are exhausted.
+
+
+(gcafter s_type)
+
+     WHERE:   s_type is one of the FRANZ LISP data types listed in 1.3.
+
+     NOTE: this function is called by the garbage collector after a garbage
+           collection  which was caused by running out of data type s_type.
+           This function should determine if more space need  be  allocated
+           and  if so should allocate it.  There is a default gcafter func-
+           tion but users who want control over space allocation can define
+           their own -- but note that it must be an nlambda.
+
+
+(getenv 's_name)
+
+     RETURNS: a symbol whose pname is the value of s_name  in  the  current
+              UNIX  environment.   If  s_name  doesn't exist in the current
+              environment, a symbol with a null pname is returned.
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                        6-4
+
+
+(hashtabstat)
+
+     RETURNS: a list of fixnums representing the number of symbols in  each
+              bucket of the oblist.
+
+     NOTE: the oblist is stored a hash table  of  buckets.   Ideally  there
+           would be the same number of symbols in each bucket.
+
+
+(include s_filename)
+
+     RETURNS: nil
+
+     SIDE EFFECT: The given filename is _\bl_\bo_\ba_\bded into the lisp.
+
+     NOTE: this is similar to load except the argument  is  not  evaluated.
+           Include means something special to the compiler.
+
+
+(includef 's_filename)
+
+     RETURNS: nil
+
+     SIDE EFFECT: this is the  same  as  _\bi_\bn_\bc_\bl_\bu_\bd_\be  except  the  argument  is
+                  evaluated.
+
+
+(maknum 'g_arg)
+
+     RETURNS: the address of its argument converted into a fixnum.
+
+
+(opval 's_arg ['g_newval])
+
+     RETURNS: the value associated with s_arg before the call.
+
+     SIDE EFFECT: If g_newval is specified, the value associated with s_arg
+                  is changed to g_newval.
+
+     NOTE: _\bo_\bp_\bv_\ba_\bl keeps track of storage allocation. If s_arg is one of  the
+           data  types  then  _\bo_\bp_\bv_\ba_\bl  will  return  a  list of three fixnums
+           representing the number of items of that type in use, the number
+           of  pages  allocated  and  the  number of items of that type per
+           page. You should never try to change the value _\bo_\bp_\bv_\ba_\bl  associates
+           with a data type using _\bo_\bp_\bv_\ba_\bl.
+           If s_arg is  _\bp_\ba_\bg_\be_\bl_\bi_\bm_\bi_\bt  then  _\bo_\bp_\bv_\ba_\bl  will  return  (and  set  if
+           g_newval is given) the maximum amount of lisp data pages it will
+           allocate.  This limit should remain small unless you  know  your
+           program requires lots of space as this limit will catch programs
+           in infinite loops which gobble up memory.
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                        6-5
+
+
+(process s_pgrm [s_frompipe s_topipe])
+
+     RETURNS: if the optional arguments are not present a fixnum  which  is
+              the  exit  code  when s_prgm dies.  If the optional arguments
+              are present, it returns a fixnum which is the process  id  of
+              the child.
+
+     SIDE EFFECT: If s_frompipe and s_topipe are given, they are  bound  to
+                  ports  which are pipes which direct characters from FRANZ
+                  LISP to the new process and to FRANZ LISP  from  the  new
+                  process  respectively.  this forks a process named s_prgm
+                  and waits for it to die iff there are no  pipe  arguments
+                  given.
+
+
+(ptime)
+
+     RETURNS: a list of two elements, the first is the amount of  processor
+              time used by the lisp system so far, the second is the amount
+              of time used by the garbage collector so far.
+
+     NOTE: the first number includes the second number.  The amount of time
+           used  by garbage collection is not recorded until the first call
+           to ptime.  This is done to prevent overhead when the user is not
+           interested garbage collection times.
+
+
+(reset)
+
+     SIDE EFFECT: the lisp runtime stack is cleared and the system restarts
+                  at the top level by executing a (_\bf_\bu_\bn_\bc_\ba_\bl_\bl _\bt_\bo_\bp-_\bl_\be_\bv_\be_\bl _\bn_\bi_\bl).
+
+
+(retbrk ['x_level])
+
+     WHERE:   x_level is a small integer of either sign.
+
+     SIDE EFFECT: The default error handler keeps a notion of  the  current
+                  level  of the error caught.  If x_level is negative, con-
+                  trol is thrown to this default error handler whose  level
+                  is  that  many  less than the present, or to _\bt_\bo_\bp-_\bl_\be_\bv_\be_\bl if
+                  there aren't enough.  If x_level is non-negative, control
+                  is  passed  to  the handler at that level.  If x_level is
+                  not present, the value -1 is taken by default.
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                        6-6
+
+
+(segment 's_type 'x_size)
+
+     WHERE:   s_type is one of the data types given in 1.3
+
+     RETURNS: a segment of contiguous lispvals of type s_type.
+
+     NOTE: In reality, _\bs_\be_\bg_\bm_\be_\bn_\bt returns a new data cell of type  s_type  and
+           allocates  space  for  x_size  -  1 more s_type's beyond the one
+           returned.  _\bS_\be_\bg_\bm_\be_\bn_\bt always allocates new space and does so in 512
+           byte  chunks.   If  you ask for 2 fixnums, segment will actually
+           allocate 128 of them thus wasting  126  fixnums.   The  function
+           _\bs_\bm_\ba_\bl_\bl-_\bs_\be_\bg_\bm_\be_\bn_\bt  is  a  smarter space allocator and should be used
+           whenever possible.
+
+
+(shell)
+
+     RETURNS: the exit code of the shell when it dies.
+
+     SIDE EFFECT: this forks a new shell and returns when the shell dies.
+
+
+(showstack)
+
+     RETURNS: nil
+
+     SIDE EFFECT: all forms currently in evaluation are printed,  beginning
+                  with  the  most  recent.  For compiled code the most that
+                  showstack will show is the function name and it  may  not
+                  show all of them.
+
+
+(signal 'x_signum 's_name)
+
+     RETURNS: nil if no previous call to signal has been made, or the  pre-
+              viously installed s_name.
+
+     SIDE EFFECT: this declares that the function named s_name will  handle
+                  the signal number x_signum.  If s_name is nil, the signal
+                  is ignored.  Presently only four UNIX signals are caught,
+                  they and their numbers are: Interrupt(2), Floating excep-
+                  tion(8), Alarm(14), and Hang-up(1).
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                        6-7
+
+
+(sizeof 'g_arg)
+
+     RETURNS: the number of bytes required to  store  one  object  of  type
+              g_arg, encoded as a fixnum.
+
+
+(small-segment 's_type 'x_cells)
+
+     WHERE:   s_type is one of fixnum, flonum and value.
+
+     RETURNS: a segment of x_cells data objects of type s_type.
+
+     SIDE EFFECT: This may call _\bs_\be_\bg_\bm_\be_\bn_\bt to allocate new space or it may  be
+                  able  to  fill  the  request on a page already allocated.
+                  The value returned by _\bs_\bm_\ba_\bl_\bl-_\bs_\be_\bg_\bm_\be_\bn_\bt is usually stored  in
+                  the data subpart of an array object.
+
+
+(sstatus g_type g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: If g_type  is  not  one  of  the  special  sstatus  codes
+                  described in the next few pages this simply sets g_val as
+                  the value of status type g_type in the system status pro-
+                  perty list.
+
+
+(sstatus appendmap g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: If g_val is non nil then when _\bf_\ba_\bs_\bl is told  to  create  a
+                  load  map,  it  will append to the file name given in the
+                  _\bf_\ba_\bs_\bl command, rather than creating a new map file.
+
+
+(sstatus automatic-reset g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: If g_val is non nil then when an error  occurs  which  no
+                  one  wants  to  handle,  a  _\br_\be_\bs_\be_\bt will be done instead of
+                  entering a primitive internal break loop.
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                        6-8
+
+
+(sstatus chainatom g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: If g_val is non nil and a _\bc_\ba_\br or _\bc_\bd_\br of a symbol is done,
+                  then  nil will be returned instead of an error being sig-
+                  naled.  This only affects the interpreter, not  the  com-
+                  piler.
+
+
+(sstatus dumpcore g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: If g_val is nil, FRANZ LISP tells UNIX that  a  segmenta-
+                  tion violation or bus error should cause a core dump.  If
+                  g_val is non nil then FRANZ LISP will catch those  errors
+                  and print a message advising the user to reset.
+
+     NOTE: The  default  value  for  this  flag  is  nil,  and  only  those
+           knowledgeable  of the innards of the lisp system should ever set
+           this flag non nil.
+
+
+(sstatus dumpmode x_val)
+
+     RETURNS: x_val
+
+     SIDE EFFECT: All subsequent _\bd_\bu_\bm_\bp_\bl_\bi_\bs_\bp's will be  done  in  mode  x_val.
+                  x_val may be either 413 or 410 (decimal).
+
+     NOTE: the advantage of mode 413 is that the dumped Lisp can be  demand
+           paged in when first started, which will make it start faster and
+           disrupt other users less.
+
+
+(sstatus feature g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: g_val is added to the (_\bs_\bt_\ba_\bt_\bu_\bs _\bf_\be_\ba_\bt_\bu_\br_\be_\bs) list,
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                        6-9
+
+
+(sstatus ignoreeof g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: If g_val is non nil then if a end  of  file  (CNTL  D  on
+                  UNIX)  is  typed  to the top level interpreter it will be
+                  ignored rather then cause the lisp system  to  exit.   If
+                  the  the  standard input is  a file or pipe then this has
+                  no effect, a EOF will always cause lisp to exit.
+
+
+(sstatus nofeature g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: g_val is removed from the status features list if it  was
+                  present.
+
+
+(sstatus translink g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: If g_val is  nil then all transfer tables are cleared and
+                  further  calls  through the transfer table will not cause
+                  the fast links to be set up.  If g_val is the  symbol  _\bo_\bn
+                  then  all  possible transfer table entries will be linked
+                  and the flag will be set to cause fast links to be set up
+                  dynamically.   Otherwise  all  that is done is to set the
+                  flag to cause fast links to be set up dynamically.
+
+     NOTE: For a discussion of transfer tables, see the Section on the com-
+           piler.
+
+
+(sstatus uctolc g_val)
+
+     RETURNS: g_val
+
+     SIDE EFFECT: If g_val is not nil then all unescaped capital letters in
+                  symbols  read  by  the  reader will be converted to lower
+                  case.
+
+     NOTE: This allows FRANZ LISP to be compatible with  single  case  lisp
+           systems (e.g. MAClisp).
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                       6-10
+
+
+(status g_code)
+
+     RETURNS: the value associated with the status code g_code if g_code is
+              not one of the special cases given below
+
+
+(status ctime)
+
+     RETURNS: a symbol whose print name is the current time and date.
+
+     EXAMPLE: (_\bs_\bt_\ba_\bt_\bu_\bs _\bc_\bt_\bi_\bm_\be) ==> |Sun Jun 29 16:51:26 1980|
+
+
+(status feature g_val)
+
+     RETURNS: t iff g_val is in the status features list.
+
+
+(status features)
+
+     RETURNS: the value of the features code, which is a list  of  features
+              which  are present in this system.  You add to this list with
+              (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bf_\be_\ba_\bt_\bu_\br_\be '_\bg__\bv_\ba_\bl)  and  test  if  feature  g_feat   is
+              present with (_\bs_\bt_\ba_\bt_\bu_\bs _\bf_\be_\ba_\bt_\bu_\br_\be '_\bg__\bf_\be_\ba_\bt).
+
+
+(status isatty)
+
+     RETURNS: t iff the standard input is a terminal.
+
+
+(status localtime)
+
+     RETURNS: a list of fixnums representing the current time as  described
+              in the UNIX manual under LOCALTIME(3).
+
+     EXAMPLE: (_\bs_\bt_\ba_\bt_\bu_\bs _\bl_\bo_\bc_\ba_\bl_\bt_\bi_\bm_\be) ==>  (20 51 16 29 5 80 0 1 nil)
+
+
+(status syntax s_char)
+
+     RETURNS: a fixnum which is the syntax code associated with the charac-
+              ter s_char in the current readtable.
+
+     NOTE: You cannot set the syntax code  with  with  (_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bs_\by_\bn_\bt_\ba_\bx _\bc_\bh),
+           you must use _\bs_\be_\bt_\bs_\by_\bn_\bt_\ba_\bx.
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+System Functions                                                       6-11
+
+
+(status undeffunc)
+
+     RETURNS: a list of all functions which transfer table entries point to
+              but which are not defined at this point.
+
+     NOTE: Some of the undefined functions listed  could  be  arrays  which
+           have yet to be created.
+
+
+(status version)
+
+     RETURNS: a string which is the current lisp version name.
+
+     EXAMPLE: (_\bs_\bt_\ba_\bt_\bu_\bs _\bv_\be_\br_\bs_\bi_\bo_\bn) ==> "Franz Lisp, Opus 33b"
+
+
+(syscall 'x_index ['xst_arg1 ...])
+
+     RETURNS: the result of issuing the UNIX  system  call  number  x_index
+              with arguments xst_arg_\bi.
+
+     NOTE: The UNIX system calls are described in section  2  of  the  UNIX
+           manual.  If xst_arg_\bi is a fixnum, then its value is passed as an
+           argument, if it is a symbol then its pname is passed and finally
+           if  it  is a string then the string itself is passed as an argu-
+           ment.  Some useful syscalls are:
+           (_\bs_\by_\bs_\bc_\ba_\bl_\bl _\b2_\b0) returns process id.
+           (_\bs_\by_\bs_\bc_\ba_\bl_\bl _\b1_\b3) returns the number of seconds since Jan 1, 1970.
+           (_\bs_\by_\bs_\bc_\ba_\bl_\bl _\b1_\b0 '_\bf_\bo_\bo) will unlink (delete) the file foo.
+
+
+(top-level)
+
+     RETURNS: nothing (it never returns)
+
+     NOTE: This function is the top-level read-eval-print loop.   It  never
+           returns any value.  Its main utility is that if you redefine it,
+           and do a (reset) then the redefined (top-level) is then invoked.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch7.r b/usr/lib/lisp/manual/ch7.r
new file mode 100644 (file)
index 0000000..f15bb94
--- /dev/null
@@ -0,0 +1,223 @@
+
+
+
+
+
+
+
+                                CHAPTER  7
+
+
+                                The Reader
+
+
+
+
+     The FRANZ LISP reader is controlled by a _\br_\be_\ba_\bd_\bt_\ba_\bb_\bl_\be.  A readtable is an
+array of fixnums, one fixnum for each of the 128 ascii characters. The fix-
+nums tell the reader what the properties of the each  character  are.   The
+initial  readtable  is described below.  The user may create new readtables
+using the _\bm_\ba_\bk_\be_\br_\be_\ba_\bd_\bt_\ba_\bb_\bl_\be function.  The current readtable is  the  value  of
+the  lisp symbol _\br_\be_\ba_\bd_\bt_\ba_\bb_\bl_\be which, like any lisp symbol, may be lambda bound
+to allow the user to change the reader syntax  very  quickly.   The  values
+which may appear in the readtable are:
+
+\e8 _________________________________________________________________________
+    type     value (decimal)           meaning                default
+\e8 _________________________________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b_________________________________________________________________________
+   vnum              0                  digit                   0-9
+\e8 _________________________________________________________________________
+   vsign             1              plus or minus               + -
+\e8 _________________________________________________________________________
+   vchar             2           alphabetic character
+\e7                                                          A-Z a-z ^H !  $
+                                                          % & * , / : ; <
+                                                          = > ? @ ^ _ ` {
+                                                          | } ~
+\e8 _________________________________________________________________________
+   vsca             66             single char atom            none
+\e8 _________________________________________________________________________
+   vlpara          195                left paren                 (
+\e8 _________________________________________________________________________
+   vrpara          196               right paren                 )
+\e8 _________________________________________________________________________
+   vperd           197                  period                   .
+\e8 _________________________________________________________________________
+   vlbrkt          198               left bracket                [
+\e8 _________________________________________________________________________
+   vrbrkt          199              right bracket                ]
+\e8 _________________________________________________________________________
+   veof            200               end of file              rubout
+\e8 _________________________________________________________________________
+   vsq             201               single quote                '
+\e8 _________________________________________________________________________
+   vdq             138                                           |
+\e7                               double quote, all  char-
+                               acters  between matching
+                               double  quotes  are  es-
+                               caped  (i.e.  treated as
+                               vchar)
+\e8 _________________________________________________________________________
+   vsd             137                                           "
+\e7                               string  delimiter,   all
+                               characters       between
+                               matching delimiters  are
+                               _\bc_\bo_\bn_\bc_\ba_\bted  into an object
+                               of type string
+\e8 _________________________________________________________________________
+
+
+
+
+
+\e9The Reader                                                              7-1
+
+
+
+
+
+
+
+The Reader                                                              7-2
+
+
+   verr            203            illegal character
+\e7                                                          null ^A-^I  ^N-
+                                                          ^Z ^\-^_
+\e8 _________________________________________________________________________
+   vsep            204                separator           ^I-^M esc space
+\e8 _________________________________________________________________________
+   vspl            205         splicing macro character        none
+\e8 _________________________________________________________________________
+   vmac            206             macro character             none
+\e8 _________________________________________________________________________
+   vesc            143             escape character              \
+\e8 _________________________________________________________________________
+\e7
+|\b
+|\b
+|\b
+|\b
+|\b
+|\b
+|\b
+|\b
+|
+\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e9\e9          |\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|
+\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e9\e9                            |\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|
+\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e9\e9                                                       |\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|
+\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e9\e9                                                                         |\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|
+\e7\e7\e7\e7\e7\e7\e7\e7
+     The names in the type column are not known to Franz, we are just using
+them  to  tag  the  various  classes.  You must use the value in the second
+column.  The default column shows the syntax values of  characters  in  the
+raw  lisp,  i.e.,  the lisp which contains only machine language functions.
+The lisp which you get when you give the lisp command to the  shell  is  an
+augmented version of the raw lisp, with additional lisp coded functions and
+changes in the readtable.  The syntax changes in the lisp may  differ  from
+installation to installation but will probably include making one character
+be a comment character.  In the lisp at Berkeley, semicolon is the  comment
+character.  This was done  by declaring it to be a splicing macro character
+which invokes the function _\bz_\ba_\bp_\bl_\bi_\bn_\be when seen.
+
+     To read the syntax of a character, you may use (status syntax s_char).
+
+     To change the syntax bits of a character, use the _\bs_\be_\bt_\bs_\by_\bn_\bt_\ba_\bx  function.
+There  are two forms, one when you just want to change the syntax bits, and
+the other when you want to define a character macro.  The first form is:
+
+                        (setsyntax  _\b'_\bs_\b__\bc  _\b'_\bx_\b__\bv_\ba_\bl_\bu_\be)
+
+Here _\bs__\bc may be the character itself or it may be the fixnum representation
+of  that character.  _\bx__\bv_\ba_\bl_\bu_\be is one of the values given above in the second
+column.  You should be careful when you change the syntax of a character as
+the  change  lasts  until  you explicitly change it back or until you begin
+with a new lisp.  Also, some syntax changes are  silly  and  will  probably
+cause system errors (e.g. changing the syntax of an alphabetic character to
+be a _\bv_\bn_\bu_\bm ).  The only syntax values you will probably ever  use  are:  _\bv_\bd_\bq
+and _\bv_\be_\bs_\bc.  You should not change the syntax to _\bv_\bs_\bp_\bl or _\bv_\bm_\ba_\bc using the above
+form, instead it will be done automatically when you use the form below.
+
+     To declare a character macro use:
+
+                    (setsyntax  _\b'_\bs_\b__\bc  _\b'_\bs_\b__\bt_\by_\bp_\be  _\b'_\bs_\b__\bf_\bc_\bn)
+
+Where _\bs__\bc is again either the character itself or  its  fixnum  equivalent,
+type  is  _\bs_\bp_\bl_\bi_\bc_\bi_\bn_\bg  or  _\bm_\ba_\bc_\br_\bo,  and  _\bs__\bf_\bc_\bn is either the name of a function
+expecting no arguments or is a lambda expression.  The result of  the  set-
+syntax  function  is  twofold:  the  readtable  value for that character is
+changed to _\bv_\bs_\bp_\bl or _\bv_\bm_\ba_\bc, and the function is put on the  property  list  of
+the character under the indicator "macro".  The difference between a splic-
+ing macro and a macro is this: the value returned by a  splicing  macro  is
+_\bn_\bc_\bo_\bn_\bced  to  what  has  been read so far (i.e. (nconc sofar justreturned)),
+
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+The Reader                                                              7-3
+
+
+while the value returned by a macro is added to what has  been  read,  (i.e
+(nconc sofar (list  justread)).  Thus if a splicing macro returns nil, then
+it isn't seen since (nconc any nil) ==> any.  In particular, splicing  mac-
+ros are useful for conditional loading of lisp expressions.
+
+     FRANZ LISP treats left and right square brackets in a special way when
+building  lists.   A  left  bracket  is just like a left parenthesis, and a
+right bracket matches a left bracket or all open left  parentheses,  which-
+ever comes first.
+
+     When building atoms, a character with the syntax code _\bv_\be_\bs_\bc will  cause
+the  next  character  to  be  read in and treated as a _\bv_\bc_\bh_\ba_\br.  To escape an
+entire string of characters, you surround  them  with  matching  characters
+having  the _\bv_\bd_\bq syntax code.  To escape the _\bv_\bd_\bq character within the string
+of characters you use any character  of  class  _\bv_\be_\bs_\bc.   The  standard  UNIX
+escape character, backslash (`\'), is in this class by default.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch8.r b/usr/lib/lisp/manual/ch8.r
new file mode 100644 (file)
index 0000000..c91cc97
--- /dev/null
@@ -0,0 +1,601 @@
+
+
+
+
+
+
+
+                                CHAPTER  8
+
+
+                           Functions and Macros
+
+
+
+
+
+
+
+   _\b8._\b1.  _\bv_\ba_\bl_\bi_\bd _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn _\bo_\bb_\bj_\be_\bc_\bt_\bs
+
+           There are many different objects which can occupy  the  function
+      field  of a symbol object.  The following table shows all of the pos-
+      sibilities, how to recognize them and where to  look  for  documenta-
+      tion.
+
+
+
+\e8          _____________________________________________________________
+            informal name           object type         documentation
+\e8          _____________________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b_____________________________________________________________
+             interpreted           list with _\bc_\ba_\br             8.2
+           lambda function         _\be_\bq to lambda
+\e8          _____________________________________________________________
+             interpreted           list with _\bc_\ba_\br             8.2
+           nlambda function        _\be_\bq to nlambda
+\e8          _____________________________________________________________
+             interpreted           list with _\bc_\ba_\br             8.2
+            lexpr function          _\be_\bq to lexpr
+\e8          _____________________________________________________________
+             interpreted           list with _\bc_\ba_\br             8.3
+                macro               _\be_\bq to macro
+\e8          _____________________________________________________________
+               compiled       binary with discipline         8.2
+           lambda or lexpr         _\be_\bq to lambda
+               function
+\e8          _____________________________________________________________
+               compiled       binary with discipline         8.2
+           nlambda function        _\be_\bq to nlambda
+\e8          _____________________________________________________________
+               compiled       binary with discipline         8.3
+                macro               _\be_\bq to macro
+\e8          _____________________________________________________________
+               foreign        binary with discipline         8.4
+              subroutine         of "subroutine"[]
+\e8          _____________________________________________________________
+               foreign        binary with discipline         8.4
+               function           of "function"[]
+\e8          _____________________________________________________________
+               foreign        binary with discipline         8.4
+           integer function   of "integer-function"[]
+\e8          _____________________________________________________________
+               foreign        binary with discipline         8.4
+            real function      of "real-function"[]
+\e8          _____________________________________________________________
+                array              array object               9
+
+
+
+\e9Functions and Macros                                                    8-1
+
+
+
+
+
+
+
+Functions and Macros                                                    8-2
+
+
+\e8          _____________________________________________________________
+\e7\e9\e9         |\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|
+\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e9\e9                           |\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|
+\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e9\e9                                                     |\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|
+\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e9\e9                                                                      |\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|\b\e9\e9|
+\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7\e7
+
+
+
+   _\b8._\b2.  _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs   The basic lisp function is the lambda function.   When
+      a  lambda function is called, the actual arguments are evaluated from
+      left to right and are lambda-bound to the formal  parameters  of  the
+      lambda function.
+
+           An nlambda function is usually  used  for  functions  which  are
+      invoked  by  the  user  at  top level.  Some built-in functions which
+      evaluate their arguments in special ways are also nlambdas (e.g _\bc_\bo_\bn_\bd,
+      _\bd_\bo, _\bo_\br).  When an nlambda function is called, the list of unevaluated
+      arguments is lambda bound to  the  single  formal  parameter  of  the
+      nlambda function.
+
+           Some programmers will use an nlambda function when they are  not
+      sure  how  many  arguments  will be passed.  Then the first thing the
+      nlambda function does is map _\be_\bv_\ba_\bl over the list of unevaluated  argu-
+      ments  it  has been passed.  This is usually the wrong thing to do as
+      it won't work compiled if any of the arguments are  local  variables.
+      The solution is to use a lexpr.  When a lexpr function is called, the
+      arguments are evaluated and the number of arguments  is  lambda-bound
+      to the single formal parameter of the lexpr function.  The lexpr then
+      accesses the arguments using the _\ba_\br_\bg function.
+
+           When a function is compiled _\bs_\bp_\be_\bc_\bi_\ba_\bl declaration may be needed to
+      preserve  its  behavior.  An argument is not lambda-bound to the name
+      of the corresponding formal parameter unless  that  formal  parameter
+      has been declared _\bs_\bp_\be_\bc_\bi_\ba_\bl (see 12.3.2.2).  Lambda and lexpr functions
+      both compile into a binary object with a discipline of lambda.   How-
+      ever, a compiled lexpr still acts like an interpreted lexpr.
+
+
+
+
+   _\b8._\b3.  _\bm_\ba_\bc_\br_\bo_\bs   An important features of Lisp is its ability  to  manipu-
+      late  programs  as  data.  As a result of this, most Lisp implementa-
+      tions have very powerful macro facilities.  The Lisp language's macro
+      facility  can  be  used  to incorporate popular features of the other
+      languages into Lisp.  For example, there  are  macro  packages  which
+      allow  one  to  create  records (ala Pascal) and refer to elements of
+      those records by the key names.[] Another  popular use for macros  is
+      to create more readable control structures which expand into _\bc_\bo_\bn_\bd, _\bo_\br
+____________________
+\e9   []Only the first character of the string is significant (i.e "s"  is  ok
+for "subroutine")
+   []A record definition macro package especially suited for FRANZ LISP  is
+in  the planning stages at Berkeley.  At this time the Maclisp _\bs_\bt_\br_\bu_\bc_\bt pack-
+age can be used.
+
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Functions and Macros                                                    8-3
+
+
+      and _\ba_\bn_\bd.  One such example is the If macro in the jkfmacs.l  package.
+      It allows you to write
+
+      (_\bI_\bf (_\be_\bq_\bu_\ba_\bl _\bn_\bu_\bm_\bb _\b0) _\bt_\bh_\be_\bn (_\bp_\br_\bi_\bn_\bt '_\bz_\be_\br_\bo) (_\bt_\be_\br_\bp_\br)
+       _\be_\bl_\bs_\be_\bi_\bf (_\be_\bq_\bu_\ba_\bl _\bn_\bu_\bm_\bb _\b1) _\bt_\bh_\be_\bn (_\bp_\br_\bi_\bn_\bt '_\bo_\bn_\be) (_\bt_\be_\br_\bp_\br)
+       _\be_\bl_\bs_\be (_\bp_\br_\bi_\bn_\bt '|_\bI _\bg_\bi_\bv_\be _\bu_\bp|))
+
+      which expands to
+
+      (_\bc_\bo_\bn_\bd
+          ((_\be_\bq_\bu_\ba_\bl _\bn_\bu_\bm_\bb _\b0) (_\bp_\br_\bi_\bn_\bt '_\bz_\be_\br_\bo) (_\bt_\be_\br_\bp_\br))
+          ((_\be_\bq_\bu_\ba_\bl _\bn_\bu_\bm_\bb _\b1) (_\bp_\br_\bi_\bn_\bt '_\bo_\bn_\be) (_\bt_\be_\br_\bp_\br))
+          (_\bt (_\bp_\br_\bi_\bn_\bt '|_\bI _\bg_\bi_\bv_\be _\bu_\bp|)))
+
+
+
+
+
+      _\b8._\b3._\b1.  _\bm_\ba_\bc_\br_\bo _\bf_\bo_\br_\bm_\bs   A macro is a  function  which  accepts  a  Lisp
+         expression  as  input  and  returns  another Lisp expression.  The
+         action the macro takes is called macro expansion.  Here is a  sim-
+         ple example:
+
+         -> (_\bd_\be_\bf _\bf_\bi_\br_\bs_\bt (_\bm_\ba_\bc_\br_\bo (_\bx) (_\bc_\bo_\bn_\bs '_\bc_\ba_\br (_\bc_\bd_\br _\bx))))
+         first
+         -> (_\bf_\bi_\br_\bs_\bt '(_\ba _\bb _\bc))
+         a
+         -> (_\ba_\bp_\bp_\bl_\by '_\bf_\bi_\br_\bs_\bt '(_\bf_\bi_\br_\bs_\bt '(_\ba _\bb _\bc)))
+         (car '(a b c))
+
+         The first input line defines a macro called  _\bf_\bi_\br_\bs_\bt.   Notice  that
+         the  macro  has one formal parameter, _\bx. On the second input line,
+         we ask the interpreter to evaluate  (_\bf_\bi_\br_\bs_\bt '(_\ba _\bb _\bc)).   _\bE_\bv_\ba_\bl  sees
+         that  _\bf_\bi_\br_\bs_\bt  has a function definition of type macro  so it evalu-
+         ates _\bf_\bi_\br_\bs_\bt's definition passing to _\bf_\bi_\br_\bs_\bt as an argument, the  form
+         _\be_\bv_\ba_\bl  itself  was trying to evaluate, (_\bf_\bi_\br_\bs_\bt '(_\ba _\bb _\bc)).  The _\bf_\bi_\br_\bs_\bt
+         macro chops off the car of the argument with _\bc_\bd_\br, cons' a  _\bc_\ba_\br  at
+         the  beginning  of  the list and returns (_\bc_\ba_\br '(_\ba _\bb _\bc)).  Now _\be_\bv_\ba_\bl
+         evaluates that, and the value is _\ba which is returned as the  value
+         of  (_\bf_\bi_\br_\bs_\bt '(_\ba _\bb _\bc)).  Thus whenever _\be_\bv_\ba_\bl tries to evaluate a list
+         whose car has a macro definition it ends up doing (at  least)  two
+         operations,  one is a call to the macro to let it macro expand the
+         form, and the other is the evaluation of the result of the  macro.
+         The  result  of  the  macro may be yet another call to a macro, so
+         _\be_\bv_\ba_\bl may have to do even more evaluations  until  it  can  finally
+         determine the  value of an expression.  One way to see how a macro
+         will expand is to use _\ba_\bp_\bp_\bl_\by as  shown  on  the  third  input  line
+         above.
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Functions and Macros                                                    8-4
+
+
+      _\b8._\b3._\b2.  _\bd_\be_\bf_\bm_\ba_\bc_\br_\bo   The macro _\bd_\be_\bf_\bm_\ba_\bc_\br_\bo makes it easier to define  mac-
+         ros because it allows you to name the arguments to the macro call.
+         For example, suppose we find ourselves  often  writing  code  like
+         (_\bs_\be_\bt_\bq _\bs_\bt_\ba_\bc_\bk (_\bc_\bo_\bn_\bs _\bn_\be_\bw_\be_\bl_\bt _\bs_\bt_\ba_\bc_\bk).   We  could  define a macro named
+         _\bp_\bu_\bs_\bh to do this for us.  One way to define it is:
+
+         -> (_\bd_\be_\bf _\bp_\bu_\bs_\bh (_\bm_\ba_\bc_\br_\bo (_\bx) (_\bl_\bi_\bs_\bt '_\bs_\be_\bt_\bq (_\bc_\ba_\bd_\bd_\br _\bx) (_\bl_\bi_\bs_\bt '_\bc_\bo_\bn_\bs (_\bc_\ba_\bd_\br _\bx) (_\bc_\ba_\bd_\bd_\br _\bx)))))
+         push
+
+         then (_\bp_\bu_\bs_\bh _\bn_\be_\bw_\be_\bl_\bt _\bs_\bt_\ba_\bc_\bk) will expand to the form mentioned  above.
+         The same macro written using defmacro would be:
+
+         -> (_\bd_\be_\bf_\bm_\ba_\bc_\br_\bo _\bp_\bu_\bs_\bh (_\bv_\ba_\bl_\bu_\be _\bs_\bt_\ba_\bc_\bk) (_\bl_\bi_\bs_\bt '_\bs_\be_\bt_\bq _\bs_\bt_\ba_\bc_\bk (_\bl_\bi_\bs_\bt '_\bc_\bo_\bn_\bs _\bv_\ba_\bl_\bu_\be _\bs_\bt_\ba_\bc_\bk))
+         push
+
+         Defmacro allows you to name the arguments of the macro  call,  and
+         makes the macro definition look more like a function definition.
+
+
+
+
+      _\b8._\b3._\b3.  _\bt_\bh_\be _\bb_\ba_\bc_\bk_\bq_\bu_\bo_\bt_\be _\bc_\bh_\ba_\br_\ba_\bc_\bt_\be_\br _\bm_\ba_\bc_\br_\bo   The default syntax for  FRANZ
+         LISP  has  only three characters with associated character macros.
+         One is semicolon for comments.  The other two  are  backquote  and
+         comma  which  are  used  by  the  backquote  character macro.  The
+         backquote macro is used to create lists where many of the elements
+         are  fixed  (quoted). This makes it very useful for creating macro
+         definitions.  In the simplest case, a backquote acts just  like  a
+         single quote:
+
+         ->`(_\ba _\bb _\bc _\bd _\be)
+         (a b c d e)
+
+         If a comma precedes an element of a backquoted list then that ele-
+         ment is evaluated and its value is put in the list.
+
+         ->(_\bs_\be_\bt_\bq _\bd '(_\bx _\by _\bz))
+         (x y z)
+         ->`(_\ba _\bb _\bc ,_\bd _\be)
+         (a b c (x y z) e)
+
+         If a comma followed by  an  at  sign  precedes  an  element  in  a
+         backquoted  list,  then that element is evaluated and spliced into
+         the list with _\ba_\bp_\bp_\be_\bn_\bd.
+
+         ->`(_\ba _\bb _\bc ,@_\bd _\be)
+         (a b c x y z e)
+
+         Once a list begins with a backquote, the commas  may  appear  any-
+         where in the list as this example shows:
+
+         ->`(_\ba _\bb (_\bc _\bd ,(_\bc_\bd_\br _\bd)) (_\be _\bf (_\bg _\bh ,@(_\bc_\bd_\bd_\br _\bd) ,@_\bd)))
+         (a b (c d (y z)) (e f (g h z x y z)))
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Functions and Macros                                                    8-5
+
+
+         It is also possible and sometimes even useful to use the backquote
+         macro  within  itself.   As a final demonstration of the backquote
+         macro, we shall define the first and push  macros  using  all  the
+         power at our disposal, defmacro and the backquote macro.
+
+         ->(_\bd_\be_\bf_\bm_\ba_\bc_\br_\bo _\bf_\bi_\br_\bs_\bt (_\bl_\bi_\bs_\bt) `(_\bc_\ba_\br ,_\bl_\bi_\bs_\bt))
+         first
+         ->(_\bd_\be_\bf_\bm_\ba_\bc_\br_\bo _\bp_\bu_\bs_\bh (_\bv_\ba_\bl_\bu_\be _\bs_\bt_\ba_\bc_\bk) `(_\bs_\be_\bt_\bq ,_\bs_\bt_\ba_\bc_\bk (_\bc_\bo_\bn_\bs ,_\bv_\ba_\bl_\bu_\be ,_\bs_\bt_\ba_\bc_\bk)))
+         stack
+
+
+
+
+   _\b8._\b4.  _\bf_\bo_\br_\be_\bi_\bg_\bn _\bs_\bu_\bb_\br_\bo_\bu_\bt_\bi_\bn_\be_\bs _\ba_\bn_\bd _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs   FRANZ LISP has the ability  to
+      dynamically  load  object  files produced by other compilers and then
+      call functions defined in those files.  These  functions  are  called
+      _\bf_\bo_\br_\be_\bi_\bg_\bn  functions.   There  are  four types of foreign functions and
+      they are characterized by the type of result they return:
+
+      subroutine
+           This does not return anything. The lisp system always returns  t
+           after calling a subroutine.
+
+      function
+           This returns whatever the function  returns.   This  must  be  a
+           valid lisp object or it may cause the lisp system to fail.
+
+      integer-function
+           This returns an integer which the lisp system makes into a  fix-
+           num and returns.
+
+      real-function
+           This returns a double precision real number which the lisp  sys-
+           tem makes into a flonum and returns.
+
+      A foreign function is accessed through a binary object  just  like  a
+      compiled  lisp function.  The difference is that the discipline field
+      for a binary object of a foreign function is  a  string  whose  first
+      character  is s for a subroutine, f for a function, i for an integer-
+      function and r for a real-function.  Two functions are  provided  for
+      the setting up of foreign functions.  _\bC_\bf_\ba_\bs_\bl loads an object file into
+      the lisp system and sets up one foreign function binary  object.   If
+      there  is more than one function in an object file, _\bg_\be_\bt_\ba_\bd_\bd_\br_\be_\bs_\bs can be
+      used to set up further foreign function objects.
+
+           Foreign  functions are called just  like  other  functions,  e.g
+      (_\bf_\bu_\bn_\bn_\ba_\bm_\be _\ba_\br_\bg_\b1 _\ba_\br_\bg_\b2).  When one is called, the arguments are evaluated
+      and then examined.   List,  hunk  and  symbol  arguments  are  passed
+      unchanged  to  the foreign function.  Fixnum and flonum arguments are
+      copied into a temporary location and a pointer to the value is passed
+      (this  is  because Fortran uses call by reference and it is dangerous
+      to modify the contents of a fixnum or  flonum  which  something  else
+      might point to).  If an array object is an argument the data field of
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Functions and Macros                                                    8-6
+
+
+      the array  object is passed to the  foreign  function  (this  is  the
+      easiest  way  to  send  large  amounts  of  data to and receive large
+      amounts of data from a foreign function).  If a binary object  is  an
+      argument,  the  entry  field  of that object is passed to the foreign
+      function (the entry field is the  address  of  a  function,  so  this
+      amounts to passing a function as an argument).
+
+           The method a foreign function uses to access the arguments  pro-
+      vided  by  lisp is dependent on the language of the foreign function.
+      The following scripts demonstrate how  how  lisp  can  interact  with
+      three  languages:  C,  Pascal and Fortran.  C and Pascal have pointer
+      types and the first script shows  how  to  use  pointers  to  extract
+      information  from  lisp objects.  There are two functions defined for
+      each language.  The first (cfoo is C, pfoo in Pascal) is  given  four
+      arguments,  a  fixnum,  a  flonum-block array, a hunk of at least two
+      fixnums and a list of at least two fixnums.  To demonstrate that  the
+      values were passed, each ?foo function prints its arguments (or parts
+      of them).  The ?foo function then modifies the second element of  the
+      flonum-block  array  and  returns  a  3 to lisp.  The second function
+      (cmemq in C, pmemq in Pascal) acts just like the lisp  _\bm_\be_\bm_\bq  function
+      (except it won't work for fixnums whereas the lisp _\bm_\be_\bm_\bq will work for
+      small fixnums).  In the script, typed input is in _\bb_\bo_\bl_\bd, computer out-
+      put is in roman and comments are in _\bi_\bt_\ba_\bl_\bi_\bc.
+
+
+      _\bT_\bh_\be_\bs_\be _\ba_\br_\be _\bt_\bh_\be _\bC _\bc_\bo_\bd_\be_\bd _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs
+      % cat ch8auxc.c
+      /* demonstration of c coded foreign integer-function */
+
+      /* the following will be used to extract fixnums out of a list of fixnums */
+      struct listoffixnumscell
+      {    struct listoffixnumscell *cdr;
+           int *fixnum;
+      };
+
+      struct listcell
+      {       struct listcell *cdr;
+              int car;
+      };
+
+      cfoo(a,b,c,d)
+      int *a;
+      double b[];
+      int *c[];
+      struct listoffixnumscell *d;
+      {
+          printf("a: %d, b[0]: %f, b[1]: %f0, *a, b[0], b[1]);
+          printf(" c (first): %d   c (second): %d0,
+                     *c[0],*c[1]);
+          printf(" ( %d %d ... ) ", *(d->fixnum), *(d->cdr->fixnum));
+          b[1] = 3.1415926;
+          return(3);
+      }
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Functions and Macros                                                    8-7
+
+
+      struct listcell *
+      cmemq(element,list)
+      int element;
+      struct listcell *list;
+      {
+         for( ; list && element != list->car ;  list = list->cdr);
+         return(list);
+      }
+
+
+      _\bT_\bh_\be_\bs_\be _\ba_\br_\be _\bt_\bh_\be _\bP_\ba_\bs_\bc_\ba_\bl _\bc_\bo_\bd_\be_\bd _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs
+      % cat ch8auxp.p
+      type    pinteger = ^integer;
+              realarray = array[0..10] of real;
+              pintarray = array[0..10] of pinteger;
+              listoffixnumscell = record
+                                      cdr  : ^listoffixnumscell;
+                                      fixnum : pinteger;
+                                  end;
+              plistcell = ^listcell;
+              listcell = record
+                            cdr : plistcell;
+                            car : integer;
+                         end;
+
+      function pfoo ( var a : integer ;
+                      var b : realarray;
+                      var c : pintarray;
+                      var d : listoffixnumscell) : integer;
+      begin
+         writeln(' a:',a, ' b[0]:', b[0], ' b[1]:', b[1]);
+         writeln(' c (first):', c[0]^,' c (second):', c[1]^);
+         writeln(' ( ', d.fixnum^, d.cdr^.fixnum^, ' ...) ');
+         b[1] := 3.1415926;
+         pfoo := 3
+      end ;
+
+      { the function pmemq looks for the lisp pointer given as the first argument
+        in the list pointed to by the second argument.
+        Note that we declare " a : integer " instead of " var a : integer " since
+        we are interested in the pointer value instead of what it points to (which
+        could be any lisp object)
+      }
+      function pmemq( a : integer; list : plistcell) : plistcell;
+      begin
+       while (list <> nil) and (list^.car <> a) do list := list^.cdr;
+       pmemq := list;
+      end ;
+
+
+      _\bT_\bh_\be _\bf_\bi_\bl_\be_\bs _\ba_\br_\be _\bc_\bo_\bm_\bp_\bi_\bl_\be_\bd
+      % cc -c ch8auxc.c
+      1.0u 1.2s 0:15 14% 30+39k 33+20io 147pf+0w
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Functions and Macros                                                    8-8
+
+
+      % pc -c ch8auxp.p
+      3.0u 1.7s 0:37 12% 27+32k 53+32io 143pf+0w
+
+
+      % lisp
+      Franz Lisp, Opus 33b
+      _\bF_\bi_\br_\bs_\bt _\bt_\bh_\be _\bf_\bi_\bl_\be_\bs _\ba_\br_\be _\bl_\bo_\ba_\bd_\be_\bd _\ba_\bn_\bd _\bw_\be _\bs_\be_\bt _\bu_\bp _\bo_\bn_\be _\bf_\bo_\br_\be_\bi_\bg_\bn _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn _\bb_\bi_\bn_\ba_\br_\by.
+      _\bW_\be  _\bh_\ba_\bv_\be  _\bt_\bw_\bo  _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn_\bs  _\bi_\bn  _\be_\ba_\bc_\bh _\bf_\bi_\bl_\be _\bs_\bo _\bw_\be _\bm_\bu_\bs_\bt _\bc_\bh_\bo_\bo_\bs_\be _\bo_\bn_\be _\bt_\bo _\bt_\be_\bl_\bl
+      _\bc_\bf_\ba_\bs_\bl _\ba_\bb_\bo_\bu_\bt.  _\bT_\bh_\be _\bc_\bh_\bo_\bi_\bc_\be _\bi_\bs _\ba_\br_\bb_\bi_\bt_\br_\ba_\br_\by.
+      -> (cfasl 'ch8auxc.o '_cfoo 'cfoo "integer-function")
+      /usr/lib/lisp/nld -N -A /usr/local/lisp -T 63000 ch8auxc.o -e _cfoo -o /tmp/Li7055.0  -lc
+      #63000-"integer-function"
+      -> (cfasl 'ch8auxp.o '_pfoo 'pfoo "integer-function" "-lpc")
+      /usr/lib/lisp/nld -N -A /tmp/Li7055.0 -T 63200 ch8auxp.o -e _pfoo -o /tmp/Li7055.1 -lpc -lc
+      #63200-"integer-function"
+      _\bH_\be_\br_\be _\bw_\be _\bs_\be_\bt _\bu_\bp _\bt_\bh_\be _\bo_\bt_\bh_\be_\br _\bf_\bo_\br_\be_\bi_\bg_\bn _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn _\bb_\bi_\bn_\ba_\br_\by _\bo_\bb_\bj_\be_\bc_\bt_\bs
+      -> (getaddress '_cmemq 'cmemq "function" '_pmemq 'pmemq "function")
+      #6306c-"function"
+      _\bW_\be _\bw_\ba_\bn_\bt _\bt_\bo _\bc_\br_\be_\ba_\bt_\be _\ba_\bn_\bd _\bi_\bn_\bi_\bt_\bi_\ba_\bl_\bi_\bz_\be _\ba_\bn _\ba_\br_\br_\ba_\by _\bt_\bo _\bp_\ba_\bs_\bs _\bt_\bo _\bt_\bh_\be  _\bc_\bf_\bo_\bo  _\bf_\bu_\bn_\bc_\b-
+      _\bt_\bi_\bo_\bn.   _\bI_\bn  _\bt_\bh_\bi_\bs  _\bc_\ba_\bs_\be _\bw_\be _\bc_\br_\be_\ba_\bt_\be _\ba_\bn _\bu_\bn_\bn_\ba_\bm_\be_\bd _\ba_\br_\br_\ba_\by _\ba_\bn_\bd _\bs_\bt_\bo_\br_\be _\bi_\bt _\bi_\bn _\bt_\bh_\be
+      _\bv_\ba_\bl_\bu_\be _\bc_\be_\bl_\bl _\bo_\bf _\bt_\be_\bs_\bt_\ba_\br_\br. _\bW_\bh_\be_\bn _\bw_\be _\bc_\br_\be_\ba_\bt_\be _\ba_\bn _\ba_\br_\br_\ba_\by _\bt_\bo _\bp_\ba_\bs_\bs _\bt_\bo _\bt_\bh_\be  _\bP_\ba_\bs_\bc_\ba_\bl
+      _\bp_\br_\bo_\bg_\br_\ba_\bm  _\bw_\be _\bw_\bi_\bl_\bl _\bu_\bs_\be_\bd _\ba _\bn_\ba_\bm_\be_\bd _\ba_\br_\br_\ba_\by _\bj_\bu_\bs_\bt _\bt_\bo _\bd_\be_\bm_\bo_\bn_\bs_\bt_\br_\ba_\bt_\be _\bt_\bh_\be _\bd_\bi_\bf_\bf_\be_\br_\be_\bn_\bt
+      _\bw_\ba_\by _\bt_\bh_\ba_\bt _\bn_\ba_\bm_\be_\bd _\ba_\bn_\bd _\bu_\bn_\bn_\ba_\bm_\be_\bd _\ba_\br_\br_\ba_\by_\bs _\ba_\br_\be _\bc_\br_\be_\ba_\bt_\be_\bd _\ba_\bn_\bd _\ba_\bc_\bc_\be_\bs_\bs_\be_\bd.
+      -> (setq testarr (array nil flonum-block 2))
+      array[2]
+      -> (store (funcall testarr 0) 1.234)
+      1.234
+      -> (store (funcall testarr 1) 5.678)
+      5.678
+      -> (cfoo 385 testarr (hunk 10 11 13 14) '(15 16 17))
+      a: 385, b[0]: 1.234000, b[1]: 5.678000
+       c (first): 10   c (second): 11
+       ( 15 16 ... )
+       3
+      _\bN_\bo_\bt_\be _\bt_\bh_\ba_\bt _\bc_\bf_\bo_\bo _\bh_\ba_\bs _\br_\be_\bt_\bu_\br_\bn_\be_\bd _\b3 _\ba_\bs _\bi_\bt _\bs_\bh_\bo_\bu_\bl_\bd.  _\bI_\bt  _\ba_\bl_\bs_\bo  _\bh_\ba_\bd  _\bt_\bh_\be  _\bs_\bi_\bd_\be
+      _\be_\bf_\bf_\be_\bc_\bt  _\bo_\bf _\bc_\bh_\ba_\bn_\bg_\bi_\bn_\bg _\bt_\bh_\be _\bs_\be_\bc_\bo_\bn_\bd _\bv_\ba_\bl_\bu_\be _\bo_\bf _\bt_\bh_\be _\ba_\br_\br_\ba_\by _\bt_\bo _\b3._\b1_\b4_\b1_\b5_\b9_\b2_\b6  _\bw_\bh_\bi_\bc_\bh
+      _\bc_\bh_\be_\bc_\bk _\bn_\be_\bx_\bt.
+      -> (funcall testarr 1)
+      3.1415926
+
+
+      _\bI_\bn _\bp_\br_\be_\bp_\ba_\br_\ba_\bt_\bi_\bo_\bn _\bf_\bo_\br _\bc_\ba_\bl_\bl_\bi_\bn_\bg _\bp_\bf_\bo_\bo _\bw_\be _\bc_\br_\be_\ba_\bt_\be _\ba_\bn _\ba_\br_\br_\ba_\by.
+      -> (array test flonum-block 2)
+      array[2]
+      -> (store (test 0) 1.234)
+      1.234
+      -> (store (test 1) 5.678)
+      5.678
+      -> (pfoo 385 (getd 'test) (hunk 10 11 13 14) '(15 16 17))
+       a:       385 b[0]:  1.23400000000000E+00 b[1]:  5.67800000000000E+00
+       c (first):        10 c (second):        11
+       (         15        16 ...)
+      3
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Functions and Macros                                                    8-9
+
+
+      -> (test 1)
+      3.1415926
+
+       _\bN_\bo_\bw _\bt_\bo _\bt_\be_\bs_\bt _\bo_\bu_\bt _\bt_\bh_\be _\bm_\be_\bm_\bq'_\bs
+      -> (cmemq 'a '(b c a d e f))
+      (_\ba _\bd _\be _\bf)
+      -> (pmemq 'e '(a d f g a x))
+      _\bn_\bi_\bl
+
+           The Fortran example will be much shorter since  in  Fortran  you
+      can't  follow  pointers  as  you can in other languages.  The Fortran
+      function ffoo is given three  arguments:  a  fixnum,  a  fixnum-block
+      array  and  a flonum.  These arguments are printed out to verify that
+      they made it and then the first value of the array is modified.   The
+      function  returns  a  double  precision value which is converted to a
+      flonum by lisp and printed.  Note that the entry point  corresponding
+      to the Fortran function ffoo is _ffoo_ as opposed to the C and Pascal
+      convention of preceding the name with an underscore.
+
+
+      % cat ch8auxf.f
+              double precision function ffoo(a,b,c)
+              integer a,b(10)
+              double precision c
+              print 2,a,b(1),b(2),c
+      2       format(' a=',i4,', b(1)=',i5,', b(2)=',i5,' c=',f6.4)
+              b(1) = 22
+              ffoo = 1.23456
+              return
+              end
+      % f77 -c ch8auxf.f
+      ch8auxf.f:
+         ffoo:
+      0.9u 1.8s 0:12 22% 20+22k 54+48io 158pf+0w
+      % lisp
+      Franz Lisp, Opus 33b
+      -> (cfasl 'ch8auxf.o '_ffoo_ 'ffoo "real-function" "-lF77 -lI77")
+      /usr/lib/lisp/nld -N -A /usr/local/lisp -T 63000 ch8auxf.o -e _ffoo_
+      -o /tmp/Li11066.0 -lF77 -lI77 -lc
+      #6307c-"real-function"
+
+      -> (array test fixnum-block 2)
+      array[2]
+      -> (store (test 0) 10)
+      10
+      -> (store (test 1) 11)
+      11
+      -> (ffoo 385 (getd 'test) 5.678)
+       a= 385, b(1)=   10, b(2)=   11 c=5.6780
+      1.234559893608093
+      -> (test 0)
+      22
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/ch9.r b/usr/lib/lisp/manual/ch9.r
new file mode 100644 (file)
index 0000000..037efa1
--- /dev/null
@@ -0,0 +1,319 @@
+
+
+
+
+
+
+
+                                CHAPTER  9
+
+
+                                  Arrays
+
+
+
+
+     Arrays in FRANZ LISP provide  a  programmable  data  structure  access
+mechanism.   One possible use for FRANZ LISP arrays is to implement Maclisp
+style arrays which are  simple  vectors  of  fixnums,  flonums  or  general
+lispvalues.   This  is  described  in  more detail in 9.3 but first we will
+describe how array references are handled by the lisp system.
+
+     The structure of an array object is given in 1.3.9 and reproduced here
+for your convenience.
+
+
+\e8      _______________________________________________________________
+        Subpart name     Get value   Set value          Type
+
+\e8      _______________________________________________________________\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b_______________________________________________________________
+       access function   getaccess   putaccess      binary, list
+                                                      or symbol
+\e8      _______________________________________________________________
+          auxiliary       getaux      putaux           lispval
+\e8      _______________________________________________________________
+            data         arrayref     replace    block of contiguous
+                                        set            lispval
+\e8      _______________________________________________________________
+           length        getlength   putlength         fixnum
+\e8      _______________________________________________________________
+            delta        getdelta    putdelta          fixnum
+\e8      _______________________________________________________________
+\e7     |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+                      |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+                                  |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+                                              |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+                                                                    |\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|\b\e7|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+   _\b9._\b1.  _\bg_\be_\bn_\be_\br_\ba_\bl  _\ba_\br_\br_\ba_\by_\bs    Suppose  the  evaluator  is  told  to  evaluate
+      (_\bf_\bo_\bo _\ba _\bb)  and  the function cell of the symbol foo contains an array
+      object (which we will call foo_arr_obj).  First  the  evaluator  will
+      evaluate  and  stack  the  values of _\ba and _\bb.  Next it will stack the
+      array object foo_arr_obj.  Finally it will call the  access  function
+      of  foo_arr_obj.  The access function should be a lexpr[] or a symbol
+      whose function cell contains a lexpr.  The access function is respon-
+      sible  for  locating and returning a value from the array.  The array
+      access function is free to interpret the arguments as it wishes.  The
+      Maclisp  compatible  array  access  function which is provided in the
+      standard FRANZ LISP system interprets the arguments as subscripts  in
+      the same way as languages like Fortran and Pascal.
+\e9____________________
+\e9   []A lexpr is a function which accepts any number of arguments which  are
+evaluated before the function is called.
+
+
+
+\e9Arrays                                                                  9-1
+
+
+
+
+
+
+
+Arrays                                                                  9-2
+
+
+           The array access function will also be called up to  store  ele-
+      ments  in the array.  For example, (_\bs_\bt_\bo_\br_\be (_\bf_\bo_\bo _\ba _\bb) _\bc) will automati-
+      cally expand to (foo c a b) and  when  the  evaluator  is  called  to
+      evaluate  this,  it  will evaluate the arguments _\bc, _\bb and _\ba.  Then it
+      will stack the array object (which is stored in the function cell  of
+      foo)  and  call  the array access function with (now) four arguments.
+      The array access function must be able to tell this is a store opera-
+      tion  which  it  can  by checking the number of arguments it has been
+      given (a lexpr can do this very easily).
+
+
+
+
+   _\b9._\b2.  _\bs_\bu_\bb_\bp_\ba_\br_\bt_\bs _\bo_\bf _\ba_\bn _\ba_\br_\br_\ba_\by _\bo_\bb_\bj_\be_\bc_\bt   When an array is created a raw array
+      object  is allocated with _\bm_\ba_\br_\br_\ba_\by and the user is responsible for fil-
+      ling in the parts.  Certain lisp functions interpret  the  values  of
+      the  subparts of the array object in special ways as described in the
+      following text.  Placing illegal values in these subparts  may  cause
+      the lisp system to fail.
+
+
+
+
+      _\b9._\b2._\b1.  _\ba_\bc_\bc_\be_\bs_\bs _\bf_\bu_\bn_\bc_\bt_\bi_\bo_\bn   The function of  the  access  function  has
+         been  described above.  The contents of the access function should
+         be a lexpr, either a binary (compiled function) or a list  (inter-
+         preted  function).   It  may  also be a symbol whose function cell
+         contains a function definition.  This subpart  is  used  by  _\be_\bv_\ba_\bl,
+         _\bf_\bu_\bn_\bc_\ba_\bl_\bl, and _\ba_\bp_\bp_\bl_\by when evaluating array references.
+
+
+
+
+      _\b9._\b2._\b2.  _\ba_\bu_\bx_\bi_\bl_\bi_\ba_\br_\by   This can be used for any purpose. If it is a list
+         and  the  first  element of that list is the symbol unmarked_array
+         then the data subpart will not be marked by the garbage  collector
+         (this  is used in the Maclisp compatible array package and has the
+         potential for causing strange errors if used incorrectly).
+
+
+
+
+      _\b9._\b2._\b3.  _\bd_\ba_\bt_\ba   This is either nil or points to a block of data  space
+         allocated by _\bs_\be_\bg_\bm_\be_\bn_\bt or _\bs_\bm_\ba_\bl_\bl-_\bs_\be_\bg_\bm_\be_\bn_\bt.
+
+
+
+
+      _\b9._\b2._\b4.  _\bl_\be_\bn_\bg_\bt_\bh   This is a fixnum whose value is the number  of  ele-
+         ments  in  the  data block.  This is used by the garbage collector
+         and by _\ba_\br_\br_\ba_\by_\br_\be_\bf to determine if your index is in bounds.
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Arrays                                                                  9-3
+
+
+      _\b9._\b2._\b5.  _\bd_\be_\bl_\bt_\ba   This is a fixnum whose value is the number  of  bytes
+         in each element of the data block.  This will be four for an array
+         of fixnums or value cells, and eight  for  an  array  of  flonums.
+         This is used by the garbage collector and _\ba_\br_\br_\ba_\by_\br_\be_\bf as well.
+
+
+
+
+   _\b9._\b3.  _\bT_\bh_\be _\bM_\ba_\bc_\bl_\bi_\bs_\bp _\bc_\bo_\bm_\bp_\ba_\bt_\bi_\bb_\bl_\be _\ba_\br_\br_\ba_\by _\bp_\ba_\bc_\bk_\ba_\bg_\be
+
+           A Maclisp style array is similar to what are know as  arrays  in
+      other  languages:  a  block  of  homogeneous  data  elements which is
+      indexed by one or more integers called subscripts.  The data elements
+      can  be  all  fixnums,  flonums or general lisp objects.  An array is
+      created by a call to the function _\ba_\br_\br_\ba_\by or *array .  The only differ-
+      ence is that *_\ba_\br_\br_\ba_\by evaluates its arguments.  This call: (_\ba_\br_\br_\ba_\by _\bf_\bo_\bo _\bt
+      _\b3 _\b5) sets up an array called foo of dimensions  3  by  5.   The  sub-
+      scripts  are  zero based. The first element is (_\bf_\bo_\bo _\b0 _\b0), the next is
+      (_\bf_\bo_\bo _\b0 _\b1) and so on up to (_\bf_\bo_\bo _\b2 _\b4).  The t indicates a general  lisp
+      object  array  which means each element of foo can be any type.  Each
+      element can be any type since all that is stored in the  array  is  a
+      pointer  to a lisp object, not the object itself.  _\bA_\br_\br_\ba_\by does this by
+      allocating an array object with _\bm_\ba_\br_\br_\ba_\by and then allocating a  segment
+      of  15  consecutive  value  cells  with  _\bs_\bm_\ba_\bl_\bl-_\bs_\be_\bg_\bm_\be_\bn_\bt  and storing a
+      pointer to that segment in the data subpart of the array object.  The
+      length  and  delta subpart of the array object are filled in (with 15
+      and 4 respectively) and the access function subpart is set  to  point
+      to  the  appropriate  array access function.  In this case there is a
+      special access function for two dimensional value cell arrays  called
+      arrac-twoD,  and this access function is used.  The auxiliary subpart
+      is set to (t 3 5) which describes the type of array and the bounds of
+      the  subscripts.  Finally this array object is placed in the function
+      cell of the symbol foo.  Now when (_\bf_\bo_\bo _\b1 _\b3) is evaluated,  the  array
+      access  function  is invoked with three arguments: 1, 3 and the array
+      object.  From the auxiliary field of  the  array  object  it  gets  a
+      description  of  the particular array.  It then determines which ele-
+      ment (_\bf_\bo_\bo _\b1 _\b3) refers to  and uses arrayref to extract that  element.
+      Since  this  is  an  array of value cells, what arrayref returns is a
+      value cell whose value what we want, so we evaluate  the  value  cell
+      and return it as the value of (_\bf_\bo_\bo _\b1 _\b3).
+
+           In Maclisp the call (_\ba_\br_\br_\ba_\by _\bf_\bo_\bo _\bf_\bi_\bx_\bn_\bu_\bm _\b2_\b5) returns an array whose
+      data  object  is a block of 25 memory words.  When fixnums are stored
+      in this array, the actual numbers are be stored instead  of  pointers
+      to  the  numbers  as are done in general lisp object arrays.  This is
+      efficient under Maclisp but inefficient in  FRANZ  LISP  since  every
+      time  a  value was referenced from an array it had to be copied and a
+      pointer to the copy returned to prevent aliasing[].  Thus  t,  fixnum
+____________________
+\e9   []Aliasing is when two variables are share the  same  storage  location.
+For   example   if   the   copying   mentioned   weren't  done  then  after
+(_\bs_\be_\bt_\bq _\bx (_\bf_\bo_\bo _\b2)) was done, the value of x and (foo 2) would share the  same
+
+
+\e9                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+Arrays                                                                  9-4
+
+
+      and flonum arrays are all  implemented  in  the  same  manner.   This
+      should  not  affect  the compatibility of Maclisp and FRANZ LISP.  If
+      there is an application where  a  block  of  fixnums  or  flonums  is
+      required,  then  the exact same effect of fixnum and flonum arrays in
+      Maclisp can  be  achieved  by  using  fixnum-block  and  flonum-block
+      arrays.   Such arrays are required if you want to pass a large number
+      of arguments to a Fortran or C coded function and  then  get  answers
+      back.
+
+           The Maclisp compatible array package is just one example of  how
+      a general array scheme can be implemented.  Another type of array you
+      could implement would be hashed arrays.  The subscript could be  any-
+      thing,  not  just  a number.  The access function would hash the sub-
+      script and use the result to select an array element.  With the  gen-
+      erality  of  arrays  also comes extra cost; if you just want a simple
+      vector of (less than 128) general lisp objects you would be  wise  to
+      look into using hunks.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+____________________
+\e9location.   Then should the value of (foo 2) change, x's value would change
+as well.  This is considered dangerous and as a result pointers  are  never
+returned into the data space of arrays.
+
+
+
+\e9                                                  Printed: October 22, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/chb.r b/usr/lib/lisp/manual/chb.r
new file mode 100644 (file)
index 0000000..66aaa77
--- /dev/null
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+                                APPENDIX  B
+
+
+                              Special Symbols
+
+
+
+
+     The values of these symbols  have a predefined meaning.   Some  values
+are  counters while others are simply flags whose value the user can change
+to affect the operation of lisp system.  In all cases, only the value  cell
+of the symbol is important, the function cell is not.  The value of some of
+the symbols (like ER%misc) are functions - what  this  means  is  that  the
+value  cell  of those symbols either contains a lambda expression, a binary
+object, or symbol with a function binding.
+
+     The values of the special symbols are:
+
+$gccount$ - The number of garbage collections which have occurred.
+
+$gcprint - If bound to  a non nil value, then after each garbage collection
+     and subsequent storage allocation a summary of storage allocation will
+     be printed.
+
+ER%all - The function which is the error handler for all errors (see 10)
+
+ER%brk - The function which is the handler for the error  signal  generated
+     by the evaluation of the _\bb_\br_\be_\ba_\bk function (see 10).
+
+ER%err - The function which is the handler for the error  signal  generated
+     by the evaluation of the _\be_\br_\br function (see 10).
+
+ER%misc - The function which is the handler of the error  signal  generated
+     by one of the unclassified errors (see 10).  Most errors are unclassi-
+     fied at this point.
+
+ER%tpl - The function which is the handler to be called when an  error  has
+     occurred which has not been handled (see 10).
+
+ER%undef - The function which is the handler for the error signal generated
+     when a call to an undefined function is made.
+
+^w - When bound to a non nil value this will prevent output to the standard
+     output port (poport) from reaching the standard output (usually a ter-
+     minal).  Note that ^w is a two character symbol and should not be con-
+     fused with ^W which is how we would denote control-w.  The value of ^w
+     is checked when the standard output buffer  is  flushed  which  occurs
+     after  a _\bt_\be_\br_\bp_\br, _\bd_\br_\ba_\bi_\bn or when the buffer overflows.  This is most use-
+     ful in conjunction with ptport described below.  System error handlers
+     rebind  ^w  to nil when they are invoked to assure that error messages
+     are not lost.  (This was introduced for Maclisp compatibility).
+
+defmacro-for-compiling - The has an effect during compilation.  If  non-nil
+
+
+                                                                        B-1
+
+
+
+
+
+
+
+                                                                        B-2
+
+
+     it  causes  macros  defined by defmacro to be compiled and included in
+     the object file.
+
+environment - The UNIX environment in assoc list form.
+
+errlist - When a _\br_\be_\bs_\be_\bt is done, the value of errlist is saved away and con-
+     trol  is  thrown to the top level.  _\bE_\bv_\ba_\bl is then mapped over the saved
+     away value of this list.
+
+errport - This port is initially bound to the standard error file.
+
+ibase - This is the input radix used by the lisp reader.  It may be  either
+     eight  or  ten.  Numbers followed by a decimal point are assumed to be
+     decimal regardless of what ibase is.
+
+linel - The line length used by the pretty printer,  pp.   This  should  be
+     used by _\bp_\br_\bi_\bn_\bt but it is not at this time.
+
+nil - This symbol represents the null list and thus can be written ().  Its
+     value  is  always nil.  Any attempt to change the value will result in
+     an error.
+
+piport - Initially bound to the standard input (usually the  keyboard).   A
+     read with no arguments reads from piport.
+
+poport - Initially bound to the standard output (usually the terminal  con-
+     sole).   A  print with no second argument writes to poport.  See also:
+     ^w and ptport.
+
+ptport - Initially bound to nil.  If bound to a port, then all output  sent
+     to  the standard output will also be sent to this port as long as this
+     port is not also the standard output (as this  would  cause  a  loop).
+     Note  that ptport will not get a copy of whatever is sent to poport if
+     poport is not bound to the standard output.
+
+readtable - The value of this is the current readtable.  It is an array but
+     you  should  NOT  try to change the value of the elements of the array
+     using the array functions.  This is because the readtable is an  array
+     of bytes and the smallest unit the array functions work with is a full
+     word (4 bytes).  You can  use  _\bs_\be_\bt_\bs_\by_\bn_\bt_\ba_\bx  to  change  the  values  and
+     (_\bs_\bt_\ba_\bt_\bu_\bs _\bs_\by_\bn_\bt_\ba_\bx ...) to read the values.
+
+t - This symbol always has the value t.  It is possible to change the value
+     of  this symbol for short periods of time but you are strongly advised
+     against it.
+
+top-level - In a lisp system without /usr/lib/lisp/toplevel.l loaded, after
+     a  _\br_\be_\bs_\be_\bt  is done, the lisp system will _\bf_\bu_\bn_\bc_\ba_\bl_\bl the value of top-level
+     if it is non nil.  This provides a way for the user to  introduce  his
+     own  top  level interpreter.  When /usr/lib/lisp/toplevel.l is loaded,
+     it sets top-level to franz-top-level and changes the _\br_\be_\bs_\be_\bt function so
+     that  once  franz-top-level  starts, it cannot be replaced by changing
+     top-level.  Franz-top-level  does provide a way of  changing  the  top
+
+
+                                                  Printed: October 22, 1980
+
+
+
+
+
+
+
+                                                                        B-3
+
+
+     level however, and that is through user-top-level.
+
+user-top-level - If this is bound then after a _\br_\be_\bs_\be_\bt,  the  value  of  this
+     variable will be _\bf_\bu_\bn_\bc_\ba_\bl_\bled.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 22, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/chc.r b/usr/lib/lisp/manual/chc.r
new file mode 100644 (file)
index 0000000..1f2473a
--- /dev/null
@@ -0,0 +1,195 @@
+
+
+
+
+
+
+
+                                APPENDIX  C
+
+
+                              Short Subjects.
+
+
+
+
+
+                           The Garbage Collector
+
+     The garbage collector is invoked automatically whenever a  collectable
+data  type  runs  out.   All  data types are collectable except strings and
+atoms are not.  After a garbage collection  finishes,  the  collector  will
+call  the  function  _\bg_\bc_\ba_\bf_\bt_\be_\br which should be a lambda of one argument.  The
+argument passed to _\bg_\bc_\ba_\bf_\bt_\be_\br is the name of the data type which ran  out  and
+caused  the garbage collection.  It is _\bg_\bc_\ba_\bf_\bt_\be_\br's responsibility to allocate
+more pages of free space.  The default _\bg_\bc_\ba_\bf_\bt_\be_\br makes its decision based  on
+the  percentage  of  space  still  in use after the garbage collection.  If
+there is a large percentage of space still  in  use,  _\bg_\bc_\ba_\bf_\bt_\be_\br  allocates  a
+larger  amount  of  free  space than if only a small percentage of space is
+still in use.  The default _\bg_\bc_\ba_\bf_\bt_\be_\br will also print a summary of  the  space
+in  use  if  the variable $_\bg_\bc_\bp_\br_\bi_\bn_\bt is non nil.  The summary always includes
+the state of the list and fixnum space and will include another type if  it
+caused  the  garbage collection.  The type which caused the garbage collec-
+tion is preceded by an asterisk.
+
+
+
+
+                                 Debugging
+
+     There are two built-in functions to help you debug your programs: _\bb_\ba_\bk_\b-
+_\bt_\br_\ba_\bc_\be  and _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk.  When an error occurs (or when you type the interrupt
+character), you will be left at a break level with the state of the  compu-
+tation frozen in the stack.  At this point, calling  the function _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk
+will cause the contents of the lisp  evaluation  stack  to  be  printed  in
+reverse chronological order (most recent first).  When the programs you are
+running are interpreted or traced, the output of _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk can be very ver-
+bose.   The  function  _\bb_\ba_\bk_\bt_\br_\ba_\bc_\be  prints a summary of what _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk prints.
+That is, if showstack would print a list, _\bb_\ba_\bk_\bt_\br_\ba_\bc_\be  would  only  print  the
+first  element  of  the  list.   If  you are running compiled code with the
+(_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk) non nil, then fast links are being made.  In this  case,
+there  is  not  enough information on the stack for _\bs_\bh_\bo_\bw_\bs_\bt_\ba_\bc_\bk and _\bb_\ba_\bk_\bt_\br_\ba_\bc_\be.
+Thus,  if  you  are  debugging  compiled  code  you  should   probably   do
+(_\bs_\bs_\bt_\ba_\bt_\bu_\bs _\bt_\br_\ba_\bn_\bs_\bl_\bi_\bn_\bk _\bn_\bi_\bl).
+
+     If the contents of the stack don't tell you enough about your problem,
+the  next  thing  you  may  want to try is to run your program with certain
+functions traced.  You can direct the trace package to stop program  execu-
+tion  when  it  enters  a function, allowing you to examine the contents of
+variables or call other functions.  The trace package is documented in 11.
+\e9
+
+\e9                                                                        C-1
+
+
+
+
+
+
+
+                                                                        C-2
+
+
+     It is also possible to single step the evaluator and to look at  stack
+frames  within lisp.  The programs which take advantage of these things are
+in /usr/lib/lisp and are called step and fixit.  They are maintained by the
+people  at Carnegie-Mellon (currently Lars Ericson is in charge of the code
+there).  There are documentation files for these programs in  /usr/lib/lisp
+as well.  We run compiled lisp almost exclusively at Berkeley.  Sites which
+run a mostly interpreted code should examine these files.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
+
+
+
+
+                                                                        C-3
+
+
+                        The Interpreter's Top Level
+
+     The top level interpreter for Franz, named _\bf_\br_\ba_\bn_\bz-_\bt_\bo_\bp-_\bl_\be_\bv_\be_\bl is  defined
+in /usr/lib/lisp/toplevel.l It is given control when the lisp system starts
+up because the variable top-level is bound to the  symbol  _\bf_\br_\ba_\bn_\bz-_\bt_\bo_\bp-_\bl_\be_\bv_\be_\bl.
+The  first  action  _\bf_\br_\ba_\bn_\bz-_\bt_\bo_\bp-_\bl_\be_\bv_\be_\bl  takes  is to print out the name of the
+current version of the lisp system.  Then it loads the  file  .lisprc  from
+the  HOME  directory  of  the  person invoking the lisp system if that file
+exists.  The .lisprc file allows you to set up your own defaults,  read  in
+files, set up autoloading  or anything else you might want to do to person-
+alize the lisp system.  Next, the top level goes into  a  prompt-read-eval-
+print  loop.   Each  time  around  the  loop, before printing the prompt it
+checks if the variable user-top-level is bound.  If so, then the  value  of
+user-top-level  will  be  _\bf_\bu_\bn_\bc_\ba_\bl_\bled.   This provides a convenient way for a
+user to introduce his own top level (Liszt, the lisp compiler, is an  exam-
+ple  of  a  program which uses this).  If the user types a ^D (which is the
+end of file character), and  the standard input is not from a keyboard, the
+lisp  system  will  exit.   If  the standard input is a keyboard and if the
+value of (_\bs_\bt_\ba_\bt_\bu_\bs _\bi_\bg_\bn_\bo_\br_\be_\be_\bo_\bf) is nil, the lisp system will also exit.  Other-
+wise  the  end  of  file will be ignored.  When a _\br_\be_\bs_\be_\bt is done the current
+value of _\be_\br_\br_\bl_\bi_\bs_\bt is saved away and control is thrown back  up  to  the  top
+level where _\be_\bv_\ba_\bl is mapped over the saved value of _\be_\br_\br_\bl_\bi_\bs_\bt.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+\e9
+
+\e9                                                  Printed: October 21, 1980
+
+
+
diff --git a/usr/lib/lisp/manual/helpindex b/usr/lib/lisp/manual/helpindex
new file mode 100644 (file)
index 0000000..303a3ca
--- /dev/null
@@ -0,0 +1,278 @@
+(*array ch2.r)
+(aexplode ch2.r)
+(aexplodec ch2.r)
+(aexploden ch2.r)
+(alphalessp ch2.r)
+(append ch2.r)
+(append1 ch2.r)
+(array ch2.r)
+(arraycall ch2.r)
+(arraydims ch2.r)
+(arrayp ch2.r)
+(arrayref ch2.r)
+(ascii ch2.r)
+(assoc ch2.r)
+(assq ch2.r)
+(atom ch2.r)
+(bcdad ch2.r)
+(bcdp ch2.r)
+(bigp ch2.r)
+(c..r ch2.r)
+(concat ch2.r)
+(cons ch2.r)
+(copy ch2.r)
+(copysymbol ch2.r)
+(cpy1 ch2.r)
+(cxr ch2.r)
+(defprop ch2.r)
+(delete ch2.r)
+(delq ch2.r)
+(dtpr ch2.r)
+(eq ch2.r)
+(equal ch2.r)
+(explode ch2.r)
+(explodec ch2.r)
+(exploden ch2.r)
+(fillarray ch2.r)
+(gensym ch2.r)
+(get ch2.r)
+(get_pname ch2.r)
+(getaccess ch2.r)
+(getaddress ch2.r)
+(getaux ch2.r)
+(getchar ch2.r)
+(getcharn ch2.r)
+(getd ch2.r)
+(getdelta ch2.r)
+(getentry ch2.r)
+(getlength ch2.r)
+(hunk ch2.r)
+(hunksize ch2.r)
+(implode ch2.r)
+(intern ch2.r)
+(last ch2.r)
+(length ch2.r)
+(list ch2.r)
+(makhunk ch2.r)
+(*makhunk ch2.r)
+(maknam ch2.r)
+(makunbound ch2.r)
+(marray ch2.r)
+(member ch2.r)
+(memq ch2.r)
+(nconc ch2.r)
+(ncons ch2.r)
+(not ch2.r)
+(nreverse ch2.r)
+(nthelem ch2.r)
+(null ch2.r)
+(plist ch2.r)
+(ptr ch2.r)
+(putaccess ch2.r)
+(putaux ch2.r)
+(putdelta ch2.r)
+(putdisc ch2.r)
+(putlength ch2.r)
+(putprop ch2.r)
+(quote ch2.r)
+(rematom ch2.r)
+(remob ch2.r)
+(remprop ch2.r)
+(replace ch2.r)
+(reverse ch2.r)
+(rplaca ch2.r)
+(rplacd ch2.r)
+(rplacx ch2.r)
+(*rplacx ch2.r)
+(sassoc ch2.r)
+(sassq ch2.r)
+(set ch2.r)
+(setplist ch2.r)
+(setq ch2.r)
+(stringp ch2.r)
+(symbolp ch2.r)
+(type ch2.r)
+(typep ch2.r)
+(uconcat ch2.r)
+(valuep ch2.r)
+(abs ch3.r)
+(absval ch3.r)
+(add ch3.r)
+(add1 ch3.r)
+(acos ch3.r)
+(asin ch3.r)
+(atan ch3.r)
+(boole ch3.r)
+(cos ch3.r)
+(diff ch3.r)
+(difference ch3.r)
+(Divide ch3.r)
+(Emuldiv ch3.r)
+(exp ch3.r)
+(expt ch3.r)
+(fact ch3.r)
+(fix ch3.r)
+(fixp ch3.r)
+(float ch3.r)
+(floatp ch3.r)
+(greaterp ch3.r)
+(haipart ch3.r)
+(haulong ch3.r)
+(lessp ch3.r)
+(log ch3.r)
+(lsh ch3.r)
+(max ch3.r)
+(min ch3.r)
+(minus ch3.r)
+(minusp ch3.r)
+(mod ch3.r)
+(numberp ch3.r)
+(numbp ch3.r)
+(onep ch3.r)
+(plus ch3.r)
+(plusp ch3.r)
+(product ch3.r)
+(quotient ch3.r)
+(random ch3.r)
+(remainder ch3.r)
+(rot ch3.r)
+(sin ch3.r)
+(sqrt ch3.r)
+(sub1 ch3.r)
+(sum ch3.r)
+(times ch3.r)
+(zerop ch3.r)
+(1+ ch3.r)
+(1\(mi ch3.r)
+(\(pl ch3.r)
+(\(** ch3.r)
+(\(mi ch3.r)
+(/ ch3.r)
+(< ch3.r)
+(\(eq ch3.r)
+(> ch3.r)
+(and ch4.r)
+(apply ch4.r)
+(arg ch4.r)
+(break ch4.r)
+(*break ch4.r)
+(catch ch4.r)
+(*catch ch4.r)
+(comment ch4.r)
+(cond ch4.r)
+(declare ch4.r)
+(def ch4.r)
+(defun ch4.r)
+(do ch4.r)
+(do ch4.r)
+(err ch4.r)
+(error ch4.r)
+(errset ch4.r)
+(eval ch4.r)
+(eval-when ch4.r)
+(exec ch4.r)
+(exece ch4.r)
+(funcall ch4.r)
+(function ch4.r)
+(getdisc ch4.r)
+(go ch4.r)
+(map ch4.r)
+(mapc ch4.r)
+(mapcan ch4.r)
+(mapcar ch4.r)
+(mapcon ch4.r)
+(maplist ch4.r)
+(mfunction ch4.r)
+(oblist ch4.r)
+(or ch4.r)
+(prog ch4.r)
+(prog2 ch4.r)
+(progn ch4.r)
+(progv ch4.r)
+(putd ch4.r)
+(return ch4.r)
+(setarg ch4.r)
+(throw ch4.r)
+(*throw ch4.r)
+(cfasl ch5.r)
+(close ch5.r)
+(cprintf ch5.r)
+(drain ch5.r)
+(fasl ch5.r)
+(ffasl ch5.r)
+(flatc ch5.r)
+(flatsize ch5.r)
+(fseek ch5.r)
+(infile ch5.r)
+(load ch5.r)
+(makereadtable ch5.r)
+(nwritn ch5.r)
+(outfile ch5.r)
+(patom ch5.r)
+(pntlen ch5.r)
+(portp ch5.r)
+(pp ch5.r)
+(princ ch5.r)
+(print ch5.r)
+(probef ch5.r)
+(ratom ch5.r)
+(read ch5.r)
+(readc ch5.r)
+(readlist ch5.r)
+(resetio ch5.r)
+(setsyntax ch5.r)
+(terpr ch5.r)
+(terpri ch5.r)
+(tyi ch5.r)
+(tyipeek ch5.r)
+(tyo ch5.r)
+(zapline ch5.r)
+(allocate ch6.r)
+(argv ch6.r)
+(baktrace ch6.r)
+(boundp ch6.r)
+(chdir ch6.r)
+(dumplisp ch6.r)
+(eval-when ch6.r)
+(exit ch6.r)
+(fake ch6.r)
+(gc ch6.r)
+(gcafter ch6.r)
+(getenv ch6.r)
+(hashtabstat ch6.r)
+(include ch6.r)
+(includef ch6.r)
+(maknum ch6.r)
+(opval ch6.r)
+(process ch6.r)
+(ptime ch6.r)
+(reset ch6.r)
+(retbrk ch6.r)
+(segment ch6.r)
+(shell ch6.r)
+(showstack ch6.r)
+(signal ch6.r)
+(sizeof ch6.r)
+(small-segment ch6.r)
+(sstatus ch6.r)
+(sstatus appendmap ch6.r)
+(sstatus automatic-reset ch6.r)
+(sstatus chainatom ch6.r)
+(sstatus dumpcore ch6.r)
+(sstatus dumpmode ch6.r)
+(sstatus feature ch6.r)
+(sstatus ignoreeof ch6.r)
+(sstatus nofeature ch6.r)
+(sstatus translink ch6.r)
+(sstatus uctolc ch6.r)
+(status ch6.r)
+(status ctime ch6.r)
+(status feature ch6.r)
+(status features ch6.r)
+(status isatty ch6.r)
+(status localtime ch6.r)
+(status syntax ch6.r)
+(status undeffunc ch6.r)
+(status version ch6.r)
+(syscall ch6.r)
+(top-level ch6.r)