-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathmacros.zil
409 lines (327 loc) · 10.7 KB
/
macros.zil
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
;*****************************************************************************
; "game : SHERLOCK!"
; "file : MACROS.ZIL"
; "auth : $Author: DEB $"
; "date : $Date: 24 Sep 1987 21:15:56 $"
; "rev : $Revision: 1.4 $"
; "vers : 1.00"
;*****************************************************************************
;-----------------------------------------------------------------------------
; "default property values"
;-----------------------------------------------------------------------------
<PROPDEF VALUE 0>
<PROPDEF SIZE 0>
<PROPDEF STRENGTH 10>
<PROPDEF DEXTERITY 10>
;*****************************************************************************
; "tell-tokens"
;*****************************************************************************
<TELL-TOKENS
CR <CRLF>
N * <PRINTN .X>
C * <PRINTC .X>
D * <DPRINT .X>
A * <RT-A-PRINT .X>
CA * <RT-THEO-PRINT .X T ,K-DESC-A>
AO <RT-A-PRINT>
ANY * <RT-THEO-PRINT .X <> ,K-DESC-ANY>
THE * <RT-THEO-PRINT .X>
THEO <RT-THEO-PRINT>
THEI <RT-THEI-PRINT>
CTHE * <RT-CTHEO-PRINT .X>
CTHEO <RT-CTHEO-PRINT>
CTHEI <RT-CTHEI-PRINT>
VW <RT-VW-PRINT>
INDENT <RT-INDENT-PRINT>
WRAP <RT-WRAP-PRINT>
>
<DEFINE MULTIFROB (X ATMS "AUX" (OO (OR)) (O .OO) (LL (T)) (L .LL) ATM)
<REPEAT ()
<COND
(<EMPTY? .ATMS>
<RETURN!-
<COND
(<LENGTH? .OO 1>
<ERROR .X>
)
(<LENGTH? .OO 2>
<NTH .OO 2>
)
(ELSE
<CHTYPE .OO FORM>
)
>
>
)
>
<REPEAT ()
<COND
(<EMPTY? .ATMS>
<RETURN!->
)
>
<SET ATM <NTH .ATMS 1>>
<SET L <REST <PUTREST .L
(<COND
(<TYPE? .ATM ATOM>
<CHTYPE
<COND
(<==? .X GL-PRSA>
<PARSE <STRING "V?" <SPNAME .ATM>>>
)
(<==? .X GL-P-PRSA-WORD>
<PARSE <STRING "W?" <SPNAME .ATM>>>
)
(T
.ATM
)
>
GVAL
>
)
(ELSE
.ATM
)
>)
>>>
<SET ATMS <REST .ATMS>>
<COND
(<==? <LENGTH .LL> 4>
<RETURN!->
)
>
>
<SET O <REST <PUTREST .O
(<FORM EQUAL? <CHTYPE .X GVAL> !<REST .LL>>)
>>>
<SET LL (T)>
<SET L .LL>
>
>
;*****************************************************************************
; "macro definitions"
;*****************************************************************************
;-----------------------------------------------------------------------------
; "MC-VERB?"
;-----------------------------------------------------------------------------
<DEFMAC MC-VERB? ("ARGS" ATMS)
<MULTIFROB GL-PRSA .ATMS>
>
;-----------------------------------------------------------------------------
; "MC-VERB-WORD?"
;-----------------------------------------------------------------------------
<DEFMAC MC-VERB-WORD? ("ARGS" ATMS)
<MULTIFROB GL-P-PRSA-WORD .ATMS>
>
;-----------------------------------------------------------------------------
; "MC-PRSO?"
;-----------------------------------------------------------------------------
<DEFMAC MC-PRSO? ("ARGS" ATMS)
<MULTIFROB GL-PRSO .ATMS>
>
;-----------------------------------------------------------------------------
; "MC-PRSI?"
;-----------------------------------------------------------------------------
<DEFMAC MC-PRSI? ("ARGS" ATMS)
<MULTIFROB GL-PRSI .ATMS>
>
;-----------------------------------------------------------------------------
; "MC-THIS-PRSO?"
;-----------------------------------------------------------------------------
<DEFMAC MC-THIS-PRSO? ()
<FORM ZERO? <CHTYPE GL-NOW-PRSI? GVAL>>
>
;-----------------------------------------------------------------------------
; "MC-THIS-PRSI?"
;-----------------------------------------------------------------------------
<DEFMAC MC-THIS-PRSI? ()
<FORM NOT <FORM ZERO? <CHTYPE GL-NOW-PRSI? GVAL>>>
>
;-----------------------------------------------------------------------------
; "MC-HERE?"
;-----------------------------------------------------------------------------
<DEFMAC MC-HERE? ("ARGS" ATMS)
<MULTIFROB GL-PLACE-CUR .ATMS>
>
;-----------------------------------------------------------------------------
; "MC-LISTEN?"
;-----------------------------------------------------------------------------
<DEFMAC MC-LISTEN? ("ARGS" ATMS)
<MULTIFROB GL-LISTEN-OBJ .ATMS>
>
;-----------------------------------------------------------------------------
; "MC-PROB"
;-----------------------------------------------------------------------------
<DEFMAC MC-PROB ('BASE?)
<FORM NOT <FORM L? .BASE? '<RANDOM 100>>>
>
;-----------------------------------------------------------------------------
; "MC-GET/B"
;-----------------------------------------------------------------------------
<DEFMAC MC-GET/B ('TBL 'PTR)
<FORM GET .TBL .PTR>
>
;-----------------------------------------------------------------------------
; "MC-ABS"
;-----------------------------------------------------------------------------
<DEFMAC MC-ABS ('NUM)
<FORM COND
(<FORM L? .NUM 0>
<FORM - 0 .NUM>
)
(T
.NUM
)
>
>
;-----------------------------------------------------------------------------
; "MC-SPACE"
;-----------------------------------------------------------------------------
<DEFMAC MC-SPACE ()
<FORM PRINTC 32>
>
;-----------------------------------------------------------------------------
; "MC-QUOTE?"
;-----------------------------------------------------------------------------
<DEFMAC MC-QUOTE? ()
<FORM
COND
(<FORM NOT <FORM EQUAL?
<CHTYPE GL-WINNER GVAL>
<CHTYPE CH-PLAYER GVAL>>
>
<FORM PRINTC 34>
)
>
>
;-----------------------------------------------------------------------------
; "MC-MAKE"
;-----------------------------------------------------------------------------
<DEFMAC MC-MAKE ('OBJ 'FLAG)
<FORM FSET .OBJ .FLAG>
>
;-----------------------------------------------------------------------------
; "MC-UNMAKE"
;-----------------------------------------------------------------------------
<DEFMAC MC-UNMAKE ('OBJ 'FLAG)
<FORM FCLEAR .OBJ .FLAG>
>
;-----------------------------------------------------------------------------
; "MC-IS?"
;-----------------------------------------------------------------------------
<DEFMAC MC-IS? ('OBJ 'FLAG)
<FORM FSET? .OBJ .FLAG>
>
;-----------------------------------------------------------------------------
; "MC-ISNOT?"
;-----------------------------------------------------------------------------
<DEFMAC MC-ISNOT? ('OBJ 'FLAG)
<FORM NOT <FORM FSET? .OBJ .FLAG>>
>
;-----------------------------------------------------------------------------
; "MC-NOTZERO?"
;-----------------------------------------------------------------------------
<DEFMAC MC-NOTZERO? ('TERM)
<FORM NOT <FORM ZERO? .TERM>>
>
;-----------------------------------------------------------------------------
; "MC-T?"
;-----------------------------------------------------------------------------
<DEFMAC MC-T? ('TERM)
<FORM NOT <FORM ZERO? .TERM>>
>
;-----------------------------------------------------------------------------
; "MC-THIS-WINNER?"
;-----------------------------------------------------------------------------
<DEFMAC MC-THIS-WINNER? ()
<FORM EQUAL? '.CONTEXT ',K-M-WINNER>
>
;-----------------------------------------------------------------------------
; "MC-F?"
;-----------------------------------------------------------------------------
<DEFMAC MC-F? ('TERM)
<FORM ZERO? .TERM>
>
;-----------------------------------------------------------------------------
; "MC-GET-RM-EXIT-DEST"
;-----------------------------------------------------------------------------
<DEFMAC MC-GET-RM-EXIT-DEST ('PT)
<FORM GETB .PT ',K-REXIT>
>
;-----------------------------------------------------------------------------
; "MC-GET-RM-EXIT-DOOR"
;-----------------------------------------------------------------------------
<DEFMAC MC-GET-RM-EXIT-DOOR ('PT)
<FORM GET <FORM REST .PT> '<- ,K-DEXITOBJ 1>>>
<DEFMAC DEBUGGING? ('X "OPT" 'Y)
<COND (,GL-DEBUG?
<COND (<TYPE? .X LIST>
<CHTYPE .X SPLICE>)
(T .X)>)
(T
<COND (<ASSIGNED? Y>
<COND (<TYPE? .Y LIST>
<CHTYPE .Y SPLICE>)
(T .Y)>)
(T #SPLICE ())>)>>
<DEFMAC STRLENGTH (X)
<LENGTH .X>>
<DEFMAC RT-VW-PRINT ()
<FORM PRINTB ',GL-P-PRSA-WORD>>
<DEFMAC RT-CLOCK-INC-SET ("ARGS" STUFF)
<FORM RT-DO-CLOCK-SET ',GL-TIME-UPDT-INC !.STUFF>>
<DEFMAC RT-CLOCK-DEF-SET ("ARGS" STUFF)
<FORM RT-DO-CLOCK-SET ',GL-TIME-UPDT-DEF !.STUFF>>
<DEFMAC RT-CLOCK-SET ("ARGS" STUFF)
<FORM RT-DO-CLOCK-SET ',GL-TIME !.STUFF>>
<DEFMAC RT-PARM-SET ("ARGS" STUFF)
<FORM RT-DO-CLOCK-SET ',GL-TIME-PARM !.STUFF>>
; "Generate an appropriate BTST to test the part of speech in cases where
we can get away with it. Otherwise, call RT-WT?.
EXTRA-BIT is used to test two parts of speech at the same time. Note
that all arguments after the first are evaluated at compile time, so had
better be PS? or P1? type constants."
<DEFMAC WT? ('PTR BIT "OPT" (B1:<OR FIX FALSE> 5) EXTRA-BIT)
<COND (<OR <NOT .B1>
<G? .B1 4>>
<COND (<ASSIGNED? EXTRA-BIT>
; "Handle an OR test of two parts of speech"
<FORM NOT <FORM 0? <FORM ANDB <FORM GETB .PTR ,K-P-PSOFF>
<+ .BIT .EXTRA-BIT>>>>)
(T
<FORM BTST <FORM GETB .PTR ,K-P-PSOFF> .BIT>)>)
(<ASSIGNED? EXTRA-BIT>
<ERROR CANT-TEST-FOR-TWO-PARTS-OF-SPEECH-WITH-VALUE!-ERRORS
.BIT .EXTRA-BIT WT?>)
(T
<FORM RT-WT? .PTR .BIT .B1>)>>
;"Structures created by eliminating the AUXn properties."
<GLOBAL TH-ROPE-AUX1 -1> ; "First person tied up"
<GLOBAL TH-ROPE-AUX2 -1> ; "Second person tied up"
<GLOBAL CH-BANK-GUARD-AUX1 0 <> BYTE> ; "Number of gems used to bribe him"
<GLOBAL CH-HOLMES-AUX1 0 <> BYTE> ; "Seems to be flags for holmes"
<GLOBAL CH-TRAINED-PIGEON-AUX1 0 <> BYTE> ; "Flags"
<GLOBAL CH-TRAINED-PIGEON-AUX2 0 <> BYTE>
<GLOBAL CH-TRAINED-PIGEON-AUX3 0> ; "An object"
<GLOBAL RM-HOLMES-STUDY-AUX1 0 <> BYTE> ; "Minutes out of study after
waking holmes"
<GLOBAL TH-BELL-AUX1 0 <> BYTE> ; "Number of times to ring Ben"
<GLOBAL TH-BELL-AUX2 0 <> BYTE> ; "Bell position?"
<GLOBAL TH-PACKET-OF-PAPER-AUX1 0 <> BYTE>
<GLOBAL TH-BOX-KEY-AUX1 0> ; "Box the key is in (number)"
<GLOBAL TH-SAFETY-DEPOSIT-BOX-AUX1 0> ; "Box number"
<GLOBAL TH-BOX-LOCK-AUX1 0>
<GLOBAL TH-DIAL-AUX1 0> ;"Direction being turned, or some such"
<GLOBAL TH-DIAL-AUX2 0>
<GLOBAL CH-WIGGINS-AUX1 0 <> BYTE> ; "True if `activated'"
<GLOBAL CH-ELIZA-DOOLITTLE-AUX1 0 <> BYTE>
<GLOBAL CH-VENDOR-AUX1 0 <> BYTE> ; "Number of haggles"
<GLOBAL TH-CAB-WHISTLE-AUX1 0 <> BYTE> ; "Number of whistles"
<GLOBAL TH-CAB-WHISTLE-AUX2 0 <> BYTE> ; "Where"
<GLOBAL TH-HANSOM-CAB-AUX1 0 <> BYTE> ; "Called before?"
<GLOBAL TH-HANSOM-CAB-AUX2 0 <> BYTE> ; "Waiting?"
<GLOBAL TH-GROWLER-CAB-AUX1 0 <> BYTE>
<GLOBAL TH-GUN-AUX1 6 <> BYTE> ; "Bullets left"
<GLOBAL TH-PHIAL-AUX1 0 <> BYTE>
<GLOBAL TH-BOAT-AUX1 0 <> BYTE>
<GLOBAL TH-SAPPHIRE-AUX1 2> ; "Number of grabs left"ct