/* A Bison parser, made from ./web2c.y by GNU Bison version 1.25 */ #define YYBISON 1 /* Identify Bison output. */ #define array_tok 258 #define begin_tok 259 #define case_tok 260 #define const_tok 261 #define do_tok 262 #define downto_tok 263 #define else_tok 264 #define end_tok 265 #define file_tok 266 #define for_tok 267 #define function_tok 268 #define goto_tok 269 #define if_tok 270 #define label_tok 271 #define of_tok 272 #define procedure_tok 273 #define program_tok 274 #define record_tok 275 #define repeat_tok 276 #define then_tok 277 #define to_tok 278 #define type_tok 279 #define until_tok 280 #define var_tok 281 #define while_tok 282 #define others_tok 283 #define r_num_tok 284 #define i_num_tok 285 #define string_literal_tok 286 #define single_char_tok 287 #define assign_tok 288 #define two_dots_tok 289 #define undef_id_tok 290 #define var_id_tok 291 #define proc_id_tok 292 #define proc_param_tok 293 #define fun_id_tok 294 #define fun_param_tok 295 #define const_id_tok 296 #define type_id_tok 297 #define hhb0_tok 298 #define hhb1_tok 299 #define field_id_tok 300 #define define_tok 301 #define field_tok 302 #define break_tok 303 #define not_eq_tok 304 #define less_eq_tok 305 #define great_eq_tok 306 #define or_tok 307 #define unary_plus_tok 308 #define unary_minus_tok 309 #define div_tok 310 #define mod_tok 311 #define and_tok 312 #define not_tok 313 #line 24 "./web2c.y" #include "web2c.h" #define YYDEBUG 1 #define symbol(x) sym_table[x].id #define MAX_ARGS 50 static char fn_return_type[50], for_stack[300], control_var[50], relation[3]; static char arg_type[MAX_ARGS][30]; static int last_type = -1, ids_typed; char my_routine[100]; /* Name of routine being parsed, if any */ static char array_bounds[80], array_offset[80]; static int uses_mem, uses_eqtb, lower_sym, upper_sym; static FILE *orig_std; boolean doing_statements = false; static boolean var_formals = false; static int param_id_list[MAX_ARGS], ids_paramed=0; extern char conditional[], temp[], *std_header; extern int tex, mf, strict_for; extern FILE *coerce; extern char coerce_name[]; extern string program_name; extern boolean debug; static long my_labs P1H(long); static void compute_array_bounds P1H(void); static void fixup_var_list P1H(void); static void do_proc_args P1H(void); static void gen_function_head P1H(void); static boolean doreturn P1H(string); #ifndef YYSTYPE #define YYSTYPE int #endif #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define YYFINAL 481 #define YYFLAG -32768 #define YYNTBASE 75 #define YYTRANSLATE(x) ((unsigned)(x) <= 313 ? yytranslate[x] : 261) static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 67, 68, 60, 55, 69, 56, 74, 61, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 73, 66, 51, 49, 52, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 71, 2, 72, 70, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 50, 53, 54, 57, 58, 59, 62, 63, 64, 65 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 1, 2, 13, 14, 17, 22, 27, 32, 39, 44, 51, 56, 63, 68, 73, 77, 78, 80, 84, 86, 88, 89, 90, 91, 100, 101, 102, 107, 109, 113, 115, 116, 119, 121, 124, 125, 126, 127, 128, 137, 139, 141, 143, 145, 148, 149, 154, 155, 160, 161, 166, 167, 172, 173, 178, 179, 184, 185, 190, 191, 196, 197, 202, 203, 208, 209, 214, 215, 220, 221, 226, 227, 232, 234, 235, 240, 242, 244, 246, 248, 249, 252, 254, 257, 258, 259, 260, 268, 270, 272, 274, 276, 280, 281, 283, 286, 288, 290, 292, 294, 296, 298, 300, 302, 305, 312, 321, 323, 325, 327, 328, 333, 335, 339, 340, 341, 347, 348, 350, 354, 356, 358, 359, 364, 365, 368, 370, 373, 374, 375, 382, 384, 388, 390, 392, 394, 395, 396, 402, 404, 407, 410, 413, 416, 417, 423, 424, 430, 431, 432, 437, 439, 443, 444, 449, 450, 453, 454, 458, 460, 462, 465, 466, 467, 468, 478, 479, 480, 481, 491, 493, 495, 497, 501, 502, 507, 509, 513, 515, 519, 521, 523, 525, 527, 529, 531, 533, 535, 536, 541, 542, 547, 548, 552, 554, 556, 558, 560, 563, 564, 569, 572, 575, 578, 580, 581, 586, 589, 590, 595, 596, 601, 602, 607, 608, 613, 614, 619, 620, 625, 626, 631, 632, 637, 638, 643, 644, 649, 650, 655, 656, 661, 662, 667, 668, 673, 675, 677, 679, 681, 682, 687, 689, 691, 693, 694, 698, 699, 704, 706, 707, 712, 715, 717, 720, 721, 723, 725, 726, 730, 733, 734, 736, 738, 740, 742, 744, 746, 749, 750, 751, 758, 759, 763, 764, 765, 773, 775, 779, 783, 785, 789, 791, 793, 795, 798, 800, 802, 804, 805, 806, 813, 814, 815, 822, 823, 824, 825, 835, 837, 838, 839, 845, 846, 847 }; static const short yyrhs[] = { -1, 0, 78, 80, 76, 88, 92, 119, 146, 77, 155, 153, 0, 0, 78, 79, 0, 46, 47, 35, 66, 0, 46, 13, 35, 66, 0, 46, 6, 35, 66, 0, 46, 13, 35, 67, 68, 66, 0, 46, 18, 35, 66, 0, 46, 18, 35, 67, 68, 66, 0, 46, 24, 35, 66, 0, 46, 24, 35, 49, 127, 66, 0, 46, 26, 35, 66, 0, 19, 35, 81, 66, 0, 67, 82, 68, 0, 0, 83, 0, 82, 69, 83, 0, 41, 0, 35, 0, 0, 0, 0, 85, 88, 92, 119, 86, 146, 87, 180, 0, 0, 0, 16, 89, 90, 66, 0, 91, 0, 90, 69, 91, 0, 30, 0, 0, 6, 93, 0, 94, 0, 93, 94, 0, 0, 0, 0, 0, 95, 35, 96, 49, 97, 100, 98, 66, 0, 30, 0, 29, 0, 117, 0, 118, 0, 214, 100, 0, 0, 100, 55, 101, 100, 0, 0, 100, 56, 102, 100, 0, 0, 100, 60, 103, 100, 0, 0, 100, 62, 104, 100, 0, 0, 100, 49, 105, 100, 0, 0, 100, 50, 106, 100, 0, 0, 100, 63, 107, 100, 0, 0, 100, 51, 108, 100, 0, 0, 100, 52, 109, 100, 0, 0, 100, 53, 110, 100, 0, 0, 100, 54, 111, 100, 0, 0, 100, 64, 112, 100, 0, 0, 100, 57, 113, 100, 0, 0, 100, 61, 114, 100, 0, 115, 0, 0, 67, 116, 100, 68, 0, 99, 0, 31, 0, 32, 0, 41, 0, 0, 24, 120, 0, 121, 0, 120, 121, 0, 0, 0, 0, 122, 35, 123, 49, 124, 125, 66, 0, 126, 0, 131, 0, 127, 0, 130, 0, 129, 34, 129, 0, 0, 58, 0, 128, 30, 0, 41, 0, 36, 0, 35, 0, 42, 0, 133, 0, 136, 0, 144, 0, 132, 0, 70, 42, 0, 3, 71, 134, 72, 17, 135, 0, 3, 71, 134, 69, 134, 72, 17, 135, 0, 127, 0, 42, 0, 125, 0, 0, 20, 137, 138, 10, 0, 139, 0, 138, 66, 139, 0, 0, 0, 140, 142, 73, 141, 125, 0, 0, 143, 0, 142, 69, 143, 0, 35, 0, 45, 0, 0, 11, 17, 145, 125, 0, 0, 26, 147, 0, 148, 0, 147, 148, 0, 0, 0, 149, 151, 73, 150, 125, 66, 0, 152, 0, 151, 69, 152, 0, 35, 0, 36, 0, 45, 0, 0, 0, 4, 154, 183, 10, 74, 0, 156, 0, 155, 156, 0, 157, 66, 0, 170, 66, 0, 158, 84, 0, 0, 18, 35, 159, 161, 66, 0, 0, 18, 169, 160, 161, 66, 0, 0, 0, 67, 162, 163, 68, 0, 166, 0, 163, 66, 166, 0, 0, 165, 151, 73, 42, 0, 0, 167, 164, 0, 0, 26, 168, 164, 0, 37, 0, 38, 0, 171, 84, 0, 0, 0, 0, 13, 35, 172, 161, 73, 173, 179, 174, 66, 0, 0, 0, 0, 13, 178, 175, 161, 73, 176, 179, 177, 66, 0, 39, 0, 40, 0, 125, 0, 4, 183, 10, 0, 0, 4, 182, 183, 10, 0, 184, 0, 183, 66, 184, 0, 186, 0, 185, 73, 186, 0, 30, 0, 187, 0, 228, 0, 188, 0, 224, 0, 226, 0, 227, 0, 48, 0, 0, 191, 33, 189, 199, 0, 0, 193, 33, 190, 199, 0, 0, 36, 192, 194, 0, 36, 0, 39, 0, 40, 0, 195, 0, 194, 195, 0, 0, 71, 196, 199, 197, 0, 74, 45, 0, 74, 43, 0, 74, 44, 0, 72, 0, 0, 69, 198, 199, 72, 0, 214, 199, 0, 0, 199, 55, 200, 199, 0, 0, 199, 56, 201, 199, 0, 0, 199, 60, 202, 199, 0, 0, 199, 62, 203, 199, 0, 0, 199, 49, 204, 199, 0, 0, 199, 50, 205, 199, 0, 0, 199, 63, 206, 199, 0, 0, 199, 51, 207, 199, 0, 0, 199, 52, 208, 199, 0, 0, 199, 53, 209, 199, 0, 0, 199, 54, 210, 199, 0, 0, 199, 64, 211, 199, 0, 0, 199, 57, 212, 199, 0, 0, 199, 61, 213, 199, 0, 215, 0, 58, 0, 59, 0, 65, 0, 0, 67, 216, 199, 68, 0, 191, 0, 99, 0, 39, 0, 0, 40, 217, 218, 0, 0, 67, 219, 220, 68, 0, 222, 0, 0, 220, 69, 221, 222, 0, 199, 223, 0, 42, 0, 73, 30, 0, 0, 37, 0, 35, 0, 0, 38, 225, 218, 0, 14, 30, 0, 0, 181, 0, 229, 0, 244, 0, 230, 0, 236, 0, 231, 0, 231, 234, 0, 0, 0, 15, 232, 199, 233, 22, 184, 0, 0, 9, 235, 184, 0, 0, 0, 5, 237, 199, 17, 238, 239, 243, 0, 240, 0, 239, 66, 240, 0, 241, 73, 186, 0, 242, 0, 241, 69, 242, 0, 30, 0, 28, 0, 10, 0, 66, 10, 0, 245, 0, 248, 0, 251, 0, 0, 0, 27, 246, 199, 247, 7, 184, 0, 0, 0, 21, 249, 183, 25, 250, 199, 0, 0, 0, 0, 12, 252, 255, 33, 253, 256, 7, 254, 184, 0, 36, 0, 0, 0, 199, 257, 23, 258, 199, 0, 0, 0, 199, 259, 8, 260, 199, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, 62, 70, 74, 79, 81, 83, 89, 94, 99, 104, 109, 114, 119, 128, 136, 139, 141, 144, 146, 149, 151, 154, 159, 174, 176, 204, 205, 207, 211, 212, 215, 219, 221, 225, 227, 230, 239, 243, 244, 245, 248, 257, 258, 259, 262, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 296, 299, 301, 304, 321, 339, 343, 344, 347, 348, 351, 354, 361, 365, 377, 379, 382, 419, 422, 426, 428, 431, 439, 446, 455, 466, 480, 485, 486, 490, 496, 511, 513, 516, 519, 529, 531, 534, 538, 539, 542, 544, 550, 563, 566, 567, 570, 582, 594, 598, 601, 603, 606, 608, 611, 619, 624, 628, 629, 632, 646, 660, 676, 678, 683, 690, 692, 695, 697, 701, 704, 717, 721, 729, 736, 743, 752, 755, 756, 759, 761, 776, 777, 777, 778, 780, 782, 785, 787, 799, 806, 812, 812, 822, 828, 833, 835, 836, 839, 842, 845, 847, 851, 852, 855, 856, 860, 868, 870, 874, 875, 876, 877, 878, 882, 885, 885, 888, 890, 901, 901, 907, 909, 913, 914, 917, 919, 921, 939, 941, 945, 946, 948, 951, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979, 982, 983, 987, 989, 991, 995, 998, 1000, 1001, 1002, 1004, 1007, 1009, 1011, 1014, 1016, 1018, 1020, 1022, 1026, 1028, 1031, 1033, 1039, 1042, 1044, 1058, 1061, 1062, 1063, 1066, 1067, 1070, 1071, 1074, 1077, 1078, 1081, 1084, 1086, 1088, 1092, 1096, 1097, 1100, 1104, 1105, 1108, 1113, 1117, 1118, 1121, 1122, 1123, 1126, 1131, 1132, 1135, 1137, 1142, 1145, 1154, 1160, 1178, 1195, 1199, 1202, 1207, 1211, 1214, 1219 }; #endif #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","array_tok", "begin_tok","case_tok","const_tok","do_tok","downto_tok","else_tok","end_tok", "file_tok","for_tok","function_tok","goto_tok","if_tok","label_tok","of_tok", "procedure_tok","program_tok","record_tok","repeat_tok","then_tok","to_tok", "type_tok","until_tok","var_tok","while_tok","others_tok","r_num_tok","i_num_tok", "string_literal_tok","single_char_tok","assign_tok","two_dots_tok","undef_id_tok", "var_id_tok","proc_id_tok","proc_param_tok","fun_id_tok","fun_param_tok","const_id_tok", "type_id_tok","hhb0_tok","hhb1_tok","field_id_tok","define_tok","field_tok", "break_tok","'='","not_eq_tok","'<'","'>'","less_eq_tok","great_eq_tok","'+'", "'-'","or_tok","unary_plus_tok","unary_minus_tok","'*'","'/'","div_tok","mod_tok", "and_tok","not_tok","';'","'('","')'","','","'^'","'['","']'","':'","'.'","PROGRAM", "@1","@2","DEFS","DEF","PROGRAM_HEAD","PROGRAM_FILE_PART","PROGRAM_FILE_LIST", "PROGRAM_FILE","BLOCK","@3","@4","@5","LABEL_DEC_PART","@6","LABEL_LIST","LABEL", "CONST_DEC_PART","CONST_DEC_LIST","CONST_DEC","@7","@8","@9","@10","CONSTANT", "CONSTANT_EXPRESS","@11","@12","@13","@14","@15","@16","@17","@18","@19","@20", "@21","@22","@23","@24","CONST_FACTOR","@25","STRING","CONSTANT_ID","TYPE_DEC_PART", "TYPE_DEF_LIST","TYPE_DEF","@26","@27","@28","TYPE","SIMPLE_TYPE","SUBRANGE_TYPE", "POSSIBLE_PLUS","SUBRANGE_CONSTANT","TYPE_ID","STRUCTURED_TYPE","POINTER_TYPE", "ARRAY_TYPE","INDEX_TYPE","COMPONENT_TYPE","RECORD_TYPE","@29","FIELD_LIST", "RECORD_SECTION","@30","@31","FIELD_ID_LIST","FIELD_ID","FILE_TYPE","@32","VAR_DEC_PART", "VAR_DEC_LIST","VAR_DEC","@33","@34","VAR_ID_DEC_LIST","VAR_ID","BODY","@35", "P_F_DEC_PART","P_F_DEC","PROCEDURE_DEC","PROCEDURE_HEAD","@36","@37","PARAM", "@38","FORM_PAR_SEC_L","FORM_PAR_SEC1","@39","FORM_PAR_SEC","@40","@41","DECLARED_PROC", "FUNCTION_DEC","FUNCTION_HEAD","@42","@43","@44","@45","@46","@47","DECLARED_FUN", "RESULT_TYPE","STAT_PART","COMPOUND_STAT","@48","STAT_LIST","STATEMENT","S_LABEL", "UNLAB_STAT","SIMPLE_STAT","ASSIGN_STAT","@49","@50","VARIABLE","@51","FUNC_ID_AS", "VAR_DESIG_LIST","VAR_DESIG","@52","VAR_DESIG1","@53","EXPRESS","@54","@55", "@56","@57","@58","@59","@60","@61","@62","@63","@64","@65","@66","@67","UNARY_OP", "FACTOR","@68","@69","PARAM_LIST","@70","ACTUAL_PARAM_L","@71","ACTUAL_PARAM", "WIDTH_FIELD","PROC_STAT","@72","GO_TO_STAT","EMPTY_STAT","STRUCT_STAT","CONDIT_STAT", "IF_STATEMENT","BEGIN_IF_STAT","@73","@74","ELSE_STAT","@75","CASE_STATEMENT", "@76","@77","CASE_EL_LIST","CASE_ELEMENT","CASE_LAB_LIST","CASE_LAB","END_CASE", "REPETIT_STAT","WHILE_STATEMENT","@78","@79","REP_STATEMENT","@80","@81","FOR_STATEMENT", "@82","@83","@84","CONTROL_VAR","FOR_LIST","@85","@86","@87","@88", NULL }; #endif static const short yyr1[] = { 0, 76, 77, 75, 78, 78, 79, 79, 79, 79, 79, 79, 79, 79, 79, 80, 81, 81, 82, 82, 83, 83, 85, 86, 87, 84, 88, 89, 88, 90, 90, 91, 92, 92, 93, 93, 95, 96, 97, 98, 94, 99, 99, 99, 99, 100, 101, 100, 102, 100, 103, 100, 104, 100, 105, 100, 106, 100, 107, 100, 108, 100, 109, 100, 110, 100, 111, 100, 112, 100, 113, 100, 114, 100, 100, 116, 115, 115, 117, 117, 118, 119, 119, 120, 120, 122, 123, 124, 121, 125, 125, 126, 126, 127, 128, 128, 129, 129, 129, 129, 130, 131, 131, 131, 131, 132, 133, 133, 134, 134, 135, 137, 136, 138, 138, 140, 141, 139, 139, 142, 142, 143, 143, 145, 144, 146, 146, 147, 147, 149, 150, 148, 151, 151, 152, 152, 152, 153, 154, 153, 155, 155, 156, 156, 157, 159, 158, 160, 158, 161, 162, 161, 163, 163, 165, 164, 167, 166, 168, 166, 169, 169, 170, 172, 173, 174, 171, 175, 176, 177, 171, 178, 178, 179, 180, 182, 181, 183, 183, 184, 184, 185, 186, 186, 187, 187, 187, 187, 187, 189, 188, 190, 188, 192, 191, 191, 193, 193, 194, 194, 196, 195, 195, 195, 195, 197, 198, 197, 199, 200, 199, 201, 199, 202, 199, 203, 199, 204, 199, 205, 199, 206, 199, 207, 199, 208, 199, 209, 199, 210, 199, 211, 199, 212, 199, 213, 199, 199, 214, 214, 214, 216, 215, 215, 215, 215, 217, 215, 219, 218, 220, 221, 220, 222, 222, 223, 223, 224, 224, 225, 224, 226, 227, 228, 228, 228, 229, 229, 230, 230, 232, 233, 231, 235, 234, 237, 238, 236, 239, 239, 240, 241, 241, 242, 242, 243, 243, 244, 244, 244, 246, 247, 245, 249, 250, 248, 252, 253, 254, 251, 255, 257, 258, 256, 259, 260, 256 }; static const short yyr2[] = { 0, 0, 0, 10, 0, 2, 4, 4, 4, 6, 4, 6, 4, 6, 4, 4, 3, 0, 1, 3, 1, 1, 0, 0, 0, 8, 0, 0, 4, 1, 3, 1, 0, 2, 1, 2, 0, 0, 0, 0, 8, 1, 1, 1, 1, 2, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 1, 0, 4, 1, 1, 1, 1, 0, 2, 1, 2, 0, 0, 0, 7, 1, 1, 1, 1, 3, 0, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 6, 8, 1, 1, 1, 0, 4, 1, 3, 0, 0, 5, 0, 1, 3, 1, 1, 0, 4, 0, 2, 1, 2, 0, 0, 6, 1, 3, 1, 1, 1, 0, 0, 5, 1, 2, 2, 2, 2, 0, 5, 0, 5, 0, 0, 4, 1, 3, 0, 4, 0, 2, 0, 3, 1, 1, 2, 0, 0, 0, 9, 0, 0, 0, 9, 1, 1, 1, 3, 0, 4, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 0, 4, 0, 4, 0, 3, 1, 1, 1, 1, 2, 0, 4, 2, 2, 2, 1, 0, 4, 2, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 0, 4, 1, 1, 1, 1, 0, 4, 1, 1, 1, 0, 3, 0, 4, 1, 0, 4, 2, 1, 2, 0, 1, 1, 0, 3, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 0, 6, 0, 3, 0, 0, 7, 1, 3, 3, 1, 3, 1, 1, 1, 2, 1, 1, 1, 0, 0, 6, 0, 0, 6, 0, 0, 0, 9, 1, 0, 0, 5, 0, 0, 5 }; static const short yydefact[] = { 4, 0, 0, 0, 5, 1, 17, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 27, 32, 21, 20, 0, 18, 15, 8, 7, 0, 10, 0, 94, 12, 14, 6, 0, 36, 81, 16, 0, 0, 0, 99, 98, 97, 95, 0, 0, 0, 31, 0, 29, 33, 34, 0, 85, 125, 19, 9, 11, 13, 96, 94, 28, 0, 35, 37, 82, 83, 0, 129, 2, 93, 30, 0, 84, 86, 126, 127, 0, 0, 38, 0, 128, 134, 135, 136, 0, 132, 0, 0, 137, 140, 0, 22, 0, 22, 0, 87, 0, 130, 163, 171, 172, 167, 145, 160, 161, 147, 138, 3, 141, 142, 144, 26, 143, 162, 42, 41, 78, 79, 80, 238, 239, 240, 75, 77, 39, 74, 43, 44, 0, 94, 133, 94, 149, 149, 149, 149, 262, 32, 0, 54, 56, 60, 62, 64, 66, 46, 48, 70, 50, 72, 52, 58, 68, 0, 45, 0, 0, 111, 100, 0, 0, 89, 91, 92, 90, 104, 101, 102, 103, 0, 150, 0, 0, 0, 0, 175, 275, 296, 0, 270, 293, 290, 181, 258, 195, 257, 259, 196, 197, 188, 263, 0, 177, 0, 179, 182, 184, 0, 0, 185, 186, 187, 183, 264, 266, 268, 267, 265, 287, 288, 289, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 40, 94, 123, 115, 105, 88, 131, 156, 164, 168, 146, 148, 262, 0, 0, 261, 0, 262, 0, 0, 0, 0, 262, 262, 189, 191, 273, 269, 23, 76, 55, 57, 61, 63, 65, 67, 47, 49, 71, 51, 73, 53, 59, 69, 109, 108, 0, 94, 0, 113, 0, 158, 0, 152, 154, 94, 94, 0, 245, 246, 241, 244, 243, 0, 0, 237, 300, 0, 271, 0, 291, 200, 0, 194, 198, 248, 260, 139, 178, 180, 0, 0, 262, 125, 94, 0, 124, 112, 115, 121, 122, 0, 119, 154, 156, 151, 157, 0, 173, 165, 169, 176, 0, 0, 276, 217, 219, 223, 225, 227, 229, 209, 211, 233, 213, 235, 215, 221, 231, 208, 297, 0, 294, 0, 0, 203, 204, 202, 199, 0, 190, 192, 274, 24, 0, 94, 114, 0, 116, 159, 153, 0, 0, 0, 247, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 262, 0, 262, 0, 254, 256, 0, 250, 0, 0, 110, 106, 120, 94, 0, 166, 170, 242, 284, 283, 0, 278, 0, 281, 218, 220, 224, 226, 228, 230, 210, 212, 234, 214, 236, 216, 222, 232, 301, 0, 272, 295, 292, 206, 205, 201, 0, 253, 249, 251, 262, 25, 94, 117, 155, 285, 0, 277, 0, 262, 0, 0, 298, 0, 255, 0, 0, 107, 286, 279, 282, 280, 302, 305, 262, 0, 252, 174, 0, 0, 299, 207, 303, 306, 0, 0, 0 }; static const short yydefgoto[] = { 479, 13, 83, 1, 4, 5, 15, 26, 27, 116, 117, 316, 403, 23, 38, 53, 54, 40, 55, 56, 57, 77, 100, 159, 294, 130, 225, 226, 228, 230, 219, 220, 231, 221, 222, 223, 224, 232, 227, 229, 131, 144, 132, 133, 59, 70, 71, 72, 85, 135, 331, 167, 168, 50, 51, 169, 170, 171, 172, 279, 406, 173, 236, 281, 282, 283, 408, 324, 325, 174, 280, 74, 80, 81, 82, 137, 90, 91, 113, 142, 94, 95, 96, 97, 140, 141, 177, 240, 285, 329, 330, 286, 287, 326, 111, 98, 99, 138, 288, 375, 139, 289, 376, 107, 332, 446, 196, 245, 197, 198, 199, 200, 201, 202, 313, 314, 295, 252, 204, 306, 307, 357, 440, 458, 400, 386, 387, 389, 391, 380, 381, 392, 382, 383, 384, 385, 393, 388, 390, 297, 298, 336, 335, 309, 362, 401, 460, 402, 442, 205, 253, 206, 207, 208, 209, 210, 211, 249, 354, 260, 315, 212, 246, 379, 415, 416, 417, 418, 452, 213, 214, 251, 356, 215, 250, 396, 216, 247, 394, 469, 300, 434, 455, 473, 456, 474 }; static const short yypact[] = {-32768, 4, -14, 9,-32768,-32768, -41, -3, 28, 41, 48, 63, 72, 23, 49, 97, 128, 57, 164, -20, 132, 139,-32768, 222,-32768,-32768, 179,-32768,-32768,-32768,-32768, 167,-32768, 170, 38,-32768,-32768,-32768, 202,-32768, 216, -32768, 49, 180, 186,-32768,-32768,-32768,-32768, 188, 214, 217,-32768, 122,-32768, 230,-32768, 231,-32768, 246,-32768, -32768,-32768,-32768,-32768, 38,-32768, 202,-32768,-32768, 238, -32768, 240,-32768,-32768,-32768,-32768, 227,-32768,-32768, -5, -32768, 25, 84,-32768, 228,-32768,-32768,-32768,-32768, 36, -32768, 53, 131, 73,-32768, 212,-32768, 213,-32768, 13, -32768, 25,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, 23,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 482, -32768,-32768,-32768, 13, 17,-32768, 17, 215, 215, 215, 215, 337, 222, 13,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 218,-32768, 209, 264,-32768,-32768, 241, 235,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 236,-32768, 232, 233, 242, 243, -32768,-32768,-32768, 274,-32768,-32768,-32768,-32768,-32768, 121, -32768,-32768,-32768,-32768,-32768,-32768, -4,-32768, 234,-32768, -32768,-32768, 277, 278,-32768,-32768,-32768,-32768,-32768,-32768, 305,-32768,-32768,-32768,-32768,-32768, 216, 442, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,-32768, 59,-32768, -2,-32768,-32768,-32768, 289, -32768,-32768,-32768,-32768, 337, 178, 280,-32768, 178, 337, 178, 142, 250, 244, 337, 185,-32768,-32768,-32768,-32768, -32768,-32768, 498, 498, 498, 498, 498, 498, 58, 58, 58,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 124, 17, 0,-32768, -11,-32768, 79,-32768,-32768, 17, 17, 1, -32768,-32768,-32768,-32768,-32768, 283, 178,-32768,-32768, 286, 514, -9, 514,-32768, 127, 142,-32768,-32768,-32768,-32768, -32768,-32768, 178, 178, 337, 246, 59, 303,-32768,-32768, -2,-32768,-32768, 37,-32768,-32768, 289,-32768,-32768, 25, -32768,-32768,-32768,-32768, 250, 178,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 299,-32768, 315, 178,-32768,-32768,-32768, -32768, 350, 514, 514,-32768,-32768, 251, 17,-32768, -11, -32768,-32768,-32768, 42, 258, 259,-32768, 462, 199, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 337, 178, 337, 394,-32768, 369, 181,-32768, 322, 311,-32768,-32768,-32768, 17, 287,-32768, -32768,-32768,-32768,-32768, 2,-32768, 43,-32768, 530, 530, 530, 530, 530, 530, 80, 80, 80,-32768,-32768,-32768, -32768,-32768, 207, 323,-32768, 514,-32768,-32768,-32768,-32768, 301,-32768,-32768,-32768, 337,-32768, 17,-32768,-32768,-32768, 8,-32768, 199, 185, 325, 342,-32768, 178,-32768, 350, 3,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 337, 418, -32768,-32768, 178, 178,-32768,-32768, 514, 514, 353, 354, -32768 }; static const short yypgoto[] = {-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768, 313, 257,-32768, -32768,-32768, 245,-32768,-32768, 290, 220,-32768, 304,-32768, -32768,-32768,-32768, -93, 67,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 143,-32768, 291,-32768,-32768,-32768, -134, -32768, -32,-32768, 300,-32768,-32768,-32768,-32768, 51, -81, -32768,-32768,-32768, 50,-32768,-32768,-32768, -1,-32768,-32768, 54,-32768, 298,-32768,-32768, 64, 281,-32768,-32768,-32768, 293,-32768,-32768,-32768,-32768, -92,-32768,-32768, 62,-32768, 66,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 95,-32768,-32768,-32768, -241, -230,-32768, -251,-32768,-32768,-32768,-32768, -142,-32768,-32768,-32768, 89, -32768,-32768,-32768, -232,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -45,-32768, -32768,-32768, 61,-32768,-32768,-32768, -63,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, -53,-32768, -54,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768 }; #define YYLAST 594 static const short yytable[] = { 203, 166, 49, 175, 290, 312, 254, 129, -118, 302, 320, 334, 450, 472, 296, 7, 355, 301, 463, 303, 161, 6, 8, 2, 322, 311, 14, 9, 162, 34, -129, -129, 16, 10, 323, 11, 413, 163, 414, 22, -129, 129, 120, 121, 122, 123, 35, 178, 179, 180, 3, 129, 45, 46, 124, 134, 12, 255, 47, 164, 87, 88, 255, 17, -118, 352, 321, 255, 451, 255, 89, 125, 126, 45, 46, 48, 18, 112, 127, 47, 128, 363, 364, 19, 24, 365, 92, 165, 104, 134, 25, 93, 105, 106, 45, 46, 48, 92, 20, 134, 47, 277, 93, 203, 378, 102, 370, 21, 203, 103, 371, 102, 453, 203, 203, 409, 454, 48, 154, 155, 156, 157, 158, 30, 31, 398, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 129, 347, 348, 349, 350, 351, 327, 319, 328, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 28, 436, 435, 108, 437, 109, 110, 358, 359, 360, 203, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 134, 66, 181, 182, 67, -193, 317, 29, -193, 318, 183, 36, 184, 185, 160, 278, 466, 461, 37, 186, 120, 121, 122, 123, 218, 187, 304, 190, -304, 305, 291, 292, 124, 189, 190, 191, 192, 193, 194, 470, 413, 39, 414, 32, 33, 52, 195, 405, 43, 125, 126, 44, 475, 58, 477, 478, 127, 64, 293, 61, 41, 42, 443, 444, 65, 62, 203, 63, 203, 338, 339, 340, 341, 342, 343, 344, 345, 346, -36, 69, 347, 348, 349, 350, 351, 73, -85, 448, 79, 84, 101, 115, 118, 234, 235, 176, 237, 233, 278, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 337, 238, 239, 203, 248, 241, 242, 256, 243, 244, 257, 258, 203, 405, 259, 284, 299, 308, 310, 353, 368, 395, 397, 404, 410, 411, 445, 203, 447, 449, 457, 459, 338, 339, 340, 341, 342, 343, 344, 345, 346, 181, 182, 347, 348, 349, 350, 351, 467, 183, 468, 184, 185, 480, 481, 60, 119, 76, 186, 68, 261, 78, 143, 217, 187, 75, 462, 188, 367, 407, 366, 369, 189, 190, 191, 192, 193, 194, 86, 120, 121, 122, 123, 136, 333, 195, 190, 114, 372, 291, 292, 124, 399, 373, 374, 361, 377, 471, 464, 465, 0, 0, 0, 0, 0, 0, 0, 0, 125, 126, 0, 0, 0, 0, 0, 127, 0, 293, 338, 339, 340, 341, 342, 343, 344, 345, 346, 0, 0, 347, 348, 349, 350, 351, 0, 0, 0, 0, 0, 0, 0, 0, 441, 338, 339, 340, 341, 342, 343, 344, 345, 346, 0, 0, 347, 348, 349, 350, 351, 0, 0, 0, 0, 438, 0, 0, 439, 338, 339, 340, 341, 342, 343, 344, 345, 346, 0, 0, 347, 348, 349, 350, 351, 0, 0, 0, 0, 0, 0, 0, 476, 145, 146, 147, 148, 149, 150, 151, 152, 153, 0, 0, 154, 155, 156, 157, 158, 0, 0, 0, 262, 338, 339, 340, 341, 342, 343, 344, 345, 346, 0, 0, 347, 348, 349, 350, 351, 0, 0, 0, 412, 145, 146, 147, 148, 149, 150, 151, 152, 153, 0, 0, 154, 155, 156, 157, 158,-32768,-32768,-32768,-32768, -32768,-32768, 151, 152, 153, 0, 0, 154, 155, 156, 157, 158, 338, 339, 340, 341, 342, 343, 344, 345, 346, 0, 0, 347, 348, 349, 350, 351,-32768,-32768, -32768,-32768,-32768,-32768, 344, 345, 346, 0, 0, 347, 348, 349, 350, 351 }; static const short yycheck[] = { 142, 135, 34, 137, 245, 256, 10, 100, 10, 250, 10, 10, 10, 10, 246, 6, 25, 249, 10, 251, 3, 35, 13, 19, 35, 255, 67, 18, 11, 49, 35, 36, 35, 24, 45, 26, 28, 20, 30, 16, 45, 134, 29, 30, 31, 32, 66, 139, 140, 141, 46, 144, 35, 36, 41, 100, 47, 66, 41, 42, 35, 36, 66, 35, 66, 297, 66, 66, 66, 66, 45, 58, 59, 35, 36, 58, 35, 4, 65, 41, 67, 313, 314, 35, 35, 315, 13, 70, 35, 134, 41, 18, 39, 40, 35, 36, 58, 13, 35, 144, 41, 42, 18, 245, 336, 69, 69, 35, 250, 73, 73, 69, 69, 255, 256, 73, 73, 58, 60, 61, 62, 63, 64, 66, 67, 357, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 60, 61, 62, 63, 64, 66, 280, 68, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 66, 396, 395, 35, 397, 37, 38, 43, 44, 45, 315, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 66, 4, 5, 69, 71, 69, 66, 74, 72, 12, 66, 14, 15, 134, 234, 454, 445, 66, 21, 29, 30, 31, 32, 144, 27, 71, 36, 8, 74, 39, 40, 41, 35, 36, 37, 38, 39, 40, 458, 28, 6, 30, 66, 67, 30, 48, 368, 68, 58, 59, 68, 469, 24, 473, 474, 65, 30, 67, 66, 68, 69, 68, 69, 34, 66, 395, 66, 397, 49, 50, 51, 52, 53, 54, 55, 56, 57, 35, 35, 60, 61, 62, 63, 64, 26, 35, 408, 35, 49, 49, 66, 66, 71, 17, 67, 42, 66, 317, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 17, 66, 66, 445, 30, 73, 73, 73, 66, 66, 33, 33, 454, 447, 9, 26, 36, 67, 74, 33, 17, 22, 7, 72, 66, 66, 4, 469, 17, 42, 7, 30, 49, 50, 51, 52, 53, 54, 55, 56, 57, 4, 5, 60, 61, 62, 63, 64, 23, 12, 8, 14, 15, 0, 0, 42, 99, 67, 21, 55, 217, 70, 117, 143, 27, 65, 447, 30, 317, 370, 316, 321, 35, 36, 37, 38, 39, 40, 80, 29, 30, 31, 32, 102, 289, 48, 36, 94, 326, 39, 40, 41, 42, 327, 330, 306, 335, 460, 451, 453, -1, -1, -1, -1, -1, -1, -1, -1, 58, 59, -1, -1, -1, -1, -1, 65, -1, 67, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, -1, 73, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, -1, 69, -1, -1, 72, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, -1, -1, -1, -1, 72, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, 68, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64, -1, -1, -1, 68, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64, 49, 50, 51, 52, 53, 54, 55, 56, 57, -1, -1, 60, 61, 62, 63, 64 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ #line 3 "/usr/share/bison.simple" /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ #ifndef alloca #ifdef __GNUC__ #define alloca __builtin_alloca #else /* not GNU C. */ #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) #include #else /* not sparc */ #if defined (MSDOS) && !defined (__TURBOC__) #include #else /* not MSDOS, or __TURBOC__ */ #if defined(_AIX) #include #pragma alloca #else /* not MSDOS, __TURBOC__, or _AIX */ #ifdef __hpux #ifdef __cplusplus extern "C" { void *alloca (unsigned int); }; #else /* not __cplusplus */ void *alloca (); #endif /* not __cplusplus */ #endif /* __hpux */ #endif /* not _AIX */ #endif /* not MSDOS, or __TURBOC__ */ #endif /* not sparc. */ #endif /* not GNU C. */ #endif /* alloca not defined. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* Note: there must be only one dollar sign in this file. It is replaced by the list of actions, each action as one case of the switch. */ #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT return(0) #define YYABORT return(1) #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(token, value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { yychar = (token), yylval = (value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { yyerror ("syntax error: cannot back up"); YYERROR; } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 #ifndef YYPURE #define YYLEX yylex() #endif #ifdef YYPURE #ifdef YYLSP_NEEDED #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) #else #define YYLEX yylex(&yylval, &yylloc) #endif #else /* not YYLSP_NEEDED */ #ifdef YYLEX_PARAM #define YYLEX yylex(&yylval, YYLEX_PARAM) #else #define YYLEX yylex(&yylval) #endif #endif /* not YYLSP_NEEDED */ #endif /* If nonreentrant, generate the variables here */ #ifndef YYPURE int yychar; /* the lookahead symbol */ YYSTYPE yylval; /* the semantic value of the */ /* lookahead symbol */ #ifdef YYLSP_NEEDED YYLTYPE yylloc; /* location data for the lookahead */ /* symbol */ #endif int yynerrs; /* number of parse errors so far */ #endif /* not YYPURE */ #if YYDEBUG != 0 int yydebug; /* nonzero means print parse trace */ /* Since this is uninitialized, it does not stop multiple parsers from coexisting. */ #endif /* YYINITDEPTH indicates the initial size of the parser's stacks */ #ifndef YYINITDEPTH #define YYINITDEPTH 200 #endif /* YYMAXDEPTH is the maximum size the stacks can grow to (effective only if the built-in stack extension method is used). */ #if YYMAXDEPTH == 0 #undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH #define YYMAXDEPTH 10000 #endif /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ int yyparse (void); #endif #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) #else /* not GNU C or C++ */ #ifndef __cplusplus /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (to, from, count) char *to; char *from; int count; { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #else /* __cplusplus */ /* This is the most reliable way to avoid incompatibilities in available built-in functions on various systems. */ static void __yy_memcpy (char *to, char *from, int count) { register char *f = from; register char *t = to; register int i = count; while (i-- > 0) *t++ = *f++; } #endif #endif #line 196 "/usr/share/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM #ifdef __cplusplus #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM #define YYPARSE_PARAM_DECL #else /* not __cplusplus */ #define YYPARSE_PARAM_ARG YYPARSE_PARAM #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; #endif /* not __cplusplus */ #else /* not YYPARSE_PARAM */ #define YYPARSE_PARAM_ARG #define YYPARSE_PARAM_DECL #endif /* not YYPARSE_PARAM */ int yyparse(YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { register int yystate; register int yyn; register short *yyssp; register YYSTYPE *yyvsp; int yyerrstatus; /* number of tokens to shift before error messages enabled */ int yychar1 = 0; /* lookahead token as an internal (translated) token number */ short yyssa[YYINITDEPTH]; /* the state stack */ YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ short *yyss = yyssa; /* refer to the stacks thru separate pointers */ YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ #ifdef YYLSP_NEEDED YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else #define YYPOPSTACK (yyvsp--, yyssp--) #endif int yystacksize = YYINITDEPTH; #ifdef YYPURE int yychar; YYSTYPE yylval; int yynerrs; #ifdef YYLSP_NEEDED YYLTYPE yylloc; #endif #endif YYSTYPE yyval; /* the variable used to return */ /* semantic values from the action */ /* routines */ int yylen; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Starting parse\n"); #endif yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss - 1; yyvsp = yyvs; #ifdef YYLSP_NEEDED yylsp = yyls; #endif /* Push a new state, which is found in yystate . */ /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yynewstate: *++yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Give user a chance to reallocate the stack */ /* Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; #ifdef YYLSP_NEEDED YYLTYPE *yyls1 = yyls; #endif /* Get the current used size of the three stacks, in elements. */ int size = yyssp - yyss + 1; #ifdef yyoverflow /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ #ifdef YYLSP_NEEDED /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yyls1, size * sizeof (*yylsp), &yystacksize); #else yyoverflow("parser stack overflow", &yyss1, size * sizeof (*yyssp), &yyvs1, size * sizeof (*yyvsp), &yystacksize); #endif yyss = yyss1; yyvs = yyvs1; #ifdef YYLSP_NEEDED yyls = yyls1; #endif #else /* no yyoverflow */ /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) { yyerror("parser stack overflow"); return 2; } yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; yyss = (short *) alloca (yystacksize * sizeof (*yyssp)); __yy_memcpy ((char *)yyss, (char *)yyss1, size * sizeof (*yyssp)); yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp)); __yy_memcpy ((char *)yyvs, (char *)yyvs1, size * sizeof (*yyvsp)); #ifdef YYLSP_NEEDED yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp)); __yy_memcpy ((char *)yyls, (char *)yyls1, size * sizeof (*yylsp)); #endif #endif /* no yyoverflow */ yyssp = yyss + size - 1; yyvsp = yyvs + size - 1; #ifdef YYLSP_NEEDED yylsp = yyls + size - 1; #endif #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Stack size increased to %d\n", yystacksize); #endif if (yyssp >= yyss + yystacksize - 1) YYABORT; } #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Entering state %d\n", yystate); #endif goto yybackup; yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Reading a token: "); #endif yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Now at end of input.\n"); #endif } else { yychar1 = YYTRANSLATE(yychar); #if YYDEBUG != 0 if (yydebug) { fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ #ifdef YYPRINT YYPRINT (stderr, yychar, yylval); #endif fprintf (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); #endif /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif /* count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /* Do the default action for the current state. */ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; /* Do a reduction. yyn is the number of a rule to reduce with. */ yyreduce: yylen = yyr2[yyn]; if (yylen > 0) yyval = yyvsp[1-yylen]; /* implement default value of the action */ #if YYDEBUG != 0 if (yydebug) { int i; fprintf (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) fprintf (stderr, "%s ", yytname[yyrhs[i]]); fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 1: #line 65 "./web2c.y" { printf ("#define %s\n", uppercasify (program_name)); block_level++; printf ("#include \"%s\"\n", std_header); ; break;} case 2: #line 72 "./web2c.y" { printf ("\n#include \"%s\"\n", coerce_name); ; break;} case 3: #line 75 "./web2c.y" { YYACCEPT; ; break;} case 6: #line 85 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = field_id_tok; ; break;} case 7: #line 90 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = fun_id_tok; ; break;} case 8: #line 95 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = const_id_tok; ; break;} case 9: #line 100 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = fun_param_tok; ; break;} case 10: #line 105 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = proc_id_tok; ; break;} case 11: #line 110 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = proc_param_tok; ; break;} case 12: #line 115 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = type_id_tok; ; break;} case 13: #line 120 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = type_id_tok; sym_table[ii].val = lower_bound; sym_table[ii].val_sym = lower_sym; sym_table[ii].upper = upper_bound; sym_table[ii].upper_sym = upper_sym; ; break;} case 14: #line 129 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = var_id_tok; ; break;} case 22: #line 155 "./web2c.y" { if (block_level > 0) my_output("{\n "); indent++; block_level++; ; break;} case 23: #line 160 "./web2c.y" { if (block_level == 2) { if (strcmp(fn_return_type, "void")) { my_output("register"); my_output(fn_return_type); my_output("Result;"); } if (tex) { sprintf(safe_string, "%s_regmem", my_routine); my_output(safe_string); new_line(); } } ; break;} case 24: #line 174 "./web2c.y" { doing_statements = true; ; break;} case 25: #line 176 "./web2c.y" { if (block_level == 2) { if (strcmp(fn_return_type,"void")) { my_output("return Result"); semicolon(); } if (tex) { if (uses_mem && uses_eqtb) fprintf(coerce, "#define %s_regmem register memoryword *mem=zmem, *eqtb=zeqtb;\n", my_routine); else if (uses_mem) fprintf(coerce, "#define %s_regmem register memoryword *mem=zmem;\n", my_routine); else if (uses_eqtb) fprintf(coerce, "#define %s_regmem register memoryword *eqtb=zeqtb;\n", my_routine); else fprintf(coerce, "#define %s_regmem\n", my_routine); } my_routine[0] = '\0'; } indent--; block_level--; my_output("}"); new_line(); doing_statements = false; ; break;} case 27: #line 206 "./web2c.y" { my_output("/*"); ; break;} case 28: #line 208 "./web2c.y" { my_output("*/"); ; break;} case 31: #line 216 "./web2c.y" { my_output(temp); ; break;} case 33: #line 222 "./web2c.y" { new_line(); ; break;} case 36: #line 231 "./web2c.y" { /* `#define' must be in column 1 for pcc. */ unsigned save = indent; new_line (); indent = 0; my_output ("#define"); indent = save; ; break;} case 37: #line 239 "./web2c.y" { ii = add_to_table (last_id); sym_table[ii].typ = const_id_tok; my_output (last_id); ; break;} case 38: #line 243 "./web2c.y" { my_output ("("); ; break;} case 39: #line 244 "./web2c.y" { my_output (")"); ; break;} case 40: #line 245 "./web2c.y" { sym_table[ii].val = last_i_num; new_line(); ; break;} case 41: #line 250 "./web2c.y" { sscanf (temp, "%ld", &last_i_num); if (my_labs ((long) last_i_num) > 32767) strcat (temp, "L"); my_output (temp); yyval = ex_32; ; break;} case 42: #line 257 "./web2c.y" { my_output(temp); yyval = ex_real; ; break;} case 43: #line 258 "./web2c.y" { yyval = 0; ; break;} case 44: #line 259 "./web2c.y" { yyval = ex_32; ; break;} case 45: #line 264 "./web2c.y" { yyval = yyvsp[0]; ; break;} case 46: #line 265 "./web2c.y" { my_output ("+"); ; break;} case 47: #line 266 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 48: #line 267 "./web2c.y" { my_output ("-"); ; break;} case 49: #line 268 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 50: #line 269 "./web2c.y" { my_output ("*"); ; break;} case 51: #line 270 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 52: #line 271 "./web2c.y" { my_output ("/"); ; break;} case 53: #line 272 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 54: #line 273 "./web2c.y" { my_output ("=="); ; break;} case 55: #line 274 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 56: #line 275 "./web2c.y" { my_output ("!="); ; break;} case 57: #line 276 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 58: #line 277 "./web2c.y" { my_output ("%"); ; break;} case 59: #line 278 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 60: #line 279 "./web2c.y" { my_output ("<"); ; break;} case 61: #line 280 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 62: #line 281 "./web2c.y" { my_output (">"); ; break;} case 63: #line 282 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 64: #line 283 "./web2c.y" { my_output ("<="); ; break;} case 65: #line 284 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 66: #line 285 "./web2c.y" { my_output (">="); ; break;} case 67: #line 286 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 68: #line 287 "./web2c.y" { my_output ("&&"); ; break;} case 69: #line 288 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 70: #line 289 "./web2c.y" { my_output ("||"); ; break;} case 71: #line 290 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 72: #line 291 "./web2c.y" { my_output ("/ ((double)"); ; break;} case 73: #line 292 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); my_output (")"); ; break;} case 74: #line 293 "./web2c.y" { yyval = yyvsp[0]; ; break;} case 75: #line 298 "./web2c.y" { my_output ("("); ; break;} case 76: #line 300 "./web2c.y" { my_output (")"); yyval = yyvsp[-3]; ; break;} case 78: #line 306 "./web2c.y" { int i, j; char s[132]; j = 1; s[0] = '"'; for (i=1; yytext[i-1] != 0; i++) { if (yytext[i] == '\\' || yytext[i] == '"') s[j++] = '\\'; else if (yytext[i] == '\'') i++; s[j++] = yytext[i]; } s[j-1] = '"'; s[j] = 0; my_output (s); ; break;} case 79: #line 322 "./web2c.y" { char s[5]; s[0]='\''; if (yytext[1] == '\\' || yytext[1] == '\'') { s[1] = '\\'; s[2] = yytext[1]; s[3] = '\''; s[4] = 0; } else { s[1] = yytext[1]; s[2] = '\''; s[3] = 0; } my_output (s); ; break;} case 80: #line 340 "./web2c.y" { my_output (last_id); ; break;} case 85: #line 352 "./web2c.y" { my_output ("typedef"); ; break;} case 86: #line 354 "./web2c.y" { ii = add_to_table(last_id); sym_table[ii].typ = type_id_tok; strcpy(safe_string, last_id); last_type = ii; ; break;} case 87: #line 361 "./web2c.y" { array_bounds[0] = 0; array_offset[0] = 0; ; break;} case 88: #line 366 "./web2c.y" { if (*array_offset) { yyerror ("Cannot typedef arrays with offsets"); } my_output (safe_string); my_output (array_bounds); semicolon (); last_type = -1; ; break;} case 91: #line 384 "./web2c.y" { if (last_type >= 0) { sym_table[ii].val = lower_bound; sym_table[ii].val_sym = lower_sym; sym_table[ii].upper = upper_bound; sym_table[ii].upper_sym = upper_sym; ii= -1; } /* If the bounds on an integral type are known at translation time, select the smallest ANSI C type which can represent it. We avoid using unsigned char and unsigned short where possible, as ANSI compilers (typically) convert them to int, while traditional compilers convert them to unsigned int. We also avoid schar if possible, since it also is different on different compilers (see config.h). */ if (lower_sym == -1 && upper_sym == -1) { if (0 <= lower_bound && upper_bound <= SCHAR_MAX) my_output ("char"); else if (SCHAR_MIN <= lower_bound && upper_bound <= SCHAR_MAX) my_output ("schar"); else if (0 <= lower_bound && upper_bound <= UCHAR_MAX) my_output ("unsigned char"); else if (SHRT_MIN <= lower_bound && upper_bound <= SHRT_MAX) my_output ("short"); else if (0 <= lower_bound && upper_bound <= USHRT_MAX) my_output ("unsigned short"); else my_output ("integer"); } else { my_output ("integer"); } ; break;} case 96: #line 433 "./web2c.y" { lower_bound = upper_bound; lower_sym = upper_sym; sscanf (temp, "%ld", &upper_bound); upper_sym = -1; /* no sym table entry */ ; break;} case 97: #line 440 "./web2c.y" { lower_bound = upper_bound; lower_sym = upper_sym; upper_bound = sym_table[l_s].val; upper_sym = l_s; ; break;} case 98: #line 447 "./web2c.y" { /* We've changed some constants into dynamic variables. To avoid changing all the subrange decls, just use integer. This does not work for arrays, for which we check later. */ lower_bound = upper_bound; lower_sym = upper_sym; upper_bound = 0; upper_sym = 0; /* Translate to integer. */ ; break;} case 99: #line 456 "./web2c.y" { /* Same as var_id_tok, to avoid changing type definitions. Should keep track of the variables we use in this way and make sure they're all eventually defined. */ lower_bound = upper_bound; lower_sym = upper_sym; upper_bound = 0; upper_sym = 0; ; break;} case 100: #line 468 "./web2c.y" { if (last_type >= 0) { sym_table[last_type].var_not_needed = sym_table[l_s].var_not_needed; sym_table[last_type].upper = sym_table[l_s].upper; sym_table[last_type].upper_sym = sym_table[l_s].upper_sym; sym_table[last_type].val = sym_table[l_s].val; sym_table[last_type].val_sym = sym_table[l_s].val_sym; } my_output (last_id); ; break;} case 101: #line 482 "./web2c.y" { if (last_type >= 0) sym_table[last_type].var_not_needed = true; ; break;} case 103: #line 487 "./web2c.y" { if (last_type >= 0) sym_table[last_type].var_not_needed = true; ; break;} case 104: #line 491 "./web2c.y" { if (last_type >= 0) sym_table[last_type].var_not_needed = true; ; break;} case 105: #line 498 "./web2c.y" { if (last_type >= 0) { sym_table[last_type].var_not_needed = sym_table[l_s].var_not_needed; sym_table[last_type].upper = sym_table[l_s].upper; sym_table[last_type].upper_sym = sym_table[l_s].upper_sym; sym_table[last_type].val = sym_table[l_s].val; sym_table[last_type].val_sym = sym_table[l_s].val_sym; } my_output (last_id); my_output ("*"); ; break;} case 108: #line 518 "./web2c.y" { compute_array_bounds(); ; break;} case 109: #line 520 "./web2c.y" { lower_bound = sym_table[l_s].val; lower_sym = sym_table[l_s].val_sym; upper_bound = sym_table[l_s].upper; upper_sym = sym_table[l_s].upper_sym; compute_array_bounds(); ; break;} case 111: #line 533 "./web2c.y" { my_output ("struct"); my_output ("{"); indent++; ; break;} case 112: #line 535 "./web2c.y" { indent--; my_output ("}"); semicolon(); ; break;} case 115: #line 543 "./web2c.y" { field_list[0] = 0; ; break;} case 116: #line 545 "./web2c.y" { /*array_bounds[0] = 0; array_offset[0] = 0;*/ ; break;} case 117: #line 550 "./web2c.y" { int i=0, j; char ltemp[80]; while(field_list[i++] == '!') { j = 0; while (field_list[i]) ltemp[j++] = field_list[i++]; i++; if (field_list[i] == '!') ltemp[j++] = ','; ltemp[j] = 0; my_output (ltemp); } semicolon(); ; break;} case 121: #line 571 "./web2c.y" { int i=0, j=0; while (field_list[i] == '!') while(field_list[i++]); ii = add_to_table(last_id); sym_table[ii].typ = field_id_tok; field_list[i++] = '!'; while (last_id[j]) field_list[i++] = last_id[j++]; field_list[i++] = 0; field_list[i++] = 0; ; break;} case 122: #line 583 "./web2c.y" { int i=0, j=0; while (field_list[i] == '!') while(field_list[i++]); field_list[i++] = '!'; while (last_id[j]) field_list[i++] = last_id[j++]; field_list[i++] = 0; field_list[i++] = 0; ; break;} case 123: #line 596 "./web2c.y" { my_output ("text /* of "); ; break;} case 124: #line 598 "./web2c.y" { my_output ("*/"); ; break;} case 129: #line 612 "./web2c.y" { var_list[0] = 0; array_bounds[0] = 0; array_offset[0] = 0; var_formals = false; ids_paramed = 0; ; break;} case 130: #line 620 "./web2c.y" { array_bounds[0] = 0; array_offset[0] = 0; ; break;} case 131: #line 625 "./web2c.y" { fixup_var_list(); ; break;} case 134: #line 633 "./web2c.y" { int i=0, j=0; ii = add_to_table(last_id); sym_table[ii].typ = var_id_tok; sym_table[ii].var_formal = var_formals; param_id_list[ids_paramed++] = ii; while (var_list[i] == '!') while(var_list[i++]); var_list[i++] = '!'; while (last_id[j]) var_list[i++] = last_id[j++]; var_list[i++] = 0; var_list[i++] = 0; ; break;} case 135: #line 647 "./web2c.y" { int i=0, j=0; ii = add_to_table(last_id); sym_table[ii].typ = var_id_tok; sym_table[ii].var_formal = var_formals; param_id_list[ids_paramed++] = ii; while (var_list[i] == '!') while (var_list[i++]); var_list[i++] = '!'; while (last_id[j]) var_list[i++] = last_id[j++]; var_list[i++] = 0; var_list[i++] = 0; ; break;} case 136: #line 661 "./web2c.y" { int i=0, j=0; ii = add_to_table(last_id); sym_table[ii].typ = var_id_tok; sym_table[ii].var_formal = var_formals; param_id_list[ids_paramed++] = ii; while (var_list[i] == '!') while(var_list[i++]); var_list[i++] = '!'; while (last_id[j]) var_list[i++] = last_id[j++]; var_list[i++] = 0; var_list[i++] = 0; ; break;} case 138: #line 679 "./web2c.y" { my_output ("void mainbody() {"); indent++; new_line (); ; break;} case 139: #line 684 "./web2c.y" { indent--; my_output ("}"); new_line (); ; break;} case 142: #line 696 "./web2c.y" { new_line(); remove_locals(); ; break;} case 143: #line 698 "./web2c.y" { new_line(); remove_locals(); ; break;} case 145: #line 706 "./web2c.y" { ii = add_to_table(last_id); if (debug) fprintf(stderr, "%3d Procedure %s\n", pf_count++, last_id); sym_table[ii].typ = proc_id_tok; strcpy(my_routine, last_id); uses_eqtb = uses_mem = false; my_output ("void"); new_line (); orig_std = std; std = 0; ; break;} case 146: #line 718 "./web2c.y" { strcpy(fn_return_type, "void"); do_proc_args(); gen_function_head(); ; break;} case 147: #line 722 "./web2c.y" { ii = l_s; if (debug) fprintf(stderr, "%3d Procedure %s\n", pf_count++, last_id); strcpy(my_routine, last_id); my_output ("void"); new_line (); ; break;} case 148: #line 730 "./web2c.y" { strcpy(fn_return_type, "void"); do_proc_args(); gen_function_head(); ; break;} case 149: #line 738 "./web2c.y" { strcpy (z_id, last_id); mark (); ids_paramed = 0; ; break;} case 150: #line 744 "./web2c.y" { sprintf (z_id, "z%s", last_id); ids_paramed = 0; if (sym_table[ii].typ == proc_id_tok) sym_table[ii].typ = proc_param_tok; else if (sym_table[ii].typ == fun_id_tok) sym_table[ii].typ = fun_param_tok; mark(); ; break;} case 154: #line 760 "./web2c.y" { ids_typed = ids_paramed; ; break;} case 155: #line 762 "./web2c.y" { int i, need_var; i = search_table(last_id); need_var = !sym_table[i].var_not_needed; for (i=ids_typed; i"); ; break;} case 226: #line 970 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 227: #line 971 "./web2c.y" { my_output ("<="); ; break;} case 228: #line 972 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 229: #line 973 "./web2c.y" { my_output (">="); ; break;} case 230: #line 974 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 231: #line 975 "./web2c.y" { my_output ("&&"); ; break;} case 232: #line 976 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 233: #line 977 "./web2c.y" { my_output ("||"); ; break;} case 234: #line 978 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); ; break;} case 235: #line 980 "./web2c.y" { my_output ("/ ((double)"); ; break;} case 236: #line 982 "./web2c.y" { yyval = max (yyvsp[-3], yyvsp[0]); my_output (")"); ; break;} case 237: #line 984 "./web2c.y" { yyval = yyvsp[0]; ; break;} case 239: #line 990 "./web2c.y" { my_output ("- (integer)"); ; break;} case 240: #line 992 "./web2c.y" { my_output ("!"); ; break;} case 241: #line 997 "./web2c.y" { my_output ("("); ; break;} case 242: #line 999 "./web2c.y" { my_output (")"); yyval = yyvsp[-3]; ; break;} case 245: #line 1003 "./web2c.y" { my_output (last_id); my_output ("()"); ; break;} case 246: #line 1005 "./web2c.y" { my_output (last_id); ; break;} case 248: #line 1010 "./web2c.y" { my_output ("("); ; break;} case 249: #line 1011 "./web2c.y" { my_output (")"); ; break;} case 251: #line 1016 "./web2c.y" { my_output (","); ; break;} case 254: #line 1023 "./web2c.y" { my_output (last_id); ; break;} case 257: #line 1032 "./web2c.y" { my_output (last_id); my_output ("()"); ; break;} case 258: #line 1034 "./web2c.y" { my_output (last_id); ii = add_to_table(last_id); sym_table[ii].typ = proc_id_tok; my_output ("()"); ; break;} case 259: #line 1040 "./web2c.y" { my_output (last_id); ; break;} case 261: #line 1045 "./web2c.y" {if (doreturn(temp)) { if (strcmp(fn_return_type,"void")) my_output ("return Result"); else my_output ("return"); } else { sprintf(safe_string, "goto lab%s", temp); my_output (safe_string); } ; break;} case 270: #line 1075 "./web2c.y" { my_output ("if"); my_output ("("); ; break;} case 271: #line 1077 "./web2c.y" { my_output (")"); new_line (); ; break;} case 273: #line 1082 "./web2c.y" { my_output ("else"); ; break;} case 275: #line 1087 "./web2c.y" { my_output ("switch"); my_output ("("); ; break;} case 276: #line 1089 "./web2c.y" { my_output (")"); new_line(); my_output ("{"); indent++; ; break;} case 277: #line 1093 "./web2c.y" { indent--; my_output ("}"); new_line(); ; break;} case 280: #line 1101 "./web2c.y" { my_output ("break"); semicolon(); ; break;} case 283: #line 1109 "./web2c.y" { my_output ("case"); my_output (temp); my_output (":"); new_line(); ; break;} case 284: #line 1114 "./web2c.y" { my_output ("default:"); new_line(); ; break;} case 290: #line 1127 "./web2c.y" { my_output ("while"); my_output ("("); ; break;} case 291: #line 1131 "./web2c.y" { my_output (")"); ; break;} case 293: #line 1136 "./web2c.y" { my_output ("do"); my_output ("{"); indent++; ; break;} case 294: #line 1138 "./web2c.y" { indent--; my_output ("}"); my_output ("while"); my_output ("( ! ("); ; break;} case 295: #line 1142 "./web2c.y" { my_output (") )"); ; break;} case 296: #line 1146 "./web2c.y" { my_output ("{"); my_output ("register"); my_output ("integer"); if (strict_for) my_output ("for_begin,"); my_output ("for_end;"); ; break;} case 297: #line 1155 "./web2c.y" { if (strict_for) my_output ("for_begin"); else my_output (control_var); my_output ("="); ; break;} case 298: #line 1161 "./web2c.y" { my_output ("; if ("); if (strict_for) my_output ("for_begin"); else my_output (control_var); my_output (relation); my_output ("for_end)"); if (strict_for) { my_output ("{"); my_output (control_var); my_output ("="); my_output ("for_begin"); semicolon(); } my_output ("do"); indent++; new_line(); ; break;} case 299: #line 1178 "./web2c.y" { char *top = strrchr (for_stack, '#'); indent--; new_line(); my_output ("while"); my_output ("("); my_output (top+1); my_output (")"); my_output (";"); my_output ("}"); if (strict_for) my_output ("}"); *top=0; new_line(); ; break;} case 300: #line 1196 "./web2c.y" { strcpy(control_var, last_id); ; break;} case 301: #line 1200 "./web2c.y" { my_output (";"); ; break;} case 302: #line 1202 "./web2c.y" { strcpy(relation, "<="); my_output ("for_end"); my_output ("="); ; break;} case 303: #line 1207 "./web2c.y" { sprintf(for_stack + strlen(for_stack), "#%s++ < for_end", control_var); ; break;} case 304: #line 1212 "./web2c.y" { my_output (";"); ; break;} case 305: #line 1214 "./web2c.y" { strcpy(relation, ">="); my_output ("for_end"); my_output ("="); ; break;} case 306: #line 1219 "./web2c.y" { sprintf(for_stack + strlen(for_stack), "#%s-- > for_end", control_var); ; break;} } /* the action file gets copied in in place of this dollarsign */ #line 498 "/usr/share/bison.simple" yyvsp -= yylen; yyssp -= yylen; #ifdef YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif *++yyvsp = yyval; #ifdef YYLSP_NEEDED yylsp++; if (yylen == 0) { yylsp->first_line = yylloc.first_line; yylsp->first_column = yylloc.first_column; yylsp->last_line = (yylsp-1)->last_line; yylsp->last_column = (yylsp-1)->last_column; yylsp->text = 0; } else { yylsp->last_line = (yylsp+yylen-1)->last_line; yylsp->last_column = (yylsp+yylen-1)->last_column; } #endif /* Now "shift" the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; yyerrlab: /* here on detecting error */ if (! yyerrstatus) /* If not already recovering from an error, report this error. */ { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { int size = 0; char *msg; int x, count; count = 0; /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) size += strlen(yytname[x]) + 15, count++; msg = (char *) malloc(size + 15); if (msg != 0) { strcpy(msg, "parse error"); if (count < 5) { count = 0; for (x = (yyn < 0 ? -yyn : 0); x < (sizeof(yytname) / sizeof(char *)); x++) if (yycheck[x + yyn] == x) { strcat(msg, count == 0 ? ", expecting `" : " or `"); strcat(msg, yytname[x]); strcat(msg, "'"); count++; } } yyerror(msg); free(msg); } else yyerror ("parse error; also virtual memory exceeded"); } else #endif /* YYERROR_VERBOSE */ yyerror("parse error"); } goto yyerrlab1; yyerrlab1: /* here on error raised explicitly by an action */ if (yyerrstatus == 3) { /* if just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); #endif yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; yyerrdefault: /* current state does not do anything special for the error token. */ #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ if (yyn) goto yydefault; #endif yyerrpop: /* pop the current state because it cannot handle the error token */ if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #ifdef YYLSP_NEEDED yylsp--; #endif #if YYDEBUG != 0 if (yydebug) { short *ssp1 = yyss - 1; fprintf (stderr, "Error: state stack now"); while (ssp1 != yyssp) fprintf (stderr, " %d", *++ssp1); fprintf (stderr, "\n"); } #endif yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; #if YYDEBUG != 0 if (yydebug) fprintf(stderr, "Shifting error token, "); #endif *++yyvsp = yylval; #ifdef YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; } #line 1224 "./web2c.y" static void compute_array_bounds P1H(void) { long lb; char tmp[200]; if (lower_sym == 0 || upper_sym == 0) { yyerror ("Cannot handle variable subrange in array decl"); } else if (lower_sym == -1) { /* lower is a constant */ lb = lower_bound - 1; if (lb==0) lb = -1; /* Treat lower_bound==1 as if lower_bound==0 */ if (upper_sym == -1) /* both constants */ sprintf(tmp, "[%ld]", upper_bound - lb); else { /* upper a symbol, lower constant */ if (lb < 0) sprintf(tmp, "[%s + %ld]", symbol(upper_sym), (-lb)); else sprintf(tmp, "[%s - %ld]", symbol(upper_sym), lb); } if (lower_bound < 0 || lower_bound > 1) { if (*array_bounds) { yyerror ("Cannot handle offset in second dimension"); } if (lower_bound < 0) { sprintf(array_offset, "+%ld", -lower_bound); } else { sprintf(array_offset, "-%ld", lower_bound); } } strcat(array_bounds, tmp); } else { /* lower is a symbol */ if (upper_sym != -1) /* both are symbols */ sprintf(tmp, "[%s - %s + 1]", symbol(upper_sym), symbol(lower_sym)); else { /* upper constant, lower symbol */ sprintf(tmp, "[%ld - %s]", upper_bound + 1, symbol(lower_sym)); } if (*array_bounds) { yyerror ("Cannot handle symbolic offset in second dimension"); } sprintf(array_offset, "- (int)(%s)", symbol(lower_sym)); strcat(array_bounds, tmp); } } /* Kludge around negative lower array bounds. */ static void fixup_var_list () { int i, j; char output_string[100], real_symbol[100]; for (i = 0; var_list[i++] == '!'; ) { for (j = 0; (real_symbol[j++] = var_list[i++]); ) ; if (*array_offset) { fprintf (std, "\n#define %s (%s %s)\n ", real_symbol, next_temp, array_offset); strcpy (real_symbol, next_temp); /* Add the temp to the symbol table, so that change files can use it later on if necessary. */ j = add_to_table (next_temp); sym_table[j].typ = var_id_tok; find_next_temp (); } sprintf (output_string, "%s%s%c", real_symbol, array_bounds, var_list[i] == '!' ? ',' : ' '); my_output (output_string); } semicolon (); } /* If we're not processing TeX, we return false. Otherwise, return true if the label is "10" and we're not in one of four TeX routines where the line labeled "10" isn't the end of the routine. Otherwise, return 0. */ static boolean doreturn P1C(string, label) { return tex && STREQ (label, "10") && !STREQ (my_routine, "macrocall") && !STREQ (my_routine, "hpack") && !STREQ (my_routine, "vpackage") && !STREQ (my_routine, "trybreak"); } /* Return the absolute value of a long. */ static long my_labs P1C(long, x) { if (x < 0L) return(-x); return(x); } /* Output current function declaration to coerce file. */ static void do_proc_args P1H(void) { /* If we want ANSI code and one of the parameters is a var parameter, then use the #define to add the &. We do this by adding a 'z' at the front of the name. gen_function_head will do the real work. */ int i; int var = 0; for (i = 0; i < ids_paramed; ++i) var += sym_table[param_id_list[i]].var_formal; if (var) { for (i = strlen (z_id); i >= 0; --i) z_id[i+1] = z_id[i]; z_id[0] = 'z'; } /* We can't use our P?H macros here, since there might be an arbitrary number of function arguments. */ fprintf (coerce, "%s %s AA((", fn_return_type, z_id); if (ids_paramed == 0) fprintf (coerce, "void"); for (i = 0; i < ids_paramed; i++) { if (i > 0) putc (',', coerce); fprintf (coerce, "%s %s", arg_type[i], symbol (param_id_list[i])); } fprintf (coerce, "));\n"); } static void gen_function_head P1H(void) { int i; if (strcmp(my_routine, z_id)) { fprintf(coerce, "#define %s(", my_routine); for (i=0; i 0) fprintf(coerce, ", %s", symbol(param_id_list[i])); else fprintf(coerce, "%s", symbol(param_id_list[i])); } fprintf(coerce, ") %s(", z_id); for (i=0; i 0) fputs(", ", coerce); fprintf(coerce, "(%s) ", arg_type[i]); fprintf(coerce, "%s(%s)", sym_table[param_id_list[i]].var_formal?"&":"", symbol(param_id_list[i])); } fprintf(coerce, ")\n"); } std = orig_std; new_line (); /* We can't use our P?C macros here, since there might be an arbitrary number of function arguments. We have to include the #ifdef in the generated code, or we'd generate different code with and without prototypes, which might cause splitup to create different numbers of files in each case. */ fputs ("#ifdef HAVE_PROTOTYPES\n", std); my_output (z_id); my_output ("("); if (ids_paramed == 0) my_output ("void"); for (i=0; i 0) my_output (","); my_output (arg_type[i]); my_output (symbol (param_id_list[i])); } my_output (")"); new_line (); fputs ("#else\n", std); my_output (z_id); my_output ("("); for (i=0; i 0) my_output (","); my_output (symbol (param_id_list[i])); } my_output (")"); new_line (); indent++; for (i=0; i