/* A Bison parser, made from sl.y by GNU Bison version 1.25 */ #define YYBISON 1 /* Identify Bison output. */ #define alloca #define SL_SURFACE 258 #define SL_DISPLACEMENT 259 #define SL_LIGHT 260 #define SL_VOLUME 261 #define SL_TRANSFORMATION 262 #define SL_IMAGER 263 #define SL_FOR 264 #define SL_WHILE 265 #define SL_IF 266 #define SL_ELSE 267 #define SL_BREAK 268 #define SL_CONTINUE 269 #define SL_ILLUMINANCE 270 #define SL_ILLUMINATE 271 #define SL_SOLAR 272 #define SL_RETURN 273 #define SL_VOID 274 #define SL_LIGHTSOURCE 275 #define SL_FCN_PI 276 #define SL_IDENTIFIER_VALUE 277 #define SL_FLOAT_VALUE 278 #define SL_COMMA 279 #define SL_SEMI_COLON 280 #define SL_OPEN_PARANTHESIS 281 #define SL_CLOSE_PARANTHESIS 282 #define SL_OPEN_CRL_PARANTHESIS 283 #define SL_CLOSE_CRL_PARANTHESIS 284 #define SL_OPEN_SQR_PARANTHESIS 285 #define SL_CLOSE_SQR_PARANTHESIS 286 #define SL_TEXTURE 287 #define SL_SHADOW 288 #define SL_ENVIRONMENT 289 #define SL_BUMP 290 #define SL_TEXT_VALUE 291 #define SL_FLOAT 292 #define SL_COLOR 293 #define SL_POINT 294 #define SL_VECTOR 295 #define SL_NORMAL 296 #define SL_MATRIX 297 #define SL_STRING 298 #define SL_COMP_EQUAL 299 #define SL_COMP_DIFFERENT 300 #define SL_COMP_GREATER 301 #define SL_COMP_GREATER_EQUAL 302 #define SL_COMP_LESS 303 #define SL_COMP_LESS_EQUAL 304 #define SL_EQUAL 305 #define SL_INCREMENT 306 #define SL_DECREMENT 307 #define SL_INCREMENT_BY 308 #define SL_DECREMENT_BY 309 #define SL_MULTIPLY_BY 310 #define SL_DIVIDE_BY 311 #define SL_PLUS 312 #define SL_MINUS 313 #define SL_CROSS 314 #define SL_DIVIDE 315 #define SL_MULTIPLY 316 #define SL_DOT 317 #define SL_OR 318 #define SL_AND 319 #define SL_NOT 320 #define SL_QUESTION 321 #define SL_COLON 322 #define SL_OUTPUT 323 #define SL_EXTERN 324 #define SL_UNIFORM 325 #define SL_VARIABLE 326 #line 29 "sl.y" #undef alloca ////////////////////////////////////////////////////////////////////////// // Misc C definitions ////////////////////////////////////////////////////////////////////////// #include "common/str.h" #include "opcodes.h" #include "sdr.h" void yyerror(char *); // Forward definition for stupid yacc int yylex(void ); // Forward definition for stupid yacc ////////////////////////////////////////////////////////////////////////// // Here's the only global CVariable ////////////////////////////////////////////////////////////////////////// CScriptContext *sdr; ////////////////////////////////////////////////////////////////////////// #line 50 "sl.y" typedef union { char *string; CExpression *code; CExpression *expression; float real; int integer; } YYSTYPE; #include #ifndef __cplusplus #ifndef __STDC__ #define const #endif #endif #define YYFINAL 405 #define YYFLAG 32768 #define YYNTBASE 72 #define YYTRANSLATE(x) ((unsigned)(x) <= 326 ? yytranslate[x] : 161) 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, 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, 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, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71 }; #if YYDEBUG != 0 static const short yyprhs[] = { 0, 0, 1, 4, 6, 8, 9, 11, 12, 14, 15, 17, 19, 21, 23, 25, 27, 29, 34, 37, 39, 43, 47, 52, 54, 55, 59, 62, 64, 65, 69, 70, 75, 77, 78, 85, 86, 94, 98, 103, 104, 105, 114, 116, 118, 120, 122, 124, 126, 128, 129, 133, 136, 138, 141, 144, 145, 150, 151, 155, 156, 164, 165, 172, 173, 175, 179, 180, 185, 188, 191, 192, 196, 197, 202, 203, 210, 211, 219, 222, 224, 226, 228, 230, 233, 234, 236, 238, 240, 243, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 267, 269, 271, 273, 275, 277, 279, 281, 285, 288, 292, 295, 299, 302, 307, 310, 313, 314, 319, 320, 328, 329, 334, 335, 340, 343, 346, 347, 352, 353, 358, 360, 370, 380, 382, 383, 387, 389, 391, 392, 394, 395, 399, 401, 405, 407, 415, 421, 429, 431, 437, 445, 455, 467, 473, 481, 491, 503, 509, 519, 525, 535, 540, 548, 553, 561, 563, 567, 571, 575, 579, 580, 585, 589, 592, 595, 601, 603, 605, 607, 609, 611, 613, 618, 620, 622, 630, 664, 668, 671, 675, 679, 683, 687, 691, 695, 699, 703, 707, 711, 715, 719, 722, 724, 725, 731, 738, 748, 755, 765, 767, 769, 771, 773, 775, 776, 777, 782 }; static const short yyrhs[] = { -1, 73, 79, 0, 70, 0, 71, 0, 0, 69, 0, 0, 68, 0, 0, 37, 0, 38, 0, 40, 0, 41, 0, 39, 0, 42, 0, 43, 0, 75, 76, 74, 77, 0, 81, 79, 0, 90, 0, 78, 22, 26, 0, 19, 22, 26, 0, 80, 82, 27, 104, 0, 83, 0, 0, 84, 25, 83, 0, 84, 25, 0, 84, 0, 0, 78, 85, 86, 0, 0, 22, 87, 24, 86, 0, 22, 0, 0, 22, 30, 31, 88, 24, 86, 0, 0, 22, 30, 23, 31, 89, 24, 86, 0, 22, 30, 31, 0, 22, 30, 23, 31, 0, 0, 0, 93, 22, 26, 91, 94, 27, 92, 104, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0, 8, 0, 95, 0, 0, 96, 25, 95, 0, 96, 25, 0, 96, 0, 78, 103, 0, 50, 149, 0, 0, 22, 24, 99, 98, 0, 0, 22, 100, 97, 0, 0, 22, 30, 23, 31, 24, 101, 98, 0, 0, 22, 30, 23, 31, 102, 97, 0, 0, 98, 0, 98, 24, 103, 0, 0, 28, 105, 115, 29, 0, 78, 108, 0, 50, 149, 0, 0, 22, 109, 113, 0, 0, 22, 110, 107, 113, 0, 0, 22, 30, 23, 31, 111, 113, 0, 0, 22, 30, 23, 31, 112, 107, 113, 0, 24, 108, 0, 25, 0, 117, 0, 116, 0, 1, 0, 115, 114, 0, 0, 133, 0, 122, 0, 140, 0, 124, 25, 0, 127, 25, 0, 118, 0, 119, 0, 120, 0, 143, 0, 145, 0, 147, 0, 104, 0, 106, 0, 81, 0, 154, 25, 0, 25, 0, 141, 0, 123, 0, 134, 0, 144, 0, 146, 0, 148, 0, 13, 23, 25, 0, 13, 25, 0, 14, 23, 25, 0, 14, 25, 0, 18, 149, 25, 0, 18, 25, 0, 10, 26, 153, 27, 0, 121, 116, 0, 121, 117, 0, 0, 22, 50, 125, 149, 0, 0, 22, 30, 149, 31, 50, 126, 149, 0, 0, 22, 53, 128, 149, 0, 0, 22, 54, 129, 149, 0, 22, 51, 0, 22, 52, 0, 0, 22, 55, 130, 149, 0, 0, 22, 56, 131, 149, 0, 9, 0, 132, 26, 135, 25, 137, 25, 138, 27, 116, 0, 132, 26, 135, 25, 137, 25, 138, 27, 117, 0, 136, 0, 0, 124, 24, 136, 0, 124, 0, 153, 0, 0, 139, 0, 0, 124, 24, 139, 0, 124, 0, 127, 24, 139, 0, 127, 0, 11, 26, 153, 27, 116, 12, 116, 0, 11, 26, 153, 27, 114, 0, 11, 26, 153, 27, 116, 12, 117, 0, 15, 0, 142, 26, 149, 27, 116, 0, 142, 26, 149, 24, 149, 27, 116, 0, 142, 26, 149, 24, 149, 24, 149, 27, 116, 0, 142, 26, 149, 24, 149, 24, 149, 24, 149, 27, 116, 0, 142, 26, 149, 27, 117, 0, 142, 26, 149, 24, 149, 27, 117, 0, 142, 26, 149, 24, 149, 24, 149, 27, 117, 0, 142, 26, 149, 24, 149, 24, 149, 24, 149, 27, 117, 0, 16, 26, 149, 27, 116, 0, 16, 26, 149, 24, 149, 24, 149, 27, 116, 0, 16, 26, 149, 27, 117, 0, 16, 26, 149, 24, 149, 24, 149, 27, 117, 0, 17, 26, 27, 116, 0, 17, 26, 149, 24, 149, 27, 116, 0, 17, 26, 27, 117, 0, 17, 26, 149, 24, 149, 27, 117, 0, 151, 0, 149, 57, 149, 0, 149, 58, 149, 0, 149, 61, 149, 0, 149, 60, 149, 0, 0, 149, 62, 150, 149, 0, 149, 59, 149, 0, 57, 149, 0, 58, 149, 0, 153, 66, 149, 67, 149, 0, 21, 0, 124, 0, 127, 0, 152, 0, 154, 0, 22, 0, 22, 30, 149, 31, 0, 23, 0, 36, 0, 26, 149, 24, 149, 24, 149, 27, 0, 26, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 24, 149, 27, 0, 26, 149, 27, 0, 78, 149, 0, 78, 36, 149, 0, 26, 153, 27, 0, 153, 64, 153, 0, 153, 63, 153, 0, 149, 46, 149, 0, 149, 48, 149, 0, 149, 47, 149, 0, 149, 49, 149, 0, 149, 44, 149, 0, 149, 45, 149, 0, 153, 44, 153, 0, 153, 45, 153, 0, 65, 153, 0, 156, 0, 0, 22, 26, 155, 158, 27, 0, 157, 26, 22, 24, 158, 27, 0, 157, 26, 22, 30, 149, 31, 24, 158, 27, 0, 157, 26, 36, 24, 158, 27, 0, 157, 26, 36, 30, 149, 31, 24, 158, 27, 0, 32, 0, 33, 0, 34, 0, 35, 0, 159, 0, 0, 0, 149, 24, 160, 159, 0, 149, 0 }; #endif #if YYDEBUG != 0 static const short yyrline[] = { 0, 202, 209, 213, 218, 223, 230, 235, 241, 246, 252, 258, 264, 270, 276, 282, 288, 296, 317, 323, 339, 350, 361, 383, 388, 397, 404, 410, 419, 431, 439, 447, 451, 460, 470, 474, 490, 494, 505, 528, 541, 545, 557, 561, 566, 571, 576, 581, 590, 595, 603, 610, 616, 625, 637, 646, 655, 658, 666, 669, 686, 689, 706, 710, 717, 722, 734, 740, 752, 769, 776, 786, 789, 799, 803, 822, 825, 845, 851, 857, 867, 873, 878, 887, 893, 902, 907, 912, 917, 922, 927, 932, 937, 942, 947, 952, 957, 962, 967, 972, 977, 986, 991, 996, 1001, 1006, 1011, 1020, 1047, 1074, 1101, 1128, 1167, 1191, 1204, 1214, 1227, 1237, 1247, 1260, 1274, 1284, 1294, 1304, 1314, 1325, 1336, 1346, 1356, 1366, 1380, 1388, 1405, 1424, 1429, 1437, 1444, 1453, 1458, 1466, 1471, 1479, 1486, 1491, 1498, 1507, 1522, 1531, 1546, 1556, 1567, 1580, 1595, 1614, 1625, 1638, 1653, 1674, 1685, 1702, 1713, 1732, 1742, 1757, 1767, 1784, 1789, 1796, 1803, 1826, 1833, 1840, 1844, 1851, 1857, 1863, 1881, 1886, 1891, 1896, 1901, 1906, 1919, 1934, 1939, 1944, 1955, 2011, 2021, 2029, 2040, 2047, 2054, 2061, 2069, 2077, 2085, 2093, 2101, 2109, 2117, 2125, 2136, 2176, 2189, 2258, 2290, 2325, 2348, 2377, 2390, 2403, 2416, 2433, 2437, 2442, 2449, 2451 }; #endif #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) static const char * const yytname[] = { "$","error","$undefined.","SL_SURFACE", "SL_DISPLACEMENT","SL_LIGHT","SL_VOLUME","SL_TRANSFORMATION","SL_IMAGER","SL_FOR", "SL_WHILE","SL_IF","SL_ELSE","SL_BREAK","SL_CONTINUE","SL_ILLUMINANCE","SL_ILLUMINATE", "SL_SOLAR","SL_RETURN","SL_VOID","SL_LIGHTSOURCE","SL_FCN_PI","SL_IDENTIFIER_VALUE", "SL_FLOAT_VALUE","SL_COMMA","SL_SEMI_COLON","SL_OPEN_PARANTHESIS","SL_CLOSE_PARANTHESIS", "SL_OPEN_CRL_PARANTHESIS","SL_CLOSE_CRL_PARANTHESIS","SL_OPEN_SQR_PARANTHESIS", "SL_CLOSE_SQR_PARANTHESIS","SL_TEXTURE","SL_SHADOW","SL_ENVIRONMENT","SL_BUMP", "SL_TEXT_VALUE","SL_FLOAT","SL_COLOR","SL_POINT","SL_VECTOR","SL_NORMAL","SL_MATRIX", "SL_STRING","SL_COMP_EQUAL","SL_COMP_DIFFERENT","SL_COMP_GREATER","SL_COMP_GREATER_EQUAL", "SL_COMP_LESS","SL_COMP_LESS_EQUAL","SL_EQUAL","SL_INCREMENT","SL_DECREMENT", "SL_INCREMENT_BY","SL_DECREMENT_BY","SL_MULTIPLY_BY","SL_DIVIDE_BY","SL_PLUS", "SL_MINUS","SL_CROSS","SL_DIVIDE","SL_MULTIPLY","SL_DOT","SL_OR","SL_AND","SL_NOT", "SL_QUESTION","SL_COLON","SL_OUTPUT","SL_EXTERN","SL_UNIFORM","SL_VARIABLE", "slStart","@1","slContainerClass","slInheritanceClass","slOutputClass","slTypeSpecifier", "slTypeDecl","slShader","slFunctionHeader","slFunction","slFunctionParameterList", "slFunctionParameters","slFunctionParameter","@2","slFunctionParameterIdentifierList", "@3","@4","@5","slMain","@6","@7","slShaderType","slShaderParameterList","slShaderParameters", "slShaderParameter","slShaderParameterInitializer","slShaderParameterIdentifierToken", "@8","@9","@10","@11","slShaderParameterIdentifierList","slBlock","@12","slVariableDeclerations", "slVariableInitializer","slVariableIdentifierList","@13","@14","@15","@16","slVariableIdentifierTail", "slStatement","slStatements","slMatchedStatement","slUnmatchedStatement","slBreakStatement", "slContinueStatement","slReturnStatement","slWhileStartStatement","slWhileStatement", "slUnmatchedWhileStatement","slAssignmentStatement","@17","@18","slUpdateStatement", "@19","@20","@21","@22","slForStartStatement","slForStatement","slUnmatchedForStatement", "slForInitStatement","slForInitStatements","slForCheckStatement","slForIncrementStatement", "slForIncrementStatements","slMatchedIfStatement","slUnmatchedIfStatement","slIlluminanceStartStatement", "slIlluminanceStatement","slUnmatchedIlluminanceStatement","slIlluminateStatement", "slUnmatchedIlluminateStatement","slSolarStatement","slUnmatchedSolarStatement", "slAritmeticExpression","@23","slAritmeticTerminalValue","slAritmeticTypeCast", "slBooleanExpression","slFunctionCall","@24","slTextureCall","slTextureName", "slFunctionCallParameterList","slFunctionCallParameters","@25", NULL }; #endif static const short yyr1[] = { 0, 73, 72, 74, 74, 74, 75, 75, 76, 76, 77, 77, 77, 77, 77, 77, 77, 78, 79, 79, 80, 80, 81, 82, 82, 83, 83, 83, 85, 84, 87, 86, 86, 88, 86, 89, 86, 86, 86, 91, 92, 90, 93, 93, 93, 93, 93, 93, 94, 94, 95, 95, 95, 96, 97, 99, 98, 100, 98, 101, 98, 102, 98, 98, 103, 103, 105, 104, 106, 107, 109, 108, 110, 108, 111, 108, 112, 108, 113, 113, 114, 114, 114, 115, 115, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 116, 117, 117, 117, 117, 117, 117, 118, 118, 119, 119, 120, 120, 121, 122, 123, 125, 124, 126, 124, 128, 127, 129, 127, 127, 127, 130, 127, 131, 127, 132, 133, 134, 135, 135, 136, 136, 137, 137, 138, 138, 139, 139, 139, 139, 140, 141, 141, 142, 143, 143, 143, 143, 144, 144, 144, 144, 145, 145, 146, 146, 147, 147, 148, 148, 149, 149, 149, 149, 149, 150, 149, 149, 149, 149, 149, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 151, 152, 152, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 153, 154, 155, 154, 156, 156, 156, 156, 157, 157, 157, 157, 158, 158, 160, 159, 159 }; static const short yyr2[] = { 0, 0, 2, 1, 1, 0, 1, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 4, 2, 1, 3, 3, 4, 1, 0, 3, 2, 1, 0, 3, 0, 4, 1, 0, 6, 0, 7, 3, 4, 0, 0, 8, 1, 1, 1, 1, 1, 1, 1, 0, 3, 2, 1, 2, 2, 0, 4, 0, 3, 0, 7, 0, 6, 0, 1, 3, 0, 4, 2, 2, 0, 3, 0, 4, 0, 6, 0, 7, 2, 1, 1, 1, 1, 2, 0, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, 2, 4, 2, 2, 0, 4, 0, 7, 0, 4, 0, 4, 2, 2, 0, 4, 0, 4, 1, 9, 9, 1, 0, 3, 1, 1, 0, 1, 0, 3, 1, 3, 1, 7, 5, 7, 1, 5, 7, 9, 11, 5, 7, 9, 11, 5, 9, 5, 9, 4, 7, 4, 7, 1, 3, 3, 3, 3, 0, 4, 3, 2, 2, 5, 1, 1, 1, 1, 1, 1, 4, 1, 1, 7, 33, 3, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 2, 1, 0, 5, 6, 9, 6, 9, 1, 1, 1, 1, 1, 0, 0, 4, 1 }; static const short yydefact[] = { 1, 7, 42, 43, 44, 45, 46, 47, 0, 6, 9, 0, 2, 7, 7, 19, 0, 0, 8, 5, 0, 28, 0, 23, 27, 18, 0, 21, 3, 4, 0, 20, 0, 0, 7, 39, 10, 11, 14, 12, 13, 15, 16, 17, 32, 29, 66, 22, 25, 7, 0, 0, 84, 63, 0, 48, 52, 0, 37, 0, 0, 57, 64, 53, 40, 7, 38, 0, 31, 82, 130, 0, 0, 0, 0, 148, 0, 0, 7, 0, 100, 67, 209, 210, 211, 212, 0, 98, 96, 97, 83, 81, 80, 90, 91, 92, 7, 86, 102, 0, 0, 0, 85, 103, 87, 101, 0, 93, 104, 94, 105, 95, 106, 0, 202, 0, 55, 0, 0, 63, 0, 50, 0, 0, 7, 7, 0, 108, 0, 110, 7, 7, 176, 181, 183, 112, 7, 184, 7, 7, 7, 7, 177, 178, 0, 165, 179, 0, 180, 203, 7, 116, 124, 125, 120, 122, 126, 128, 70, 68, 114, 115, 88, 89, 134, 7, 99, 0, 63, 0, 7, 58, 65, 41, 0, 34, 0, 0, 0, 107, 109, 0, 7, 0, 7, 0, 0, 173, 174, 201, 184, 188, 111, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 170, 7, 7, 7, 7, 7, 7, 0, 7, 7, 7, 7, 7, 0, 0, 0, 0, 136, 0, 133, 0, 0, 0, 56, 61, 54, 36, 113, 0, 7, 7, 161, 163, 7, 0, 7, 187, 190, 189, 197, 198, 193, 195, 194, 196, 166, 167, 172, 169, 168, 7, 199, 200, 192, 191, 0, 217, 0, 213, 0, 117, 121, 123, 127, 129, 0, 0, 79, 71, 7, 0, 0, 7, 7, 7, 7, 7, 7, 7, 59, 0, 146, 81, 0, 157, 159, 0, 182, 0, 171, 7, 215, 204, 118, 74, 70, 78, 69, 73, 135, 0, 137, 0, 149, 153, 0, 0, 0, 0, 63, 62, 7, 7, 7, 7, 175, 7, 7, 0, 0, 140, 7, 7, 205, 0, 207, 0, 60, 145, 147, 0, 162, 164, 0, 216, 119, 75, 0, 0, 142, 144, 0, 139, 0, 150, 154, 7, 7, 7, 7, 185, 77, 0, 0, 7, 7, 7, 0, 0, 158, 160, 0, 141, 143, 131, 132, 0, 151, 155, 206, 208, 7, 7, 0, 152, 156, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 7, 0, 186, 0, 0, 0 }; static const short yydefgoto[] = { 403, 1, 30, 10, 19, 43, 141, 12, 13, 87, 22, 23, 24, 32, 45, 51, 67, 122, 15, 49, 120, 16, 54, 55, 56, 171, 62, 168, 118, 313, 284, 63, 88, 52, 89, 274, 159, 218, 219, 322, 323, 272, 90, 60, 91, 92, 93, 94, 95, 96, 97, 98, 142, 212, 321, 143, 213, 214, 215, 216, 101, 102, 103, 222, 223, 304, 345, 346, 104, 105, 106, 107, 108, 109, 110, 111, 112, 176, 254, 145, 146, 147, 148, 210, 114, 115, 261, 262, 320 }; static const short yypact[] = {-32768, 31,-32768,-32768,-32768,-32768,-32768,-32768, -14,-32768, -38, 45,-32768, -23, 31,-32768, 60, 59,-32768, 48, 63, -32768, 80,-32768, 89,-32768, 116,-32768,-32768,-32768, 166, -32768, 136, 83, -22,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 1,-32768,-32768,-32768,-32768, -20, 32, 148,-32768, 151, 147,-32768, 154, 145, 156, 136, 470, 82, 158,-32768,-32768, -13, 167, 169,-32768,-32768,-32768, 164, 170, 4, 120,-32768, 171, 173, 584, 133,-32768, -32768,-32768,-32768,-32768,-32768, 188,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768, 406,-32768,-32768, 196, 204, 187,-32768,-32768,-32768,-32768, 190,-32768,-32768,-32768,-32768, -32768,-32768, 205,-32768, 208,-32768, 213, 197, 151, 83, -32768, 231, 136, 667, 667, 232,-32768, 235,-32768, 667, 611,-32768, 172,-32768,-32768, 667,-32768, 667, 667, 667, 687,-32768,-32768, 471,-32768,-32768, 9,-32768,-32768, 667, -32768,-32768,-32768,-32768,-32768,-32768,-32768, 2,-32768,-32768, -32768,-32768,-32768, 239, 667,-32768, 35, 151, 234, 667, -32768,-32768,-32768, 136,-32768, 1233, -21, 17,-32768,-32768, 403, 406, 801, 667, 702, 57, 191, 191, 129, 556, 1233,-32768, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667, 667,-32768, 667, 667, 667, 667, 667, 629, 1159, 667, 667, 667, 667, 667, 243, 105, 217, -10, 244, 245,-32768, 730, 85, 86,-32768, 247, 1233,-32768, -32768, 533, 667, 406,-32768,-32768, 667, 1165, 667,-32768, -32768, 1233, 833, 833, 833, 833, 833, 833, 191, 191, 37, 207, 207, 667, 61, 61, -6, 129, 1209, 827, 246,-32768, 222, 184, 184, 184, 184, 184, 248, 254, -32768,-32768, 667, 105, 239, 649, 667, 406, 629, 667, 629, 667,-32768, 197,-32768, 266, 853,-32768,-32768, 1088, 222, 859,-32768, 667,-32768,-32768,-32768, 236, -9,-32768, 1233,-32768,-32768, 259, 9, 756,-32768,-32768, 263, 1184, 265, 1203, 151,-32768, 406, 667, 406, 667,-32768, 667, 667, 105, 217, 271, 667, 406,-32768, 270,-32768, 272, -32768,-32768,-32768, 1111,-32768,-32768, 782,-32768, 184,-32768, 105, 114, 277, 278, 268,-32768, 808,-32768,-32768, 629, 629, 406, 667,-32768,-32768, 271, 271, 406, 667, 406, 276, 279,-32768,-32768, 885,-32768,-32768,-32768,-32768, 1117, -32768,-32768,-32768,-32768, 667, 406, 904,-32768,-32768, 667, 911, 667, 930, 667, 956, 667, 962, 667, 988, 667, 1007, 667, 1014, 667, 1033, 667, 1059, 667, 1065, 667, 1140,-32768, 304, 307,-32768 }; static const short yypgoto[] = {-32768, -32768,-32768,-32768,-32768,-32768, -1, 295,-32768, 64,-32768, 281,-32768,-32768, -57,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768, 252,-32768, 26, -167,-32768,-32768,-32768,-32768, 192, -24,-32768,-32768, -11, 49,-32768,-32768,-32768,-32768, -271, 91,-32768, -77, -78,-32768,-32768,-32768,-32768,-32768, -32768, 30,-32768,-32768, 53,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768, 46,-32768,-32768, -196,-32768,-32768,-32768, -32768,-32768,-32768,-32768,-32768,-32768, -62,-32768,-32768,-32768, -114, 118,-32768,-32768,-32768, -264, 7,-32768 }; #define YYLAST 1295 static const short yytable[] = { 11, 227, 68, 302, -24, -26, 231, -49, 17, 47, 177, 178, 21, 11, -51, 309, 144, 311, 161, 160, 150, 217, 186, 205, 206, -30, 189, 126, 31, 127, 18, 50, 217, 21, 2, 3, 4, 5, 6, 7, 151, -72, 207, 208, 232, 209, 9, 9, 53, 9, 8, 340, -72, 205, 206, 57, 9, 225, 208, 86, 209, 205, 206, 58, 53, 14, 175, 20, 181, 183, 355, 226, 207, 208, 185, 209, 187, 188, 14, 191, 207, 208, 26, 209, 241, 27, 361, 362, 211, 31, 99, 255, 256, 257, 258, 86, 173, 202, 203, 204, 9, 205, 206, 224, 236, 235, 116, 33, 229, 279, 281, 46, 117, 100, 34, 280, 282, 230, 28, 29, 207, 208, 238, 209, 207, 208, 99, 209, 242, 270, 271, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 35, 128, 150, 129, 331, 259, 260, 100, 264, 265, 266, 267, 268, 286, 289, 288, 44, 149, 366, 367, 305, 150, 151, 152, 153, 154, 155, 156, 157, 287, 59, 61, 64, 290, 66, 292, 113, 65, -33, 86, 119, 151, 152, 153, 154, 155, 156, 157, 124, -35, 293, 123, 221, 209, 125, 130, 149, 131, 308, 307, 184, 36, 37, 38, 39, 40, 41, 42, 158, 301, 99, 164, 113, 306, 165, 260, 310, 260, 312, 162, 151, 152, 153, 154, 155, 156, 157, 163, 166, 86, 319, 86, 167, 100, 169, 333, 332, 336, 335, 199, 200, 201, 202, 203, 204, 170, 349, 348, 201, 202, 203, 204, 334, 174, 337, 179, 260, 339, 180, 220, 99, 347, 99, 228, 269, 273, 275, 204, 276, 283, 297, 296, 364, 363, 299, 86, 315, 298, 369, 368, 372, 371, 324, 100, -76, 100, 260, 260, 327, 365, 329, 342, 350, 358, 351, 370, 379, 378, 113, 356, 357, 373, 404, 221, 374, 405, 99, 25, 314, 172, 341, 377, 86, 48, 86, 121, 381, 300, 383, 303, 385, 285, 387, 86, 389, 338, 391, 0, 393, 100, 395, 0, 397, 0, 399, 0, 401, 0, 0, 0, 0, 0, 0, 99, 0, 99, 0, 0, 113, 86, 113, 0, 343, 0, 99, 86, 0, 86, 0, 0, 0, 0, 0, 0, 0, 0, 100, 0, 100, 0, 0, 0, 0, 86, 0, 344, 0, 100, 0, 0, 99, 0, 0, 0, 343, 343, 99, 0, 99, 0, 0, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 100, 99, 0, 0, 344, 344, 100, 0, 100, 0, 70, 71, 72, 0, 73, 74, 75, 76, 77, 78, 8, 0, 233, 79, 100, 234, 80, 0, 113, 46, 113, 0, 0, 82, 83, 84, 85, 0, 0, 113, 0, 0, 193, 194, 195, 196, 197, 198, 0, 0, 0, 0, 0, 0, 0, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 113, 69, 0, 0, 0, 9, 113, 0, 113, 70, 71, 72, 0, 73, 74, 75, 76, 77, 78, 8, 0, 0, 79, 0, 113, 80, 192, 0, 46, 81, 0, 0, 82, 83, 84, 85, 0, -7, -7, -7, -7, -7, -7, -7, 0, 193, 194, 195, 196, 197, 198, 0, 0, 0, 0, 0, 0, 0, 199, 200, 201, 202, 203, 204, 69, 0, 0, 0, -7, 9, -7, -7, 70, 71, 72, 0, 73, 74, 75, 76, 77, 78, 8, 0, 0, 79, 0, 0, 80, 0, 0, 46, 0, 0, 0, 82, 83, 84, 85, 0, -7, -7, -7, -7, -7, -7, -7, 132, 133, 134, 0, 0, 136, 0, 0, 0, 0, 0, 82, 83, 84, 85, 137, -7, -7, -7, -7, -7, -7, -7, 0, -7, 9, -7, -7, 132, 133, 134, 0, 135, 136, 0, 0, 138, 139, 0, 82, 83, 84, 85, 137, 140, 0, 0, -7, 9, -7, -7, 0, 0, 0, 0, 132, 133, 134, 0, 0, 136, 182, 0, 0, 138, 139, 82, 83, 84, 85, 137, 0, 140, 132, 133, 134, 9, 0, 136, -214, 0, 0, 0, 0, 82, 83, 84, 85, 137, 0, 0, 138, 139, 132, 133, 134, 0, -138, 136, 140, 0, 0, 0, 9, 82, 83, 84, 85, 137, 138, 139, 132, 133, 134, 0, 0, 136, 140, 0, 0, 0, 9, 82, 83, 84, 85, 137, 0, 0, 138, 139, 132, 133, 134, 0, 0, 136, 140, 0, 0, 0, 9, 82, 83, 84, 85, 190, 138, 139, 239, 0, 0, 240, 0, 0, 140, 0, 0, 0, 9, 0, 0, 0, 0, 0, 0, 0, 138, 139, 193, 194, 195, 196, 197, 198, 140, 0, 277, 0, 9, 278, 0, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 0, 0, 0, 193, 194, 195, 196, 197, 198, 325, 0, 0, 326, 0, 0, 0, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 0, 193, 194, 195, 196, 197, 198, 353, 0, 0, 354, 0, 0, 0, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 237, 193, 194, 195, 196, 197, 198, 359, 0, 0, 360, 0, 0, 0, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 295, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 0, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 316, 0, 195, 196, 197, 198, 318, 199, 200, 201, 202, 203, 204, 199, 200, 201, 202, 203, 204, 0, 193, 194, 195, 196, 197, 198, 193, 194, 195, 196, 197, 198, 375, 199, 200, 201, 202, 203, 204, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 380, 193, 194, 195, 196, 197, 198, 382, 0, 0, 0, 0, 0, 0, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 384, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 0, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 386, 0, 0, 0, 0, 0, 388, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 0, 193, 194, 195, 196, 197, 198, 193, 194, 195, 196, 197, 198, 390, 199, 200, 201, 202, 203, 204, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 392, 193, 194, 195, 196, 197, 198, 394, 0, 0, 0, 0, 0, 0, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 396, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 0, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 398, 0, 0, 0, 0, 0, 400, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 0, 0, 0, 193, 194, 195, 196, 197, 198, 193, 194, 195, 196, 197, 198, 317, 199, 200, 201, 202, 203, 204, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 193, 194, 195, 196, 197, 198, 352, 0, 0, 0, 0, 0, 376, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 193, 194, 195, 196, 197, 198, 193, 194, 195, 196, 197, 198, 402, 199, 200, 201, 202, 203, 204, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 193, 194, 195, 196, 197, 198, 263, 0, 0, 0, 0, 0, 291, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 193, 194, 195, 196, 197, 198, 328, 199, 200, 201, 202, 203, 204, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 330, 0, 0, 0, 0, 0, 0, 199, 200, 201, 202, 203, 204, 193, 194, 195, 196, 197, 198, 193, 194, 195, 196, 197, 198, 0, 199, 200, 201, 202, 203, 204, 199, 200, 201, 202, 203, 204, 0, 0, 0, 0, 294, 193, 194, 195, 196, 197, 198, 0, 0, 0, 0, 0, 0, 0, 199, 200, 201, 202, 203, 204 }; static const short yycheck[] = { 1, 168, 59, 274, 27, 27, 27, 27, 22, 33, 124, 125, 13, 14, 27, 279, 78, 281, 96, 96, 30, 30, 136, 44, 45, 24, 140, 23, 26, 25, 68, 30, 30, 34, 3, 4, 5, 6, 7, 8, 50, 50, 63, 64, 27, 66, 69, 69, 49, 69, 19, 322, 50, 44, 45, 23, 69, 22, 64, 60, 66, 44, 45, 31, 65, 1, 123, 22, 130, 131, 341, 36, 63, 64, 136, 66, 138, 139, 14, 141, 63, 64, 22, 66, 27, 26, 350, 351, 150, 26, 60, 205, 206, 207, 208, 96, 120, 60, 61, 62, 69, 44, 45, 165, 182, 182, 24, 27, 170, 24, 24, 28, 30, 60, 25, 30, 30, 174, 70, 71, 63, 64, 184, 66, 63, 64, 96, 66, 190, 24, 25, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 26, 23, 30, 25, 313, 209, 210, 96, 212, 213, 214, 215, 216, 232, 234, 234, 22, 26, 356, 357, 276, 30, 50, 51, 52, 53, 54, 55, 56, 233, 24, 22, 27, 237, 31, 239, 60, 25, 24, 182, 24, 50, 51, 52, 53, 54, 55, 56, 26, 24, 254, 24, 164, 66, 26, 26, 26, 26, 278, 278, 30, 37, 38, 39, 40, 41, 42, 43, 22, 273, 182, 26, 96, 277, 26, 279, 280, 281, 282, 25, 50, 51, 52, 53, 54, 55, 56, 25, 25, 232, 294, 234, 26, 182, 23, 315, 315, 317, 317, 57, 58, 59, 60, 61, 62, 50, 326, 326, 59, 60, 61, 62, 316, 24, 318, 25, 320, 321, 25, 22, 232, 325, 234, 31, 23, 50, 24, 62, 25, 24, 50, 27, 352, 352, 22, 278, 12, 31, 358, 358, 360, 360, 25, 232, 50, 234, 350, 351, 27, 353, 27, 22, 24, 27, 24, 359, 376, 376, 182, 24, 24, 27, 0, 275, 27, 0, 278, 14, 284, 119, 323, 375, 315, 34, 317, 65, 380, 270, 382, 275, 384, 232, 386, 326, 388, 320, 390, -1, 392, 278, 394, -1, 396, -1, 398, -1, 400, -1, -1, -1, -1, -1, -1, 315, -1, 317, -1, -1, 232, 352, 234, -1, 324, -1, 326, 358, -1, 360, -1, -1, -1, -1, -1, -1, -1, -1, 315, -1, 317, -1, -1, -1, -1, 376, -1, 324, -1, 326, -1, -1, 352, -1, -1, -1, 356, 357, 358, -1, 360, -1, -1, -1, -1, -1, 278, -1, -1, -1, -1, -1, -1, -1, -1, 352, 376, -1, -1, 356, 357, 358, -1, 360, -1, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, -1, 24, 22, 376, 27, 25, -1, 315, 28, 317, -1, -1, 32, 33, 34, 35, -1, -1, 326, -1, -1, 44, 45, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, 352, 1, -1, -1, -1, 69, 358, -1, 360, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, -1, -1, 22, -1, 376, 25, 25, -1, 28, 29, -1, -1, 32, 33, 34, 35, -1, 37, 38, 39, 40, 41, 42, 43, -1, 44, 45, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, 57, 58, 59, 60, 61, 62, 1, -1, -1, -1, 68, 69, 70, 71, 9, 10, 11, -1, 13, 14, 15, 16, 17, 18, 19, -1, -1, 22, -1, -1, 25, -1, -1, 28, -1, -1, -1, 32, 33, 34, 35, -1, 37, 38, 39, 40, 41, 42, 43, 21, 22, 23, -1, -1, 26, -1, -1, -1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, -1, 68, 69, 70, 71, 21, 22, 23, -1, 25, 26, -1, -1, 57, 58, -1, 32, 33, 34, 35, 36, 65, -1, -1, 68, 69, 70, 71, -1, -1, -1, -1, 21, 22, 23, -1, -1, 26, 27, -1, -1, 57, 58, 32, 33, 34, 35, 36, -1, 65, 21, 22, 23, 69, -1, 26, 27, -1, -1, -1, -1, 32, 33, 34, 35, 36, -1, -1, 57, 58, 21, 22, 23, -1, 25, 26, 65, -1, -1, -1, 69, 32, 33, 34, 35, 36, 57, 58, 21, 22, 23, -1, -1, 26, 65, -1, -1, -1, 69, 32, 33, 34, 35, 36, -1, -1, 57, 58, 21, 22, 23, -1, -1, 26, 65, -1, -1, -1, 69, 32, 33, 34, 35, 36, 57, 58, 24, -1, -1, 27, -1, -1, 65, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, 57, 58, 44, 45, 46, 47, 48, 49, 65, -1, 24, -1, 69, 27, -1, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 24, -1, -1, 27, -1, -1, -1, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 24, -1, -1, 27, -1, -1, -1, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, -1, -1, 24, 44, 45, 46, 47, 48, 49, 24, -1, -1, 27, -1, -1, -1, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 24, 44, 45, 46, 47, 48, 49, 57, 58, 59, 60, 61, 62, -1, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 24, -1, 46, 47, 48, 49, 24, 57, 58, 59, 60, 61, 62, 57, 58, 59, 60, 61, 62, -1, 44, 45, 46, 47, 48, 49, 44, 45, 46, 47, 48, 49, 24, 57, 58, 59, 60, 61, 62, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, -1, -1, 24, 44, 45, 46, 47, 48, 49, 24, -1, -1, -1, -1, -1, -1, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 24, 44, 45, 46, 47, 48, 49, 57, 58, 59, 60, 61, 62, -1, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 24, -1, -1, -1, -1, -1, 24, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 44, 45, 46, 47, 48, 49, 24, 57, 58, 59, 60, 61, 62, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, -1, -1, 24, 44, 45, 46, 47, 48, 49, 24, -1, -1, -1, -1, -1, -1, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 24, 44, 45, 46, 47, 48, 49, 57, 58, 59, 60, 61, 62, -1, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 24, -1, -1, -1, -1, -1, 24, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 44, 45, 46, 47, 48, 49, 27, 57, 58, 59, 60, 61, 62, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 27, -1, -1, -1, -1, -1, 27, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 44, 45, 46, 47, 48, 49, 27, 57, 58, 59, 60, 61, 62, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, 44, 45, 46, 47, 48, 49, 31, -1, -1, -1, -1, -1, 31, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 44, 45, 46, 47, 48, 49, 31, 57, 58, 59, 60, 61, 62, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 31, -1, -1, -1, -1, -1, -1, 57, 58, 59, 60, 61, 62, 44, 45, 46, 47, 48, 49, 44, 45, 46, 47, 48, 49, -1, 57, 58, 59, 60, 61, 62, 57, 58, 59, 60, 61, 62, -1, -1, -1, -1, 67, 44, 45, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, 57, 58, 59, 60, 61, 62 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* 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 /* 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 206 "sl.y" { ; break;} case 2: #line 209 "sl.y" { ; break;} case 3: #line 215 "sl.y" { yyval.integer = SLC_UNIFORM; ; break;} case 4: #line 220 "sl.y" { yyval.integer = 0; ; break;} case 5: #line 224 "sl.y" { yyval.integer = 0; ; break;} case 6: #line 232 "sl.y" { yyval.integer = SLC_EXTERN; ; break;} case 7: #line 236 "sl.y" { yyval.integer = 0; ; break;} case 8: #line 243 "sl.y" { yyval.integer = SLC_OUTPUT; ; break;} case 9: #line 247 "sl.y" { yyval.integer = 0; ; break;} case 10: #line 254 "sl.y" { sdr->desire(SLC_FLOAT); yyval.integer = SLC_FLOAT; ; break;} case 11: #line 260 "sl.y" { sdr->desire(SLC_VECTOR | SLC_VCOLOR); yyval.integer = SLC_VECTOR | SLC_VCOLOR; ; break;} case 12: #line 266 "sl.y" { sdr->desire(SLC_VECTOR | SLC_VVECTOR); yyval.integer = SLC_VECTOR | SLC_VVECTOR; ; break;} case 13: #line 272 "sl.y" { sdr->desire(SLC_VECTOR | SLC_VNORMAL); yyval.integer = SLC_VECTOR | SLC_VNORMAL; ; break;} case 14: #line 278 "sl.y" { sdr->desire(SLC_VECTOR | SLC_VPOINT); yyval.integer = SLC_VECTOR | SLC_VPOINT; ; break;} case 15: #line 284 "sl.y" { sdr->desire(SLC_MATRIX); yyval.integer = SLC_MATRIX; ; break;} case 16: #line 290 "sl.y" { sdr->desire(SLC_STRING); yyval.integer = SLC_STRING; ; break;} case 17: #line 301 "sl.y" { yyval.integer = yyvsp[-3].integer | yyvsp[-2].integer | yyvsp[-1].integer | yyvsp[0].integer; sdr->undesire(); sdr->desire(yyval.integer); ; break;} case 18: #line 320 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-1].code,yyvsp[0].code); ; break;} case 19: #line 325 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 20: #line 343 "sl.y" { CFunction *thisFunction = sdr->newFunction(yyvsp[-1].string); thisFunction->returnValue = new CParameter(yyvsp[-1].string,yyvsp[-2].integer,1); sdr->undesire(); ; break;} case 21: #line 354 "sl.y" { CFunction *thisFunction = sdr->newFunction(yyvsp[-1].string); thisFunction->returnValue = NULL; ; break;} case 22: #line 366 "sl.y" { CFunction *cFun = sdr->popFunction(); cFun->initExpression = yyvsp[-2].code; cFun->code = yyvsp[0].code; if (cFun->returnValue != NULL) if (cFun->returnValueGiven == FALSE) sdr->error("Return value not given for %s\n",cFun->symbolName); yyval.code = new CNullExpression; ; break;} case 23: #line 385 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 24: #line 389 "sl.y" { yyval.code = new CNullExpression; ; break;} case 25: #line 401 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code); ; break;} case 26: #line 407 "sl.y" { yyval.code = yyvsp[-1].code; ; break;} case 27: #line 412 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 28: #line 421 "sl.y" { int type = sdr->desired(); if (type & SLC_OUTPUT) { } else { sdr->undesire(); sdr->desire(type | SLC_RDONLY); // Make sure we mark the desired type as READ-ONLY } ; break;} case 29: #line 431 "sl.y" { yyval.code = yyvsp[0].code; sdr->undesire(); // We're done with the type ; break;} case 30: #line 441 "sl.y" { CParameter *cParameter; cParameter = sdr->newParameter(yyvsp[0].string,sdr->desired(),1); // Add the Parameter to the current CFunction ; break;} case 31: #line 448 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 32: #line 453 "sl.y" { CParameter *cParameter; cParameter = sdr->newParameter(yyvsp[0].string,sdr->desired(),1); yyval.code = new CNullExpression; ; break;} case 33: #line 464 "sl.y" { CParameter *cParameter; cParameter = sdr->newParameter(yyvsp[-2].string,sdr->desired() | SLC_ARRAY,-1); ; break;} case 34: #line 471 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 35: #line 479 "sl.y" { CParameter *cParameter; cParameter = sdr->newParameter(yyvsp[-3].string,sdr->desired() | SLC_ARRAY, atoi(yyvsp[-1].string)); if (cParameter->numItems <= 0) { sdr->error("Array size for %s is invalid (%s)\n",yyvsp[-3].string,yyvsp[-1].string); cParameter->numItems = 1; } ; break;} case 36: #line 491 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 37: #line 498 "sl.y" { CParameter *cParameter; cParameter = sdr->newParameter(yyvsp[-2].string,sdr->desired() | SLC_ARRAY, -1); yyval.code = new CNullExpression; ; break;} case 38: #line 510 "sl.y" { CParameter *cParameter; cParameter = sdr->newParameter(yyvsp[-3].string,sdr->desired() | SLC_ARRAY, atoi(yyvsp[-1].string)); if (cParameter->numItems <= 0) { sdr->error("Array size for %s is invalid (%s)\n",yyvsp[-3].string,yyvsp[-1].string); cParameter->numItems = 1; } yyval.code = new CNullExpression; ; break;} case 39: #line 531 "sl.y" { CFunction *mainFunction = sdr->newFunction(constantShaderMain); mainFunction->returnValue = NULL; sdr->shaderName = sdup(yyvsp[-1].string); sdr->shaderType = yyvsp[-2].integer; sdr->shaderFunction = mainFunction; ; break;} case 40: #line 542 "sl.y" { ; break;} case 41: #line 545 "sl.y" { CFunction *cFun = sdr->popFunction(); assert(cFun == sdr->shaderFunction); cFun->initExpression = yyvsp[-3].code; cFun->code = yyvsp[0].code; ; break;} case 42: #line 558 "sl.y" { yyval.integer = SLC_SURFACE; ; break;} case 43: #line 563 "sl.y" { yyval.integer = SLC_DISPLACEMENT; ; break;} case 44: #line 568 "sl.y" { yyval.integer = SLC_LIGHT; ; break;} case 45: #line 573 "sl.y" { yyval.integer = SLC_VOLUME; ; break;} case 46: #line 578 "sl.y" { yyval.integer = SLC_TRANSFORMATION; ; break;} case 47: #line 583 "sl.y" { yyval.integer = SLC_IMAGER; ; break;} case 48: #line 592 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 49: #line 596 "sl.y" { yyval.code = new CNullExpression; ; break;} case 50: #line 607 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code); ; break;} case 51: #line 613 "sl.y" { yyval.code = yyvsp[-1].code; ; break;} case 52: #line 618 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 53: #line 628 "sl.y" { yyval.code = yyvsp[0].code; sdr->undesire(); ; break;} case 54: #line 640 "sl.y" { yyval.code = getAssignment(sdr->variableList,yyvsp[0].expression); ; break;} case 55: #line 649 "sl.y" { CParameter *cParameter = sdr->newParameter(yyvsp[-1].string,sdr->desired() | SLC_PARAMETER,1); sdr->variableList->push(cParameter); // Save the parameter so that we gen generate init code later ; break;} case 56: #line 655 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 57: #line 660 "sl.y" { CParameter *cParameter = sdr->newParameter(yyvsp[0].string,sdr->desired() | SLC_PARAMETER,1); sdr->variableList->push(cParameter); ; break;} case 58: #line 666 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 59: #line 675 "sl.y" { CParameter *cParameter = sdr->newParameter(yyvsp[-4].string,sdr->desired() | SLC_PARAMETER | SLC_ARRAY,atoi(yyvsp[-2].string)); if (cParameter->numItems <= 0) { sdr->error("Array size for %s is invalid (%s)\n",yyvsp[-4].string,yyvsp[-2].string); cParameter->numItems = 1; } sdr->variableList->push(cParameter); ; break;} case 60: #line 686 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 61: #line 694 "sl.y" { CParameter *cParameter = sdr->newParameter(yyvsp[-3].string,sdr->desired() | SLC_PARAMETER | SLC_ARRAY,atoi(yyvsp[-1].string)); // Get the parameter if (cParameter->numItems <= 0) { sdr->error("Array size for %s is invalid (%s)\n",yyvsp[-3].string,yyvsp[-1].string); cParameter->numItems = 1; } sdr->variableList->push(cParameter); ; break;} case 62: #line 706 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 63: #line 711 "sl.y" { yyval.code = new CNullExpression; ; break;} case 64: #line 719 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 65: #line 726 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-2].code,yyvsp[0].code); ; break;} case 66: #line 736 "sl.y" { CFunction *cFun = sdr->newFunction(constantBlockName); ; break;} case 67: #line 741 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CFuncallExpression(cFun,NULL); ; break;} case 68: #line 755 "sl.y" { CVariable *cVar; // Remove the uninitialized variables from the list while((cVar = (CVariable *) sdr->variableList->pop()) != NULL); sdr->undesire(); yyval.code = yyvsp[0].code; ; break;} case 69: #line 772 "sl.y" { yyval.code = getAssignment(sdr->variableList,yyvsp[0].expression); ; break;} case 70: #line 778 "sl.y" { CVariable *cVar; cVar = sdr->newVariable(yyvsp[0].string,sdr->desired(),1); sdr->variableList->push(cVar); ; break;} case 71: #line 786 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 72: #line 791 "sl.y" { CVariable *cVar; cVar = sdr->newVariable(yyvsp[0].string,sdr->desired(),1); sdr->variableList->push(cVar); ; break;} case 73: #line 800 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-1].code,yyvsp[0].code); ; break;} case 74: #line 809 "sl.y" { CVariable *cVar; cVar = sdr->newVariable(yyvsp[-3].string,sdr->desired() | SLC_ARRAY,atoi(yyvsp[-1].string)); if (cVar->numItems <= 0) { sdr->error("Array size is invalid for %s (%s)\n",yyvsp[-3].string,yyvsp[-1].string); cVar->numItems = 1; } sdr->variableList->push(cVar); ; break;} case 75: #line 822 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 76: #line 830 "sl.y" { CVariable *cVar; cVar = sdr->newVariable(yyvsp[-3].string,sdr->desired() | SLC_ARRAY,atoi(yyvsp[-1].string)); if (cVar->numItems <= 0) { sdr->error("Array size is invalid for %s (%s)\n",yyvsp[-3].string,yyvsp[-1].string); cVar->numItems = 1; } sdr->variableList->push(cVar); ; break;} case 77: #line 846 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-1].code,yyvsp[0].code); ; break;} case 78: #line 854 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 79: #line 859 "sl.y" { yyval.code = new CNullExpression; ; break;} case 80: #line 869 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 81: #line 875 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 82: #line 880 "sl.y" { // Recoverable error happened yyval.code = new CNullExpression; ; break;} case 83: #line 890 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-1].code,yyvsp[0].code); ; break;} case 84: #line 894 "sl.y" { yyval.code = new CNullExpression; ; break;} case 85: #line 904 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 86: #line 909 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 87: #line 914 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 88: #line 919 "sl.y" { yyval.code = yyvsp[-1].expression; ; break;} case 89: #line 924 "sl.y" { yyval.code = yyvsp[-1].expression; ; break;} case 90: #line 929 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 91: #line 934 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 92: #line 939 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 93: #line 944 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 94: #line 949 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 95: #line 954 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 96: #line 959 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 97: #line 964 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 98: #line 969 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 99: #line 974 "sl.y" { yyval.code = yyvsp[-1].expression; ; break;} case 100: #line 979 "sl.y" { yyval.code = new CNullExpression; ; break;} case 101: #line 988 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 102: #line 993 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 103: #line 998 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 104: #line 1003 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 105: #line 1008 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 106: #line 1013 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 107: #line 1022 "sl.y" { CFunction *cFunction; int bc; char tmp[256]; if (sscanf(yyvsp[-1].string,"%d",&bc) != 1) sdr->error("Invalid break count: %s\n",yyvsp[-1].string); if (bc <= 0) sdr->error("Bad break count: %s\n",yyvsp[-1].string); for(cFunction = sdr->functionStack->last(); cFunction != NULL; cFunction = sdr->functionStack->prev()) { if (scmp(cFunction->symbolName,constantLoopName) == 0) bc--; else if (scmp(cFunction->symbolName,constantBlockName) == 0) continue; if (bc == 0) break; sdr->error("Break target not found\n"); break; } if (cFunction == NULL) sdr->error("Break target not found\n"); sprintf(tmp,"%s\t%s\n",opcodeBreak,yyvsp[-1].string); yyval.code = new CFixedExpression(tmp); ; break;} case 108: #line 1049 "sl.y" { CFunction *cFunction; char tmp[256]; int bc = (int) 1; for(cFunction = sdr->functionStack->last(); cFunction != NULL; cFunction = sdr->functionStack->prev()) { if (scmp(cFunction->symbolName,constantLoopName) == 0) bc--; else if (scmp(cFunction->symbolName,constantBlockName) == 0) continue; if (bc == 0) break; sdr->error("Break target not found\n"); break; } if (cFunction == NULL) sdr->error("Break target not found\n"); sprintf(tmp,"%s\t1\n",opcodeBreak); yyval.code = new CFixedExpression(tmp); ; break;} case 109: #line 1076 "sl.y" { CFunction *cFunction; char tmp[256]; int bc; if (sscanf(yyvsp[-1].string,miscPrintInteger,&bc) != 1) sdr->error("Bad continue count: %s\n",yyvsp[-1].string); if (bc <= 0) sdr->error("Bad continue count: %s\n",yyvsp[-1].string); for(cFunction = sdr->functionStack->last(); cFunction != NULL; cFunction = sdr->functionStack->prev()) { if (scmp(cFunction->symbolName,constantLoopName) == 0) bc--; else if (scmp(cFunction->symbolName,constantBlockName) == 0) continue; if (bc == 0) break; sdr->error("Continue target not found\n"); break; } if (cFunction == NULL) sdr->error("Continue target not found\n"); sprintf(tmp,"%s\t%s\n",opcodeContinue,yyvsp[-1].string); yyval.code = new CFixedExpression(tmp); ; break;} case 110: #line 1103 "sl.y" { CFunction *cFunction; char tmp[256]; int bc = (int) 1; for(cFunction = sdr->functionStack->last(); cFunction != NULL; cFunction = sdr->functionStack->prev()) { if (scmp(cFunction->symbolName,constantLoopName) == 0) bc--; else if (scmp(cFunction->symbolName,constantBlockName) == 0) continue; if (bc == 0) break; sdr->error("Continue target not found\n"); break; } if (cFunction == NULL) sdr->error("Continue target not found\n"); sprintf(tmp,"%s\t1\n",opcodeContinue); yyval.code = new CFixedExpression(tmp); ; break;} case 111: #line 1130 "sl.y" { CFunction *cFun = sdr->lastFunction; CExpression *c; // Skip over loops for (cFun = sdr->functionStack->last(); cFun != NULL; cFun = sdr->functionStack->prev()) { if (scmp(cFun->symbolName,constantBlockName) == 0) continue; if (scmp(cFun->symbolName,constantLoopName) == 0) continue; break; } if (cFun == NULL) { sdr->error("Return target not found\n"); yyval.code = new CNullExpression; } else { if (cFun->returnValue == NULL) { sdr->error("Function %s was not expecting a return value\n",cFun->symbolName); c = new CNullExpression; } else { if (cFun->returnValue->type & SLC_FLOAT) { c = new CAssignmentExpression(cFun->returnValue,getConversion(SLC_FLOAT,yyvsp[-1].expression)); } else if (cFun->returnValue->type & SLC_VECTOR) { c = new CAssignmentExpression(cFun->returnValue,getConversion(SLC_VECTOR,yyvsp[-1].expression)); } else if (cFun->returnValue->type & SLC_STRING) { c = new CAssignmentExpression(cFun->returnValue,getConversion(SLC_STRING,yyvsp[-1].expression)); } else if (cFun->returnValue->type & SLC_MATRIX) { c = new CAssignmentExpression(cFun->returnValue,getConversion(SLC_MATRIX,yyvsp[-1].expression)); } else { assert(FALSE); } } yyval.code = c; cFun->returnValueGiven = TRUE; } ; break;} case 112: #line 1169 "sl.y" { CFunction *cFun = sdr->lastFunction; // Skip over loops for (cFun = sdr->functionStack->last(); cFun != NULL; cFun = sdr->functionStack->prev()) { if (scmp(cFun->symbolName,constantBlockName) == 0) continue; if (scmp(cFun->symbolName,constantLoopName) == 0) continue; break; } if (cFun == NULL) sdr->error("Return target not found\n"); else { if (cFun->returnValue != NULL) { sdr->error("Function %s was expecting a return value\n",cFun->symbolName); } } ; break;} case 113: #line 1196 "sl.y" { CFunction *cFun = sdr->newFunction(constantLoopName); yyval.expression = yyvsp[-1].expression; ; break;} case 114: #line 1207 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CForLoop(NULL,yyvsp[-1].expression,NULL,yyvsp[0].code); ; break;} case 115: #line 1217 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CForLoop(NULL,yyvsp[-1].expression,NULL,yyvsp[0].code); ; break;} case 116: #line 1230 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-1].string); if (cVar == NULL) sdr->error("Identifier %s not found\n",yyvsp[-1].string); else sdr->desire(cVar->type); ; break;} case 117: #line 1237 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-3].string); if (cVar == NULL) { yyval.expression = new CNullExpression; } else { yyval.expression = new CAssignmentExpression(cVar,yyvsp[0].expression); sdr->undesire(); } ; break;} case 118: #line 1253 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-4].string); if (cVar == NULL) sdr->error("Identifier %s not found\n",yyvsp[-4].string); else sdr->desire(cVar->type); ; break;} case 119: #line 1260 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-6].string); if (cVar == NULL) { yyval.expression = new CNullExpression; } else { yyval.expression = new CArrayAssignmentExpression(cVar,yyvsp[-4].expression,yyvsp[0].expression); sdr->undesire(); } ; break;} case 120: #line 1277 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-1].string); if (cVar == NULL) sdr->error("Identifier %s not found\n",yyvsp[-1].string); else sdr->desire(cVar->type); ; break;} case 121: #line 1284 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-3].string); if (cVar == NULL) { yyval.expression = new CNullExpression; } else { yyval.expression = new CUpdateExpression(cVar,opcodeAddFloatFloat,opcodeAddVectorVector,FALSE,yyvsp[0].expression); sdr->undesire(); } ; break;} case 122: #line 1297 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-1].string); if (cVar == NULL) sdr->error("Identifier %s not found\n",yyvsp[-1].string); else sdr->desire(cVar->type); ; break;} case 123: #line 1304 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-3].string); if (cVar == NULL) { yyval.expression = new CNullExpression; } else { yyval.expression = new CUpdateExpression(cVar,opcodeSubFloatFloat,opcodeSubVectorVector,FALSE,yyvsp[0].expression); sdr->undesire(); } ; break;} case 124: #line 1317 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-1].string); if (cVar == NULL) sdr->error("Identifier %s not found\n",yyvsp[-1].string); else { yyval.expression = new CUpdateExpression(cVar,opcodeAddFloatFloat,opcodeAddVectorVector,FALSE,new CConstantTerminalExpression(SLC_FLOAT,sdup("1"))); } ; break;} case 125: #line 1328 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-1].string); if (cVar == NULL) sdr->error("Identifier %s not found\n",yyvsp[-1].string); else { yyval.expression = new CUpdateExpression(cVar,opcodeAddFloatFloat,opcodeAddVectorVector,FALSE,new CConstantTerminalExpression(SLC_FLOAT,sdup("-1"))); } ; break;} case 126: #line 1339 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-1].string); if (cVar == NULL) sdr->error("Identifier %s not found\n",yyvsp[-1].string); else sdr->desire(cVar->type); ; break;} case 127: #line 1346 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-3].string); if (cVar == NULL) { yyval.expression = new CNullExpression; } else { yyval.expression = new CUpdateExpression(cVar,opcodeMulFloatFloat,opcodeMulVectorVector,FALSE,yyvsp[0].expression); sdr->undesire(); } ; break;} case 128: #line 1359 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-1].string); if (cVar == NULL) sdr->error("Identifier %s not found\n",yyvsp[-1].string); else sdr->desire(cVar->type); ; break;} case 129: #line 1366 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-3].string); if (cVar == NULL) { yyval.expression = new CNullExpression; } else { yyval.expression = new CUpdateExpression(cVar,opcodeDivFloatFloat,opcodeDivVectorVector,FALSE,yyvsp[0].expression); sdr->undesire(); } ; break;} case 130: #line 1382 "sl.y" { CFunction *cFun = sdr->newFunction(constantLoopName); yyval.code = new CNullExpression; ; break;} case 131: #line 1398 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CForLoop(yyvsp[-4].expression,yyvsp[-6].code,yyvsp[0].code,yyvsp[-2].code); ; break;} case 132: #line 1415 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CForLoop(yyvsp[-6].code,yyvsp[-4].expression,yyvsp[-2].code,yyvsp[0].code); ; break;} case 133: #line 1426 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 134: #line 1430 "sl.y" { yyval.code = new CNullExpression; ; break;} case 135: #line 1441 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-2].expression,yyvsp[0].code); ; break;} case 136: #line 1446 "sl.y" { yyval.code = yyvsp[0].expression; ; break;} case 137: #line 1455 "sl.y" { yyval.expression = getConversion(SLC_BOOLEAN,yyvsp[0].expression); ; break;} case 138: #line 1459 "sl.y" { yyval.expression = new CConstantTerminalExpression(SLC_BOOLEAN | SLC_UNIFORM,sdup("true")); ; break;} case 139: #line 1468 "sl.y" { yyval.code = yyvsp[0].code; ; break;} case 140: #line 1472 "sl.y" { yyval.code = new CNullExpression; ; break;} case 141: #line 1483 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-2].expression,yyvsp[0].code); ; break;} case 142: #line 1488 "sl.y" { yyval.code = yyvsp[0].expression; ; break;} case 143: #line 1495 "sl.y" { yyval.code = new CTwoExpressions(yyvsp[-2].expression,yyvsp[0].code); ; break;} case 144: #line 1500 "sl.y" { yyval.code = yyvsp[0].expression; ; break;} case 145: #line 1515 "sl.y" { yyval.code = new CIfThenElse(yyvsp[-4].expression,yyvsp[-2].code,yyvsp[0].code); ; break;} case 146: #line 1528 "sl.y" { yyval.code = new CIfThenElse(yyvsp[-2].expression,yyvsp[0].code,NULL); ; break;} case 147: #line 1539 "sl.y" { yyval.code = new CIfThenElse(yyvsp[-4].expression,yyvsp[-2].code,yyvsp[0].code); ; break;} case 148: #line 1548 "sl.y" { CFunction *cCFunction = sdr->newFunction(constantLoopName); sdr->requiredShaderContext |= SLC_SURFACE; yyval.code = new CNullExpression; ; break;} case 149: #line 1562 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CIlluminationLoop(NULL,yyvsp[-2].expression,NULL,NULL,yyvsp[0].code); ; break;} case 150: #line 1575 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CIlluminationLoop(yyvsp[-4].expression,yyvsp[-2].expression,NULL,NULL,yyvsp[0].code); ; break;} case 151: #line 1590 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CIlluminationLoop(NULL,yyvsp[-6].expression,yyvsp[-4].expression,yyvsp[-2].expression,yyvsp[0].code); ; break;} case 152: #line 1607 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CIlluminationLoop(yyvsp[-8].expression,yyvsp[-6].expression,yyvsp[-4].expression,yyvsp[-2].expression,yyvsp[0].code); ; break;} case 153: #line 1620 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CIlluminationLoop(NULL,yyvsp[-2].expression,NULL,NULL,yyvsp[0].code); ; break;} case 154: #line 1633 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CIlluminationLoop(yyvsp[-4].expression,yyvsp[-2].expression,NULL,NULL,yyvsp[0].code); ; break;} case 155: #line 1648 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CIlluminationLoop(NULL,yyvsp[-6].expression,yyvsp[-4].expression,yyvsp[-2].expression,yyvsp[0].code); ; break;} case 156: #line 1665 "sl.y" { CFunction *cFun = sdr->popFunction(); yyval.code = new CIlluminationLoop(yyvsp[-8].expression,yyvsp[-6].expression,yyvsp[-4].expression,yyvsp[-2].expression,yyvsp[0].code); ; break;} case 157: #line 1680 "sl.y" { sdr->requiredShaderContext |= SLC_LIGHT; yyval.code = new CIlluminateSolar(opcodeIlluminate,opcodeEndIlluminate,yyvsp[-2].expression,NULL,NULL,yyvsp[0].code); ; break;} case 158: #line 1695 "sl.y" { sdr->requiredShaderContext |= SLC_LIGHT; yyval.code = new CIlluminateSolar(opcodeIlluminate,opcodeEndIlluminate,yyvsp[-6].expression,yyvsp[-4].expression,yyvsp[-2].expression,yyvsp[0].code); ; break;} case 159: #line 1708 "sl.y" { sdr->requiredShaderContext |= SLC_LIGHT; yyval.code = new CIlluminateSolar(opcodeIlluminate,opcodeEndIlluminate,yyvsp[-2].expression,NULL,NULL,yyvsp[0].code); ; break;} case 160: #line 1723 "sl.y" { sdr->requiredShaderContext |= SLC_LIGHT; yyval.code = new CIlluminateSolar(opcodeIlluminate,opcodeEndIlluminate,yyvsp[-6].expression,yyvsp[-4].expression,yyvsp[-2].expression,yyvsp[0].code); ; break;} case 161: #line 1737 "sl.y" { sdr->requiredShaderContext |= SLC_LIGHT; yyval.code = new CIlluminateSolar(opcodeSolar,opcodeEndSolar,NULL,NULL,NULL,yyvsp[0].code); ; break;} case 162: #line 1750 "sl.y" { sdr->requiredShaderContext |= SLC_LIGHT; yyval.code = new CIlluminateSolar(opcodeSolar,opcodeEndSolar,yyvsp[-4].expression,yyvsp[-2].expression,NULL,yyvsp[0].code); ; break;} case 163: #line 1762 "sl.y" { sdr->requiredShaderContext |= SLC_LIGHT; yyval.code = new CIlluminateSolar(opcodeSolar,opcodeEndSolar,NULL,NULL,NULL,yyvsp[0].code); ; break;} case 164: #line 1775 "sl.y" { sdr->requiredShaderContext |= SLC_LIGHT; yyval.code = new CIlluminateSolar(opcodeSolar,opcodeEndSolar,yyvsp[-4].expression,yyvsp[-2].expression,NULL,yyvsp[0].code); ; break;} case 165: #line 1786 "sl.y" { yyval.expression = yyvsp[0].expression; ; break;} case 166: #line 1793 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeAddFloatFloat,opcodeAddVectorVector,opcodeAddMatrixMatrix,NULL,NULL); ; break;} case 167: #line 1800 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeSubFloatFloat,opcodeSubVectorVector,opcodeSubMatrixMatrix,NULL,NULL); ; break;} case 168: #line 1807 "sl.y" { yyval.expression = NULL; if (yyvsp[-2].expression->type & SLC_MATRIX) { if (!(yyvsp[0].expression->type & SLC_MATRIX)) { yyval.expression = new CBinaryExpression(SLC_VECTOR,opcodeMulMatrixVector,yyvsp[-2].expression,getConversion(SLC_VECTOR,yyvsp[0].expression)); } } if (yyvsp[0].expression->type & SLC_MATRIX) { if (!(yyvsp[-2].expression->type & SLC_MATRIX)) { yyval.expression = new CBinaryExpression(SLC_VECTOR,opcodeMulVectorMatrix,yyvsp[-2].expression,getConversion(SLC_VECTOR,yyvsp[0].expression)); } } if (yyval.expression == NULL) yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeMulFloatFloat,opcodeMulVectorVector,opcodeMulMatrixMatrix,NULL,NULL); ; break;} case 169: #line 1830 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeDivFloatFloat,opcodeDivVectorVector,opcodeDivMatrixMatrix,NULL,NULL); ; break;} case 170: #line 1836 "sl.y" { sdr->desire(SLC_VECTOR | SLC_VVECTOR); ; break;} case 171: #line 1840 "sl.y" { sdr->undesire(); yyval.expression = new CBinaryExpression(SLC_FLOAT,opcodeDotProduct,getConversion(SLC_VECTOR,yyvsp[-3].expression),getConversion(SLC_VECTOR,yyvsp[0].expression)); ; break;} case 172: #line 1848 "sl.y" { yyval.expression = new CBinaryExpression(SLC_VECTOR,opcodeCrossProduct,getConversion(SLC_VECTOR,yyvsp[-2].expression),getConversion(SLC_VECTOR,yyvsp[0].expression)); ; break;} case 173: #line 1854 "sl.y" { yyval.expression = yyvsp[0].expression; ; break;} case 174: #line 1860 "sl.y" { yyval.expression = getOperation(yyvsp[0].expression,opcodeNegFloat,opcodeNegVector,opcodeNegMatrix,NULL,NULL); ; break;} case 175: #line 1869 "sl.y" { int ft = yyvsp[-2].expression->type; int st = yyvsp[0].expression->type; if ((yyvsp[-2].expression->type & SLC_TYPE_MASK) == (yyvsp[0].expression->type & SLC_TYPE_MASK)) { yyval.expression = new CConditionalExpression(yyvsp[-2].expression->type,yyvsp[-4].expression,yyvsp[-2].expression,yyvsp[0].expression); } else { sdr->error("Type mismatch in comditional execution\n"); } ; break;} case 176: #line 1883 "sl.y" { yyval.expression = new CConstantTerminalExpression(SLC_FLOAT | SLC_UNIFORM,sdup("3.141592654")); ; break;} case 177: #line 1888 "sl.y" { yyval.expression = yyvsp[0].expression; ; break;} case 178: #line 1893 "sl.y" { yyval.expression = yyvsp[0].expression; ; break;} case 179: #line 1898 "sl.y" { yyval.expression = yyvsp[0].expression; ; break;} case 180: #line 1903 "sl.y" { yyval.expression = yyvsp[0].expression; ; break;} case 181: #line 1908 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[0].string); if (cVar == NULL) { sdr->error("Identifier %s not found\n",yyvsp[0].string); yyval.expression = new CNullExpression; } else { yyval.expression = new CTerminalExpression(cVar); } ; break;} case 182: #line 1924 "sl.y" { CVariable *cVar = sdr->getVariable(yyvsp[-3].string); if (cVar == NULL) { sdr->error("Identifier %s not found\n",yyvsp[-3].string); yyval.expression = new CNullExpression; } else { yyval.expression = new CArrayExpression(cVar,yyvsp[-1].expression); } ; break;} case 183: #line 1936 "sl.y" { yyval.expression = new CConstantTerminalExpression(SLC_FLOAT,sdup(yyvsp[0].string)); ; break;} case 184: #line 1941 "sl.y" { yyval.expression = new CConstantTerminalExpression(SLC_STRING,sdup(yyvsp[0].string)); ; break;} case 185: #line 1952 "sl.y" { yyval.expression = new CVectorExpression(yyvsp[-5].expression,yyvsp[-3].expression,yyvsp[-1].expression); ; break;} case 186: #line 1989 "sl.y" { CExpression *elements[16]; elements[0] = yyvsp[-31].expression; elements[1] = yyvsp[-29].expression; elements[2] = yyvsp[-27].expression; elements[3] = yyvsp[-25].expression; elements[4] = yyvsp[-23].expression; elements[5] = yyvsp[-21].expression; elements[6] = yyvsp[-19].expression; elements[7] = yyvsp[-17].expression; elements[8] = yyvsp[-15].expression; elements[9] = yyvsp[-13].expression; elements[10] = yyvsp[-11].expression; elements[11] = yyvsp[-9].expression; elements[12] = yyvsp[-7].expression; elements[13] = yyvsp[-5].expression; elements[14] = yyvsp[-3].expression; elements[15] = yyvsp[-1].expression; yyval.expression = new CMatrixExpression(elements); ; break;} case 187: #line 2015 "sl.y" { yyval.expression = yyvsp[-1].expression; ; break;} case 188: #line 2024 "sl.y" { sdr->undesire(); yyval.expression = getConversion(yyvsp[-1].integer,yyvsp[0].expression); ; break;} case 189: #line 2033 "sl.y" { sdr->undesire(); yyval.expression = getConversion(yyvsp[-2].integer,yyvsp[-1].string,yyvsp[0].expression); ; break;} case 190: #line 2044 "sl.y" { yyval.expression = yyvsp[-1].expression; ; break;} case 191: #line 2051 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,NULL,NULL,NULL,NULL,opcodeAnd); ; break;} case 192: #line 2058 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,NULL,NULL,NULL,NULL,opcodeOr); ; break;} case 193: #line 2065 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeFloatGreater,opcodeVectorGreater,NULL,NULL,NULL); yyval.expression->type = SLC_BOOLEAN; ; break;} case 194: #line 2073 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeFloatLess,opcodeVectorLess,NULL,NULL,NULL); yyval.expression->type = SLC_BOOLEAN; ; break;} case 195: #line 2081 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeFloatEGreater,opcodeVectorEGreater,NULL,NULL,NULL); yyval.expression->type = SLC_BOOLEAN; ; break;} case 196: #line 2089 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeFloatELess,opcodeVectorELess,NULL,NULL,NULL); yyval.expression->type = SLC_BOOLEAN; ; break;} case 197: #line 2097 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeFloatEqual,opcodeVectorEqual,NULL,opcodeStringEqual,NULL); yyval.expression->type = SLC_BOOLEAN; ; break;} case 198: #line 2105 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,opcodeFloatNotEqual,opcodeVectorNotEqual,NULL,opcodeStringNotEqual,NULL); yyval.expression->type = SLC_BOOLEAN; ; break;} case 199: #line 2113 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,NULL,NULL,NULL,NULL,opcodeAnd); yyval.expression->type = SLC_BOOLEAN; ; break;} case 200: #line 2121 "sl.y" { yyval.expression = getOperation(yyvsp[-2].expression,yyvsp[0].expression,NULL,NULL,NULL,NULL,opcodeXor); yyval.expression->type = SLC_BOOLEAN; ; break;} case 201: #line 2128 "sl.y" { yyval.expression = new CUnaryExpression(SLC_BOOLEAN,opcodeNot,getConversion(SLC_BOOLEAN,yyvsp[0].expression)); ; break;} case 202: #line 2138 "sl.y" { CFunctionPrototype *cFun; CList *parameters = sdr->actualParameters; // This is the list of parameters to the function char *funName = yyvsp[0].string; // Clear the desired type flags sdr->undesire(); // Restore the old parameters sdr->actualParameters = sdr->actualParameterStack->pop(); // Check the builtin functions for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) { if (cFun->perfectMatch(yyvsp[0].string,parameters,sdr->desired())) break; } if (cFun == NULL) { for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) { if (cFun->match(yyvsp[0].string,parameters,sdr->desired())) break; } } if (cFun != NULL) { yyval.expression = new CBuiltinExpression(cFun,parameters); /* error */ } else { sdr->error("Function %s not found\n",yyvsp[0].string); if (parameters->numItems() != 0) { CExpression *cCode; while((cCode = parameters->pop()) != NULL) { delete cCode; } } delete parameters; yyval.expression = new CNullExpression; } ; break;} case 203: #line 2179 "sl.y" { // Save the old parameters sdr->actualParameterStack->push(sdr->actualParameters); // Start a new parameter list sdr->actualParameters = new CList; // Make sure we do not do something stupid with the parameters sdr->desire(SLC_NONE); ; break;} case 204: #line 2190 "sl.y" { CFunction *cFun; CList *parameters = sdr->actualParameters; // This is the list of parameters to the function char *funName = yyvsp[-4].string; if (scmp(funName,"MaterialClay") == 0) { int t = 1; } // Clear the desired type flags sdr->undesire(); // Restore the old parameters sdr->actualParameters = sdr->actualParameterStack->pop(); // Search for the CFunction here.... cFun = sdr->getFunction(yyvsp[-4].string,parameters); if (cFun != NULL) { // Cool, the function exists // A function with the same name is defined ... // Try to match the parameters; if (cFun->parameters->numItems() == parameters->numItems()) { // The number of parameters match // A function with the same name is defined and the number of Parameters match yyval.expression = new CFuncallExpression(cFun,parameters); } } // If not found, check the predefined CFunctions if (cFun == NULL) { CFunctionPrototype *cFun; char *fName = yyvsp[-4].string; // Check the builtin CFunctions for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) { if (cFun->perfectMatch(yyvsp[-4].string,parameters,sdr->desired())) break; } if (cFun == NULL) { for (cFun = sdr->builtinFunctions->first(); cFun != NULL; cFun = sdr->builtinFunctions->next()) { if (cFun->match(yyvsp[-4].string,parameters,sdr->desired())) break; } } if (cFun != NULL) { yyval.expression = new CBuiltinExpression(cFun,parameters); /* error */ } else { sdr->error("Function %s not found\n",yyvsp[-4].string); if (parameters->numItems() != 0) { CExpression *cCode; while((cCode = parameters->pop()) != NULL) { delete cCode; } } delete parameters; yyval.expression = new CNullExpression; } } ; break;} case 205: #line 2265 "sl.y" { // Fake the parameters CList *parameters = sdr->actualParameters; // This is the list of parameters to the function CList *pl = new CList; CExpression *cExpression; CVariable *cVariable; // Add the dummy variables at the beginning cVariable = sdr->getVariable(yyvsp[-3].string); if (cVariable == NULL) { sdr->error("Identifier %s not found\n",yyvsp[-5].string); pl->push(new CConstantTerminalExpression(SLC_STRING,sdup("\"dummy\""))); } else { pl->push(new CTerminalExpression(cVariable)); } pl->push(new CConstantTerminalExpression(SLC_FLOAT,sdup("0"))); for (cExpression=parameters->first();cExpression!=NULL;cExpression=parameters->next()) pl->push(cExpression); delete parameters; sdr->actualParameters = pl; yyval.string = yyvsp[-5].string; ; break;} case 206: #line 2300 "sl.y" { CList *parameters = sdr->actualParameters; // This is the list of parameters to the function CList *pl = new CList; CExpression *cExpression; CVariable *cVariable; // Add the dummy variables at the beginning cVariable = sdr->getVariable(yyvsp[-6].string); if (cVariable == NULL) { sdr->error("Identifier %s not found\n",yyvsp[-8].string); pl->push(new CConstantTerminalExpression(SLC_STRING,sdup("\"dummy\""))); } else { pl->push(new CTerminalExpression(cVariable)); } pl->push(yyvsp[-4].expression); for (cExpression=parameters->first();cExpression!=NULL;cExpression=parameters->next()) pl->push(cExpression); delete parameters; sdr->actualParameters = pl; yyval.string = yyvsp[-8].string; ; break;} case 207: #line 2332 "sl.y" { CList *parameters = sdr->actualParameters; // This is the list of parameters to the function CList *pl = new CList; CExpression *cExpression; // Add the dummy variables at the beginning pl->push(new CConstantTerminalExpression(SLC_STRING,sdup(yyvsp[-3].string))); pl->push(new CConstantTerminalExpression(SLC_FLOAT,sdup("0"))); for (cExpression=parameters->first();cExpression!=NULL;cExpression=parameters->next()) pl->push(cExpression); delete parameters; sdr->actualParameters = pl; yyval.string = yyvsp[-5].string; ; break;} case 208: #line 2358 "sl.y" { CList *parameters = sdr->actualParameters; // This is the list of parameters to the function CList *pl = new CList; CExpression *cExpression; // Add the dummy variables at the beginning pl->push(new CConstantTerminalExpression(SLC_STRING,sdup(yyvsp[-6].string))); pl->push(yyvsp[-4].expression); for (cExpression=parameters->first();cExpression!=NULL;cExpression=parameters->next()) pl->push(cExpression); delete parameters; sdr->actualParameters = pl; yyval.string = yyvsp[-8].string; ; break;} case 209: #line 2379 "sl.y" { yyval.string = "texture"; // Save the old parameters sdr->actualParameterStack->push(sdr->actualParameters); // Start a new parameter list sdr->actualParameters = new CList; // Make sure we do not do something stupid with the parameters sdr->desire(SLC_NONE); ; break;} case 210: #line 2392 "sl.y" { yyval.string = "shadow"; // Save the old parameters sdr->actualParameterStack->push(sdr->actualParameters); // Start a new parameter list sdr->actualParameters = new CList; // Make sure we do not do something stupid with the parameters sdr->desire(SLC_NONE); ; break;} case 211: #line 2405 "sl.y" { yyval.string = "environment"; // Save the old parameters sdr->actualParameterStack->push(sdr->actualParameters); // Start a new parameter list sdr->actualParameters = new CList; // Make sure we do not do something stupid with the parameters sdr->desire(SLC_NONE); ; break;} case 212: #line 2418 "sl.y" { yyval.string = "bump"; // Save the old parameters sdr->actualParameterStack->push(sdr->actualParameters); // Start a new parameter list sdr->actualParameters = new CList; // Make sure we do not do something stupid with the parameters sdr->desire(SLC_NONE); ; break;} case 213: #line 2435 "sl.y" { ; break;} case 214: #line 2438 "sl.y" { ; break;} case 215: #line 2445 "sl.y" { sdr->actualParameters->push(yyvsp[-1].expression); ; break;} case 216: #line 2449 "sl.y" { ; break;} case 217: #line 2453 "sl.y" { sdr->actualParameters->push(yyvsp[0].expression); ; break;} } /* the action file gets copied in in place of this dollarsign */ 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 2458 "sl.y" #include "lex.sl.cpp" int CScriptContext::compile(FILE *in) { sdr = this; yyin = in; yyparse(); if (compileError == 0) { char *tmp; // If there's no compile error, dump the compiled code tmp = new char[slen(sdr->shaderName)+5]; scpy(tmp,sdr->shaderName); scat(tmp,".sdr"); sdr->generateCode(tmp); delete [] tmp; return TRUE; } return FALSE; } void yyerror(char *mes) { sdr->error("Parse error\n"); }