inform6lib 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/README.md +125 -0
- data/Rakefile +65 -0
- data/lib/inform/English.h.rb +1279 -0
- data/lib/inform/Grammar.h.inf.rb +350 -0
- data/lib/inform/Parser.h.rb +145 -0
- data/lib/inform/VerbLib.h.rb +77 -0
- data/lib/inform/infix.h.inf.rb +58 -0
- data/lib/inform/infix.h.rb +1064 -0
- data/lib/inform/linklpa.h.rb +139 -0
- data/lib/inform/linklv.h.rb +174 -0
- data/lib/inform/parserm.h.rb +5884 -0
- data/lib/inform/verblibm.h.rb +2481 -0
- metadata +57 -0
|
@@ -0,0 +1,1064 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
# frozen_string_literal: false
|
|
3
|
+
|
|
4
|
+
# ==============================================================================
|
|
5
|
+
# INFIX: Support for the optional library debugger extension "Infix".
|
|
6
|
+
#
|
|
7
|
+
# Supplied for use with Inform 6 -- Release 6/11 -- Serial number 040227
|
|
8
|
+
#
|
|
9
|
+
# Copyright Graham Nelson 1993-2004 but freely usable (see manuals)
|
|
10
|
+
#
|
|
11
|
+
# This file is automatically Included in your game file by "Grammar" if you
|
|
12
|
+
# supply the -X compiler switch.
|
|
13
|
+
# ==============================================================================
|
|
14
|
+
|
|
15
|
+
# Copyright Nels Nelson 2008-2022 but freely usable (see license)
|
|
16
|
+
#
|
|
17
|
+
# You should have received a copy of the Artistic License
|
|
18
|
+
# along with the Inform6 Ruby Port.
|
|
19
|
+
#
|
|
20
|
+
# If not, see <https://www.perlfoundation.org/artistic-license-20.html>.
|
|
21
|
+
|
|
22
|
+
# ------------------------------------------------------------------------------
|
|
23
|
+
|
|
24
|
+
if defined? DEBUG_INFIX
|
|
25
|
+
|
|
26
|
+
# TODO: Port to Ruby
|
|
27
|
+
|
|
28
|
+
# Constant INFIXTT_NUMBER 0;
|
|
29
|
+
# Constant INFIXTT_ARRAY 1;
|
|
30
|
+
# Constant INFIXTT_ROUTINE 2;
|
|
31
|
+
# Constant INFIXTT_CONSTANT 3;
|
|
32
|
+
# Constant INFIXTT_DWORD 4;
|
|
33
|
+
# Constant INFIXTT_ACTION 5;
|
|
34
|
+
# Constant INFIXTT_ATTRIBUTE 6;
|
|
35
|
+
# Constant INFIXTT_PROPERTY 7;
|
|
36
|
+
# Constant INFIXTT_GLOBAL 8;
|
|
37
|
+
# Constant INFIXTT_NAMEDOBJECT 9;
|
|
38
|
+
# Constant INFIXTT_SYSFUN 10;
|
|
39
|
+
# Constant INFIXTT_STATICSTRING 11;
|
|
40
|
+
# Constant INFIXTT_LOGICAL 12;
|
|
41
|
+
|
|
42
|
+
# Global infix_term_type;
|
|
43
|
+
# Global infix_data1;
|
|
44
|
+
# Global infix_data2;
|
|
45
|
+
# Global infix_lvalue;
|
|
46
|
+
# Global infix_parsed_lvalue;
|
|
47
|
+
# Array infix_tolowercase -> 256;
|
|
48
|
+
# #Ifdef VN_1630;
|
|
49
|
+
# Array infix_text buffer 126;
|
|
50
|
+
# #Ifnot;
|
|
51
|
+
# Array infix_text -> 128;
|
|
52
|
+
# #Endif; ! VN_
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
# [ InfixPrintAttribute x; print (string) #attribute_names_array-->x; ];
|
|
56
|
+
|
|
57
|
+
# [ InfixPrintProperty x; print (property) x; ];
|
|
58
|
+
|
|
59
|
+
# [ InfixPrintGlobal x; print (string) #global_names_array-->x; ];
|
|
60
|
+
|
|
61
|
+
# [ InfixPrintAction x; print (string) #action_names_array-->(x-#lowest_action_number); ];
|
|
62
|
+
|
|
63
|
+
# [ InfixPrintRoutine x; print (string) #routine_names_array-->(x-#lowest_routine_number); ];
|
|
64
|
+
|
|
65
|
+
# [ InfixPrintConstant x; print (string) #constant_names_array-->(x-#lowest_constant_number); ];
|
|
66
|
+
|
|
67
|
+
# [ InfixPrintArray x; print (string) #array_names_array-->(x-#lowest_array_number); ];
|
|
68
|
+
|
|
69
|
+
# [ InfixPrintFakeAction x;
|
|
70
|
+
# print (string) #fake_action_names_array-->(x-#lowest_fake_action_number); ];
|
|
71
|
+
|
|
72
|
+
# [ InfixPrintPA x n;
|
|
73
|
+
# for (n=#lowest_routine_number : n<=#highest_routine_number : n++) {
|
|
74
|
+
# if (x == Symb__Tab(INFIXTT_ROUTINE, n)) {
|
|
75
|
+
# print (InfixPrintRoutine) n; return;
|
|
76
|
+
# }
|
|
77
|
+
# }
|
|
78
|
+
# print "Routine(", x, ")";
|
|
79
|
+
# ];
|
|
80
|
+
|
|
81
|
+
# [ InfixMatchPrule PrintingRule range1 range2 wa wl t i i2 it2 itlc j k plus;
|
|
82
|
+
# itlc = infix_tolowercase;
|
|
83
|
+
# if (itlc->255 == 0) {
|
|
84
|
+
# for (j=0 : j<256 : j++) itlc->j = j;
|
|
85
|
+
# itlc->'A' = 'a'; itlc->'B' = 'b';
|
|
86
|
+
# itlc->'C' = 'c'; itlc->'D' = 'd';
|
|
87
|
+
# itlc->'E' = 'e'; itlc->'F' = 'f';
|
|
88
|
+
# itlc->'G' = 'g'; itlc->'H' = 'h';
|
|
89
|
+
# itlc->'I' = 'i'; itlc->'J' = 'j';
|
|
90
|
+
# itlc->'K' = 'k'; itlc->'L' = 'l';
|
|
91
|
+
# itlc->'M' = 'm'; itlc->'N' = 'n';
|
|
92
|
+
# itlc->'O' = 'o'; itlc->'P' = 'p';
|
|
93
|
+
# itlc->'Q' = 'q'; itlc->'R' = 'r';
|
|
94
|
+
# itlc->'S' = 's'; itlc->'T' = 't';
|
|
95
|
+
# itlc->'U' = 'u'; itlc->'V' = 'v';
|
|
96
|
+
# itlc->'W' = 'w'; itlc->'X' = 'x';
|
|
97
|
+
# itlc->'Y' = 'y'; itlc->'Z' = 'z';
|
|
98
|
+
# }
|
|
99
|
+
# switch(PrintingRule) {
|
|
100
|
+
# InfixPrintAttribute:
|
|
101
|
+
# if (wa->0 == '~') { wl--; wa++; plus = 100; } ! A tilde
|
|
102
|
+
# t = #attribute_names_array;
|
|
103
|
+
# InfixPrintProperty: t = #property_names_array;
|
|
104
|
+
# InfixPrintAction: t = #action_names_array;
|
|
105
|
+
# InfixPrintFakeAction: t = #fake_action_names_array;
|
|
106
|
+
# InfixPrintGlobal: t = #global_names_array;
|
|
107
|
+
# InfixPrintRoutine: t = #routine_names_array;
|
|
108
|
+
# InfixPrintAction: t = #constant_names_array;
|
|
109
|
+
# InfixPrintArray: t = #array_names_array;
|
|
110
|
+
# }
|
|
111
|
+
|
|
112
|
+
# i2 = range2-range1; it2 = infix_text+2;
|
|
113
|
+
# for (i=0 : i<=i2 : i++) {
|
|
114
|
+
# infix_text-->0 = 62; @output_stream 3 infix_text;
|
|
115
|
+
# if (t) print (string) t-->i; else PrintingRule(i+range1);
|
|
116
|
+
# @output_stream -3;
|
|
117
|
+
# k = infix_text-->0;
|
|
118
|
+
# if (k ~= wl) jump XL;
|
|
119
|
+
# if (itlc->(it2->0) ~= wa->0) jump XL;
|
|
120
|
+
# for (j=1 : j<k : j++)
|
|
121
|
+
# if (itlc->(it2->j) ~= wa->j) jump XL;
|
|
122
|
+
# parsed_number = i + range1 + plus;
|
|
123
|
+
# rtrue;
|
|
124
|
+
# .XL;
|
|
125
|
+
# }
|
|
126
|
+
# rfalse;
|
|
127
|
+
# ];
|
|
128
|
+
|
|
129
|
+
# [ InfixActionToken;
|
|
130
|
+
# if (InfixMatchPrule(InfixPrintAction, #lowest_action_number,
|
|
131
|
+
# #highest_action_number, WordAddress(wn), WordLength(wn))) {
|
|
132
|
+
# wn++; infix_lvalue = parsed_number; return 0;
|
|
133
|
+
# }
|
|
134
|
+
# if (InfixMatchPrule(InfixPrintFakeAction, #lowest_fake_action_number,
|
|
135
|
+
# #highest_fake_action_number, WordAddress(wn), WordLength(wn))) {
|
|
136
|
+
# wn++; infix_lvalue = parsed_number; return 0;
|
|
137
|
+
# }
|
|
138
|
+
# return -1;
|
|
139
|
+
# ];
|
|
140
|
+
|
|
141
|
+
# [ InfixRvalueTerm n w i initial_wn wa wl sign base digit dcount;
|
|
142
|
+
|
|
143
|
+
# initial_wn = wn;
|
|
144
|
+
|
|
145
|
+
# infix_parsed_lvalue = -1;
|
|
146
|
+
# infix_term_type = INFIXTT_NUMBER;
|
|
147
|
+
|
|
148
|
+
# w = NextWordStopped();
|
|
149
|
+
# if (w == -1) return -1;
|
|
150
|
+
|
|
151
|
+
# wa = WordAddress(wn-1);
|
|
152
|
+
# wl = WordLength(wn-1);
|
|
153
|
+
# if (wa->0 == '-' or '$' or '0' or '1' or '2' or '3'
|
|
154
|
+
# or '4' or '5' or '6' or '7' or '8' or '9') {
|
|
155
|
+
# ! Parse decimal, hex or binary number
|
|
156
|
+
|
|
157
|
+
# sign = 1; base = 10; dcount = 0;
|
|
158
|
+
# if (wa->0 == '-') { sign = -1; wl--; wa++; }
|
|
159
|
+
# else {
|
|
160
|
+
# if (wa->0 == '$') { base = 16; wl--; wa++; }
|
|
161
|
+
# if (wa->0 == '$') { base = 2; wl--; wa++; }
|
|
162
|
+
# }
|
|
163
|
+
# if (wl == 0) return -1;
|
|
164
|
+
# n = 0;
|
|
165
|
+
# while (wl > 0) {
|
|
166
|
+
# if (wa->0 >= 'a') digit = wa->0 - 'a' + 10;
|
|
167
|
+
# else digit = wa->0 - '0';
|
|
168
|
+
# dcount++;
|
|
169
|
+
# switch (base) {
|
|
170
|
+
# 2:
|
|
171
|
+
# if (dcount == 17) return -1;
|
|
172
|
+
# 10:
|
|
173
|
+
# if (dcount == 6) return -1;
|
|
174
|
+
# if (dcount == 5) {
|
|
175
|
+
# if (n > 3276) return -1;
|
|
176
|
+
# if (n == 3276) {
|
|
177
|
+
# if (sign == 1 && digit > 7) return -1;
|
|
178
|
+
# if (sign == -1 && digit > 8) return -1;
|
|
179
|
+
# }
|
|
180
|
+
# }
|
|
181
|
+
# 16:
|
|
182
|
+
# if (dcount == 5) return -1;
|
|
183
|
+
# }
|
|
184
|
+
# if (digit >= 0 && digit < base) n = base*n + digit;
|
|
185
|
+
# else return -1;
|
|
186
|
+
# wl--; wa++;
|
|
187
|
+
# }
|
|
188
|
+
# parsed_number = n*sign; return 1;
|
|
189
|
+
# }
|
|
190
|
+
|
|
191
|
+
# ! Parse character constant 'a'
|
|
192
|
+
|
|
193
|
+
# if (wl == 3 && wa->0 == ''' && wa->2 == ''') {
|
|
194
|
+
# parsed_number = wa->1; return 1;
|
|
195
|
+
# }
|
|
196
|
+
|
|
197
|
+
# ! ##Action, 'dword'
|
|
198
|
+
|
|
199
|
+
# switch (w) {
|
|
200
|
+
# '##':
|
|
201
|
+
# infix_term_type = INFIXTT_ACTION;
|
|
202
|
+
# w = NextWordStopped(); if (w == -1) return -1;
|
|
203
|
+
# wn--;
|
|
204
|
+
# if (InfixActionToken() == 0) return 1;
|
|
205
|
+
# return -1;
|
|
206
|
+
# '^^':
|
|
207
|
+
# infix_term_type = INFIXTT_DWORD;
|
|
208
|
+
# w = NextWordStopped(); if (w == -1) return -1;
|
|
209
|
+
# parsed_number = w; return 1;
|
|
210
|
+
# }
|
|
211
|
+
|
|
212
|
+
# ! Test for attribute, property, class name, variable name, array name, routine
|
|
213
|
+
# ! name, constant name
|
|
214
|
+
|
|
215
|
+
# wn--;
|
|
216
|
+
# if ((wa->0 >= 'a' && wa->0 <= 'z') ||
|
|
217
|
+
# (wa->0 >= 'A' && wa->0 <= 'Z') ||
|
|
218
|
+
# wa->0 == '_') {
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
# infix_term_type = INFIXTT_ATTRIBUTE;
|
|
222
|
+
# if (InfixMatchPrule(InfixPrintAttribute, #lowest_attribute_number,
|
|
223
|
+
# #highest_attribute_number, wa, wl)) {
|
|
224
|
+
# wn++; return 1; }
|
|
225
|
+
|
|
226
|
+
# infix_term_type = INFIXTT_PROPERTY;
|
|
227
|
+
# if (InfixMatchPrule(InfixPrintProperty, #lowest_property_number,
|
|
228
|
+
# #highest_property_number, wa, wl)) {
|
|
229
|
+
# wn++; return 1; }
|
|
230
|
+
|
|
231
|
+
# infix_term_type = INFIXTT_GLOBAL;
|
|
232
|
+
# if (InfixMatchPrule(InfixPrintGlobal, #lowest_global_number,
|
|
233
|
+
# #highest_global_number, wa, wl)) {
|
|
234
|
+
# infix_parsed_lvalue = parsed_number-16;
|
|
235
|
+
# parsed_number = #globals_array-->infix_parsed_lvalue;
|
|
236
|
+
# wn++; return 1;
|
|
237
|
+
# }
|
|
238
|
+
|
|
239
|
+
# infix_term_type = INFIXTT_ARRAY;
|
|
240
|
+
# if (InfixMatchPrule(InfixPrintArray, #lowest_array_number,
|
|
241
|
+
# #highest_array_number, wa, wl)) {
|
|
242
|
+
# infix_parsed_lvalue = parsed_number;
|
|
243
|
+
# parsed_number = Symb__Tab(INFIXTT_ARRAY,parsed_number);
|
|
244
|
+
# infix_data1 = temp__global3;
|
|
245
|
+
# infix_data2 = temp__global2;
|
|
246
|
+
# wn++; return 1;
|
|
247
|
+
# }
|
|
248
|
+
|
|
249
|
+
# infix_term_type = INFIXTT_ROUTINE;
|
|
250
|
+
# if (InfixMatchPrule(InfixPrintRoutine, #lowest_routine_number,
|
|
251
|
+
# #highest_routine_number, wa, wl)) {
|
|
252
|
+
# infix_parsed_lvalue = parsed_number;
|
|
253
|
+
# parsed_number = Symb__Tab(INFIXTT_ROUTINE,parsed_number);
|
|
254
|
+
# infix_data1 = temp__global3;
|
|
255
|
+
# infix_data2 = temp__global2;
|
|
256
|
+
# wn++; return 1;
|
|
257
|
+
# }
|
|
258
|
+
|
|
259
|
+
# infix_term_type = INFIXTT_CONSTANT;
|
|
260
|
+
# if (InfixMatchPrule(InfixPrintConstant, #lowest_constant_number,
|
|
261
|
+
# #highest_constant_number, wa, wl)) {
|
|
262
|
+
# infix_parsed_lvalue = parsed_number;
|
|
263
|
+
# parsed_number = Symb__Tab(INFIXTT_CONSTANT,parsed_number);
|
|
264
|
+
# infix_data1 = temp__global3;
|
|
265
|
+
# infix_data2 = temp__global2;
|
|
266
|
+
# wn++; return 1;
|
|
267
|
+
# }
|
|
268
|
+
|
|
269
|
+
# switch (w) {
|
|
270
|
+
# 'parent', 'child', 'children',
|
|
271
|
+
# 'random', 'metaclass', 'sibling':
|
|
272
|
+
# parsed_number = w;
|
|
273
|
+
# infix_parsed_lvalue = INFIXTT_SYSFUN;
|
|
274
|
+
# wn++; return 1;
|
|
275
|
+
# }
|
|
276
|
+
# }
|
|
277
|
+
|
|
278
|
+
# infix_term_type = INFIXTT_NAMEDOBJECT;
|
|
279
|
+
|
|
280
|
+
# wn = initial_wn; i = ParseToken(SCOPE_TT, InfixBigScope);
|
|
281
|
+
|
|
282
|
+
# if (i == GPR_REPARSE) return i;
|
|
283
|
+
# if (i > GPR_MULTIPLE) {
|
|
284
|
+
# print "(", (name) i, " (", i, "))^";
|
|
285
|
+
# parsed_number = i; return 1;
|
|
286
|
+
# }
|
|
287
|
+
# return -1;
|
|
288
|
+
# ]; ! end of InfixRvalueTerm
|
|
289
|
+
|
|
290
|
+
# [ InfixBigScope x;
|
|
291
|
+
# if (scope_stage == 1) return false; ! No multiples here
|
|
292
|
+
# if (scope_stage == 2) {
|
|
293
|
+
# objectloop (x ofclass Object) PlaceInScope(x);
|
|
294
|
+
# return true; ! That's the whole scope
|
|
295
|
+
# }
|
|
296
|
+
# print "; I'm unable to make any sense of that term.^";
|
|
297
|
+
# ];
|
|
298
|
+
|
|
299
|
+
# [ InfixCheckLineSpaced wa wl i force altered;
|
|
300
|
+
# for (i=1 : i<=parse->1 : i++) {
|
|
301
|
+
# wa = WordAddress(i);
|
|
302
|
+
# wl = WordLength(i);
|
|
303
|
+
# if (wl > 3 && wa->0 == ''' && wa->(wl-1) == ''') {
|
|
304
|
+
# wa->(wl-1) = ' ';
|
|
305
|
+
# if (wa->(wl-2) == '/' && wa->(wl-3) == '/') {
|
|
306
|
+
# wa->(wl-2) = ' ';
|
|
307
|
+
# wa->(wl-3) = ' ';
|
|
308
|
+
# }
|
|
309
|
+
# LTI_Insert(wa-buffer, ''');
|
|
310
|
+
# LTI_Insert(wa-buffer + 2, ' ');
|
|
311
|
+
# altered = true; break;
|
|
312
|
+
# }
|
|
313
|
+
# }
|
|
314
|
+
# for (i=2 : i<buffer->1 + 2 : i++) {
|
|
315
|
+
# force = false;
|
|
316
|
+
# if (buffer->i == '-' && buffer->(i+1) == '-' && buffer->(i+2) == '>')
|
|
317
|
+
# force = true;
|
|
318
|
+
# if (force) {
|
|
319
|
+
# if (i>2 && buffer->(i-1) ~= ' ') {
|
|
320
|
+
# LTI_Insert(i++, ' '); altered = true;
|
|
321
|
+
# }
|
|
322
|
+
# if (buffer->(i+3) ~= ' ') {
|
|
323
|
+
# LTI_Insert(i+3, ' '); i++; altered = true;
|
|
324
|
+
# }
|
|
325
|
+
# i = i + 2; continue;
|
|
326
|
+
# }
|
|
327
|
+
|
|
328
|
+
# if (buffer->i == ':' && buffer->(i+1) == ':') force = true;
|
|
329
|
+
# if (buffer->i == '-' && buffer->(i+1) == '>') force = true;
|
|
330
|
+
# if (buffer->i == '.' && buffer->(i+1) == '&') {
|
|
331
|
+
# buffer->i = ']'; force = true;
|
|
332
|
+
# }
|
|
333
|
+
# if (buffer->i == '.' && buffer->(i+1) == '#') {
|
|
334
|
+
# buffer->i = ']'; force = true;
|
|
335
|
+
# }
|
|
336
|
+
# if (buffer->i == ']' && buffer->(i+1) == '&') force = true;
|
|
337
|
+
# if (buffer->i == ']' && buffer->(i+1) == '#') force = true;
|
|
338
|
+
# if (buffer->i == '+' && buffer->(i+1) == '+') force = true;
|
|
339
|
+
# if (buffer->i == '-' && buffer->(i+1) == '-') force = true;
|
|
340
|
+
# if (buffer->i == '&' && buffer->(i+1) == '&') force = true;
|
|
341
|
+
# if (buffer->i == '|' && buffer->(i+1) == '|') force = true;
|
|
342
|
+
# if (buffer->i == '~' && buffer->(i+1) == '~') force = true;
|
|
343
|
+
|
|
344
|
+
# if (buffer->i == '=' && buffer->(i+1) == '=') force = true;
|
|
345
|
+
# if (buffer->i == '~' && buffer->(i+1) == '=') force = true;
|
|
346
|
+
# if (buffer->i == '>' && buffer->(i+1) == '=') force = true;
|
|
347
|
+
# if (buffer->i == '<' && buffer->(i+1) == '=') force = true;
|
|
348
|
+
# if (buffer->i == '#' && buffer->(i+1) == '#') force = true;
|
|
349
|
+
|
|
350
|
+
# if (force) {
|
|
351
|
+
# if (i > 2 && buffer->(i-1) ~= ' ') {
|
|
352
|
+
# LTI_Insert(i++, ' '); altered = true;
|
|
353
|
+
# }
|
|
354
|
+
# if (buffer->(i+2) ~= ' ') {
|
|
355
|
+
# LTI_Insert(i+2, ' '); i++; altered = true;
|
|
356
|
+
# }
|
|
357
|
+
# i = i + 1; continue;
|
|
358
|
+
# }
|
|
359
|
+
|
|
360
|
+
# if (buffer->i == '+') force = true;
|
|
361
|
+
# if (buffer->i == '-') force = true;
|
|
362
|
+
# if (buffer->i == '*') force = true;
|
|
363
|
+
# if (buffer->i == '/') force = true;
|
|
364
|
+
# if (buffer->i == '%') force = true;
|
|
365
|
+
# if (buffer->i == '(') force = true;
|
|
366
|
+
# if (buffer->i == ')') force = true;
|
|
367
|
+
# if (buffer->i == '<' && buffer->(i-1) ~= ';') force = true;
|
|
368
|
+
# if (buffer->i == '>') force = true;
|
|
369
|
+
# if (buffer->i == ',') force = true;
|
|
370
|
+
# if (buffer->i == '.') force = true;
|
|
371
|
+
# if (buffer->i == '&') force = true;
|
|
372
|
+
# if (buffer->i == '|') force = true;
|
|
373
|
+
# if (buffer->i == '~') force = true;
|
|
374
|
+
# if (buffer->i == '=') force = true;
|
|
375
|
+
# if (force) {
|
|
376
|
+
# if (i > 2 && buffer->(i-1) ~= ' ') {
|
|
377
|
+
# LTI_Insert(i++, ' '); altered = true;
|
|
378
|
+
# }
|
|
379
|
+
# if (buffer->(i+1) ~= ' ') {
|
|
380
|
+
# LTI_Insert(i+1, ' '); i++; altered = true;
|
|
381
|
+
# }
|
|
382
|
+
# }
|
|
383
|
+
# }
|
|
384
|
+
# for (i=2 : i<buffer->1 + 2 : i++)
|
|
385
|
+
# if (buffer->i == '~') { buffer->i = '['; altered = true; }
|
|
386
|
+
# return altered;
|
|
387
|
+
# ]; ! end of InfixCheckLineSpaced
|
|
388
|
+
|
|
389
|
+
# Array InfixRV_rvals --> 32;
|
|
390
|
+
# Array InfixRV_lvals --> 32;
|
|
391
|
+
# Array InfixRV_op --> 32;
|
|
392
|
+
# Array InfixRV_lop --> 32;
|
|
393
|
+
# Array InfixRV_rop --> 32;
|
|
394
|
+
# Array InfixRV_types --> 32;
|
|
395
|
+
# Array InfixRV_commas --> 32;
|
|
396
|
+
|
|
397
|
+
# [ InfixInBounds addr index n;
|
|
398
|
+
# if (addr < #array__start || addr > #array__end)
|
|
399
|
+
# rtrue;
|
|
400
|
+
# for (n=#lowest_array_number : n<=#highest_array_number : n++) {
|
|
401
|
+
# if (addr == Symb__Tab(INFIXTT_ARRAY, n)) {
|
|
402
|
+
# if (temp__global3 == 1 or 3)
|
|
403
|
+
# temp__global2=temp__global2*WORDSIZE+WORDSIZE-1;
|
|
404
|
+
# if (index > temp__global2) {
|
|
405
|
+
# print "Array index out of range";
|
|
406
|
+
# rfalse;
|
|
407
|
+
# }
|
|
408
|
+
# }
|
|
409
|
+
# }
|
|
410
|
+
# rtrue;
|
|
411
|
+
# ];
|
|
412
|
+
|
|
413
|
+
# [ InfixRvalue acc w i n flag base expecting_term max maxi lop rop lvalside
|
|
414
|
+
# a b sysfun_f;
|
|
415
|
+
|
|
416
|
+
# if (InfixCheckLineSpaced()) return GPR_REPARSE;
|
|
417
|
+
|
|
418
|
+
# ! w = wn; for (i=0 : i<10 : i++) { wn = w; InfixRvalueTerm(); print i, "^"; }
|
|
419
|
+
# ! wn = w;
|
|
420
|
+
|
|
421
|
+
# expecting_term = true; base = 0;
|
|
422
|
+
# do {
|
|
423
|
+
# w = NextWordStopped();
|
|
424
|
+
# if (expecting_term) {
|
|
425
|
+
# switch (w) {
|
|
426
|
+
# '-//':
|
|
427
|
+
# InfixRV_rvals-->n = 'unary-'; InfixRV_types-->n = base + 8;
|
|
428
|
+
# '[//':
|
|
429
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 6;
|
|
430
|
+
# '[[':
|
|
431
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 2;
|
|
432
|
+
# '++':
|
|
433
|
+
# InfixRV_rvals-->n = 'pre++'; InfixRV_types-->n = base + 9;
|
|
434
|
+
# '--':
|
|
435
|
+
# InfixRV_rvals-->n = 'pre--'; InfixRV_types-->n = base + 9;
|
|
436
|
+
# '(//':
|
|
437
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = -3; base=base+100;
|
|
438
|
+
# ')//':
|
|
439
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = -3; base=base-100;
|
|
440
|
+
# if (base < 0) { wn--; flag = true; }
|
|
441
|
+
# -1:
|
|
442
|
+
# flag = true;
|
|
443
|
+
# default:
|
|
444
|
+
# wn--;
|
|
445
|
+
# if (InfixRValueTerm() == 1) {
|
|
446
|
+
# InfixRV_rvals-->n = parsed_number;
|
|
447
|
+
# InfixRV_lvals-->n = infix_parsed_lvalue;
|
|
448
|
+
# InfixRV_types-->n = -1;
|
|
449
|
+
# expecting_term = false;
|
|
450
|
+
# }
|
|
451
|
+
# else flag = true;
|
|
452
|
+
# }
|
|
453
|
+
# }
|
|
454
|
+
# else {
|
|
455
|
+
# expecting_term = true;
|
|
456
|
+
# switch (w) {
|
|
457
|
+
# comma_word:
|
|
458
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base;
|
|
459
|
+
# '=//':
|
|
460
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 1;
|
|
461
|
+
# '&&', '||':
|
|
462
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 2;
|
|
463
|
+
# '==', '[=', '>//', '>=', '<//', '<=', 'has', 'hasnt',
|
|
464
|
+
# 'in', 'notin', 'ofclass', 'provides':
|
|
465
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 3;
|
|
466
|
+
# 'or':
|
|
467
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 4;
|
|
468
|
+
# '+//', '-//':
|
|
469
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 5;
|
|
470
|
+
# '*//', '@{2f}//', '%//', '&//', '|//':
|
|
471
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 6;
|
|
472
|
+
# '->', '-->':
|
|
473
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 7;
|
|
474
|
+
# ']&', ']#':
|
|
475
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 10;
|
|
476
|
+
# THEN1__WD:
|
|
477
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 12;
|
|
478
|
+
# '::':
|
|
479
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = base + 13;
|
|
480
|
+
# '(//':
|
|
481
|
+
# InfixRV_rvals-->n = '(rcall';
|
|
482
|
+
# InfixRV_types-->n = base + 11; base = base + 100;
|
|
483
|
+
# ')//':
|
|
484
|
+
# InfixRV_rvals-->n = w; InfixRV_types-->n = -3;
|
|
485
|
+
# base = base - 100;
|
|
486
|
+
# if (base < 0) { wn--; flag = true; }
|
|
487
|
+
# expecting_term = false;
|
|
488
|
+
# '++':
|
|
489
|
+
# InfixRV_rvals-->n = 'post++'; InfixRV_types-->n = base + 9;
|
|
490
|
+
# expecting_term = false;
|
|
491
|
+
# '--':
|
|
492
|
+
# InfixRV_rvals-->n = 'post--'; InfixRV_types-->n = base + 9;
|
|
493
|
+
# expecting_term = false;
|
|
494
|
+
# default:
|
|
495
|
+
# flag = true;
|
|
496
|
+
# }
|
|
497
|
+
# }
|
|
498
|
+
# n++;
|
|
499
|
+
# } until (flag || n == 32);
|
|
500
|
+
# if (base > 0) return -1;
|
|
501
|
+
# n--; if (n == 0) return -1;
|
|
502
|
+
# wn--;
|
|
503
|
+
|
|
504
|
+
# for (i=0 : i<n : i++) {
|
|
505
|
+
# acc = 0; if (InfixRV_types-->i ~= -3) acc = InfixRV_rvals-->i;
|
|
506
|
+
# InfixRV_op-->i = acc;
|
|
507
|
+
# }
|
|
508
|
+
|
|
509
|
+
# for (::) {
|
|
510
|
+
|
|
511
|
+
# ! for (i=0 : i<n : i++) {
|
|
512
|
+
# ! if (InfixRV_types-->i == -1) print InfixRV_rvals-->i, " ";
|
|
513
|
+
# ! else if (InfixRV_types-->i == -3) print " # ";
|
|
514
|
+
# ! else if (InfixRV_types-->i == -2) print " ## ";
|
|
515
|
+
# ! else print (address) InfixRV_rvals-->i, "_", InfixRV_types-->i, " ";
|
|
516
|
+
# ! }
|
|
517
|
+
# ! new_line;
|
|
518
|
+
|
|
519
|
+
# max = -2;
|
|
520
|
+
# for (i=0 : i<n : i++) if (InfixRV_types-->i > max) {
|
|
521
|
+
# max = InfixRV_types-->i; maxi = i; }
|
|
522
|
+
# if (max == -1) { parsed_number = InfixRV_rvals-->maxi; return 1; }
|
|
523
|
+
|
|
524
|
+
# lop = maxi-1; rop = maxi+1;
|
|
525
|
+
# while (lop >= 0 && InfixRV_types-->lop < -1) lop--;
|
|
526
|
+
# while (rop < n && InfixRV_types-->rop < -1) rop++;
|
|
527
|
+
# if (lop >= 0) InfixRV_lop-->maxi = InfixRV_rvals-->lop;
|
|
528
|
+
# if (rop < n) InfixRV_rop-->maxi = InfixRV_rvals-->rop;
|
|
529
|
+
# flag = false;
|
|
530
|
+
# infix_term_type = INFIXTT_NUMBER;
|
|
531
|
+
# switch (InfixRV_rvals-->maxi) {
|
|
532
|
+
# comma_word:
|
|
533
|
+
# acc = (InfixRV_rvals-->rop);
|
|
534
|
+
# '=//', 'pre++', 'post++', 'pre--', 'post--':
|
|
535
|
+
# lvalside = lop;
|
|
536
|
+
# switch (InfixRV_rvals-->maxi) {
|
|
537
|
+
# '=//': acc = (InfixRV_rvals-->rop);
|
|
538
|
+
# 'pre++': acc = (InfixRV_rvals-->rop) + 1; lvalside = rop;
|
|
539
|
+
# 'pre--': acc = (InfixRV_rvals-->rop) - 1; lvalside = rop;
|
|
540
|
+
# 'post++': acc = (InfixRV_rvals-->lop) + 1;
|
|
541
|
+
# 'post--': acc = (InfixRV_rvals-->lop) - 1;
|
|
542
|
+
# }
|
|
543
|
+
# switch (InfixRV_op-->lvalside) {
|
|
544
|
+
# THEN1__WD:
|
|
545
|
+
# (InfixRV_lop-->lvalside).(InfixRV_rop-->lvalside) = acc;
|
|
546
|
+
# '->':
|
|
547
|
+
# if (InfixInBounds(InfixRV_lop-->lvalside, InfixRV_rop-->lvalside))
|
|
548
|
+
# (InfixRV_lop-->lvalside)->(InfixRV_rop-->lvalside) = acc;
|
|
549
|
+
# '-->':
|
|
550
|
+
# if (InfixInBounds(InfixRV_lop-->lvalside, WORDSIZE * InfixRV_rop-->lvalside))
|
|
551
|
+
# (InfixRV_lop-->lvalside)-->(InfixRV_rop-->lvalside) = acc;
|
|
552
|
+
# default:
|
|
553
|
+
# w = InfixRV_lvals-->lvalside; if (w == -1) return -1;
|
|
554
|
+
# @storew #globals_array w acc;
|
|
555
|
+
# }
|
|
556
|
+
# switch(InfixRV_rvals-->maxi) {
|
|
557
|
+
# 'post++': acc--;
|
|
558
|
+
# 'post--': acc++;
|
|
559
|
+
# }
|
|
560
|
+
# '(rcall':
|
|
561
|
+
# sysfun_f = false;
|
|
562
|
+
# switch (InfixRV_op-->lop) {
|
|
563
|
+
# THEN1__WD:
|
|
564
|
+
# a = InfixRV_lop-->lop; b = InfixRV_rop-->lop;
|
|
565
|
+
# default:
|
|
566
|
+
# a = InfixRV_rvals-->lop; b = call;
|
|
567
|
+
# if (InfixRV_lvals-->lop == INFIXTT_SYSFUN)
|
|
568
|
+
# sysfun_f = true;
|
|
569
|
+
# }
|
|
570
|
+
# w = 0;
|
|
571
|
+
# i = maxi + 1; base = 100;
|
|
572
|
+
# if (InfixRV_types-->i == -1 && InfixRV_rvals-->i == ')//') {
|
|
573
|
+
# if (sysfun_f) return -1;
|
|
574
|
+
# acc = a.b();
|
|
575
|
+
# }
|
|
576
|
+
# else {
|
|
577
|
+
# while (base > 0) {
|
|
578
|
+
# if (InfixRV_types-->i == -3 && InfixRV_rvals-->i == ')//') base = base - 100;
|
|
579
|
+
# if (InfixRV_types-->i == -3 && InfixRV_rvals-->i == '(//') base = base + 100;
|
|
580
|
+
# if (InfixRV_op-->i == '(rcall') base = base + 100;
|
|
581
|
+
# if (base == 100 && InfixRV_op-->i == comma_word) {
|
|
582
|
+
# InfixRV_commas-->(w++) = i;
|
|
583
|
+
# ! print "Comma found at ", i, "^";
|
|
584
|
+
# }
|
|
585
|
+
# i++;
|
|
586
|
+
# }
|
|
587
|
+
# ! print "Num args = ", w + 1, "^";
|
|
588
|
+
# ! for (i=0 : i<w : i++)
|
|
589
|
+
# ! print "arg: ", InfixRV_lop-->(InfixRV_commas-->i), "^";
|
|
590
|
+
# ! print "arg: ", InfixRV_rvals-->rop, "^";
|
|
591
|
+
# switch (w+1) {
|
|
592
|
+
# 1:
|
|
593
|
+
# if (sysfun_f) {
|
|
594
|
+
# b = InfixRV_rvals-->rop;
|
|
595
|
+
# infix_term_type = INFIXTT_NAMEDOBJECT;
|
|
596
|
+
# switch(a) {
|
|
597
|
+
# 'metaclass':
|
|
598
|
+
# acc = metaclass(b);
|
|
599
|
+
# 'parent':
|
|
600
|
+
# acc = parent(b);
|
|
601
|
+
# 'child':
|
|
602
|
+
# acc = child(b);
|
|
603
|
+
# 'children':
|
|
604
|
+
# acc = children(b);
|
|
605
|
+
# infix_term_type = INFIXTT_NUMBER;
|
|
606
|
+
# 'random':
|
|
607
|
+
# acc = random(b);
|
|
608
|
+
# infix_term_type = INFIXTT_NUMBER;
|
|
609
|
+
# 'sibling':
|
|
610
|
+
# acc = sibling(b);
|
|
611
|
+
# }
|
|
612
|
+
# }
|
|
613
|
+
# else
|
|
614
|
+
# acc = a.b(InfixRV_rvals-->rop);
|
|
615
|
+
# 2:
|
|
616
|
+
# if (sysfun_f) return -1;
|
|
617
|
+
# acc = a.b(InfixRV_lop-->(InfixRV_commas-->0),
|
|
618
|
+
# InfixRV_rvals-->rop);
|
|
619
|
+
# 3:
|
|
620
|
+
# if (sysfun_f) return -1;
|
|
621
|
+
# acc = a.b(InfixRV_lop-->(InfixRV_commas-->0),
|
|
622
|
+
# InfixRV_lop-->(InfixRV_commas-->1),
|
|
623
|
+
# InfixRV_rvals-->rop);
|
|
624
|
+
# 4:
|
|
625
|
+
# if (sysfun_f) return -1;
|
|
626
|
+
# acc = a.b(InfixRV_lop-->(InfixRV_commas-->0),
|
|
627
|
+
# InfixRV_lop-->(InfixRV_commas-->1),
|
|
628
|
+
# InfixRV_lop-->(InfixRV_commas-->2),
|
|
629
|
+
# InfixRV_rvals-->rop);
|
|
630
|
+
# 5:
|
|
631
|
+
# if (sysfun_f) return -1;
|
|
632
|
+
# acc = a.b(InfixRV_lop-->(InfixRV_commas-->0),
|
|
633
|
+
# InfixRV_lop-->(InfixRV_commas-->1),
|
|
634
|
+
# InfixRV_lop-->(InfixRV_commas-->2),
|
|
635
|
+
# InfixRV_lop-->(InfixRV_commas-->3),
|
|
636
|
+
# InfixRV_rvals-->rop);
|
|
637
|
+
# default:
|
|
638
|
+
# return -1;
|
|
639
|
+
# }
|
|
640
|
+
# }
|
|
641
|
+
# '+//': acc = (InfixRV_rvals-->lop) + (InfixRV_rvals-->rop);
|
|
642
|
+
# '-//': acc = (InfixRV_rvals-->lop) - (InfixRV_rvals-->rop);
|
|
643
|
+
# '*//': acc = (InfixRV_rvals-->lop) * (InfixRV_rvals-->rop);
|
|
644
|
+
# '@{2f}//': acc = (InfixRV_rvals-->lop) / (InfixRV_rvals-->rop);
|
|
645
|
+
# '%//': acc = (InfixRV_rvals-->lop) % (InfixRV_rvals-->rop);
|
|
646
|
+
# THEN1__WD: acc = (InfixRV_rvals-->lop) . (InfixRV_rvals-->rop);
|
|
647
|
+
# '->': acc = (InfixRV_rvals-->lop) -> (InfixRV_rvals-->rop);
|
|
648
|
+
# '-->': acc = (InfixRV_rvals-->lop) --> (InfixRV_rvals-->rop);
|
|
649
|
+
# ']&': acc = (InfixRV_rvals-->lop) .& (InfixRV_rvals-->rop);
|
|
650
|
+
# ']#': acc = (InfixRV_rvals-->lop) .# (InfixRV_rvals-->rop);
|
|
651
|
+
# '::': acc = (InfixRV_rvals-->lop) :: (InfixRV_rvals-->rop);
|
|
652
|
+
# '&//': acc = (InfixRV_rvals-->lop) & (InfixRV_rvals-->rop);
|
|
653
|
+
# '|//': acc = (InfixRV_rvals-->lop) | (InfixRV_rvals-->rop);
|
|
654
|
+
# '&&': acc = (InfixRV_rvals-->lop) && (InfixRV_rvals-->rop);
|
|
655
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
656
|
+
# '||': acc = (InfixRV_rvals-->lop) || (InfixRV_rvals-->rop);
|
|
657
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
658
|
+
# '<//': acc = (InfixRV_rvals-->lop) < (InfixRV_rvals-->rop);
|
|
659
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
660
|
+
# '<=': acc = (InfixRV_rvals-->lop) <= (InfixRV_rvals-->rop);
|
|
661
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
662
|
+
# '>//': acc = (InfixRV_rvals-->lop) > (InfixRV_rvals-->rop);
|
|
663
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
664
|
+
# '>=': acc = (InfixRV_rvals-->lop) >= (InfixRV_rvals-->rop);
|
|
665
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
666
|
+
# '==': acc = (InfixRV_rvals-->lop) == (InfixRV_rvals-->rop);
|
|
667
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
668
|
+
# '[=': acc = (InfixRV_rvals-->lop) ~= (InfixRV_rvals-->rop);
|
|
669
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
670
|
+
# 'has': acc = (InfixRV_rvals-->lop) has (InfixRV_rvals-->rop);
|
|
671
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
672
|
+
# 'hasnt': acc = (InfixRV_rvals-->lop) hasnt (InfixRV_rvals-->rop);
|
|
673
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
674
|
+
# 'in': acc = (InfixRV_rvals-->lop) in (InfixRV_rvals-->rop);
|
|
675
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
676
|
+
# 'notin': acc = (InfixRV_rvals-->lop) notin (InfixRV_rvals-->rop);
|
|
677
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
678
|
+
# 'provides': acc = (InfixRV_rvals-->lop) provides (InfixRV_rvals-->rop);
|
|
679
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
680
|
+
# 'ofclass': acc = (InfixRV_rvals-->lop) ofclass (InfixRV_rvals-->rop);
|
|
681
|
+
# infix_term_type = INFIXTT_LOGICAL;
|
|
682
|
+
# '[[': acc = ~~ (InfixRV_rvals-->rop); flag = true;
|
|
683
|
+
# '[//': acc = ~ (InfixRV_rvals-->rop); flag = true;
|
|
684
|
+
# 'unary-': acc = - (InfixRV_rvals-->rop); flag = true;
|
|
685
|
+
# } ! end of switch(InfixRV_rvals-->maxi)
|
|
686
|
+
# InfixRV_rvals-->maxi = acc;
|
|
687
|
+
# InfixRV_types-->maxi = -1;
|
|
688
|
+
# if (rop < n) InfixRV_types-->rop = -2;
|
|
689
|
+
# if (flag == false && lop >= 0) InfixRV_types-->lop = -2;
|
|
690
|
+
# } ! end of for (::)
|
|
691
|
+
# ]; ! end of InfixRvalue
|
|
692
|
+
|
|
693
|
+
# ! ------------------------------------------------------------------------
|
|
694
|
+
|
|
695
|
+
# [ InfixWelcomeSub;
|
|
696
|
+
# print "; Welcome to the ~Infix~ debugger (1/990428), which makes the
|
|
697
|
+
# following verbs available:^^
|
|
698
|
+
# ~; <expression>~: evaluates this Inform expression: e.g.
|
|
699
|
+
# ~; location~ will print the value of the variable ~location~,
|
|
700
|
+
# ~; 3*5+1~ will print 16, ~; children(old cloth bag)~ will tell you
|
|
701
|
+
# how many items are in it. (You can name objects either by their
|
|
702
|
+
# names inside the source code, such as ~n_obj~, or by typing the
|
|
703
|
+
# names by which the game's parser would normally know them, such
|
|
704
|
+
# as ~north wall~: the effect is the same.)^
|
|
705
|
+
# Any expression is allowed except that you can't use double-quoted
|
|
706
|
+
# strings of text: but you can send messages, call routines or
|
|
707
|
+
# assign values to variables, properties and array entries.
|
|
708
|
+
# ^ ~; score++~ is one way to get on in the world.
|
|
709
|
+
# ^ ~; deadflag = true~ is one way to get out of it.
|
|
710
|
+
# ^ ~; StopDaemon(nasty little dwarf)~ will keep you from being pestered.^
|
|
711
|
+
# Conditions like ~; score>20~ are also allowed and print
|
|
712
|
+
# either 1 (if true) or 0 (if false).^^";
|
|
713
|
+
# print "~;examine <something>~ or ~;x <something>~ gives full details
|
|
714
|
+
# of whatever it is. For instance, ~;x ##Take~ describes the Take
|
|
715
|
+
# action; ~;x Class~ the class Class; ~;x 'drop'~ the dictionary
|
|
716
|
+
# word ~drop~ and so on for numbers, routines, arrays and of course
|
|
717
|
+
# objects. ~;xo~ examines something as an object, so for instance
|
|
718
|
+
# ~;x location~ tells you about the variable ~location~, but ~;xo
|
|
719
|
+
# location~ tells you what object it refers to.^^";
|
|
720
|
+
# print "~;give~, ~;remove~ and ~;move~ work like the corresponding
|
|
721
|
+
# Inform statements.^^";
|
|
722
|
+
# print "~;<~ causes an action: for instance, ~;< Eat cheese~.^^";
|
|
723
|
+
# print "~;watch~ or ~;w~ can set a watch on various activities:
|
|
724
|
+
# type just ~;w~ for details.^^";
|
|
725
|
+
# print "~;inventory~ or ~;i~ describes the contents of this story file.^";
|
|
726
|
+
# ];
|
|
727
|
+
|
|
728
|
+
# [ InfixEvalSub; InfixExamineP(true); ];
|
|
729
|
+
|
|
730
|
+
# [ InfixActionSub;
|
|
731
|
+
# print "; <", (InfixPrintAction) infix_lvalue;
|
|
732
|
+
# if (noun) print " (", (the) noun, ")";
|
|
733
|
+
# if (second) print " (", (the) second, ")";
|
|
734
|
+
# print ">^";
|
|
735
|
+
# if (second) <<(infix_lvalue) noun second>>;
|
|
736
|
+
# if (noun) <<(infix_lvalue) noun>>;
|
|
737
|
+
# <<(infix_lvalue)>>;
|
|
738
|
+
# ];
|
|
739
|
+
|
|
740
|
+
# [ InfixGiveSub f;
|
|
741
|
+
# print "; give (", (the) noun, ") ";
|
|
742
|
+
# if (second < 0) { second = ~second; f=true; }
|
|
743
|
+
# if (second < 0 || second >= 48) "<No such attribute>";
|
|
744
|
+
# if (f) print "@@126";
|
|
745
|
+
# print (DebugAttribute) second;
|
|
746
|
+
# if (f) @clear_attr noun second;
|
|
747
|
+
# else @set_attr noun second;
|
|
748
|
+
# ];
|
|
749
|
+
|
|
750
|
+
# [ InfixMoveSub;
|
|
751
|
+
# print "; move (", (the) noun, ") to (", (the) second, ")";
|
|
752
|
+
# move noun to second;
|
|
753
|
+
# ];
|
|
754
|
+
|
|
755
|
+
# [ InfixRemoveSub;
|
|
756
|
+
# print "; remove (", (the) noun, ")";
|
|
757
|
+
# remove noun;
|
|
758
|
+
# ];
|
|
759
|
+
|
|
760
|
+
# [ InfixHex x y;
|
|
761
|
+
# y = (x & $7f00) / $100;
|
|
762
|
+
# if (x < 0) y = y + $80;
|
|
763
|
+
# x = x & $ff;
|
|
764
|
+
# print (Infixhexdigit) y/$10, (Infixhexdigit) y, (Infixhexdigit) x/$10, (Infixhexdigit) x;
|
|
765
|
+
# ];
|
|
766
|
+
|
|
767
|
+
# [ Infixhexdigit x; x = x % $10; if (x < 10) print x; else print (char) 'a'+x-10; ];
|
|
768
|
+
|
|
769
|
+
# [ InfixExamineOSub;
|
|
770
|
+
# infix_data1 = metaclass(noun);
|
|
771
|
+
# infix_term_type = INFIXTT_CONSTANT;
|
|
772
|
+
# InfixExamineP(false);
|
|
773
|
+
# ];
|
|
774
|
+
|
|
775
|
+
# [ InfixExamineSSub;
|
|
776
|
+
# infix_term_type = INFIXTT_STATICSTRING;
|
|
777
|
+
# InfixExamineP(false);
|
|
778
|
+
# ];
|
|
779
|
+
|
|
780
|
+
# [ InfixExamineSub; InfixExamineP(false); ];
|
|
781
|
+
|
|
782
|
+
# [ InfixExamineP brief x a b w flag lines;
|
|
783
|
+
# switch (infix_term_type) {
|
|
784
|
+
# INFIXTT_NUMBER:
|
|
785
|
+
# if (brief) "; == ", noun;
|
|
786
|
+
# print "; The number ", noun, " == $", (InfixHex) noun;
|
|
787
|
+
# if (noun >= 32 && noun < 127) print " == '", (char) noun, "'";
|
|
788
|
+
# new_line;
|
|
789
|
+
# INFIXTT_NAMEDOBJECT:
|
|
790
|
+
# print "~", (name) noun, "~ (", noun, ")^"; if (brief) return;
|
|
791
|
+
# <<Showobj noun>>;
|
|
792
|
+
# INFIXTT_CONSTANT:
|
|
793
|
+
# if (brief) "; == ", noun;
|
|
794
|
+
# switch (infix_data1 & 15) {
|
|
795
|
+
# nothing:
|
|
796
|
+
# print "; Constant ", (InfixPrintConstant) infix_parsed_lvalue,
|
|
797
|
+
# " == ", noun, "^";
|
|
798
|
+
# Object: <<Showobj noun>>;
|
|
799
|
+
# Class:
|
|
800
|
+
# print "Class ", (name) noun, "^";
|
|
801
|
+
# objectloop (a ofclass noun) {
|
|
802
|
+
# if (flag) print ", "; else print "Contains: ";
|
|
803
|
+
# print (name) a, " (", a, ")"; flag=true;
|
|
804
|
+
# }
|
|
805
|
+
# if (flag == false) "No object is of this class";
|
|
806
|
+
# }
|
|
807
|
+
# new_line;
|
|
808
|
+
# INFIXTT_ATTRIBUTE:
|
|
809
|
+
# if (brief) "; == ", noun;
|
|
810
|
+
# if (noun >= 48 || noun < 0) "; No such attribute";
|
|
811
|
+
# print "; Attribute ", (InfixPrintAttribute) noun,
|
|
812
|
+
# " (numbered ", noun, ")^";
|
|
813
|
+
# objectloop (x has noun) {
|
|
814
|
+
# if (flag) print ", ";
|
|
815
|
+
# else print "Each of these ~has ", (InfixPrintAttribute) noun, "~: ";
|
|
816
|
+
# print (name) x, " (", x, ")"; flag = true;
|
|
817
|
+
# }
|
|
818
|
+
# if (flag == false) "No object ~has ", (InfixPrintAttribute) noun, "~";
|
|
819
|
+
# new_line;
|
|
820
|
+
# INFIXTT_PROPERTY:
|
|
821
|
+
# if (brief) "; == ", noun;
|
|
822
|
+
# print "; Property ", (property) noun, " (numbered ", noun, ")^";
|
|
823
|
+
# objectloop (x provides noun) {
|
|
824
|
+
# if (flag) print ", "; else print "Provided by: ";
|
|
825
|
+
# print (name) x, " (", x, ")"; flag = true;
|
|
826
|
+
# }
|
|
827
|
+
# if (flag == false) "Which is not provided by any object";
|
|
828
|
+
# new_line;
|
|
829
|
+
# INFIXTT_DWORD:
|
|
830
|
+
# if (brief) "; == ", noun;
|
|
831
|
+
# if (noun == 0) "; This word is not in the dictionary";
|
|
832
|
+
# a = noun->#dict_par1;
|
|
833
|
+
# print "; Dictionary word '", (address) noun;
|
|
834
|
+
# if (a & 4) print "//p";
|
|
835
|
+
# print "' (address ", noun, ")";
|
|
836
|
+
# if (a) {
|
|
837
|
+
# print ": ";
|
|
838
|
+
# if (a & 2) print "meta ";
|
|
839
|
+
# if (a & 1) print "verb ";
|
|
840
|
+
# if (a & 8) print "preposition ";
|
|
841
|
+
# if (a & 4) print "pluralising ";
|
|
842
|
+
# if (a & 128) print "noun ";
|
|
843
|
+
# }
|
|
844
|
+
# new_line;
|
|
845
|
+
# if (a & 1) <<Showverb noun>>;
|
|
846
|
+
# INFIXTT_ROUTINE:
|
|
847
|
+
# if (brief) "; == ", noun;
|
|
848
|
+
# print "; Routine ", (InfixPrintRoutine) infix_parsed_lvalue, " (number ",
|
|
849
|
+
# infix_parsed_lvalue, ", packed address ", noun, ")^";
|
|
850
|
+
# INFIXTT_GLOBAL:
|
|
851
|
+
# if (brief) "; == ", noun;
|
|
852
|
+
# print "; Global ", (InfixPrintGlobal) infix_parsed_lvalue, " == ", noun, "^";
|
|
853
|
+
# INFIXTT_ARRAY:
|
|
854
|
+
# if (brief) "; == ", noun;
|
|
855
|
+
# print "; Array ", (InfixPrintArray) infix_parsed_lvalue, " ";
|
|
856
|
+
# infix_data1 = infix_data1 % 16;
|
|
857
|
+
# switch (infix_data1) {
|
|
858
|
+
# 0: print "->"; a=0;
|
|
859
|
+
# 1: print "-->"; a=0;
|
|
860
|
+
# 2: print "string"; a=1;
|
|
861
|
+
# 3: print "table"; a=1;
|
|
862
|
+
# 4: print "buffer"; a=WORDSIZE;
|
|
863
|
+
# }
|
|
864
|
+
# print " ", infix_data2 + 1 - a, "^; == "; b = infix_data2;
|
|
865
|
+
# for (w=b : w>=a : w--)
|
|
866
|
+
# if (infix_data1 == 0 or 2 or 4) { if (noun->w) break; }
|
|
867
|
+
# else { if (noun-->w) break; }
|
|
868
|
+
# if (b-w < 5) w=b;
|
|
869
|
+
# for (: x<=w : x++) {
|
|
870
|
+
# if (infix_data1 == 0 or 2 or 4) print noun->x, " ";
|
|
871
|
+
# else print noun-->x, " ";
|
|
872
|
+
# if (x+1 == a) print ": ";
|
|
873
|
+
# }
|
|
874
|
+
# if (w < b) print "(then ", b-w, " zero entries)";
|
|
875
|
+
# new_line;
|
|
876
|
+
# INFIXTT_ACTION:
|
|
877
|
+
# if (brief) "; == ", noun;
|
|
878
|
+
# if (noun >= #lowest_fake_action_number && noun <= #highest_fake_action_number)
|
|
879
|
+
# "; Fake action ", (InfixPrintFakeAction) noun,
|
|
880
|
+
# " (numbered ", noun, ")^Is not generated by any grammar";
|
|
881
|
+
# print "; Action ", (InfixPrintAction) noun,
|
|
882
|
+
# " (numbered ", noun, ")^";
|
|
883
|
+
# w = HDR_DICTIONARY-->0;
|
|
884
|
+
# for (b=0 : b<(HDR_DICTIONARY-->0 + 5)-->0 : b++) {
|
|
885
|
+
# w = HDR_DICTIONARY-->0 + 7 + b*9;
|
|
886
|
+
# if ((w->#dict_par1) & 1) {
|
|
887
|
+
# a = (HDR_STATICMEMORY-->0)-->($ff-(w->#dict_par2));
|
|
888
|
+
# lines = a->0; a++;
|
|
889
|
+
# for (: lines>0 : lines--) {
|
|
890
|
+
# a = UnpackGrammarLine(a);
|
|
891
|
+
# if (action_to_be == noun) {
|
|
892
|
+
# print "'", (address) w, "' "; DebugGrammarLine();
|
|
893
|
+
# new_line;
|
|
894
|
+
# flag = true;
|
|
895
|
+
# }
|
|
896
|
+
# }
|
|
897
|
+
# }
|
|
898
|
+
# }
|
|
899
|
+
# if (flag == 0) "Is not generated by any grammar";
|
|
900
|
+
# INFIXTT_SYSFUN:
|
|
901
|
+
# if (brief) "; == ", noun;
|
|
902
|
+
# "; System function ~", (address) infix_parsed_lvalue, "~ has
|
|
903
|
+
# not been overridden by any routine and so has its standard definition.";
|
|
904
|
+
# INFIXTT_STATICSTRING:
|
|
905
|
+
# if (brief) "; == ", noun;
|
|
906
|
+
# if (metaclass(noun) ~= String) "; ", noun, " is not a string.";
|
|
907
|
+
# print "~", (string) noun, "~^";
|
|
908
|
+
# INFIXTT_LOGICAL:
|
|
909
|
+
# if (noun == true) "; true"; if (noun == false) "; false";
|
|
910
|
+
# "; ", noun;
|
|
911
|
+
# }
|
|
912
|
+
# ]; ! end of InfixExamineP
|
|
913
|
+
|
|
914
|
+
# [ InfixDescribeWatchSub x y z s flag aflag;
|
|
915
|
+
# print "; The Infix ~;watch~ verb allows you to set a watch on any named
|
|
916
|
+
# routine(s) or objects: for instance ~;watch ScoreSub~ or
|
|
917
|
+
# ~;watch silver bars~. You can also:
|
|
918
|
+
# ^ ~;watch objects~: changes to attribute or property settings";
|
|
919
|
+
# if (debug_flag & 8) print " (on)"; else print " (off)";
|
|
920
|
+
|
|
921
|
+
# print ";^ ~;watch timers~: the running of timers and daemons each turn";
|
|
922
|
+
# if (debug_flag & 4) print " (on)"; else print " (off)";
|
|
923
|
+
|
|
924
|
+
# print ";^ ~;watch messages~: all messages sent";
|
|
925
|
+
# if (debug_flag & 1) print " (on)"; else print " (off)";
|
|
926
|
+
|
|
927
|
+
# print ";^ ~;watch actions~: all actions generated";
|
|
928
|
+
# if (debug_flag & 2) print " (on)"; else print " (off)";
|
|
929
|
+
|
|
930
|
+
# print ".^~~;watch~ can be abbreviated to ~;w~ and use ~off~ to stop
|
|
931
|
+
# watching: for instance ~;w location off~.^";
|
|
932
|
+
# aflag = debug_flag;
|
|
933
|
+
# objectloop (x has infix__watching) flag = true; aflag = aflag || flag;
|
|
934
|
+
# if (flag) print "The following objects are currently being watched: ";
|
|
935
|
+
# flag = false;
|
|
936
|
+
# objectloop (x has infix__watching) {
|
|
937
|
+
# if (flag) print ", "; flag = true;
|
|
938
|
+
# print (name) x, " (", x, ")";
|
|
939
|
+
# }
|
|
940
|
+
# if (flag) new_line;
|
|
941
|
+
# s = (#highest_routine_number - #lowest_routine_number);
|
|
942
|
+
# if (s%8 == 0) s=s/8; else s=s/8+1;
|
|
943
|
+
# for (flag=false,x=0 : x<s : x++) if (#routine_flags_array->x) flag = true;
|
|
944
|
+
# aflag = aflag || flag;
|
|
945
|
+
# if (flag) print "The following routines are currently being watched: ";
|
|
946
|
+
# for (x=0,flag=false : x<s : x++) {
|
|
947
|
+
# for (y=1,z=0 : y<256 : z++,y=y*2) {
|
|
948
|
+
# if ((#routine_flags_array->x) & y) {
|
|
949
|
+
# if (flag) print ", "; flag = true;
|
|
950
|
+
# print (InfixPrintRoutine)
|
|
951
|
+
# #lowest_routine_number + x*8 + z;
|
|
952
|
+
# }
|
|
953
|
+
# }
|
|
954
|
+
# }
|
|
955
|
+
# if (flag) new_line;
|
|
956
|
+
# if (aflag == false) "At present, nothing is being watched.";
|
|
957
|
+
# ];
|
|
958
|
+
|
|
959
|
+
# [ InfixWatchOnSub i j k l;
|
|
960
|
+
# if (noun == 0) return InfixDescribeWatchSub();
|
|
961
|
+
# if (infix_term_type == INFIXTT_ROUTINE) {
|
|
962
|
+
# i = infix_parsed_lvalue/8;
|
|
963
|
+
# for (j=0,k=1 : j<infix_parsed_lvalue%8 : j++) k=k*2;
|
|
964
|
+
# l = #routine_flags_array->i;
|
|
965
|
+
# l = l | k;
|
|
966
|
+
# @storeb #routine_flags_array i l;
|
|
967
|
+
# "; Watching routine ", (InfixPrintRoutine) infix_parsed_lvalue, ".";
|
|
968
|
+
# }
|
|
969
|
+
# if (metaclass(noun) == Object) {
|
|
970
|
+
# give noun infix__watching;
|
|
971
|
+
# "; Watching object ~", (name) noun, "~ (", noun, ").";
|
|
972
|
+
# }
|
|
973
|
+
# InfixDescribeWatchSub();
|
|
974
|
+
# ];
|
|
975
|
+
|
|
976
|
+
# [ InfixWatchOffSub i j k l;
|
|
977
|
+
# if (noun == 0) return InfixDescribeWatchSub();
|
|
978
|
+
# if (infix_term_type == INFIXTT_ROUTINE) {
|
|
979
|
+
# i = infix_parsed_lvalue/8;
|
|
980
|
+
# for (j=0,k=1 : j<infix_parsed_lvalue%8 : j++) k=k*2;
|
|
981
|
+
# l = #routine_flags_array->i;
|
|
982
|
+
# l = l & (~k);
|
|
983
|
+
# @storeb #routine_flags_array i l;
|
|
984
|
+
# "; Not watching ", (InfixPrintRoutine) infix_parsed_lvalue, ".";
|
|
985
|
+
# }
|
|
986
|
+
# if (metaclass(noun) == Object) {
|
|
987
|
+
# @clear_attr noun infix__watching;
|
|
988
|
+
# "; Not watching object ~", (name) noun, "~ (", noun, ").";
|
|
989
|
+
# }
|
|
990
|
+
# InfixDescribeWatchSub();
|
|
991
|
+
# ];
|
|
992
|
+
|
|
993
|
+
# [ InfixList from to tab filter i flag;
|
|
994
|
+
# print "^ ";
|
|
995
|
+
# for (i=from : i<=to : i++)
|
|
996
|
+
# if (tab-->(i-from)) {
|
|
997
|
+
# flag = true;
|
|
998
|
+
# if (tab == #array_names_array) {
|
|
999
|
+
# Symb__Tab(INFIXTT_ARRAY, i);
|
|
1000
|
+
# flag = ~~(temp__global3 & 16);
|
|
1001
|
+
# }
|
|
1002
|
+
# if (tab == #routine_names_array) {
|
|
1003
|
+
# Symb__Tab(INFIXTT_ROUTINE,i);
|
|
1004
|
+
# flag = ~~(temp__global3 & 16);
|
|
1005
|
+
# }
|
|
1006
|
+
# if (tab == #constant_names_array) {
|
|
1007
|
+
# Symb__Tab(INFIXTT_CONSTANT,i);
|
|
1008
|
+
# flag = (~~(temp__global3 & 16)) && (temp__global3 % 16 == filter);
|
|
1009
|
+
# }
|
|
1010
|
+
# if (flag) print (string) tab-->(i-from), " ";
|
|
1011
|
+
# }
|
|
1012
|
+
# new_line;
|
|
1013
|
+
# ];
|
|
1014
|
+
|
|
1015
|
+
# [ InfixInvSub i;
|
|
1016
|
+
|
|
1017
|
+
# print (string) Story, (string) Headline;
|
|
1018
|
+
# print " ", (number) #highest_object_number - #lowest_object_number + 1,
|
|
1019
|
+
# " objects;^";
|
|
1020
|
+
|
|
1021
|
+
# print " non-library object-name constants:";
|
|
1022
|
+
# InfixList(#lowest_constant_number, #highest_constant_number, #constant_names_array, 2);
|
|
1023
|
+
|
|
1024
|
+
# print " ", (number) #highest_class_number - #lowest_class_number + 1, " classes:^ ";
|
|
1025
|
+
# for (i=#lowest_class_number : i<=#highest_class_number : i++)
|
|
1026
|
+
# print (name) #class_objects_array-->i, " ";
|
|
1027
|
+
# new_line;
|
|
1028
|
+
|
|
1029
|
+
# print " non-library arrays:";
|
|
1030
|
+
# InfixList(#lowest_array_number, #highest_array_number, #array_names_array);
|
|
1031
|
+
|
|
1032
|
+
# print " non-library routines:";
|
|
1033
|
+
# InfixList(#lowest_routine_number, #highest_routine_number, #routine_names_array);
|
|
1034
|
+
|
|
1035
|
+
# print " non-library constants:";
|
|
1036
|
+
# InfixList(#lowest_constant_number, #highest_constant_number, #constant_names_array, 0);
|
|
1037
|
+
|
|
1038
|
+
# print " (common) properties:";
|
|
1039
|
+
# InfixList(#lowest_property_number, 63, #property_names_array);
|
|
1040
|
+
|
|
1041
|
+
# print " (individual) properties:";
|
|
1042
|
+
# InfixList(64, #highest_property_number, #property_names_array + 126);
|
|
1043
|
+
|
|
1044
|
+
# print " attributes:";
|
|
1045
|
+
# InfixList(#lowest_attribute_number, #highest_attribute_number, #attribute_names_array);
|
|
1046
|
+
|
|
1047
|
+
# if (true) return;
|
|
1048
|
+
|
|
1049
|
+
# print " variables:";
|
|
1050
|
+
# InfixList(#lowest_global_number, #highest_global_number, #global_names_array);
|
|
1051
|
+
|
|
1052
|
+
# print " actions:";
|
|
1053
|
+
# InfixList(#lowest_action_number, #highest_action_number, #action_names_array);
|
|
1054
|
+
|
|
1055
|
+
# print " fake actions:";
|
|
1056
|
+
# InfixList(#lowest_fake_action_number, #highest_fake_action_number, #fake_action_names_array);
|
|
1057
|
+
# ];
|
|
1058
|
+
|
|
1059
|
+
end
|
|
1060
|
+
# defined? DEBUG_
|
|
1061
|
+
|
|
1062
|
+
Include "infix.h.inf"
|
|
1063
|
+
|
|
1064
|
+
# ==============================================================================
|