home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Resource Library: Graphics
/
graphics-16000.iso
/
msdos
/
raytrace
/
rayshade
/
etc
/
rsconver
/
yacc_tab.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-04-30
|
49KB
|
1,757 lines
/* A Bison parser, made from yacc.y */
#define tFLOAT 258
#define tSTRING 259
#define tHASHTHING 260
#define tINT 261
#define tADAPTIVE 262
#define tAPERTURE 263
#define tBACKGROUND 264
#define tBLOTCH 265
#define tBOX 266
#define tBUMP 267
#define tCONE 268
#define tCYL 269
#define tDIRECTIONAL 270
#define tENDDEF 271
#define tEXTENDED 272
#define tEYEP 273
#define tFBM 274
#define tFBMBUMP 275
#define tFOCALDIST 276
#define tFOG 277
#define tFOV 278
#define tGLOSS 279
#define tGRID 280
#define tHEIGHTFIELD 281
#define tJITTERED 282
#define tLIGHT 283
#define tLIST 284
#define tLOOKP 285
#define tMARBLE 286
#define tMAXDEPTH 287
#define tMIST 288
#define tOBJECT 289
#define tOUTFILE 290
#define tPLANE 291
#define tPOINT 292
#define tPOLY 293
#define tROTATE 294
#define tSAMPLES 295
#define tSCALE 296
#define tSCREEN 297
#define tSPHERE 298
#define tSTARTDEF 299
#define tSUPERQ 300
#define tSURFACE 301
#define tRESOLUTION 302
#define tTHRESH 303
#define tTRANSLATE 304
#define tTRANSFORM 305
#define tTRIANGLE 306
#define tUP 307
#define tENDFILE 308
#define tTEXTURE 309
#define tCHECKER 310
#define tWOOD 311
#define tCONTRAST 312
#define tCUTOFF 313
#include <stdio.h>
#include "common.h"
#define NEWLINE() WriteNewline()
/*#define NEWLINE() printf("\n")*/
#define LIST 0
#define GRID 1
char yyfilename[BUFSIZ];
int yylineno;
typedef union {
char *c;
int i;
double d;
Color col;
Vector v;
} YYSTYPE;
#ifndef YYLTYPE
typedef
struct yyltype
{
int timestamp;
int first_line;
int first_column;
int last_line;
int last_column;
char *text;
}
yyltype;
#define YYLTYPE yyltype
#endif
#include <stdio.h>
#ifndef __STDC__
#define const
#endif
#define YYFINAL 311
#define YYFLAG -32768
#define YYNTBASE 59
#define YYTRANSLATE(x) ((unsigned)(x) <= 313 ? yytranslate[x] : 171)
static const char yytranslate[] = { 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 1, 2, 3, 4, 5,
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, 37, 38, 39, 40, 41, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58
};
#if YYDEBUG != 0
static const short yyrline[] = { 0,
51, 52, 54, 55, 56, 57, 58, 59, 60, 61,
62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
72, 73, 74, 75, 76, 77, 78, 79, 81, 87,
92, 97, 99, 101, 102, 103, 104, 105, 106, 107,
108, 109, 111, 116, 118, 126, 127, 129, 130, 131,
132, 133, 134, 136, 137, 139, 144, 148, 152, 156,
160, 164, 168, 172, 176, 180, 185, 190, 195, 196,
198, 202, 207, 211, 221, 234, 239, 244, 249, 253,
258, 263, 269, 274, 279, 284, 288, 293, 298, 303,
308, 313, 317, 321, 328, 332, 337, 374, 418, 423,
428, 429, 431, 436, 446, 472, 477, 491, 495, 500,
509, 517, 522, 527, 534, 536, 541, 543, 548, 550,
553, 555, 557, 558, 561, 563, 565, 566, 567, 568,
569, 570, 571, 572, 573, 574, 575, 576, 577, 578,
579, 580, 581, 582, 583, 584, 585, 586, 587, 588,
589, 590, 591, 592, 593, 594, 595, 596, 597, 598,
599, 600, 601, 602, 603, 604, 605, 606, 607, 608,
609, 610, 611, 612, 613, 614, 615
};
static const char * const yytname[] = { 0,
"error","$illegal.","tFLOAT","tSTRING","tHASHTHING","tINT","tADAPTIVE","tAPERTURE","tBACKGROUND","tBLOTCH",
"tBOX","tBUMP","tCONE","tCYL","tDIRECTIONAL","tENDDEF","tEXTENDED","tEYEP","tFBM","tFBMBUMP",
"tFOCALDIST","tFOG","tFOV","tGLOSS","tGRID","tHEIGHTFIELD","tJITTERED","tLIGHT","tLIST","tLOOKP",
"tMARBLE","tMAXDEPTH","tMIST","tOBJECT","tOUTFILE","tPLANE","tPOINT","tPOLY","tROTATE","tSAMPLES",
"tSCALE","tSCREEN","tSPHERE","tSTARTDEF","tSUPERQ","tSURFACE","tRESOLUTION","tTHRESH","tTRANSLATE","tTRANSFORM",
"tTRIANGLE","tUP","tENDFILE","tTEXTURE","tCHECKER","tWOOD","tCONTRAST","tCUTOFF","Items"
};
#endif
static const short yyr1[] = { 0,
59, 59, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 60, 61, 62,
63, 64, 65, 66, 66, 66, 66, 66, 66, 66,
66, 66, 67, 68, 69, 70, 70, 71, 71, 71,
71, 71, 71, 72, 72, 73, 74, 74, 74, 74,
74, 74, 74, 74, 74, 74, 75, 76, 77, 77,
78, 78, 78, 78, 78, 79, 80, 81, 82, 82,
83, 84, 85, 86, 87, 88, 88, 89, 90, 91,
92, 93, 93, 93, 94, 94, 95, 95, 96, 97,
98, 98, 99, 100, 101, 102, 103, 104, 104, 105,
106, 107, 108, 109, 110, 111, 112, 113, 114, 114,
115, 116, 117, 117, 118, 119, 120, 121, 122, 123,
124, 125, 126, 127, 128, 129, 130, 131, 132, 133,
134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
144, 145, 146, 147, 148, 149, 150, 151, 152, 153,
154, 155, 156, 157, 158, 159, 160, 161, 162, 163,
164, 165, 166, 167, 168, 169, 170
};
static const short yyr2[] = { 0,
0, 2, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
1, 1, 2, 3, 1, 2, 0, 1, 1, 1,
1, 1, 1, 2, 0, 3, 2, 3, 2, 1,
2, 7, 8, 6, 1, 2, 2, 3, 2, 0,
2, 3, 4, 10, 13, 3, 2, 2, 3, 2,
2, 2, 4, 2, 1, 3, 3, 2, 2, 2,
2, 3, 3, 4, 2, 2, 9, 11, 3, 3,
0, 2, 1, 6, 5, 4, 8, 5, 8, 9,
4, 2, 5, 3, 3, 3, 3, 3, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 4, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 2, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1
};
static const short yydefact[] = { 1,
0, 29, 127, 128, 129, 131, 133, 134, 138, 141,
142, 143, 0, 146, 147, 148, 149, 150, 152, 153,
154, 155, 156, 158, 160, 162, 163, 0, 165, 166,
167, 170, 171, 172, 176, 177, 2, 27, 22, 23,
18, 55, 70, 24, 55, 47, 19, 55, 3, 4,
5, 6, 11, 13, 14, 15, 12, 7, 8, 9,
10, 16, 17, 0, 20, 42, 41, 39, 38, 35,
36, 37, 40, 34, 21, 26, 25, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 31, 0, 85,
0, 30, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 45, 0, 0, 0, 0, 0, 28, 0,
0, 0, 164, 32, 33, 43, 0, 67, 135, 137,
157, 0, 0, 0, 122, 82, 119, 120, 88, 91,
0, 125, 0, 0, 126, 0, 70, 0, 89, 123,
124, 0, 80, 0, 96, 95, 77, 121, 90, 0,
70, 112, 0, 101, 81, 0, 0, 0, 0, 0,
0, 78, 0, 84, 0, 173, 54, 0, 159, 161,
168, 169, 69, 0, 0, 0, 0, 136, 51, 52,
48, 53, 46, 50, 49, 44, 93, 0, 0, 92,
0, 0, 0, 0, 76, 0, 114, 0, 79, 99,
0, 68, 0, 100, 86, 0, 0, 0, 87, 0,
0, 145, 130, 132, 139, 140, 144, 151, 174, 175,
70, 0, 0, 0, 0, 0, 60, 0, 65, 0,
0, 71, 0, 94, 0, 115, 0, 0, 0, 117,
0, 0, 111, 102, 103, 106, 0, 0, 0, 83,
56, 0, 59, 0, 0, 66, 61, 57, 72, 0,
0, 118, 0, 0, 105, 116, 113, 0, 0, 108,
58, 0, 0, 73, 0, 0, 104, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
107, 0, 0, 109, 0, 64, 0, 110, 97, 62,
0, 0, 63, 0, 98, 74, 0, 0, 75, 0,
0
};
static const short yydefgoto[] = { 1,
37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
117, 183, 114, 167, 221, 47, 48, 115, 173, 49,
50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
60, 61, 62, 63, 64, 65, 66, 67, 204, 244,
68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
130, 197, 137, 188, 138, 149, 126, 189, 133, 136,
78, 79, 80, 222, 81, 223, 82, 83, 122, 186,
123, 84, 224, 225, 85, 86, 87, 226, 88, 89,
90, 91, 92, 93, 227, 94, 95, 96, 97, 98,
124, 99, 174, 100, 175, 101, 102, 103, 104, 105,
106, 176, 177, 107, 108, 109, 168, 228, 229, 110,
111
};
static const short yypact[] = {-32768,
379,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768, -2,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 13,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768, -12,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 3, 8, 8,
19, 19, 26, 8, 8, 12, 8,-32768, 19,-32768,
8,-32768, 8, 30, 8, 19, 19, 19, 19, 30,
30, 19,-32768, 19, 19, 30, 19, 8,-32768, 8,
8, 32,-32768, -11, 5, -11, 82, -11,-32768,-32768,
-32768, 8, 12, 8,-32768,-32768,-32768,-32768,-32768,-32768,
8,-32768, 12, 12,-32768, 12,-32768, 8,-32768,-32768,
-32768, 12, 8, 19,-32768, 8,-32768,-32768,-32768, 8,
-32768,-32768, 12,-32768,-32768, 30, 8, 8, 12, 30,
8,-32768, 8,-32768, 36,-32768,-32768, 21,-32768,-32768,
-32768,-32768,-32768, 8, 8, 8, 12,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768, 12, 12,-32768,
8, 12, 12, 12, 5, 8,-32768, 12,-32768,-32768,
8, 5, 12, 8,-32768, 8, 8, 12,-32768, 8,
8,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768, 8, 8, 8, 8, 8, 19, 19,-32768, 12,
8,-32768, 12,-32768, 12,-32768, 12, 12, 12,-32768,
12, 8,-32768,-32768,-32768,-32768, 8, 12, 8,-32768,
5, 19,-32768, 8, 8,-32768,-32768,-32768,-32768, 8,
12,-32768, 12, 12,-32768,-32768,-32768, 8, 12, 8,
-32768, 8, 8,-32768, 12, 12,-32768, 8, 12, 8,
8, 8, 12, 12, 8, 12, 8, 30, 30, 12,
-32768, 8, 12,-32768, 8,-32768, 12,-32768, 12, 19,
12, 12,-32768, 12,-32768, 12, 12, 12,-32768, 48,
-32768
};
static const short yypgoto[] = {-32768,
-32768,-32768, -68, -66, -64,-32768,-32768, -60,-32768,-32768,
-32768,-32768, -24,-32768,-32768, -59,-32768, -135,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768, -58,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-85, -158, 140, -114, 81, -93,-32768, -86, -70,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
-32768
};
#define YYLAST 437
static const short yytable[] = { 142,
208, 195, 119, 112, 120, 145, 155, 156, 125, 150,
127, 134, 160, 128, 140, 202, 113, 141, 144, 193,
116, 194, 132, 118, 121, 151, 152, 153, 154, 135,
213, 157, 214, 158, 159, 148, 161, 165, 203, 215,
216, 212, 166, 169, 217, 170, 192, 311, 179, 248,
180, 218, 181, 171, 172, 198, 182, 184, 185, 0,
0, 0, 205, 0, 201, 0, 209, 0, 0, 0,
0, 0, 198, 200, 0, 219, 220, 0, 238, 239,
0, 0, 0, 0, 0, 251, 0, 0, 243, 269,
233, 0, 6, 0, 7, 8, 0, 178, 0, 0,
0, 234, 235, 0, 0, 237, 13, 14, 0, 0,
17, 241, 0, 0, 0, 21, 0, 23, 0, 24,
0, 198, 0, 0, 27, 28, 29, 30, 0, 0,
0, 0, 32, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 259, 0, 0, 261, 0, 262, 0,
263, 264, 265, 0, 266, 0, 257, 258, 0, 129,
131, 198, 0, 0, 0, 139, 0, 143, 0, 0,
0, 146, 0, 0, 275, 131, 276, 277, 0, 0,
0, 271, 279, 0, 0, 0, 0, 0, 283, 284,
163, 164, 286, 0, 295, 296, 290, 291, 0, 293,
0, 0, 0, 297, 0, 0, 299, 0, 0, 0,
301, 191, 302, 0, 304, 305, 0, 306, 196, 307,
308, 309, 0, 199, 0, 0, 191, 0, 0, 303,
131, 0, 147, 0, 0, 0, 0, 206, 207, 0,
0, 0, 0, 211, 0, 0, 0, 162, 0, 0,
0, 0, 0, 0, 0, 231, 0, 0, 0, 0,
0, 187, 0, 190, 0, 0, 0, 0, 0, 0,
0, 236, 0, 0, 0, 0, 240, 0, 0, 0,
0, 242, 0, 0, 0, 0, 0, 247, 0, 0,
0, 250, 0, 0, 0, 0, 0, 0, 0, 0,
210, 0, 252, 253, 254, 255, 256, 0, 0, 0,
0, 260, 0, 230, 0, 232, 0, 0, 0, 0,
0, 0, 267, 0, 0, 0, 0, 268, 0, 0,
0, 0, 0, 0, 272, 273, 0, 0, 0, 0,
274, 0, 0, 245, 0, 246, 0, 0, 278, 249,
0, 0, 281, 282, 0, 0, 0, 0, 285, 0,
0, 288, 289, 0, 0, 292, 0, 0, 0, 0,
0, 0, 298, 0, 0, 300, 0, 0, 310, 0,
0, 0, 0, 2, 0, 3, 4, 5, 270, 6,
0, 7, 8, 0, 0, 0, 9, 0, 0, 10,
11, 12, 0, 13, 14, 15, 16, 17, 18, 280,
19, 20, 21, 22, 23, 0, 24, 0, 25, 287,
26, 27, 28, 29, 30, 31, 294, 0, 0, 32,
33, 34, 0, 0, 0, 35, 36
};
static const short yycheck[] = { 86,
159, 137, 15, 6, 17, 91, 100, 101, 6, 95,
3, 82, 106, 6, 3, 151, 4, 6, 89, 134,
45, 136, 4, 48, 37, 96, 97, 98, 99, 4,
10, 102, 12, 104, 105, 6, 107, 6, 153, 19,
20, 6, 54, 39, 24, 41, 133, 0, 117, 208,
117, 31, 117, 49, 50, 142, 117, 117, 117, -1,
-1, -1, 156, -1, 150, -1, 160, -1, -1, -1,
-1, -1, 159, 144, -1, 55, 56, -1, 193, 194,
-1, -1, -1, -1, -1, 221, -1, -1, 203, 248,
177, -1, 11, -1, 13, 14, -1, 16, -1, -1,
-1, 188, 189, -1, -1, 192, 25, 26, -1, -1,
29, 198, -1, -1, -1, 34, -1, 36, -1, 38,
-1, 208, -1, -1, 43, 44, 45, 46, -1, -1,
-1, -1, 51, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, 230, -1, -1, 233, -1, 235, -1,
237, 238, 239, -1, 241, -1, 227, 228, -1, 79,
80, 248, -1, -1, -1, 85, -1, 87, -1, -1,
-1, 91, -1, -1, 261, 95, 263, 264, -1, -1,
-1, 252, 269, -1, -1, -1, -1, -1, 275, 276,
110, 111, 279, -1, 288, 289, 283, 284, -1, 286,
-1, -1, -1, 290, -1, -1, 293, -1, -1, -1,
297, 131, 299, -1, 301, 302, -1, 304, 138, 306,
307, 308, -1, 143, -1, -1, 146, -1, -1, 300,
150, -1, 93, -1, -1, -1, -1, 157, 158, -1,
-1, -1, -1, 163, -1, -1, -1, 108, -1, -1,
-1, -1, -1, -1, -1, 175, -1, -1, -1, -1,
-1, 122, -1, 124, -1, -1, -1, -1, -1, -1,
-1, 191, -1, -1, -1, -1, 196, -1, -1, -1,
-1, 201, -1, -1, -1, -1, -1, 207, -1, -1,
-1, 211, -1, -1, -1, -1, -1, -1, -1, -1,
161, -1, 222, 223, 224, 225, 226, -1, -1, -1,
-1, 231, -1, 174, -1, 176, -1, -1, -1, -1,
-1, -1, 242, -1, -1, -1, -1, 247, -1, -1,
-1, -1, -1, -1, 254, 255, -1, -1, -1, -1,
260, -1, -1, 204, -1, 206, -1, -1, 268, 210,
-1, -1, 272, 273, -1, -1, -1, -1, 278, -1,
-1, 281, 282, -1, -1, 285, -1, -1, -1, -1,
-1, -1, 292, -1, -1, 295, -1, -1, 0, -1,
-1, -1, -1, 5, -1, 7, 8, 9, 249, 11,
-1, 13, 14, -1, -1, -1, 18, -1, -1, 21,
22, 23, -1, 25, 26, 27, 28, 29, 30, 270,
32, 33, 34, 35, 36, -1, 38, -1, 40, 280,
42, 43, 44, 45, 46, 47, 287, -1, -1, 51,
52, 53, -1, -1, -1, 57, 58
};
#define YYPURE 1
/* BISON template */
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
/* Skeleton output parser for bison,
Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
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 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#ifdef __GNUC__
#define alloca __builtin_alloca
#else /* Not GNU C. */
#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
#include <alloca.h>
#else
#ifdef MSDOS
#include <malloc.h>
#else
void *alloca(unsigned);
#endif /* MSDOS */
#endif /* Sparc. */
#endif /* Not GNU C. */
#ifndef bcopy
#define bcopy(s,d,x) memcpy(d,s,x)
#endif
/* This is the parser code that is written into each bison parser
when the %semantic_parser declaration is not specified in the grammar.
It was written by Richard Stallman by simplifying the hairy parser
used when %semantic_parser is specified. */
/* Note: there must be only one dollar sign in this file.
It is replaced by the list of actions, each action
as one case of the switch. */
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
#define YYEMPTY -2
#define YYEOF 0
#define YYACCEPT return(0)
#define YYABORT return(1)
#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror.
This remains here temporarily to ease the
transition to the new meaning of YYERROR, for GCC.
Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
#define YYRECOVERING() (!!yyerrstatus)
#define YYBACKUP(token, value) \
do \
if (yychar == YYEMPTY && yylen == 1) \
{ yychar = (token), yylval = (value); \
yychar1 = YYTRANSLATE (yychar); \
YYPOPSTACK; \
goto yybackup; \
} \
else \
{ yyerror ("syntax error: cannot back up"); YYERROR; } \
while (0)
#define YYTERROR 1
#define YYERRCODE 256
#ifndef YYIMPURE
#define YYLEX yylex()
#endif
#ifndef YYPURE
#define YYLEX yylex(&yylval, &yylloc)
#endif
/* If nonreentrant, generate the variables here */
#ifndef YYIMPURE
int yychar; /* the lookahead symbol */
YYSTYPE yylval; /* the semantic value of the */
/* lookahead symbol */
#ifdef YYLSP_NEEDED
YYLTYPE yylloc; /* location data for the lookahead */
/* symbol */
#endif
int yynerrs; /* number of parse errors so far */
#endif /* YYIMPURE */
#if YYDEBUG != 0
int yydebug; /* nonzero means print parse trace */
/* Since this is uninitialized, it does not stop multiple parsers
from coexisting. */
#endif
/* YYINITDEPTH indicates the initial size of the parser's stacks */
#ifndef YYINITDEPTH
#define YYINITDEPTH 200
#endif
/* YYMAXDEPTH is the maximum size the stacks can grow to
(effective only if the built-in stack extension method is used). */
#if YYMAXDEPTH == 0
#undef YYMAXDEPTH
#endif
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 10000
#endif
/* This is the most reliable way to avoid incompatibilities
in available built-in functions on various systems. */
static void
__yy_bcopy (from, to, count)
char *from;
char *to;
int count;
{
register char *f = from;
register char *t = to;
register int i = count;
while (i-- > 0)
*t++ = *f++;
}
int
yyparse()
{
register int yystate;
register int yyn;
register short *yyssp;
register YYSTYPE *yyvsp;
int yyerrstatus; /* number of tokens to shift before error messages enabled */
int yychar1; /* lookahead token as an internal (translated) token number */
short yyssa[YYINITDEPTH]; /* the state stack */
YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
short *yyss = yyssa; /* refer to the stacks thru separate pointers */
YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */
#ifdef YYLSP_NEEDED
YYLTYPE *yyls = yylsa;
YYLTYPE *yylsp;
YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
#define YYPOPSTACK (yyvsp--, yysp--, yylsp--)
#else
#define YYPOPSTACK (yyvsp--, yysp--)
#endif
int yystacksize = YYINITDEPTH;
#ifndef YYPURE
int yychar;
YYSTYPE yylval;
int yynerrs;
#ifdef YYLSP_NEEDED
YYLTYPE yylloc;
#endif
#endif
YYSTYPE yyval; /* the variable used to return */
/* semantic values from the action */
/* routines */
int yylen;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Starting parse\n");
#endif
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
yychar = YYEMPTY; /* Cause a token to be read. */
/* Initialize stack pointers.
Waste one element of value and location stack
so that they stay on the same level as the state stack. */
yyssp = yyss - 1;
yyvsp = yyvs;
#ifdef YYLSP_NEEDED
yylsp = yyls;
#endif
/* Push a new state, which is found in yystate . */
/* In all cases, when you get here, the value and location stacks
have just been pushed. so pushing a state here evens the stacks. */
yynewstate:
*++yyssp = yystate;
if (yyssp >= yyss + yystacksize - 1)
{
/* Give user a chance to reallocate the stack */
/* Use copies of these so that the &'s don't force the real ones into memory. */
YYSTYPE *yyvs1 = yyvs;
short *yyss1 = yyss;
#ifdef YYLSP_NEEDED
YYLTYPE *yyls1 = yyls;
#endif
/* Get the current used size of the three stacks, in elements. */
int size = yyssp - yyss + 1;
#ifdef yyoverflow
/* Each stack pointer address is followed by the size of
the data in use in that stack, in bytes. */
yyoverflow("parser stack overflow",
&yyss1, size * sizeof (*yyssp),
&yyvs1, size * sizeof (*yyvsp),
#ifdef YYLSP_NEEDED
&yyls1, size * sizeof (*yylsp),
#endif
&yystacksize);
yyss = yyss1; yyvs = yyvs1;
#ifdef YYLSP_NEEDED
yyls = yyls1;
#endif
#else /* no yyoverflow */
/* Extend the stack our own way. */
if (yystacksize >= YYMAXDEPTH)
{
yyerror("parser stack overflow");
return 2;
}
yystacksize *= 2;
if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
__yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
__yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
#ifdef YYLSP_NEEDED
yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
__yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
#endif
#endif /* no yyoverflow */
yyssp = yyss + size - 1;
yyvsp = yyvs + size - 1;
#ifdef YYLSP_NEEDED
yylsp = yyls + size - 1;
#endif
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Stack size increased to %d\n", yystacksize);
#endif
if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Entering state %d\n", yystate);
#endif
yybackup:
/* Do appropriate processing given the current state. */
/* Read a lookahead token if we need one and don't already have one. */
/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
/* yychar is either YYEMPTY or YYEOF
or a valid token in external form. */
if (yychar == YYEMPTY)
{
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Reading a token: ");
#endif
yychar = YYLEX;
}
/* Convert token to internal form (in yychar1) for indexing tables with */
if (yychar <= 0) /* This means end of input. */
{
yychar1 = 0;
yychar = YYEOF; /* Don't call YYLEX any more */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Now at end of input.\n");
#endif
}
else
{
yychar1 = YYTRANSLATE(yychar);
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
#endif
}
yyn += yychar1;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
goto yydefault;
yyn = yytable[yyn];
/* yyn is what to do for this token type in this state.
Negative => reduce, -yyn is rule number.
Positive => shift, yyn is new state.
New state is final state => don't bother to shift,
just return success.
0, or most negative number => error. */
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrlab;
if (yyn == YYFINAL)
YYACCEPT;
/* Shift the lookahead token. */
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
#endif
/* Discard the token being shifted unless it is eof. */
if (yychar != YYEOF)
yychar = YYEMPTY;
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
/* count tokens shifted since error; after three, turn off error status. */
if (yyerrstatus) yyerrstatus--;
yystate = yyn;
goto yynewstate;
/* Do the default action for the current state. */
yydefault:
yyn = yydefact[yystate];
if (yyn == 0)
goto yyerrlab;
/* Do a reduction. yyn is the number of a rule to reduce with. */
yyreduce:
yylen = yyr2[yyn];
yyval = yyvsp[1-yylen]; /* implement default value of the action */
#if YYDEBUG != 0
if (yydebug)
{
if (yylen == 1)
fprintf (stderr, "Reducing 1 value via rule %d (line %d), ",
yyn, yyrline[yyn]);
else
fprintf (stderr, "Reducing %d values via rule %d (line %d), ",
yylen, yyn, yyrline[yyn]);
}
#endif
switch (yyn) {
case 29:
{
WriteVerbatim("\n#");
WriteVerbatim(yyvsp[0].c);
WriteNewline();
;
break;}
case 30:
{
NEWLINE();
;
break;}
case 31:
{
NEWLINE();
;
break;}
case 43:
{
NEWLINE();
;
break;}
case 45:
{
NEWLINE();
;
break;}
case 56:
{
NEWLINE();
;
break;}
case 57:
{
NEWLINE();
;
break;}
case 58:
{
NEWLINE();
;
break;}
case 59:
{
NEWLINE();
;
break;}
case 60:
{
NEWLINE();
;
break;}
case 61:
{
NEWLINE();
;
break;}
case 62:
{
NEWLINE();
;
break;}
case 63:
{
NEWLINE();
;
break;}
case 64:
{
NEWLINE();
;
break;}
case 65:
{
NEWLINE();
;
break;}
case 66:
{
NEWLINE();
;
break;}
case 67:
{
NEWLINE();
;
break;}
case 68:
{
NEWLINE();
;
break;}
case 71:
{
NEWLINE();
;
break;}
case 72:
{
WriteFloat(-yyvsp[0].d);
NEWLINE();
;
break;}
case 73:
{
NEWLINE();
;
break;}
case 74:
{
/* have to transpose... */
WriteFloat(yyvsp[-8].d); WriteFloat(yyvsp[-5].d); WriteFloat(yyvsp[-2].d);
WriteFloat(yyvsp[-7].d); WriteFloat(yyvsp[-4].d); WriteFloat(yyvsp[-1].d);
WriteFloat(yyvsp[-6].d); WriteFloat(yyvsp[-3].d); WriteFloat(yyvsp[0].d);
NEWLINE();
;
break;}
case 75:
{
/* transpose it */
WriteFloat(yyvsp[-11].d); WriteFloat(yyvsp[-8].d); WriteFloat(yyvsp[-5].d);
WriteFloat(yyvsp[-10].d); WriteFloat(yyvsp[-7].d); WriteFloat(yyvsp[-4].d);
WriteFloat(yyvsp[-9].d); WriteFloat(yyvsp[-6].d); WriteFloat(yyvsp[-3].d);
WriteFloat(yyvsp[-2].d); WriteFloat(yyvsp[-1].d); WriteFloat(yyvsp[0].d);
NEWLINE();
;
break;}
case 76:
{
NEWLINE();
;
break;}
case 77:
{
NEWLINE();
;
break;}
case 78:
{
NEWLINE();
;
break;}
case 79:
{
NEWLINE();
;
break;}
case 80:
{
NEWLINE();
;
break;}
case 81:
{
NEWLINE();
;
break;}
case 82:
{
WriteFloat((Float)(yyvsp[0].i+1));
NEWLINE();
;
break;}
case 83:
{
NEWLINE();
;
break;}
case 84:
{
NEWLINE();
;
break;}
case 85:
{
NEWLINE();
;
break;}
case 86:
{
NEWLINE();
;
break;}
case 87:
{
NEWLINE();
;
break;}
case 88:
{
NEWLINE();
;
break;}
case 89:
{
NEWLINE();
;
break;}
case 90:
{
NEWLINE();
;
break;}
case 91:
{
NEWLINE();
;
break;}
case 92:
{
NEWLINE();
;
break;}
case 93:
{
NEWLINE();
;
break;}
case 94:
{
WriteFloat(yyvsp[0].d);
WriteVector(&yyvsp[-1].v);
NEWLINE();
;
break;}
case 95:
{
NEWLINE();
;
break;}
case 96:
{
NEWLINE();
;
break;}
case 97:
{
if (yyvsp[-6].col.r || yyvsp[-6].col.g || yyvsp[-6].col.b) {
WriteString("\tambient");
WriteColor(&yyvsp[-6].col);
WriteNewline();
}
if (yyvsp[-5].col.r || yyvsp[-5].col.g || yyvsp[-5].col.b) {
WriteString("\tdiffuse");
WriteColor(&yyvsp[-5].col);
WriteNewline();
}
if (yyvsp[-4].col.r || yyvsp[-4].col.g || yyvsp[-4].col.b) {
WriteString("\tspecular");
WriteColor(&yyvsp[-4].col);
WriteNewline();
if (yyvsp[-3].d) {
WriteString("\tspecpow");
WriteFloat(yyvsp[-3].d);
WriteNewline();
}
}
if (yyvsp[-2].d) {
WriteString("\treflect");
WriteFloat(yyvsp[-2].d);
WriteNewline();
}
if (yyvsp[-1].d) {
WriteString("\ttransp");
WriteFloat(yyvsp[-1].d);
WriteString("index");
WriteFloat(yyvsp[0].d);
WriteNewline();
}
;
break;}
case 98:
{
if (yyvsp[-8].col.r || yyvsp[-8].col.g || yyvsp[-8].col.b) {
WriteString("\tambient");
WriteColor(&yyvsp[-8].col);
WriteNewline();
}
if (yyvsp[-7].col.r || yyvsp[-7].col.g || yyvsp[-7].col.b) {
WriteString("\tdiffuse");
WriteColor(&yyvsp[-7].col);
WriteNewline();
}
if (yyvsp[-6].col.r || yyvsp[-6].col.g || yyvsp[-6].col.b) {
WriteString("\tspecular");
WriteColor(&yyvsp[-6].col);
WriteNewline();
if (yyvsp[-5].d) {
WriteString("\tspecpow");
WriteFloat(yyvsp[-5].d);
WriteNewline();
}
}
if (yyvsp[-4].d) {
WriteString("\treflect");
WriteFloat(yyvsp[-4].d);
WriteNewline();
}
if (yyvsp[-3].d) {
WriteString("\ttransp");
WriteFloat(yyvsp[-3].d);
WriteString("index");
WriteFloat(yyvsp[-2].d);
WriteNewline();
}
if (yyvsp[-1].d) {
WriteString("\ttranslu");
WriteFloat(yyvsp[-1].d);
WriteString("1 1 1");
WriteFloat(yyvsp[0].d);
WriteNewline();
}
;
break;}
case 99:
{
NEWLINE();
;
break;}
case 100:
{
NEWLINE();
;
break;}
case 103:
{
NEWLINE();
;
break;}
case 104:
{
/* Radii now precede points */
WriteFloat(yyvsp[-1].d);
WriteVector(&yyvsp[-3].v);
WriteFloat(yyvsp[0].d);
WriteVector(&yyvsp[-2].v);
NEWLINE();
;
break;}
case 105:
{
Vector tmp;
WriteString(yyvsp[-3].c);
/* Radius now goes first */
WriteFloat(yyvsp[0].d);
WriteVector(&yyvsp[-2].v);
WriteVector(&yyvsp[-1].v);
NEWLINE();
WriteVerbatim("#ifdef ENDCAPS\n");
VecSub(yyvsp[-2].v, yyvsp[-1].v, &tmp);
WriteVerbatim("disc ");
WriteString(yyvsp[-3].c);
WriteFloat(yyvsp[0].d); /* radius */
WriteVector(&yyvsp[-2].v); /* pos */
WriteVector(&tmp);
WriteVerbatim("\ndisc ");
WriteString(yyvsp[-3].c);
VecScale(-1, tmp, &tmp);
WriteFloat(yyvsp[0].d); /* radius */
WriteVector(&yyvsp[-1].v); /* pos */
WriteVector(&tmp);
WriteVerbatim("\n#endif\n");
;
break;}
case 106:
{
NEWLINE();
;
break;}
case 107:
{
/* give box corners */
WriteFloat(yyvsp[-5].d - yyvsp[-2].d);
WriteFloat(yyvsp[-4].d - yyvsp[-1].d);
WriteFloat(yyvsp[-3].d - yyvsp[0].d);
WriteFloat(yyvsp[-5].d + yyvsp[-2].d);
WriteFloat(yyvsp[-4].d + yyvsp[-1].d);
WriteFloat(yyvsp[-3].d + yyvsp[0].d);
NEWLINE();
;
break;}
case 108:
{
NEWLINE();
;
break;}
case 109:
{
NEWLINE();
;
break;}
case 110:
{
WriteVerbatim("*/");
NEWLINE();
;
break;}
case 111:
{
/* reverse order of point/normal */
WriteVector(&yyvsp[0].v);
WriteVector(&yyvsp[-1].v);
NEWLINE();
;
break;}
case 112:
{
NEWLINE();
;
break;}
case 113:
{
NEWLINE();
;
break;}
case 114:
{
WriteColor(&yyvsp[0].col);
WriteFloat(yyvsp[-1].d); WriteFloat(yyvsp[-1].d); WriteFloat(yyvsp[-1].d);
NEWLINE();
;
break;}
case 116:
{
yyval.col.r = yyvsp[-2].d; yyval.col.g = yyvsp[-1].d; yyval.col.b = yyvsp[0].d;
;
break;}
case 118:
{
yyval.v.x = yyvsp[-2].d; yyval.v.y = yyvsp[-1].d; yyval.v.z = yyvsp[0].d;
;
break;}
case 119:
{ WriteFloat(yyvsp[0].d); ;
break;}
case 120:
{ WriteFloat((Float)yyvsp[0].i); ;
break;}
case 121:
{ WriteFloat((Float)yyvsp[0].i); ;
break;}
case 122:
{ yyval.i = (int)yyvsp[0].i; ;
break;}
case 124:
{ yyval.d = (double)yyvsp[0].i; ;
break;}
case 125:
{ WriteString(yyvsp[0].c); ;
break;}
case 126:
{ yyval.c = yyvsp[0].c; ;
break;}
case 127:
{ WriteString("samples"); ;
break;}
case 128:
{ WriteString("aperture"); ;
break;}
case 129:
{ WriteString("background"); ;
break;}
case 130:
{ WriteString("blotch"); ;
break;}
case 131:
{ WriteString("box"); ;
break;}
case 132:
{ WriteString("bump"); ;
break;}
case 133:
{ WriteString("cone"); ;
break;}
case 134:
{ WriteString("cylinder"); ;
break;}
case 135:
{ WriteString("directional"); ;
break;}
case 136:
{ EndDefine(); ;
break;}
case 137:
{ WriteString("extended"); ;
break;}
case 138:
{ WriteString("eyep"); ;
break;}
case 139:
{ WriteString("fbm"); ;
break;}
case 140:
{ WriteString("fbmbump"); ;
break;}
case 141:
{ WriteString("focaldist"); ;
break;}
case 142:
{ WriteString("atmosphere fog"); ;
break;}
case 143:
{ WriteString("fov"); ;
break;}
case 144:
{ WriteString("gloss"); ;
break;}
case 145:
{ SetTypeGrid(yyvsp[-2].i,yyvsp[-1].i,yyvsp[0].i); ;
break;}
case 146:
{ WriteString("heightfield"); ;
break;}
case 147:
{ WriteString("jittered"); ;
break;}
case 148:
{ WriteString("light"); ;
break;}
case 149:
{ SetTypeList(); ;
break;}
case 150:
{ WriteString("lookp"); ;
break;}
case 151:
{ WriteString("marble"); ;
break;}
case 152:
{ WriteString("maxdepth"); ;
break;}
case 153:
{ WriteString("atmosphere mist"); ;
break;}
case 154:
{ WriteString("object"); ;
break;}
case 155:
{ WriteString("outfile"); ;
break;}
case 156:
{ WriteString("plane"); ;
break;}
case 157:
{ WriteString("point"); ;
break;}
case 158:
{ WriteString("poly"); ;
break;}
case 159:
{ WriteString("rotate"); ;
break;}
case 160:
{ WriteString("samples"); ;
break;}
case 161:
{ WriteString("scale"); ;
break;}
case 162:
{ WriteString("screen"); ;
break;}
case 163:
{ WriteString("sphere"); ;
break;}
case 164:
{ StartDefine(yyvsp[0].c); ;
break;}
case 165:
{ WriteString("/* superq"); ;
break;}
case 166:
{ WriteString("surface"); ;
break;}
case 167:
{ WriteString("resolution"); ;
break;}
case 168:
{ WriteString("translate"); ;
break;}
case 169:
{ WriteString("transform"); ;
break;}
case 170:
{ WriteString("triangle"); ;
break;}
case 171:
{ WriteString("up"); ;
break;}
case 172:
{ /* Don't do a thing. */ ;
break;}
case 173:
{ WriteString("texture"); ;
break;}
case 174:
{ WriteString("checker"); ;
break;}
case 175:
{ WriteString("wood"); ;
break;}
case 176:
{ WriteString("contrast"); ;
break;}
case 177:
{ WriteString("cutoff"); ;
break;}
}
/* the action file gets copied in in place of this dollarsign */
yyvsp -= yylen;
yyssp -= yylen;
#ifdef YYLSP_NEEDED
yylsp -= yylen;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
*++yyvsp = yyval;
#ifdef YYLSP_NEEDED
yylsp++;
if (yylen == 0)
{
yylsp->first_line = yylloc.first_line;
yylsp->first_column = yylloc.first_column;
yylsp->last_line = (yylsp-1)->last_line;
yylsp->last_column = (yylsp-1)->last_column;
yylsp->text = 0;
}
else
{
yylsp->last_line = (yylsp+yylen-1)->last_line;
yylsp->last_column = (yylsp+yylen-1)->last_column;
}
#endif
/* Now "shift" the result of the reduction.
Determine what state that goes to,
based on the state we popped back to
and the rule number reduced by. */
yyn = yyr1[yyn];
yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
yyerrlab: /* here on detecting error */
if (! yyerrstatus)
/* If not already recovering from an error, report this error. */
{
++yynerrs;
#ifdef YYERROR_VERBOSE
yyn = yypact[yystate];
if (yyn > YYFLAG && yyn < YYLAST)
{
int size = 0;
char *msg;
int x, count;
count = 0;
for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
size += strlen(yytname[x]) + 15, count++;
msg = (char *) xmalloc(size + 15);
strcpy(msg, "parse error");
if (count < 5)
{
count = 0;
for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
if (yycheck[x + yyn] == x)
{
strcat(msg, count == 0 ? ", expecting `" : " or `");
strcat(msg, yytname[x]);
strcat(msg, "'");
count++;
}
}
yyerror(msg);
free(msg);
}
else
#endif /* YYERROR_VERBOSE */
yyerror("parse error");
}
yyerrlab1: /* here on error raised explicitly by an action */
if (yyerrstatus == 3)
{
/* if just tried and failed to reuse lookahead token after an error, discard it. */
/* return failure if at end of input */
if (yychar == YYEOF)
YYABORT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
#endif
yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token
after shifting the error token. */
yyerrstatus = 3; /* Each real token shifted decrements this */
goto yyerrhandle;
yyerrdefault: /* current state does not do anything special for the error token. */
#if 0
/* This is wrong; only states that explicitly want error tokens
should shift them. */
yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
if (yyn) goto yydefault;
#endif
yyerrpop: /* pop the current state because it cannot handle the error token */
if (yyssp == yyss) YYABORT;
yyvsp--;
yystate = *--yyssp;
#ifdef YYLSP_NEEDED
yylsp--;
#endif
#if YYDEBUG != 0
if (yydebug)
{
short *ssp1 = yyss - 1;
fprintf (stderr, "Error: state stack now");
while (ssp1 != yyssp)
fprintf (stderr, " %d", *++ssp1);
fprintf (stderr, "\n");
}
#endif
yyerrhandle:
yyn = yypact[yystate];
if (yyn == YYFLAG)
goto yyerrdefault;
yyn += YYTERROR;
if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
goto yyerrdefault;
yyn = yytable[yyn];
if (yyn < 0)
{
if (yyn == YYFLAG)
goto yyerrpop;
yyn = -yyn;
goto yyreduce;
}
else if (yyn == 0)
goto yyerrpop;
if (yyn == YYFINAL)
YYACCEPT;
#if YYDEBUG != 0
if (yydebug)
fprintf(stderr, "Shifting error token, ");
#endif
*++yyvsp = yylval;
#ifdef YYLSP_NEEDED
*++yylsp = yylloc;
#endif
yystate = yyn;
goto yynewstate;
}
#define STARTBUFSIZ (1 << 18)
typedef struct db {
int bufsiz, curpos;
int type, x, y, z;
char *name;
struct db *next;
char *memory;
} DefBuf;
DefBuf *defbuf = NULL;
void yyerror(char *s)
{
fprintf(stderr,"rsconvert: %s, line %d: %s \n",
yyfilename[0] ? yyfilename : "stdin",
yylineno, s);
}
StartDefine(name)
char *name;
{
DefBuf *new;
/*
* Push new buffer onto define stack.
*/
new = (DefBuf *)RayMalloc(sizeof(DefBuf));
new->bufsiz = STARTBUFSIZ;
new->type = LIST;
new->curpos = 0;
new->name = name;
new->memory = (char *)Calloc(new->bufsiz, sizeof(char));
new->next = defbuf;
defbuf = new;
}
EndDefine()
{
char buf[BUFSIZ];
DefBuf *old;
old = defbuf;
defbuf = defbuf->next;
if (old->type == LIST) {
sprintf(buf, "name %s list", old->name);
} else {
sprintf(buf, "name %s grid %d %d %d", old->name,
old->x, old->y, old->z);
}
/*
* dump goodies
*/
WriteVerbatim(buf);
WriteVerbatim(old->memory);
WriteVerbatim("end");
free((voidstar)old->memory);
free((voidstar)old);
}
WriteString(str)
char *str;
{
WriteVerbatim(str);
WriteChar(' ');
}
WriteVerbatim(str)
char *str;
{
int n;
for (n = strlen(str); n; n--)
WriteChar(*(str++));
}
WriteChar(c)
char c;
{
if (defbuf) {
if (defbuf->curpos == defbuf->bufsiz -1) {
defbuf->bufsiz *= 2;
defbuf->memory = (char *)realloc(defbuf->memory,
defbuf->bufsiz * sizeof(char));
if (defbuf->memory == (char *)NULL) {
fprintf(stderr,"realloc failed!\n");
exit(-1);
}
}
defbuf->memory[defbuf->curpos++] = c;
defbuf->memory[defbuf->curpos] = (char)NULL;
} else
putchar(c);
}
WriteVector(v)
Vector *v;
{
WriteFloat(v->x);
WriteFloat(v->y);
WriteFloat(v->z);
}
WriteFloat(x)
Float x;
{
char buf[BUFSIZ];
sprintf(buf, "%g ", x);
WriteVerbatim(buf);
}
WriteNewline()
{
WriteVerbatim("\n");
}
SetTypeList()
{
if (defbuf)
defbuf->type = LIST;
/* else set world type */
}
SetTypeGrid(x,y,z)
int x, y, z;
{
if (defbuf) {
defbuf->type = GRID;
defbuf->x = x; defbuf->y = y; defbuf->z = z;
} /* else set world type */
}
WriteColor(c)
Color *c;
{
WriteFloat(c->r);
WriteFloat(c->g);
WriteFloat(c->b);
}