00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define YYBISON 1
00048
00049
00050 #define YYBISON_VERSION "2.3"
00051
00052
00053 #define YYSKELETON_NAME "yacc.c"
00054
00055
00056 #define YYPURE 0
00057
00058
00059 #define YYLSP_NEEDED 0
00060
00061
00062
00063
00064 #ifndef YYTOKENTYPE
00065 # define YYTOKENTYPE
00066
00067
00068 enum yytokentype {
00069 STRING = 258,
00070 ID = 259,
00071 NUM = 260,
00072 LBRACK = 261,
00073 RBRACK = 262,
00074 ACCELERATOR = 263,
00075 AREALIGHTSOURCE = 264,
00076 ATTRIBUTEBEGIN = 265,
00077 ATTRIBUTEEND = 266,
00078 CAMERA = 267,
00079 CONCATTRANSFORM = 268,
00080 COORDINATESYSTEM = 269,
00081 COORDSYSTRANSFORM = 270,
00082 FILM = 271,
00083 IDENTITY = 272,
00084 LIGHTSOURCE = 273,
00085 LOOKAT = 274,
00086 MATERIAL = 275,
00087 MAKENAMEDMATERIAL = 276,
00088 NAMEDMATERIAL = 277,
00089 OBJECTBEGIN = 278,
00090 OBJECTEND = 279,
00091 OBJECTINSTANCE = 280,
00092 PIXELFILTER = 281,
00093 REVERSEORIENTATION = 282,
00094 ROTATE = 283,
00095 SAMPLER = 284,
00096 SCALE = 285,
00097 SEARCHPATH = 286,
00098 PORTALSHAPE = 287,
00099 SHAPE = 288,
00100 SURFACEINTEGRATOR = 289,
00101 TEXTURE = 290,
00102 TRANSFORMBEGIN = 291,
00103 TRANSFORMEND = 292,
00104 TRANSFORM = 293,
00105 TRANSLATE = 294,
00106 VOLUME = 295,
00107 VOLUMEINTEGRATOR = 296,
00108 WORLDBEGIN = 297,
00109 WORLDEND = 298,
00110 HIGH_PRECEDENCE = 299
00111 };
00112 #endif
00113
00114 #define STRING 258
00115 #define ID 259
00116 #define NUM 260
00117 #define LBRACK 261
00118 #define RBRACK 262
00119 #define ACCELERATOR 263
00120 #define AREALIGHTSOURCE 264
00121 #define ATTRIBUTEBEGIN 265
00122 #define ATTRIBUTEEND 266
00123 #define CAMERA 267
00124 #define CONCATTRANSFORM 268
00125 #define COORDINATESYSTEM 269
00126 #define COORDSYSTRANSFORM 270
00127 #define FILM 271
00128 #define IDENTITY 272
00129 #define LIGHTSOURCE 273
00130 #define LOOKAT 274
00131 #define MATERIAL 275
00132 #define MAKENAMEDMATERIAL 276
00133 #define NAMEDMATERIAL 277
00134 #define OBJECTBEGIN 278
00135 #define OBJECTEND 279
00136 #define OBJECTINSTANCE 280
00137 #define PIXELFILTER 281
00138 #define REVERSEORIENTATION 282
00139 #define ROTATE 283
00140 #define SAMPLER 284
00141 #define SCALE 285
00142 #define SEARCHPATH 286
00143 #define PORTALSHAPE 287
00144 #define SHAPE 288
00145 #define SURFACEINTEGRATOR 289
00146 #define TEXTURE 290
00147 #define TRANSFORMBEGIN 291
00148 #define TRANSFORMEND 292
00149 #define TRANSFORM 293
00150 #define TRANSLATE 294
00151 #define VOLUME 295
00152 #define VOLUMEINTEGRATOR 296
00153 #define WORLDBEGIN 297
00154 #define WORLDEND 298
00155 #define HIGH_PRECEDENCE 299
00156
00157
00158
00159
00160
00161 #line 24 "/builddir/build/BUILD/lux/core/luxparse.y"
00162
00163 #include "api.h"
00164 #include "lux.h"
00165 #include "error.h"
00166 #include "paramset.h"
00167 #include "context.h"
00168 #include "memory.h"
00169 #include <stdarg.h>
00170 #include <sstream>
00171
00172 using namespace lux;
00173
00174 extern int yylex( void );
00175 int line_num = 0;
00176 string current_file;
00177
00178 #define YYMAXDEPTH 100000000
00179
00180 void yyerror( const char *str ) {
00181 std::stringstream ss;
00182 ss<<"Parsing error: "<<str;
00183 luxError( LUX_SYNTAX,LUX_SEVERE,ss.str().c_str());
00184
00185 }
00186
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199 int cur_paramlist_allocated = 0;
00200 int cur_paramlist_size = 0;
00201 const char **cur_paramlist_tokens = NULL;
00202 void **cur_paramlist_args = NULL;
00203 int *cur_paramlist_sizes = NULL;
00204 bool *cur_paramlist_texture_helper = NULL;
00205
00206 #define CPS cur_paramlist_size
00207 #define CPT cur_paramlist_tokens
00208 #define CPA cur_paramlist_args
00209 #define CPTH cur_paramlist_texture_helper
00210 #define CPSZ cur_paramlist_sizes
00211
00212 typedef struct ParamArray {
00213 int element_size;
00214 int allocated;
00215 int nelems;
00216 void *array;
00217 } ParamArray;
00218
00219 ParamArray *cur_array = NULL;
00220 bool array_is_single_string = false;
00221
00222 #define NA(r) ((float *) r->array)
00223 #define SA(r) ((const char **) r->array)
00224
00225 void AddArrayElement( void *elem ) {
00226 if (cur_array->nelems >= cur_array->allocated) {
00227 cur_array->allocated = 2*cur_array->allocated + 1;
00228 cur_array->array = realloc( cur_array->array,
00229 cur_array->allocated*cur_array->element_size );
00230 }
00231 char *next = ((char *)cur_array->array) + cur_array->nelems *
00232 cur_array->element_size;
00233 memcpy( next, elem, cur_array->element_size );
00234 cur_array->nelems++;
00235 }
00236
00237 ParamArray *ArrayDup( ParamArray *ra )
00238 {
00239 ParamArray *ret = new ParamArray;
00240 ret->element_size = ra->element_size;
00241 ret->allocated = ra->allocated;
00242 ret->nelems = ra->nelems;
00243 ret->array = malloc(ra->nelems * ra->element_size);
00244 memcpy( ret->array, ra->array, ra->nelems * ra->element_size );
00245 return ret;
00246 }
00247
00248 void ArrayFree( ParamArray *ra )
00249 {
00250 free(ra->array);
00251 delete ra;
00252 }
00253
00254 void FreeArgs()
00255 {
00256 for (int i = 0; i < cur_paramlist_size; ++i) {
00257
00258 if(memcmp("string", cur_paramlist_tokens[i], 6) == 0 ||
00259 memcmp("texture", cur_paramlist_tokens[i], 6) == 0) {
00260 for (int j = 0; j < cur_paramlist_sizes[i]; ++j)
00261 free(((char **)cur_paramlist_args[i])[j]);
00262 }
00263 delete[] ((char *)cur_paramlist_args[i]);
00264 }
00265 }
00266
00267 static bool VerifyArrayLength( ParamArray *arr, int required,
00268 const char *command ) {
00269 if (arr->nelems != required) {
00270 std::stringstream ss;
00271 ss<<command<<" requires a(n) "<<required<<" element array!";
00272
00273 return false;
00274 }
00275 return true;
00276 }
00277 enum { PARAM_TYPE_INT, PARAM_TYPE_BOOL, PARAM_TYPE_FLOAT, PARAM_TYPE_POINT,
00278 PARAM_TYPE_VECTOR, PARAM_TYPE_NORMAL, PARAM_TYPE_COLOR,
00279 PARAM_TYPE_STRING, PARAM_TYPE_TEXTURE };
00280 static void InitParamSet(ParamSet &ps, int count, const char **tokens,
00281 void **args, int *sizes, bool *texture_helper);
00282 static bool lookupType(const char *token, int *type, string &name);
00283 #define YYPRINT(file, type, value) \
00284 { \
00285 if ((type) == ID || (type) == STRING) \
00286 fprintf ((file), " %s", (value).string); \
00287 else if ((type) == NUM) \
00288 fprintf ((file), " %f", (value).num); \
00289 }
00290
00291
00292
00293 #ifndef YYDEBUG
00294 # define YYDEBUG 0
00295 #endif
00296
00297
00298 #ifdef YYERROR_VERBOSE
00299 # undef YYERROR_VERBOSE
00300 # define YYERROR_VERBOSE 1
00301 #else
00302 # define YYERROR_VERBOSE 0
00303 #endif
00304
00305
00306 #ifndef YYTOKEN_TABLE
00307 # define YYTOKEN_TABLE 0
00308 #endif
00309
00310 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00311 typedef union YYSTYPE
00312 #line 154 "/builddir/build/BUILD/lux/core/luxparse.y"
00313 {
00314 char string[1024];
00315 float num;
00316 ParamArray *ribarray;
00317 }
00318
00319 #line 320 "/builddir/build/BUILD/lux/build/luxparse.cpp"
00320 YYSTYPE;
00321 # define yystype YYSTYPE
00322 # define YYSTYPE_IS_DECLARED 1
00323 # define YYSTYPE_IS_TRIVIAL 1
00324 #endif
00325
00326
00327
00328
00329
00330
00331
00332 #line 333 "/builddir/build/BUILD/lux/build/luxparse.cpp"
00333
00334 #ifdef short
00335 # undef short
00336 #endif
00337
00338 #ifdef YYTYPE_UINT8
00339 typedef YYTYPE_UINT8 yytype_uint8;
00340 #else
00341 typedef unsigned char yytype_uint8;
00342 #endif
00343
00344 #ifdef YYTYPE_INT8
00345 typedef YYTYPE_INT8 yytype_int8;
00346 #elif (defined __STDC__ || defined __C99__FUNC__ \
00347 || defined __cplusplus || defined _MSC_VER)
00348 typedef signed char yytype_int8;
00349 #else
00350 typedef short int yytype_int8;
00351 #endif
00352
00353 #ifdef YYTYPE_UINT16
00354 typedef YYTYPE_UINT16 yytype_uint16;
00355 #else
00356 typedef unsigned short int yytype_uint16;
00357 #endif
00358
00359 #ifdef YYTYPE_INT16
00360 typedef YYTYPE_INT16 yytype_int16;
00361 #else
00362 typedef short int yytype_int16;
00363 #endif
00364
00365 #ifndef YYSIZE_T
00366 # ifdef __SIZE_TYPE__
00367 # define YYSIZE_T __SIZE_TYPE__
00368 # elif defined size_t
00369 # define YYSIZE_T size_t
00370 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00371 || defined __cplusplus || defined _MSC_VER)
00372 # include <stddef.h>
00373 # define YYSIZE_T size_t
00374 # else
00375 # define YYSIZE_T unsigned int
00376 # endif
00377 #endif
00378
00379 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00380
00381 #ifndef YY_
00382 # if YYENABLE_NLS
00383 # if ENABLE_NLS
00384 # include <libintl.h>
00385 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00386 # endif
00387 # endif
00388 # ifndef YY_
00389 # define YY_(msgid) msgid
00390 # endif
00391 #endif
00392
00393
00394 #if ! defined lint || defined __GNUC__
00395 # define YYUSE(e) ((void) (e))
00396 #else
00397 # define YYUSE(e)
00398 #endif
00399
00400
00401 #ifndef lint
00402 # define YYID(n) (n)
00403 #else
00404 #if (defined __STDC__ || defined __C99__FUNC__ \
00405 || defined __cplusplus || defined _MSC_VER)
00406 static int
00407 YYID (int i)
00408 #else
00409 static int
00410 YYID (i)
00411 int i;
00412 #endif
00413 {
00414 return i;
00415 }
00416 #endif
00417
00418 #if ! defined yyoverflow || YYERROR_VERBOSE
00419
00420
00421
00422 # ifdef YYSTACK_USE_ALLOCA
00423 # if YYSTACK_USE_ALLOCA
00424 # ifdef __GNUC__
00425 # define YYSTACK_ALLOC __builtin_alloca
00426 # elif defined __BUILTIN_VA_ARG_INCR
00427 # include <alloca.h>
00428 # elif defined _AIX
00429 # define YYSTACK_ALLOC __alloca
00430 # elif defined _MSC_VER
00431 # include <malloc.h>
00432 # define alloca _alloca
00433 # else
00434 # define YYSTACK_ALLOC alloca
00435 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00436 || defined __cplusplus || defined _MSC_VER)
00437 # include <stdlib.h>
00438 # ifndef _STDLIB_H
00439 # define _STDLIB_H 1
00440 # endif
00441 # endif
00442 # endif
00443 # endif
00444 # endif
00445
00446 # ifdef YYSTACK_ALLOC
00447
00448 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
00449 # ifndef YYSTACK_ALLOC_MAXIMUM
00450
00451
00452
00453
00454 # define YYSTACK_ALLOC_MAXIMUM 4032
00455 # endif
00456 # else
00457 # define YYSTACK_ALLOC YYMALLOC
00458 # define YYSTACK_FREE YYFREE
00459 # ifndef YYSTACK_ALLOC_MAXIMUM
00460 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00461 # endif
00462 # if (defined __cplusplus && ! defined _STDLIB_H \
00463 && ! ((defined YYMALLOC || defined malloc) \
00464 && (defined YYFREE || defined free)))
00465 # include <stdlib.h>
00466 # ifndef _STDLIB_H
00467 # define _STDLIB_H 1
00468 # endif
00469 # endif
00470 # ifndef YYMALLOC
00471 # define YYMALLOC malloc
00472 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00473 || defined __cplusplus || defined _MSC_VER)
00474 void *malloc (YYSIZE_T);
00475 # endif
00476 # endif
00477 # ifndef YYFREE
00478 # define YYFREE free
00479 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00480 || defined __cplusplus || defined _MSC_VER)
00481 void free (void *);
00482 # endif
00483 # endif
00484 # endif
00485 #endif
00486
00487
00488 #if (! defined yyoverflow \
00489 && (! defined __cplusplus \
00490 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00491
00492
00493 union yyalloc
00494 {
00495 yytype_int16 yyss;
00496 YYSTYPE yyvs;
00497 };
00498
00499
00500 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00501
00502
00503
00504 # define YYSTACK_BYTES(N) \
00505 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00506 + YYSTACK_GAP_MAXIMUM)
00507
00508
00509
00510 # ifndef YYCOPY
00511 # if defined __GNUC__ && 1 < __GNUC__
00512 # define YYCOPY(To, From, Count) \
00513 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00514 # else
00515 # define YYCOPY(To, From, Count) \
00516 do \
00517 { \
00518 YYSIZE_T yyi; \
00519 for (yyi = 0; yyi < (Count); yyi++) \
00520 (To)[yyi] = (From)[yyi]; \
00521 } \
00522 while (YYID (0))
00523 # endif
00524 # endif
00525
00526
00527
00528
00529
00530
00531 # define YYSTACK_RELOCATE(Stack) \
00532 do \
00533 { \
00534 YYSIZE_T yynewbytes; \
00535 YYCOPY (&yyptr->Stack, Stack, yysize); \
00536 Stack = &yyptr->Stack; \
00537 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00538 yyptr += yynewbytes / sizeof (*yyptr); \
00539 } \
00540 while (YYID (0))
00541
00542 #endif
00543
00544
00545 #define YYFINAL 71
00546
00547 #define YYLAST 113
00548
00549
00550 #define YYNTOKENS 45
00551
00552 #define YYNNTS 22
00553
00554 #define YYNRULES 64
00555
00556 #define YYNSTATES 133
00557
00558
00559 #define YYUNDEFTOK 2
00560 #define YYMAXUTOK 299
00561
00562 #define YYTRANSLATE(YYX) \
00563 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00564
00565
00566 static const yytype_uint8 yytranslate[] =
00567 {
00568 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00569 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00570 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00571 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00572 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00573 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00574 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00575 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00576 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00577 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00578 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00579 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00580 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00581 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00582 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00583 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00584 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00585 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00586 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00587 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00588 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00589 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00590 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00591 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00592 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00593 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
00594 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
00595 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
00596 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
00597 35, 36, 37, 38, 39, 40, 41, 42, 43, 44
00598 };
00599
00600 #if YYDEBUG
00601
00602
00603 static const yytype_uint8 yyprhs[] =
00604 {
00605 0, 0, 3, 5, 6, 7, 8, 10, 12, 14,
00606 16, 21, 24, 27, 29, 32, 34, 36, 41, 44,
00607 47, 49, 52, 55, 56, 59, 60, 63, 66, 68,
00608 72, 76, 78, 80, 84, 87, 90, 93, 97, 99,
00609 103, 114, 118, 122, 126, 129, 131, 134, 138, 140,
00610 146, 150, 155, 158, 162, 166, 170, 176, 178, 180,
00611 183, 188, 192, 196, 198
00612 };
00613
00614
00615 static const yytype_int8 yyrhs[] =
00616 {
00617 46, 0, -1, 65, -1, -1, -1, -1, 51, -1,
00618 56, -1, 52, -1, 53, -1, 47, 6, 54, 7,
00619 -1, 47, 55, -1, 54, 55, -1, 55, -1, 48,
00620 3, -1, 57, -1, 58, -1, 47, 6, 59, 7,
00621 -1, 47, 60, -1, 59, 60, -1, 60, -1, 49,
00622 5, -1, 62, 63, -1, -1, 64, 63, -1, -1,
00623 3, 50, -1, 65, 66, -1, 66, -1, 8, 3,
00624 61, -1, 9, 3, 61, -1, 10, -1, 11, -1,
00625 12, 3, 61, -1, 13, 56, -1, 14, 3, -1,
00626 15, 3, -1, 16, 3, 61, -1, 17, -1, 18,
00627 3, 61, -1, 19, 5, 5, 5, 5, 5, 5,
00628 5, 5, 5, -1, 20, 3, 61, -1, 21, 3,
00629 61, -1, 22, 3, 61, -1, 23, 3, -1, 24,
00630 -1, 25, 3, -1, 26, 3, 61, -1, 27, -1,
00631 28, 5, 5, 5, 5, -1, 29, 3, 61, -1,
00632 30, 5, 5, 5, -1, 31, 3, -1, 33, 3,
00633 61, -1, 32, 3, 61, -1, 34, 3, 61, -1,
00634 35, 3, 3, 3, 61, -1, 36, -1, 37, -1,
00635 38, 57, -1, 39, 5, 5, 5, -1, 41, 3,
00636 61, -1, 40, 3, 61, -1, 42, -1, 43, -1
00637 };
00638
00639
00640 static const yytype_uint16 yyrline[] =
00641 {
00642 0, 176, 176, 180, 190, 195, 200, 204, 209, 213,
00643 219, 224, 228, 231, 235, 241, 245, 250, 255, 259,
00644 262, 266, 272, 276, 281, 285, 288, 306, 309, 313,
00645 320, 327, 331, 335, 342, 348, 352, 356, 363, 367,
00646 374, 378, 385, 392, 399, 403, 407, 411, 418, 422,
00647 426, 433, 437, 441, 448, 455, 462, 469, 473, 477,
00648 483, 487, 494, 501, 505
00649 };
00650 #endif
00651
00652 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00653
00654
00655 static const char *const yytname[] =
00656 {
00657 "$end", "error", "$undefined", "STRING", "ID", "NUM", "LBRACK",
00658 "RBRACK", "ACCELERATOR", "AREALIGHTSOURCE", "ATTRIBUTEBEGIN",
00659 "ATTRIBUTEEND", "CAMERA", "CONCATTRANSFORM", "COORDINATESYSTEM",
00660 "COORDSYSTRANSFORM", "FILM", "IDENTITY", "LIGHTSOURCE", "LOOKAT",
00661 "MATERIAL", "MAKENAMEDMATERIAL", "NAMEDMATERIAL", "OBJECTBEGIN",
00662 "OBJECTEND", "OBJECTINSTANCE", "PIXELFILTER", "REVERSEORIENTATION",
00663 "ROTATE", "SAMPLER", "SCALE", "SEARCHPATH", "PORTALSHAPE", "SHAPE",
00664 "SURFACEINTEGRATOR", "TEXTURE", "TRANSFORMBEGIN", "TRANSFORMEND",
00665 "TRANSFORM", "TRANSLATE", "VOLUME", "VOLUMEINTEGRATOR", "WORLDBEGIN",
00666 "WORLDEND", "HIGH_PRECEDENCE", "$accept", "start", "array_init",
00667 "string_array_init", "num_array_init", "array", "string_array",
00668 "real_string_array", "single_element_string_array", "string_list",
00669 "string_list_entry", "num_array", "real_num_array",
00670 "single_element_num_array", "num_list", "num_list_entry", "paramlist",
00671 "paramlist_init", "paramlist_contents", "paramlist_entry",
00672 "ri_stmt_list", "ri_stmt", 0
00673 };
00674 #endif
00675
00676 # ifdef YYPRINT
00677
00678
00679 static const yytype_uint16 yytoknum[] =
00680 {
00681 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
00682 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
00683 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
00684 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
00685 295, 296, 297, 298, 299
00686 };
00687 # endif
00688
00689
00690 static const yytype_uint8 yyr1[] =
00691 {
00692 0, 45, 46, 47, 48, 49, 50, 50, 51, 51,
00693 52, 53, 54, 54, 55, 56, 56, 57, 58, 59,
00694 59, 60, 61, 62, 63, 63, 64, 65, 65, 66,
00695 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
00696 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
00697 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
00698 66, 66, 66, 66, 66
00699 };
00700
00701
00702 static const yytype_uint8 yyr2[] =
00703 {
00704 0, 2, 1, 0, 0, 0, 1, 1, 1, 1,
00705 4, 2, 2, 1, 2, 1, 1, 4, 2, 2,
00706 1, 2, 2, 0, 2, 0, 2, 2, 1, 3,
00707 3, 1, 1, 3, 2, 2, 2, 3, 1, 3,
00708 10, 3, 3, 3, 2, 1, 2, 3, 1, 5,
00709 3, 4, 2, 3, 3, 3, 5, 1, 1, 2,
00710 4, 3, 3, 1, 1
00711 };
00712
00713
00714
00715
00716 static const yytype_uint8 yydefact[] =
00717 {
00718 0, 0, 0, 31, 32, 0, 3, 0, 0, 0,
00719 38, 0, 0, 0, 0, 0, 0, 45, 0, 0,
00720 48, 0, 0, 0, 0, 0, 0, 0, 0, 57,
00721 58, 3, 0, 0, 0, 63, 64, 0, 2, 28,
00722 23, 23, 23, 5, 34, 15, 16, 35, 36, 23,
00723 23, 0, 23, 23, 23, 44, 46, 23, 0, 23,
00724 0, 52, 23, 23, 23, 0, 0, 59, 0, 23,
00725 23, 1, 27, 29, 25, 30, 33, 5, 0, 18,
00726 37, 39, 0, 41, 42, 43, 47, 0, 50, 0,
00727 54, 53, 55, 0, 0, 62, 61, 3, 22, 25,
00728 5, 20, 21, 0, 0, 51, 23, 60, 4, 26,
00729 6, 8, 9, 7, 24, 17, 19, 0, 49, 56,
00730 4, 0, 11, 0, 4, 13, 14, 0, 10, 12,
00731 0, 0, 40
00732 };
00733
00734
00735 static const yytype_int8 yydefgoto[] =
00736 {
00737 -1, 37, 43, 121, 78, 109, 110, 111, 112, 124,
00738 122, 44, 45, 46, 100, 79, 73, 74, 98, 99,
00739 38, 39
00740 };
00741
00742
00743
00744 #define YYPACT_NINF -120
00745 static const yytype_int8 yypact[] =
00746 {
00747 60, 5, 6, -120, -120, 9, -120, 13, 14, 16,
00748 -120, 18, 17, 23, 25, 26, 29, -120, 30, 31,
00749 -120, 32, 33, 34, 35, 37, 38, 39, 40, -120,
00750 -120, -120, 41, 42, 45, -120, -120, 44, 60, -120,
00751 -120, -120, -120, 43, -120, -120, -120, -120, -120, -120,
00752 -120, 46, -120, -120, -120, -120, -120, -120, 47, -120,
00753 48, -120, -120, -120, -120, 51, 43, -120, 50, -120,
00754 -120, -120, -120, -120, 53, -120, -120, -120, 52, -120,
00755 -120, -120, 54, -120, -120, -120, -120, 55, -120, 56,
00756 -120, -120, -120, 59, 58, -120, -120, -120, -120, 53,
00757 28, -120, -120, 99, 100, -120, -120, -120, 1, -120,
00758 -120, -120, -120, -120, -120, -120, -120, 101, -120, -120,
00759 102, 61, -120, 103, 104, -120, -120, 105, -120, -120,
00760 107, 108, -120
00761 };
00762
00763
00764 static const yytype_int8 yypgoto[] =
00765 {
00766 -120, -120, -31, -120, -120, -120, -120, -120, -120, -120,
00767 -119, -47, 27, -120, -120, -73, -39, -120, -34, -120,
00768 -120, 71
00769 };
00770
00771
00772
00773
00774
00775 #define YYTABLE_NINF -6
00776 static const yytype_int16 yytable[] =
00777 {
00778 66, 125, 75, 76, 101, 129, -5, 120, 40, 41,
00779 80, 81, 42, 83, 84, 85, 47, 48, 86, 49,
00780 88, 50, 51, 90, 91, 92, 52, 116, 53, 54,
00781 95, 96, 55, 56, 57, 115, 59, 58, 61, 60,
00782 62, 63, 64, 65, 71, 69, 68, 101, 70, 77,
00783 113, 82, 87, 89, 93, 94, 97, 102, 67, 103,
00784 104, 105, 106, 107, 126, 114, 108, 119, 1, 2,
00785 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
00786 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
00787 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
00788 33, 34, 35, 36, 117, 118, 123, -5, 127, 72,
00789 130, 128, 131, 132
00790 };
00791
00792 static const yytype_uint8 yycheck[] =
00793 {
00794 31, 120, 41, 42, 77, 124, 5, 6, 3, 3,
00795 49, 50, 3, 52, 53, 54, 3, 3, 57, 3,
00796 59, 3, 5, 62, 63, 64, 3, 100, 3, 3,
00797 69, 70, 3, 3, 3, 7, 3, 5, 3, 5,
00798 3, 3, 3, 3, 0, 3, 5, 120, 3, 6,
00799 97, 5, 5, 5, 3, 5, 3, 5, 31, 5,
00800 5, 5, 3, 5, 3, 99, 97, 106, 8, 9,
00801 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,
00802 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
00803 30, 31, 32, 33, 34, 35, 36, 37, 38, 39,
00804 40, 41, 42, 43, 5, 5, 5, 5, 5, 38,
00805 5, 7, 5, 5
00806 };
00807
00808
00809
00810 static const yytype_uint8 yystos[] =
00811 {
00812 0, 8, 9, 10, 11, 12, 13, 14, 15, 16,
00813 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
00814 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
00815 37, 38, 39, 40, 41, 42, 43, 46, 65, 66,
00816 3, 3, 3, 47, 56, 57, 58, 3, 3, 3,
00817 3, 5, 3, 3, 3, 3, 3, 3, 5, 3,
00818 5, 3, 3, 3, 3, 3, 47, 57, 5, 3,
00819 3, 0, 66, 61, 62, 61, 61, 6, 49, 60,
00820 61, 61, 5, 61, 61, 61, 61, 5, 61, 5,
00821 61, 61, 61, 3, 5, 61, 61, 3, 63, 64,
00822 59, 60, 5, 5, 5, 5, 3, 5, 47, 50,
00823 51, 52, 53, 56, 63, 7, 60, 5, 5, 61,
00824 6, 48, 55, 5, 54, 55, 3, 5, 7, 55,
00825 5, 5, 5
00826 };
00827
00828 #define yyerrok (yyerrstatus = 0)
00829 #define yyclearin (yychar = YYEMPTY)
00830 #define YYEMPTY (-2)
00831 #define YYEOF 0
00832
00833 #define YYACCEPT goto yyacceptlab
00834 #define YYABORT goto yyabortlab
00835 #define YYERROR goto yyerrorlab
00836
00837
00838
00839
00840
00841
00842 #define YYFAIL goto yyerrlab
00843
00844 #define YYRECOVERING() (!!yyerrstatus)
00845
00846 #define YYBACKUP(Token, Value) \
00847 do \
00848 if (yychar == YYEMPTY && yylen == 1) \
00849 { \
00850 yychar = (Token); \
00851 yylval = (Value); \
00852 yytoken = YYTRANSLATE (yychar); \
00853 YYPOPSTACK (1); \
00854 goto yybackup; \
00855 } \
00856 else \
00857 { \
00858 yyerror (YY_("syntax error: cannot back up")); \
00859 YYERROR; \
00860 } \
00861 while (YYID (0))
00862
00863
00864 #define YYTERROR 1
00865 #define YYERRCODE 256
00866
00867
00868
00869
00870
00871
00872 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00873 #ifndef YYLLOC_DEFAULT
00874 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00875 do \
00876 if (YYID (N)) \
00877 { \
00878 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
00879 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
00880 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
00881 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
00882 } \
00883 else \
00884 { \
00885 (Current).first_line = (Current).last_line = \
00886 YYRHSLOC (Rhs, 0).last_line; \
00887 (Current).first_column = (Current).last_column = \
00888 YYRHSLOC (Rhs, 0).last_column; \
00889 } \
00890 while (YYID (0))
00891 #endif
00892
00893
00894
00895
00896
00897
00898 #ifndef YY_LOCATION_PRINT
00899 # if YYLTYPE_IS_TRIVIAL
00900 # define YY_LOCATION_PRINT(File, Loc) \
00901 fprintf (File, "%d.%d-%d.%d", \
00902 (Loc).first_line, (Loc).first_column, \
00903 (Loc).last_line, (Loc).last_column)
00904 # else
00905 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00906 # endif
00907 #endif
00908
00909
00910
00911
00912 #ifdef YYLEX_PARAM
00913 # define YYLEX yylex (YYLEX_PARAM)
00914 #else
00915 # define YYLEX yylex ()
00916 #endif
00917
00918
00919 #if YYDEBUG
00920
00921 # ifndef YYFPRINTF
00922 # include <stdio.h>
00923 # define YYFPRINTF fprintf
00924 # endif
00925
00926 # define YYDPRINTF(Args) \
00927 do { \
00928 if (yydebug) \
00929 YYFPRINTF Args; \
00930 } while (YYID (0))
00931
00932 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
00933 do { \
00934 if (yydebug) \
00935 { \
00936 YYFPRINTF (stderr, "%s ", Title); \
00937 yy_symbol_print (stderr, \
00938 Type, Value); \
00939 YYFPRINTF (stderr, "\n"); \
00940 } \
00941 } while (YYID (0))
00942
00943
00944
00945
00946
00947
00948
00949 #if (defined __STDC__ || defined __C99__FUNC__ \
00950 || defined __cplusplus || defined _MSC_VER)
00951 static void
00952 yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00953 #else
00954 static void
00955 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
00956 FILE *yyoutput;
00957 int yytype;
00958 YYSTYPE const * const yyvaluep;
00959 #endif
00960 {
00961 if (!yyvaluep)
00962 return;
00963 # ifdef YYPRINT
00964 if (yytype < YYNTOKENS)
00965 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00966 # else
00967 YYUSE (yyoutput);
00968 # endif
00969 switch (yytype)
00970 {
00971 default:
00972 break;
00973 }
00974 }
00975
00976
00977
00978
00979
00980
00981 #if (defined __STDC__ || defined __C99__FUNC__ \
00982 || defined __cplusplus || defined _MSC_VER)
00983 static void
00984 yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
00985 #else
00986 static void
00987 yy_symbol_print (yyoutput, yytype, yyvaluep)
00988 FILE *yyoutput;
00989 int yytype;
00990 YYSTYPE const * const yyvaluep;
00991 #endif
00992 {
00993 if (yytype < YYNTOKENS)
00994 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00995 else
00996 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00997
00998 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
00999 YYFPRINTF (yyoutput, ")");
01000 }
01001
01002
01003
01004
01005
01006
01007 #if (defined __STDC__ || defined __C99__FUNC__ \
01008 || defined __cplusplus || defined _MSC_VER)
01009 static void
01010 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
01011 #else
01012 static void
01013 yy_stack_print (bottom, top)
01014 yytype_int16 *bottom;
01015 yytype_int16 *top;
01016 #endif
01017 {
01018 YYFPRINTF (stderr, "Stack now");
01019 for (; bottom <= top; ++bottom)
01020 YYFPRINTF (stderr, " %d", *bottom);
01021 YYFPRINTF (stderr, "\n");
01022 }
01023
01024 # define YY_STACK_PRINT(Bottom, Top) \
01025 do { \
01026 if (yydebug) \
01027 yy_stack_print ((Bottom), (Top)); \
01028 } while (YYID (0))
01029
01030
01031
01032
01033
01034
01035 #if (defined __STDC__ || defined __C99__FUNC__ \
01036 || defined __cplusplus || defined _MSC_VER)
01037 static void
01038 yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
01039 #else
01040 static void
01041 yy_reduce_print (yyvsp, yyrule)
01042 YYSTYPE *yyvsp;
01043 int yyrule;
01044 #endif
01045 {
01046 int yynrhs = yyr2[yyrule];
01047 int yyi;
01048 unsigned long int yylno = yyrline[yyrule];
01049 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
01050 yyrule - 1, yylno);
01051
01052 for (yyi = 0; yyi < yynrhs; yyi++)
01053 {
01054 fprintf (stderr, " $%d = ", yyi + 1);
01055 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
01056 &(yyvsp[(yyi + 1) - (yynrhs)])
01057 );
01058 fprintf (stderr, "\n");
01059 }
01060 }
01061
01062 # define YY_REDUCE_PRINT(Rule) \
01063 do { \
01064 if (yydebug) \
01065 yy_reduce_print (yyvsp, Rule); \
01066 } while (YYID (0))
01067
01068
01069
01070 int yydebug;
01071 #else
01072 # define YYDPRINTF(Args)
01073 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
01074 # define YY_STACK_PRINT(Bottom, Top)
01075 # define YY_REDUCE_PRINT(Rule)
01076 #endif
01077
01078
01079
01080 #ifndef YYINITDEPTH
01081 # define YYINITDEPTH 200
01082 #endif
01083
01084
01085
01086
01087
01088
01089
01090
01091 #ifndef YYMAXDEPTH
01092 # define YYMAXDEPTH 10000
01093 #endif
01094
01095
01096
01097 #if YYERROR_VERBOSE
01098
01099 # ifndef yystrlen
01100 # if defined __GLIBC__ && defined _STRING_H
01101 # define yystrlen strlen
01102 # else
01103
01104 #if (defined __STDC__ || defined __C99__FUNC__ \
01105 || defined __cplusplus || defined _MSC_VER)
01106 static YYSIZE_T
01107 yystrlen (const char *yystr)
01108 #else
01109 static YYSIZE_T
01110 yystrlen (yystr)
01111 const char *yystr;
01112 #endif
01113 {
01114 YYSIZE_T yylen;
01115 for (yylen = 0; yystr[yylen]; yylen++)
01116 continue;
01117 return yylen;
01118 }
01119 # endif
01120 # endif
01121
01122 # ifndef yystpcpy
01123 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
01124 # define yystpcpy stpcpy
01125 # else
01126
01127
01128 #if (defined __STDC__ || defined __C99__FUNC__ \
01129 || defined __cplusplus || defined _MSC_VER)
01130 static char *
01131 yystpcpy (char *yydest, const char *yysrc)
01132 #else
01133 static char *
01134 yystpcpy (yydest, yysrc)
01135 char *yydest;
01136 const char *yysrc;
01137 #endif
01138 {
01139 char *yyd = yydest;
01140 const char *yys = yysrc;
01141
01142 while ((*yyd++ = *yys++) != '\0')
01143 continue;
01144
01145 return yyd - 1;
01146 }
01147 # endif
01148 # endif
01149
01150 # ifndef yytnamerr
01151
01152
01153
01154
01155
01156
01157
01158 static YYSIZE_T
01159 yytnamerr (char *yyres, const char *yystr)
01160 {
01161 if (*yystr == '"')
01162 {
01163 YYSIZE_T yyn = 0;
01164 char const *yyp = yystr;
01165
01166 for (;;)
01167 switch (*++yyp)
01168 {
01169 case '\'':
01170 case ',':
01171 goto do_not_strip_quotes;
01172
01173 case '\\':
01174 if (*++yyp != '\\')
01175 goto do_not_strip_quotes;
01176
01177 default:
01178 if (yyres)
01179 yyres[yyn] = *yyp;
01180 yyn++;
01181 break;
01182
01183 case '"':
01184 if (yyres)
01185 yyres[yyn] = '\0';
01186 return yyn;
01187 }
01188 do_not_strip_quotes: ;
01189 }
01190
01191 if (! yyres)
01192 return yystrlen (yystr);
01193
01194 return yystpcpy (yyres, yystr) - yyres;
01195 }
01196 # endif
01197
01198
01199
01200
01201
01202
01203
01204
01205 static YYSIZE_T
01206 yysyntax_error (char *yyresult, int yystate, int yychar)
01207 {
01208 int yyn = yypact[yystate];
01209
01210 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
01211 return 0;
01212 else
01213 {
01214 int yytype = YYTRANSLATE (yychar);
01215 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
01216 YYSIZE_T yysize = yysize0;
01217 YYSIZE_T yysize1;
01218 int yysize_overflow = 0;
01219 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
01220 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
01221 int yyx;
01222
01223 # if 0
01224
01225
01226 YY_("syntax error, unexpected %s");
01227 YY_("syntax error, unexpected %s, expecting %s");
01228 YY_("syntax error, unexpected %s, expecting %s or %s");
01229 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
01230 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
01231 # endif
01232 char *yyfmt;
01233 char const *yyf;
01234 static char const yyunexpected[] = "syntax error, unexpected %s";
01235 static char const yyexpecting[] = ", expecting %s";
01236 static char const yyor[] = " or %s";
01237 char yyformat[sizeof yyunexpected
01238 + sizeof yyexpecting - 1
01239 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
01240 * (sizeof yyor - 1))];
01241 char const *yyprefix = yyexpecting;
01242
01243
01244
01245 int yyxbegin = yyn < 0 ? -yyn : 0;
01246
01247
01248 int yychecklim = YYLAST - yyn + 1;
01249 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
01250 int yycount = 1;
01251
01252 yyarg[0] = yytname[yytype];
01253 yyfmt = yystpcpy (yyformat, yyunexpected);
01254
01255 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
01256 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
01257 {
01258 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
01259 {
01260 yycount = 1;
01261 yysize = yysize0;
01262 yyformat[sizeof yyunexpected - 1] = '\0';
01263 break;
01264 }
01265 yyarg[yycount++] = yytname[yyx];
01266 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
01267 yysize_overflow |= (yysize1 < yysize);
01268 yysize = yysize1;
01269 yyfmt = yystpcpy (yyfmt, yyprefix);
01270 yyprefix = yyor;
01271 }
01272
01273 yyf = YY_(yyformat);
01274 yysize1 = yysize + yystrlen (yyf);
01275 yysize_overflow |= (yysize1 < yysize);
01276 yysize = yysize1;
01277
01278 if (yysize_overflow)
01279 return YYSIZE_MAXIMUM;
01280
01281 if (yyresult)
01282 {
01283
01284
01285
01286 char *yyp = yyresult;
01287 int yyi = 0;
01288 while ((*yyp = *yyf) != '\0')
01289 {
01290 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01291 {
01292 yyp += yytnamerr (yyp, yyarg[yyi++]);
01293 yyf += 2;
01294 }
01295 else
01296 {
01297 yyp++;
01298 yyf++;
01299 }
01300 }
01301 }
01302 return yysize;
01303 }
01304 }
01305 #endif
01306
01307
01308
01309
01310
01311
01312
01313 #if (defined __STDC__ || defined __C99__FUNC__ \
01314 || defined __cplusplus || defined _MSC_VER)
01315 static void
01316 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
01317 #else
01318 static void
01319 yydestruct (yymsg, yytype, yyvaluep)
01320 const char *yymsg;
01321 int yytype;
01322 YYSTYPE *yyvaluep;
01323 #endif
01324 {
01325 YYUSE (yyvaluep);
01326
01327 if (!yymsg)
01328 yymsg = "Deleting";
01329 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01330
01331 switch (yytype)
01332 {
01333
01334 default:
01335 break;
01336 }
01337 }
01338
01339
01340
01341
01342 #ifdef YYPARSE_PARAM
01343 #if defined __STDC__ || defined __cplusplus
01344 int yyparse (void *YYPARSE_PARAM);
01345 #else
01346 int yyparse ();
01347 #endif
01348 #else
01349 #if defined __STDC__ || defined __cplusplus
01350 int yyparse (void);
01351 #else
01352 int yyparse ();
01353 #endif
01354 #endif
01355
01356
01357
01358
01359 int yychar;
01360
01361
01362 YYSTYPE yylval;
01363
01364
01365 int yynerrs;
01366
01367
01368
01369
01370
01371
01372
01373 #ifdef YYPARSE_PARAM
01374 #if (defined __STDC__ || defined __C99__FUNC__ \
01375 || defined __cplusplus || defined _MSC_VER)
01376 int
01377 yyparse (void *YYPARSE_PARAM)
01378 #else
01379 int
01380 yyparse (YYPARSE_PARAM)
01381 void *YYPARSE_PARAM;
01382 #endif
01383 #else
01384 #if (defined __STDC__ || defined __C99__FUNC__ \
01385 || defined __cplusplus || defined _MSC_VER)
01386 int
01387 yyparse (void)
01388 #else
01389 int
01390 yyparse ()
01391
01392 #endif
01393 #endif
01394 {
01395
01396 int yystate;
01397 int yyn;
01398 int yyresult;
01399
01400 int yyerrstatus;
01401
01402 int yytoken = 0;
01403 #if YYERROR_VERBOSE
01404
01405 char yymsgbuf[128];
01406 char *yymsg = yymsgbuf;
01407 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01408 #endif
01409
01410
01411
01412
01413
01414
01415
01416
01417
01418
01419 yytype_int16 yyssa[YYINITDEPTH];
01420 yytype_int16 *yyss = yyssa;
01421 yytype_int16 *yyssp;
01422
01423
01424 YYSTYPE yyvsa[YYINITDEPTH];
01425 YYSTYPE *yyvs = yyvsa;
01426 YYSTYPE *yyvsp;
01427
01428
01429
01430 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
01431
01432 YYSIZE_T yystacksize = YYINITDEPTH;
01433
01434
01435
01436 YYSTYPE yyval;
01437
01438
01439
01440
01441 int yylen = 0;
01442
01443 YYDPRINTF ((stderr, "Starting parse\n"));
01444
01445 yystate = 0;
01446 yyerrstatus = 0;
01447 yynerrs = 0;
01448 yychar = YYEMPTY;
01449
01450
01451
01452
01453
01454
01455 yyssp = yyss;
01456 yyvsp = yyvs;
01457
01458 goto yysetstate;
01459
01460
01461
01462
01463 yynewstate:
01464
01465
01466 yyssp++;
01467
01468 yysetstate:
01469 *yyssp = yystate;
01470
01471 if (yyss + yystacksize - 1 <= yyssp)
01472 {
01473
01474 YYSIZE_T yysize = yyssp - yyss + 1;
01475
01476 #ifdef yyoverflow
01477 {
01478
01479
01480
01481 YYSTYPE *yyvs1 = yyvs;
01482 yytype_int16 *yyss1 = yyss;
01483
01484
01485
01486
01487
01488
01489 yyoverflow (YY_("memory exhausted"),
01490 &yyss1, yysize * sizeof (*yyssp),
01491 &yyvs1, yysize * sizeof (*yyvsp),
01492
01493 &yystacksize);
01494
01495 yyss = yyss1;
01496 yyvs = yyvs1;
01497 }
01498 #else
01499 # ifndef YYSTACK_RELOCATE
01500 goto yyexhaustedlab;
01501 # else
01502
01503 if (YYMAXDEPTH <= yystacksize)
01504 goto yyexhaustedlab;
01505 yystacksize *= 2;
01506 if (YYMAXDEPTH < yystacksize)
01507 yystacksize = YYMAXDEPTH;
01508
01509 {
01510 yytype_int16 *yyss1 = yyss;
01511 union yyalloc *yyptr =
01512 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01513 if (! yyptr)
01514 goto yyexhaustedlab;
01515 YYSTACK_RELOCATE (yyss);
01516 YYSTACK_RELOCATE (yyvs);
01517
01518 # undef YYSTACK_RELOCATE
01519 if (yyss1 != yyssa)
01520 YYSTACK_FREE (yyss1);
01521 }
01522 # endif
01523 #endif
01524
01525 yyssp = yyss + yysize - 1;
01526 yyvsp = yyvs + yysize - 1;
01527
01528
01529 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01530 (unsigned long int) yystacksize));
01531
01532 if (yyss + yystacksize - 1 <= yyssp)
01533 YYABORT;
01534 }
01535
01536 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01537
01538 goto yybackup;
01539
01540
01541
01542
01543 yybackup:
01544
01545
01546
01547
01548
01549 yyn = yypact[yystate];
01550 if (yyn == YYPACT_NINF)
01551 goto yydefault;
01552
01553
01554
01555
01556 if (yychar == YYEMPTY)
01557 {
01558 YYDPRINTF ((stderr, "Reading a token: "));
01559 yychar = YYLEX;
01560 }
01561
01562 if (yychar <= YYEOF)
01563 {
01564 yychar = yytoken = YYEOF;
01565 YYDPRINTF ((stderr, "Now at end of input.\n"));
01566 }
01567 else
01568 {
01569 yytoken = YYTRANSLATE (yychar);
01570 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01571 }
01572
01573
01574
01575 yyn += yytoken;
01576 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01577 goto yydefault;
01578 yyn = yytable[yyn];
01579 if (yyn <= 0)
01580 {
01581 if (yyn == 0 || yyn == YYTABLE_NINF)
01582 goto yyerrlab;
01583 yyn = -yyn;
01584 goto yyreduce;
01585 }
01586
01587 if (yyn == YYFINAL)
01588 YYACCEPT;
01589
01590
01591
01592 if (yyerrstatus)
01593 yyerrstatus--;
01594
01595
01596 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01597
01598
01599 if (yychar != YYEOF)
01600 yychar = YYEMPTY;
01601
01602 yystate = yyn;
01603 *++yyvsp = yylval;
01604
01605 goto yynewstate;
01606
01607
01608
01609
01610
01611 yydefault:
01612 yyn = yydefact[yystate];
01613 if (yyn == 0)
01614 goto yyerrlab;
01615 goto yyreduce;
01616
01617
01618
01619
01620
01621 yyreduce:
01622
01623 yylen = yyr2[yyn];
01624
01625
01626
01627
01628
01629
01630
01631
01632
01633 yyval = yyvsp[1-yylen];
01634
01635
01636 YY_REDUCE_PRINT (yyn);
01637 switch (yyn)
01638 {
01639 case 2:
01640 #line 177 "/builddir/build/BUILD/lux/core/luxparse.y"
01641 {
01642 }
01643 break;
01644
01645 case 3:
01646 #line 181 "/builddir/build/BUILD/lux/core/luxparse.y"
01647 {
01648 if (cur_array) ArrayFree( cur_array );
01649 cur_array = new ParamArray;
01650 cur_array->allocated = 0;
01651 cur_array->nelems = 0;
01652 cur_array->array = NULL;
01653 array_is_single_string = false;
01654 }
01655 break;
01656
01657 case 4:
01658 #line 191 "/builddir/build/BUILD/lux/core/luxparse.y"
01659 {
01660 cur_array->element_size = sizeof( const char * );
01661 }
01662 break;
01663
01664 case 5:
01665 #line 196 "/builddir/build/BUILD/lux/core/luxparse.y"
01666 {
01667 cur_array->element_size = sizeof( float );
01668 }
01669 break;
01670
01671 case 6:
01672 #line 201 "/builddir/build/BUILD/lux/core/luxparse.y"
01673 {
01674 (yyval.ribarray) = (yyvsp[(1) - (1)].ribarray);
01675 }
01676 break;
01677
01678 case 7:
01679 #line 205 "/builddir/build/BUILD/lux/core/luxparse.y"
01680 {
01681 (yyval.ribarray) = (yyvsp[(1) - (1)].ribarray);
01682 }
01683 break;
01684
01685 case 8:
01686 #line 210 "/builddir/build/BUILD/lux/core/luxparse.y"
01687 {
01688 (yyval.ribarray) = (yyvsp[(1) - (1)].ribarray);
01689 }
01690 break;
01691
01692 case 9:
01693 #line 214 "/builddir/build/BUILD/lux/core/luxparse.y"
01694 {
01695 (yyval.ribarray) = ArrayDup(cur_array);
01696 array_is_single_string = true;
01697 }
01698 break;
01699
01700 case 10:
01701 #line 220 "/builddir/build/BUILD/lux/core/luxparse.y"
01702 {
01703 (yyval.ribarray) = ArrayDup(cur_array);
01704 }
01705 break;
01706
01707 case 11:
01708 #line 225 "/builddir/build/BUILD/lux/core/luxparse.y"
01709 {
01710 }
01711 break;
01712
01713 case 12:
01714 #line 229 "/builddir/build/BUILD/lux/core/luxparse.y"
01715 {
01716 }
01717 break;
01718
01719 case 13:
01720 #line 232 "/builddir/build/BUILD/lux/core/luxparse.y"
01721 {
01722 }
01723 break;
01724
01725 case 14:
01726 #line 236 "/builddir/build/BUILD/lux/core/luxparse.y"
01727 {
01728 char *to_add = strdup((yyvsp[(2) - (2)].string));
01729 AddArrayElement( &to_add );
01730 }
01731 break;
01732
01733 case 15:
01734 #line 242 "/builddir/build/BUILD/lux/core/luxparse.y"
01735 {
01736 (yyval.ribarray) = (yyvsp[(1) - (1)].ribarray);
01737 }
01738 break;
01739
01740 case 16:
01741 #line 246 "/builddir/build/BUILD/lux/core/luxparse.y"
01742 {
01743 (yyval.ribarray) = ArrayDup(cur_array);
01744 }
01745 break;
01746
01747 case 17:
01748 #line 251 "/builddir/build/BUILD/lux/core/luxparse.y"
01749 {
01750 (yyval.ribarray) = ArrayDup(cur_array);
01751 }
01752 break;
01753
01754 case 18:
01755 #line 256 "/builddir/build/BUILD/lux/core/luxparse.y"
01756 {
01757 }
01758 break;
01759
01760 case 19:
01761 #line 260 "/builddir/build/BUILD/lux/core/luxparse.y"
01762 {
01763 }
01764 break;
01765
01766 case 20:
01767 #line 263 "/builddir/build/BUILD/lux/core/luxparse.y"
01768 {
01769 }
01770 break;
01771
01772 case 21:
01773 #line 267 "/builddir/build/BUILD/lux/core/luxparse.y"
01774 {
01775 float to_add = (yyvsp[(2) - (2)].num);
01776 AddArrayElement( &to_add );
01777 }
01778 break;
01779
01780 case 22:
01781 #line 273 "/builddir/build/BUILD/lux/core/luxparse.y"
01782 {
01783 }
01784 break;
01785
01786 case 23:
01787 #line 277 "/builddir/build/BUILD/lux/core/luxparse.y"
01788 {
01789 cur_paramlist_size = 0;
01790 }
01791 break;
01792
01793 case 24:
01794 #line 282 "/builddir/build/BUILD/lux/core/luxparse.y"
01795 {
01796 }
01797 break;
01798
01799 case 25:
01800 #line 285 "/builddir/build/BUILD/lux/core/luxparse.y"
01801 {
01802 }
01803 break;
01804
01805 case 26:
01806 #line 289 "/builddir/build/BUILD/lux/core/luxparse.y"
01807 {
01808 void *arg = new char[ (yyvsp[(2) - (2)].ribarray)->nelems * (yyvsp[(2) - (2)].ribarray)->element_size ];
01809 memcpy(arg, (yyvsp[(2) - (2)].ribarray)->array, (yyvsp[(2) - (2)].ribarray)->nelems * (yyvsp[(2) - (2)].ribarray)->element_size);
01810 if (cur_paramlist_size >= cur_paramlist_allocated) {
01811 cur_paramlist_allocated = 2*cur_paramlist_allocated + 1;
01812 cur_paramlist_tokens = (const char **) realloc(cur_paramlist_tokens, cur_paramlist_allocated*sizeof(const char *) );
01813 cur_paramlist_args = (void * *) realloc( cur_paramlist_args, cur_paramlist_allocated*sizeof(void *) );
01814 cur_paramlist_sizes = (int *) realloc( cur_paramlist_sizes, cur_paramlist_allocated*sizeof(int) );
01815 cur_paramlist_texture_helper = (bool *) realloc( cur_paramlist_texture_helper, cur_paramlist_allocated*sizeof(bool) );
01816 }
01817 cur_paramlist_tokens[cur_paramlist_size] = (yyvsp[(1) - (2)].string);
01818 cur_paramlist_sizes[cur_paramlist_size] = (yyvsp[(2) - (2)].ribarray)->nelems;
01819 cur_paramlist_texture_helper[cur_paramlist_size] = array_is_single_string;
01820 cur_paramlist_args[cur_paramlist_size++] = arg;
01821 ArrayFree( (yyvsp[(2) - (2)].ribarray) );
01822 }
01823 break;
01824
01825 case 27:
01826 #line 307 "/builddir/build/BUILD/lux/core/luxparse.y"
01827 {
01828 }
01829 break;
01830
01831 case 28:
01832 #line 310 "/builddir/build/BUILD/lux/core/luxparse.y"
01833 {
01834 }
01835 break;
01836
01837 case 29:
01838 #line 314 "/builddir/build/BUILD/lux/core/luxparse.y"
01839 {
01840 ParamSet params;
01841 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01842 Context::luxAccelerator((yyvsp[(2) - (3)].string), params);
01843 FreeArgs();
01844 }
01845 break;
01846
01847 case 30:
01848 #line 321 "/builddir/build/BUILD/lux/core/luxparse.y"
01849 {
01850 ParamSet params;
01851 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01852 Context::luxAreaLightSource((yyvsp[(2) - (3)].string), params);
01853 FreeArgs();
01854 }
01855 break;
01856
01857 case 31:
01858 #line 328 "/builddir/build/BUILD/lux/core/luxparse.y"
01859 {
01860 Context::luxAttributeBegin();
01861 }
01862 break;
01863
01864 case 32:
01865 #line 332 "/builddir/build/BUILD/lux/core/luxparse.y"
01866 {
01867 Context::luxAttributeEnd();
01868 }
01869 break;
01870
01871 case 33:
01872 #line 336 "/builddir/build/BUILD/lux/core/luxparse.y"
01873 {
01874 ParamSet params;
01875 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01876 Context::luxCamera((yyvsp[(2) - (3)].string), params);
01877 FreeArgs();
01878 }
01879 break;
01880
01881 case 34:
01882 #line 343 "/builddir/build/BUILD/lux/core/luxparse.y"
01883 {
01884 if (VerifyArrayLength( (yyvsp[(2) - (2)].ribarray), 16, "ConcatTransform" ))
01885 Context::luxConcatTransform( (float *) (yyvsp[(2) - (2)].ribarray)->array );
01886 ArrayFree( (yyvsp[(2) - (2)].ribarray) );
01887 }
01888 break;
01889
01890 case 35:
01891 #line 349 "/builddir/build/BUILD/lux/core/luxparse.y"
01892 {
01893 Context::luxCoordinateSystem( (yyvsp[(2) - (2)].string) );
01894 }
01895 break;
01896
01897 case 36:
01898 #line 353 "/builddir/build/BUILD/lux/core/luxparse.y"
01899 {
01900 Context::luxCoordSysTransform( (yyvsp[(2) - (2)].string) );
01901 }
01902 break;
01903
01904 case 37:
01905 #line 357 "/builddir/build/BUILD/lux/core/luxparse.y"
01906 {
01907 ParamSet params;
01908 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01909 Context::luxFilm((yyvsp[(2) - (3)].string), params);
01910 FreeArgs();
01911 }
01912 break;
01913
01914 case 38:
01915 #line 364 "/builddir/build/BUILD/lux/core/luxparse.y"
01916 {
01917 Context::luxIdentity();
01918 }
01919 break;
01920
01921 case 39:
01922 #line 368 "/builddir/build/BUILD/lux/core/luxparse.y"
01923 {
01924 ParamSet params;
01925 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01926 Context::luxLightSource((yyvsp[(2) - (3)].string), params);
01927 FreeArgs();
01928 }
01929 break;
01930
01931 case 40:
01932 #line 375 "/builddir/build/BUILD/lux/core/luxparse.y"
01933 {
01934 Context::luxLookAt((yyvsp[(2) - (10)].num), (yyvsp[(3) - (10)].num), (yyvsp[(4) - (10)].num), (yyvsp[(5) - (10)].num), (yyvsp[(6) - (10)].num), (yyvsp[(7) - (10)].num), (yyvsp[(8) - (10)].num), (yyvsp[(9) - (10)].num), (yyvsp[(10) - (10)].num));
01935 }
01936 break;
01937
01938 case 41:
01939 #line 379 "/builddir/build/BUILD/lux/core/luxparse.y"
01940 {
01941 ParamSet params;
01942 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01943 Context::luxMaterial((yyvsp[(2) - (3)].string), params);
01944 FreeArgs();
01945 }
01946 break;
01947
01948 case 42:
01949 #line 386 "/builddir/build/BUILD/lux/core/luxparse.y"
01950 {
01951 ParamSet params;
01952 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01953 Context::luxMakeNamedMaterial((yyvsp[(2) - (3)].string), params);
01954 FreeArgs();
01955 }
01956 break;
01957
01958 case 43:
01959 #line 393 "/builddir/build/BUILD/lux/core/luxparse.y"
01960 {
01961 ParamSet params;
01962 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01963 Context::luxNamedMaterial((yyvsp[(2) - (3)].string), params);
01964 FreeArgs();
01965 }
01966 break;
01967
01968 case 44:
01969 #line 400 "/builddir/build/BUILD/lux/core/luxparse.y"
01970 {
01971 Context::luxObjectBegin((yyvsp[(2) - (2)].string));
01972 }
01973 break;
01974
01975 case 45:
01976 #line 404 "/builddir/build/BUILD/lux/core/luxparse.y"
01977 {
01978 Context::luxObjectEnd();
01979 }
01980 break;
01981
01982 case 46:
01983 #line 408 "/builddir/build/BUILD/lux/core/luxparse.y"
01984 {
01985 Context::luxObjectInstance((yyvsp[(2) - (2)].string));
01986 }
01987 break;
01988
01989 case 47:
01990 #line 412 "/builddir/build/BUILD/lux/core/luxparse.y"
01991 {
01992 ParamSet params;
01993 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
01994 Context::luxPixelFilter((yyvsp[(2) - (3)].string), params);
01995 FreeArgs();
01996 }
01997 break;
01998
01999 case 48:
02000 #line 419 "/builddir/build/BUILD/lux/core/luxparse.y"
02001 {
02002 Context::luxReverseOrientation();
02003 }
02004 break;
02005
02006 case 49:
02007 #line 423 "/builddir/build/BUILD/lux/core/luxparse.y"
02008 {
02009 Context::luxRotate((yyvsp[(2) - (5)].num), (yyvsp[(3) - (5)].num), (yyvsp[(4) - (5)].num), (yyvsp[(5) - (5)].num));
02010 }
02011 break;
02012
02013 case 50:
02014 #line 427 "/builddir/build/BUILD/lux/core/luxparse.y"
02015 {
02016 ParamSet params;
02017 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
02018 Context::luxSampler((yyvsp[(2) - (3)].string), params);
02019 FreeArgs();
02020 }
02021 break;
02022
02023 case 51:
02024 #line 434 "/builddir/build/BUILD/lux/core/luxparse.y"
02025 {
02026 Context::luxScale((yyvsp[(2) - (4)].num), (yyvsp[(3) - (4)].num), (yyvsp[(4) - (4)].num));
02027 }
02028 break;
02029
02030 case 52:
02031 #line 438 "/builddir/build/BUILD/lux/core/luxparse.y"
02032 {
02033 ;
02034 }
02035 break;
02036
02037 case 53:
02038 #line 442 "/builddir/build/BUILD/lux/core/luxparse.y"
02039 {
02040 ParamSet params;
02041 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
02042 Context::luxShape((yyvsp[(2) - (3)].string), params);
02043 FreeArgs();
02044 }
02045 break;
02046
02047 case 54:
02048 #line 449 "/builddir/build/BUILD/lux/core/luxparse.y"
02049 {
02050 ParamSet params;
02051 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
02052 Context::luxPortalShape((yyvsp[(2) - (3)].string), params);
02053 FreeArgs();
02054 }
02055 break;
02056
02057 case 55:
02058 #line 456 "/builddir/build/BUILD/lux/core/luxparse.y"
02059 {
02060 ParamSet params;
02061 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
02062 Context::luxSurfaceIntegrator((yyvsp[(2) - (3)].string), params);
02063 FreeArgs();
02064 }
02065 break;
02066
02067 case 56:
02068 #line 463 "/builddir/build/BUILD/lux/core/luxparse.y"
02069 {
02070 ParamSet params;
02071 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
02072 Context::luxTexture((yyvsp[(2) - (5)].string), (yyvsp[(3) - (5)].string), (yyvsp[(4) - (5)].string), params);
02073 FreeArgs();
02074 }
02075 break;
02076
02077 case 57:
02078 #line 470 "/builddir/build/BUILD/lux/core/luxparse.y"
02079 {
02080 Context::luxTransformBegin();
02081 }
02082 break;
02083
02084 case 58:
02085 #line 474 "/builddir/build/BUILD/lux/core/luxparse.y"
02086 {
02087 Context::luxTransformEnd();
02088 }
02089 break;
02090
02091 case 59:
02092 #line 478 "/builddir/build/BUILD/lux/core/luxparse.y"
02093 {
02094 if (VerifyArrayLength( (yyvsp[(2) - (2)].ribarray), 16, "Transform" ))
02095 Context::luxTransform( (float *) (yyvsp[(2) - (2)].ribarray)->array );
02096 ArrayFree( (yyvsp[(2) - (2)].ribarray) );
02097 }
02098 break;
02099
02100 case 60:
02101 #line 484 "/builddir/build/BUILD/lux/core/luxparse.y"
02102 {
02103 luxTranslate((yyvsp[(2) - (4)].num), (yyvsp[(3) - (4)].num), (yyvsp[(4) - (4)].num));
02104 }
02105 break;
02106
02107 case 61:
02108 #line 488 "/builddir/build/BUILD/lux/core/luxparse.y"
02109 {
02110 ParamSet params;
02111 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
02112 Context::luxVolumeIntegrator((yyvsp[(2) - (3)].string), params);
02113 FreeArgs();
02114 }
02115 break;
02116
02117 case 62:
02118 #line 495 "/builddir/build/BUILD/lux/core/luxparse.y"
02119 {
02120 ParamSet params;
02121 InitParamSet(params, CPS, CPT, CPA, CPSZ, CPTH);
02122 Context::luxVolume((yyvsp[(2) - (3)].string), params);
02123 FreeArgs();
02124 }
02125 break;
02126
02127 case 63:
02128 #line 502 "/builddir/build/BUILD/lux/core/luxparse.y"
02129 {
02130 Context::luxWorldBegin();
02131 }
02132 break;
02133
02134 case 64:
02135 #line 506 "/builddir/build/BUILD/lux/core/luxparse.y"
02136 {
02137 Context::luxWorldEnd();
02138 }
02139 break;
02140
02141
02142
02143 #line 2144 "/builddir/build/BUILD/lux/build/luxparse.cpp"
02144 default: break;
02145 }
02146 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
02147
02148 YYPOPSTACK (yylen);
02149 yylen = 0;
02150 YY_STACK_PRINT (yyss, yyssp);
02151
02152 *++yyvsp = yyval;
02153
02154
02155
02156
02157
02158
02159 yyn = yyr1[yyn];
02160
02161 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
02162 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
02163 yystate = yytable[yystate];
02164 else
02165 yystate = yydefgoto[yyn - YYNTOKENS];
02166
02167 goto yynewstate;
02168
02169
02170
02171
02172
02173 yyerrlab:
02174
02175 if (!yyerrstatus)
02176 {
02177 ++yynerrs;
02178 #if ! YYERROR_VERBOSE
02179 yyerror (YY_("syntax error"));
02180 #else
02181 {
02182 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
02183 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
02184 {
02185 YYSIZE_T yyalloc = 2 * yysize;
02186 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
02187 yyalloc = YYSTACK_ALLOC_MAXIMUM;
02188 if (yymsg != yymsgbuf)
02189 YYSTACK_FREE (yymsg);
02190 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
02191 if (yymsg)
02192 yymsg_alloc = yyalloc;
02193 else
02194 {
02195 yymsg = yymsgbuf;
02196 yymsg_alloc = sizeof yymsgbuf;
02197 }
02198 }
02199
02200 if (0 < yysize && yysize <= yymsg_alloc)
02201 {
02202 (void) yysyntax_error (yymsg, yystate, yychar);
02203 yyerror (yymsg);
02204 }
02205 else
02206 {
02207 yyerror (YY_("syntax error"));
02208 if (yysize != 0)
02209 goto yyexhaustedlab;
02210 }
02211 }
02212 #endif
02213 }
02214
02215
02216
02217 if (yyerrstatus == 3)
02218 {
02219
02220
02221
02222 if (yychar <= YYEOF)
02223 {
02224
02225 if (yychar == YYEOF)
02226 YYABORT;
02227 }
02228 else
02229 {
02230 yydestruct ("Error: discarding",
02231 yytoken, &yylval);
02232 yychar = YYEMPTY;
02233 }
02234 }
02235
02236
02237
02238 goto yyerrlab1;
02239
02240
02241
02242
02243
02244 yyerrorlab:
02245
02246
02247
02248
02249 if ( 0)
02250 goto yyerrorlab;
02251
02252
02253
02254 YYPOPSTACK (yylen);
02255 yylen = 0;
02256 YY_STACK_PRINT (yyss, yyssp);
02257 yystate = *yyssp;
02258 goto yyerrlab1;
02259
02260
02261
02262
02263
02264 yyerrlab1:
02265 yyerrstatus = 3;
02266
02267 for (;;)
02268 {
02269 yyn = yypact[yystate];
02270 if (yyn != YYPACT_NINF)
02271 {
02272 yyn += YYTERROR;
02273 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
02274 {
02275 yyn = yytable[yyn];
02276 if (0 < yyn)
02277 break;
02278 }
02279 }
02280
02281
02282 if (yyssp == yyss)
02283 YYABORT;
02284
02285
02286 yydestruct ("Error: popping",
02287 yystos[yystate], yyvsp);
02288 YYPOPSTACK (1);
02289 yystate = *yyssp;
02290 YY_STACK_PRINT (yyss, yyssp);
02291 }
02292
02293 if (yyn == YYFINAL)
02294 YYACCEPT;
02295
02296 *++yyvsp = yylval;
02297
02298
02299
02300 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
02301
02302 yystate = yyn;
02303 goto yynewstate;
02304
02305
02306
02307
02308
02309 yyacceptlab:
02310 yyresult = 0;
02311 goto yyreturn;
02312
02313
02314
02315
02316 yyabortlab:
02317 yyresult = 1;
02318 goto yyreturn;
02319
02320 #ifndef yyoverflow
02321
02322
02323
02324 yyexhaustedlab:
02325 yyerror (YY_("memory exhausted"));
02326 yyresult = 2;
02327
02328 #endif
02329
02330 yyreturn:
02331 if (yychar != YYEOF && yychar != YYEMPTY)
02332 yydestruct ("Cleanup: discarding lookahead",
02333 yytoken, &yylval);
02334
02335
02336 YYPOPSTACK (yylen);
02337 YY_STACK_PRINT (yyss, yyssp);
02338 while (yyssp != yyss)
02339 {
02340 yydestruct ("Cleanup: popping",
02341 yystos[*yyssp], yyvsp);
02342 YYPOPSTACK (1);
02343 }
02344 #ifndef yyoverflow
02345 if (yyss != yyssa)
02346 YYSTACK_FREE (yyss);
02347 #endif
02348 #if YYERROR_VERBOSE
02349 if (yymsg != yymsgbuf)
02350 YYSTACK_FREE (yymsg);
02351 #endif
02352
02353 return YYID (yyresult);
02354 }
02355
02356
02357 #line 509 "/builddir/build/BUILD/lux/core/luxparse.y"
02358
02359 static void InitParamSet(ParamSet &ps, int count, const char **tokens,
02360 void **args, int *sizes, bool *texture_helper) {
02361 ps.Clear();
02362 for (int i = 0; i < count; ++i) {
02363 int type;
02364 string name;
02365 if (lookupType(tokens[i], &type, name)) {
02366 if (texture_helper && texture_helper[i] && type != PARAM_TYPE_TEXTURE && type != PARAM_TYPE_STRING)
02367 {
02368 std::stringstream ss;
02369 ss<<"Bad type for "<<name<<". Changing it to a texture.";
02370 luxError( LUX_SYNTAX,LUX_WARNING,ss.str().c_str());
02371
02372 type = PARAM_TYPE_TEXTURE;
02373 }
02374 void *data = args[i];
02375 int nItems = sizes[i];
02376 if (type == PARAM_TYPE_INT) {
02377
02378 int nAlloc = sizes[i];
02379 int *idata = new int[nAlloc];
02380 float *fdata = (float *)data;
02381 for (int j = 0; j < nAlloc; ++j)
02382 idata[j] = int(fdata[j]);
02383 ps.AddInt(name, idata, nItems);
02384 delete[] idata;
02385 }
02386 else if (type == PARAM_TYPE_BOOL) {
02387
02388 int nAlloc = sizes[i];
02389 bool *bdata = new bool[nAlloc];
02390 for (int j = 0; j < nAlloc; ++j) {
02391 string s(*((const char **)data));
02392 if (s == "true") bdata[j] = true;
02393 else if (s == "false") bdata[j] = false;
02394 else {
02395 std::stringstream ss;
02396 ss<<"Value '"<<s<<"' unknown for boolean parameter '"<<tokens[i]<<"'. Using 'false'.";
02397 luxError( LUX_SYNTAX,LUX_WARNING,ss.str().c_str());
02398
02399
02400 bdata[j] = false;
02401 }
02402 }
02403 ps.AddBool(name, bdata, nItems);
02404 delete[] bdata;
02405 }
02406 else if (type == PARAM_TYPE_FLOAT) {
02407 ps.AddFloat(name, (float *)data, nItems);
02408 } else if (type == PARAM_TYPE_POINT) {
02409 ps.AddPoint(name, (Point *)data, nItems / 3);
02410 } else if (type == PARAM_TYPE_VECTOR) {
02411 ps.AddVector(name, (Vector *)data, nItems / 3);
02412 } else if (type == PARAM_TYPE_NORMAL) {
02413 ps.AddNormal(name, (Normal *)data, nItems / 3);
02414 } else if (type == PARAM_TYPE_COLOR) {
02415 ps.AddSpectrum(name, (Spectrum *)data, nItems / COLOR_SAMPLES);
02416 } else if (type == PARAM_TYPE_STRING) {
02417 string *strings = new string[nItems];
02418 for (int j = 0; j < nItems; ++j)
02419 strings[j] = string(*((const char **)data+j));
02420 ps.AddString(name, strings, nItems);
02421 delete[] strings;
02422 }
02423 else if (type == PARAM_TYPE_TEXTURE) {
02424 if (nItems == 1) {
02425 string val(*((const char **)data));
02426 ps.AddTexture(name, val);
02427 }
02428 else
02429 {
02430
02431 std::stringstream ss;
02432 ss<<"Only one string allowed for 'texture' parameter "<<name;
02433 luxError( LUX_SYNTAX,LUX_ERROR,ss.str().c_str());
02434 }
02435 }
02436 }
02437 else
02438 {
02439
02440 std::stringstream ss;
02441 ss<<"Type of parameter '"<<tokens[i]<<"' is unknown";
02442 luxError( LUX_SYNTAX,LUX_WARNING,ss.str().c_str());
02443 }
02444 }
02445 }
02446 static bool lookupType(const char *token, int *type, string &name) {
02447 BOOST_ASSERT(token != NULL);
02448 *type = 0;
02449 const char *strp = token;
02450 while (*strp && isspace(*strp))
02451 ++strp;
02452 if (!*strp) {
02453
02454 std::stringstream ss;
02455 ss<<"Parameter '"<<token<<"' doesn't have a type declaration?!";
02456 luxError( LUX_SYNTAX,LUX_ERROR,ss.str().c_str());
02457 return false;
02458 }
02459 #define TRY_DECODING_TYPE(name, mask) \
02460 if (strncmp(name, strp, strlen(name)) == 0) { \
02461 *type = mask; strp += strlen(name); \
02462 }
02463 TRY_DECODING_TYPE("float", PARAM_TYPE_FLOAT)
02464 else TRY_DECODING_TYPE("integer", PARAM_TYPE_INT)
02465 else TRY_DECODING_TYPE("bool", PARAM_TYPE_BOOL)
02466 else TRY_DECODING_TYPE("point", PARAM_TYPE_POINT)
02467 else TRY_DECODING_TYPE("vector", PARAM_TYPE_VECTOR)
02468 else TRY_DECODING_TYPE("normal", PARAM_TYPE_NORMAL)
02469 else TRY_DECODING_TYPE("string", PARAM_TYPE_STRING)
02470 else TRY_DECODING_TYPE("texture", PARAM_TYPE_TEXTURE)
02471 else TRY_DECODING_TYPE("color", PARAM_TYPE_COLOR)
02472 else {
02473
02474 std::stringstream ss;
02475 ss<<"Unable to decode type for token '"<<token<<"'";
02476 luxError( LUX_SYNTAX,LUX_ERROR,ss.str().c_str());
02477 return false;
02478 }
02479 while (*strp && isspace(*strp))
02480 ++strp;
02481 name = string(strp);
02482 return true;
02483 }
02484