/* A Bison parser, made by GNU Bison 1.875d. */ /* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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. */ /* Written by Richard Stallman by simplifying the original so called ``semantic'' parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* If NAME_PREFIX is specified substitute the variables and functions names. */ #define yyparse sdrparse #define yylex sdrlex #define yyerror sdrerror #define yylval sdrlval #define yychar sdrchar #define yydebug sdrdebug #define yynerrs sdrnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { SCRL_PARAMETERS = 258, SCRL_VARIABLES = 259, SCRL_OUTPUT = 260, SCRL_VARYING = 261, SCRL_VERTEX = 262, SCRL_UNIFORM = 263, SCRL_BOOLEAN = 264, SCRL_FLOAT = 265, SCRL_COLOR = 266, SCRL_VECTOR = 267, SCRL_NORMAL = 268, SCRL_POINT = 269, SCRL_MATRIX = 270, SCRL_STRING = 271, SCRL_SURFACE = 272, SCRL_DISPLACEMENT = 273, SCRL_IMAGER = 274, SCRL_LIGHTSOURCE = 275, SCRL_VOLUME = 276, SCRL_GENERIC = 277, SCRL_DSO = 278, SCRL_DOT = 279, SCRL_COLON = 280, SCRL_EQUAL = 281, SCRL_OPEN_PARANTHESIS = 282, SCRL_CLOSE_PARANTHESIS = 283, SCRL_OPEN_SQR_PARANTHESIS = 284, SCRL_CLOSE_SQR_PARANTHESIS = 285, SCRL_COMMA = 286, SCRL_NL = 287, SCRL_TEXT_VALUE = 288, SCRL_IDENTIFIER_VALUE = 289, SCRL_LABEL_VALUE = 290, SCRL_FLOAT_VALUE = 291 }; #endif #define SCRL_PARAMETERS 258 #define SCRL_VARIABLES 259 #define SCRL_OUTPUT 260 #define SCRL_VARYING 261 #define SCRL_VERTEX 262 #define SCRL_UNIFORM 263 #define SCRL_BOOLEAN 264 #define SCRL_FLOAT 265 #define SCRL_COLOR 266 #define SCRL_VECTOR 267 #define SCRL_NORMAL 268 #define SCRL_POINT 269 #define SCRL_MATRIX 270 #define SCRL_STRING 271 #define SCRL_SURFACE 272 #define SCRL_DISPLACEMENT 273 #define SCRL_IMAGER 274 #define SCRL_LIGHTSOURCE 275 #define SCRL_VOLUME 276 #define SCRL_GENERIC 277 #define SCRL_DSO 278 #define SCRL_DOT 279 #define SCRL_COLON 280 #define SCRL_EQUAL 281 #define SCRL_OPEN_PARANTHESIS 282 #define SCRL_CLOSE_PARANTHESIS 283 #define SCRL_OPEN_SQR_PARANTHESIS 284 #define SCRL_CLOSE_SQR_PARANTHESIS 285 #define SCRL_COMMA 286 #define SCRL_NL 287 #define SCRL_TEXT_VALUE 288 #define SCRL_IDENTIFIER_VALUE 289 #define SCRL_LABEL_VALUE 290 #define SCRL_FLOAT_VALUE 291 /* Copy the first part of user declarations. */ #line 1 "sdr.y" ////////////////////////////////////////////////////////////////////// // // Pixie // // Copyright © 1999 - 2003, Okan Arikan // // Contact: okan@cs.berkeley.edu // // This library 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 of the License, or (at your option) any later version. // // This library 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 library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // /////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// // // File : sl.y // Classes : - // Description : This is the parser file for CShader // //////////////////////////////////////////////////////////////////////// #undef alloca #include #include #include "common/algebra.h" #include "common/os.h" #include "sdr.h" ///////////////////////////////////////////////////////////////////////////////////// // First some temporary data structures used during the script parsing // Some forward definitions void sdrerror(char *); // Forward definition for stupid yacc int sdrlex(void ); // Forward definition for stupid yacc /////////////////////////////////////////////////////////////////////// // Function : // Description : // Return Value : // Comments : // Date last edited : static void processEscapes(char *str) { char *cstr; while((cstr = strchr(str,'\\')) != NULL) { switch(cstr[1]) { case 'n': cstr[0] = '\n'; break; case 't': cstr[0] = '\t'; break; case 'r': cstr[0] = '\r'; break; default: if (((cstr[1] >= 'a') && (cstr[1] <= 'z')) || ((cstr[1] >= 'A') && (cstr[1] <= 'Z'))) { // Unrecognised escape sequence sdrerror("Unrecognised escape sequence"); } else { cstr[0] = cstr[1]; } } { int i; for (i=2;cstr[i] != '\0';i++) { cstr[i-1] = cstr[i]; } cstr[i-1] = cstr[i]; } } } TSdrParameter *parameters; TSdrParameter *currentParameter; UDefaultVal *currentDefaultItem; int numArrayItemsRemaining; ESdrShaderType shaderType; /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) #line 98 "sdr.y" typedef union slval { float real; char string[64]; matrix m; vector v; TSdrParameter *parameter; } YYSTYPE; /* Line 191 of yacc.c. */ #line 263 "sdr.cpp" # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 214 of yacc.c. */ #line 275 "sdr.cpp" #if ! defined (yyoverflow) || YYERROR_VERBOSE # ifndef YYFREE # define YYFREE free # endif # ifndef YYMALLOC # define YYMALLOC malloc # endif /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # endif # else # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # endif #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short int yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined (__GNUC__) && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char; #else typedef short int yysigned_char; #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 13 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 268 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 37 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 61 /* YYNRULES -- Number of rules. */ #define YYNRULES 135 /* YYNRULES -- Number of states. */ #define YYNSTATES 301 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 291 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const unsigned 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 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const unsigned short int yyprhs[] = { 0, 0, 3, 9, 10, 13, 16, 23, 25, 31, 33, 36, 37, 39, 41, 42, 45, 48, 51, 54, 57, 62, 66, 67, 68, 72, 73, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 99, 102, 105, 107, 112, 115, 116, 125, 131, 135, 138, 139, 142, 147, 148, 157, 163, 167, 170, 171, 172, 177, 178, 187, 193, 194, 199, 200, 209, 215, 219, 220, 224, 225, 226, 231, 232, 241, 247, 248, 253, 254, 263, 269, 291, 296, 299, 300, 309, 315, 319, 339, 342, 343, 348, 352, 353, 356, 359, 362, 365, 368, 371, 374, 377, 380, 386, 389, 395, 398, 404, 407, 413, 416, 422, 425, 431, 434, 440, 443, 449, 453, 457, 461, 462, 463, 471, 473, 476, 477, 480, 483, 485, 487, 489, 491, 499, 533 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yysigned_char yyrhs[] = { 38, 0, -1, 44, 45, 79, 90, 39, -1, -1, 32, 39, -1, 33, 36, -1, 33, 29, 36, 36, 36, 30, -1, 36, -1, 29, 36, 36, 36, 30, -1, 40, -1, 26, 41, -1, -1, 8, -1, 6, -1, -1, 17, 32, -1, 18, 32, -1, 20, 32, -1, 21, 32, -1, 19, 32, -1, 3, 25, 32, 46, -1, 46, 47, 32, -1, -1, -1, 48, 51, 50, -1, -1, 49, 50, -1, 52, -1, 56, -1, 60, -1, 63, -1, 69, -1, 72, -1, 75, -1, 8, -1, 6, -1, 7, -1, 5, 8, -1, 5, 6, -1, 5, 7, -1, 5, -1, 10, 34, 26, 36, -1, 10, 34, -1, -1, 10, 34, 29, 36, 30, 26, 53, 54, -1, 10, 34, 29, 36, 30, -1, 29, 55, 30, -1, 55, 36, -1, -1, 16, 34, -1, 16, 34, 26, 33, -1, -1, 16, 34, 29, 36, 30, 26, 57, 58, -1, 16, 34, 29, 36, 30, -1, 29, 59, 30, -1, 59, 33, -1, -1, -1, 11, 34, 61, 42, -1, -1, 11, 34, 29, 36, 30, 26, 62, 66, -1, 11, 34, 29, 36, 30, -1, -1, 12, 34, 64, 42, -1, -1, 12, 34, 29, 36, 30, 26, 65, 66, -1, 12, 34, 29, 36, 30, -1, 29, 67, 30, -1, -1, 67, 68, 41, -1, -1, -1, 13, 34, 70, 42, -1, -1, 13, 34, 29, 36, 30, 26, 71, 66, -1, 13, 34, 29, 36, 30, -1, -1, 14, 34, 73, 42, -1, -1, 14, 34, 29, 36, 30, 26, 74, 66, -1, 14, 34, 29, 36, 30, -1, 15, 34, 26, 29, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 30, -1, 15, 34, 26, 36, -1, 15, 34, -1, -1, 15, 34, 29, 36, 30, 26, 76, 77, -1, 15, 34, 29, 36, 30, -1, 29, 78, 30, -1, 78, 29, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 30, -1, 78, 36, -1, -1, 4, 25, 32, 80, -1, 80, 81, 32, -1, -1, 43, 82, -1, 43, 83, -1, 43, 84, -1, 43, 86, -1, 43, 85, -1, 43, 87, -1, 43, 88, -1, 43, 89, -1, 9, 34, -1, 9, 34, 29, 36, 30, -1, 10, 34, -1, 10, 34, 29, 36, 30, -1, 16, 34, -1, 16, 34, 29, 36, 30, -1, 12, 34, -1, 12, 34, 29, 36, 30, -1, 11, 34, -1, 11, 34, 29, 36, 30, -1, 13, 34, -1, 13, 34, 29, 36, 30, -1, 14, 34, -1, 14, 34, 29, 36, 30, -1, 15, 34, -1, 15, 34, 29, 36, 30, -1, 90, 95, 32, -1, 90, 96, 32, -1, 90, 91, 32, -1, -1, -1, 23, 34, 92, 27, 33, 28, 94, -1, 34, -1, 97, 94, -1, -1, 93, 94, -1, 35, 25, -1, 33, -1, 35, -1, 34, -1, 36, -1, 27, 36, 31, 36, 31, 36, 28, -1, 27, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 31, 36, 28, -1, 27, 33, 28, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { 0, 150, 150, 157, 159, 163, 173, 187, 195, 208, 213, 216, 224, 228, 232, 237, 243, 249, 255, 261, 269, 276, 282, 287, 287, 300, 300, 315, 317, 319, 321, 323, 325, 327, 332, 337, 342, 347, 353, 359, 365, 372, 383, 398, 392, 409, 427, 438, 450, 454, 463, 480, 474, 491, 509, 520, 532, 538, 536, 555, 549, 566, 590, 588, 607, 601, 618, 640, 652, 651, 665, 671, 669, 688, 682, 699, 723, 721, 740, 734, 751, 773, 818, 846, 878, 872, 890, 926, 937, 984, 1010, 1014, 1021, 1024, 1028, 1031, 1034, 1037, 1040, 1043, 1046, 1049, 1054, 1059, 1070, 1075, 1085, 1090, 1100, 1105, 1115, 1120, 1130, 1135, 1145, 1150, 1160, 1165, 1175, 1179, 1183, 1186, 1192, 1190, 1203, 1209, 1214, 1219, 1226, 1233, 1237, 1241, 1245, 1249, 1259, 1295 }; #endif #if YYDEBUG || YYERROR_VERBOSE /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "SCRL_PARAMETERS", "SCRL_VARIABLES", "SCRL_OUTPUT", "SCRL_VARYING", "SCRL_VERTEX", "SCRL_UNIFORM", "SCRL_BOOLEAN", "SCRL_FLOAT", "SCRL_COLOR", "SCRL_VECTOR", "SCRL_NORMAL", "SCRL_POINT", "SCRL_MATRIX", "SCRL_STRING", "SCRL_SURFACE", "SCRL_DISPLACEMENT", "SCRL_IMAGER", "SCRL_LIGHTSOURCE", "SCRL_VOLUME", "SCRL_GENERIC", "SCRL_DSO", "SCRL_DOT", "SCRL_COLON", "SCRL_EQUAL", "SCRL_OPEN_PARANTHESIS", "SCRL_CLOSE_PARANTHESIS", "SCRL_OPEN_SQR_PARANTHESIS", "SCRL_CLOSE_SQR_PARANTHESIS", "SCRL_COMMA", "SCRL_NL", "SCRL_TEXT_VALUE", "SCRL_IDENTIFIER_VALUE", "SCRL_LABEL_VALUE", "SCRL_FLOAT_VALUE", "$accept", "start", "slEmptySpace", "slVectorIn", "slVector", "slVectorInit", "slContainer", "slType", "slParameterDefinitions", "slParameters", "slParameter", "@1", "@2", "slRegularParameter", "slGlobalParameterContainer", "slFloatParameter", "@3", "slFloatArrayInitializer", "slFloatArrayInitializerItems", "slStringParameter", "@4", "slStringArrayInitializer", "slStringArrayInitializerItems", "slColorParameter", "@5", "@6", "slVectorParameter", "@7", "@8", "slVectorArrayInitializer", "slVectorArrayInitializerItems", "@9", "slNormalParameter", "@10", "@11", "slPointParameter", "@12", "@13", "slMatrixParameter", "@14", "slMatrixArrayInitializer", "slMatrixArrayInitializerItems", "slVariableDefinitions", "slVariables", "slVariable", "slBooleanVariable", "slFloatVariable", "slStringVariable", "slVectorVariable", "slColorVariable", "slNormalVariable", "slPointVariable", "slMatrixVariable", "slCode", "slDSO", "@15", "slOpcode", "slOperandList", "slStatement", "slLabelDefinition", "slOperand", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const unsigned short int yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const unsigned char yyr1[] = { 0, 37, 38, 39, 39, 40, 40, 40, 40, 41, 42, 42, 43, 43, 43, 44, 44, 44, 44, 44, 45, 46, 46, 48, 47, 49, 47, 50, 50, 50, 50, 50, 50, 50, 51, 51, 51, 51, 51, 51, 51, 52, 52, 53, 52, 52, 54, 55, 55, 56, 56, 57, 56, 56, 58, 59, 59, 61, 60, 62, 60, 60, 64, 63, 65, 63, 63, 66, 68, 67, 67, 70, 69, 71, 69, 69, 73, 72, 74, 72, 72, 75, 75, 75, 76, 75, 75, 77, 78, 78, 78, 79, 80, 80, 81, 81, 81, 81, 81, 81, 81, 81, 82, 82, 83, 83, 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, 89, 89, 90, 90, 90, 90, 92, 91, 93, 94, 94, 95, 96, 97, 97, 97, 97, 97, 97, 97 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const unsigned char yyr2[] = { 0, 2, 5, 0, 2, 2, 6, 1, 5, 1, 2, 0, 1, 1, 0, 2, 2, 2, 2, 2, 4, 3, 0, 0, 3, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 4, 2, 0, 8, 5, 3, 2, 0, 2, 4, 0, 8, 5, 3, 2, 0, 0, 4, 0, 8, 5, 0, 4, 0, 8, 5, 3, 0, 3, 0, 0, 4, 0, 8, 5, 0, 4, 0, 8, 5, 21, 4, 2, 0, 8, 5, 3, 19, 2, 0, 4, 3, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5, 3, 3, 3, 0, 0, 7, 1, 2, 0, 2, 2, 1, 1, 1, 1, 7, 33, 3 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const unsigned char yydefact[] = { 0, 0, 0, 0, 0, 0, 0, 0, 15, 16, 19, 17, 18, 1, 0, 0, 0, 0, 121, 22, 0, 3, 25, 93, 0, 3, 124, 0, 2, 0, 126, 0, 0, 0, 0, 0, 14, 122, 4, 128, 120, 0, 129, 131, 130, 132, 127, 126, 118, 119, 21, 40, 35, 36, 34, 0, 0, 0, 0, 0, 0, 0, 0, 26, 27, 28, 29, 30, 31, 32, 33, 13, 12, 0, 0, 0, 0, 0, 125, 38, 39, 37, 24, 42, 57, 62, 71, 76, 83, 49, 0, 0, 0, 0, 0, 0, 0, 0, 94, 95, 96, 98, 97, 99, 100, 101, 92, 0, 135, 0, 0, 0, 0, 11, 0, 11, 0, 11, 0, 11, 0, 0, 0, 0, 102, 104, 110, 108, 112, 114, 116, 106, 0, 0, 41, 0, 0, 0, 58, 0, 63, 0, 72, 0, 77, 0, 82, 0, 50, 0, 0, 0, 0, 0, 0, 0, 0, 0, 126, 0, 45, 61, 0, 0, 7, 9, 10, 66, 75, 80, 0, 86, 53, 0, 0, 0, 0, 0, 0, 0, 0, 123, 0, 43, 59, 0, 0, 5, 64, 73, 78, 0, 84, 51, 103, 105, 111, 109, 113, 115, 117, 107, 133, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 48, 44, 70, 60, 0, 0, 65, 74, 79, 0, 90, 85, 56, 52, 0, 0, 68, 8, 0, 0, 0, 0, 0, 46, 47, 67, 0, 6, 0, 0, 87, 89, 54, 55, 0, 69, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 88, 0, 0, 0, 0, 0, 134 }; /* YYDEFGOTO[NTERM-NUM]. */ static const short int yydefgoto[] = { -1, 6, 28, 165, 166, 138, 73, 7, 15, 22, 33, 34, 35, 63, 55, 64, 204, 216, 230, 65, 213, 228, 236, 66, 113, 205, 67, 115, 208, 218, 231, 241, 68, 117, 209, 69, 119, 210, 70, 212, 226, 235, 18, 36, 74, 98, 99, 100, 101, 102, 103, 104, 105, 21, 29, 75, 30, 46, 31, 32, 47 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -146 static const short int yypact[] = { 36, -29, -28, -11, 33, 53, 67, 83, -146, -146, -146, -146, -146, -146, 62, 4, 56, 65, -146, -146, 57, -21, 55, -146, 58, 59, -146, 68, -146, 63, -17, 66, 69, 70, 64, 35, 1, -146, -146, -146, -146, -13, -146, -146, -146, -146, -146, -17, -146, -146, -146, 73, -146, -146, -146, 35, 60, 71, 72, 74, 75, 76, 78, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 16, 81, 77, 79, 84, -146, -146, -146, -146, -146, 13, 85, 87, 88, 89, 14, 47, 86, 90, 91, 92, 93, 94, 95, 96, -146, -146, -146, -146, -146, -146, -146, -146, -146, 98, -146, 61, 97, 99, 100, 106, 101, 106, 102, 106, 103, 106, -14, 104, 108, 107, 105, 113, 115, 116, 117, 118, 119, 120, 122, 121, -146, 123, 124, 5, -146, 125, -146, 126, -146, 127, -146, 128, -146, 129, -146, 130, 131, 132, 133, 134, 135, 136, 137, 138, -17, 139, 140, 150, 141, 8, -146, -146, -146, 152, 153, 154, 145, 156, 157, 155, 158, 159, 160, 161, 162, 163, 164, -146, 46, -146, -146, 148, 151, -146, -146, -146, -146, 165, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, 166, 167, 168, 169, 170, 168, 168, 168, 171, 174, 175, 177, -146, -146, -146, -146, 179, 176, -146, -146, -146, 178, -146, -146, -146, -146, 180, 22, 181, -146, 183, 182, -24, 45, 184, -146, -146, -146, 5, -146, 185, 186, -146, -146, -146, -146, 187, -146, 188, 189, 195, 191, 192, 193, 194, 196, 200, 197, 198, 199, 201, 202, 205, 203, 204, 206, 207, 208, 210, 209, 211, 212, 213, 214, 215, 190, 216, 217, -146, 218, 220, 219, 221, 222, 225, 223, 224, 226, 230, 233, 228, -146, 234, 231, 235, 232, 172, -146 }; /* YYPGOTO[NTERM-NUM]. */ static const short int yypgoto[] = { -146, -146, 173, -146, -145, -51, -146, -146, -146, -146, -146, -146, -146, 44, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -126, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -146, -47, -146, -146, -146 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -92 static const short int yytable[] = { 78, -91, 24, 8, 9, 244, 245, 71, 17, 72, 41, 25, 246, 26, 27, 145, 42, 43, 44, 45, 76, 10, 146, 77, -91, 90, 91, 92, 93, 94, 95, 96, 97, -91, 162, -91, -91, 186, 163, 110, 120, 164, 111, 121, 187, 56, 57, 58, 59, 60, 61, 62, 238, 1, 2, 3, 4, 5, 239, -20, -23, -23, -23, -23, 140, 11, 142, 13, 144, 51, 52, 53, 54, 122, 202, 247, 123, 203, 248, 79, 80, 81, 221, 222, 223, 12, 14, 16, 19, 23, 20, 25, 37, 39, 83, 40, 250, 133, 48, 82, 0, 49, 50, 0, 107, 84, 85, 108, 86, 87, 88, 181, 89, 106, 112, 109, 114, 116, 118, 0, 124, 0, 0, 0, 125, 126, 127, 128, 129, 130, 131, 132, 137, 134, 150, 135, 136, 139, 141, 143, 147, 148, 151, 149, 152, 153, 154, 155, 156, 157, 158, 0, 159, 160, 161, 167, 168, 169, 0, 171, 172, 0, 0, 0, 170, 0, 183, 173, 174, 175, 176, 177, 178, 179, 180, 182, 184, 185, 188, 189, 190, 191, 192, 193, 206, 194, 0, 207, 195, 196, 197, 198, 199, 200, 201, 0, 215, 217, 38, 0, 300, 211, 214, 225, 227, 219, 220, 224, 229, 232, 0, 240, 233, 242, 234, 249, 237, 0, 243, 0, 281, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 262, 261, 263, 264, 265, 268, 266, 267, 269, 270, 274, 271, 272, 273, 275, 280, 276, 277, 278, 279, 285, 282, 283, 284, 286, 289, 287, 288, 290, 291, 293, 292, 294, 295, 296, 298, 297, 299 }; static const short int yycheck[] = { 47, 0, 23, 32, 32, 29, 30, 6, 4, 8, 27, 32, 36, 34, 35, 29, 33, 34, 35, 36, 33, 32, 36, 36, 23, 9, 10, 11, 12, 13, 14, 15, 16, 32, 29, 34, 35, 29, 33, 26, 26, 36, 29, 29, 36, 10, 11, 12, 13, 14, 15, 16, 30, 17, 18, 19, 20, 21, 36, 4, 5, 6, 7, 8, 115, 32, 117, 0, 119, 5, 6, 7, 8, 26, 28, 30, 29, 31, 33, 6, 7, 8, 208, 209, 210, 32, 3, 25, 32, 32, 25, 32, 34, 25, 34, 32, 241, 36, 32, 55, -1, 32, 32, -1, 27, 34, 34, 28, 34, 34, 34, 158, 34, 32, 29, 31, 29, 29, 29, -1, 34, -1, -1, -1, 34, 34, 34, 34, 34, 34, 34, 33, 26, 36, 29, 36, 36, 36, 36, 36, 36, 33, 29, 36, 29, 29, 29, 29, 29, 29, 28, -1, 31, 30, 30, 30, 30, 30, -1, 30, 30, -1, -1, -1, 36, -1, 26, 36, 36, 36, 36, 36, 36, 36, 36, 36, 26, 36, 26, 26, 26, 36, 26, 26, 36, 30, -1, 36, 30, 30, 30, 30, 30, 30, 30, -1, 29, 29, 25, -1, 28, 36, 36, 29, 29, 36, 36, 36, 31, 30, -1, 30, 36, 30, 36, 31, 36, -1, 36, -1, 30, 36, 36, 36, 36, 36, 31, 36, 36, 36, 36, 31, 36, 36, 36, 36, 31, 36, 36, 36, 36, 31, 36, 36, 36, 36, 31, 36, 36, 36, 36, 31, 36, 36, 36, 36, 31, 36, 36, 36, 36, 31, 36, 30, 36, 31, 31, 36, 36 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const unsigned char yystos[] = { 0, 17, 18, 19, 20, 21, 38, 44, 32, 32, 32, 32, 32, 0, 3, 45, 25, 4, 79, 32, 25, 90, 46, 32, 23, 32, 34, 35, 39, 91, 93, 95, 96, 47, 48, 49, 80, 34, 39, 25, 32, 27, 33, 34, 35, 36, 94, 97, 32, 32, 32, 5, 6, 7, 8, 51, 10, 11, 12, 13, 14, 15, 16, 50, 52, 56, 60, 63, 69, 72, 75, 6, 8, 43, 81, 92, 33, 36, 94, 6, 7, 8, 50, 34, 34, 34, 34, 34, 34, 34, 9, 10, 11, 12, 13, 14, 15, 16, 82, 83, 84, 85, 86, 87, 88, 89, 32, 27, 28, 31, 26, 29, 29, 61, 29, 64, 29, 70, 29, 73, 26, 29, 26, 29, 34, 34, 34, 34, 34, 34, 34, 34, 33, 36, 36, 36, 36, 26, 42, 36, 42, 36, 42, 36, 42, 29, 36, 36, 33, 36, 29, 29, 29, 29, 29, 29, 29, 29, 28, 31, 30, 30, 29, 33, 36, 40, 41, 30, 30, 30, 36, 30, 30, 36, 36, 36, 36, 36, 36, 36, 36, 94, 36, 26, 26, 36, 29, 36, 26, 26, 26, 36, 26, 26, 30, 30, 30, 30, 30, 30, 30, 30, 28, 31, 53, 62, 36, 36, 65, 71, 74, 36, 76, 57, 36, 29, 54, 29, 66, 36, 36, 66, 66, 66, 36, 29, 77, 29, 58, 31, 55, 67, 30, 36, 36, 78, 59, 36, 30, 36, 30, 68, 30, 36, 29, 30, 36, 30, 33, 31, 41, 36, 36, 36, 36, 36, 31, 36, 36, 36, 36, 36, 31, 36, 36, 36, 36, 36, 31, 36, 36, 36, 36, 36, 31, 36, 36, 36, 36, 36, 31, 30, 36, 36, 36, 31, 36, 36, 36, 31, 36, 36, 36, 31, 30, 36, 31, 36, 31, 36, 28 }; #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* 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); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up");\ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ ((Current).first_line = (Rhs)[1].first_line, \ (Current).first_column = (Rhs)[1].first_column, \ (Current).last_line = (Rhs)[N].last_line, \ (Current).last_column = (Rhs)[N].last_column) #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) # define YYDSYMPRINT(Args) \ do { \ if (yydebug) \ yysymprint Args; \ } while (0) # define YYDSYMPRINTF(Title, Token, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yysymprint (stderr, \ Token, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yy_stack_print (short int *bottom, short int *top) #else static void yy_stack_print (bottom, top) short int *bottom; short int *top; #endif { YYFPRINTF (stderr, "Stack now"); for (/* Nothing. */; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (0) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yy_reduce_print (int yyrule) #else static void yy_reduce_print (yyrule) int yyrule; #endif { int yyi; unsigned int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", yyrule - 1, yylno); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (Rule); \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YYDSYMPRINT(Args) # define YYDSYMPRINTF(Title, Token, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #if defined (YYMAXDEPTH) && YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { register const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # endif # endif # ifndef yystpcpy # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { register char *yyd = yydest; register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif #endif /* !YYERROR_VERBOSE */ #if YYDEBUG /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) #else static void yysymprint (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; if (yytype < YYNTOKENS) { YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); # ifdef YYPRINT YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # endif } else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); switch (yytype) { default: break; } YYFPRINTF (yyoutput, ")"); } #endif /* ! YYDEBUG */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ #if defined (__STDC__) || defined (__cplusplus) static void yydestruct (int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yytype, yyvaluep) int yytype; YYSTYPE *yyvaluep; #endif { /* Pacify ``unused variable'' warnings. */ (void) yyvaluep; switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) int yyparse (void *YYPARSE_PARAM); # else int yyparse (); # endif #else /* ! YYPARSE_PARAM */ #if defined (__STDC__) || defined (__cplusplus) int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) int yyparse (void *YYPARSE_PARAM) # else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; # endif #else /* ! YYPARSE_PARAM */ #if defined (__STDC__) || defined (__cplusplus) int yyparse (void) #else int yyparse () #endif #endif { register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yytoken = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short int yyssa[YYINITDEPTH]; short int *yyss = yyssa; register short int *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #define YYPOPSTACK (yyvsp--, yyssp--) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); 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; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* 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 int *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. 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, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyoverflowlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { short int *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | 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 == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 5: #line 165 "sdr.y" { currentParameter->space = strdup(yyvsp[-1].string); currentDefaultItem->vector = new float[3]; currentDefaultItem->vector[0] = yyvsp[0].real; currentDefaultItem->vector[1] = yyvsp[0].real; currentDefaultItem->vector[2] = yyvsp[0].real; ;} break; case 6: #line 179 "sdr.y" { currentParameter->space = strdup(yyvsp[-5].string); currentDefaultItem->vector = new float[3]; currentDefaultItem->vector[0] = yyvsp[-3].real; currentDefaultItem->vector[1] = yyvsp[-2].real; currentDefaultItem->vector[2] = yyvsp[-1].real; ;} break; case 7: #line 188 "sdr.y" { currentDefaultItem->vector = new float[3]; currentDefaultItem->vector[0] = yyvsp[0].real; currentDefaultItem->vector[1] = yyvsp[0].real; currentDefaultItem->vector[2] = yyvsp[0].real; ;} break; case 8: #line 200 "sdr.y" { currentDefaultItem->vector = new float[3]; currentDefaultItem->vector[0] = yyvsp[-3].real; currentDefaultItem->vector[1] = yyvsp[-2].real; currentDefaultItem->vector[2] = yyvsp[-1].real; ;} break; case 9: #line 209 "sdr.y" { ;} break; case 11: #line 216 "sdr.y" { currentParameter->defaultValue.vector = new float[3]; currentParameter->defaultValue.vector[0] = 0; currentParameter->defaultValue.vector[1] = 0; currentParameter->defaultValue.vector[2] = 0; ;} break; case 12: #line 225 "sdr.y" { ;} break; case 13: #line 229 "sdr.y" { ;} break; case 14: #line 232 "sdr.y" { ;} break; case 15: #line 239 "sdr.y" { shaderType = SHADER_SURFACE; ;} break; case 16: #line 245 "sdr.y" { shaderType = SHADER_DISPLACEMENT; ;} break; case 17: #line 251 "sdr.y" { shaderType = SHADER_LIGHT; ;} break; case 18: #line 257 "sdr.y" { shaderType = SHADER_VOLUME; ;} break; case 19: #line 263 "sdr.y" { shaderType = SHADER_IMAGER; ;} break; case 21: #line 279 "sdr.y" { ;} break; case 22: #line 282 "sdr.y" { ;} break; case 23: #line 287 "sdr.y" { currentParameter = new TSdrParameter; currentParameter->space = NULL; currentParameter->numItems = 1; currentParameter->defaultValue.string = NULL; ;} break; case 24: #line 295 "sdr.y" { currentParameter->next = parameters; parameters = currentParameter; ;} break; case 25: #line 300 "sdr.y" { currentParameter = new TSdrParameter; currentParameter->space = NULL; currentParameter->numItems = 1; currentParameter->defaultValue.string = NULL; currentParameter->container = CONTAINER_UNIFORM; ;} break; case 26: #line 308 "sdr.y" { currentParameter->next = parameters; parameters = currentParameter; ;} break; case 34: #line 333 "sdr.y" { currentParameter->container = CONTAINER_UNIFORM; ;} break; case 35: #line 338 "sdr.y" { currentParameter->container = CONTAINER_VARYING; ;} break; case 36: #line 343 "sdr.y" { currentParameter->container = CONTAINER_VERTEX; ;} break; case 37: #line 349 "sdr.y" { currentParameter->container = CONTAINER_UNIFORM; ;} break; case 38: #line 355 "sdr.y" { currentParameter->container = CONTAINER_VARYING; ;} break; case 39: #line 361 "sdr.y" { currentParameter->container = CONTAINER_VERTEX; ;} break; case 40: #line 366 "sdr.y" { currentParameter->container = CONTAINER_UNIFORM; ;} break; case 41: #line 376 "sdr.y" { currentParameter->type = TYPE_FLOAT; currentParameter->name = strdup(yyvsp[-2].string); currentParameter->defaultValue.scalar = yyvsp[0].real; currentParameter->numItems = 1; ;} break; case 42: #line 385 "sdr.y" { currentParameter->type = TYPE_FLOAT; currentParameter->name = strdup(yyvsp[0].string); currentParameter->defaultValue.scalar = 0; currentParameter->numItems = 1; ;} break; case 43: #line 398 "sdr.y" { currentParameter->type = TYPE_FLOAT; currentParameter->name = strdup(yyvsp[-4].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-2].real]; currentParameter->numItems = (int) yyvsp[-2].real; currentDefaultItem = currentParameter->defaultValue.array; numArrayItemsRemaining = currentParameter->numItems; ;} break; case 45: #line 414 "sdr.y" { currentParameter->type = TYPE_FLOAT; currentParameter->name = strdup(yyvsp[-3].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-1].real]; currentParameter->numItems = (int) yyvsp[-1].real; currentDefaultItem = currentParameter->defaultValue.array; for(int i=0;inumItems;i++) currentDefaultItem[i].scalar = 0; ;} break; case 46: #line 430 "sdr.y" { if(numArrayItemsRemaining){ sdrerror("wrong number of items in array initializer\n"); } ;} break; case 47: #line 440 "sdr.y" { if(numArrayItemsRemaining){ currentDefaultItem->scalar = yyvsp[0].real; currentDefaultItem++; numArrayItemsRemaining--; } else{ sdrerror("wrong number of items in array initializer\n"); } ;} break; case 49: #line 456 "sdr.y" { currentParameter->type = TYPE_STRING; currentParameter->name = strdup(yyvsp[0].string); currentParameter->defaultValue.array = NULL; currentParameter->numItems = 1; ;} break; case 50: #line 467 "sdr.y" { currentParameter->type = TYPE_STRING; currentParameter->name = strdup(yyvsp[-2].string); currentParameter->defaultValue.string = strdup(yyvsp[0].string); currentParameter->numItems = 1; ;} break; case 51: #line 480 "sdr.y" { currentParameter->type = TYPE_STRING; currentParameter->name = strdup(yyvsp[-4].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-2].real]; currentParameter->numItems = (int) yyvsp[-2].real; currentDefaultItem = currentParameter->defaultValue.array; numArrayItemsRemaining = currentParameter->numItems; ;} break; case 53: #line 496 "sdr.y" { currentParameter->type = TYPE_STRING; currentParameter->name = strdup(yyvsp[-3].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-1].real]; currentParameter->numItems = (int) yyvsp[-1].real; currentDefaultItem = currentParameter->defaultValue.array; for(int i=0;inumItems;i++) currentDefaultItem[i].string = NULL; ;} break; case 54: #line 512 "sdr.y" { if(numArrayItemsRemaining){ sdrerror("wrong number of items in array initializer\n"); } ;} break; case 55: #line 522 "sdr.y" { if(numArrayItemsRemaining){ currentDefaultItem->string = strdup(yyvsp[0].string); currentDefaultItem++; numArrayItemsRemaining--; } else{ sdrerror("wrong number of items in array initializer\n"); } ;} break; case 57: #line 538 "sdr.y" { currentParameter->type = TYPE_COLOR; currentParameter->name = strdup(yyvsp[0].string); currentParameter->numItems = 1; currentDefaultItem = ¤tParameter->defaultValue; ;} break; case 58: #line 546 "sdr.y" { ;} break; case 59: #line 555 "sdr.y" { currentParameter->type = TYPE_COLOR; currentParameter->name = strdup(yyvsp[-4].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-2].real]; currentParameter->numItems = (int) yyvsp[-2].real; currentDefaultItem = currentParameter->defaultValue.array; numArrayItemsRemaining = currentParameter->numItems; ;} break; case 61: #line 571 "sdr.y" { currentParameter->type = TYPE_COLOR; currentParameter->name = strdup(yyvsp[-3].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-1].real]; currentParameter->numItems = (int) yyvsp[-1].real; currentDefaultItem = currentParameter->defaultValue.array; for(int i=0;inumItems;i++){ currentDefaultItem[i].vector = new float[3]; currentDefaultItem[i].vector[0] = 0; currentDefaultItem[i].vector[1] = 0; currentDefaultItem[i].vector[2] = 0; } ;} break; case 62: #line 590 "sdr.y" { currentParameter->type = TYPE_VECTOR; currentParameter->name = strdup(yyvsp[0].string); currentParameter->numItems = 1; currentDefaultItem = ¤tParameter->defaultValue; ;} break; case 63: #line 598 "sdr.y" { ;} break; case 64: #line 607 "sdr.y" { currentParameter->type = TYPE_VECTOR; currentParameter->name = strdup(yyvsp[-4].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-2].real]; currentParameter->numItems = (int) yyvsp[-2].real; currentDefaultItem = currentParameter->defaultValue.array; numArrayItemsRemaining = currentParameter->numItems; ;} break; case 66: #line 623 "sdr.y" { currentParameter->type = TYPE_VECTOR; currentParameter->name = strdup(yyvsp[-3].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-1].real]; currentParameter->numItems = (int) yyvsp[-1].real; currentDefaultItem = currentParameter->defaultValue.array; for(int i=0;inumItems;i++){ currentDefaultItem[i].vector = new float[3]; currentDefaultItem[i].vector[0] = 0; currentDefaultItem[i].vector[1] = 0; currentDefaultItem[i].vector[2] = 0; } ;} break; case 67: #line 643 "sdr.y" { if(numArrayItemsRemaining){ sdrerror("wrong number of items in array initializer\n"); } ;} break; case 68: #line 652 "sdr.y" { if(numArrayItemsRemaining){ currentDefaultItem->vector = new float[3]; } else{ sdrerror("wrong number of items in array initializer\n"); } ;} break; case 69: #line 661 "sdr.y" { currentDefaultItem++; numArrayItemsRemaining--; ;} break; case 71: #line 671 "sdr.y" { currentParameter->type = TYPE_NORMAL; currentParameter->name = strdup(yyvsp[0].string); currentParameter->numItems = 1; currentDefaultItem = ¤tParameter->defaultValue; ;} break; case 72: #line 679 "sdr.y" { ;} break; case 73: #line 688 "sdr.y" { currentParameter->type = TYPE_NORMAL; currentParameter->name = strdup(yyvsp[-4].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-2].real]; currentParameter->numItems = (int) yyvsp[-2].real; currentDefaultItem = currentParameter->defaultValue.array; numArrayItemsRemaining = currentParameter->numItems; ;} break; case 75: #line 704 "sdr.y" { currentParameter->type = TYPE_NORMAL; currentParameter->name = strdup(yyvsp[-3].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-1].real]; currentParameter->numItems = (int) yyvsp[-1].real; currentDefaultItem = currentParameter->defaultValue.array; for(int i=0;inumItems;i++){ currentDefaultItem[i].vector = new float[3]; currentDefaultItem[i].vector[0] = 0; currentDefaultItem[i].vector[1] = 0; currentDefaultItem[i].vector[3] = 0; } ;} break; case 76: #line 723 "sdr.y" { currentParameter->type = TYPE_POINT; currentParameter->name = strdup(yyvsp[0].string); currentParameter->numItems = 1; currentDefaultItem = ¤tParameter->defaultValue; ;} break; case 77: #line 731 "sdr.y" { ;} break; case 78: #line 740 "sdr.y" { currentParameter->type = TYPE_POINT; currentParameter->name = strdup(yyvsp[-4].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-2].real]; currentParameter->numItems = (int) yyvsp[-2].real; currentDefaultItem = currentParameter->defaultValue.array; numArrayItemsRemaining = currentParameter->numItems; ;} break; case 80: #line 756 "sdr.y" { currentParameter->type = TYPE_POINT; currentParameter->name = strdup(yyvsp[-3].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-1].real]; currentParameter->numItems = (int) yyvsp[-1].real; currentDefaultItem = currentParameter->defaultValue.array; for(int i=0;inumItems;i++){ currentDefaultItem[i].vector = new float[3]; currentDefaultItem[i].vector[0] = 0; currentDefaultItem[i].vector[1] = 0; currentDefaultItem[i].vector[2] = 0; } ;} break; case 81: #line 794 "sdr.y" { currentParameter->container = CONTAINER_UNIFORM; currentParameter->type = TYPE_MATRIX; currentParameter->name = strdup(yyvsp[-19].string); currentParameter->defaultValue.matrix = new float[16]; currentParameter->defaultValue.matrix[0] = yyvsp[-16].real; currentParameter->defaultValue.matrix[1] = yyvsp[-15].real; currentParameter->defaultValue.matrix[2] = yyvsp[-14].real; currentParameter->defaultValue.matrix[3] = yyvsp[-13].real; currentParameter->defaultValue.matrix[4] = yyvsp[-12].real; currentParameter->defaultValue.matrix[5] = yyvsp[-11].real; currentParameter->defaultValue.matrix[6] = yyvsp[-10].real; currentParameter->defaultValue.matrix[7] = yyvsp[-9].real; currentParameter->defaultValue.matrix[8] = yyvsp[-8].real; currentParameter->defaultValue.matrix[9] = yyvsp[-7].real; currentParameter->defaultValue.matrix[10] = yyvsp[-6].real; currentParameter->defaultValue.matrix[11] = yyvsp[-5].real; currentParameter->defaultValue.matrix[12] = yyvsp[-4].real; currentParameter->defaultValue.matrix[13] = yyvsp[-3].real; currentParameter->defaultValue.matrix[14] = yyvsp[-2].real; currentParameter->defaultValue.matrix[15] = yyvsp[-1].real; currentParameter->numItems = 1; ;} break; case 82: #line 822 "sdr.y" { currentParameter->container = CONTAINER_UNIFORM; currentParameter->type = TYPE_MATRIX; currentParameter->name = strdup(yyvsp[-2].string); currentParameter->defaultValue.matrix = new float[16]; currentParameter->defaultValue.matrix[0] = yyvsp[0].real; currentParameter->defaultValue.matrix[1] = 0; currentParameter->defaultValue.matrix[2] = 0; currentParameter->defaultValue.matrix[3] = 0; currentParameter->defaultValue.matrix[4] = 0; currentParameter->defaultValue.matrix[5] = yyvsp[0].real; currentParameter->defaultValue.matrix[6] = 0; currentParameter->defaultValue.matrix[7] = 0; currentParameter->defaultValue.matrix[8] = 0; currentParameter->defaultValue.matrix[9] = 0; currentParameter->defaultValue.matrix[10] = yyvsp[0].real; currentParameter->defaultValue.matrix[11] = 0; currentParameter->defaultValue.matrix[12] = 0; currentParameter->defaultValue.matrix[13] = 0; currentParameter->defaultValue.matrix[14] = 0; currentParameter->defaultValue.matrix[15] = yyvsp[0].real; currentParameter->numItems = 1; ;} break; case 83: #line 848 "sdr.y" { currentParameter->container = CONTAINER_UNIFORM; currentParameter->type = TYPE_MATRIX; currentParameter->name = strdup(yyvsp[0].string); currentParameter->defaultValue.matrix = new float[16]; currentParameter->defaultValue.matrix[0] = 1; currentParameter->defaultValue.matrix[1] = 0; currentParameter->defaultValue.matrix[2] = 0; currentParameter->defaultValue.matrix[3] = 0; currentParameter->defaultValue.matrix[4] = 0; currentParameter->defaultValue.matrix[5] = 1; currentParameter->defaultValue.matrix[6] = 0; currentParameter->defaultValue.matrix[7] = 0; currentParameter->defaultValue.matrix[8] = 0; currentParameter->defaultValue.matrix[9] = 0; currentParameter->defaultValue.matrix[10] = 1; currentParameter->defaultValue.matrix[11] = 0; currentParameter->defaultValue.matrix[12] = 0; currentParameter->defaultValue.matrix[13] = 0; currentParameter->defaultValue.matrix[14] = 0; currentParameter->defaultValue.matrix[15] = 1; currentParameter->numItems = 1; ;} break; case 84: #line 878 "sdr.y" { currentParameter->container = CONTAINER_UNIFORM; currentParameter->type = TYPE_MATRIX; currentParameter->name = strdup(yyvsp[-4].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-2].real]; currentParameter->numItems = (int) yyvsp[-2].real; currentDefaultItem = currentParameter->defaultValue.array; numArrayItemsRemaining = currentParameter->numItems; ;} break; case 86: #line 895 "sdr.y" { currentParameter->container = CONTAINER_UNIFORM; currentParameter->type = TYPE_MATRIX; currentParameter->name = strdup(yyvsp[-3].string); currentParameter->defaultValue.array = new UDefaultVal[(int) yyvsp[-1].real]; currentParameter->numItems = (int) yyvsp[-1].real; currentDefaultItem = currentParameter->defaultValue.array; for(int i=0;inumItems;i++){ currentDefaultItem[i].matrix = new float[16]; currentDefaultItem[i].matrix[0] = 1; currentDefaultItem[i].matrix[1] = 0; currentDefaultItem[i].matrix[2] = 0; currentDefaultItem[i].matrix[3] = 0; currentDefaultItem[i].matrix[4] = 0; currentDefaultItem[i].matrix[5] = 1; currentDefaultItem[i].matrix[6] = 0; currentDefaultItem[i].matrix[7] = 0; currentDefaultItem[i].matrix[8] = 0; currentDefaultItem[i].matrix[9] = 0; currentDefaultItem[i].matrix[10] = 1; currentDefaultItem[i].matrix[11] = 0; currentDefaultItem[i].matrix[12] = 0; currentDefaultItem[i].matrix[13] = 0; currentDefaultItem[i].matrix[14] = 0; currentDefaultItem[i].matrix[15] = 1; } ;} break; case 87: #line 929 "sdr.y" { if(numArrayItemsRemaining){ sdrerror("wrong number of items in array initializer\n"); } ;} break; case 88: #line 956 "sdr.y" { if(numArrayItemsRemaining){ currentDefaultItem->matrix = new float[16]; currentDefaultItem->matrix[0] = yyvsp[-16].real; currentDefaultItem->matrix[1] = yyvsp[-15].real; currentDefaultItem->matrix[2] = yyvsp[-14].real; currentDefaultItem->matrix[3] = yyvsp[-13].real; currentDefaultItem->matrix[4] = yyvsp[-12].real; currentDefaultItem->matrix[5] = yyvsp[-11].real; currentDefaultItem->matrix[6] = yyvsp[-10].real; currentDefaultItem->matrix[7] = yyvsp[-9].real; currentDefaultItem->matrix[8] = yyvsp[-8].real; currentDefaultItem->matrix[9] = yyvsp[-7].real; currentDefaultItem->matrix[10] = yyvsp[-6].real; currentDefaultItem->matrix[11] = yyvsp[-5].real; currentDefaultItem->matrix[12] = yyvsp[-4].real; currentDefaultItem->matrix[13] = yyvsp[-3].real; currentDefaultItem->matrix[14] = yyvsp[-2].real; currentDefaultItem->matrix[15] = yyvsp[-1].real; currentDefaultItem++; numArrayItemsRemaining--; } else{ sdrerror("wrong number of items in array initializer\n"); } ;} break; case 89: #line 986 "sdr.y" { if(numArrayItemsRemaining){ currentDefaultItem->matrix = new float[16]; currentDefaultItem->matrix[0] = yyvsp[0].real; currentDefaultItem->matrix[1] = 0; currentDefaultItem->matrix[2] = 0; currentDefaultItem->matrix[3] = 0; currentDefaultItem->matrix[4] = 0; currentDefaultItem->matrix[5] = yyvsp[0].real; currentDefaultItem->matrix[6] = 0; currentDefaultItem->matrix[7] = 0; currentDefaultItem->matrix[8] = 0; currentDefaultItem->matrix[9] = 0; currentDefaultItem->matrix[10] = yyvsp[0].real; currentDefaultItem->matrix[11] = 0; currentDefaultItem->matrix[12] = 0; currentDefaultItem->matrix[13] = 0; currentDefaultItem->matrix[14] = 0; currentDefaultItem->matrix[15] = 1; currentDefaultItem++; numArrayItemsRemaining--; } ;} break; case 102: #line 1056 "sdr.y" { ;} break; case 103: #line 1064 "sdr.y" { ;} break; case 104: #line 1072 "sdr.y" { ;} break; case 105: #line 1080 "sdr.y" { ;} break; case 106: #line 1087 "sdr.y" { ;} break; case 107: #line 1095 "sdr.y" { ;} break; case 108: #line 1102 "sdr.y" { ;} break; case 109: #line 1110 "sdr.y" { ;} break; case 110: #line 1117 "sdr.y" { ;} break; case 111: #line 1125 "sdr.y" { ;} break; case 112: #line 1132 "sdr.y" { ;} break; case 113: #line 1140 "sdr.y" { ;} break; case 114: #line 1147 "sdr.y" { ;} break; case 115: #line 1155 "sdr.y" { ;} break; case 116: #line 1162 "sdr.y" { ;} break; case 117: #line 1170 "sdr.y" { ;} break; case 122: #line 1192 "sdr.y" { ;} break; case 123: #line 1198 "sdr.y" { ;} break; case 124: #line 1204 "sdr.y" { ;} break; case 125: #line 1211 "sdr.y" { ;} break; case 126: #line 1214 "sdr.y" { ;} break; case 127: #line 1221 "sdr.y" { ;} break; case 128: #line 1228 "sdr.y" { ;} break; case 129: #line 1234 "sdr.y" { ;} break; case 130: #line 1238 "sdr.y" { ;} break; case 131: #line 1242 "sdr.y" { ;} break; case 132: #line 1246 "sdr.y" { ;} break; case 133: #line 1256 "sdr.y" { ;} break; case 134: #line 1292 "sdr.y" { ;} break; case 135: #line 1298 "sdr.y" { ;} break; } /* Line 1010 of yacc.c. */ #line 2379 "sdr.cpp" yyvsp -= yylen; yyssp -= yylen; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* 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 - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if YYERROR_VERBOSE yyn = yypact[yystate]; if (YYPACT_NINF < yyn && yyn < YYLAST) { YYSIZE_T yysize = 0; int yytype = YYTRANSLATE (yychar); const char* yyprefix; char *yymsg; int yyx; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 0; yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); yycount += 1; if (yycount == 5) { yysize = 0; break; } } yysize += (sizeof ("syntax error, unexpected ") + yystrlen (yytname[yytype])); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); yyp = yystpcpy (yyp, yytname[yytype]); if (yycount < 5) { yyprefix = ", expecting "; for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { yyp = yystpcpy (yyp, yyprefix); yyp = yystpcpy (yyp, yytname[yyx]); yyprefix = " or "; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("syntax error; also virtual memory exhausted"); } else #endif /* YYERROR_VERBOSE */ yyerror ("syntax error"); } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* If at end of input, pop the error token, then the rest of the stack, then return failure. */ if (yychar == YYEOF) for (;;) { YYPOPSTACK; if (yyssp == yyss) YYABORT; YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[*yyssp], yyvsp); } } else { YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); yydestruct (yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: #ifdef __GNUC__ /* Pacify GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (0) goto yyerrorlab; #endif yyvsp -= yylen; yyssp -= yylen; yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); yydestruct (yystos[yystate], yyvsp); YYPOPSTACK; yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*----------------------------------------------. | yyoverflowlab -- parser overflow comes here. | `----------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ #endif yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } #line 1302 "sdr.y" #include "lex.sdr.cpp" int slLineno = 0; /////////////////////////////////////////////////////////////////////// // Function : sdrerror // Description : Parser error function // Return Value : // Comments : // Date last edited : 5/20/2003 void sdrerror(char *s) { fprintf(stdout,"%s\n",s); } /////////////////////////////////////////////////////////////////////// // Function : sdrGet // Description : Parse a shader // Return Value : // Comments : // Date last edited : 5/20/2003 TSdrShader *sdrGet(const char *in,const char *searchpath) { TSdrShader *cShader; char tmp[512]; const char *currentPath; char *dest; memoryManagerInit(); sdrin = fopen(in,"r"); if (sdrin == NULL) { if (searchpath != NULL) { for (dest=tmp,currentPath=searchpath;;) { if ((*currentPath == '\0') || (*currentPath == ':')) { // End of the current path if ((dest - tmp) > 0) { // Do we have anything to record ? dest--; if ((*dest == '/') || (*dest == '\\')) { // The last character has to be a slash dest++; } else { dest++; *dest++ = '/'; } sprintf(dest,in); if (strstr(dest,".sdr") == NULL) { strcat(dest,".sdr"); } osFixSlashes(tmp); if (strncmp(tmp,"\\\\",2) == 0) { tmp[1] = tmp[2]; tmp[2] = ':'; tmp[3] = '\\'; sdrin = fopen(tmp+1,"r"); } else { sdrin = fopen(tmp,"r"); } if (sdrin != NULL) break; } dest = tmp; if (*currentPath == '\0') break; currentPath++; } else if (*currentPath == '%') { const char *endOfCurrentPath = strchr(currentPath+1,'%'); char environmentVariable[OS_MAX_PATH_LENGTH]; if (endOfCurrentPath!=NULL) { const int environmentLength = endOfCurrentPath - currentPath - 1; const char *value; strncpy(environmentVariable,currentPath+1,environmentLength); environmentVariable[environmentLength] = '\0'; value = osEnvironment(environmentVariable); if (value != NULL) { strcpy(dest,value); dest += strlen(value); } currentPath = endOfCurrentPath+1; } else { currentPath++; } } else if ((*currentPath == '@') || (*currentPath == '&')) { currentPath++; } else { *dest++ = *currentPath++; } } } } if (sdrin == NULL) return NULL; parameters = NULL; sdrparse(); fclose(sdrin); cShader = new TSdrShader; cShader->name = strdup(in); cShader->type = shaderType; cShader->parameters = parameters; return cShader; } /////////////////////////////////////////////////////////////////////// // Function : sdrDelete // Description : Delete a shader // Return Value : // Comments : // Date last edited : 5/20/2003 void sdrDelete(TSdrShader *cShader) { TSdrParameter *cParameter; while((cParameter = cShader->parameters) != NULL) { cShader->parameters = cParameter->next; free(cParameter->name); if (cParameter->space != NULL) { free(cParameter->space); } if (cParameter->numItems == 1) { switch(cParameter->type) { case TYPE_FLOAT: break; case TYPE_VECTOR: case TYPE_NORMAL: case TYPE_POINT: case TYPE_COLOR: if (cParameter->defaultValue.vector != NULL) { delete [] cParameter->defaultValue.vector; } break; case TYPE_MATRIX: if (cParameter->defaultValue.matrix != NULL) { delete [] cParameter->defaultValue.matrix; } break; case TYPE_STRING: if (cParameter->defaultValue.string != NULL) { free(cParameter->defaultValue.string); } break; } } delete cParameter; } free(cShader->name); delete cShader; memoryManagerTini(); }