diff --git a/direct/src/dcparser/dcParser.cxx.prebuilt b/direct/src/dcparser/dcParser.cxx.prebuilt index 2dd086de44..0042a31298 100644 --- a/direct/src/dcparser/dcParser.cxx.prebuilt +++ b/direct/src/dcparser/dcParser.cxx.prebuilt @@ -139,10 +139,10 @@ dc_cleanup_parser() { #define YYFINAL 271 #define YYFLAG -32768 -#define YYNTBASE 62 +#define YYNTBASE 63 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ -#define YYTRANSLATE(x) ((unsigned)(x) <= 301 ? yytranslate[x] : 135) +#define YYTRANSLATE(x) ((unsigned)(x) <= 301 ? yytranslate[x] : 137) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = @@ -150,13 +150,13 @@ 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, - 56, 57, 51, 2, 52, 59, 50, 49, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 59, 2, 2, + 56, 57, 51, 2, 52, 60, 50, 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 55, 48, 2, 58, 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, 60, 2, 61, 2, 2, 2, 2, 2, 2, + 2, 61, 2, 62, 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, 53, 2, 54, 2, 2, 2, 2, @@ -190,73 +190,73 @@ static const short yyprhs[] = 117, 119, 121, 124, 126, 130, 132, 135, 138, 141, 144, 148, 151, 152, 158, 160, 162, 164, 168, 170, 171, 175, 177, 179, 180, 185, 187, 188, 193, 195, - 197, 199, 201, 204, 207, 210, 212, 217, 221, 228, - 235, 237, 239, 241, 243, 245, 249, 252, 256, 262, - 267, 269, 271, 275, 278, 282, 288, 293, 295, 300, - 302, 306, 311, 313, 315, 317, 319, 321, 323, 325, - 327, 329, 331, 333, 335, 337, 339, 341, 343, 344, - 349, 350, 355, 356, 361, 365, 369, 373, 377, 379, - 382, 384, 386, 388, 392, 394, 396, 398, 400, 402, - 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, - 424, 426, 428, 430, 432, 434, 437, 440, 443, 446, - 449, 452, 455, 458, 461, 463, 464, 469, 471, 473, - 477, 479, 481, 482, 492, 494, 497, 500, 503, 504, - 509, 512, 514 + 197, 199, 201, 204, 207, 210, 212, 217, 221, 225, + 227, 229, 231, 233, 235, 237, 241, 244, 248, 254, + 259, 261, 263, 267, 270, 274, 280, 285, 287, 292, + 294, 298, 302, 307, 309, 311, 313, 315, 317, 319, + 321, 323, 325, 327, 329, 331, 333, 335, 337, 339, + 340, 345, 346, 351, 352, 357, 361, 365, 369, 373, + 375, 378, 380, 382, 384, 388, 390, 392, 394, 396, + 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, + 418, 420, 422, 424, 426, 428, 430, 433, 436, 439, + 442, 445, 448, 451, 454, 457, 459, 460, 465, 467, + 469, 473, 475, 477, 478, 488, 490, 493, 496, 499, + 500, 505, 508, 510 }; static const short yyrhs[] = { - 45, 63, 0, 46, 113, 0, 47, 100, 0, 134, - 0, 63, 48, 0, 63, 71, 0, 63, 128, 0, - 63, 66, 0, 63, 70, 0, 8, 0, 64, 49, - 8, 0, 64, 0, 65, 50, 64, 0, 12, 65, - 0, 0, 11, 65, 12, 67, 68, 0, 69, 0, - 51, 0, 64, 0, 69, 52, 64, 0, 13, 99, - 0, 72, 0, 79, 0, 0, 9, 127, 73, 75, - 53, 77, 54, 0, 8, 0, 134, 0, 55, 76, - 0, 74, 0, 76, 52, 74, 0, 134, 0, 77, - 48, 0, 77, 78, 0, 86, 121, 0, 123, 122, - 0, 96, 121, 48, 0, 94, 121, 0, 0, 10, - 127, 80, 82, 53, 84, 54, 0, 8, 0, 134, - 0, 55, 83, 0, 81, 0, 83, 52, 81, 0, - 134, 0, 84, 48, 0, 84, 85, 0, 86, 122, - 0, 123, 122, 0, 96, 122, 48, 0, 94, 122, - 0, 0, 127, 56, 87, 88, 57, 0, 134, 0, - 89, 0, 90, 0, 89, 52, 90, 0, 99, 0, - 0, 104, 92, 105, 0, 104, 0, 91, 0, 0, - 91, 58, 95, 113, 0, 93, 0, 0, 93, 58, - 97, 113, 0, 91, 0, 93, 0, 94, 0, 96, - 0, 86, 122, 0, 96, 122, 0, 94, 122, 0, - 120, 0, 120, 56, 102, 57, 0, 120, 49, 107, - 0, 120, 49, 107, 56, 102, 57, 0, 120, 56, - 102, 57, 49, 107, 0, 8, 0, 79, 0, 128, - 0, 134, 0, 112, 0, 112, 59, 112, 0, 112, - 111, 0, 102, 52, 112, 0, 102, 52, 112, 59, - 112, 0, 102, 52, 112, 111, 0, 134, 0, 106, - 0, 106, 59, 106, 0, 106, 108, 0, 103, 52, - 106, 0, 103, 52, 106, 59, 106, 0, 103, 52, - 106, 108, 0, 101, 0, 104, 60, 103, 61, 0, - 8, 0, 105, 49, 107, 0, 105, 60, 103, 61, - 0, 6, 0, 107, 0, 3, 0, 4, 0, 4, - 0, 3, 0, 110, 0, 109, 0, 5, 0, 6, - 0, 111, 0, 109, 0, 110, 0, 5, 0, 6, - 0, 7, 0, 0, 53, 114, 117, 54, 0, 0, - 60, 115, 117, 61, 0, 0, 56, 116, 117, 57, - 0, 109, 51, 107, 0, 110, 51, 107, 0, 5, - 51, 107, 0, 7, 51, 107, 0, 118, 0, 119, - 118, 0, 134, 0, 52, 0, 113, 0, 119, 52, - 113, 0, 16, 0, 17, 0, 18, 0, 19, 0, - 20, 0, 21, 0, 22, 0, 23, 0, 24, 0, - 25, 0, 26, 0, 27, 0, 28, 0, 29, 0, - 30, 0, 31, 0, 32, 0, 33, 0, 34, 0, - 35, 0, 134, 0, 121, 36, 0, 121, 37, 0, - 121, 38, 0, 121, 39, 0, 121, 40, 0, 121, - 41, 0, 121, 42, 0, 121, 43, 0, 121, 44, - 0, 121, 0, 0, 8, 55, 124, 126, 0, 8, - 0, 125, 0, 126, 52, 125, 0, 134, 0, 8, - 0, 0, 14, 127, 56, 98, 57, 53, 129, 130, - 54, 0, 134, 0, 130, 48, 0, 130, 131, 0, - 130, 133, 0, 0, 15, 132, 113, 55, 0, 96, - 48, 0, 94, 0, 0 + 45, 64, 0, 46, 115, 0, 47, 101, 0, 136, + 0, 64, 48, 0, 64, 72, 0, 64, 130, 0, + 64, 67, 0, 64, 71, 0, 8, 0, 65, 49, + 8, 0, 65, 0, 66, 50, 65, 0, 12, 66, + 0, 0, 11, 66, 12, 68, 69, 0, 70, 0, + 51, 0, 65, 0, 70, 52, 65, 0, 13, 100, + 0, 73, 0, 80, 0, 0, 9, 129, 74, 76, + 53, 78, 54, 0, 8, 0, 136, 0, 55, 77, + 0, 75, 0, 77, 52, 75, 0, 136, 0, 78, + 48, 0, 78, 79, 0, 87, 123, 0, 125, 124, + 0, 97, 123, 48, 0, 95, 123, 0, 0, 10, + 129, 81, 83, 53, 85, 54, 0, 8, 0, 136, + 0, 55, 84, 0, 82, 0, 84, 52, 82, 0, + 136, 0, 85, 48, 0, 85, 86, 0, 87, 124, + 0, 125, 124, 0, 97, 124, 48, 0, 95, 124, + 0, 0, 129, 56, 88, 89, 57, 0, 136, 0, + 90, 0, 91, 0, 90, 52, 91, 0, 100, 0, + 0, 106, 93, 107, 0, 106, 0, 92, 0, 0, + 92, 58, 96, 115, 0, 94, 0, 0, 94, 58, + 98, 115, 0, 92, 0, 94, 0, 95, 0, 97, + 0, 87, 124, 0, 97, 124, 0, 95, 124, 0, + 122, 0, 102, 56, 104, 57, 0, 102, 49, 109, + 0, 102, 59, 113, 0, 102, 0, 8, 0, 80, + 0, 130, 0, 136, 0, 114, 0, 114, 60, 114, + 0, 114, 113, 0, 104, 52, 114, 0, 104, 52, + 114, 60, 114, 0, 104, 52, 114, 113, 0, 136, + 0, 108, 0, 108, 60, 108, 0, 108, 110, 0, + 105, 52, 108, 0, 105, 52, 108, 60, 108, 0, + 105, 52, 108, 110, 0, 103, 0, 106, 61, 105, + 62, 0, 8, 0, 107, 49, 109, 0, 107, 59, + 113, 0, 107, 61, 105, 62, 0, 6, 0, 109, + 0, 3, 0, 4, 0, 4, 0, 3, 0, 112, + 0, 111, 0, 5, 0, 6, 0, 113, 0, 111, + 0, 112, 0, 5, 0, 6, 0, 7, 0, 0, + 53, 116, 119, 54, 0, 0, 61, 117, 119, 62, + 0, 0, 56, 118, 119, 57, 0, 111, 51, 109, + 0, 112, 51, 109, 0, 5, 51, 109, 0, 7, + 51, 109, 0, 120, 0, 121, 120, 0, 136, 0, + 52, 0, 115, 0, 121, 52, 115, 0, 16, 0, + 17, 0, 18, 0, 19, 0, 20, 0, 21, 0, + 22, 0, 23, 0, 24, 0, 25, 0, 26, 0, + 27, 0, 28, 0, 29, 0, 30, 0, 31, 0, + 32, 0, 33, 0, 34, 0, 35, 0, 136, 0, + 123, 36, 0, 123, 37, 0, 123, 38, 0, 123, + 39, 0, 123, 40, 0, 123, 41, 0, 123, 42, + 0, 123, 43, 0, 123, 44, 0, 123, 0, 0, + 8, 55, 126, 128, 0, 8, 0, 127, 0, 128, + 52, 127, 0, 136, 0, 8, 0, 0, 14, 129, + 56, 99, 57, 53, 131, 132, 54, 0, 136, 0, + 132, 48, 0, 132, 133, 0, 132, 135, 0, 0, + 15, 134, 115, 55, 0, 97, 48, 0, 95, 0, + 0 }; #endif @@ -265,25 +265,25 @@ static const short yyrhs[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { - 0, 171, 173, 174, 180, 182, 183, 194, 200, 201, - 204, 206, 212, 214, 220, 225, 225, 232, 234, 240, - 245, 251, 269, 271, 274, 274, 287, 310, 312, 315, - 322, 330, 332, 333, 345, 356, 357, 365, 374, 374, - 387, 410, 412, 415, 422, 430, 432, 433, 443, 451, - 452, 456, 462, 462, 475, 477, 480, 482, 485, 494, - 494, 505, 509, 511, 511, 539, 541, 541, 569, 571, - 574, 576, 579, 584, 588, 594, 599, 607, 618, 632, - 646, 681, 697, 715, 720, 727, 734, 743, 749, 755, - 765, 770, 777, 784, 791, 797, 803, 811, 813, 823, - 829, 843, 849, 859, 862, 873, 887, 891, 895, 900, - 904, 907, 917, 921, 926, 930, 934, 938, 942, 942, - 950, 950, 958, 958, 966, 972, 978, 984, 992, 994, - 997, 999, 1002, 1004, 1007, 1012, 1016, 1020, 1024, 1028, - 1032, 1036, 1040, 1044, 1048, 1052, 1056, 1060, 1064, 1068, - 1072, 1076, 1080, 1084, 1090, 1095, 1099, 1103, 1107, 1111, - 1115, 1119, 1123, 1127, 1133, 1143, 1143, 1154, 1170, 1177, - 1190, 1195, 1198, 1198, 1212, 1214, 1215, 1216, 1228, 1228, - 1245, 1250, 1256 + 0, 172, 174, 175, 181, 183, 184, 195, 201, 202, + 205, 207, 213, 215, 221, 226, 226, 233, 235, 241, + 246, 252, 270, 272, 275, 275, 288, 311, 313, 316, + 323, 331, 333, 334, 346, 357, 358, 366, 375, 375, + 388, 411, 413, 416, 423, 431, 433, 434, 444, 452, + 453, 457, 463, 463, 476, 478, 481, 483, 486, 495, + 495, 506, 510, 512, 512, 540, 542, 542, 570, 572, + 575, 577, 580, 585, 589, 595, 600, 609, 626, 640, + 642, 677, 693, 711, 716, 723, 730, 739, 745, 751, + 761, 766, 773, 780, 787, 793, 799, 807, 809, 819, + 825, 840, 855, 861, 871, 874, 885, 899, 903, 907, + 912, 916, 919, 929, 933, 938, 942, 946, 950, 954, + 954, 962, 962, 970, 970, 978, 984, 990, 996, 1004, + 1006, 1009, 1011, 1014, 1016, 1019, 1024, 1028, 1032, 1036, + 1040, 1044, 1048, 1052, 1056, 1060, 1064, 1068, 1072, 1076, + 1080, 1084, 1088, 1092, 1096, 1102, 1107, 1111, 1115, 1119, + 1123, 1127, 1131, 1135, 1139, 1145, 1155, 1155, 1166, 1182, + 1189, 1202, 1207, 1210, 1210, 1224, 1226, 1227, 1228, 1240, + 1240, 1257, 1262, 1268 }; #endif @@ -304,50 +304,50 @@ static const char *const yytname[] = "KW_P2P", "KW_RAM", "KW_DB", "KW_CLSEND", "KW_CLRECV", "KW_OWNSEND", "KW_AIRECV", "START_DC", "START_PARAMETER_VALUE", "START_PARAMETER_DESCRIPTION", "';'", "'/'", "'.'", "'*'", "','", "'{'", - "'}'", "':'", "'('", "')'", "'='", "'-'", "'['", "']'", "grammar", "dc", - "slash_identifier", "import_identifier", "import", "@1", - "import_symbol_list_or_star", "import_symbol_list", "typedef_decl", - "dclass_or_struct", "dclass", "@2", "dclass_name", "dclass_derivation", - "dclass_base_list", "dclass_fields", "dclass_field", "struct", "@3", - "struct_name", "struct_derivation", "struct_base_list", "struct_fields", - "struct_field", "atomic_field", "@4", "parameter_list", - "nonempty_parameter_list", "atomic_element", "named_parameter", "@5", - "unnamed_parameter", "named_parameter_with_default", "@6", - "unnamed_parameter_with_default", "@7", "parameter", - "parameter_with_default", "parameter_description", "type_name", - "double_range", "uint_range", "type_definition", "parameter_definition", - "char_or_uint", "small_unsigned_integer", "small_negative_integer", - "signed_integer", "unsigned_integer", "number", "char_or_number", - "parameter_value", "@8", "@9", "@10", "array", "maybe_comma", - "array_def", "type_token", "server_flags", "no_server_flags", - "molecular_field", "@11", "atomic_name", "molecular_atom_list", - "optional_name", "switch", "@12", "switch_fields", "switch_case", "@13", - "switch_field", "empty", 0 + "'}'", "':'", "'('", "')'", "'='", "'%'", "'-'", "'['", "']'", + "grammar", "dc", "slash_identifier", "import_identifier", "import", + "@1", "import_symbol_list_or_star", "import_symbol_list", + "typedef_decl", "dclass_or_struct", "dclass", "@2", "dclass_name", + "dclass_derivation", "dclass_base_list", "dclass_fields", + "dclass_field", "struct", "@3", "struct_name", "struct_derivation", + "struct_base_list", "struct_fields", "struct_field", "atomic_field", + "@4", "parameter_list", "nonempty_parameter_list", "atomic_element", + "named_parameter", "@5", "unnamed_parameter", + "named_parameter_with_default", "@6", "unnamed_parameter_with_default", + "@7", "parameter", "parameter_with_default", "parameter_description", + "simple_type_name", "type_name", "double_range", "uint_range", + "type_definition", "parameter_definition", "char_or_uint", + "small_unsigned_integer", "small_negative_integer", "signed_integer", + "unsigned_integer", "number", "char_or_number", "parameter_value", "@8", + "@9", "@10", "array", "maybe_comma", "array_def", "type_token", + "server_flags", "no_server_flags", "molecular_field", "@11", + "atomic_name", "molecular_atom_list", "optional_name", "switch", "@12", + "switch_fields", "switch_case", "@13", "switch_field", "empty", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { - 0, 62, 62, 62, 63, 63, 63, 63, 63, 63, - 64, 64, 65, 65, 66, 67, 66, 68, 68, 69, - 69, 70, 71, 71, 73, 72, 74, 75, 75, 76, - 76, 77, 77, 77, 78, 78, 78, 78, 80, 79, - 81, 82, 82, 83, 83, 84, 84, 84, 85, 85, - 85, 85, 87, 86, 88, 88, 89, 89, 90, 92, - 91, 93, 94, 95, 94, 96, 97, 96, 98, 98, - 99, 99, 100, 100, 100, 101, 101, 101, 101, 101, - 101, 101, 101, 102, 102, 102, 102, 102, 102, 102, - 103, 103, 103, 103, 103, 103, 103, 104, 104, 105, - 105, 105, 106, 106, 107, 108, 109, 110, 111, 111, - 111, 112, 112, 113, 113, 113, 113, 113, 114, 113, - 115, 113, 116, 113, 113, 113, 113, 113, 117, 117, - 118, 118, 119, 119, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, - 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, - 121, 121, 121, 121, 122, 124, 123, 125, 126, 126, - 127, 127, 129, 128, 130, 130, 130, 130, 132, 131, - 133, 133, 134 + 0, 63, 63, 63, 64, 64, 64, 64, 64, 64, + 65, 65, 66, 66, 67, 68, 67, 69, 69, 70, + 70, 71, 72, 72, 74, 73, 75, 76, 76, 77, + 77, 78, 78, 78, 79, 79, 79, 79, 81, 80, + 82, 83, 83, 84, 84, 85, 85, 85, 86, 86, + 86, 86, 88, 87, 89, 89, 90, 90, 91, 93, + 92, 94, 95, 96, 95, 97, 98, 97, 99, 99, + 100, 100, 101, 101, 101, 102, 102, 102, 102, 103, + 103, 103, 103, 104, 104, 104, 104, 104, 104, 104, + 105, 105, 105, 105, 105, 105, 105, 106, 106, 107, + 107, 107, 107, 108, 108, 109, 110, 111, 112, 113, + 113, 113, 114, 114, 115, 115, 115, 115, 115, 116, + 115, 117, 115, 118, 115, 115, 115, 115, 115, 119, + 119, 120, 120, 121, 121, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 122, 122, 122, 122, 122, + 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, + 123, 123, 123, 123, 123, 124, 126, 125, 127, 128, + 128, 129, 129, 131, 130, 132, 132, 132, 132, 134, + 133, 135, 135, 136 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ @@ -360,18 +360,18 @@ static const short yyr2[] = 1, 1, 2, 1, 3, 1, 2, 2, 2, 2, 3, 2, 0, 5, 1, 1, 1, 3, 1, 0, 3, 1, 1, 0, 4, 1, 0, 4, 1, 1, - 1, 1, 2, 2, 2, 1, 4, 3, 6, 6, + 1, 1, 2, 2, 2, 1, 4, 3, 3, 1, 1, 1, 1, 1, 1, 3, 2, 3, 5, 4, 1, 1, 3, 2, 3, 5, 4, 1, 4, 1, - 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 4, - 0, 4, 0, 4, 3, 3, 3, 3, 1, 2, - 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, + 3, 3, 4, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, + 4, 0, 4, 0, 4, 3, 3, 3, 3, 1, + 2, 1, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 1, 0, 4, 1, 1, 3, - 1, 1, 0, 9, 1, 2, 2, 2, 0, 4, - 2, 1, 0 + 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 1, 0, 4, 1, 1, + 3, 1, 1, 0, 9, 1, 2, 2, 2, 0, + 4, 2, 1, 0 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE @@ -379,90 +379,90 @@ static const short yyr2[] = error. */ static const short yydefact[] = { - 0, 182, 0, 182, 1, 4, 107, 106, 115, 116, - 117, 118, 122, 120, 113, 114, 2, 80, 182, 182, - 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, - 81, 182, 62, 65, 182, 182, 3, 97, 61, 75, - 0, 82, 170, 182, 0, 0, 0, 5, 8, 9, - 6, 22, 23, 7, 0, 0, 182, 182, 182, 0, - 0, 171, 38, 0, 164, 72, 154, 63, 66, 74, - 73, 182, 0, 0, 182, 52, 24, 10, 12, 0, - 14, 80, 70, 71, 21, 104, 126, 127, 131, 132, - 0, 128, 182, 130, 0, 0, 124, 125, 182, 0, - 155, 156, 157, 158, 159, 160, 161, 162, 163, 0, - 0, 102, 0, 91, 103, 90, 99, 60, 77, 110, - 111, 0, 109, 108, 112, 84, 83, 182, 182, 0, - 15, 0, 119, 131, 129, 123, 121, 0, 0, 41, - 68, 69, 0, 64, 67, 0, 98, 105, 0, 93, - 0, 182, 182, 0, 76, 0, 86, 0, 55, 56, - 58, 54, 0, 0, 27, 11, 0, 13, 133, 40, - 43, 42, 182, 0, 94, 92, 100, 0, 0, 87, - 0, 85, 53, 0, 26, 29, 28, 182, 18, 19, - 16, 17, 0, 182, 45, 172, 0, 96, 101, 78, - 0, 89, 79, 57, 0, 182, 31, 0, 44, 80, - 46, 39, 47, 182, 182, 182, 182, 182, 95, 88, - 30, 32, 25, 33, 182, 182, 182, 182, 20, 165, - 48, 51, 0, 49, 0, 174, 34, 37, 0, 35, - 0, 50, 178, 175, 173, 181, 0, 176, 177, 36, - 167, 168, 166, 0, 180, 0, 0, 169, 179, 0, + 0, 183, 0, 183, 1, 4, 108, 107, 116, 117, + 118, 119, 123, 121, 114, 115, 2, 80, 183, 183, + 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, + 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, + 81, 183, 62, 65, 183, 183, 3, 79, 97, 61, + 75, 0, 82, 171, 183, 0, 0, 0, 5, 8, + 9, 6, 22, 23, 7, 0, 0, 183, 183, 183, + 0, 0, 172, 38, 0, 165, 72, 155, 63, 66, + 74, 73, 0, 183, 0, 183, 0, 52, 24, 10, + 12, 0, 14, 80, 70, 71, 21, 105, 127, 128, + 132, 133, 0, 129, 183, 131, 0, 0, 125, 126, + 183, 0, 156, 157, 158, 159, 160, 161, 162, 163, + 164, 0, 0, 77, 111, 112, 0, 110, 109, 113, + 84, 83, 78, 103, 0, 91, 104, 90, 99, 60, + 183, 183, 0, 15, 0, 120, 132, 130, 124, 122, + 0, 0, 41, 68, 69, 0, 64, 67, 0, 76, + 0, 86, 0, 98, 106, 0, 93, 0, 0, 183, + 0, 55, 56, 58, 54, 0, 0, 27, 11, 0, + 13, 134, 40, 43, 42, 183, 0, 87, 85, 94, + 92, 100, 101, 0, 53, 0, 26, 29, 28, 183, + 18, 19, 16, 17, 0, 183, 45, 173, 0, 89, + 0, 96, 102, 57, 0, 183, 31, 0, 44, 80, + 46, 39, 47, 183, 183, 183, 183, 183, 88, 95, + 30, 32, 25, 33, 183, 183, 183, 183, 20, 166, + 48, 51, 0, 49, 0, 175, 34, 37, 0, 35, + 0, 50, 179, 176, 174, 182, 0, 177, 178, 36, + 168, 169, 167, 0, 181, 0, 0, 170, 180, 0, 0, 0 }; static const short yydefgoto[] = { - 269, 4, 88, 89, 58, 176, 200, 201, 59, 60, - 61, 138, 195, 173, 196, 215, 233, 40, 108, 180, - 148, 181, 203, 222, 41, 137, 167, 168, 169, 42, - 82, 43, 92, 119, 93, 120, 152, 170, 46, 47, - 131, 122, 48, 127, 123, 124, 159, 14, 15, 134, - 135, 99, 66, 68, 67, 100, 101, 102, 49, 74, - 75, 226, 250, 261, 262, 50, 51, 227, 244, 257, - 263, 258, 76 + 269, 4, 90, 91, 59, 179, 202, 203, 60, 61, + 62, 141, 197, 176, 198, 215, 233, 40, 110, 183, + 151, 184, 205, 222, 41, 140, 170, 171, 172, 42, + 86, 43, 94, 121, 95, 122, 155, 173, 46, 47, + 48, 126, 134, 49, 139, 135, 136, 166, 14, 15, + 129, 130, 101, 67, 69, 68, 102, 103, 104, 50, + 75, 76, 226, 250, 261, 262, 51, 52, 227, 244, + 257, 263, 258, 77 }; static const short yypact[] = { - 67,-32768, 33, 365, 110,-32768,-32768,-32768, -23,-32768, - 8,-32768,-32768,-32768, 14, 20,-32768, -5, 69, 69, + 62,-32768, 65, 365, 129,-32768,-32768,-32768, -17,-32768, + -13,-32768,-32768,-32768, -10, 11,-32768, 9, 55, 55, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, 50, 52,-32768,-32768,-32768,-32768, 6, -22, - 60,-32768,-32768, 69, 96, 96, 393,-32768,-32768,-32768, - -32768,-32768,-32768,-32768, 128, 128, 16, 16, 16, 128, - 128,-32768,-32768, 79, 134,-32768,-32768,-32768,-32768,-32768, - -32768, 29, 130, 128, 91,-32768,-32768,-32768, 87, 12, - 89,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - 86,-32768, 90,-32768, 99, 82,-32768,-32768, 102, 393, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 33, - 33,-32768, -3, 5,-32768,-32768,-32768, 32, 104,-32768, - -32768, 46,-32768,-32768,-32768, 40,-32768, 393, 106, 138, - -32768, 96,-32768, 33,-32768,-32768,-32768, 154, 112,-32768, - -32768,-32768, 107,-32768,-32768, 29,-32768,-32768, 29,-32768, - 128, 29, 91, 91, 114, 91,-32768, 109, 115,-32768, - -32768,-32768, 171, 127,-32768,-32768, 10, 87,-32768,-32768, - -32768, 129,-32768, 135, 11,-32768,-32768, 2, 48, 43, - 128,-32768,-32768, 393,-32768,-32768, 139,-32768,-32768, 87, - -32768, 140, 154, 287,-32768,-32768, 29,-32768,-32768,-32768, - 91,-32768,-32768,-32768, 171, 326,-32768, 96,-32768, 70, + -32768,-32768, 47, 72,-32768,-32768,-32768, -19,-32768, 5, + -32768, 76,-32768,-32768, 55, 125, 125, 393,-32768,-32768, + -32768,-32768,-32768,-32768,-32768, 131, 131, 45, 45, 45, + 131, 131,-32768,-32768, 79, 126,-32768,-32768,-32768,-32768, + -32768,-32768, 131, 119, 109, 29, 137,-32768,-32768,-32768, + 88, 43, 96,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768, 104,-32768, 107,-32768, 103, 110,-32768,-32768, + 116, 393,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, + -32768, 65, 65,-32768,-32768,-32768, 37,-32768,-32768,-32768, + 13,-32768,-32768,-32768, -6, 20,-32768,-32768,-32768, -16, + 393, 118, 166,-32768, 125,-32768, 65,-32768,-32768,-32768, + 167, 127,-32768,-32768,-32768, 121,-32768,-32768, 119,-32768, + 119,-32768, 29,-32768,-32768, 29,-32768, 131, 109, 29, + 122, 130,-32768,-32768,-32768, 173, 134,-32768,-32768, 28, + 88,-32768,-32768,-32768, 136,-32768, 138, 18,-32768, 24, + -32768,-32768,-32768, 2,-32768, 393,-32768,-32768, 141,-32768, + -32768, 88,-32768, 142, 167, 287,-32768,-32768, 119,-32768, + 29,-32768,-32768,-32768, 173, 326,-32768, 125,-32768, 44, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 87,-32768, - -32768,-32768, 142,-32768, 248,-32768, 134, 134, 111,-32768, - 174,-32768,-32768,-32768,-32768,-32768, 145,-32768,-32768,-32768, - -32768,-32768, 143, 33,-32768, 174, 132,-32768,-32768, 194, - 196,-32768 + -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 88,-32768, + -32768,-32768, 147,-32768, 248,-32768, 126, 126, 113,-32768, + 181,-32768,-32768,-32768,-32768,-32768, 148,-32768,-32768,-32768, + -32768,-32768, 146, 65,-32768, 181, 135,-32768,-32768, 199, + 200,-32768 }; static const short yypgoto[] = { - -32768,-32768, -134, 144,-32768,-32768,-32768,-32768,-32768,-32768, - -32768,-32768, -16,-32768,-32768,-32768,-32768, 197,-32768, 3, - -32768,-32768,-32768,-32768, -174,-32768,-32768,-32768, 13, 98, - -32768, 100, -1,-32768, 0,-32768,-32768, 152,-32768,-32768, - 38, 51,-32768,-32768, -105, -53, 27, -83, -78, -122, - -132, -2,-32768,-32768,-32768, 66, 116,-32768,-32768, -106, - -40, 1,-32768, -52,-32768, 37, 213,-32768,-32768,-32768, - -32768,-32768, 7 + -32768,-32768, -135, 145,-32768,-32768,-32768,-32768,-32768,-32768, + -32768,-32768, -12,-32768,-32768,-32768,-32768, 203,-32768, 4, + -32768,-32768,-32768,-32768, -148,-32768,-32768,-32768, 8, 98, + -32768, 99, -1,-32768, 0,-32768,-32768, 154,-32768,-32768, + -32768,-32768, 48,-32768,-32768, -123, -51, 27, -77, -72, + -83, -131, -2,-32768,-32768,-32768, 34, 114,-32768,-32768, + -107, -40, 6,-32768, -52,-32768, 41, 215,-32768,-32768, + -32768,-32768,-32768, 7 }; @@ -471,32 +471,32 @@ static const short yypgoto[] = static const short yytable[] = { - 16, 132, 44, 45, 79, 80, 133, 177, 5, 157, - 52, 96, 97, 166, -59, 157, 106, 107, 87, 6, - 7, 8, 9, 10, 140, 52, 52, 83, 64, 223, - 128, 189, 95, 191, 84, 121, 6, 7, 8, 9, - 10, 234, 199, 6, 7, 129, 6, 7, 129, 155, - 184, -171, 132, 185, 155, 72, 73, 133, 156, 65, - 52, 198, 141, 208, 158, 69, 81, 211, 98, 11, - 206, 70, 12, 103, 103, 103, 13, 71, 229, 132, - 132, 160, 132, 238, 133, 133, 11, 133, 125, 12, - 86, 136, 161, 13, 6, 7, 129, 130, 163, 165, - 163, 228, 210, 164, 87, 209, 132, 186, 77, 103, - 78, 133, 1, 2, 3, 149, 85, 153, 154, 53, - 18, 54, 55, 56, 19, 239, -171, 132, 246, 247, - 248, 95, 133, 104, 105, 109, 139, 212, 126, 141, - 142, 178, 143, 146, 171, 174, 175, 110, 111, 112, - 113, 114, 115, 116, 117, 118, 145, 147, 57, 259, - 162, 172, 179, 190, 183, 182, 192, 193, 125, 136, - 110, 111, 112, 113, 114, 115, 116, 117, 118, 194, - 197, 202, 260, 240, 241, 242, 243, 268, 205, 204, - 251, 214, 217, 264, 270, 265, 271, 249, 230, 90, - 188, 62, 224, 225, 216, 218, 213, 150, 94, 151, - 52, 207, 187, 267, 235, 236, 237, 63, 144, 0, - 0, 0, 52, 0, 0, 0, 0, 0, 0, 0, + 16, 132, 44, 45, 80, 81, 127, 127, 5, 180, + 53, 128, 128, -59, 98, 99, 6, 7, 124, 108, + 109, 6, 7, 124, 164, 53, 53, 187, 164, 188, + 82, 123, 97, 167, 65, 133, 89, 83, 66, 189, + 84, 70, 190, 168, 201, 169, 162, 161, 6, 7, + 8, 9, 10, 127, 162, 143, 163, 223, 128, 73, + 74, 53, 71, 72, 212, -172, 85, 234, 6, 7, + 8, 9, 10, 160, 105, 105, 105, 228, 208, 200, + 165, 127, 238, 127, 210, 192, 128, 229, 128, 158, + 131, 127, 137, 144, 159, 88, 128, 100, 11, 239, + -172, 12, 106, 107, 209, 78, 13, 1, 2, 3, + 127, 105, 6, 7, 124, 128, 191, 152, 11, 156, + 157, 12, 6, 7, 124, 125, 13, 246, 247, 248, + 79, 127, 87, 89, 97, 111, 128, 142, 54, 18, + 55, 56, 57, 19, 181, 138, 144, 174, 177, 112, + 113, 114, 115, 116, 117, 118, 119, 120, 145, 146, + 148, 259, 112, 113, 114, 115, 116, 117, 118, 119, + 120, 150, 149, 175, 178, 182, 137, 58, 186, 194, + 185, 196, 195, 240, 241, 242, 243, 199, 204, 260, + 268, 207, 206, 214, 217, 251, 264, 249, 265, 270, + 271, 92, 230, 213, 224, 225, 216, 63, 218, 153, + 154, 96, 53, 267, 235, 236, 211, 193, 147, 64, + 0, 237, 53, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 245, 0, 0, 0, 0, 0, 0, 0, 0, 255, 256, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 91, 0, 18, 0, + 0, 0, 0, 0, 0, 0, 93, 0, 18, 0, 0, 266, 19, 252, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0, 0, 0, 0, 0, 0, @@ -511,36 +511,36 @@ static const short yytable[] = 0, 0, 0, 17, 231, 18, 0, 0, 0, 19, 232, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - 39, 91, 0, 18, 0, 0, 0, 19, 0, 20, + 39, 93, 0, 18, 0, 0, 0, 19, 0, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39 }; static const short yycheck[] = { - 2, 84, 3, 3, 44, 45, 84, 141, 1, 4, - 3, 64, 65, 135, 8, 4, 69, 70, 8, 3, - 4, 5, 6, 7, 12, 18, 19, 49, 51, 203, - 83, 163, 3, 165, 56, 6, 3, 4, 5, 6, - 7, 215, 176, 3, 4, 5, 3, 4, 5, 52, - 155, 56, 135, 158, 52, 18, 19, 135, 61, 51, - 53, 51, 50, 61, 59, 51, 60, 189, 52, 53, - 59, 51, 56, 66, 67, 68, 60, 8, 210, 162, - 163, 49, 165, 217, 162, 163, 53, 165, 81, 56, - 53, 84, 60, 60, 3, 4, 5, 6, 52, 59, - 52, 206, 59, 57, 8, 57, 189, 160, 58, 102, - 58, 189, 45, 46, 47, 108, 56, 119, 120, 9, - 10, 11, 12, 13, 14, 55, 56, 210, 234, 235, - 236, 3, 210, 67, 68, 56, 49, 190, 8, 50, - 54, 143, 52, 61, 137, 138, 8, 36, 37, 38, - 39, 40, 41, 42, 43, 44, 57, 55, 48, 48, - 56, 55, 8, 49, 57, 53, 57, 52, 161, 162, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 8, - 53, 52, 8, 223, 224, 225, 226, 55, 53, 182, - 48, 52, 52, 48, 0, 52, 0, 237, 214, 55, - 162, 4, 203, 203, 197, 202, 193, 109, 56, 109, - 203, 184, 161, 265, 215, 215, 215, 4, 102, -1, - -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, + 2, 84, 3, 3, 44, 45, 83, 84, 1, 144, + 3, 83, 84, 8, 65, 66, 3, 4, 5, 70, + 71, 3, 4, 5, 4, 18, 19, 158, 4, 160, + 49, 82, 3, 49, 51, 6, 8, 56, 51, 162, + 59, 51, 165, 59, 179, 61, 52, 130, 3, 4, + 5, 6, 7, 130, 52, 12, 62, 205, 130, 18, + 19, 54, 51, 8, 62, 56, 61, 215, 3, 4, + 5, 6, 7, 60, 67, 68, 69, 208, 60, 51, + 60, 158, 217, 160, 60, 168, 158, 210, 160, 52, + 83, 168, 85, 50, 57, 54, 168, 52, 53, 55, + 56, 56, 68, 69, 187, 58, 61, 45, 46, 47, + 187, 104, 3, 4, 5, 187, 167, 110, 53, 121, + 122, 56, 3, 4, 5, 6, 61, 234, 235, 236, + 58, 208, 56, 8, 3, 56, 208, 49, 9, 10, + 11, 12, 13, 14, 146, 8, 50, 140, 141, 36, + 37, 38, 39, 40, 41, 42, 43, 44, 54, 52, + 57, 48, 36, 37, 38, 39, 40, 41, 42, 43, + 44, 55, 62, 55, 8, 8, 169, 48, 57, 57, + 53, 8, 52, 223, 224, 225, 226, 53, 52, 8, + 55, 53, 185, 52, 52, 48, 48, 237, 52, 0, + 0, 56, 214, 195, 205, 205, 199, 4, 204, 111, + 111, 57, 205, 265, 215, 215, 189, 169, 104, 4, + -1, 215, 215, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, -1, -1, 244, 244, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 8, -1, 10, -1, @@ -1270,13 +1270,13 @@ yyreduce: switch (yyn) { case 3: -#line 175 "dcParser.yxx" +#line 176 "dcParser.yxx" { parameter_description = yyvsp[0].u.field; } break; case 6: -#line 184 "dcParser.yxx" +#line 185 "dcParser.yxx" { if (!dc_file->add_class(yyvsp[0].u.dclass)) { DCClass *old_class = dc_file->get_class_by_name(yyvsp[0].u.dclass->get_name()); @@ -1289,7 +1289,7 @@ case 6: } break; case 7: -#line 195 "dcParser.yxx" +#line 196 "dcParser.yxx" { if (!dc_file->add_switch(yyvsp[0].u.dswitch)) { yyerror("Duplicate class name: " + yyvsp[0].u.dswitch->get_name()); @@ -1297,49 +1297,49 @@ case 7: } break; case 11: -#line 207 "dcParser.yxx" +#line 208 "dcParser.yxx" { yyval.str = yyvsp[-2].str + string("/") + yyvsp[0].str; } break; case 13: -#line 215 "dcParser.yxx" +#line 216 "dcParser.yxx" { yyval.str = yyvsp[-2].str + string(".") + yyvsp[0].str; } break; case 14: -#line 222 "dcParser.yxx" +#line 223 "dcParser.yxx" { dc_file->add_import_module(yyvsp[0].str); } break; case 15: -#line 226 "dcParser.yxx" +#line 227 "dcParser.yxx" { dc_file->add_import_module(yyvsp[-1].str); } break; case 18: -#line 235 "dcParser.yxx" +#line 236 "dcParser.yxx" { dc_file->add_import_symbol("*"); } break; case 19: -#line 242 "dcParser.yxx" +#line 243 "dcParser.yxx" { dc_file->add_import_symbol(yyvsp[0].str); } break; case 20: -#line 246 "dcParser.yxx" +#line 247 "dcParser.yxx" { dc_file->add_import_symbol(yyvsp[0].str); } break; case 21: -#line 253 "dcParser.yxx" +#line 254 "dcParser.yxx" { if (yyvsp[0].u.parameter != (DCParameter *)NULL) { DCTypedef *dtypedef = new DCTypedef(yyvsp[0].u.parameter); @@ -1356,21 +1356,21 @@ case 21: } break; case 24: -#line 276 "dcParser.yxx" +#line 277 "dcParser.yxx" { yyval.u.dclass = current_class; current_class = new DCClass(yyvsp[0].str, false, false); } break; case 25: -#line 281 "dcParser.yxx" +#line 282 "dcParser.yxx" { yyval.u.dclass = current_class; current_class = yyvsp[-4].u.dclass; } break; case 26: -#line 289 "dcParser.yxx" +#line 290 "dcParser.yxx" { if (dc_file == (DCFile *)NULL) { yyerror("No DCFile available, so no class names are predefined."); @@ -1392,7 +1392,7 @@ case 26: } break; case 29: -#line 317 "dcParser.yxx" +#line 318 "dcParser.yxx" { if (yyvsp[0].u.dclass != (DCClass *)NULL) { current_class->add_parent(yyvsp[0].u.dclass); @@ -1400,7 +1400,7 @@ case 29: } break; case 30: -#line 323 "dcParser.yxx" +#line 324 "dcParser.yxx" { if (yyvsp[0].u.dclass != (DCClass *)NULL) { current_class->add_parent(yyvsp[0].u.dclass); @@ -1408,7 +1408,7 @@ case 30: } break; case 33: -#line 334 "dcParser.yxx" +#line 335 "dcParser.yxx" { if (yyvsp[0].u.field == (DCField *)NULL) { // Pass this error up. @@ -1420,7 +1420,7 @@ case 33: } break; case 34: -#line 347 "dcParser.yxx" +#line 348 "dcParser.yxx" { if (yyvsp[-1].u.field != (DCField *)NULL) { if (yyvsp[-1].u.field->get_name().empty()) { @@ -1432,7 +1432,7 @@ case 34: } break; case 36: -#line 358 "dcParser.yxx" +#line 359 "dcParser.yxx" { yyerror("Unnamed parameters are not allowed on a dclass"); if (yyvsp[-2].u.parameter != (DCField *)NULL) { @@ -1442,7 +1442,7 @@ case 36: } break; case 37: -#line 366 "dcParser.yxx" +#line 367 "dcParser.yxx" { if (yyvsp[-1].u.parameter != (DCField *)NULL) { yyvsp[-1].u.parameter->set_flags(yyvsp[0].u.s_int); @@ -1451,21 +1451,21 @@ case 37: } break; case 38: -#line 376 "dcParser.yxx" +#line 377 "dcParser.yxx" { yyval.u.dclass = current_class; current_class = new DCClass(yyvsp[0].str, true, false); } break; case 39: -#line 381 "dcParser.yxx" +#line 382 "dcParser.yxx" { yyval.u.dclass = current_class; current_class = yyvsp[-4].u.dclass; } break; case 40: -#line 389 "dcParser.yxx" +#line 390 "dcParser.yxx" { if (dc_file == (DCFile *)NULL) { yyerror("No DCFile available, so no struct names are predefined."); @@ -1487,7 +1487,7 @@ case 40: } break; case 43: -#line 417 "dcParser.yxx" +#line 418 "dcParser.yxx" { if (yyvsp[0].u.dclass != (DCClass *)NULL) { current_class->add_parent(yyvsp[0].u.dclass); @@ -1495,7 +1495,7 @@ case 43: } break; case 44: -#line 423 "dcParser.yxx" +#line 424 "dcParser.yxx" { if (yyvsp[0].u.dclass != (DCClass *)NULL) { current_class->add_parent(yyvsp[0].u.dclass); @@ -1503,7 +1503,7 @@ case 44: } break; case 47: -#line 434 "dcParser.yxx" +#line 435 "dcParser.yxx" { if (yyvsp[0].u.field == (DCField *)NULL) { // Pass this error up. @@ -1513,7 +1513,7 @@ case 47: } break; case 48: -#line 445 "dcParser.yxx" +#line 446 "dcParser.yxx" { if (yyvsp[-1].u.field->get_name().empty()) { yyerror("Field name required."); @@ -1522,33 +1522,33 @@ case 48: } break; case 50: -#line 453 "dcParser.yxx" +#line 454 "dcParser.yxx" { yyval.u.field = yyvsp[-2].u.parameter; } break; case 51: -#line 457 "dcParser.yxx" +#line 458 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.parameter; } break; case 52: -#line 464 "dcParser.yxx" +#line 465 "dcParser.yxx" { yyval.u.field = current_atomic; current_atomic = new DCAtomicField(yyvsp[-1].str); } break; case 53: -#line 469 "dcParser.yxx" +#line 470 "dcParser.yxx" { yyval.u.field = current_atomic; current_atomic = yyvsp[-2].u.atomic; } break; case 58: -#line 487 "dcParser.yxx" +#line 488 "dcParser.yxx" { if (yyvsp[0].u.parameter != (DCParameter *)NULL) { current_atomic->add_element(yyvsp[0].u.parameter); @@ -1556,19 +1556,19 @@ case 58: } break; case 59: -#line 496 "dcParser.yxx" +#line 497 "dcParser.yxx" { current_parameter = yyvsp[0].u.parameter; } break; case 60: -#line 500 "dcParser.yxx" +#line 501 "dcParser.yxx" { yyval.u.parameter = yyvsp[0].u.parameter; } break; case 63: -#line 512 "dcParser.yxx" +#line 513 "dcParser.yxx" { current_packer = &default_packer; current_packer->clear_data(); @@ -1578,7 +1578,7 @@ case 63: } break; case 64: -#line 520 "dcParser.yxx" +#line 521 "dcParser.yxx" { bool is_valid = false; if (yyvsp[-3].u.parameter != (DCField *)NULL) { @@ -1598,7 +1598,7 @@ case 64: } break; case 66: -#line 542 "dcParser.yxx" +#line 543 "dcParser.yxx" { current_packer = &default_packer; current_packer->clear_data(); @@ -1608,7 +1608,7 @@ case 66: } break; case 67: -#line 550 "dcParser.yxx" +#line 551 "dcParser.yxx" { bool is_valid = false; if (yyvsp[-3].u.parameter != (DCField *)NULL) { @@ -1628,33 +1628,34 @@ case 67: } break; case 72: -#line 581 "dcParser.yxx" +#line 582 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.field; } break; case 73: -#line 585 "dcParser.yxx" +#line 586 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.parameter; } break; case 74: -#line 589 "dcParser.yxx" +#line 590 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.parameter; } break; case 75: -#line 596 "dcParser.yxx" +#line 597 "dcParser.yxx" { yyval.u.parameter = new DCSimpleParameter(yyvsp[0].u.subatomic); } break; case 76: -#line 600 "dcParser.yxx" +#line 601 "dcParser.yxx" { - DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-3].u.subatomic); + DCSimpleParameter *simple_param = yyvsp[-3].u.parameter->as_simple_parameter(); + nassertr(simple_param != (DCSimpleParameter *)NULL, 0); if (!simple_param->set_range(double_range)) { yyerror("Inappropriate range for type"); } @@ -1662,52 +1663,39 @@ case 76: } break; case 77: -#line 608 "dcParser.yxx" +#line 610 "dcParser.yxx" { - DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-2].u.subatomic); - if (yyvsp[0].u.s_uint == 0) { - yyerror("Invalid divisor."); + DCSimpleParameter *simple_param = yyvsp[-2].u.parameter->as_simple_parameter(); + nassertr(simple_param != (DCSimpleParameter *)NULL, 0); + if (!simple_param->is_numeric_type()) { + yyerror("A divisor is only valid on a numeric type."); } else if (!simple_param->set_divisor(yyvsp[0].u.s_uint)) { - yyerror("A divisor is only valid on a numeric type."); + yyerror("Invalid divisor."); + + } else if (simple_param->has_modulus() && !simple_param->set_modulus(simple_param->get_modulus())) { + // Changing the divisor may change the valid range for the modulus. + yyerror("Invalid modulus."); } yyval.u.parameter = simple_param; } break; case 78: -#line 619 "dcParser.yxx" -{ - DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-5].u.subatomic); - if (yyvsp[-3].u.s_uint == 0) { - yyerror("Invalid divisor."); - - } else if (!simple_param->set_divisor(yyvsp[-3].u.s_uint)) { +#line 627 "dcParser.yxx" +{ + DCSimpleParameter *simple_param = yyvsp[-2].u.parameter->as_simple_parameter(); + nassertr(simple_param != (DCSimpleParameter *)NULL, 0); + if (!simple_param->is_numeric_type()) { yyerror("A divisor is only valid on a numeric type."); - } - if (!simple_param->set_range(double_range)) { - yyerror("Inappropriate range for type"); - } - yyval.u.parameter = simple_param; -} - break; -case 79: -#line 633 "dcParser.yxx" -{ - DCSimpleParameter *simple_param = new DCSimpleParameter(yyvsp[-5].u.subatomic); - if (yyvsp[0].u.s_uint == 0) { - yyerror("Invalid divisor."); - } else if (!simple_param->set_divisor(yyvsp[0].u.s_uint)) { - yyerror("A divisor is only valid on a numeric type."); - } - if (!simple_param->set_range(double_range)) { - yyerror("Inappropriate range for type"); + } else if (!simple_param->set_modulus(yyvsp[0].u.real)) { + yyerror("Invalid modulus."); } yyval.u.parameter = simple_param; } break; case 80: -#line 647 "dcParser.yxx" +#line 643 "dcParser.yxx" { if (dc_file == (DCFile *)NULL) { yyerror("Invalid type."); @@ -1744,7 +1732,7 @@ case 80: } break; case 81: -#line 682 "dcParser.yxx" +#line 678 "dcParser.yxx" { // This is an inline struct definition. if (yyvsp[0].u.dclass == (DCClass *)NULL) { @@ -1762,7 +1750,7 @@ case 81: } break; case 82: -#line 698 "dcParser.yxx" +#line 694 "dcParser.yxx" { // This is an inline switch definition. if (yyvsp[0].u.dswitch == (DCSwitch *)NULL) { @@ -1780,13 +1768,13 @@ case 82: } break; case 83: -#line 717 "dcParser.yxx" +#line 713 "dcParser.yxx" { double_range.clear(); } break; case 84: -#line 721 "dcParser.yxx" +#line 717 "dcParser.yxx" { double_range.clear(); if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { @@ -1795,7 +1783,7 @@ case 84: } break; case 85: -#line 728 "dcParser.yxx" +#line 724 "dcParser.yxx" { double_range.clear(); if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { @@ -1804,7 +1792,7 @@ case 85: } break; case 86: -#line 735 "dcParser.yxx" +#line 731 "dcParser.yxx" { double_range.clear(); if (yyvsp[0].u.real >= 0) { @@ -1815,7 +1803,7 @@ case 86: } break; case 87: -#line 744 "dcParser.yxx" +#line 740 "dcParser.yxx" { if (!double_range.add_range(yyvsp[0].u.real, yyvsp[0].u.real)) { yyerror("Overlapping range"); @@ -1823,7 +1811,7 @@ case 87: } break; case 88: -#line 750 "dcParser.yxx" +#line 746 "dcParser.yxx" { if (!double_range.add_range(yyvsp[-2].u.real, yyvsp[0].u.real)) { yyerror("Overlapping range"); @@ -1831,7 +1819,7 @@ case 88: } break; case 89: -#line 756 "dcParser.yxx" +#line 752 "dcParser.yxx" { if (yyvsp[0].u.real >= 0) { yyerror("Syntax error"); @@ -1841,13 +1829,13 @@ case 89: } break; case 90: -#line 767 "dcParser.yxx" +#line 763 "dcParser.yxx" { uint_range.clear(); } break; case 91: -#line 771 "dcParser.yxx" +#line 767 "dcParser.yxx" { uint_range.clear(); if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { @@ -1856,7 +1844,7 @@ case 91: } break; case 92: -#line 778 "dcParser.yxx" +#line 774 "dcParser.yxx" { uint_range.clear(); if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { @@ -1865,7 +1853,7 @@ case 92: } break; case 93: -#line 785 "dcParser.yxx" +#line 781 "dcParser.yxx" { uint_range.clear(); if (!uint_range.add_range(yyvsp[-1].u.s_uint, yyvsp[0].u.s_uint)) { @@ -1874,7 +1862,7 @@ case 93: } break; case 94: -#line 792 "dcParser.yxx" +#line 788 "dcParser.yxx" { if (!uint_range.add_range(yyvsp[0].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); @@ -1882,7 +1870,7 @@ case 94: } break; case 95: -#line 798 "dcParser.yxx" +#line 794 "dcParser.yxx" { if (!uint_range.add_range(yyvsp[-2].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); @@ -1890,7 +1878,7 @@ case 95: } break; case 96: -#line 804 "dcParser.yxx" +#line 800 "dcParser.yxx" { if (!uint_range.add_range(yyvsp[-1].u.s_uint, yyvsp[0].u.s_uint)) { yyerror("Overlapping range"); @@ -1898,7 +1886,7 @@ case 96: } break; case 98: -#line 814 "dcParser.yxx" +#line 810 "dcParser.yxx" { if (yyvsp[-3].u.parameter == (DCParameter *)NULL) { yyval.u.parameter = NULL; @@ -1908,36 +1896,54 @@ case 98: } break; case 99: -#line 825 "dcParser.yxx" +#line 821 "dcParser.yxx" { current_parameter->set_name(yyvsp[0].str); yyval.u.parameter = current_parameter; } break; case 100: -#line 830 "dcParser.yxx" +#line 826 "dcParser.yxx" { - if (yyvsp[0].u.s_uint == 0) { - yyerror("Invalid divisor."); - - } else if (yyvsp[-2].u.parameter->as_simple_parameter() == NULL || yyvsp[-2].u.parameter->get_typedef() != (DCTypedef *)NULL) { + DCSimpleParameter *simple_param = yyvsp[-2].u.parameter->as_simple_parameter(); + if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) { yyerror("A divisor is only allowed on a primitive type."); - } else { - if (!yyvsp[-2].u.parameter->as_simple_parameter()->set_divisor(yyvsp[0].u.s_uint)) { + } else if (!simple_param->is_numeric_type()) { yyerror("A divisor is only valid on a numeric type."); + + } else { + if (!simple_param->set_divisor(yyvsp[0].u.s_uint)) { + yyerror("Invalid divisor."); } } } break; case 101: -#line 844 "dcParser.yxx" +#line 841 "dcParser.yxx" +{ + DCSimpleParameter *simple_param = yyvsp[-2].u.parameter->as_simple_parameter(); + if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) { + yyerror("A modulus is only allowed on a primitive type."); + + } else if (!simple_param->is_numeric_type()) { + yyerror("A modulus is only valid on a numeric type."); + + } else { + if (!simple_param->set_modulus(yyvsp[0].u.real)) { + yyerror("Invalid modulus."); + } + } +} + break; +case 102: +#line 856 "dcParser.yxx" { yyval.u.parameter = new DCArrayParameter(yyvsp[-3].u.parameter, uint_range); } break; -case 102: -#line 851 "dcParser.yxx" +case 103: +#line 863 "dcParser.yxx" { if (yyvsp[0].str.length() != 1) { yyerror("Single character required."); @@ -1947,8 +1953,8 @@ case 102: } } break; -case 104: -#line 864 "dcParser.yxx" +case 105: +#line 876 "dcParser.yxx" { yyval.u.s_uint = (unsigned int)yyvsp[0].u.uint64; if (yyval.u.s_uint != yyvsp[0].u.uint64) { @@ -1957,8 +1963,8 @@ case 104: } } break; -case 105: -#line 875 "dcParser.yxx" +case 106: +#line 887 "dcParser.yxx" { yyval.u.s_uint = (unsigned int)-yyvsp[0].u.int64; if (yyvsp[0].u.int64 >= 0) { @@ -1970,20 +1976,20 @@ case 105: } } break; -case 108: -#line 897 "dcParser.yxx" +case 109: +#line 909 "dcParser.yxx" { yyval.u.real = (double)yyvsp[0].u.uint64; } break; -case 109: -#line 901 "dcParser.yxx" +case 110: +#line 913 "dcParser.yxx" { yyval.u.real = (double)yyvsp[0].u.int64; } break; -case 111: -#line 909 "dcParser.yxx" +case 112: +#line 921 "dcParser.yxx" { if (yyvsp[0].str.length() != 1) { yyerror("Single character required."); @@ -1993,286 +1999,286 @@ case 111: } } break; -case 113: -#line 923 "dcParser.yxx" +case 114: +#line 935 "dcParser.yxx" { current_packer->pack_int64(yyvsp[0].u.int64); } break; -case 114: -#line 927 "dcParser.yxx" +case 115: +#line 939 "dcParser.yxx" { current_packer->pack_uint64(yyvsp[0].u.uint64); } break; -case 115: -#line 931 "dcParser.yxx" +case 116: +#line 943 "dcParser.yxx" { current_packer->pack_double(yyvsp[0].u.real); } break; -case 116: -#line 935 "dcParser.yxx" +case 117: +#line 947 "dcParser.yxx" { current_packer->pack_string(yyvsp[0].str); } break; -case 117: -#line 939 "dcParser.yxx" +case 118: +#line 951 "dcParser.yxx" { current_packer->pack_literal_value(yyvsp[0].str); } break; -case 118: -#line 943 "dcParser.yxx" +case 119: +#line 955 "dcParser.yxx" { current_packer->push(); } break; -case 119: -#line 947 "dcParser.yxx" -{ - current_packer->pop(); -} - break; case 120: -#line 951 "dcParser.yxx" +#line 959 "dcParser.yxx" { - current_packer->push(); + current_packer->pop(); } break; case 121: -#line 955 "dcParser.yxx" -{ - current_packer->pop(); -} - break; -case 122: -#line 959 "dcParser.yxx" +#line 963 "dcParser.yxx" { current_packer->push(); } break; -case 123: -#line 963 "dcParser.yxx" +case 122: +#line 967 "dcParser.yxx" { current_packer->pop(); } break; +case 123: +#line 971 "dcParser.yxx" +{ + current_packer->push(); +} + break; case 124: -#line 967 "dcParser.yxx" +#line 975 "dcParser.yxx" +{ + current_packer->pop(); +} + break; +case 125: +#line 979 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_int64(yyvsp[-2].u.int64); } } break; -case 125: -#line 973 "dcParser.yxx" +case 126: +#line 985 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_uint64(yyvsp[-2].u.uint64); } } break; -case 126: -#line 979 "dcParser.yxx" +case 127: +#line 991 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_double(yyvsp[-2].u.real); } } break; -case 127: -#line 985 "dcParser.yxx" +case 128: +#line 997 "dcParser.yxx" { for (unsigned int i = 0; i < yyvsp[0].u.s_uint; i++) { current_packer->pack_literal_value(yyvsp[-2].str); } } break; -case 134: -#line 1009 "dcParser.yxx" +case 135: +#line 1021 "dcParser.yxx" { yyval.u.subatomic = ST_int8; } break; -case 135: -#line 1013 "dcParser.yxx" +case 136: +#line 1025 "dcParser.yxx" { yyval.u.subatomic = ST_int16; } break; -case 136: -#line 1017 "dcParser.yxx" +case 137: +#line 1029 "dcParser.yxx" { yyval.u.subatomic = ST_int32; } break; -case 137: -#line 1021 "dcParser.yxx" +case 138: +#line 1033 "dcParser.yxx" { yyval.u.subatomic = ST_int64; } break; -case 138: -#line 1025 "dcParser.yxx" +case 139: +#line 1037 "dcParser.yxx" { yyval.u.subatomic = ST_uint8; } break; -case 139: -#line 1029 "dcParser.yxx" +case 140: +#line 1041 "dcParser.yxx" { yyval.u.subatomic = ST_uint16; } break; -case 140: -#line 1033 "dcParser.yxx" +case 141: +#line 1045 "dcParser.yxx" { yyval.u.subatomic = ST_uint32; } break; -case 141: -#line 1037 "dcParser.yxx" +case 142: +#line 1049 "dcParser.yxx" { yyval.u.subatomic = ST_uint64; } break; -case 142: -#line 1041 "dcParser.yxx" +case 143: +#line 1053 "dcParser.yxx" { yyval.u.subatomic = ST_float64; } break; -case 143: -#line 1045 "dcParser.yxx" +case 144: +#line 1057 "dcParser.yxx" { yyval.u.subatomic = ST_string; } break; -case 144: -#line 1049 "dcParser.yxx" +case 145: +#line 1061 "dcParser.yxx" { yyval.u.subatomic = ST_blob; } break; -case 145: -#line 1053 "dcParser.yxx" +case 146: +#line 1065 "dcParser.yxx" { yyval.u.subatomic = ST_blob32; } break; -case 146: -#line 1057 "dcParser.yxx" +case 147: +#line 1069 "dcParser.yxx" { yyval.u.subatomic = ST_int8array; } break; -case 147: -#line 1061 "dcParser.yxx" +case 148: +#line 1073 "dcParser.yxx" { yyval.u.subatomic = ST_int16array; } break; -case 148: -#line 1065 "dcParser.yxx" +case 149: +#line 1077 "dcParser.yxx" { yyval.u.subatomic = ST_int32array; } break; -case 149: -#line 1069 "dcParser.yxx" +case 150: +#line 1081 "dcParser.yxx" { yyval.u.subatomic = ST_uint8array; } break; -case 150: -#line 1073 "dcParser.yxx" +case 151: +#line 1085 "dcParser.yxx" { yyval.u.subatomic = ST_uint16array; } break; -case 151: -#line 1077 "dcParser.yxx" +case 152: +#line 1089 "dcParser.yxx" { yyval.u.subatomic = ST_uint32array; } break; -case 152: -#line 1081 "dcParser.yxx" +case 153: +#line 1093 "dcParser.yxx" { yyval.u.subatomic = ST_uint32uint8array; } break; -case 153: -#line 1085 "dcParser.yxx" +case 154: +#line 1097 "dcParser.yxx" { yyval.u.subatomic = ST_char; } break; -case 154: -#line 1092 "dcParser.yxx" +case 155: +#line 1104 "dcParser.yxx" { yyval.u.s_int = 0; } break; -case 155: -#line 1096 "dcParser.yxx" +case 156: +#line 1108 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_required; } break; -case 156: -#line 1100 "dcParser.yxx" +case 157: +#line 1112 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_broadcast; } break; -case 157: -#line 1104 "dcParser.yxx" +case 158: +#line 1116 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_p2p; } break; -case 158: -#line 1108 "dcParser.yxx" +case 159: +#line 1120 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_ram; } break; -case 159: -#line 1112 "dcParser.yxx" +case 160: +#line 1124 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_db; } break; -case 160: -#line 1116 "dcParser.yxx" +case 161: +#line 1128 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_clsend; } break; -case 161: -#line 1120 "dcParser.yxx" +case 162: +#line 1132 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_clrecv; } break; -case 162: -#line 1124 "dcParser.yxx" +case 163: +#line 1136 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_ownsend; } break; -case 163: -#line 1128 "dcParser.yxx" +case 164: +#line 1140 "dcParser.yxx" { yyval.u.s_int = yyvsp[-1].u.s_int | DCAtomicField::F_airecv; } break; -case 164: -#line 1135 "dcParser.yxx" +case 165: +#line 1147 "dcParser.yxx" { if (yyvsp[0].u.s_int != 0) { yyerror("Server flags are not allowed here."); @@ -2280,20 +2286,20 @@ case 164: yyval.u.s_int = yyvsp[0].u.s_int; } break; -case 165: -#line 1145 "dcParser.yxx" +case 166: +#line 1157 "dcParser.yxx" { current_molecular = new DCMolecularField(yyvsp[-1].str); } break; -case 166: -#line 1149 "dcParser.yxx" +case 167: +#line 1161 "dcParser.yxx" { yyval.u.field = current_molecular; } break; -case 167: -#line 1156 "dcParser.yxx" +case 168: +#line 1168 "dcParser.yxx" { DCField *field = current_class->get_field_by_name(yyvsp[0].str); yyval.u.atomic = (DCAtomicField *)NULL; @@ -2307,16 +2313,16 @@ case 167: } } break; -case 168: -#line 1172 "dcParser.yxx" +case 169: +#line 1184 "dcParser.yxx" { if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { current_molecular->add_atomic(yyvsp[0].u.atomic); } } break; -case 169: -#line 1178 "dcParser.yxx" +case 170: +#line 1190 "dcParser.yxx" { if (yyvsp[0].u.atomic != (DCAtomicField *)NULL) { current_molecular->add_atomic(yyvsp[0].u.atomic); @@ -2328,28 +2334,28 @@ case 169: } } break; -case 170: -#line 1192 "dcParser.yxx" +case 171: +#line 1204 "dcParser.yxx" { yyval.str = ""; } break; -case 172: -#line 1200 "dcParser.yxx" +case 173: +#line 1212 "dcParser.yxx" { yyval.u.dswitch = current_switch; current_switch = new DCSwitch(yyvsp[-4].str, yyvsp[-2].u.parameter); } break; -case 173: -#line 1205 "dcParser.yxx" +case 174: +#line 1217 "dcParser.yxx" { yyval.u.dswitch = current_switch; current_switch = (DCSwitch *)yyvsp[-2].u.parameter; } break; -case 177: -#line 1217 "dcParser.yxx" +case 178: +#line 1229 "dcParser.yxx" { if (current_switch->get_num_cases() == 0) { yyerror("case declaration required before first element"); @@ -2360,16 +2366,16 @@ case 177: } } break; -case 178: -#line 1230 "dcParser.yxx" +case 179: +#line 1242 "dcParser.yxx" { current_packer = &default_packer; current_packer->clear_data(); current_packer->begin_pack(current_switch->get_key_parameter()); } break; -case 179: -#line 1236 "dcParser.yxx" +case 180: +#line 1248 "dcParser.yxx" { if (!current_packer->end_pack()) { yyerror("Invalid value for switch parameter"); @@ -2378,14 +2384,14 @@ case 179: } } break; -case 180: -#line 1247 "dcParser.yxx" +case 181: +#line 1259 "dcParser.yxx" { yyval.u.field = yyvsp[-1].u.parameter; } break; -case 181: -#line 1251 "dcParser.yxx" +case 182: +#line 1263 "dcParser.yxx" { yyval.u.field = yyvsp[0].u.parameter; } @@ -2623,4 +2629,4 @@ yyreturn: #endif return yyresult; } -#line 1259 "dcParser.yxx" +#line 1271 "dcParser.yxx" diff --git a/direct/src/dcparser/dcParser.yxx b/direct/src/dcparser/dcParser.yxx index ff17cc93da..8c708c9de6 100644 --- a/direct/src/dcparser/dcParser.yxx +++ b/direct/src/dcparser/dcParser.yxx @@ -146,6 +146,7 @@ dc_cleanup_parser() { %type atomic_field %type molecular_field %type type_token +%type simple_type_name %type type_name %type type_definition %type named_parameter @@ -591,58 +592,53 @@ parameter_description: } ; -type_name: - type_token +simple_type_name: + type_token { $$ = new DCSimpleParameter($1); } - | type_token '(' double_range ')' + | simple_type_name '(' double_range ')' { - DCSimpleParameter *simple_param = new DCSimpleParameter($1); + DCSimpleParameter *simple_param = $1->as_simple_parameter(); + nassertr(simple_param != (DCSimpleParameter *)NULL, 0); if (!simple_param->set_range(double_range)) { yyerror("Inappropriate range for type"); } $$ = simple_param; } - | type_token '/' small_unsigned_integer + | simple_type_name '/' small_unsigned_integer { - DCSimpleParameter *simple_param = new DCSimpleParameter($1); - if ($3 == 0) { - yyerror("Invalid divisor."); + DCSimpleParameter *simple_param = $1->as_simple_parameter(); + nassertr(simple_param != (DCSimpleParameter *)NULL, 0); + if (!simple_param->is_numeric_type()) { + yyerror("A divisor is only valid on a numeric type."); } else if (!simple_param->set_divisor($3)) { - yyerror("A divisor is only valid on a numeric type."); - } - $$ = simple_param; -} - | type_token '/' small_unsigned_integer '(' double_range ')' -{ - DCSimpleParameter *simple_param = new DCSimpleParameter($1); - if ($3 == 0) { yyerror("Invalid divisor."); - } else if (!simple_param->set_divisor($3)) { - yyerror("A divisor is only valid on a numeric type."); - } - if (!simple_param->set_range(double_range)) { - yyerror("Inappropriate range for type"); + } else if (simple_param->has_modulus() && !simple_param->set_modulus(simple_param->get_modulus())) { + // Changing the divisor may change the valid range for the modulus. + yyerror("Invalid modulus."); } $$ = simple_param; } - | type_token '(' double_range ')' '/' small_unsigned_integer -{ - DCSimpleParameter *simple_param = new DCSimpleParameter($1); - if ($6 == 0) { - yyerror("Invalid divisor."); + ; + | simple_type_name '%' number +{ + DCSimpleParameter *simple_param = $1->as_simple_parameter(); + nassertr(simple_param != (DCSimpleParameter *)NULL, 0); + if (!simple_param->is_numeric_type()) { + yyerror("A divisor is only valid on a numeric type."); - } else if (!simple_param->set_divisor($6)) { - yyerror("A divisor is only valid on a numeric type."); - } - if (!simple_param->set_range(double_range)) { - yyerror("Inappropriate range for type"); + } else if (!simple_param->set_modulus($3)) { + yyerror("Invalid modulus."); } $$ = simple_param; } + ; + +type_name: + simple_type_name | IDENTIFIER { if (dc_file == (DCFile *)NULL) { @@ -828,15 +824,31 @@ parameter_definition: } | parameter_definition '/' small_unsigned_integer { - if ($3 == 0) { - yyerror("Invalid divisor."); - - } else if ($1->as_simple_parameter() == NULL || $1->get_typedef() != (DCTypedef *)NULL) { + DCSimpleParameter *simple_param = $1->as_simple_parameter(); + if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) { yyerror("A divisor is only allowed on a primitive type."); - } else { - if (!$1->as_simple_parameter()->set_divisor($3)) { + } else if (!simple_param->is_numeric_type()) { yyerror("A divisor is only valid on a numeric type."); + + } else { + if (!simple_param->set_divisor($3)) { + yyerror("Invalid divisor."); + } + } +} + | parameter_definition '%' number +{ + DCSimpleParameter *simple_param = $1->as_simple_parameter(); + if (simple_param == NULL || simple_param->get_typedef() != (DCTypedef *)NULL) { + yyerror("A modulus is only allowed on a primitive type."); + + } else if (!simple_param->is_numeric_type()) { + yyerror("A modulus is only valid on a numeric type."); + + } else { + if (!simple_param->set_modulus($3)) { + yyerror("Invalid modulus."); } } } diff --git a/direct/src/dcparser/dcSimpleParameter.cxx b/direct/src/dcparser/dcSimpleParameter.cxx index c600942220..0ba37a8f48 100644 --- a/direct/src/dcparser/dcSimpleParameter.cxx +++ b/direct/src/dcparser/dcSimpleParameter.cxx @@ -36,7 +36,8 @@ DCClassParameter *DCSimpleParameter::_uint32uint8_type = NULL; DCSimpleParameter:: DCSimpleParameter(DCSubatomicType type, unsigned int divisor) : _type(type), - _divisor(1) + _divisor(1), + _has_modulus(false) { _pack_type = PT_invalid; _nested_type = ST_invalid; @@ -210,11 +211,17 @@ DCSimpleParameter(const DCSimpleParameter ©) : _divisor(copy._divisor), _nested_field(copy._nested_field), _bytes_per_element(copy._bytes_per_element), + _orig_range(copy._orig_range), + _has_modulus(copy._has_modulus), + _orig_modulus(copy._orig_modulus), _int_range(copy._int_range), _uint_range(copy._uint_range), _int64_range(copy._int64_range), _uint64_range(copy._uint64_range), - _double_range(copy._double_range) + _double_range(copy._double_range), + _uint_modulus(copy._uint_modulus), + _uint64_modulus(copy._uint64_modulus), + _double_modulus(copy._double_modulus) { } @@ -271,6 +278,33 @@ get_type() const { return _type; } +//////////////////////////////////////////////////////////////////// +// Function: DCSimpleParameter::has_modulus +// Access: Published +// Description: Returns true if there is a modulus associated, false +// otherwise., +//////////////////////////////////////////////////////////////////// +bool DCSimpleParameter:: +has_modulus() const { + return _has_modulus; +} + +//////////////////////////////////////////////////////////////////// +// Function: DCSimpleParameter::get_modulus +// Access: Published +// Description: Returns the modulus associated with this type, if +// any. It is an error to call this if has_modulus() +// returned false. +// +// If present, this is the modulus that is used to +// constrain the numeric value of the field before it is +// packed (and range-checked). +//////////////////////////////////////////////////////////////////// +double DCSimpleParameter:: +get_modulus() const { + return _orig_modulus; +} + //////////////////////////////////////////////////////////////////// // Function: DCSimpleParameter::get_divisor // Access: Published @@ -286,12 +320,97 @@ get_divisor() const { return _divisor; } +//////////////////////////////////////////////////////////////////// +// Function: DCSimpleParameter::is_numeric_type +// Access: Public +// Description: Returns true if the type is a numeric type (and +// therefore can accept a divisor and/or a modulus), or +// false if it is some string-based type. +//////////////////////////////////////////////////////////////////// +bool DCSimpleParameter:: +is_numeric_type() const { + return !(_pack_type == PT_string || _pack_type == PT_blob); +} + +//////////////////////////////////////////////////////////////////// +// Function: DCSimpleParameter::set_modulus +// Access: Public +// Description: Assigns the indicated modulus to the simple type. +// Any packed value will be constrained to be within [0, +// modulus). +// +// Returns true if assigned, false if this type cannot +// accept a modulus or if the modulus is invalid. +//////////////////////////////////////////////////////////////////// +bool DCSimpleParameter:: +set_modulus(double modulus) { + if (_pack_type == PT_string || _pack_type == PT_blob || modulus <= 0.0) { + return false; + } + + _has_modulus = true; + _orig_modulus = modulus; + + bool range_error = false; + _double_modulus = modulus * _divisor; + _uint64_modulus = (PN_uint64)floor(_double_modulus + 0.5); + _uint_modulus = (unsigned int)_uint64_modulus; + + // Check the range. The legitimate range for a modulus value is 1 + // through (maximum_value + 1). + switch (_type) { + case ST_int8: + case ST_int8array: + validate_uint64_limits(_uint64_modulus - 1, 7, range_error); + break; + + case ST_int16: + case ST_int16array: + validate_uint64_limits(_uint64_modulus - 1, 15, range_error); + break; + + case ST_int32: + case ST_int32array: + validate_uint64_limits(_uint64_modulus - 1, 31, range_error); + break; + + case ST_int64: + validate_uint64_limits(_uint64_modulus - 1, 63, range_error); + break; + + case ST_char: + case ST_uint8: + case ST_uint8array: + validate_uint64_limits(_uint64_modulus - 1, 8, range_error); + break; + + case ST_uint16: + case ST_uint16array: + validate_uint64_limits(_uint64_modulus - 1, 16, range_error); + break; + + case ST_uint32: + case ST_uint32array: + validate_uint64_limits(_uint64_modulus - 1, 32, range_error); + break; + + case ST_uint64: + case ST_float64: + break; + + default: + return false; + } + + return !range_error; +} + //////////////////////////////////////////////////////////////////// // Function: DCSimpleParameter::set_divisor // Access: Public // Description: Assigns the indicated divisor to the simple type. // Returns true if assigned, false if this type cannot -// accept a divisor. +// accept a divisor or if the divisor is invalid. //////////////////////////////////////////////////////////////////// bool DCSimpleParameter:: set_divisor(unsigned int divisor) { @@ -306,6 +425,13 @@ set_divisor(unsigned int divisor) { _pack_type = PT_double; } + if (_has_range_limits) { + set_range(_orig_range); + } + if (_has_modulus) { + set_modulus(_orig_modulus); + } + return true; } @@ -326,6 +452,7 @@ set_range(const DCDoubleRange &range) { int i; _has_range_limits = (num_ranges != 0); + _orig_range = range; switch (_type) { case ST_int8: @@ -523,6 +650,16 @@ void DCSimpleParameter:: pack_double(DCPackData &pack_data, double value, bool &pack_error, bool &range_error) const { double real_value = value * _divisor; + if (_has_modulus) { + if (real_value < 0.0) { + real_value = _double_modulus - fmod(-real_value, _double_modulus); + if (real_value == _double_modulus) { + real_value = 0.0; + } + } else { + real_value = fmod(real_value, _double_modulus); + } + } switch (_type) { case ST_int8: @@ -614,6 +751,13 @@ void DCSimpleParameter:: pack_int(DCPackData &pack_data, int value, bool &pack_error, bool &range_error) const { int int_value = value * _divisor; + if (_has_modulus && _uint_modulus != 0) { + if (int_value < 0) { + int_value = _uint_modulus - 1 - (-int_value - 1) % _uint_modulus; + } else { + int_value = int_value % _uint_modulus; + } + } switch (_type) { case ST_int8: @@ -693,6 +837,9 @@ void DCSimpleParameter:: pack_uint(DCPackData &pack_data, unsigned int value, bool &pack_error, bool &range_error) const { unsigned int int_value = value * _divisor; + if (_has_modulus && _uint_modulus != 0) { + int_value = int_value % _uint_modulus; + } switch (_type) { case ST_int8: @@ -772,6 +919,13 @@ void DCSimpleParameter:: pack_int64(DCPackData &pack_data, PN_int64 value, bool &pack_error, bool &range_error) const { PN_int64 int_value = value * _divisor; + if (_has_modulus && _uint64_modulus != 0) { + if (int_value < 0) { + int_value = _uint64_modulus - 1 - (-int_value - 1) % _uint64_modulus; + } else { + int_value = int_value % _uint64_modulus; + } + } switch (_type) { case ST_int8: @@ -853,6 +1007,9 @@ void DCSimpleParameter:: pack_uint64(DCPackData &pack_data, PN_uint64 value, bool &pack_error, bool &range_error) const { PN_uint64 int_value = value * _divisor; + if (_has_modulus && _uint64_modulus != 0) { + int_value = int_value % _uint64_modulus; + } switch (_type) { case ST_int8: @@ -2113,6 +2270,9 @@ output_instance(ostream &out, bool brief, const string &prename, } else { out << _type; + if (_has_modulus) { + out << "%" << _orig_modulus; + } if (_divisor != 1) { out << "/" << _divisor; } @@ -2193,6 +2353,9 @@ generate_hash(HashGenerator &hashgen) const { hashgen.add_int(_type); hashgen.add_int(_divisor); + if (_has_modulus) { + hashgen.add_int((int)_double_modulus); + } _int_range.generate_hash(hashgen); _int64_range.generate_hash(hashgen); diff --git a/direct/src/dcparser/dcSimpleParameter.h b/direct/src/dcparser/dcSimpleParameter.h index f46d1fbc4a..28e6724dff 100644 --- a/direct/src/dcparser/dcSimpleParameter.h +++ b/direct/src/dcparser/dcSimpleParameter.h @@ -45,9 +45,13 @@ PUBLISHED: virtual bool is_valid() const; DCSubatomicType get_type() const; + bool has_modulus() const; + double get_modulus() const; int get_divisor() const; public: + bool is_numeric_type() const; + bool set_modulus(double modulus); bool set_divisor(unsigned int divisor); bool set_range(const DCDoubleRange &range); @@ -114,12 +118,25 @@ private: typedef pmap NestedFieldMap; static NestedFieldMap _nested_field_map; + // These are the range and modulus values as specified by the user, + // unscaled by the divisor. + DCDoubleRange _orig_range; + bool _has_modulus; + double _orig_modulus; + + // Only the range appropriate to this type will be filled in. DCIntRange _int_range; DCUnsignedIntRange _uint_range; DCInt64Range _int64_range; DCUnsignedInt64Range _uint64_range; DCDoubleRange _double_range; + // All of these modulus values will be filled in, regardless of the + // type. + unsigned int _uint_modulus; + PN_uint64 _uint64_modulus; + double _double_modulus; + static DCClassParameter *_uint32uint8_type; };