-
Notifications
You must be signed in to change notification settings - Fork 23
/
macros.zil
121 lines (94 loc) · 2.55 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
"MACROS for TRINITY: (C)1986 Infocom, Inc. All rights reserved."
<SETG C-ENABLED? 0>
<SETG C-ENABLED 1>
<SETG C-DISABLED 0>
<TELL-TOKENS (CR CRLF) <CRLF>
(N NUM) * <PRINTN .X>
(C CHAR CHR) * <PRINTC .X>
(D DESC) * <PRINTD .X>
(A AN) * <PRINTA .X>
THE * <THE-PRINT .X>
CTHE * <CTHE-PRINT .X>
THEO <THE-PRINT>
CTHEO <CTHE-PRINT>
CTHEI <CTHEI-PRINT>
THEI <THEI-PRINT>>
<DEFMAC VERB? ("ARGS" ATMS)
<MULTIFROB PRSA .ATMS>>
<DEFMAC PRSO? ("ARGS" ATMS)
<MULTIFROB PRSO .ATMS>>
<DEFMAC PRSI? ("ARGS" ATMS)
<MULTIFROB PRSI .ATMS>>
<DEFMAC HERE? ("ARGS" ATMS)
<MULTIFROB HERE .ATMS>>
<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 PRSA>
<PARSE
<STRING "V?"
<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>>>
<DEFMAC RFATAL ()
'<PROG () <PUSH 2> <RSTACK>>>
<DEFMAC PROB ('BASE?)
<FORM NOT <FORM L? .BASE? '<RANDOM 100>>>>
<DEFMAC ZIL? ()
<FORM ZERO? '<GETB 0 18>>>
<DEFMAC ENABLE ('INT)
<FORM PUT .INT ,C-ENABLED? 1>>
<DEFMAC DISABLE ('INT)
<FORM PUT .INT ,C-ENABLED? 0>>
<DEFMAC GET-REXIT-ROOM ('PT)
<FORM GET .PT ',REXIT>>
<DEFMAC GET-DOOR-OBJ ('PT)
<FORM GET .PT ',DEXITOBJ>>
<DEFMAC GET/B ('TBL 'PTR)
<FORM GET .TBL .PTR>>
<DEFMAC RMGL-SIZE ('TBL)
<FORM - <FORM / <FORM PTSIZE .TBL> 2> 1>>
<DEFMAC MAKE ('OBJ 'FLAG)
<FORM FSET .OBJ .FLAG>>
<DEFMAC UNMAKE ('OBJ 'FLAG)
<FORM FCLEAR .OBJ .FLAG>>
<DEFMAC IS? ('OBJ 'FLAG)
<FORM FSET? .OBJ .FLAG>>
<DEFMAC T? ('TERM)
<FORM NOT <FORM ZERO? .TERM>>>
<DEFMAC ABS ('NUM)
<FORM COND (<FORM L? .NUM 0>
<FORM - 0 .NUM>)
(T
.NUM)>>
<DEFMAC QUOTE? ()
<FORM COND (<FORM NOT <FORM EQUAL?
<CHTYPE WINNER GVAL>
<CHTYPE PLAYER GVAL>>>
<FORM PRINTC 34>)>>
<DEFMAC SPACE ()
<FORM PRINTC 32>>
<DEFMAC THIS-PRSO? ()
<FORM ZERO? <CHTYPE NOW-PRSI? GVAL>>>
<DEFMAC THIS-PRSI? ()
<FORM NOT <FORM ZERO? <CHTYPE NOW-PRSI? GVAL>>>>