home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OSK
/
GRAPHICS
/
rayshade.lzh
/
input_yacc.c
< prev
next >
Wrap
Text File
|
1990-09-29
|
45KB
|
1,405 lines
#ifndef lint
char yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90";
#endif
#include <stdio.h>
#include "constants.h"
#include "typedefs.h"
#include "funcdefs.h"
#include "texture.h"
#include "atmosphere.h"
char yyfilename[BUFSIZ];
int Npoints=0, CurXSize, CurYSize, CurZSize;
Object *LastObj = (Object *)0;
ObjList *CurObj, *ListTmp;
Surface *stmp;
Texture *CurText;
TransInfo *CurTrans = (TransInfo *)0, CurITrans;
PointList *Polypoints, *Point;
extern FILE *yyin;
extern Object *World;
extern int WorldXSize, WorldYSize, WorldZSize, nlight, Xres, Yres, maxlevel;
extern int yylineno, Jittered, JitSamples, pixel_div;
extern int ResolutionSet, ContrastSet, SamplesSet, CutoffSet;
extern int AdaptiveSet, JitteredSet;
extern double hfov, vfov, RedContrast, GreenContrast, BlueContrast;
extern double TreeCutoff, aperture, focaldist;
extern Vector eyep, lookp, up;
extern char outfilename[];
extern Color background;
extern SurfaceList *Surfaces;
extern Light light[];
extern Fog *GlobalFog;
extern Mist *GlobalMist;
typedef union {
char *c;
int i;
double d;
Vector v;
Color col;
struct Texture *text;
} YYSTYPE;
#define tINT 257
#define tFLOAT 258
#define tSTRING 259
#define tADAPTIVE 260
#define tAPERTURE 261
#define tBACKGROUND 262
#define tBLOTCH 263
#define tBOX 264
#define tBUMP 265
#define tCONE 266
#define tCYL 267
#define tDIRECTIONAL 268
#define tENDDEF 269
#define tEXTENDED 270
#define tEYEP 271
#define tFBM 272
#define tFBMBUMP 273
#define tFOCALDIST 274
#define tFOG 275
#define tFOV 276
#define tGLOSS 277
#define tGRID 278
#define tHEIGHTFIELD 279
#define tJITTERED 280
#define tLIGHT 281
#define tLIST 282
#define tLOOKP 283
#define tMARBLE 284
#define tMAXDEPTH 285
#define tMIST 286
#define tOBJECT 287
#define tOUTFILE 288
#define tPLANE 289
#define tPOINT 290
#define tPOLY 291
#define tROTATE 292
#define tSAMPLES 293
#define tSCALE 294
#define tSCREEN 295
#define tSPHERE 296
#define tSTARTDEF 297
#define tSUPERQ 298
#define tSURFACE 299
#define tRESOLUTION 300
#define tTHRESH 301
#define tTRANSLATE 302
#define tTRANSFORM 303
#define tTRIANGLE 304
#define tUP 305
#define tENDFILE 306
#define tTEXTURE 307
#define tCHECKER 308
#define tWOOD 309
#define tCONTRAST 310
#define tCUTOFF 311
#define YYERRCODE 256
short yylhs[] = { -1,
0, 0, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6, 26, 27, 22,
31, 33, 33, 33, 33, 33, 33, 33, 33, 33,
28, 44, 45, 46, 46, 47, 47, 47, 47, 47,
47, 32, 32, 48, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 23, 49, 34, 34, 50, 50,
50, 50, 50, 7, 8, 9, 10, 10, 15, 17,
18, 19, 16, 11, 11, 12, 13, 14, 20, 21,
21, 21, 51, 51, 24, 24, 43, 42, 52, 52,
53, 40, 39, 36, 37, 38, 38, 41, 35, 25,
30, 29, 4, 3, 1, 1, 2,
};
short yylen[] = { 2,
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, 4, 2,
2, 1, 1, 1, 1, 1, 1, 1, 1, 1,
2, 3, 2, 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, 1, 1, 1,
};
short yydefred[] = { 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 83, 0, 28, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 27, 0, 0, 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,
53, 68, 32, 33, 34, 35, 36, 37, 38, 39,
40, 53, 45, 53, 0, 80, 116, 115, 86, 0,
89, 0, 0, 0, 0, 68, 87, 0, 0, 0,
0, 0, 94, 75, 88, 0, 117, 68, 110, 0,
99, 79, 0, 0, 43, 0, 0, 0, 0, 76,
0, 82, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 112, 77, 0, 97,
0, 0, 0, 0, 84, 0, 0, 0, 85, 0,
0, 0, 52, 0, 0, 0, 0, 67, 42, 46,
48, 47, 49, 50, 51, 44, 91, 0, 90, 113,
0, 0, 0, 114, 29, 0, 109, 101, 100, 104,
0, 0, 0, 81, 0, 0, 0, 0, 0, 0,
0, 63, 68, 0, 0, 69, 0, 92, 0, 0,
103, 111, 0, 0, 0, 0, 57, 0, 0, 64,
59, 55, 0, 70, 0, 0, 0, 102, 0, 0,
0, 56, 0, 0, 71, 0, 0, 0, 0, 0,
0, 0, 0, 105, 0, 0, 107, 0, 0, 0,
108, 0, 0, 62, 0, 0, 0, 0, 96, 61,
0, 0, 0, 0, 73,
};
short yydgoto[] = { 1,
85, 98, 86, 81, 183, 36, 37, 38, 39, 40,
41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
61, 113, 62, 114, 63, 64, 65, 66, 67, 68,
69, 70, 71, 72, 73, 116, 156, 143, 74, 148,
75, 134, 169,
};
short yysindex[] = { 0,
789, -254, -227, -227, -252, -247, -231, -227, -227, -227,
-227, -222, -221, 0, -227, 0, -227, -216, -227, -217,
-217, -214, -213, -210, -209, -204, -217, -202, -217, -207,
-201, -227, 0, -227, -227, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, -264, 0, 0, 0, 0, -227,
0, -227, -227, -227, -227, 0, 0, -227, -227, -198,
-199, -227, 0, 0, 0, -227, 0, 0, 0, -227,
0, 0, -196, -227, 0, -227, -227, -195, -227, 0,
-227, 0, -242, -292, -242, -215, -242, -227, -227, -227,
-227, -227, -227, -227, -227, -292, 0, 0, -191, 0,
-227, -292, -227, -227, 0, -227, -227, -227, 0, -227,
-227, -240, 0, -227, -227, -227, -227, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, -227, 0, 0,
-227, -227, -227, 0, 0, -227, 0, 0, 0, 0,
-227, -227, -227, 0, -227, -227, -227, -227, -227, -217,
-217, 0, 0, -227, -227, 0, -227, 0, -227, -227,
0, 0, -227, -227, -227, -217, 0, -227, -227, 0,
0, 0, -292, 0, -227, -227, -227, 0, -227, -227,
-227, 0, -227, -227, 0, -227, -227, -227, -227, -227,
-227, -227, -227, 0, -227, -227, 0, -187, -186, -227,
0, -227, -227, 0, -227, -227, -184, -227, 0, 0,
-227, -227, -227, -227, 0,
};
short yyrindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 631, 0,
0, -234, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 420, 264, 472, 0, 527, 0, 0, 0,
0, 0, 0, 0, 0, 683, 0, 0, 0, 0,
0, 316, 0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 53,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 105, 0, 0, 0, 0, 0,
0, 0, 368, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 579, 0, 0, 0, 0, 157, 0, 0, 0,
0, 209, 0, 0, 0,
};
short yygindex[] = { 0,
5, -8, 908, 3, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, -73, -43, -39, 0, -38, -37, -36, 0, 0,
0, -45, 0, -81, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0,
};
#define YYTABLESIZE 1128
short yytable[] = { 144,
98, 145, 76, 118, 126, 119, 82, 79, 80, 146,
147, 83, 99, 87, 88, 89, 132, 93, 105, 92,
107, 96, 175, 80, 176, 120, 115, 84, 117, 77,
78, 177, 178, 93, 90, 93, 179, 91, 111, 112,
95, 97, 150, 180, 100, 101, 102, 103, 5, 108,
6, 7, 58, 149, 104, 93, 106, 109, 129, 130,
135, 139, 12, 13, 142, 165, 16, 181, 182, 233,
234, 20, 151, 22, 240, 23, 152, 153, 154, 155,
26, 27, 28, 29, 121, 0, 122, 0, 31, 125,
127, 0, 80, 128, 0, 0, 121, 0, 131, 0,
80, 203, 0, 0, 106, 0, 0, 0, 136, 138,
137, 80, 0, 0, 0, 141, 0, 0, 0, 0,
0, 0, 0, 0, 0, 160, 161, 0, 0, 164,
0, 0, 0, 0, 0, 166, 0, 0, 0, 0,
172, 171, 80, 0, 0, 174, 0, 0, 0, 185,
0, 187, 0, 0, 0, 0, 60, 0, 0, 0,
0, 0, 188, 0, 0, 189, 190, 191, 0, 0,
192, 201, 202, 0, 194, 193, 80, 0, 0, 196,
197, 198, 199, 200, 0, 0, 0, 212, 204, 205,
0, 206, 0, 207, 208, 0, 0, 209, 210, 0,
0, 0, 213, 214, 0, 0, 0, 0, 72, 215,
216, 217, 0, 218, 219, 0, 0, 221, 222, 0,
223, 224, 225, 226, 0, 228, 229, 230, 0, 231,
232, 0, 0, 0, 235, 0, 236, 237, 0, 238,
239, 0, 241, 0, 0, 242, 243, 244, 245, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
98, 98, 98, 31, 98, 0, 98, 98, 0, 98,
0, 98, 0, 0, 98, 98, 98, 0, 98, 98,
98, 98, 98, 98, 0, 98, 98, 98, 98, 98,
0, 98, 98, 98, 98, 98, 98, 98, 98, 98,
98, 0, 98, 98, 98, 98, 98, 98, 0, 0,
98, 98, 58, 58, 58, 66, 58, 0, 58, 58,
0, 58, 0, 58, 0, 0, 58, 58, 58, 0,
58, 58, 58, 58, 58, 58, 0, 58, 58, 58,
58, 58, 0, 58, 58, 58, 58, 58, 58, 58,
58, 58, 58, 0, 58, 58, 58, 58, 58, 58,
0, 0, 58, 58, 106, 106, 106, 54, 106, 0,
106, 106, 0, 106, 0, 106, 0, 0, 106, 106,
106, 0, 106, 106, 106, 106, 106, 106, 0, 106,
106, 106, 106, 106, 0, 106, 106, 106, 106, 106,
106, 106, 106, 106, 106, 0, 106, 106, 106, 106,
106, 106, 0, 0, 106, 106, 60, 60, 60, 30,
60, 0, 60, 60, 0, 60, 0, 60, 0, 0,
60, 60, 60, 0, 60, 60, 60, 60, 60, 60,
0, 60, 60, 60, 60, 60, 0, 60, 60, 60,
60, 60, 60, 60, 60, 60, 60, 0, 60, 60,
60, 60, 60, 60, 0, 0, 60, 60, 72, 72,
72, 41, 72, 0, 72, 72, 0, 72, 0, 72,
0, 0, 72, 72, 72, 0, 72, 72, 72, 72,
72, 72, 0, 72, 72, 72, 72, 72, 0, 72,
72, 72, 72, 72, 72, 72, 72, 72, 72, 0,
72, 72, 72, 72, 72, 72, 0, 0, 72, 72,
0, 0, 0, 31, 31, 31, 65, 31, 0, 31,
31, 0, 31, 0, 31, 0, 0, 31, 31, 31,
0, 31, 31, 31, 31, 31, 31, 0, 31, 31,
31, 31, 31, 0, 31, 0, 31, 0, 31, 31,
31, 31, 31, 31, 0, 0, 0, 31, 31, 31,
31, 0, 0, 31, 31, 66, 66, 66, 95, 66,
0, 66, 66, 0, 66, 0, 66, 0, 0, 66,
66, 66, 0, 66, 66, 66, 66, 66, 66, 0,
66, 66, 66, 66, 66, 0, 66, 0, 66, 0,
66, 66, 66, 66, 66, 66, 0, 0, 0, 66,
66, 66, 66, 0, 0, 66, 66, 54, 54, 54,
78, 54, 0, 54, 54, 0, 54, 0, 54, 0,
0, 54, 54, 54, 0, 54, 54, 54, 54, 54,
54, 0, 54, 54, 54, 54, 54, 0, 54, 0,
54, 0, 54, 54, 54, 54, 54, 54, 0, 0,
0, 54, 54, 54, 54, 0, 0, 54, 54, 30,
30, 30, 74, 30, 0, 30, 30, 0, 30, 0,
30, 0, 0, 30, 30, 30, 0, 30, 30, 30,
30, 30, 30, 0, 30, 30, 30, 30, 30, 0,
30, 0, 30, 0, 30, 30, 30, 30, 30, 30,
0, 0, 0, 30, 30, 30, 0, 0, 0, 30,
30, 41, 41, 41, 0, 41, 0, 41, 41, 0,
41, 0, 41, 0, 0, 41, 41, 41, 0, 41,
41, 41, 41, 41, 41, 0, 41, 41, 41, 41,
41, 0, 41, 0, 41, 0, 41, 41, 41, 41,
41, 41, 0, 0, 0, 41, 41, 41, 0, 0,
0, 41, 41, 0, 0, 0, 65, 65, 65, 0,
65, 0, 65, 65, 0, 65, 0, 65, 0, 0,
65, 65, 65, 0, 65, 65, 65, 65, 65, 65,
0, 65, 65, 65, 65, 65, 0, 65, 0, 65,
0, 65, 65, 65, 65, 65, 65, 0, 0, 0,
65, 65, 65, 0, 0, 0, 65, 65, 95, 95,
95, 0, 95, 0, 95, 95, 0, 95, 0, 95,
0, 0, 95, 95, 95, 0, 95, 95, 95, 95,
95, 95, 0, 95, 95, 95, 95, 95, 0, 95,
0, 95, 0, 95, 95, 95, 95, 95, 95, 0,
0, 0, 95, 95, 95, 0, 0, 0, 95, 95,
78, 78, 78, 0, 78, 0, 78, 78, 0, 0,
0, 78, 0, 0, 78, 78, 78, 0, 78, 78,
78, 78, 78, 78, 0, 78, 78, 78, 78, 78,
0, 78, 0, 78, 94, 78, 78, 78, 78, 78,
78, 0, 0, 0, 78, 78, 78, 0, 0, 110,
78, 78, 74, 74, 74, 0, 74, 0, 74, 74,
0, 0, 0, 74, 0, 0, 74, 74, 74, 0,
74, 74, 74, 74, 74, 74, 0, 74, 74, 74,
74, 74, 0, 74, 0, 74, 0, 74, 74, 74,
74, 74, 74, 0, 0, 0, 74, 74, 74, 0,
123, 124, 74, 74, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 133, 0, 0,
0, 0, 0, 0, 0, 0, 140, 0, 0, 0,
0, 0, 0, 0, 0, 157, 158, 159, 0, 0,
162, 163, 0, 0, 0, 0, 0, 0, 0, 0,
167, 168, 0, 170, 0, 0, 0, 173, 2, 3,
4, 184, 5, 186, 6, 7, 0, 0, 0, 8,
0, 0, 9, 10, 11, 0, 12, 13, 14, 15,
16, 17, 0, 18, 19, 20, 21, 22, 0, 23,
195, 24, 0, 25, 26, 27, 28, 29, 30, 0,
0, 0, 31, 32, 33, 0, 0, 0, 34, 35,
0, 0, 211, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 220, 0,
0, 0, 0, 0, 0, 0, 0, 227,
};
short yycheck[] = { 292,
0, 294, 257, 268, 86, 270, 259, 3, 4, 302,
303, 259, 21, 9, 10, 11, 98, 15, 27, 15,
29, 19, 263, 19, 265, 290, 72, 259, 74, 257,
258, 272, 273, 268, 257, 270, 277, 259, 34, 35,
257, 259, 116, 284, 259, 259, 257, 257, 264, 257,
266, 267, 0, 269, 259, 290, 259, 259, 257, 259,
257, 257, 278, 279, 307, 257, 282, 308, 309, 257,
257, 287, 116, 289, 259, 291, 116, 116, 116, 116,
296, 297, 298, 299, 80, -1, 82, -1, 304, 85,
88, -1, 88, 89, -1, -1, 92, -1, 96, -1,
96, 183, -1, -1, 0, -1, -1, -1, 104, 107,
106, 107, -1, -1, -1, 111, -1, -1, -1, -1,
-1, -1, -1, -1, -1, 121, 122, -1, -1, 125,
-1, -1, -1, -1, -1, 131, -1, -1, -1, -1,
138, 137, 138, -1, -1, 141, -1, -1, -1, 145,
-1, 147, -1, -1, -1, -1, 0, -1, -1, -1,
-1, -1, 158, -1, -1, 161, 162, 163, -1, -1,
166, 180, 181, -1, 172, 171, 172, -1, -1, 175,
176, 177, 178, 179, -1, -1, -1, 196, 184, 185,
-1, 187, -1, 189, 190, -1, -1, 193, 194, -1,
-1, -1, 198, 199, -1, -1, -1, -1, 0, 205,
206, 207, -1, 209, 210, -1, -1, 213, 214, -1,
216, 217, 218, 219, -1, 221, 222, 223, -1, 225,
226, -1, -1, -1, 230, -1, 232, 233, -1, 235,
236, -1, 238, -1, -1, 241, 242, 243, 244, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
260, 261, 262, 0, 264, -1, 266, 267, -1, 269,
-1, 271, -1, -1, 274, 275, 276, -1, 278, 279,
280, 281, 282, 283, -1, 285, 286, 287, 288, 289,
-1, 291, 292, 293, 294, 295, 296, 297, 298, 299,
300, -1, 302, 303, 304, 305, 306, 307, -1, -1,
310, 311, 260, 261, 262, 0, 264, -1, 266, 267,
-1, 269, -1, 271, -1, -1, 274, 275, 276, -1,
278, 279, 280, 281, 282, 283, -1, 285, 286, 287,
288, 289, -1, 291, 292, 293, 294, 295, 296, 297,
298, 299, 300, -1, 302, 303, 304, 305, 306, 307,
-1, -1, 310, 311, 260, 261, 262, 0, 264, -1,
266, 267, -1, 269, -1, 271, -1, -1, 274, 275,
276, -1, 278, 279, 280, 281, 282, 283, -1, 285,
286, 287, 288, 289, -1, 291, 292, 293, 294, 295,
296, 297, 298, 299, 300, -1, 302, 303, 304, 305,
306, 307, -1, -1, 310, 311, 260, 261, 262, 0,
264, -1, 266, 267, -1, 269, -1, 271, -1, -1,
274, 275, 276, -1, 278, 279, 280, 281, 282, 283,
-1, 285, 286, 287, 288, 289, -1, 291, 292, 293,
294, 295, 296, 297, 298, 299, 300, -1, 302, 303,
304, 305, 306, 307, -1, -1, 310, 311, 260, 261,
262, 0, 264, -1, 266, 267, -1, 269, -1, 271,
-1, -1, 274, 275, 276, -1, 278, 279, 280, 281,
282, 283, -1, 285, 286, 287, 288, 289, -1, 291,
292, 293, 294, 295, 296, 297, 298, 299, 300, -1,
302, 303, 304, 305, 306, 307, -1, -1, 310, 311,
-1, -1, -1, 260, 261, 262, 0, 264, -1, 266,
267, -1, 269, -1, 271, -1, -1, 274, 275, 276,
-1, 278, 279, 280, 281, 282, 283, -1, 285, 286,
287, 288, 289, -1, 291, -1, 293, -1, 295, 296,
297, 298, 299, 300, -1, -1, -1, 304, 305, 306,
307, -1, -1, 310, 311, 260, 261, 262, 0, 264,
-1, 266, 267, -1, 269, -1, 271, -1, -1, 274,
275, 276, -1, 278, 279, 280, 281, 282, 283, -1,
285, 286, 287, 288, 289, -1, 291, -1, 293, -1,
295, 296, 297, 298, 299, 300, -1, -1, -1, 304,
305, 306, 307, -1, -1, 310, 311, 260, 261, 262,
0, 264, -1, 266, 267, -1, 269, -1, 271, -1,
-1, 274, 275, 276, -1, 278, 279, 280, 281, 282,
283, -1, 285, 286, 287, 288, 289, -1, 291, -1,
293, -1, 295, 296, 297, 298, 299, 300, -1, -1,
-1, 304, 305, 306, 307, -1, -1, 310, 311, 260,
261, 262, 0, 264, -1, 266, 267, -1, 269, -1,
271, -1, -1, 274, 275, 276, -1, 278, 279, 280,
281, 282, 283, -1, 285, 286, 287, 288, 289, -1,
291, -1, 293, -1, 295, 296, 297, 298, 299, 300,
-1, -1, -1, 304, 305, 306, -1, -1, -1, 310,
311, 260, 261, 262, -1, 264, -1, 266, 267, -1,
269, -1, 271, -1, -1, 274, 275, 276, -1, 278,
279, 280, 281, 282, 283, -1, 285, 286, 287, 288,
289, -1, 291, -1, 293, -1, 295, 296, 297, 298,
299, 300, -1, -1, -1, 304, 305, 306, -1, -1,
-1, 310, 311, -1, -1, -1, 260, 261, 262, -1,
264, -1, 266, 267, -1, 269, -1, 271, -1, -1,
274, 275, 276, -1, 278, 279, 280, 281, 282, 283,
-1, 285, 286, 287, 288, 289, -1, 291, -1, 293,
-1, 295, 296, 297, 298, 299, 300, -1, -1, -1,
304, 305, 306, -1, -1, -1, 310, 311, 260, 261,
262, -1, 264, -1, 266, 267, -1, 269, -1, 271,
-1, -1, 274, 275, 276, -1, 278, 279, 280, 281,
282, 283, -1, 285, 286, 287, 288, 289, -1, 291,
-1, 293, -1, 295, 296, 297, 298, 299, 300, -1,
-1, -1, 304, 305, 306, -1, -1, -1, 310, 311,
260, 261, 262, -1, 264, -1, 266, 267, -1, -1,
-1, 271, -1, -1, 274, 275, 276, -1, 278, 279,
280, 281, 282, 283, -1, 285, 286, 287, 288, 289,
-1, 291, -1, 293, 17, 295, 296, 297, 298, 299,
300, -1, -1, -1, 304, 305, 306, -1, -1, 32,
310, 311, 260, 261, 262, -1, 264, -1, 266, 267,
-1, -1, -1, 271, -1, -1, 274, 275, 276, -1,
278, 279, 280, 281, 282, 283, -1, 285, 286, 287,
288, 289, -1, 291, -1, 293, -1, 295, 296, 297,
298, 299, 300, -1, -1, -1, 304, 305, 306, -1,
83, 84, 310, 311, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, 100, -1, -1,
-1, -1, -1, -1, -1, -1, 109, -1, -1, -1,
-1, -1, -1, -1, -1, 118, 119, 120, -1, -1,
123, 124, -1, -1, -1, -1, -1, -1, -1, -1,
133, 134, -1, 136, -1, -1, -1, 140, 260, 261,
262, 144, 264, 146, 266, 267, -1, -1, -1, 271,
-1, -1, 274, 275, 276, -1, 278, 279, 280, 281,
282, 283, -1, 285, 286, 287, 288, 289, -1, 291,
173, 293, -1, 295, 296, 297, 298, 299, 300, -1,
-1, -1, 304, 305, 306, -1, -1, -1, 310, 311,
-1, -1, 195, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, 211, -1,
-1, -1, -1, -1, -1, -1, -1, 220,
};
#define YYFINAL 1
#ifndef YYDEBUG
#define YYDEBUG 0
#endif
#define YYMAXTOKEN 311
#if YYDEBUG
char *yyname[] = {
"end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"tINT","tFLOAT","tSTRING",
"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",
};
char *yyrule[] = {
"$accept : Items",
"Items :",
"Items : Items Item",
"Item : Eyep",
"Item : Lookp",
"Item : Up",
"Item : Fov",
"Item : Screen",
"Item : Aperture",
"Item : Focaldist",
"Item : Maxdepth",
"Item : Samples",
"Item : Jittered",
"Item : Adaptive",
"Item : Contrast",
"Item : Cutoff",
"Item : Background",
"Item : Light",
"Item : Primitive",
"Item : Child",
"Item : Surface",
"Item : Outfile",
"Item : List",
"Item : Grid",
"Item : Object",
"Item : Fog",
"Item : Mist",
"Item : tENDFILE",
"List : tLIST",
"Grid : tGRID tINT tINT tINT",
"Primitive : Prim Textures",
"Prim : Primtype Transforms",
"Primtype : Plane",
"Primtype : Sphere",
"Primtype : Box",
"Primtype : Triangle",
"Primtype : Cylinder",
"Primtype : Cone",
"Primtype : Superq",
"Primtype : Poly",
"Primtype : HeightField",
"Object : Objectdef Textures",
"Objectdef : Startdef Objdefs tENDDEF",
"Startdef : tSTARTDEF String",
"Objdefs : Objdefs Objdef",
"Objdefs :",
"Objdef : Primitive",
"Objdef : Surface",
"Objdef : Child",
"Objdef : List",
"Objdef : Grid",
"Objdef : Object",
"Textures : Textures Texture",
"Textures :",
"Texture : tTEXTURE Texturetype Transforms",
"Texturetype : tCHECKER String",
"Texturetype : tBLOTCH Fnumber String",
"Texturetype : tBUMP Fnumber",
"Texturetype : tMARBLE",
"Texturetype : tMARBLE String",
"Texturetype : tFBM Fnumber Fnumber Fnumber Fnumber tINT Fnumber",
"Texturetype : tFBM Fnumber Fnumber Fnumber Fnumber tINT Fnumber tSTRING",
"Texturetype : tFBMBUMP Fnumber Fnumber Fnumber Fnumber tINT",
"Texturetype : tWOOD",
"Texturetype : tGLOSS Fnumber",
"Child : Childdef Textures",
"Childdef : tOBJECT String Transforms",
"Transforms : Transforms Transform",
"Transforms :",
"Transform : tTRANSLATE Vector",
"Transform : tROTATE Vector Fnumber",
"Transform : tSCALE Fnumber Fnumber Fnumber",
"Transform : tTRANSFORM Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
"Transform : tTRANSFORM Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
"Eyep : tEYEP Vector Transforms",
"Lookp : tLOOKP Vector",
"Up : tUP Vector",
"Fov : tFOV Fnumber Fnumber",
"Fov : tFOV Fnumber",
"Samples : tSAMPLES tINT",
"Adaptive : tADAPTIVE tINT",
"Contrast : tCONTRAST Fnumber Fnumber Fnumber",
"Cutoff : tCUTOFF Fnumber",
"Jittered : tJITTERED",
"Screen : tSCREEN tINT tINT",
"Screen : tRESOLUTION tINT tINT",
"Aperture : tAPERTURE Fnumber",
"Focaldist : tFOCALDIST Fnumber",
"Maxdepth : tMAXDEPTH tINT",
"Background : tBACKGROUND Color",
"Light : Lightdef tPOINT Vector",
"Light : Lightdef tDIRECTIONAL Vector",
"Light : Lightdef tEXTENDED Vector Fnumber",
"Lightdef : tLIGHT Fnumber",
"Lightdef : tLIGHT Color",
"Surface : tSURFACE String Color Color Color Fnumber Fnumber Fnumber Fnumber",
"Surface : tSURFACE String Color Color Color Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
"HeightField : tHEIGHTFIELD tSTRING tSTRING",
"Poly : tPOLY tSTRING Polypoints",
"Polypoints :",
"Polypoints : Polypoints Polypoint",
"Polypoint : Vector",
"Cone : tCONE tSTRING Vector Vector Fnumber Fnumber",
"Cylinder : tCYL tSTRING Vector Vector Fnumber",
"Sphere : tSPHERE tSTRING Fnumber Vector",
"Box : tBOX tSTRING Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
"Triangle : tTRIANGLE tSTRING Vector Vector Vector",
"Triangle : tTRIANGLE tSTRING Vector Vector Vector Vector Vector Vector",
"Superq : tSUPERQ tSTRING Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
"Plane : tPLANE tSTRING Vector Vector",
"Outfile : tOUTFILE String",
"Mist : tMIST Color Color Fnumber Fnumber",
"Fog : tFOG Fnumber Color",
"Color : Fnumber Fnumber Fnumber",
"Vector : Fnumber Fnumber Fnumber",
"Fnumber : tFLOAT",
"Fnumber : tINT",
"String : tSTRING",
};
#endif
#define yyclearin (yychar=(-1))
#define yyerrok (yyerrflag=0)
#ifndef YYSTACKSIZE
#ifdef YYMAXDEPTH
#define YYSTACKSIZE YYMAXDEPTH
#else
#define YYSTACKSIZE 300
#endif
#endif
int yydebug;
int yynerrs;
int yyerrflag;
int yychar;
short *yyssp;
YYSTYPE *yyvsp;
YYSTYPE yyval;
YYSTYPE yylval;
#define yystacksize YYSTACKSIZE
short yyss[YYSTACKSIZE];
YYSTYPE yyvs[YYSTACKSIZE];
/*
* Issue error message containing filename and line number, and exit.
*/
/*VARARGS1*/
yyerror(s, pat1, pat2)
char *s, *pat1, *pat2;
{
RSmessage("Error", "%s, line %d: ", yyfilename, yylineno);
fprintf(stderr, s, pat1, pat2);
fprintf(stderr,"\n"); /* yacc doesn't use newlines on syntax errors */
exit(1);
}
/*
* Issue warning message containing filename and line number if not in
* Quiet mode.
*/
/*VARARGS1*/
yywarning(s, pat1, pat2)
char *s, *pat1, *pat2;
{
extern int Quiet;
if (!Quiet) {
RSmessage("Warning", "%s, line %d: ",yyfilename, yylineno);
fprintf(stderr, s, pat1, pat2);
}
}
#define YYABORT goto yyabort
#define YYACCEPT goto yyaccept
#define YYERROR goto yyerrlab
int
yyparse()
{
register int yym, yyn, yystate;
#if YYDEBUG
register char *yys;
extern char *getenv();
if (yys = getenv("YYDEBUG"))
{
yyn = *yys;
if (yyn >= '0' && yyn <= '9')
yydebug = yyn - '0';
}
#endif
yynerrs = 0;
yyerrflag = 0;
yychar = (-1);
yyssp = yyss;
yyvsp = yyvs;
*yyssp = yystate = 0;
yyloop:
if (yyn = yydefred[yystate]) goto yyreduce;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, reading %d (%s)\n", yystate,
yychar, yys);
}
#endif
}
if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, shifting to state %d\n",
yystate, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
yychar = (-1);
if (yyerrflag > 0) --yyerrflag;
goto yyloop;
}
if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
{
yyn = yytable[yyn];
goto yyreduce;
}
if (yyerrflag) goto yyinrecovery;
#ifdef lint
goto yynewerror;
#endif
yynewerror:
yyerror("syntax error");
#ifdef lint
goto yyerrlab;
#endif
yyerrlab:
++yynerrs;
yyinrecovery:
if (yyerrflag < 3)
{
yyerrflag = 3;
for (;;)
{
if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
{
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, error recovery shifting\
to state %d\n", *yyssp, yytable[yyn]);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate = yytable[yyn];
*++yyvsp = yylval;
goto yyloop;
}
else
{
#if YYDEBUG
if (yydebug)
printf("yydebug: error recovery discarding state %d\n",
*yyssp);
#endif
if (yyssp <= yyss) goto yyabort;
--yyssp;
--yyvsp;
}
}
}
else
{
if (yychar == 0) goto yyabort;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, error recovery discards token %d (%s)\n",
yystate, yychar, yys);
}
#endif
yychar = (-1);
goto yyloop;
}
yyreduce:
#if YYDEBUG
if (yydebug)
printf("yydebug: state %d, reducing by rule %d (%s)\n",
yystate, yyn, yyrule[yyn]);
#endif
yym = yylen[yyn];
yyval = yyvsp[1-yym];
switch (yyn)
{
case 28:
{
if (CurObj->data)
CurObj->data->type = LIST;
else
World->type = LIST;
}
break;
case 29:
{
if (CurObj->data) {
CurObj->data->type = GRID;
CurXSize = yyvsp[-2].i ;
CurYSize = yyvsp[-1].i ;
CurZSize = yyvsp[0].i ;
} else {
World->type = GRID;
WorldXSize = yyvsp[-2].i ;
WorldYSize = yyvsp[-1].i ;
WorldZSize = yyvsp[0].i ;
}
}
break;
case 30:
{
if (LastObj) {
/* User may have botched prim. def. */
LastObj->texture = CurText;
if (CurObj->data)
CurObj->data->prims++;
else
World->prims++;
}
CurText = (Texture *)0;
LastObj = (Object *)0;
}
break;
case 31:
{
if (LastObj != (Object *)0) {
/*
* Compute boundings box of primitive.
* if box's low X is > its high X,
* then the prim is unbounded.
*/
set_prim_bounds(LastObj);
/*
* Add primitive to current object
* list. When the obj. def. is complete
* make_list() will calculate the
* bounding box of the entire object.
*/
add_prim(LastObj, CurObj->data);
if (CurTrans) {
/*
* Compute the bounding box of the
* transformed object.
*/
transform_bounds(CurTrans,
LastObj->bounds);
invert_trans(&CurITrans, CurTrans);
LastObj->trans = new_trans(CurTrans,
&CurITrans);
free((char *)CurTrans);
CurTrans = (TransInfo *)0;
}
} else {
/*
* There was something wrong with the def.
*/
if (CurTrans) {
free((char *)CurTrans);
CurTrans = (TransInfo *)0;
}
}
}
break;
case 41:
{
CurObj->data->texture = CurText;
CurText = (Texture *)0;
ListTmp = CurObj->next;
free((char *)CurObj);
CurObj = ListTmp;
}
break;
case 42:
{
/*
* Object definition.
*/
LastObj = (Object *)NULL;
if (CurObj->data->data == (char *)0) {
yywarning("Null object \"%s\" defined.\n",
CurObj->data->name);
} else {
if (CurObj->data->type == GRID) {
list2grid(CurObj->data, CurXSize,
CurYSize, CurZSize);
} else {
/*
* Object is a list -- transform the
* linked list (ObjList) into a List.
*/
make_list(CurObj->data);
}
/*
* Add this new object to the list of
* defined objects.
*/
add_to_objects(CurObj->data);
}
}
break;
case 43:
{
/*
* Once we know the bounding box of this object
* (and the user hasn't specified that this object
* is stored in a List), then we enlist everything
* it contains.
* The new object's DATA field points to an ObjList
* until the definition complete, when the ObjList
* is then turned into either a Grid or a List.
*/
ListTmp = (ObjList *)Malloc(sizeof(ObjList));
ListTmp->data = new_object(yyvsp[0].c , LIST, (char *)NULL,
(Trans *)NULL);
ListTmp->next = CurObj;
CurObj = ListTmp;
}
break;
case 54:
{
/*
* Set transformation information.
*/
if (CurTrans) {
invert_trans(&CurITrans, CurTrans);
yyvsp[-1].text ->trans = new_trans(CurTrans,&CurITrans);
free((char *)CurTrans);
CurTrans = (TransInfo *)NULL;
}
/*
* Walk to the end of list of textures and
* append new texture. This is done so that
* textures are implied in the expected order.
*/
{
Texture *tp;
yyvsp[-1].text ->next = (Texture *)0;
if (CurText) {
for (tp=CurText;tp->next;tp=tp->next)
;
tp->next = yyvsp[-1].text ;
} else {
CurText = yyvsp[-1].text ;
}
}
}
break;
case 55:
{
yyval.text = NewCheckText(yyvsp[0].c );
}
break;
case 56:
{
yyval.text = NewBlotchText(yyvsp[-1].d , yyvsp[0].c );
}
break;
case 57:
{
yyval.text = NewBumpText(yyvsp[0].d );
}
break;
case 58:
{
yyval.text = NewMarbleText((char *)NULL);
}
break;
case 59:
{
yyval.text = NewMarbleText(yyvsp[0].c );
}
break;
case 60:
{
yyval.text = NewfBmText(yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].i , yyvsp[0].d , (char *)0);
}
break;
case 61:
{
yyval.text = NewfBmText(yyvsp[-6].d , yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].i , yyvsp[-1].d , yyvsp[0].c );
}
break;
case 62:
{
yyval.text = NewfBmBumpText(yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].i );
}
break;
case 63:
{
yyval.text = NewWoodText();
}
break;
case 64:
{
yyval.text = NewGlossText(yyvsp[0].d );
}
break;
case 65:
{
LastObj->texture = CurText;
CurText = (Texture *)0;
LastObj = (Object *)0;
}
break;
case 66:
{
LastObj = add_child_named(yyvsp[-1].c , CurObj->data);
if (CurTrans) {
transform_bounds(CurTrans, LastObj->bounds);
invert_trans(&CurITrans, CurTrans);
if (LastObj->trans) {
mmult(&LastObj->trans->obj2world,
CurTrans,
&LastObj->trans->obj2world);
mmult(&LastObj->trans->world2obj,
&CurITrans,
&LastObj->trans->world2obj);
} else
LastObj->trans = new_trans(CurTrans,
&CurITrans);
free((char *)CurTrans);
CurTrans = (TransInfo *)NULL;
}
}
break;
case 69:
{
if (CurTrans == (TransInfo *)0)
CurTrans = new_transinfo();
RS_translate(CurTrans, &(yyvsp[0].v ));
}
break;
case 70:
{
if (CurTrans == (TransInfo *)0)
CurTrans = new_transinfo();
RS_rotate(CurTrans, &(yyvsp[-1].v ), deg2rad(yyvsp[0].d ));
}
break;
case 71:
{
if (CurTrans == (TransInfo *)0)
CurTrans = new_transinfo();
RS_scale(CurTrans, yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d );
}
break;
case 72:
{
if (CurTrans == (TransInfo *)0)
CurTrans = new_transinfo();
explicit_trans(CurTrans,
yyvsp[-8].d , yyvsp[-7].d , yyvsp[-6].d , yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d ,
0., 0., 0., CurTrans);
}
break;
case 73:
{
if (CurTrans == (TransInfo *)0)
CurTrans = new_transinfo();
explicit_trans(CurTrans,
yyvsp[-11].d , yyvsp[-10].d , yyvsp[-9].d , yyvsp[-8].d , yyvsp[-7].d , yyvsp[-6].d , yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d ,
yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d ,CurTrans);
}
break;
case 74:
{
eyep = yyvsp[-1].v ;
if (CurTrans) {
transform_point(&eyep, CurTrans);
free((char *)CurTrans);
CurTrans = (TransInfo *)0;
}
}
break;
case 75:
{
lookp = yyvsp[0].v ;
}
break;
case 76:
{
up = yyvsp[0].v ;
}
break;
case 77:
{
hfov = yyvsp[-1].d ; vfov = yyvsp[0].d ;
}
break;
case 78:
{
hfov = yyvsp[0].d ;
}
break;
case 79:
{
if (!SamplesSet)
JitSamples = yyvsp[0].i ;
}
break;
case 80:
{
if (!AdaptiveSet && !JitteredSet)
pixel_div = yyvsp[0].i ;
}
break;
case 81:
{
if (!ContrastSet) {
RedContrast = yyvsp[-2].d ;
GreenContrast = yyvsp[-1].d ;
BlueContrast = yyvsp[0].d ;
}
}
break;
case 82:
{
if (!CutoffSet)
TreeCutoff = yyvsp[0].d ;
}
break;
case 83:
{
if (!AdaptiveSet)
Jittered = TRUE;
}
break;
case 84:
{
if (!ResolutionSet) {
Xres = yyvsp[-1].i ;
Yres = yyvsp[0].i ;
}
}
break;
case 85:
{
if (!ResolutionSet) {
Xres = yyvsp[-1].i ;
Yres = yyvsp[0].i ;
}
}
break;
case 86:
{
aperture = yyvsp[0].d ;
}
break;
case 87:
{
focaldist = yyvsp[0].d ;
}
break;
case 88:
{
maxlevel = yyvsp[0].i ;
}
break;
case 89:
{
background = yyvsp[0].col ;
}
break;
case 90:
{
light[nlight].pos = yyvsp[0].v ;
light[nlight].type = LOCAL;
nlight++;
}
break;
case 91:
{
(void)normalize(&(yyvsp[0].v ));
light[nlight].pos = yyvsp[0].v ;
light[nlight].type = DIRECTIONAL;
nlight++;
}
break;
case 92:
{
light[nlight].pos = yyvsp[-1].v ;
light[nlight].radius = yyvsp[0].d ;
light[nlight].type = EXTENDED;
nlight++;
}
break;
case 93:
{
if (nlight == LIGHTS)
yyerror("Too many lights.\n");
light[nlight].color.r = yyvsp[0].d ;
light[nlight].color.g = yyvsp[0].d ;
light[nlight].color.b = yyvsp[0].d ;
}
break;
case 94:
{
if (nlight == LIGHTS)
yyerror("Too many lights.\n");
light[nlight].color = yyvsp[0].col ;
}
break;
case 95:
{
/*
* surface name
* amb
* diff
* spec coef reflect refract krefract
*/
stmp = make_surface(yyvsp[-7].c , &(yyvsp[-6].col ), &(yyvsp[-5].col ), &(yyvsp[-4].col ), yyvsp[-3].d , yyvsp[-2].d ,
yyvsp[-1].d , yyvsp[0].d , 0., 0.);
Surfaces = add_surface(stmp, Surfaces);
}
break;
case 96:
{
/*
* surface name
* amb
* diff
* spec coef reflect refract krefract
*/
stmp = make_surface(yyvsp[-9].c , &(yyvsp[-8].col ), &(yyvsp[-7].col ), &(yyvsp[-6].col ), yyvsp[-5].d , yyvsp[-4].d ,
yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d );
Surfaces = add_surface(stmp, Surfaces);
}
break;
case 97:
{
LastObj = makhf(yyvsp[-1].c , yyvsp[0].c );
}
break;
case 98:
{
LastObj = makpoly(yyvsp[-1].c , Polypoints, Npoints);
Polypoints = (PointList *)0;
Npoints = 0;
}
break;
case 101:
{
Point = (PointList *)Malloc(sizeof(PointList));
Point->vec = yyvsp[0].v ;
Point->next = Polypoints;
Polypoints = Point;
Npoints++;
}
break;
case 102:
{
CurTrans = new_transinfo();
LastObj = makcone(yyvsp[-4].c , &(yyvsp[-3].v ), &(yyvsp[-2].v ), yyvsp[-1].d , yyvsp[0].d , CurTrans);
}
break;
case 103:
{
/*
* Cylinders automagically define a
* transformation matrix.
*/
CurTrans = new_transinfo();
LastObj = makcyl(yyvsp[-3].c , &(yyvsp[-2].v ), &(yyvsp[-1].v ), yyvsp[0].d , CurTrans);
}
break;
case 104:
{
LastObj = maksph(yyvsp[-2].c , yyvsp[-1].d , &(yyvsp[0].v ));
}
break;
case 105:
{
LastObj = makbox(yyvsp[-6].c , yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d );
}
break;
case 106:
{
LastObj = maktri(TRIANGLE, yyvsp[-3].c , &(yyvsp[-2].v ), &(yyvsp[-1].v ), &(yyvsp[0].v ),
(Vector *)0, (Vector *)0, (Vector *)0);
}
break;
case 107:
{
LastObj = maktri(PHONGTRI, yyvsp[-6].c , &(yyvsp[-5].v ), &(yyvsp[-3].v ),
&(yyvsp[-1].v ), &(yyvsp[-4].v ), &(yyvsp[-2].v ), &(yyvsp[0].v ));
}
break;
case 108:
{
LastObj = maksup(yyvsp[-7].c , yyvsp[-6].d , yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d );
}
break;
case 109:
{
LastObj = makplane(yyvsp[-2].c , &(yyvsp[-1].v ), &(yyvsp[0].v ));
}
break;
case 110:
{
if (*outfilename != (char)NULL)
yywarning("Ignoring output file name \"%s\".\n",
yyvsp[0].c );
else
strcpy(outfilename, yyvsp[0].c );
}
break;
case 111:
{
GlobalMist = (Mist *)Malloc(sizeof(Mist));
GlobalMist->color = yyvsp[-3].col ;
GlobalMist->trans = yyvsp[-2].col ;
GlobalMist->zero = yyvsp[-1].d ;
GlobalMist->scale = 1. / yyvsp[0].d ;
}
break;
case 112:
{
GlobalFog = (Fog *)Malloc(sizeof(Fog));
GlobalFog->trans = 1./yyvsp[-1].d ;
GlobalFog->color = yyvsp[0].col ;
}
break;
case 113:
{
yyval.col .r = yyvsp[-2].d ;
yyval.col .g = yyvsp[-1].d ;
yyval.col .b = yyvsp[0].d ;
}
break;
case 114:
{
yyval.v .x = yyvsp[-2].d ;
yyval.v .y = yyvsp[-1].d ;
yyval.v .z = yyvsp[0].d ;
}
break;
case 115:
{ yyval.d = yyvsp[0].d ;}
break;
case 116:
{ yyval.d = yyvsp[0].i ;}
break;
case 117:
{ yyval.c = yyvsp[0].c ;}
break;
}
yyssp -= yym;
yystate = *yyssp;
yyvsp -= yym;
yym = yylhs[yyn];
if (yystate == 0 && yym == 0)
{
#ifdef YYDEBUG
if (yydebug)
printf("yydebug: after reduction, shifting from state 0 to\
state %d\n", YYFINAL);
#endif
yystate = YYFINAL;
*++yyssp = YYFINAL;
*++yyvsp = yyval;
if (yychar < 0)
{
if ((yychar = yylex()) < 0) yychar = 0;
#if YYDEBUG
if (yydebug)
{
yys = 0;
if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
if (!yys) yys = "illegal-symbol";
printf("yydebug: state %d, reading %d (%s)\n",
YYFINAL, yychar, yys);
}
#endif
}
if (yychar == 0) goto yyaccept;
goto yyloop;
}
if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
yystate = yytable[yyn];
else
yystate = yydgoto[yym];
#ifdef YYDEBUG
if (yydebug)
printf("yydebug: after reduction, shifting from state %d \
to state %d\n", *yyssp, yystate);
#endif
if (yyssp >= yyss + yystacksize - 1)
{
goto yyoverflow;
}
*++yyssp = yystate;
*++yyvsp = yyval;
goto yyloop;
yyoverflow:
yyerror("yacc stack overflow");
yyabort:
return (1);
yyaccept:
return (0);
}