Mercurial > ~dholland > hg > ag > index.cgi
comparison tests/agcl/silly/good/silly06.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 SILLY06_H | |
27 #include "silly06.h" | |
28 #endif | |
29 | |
30 #ifndef SILLY06_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 silly06_pcb_type silly06_pcb; | |
44 #define PCB silly06_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 #define ag_rp_1() (a()) | |
54 | |
55 #define ag_rp_2() (b()) | |
56 | |
57 #define ag_rp_3() (c()) | |
58 | |
59 #define ag_rp_4() (d()) | |
60 | |
61 | |
62 #define READ_COUNTS | |
63 #define WRITE_COUNTS | |
64 #undef V | |
65 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i])) | |
66 #undef VS | |
67 #define VS(i) (PCB).vs[(PCB).ssx + i] | |
68 | |
69 #ifndef GET_CONTEXT | |
70 #define GET_CONTEXT CONTEXT = (PCB).input_context | |
71 #endif | |
72 | |
73 typedef enum { | |
74 ag_action_1, | |
75 ag_action_2, | |
76 ag_action_3, | |
77 ag_action_4, | |
78 ag_action_5, | |
79 ag_action_6, | |
80 ag_action_7, | |
81 ag_action_8, | |
82 ag_action_9, | |
83 ag_action_10, | |
84 ag_action_11, | |
85 ag_action_12 | |
86 } ag_parser_action; | |
87 | |
88 | |
89 #ifndef NULL_VALUE_INITIALIZER | |
90 #define NULL_VALUE_INITIALIZER = 0 | |
91 #endif | |
92 | |
93 static int const ag_null_value NULL_VALUE_INITIALIZER; | |
94 | |
95 static const unsigned char ag_rpx[] = { | |
96 0, 1, 2, 3, 4 | |
97 }; | |
98 #define AG_TCV(x) (((x) > 0 && (x) <= 1) ? (x) : 0) | |
99 #ifndef SYNTAX_ERROR | |
100 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \ | |
101 (PCB).error_message, (PCB).line, (PCB).column) | |
102 #endif | |
103 | |
104 #ifndef FIRST_LINE | |
105 #define FIRST_LINE 1 | |
106 #endif | |
107 | |
108 #ifndef FIRST_COLUMN | |
109 #define FIRST_COLUMN 1 | |
110 #endif | |
111 | |
112 #ifndef PARSER_STACK_OVERFLOW | |
113 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \ | |
114 "\nParser stack overflow, line %d, column %d\n",\ | |
115 (PCB).line, (PCB).column);} | |
116 #endif | |
117 | |
118 #ifndef REDUCTION_TOKEN_ERROR | |
119 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \ | |
120 "\nReduction token error, line %d, column %d\n", \ | |
121 (PCB).line, (PCB).column);} | |
122 #endif | |
123 | |
124 | |
125 #ifndef GET_INPUT | |
126 #define GET_INPUT ((PCB).input_code = getchar()) | |
127 #endif | |
128 | |
129 | |
130 #ifndef AG_NEWLINE | |
131 #define AG_NEWLINE 10 | |
132 #endif | |
133 | |
134 #ifndef AG_RETURN | |
135 #define AG_RETURN 13 | |
136 #endif | |
137 | |
138 #ifndef AG_FORMFEED | |
139 #define AG_FORMFEED 12 | |
140 #endif | |
141 | |
142 #ifndef AG_TABCHAR | |
143 #define AG_TABCHAR 9 | |
144 #endif | |
145 | |
146 static void ag_track(void) { | |
147 switch ((PCB).input_code) { | |
148 case AG_NEWLINE: | |
149 (PCB).column = 1, (PCB).line++; | |
150 case AG_RETURN: | |
151 case AG_FORMFEED: | |
152 break; | |
153 case AG_TABCHAR: | |
154 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING); | |
155 break; | |
156 default: | |
157 (PCB).column++; | |
158 } | |
159 (PCB).read_flag = 1; | |
160 } | |
161 | |
162 | |
163 static void ag_prot(void) { | |
164 int ag_k; | |
165 ag_k = 128 - ++(PCB).btsx; | |
166 if (ag_k <= (PCB).ssx) { | |
167 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
168 PARSER_STACK_OVERFLOW; | |
169 return; | |
170 } | |
171 (PCB).bts[(PCB).btsx] = (PCB).sn; | |
172 (PCB).bts[ag_k] = (PCB).ssx; | |
173 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx]; | |
174 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx]; | |
175 } | |
176 | |
177 static void ag_undo(void) { | |
178 if ((PCB).drt == -1) return; | |
179 while ((PCB).btsx) { | |
180 int ag_k = 128 - (PCB).btsx; | |
181 (PCB).sn = (PCB).bts[(PCB).btsx--]; | |
182 (PCB).ssx = (PCB).bts[ag_k]; | |
183 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k]; | |
184 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k]; | |
185 } | |
186 (PCB).token_number = (silly06_token_type) (PCB).drt; | |
187 (PCB).ssx = (PCB).dssx; | |
188 (PCB).sn = (PCB).dsn; | |
189 (PCB).drt = -1; | |
190 } | |
191 | |
192 | |
193 static const unsigned char ag_tstt[] = { | |
194 0,1, | |
195 | |
196 }; | |
197 | |
198 | |
199 static unsigned const char ag_astt[2] = { | |
200 7,0 | |
201 }; | |
202 | |
203 | |
204 static const unsigned char ag_pstt[] = { | |
205 0,0, | |
206 | |
207 }; | |
208 | |
209 | |
210 static const unsigned char ag_sbt[] = { | |
211 0, 2 | |
212 }; | |
213 | |
214 | |
215 static const unsigned char ag_sbe[] = { | |
216 0, 2 | |
217 }; | |
218 | |
219 | |
220 static const unsigned char ag_fl[] = { | |
221 1,0,0,0,0 | |
222 }; | |
223 | |
224 static const unsigned char ag_ptt[] = { | |
225 0, 1, 1, 1, 1 | |
226 }; | |
227 | |
228 | |
229 static void ag_ra(void) | |
230 { | |
231 switch(ag_rpx[(PCB).ag_ap]) { | |
232 case 1: ag_rp_1(); break; | |
233 case 2: ag_rp_2(); break; | |
234 case 3: ag_rp_3(); break; | |
235 case 4: ag_rp_4(); break; | |
236 } | |
237 } | |
238 | |
239 #define TOKEN_NAMES silly06_token_names | |
240 const char *const silly06_token_names[2] = { | |
241 "foo", | |
242 "foo", | |
243 | |
244 }; | |
245 | |
246 #ifndef MISSING_FORMAT | |
247 #define MISSING_FORMAT "Missing %s" | |
248 #endif | |
249 #ifndef UNEXPECTED_FORMAT | |
250 #define UNEXPECTED_FORMAT "Unexpected %s" | |
251 #endif | |
252 #ifndef UNNAMED_TOKEN | |
253 #define UNNAMED_TOKEN "input" | |
254 #endif | |
255 | |
256 | |
257 static void ag_diagnose(void) { | |
258 int ag_snd = (PCB).sn; | |
259 const char *ag_p; | |
260 int ag_k = ag_sbt[ag_snd]; | |
261 | |
262 if (*(ag_p = TOKEN_NAMES[ag_tstt[ag_k++]]) != 0 && | |
263 ag_astt[ag_k] == ag_action_8) { | |
264 sprintf((PCB).ag_msg, MISSING_FORMAT, ag_p); | |
265 } | |
266 else if ((ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1 | |
267 && *TOKEN_NAMES[ag_tstt[ag_k]]) { | |
268 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]); | |
269 } | |
270 else { | |
271 ag_p = TOKEN_NAMES[(PCB).token_number]; | |
272 if ((PCB).token_number == 0 || *ag_p == 0) ag_p = UNNAMED_TOKEN; | |
273 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, ag_p); | |
274 | |
275 } | |
276 (PCB).error_message = (PCB).ag_msg; | |
277 | |
278 | |
279 } | |
280 static int ag_action_1_r_proc(void); | |
281 static int ag_action_2_r_proc(void); | |
282 static int ag_action_3_r_proc(void); | |
283 static int ag_action_4_r_proc(void); | |
284 static int ag_action_1_s_proc(void); | |
285 static int ag_action_3_s_proc(void); | |
286 static int ag_action_1_proc(void); | |
287 static int ag_action_2_proc(void); | |
288 static int ag_action_3_proc(void); | |
289 static int ag_action_4_proc(void); | |
290 static int ag_action_5_proc(void); | |
291 static int ag_action_6_proc(void); | |
292 static int ag_action_7_proc(void); | |
293 static int ag_action_8_proc(void); | |
294 static int ag_action_9_proc(void); | |
295 static int ag_action_10_proc(void); | |
296 static int ag_action_11_proc(void); | |
297 static int ag_action_8_proc(void); | |
298 | |
299 | |
300 static int (*const ag_r_procs_scan[])(void) = { | |
301 ag_action_1_r_proc, | |
302 ag_action_2_r_proc, | |
303 ag_action_3_r_proc, | |
304 ag_action_4_r_proc | |
305 }; | |
306 | |
307 static int (*const ag_s_procs_scan[])(void) = { | |
308 ag_action_1_s_proc, | |
309 ag_action_2_r_proc, | |
310 ag_action_3_s_proc, | |
311 ag_action_4_r_proc | |
312 }; | |
313 | |
314 static int (*const ag_gt_procs_scan[])(void) = { | |
315 ag_action_1_proc, | |
316 ag_action_2_proc, | |
317 ag_action_3_proc, | |
318 ag_action_4_proc, | |
319 ag_action_5_proc, | |
320 ag_action_6_proc, | |
321 ag_action_7_proc, | |
322 ag_action_8_proc, | |
323 ag_action_9_proc, | |
324 ag_action_10_proc, | |
325 ag_action_11_proc, | |
326 ag_action_8_proc | |
327 }; | |
328 | |
329 | |
330 static int ag_action_10_proc(void) { | |
331 int ag_t = (PCB).token_number; | |
332 (PCB).btsx = 0, (PCB).drt = -1; | |
333 do { | |
334 ag_track(); | |
335 if ((PCB).read_flag) { | |
336 (PCB).read_flag = 0; | |
337 GET_INPUT; | |
338 }; | |
339 (PCB).token_number = (silly06_token_type) AG_TCV((PCB).input_code); | |
340 } while ((PCB).token_number == (silly06_token_type) ag_t); | |
341 return 1; | |
342 } | |
343 | |
344 static int ag_action_11_proc(void) { | |
345 int ag_t = (PCB).token_number; | |
346 | |
347 (PCB).btsx = 0, (PCB).drt = -1; | |
348 do { | |
349 (PCB).vs[(PCB).ssx] = (PCB).input_code; | |
350 (PCB).ssx--; | |
351 ag_track(); | |
352 ag_ra(); | |
353 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0; | |
354 (PCB).ssx++; | |
355 if ((PCB).read_flag) { | |
356 (PCB).read_flag = 0; | |
357 GET_INPUT; | |
358 }; | |
359 (PCB).token_number = (silly06_token_type) AG_TCV((PCB).input_code); | |
360 } | |
361 while ((PCB).token_number == (silly06_token_type) ag_t); | |
362 return 1; | |
363 } | |
364 | |
365 static int ag_action_3_r_proc(void) { | |
366 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
367 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
368 (PCB).btsx = 0, (PCB).drt = -1; | |
369 (PCB).reduction_token = (silly06_token_type) ag_ptt[(PCB).ag_ap]; | |
370 ag_ra(); | |
371 return (PCB).exit_flag == AG_RUNNING_CODE; | |
372 } | |
373 | |
374 static int ag_action_3_s_proc(void) { | |
375 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
376 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
377 (PCB).btsx = 0, (PCB).drt = -1; | |
378 (PCB).reduction_token = (silly06_token_type) ag_ptt[(PCB).ag_ap]; | |
379 ag_ra(); | |
380 return (PCB).exit_flag == AG_RUNNING_CODE; | |
381 } | |
382 | |
383 static int ag_action_4_r_proc(void) { | |
384 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
385 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
386 (PCB).reduction_token = (silly06_token_type) ag_ptt[(PCB).ag_ap]; | |
387 return 1; | |
388 } | |
389 | |
390 static int ag_action_2_proc(void) { | |
391 (PCB).btsx = 0, (PCB).drt = -1; | |
392 if ((PCB).ssx >= 128) { | |
393 (PCB).exit_flag = AG_STACK_ERROR_CODE; | |
394 PARSER_STACK_OVERFLOW; | |
395 } | |
396 (PCB).vs[(PCB).ssx] = (PCB).input_code; | |
397 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
398 (PCB).ssx++; | |
399 (PCB).sn = (PCB).ag_ap; | |
400 ag_track(); | |
401 return 0; | |
402 } | |
403 | |
404 static int ag_action_9_proc(void) { | |
405 if ((PCB).drt == -1) { | |
406 (PCB).drt=(PCB).token_number; | |
407 (PCB).dssx=(PCB).ssx; | |
408 (PCB).dsn=(PCB).sn; | |
409 } | |
410 ag_prot(); | |
411 (PCB).vs[(PCB).ssx] = ag_null_value; | |
412 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
413 (PCB).ssx++; | |
414 (PCB).sn = (PCB).ag_ap; | |
415 return (PCB).exit_flag == AG_RUNNING_CODE; | |
416 } | |
417 | |
418 static int ag_action_2_r_proc(void) { | |
419 (PCB).ssx++; | |
420 (PCB).sn = (PCB).ag_ap; | |
421 return 0; | |
422 } | |
423 | |
424 static int ag_action_7_proc(void) { | |
425 --(PCB).ssx; | |
426 (PCB).exit_flag = AG_SUCCESS_CODE; | |
427 return 0; | |
428 } | |
429 | |
430 static int ag_action_1_proc(void) { | |
431 ag_track(); | |
432 (PCB).exit_flag = AG_SUCCESS_CODE; | |
433 return 0; | |
434 } | |
435 | |
436 static int ag_action_1_r_proc(void) { | |
437 (PCB).exit_flag = AG_SUCCESS_CODE; | |
438 return 0; | |
439 } | |
440 | |
441 static int ag_action_1_s_proc(void) { | |
442 (PCB).exit_flag = AG_SUCCESS_CODE; | |
443 return 0; | |
444 } | |
445 | |
446 static int ag_action_4_proc(void) { | |
447 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
448 (PCB).reduction_token = (silly06_token_type) ag_ptt[(PCB).ag_ap]; | |
449 (PCB).btsx = 0, (PCB).drt = -1; | |
450 (PCB).vs[(PCB).ssx] = (PCB).input_code; | |
451 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
452 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
453 ag_track(); | |
454 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
455 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
456 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
457 do { | |
458 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
459 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
460 else ag_t2 = ag_tx; | |
461 } while (ag_t1 < ag_t2); | |
462 (PCB).ag_ap = ag_pstt[ag_t1]; | |
463 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
464 } | |
465 return 0; | |
466 } | |
467 | |
468 static int ag_action_3_proc(void) { | |
469 int ag_sd = ag_fl[(PCB).ag_ap] - 1; | |
470 (PCB).btsx = 0, (PCB).drt = -1; | |
471 (PCB).vs[(PCB).ssx] = (PCB).input_code; | |
472 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
473 else (PCB).ss[(PCB).ssx] = (PCB).sn; | |
474 ag_track(); | |
475 (PCB).reduction_token = (silly06_token_type) ag_ptt[(PCB).ag_ap]; | |
476 ag_ra(); | |
477 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
478 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
479 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
480 do { | |
481 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
482 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
483 else ag_t2 = ag_tx; | |
484 } while (ag_t1 < ag_t2); | |
485 (PCB).ag_ap = ag_pstt[ag_t1]; | |
486 if ((ag_s_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
487 } | |
488 return 0; | |
489 } | |
490 | |
491 static int ag_action_8_proc(void) { | |
492 ag_undo(); | |
493 (PCB).exit_flag = AG_SYNTAX_ERROR_CODE; | |
494 ag_diagnose(); | |
495 SYNTAX_ERROR; | |
496 ag_track(); | |
497 return (PCB).exit_flag == AG_RUNNING_CODE; | |
498 } | |
499 | |
500 static int ag_action_5_proc(void) { | |
501 int ag_sd = ag_fl[(PCB).ag_ap]; | |
502 (PCB).btsx = 0, (PCB).drt = -1; | |
503 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
504 else { | |
505 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
506 } | |
507 (PCB).reduction_token = (silly06_token_type) ag_ptt[(PCB).ag_ap]; | |
508 ag_ra(); | |
509 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
510 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
511 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
512 do { | |
513 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
514 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
515 else ag_t2 = ag_tx; | |
516 } while (ag_t1 < ag_t2); | |
517 (PCB).ag_ap = ag_pstt[ag_t1]; | |
518 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
519 } | |
520 return (PCB).exit_flag == AG_RUNNING_CODE; | |
521 } | |
522 | |
523 static int ag_action_6_proc(void) { | |
524 int ag_sd = ag_fl[(PCB).ag_ap]; | |
525 (PCB).reduction_token = (silly06_token_type) ag_ptt[(PCB).ag_ap]; | |
526 if ((PCB).drt == -1) { | |
527 (PCB).drt=(PCB).token_number; | |
528 (PCB).dssx=(PCB).ssx; | |
529 (PCB).dsn=(PCB).sn; | |
530 } | |
531 if (ag_sd) { | |
532 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd]; | |
533 } | |
534 else { | |
535 ag_prot(); | |
536 (PCB).vs[(PCB).ssx] = ag_null_value; | |
537 (PCB).ss[(PCB).ssx] = (PCB).sn; | |
538 } | |
539 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
540 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1; | |
541 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1; | |
542 do { | |
543 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
544 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1; | |
545 else ag_t2 = ag_tx; | |
546 } while (ag_t1 < ag_t2); | |
547 (PCB).ag_ap = ag_pstt[ag_t1]; | |
548 if ((ag_r_procs_scan[ag_astt[ag_t1]])() == 0) break; | |
549 } | |
550 return (PCB).exit_flag == AG_RUNNING_CODE; | |
551 } | |
552 | |
553 | |
554 void init_silly06(void) { | |
555 (PCB).read_flag = 1; | |
556 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0; | |
557 (PCB).exit_flag = AG_RUNNING_CODE; | |
558 (PCB).line = FIRST_LINE; | |
559 (PCB).column = FIRST_COLUMN; | |
560 (PCB).btsx = 0, (PCB).drt = -1; | |
561 } | |
562 | |
563 void silly06(void) { | |
564 init_silly06(); | |
565 (PCB).exit_flag = AG_RUNNING_CODE; | |
566 while ((PCB).exit_flag == AG_RUNNING_CODE) { | |
567 unsigned ag_t1 = ag_sbt[(PCB).sn]; | |
568 if (ag_tstt[ag_t1]) { | |
569 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1; | |
570 if ((PCB).read_flag) { | |
571 (PCB).read_flag = 0; | |
572 GET_INPUT; | |
573 }; | |
574 (PCB).token_number = (silly06_token_type) AG_TCV((PCB).input_code); | |
575 do { | |
576 unsigned ag_tx = (ag_t1 + ag_t2)/2; | |
577 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number) | |
578 ag_t1 = ag_tx + 1; | |
579 else ag_t2 = ag_tx; | |
580 } while (ag_t1 < ag_t2); | |
581 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number) | |
582 ag_t1 = ag_sbe[(PCB).sn]; | |
583 } | |
584 (PCB).ag_ap = ag_pstt[ag_t1]; | |
585 (ag_gt_procs_scan[ag_astt[ag_t1]])(); | |
586 } | |
587 } | |
588 | |
589 | |
590 | |
591 int main(void) { | |
592 silly06(); | |
593 return 0; | |
594 } |