comparison tests/agcl/parsifal/good/tpia2.c @ 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 /*
3 * AnaGram, A System for Syntax Directed Programming
4 * File generated by: ...
5 *
6 * AnaGram Parsing Engine
7 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
8 *
9 * This software is provided 'as-is', without any express or implied
10 * warranty. In no event will the authors be held liable for any damages
11 * arising from the use of this software.
12 *
13 * Permission is granted to anyone to use this software for any purpose,
14 * including commercial applications, and to alter it and redistribute it
15 * freely, subject to the following restrictions:
16 *
17 * 1. The origin of this software must not be misrepresented; you must not
18 * claim that you wrote the original software. If you use this software
19 * in a product, an acknowledgment in the product documentation would be
20 * appreciated but is not required.
21 * 2. Altered source versions must be plainly marked as such, and must not be
22 * misrepresented as being the original software.
23 * 3. This notice may not be removed or altered from any source distribution.
24 */
25
26 #ifndef TPIA2_H
27 #include "tpia2.h"
28 #endif
29
30 #ifndef TPIA2_H
31 #error Mismatched header file
32 #endif
33
34 #include <ctype.h>
35 #include <stdio.h>
36
37 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx]))
38 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx])
39 #define CONTEXT ((PCB).cs[(PCB).ssx])
40
41
42
43 tpia2_pcb_type tpia2_pcb;
44 #define PCB tpia2_pcb
45
46 #ifndef CONVERT_CASE
47 #define CONVERT_CASE(c) (c)
48 #endif
49 #ifndef TAB_SPACING
50 #define TAB_SPACING 8
51 #endif
52
53 static void ag_rp_1(int a, int b) {
54 /* Line -, tpia2.syn */
55 printf("immed: %c%c\n", a, b);
56 }
57
58 static void ag_rp_2(int a, int b) {
59 /* Line -, tpia2.syn */
60 printf("reduce: %c%c\n", a,b);
61 }
62
63
64 #define READ_COUNTS
65 #define WRITE_COUNTS
66 #undef V
67 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i]))
68 #undef VS
69 #define VS(i) (PCB).vs[(PCB).ssx + i]
70
71 #ifndef GET_CONTEXT
72 #define GET_CONTEXT CONTEXT = (PCB).input_context
73 #endif
74
75 typedef enum {
76 ag_action_1,
77 ag_action_2,
78 ag_action_3,
79 ag_action_4,
80 ag_action_5,
81 ag_action_6,
82 ag_action_7,
83 ag_action_8,
84 ag_action_9,
85 ag_action_10,
86 ag_action_11,
87 ag_action_12
88 } ag_parser_action;
89
90
91 #ifndef NULL_VALUE_INITIALIZER
92 #define NULL_VALUE_INITIALIZER = 0
93 #endif
94
95 static int const ag_null_value NULL_VALUE_INITIALIZER;
96
97 static const unsigned char ag_rpx[] = {
98 0, 1, 2
99 };
100 #define AG_TCV(x) (((int)(x) >= -1 && (int)(x) <= 255) ? ag_tcv[(x) + 1] : 0)
101
102 static const unsigned char ag_tcv[] = {
103 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0,
104 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
105 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
106 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2,
107 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
108 2, 2, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
109 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 0,
110 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
111 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
112 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
113 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
114 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
115 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
116 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
117 0, 0, 0, 0, 0
118 };
119
120 #ifndef SYNTAX_ERROR
121 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \
122 (PCB).error_message, (PCB).line, (PCB).column)
123 #endif
124
125 #ifndef FIRST_LINE
126 #define FIRST_LINE 1
127 #endif
128
129 #ifndef FIRST_COLUMN
130 #define FIRST_COLUMN 1
131 #endif
132
133 #ifndef PARSER_STACK_OVERFLOW
134 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \
135 "\nParser stack overflow, line %d, column %d\n",\
136 (PCB).line, (PCB).column);}
137 #endif
138
139 #ifndef REDUCTION_TOKEN_ERROR
140 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \
141 "\nReduction token error, line %d, column %d\n", \
142 (PCB).line, (PCB).column);}
143 #endif
144
145
146 #ifndef GET_INPUT
147 #define GET_INPUT ((PCB).input_code = getchar())
148 #endif
149
150
151 #ifndef AG_NEWLINE
152 #define AG_NEWLINE 10
153 #endif
154
155 #ifndef AG_RETURN
156 #define AG_RETURN 13
157 #endif
158
159 #ifndef AG_FORMFEED
160 #define AG_FORMFEED 12
161 #endif
162
163 #ifndef AG_TABCHAR
164 #define AG_TABCHAR 9
165 #endif
166
167 static void ag_track(void) {
168 switch ((PCB).input_code) {
169 case AG_NEWLINE:
170 (PCB).column = 1, (PCB).line++;
171 case AG_RETURN:
172 case AG_FORMFEED:
173 break;
174 case AG_TABCHAR:
175 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING);
176 break;
177 default:
178 (PCB).column++;
179 }
180 (PCB).read_flag = 1;
181 }
182
183
184 static void ag_prot(void) {
185 int ag_k;
186 ag_k = 128 - ++(PCB).btsx;
187 if (ag_k <= (PCB).ssx) {
188 (PCB).exit_flag = AG_STACK_ERROR_CODE;
189 PARSER_STACK_OVERFLOW;
190 return;
191 }
192 (PCB).bts[(PCB).btsx] = (PCB).sn;
193 (PCB).bts[ag_k] = (PCB).ssx;
194 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx];
195 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx];
196 }
197
198 static void ag_undo(void) {
199 if ((PCB).drt == -1) return;
200 while ((PCB).btsx) {
201 int ag_k = 128 - (PCB).btsx;
202 (PCB).sn = (PCB).bts[(PCB).btsx--];
203 (PCB).ssx = (PCB).bts[ag_k];
204 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k];
205 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k];
206 }
207 (PCB).token_number = (tpia2_token_type) (PCB).drt;
208 (PCB).ssx = (PCB).dssx;
209 (PCB).sn = (PCB).dsn;
210 (PCB).drt = -1;
211 }
212
213
214 static const unsigned char ag_tstt[] = {
215 8,2,0,1,5,6,7,
216 2,0,
217 2,0,5,
218 8,0,
219 4,0,3,
220 4,0,
221
222 };
223
224
225 static unsigned const char ag_astt[19] = {
226 8,1,7,0,1,1,1,1,7,1,5,3,3,7,4,7,1,2,7
227 };
228
229
230 static const unsigned char ag_pstt[] = {
231 3,1,0,0,2,2,3,
232 4,1,
233 1,6,4,
234 7,3,
235 1,4,5,
236 2,5,
237
238 };
239
240
241 static const unsigned char ag_sbt[] = {
242 0, 7, 9, 12, 14, 17, 19
243 };
244
245
246 static const unsigned char ag_sbe[] = {
247 2, 8, 10, 13, 15, 18, 19
248 };
249
250
251 static const unsigned char ag_fl[] = {
252 1,0,4,1,2,0,1,2
253 };
254
255 static const unsigned char ag_ptt[] = {
256 0, 3, 5, 6, 6, 7, 7, 1
257 };
258
259
260 static void ag_ra(void)
261 {
262 switch(ag_rpx[(PCB).ag_ap]) {
263 case 1: ag_rp_1(VS(-2), VS(-1)); break;
264 case 2: ag_rp_2(VS(0), VS(1)); break;
265 }
266 }
267
268 #define TOKEN_NAMES tpia2_token_names
269 const char *const tpia2_token_names[9] = {
270 "grammar",
271 "grammar",
272 "letter",
273 "",
274 "'\\n'",
275 "",
276 "",
277 "",
278 "",
279
280 };
281
282 #ifndef MISSING_FORMAT
283 #define MISSING_FORMAT "Missing %s"
284 #endif
285 #ifndef UNEXPECTED_FORMAT
286 #define UNEXPECTED_FORMAT "Unexpected %s"
287 #endif
288 #ifndef UNNAMED_TOKEN
289 #define UNNAMED_TOKEN "input"
290 #endif
291
292
293 static void ag_diagnose(void) {
294 int ag_snd = (PCB).sn;
295 int ag_k = ag_sbt[ag_snd];
296
297 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) {
298 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
299 }
300 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8
301 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1
302 && *TOKEN_NAMES[ag_tstt[ag_k]]) {
303 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
304 }
305 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) {
306 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]);
307 }
308 else if (isprint(((PCB).input_code)) && ((PCB).input_code) != '\\') {
309 char buf[20];
310 sprintf(buf, "\'%c\'", (char) ((PCB).input_code));
311 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf);
312 }
313 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN);
314 (PCB).error_message = (PCB).ag_msg;
315
316
317 }
318 static int ag_action_1_r_proc(void);
319 static int ag_action_2_r_proc(void);
320 static int ag_action_3_r_proc(void);
321 static int ag_action_4_r_proc(void);
322 static int ag_action_1_s_proc(void);
323 static int ag_action_3_s_proc(void);
324 static int ag_action_1_proc(void);
325 static int ag_action_2_proc(void);
326 static int ag_action_3_proc(void);
327 static int ag_action_4_proc(void);
328 static int ag_action_5_proc(void);
329 static int ag_action_6_proc(void);
330 static int ag_action_7_proc(void);
331 static int ag_action_8_proc(void);
332 static int ag_action_9_proc(void);
333 static int ag_action_10_proc(void);
334 static int ag_action_11_proc(void);
335 static int ag_action_8_proc(void);
336
337
338 static int (*const ag_r_procs_scan[])(void) = {
339 ag_action_1_r_proc,
340 ag_action_2_r_proc,
341 ag_action_3_r_proc,
342 ag_action_4_r_proc
343 };
344
345 static int (*const ag_s_procs_scan[])(void) = {
346 ag_action_1_s_proc,
347 ag_action_2_r_proc,
348 ag_action_3_s_proc,
349 ag_action_4_r_proc
350 };
351
352 static int (*const ag_gt_procs_scan[])(void) = {
353 ag_action_1_proc,
354 ag_action_2_proc,
355 ag_action_3_proc,
356 ag_action_4_proc,
357 ag_action_5_proc,
358 ag_action_6_proc,
359 ag_action_7_proc,
360 ag_action_8_proc,
361 ag_action_9_proc,
362 ag_action_10_proc,
363 ag_action_11_proc,
364 ag_action_8_proc
365 };
366
367
368 static int ag_action_10_proc(void) {
369 int ag_t = (PCB).token_number;
370 (PCB).btsx = 0, (PCB).drt = -1;
371 do {
372 ag_track();
373 if ((PCB).read_flag) {
374 (PCB).read_flag = 0;
375 GET_INPUT;
376 };
377 (PCB).token_number = (tpia2_token_type) AG_TCV((PCB).input_code);
378 } while ((PCB).token_number == (tpia2_token_type) ag_t);
379 return 1;
380 }
381
382 static int ag_action_11_proc(void) {
383 int ag_t = (PCB).token_number;
384
385 (PCB).btsx = 0, (PCB).drt = -1;
386 do {
387 (PCB).vs[(PCB).ssx] = (PCB).input_code;
388 (PCB).ssx--;
389 ag_track();
390 ag_ra();
391 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0;
392 (PCB).ssx++;
393 if ((PCB).read_flag) {
394 (PCB).read_flag = 0;
395 GET_INPUT;
396 };
397 (PCB).token_number = (tpia2_token_type) AG_TCV((PCB).input_code);
398 }
399 while ((PCB).token_number == (tpia2_token_type) ag_t);
400 return 1;
401 }
402
403 static int ag_action_3_r_proc(void) {
404 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
405 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
406 (PCB).btsx = 0, (PCB).drt = -1;
407 (PCB).reduction_token = (tpia2_token_type) ag_ptt[(PCB).ag_ap];
408 ag_ra();
409 return (PCB).exit_flag == AG_RUNNING_CODE;
410 }
411
412 static int ag_action_3_s_proc(void) {
413 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
414 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
415 (PCB).btsx = 0, (PCB).drt = -1;
416 (PCB).reduction_token = (tpia2_token_type) ag_ptt[(PCB).ag_ap];
417 ag_ra();
418 return (PCB).exit_flag == AG_RUNNING_CODE;
419 }
420
421 static int ag_action_4_r_proc(void) {
422 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
423 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
424 (PCB).reduction_token = (tpia2_token_type) ag_ptt[(PCB).ag_ap];
425 return 1;
426 }
427
428 static int ag_action_2_proc(void) {
429 (PCB).btsx = 0, (PCB).drt = -1;
430 if ((PCB).ssx >= 128) {
431 (PCB).exit_flag = AG_STACK_ERROR_CODE;
432 PARSER_STACK_OVERFLOW;
433 }
434 (PCB).vs[(PCB).ssx] = (PCB).input_code;
435 (PCB).ss[(PCB).ssx] = (PCB).sn;
436 (PCB).ssx++;
437 (PCB).sn = (PCB).ag_ap;
438 ag_track();
439 return 0;
440 }
441
442 static int ag_action_9_proc(void) {
443 if ((PCB).drt == -1) {
444 (PCB).drt=(PCB).token_number;
445 (PCB).dssx=(PCB).ssx;
446 (PCB).dsn=(PCB).sn;
447 }
448 ag_prot();
449 (PCB).vs[(PCB).ssx] = ag_null_value;
450 (PCB).ss[(PCB).ssx] = (PCB).sn;
451 (PCB).ssx++;
452 (PCB).sn = (PCB).ag_ap;
453 return (PCB).exit_flag == AG_RUNNING_CODE;
454 }
455
456 static int ag_action_2_r_proc(void) {
457 (PCB).ssx++;
458 (PCB).sn = (PCB).ag_ap;
459 return 0;
460 }
461
462 static int ag_action_7_proc(void) {
463 --(PCB).ssx;
464 (PCB).exit_flag = AG_SUCCESS_CODE;
465 return 0;
466 }
467
468 static int ag_action_1_proc(void) {
469 ag_track();
470 (PCB).exit_flag = AG_SUCCESS_CODE;
471 return 0;
472 }
473
474 static int ag_action_1_r_proc(void) {
475 (PCB).exit_flag = AG_SUCCESS_CODE;
476 return 0;
477 }
478
479 static int ag_action_1_s_proc(void) {
480 (PCB).exit_flag = AG_SUCCESS_CODE;
481 return 0;
482 }
483
484 static int ag_action_4_proc(void) {
485 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
486 (PCB).reduction_token = (tpia2_token_type) ag_ptt[(PCB).ag_ap];
487 (PCB).btsx = 0, (PCB).drt = -1;
488 (PCB).vs[(PCB).ssx] = (PCB).input_code;
489 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
490 else (PCB).ss[(PCB).ssx] = (PCB).sn;
491 ag_track();
492 while ((PCB).exit_flag == AG_RUNNING_CODE) {
493 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
494 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
495 do {
496 unsigned ag_tx = (ag_t1 + ag_t2)/2;
497 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
498 else ag_t2 = ag_tx;
499 } while (ag_t1 < ag_t2);
500 (PCB).ag_ap = ag_pstt[ag_t1];
501 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
502 }
503 return 0;
504 }
505
506 static int ag_action_3_proc(void) {
507 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
508 (PCB).btsx = 0, (PCB).drt = -1;
509 (PCB).vs[(PCB).ssx] = (PCB).input_code;
510 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
511 else (PCB).ss[(PCB).ssx] = (PCB).sn;
512 ag_track();
513 (PCB).reduction_token = (tpia2_token_type) ag_ptt[(PCB).ag_ap];
514 ag_ra();
515 while ((PCB).exit_flag == AG_RUNNING_CODE) {
516 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
517 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
518 do {
519 unsigned ag_tx = (ag_t1 + ag_t2)/2;
520 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
521 else ag_t2 = ag_tx;
522 } while (ag_t1 < ag_t2);
523 (PCB).ag_ap = ag_pstt[ag_t1];
524 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break;
525 }
526 return 0;
527 }
528
529 static int ag_action_8_proc(void) {
530 ag_undo();
531 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE;
532 ag_diagnose();
533 SYNTAX_ERROR;
534 ag_track();
535 return (PCB).exit_flag == AG_RUNNING_CODE;
536 }
537
538 static int ag_action_5_proc(void) {
539 int ag_sd = ag_fl[(PCB).ag_ap];
540 (PCB).btsx = 0, (PCB).drt = -1;
541 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
542 else {
543 (PCB).ss[(PCB).ssx] = (PCB).sn;
544 }
545 (PCB).reduction_token = (tpia2_token_type) ag_ptt[(PCB).ag_ap];
546 ag_ra();
547 while ((PCB).exit_flag == AG_RUNNING_CODE) {
548 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
549 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
550 do {
551 unsigned ag_tx = (ag_t1 + ag_t2)/2;
552 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
553 else ag_t2 = ag_tx;
554 } while (ag_t1 < ag_t2);
555 (PCB).ag_ap = ag_pstt[ag_t1];
556 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break;
557 }
558 return (PCB).exit_flag == AG_RUNNING_CODE;
559 }
560
561 static int ag_action_6_proc(void) {
562 int ag_sd = ag_fl[(PCB).ag_ap];
563 (PCB).reduction_token = (tpia2_token_type) ag_ptt[(PCB).ag_ap];
564 if ((PCB).drt == -1) {
565 (PCB).drt=(PCB).token_number;
566 (PCB).dssx=(PCB).ssx;
567 (PCB).dsn=(PCB).sn;
568 }
569 if (ag_sd) {
570 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
571 }
572 else {
573 ag_prot();
574 (PCB).vs[(PCB).ssx] = ag_null_value;
575 (PCB).ss[(PCB).ssx] = (PCB).sn;
576 }
577 while ((PCB).exit_flag == AG_RUNNING_CODE) {
578 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
579 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
580 do {
581 unsigned ag_tx = (ag_t1 + ag_t2)/2;
582 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
583 else ag_t2 = ag_tx;
584 } while (ag_t1 < ag_t2);
585 (PCB).ag_ap = ag_pstt[ag_t1];
586 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break;
587 }
588 return (PCB).exit_flag == AG_RUNNING_CODE;
589 }
590
591
592 void init_tpia2(void) {
593 (PCB).read_flag = 1;
594 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0;
595 (PCB).exit_flag = AG_RUNNING_CODE;
596 (PCB).line = FIRST_LINE;
597 (PCB).column = FIRST_COLUMN;
598 (PCB).btsx = 0, (PCB).drt = -1;
599 }
600
601 void tpia2(void) {
602 init_tpia2();
603 (PCB).exit_flag = AG_RUNNING_CODE;
604 while ((PCB).exit_flag == AG_RUNNING_CODE) {
605 unsigned ag_t1 = ag_sbt[(PCB).sn];
606 if (ag_tstt[ag_t1]) {
607 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1;
608 if ((PCB).read_flag) {
609 (PCB).read_flag = 0;
610 GET_INPUT;
611 };
612 (PCB).token_number = (tpia2_token_type) AG_TCV((PCB).input_code);
613 do {
614 unsigned ag_tx = (ag_t1 + ag_t2)/2;
615 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number)
616 ag_t1 = ag_tx + 1;
617 else ag_t2 = ag_tx;
618 } while (ag_t1 < ag_t2);
619 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number)
620 ag_t1 = ag_sbe[(PCB).sn];
621 }
622 (PCB).ag_ap = ag_pstt[ag_t1];
623 (ag_gt_procs_scan[ag_astt[ag_t1]])();
624 }
625 }
626
627
628
629 int main(void) {
630 tpia2();
631 return 0;
632 }