home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume1 / xlisp1.4 / part4 < prev    next >
SHell self-extracting ARchive  |  1986-11-30  |  46.2 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: SHell self-extracting ARchive (archive/shar).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert Newsgroup Content (archive/news) magic Supported
100% dexvert SHell self-extracting ARchive (archive/shar) magic Supported
100% dexvert Internet Message Format (text/imf) magic Supported
1% dexvert Texas Instruments Calculator Program (executable/tiCalcProgram) magic Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file news or mail text default
99% file makefile script text default
98% file Lisp/Scheme program text default
97% file Lisp/Scheme program, ASCII text default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/329 Shell Archive Format default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 44 61 74 65 3a 20 57 65 | 64 2c 20 31 33 20 4d 61 |Date: We|d, 13 Ma|
|00000010| 72 20 38 35 20 31 36 3a | 35 38 3a 34 31 20 70 73 |r 85 16:|58:41 ps|
|00000020| 74 0a 46 72 6f 6d 3a 20 | 64 65 63 76 61 78 21 75 |t.From: |decvax!u|
|00000030| 63 62 76 61 78 21 55 43 | 42 4a 41 44 45 21 75 63 |cbvax!UC|BJADE!uc|
|00000040| 62 6a 61 64 65 3a 6d 77 | 6d 20 28 4d 69 6b 65 20 |bjade:mw|m (Mike |
|00000050| 4d 65 79 65 72 29 0a 53 | 75 62 6a 65 63 74 3a 20 |Meyer).S|ubject: |
|00000060| 58 4c 49 53 50 20 31 2e | 34 20 70 61 72 74 20 34 |XLISP 1.|4 part 4|
|00000070| 20 28 6f 66 20 34 29 0a | 0a 0a 23 21 20 2f 62 69 | (of 4).|..#! /bi|
|00000080| 6e 2f 73 68 0a 23 20 54 | 68 69 73 20 69 73 20 61 |n/sh.# T|his is a|
|00000090| 20 73 68 65 6c 6c 20 61 | 72 63 68 69 76 65 2c 20 | shell a|rchive, |
|000000a0| 6d 65 61 6e 69 6e 67 3a | 0a 23 20 31 2e 20 52 65 |meaning:|.# 1. Re|
|000000b0| 6d 6f 76 65 20 65 76 65 | 72 79 74 68 69 6e 67 20 |move eve|rything |
|000000c0| 61 62 6f 76 65 20 74 68 | 65 20 23 21 20 2f 62 69 |above th|e #! /bi|
|000000d0| 6e 2f 73 68 20 6c 69 6e | 65 2e 0a 23 20 32 2e 20 |n/sh lin|e..# 2. |
|000000e0| 53 61 76 65 20 74 68 65 | 20 72 65 73 75 6c 74 69 |Save the| resulti|
|000000f0| 6e 67 20 74 65 78 74 20 | 69 6e 20 61 20 66 69 6c |ng text |in a fil|
|00000100| 65 2e 0a 23 20 33 2e 20 | 45 78 65 63 75 74 65 20 |e..# 3. |Execute |
|00000110| 74 68 65 20 66 69 6c 65 | 20 77 69 74 68 20 2f 62 |the file| with /b|
|00000120| 69 6e 2f 73 68 20 28 6e | 6f 74 20 63 73 68 29 20 |in/sh (n|ot csh) |
|00000130| 74 6f 20 63 72 65 61 74 | 65 20 74 68 65 20 66 69 |to creat|e the fi|
|00000140| 6c 65 73 3a 0a 23 09 4d | 61 6b 65 66 69 6c 65 0a |les:.#.M|akefile.|
|00000150| 23 09 66 61 63 74 2e 6c | 73 70 0a 23 09 69 6e 69 |#.fact.l|sp.#.ini|
|00000160| 74 2e 6c 73 70 0a 23 09 | 6f 62 6a 65 63 74 2e 6c |t.lsp.#.|object.l|
|00000170| 73 70 0a 23 09 70 72 6f | 6c 6f 67 2e 6c 73 70 0a |sp.#.pro|log.lsp.|
|00000180| 23 09 74 72 61 63 65 2e | 6c 73 70 0a 23 09 78 6c |#.trace.|lsp.#.xl|
|00000190| 62 69 6e 64 2e 63 0a 23 | 09 78 6c 64 62 75 67 2e |bind.c.#|.xldbug.|
|000001a0| 63 0a 23 09 78 6c 69 73 | 70 2e 68 0a 23 09 78 6c |c.#.xlis|p.h.#.xl|
|000001b0| 73 65 74 66 2e 63 0a 23 | 09 78 6c 73 74 72 2e 63 |setf.c.#|.xlstr.c|
|000001c0| 0a 23 09 78 6c 73 74 75 | 62 2e 63 2e 58 58 58 0a |.#.xlstu|b.c.XXX.|
|000001d0| 23 09 78 6c 73 75 62 72 | 2e 63 0a 23 09 78 6c 73 |#.xlsubr|.c.#.xls|
|000001e0| 79 6d 2e 63 0a 23 09 78 | 6c 73 79 73 2e 63 0a 23 |ym.c.#.x|lsys.c.#|
|000001f0| 20 54 68 69 73 20 61 72 | 63 68 69 76 65 20 63 72 | This ar|chive cr|
|00000200| 65 61 74 65 64 3a 20 4d | 6f 6e 20 44 65 63 20 20 |eated: M|on Dec |
|00000210| 32 20 31 30 3a 30 31 3a | 31 32 20 31 39 38 35 0a |2 10:01:|12 1985.|
|00000220| 65 78 70 6f 72 74 20 50 | 41 54 48 3b 20 50 41 54 |export P|ATH; PAT|
|00000230| 48 3d 2f 62 69 6e 3a 24 | 50 41 54 48 0a 65 63 68 |H=/bin:$|PATH.ech|
|00000240| 6f 20 73 68 61 72 3a 20 | 65 78 74 72 61 63 74 69 |o shar: |extracti|
|00000250| 6e 67 20 22 27 4d 61 6b | 65 66 69 6c 65 27 22 20 |ng "'Mak|efile'" |
|00000260| 27 28 39 32 31 20 63 68 | 61 72 61 63 74 65 72 73 |'(921 ch|aracters|
|00000270| 29 27 0a 69 66 20 74 65 | 73 74 20 2d 66 20 27 4d |)'.if te|st -f 'M|
|00000280| 61 6b 65 66 69 6c 65 27 | 0a 74 68 65 6e 0a 09 65 |akefile'|.then..e|
|00000290| 63 68 6f 20 73 68 61 72 | 3a 20 77 69 6c 6c 20 6e |cho shar|: will n|
|000002a0| 6f 74 20 6f 76 65 72 2d | 77 72 69 74 65 20 65 78 |ot over-|write ex|
|000002b0| 69 73 74 69 6e 67 20 66 | 69 6c 65 20 22 27 4d 61 |isting f|ile "'Ma|
|000002c0| 6b 65 66 69 6c 65 27 22 | 0a 65 6c 73 65 0a 73 65 |kefile'"|.else.se|
|000002d0| 64 20 27 73 2f 5e 58 2f | 2f 27 20 3c 3c 20 5c 53 |d 's/^X/|/' << \S|
|000002e0| 48 41 52 5f 45 4f 46 20 | 3e 20 27 4d 61 6b 65 66 |HAR_EOF |> 'Makef|
|000002f0| 69 6c 65 27 0a 58 53 52 | 43 31 3d 09 78 6c 6f 62 |ile'.XSR|C1=.xlob|
|00000300| 6a 2e 63 20 78 6c 6c 69 | 73 74 2e 63 20 78 6c 63 |j.c xlli|st.c xlc|
|00000310| 6f 6e 74 2e 63 20 78 6c | 62 66 75 6e 2e 63 0a 58 |ont.c xl|bfun.c.X|
|00000320| 53 52 43 32 3d 09 78 6c | 64 6d 65 6d 2e 63 20 78 |SRC2=.xl|dmem.c x|
|00000330| 6c 65 76 61 6c 2e 63 20 | 78 6c 66 69 6f 2e 63 20 |leval.c |xlfio.c |
|00000340| 78 6c 66 74 61 62 2e 63 | 20 78 6c 67 6c 6f 62 2e |xlftab.c| xlglob.|
|00000350| 63 20 78 6c 69 6f 2e 63 | 20 78 6c 69 73 70 2e 63 |c xlio.c| xlisp.c|
|00000360| 20 78 6c 6a 75 6d 70 2e | 63 20 5c 0a 09 78 6c 6d | xljump.|c \..xlm|
|00000370| 61 74 68 2e 63 20 78 6c | 70 72 69 6e 2e 63 20 78 |ath.c xl|prin.c x|
|00000380| 6c 72 65 61 64 2e 63 20 | 78 6c 69 6e 69 74 2e 63 |lread.c |xlinit.c|
|00000390| 0a 58 53 52 43 33 3d 09 | 78 6c 73 65 74 66 2e 63 |.XSRC3=.|xlsetf.c|
|000003a0| 20 78 6c 73 74 72 2e 63 | 20 78 6c 73 75 62 72 2e | xlstr.c| xlsubr.|
|000003b0| 63 20 78 6c 73 79 6d 2e | 63 20 78 6c 73 79 73 2e |c xlsym.|c xlsys.|
|000003c0| 63 20 78 6c 62 69 6e 64 | 2e 63 20 78 6c 64 62 75 |c xlbind|.c xldbu|
|000003d0| 67 2e 63 0a 58 53 52 43 | 53 3d 09 24 28 53 52 43 |g.c.XSRC|S=.$(SRC|
|000003e0| 31 29 20 24 28 53 52 43 | 32 29 20 24 28 53 52 43 |1) $(SRC|2) $(SRC|
|000003f0| 33 29 20 78 6c 69 73 70 | 2e 68 0a 0a 4f 42 4a 53 |3) xlisp|.h..OBJS|
|00000400| 3d 09 78 6c 62 66 75 6e | 2e 6f 20 78 6c 62 69 6e |=.xlbfun|.o xlbin|
|00000410| 64 2e 6f 20 78 6c 63 6f | 6e 74 2e 6f 20 78 6c 64 |d.o xlco|nt.o xld|
|00000420| 62 75 67 2e 6f 20 78 6c | 64 6d 65 6d 2e 6f 20 78 |bug.o xl|dmem.o x|
|00000430| 6c 65 76 61 6c 2e 6f 20 | 78 6c 66 69 6f 2e 6f 20 |leval.o |xlfio.o |
|00000440| 5c 0a 09 78 6c 66 74 61 | 62 2e 6f 20 78 6c 67 6c |\..xlfta|b.o xlgl|
|00000450| 6f 62 2e 6f 20 78 6c 69 | 6e 69 74 2e 6f 20 78 6c |ob.o xli|nit.o xl|
|00000460| 69 6f 2e 6f 20 78 6c 69 | 73 70 2e 6f 20 78 6c 6a |io.o xli|sp.o xlj|
|00000470| 75 6d 70 2e 6f 20 78 6c | 6c 69 73 74 2e 6f 20 78 |ump.o xl|list.o x|
|00000480| 6c 6d 61 74 68 2e 6f 20 | 5c 0a 09 78 6c 6f 62 6a |lmath.o |\..xlobj|
|00000490| 2e 6f 20 78 6c 70 72 69 | 6e 2e 6f 20 78 6c 72 65 |.o xlpri|n.o xlre|
|000004a0| 61 64 2e 6f 20 78 6c 73 | 65 74 66 2e 6f 20 78 6c |ad.o xls|etf.o xl|
|000004b0| 73 74 72 2e 6f 20 78 6c | 73 75 62 72 2e 6f 20 78 |str.o xl|subr.o x|
|000004c0| 6c 73 79 6d 2e 6f 20 78 | 6c 73 79 73 2e 6f 20 0a |lsym.o x|lsys.o .|
|000004d0| 4d 49 53 43 3d 09 4d 61 | 6b 65 66 69 6c 65 20 66 |MISC=.Ma|kefile f|
|000004e0| 61 63 74 2e 6c 73 70 20 | 69 6e 69 74 2e 6c 73 70 |act.lsp |init.lsp|
|000004f0| 20 6f 62 6a 65 63 74 2e | 6c 73 70 20 70 72 6f 6c | object.|lsp prol|
|00000500| 6f 67 2e 6c 73 70 20 74 | 72 61 63 65 2e 6c 73 70 |og.lsp t|race.lsp|
|00000510| 20 5c 0a 09 78 6c 73 74 | 75 62 2e 63 2e 4e 4f 54 | \..xlst|ub.c.NOT|
|00000520| 55 53 45 44 20 0a 0a 43 | 46 4c 41 47 53 3d 09 2d |USED ..C|FLAGS=.-|
|00000530| 4f 0a 0a 78 6c 69 73 70 | 3a 20 24 28 4f 42 4a 53 |O..xlisp|: $(OBJS|
|00000540| 29 0a 09 63 63 20 2d 6f | 20 78 6c 69 73 70 20 24 |)..cc -o| xlisp $|
|00000550| 28 43 46 4c 41 47 53 29 | 20 24 28 4f 42 4a 53 29 |(CFLAGS)| $(OBJS)|
|00000560| 0a 0a 24 28 4f 42 4a 53 | 29 3a 20 78 6c 69 73 70 |..$(OBJS|): xlisp|
|00000570| 2e 68 0a 0a 72 63 73 3a | 20 24 28 53 52 43 53 29 |.h..rcs:| $(SRCS)|
|00000580| 0a 09 72 63 73 20 2d 6c | 20 24 3f 0a 09 74 6f 75 |..rcs -l| $?..tou|
|00000590| 63 68 20 72 63 73 0a 0a | 6c 69 6e 74 3a 0a 09 6c |ch rcs..|lint:..l|
|000005a0| 69 6e 74 20 2d 61 63 68 | 20 24 28 53 52 43 53 29 |int -ach| $(SRCS)|
|000005b0| 0a 0a 6e 65 77 3a 20 63 | 6c 65 61 6e 0a 09 72 6d |..new: c|lean..rm|
|000005c0| 20 2d 66 20 78 6c 69 73 | 70 0a 09 6d 61 6b 65 20 | -f xlis|p..make |
|000005d0| 78 6c 69 73 70 0a 0a 63 | 6c 65 61 6e 3a 0a 09 72 |xlisp..c|lean:..r|
|000005e0| 6d 20 2d 66 20 2a 2e 6f | 0a 0a 73 68 61 72 3a 20 |m -f *.o|..shar: |
|000005f0| 24 28 53 52 43 53 29 20 | 24 28 4d 49 53 43 29 0a |$(SRCS) |$(MISC).|
|00000600| 09 73 68 61 72 20 2d 63 | 20 2d 76 20 78 6c 69 73 |.shar -c| -v xlis|
|00000610| 70 2e 64 6f 63 20 3e 20 | 78 6c 69 73 70 31 2e 73 |p.doc > |xlisp1.s|
|00000620| 68 61 72 0a 09 73 68 61 | 72 20 2d 63 20 2d 76 20 |har..sha|r -c -v |
|00000630| 24 28 53 52 43 31 29 20 | 3e 20 78 6c 69 73 70 32 |$(SRC1) |> xlisp2|
|00000640| 2e 73 68 61 72 0a 09 73 | 68 61 72 20 2d 63 20 2d |.shar..s|har -c -|
|00000650| 76 20 24 28 53 52 43 32 | 29 20 3e 20 78 6c 69 73 |v $(SRC2|) > xlis|
|00000660| 70 33 2e 73 68 61 72 0a | 09 73 68 61 72 20 2d 63 |p3.shar.|.shar -c|
|00000670| 20 2d 76 20 24 28 53 52 | 43 33 29 20 24 28 4d 49 | -v $(SR|C3) $(MI|
|00000680| 53 43 29 20 3e 20 78 6c | 69 73 70 34 2e 73 68 61 |SC) > xl|isp4.sha|
|00000690| 72 0a 53 48 41 52 5f 45 | 4f 46 0a 69 66 20 74 65 |r.SHAR_E|OF.if te|
|000006a0| 73 74 20 39 32 31 20 2d | 6e 65 20 22 60 77 63 20 |st 921 -|ne "`wc |
|000006b0| 2d 63 20 3c 20 27 4d 61 | 6b 65 66 69 6c 65 27 60 |-c < 'Ma|kefile'`|
|000006c0| 22 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |".then..|echo sha|
|000006d0| 72 3a 20 65 72 72 6f 72 | 20 74 72 61 6e 73 6d 69 |r: error| transmi|
|000006e0| 74 74 69 6e 67 20 22 27 | 4d 61 6b 65 66 69 6c 65 |tting "'|Makefile|
|000006f0| 27 22 20 27 28 73 68 6f | 75 6c 64 20 68 61 76 65 |'" '(sho|uld have|
|00000700| 20 62 65 65 6e 20 39 32 | 31 20 63 68 61 72 61 63 | been 92|1 charac|
|00000710| 74 65 72 73 29 27 0a 66 | 69 0a 66 69 20 23 20 65 |ters)'.f|i.fi # e|
|00000720| 6e 64 20 6f 66 20 6f 76 | 65 72 77 72 69 74 69 6e |nd of ov|erwritin|
|00000730| 67 20 63 68 65 63 6b 0a | 65 63 68 6f 20 73 68 61 |g check.|echo sha|
|00000740| 72 3a 20 65 78 74 72 61 | 63 74 69 6e 67 20 22 27 |r: extra|cting "'|
|00000750| 66 61 63 74 2e 6c 73 70 | 27 22 20 27 28 38 34 20 |fact.lsp|'" '(84 |
|00000760| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 69 66 20 |characte|rs)'.if |
|00000770| 74 65 73 74 20 2d 66 20 | 27 66 61 63 74 2e 6c 73 |test -f |'fact.ls|
|00000780| 70 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |p'.then.|.echo sh|
|00000790| 61 72 3a 20 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: will| not ove|
|000007a0| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|000007b0| 20 66 69 6c 65 20 22 27 | 66 61 63 74 2e 6c 73 70 | file "'|fact.lsp|
|000007c0| 27 22 0a 65 6c 73 65 0a | 73 65 64 20 27 73 2f 5e |'".else.|sed 's/^|
|000007d0| 58 2f 2f 27 20 3c 3c 20 | 5c 53 48 41 52 5f 45 4f |X//' << |\SHAR_EO|
|000007e0| 46 20 3e 20 27 66 61 63 | 74 2e 6c 73 70 27 0a 28 |F > 'fac|t.lsp'.(|
|000007f0| 64 65 66 75 6e 20 66 61 | 63 74 6f 72 69 61 6c 20 |defun fa|ctorial |
|00000800| 28 6e 29 0a 20 20 20 20 | 20 20 20 28 63 6f 6e 64 |(n). | (cond|
|00000810| 20 28 28 3d 20 6e 20 31 | 29 20 31 29 0a 09 20 20 | ((= n 1|) 1).. |
|00000820| 20 20 20 28 74 20 28 2a | 20 6e 20 28 66 61 63 74 | (t (*| n (fact|
|00000830| 6f 72 69 61 6c 20 28 2d | 20 6e 20 31 29 29 29 29 |orial (-| n 1))))|
|00000840| 29 29 0a 53 48 41 52 5f | 45 4f 46 0a 69 66 20 74 |)).SHAR_|EOF.if t|
|00000850| 65 73 74 20 38 34 20 2d | 6e 65 20 22 60 77 63 20 |est 84 -|ne "`wc |
|00000860| 2d 63 20 3c 20 27 66 61 | 63 74 2e 6c 73 70 27 60 |-c < 'fa|ct.lsp'`|
|00000870| 22 0a 74 68 65 6e 0a 09 | 65 63 68 6f 20 73 68 61 |".then..|echo sha|
|00000880| 72 3a 20 65 72 72 6f 72 | 20 74 72 61 6e 73 6d 69 |r: error| transmi|
|00000890| 74 74 69 6e 67 20 22 27 | 66 61 63 74 2e 6c 73 70 |tting "'|fact.lsp|
|000008a0| 27 22 20 27 28 73 68 6f | 75 6c 64 20 68 61 76 65 |'" '(sho|uld have|
|000008b0| 20 62 65 65 6e 20 38 34 | 20 63 68 61 72 61 63 74 | been 84| charact|
|000008c0| 65 72 73 29 27 0a 66 69 | 0a 66 69 20 23 20 65 6e |ers)'.fi|.fi # en|
|000008d0| 64 20 6f 66 20 6f 76 65 | 72 77 72 69 74 69 6e 67 |d of ove|rwriting|
|000008e0| 20 63 68 65 63 6b 0a 65 | 63 68 6f 20 73 68 61 72 | check.e|cho shar|
|000008f0| 3a 20 65 78 74 72 61 63 | 74 69 6e 67 20 22 27 69 |: extrac|ting "'i|
|00000900| 6e 69 74 2e 6c 73 70 27 | 22 20 27 28 31 39 35 39 |nit.lsp'|" '(1959|
|00000910| 20 63 68 61 72 61 63 74 | 65 72 73 29 27 0a 69 66 | charact|ers)'.if|
|00000920| 20 74 65 73 74 20 2d 66 | 20 27 69 6e 69 74 2e 6c | test -f| 'init.l|
|00000930| 73 70 27 0a 74 68 65 6e | 0a 09 65 63 68 6f 20 73 |sp'.then|..echo s|
|00000940| 68 61 72 3a 20 77 69 6c | 6c 20 6e 6f 74 20 6f 76 |har: wil|l not ov|
|00000950| 65 72 2d 77 72 69 74 65 | 20 65 78 69 73 74 69 6e |er-write| existin|
|00000960| 67 20 66 69 6c 65 20 22 | 27 69 6e 69 74 2e 6c 73 |g file "|'init.ls|
|00000970| 70 27 22 0a 65 6c 73 65 | 0a 73 65 64 20 27 73 2f |p'".else|.sed 's/|
|00000980| 5e 58 2f 2f 27 20 3c 3c | 20 5c 53 48 41 52 5f 45 |^X//' <<| \SHAR_E|
|00000990| 4f 46 20 3e 20 27 69 6e | 69 74 2e 6c 73 70 27 0a |OF > 'in|it.lsp'.|
|000009a0| 3b 20 67 65 74 20 73 6f | 6d 65 20 6d 6f 72 65 20 |; get so|me more |
|000009b0| 6d 65 6d 6f 72 79 0a 28 | 65 78 70 61 6e 64 20 31 |memory.(|expand 1|
|000009c0| 29 0a 0a 3b 20 73 6f 6d | 65 20 66 61 6b 65 20 64 |)..; som|e fake d|
|000009d0| 65 66 69 6e 69 74 69 6f | 6e 73 20 66 6f 72 20 43 |efinitio|ns for C|
|000009e0| 6f 6d 6d 6f 6e 20 4c 69 | 73 70 20 70 73 65 75 64 |ommon Li|sp pseud|
|000009f0| 6f 20 63 6f 6d 70 61 74 | 69 62 6c 69 74 79 0a 28 |o compat|iblity.(|
|00000a00| 73 65 74 71 20 73 79 6d | 62 6f 6c 2d 66 75 6e 63 |setq sym|bol-func|
|00000a10| 74 69 6f 6e 20 73 79 6d | 62 6f 6c 2d 76 61 6c 75 |tion sym|bol-valu|
|00000a20| 65 29 0a 28 73 65 74 71 | 20 66 62 6f 75 6e 64 70 |e).(setq| fboundp|
|00000a30| 20 62 6f 75 6e 64 70 29 | 0a 28 73 65 74 71 20 66 | boundp)|.(setq f|
|00000a40| 69 72 73 74 20 63 61 72 | 29 0a 28 73 65 74 71 20 |irst car|).(setq |
|00000a50| 73 65 63 6f 6e 64 20 63 | 61 64 72 29 0a 28 73 65 |second c|adr).(se|
|00000a60| 74 71 20 72 65 73 74 20 | 63 64 72 29 0a 0a 3b 20 |tq rest |cdr)..; |
|00000a70| 73 6f 6d 65 20 6d 6f 72 | 65 20 63 78 72 20 66 75 |some mor|e cxr fu|
|00000a80| 6e 63 74 69 6f 6e 73 0a | 28 64 65 66 75 6e 20 63 |nctions.|(defun c|
|00000a90| 61 64 64 72 20 28 78 29 | 20 28 63 61 72 20 28 63 |addr (x)| (car (c|
|00000aa0| 64 64 72 20 78 29 29 29 | 0a 28 64 65 66 75 6e 20 |ddr x)))|.(defun |
|00000ab0| 63 61 64 64 64 72 20 28 | 78 29 20 28 63 61 64 72 |cadddr (|x) (cadr|
|00000ac0| 20 28 63 64 64 72 20 78 | 29 29 29 0a 0a 3b 20 28 | (cddr x|)))..; (|
|00000ad0| 77 68 65 6e 20 74 65 73 | 74 20 63 6f 64 65 2e 2e |when tes|t code..|
|00000ae0| 2e 29 20 2d 20 65 78 65 | 63 75 74 65 20 63 6f 64 |.) - exe|cute cod|
|00000af0| 65 20 77 68 65 6e 20 74 | 65 73 74 20 69 73 20 74 |e when t|est is t|
|00000b00| 72 75 65 0a 28 64 65 66 | 6d 61 63 72 6f 20 77 68 |rue.(def|macro wh|
|00000b10| 65 6e 20 28 74 65 73 74 | 20 26 72 65 73 74 20 63 |en (test| &rest c|
|00000b20| 6f 64 65 29 0a 20 20 20 | 20 20 20 20 20 20 20 60 |ode). | `|
|00000b30| 28 63 6f 6e 64 20 28 2c | 74 65 73 74 20 2c 40 63 |(cond (,|test ,@c|
|00000b40| 6f 64 65 29 29 29 0a 0a | 3b 20 28 75 6e 6c 65 73 |ode)))..|; (unles|
|00000b50| 73 20 74 65 73 74 20 63 | 6f 64 65 2e 2e 2e 29 20 |s test c|ode...) |
|00000b60| 2d 20 65 78 65 63 75 74 | 65 20 63 6f 64 65 20 75 |- execut|e code u|
|00000b70| 6e 6c 65 73 73 20 74 65 | 73 74 20 69 73 20 74 72 |nless te|st is tr|
|00000b80| 75 65 0a 28 64 65 66 6d | 61 63 72 6f 20 75 6e 6c |ue.(defm|acro unl|
|00000b90| 65 73 73 20 28 74 65 73 | 74 20 26 72 65 73 74 20 |ess (tes|t &rest |
|00000ba0| 63 6f 64 65 29 0a 20 20 | 20 20 20 20 20 20 20 20 |code). | |
|00000bb0| 60 28 63 6f 6e 64 20 28 | 28 6e 6f 74 20 2c 74 65 |`(cond (|(not ,te|
|00000bc0| 73 74 29 20 2c 40 63 6f | 64 65 29 29 29 0a 0a 3b |st) ,@co|de)))..;|
|00000bd0| 20 28 6d 61 6b 75 6e 62 | 6f 75 6e 64 20 73 79 6d | (makunb|ound sym|
|00000be0| 29 20 2d 20 6d 61 6b 65 | 20 61 20 73 79 6d 62 6f |) - make| a symbo|
|00000bf0| 6c 20 62 65 20 75 6e 62 | 6f 75 6e 64 0a 28 64 65 |l be unb|ound.(de|
|00000c00| 66 75 6e 20 6d 61 6b 75 | 6e 62 6f 75 6e 64 20 28 |fun maku|nbound (|
|00000c10| 73 79 6d 29 20 28 73 65 | 74 71 20 73 79 6d 20 27 |sym) (se|tq sym '|
|00000c20| 2a 75 6e 62 6f 75 6e 64 | 2a 29 20 73 79 6d 29 0a |*unbound|*) sym).|
|00000c30| 0a 3b 20 28 6f 62 6a 65 | 63 74 70 20 65 78 70 72 |.; (obje|ctp expr|
|00000c40| 29 20 2d 20 6f 62 6a 65 | 63 74 20 70 72 65 64 69 |) - obje|ct predi|
|00000c50| 63 61 74 65 0a 28 64 65 | 66 75 6e 20 6f 62 6a 65 |cate.(de|fun obje|
|00000c60| 63 74 70 20 28 78 29 20 | 28 65 71 20 28 74 79 70 |ctp (x) |(eq (typ|
|00000c70| 65 20 78 29 20 27 4f 42 | 4a 29 29 0a 0a 3b 20 28 |e x) 'OB|J))..; (|
|00000c80| 66 69 6c 65 70 20 65 78 | 70 72 29 20 2d 20 66 69 |filep ex|pr) - fi|
|00000c90| 6c 65 20 70 72 65 64 69 | 63 61 74 65 0a 28 64 65 |le predi|cate.(de|
|00000ca0| 66 75 6e 20 66 69 6c 65 | 70 20 28 78 29 20 28 65 |fun file|p (x) (e|
|00000cb0| 71 20 28 74 79 70 65 20 | 78 29 20 27 46 50 54 52 |q (type |x) 'FPTR|
|00000cc0| 29 29 0a 0a 3b 20 28 75 | 6e 69 6e 74 65 72 6e 20 |))..; (u|nintern |
|00000cd0| 73 79 6d 29 20 2d 20 72 | 65 6d 6f 76 65 20 61 20 |sym) - r|emove a |
|00000ce0| 73 79 6d 62 6f 6c 20 66 | 72 6f 6d 20 74 68 65 20 |symbol f|rom the |
|00000cf0| 6f 62 6c 69 73 74 0a 28 | 64 65 66 75 6e 20 75 6e |oblist.(|defun un|
|00000d00| 69 6e 74 65 72 6e 20 28 | 73 79 6d 29 20 28 63 6f |intern (|sym) (co|
|00000d10| 6e 64 20 28 28 6d 65 6d | 62 65 72 20 73 79 6d 20 |nd ((mem|ber sym |
|00000d20| 2a 6f 62 6c 69 73 74 2a | 29 0a 20 20 20 20 20 20 |*oblist*|). |
|00000d30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d40| 20 20 20 20 20 20 20 28 | 73 65 74 71 20 2a 6f 62 | (|setq *ob|
|00000d50| 6c 69 73 74 2a 20 28 64 | 65 6c 65 74 65 20 73 79 |list* (d|elete sy|
|00000d60| 6d 20 2a 6f 62 6c 69 73 | 74 2a 29 29 0a 20 20 20 |m *oblis|t*)). |
|00000d70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000d80| 20 20 20 20 20 20 20 20 | 20 20 74 29 0a 20 20 20 | | t). |
|00000d90| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000da0| 20 20 20 20 20 20 20 20 | 20 28 74 20 6e 69 6c 29 | | (t nil)|
|00000db0| 29 29 0a 0a 3b 20 28 6d | 61 70 63 61 6e 20 2e 2e |))..; (m|apcan ..|
|00000dc0| 2e 29 0a 28 64 65 66 6d | 61 63 72 6f 20 6d 61 70 |.).(defm|acro map|
|00000dd0| 63 61 6e 20 28 26 72 65 | 73 74 20 61 72 67 73 29 |can (&re|st args)|
|00000de0| 20 60 28 61 70 70 6c 79 | 20 23 27 6e 63 6f 6e 63 | `(apply| #'nconc|
|00000df0| 20 28 6d 61 70 63 61 72 | 20 2c 40 61 72 67 73 29 | (mapcar| ,@args)|
|00000e00| 29 29 0a 0a 3b 20 28 6d | 61 70 63 6f 6e 20 2e 2e |))..; (m|apcon ..|
|00000e10| 2e 29 0a 28 64 65 66 6d | 61 63 72 6f 20 6d 61 70 |.).(defm|acro map|
|00000e20| 63 6f 6e 20 28 26 72 65 | 73 74 20 61 72 67 73 29 |con (&re|st args)|
|00000e30| 20 60 28 61 70 70 6c 79 | 20 23 27 6e 63 6f 6e 63 | `(apply| #'nconc|
|00000e40| 20 28 6d 61 70 6c 69 73 | 74 20 2c 40 61 72 67 73 | (maplis|t ,@args|
|00000e50| 29 29 29 0a 0a 3b 20 28 | 73 61 76 65 20 66 75 6e |)))..; (|save fun|
|00000e60| 29 20 2d 20 73 61 76 65 | 20 61 20 66 75 6e 63 74 |) - save| a funct|
|00000e70| 69 6f 6e 20 64 65 66 69 | 6e 69 74 69 6f 6e 20 74 |ion defi|nition t|
|00000e80| 6f 20 61 20 66 69 6c 65 | 0a 28 64 65 66 75 6e 20 |o a file|.(defun |
|00000e90| 73 61 76 65 20 28 66 75 | 6e 29 0a 20 20 20 20 20 |save (fu|n). |
|00000ea0| 20 20 28 6c 65 74 2a 20 | 28 28 66 6e 61 6d 65 20 | (let* |((fname |
|00000eb0| 28 73 74 72 63 61 74 20 | 28 73 79 6d 62 6f 6c 2d |(strcat |(symbol-|
|00000ec0| 6e 61 6d 65 20 66 75 6e | 29 20 22 2e 6c 73 70 22 |name fun|) ".lsp"|
|00000ed0| 29 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |)). | |
|00000ee0| 20 28 66 70 20 28 6f 70 | 65 6e 6f 20 66 6e 61 6d | (fp (op|eno fnam|
|00000ef0| 65 29 29 29 0a 20 20 20 | 20 20 20 20 20 20 20 20 |e))). | |
|00000f00| 20 20 28 63 6f 6e 64 20 | 28 66 70 20 28 70 72 69 | (cond |(fp (pri|
|00000f10| 6e 74 20 28 63 6f 6e 73 | 20 28 69 66 20 28 65 71 |nt (cons| (if (eq|
|00000f20| 20 28 63 61 72 20 28 65 | 76 61 6c 20 66 75 6e 29 | (car (e|val fun)|
|00000f30| 29 20 27 6c 61 6d 62 64 | 61 29 0a 20 20 20 20 20 |) 'lambd|a). |
|00000f40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000f50| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000f60| 20 20 20 27 64 65 66 75 | 6e 0a 20 20 20 20 20 20 | 'defu|n. |
|00000f70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000f80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000f90| 20 20 27 64 65 66 6d 61 | 63 72 6f 29 0a 20 20 20 | 'defma|cro). |
|00000fa0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000fb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000fc0| 20 28 63 6f 6e 73 20 66 | 75 6e 20 28 63 64 72 20 | (cons f|un (cdr |
|00000fd0| 28 65 76 61 6c 20 66 75 | 6e 29 29 29 29 20 66 70 |(eval fu|n)))) fp|
|00000fe0| 29 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |). | |
|00000ff0| 20 20 20 20 20 20 20 20 | 20 28 63 6c 6f 73 65 20 | | (close |
|00001000| 66 70 29 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |fp). | |
|00001010| 20 20 20 20 20 20 20 20 | 20 20 20 66 6e 61 6d 65 | | fname|
|00001020| 29 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |). | |
|00001030| 20 20 20 20 20 28 74 20 | 6e 69 6c 29 29 29 29 0a | (t |nil)))).|
|00001040| 0a 3b 20 28 64 65 62 75 | 67 29 20 2d 20 65 6e 61 |.; (debu|g) - ena|
|00001050| 62 6c 65 20 64 65 62 75 | 67 20 62 72 65 61 6b 73 |ble debu|g breaks|
|00001060| 0a 28 64 65 66 75 6e 20 | 64 65 62 75 67 20 28 29 |.(defun |debug ()|
|00001070| 0a 20 20 20 20 20 20 20 | 28 73 65 74 71 20 2a 62 |. |(setq *b|
|00001080| 72 65 61 6b 65 6e 61 62 | 6c 65 2a 20 74 29 29 0a |reakenab|le* t)).|
|00001090| 0a 3b 20 28 6e 6f 64 65 | 62 75 67 29 20 2d 20 64 |.; (node|bug) - d|
|000010a0| 69 73 61 62 6c 65 20 64 | 65 62 75 67 20 62 72 65 |isable d|ebug bre|
|000010b0| 61 6b 73 0a 28 64 65 66 | 75 6e 20 6e 6f 64 65 62 |aks.(def|un nodeb|
|000010c0| 75 67 20 28 29 0a 20 20 | 20 20 20 20 20 28 73 65 |ug (). | (se|
|000010d0| 74 71 20 2a 62 72 65 61 | 6b 65 6e 61 62 6c 65 2a |tq *brea|kenable*|
|000010e0| 20 6e 69 6c 29 29 0a 0a | 3b 20 69 6e 69 74 69 61 | nil))..|; initia|
|000010f0| 6c 69 7a 65 20 74 6f 20 | 65 6e 61 62 6c 65 20 62 |lize to |enable b|
|00001100| 72 65 61 6b 73 20 62 75 | 74 20 6e 6f 20 74 72 61 |reaks bu|t no tra|
|00001110| 63 65 20 62 61 63 6b 0a | 28 73 65 74 71 20 2a 62 |ce back.|(setq *b|
|00001120| 72 65 61 6b 65 6e 61 62 | 6c 65 2a 20 74 29 0a 28 |reakenab|le* t).(|
|00001130| 73 65 74 71 20 2a 74 72 | 61 63 65 6e 61 62 6c 65 |setq *tr|acenable|
|00001140| 2a 20 6e 69 6c 29 0a 53 | 48 41 52 5f 45 4f 46 0a |* nil).S|HAR_EOF.|
|00001150| 69 66 20 74 65 73 74 20 | 31 39 35 39 20 2d 6e 65 |if test |1959 -ne|
|00001160| 20 22 60 77 63 20 2d 63 | 20 3c 20 27 69 6e 69 74 | "`wc -c| < 'init|
|00001170| 2e 6c 73 70 27 60 22 0a | 74 68 65 6e 0a 09 65 63 |.lsp'`".|then..ec|
|00001180| 68 6f 20 73 68 61 72 3a | 20 65 72 72 6f 72 20 74 |ho shar:| error t|
|00001190| 72 61 6e 73 6d 69 74 74 | 69 6e 67 20 22 27 69 6e |ransmitt|ing "'in|
|000011a0| 69 74 2e 6c 73 70 27 22 | 20 27 28 73 68 6f 75 6c |it.lsp'"| '(shoul|
|000011b0| 64 20 68 61 76 65 20 62 | 65 65 6e 20 31 39 35 39 |d have b|een 1959|
|000011c0| 20 63 68 61 72 61 63 74 | 65 72 73 29 27 0a 66 69 | charact|ers)'.fi|
|000011d0| 0a 66 69 20 23 20 65 6e | 64 20 6f 66 20 6f 76 65 |.fi # en|d of ove|
|000011e0| 72 77 72 69 74 69 6e 67 | 20 63 68 65 63 6b 0a 65 |rwriting| check.e|
|000011f0| 63 68 6f 20 73 68 61 72 | 3a 20 65 78 74 72 61 63 |cho shar|: extrac|
|00001200| 74 69 6e 67 20 22 27 6f | 62 6a 65 63 74 2e 6c 73 |ting "'o|bject.ls|
|00001210| 70 27 22 20 27 28 32 33 | 37 34 20 63 68 61 72 61 |p'" '(23|74 chara|
|00001220| 63 74 65 72 73 29 27 0a | 69 66 20 74 65 73 74 20 |cters)'.|if test |
|00001230| 2d 66 20 27 6f 62 6a 65 | 63 74 2e 6c 73 70 27 0a |-f 'obje|ct.lsp'.|
|00001240| 74 68 65 6e 0a 09 65 63 | 68 6f 20 73 68 61 72 3a |then..ec|ho shar:|
|00001250| 20 77 69 6c 6c 20 6e 6f | 74 20 6f 76 65 72 2d 77 | will no|t over-w|
|00001260| 72 69 74 65 20 65 78 69 | 73 74 69 6e 67 20 66 69 |rite exi|sting fi|
|00001270| 6c 65 20 22 27 6f 62 6a | 65 63 74 2e 6c 73 70 27 |le "'obj|ect.lsp'|
|00001280| 22 0a 65 6c 73 65 0a 73 | 65 64 20 27 73 2f 5e 58 |".else.s|ed 's/^X|
|00001290| 2f 2f 27 20 3c 3c 20 5c | 53 48 41 52 5f 45 4f 46 |//' << \|SHAR_EOF|
|000012a0| 20 3e 20 27 6f 62 6a 65 | 63 74 2e 6c 73 70 27 0a | > 'obje|ct.lsp'.|
|000012b0| 3b 20 54 68 69 73 20 69 | 73 20 61 6e 20 65 78 61 |; This i|s an exa|
|000012c0| 6d 70 6c 65 20 75 73 69 | 6e 67 20 74 68 65 20 6f |mple usi|ng the o|
|000012d0| 62 6a 65 63 74 2d 6f 72 | 69 65 6e 74 65 64 20 70 |bject-or|iented p|
|000012e0| 72 6f 67 72 61 6d 6d 69 | 6e 67 20 73 75 70 70 6f |rogrammi|ng suppo|
|000012f0| 72 74 20 69 6e 0a 3b 20 | 58 4c 49 53 50 2e 20 20 |rt in.; |XLISP. |
|00001300| 54 68 65 20 65 78 61 6d | 70 6c 65 20 69 6e 76 6f |The exam|ple invo|
|00001310| 6c 76 65 73 20 64 65 66 | 69 6e 69 6e 67 20 61 20 |lves def|ining a |
|00001320| 63 6c 61 73 73 20 6f 66 | 20 6f 62 6a 65 63 74 73 |class of| objects|
|00001330| 20 72 65 70 72 65 73 65 | 6e 74 69 6e 67 0a 3b 20 | represe|nting.; |
|00001340| 64 69 63 74 69 6f 6e 61 | 72 69 65 73 2e 20 20 45 |dictiona|ries. E|
|00001350| 61 63 68 20 69 6e 73 74 | 61 6e 63 65 20 6f 66 20 |ach inst|ance of |
|00001360| 74 68 69 73 20 63 6c 61 | 73 73 20 77 69 6c 6c 20 |this cla|ss will |
|00001370| 62 65 20 61 20 64 69 63 | 74 69 6f 6e 61 72 79 20 |be a dic|tionary |
|00001380| 69 6e 0a 3b 20 77 68 69 | 63 68 20 6e 61 6d 65 73 |in.; whi|ch names|
|00001390| 20 61 6e 64 20 76 61 6c | 75 65 73 20 63 61 6e 20 | and val|ues can |
|000013a0| 62 65 20 73 74 6f 72 65 | 64 2e 20 20 54 68 65 72 |be store|d. Ther|
|000013b0| 65 20 77 69 6c 6c 20 61 | 6c 73 6f 20 62 65 20 61 |e will a|lso be a|
|000013c0| 20 66 61 63 69 6c 69 74 | 79 0a 3b 20 66 6f 72 20 | facilit|y.; for |
|000013d0| 66 69 6e 64 69 6e 67 20 | 74 68 65 20 76 61 6c 75 |finding |the valu|
|000013e0| 65 73 20 61 73 73 6f 63 | 69 61 74 65 64 20 77 69 |es assoc|iated wi|
|000013f0| 74 68 20 6e 61 6d 65 73 | 20 61 66 74 65 72 20 74 |th names| after t|
|00001400| 68 65 79 20 68 61 76 65 | 20 62 65 65 6e 0a 3b 20 |hey have| been.; |
|00001410| 73 74 6f 72 65 64 2e 0a | 0a 3b 20 43 72 65 61 74 |stored..|.; Creat|
|00001420| 65 20 74 68 65 20 27 44 | 69 63 74 69 6f 6e 61 72 |e the 'D|ictionar|
|00001430| 79 27 20 63 6c 61 73 73 | 2e 0a 0a 28 73 65 74 71 |y' class|...(setq|
|00001440| 20 44 69 63 74 69 6f 6e | 61 72 79 20 28 43 6c 61 | Diction|ary (Cla|
|00001450| 73 73 20 27 6e 65 77 29 | 29 0a 0a 3b 20 45 73 74 |ss 'new)|)..; Est|
|00001460| 61 62 6c 69 73 68 20 74 | 68 65 20 69 6e 73 74 61 |ablish t|he insta|
|00001470| 6e 63 65 20 76 61 72 69 | 61 62 6c 65 73 20 66 6f |nce vari|ables fo|
|00001480| 72 20 74 68 65 20 6e 65 | 77 20 63 6c 61 73 73 2e |r the ne|w class.|
|00001490| 0a 3b 20 54 68 65 20 76 | 61 72 69 61 62 6c 65 20 |.; The v|ariable |
|000014a0| 27 65 6e 74 72 69 65 73 | 27 20 77 69 6c 6c 20 70 |'entries|' will p|
|000014b0| 6f 69 6e 74 20 74 6f 20 | 61 6e 20 61 73 73 6f 63 |oint to |an assoc|
|000014c0| 69 61 74 69 6f 6e 20 6c | 69 73 74 20 72 65 70 72 |iation l|ist repr|
|000014d0| 65 73 65 6e 74 69 6e 67 | 20 74 68 65 0a 3b 20 65 |esenting| the.; e|
|000014e0| 6e 74 72 69 65 73 20 69 | 6e 20 74 68 65 20 64 69 |ntries i|n the di|
|000014f0| 63 74 69 6f 6e 61 72 79 | 20 69 6e 73 74 61 6e 63 |ctionary| instanc|
|00001500| 65 2e 0a 0a 28 44 69 63 | 74 69 6f 6e 61 72 79 20 |e...(Dic|tionary |
|00001510| 27 69 76 61 72 73 20 27 | 28 65 6e 74 72 69 65 73 |'ivars '|(entries|
|00001520| 29 29 0a 0a 3b 20 53 65 | 74 75 70 20 74 68 65 20 |))..; Se|tup the |
|00001530| 6d 65 74 68 6f 64 20 66 | 6f 72 20 74 68 65 20 27 |method f|or the '|
|00001540| 69 73 6e 65 77 27 20 69 | 6e 69 74 69 61 6c 69 7a |isnew' i|nitializ|
|00001550| 61 74 69 6f 6e 20 6d 65 | 73 73 61 67 65 2e 0a 3b |ation me|ssage..;|
|00001560| 20 54 68 69 73 20 6d 65 | 73 73 61 67 65 20 77 69 | This me|ssage wi|
|00001570| 6c 6c 20 62 65 20 73 65 | 6e 64 20 77 68 65 6e 65 |ll be se|nd whene|
|00001580| 76 65 72 20 61 20 6e 65 | 77 20 69 6e 73 74 61 6e |ver a ne|w instan|
|00001590| 63 65 20 6f 66 20 74 68 | 65 20 27 44 69 63 74 69 |ce of th|e 'Dicti|
|000015a0| 6f 6e 61 72 79 27 0a 3b | 20 63 6c 61 73 73 20 69 |onary'.;| class i|
|000015b0| 73 20 63 72 65 61 74 65 | 64 2e 20 20 49 74 73 20 |s create|d. Its |
|000015c0| 70 75 72 70 6f 73 65 20 | 69 73 20 74 6f 20 61 6c |purpose |is to al|
|000015d0| 6c 6f 77 20 74 68 65 20 | 6e 65 77 20 69 6e 73 74 |low the |new inst|
|000015e0| 61 6e 63 65 20 74 6f 20 | 62 65 0a 3b 20 69 6e 69 |ance to |be.; ini|
|000015f0| 74 69 61 6c 69 7a 65 64 | 20 62 65 66 6f 72 65 20 |tialized| before |
|00001600| 61 6e 79 20 6f 74 68 65 | 72 20 6d 65 73 73 61 67 |any othe|r messag|
|00001610| 65 73 20 61 72 65 20 73 | 65 6e 74 20 74 6f 20 69 |es are s|ent to i|
|00001620| 74 2e 20 20 49 74 20 73 | 65 74 73 20 74 68 65 20 |t. It s|ets the |
|00001630| 76 61 6c 75 65 0a 3b 20 | 6f 66 20 27 65 6e 74 72 |value.; |of 'entr|
|00001640| 69 65 73 27 20 74 6f 20 | 6e 69 6c 20 74 6f 20 69 |ies' to |nil to i|
|00001650| 6e 64 69 63 61 74 65 20 | 74 68 61 74 20 74 68 65 |ndicate |that the|
|00001660| 20 64 69 63 74 69 6f 6e | 61 72 79 20 69 73 20 65 | diction|ary is e|
|00001670| 6d 70 74 79 2e 0a 0a 28 | 44 69 63 74 69 6f 6e 61 |mpty...(|Dictiona|
|00001680| 72 79 20 27 61 6e 73 77 | 65 72 20 27 69 73 6e 65 |ry 'answ|er 'isne|
|00001690| 77 20 27 28 29 0a 09 20 | 20 20 20 27 28 28 73 65 |w '().. | '((se|
|000016a0| 74 71 20 65 6e 74 72 69 | 65 73 20 6e 69 6c 29 0a |tq entri|es nil).|
|000016b0| 09 20 20 20 20 20 20 73 | 65 6c 66 29 29 0a 0a 3b |. s|elf))..;|
|000016c0| 20 44 65 66 69 6e 65 20 | 74 68 65 20 6d 65 73 73 | Define |the mess|
|000016d0| 61 67 65 20 27 61 64 64 | 27 20 74 6f 20 6d 61 6b |age 'add|' to mak|
|000016e0| 65 20 61 20 6e 65 77 20 | 65 6e 74 72 79 20 69 6e |e a new |entry in|
|000016f0| 20 74 68 65 20 64 69 63 | 74 69 6f 6e 61 72 79 2e | the dic|tionary.|
|00001700| 20 20 54 68 69 73 0a 3b | 20 6d 65 73 73 61 67 65 | This.;| message|
|00001710| 20 74 61 6b 65 73 20 74 | 77 6f 20 61 72 67 75 6d | takes t|wo argum|
|00001720| 65 6e 74 73 2e 20 20 54 | 68 65 20 61 72 67 75 6d |ents. T|he argum|
|00001730| 65 6e 74 20 27 6e 61 6d | 65 27 20 73 70 65 63 69 |ent 'nam|e' speci|
|00001740| 66 69 65 73 20 74 68 65 | 20 6e 61 6d 65 0a 3b 20 |fies the| name.; |
|00001750| 6f 66 20 74 68 65 20 6e | 65 77 20 65 6e 74 72 79 |of the n|ew entry|
|00001760| 3b 20 74 68 65 20 61 72 | 67 75 6d 65 6e 74 20 27 |; the ar|gument '|
|00001770| 76 61 6c 75 65 27 20 73 | 70 65 63 69 66 69 65 73 |value' s|pecifies|
|00001780| 20 74 68 65 20 76 61 6c | 75 65 20 74 6f 20 62 65 | the val|ue to be|
|00001790| 0a 3b 20 61 73 73 6f 63 | 69 61 74 65 64 20 77 69 |.; assoc|iated wi|
|000017a0| 74 68 20 74 68 61 74 20 | 6e 61 6d 65 2e 0a 0a 28 |th that |name...(|
|000017b0| 44 69 63 74 69 6f 6e 61 | 72 79 20 27 61 6e 73 77 |Dictiona|ry 'answ|
|000017c0| 65 72 20 27 61 64 64 20 | 27 28 6e 61 6d 65 20 76 |er 'add |'(name v|
|000017d0| 61 6c 75 65 29 0a 09 20 | 20 20 20 27 28 28 73 65 |alue).. | '((se|
|000017e0| 74 71 20 65 6e 74 72 69 | 65 73 0a 09 20 20 20 20 |tq entri|es.. |
|000017f0| 20 20 20 20 20 20 20 20 | 28 63 6f 6e 73 20 28 63 | |(cons (c|
|00001800| 6f 6e 73 20 6e 61 6d 65 | 20 76 61 6c 75 65 29 20 |ons name| value) |
|00001810| 65 6e 74 72 69 65 73 29 | 29 0a 09 20 20 20 20 20 |entries)|).. |
|00001820| 20 76 61 6c 75 65 29 29 | 0a 0a 3b 20 43 72 65 61 | value))|..; Crea|
|00001830| 74 65 20 61 6e 20 69 6e | 73 74 61 6e 63 65 20 6f |te an in|stance o|
|00001840| 66 20 74 68 65 20 27 44 | 69 63 74 69 6f 6e 61 72 |f the 'D|ictionar|
|00001850| 79 27 20 63 6c 61 73 73 | 2e 20 20 54 68 69 73 20 |y' class|. This |
|00001860| 69 6e 73 74 61 6e 63 65 | 20 69 73 20 61 6e 20 65 |instance| is an e|
|00001870| 6d 70 74 79 0a 3b 20 64 | 69 63 74 69 6f 6e 61 72 |mpty.; d|ictionar|
|00001880| 79 20 74 6f 20 77 68 69 | 63 68 20 77 6f 72 64 73 |y to whi|ch words|
|00001890| 20 6d 61 79 20 62 65 20 | 61 64 64 65 64 2e 0a 0a | may be |added...|
|000018a0| 28 73 65 74 71 20 64 20 | 28 44 69 63 74 69 6f 6e |(setq d |(Diction|
|000018b0| 61 72 79 20 27 6e 65 77 | 29 29 0a 0a 3b 20 41 64 |ary 'new|))..; Ad|
|000018c0| 64 20 73 6f 6d 65 20 65 | 6e 74 72 69 65 73 20 74 |d some e|ntries t|
|000018d0| 6f 20 74 68 65 20 6e 65 | 77 20 64 69 63 74 69 6f |o the ne|w dictio|
|000018e0| 6e 61 72 79 2e 0a 0a 28 | 64 20 27 61 64 64 20 27 |nary...(|d 'add '|
|000018f0| 6d 6f 7a 61 72 74 20 27 | 63 6f 6d 70 6f 73 65 72 |mozart '|composer|
|00001900| 29 0a 28 64 20 27 61 64 | 64 20 27 77 69 6e 73 74 |).(d 'ad|d 'winst|
|00001910| 6f 6e 20 27 63 6f 6d 70 | 75 74 65 72 2d 73 63 69 |on 'comp|uter-sci|
|00001920| 65 6e 74 69 73 74 29 0a | 0a 3b 20 44 65 66 69 6e |entist).|.; Defin|
|00001930| 65 20 61 20 6d 65 73 73 | 61 67 65 20 74 6f 20 66 |e a mess|age to f|
|00001940| 69 6e 64 20 65 6e 74 72 | 69 65 73 20 69 6e 20 61 |ind entr|ies in a|
|00001950| 20 64 69 63 74 69 6f 6e | 61 72 79 2e 20 20 54 68 | diction|ary. Th|
|00001960| 69 73 20 6d 65 73 73 61 | 67 65 20 74 61 6b 65 73 |is messa|ge takes|
|00001970| 0a 3b 20 6f 6e 65 20 61 | 72 67 75 6d 65 6e 74 20 |.; one a|rgument |
|00001980| 27 6e 61 6d 65 27 20 77 | 68 69 63 68 20 73 70 65 |'name' w|hich spe|
|00001990| 63 69 66 69 65 73 20 74 | 68 65 20 6e 61 6d 65 20 |cifies t|he name |
|000019a0| 6f 66 20 74 68 65 20 65 | 6e 74 72 79 20 66 6f 72 |of the e|ntry for|
|000019b0| 20 77 68 69 63 68 20 74 | 6f 0a 3b 20 73 65 61 72 | which t|o.; sear|
|000019c0| 63 68 2e 20 20 49 74 20 | 72 65 74 75 72 6e 73 20 |ch. It |returns |
|000019d0| 74 68 65 20 76 61 6c 75 | 65 20 61 73 73 6f 63 69 |the valu|e associ|
|000019e0| 61 74 65 64 20 77 69 74 | 68 20 74 68 65 20 65 6e |ated wit|h the en|
|000019f0| 74 72 79 20 69 66 20 6f | 6e 65 20 69 73 0a 3b 20 |try if o|ne is.; |
|00001a00| 70 72 65 73 65 6e 74 20 | 69 6e 20 74 68 65 20 64 |present |in the d|
|00001a10| 69 63 74 69 6f 6e 61 72 | 79 2e 20 20 4f 74 68 65 |ictionar|y. Othe|
|00001a20| 72 77 69 73 65 2c 20 69 | 74 20 72 65 74 75 72 6e |rwise, i|t return|
|00001a30| 73 20 6e 69 6c 2e 0a 0a | 28 44 69 63 74 69 6f 6e |s nil...|(Diction|
|00001a40| 61 72 79 20 27 61 6e 73 | 77 65 72 20 27 66 69 6e |ary 'ans|wer 'fin|
|00001a50| 64 20 27 28 6e 61 6d 65 | 20 26 61 75 78 20 65 6e |d '(name| &aux en|
|00001a60| 74 72 79 29 0a 09 20 20 | 20 20 27 28 28 63 6f 6e |try).. | '((con|
|00001a70| 64 20 28 28 73 65 74 71 | 20 65 6e 74 72 79 20 28 |d ((setq| entry (|
|00001a80| 61 73 73 6f 63 20 6e 61 | 6d 65 20 65 6e 74 72 69 |assoc na|me entri|
|00001a90| 65 73 29 29 0a 09 20 20 | 20 20 20 20 28 63 64 72 |es)).. | (cdr|
|00001aa0| 20 65 6e 74 72 79 29 29 | 0a 09 20 20 20 20 20 28 | entry))|.. (|
|00001ab0| 74 0a 09 20 20 20 20 20 | 20 6e 69 6c 29 29 29 29 |t.. | nil))))|
|00001ac0| 0a 0a 3b 20 54 72 79 20 | 74 6f 20 66 69 6e 64 20 |..; Try |to find |
|00001ad0| 73 6f 6d 65 20 65 6e 74 | 72 69 65 73 20 69 6e 20 |some ent|ries in |
|00001ae0| 74 68 65 20 64 69 63 74 | 69 6f 6e 61 72 79 20 77 |the dict|ionary w|
|00001af0| 65 20 63 72 65 61 74 65 | 64 2e 0a 0a 28 64 20 27 |e create|d...(d '|
|00001b00| 66 69 6e 64 20 27 6d 6f | 7a 61 72 74 29 0a 28 64 |find 'mo|zart).(d|
|00001b10| 20 27 66 69 6e 64 20 27 | 77 69 6e 73 74 6f 6e 29 | 'find '|winston)|
|00001b20| 0a 28 64 20 27 66 69 6e | 64 20 27 62 6f 7a 6f 29 |.(d 'fin|d 'bozo)|
|00001b30| 0a 0a 3b 20 54 68 65 20 | 6e 61 6d 65 73 20 27 6d |..; The |names 'm|
|00001b40| 6f 7a 61 72 74 27 20 61 | 6e 64 20 27 77 69 6e 73 |ozart' a|nd 'wins|
|00001b50| 74 6f 6e 27 20 61 72 65 | 20 66 6f 75 6e 64 20 69 |ton' are| found i|
|00001b60| 6e 20 74 68 65 20 64 69 | 63 74 69 6f 6e 61 72 79 |n the di|ctionary|
|00001b70| 20 73 6f 20 74 68 65 69 | 72 0a 3b 20 76 61 6c 75 | so thei|r.; valu|
|00001b80| 65 73 20 27 63 6f 6d 70 | 6f 73 65 72 27 20 61 6e |es 'comp|oser' an|
|00001b90| 64 20 27 63 6f 6d 70 75 | 74 65 72 2d 73 63 69 65 |d 'compu|ter-scie|
|00001ba0| 6e 74 69 73 74 27 20 61 | 72 65 20 72 65 74 75 72 |ntist' a|re retur|
|00001bb0| 6e 65 64 2e 20 20 54 68 | 65 20 6e 61 6d 65 20 27 |ned. Th|e name '|
|00001bc0| 62 6f 7a 6f 27 0a 3b 20 | 69 73 20 6e 6f 74 20 66 |bozo'.; |is not f|
|00001bd0| 6f 75 6e 64 20 73 6f 20 | 6e 69 6c 20 69 73 20 72 |ound so |nil is r|
|00001be0| 65 74 75 72 6e 65 64 20 | 69 6e 20 74 68 69 73 20 |eturned |in this |
|00001bf0| 63 61 73 65 2e 0a 53 48 | 41 52 5f 45 4f 46 0a 69 |case..SH|AR_EOF.i|
|00001c00| 66 20 74 65 73 74 20 32 | 33 37 34 20 2d 6e 65 20 |f test 2|374 -ne |
|00001c10| 22 60 77 63 20 2d 63 20 | 3c 20 27 6f 62 6a 65 63 |"`wc -c |< 'objec|
|00001c20| 74 2e 6c 73 70 27 60 22 | 0a 74 68 65 6e 0a 09 65 |t.lsp'`"|.then..e|
|00001c30| 63 68 6f 20 73 68 61 72 | 3a 20 65 72 72 6f 72 20 |cho shar|: error |
|00001c40| 74 72 61 6e 73 6d 69 74 | 74 69 6e 67 20 22 27 6f |transmit|ting "'o|
|00001c50| 62 6a 65 63 74 2e 6c 73 | 70 27 22 20 27 28 73 68 |bject.ls|p'" '(sh|
|00001c60| 6f 75 6c 64 20 68 61 76 | 65 20 62 65 65 6e 20 32 |ould hav|e been 2|
|00001c70| 33 37 34 20 63 68 61 72 | 61 63 74 65 72 73 29 27 |374 char|acters)'|
|00001c80| 0a 66 69 0a 66 69 20 23 | 20 65 6e 64 20 6f 66 20 |.fi.fi #| end of |
|00001c90| 6f 76 65 72 77 72 69 74 | 69 6e 67 20 63 68 65 63 |overwrit|ing chec|
|00001ca0| 6b 0a 65 63 68 6f 20 73 | 68 61 72 3a 20 65 78 74 |k.echo s|har: ext|
|00001cb0| 72 61 63 74 69 6e 67 20 | 22 27 70 72 6f 6c 6f 67 |racting |"'prolog|
|00001cc0| 2e 6c 73 70 27 22 20 27 | 28 34 32 38 39 20 63 68 |.lsp'" '|(4289 ch|
|00001cd0| 61 72 61 63 74 65 72 73 | 29 27 0a 69 66 20 74 65 |aracters|)'.if te|
|00001ce0| 73 74 20 2d 66 20 27 70 | 72 6f 6c 6f 67 2e 6c 73 |st -f 'p|rolog.ls|
|00001cf0| 70 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |p'.then.|.echo sh|
|00001d00| 61 72 3a 20 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: will| not ove|
|00001d10| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|00001d20| 20 66 69 6c 65 20 22 27 | 70 72 6f 6c 6f 67 2e 6c | file "'|prolog.l|
|00001d30| 73 70 27 22 0a 65 6c 73 | 65 0a 73 65 64 20 27 73 |sp'".els|e.sed 's|
|00001d40| 2f 5e 58 2f 2f 27 20 3c | 3c 20 5c 53 48 41 52 5f |/^X//' <|< \SHAR_|
|00001d50| 45 4f 46 20 3e 20 27 70 | 72 6f 6c 6f 67 2e 6c 73 |EOF > 'p|rolog.ls|
|00001d60| 70 27 0a 0a 3b 3b 20 54 | 68 65 20 66 6f 6c 6c 6f |p'..;; T|he follo|
|00001d70| 77 69 6e 67 20 69 73 20 | 61 20 74 69 6e 79 20 50 |wing is |a tiny P|
|00001d80| 72 6f 6c 6f 67 20 69 6e | 74 65 72 70 72 65 74 65 |rolog in|terprete|
|00001d90| 72 20 69 6e 20 4d 61 63 | 4c 69 73 70 0a 3b 3b 20 |r in Mac|Lisp.;; |
|00001da0| 77 72 69 74 74 65 6e 20 | 62 79 20 4b 65 6e 20 4b |written |by Ken K|
|00001db0| 61 68 6e 20 61 6e 64 20 | 6d 6f 64 69 66 69 65 64 |ahn and |modified|
|00001dc0| 20 66 6f 72 20 58 4c 49 | 53 50 20 62 79 20 44 61 | for XLI|SP by Da|
|00001dd0| 76 69 64 20 42 65 74 7a | 2e 0a 3b 3b 20 49 74 20 |vid Betz|..;; It |
|00001de0| 77 61 73 20 69 6e 73 70 | 69 72 65 64 20 62 79 20 |was insp|ired by |
|00001df0| 6f 74 68 65 72 20 74 69 | 6e 79 20 4c 69 73 70 2d |other ti|ny Lisp-|
|00001e00| 62 61 73 65 64 20 50 72 | 6f 6c 6f 67 73 20 6f 66 |based Pr|ologs of|
|00001e10| 0a 3b 3b 20 50 61 72 20 | 45 6d 61 6e 75 65 6c 73 |.;; Par |Emanuels|
|00001e20| 6f 6e 20 61 6e 64 20 4d | 61 72 74 69 6e 20 4e 69 |on and M|artin Ni|
|00001e30| 6c 73 73 6f 6e 2e 0a 3b | 3b 20 54 68 65 72 65 20 |lsson..;|; There |
|00001e40| 61 72 65 20 6e 6f 20 73 | 69 64 65 2d 65 66 66 65 |are no s|ide-effe|
|00001e50| 63 74 73 20 61 6e 79 77 | 68 65 72 65 20 69 6e 20 |cts anyw|here in |
|00001e60| 74 68 65 20 69 6d 70 6c | 65 6d 65 6e 74 61 74 69 |the impl|ementati|
|00001e70| 6f 6e 2e 0a 3b 3b 20 54 | 68 6f 75 67 68 20 69 74 |on..;; T|hough it|
|00001e80| 20 69 73 20 56 45 52 59 | 20 73 6c 6f 77 20 6f 66 | is VERY| slow of|
|00001e90| 20 63 6f 75 72 73 65 2e | 0a 0a 28 64 65 66 75 6e | course.|..(defun|
|00001ea0| 20 70 72 6f 6c 6f 67 20 | 28 64 61 74 61 62 61 73 | prolog |(databas|
|00001eb0| 65 20 26 61 75 78 20 67 | 6f 61 6c 29 0a 20 20 20 |e &aux g|oal). |
|00001ec0| 20 20 20 20 28 64 6f 20 | 28 29 20 28 28 6e 6f 74 | (do |() ((not|
|00001ed0| 20 28 70 72 6f 67 6e 20 | 28 70 72 69 6e 63 20 22 | (progn |(princ "|
|00001ee0| 51 75 65 72 79 3f 22 29 | 20 28 73 65 74 71 20 67 |Query?")| (setq g|
|00001ef0| 6f 61 6c 20 28 72 65 61 | 64 29 29 29 29 29 0a 20 |oal (rea|d))))). |
|00001f00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 28 70 72 | | (pr|
|00001f10| 6f 76 65 20 28 6c 69 73 | 74 20 28 72 65 6e 61 6d |ove (lis|t (renam|
|00001f20| 65 2d 76 61 72 69 61 62 | 6c 65 73 20 67 6f 61 6c |e-variab|les goal|
|00001f30| 20 27 28 30 29 29 29 0a | 20 20 20 20 20 20 20 20 | '(0))).| |
|00001f40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 27 28 28 | | '((|
|00001f50| 62 6f 74 74 6f 6d 2d 6f | 66 2d 65 6e 76 69 72 6f |bottom-o|f-enviro|
|00001f60| 6e 6d 65 6e 74 29 29 0a | 20 20 20 20 20 20 20 20 |nment)).| |
|00001f70| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 64 61 74 | | dat|
|00001f80| 61 62 61 73 65 0a 20 20 | 20 20 20 20 20 20 20 20 |abase. | |
|00001f90| 20 20 20 20 20 20 20 20 | 20 20 20 31 29 29 29 0a | | 1))).|
|00001fa0| 0a 3b 3b 20 70 72 6f 76 | 65 20 2d 20 70 72 6f 76 |.;; prov|e - prov|
|00001fb0| 65 73 20 74 68 65 20 63 | 6f 6e 6a 75 6e 63 74 69 |es the c|onjuncti|
|00001fc0| 6f 6e 20 6f 66 20 74 68 | 65 20 6c 69 73 74 2d 6f |on of th|e list-o|
|00001fd0| 66 2d 67 6f 61 6c 73 0a | 3b 3b 20 20 20 20 20 20 |f-goals.|;; |
|00001fe0| 20 20 20 69 6e 20 74 68 | 65 20 63 75 72 72 65 6e | in th|e curren|
|00001ff0| 74 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 0a 0a 28 |t enviro|nment..(|
|00002000| 64 65 66 75 6e 20 70 72 | 6f 76 65 20 28 6c 69 73 |defun pr|ove (lis|
|00002010| 74 2d 6f 66 2d 67 6f 61 | 6c 73 20 65 6e 76 69 72 |t-of-goa|ls envir|
|00002020| 6f 6e 6d 65 6e 74 20 64 | 61 74 61 62 61 73 65 20 |onment d|atabase |
|00002030| 6c 65 76 65 6c 29 0a 20 | 20 20 20 20 20 28 63 6f |level). | (co|
|00002040| 6e 64 20 28 28 6e 75 6c | 6c 20 6c 69 73 74 2d 6f |nd ((nul|l list-o|
|00002050| 66 2d 67 6f 61 6c 73 29 | 20 3b 3b 20 73 75 63 63 |f-goals)| ;; succ|
|00002060| 65 65 64 65 64 20 73 69 | 6e 63 65 20 74 68 65 72 |eeded si|nce ther|
|00002070| 65 20 61 72 65 20 6e 6f | 20 67 6f 61 6c 73 0a 20 |e are no| goals. |
|00002080| 20 20 20 20 20 20 20 20 | 20 20 20 20 28 70 72 69 | | (pri|
|00002090| 6e 74 2d 62 69 6e 64 69 | 6e 67 73 20 65 6e 76 69 |nt-bindi|ngs envi|
|000020a0| 72 6f 6e 6d 65 6e 74 20 | 65 6e 76 69 72 6f 6e 6d |ronment |environm|
|000020b0| 65 6e 74 29 0a 20 20 20 | 20 20 20 20 20 20 20 20 |ent). | |
|000020c0| 20 20 28 6e 6f 74 20 28 | 79 2d 6f 72 2d 6e 2d 70 | (not (|y-or-n-p|
|000020d0| 20 22 4d 6f 72 65 3f 22 | 29 29 29 0a 20 20 20 20 | "More?"|))). |
|000020e0| 20 20 20 20 20 20 20 20 | 28 74 20 28 74 72 79 2d | |(t (try-|
|000020f0| 65 61 63 68 20 64 61 74 | 61 62 61 73 65 20 64 61 |each dat|abase da|
|00002100| 74 61 62 61 73 65 0a 20 | 20 20 20 20 20 20 20 20 |tabase. | |
|00002110| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002120| 28 63 64 72 20 6c 69 73 | 74 2d 6f 66 2d 67 6f 61 |(cdr lis|t-of-goa|
|00002130| 6c 73 29 20 28 63 61 72 | 20 6c 69 73 74 2d 6f 66 |ls) (car| list-of|
|00002140| 2d 67 6f 61 6c 73 29 0a | 20 20 20 20 20 20 20 20 |-goals).| |
|00002150| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002160| 20 65 6e 76 69 72 6f 6e | 6d 65 6e 74 20 6c 65 76 | environ|ment lev|
|00002170| 65 6c 29 29 29 29 0a 0a | 28 64 65 66 75 6e 20 74 |el))))..|(defun t|
|00002180| 72 79 2d 65 61 63 68 20 | 28 64 61 74 61 62 61 73 |ry-each |(databas|
|00002190| 65 2d 6c 65 66 74 20 64 | 61 74 61 62 61 73 65 20 |e-left d|atabase |
|000021a0| 67 6f 61 6c 73 2d 6c 65 | 66 74 20 67 6f 61 6c 20 |goals-le|ft goal |
|000021b0| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 20 6c 65 76 65 |environm|ent leve|
|000021c0| 6c 20 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |l . | |
|000021d0| 20 20 20 20 26 61 75 78 | 20 61 73 73 65 72 74 69 | &aux| asserti|
|000021e0| 6f 6e 20 6e 65 77 2d 65 | 6e 76 69 72 6f 6d 65 6e |on new-e|nviromen|
|000021f0| 74 29 0a 20 20 20 20 20 | 20 20 28 63 6f 6e 64 20 |t). | (cond |
|00002200| 28 28 6e 75 6c 6c 20 64 | 61 74 61 62 61 73 65 2d |((null d|atabase-|
|00002210| 6c 65 66 74 29 20 6e 69 | 6c 29 20 3b 3b 20 66 61 |left) ni|l) ;; fa|
|00002220| 69 6c 20 73 69 6e 63 65 | 20 6e 6f 74 68 69 6e 67 |il since| nothing|
|00002230| 20 6c 65 66 74 20 69 6e | 20 64 61 74 61 62 61 73 | left in| databas|
|00002240| 65 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 28 |e. | (|
|00002250| 74 20 28 73 65 74 71 20 | 61 73 73 65 72 74 69 6f |t (setq |assertio|
|00002260| 6e 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |n. | |
|00002270| 20 20 20 20 20 20 20 20 | 28 72 65 6e 61 6d 65 2d | |(rename-|
|00002280| 76 61 72 69 61 62 6c 65 | 73 20 28 63 61 72 20 64 |variable|s (car d|
|00002290| 61 74 61 62 61 73 65 2d | 6c 65 66 74 29 0a 20 20 |atabase-|left). |
|000022a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000022b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000022c0| 20 20 20 20 20 20 28 6c | 69 73 74 20 6c 65 76 65 | (l|ist leve|
|000022d0| 6c 29 29 29 0a 20 20 20 | 20 20 20 20 20 20 20 20 |l))). | |
|000022e0| 20 20 20 20 20 28 73 65 | 74 71 20 6e 65 77 2d 65 | (se|tq new-e|
|000022f0| 6e 76 69 72 6f 6e 6d 65 | 6e 74 0a 20 20 20 20 20 |nvironme|nt. |
|00002300| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002310| 20 28 75 6e 69 66 79 20 | 67 6f 61 6c 20 28 63 61 | (unify |goal (ca|
|00002320| 72 20 61 73 73 65 72 74 | 69 6f 6e 29 20 65 6e 76 |r assert|ion) env|
|00002330| 69 72 6f 6e 6d 65 6e 74 | 29 29 0a 20 20 20 20 20 |ironment|)). |
|00002340| 20 20 20 20 20 20 20 20 | 20 20 20 28 63 6f 6e 64 | | (cond|
|00002350| 20 28 28 6e 75 6c 6c 20 | 6e 65 77 2d 65 6e 76 69 | ((null |new-envi|
|00002360| 72 6f 6e 6d 65 6e 74 29 | 20 3b 3b 20 66 61 69 6c |ronment)| ;; fail|
|00002370| 65 64 20 74 6f 20 75 6e | 69 66 79 0a 20 20 20 20 |ed to un|ify. |
|00002380| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002390| 20 20 20 28 74 72 79 2d | 65 61 63 68 20 28 63 64 | (try-|each (cd|
|000023a0| 72 20 64 61 74 61 62 61 | 73 65 2d 6c 65 66 74 29 |r databa|se-left)|
|000023b0| 20 64 61 74 61 62 61 73 | 65 0a 20 20 20 20 20 20 | databas|e. |
|000023c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000023d0| 20 20 20 20 20 20 20 20 | 20 20 20 67 6f 61 6c 73 | | goals|
|000023e0| 2d 6c 65 66 74 20 67 6f | 61 6c 0a 20 20 20 20 20 |-left go|al. |
|000023f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002400| 20 20 20 20 20 20 20 20 | 20 20 20 20 65 6e 76 69 | | envi|
|00002410| 72 6f 6e 6d 65 6e 74 20 | 6c 65 76 65 6c 29 29 0a |ronment |level)).|
|00002420| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002430| 20 20 20 20 20 20 28 28 | 70 72 6f 76 65 20 28 61 | ((|prove (a|
|00002440| 70 70 65 6e 64 20 28 63 | 64 72 20 61 73 73 65 72 |ppend (c|dr asser|
|00002450| 74 69 6f 6e 29 20 67 6f | 61 6c 73 2d 6c 65 66 74 |tion) go|als-left|
|00002460| 29 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |). | |
|00002470| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002480| 6e 65 77 2d 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 0a |new-envi|ronment.|
|00002490| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000024a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 64 61 | | da|
|000024b0| 74 61 62 61 73 65 0a 20 | 20 20 20 20 20 20 20 20 |tabase. | |
|000024c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000024d0| 20 20 20 20 20 28 2b 20 | 31 20 6c 65 76 65 6c 29 | (+ |1 level)|
|000024e0| 29 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |)). | |
|000024f0| 20 20 20 20 20 20 20 20 | 20 28 74 20 28 74 72 79 | | (t (try|
|00002500| 2d 65 61 63 68 20 28 63 | 64 72 20 64 61 74 61 62 |-each (c|dr datab|
|00002510| 61 73 65 2d 6c 65 66 74 | 29 20 64 61 74 61 62 61 |ase-left|) databa|
|00002520| 73 65 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |se. | |
|00002530| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002540| 20 20 20 20 20 20 67 6f | 61 6c 73 2d 6c 65 66 74 | go|als-left|
|00002550| 20 67 6f 61 6c 0a 20 20 | 20 20 20 20 20 20 20 20 | goal. | |
|00002560| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002570| 20 20 20 20 20 20 20 20 | 20 65 6e 76 69 72 6f 6e | | environ|
|00002580| 6d 65 6e 74 20 6c 65 76 | 65 6c 29 29 29 29 29 29 |ment lev|el))))))|
|00002590| 0a 0a 28 64 65 66 75 6e | 20 75 6e 69 66 79 20 28 |..(defun| unify (|
|000025a0| 78 20 79 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 20 |x y envi|ronment |
|000025b0| 26 61 75 78 20 6e 65 77 | 2d 65 6e 76 69 72 6f 6e |&aux new|-environ|
|000025c0| 6d 65 6e 74 29 0a 20 20 | 20 20 20 20 20 28 73 65 |ment). | (se|
|000025d0| 74 71 20 78 20 28 76 61 | 6c 75 65 20 78 20 65 6e |tq x (va|lue x en|
|000025e0| 76 69 72 6f 6e 6d 65 6e | 74 29 29 0a 20 20 20 20 |vironmen|t)). |
|000025f0| 20 20 20 28 73 65 74 71 | 20 79 20 28 76 61 6c 75 | (setq| y (valu|
|00002600| 65 20 79 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 29 |e y envi|ronment)|
|00002610| 29 0a 20 20 20 20 20 20 | 20 28 63 6f 6e 64 20 28 |). | (cond (|
|00002620| 28 76 61 72 69 61 62 6c | 65 2d 70 20 78 29 20 28 |(variabl|e-p x) (|
|00002630| 63 6f 6e 73 20 28 6c 69 | 73 74 20 78 20 79 29 20 |cons (li|st x y) |
|00002640| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 29 29 0a 20 20 |environm|ent)). |
|00002650| 20 20 20 20 20 20 20 20 | 20 20 20 28 28 76 61 72 | | ((var|
|00002660| 69 61 62 6c 65 2d 70 20 | 79 29 20 28 63 6f 6e 73 |iable-p |y) (cons|
|00002670| 20 28 6c 69 73 74 20 79 | 20 78 29 20 65 6e 76 69 | (list y| x) envi|
|00002680| 72 6f 6e 6d 65 6e 74 29 | 29 0a 20 20 20 20 20 20 |ronment)|). |
|00002690| 20 20 20 20 20 20 20 28 | 28 6f 72 20 28 61 74 6f | (|(or (ato|
|000026a0| 6d 20 78 29 20 28 61 74 | 6f 6d 20 79 29 29 0a 20 |m x) (at|om y)). |
|000026b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000026c0| 20 28 63 6f 6e 64 20 28 | 28 65 71 75 61 6c 20 78 | (cond (|(equal x|
|000026d0| 20 79 29 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 29 | y) envi|ronment)|
|000026e0| 0a 20 20 20 20 09 20 20 | 20 20 20 20 20 20 20 20 |. . | |
|000026f0| 20 20 20 20 20 20 28 74 | 20 6e 69 6c 29 29 29 0a | (t| nil))).|
|00002700| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 28 74 20 | | (t |
|00002710| 28 73 65 74 71 20 6e 65 | 77 2d 65 6e 76 69 72 6f |(setq ne|w-enviro|
|00002720| 6e 6d 65 6e 74 20 28 75 | 6e 69 66 79 20 28 63 61 |nment (u|nify (ca|
|00002730| 72 20 78 29 20 28 63 61 | 72 20 79 29 20 65 6e 76 |r x) (ca|r y) env|
|00002740| 69 72 6f 6e 6d 65 6e 74 | 29 29 0a 20 20 20 20 20 |ironment|)). |
|00002750| 20 20 20 20 20 20 20 20 | 20 20 20 28 63 6f 6e 64 | | (cond|
|00002760| 20 28 6e 65 77 2d 65 6e | 76 69 72 6f 6e 6d 65 6e | (new-en|vironmen|
|00002770| 74 20 28 75 6e 69 66 79 | 20 28 63 64 72 20 78 29 |t (unify| (cdr x)|
|00002780| 20 28 63 64 72 20 79 29 | 20 6e 65 77 2d 65 6e 76 | (cdr y)| new-env|
|00002790| 69 72 6f 6e 6d 65 6e 74 | 29 29 0a 20 20 20 20 09 |ironment|)). .|
|000027a0| 09 20 20 20 20 20 20 28 | 74 20 6e 69 6c 29 29 29 |. (|t nil)))|
|000027b0| 29 29 0a 0a 28 64 65 66 | 75 6e 20 76 61 6c 75 65 |))..(def|un value|
|000027c0| 20 28 78 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 20 | (x envi|ronment |
|000027d0| 26 61 75 78 20 62 69 6e | 64 69 6e 67 29 0a 20 20 |&aux bin|ding). |
|000027e0| 20 20 20 20 20 28 63 6f | 6e 64 20 28 28 76 61 72 | (co|nd ((var|
|000027f0| 69 61 62 6c 65 2d 70 20 | 78 29 0a 20 20 20 20 20 |iable-p |x). |
|00002800| 20 20 20 20 20 20 20 20 | 20 28 73 65 74 71 20 62 | | (setq b|
|00002810| 69 6e 64 69 6e 67 20 28 | 61 73 73 6f 63 20 78 20 |inding (|assoc x |
|00002820| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 29 29 0a 20 20 |environm|ent)). |
|00002830| 20 20 20 20 20 20 20 20 | 20 20 20 20 28 63 6f 6e | | (con|
|00002840| 64 20 28 28 6e 75 6c 6c | 20 62 69 6e 64 69 6e 67 |d ((null| binding|
|00002850| 29 20 78 29 0a 20 20 20 | 20 20 20 20 20 20 20 20 |) x). | |
|00002860| 20 20 20 20 20 20 20 20 | 20 28 74 20 28 76 61 6c | | (t (val|
|00002870| 75 65 20 28 63 61 64 72 | 20 62 69 6e 64 69 6e 67 |ue (cadr| binding|
|00002880| 29 20 65 6e 76 69 72 6f | 6e 6d 65 6e 74 29 29 29 |) enviro|nment)))|
|00002890| 29 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 20 28 |). | (|
|000028a0| 74 20 78 29 29 29 0a 0a | 28 64 65 66 75 6e 20 76 |t x)))..|(defun v|
|000028b0| 61 72 69 61 62 6c 65 2d | 70 20 28 78 29 0a 20 20 |ariable-|p (x). |
|000028c0| 20 20 20 20 20 28 61 6e | 64 20 78 20 28 6c 69 73 | (an|d x (lis|
|000028d0| 74 70 20 78 29 20 28 65 | 71 20 28 63 61 72 20 78 |tp x) (e|q (car x|
|000028e0| 29 20 27 3f 29 29 29 0a | 0a 28 64 65 66 75 6e 20 |) '?))).|.(defun |
|000028f0| 72 65 6e 61 6d 65 2d 76 | 61 72 69 61 62 6c 65 73 |rename-v|ariables|
|00002900| 20 28 74 65 72 6d 20 6c | 69 73 74 2d 6f 66 2d 6c | (term l|ist-of-l|
|00002910| 65 76 65 6c 29 0a 20 20 | 20 20 20 20 20 28 63 6f |evel). | (co|
|00002920| 6e 64 20 28 28 76 61 72 | 69 61 62 6c 65 2d 70 20 |nd ((var|iable-p |
|00002930| 74 65 72 6d 29 20 28 61 | 70 70 65 6e 64 20 74 65 |term) (a|ppend te|
|00002940| 72 6d 20 6c 69 73 74 2d | 6f 66 2d 6c 65 76 65 6c |rm list-|of-level|
|00002950| 29 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |)). | |
|00002960| 28 28 61 74 6f 6d 20 74 | 65 72 6d 29 20 74 65 72 |((atom t|erm) ter|
|00002970| 6d 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |m). | |
|00002980| 28 74 20 28 63 6f 6e 73 | 20 28 72 65 6e 61 6d 65 |(t (cons| (rename|
|00002990| 2d 76 61 72 69 61 62 6c | 65 73 20 28 63 61 72 20 |-variabl|es (car |
|000029a0| 74 65 72 6d 29 20 6c 69 | 73 74 2d 6f 66 2d 6c 65 |term) li|st-of-le|
|000029b0| 76 65 6c 29 0a 20 20 20 | 20 20 20 20 20 20 20 20 |vel). | |
|000029c0| 20 20 20 20 20 20 20 20 | 20 20 20 28 72 65 6e 61 | | (rena|
|000029d0| 6d 65 2d 76 61 72 69 61 | 62 6c 65 73 20 28 63 64 |me-varia|bles (cd|
|000029e0| 72 20 74 65 72 6d 29 20 | 6c 69 73 74 2d 6f 66 2d |r term) |list-of-|
|000029f0| 6c 65 76 65 6c 29 29 29 | 29 29 0a 0a 28 64 65 66 |level)))|))..(def|
|00002a00| 75 6e 20 70 72 69 6e 74 | 2d 62 69 6e 64 69 6e 67 |un print|-binding|
|00002a10| 73 20 28 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 2d 6c |s (envir|onment-l|
|00002a20| 65 66 74 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 29 |eft envi|ronment)|
|00002a30| 0a 20 20 20 20 20 20 20 | 28 63 6f 6e 64 20 28 28 |. |(cond ((|
|00002a40| 63 64 72 20 65 6e 76 69 | 72 6f 6e 6d 65 6e 74 2d |cdr envi|ronment-|
|00002a50| 6c 65 66 74 29 0a 20 20 | 20 20 20 20 20 20 20 20 |left). | |
|00002a60| 20 20 20 20 28 63 6f 6e | 64 20 28 28 3d 20 30 20 | (con|d ((= 0 |
|00002a70| 28 6e 74 68 20 32 20 28 | 63 61 61 72 20 65 6e 76 |(nth 2 (|caar env|
|00002a80| 69 72 6f 6e 6d 65 6e 74 | 2d 6c 65 66 74 29 29 29 |ironment|-left)))|
|00002a90| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00002aa0| 20 20 20 20 20 20 28 70 | 72 69 6e 31 20 28 63 61 | (p|rin1 (ca|
|00002ab0| 64 72 20 28 63 61 61 72 | 20 65 6e 76 69 72 6f 6e |dr (caar| environ|
|00002ac0| 6d 65 6e 74 2d 6c 65 66 | 74 29 29 29 0a 20 20 20 |ment-lef|t))). |
|00002ad0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002ae0| 20 20 28 70 72 69 6e 63 | 20 22 20 3d 20 22 29 0a | (princ| " = ").|
|00002af0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002b00| 20 20 20 20 20 28 70 72 | 69 6e 74 20 28 76 61 6c | (pr|int (val|
|00002b10| 75 65 20 28 63 61 61 72 | 20 65 6e 76 69 72 6f 6e |ue (caar| environ|
|00002b20| 6d 65 6e 74 2d 6c 65 66 | 74 29 20 65 6e 76 69 72 |ment-lef|t) envir|
|00002b30| 6f 6e 6d 65 6e 74 29 29 | 29 29 0a 20 20 20 20 20 |onment))|)). |
|00002b40| 20 20 20 20 20 20 20 20 | 20 28 70 72 69 6e 74 2d | | (print-|
|00002b50| 62 69 6e 64 69 6e 67 73 | 20 28 63 64 72 20 65 6e |bindings| (cdr en|
|00002b60| 76 69 72 6f 6e 6d 65 6e | 74 2d 6c 65 66 74 29 20 |vironmen|t-left) |
|00002b70| 65 6e 76 69 72 6f 6e 6d | 65 6e 74 29 29 29 29 0a |environm|ent)))).|
|00002b80| 0a 3b 3b 20 61 20 73 61 | 6d 70 6c 65 20 64 61 74 |.;; a sa|mple dat|
|00002b90| 61 62 61 73 65 3a 0a 28 | 73 65 74 71 20 64 62 20 |abase:.(|setq db |
|00002ba0| 27 28 28 28 66 61 74 68 | 65 72 20 6d 61 64 65 6c |'(((fath|er madel|
|00002bb0| 79 6e 20 65 72 6e 65 73 | 74 29 29 0a 20 20 20 20 |yn ernes|t)). |
|00002bc0| 20 20 20 20 20 20 20 28 | 28 6d 6f 74 68 65 72 20 | (|(mother |
|00002bd0| 6d 61 64 65 6c 79 6e 20 | 76 69 72 67 69 6e 69 61 |madelyn |virginia|
|00002be0| 29 29 0a 09 20 20 20 28 | 28 66 61 74 68 65 72 20 |)).. (|(father |
|00002bf0| 64 61 76 69 64 20 61 72 | 6e 6f 6c 64 29 29 0a 09 |david ar|nold))..|
|00002c00| 20 20 20 28 28 6d 6f 74 | 68 65 72 20 64 61 76 69 | ((mot|her davi|
|00002c10| 64 20 70 61 75 6c 69 6e | 65 29 29 0a 09 20 20 20 |d paulin|e)).. |
|00002c20| 28 28 66 61 74 68 65 72 | 20 72 61 63 68 65 6c 20 |((father| rachel |
|00002c30| 64 61 76 69 64 29 29 0a | 09 20 20 20 28 28 6d 6f |david)).|. ((mo|
|00002c40| 74 68 65 72 20 72 61 63 | 68 65 6c 20 6d 61 64 65 |ther rac|hel made|
|00002c50| 6c 79 6e 29 29 0a 20 20 | 20 20 20 20 20 20 20 20 |lyn)). | |
|00002c60| 20 28 28 67 72 61 6e 64 | 70 61 72 65 6e 74 20 28 | ((grand|parent (|
|00002c70| 3f 20 67 72 61 6e 64 70 | 61 72 65 6e 74 29 20 28 |? grandp|arent) (|
|00002c80| 3f 20 67 72 61 6e 64 63 | 68 69 6c 64 29 29 0a 20 |? grandc|hild)). |
|00002c90| 20 20 20 20 20 20 20 20 | 20 20 20 28 70 61 72 65 | | (pare|
|00002ca0| 6e 74 20 28 3f 20 67 72 | 61 6e 64 70 61 72 65 6e |nt (? gr|andparen|
|00002cb0| 74 29 20 28 3f 20 70 61 | 72 65 6e 74 29 29 0a 20 |t) (? pa|rent)). |
|00002cc0| 20 20 20 20 20 20 20 20 | 20 20 20 28 70 61 72 65 | | (pare|
|00002cd0| 6e 74 20 28 3f 20 70 61 | 72 65 6e 74 29 20 28 3f |nt (? pa|rent) (?|
|00002ce0| 20 67 72 61 6e 64 63 68 | 69 6c 64 29 29 29 0a 20 | grandch|ild))). |
|00002cf0| 20 20 20 20 20 20 20 20 | 20 20 28 28 70 61 72 65 | | ((pare|
|00002d00| 6e 74 20 28 3f 20 70 61 | 72 65 6e 74 29 20 28 3f |nt (? pa|rent) (?|
|00002d10| 20 63 68 69 6c 64 29 29 | 0a 20 20 20 20 20 20 20 | child))|. |
|00002d20| 20 20 20 20 20 28 6d 6f | 74 68 65 72 20 28 3f 20 | (mo|ther (? |
|00002d30| 70 61 72 65 6e 74 29 20 | 28 3f 20 63 68 69 6c 64 |parent) |(? child|
|00002d40| 29 29 29 0a 20 20 20 20 | 20 20 20 20 20 20 20 28 |))). | (|
|00002d50| 28 70 61 72 65 6e 74 20 | 28 3f 20 70 61 72 65 6e |(parent |(? paren|
|00002d60| 74 29 20 28 3f 20 63 68 | 69 6c 64 29 29 0a 20 20 |t) (? ch|ild)). |
|00002d70| 20 20 20 20 20 20 20 20 | 20 20 28 66 61 74 68 65 | | (fathe|
|00002d80| 72 20 28 3f 20 70 61 72 | 65 6e 74 29 20 28 3f 20 |r (? par|ent) (? |
|00002d90| 63 68 69 6c 64 29 29 29 | 29 29 0a 0a 3b 3b 20 74 |child)))|))..;; t|
|00002da0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 61 72 65 |he follo|wing are|
|00002db0| 20 75 74 69 6c 69 74 69 | 65 73 0a 28 64 65 66 75 | utiliti|es.(defu|
|00002dc0| 6e 20 79 2d 6f 72 2d 6e | 2d 70 20 28 70 72 6f 6d |n y-or-n|-p (prom|
|00002dd0| 70 74 29 0a 20 20 20 20 | 20 20 20 28 70 72 69 6e |pt). | (prin|
|00002de0| 63 20 70 72 6f 6d 70 74 | 29 0a 20 20 20 20 20 20 |c prompt|). |
|00002df0| 20 28 65 71 20 28 72 65 | 61 64 29 20 27 79 29 29 | (eq (re|ad) 'y))|
|00002e00| 0a 0a 3b 3b 20 73 74 61 | 72 74 20 74 68 69 6e 67 |..;; sta|rt thing|
|00002e10| 73 20 67 6f 69 6e 67 0a | 28 70 72 6f 6c 6f 67 20 |s going.|(prolog |
|00002e20| 64 62 29 0a 53 48 41 52 | 5f 45 4f 46 0a 69 66 20 |db).SHAR|_EOF.if |
|00002e30| 74 65 73 74 20 34 32 38 | 39 20 2d 6e 65 20 22 60 |test 428|9 -ne "`|
|00002e40| 77 63 20 2d 63 20 3c 20 | 27 70 72 6f 6c 6f 67 2e |wc -c < |'prolog.|
|00002e50| 6c 73 70 27 60 22 0a 74 | 68 65 6e 0a 09 65 63 68 |lsp'`".t|hen..ech|
|00002e60| 6f 20 73 68 61 72 3a 20 | 65 72 72 6f 72 20 74 72 |o shar: |error tr|
|00002e70| 61 6e 73 6d 69 74 74 69 | 6e 67 20 22 27 70 72 6f |ansmitti|ng "'pro|
|00002e80| 6c 6f 67 2e 6c 73 70 27 | 22 20 27 28 73 68 6f 75 |log.lsp'|" '(shou|
|00002e90| 6c 64 20 68 61 76 65 20 | 62 65 65 6e 20 34 32 38 |ld have |been 428|
|00002ea0| 39 20 63 68 61 72 61 63 | 74 65 72 73 29 27 0a 66 |9 charac|ters)'.f|
|00002eb0| 69 0a 66 69 20 23 20 65 | 6e 64 20 6f 66 20 6f 76 |i.fi # e|nd of ov|
|00002ec0| 65 72 77 72 69 74 69 6e | 67 20 63 68 65 63 6b 0a |erwritin|g check.|
|00002ed0| 65 63 68 6f 20 73 68 61 | 72 3a 20 65 78 74 72 61 |echo sha|r: extra|
|00002ee0| 63 74 69 6e 67 20 22 27 | 74 72 61 63 65 2e 6c 73 |cting "'|trace.ls|
|00002ef0| 70 27 22 20 27 28 36 34 | 32 20 63 68 61 72 61 63 |p'" '(64|2 charac|
|00002f00| 74 65 72 73 29 27 0a 69 | 66 20 74 65 73 74 20 2d |ters)'.i|f test -|
|00002f10| 66 20 27 74 72 61 63 65 | 2e 6c 73 70 27 0a 74 68 |f 'trace|.lsp'.th|
|00002f20| 65 6e 0a 09 65 63 68 6f | 20 73 68 61 72 3a 20 77 |en..echo| shar: w|
|00002f30| 69 6c 6c 20 6e 6f 74 20 | 6f 76 65 72 2d 77 72 69 |ill not |over-wri|
|00002f40| 74 65 20 65 78 69 73 74 | 69 6e 67 20 66 69 6c 65 |te exist|ing file|
|00002f50| 20 22 27 74 72 61 63 65 | 2e 6c 73 70 27 22 0a 65 | "'trace|.lsp'".e|
|00002f60| 6c 73 65 0a 73 65 64 20 | 27 73 2f 5e 58 2f 2f 27 |lse.sed |'s/^X//'|
|00002f70| 20 3c 3c 20 5c 53 48 41 | 52 5f 45 4f 46 20 3e 20 | << \SHA|R_EOF > |
|00002f80| 27 74 72 61 63 65 2e 6c | 73 70 27 0a 28 73 65 74 |'trace.l|sp'.(set|
|00002f90| 71 20 2a 74 72 61 63 65 | 6c 69 73 74 2a 20 6e 69 |q *trace|list* ni|
|00002fa0| 6c 29 0a 0a 28 64 65 66 | 75 6e 20 65 76 61 6c 68 |l)..(def|un evalh|
|00002fb0| 6f 6f 6b 66 63 6e 20 28 | 65 78 70 72 20 26 61 75 |ookfcn (|expr &au|
|00002fc0| 78 20 76 61 6c 29 0a 20 | 20 20 20 20 20 20 28 69 |x val). | (i|
|00002fd0| 66 20 28 61 6e 64 20 28 | 63 6f 6e 73 70 20 65 78 |f (and (|consp ex|
|00002fe0| 70 72 29 20 28 6d 65 6d | 62 65 72 20 28 63 61 72 |pr) (mem|ber (car|
|00002ff0| 20 65 78 70 72 29 20 2a | 74 72 61 63 65 6c 69 73 | expr) *|tracelis|
|00003000| 74 2a 29 29 0a 20 20 20 | 20 20 20 20 20 20 20 20 |t*)). | |
|00003010| 28 70 72 6f 67 6e 20 28 | 70 72 69 6e 63 20 22 3e |(progn (|princ ">|
|00003020| 3e 3e 20 22 29 20 28 70 | 72 69 6e 74 20 65 78 70 |>> ") (p|rint exp|
|00003030| 72 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |r). | |
|00003040| 20 20 20 20 20 28 73 65 | 74 71 20 76 61 6c 20 28 | (se|tq val (|
|00003050| 65 76 61 6c 68 6f 6f 6b | 20 65 78 70 72 20 65 76 |evalhook| expr ev|
|00003060| 61 6c 68 6f 6f 6b 66 63 | 6e 20 6e 69 6c 29 29 0a |alhookfc|n nil)).|
|00003070| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003080| 20 20 28 70 72 69 6e 63 | 20 22 3c 3c 3c 20 22 29 | (princ| "<<< ")|
|00003090| 20 28 70 72 69 6e 74 20 | 76 61 6c 29 29 0a 20 20 | (print |val)). |
|000030a0| 20 20 20 20 20 20 20 20 | 20 28 65 76 61 6c 68 6f | | (evalho|
|000030b0| 6f 6b 20 65 78 70 72 20 | 65 76 61 6c 68 6f 6f 6b |ok expr |evalhook|
|000030c0| 66 63 6e 20 6e 69 6c 29 | 29 29 0a 0a 28 64 65 66 |fcn nil)|))..(def|
|000030d0| 75 6e 20 74 72 61 63 65 | 20 28 66 75 6e 29 0a 20 |un trace| (fun). |
|000030e0| 20 20 20 20 20 20 28 69 | 66 20 28 6e 6f 74 20 28 | (i|f (not (|
|000030f0| 6d 65 6d 62 65 72 20 66 | 75 6e 20 2a 74 72 61 63 |member f|un *trac|
|00003100| 65 6c 69 73 74 2a 29 29 | 0a 09 20 20 20 28 70 72 |elist*))|.. (pr|
|00003110| 6f 67 6e 20 28 73 65 74 | 71 20 2a 74 72 61 63 65 |ogn (set|q *trace|
|00003120| 6c 69 73 74 2a 20 28 63 | 6f 6e 73 20 66 75 6e 20 |list* (c|ons fun |
|00003130| 2a 74 72 61 63 65 6c 69 | 73 74 2a 29 29 0a 20 20 |*traceli|st*)). |
|00003140| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003150| 28 73 65 74 71 20 2a 65 | 76 61 6c 68 6f 6f 6b 2a |(setq *e|valhook*|
|00003160| 20 65 76 61 6c 68 6f 6f | 6b 66 63 6e 29 29 29 0a | evalhoo|kfcn))).|
|00003170| 20 20 20 20 20 20 20 2a | 74 72 61 63 65 6c 69 73 | *|tracelis|
|00003180| 74 2a 29 0a 0a 28 64 65 | 66 75 6e 20 75 6e 74 72 |t*)..(de|fun untr|
|00003190| 61 63 65 20 28 66 75 6e | 29 0a 20 20 20 20 20 20 |ace (fun|). |
|000031a0| 20 28 69 66 20 28 6e 75 | 6c 6c 20 28 73 65 74 71 | (if (nu|ll (setq|
|000031b0| 20 2a 74 72 61 63 65 6c | 69 73 74 2a 20 28 64 65 | *tracel|ist* (de|
|000031c0| 6c 65 74 65 20 66 75 6e | 20 2a 74 72 61 63 65 6c |lete fun| *tracel|
|000031d0| 69 73 74 2a 29 29 29 0a | 20 20 20 20 20 20 20 20 |ist*))).| |
|000031e0| 20 20 20 28 73 65 74 71 | 20 2a 65 76 61 6c 68 6f | (setq| *evalho|
|000031f0| 6f 6b 2a 20 6e 69 6c 29 | 29 0a 20 20 20 20 20 20 |ok* nil)|). |
|00003200| 20 2a 74 72 61 63 65 6c | 69 73 74 2a 29 0a 53 48 | *tracel|ist*).SH|
|00003210| 41 52 5f 45 4f 46 0a 69 | 66 20 74 65 73 74 20 36 |AR_EOF.i|f test 6|
|00003220| 34 32 20 2d 6e 65 20 22 | 60 77 63 20 2d 63 20 3c |42 -ne "|`wc -c <|
|00003230| 20 27 74 72 61 63 65 2e | 6c 73 70 27 60 22 0a 74 | 'trace.|lsp'`".t|
|00003240| 68 65 6e 0a 09 65 63 68 | 6f 20 73 68 61 72 3a 20 |hen..ech|o shar: |
|00003250| 65 72 72 6f 72 20 74 72 | 61 6e 73 6d 69 74 74 69 |error tr|ansmitti|
|00003260| 6e 67 20 22 27 74 72 61 | 63 65 2e 6c 73 70 27 22 |ng "'tra|ce.lsp'"|
|00003270| 20 27 28 73 68 6f 75 6c | 64 20 68 61 76 65 20 62 | '(shoul|d have b|
|00003280| 65 65 6e 20 36 34 32 20 | 63 68 61 72 61 63 74 65 |een 642 |characte|
|00003290| 72 73 29 27 0a 66 69 0a | 66 69 20 23 20 65 6e 64 |rs)'.fi.|fi # end|
|000032a0| 20 6f 66 20 6f 76 65 72 | 77 72 69 74 69 6e 67 20 | of over|writing |
|000032b0| 63 68 65 63 6b 0a 65 63 | 68 6f 20 73 68 61 72 3a |check.ec|ho shar:|
|000032c0| 20 65 78 74 72 61 63 74 | 69 6e 67 20 22 27 78 6c | extract|ing "'xl|
|000032d0| 62 69 6e 64 2e 63 27 22 | 20 27 28 31 35 30 39 20 |bind.c'"| '(1509 |
|000032e0| 63 68 61 72 61 63 74 65 | 72 73 29 27 0a 69 66 20 |characte|rs)'.if |
|000032f0| 74 65 73 74 20 2d 66 20 | 27 78 6c 62 69 6e 64 2e |test -f |'xlbind.|
|00003300| 63 27 0a 74 68 65 6e 0a | 09 65 63 68 6f 20 73 68 |c'.then.|.echo sh|
|00003310| 61 72 3a 20 77 69 6c 6c | 20 6e 6f 74 20 6f 76 65 |ar: will| not ove|
|00003320| 72 2d 77 72 69 74 65 20 | 65 78 69 73 74 69 6e 67 |r-write |existing|
|00003330| 20 66 69 6c 65 20 22 27 | 78 6c 62 69 6e 64 2e 63 | file "'|xlbind.c|
|00003340| 27 22 0a 65 6c 73 65 0a | 73 65 64 20 27 73 2f 5e |'".else.|sed 's/^|
|00003350| 58 2f 2f 27 20 3c 3c 20 | 5c 53 48 41 52 5f 45 4f |X//' << |\SHAR_EO|
|00003360| 46 20 3e 20 27 78 6c 62 | 69 6e 64 2e 63 27 0a 2f |F > 'xlb|ind.c'./|
|00003370| 2a 20 78 6c 62 69 6e 64 | 20 2d 20 78 6c 69 73 70 |* xlbind| - xlisp|
|00003380| 20 73 79 6d 62 6f 6c 20 | 62 69 6e 64 69 6e 67 20 | symbol |binding |
|00003390| 72 6f 75 74 69 6e 65 73 | 20 2a 2f 0a 0a 23 69 6e |routines| */..#in|
|000033a0| 63 6c 75 64 65 20 22 78 | 6c 69 73 70 2e 68 22 0a |clude "x|lisp.h".|
|000033b0| 0a 2f 2a 20 65 78 74 65 | 72 6e 61 6c 20 76 61 72 |./* exte|rnal var|
|000033c0| 69 61 62 6c 65 73 20 2a | 2f 0a 65 78 74 65 72 6e |iables *|/.extern|
|000033d0| 20 4e 4f 44 45 20 2a 78 | 6c 65 6e 76 2c 2a 78 6c | NODE *x|lenv,*xl|
|000033e0| 6e 65 77 65 6e 76 3b 0a | 0a 2f 2a 20 78 6c 73 62 |newenv;.|./* xlsb|
|000033f0| 69 6e 64 20 2d 20 62 69 | 6e 64 20 61 20 76 61 6c |ind - bi|nd a val|
|00003400| 75 65 20 74 6f 20 61 20 | 73 79 6d 62 6f 6c 20 73 |ue to a |symbol s|
|00003410| 65 71 75 65 6e 74 69 61 | 6c 6c 79 20 2a 2f 0a 78 |equentia|lly */.x|
|00003420| 6c 73 62 69 6e 64 28 73 | 79 6d 2c 76 61 6c 29 0a |lsbind(s|ym,val).|
|00003430| 20 20 4e 4f 44 45 20 2a | 73 79 6d 2c 2a 76 61 6c | NODE *|sym,*val|
|00003440| 3b 0a 7b 0a 20 20 20 20 | 4e 4f 44 45 20 2a 70 74 |;.{. |NODE *pt|
|00003450| 72 3b 0a 0a 20 20 20 20 | 2f 2a 20 63 72 65 61 74 |r;.. |/* creat|
|00003460| 65 20 61 20 6e 65 77 20 | 65 6e 76 69 72 6f 6e 6d |e a new |environm|
|00003470| 65 6e 74 20 6c 69 73 74 | 20 65 6e 74 72 79 20 2a |ent list| entry *|
|00003480| 2f 0a 20 20 20 20 70 74 | 72 20 3d 20 6e 65 77 6e |/. pt|r = newn|
|00003490| 6f 64 65 28 4c 49 53 54 | 29 3b 0a 20 20 20 20 72 |ode(LIST|);. r|
|000034a0| 70 6c 61 63 64 28 70 74 | 72 2c 78 6c 65 6e 76 29 |placd(pt|r,xlenv)|
|000034b0| 3b 0a 20 20 20 20 78 6c | 65 6e 76 20 3d 20 70 74 |;. xl|env = pt|
|000034c0| 72 3b 0a 0a 20 20 20 20 | 2f 2a 20 63 72 65 61 74 |r;.. |/* creat|
|000034d0| 65 20 61 20 6e 65 77 20 | 76 61 72 69 61 62 6c 65 |e a new |variable|
|000034e0| 20 62 69 6e 64 69 6e 67 | 20 2a 2f 0a 20 20 20 20 | binding| */. |
|000034f0| 72 70 6c 61 63 61 28 70 | 74 72 2c 6e 65 77 6e 6f |rplaca(p|tr,newno|
|00003500| 64 65 28 4c 49 53 54 29 | 29 3b 0a 20 20 20 20 72 |de(LIST)|);. r|
|00003510| 70 6c 61 63 61 28 63 61 | 72 28 70 74 72 29 2c 73 |placa(ca|r(ptr),s|
|00003520| 79 6d 29 3b 0a 20 20 20 | 20 72 70 6c 61 63 64 28 |ym);. | rplacd(|
|00003530| 63 61 72 28 70 74 72 29 | 2c 73 79 6d 2d 3e 6e 5f |car(ptr)|,sym->n_|
|00003540| 73 79 6d 76 61 6c 75 65 | 29 3b 0a 20 20 20 20 73 |symvalue|);. s|
|00003550| 79 6d 2d 3e 6e 5f 73 79 | 6d 76 61 6c 75 65 20 3d |ym->n_sy|mvalue =|
|00003560| 20 76 61 6c 3b 0a 7d 0a | 0a 2f 2a 20 78 6c 62 69 | val;.}.|./* xlbi|
|00003570| 6e 64 20 2d 20 62 69 6e | 64 20 61 20 76 61 6c 75 |nd - bin|d a valu|
|00003580| 65 20 74 6f 20 61 20 73 | 79 6d 62 6f 6c 20 69 6e |e to a s|ymbol in|
|00003590| 20 70 61 72 61 6c 6c 65 | 6c 20 2a 2f 0a 78 6c 62 | paralle|l */.xlb|
|000035a0| 69 6e 64 28 73 79 6d 2c | 76 61 6c 29 0a 20 20 4e |ind(sym,|val). N|
|000035b0| 4f 44 45 20 2a 73 79 6d | 2c 2a 76 61 6c 3b 0a 7b |ODE *sym|,*val;.{|
|000035c0| 0a 20 20 20 20 4e 4f 44 | 45 20 2a 70 74 72 3b 0a |. NOD|E *ptr;.|
|000035d0| 0a 20 20 20 20 2f 2a 20 | 63 72 65 61 74 65 20 61 |. /* |create a|
|000035e0| 20 6e 65 77 20 65 6e 76 | 69 72 6f 6e 6d 65 6e 74 | new env|ironment|
|000035f0| 20 6c 69 73 74 20 65 6e | 74 72 79 20 2a 2f 0a 20 | list en|try */. |
|00003600| 20 20 20 70 74 72 20 3d | 20 6e 65 77 6e 6f 64 65 | ptr =| newnode|
|00003610| 28 4c 49 53 54 29 3b 0a | 20 20 20 20 72 70 6c 61 |(LIST);.| rpla|
|00003620| 63 64 28 70 74 72 2c 78 | 6c 6e 65 77 65 6e 76 29 |cd(ptr,x|lnewenv)|
|00003630| 3b 0a 20 20 20 20 78 6c | 6e 65 77 65 6e 76 20 3d |;. xl|newenv =|
|00003640| 20 70 74 72 3b 0a 0a 20 | 20 20 20 2f 2a 20 63 72 | ptr;.. | /* cr|
|00003650| 65 61 74 65 20 61 20 6e | 65 77 20 76 61 72 69 61 |eate a n|ew varia|
|00003660| 62 6c 65 20 62 69 6e 64 | 69 6e 67 20 2a 2f 0a 20 |ble bind|ing */. |
|00003670| 20 20 20 72 70 6c 61 63 | 61 28 70 74 72 2c 6e 65 | rplac|a(ptr,ne|
|00003680| 77 6e 6f 64 65 28 4c 49 | 53 54 29 29 3b 0a 20 20 |wnode(LI|ST));. |
|00003690| 20 20 72 70 6c 61 63 61 | 28 63 61 72 28 70 74 72 | rplaca|(car(ptr|
|000036a0| 29 2c 73 79 6d 29 3b 0a | 20 20 20 20 72 70 6c 61 |),sym);.| rpla|
|000036b0| 63 64 28 63 61 72 28 70 | 74 72 29 2c 76 61 6c 29 |cd(car(p|tr),val)|
|000036c0| 3b 0a 7d 0a 0a 2f 2a 20 | 78 6c 66 69 78 62 69 6e |;.}../* |xlfixbin|
|000036d0| 64 69 6e 67 73 20 2d 20 | 6d 61 6b 65 20 61 20 6e |dings - |make a n|
|000036e0| 65 77 20 73 65 74 20 6f | 66 20 62 69 6e 64 69 6e |ew set o|f bindin|
|000036f0| 67 73 20 76 69 73 69 62 | 6c 65 20 2a 2f 0a 78 6c |gs visib|le */.xl|
|00003700| 66 69 78 62 69 6e 64 69 | 6e 67 73 28 29 0a 7b 0a |fixbindi|ngs().{.|
|00003710| 20 20 20 20 4e 4f 44 45 | 20 2a 65 70 74 72 2c 2a | NODE| *eptr,*|
|00003720| 62 6e 64 2c 2a 73 79 6d | 2c 2a 6f 6c 64 76 61 6c |bnd,*sym|,*oldval|
|00003730| 75 65 3b 0a 0a 20 20 20 | 20 2f 2a 20 66 69 78 20 |ue;.. | /* fix |
|00003740| 74 68 65 20 62 6f 75 6e | 64 20 76 61 6c 75 65 20 |the boun|d value |
|00003750| 6f 66 20 65 61 63 68 20 | 73 79 6d 62 6f 6c 20 69 |of each |symbol i|
|00003760| 6e 20 74 68 65 20 65 6e | 76 69 72 6f 6e 6d 65 6e |n the en|vironmen|
|00003770| 74 20 63 68 61 69 6e 20 | 2a 2f 0a 20 20 20 20 66 |t chain |*/. f|
|00003780| 6f 72 20 28 65 70 74 72 | 20 3d 20 78 6c 6e 65 77 |or (eptr| = xlnew|
|00003790| 65 6e 76 3b 20 65 70 74 | 72 20 21 3d 20 78 6c 65 |env; ept|r != xle|
|000037a0| 6e 76 3b 20 65 70 74 72 | 20 3d 20 63 64 72 28 65 |nv; eptr| = cdr(e|
|000037b0| 70 74 72 29 29 20 7b 0a | 09 62 6e 64 20 3d 20 63 |ptr)) {.|.bnd = c|
|000037c0| 61 72 28 65 70 74 72 29 | 3b 0a 09 73 79 6d 20 3d |ar(eptr)|;..sym =|
|000037d0| 20 63 61 72 28 62 6e 64 | 29 3b 0a 09 6f 6c 64 76 | car(bnd|);..oldv|
|000037e0| 61 6c 75 65 20 3d 20 73 | 79 6d 2d 3e 6e 5f 73 79 |alue = s|ym->n_sy|
|000037f0| 6d 76 61 6c 75 65 3b 0a | 09 73 79 6d 2d 3e 6e 5f |mvalue;.|.sym->n_|
|00003800| 73 79 6d 76 61 6c 75 65 | 20 3d 20 63 64 72 28 62 |symvalue| = cdr(b|
|00003810| 6e 64 29 3b 0a 09 72 70 | 6c 61 63 64 28 62 6e 64 |nd);..rp|lacd(bnd|
|00003820| 2c 6f 6c 64 76 61 6c 75 | 65 29 3b 0a 20 20 20 20 |,oldvalu|e);. |
|00003830| 7d 0a 20 20 20 20 78 6c | 65 6e 76 20 3d 20 78 6c |}. xl|env = xl|
|00003840| 6e 65 77 65 6e 76 3b 0a | 7d 0a 0a 2f 2a 20 78 6c |newenv;.|}../* xl|
|00003850| 75 6e 62 69 6e 64 20 2d | 20 75 6e 62 69 6e 64 20 |unbind -| unbind |
|00003860| 73 79 6d 62 6f 6c 73 20 | 62 6f 75 6e 64 20 69 6e |symbols |bound in|
|00003870| 20 74 68 69 73 20 65 6e | 76 69 72 6f 6e 6d 65 6e | this en|vironmen|
|00003880| 74 20 2a 2f 0a 78 6c 75 | 6e 62 69 6e 64 28 65 6e |t */.xlu|nbind(en|
|00003890| 76 29 0a 20 20 4e 4f 44 | 45 20 2a 65 6e 76 3b 0a |v). NOD|E *env;.|
|000038a0| 7b 0a 20 20 20 20 4e 4f | 44 45 20 2a 62 6e 64 3b |{. NO|DE *bnd;|
|000038b0| 0a 0a 20 20 20 20 2f 2a | 20 75 6e 62 69 6e 64 20 |.. /*| unbind |
|000038c0| 65 61 63 68 20 73 79 6d | 62 6f 6c 20 69 6e 20 74 |each sym|bol in t|
|000038d0| 68 65 20 65 6e 76 69 72 | 6f 6e 6d 65 6e 74 20 63 |he envir|onment c|
|000038e0| 68 61 69 6e 20 2a 2f 0a | 20 20 20 20 66 6f 72 20 |hain */.| for |
|000038f0| 28 3b 20 78 6c 65 6e 76 | 20 21 3d 20 65 6e 76 3b |(; xlenv| != env;|
|00003900| 20 78 6c 65 6e 76 20 3d | 20 63 64 72 28 78 6c 65 | xlenv =| cdr(xle|
|00003910| 6e 76 29 29 0a 09 69 66 | 20 28 62 6e 64 20 3d 20 |nv))..if| (bnd = |
|00003920| 63 61 72 28 78 6c 65 6e | 76 29 29 0a 09 20 20 20 |car(xlen|v)).. |
|00003930| 20 63 61 72 28 62 6e 64 | 29 2d 3e 6e 5f 73 79 6d | car(bnd|)->n_sym|
|00003940| 76 61 6c 75 65 20 3d 20 | 63 64 72 28 62 6e 64 29 |value = |cdr(bnd)|
|00003950| 3b 0a 7d 0a 53 48 41 52 | 5f 45 4f 46 0a 69 66 20 |;.}.SHAR|_EOF.if |
|00003960| 74 65 73 74 20 31 35 30 | 39 20 2d 6e 65 20 22 60 |test 150|9 -ne "`|
|00003970| 77 63 20 2d 63 20 3c 20 | 27 78 6c 62 69 6e 64 2e |wc -c < |'xlbind.|
|00003980| 63 27 60 22 0a 74 68 65 | 6e 0a 09 65 63 68 6f 20 |c'`".the|n..echo |
|00003990| 73 68 61 72 3a 20 65 72 | 72 6f 72 20 74 72 61 6e |shar: er|ror tran|
|000039a0| 73 6d 69 74 74 69 6e 67 | 20 22 27 78 6c 62 69 6e |smitting| "'xlbin|
|000039b0| 64 2e 63 27 22 20 27 28 | 73 68 6f 75 6c 64 20 68 |d.c'" '(|should h|
|000039c0| 61 76 65 20 62 65 65 6e | 20 31 35 30 39 20 63 68 |ave been| 1509 ch|
|000039d0| 61 72 61 63 74 65 72 73 | 29 27 0a 66 69 0a 66 69 |aracters|)'.fi.fi|
|000039e0| 20 23 20 65 6e 64 20 6f | 66 20 6f 76 65 72 77 72 | # end o|f overwr|
|000039f0| 69 74 69 6e 67 20 63 68 | 65 63 6b 0a 65 63 68 6f |iting ch|eck.echo|
|00003a00| 20 73 68 61 72 3a 20 65 | 78 74 72 61 63 74 69 6e | shar: e|xtractin|
|00003a10| 67 20 22 27 78 6c 64 62 | 75 67 2e 63 27 22 20 27 |g "'xldb|ug.c'" '|
|00003a20| 28 33 39 32 34 20 63 68 | 61 72 61 63 74 65 72 73 |(3924 ch|aracters|
|00003a30| 29 27 0a 69 66 20 74 65 | 73 74 20 2d 66 20 27 78 |)'.if te|st -f 'x|
|00003a40| 6c 64 62 75 67 2e 63 27 | 0a 74 68 65 6e 0a 09 65 |ldbug.c'|.then..e|
|00003a50| 63 68 6f 20 73 68 61 72 | 3a 20 77 69 6c 6c 20 6e |cho shar|: will n|
|00003a60| 6f 74 20 6f 76 65 72 2d | 77 72 69 74 65 20 65 78 |ot over-|write ex|
|00003a70| 69 73 74 69 6e 67 20 66 | 69 6c 65 20 22 27 78 6c |isting f|ile "'xl|
|00003a80| 64 62 75 67 2e 63 27 22 | 0a 65 6c 73 65 0a 73 65 |dbug.c'"|.else.se|
|00003a90| 64 20 27 73 2f 5e 58 2f | 2f 27 20 3c 3c 20 5c 53 |d 's/^X/|/' << \S|
|00003aa0| 48 41 52 5f 45 4f 46 20 | 3e 20 27 78 6c 64 62 75 |HAR_EOF |> 'xldbu|
|00003ab0| 67 2e 63 27 0a 2f 2a 20 | 78 6c 64 65 62 75 67 20 |g.c'./* |xldebug |
|00003ac0| 2d 20 78 6c 69 73 70 20 | 64 65 62 75 67 67 69 6e |- xlisp |debuggin|
|00003ad0| 67 20 73 75 70 70 6f 72 | 74 20 2a 2f 0a 0a 23 69 |g suppor|t */..#i|
|00003ae0| 6e 63 6c 75 64 65 20 22 | 78 6c 69 73 70 2e 68 22 |nclude "|xlisp.h"|
|00003af0| 0a 0a 2f 2a 20 65 78 74 | 65 72 6e 61 6c 20 76 61 |../* ext|ernal va|
|00003b00| 72 69 61 62 6c 65 73 20 | 2a 2f 0a 65 78 74 65 72 |riables |*/.exter|
|00003b10| 6e 20 6c 6f 6e 67 20 74 | 6f 74 61 6c 3b 0a 65 78 |n long t|otal;.ex|
|00003b20| 74 65 72 6e 20 69 6e 74 | 20 78 6c 64 65 62 75 67 |tern int| xldebug|
|00003b30| 3b 0a 65 78 74 65 72 6e | 20 69 6e 74 20 78 6c 74 |;.extern| int xlt|
|00003b40| 72 61 63 65 3b 0a 65 78 | 74 65 72 6e 20 4e 4f 44 |race;.ex|tern NOD|
|00003b50| 45 20 2a 73 5f 75 6e 62 | 6f 75 6e 64 3b 0a 65 78 |E *s_unb|ound;.ex|
|00003b60| 74 65 72 6e 20 4e 4f 44 | 45 20 2a 73 5f 73 74 64 |tern NOD|E *s_std|
|00003b70| 69 6e 2c 2a 73 5f 73 74 | 64 6f 75 74 3b 0a 65 78 |in,*s_st|dout;.ex|
|00003b80| 74 65 72 6e 20 4e 4f 44 | 45 20 2a 73 5f 74 72 61 |tern NOD|E *s_tra|
|00003b90| 63 65 6e 61 62 6c 65 2c | 2a 73 5f 74 6c 69 6d 69 |cenable,|*s_tlimi|
|00003ba0| 74 2c 2a 73 5f 62 72 65 | 61 6b 65 6e 61 62 6c 65 |t,*s_bre|akenable|
|00003bb0| 3b 0a 65 78 74 65 72 6e | 20 4e 4f 44 45 20 2a 73 |;.extern| NODE *s|
|00003bc0| 5f 63 6f 6e 74 69 6e 75 | 65 2c 2a 73 5f 71 75 69 |_continu|e,*s_qui|
|00003bd0| 74 3b 0a 65 78 74 65 72 | 6e 20 4e 4f 44 45 20 2a |t;.exter|n NODE *|
|00003be0| 78 6c 73 74 61 63 6b 3b | 0a 65 78 74 65 72 6e 20 |xlstack;|.extern |
|00003bf0| 4e 4f 44 45 20 2a 74 72 | 75 65 3b 0a 65 78 74 65 |NODE *tr|ue;.exte|
|00003c00| 72 6e 20 4e 4f 44 45 20 | 2a 2a 74 72 61 63 65 5f |rn NODE |**trace_|
|00003c10| 73 74 61 63 6b 3b 0a 0a | 2f 2a 20 65 78 74 65 72 |stack;..|/* exter|
|00003c20| 6e 61 6c 20 72 6f 75 74 | 69 6e 65 73 20 2a 2f 0a |nal rout|ines */.|
|00003c30| 65 78 74 65 72 6e 20 63 | 68 61 72 20 2a 6d 61 6c |extern c|har *mal|
|00003c40| 6c 6f 63 28 29 3b 0a 0a | 2f 2a 20 66 6f 72 77 61 |loc();..|/* forwa|
|00003c50| 72 64 20 64 65 63 6c 61 | 72 61 74 69 6f 6e 73 20 |rd decla|rations |
|00003c60| 2a 2f 0a 58 46 4f 52 57 | 41 52 44 20 4e 4f 44 45 |*/.XFORW|ARD NODE|
|00003c70| 20 2a 73 74 61 63 6b 74 | 6f 70 28 29 3b 0a 0a 2f | *stackt|op();../|
|00003c80| 2a 20 78 6c 66 61 69 6c | 20 2d 20 78 6c 69 73 70 |* xlfail| - xlisp|
|00003c90| 20 65 72 72 6f 72 20 68 | 61 6e 64 6c 65 72 20 2a | error h|andler *|
|00003ca0| 2f 0a 78 6c 66 61 69 6c | 28 65 6d 73 67 29 0a 20 |/.xlfail|(emsg). |
|00003cb0| 20 63 68 61 72 20 2a 65 | 6d 73 67 3b 0a 7b 0a 20 | char *e|msg;.{. |
|00003cc0| 20 20 20 78 6c 65 72 72 | 6f 72 28 65 6d 73 67 2c | xlerr|or(emsg,|
|00003cd0| 73 74 61 63 6b 74 6f 70 | 28 29 29 3b 0a 7d 0a 0a |stacktop|());.}..|
|00003ce0| 2f 2a 20 78 6c 61 62 6f | 72 74 20 2d 20 78 6c 69 |/* xlabo|rt - xli|
|00003cf0| 73 70 20 73 65 72 69 6f | 75 73 20 65 72 72 6f 72 |sp serio|us error|
|00003d00| 20 68 61 6e 64 6c 65 72 | 20 2a 2f 0a 78 6c 61 62 | handler| */.xlab|
|00003d10| 6f 72 74 28 65 6d 73 67 | 29 0a 20 20 63 68 61 72 |ort(emsg|). char|
|00003d20| 20 2a 65 6d 73 67 3b 0a | 7b 0a 20 20 20 20 78 6c | *emsg;.|{. xl|
|00003d30| 73 69 67 6e 61 6c 28 65 | 6d 73 67 2c 73 5f 75 6e |signal(e|msg,s_un|
|00003d40| 62 6f 75 6e 64 29 3b 0a | 7d 0a 0a 2f 2a 20 78 6c |bound);.|}../* xl|
|00003d50| 62 72 65 61 6b 20 2d 20 | 65 6e 74 65 72 20 61 20 |break - |enter a |
|00003d60| 62 72 65 61 6b 20 6c 6f | 6f 70 20 2a 2f 0a 78 6c |break lo|op */.xl|
|00003d70| 62 72 65 61 6b 28 65 6d | 73 67 2c 61 72 67 29 0a |break(em|sg,arg).|
|00003d80| 20 20 63 68 61 72 20 2a | 65 6d 73 67 3b 20 4e 4f | char *|emsg; NO|
|00003d90| 44 45 20 2a 61 72 67 3b | 0a 7b 0a 20 20 20 20 62 |DE *arg;|.{. b|
|00003da0| 72 65 61 6b 6c 6f 6f 70 | 28 22 62 72 65 61 6b 22 |reakloop|("break"|
|00003db0| 2c 4e 55 4c 4c 2c 65 6d | 73 67 2c 61 72 67 2c 54 |,NULL,em|sg,arg,T|
|00003dc0| 52 55 45 29 3b 0a 7d 0a | 0a 2f 2a 20 78 6c 65 72 |RUE);.}.|./* xler|
|00003dd0| 72 6f 72 20 2d 20 68 61 | 6e 64 6c 65 20 61 20 66 |ror - ha|ndle a f|
|00003de0| 61 74 61 6c 20 65 72 72 | 6f 72 20 2a 2f 0a 78 6c |atal err|or */.xl|
|00003df0| 65 72 72 6f 72 28 65 6d | 73 67 2c 61 72 67 29 0a |error(em|sg,arg).|
|00003e00| 20 20 63 68 61 72 20 2a | 65 6d 73 67 3b 20 4e 4f | char *|emsg; NO|
|00003e10| 44 45 20 2a 61 72 67 3b | 0a 7b 0a 20 20 20 20 64 |DE *arg;|.{. d|
|00003e20| 6f 65 72 72 6f 72 28 4e | 55 4c 4c 2c 65 6d 73 67 |oerror(N|ULL,emsg|
|00003e30| 2c 61 72 67 2c 46 41 4c | 53 45 29 3b 0a 7d 0a 0a |,arg,FAL|SE);.}..|
|00003e40| 2f 2a 20 78 6c 63 65 72 | 72 6f 72 20 2d 20 68 61 |/* xlcer|ror - ha|
|00003e50| 6e 64 6c 65 20 61 20 72 | 65 63 6f 76 65 72 61 62 |ndle a r|ecoverab|
|00003e60| 6c 65 20 65 72 72 6f 72 | 20 2a 2f 0a 78 6c 63 65 |le error| */.xlce|
|00003e70| 72 72 6f 72 28 63 6d 73 | 67 2c 65 6d 73 67 2c 61 |rror(cms|g,emsg,a|
|00003e80| 72 67 29 0a 20 20 63 68 | 61 72 20 2a 63 6d 73 67 |rg). ch|ar *cmsg|
|00003e90| 2c 2a 65 6d 73 67 3b 20 | 4e 4f 44 45 20 2a 61 72 |,*emsg; |NODE *ar|
|00003ea0| 67 3b 0a 7b 0a 20 20 20 | 20 64 6f 65 72 72 6f 72 |g;.{. | doerror|
|00003eb0| 28 63 6d 73 67 2c 65 6d | 73 67 2c 61 72 67 2c 54 |(cmsg,em|sg,arg,T|
|00003ec0| 52 55 45 29 3b 0a 7d 0a | 0a 2f 2a 20 78 6c 65 72 |RUE);.}.|./* xler|
|00003ed0| 72 70 72 69 6e 74 20 2d | 20 70 72 69 6e 74 20 61 |rprint -| print a|
|00003ee0| 6e 20 65 72 72 6f 72 20 | 6d 65 73 73 61 67 65 20 |n error |message |
|00003ef0| 2a 2f 0a 78 6c 65 72 72 | 70 72 69 6e 74 28 68 64 |*/.xlerr|print(hd|
|00003f00| 72 2c 63 6d 73 67 2c 65 | 6d 73 67 2c 61 72 67 29 |r,cmsg,e|msg,arg)|
|00003f10| 0a 20 20 63 68 61 72 20 | 2a 68 64 72 2c 2a 63 6d |. char |*hdr,*cm|
|00003f20| 73 67 2c 2a 65 6d 73 67 | 3b 20 4e 4f 44 45 20 2a |sg,*emsg|; NODE *|
|00003f30| 61 72 67 3b 0a 7b 0a 20 | 20 20 20 70 72 69 6e 74 |arg;.{. | print|
|00003f40| 66 28 22 25 73 3a 20 25 | 73 22 2c 68 64 72 2c 65 |f("%s: %|s",hdr,e|
|00003f50| 6d 73 67 29 3b 0a 20 20 | 20 20 69 66 20 28 61 72 |msg);. | if (ar|
|00003f60| 67 20 21 3d 20 73 5f 75 | 6e 62 6f 75 6e 64 29 20 |g != s_u|nbound) |
|00003f70| 7b 20 70 72 69 6e 74 66 | 28 22 20 2d 20 22 29 3b |{ printf|(" - ");|
|00003f80| 20 73 74 64 70 72 69 6e | 74 28 61 72 67 29 3b 20 | stdprin|t(arg); |
|00003f90| 7d 0a 20 20 20 20 65 6c | 73 65 20 70 72 69 6e 74 |}. el|se print|
|00003fa0| 66 28 22 5c 6e 22 29 3b | 0a 20 20 20 20 69 66 20 |f("\n");|. if |
|00003fb0| 28 63 6d 73 67 29 20 70 | 72 69 6e 74 66 28 22 69 |(cmsg) p|rintf("i|
|00003fc0| 66 20 63 6f 6e 74 69 6e | 75 65 64 3a 20 25 73 5c |f contin|ued: %s\|
|00003fd0| 6e 22 2c 63 6d 73 67 29 | 3b 0a 7d 0a 0a 2f 2a 20 |n",cmsg)|;.}../* |
|00003fe0| 64 6f 65 72 72 6f 72 20 | 2d 20 68 61 6e 64 6c 65 |doerror |- handle|
|00003ff0| 20 78 6c 69 73 70 20 65 | 72 72 6f 72 73 20 2a 2f | xlisp e|rrors */|
|00004000| 0a 4c 4f 43 41 4c 20 64 | 6f 65 72 72 6f 72 28 63 |.LOCAL d|oerror(c|
|00004010| 6d 73 67 2c 65 6d 73 67 | 2c 61 72 67 2c 63 66 6c |msg,emsg|,arg,cfl|
|00004020| 61 67 29 0a 20 20 63 68 | 61 72 20 2a 63 6d 73 67 |ag). ch|ar *cmsg|
|00004030| 2c 2a 65 6d 73 67 3b 20 | 4e 4f 44 45 20 2a 61 72 |,*emsg; |NODE *ar|
|00004040| 67 3b 20 69 6e 74 20 63 | 66 6c 61 67 3b 0a 7b 0a |g; int c|flag;.{.|
|00004050| 20 20 20 20 2f 2a 20 6d | 61 6b 65 20 73 75 72 65 | /* m|ake sure|
|00004060| 20 74 68 65 20 62 72 65 | 61 6b 20 6c 6f 6f 70 20 | the bre|ak loop |
|00004070| 69 73 20 65 6e 61 62 6c | 65 64 20 2a 2f 0a 20 20 |is enabl|ed */. |
|00004080| 20 20 69 66 20 28 73 5f | 62 72 65 61 6b 65 6e 61 | if (s_|breakena|
|00004090| 62 6c 65 2d 3e 6e 5f 73 | 79 6d 76 61 6c 75 65 20 |ble->n_s|ymvalue |
|000040a0| 3d 3d 20 4e 49 4c 29 0a | 09 78 6c 73 69 67 6e 61 |== NIL).|.xlsigna|
|000040b0| 6c 28 65 6d 73 67 2c 61 | 72 67 29 3b 0a 0a 20 20 |l(emsg,a|rg);.. |
|000040c0| 20 20 2f 2a 20 63 61 6c | 6c 20 74 68 65 20 64 65 | /* cal|l the de|
|000040d0| 62 75 67 20 72 65 61 64 | 2d 65 76 61 6c 2d 70 72 |bug read|-eval-pr|
|000040e0| 69 6e 74 20 6c 6f 6f 70 | 20 2a 2f 0a 20 20 20 20 |int loop| */. |
|000040f0| 62 72 65 61 6b 6c 6f 6f | 70 28 22 65 72 72 6f 72 |breakloo|p("error|
|00004100| 22 2c 63 6d 73 67 2c 65 | 6d 73 67 2c 61 72 67 2c |",cmsg,e|msg,arg,|
|00004110| 63 66 6c 61 67 29 3b 0a | 7d 0a 0a 2f 2a 20 62 72 |cflag);.|}../* br|
|00004120| 65 61 6b 6c 6f 6f 70 20 | 2d 20 74 68 65 20 64 65 |eakloop |- the de|
|00004130| 62 75 67 20 72 65 61 64 | 2d 65 76 61 6c 2d 70 72 |bug read|-eval-pr|
|00004140| 69 6e 74 20 6c 6f 6f 70 | 20 2a 2f 0a 4c 4f 43 41 |int loop| */.LOCA|
|00004150| 4c 20 69 6e 74 20 62 72 | 65 61 6b 6c 6f 6f 70 28 |L int br|eakloop(|
|00004160| 68 64 72 2c 63 6d 73 67 | 2c 65 6d 73 67 2c 61 72 |hdr,cmsg|,emsg,ar|
|00004170| 67 2c 63 66 6c 61 67 29 | 0a 20 20 63 68 61 72 20 |g,cflag)|. char |
|00004180| 2a 68 64 72 2c 2a 63 6d | 73 67 2c 2a 65 6d 73 67 |*hdr,*cm|sg,*emsg|
|00004190| 3b 20 4e 4f 44 45 20 2a | 61 72 67 3b 20 69 6e 74 |; NODE *|arg; int|
|000041a0| 20 63 66 6c 61 67 3b 0a | 7b 0a 20 20 20 20 4e 4f | cflag;.|{. NO|
|000041b0| 44 45 20 2a 6f 6c 64 73 | 74 6b 2c 65 78 70 72 2c |DE *olds|tk,expr,|
|000041c0| 2a 76 61 6c 3b 0a 20 20 | 20 20 43 4f 4e 54 45 58 |*val;. | CONTEX|
|000041d0| 54 20 63 6e 74 78 74 3b | 0a 0a 20 20 20 20 2f 2a |T cntxt;|.. /*|
|000041e0| 20 69 6e 63 72 65 6d 65 | 6e 74 20 74 68 65 20 64 | increme|nt the d|
|000041f0| 65 62 75 67 20 6c 65 76 | 65 6c 20 2a 2f 0a 20 20 |ebug lev|el */. |
|00004200| 20 20 78 6c 64 65 62 75 | 67 2b 2b 3b 0a 0a 20 20 | xldebu|g++;.. |
|00004210| 20 20 2f 2a 20 66 6c 75 | 73 68 20 74 68 65 20 69 | /* flu|sh the i|
|00004220| 6e 70 75 74 20 62 75 66 | 66 65 72 20 2a 2f 0a 20 |nput buf|fer */. |
|00004230| 20 20 20 78 6c 66 6c 75 | 73 68 28 29 3b 0a 0a 20 | xlflu|sh();.. |
|00004240| 20 20 20 2f 2a 20 70 72 | 69 6e 74 20 74 68 65 20 | /* pr|int the |
|00004250| 65 72 72 6f 72 20 6d 65 | 73 73 61 67 65 20 2a 2f |error me|ssage */|
|00004260| 0a 20 20 20 20 78 6c 65 | 72 72 70 72 69 6e 74 28 |. xle|rrprint(|
|00004270| 68 64 72 2c 63 6d 73 67 | 2c 65 6d 73 67 2c 61 72 |hdr,cmsg|,emsg,ar|
|00004280| 67 29 3b 0a 0a 20 20 20 | 20 2f 2a 20 64 6f 20 74 |g);.. | /* do t|
|00004290| 68 65 20 62 61 63 6b 20 | 74 72 61 63 65 20 2a 2f |he back |trace */|
|000042a0| 0a 20 20 20 20 69 66 20 | 28 73 5f 74 72 61 63 65 |. if |(s_trace|
|000042b0| 6e 61 62 6c 65 2d 3e 6e | 5f 73 79 6d 76 61 6c 75 |nable->n|_symvalu|
|000042c0| 65 29 20 7b 0a 09 76 61 | 6c 20 3d 20 73 5f 74 6c |e) {..va|l = s_tl|
|000042d0| 69 6d 69 74 2d 3e 6e 5f | 73 79 6d 76 61 6c 75 65 |imit->n_|symvalue|
|000042e0| 3b 0a 09 78 6c 62 61 6b | 74 72 61 63 65 28 66 69 |;..xlbak|trace(fi|
|000042f0| 78 70 28 76 61 6c 29 20 | 3f 20 76 61 6c 2d 3e 6e |xp(val) |? val->n|
|00004300| 5f 69 6e 74 20 3a 20 2d | 31 29 3b 0a 20 20 20 20 |_int : -|1);. |
|00004310| 7d 0a 0a 20 20 20 20 2f | 2a 20 63 72 65 61 74 65 |}.. /|* create|
|00004320| 20 61 20 6e 65 77 20 73 | 74 61 63 6b 20 66 72 61 | a new s|tack fra|
|00004330| 6d 65 20 2a 2f 0a 20 20 | 20 20 6f 6c 64 73 74 6b |me */. | oldstk|
|00004340| 20 3d 20 78 6c 73 61 76 | 65 28 26 65 78 70 72 2c | = xlsav|e(&expr,|
|00004350| 4e 55 4c 4c 29 3b 0a 0a | 20 20 20 20 2f 2a 20 64 |NULL);..| /* d|
|00004360| 65 62 75 67 20 63 6f 6d | 6d 61 6e 64 20 70 72 6f |ebug com|mand pro|
|00004370| 63 65 73 73 69 6e 67 20 | 6c 6f 6f 70 20 2a 2f 0a |cessing |loop */.|
|00004380| 20 20 20 20 78 6c 62 65 | 67 69 6e 28 26 63 6e 74 | xlbe|gin(&cnt|
|00004390| 78 74 2c 43 46 5f 45 52 | 52 4f 52 2c 74 72 75 65 |xt,CF_ER|ROR,true|
|000043a0| 29 3b 0a 20 20 20 20 77 | 68 69 6c 65 20 28 54 52 |);. w|hile (TR|
|000043b0| 55 45 29 20 7b 0a 0a 09 | 2f 2a 20 73 65 74 75 70 |UE) {...|/* setup|
|000043c0| 20 74 68 65 20 63 6f 6e | 74 69 6e 75 65 20 74 72 | the con|tinue tr|
|000043d0| 61 70 20 2a 2f 0a 09 69 | 66 20 28 73 65 74 6a 6d |ap */..i|f (setjm|
|000043e0| 70 28 63 6e 74 78 74 2e | 63 5f 6a 6d 70 62 75 66 |p(cntxt.|c_jmpbuf|
|000043f0| 29 29 20 7b 0a 09 20 20 | 20 20 78 6c 66 6c 75 73 |)) {.. | xlflus|
|00004400| 68 28 29 3b 0a 09 20 20 | 20 20 63 6f 6e 74 69 6e |h();.. | contin|
|00004410| 75 65 3b 0a 09 7d 0a 0a | 09 2f 2a 20 72 65 61 64 |ue;..}..|./* read|
|00004420| 20 61 6e 20 65 78 70 72 | 65 73 73 69 6f 6e 20 61 | an expr|ession a|
|00004430| 6e 64 20 63 68 65 63 6b | 20 66 6f 72 20 65 6f 66 |nd check| for eof|
|00004440| 20 2a 2f 0a 09 69 66 20 | 28 21 78 6c 72 65 61 64 | */..if |(!xlread|
|00004450| 28 73 5f 73 74 64 69 6e | 2d 3e 6e 5f 73 79 6d 76 |(s_stdin|->n_symv|
|00004460| 61 6c 75 65 2c 26 65 78 | 70 72 2e 6e 5f 70 74 72 |alue,&ex|pr.n_ptr|
|00004470| 29 29 20 7b 0a 09 20 20 | 20 20 65 78 70 72 2e 6e |)) {.. | expr.n|
|00004480| 5f 70 74 72 20 3d 20 73 | 5f 71 75 69 74 3b 0a 09 |_ptr = s|_quit;..|
|00004490| 20 20 20 20 62 72 65 61 | 6b 3b 0a 09 7d 0a 0a 09 | brea|k;..}...|
|000044a0| 2f 2a 20 63 68 65 63 6b | 20 66 6f 72 20 63 6f 6d |/* check| for com|
|000044b0| 6d 61 6e 64 73 20 2a 2f | 0a 09 69 66 20 28 65 78 |mands */|..if (ex|
|000044c0| 70 72 2e 6e 5f 70 74 72 | 20 3d 3d 20 73 5f 63 6f |pr.n_ptr| == s_co|
|000044d0| 6e 74 69 6e 75 65 29 20 | 7b 0a 09 20 20 20 20 69 |ntinue) |{.. i|
|000044e0| 66 20 28 63 66 6c 61 67 | 29 20 62 72 65 61 6b 3b |f (cflag|) break;|
|000044f0| 0a 09 20 20 20 20 65 6c | 73 65 20 78 6c 61 62 6f |.. el|se xlabo|
|00004500| 72 74 28 22 74 68 69 73 | 20 65 72 72 6f 72 20 63 |rt("this| error c|
|00004510| 61 6e 27 74 20 62 65 20 | 63 6f 6e 74 69 6e 75 65 |an't be |continue|
|00004520| 64 22 29 3b 0a 09 7d 0a | 09 65 6c 73 65 20 69 66 |d");..}.|.else if|
|00004530| 20 28 65 78 70 72 2e 6e | 5f 70 74 72 20 3d 3d 20 | (expr.n|_ptr == |
|00004540| 73 5f 71 75 69 74 29 0a | 09 20 20 20 20 62 72 65 |s_quit).|. bre|
|00004550| 61 6b 3b 0a 0a 09 2f 2a | 20 65 76 61 6c 75 61 74 |ak;.../*| evaluat|
|00004560| 65 20 74 68 65 20 65 78 | 70 72 65 73 73 69 6f 6e |e the ex|pression|
|00004570| 20 2a 2f 0a 09 65 78 70 | 72 2e 6e 5f 70 74 72 20 | */..exp|r.n_ptr |
|00004580| 3d 20 78 6c 65 76 61 6c | 28 65 78 70 72 2e 6e 5f |= xleval|(expr.n_|
|00004590| 70 74 72 29 3b 0a 0a 09 | 2f 2a 20 70 72 69 6e 74 |ptr);...|/* print|
|000045a0| 20 69 74 20 2a 2f 0a 09 | 78 6c 70 72 69 6e 74 28 | it */..|xlprint(|
|000045b0| 73 5f 73 74 64 6f 75 74 | 2d 3e 6e 5f 73 79 6d 76 |s_stdout|->n_symv|
|000045c0| 61 6c 75 65 2c 65 78 70 | 72 2e 6e 5f 70 74 72 2c |alue,exp|r.n_ptr,|
|000045d0| 54 52 55 45 29 3b 0a 09 | 78 6c 74 65 72 70 72 69 |TRUE);..|xlterpri|
|000045e0| 28 73 5f 73 74 64 6f 75 | 74 2d 3e 6e 5f 73 79 6d |(s_stdou|t->n_sym|
|000045f0| 76 61 6c 75 65 29 3b 0a | 20 20 20 20 7d 0a 20 20 |value);.| }. |
|00004600| 20 20 78 6c 65 6e 64 28 | 26 63 6e 74 78 74 29 3b | xlend(|&cntxt);|
|00004610| 0a 0a 20 20 20 20 2f 2a | 20 72 65 73 74 6f 72 65 |.. /*| restore|
|00004620| 20 74 68 65 20 70 72 65 | 76 69 6f 75 73 20 73 74 | the pre|vious st|
|00004630| 61 63 6b 20 66 72 61 6d | 65 20 2a 2f 0a 20 20 20 |ack fram|e */. |
|00004640| 20 78 6c 73 74 61 63 6b | 20 3d 20 6f 6c 64 73 74 | xlstack| = oldst|
|00004650| 6b 3b 0a 0a 20 20 20 20 | 2f 2a 20 64 65 63 72 65 |k;.. |/* decre|
|00004660| 6d 65 6e 74 20 74 68 65 | 20 64 65 62 75 67 20 6c |ment the| debug l|
|00004670| 65 76 65 6c 20 2a 2f 0a | 20 20 20 20 78 6c 64 65 |evel */.| xlde|
|00004680| 62 75 67 2d 2d 3b 0a 0a | 20 20 20 20 2f 2a 20 63 |bug--;..| /* c|
|00004690| 6f 6e 74 69 6e 75 65 20 | 74 68 65 20 6e 65 78 74 |ontinue |the next|
|000046a0| 20 68 69 67 68 65 72 20 | 62 72 65 61 6b 20 6c 6f | higher |break lo|
|000046b0| 6f 70 20 6f 6e 20 71 75 | 69 74 20 2a 2f 0a 20 20 |op on qu|it */. |
|000046c0| 20 20 69 66 20 28 65 78 | 70 72 2e 6e 5f 70 74 72 | if (ex|pr.n_ptr|
|000046d0| 20 3d 3d 20 73 5f 71 75 | 69 74 29 0a 09 78 6c 73 | == s_qu|it)..xls|
|000046e0| 69 67 6e 61 6c 28 22 71 | 75 69 74 20 66 72 6f 6d |ignal("q|uit from|
|000046f0| 20 62 72 65 61 6b 20 6c | 6f 6f 70 22 2c 73 5f 75 | break l|oop",s_u|
|00004700| 6e 62 6f 75 6e 64 29 3b | 0a 7d 0a 0a 2f 2a 20 74 |nbound);|.}../* t|
|00004710| 70 75 73 68 20 2d 20 61 | 64 64 20 61 6e 20 65 6e |push - a|dd an en|
|00004720| 74 72 79 20 74 6f 20 74 | 68 65 20 74 72 61 63 65 |try to t|he trace|
|00004730| 20 73 74 61 63 6b 20 2a | 2f 0a 78 6c 74 70 75 73 | stack *|/.xltpus|
|00004740| 68 28 6e 70 74 72 29 0a | 20 20 20 20 4e 4f 44 45 |h(nptr).| NODE|
|00004750| 20 2a 6e 70 74 72 3b 0a | 7b 0a 20 20 20 20 69 66 | *nptr;.|{. if|
|00004760| 20 28 2b 2b 78 6c 74 72 | 61 63 65 20 3c 20 54 44 | (++xltr|ace < TD|
|00004770| 45 50 54 48 29 0a 09 74 | 72 61 63 65 5f 73 74 61 |EPTH)..t|race_sta|
|00004780| 63 6b 5b 78 6c 74 72 61 | 63 65 5d 20 3d 20 6e 70 |ck[xltra|ce] = np|
|00004790| 74 72 3b 0a 7d 0a 0a 2f | 2a 20 74 70 6f 70 20 2d |tr;.}../|* tpop -|
|000047a0| 20 70 6f 70 20 61 6e 20 | 65 6e 74 72 79 20 66 72 | pop an |entry fr|
|000047b0| 6f 6d 20 74 68 65 20 74 | 72 61 63 65 20 73 74 61 |om the t|race sta|
|000047c0| 63 6b 20 2a 2f 0a 78 6c | 74 70 6f 70 28 29 0a 7b |ck */.xl|tpop().{|
|000047d0| 0a 20 20 20 20 78 6c 74 | 72 61 63 65 2d 2d 3b 0a |. xlt|race--;.|
|000047e0| 7d 0a 0a 2f 2a 20 73 74 | 61 63 6b 74 6f 70 20 2d |}../* st|acktop -|
|000047f0| 20 72 65 74 75 72 6e 20 | 74 68 65 20 74 6f 70 20 | return |the top |
|00004800| 6e 6f 64 65 20 6f 6e 20 | 74 68 65 20 73 74 61 63 |node on |the stac|
|00004810| 6b 20 2a 2f 0a 4c 4f 43 | 41 4c 20 4e 4f 44 45 20 |k */.LOC|AL NODE |
|00004820| 2a 73 74 61 63 6b 74 6f | 70 28 29 0a 7b 0a 20 20 |*stackto|p().{. |
|00004830| 20 20 72 65 74 75 72 6e | 20 28 78 6c 74 72 61 63 | return| (xltrac|
|00004840| 65 20 3e 3d 20 30 20 26 | 26 20 78 6c 74 72 61 63 |e >= 0 &|& xltrac|
|00004850| 65 20 3c 20 54 44 45 50 | 54 48 20 3f 20 74 72 61 |e < TDEP|TH ? tra|
|00004860| 63 65 5f 73 74 61 63 6b | 5b 78 6c 74 72 61 63 65 |ce_stack|[xltrace|
|00004870| 5d 20 3a 20 73 5f 75 6e | 62 6f 75 6e 64 29 3b 0a |] : s_un|bound);.|
|00004880| 7d 0a 0a 2f 2a 20 62 61 | 6b 74 72 61 63 65 20 2d |}../* ba|ktrace -|
|00004890| 20 64 6f 20 61 20 62 61 | 63 6b 20 74 72 61 63 65 | do a ba|ck trace|
|000048a0| 20 2a 2f 0a 78 6c 62 61 | 6b 74 72 61 63 65 28 6e | */.xlba|ktrace(n|
|000048b0| 29 0a 20 20 69 6e 74 20 | 6e 3b 0a 7b 0a 20 20 20 |). int |n;.{. |
|000048c0| 20 69 6e 74 20 69 3b 0a | 0a 20 20 20 20 66 6f 72 | int i;.|. for|
|000048d0| 20 28 69 20 3d 20 78 6c | 74 72 61 63 65 3b 20 28 | (i = xl|trace; (|
|000048e0| 6e 20 3c 20 30 20 7c 7c | 20 6e 2d 2d 29 20 26 26 |n < 0 ||| n--) &&|
|000048f0| 20 69 20 3e 3d 20 30 3b | 20 69 2d 2d 29 0a 09 69 | i >= 0;| i--)..i|
|00004900| 66 20 28 69 20 3c 20 54 | 44 45 50 54 48 29 0a 09 |f (i < T|DEPTH)..|
|00004910| 20 20 20 20 73 74 64 70 | 72 69 6e 74 28 74 72 61 | stdp|rint(tra|
|00004920| 63 65 5f 73 74 61 63 6b | 5b 69 5d 29 3b 0a 7d 0a |ce_stack|[i]);.}.|
|00004930| 0a 2f 2a 20 78 6c 64 69 | 6e 69 74 20 2d 20 64 65 |./* xldi|nit - de|
|00004940| 62 75 67 20 69 6e 69 74 | 69 61 6c 69 7a 61 74 69 |bug init|ializati|
|00004950| 6f 6e 20 72 6f 75 74 69 | 6e 65 20 2a 2f 0a 78 6c |on routi|ne */.xl|
|00004960| 64 69 6e 69 74 28 29 0a | 7b 0a 20 20 20 20 69 66 |dinit().|{. if|
|00004970| 20 28 28 74 72 61 63 65 | 5f 73 74 61 63 6b 20 3d | ((trace|_stack =|
|00004980| 20 28 4e 4f 44 45 20 2a | 2a 29 20 6d 61 6c 6c 6f | (NODE *|*) mallo|
|00004990| 63 28 54 53 54 4b 53 49 | 5a 45 29 29 20 3d 3d 20 |c(TSTKSI|ZE)) == |
|000049a0| 4e 55 4c 4c 29 0a 09 78 | 6c 61 62 6f 72 74 28 22 |NULL)..x|labort("|
|000049b0| 69 6e 73 75 66 66 69 63 | 69 65 6e 74 20 6d 65 6d |insuffic|ient mem|
|000049c0| 6f 72 79 22 29 3b 0a 20 | 20 20 20 74 6f 74 61 6c |ory");. | total|
|000049d0| 20 2b 3d 20 28 6c 6f 6e | 67 29 20 54 53 54 4b 53 | += (lon|g) TSTKS|
|000049e0| 49 5a 45 3b 0a 20 20 20 | 20 78 6c 74 72 61 63 65 |IZE;. | xltrace|
|000049f0| 20 3d 20 2d 31 3b 0a 20 | 20 20 20 78 6c 64 65 62 | = -1;. | xldeb|
|00004a00| 75 67 20 3d 20 30 3b 0a | 7d 0a 53 48 41 52 5f 45 |ug = 0;.|}.SHAR_E|
|00004a10| 4f 46 0a 69 66 20 74 65 | 73 74 20 33 39 32 34 20 |OF.if te|st 3924 |
|00004a20| 2d 6e 65 20 22 60 77 63 | 20 2d 63 20 3c 20 27 78 |-ne "`wc| -c < 'x|
|00004a30| 6c 64 62 75 67 2e 63 27 | 60 22 0a 74 68 65 6e 0a |ldbug.c'|`".then.|
|00004a40| 09 65 63 68 6f 20 73 68 | 61 72 3a 20 65 72 72 6f |.echo sh|ar: erro|
|00004a50| 72 20 74 72 61 6e 73 6d | 69 74 74 69 6e 67 20 22 |r transm|itting "|
|00004a60| 27 78 6c 64 62 75 67 2e | 63 27 22 20 27 28 73 68 |'xldbug.|c'" '(sh|
|00004a70| 6f 75 6c 64 20 68 61 76 | 65 20 62 65 65 6e 20 33 |ould hav|e been 3|
|00004a80| 39 32 34 20 63 68 61 72 | 61 63 74 65 72 73 29 27 |924 char|acters)'|
|00004a90| 0a 66 69 0a 66 69 20 23 | 20 65 6e 64 20 6f 66 20 |.fi.fi #| end of |
|00004aa0| 6f 76 65 72 77 72 69 74 | 69 6e 67 20 63 68 65 63 |overwrit|ing chec|
|00004ab0| 6b 0a 65 63 68 6f 20 73 | 68 61 72 3a 20 65 78 74 |k.echo s|har: ext|
|00004ac0| 72 61 63 74 69 6e 67 20 | 22 27 78 6c 69 73 70 2e |racting |"'xlisp.|
|00004ad0| 68 27 22 20 27 28 38 34 | 30 36 20 63 68 61 72 61 |h'" '(84|06 chara|
|00004ae0| 63 74 65 72 73 29 27 0a | 69 66 20 74 65 73 74 20 |cters)'.|if test |
|00004af0| 2d 66 20 27 78 6c 69 73 | 70 2e 68 27 0a 74 68 65 |-f 'xlis|p.h'.the|
|00004b00| 6e 0a 09 65 63 68 6f 20 | 73 68 61 72 3a 20 77 69 |n..echo |shar: wi|
|00004b10| 6c 6c 20 6e 6f 74 20 6f | 76 65 72 2d 77 72 69 74 |ll not o|ver-writ|
|00004b20| 65 20 65 78 69 73 74 69 | 6e 67 20 66 69 6c 65 20 |e existi|ng file |
|00004b30| 22 27 78 6c 69 73 70 2e | 68 27 22 0a 65 6c 73 65 |"'xlisp.|h'".else|
|00004b40| 0a 73 65 64 20 27 73 2f | 5e 58 2f 2f 27 20 3c 3c |.sed 's/|^X//' <<|
|00004b50| 20 5c 53 48 41 52 5f 45 | 4f 46 20 3e 20 27 78 6c | \SHAR_E|OF > 'xl|
|00004b60| 69 73 70 2e 68 27 0a 23 | 69 6e 63 6c 75 64 65 20 |isp.h'.#|include |
|00004b70| 3c 73 74 64 69 6f 2e 68 | 3e 0a 0a 09 09 20 20 20 |<stdio.h|>.... |
|00004b80| 20 20 20 2f 2a 20 78 6c | 69 73 70 20 2d 20 61 20 | /* xl|isp - a |
|00004b90| 73 6d 61 6c 6c 20 73 75 | 62 73 65 74 20 6f 66 20 |small su|bset of |
|00004ba0| 6c 69 73 70 20 2a 2f 0a | 0a 0a 09 09 09 2f 2a 20 |lisp */.|...../* |
|00004bb0| 73 79 73 74 65 6d 20 73 | 70 65 63 69 66 69 63 20 |system s|pecific |
|00004bc0| 64 65 66 69 6e 69 74 69 | 6f 6e 73 20 2a 2f 0a 0a |definiti|ons */..|
|00004bd0| 2f 2a 20 44 45 46 45 58 | 54 20 20 20 20 20 20 20 |/* DEFEX|T |
|00004be0| 64 65 66 69 6e 65 20 74 | 6f 20 65 6e 61 62 6c 65 |define t|o enable|
|00004bf0| 20 64 65 66 61 75 6c 74 | 20 65 78 74 65 6e 73 69 | default| extensi|
|00004c00| 6f 6e 20 6f 66 20 27 2e | 6c 73 70 27 20 6f 6e 20 |on of '.|lsp' on |
|00004c10| 27 6c 6f 61 64 27 20 2a | 2f 0a 2f 2a 20 46 47 45 |'load' *|/./* FGE|
|00004c20| 54 4e 41 4d 45 20 20 20 | 20 20 64 65 66 69 6e 65 |TNAME | define|
|00004c30| 20 69 66 20 73 79 73 74 | 65 6d 20 73 75 70 70 6f | if syst|em suppo|
|00004c40| 72 74 73 20 27 66 67 65 | 74 6e 61 6d 65 27 20 2a |rts 'fge|tname' *|
|00004c50| 2f 0a 2f 2a 20 4e 4e 4f | 44 45 53 20 20 20 20 20 |/./* NNO|DES |
|00004c60| 20 20 6e 75 6d 62 65 72 | 20 6f 66 20 6e 6f 64 65 | number| of node|
|00004c70| 73 20 74 6f 20 61 6c 6c | 6f 63 61 74 65 20 69 6e |s to all|ocate in|
|00004c80| 20 65 61 63 68 20 72 65 | 71 75 65 73 74 20 2a 2f | each re|quest */|
|00004c90| 0a 2f 2a 20 78 6c 69 73 | 70 20 2d 20 61 20 73 6d |./* xlis|p - a sm|
|00004ca0| 61 6c 6c 20 73 75 62 73 | 65 74 20 6f 66 20 6c 69 |all subs|et of li|
|00004cb0| 73 70 20 2a 2f 0a 0a 2f | 2a 20 73 79 73 74 65 6d |sp */../|* system|
|00004cc0| 20 73 70 65 63 69 66 69 | 63 20 64 65 66 69 6e 69 | specifi|c defini|
|00004cd0| 74 69 6f 6e 73 20 2a 2f | 0a 23 64 65 66 69 6e 65 |tions */|.#define|
|00004ce0| 20 55 4e 49 58 0a 0a 23 | 69 66 64 65 66 20 41 5a | UNIX..#|ifdef AZ|
|00004cf0| 54 45 43 0a 23 69 6e 63 | 6c 75 64 65 20 22 73 74 |TEC.#inc|lude "st|
|00004d00| 64 69 6f 2e 68 22 0a 23 | 69 6e 63 6c 75 64 65 20 |dio.h".#|include |
|00004d10| 22 73 65 74 6a 6d 70 2e | 68 22 0a 23 65 6c 73 65 |"setjmp.|h".#else|
|00004d20| 0a 23 69 6e 63 6c 75 64 | 65 20 3c 73 74 64 69 6f |.#includ|e <stdio|
|00004d30| 2e 68 3e 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 65 |.h>.#inc|lude <se|
|00004d40| 74 6a 6d 70 2e 68 3e 0a | 23 69 6e 63 6c 75 64 65 |tjmp.h>.|#include|
|00004d50| 20 3c 63 74 79 70 65 2e | 68 3e 0a 23 65 6e 64 69 | <ctype.|h>.#endi|
|00004d60| 66 0a 0a 2f 2a 20 4e 4e | 4f 44 45 53 20 20 20 20 |f../* NN|ODES |
|00004d70| 20 20 20 6e 75 6d 62 65 | 72 20 6f 66 20 6e 6f 64 | numbe|r of nod|
|00004d80| 65 73 20 74 6f 20 61 6c | 6c 6f 63 61 74 65 20 69 |es to al|locate i|
|00004d90| 6e 20 65 61 63 68 20 72 | 65 71 75 65 73 74 20 2a |n each r|equest *|
|00004da0| 2f 0a 2f 2a 20 54 44 45 | 50 54 48 20 20 20 20 20 |/./* TDE|PTH |
|00004db0| 20 20 74 72 61 63 65 20 | 73 74 61 63 6b 20 64 65 | trace |stack de|
|00004dc0| 70 74 68 20 2a 2f 0a 2f | 2a 20 46 4f 52 57 41 52 |pth */./|* FORWAR|
|00004dd0| 44 20 20 20 20 20 20 74 | 79 70 65 20 6f 66 20 61 |D t|ype of a|
|00004de0| 20 66 6f 72 77 61 72 64 | 20 64 65 63 6c 61 72 61 | forward| declara|
|00004df0| 74 69 6f 6e 20 28 75 73 | 75 61 6c 6c 79 20 22 22 |tion (us|ually ""|
|00004e00| 29 20 2a 2f 0a 2f 2a 20 | 4c 4f 43 41 4c 20 20 20 |) */./* |LOCAL |
|00004e10| 20 20 20 20 20 74 79 70 | 65 20 6f 66 20 61 20 6c | typ|e of a l|
|00004e20| 6f 63 61 6c 20 66 75 6e | 63 74 69 6f 6e 20 28 75 |ocal fun|ction (u|
|00004e30| 73 75 61 6c 6c 79 20 22 | 73 74 61 74 69 63 22 29 |sually "|static")|
|00004e40| 20 2a 2f 0a 0a 2f 2a 20 | 66 6f 72 20 74 68 65 20 | */../* |for the |
|00004e50| 43 6f 6d 70 75 74 65 72 | 20 49 6e 6e 6f 76 61 74 |Computer| Innovat|
|00004e60| 69 6f 6e 73 20 63 6f 6d | 70 69 6c 65 72 20 2a 2f |ions com|piler */|
|00004e70| 0a 23 69 66 64 65 66 20 | 43 49 0a 23 64 65 66 69 |.#ifdef |CI.#defi|
|00004e80| 6e 65 20 4e 4e 4f 44 45 | 53 20 20 20 20 20 20 20 |ne NNODE|S |
|00004e90| 20 20 20 31 30 30 30 0a | 23 64 65 66 69 6e 65 20 | 1000.|#define |
|00004ea0| 54 44 45 50 54 48 20 20 | 20 20 20 20 20 20 20 20 |TDEPTH | |
|00004eb0| 35 30 30 0a 23 65 6e 64 | 69 66 0a 0a 2f 2a 20 66 |500.#end|if../* f|
|00004ec0| 6f 72 20 74 68 65 20 43 | 50 4d 36 38 4b 20 63 6f |or the C|PM68K co|
|00004ed0| 6d 70 69 6c 65 72 20 2a | 2f 0a 23 69 66 64 65 66 |mpiler *|/.#ifdef|
|00004ee0| 20 43 50 4d 36 38 4b 0a | 23 64 65 66 69 6e 65 20 | CPM68K.|#define |
|00004ef0| 4e 4e 4f 44 45 53 20 20 | 20 20 20 20 20 20 20 20 |NNODES | |
|00004f00| 31 30 30 30 0a 23 64 65 | 66 69 6e 65 20 54 44 45 |1000.#de|fine TDE|
|00004f10| 50 54 48 20 20 20 20 20 | 20 20 20 20 20 35 30 30 |PTH | 500|
|00004f20| 0a 23 64 65 66 69 6e 65 | 20 4c 4f 43 41 4c 0a 23 |.#define| LOCAL.#|
|00004f30| 64 65 66 69 6e 65 20 41 | 46 4d 54 20 20 20 20 20 |define A|FMT |
|00004f40| 20 20 20 20 20 20 20 22 | 25 6c 78 22 0a 23 75 6e | "|%lx".#un|
|00004f50| 64 65 66 20 4e 55 4c 4c | 0a 23 64 65 66 69 6e 65 |def NULL|.#define|
|00004f60| 20 4e 55 4c 4c 20 20 20 | 20 20 20 20 20 20 20 20 | NULL | |
|00004f70| 20 28 63 68 61 72 20 2a | 29 30 0a 23 65 6e 64 69 | (char *|)0.#endi|
|00004f80| 66 0a 0a 2f 2a 20 66 6f | 72 20 74 68 65 20 44 65 |f../* fo|r the De|
|00004f90| 53 6d 65 74 20 63 6f 6d | 70 69 6c 65 72 20 2a 2f |Smet com|piler */|
|00004fa0| 0a 23 69 66 64 65 66 20 | 44 45 53 4d 45 54 0a 23 |.#ifdef |DESMET.#|
|00004fb0| 64 65 66 69 6e 65 20 4e | 4e 4f 44 45 53 20 20 20 |define N|NODES |
|00004fc0| 20 20 20 20 20 20 20 31 | 30 30 30 0a 23 64 65 66 | 1|000.#def|
|00004fd0| 69 6e 65 20 54 44 45 50 | 54 48 20 20 20 20 20 20 |ine TDEP|TH |
|00004fe0| 20 20 20 20 35 30 30 0a | 23 64 65 66 69 6e 65 20 | 500.|#define |
|00004ff0| 4c 4f 43 41 4c 0a 23 64 | 65 66 69 6e 65 20 67 65 |LOCAL.#d|efine ge|
|00005000| 74 63 28 66 70 29 20 20 | 20 20 20 20 20 20 67 65 |tc(fp) | ge|
|00005010| 74 63 78 28 66 70 29 0a | 23 64 65 66 69 6e 65 20 |tcx(fp).|#define |
|00005020| 70 75 74 63 28 63 68 2c | 66 70 29 20 20 20 20 20 |putc(ch,|fp) |
|00005030| 70 75 74 63 78 28 63 68 | 2c 66 70 29 0a 23 64 65 |putcx(ch|,fp).#de|
|00005040| 66 69 6e 65 20 45 4f 46 | 20 20 20 20 20 20 20 20 |fine EOF| |
|00005050| 20 20 20 20 20 2d 31 0a | 23 65 6e 64 69 66 0a 0a | -1.|#endif..|
|00005060| 2f 2a 20 66 6f 72 20 74 | 68 65 20 4d 65 67 61 4d |/* for t|he MegaM|
|00005070| 61 78 20 63 6f 6d 70 69 | 6c 65 72 20 2a 2f 0a 23 |ax compi|ler */.#|
|00005080| 69 66 64 65 66 20 4d 45 | 47 41 4d 41 58 0a 23 64 |ifdef ME|GAMAX.#d|
|00005090| 65 66 69 6e 65 20 4e 4e | 4f 44 45 53 20 20 20 20 |efine NN|ODES |
|000050a0| 20 20 20 20 20 20 32 30 | 30 0a 23 64 65 66 69 6e | 20|0.#defin|
|000050b0| 65 20 54 44 45 50 54 48 | 20 20 20 20 20 20 20 20 |e TDEPTH| |
|000050c0| 20 20 31 30 30 0a 23 64 | 65 66 69 6e 65 20 4c 4f | 100.#d|efine LO|
|000050d0| 43 41 4c 0a 23 64 65 66 | 69 6e 65 20 41 46 4d 54 |CAL.#def|ine AFMT|
|000050e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 22 25 6c 78 | | "%lx|
|000050f0| 22 0a 23 64 65 66 69 6e | 65 20 54 53 54 4b 53 49 |".#defin|e TSTKSI|
|00005100| 5a 45 20 20 20 20 20 20 | 20 20 28 34 20 2a 20 54 |ZE | (4 * T|
|00005110| 44 45 50 54 48 29 0a 23 | 65 6e 64 69 66 0a 0a 2f |DEPTH).#|endif../|
|00005120| 2a 20 66 6f 72 20 74 68 | 65 20 56 41 58 2d 31 31 |* for th|e VAX-11|
|00005130| 20 43 20 63 6f 6d 70 69 | 6c 65 72 20 2a 2f 0a 23 | C compi|ler */.#|
|00005140| 69 66 64 65 66 20 76 6d | 73 0a 23 64 65 66 69 6e |ifdef vm|s.#defin|
|00005150| 65 20 4e 4e 4f 44 45 53 | 20 20 20 20 20 20 20 20 |e NNODES| |
|00005160| 20 20 32 30 30 30 0a 23 | 64 65 66 69 6e 65 20 54 | 2000.#|define T|
|00005170| 44 45 50 54 48 20 20 20 | 20 20 20 20 20 20 20 31 |DEPTH | 1|
|00005180| 30 30 30 0a 23 65 6e 64 | 69 66 0a 0a 2f 2a 20 66 |000.#end|if../* f|
|00005190| 6f 72 20 74 68 65 20 44 | 45 43 55 53 20 43 20 63 |or the D|ECUS C c|
|000051a0| 6f 6d 70 69 6c 65 72 20 | 2a 2f 0a 23 69 66 64 65 |ompiler |*/.#ifde|
|000051b0| 66 20 64 65 63 75 73 0a | 23 64 65 66 69 6e 65 20 |f decus.|#define |
|000051c0| 4e 4e 4f 44 45 53 20 20 | 20 20 20 20 20 20 20 20 |NNODES | |
|000051d0| 32 30 30 0a 23 64 65 66 | 69 6e 65 20 54 44 45 50 |200.#def|ine TDEP|
|000051e0| 54 48 20 20 20 20 20 20 | 20 20 20 20 31 30 30 0a |TH | 100.|
|000051f0| 23 64 65 66 69 6e 65 20 | 46 4f 52 57 41 52 44 20 |#define |FORWARD |
|00005200| 20 20 20 20 20 20 20 20 | 65 78 74 65 72 6e 0a 23 | |extern.#|
|00005210| 65 6e 64 69 66 0a 0a 2f | 2a 20 66 6f 72 20 75 6e |endif../|* for un|
|00005220| 69 78 20 63 6f 6d 70 69 | 6c 65 72 73 20 2a 2f 0a |ix compi|lers */.|
|00005230| 23 69 66 64 65 66 20 75 | 6e 69 78 0a 23 64 65 66 |#ifdef u|nix.#def|
|00005240| 69 6e 65 20 4e 4e 4f 44 | 45 53 20 20 20 20 20 20 |ine NNOD|ES |
|00005250| 20 20 20 20 32 30 30 0a | 23 64 65 66 69 6e 65 20 | 200.|#define |
|00005260| 54 44 45 50 54 48 20 20 | 20 20 20 20 20 20 20 20 |TDEPTH | |
|00005270| 31 30 30 0a 23 65 6e 64 | 69 66 0a 0a 2f 2a 20 66 |100.#end|if../* f|
|00005280| 6f 72 20 74 68 65 20 41 | 5a 54 45 43 20 43 20 63 |or the A|ZTEC C c|
|00005290| 6f 6d 70 69 6c 65 72 20 | 2a 2f 0a 23 69 66 64 65 |ompiler |*/.#ifde|
|000052a0| 66 20 41 5a 54 45 43 0a | 23 64 65 66 69 6e 65 20 |f AZTEC.|#define |
|000052b0| 4e 4e 4f 44 45 53 20 20 | 20 20 20 20 20 20 20 20 |NNODES | |
|000052c0| 32 30 30 0a 23 64 65 66 | 69 6e 65 20 54 44 45 50 |200.#def|ine TDEP|
|000052d0| 54 48 20 20 20 20 20 20 | 20 20 20 20 31 30 30 0a |TH | 100.|
|000052e0| 23 64 65 66 69 6e 65 20 | 67 65 74 63 28 66 70 29 |#define |getc(fp)|
|000052f0| 20 20 20 20 20 20 20 20 | 61 67 65 74 63 28 66 70 | |agetc(fp|
|00005300| 29 0a 23 64 65 66 69 6e | 65 20 70 75 74 63 28 63 |).#defin|e putc(c|
|00005310| 68 2c 66 70 29 20 20 20 | 20 20 61 70 75 74 63 28 |h,fp) | aputc(|
|00005320| 63 68 2c 66 70 29 0a 23 | 65 6e 64 69 66 0a 0a 2f |ch,fp).#|endif../|
|00005330| 2a 20 64 65 66 61 75 6c | 74 20 69 6d 70 6f 72 74 |* defaul|t import|
|00005340| 61 6e 74 20 64 65 66 69 | 6e 69 74 69 6f 6e 73 20 |ant defi|nitions |
|00005350| 2a 2f 0a 23 69 66 6e 64 | 65 66 20 4e 4e 4f 44 45 |*/.#ifnd|ef NNODE|
|00005360| 53 0a 23 64 65 66 69 6e | 65 20 4e 4e 4f 44 45 53 |S.#defin|e NNODES|
|00005370| 20 20 20 20 20 20 20 20 | 20 20 32 30 30 0a 23 65 | | 200.#e|
|00005380| 6e 64 69 66 0a 23 69 66 | 6e 64 65 66 20 54 44 45 |ndif.#if|ndef TDE|
|00005390| 50 54 48 0a 23 64 65 66 | 69 6e 65 20 54 44 45 50 |PTH.#def|ine TDEP|
|000053a0| 54 48 20 20 20 20 20 20 | 20 20 20 20 31 30 30 0a |TH | 100.|
|000053b0| 23 65 6e 64 69 66 0a 23 | 69 66 6e 64 65 66 20 46 |#endif.#|ifndef F|
|000053c0| 4f 52 57 41 52 44 0a 23 | 64 65 66 69 6e 65 20 46 |ORWARD.#|define F|
|000053d0| 4f 52 57 41 52 44 0a 23 | 65 6e 64 69 66 0a 23 69 |ORWARD.#|endif.#i|
|000053e0| 66 6e 64 65 66 20 4c 4f | 43 41 4c 0a 23 64 65 66 |fndef LO|CAL.#def|
|000053f0| 69 6e 65 20 4c 4f 43 41 | 4c 20 20 20 20 20 20 20 |ine LOCA|L |
|00005400| 20 20 20 20 73 74 61 74 | 69 63 0a 23 65 6e 64 69 | stat|ic.#endi|
|00005410| 66 0a 23 69 66 6e 64 65 | 66 20 41 46 4d 54 0a 23 |f.#ifnde|f AFMT.#|
|00005420| 64 65 66 69 6e 65 20 41 | 46 4d 54 20 20 20 20 20 |define A|FMT |
|00005430| 20 20 20 20 20 20 20 22 | 25 78 22 0a 23 65 6e 64 | "|%x".#end|
|00005440| 69 66 0a 23 69 66 6e 64 | 65 66 20 54 53 54 4b 53 |if.#ifnd|ef TSTKS|
|00005450| 49 5a 45 0a 23 64 65 66 | 69 6e 65 20 54 53 54 4b |IZE.#def|ine TSTK|
|00005460| 53 49 5a 45 20 20 20 20 | 20 20 20 20 28 73 69 7a |SIZE | (siz|
|00005470| 65 6f 66 28 4e 4f 44 45 | 20 2a 29 20 2a 20 54 44 |eof(NODE| *) * TD|
|00005480| 45 50 54 48 29 0a 23 65 | 6e 64 69 66 0a 0a 2f 2a |EPTH).#e|ndif../*|
|00005490| 20 75 73 65 66 75 6c 20 | 64 65 66 69 6e 69 74 69 | useful |definiti|
|000054a0| 6f 6e 73 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 54 |ons */.#|define T|
|000054b0| 52 55 45 20 20 20 20 31 | 0a 23 64 65 66 69 6e 65 |RUE 1|.#define|
|000054c0| 20 46 41 4c 53 45 20 20 | 20 30 0a 23 64 65 66 69 | FALSE | 0.#defi|
|000054d0| 6e 65 20 4e 49 4c 20 20 | 20 20 20 28 4e 4f 44 45 |ne NIL | (NODE|
|000054e0| 20 2a 29 30 0a 0a 2f 2a | 20 70 72 6f 67 72 61 6d | *)0../*| program|
|000054f0| 20 6c 69 6d 69 74 73 20 | 2a 2f 0a 23 64 65 66 69 | limits |*/.#defi|
|00005500| 6e 65 20 53 54 52 4d 41 | 58 20 20 20 20 20 20 20 |ne STRMA|X |
|00005510| 20 20 20 31 30 30 20 20 | 20 20 20 20 20 20 20 20 | 100 | |
|00005520| 20 20 20 2f 2a 20 6d 61 | 78 69 6d 75 6d 20 6c 65 | /* ma|ximum le|
|00005530| 6e 67 74 68 20 6f 66 20 | 61 20 73 74 72 69 6e 67 |ngth of |a string|
|00005540| 20 63 6f 6e 73 74 61 6e | 74 20 2a 2f 0a 20 20 20 | constan|t */. |
|00005550| 20 20 20 20 20 0a 2f 2a | 20 6e 6f 64 65 20 74 79 | ./*| node ty|
|00005560| 70 65 73 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 46 |pes */.#|define F|
|00005570| 52 45 45 20 20 20 20 30 | 0a 23 64 65 66 69 6e 65 |REE 0|.#define|
|00005580| 20 53 55 42 52 20 20 20 | 20 31 0a 23 64 65 66 69 | SUBR | 1.#defi|
|00005590| 6e 65 20 46 53 55 42 52 | 20 20 20 32 0a 23 64 65 |ne FSUBR| 2.#de|
|000055a0| 66 69 6e 65 20 4c 49 53 | 54 20 20 20 20 33 0a 23 |fine LIS|T 3.#|
|000055b0| 64 65 66 69 6e 65 20 53 | 59 4d 20 20 20 20 20 34 |define S|YM 4|
|000055c0| 0a 23 64 65 66 69 6e 65 | 20 49 4e 54 20 20 20 20 |.#define| INT |
|000055d0| 20 35 0a 23 64 65 66 69 | 6e 65 20 53 54 52 20 20 | 5.#defi|ne STR |
|000055e0| 20 20 20 36 0a 23 64 65 | 66 69 6e 65 20 4f 42 4a | 6.#de|fine OBJ|
|000055f0| 20 20 20 20 20 37 0a 23 | 64 65 66 69 6e 65 20 46 | 7.#|define F|
|00005600| 50 54 52 20 20 20 20 38 | 0a 0a 2f 2a 20 6e 6f 64 |PTR 8|../* nod|
|00005610| 65 20 66 6c 61 67 73 20 | 2a 2f 0a 23 64 65 66 69 |e flags |*/.#defi|
|00005620| 6e 65 20 4d 41 52 4b 20 | 20 20 20 31 0a 23 64 65 |ne MARK | 1.#de|
|00005630| 66 69 6e 65 20 4c 45 46 | 54 20 20 20 20 32 0a 0a |fine LEF|T 2..|
|00005640| 2f 2a 20 73 74 72 69 6e | 67 20 74 79 70 65 73 20 |/* strin|g types |
|00005650| 2a 2f 0a 23 64 65 66 69 | 6e 65 20 44 59 4e 41 4d |*/.#defi|ne DYNAM|
|00005660| 49 43 20 30 0a 23 64 65 | 66 69 6e 65 20 53 54 41 |IC 0.#de|fine STA|
|00005670| 54 49 43 20 20 31 0a 0a | 2f 2a 20 6e 65 77 20 6e |TIC 1..|/* new n|
|00005680| 6f 64 65 20 61 63 63 65 | 73 73 20 6d 61 63 72 6f |ode acce|ss macro|
|00005690| 73 20 2a 2f 0a 23 64 65 | 66 69 6e 65 20 6e 74 79 |s */.#de|fine nty|
|000056a0| 70 65 28 78 29 20 20 20 | 20 20 20 20 20 28 28 78 |pe(x) | ((x|
|000056b0| 29 2d 3e 6e 5f 74 79 70 | 65 29 0a 23 64 65 66 69 |)->n_typ|e).#defi|
|000056c0| 6e 65 20 61 74 6f 6d 28 | 78 29 20 20 20 20 20 20 |ne atom(|x) |
|000056d0| 20 20 20 28 28 78 29 20 | 3d 3d 20 4e 49 4c 20 7c | ((x) |== NIL ||
|000056e0| 7c 20 28 78 29 2d 3e 6e | 5f 74 79 70 65 20 21 3d || (x)->n|_type !=|
|000056f0| 20 4c 49 53 54 29 0a 23 | 64 65 66 69 6e 65 20 6e | LIST).#|define n|
|00005700| 75 6c 6c 28 78 29 20 20 | 20 20 20 20 20 20 20 28 |ull(x) | (|
|00005710| 28 78 29 20 3d 3d 20 4e | 49 4c 29 0a 23 64 65 66 |(x) == N|IL).#def|
|00005720| 69 6e 65 20 6c 69 73 74 | 70 28 78 29 20 20 20 20 |ine list|p(x) |
|00005730| 20 20 20 20 28 28 78 29 | 20 3d 3d 20 4e 49 4c 20 | ((x)| == NIL |
|00005740| 7c 7c 20 28 78 29 2d 3e | 6e 5f 74 79 70 65 20 3d ||| (x)->|n_type =|
|00005750| 3d 20 4c 49 53 54 29 0a | 23 64 65 66 69 6e 65 20 |= LIST).|#define |
|00005760| 63 6f 6e 73 70 28 78 29 | 20 20 20 20 20 20 20 20 |consp(x)| |
|00005770| 28 28 78 29 20 26 26 20 | 28 78 29 2d 3e 6e 5f 74 |((x) && |(x)->n_t|
|00005780| 79 70 65 20 3d 3d 20 4c | 49 53 54 29 0a 23 64 65 |ype == L|IST).#de|
|00005790| 66 69 6e 65 20 73 75 62 | 72 70 28 78 29 20 20 20 |fine sub|rp(x) |
|000057a0| 20 20 20 20 20 28 28 78 | 29 20 26 26 20 28 78 29 | ((x|) && (x)|
|000057b0| 2d 3e 6e 5f 74 79 70 65 | 20 3d 3d 20 53 55 42 52 |->n_type| == SUBR|
|000057c0| 29 0a 23 64 65 66 69 6e | 65 20 66 73 75 62 72 70 |).#defin|e fsubrp|
|000057d0| 28 78 29 20 20 20 20 20 | 20 20 28 28 78 29 20 26 |(x) | ((x) &|
|000057e0| 26 20 28 78 29 2d 3e 6e | 5f 74 79 70 65 20 3d 3d |& (x)->n|_type ==|
|000057f0| 20 46 53 55 42 52 29 0a | 23 64 65 66 69 6e 65 20 | FSUBR).|#define |
|00005800| 73 74 72 69 6e 67 70 28 | 78 29 20 20 20 20 20 20 |stringp(|x) |
|00005810| 28 28 78 29 20 26 26 20 | 28 78 29 2d 3e 6e 5f 74 |((x) && |(x)->n_t|
|00005820| 79 70 65 20 3d 3d 20 53 | 54 52 29 0a 23 64 65 66 |ype == S|TR).#def|
|00005830| 69 6e 65 20 73 79 6d 62 | 6f 6c 70 28 78 29 20 20 |ine symb|olp(x) |
|00005840| 20 20 20 20 28 28 78 29 | 20 26 26 20 28 78 29 2d | ((x)| && (x)-|
|00005850| 3e 6e 5f 74 79 70 65 20 | 3d 3d 20 53 59 4d 29 0a |>n_type |== SYM).|
|00005860| 23 64 65 66 69 6e 65 20 | 66 69 6c 65 70 28 78 29 |#define |filep(x)|
|00005870| 20 20 20 20 20 20 20 20 | 28 28 78 29 20 26 26 20 | |((x) && |
|00005880| 28 78 29 2d 3e 6e 5f 74 | 79 70 65 20 3d 3d 20 46 |(x)->n_t|ype == F|
|00005890| 50 54 52 29 0a 23 64 65 | 66 69 6e 65 20 6f 62 6a |PTR).#de|fine obj|
|000058a0| 65 63 74 70 28 78 29 20 | 20 20 20 20 20 28 28 78 |ectp(x) | ((x|
|000058b0| 29 20 26 26 20 28 78 29 | 2d 3e 6e 5f 74 79 70 65 |) && (x)|->n_type|
|000058c0| 20 3d 3d 20 4f 42 4a 29 | 0a 23 64 65 66 69 6e 65 | == OBJ)|.#define|
|000058d0| 20 66 69 78 70 28 78 29 | 20 20 20 20 20 20 20 20 | fixp(x)| |
|000058e0| 20 28 28 78 29 20 26 26 | 20 28 78 29 2d 3e 6e 5f | ((x) &&| (x)->n_|
|000058f0| 74 79 70 65 20 3d 3d 20 | 49 4e 54 29 0a 23 64 65 |type == |INT).#de|
|00005900| 66 69 6e 65 20 63 61 72 | 28 78 29 20 20 20 20 20 |fine car|(x) |
|00005910| 20 20 20 20 20 28 28 78 | 29 2d 3e 6e 5f 63 61 72 | ((x|)->n_car|
|00005920| 29 0a 23 64 65 66 69 6e | 65 20 63 64 72 28 78 29 |).#defin|e cdr(x)|
|00005930| 20 20 20 20 20 20 20 20 | 20 20 28 28 78 29 2d 3e | | ((x)->|
|00005940| 6e 5f 63 64 72 29 0a 23 | 64 65 66 69 6e 65 20 72 |n_cdr).#|define r|
|00005950| 70 6c 61 63 61 28 78 2c | 79 29 20 20 20 20 20 28 |placa(x,|y) (|
|00005960| 28 78 29 2d 3e 6e 5f 63 | 61 72 20 3d 20 28 79 29 |(x)->n_c|ar = (y)|
|00005970| 29 0a 23 64 65 66 69 6e | 65 20 72 70 6c 61 63 64 |).#defin|e rplacd|
|00005980| 28 78 2c 79 29 20 20 20 | 20 20 28 28 78 29 2d 3e |(x,y) | ((x)->|
|00005990| 6e 5f 63 64 72 20 3d 20 | 28 79 29 29 0a 0a 2f 2a |n_cdr = |(y))../*|
|000059a0| 20 73 79 6d 62 6f 6c 20 | 6e 6f 64 65 20 2a 2f 0a | symbol |node */.|
|000059b0| 23 64 65 66 69 6e 65 20 | 6e 5f 73 79 6d 70 6c 69 |#define |n_sympli|
|000059c0| 73 74 20 20 20 20 20 20 | 6e 5f 69 6e 66 6f 2e 6e |st |n_info.n|
|000059d0| 5f 78 73 79 6d 2e 78 73 | 79 5f 70 6c 69 73 74 0a |_xsym.xs|y_plist.|
|000059e0| 23 64 65 66 69 6e 65 20 | 6e 5f 73 79 6d 76 61 6c |#define |n_symval|
|000059f0| 75 65 20 20 20 20 20 20 | 6e 5f 69 6e 66 6f 2e 6e |ue |n_info.n|
|00005a00| 5f 78 73 79 6d 2e 78 73 | 79 5f 76 61 6c 75 65 0a |_xsym.xs|y_value.|
|00005a10| 0a 2f 2a 20 73 75 62 72 | 2f 66 73 75 62 72 20 6e |./* subr|/fsubr n|
|00005a20| 6f 64 65 20 2a 2f 0a 23 | 64 65 66 69 6e 65 20 6e |ode */.#|define n|
|00005a30| 5f 73 75 62 72 20 20 20 | 20 20 20 20 20 20 20 6e |_subr | n|
|00005a40| 5f 69 6e 66 6f 2e 6e 5f | 78 73 75 62 72 2e 78 73 |_info.n_|xsubr.xs|
|00005a50| 75 5f 73 75 62 72 0a 0a | 2f 2a 20 6c 69 73 74 20 |u_subr..|/* list |
|00005a60| 6e 6f 64 65 20 2a 2f 0a | 23 64 65 66 69 6e 65 20 |node */.|#define |
|00005a70| 6e 5f 63 61 72 20 20 20 | 20 20 20 20 20 20 20 20 |n_car | |
|00005a80| 6e 5f 69 6e 66 6f 2e 6e | 5f 78 6c 69 73 74 2e 78 |n_info.n|_xlist.x|
|00005a90| 6c 5f 63 61 72 0a 23 64 | 65 66 69 6e 65 20 6e 5f |l_car.#d|efine n_|
|00005aa0| 63 64 72 20 20 20 20 20 | 20 20 20 20 20 20 6e 5f |cdr | n_|
|00005ab0| 69 6e 66 6f 2e 6e 5f 78 | 6c 69 73 74 2e 78 6c 5f |info.n_x|list.xl_|
|00005ac0| 63 64 72 0a 23 64 65 66 | 69 6e 65 20 6e 5f 70 74 |cdr.#def|ine n_pt|
|00005ad0| 72 20 20 20 20 20 20 20 | 20 20 20 20 6e 5f 69 6e |r | n_in|
|00005ae0| 66 6f 2e 6e 5f 78 6c 69 | 73 74 2e 78 6c 5f 63 61 |fo.n_xli|st.xl_ca|
|00005af0| 72 0a 0a 2f 2a 20 69 6e | 74 65 67 65 72 20 6e 6f |r../* in|teger no|
|00005b00| 64 65 20 2a 2f 0a 23 64 | 65 66 69 6e 65 20 6e 5f |de */.#d|efine n_|
|00005b10| 69 6e 74 20 20 20 20 20 | 20 20 20 20 20 20 6e 5f |int | n_|
|00005b20| 69 6e 66 6f 2e 6e 5f 78 | 69 6e 74 2e 78 69 5f 69 |info.n_x|int.xi_i|
|00005b30| 6e 74 0a 0a 2f 2a 20 73 | 74 72 69 6e 67 20 6e 6f |nt../* s|tring no|
|00005b40| 64 65 20 2a 2f 0a 23 64 | 65 66 69 6e 65 20 6e 5f |de */.#d|efine n_|
|00005b50| 73 74 72 20 20 20 20 20 | 20 20 20 20 20 20 6e 5f |str | n_|
|00005b60| 69 6e 66 6f 2e 6e 5f 78 | 73 74 72 2e 78 73 74 5f |info.n_x|str.xst_|
|00005b70| 73 74 72 0a 23 64 65 66 | 69 6e 65 20 6e 5f 73 74 |str.#def|ine n_st|
|00005b80| 72 74 79 70 65 20 20 20 | 20 20 20 20 6e 5f 69 6e |rtype | n_in|
|00005b90| 66 6f 2e 6e 5f 78 73 74 | 72 2e 78 73 74 5f 74 79 |fo.n_xst|r.xst_ty|
|00005ba0| 70 65 0a 0a 2f 2a 20 6f | 62 6a 65 63 74 20 6e 6f |pe../* o|bject no|
|00005bb0| 64 65 20 2a 2f 0a 23 64 | 65 66 69 6e 65 20 6e 5f |de */.#d|efine n_|
|00005bc0| 6f 62 63 6c 61 73 73 20 | 20 20 20 20 20 20 6e 5f |obclass | n_|
|00005bd0| 69 6e 66 6f 2e 6e 5f 78 | 6f 62 6a 2e 78 6f 5f 6f |info.n_x|obj.xo_o|
|00005be0| 62 63 6c 61 73 73 0a 23 | 64 65 66 69 6e 65 20 6e |bclass.#|define n|
|00005bf0| 5f 6f 62 64 61 74 61 20 | 20 20 20 20 20 20 20 6e |_obdata | n|
|00005c00| 5f 69 6e 66 6f 2e 6e 5f | 78 6f 62 6a 2e 78 6f 5f |_info.n_|xobj.xo_|
|00005c10| 6f 62 64 61 74 61 0a 0a | 2f 2a 20 66 69 6c 65 20 |obdata..|/* file |
|00005c20| 70 6f 69 6e 74 65 72 20 | 6e 6f 64 65 20 2a 2f 0a |pointer |node */.|
|00005c30| 23 64 65 66 69 6e 65 20 | 6e 5f 66 70 20 20 20 20 |#define |n_fp |
|00005c40| 20 20 20 20 20 20 20 20 | 6e 5f 69 6e 66 6f 2e 6e | |n_info.n|
|00005c50| 5f 78 66 70 74 72 2e 78 | 66 5f 66 70 0a 23 64 65 |_xfptr.x|f_fp.#de|
|00005c60| 66 69 6e 65 20 6e 5f 73 | 61 76 65 63 68 20 20 20 |fine n_s|avech |
|00005c70| 20 20 20 20 20 6e 5f 69 | 6e 66 6f 2e 6e 5f 78 66 | n_i|nfo.n_xf|
|00005c80| 70 74 72 2e 78 66 5f 73 | 61 76 65 63 68 0a 0a 2f |ptr.xf_s|avech../|
|00005c90| 2a 20 6e 6f 64 65 20 73 | 74 72 75 63 74 75 72 65 |* node s|tructure|
|00005ca0| 20 2a 2f 0a 74 79 70 65 | 64 65 66 20 73 74 72 75 | */.type|def stru|
|00005cb0| 63 74 20 6e 6f 64 65 20 | 7b 0a 20 20 20 20 63 68 |ct node |{. ch|
|00005cc0| 61 72 20 6e 5f 74 79 70 | 65 3b 20 20 20 20 20 20 |ar n_typ|e; |
|00005cd0| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 74 79 70 | | /* typ|
|00005ce0| 65 20 6f 66 20 6e 6f 64 | 65 20 2a 2f 0a 20 20 20 |e of nod|e */. |
|00005cf0| 20 63 68 61 72 20 6e 5f | 66 6c 61 67 73 3b 20 20 | char n_|flags; |
|00005d00| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|00005d10| 66 6c 61 67 20 62 69 74 | 73 20 2a 2f 0a 20 20 20 |flag bit|s */. |
|00005d20| 20 75 6e 69 6f 6e 20 7b | 20 20 20 20 20 20 20 20 | union {| |
|00005d30| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|00005d40| 76 61 6c 75 65 20 2a 2f | 0a 20 20 20 20 20 20 20 |value */|. |
|00005d50| 20 73 74 72 75 63 74 20 | 78 73 79 6d 20 7b 20 20 | struct |xsym { |
|00005d60| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 73 79 6d 62 | | /* symb|
|00005d70| 6f 6c 20 6e 6f 64 65 20 | 2a 2f 0a 20 20 20 20 20 |ol node |*/. |
|00005d80| 20 20 20 20 20 20 20 73 | 74 72 75 63 74 20 6e 6f | s|truct no|
|00005d90| 64 65 20 2a 78 73 79 5f | 70 6c 69 73 74 3b 20 20 |de *xsy_|plist; |
|00005da0| 20 20 20 2f 2a 20 73 79 | 6d 62 6f 6c 20 70 6c 69 | /* sy|mbol pli|
|00005db0| 73 74 20 2d 20 28 6e 61 | 6d 65 20 2e 20 70 6c 69 |st - (na|me . pli|
|00005dc0| 73 74 29 20 2a 2f 0a 20 | 20 20 20 20 20 20 20 20 |st) */. | |
|00005dd0| 20 20 20 73 74 72 75 63 | 74 20 6e 6f 64 65 20 2a | struc|t node *|
|00005de0| 78 73 79 5f 76 61 6c 75 | 65 3b 20 20 20 20 20 2f |xsy_valu|e; /|
|00005df0| 2a 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 76 61 |* the cu|rrent va|
|00005e00| 6c 75 65 20 2a 2f 0a 20 | 20 20 20 20 20 20 20 7d |lue */. | }|
|00005e10| 20 6e 5f 78 73 79 6d 3b | 0a 20 20 20 20 20 20 20 | n_xsym;|. |
|00005e20| 20 73 74 72 75 63 74 20 | 78 73 75 62 72 20 7b 20 | struct |xsubr { |
|00005e30| 20 20 20 20 20 20 20 20 | 20 2f 2a 20 73 75 62 72 | | /* subr|
|00005e40| 2f 66 73 75 62 72 20 6e | 6f 64 65 20 2a 2f 0a 20 |/fsubr n|ode */. |
|00005e50| 20 20 20 20 20 20 20 20 | 20 20 20 73 74 72 75 63 | | struc|
|00005e60| 74 20 6e 6f 64 65 20 2a | 28 2a 78 73 75 5f 73 75 |t node *|(*xsu_su|
|00005e70| 62 72 29 28 29 3b 20 2f | 2a 20 70 6f 69 6e 74 65 |br)(); /|* pointe|
|00005e80| 72 20 74 6f 20 61 6e 20 | 69 6e 74 65 72 6e 61 6c |r to an |internal|
|00005e90| 20 72 6f 75 74 69 6e 65 | 20 2a 2f 0a 20 20 20 20 | routine| */. |
|00005ea0| 20 20 20 20 7d 20 6e 5f | 78 73 75 62 72 3b 0a 20 | } n_|xsubr;. |
|00005eb0| 20 20 20 20 20 20 20 73 | 74 72 75 63 74 20 78 6c | s|truct xl|
|00005ec0| 69 73 74 20 7b 20 20 20 | 20 20 20 20 20 20 20 2f |ist { | /|
|00005ed0| 2a 20 6c 69 73 74 20 6e | 6f 64 65 20 28 63 6f 6e |* list n|ode (con|
|00005ee0| 73 29 20 2a 2f 0a 20 20 | 20 20 20 20 20 20 20 20 |s) */. | |
|00005ef0| 20 20 73 74 72 75 63 74 | 20 6e 6f 64 65 20 2a 78 | struct| node *x|
|00005f00| 6c 5f 63 61 72 3b 20 20 | 20 20 20 20 20 20 2f 2a |l_car; | /*|
|00005f10| 20 74 68 65 20 63 61 72 | 20 70 6f 69 6e 74 65 72 | the car| pointer|
|00005f20| 20 2a 2f 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 | */. | |
|00005f30| 73 74 72 75 63 74 20 6e | 6f 64 65 20 2a 78 6c 5f |struct n|ode *xl_|
|00005f40| 63 64 72 3b 20 20 20 20 | 20 20 20 20 2f 2a 20 74 |cdr; | /* t|
|00005f50| 68 65 20 63 64 72 20 70 | 6f 69 6e 74 65 72 20 2a |he cdr p|ointer *|
|00005f60| 2f 0a 20 20 20 20 20 20 | 20 20 7d 20 6e 5f 78 6c |/. | } n_xl|
|00005f70| 69 73 74 3b 0a 20 20 20 | 20 20 20 20 20 73 74 72 |ist;. | str|
|00005f80| 75 63 74 20 78 69 6e 74 | 20 7b 20 20 20 20 20 20 |uct xint| { |
|00005f90| 20 20 20 20 20 2f 2a 20 | 69 6e 74 65 67 65 72 20 | /* |integer |
|00005fa0| 6e 6f 64 65 20 2a 2f 0a | 20 20 20 20 20 20 20 20 |node */.| |
|00005fb0| 20 20 20 20 69 6e 74 20 | 78 69 5f 69 6e 74 3b 20 | int |xi_int; |
|00005fc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00005fd0| 2f 2a 20 69 6e 74 65 67 | 65 72 20 76 61 6c 75 65 |/* integ|er value|
|00005fe0| 20 2a 2f 0a 20 20 20 20 | 20 20 20 20 7d 20 6e 5f | */. | } n_|
|00005ff0| 78 69 6e 74 3b 0a 20 20 | 20 20 20 20 20 20 73 74 |xint;. | st|
|00006000| 72 75 63 74 20 78 73 74 | 72 20 7b 20 20 20 20 20 |ruct xst|r { |
|00006010| 20 20 20 20 20 20 2f 2a | 20 73 74 72 69 6e 67 20 | /*| string |
|00006020| 6e 6f 64 65 20 2a 2f 0a | 20 20 20 20 20 20 20 20 |node */.| |
|00006030| 20 20 20 20 69 6e 74 20 | 78 73 74 5f 74 79 70 65 | int |xst_type|
|00006040| 3b 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |; | |
|00006050| 2f 2a 20 73 74 72 69 6e | 67 20 74 79 70 65 20 2a |/* strin|g type *|
|00006060| 2f 0a 20 20 20 20 20 20 | 20 20 20 20 20 20 63 68 |/. | ch|
|00006070| 61 72 20 2a 78 73 74 5f | 73 74 72 3b 20 20 20 20 |ar *xst_|str; |
|00006080| 20 20 20 20 20 20 20 20 | 20 20 2f 2a 20 73 74 72 | | /* str|
|00006090| 69 6e 67 20 70 6f 69 6e | 74 65 72 20 2a 2f 0a 20 |ing poin|ter */. |
|000060a0| 20 20 20 20 20 20 20 7d | 20 6e 5f 78 73 74 72 3b | }| n_xstr;|
|000060b0| 0a 20 20 20 20 20 20 20 | 20 73 74 72 75 63 74 20 |. | struct |
|000060c0| 78 6f 62 6a 20 7b 20 20 | 20 20 20 20 20 20 20 20 |xobj { | |
|000060d0| 20 2f 2a 20 6f 62 6a 65 | 63 74 20 6e 6f 64 65 20 | /* obje|ct node |
|000060e0| 2a 2f 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 73 |*/. | s|
|000060f0| 74 72 75 63 74 20 6e 6f | 64 65 20 2a 78 6f 5f 6f |truct no|de *xo_o|
|00006100| 62 63 6c 61 73 73 3b 20 | 20 20 20 2f 2a 20 63 6c |bclass; | /* cl|
|00006110| 61 73 73 20 6f 66 20 6f | 62 6a 65 63 74 20 2a 2f |ass of o|bject */|
|00006120| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 73 74 72 |. | str|
|00006130| 75 63 74 20 6e 6f 64 65 | 20 2a 78 6f 5f 6f 62 64 |uct node| *xo_obd|
|00006140| 61 74 61 3b 20 20 20 20 | 20 2f 2a 20 69 6e 73 74 |ata; | /* inst|
|00006150| 61 6e 63 65 20 64 61 74 | 61 20 2a 2f 0a 20 20 20 |ance dat|a */. |
|00006160| 20 20 20 20 20 7d 20 6e | 5f 78 6f 62 6a 3b 0a 20 | } n|_xobj;. |
|00006170| 20 20 20 20 20 20 20 73 | 74 72 75 63 74 20 78 66 | s|truct xf|
|00006180| 70 74 72 20 7b 20 20 20 | 20 20 20 20 20 20 20 2f |ptr { | /|
|00006190| 2a 20 66 69 6c 65 20 70 | 6f 69 6e 74 65 72 20 6e |* file p|ointer n|
|000061a0| 6f 64 65 20 2a 2f 0a 20 | 20 20 20 20 20 20 20 20 |ode */. | |
|000061b0| 20 20 20 46 49 4c 45 20 | 2a 78 66 5f 66 70 3b 20 | FILE |*xf_fp; |
|000061c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|000061d0| 2a 20 74 68 65 20 66 69 | 6c 65 20 70 6f 69 6e 74 |* the fi|le point|
|000061e0| 65 72 20 2a 2f 0a 20 20 | 20 20 20 20 20 20 20 20 |er */. | |
|000061f0| 20 20 69 6e 74 20 78 66 | 5f 73 61 76 65 63 68 3b | int xf|_savech;|
|00006200| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 2f 2a | | /*|
|00006210| 20 6c 6f 6f 6b 61 68 65 | 61 64 20 63 68 61 72 61 | lookahe|ad chara|
|00006220| 63 74 65 72 20 66 6f 72 | 20 69 6e 70 75 74 20 66 |cter for| input f|
|00006230| 69 6c 65 73 20 2a 2f 0a | 20 20 20 20 20 20 20 20 |iles */.| |
|00006240| 7d 20 6e 5f 78 66 70 74 | 72 3b 0a 20 20 20 20 7d |} n_xfpt|r;. }|
|00006250| 20 6e 5f 69 6e 66 6f 3b | 0a 7d 20 4e 4f 44 45 3b | n_info;|.} NODE;|
|00006260| 0a 0a 2f 2a 20 65 78 65 | 63 75 74 69 6f 6e 20 63 |../* exe|cution c|
|00006270| 6f 6e 74 65 78 74 20 66 | 6c 61 67 73 20 2a 2f 0a |ontext f|lags */.|
|00006280| 23 64 65 66 69 6e 65 20 | 43 46 5f 47 4f 20 20 20 |#define |CF_GO |
|00006290| 20 20 20 20 20 20 20 20 | 31 0a 23 64 65 66 69 6e | |1.#defin|
|000062a0| 65 20 43 46 5f 52 45 54 | 55 52 4e 20 20 20 20 20 |e CF_RET|URN |
|000062b0| 20 20 32 0a 23 64 65 66 | 69 6e 65 20 43 46 5f 54 | 2.#def|ine CF_T|
|000062c0| 48 52 4f 57 20 20 20 20 | 20 20 20 20 34 0a 23 64 |HROW | 4.#d|
|000062d0| 65 66 69 6e 65 20 43 46 | 5f 45 52 52 4f 52 20 20 |efine CF|_ERROR |
|000062e0| 20 20 20 20 20 20 38 0a | 0a 2f 2a 20 65 78 65 63 | 8.|./* exec|
|000062f0| 75 74 69 6f 6e 20 63 6f | 6e 74 65 78 74 20 2a 2f |ution co|ntext */|
|00006300| 0a 74 79 70 65 64 65 66 | 20 73 74 72 75 63 74 20 |.typedef| struct |
|00006310| 63 6f 6e 74 65 78 74 20 | 7b 0a 20 20 20 20 69 6e |context |{. in|
|00006320| 74 20 63 5f 66 6c 61 67 | 73 3b 20 20 20 20 20 20 |t c_flag|s; |
|00006330| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00006340| 20 20 2f 2a 20 63 6f 6e | 74 65 78 74 20 74 79 70 | /* con|text typ|
|00006350| 65 20 66 6c 61 67 73 20 | 2a 2f 0a 20 20 20 20 73 |e flags |*/. s|
|00006360| 74 72 75 63 74 20 6e 6f | 64 65 20 2a 63 5f 65 78 |truct no|de *c_ex|
|00006370| 70 72 3b 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |pr; | |
|00006380| 20 20 20 2f 2a 20 65 78 | 70 72 65 73 73 69 6f 6e | /* ex|pression|
|00006390| 20 28 74 79 70 65 20 64 | 65 70 65 6e 64 61 6e 74 | (type d|ependant|
|000063a0| 29 20 2a 2f 0a 20 20 20 | 20 6a 6d 70 5f 62 75 66 |) */. | jmp_buf|
|000063b0| 20 63 5f 6a 6d 70 62 75 | 66 3b 20 20 20 20 20 20 | c_jmpbu|f; |
|000063c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2a 20 | | /* |
|000063d0| 6c 6f 6e 67 6a 6d 70 20 | 63 6f 6e 74 65 78 74 20 |longjmp |context |
|000063e0| 2a 2f 0a 20 20 20 20 73 | 74 72 75 63 74 20 63 6f |*/. s|truct co|
|000063f0| 6e 74 65 78 74 20 2a 63 | 5f 78 6c 63 6f 6e 74 65 |ntext *c|_xlconte|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.