-
Notifications
You must be signed in to change notification settings - Fork 7
/
debug1.lisp
196 lines (178 loc) · 6.54 KB
/
debug1.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
(FILEHEADER DEBUG1)
(PRINT 'DEBUG1-PACKAGE)
(PRINT '(VERSION 6))
(DEFINEQ
(*ARGLIST
(LAMBDA (X) (CADR (GETD X))))
(BREAK-BT
(LAMBDA (AL BTV)
(PRINTLEVEL
(PRINTLEVEL *PRINTLEVEL)
(MAPC (BREAK-SKIP1 (ALIST T)) 'BT-PRINT 'BREAK-SKIP))))
(BREAK-EVAL
[LAMBDA (BREAK-FORM)
(PROG ((*BRKFLG NIL) BREAK-EVAL)
(RETURN (COND (*BRKEVAL !VALUE)
((OR (NLISTP BREAK-FORM)
(CAR BREAK-FORM))
(EVAL BREAK-FORM))
((APPLY
(CADR BREAK-FORM)
(CDDR BREAK-FORM])
(BREAK-SKIP
[LAMBDA (X)
(PROG NIL
LOOP (RETURN (AND X
(SELECTQ
(CAADR X)
(BREAK-EVAL (BREAK-SKIP1 X))
(*FORM (CDR X))
(COND (BTV (CDR X))
(T (SETQ X (CDR X)) (GO LOOP])
(BREAK-SKIP1
[LAMBDA (X)
(PROG NIL
LOOP (COND ((NULL (SETQ X (CDR X))) (RETURN NIL))
((EQ (CAAR X) '*FORM)
(SELECTQ
(CADAR X)
[(BREAK11 SYSERROR)
(RETURN (CONS '**BREAK** (CDR X]
(GO LOOP)))
(T (GO LOOP])
(BREAK1
(NLAMBDA L (APPLYSTK 'BREAK11 L (BINDENV L))))
(BREAK11
[LAMBDA (BRKEXP BRKWHEN BRKFN BRKCOMS SYSERROR)
((FSUBR . COND)
(*BRKFLG ((SUBR . EVAL) BRKEXP))
(((FSUBR . PROG)
((*BR1 ((SUBR . IOTAB) 1 T))
(*BR2 ((SUBR . IOTAB) 5 T))
(*BRKFLG T))
(RETURN (PROG (COM *BRKEVAL
(*BRKFLG T)
(AL (BINDENV BRKEXP))
!VALUE)
(OR (BREAK-EVAL BRKWHEN)
(RETURN (BREAK-EVAL BRKEXP)))
(IOTAB 2 (IOTAB 4))
BREAK11LOOP
(PRINT (LIST BRKFN 'BROKEN))
L (SETQ COM (COM-READ BRKCOMS :))
[SELECTQ COM
[?= (OR SYSERROR
(PRVARS1
(*ARGLIST BRKFN)
(PRVARS (*ARGLIST BRKFN) AL]
(! (GO* BREAKOUT))
(OK (RETURN (BREAK-EVAL BRKEXP)))
[GO (RETURN
(PRINT
(BREAK-EVAL BRKEXP)
(PRIN2 BRKFN)
(PRIN1 " = "]
[RETURN
(SETQ *BRKEVAL NIL)
(RETURN
(BREAK-EVAL (COM-READ BRKCOMS :]
(EVAL (SETQ *BRKEVAL NIL)
(SETQ !VALUE (BREAK-EVAL BRKEXP))
(PRINTL-SP BRKFN 'EVALUATED)
(SETQ *BRKEVAL T))
(!EVAL
(SETQ BRKCOMS
(APPEND '(UB EVAL BR) BRKCOMS)))
(!OK (SETQ BRKCOMS
(APPEND '(!EVAL OK) BRKCOMS)))
(!GO (SETQ BRKCOMS
(APPEND '(!EVAL GO) BRKCOMS)))
(UB (UNBREAK1 BRKFN))
(BR (REBREAK1 BRKFN))
(BT (BREAK-BT AL))
(BTV (BREAK-BT AL T))
((LAMBDA *BRKEVAL
(PRINT (BREAK-EVAL COM]
(GO L))
(IOTAB 1 *BR1)
(IOTAB 5 *BR2))
BREAKOUT
(GO* BREAK11LOOP)
(RESET])
(BT-PRINT
[LAMBDA (X)
(COND ((NLISTP X) (PRINT X))
((SELECTQ
(CAR X)
[*FORM (PRIN2L-SP
(CAR X)
(SELECTQ
(CADR X)
(PROG '*PROG)
(CDR X]
(PRIN2L-SP (CAR X) '= (CDR X])
(ERRORB
(LAMBDA NIL (GO* ERRORSET) (RESET)))
(ERRORN
(LAMBDA NIL (CAR (ERRORSET 'ERRTYPE))))
(ERRORSET
(LAMBDA (ERRFORM ERRFLG)
(PROG NIL
(RETURN (LIST (EVAL ERRFORM)))
ERRORSET
(RETURN NIL))))
(ERSETQ
(NLAMBDA (ERSETX) (ERRORSET ERSETX T)))
(HELP
(LAMBDA (HELPX HELPY)
(PROG NIL
(TERPRI T)
(PRIN1 "HELP:" T)
(TERPRI T)
(PRIN1 HELPX T)
(TERPRI T)
(PRIN1 HELPY T)
LOOP (NLSETQ (PROGN (TERPRI T)
(PRIN1 '":" T)
(PRINT (EVAL (READ T)) T)))
(GO LOOP))))
(KWOTE
(LAMBDA (X) (LIST 'QUOTE X)))
(NLSETQ
(NLAMBDA (NLSETX) (ERRORSET NLSETX NIL)))
(PRVARS
[LAMBDA (L AL)
(COND ((NULL L) NIL)
((ATOM L) (EVSTK L AL))
(T (CONS (EVSTK (CAR L) AL) (PRVARS (CDR L) AL])
(PRVARS1
[LAMBDA (VARS VALS)
(COND ((NULL VARS) NIL)
((NLISTP VARS) (PRIN2L-SP VARS '= VALS))
(T (PRIN2L-SP (CAR VARS) '= (CAR VALS))
(PRVARS1 (CDR VARS) (CDR VALS])
(SYSERROR
(LAMBDA (ERRTYPE FN ARG FORM *BRKFLG)
[COND (ERRFLG (OUTUNIT
(OUTUNIT T)
(ERRORMESS ERRTYPE)
(PRIN2L-SP FN '- ARG]
(GO* ERRORSET)
(BREAK11 FORM T FN NIL T)))
)
(PRINT 'DEBUG1FNS)
(RPAQQ DEBUG1FNS
(*ARGLIST BREAK-BT BREAK-EVAL BREAK-SKIP BREAK-SKIP1 BREAK1 BREAK11
BT-PRINT ERRORB ERRORN ERRORSET ERSETQ HELP KWOTE NLSETQ PRVARS
PRVARS1 SYSERROR))
(RPAQQ DEBUG1COMS DEBUG1-PACKAGE)
(RPAQ DEBUG1GENNR 6)
(PRINT 'DEBUG1VARS)
[RPAQQ DEBUG1VARS
((P (RPAQ *PRINTLEVEL 3)
(RPAQ *BRKFLG NIL)
(RPAQ ERRFLG T]
(RPAQ *PRINTLEVEL 3)
(RPAQ *BRKFLG NIL)
(RPAQ ERRFLG T)
STOP