home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / s / siod-29.zip / SIOD-29.SHA / siod.doc < prev    next >
Text File  |  1993-01-09  |  22KB  |  633 lines

  1.  *                   COPYRIGHT (c) 1988-1992 BY                             *
  2.  *        PARADIGM ASSOCIATES INCORPORATED, CAMBRIDGE, MASSACHUSETTS.       *
  3.  *        See the source file SLIB.C for more information.                  *
  4.  
  5. Documentation for Release 2.9 21-MAR-92, George Carrette
  6.  
  7. [Release Notes:]
  8.  
  9. 1.4 This release is functionally the same as release 1.3 but has been
  10. remodularized in response to people who have been encorporating SIOD
  11. as an interpreted extension language in other systems.
  12.  
  13. 1.5 Added the -g flag to enable mark-and-sweep garbage collection.
  14.     The default is stop-and-copy.
  15.  
  16. 2.0 Set_Repl_Hooks, catch & throw. 
  17.  
  18. 2.1 Additions to SIOD.SCM: Backquote, cond.
  19.  
  20. 2.2 User Type extension. Read-Macros. (From C-programmer level).
  21.  
  22. 2.3 save-forms. load with argument t, comment character, faster intern.
  23.     -o flag gives obarray size. default 100.
  24.  
  25. 2.4 speed up arithmetic and the evaluator. fixes to siod.scm. no_interrupt
  26.     around calls to C I/O. gen_readr.
  27.  
  28. 2.5 numeric arrays in siod.c
  29.  
  30. 2.6 remodularize .h files, procedure prototypes. gc, eval, print hooks
  31.     now table-driven.
  32.  
  33. 2.7 hash tables, fasload.
  34.  
  35. 2.8 bug fixes.
  36.  
  37. 2.9 added trace.c, fseek, ftell, some fixes.
  38.  
  39. gjc@paradigm.com, gjc@mitech.com
  40. George Carrette
  41.  
  42.    
  43. Paradigm Associates Inc          Phone: 617-492-6079
  44. 29 Putnam Ave, Suite 6
  45. Cambridge, MA 02138
  46.  
  47. [Files:]
  48.  
  49.  siod.h    Declarations 
  50.  siodp.h   private declarations.
  51.  slib.c    scheme library.
  52.  sliba.c   array library.
  53.  siod.c    a main program.
  54.  trace.c   an optional trace package.
  55.  siod.scm  Some scheme code
  56.  pratt.scm A pratt-parser in scheme.
  57.  
  58.  
  59. [Motivation:]
  60.  
  61. The most obvious thing one should notice is that this lisp implementation 
  62. is extremely small. For example, the resulting binary executable file 
  63. on a VAX/VMS system with /notraceback/nodebug is 17 kilo-bytes.
  64.  
  65. Small enough to understand, the source file slib.c is 30 kilo-bytes.
  66.  
  67. Small enough to include in the smallest applications which require
  68. command interpreters or extension languages.
  69.  
  70. We also want to be able to run code from the book "Structure and
  71. Interpretation of Computer Programs." 
  72.  
  73. Techniques used will be familiar to most lisp implementors.  Having
  74. objects be all the same size, and having only two statically allocated
  75. spaces simplifies and speeds up both consing and gc considerably.  the
  76. MSUBR hack allows for a modular implementation of tail recursion,     
  77. an extension of the FSUBR that is, as far as I know, original.
  78. The optional mark and sweep garbage collector may be selected at runtime.
  79.  
  80. Error handling is rather crude. A topic taken with machine fault,
  81. exception handling, tracing, debugging, and state recovery which we
  82. could cover in detail, but is clearly beyond the scope of this
  83. implementation. Suffice it to say that if you have a good symbolic
  84. debugger you can set a break point at "err" and observe in detail all
  85. the arguments and local variables of the procedures in question, since
  86. there is no casting of data types. For example, if X is an offending
  87. or interesting object then examining X->type will give you the type,
  88. and X->storage_as.cons will show the car and the cdr.
  89.  
  90. [Invocation:]
  91.  
  92. siod [-hXXXXX] [-iXXXXX] [-gX] [-oXXXXX] [-nXXXXX] [-sXXXXX]
  93.  -h where XXXXX is an integer, to specify the heap size, in obj cells,
  94.  -i where XXXXX is a filename to load before going into the repl loop.
  95.  -g where X = 1 for stop-and-copy GC, X = 0 for mark-and-sweep.
  96.  -o where XXXXX is the size of the symbol hash table to use, default 100.
  97.  -n where XXXXX is the number of preconsed/interned non-negative numbers.
  98.  -s where XXXXX is the number of bytes of machine recursion stack.
  99.  
  100.   Example:
  101.    siod -isiod.scm -h100000
  102.  
  103. [Garbage Collection:]
  104.  
  105. There are two storage management techniques which may be chosen at runtime
  106. by specifying the -g argument flag. 
  107.  
  108.  -g1 (the default) is stop-and-copy. This is the simplest and most
  109.      portable implementation. GC is only done at toplevel.
  110.  -g0 is mark-and-sweep. GC is done at any time, required or requested.
  111.      However, the implementation is not as portable.
  112.  
  113. Discussion of stop-and-copy follows:
  114.  
  115. As one can see from the source, garbage collection is really quite an easy
  116. thing. The procedure gc_relocate is about 25 lines of code, and
  117. scan_newspace is about 15.
  118.  
  119. The real tricks in handling garbage collection are (in a copying gc):
  120.  (1) keeping track of locations containing objects
  121.  (2) parsing the heap (in the space scanning)
  122.  
  123. The procedure gc_protect is called once (e.g. at startup) on each
  124. "global" location which will contain a lisp object.
  125.  
  126. That leaves the stack. Now, if we had chosen not to use the argument
  127. and return-value passing mechanism provided by the C-language
  128. implementation, (also known as the "machine stack" and "machine
  129. procedure calling mechanism) this lisp would be larger, slower, and
  130. rather more difficult to read and understand. Furthermore it would be
  131. considerably more painful to *add* functionality in the way of SUBR's
  132. to the implementation.
  133.  
  134. Aside from writing a very machine and compiler specific assembling language
  135. routine for each C-language implementation, embodying assumptions about
  136. the placement choices for arguments and local values, etc, we
  137. are left with the following limitation: "YOU CAN GC ONLY AT TOP-LEVEL"
  138.  
  139. However, this fits in perfectly with the programming style imposed in
  140. many user interface implementations including the MIT X-Windows Toolkit.
  141. In the X Toolkit, a callback or work procedure is not supposed to spend
  142. much time implementing the action. Therefore it cannot have allocated
  143. much storage, and the callback trampoline mechanism can post a work
  144. procedure to call the garbage collector when needed.
  145.  
  146. Our simple object format makes parsing the heap rather trivial.
  147. In more complex situations one ends up requiring object headers or markers
  148. of some kind to keep track of the actual storage lengths of objects
  149. and what components of objects are lisp pointers.
  150.  
  151. Because of the usefulness of strings, they were added by default into
  152. SIOD 2.6. The implementation requires a hook that calls the C library
  153. memory free procedure when an object is in oldspace and never
  154. got relocated to newspace. Obviously this slows down the mark-and-sweep
  155. GC, and removes one of the usual advantages it has over mark-and-sweep.
  156.  
  157. Discussion of mark-and-sweep follows:
  158.  
  159. In a mark-and-sweep GC the objects are not relocated. Instead
  160. one only has to LOOK at objects which are referenced by the argument
  161. frames and local variables of the underlying (in this case C-coded)
  162. implementation procedures. If a pointer "LOOKS" like it is a valid
  163. lisp object (see the procedure mark_locations_array) then it may be marked,
  164. and the objects it points to may be marked, as being in-use storage which
  165. is not linked into the freelist in the gc_sweep phase.
  166.  
  167. Another advantage of the mark_and_sweep storage management technique is
  168. that only one heap is required.
  169.  
  170. This main disadvantages are:
  171. (1) start-up cost to initially link freelist.
  172.     (can be avoided by more general but slower NEWCELL code).
  173. (2) does not COMPACT or LOCALIZE the use of storage. This is poor engineering
  174.     practice in a virtual memory environment.
  175. (2) the entire heap must be looked at, not just the parts with useful storage.
  176.  
  177. In general, mark-and-sweep is slower in that it has to look at more
  178. memory locations for a given heap size, however the heap size can
  179. be smaller for a given problem being solved. More complex analysis
  180. is required when READ-ONLY, STATIC, storage spaces are considered.
  181. Additionally the most sophisticated stop-and-copy storage management
  182. techniques take into account considerations of object usage temporality.
  183.  
  184. The technique assumes that all machine registers the GC needs to
  185. look at will be saved by a setjmp call into the save_regs_gc_mark data.
  186.  
  187. [Compilation:]
  188.  
  189. This code (version 2.7) has been compiled and run under the following:
  190. - SUN-IV,      GCC (GNU C)
  191. - VAX/VMS,     VAXC
  192. - MacIntosh,   THINK C 5.0
  193.  
  194. Earlier versions were compiled and run on the AMIGA, Encore, and 4.3BSD.
  195. There are reports that the code will also compile and run under MS-DOS.
  196.  
  197. On all unix machines use (with floating-point flags as needed)
  198.   
  199.   %cc -O -c siod.c
  200.   %cc -O -c slib.c
  201.   %cc -O -c sliba.c
  202.   %cc -o siod siod.o slib.o sliba.o
  203.  
  204. If cc doesn't work, try gcc (GNU C, Free Software Foundation, Cambridge MA).
  205.  
  206. on VAX/VMS:
  207.  
  208.   $ cc siod
  209.   $ cc slib
  210.   $ cc sliba
  211.   $ link siod,slib,sliba,sys$input:/opt
  212.   sys$library:vaxcrtl/share
  213.   $ siod == "$" + F$ENV("DEFAULT") + "SIOD"
  214.  
  215. on AMIGA 500, ignore warning messages about return value mismatches,
  216.   %lc siod.c
  217.   %lc slib.c
  218.   %lc sliba.c
  219.   %blink lib:c.o,siod.o,slib.o,sliba.o to siod lib lib:lcm.lib,lib:lc.lib,lib:amiga.lib
  220.  
  221. in THINK C.
  222.   The siod project must include siod.c,slib.c,slib.c,sliba.c,siodm.c, ANSI.
  223.   The compilation option "require prototypes" should be used.
  224.  
  225. [System:]
  226.  
  227. The interrupts called SIGINT and SIGFPE by the C runtime system are
  228. handled by invoking the lisp error procedure. SIGINT is usually caused
  229. by the CONTROL-C character and SIGFPE by floating point overflow or underflow.
  230.  
  231. [Syntax:]
  232.  
  233. The only special characters are the parenthesis and single quote.
  234. Everything else, besides whitespace of course, will make up a regular token.
  235. These tokens are either symbols or numbers depending on what they look like.
  236. Dotted-list notation is not supported on input, only on output.
  237.  
  238. [Special forms:]
  239.  
  240. The CAR of a list is evaluated first, if the value is a SUBR of type 9 or 10
  241. then it is a special form.
  242.  
  243. (define symbol value) is presently like (set! symbol value).
  244.  
  245. (define (f . arglist) . body) ==> (define f (lambda arglist . body))
  246.  
  247. (lambda arglist . body) Returns a closure.
  248.  
  249. (if pred val1 val2) If pred evaluates to () then val2 is evaluated else val1.
  250.  
  251. (begin . body) Each form in body is evaluated with the result of the last
  252. returned.
  253.  
  254. (set! symbol value) Evaluates value and sets the local or global value of
  255. the symbol.
  256.  
  257. (or x1 x2 x3 ...) Returns the first Xn such that Xn evaluated non-().
  258.  
  259. (and x1 x2 x3 ...) Keeps evaluating Xj until one returns (), or Xn.
  260.  
  261. (quote form). Input syntax 'form, returns form without evaluation.
  262.  
  263. (let pairlist . body) Each element in pairlist is (variable value).
  264. Evaluates each value then sets of new bindings for each of the variables,
  265. then evaluates the body like the body of a progn. This is actually
  266. implemented as a macro turning into a let-internal form.
  267.  
  268. (the-environment) Returns the current lexical environment.
  269.  
  270. [Macro Special forms:]
  271.  
  272. If the CAR of a list evaluates to a symbol then the value of that symbol
  273. is called on a single argument, the original form. The result of this
  274. application is a new form which is recursively evaluated.
  275.  
  276. [Built-In functions:]
  277.  
  278. These are all SUBR's of type 4,5,6,7, taking from 0 to 3 arguments
  279. with extra arguments ignored, (not even evaluated!) and arguments not
  280. given defaulting to (). SUBR's of type 8 are lexprs, receiving a list
  281. of arguments. Order of evaluation of arguments will depend on the
  282. implementation choice of your system C compiler.
  283.  
  284. consp cons car cdr set-car! set-cdr!
  285.  
  286. number? + - * / < > eqv?
  287. The arithmetic functions all take two arguments.
  288.  
  289. eq?, pointer objective identity. (Use eqv? for numbers.)
  290.  
  291. symbolconc, takes symbols as arguments and appends them. 
  292.  
  293. symbol?
  294.  
  295. symbol-bound? takes an optional environment structure.
  296. symbol-value also takes optional env.
  297. set-symbol-value also takes optional env.
  298.  
  299. env-lookup takes a symbol and an environment structure. If it returns
  300. non-nil the CAR will be the value of the symbol.
  301.  
  302. assq
  303.  
  304. read,print
  305.  
  306. eval, takes a second argument, an environment.
  307.  
  308. copy-list. Copies the top level conses in a list.
  309.  
  310. oblist, returns a copy of the list of the symbols that have been interned.
  311.  
  312. gc-status, prints out the status of garbage collection services, the
  313. number of cells allocated and the number of cells free. If given
  314. a () argument turns gc services off, if non-() turns gc services on.
  315. In mark-and-sweep storage management mode the argument only turns on
  316. and off verbosity of GC messages.
  317.  
  318. gc, does a mark-and-sweep garbage collection. If called with argument nil
  319. does not print gc messages during the gc.
  320.  
  321. load, given a filename (which must be a symbol, there are no strings)
  322. will read/eval all the forms in that file. An optional second argument,
  323. if T causes returning of the forms in the file instead of evaluating them.
  324.  
  325. save-forms, given a filename and a list of forms, prints the forms to the
  326. file. 3rd argument is optional, 'a to open the file in append mode.
  327.  
  328. quit, will exit back to the operating system.
  329.  
  330. error, takes a symbol as its first argument, prints the pname of this
  331. as an error message. The second argument (optional) is an offensive
  332. object. The global variable errobj gets set to this object for later
  333. observation.
  334.  
  335. null?, not. are the same thing.
  336.  
  337. *catch tag exp, Sets up a dynamic catch frame using tag. Then evaluates exp.
  338.  
  339. *throw tag value, finds the nearest *catch with an EQ tag, and cause it to
  340. return value.
  341.  
  342. [Procedures in main program siod.c]
  343.  
  344. cfib is the same as standard-fib. You can time it and compare it with
  345. standard-fib to get an idea of the overhead of interpretation.
  346.  
  347. vms-debug invokes the VMS debugger. The one optional argument is
  348. a string of vms-debugger commands. To show the current call
  349. stack and then continue execution:
  350.  
  351.     (vms-debug "set module/all;show calls;go") 
  352.  
  353. Or, to single step and run at the same time:
  354.  
  355.     (vms-debug "for i=1 to 100 do (STEP);go")
  356.  
  357. Or, to set up a breakpoint on errors:
  358.  
  359.     (vms-debug "set module slib;set break err;go")
  360.  
  361.  
  362. [Utility procedures in siod.scm:]
  363.  
  364. Shows how to define macros.
  365.  
  366. cadr,caddr,cdddr,replace,list.
  367.  
  368. (defvar variable default-value)
  369.  
  370. And for us old maclisp hackers, setq and defun, and progn, etc.
  371.  
  372. call-with-current-continuation
  373.  
  374. Implemented in terms of *catch and *throw. So upward continuations
  375. are not allowed.
  376.  
  377. A simple backquote (quasi-quote) implementation.
  378.  
  379. cond, a macro.
  380.  
  381. append
  382.  
  383. nconc
  384.  
  385. [TRACE]
  386.  
  387. (trace procedure1 procedure2 ...)
  388. (untrace procedure1 procedure2 ...)
  389.  
  390. Note: * trace is an fsubr, and can be used on internal procedures too.
  391.       * only interpreted procedures (non-subrs) can be traced.
  392.  
  393. (define (f x)
  394.    (let ((g (lambda () ...)))
  395.      (trace g)
  396.      (g)))
  397.  
  398. [Advanced I/O]
  399.  
  400. Efficient binary I/O may be used to save non-cicular data structures.
  401. See siod.scm for definitions of fasload and fasdump.
  402.  
  403. (fopen filename mode) => file
  404. (fclose file)
  405. (getc file)
  406. (putc char file)
  407.  
  408. (fread size file) => string    ;; conses a new string.
  409. (fread string file) => length  ;; stores into existing string.
  410. (fwrite string file)
  411.  
  412. (fseek file offset direction)
  413. (ftell file) => offset
  414.  
  415. Note: By combining the use of fast-print and fast-read with and without
  416.       the use of tables, with clever use of ftell and fseek, it is possible
  417.       to implement an efficient database of lisp expressions.
  418.  
  419. (fast-read table) => expression
  420. (fast-print expression table)
  421.  
  422. A table is a list containing 3 elements: (<file> <hash-table> <index>)
  423. When doing fast-print the index and hash-table are updated as data
  424. is written to the file. If the index is () then symbol-printing is
  425. not optimized. fast-read uses just the <hash-table> as a way of
  426. looking up previously interned symbols that have been assigned
  427. an index.
  428.  
  429. [A streams implementation:]
  430.  
  431. The first thing we must do is decide how to represent a stream.
  432. There is only one reasonable data structure available to us, the list.
  433. So we might use (<stream-car> <cache-flag> <cdr-cache> <cdr-procedure>)
  434.  
  435. the-empty-stream is just ().
  436.  
  437. empty-stream?
  438.  
  439. head
  440.  
  441. tail
  442.  
  443. cons-stream is a special form. Wraps a lambda around the second argument.
  444.  
  445. *cons-stream is the low-level constructor used by cons-stream.
  446.  
  447. fasload, fasldump. Take the obvious arguments, and are implemented
  448. in terms of fast-read and fast-print.
  449.  
  450. compile-file. 
  451.  
  452. [Arrays:]
  453.  
  454. (cons-array size [type]) Where [type] is double, long, string, lisp or nil.
  455. (aref array index)
  456. (aset array index value) 
  457.  
  458. fasload and fasdump are effective ways of storing and restoring numeric
  459. array data.
  460.  
  461. [Benchmarks:]
  462.  
  463. A standard-fib procedure is included in siod.scm so that everyone will
  464. use the same definition in any reports of speed. Make sure the return
  465. result is correct. use command line argument of
  466.  %siod -h100000 -isiod.scm
  467.  
  468. (standard-fib 10) => 55 ; 795 cons work.
  469. (standard-fib 15) => 610 ; 8877 cons work.
  470. (standard-fib 20) => 6765 ; 98508 cons work.
  471.  
  472. [Porting:]
  473.  
  474. See the #ifdef definition of myruntime, which
  475. should be defined to return a double float, the number of cpu seconds
  476. used by the process so far. It uses the the tms_utime slot, and assumes
  477. a clock cycle of 1/60'th of a second.
  478.  
  479. If your system or C runtime needs to poll for the interrupt signal
  480. mechanism to work, then define INTERRUPT_CHECK to be something
  481. useful.
  482.  
  483. The STACK_LIMIT and STACK_CHECK macros may need to be conditionized.
  484. They currently assume stack growth downward in virtual address.
  485. The subr (%%stack-limit setting non-verbose) may be used to change the
  486. limits at runtime.
  487.  
  488. The stack and register marking code used in the mark-and-sweep GC
  489. is unlikely to work on machines that do not keep the procedure call
  490. stack in main memory at all times. It is assumed that setjmp saves
  491. all registers into the jmp_buff data structure.
  492.  
  493. If the stack is not always aligned (in LISP-PTR sense) then the 
  494. gc_mark_and_sweep procedure will not work properly. 
  495.  
  496. Example, assuming a byte addressed 32-bit pointer machine:
  497.  
  498. stack_start_ptr: [LISP-PTR(4)] 
  499.                  [LISP-PTR(4)]
  500.                  [RANDOM(4)]
  501.                  [RANDOM(2)]
  502.                  [LISP-PTR(4)]
  503.                  [LISP-PTR(4)]
  504.                  [RANDOM(2)]
  505.                  [LISP-PTR(4)]
  506.                  [LISP-PTR(4)]
  507. stack_end:       [LISP-PTR(4)]
  508.  
  509. As mark_locations goes from start to end it will get off proper alignment
  510. somewhere in the middle, and therefore the stack marking operation will
  511. not properly identify some valid lisp pointers.
  512.  
  513. Fortunately there is an easy fix to this. A more aggressive use of
  514. our mark_locations procedure will suffice.
  515.  
  516. For example, say that there might be 2-byte random objects inserted into
  517. the stack. Then use two calls to mark_locations:
  518.  
  519.  mark_locations(((char *)stack_start_ptr) + 0,((char *)&stack_end) + 0);
  520.  mark_locations(((char *)stack_start_ptr) + 2,((char *)&stack_end) + 2);
  521.  
  522. If we think there might be 1-byte random objects, then 4 calls are required:
  523.  
  524.  mark_locations(((char *)stack_start_ptr) + 0,((char *)&stack_end) + 0);
  525.  mark_locations(((char *)stack_start_ptr) + 1,((char *)&stack_end) + 1);
  526.  mark_locations(((char *)stack_start_ptr) + 2,((char *)&stack_end) + 2);
  527.  mark_locations(((char *)stack_start_ptr) + 3,((char *)&stack_end) + 3);
  528.  
  529.  
  530. [Interface to other programs:]
  531.  
  532. If your main program does not want to actually have a read/eval/print
  533. loop, and instead wants to do something else entirely, then use
  534. the routine set_repl_hooks to set up for procedures for:
  535.  
  536.  * putting the prompt "> " and other info strings to standard output.
  537.  
  538.  * reading (getting) an expression
  539.  
  540.  * evaluating an expression
  541.  
  542.  * printing an expression.
  543.  
  544. The routine get_eof_val may be called inside your reading procedure
  545. to return a value that will cause exit from the read/eval/print loop.
  546.  
  547. In order to call a single C function in the context of the repl loop,
  548. you can do the following:
  549.  
  550. int flag = 0;
  551.  
  552. void my_puts(st)
  553.  char *st;
  554. {}
  555.  
  556. LISP my_reader()
  557. {if (flag == 1)
  558.   return(get_eof_val());
  559.  flag == 1;
  560.  return(NIL);}
  561.  
  562. LISP my_eval(x)
  563.  LISP x;
  564. {call_my_c_function();
  565.  return(NIL);}
  566.  
  567. LISP my_print(x)
  568.  LISP x;
  569. {}
  570.  
  571. do_my_c_function()
  572. {set_repl_hooks(my_puts,my_read,my_eval,my_print);
  573.  repl_driver(1, /* or 0 if we do not want lisp's SIGINT handler */
  574.              0);}
  575.  
  576.  
  577. If you need a completely different read-eval-print-loop, for example
  578. one based in X-Window procedures such as XtAddInput, then you may want to
  579. have your own input-scanner and utilize a read-from-string kind of
  580. function.
  581.  
  582.  
  583. [User Type Extension:]
  584.  
  585. There are 5 user types currently available. tc_user_1 through tc_user_5.
  586. If you use them then you must at least tell the garbage collector about
  587. them. To do this you must have 4 functions,
  588.  * a user_relocate, takes a object and returns a new copy.
  589.  * a user_scan, takes an object and calls relocate on its subparts.
  590.  * a user_mark, takes an object and calls gc_mark on its subparts or
  591.                 it may return one of these to avoid stack growth.
  592.  * a user_free, takes an object to hack before it gets onto the freelist.
  593.  
  594. set_gc_hooks(type,
  595.              user_relocate_fcn,
  596.              user_scan_fcn,
  597.              user_mark_fcn,
  598.              user_free_fcn,
  599.              &kind_of_gc);
  600.  
  601. kind_of_gc should be a long. It will receive 0 for mark-and-sweep, 1 for
  602. stop-and-copy. Therefore set_gc_hooks should be called AFTER process_cla.
  603. You must specify a relocate function with stop-and-copy. The scan
  604. function may be NULL if your user types will not have lisp objects in them.
  605. Under mark-and-sweep the mark function is required but the free function
  606. may be NULL.
  607.  
  608. See SIOD.C for a very simple string-append implementation example.
  609.  
  610. You might also want to extend the printer. This is optional.
  611.  
  612. set_print_hooks(type,fcn);
  613.  
  614. The fcn receives the object which should be printed to its second
  615. argument, a FILE*.
  616.  
  617. The evaluator may also be extended, with the "application" of user defined
  618. types following in the manner of an MSUBR.
  619.  
  620. Lastly there is a simple read macro facility.
  621.  
  622. void set_read_hooks(char *all_set,char *end_set,
  623.             LISP (*fcn1)(),LISP (*fcn2)())
  624.  
  625. All_set is a string of all read macros. end_set are those
  626. that will end the current token.
  627.  
  628. The fcn1 will receive the character used to trigger
  629. it and the struct gen_readio * being read from. It should return a lisp object.
  630.  
  631. the fnc2 is optional, and is a user hook into the token => lisp object
  632. conversion.
  633.