comparison tests/agcl/oldagsrc/good/cf-old.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 AnaGram Syntax Analyzer.
3 Copyright (c) Parsifal Software, 1993.
4 All Rights Reserved.
5
6 Configuration file module
7 */
8 #include HEADERS
9
10 #include DATA
11 #include ASSERT
12 #include CTYPE
13 #include STDLIB
14 #include STRING
15 #include ARRAYS
16 #include MYALLOC
17 #include CF
18 #include PARAMS
19 #include PF
20
21
22 /*
23 * AnaGram, A System for Syntax Directed Programming
24 * File generated by: ...
25 *
26 * AnaGram Parsing Engine
27 * Copyright 1993-2002 Parsifal Software. All Rights Reserved.
28 *
29 * This software is provided 'as-is', without any express or implied
30 * warranty. In no event will the authors be held liable for any damages
31 * arising from the use of this software.
32 *
33 * Permission is granted to anyone to use this software for any purpose,
34 * including commercial applications, and to alter it and redistribute it
35 * freely, subject to the following restrictions:
36 *
37 * 1. The origin of this software must not be misrepresented; you must not
38 * claim that you wrote the original software. If you use this software
39 * in a product, an acknowledgment in the product documentation would be
40 * appreciated but is not required.
41 * 2. Altered source versions must be plainly marked as such, and must not be
42 * misrepresented as being the original software.
43 * 3. This notice may not be removed or altered from any source distribution.
44 */
45
46 #ifndef CF-OLD_H
47 #include "cf-old.h"
48 #endif
49
50 #ifndef CF-OLD_H
51 #error Mismatched header file
52 #endif
53
54 #include <ctype.h>
55 #include <stdio.h>
56
57 #define RULE_CONTEXT (&((PCB).cs[(PCB).ssx]))
58 #define ERROR_CONTEXT ((PCB).cs[(PCB).error_frame_ssx])
59 #define CONTEXT ((PCB).cs[(PCB).ssx])
60
61
62 #define CHANGE_REDUCTION(x) cf-old_change_reduction(cf-old_##x##_token)
63 int cf-old_change_reduction(cf-old_token_type);
64
65
66 int cf-old_value(void);
67
68 #define TOKEN_NAMES cf-old_token_names
69 const char *const cf-old_token_names[108] = {
70 "config file",
71 "config file",
72 "equals",
73 "'='",
74 "",
75 "",
76 "minus",
77 "'-'",
78 "plus",
79 "'+'",
80 "tilde",
81 "'~'",
82 "",
83 "'('",
84 "",
85 "')'",
86 "blank",
87 "",
88 "",
89 "global parameter",
90 "end of line",
91 "",
92 "",
93 "",
94 "eof",
95 "name",
96 "data type",
97 "keyword string",
98 "number",
99 "\"trial\"",
100 "\"copy\"",
101 "\"code\"",
102 "trial copy code",
103 "",
104 "abstract declarator",
105 "",
106 "direct abstract declarator",
107 "",
108 "",
109 "star",
110 "'*'",
111 "",
112 "letter",
113 "",
114 "blank char",
115 "c comment",
116 "continuation",
117 "comment",
118 "",
119 "carriage return",
120 "",
121 "newline",
122 "white",
123 "vertical space",
124 "\"//\"",
125 "",
126 "",
127 "",
128 "decimal number",
129 "",
130 "octal number",
131 "'0'",
132 "",
133 "hex number",
134 "\"0x\"",
135 "\"0X\"",
136 "",
137 "simple number",
138 "",
139 "",
140 "keyword string head",
141 "string",
142 "double quote",
143 "",
144 "",
145 "",
146 "string char",
147 "simple string char",
148 "",
149 "\"\\\\a\"",
150 "\"\\\\b\"",
151 "\"\\\\f\"",
152 "\"\\\\n\"",
153 "\"\\\\r\"",
154 "\"\\\\t\"",
155 "\"\\\\v\"",
156 "\"\\\\\\\\\"",
157 "\"\\\\?\"",
158 "\"\\\\\\'\"",
159 "\"\\\\\\\"\"",
160 "",
161 "",
162 "backslash",
163 "",
164 "",
165 "",
166 "",
167 "\"\\\\x\"",
168 "any digit",
169 "nonoctal digit",
170 "",
171 "\"*/\"",
172 "\"/*\"",
173 "",
174 "",
175 "",
176 "",
177 "",
178
179 };
180
181
182 #line - "cf-old.syn"
183 #define PARSE_STACK_OVERFLOW\
184 {fprintf(stderr,"Parse stack overflow\n");myabort();}
185 #define SYNTAX_ERROR cf_syn_error()
186 #define GET_CONTEXT CONTEXT.x = PCB.column, CONTEXT.y = PCB.line
187
188 #define N_PARAMS 80
189
190
191 static cf_pcb_type cfcb;
192 #define PCB cfcb
193
194 extern string_dict *param_dict;
195 extern unsigned char *input_base;
196 extern int precedence_level;
197 extern int int_token_type;
198
199 void reset_stack(void);
200 void log_error(void);
201
202 static void cf_gp2(void);
203 static void cf_gp3(void);
204 static void cf_gp4(int);
205 static void cf_gp5(int);
206
207 void acs(int);
208 void scs(int);
209
210 void init_params(void);
211
212 unsigned char *read_file(char *);
213
214 static char *config_file;
215
216 static void cf_error(char *);
217
218 static void cf_bad_param(int pn) {
219 char *dm;
220 if (pn) dm = "Inappropriate value";
221 else dm = "No such parameter";
222 cf_error(dm);
223 rcs();
224 return;
225 }
226
227 void xgp5(int, void bad(int), int);
228
229 static void cf_gp5(int tv) {
230 xgp5(tv,cf_bad_param,0);
231 }
232
233 void xgp4(int, void bad(int), int);
234
235 static void cf_gp4(int tv) {
236 xgp4(tv,cf_bad_param,0);
237 }
238
239 void xgp2(void bad(int), int);
240
241 static void cf_gp2(void) {
242 xgp2(cf_bad_param,0);
243 }
244
245 void xgp3(void bad(int), int);
246
247 static void cf_gp3(void) {
248 xgp3(cf_bad_param,0);
249 }
250
251 static int read_config_file(char *path) {
252 char* file_name = allocate(strlen(path)+20,char);
253 char *cp;
254
255 strcpy(file_name, path);
256 cp = strrchr(file_name,PATH_DELIMITER);
257 /*
258 assert(cp != NULL);
259 strcpy(cp+1,"AnaGram.cfg");
260 */
261 if (cp) cp++;
262 else cp = file_name;
263 strcpy(cp,"AnaGram.cfg");
264 config_file = file_name;
265 cfcb.pointer = input_base = read_file(file_name);
266 return input_base != NULL;
267 }
268
269 static void get_config(char *path) {
270 cfcb.pointer = input_base = read_file(path);
271 if (input_base != NULL) {
272 cf();
273 free(input_base);
274 }
275 input_base = NULL;
276 }
277 int in_cur_dir(char *);
278
279 void read_config(char *path) {
280 if (read_config_file(path)) {
281 cf();
282 free(input_base);
283 free(config_file);
284 }
285 if (in_cur_dir(path)) return;
286 config_file = "AnaGram.cfg";
287 get_config("anagram.cfg");
288 }
289
290 static void cf_error(char *msg) {
291 int eline = PCB.line, ecol = PCB.column;
292
293 if (PCB.token_number == cf_eof_token) {
294 eline = ERROR_CONTEXT.y;
295 ecol = ERROR_CONTEXT.x;
296 }
297 ssprintf("%s, Line %d, Col %d: %s", config_file,
298 eline, ecol, msg);
299 log_error();
300 }
301
302 static void cf_syn_error(void) {
303 reset_stk();
304 cf_error(PCB.error_message);
305 }
306
307 param_number_map *map_param_number;
308
309 static void init_param_val_proc(int *pn, char *name, int v) {
310 param_number_map *mpn;
311
312 *pn = add_string_dict(name,param_dict);
313 check_size(map_param_number,*pn,*pn);
314 mpn = &map_param_number[*pn];
315 /* mpn->value_name = 1; */
316 mpn->value = v;
317 }
318
319
320 #define init_param_val(p,v) \
321 init_param_val_proc(&p##_pn, #p,v)
322
323 static param_number_map *id_param(int *pn, void *p, char *name) {
324 int k = add_string_dict(name,param_dict);
325 param_number_map *mpn;
326
327 check_size(map_param_number, k,3*k/2);
328 *pn = k;
329 mpn = &map_param_number[k];
330 mpn->param = p;
331 return mpn;
332 }
333
334 #define init_param(p, global, implicit)\
335 {param_number_map *mpn = id_param(&p##_pn,&p, #p);\
336 mpn->global = 1;\
337 mpn->implicit = 1;}
338
339 #define init_param_co(p, global, implicit)\
340 {param_number_map *mpn = id_param(&p##_pn,&p, #p);\
341 mpn->global = mpn->config_only = 1;\
342 mpn->implicit = 1;}
343
344 /*
345 #define init_verb(p,param)\
346 {param_number_map *mpn =\
347 &map_param_number[p##_pn = add_string_dict(#p, param_dict)];\
348 mpn->verb = 1;\
349 mpn->value = param##_pn;}
350 */
351 /*
352 #define init_token_param(p,implicit)\
353 {param_number_map *mpn =\
354 &map_param_number[p##_pn = add_string_dict(#p, param_dict)];\
355 mpn->token = 1;\
356 mpn->implicit = 1;}
357 */
358
359 #define init_dict_param(p,global,dict_name)\
360 {param_number_map *mpn = id_param(&p##_pn,&p, #p);\
361 mpn->global = 1;\
362 mpn->dict = dict_name;\
363 mpn->value_id = 1;}
364 /*
365 #define init_literal_param(p,global,first_value)\
366 {param_number_map *mpn = id_param(&p##_pn,&p, #p);\
367 mpn->value = first_value##_pn;\
368 mpn->global = 1;\
369 mpn->dict = param_dict;\
370 mpn->literal = 1;}
371 */
372
373 #define init_proc_param(p,global,proc_name)\
374 {param_number_map *mpn = id_param(&p##_pn,&p, #p);\
375 mpn->global = 1;\
376 mpn->proc = proc_name;\
377 mpn->proc_call = 1;}
378
379 #define init_token_id_param(p,global)\
380 {param_number_map *mpn = id_param(&p##_pn,&p, #p);\
381 mpn->global = 1;\
382 mpn->proc = name_token;\
383 mpn->proc_call = 1;\
384 mpn->token_id = 1;}
385
386 #define dp(p)\
387 static int p##_pn
388
389 dp(on);
390 dp(off);
391
392 extern int allow_macros; dp(allow_macros);
393 int auto_init = 1; dp(auto_init);
394 int auto_resynch = 0; dp(auto_resynch);
395 extern int backtrack; dp(backtrack);
396 int bottom_margin = 3; dp(bottom_margin);
397 int bright_background = 1; dp(bright_background);
398
399 int case_sensitive = 1; dp(case_sensitive);
400 char *compile_command = ""; dp(compile_command);
401 char *context_type = NULL; dp(context_type);
402 char *coverage_file_name = "#.nrc"; dp(coverage_file_name);
403
404 int declare_pcb = 1; dp(declare_pcb);
405 extern int default_input_type; dp(default_input_type);
406 extern int default_token_type; dp(default_token_type);
407 extern int default_reductions; dp(default_reductions);
408 int diagnose_errors = 1; dp(diagnose_errors);
409
410 extern char *edit_command; dp(edit_command);
411 char *enum_constant_name = "$_%_token"; dp(enum_constant_name);
412 int error_frame = 0; dp(error_frame);
413 int error_trace = 0; dp(error_trace);
414 int escape_backslashes = 0; dp(escape_backslashes);
415 int event_driven = 0; dp(event_driven);
416
417 extern int far_tables; dp(far_tables);
418
419 extern int grammar_token; dp(grammar_token);
420 extern char *header_file_name; dp(header_file_name);
421 int input_values = 0; dp(input_values);
422
423 int line_length = 80; dp(line_length);
424 extern int line_numbers; dp(line_numbers);
425 char *line_numbers_path = NULL; dp(line_numbers_path);
426 extern int lines_and_columns; dp(lines_and_columns);
427
428 int main_program = 1; dp(main_program);
429 int max_conflicts = 50; dp(max_conflicts);
430
431 int near_functions = 0; dp(near_functions);
432 int nest_comments = 0; dp(nest_comments);
433
434 int old_style = 0; dp(old_style);
435
436 int page_length = 66; dp(page_length);
437 extern char *parser_file_name; dp(parser_file_name);
438 char *parser_name = "#"; dp(parser_name);
439 int parser_stack_alignment; dp(parser_stack_alignment);
440 int parser_stack_size = 32; dp(parser_stack_size);
441 int pointer_input = 0; dp(pointer_input);
442 char *pointer_type = "unsigned char *"; dp(pointer_type);
443 char *print_file_name = "LPT1"; dp(print_file_name);
444
445 int quick_reference = 1; dp(quick_reference);
446
447 int reduction_choices =0; dp(reduction_choices);
448 int rule_coverage = 0; dp(rule_coverage);
449
450 int tab_spacing = 8; dp(tab_spacing);
451 int test_file_binary = 0; dp(test_file_binary);
452 char *test_file_mask = "*.*"; dp(test_file_mask);
453 extern int test_range; dp(test_range);
454 extern int token_names; dp(token_names);
455 int top_margin = 3; dp(top_margin);
456 extern int traditional_engine; dp(traditional_engine);
457
458 extern int video_mode; dp(video_mode);
459
460 unsigned long trial_copy_code = 0;
461
462
463 /* char *note_file_name = "$.nf"; dp(note_file_name); */
464
465 char *input_type_name = "$_it_type"; /* dp(input_type_name); */
466
467
468 char *control_block_type = "$_pcb_type";
469 char *typedef_name = "$_token_type";
470 char *value_stack_type = "$_vs_type";
471
472
473 extern string_dict *cast_dict;
474 extern string_dict *proc_dict;
475
476
477 extern string_dict *tkn_dict;
478
479 extern int error_token; dp(error_token);
480 /* extern int noise_token; dp(noise_token); */
481 int eof_token = 0; dp(eof_token);
482
483 extern int active_color; dp(active_color);
484 extern int active_bar_color; dp(active_bar_color);
485 extern int inactive_color; dp(inactive_color);
486 extern int inactive_bar_color; dp(inactive_bar_color);
487 extern int backdrop_color; dp(backdrop_color);
488 extern int backdrop_bar_color; dp(backdrop_bar_color);
489
490
491 int id_token(int);
492
493 static int name_token(char *name){
494 sss(name);
495 free(name);
496 ids(tkn_dict);
497 return id_token(fis());
498 }
499
500 void init_params(void) {
501 int n;
502 map_param_number = init_array(N_PARAMS,sizeof(param_number_map));
503
504 init_param_val(off, 0);
505 init_param_val(on, 1);
506
507 /*
508
509 N.B. The following list should be in alphabetical order. Make sure that
510 when you enter a new parameter, you enter it in the right place!
511
512 */
513 init_param(allow_macros, global, implicit);
514 init_param(auto_init, global, implicit);
515 init_param(auto_resynch, global, implicit);
516
517 init_param(backtrack, global, implicit);
518 init_param(bottom_margin, global, int_value);
519 init_param_co(bright_background, global, implicit);
520
521 init_param(case_sensitive, global, implicit);
522 init_param(compile_command, global, string_value);
523 init_param(context_type, global, text_value);
524 init_param(coverage_file_name, global, string_value);
525
526 init_param(declare_pcb, global,implicit);
527 init_dict_param(default_input_type, global, cast_dict);
528 init_param(default_reductions, global, implicit);
529 init_dict_param(default_token_type, global, cast_dict);
530 init_param(diagnose_errors, global, implicit);
531
532 init_param(edit_command, global, string_value);
533 init_param(enum_constant_name, global, string_value);
534 init_token_id_param(eof_token, global);
535 init_param(error_frame, global, implicit);
536 init_token_id_param(error_token, global);
537 init_param(error_trace, global, implicit);
538 init_param(escape_backslashes, global, implicit);
539 init_param(event_driven, global, implicit);
540
541 init_param(far_tables, global, implicit);
542
543 init_token_id_param(grammar_token, global);
544
545 init_param(header_file_name, global, string_value);
546
547 init_param(input_values, global, implicit);
548
549 init_param(line_length, global, int_value);
550 init_param(line_numbers, global, implicit);
551 init_param(line_numbers_path, global, string_value);
552 init_param(lines_and_columns, global, implicit);
553
554 init_param(main_program, global, implicit);
555 init_param(max_conflicts, global, int_value);
556
557 init_param(near_functions, global, implicit);
558 init_param(nest_comments, global, implicit);
559
560 init_param(old_style, global, implicit);
561
562 init_param(page_length, global, int_value);
563 init_param(parser_file_name, global, string_value);
564 init_param(parser_name, global, text_value);
565 init_dict_param(parser_stack_alignment, global, cast_dict);
566 init_param(parser_stack_size, global, int_value);
567 init_param(pointer_input, global, implicit);
568 init_param(pointer_type, global, text_value);
569 init_param(print_file_name, global, string_value);
570
571 init_param(quick_reference, global, implicit);
572
573 init_param(reduction_choices, global, implicit);
574 init_param(rule_coverage, global, implicit);
575
576 init_param(tab_spacing, global, int_value);
577 init_param(test_file_binary, global, implicit);
578 init_param(test_file_mask, global, string_value);
579 init_param(test_range, global, implicit);
580 init_param(token_names, global, implicit);
581 init_param(top_margin, global, int_value);
582 init_param(traditional_engine, global, implicit);
583 init_param_co(video_mode, global, int_value);
584
585
586
587 init_param_co(active_bar_color, global, color_value);
588 init_param_co(active_color, global, color_value);
589 init_param_co(backdrop_bar_color, global, color_value);
590 init_param_co(backdrop_color, global, color_value);
591 init_param_co(inactive_bar_color, global, color_value);
592 init_param_co(inactive_color, global, color_value);
593
594
595 n = param_dict->nsx;
596 assert(n < N_PARAMS);
597 map_param_number = set_array_size(map_param_number, n);
598 }
599 #line - "cf-old.c"
600
601 #ifndef CONVERT_CASE
602 #define CONVERT_CASE(c) (c)
603 #endif
604 #ifndef TAB_SPACING
605 #define TAB_SPACING 8
606 #endif
607 int cf-old_value(void) {
608 int returnValue;
609 returnValue = (*(int *) &(PCB).vs[(PCB).ssx]);
610 return returnValue;
611 }
612
613 static void near ag_rp_1(void) {
614 #line - "cf-old.syn"
615 cf_gp4(1);
616 #line - "cf-old.c"
617 }
618
619 static void near ag_rp_2(void) {
620 #line - "cf-old.syn"
621 cf_gp4(0);
622 #line - "cf-old.c"
623 }
624
625 static void near ag_rp_3(void) {
626 #line - "cf-old.syn"
627 cf_gp2();
628 #line - "cf-old.c"
629 }
630
631 static void near ag_rp_4(void) {
632 #line - "cf-old.syn"
633 cf_gp3();
634 #line - "cf-old.c"
635 }
636
637 static void near ag_rp_5(int n) {
638 #line - "cf-old.syn"
639 cf_gp5(n);
640 #line - "cf-old.c"
641 }
642
643 static void near ag_rp_6(unsigned long n) {
644 #line - "cf-old.syn"
645 trial_copy_code = n;
646 #line - "cf-old.c"
647 }
648
649 static unsigned long near ag_rp_7(int d) {
650 #line - "cf-old.syn"
651 return d-'0';
652 #line - "cf-old.c"
653 }
654
655 static unsigned long near ag_rp_8(unsigned long n, int d) {
656 #line - "cf-old.syn"
657 return 10*n + d-'0';
658 #line - "cf-old.c"
659 }
660
661 static void near ag_rp_9(void) {
662 #line - "cf-old.syn"
663 concat_string();
664 #line - "cf-old.c"
665 }
666
667 static void near ag_rp_10(void) {
668 #line - "cf-old.syn"
669 concat_string();
670 #line - "cf-old.c"
671 }
672
673 static int near ag_rp_11(void) {
674 #line - "cf-old.syn"
675 return scs('('),0;
676 #line - "cf-old.c"
677 }
678
679 static void near ag_rp_12(void) {
680 #line - "cf-old.syn"
681 concat_string(), acs(')');
682 #line - "cf-old.c"
683 }
684
685 static void near ag_rp_13(void) {
686 #line - "cf-old.syn"
687 concat_string();
688 #line - "cf-old.c"
689 }
690
691 static void near ag_rp_14(void) {
692 #line - "cf-old.syn"
693 sss(" *");
694 #line - "cf-old.c"
695 }
696
697 static void near ag_rp_15(void) {
698 #line - "cf-old.syn"
699 concat_string();
700 #line - "cf-old.c"
701 }
702
703 static void near ag_rp_16(int a) {
704 #line - "cf-old.syn"
705 scs(a);
706 #line - "cf-old.c"
707 }
708
709 static void near ag_rp_17(int a) {
710 #line - "cf-old.syn"
711 acs(a);
712 #line - "cf-old.c"
713 }
714
715 static void near ag_rp_18(int a) {
716 #line - "cf-old.syn"
717 acs(' '), acs(a);
718 #line - "cf-old.c"
719 }
720
721 static int near ag_rp_19(int d) {
722 #line - "cf-old.syn"
723 return d - '0';
724 #line - "cf-old.c"
725 }
726
727 static int near ag_rp_20(int n, int d) {
728 #line - "cf-old.syn"
729 return 10*n + d - '0';
730 #line - "cf-old.c"
731 }
732
733 static int near ag_rp_21(void) {
734 #line - "cf-old.syn"
735 return 0;
736 #line - "cf-old.c"
737 }
738
739 static int near ag_rp_22(int n, int d) {
740 #line - "cf-old.syn"
741 return 8*n + d - '0';
742 #line - "cf-old.c"
743 }
744
745 static int near ag_rp_23(void) {
746 #line - "cf-old.syn"
747 return 0;
748 #line - "cf-old.c"
749 }
750
751 static int near ag_rp_24(void) {
752 #line - "cf-old.syn"
753 return 0;
754 #line - "cf-old.c"
755 }
756
757 static int near ag_rp_25(int n, int d) {
758 #line - "cf-old.syn"
759 return 16*n + d - '0';
760 #line - "cf-old.c"
761 }
762
763 static int near ag_rp_26(int n, int d) {
764 #line - "cf-old.syn"
765 return 16*n + (d&7) + 9;
766 #line - "cf-old.c"
767 }
768
769 static int near ag_rp_27(int s, int n) {
770 #line - "cf-old.syn"
771 return s*n;
772 #line - "cf-old.c"
773 }
774
775 static int near ag_rp_28(void) {
776 #line - "cf-old.syn"
777 return 1;
778 #line - "cf-old.c"
779 }
780
781 static int near ag_rp_29(void) {
782 #line - "cf-old.syn"
783 return -1;
784 #line - "cf-old.c"
785 }
786
787 static void near ag_rp_30(void) {
788 #line - "cf-old.syn"
789 ics();
790 #line - "cf-old.c"
791 }
792
793 static int near ag_rp_31(void) {
794 #line - "cf-old.syn"
795 return '\a';
796 #line - "cf-old.c"
797 }
798
799 static int near ag_rp_32(void) {
800 #line - "cf-old.syn"
801 return '\b';
802 #line - "cf-old.c"
803 }
804
805 static int near ag_rp_33(void) {
806 #line - "cf-old.syn"
807 return '\f';
808 #line - "cf-old.c"
809 }
810
811 static int near ag_rp_34(void) {
812 #line - "cf-old.syn"
813 return '\n';
814 #line - "cf-old.c"
815 }
816
817 static int near ag_rp_35(void) {
818 #line - "cf-old.syn"
819 return '\r';
820 #line - "cf-old.c"
821 }
822
823 static int near ag_rp_36(void) {
824 #line - "cf-old.syn"
825 return '\t';
826 #line - "cf-old.c"
827 }
828
829 static int near ag_rp_37(void) {
830 #line - "cf-old.syn"
831 return '\v';
832 #line - "cf-old.c"
833 }
834
835 static int near ag_rp_38(void) {
836 #line - "cf-old.syn"
837 return '\\';
838 #line - "cf-old.c"
839 }
840
841 static int near ag_rp_39(void) {
842 #line - "cf-old.syn"
843 return '\?';
844 #line - "cf-old.c"
845 }
846
847 static int near ag_rp_40(void) {
848 #line - "cf-old.syn"
849 return '\'';
850 #line - "cf-old.c"
851 }
852
853 static int near ag_rp_41(void) {
854 #line - "cf-old.syn"
855 return '"';
856 #line - "cf-old.c"
857 }
858
859 static int near ag_rp_42(int n) {
860 #line - "cf-old.syn"
861 return n==0?cf_error("Null character in string"),0 : n;
862 #line - "cf-old.c"
863 }
864
865 static int near ag_rp_43(int n) {
866 #line - "cf-old.syn"
867 return n&7;
868 #line - "cf-old.c"
869 }
870
871 static int near ag_rp_44(int n, int d) {
872 #line - "cf-old.syn"
873 return n*8 + (d&7);
874 #line - "cf-old.c"
875 }
876
877 static int near ag_rp_45(int n, int d) {
878 #line - "cf-old.syn"
879 return n*8 + (d&7);
880 #line - "cf-old.c"
881 }
882
883 static int near ag_rp_46(int n) {
884 #line - "cf-old.syn"
885 return n==0?cf_error("Null character in string"),0 : n;
886 #line - "cf-old.c"
887 }
888
889 static int near ag_rp_47(int n) {
890 #line - "cf-old.syn"
891 return n;
892 #line - "cf-old.c"
893 }
894
895 static void near ag_rp_48(int c) {
896 #line - "cf-old.syn"
897 acs(c);
898 #line - "cf-old.c"
899 }
900
901 static void near ag_rp_49(int c) {
902 #line - "cf-old.syn"
903 acs(c);
904 #line - "cf-old.c"
905 }
906
907 static void near ag_rp_50(int c) {
908 #line - "cf-old.syn"
909 acs(c);
910 #line - "cf-old.c"
911 }
912
913 static void near ag_rp_51(int c) {
914 #line - "cf-old.syn"
915 acs(c);
916 #line - "cf-old.c"
917 }
918
919 static void near ag_rp_52(int c) {
920 #line - "cf-old.syn"
921 acs(c);
922 #line - "cf-old.c"
923 }
924
925 static void near ag_rp_53(int n) {
926 #line - "cf-old.syn"
927 acs(n);
928 #line - "cf-old.c"
929 }
930
931 static void near ag_rp_54(int n) {
932 #line - "cf-old.syn"
933 acs(n);
934 #line - "cf-old.c"
935 }
936
937 static void near ag_rp_55(int n) {
938 #line - "cf-old.syn"
939 acs(n);
940 #line - "cf-old.c"
941 }
942
943 static void near ag_rp_56(int n) {
944 #line - "cf-old.syn"
945 acs(n);
946 #line - "cf-old.c"
947 }
948
949 static void near ag_rp_57(void) {
950 #line - "cf-old.syn"
951 if (nest_comments) PCB.reduction_token = cf_c_comment_text_token;
952 #line - "cf-old.c"
953 }
954
955
956 #define READ_COUNTS
957 #define WRITE_COUNTS
958 #undef V
959 #define V(i,t) (*t (&(PCB).vs[(PCB).ssx + i]))
960 #undef VS
961 #define VS(i) (PCB).vs[(PCB).ssx + i]
962
963 #ifndef GET_CONTEXT
964 #define GET_CONTEXT CONTEXT = (PCB).input_context
965 #endif
966
967 typedef enum {
968 ag_action_1,
969 ag_action_2,
970 ag_action_3,
971 ag_action_4,
972 ag_action_5,
973 ag_action_6,
974 ag_action_7,
975 ag_action_8,
976 ag_action_9,
977 ag_action_10,
978 ag_action_11,
979 ag_action_12
980 } ag_parser_action;
981
982
983 #ifndef NULL_VALUE_INITIALIZER
984 #define NULL_VALUE_INITIALIZER = { 0 }
985 #endif
986
987 static cf-old_vs_type const ag_null_value NULL_VALUE_INITIALIZER;
988
989 static const unsigned char ag_rpx[] = {
990 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
991 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 9, 0, 0, 10, 11, 12,
992 0, 13, 14, 0, 15, 16, 17, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
993 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 20, 21, 22,
994 23, 24, 25, 26, 0, 0, 0, 27, 0, 0, 28, 29, 0, 0, 0, 0, 30, 0,
995 0, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 0, 0,
996 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 0, 0, 0, 57
997 };
998
999 static const unsigned char ag_key_itt[] = {
1000 0
1001 };
1002
1003 static const unsigned short ag_key_pt[] = {
1004 0
1005 };
1006
1007 static const unsigned char ag_key_ch[] = {
1008 0, 42, 47,255, 47,116,255, 42, 47,255, 47,116,255, 42, 47,255, 47,255,
1009 47,255, 47,255,116,255, 42, 47,255, 88,120,255, 47, 48,255, 47, 99,255,
1010 88,120,255, 48,255, 88,120,255, 47, 48,255, 34, 39, 63, 92, 97, 98,102,
1011 110,114,116,118,120,255, 92,255, 47, 99,255
1012 };
1013
1014 static const unsigned char ag_key_act[] = {
1015 0,0,0,4,2,3,4,3,3,4,3,3,4,0,0,4,2,4,3,4,3,4,3,4,0,0,4,0,0,4,2,2,4,3,3,
1016 4,0,0,4,2,4,0,0,4,3,2,4,0,0,0,0,0,0,0,0,0,0,0,0,4,2,4,3,3,4
1017 };
1018
1019 static const unsigned char ag_key_parm[] = {
1020 0,102, 54, 0, 0, 29, 0,101,102, 0, 54, 29, 0,102, 54, 0, 0, 0,
1021 102, 0, 54, 0, 29, 0,102, 54, 0, 65, 64, 0, 0, 0, 0,102, 30, 0,
1022 65, 64, 0, 0, 0, 65, 64, 0,102, 0, 0, 89, 88, 87, 86, 79, 80, 81,
1023 82, 83, 84, 85, 97, 0, 0, 0,102, 31, 0
1024 };
1025
1026 static const unsigned char ag_key_jmp[] = {
1027 0, 0, 0, 0, 1, 0, 0, 5, 7, 0, 9, 11, 0, 0, 0, 0, 13, 0,
1028 16, 0, 18, 0, 20, 0, 0, 0, 0, 0, 0, 0, 24, 27, 0, 25, 27, 0,
1029 0, 0, 0, 36, 0, 0, 0, 0, 31, 41, 0, 0, 0, 0, 0, 0, 0, 0,
1030 0, 0, 0, 0, 0, 0, 47, 0, 33, 35, 0
1031 };
1032
1033 static const unsigned char ag_key_index[] = {
1034 4, 7, 4, 10, 0, 16, 16, 0, 0, 18, 0, 20, 4, 22, 20, 0, 0, 0,
1035 0, 30, 16, 0, 33, 30, 39, 0, 0, 4, 44, 18, 30, 30, 39, 60, 20, 0,
1036 44, 62, 16, 16, 16, 16, 0, 60, 60, 39, 60, 60, 60, 16, 16, 20, 0, 20,
1037 18, 60, 16, 0, 0, 16, 0, 20
1038 };
1039
1040 static const unsigned char ag_key_ends[] = {
1041 114,105,97,108,0, 47,0, 42,0, 47,0, 114,105,97,108,0, 42,0,
1042 47,0, 114,105,97,108,0, 42,0, 111,112,121,0, 42,0, 42,0,
1043 111,100,101,0,
1044 };
1045
1046 #define AG_TCV(x) ag_tcv[(x)]
1047
1048 static const unsigned char ag_tcv[] = {
1049 24,107,107,107,107,107,107,107,107, 44, 51, 53, 53, 49,107,107,107,107,
1050 107,107,107,107,107,107,107,107, 24,107,107,107,107,107, 44,107, 72,107,
1051 107,107,107,107, 13, 15, 40, 9,107, 7,107,107, 61,104,104,104,104,104,
1052 104,104,105,105,107,107,107, 3,107,107,107, 66, 66, 66, 66, 66, 66,106,
1053 106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
1054 106,107, 92,107,107,106,107, 66, 66, 66, 66, 66, 66,106,106,106,106,106,
1055 106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,107,107,107,
1056 11,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
1057 107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
1058 107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
1059 107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
1060 107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
1061 107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
1062 107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
1063 107,107,107,107
1064 };
1065
1066 #ifndef SYNTAX_ERROR
1067 #define SYNTAX_ERROR fprintf(stderr,"%s, line %d, column %d\n", \
1068 (PCB).error_message, (PCB).line, (PCB).column)
1069 #endif
1070
1071 #ifndef FIRST_LINE
1072 #define FIRST_LINE 1
1073 #endif
1074
1075 #ifndef FIRST_COLUMN
1076 #define FIRST_COLUMN 1
1077 #endif
1078
1079 #ifndef PARSER_STACK_OVERFLOW
1080 #define PARSER_STACK_OVERFLOW {fprintf(stderr, \
1081 "\nParser stack overflow, line %d, column %d\n",\
1082 (PCB).line, (PCB).column);}
1083 #endif
1084
1085 #ifndef REDUCTION_TOKEN_ERROR
1086 #define REDUCTION_TOKEN_ERROR {fprintf(stderr, \
1087 "\nReduction token error, line %d, column %d\n", \
1088 (PCB).line, (PCB).column);}
1089 #endif
1090
1091
1092 #ifndef INPUT_CODE
1093 #define INPUT_CODE(T) (T)
1094 #endif
1095
1096 typedef enum
1097 {ag_accept_key, ag_set_key, ag_jmp_key, ag_end_key, ag_no_match_key,
1098 ag_cf_accept_key, ag_cf_set_key, ag_cf_end_key} key_words;
1099
1100 static void near ag_get_key_word(int ag_k) {
1101 int ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
1102 const unsigned char *ag_p;
1103 int ag_ch;
1104 while (1) {
1105 switch (ag_key_act[ag_k]) {
1106 case ag_cf_end_key: {
1107 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k];
1108 do {
1109 if ((ag_ch = *sp++) == 0) {
1110 int ag_k1 = ag_key_parm[ag_k];
1111 int ag_k2 = ag_key_pt[ag_k1];
1112 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) goto ag_fail;
1113 (PCB).token_number = (cf-old_token_type) ag_key_pt[ag_k1 + 1];
1114 return;
1115 }
1116 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch);
1117 goto ag_fail;
1118 }
1119 case ag_end_key: {
1120 const unsigned char *sp = ag_key_ends + ag_key_jmp[ag_k];
1121 do {
1122 if ((ag_ch = *sp++) == 0) {
1123 (PCB).token_number = (cf-old_token_type) ag_key_parm[ag_k];
1124 return;
1125 }
1126 } while (CONVERT_CASE(*(PCB).la_ptr++) == ag_ch);
1127 }
1128 case ag_no_match_key:
1129 ag_fail:
1130 (PCB).la_ptr = (PCB).pointer + ag_save;
1131 return;
1132 case ag_cf_set_key: {
1133 int ag_k1 = ag_key_parm[ag_k];
1134 int ag_k2 = ag_key_pt[ag_k1];
1135 ag_k = ag_key_jmp[ag_k];
1136 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)]) break;
1137 ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
1138 (PCB).token_number = (cf-old_token_type) ag_key_pt[ag_k1+1];
1139 break;
1140 }
1141 case ag_set_key:
1142 ag_save = (int) ((PCB).la_ptr - (PCB).pointer);
1143 (PCB).token_number = (cf-old_token_type) ag_key_parm[ag_k];
1144 case ag_jmp_key:
1145 ag_k = ag_key_jmp[ag_k];
1146 break;
1147 case ag_accept_key:
1148 (PCB).token_number = (cf-old_token_type) ag_key_parm[ag_k];
1149 return;
1150 case ag_cf_accept_key: {
1151 int ag_k1 = ag_key_parm[ag_k];
1152 int ag_k2 = ag_key_pt[ag_k1];
1153 if (ag_key_itt[ag_k2 + CONVERT_CASE(*(PCB).la_ptr)])
1154 (PCB).la_ptr = (PCB).pointer + ag_save;
1155 else (PCB).token_number = (cf-old_token_type) ag_key_pt[ag_k1+1];
1156 return;
1157 }
1158 }
1159 ag_ch = CONVERT_CASE(*(PCB).la_ptr++);
1160 ag_p = &ag_key_ch[ag_k];
1161 if (ag_ch <= 255) while (*ag_p < ag_ch) ag_p++;
1162 if (ag_ch > 255 || *ag_p != ag_ch) {
1163 (PCB).la_ptr = (PCB).pointer + ag_save;
1164 return;
1165 }
1166 ag_k = (int) (ag_p - ag_key_ch);
1167 }
1168 }
1169
1170
1171 #ifndef AG_NEWLINE
1172 #define AG_NEWLINE 10
1173 #endif
1174
1175 #ifndef AG_RETURN
1176 #define AG_RETURN 13
1177 #endif
1178
1179 #ifndef AG_FORMFEED
1180 #define AG_FORMFEED 12
1181 #endif
1182
1183 #ifndef AG_TABCHAR
1184 #define AG_TABCHAR 9
1185 #endif
1186
1187 static void near ag_track(void) {
1188 int ag_k = (int) ((PCB).la_ptr - (PCB).pointer);
1189 while (ag_k--) {
1190 switch (*(PCB).pointer++) {
1191 case AG_NEWLINE:
1192 (PCB).column = 1, (PCB).line++;
1193 case AG_RETURN:
1194 case AG_FORMFEED:
1195 break;
1196 case AG_TABCHAR:
1197 (PCB).column += (TAB_SPACING) - ((PCB).column - 1) % (TAB_SPACING);
1198 break;
1199 default:
1200 (PCB).column++;
1201 }
1202 }
1203 }
1204
1205
1206 static void near ag_prot(void) {
1207 int ag_k;
1208 ag_k = 128 - ++(PCB).btsx;
1209 if (ag_k <= (PCB).ssx) {
1210 (PCB).exit_flag = AG_STACK_ERROR_CODE;
1211 PARSER_STACK_OVERFLOW;
1212 return;
1213 }
1214 (PCB).bts[(PCB).btsx] = (PCB).sn;
1215 (PCB).bts[ag_k] = (PCB).ssx;
1216 (PCB).vs[ag_k] = (PCB).vs[(PCB).ssx];
1217 (PCB).ss[ag_k] = (PCB).ss[(PCB).ssx];
1218 (PCB).cs[ag_k] = (PCB).cs[(PCB).ssx];
1219 }
1220
1221 static void near ag_undo(void) {
1222 if ((PCB).drt == -1) return;
1223 while ((PCB).btsx) {
1224 int ag_k = 128 - (PCB).btsx;
1225 (PCB).sn = (PCB).bts[(PCB).btsx--];
1226 (PCB).ssx = (PCB).bts[ag_k];
1227 (PCB).vs[(PCB).ssx] = (PCB).vs[ag_k];
1228 (PCB).ss[(PCB).ssx] = (PCB).ss[ag_k];
1229 (PCB).cs[(PCB).ssx] = (PCB).cs[ag_k];
1230 }
1231 (PCB).token_number = (cf-old_token_type) (PCB).drt;
1232 (PCB).ssx = (PCB).dssx;
1233 (PCB).sn = (PCB).dsn;
1234 (PCB).drt = -1;
1235 }
1236
1237
1238
1239 static const int ag_rtt[] = {
1240 45,100, 0
1241 };
1242
1243 static const unsigned char ag_tstt[] = {
1244 106,102,66,54,51,49,44,29,24,11,0,1,16,17,18,45,100,
1245 107,106,105,104,102,101,92,72,66,61,53,51,49,44,40,15,13,11,9,7,3,0,45,100,
1246 102,44,0,16,45,100,
1247 106,66,54,51,49,29,24,11,0,10,19,20,21,22,23,25,41,47,50,
1248 107,106,105,104,92,72,66,61,53,51,49,44,40,15,13,11,9,7,3,0,56,57,
1249 106,102,66,54,51,49,44,0,4,5,16,17,45,46,47,48,50,100,
1250 106,105,104,102,66,61,54,51,49,44,40,24,15,13,3,0,16,17,18,45,100,
1251 51,0,
1252 51,49,0,50,
1253 102,44,0,16,17,45,100,
1254 106,66,0,25,41,
1255 3,0,2,
1256 106,102,66,54,53,51,49,44,29,24,11,0,16,45,47,50,52,100,
1257 106,66,29,11,0,10,19,25,41,
1258 54,51,49,24,0,20,47,50,
1259 24,0,
1260 107,106,105,104,92,72,66,61,53,44,40,15,13,11,9,7,3,0,
1261 51,0,
1262 51,49,0,48,50,
1263 106,105,104,102,72,66,65,64,61,54,51,49,44,40,13,9,7,0,16,45,46,47,48,50,
1264 100,
1265 106,105,104,102,66,61,44,0,16,45,100,
1266 51,0,
1267 102,44,30,0,16,45,100,
1268 106,105,104,102,72,66,65,64,61,54,51,49,44,9,7,0,4,5,16,17,45,46,47,48,50,
1269 100,
1270 106,105,104,72,66,65,64,61,9,7,0,6,8,25,26,27,28,41,68,69,70,
1271 51,49,0,50,
1272 51,0,
1273 106,102,66,54,53,51,49,44,29,24,11,0,16,45,47,50,52,100,
1274 102,44,0,16,17,45,100,
1275 102,44,0,16,17,45,100,
1276 105,104,102,65,64,61,54,51,49,44,0,4,5,16,17,45,46,47,48,50,100,
1277 105,104,102,65,64,61,54,51,49,44,0,4,5,16,17,45,46,47,48,50,100,
1278 105,104,65,64,61,0,58,60,63,67,
1279 107,106,105,104,97,92,89,88,87,86,85,84,83,82,81,80,79,66,61,53,44,40,15,13,
1280 11,9,7,3,0,71,73,74,75,76,78,90,91,93,94,95,96,
1281 40,13,0,12,34,35,36,37,38,39,
1282 51,0,
1283 102,44,0,16,45,100,
1284 102,44,31,0,16,45,100,
1285 105,104,66,61,0,
1286 104,61,0,
1287 105,104,61,0,
1288 102,54,51,49,44,24,0,16,17,18,45,100,
1289 104,61,0,
1290 104,61,0,
1291 104,61,0,
1292 65,64,0,63,
1293 105,66,0,
1294 105,104,66,61,0,
1295 107,106,97,92,89,88,87,86,85,84,83,82,81,80,79,72,53,44,40,15,13,11,9,7,3,0,
1296 76,78,90,91,93,94,95,96,
1297 102,54,51,49,44,40,13,0,4,5,16,17,45,46,47,48,50,100,
1298 106,102,66,54,51,49,44,40,24,15,13,0,16,17,18,45,100,
1299 106,66,0,25,41,
1300 40,13,0,12,34,35,36,37,38,39,
1301 40,13,0,12,36,37,38,39,
1302 102,44,3,0,16,17,18,45,100,
1303 105,104,66,61,0,
1304 102,54,51,49,44,24,0,16,17,18,45,100,
1305 15,0,14,
1306 3,0,2,
1307 102,54,51,49,44,24,15,0,16,17,18,45,100,
1308 105,104,61,0,32,
1309 105,104,61,0,
1310
1311 };
1312
1313
1314 static unsigned const char ag_astt[649] = {
1315 8,1,8,8,8,8,1,8,5,8,7,0,1,1,1,1,1,3,3,3,3,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,
1316 3,7,2,1,1,9,5,3,3,1,2,2,1,8,1,1,8,1,7,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1317 1,5,5,1,1,1,1,1,1,1,1,7,1,3,5,1,5,1,8,1,1,7,3,3,1,1,1,3,1,3,1,1,10,10,10,1,
1318 10,10,5,5,5,1,5,5,5,5,5,7,1,1,3,1,1,3,7,8,1,7,1,1,1,7,1,1,1,1,2,2,7,2,1,1,
1319 4,1,5,1,5,1,9,8,1,9,5,5,5,7,3,3,1,1,3,1,2,2,1,1,5,1,3,1,1,1,8,1,5,7,1,1,1,
1320 3,7,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,5,1,7,8,1,7,3,1,5,5,5,1,5,5,5,5,5,1,
1321 8,1,9,5,5,5,5,7,3,3,3,1,3,1,1,2,2,2,1,2,2,9,5,3,3,1,3,7,1,9,1,7,3,3,1,5,5,
1322 5,1,5,5,5,5,5,1,8,1,1,5,5,7,3,3,1,1,1,3,1,3,1,1,2,5,5,2,2,5,5,5,1,1,7,2,2,
1323 1,2,2,2,1,1,2,1,8,1,7,1,3,7,5,1,5,1,9,8,1,9,5,5,5,7,3,3,1,1,3,1,1,1,5,1,1,
1324 1,1,1,1,7,1,1,1,1,5,5,1,5,5,5,1,8,1,1,7,3,3,1,1,1,3,1,3,1,1,5,5,1,5,5,5,1,
1325 8,1,1,7,3,3,1,1,1,3,1,3,1,1,2,2,2,2,2,7,1,1,1,1,2,2,2,2,1,1,2,2,2,2,2,2,2,
1326 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,7,1,1,1,1,2,2,2,1,1,2,2,2,1,1,5,2,2,1,2,1,1,
1327 1,3,7,1,9,5,3,3,1,1,9,1,7,3,3,1,10,10,10,10,5,10,10,5,10,10,10,5,1,5,5,5,1,
1328 5,7,1,1,2,1,1,2,2,7,2,2,5,2,2,5,2,2,7,1,2,2,5,10,10,10,10,5,2,2,1,1,2,2,2,
1329 2,2,2,2,2,2,2,2,1,2,2,2,2,2,2,2,2,2,7,2,2,2,1,1,2,2,2,1,1,8,1,1,5,5,7,3,3,
1330 1,1,1,3,1,3,1,1,5,1,5,5,5,5,1,5,5,5,5,7,1,1,2,1,1,2,2,5,2,1,1,1,7,2,1,1,1,
1331 1,1,1,1,1,5,2,2,1,2,1,1,1,8,7,1,1,1,1,1,10,10,10,10,4,1,5,5,5,1,5,7,1,1,3,
1332 1,1,1,7,2,1,7,1,1,5,5,5,1,5,5,7,1,1,3,1,1,2,2,2,7,1,10,10,10,4
1333 };
1334
1335
1336 static const unsigned char ag_pstt[] = {
1337 3,1,3,3,3,3,2,3,10,3,0,0,2,2,3,2,1,
1338 121,121,121,121,1,119,121,121,121,121,121,121,121,121,121,121,121,121,121,
1339 121,121,1,122,1,
1340 1,9,11,9,9,1,
1341 41,41,4,7,7,9,15,5,3,10,14,12,14,13,15,11,6,8,7,
1342 16,16,16,16,16,16,16,16,16,65,65,16,16,16,16,16,16,16,16,4,16,67,
1343 1,1,1,4,17,17,19,5,6,6,19,19,19,6,18,6,17,1,
1344 42,42,42,1,42,42,10,10,10,20,10,10,10,10,10,6,20,20,44,20,1,
1345 60,7,
1346 21,21,8,21,
1347 1,22,9,22,22,22,1,
1348 41,41,10,22,6,
1349 23,21,24,
1350 16,1,16,4,62,26,26,61,16,16,16,12,61,61,25,26,61,1,
1351 41,41,9,5,19,10,14,11,6,
1352 4,7,7,18,14,27,8,7,
1353 20,15,
1354 64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,64,66,
1355 28,17,
1356 17,17,18,50,17,
1357 47,47,47,1,47,47,47,47,47,4,17,17,9,47,47,47,47,19,9,9,48,18,48,17,1,
1358 43,43,43,1,43,43,9,11,9,9,1,
1359 59,21,
1360 1,9,29,22,9,9,1,
1361 1,1,1,1,1,1,1,1,1,4,17,17,19,1,1,23,3,3,19,19,19,3,18,3,17,1,
1362 41,80,80,88,41,80,80,80,30,31,24,83,82,34,23,24,25,6,32,82,33,
1363 35,35,25,35,
1364 57,26,
1365 15,1,15,4,62,26,26,61,15,15,15,27,61,61,25,26,61,1,
1366 1,36,54,36,36,36,1,
1367 1,37,29,37,37,37,1,
1368 1,1,1,1,1,1,4,17,17,19,30,5,5,19,19,19,5,18,5,17,1,
1369 1,1,1,1,1,1,4,17,17,19,31,4,4,19,19,19,4,18,4,17,1,
1370 68,68,73,72,70,32,40,39,38,41,
1371 110,110,111,111,45,42,101,100,99,98,97,96,95,94,93,92,91,111,111,110,110,
1372 110,110,110,110,110,110,110,33,48,47,46,48,110,110,102,44,43,115,108,
1373 117,
1374 50,49,29,34,30,53,30,52,53,51,
1375 58,35,
1376 1,9,55,9,9,1,
1377 1,9,54,37,9,9,1,
1378 74,74,75,74,78,
1379 71,71,77,
1380 69,69,69,76,
1381 1,10,10,10,2,10,41,2,2,79,2,1,
1382 103,103,42,
1383 105,105,107,
1384 104,104,106,
1385 73,72,45,55,
1386 114,114,86,
1387 113,113,113,113,85,
1388 112,112,45,42,101,100,99,98,97,96,95,94,93,92,91,56,112,112,112,112,112,112,
1389 112,112,112,48,112,112,102,44,43,116,108,118,
1390 1,4,17,17,19,1,1,49,7,7,19,19,19,7,18,7,17,1,
1391 10,1,10,10,10,10,2,10,10,10,10,50,2,2,38,2,1,
1392 41,41,36,37,6,
1393 50,49,52,34,57,53,57,52,53,51,
1394 50,49,31,34,33,52,40,51,
1395 1,2,58,54,2,2,58,2,1,
1396 74,74,75,74,109,
1397 1,10,10,10,2,10,56,2,2,84,2,1,
1398 59,57,35,
1399 23,58,60,
1400 1,10,10,10,2,10,10,59,2,2,12,2,1,
1401 27,27,27,60,61,
1402 28,28,28,26,
1403
1404 };
1405
1406
1407 static const unsigned short ag_sbt[] = {
1408 0, 17, 41, 47, 66, 88, 106, 127, 129, 133, 140, 145, 148, 166,
1409 175, 183, 185, 203, 205, 210, 235, 246, 248, 255, 281, 302, 306, 308,
1410 326, 333, 340, 361, 382, 392, 433, 443, 445, 451, 458, 463, 466, 470,
1411 482, 485, 488, 491, 495, 498, 503, 537, 555, 572, 577, 587, 595, 604,
1412 609, 621, 624, 627, 640, 645, 649
1413 };
1414
1415
1416 static const unsigned short ag_sbe[] = {
1417 10, 38, 43, 55, 85, 95, 121, 128, 131, 135, 142, 146, 159, 170,
1418 179, 184, 202, 204, 207, 227, 242, 247, 251, 270, 291, 304, 307, 319,
1419 328, 335, 350, 371, 387, 420, 435, 444, 447, 454, 462, 465, 469, 476,
1420 484, 487, 490, 493, 497, 502, 528, 544, 566, 574, 579, 589, 598, 608,
1421 615, 622, 625, 634, 643, 648, 649
1422 };
1423
1424
1425 static const unsigned char ag_fl[] = {
1426 1,0,1,2,2,2,2,2,1,2,0,1,2,1,2,2,1,0,1,1,3,1,2,3,3,3,8,1,2,1,2,1,1,2,1,
1427 3,1,2,2,1,2,1,2,3,2,1,1,1,2,1,2,1,0,1,2,3,1,2,3,3,2,2,2,1,2,0,1,2,1,2,
1428 1,2,1,1,2,2,1,1,1,3,0,1,1,1,4,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,
1429 2,1,1,1,2,1,1,2,2,2,1,2,1,2,2,1,2,2
1430 };
1431
1432 static const unsigned char ag_ptt[] = {
1433 0, 5, 5, 2, 6, 8, 10, 12, 17, 17, 18, 18, 14, 21, 21, 22, 22, 23,
1434 23, 23, 1, 19, 19, 19, 19, 19, 19, 32, 32, 26, 26, 34, 34, 34, 37, 36,
1435 38, 38, 39, 35, 35, 41, 41, 41, 25, 16, 16, 4, 4, 4, 46, 46, 50, 50,
1436 48, 48, 52, 52, 52, 20, 20, 20, 20, 56, 56, 57, 57, 47, 58, 58, 60, 60,
1437 63, 63, 63, 63, 67, 67, 67, 28, 69, 69, 68, 68, 27, 71, 71, 71, 70, 76,
1438 76, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 91, 93, 90, 95, 95,
1439 94, 96, 73, 73, 73, 73, 73, 74, 74, 75, 75, 45,100,100, 45
1440 };
1441
1442 static const unsigned char *ag_valid(int ag_k) {
1443 const unsigned char *ag_tp = &ag_tstt[ag_sbt[(PCB).sn+1]];
1444 while (*--ag_tp != (unsigned char) ag_k) if (*ag_tp == 0) return NULL;
1445 return ag_tp;
1446 }
1447
1448 int cf-old_change_reduction(cf-old_token_type ag_k) {
1449 if (!ag_valid(ag_k)) return 0;
1450 (PCB).reduction_token = ag_k;
1451 return 1;
1452 }
1453
1454 static void near ag_default(const int *ag_tp) {
1455 (PCB).ag_dsn = (PCB).sn;
1456 (PCB).ag_dtl = ag_tp;
1457 while (!ag_valid((cf-old_token_type) *ag_tp)) ag_tp++;
1458 (PCB).reduction_token = (cf-old_token_type) *ag_tp;
1459 }
1460
1461
1462
1463 static void near ag_ra(void)
1464 {
1465 switch(ag_rpx[(PCB).ag_ap]) {
1466 case 1: ag_rp_1(); break;
1467 case 2: ag_rp_2(); break;
1468 case 3: ag_rp_3(); break;
1469 case 4: ag_rp_4(); break;
1470 case 5: ag_rp_5(V(2,(int *))); break;
1471 case 6: ag_rp_6(V(7,(unsigned long *))); break;
1472 case 7: V(0,(unsigned long *)) = ag_rp_7(V(0,(int *))); break;
1473 case 8: V(0,(unsigned long *)) = ag_rp_8(V(0,(unsigned long *)), V(1,(int *))); break;
1474 case 9: ag_rp_9(); break;
1475 case 10: ag_rp_10(); break;
1476 case 11: V(0,(int *)) = ag_rp_11(); break;
1477 case 12: ag_rp_12(); break;
1478 case 13: ag_rp_13(); break;
1479 case 14: ag_rp_14(); break;
1480 case 15: ag_rp_15(); break;
1481 case 16: ag_rp_16(V(0,(int *))); break;
1482 case 17: ag_rp_17(V(1,(int *))); break;
1483 case 18: ag_rp_18(V(2,(int *))); break;
1484 case 19: V(0,(int *)) = ag_rp_19(V(0,(int *))); break;
1485 case 20: V(0,(int *)) = ag_rp_20(V(0,(int *)), V(1,(int *))); break;
1486 case 21: V(0,(int *)) = ag_rp_21(); break;
1487 case 22: V(0,(int *)) = ag_rp_22(V(0,(int *)), V(1,(int *))); break;
1488 case 23: V(0,(int *)) = ag_rp_23(); break;
1489 case 24: V(0,(int *)) = ag_rp_24(); break;
1490 case 25: V(0,(int *)) = ag_rp_25(V(0,(int *)), V(1,(int *))); break;
1491 case 26: V(0,(int *)) = ag_rp_26(V(0,(int *)), V(1,(int *))); break;
1492 case 27: V(0,(int *)) = ag_rp_27(V(0,(int *)), V(1,(int *))); break;
1493 case 28: V(0,(int *)) = ag_rp_28(); break;
1494 case 29: V(0,(int *)) = ag_rp_29(); break;
1495 case 30: ag_rp_30(); break;
1496 case 31: V(0,(int *)) = ag_rp_31(); break;
1497 case 32: V(0,(int *)) = ag_rp_32(); break;
1498 case 33: V(0,(int *)) = ag_rp_33(); break;
1499 case 34: V(0,(int *)) = ag_rp_34(); break;
1500 case 35: V(0,(int *)) = ag_rp_35(); break;
1501 case 36: V(0,(int *)) = ag_rp_36(); break;
1502 case 37: V(0,(int *)) = ag_rp_37(); break;
1503 case 38: V(0,(int *)) = ag_rp_38(); break;
1504 case 39: V(0,(int *)) = ag_rp_39(); break;
1505 case 40: V(0,(int *)) = ag_rp_40(); break;
1506 case 41: V(0,(int *)) = ag_rp_41(); break;
1507 case 42: V(0,(int *)) = ag_rp_42(V(0,(int *))); break;
1508 case 43: V(0,(int *)) = ag_rp_43(V(1,(int *))); break;
1509 case 44: V(0,(int *)) = ag_rp_44(V(0,(int *)), V(1,(int *))); break;
1510 case 45: V(0,(int *)) = ag_rp_45(V(0,(int *)), V(1,(int *))); break;
1511 case 46: V(0,(int *)) = ag_rp_46(V(0,(int *))); break;
1512 case 47: V(0,(int *)) = ag_rp_47(V(1,(int *))); break;
1513 case 48: ag_rp_48(V(0,(int *))); break;
1514 case 49: ag_rp_49(V(0,(int *))); break;
1515 case 50: ag_rp_50(V(1,(int *))); break;
1516 case 51: ag_rp_51(V(1,(int *))); break;
1517 case 52: ag_rp_52(V(1,(int *))); break;
1518 case 53: ag_rp_53(V(0,(int *))); break;
1519 case 54: ag_rp_54(V(1,(int *))); break;
1520 case 55: ag_rp_55(V(0,(int *))); break;
1521 case 56: ag_rp_56(V(1,(int *))); break;
1522 case 57: ag_default(&ag_rtt[0]); ag_rp_57(); break;
1523 }
1524 (PCB).la_ptr = (PCB).pointer;
1525 }
1526
1527
1528 static const unsigned char ag_ctn[] = {
1529 0,0, 45,1, 0,0, 0,0, 47,1, 10,1, 25,1, 20,1, 20,1, 19,1, 19,1, 19,1,
1530 20,1, 22,1, 22,1, 0,0, 0,0, 0,0, 46,1, 0,0, 0,0, 20,2, 0,0, 2,1,
1531 19,2, 52,1, 52,1, 20,1, 0,0, 19,3, 8,1, 6,1, 28,1, 27,1, 26,1, 52,2,
1532 0,0, 0,0, 63,1, 60,1, 58,1, 28,2, 76,1, 76,1, 76,1, 0,0, 71,1, 71,1,
1533 71,1, 36,1, 39,1, 0,0, 36,1, 34,1, 19,5, 63,1, 27,3, 36,2, 19,6, 0,0,
1534 19,7, 32,1
1535 };
1536
1537 #ifndef MISSING_FORMAT
1538 #define MISSING_FORMAT "Missing %s"
1539 #endif
1540 #ifndef UNEXPECTED_FORMAT
1541 #define UNEXPECTED_FORMAT "Unexpected %s"
1542 #endif
1543 #ifndef UNNAMED_TOKEN
1544 #define UNNAMED_TOKEN "input"
1545 #endif
1546
1547
1548 static void near ag_diagnose(void) {
1549 int ag_snd = (PCB).sn;
1550 int ag_k = ag_sbt[ag_snd];
1551
1552 if (*TOKEN_NAMES[ag_tstt[ag_k]] && ag_astt[ag_k + 1] == ag_action_8) {
1553 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
1554 }
1555 else if (ag_astt[ag_sbe[(PCB).sn]] == ag_action_8
1556 && (ag_k = (int) ag_sbe[(PCB).sn] + 1) == (int) ag_sbt[(PCB).sn+1] - 1
1557 && *TOKEN_NAMES[ag_tstt[ag_k]]) {
1558 sprintf((PCB).ag_msg, MISSING_FORMAT, TOKEN_NAMES[ag_tstt[ag_k]]);
1559 }
1560 else if ((PCB).token_number && *TOKEN_NAMES[(PCB).token_number]) {
1561 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, TOKEN_NAMES[(PCB).token_number]);
1562 }
1563 else if (isprint(INPUT_CODE((*(PCB).pointer))) && INPUT_CODE((*(PCB).pointer)) != '\\') {
1564 char buf[20];
1565 sprintf(buf, "\'%c\'", (char) INPUT_CODE((*(PCB).pointer)));
1566 sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, buf);
1567 }
1568 else sprintf((PCB).ag_msg, UNEXPECTED_FORMAT, UNNAMED_TOKEN);
1569 (PCB).error_message = (PCB).ag_msg;
1570
1571
1572 {
1573 int ag_sx, ag_t;
1574
1575 ag_sx = (PCB).ssx;
1576 (PCB).ss[ag_sx] = (PCB).sn;
1577 do {
1578 while (ag_sx && ag_ctn[2*(ag_snd = (PCB).ss[ag_sx])] == 0) ag_sx--;
1579 if (ag_sx) {
1580 ag_t = ag_ctn[2*ag_snd];
1581 ag_sx -= ag_ctn[2*ag_snd +1];
1582 ag_snd = (PCB).ss[ag_sx];
1583 }
1584 else {
1585 ag_snd = 0;
1586 ag_t = ag_ptt[0];
1587 }
1588 } while (ag_sx && *TOKEN_NAMES[ag_t]==0);
1589 if (*TOKEN_NAMES[ag_t] == 0) ag_t = 0;
1590 (PCB).error_frame_ssx = ag_sx;
1591 (PCB).error_frame_token = (cf-old_token_type) ag_t;
1592 }
1593
1594
1595 }
1596 static int near ag_action_1_r_proc(void);
1597 static int near ag_action_2_r_proc(void);
1598 static int near ag_action_3_r_proc(void);
1599 static int near ag_action_4_r_proc(void);
1600 static int near ag_action_1_s_proc(void);
1601 static int near ag_action_3_s_proc(void);
1602 static int near ag_action_1_proc(void);
1603 static int near ag_action_2_proc(void);
1604 static int near ag_action_3_proc(void);
1605 static int near ag_action_4_proc(void);
1606 static int near ag_action_5_proc(void);
1607 static int near ag_action_6_proc(void);
1608 static int near ag_action_7_proc(void);
1609 static int near ag_action_8_proc(void);
1610 static int near ag_action_9_proc(void);
1611 static int near ag_action_10_proc(void);
1612 static int near ag_action_11_proc(void);
1613 static int near ag_action_8_proc(void);
1614
1615
1616 static int (near *const ag_r_procs_scan[])(void) = {
1617 ag_action_1_r_proc,
1618 ag_action_2_r_proc,
1619 ag_action_3_r_proc,
1620 ag_action_4_r_proc
1621 };
1622
1623 static int (near *const ag_s_procs_scan[])(void) = {
1624 ag_action_1_s_proc,
1625 ag_action_2_r_proc,
1626 ag_action_3_s_proc,
1627 ag_action_4_r_proc
1628 };
1629
1630 static int (near *const ag_gt_procs_scan[])(void) = {
1631 ag_action_1_proc,
1632 ag_action_2_proc,
1633 ag_action_3_proc,
1634 ag_action_4_proc,
1635 ag_action_5_proc,
1636 ag_action_6_proc,
1637 ag_action_7_proc,
1638 ag_action_8_proc,
1639 ag_action_9_proc,
1640 ag_action_10_proc,
1641 ag_action_11_proc,
1642 ag_action_8_proc
1643 };
1644
1645
1646 static int near ag_rns(int ag_t, int *ag_sx, int ag_snd) {
1647 while (1) {
1648 int ag_act, ag_k = ag_sbt[ag_snd], ag_lim = ag_sbt[ag_snd+1];
1649 int ag_p;
1650
1651 while (ag_k < ag_lim && ag_tstt[ag_k] != ag_t) ag_k++;
1652 if (ag_k == ag_lim) break;
1653 ag_act = ag_astt[ag_k];
1654 ag_p = ag_pstt[ag_k];
1655 if (ag_act == ag_action_2) return ag_p;
1656 if (ag_act == ag_action_10 || ag_act == ag_action_11) {
1657 (*ag_sx)--;
1658 return ag_snd;
1659 }
1660 if (ag_act != ag_action_3 &&
1661 ag_act != ag_action_4) break;
1662 *ag_sx -= (ag_fl[ag_p] - 1);
1663 ag_snd = (PCB).ss[*ag_sx];
1664 ag_t = ag_ptt[ag_p];
1665 }
1666 return 0;
1667 }
1668
1669 static int near ag_jns(int ag_t) {
1670 int ag_k;
1671
1672 ag_k = ag_sbt[(PCB).sn];
1673 while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++;
1674 while (1) {
1675 int ag_p = ag_pstt[ag_k];
1676 int ag_sd;
1677
1678 switch (ag_astt[ag_k]) {
1679 case ag_action_2:
1680 GET_CONTEXT;
1681 (PCB).ss[(PCB).ssx] = (PCB).sn;
1682 return ag_p;
1683 case ag_action_10:
1684 case ag_action_11:
1685 return (PCB).ss[(PCB).ssx--];
1686 case ag_action_9:
1687 GET_CONTEXT;
1688 (PCB).ss[(PCB).ssx] = (PCB).sn;
1689 (PCB).ssx++;
1690 (PCB).sn = ag_p;
1691 ag_k = ag_sbt[(PCB).sn];
1692 while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++;
1693 continue;
1694 case ag_action_3:
1695 case ag_action_4:
1696 ag_sd = ag_fl[ag_p] - 1;
1697 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1698 else GET_CONTEXT;
1699 (PCB).ss[(PCB).ssx] = (PCB).sn;
1700 ag_t = ag_ptt[ag_p];
1701 ag_k = ag_sbt[(PCB).sn+1];
1702 while (ag_tstt[--ag_k] != ag_t);
1703 continue;
1704 case ag_action_5:
1705 case ag_action_6:
1706 if (ag_fl[ag_p]) break;
1707 (PCB).sn = ag_rns(ag_ptt[ag_p],&(PCB).ssx, (PCB).sn);
1708 (PCB).ss[++(PCB).ssx] = (PCB).sn;
1709 ag_k = ag_sbt[(PCB).sn];
1710 while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++;
1711 continue;
1712 }
1713 break;
1714 }
1715 return 0;
1716 }
1717
1718
1719 static int near ag_atx(int ag_t, int *ag_sx, int ag_snd) {
1720 int ag_k, ag_f;
1721 int ag_save_btsx = (PCB).btsx;
1722 int ag_flag = 1;
1723
1724 while (1) {
1725 int ag_a;
1726
1727 (PCB).bts[128 - ++(PCB).btsx] = *ag_sx;
1728 (PCB).ss[128 - (PCB).btsx] = (PCB).ss[*ag_sx];
1729 (PCB).ss[*ag_sx] = ag_snd;
1730 ag_k = ag_sbt[ag_snd];
1731 while (ag_tstt[ag_k] != ag_t && ag_tstt[ag_k]) ag_k++;
1732 ag_a = ag_astt[ag_k];
1733 if (ag_a == ag_action_2 ||
1734 ag_a == ag_action_3 ||
1735 ag_a == ag_action_10 ||
1736 ag_a == ag_action_11 ||
1737 ag_a == ag_action_1 ||
1738 ag_a == ag_action_4) break;
1739 if ((ag_a == ag_action_5 ||
1740 ag_a == ag_action_6) &&
1741 (ag_k = ag_fl[ag_f = ag_pstt[ag_k]]) == 0) {
1742 ag_snd = ag_rns(ag_ptt[ag_f],ag_sx, (PCB).ss[*ag_sx]);
1743 (*ag_sx)++;
1744 continue;
1745 }
1746 if (ag_a == ag_action_9) {
1747 ag_snd = ag_pstt[ag_k];
1748 (*ag_sx)++;
1749 continue;
1750 }
1751 ag_flag = 0;
1752 break;
1753 }
1754 while ((PCB).btsx > ag_save_btsx) {
1755 *ag_sx = (PCB).bts[128 - (PCB).btsx];
1756 (PCB).ss[*ag_sx] = (PCB).ss[128 - (PCB).btsx--];
1757 }
1758 return ag_flag;
1759 }
1760
1761
1762 static int near ag_tst_tkn(void) {
1763 int ag_rk, ag_sx, ag_snd = (PCB).sn;
1764
1765 (PCB).token_number = (cf-old_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
1766 (PCB).la_ptr++;
1767 if (ag_key_index[(PCB).sn]) {
1768 unsigned ag_k = ag_key_index[(PCB).sn];
1769 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
1770 if (ag_ch <= 255) {
1771 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
1772 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
1773 }
1774 }
1775 for (ag_rk = 0; ag_rk < (PCB).ag_lrss; ag_rk += 2) {
1776 ag_sx = (PCB).ag_rss[ag_rk];
1777 if (ag_sx > (PCB).ssx || ag_sx > (PCB).ag_min_depth) continue;
1778 (PCB).sn = (PCB).ag_rss[ag_rk + 1];
1779 if (ag_atx((PCB).token_number, &ag_sx, (PCB).sn)) break;
1780 }
1781 (PCB).sn = ag_snd;
1782 return ag_rk;
1783 }
1784
1785 static void near ag_set_error_procs(void);
1786
1787 static void near ag_auto_resynch(void) {
1788 int ag_sx, ag_rk;
1789 int ag_rk1, ag_rk2, ag_tk1;
1790 (PCB).ss[(PCB).ssx] = (PCB).sn;
1791 if ((PCB).ag_error_depth && (PCB).ag_min_depth >= (PCB).ag_error_depth) {
1792 (PCB).ssx = (PCB).ag_error_depth;
1793 (PCB).sn = (PCB).ss[(PCB).ssx];
1794 }
1795 else {
1796 ag_diagnose();
1797 SYNTAX_ERROR;
1798 if ((PCB).exit_flag != AG_RUNNING_CODE) return;
1799 (PCB).ag_error_depth = (PCB).ag_min_depth = 0;
1800 (PCB).ag_lrss = 0;
1801 (PCB).ss[ag_sx = (PCB).ssx] = (PCB).sn;
1802 (PCB).ag_min_depth = (PCB).ag_rss[(PCB).ag_lrss++] = ag_sx;
1803 (PCB).ag_rss[(PCB).ag_lrss++] = (PCB).sn;
1804 while (ag_sx && (PCB).ag_lrss < 2*128) {
1805 int ag_t = 0, ag_x, ag_s, ag_sxs = ag_sx;
1806
1807 while (ag_sx && (ag_t = ag_ctn[2*(PCB).sn]) == 0) (PCB).sn = (PCB).ss[--ag_sx];
1808 if (ag_t) (PCB).sn = (PCB).ss[ag_sx -= ag_ctn[2*(PCB).sn +1]];
1809 else {
1810 if (ag_sx == 0) (PCB).sn = 0;
1811 ag_t = ag_ptt[0];
1812 }
1813 if ((ag_s = ag_rns(ag_t, &ag_sx, (PCB).sn)) == 0) break;
1814 for (ag_x = 0; ag_x < (PCB).ag_lrss; ag_x += 2)
1815 if ((PCB).ag_rss[ag_x] == ag_sx + 1 && (PCB).ag_rss[ag_x+1] == ag_s) break;
1816 if (ag_x == (PCB).ag_lrss) {
1817 (PCB).ag_rss[(PCB).ag_lrss++] = ++ag_sx;
1818 (PCB).ag_rss[(PCB).ag_lrss++] = (PCB).sn = ag_s;
1819 }
1820 else if (ag_sx >= ag_sxs) ag_sx--;
1821 }
1822 ag_set_error_procs();
1823 }
1824 (PCB).la_ptr = (PCB).pointer;
1825 if ((PCB).ssx > (PCB).ag_min_depth) (PCB).ag_min_depth = (PCB).ssx;
1826 while (1) {
1827 ag_rk1 = ag_tst_tkn();
1828 if ((PCB).token_number == 24)
1829 {(PCB).exit_flag = AG_SYNTAX_ERROR_CODE; return;}
1830 if (ag_rk1 < (PCB).ag_lrss) break;
1831 {(PCB).la_ptr = (PCB).pointer + 1; ag_track();}
1832 }
1833 ag_tk1 = (PCB).token_number;
1834 ag_track();
1835 ag_rk2 = ag_tst_tkn();
1836 if (ag_rk2 < ag_rk1) {ag_rk = ag_rk2; ag_track();}
1837 else {ag_rk = ag_rk1; (PCB).token_number = (cf-old_token_type) ag_tk1; (PCB).la_ptr = (PCB).pointer;}
1838 (PCB).ag_min_depth = (PCB).ssx = (PCB).ag_rss[ag_rk++];
1839 (PCB).sn = (PCB).ss[(PCB).ssx] = (PCB).ag_rss[ag_rk];
1840 (PCB).sn = ag_jns((PCB).token_number);
1841 if ((PCB).ag_error_depth == 0 || (PCB).ag_error_depth > (PCB).ssx)
1842 (PCB).ag_error_depth = (PCB).ssx;
1843 if (++(PCB).ssx >= 128) {
1844 (PCB).exit_flag = AG_STACK_ERROR_CODE;
1845 PARSER_STACK_OVERFLOW;
1846 return;
1847 }
1848 GET_CONTEXT;
1849 (PCB).ss[(PCB).ssx] = (PCB).sn;
1850 (PCB).ag_tmp_depth = (PCB).ag_min_depth;
1851 (PCB).la_ptr = (PCB).pointer;
1852 return;
1853 }
1854
1855
1856 static int near ag_action_10_proc(void) {
1857 int ag_t = (PCB).token_number;
1858 (PCB).btsx = 0, (PCB).drt = -1;
1859 do {
1860 ag_track();
1861 (PCB).token_number = (cf-old_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
1862 (PCB).la_ptr++;
1863 if (ag_key_index[(PCB).sn]) {
1864 unsigned ag_k = ag_key_index[(PCB).sn];
1865 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
1866 if (ag_ch <= 255) {
1867 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
1868 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
1869 }
1870 }
1871 } while ((PCB).token_number == (cf-old_token_type) ag_t);
1872 (PCB).la_ptr = (PCB).pointer;
1873 return 1;
1874 }
1875
1876 static int near ag_action_11_proc(void) {
1877 int ag_t = (PCB).token_number;
1878
1879 (PCB).btsx = 0, (PCB).drt = -1;
1880 do {
1881 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
1882 (PCB).ssx--;
1883 ag_track();
1884 ag_ra();
1885 if ((PCB).exit_flag != AG_RUNNING_CODE) return 0;
1886 (PCB).ssx++;
1887 (PCB).token_number = (cf-old_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
1888 (PCB).la_ptr++;
1889 if (ag_key_index[(PCB).sn]) {
1890 unsigned ag_k = ag_key_index[(PCB).sn];
1891 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
1892 if (ag_ch <= 255) {
1893 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
1894 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
1895 }
1896 }
1897 }
1898 while ((PCB).token_number == (cf-old_token_type) ag_t);
1899 (PCB).la_ptr = (PCB).pointer;
1900 return 1;
1901 }
1902
1903 static int near ag_action_3_r_proc(void) {
1904 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1905 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1906 (PCB).btsx = 0, (PCB).drt = -1;
1907 (PCB).reduction_token = (cf-old_token_type) ag_ptt[(PCB).ag_ap];
1908 ag_ra();
1909 return (PCB).exit_flag == AG_RUNNING_CODE;
1910 }
1911
1912 static int near ag_action_3_s_proc(void) {
1913 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1914 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1915 (PCB).btsx = 0, (PCB).drt = -1;
1916 (PCB).reduction_token = (cf-old_token_type) ag_ptt[(PCB).ag_ap];
1917 ag_ra();
1918 return (PCB).exit_flag == AG_RUNNING_CODE;
1919 }
1920
1921 static int near ag_action_4_r_proc(void) {
1922 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1923 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1924 (PCB).reduction_token = (cf-old_token_type) ag_ptt[(PCB).ag_ap];
1925 return 1;
1926 }
1927
1928 static int near ag_action_2_proc(void) {
1929 (PCB).btsx = 0, (PCB).drt = -1;
1930 if ((PCB).ssx >= 128) {
1931 (PCB).exit_flag = AG_STACK_ERROR_CODE;
1932 PARSER_STACK_OVERFLOW;
1933 }
1934 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
1935 GET_CONTEXT;
1936 (PCB).ss[(PCB).ssx] = (PCB).sn;
1937 (PCB).ssx++;
1938 (PCB).sn = (PCB).ag_ap;
1939 ag_track();
1940 return 0;
1941 }
1942
1943 static int near ag_action_9_proc(void) {
1944 if ((PCB).drt == -1) {
1945 (PCB).drt=(PCB).token_number;
1946 (PCB).dssx=(PCB).ssx;
1947 (PCB).dsn=(PCB).sn;
1948 }
1949 ag_prot();
1950 (PCB).vs[(PCB).ssx] = ag_null_value;
1951 GET_CONTEXT;
1952 (PCB).ss[(PCB).ssx] = (PCB).sn;
1953 (PCB).ssx++;
1954 (PCB).sn = (PCB).ag_ap;
1955 (PCB).la_ptr = (PCB).pointer;
1956 return (PCB).exit_flag == AG_RUNNING_CODE;
1957 }
1958
1959 static int near ag_action_2_r_proc(void) {
1960 (PCB).ssx++;
1961 (PCB).sn = (PCB).ag_ap;
1962 return 0;
1963 }
1964
1965 static int near ag_action_7_proc(void) {
1966 --(PCB).ssx;
1967 (PCB).la_ptr = (PCB).pointer;
1968 (PCB).exit_flag = AG_SUCCESS_CODE;
1969 return 0;
1970 }
1971
1972 static int near ag_action_1_proc(void) {
1973 ag_track();
1974 (PCB).exit_flag = AG_SUCCESS_CODE;
1975 return 0;
1976 }
1977
1978 static int near ag_action_1_r_proc(void) {
1979 (PCB).exit_flag = AG_SUCCESS_CODE;
1980 return 0;
1981 }
1982
1983 static int near ag_action_1_s_proc(void) {
1984 (PCB).exit_flag = AG_SUCCESS_CODE;
1985 return 0;
1986 }
1987
1988 static int near ag_action_4_proc(void) {
1989 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
1990 (PCB).reduction_token = (cf-old_token_type) ag_ptt[(PCB).ag_ap];
1991 (PCB).btsx = 0, (PCB).drt = -1;
1992 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
1993 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
1994 else GET_CONTEXT;
1995 (PCB).ss[(PCB).ssx] = (PCB).sn;
1996 ag_track();
1997 while ((PCB).exit_flag == AG_RUNNING_CODE) {
1998 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
1999 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
2000 do {
2001 unsigned ag_tx = (ag_t1 + ag_t2)/2;
2002 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
2003 else ag_t2 = ag_tx;
2004 } while (ag_t1 < ag_t2);
2005 if (ag_tstt[ag_t1] != (PCB).reduction_token) {
2006 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE;
2007 REDUCTION_TOKEN_ERROR; break;}
2008 (PCB).ag_ap = ag_pstt[ag_t1];
2009 if ((*(PCB).s_procs[ag_astt[ag_t1]])() == 0) break;
2010 }
2011 return 0;
2012 }
2013
2014 static int near ag_action_3_proc(void) {
2015 int ag_sd = ag_fl[(PCB).ag_ap] - 1;
2016 (PCB).btsx = 0, (PCB).drt = -1;
2017 (*(int *) &(PCB).vs[(PCB).ssx]) = *(PCB).pointer;
2018 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
2019 else GET_CONTEXT;
2020 (PCB).ss[(PCB).ssx] = (PCB).sn;
2021 ag_track();
2022 (PCB).reduction_token = (cf-old_token_type) ag_ptt[(PCB).ag_ap];
2023 ag_ra();
2024 while ((PCB).exit_flag == AG_RUNNING_CODE) {
2025 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
2026 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
2027 do {
2028 unsigned ag_tx = (ag_t1 + ag_t2)/2;
2029 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
2030 else ag_t2 = ag_tx;
2031 } while (ag_t1 < ag_t2);
2032 if (ag_tstt[ag_t1] != (PCB).reduction_token) {
2033 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE;
2034 REDUCTION_TOKEN_ERROR; break;}
2035 (PCB).ag_ap = ag_pstt[ag_t1];
2036 if ((*(PCB).s_procs[ag_astt[ag_t1]])() == 0) break;
2037 }
2038 return 0;
2039 }
2040
2041 static int near ag_action_8_proc(void) {
2042 ag_undo();
2043 (PCB).la_ptr = (PCB).pointer;
2044 ag_auto_resynch();
2045 return (PCB).exit_flag == AG_RUNNING_CODE;
2046 }
2047
2048 static int near ag_action_5_proc(void) {
2049 int ag_sd = ag_fl[(PCB).ag_ap];
2050 (PCB).btsx = 0, (PCB).drt = -1;
2051 if (ag_sd) (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
2052 else {
2053 GET_CONTEXT;
2054 (PCB).ss[(PCB).ssx] = (PCB).sn;
2055 }
2056 (PCB).la_ptr = (PCB).pointer;
2057 (PCB).reduction_token = (cf-old_token_type) ag_ptt[(PCB).ag_ap];
2058 ag_ra();
2059 while ((PCB).exit_flag == AG_RUNNING_CODE) {
2060 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
2061 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
2062 do {
2063 unsigned ag_tx = (ag_t1 + ag_t2)/2;
2064 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
2065 else ag_t2 = ag_tx;
2066 } while (ag_t1 < ag_t2);
2067 if (ag_tstt[ag_t1] != (PCB).reduction_token) {
2068 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE;
2069 REDUCTION_TOKEN_ERROR; break;}
2070 (PCB).ag_ap = ag_pstt[ag_t1];
2071 if ((*(PCB).r_procs[ag_astt[ag_t1]])() == 0) break;
2072 }
2073 return (PCB).exit_flag == AG_RUNNING_CODE;
2074 }
2075
2076 static int near ag_action_6_proc(void) {
2077 int ag_sd = ag_fl[(PCB).ag_ap];
2078 (PCB).reduction_token = (cf-old_token_type) ag_ptt[(PCB).ag_ap];
2079 if ((PCB).drt == -1) {
2080 (PCB).drt=(PCB).token_number;
2081 (PCB).dssx=(PCB).ssx;
2082 (PCB).dsn=(PCB).sn;
2083 }
2084 if (ag_sd) {
2085 (PCB).sn = (PCB).ss[(PCB).ssx -= ag_sd];
2086 }
2087 else {
2088 ag_prot();
2089 (PCB).vs[(PCB).ssx] = ag_null_value;
2090 GET_CONTEXT;
2091 (PCB).ss[(PCB).ssx] = (PCB).sn;
2092 }
2093 (PCB).la_ptr = (PCB).pointer;
2094 while ((PCB).exit_flag == AG_RUNNING_CODE) {
2095 unsigned ag_t1 = ag_sbe[(PCB).sn] + 1;
2096 unsigned ag_t2 = ag_sbt[(PCB).sn+1] - 1;
2097 do {
2098 unsigned ag_tx = (ag_t1 + ag_t2)/2;
2099 if (ag_tstt[ag_tx] < (unsigned char)(PCB).reduction_token) ag_t1 = ag_tx + 1;
2100 else ag_t2 = ag_tx;
2101 } while (ag_t1 < ag_t2);
2102 if (ag_tstt[ag_t1] != (PCB).reduction_token) {
2103 (PCB).exit_flag = AG_REDUCTION_ERROR_CODE;
2104 REDUCTION_TOKEN_ERROR; break;}
2105 (PCB).ag_ap = ag_pstt[ag_t1];
2106 if ((*(PCB).r_procs[ag_astt[ag_t1]])() == 0) break;
2107 }
2108 return (PCB).exit_flag == AG_RUNNING_CODE;
2109 }
2110
2111
2112 static void near ag_check_depth(int ag_fl) {
2113 int ag_sx = (PCB).ssx - ag_fl;
2114 if ((PCB).ag_error_depth && ag_sx < (PCB).ag_tmp_depth) (PCB).ag_tmp_depth = ag_sx;
2115 }
2116
2117 static int near ag_action_3_er_proc(void) {
2118 ag_check_depth(ag_fl[(PCB).ag_ap] - 1);
2119 return ag_action_4_r_proc();
2120 }
2121
2122 static int near ag_action_2_e_proc(void) {
2123 ag_action_2_proc();
2124 (PCB).ag_min_depth = (PCB).ag_tmp_depth;
2125 return 0;
2126 }
2127
2128 static int near ag_action_4_e_proc(void) {
2129 ag_check_depth(ag_fl[(PCB).ag_ap] - 1);
2130 (PCB).ag_min_depth = (PCB).ag_tmp_depth;
2131 return ag_action_4_proc();
2132 }
2133
2134 static int near ag_action_6_e_proc(void) {
2135 ag_check_depth(ag_fl[(PCB).ag_ap]);
2136 return ag_action_6_proc();
2137 }
2138
2139 static int near ag_action_11_e_proc(void) {
2140 return ag_action_10_proc();
2141 }
2142
2143 static int (near *ag_r_procs_error[])(void) = {
2144 ag_action_1_r_proc,
2145 ag_action_2_r_proc,
2146 ag_action_3_er_proc,
2147 ag_action_3_er_proc
2148 };
2149
2150 static int (near *ag_s_procs_error[])(void) = {
2151 ag_action_1_s_proc,
2152 ag_action_2_r_proc,
2153 ag_action_3_er_proc,
2154 ag_action_3_er_proc
2155 };
2156
2157 static int (near *ag_gt_procs_error[])(void) = {
2158 ag_action_1_proc,
2159 ag_action_2_e_proc,
2160 ag_action_4_e_proc,
2161 ag_action_4_e_proc,
2162 ag_action_6_e_proc,
2163 ag_action_6_e_proc,
2164 ag_action_7_proc,
2165 ag_action_8_proc,
2166 ag_action_9_proc,
2167 ag_action_10_proc,
2168 ag_action_11_e_proc,
2169 ag_action_8_proc
2170 };
2171
2172 static void near ag_set_error_procs(void) {
2173 (PCB).gt_procs = ag_gt_procs_error;
2174 (PCB).r_procs = ag_r_procs_error;
2175 (PCB).s_procs = ag_s_procs_error;
2176 }
2177
2178
2179 void init_cf-old(void) {
2180 (PCB).la_ptr = (PCB).pointer;
2181 (PCB).gt_procs = ag_gt_procs_scan;
2182 (PCB).r_procs = ag_r_procs_scan;
2183 (PCB).s_procs = ag_s_procs_scan;
2184 (PCB).ag_error_depth = (PCB).ag_min_depth = (PCB).ag_tmp_depth = 0;
2185 (PCB).ag_resynch_active = 0;
2186 (PCB).ss[0] = (PCB).sn = (PCB).ssx = 0;
2187 (PCB).exit_flag = AG_RUNNING_CODE;
2188 (PCB).line = FIRST_LINE;
2189 (PCB).column = FIRST_COLUMN;
2190 (PCB).btsx = 0, (PCB).drt = -1;
2191 }
2192
2193 void cf-old(void) {
2194 init_cf-old();
2195 (PCB).exit_flag = AG_RUNNING_CODE;
2196 while ((PCB).exit_flag == AG_RUNNING_CODE) {
2197 unsigned ag_t1 = ag_sbt[(PCB).sn];
2198 if (ag_tstt[ag_t1]) {
2199 unsigned ag_t2 = ag_sbe[(PCB).sn] - 1;
2200 (PCB).token_number = (cf-old_token_type) AG_TCV(INPUT_CODE(*(PCB).la_ptr));
2201 (PCB).la_ptr++;
2202 if (ag_key_index[(PCB).sn]) {
2203 unsigned ag_k = ag_key_index[(PCB).sn];
2204 int ag_ch = CONVERT_CASE(INPUT_CODE(*(PCB).pointer));
2205 if (ag_ch <= 255) {
2206 while (ag_key_ch[ag_k] < ag_ch) ag_k++;
2207 if (ag_key_ch[ag_k] == ag_ch) ag_get_key_word(ag_k);
2208 }
2209 }
2210 do {
2211 unsigned ag_tx = (ag_t1 + ag_t2)/2;
2212 if (ag_tstt[ag_tx] > (unsigned char)(PCB).token_number)
2213 ag_t1 = ag_tx + 1;
2214 else ag_t2 = ag_tx;
2215 } while (ag_t1 < ag_t2);
2216 if (ag_tstt[ag_t1] != (unsigned char)(PCB).token_number)
2217 ag_t1 = ag_sbe[(PCB).sn];
2218 }
2219 (PCB).ag_ap = ag_pstt[ag_t1];
2220 (*(PCB).gt_procs[ag_astt[ag_t1]])();
2221 }
2222 }
2223
2224