home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
gondwana.ecr.mu.oz.au/pub/
/
Graphics.tar
/
Graphics
/
atomart.tar.gz
/
atomart.tar
/
gram.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-06-21
|
24KB
|
991 lines
# line 6 "gram.y"
#include <stdio.h>
#include <math.h>
#include "atomart.h"
#include "macro.h"
extern object *sphereinit(),
*polygoninit();
extern light *lightinit();
extern tlist *tileinit();
extern tlist *textureinit();
extern attr *astackp;
extern object *oblist;
extern light *lights;
extern vector org, up;
extern matrix trans;
extern float focallength;
extern char *title;
extern int maxhitlevel, raysperpix;
extern long filetype;
extern colour backcol;
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
# line 39 "gram.y"
typedef union {
object *y_obj;
light *y_lht;
vector *y_pnt;
details *y_det;
char *y_str;
float y_flt;
int y_int;
} YYSTYPE;
# define STREE 257
# define SPHERE 258
# define POLYGON 259
# define COMPOSITE 260
# define FLOAT 261
# define INTEGER 262
# define FILETYPE 263
# define OPTION 264
# define STRING 265
# define NAME 266
# define LBRACE 267
# define RBRACE 268
# define LP 269
# define RP 270
# define RADIUS 271
# define RADII 272
# define COLOUR 273
# define CENTER 274
# define VERTEX 275
# define COMMA 276
# define PCENT 277
# define MATERIAL 278
# define REFI 279
# define MINUS 280
# define AMBIENT 281
# define LIGHT 282
# define INTENSITY 283
# define LOCATION 284
# define DOLS 285
# define EQUATION 286
# define TILE 287
# define OFFFILE 288
# define BASE 289
# define TOP 290
# define CONST 291
# define COEFFS 292
# define SCALE 293
# define ROTATE 294
# define TRANSLATE 295
# define TITLE 296
# define REFLECTANCE 297
# define DOT 298
# define ON 299
# define OFF 300
# define LOOKAT 301
# define FIELDOFVIEW 302
# define TRANSPARENCY 303
# define RAYSPERPIXEL 304
# define BACKGROUND 305
# define SIZE 306
# define MAXHITLEVEL 307
# define OUTPUT 308
# define ORDER 309
# define ABSORPTION 310
# define VREF1 311
# define VREF2 312
# define NUMRAYS 313
# define OBJECT 314
# define TEXTURE 315
# define DIRECTION 316
# define ANGLE 317
# define UP 318
# define TWENTYFIVEBIT 319
# define RANGE 320
# define MAP 321
# define BLENDCOLOR 322
# define SCALEFACTORS 323
# define VORTFILE 324
# define PLUS 325
# define MULT 326
# define DIV 327
# define COMBINE 328
# define POWER 329
# define UMINUS 330
# define EQUALS 331
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern short yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
YYSTYPE yylval, yyval;
# define YYERRCODE 256
short yyexca[] ={
-1, 1,
0, -1,
-2, 0,
};
# define YYNPROD 72
# define YYLAST 564
short yyact[]={
15, 83, 121, 122, 146, 50, 51, 72, 238, 20,
236, 54, 162, 224, 21, 42, 43, 22, 223, 113,
222, 173, 117, 19, 114, 221, 220, 240, 218, 28,
26, 27, 55, 23, 41, 116, 217, 211, 202, 24,
200, 199, 143, 198, 197, 193, 25, 16, 17, 192,
191, 18, 71, 73, 74, 190, 141, 140, 142, 144,
145, 15, 181, 180, 118, 137, 179, 120, 119, 167,
20, 166, 164, 38, 163, 21, 150, 149, 22, 148,
147, 134, 112, 111, 19, 110, 103, 102, 100, 99,
28, 26, 27, 86, 23, 85, 84, 78, 235, 234,
24, 233, 232, 143, 210, 209, 204, 25, 16, 17,
203, 201, 18, 15, 178, 160, 159, 141, 140, 142,
144, 145, 20, 155, 65, 64, 63, 21, 53, 52,
22, 29, 46, 45, 82, 81, 19, 70, 69, 68,
66, 168, 28, 26, 27, 6, 23, 151, 56, 91,
10, 7, 24, 8, 11, 49, 12, 13, 34, 25,
16, 17, 36, 37, 18, 92, 104, 9, 15, 42,
43, 2, 131, 1, 138, 127, 115, 20, 126, 128,
125, 90, 21, 4, 30, 22, 36, 37, 35, 5,
124, 19, 14, 31, 33, 3, 32, 28, 26, 27,
0, 23, 0, 0, 0, 0, 0, 24, 0, 0,
0, 36, 37, 0, 25, 16, 17, 15, 0, 18,
67, 130, 0, 0, 127, 0, 20, 126, 128, 0,
0, 21, 0, 0, 22, 93, 94, 0, 0, 0,
19, 0, 0, 0, 0, 0, 28, 26, 27, 105,
23, 129, 129, 129, 0, 0, 24, 0, 0, 0,
36, 37, 0, 25, 16, 17, 15, 0, 18, 0,
123, 0, 0, 127, 0, 20, 126, 128, 0, 0,
21, 0, 0, 22, 40, 139, 139, 0, 0, 19,
0, 0, 15, 0, 0, 28, 26, 27, 0, 23,
0, 20, 0, 0, 0, 24, 21, 0, 0, 22,
29, 0, 25, 16, 17, 19, 0, 18, 0, 0,
0, 28, 26, 27, 39, 23, 75, 0, 0, 0,
0, 24, 0, 44, 0, 0, 47, 48, 25, 16,
17, 0, 0, 18, 0, 57, 58, 59, 60, 61,
62, 0, 0, 0, 0, 0, 95, 96, 97, 98,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
76, 77, 0, 0, 0, 0, 0, 79, 80, 0,
0, 0, 0, 0, 0, 0, 0, 0, 87, 88,
89, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 101, 0, 0, 0, 0, 106, 107,
108, 109, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 132, 133, 0, 135, 136, 0,
0, 0, 0, 0, 0, 0, 152, 153, 0, 154,
0, 0, 156, 157, 158, 0, 0, 0, 0, 0,
0, 0, 161, 0, 0, 0, 0, 0, 0, 165,
0, 0, 0, 0, 0, 0, 169, 170, 171, 172,
0, 0, 174, 175, 176, 177, 0, 0, 0, 0,
182, 0, 0, 0, 183, 184, 0, 185, 186, 187,
0, 188, 189, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 194, 195, 196, 0, 0, 0,
0, 0, 0, 0, 0, 205, 206, 207, 208, 0,
0, 0, 212, 213, 214, 215, 0, 216, 0, 0,
0, 0, 0, 0, 0, 0, 219, 0, 0, 0,
0, 0, 225, 226, 0, 227, 228, 229, 230, 231,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 237, 0, 239 };
short yypact[]={
-1000,-1000,-151, 28,-1000, -72,-192,-246,-246,-136,
-137,-246,-246,-108,-1000,-294,-140,-141,-255,-118,
-246,-246,-246,-246,-246,-246,-143,-144,-145,-127,
-1000, -72,-1000, -72,-1000,-128,-129,-130,-1000,-1000,
-273, -92,-1000,-1000,-1000,-246,-246,-179,-1000,-1000,
-1000,-1000,-246,-246,-132,-133,-305,-180,-181,-183,
-1000,-1000,-1000,-246,-246,-246,-115, -72,-1000,-1000,
-1000, -92, -92, -92, -92,-1000,-187,-188,-246,-189,
-190,-1000,-1000,-246,-246,-246,-246,-191,-193,-194,
-249,-297, 2, -47, -96,-1000,-1000,-1000,-1000,-246,
-246,-195,-246,-246,-203,-264,-196,-197,-199,-200,
-119,-246,-246,-1000,-246,-1000,-146,-246,-246,-246,
-153,-1000,-1000,-1000,-1000,-1000,-154,-246,-257,-1000,
-1000,-1000,-202,-204,-246,-205,-207,-1000,-1000,-1000,
-125,-246,-246,-246,-246,-245,-1000,-246,-246,-246,
-246,-156,-210,-213,-214,-246,-1000,-1000,-1000,-246,
-246,-1000,-246,-246,-246,-1000,-246,-246,-1000,-1000,
-221,-226,-227,-1000,-1000,-1000,-231,-1000,-1000,-246,
-246,-246,-232,-233,-235,-236,-159,-238,-160,-164,
-246,-246,-246,-246,-165,-166,-239,-246,-246,-246,
-246,-1000,-246,-1000,-1000,-240,-1000,-248,-1000,-1000,
-1000,-246,-250,-251,-256,-258,-263,-246,-246,-1000,
-246,-246,-246,-246,-246,-1000,-1000,-168,-169,-171,
-172,-266,-1000,-1000,-1000,-1000,-246,-268,-246,-243,
-1000 };
short yypgo[]={
0, 192, 195, 324, 284, 158, 189, 165, 190, 180,
181, 176, 166, 174, 173, 171 };
short yyr1[]={
0, 14, 14, 14, 14, 15, 15, 15, 15, 15,
15, 15, 15, 15, 2, 2, 1, 10, 10, 10,
10, 10, 11, 11, 11, 11, 11, 6, 6, 6,
5, 5, 7, 7, 7, 8, 8, 8, 8, 9,
9, 9, 9, 9, 9, 9, 9, 9, 9, 9,
9, 9, 9, 9, 9, 12, 12, 12, 13, 13,
13, 13, 13, 13, 3, 3, 3, 3, 3, 3,
4, 4 };
short yyr2[]={
0, 4, 3, 3, 2, 0, 3, 3, 3, 9,
17, 7, 3, 3, 1, 2, 4, 0, 7, 2,
2, 2, 8, 2, 2, 2, 8, 0, 2, 5,
4, 4, 0, 2, 2, 8, 2, 8, 1, 2,
2, 8, 8, 5, 5, 6, 6, 8, 6, 2,
2, 2, 6, 8, 8, 0, 2, 2, 2, 2,
6, 4, 6, 2, 1, 3, 3, 3, 3, 2,
1, 1 };
short yychk[]={
-1000, -14, -15, -2, -9, -6, 296, 302, 304, 318,
301, 305, 307, 308, -1, 264, 311, 312, 315, 287,
273, 278, 281, 297, 303, 310, 294, 295, 293, 282,
-9, -6, -1, -6, -5, 260, 258, 259, 265, -3,
-4, 280, 261, 262, -3, 269, 269, -3, -3, 263,
299, 300, 269, 269, 266, 287, 266, -3, -3, -3,
-3, -3, -3, 269, 269, 269, 267, -6, 267, 267,
267, 325, 280, 326, 327, -4, -3, -3, 276, -3,
-3, 267, 267, 306, 276, 276, 276, -3, -3, -3,
-10, 264, -7, -7, -7, -4, -4, -4, -4, 276,
276, -3, 276, 276, -12, -12, -3, -3, -3, -3,
276, 276, 276, 268, 273, -11, 284, 271, 313, 317,
316, 299, 300, 268, -8, -9, 274, 271, 275, -5,
268, 268, -3, -3, 276, -3, -3, 268, -13, -9,
321, 320, 322, 306, 323, 324, 268, 276, 276, 276,
276, 266, -3, -3, -3, 269, -3, -3, -3, 269,
269, -3, 269, 276, 276, -3, 276, 276, 266, -3,
-3, -3, -3, 266, -3, -3, -3, -3, 270, 276,
276, 276, -3, -3, -3, -3, -3, -3, -3, -3,
276, 276, 276, 276, -3, -3, -3, 276, 276, 276,
276, 270, 276, 270, 270, -3, -3, -3, -3, 270,
270, 276, -3, -3, -3, -3, -3, 276, 276, -3,
276, 276, 276, 276, 276, -3, -3, -3, -3, -3,
-3, -3, 270, 270, 270, 270, 276, -3, 276, -3,
270 };
short yydef[]={
5, -2, 27, 27, 27, 4, 0, 0, 0, 0,
0, 0, 0, 0, 14, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
27, 3, 15, 2, 28, 0, 0, 0, 6, 7,
64, 0, 70, 71, 8, 0, 0, 0, 12, 13,
39, 40, 0, 0, 0, 0, 0, 0, 0, 0,
49, 50, 51, 0, 0, 0, 17, 1, 32, 32,
32, 0, 0, 0, 0, 69, 0, 0, 0, 0,
0, 55, 55, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 65, 66, 67, 68, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 16, 0, 21, 0, 0, 0, 0,
0, 19, 20, 29, 33, 34, 0, 0, 0, 38,
30, 31, 0, 0, 0, 0, 0, 43, 56, 57,
0, 0, 0, 0, 0, 0, 44, 0, 0, 0,
0, 0, 0, 0, 0, 0, 23, 24, 25, 0,
0, 36, 0, 0, 0, 11, 0, 0, 58, 59,
0, 0, 0, 63, 45, 46, 0, 48, 52, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 9, 0, 41, 42, 0, 61, 0, 47, 53,
54, 0, 0, 0, 0, 0, 0, 0, 0, 18,
0, 0, 0, 0, 0, 60, 62, 0, 0, 0,
0, 0, 22, 26, 35, 37, 0, 0, 0, 0,
10 };
#ifndef lint
static char yaccpar_sccsid[] = "@(#)yaccpar 1.6 88/02/08 SMI"; /* from UCB 4.1 83/02/11 */
#endif
#
# define YYFLAG -1000
# define YYERROR goto yyerrlab
# define YYACCEPT return(0)
# define YYABORT return(1)
/* parser for yacc output */
#ifdef YYDEBUG
int yydebug = 0; /* 1 for debugging */
#endif
YYSTYPE yyv[YYMAXDEPTH]; /* where the values are stored */
int yychar = -1; /* current input token number */
int yynerrs = 0; /* number of errors */
short yyerrflag = 0; /* error recovery flag */
yyparse() {
short yys[YYMAXDEPTH];
short yyj, yym;
register YYSTYPE *yypvt;
register short yystate, *yyps, yyn;
register YYSTYPE *yypv;
register short *yyxi;
yystate = 0;
yychar = -1;
yynerrs = 0;
yyerrflag = 0;
yyps= &yys[-1];
yypv= &yyv[-1];
yystack: /* put a state and value onto the stack */
#ifdef YYDEBUG
if( yydebug ) printf( "state %d, char 0%o\n", yystate, yychar );
#endif
if( ++yyps>= &yys[YYMAXDEPTH] ) { yyerror( "yacc stack overflow" ); return(1); }
*yyps = yystate;
++yypv;
*yypv = yyval;
yynewstate:
yyn = yypact[yystate];
if( yyn<= YYFLAG ) goto yydefault; /* simple state */
if( yychar<0 ) if( (yychar=yylex())<0 ) yychar=0;
if( (yyn += yychar)<0 || yyn >= YYLAST ) goto yydefault;
if( yychk[ yyn=yyact[ yyn ] ] == yychar ){ /* valid shift */
yychar = -1;
yyval = yylval;
yystate = yyn;
if( yyerrflag > 0 ) --yyerrflag;
goto yystack;
}
yydefault:
/* default state action */
if( (yyn=yydef[yystate]) == -2 ) {
if( yychar<0 ) if( (yychar=yylex())<0 ) yychar = 0;
/* look through exception table */
for( yyxi=yyexca; (*yyxi!= (-1)) || (yyxi[1]!=yystate) ; yyxi += 2 ) ; /* VOID */
while( *(yyxi+=2) >= 0 ){
if( *yyxi == yychar ) break;
}
if( (yyn = yyxi[1]) < 0 ) return(0); /* accept */
}
if( yyn == 0 ){ /* error */
/* error ... attempt to resume parsing */
switch( yyerrflag ){
case 0: /* brand new error */
yyerror( "syntax error" );
yyerrlab:
++yynerrs;
case 1:
case 2: /* incompletely recovered error ... try again */
yyerrflag = 3;
/* find a state where "error" is a legal shift action */
while ( yyps >= yys ) {
yyn = yypact[*yyps] + YYERRCODE;
if( yyn>= 0 && yyn < YYLAST && yychk[yyact[yyn]] == YYERRCODE ){
yystate = yyact[yyn]; /* simulate a shift of "error" */
goto yystack;
}
yyn = yypact[*yyps];
/* the current yyps has no shift onn "error", pop stack */
#ifdef YYDEBUG
if( yydebug ) printf( "error recovery pops state %d, uncovers %d\n", *yyps, yyps[-1] );
#endif
--yyps;
--yypv;
}
/* there is no state on the stack with an error shift ... abort */
yyabort:
return(1);
case 3: /* no shift yet; clobber input char */
#ifdef YYDEBUG
if( yydebug ) printf( "error recovery discards char %d\n", yychar );
#endif
if( yychar == 0 ) goto yyabort; /* don't discard EOF, quit */
yychar = -1;
goto yynewstate; /* try again in the same state */
}
}
/* reduction by production yyn */
#ifdef YYDEBUG
if( yydebug ) printf("reduce %d\n",yyn);
#endif
yyps -= yyr2[yyn];
yypvt = yypv;
yypv -= yyr2[yyn];
yyval = yypv[1];
yym=yyn;
/* consult goto table to find next state */
yyn = yyr1[yyn];
yyj = yypgo[yyn] + *yyps + 1;
if( yyj>=YYLAST || yychk[ yystate = yyact[yyj] ] != -yyn ) yystate = yyact[yypgo[yyn]];
switch(yym){
case 6:
# line 89 "gram.y"
{
title = yypvt[-0].y_str;
} break;
case 7:
# line 93 "gram.y"
{
if (yypvt[-0].y_flt == 0.0 || yypvt[-0].y_flt == 360.0)
fatal("art: idiotic angle in field of view.\n");
focallength = -1.0 / tan(M_PI / 360.0 * yypvt[-0].y_flt);
} break;
case 8:
# line 100 "gram.y"
{
raysperpix = yypvt[-0].y_flt;
} break;
case 9:
# line 104 "gram.y"
{
up.x = yypvt[-5].y_flt;
up.y = yypvt[-3].y_flt;
up.z = yypvt[-1].y_flt;
} break;
case 10:
# line 110 "gram.y"
{
vector t, u, s;
matrix m, tmp;
double vy, vz, sinval, cosval;
/*
* apply the twist
*/
sinval = sin(yypvt[-1].y_flt * M_PI / 180.0);
cosval = cos(yypvt[-1].y_flt * M_PI / 180.0);
mident4(m);
m[0][0] = cosval;
m[0][1] = -sinval;
m[1][0] = sinval;
m[1][1] = cosval;
mcpy4(tmp, trans);
mmult4(trans, tmp, m);
/*
* calculate the lookat
*/
t.x = yypvt[-13].y_flt - yypvt[-7].y_flt;
t.y = yypvt[-11].y_flt - yypvt[-5].y_flt;
t.z = yypvt[-9].y_flt - yypvt[-3].y_flt;
u.x = up.x;
u.y = up.y;
u.z = up.z;
normalise(t);
normalise(u);
vz = dprod(t, u);
if (fabs(vz) >= 1.0)
fatal("atomart: up vector and direction of view are the same.\n");
vy = sqrt(1.0 - vz * vz);
u.x = (u.x - vz * t.x) / vy;
u.y = (u.y - vz * t.y) / vy;
u.z = (u.z - vz * t.z) / vy;
xprod(s, u, t);
mident4(m);
m[0][0] = s.x;
m[0][1] = s.y;
m[0][2] = s.z;
m[1][0] = u.x;
m[1][1] = u.y;
m[1][2] = u.z;
m[2][0] = t.x;
m[2][1] = t.y;
m[2][2] = t.z;
mcpy4(tmp, trans);
mmult4(trans, tmp, m);
mident4(m);
m[3][0] = yypvt[-13].y_flt;
m[3][1] = yypvt[-11].y_flt;
m[3][2] = yypvt[-9].y_flt;
mcpy4(tmp, trans);
mmult4(trans, tmp, m);
astackp->mcopy = TRUE;
} break;
case 11:
# line 183 "gram.y"
{
backcol.r = yypvt[-4].y_flt;
backcol.g = yypvt[-2].y_flt;
backcol.b = yypvt[-0].y_flt;
} break;
case 12:
# line 189 "gram.y"
{
maxhitlevel = yypvt[-0].y_flt;
} break;
case 13:
# line 193 "gram.y"
{
filetype = yypvt[-0].y_int;
} break;
case 14:
# line 199 "gram.y"
{
lights = yypvt[-0].y_lht;
lights->nxt = (light *)NULL;
} break;
case 15:
# line 204 "gram.y"
{
yypvt[-0].y_lht->nxt = lights;
lights = yypvt[-0].y_lht;
} break;
case 16:
# line 211 "gram.y"
{
yyval.y_lht = lightinit(yypvt[-1].y_det);
astackp--;
} break;
case 17:
# line 218 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 18:
# line 222 "gram.y"
{
astackp->s.c.r = yypvt[-4].y_flt;
astackp->s.c.g = yypvt[-2].y_flt;
astackp->s.c.b = yypvt[-0].y_flt;
yyval.y_det = yypvt[-6].y_det;
} break;
case 19:
# line 229 "gram.y"
{
astackp->options |= yypvt[-1].y_int;
} break;
case 20:
# line 233 "gram.y"
{
astackp->options &= ~yypvt[-1].y_int;
} break;
case 21:
# line 237 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 22:
# line 244 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = CENTER;
yyval.y_det->u.v.x = yypvt[-5].y_flt;
yyval.y_det->u.v.y = yypvt[-3].y_flt;
yyval.y_det->u.v.z = yypvt[-1].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 23:
# line 253 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = RADIUS;
yyval.y_det->u.f = yypvt[-0].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 24:
# line 260 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = NUMRAYS;
yyval.y_det->u.f = yypvt[-0].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 25:
# line 267 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = ANGLE;
yyval.y_det->u.f = yypvt[-0].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 26:
# line 274 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = DIRECTION;
yyval.y_det->u.v.x = yypvt[-5].y_flt;
yyval.y_det->u.v.y = yypvt[-3].y_flt;
yyval.y_det->u.v.z = yypvt[-1].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 27:
# line 286 "gram.y"
{
oblist = (object *)NULL;
} break;
case 28:
# line 290 "gram.y"
{
yypvt[-0].y_obj->nxt = oblist;
oblist = yypvt[-0].y_obj;
} break;
case 29:
# line 295 "gram.y"
{
details *d, *nxtd;
for (d = yypvt[-1].y_det; d != (details *)NULL; d = nxtd) {
nxtd = d->nxt;
if (d->type == OBJECT) {
d->u.obj->nxt = oblist;
oblist = d->u.obj;
}
free(d);
}
} break;
case 30:
# line 310 "gram.y"
{
yyval.y_obj = sphereinit(yypvt[-1].y_det);
astackp--;
} break;
case 31:
# line 316 "gram.y"
{
yyval.y_obj = polygoninit(yypvt[-1].y_det);
astackp--;
} break;
case 32:
# line 323 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 33:
# line 327 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 34:
# line 332 "gram.y"
{
yyval.y_det = yypvt[-1].y_det;
} break;
case 35:
# line 338 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = CENTER;
yyval.y_det->u.v.x = yypvt[-5].y_flt;
yyval.y_det->u.v.y = yypvt[-3].y_flt;
yyval.y_det->u.v.z = yypvt[-1].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 36:
# line 347 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = RADIUS;
yyval.y_det->u.f = yypvt[-0].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 37:
# line 354 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = VERTEX;
yyval.y_det->u.v.x = yypvt[-5].y_flt;
yyval.y_det->u.v.y = yypvt[-3].y_flt;
yyval.y_det->u.v.z = yypvt[-1].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 38:
# line 363 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OBJECT;
yyval.y_det->u.obj = yypvt[-0].y_obj;
yyval.y_det->nxt = (details *)NULL;
} break;
case 39:
# line 372 "gram.y"
{
astackp->options |= yypvt[-1].y_int;
} break;
case 40:
# line 376 "gram.y"
{
astackp->options &= ~yypvt[-1].y_int;
} break;
case 41:
# line 380 "gram.y"
{
astackp->s.txtlist->txt.refset = TRUE;
astackp->s.txtlist->txt.vref1.x = yypvt[-5].y_flt;
astackp->s.txtlist->txt.vref1.y = yypvt[-3].y_flt;
astackp->s.txtlist->txt.vref1.z = yypvt[-1].y_flt;
normalise(astackp->s.txtlist->txt.vref1);
} break;
case 42:
# line 389 "gram.y"
{
astackp->s.txtlist->txt.vref2.x = yypvt[-5].y_flt;
astackp->s.txtlist->txt.vref2.y = yypvt[-3].y_flt;
astackp->s.txtlist->txt.vref2.z = yypvt[-1].y_flt;
normalise(astackp->s.txtlist->txt.vref2);
} break;
case 43:
# line 397 "gram.y"
{
tlist *tl;
tl = textureinit(yypvt[-3].y_str, yypvt[-1].y_det);
astackp--;
tl->nxt = astackp->s.txtlist;
astackp->s.txtlist = tl;
} break;
case 44:
# line 408 "gram.y"
{
tlist *tl;
tl = textureinit("tile", yypvt[-1].y_det);
astackp--;
tl->nxt = astackp->s.txtlist;
astackp->s.txtlist = tl;
} break;
case 45:
# line 419 "gram.y"
{
tlist *tl;
matrix tmp;
tl = (tlist *)smalloc(sizeof(tlist));
tl->txt.type = TILE;
tl->txtcol = (void (*)())NULL;
tl->txt.refset = FALSE;
tl->txt.scalew = 1.0;
tl->txt.scaleh = 1.0;
tileinit(&tl->txt, yypvt[-4].y_str, yypvt[-2].y_flt, yypvt[-0].y_flt);
mmult4(tmp, trans, astackp->m);
cp3x3(tl->txt.mat, tmp);
tl->txt.scales = astackp->scales;
tl->txt.trans.x = tmp[3][0];
tl->txt.trans.y = tmp[3][1];
tl->txt.trans.z = tmp[3][2];
tl->nxt = astackp->s.txtlist;
astackp->s.txtlist = tl;
} break;
case 46:
# line 445 "gram.y"
{
astackp->s.c.r = yypvt[-4].y_flt;
astackp->s.c.g = yypvt[-2].y_flt;
astackp->s.c.b = yypvt[-0].y_flt;
} break;
case 47:
# line 451 "gram.y"
{
astackp->s.ri = yypvt[-6].y_flt;
astackp->s.kd = yypvt[-4].y_flt;
astackp->s.ks = yypvt[-2].y_flt;
astackp->s.ksexp = yypvt[-0].y_flt;
} break;
case 48:
# line 458 "gram.y"
{
astackp->s.a.r = yypvt[-4].y_flt;
astackp->s.a.g = yypvt[-2].y_flt;
astackp->s.a.b = yypvt[-0].y_flt;
} break;
case 49:
# line 464 "gram.y"
{
astackp->s.refl = yypvt[-0].y_flt;
} break;
case 50:
# line 468 "gram.y"
{
astackp->s.trans = yypvt[-0].y_flt;
} break;
case 51:
# line 472 "gram.y"
{
astackp->s.absorb = yypvt[-0].y_flt;
} break;
case 52:
# line 476 "gram.y"
{
rotate(yypvt[-3].y_flt, *yypvt[-1].y_str);
} break;
case 53:
# line 480 "gram.y"
{
translate(yypvt[-5].y_flt, yypvt[-3].y_flt, yypvt[-1].y_flt);
} break;
case 54:
# line 484 "gram.y"
{
scale(yypvt[-5].y_flt, yypvt[-3].y_flt, yypvt[-1].y_flt);
} break;
case 55:
# line 490 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 56:
# line 494 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 57:
# line 499 "gram.y"
{
yyval.y_det = yypvt[-1].y_det;
} break;
case 58:
# line 505 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = MAP;
yyval.y_det->u.s = yypvt[-0].y_str;
yyval.y_det->nxt = (details *)NULL;
} break;
case 59:
# line 512 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = RANGE;
yyval.y_det->u.f = yypvt[-0].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 60:
# line 519 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = BLENDCOLOR;
yyval.y_det->u.v.x = yypvt[-4].y_flt;
yyval.y_det->u.v.y = yypvt[-2].y_flt;
yyval.y_det->u.v.z = yypvt[-0].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 61:
# line 528 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = SIZE;
yyval.y_det->u.v.x = yypvt[-2].y_flt;
yyval.y_det->u.v.y = yypvt[-0].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 62:
# line 536 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = SCALEFACTORS;
yyval.y_det->u.v.x = yypvt[-4].y_flt;
yyval.y_det->u.v.y = yypvt[-2].y_flt;
yyval.y_det->u.v.z = yypvt[-0].y_flt;
yyval.y_det->nxt = (details *)NULL;
} break;
case 63:
# line 545 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = VORTFILE;
yyval.y_det->u.s = yypvt[-0].y_str;
yyval.y_det->nxt = (details *)NULL;
} break;
case 64:
# line 554 "gram.y"
{
yyval.y_flt = yypvt[-0].y_flt;
} break;
case 65:
# line 558 "gram.y"
{
yyval.y_flt = yypvt[-2].y_flt + yypvt[-0].y_flt;
} break;
case 66:
# line 562 "gram.y"
{
yyval.y_flt = yypvt[-2].y_flt - yypvt[-0].y_flt;
} break;
case 67:
# line 566 "gram.y"
{
yyval.y_flt = yypvt[-2].y_flt * yypvt[-0].y_flt;
} break;
case 68:
# line 570 "gram.y"
{
yyval.y_flt = yypvt[-2].y_flt / yypvt[-0].y_flt;
} break;
case 69:
# line 574 "gram.y"
{
yyval.y_flt = -yypvt[-0].y_flt;
} break;
case 70:
# line 580 "gram.y"
{
yyval.y_flt = yypvt[-0].y_flt;
} break;
case 71:
# line 584 "gram.y"
{
yyval.y_flt = yypvt[-0].y_int;
} break;
}
goto yystack; /* stack new state and value */
}