Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/oldagsrc/good/bcip.cpp @ 0:13d2b8934445
Import AnaGram (near-)release tree into Mercurial.
author | David A. Holland |
---|---|
date | Sat, 22 Dec 2007 17:52:45 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:13d2b8934445 |
---|---|
1 /* | |
2 bcip.syn Version 1.0 | |
3 | |
4 A simple byte code compiler | |
5 | |
6 Copyright (c) 1996-1999 Parsifal Software, All Rights Reserved. | |
7 | |
8 The expression syntax is borrowed from C but with the addition | |
9 of the FORTRAN exponentiation operator (**). | |
10 | |
11 The cast, increment, and decrement operators are not | |
12 implemented, nor are the following operations that are defined | |
13 only for integers: | |
14 Bitwise logical operators: &, |, ^, ~, &=, |=, ^= | |
15 Remainder operators: %, %= | |
16 Shift operators: <<, >>, >>=, <<= | |
17 | |
18 The supported operations are: | |
19 Assignment operators: =, +=, -=, *=, /= | |
20 Conditional expressions: ? : | |
21 Logical operators: !, &&, || | |
22 Comparison operators: ==, !=, <, <=, >, >= | |
23 Binary arithmetic operators: +, -, *, / | |
24 Exponentiation: ** | |
25 Unary arithmetic operators: +, - | |
26 Parentheses ( ) | |
27 Built-in functions log, exp, sqrt | |
28 | |
29 All arithmetic is double precision floating point. | |
30 | |
31 Statements may include expression statements, blocks, if/else | |
32 statements, while statements, do-while statements, or for | |
33 statements, following the rules of C. | |
34 | |
35 The statement syntax has been written to avoid the conventional | |
36 if/else ambiguity. | |
37 | |
38 There are no declarations. All variables are presumed to be | |
39 double. | |
40 | |
41 Input strings may contain any number of statements. White space | |
42 may be used freely, including both C and C++ style comments. | |
43 | |
44 The parser is invoked by the constructor for the virtual machine | |
45 to parse the source code and compile it into byte code. | |
46 | |
47 With this organization, it is possible to create various | |
48 virtual machine objects all of which use the same symbol dictionary, | |
49 so that all can operate on the same data array. Furthermore, if | |
50 there are multiple data arrays, all consistent with the same | |
51 symbol dictionary, then any virtual machine object created using the | |
52 given symbol dictionary can operate on any of the data arrays. | |
53 | |
54 Thus a given virtual machine may operate on different data | |
55 arrays at different times. The data array, of course, must be | |
56 consistent with the symbol dictionary used to initialize the virtual | |
57 machine. | |
58 | |
59 The symbol dictionary maps character strings to indices into the | |
60 data array, so that each unique variable name is assigned a | |
61 particular location in the data array. Different virtual | |
62 machines may be initialized with the same symbol dictionary. When | |
63 this is done, these virtual machines can all operate on the | |
64 same data array. | |
65 | |
66 An override for the SYNTAX_ERROR macro defined by AnaGram and | |
67 the definition of the ScriptMethod class are in the bci.h | |
68 file. bci.cpp has function definitons for the ScriptMethod | |
69 class. bcidemo.cpp demonstrates one way to use the virtual | |
70 machine. | |
71 | |
72 bcip.syn is compiled with the AnaGram parser generator yielding | |
73 bcip.h and bcip.cpp. | |
74 | |
75 To build bcidemo, compile bcip.cpp, bci.cpp, cntnrs.cpp and bcidemo.cpp | |
76 and link them with your C++ compiler. | |
77 | |
78 For information about AnaGram, visit http://www.parsifalsoft.com. | |
79 */ | |
80 | |
81 #include <math.h> | |
82 #include "bci.h" // defines external interface | |
83 | |
84 | |
85 /* | |
86 * AnaGram, A System for Syntax Directed Programming | |
87 * File generated by: ... | |
88 * | |
89 * AnaGram Parsing Engine | |
90 * Copyright 1993-2002 Parsifal Software. All Rights Reserved. | |
91 * | |
92 * This software is provided 'as-is', without any express or implied | |
93 * warranty. In no event will the authors be held liable for any damages | |
94 * arising from the use of this software. | |
95 * | |
96 * Permission is granted to anyone to use this software for any purpose, | |
97 * including commercial applications, and to alter it and redistribute it | |
98 * freely, subject to the following restrictions: | |
99 * | |
100 * 1. The origin of this software must not be misrepresented; you must not | |
101 * claim that you wrote the original software. If you use this software | |
102 * in a product, an acknowledgment in the product documentation would be | |
103 * appreciated but is not required. | |
104 * 2. Altered source versions must be plainly marked as such, and must not be | |
105 * misrepresented as being the original software. | |
106 * 3. This notice may not be removed or altered from any source distribution. | |
107 */ | |
108 | |
109 #ifndef BCIP_H | |
110 #include "bcip.h" | |
111 #endif | |
112 | |
113 #ifndef BCIP_H | |
114 #error Mismatched header file | |
115 #endif | |
116 | |
117 #include <ctype.h> | |
118 #include <stdio.h> | |
119 | |
120 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx])) | |
121 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx]) | |
122 #define CONTEXT ((PCB).cs[(PCB).ssx]) | |
123 | |
124 | |
125 #ifndef PCB_TYPE | |
126 #define PCB_TYPE bciParse_pcb_type | |
127 #endif | |
128 | |
129 | |
130 #define PCB (*pcb_pointer) | |
131 #define PCB_DECL PCB_TYPE *pcb_pointer | |
132 #define PCB_POINTER pcb_pointer | |
133 | |
134 CodeFragment bciParse_value(PCB_DECL); | |
135 | |
136 static void ag_delete_wrappers(PCB_DECL); | |
137 #ifndef DELETE_WRAPPERS | |
138 #define DELETE_WRAPPERS ag_delete_wrappers(PCB_POINTER) | |
139 #endif | |
140 | |
141 /* Line -, bcip.syn */ | |
142 // Begin embedded C | |
143 | |
144 #define SYNTAX_ERROR | |
145 | |
146 int bciParse_pcb_struct::stashReal(double x) { | |
147 int n = realList.size(); | |
148 realList.push(x); | |
149 return n; | |
150 } | |
151 | |
152 CodeFragment bciParse_pcb_struct::codeIfElse(CodeFragment &condition, | |
153 CodeFragment &trueStatement, | |
154 CodeFragment &falseStatement) | |
155 { | |
156 return condition.cat(BRF, trueStatement.size() + 2) | |
157 .cat(trueStatement) | |
158 .cat(BR, falseStatement.size()) | |
159 .cat(falseStatement); | |
160 } | |
161 | |
162 CodeFragment bciParse_pcb_struct::codeWhile(CodeFragment &condition, | |
163 CodeFragment &statement) | |
164 { | |
165 // loop back distance is length of statement + length of condition + 2 branch instructions | |
166 int loopBackDistance = condition.size() + statement.size() + 4; | |
167 return condition.cat(BRF, statement.size() + 2) // size of statement +size of loopback | |
168 .cat(statement) | |
169 .cat(BR, -loopBackDistance); | |
170 } | |
171 | |
172 CodeFragment bciParse_pcb_struct::codeDoWhile(CodeFragment &statement, | |
173 CodeFragment &condition) | |
174 { | |
175 // loop back distance is | |
176 // length of statement + length of condition + 1 branch instruction | |
177 int loopBackDistance = statement.size() + condition.size() + 2; | |
178 return statement.cat(condition) | |
179 .cat(BRT, -loopBackDistance); | |
180 } | |
181 | |
182 CodeFragment bciParse_pcb_struct::codeFor(CodeFragment &initializer, | |
183 CodeFragment &condition, | |
184 CodeFragment &increment, | |
185 CodeFragment &statement) | |
186 { | |
187 // Calculate the length of the jump back at the bottom of the loop | |
188 // It consists of the length of the increment, condition and statement | |
189 // CodeFragments + 5 inserted Bytecodes: 1 Pop, and 2 each for each of | |
190 // two branches | |
191 int loopBackDistance = increment.size() + condition.size() + statement.size() + 5; | |
192 | |
193 // Put it all together | |
194 return initializer.cat(POP) // clear expression value from stack | |
195 .cat(BR, increment.size() + 1) // Skip increment on first time through | |
196 .cat(increment).cat(POP) // clear expresson value from stack | |
197 .cat(condition) | |
198 .cat(BRF, statement.size() + 2) // exit when condition is false | |
199 .cat(statement) | |
200 .cat(BR, -loopBackDistance); | |
201 } | |
202 | |
203 int bciParse_pcb_struct::compile(AgStringDictionary *s, AgString text) { | |
204 symbolDictionary = s; | |
205 charStack.reset(); | |
206 pointer = (unsigned char *) text.ptr(); | |
207 bciParse(this); | |
208 if(exit_flag != AG_SUCCESS_CODE) return 1; | |
209 code = bciParse_value(this); | |
210 return 0; | |
211 } | |
212 | |
213 | |
214 #ifndef CONVERT_CASE | |
215 #define CONVERT_CASE(c) (c) | |
216 #endif | |
217 #ifndef TAB_SPACING | |
218 #define TAB_SPACING 8 | |
219 #endif | |
220 CodeFragment bciParse_value(PCB_DECL) { | |
221 CodeFragment returnValue; | |
222 returnValue = (*(AgObjectWrapper< CodeFragment > *) &(PCB).vs[(PCB).ssx]); | |
223 return returnValue; | |
224 } | |
225 | |
226 static inline CodeFragment ag_rp_1(PCB_DECL, CodeFragment &x) { | |
227 /* Line -, bcip.syn */ | |
228 return x.cat(HLT); | |
229 } | |
230 | |
231 static inline CodeFragment ag_rp_2(PCB_DECL) { | |
232 /* Line -, bcip.syn */ | |
233 return CodeFragment(); | |
234 } | |
235 | |
236 static inline CodeFragment ag_rp_3(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
237 /* Line -, bcip.syn */ | |
238 return x.cat(y); | |
239 } | |
240 | |
241 static inline CodeFragment ag_rp_4(PCB_DECL, CodeFragment &x, CodeFragment &s) { | |
242 /* Line -, bcip.syn */ | |
243 return x.cat(BRF, s.size()).cat(s); | |
244 } | |
245 | |
246 static inline CodeFragment ag_rp_5(PCB_DECL, CodeFragment &x, CodeFragment &s1, CodeFragment &s2) { | |
247 /* Line -, bcip.syn */ | |
248 return PCB.codeIfElse(x,s1,s2); | |
249 } | |
250 | |
251 static inline CodeFragment ag_rp_6(PCB_DECL, CodeFragment &x, CodeFragment &s) { | |
252 /* Line -, bcip.syn */ | |
253 return PCB.codeWhile(x,s); | |
254 } | |
255 | |
256 static inline CodeFragment ag_rp_7(PCB_DECL, CodeFragment &init, CodeFragment &cond, CodeFragment &inc, CodeFragment &s) { | |
257 /* Line -, bcip.syn */ | |
258 return PCB.codeFor(init, cond, inc, s); | |
259 } | |
260 | |
261 static inline CodeFragment ag_rp_8(PCB_DECL, CodeFragment &x, CodeFragment &s1, CodeFragment &s2) { | |
262 /* Line -, bcip.syn */ | |
263 return PCB.codeIfElse(x,s1,s2); | |
264 } | |
265 | |
266 static inline CodeFragment ag_rp_9(PCB_DECL, CodeFragment &x, CodeFragment &s) { | |
267 /* Line -, bcip.syn */ | |
268 return PCB.codeWhile(x,s); | |
269 } | |
270 | |
271 static inline CodeFragment ag_rp_10(PCB_DECL, CodeFragment &s, CodeFragment &x) { | |
272 /* Line -, bcip.syn */ | |
273 return PCB.codeDoWhile(s,x); | |
274 } | |
275 | |
276 static inline CodeFragment ag_rp_11(PCB_DECL, CodeFragment &init, CodeFragment &cond, CodeFragment &inc, CodeFragment &s) { | |
277 /* Line -, bcip.syn */ | |
278 return PCB.codeFor(init, cond, inc, s); | |
279 } | |
280 | |
281 static inline CodeFragment ag_rp_12(PCB_DECL, CodeFragment &x) { | |
282 /* Line -, bcip.syn */ | |
283 return x; | |
284 } | |
285 | |
286 static inline CodeFragment ag_rp_13(PCB_DECL, CodeFragment &x) { | |
287 /* Line -, bcip.syn */ | |
288 return x; | |
289 } | |
290 | |
291 static inline CodeFragment ag_rp_14(PCB_DECL, CodeFragment &x) { | |
292 /* Line -, bcip.syn */ | |
293 return x.cat(POP); | |
294 } | |
295 | |
296 static inline CodeFragment ag_rp_15(PCB_DECL) { | |
297 /* Line -, bcip.syn */ | |
298 return CodeFragment(); | |
299 } | |
300 | |
301 static inline CodeFragment ag_rp_16(PCB_DECL, CodeFragment &s) { | |
302 /* Line -, bcip.syn */ | |
303 return s; | |
304 } | |
305 | |
306 static inline CodeFragment ag_rp_17(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
307 /* Line -, bcip.syn */ | |
308 return x.cat(POP).cat(y); | |
309 } | |
310 | |
311 static inline CodeFragment ag_rp_18(PCB_DECL, int k, CodeFragment &x) { | |
312 /* Line -, bcip.syn */ | |
313 return x.cat(STORE, k); | |
314 } | |
315 | |
316 static inline CodeFragment ag_rp_19(PCB_DECL, int k, CodeFragment &x) { | |
317 /* Line -, bcip.syn */ | |
318 return x.cat(ADDM, k); | |
319 } | |
320 | |
321 static inline CodeFragment ag_rp_20(PCB_DECL, int k, CodeFragment &x) { | |
322 /* Line -, bcip.syn */ | |
323 return x.cat(SUBM, k); | |
324 } | |
325 | |
326 static inline CodeFragment ag_rp_21(PCB_DECL, int k, CodeFragment &x) { | |
327 /* Line -, bcip.syn */ | |
328 return x.cat(MULM,k); | |
329 } | |
330 | |
331 static inline CodeFragment ag_rp_22(PCB_DECL, int k, CodeFragment &x) { | |
332 /* Line -, bcip.syn */ | |
333 return x.cat(DIVM, k); | |
334 } | |
335 | |
336 static inline CodeFragment ag_rp_23(PCB_DECL, CodeFragment &c, CodeFragment &x, CodeFragment &y) { | |
337 /* Line -, bcip.syn */ | |
338 return PCB.codeIfElse(c, x, y); | |
339 } | |
340 | |
341 static inline CodeFragment ag_rp_24(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
342 /* Line -, bcip.syn */ | |
343 return x.cat(OR, y.size()).cat(y); | |
344 } | |
345 | |
346 static inline CodeFragment ag_rp_25(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
347 /* Line -, bcip.syn */ | |
348 return x.cat(AND, y.size()).cat(y); | |
349 } | |
350 | |
351 static inline CodeFragment ag_rp_26(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
352 /* Line -, bcip.syn */ | |
353 return x.cat(y).cat(EQ); | |
354 } | |
355 | |
356 static inline CodeFragment ag_rp_27(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
357 /* Line -, bcip.syn */ | |
358 return x.cat(y).cat(NE); | |
359 } | |
360 | |
361 static inline CodeFragment ag_rp_28(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
362 /* Line -, bcip.syn */ | |
363 return x.cat(y).cat(LT); | |
364 } | |
365 | |
366 static inline CodeFragment ag_rp_29(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
367 /* Line -, bcip.syn */ | |
368 return x.cat(y).cat(LE); | |
369 } | |
370 | |
371 static inline CodeFragment ag_rp_30(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
372 /* Line -, bcip.syn */ | |
373 return x.cat(y).cat(GT); | |
374 } | |
375 | |
376 static inline CodeFragment ag_rp_31(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
377 /* Line -, bcip.syn */ | |
378 return x.cat(y).cat(GE); | |
379 } | |
380 | |
381 static inline CodeFragment ag_rp_32(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
382 /* Line -, bcip.syn */ | |
383 return x.cat(y).cat(ADD); | |
384 } | |
385 | |
386 static inline CodeFragment ag_rp_33(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
387 /* Line -, bcip.syn */ | |
388 return x.cat(y).cat(SUB); | |
389 } | |
390 | |
391 static inline CodeFragment ag_rp_34(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
392 /* Line -, bcip.syn */ | |
393 return x.cat(y).cat(MUL); | |
394 } | |
395 | |
396 static inline CodeFragment ag_rp_35(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
397 /* Line -, bcip.syn */ | |
398 return x.cat(y).cat(DIV); | |
399 } | |
400 | |
401 static inline CodeFragment ag_rp_36(PCB_DECL, CodeFragment &x) { | |
402 /* Line -, bcip.syn */ | |
403 return x.cat(NEG); | |
404 } | |
405 | |
406 static inline CodeFragment ag_rp_37(PCB_DECL, CodeFragment &x) { | |
407 /* Line -, bcip.syn */ | |
408 return x; | |
409 } | |
410 | |
411 static inline CodeFragment ag_rp_38(PCB_DECL, CodeFragment &x, CodeFragment &y) { | |
412 /* Line -, bcip.syn */ | |
413 return x.cat(y).cat(POW); | |
414 } | |
415 | |
416 static inline CodeFragment ag_rp_39(PCB_DECL, int x) { | |
417 /* Line -, bcip.syn */ | |
418 return CodeFragment().cat(PUSHI, x); | |
419 } | |
420 | |
421 static inline CodeFragment ag_rp_40(PCB_DECL, int k) { | |
422 /* Line -, bcip.syn */ | |
423 return CodeFragment().cat(PUSH, k); | |
424 } | |
425 | |
426 static inline CodeFragment ag_rp_41(PCB_DECL, CodeFragment &x) { | |
427 /* Line -, bcip.syn */ | |
428 return x.cat(LOG); | |
429 } | |
430 | |
431 static inline CodeFragment ag_rp_42(PCB_DECL, CodeFragment &x) { | |
432 /* Line -, bcip.syn */ | |
433 return x.cat(EXP); | |
434 } | |
435 | |
436 static inline CodeFragment ag_rp_43(PCB_DECL, CodeFragment &x) { | |
437 /* Line -, bcip.syn */ | |
438 return x.cat(SQRT); | |
439 } | |
440 | |
441 static inline CodeFragment ag_rp_44(PCB_DECL, CodeFragment &x) { | |
442 /* Line -, bcip.syn */ | |
443 return x; | |
444 } | |
445 | |
446 static inline CodeFragment ag_rp_45(PCB_DECL, CodeFragment &x) { | |
447 /* Line -, bcip.syn */ | |
448 return x.cat(NOT); | |
449 } | |
450 | |
451 static inline int ag_rp_46(PCB_DECL, double x) { | |
452 /* Line -, bcip.syn */ | |
453 return PCB.stashReal(x); | |
454 } | |
455 | |
456 static inline int ag_rp_47(PCB_DECL, double x, int e) { | |
457 /* Line -, bcip.syn */ | |
458 return PCB.stashReal(x*pow(10,e)); | |
459 } | |
460 | |
461 static inline int ag_rp_48(PCB_DECL, double x, int e) { | |
462 /* Line -, bcip.syn */ | |
463 return PCB.stashReal(x*pow(10,-e)); | |
464 } | |
465 | |
466 static inline double ag_rp_49(PCB_DECL, double i, double f) { | |
467 /* Line -, bcip.syn */ | |
468 return i+f; | |
469 } | |
470 | |
471 static inline double ag_rp_50(PCB_DECL, double f) { | |
472 /* Line -, bcip.syn */ | |
473 return f; | |
474 } | |
475 | |
476 static inline double ag_rp_51(PCB_DECL, int d) { | |
477 /* Line -, bcip.syn */ | |
478 return d-'0'; | |
479 } | |
480 | |
481 static inline double ag_rp_52(PCB_DECL, double x, int d) { | |
482 /* Line -, bcip.syn */ | |
483 return 10*x + d-'0'; | |
484 } | |
485 | |
486 static inline double ag_rp_53(PCB_DECL, int d) { | |
487 /* Line -, bcip.syn */ | |
488 return (d-'0')/10.; | |
489 } | |
490 | |
491 static inline double ag_rp_54(PCB_DECL, int d, double f) { | |
492 /* Line -, bcip.syn */ | |
493 return (d-'0' + f)/10.; | |
494 } | |
495 | |
496 static inline int ag_rp_55(PCB_DECL, int d) { | |
497 /* Line -, bcip.syn */ | |
498 return d-'0'; | |
499 } | |
500 | |
501 static inline int ag_rp_56(PCB_DECL, int x, int d) { | |
502 /* Line -, bcip.syn */ | |
503 return 10*x + d-'0'; | |
504 } | |
505 | |
506 static inline int ag_rp_57(PCB_DECL) { | |
507 /* Line -, bcip.syn */ | |
508 return PCB.symbolDictionary->identify(PCB.charStack.popString()); | |
509 } | |
510 | |
511 static inline void ag_rp_58(PCB_DECL, int c) { | |
512 /* Line -, bcip.syn */ | |
513 PCB.charStack.push((char) c); | |
514 } | |
515 | |
516 static inline void ag_rp_59(PCB_DECL, int c) { | |
517 /* Line -, bcip.syn */ | |
518 PCB.charStack.push((char) c); | |
519 } | |
520 | |
521 | |
522 #define READ_COUNTS | |
523 #define WRITE_COUNTS | |
524 #undef V | |
525 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) | |
526 #undef VS | |
527 #define VS(i) (PCB).vs[(PCB).ssx + i] | |
528 | |
529 #ifndef GET_CONTEXT | |
530 #define GET_CONTEXT CONTEXT = (PCB).input_context | |
531 #endif | |
532 | |
533 typedef enum { | |
534 ag_action_1, | |
535 ag_action_2, | |
536 ag_action_3, | |
537 ag_action_4, | |
538 ag_action_5, | |
539 ag_action_6, | |
540 ag_action_7, | |
541 ag_action_8, | |
542 ag_action_9, | |
543 ag_action_10, | |
544 ag_action_11, | |
545 ag_action_12 | |
546 } ag_parser_action; | |
547 | |
548 | |
549 #ifndef NULL_VALUE_INITIALIZER | |
550 #define NULL_VALUE_INITIALIZER = { 0 } | |
551 #endif | |
552 | |
553 | |
554 static const char ag_wdf[] = { | |
555 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
556 0, 4, 0, 0, 4, 4, 4, 4, 0, 4, 0, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, | |
557 0, 0, 4, 4, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
558 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | |
559 0, 4, 0, 0, 0, 0, 4, 0, 4, 0, 0, 0, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, | |
560 4, 0, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 4, 0, 4, 0 | |
561 }; | |
562 | |
563 #undef VW | |
564 #define VW(i,t) *(t) (&(PCB).vs[(PCB).ssx + (i)]) | |
565 #undef VNO | |
566 #define VNO new(&(PCB).vs[(PCB).ssx]) | |
567 #undef VRO | |
568 #define VRO(to,v) ag_replace_object((to) &(PCB).vs[(PCB).ssx], v) | |
569 #undef VWD | |
570 #define VWD(i,t) ag_delete_object((t) &(PCB).vs[(PCB).ssx + (i)]); | |
571 #undef VDO | |
572 #define VDO(to, v) ag_delete_object((to) &(PCB).vs[(PCB).ssx], v) | |
573 | |
574 template <class NewObject, class OldObject> | |
575 static inline void ag_replace_object(AgObjectWrapper<OldObject> *p, const NewObject &o) { | |
576 delete p; | |
577 new(p) AgObjectWrapper<NewObject >(o); | |
578 } | |
579 | |
580 template <class Object> | |
581 static inline void ag_delete_object(AgObjectWrapper<Object> *p) { | |
582 delete p; | |
583 } | |
584 | |
585 template <class NewObject, class OldObject> | |
586 static inline const NewObject &ag_delete_object(AgObjectWrapper<OldObject> *p, const NewObject &o) { | |
587 delete p; | |
588 return o; | |
589 } | |
590 | |
591 | |
592 #undef AG_WRAP_4 | |
593 #define AG_WRAP_4 AgObjectWrapper<CodeFragment > | |
594 | |
595 static void ag_delete_wrappers(PCB_DECL) { | |
596 int sn = (PCB).sn; | |
597 int sx = (PCB).ssx; | |
598 while (sx--) { | |
599 switch (ag_wdf[sn]) { | |
600 case 4: ag_delete_object((AG_WRAP_4 *) &(PCB).vs[sx]); break; | |
601 default: break; | |
602 } | |
603 sn = (PCB).ss[sx]; | |
604 } | |
605 } | |
606 | |
607 static bciParse_vs_type const ag_null_value NULL_VALUE_INITIALIZER; | |
608 | |
609 static const unsigned char ag_rpx[] = { | |
610 0, 1, 2, 3, 0, 0, 4, 5, 6, 7, 0, 8, 9, 10, 11, 12, 13, 14, | |
611 15, 16, 0, 17, 0, 18, 19, 20, 21, 22, 0, 23, 0, 24, 0, 25, 0, 26, | |
612 27, 0, 28, 29, 30, 31, 0, 32, 33, 0, 34, 35, 0, 36, 37, 0, 38, 39, | |
613 40, 41, 42, 43, 44, 45, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 46, | |
614 0, 0, 47, 48, 49, 0, 0, 0, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59 | |
615 }; | |
616 | |
617 static const unsigned char ag_key_itt[] = { | |
618 0 | |
619 }; | |
620 | |
621 static const unsigned short ag_key_pt[] = { | |
622 0 | |
623 }; | |
624 | |
625 static const unsigned char ag_key_ch[] = { | |
626 0, 42, 47,255, 47,100,101,102,105,108,115,119,255, 42,255, 42, 61,255, | |
627 42, 47, 61,255,108,120,255, 33, 38, 42, 43, 45, 47, 60, 61, 62,100,101, | |
628 102,105,108,115,119,124,255,100,101,102,105,108,115,119,255, 42, 47,255, | |
629 33, 38, 42, 47, 60, 61, 62,124,255, 42, 47,255, 47,101,108,115,255, 42, | |
630 47,255, 47,255,101,108,115,255, 33, 38, 42, 60, 61, 62,124,255, 33, 38, | |
631 60, 61, 62,124,255, 33, 38, 61,124,255, 42, 61,255, 42, 47, 61,255, 33, | |
632 38, 42, 43, 45, 47, 60, 61, 62,124,255,124,255, 42, 61,255, 33, 38, 42, | |
633 43, 45, 47, 60, 61, 62,124,255, 42, 47,255,108,120,255, 47,100,101,102, | |
634 105,108,115,119,255,119,255,108,120,255,100,101,102,105,108,115,119,255, | |
635 42, 47,255, 33, 38, 42, 47, 60, 61, 62,100,101,102,105,108,115,119,124, | |
636 255 | |
637 }; | |
638 | |
639 static const unsigned char ag_key_act[] = { | |
640 0,0,0,4,2,3,3,3,3,3,3,3,4,3,4,0,0,4,0,0,0,4,3,3,4,3,3,2,3,3,2,3,3,3,3, | |
641 2,3,3,3,3,3,3,4,3,3,3,3,3,3,3,4,0,0,4,3,3,3,2,3,3,3,3,4,0,0,4,2,3,3,3, | |
642 4,0,0,4,2,4,3,3,3,4,3,3,3,3,3,3,3,4,3,3,3,3,3,3,4,3,3,3,3,4,0,0,4,0,0, | |
643 0,4,3,3,2,3,3,2,3,3,3,3,4,3,4,0,0,4,3,3,2,3,3,3,3,3,3,3,4,0,0,4,3,3,4, | |
644 2,3,2,3,3,3,3,3,4,3,4,3,3,4,3,2,3,3,3,3,3,4,0,0,4,3,3,3,2,3,3,3,3,3,3, | |
645 3,3,3,3,3,4 | |
646 }; | |
647 | |
648 static const unsigned char ag_key_parm[] = { | |
649 0, 61, 66, 0, 0, 93,122, 92, 94,121,123, 95, 0, 65, 0,119,103, 0, | |
650 61, 66,104, 0, 88,122, 0,110,108, 0,101,102, 0,112,109,114, 93, 0, | |
651 92, 94,121,123, 95,107, 0, 93,122, 92, 94,121,123, 95, 0, 61, 66, 0, | |
652 110,108,119, 0,112,109,114,107, 0, 61, 66, 0, 0,122,121,123, 0, 61, | |
653 66, 0, 0, 0,122,121,123, 0,110,108,119,112,109,114,107, 0,110,108, | |
654 112,109,114,107, 0,110,108,109,107, 0,119,103, 0, 61, 66,104, 0,110, | |
655 108, 0,101,102, 0,112,109,114,107, 0,107, 0,119,103, 0,110,108, 0, | |
656 101,102,104,112,109,114,107, 0, 61, 66, 0, 88,122, 0, 0, 93, 0, 92, | |
657 94,121,123, 95, 0, 95, 0, 88,122, 0, 93, 0, 92, 94,121,123, 95, 0, | |
658 61, 66, 0,110,108,119, 0,112,109,114, 93,122, 92, 94,121,123, 95,107, | |
659 0 | |
660 }; | |
661 | |
662 static const unsigned short ag_key_jmp[] = { | |
663 0, 0, 0, 0, 1, 0, 2, 5, 8, 10, 13, 17, 0, 22, 0, 0, 0, 0, | |
664 0, 0, 0, 0, 40, 43, 0, 24, 26, 15, 28, 30, 18, 32, 34, 36, 38, 22, | |
665 45, 48, 50, 53, 57, 62, 0, 64, 66, 69, 72, 74, 77, 81, 0, 0, 0, 0, | |
666 86, 88, 90, 51, 92, 94, 96, 98, 0, 0, 0, 0, 63,100,103,106, 0, 0, | |
667 0, 0, 71, 0,110,113,116, 0,120,122,124,126,128,130,132, 0,134,136, | |
668 138,140,142,144, 0,146,148,150,152, 0, 0, 0, 0, 0, 0, 0, 0,154, | |
669 156,100,158,160,103,162,164,166,168, 0,170, 0, 0, 0, 0,172,174,120, | |
670 176,178,180,182,184,186,188, 0, 0, 0, 0,192,195, 0,134,190,137,197, | |
671 200,202,205,209, 0,214, 0,221,224, 0,219,151,226,229,231,234,238, 0, | |
672 0, 0, 0,243,245,247,162,249,251,253,255,257,260,263,265,268,272,277, | |
673 0 | |
674 }; | |
675 | |
676 static const unsigned char ag_key_index[] = { | |
677 4, 0, 13, 25, 43, 0, 0, 13, 13, 43, 0, 54, 54, 66, 66, 74, 74, 74, | |
678 54, 76, 76, 0, 0, 0, 66, 66, 80, 76, 76, 88, 88, 88, 95,107,118,107, | |
679 0,123, 4,140, 74, 74, 4, 43, 0, 74, 0, 0, 43, 0, 43, 43, 54, 54, | |
680 0, 0, 76, 76, 76, 66, 76, 66, 76, 66, 76, 76, 76, 66, 76, 66, 76, 66, | |
681 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, 76, 66, | |
682 76, 66, 76, 66, 76, 43, 66, 76, 76, 76,149, 76,154, 0, 0,165, 0, 0, | |
683 0, 88, 88, 88, 88, 88, 88, 88, 88, 0,140, 0, 0, 0, 0, 4, 43, 54, | |
684 54, 66, 76, 76, 0, 76, 0, 43 | |
685 }; | |
686 | |
687 static const unsigned char ag_key_ends[] = { | |
688 111,0, 120,112,0, 111,114,0, 102,0, 111,103,0, 113,114,116,0, | |
689 104,105,108,101,0, 47,0, 61,0, 38,0, 61,0, 61,0, 61,0, 61,0, | |
690 61,0, 111,0, 115,101,0, 112,0, 111,114,0, 102,0, 111,103,0, | |
691 113,114,116,0, 104,105,108,101,0, 124,0, 111,0, 120,112,0, | |
692 111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0, | |
693 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 120,112,0, | |
694 111,103,0, 113,114,116,0, 120,112,0, 111,103,0, 113,114,116,0, | |
695 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 124,0, 61,0, 38,0, 61,0, | |
696 61,0, 61,0, 124,0, 61,0, 38,0, 61,0, 124,0, 61,0, 38,0, | |
697 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 124,0, 61,0, 38,0, | |
698 61,0, 61,0, 61,0, 61,0, 61,0, 61,0, 124,0, 111,0, 115,101,0, | |
699 112,0, 111,114,0, 102,0, 111,103,0, 113,114,116,0, | |
700 104,105,108,101,0, 104,105,108,101,0, 111,0, 115,101,0, 112,0, | |
701 111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0, | |
702 61,0, 38,0, 42,0, 61,0, 61,0, 61,0, 111,0, 120,112,0, | |
703 111,114,0, 102,0, 111,103,0, 113,114,116,0, 104,105,108,101,0, | |
704 124,0, | |
705 }; | |
706 | |
707 #define AG_TCV(x) ag_tcv[(x)] | |
708 | |
709 static const unsigned char ag_tcv[] = { | |
710 6, 84, 84, 84, 84, 84, 84, 84, 84, 83, 70, 83, 83, 83, 84, 84, 84, 84, | |
711 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 83,124, 84, 84, | |
712 84, 84, 84, 84, 91, 89,117,115, 98,116, 76,118, 79, 79, 79, 79, 79, 79, | |
713 79, 79, 79, 79,105, 90,111, 99,113,106, 84, 85, 85, 85, 85, 72, 85, 85, | |
714 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, | |
715 85, 84, 84, 84, 84, 85, 84, 85, 85, 85, 85, 72, 85, 85, 85, 85, 85, 85, | |
716 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 97, 84, 96, | |
717 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | |
718 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | |
719 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | |
720 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | |
721 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | |
722 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | |
723 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | |
724 84, 84, 84, 84 | |
725 }; | |
726 | |
727 #ifndef SYNTAX_ERROR | |
728 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \ | |
729 (PCB).error_message, (PCB).line, (PCB).column) | |
730 #endif | |
731 | |
732 #ifndef FIRST_LINE | |
733 #define FIRST_LINE 1 | |
734 #endif | |
735 | |
736 #ifndef FIRST_COLUMN | |
737 #define FIRST_COLUMN 1 | |
738 #endif | |
739 | |
740 #ifndef PARSER_STACK_OVERFLOW | |
741 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \ | |
742 "\nParser stack overflow, line %d, column %d\n",\ | |
743 (PCB).line, (PCB).column);} | |
744 #endif | |
745 | |
746 #ifndef REDUCTION_TOKEN_ERROR | |
747 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \ | |
748 "\nReduction token error, line %d, column %d\n", \ | |
749 (PCB).line, (PCB).column);} | |
750 #endif | |
751 | |
752 | |
753 #ifndef INPUT_CODE | |
754 #define INPUT_CODE(T) (T) | |
755 #endif | |
756 | |
757 typedef enum | |
758 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key, | |
759 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words; | |
760 | |
761 static void ag_get_key_word(PCB_DECL, int ag_k) { | |
762 int ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
763 const unsigned char *ag_p; | |
764 int ag_ch; | |
765 while (1) { | |
766 switch (ag_key_act[ag_k]) { | |
767 case ag_cf_end_key: { | |
768 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k]; | |
769 do { | |
770 if ((ag_ch = *sp++) == 0) { | |
771 int ag_k1 = ag_key_parm[ag_k]; | |
772 int ag_k2 = ag_key_pt[ag_k1]; | |
773 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) goto ag_fail; | |
774 (PCB).token_number = (bciParse_token_type) ag_key_pt[ag_k1 + 1]; | |
775 return; | |
776 } | |
777 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); | |
778 goto ag_fail; | |
779 } | |
780 case ag_end_key: { | |
781 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k]; | |
782 do { | |
783 if ((ag_ch = *sp++) == 0) { | |
784 (PCB).token_number = (bciParse_token_type) ag_key_parm[ag_k]; | |
785 return; | |
786 } | |
787 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch); | |
788 } | |
789 case ag_no_match_key: | |
790 ag_fail: | |
791 (PCB).la_ptr = (PCB).pointer + ag_save; | |
792 return; | |
793 case ag_cf_set_key: { | |
794 int ag_k1 = ag_key_parm[ag_k]; | |
795 int ag_k2 = ag_key_pt[ag_k1]; | |
796 ag_k = ag_key_jmp[ag_k]; | |
797 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) break; | |
798 ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
799 (PCB).token_number = (bciParse_token_type) ag_key_pt[ag_k1+1]; | |
800 break; | |
801 } | |
802 case ag_set_key: | |
803 ag_save = (int) ((PCB).la_ptr - (PCB).pointer); | |
804 (PCB).token_number = (bciParse_token_type) ag_key_parm[ag_k]; | |
805 case ag_jmp_key: | |
806 ag_k = ag_key_jmp[ag_k]; | |
807 break; | |
808 case ag_accept_key: | |
809 (PCB).token_number = (bciParse_token_type) ag_key_parm[ag_k]; | |
810 return; | |
811 case ag_cf_accept_key: { | |
812 int ag_k1 = ag_key_parm[ag_k]; | |
813 int ag_k2 = ag_key_pt[ag_k1]; | |
814 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) | |
815 (PCB).la_ptr = (PCB).pointer + ag_save; | |
816 else (PCB).token_number = (bciParse_token_type) ag_key_pt[ag_k1+1]; | |
817 return; | |
818 } | |
819 } | |
820 ag_ch = CONVERT_CASE(*(PCB).la_ptr++); | |
821 ag_p = &ag_key_ch[ag_k]; | |
822 if (ag_ch <= 255) while (*ag_p < ag_ch) ag_p++; | |
823 if (ag_ch > 255 || *ag_p != ag_ch) { | |
824 (PCB).la_ptr = (PCB).pointer + ag_save; | |
825 return; | |
826 } | |
827 ag_k = (int) (ag_p - ag_key_ch); | |
828 } | |
829 } | |
830 | |
831 | |
832 #ifndef AG_NEWLINE | |
833 #define AG_NEWLINE 10 | |
834 #endif | |
835 | |
836 #ifndef AG_RETURN | |
837 #define AG_RETURN 13 | |
838 #endif | |
839 | |
840 #ifndef AG_FORMFEED | |
841 #define AG_FORMFEED 12 | |
842 #endif | |
843 | |
844 #ifndef AG_TABCHAR | |
845 #define AG_TABCHAR 9 | |
846 #endif | |
847 | |
848 static void ag_track(PCB_DECL) { | |
849 int ag_k = (int) ((PCB).la_ptr - (PCB).pointer); | |
850 while (ag_k--) { | |
851 switch (*(PCB).pointer++) { | |
852 case AG_NEWLINE: | |
853 (PCB).column = 1, (PCB).line++; | |
854 case AG_RETURN: | |
855 case AG_FORMFEED: | |
856 break; | |
857 case AG_TABCHAR: | |
858 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING); | |
859 break; | |
860 default: | |
861 (PCB).column++; | |
862 } | |
863 } | |
864 } | |
865 | |
866 | |
867 static void ag_prot(PCB_DECL) { | |
868 int ag_k; | |
869 ag_k = 128 - ++(PCB).btsx; | |
870 if (ag_k <= (PCB).ssx) { | |
871 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
872 PARSER_STACK_OVERFLOW; | |
873 return; | |
874 } | |
875 (PCB).bts[(PCB).btsx] = (PCB).sn; | |
876 (PCB).bts[ag_k] = (PCB).ssx; | |
877 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; | |
878 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; | |
879 } | |
880 | |
881 static void ag_undo(PCB_DECL) { | |
882 if ((PCB).drt == -1) return; | |
883 while ((PCB).btsx) { | |
884 int ag_k = 128 - (PCB).btsx; | |
885 (PCB).sn = (PCB).bts[(PCB).btsx--]; | |
886 (PCB).ssx = (PCB).bts[ag_k]; | |
887 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; | |
888 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; | |
889 } | |
890 (PCB).token_number = (bciParse_token_type) (PCB).drt; | |
891 (PCB).ssx = (PCB).dssx; | |
892 (PCB).sn = (PCB).dsn; | |
893 (PCB).drt = -1; | |
894 } | |
895 | |
896 | |
897 static const unsigned char ag_tstt[] = { | |
898 124,123,122,121,116,115,97,95,94,93,92,91,90,85,83,79,76,72,70,66,61,6,0,1, | |
899 86,87, | |
900 124,118,117,116,115,113,111,106,105,99,98,97,96,91,90,89,85,84,83,79,76,72, | |
901 70,0,68,69, | |
902 124,118,117,116,115,113,111,106,105,99,98,97,96,91,90,89,85,84,83,79,76,72, | |
903 70,65,0,63,64, | |
904 83,70,66,61,0,1, | |
905 124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,6,0,4,5, | |
906 124,118,117,116,115,113,111,106,105,99,98,97,96,91,90,89,85,84,83,79,76,72, | |
907 0, | |
908 70,0, | |
909 124,118,117,116,115,113,111,106,105,99,98,97,96,91,90,89,85,84,83,79,76,72, | |
910 70,0, | |
911 65,0, | |
912 124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,6,0,2,3,7,8,9,10, | |
913 12,13,14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56, | |
914 57,58,59,71,75,80,100,120, | |
915 79,0,77, | |
916 119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,98,90,89,83,79, | |
917 76,72,70,66,61,0,78, | |
918 72,0, | |
919 124,123,122,121,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
920 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
921 91,83,70,66,61,0,1,86,87, | |
922 91,83,70,66,61,0,1,86,87, | |
923 91,83,70,66,61,0,1,86,87, | |
924 119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,98,90,89,83,70, | |
925 66,61,0,1,86,87, | |
926 124,123,122,121,91,85,79,76,72,0,2,3,14,54,56,57,58,59,71,75,80,100,120, | |
927 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, | |
928 48,49,50,53,54,56,57,58,59,71,75,80,100,120, | |
929 91,0,14, | |
930 91,0,14, | |
931 91,0,14, | |
932 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
933 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
934 119,0,55, | |
935 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, | |
936 71,75,80,100,120, | |
937 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, | |
938 71,75,80,100,120, | |
939 118,117,0,51,52, | |
940 116,115,0,48,49, | |
941 114,113,112,111,0,43,44,45,46, | |
942 110,109,108,0,38,40,41, | |
943 85,79,72,0, | |
944 107,0,36, | |
945 119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101, | |
946 99,98,90,89,83,70,66,61,0,1,86,87, | |
947 106,0,33, | |
948 104,103,102,101,99,0,27,28,29,30,31, | |
949 124,123,122,121,116,115,97,96,95,94,93,92,91,90,85,83,79,76,72,70,66,61,0,1, | |
950 86,87, | |
951 124,123,122,121,116,115,97,96,95,94,93,92,91,90,88,85,83,79,76,72,70,66,61, | |
952 6,0,1,86,87, | |
953 91,83,70,66,61,0,1,86,87, | |
954 91,83,70,66,61,0,1,86,87, | |
955 124,123,122,121,116,115,97,95,94,93,92,91,90,85,83,79,76,72,70,66,61,0,1,86, | |
956 87, | |
957 124,123,122,121,116,115,97,96,95,94,93,92,91,90,85,79,76,72,0,5, | |
958 98,90,0,16,25, | |
959 91,83,70,66,61,0,1,86,87, | |
960 91,0,14, | |
961 91,0,14, | |
962 124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,7,8,9,10,12, | |
963 13,14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57, | |
964 58,59,71,75,80,100,120, | |
965 91,0,14, | |
966 124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,8,9,10,12,13, | |
967 14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57,58, | |
968 59,71,75,80,100,120, | |
969 124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,7,8,9,10,12, | |
970 13,14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57, | |
971 58,59,71,75,80,100,120, | |
972 79,0,77, | |
973 79,0,77, | |
974 116,115,79,0,73, | |
975 98,89,0,17,25, | |
976 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
977 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
978 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
979 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
980 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
981 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
982 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
983 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, | |
984 71,75,80,100,120, | |
985 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
986 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, | |
987 71,75,80,100,120, | |
988 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
989 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,48,49,50,53,54,56,57,58,59, | |
990 71,75,80,100,120, | |
991 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,47,48,49,50,53,54,56,57,58, | |
992 59,71,75,80,100,120, | |
993 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,47,48,49,50,53,54,56,57,58, | |
994 59,71,75,80,100,120, | |
995 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
996 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,42,47,48,49,50,53,54,56,57, | |
997 58,59,71,75,80,100,120, | |
998 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
999 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,42,47,48,49,50,53,54,56,57, | |
1000 58,59,71,75,80,100,120, | |
1001 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1002 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,42,47,48,49,50,53,54,56,57, | |
1003 58,59,71,75,80,100,120, | |
1004 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1005 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,42,47,48,49,50,53,54,56,57, | |
1006 58,59,71,75,80,100,120, | |
1007 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1008 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,39,42,47,48,49,50,53,54,56, | |
1009 57,58,59,71,75,80,100,120, | |
1010 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1011 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,39,42,47,48,49,50,53,54,56, | |
1012 57,58,59,71,75,80,100,120, | |
1013 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1014 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,35,37,39,42,47,48,49,50,53, | |
1015 54,56,57,58,59,71,75,80,100,120, | |
1016 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1017 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,32,35,37,39,42,47,48,49,50, | |
1018 53,54,56,57,58,59,71,75,80,100,120, | |
1019 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1020 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, | |
1021 48,49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1022 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1023 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
1024 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1025 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1026 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
1027 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1028 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1029 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
1030 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1031 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1032 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
1033 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1034 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1035 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
1036 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1037 124,123,122,121,116,115,97,96,95,94,93,92,91,90,85,79,76,72,0,2,3,7,8,9,10, | |
1038 12,13,14,15,16,18,19,20,21,22,23,24,26,32,35,37,39,42,47,48,49,50,53,54, | |
1039 56,57,58,59,71,75,80,100,120, | |
1040 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1041 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,24,26,32,35,37,39,42,47,48, | |
1042 49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1043 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, | |
1044 48,49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1045 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, | |
1046 48,49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1047 95,0,12,21, | |
1048 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, | |
1049 48,49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1050 88,0,11, | |
1051 79,0,74, | |
1052 79,0,74, | |
1053 124,123,122,121,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105, | |
1054 98,97,95,94,93,92,91,90,89,85,83,79,76,72,70,66,61,0,1,86,87, | |
1055 89,0,17, | |
1056 89,0,17, | |
1057 89,0,17, | |
1058 118,117,0,51,52, | |
1059 118,117,0,51,52, | |
1060 116,115,0,48,49, | |
1061 116,115,0,48,49, | |
1062 116,115,0,48,49, | |
1063 116,115,0,48,49, | |
1064 114,113,112,111,0,43,44,45,46, | |
1065 114,113,112,111,0,43,44,45,46, | |
1066 105,98,0,25,34, | |
1067 124,123,122,121,116,115,97,96,95,94,93,92,91,90,88,85,83,79,76,72,70,66,61, | |
1068 6,0,1,86,87, | |
1069 98,89,0,17,25, | |
1070 98,89,0,17,25, | |
1071 90,0,16, | |
1072 98,90,0,16,25, | |
1073 124,123,122,121,116,115,97,95,94,93,92,91,90,85,83,79,76,72,70,66,61,0,1,86, | |
1074 87, | |
1075 124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,8,9,10,12,13, | |
1076 14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57,58, | |
1077 59,71,75,80,100,120, | |
1078 79,0, | |
1079 79,0, | |
1080 124,123,122,121,116,115,91,85,83,79,76,72,70,66,61,0,1,86,87, | |
1081 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,26,32,35,37,39,42,47,48,49, | |
1082 50,53,54,56,57,58,59,71,75,80,100,120, | |
1083 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, | |
1084 48,49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1085 98,90,0,16,25, | |
1086 124,123,122,121,116,115,91,85,79,76,72,0,2,3,14,15,24,26,32,35,37,39,42,47, | |
1087 48,49,50,53,54,56,57,58,59,71,75,80,100,120, | |
1088 98,89,0,17,25, | |
1089 124,123,122,121,116,115,97,95,94,93,92,91,90,85,79,76,72,0,2,3,8,9,10,12,13, | |
1090 14,15,16,18,19,20,21,22,24,26,32,35,37,39,42,47,48,49,50,53,54,56,57,58, | |
1091 59,71,75,80,100,120, | |
1092 | |
1093 }; | |
1094 | |
1095 | |
1096 static unsigned const char ag_astt[2635] = { | |
1097 8,8,8,8,8,8,8,8,8,8,8,8,8,8,1,8,8,8,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1098 1,1,1,1,1,1,1,1,1,1,1,8,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1099 1,8,7,1,1,9,9,1,1,5,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,0,1,9,9,9,9,9, | |
1100 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,3,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9, | |
1101 9,9,9,9,9,9,5,3,7,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,7,2,1,2,2,2,1,1,1,1, | |
1102 1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,2,5,5,5,5,5, | |
1103 5,5,5,5,5,5,5,5,5,5,5,5,5,5,10,1,5,5,5,5,7,3,1,4,5,5,5,5,5,5,1,5,5,5,1,1,1, | |
1104 7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,5,1,1,1,1,7,1,1,3,5,1,1,1,1, | |
1105 7,1,1,3,5,1,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,1,1,1,7,1, | |
1106 1,3,1,1,1,1,1,2,2,1,2,7,2,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7, | |
1107 2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,7,1,1,7,1,5,5, | |
1108 5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1, | |
1109 5,1,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1110 1,2,2,1,2,7,2,2,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,5,1,1,1,1,5,1,1,1,1,1,1, | |
1111 5,1,1,1,1,1,1,1,5,1,1,1,10,10,10,4,1,5,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, | |
1112 5,5,5,5,5,5,1,1,1,1,7,1,1,3,1,5,1,1,1,1,1,1,4,1,1,1,1,1,5,5,5,5,5,5,5,5,5, | |
1113 5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5, | |
1114 1,1,1,5,7,1,1,3,5,1,1,1,1,7,1,1,3,5,1,1,1,1,7,1,1,3,5,5,5,5,5,5,5,5,5,5,5, | |
1115 5,5,5,1,5,5,5,1,1,1,7,1,1,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,7,1,1,1,7, | |
1116 2,1,5,1,1,1,1,7,1,1,3,1,7,1,1,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1, | |
1117 1,1,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1118 7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,2,2,1,1,1,1,1,2,2,1,1,1,1,1,1, | |
1119 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2, | |
1120 7,2,1,2,2,1,1,1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1121 1,1,1,4,2,1,5,2,1,1,8,7,1,1,1,7,2,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,1,1,1,1, | |
1122 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,1,1,1,1, | |
1123 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,1,1,1,1, | |
1124 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3, | |
1125 1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5, | |
1126 1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1,1,2,2,1,1,1,1,1,1,1, | |
1127 1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1, | |
1128 1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1,1,1,1,1,1,1,1, | |
1129 1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1130 5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1,1,1, | |
1131 1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1, | |
1132 1,1,2,2,1,2,7,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5, | |
1133 5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1134 1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1, | |
1135 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1, | |
1136 1,1,1,1,2,2,1,2,7,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5, | |
1137 1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,1,1,1,1,1,1,1,1,1,1,1, | |
1138 1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7, | |
1139 2,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1, | |
1140 7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1141 1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,1, | |
1142 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1, | |
1143 7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1144 1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,1, | |
1145 1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1, | |
1146 1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1147 1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2, | |
1148 1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5,5,5,1, | |
1149 1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1150 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,2,2,2,1,1,1,1,1,2,2, | |
1151 1,1,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,5,5,5,5,5,5,5,1,5, | |
1152 5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1, | |
1153 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1154 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1155 1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,1,1,1,1,1,1,1, | |
1156 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,5,1,2,7,1,2,7,1,5,5,5,5,5,5,5,5,5,5,5,5, | |
1157 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,7,2,1,7,2,1,7,2, | |
1158 1,1,4,1,1,1,1,4,1,1,1,1,4,1,1,1,1,4,1,1,1,1,4,1,1,1,1,4,1,1,1,1,1,1,4,1,1, | |
1159 1,1,1,1,1,1,4,1,1,1,1,1,1,7,1,1,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,1,5,5,5,1, | |
1160 1,1,5,7,1,1,3,1,1,7,2,1,1,1,7,2,1,1,7,2,1,1,7,1,1,5,5,5,5,5,5,5,5,5,5,5,5, | |
1161 5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,2,2,1,1, | |
1162 1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,10,4,10,4,5, | |
1163 5,5,5,5,5,5,5,1,5,5,5,1,1,1,7,1,1,3,1,1,1,1,1,1,1,2,2,1,2,7,2,2,1,2,1,1,1, | |
1164 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1,1,1,1,1,1,1, | |
1165 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,2,2,1,2,7,2,1, | |
1166 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,7,1,1,1,1,1,1,1,1,1,1, | |
1167 1,1,1,1,1,2,2,1,2,7,2,1,2,2,1,1,1,1,1,2,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1168 1,1,1,1,1,1,1,1,1,1 | |
1169 }; | |
1170 | |
1171 | |
1172 static const unsigned char ag_pstt[] = { | |
1173 4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,4,4,4,3,1,2,4,0,3,3,4, | |
1174 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,6,1,5,6, | |
1175 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,8,2,7,8, | |
1176 143,143,1,2,145,143, | |
1177 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,4,0,9, | |
1178 67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,67,69, | |
1179 70,6, | |
1180 62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,62,64, | |
1181 65,8, | |
1182 13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,1,9,53,37,3,3,3,51,50,49, | |
1183 20,44,18,3,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23,22,21, | |
1184 19,12,11,33,35,18, | |
1185 52,10,80, | |
1186 77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,77,82,53,77,77,77,77, | |
1187 11,79, | |
1188 54,71, | |
1189 144,144,144,144,144,144,3,144,144,144,3,1,2,13,3,3,182, | |
1190 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,14,3,3,149, | |
1191 144,3,3,1,2,15,3,3,181, | |
1192 144,3,3,1,2,16,3,3,180, | |
1193 144,3,3,1,2,17,3,3,179, | |
1194 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,3, | |
1195 1,2,18,3,3,178, | |
1196 13,15,16,17,14,88,81,10,88,19,53,54,20,59,23,22,21,19,12,11,33,35,18, | |
1197 13,15,16,17,25,24,14,88,81,10,88,20,53,37,20,55,55,55,36,34,32,31,30,29,27, | |
1198 28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1199 14,21,56, | |
1200 14,22,57, | |
1201 14,23,58, | |
1202 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,24,3,3,173, | |
1203 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,25,3,3,174, | |
1204 59,51,60, | |
1205 13,15,16,17,25,24,14,88,81,10,88,27,53,54,20,27,28,50,50,26,23,22,21,19,12, | |
1206 11,33,35,18, | |
1207 13,15,16,17,25,24,14,88,81,10,88,28,53,54,20,27,28,49,49,26,23,22,21,19,12, | |
1208 11,33,35,18, | |
1209 61,63,42,64,62, | |
1210 25,24,37,66,65, | |
1211 67,69,71,73,34,74,72,70,68, | |
1212 75,77,79,32,80,78,76, | |
1213 89,89,89,87, | |
1214 81,30,82, | |
1215 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, | |
1216 144,144,144,144,3,3,1,2,35,3,3,158, | |
1217 83,28,84, | |
1218 85,87,89,91,93,54,94,92,90,88,86, | |
1219 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144,144,3, | |
1220 1,2,38,3,3,155, | |
1221 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144, | |
1222 144,3,1,2,144,39,3,3,148, | |
1223 144,3,3,1,2,40,3,3,153, | |
1224 144,3,3,1,2,41,3,3,152, | |
1225 144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144,144,3,1,2, | |
1226 42,3,3,151, | |
1227 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,43,95, | |
1228 96,39,44,17,97, | |
1229 144,3,3,1,2,45,3,3,150, | |
1230 14,46,98, | |
1231 14,47,99, | |
1232 13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,48,53,37,100,100,100,51, | |
1233 50,49,20,44,18,100,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26, | |
1234 23,22,21,19,12,11,33,35,18, | |
1235 14,49,101, | |
1236 13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,50,53,37,8,12,51,50,49, | |
1237 20,44,18,12,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23,22,21, | |
1238 19,12,11,33,35,18, | |
1239 13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,51,53,37,6,6,102,51,50, | |
1240 49,20,44,18,102,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23, | |
1241 22,21,19,12,11,33,35,18, | |
1242 52,83,84, | |
1243 52,78,76, | |
1244 103,104,104,54,104, | |
1245 96,105,55,58,97, | |
1246 13,15,16,17,25,24,14,88,81,10,88,56,53,37,20,106,106,36,34,32,31,30,29,27, | |
1247 28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1248 13,15,16,17,25,24,14,88,81,10,88,57,53,37,20,107,107,36,34,32,31,30,29,27, | |
1249 28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1250 13,15,16,17,25,24,14,88,81,10,88,58,53,37,20,108,108,36,34,32,31,30,29,27, | |
1251 28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1252 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,59,3,3,177, | |
1253 13,15,16,17,25,24,14,88,81,10,88,60,53,54,20,27,28,52,52,26,23,22,21,19,12, | |
1254 11,33,35,18, | |
1255 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,61,3,3,176, | |
1256 13,15,16,17,25,24,14,88,81,10,88,62,53,54,20,27,28,47,47,26,23,22,21,19,12, | |
1257 11,33,35,18, | |
1258 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,63,3,3,175, | |
1259 13,15,16,17,25,24,14,88,81,10,88,64,53,54,20,27,28,46,46,26,23,22,21,19,12, | |
1260 11,33,35,18, | |
1261 13,15,16,17,25,24,14,88,81,10,88,65,53,54,20,109,27,28,109,109,26,23,22,21, | |
1262 19,12,11,33,35,18, | |
1263 13,15,16,17,25,24,14,88,81,10,88,66,53,54,20,110,27,28,110,110,26,23,22,21, | |
1264 19,12,11,33,35,18, | |
1265 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,67,3,3,172, | |
1266 13,15,16,17,25,24,14,88,81,10,88,68,53,54,20,111,29,27,28,29,29,26,23,22,21, | |
1267 19,12,11,33,35,18, | |
1268 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,69,3,3,171, | |
1269 13,15,16,17,25,24,14,88,81,10,88,70,53,54,20,112,29,27,28,29,29,26,23,22,21, | |
1270 19,12,11,33,35,18, | |
1271 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,71,3,3,170, | |
1272 13,15,16,17,25,24,14,88,81,10,88,72,53,54,20,113,29,27,28,29,29,26,23,22,21, | |
1273 19,12,11,33,35,18, | |
1274 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,73,3,3,169, | |
1275 13,15,16,17,25,24,14,88,81,10,88,74,53,54,20,114,29,27,28,29,29,26,23,22,21, | |
1276 19,12,11,33,35,18, | |
1277 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,75,3,3,168, | |
1278 13,15,16,17,25,24,14,88,81,10,88,76,53,54,20,115,30,29,27,28,29,29,26,23,22, | |
1279 21,19,12,11,33,35,18, | |
1280 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,77,3,3,167, | |
1281 13,15,16,17,25,24,14,88,81,10,88,78,53,54,20,116,30,29,27,28,29,29,26,23,22, | |
1282 21,19,12,11,33,35,18, | |
1283 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,79,3,3,166, | |
1284 13,15,16,17,25,24,14,88,81,10,88,80,53,54,20,33,32,31,30,29,27,28,29,29,26, | |
1285 23,22,21,19,12,11,33,35,18, | |
1286 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,81,3,3,165, | |
1287 13,15,16,17,25,24,14,88,81,10,88,82,53,54,20,31,34,32,31,30,29,27,28,29,29, | |
1288 26,23,22,21,19,12,11,33,35,18, | |
1289 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,83,3,3,164, | |
1290 13,15,16,17,25,24,14,88,81,10,88,84,53,37,20,117,117,117,36,34,32,31,30,29, | |
1291 27,28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1292 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,85,3,3,162, | |
1293 13,15,16,17,25,24,14,88,81,10,88,86,53,37,20,27,27,36,34,32,31,30,29,27,28, | |
1294 29,29,26,23,22,21,19,12,11,33,35,18, | |
1295 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,87,3,3,161, | |
1296 13,15,16,17,25,24,14,88,81,10,88,88,53,37,20,26,26,36,34,32,31,30,29,27,28, | |
1297 29,29,26,23,22,21,19,12,11,33,35,18, | |
1298 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,89,3,3,160, | |
1299 13,15,16,17,25,24,14,88,81,10,88,90,53,37,20,25,25,36,34,32,31,30,29,27,28, | |
1300 29,29,26,23,22,21,19,12,11,33,35,18, | |
1301 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,91,3,3,159, | |
1302 13,15,16,17,25,24,14,88,81,10,88,92,53,37,20,24,24,36,34,32,31,30,29,27,28, | |
1303 29,29,26,23,22,21,19,12,11,33,35,18, | |
1304 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,93,3,3,157, | |
1305 13,15,16,17,25,24,14,88,81,10,88,94,53,37,20,23,23,36,34,32,31,30,29,27,28, | |
1306 29,29,26,23,22,21,19,12,11,33,35,18, | |
1307 13,15,16,17,25,24,38,118,40,41,42,45,14,39,88,81,10,88,95,53,37,3,3,3,51,50, | |
1308 49,20,44,18,3,48,47,46,43,19,44,44,36,34,32,31,30,29,27,28,29,29,26,23, | |
1309 22,21,19,12,11,33,35,18, | |
1310 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,96,3,3,156, | |
1311 13,15,16,17,25,24,14,88,81,10,88,97,53,37,20,21,21,36,34,32,31,30,29,27,28, | |
1312 29,29,26,23,22,21,19,12,11,33,35,18, | |
1313 13,15,16,17,25,24,14,88,81,10,88,98,53,37,20,119,119,119,36,34,32,31,30,29, | |
1314 27,28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1315 13,15,16,17,25,24,14,88,81,10,88,99,53,37,20,120,120,120,36,34,32,31,30,29, | |
1316 27,28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1317 40,100,121,46, | |
1318 13,15,16,17,25,24,14,88,81,10,88,101,53,37,20,122,122,122,36,34,32,31,30,29, | |
1319 27,28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1320 123,5,124, | |
1321 85,103,125, | |
1322 85,104,126, | |
1323 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144, | |
1324 144,144,144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,105,3,3,147, | |
1325 105,106,57, | |
1326 105,107,56, | |
1327 105,108,55, | |
1328 61,63,44,64,62, | |
1329 61,63,43,64,62, | |
1330 25,24,41,66,65, | |
1331 25,24,40,66,65, | |
1332 25,24,39,66,65, | |
1333 25,24,38,66,65, | |
1334 67,69,71,73,36,74,72,70,68, | |
1335 67,69,71,73,35,74,72,70,68, | |
1336 127,96,117,97,128, | |
1337 144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144, | |
1338 144,3,1,2,144,118,3,3,154, | |
1339 96,105,119,16,97, | |
1340 96,105,120,15,97, | |
1341 39,121,13, | |
1342 96,39,122,129,97, | |
1343 144,144,144,144,144,144,144,144,144,144,144,144,144,144,3,144,144,144,3,1,2, | |
1344 123,3,3,146, | |
1345 13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,124,53,37,7,11,51,50,49, | |
1346 20,44,18,11,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23,22,21, | |
1347 19,12,11,33,35,18, | |
1348 86,75, | |
1349 86,74, | |
1350 144,144,144,144,144,144,144,144,3,144,144,144,3,1,2,127,3,3,163, | |
1351 13,15,16,17,25,24,14,88,81,10,88,128,53,54,20,29,36,34,32,31,30,29,27,28,29, | |
1352 29,26,23,22,21,19,12,11,33,35,18, | |
1353 13,15,16,17,25,24,14,88,81,10,88,129,53,37,20,130,130,130,36,34,32,31,30,29, | |
1354 27,28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1355 96,39,130,131,97, | |
1356 13,15,16,17,25,24,14,88,81,10,88,131,53,37,20,132,132,132,36,34,32,31,30,29, | |
1357 27,28,29,29,26,23,22,21,19,12,11,33,35,18, | |
1358 96,105,132,133,97, | |
1359 13,15,16,17,25,24,38,40,41,42,45,14,39,88,81,10,88,133,53,37,9,14,51,50,49, | |
1360 20,44,18,14,48,47,46,43,44,44,36,34,32,31,30,29,27,28,29,29,26,23,22,21, | |
1361 19,12,11,33,35,18, | |
1362 | |
1363 }; | |
1364 | |
1365 | |
1366 static const unsigned short ag_sbt[] = { | |
1367 0, 26, 52, 79, 85, 106, 129, 131, 155, 157, 214, 217, 244, 246, | |
1368 263, 282, 291, 300, 309, 335, 358, 396, 399, 402, 405, 424, 443, 446, | |
1369 475, 504, 509, 514, 523, 530, 534, 537, 568, 571, 582, 608, 636, 645, | |
1370 654, 679, 699, 704, 713, 716, 719, 775, 778, 833, 889, 892, 895, 900, | |
1371 905, 942, 979,1016,1035,1064,1083,1112,1131,1160,1190,1220,1239,1270, | |
1372 1289,1320,1339,1370,1389,1420,1439,1471,1490,1522,1541,1575,1594,1629, | |
1373 1648,1686,1705,1742,1761,1798,1817,1854,1873,1910,1929,1966,2024,2043, | |
1374 2080,2118,2156,2160,2198,2201,2204,2207,2247,2250,2253,2256,2261,2266, | |
1375 2271,2276,2281,2286,2295,2304,2309,2337,2342,2347,2350,2355,2380,2435, | |
1376 2437,2439,2458,2494,2532,2537,2575,2580,2635 | |
1377 }; | |
1378 | |
1379 | |
1380 static const unsigned short ag_sbe[] = { | |
1381 22, 49, 76, 83, 103, 128, 130, 154, 156, 175, 215, 242, 245, 259, | |
1382 278, 287, 296, 305, 331, 344, 369, 397, 400, 403, 420, 439, 444, 457, | |
1383 486, 506, 511, 518, 526, 533, 535, 564, 569, 576, 604, 632, 641, 650, | |
1384 675, 697, 701, 709, 714, 717, 736, 776, 795, 850, 890, 893, 898, 902, | |
1385 916, 953, 990,1031,1046,1079,1094,1127,1142,1171,1201,1235,1250,1285, | |
1386 1300,1335,1350,1385,1400,1435,1450,1486,1501,1537,1552,1590,1605,1644, | |
1387 1659,1701,1716,1757,1772,1813,1828,1869,1884,1925,1940,1984,2039,2054, | |
1388 2091,2129,2157,2171,2199,2202,2205,2243,2248,2251,2254,2258,2263,2268, | |
1389 2273,2278,2283,2290,2299,2306,2333,2339,2344,2348,2352,2376,2397,2436, | |
1390 2438,2454,2469,2505,2534,2548,2577,2597,2635 | |
1391 }; | |
1392 | |
1393 | |
1394 static const unsigned char ag_fl[] = { | |
1395 2,2,0,2,1,1,2,4,2,9,1,4,2,4,9,4,4,2,1,3,1,3,1,3,3,3,3,3,1,5,1,3,1,3,1, | |
1396 3,3,1,3,3,3,3,1,3,3,1,3,3,1,2,2,1,3,1,1,4,4,4,3,2,1,1,2,0,1,3,1,2,0,1, | |
1397 3,1,0,1,4,4,3,0,1,2,2,1,2,1,2,1,2,1,1,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1398 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1, | |
1399 1,1,1,2,0,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2, | |
1400 2,2,2,2,2,2,2,2 | |
1401 }; | |
1402 | |
1403 static const unsigned char ag_ptt[] = { | |
1404 0, 4, 5, 5, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 9, 10, 12, 18, | |
1405 18, 18, 15, 15, 24, 24, 24, 24, 24, 24, 26, 26, 32, 32, 35, 35, 37, 37, | |
1406 37, 39, 39, 39, 39, 39, 42, 42, 42, 47, 47, 47, 50, 50, 50, 53, 53, 54, | |
1407 54, 54, 54, 54, 54, 54, 1, 63, 63, 64, 64, 1, 68, 68, 69, 69, 1,120, | |
1408 73, 73,120,120, 71, 78, 78, 71, 71, 75, 75, 77, 77, 74, 74,100, 80, 80, | |
1409 60, 60, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62, | |
1410 62, 62, 62, 62, 62, 62, 62, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, | |
1411 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 81, 81, 82, 82, 82, 86, 86, | |
1412 87, 87, 11, 17, 16, 14, 13, 19, 20, 21, 23, 22, 25, 27, 3, 28, 29, 30, | |
1413 31, 34, 33, 36, 38, 40, 41, 43, 44, 45, 46, 48, 49, 51, 52, 55, 2, 56, | |
1414 57, 58, 59 | |
1415 }; | |
1416 | |
1417 | |
1418 static void ag_ra(PCB_DECL) | |
1419 { | |
1420 switch(ag_rpx[(PCB).ag_ap]) { | |
1421 case 1: VRO(AG_WRAP_4 *, ag_rp_1(PCB_POINTER, VW(0, AG_WRAP_4 *))); break; | |
1422 case 2: VNO AG_WRAP_4(ag_rp_2(PCB_POINTER)); break; | |
1423 case 3: VRO(AG_WRAP_4 *, ag_rp_3(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *))); | |
1424 VWD(1, AG_WRAP_4 *); break; | |
1425 case 4: VRO(AG_WRAP_4 *, ag_rp_4(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *))); | |
1426 VWD(1, AG_WRAP_4 *); break; | |
1427 case 5: VRO(AG_WRAP_4 *, ag_rp_5(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *), VW(3, AG_WRAP_4 *))); | |
1428 VWD(1, AG_WRAP_4 *); VWD(3, AG_WRAP_4 *); break; | |
1429 case 6: VRO(AG_WRAP_4 *, ag_rp_6(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *))); | |
1430 VWD(1, AG_WRAP_4 *); break; | |
1431 case 7: VNO AG_WRAP_4(ag_rp_7(PCB_POINTER, VW(2, AG_WRAP_4 *), VW(4, AG_WRAP_4 *), VW(6, AG_WRAP_4 *), VW(8, AG_WRAP_4 *))); | |
1432 VWD(2, AG_WRAP_4 *); VWD(4, AG_WRAP_4 *); VWD(6, AG_WRAP_4 *); VWD(8, AG_WRAP_4 *); break; | |
1433 case 8: VRO(AG_WRAP_4 *, ag_rp_8(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *), VW(3, AG_WRAP_4 *))); | |
1434 VWD(1, AG_WRAP_4 *); VWD(3, AG_WRAP_4 *); break; | |
1435 case 9: VRO(AG_WRAP_4 *, ag_rp_9(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(1, AG_WRAP_4 *))); | |
1436 VWD(1, AG_WRAP_4 *); break; | |
1437 case 10: VNO AG_WRAP_4(ag_rp_10(PCB_POINTER, VW(1, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1438 VWD(1, AG_WRAP_4 *); VWD(2, AG_WRAP_4 *); break; | |
1439 case 11: VNO AG_WRAP_4(ag_rp_11(PCB_POINTER, VW(2, AG_WRAP_4 *), VW(4, AG_WRAP_4 *), VW(6, AG_WRAP_4 *), VW(8, AG_WRAP_4 *))); | |
1440 VWD(2, AG_WRAP_4 *); VWD(4, AG_WRAP_4 *); VWD(6, AG_WRAP_4 *); VWD(8, AG_WRAP_4 *); break; | |
1441 case 12: VNO AG_WRAP_4(ag_rp_12(PCB_POINTER, VW(2, AG_WRAP_4 *))); | |
1442 VWD(2, AG_WRAP_4 *); break; | |
1443 case 13: VNO AG_WRAP_4(ag_rp_13(PCB_POINTER, VW(2, AG_WRAP_4 *))); | |
1444 VWD(2, AG_WRAP_4 *); break; | |
1445 case 14: VRO(AG_WRAP_4 *, ag_rp_14(PCB_POINTER, VW(0, AG_WRAP_4 *))); break; | |
1446 case 15: VNO AG_WRAP_4(ag_rp_15(PCB_POINTER)); break; | |
1447 case 16: VNO AG_WRAP_4(ag_rp_16(PCB_POINTER, VW(1, AG_WRAP_4 *))); | |
1448 VWD(1, AG_WRAP_4 *); break; | |
1449 case 17: VRO(AG_WRAP_4 *, ag_rp_17(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1450 VWD(2, AG_WRAP_4 *); break; | |
1451 case 18: VNO AG_WRAP_4(ag_rp_18(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); | |
1452 VWD(2, AG_WRAP_4 *); break; | |
1453 case 19: VNO AG_WRAP_4(ag_rp_19(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); | |
1454 VWD(2, AG_WRAP_4 *); break; | |
1455 case 20: VNO AG_WRAP_4(ag_rp_20(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); | |
1456 VWD(2, AG_WRAP_4 *); break; | |
1457 case 21: VNO AG_WRAP_4(ag_rp_21(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); | |
1458 VWD(2, AG_WRAP_4 *); break; | |
1459 case 22: VNO AG_WRAP_4(ag_rp_22(PCB_POINTER, V(0,(int *)), VW(2, AG_WRAP_4 *))); | |
1460 VWD(2, AG_WRAP_4 *); break; | |
1461 case 23: VRO(AG_WRAP_4 *, ag_rp_23(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *), VW(4, AG_WRAP_4 *))); | |
1462 VWD(2, AG_WRAP_4 *); VWD(4, AG_WRAP_4 *); break; | |
1463 case 24: VRO(AG_WRAP_4 *, ag_rp_24(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1464 VWD(2, AG_WRAP_4 *); break; | |
1465 case 25: VRO(AG_WRAP_4 *, ag_rp_25(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1466 VWD(2, AG_WRAP_4 *); break; | |
1467 case 26: VRO(AG_WRAP_4 *, ag_rp_26(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1468 VWD(2, AG_WRAP_4 *); break; | |
1469 case 27: VRO(AG_WRAP_4 *, ag_rp_27(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1470 VWD(2, AG_WRAP_4 *); break; | |
1471 case 28: VRO(AG_WRAP_4 *, ag_rp_28(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1472 VWD(2, AG_WRAP_4 *); break; | |
1473 case 29: VRO(AG_WRAP_4 *, ag_rp_29(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1474 VWD(2, AG_WRAP_4 *); break; | |
1475 case 30: VRO(AG_WRAP_4 *, ag_rp_30(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1476 VWD(2, AG_WRAP_4 *); break; | |
1477 case 31: VRO(AG_WRAP_4 *, ag_rp_31(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1478 VWD(2, AG_WRAP_4 *); break; | |
1479 case 32: VRO(AG_WRAP_4 *, ag_rp_32(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1480 VWD(2, AG_WRAP_4 *); break; | |
1481 case 33: VRO(AG_WRAP_4 *, ag_rp_33(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1482 VWD(2, AG_WRAP_4 *); break; | |
1483 case 34: VRO(AG_WRAP_4 *, ag_rp_34(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1484 VWD(2, AG_WRAP_4 *); break; | |
1485 case 35: VRO(AG_WRAP_4 *, ag_rp_35(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1486 VWD(2, AG_WRAP_4 *); break; | |
1487 case 36: VNO AG_WRAP_4(ag_rp_36(PCB_POINTER, VW(1, AG_WRAP_4 *))); | |
1488 VWD(1, AG_WRAP_4 *); break; | |
1489 case 37: VNO AG_WRAP_4(ag_rp_37(PCB_POINTER, VW(1, AG_WRAP_4 *))); | |
1490 VWD(1, AG_WRAP_4 *); break; | |
1491 case 38: VRO(AG_WRAP_4 *, ag_rp_38(PCB_POINTER, VW(0, AG_WRAP_4 *), VW(2, AG_WRAP_4 *))); | |
1492 VWD(2, AG_WRAP_4 *); break; | |
1493 case 39: VNO AG_WRAP_4(ag_rp_39(PCB_POINTER, V(0,(int *)))); break; | |
1494 case 40: VNO AG_WRAP_4(ag_rp_40(PCB_POINTER, V(0,(int *)))); break; | |
1495 case 41: VNO AG_WRAP_4(ag_rp_41(PCB_POINTER, VW(2, AG_WRAP_4 *))); | |
1496 VWD(2, AG_WRAP_4 *); break; | |
1497 case 42: VNO AG_WRAP_4(ag_rp_42(PCB_POINTER, VW(2, AG_WRAP_4 *))); | |
1498 VWD(2, AG_WRAP_4 *); break; | |
1499 case 43: VNO AG_WRAP_4(ag_rp_43(PCB_POINTER, VW(2, AG_WRAP_4 *))); | |
1500 VWD(2, AG_WRAP_4 *); break; | |
1501 case 44: VNO AG_WRAP_4(ag_rp_44(PCB_POINTER, VW(1, AG_WRAP_4 *))); | |
1502 VWD(1, AG_WRAP_4 *); break; | |
1503 case 45: VNO AG_WRAP_4(ag_rp_45(PCB_POINTER, VW(1, AG_WRAP_4 *))); | |
1504 VWD(1, AG_WRAP_4 *); break; | |
1505 case 46: V(0,(int *)) = ag_rp_46(PCB_POINTER, V(0,(double *))); break; | |
1506 case 47: V(0,(int *)) = ag_rp_47(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; | |
1507 case 48: V(0,(int *)) = ag_rp_48(PCB_POINTER, V(0,(double *)), V(3,(int *))); break; | |
1508 case 49: V(0,(double *)) = ag_rp_49(PCB_POINTER, V(0,(double *)), V(2,(double *))); break; | |
1509 case 50: V(0,(double *)) = ag_rp_50(PCB_POINTER, V(1,(double *))); break; | |
1510 case 51: V(0,(double *)) = ag_rp_51(PCB_POINTER, V(0,(int *))); break; | |
1511 case 52: V(0,(double *)) = ag_rp_52(PCB_POINTER, V(0,(double *)), V(1,(int *))); break; | |
1512 case 53: V(0,(double *)) = ag_rp_53(PCB_POINTER, V(0,(int *))); break; | |
1513 case 54: V(0,(double *)) = ag_rp_54(PCB_POINTER, V(0,(int *)), V(1,(double *))); break; | |
1514 case 55: V(0,(int *)) = ag_rp_55(PCB_POINTER, V(0,(int *))); break; | |
1515 case 56: V(0,(int *)) = ag_rp_56(PCB_POINTER, V(0,(int *)), V(1,(int *))); break; | |
1516 case 57: V(0,(int *)) = ag_rp_57(PCB_POINTER); break; | |
1517 case 58: ag_rp_58(PCB_POINTER, V(0,(int *))); break; | |
1518 case 59: ag_rp_59(PCB_POINTER, V(1,(int *))); break; | |
1519 } | |
1520 (PCB).la_ptr = (PCB).pointer; | |
1521 } | |
1522 | |
1523 #define TOKEN_NAMES bciParse_token_names | |
1524 const char *const bciParse_token_names[125] = { | |
1525 "input string", | |
1526 "white space", | |
1527 "real", | |
1528 "name", | |
1529 "input string", | |
1530 "statements", | |
1531 "eof", | |
1532 "statement", | |
1533 "open statement", | |
1534 "closed statement", | |
1535 "if clause", | |
1536 "\"else\"", | |
1537 "while clause", | |
1538 "\"for\"", | |
1539 "'('", | |
1540 "expression", | |
1541 "';'", | |
1542 "')'", | |
1543 "simple statement", | |
1544 "\"do\"", | |
1545 "\"if\"", | |
1546 "\"while\"", | |
1547 "'{'", | |
1548 "'}'", | |
1549 "assignment expression", | |
1550 "','", | |
1551 "conditional expression", | |
1552 "'='", | |
1553 "\"+=\"", | |
1554 "\"-=\"", | |
1555 "\"*=\"", | |
1556 "\"/=\"", | |
1557 "logical or expression", | |
1558 "'\\?'", | |
1559 "':'", | |
1560 "logical and expression", | |
1561 "\"||\"", | |
1562 "equality expression", | |
1563 "\"&&\"", | |
1564 "relational expression", | |
1565 "\"==\"", | |
1566 "\"!=\"", | |
1567 "additive expression", | |
1568 "'<'", | |
1569 "\"<=\"", | |
1570 "'>'", | |
1571 "\">=\"", | |
1572 "multiplicative expression", | |
1573 "'+'", | |
1574 "'-'", | |
1575 "unary expression", | |
1576 "'*'", | |
1577 "'/'", | |
1578 "factor", | |
1579 "primary", | |
1580 "\"**\"", | |
1581 "\"log\"", | |
1582 "\"exp\"", | |
1583 "\"sqrt\"", | |
1584 "'!'", | |
1585 "", | |
1586 "\"/*\"", | |
1587 "", | |
1588 "", | |
1589 "", | |
1590 "\"*/\"", | |
1591 "\"//\"", | |
1592 "", | |
1593 "", | |
1594 "", | |
1595 "'\\n'", | |
1596 "simple real", | |
1597 "", | |
1598 "", | |
1599 "exponent", | |
1600 "integer part", | |
1601 "'.'", | |
1602 "fraction part", | |
1603 "", | |
1604 "digit", | |
1605 "name string", | |
1606 "letter", | |
1607 "", | |
1608 "", | |
1609 "", | |
1610 "", | |
1611 "", | |
1612 "", | |
1613 "\"else\"", | |
1614 "')'", | |
1615 "';'", | |
1616 "'('", | |
1617 "\"for\"", | |
1618 "\"do\"", | |
1619 "\"if\"", | |
1620 "\"while\"", | |
1621 "'}'", | |
1622 "'{'", | |
1623 "','", | |
1624 "'='", | |
1625 "name", | |
1626 "\"+=\"", | |
1627 "\"-=\"", | |
1628 "\"*=\"", | |
1629 "\"/=\"", | |
1630 "':'", | |
1631 "'\\?'", | |
1632 "\"||\"", | |
1633 "\"&&\"", | |
1634 "\"==\"", | |
1635 "\"!=\"", | |
1636 "'<'", | |
1637 "\"<=\"", | |
1638 "'>'", | |
1639 "\">=\"", | |
1640 "'+'", | |
1641 "'-'", | |
1642 "'*'", | |
1643 "'/'", | |
1644 "\"**\"", | |
1645 "real", | |
1646 "\"log\"", | |
1647 "\"exp\"", | |
1648 "\"sqrt\"", | |
1649 "'!'", | |
1650 | |
1651 }; | |
1652 | |
1653 #ifndef MISSING_FORMAT | |
1654 #define MISSING_FORMAT "Missing %s" | |
1655 #endif | |
1656 #ifndef UNEXPECTED_FORMAT | |
1657 #define UNEXPECTED_FORMAT "Unexpected %s" | |
1658 #endif | |
1659 #ifndef UNNAMED_TOKEN | |
1660 #define UNNAMED_TOKEN "input" | |
1661 #endif | |
1662 | |
1663 | |
1664 static void ag_diagnose(PCB_DECL) { | |
1665 int ag_snd = (PCB).sn; | |
1666 int ag_k = ag_sbt[ag_snd]; | |
1667 | |
1668 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) { | |
1669 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
1670 } | |
1671 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8 | |
1672 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 | |
1673 && *TOKEN_NAMES[ag_tstt[ag_k]]) { | |
1674 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
1675 } | |
1676 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) { | |
1677 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]); | |
1678 } | |
1679 else if (isprint(INPUT_CODE((*(PCB).pointer))) && INPUT_CODE((*(PCB).pointer)) != '\\') { | |
1680 char buf[20]; | |
1681 sprintf(buf, "\'%c\'", (char) INPUT_CODE((*(PCB).pointer))); | |
1682 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf); | |
1683 } | |
1684 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN); | |
1685 (PCB).error_message = (PCB).ag_msg; | |
1686 | |
1687 | |
1688 } | |
1689 static int ag_action_1_r_proc(PCB_DECL); | |
1690 static int ag_action_2_r_proc(PCB_DECL); | |
1691 static int ag_action_3_r_proc(PCB_DECL); | |
1692 static int ag_action_4_r_proc(PCB_DECL); | |
1693 static int ag_action_1_s_proc(PCB_DECL); | |
1694 static int ag_action_3_s_proc(PCB_DECL); | |
1695 static int ag_action_1_proc(PCB_DECL); | |
1696 static int ag_action_2_proc(PCB_DECL); | |
1697 static int ag_action_3_proc(PCB_DECL); | |
1698 static int ag_action_4_proc(PCB_DECL); | |
1699 static int ag_action_5_proc(PCB_DECL); | |
1700 static int ag_action_6_proc(PCB_DECL); | |
1701 static int ag_action_7_proc(PCB_DECL); | |
1702 static int ag_action_8_proc(PCB_DECL); | |
1703 static int ag_action_9_proc(PCB_DECL); | |
1704 static int ag_action_10_proc(PCB_DECL); | |
1705 static int ag_action_11_proc(PCB_DECL); | |
1706 static int ag_action_8_proc(PCB_DECL); | |
1707 | |
1708 | |
1709 static int (*const ag_r_procs_scan[])(PCB_DECL) = { | |
1710 ag_action_1_r_proc, | |
1711 ag_action_2_r_proc, | |
1712 ag_action_3_r_proc, | |
1713 ag_action_4_r_proc | |
1714 }; | |
1715 | |
1716 static int (*const ag_s_procs_scan[])(PCB_DECL) = { | |
1717 ag_action_1_s_proc, | |
1718 ag_action_2_r_proc, | |
1719 ag_action_3_s_proc, | |
1720 ag_action_4_r_proc | |
1721 }; | |
1722 | |
1723 static int (*const ag_gt_procs_scan[])(PCB_DECL) = { | |
1724 ag_action_1_proc, | |
1725 ag_action_2_proc, | |
1726 ag_action_3_proc, | |
1727 ag_action_4_proc, | |
1728 ag_action_5_proc, | |
1729 ag_action_6_proc, | |
1730 ag_action_7_proc, | |
1731 ag_action_8_proc, | |
1732 ag_action_9_proc, | |
1733 ag_action_10_proc, | |
1734 ag_action_11_proc, | |
1735 ag_action_8_proc | |
1736 }; | |
1737 | |
1738 | |
1739 static int ag_action_10_proc(PCB_DECL) { | |
1740 int ag_t = (PCB).token_number; | |
1741 (PCB).btsx = 0, (PCB).drt = -1; | |
1742 do { | |
1743 ag_track(PCB_POINTER); | |
1744 (PCB).token_number = (bciParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1745 (PCB).la_ptr++; | |
1746 if (ag_key_index[(PCB).sn]) { | |
1747 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1748 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
1749 if (ag_ch <= 255) { | |
1750 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1751 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); | |
1752 } | |
1753 } | |
1754 } while ((PCB).token_number == (bciParse_token_type) ag_t); | |
1755 (PCB).la_ptr = (PCB).pointer; | |
1756 return 1; | |
1757 } | |
1758 | |
1759 static int ag_action_11_proc(PCB_DECL) { | |
1760 int ag_t = (PCB).token_number; | |
1761 | |
1762 (PCB).btsx = 0, (PCB).drt = -1; | |
1763 do { | |
1764 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1765 (PCB).ssx--; | |
1766 ag_track(PCB_POINTER); | |
1767 ag_ra(PCB_POINTER); | |
1768 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0; | |
1769 (PCB).ssx++; | |
1770 (PCB).token_number = (bciParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1771 (PCB).la_ptr++; | |
1772 if (ag_key_index[(PCB).sn]) { | |
1773 unsigned ag_k = ag_key_index[(PCB).sn]; | |
1774 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
1775 if (ag_ch <= 255) { | |
1776 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
1777 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); | |
1778 } | |
1779 } | |
1780 } | |
1781 while ((PCB).token_number == (bciParse_token_type) ag_t); | |
1782 (PCB).la_ptr = (PCB).pointer; | |
1783 return 1; | |
1784 } | |
1785 | |
1786 static int ag_action_3_r_proc(PCB_DECL) { | |
1787 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1788 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1789 (PCB).btsx = 0, (PCB).drt = -1; | |
1790 (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; | |
1791 ag_ra(PCB_POINTER); | |
1792 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1793 } | |
1794 | |
1795 static int ag_action_3_s_proc(PCB_DECL) { | |
1796 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1797 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1798 (PCB).btsx = 0, (PCB).drt = -1; | |
1799 (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; | |
1800 ag_ra(PCB_POINTER); | |
1801 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1802 } | |
1803 | |
1804 static int ag_action_4_r_proc(PCB_DECL) { | |
1805 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1806 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1807 (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; | |
1808 return 1; | |
1809 } | |
1810 | |
1811 static int ag_action_2_proc(PCB_DECL) { | |
1812 (PCB).btsx = 0, (PCB).drt = -1; | |
1813 if ((PCB).ssx >= 128) { | |
1814 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
1815 PARSER_STACK_OVERFLOW; | |
1816 } | |
1817 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1818 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1819 (PCB).ssx++; | |
1820 (PCB).sn = (PCB).ag_ap; | |
1821 ag_track(PCB_POINTER); | |
1822 return 0; | |
1823 } | |
1824 | |
1825 static int ag_action_9_proc(PCB_DECL) { | |
1826 if ((PCB).drt == -1) { | |
1827 (PCB).drt=(PCB).token_number; | |
1828 (PCB).dssx=(PCB).ssx; | |
1829 (PCB).dsn=(PCB).sn; | |
1830 } | |
1831 ag_prot(PCB_POINTER); | |
1832 (PCB).vs[(PCB).ssx] = ag_null_value; | |
1833 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1834 (PCB).ssx++; | |
1835 (PCB).sn = (PCB).ag_ap; | |
1836 (PCB).la_ptr = (PCB).pointer; | |
1837 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1838 } | |
1839 | |
1840 static int ag_action_2_r_proc(PCB_DECL) { | |
1841 (PCB).ssx++; | |
1842 (PCB).sn = (PCB).ag_ap; | |
1843 return 0; | |
1844 } | |
1845 | |
1846 static int ag_action_7_proc(PCB_DECL) { | |
1847 --(PCB).ssx; | |
1848 (PCB).la_ptr = (PCB).pointer; | |
1849 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1850 return 0; | |
1851 } | |
1852 | |
1853 static int ag_action_1_proc(PCB_DECL) { | |
1854 ag_track(PCB_POINTER); | |
1855 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1856 return 0; | |
1857 } | |
1858 | |
1859 static int ag_action_1_r_proc(PCB_DECL) { | |
1860 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1861 return 0; | |
1862 } | |
1863 | |
1864 static int ag_action_1_s_proc(PCB_DECL) { | |
1865 (PCB).exit_flag = AG_SUCCESS_CODE; | |
1866 return 0; | |
1867 } | |
1868 | |
1869 static int ag_action_4_proc(PCB_DECL) { | |
1870 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1871 (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; | |
1872 (PCB).btsx = 0, (PCB).drt = -1; | |
1873 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1874 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1875 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1876 ag_track(PCB_POINTER); | |
1877 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1878 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1879 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1880 do { | |
1881 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1882 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1883 else ag_t2 = ag_tx; | |
1884 } while (ag_t1 < ag_t2); | |
1885 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1886 if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; | |
1887 } | |
1888 return 0; | |
1889 } | |
1890 | |
1891 static int ag_action_3_proc(PCB_DECL) { | |
1892 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
1893 (PCB).btsx = 0, (PCB).drt = -1; | |
1894 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer; | |
1895 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1896 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1897 ag_track(PCB_POINTER); | |
1898 (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; | |
1899 ag_ra(PCB_POINTER); | |
1900 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1901 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1902 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1903 do { | |
1904 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1905 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1906 else ag_t2 = ag_tx; | |
1907 } while (ag_t1 < ag_t2); | |
1908 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1909 if ((ag_s_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; | |
1910 } | |
1911 return 0; | |
1912 } | |
1913 | |
1914 static int ag_action_8_proc(PCB_DECL) { | |
1915 ag_undo(PCB_POINTER); | |
1916 (PCB).la_ptr = (PCB).pointer; | |
1917 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE; | |
1918 ag_diagnose(PCB_POINTER); | |
1919 SYNTAX_ERROR; | |
1920 {(PCB).la_ptr = (PCB).pointer + 1; ag_track(PCB_POINTER);} | |
1921 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1922 } | |
1923 | |
1924 static int ag_action_5_proc(PCB_DECL) { | |
1925 int ag_sd = ag_fl[(PCB).ag_ap]; | |
1926 (PCB).btsx = 0, (PCB).drt = -1; | |
1927 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1928 else { | |
1929 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1930 } | |
1931 (PCB).la_ptr = (PCB).pointer; | |
1932 (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; | |
1933 ag_ra(PCB_POINTER); | |
1934 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1935 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1936 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1937 do { | |
1938 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1939 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1940 else ag_t2 = ag_tx; | |
1941 } while (ag_t1 < ag_t2); | |
1942 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1943 if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; | |
1944 } | |
1945 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1946 } | |
1947 | |
1948 static int ag_action_6_proc(PCB_DECL) { | |
1949 int ag_sd = ag_fl[(PCB).ag_ap]; | |
1950 (PCB).reduction_token = (bciParse_token_type) ag_ptt[(PCB).ag_ap]; | |
1951 if ((PCB).drt == -1) { | |
1952 (PCB).drt=(PCB).token_number; | |
1953 (PCB).dssx=(PCB).ssx; | |
1954 (PCB).dsn=(PCB).sn; | |
1955 } | |
1956 if (ag_sd) { | |
1957 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
1958 } | |
1959 else { | |
1960 ag_prot(PCB_POINTER); | |
1961 (PCB).vs[(PCB).ssx] = ag_null_value; | |
1962 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
1963 } | |
1964 (PCB).la_ptr = (PCB).pointer; | |
1965 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1966 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
1967 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
1968 do { | |
1969 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
1970 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
1971 else ag_t2 = ag_tx; | |
1972 } while (ag_t1 < ag_t2); | |
1973 (PCB).ag_ap = ag_pstt[ag_t1]; | |
1974 if ((ag_r_procs_scan[ag_astt[ag_t1]])(PCB_POINTER) == 0) break; | |
1975 } | |
1976 return (PCB).exit_flag == AG_RUNNING_CODE; | |
1977 } | |
1978 | |
1979 | |
1980 void init_bciParse(bciParse_pcb_type *PCB_POINTER) { | |
1981 (PCB).la_ptr = (PCB).pointer; | |
1982 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; | |
1983 (PCB).exit_flag = AG_RUNNING_CODE; | |
1984 (PCB).line = FIRST_LINE; | |
1985 (PCB).column = FIRST_COLUMN; | |
1986 (PCB).btsx = 0, (PCB).drt = -1; | |
1987 } | |
1988 | |
1989 void bciParse(bciParse_pcb_type *PCB_POINTER) { | |
1990 init_bciParse(PCB_POINTER); | |
1991 (PCB).exit_flag = AG_RUNNING_CODE; | |
1992 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
1993 unsigned ag_t1 = ag_sbt[(PCB).sn]; | |
1994 if (ag_tstt[ag_t1]) { | |
1995 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; | |
1996 (PCB).token_number = (bciParse_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr)); | |
1997 (PCB).la_ptr++; | |
1998 if (ag_key_index[(PCB).sn]) { | |
1999 unsigned ag_k = ag_key_index[(PCB).sn]; | |
2000 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer)); | |
2001 if (ag_ch <= 255) { | |
2002 while (ag_key_ch[ag_k] < ag_ch) ag_k++; | |
2003 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word((PCB_TYPE *)PCB_POINTER, ag_k); | |
2004 } | |
2005 } | |
2006 do { | |
2007 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
2008 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number) | |
2009 ag_t1 = ag_tx + 1; | |
2010 else ag_t2 = ag_tx; | |
2011 } while (ag_t1 < ag_t2); | |
2012 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number) | |
2013 ag_t1 = ag_sbe[(PCB).sn]; | |
2014 } | |
2015 (PCB).ag_ap = ag_pstt[ag_t1]; | |
2016 (ag_gt_procs_scan[ag_astt[ag_t1]])((PCB_TYPE *)PCB_POINTER); | |
2017 } | |
2018 } | |
2019 | |
2020 |