UBC Theses and Dissertations

UBC Theses Logo

UBC Theses and Dissertations

A lisp interactive programming environment Hall, Wayne F. 1974

Your browser doesn't seem to have a PDF viewer, please download the PDF to view this item.

Item Metadata

Download

Media
831-UBC_1974_A6_7 H34.pdf [ 5.66MB ]
Metadata
JSON: 831-1.0051758.json
JSON-LD: 831-1.0051758-ld.json
RDF/XML (Pretty): 831-1.0051758-rdf.xml
RDF/JSON: 831-1.0051758-rdf.json
Turtle: 831-1.0051758-turtle.txt
N-Triples: 831-1.0051758-rdf-ntriples.txt
Original Record: 831-1.0051758-source.json
Full Text
831-1.0051758-fulltext.txt
Citation
831-1.0051758.ris

Full Text

A LISP INTERACTIVE PROGRAMMING ENVIRONMENT by Wayne F. H a l l B.Sc., U n i v e r s i t y of B r i t i s h Columbia, 1972 A THESIS SUBMITTED IN PARTIAL FULFILMENT OF THE REQUIREMENTS FOR THE DEGREE OF MASTER OF SCIENCE i n the Department of COMPUTER SCIENCE We accept t h i s t h e s i s as conforming to the r e q u i r e d standard. The U n i v e r s i t y of B r i t i s h Columbia A p r i l 1974 In presenting t h i s thesis i n p a r t i a l f u l f i l m e n t of the requirements for an advanced degree at the University of B r i t i s h Columbia, I agree that the Library s h a l l make i t f r e e l y available f o r reference and study. I further agree that permission fo r extensive copying of t h i s thesis for scholarly purposes may be granted by the Head of my Department or by h i s representatives. It i s understood that copying or publication of t h i s thesis for f i n a n c i a l gain s h a l l not be allowed without my written permission. Department of Computer Science The University of B r i t i s h Columbia Vancouver 8 , Canada Date A p r i l 19. 1974 Abstract An implementation of a L i s p L i b r a r y i s d e s c r i b e d . This L i b r a r y provides a simple and uniform scheme f o r programmer access t o a number of L i s p support programs. A scheme by which programs are a u t o m a t i c a l l y loaded from t h i s L i b r a r y i s presented, as w e l l as methods of querying the system and unloading s e l e c t e d programs. A f a c i l i t y f o r a i d i n g in the debugging of L i s p programs i s a l s o described. i i i Table of Contents I I n t r o d u c t i o n ...................1 I I P r e l i m i n a r y Remarks 3 1 Design Considerations ..................................3 1.A Related Work ....................................... 3 1. B Design C r i t e r i a ....................................4 1.C The Autoloader Mechanism ...........................5 1.D The Debug Package .................................. 6 1. E P r e t t y p r i n t i n g .....................................7 1.E.1 S y n t a c t i c Approach .8 1. E.2 Semantic Considerations ........................ 9 I I I The L i s p L i b r a r y Manual ..................11 1 I n t r o d u c t i o n .............................11 1.A Notation ..........................................12 1. B What to read f i r s t ...................13 2 The L i s p L i b r a r y ...................................... 1 2. A How to Run ........>*«*14 2.B L i b r a r y S t r u c t u r e .................................16 2, B.1 Index Format .................................,16 2.C The Loader ...............18 2.C.1 The Autoloader Routine ........................ 20 2. D L i b r a r y U t i l i t y Programs .,...,,..21 2. D.1 GENLIB Commands ............................... 24 3 L i s p F i l e I/O Functions ............................... 30 3. A The FNS l i s t ......................................31 3. A.1 Comments ......................................32 i v 3.B The F u n c t i o n s ..................33 3.C The P r e t t y p r i n t Algorithm ..37 3.D Related Functions ...39 3. E Example 40 4 The Debug Package 41 4. A Invoking the Debug Package ..................42 4.A.1 Debug Package Handling of E r r o r s .............. 42 4.B Break p o i n t s ..43 4.B.1 Pseudo-breakpoints ............................ 46 4. C The S t a c k p o i n t e r 47 4.D The F u n c t i o n s ..................................... 48 4. E The Debug Commands ................................ 53 4.E.1 Input Format .................................. 53 4.E.2 Program C o n t r o l Commands ...................... 54 4.E.3 Stack Commands ................................ 57 4.E.4 Breakpoint Commands ...........................58 4.E.5 R e s t r i c t i o n s .................................. 60 5 F u n c t i o n A n a l y s i s Routines ............................62 5. A The Cross Reference Program ....................... 63 6 M i s c e l l a n e o u s L i b r a r y Routines 69 IV C o n c l u s i o n s ..............77 B i b l i o g r a p h y .................80 Appendix I - Lisp/MTS ..............81 1 I n t r o d u c t i o n ....................81 2 Language Extensions and D i f f e r e n c e s ..82 2.A Stack Operations 82 2.B E r r o r Handling 83 2.C St a t u s F u n c t i o n 84 2.D Lisp/MTS I/O S t r u c t u r e .................84 2.D.1 MTS F i l e S t r u c t u r e ............................ 85 2.D.2 Lisp/MTS B u f f e r s .........................85 2.D.3 I/O I n t e r c e p t s and Macros ..................... 86 2.E The I n f l u e n c e of MTS 87 Appendix IT - Loader L i s t i n g 89 Appendix I I I - L i b r a r y L i s t i n g ............................. 90 Index .................................... 106 I I n t r o d u c t i o n 1 Since i t s e a r l y development the L i s p language has undergone considerable change. I t has grown from a mathematical language i n t o a very powerful system f o r symbolic and l o g i c a l manipulation of complex data s t r u c t u r e s . L i s p has been used almost e x c l u s i v e l y as a research language i n the f i e l d of a r t i f i c i a l I n t e l l i g e n c e , although i t i s now beginning to be used by researchers i n other f i e l d s . L i s p i s by nature an i n t e r a c t i v e language. L i s p programs are stored i n the same way as data, thus a l l o w i n g programmer access t o a l l programs. The L i s p e r r o r handling r o u t i n e s are designed to permit " s o f t " recovery from a l l e r r o r s i n a user's program. In order to best use the power and f l e x i b i l i t y of the language one must i n t e r a c t with i t at a c o n v e r s a t i o n a l t e r m i n a l . I t i s important i n the study of any programming language to i n v e s t i g a t e the use t o which t h a t language i s to be put. The design and implementation d e c i s i o n s should be guided by the knowledge of how d i f f e r e n t f e a t u r e s i n the language w i l l be used. For the type of computing done i n A r t i f i c i a l I n t e l l i g e n c e , almost a l l computing e f f o r t and time i s spent debugging the programs. In many cases a program i s discarded or i s of no f u r t h e r i n t e r e s t once i t i s o p e r a t i o n a l . The b a s i c demands of a programming system which i s to perform w e l l i n t h i s type of environment are that the system provide a powerful set of t o o l s f o r e d i t i n g , manipulating, debugging, and s t o r i n g the programs which the programmer wishes I I n t r o d u c t i o n 2 to use. Speed of execution, while s t i l l of considerable importance, takes a secondary r o l e to the e f f i c i e n c y and ease of i n t e r a c t i o n with the language. The question "How can i t be done?" becomes more important than "How much w i l l i t c o s t ? " . The purpose of the work described i n t h i s t h e s i s i s the design and implementation of a c o l l e c t i o n of L i s p programs which w i l l provide the L i s p programmer with a v a r i e t y of a i d s f o r w r i t i n g and debugging programs. One of the goals of t h i s system i s to provide an environment i n which the L i s p programmer need not leave L i s p i n order t o e d i t or manipulate h i s programs. a l l the t o o l s necessary to debug a user's program should be a v a i l a b l e w i t h i n L i s p . The mechanism by which t h i s i s achieved i s the L i s p L i b r a r y system. This L i b r a r y , together with the Loader r o u t i n e s that i t uses, provides the user with a simple yet powerful method of accessing a number of u s e f u l L i s p u t i l i t y f u n c t i o n s . I I P r e l i m i n a r y Remarks 1 DESIGN CONSIDERATIONS 3 a 1.A n Related Work Of the many implementations of L i s p , I n t e r l i s p [ 4 ] provides the most complete set of programmer a i d s . Included i n the I n t e r l i s p system i s an E d i t o r f o r e d i t i n g L i s p programs w i t h i n L i s p , a break package which a l l o w s program execution to be monitored or suspended, an extensive set of I/O f e a t u r e s and a p r e t t y p r i n t program. Teitelman [ 3 ] has done considerable work both on the I n t e r l i s p system i t s e l f and on a '•Programmer's A s s i s t a n t " . The "Programmer's A s s i s t a n t " provides the user with an " a s s i s t a n t " which can remember what has occurred i n p r e v i o u s l y typed l i n e s , c o r r e c t simple s y n t a c t i c s p e l l i n g mistakes, and undo the e f f e c t s of p r e v i o u s l y executed programs. Many of the programs described i n t h i s t h e s i s have been designed a f t e r the concepts and programs i n the I n t e r l i s p system. The E d i t o r , which was w r i t t e n by P. Friedman[1 ], i s patterned a f t e r the I n t e r l i s p e d i t o r . The Debug Package serves a s i m i l a r f u n c t i o n to the I n t e r l i s p break package, although the "step" features of the Debug Package are not present i n the I n t e r l i s p system. Design Considerations II Preliminary Remarks 4 n 1..B a Design C r i t e r i a The L i s p Library System described i n Chapter III consists of a Loader which can load various u t i l i t y programs into Lisp. The u t i l i t y programs, such as the Editor, Debug Package, and F i l e I/O routines, are c o l l e c t e d into a single f i l e c a l l e d the Library. In the design of the'Library system, the following c r i t e r i a were of primary importance: 1. The system should encompass a l l of the various subsystems available i n Lisp. This includes the Editor, prettyprinter, I/O functions, and Debug Package as well as any commonly used programs or functions. 2 . The user should be able to c a l l any of the Library routines d i r e c t l y without e x p l i c i t l y having to load them. This means that the Library functions can be thought of as part of the Lisp interpreter by the programmer. 3. a user should be able to build his own Library of Lisp programs and have the Loader use them as well as, or instead of, the programs provided i n the main Lisp Library. 4 . F a c i l i t i e s should be provided which allow the user to query the Library system about i t s status. This Design Considerations I I P r e l i m i n a r y Remarks 5 i n f o r m a t i o n c o u l d be used by t h e programmer t o d i r e c t t h e L o a d e r t o r e l e a s e t h e s p a c e o c c u p i e d by a L i b r a r y f u n c t i o n . • 1.C • The A u t o l o a d e r Mechanism One o f t h e b a s i c c r i t e r i a f o r t h e L i s p L i b r a r y i s t h a t a L i b r a r y f u n c t i o n s h o u l d be a v a i l a b l e t o t h e u s e r s i m p l y by c a l l i n g i t . The u s e r need n o t worry a b o u t when t o l o a d a f u n c t i o n o r what s u b f u n c t i o n s a r e t o be l o a d e d . I n e s s e n c e t h i s a l l o w s L i b r a r y r o u t i n e s t o be t r e a t e d i n t h e same manner a s t h e b a s i c f u n c t i o n s o f t h e L i s p i n t e r p r e t e r . I n f a c t , i f a L i b r a r y f u n c t i o n were c o m p i l e d o r r e w r i t t e n i n a s s e m b l y l a n g u a g e , and made a r e s i d e n t p a r t o f t h e L i s p i n t e r p r e t e r the u s e r s h o u l d n ot n o t i c e any d i f f e r e n c e s i n t h e way he u s e s t h a t f u n c t i o n , e x c e p t f o r an i n c r e a s e i n s p e e d . The mechanism by w h i c h t h i s d u a l i t y between i n t e r p r e t e r and L i b r a r y f u n c t i o n s i s a c h i e v e d i s t h e a u t o l o a d e r r o u t i n e . T h i s program i s r e s p o n s i b l e f o r c a l l i n g t h e L o a d e r when a L i b r a r y r o u t i n e i s c a l l e d b u t n o t p r e s e n t i n c o r e memory. I t i s i n v o k e d by t h e e r r o r r o u t i n e s o f t h e L i s p / M T S i n t e r p r e t e r ( s e e A p p e n d i x I f o r a b r i e f d e s c r i p t i o n o f L i s p / M T S ) . When a f u n c t i o n i s c a l l e d which i s u n d e f i n e d , t h e Lisp/MTS e r r o r r o u t i n e s s u s p e n d t h e e x e c u t i o n o f t h e u s e r ' s program and c a l l t h e A u t o l o a d e r . The D e s i g n C o n s i d e r a t i o n s I I P r e l i m i n a r y Remarks 6 Autoloader examines the undefined f u n c t i o n ' s name, and searches the L i b r a r y index, loads the L i b r a r y f u n c t i o n and r e s t a r t s the execution of the f u n c t i o n . I f the f u n c t i o n cannot be found i n the L i b r a r i e s , the e r r o r i s treated as a normal L i s p e r r o r . p 1.D n The Debug Package One of the most u s e f u l r o u t i n e s i n the L i s p L i b r a r y i s the Debug Package. This program allows the user to observe the execution of h i s program step by step, with the a b i l i t y to intervene i n i t s execution. Included i n the commands a v a i l a b l e to the user are commands to e d i t p a r t s of the user's program, d i s p l a y and search the L i s p stack, and resume execution at various points i n h i s program. The b a s i c design of the Debug Package i s s i m i l a r to the break package of I n t e r l i s p , a v e r s i o n of which has been w r i t t e n f o r Lisp/BTS by P. Friedman[1]. The MTS assembly language symbolic debugging system (SDS [2] ) , has i n f l u e n c e d i n some ways the design of the Debug Package. The STEP fe a t u r e of the Debug Package i s patterned a f t e r i t s counterpart i n SDS. The bas i c STEP mechanism i s designed around a s p e c i a l i z e d i n t e r p r e t e r f u n c t i o n c a l l e d STEP. By i n s e r t i n g i n t o the Design Considerations I I P r e l i m i n a r y Remarks 7 i n t e r n a l EVAL rou t i n e a counter, i t i s p o s s i b l e to cause a t r a n s f e r to the L i s p e r r o r r o u t i n e s a f t e r a s p e c i f i e d number of EVALs. By changing the e r r o r forms which the L i s p e r r o r r o u t i n e s c a l l , i t i s then p o s s i b l e to t r a n s f e r c o n t r o l to the Debug Package. The Debug Package commands give the user complete c o n t r o l over the execution of h i s program. A more d e t a i l e d d e s c r i p t i o n of the STEP f u n c t i o n can be found i n the Lisp/MTS Dsers Manual [ 5 ] . The Debug Package i s described i n greater d e t a i l i n Chapter I I I . a 1.E c P r e t t y p r i n t i n g One of the most valuable a i d s to w r i t i n g , debugging, and understanding programs i n any language i s the v i s u a l s t r u c t u r e of the program when i t i s p r i n t e d on a page. I f the programmer can i n d i c a t e v i s u a l l y the l o g i c a l s t r u c t u r e of h i s program, he can more e a s i l y f o l l o w i t s l o g i c a l s t r u c t u r e . In most languages t h i s v i s u a l s t r u c t u r i n g i s done by the programmer when he f i r s t w r i tes h i s program. This may cause him t r o u b l e when l a t e r c o r r e c t i o n s cause the l o g i c a l s t r u c t u r e to change, s i n c e he must then e i t h e r r e s t r u c t u r e the program v i s u a l l y or throw away t h i s a i d . Design Considerations I I P r e l i m i n a r y Remarks 8 In L i s p , as i n most other languages, i t i s p o s s i b l e to write a E££ttyj}r i n t e r which w i l l p r i n t a program i n a v i s u a l l y s t r u c t u r e d way. In the L i s p L i b r a r y system i f ttfe user r e w r i t e s or e d i t s a program i n L i s p he must w r i t e i t back i n t o a f i l e . Due t o the t o t a l u n r e a d a b i l i t y of L i s p programs which are p r i n t e d simply as huge l i s t s , i t i s necessary that some form of p r e t t y p r i n t e r be a v a i l a b l e . 1 . E . 1 S y n t a c t i c Approach S i n c e a l l L i s p programs are simply l a r g e l i s t s , i t i s r e l a t i v e l y simple to write a L i s p program which w i l l p r i n t out a program using the l i s t s t r u c t u r e to guide the i n d e n t a t i o n of l i n e s . Since L i s p i s almost t o t a l l y devoid of syntax, the program i s very easy t o writ e . In Lisp/MTS the c h a r a c t e r • i s recognized as standing f o r the QUOTE f u n c t i o n . Thus, when the user types i n • ( A B C ) the read r o u t i n e s convert t h i s i n t o (QUOTE ( A B C ) ) If a p r e t t y p r i n t e r i s t o attempt to produce output which i n some way m i r r o r s the way the programmer would w r i t e i t , these quote symbols must be r e - i n s e r t e d i n t o the output. A s i m i l a r problem e x i s t s with b r e a k p o i n t s from the Debug Package s i n c e these b r e a k p o i n t s make a c t u a l changes t o the user's program. The Design C o n s i d e r a t i o n s I I P r e l i m i n a r y Remarks 9 p r e t t y p r i n t e r should not "see" these breakpoints when i t w r i t e s out the program. In ,order to e f f i c i e n t l y implement these f e a t u r e s i n the p r e t t y p r i n t e r the p r i n t macros of Lisp/MTS were modified i n such a way that whenever the i n t e r n a l p r i n t r o u t i n e i s about to p r i n t {QUOTE (A B C ) ) , a s p e c i a l p r i n t i n t e r c e p t f u n c t i o n i s c a l l e d which p r i n t s ' ( A B C ) . A s i m i l a r mechanism i s used to handle breakpoints. This f e a t u r e could a l s o be used to extend the p r e t t y p r i n t e r to handle other s p e c i a l i z e d f u n c t i o n s (such as the Micro-planner readmacro ch a r a c t e r s $?, $G, $T, e t c . ) . \ 1. E. 2 Semantic Considerations Since L i s p has a very weak syntax, i t i s only reasonable that the semantics of the language be used to v i s u a l l y r e f l e c t the l o g i c a l s t r u c t u r e of a program. As an example, the COND fu n c t i o n i n L i s p c o n s i s t s l o g i c a l l y of a number of a l t e r n a t e c o n d i t i o n s and statements. A purely s y n t a c t i c p r e t t y p r i n t e r might p r i n t a COND statement as (COND ((ATOM (CAR X)) (CDR X)) { (LISTP X) NIL) (T T) ) when i n f a c t i t s l o g i c a l s t r u c t u r e would be be t t e r displayed by w r i t i n g i t as Design Considerations I I P r e l i m i n a r y Remarks 10 (COND { (ATOM (CAR X)) (CDR X)) ( (LISTP X) NIL) ) (T T) ) S i m i l a r l y , i n Lisp/MTS the SETQ f u n c t i o n allows any number of v a r i a b l e - v a l u e p a i r s of arguments i n s t e a d of j u s t one p a i r . In many i n s t a n c e s a s t r i c t l y s y n t a c t i c p r e t t y p r i n t e r would p r i n t these as (SETQ A (CAR X) LST LST1 LST2 (CONS A B) ) When i n f a c t the semantic s t r u c t u r e i s more l i k e (SETQ A (CAR X) LST LST1 LST 2 (COHS A B) ) E v i d e n t l y , i n order to produce a l i s t i n g of a user's program which w i l l be most u s e f u l f o r debugging and understanding the program, the p r e t t y p r i n t e r must be aware of the meaning of p a r t s of the program, as w e l l as the l i s t s t r u c t u r e o f t h e program. The p r e t t y p r i n t e r d e s c r i b e d i n Chapter I I I attempts to meet at l e a s t part of t h i s requirement. Design C o n s i d e r a t i o n s I l l The L i s p L i b r a r y Manual 11 1 INTRODUCTION The f o l l o w i n g manual describes a group of f u n c t i o n s c o l l e c t i v e l y c a l l e d a L i s p L i b r a r y . This L i b r a r y contains a number of general purpose L i s p f u n c t i o n s to a i d a L i s p programmer with problems of w r i t i n g , maintaining, and debugging h i s programs. The L i b r a r y scheme, described i n the f i r s t s e c t i o n , i s designed to allow a number of d i f f e r e n t r o u t i n e s to be conveniently accessed through a common i n t e r f a c e . The Loader which loads these r o u t i n e s i n t o L i s p allows the user t o w r i t e and maintain h i s own L i b r a r y and use i t i n conjunction with the main L i s p L i b r a r y . This manual assumes that the user i s f a m i l i a r with the LISP/MTS i n t e r p r e t e r and User's Manual [ 5 ] . A b r i e f d e s c r i p t i o n of some of the fe a t u r e s of Lisp/MTS can be found i n Appendix I. L i s t i n g of the Loader and L i b r a r y programs can be found i n Appendix I I and Appendix I I I . I n t r o d u c t i o n I l l The L i s p L i b r a r y Manual 1 2 n 1, A n Notation In the d e s c r i p t i o n of L i s p f u n c t i o n s (of which there are many i n t h i s manual), i t i s necessary to convey c e r t a i n key pieces of i n f o r m a t i o n about the f u n c t i o n and how i t i s c a l l e d . A complete d e s c r i p t i o n of what the arguments are and what they do i s of prime importance. The value returned by some f u n c t i o n s i s a l s o of importance. In the d e s c r i p t i o n of the arguments i t i s necessary t o i n d i c a t e which arguments are o p t i o n a l , what t h e i r d e f a u l t values are, and which ones get e v a l u a t e d . The f o l l o w i n g scheme i s used to d e s c r i b e a l l the f u n c t i o n s and commands i n t h i s manual: 1 . O p t i o n a l arguments are enclosed i n square b r a c k e t s as i n [ F I L E ] . The d e f a u l t values, i f any, are i n d i c a t e d i n the d e s c r i p t i o n of the argument. 2 . Quoted arguments, t h a t i s ones which are not evaluated, are i n d i c a t e d by u n d e r s c o r i n g , as i n FNJ or [OUT F I L E ] . 3 . Where one or more occurrences of the same argument i s p o s s i b l e the sequence i s i n d i c a t e d as A1 A2 ... An. Examples: (DISKTN FILE 1 F I L E 2 ... FILEn) i n d i c a t e s one or more FILEs may be s p e c i f i e d f o r DISKIN; none of the arguments w i l l be evaluated. (EDITE F) e v a l u a t e s the s i n g l e argument F. (XREF F [ OUTFILE ]) does not e v a l u a t e e i t h e r argument, and the second one i s o p t i o n a l . I n t r o d u c t i o n I l l The L i s p L i b r a r y Manual 13 • 1.B n What t o read f i r s t Since t h i s manual i s q u i t e large,: i t i s probable that few people w i l l want to read i t completely the f i r s t time. For someone who would l i k e t o use a p a r t i c u l a r f u n c t i o n or group of f u n c t i o n s , i t i s u s e f u l to i n d i c a t e some order of p r i o r i t i e s as to what should be read f i r s t s The f i r s t s e c t i o n to read, and you probably already have done so, i s the I n t r o d u c t i o n , e s p e c i a l l y the s e c t i o n s on Notation and "What to read f i r s t " . The only other part a b s o l u t e l y necessary i s the beginning of the next s e c t i o n e n t i t l e d "How to Run". With t h i s minimum of in f o r m a t i o n , i t i s po s s i b l e to c a l l and execute many f u n c t i o n s i n the L i b r a r y . The r o u t i n e s i n the s e c t i o n on F i l e I/O are probably the most commonly used f u n c t i o n s . This s e c t i o n i n c l u d e s the p r e t t y p r i n t e r , DISKIN, DISROOT, and UPDATE. The d e s c r i p t i o n of the FNS l i s t i s important, since many other f u n c t i o n s i n the L i b r a r y use these l i s t s . The Debug Package i s i n a more or l e s s s e l f contained s e c t i o n . The Debug Package w i l l probably take some g e t t i n g used t o , so be prepared to spend some time to get f a m i l i a r with i t . (Try i t , y o u ' l l l i k e i t ) . I n t r o d u c t i o n I l l The L i s p L i b r a r y Manual 2 THE LISP LIBRARY 14 This s e c t i o n describes the s t r u c t u r e of L i s p L i b r a r i e s and how they can be used and generated. • 2 .A n How t c Run The L i b r a r y r o u t i n e s are made a v a i l a b l e by loading i n t o Lisp the LOADER r o u t i n e s . I f we assume that t h i s f i l e i s under the ID PSIL, the f o l l o w i n g MTS command w i l l run L i s p with the L i b r a r y : $R'UN PSIL: LISP SCARDS=PSIL:LOADER When, i n L i s p , any L i b r a r y routine may be used simply by c a l l i n g i t . I f i t has not yet been read i n , as i s the case p r i o r to i t s f i r s t i n v o c a t i o n , i t w i l l be loaded from the L i b r a r y . A message i s p r i n t e d to inform the user that the f u n c t i o n has been loaded, and execution continues as i f i t had always been i n core. The f o l l o w i n g example shows a simple run using the L i b r a r y . The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 15 Example: * RUN PSIL:LISP SCARDS=PSTL:LOADER APR 2/74: REVISED INTERPRETER > LOADER * (DISKIN TESTFYLE) > LOADING: DISKIN > 4 FORMS READ FROM: TESTFYLE > * (SETQ 7MAXLEN 50) > 50 * (PP F91) > LOADING: PP > (LAMBDA (Z) > (IF (CREATERP X 100) > (SUB X 10) > (F91 (F91 (ADD X 11))))) > * (EDITF F91) > LOADING: EDITF : EDITING F91 : (LAMBDA (Z) (IF S 8 S) ) . INSERT X FOR Z 1 : (LAMBDA (X) (IF S S 6) ) . OK > NIL * (UPDATE TESTFYLE) > LOADING: UPDATE > FILE: TESTFYLE UPDATED.. * (STOP) The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual • 2.B n L i b r a r y S t r u c t u r e 16 T h i s s e c t i o n deals with the a c t u a l s t r u c t u r e of L i s p L i b r a r i e s , and how and where the v a r i o u s b i t s o f i n f o r m a t i o n necessary f o r l o a d i n g a f u n c t i o n are s t o r e d . The L i b r a r y f i l e i t s e l f c o n s i s t s of an INDEX which i s a L i s p S-expression, and the L i b r a r y f u n c t i o n s themselves, The f i l e i s an MTS l i n e f i l e . The INDEX i s normally s t o r e d i n the negative l i n e numbers while the f u n c t i o n d e f i n i t i o n s are s t o r e d i n t he p o s i t i v e l i n e s . The INDEX d e s c r i b e s f o r each f u n c t i o n , where i t i s and what other s u b f u n c t i o n s must be loaded with i t . 2.B.1 Index Format The Index i s a l i s t of the form (INDEX S1 S2 ... Sn) where each S i i s the l o a d e r i n f o r m a t i o n f o r a s i n g l e L i b r a r y f u n c t i o n . The S i are of the form (FN L1 L2 ... Ln) FN i s the name of the L i b r a r y f u n c t i o n being indexed, and the L i s p e c i f y where i n the L i b r a r y f i l e the necessary s u b f u n c t i o n s are to be found. Each L i i s e i t h e r the MTS l i n e number where the f u n c t i o n s a re to be found, or the name of some other L i b r a r y f u n c t i o n , e i t h e r i n t h i s same L i b r a r y or i n some other L i b r a r y . The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 17 The use of the names of other L i b r a r y f u n c t i o n s reduces the number of L i elements i n the index e n t r i e s . I t a l s o a l l o w s a f u n c t i o n i n one L i b r a r y t o have a s u b f u n c t i o n i n another L i b r a r y . Example: (INDEX (DISKIN 1 101 201) (PP 301 401 501 601 701 801) (UPDATE 901 PP) • • • ) In t h i s example, t o load the r o u t i n e DISKIN, the f u n c t i o n s at l i n e s 1, 101, and 201 must be loaded. To load UPDATE, the f u n c t i o n s at l i n e s 901, 30 1, 401, 501, 601, 70 1, and 801 must be loaded. The f u n c t i o n GENLIB, d e s c r i b e d l a t e r i n t h i s document, can be used to generate t h i s Index s e m i - a u t o m a t i c a l l y . The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual n 2.C n The Loader 18 The Loader r o u t i n e s are the heart of the L i s p L i b r a r y system, The Loader i s able to search through a l i b r a r y index, read i n the L i s p f u n c t i o n s appropriate to the f u n c t i o n being loaded, and r e s t a r t the execution of the user's program. The Loader w i l l handle any number of L i b r a r y f i l e s . The f u n c t i o n LO ADF N can be used to e x p l i c i t l y c a l l the Loader or the d e f a u l t automatic lo a d i n g f e a t u r e can be used to cause the Loader to be invoked whenever a L i b r a r y f u n c t i o n i s c a l l e d which has not been loaded. For each L i b r a r y t h a t has been referenced, the Loader saves a l l the in f o r m a t i o n i t needs i n order to access the L i b r a r y and load f u n c t i o n s from i t . This i n f o r m a t i o n i s stored on the property l i s t of the L i b r a r y name. The f o l l o w i n g l i s t of property tags are used by the Loader. The tags are a l l of the form " . t a g . " i n order to avoid l i k e l y c o n f l i c t s with user defined property tags. ".BUFFER." - the buffer ( a c t u a l l y a L i s p IOARG) which i s opened on the L i b r a r y f i l e . Saving the bu f f e r avoids the nec e s s i t y of reopening the f i l e each time the Loader i s c a l l e d . ".INDEX." - the L i b r a r y index, as described above. Note th a t the index i s not read i n u n t i l the f i r s t reference to the L i b r a r y . The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 19 LOADMAP." - a l i s t of a l l f u n c t i o n s and s u b f u n c t i o n s which have been loaded from t h i s L i b r a r y . T h i s l i s t i s used by the Loader to a v o i d r e r e a d i n g f u n c t i o n s which have been read i n p r e v i o u s l y . The l i s t i s of the form: ((L1 FN 1 . C1) (L2 FN 2 . C2) ... (Ln FNn . Cn) ) where L i i s the MTS l i n e number from which t h i s f u n c t i o n or e x p r e s s i o n has been read, FNi i s e i t h e r the Expr f u n c t i o n name, or NIL i f a non-Expr was read, and C i i s the number of times the f u n c t i o n has been loaded (normally 1). »». TOPCALLS. •» - a l i s t of a l l f u n c t i o n s which the Loader has been c a l l e d on t o l o a d . These are only the top l e v e l r o u t i n e s , not the s u b f u n c t i o n s of these r o u t i n e s . The above i n f o r m a t i o n i s s t o r e d the f i r s t time the Loader i s c a l l e d on to load a f u n c t i o n from the p a r t i c u l a r L i b r a r y . Successive c a l l s update the e x i s t i n g l i s t s . The UNLOADFN r o u t i n e w i l l d e l e t e e n t r i e s from these l i s t s . The g l o b a l v a r i a b l e #LIBRARYLIST# i s a l i s t of a l l the L i b r a r i e s from which the Loader can l o a d f u n c t i o n s . T h i s i s i n i t i a l l y the l i s t (PSIL:LIBRARY) which i s the L i b r a r y f i l e f o r the r o u t i n e s d e s c r i b e d i n t h i s document. The user may add h i s own L i b r a r y to t h i s l i s t . The L i b r a r i e s are searched i n the order i n which they appear i n t h i s l i s t . I f two L i b r a r i e s both have a f u n c t i o n with the same name, the L i b r a r y c l o s e r to the f r o n t of t h i s l i s t w i l l be the one from which the f u n c t i o n w i l l be loaded. The Loader w i l l a l s o allow f u n c t i o n s i n one L i b r a r y to r e f e r e n c e f u n c t i o n s from another L i b r a r y . T h i s avoids the n e c e s s i t y of making a copy of one L i b r a r y r o u t i n e i n order to The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 20 use i t from another L i b r a r y . 2.C.1 The Autoloader Routine The Loader contains a s p e c i a l r o u t i n e which i n t e r f a c e s with the L i s p e r r o r handling r o u t i n e s . This r o u t i n e enables the Loader to a u t o m a t i c a l l y load a L i b r a r y f u n c t i o n when i t i s c a l l e d . The same r o u t i n e a l s o handles the automatic i n v o c a t i o n of the Debug Package (see Section 4 ) . The Autoloader i s invoked whenever an undefined f u n c t i o n e r r o r i s detected by L i s p . I t searches the index of each of the L i b r a r i e s l i s t e d i n #LIBRARYLIST#. I f the f u n c t i o n i s found, i t i s loaded and execution resumes; I f i t i s not found, the e r r o r i s processed as a r e g u l a r L i s p e r r o r . When the Autoloader loads a f u n c t i o n , a message i s p r i n t e d on the te r m i n a l i n d i c a t i n g to the user that the f u n c t i o n has been loaded. The Autoloader i s c o n t r o l l e d by the f o l l o w i n g g l o b a l switch: ?AUTOLOAD - d e f a u l t i s T. I f t h i s switch i s MIL the Autoloader w i l l not be invoked when a L i b r a r y f u n c t i o n i s to be read i n , hence a l l L i b r a r y r o u t i n e s w i l l have to be e x p l i c i t l y loaded v i a the LOADFN r o u t i n e . I f t h i s switch i s non-NIL, the Autoloader w i l l attempt to load the f u n c t i o n (see below). The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 21 n 2.D n L i b r a r y U t i l i t y Programs In order t o pr o v i d e a more f l e x i b l e L i b r a r y system, the f o l l o w i n g f u n c t i o n s have been i n c l u d e d i n the L i s p L i b r a r y . They are f u n c t i o n s which e x p l i c i t l y manipulate L i b r a r i e s , and L i b r a r y f u n c t i o n s . The f u n c t i o n LOADINFO can be c a l l e d t o p r o v i d e the user with i n f o r m a t i o n about which L i b r a r y r o u t i n e s have a l r e a d y been loaded from the L i b a r i e s . UNLOADFN i s used to remove d e f i n i t i o n s of L i b r a r y r o u t i n e s t h a t are no l o n g e r r e q u i r e d . In some i n s t a n c e s i t may be d e s i r a b l e t o e x t r a c t from a L i b r a r y a f u n c t i o n together with a l l i t s s u b f u n c t i o n s , i n order to add i t to another L i b r a r y or to w r i t e i t onto a separate f i l e . The f u n c t i o n EXTRACTFN i s meant to do t h i s . F i n a l l y , GENLIB can be used t o b u i l d a new L i b r a r y or update an e x i s t i n g one. * (LOADFN F l F 2 ... Fn) Purpose: to e x p l i c i t l y c a l l the Loader r o u t i n e s . F i - the name of the L i b r a r y f u n c t i o n to be loaded. The f u n c t i o n s s p e c i f i e d are loaded from the L i b r a r i e s s p e c i f i e d by the l i s t #LIBRARYLIST#. I f a f u n c t i o n cannot be found i n any of the L i b r a r i e s , an e r r o r message i s p r i n t e d . The value r e t u r n e d by LOADFN i s T. The L i s p L i b r a r y I ' l l The L i s p L i b r a r y Manual 22 Example: (LOADFN PP DEBUG UPDATE) loads the f u n c t i o n s PP, DEBUG, and UPDATE from the L i b r a r y . a (EXTRACTFN F) Purpose:, used to e x t r a c t a L i b r a r y f u n c t i o n from a L i b r a r y . F - the name o f the L i b r a r y r o u t i n e t o be removed. EXTRACTFN lo a d s a l i b r a r y r o u t i n e much as the Loader would, but i n the process of l o a d i n g , a l i s t i s b u i l t of a l l f u n c t i o n s and forms which i t loads. T h i s l i s t has the FNS format de s c r i b e d i n the s e c t i o n on F i l e I/O f u n c t i o n s . The l i s t i s sto r e d on the property l i s t of the f u n c t i o n name under the tag ".FNS.". A f u n c t i o n which has been e x t r a c t e d i n t h i s way can be -wr i t t e n out to a f i l e using DISKOUT, as i f i t had been read i n by DISKIN. The value returned by EXTRACTFN i s the FNS l i s t i t generates. Example: (EXTRACTFN PP) e x t r a c t s the p r e t t y p r i n t r o u t i n e s from the L i s p L i b r a r y . (DISKOUT -A PP) writ e s i t out to f i l e -A. i The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 23 • (LOADINFO [FULL]) Purpose: to p r i n t out i n f o r m a t i o n about what L i b r a r y f u n c t i o n s are c u r r e n t l y loaded. FULL - t h i s i s an o p t i o n a l argument which w i l l cause a more e x t e n s i v e l i s t of L i b r a r y f u n c t i o n s to be p r i n t e d . I t s value i s not used, only i t s presence or absence i s of any consequence. LOADINFO p r i n t s f o r each L i b r a r y , the top < l e v e l r o u t i n e s which have been loaded from the L i b r a r y . I f the argument FULL i s p r e sent, a l i s t of a l l the s u b f u n c t i o n s , t h e i r f i l e l i n e numbers, and load counts are a l s o p r i n t e d . These l i s t s are the TOPCALLS." and LOADMAP." l i s t s d e s c r i b e d p r e v i o u s l y i n the s e c t i o n on the Loader. LOADINFO can be used i n c o n j u n c t i o n with UNLOADFN to av o i d keeping r o u t i n e s around which are no longer needed. m (GENLIB FILE LIB) Purpose: used to generate a new L i b r a r y f i l e . FILE - the name of an MTS l i n e f i l e which i s to be the new L i b r a r y f i l e . T h i s f i l e should be c r e a t e d by the user. GENLIB does not empty the f i l e before w r i t i n g i n t o i t . LIB - the name of an e x i s t i n g L i b r a r y . A l l the f u n c t i o n s i n t h i s L i b r a r y w i l l be the i n i t i a l e n t r i e s i n the new L i b r a r y . I f LIB i s NIL, no i n i t i a l L i b r a r y i s used. GENLIB e x t r a c t s a l l the f u n c t i o n s i n the o l d L i b r a r y s p e c i f i e d by LIB, then a l l o w s the user to enter any of a number of commands s p e c i f y i n g which a d d i t i o n s or d e l e t i o n s are to be made to t h i s l i s t . A f t e r a l l changes have been made, the command OK w i l l cause GENLIB to w r i t e out the new L i b r a r y f i l e . The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 24 \ / The f u n c t i o n s are w r i t t e n using the DISKOUT f u n c t i o n . GENLIB operates by f i r s t b u i l d i n g a l i s t , c a l l e d FNLIST, of ' FNS l i s t s b u i l t from the index of the o l d L i b r a r y . T h i s may be modified, and new s u b l i s t s may be added by using the commands below. When the command OK i s entered, the FNLIST i s used to generate the new L i b r a r y index which i n t u r n i s w r i t t e n out to the new f i l e . The new index s t a r t s at MTS l i n e number -1000 of the new f i l e . GENLIB r e t u r n s the value DONE i f the L i b r a r y was s u c c e s s f u l l y w r i t t e n , and FAIL i f i t was not. I f the r o u t i n e FAILed, an e r r o r message w i l l be p r i n t e d e x p l a i n i n g what happened. In order to allow a new L i b r a r y to use f u n c t i o n s from other L i b r a r i e s without copying them, the command EXTERNAL i s i n c l u d e d . T h i s command i n d i c a t e s t o GENLIB what f u n c t i o n s are e x t e r n a l , and are to be entered i n the new index as e x t e r n a l r e f e r e n c e s (see INDEX d e s c r i p t i o n e a r l i e r i n t h i s s e c t i o n ) . 2. D. 1 GENLIB Commands Th§ f o l l o w i n g s e t of commands are recognized by GENLIB. In a d d i t i o n to these commands, anything which i s not a v a l i d command name i s EVALed, and the r e s u l t p r i n t e d . For commands which allow an a r b i t r a r y number of arguments, the end of a l i n e The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 25 i s used as a t e r m i n a t o r . Any e r r o r i n the p r o c e s s i n g of one of the arguments of these commands w i l l cause the r e s t of the l i n e to be ignored. The p r e f i x c h a r a c t e r "£" i s used by GENLIB to i n d i c a t e t h a t i t i s w a i t i n g f o r a command to be typed i n . » ADD NAME FNS — adds a new f u n c t i o n to the L i b r a r y . The name of the f u n c t i o n w i l l be NAME. FNS s p e c i f i e s what f u n c t i o n s and s u b f u n c t i o n s are to be p a r t of t h i s e n t r y . I f FNS i s an atom, the FNS l i s t s t o r e d on the property l i s t of t h i s atom under the tag ".FNS." w i l l be used, otherwise FNS must be a l i s t of the same format as those c r e a t e d by DISKIN. See the FNS d e s c r i p t i o n i n S e c t i o n 3. . ADDTO NAME F1 F2 ... Fn — add new s u b f u n c t i o n s to e x i s t i n g e n t r i e s i n FNLIST. The e n t r y i n FNLIST f o r the f u n c t i o n NAME i s modified by adding to i t the f u n c t i o n names F i . The F i must be v a l i d elements of a FNS l i s t , t h a t i s , e i t h e r f u n c t i o n names or dotted p a i r s of atoms and p r o p e r t y tags, or a l i s t whose CDR i s a form to be added to the L i b r a r y . Example: I f THISFN i s a f u n c t i o n i n the L i b r a r y , the command ADDTO THISFN THATFN THEOTHERFN w i l l add the f u n c t i o n s THATFN and THEOTHERFN to the l i s t of r o u t i n e s which must be loaded by the Loader when THISFN i s loaded. • CLEAR — the EXTERNAL l i s t , generated by the EXTERNAL command, i s r e s e t t o NIL. The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 26 « DELETE NAM E l §AMJ2 , .. NAMEn A b b r e v i a t i o n : DEL -- d e l e t e s a L i b r a r y f u n c t i o n from the new L i b r a r y . T h i s command has the o p p o s i t e e f f e c t to the ADD command. NAMEi must be the name of one of the e n t r i e s i n the FNLIST. The e n t r y i n FNLIST whose CAR i s NAMEi w i l l be d e l e t e d from the l i s t , thus removing t h i s f u n c t i o n from the new L i b r a r y . T h i s command can be used i n c o n j u n c t i o n with the LIB argument to GENLIB to remove unwanted f u n c t i o n s from an e x i s t i n g L i b r a r y . - DELFROM NAME F± F2 Fn — each of the s u b f u n c t i o n s F i are removed from the index entry of NAME i n the FNLIST. T h i s command has the o p p o s i t e e f f e c t to the ADDTO command. Example: I f THISFN i s a L i b r a r y f u n c t i o n which has the s u b f u n c t i o n s THATFN and THEOTHERFN, the command DELFROM THISFN THATFN THEOTHERFN w i l l remove THATFN and THEOTHERFN from the index entry f o r THISFN. a EXTERNAL FJ. F2 ... Fn — adds the f u n c t i o n s F i to the l i s t of e x t e r n a l L i b r a r y f u n c t i o n s . The l i s t EXTERNAL i s a l i s t of those f u n c t i o n s which are to be entered i n the new index as being e x t e r n a l r e f e r e n c e s . (See the INDEX d e s c r i p t i o n ) Any s u b f u n c t i o n name which i s i n t h i s l i s t w i l l be t r e a t e d by GENLIB as a f u n c t i o n i n another L i b r a r y . • LIST — produces a l i s t i n g of the c u r r e n t FNLIST and EXTERNAL l i s t s . T h i s a l l o w s the user to see what the c u r r e n t f u n c t i o n s i n the new L i b r a r y a r e . The f i r s t element of each l i s t p r i n t e d i s the name of the new L i b r a r y r o u t i n e . The r e s t of the elements are the f u n c t i o n s and forms which must be loaded by the Loader when i t loaded t h i s f u n c t i o n . Note t h a t i n most cases the f i r s t and second names i n the l i s t are the same s i n c e the f u n c t i o n i t s e l f must be loaded. The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 27 generate and write out the new L i b r a r y . T h i s command w i l l cause the GENLIB r o u t i n e to write out the new L i b r a r y and index, and then stop. * STOP e x i t the GENLIB routine.. T h i s stops e x e c u t i o n without g e n e r a t i n g a new L i b r a r y . Example:, The f o l l o w i n g example shows how GENLIB can be used to c o n s t r u c t a L i b r a r y . * * (GENLIB MY LIB NIL) > LOADING: GENLIB 0 ADD PRETTY (PP) 0 (DISKIN TESTFYLE) > LOADING: DISKIN > 4 FORMS READ FROM: TESTFYLE > 0 ADD IF (;IF) 0 ADD F91 (F91) 0 (EXTRACTFN CONSES) > (CONSES) 0 ADD CONSES CONSES 0 LIST > > *INDEX* > (PRETTY PP) > <iIF IF) > (tF91 F91) > (CONSES CONSES) > > ^EXTERNAL FNS * > NIL > At t h i s p o i n t we have 4 f u n c t i o n s i n the L i b r a r y , PRETTY (which i s a c a l l to the f u n c t i o n PP), IF, F91, and CONSES. Since PP i s to be an e x t e r n a l c a l l , we must use the EXTERNAL command to i n d i c a t e t h i s . 0 0 ADDTO F91 IF 0 EXTERNAL PP 0 LIST > The L i s p L i b r a r y I ' l l The L i s p L i b r a r y Manual 28 > *INDEX* > (PRETTY PP) > (IF IF) > (F91 F91 IF) > (CONSES CONSES) > > * EXTERNAL FNS* > (;PP) > 0 OR > DONE > A f t e r l i s t i n g the index ag a i n , we type OK which causes the L i b r a r y to be w r i t t e n out to the f i l e MYLIB. I f we l i s t l i n e s -1000 to 0 of MYLIB we can see the index generated: * * (MTS «"$LIST MYLIB (-1000,0) ") > -1000 ; LIBRARY INDEX > -999 (INDEX > -998 (CONSES 3) > -997 (F91 103 IF) > -9 96 (IF 203) > -995 (PRETTY PP) > -994 ) ; END OF INDEX # END OF FILE > NIL • (U1NLOADFN F l F2 ... Fn) Purpose: used to unload the L i b r a r y r o u t i n e s F i . F i - the name of a L i b r a r y r o u t i n e which has been loaded. UNLOADFN i s used t o remove from core the d e f i n i t i o n of L i b r a r y r o u t i n e s p r e v i o u s l y loaded, but which are no longer r e g u i r e d . L i s p w i l l not a c t u a l l y reduce the amount of core i t i s u s i n g (unfortunately) but the space w i l l be garbage c o l l e c t e d . The L i s p L i b r a r y I ' l l The L i s p L i b r a r y Manual 29 Example: * * (LOADFN DISKIN UPDATE) > T * (LOADINFO) > LOADING: LOADINFO > > LIBRABY: FRED:LIBRABY " > FNS LOADED: DISKIN PRINTMSSG PP UPDATE DISKOUT Notice that DISKIN uses PRINTMSSG as a s u b f u n c t i o n , and UPDATE uses PP and DISKOUT as s u b f u n c t i o n s . T h i s i s why these f u n c t i o n s were unloaded as w e l l as UPDATE and DISKIN. LOADINFO > > > > (UNLOADFN DISKIN UPDATE) LOADING: UNLOADFN (UPDATE DISKOUT DISKIN PRINTMSSG PP) * (LOADINFO FULL) > > LIBRARY: FRED:LIBRARY > FNS LOADED: LOADINFO UNLOADFN > SDBFNS: > (9003 LOADINFO . 1) > (,11201 UNLOADFUN . 1) > (11401 UNLOADFUHft . 1 > (11103 UNLOADFN . (11301 UNLOADFUN1 NIL D The L i s p L i b r a r y I l l The L i s p L i b r a r y Manual 30 3 LISP FILE I/O FUNCTIONS These I/O f u n c t i o n are w r i t t e n to provide the user with a f l e x i b l e and convenient method of p r i n t i n g , reading and s t o r i n g f i l e s of L i s p f u n c t i o n s . These f u n c t i o n s are used as f o l l o w s : 1. Bead i n an MTS f i l e c o n t a i n i n g a number of L i s p f u n c t i o n s , u s i n g the f u n c t i o n DISKIN. 2. Debug these programs, modifying them with the e d i t o r or by r e d e f i n i n g or adding new f u n c t i o n s . 3. Write the f u n c t i o n s back to an MTS f i l e using the f u n c t i o n UPDATE or DISKOUT. As w e l l as being a b l e to w r i t e f u n c t i o n s i n t o f i l e s i n a L i s p r e a d a b l e form, i t i s d e s i r a b l e that the f i l e be person readable. Thus, a s t r u c t u r a l p r i n t f u n c t i o n , c a l l e d a " p r e t t y p r i n t e r " , i s used to write out the f i l e s . The p r e t t y p r i n t e r uses v a r i o u s i n d e n t a t i o n r u l e s based on the l i s t s t r u c t u r e of the f u n c t i o n to produce an e a s i l y r e a d l i s t i n g . In a d d i t i o n , the p r e t t y p r i n t e r w i l l ensure that atoms which must be read i n t o L i s p with e n c l o s i n g quotes, such as "...", are p r i n t e d i n t h i s form. The p r e t t y p r i n t e r i s a l s o a v a i l a b l e as a separate f u n c t i o n which can be c a l l e d from L i s p to p r i n t any L i s p f u n c t i o n s or forms while the user i s debugging or e xecuting h i s programs. L i s p F i l e I/O F u n c t i o n s I l l The L i s p L i b r a r y Manual 31 • 3.a n The FNS l i s t In order to c o n v e n i e n t l y w r i t e out a l l f u n c t i o n s read from a f i l e , a scheme has been developed whereby the f u n c t i o n DISKIN w i l l "remember" what has been read i n from a f i l e , and UPDATE or DISKOUT can use th a t i n f o r m a t i o n to write the s t r u c t u r e s out again. DISKIN b u i l d s a l i s t , c a l l e d the FNS l i s t , which c o n t a i n s a l l the i n f o r m a t i o n necessary to w r i t e out the f i l e . The l i s t i s st o r e d on the p r o p e r t y l i s t o f the atomic f i l e name from which the read was done, under the property tag ".FNS.". The s t r u c t u r e of the FNS l i s t i s as f o l l o w s : (S1 S2 S3 ... Sn) Each S i corresponds t o one form or s t r u c t u r e which was read from the f i l e , and consequently must be w r i t t e n out. Each S i can be one of three forms: ATOM - i f S i i s an atom, then the s t r u c t u r e r e f e r r e d t o i s the Expr d e f i n i t i o n s t o r e d on the property l i s t of the atom; i n other words, t h i s i s the name of a f u n c t i o n t o be w r i t t e n . (ATOM . TAG) - the s t r u c t u r e r e f e r r e d to i s the S-expression s t o r e d under the property TAG on the atom ATOM. The form read or w r i t t e n w i l l be (DEFPROP ATOM TAG ... ) . (ATOM . FORM) - where FORM i s a non-atomic L i s p s t r u c t u r e . The FORM i t s e l f w i l l be w r i t t e n out a s - i s . The ATOM i s ig n o r e d . DISKIN, when re a d i n g a f i l e , w i l l generate a FNS l i s t as de s c r i b e d above and s t o r e i t on the prop e r t y l i s t of the f i l e name under the tag ".FNS.", I f an S-expression read i n begins L i s p F i l e I/O Functions I l l The L i s p L i b r a r y Manual 32 with (DEFUN ... , DISKIN generates an S i of the form ATOM above; i f the S-expression begins with (DEFPROP ... , DISKIN generates an S i of the form (ATOM . TAG) above; otherwise the S-expression i t s e l f i s saved as the CDR of the dotted p a i r (ATOM . FORM) . The ATOM used as the CAR of t h i s dotted p a i r i s a GENSYM atom generated by DISKIN. 3.A.1 Comments In a d d i t i o n to remembering which f u n c t i o n s and forms were read i n , DISKIN w i l l a l s o save any comments which appear before each top l e v e l f u n c t i o n or form i n the f i l e . The comments must be on l i n e s by themselves and cannot be i n s i d e f u n c t i o n d e f i n i t i o n s , or they w i l l be ign o r e d . The comments are s t o r e d on the property l i s t of the ATOM part of the S i d e s c r i b e d above, under the t a g ".COMMENTS.". L i s p F i l e I/O Functions I l l The Lisp Library Manual a 3.B o The Functions • (DISKIN FILEJ F I L E 2 ... FILEn) Purpose: reads programs in from the f i l e s s p e c i f i e d . FILEi - an atom, the name of the MTS f i l e to read. This function reads i n an MTS l i n e f i l e . As well as reading and EVALing a l l forms, DISKIN generates the FNS l i s t necessary to enable UPDATE or DISKOUT to write the f i l e out again (see FNS description above). DISKIN w i l l also save any top l e v e l comments i t reads as described in the Comments section above. A message i s printed for each FILEi indicating how many forms were read from the f i l e . The value returned by DISKIN i s a blank. Example: * (DISKIN TESTFYLE FRED:PA) > LOADING: DISK IN > U FORMS READ FROM: TESTFYLE > 5 FORMS READ FROM: FRED:PA > ***Note: I f 2 or more forms appear on the same l i n e of a f i l e , only the f i r s t one w i l l be read by DISKIN. This i s because DISKIN scans for comments between top l e v e l S-expressions. F i l e s written by UPDATE or DISKOUT w i l l never have more that one Lisp F i l e I/O Functions 33 I l l The L i s p L i b r a r y Manual 34 form per l i n e . • (DISKOUT F I L E FL1STJ FLIST2 ... F L I S T n) P u r p o s e : w r i t e s t h e f u n c t i o n d e f i n i t i o n s or f o r m s s p e c i f i e d by t h e F L I S T s o u t t o t h e f i l e F I L E . F I L E - an atom, t h e name o f t h e MTS f i l e which i s t o be w r i t t e n i n t o . DISKOUT w i l l n o t empty t h e f i l e b e f o r e w r i t i n g t o i t . F L I S T i - e i t h e r an atom o r a FNS l i s t . I f F L I S T i i s an atom, t h e FNS l i s t s t o r e d under t h e p r o p e r t y n » F N S . " on t h e p r o p e r t y l i s t o f t h e atom, i s r e t r i e v e d . I f F L I S T i i s a l i s t , i t must have t h e f o r m a t o f a FNS l i s t ( see d e s c r i p t i o n o f t h e FNS l i s t i n S e c t i o n 3.ft). The F L I S T i s p e c i f y which f u n c t i o n s and f o r m s a r e t o be w r i t t e n o u t t o t h e f i l e F I L E . The f o r m s a r e w r i t t e n o u t u s i n g t h e p r e t t y p r i n t e r . Any comments a s s o c i a t e d w i t h t h e f o r m s a r e w r i t t e n o u t i m m e d i a t e l y b e f o r e t h e f o r m . The v a l u e r e t u r n e d by DISKOUT i s t h e atom DONE i f t h e DISKOUT was s u c c e s s f u l , and F A IL i f i t was n o t (an e r r o r message w i l l be p r i n t e d i f t h e o u t p u t f a i l e d ) . Example: {DISKIN FIDE) r e a d i n t h e f u n c t i o n s i n FYLE (DISKOUT NEWFYLE FYLE) w r i t e them o u t t o NEWFYLE (DISKOUT -A (LOADFN LOADFUN (QUOTE . MACRO))) w r i t e s o u t t h r e e f o r m s t o t h e f i l e -A. The f u n c t i o n d e f i n i t i o n s o f LOADFN and LOADFUN a r e p r i n t e d and t h e f o r m (DEFPROP QUOTE MACRO v a l u e ) L i s p F i l e I/O F u n c t i o n s I l l The L i s p L i b r a r y Manual 35 m (UPDATE FILE [ FLISTI. F L I S T 2 ... FLISTn]) Purpose: to update the contents of f i l e FILE. FILE - an atom, the name of the MTS f i l e to be updated. F L I S T i - e i t h e r an atom or a FNS l i s t . T h i s argument i s the same as the FLIST argument to DISKOUT. UPDATE w r i t e s out a f i l e i n e x a c t l y the same way as DISKOUT. The f i r s t argument, FILE,, must have been read by DISKIN. A l l the f u n c t i o n s and forms read from FILE are r e -w r i t t e n t o FILE, as well as any f u n c t i o n s or forms s p e c i f i e d by the FLIST arguments. N o t i c e that t h i s f u n c t i o n d i f f e r s from DISKOUT, where FILE i s only the MTS f i l e name. UPDATE t r e a t s FILE as both the f i l e name and an F L I S T i parameter. S i n c e UPDATE i s r e - w r i t i n g an e x i s t i n g f i l e , i t i s p o s s i b l e to l o s e the i n f o r m a t i o n i n the f i l e , due to L i s p e r r o r s , f i l e o verflows, MTS system f a i l u r e s e t c . To prevent t h i s kind of d i s a s t e r , UPDATE makes a copy ( a c t u a l l y an MTS RENAME) of the c u r r e n t contents of FILE before emptying i t and w r i t i n g the new i n f o r m a t i o n . The new f i l e w i l l have the name =FILE. The example below best e x p l a i n s the s e r i e s of MTS commands which are used by the UPDATE f u n c t i o n . Example: (DISKIN MYFILE) read i n the MTS f i l e MYFILE * » • (UPDATE MYFILE) the f u n c t i o n s read from MY FILE by DISKIN are f i r s t w r i t t e n to the s c r a t c h f i l e -MYFILE. The f o l l o w i n g MTS commands are then executed: $DESTROY =MYFILE OK $RENAME MYFILE = MYFILE OK L i s p F i l e I/O Functions I l l The L i s p L i b r a r y Manual 36 $HENAM E -MY FILE MYFILE $TRUNCATE MYFILE $PERMIT MYFILE LIKE =MYFILE The r e s u l t of the above commands i s t o put the new v e r s i o n of t h e f i l e MYFILE i n the f i l e MYFILE, and the p r e v i o u s v e r s i o n of the f i l e i n = MYFILE. ***Note: the f i l e name FILE should not be of the form ID:name, s i n c e UPDATE cannot rename f i l e s under another ID. ?DISKM AXLEN - Both DISKOUT and UPDATE al l o w the user to s e t the maximum output l i n e l e n g t h . By d e f a u l t , t h i s l e n g t h i s 105 c h a r a c t e r s . 7DISKMAXLEN may be set to any value l e s s than 255. Since t h i s l e n g t h does not i n c l u d e the c l o s i n g p a r e n t h e s i s which may be p r i n t e d a t the end of a l i n e , i t should be s e t to 5 or 10 l e s s than the d e s i r e d maximum l e n g t h . a (PP F [TAG]) Purpose: to p r e t t y p r i n t a L i s p s t r u c t u r e . F - the name of the t h i n g to be p r e t t y p r i n t e d . I f an atom, the form under the tag TAG ( d e f a u l t EXPR) i s p r e t t y p r i n t e d . I f F i s a L i s p form, the form i s EVALed and the value p r e t t y p r i n t e d . TAG - the property l i s t tag under which, on the atom F, the form t o be p r e t t y p r i n t e d i s found. TAG d e f a u l t s to EXPR. The f u n c t i o n PP c a l l s the p r e t t y p r i n t e r to p r i n t a L i s p s t r u c t u r e d i r e c t l y on the user's t e r m i n a l . A l l occurrences of the form (QUOTE form) are p r i n t e d as 'form and a l l forms which have Breakpoints on them are p r i n t e d as Sform. L i s p F i l e I/O F u nctions I l l The l i s p L i b r a r y Manual 37 7MAXLEN - T h i s i s the maximum len g t h t h a t output l i n e s are to be p r i n t e d . The d e f a u l t i s 80 but may be r e s e t to any value. T h i s v a l u e i s used only,by PP, not by DISKOUT or UPDATE. Example:. (PP THISF0HCTIOB) p r e t t y p r i n t s the f u n c t i o n THISFUNCTION. (PP PICKUP THEOREM) p r e t t y p r i n t s the form on the p r o p e r t y l i s t of the atom PICKUP under the tag THEOREM. (PP (C ADR (GETL 'FN • (EXPR THEOREM)))) p r e t t y p r i n t s e i t h e r the EXPR or THEOREM d e f i n i t i o n o f FN. (PP (OR X)) p r e t t y p r i n t s the value of X. a 3.C n The P r e t t y p r i n t Algorithm The primary purpose of a p r e t t y p r i n t e r i s to produce an e a s i l y read l i s t i n g of a L i s p s - e x p r e s s i o n ( u s u a l l y a f u n c t i o n d e f i n i t i o n ) : . The s t r u c t u r e of the s - e x p r e s s i o n i s r e f l e c t e d i n the way i t i s p r i n t e d , thus p a r e n t h e s i z a t i o n e r r o r s can be more e a s i l y d e t e c t e d . A secondary p r e r e q u i s i t e , necessary f o r f u n c t i o n s such as UPDATE and DISKOUT, i s that the output be L i s p readable. T h i s i n v o l v e s p r i n t i n g atoms which must be enclosed i n quotes, such as "A B C", with the quotes. The p r e t t y p r i n t a l g o r i t h m used i n t h i s program invokes some simple o v e r a l l r u l e s governing i n d e n t a t i o n , p l u s some s p e c i f i c e x c eptions which make L i s p programs e a s i e r to r e a d . The b a s i c a l g o r i t h m f o r p r e t t y p r i n t i n g a form i s best d e s c r i b e d as L i s p F i l e I/O Functions I l l The L i s p L i b r a r y Manual 38 f o l l o w s : 1. I f the form w i l l f i t on the c u r r e n t output l i n e , s t a r t i n g at the c u r r e n t i n d e n t a t i o n column, p r i n t i t , 2. I f the form i s an atom, p r i n t i t anyways. 3 . (we now have a l i s t to p r i n t ) P r i n t a l e f t p a r e n t h e s i s " (". 4. P r e t t y p r i n t the f i r s t element (CAR) of the s t r u c t u r e . 5. I f the f i r s t element i s an atom, p r e t t y p r i n t the second' element of the l i s t on the same l i n e . 6 . Indent the l e f t margin and p r e t t y p r i n t each of the r e s t of the elements of the l i s t , one per l i n e . 7 . P r i n t the r i g h t p a r e n t h e s i s " ) " . V a r i o u s m o d i f i c a t i o n t o the above a l g o r i t h m have been made to produce a more readable output. 1. A l l s-expressions of the form (QUOTE form) are p r i n t e d as 'form. 2. B r e a k p o i n t s are p r i n t e d as aform by the f u n c t i o n PP, and ignored completely by UPDATE and DISKOUT. 3 . The l o c a l v a r i a b l e s l i s t of a PROG i s p r i n t e d as many elements per l i n e as p o s s i b l e . T h i s e l i m i n a t e s the annoying,problem of the PROG f u n c t i o n with too many v a r i a b l e s to p r i n t on one l i n e p r i n t i n g i t s v a r i a b l e l i s t one per l i n e (as i t would under the r u l e s d e s c r i b e d above). 4. The SETQ and SET f u n c t i o n s are w r i t t e n so as to p a i r t h e i r arguments i n s t e a d of l i s t i n g them one per l i n e . 5. The COHD f u n c t i o n always p r i n t s i t s cases on separate l i n e s . L i s p F i l e I/O Functions I l l The L i s p L i b r a r y Manual 39 o 3.D a Belated Functions A number of other f u n c t i o n s i n t h i s l i b r a r y make use of the FNS l i s t generated by DISKIN. The f u n c t i o n EXTRACTFN, generates a FNS l i s t f o r the f u n c t i o n s i t e x t r a c t s from a l i b r a r y . Thus (EXTRACTFN PP) (DISKOUT -FYLE PP) w i l l p r i n t a copy of the p r e t t y p r i n t e r on the f i l e -FYLE. The f u n c t i o n SORTFILE s o r t s the FNS l i s t a l p h a b e t i c a l l y . XREFFILE w i l l c r o s s r e f e r e n c e a l l the f u n c t i o n s i n a f i l e , using the FNS l i s t . GENLIB uses the FNS l i s t to b u i l d a new l i b r a r y . The e d i t o r command PP c a l l s the p r e t t y p r i n t f u n c t i o n to p r i n t a part of the e d i t e d form. L i s p F i l e I/O Functions I l l The L i s p L i b r a r y Manual 40 n 3.E n Example Consider the f o l l o w i n g MTS f i l e : 1 ; THE 91 FUNCTION 2 (DEFUN F91 (X) 3 (IF (GREATER? X 100) (SUB X 10) 4 (F91 (F91 (ADD X 11))))) 5 6 ; A LISP VERSION OF THE IF STATEMENT 7 ; (IF A B C) IS EQUIVALENT TO 8 ; IF A THEN B ELSE C 9 (DEFUN IF NEXPR ( A B C ) 10 (COND ( (EVAL A) (EVAL B) ) 1 1 (tEVAL C) ) ) ) 12 13 (DEFPROP NON SENSE (WORDS WORDS AND MORE WORDS) ) 14 15 (SETQ Q (LIST 'MAPC 'MAP 'MAPCAR 16 •MAPCAN 'MAPCON 'MAPOB)) We c a l l DISKIN to read i n t h i s f i l e . * * (DISKIN TESTFYLE) > LOADING: DISKIN > 4 FORMS READ FROM: TESTFYLE > * (SETQ ?MAXLEN 50) > 50 * (PP IF) > LOADING: PP > (NLAMBDA ( A B C ) > (COND ((EVAL A) (EVAL B) ) > ((EVAL C )))) > * (PP NON SENSE) > (WORDS WORDS AND MORE WORDS) > * (PP (OR Q) ) > (MAPC MAP MAPCAR MAPCAN MAPLIST MAPCON MAPOB) > * (DISKOUT -A (IF (NON . SENSE))) > LOADING: DISKOUT > DONE * (UPDATE TESTFYLE) > LOADING: UPDATE > FILE: TESTFYLE UPDATED. L i s p F i l e I/O Functions I l l The L i s p L i b r a r y Manual 41 4 THE DEBUG PACKAGE The Debug Package i s a s e t of r o u t i n e s which allow the L i s p programmer to monitor the execution of h i s program, as w e l l as to i n t e r v e n e i n the normal flow of i t s e x e c u t i o n . A s p e c i a l " s t e p " f e a t u r e allows the user the o p t i o n of executing the program i n c r e m e n t a l l y one form at a time. Commands given to the Debug Package allow easy access to i n f o r m a t i o n kept on the L i s p s t a c k , allow c o n t r o l t o be t r a n s f e r r e d to any p o i n t on the stack, and enable the s e t t i n g of " b r e a k p o i n t s " i n a program. These Breakpoints r e t u r n c o n t r o l t o the Debug Package to g i v e the user access t o a l l the commands i n the system. An o p t i o n a l e r r o r p r o c e s s i n g r o u t i n e w i l l t r a p any L i s p e r r o r s which occur i n the normal execution of a program. When an e r r o r o c c u r s , the Debug Package i s a u t o m a t i c a l l y invoked, and the user has a v a i l a b l e t o him a l l of i t s commands. The Debug Package c o n s i s t s of three t o p l e v e l l i b r a r y r o u t i n e s : DEBUG, BREAKF, and UNBREAKF. Loading any one of these f u n c t i o n s , e i t h e r e x p l i c i t l y v i a the LOADFN f u n c t i o n , or i m p l i c i t l y by c a l l i n g i t , w i l l cause a l l of the Debug Package to be loaded. As with other l i b r a r y f u n c t i o n s , the UNLOADFN program w i l l r e l e a s e the fr e e s p a c e occupied by these r o u t i n e s so that the garbage c o l l e c t o r can r e c l a i m i t . The Debug Package I l l The L i s p L i b r a r y Manual 42 a 4,A a Invoking the Debug Package The Debug Package can be invoked i n one of three ways: 1 . Via a Breakpoint s e t by BREAKF 2. By c a l l i n g the f u n c t i o n DEBUG on a form 3. When a L i s p e r r o r occurs The form which caused the break to o c c u r , c a l l e d the breakform i s passed to DEBOGMAIN, the main r o u t i n e i n the Debug Package. I f a break was s e t on a p a r t i c u l a r f u n c t i o n , as i n (BREAKF FQO), the Breakform i s the f i r s t form i n the body of the broken function,. On a L i s p e r r o r , the Breakform i s the form being evaluated when the e r r o r o c c u r r e d . Once the Debug Package has been invoked, a l l c a l l s are t r e a t e d i n the same manner. The Debug Package al l o w s the user to type i n commands d i r e c t i n g i t t o d i s p l a y any form or value s t o r e d on the L i s p s t a c k , e d i t any form on the L i s p stack, set or remove Breakpoints, r e t u r n from any form on the s t a c k , or continue p r o c e s s i n g . Typing STOP or NIL w i l l r e t u r n to the top l e v e l of L i s p j u s t as NIL would do i n a normal L i s p e r r o r break. 4.A .1 Debug Packag_e Handling of E r r o r s The Loader r o u t i n e s enable the Debug Package to t r a p a l l L i s p e r r o r s . T h i s o p t i o n i s i n i t i a l l y o f f , and w i l l be enabled The Debug Package I l l The L i s p L i b r a r y Manual 43 whenever the Debug Package i s loaded. 7DEBUG - d e f a u l t NIL. When ?DEBUG i s non-NIL, any L i s p e r r o r not trapped by the Autoloader, w i l l cause immediate t r a n s f e r to the Debug Package. T h i s switch i s set to T when the Debug Package i s loaded. a 4.B D Breakpoints A Breakpoint i s a f u n c t i o n i n s e r t e d i n t o the user's program which w i l l cause, under c e r t a i n c o n d i t i o n s , the execution of the program to be suspended or broken. When a Breakpoint i s encountered, c o n t r o l i s passed to the Debug Package which w i l l then g i v e the user c o n t r o l over how execution i s to proceed. B r e a k p o i n t s come i n two v a r i e t i e s ; Breakpoints on f u n c t i o n s , and B r e a k p o i n t s on forms w i t h i n a f u n c t i o n . Both types can o p t i o n a l l y have a L i s p p r e d i c a t e a s s o c i a t e d with them which w i l l determine each time they are encountered whether the break i s to be acknowledged or ignored. A Breakpoint on a f u n c t i o n w i l l cause a l l c a l l s to t h a t f u n c t i o n to be broken, s u b j e c t to the p r e d i c a t e . A Breakpoint on a form w i t h i n a f u n c t i o n a l l o w s c l o s e r c o n t r o l of e x a c t l y where a break i s to occur. Both types of Breakpoints are s e t by the BREAKF f u n c t i o n or the BREAK command, and can be removed by the UNBREAKF The Debug Package I l l The L i s p L i b r a r y Manual 44 f u n c t i o n or the UNBREK command. A f u n c t i o n i s broken by p h y s i c a l l y changing the body of the f u n c t i o n . The form being broken i s r e p l a c e d by the form: (BREAKPOINT FORM NAME PREDICATE) where FORM i s the form being broken; NAME i s the name of the break (used by the Debug Package), and PREDICATE i s the p r e d i c a t e which determines whether the break i s to occur. PREDICATE d e f a u l t s to T. I f a s p e c i f i c f u n c t i o n i s broken, FORM i s the f i r s t form within the body of the Lambda ex p r e s s i o n d e f i n i n g the f u n c t i o n . T h i s means th a t a break of a f u n c t i o n name w i l l break a f t e r i t s arguments have been processed and the Lambda v a r i a b l e s have been bound, while a break on a s p e c i f i c form i n a f u n c t i o n o ccurs before the form has been evaluated'. The , P r e t t y p r i n t e r w i l l p r i n t the symbol a» i n f r o n t of any broken form i n the f u n c t i o n being p r i n t e d . The f u n c t i o n s UPDATE and DISKOUT w i l l i gnore any Breakpoints and p r i n t the o r i g i n a l f u n c t i o n . T h i s means t h a t f u n c t i o n s do not have to be unbroken (using UNBREAKF or the command UNBREAK) before they are w r i t t e n on a f i l e using UPDATE or DISKOUT. ?BREAKSW - t h i s i s a switch which when set t o NIL causes a l l Breakpoints to be i g n o r e d . The switch i s s e t to T whenever BREAKF i s c a l l e d , and s e t to NIL when the f u n c t i o n UNBREAKF i s c a l l e d with no arguments, as i n (UN BREAKF). In p a r t i c u l a r , c a l l i n g (BREAKF) w i l l t u r n on the p r o c e s s i n g of B r e a k p o i n t s and c a l l i n g (UNBREAKF) w i l l t u r n o f f the The Debug Package I l l The L i s p L i b r a r y Manual pr o c e s s i n g of Breakpoints. I t i s important to observe that (UNBREAKF) does not remove Breakpoints, i t only stops them from being processed. ?BROKEN - i s a g l o b a l v a r i a b l e which i s set to the l i s t of a l l c u r r e n t Breakpoints. BREAKF adds i t s arguments t o t h i s l i s t , and UNBREAKF removes i t s arguments from the l i s t . Example:. c o n s i d e r the f o l l o w i n g f u n c t i o n s : > * (PP SUM) > (LAMBDA (A B) (ADD (FACT A) (FACT B) ) ) > * (PP FACT) > (LAMBDA (X) > (sCOND ( (LESSP X 2) 1) > ( (TIMES X (FACT (SUB1 X ) ) ) ) ) ) > * (DEBUG (SUM 3 4) ) > LOADING: DEBUG 0=>(SUM 3 4) 3 BREAK FACT 0=> BREAK a FACT a We now have s e t a Breakpoint on the f u n c t i o n FACT. Exe c u t i o n c o n t i n u e s by using the CONTINUE command: a 3 CONTINUE 0=7> AT: FACT a PRINT 0=>(COND ((LESSP X 2) 1) ( (TIMES X (FACT (SUB1 X) ) ) ) ) 9 CONTINUE 0=> AT: FACT a PRINT 0=>(COND ( (LESSP X 2) 1) ((TIMES X (FACT (SUB1 X ) ) ) ) ) 3 CONTINUE 0=> AT: FACT 3 BKF 0=>COND 0=>FACT 0=>TIMES 0=>COND 0=>FACT 0=>TIMES 0=>COND 0=>FACT The Debug Package I l l The L i s p L i b r a r y Manual 0=>ADD 0=>SUM oi At t h i s p o i n t we have re- e n t e r e d FACT 3 times r e c u r s i v e l y , breaking on the f i r s t form i n FACT (the COND) each time, He now r e s t a r t the execution of SUM by use of the GO command: a a GO SUM 0=>(SUM 3 4) a UNBR FACT 3 BREAK (FACT IN SUM) 0=> BREAK 3 (FACT IN SUM) a Having c l e a r e d the o l d break of FACT and s e t a Breakpoint on the c a l l s to FACT w i t h i n the f u n c t i o n SUM, we f i r s t STEP to the f i r s t form i n SUM, then c o n t i n u e e x e c u t i o n : a a STEP 0=>(ADD a (FACT A) a(FACT B)) a CONTINUE 0=> AT: (FACT IN SUM) a PRINT 0=>(FACT A) 3 CONTINUE 0=> AT: (FACT IN SUM) a PRINT 0=>(FACT B) a CONTINUE > 30 No t i c e t h a t t h i s time we only stopped twice, once f o r each c a l l of FACT from w i t h i n SUM, but not f o r the r e c u r s i v e c a l l s t o FACT. 4» B. 1 Pseudo-breaJ<£oints In o r d e r to give the user the a b i l i t y to "s t e p " through a program the Debug Package s e t s up E§§Jl£2z]2£eak£oints i n the user programs. A pseudo-breakpoint behaves l i k e a Breakpoint s et by the BREAKF f u n c t i o n , but does not r e a l l y appear i n the user's The Debug Package I l l The L i s p L i b r a r y Manual 47 program. I t i s s e t by using the L i s p STEP f u n c t i o n , which causes the L i s p i n t e r p r e t e r to s i g n a l an e r r o r a f t e r a s p e c i f i e d number of i n t e r n a l c a l l s to EVAL. The e r r o r i s trapped by the Debug Package which i n t u r n a l l o w s the user to continue t y p i n g commands, The Debug Package w i l l not set a pseudo-breakpoint on the f u n c t i o n s QUOTE, LAMBDA, FLAMBDA, NLAMBDA, DUMP, or STEP. Thus, i n stepping through a program, the Debug Package w i l l not stop at any of these f u n c t i o n s , but w i l l pass them and stop at the next f u n c t i o n . • 4» C • The S t a c k p o i n t e r The commands GO, FIND, and EDIT a l l allow a s e r i e s of l o c a t o r parameters which are used to set an i n t e r n a l Sili£JS£°i£*®£ t G a p a r t i c u l a r form on the L i s p stack. The l o c a t o r s are atomic f u n c t i o n names. Each l o c a t o r i s processed i n order and r e s u l t s i n moving the s t a c k p o i n t e r down the stack (towards top l e v e l L i s p ) t o po i n t to the next occurrence of a c a l l to the f u n c t i o n s p e c i f i e d by the l o c a t o r . Consider the s i t u a t i o n i n which the stack has on i t the forms: (ADD ... (COND (( (F ... (ADD ... The Debug Package I l l The L i s p L i b r a r y Manual 48 (COND ( ( . . . (F ... The l o c a t o r s COND ADD would set the Stackpointer to the f o u r t h form from the top of the l i s t . From t h i s p o i n t , the l o c a t o r F would s e t the Stackpointer to,the bottom form i n t h i s l i s t . Once the Stackpointer has been set, the a c t i o n s s p e c i f i e d by the commands EDIT, GO, and VALUE are executed as i f the user were a t that point i n the execution of the program. The command TOP i s used to r e s e t the St a c k p o i n t e r to the top of the L i s p stack, that i s , p o i n t i n g to the Breakform. • 4.D • The Functions m (BBEAKF £1 F2 ... Fn) Purpose: t h i s f u n c t i o n allows the user to set Breakpoints i n h i s program. The f u n c t i o n i s a Fexpr which w i l l take an i n d e f i n i t e number of arguments. F i - the s p e c i f i c a t i o n of where a Breakpoint i s to be s e t . I f F i i s an atom, i t must be the name of a user defined f u n c t i o n which i s to be broken. The break i s u n c o n d i t i o n a l ; each c a l l to t h i s f u n c t i o n w i l l cause a break to occur. Because i t i s necessary to change the a c t u a l Lambda expression of the f u n c t i o n d e f i n i t i o n , only Exprs may be broken, not Subrs. The Debug Package I l l The L i s p L i b r a r y Manual 49 I f F i i s a l i s t of the form (Fn1 IN Fn2) , a l l c a l l s to the f u n c t i o n Fn1 which occur i n the body of the f u n c t i o n -Fn2 w i l l be broken. As with the previous case, Fn2 must not be a Subr. The f u n c t i o n Fn1 may be e i t h e r an Expr or a Subr. Breakpoints may have a s s o c i a t e d with them a p r e d i c a t e which w i l l be eva l u a t e d when c o n t r o l reaches the Breakpoint. I f the p r e d i c a t e e v a l u a t e s to NIL the Breakpoint i s ignored and exec u t i o n proceeds normally. I f the p r e d i c a t e e v a l u a t e s to a non^-NIL value, the break i s taken. I f a ' p r e d i c a t e i s to be s p e c i f i e d at a Bre a k p o i n t , F i must be a l i s t of the form (WHERE PREDICATE) where the argument WHERE i s e i t h e r a f u n c t i o n name or a l i s t of the form (Fnl IN F n 2 ), as de s c r i b e d above, and PREDICATE i s the L i s p form which w i l l be evaluated as the p r e d i c a t e t e s t . Thus, the fo u r p o s s i b l e forms of the argument F i are: FOO (F001 IN F002) (FOO (EQ A B) ) ( ( F 0 0 1 IN F002) (ATOM X)) The Debug Package I l l The L i s p L i b r a r y Manual 50 • (UNBREAKF JM F2 ... Fn) Purpose: t o remove Breakpoints s e t by the f u n c t i o n BREAKF. F i " the s p e c i f i c a t i o n of what i s to be unbroken. T h i s argument has the same form as the two BREAKF argument forms which do not s p e c i f y a p r e d i c a t e . I f F i i s an atom, the f u n c t i o n of t h a t name has i t s break removed; i f F i i s a l i s t of the form (Fn1 IN Fn2), a l l Breakpoints of the f u n c t i o n Fn1 w i t h i n the f u n c t i o n Fn2 are removed. The s p e c i a l case of a c a l l to UNBREAKF with no arguments w i l l t u r n o f f a l l Breakpoints t e m p o r a r i l y , u n t i l the f u n c t i o n BREAKF i s c a l l e d again (See BREAKF above). m (DEBUG FORM) Purpose: t o c a l l the Debug Package e x p l i c i t l y on the form FORM. FORM - an a r b i t r a r y L i s p form. Example: (DEBUG (F 27)) begins a c a l l t o the f u n c t i o n F and immediately c a l l s the Debug Package with (F 27) as the f i r s t Breakform. Examples: Consider the f u n c t i o n F d e f i n e d as f o l l o w s : * * (PP F) > (LAMBDA (X) > (COND ( (GREATERP X 100) (SUB X 10)) > (T (F (F (ADD X 1 1 ) ) ) ) ) ) > We f i r s t s e t a Breakpoint on the f u n c t i o n F: * * (BREAKF F) 0=> BREAK 9 F > DONE * <F 27) 0=> AT: F 9 CONTINUE 0=> AT: F «B UNBR F The Debug Package I l l The L i s p L i b r a r y Manual 51 S CONTINUE > 91 > N o t i c e that t h i s type of Breakpoint causes a break on each r e c u r s i v e c a l l to F. The f i n a l value r e t u r n e d i s 91. Now we s e t Breakpoints on s p e c i f i c forms with the f u n c t i o n F: * * {BREAKF (ADD IN F) (SUB IN F) ) 0=> BREAK a (ADD IN F) 0=> BREAK a (SUB IN F) > DONE * (F 34) 0=> AT: (ADD IN F) 3 CONTINUE 0=> AT: (ADD IN F) a CONTINUE 0=> AT: (ADD IN F) a UNBR (ADD IN F) | a CONTINUE 0=> AT: (SUB IN F) a STOP > **STOP** * In the next case, we turn o f f a l l breaks by c a l l i n g UN BREAKF with no arguments. * * (UNBREAKF) > DONE * (F 45) > 91 * I f we c a l l BREAKF again, again. the breaks w i l l be turned on * * (BREAKF) > DONE * (F 56) 0=> AT: (SUB IN F) a STOP > **STOP** * (UNBREAKF (SUB IN F) ) > DON E * We next s e t a c o n d i t i o n a l break on the c a l l t o COND w i t h i n the f u n c t i o n F. * * (BREAKF ((COND IN F) (EQ X 91))) 0=> BREAK 3 (COND IN F) The Debug Package I l l The L i s p L i b r a r y Manual 52 > DONE * (F 54) 0=> AT: (COND IN F) 3 X 0=> X = 91 3 3 CONTINUE 0=> AT: (COND IN F) a X 0=> X = 91 a BKF 0=>COND 0=>F 0=>COND 0 = >F 0=>F 0=>COND 0=>F 0=>F 0=>COND 0=>F a CONTINUE 0=> AT: (COND IN F) 3 CONTINUE 0=> AT: (COND IN F) a CONTINUE > 91 * N o t i c e t h a t i n t h i s l a s t i n s t a n c e t h a t although the COND has been executed many times (as i s i n d i c a t e d by the backtrace p r i n t e d by BKF), the break occurred only when the value of X was 91. The Debug Package I ' l l The L i s p L i b r a r y Manual n 4.E n The Debug Commands 53 The f o l l o w i n g l i s t of commands are broken l o o s e l y i n t o t h r e e groups; the commands which c o n t r o l or a l t e r the flow of exe c u t i o n of the user's program, those which f i n d and look at forms on the L i s p stack, and those which manipulate Breakpoints. Some commands, such as GO, c o u l d belong l o g i c a l l y t o more than one of these groups. The d i v i s i o n i s somewhat a r b i t r a r y . 4. E; 1 Inp_ut Format In order t o d i s t i n g u i s h user typed i n p u t l i n e s from l i n e s p r i n t e d by the Debug Package, and to a i d the user i n determining when the Debug Package i s expecting i n p u t , p r e f i x c h a r a c t e r s are used on a l l i n p u t and output i n the Debug Package. The s i n g l e symbol "S" precedes a l l l i n e s of i n p u t and i s typed by the system whenever the Debug Package expects a command to be typed i n . The symbols "n=>" where n i s an i n t e g e r precedes each l i n e of output. The number n i n d i c a t e s the break l e v e l t h a t the Debug Package i s c u r r e n t l y o p e r a t i n g i n . T h i s l e v e l number i s normally 0 , but i f an e r r o r occurs i n the e v a l u a t i o n of a form from w i t h i n the Debug Package, the l e v e l number i s i n c r e a s e d by one*. The Debug Package w i l l allow m u l t i p l e commands on a l i n e . The Debug Package I l l The L i s p L i b r a r y Manual 54. Where ambiguity may occur between the o p t i o n a l parameters of one command and the next command, the atom : may be used as a separator, The Debug Package t r e a t s each e n d - o f - l i n e as i f there were a :, hence commands may not span more than one l i n e . I f a L i s p form or an atom which i s not a command name i s entered, the Debug Package w i l l p r i n t the r e s u l t of EVALing the form, or p r i n t the value of the v a r i a b l e . • HELP :— gives a short (1 l i n e ) d e s c r i p t i o n of each command a v a i l a b l e i n the Debug Package. The d e s c r i p t i o n i s not intended to be i n any way complete - i t should only serve as a reminder of what a command does or what i t expects as an argument. 4. E. 2 Program C o n t r o l Commands a CONTINUE A b b r e v i a t i o n : CO C -- continue execution of the user's program, s t a r t i n g with the Breakform. I f the Breakform has already been EVALed by the command EVAL, i t w i l l not be re-evaluated. Mo pseudo-breakpoint i s s e t , only an e r r o r or Breakpoint w i l l cause the r e - i n v o c a t i o n of the Debug Package. The Debug Package I l l The L i s p L i b r a r y Manual 55 EV AL A b b r e v i a t i o n : E — ev a l u a t e the Breakform and p r i n t i t s v a l u e . The value i s r e t a i n e d so t h a t the CONTINUE and NEXT commands w i l l not r e - e v a l u a t e the form. I f an e r r o r occurs i n EVALing the Breakform, the Debug Package i s re-invoked a t a higher l e v e l number. The UP command d e s c r i b e s how to r e t u r n from t h i s new break l e v e l . GO [LOCJ LOC2 ... LOCn ] — go to the pl a c e on the L i s p stack determined by the l o c a t o r s L0C1 LOC2 ... LOCn. The LOCi are st a c k l o c a t o r s as d e s c r i b e d i n the s e c t i o n above on the S t a c k p o i n t e r . A f t e r r e s e t i n g the S t a c k p o i n t e r , the command GO t r a n s f e r s t o the form po i n t e d to by the S t a c k p o i n t e r . A pseudo-breakpoint i s set a t the new form causing the Debug Package to immediately break on t h i s form. The e f f e c t of the GO command i s to r e s t a r t the execution of the user's program a t some previous f u n c t i o n c a l l . T h i s can be u s e f u l when v a r i a b l e bindings may be i n c o r r e c t due to some e r r o r i n the program. R e s t a r t i n g the PROG or Lambda ex p r e s s i o n which bound them w i l l cause these v a r i a b l e s to be rebound. NEXT A b b r e v i a t i o n : NX N — the c u r r e n t Breakform i s evaluated i f i t has not a l r e a d y been EVALed by the EVAL command, and c o n t r o l t r a n s f e r s to the next form i n the user's program. T h i s enables the user to a v o i d s t e p p i n g through a l l the f u n c t i o n c a l l s i n the Breakform but s t i l l c ausing the Debug Package t o stop at the next form a f t e r the Breakform. T h i s can be p a r t i c u l a r l y u s e f u l i n f u n c t i o n s which c o n t a i n a s e r i e s of forms or statements such as PROGs, LAMBDAS, CONDs, SELECTQs, e t c . RETURN FORM A b b r e v i a t i o n : RET R the form FOEM i s evaluated and returned as the value of the Breakform. A pseudo-breakpoint i s s e t f o r the next form i n the user's program. As with EVAL, i f an e r r o r occurs i n the e v a l u a t i o n of FORM, the Debug Package i s re-entered one break l e v e l h i gher. The UP or | command can be used to r e t u r n to the pre v i o u s break l e v e l , RETURN provi d e s a convenient way of r e t u r n i n g the " c o r r e c t " value from a f u n c t i o n which i s not working c o r r e c t l y . The Debug Package I l l The L i s p L i b r a r y Manual 56 STEP [N] A b b r e v i a t i o n : ST S execution of the Breakform continues, with a pseudo-breakpoint s e t f o r the Nth form to be executed. The d e f a u l t value of N i s 1. Thus STEP 1 w i l l break a f t e r one form has been evaluated, STEP 3 a f t e r three forms have been e v a l u a t e d , e t c , Note t h a t u n l i k e NEXT and CONTINUE, STEP begins e v a l u a t i o n o f the Breakform r e g a r d l e s s of whether i t has been e x p l i c i t l y EVALed by the EVAL command. STOP A b b r e v i a t i o n : NIL || — stops execution of the program and r e t u r n s to the top l e v e l of L i s p , Thus NIL typed a f t e r an e r r o r , b r e a k has the same e f f e c t as i t does when the L i s p e r r o r breaks are i n e f f e c t , UP A b b r e v i a t i o n : | used when an e r r o r or break has oc c u r r e d i n the e v a l u a t i o n of a form from w i t h i n the Debug Package. In t h i s case the output p r e f i x w i l l be n=> with n non-zero (the normal p r e f i x i s 0=>). T h i s command w i l l r e t u r n to the p r e v i o u s l e v e l of the Debug Package. The r e t u r n i s not t o the command which caused the e r r o r , but back to the command p r o c e s s o r . The S t a c k p o i n t e r w i l l be r e s e t to the Breakform and the Debug Package w i l l s t a r t p r o c e s s i n g commands again. USE FORM — used to c o r r e c t undefined f u n c t i o n or undefined atom e r r o r s . Often these e r r o r s are caused by m i s s p e l l i n g an atom or f u n c t i o n name. The USE command can be used to c o r r e c t these e r r o r s without the n e c e s s i t y of c a l l i n g the E d i t o r . The value of FORM i s s u b s t i t u t e d f o r the e r r i n g atom or f u n c t i o n name. The change i s permanent; i t i s done by a RPLACA on the a c t u a l form i n the program. A f t e r making the change, the c o r r e c t e d form i s p r i n t e d out. The Debug Package I l l The L i s p L i b r a r y Manual 57 4. E. 3 Stack Commands These commands manipulate and d i s p l a y i n f o r m a t i o n s t o r e d on the L i s p s t a c k . The p r i n t commands ? and P are i n c l u d e d i n t h i s grouvp s i n c e they; p r i n t the Breakform, which i s the top form on the s t a c k . 7 — p r i n t the c u r r e n t Breakform. The complete form i s p r i n t e d i n c l u d i n g any c a l l s to BREAKPOINT (see PRINT below) . • BACK [;N ] A b b r e v i a t i o n : BKE BK p r i n t a backtrace of N forms on the stack, s t a r t i n g at the p o i n t s p e c i f i e d by the S t a c k p o i n t e r , which i s normally s e t to the Breakform. The d e f a u l t value f o r N i s 10. I f the g l o b a l switch 7TERSE i s non-NIL (the d e f a u l t ) , only one l i n e i s p r i n t e d f o r each form. Only f u n c t i o n s i n the user's program appear i n the backtrace; i f any f u n c t i o n s which are p a r t of the Debug Package are on the stack they are i n d i c a t e d by a s e r i e s of th r e e dots. I f N i s the atom FULL, a f u l l b acktrace w i l l be p r i n t e d . T h i s i s e f f e c t i v e l y e q u i v a l e n t t o an i n f i n i t e v a l u e f o r N. ~* m BKF [N] ipri n t a backtrace of the names of N forms on the stack. T h i s command works the same as BKE above, but p r i n t s only the f u n c t i o n names, not the whole form. • EDIT [LOCI LOC2 ... LOCn] A b b r e v i a t i o n : ED — c a l l s the L i s p e d i t o r on the form on the stack i n d i c a t e d by the S t a c k p o i n t e r . The l o c a t o r s LOCi are f i r s t used to set the S t a c k p o i n t e r . In the s i m p l e s t case, i f the f i r s t command entered a f t e r a break i s EDIT, the form broken i s sent to the e d i t o r . The e d i t o r command OK w i l l r e t u r n c o n t r o l to the Debug Package. The Debug Package I l l The L i s p L i b r a r y Manual 58 » FIND [LOCI LOC2 ... LOCn] A b b r e v i a t i o n : F — t h i s f u n c t i o n i s used to s e t the S t a c k p o i n t e r . The form p o i n t e d t o by the S t a c k p o i n t e r i s p r i n t e d out. • PR'INT A b b r e v i a t i o n : P -- p r i n t s out the form pointed t o by the S t a c k p o i n t e r . The form i s p r i n t e d i n a t e r s e (one l i n e ) mode and has a l l quoted f u n c t i o n s p r i n t e d as 'FORM and a l l Breakpoints p r i n t e d as 2)F0RM, where FORM i s the broken form. T h i s same p r i n t r o u t i n e i s used by BACK and FIND to p r i n t forms on the s t a c k . m TOP — r e s e t s the S t a c k p o i n t e r back to the top of the stack (the Breakform) . \ « VALUE FORM A b b r e v i a t i o n : V p r i n t s out the e v a l u a t i o n of FORM at the p o i n t on the stack i n d i c a t e d by the S t a c k p o i n t e r . T h i s command allo w s the user to d i s p l a y the value of v a r i a b l e s bound on the stack at some pr e v i o u s l e v e l of a r e c u r s i o n . FORM may c o n t a i n f u n c t i o n c a l l s to simple l i s t s e a r c h i n g or p r e d i c a t e Subrs. The e x e c u t i o n of FORM i s simulated by the VALUE command si n c e L i s p o n l y has the f a c i l i t y t o f i n d v a l u e s o f atoms bound on the s t a c k , not forms. The VALUE command determines the values of a l l atoms i n the FORM, then a p p l i e s the f u n c t i o n s of the FORM to these values. P o s s i b l e f u n c t i o n s which can be used i n the FORM are: CAR, CDR e t c . , NTH, ATOM, LISTP e t c . 4 .E. 4 B r e a k p o i n t Commands The f o l l o w i n g commands have s i m i l a r e f f e c t s to the f u n c t i o n s BREAKF and UNBREAKF, and can be used i n c o n j u n c t i o n with these f u n c t i o n s . The command ?BREAK e v a l u a t e s the g l o b a l The Debug Package I l l The L i s p L i b r a r y Manual 59 l i s t 7BR0KEN which i s a l i s t of a l l Breakpoints c u r r e n t l y s e t . a 'BREAK'['Ji F2 ... F n ] A b b r e v i a t i o n : ?BR p r i n t s a l i s t of the broken f u n c t i o n s . I f no arguments are g i v e n , a complete l i s t of a l l c u r r e n t Breakpoints i s p r i n t e d . I f F i i s a f u n c t i o n name, a l l breaks of the form (FN IN Fi) are p r i n t e d , as w e l l as i n d i c a t i n g whether the f u n c t i o n F i i s broken. m BREAK [ F1. F2 . . . F n ] A b b r e v i a t i o n : BR — s e t s Breakpoints a t the l o c a t i o n s s p e c i f i e d by the F i i n the same way as the f u n c t i o n BREAKF does. As i n the f u n c t i o n BREAKF, i f F i i s an atom, the Expr F i i s broken, i f F i i s of the form (Fn1 IN Fn2), a l l c a l l s to Fn1 from w i t h i n Fn2 are broken. I f F i i s of the form (WHERE PREDICATE), the Breakpoint a t l o c a t i o n WHERE (which must be of the form F i or (Fn1 IN Fn2)as above) i s made c o n d i t i o n a l on the form PREDICATE being non-NIL. As with BREAKF, t y p i n g the command BREAK with no arguments, w i l l r e s e t the g l o b a l s w i t c h ?BREAKSW. (See the s e c t i o n on Breakpoints f o r a more d e t a i l e d d e s c r i p t i o n of how Break p o i n t s are implemented. ) m UNBREAK [ F1 F2? ... F n ] A b b r e v i a t i o n : UNBR removes the Breakpoints s e t by the BREAK command or the BREAKF f u n c t i o n . The arguments F i are of the same form as N i n the f u n c t i o n UNBREAKF; i f F i i s a f u n c t i o n name, th a t f u n c t i o n i s unbroken, i f F i i s of the form (Fn1 IN Fn2)f a l l B r e a k p o i n t s of the f u n c t i o n Fn1 i n the body of the f u n c t i o n Fn1 are removed. As with UNBREAKF, t y p i n g the command UNBREAK with no arguments w i l l s e t the switch 7BREAKSW to NIL, thus d i s a b l i n g a l l breaks t e m p o r a r i l y . (See the BREAKF and UNBREAKF f u n c t i o n s , and the d e s c r i p t i o n of Breakpoints) The Debug Package I l l The L i s p L i b r a r y Manual 60 4.E. 5 R e s t r i c t i o n s 1. The Debug Package uses the STEP f u n c t i o n to s e t pseudo-breakpoints, hence the user should a v o i d using t h i s f u n c t i o n i n h i s own programs. 2. The Debug Package w i l l step over any c a l l s to the f u n c t i o n s STEP, LAMBDA, FLAMBDA, NLAMBDA, DUMP, BREAK, and QUOTE. 3. A t t e n t i o n and program i n t e r r u p t s are not trapped by the Debug Package, They are handled i n the usual way by the L i s p e r r o r h a n d l i n g r o u t i n e s , 4. The atoms DEBUGIN, DEBUGOUT, 7TERSE, ?BACK#, 7BREAKSW, 7DEBUG, 7BROKEN, BPOINT? and DEBUG* are a l l g l o b a l atoms used by the Debug Package and should not be a l t e r e d a c c i d e n t a l l y . 5. Using the STEP, NEXT, and RETURN commands i t i s p o s s i b l e to s e t a pseudo-breakpoint a t the end of the program which w i l l not be i n the user's program. In t h i s case the next form typed to L i s p a f t e r the Debug Package has been e x i t e d may re-invoke the Debug Package. T h i s can be very c o n f u s i n g . Typing the command CONTINUE w i l l allow the program t o cont i n u e . Example: The f o l l o w i n g example i l l u s t r a t e s how the Debug Package e r r o r handling works: * (PP PRLEN) > (LAMBDA (X) > fcCOND ( (ATOM X) (PLEN X)) > ( (CDR S) > (ADD 1 > (PRLEN (CAR X) ) > (PRLEN (CDR X)))) > ( (ADD 2 (PRLEN (CAR X) ) ) ) ) ) > * (LOADFN DEBUG) > T * (PRLEN • (THIS IS (A LIST))) + ***16 UNDEFINED ATOM + S + 0=>(CDR S) o> We have d e f i n e d a f u n c t i o n PRLEN, and loaded the Debug Package to monitor the e x e c u t i o n of t h i s f u n c t i o n . When the e r r o r i s de t e c t e d we are immediately t r a n s f e r e d to the The Debug Package I l l The L i s p L i b r a r y Manual 61 Debug Package with the Breakform set to the form which caused the e r r o r . a a V A L U E x 0=> X = (THIS IS (A LIST}) a VALUE S 0=> S = *UNDEF* a USE x 0=> (CDR X) a A f t e r checking the va l u e s of X and S, we use the USE command to c o r r e c t the e r r o r . a a STEP 0=>(ADD 1 (PRLEN (CAR X)) (PRLEN (CDS X))) a STEP 0=>(PRLEN (CAR X)) a NEXT 0=>(PRLEN (CDR X)) a X 0=> X = (THIS IS (A LIST) ) a EVAL 0=> 13 3 CONTINUE > 18 * The STEP and NEXT f u n c t i o n s are used to proceed with the execution o f the program. The command EVAL e v a l u a t e s the Breakform (PRLEN (CDR X)) which y i e l d s the value 13, then CONTINUE continues execution which f i n a l l y r e s u l t s i n the value 18 f o r the f u n c t i o n . c The Debug Package I l l The L i s p L i b r a r y Manual 5 FUNCTION ANALYSIS ROUTINES 6 2 The f u n c t i o n s described i n the s e c t i o n are a group of u t i l i t y , r o u t i n e s which provide the user with information about the s t r u c t u r e of his programs. The f u n c t i o n FNMAP allows the user to f i n d out what f u n c t i o n s are c u r r e n t l y defined, and FNSIZE gives the s i z e of L i s p f u n c t i o n s . F i n a l l y , the f u n c t i o n s XREF and XREFFIL'E provide a s t r u c t u r a l a n a l y s i s of a program or group of programs. * (FNMAP [ F I L E ] [TAGS]) Purpose: t h i s f u n c t i o n produces a l i s t of a l l atoms on the OBLIST which have a p a r t i c u l a r property tag. FILE - the MTS f i l e or device on which the output i s p r i n t e d . The d e f a u l t i s *SINK*, the user's t e r m i n a l . TAGS - a l i s t of property tags that FNMAP w i l l look f o r . The d e f a u l t i s (EXPR) , Note that i f t h i s argument i s s p e c i f i e d , the FILE argument must a l s o be s p e c i f i e d . FNMAP searches the OBLIST t e s t i n g each atom f o r the p r o p e r t i e s s p e c i f i e d . A t a b l e i s produced of the atoms and the property tag that.was found. Example: (FNMAP) gives a .table of a l l Exprs c u r r e n t l y defined. (FNMAP *SINK* (SUBR FSUBR NSUBR)) gives a t a b l e of a l l Subr type f u n c t i o n s (FNMAP -A (GRAMMAR THEOREM)) p r i n t s a t a b l e of a l l atoms with e i t h e r the tag GRAMMAR or THEOREM onto the MTS f i l e -A. Function A n a l y s i s Routines I l l The L i s p L i b r a r y Manual 63 m (FNSIZE F1 F 2 ... Fn) Purpose; to determine the s i z e of the f u n c t i o n s F i . F i - an atom, the name of the f u n c t i o n t o be a n a l y i z e d . FNSIZE counts the number of cons c e l l s i n the d e f i n i t i o n of each f u n c t i o n F i and p r i n t s a t a b l e of the f u n c t i o n names, t h e i r s i z e s , and the t o t a l s i z e of a l l the f u n c t i o n s . Example: (FNSIZE FNSIZE) g i v e s the s i z e of the f u n c t i o n FNSIZE. (FNSIZE DISKIN DISKIN 1 DISKINCOM) p r i n t s a t a b l e of the s i z e s of s u b f u n c t i o n s of the DISKIN r o u t i n e . a 5 . A • The Cross Reference Program The c r o s s r e f e r e n c i n g program, XREF, i s used to analyze the s t r u c t u r e of L i s p programs. C a l l i n g (XREF FN) where FN i s a L i s p Expr, w i l l produce a s t r u c t u r a l a n a l y s i s of FN. The a n a l y s i s i n c l u d e s a l i s t of a l l other Exprs c a l l e d by FN, a l l l o c a l and g l o b a l v a r i a b l e s used by FN, o p t i o n a l l y a l l Subrs c a l l e d by FN, and a l i s t of a l l other Exprs analyzed by XREF which c a l l FN. As w e l l as a n a l y z i n g FN, XREF a l s o produces the same i n f o r m a t i o n about a l l f u n c t i o n s c a l l e d by FN, and a l l f u n c t i o n s they c a l l e t c . A number of g l o b a l switches are used by the XREF r o u t i n e s F u n c t i o n A n a l y s i s Routines I l l The L i s p L i b r a r y Manual 64 to allow the user some c o n t r o l over what fu n c t i o n s are or are not t o be analyzed by the c r o s s r e f e r e n c e s These switches are descibed at the end of t h i s s e c t i o n . • (XREF F [ OUTFILE]) Purpose: t h i s f u n c t i o n produces a cross r e f e r e n c i n g of the f u n c t i o n s s p e c i f i e d by F. F - e i t h e r a s i n g l e name of a f u n c t i o n which i s to be c r o s s referenced; or a l i s t of f u n c t i o n s to be c r o s s referenced. OUTFILE - the name of the MTS f i l e or device where the output i s t o be p r i n t e d . The d e f a u l t OUTFILE i s *SINK*, the user's termina1. XREF p r i n t s , f o r each f u n c t i o n i n the l i s t F, a t r e e i n d i c a t i n g which f u n c t i o n s c a l l which other f u n c t i o n s . The t r e e i s printed 5 h o r i z o n t a l l y on the page, s t a r t i n g at the top l e f t and growing towards the bottom r i g h t of the page. I f the argument F i s a l i s t of f u n c t i o n s , a separate t r e e i s p r i n t e d f o r each f u n c t i o n i n F., Each f u n c t i o n i s expanded only once i n the t r e e , at the time i t i s f i r s t p r i n t e d on the page. Aft e r the t r e e i s p r i n t e d , each of the f u n c t i o n s are l i s t e d , a l p h a b e t i c a l l y , along with the f o l l o w i n g i n f o r m a t i o n : 1 . I t s parameter l i s t . 2. I t s type (EXPR, FEXPR, NEXPR). 3 . Any comments which may have been associated with the f u n c t i o n by the DISKIN r o u t i n e . 4 . A l i s t of other EXPRs c a l l e d by t h i s f u n c t i o n . 5. A l i s t of Exprs which XREF has encountered i n t h i s a n a l y s i s which c a l l t h i s f u n c t i o n . Function A n a l y s i s Routines I l l The L i s p L i b r a r y Manual 65 6. A l i s t of l o c a l v a r i a b l e s . These are a l l PROG and Lambda v a r i a b l e s i n the body of the f u n c t i o n . 7 . A l i s t of a l l g l o b a l v a r i a b l e s used by t h i s f u n c t i o n . 8. O p t i o n a l l y , a l i s t of Subrs c a l l e d by t h i s f u n c t i o n . A number ofi switches can be set to c o n t r o l some of the d e c i s i o n s t h a t XREF makes. These switches allow the user to s p e c i f y the cross r e f e r e n c i n g of Subrs, L i b r a r y f u n c t i o n s , and i n h i b i t cross r e f e r e n c i n g c e r t a i n Exprs which would normally be looked at. A l l switches d e f a u l t t o t h e i r most common s e t t i n g . XREFEXPRS - d e f a u l t T. I f set to a l i s t of f u n c t i o n names, only these f u n c t i o n s w i l l be analyzed by XREF. I f set to T, the d e f a u l t , a l l Exprs c a l l e d by a f u n c t i o n being analyzed by XREF w i l l themselves be analyzed. L i b r a r y Exprs are t r e a t e d s e p a r a t e l y . I f XREFEXPRS i s set to NIL, only f u n c t i o n s e x p l i c i t l y mentioned i n the F argument of XREF w i l l be analyzed. XREFLIB - d e f a u l t NIL. I f set to a l i s t of L i b r a r y f u n c t i o n names, these f u n c t i o n s w i l l a l s o be analyzed by XREF. I f set to T, a l l L i b r a r y f u n c t i o n s w i l l be XREFed. I f set to NIL, the d e f a u l t , L i b r a r y r o u t i n e s w i l l be l i s t e d as being Exprs c a l l e d by a f u n c t i o n , but the r o u t i n e s themselves w i l l not be XREFed. XREFNOT - d e f a u l t NIL. I f any of the v a r i a b l e s XREFEXPRS, XREFLIB, or XREFSUBBS i s set t o T, t h i s l i s t can be used to o v e r r i d e the XREFing of s e l e c t e d f u n c t i o n s . Any f u n c t i o n name i n rthis l i s t w i l l not be XREFed, despite the s e t t i n g of the other v a r i a b l e s . Function A n a l y s i s Routines I l l The L i s p L i b r a r y Manual 66 XREFSUBRS - d e f a u l t NIL. I f s e t to a l i s t of Subr names, any occurrences of these Subrs i n one of the f u n c t i o n s being XREFed w i l l r e s u l t i n t h a t Subr being mentioned i n the t a b l e of i n f o r m a t i o n p r i n t e d f o r the f u n c t i o n . I f s e t to T, a l l Subrs i n the f u n c t i o n being XREFed w i l l be . l i s t e d . I f XREFSUBRS i s NIL, no Subrs w i l l be XREFed. Example: In t h i s example we c a l l XREF on the f u n c t i o n LOADFN of the load e r r o u t i n e s . The l i s t XREFSUBRS i s s e t to the l i s t of f u n c t i o n s which we want the XREF r o u t i n e t o t e l l us about f o r each f u n c t i o n i t encounters. * * (SETQ XREFSUBRS ' (PROG LAMBDA RETURN GO) ) > (PROG LAMBDA RETURN GO) * (XREF LOADFN) CROSS REFERENCE FOR: LOADFN MAR 28, 1 9 7 4 20:20:16 LOADFN LOADFUN LOADS ETUP LOADINDEX READFROM LOADFUN* READFROM LOADFUN LOADFN (L) CALLS: CALLS SUBRS CALLED BY: LOCAL: GLOBAL: FEXPR LOADFUN LOADFUN (FN) CALLS: CALLS SUBRS; CALLED' BY: LOCAL: GLOBAL: EX PR LOADSETUP LOADFUN* LOADFUN PROG RETURN LAMBDA LOADFUN LOADFN FN TOPCALLS LINE LIST ERR OUT #LIBBARY.LIST# LOADFUNf (LINE) CALLS: CALLS SUBRS: CALLED BY: LOCAL: GLOBAL: EXPR READFROM LOADFUN LINE ENTRY LOADMAP BUFFER FORM NAME LOADINDEX (LIB) CALLS: CALLS SUBRS CALLED BY: EXPR READFROM PROG RETURN LOADSETUP Function A n a l y s i s Routines I l l The L i s p L i b r a r y Manual 67 LOCAL: GLOBAL: LIB BUFFER INDEX LOADSETUP (FN) CALLS: CALLS SUBRS: CALLED BY: EXPR LOADINDEX LAMBDA RETURN LOADFUN LIB FN INDEX LIST BUFFER LOADMAP TOPCALLS #LIBRARYLIST# LOCAL: GLOBAL: READFHOH (BUFFER CALLS: CALLS SUBRS: CALLED BY: LINE) EXPR LOCAL: GLOBAL: PROG LOADINDEX LOADFUN# LINE STATUS BUFFER > The tree s t r u c t u r e i n d i c a t e s t h a t LOADFN c a l l s o n l y the f u n c t i o n LOADFUN. LOADFUN c a l l s LOADSETUP, LOADFUN#, and i t s e l f . LOADSETUP c a l l s LOADINDEX which i n turn c a l l s READFROiM. LOADFUN* c a l l s only READFROM. '« (XREFFILE F I L E [ O U T F I L E ] ) Purpose: to c r o s s r e f e r e n c e a l l f u n c t i o n s i n the f i l e FILE. F I L E - the f i l e whose fun c t i o n s ' are to be XREFed. I f F I L E has not been read by DISKIN, i t i s read i n f i r s t . OUTFILE - d e f a u l t i s *SINK*. T h i s i s the f i l e to which the output from the c r o s s r e f e r e n c e r i s to be p r i n t e d , X R E F F I L E takes the FNS l i s t of f u n c t i o n s generated by DISKIN, removes a l l non-Exprs, and passes t h i s l i s t t o the f u n c t i o n XREF. The OUTFILE argument of X R E F F I L E i s the same as the one f o r XREF, T h i s f u n c t i o n p r o v i d e s a convenient way of c r o s s r e f e r e n c i n g a l a r g e L i s p program, e s p e c i a l l y i f the user i s not f a m i l i a r with the programs i n the f i l e . A l l switches and o p t i o n s of XREF apply to X R E F F I L E . Function A n a l y s i s Routines I l l The L i s p L i b r a r y Manual 68 Example: (XREFFILE B A T C : C 0 M P I L E R 2 ) w i l l produce a (long) c r o s s r e f e r e n c e of a l l f u n c t i o n s i n the L i s p c o m p i l e r . Function A n a l y s i s Routines I l l The L i s p L i b r a r y Manual 69 6 MISCELLANEOUS LIBRARY ROUTINES T h i s s e c t i o n i n c l u d e s a number of L i b r a r y r o u t i n e s which do not c o n v e n i e n t l y f i t under any of the major c l a s s i f i c a t i o n s i n t h i s document. Many of them are used as s u b f u n c t i o n s of other L i b r a r y r o u t i n e s and are l i s t e d here because they may be of use or i n t e r e s t to o t h e r s . • (*PUTOB AI A2 ... An) Purpose: to add atoms t o the OBLIST. Ai - an atom, a copy of which w i l l be put on the L i s p OBLIST. T h i s f u n c t i o n adds c o p i e s of i t s arguments to the OBLIST. Any READS which occur a f t e r the e x e c u t i o n of t h i s f u n c t i o n w i l l f i n d the new atoms i n s t e a d of the p r e v i o u s ones. The o r i g i n a l atoms are l e f t on the OBLIST, complete with t h e i r v a l u e s and property l i s t s . Any f u n c t i o n s which were read i n p r i o r to the c a l l t o *PUTOB w i l l s t i l l use the o l d atoms. T h i s f u n c t i o n i s used i n c o n j u n c t i o n with *REMOB to e f f e c t i v e l y i s o l a t e atoms which might otherwise cause c o n f l i c t s i n f u n c t i o n s which EVAL some of t h e i r parameters or PROG v a r i a b l e s , *PUTOB and *REMOB are a c t u a l l y p a r t of the Loader r o u t i n e s ; they are not p a r t of the L i b r a r y . M i s c e l l a n e o u s L i b r a r y Routines I l l The L i s p L i b r a r y Manual 70 I • (*REMOB JU A2 ... An) Purpose: to remove atoms from the OBLIST. A i - an atom to be removed. *REMOB i s the NSUBR v e r s i o n of the L i s p f u n c t i o n REMOB. Thi s means t h a t i t i s the same as REMOB but does not EVAL i t s arguments. I t i s used i n c o n j u n c t i o n with *PUT0B t o i s o l a t e Lambda and PROG v a r i a b l e s . Example: * (*PUT0B A B C ) > NIL * (DEFUN IF (A B C) * (COND ((EVAL A) (EVAL B) ) * ( (EVAL C)))) > IF * (*RE MOB A B C ) > A * (SETQ B 2) > 2 * (IF NIL (CONS 1 2) B) > 2 * I f the *puTOB and *REMOB were not present, the IF c a l l would r e t u r n the value (CONS 1 2) i n s t e a d of 2. T h i s i s due to the f a c t t h a t B i s bound within the f u n c t i o n IF to IF'.s second! argument. When B i s EVALed, i t i s i t s l o c a l v a lue t h a t i s r e t u r n e d , not i t s g l o b a l value. *PUTOB and •REMOB sol v e t h i s problem by making the atom B i n the f u n c t i o n IF a d i f f e r e n t atom from the atom B used elsewhere i n L i s p . • (CASE N S1 S2 ... Sn) Purpose: a L i s p CASE statement. N - a L i s p e x p r e s s i o n which e v a l u a t e s t o an i n t e g e r number. S i - any L i s p e x p r e s s i o n . The v a l u e of CASE i s the value of S(N), where N i s the f i r s t argument. I f N i s l e s s than 1, the value i s Sn, the l a s t M i s c e l l a n e o u s L i b r a r y Routines I l l The L i s p L i b r a r y Manual 71 expression. I f N i s greater than the number of S i , the value i s NIL. » (CONSES S) Purpose: counts the number of cons c e l l s i n the s t r u c t u r e S. S - any a r b i t r a r y L i s p expression. This f u n c t i o n i s used by FNSIZE (described elsewhere) to give the number of cons c e l l s i n a L i s p f u n c t i o n . I f S contains a c i r c u l a r l i s t ; CONSES w i l l never r e t u r n . • (DREVERSE L) Purpose: to reverse the l i s t L. L - any L i s p l i s t . DREVERSE behaves e x a c t l y l i k e REVERSE except that the o r i g i n a l l i s t i s modified i n s t e a d of making a copy. • (EDITE F) Purpose: c a l l s the e d i t o r on the form F. F - any L i s p expression. The value of t h i s expression i s passed to the e d i t o r . This f u n c t i o n i s the e d i t o r w r i t t e n by Paul Friedman, which i s documented i n the f i l e PSIL:MINIED,FMT. . This L i b r a r y contains a copy of t h i s e d i t o r with small changes to i n t e r f a c e i t to the p r e t t y p r i n t e r described i n the document. Miscellaneous L i b r a r y Routines I l l The L i s p L i b r a r y Manual 72 • (EDITF FI F2 ... Fn) Purpose:; c a l l s the e d i t o r on the f u n c t i o n s F i . F i - the name of a L i s p Expr to be e d i t e d . EDITF i s the a l t e r n a t e entry point to the L i s p e d i t o r . See EDITE above. i • (ELEM L N) Purpose: r e t u r n s the Nth element of l i s t L. L - should evaluate to a L i s p l i s t . N - must evaluate to an i n t e g e r number. ELEM r e t u r n the Nth element of the l i s t L. I f N i s l e s s than 1, the l a s t element of L i s returned, i f N i s greater than the length of the l i s t L, NIL i s returned. • (INFO) Purpose: p r i n t s current storage, time, and cos t i n f o r m a t i o n . T h i s f u n c t i o n p r i n t s out the elapsed and CPU time f o r the current L i s p run, the current stack and freespace a l l o c a t i o n s , and the.MTS VMSIZE and t o t a l cost information. Example: # (INFO) > ELAPSED TIME SINCE START OF RUN = 8 MINUTES 26 SECONDS > CPU TIME = 1 SECONDS. > CURRENT FREES PACE ALLOCATION = 6. PAGES. > CURRENT STACK ALLOCATION = 1. PAGES. # VMSIZE = 35 PAGES # COST = $2.93 > Miscellaneous L i b r a r y Routines I l l The L i s p L i b r a r y Manual 73 • (MT "cmnd") Purpose: to execute the MTS command s p e c i f i e d . The MT fu n c t i o n converts the command s p e c i f i e d by the arguments to MT i n t o proper MTS command format. I t adds commas and removes excess blanks from the command. Ex ample: (MT L MYFILE ( 1 0 2 0 ) ) = $L MYFILE ( 1 0 , 2 0 ) (MT PERMIT (A B) LIKE FOO) =$PERMIT (A,B) LIKE FOO • (PRINT! SI S 2 ... Sn) Purpose: used to p r i n t messages. S i - e i t h e r an atom or a l i s t of S-expressions. I f S i i s an atom, i t i s p r i n t e d (with a P R I N 1 ) , i f i t i s a l i s t , each element of the l i s t i s EVALed and p r i n t e d . The atom : w i l l cause a c a r r i a g e r e t u r n and 5 space indent, The value of the f u n c t i o n PRINTL i s NIL. Example: * (SETQ X 3 Y 5) > 5 * (PRINTL X= (X) AND Y= (Y) ) > X= 3 AND Y= 5 ' > NIL * (PRINTL : X= (X) : Y= (Y) : X + Y= ((ADD X Y)) ) > X= 3 > Y= 5 > X+Y= 8 > NIL * i Miscellaneous L i b r a r y Routines I I I The L i s p L i b r a r y Manual 74 • (PRINTMSSG BUFFER SI S2 ... Sn) Purpose: to p r i n t a message to a p a r t i c u l a r b u f f e r . BUFFER - the name of a b u f f e r i n t o which the message i s to be p r i n t e d . The b u f f e r must have p r e v i o u s l y been opened. S i - e i t h e r an atom, or a l i s t of S-expressions. T h i s f u n c t i o n i s the same as PRINTL above, but a l l o w s the s p e c i f i c a t i o n o f a b u f f e r i n t o which the message i s p r i n t e d . PRINTL uses the b u f f e r LISPOUT. Example: * (SETQ X 22) > 22 * (PRINTMSSG LISPOUT THE VALUE OF X IS (X)) > THE VALUE OF X IS 22 > NIL * (SETQ X 'THEUNDEFINEDATOM) > THEUNDEFINEDATOM * (PRINTMSSG LISPOUT *EREOR* : (X) IS UNDEFINED) > *ERROR* > THEUNDEFINEDATOM IS UNDEFINED > NIL a (SETELEM L N V) Purpose: to s e t the Nth element of L to V. L - any L i s p l i s t . N - e v a l u a t e s to an i n t e g e r . V - e v a l u a t e s to the new v a l u e f o r the Nth element of L. T h i s f u n c t i o n does not make a copy of argument L, the change i s a d e s t r u c t i v e one. Mis c e l l a n e o u s L i b r a r y Routines I l l The Li s p L i b r a r y Manual 75 Example; * (SETQ X » (fi B C) ) > ( A B C ) * (SET EL EM X 2 ' (X Y Z) ) > ( (X Y Z) C) * X > (A (X Y Z) C) * • (SORTFILE FILE) Purpose: s o r t s the fu n c t i o n s i n a f i l e a l p h a b e t i c a l l y . FILE - the name of the MTS l i n e f i l e to be sorted. I f FILE has not been read i n by (DISKIN FILE), i t i s read. The FNS l i s t on the property l i s t of the f i l e name i s passed to the f u n c t i o n SORTLIST. The sor t e d l i s t i s put back on the property l i s t of the f i l e name. I f UPDATE or DISKOUT i s then c a l l e d to wr i t e out the f i l e , i t w i l l be p r i n t e d i n a l p h a b e t i c a l order. Example; (DISKIN MYFILE) ;read the f i l e (SORTFILE MYFILE) ; s o r t i t (UPDATE MYFILE) ; w r i t e i t out again Miscellaneous L i b r a r y Routines I l l The L i s p L i b r a r y Manual 76 n (SORTLIST 1ST F) P u r p o s e : t o s o r t the l i s t LST a l p h a b e t i c a l l y . LST - e v a l u a t e s t o t h e l i s t t o be s o r t e d . F - must e v a l u a t e to a L i s p f u n c t i o n o f one a rgument . The f u n c t i o n F i s a p p l i e d t o each e lement o f t he l i s t LST to r e t r i e v e t h e s o r t k e y . The v a l u e o f t h e f u n c t i o n SORTLIST i s t h e new ( so r t ed ) l i s t . Example : * (SETQ X * ((A Y) (D X) (B V) > ((A %) (D X) (B V) (C W) ) * (SORTLIST X 'CAR) > ( ( A Y.) ( B V) (C W) (D X) ) * (SORTLIST X * CADR) > ( (B V) (C W) (D X) (A ? ) ) * (SETQ Y • (A E C D I • B)) > ( A E C D F B) * (SORTLIST Y 'QUOTE) > * ( A B C D E F) M i s c e l l a n e o u s L i b r a r y R o u t i n e s IV Conclusions 77 Although a l l of the programs described i n t h i s t h e s i s are c u r r e n t l y i n - use, there e x i s t many rough spots i n the implementation. The e n t i r e system s u f f e r s from the lack of a L i s p compiler f o r Lisp/MTS. Compiling the programs would not only improve the speed and space requirements of the programs, but would reduce the c o n f l i c t s between user and L i b r a r y f u n c t i o n names and v a r i a b l e s . I t i s hoped that a compiler w i l l be a v a i l a b l e f o r Lisp/MTS i n the near f u t u r e . The p r e t t y p r i n t e r appears to perform w e l l over a l a r g e c l a s s of user programs. The s p e c i a l h e u r i s t i c s used to improve the v i s u a l s t r u c t u r i n g of p a r t i c u l a r L i s p f u n c t i o n s work w e l l , but might be extended to a number of other f u n c t i o n s . The b a s i c d u a l i t y of programs and data which e x i s t s i n L i s p w i l l s t i l l cause the p r e t t y p r i n t e r to produce " i n c o r r e c t " s t r u c t u r i n g . The p r e t t y p r i n t e r cannot know whether a p a r t i c u l a r l i s t s t r u c t u r e i s a program segment or a data s t r u c t u r e . I f i t assumes that i t i s a program, data may be v i s u a l l y s t r u c t u r e d i n c o r r e c t l y . I f the l i s t i s assumed to be data, programs w i l l not be p r o p e r l y p r e t t y p r i n t e d . This problem i s unresolvable; the best that one can hope f o r i s a program which "almost always" works c o r r e c t l y . There e x i s t many problems with the Debug Package both i n implementation and i n user i n t e r a c t i o n . Because of the order i n which L i s p processes f u n c t i o n c a l l s , i t i s p o s s i b l e t o c o r r e c t an e r r o r with the Debug Package only to f i n d t h a t the IV Conclusions 78 i n t e r p r e t e r does not "see" the c o r r e c t i o n . Nevertheless, i f execution i s r e s t a r t e d from some higher l e v e l , the program w i l l work c o r r e c t l y . In most cases i t i s obvious when execution must resume at some p r i o r point i n the e v a l u a t i o n of the program. There are however, s i t u a t i o n s i n which execution should be r e s t a r t a b l e at a give p o i n t , but i s not. This problem i s due to the order i n which the i n t e r p r e t e r processes L i s p f u n c t i o n c a l l s . The problem cannot be c o r r e c t e d without major changes i n the i n t e r n a l s t r u c t u r e of the L i s p i n t e r p r e t e r . C l e a r l y , the Debug Package i s designed f o r use by s o p h i s t i c a t e d L i s p programmers. a novice w i l l be more confused than; helped by t h i s f a c i l i t y . I f the system i s to be used f o r teaching L i s p , i t would be wise t o augment i t with a s i m p l i f i e d "Mini-Debug Package". The command language of the Debug Package, while q u i t e comprehensive, r e q u i r e s some extensions. Some sequences of commands would be b e t t e r i f merged i n t o a s i n g l e command. A macro f a c i l i t y would o f f e r the user the a b i l i t y to adapt the Debug Package to h i s p a r t i c u l a r s t y l e of debugging by a l l o w i n g him to wr i t e h i s own "best" set of commands. A u s e f u l extension to the L i b r a r y system would be the i n c l u s i o n o f "undoable" f u n c t i o n s . These could be used i n conjunction with the Debug Package t o allow the user , to "back up" the execution of h i s programs to an a r b i t r a r y previous s t a t e . In p a r t i c u l a r , the "undoable" f u n c t i o n s would undo IV Conclusions 7 9 changes to v a r i a b l e bindings, property l i s t s , and l i s t s t r u c t u r e s that may have occurred during the execution of a program. This would allow re-execution under the same i n i t i a l c o n d i t i o n s . The L i s p L i b r a r y provides a basi s upon which future enhancements to the L i s p environment may be b u i l t . The system admits the a d d i t i o n of both new f u n c t i o n s and new L i b r a r i e s . With t h i s system i t i s hoped t h a t a more f l e x i b l e L i s p programming environment w i l l be a v a i l a b l e to L i s p programmers. B i b l i o g r a p h y 80 [ 1 ] Friedman, P. An I n t e r a c t i v e Debugging Package f o r Lisp/MTS. Vancouver B.C.: U n i v e r s i t y of B r i t i s h Columbia, Master's T h e s i s , 1973. [ 2 ] S a l i s b u r y , D. The Symbolic Debugging System. Ann Arbor; Michigan: U n i v e r s i t y of Michigan Computing Center. [ 3 ] Teitelman, W. "Automated Programming - The Programmer's A s s i s t a n t " , Proceedings of F a l l J o i n t Computer Conference 1972. [ 4 ] T e i t e l m a n , W. , Bobrow, D. and H a r t l e y , A. I n t e r l i s p Reference Manual.. Palo A l t o C a l i f . : Xerox Palo A l t o Research Center, 1973. [ 5 ] Wilcox, B. and Hafner, C. Lisp/MTS Users Guide. Ann Arbor, Michigan: Mental Health Research I n s t i t u t e , 19 73. Appendix I - Lisp/MTS 81 1 INTRODUCTION The Lisp/MTS i n t e r p r e t e r was o r i g i n a l l y implemented at the U n i v e r s i t y of Michigan by W i l c o x £ 5 ] . As UBC uses the same op e r a t i n g system as Michigan (MTS), the i n t e r p r e t e r was e a s i l y t r a n s f e r r e d to UBC. At UBC the i n t e r p r e t e r has been a l t e r e d by P. Friedman and myself. L o c a l changes i n c l u d e the a d d i t i o n of many new f u n c t i o n , changes t o the names of some f u n c t i o n s , and a l t e r a t i o n s to the printmacro and stack o p e r a t i o n s . In i t s b a s i c form, Lisp/MTS i s very s i m i l a r to the MACLISP system of MIT. A l l forms are typed i n as r e g u l a r L i s p forms to top l e v e l L i s p ; there i s ' no evalquote f e a t u r e . Most of the standard f u n c t i o n s of L i s p are a v a i l a b l e . I n t r o d u c t i o n Appendix I - Lisp/MTS 82 2 LANGUAGE EXTENSIONS AND DIFFERENCES T h i s s e c t i o n w i l l attempt to i n d i c a t e some of the f e a t u r e s of Lisp/MT.S which d i f f e r from other L i s p systems. Many of these d i f f e r e n c e s are due, at l e a s t i n p a r t , to the way that programs running under MTS can communicate with the o p e r a t i n g system and i t s f i l e s . Lisp/MTS p r o v i d e s v a r i o u s f u n c t i o n s which can access i n f o r m a t i o n s t o r e d by the L i s p i n t e r p r e t e r on i t s pushdown stack. The f u n c t i o n UNEVAL allo w s the a c c e s s i n g of EVAL forms on the s t a c k . A c a l l t o (UNEVAL LOC) w i l l r e t u r n the form s t o r e d at l o c a t i o n LOC on the s t a c k . LOC can be an i n t e g e r n which i n d i c a t e s the n-th form from the top of the stack (a n e g a t i v e i n t e g e r counts from the bottom of the s t a c k ) , or the name of a f u n c t i o n which i s to be searched f o r . I f an o p t i o n a l second argument i s present, i t s p e c i f i e s what i s t o be done at t h a t l o c a t i o n on the s t a c k . A second argument of T causes exe c u t i o n to resume at t h a t p o i n t on the stack. Any other value must be a l e g i t i m a t e L i s p form which w i l l be e v a l u a t e d i n s t e a d of the form at the s p e c i f i e d l o c a t i o n . n 2. A n Stack Operations Language Extensions and D i f f e r e n c e s Appendix I , - Lisp/MTS 83 The f u n c t i o n RETURN has been extended to allow an o p t i o n a l second argument of the same form as the LOC argument of UN EVAL. T h i s allows values to be r e t u r n e d from auy f u n c t i o n , not j u s t PROGs, The DISPLAY f u n c t i o n a l l o w s the a c c e s s i n g of v a r i a b l e b i n d i n g s at s p e c i f i e d l o c a t i o n s on the stack. T h i s i s used i n the Debug Package to implement the VALUE command. n 2.B ri E r r o r Handling Lisp/MTS assigns to each p o s s i b l e e r r o r (of which there are about 40), an e r r o r form which i s a L i s p expression to be evaluated when the e r r o r occurs. The stack i s l e f t i n t a c t while the e r r o r i s being processed, thus a l l o w i n g the user complete access to i t v i a the stack f u n c t i o n s . By d e f a u l t , the e r r o r form i s the system DUMP f u n c t i o n which p r i n t s backtrace information and e r r o r messages. The Debug Package makes use of e r r o r forms by changing them so that they c a l l the Debug Package whenever an e r r o r occurs. Since the Debug Package can access the stack v i a UNEVAL and DISPLAY, i t has complete c o n t r o l over the f u r t h u r execution of the user's program. Language Extensions and Differences Append ix I - L i s p / M T S 84 n 2 . C n S t a t u s F u n c t i o n The L i s p / M T S u se r a c c e s s e s most o f t h e sys t em s w i t c h e s and f u n c t i o n s v i a a common STATUS f u n c t i o n . Each STATUS s u b f u n c t i o n has a un ique number t h r o u g h w h i c h i t can be a c c e s s e d . There a re v a r i o u s I / O r e l a t e d STATUS s w i t c h e s a v a i l a b l e t o s e t e n d - o f - f i l e f u n c t i o n s , l i n e f i l e m o d i f i e r s and l i n e numbers, f i l e and b u f f e r p r e f i x e s e t c . Time and c o r e usage i n f o r m a t i o n i s a l s o a v a i l a b l e . The c u r r e n t e r r o r number and e r r o r form used by the A u t o l o a d e r and Debug Package a r e a c c e s s e d by u s i n g the STATUS f u n c t i o n . The L i s p / M T S sys tem p r o v i d e s a v e r y f l e x i b l e and p o w e r f u l scheme f o r r e a d i n g and w r i t i n g MTS f i l e s and c o m m u n i c a t i n g w i t h t h e u s e r ' s t e r m i n a l . I t i s because o f t h i s f l e x i b i l i t y t h a t many o f t h e f u n c t i o n s and programs i n the L i s p L i b r a r y e x i s t . n 2 . D n L i s p / M T S I / O S t r u c t u r e Language E x t e n s i o n s and D i f f e r e n c es Appendix I - Lisp/MTS 85 2. D. 1 MTS F i l e S t r u c t u r e T h i s s e c t i o n i s not intended i n any way to be a complete or even t e c h n i c a l l y accurate d e s c r i p t i o n of MTS f i l e s . The purpose 0 of t h i s d e s c r i p t i o n i s t o i n d i c a t e how MTS f i l e s are used from the Lisp/MTS system. I n MTS most user's programs and data are s t o r e d i n l i n e f i l e s which are d i s k f i l e s composed of l i n e s of from 1 to 256 c h a r a c t e r s . Each l i n e has a s s o c i a t e d with i t a l i n e number v i a which i t can be accessed. The system I/O r o u t i n e s allow random access to any l i n e s i n the f i l e f o r the purpose of e i t h e r r e a d i n g or w r i t i n g . The c o n v e r s a t i o n a l t e r m i n a l s i n MTS are t r e a t e d i n the same way as a f i l e ; w r i t i n g on the p s e u d o - f i l e name *SIHK* w r i t e s to the user's t e r m i n a l , r e a d i n g from *SOURCE* reads the user's typed i n p u t . 2. C. 2 L is£^MTS B u f f e r s Lisp/MTS accesses the MTS f i l e s and the u s e r ' s t e r m i n a l v i a a f i l e - b u f f e r p a i r c a l l e d an IOABG. A b u f f e r i s a s p e c i a l atom whose p r i n t name i s v a r i a b l e i n l e n g t h from 1 to 255 c h a r a c t e r s . A l l w r i t i n g and r e a d i n g i s done i n t o or from these b u f f e r s . I f no f i l e i s attached to the b u f f e r , the user's t e r m i n a l i s used. The p r e t t y p r i n t e r d e s c r i b e d i n Chapter I I I uses a b u f f e r to Language Extensions and D i f f e r e n c e s Appendix I - Lisp/MTS 8 6 determine the l e n g t h of a p a r t i c u l a r L i s p s t r u c t u r e . In t h i s case, no a c t u a l I/O o c c u r s ; the contents of the b u f f e r i s never p r i n t e d out. The IOABGs are accessed and manipulated v i a a number of STATUS s u b f u n c t i o n s as w e l l as by the I/O f u n c t i o n s BEAD, PBINT, PRIN1, e t c . A l l I/O f u n c t i o n s allow an o p t i o n a l b u f f e r argument which s p e c i f e s f o r t h a t p a r t i c u l a r c a l l o f the f u n c t i o n , which f i l e - b u f f e r p a i r to use. T h i s allow the use of many d i f f e r e n t i n p u t or output streams at once. 2.D.3 1/0 I n t e r c e p t s and Macros An i n t e r c e p t f u n c t i o n i n Lisp/MTS i s a L i s p form which w i l l be evaluated when a c e r t a i n c o n d i t i o n occurs. The e r r o r forms are an example o f one type of i n t e r c e p t ; when an e r r o r o c c u r s , the a s s o c i a t e d e r r o r form i s invoked. There a l s o e x i s t i n Lisp/MTS a number of i n t e r c e p t forms which are a s s o c i a t e d with I/O o p e r a t i o n s . An e n d - o f - f i l e on a f i l e w i l l cause the i n v o c a t i o n of an i n t e r c e p t . The attempt t o read past the end of a l i n e or p r i n t past the end of a l i n e can cause an i n t e r c e p t . These can, of course, be turned o f f . The e n d - o f - l i n e i n t e r c e p t s are used by the command processors of the Debug Package, E d i t o r , and GENLIB r o u t i n e s . Another type of i n t e r c e p t f u n c t i o n i n Lisp/MTS i s the Language Extensions and D i f f e r e n c e s appendix I - Lisp/MTS 87 1 printmacro f a c i l i t y . The L i s p user can s p e c i f y that a c e r t a i n Lisp atom i s to be recognized by the p r i n t r o u t i n e s as a printmacro atom. Whenever the p r i n t e r attempts to p r i n t a l i s t whose f i r s t element (CAR) i s a printmacro atom, the ass o c i a t e d i n t e r c e p t f u n c t i o n w i l l be c a l l e d i n s t e a d . This f e a t u r e i s used by the p r e t t y p r i n t e r to allow the form (QUOTE (ft B C)) to be p r i n t e d as ' ( A B C ) . n 2.E a The Influence of MTS The operating system and the a v a i l a b l e c o n v e r s a t i o n a l t e r m i n a l s have g r e a t l y i n f l u e n c e d the design and implementation of the L i s p L i b r a r y system. The demands and requirements of the user are a f f e c t e d by how he normally i n t e r a c t s with other components of the MTS system. The f l e x i b i l i t y of the MTS f i l e system means that good f a c i l i t i e s f o r reading and w r i t i n g these f i l e s from L i s p are expected by the user. The c o n v e r s a t i o n a l terminals used at UBC are IBM 3270 d i s p l a y t e r m i n a l s . These have a very high data t r a n s f e r r a t e . The speed at which these t e r m i n a l s can t r a n s f e r information to the user means that the L i s p system can be verbose without s e r i o u s l y degrading the speed of i n t e r a c t i o n with the system. Users are a l s o more w i l l i n g to use p r e t t y p r i n t e r s and other Language Extensions and D i f f e r e n c e s Appendix I - Lisp/MTS 88 programs which produce many l i n e s of output, s i n c e they do not have to wait while the l i n e s are p r i n t e d out. One o f the most h e l p f u l f e a t u r e s of the MTS system i s i t s use of p r e f i x c h a r a c t e r s to prompt the user f o r i n p u t . Examples of t h i s are seen i n the examples of Chapter I I I where the c h a r a c t e r s *, >;, and 2» are used. By using d i f f e r e n t p r e f i x symbols f o r d i f f e r e n t programs and processes, the user always knows what i s expected of him. Language Ext e n s i o n s and D i f f e r e n c e s Appendix I I - Loader L i s t i n g 89 i 2 ] l> 100 1C1 102 103 104 105 106 107 108 101 1 10 111 112 113 11« 200 201 202 203 2C4 205 206 207 300 301 302 • 303 304 105 3116 307 308 309 310 311 uoo »ov 402 403 404 DOS 006 107 408 009 mo n i l • -5.10 501 502 503 504 505 506 507 508 600 601 602 700 71.1 702 703 800 801 802 100 901 902 903 904 905 1000 1001 1002 1100 1101 11.12 1103 1104 1105 1106 1107 11"8 1109 1110 1111 1112 1200 1201 END ur FILE (DEFUS LOADFN FEX PR ([,) ^JIAPC 1 (LAfl bDA (FN) <[>ROC (F) (LOADFUN FH)) ) L) (DEFON LOADFUN (FN) (OB (IIE!tQ FN F) (PROG (INDSX DUFFEJ LOADTA P TOPCALLS LlSaiai LIST ESTRY FORR BASE) (SF.TO P (CONS FN F) ) ICOSD ((LOAD-SETUP FN) (AND (SiTO. Z-ITRt (ASSQ FN TOPCALLS)) (RPLACC ENTRY (ADD1 (CDR E3TRY))) (RETURN BID) (NCOSC TOPCALLS (LIST (CONS Ri (I14PC • (LAKUDA (LINE) (COND ( (NUKUER? LINE) (LOADFU Ml LINE)) ((LOAOFUH LINE)11) LIST)) ' {I (PRIN1 FN SBitOUr) (PBIN1 '"ISN'T IB LIBSABIS:" EfeBOOT) (PRIS1 •LIBRARILISTI ERROUT) (TERPBI ERKOUT)))))) (DBFUN LOADFUN t (LINE) (COND ( (SETQ ENTRY (ASSO L I N E L O A C X A P ) ) (SPLACD (COB (T (READFROr. UUFFEH L I N E ) (SETO FORK (BEAD DUFFER) NAfl E (AND (EO (CAR FORS) (BCONC LOADHAP (LIST (COBS LINE (CONS NA.1E 1)))) (EVAL roan)))) NTRY) (ADD1 (CDEB SNTBY) ) ) ) DEFUN) (CACB FORB))) (OEFOB LOADSETUP (FN) (H4PC •(LAMBDA (LID) (COND ((SETQ INDEX (SET LIB '".INDEX." •(LOADIBDEX LIB)) LIST (CDR (ASSQ FN INDEX •(RETURN NIL 'COND))) BUFFER (GET LIB '".UUFFEB.") LOADSAP (GET LIB •".LOADSAP.") TOPCALLS (GET LIB '".TOPCALLS.") LIBRARY LIB) (BETORII T 'LOADSETUP)))) •LIBBARYLISTI)) (DEFUN LOADIBDEX (LIB) (PBOG (BUFFER INDEX) (APPLY1 'OPEN (LIST 'BUFFER 255 LIB)) (8EADPR0K BUFFER -1000000) (SETQ INDEX (CDR (READ BUFFER))) (PUT LIB '".BUFFER." BUFFER) (PUT LIB •».INDEX." INDEX) (PUT LIB '".LOADflAP." (LIST NIL)) (PUT LIB '".TOPCALLS." (LIST NIL)) (RETURN INDEX))) (DEFUU BP.ADFROH (BUFFER LINE) (PBOG (STATUS) (APPLY 1 •STATUS '(16 BUFFER 2) (LIST 15 'BUFFER (FIX (TIKES 1000 LINE)))) (SETQ STATOS (STATUS (12 BOFFEB (LAflBDA X (RETURN NIL •BEADLINE)))|) (BEADLINE BUFFER) (APPLY 1 'STATUS (LIST 12 'BUFFES STATUS) '(16 BUFFEB 0)) BID) (SETQ ILIBBABYLISTI (LIST •PSIL:LIBBABI)) ( D E r O N 'POTOB PEIPB (L) (B1PC ' (LAMBDA (I) (PUTOB (COPY L))) L) ) (PDt ••8EB0B •BSOBB (GETPN 1BEBOB)) (DEFON )CRB) |) (AMD (EQ (STATDS 29) 68) 7AUT0L0AD (|LIBBABI-EBBI)) (HID 7DEBUG (I DEBUG-ERR I)) (0N6YAL ' 1 EBB) • (OOF.P 7))) (SETQ 78EBUC BIL TAUTOLOAD T *EB8* '()EBB))) (OEPUH ILIBBABY-EIIBI (1 (PBOG (IFNI F) (SETQ iFNI (STATUS 23)) (COND ((liAPC •(LABBOA (LIB) (AND (ASSQ »rN» (GET LIB '".ISDEX." • (LOACINDEX LIB))) (RETURN X '.lAFC))) •LIBRAHYLISTI) (PSIN1 'LOADING:) (PRIM i r N I ) (TEBP3I) (LOADFUN IP»«) (OBEVAL »P»« T))))) j IVB 13, 1974 10:39:02 Appendix I I I - L ib ra ry L i s t i n g 90 -1010 j Ln:iA;<t INDEX -in (t t i D i J -t'tH (HlltAKF ) DEUIIOI -1 17 (C*!i? 101 F.LEHI -9'>6 (COJ..-.ES 201) -99S (DCalK; JO) 401 SO 1 601 70 1 801 10 1 1001 1 101 1201 1)01 K O I .150! 1601 1101 1B01 1901 2001 2 10 1 - i n 2201 2:101 2001 2101 2601 2701 2801 2001 300! 3101 BREAKF UNUREAKF 3201 3301 340 1) -9™1 (DIKKIK 1501 1f.il 1 1701 PH INTP.-.S r.) -912 (OISKnOT 1H0) 3901 4001 110! 0201 0301 PSIHTMSSG 4401 PP) -991 (DRKVERSE 4501) -910 (ED ITE 0603 EDITF) -9B9 (EDITP 4703 4R01 4901 5001 5101 S201 5601 5701 5801 5901 6001 6101 6201 6301 6401 6501 6601 -9HB 6701 6801 PP) -937 (EL FF1 6903) -986 (EXTRACTFN 7001 7101 7201) -985 (FNPAP 7103 7401 ITIIV SOBTLIST) -9H4 • (FNSIZE 7503 COSSES) -981 (GENLIB 7003 7701 7801 7901 8001 8101 8201 8301 8401 8501 DISKOUT PBI8T.1SSG PP 8601 8701 8801 -9H2 8901 9001 SOBTLIST) -981 (IOIV 9101) -980 (INFO 9203 PBINTtlSSG IDIV) -979 (IRfn 9103) -978 (LOADINFO 9403) -9 77 (RT 950 3) -976 (PP 9603 9701 9801 9901 10001 10101 10201 10301 10401 10501 10601 10701 10801 3301 3401) -975 (PRISIL 10901) -970 (PR INTflSSG 1 1003) -971 (S ET ELEFI 11103) -972 (SORTFILE 11203 SORT LIST) -97! (SORTLIST 11301 11401) -970 (UN flR EAKF H503 DEBUG) -9(.9 (UNLOADFN 11601 11701 11801 11901) -9b8 (UPUATE 12003 DISKOUT PHINT.1SSG PP) -967 (XREF 12103 12201 EL»r. 12301 12401 12501 12601 12701 12801 12901 13001 13101 13201 13301 114C1 -966 13501 1)601 13701 13801 13901 14001 14101 14201) -9o5 (XBEPPILE 14303 DISK IN XREF) -964 J ; END OF INDEX 1' ;*«*«*[}RCAKF*********.******************** 2 3 (DEFUN BREAKF FEXPB (L) « (SETQ 7BRF.AKS» T) 5 (HAI'C • (LAMBDA (L) (PBOG NIL (DEDUGBREAK L) ^RESTART) } L) 6 9DONE) 7 100 101 j«»«.*CASE**»»****«*»****»*****»»***»»»* 102 103 (DEFUN CASE PEXPR (ICASEI) 104 (EVAL (ELElt (CDR tCASEI) (EVAL (CAS ICASEI))))) 105 200 201 .»»..«Co aSES*»*»***»**«***»**»****«»**»»»* 202 203 (DEFUN C05SES (I) 209 (COND ( (ATOn J) 0) 2U5 ( (ADD (COJSES (CAS X)) (CORSES (CDS X) ) 1) )) ) 206 3C0 301 ;*#***DEBOG****************************** 302 303 (*PUT08 FB MAnE FOBH L RETLEVEL BREAKFORH CHND CMNDLIST BETVALDE LOC .HEXTCKND BP0INT7) 304 . 4O0 »01 (PBOGN (POT '".EVAL." >S03a (GETFM 1 EVAL) ) 4"2 (OPEN (DEBUGIN 255 *S0URC5») (DEBOGOUT 75 *SINi!*)) 403 (SETO 7TERSB T 78ACXI 10 ?DR EAKSW NIL DEBUGt 0 7DE3UG T 7BB0KEN NIL BP0INT7 SIL) «0» (STATUS (14 DEBUGOOT " ") (14 DEBUGIN a ) ) ) •CS 500 501 (DEFUN IDEBIIG-ERRI () 502 (AMD (EC (STATUS 29) 9fi) (DEBUGSKIP (STATUS 28)) (STEP 6) (DSEVAL •|ERBI '(UNEVAL 1 T ) ) ) 503 (OR (EO (STATUS 29) 96) (DllSP 1)) 504 (DEBDG11AIS (A0D1 (DISPLAY |EHR| L ) ) ) ) 505 600 601 (DEFUN DEBUG NEXP9 (F0R.1) 602 (SETQ BP0INT7 NIL) 603 (STEP 3) 604 {SETQ FORK (".BVAL." FOR.D) 605 (STEP 0) • 606 FORA) 607 700 701 (DEFUN BREAKPOINT FEXPR (L) 702 (STEP 0) 703 (AKO 7BREAKSW (".EVAL." (CADD3 L)) (SETQ BP0INT7 (CAOB L)) (STEP 4)) 704 (ON EVAL 'BREAKPOINT (CAB L) ) ) 705» 800 B01 (DEFUI! DEBUGLEVELSET (L) 802 (STATUS (10 OF.OUCOOT NIL)) 803 (TAB 1 OEaUGOUT) 80* ( P a m l L UEBUGntlT) 005 (PSIN1 •«»>» DCUUGOUT 2) 806 (STATOS (10 DEBUGOOT T ) ) ) 807 loo 901 902 90) ten 905 906 907 ion 909 9 10 911 9 12 913 3 10 915 916 917 910 9 13 920 921 922 923 92a 925 926 927 928 929 9)0 931 932 933 930 9.15 936 937 938 939 900 961 952 913 9 0 0 90S 906 917 938 9 0 9 950 951 952 953 950 955 9 56 957 9 58 959 9(.0 9o1 962 9i>3 9 i.O 9t.5 10U0 1001 1002 1003 1100 1 101 1 102 11C3 1100 1105 1106 1107 1108 1200 1201 1202 1203 12C0 1300 1301 1302 1303 10CO 1001 1002 1 0 C 3 1500 1501 1502 1503 1500 1505 1506 1507 1508 1509 15 10 1511 1512 1513 1510 1515 1516 16C0 1601 1602 1603 1600 1605 1700 1701 1702 1 70 ) 1700 (Dr.ruN DCOocnAtii ( R E T L S V E I . ) (PltOG (!K<!:AK?':)1.-. L"!1NP C ^ N O L ' S T fl PTV A L U E L O C NEXTCnNO L) • 9 1 ( K S T V liuSMtroa!-. m t i u B::IL'.'.7EL) BET'/ALI ' . : : |CMI ••fitim) wc rnmsnEt,) {•J?.'j'.tr.i\"i:i.:."7 ii-:;.:;.;*) (Co;;D |li!'OU'T? [•,;:;:;1 v\T: L-rnncuuT) (?:t::.l o:-fi:':7? jrat:f;nt!T) ( T K B M ! S>n !'JWJT) • • (r:;: rc m-uicr? N I L ) ) ((•PRINT UnEAKFO'.l." I'tiSSGOUT) )) •RESTART O ( S H T U CNN DL 1ST NIL) (WHILE T (OR Cr.NDLIST (SETO C^N'OT.If.T (DEMUCC" S D) ) ) (SETQ CttNP (IJNCUSS C . - . S ? L : I ' . T Cr,:tOLI:VT) ) (CONU ((LISTPCSSD) (rRIM ( D 5 U U G E 7 A L CHHD) DEBUGOUT)) ( ( S S L E C T Q cr.no C) ( (STEP ST S) (STEP (ADD 2 (COND ( (NOn3ERP (CAR C.1NDLIST) ) (0.1CONS CRNDLIST CBSDLtST) ) C D ) ) (0NE7AL RETLEVEL T)) ((NEXT NX N) (AND (ONDEFP 'RETV ALUE) (SETQ RETVALUE (DEBUGEVAL BREAK FOR*))) (STZr 2) • (RETURN RETVALOE RETLEVEL)) ((CONTINUE CO C) (AND (CNOF.EP • RETV ALU S) (UNEVAL PZTLSVEL T) ) (8Stags R E T V A L U E E E T L E 7 2 L ) ) ((BETl'RX R E T R) (COSD ((NOT (DESUGSEXT)) (DEBUGEF.ROR "RETURN WHAT?"))) (SETQ RETVALU E (0E31IGEVAL NEXTC.IKD) ) (STEP 2) (RETURN RETVALUE R ETLEVEL)) ( ( E V A L E) ( P 3 I N T ( S 2 T 0 nSTVALUE (9E3IIG3VAL IIP SAXFOR") ) DEBUGOUT)) ((VALUE V) (VNILE (D E3UG N E X T ) ( D E B U S VALUE NEXTCEND LOC))) ((STOP )| NIL) (UNSVAL -1 ••••STOP"*)) ( ( B R E A K BR) (SETQ TBRSAKSW T) (WHILE (DEBtlGNCXT) (DSBUGDREAK NEXTCKND)) ) {('JNBRSAK OIIBR) (AND (EQ (CAS CKNOLIST) •:) (SETO 70RSAKSW NIL)). (SHILE (SESOSStEXT) (D ESUGL'NBR SEXTCfl.ll>))) ((?DREAK ?BR) (COSP ((EQ (CAR CilUOLIST) •:) (DEBUG ?Ult NIL)) (T (UHILE (DEBUGNEXT) (DEQUG7DU SEXTCJINO) )) ) ) •' ( (PRINT P) ('PRIST (UNSVAL LOC) DEliUGOUI)) (7 (PRIST BREAKFOBK DEBUGOUT)) . . ( (UP I) (UIIEVAL (D3BUGFIND 'DEBUGRAIN B ETLE VEL) T) ) [(BACX BK DKE DKF) (DEBUGBACK (NEQ CHND • BKF) (COSD ((NOT (DSBUGNEXT)) 7BACKI) (NEXTCr.aD) )) ) (TOP (SETQ LOC RETLEVEL)) ( ( F I N D F) (DEBUGLOC) (•PRIST (UIIEVAL LOC) DEBUGOUT)) . ((EDIT ED) (DEBUGLOC) (DEDUGEVAL • (EDITE (UNEVAL LOC)))) (GO (DEBUGLOC) (STEP 2) (UNEVAL LOC T) ) . ( H E L P (JITS '"SC FRED:DEBUG.HELP")) (USE (OR (.1EJ1Q (STATUS 29) • (60 68)) (DEBUGEHROR "INVALID CO ' . IASD IN T!!tS COKTF.XT") ) (OB (OF.DUC.NEXT) (DEBUGERROR " U S E rfll.VT?")) (COND ( ( S E T Q L (FIND (STATUS 23) 3REAKF03R)) (3PLACA L KEXTCHBD) "(•PRIST 'liREAKFOBM OEBUGOUT)) ((DEBUGERROR "CAN'T FIND" ((STATUS 23)))))) (DEBUGVALUE CRNO RETLEVEL))))))) (DEFUN DEBUGEVAL (FORI! ) ((LARBD& (DEBUG 1) (". EVAL." FOB*)) (ADDI DEBUG!))) (DEFUN CEBUGBBBOR FEXPB ( I L I ) (TERPBI DEBUGOUT) (PR INI •••ERROR** OEBUGOUT) (BAPC • (LAEBDA ( I L I ) (COND ( (ATOtl I L I ) (PRIN1 I L I DEBUGOUT) ) ((PRI81 (EVAL (CAR I L I ) ) DEBUGOUT)))) I L I ) (TERPBI DEBUGOUT) (CO IRESTART)) (DEFUN DEBOGCRNO () (REAOLINB DE8UGI11) (DEbUGCRNUl) ) ( D E F O S DEBUGCRSDl () (CONS (READ DEBUGIN 0 • (LARDBA (X) (RETURN •(:) • DSBUGCSND1) ) ) (DEBUGCSND1))) (DEFUN DE30GSKIP (FO) (AND (LISTP FN) (KEKQ (CAR FN) '(QUOTE STEP LABBDA PLARBD1 ULARUDA BBEAKPOINT' DUnP)))) (DEFUa • PRI.H (FORK BUP) ( ( L A B B D A (PRINTRACRO INTCP) (STATUS (0 OUO.'E T) (0 BREAKPOINT T) ) (PBIN1 FORK BUF 6 I1ITCP) (STATUS (0 QUOTE NIL) (0 BREAKPOINT N I L ) ) ) • ( L A B B D A (FORI BUF) (COND ( (AND (EQ (CAB FOR") 'QUOTE) (EQ (LENGTH FOB!!) 2)) (PRIN) •"'" BUF 2 IKTCP) (paisi (CADR F o a n ) B U F 6 I N T C P ) T) ((AND (EQ (CAR FOHK ] •BREAKPOINT) (EQ (LENGTH FORK) 0)) (PRIN1 '» BUF 2 INTCP) (PBIN1 (CADR FOBS) BUF 6 IHTCP) T ) ) ) (COND (7TEBSE •(LABBDA (X) (RETURN HIL '«PBIH1)))))) (DEFUN •PRINT (FORB BUF) (TEnPUI B U F ) (•[1111 FuRil BUP) (TEHPBI B U F ) ) (DEPUN DBBtlGBREAK (L) (PBOG (TEST) (SETQ TEST T) (AND (LISTP L) (EO (LENGTH L) 2) (SETQ TEST (CAOa L) L (CAR L) ) ) 1705 (Ano (RV.BHFR L ?U; IOKK: I ) (HETI IHH N I L •DEminoBr»K|) oo 1704 (COSD ( (ATOR L J (UEUUCBBEAKFS L ) ) . * 17-17 ( ( O i l (Sro (LENGTH L ) )) (NSQ (CAOB L ) 'IH)) (DBDUGERROR |L) "IS AH INVALID BREAK FOBR")) 1703 ( T (Al'Pl.r ' UKi«:Gll:i!\\F 13 L I D 1707 (PRItll " ' IH IUAK DEBUGOUT) 1 7 1 0 ' (FfllNi L Di::i!;i;ijijT) 1711 (TCRPRt D E U U K O U T ) 1 7 12 (3ETU ?aRO.".E!l ( C O N S L 7 D H 0 K E S ) ) ) ) 1711 1800 1 8 0 1 (DPPl 'N D F . O U C D R Z A K F N (F) 1312 (PROG ( L ) l u o i i s r r a L ( G E T F 'r.tm 1 (n-i'.uc.ERPOii (F ) " i s NOT AN E X P R " ) ) ) t80a (RPLACD (COU L ) . ( C O N S (LIST •JKEAKroINT (CADDK L ) F T E S T ) (C3DDB L))))) 1805 1900 1901 (DEFUN DEDUC3R CAKIN (WHO IN WHERE) 1902 (HAP 'DEBUC3UEAKIN1 (COOK (GET WHERE 'EXPR •(DEBUGEBROR (WHERE) "IS NOT AN EXPR"))))) 1903 2 0 . - 0 ' . 2001 (DEFUN 0E3UGBREAKIN1 ( F ) 2002 (COND ( ( L I S T ? ( C A R F ) ) 2 0 0 3 ( T A P '0EBUGURE.1KIN1 (CAR F) ) 2 0 0 9 (AND (ES ( C A A B F ) WHO) (BPLACA F (LIST 'BREAKPOINT (CAR F) L T E S T ) ) ) ) ) ) 2005 2 1 0 0 2 1 0 1 (DEFUN D E B ' J G U N BR ( L ) 2 1 0 2 (PBOG (WHO W H E R E ) 2103 (OP. (HERbER L ?D!tOl<ES) (DE3UGERSOB (L ) "IS NOT B30KEN")) 2103 (SETQ 7B5UKSN ( D E L E T E L TBHOKEN 1 ) ) 2 1 C 5 (COND ( ( A T O " L ) ( O E M ! G O N D B F N L ) ) 2106 (T ( S E T Q WHO (CAR L ) WHERE ( C A D D B L ) ) (HAP ' DEBUGUNBBIN (CDDR ( G E T WHERE " E X P R ) ) ) ) ) ) ) 2107 2200 2201 (DEFUN BEBUGUK3UIS ( f ) 2202 (COND ((LISTP ( C A R F) ) 2203 ( A N D ( E Q (CAAR F ) 'BREAKPOINT) (EQ (CAADAR F) WHO) (RPLACA F (CADAR P ) ) ) 220S (RAP 1DEBUGUNBRIN (CAR F ) ) ) ) ) 2 2 0 5 2300 2301 (DEFUN DEBUG7BB ( F ) 2302 (PROG NIL. 2303 (TERPRI DEBUGOUT) 2300 (OU ?DROKZ» (PBINT 1 "NOTHING 3R0KE.1." DEBUGOUT) ) 2305 (COND ((NULL F ) (RAPC '(LAR3DA (E ) (PBIST E DEBUGOUT)) 7BB0KEN)) 2306 (T ( A N D ( R F R Q F 70R0K EH) 2307 (PBI3 1 P DE3UG0UT) 2308 (PRIN1 '"IS BROKEN" DEBUGOUT) 2309 (TERPRI DEBUGOUT)) 2310 (RAPC ' (LAR30A ( E ) (AND (LISTP Ej (EQ F (CADDB E)) (PRINT E DEBUGOUT))) 7BR0KEN))))) 2311 , 2300 2101 (DEFUN BEBUGUNBRPN (F) 2902 (SETQ F (GET F * EXPR) ) 2903 (RPLACA ( G D D B F) (CADR (CADDS F) ))) 2909 2500 2501 (DEFUN DEBUG3ACX (FULL? SUR) 2502 (PBOG (COUNT I S D E 9 I I G ? F O S R ) 2503 (SETQ COUNT (SUB1 LOCI 2 5 1 1 SUR (COND ( ( A K D (KIIKSEBP NOR) (GBEATERP NUH 0)) SUB) 2 S 0 S ((E0 NUR ' F U L L ) 1 0 0 0 ) 2V1* {(OSDItRKRJOB (NOR) "IS INVALID.")))) 2 . -7 (REPEAT ' (PBOGN (SETU C'JII ' .T (DEbUGN EXTBK ( A D D 1 COUNT)) ) 2518 ( A N D (NULL COUNT) (PRINT • • • E S D « DEBUGOUT) (RETURN T)) • ;-,.:•'} (AND lADEUUG? (PRIST •". . ." DEBUCOUT) (UNEVAL 'PBOGN T) ) 25 10 (»P11I»T (COSD ( F U L L ? FORR) 2511 ((ATOR FOHR) F O R R ) 2512 ((ATOR ( C A B F O R R ) ) (CAR FOBS)) 2513 ( (CAAB F O R R ) ) ) 2511 DEBUGOUT)) 2515 (UN))) 2516 ' 2600 2601 (DEFUN DEBUGLOC 0 2602 (PROG (FORR INDEBUG?) 2603 (WHILE (DEBUGKEXT) 2t ) 0 » (SETQ FORM NIL) 2635 (UNTIL (EQ SEXTCRMD (CAR F O R R ) ) 2606 (SETQ LUC (COND ((DEBUG8EXT3K (A0D1 LOC))) 26P7 (X (DEBUCEBBOB (KEXTCRNO) "CAN'T BE FOUND OS STACK")))))))) 2608 27L0 27al (DEFUN DEBUGNEXTBK (LOC) 2702 (DO I 2703 LOC 27G« (ADD1 I) 2705 (GBEATERP 1-1) 2706 (SETO FOBR (UNEVAL I) ) 2 7 0 7 (COND (INDEBUG? (AND (El) (CAR F03R) • |ERR I) (SETO INDEBUG? NIL))) 2708 ((EO (CAR FORR) '".EVAL.") (SETQ INDEBCG? T ) (RETUBN I 'DEBUCSEXTBK)) 27C9 ( (RETURN I 'DElJUGNEXTliK)) ) ) 2710 NIL) 2711 2800 ' 2801 (OEFOR DEBUC.FISO (P LOC) 2802 (00 I LOC (AD01 I) (GBEATERP I -1) (AND (EQ (CAB (UNEVAL I)) F) (RETURN I • OEBUGFIN 0))) 2b03 (DEBUGERROB "NOWHERE TO RETUBN TO")) 2 3 0 s 2 9 0 0 29C1 (DEFUN DEBUGVALUE (v L O C ) 2962 ( P R IN 1 V DEBUGOUT) 2903 ( P R IN 1 •= DEBUGOUT) 290» (P8IN1 (DEUUGVALUE1 V) DEBUGOUT) 290S (TERPBI DEBUGOUT)) 29')6 3000 3001 (DEFUN DEBOnVALUEl (v) 3002 (COND ( (ATOR v) (APPLY 1 'DISPLAY "LOC 'B V) ) 3003 {(CETFS (CAB V)) ( A P P L Y (CAS V) (HAPCAR '0EBUGYALUC1 (CDR V)))))) 3 0 0 * 3100 3101 (DEFUN DEBUCNEXT () 3102 (MEQ (SETQ NEXTCRNO (UNCONS CRNDLIST CRNDLIST)) ':)) 3103 3 2 0 0 120t (•BEflOD F« NAHS FORR L RETLEVEL BRSAKFORH CRND CRNDLIST RETVALUE LOC HEXTCRND) 3202 3100 3301 (DEPU» PBIBTRACBO (L) J I M I I 1 ;0 T i l ' 1 1-.-.-2 i v n V. 11 1 >',2 i s : , ' I S t ' l l 15,15 Vj»b 15. 7 )s . 8 3509 I S 10 JS1 1 3512 I S I 3 l i 14 3t,->0 1..C1 16. '2 31. 3 l h . « t-ti 3 " " 6 3b. 7 3i>'8 3h(:<) 3b 10 3b l1 3612 3l> I I 3610 36 IS 3616 3617 36 18 3619 3b20 3b21 3622 1623 3629 3625 3626 3627 3b2B 3629 3700 371)1 3702 3703 37111 1705 3706 3707 3708 3800 3831 ' 3802 . 3803 3801 3805 38C6 3807 3808 3809 3810 3900 3901 3902 3903 3901 3905 3906 3907 3908 3909 3910 3911 3912 3913 3911 3915 39 16 3917 3918 3919 3920 3921 3922 3923 3929 3925 3926 3927 3928 3979 3930 3931 3932 3933 3911 3935 9000 9001 1002 9003 4009 4005 4006 9007 4100 9101 4102 4103 41U4 (COND ( ( U N I 1 E F P • P H I t l T R . I C H ' . ) (STATUS (4 QUOTE Kit.) (4 B R E A K P O I N T UII)) NIL) ( (A l ' I ' L l l I ' K I N T H A C m i (CAK L) (CUR L ) ) ) ) ) ( D E F P R O P • O U E A S P O I S T PRACItO I M i l l T R ACliO) 93 (DEFUN O I S K I N PEA PH ( » L « ) ( P R O C ( I F S S I ) ( R A P C • ( L A R U D A ( I F I L E I ) ( S E T Q I F N S * ( D I S S I S 1 I F I L E I ) ) ( C O « D ( I F N S I ( M I N I ( L E N G T H 1FNSI)) (PR1N1 ' " F O U R S B E A D F R O R : " ) . I P S I N 1 I F I L E I ) ( T E R P R I ) ) . ( ( R E T U R N T A I L ) ) ) ) (GO IF IKIS) ) ) (DEFUN DISKIN1 ( I F I L E I ) (PROG ( U i l l « C O R R K : I T S I IFNSI I E O F I I I N P U T I ) (APPLY1 « U P E N ( L I S T • ' I N I - 2 5 5 I F I L E I ) ) (STATUS ( 1 2 I I N I I E U F I ) ) (WHILE T (SETO I EOFI • (LAK3DA (SETQ ICOSREKTSI NIL) (DISKINCOR) (SETQ I E O F I •(LAR3DA X (GO IRISRATCH))) ( S E T Q I I N P U T I (READ U N I ) ) (SEIQ IFNSI ( S : ; L . ~ C T P ( C A N I IKPUTI) ( O E F O N (CONS (CADS IINPUTI) IFNSI)) (DEFPROP (CONS (COtfS (CAOR I INPUT I) (CADD3 IINPUTI)) IFNSI)) ((THCOSSE THANTE THEBASING) (CONS (CONS ( C A D R IINPUTI) "THEORER) IFNSI)) (CONS (CONS (SE'JSYR ' S A V E ) IINPUTI) IFNSI) ) ) (EVAL IINPUTI) (AND ICORHSaTSI (PUT (COHD ((ATOR (CAR IFNSI)) (CAR IFNSI)) ( ( C A A R IFNSI) ) ) •" .COKREBTS." (BEVERSE ICOKRESTSI)) ) ) IRISRATCH (PBINTRSSG ERROUT •••• UHRATCHED PARENTHESIS ••• LAST DEFINITION SAS" ((CAB tPNSI ) ) ) (RETURN NIL) •FINIS (EOF I I H I ) (PUT t F I L E t ' " . F N S . " (HEVERSE IFNSI ) ) ) ) (DEFOS DISKINCOR () (HEADLINE t i n t ) (BEPEAT • (SELECTQ (READCH U N I ) (" ") ( " I " (SETQ ICORREBTSI (COBS (COPY [CAR U N I ) ) ICORRErlTSI)) (READLIHE I INI) ) (PROGS (STATUS (11 I IS I 0)) (RETURN NIL 'DISKINCOR))) 1000)) ; • » » « . D I S K O U T * (DEFUN DISKOUT FEXPR ( L ) (PROG (FILE BUFFER) ' • . (SETQ PILE (ONCORS L L ) ) (OB L (RETURN '"OISKOUT VHAT7")) (APPLY 1 'OPEN (LIST 'BUFFER 250 PILE) ) (COND ((DISKERRSET (RAPC ' D I S K O O T L l ) ) (DISKO'JTDATE BUFFER) 'DOSE) (•PAIL))) ) (DEPUH DISKOUTFORB (FN) (PaOG (FLAG ARSS FORR RAXLES) (SETQ RAXLEN (COND ((UNDEFP '7DISKSAXLEB) 105) (7DISKRAXLEN))) (COND {(ATOR FN) (SETQ FLAG 'EXPR)) ( (SETQ PS (USC08S FN FLAG)) ) ) _. . .. (AND (ATOR PS) (RAPC • (LARBDA ( L ) (PRINT L BOPFE8)) (GET FN '".CO . I R E N T S . » ) ) ) . (TAB 1 BUFFER) (COND ( (LISTP PLAG) (PrFOr.R FLAG BUFFER RAXLEN NIL) ) , ((OB (SEQ FLAG 'EXPR) (LISTP F N ) ) . (PPFORfl (KC03C (LIST 'DEFPROP FN FLAG) (LIST (GET (COND ((ATOR FN) FN) ((CAR FN))) FLAG ' (GO I5RB1}))) BUFFER RAXLE3 S I L ) | (T (SETQ FORE ( G E T FS 'EXPR '(GO IERR1))) (PRIN1 •"(DEFUN" BUFFER 2) (P3IN1 FN BUFFER 4) (PRIN 1 (SELECTQ (U1ICOSS FORR FORR) (LARDDA (RETURN NIL 'PRIS1) ) (FLARBDA * FEXPB) (SLARBDA 'SEXPB) NIL) BUFFER) (PBIH1 (COND ( (SETQ ABGS (UNCOSIS FORR FORR)) ARGS) (•"()•)) BUFFER) (RAPC ' (LARBDA (FORR) (TERPBI BUFFER) (TAB 3 BUFFER) (PPFORR FORR BUFFER RAXLES SIL) ) PORB) (PBIS1 ' " ) « BUFFER 2) )) (TERPRI BUFFER) (PRIST •" " BUFFER) (DISKOUT!) (BETURS T) IE2B1 (PBINTRSSG EB ROUT "NOTHING OS ATOR" (FN) "UNDER TAG" (FLAG)) (DISKER8))) (DEFUN DISKUUTI () (APPLY! * STATUS (LIST 15 'BUFFER (TIRES (FIX (DIVIDE (ADD (STATUS (15 BUFFER)) 100000) 100000)) 100000)) •(16 BUFFER 2050)) (PRIST ' " " BUFFER) (STATUS (16 BUFFER 2048) ) ) (DEFUN DISKCUTL ( L ) (RAPC 'DISSOUTFORR (CONO ( (L ISTP L) L) { (GET L ' " . F N S . " ) ) »105 (T ( P R I H T M S S G E R R O U T " S O FSS S T O B E D U N D E R » T O B:« (LU I D I S K E R R ) ) ) ) ) _ . 6200 0201 (DP .FHS D I S K F S R 5 E T REXPR.(ILI) 6202 ( E V A L IL*) 0201 I) "20i» a 11.0 »10t ( D E 7 U N DTSKERB t» 03U2 ( K E T U R ! ; N I L ' D I S K S R H S ET ) ) 0101 a a 00 0001 (DEFUN DISKOUTOATE ( B U F F E R ) 0002 (PKtNl •";" D U F F E R ) . O O O J (PBIN1 ( S T A T U S 01) B U F F E R ) 0002 ( P 3 I N 1 ( S T A T U S OJ) B U F F S ! ! ) 0005 • (TERPRI B U F F E R ) ) • . . . . . . . . . 0006 0500 0501 ; * • • * • D 3 E V E R S E * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 0502 OSOJ ( D E F O H D R E V E R S E ( L S T ) 0500 ( P B O O (LAST N E X T ) 0505 ( A N D ( A T O H L S T ) (RETURN L S T ) ) 0506 ( R E P E A T '(SETQ N E X T ( C D B L S T ) LAST (RPLACD L S T LAST) L S T N E X T ) 1000 N I L ) 0507 (RETURN LAST))) 0503 06C0 0601 .«.«..; Bi T l :.....»..»•»....•.•». 0602 0603 • (DEFUN E D I T E (EDITLIST) 0600 ( O P E N ( E D I T I N 100 'SOURCE') ( E D I T O C T 70 "SINK*) (PRETTIBUFFER 80 "SINK*)) 06C5 (STATUS (10 E D I T I N ".") (10 E D I T O U T :) (10 PRETTIBUFFER :)) • 0606 ( S E T Q E D I T E L E ' S D I T U I I D O L I S T ) 0607 (BE.". ' E D I T U NDOLIST "EDITFLAG') 0608 (EDITSTART EDITLIST)) 0609 0700 0701 >*****g[)XTF****************************** 0702 0703 ( D E F U N EDITF F E X P R ( E D I T L I S T ) 0700 ( O P E N (EDITIN 255 'SOURCE*) (EDITOCT 70 •SINS') (PRETTYBUFFER 60 »SINK»)) »705 ( S T A T U S (10 EDITIN " . " ) (10 EDITOUT :) (10 PBETTYBUFFER :)) •706 (MAPC •(LAMBDA (EDITELE) 0707 (TEBPRI EDITOUT) 0708 ( P B I N1 ' " E D I T I N G " E D I T O U T ) • 709 (PBIH1 EDITELE EDITOUT) "-' 0710 (TEBPBI EDITOUT) 0711 (EDITSTA3T (GET EDITELE • 712 •EXPR 9711 •(PBOGN (TERPRI EDITOUT) 0710 (PBIH1 EDITELE EDITOOT) • 0715 (PRIS1 •" NOT F O U N D " EDITOUT) 0716 (TERPBI EDITOUT) • 9717 (UNEVAL 'EDITSTABT N I L ) ) ) ) ) 0718 E D I T L I S T ) ) 0719 8800 0801 ' (DEFUN EDITNEXT SEXPR (EDITFLAG) 0802 - (BEAD EDITIB 0 EDITINTERCEPT)) • «ao3 9900 • 9901 (SETQ EDITIBTERCEPT »(LAMBDA (EDITDEV) 0902 (COND ( (EQ EDITFLAG *A) (RF .TUBN **EDITFLAG* 'EDITNEXT) ) 0903 . . (EDITFLAG ( E D I T E R R "nlSSING SOMETHING")) 0900 (T (OR (MEMO EUITLASTCOMMAHD •(P P? ? 7? E TEST NIL UNBLOCK HELP)) • 90S • (SETQ EDITLASTCOHMAND NIL) 0906 (EDITONE ' P ) ) •907 (BEADLINE EDITIN) '. •90S (UNEVAL 'EDITNEXT T))))) 0909 5000 .5001 (DEFDN EOITSMASH EDITARG 5002 (PBOG (EDITA EDITCOONT) 5003 (SETQ EDITA (LIST COnnASD) EDITCOUNT 1) 5008 100P " 5005 (AND (GREATER? EDITCOUNT EDITABG) ( B E T U B B ( S E T Q EDITONDOLIST (CONS EDITA EDITONDOLIST)>)) 5006 (NCONC EDITA 5007 (CONS (CONS ( A S G EDITCOUNT) (CONS ( C A B (ABG EDITCOUNT)) (COR (ABG EDITCOUNT)))) NIL)) 5008 (BPLACA (ABG EDITCOUNT) (ASG (ADD1 ECITCOUST))) 5009 (BPLACD (ASG EDITCOUST) (ARG (ADD EDITCOUNT 2))) 5010 (SETO EDITCOUNT (ADD EDITCOUNT 3)) 5011 ' (GO LOOP))) 5012 5100 5101 (DEFUN EDITSTART (EDITLIST) 5102 (PBOG (EDITCHAIN LASTAIL EDITLASTCOMMASD PRETTYB PBETTIC EDITLASTAIL EDITNEKUNPBINT BDITUI1PBINT 5103 EDITUSDOLIST) 5100 (SETQ EDITCHAIH (CONS EDITLIST NIL)) 5105 (SETQ EDITUNOOLIST ( G E T EDITELE '«EDITFLAG»)) 5106 (OPEN (PBBTTYTDY 60)) 5107 (SETQ PRETTYB 60) 5108 (EDITONE 'P) 5109 EDITLCOP 5110 (EDITTOP ( S E T Q EDITLASTCOMMASD (EDITNEXT N I L ) ) ) 5111 (GO EDITLOOP))) 5112 5200 5201 (DEFUN EDITONE (COMMAND) 5202 (PBOC (EDITA EDITS EDITC E D I T D E D I T E EDITF) 5203 (COND ( ( N U L L COMMAND) N I L ) 52C0 ((NUMilERP COMMAND) 5205 (COND ( ( Z E R O P COMMAND) 5206 (OB ( C D S EDITCHAIH) (EDITZBR "YOU'RE AT THE T O P " ) ) 5207 (SETQ EDITCHAIH (COB EDITCHAlN))) 5208 { ( B I S U S P COMMAND) -• • 5209 (AND (GREATIC3P (MINUS COMMAND) (LENGTH (CAR EDITCHAIN) ) ) 5210 (E D I T ERR "TOO F E S E L E M E N T S " ) ) 5211 ( E D I T O N E (ADD 1 5212 COMMAND 5213 (COND ((ATOM (CAB EDITCHAIN) ) 5210 (EOITERB "CURRRHT P.X PRESi 10:1 IS AN ATOP.")) 5215 ((LENGTH (CAR EDITCHAIH))))))) 5216 (T (SETQ EDITA (CAB EDITCHAI") ) 5217 (SETl) EDITCHAIN ( C O N S (CAR ( S E T Q LASTAIL ( C O S D ((ATOM EDITA) 52 18 ( E D I T E R R "CURRENT EXPRESSION IS AN ATOM")) 5219 ((SETO EDITB (NTH EDITA COMMAND)) 5220 E D I T U ) 5221 ((EOITEHK "TOO FEU ELEMENTS"))))) 5222 EDITCHAIH))))) S223 ((SELECTQ COMMAND 5221. (I ( S E T O EDITCHAIN ( L A S T E D I T C H A I H ) ) ) Q C 5225 (!0 (1)11 (L'I'R EliITCIIAIN) (SUITEIin " I O " ' H E AT THE TUP")) -7J 5226 ( P R O C NIL 5227 LOOP 52:a (scro E D I T C H A I N (CDR E D I T C - H A I S ! ) 52.'") • ( A S D ( T A I L P (CAR EDITCHA III) (C.'.DR E D I T C H A I H ) ) (CO L O O P ) ) ) ) 5230 (NX (SETQ E D ; r C l l . M . 1 ((LAKtlDA (E'.'TTCHA I S) 52)1 ( E t l l T O N " « K P ) 5232 ( S C - Q E D I T A (CAR - M " C H A I N ) ) 5233 (OH JSC E D I T A ( C A H ITCHA I N ) ) ( E D I T J N E •!0)) 5210 (OH (::;rQ LOITU (AND (TAIL? E D I T A (CAR E D I T C H A I H ) ) 52 35 (CDS EUITA))) 5236 (SCITERR "YOl'MlE AT THE "'1D") ) 5237 (co:ir; (CAR (SETQ L A S T A I L C D I T U D E D I T C H A I N ) ) 5238 E D I T C H A I H ) ) 1 5239 (BK (SETQ EDITCHAIH ( ( L A M B D A ( E D T T C H A I N ) 5200 . ( E D I T O N E •UP) 5201 (SETQ E D I T A (CAI) EDITCHAIII)) 5 2 0 2 ( E D I T O N E M O ) " ' 5203 • (AND (EC (CAR E D I T C H A I N ) E D I T A ) 5 2 U S ( E D I T E B B "lOU".i:: AT T H E DEO INNING")) 5 2 0 5 (SETQ E D I T B (CAR E C I T C H AIS)) 5206 (PROG N I L 5207 LOOr 5208 • ( A N D (EQ (CDR E D I T B ) E D I T A ) 5209 ( R E T U R N ( C O N S (CAH ( S E T O L A S T A I L EDITS)) 5250 EDITCHAIH))) 5251 (OR ( S E T O E D I T U (CDR E D I T H ) ) 5 2 5 2 (EDITEHK "EXPRESSION IS LAST EXPRESSION")) 5253 (GO L O U P ) ) ) S 2 5 0 EOITCHAIN))) 5255 (1 NX (SETQ E D I T C H A I H ( ( L A M B D A ( E O I T C H A I N ) 5255 (PROG N I L 5257 LOOP 5258 ( C O N D ( ( N U L L ( S E T O EDITCIIAIS (CDR EDITCHAI:!))) 5259 (EDITK3R "YOU'RE AT THE END")) 5260 ((NULL (CDS (MEHQ (CAS EDITCHAIH) 5261 (CADH EDITCHAIH)))) 5262 (GO LOOP) ) ) 5263 (EDITONE 'NX))) 5260 EDITCHAIH))) 5265 (r (SETQ EDITA (EDITNEXT I)) (EDITFINDIT)) 5266 (UP (P30G NIL 5267 (SETQ EDITA (CAR EDITCHAIH)) 5268 LOOP .' . 5269 (COSD ((NULL (SETQ EDITB (CDS EDITCHAIH))) 5270 (EDITEBH "NOT A SUBEXPRESSION")) 5271 ((TAILP EDITA (CAS EDITB)) (RETURN NIL)) 5272 ((NOT (SETQ Z D I T C (MEMQ E D I T A (CAR E D I T D ) ) ) ) 5273 (EDITERR " S O T A TAIL")) 5270 ((OS (EQ EDITC L A S T A I L ) 5275 (NOT (SETQ E D I T D (MEMQ EDITA (COR EDITC)))))) 5276 ((AND ( E Q EDITA ( C A B L A S T A I L ) ) (TATLP LASTAIL EDITD)) 5277 (SETQ E D I T C L A S T A I L ) ) • 5278 (T (TERPRI EDITOCT) 5279 (PRIN 1 E D I T * E D I T O U T ) 5280 - ( P B I N 1 '" LOCATION UKCCRTAIN" E D I T O U T ) ) ) 5281 ' (COND {(EQ EDITC (CAR E D I T D ) ) (SETQ " C I T C H A I N E O I T B ) ) 5282 (T (SETQ EDITCHAIH ( C O N S E D I T C E D I T B ) ) ) ) ) ) 5283 {(IRSEBT I) • •' 5281 . • -"•••-(EDTTCOLLECT • •'(A'FTS»-BEF9RE 1 FOR - »ED:TFEAG» -:) ) 5285 ((LAMDDA (EDITCHAIH) • 5286 (SETQ E D I T D EDITA E D I T E EDITB) 5287 (COND ((MEMO EDITS • (: *EDITFLAG*)) (SETO EDITE 'FOR)) 5288 ((EDITEVAL '('EDITFLAG* :)))) 5289 (SELECTQ E D I T E 5290 (AFTE3 (EDITSMASH (CAS' ESITCKAIS) 5291 (CAAB EDITCHAIH) 5292 (NCONC E D I T D ( C D A B EDITCHAIH)))) 5293 ; (BEFOBE (COND ( (HULL (CDR CCXTCHAIN)) 5290 (EDITSMASH (CAR EDITCHAIH) S29S ( C A P E D I T D ) '5296 (HCOSC (CDR EDITD) 5297 (CONS (CAAB EDITCHAIH) 5298 (CDAB EDITCHAIH))))) 5299 ((TAIL? (CAB EDITCHAIH) (CAOH EDITCHAIH)) 5300 ( E D I T O N E ' O K ) 5 3 0 1 ( E D I T O N E ' U P ) 5302 (EDITSMASH (CAB EDITCHAIH) 5303 (CAAR EDITCHAIH) 530* (NCONC E D I T D (CDAB EDITCHAIN)))) 5305 ft ( E D I T O N E ' I IP) 5306 (EDITSMASH (CAR EDITCHAIH) 5307 ( H C O N C E D I T D (CAAB EDITCMAIN)) 5308 (CDAB EDITCHA IN) } 5309 (OR (CDS EDITCHAIN) ( E D I T O N E 0))))) 5310 (FOB (EDITSMASH (CAR EUITCHAIti) 5311 (CAR CDITD) 5312 (NCONC (CDR EDITD) (CDAB EDITCHAIN)))) 5313 (EDITEBB "SOT BEFORE, AFTEfl, OR FOR"))) 5310 EDITCHAIH)) 5315 {(EBBED EM) 5316 ((LAMBDA (EDITCHAIN) 5317 (EDITEVAL '(IN *EDIT7LAG* :)) 5318 (EDITSMASH (CAB E D I T C H A I H ) 5319 (COPY (EDITNEXT T) •• (CAAR EDITCHAIH)) 5320 (CDAB E C I T C I I A I N ) ) ) 5321 EDITCHAIH)) 5322 ((EXTBACT EX) 5323 ((LAMBDA (EDITCHAIH) 5320 . . (EDITEVAL •(FROM 'EDITFLAG* :)) 5325 (SETQ EDITD (CAB E D I T C H A I N ) ) ) 5326 EDITCHAIN) 5327 {(LAMBDA (EDITCHAIN) 5328 (EDITEVAL •("EDITFLAG* :)) 5329 (OB ( F I N D (CAR E D I T D ) (CAB EDITCHAIN)) 5330 (EDITEBB "NOT A SUBEXPRESSION")) 5131 (EDITSMASH (CAH EDITCHAIN) (CAB E D I T D ) (CDAB EDITCHAIN))) 5332 EDITCHAIN)) 5333 ((DELETE D) 5310 ((LAMBDA (EDITCHAIN) 5115 (EDITEVAL •(•EDITFLAG* :)) 5336 (COND ((NULL (CDS EDITCHAIN)) 5337 (EDITSMASH (CAB EDITCHAIN) 5138 (CA OA B EDITCIIAia) 5339 ( C D D A R EDITCHAIH))) 5300 ((TAILP (CAR EDITCHAIN) (CAOR ECITCHAIH)) 5301 I E D I T O N E ' U K ) 5302 ( E D I T O N E ' U P ) 5303 5 3 0 0 5305 5 1 0 0 5307 5308 5307 SJ10 5311 5 3 5 2 5 3 1 3 5 3 5 0 53 55 5 1 5 6 5 3 5 7 5358 5 3 5 3 5 3 b 0 5 3 6 1 5 3 6 2 5 3 6 3 5 7 6 0 5 3 6 5 . S 3 6 6 5 3 6 7 5 7 6 8 S 3 b 9 5 3 7 0 5 3 7 1 5 3 7 2 5 3 7 3 5 1 7 0 5 3 7 5 5 3 7 6 5 3 7 7 5 3 7 3 5 3 7 9 5 3 8 0 5 3 8 1 5 3 8 2 5 3 H 3 5 3 8 0 5 3 8 5 5 3 8 6 5 3 8 7 5 3 8 8 5 3 8 9 5 3 9 0 5 3 9 1 5 3 9 2 5 3 9 3 5 3 9 0 5 3 9 5 5 3 9 6 S 3 9 7 5 3 9 8 5 3 9 9 5000 5 0 0 1 S O 02 5 0 0 3 S ^ O O ' w ; ) 5 5 0 l > 6 S-.C7 5 0 0 8 5 0 0 9 5 9 1 0 S O U 5 0 1 2 5 0 1 3 5 0 1 0 5 9 1 5 5 4 1 6 5 4 1 7 5 0 1 8 5 4 1 9 • 5 4 2 0 5 4 2 1 5 9 2 2 5 0 2 3 5 9 2 4 50 2 5 5 0 2 6 54 2 7 5 0 2 8 50 2 9 5 4 1 0 5 0 1 1 5 4 1 2 50 1 3 5 4 3 4 5 0 I S 50 1 6 5 0 1 7 5 4 1 8 5 4 1 9 5 0 0 0 5 4 0 1 5 O 0 2 • 5 4 0 3 5 0 0 4 5005 5006 5 0 0 7 5008 . 5009 5 1 5 0 5 0 5 1 5 4 5 2 5 4 5 3 5 0 1 4 5 4 5 5 5 4 5 6 5 4 5 7 5 0 5 8 5 4 5 9 50 n O 5 4 6 1 5 4 6 2 nu " S O T A siinEXPRESSTON")) . F I R S T A X G U R E N T H U S T B E A N U R E E R " ) ) (EDITSRASH (CAH EDITCII.UN) (CHAR EDITCHAIN) (T (EDITSRASH (C\i'. *'•> t T ' . " 'A IN ) "0 (CAPAS : U ! 7 C I I . 1 I « ) (CUOAR riHTCIIAI :<) )) )) EDITCHAIN)) (RH ((LARL1DA (EDITCHAIN) (SETS EDITD (SOITSEXT A ) ) ( KD (T rv A t • ( • E D I T P I . A G * : ) ) (ott (i.:s?p ( C A A I I c i i t r c i i A : N I ) (;.o . (OR (N'no'-rHi1 " ^ : T O ) (':tH7'-:t<a (SETS -!}TT A (CAR i.'DITCHA IH) ) (CON D ((7.FTO? EDITD) SI'.) (tJIIliUS? EDITD) (ECirOBE 1) (EDI'MCE (S!!U1 EDITD)) ' (EDITl'SS 'UP) (EDITSRASH EDITA (CAR E01TA) (CDAR EOiT^HMN) (CAR ZCITCKAIN) (CAAR EDITCHAIN) NIL (SETO EDITD (LAST (CAR EDITCHAIN))) (CAR EDITB) (CDR EOIT.M)) (T (EDITONE (ADD 1 EOITD)) (EDITOSE.'UP) (EDITSRASH EDITA (CAR EDITS) (CDAR EDITCHAIN) (CAR EDITCHAIN) (CAAR ZDITCIIAIS) NIL (SETQ ECITB (LAST (CAB EDITA))) (CAR EDITB) (CDR EDITA))))) EDITCHAIN)) (IIL ((LABBDA (EDITCHAIN) (SETQ EDITD (EDITNEXT A)) (EDIT EVAL 1 (•EOITFLAG• :)) (OR (LISTP (CAAS EDITCHAIN)) (EDI7EM "NOT A SUBEXPRESSION.") ) (OR (NUK8ERP EDITD) (EEITES5 "FIRST ARGUESST BUST BE A SUEB5R")) (COND ((SETQ EDITS (7AILP (CAR EDITCHAIN) (CADR EDITCHAIN))) (EDITONE 'BK) (EDITONE ' U P ) ) ) (SETQ EDITA (CAR EDITCHAIN)). (COND ((ZEROP EDITD) NIL) ( (EQUAL EDITD - 1) (EDITSRASH EDITA (CONS (CAR EDITA) (CADR EDITA)) (CCDR EDITA))) ((HIHOSP EDITD) (REPEAT '(EDITONE ' B K ) (SUB - 1 EDITD)) . (EDITONE * OP) (EDITSRASH EDITA (CAR EDITA) (CAUR EDITA) (CAR EDITCHAIN) (COKS (CAAR EDITCHAIN) (CDAR EDITCHAIN)) (CDD3 EDITA) ) ) "(EDITE (EDITONE "2) (EDITONE (ADD 1 EDITD)) (EDITONE 'UP) (EDITSRASH EDITA (CAR EDITA) (CADR EDITA) (CAB EDITCHAIN) (COBS (CAAR EDITCHAIN) (CCAB EDITCHAIN)) (CDDR EDITA))) ((EOUAL EDITD 1 ) (EDITOSE 1 ) (EDITSKASH EDITA (CAAS EOITCHAIH) (CONS (CDAR EDITCHAIN) (CDB EDITA)))) (T (EDITOSE 1 ) (EDITONE EDITD) (EDITQNE 'UP) (EOITSBASH EDITA (CAAR EDITA) (CDAR EDITA) (CAR EDITCHAIN) (CAAR EDITCHAIN) (CONS (CDAR EDITCHAIN) (CDR EDITA))))-)) EDITCHAIN)) (BO ((LARBDA (EDITCHAIN) -(EDITEVAL '(•EOITFLAG* :)) * (OR (LISTP (CAAR EDITCHAIN)) (EDITERR "NOT A SUBEXPRESSION")) (COSD ( (CDA AR EDITCHAIN) (EDITSflASH (CAR EDITCHAIN) (CAAAR EDITCHAIN) (CDAAH EDITCHAIN) (SETO EDITB (LAST (CAAR EDITCHAIN))) (CAR EDITB) (CDAR EDITCHAIN))) ((EDITSflASH (CAR EDITCHAI!.') (CAAAR SDITCHAIU) (CDAR EDITCHAIN))))) EDITCHAIN)) (BI ((LARBDA (EDITCHAIN) (EDITEVAL • (THBU •EOITFLAG* :)) - - . • • - • (SETQ EDITD (CAR EDITCHAIS))) EDITCBAIS) ((LARBDA (EOITCHAIH) (EDITEVAL •(•EOITFLAG* :)) [OR (TAILP (CAR EDITCHAIN) EDITD) (EDITER3 "NOT OF THE SARE LIST")) (COND ((SQ EDITD (CAR EDITCHAIN)) (EDITSSASI1 EDITD (CONS (CAR EDITD) SIL) (CDR EDITD))) ((EDITSRASH EDITD (CONS (CAR EDITD) (CDR EDITD)) (CDAB EOITCHAIH) (CAR EDITCHAIN) (CAAB EDITCHAIN) SIL)))) EDITCHAIN)) (UNDO (SETQ EDITA (EOITSEXT A)) (OR EDITHSDOLIST (EDITERR "ilOTHISG SAVED")) (COSD {(EQ EDITA ••SDITFLAG*) (PROG NIL l i t 1.1 V I . . I I s:;..', V I . . C . ' Sai.7 50..9 5 i 10 Sa /1 s i '1 M i l SO IU sa ;s 5a !t> sa )7 5 U 7 3 50 79 5a:»0 b * i l Sa .2 S O f l S » n 0 Si..5 5a .6 S«..7 Si.-9 SUnl 55-10 Sail sa 12 sa '7 5fio 51 >5 sai6 5697 5998 59'.9 5SC0 5501 s-,;2 S 5 0 3 5500 55*5 5S.-6 SSf-7 SSC.8 5509 5510 5511 5512 5513 5510 5S15 5516 5517 55 tS 5519 5520 5521 5522 .5523 5600 5631 5632 S603 5600 5605 5636 5607 5603 5609 5610 5611 5700 S701 S702 5703 5700 S705 5706 5707 5708 5709 5710 5711 S712 5713 5710 S715 5800 5801 J3C2 5803 5803 5305 5806 5900 5901 5902 5903 5900 5905 6000 6031 6002 6003 6 3 3 0 6C0S 6006 6037 6008 6103 6101 6102 61C3 6100 6105 6136 6107 6108 • (SETO EDIT3 EDITUNDOLIST) L O O P 97 (couo (<s;u.i. EUITII ) (H I I T E K R "UNDO U H A T ? " ) ) ( (1\1 (CAAB SO IT . . ) •OLtCk) (I'll I T':3 II •MINDO BLOCKED")) ( ( M .1 f.. (CAAB i - I i l l ' l . ) » (i::i.JO HINDU NIL.) ) 1,'uin, (cbit !:u:?u)> (•'••• ••• •••)» (T (';;.[ .'!:r.:-:il' (CAAX £ D I : : J ) ) [EUIT:i:.'0.) EDIT3 *u : . D O ] ) ) ) ) (T ( P B O G II I L (SETO. EDITC EDITUKDOLIST) LOOP • (CO!ID ((NULL EDITC) (ZOITEBU "THERE ISN 'T O N E " ) ) ((.I'J ( C A A B EDITC) EDITA) ISDITII.'.CD? (CAAH EL'ITC)) (EDITIISCO EDITC ' U N O ) ) (T ( S E TQ EDITC (CDK EDITC)) (GO L O O P ) ) ) ) ) ) ) (tUNDO (OR (SETO EEITO NIL EDIT A EDITUNDOLIST) (EDITS3R "NOTHING SAVED")) (P1IOG NIL L O O P (CON D ((OR (NULL EDITA) ( E Q (CAAR EDITA) -BLOCS)) (EDIIUJ.n.J (COUS ( C C " S 'USCC EUITii) NIL) 'HINDU)) ( ( N O T (CAri EDtrj)) (SETS EDITA (CDR EDITA)) (GO LOOP)) (T (EDITU.ICUP (CAAR EDITS)) (SF .70 ED 173 (NCONC EDITB (CDAR EDITA))) . (RPLACA EDITA NIL) (SETU EDtTA (CDR EDITA)) (GO LOOP))))) (-.P (UB EDITUNPRINT (EDITEBB "NOWHERE T O GU") ) (SETO EDITCHAIN EDITUNPBINT) ) (S ( T U T (SDIFNEXT T ) ••EDirFLAG* (COPI (CAN EDITCHAIN)))) UP ?) (SETQ EOITUNPRIST E3ITNEUUN3BINT EOITNZWUNPBIST EDITCHAIN DOTFL.YG (TAIL? (CAR EDITCHAIN) (CADB EDITCHAIN))) (COSD ((TO CORRAND • ?) (?RI:iTLEV (CAS EDITCHAIN) 1000)) ((NIIHUEBP (SETQ EDITA (EDITNEXT A))) (PSISTLEV (CAB EDITCHAIN) EDITA) ) ( (PR INTLEV (CAB EOITC'.UIN) 2) (EDITONE EOITA)))) (PP (SETQ EDIl'UNPHIKT EDITS EWIIH PBI N T EDITSEWUSPH1ST EDITCHAIN) (i'PFOKR (CAR EDITCHAIN) PR ETTY3UFFE3 70 T ) (TE3PRI PRETTY3UPFEB)) (E (PRIST (EVAL (EDITNEXT T ) ) ) ) (OK (EDITONE ' T E S T ) (PUT EDITELE '•EDITFLAG* EOITDNCOLIST) (UNEVAL 'EDITSTABT NIL)) • (TEST (SETO EDITUNDOLIST ( C C N S (CONS * BLOCK NIL) EDITUNDOLIST))) (UN3LOCK (RAP •(LARBDA (EDITELE) (COND ((EQ (CAAB EDITELE) 'BLOCK) (RPLACA EDITELE NIL) (ONEVAL 'RAP N I L ) ) ) ) EDITUNDOLIST)) (7? (TERPRI EDITOUT) (RAPC • (LARBDA (EDITELE) (COND (EDITELE (PBIBV (CAB EDITELE) EDITOUT) (PBIN1 •" « EDITOUT)))) EDITUNDOLIST) (TERPRI EOITOUT)) (HELP ( R T S '"COPY CS:HINTED.HELP")) (PBOGN (PR IN 1 CORRAND EDITOUT) (PSIN1 •" WHAT?" EDITOUT) (TERPRI EDITOUT) (EOITEBR NIL))))))) (DEFUN EDITFIND (EDIT3) (COND ((EQUAL EDITA EDITD) (COBS EDITB NIL)) ((ATOR EDITD) NIL) ((AND (ATOR EDITA) (EQ EDITA (CAB EDITB))) (CONS EDITS NIL)) ((PBOG (EDITD) (SETQ EDITD EDITB) LOOP (COSD {(NULL (SETQ EDITLASTAIL EDITB)) (RETURN NIL)) ((SETQ EDITC (EDITFIND (CAR EDITS))) (RETURN (NCOBC EDITC (CONS EDITD NIL)))) (T (SETQ EDITB (CDS EDITB)) (GO LOOP))))))) (DEFUN EDITCOLLECT (EDITSTOPPEB) (PROG NIL (SETQ EDITA NIL) LOOP (COND ( (NOT (RE".g (SETQ EOITB (EDITNEXT A)) EDITSTOPPEB)) (SETQ EDITA (NCONC EDITA (COSS (COND ((AND (EQ EOITB ' I I ) (REHQ CORRAND '(I INSERT))) (GET (EDITNEXT T) ••EDITFLAG* •(EDITEBB "NOTHING SAVED"))) (EDITB)) N I L ) ) ) (GO LOOP)) - ((SETUSN EDITA))))) (DEFUN EDIT EBB NEXPR (EDITRES) (SETQ EDITLASTCORRAND «P) (OR (NULL EDITRES) (PRINT EDITRES EDITOUT)) (EDITCOLLECT • (*EUITFLAG*)) (UNEVAL • EDITTOP NIL) ) (DEFUN PBINTLE7 (EDITX EDITS) (TERJ'BI PHETTI8UFFEB) (PBISLSV 20ITI EDITS) (TERPBI P8ETTYGUFFEB)) (DEFUN RERCDB (EDITC EDITD) (PROG NIL LOOP (COND ((EQ EDITC (CUB EDITD)) (RETUBN T)) ((EQ EDITC EDITD) (BETURN NIL))) (SETQ EDITC (CDS EDITC)) (GO LOOP))) (DEFUN TAILP (EDITX EOITI) (AND EDITX (PBOC NIL LOOP (COND ((ATOR EDITY) (RETURN NIL)) ((SQ EDITX EDITY) (BETURN EDITX))) (SETO EDITY (CCR EOITY)) (CO LOUP) ) ) ) 6109 6200 6201 6202 6203 6?C0 hi'05 6." !b 6207 6208 6209 6210 62 11 62 12 6213 6219 6215 62 16 6217 6218 6219 6220 6221 6222 6223 6300 6301 6302 6303 6309 6305 6306 6307 6308 6309 63 10 6311 6100 6401 6402 6403 6904 6405 6406 6407 6908 6500 6501 6502 6503 6504 6505 6506 6507 6508 6509 6510 6511 6512 6513 6SI4 6».!I0 6t>cM M i 02 6b';l b7'l0 6701 6702 67C3 6704 6-70S 6706 6800 6801 6602 6900 hOOl b902 6903 69 04 6905 7000 7001 70C2 70(11 7004 700S 70G6 7007 7008 7009 7100 7111 7102 7103 7104 7105 7106 7197 7108 71C9 7110 71)1 7200 7201 7202 7203 7204 7205 7206 72tf7 7208 7300 7301 7302 7103 7109 7105 7306 7307 ( D R F U N rniiHEv (F D I T X E D I T S ) (CON!) t { » T c n EDIT)!) ( n a m EDIT*. P S E T T Y B B F P S S * ) ) • ((Z£:1UP E D I T N ) (Pl'INI 'C P P. E TT YM FT ES 2 ) ) ( T (rflOG ( E D I T * E D I T U ) (PHI.-U ( C U N D ( D O T F L A G (S?.r<? O O T F L A C N I L ) « ) (T • " ( " ) ) P R E T T Y Oil F F S R 2) ( P H I N L E V (CAI! "DIT1C) (fUBl E D I T N ) ) ( S E T O E D I T A E D I T X ) L O O " ( C O N D ( (" ER CDR E D I T ! E P I T A ) ( C O N D ( E D I T C (TRIM •"...«'• P R S T T Y B U F F E S ) (R F.TUHN . N I L ) ) (T (SETS E D I T S T ) ) ) ) ) ( S E T O EDITA ( C D 3 E D I T A ) ) ( C O R D ( ( N U L L E D I T A ) (PR I N t • " ) " P R E T T Y S U F F E R 2) ( R E T U R N N I L ) ) ( ( A T O M E D I T A ) ( P R I N 1 • " . " PS ETTYDUFTEE) (PRIN 1 EDITA P R E T T Y UU FFER 0 ) . . . . (PStM • " ) " PS ET 7 YL'U F FES 2) (LIETUKN N I L ) ) ) ( P B I S 1 •" " P R - T T C I V F F E S 2) ( C O N D ( ( L I S T P (CAR EDITA)) (PPINLEV (CAR E D I T A ) ( S U B 1 E D I T S ) ) ) (T (PS I1 I1 (CAR E D I T A ) P RETTY 3 U F F 2 R 6))) ( C O L O O P ) ) ) ) ) ( D E F U N E D I T F I N D I T ( ) ( S E T O E D I T B ( C A R E D I T C H A I N ) ) ( C O N D ( ( S F T Q EDITLASTAIL L A S T A I L E D I T F ( E D I T F I N D E D I T B ) ) ( S E T Q L A S T A I L ED ITLA S T A T L E D I T C H A I N (NCONC E D I T F (CDR E D I T C H A I N ) ) ) ( A N D ( A T O R (CAR E D I T C H A I N ) ) ( E D I T O N E 'UP))) ( T ( T E B P R I E D I T O U T ) ( P 9 I S 1 E E I T A E D I T O U T ) ( P R I N 1 • " NOT F O U N D " E D I T O U T ) ( T E R P R I E D I T O U T ) ( E D I T E B B N I L ) ) ) ) ( D E F U N E D I T E V A L ( E D I T T E S T ) ( E D I T C O L L E C T E D I T T E S T ) ( S A P C ' ( L A R B D A ( E D I T A ) ( C O S D ( ( O B ( S 0 H 3 S 3 ? E D I T A ) ( R E H Q E D I T A E D I T C O R R A N D S ) ) ( E D I T O N E E D I T A ) ) ( ( E D I T F I N D I T ) ) ) ) E D I T A ) ( O B ( N O T (CDR E D I T C H A I N ) ) ( T A I L P (CAR E D I T C H A I N ) ( C A D R E D I T C H A I N ) ) ( E D I T O N E ' D P ) ) ) ' ( D E F U N E D I T U N D O ( E D I T L I S T E D I T T Y P E ) ( P B O G ( E D I T A ) ( S E T Q E D I T U N D O L I S T ( C O N S ( C O N S E D I T T Y P E ( R E V E R S E (CDAB E D I T L I S T ) ) ) E D I T U N D O L I S T ) ) ( S E T Q E D I T A ( C D A B E D I T L I S T ) ) L O O P (OB E D I T A ( E E T U B S ( S P L A C A E D I T L I S T N I L ) ) ) ( S E T O E D I T E (CA AAR E O I T A ) EDITF ( C C A A B E D I T A ) ) ( S P L A C A ( C A A B E D I T A ) ( C A D A R E D I T A ) ) ( R P L A C D ( C A A B E O I I A ) (CDOAS E O I T A ) ) ( B P L A C A ( C D A R E D I T A ) E D I T E ) ( R P L A C D ( C D A R E D I T A ) E C I T F ) ( S E T Q E D I T A (CDR E D I T A ) ) ( G O L O O P ) ) ) ( D E F U N E O I T T O P ( E D I T L I S T ) -{ E D I T O N E E D I T L I S T } ) ( O E F U ; ( E O I T U N D O P ( E D I T E L E ) ( T E H P R I E D I T O U T ) • ( P B I N 1 E D I T E L E E D I T O U T ) ( P B I S 1 • » U N D O N E " E D I T O U T ) ( T E B P K I E D I T O U T ) ) ( S E T Q B D I T C O R R A N D S * ( N X OK P P P T E S T UNBLOCK. UNDO U P NX UNDO 0 7 7? - P ) ) . 98 ; * • * * • E L E R • * • • » • • * • » • * * • * » * • • •»«•#•••**•* (DEFUN ELEfl (LIST N) (CAB (NTH LIST N))) : » » » » » E X T B A C T F » « (DCrUN E X T 8 A C T F N N E X P R ( F N ) • -( P B O G ( F N S D O N ! F O B H B A R E ) ( S E T Q F N S ( L I S T N I L ) ) ( E X T R A C T F U N F N ) ( R A P C ' ( L A R B D A ( L I U ) ( S E R L I B ' " . L I N E S . " ) ) I L I B B A B Y L I S T » ) ( P U T F N '".FNS." ( C D B F N S ) ) ) ) ( D E F U N E I T B A C T F U N ( F N ) ( O B ( R S R Q F N D O N E ) ( P B O G ( I N D E X B U F F E B L O A D R A P T O P C A L L S L I B B A B Y L I S T ) ( S E T Q D O N E ( C O N S F N D O N E ) ) ( C O N D { ( L O A D S E T U P F N ) ( K A P C • ( L A R B D A ( L I K E ) (COND ( ( N U R B E R P L I N E ) ( E X T B A C T F U N I L I N E ) } ( ( E X T R A C T F U N L I N E ) ) ) ) L I S T ) ) ( T ( P B I N 1 F N ) ( P B I N 1 " I S N ' T IN L I B B A B Y S : " ) ( P B I B 1 < L I S B A R Y L I S T I ) ( T B B P R I ) ) ) ) ) ) (DEFUN E X T B A C T F U N I ( L I N E ) ( O B ( R E H Q L I N E ( G E T I I B H A B I ' " . L I N E S . " ) ) ( P B O G N ( P U T L I B R A S Y • « . L I N E S . " ( C O N S L I N E ( G E T L I B B A B Y ' " . L I N E S . " ) ) ) ( R E A D F R O R B U F F C S L I N E ) ( S E T Q FORR ( R E A D B U F F E R ) B A R E (AND (SQ (CAR FORR) ' D E F U N ) . ( C A D S F O R R ) ) ) ( A N D H A R E (HOT ( G E T N A R E ' E X ? S ) | ( E V A L F O B R ) ) ( N C O N C F N S ( L I S T (OS H A R E [ C O N S N I L F O B S ) ) ) ) ) ) ) ( D E F U N F N R A P F E X P R ( L ) ( P B O G ( B U F F I L E T A G S F N S 1 S T ) ( S E T Q F I L E ( C O N D ( ( A T O R ( C A R L ) ) ( U N C O H S L L ) ) ( • • S I N K * ) ) T A G S ( C O N D ( L ( C A B L ) ) ; 11 J 7H ••» 7 I 10 7111 7 112 7111 7 110 7 1 IS 7 1 lb 7317 7118 7 1 1 1 71?0 7121 7122 71/3 7320 • 7325 7000 7001 7002 7001 7 0"0 • 7005 71C6 70 7 ;o c a 7UC9 70 10 7011 7012 7o 13 7 0 1 0 7500 7501 7502 7503 7500 7505 7506 7537 7508 7SC9 7510 7511 7512 7513 7510 7515 7516 7517 7518 7519 7520 7521 7522 7523 7520 7525 7526 7527 7609 7601 7602 7603 76C9 7605 76C6 7507 7608 7609 7610 7611 7612 7613 7610 7615 7616 7617 7618 7619 7620 7621 76 22 7700 7701 7702 7703 7700 7705 7706 7707 7708 7709 7710 7711 7712 7800 7801 7802 7803 7800 7900 7901 7902 7903 7900 7' J 7906 7907 7908 7909 79 10 7911 7912 8000 8001 8002 8023 8000 <(1.T:;T • I - X P I I ) ) ) ) (API'lll •OPBH ( L I S T • t"K 2 5 5 F l i c ) ) ' ( K M ' U D ' ( L A R I I D A (A) ( C U M I ( ( » I ; B : F P 'A)| ( ( S ' V r o L S T ( G E T L ( S E T O F » S ( S O I I T L I S T rss ' C A H ) ) (PIMM •"UISTIBi; OF ALL ATORS WITH PBOPEIIT123 (PRIM TADS BUF 2 ) (TElU'HI HIIF) |rnru i ( S T A T U S oi) bin) (P1USI (STATUS 0 2 ) i!IIF| ( T K H F H I 1IIIF) (PR 1 N T 0 bUF 2 ) (FNftAPPRTNT (APPLT • (APTLT PHS) (RETURN •" -))) 99 TAGS)) (SETO FNS (CONS (CONS A (CAR LST)) FNS)))))) BUF 2 ) 'RAX (RAPCAR • (LARBDA (F) 'RAX (RAyCAR • (LARBDA (F) (PLEN (CAB F))) FNS)) (PLEtl (CDB F)) ) FNS)) S) (DEFUN FSRAPPRINT (COLI C0L2 (PBOG (ICOLS NCOL TAB) (5ETQ ICOLS (IDIV 100 (RAPC ' (LARBDA (F) (COSD ( ( E Q KCOL ICOLS) (ADD COL1 COL2 0 ) ) NCOL ICOLS COLI (ADD 3 COLI) COL2 (ADD 1 CUL2)) FNS) (TERPRI BUF))) (TERPRI BUF) ((SETO NCOL (A DD1 NCOL)))) (PRIN1 (CAS F) BUF 0) (TAB (SETO TAB (ACO TAB COLD) DUF) (PRIS1 (CDR F) BUF 0 ) (TAB (SETO TAB (ADD TAB C0L2)) DOF) (PRI8I ' 1 UUF)) (PRIB 1 •! BU?) (SETQ BCOL 1 TA8 1)) ;••*•* FNSIZE**** **•••*•• (DEFUN FNSIZE FEXPR (L) (PROG (I SUR COLI) (SETQ SUR 0 C0L1 (ADD 3 (APPLI 'RAX (RAPCAR "PLEN L)))) (PRINT •" ") (PRIN1 'FUNCTION) (TAU COLI) (PR IN 1 'CELLS) (TERPHI) (REPEAT '(PRIN1 •"-") (ADD COLI 6)) (TERPRI) (RAPC ' (LARBDA (NARE) (PBIN1 HARE) (TAB COLI) (PBIN 1 (SETQ » (COBSES (GET BARE •EXPB)))) (TERPBI) (SETQ SUR (ADD SUR I ) ) ) L) (REPEAT ' (PalHI V"-") (ADO COLI 6)) (TEHPRI) (PR IN 1 1 TOTAL) (TAB COLI) (PB IH 1 SUR) (TERPBI) (RETURN SUR))) (DEFUN GENLIB HEXPR. (FILE OLDLIB) . (PROG (OLDISDEX CKSO FSLIST DONE INDEX EXTERNAL TERP LINE EHTBT GENDUE) (OPEN (GES3UF 255 •SOURCE*)) " . . . (STATUS (10 GEKBUF t) ) (SETQ INDEX (LIST 'INDEX)) (G ENLIBINIT) (WHILE T (SETQ CHBD (READ GENBUP)) (SELECTQ CRSD (LIST (CERLIDLIST)) (EXTERNAL (GEKLIBEXT)) (ADD (GESLIBADD)) ((DELETE DEL) (CEBLIBDEL)) (OELFBOR (GEKLIBDELFROR)) (CLE AR EXT (SETQ EXTERNAL BID) (ADDTO (GESLI3ADDT0)) (STOP (RETURN 'STOP)) (OK (RETORS (COND ( (DISKERRSET (GENLIflGO)) 'OONE) (TAIL)))) (PBINT [EVAL CRND)))))) (DEFUN GENLIBLIST () (GENLI3RERG E FNLIST) (PRIST •" ") (PRIST '•INDEX*) (RAPC ' (LARBDA (L) (TAB 5) (PRIS1 L) (TERPRI) ) (CDB FSLIST)) (PRIST •« ») (PRIST •"•EXTEBBAL ESS") (TAB 5) (PRIS1 SXTEBNAL) (TERPBI) (PRIST •« ")) • • (DEFUS GEN LI BEXT () (PROG (L) (WHILE T (SETO L (BEAD GESBOF 0 *(LARBDA X (RETURN BIL)))) (SETQ EXTERNAL (CONS L EXTERNAL))))) (DEFUN GENLIBADD () (PROG (L BARE) (WHILE T (SETQ BARE (READ GESBUP 0 '(LARBDA X (RETURN NIL))) . L (READ GENBUF 0 '(LARBDA X (RETURN NIL)))) (BCOSC ENLIST (LIST (COSS HARE (COSD ( (LISTP L) L) ( [GET L '".FNS." •(RETURN (GBSLIBRSSG "NO FNS SPECIFIED 07" (1)) (DEFUS CENLIBRSSC PEXPR (ILI) (TE3PBI) (PR INI '* ERROR*) .(R A TC ' (LARBDA (IXl) (COND ((LISTP »XI) (PaiSI (EVAL (CAR IXI))>) ((PHIS! IXI)))) ILI) •BCOSC)))))))))) ( T E 0" I U 100 .M..0 (0RFIl:i GENLIUOEL () Hl<:2 (PRUC ( L ) aioi (WHILE T (r.ETO L ( H E A D .:rsuu>" 0 ' (LAMUDA t ( R E T U R N N I L ) ) ) ) S W (US (DELU (A : " .SJ L FNLIST • (RETURN N I L 'DELQ)) FNLIST) (GESLIfi.lSSC ( L ) "CAN'T S E r o a:iD " n n «11-1 rt2.il (DEFUN CENLIUGO () H202 ( r .E.'aiSRFIIGE F N l i r . T ) 11201 (SETO FNLIST (SUBTLIST (CDR FNLIST) * CAB) ) 8200 (APPLY 1 'Oi'ES (LIST 'BUFFER 120 FILE)) 3205 (STATUS (16 bllFFES 2 0 U H ) ) 8206 (MAPC • (LA.NDOA (F:IS) B207 ( N C O N C INDEX (LIST (SETO ENTBI (LIST (CAB FNS))))) 8203 (PKIN1 •»;....«" DUFF EH) 82>>9 (PHI.Nl ( C A S FSS) DUFFER 2) 82 10 (HEP EAT • (T H I ?; 1 •»•••• BUFFER 2) 6) 8211 (TF.RPRI BUFFER) 3212 (PRINT " iltlFPER) 8213 (BAPC ' (LAMIOA (FN) (NCONC ENTBI (LIST (GBNLIDOUT FN)))) (CDS FSS))) -8210 FNLIST) K2IV (DISKOUTDATE BllFFES) 8216 (CENLIBINDEX INDEX) ) 8217 8110 el'lt (DEFUN CENLIBOUT (FN) R102 (COND ((AND (ASSQ FN FNLIST) (N. -Q FN (CAB F N S ) ) ) FN) "1H3 ((SETQ TEMP ( A S S O C VM DUNE)) (CDR TE.1P) ) . b3"0 ((NEMO PH EXTKHHAL) FN) 8105 (T (SETQ LINE (r.E:iLIb>)) (SETQ DON E (CONS (CONS FN LINE) DONE) ) (DISK00TPORN FN) LINE))) 8106 8100 8001 (DEFUN GENLIB* () 8002 (FIX (DIVIDE (ADD 1000 (STATUS (15 BUFFER))) 1000))) 8001 8500 8501 (DEFUN GENLIBINDEX (INDEX) 85U2 (STATUS (16 BUFFER 2050) (15 BDFFEB -1000000)) 8503 (PBINT •-; LIBRARY INDEX" BUFFER) BS09 (STATUS (16 DUFFER 2008)) . • 8505 (PRINT '"(INDEX" BUFFER) • 8506 (NAPC • (LABUDA ( E ) (TAB 3 BUFFER) (PRIN1 E BUFFEB 6) (TERPBI BUFFEB)) (CDB INDEX) ) 8507 (PRINT •»} ; END OF INDEX" BUFFER)) 8508 8600 8601 (DEFUN GENLIBB EAD (N) 8602 (READFRON BUFFEB N) 8603 (SETQ F (HEAD BUFFEB) N (AND (EQ (CAB F) 'DEFUN) (CADB F ) ) ) 8610 (AUO B (EVAL F) ) 8605 (aa B (CONS NIL F I D 8606 8700 8701 (DEFUN GENLIBISIT () 8702 (PBOG (INDEX BUFFER F ) 8703 • (COND (OLDLIB (SETQ INDEX (GET OLDLIB '".INDEX." '(LOADINDEX OLCLIB))) 8700 (SETQ BUFFER (GET OLDLIB '".BUFFEB.") 8705 FNLIST (CONS NIL •8706 (RAPCA-R ** (LAMBDA (E) 8707 (KAPCAB • (LAMBDA (S) 8708 (COBO ((BUtlBEBP S) 8709 (GENLIBBEAO 8) ) 8710 («))) 8711 E)) 87.12 • IBDEX)))) 8713 (T (SETQ PNLIST (LIST NIL)))))) 8 7 1 0 8800 8801 (DEFUN CESLIBH2BGI (LIST) 8802 (BAPC • (LAMBDA (S) 8803 (BAPC • (LASQDA (FS) ' 8800 (AND (SEQ (CAS S) FN) •8805 (BAPC '(LASBDA (FN2) (OB (ASSO FN2 LIST) (DELETE FN2 (CCDB S ) ) ) ) 880S (CDDR (ASSOC PH LIST))})) •807 (CDDB S)>) 8808 LIS T ) } 8809 8900 8901 (DEPUB GENLIBADDTO () 8902 (P80G ( F N ) 8903 (SETQ 8 (BEAD GES8UF) F (ASSC: H FNLIST)) 8900 (UHILE T (NCONC P (LIST (BEAD GENBUF 0 '(LAMBDA (X) (RETURN NIL)))))))) 8905 9000 9001 (DEFUN GESLIBDELFSOS () 9002 (PROG ( F N ) 9003 (SETQ N (READ) I (ASSOC N FNLIST)) 9000 (UHILE T (DELETE (READ GENBUF 0 '(LAMBDA X (BETURN NIL))) F ) ) ) ) 9005 9100 9101 . • • • • • l a i v . . . . . . . 9102 9103 (DErUS IDIV ( A S ) 9)00 (FIX (DIVIDE A B) ) ) 9105 9200 9201 .••...^^•••••••••••••••••••« 9202 9203 (DEFUN INFO {) 9200 (PROG (TIME MIN SEC) 9205 (SETQ T I E E (STATUS 39) NIN (IDIV TIME 60000) SEC (IDIV (BEMAIN TIME 60000) 1000)) 9206 (PBINTM3SG LISPOUT "ELAPSED TIME SINCE STA3T OF BUN »" (MIN) H I N D I ' S ( S E C ) SECONDS) 9207 (PalNTMSSG LISPOUT " C P U TIME =" ((ICIV (ADD (STATUS 38) 5 0 0 ) i'.lOO) ) "SECONDS.") 9208 (PBINTRSSG LISPOUT "CUBBENT FB2ESPAC5 ALLOCATION »•* ( (DIVIDE (STATUS 17) 0096)) "PAGES.") 9209 (PRIKTMSSG LISPOUT "CURRENT STACK ALLOCATION •« ((DIVIDE (STATUS IB) 0096)) "PAGES.") 9210 (MTS '"JD VESI7.E J " ) 9211 •* ")) 9212 9300 9301 •.•••••IRSM"»»« ................... 9102 9301 (DEFUN IBEn (A B) 9300 (FIX (REMAIN A 8) ) ) 9305 9900 9001 . . ....UjjDtKfO.............................. 9002 9903 (DEFUN LOADINFO FEXPB (FULL) V I .0 (RAPC • (LARBDA (LIP. ) l f l l •.1.5 (Cosu ((<::::' Lin '".•.•jam.') XV/J. ' I . .6 (IMC.T ' • • " ) . 1i:17 ( c u : . 1 ' L I U R A U 7 - ) 'I:. vrt ( P l l t .1 I U I I ) ( T E i l i ' d l ) •1010 (P;i:«i ' " F N S L O A D E D : " ) l u l l (n»."<: ' ( L A R B D A (X) ( P B I . 1 1 (CAR X ) ) ) (COR ( C E T L I D '".TOPCALLS.")) ) 9112 ( r ' M P H I ) 9 0 1 1 ( A N D F U L L 9 1 1 0 ( P R O G (L) 1 0 1 4 C R I S T ' S I I 1 I F S S : ) 90 16 ( S E T O L (COB ( C E T LIB • ". LOAD.".AP. " ) ) ) 1 0 17 (UHILE L 1 0 IB ( T A B 5) 9 0 19 ( P U I S 1 ( U N C O S S L L) ) 9 0 2 0 (TAB 0 0 ) •)021 " ( P U I K 1 ( U S C O S S L L)) 90^2 (TEBPBI))))))) 90/1 ILIURAaTLISTI) 9 0 2 0 • » « ) 9 0 2 5 1V.0 15- . I1 ; « . , , » N X . . . . . « « . » . . . . . . . . . . . . . . . . . . . . . 9,:>2 9 5 1 3 (OEFI IN HT P E X P B ( L ) 9 5 1 . 0 (OPEH ( i r . T B U F I 255)) 9 5 0 5 ( T A D 1 inTBIIFI) 95C6 ( P B I H 1 'S IRTBUFI 2) 9 5 0 7 (PHIN1 ( C A B L) IRTBUFI 2) « 5 0 8 (RAPC • (LARBOA ( E ) 9 5 0 9 (COSD ( ( A T O R E ) (P8IH1 " IRT3UFI 2) (PaiHI E IRTBUFI 2)) 9 5 1 0 (T ( P B I I i l • " ( " t . - . T U U F S 2) 9511 (P.1IS1 ( C A P E ) IRTBUFI 2) 9512 ( A N D ( C C S E) 9513 (RAPC • (LARBDA (E) (PBIB1 IBTBOFI 2) (PBIS1 E IRTBOFI 2)) (CDB E) ) ) 9 5 1 0 (PBIH1 •••)" IBTBOFI 2)))) 95 15 (CDR L)) 9 5 1 6 (HTS (CAB IRTBUFI)) ) 9 5 1 7 9..-.0 O 1n<\ . . . . . . . . . . . . 9602 .. 9 6 0 1 (DEFUN P P FEXPR (tLI) IbL'O (PBOG (IBUFI) 9(,r>5 [OPES (IBUFI 150)) 9606 (PPFOBH (COND ( ( L I S T P (CAR tLI)) (E?AL (CAR ILI))) 9607 ( ( G E T ( C A B ILI) (OR [CADR ILI) 'EXPR)))) 9608 IBUFI 9609 (COSD ((UNDEFP '7HAXLEH) 80) 9610 ( 7 H A X L E N ) ) 9611 T) 96 12 (TERPRI IBUFI) 16 13 ")) 9 S I 9 9700 9701 (DEFUN PPFORH (FORH BUFFER HA X WIDTH S ? ) 9702 (PBOG (» - ( " " ) " " . " "•" TESTbUFFER PPINTCP PBISTHACBO) 9703 (SETO a ' a »(» •"(» '•)" •») » ".« •».» "•« •-•") 9 7 0 9 (SETQ PRIBTBACBO • ( L A R B D A ( F B) • •'-~*»70S - (COSD •((»SD"(SQ.tEl'SGTH'F) »2) (SQ (CAS F) •QUOTE)) 9706 (PRIS1 "•" B 2 PPINTCP) 9707 (pals 1 (CADR F) B 6 P P I S T C P ) 9703 T) 9709 ( ( « S 0 (EO (LENGTH F) 0 ) (EQ (CAR F) * BREAKPOINT)) 9710 (AND il (PRIN 1 » B 2 PPINTCP) ) 9711 (PaiHI (CADR F) 8 6 PPINTCP) 9712 * T))> 9713 PPIHTCP •(LAR3DA X (RETURN S I L 'PPFIT))) 9710 (STATUS ( 0 QUOTE T) (0 BREAKPOINT T)) 1 9715 (APPLT1 •OPES (LIST 'TESTBGFFER RAXWIDTH)) 9716 (PPF0HR1 FORR) 9717 (STATOS (0 QUOTE NIL) (0 BREAKPOIST SIL)))) 9718 9800 9801 (DEFUS PPF0BR1 (FORR) 9802 (COND ((ATOR FORR) (PRIN1 FOSH BUFFER 6)) 9803 ((AND ( S E Q (CAR FORH) 'COND) (PPFIT FOBfl))) 9800 • ((PPSP2CIAL FOBR)) 9805 .((PUOG (CARFORR TAB) 9 8 0 6 (SETQ CARPORR (UNCOSS FORH FORR)) 9807 (PRIS1 " ( " BUFFER 2) 9808 (COHO ((ATOR CARFORR) 9809 (PRIS1 CARFORR 3UPFEB 6) 9810 (SKIP 1 BUFFER) 9811 (SETQ TAB (ADD 1 (PLEN BUFFER))) 9812 (PPFORH1 ( U N C O S S PORR F O R R ) ) ) 9813 (T (SETQ TAB (ADD 2 ( P L E N B U F F E R ) ) ) (PPF0RR1 CARFOaR))) 9819 (BAPC "(LARBDA (CAEF03R) (TEHPRI BUFFER) (TAB T A B BUFFEil) (!>PF0RR1 CARFORR) ) rORR) 9815 (AND (CDR (LAST F09R)) (paiNl "." BUFFER) (PRH 1 (CDB ( L A S T FOBR)) DUFFER 0 ) ) 9816 (PBIB1 " ) " BUFFER 2))))) 9817 9900 9901 (DEPOH PPFIT (FORR) 9902 (TAB 1 TESTBUPP ER) 9903 (COSD ((GKEATERP RAXWIOTH 9900 (ADD ( P L E N BUFFER) (PBOGN (P8IS1 PORR TESTBUFFER 6 PPISTCP) (PLEN TESTBUFFEk)))) 9905 (PRIB1 [CAR TSST3UPPE3) BUFFER 2) 9906 T))) 9907 10000 10001 (DEFOS PPSPECIAL (PORR) 10002 (COSD ((AND (ATOR (CAR FORR)) (NOT (SUHBEBP (CAR FORR)))) 10003 (APPLtl (GET (CAB FOBR) 'PPSPECIAL 1(RETURN NIL 'PPSPECIAL)) POKR) 10000 T))) 10005 v l 10100 10101 (DEFUN PPPBOC (FORR) 10102 ( P B I H 1 " ( " BUFFER 2) 10103 ( P R I S 1 ( U N C O S S FORR P O R R ) BOFFER 6) 10100 (SKIP 1 BUFFER) 10105 (PBOG (TAB VAKS) 10106 (SETQ TAB (ADD1 (PL-S BUFFER))) 10107 (COND ((PPFIT (CAR F O R R ) ) ) 10108 (T (SETQ V A N S (CAR FORR)) 10109 ( P H I S1 " ( " B U F F E R 2) 10110 ( P 8 I N 1 ( C A P V A R S ) B U F F E R 6) 10111 (RAPC ' [LARBDA (CARFORR) 10112 (SKIP 1 BUFFER) 10113 (COND ( (PPFIT CARPOBR)) 10110 101 15 10 1 16 10 1 17 101 18 101 19 10120 10121 IC 1 J.2 10 1 2J 10120 10200 10201 10202 10201 10200 10205 10206 10i07 102O8 10209 102 10 10211 10212 102 11 10210 10300 1C301 10302 10303 1030U 10000 10001 10002 10003 10000 1C500 10501 1C502 10600 10601 10602 10700 10701 10702 10800 10301 10802 10900 10901 10902 10903 10900 10905 10906 10907 10908 10909 10910 10911 11000 110*1 110'2-11003 iioco 110C5 11006 11007 11008 11009 11010 11011 11012 11100 11101 11102 11103 111 no 11105 11200 112 01 11202 I 1201 11200 11205 11206 11207 112.18 112C9 112 10 11211 11212 11213 11210 11215 11216 11)30 II H ) 11302 11103 l i no 11105 1 1000 1 1SC1 I It "2 11003 i isro 1 I0C5 11500 I 1501 11502 11503 1 15P0 11505 1 1506 11507 1 16.10 11601 1 1602 llo03 (T ( T E R P R I BUFFER) (TAB T A B BUFFEIl) ( P R I N I C A R P O R H BUFFER 0 ) ) ) ) (CDR VM1T,)) " 1 1 1 1 ( P R I H I " ) " B U F F E R 2)) ) ( B A P C ' ( L A B U D A (F0K.1) ( T : ; U I ' B I B U F F E R ) (TAU TAU M ' . ' F F U n ) (cn:iD ('(ATiin eu:ir.) ( S K I P - 2 B U F F E R ) I P R I N I FURII D U F F E R 6)) KPFFOHBI F O R I - . ) ) ) ) ( C D B F O R M ) ) ( P R I N I " ) " B - F F E R 2))) 102 (DETUN TPSETO (FORM) (PRI.11 " (" BU FF Ert 2) (PKIH1 (CAR FOHS) BUFFER t) (SKIP 1 BLTFEII) (PROS (TAB SH) i (SETQ TAU (ADD 1 (PLF.N BUFFER)) S* T FORM (CDR FOR.!)) • (REPEAT .« (PUOCN (OU 5W (TCFPBI UUFFE3) (TAT. TAD BUFFER)) (I'PFORC. 1 (CAR Fonn)) (SKIP 1 BUFFER) (PPFOSBI (CAES FOBfl)) (SETO FOP.N (CDDR FORR) SW 1!IL) ) (SHIFT (LENGTH FORN) -1))) (PRIN1 ")•• BUFFER 2)) (DEFQN PPQUOTE (FOB.-.) (COND ( (EC (LEHGTH FOn.1) 2) (PRIN1 ((RETURN NIL 'PPSPECIAL)))) BUFFER 2) (PPFORB1 (CADR FORN))) (DEFUN PPBREAKPOIST (FORN) (COND ((EU (LENGTH FOCM) 0) (AND S?(PRIN1 i BUFFER 2)) (PPFOHN1 (CADR F0R.1I 1 I ((RETURN NIL * PPSP ECIAL)))) 1 1 1 (DEFPHOP PSOG PPSPECIAL PPPBOG) (DEFPROP (SETQ SET) PPSPECIAL PPSETQ). (DEFPROP QUOTE PPSPECIAL PPOUOTE) (DEFPBOP BREAKPOINT PPSPECIAL PPBBEAKPOINT) (DEFUN PRINTL FEZPB IL» (TERPRI) (NAPC • (LABBDA (l)T») (COND ((EQ III •:) (TEBPBI) (TAB 5)) ( (AT0.1 III) (P3IN1 »X»)) ((BAPC • (LAK3DA (IXI) (PBIN 1 (EVAL »X») ) ) IXI) ) ) ) (ABG 1)) (TERPRI) ) • .-•••••PBIHTESSG******** **••••*•*•••• + (DEFUN rKINT.ISSG FEXPB (»LI) (PBOG (IBUFI) " (SETQ IBUFI (EVAL (CAB IL»))) (BAPC ' (LABBDA (ILI) (COND ((F.O ILI •:) (TEBPHI IBUFI) (TAB 5 IBUFI)) ((ATON. ILI) (PRIS1 ILI IBUFI)) (T (NAPC 1 (LABBDA (ILI) (PRIN1 (EVAL ILI) IBUFI)) ILI)))) (CDR ILI)) (TERPRI IBUFI))) {•••••SETELB.1**" *********••*•••••** •*••••** (DEFUN SETELEB (LIST H VALUE) (RPLACA (UTH LIST N) VALUE) ) (•••••SOBTFILE**•••*••*•••*••*••••*•***•••** (DEFUN SOBTFILE NEXPB (FILE) (PBOG (AT.1S AS-IS DEFPROPS FNS) (SETQ FNS (GET FILE •".FNS." '(DISKIN1 FILE))) (BAPC ' (LABBDA (E) (COND ( (ATOH E) (SETQ ATBS (CONS E ATES) )) ( (LTSTP (CDR E)) (SETQ AS-IS (CONS E AS-IS))) ((SETQ CEFPBOPS (CONS E DEFPROPS))))) FNS) (PUT FILE '".FNS." (NCONC (SORTLIST AT.1S 'QUOTE) (SORTLIST (SOBTLIST DETPBOPS 'CAB) "CDB) (SOBTLIST AS-IS 'CAB))))) {•••••SOBTLIST"*•••*••••*»•••••••*•••»•*•••* (DEFUN SORTLIST (ILSTI IFIINCTIONI) (PBUG (INEVI) (BAPC '(LABBDA (iEI) (SETO INEVI (S0BTLIST1 INEUI))) ILSTI) (BETUBN INBWI))) (DEFUN SORTLIST1 (ILI) (COHO ((NULL ILI) (LIST IEI)) {(SORTP (APPLY1 IFUKCTIONi IEI) (APPLY 1 IPUHCTIOBI (CAB ILI))) (CONS IEI ILI)) ((RPLACD ILI (SOBTLIST! (CDB ILI)))))) {•••••UNBBEAKF**••••••••••••••«••••«•»»••••« (DEFUN UNBREAKF FEXPB (L) (COHO (L (BAPC •(LASBDA (L) (PROG NIL (DEBUGUNBB L) IBESTABT)) L)) ((SETQ 7BBEAKSU NIL))) •DONE) ;««»««UNLOADFH»* •••••••< (DEFUN UNLOADFN FEXPB (L) l l l . f » (PBOG (ENTRY PHS) (nAPC '(LARDDA (PH) (PROG (P) (UNLOAOFUN FH))) I) (REH PBS 'EXPH 1) (HETU9M T) )) II, '> II' .0 m II/' 1 (DEFUII IIKlOAOFIIti (FN) J-U 1 1 / 2 (OH (*ER9 FN F) II 11 1 (RAPC •(LARBDA (Ltll) 117. a (COND ((SET'; ENTH Y (ASSO FN (CDS (GET LIB •". TOPCALLS."))) ) t 17OS (SCTO P (COM FS F)) 11/. b (COSD ((.lii'J (COS ENTRY) I) (HPLACD ENTRY (SI1R1 (COH ENTRY)))) 117.7 (T (DELO ENTHY (GET LIU •".TOPCALLS.")) IIMt (UNLOAD t* UNI FN LIB) 117.9 (AND (E'J FN -DEllUr.) (SETQ 7DEBUG NIL)))) 11710 (RETURN NIL 'RAPC)))) 11711 ILIBBARYLISTt))) 11713 nano 1M01 (DEFUN USL0ADFUN1 (FN LIB) , 11HC2 (PBOG (LOADHAP ENTRY) 11.1E1 (SETO LOA DR AP (CST Lib • ". I.OABHAP. ") ) I1HI1U (RAPC • (LARBDA (LINE) (COND ((NUHB2F.P LINE) (U HLOADFUNI LINE)) ( (USLOADFUN LINE)))) 11H0S (CDR (ASSQ FS (GET LIB '".INDEX.")))))) l i b - * 119,0 117.11 (DEFUS USLOADFUNI (LINE) 119.12 (AHD (SETQ ENTRY (ASSQ LISE LO A DR AP) ) ll>^3 (COSD ((SEO (CODH ENTRY) 1) (RPLACD (CDR ENTRY) (SUB1 (CODS ENTRY)))) l l ' i r o (T (DELQ ENTRY LOADRAP) (AND (CADR ESTSY) (SETQ FNS (COBS (CADR E3TRY) PNS))) ) ))) I DCS WO 120"1 .»««..UPDATE»»*»»-««»««-««--»»--»--»«««»»* 123C2 12003 (DEFUS OPDATE PEXPR (L) 120r-« (PBOG (FILE BUFFER "-PILE") 12005 (SETQ FILE (CAR L)) 120C6 (OR FILE (RETURN '"UPDATE UHAT?")) 12007 (OR (GET PILE ' " . F N S . " ) (RSTUBS •"HOTHISG TO WRITE.")) 1200B (SETQ "-FILE" (RKATOR •"-" PILE)) 12GG9 (APPLY 1 'OPEN (LIST 'BUFFER 150 "-PILE")) 12010 (COSD ((DISKEMRSET (RAPC 'DISKOUTL L) )) 12311 (T (KTS (RKATOR '"JOES " "-FILE")) (BETUBS 'FAIL))) 120 12 (DI5K0UTDAT£ UOFFEU) 120 1.1 (RT5 (RKATOR '"SOES =" FILE '" OK")) 120 1» (RTS (RKATOR '"SRES » FILE •" «•' PILE •" OK")) - . ' ISO IS (RTS (RKATOR •"5REN " "-FILE" "• » FILE)) 12016 (KTS (RKATOR, .'"ITRUS " FILE)) 12017 (RTS (RKATOR 1"JPERRIT " FILE •» LIKE »« FILE)) 12018 (RKATOR '"PILE: » PILE "• UPDATED."))) 120 19 12100 12101 ••••••XBEF*****"*****»******»******»**** 12102 12103 (DEFUN XREF FEXPR (L) 121C9 (PBOG (INFO FUN PILE BUF FOUND USEDLIST LIBRARY) 12105 (SETQ PUS (USCONS L L) FILE (COSD (L (USCOSS L L)) ('»SISK»))| 12106 (AND (USD2FP 'XREFSUBRS) (SETQ XREFSUBRS NIL)) 12)07 (AHD (UNDEFP ' XII EPEXPilS) (SETO XREFEXPRS T)) 12108 (AND (UNDEFP ' XREFLID) (SETQ XREFLIB NIL)) 12109 ' (AHO (UNDEFP 'XREFSOT) (SETQ XREPSOT BID) 12110 (ASU (ATOR PUS) (SETQ FUS (LIST FUN))) 12111 (SETQ LIBRARY (XREFLIB)) 12112 (RAPC 'XREFFH FUS) 12113 (SETQ INFO (XREFSORT ISFO) ) 12119 (APPLY 1 •OPES (LIST 'BUP 120 FILE)) 12115 (PRIN1 '"1 CROSS REFERENCE FOR: " BUP 2) 12115 (RAPC '(LARBDA (FOB) (P8IM1 PUS BUP)) FUS) 12117 (TERPRI BUF) 12118 (PRIS 1 '" " BUP) 12119 (STATUS (10 BUF T) ) 12120 (P3IN1 (STATUS 91) BUF) 12121 (PBIH1 (STATUS 92) BUF) 12122 (TEKPBI BUF) 12123 (PBIST •" " BOT) 12129 (RAPC * (LARBDA (FOB) (SETQ OSEDLIST BIL) (XREFPRINTF FUH (ADD 2 (PLES FOB))) (PBIST •" " BUF)) 12125 FUN) 12126 (SKIP 90 BUP '») 12127 (TEBPRI BUF) 12128 (RAPC '(LARBDA (L) (PBIST •" " BOP) (XRSFPBINTT L)) INPO) 12129 (BETURS '" ")) ) 12130 122O0 122C1 (DEfON IBErPBINTT (E8TRI) 12202 (PBOG SIL 12203 (PBIS1 (CAS EXT8I) BUP) 12209 (COSD ((NULL (CADR ENTRY)) 12205 (PRIS1 ••••SKDEPtliZD*** BOP) 12206 (TERPBI BUF) 12207 (XBEFPRLIST '"CALLED BY:" (XREFCALLEOBY (CAB ENTRY))) 12208 (BETURS SIL))) 12209 (PBIS 1 (CADDS ENTRY) BUP) 12210 (SKIP 5 BUF) 12211 (PRIII1 (CDR (ASSQ (CADR ENTRY) ' ( (LARBDA . EXPR) (FLAR8DA . PSXPil) (SLARQDA . BEXPB))) ) EOF) 122 12 (TERPBI CUF) 12213 (XB EFCORR ENTS (CAR ENTRY)) 12219 (XBEFPRLIST 'CALLS: (ELER ENTRY 9)) 12215 (AND XREFSUBRS (XREFPHLIST '"CALLS SUBRS:" (ELER BSTRY 5))) 12216 (XBEFPRLIST '"CALLED BY:" (XREFCALLEDBY (CAR ENTRY))) 12217 (XREPPRLIST "LOCAL: (ELER ESTRY 6)) 12218 (XREPPaLIST 'GLOBAL: (ELER ENTRY 7)))) 12219 12300 12301 (DEFUN ISEPCORRESTS (FOB) 12302 (RAPC "(LARBDA (C) (TAB 10 DUF) (P8IH1 C BUF) (TESPRI BOP) ) 12303 (GET FUS "".CORRESTS." •(ONEVAL 'XREFCOHRSSTS NIL))) 12309 (PBIST •" " BUF)) 12305 . 12900 12401 (DEFUS XREFCALLEDBY (PON) 12402 (PROG (LST) 12903 (RAPC * (LARBDA (E) (AND (RERQ PUS (ELER E 4)) (SETQ LST (COSS (CAR E) LST)))) INFO) 12409 (BETUBS LST))) 12905 12500 12501 (DEFUS XR5FPBLIST (HARE LST) 12502 (TAB 5 BUF) 12503 (PB IS 1 BARE BUF) 12509 (COSD (LST (TAB 20 BUF) (RAPC '(LARBDA (L) (PBIS1 L BUP)) LST))) 12S0S (TEKPBX BUP)) 12506 12600 12601 (DEFUS XBEFPBIHTP (P IS) 1 2 t ~ 2 i 2 - . n » 1 i.''.'»S l.'iji 1 2 * . - 9 12 KiO 1 2 / . I 1 1 2 7 H 2 1 2 / ' U 1270-3 . I 2 . - U O 1 2 U C 1 1 2 « r 2 12Hf.M 129'SO 12'> >1 12'>i:2 1 2 0 0 3 124:>a 12->r,s 110 . 0 i . i r . n 1 1 0 0 2 nor-i 1 3 0 C 4 1 1 0 1 5 1 1 0 ; ! « 1 1 0 O 7 I 1 0 C J l l o i ' 9 1 1 3 1 0 1 3 1 C 1 1 1 1 0 2 1 3 1 3 3 1 3 1 R 4 I H O S 1 3 1 0 6 1 3 1 0 7 1 3 1 0 3 l l i a i 1 3 1 to 1 3 1 1 1 1 1 1 1 2 1 3 2 0 0 1 3 2 f.l 1 3 2 3 2 1 1 2 3 3 132.-UI 1 3 2 6 5 1 3 Z C 6 1 3 2 0 7 1 1 2 C 8 1 3 2 0 9 1 3 2 1 0 1 1 2 1 1 1 3 2 1 2 1 3 2 1 3 1 3 2 54 1 3 2 1 5 1 3 2 2 6 1 3 2 1 7 1 3 2 1 8 1 3 2 1 9 1 3 2 2 0 1 3 2 2 1 1 3 2 2 2 1 3 2 2 3 1 3 2 2 3 1 3 2 2 5 1 3 2 2 4 1 3 2 2 7 1 3 3 C 0 1 3 3 0 1 1 3 3 0 2 1 3 3 0 3 1 3 3 3 4 1 3 J O S 1 3 3 C 6 1 3 4 O 0 1 3 4 0 1 1 3 4 0 2 I30O3 1 3 4 C 9 1 3 4 0 5 1 3 4 G S 1 3 4 0 7 134C-3 1 3 5 C 3 1 3 5 3 1 1 3 5 0 2 1 3 5 C 3 1 3 5 C 4 1 3 S C 5 1 3 S O * 1 3 6 O 0 1 3 6 P 1 1 3 6 C 2 1 3 6 9 3 1 3 6 C * 136CJ5 1 3 6 G * 1 3 6 0 7 1 3 6 C 6 1 3 6 a ? 1 3 6 1 0 1 1 T C 0 1 3 7 C 1 1 1 7 0 2 1 3 7 0 3 1 3 8 0 0 1 3 B 0 1 1 3 8 0 2 1 3 B 0 J 1 ) 9 0 0 1 3 9 0 1 1 3 9 0 2 104 (PROG (FLIST I N D E N T ) (PP IN 1 F Uill' fi) (OH J S K T O rtis - T ic*a (NTH ( A S S O r I N F O ) » ) ) > ( S E T U P S MIL) ) ( A H U F n : ; i ' O i . i : ; T ) (n::TiJus H I L J J ( I H L ' F A S M . H S E U L T S F r| (SETQ ItlUF.Nr (ADD 1 ( A P P L Y ' T A X ( H A P C A H U ' L t l N P L I S T ) ) IH) ) (HAPC ' (LA.HIIIA ( F S ) (FA II ES OliF) (X U UFl'H 1.1XF F N . I N D E N T ) ( T E K P K I B U F ) ) FLIST))) (DEFUN XREFADDL N E X P R ( L S T WHAT) (SETO WHAT ( E V A L U H A T ) ) (REntf WHAT (EVAL LST) ' ( S E T L S T (COWS WHAT ( E V A L L S T ) ) ) ) ) (OEFUS XRE7S0BT ( I N F O ) (PBOG (NEW) (HAPC '(LARUDA ( E ) ISETQ NEW (XREPS0RT1 S E W ) ) ) INFO) (HETUBH N E W ) ) ) (DEFUN XBEFSOBT1 (L) (COSD ( ( N U L L L) ( L I S T E) ) ( ( S O R T P ( C A H E) ( C A A R L ) ) ( C O S S EL)) ((RPLACD L ( J H E P S 0 I I T 1 ( C D B L ) ) ) ) ) ) (DEFUN XREFFN ( F U N ) (PBOG ( E X I ' R S S U B R S LOCALS G L O D A L S VARS CVAHS 3 0 D I T Y P E ) (ANU (RF.RQ FUS F O U N D ) (PETU.TN N I L ) ) ( S E T Q BODY (GET F u n ' E X P R ) T 1 P E (CAR CODY) VARS (SETQ CVAHS (CADB BODY)) BODY (CDDS BODY)) (SETQ F O U N D ( C O N S FUS F O U N D ) ) (AND ( A T O R V A H S ) ( S E T Q C V A B S (LIST CVAHS))) (HAPC • (LARBDA (L) (XR FFFOBH L NIL) ) BODY) (XHEFADOFN FUN TYPE) (BETURN T ) ) ) (DEFUN ISEFADDFN (FUN TYPE) (08 ( A S S Q FUN INFO) (SETQ INFO (COND ((NULL TYPE) (CONS (LIST FUN TYPE) ISFO)) ((CONS (LIST FUN TYPE VABS (REVEBSE EXPBS) (8EVEBSE SUBRS) (BEVEBSE LOCALS) (BEVEBSE GLOBALS) ) INFO)))))) (DEFUN IBEPF0BI1 (F PROGSW) (PSOO (FN) (COND ( (ATOR F) (OB PROGSW (XBEFVAB F)) (RETUBN NIL)) ( ( A T 0 . 1 (SETO FN (CAR F)) ) (OB (XREFNEWPS FN) (RETURN NIL))) ((XBEFFoan Fd NIL))) (SELECTQ FN (COND (HAPC •(LARBDA (L) (NAPC ' (LARBDA (tl) (XBEPFOBH R NIL) ) L) ) (RETURN NIL) ) ((SELECT SELECTC) (XBEFSELECT F) (BETUBN N I L ) ) (PBOG (XREFADOL CVA3S (CADB F)) ' (RAPC • (LAKBL1 (L) (XBEFFOBK L T)) (CCDB F) ) (DNCOSS CVAR5 CVABS) (RETURN N I L ) ) (REPEAT(XBEVQUOTE (CADR ""F))) (OPES ( R A P C • ( L A R 3 C A ( L ) (XBEFVAR (CAB L)) ) (CDB F)) (BETURN NIL)) ((RAPC HAP RAPCAB BAPCON RAPCAN RAPLIST APPLY APPLY 1) (XitEFQUOTE (CADB F) )) ((GET GETL A S S Q A S S O C RERQ R E R B E R ) ( A N D (EQ (LENGTH F) 4 ) (XREFQFOBR (CAR ( L A S T F))))) (UNEVAL (AND ( E Q (LENGTH P) 3) (XBEFQPORH (CAR (LAST F ) ) ) ) ) ((LARBDA NLAR3DA FLARBDA) (XREFADDL CVARS (CADB F) ) (HAPC • (LAR3DA (L ) (XBEFFOBR L NIL) ) (CCCR F)) (USCONS CVABS CVABS) (BETURN NIL) ) N I L ) (3APC '(LARDDA (I) (XREFFORH L NIL)) (CCB F)) (RETURN T))) (CDR F)) (DEFUN XBEFQFORR (F) (AND (LISTP t) (EQ (CAH F) 'QUOTE) (COND ( (ATOR (CADR F)) (XBEFVAB (CADR F)) ) ((XBEFFORB (CADR F) NIL))))) (DITUN XBEFVAB (V) (COND [(BEHQ V '(T NIL))) ((RERQ V LOCALS)) ((BUEBERP V)) ((FIND V CVABS) (XBEFADDL LOCALS V)) ((RERQ V GLOBALS)) ((XBEFADDL GLOBALS V ) ) ) ) (DEFUN XBEFOUOTE (F) (AND (LISTP F) (EQ (CAB F) 'OUOTE) (COND ((ATOR (CADR F) ) (XBEFNEVFN (CADR F)) ) ((XREFFOBR (CADB F) NIL))))) (DEFUN XBEFNEWFN (FUN) . ... . . . .... (PBOG (PLIST) (SETQ PLIST (GETL FUN '(EXPR SOBR PSUBR NSUBB))) (COND ((NULL PLIST) (XBEFAODFH FUN NIL) (XBEFADDL EXPBS FUN) (BETUBH T)) ( ( E Q (CAR PLIST) * E X P S ) (XBEFADDL EXPBS FUN) (AND (XREFEXPR7 F U N ) (XBEFFS FUN)) (BETURN (XR EFEXPROF ? F U N ) ) ) (T (AND (XBEFSUBR? F U N ) (XREFADDL SUBBS FUN)) (RETURN (XREFSUBHOK? FUN)))))) (DEFUN XBErSUBROS? (FUN) (SOT (RERQ FUN '(QUOTE STATUS GO)))) # ' (DEFUN 13 EP5UBH ? ( F U N ) (AND IBEFSUBBS (HOT (RERQ FUN XSEPHOT)) (OR (ATL-.1 XREFSUBRS) (RERQ FUN XREF5U0R5) ) ) ) (DEFUN IREFEXPROK? (FUN) (EQ (CAAD3 PLIST) 'LARDDA)) 105 i n n I V :0 I > 11 1-. -2 I. .5 !-.:.-» I-J.-S IU1 -0 10 131 le 102 l<i > J3 leino U U i S -u m 1"-1C8 , l*i 1 '.-9 K2H0 UJOt 19202 19211 lwli.0 W l ' l It 1*2 19 193 l-ira II 105 Hl4>6 1*117 19153 10400 14401 (DEFU.I XREFlIXPIl? ( F U S ) I I L A " M D J (L::T) (f,:.n i.;;r (::•»• (ii-.:< F U S X R E F S O T ) ) (oa (co-D ((»!:.D tun L i iK iAar ) X:iiruia) (XKEFEXI'P.S)))) (ATU.-. L G T ) (K E " 0 F U S L I T ) ) ) ) ( D E F U S X R E F K E L E C T ( F ) ( P 8 U G (07) ( X R K F F O H H ( C » 0 R F) S T L ) ( S E T O 0 ? ( E O ( C A R F ) ' S E L E C T © ) F ( C C D R F ) ) ( S E P E A T '(Panes ( S A T C • (LA.-.iiDA (L) (XREFFOBS L SIL)) ( C 0 S 3 (0? ( C O I S E ) l ( ( C A B F ) ) l ) (OSCOSf F F ) ) (soul ( IB : ;GT : I n i l IxaErrona (CAB F ) S I L ) ) ) ' " (BArc Is ^ M L S f l B D A ( L I B ) ( C O P Y ( C D S ( G E T L I B - . T O P C A L L S . " • ( H E T B 3 S S I L - C O P T ) ) ) ) ) I L I B B A R T L I S T * ) ) ; » « * » » X R £ P F I L E » « • • • • • • » • • • • • ( D E F U S XB-5FF ILE F E X P B ( I L T ) ( P R O G ( I F S S I ) ( R A P C ' ( L A . 1 2 D A ( I X I ) ( A I D ( A T O K T X I ) ( S E T Q C F S S I ( C O N S I X I I E S S I ) ) ) ) ( G E T ( C A R I L I ) ' " . F S S . " ' ( D I S K I K 1 (CAB I L « ) ) ) ) ( B E T U B S ( A P P L Y ' X R E F ( B C O S C ( L I S T I F H S I ) (CDA I L I ) ) ) ) ) ) ; APa .15, 1979 11:43:55 Index , 106 i 7AUTOLOAD 20 7BREAKSW . . 44 ?BRQKEN ................. 45 7DEBUG 43 ?DISKMAXLEN 36 7MAXLEN 37 #LIBB ARYLIST# .. . . . ...19,20 ".BUFFER." 18 ».INDEX." 18 ".LOADMAP." ..............19 TOPCALLS.V 19 Autoloader ...............................................20 Breakpoints - See Debug Package .......................... 43 Cross Referencing ..................................... 62,63 DEBUG PACKAGE ................41 Breakpoints ..43,48,50,58 Commands ... 53 DEBUG F unc t i on 50 Examples ..................................... ....... .50, 60 Handling Of L i s p E r r o r s ..............42 HELP Command ....54 Pseudo-Breakpoints ..................................... 46 Stackpointer ..................................47,55,57,58 Edi t o r ...............................71 Function A n a l y s i s 62 FILE I/O ........................... 30 Comments 32 DISKIN 33 DISKOUT . . .34 FNS L i s t 22,31, 67, 75 P r e t t y p r i n t e r ...............36 UPDATE 35 FNS L i s t .........................31 FUNCTIONS 12 *PUTOB ................................................. 69 •REMOB 70 BR'EAKF 48 CAS E , 70 CONSES 7 1 DEBU G 50 DISKIN 33 DISKOUT ...........................34 DREVERSE 71 EDITE 71 EDITF 72 ELEM 72 EXTRACTFN 22 FNMAP .................................................. 62 FNSIZE 6.3 Index 107 GENLIB 23 INFO 72 LOADFN 21 LOADINFO 23 MT ..........73 PP 36 PRINTL ...............................73 PRINTMSSG 74 SETELEM 74 SORT FIL E 75 SORTLIST 76 UNBREAKF ...............................................50 UNLOAEFN 28 UPDATE .35 XREF 64 XREFFILE 67 Lisp/MTS . 8 1 LI BR ARY . . . 1 4 EXTRACTFN ............22 Generating A L i b r a r y ............... 23 GENLIB Commands ........................................24 How To Run ...............................14 Index Format ............16 LOADER 18 E x p l i c i t Loading .......................21 Loader Information ..............................23 LOADFN 21 Unloading ..............................................28 Notation .................................................12 P r e t t y p r i n t e r ......................36 XR EFEXPRS , , . . 65 XREF LIB . . 65 XREFNOT ,65 XREFSUBRS 66 

Cite

Citation Scheme:

        

Citations by CSL (citeproc-js)

Usage Statistics

Share

Embed

Customize your widget with the following options, then copy and paste the code below into the HTML of your page to embed this item in your website.
                        
                            <div id="ubcOpenCollectionsWidgetDisplay">
                            <script id="ubcOpenCollectionsWidget"
                            src="{[{embed.src}]}"
                            data-item="{[{embed.item}]}"
                            data-collection="{[{embed.collection}]}"
                            data-metadata="{[{embed.showMetadata}]}"
                            data-width="{[{embed.width}]}"
                            async >
                            </script>
                            </div>
                        
                    
IIIF logo Our image viewer uses the IIIF 2.0 standard. To load this item in other compatible viewers, use this url:
http://iiif.library.ubc.ca/presentation/dsp.831.1-0051758/manifest

Comment

Related Items