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 >
Text File  |  1990-09-29  |  45KB  |  1,405 lines

  1. #ifndef lint
  2. char yysccsid[] = "@(#)yaccpar    1.4 (Berkeley) 02/25/90";
  3. #endif
  4. #include <stdio.h>
  5. #include "constants.h"
  6. #include "typedefs.h"
  7. #include "funcdefs.h"
  8. #include "texture.h"
  9. #include "atmosphere.h"
  10.  
  11. char yyfilename[BUFSIZ];
  12. int Npoints=0, CurXSize, CurYSize, CurZSize;
  13. Object    *LastObj = (Object *)0;
  14. ObjList *CurObj, *ListTmp;
  15. Surface *stmp;
  16. Texture *CurText;
  17. TransInfo *CurTrans = (TransInfo *)0, CurITrans;
  18. PointList *Polypoints, *Point;
  19. extern FILE *yyin;
  20. extern Object *World;
  21. extern int WorldXSize, WorldYSize, WorldZSize, nlight, Xres, Yres, maxlevel;
  22. extern int yylineno, Jittered, JitSamples, pixel_div;
  23. extern int ResolutionSet, ContrastSet, SamplesSet, CutoffSet;
  24. extern int AdaptiveSet, JitteredSet;
  25. extern double hfov, vfov, RedContrast, GreenContrast, BlueContrast;
  26. extern double TreeCutoff, aperture, focaldist;
  27. extern Vector eyep, lookp, up;
  28. extern char outfilename[];
  29. extern Color background;
  30. extern SurfaceList *Surfaces;
  31. extern Light light[];
  32. extern Fog *GlobalFog;
  33. extern Mist *GlobalMist;
  34. typedef union {
  35.     char *c;
  36.     int i;
  37.     double d;
  38.     Vector v;
  39.     Color col;
  40.     struct Texture *text;
  41. } YYSTYPE;
  42. #define tINT 257
  43. #define tFLOAT 258
  44. #define tSTRING 259
  45. #define tADAPTIVE 260
  46. #define tAPERTURE 261
  47. #define tBACKGROUND 262
  48. #define tBLOTCH 263
  49. #define tBOX 264
  50. #define tBUMP 265
  51. #define tCONE 266
  52. #define tCYL 267
  53. #define tDIRECTIONAL 268
  54. #define tENDDEF 269
  55. #define tEXTENDED 270
  56. #define tEYEP 271
  57. #define tFBM 272
  58. #define tFBMBUMP 273
  59. #define tFOCALDIST 274
  60. #define tFOG 275
  61. #define tFOV 276
  62. #define tGLOSS 277
  63. #define tGRID 278
  64. #define tHEIGHTFIELD 279
  65. #define tJITTERED 280
  66. #define tLIGHT 281
  67. #define tLIST 282
  68. #define tLOOKP 283
  69. #define tMARBLE 284
  70. #define tMAXDEPTH 285
  71. #define tMIST 286
  72. #define tOBJECT 287
  73. #define tOUTFILE 288
  74. #define tPLANE 289
  75. #define tPOINT 290
  76. #define tPOLY 291
  77. #define tROTATE 292
  78. #define tSAMPLES 293
  79. #define tSCALE 294
  80. #define tSCREEN 295
  81. #define tSPHERE 296
  82. #define tSTARTDEF 297
  83. #define tSUPERQ 298
  84. #define tSURFACE 299
  85. #define tRESOLUTION 300
  86. #define tTHRESH 301
  87. #define tTRANSLATE 302
  88. #define tTRANSFORM 303
  89. #define tTRIANGLE 304
  90. #define tUP 305
  91. #define tENDFILE 306
  92. #define tTEXTURE 307
  93. #define tCHECKER 308
  94. #define tWOOD 309
  95. #define tCONTRAST 310
  96. #define tCUTOFF 311
  97. #define YYERRCODE 256
  98. short yylhs[] = {                                        -1,
  99.     0,    0,    6,    6,    6,    6,    6,    6,    6,    6,
  100.     6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
  101.     6,    6,    6,    6,    6,    6,    6,   26,   27,   22,
  102.    31,   33,   33,   33,   33,   33,   33,   33,   33,   33,
  103.    28,   44,   45,   46,   46,   47,   47,   47,   47,   47,
  104.    47,   32,   32,   48,    5,    5,    5,    5,    5,    5,
  105.     5,    5,    5,    5,   23,   49,   34,   34,   50,   50,
  106.    50,   50,   50,    7,    8,    9,   10,   10,   15,   17,
  107.    18,   19,   16,   11,   11,   12,   13,   14,   20,   21,
  108.    21,   21,   51,   51,   24,   24,   43,   42,   52,   52,
  109.    53,   40,   39,   36,   37,   38,   38,   41,   35,   25,
  110.    30,   29,    4,    3,    1,    1,    2,
  111. };
  112. short yylen[] = {                                         2,
  113.     0,    2,    1,    1,    1,    1,    1,    1,    1,    1,
  114.     1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  115.     1,    1,    1,    1,    1,    1,    1,    1,    4,    2,
  116.     2,    1,    1,    1,    1,    1,    1,    1,    1,    1,
  117.     2,    3,    2,    2,    0,    1,    1,    1,    1,    1,
  118.     1,    2,    0,    3,    2,    3,    2,    1,    2,    7,
  119.     8,    6,    1,    2,    2,    3,    2,    0,    2,    3,
  120.     4,   10,   13,    3,    2,    2,    3,    2,    2,    2,
  121.     4,    2,    1,    3,    3,    2,    2,    2,    2,    3,
  122.     3,    4,    2,    2,    9,   11,    3,    3,    0,    2,
  123.     1,    6,    5,    4,    8,    5,    8,    9,    4,    2,
  124.     5,    3,    3,    3,    1,    1,    1,
  125. };
  126. short yydefred[] = {                                      1,
  127.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  128.     0,    0,    0,   83,    0,   28,    0,    0,    0,    0,
  129.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  130.     0,    0,   27,    0,    0,    2,    3,    4,    5,    6,
  131.     7,    8,    9,   10,   11,   12,   13,   14,   15,   16,
  132.    17,   18,   19,   20,   21,   22,   23,   24,   25,   26,
  133.    53,   68,   32,   33,   34,   35,   36,   37,   38,   39,
  134.    40,   53,   45,   53,    0,   80,  116,  115,   86,    0,
  135.    89,    0,    0,    0,    0,   68,   87,    0,    0,    0,
  136.     0,    0,   94,   75,   88,    0,  117,   68,  110,    0,
  137.    99,   79,    0,    0,   43,    0,    0,    0,    0,   76,
  138.     0,   82,    0,    0,    0,    0,    0,    0,    0,    0,
  139.     0,    0,    0,    0,    0,    0,  112,   77,    0,   97,
  140.     0,    0,    0,    0,   84,    0,    0,    0,   85,    0,
  141.     0,    0,   52,    0,    0,    0,    0,   67,   42,   46,
  142.    48,   47,   49,   50,   51,   44,   91,    0,   90,  113,
  143.     0,    0,    0,  114,   29,    0,  109,  101,  100,  104,
  144.     0,    0,    0,   81,    0,    0,    0,    0,    0,    0,
  145.     0,   63,   68,    0,    0,   69,    0,   92,    0,    0,
  146.   103,  111,    0,    0,    0,    0,   57,    0,    0,   64,
  147.    59,   55,    0,   70,    0,    0,    0,  102,    0,    0,
  148.     0,   56,    0,    0,   71,    0,    0,    0,    0,    0,
  149.     0,    0,    0,  105,    0,    0,  107,    0,    0,    0,
  150.   108,    0,    0,   62,    0,    0,    0,    0,   96,   61,
  151.     0,    0,    0,    0,   73,
  152. };
  153. short yydgoto[] = {                                       1,
  154.    85,   98,   86,   81,  183,   36,   37,   38,   39,   40,
  155.    41,   42,   43,   44,   45,   46,   47,   48,   49,   50,
  156.    51,   52,   53,   54,   55,   56,   57,   58,   59,   60,
  157.    61,  113,   62,  114,   63,   64,   65,   66,   67,   68,
  158.    69,   70,   71,   72,   73,  116,  156,  143,   74,  148,
  159.    75,  134,  169,
  160. };
  161. short yysindex[] = {                                      0,
  162.   789, -254, -227, -227, -252, -247, -231, -227, -227, -227,
  163.  -227, -222, -221,    0, -227,    0, -227, -216, -227, -217,
  164.  -217, -214, -213, -210, -209, -204, -217, -202, -217, -207,
  165.  -201, -227,    0, -227, -227,    0,    0,    0,    0,    0,
  166.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  167.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  168.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  169.     0,    0,    0,    0, -264,    0,    0,    0,    0, -227,
  170.     0, -227, -227, -227, -227,    0,    0, -227, -227, -198,
  171.  -199, -227,    0,    0,    0, -227,    0,    0,    0, -227,
  172.     0,    0, -196, -227,    0, -227, -227, -195, -227,    0,
  173.  -227,    0, -242, -292, -242, -215, -242, -227, -227, -227,
  174.  -227, -227, -227, -227, -227, -292,    0,    0, -191,    0,
  175.  -227, -292, -227, -227,    0, -227, -227, -227,    0, -227,
  176.  -227, -240,    0, -227, -227, -227, -227,    0,    0,    0,
  177.     0,    0,    0,    0,    0,    0,    0, -227,    0,    0,
  178.  -227, -227, -227,    0,    0, -227,    0,    0,    0,    0,
  179.  -227, -227, -227,    0, -227, -227, -227, -227, -227, -217,
  180.  -217,    0,    0, -227, -227,    0, -227,    0, -227, -227,
  181.     0,    0, -227, -227, -227, -217,    0, -227, -227,    0,
  182.     0,    0, -292,    0, -227, -227, -227,    0, -227, -227,
  183.  -227,    0, -227, -227,    0, -227, -227, -227, -227, -227,
  184.  -227, -227, -227,    0, -227, -227,    0, -187, -186, -227,
  185.     0, -227, -227,    0, -227, -227, -184, -227,    0,    0,
  186.  -227, -227, -227, -227,    0,
  187. };
  188. short yyrindex[] = {                                      0,
  189.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  190.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  191.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  192.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  193.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  194.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  195.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  196.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  197.     0,    0,    0,    0,    0,    0,    0,    0,  631,    0,
  198.     0, -234,    0,    0,    0,    0,    0,    0,    0,    0,
  199.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  200.     0,    0,  420,  264,  472,    0,  527,    0,    0,    0,
  201.     0,    0,    0,    0,    0,  683,    0,    0,    0,    0,
  202.     0,  316,    0,    1,    0,    0,    0,    0,    0,    0,
  203.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  204.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  205.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  206.     0,    0,    0,    0,    0,    0,    0,    0,    0,   53,
  207.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  208.     0,    0,    0,    0,  105,    0,    0,    0,    0,    0,
  209.     0,    0,  368,    0,    0,    0,    0,    0,    0,    0,
  210.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  211.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  212.     0,  579,    0,    0,    0,    0,  157,    0,    0,    0,
  213.     0,  209,    0,    0,    0,
  214. };
  215. short yygindex[] = {                                      0,
  216.     5,   -8,  908,    3,    0,    0,    0,    0,    0,    0,
  217.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  218.     0,  -73,  -43,  -39,    0,  -38,  -37,  -36,    0,    0,
  219.     0,  -45,    0,  -81,    0,    0,    0,    0,    0,    0,
  220.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  221.     0,    0,    0,
  222. };
  223. #define YYTABLESIZE 1128
  224. short yytable[] = {                                     144,
  225.    98,  145,   76,  118,  126,  119,   82,   79,   80,  146,
  226.   147,   83,   99,   87,   88,   89,  132,   93,  105,   92,
  227.   107,   96,  175,   80,  176,  120,  115,   84,  117,   77,
  228.    78,  177,  178,   93,   90,   93,  179,   91,  111,  112,
  229.    95,   97,  150,  180,  100,  101,  102,  103,    5,  108,
  230.     6,    7,   58,  149,  104,   93,  106,  109,  129,  130,
  231.   135,  139,   12,   13,  142,  165,   16,  181,  182,  233,
  232.   234,   20,  151,   22,  240,   23,  152,  153,  154,  155,
  233.    26,   27,   28,   29,  121,    0,  122,    0,   31,  125,
  234.   127,    0,   80,  128,    0,    0,  121,    0,  131,    0,
  235.    80,  203,    0,    0,  106,    0,    0,    0,  136,  138,
  236.   137,   80,    0,    0,    0,  141,    0,    0,    0,    0,
  237.     0,    0,    0,    0,    0,  160,  161,    0,    0,  164,
  238.     0,    0,    0,    0,    0,  166,    0,    0,    0,    0,
  239.   172,  171,   80,    0,    0,  174,    0,    0,    0,  185,
  240.     0,  187,    0,    0,    0,    0,   60,    0,    0,    0,
  241.     0,    0,  188,    0,    0,  189,  190,  191,    0,    0,
  242.   192,  201,  202,    0,  194,  193,   80,    0,    0,  196,
  243.   197,  198,  199,  200,    0,    0,    0,  212,  204,  205,
  244.     0,  206,    0,  207,  208,    0,    0,  209,  210,    0,
  245.     0,    0,  213,  214,    0,    0,    0,    0,   72,  215,
  246.   216,  217,    0,  218,  219,    0,    0,  221,  222,    0,
  247.   223,  224,  225,  226,    0,  228,  229,  230,    0,  231,
  248.   232,    0,    0,    0,  235,    0,  236,  237,    0,  238,
  249.   239,    0,  241,    0,    0,  242,  243,  244,  245,    0,
  250.     0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
  251.    98,   98,   98,   31,   98,    0,   98,   98,    0,   98,
  252.     0,   98,    0,    0,   98,   98,   98,    0,   98,   98,
  253.    98,   98,   98,   98,    0,   98,   98,   98,   98,   98,
  254.     0,   98,   98,   98,   98,   98,   98,   98,   98,   98,
  255.    98,    0,   98,   98,   98,   98,   98,   98,    0,    0,
  256.    98,   98,   58,   58,   58,   66,   58,    0,   58,   58,
  257.     0,   58,    0,   58,    0,    0,   58,   58,   58,    0,
  258.    58,   58,   58,   58,   58,   58,    0,   58,   58,   58,
  259.    58,   58,    0,   58,   58,   58,   58,   58,   58,   58,
  260.    58,   58,   58,    0,   58,   58,   58,   58,   58,   58,
  261.     0,    0,   58,   58,  106,  106,  106,   54,  106,    0,
  262.   106,  106,    0,  106,    0,  106,    0,    0,  106,  106,
  263.   106,    0,  106,  106,  106,  106,  106,  106,    0,  106,
  264.   106,  106,  106,  106,    0,  106,  106,  106,  106,  106,
  265.   106,  106,  106,  106,  106,    0,  106,  106,  106,  106,
  266.   106,  106,    0,    0,  106,  106,   60,   60,   60,   30,
  267.    60,    0,   60,   60,    0,   60,    0,   60,    0,    0,
  268.    60,   60,   60,    0,   60,   60,   60,   60,   60,   60,
  269.     0,   60,   60,   60,   60,   60,    0,   60,   60,   60,
  270.    60,   60,   60,   60,   60,   60,   60,    0,   60,   60,
  271.    60,   60,   60,   60,    0,    0,   60,   60,   72,   72,
  272.    72,   41,   72,    0,   72,   72,    0,   72,    0,   72,
  273.     0,    0,   72,   72,   72,    0,   72,   72,   72,   72,
  274.    72,   72,    0,   72,   72,   72,   72,   72,    0,   72,
  275.    72,   72,   72,   72,   72,   72,   72,   72,   72,    0,
  276.    72,   72,   72,   72,   72,   72,    0,    0,   72,   72,
  277.     0,    0,    0,   31,   31,   31,   65,   31,    0,   31,
  278.    31,    0,   31,    0,   31,    0,    0,   31,   31,   31,
  279.     0,   31,   31,   31,   31,   31,   31,    0,   31,   31,
  280.    31,   31,   31,    0,   31,    0,   31,    0,   31,   31,
  281.    31,   31,   31,   31,    0,    0,    0,   31,   31,   31,
  282.    31,    0,    0,   31,   31,   66,   66,   66,   95,   66,
  283.     0,   66,   66,    0,   66,    0,   66,    0,    0,   66,
  284.    66,   66,    0,   66,   66,   66,   66,   66,   66,    0,
  285.    66,   66,   66,   66,   66,    0,   66,    0,   66,    0,
  286.    66,   66,   66,   66,   66,   66,    0,    0,    0,   66,
  287.    66,   66,   66,    0,    0,   66,   66,   54,   54,   54,
  288.    78,   54,    0,   54,   54,    0,   54,    0,   54,    0,
  289.     0,   54,   54,   54,    0,   54,   54,   54,   54,   54,
  290.    54,    0,   54,   54,   54,   54,   54,    0,   54,    0,
  291.    54,    0,   54,   54,   54,   54,   54,   54,    0,    0,
  292.     0,   54,   54,   54,   54,    0,    0,   54,   54,   30,
  293.    30,   30,   74,   30,    0,   30,   30,    0,   30,    0,
  294.    30,    0,    0,   30,   30,   30,    0,   30,   30,   30,
  295.    30,   30,   30,    0,   30,   30,   30,   30,   30,    0,
  296.    30,    0,   30,    0,   30,   30,   30,   30,   30,   30,
  297.     0,    0,    0,   30,   30,   30,    0,    0,    0,   30,
  298.    30,   41,   41,   41,    0,   41,    0,   41,   41,    0,
  299.    41,    0,   41,    0,    0,   41,   41,   41,    0,   41,
  300.    41,   41,   41,   41,   41,    0,   41,   41,   41,   41,
  301.    41,    0,   41,    0,   41,    0,   41,   41,   41,   41,
  302.    41,   41,    0,    0,    0,   41,   41,   41,    0,    0,
  303.     0,   41,   41,    0,    0,    0,   65,   65,   65,    0,
  304.    65,    0,   65,   65,    0,   65,    0,   65,    0,    0,
  305.    65,   65,   65,    0,   65,   65,   65,   65,   65,   65,
  306.     0,   65,   65,   65,   65,   65,    0,   65,    0,   65,
  307.     0,   65,   65,   65,   65,   65,   65,    0,    0,    0,
  308.    65,   65,   65,    0,    0,    0,   65,   65,   95,   95,
  309.    95,    0,   95,    0,   95,   95,    0,   95,    0,   95,
  310.     0,    0,   95,   95,   95,    0,   95,   95,   95,   95,
  311.    95,   95,    0,   95,   95,   95,   95,   95,    0,   95,
  312.     0,   95,    0,   95,   95,   95,   95,   95,   95,    0,
  313.     0,    0,   95,   95,   95,    0,    0,    0,   95,   95,
  314.    78,   78,   78,    0,   78,    0,   78,   78,    0,    0,
  315.     0,   78,    0,    0,   78,   78,   78,    0,   78,   78,
  316.    78,   78,   78,   78,    0,   78,   78,   78,   78,   78,
  317.     0,   78,    0,   78,   94,   78,   78,   78,   78,   78,
  318.    78,    0,    0,    0,   78,   78,   78,    0,    0,  110,
  319.    78,   78,   74,   74,   74,    0,   74,    0,   74,   74,
  320.     0,    0,    0,   74,    0,    0,   74,   74,   74,    0,
  321.    74,   74,   74,   74,   74,   74,    0,   74,   74,   74,
  322.    74,   74,    0,   74,    0,   74,    0,   74,   74,   74,
  323.    74,   74,   74,    0,    0,    0,   74,   74,   74,    0,
  324.   123,  124,   74,   74,    0,    0,    0,    0,    0,    0,
  325.     0,    0,    0,    0,    0,    0,    0,  133,    0,    0,
  326.     0,    0,    0,    0,    0,    0,  140,    0,    0,    0,
  327.     0,    0,    0,    0,    0,  157,  158,  159,    0,    0,
  328.   162,  163,    0,    0,    0,    0,    0,    0,    0,    0,
  329.   167,  168,    0,  170,    0,    0,    0,  173,    2,    3,
  330.     4,  184,    5,  186,    6,    7,    0,    0,    0,    8,
  331.     0,    0,    9,   10,   11,    0,   12,   13,   14,   15,
  332.    16,   17,    0,   18,   19,   20,   21,   22,    0,   23,
  333.   195,   24,    0,   25,   26,   27,   28,   29,   30,    0,
  334.     0,    0,   31,   32,   33,    0,    0,    0,   34,   35,
  335.     0,    0,  211,    0,    0,    0,    0,    0,    0,    0,
  336.     0,    0,    0,    0,    0,    0,    0,    0,  220,    0,
  337.     0,    0,    0,    0,    0,    0,    0,  227,
  338. };
  339. short yycheck[] = {                                     292,
  340.     0,  294,  257,  268,   86,  270,  259,    3,    4,  302,
  341.   303,  259,   21,    9,   10,   11,   98,   15,   27,   15,
  342.    29,   19,  263,   19,  265,  290,   72,  259,   74,  257,
  343.   258,  272,  273,  268,  257,  270,  277,  259,   34,   35,
  344.   257,  259,  116,  284,  259,  259,  257,  257,  264,  257,
  345.   266,  267,    0,  269,  259,  290,  259,  259,  257,  259,
  346.   257,  257,  278,  279,  307,  257,  282,  308,  309,  257,
  347.   257,  287,  116,  289,  259,  291,  116,  116,  116,  116,
  348.   296,  297,  298,  299,   80,   -1,   82,   -1,  304,   85,
  349.    88,   -1,   88,   89,   -1,   -1,   92,   -1,   96,   -1,
  350.    96,  183,   -1,   -1,    0,   -1,   -1,   -1,  104,  107,
  351.   106,  107,   -1,   -1,   -1,  111,   -1,   -1,   -1,   -1,
  352.    -1,   -1,   -1,   -1,   -1,  121,  122,   -1,   -1,  125,
  353.    -1,   -1,   -1,   -1,   -1,  131,   -1,   -1,   -1,   -1,
  354.   138,  137,  138,   -1,   -1,  141,   -1,   -1,   -1,  145,
  355.    -1,  147,   -1,   -1,   -1,   -1,    0,   -1,   -1,   -1,
  356.    -1,   -1,  158,   -1,   -1,  161,  162,  163,   -1,   -1,
  357.   166,  180,  181,   -1,  172,  171,  172,   -1,   -1,  175,
  358.   176,  177,  178,  179,   -1,   -1,   -1,  196,  184,  185,
  359.    -1,  187,   -1,  189,  190,   -1,   -1,  193,  194,   -1,
  360.    -1,   -1,  198,  199,   -1,   -1,   -1,   -1,    0,  205,
  361.   206,  207,   -1,  209,  210,   -1,   -1,  213,  214,   -1,
  362.   216,  217,  218,  219,   -1,  221,  222,  223,   -1,  225,
  363.   226,   -1,   -1,   -1,  230,   -1,  232,  233,   -1,  235,
  364.   236,   -1,  238,   -1,   -1,  241,  242,  243,  244,   -1,
  365.    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
  366.   260,  261,  262,    0,  264,   -1,  266,  267,   -1,  269,
  367.    -1,  271,   -1,   -1,  274,  275,  276,   -1,  278,  279,
  368.   280,  281,  282,  283,   -1,  285,  286,  287,  288,  289,
  369.    -1,  291,  292,  293,  294,  295,  296,  297,  298,  299,
  370.   300,   -1,  302,  303,  304,  305,  306,  307,   -1,   -1,
  371.   310,  311,  260,  261,  262,    0,  264,   -1,  266,  267,
  372.    -1,  269,   -1,  271,   -1,   -1,  274,  275,  276,   -1,
  373.   278,  279,  280,  281,  282,  283,   -1,  285,  286,  287,
  374.   288,  289,   -1,  291,  292,  293,  294,  295,  296,  297,
  375.   298,  299,  300,   -1,  302,  303,  304,  305,  306,  307,
  376.    -1,   -1,  310,  311,  260,  261,  262,    0,  264,   -1,
  377.   266,  267,   -1,  269,   -1,  271,   -1,   -1,  274,  275,
  378.   276,   -1,  278,  279,  280,  281,  282,  283,   -1,  285,
  379.   286,  287,  288,  289,   -1,  291,  292,  293,  294,  295,
  380.   296,  297,  298,  299,  300,   -1,  302,  303,  304,  305,
  381.   306,  307,   -1,   -1,  310,  311,  260,  261,  262,    0,
  382.   264,   -1,  266,  267,   -1,  269,   -1,  271,   -1,   -1,
  383.   274,  275,  276,   -1,  278,  279,  280,  281,  282,  283,
  384.    -1,  285,  286,  287,  288,  289,   -1,  291,  292,  293,
  385.   294,  295,  296,  297,  298,  299,  300,   -1,  302,  303,
  386.   304,  305,  306,  307,   -1,   -1,  310,  311,  260,  261,
  387.   262,    0,  264,   -1,  266,  267,   -1,  269,   -1,  271,
  388.    -1,   -1,  274,  275,  276,   -1,  278,  279,  280,  281,
  389.   282,  283,   -1,  285,  286,  287,  288,  289,   -1,  291,
  390.   292,  293,  294,  295,  296,  297,  298,  299,  300,   -1,
  391.   302,  303,  304,  305,  306,  307,   -1,   -1,  310,  311,
  392.    -1,   -1,   -1,  260,  261,  262,    0,  264,   -1,  266,
  393.   267,   -1,  269,   -1,  271,   -1,   -1,  274,  275,  276,
  394.    -1,  278,  279,  280,  281,  282,  283,   -1,  285,  286,
  395.   287,  288,  289,   -1,  291,   -1,  293,   -1,  295,  296,
  396.   297,  298,  299,  300,   -1,   -1,   -1,  304,  305,  306,
  397.   307,   -1,   -1,  310,  311,  260,  261,  262,    0,  264,
  398.    -1,  266,  267,   -1,  269,   -1,  271,   -1,   -1,  274,
  399.   275,  276,   -1,  278,  279,  280,  281,  282,  283,   -1,
  400.   285,  286,  287,  288,  289,   -1,  291,   -1,  293,   -1,
  401.   295,  296,  297,  298,  299,  300,   -1,   -1,   -1,  304,
  402.   305,  306,  307,   -1,   -1,  310,  311,  260,  261,  262,
  403.     0,  264,   -1,  266,  267,   -1,  269,   -1,  271,   -1,
  404.    -1,  274,  275,  276,   -1,  278,  279,  280,  281,  282,
  405.   283,   -1,  285,  286,  287,  288,  289,   -1,  291,   -1,
  406.   293,   -1,  295,  296,  297,  298,  299,  300,   -1,   -1,
  407.    -1,  304,  305,  306,  307,   -1,   -1,  310,  311,  260,
  408.   261,  262,    0,  264,   -1,  266,  267,   -1,  269,   -1,
  409.   271,   -1,   -1,  274,  275,  276,   -1,  278,  279,  280,
  410.   281,  282,  283,   -1,  285,  286,  287,  288,  289,   -1,
  411.   291,   -1,  293,   -1,  295,  296,  297,  298,  299,  300,
  412.    -1,   -1,   -1,  304,  305,  306,   -1,   -1,   -1,  310,
  413.   311,  260,  261,  262,   -1,  264,   -1,  266,  267,   -1,
  414.   269,   -1,  271,   -1,   -1,  274,  275,  276,   -1,  278,
  415.   279,  280,  281,  282,  283,   -1,  285,  286,  287,  288,
  416.   289,   -1,  291,   -1,  293,   -1,  295,  296,  297,  298,
  417.   299,  300,   -1,   -1,   -1,  304,  305,  306,   -1,   -1,
  418.    -1,  310,  311,   -1,   -1,   -1,  260,  261,  262,   -1,
  419.   264,   -1,  266,  267,   -1,  269,   -1,  271,   -1,   -1,
  420.   274,  275,  276,   -1,  278,  279,  280,  281,  282,  283,
  421.    -1,  285,  286,  287,  288,  289,   -1,  291,   -1,  293,
  422.    -1,  295,  296,  297,  298,  299,  300,   -1,   -1,   -1,
  423.   304,  305,  306,   -1,   -1,   -1,  310,  311,  260,  261,
  424.   262,   -1,  264,   -1,  266,  267,   -1,  269,   -1,  271,
  425.    -1,   -1,  274,  275,  276,   -1,  278,  279,  280,  281,
  426.   282,  283,   -1,  285,  286,  287,  288,  289,   -1,  291,
  427.    -1,  293,   -1,  295,  296,  297,  298,  299,  300,   -1,
  428.    -1,   -1,  304,  305,  306,   -1,   -1,   -1,  310,  311,
  429.   260,  261,  262,   -1,  264,   -1,  266,  267,   -1,   -1,
  430.    -1,  271,   -1,   -1,  274,  275,  276,   -1,  278,  279,
  431.   280,  281,  282,  283,   -1,  285,  286,  287,  288,  289,
  432.    -1,  291,   -1,  293,   17,  295,  296,  297,  298,  299,
  433.   300,   -1,   -1,   -1,  304,  305,  306,   -1,   -1,   32,
  434.   310,  311,  260,  261,  262,   -1,  264,   -1,  266,  267,
  435.    -1,   -1,   -1,  271,   -1,   -1,  274,  275,  276,   -1,
  436.   278,  279,  280,  281,  282,  283,   -1,  285,  286,  287,
  437.   288,  289,   -1,  291,   -1,  293,   -1,  295,  296,  297,
  438.   298,  299,  300,   -1,   -1,   -1,  304,  305,  306,   -1,
  439.    83,   84,  310,  311,   -1,   -1,   -1,   -1,   -1,   -1,
  440.    -1,   -1,   -1,   -1,   -1,   -1,   -1,  100,   -1,   -1,
  441.    -1,   -1,   -1,   -1,   -1,   -1,  109,   -1,   -1,   -1,
  442.    -1,   -1,   -1,   -1,   -1,  118,  119,  120,   -1,   -1,
  443.   123,  124,   -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
  444.   133,  134,   -1,  136,   -1,   -1,   -1,  140,  260,  261,
  445.   262,  144,  264,  146,  266,  267,   -1,   -1,   -1,  271,
  446.    -1,   -1,  274,  275,  276,   -1,  278,  279,  280,  281,
  447.   282,  283,   -1,  285,  286,  287,  288,  289,   -1,  291,
  448.   173,  293,   -1,  295,  296,  297,  298,  299,  300,   -1,
  449.    -1,   -1,  304,  305,  306,   -1,   -1,   -1,  310,  311,
  450.    -1,   -1,  195,   -1,   -1,   -1,   -1,   -1,   -1,   -1,
  451.    -1,   -1,   -1,   -1,   -1,   -1,   -1,   -1,  211,   -1,
  452.    -1,   -1,   -1,   -1,   -1,   -1,   -1,  220,
  453. };
  454. #define YYFINAL 1
  455. #ifndef YYDEBUG
  456. #define YYDEBUG 0
  457. #endif
  458. #define YYMAXTOKEN 311
  459. #if YYDEBUG
  460. char *yyname[] = {
  461. "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,
  462. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  463. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  464. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  465. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  466. 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
  467. 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",
  468. "tADAPTIVE","tAPERTURE","tBACKGROUND","tBLOTCH","tBOX","tBUMP","tCONE","tCYL",
  469. "tDIRECTIONAL","tENDDEF","tEXTENDED","tEYEP","tFBM","tFBMBUMP","tFOCALDIST",
  470. "tFOG","tFOV","tGLOSS","tGRID","tHEIGHTFIELD","tJITTERED","tLIGHT","tLIST",
  471. "tLOOKP","tMARBLE","tMAXDEPTH","tMIST","tOBJECT","tOUTFILE","tPLANE","tPOINT",
  472. "tPOLY","tROTATE","tSAMPLES","tSCALE","tSCREEN","tSPHERE","tSTARTDEF","tSUPERQ",
  473. "tSURFACE","tRESOLUTION","tTHRESH","tTRANSLATE","tTRANSFORM","tTRIANGLE","tUP",
  474. "tENDFILE","tTEXTURE","tCHECKER","tWOOD","tCONTRAST","tCUTOFF",
  475. };
  476. char *yyrule[] = {
  477. "$accept : Items",
  478. "Items :",
  479. "Items : Items Item",
  480. "Item : Eyep",
  481. "Item : Lookp",
  482. "Item : Up",
  483. "Item : Fov",
  484. "Item : Screen",
  485. "Item : Aperture",
  486. "Item : Focaldist",
  487. "Item : Maxdepth",
  488. "Item : Samples",
  489. "Item : Jittered",
  490. "Item : Adaptive",
  491. "Item : Contrast",
  492. "Item : Cutoff",
  493. "Item : Background",
  494. "Item : Light",
  495. "Item : Primitive",
  496. "Item : Child",
  497. "Item : Surface",
  498. "Item : Outfile",
  499. "Item : List",
  500. "Item : Grid",
  501. "Item : Object",
  502. "Item : Fog",
  503. "Item : Mist",
  504. "Item : tENDFILE",
  505. "List : tLIST",
  506. "Grid : tGRID tINT tINT tINT",
  507. "Primitive : Prim Textures",
  508. "Prim : Primtype Transforms",
  509. "Primtype : Plane",
  510. "Primtype : Sphere",
  511. "Primtype : Box",
  512. "Primtype : Triangle",
  513. "Primtype : Cylinder",
  514. "Primtype : Cone",
  515. "Primtype : Superq",
  516. "Primtype : Poly",
  517. "Primtype : HeightField",
  518. "Object : Objectdef Textures",
  519. "Objectdef : Startdef Objdefs tENDDEF",
  520. "Startdef : tSTARTDEF String",
  521. "Objdefs : Objdefs Objdef",
  522. "Objdefs :",
  523. "Objdef : Primitive",
  524. "Objdef : Surface",
  525. "Objdef : Child",
  526. "Objdef : List",
  527. "Objdef : Grid",
  528. "Objdef : Object",
  529. "Textures : Textures Texture",
  530. "Textures :",
  531. "Texture : tTEXTURE Texturetype Transforms",
  532. "Texturetype : tCHECKER String",
  533. "Texturetype : tBLOTCH Fnumber String",
  534. "Texturetype : tBUMP Fnumber",
  535. "Texturetype : tMARBLE",
  536. "Texturetype : tMARBLE String",
  537. "Texturetype : tFBM Fnumber Fnumber Fnumber Fnumber tINT Fnumber",
  538. "Texturetype : tFBM Fnumber Fnumber Fnumber Fnumber tINT Fnumber tSTRING",
  539. "Texturetype : tFBMBUMP Fnumber Fnumber Fnumber Fnumber tINT",
  540. "Texturetype : tWOOD",
  541. "Texturetype : tGLOSS Fnumber",
  542. "Child : Childdef Textures",
  543. "Childdef : tOBJECT String Transforms",
  544. "Transforms : Transforms Transform",
  545. "Transforms :",
  546. "Transform : tTRANSLATE Vector",
  547. "Transform : tROTATE Vector Fnumber",
  548. "Transform : tSCALE Fnumber Fnumber Fnumber",
  549. "Transform : tTRANSFORM Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
  550. "Transform : tTRANSFORM Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
  551. "Eyep : tEYEP Vector Transforms",
  552. "Lookp : tLOOKP Vector",
  553. "Up : tUP Vector",
  554. "Fov : tFOV Fnumber Fnumber",
  555. "Fov : tFOV Fnumber",
  556. "Samples : tSAMPLES tINT",
  557. "Adaptive : tADAPTIVE tINT",
  558. "Contrast : tCONTRAST Fnumber Fnumber Fnumber",
  559. "Cutoff : tCUTOFF Fnumber",
  560. "Jittered : tJITTERED",
  561. "Screen : tSCREEN tINT tINT",
  562. "Screen : tRESOLUTION tINT tINT",
  563. "Aperture : tAPERTURE Fnumber",
  564. "Focaldist : tFOCALDIST Fnumber",
  565. "Maxdepth : tMAXDEPTH tINT",
  566. "Background : tBACKGROUND Color",
  567. "Light : Lightdef tPOINT Vector",
  568. "Light : Lightdef tDIRECTIONAL Vector",
  569. "Light : Lightdef tEXTENDED Vector Fnumber",
  570. "Lightdef : tLIGHT Fnumber",
  571. "Lightdef : tLIGHT Color",
  572. "Surface : tSURFACE String Color Color Color Fnumber Fnumber Fnumber Fnumber",
  573. "Surface : tSURFACE String Color Color Color Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
  574. "HeightField : tHEIGHTFIELD tSTRING tSTRING",
  575. "Poly : tPOLY tSTRING Polypoints",
  576. "Polypoints :",
  577. "Polypoints : Polypoints Polypoint",
  578. "Polypoint : Vector",
  579. "Cone : tCONE tSTRING Vector Vector Fnumber Fnumber",
  580. "Cylinder : tCYL tSTRING Vector Vector Fnumber",
  581. "Sphere : tSPHERE tSTRING Fnumber Vector",
  582. "Box : tBOX tSTRING Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
  583. "Triangle : tTRIANGLE tSTRING Vector Vector Vector",
  584. "Triangle : tTRIANGLE tSTRING Vector Vector Vector Vector Vector Vector",
  585. "Superq : tSUPERQ tSTRING Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber",
  586. "Plane : tPLANE tSTRING Vector Vector",
  587. "Outfile : tOUTFILE String",
  588. "Mist : tMIST Color Color Fnumber Fnumber",
  589. "Fog : tFOG Fnumber Color",
  590. "Color : Fnumber Fnumber Fnumber",
  591. "Vector : Fnumber Fnumber Fnumber",
  592. "Fnumber : tFLOAT",
  593. "Fnumber : tINT",
  594. "String : tSTRING",
  595. };
  596. #endif
  597. #define yyclearin (yychar=(-1))
  598. #define yyerrok (yyerrflag=0)
  599. #ifndef YYSTACKSIZE
  600. #ifdef YYMAXDEPTH
  601. #define YYSTACKSIZE YYMAXDEPTH
  602. #else
  603. #define YYSTACKSIZE 300
  604. #endif
  605. #endif
  606. int yydebug;
  607. int yynerrs;
  608. int yyerrflag;
  609. int yychar;
  610. short *yyssp;
  611. YYSTYPE *yyvsp;
  612. YYSTYPE yyval;
  613. YYSTYPE yylval;
  614. #define yystacksize YYSTACKSIZE
  615. short yyss[YYSTACKSIZE];
  616. YYSTYPE yyvs[YYSTACKSIZE];
  617. /*
  618.  * Issue error message containing filename and line number, and exit.
  619.  */
  620. /*VARARGS1*/
  621. yyerror(s, pat1, pat2)
  622. char *s, *pat1, *pat2;
  623. {
  624.     RSmessage("Error", "%s, line %d: ", yyfilename, yylineno);
  625.     fprintf(stderr, s, pat1, pat2);
  626.     fprintf(stderr,"\n");    /* yacc doesn't use newlines on syntax errors */
  627.     exit(1);
  628. }
  629.  
  630. /*
  631.  * Issue warning message containing filename and line number if not in
  632.  * Quiet mode.
  633.  */
  634. /*VARARGS1*/
  635. yywarning(s, pat1, pat2)
  636. char *s, *pat1, *pat2;
  637. {
  638.     extern int Quiet;
  639.  
  640.     if (!Quiet) {
  641.         RSmessage("Warning", "%s, line %d: ",yyfilename, yylineno);
  642.         fprintf(stderr, s, pat1, pat2);
  643.     }
  644. }
  645. #define YYABORT goto yyabort
  646. #define YYACCEPT goto yyaccept
  647. #define YYERROR goto yyerrlab
  648. int
  649. yyparse()
  650. {
  651.     register int yym, yyn, yystate;
  652. #if YYDEBUG
  653.     register char *yys;
  654.     extern char *getenv();
  655.  
  656.     if (yys = getenv("YYDEBUG"))
  657.     {
  658.         yyn = *yys;
  659.         if (yyn >= '0' && yyn <= '9')
  660.             yydebug = yyn - '0';
  661.     }
  662. #endif
  663.  
  664.     yynerrs = 0;
  665.     yyerrflag = 0;
  666.     yychar = (-1);
  667.  
  668.     yyssp = yyss;
  669.     yyvsp = yyvs;
  670.     *yyssp = yystate = 0;
  671.  
  672. yyloop:
  673.     if (yyn = yydefred[yystate]) goto yyreduce;
  674.     if (yychar < 0)
  675.     {
  676.         if ((yychar = yylex()) < 0) yychar = 0;
  677. #if YYDEBUG
  678.         if (yydebug)
  679.         {
  680.             yys = 0;
  681.             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  682.             if (!yys) yys = "illegal-symbol";
  683.             printf("yydebug: state %d, reading %d (%s)\n", yystate,
  684.                     yychar, yys);
  685.         }
  686. #endif
  687.     }
  688.     if ((yyn = yysindex[yystate]) && (yyn += yychar) >= 0 &&
  689.             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
  690.     {
  691. #if YYDEBUG
  692.         if (yydebug)
  693.             printf("yydebug: state %d, shifting to state %d\n",
  694.                     yystate, yytable[yyn]);
  695. #endif
  696.         if (yyssp >= yyss + yystacksize - 1)
  697.         {
  698.             goto yyoverflow;
  699.         }
  700.         *++yyssp = yystate = yytable[yyn];
  701.         *++yyvsp = yylval;
  702.         yychar = (-1);
  703.         if (yyerrflag > 0)  --yyerrflag;
  704.         goto yyloop;
  705.     }
  706.     if ((yyn = yyrindex[yystate]) && (yyn += yychar) >= 0 &&
  707.             yyn <= YYTABLESIZE && yycheck[yyn] == yychar)
  708.     {
  709.         yyn = yytable[yyn];
  710.         goto yyreduce;
  711.     }
  712.     if (yyerrflag) goto yyinrecovery;
  713. #ifdef lint
  714.     goto yynewerror;
  715. #endif
  716. yynewerror:
  717.     yyerror("syntax error");
  718. #ifdef lint
  719.     goto yyerrlab;
  720. #endif
  721. yyerrlab:
  722.     ++yynerrs;
  723. yyinrecovery:
  724.     if (yyerrflag < 3)
  725.     {
  726.         yyerrflag = 3;
  727.         for (;;)
  728.         {
  729.             if ((yyn = yysindex[*yyssp]) && (yyn += YYERRCODE) >= 0 &&
  730.                     yyn <= YYTABLESIZE && yycheck[yyn] == YYERRCODE)
  731.             {
  732. #if YYDEBUG
  733.                 if (yydebug)
  734.                     printf("yydebug: state %d, error recovery shifting\
  735.  to state %d\n", *yyssp, yytable[yyn]);
  736. #endif
  737.                 if (yyssp >= yyss + yystacksize - 1)
  738.                 {
  739.                     goto yyoverflow;
  740.                 }
  741.                 *++yyssp = yystate = yytable[yyn];
  742.                 *++yyvsp = yylval;
  743.                 goto yyloop;
  744.             }
  745.             else
  746.             {
  747. #if YYDEBUG
  748.                 if (yydebug)
  749.                     printf("yydebug: error recovery discarding state %d\n",
  750.                             *yyssp);
  751. #endif
  752.                 if (yyssp <= yyss) goto yyabort;
  753.                 --yyssp;
  754.                 --yyvsp;
  755.             }
  756.         }
  757.     }
  758.     else
  759.     {
  760.         if (yychar == 0) goto yyabort;
  761. #if YYDEBUG
  762.         if (yydebug)
  763.         {
  764.             yys = 0;
  765.             if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  766.             if (!yys) yys = "illegal-symbol";
  767.             printf("yydebug: state %d, error recovery discards token %d (%s)\n",
  768.                     yystate, yychar, yys);
  769.         }
  770. #endif
  771.         yychar = (-1);
  772.         goto yyloop;
  773.     }
  774. yyreduce:
  775. #if YYDEBUG
  776.     if (yydebug)
  777.         printf("yydebug: state %d, reducing by rule %d (%s)\n",
  778.                 yystate, yyn, yyrule[yyn]);
  779. #endif
  780.     yym = yylen[yyn];
  781.     yyval = yyvsp[1-yym];
  782.     switch (yyn)
  783.     {
  784. case 28:
  785. {
  786.             if (CurObj->data)
  787.                 CurObj->data->type = LIST;
  788.             else
  789.                 World->type = LIST;
  790.         }
  791. break;
  792. case 29:
  793. {
  794.             if (CurObj->data) {
  795.                 CurObj->data->type = GRID;
  796.                 CurXSize = yyvsp[-2].i ;
  797.                 CurYSize = yyvsp[-1].i ;
  798.                 CurZSize = yyvsp[0].i ;
  799.             } else {
  800.                 World->type = GRID;
  801.                 WorldXSize = yyvsp[-2].i ;
  802.                 WorldYSize = yyvsp[-1].i ;
  803.                 WorldZSize = yyvsp[0].i ;
  804.             }
  805.         }
  806. break;
  807. case 30:
  808. {
  809.             if (LastObj) {
  810.                 /* User may have botched prim. def. */
  811.                 LastObj->texture = CurText;
  812.                 if (CurObj->data)
  813.                     CurObj->data->prims++;
  814.                 else
  815.                     World->prims++;
  816.             }
  817.             CurText = (Texture *)0;
  818.             LastObj = (Object *)0;
  819.         }
  820. break;
  821. case 31:
  822. {
  823.             if (LastObj != (Object *)0) {
  824.                 /*
  825.                  * Compute boundings box of primitive.
  826.                  * if box's low X is > its high X,
  827.                  * then the prim is unbounded.
  828.                  */
  829.                 set_prim_bounds(LastObj);
  830.                 /*
  831.                  * Add primitive to current object
  832.                  * list.  When the obj. def. is complete
  833.                  * make_list() will calculate the
  834.                  * bounding box of the entire object.
  835.                  */
  836.                 add_prim(LastObj, CurObj->data);
  837.                 if (CurTrans) {
  838.                     /*
  839.                      * Compute the bounding box of the
  840.                      * transformed object.
  841.                      */
  842.                     transform_bounds(CurTrans,
  843.                             LastObj->bounds);
  844.                     invert_trans(&CurITrans, CurTrans);
  845.                     LastObj->trans = new_trans(CurTrans,
  846.                                 &CurITrans);
  847.                     free((char *)CurTrans);
  848.                     CurTrans = (TransInfo *)0;
  849.                 }
  850.             } else {
  851.                 /*
  852.                  * There was something wrong with the def.
  853.                  */
  854.                 if (CurTrans) {
  855.                     free((char *)CurTrans);
  856.                     CurTrans = (TransInfo *)0;
  857.                 }
  858.             }
  859.         }
  860. break;
  861. case 41:
  862. {
  863.             CurObj->data->texture = CurText;
  864.             CurText = (Texture *)0;
  865.             ListTmp = CurObj->next;
  866.             free((char *)CurObj);
  867.             CurObj = ListTmp;
  868.         }
  869. break;
  870. case 42:
  871. {
  872.             /*
  873.              * Object definition.
  874.              */
  875.             LastObj = (Object *)NULL;
  876.             if (CurObj->data->data == (char *)0) {
  877.                 yywarning("Null object \"%s\" defined.\n",
  878.                     CurObj->data->name);
  879.             } else {
  880.                 if (CurObj->data->type == GRID) {
  881.                     list2grid(CurObj->data, CurXSize,
  882.                         CurYSize, CurZSize);
  883.                 } else {
  884.                     /*
  885.                       * Object is a list -- transform the
  886.                       * linked list (ObjList) into a List.
  887.                       */
  888.                     make_list(CurObj->data);
  889.                 }
  890.                 /*
  891.                   * Add this new object to the list of
  892.                   * defined objects.
  893.                   */
  894.                 add_to_objects(CurObj->data);
  895.             }
  896.         }
  897. break;
  898. case 43:
  899. {
  900.             /*
  901.              * Once we know the bounding box of this object
  902.              * (and the user hasn't specified that this object
  903.              * is stored in a List), then we enlist everything
  904.              * it contains.
  905.              * The new object's DATA field points to an ObjList
  906.              * until the definition complete, when the ObjList
  907.              * is then turned into either a Grid or a List.
  908.              */
  909.             ListTmp = (ObjList *)Malloc(sizeof(ObjList));
  910.             ListTmp->data = new_object(yyvsp[0].c , LIST, (char *)NULL,
  911.                         (Trans *)NULL);
  912.             ListTmp->next = CurObj;
  913.             CurObj = ListTmp;
  914.         }
  915. break;
  916. case 54:
  917. {
  918.             /*
  919.              * Set transformation information.
  920.              */
  921.             if (CurTrans) {
  922.                 invert_trans(&CurITrans, CurTrans);
  923.                 yyvsp[-1].text ->trans = new_trans(CurTrans,&CurITrans);
  924.                 free((char *)CurTrans);
  925.                 CurTrans = (TransInfo *)NULL;
  926.             }
  927.             /*
  928.              * Walk to the end of list of textures and
  929.              * append new texture.  This is done so that
  930.              * textures are implied in the expected order.
  931.              */
  932.             {
  933.                 Texture *tp;
  934.  
  935.                 yyvsp[-1].text ->next = (Texture *)0;
  936.  
  937.                 if (CurText) {
  938.                     for (tp=CurText;tp->next;tp=tp->next)
  939.                             ;
  940.                     tp->next = yyvsp[-1].text ;
  941.  
  942.                 } else {
  943.                     CurText = yyvsp[-1].text ;
  944.                 }
  945.             }
  946.         }
  947. break;
  948. case 55:
  949. {
  950.             yyval.text  = NewCheckText(yyvsp[0].c );
  951.         }
  952. break;
  953. case 56:
  954. {
  955.             yyval.text  = NewBlotchText(yyvsp[-1].d , yyvsp[0].c );
  956.         }
  957. break;
  958. case 57:
  959. {
  960.             yyval.text  = NewBumpText(yyvsp[0].d );
  961.         }
  962. break;
  963. case 58:
  964. {
  965.             yyval.text  = NewMarbleText((char *)NULL);
  966.         }
  967. break;
  968. case 59:
  969. {
  970.             yyval.text  = NewMarbleText(yyvsp[0].c );
  971.         }
  972. break;
  973. case 60:
  974. {
  975.             yyval.text  = NewfBmText(yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].i , yyvsp[0].d , (char *)0);
  976.         }
  977. break;
  978. case 61:
  979. {
  980.             yyval.text  = NewfBmText(yyvsp[-6].d , yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].i , yyvsp[-1].d , yyvsp[0].c );
  981.         }
  982. break;
  983. case 62:
  984. {
  985.             yyval.text  = NewfBmBumpText(yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].i );
  986.         }
  987. break;
  988. case 63:
  989. {
  990.             yyval.text  = NewWoodText();
  991.         }
  992. break;
  993. case 64:
  994. {
  995.             yyval.text  = NewGlossText(yyvsp[0].d );
  996.         }
  997. break;
  998. case 65:
  999. {
  1000.             LastObj->texture = CurText;
  1001.             CurText = (Texture *)0;
  1002.             LastObj = (Object *)0;
  1003.         }
  1004. break;
  1005. case 66:
  1006. {
  1007.             LastObj = add_child_named(yyvsp[-1].c , CurObj->data);
  1008.             if (CurTrans) {
  1009.                 transform_bounds(CurTrans, LastObj->bounds);
  1010.                 invert_trans(&CurITrans, CurTrans);
  1011.                 if (LastObj->trans) {
  1012.                     mmult(&LastObj->trans->obj2world,
  1013.                         CurTrans,
  1014.                         &LastObj->trans->obj2world);
  1015.                     mmult(&LastObj->trans->world2obj,
  1016.                         &CurITrans,
  1017.                         &LastObj->trans->world2obj);
  1018.                 } else
  1019.                     LastObj->trans = new_trans(CurTrans,
  1020.                                 &CurITrans);
  1021.                 free((char *)CurTrans);
  1022.                 CurTrans = (TransInfo *)NULL;
  1023.             }
  1024.         }
  1025. break;
  1026. case 69:
  1027. {
  1028.             if (CurTrans == (TransInfo *)0)
  1029.                 CurTrans = new_transinfo();
  1030.             RS_translate(CurTrans, &(yyvsp[0].v ));
  1031.         }
  1032. break;
  1033. case 70:
  1034. {
  1035.             if (CurTrans == (TransInfo *)0)
  1036.                 CurTrans = new_transinfo();
  1037.  
  1038.             RS_rotate(CurTrans, &(yyvsp[-1].v ), deg2rad(yyvsp[0].d ));
  1039.         }
  1040. break;
  1041. case 71:
  1042. {
  1043.             if (CurTrans == (TransInfo *)0)
  1044.                 CurTrans = new_transinfo();
  1045.             RS_scale(CurTrans, yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d );
  1046.         }
  1047. break;
  1048. case 72:
  1049. {
  1050.             if (CurTrans == (TransInfo *)0)
  1051.                 CurTrans = new_transinfo();
  1052.             explicit_trans(CurTrans,
  1053.                 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 ,
  1054.                 0., 0., 0., CurTrans);
  1055.         }
  1056. break;
  1057. case 73:
  1058. {
  1059.             if (CurTrans == (TransInfo *)0)
  1060.                 CurTrans = new_transinfo();
  1061.             explicit_trans(CurTrans,
  1062.                 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 ,
  1063.                 yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d ,CurTrans);
  1064.         }
  1065. break;
  1066. case 74:
  1067. {
  1068.             eyep = yyvsp[-1].v ;
  1069.             if (CurTrans) {
  1070.                 transform_point(&eyep, CurTrans);
  1071.                 free((char *)CurTrans);
  1072.                 CurTrans = (TransInfo *)0;
  1073.             }
  1074.         }
  1075. break;
  1076. case 75:
  1077. {
  1078.             lookp = yyvsp[0].v ;
  1079.         }
  1080. break;
  1081. case 76:
  1082. {
  1083.             up = yyvsp[0].v ;
  1084.         }
  1085. break;
  1086. case 77:
  1087. {
  1088.             hfov = yyvsp[-1].d ; vfov = yyvsp[0].d ;
  1089.         }
  1090. break;
  1091. case 78:
  1092. {
  1093.             hfov = yyvsp[0].d ;
  1094.         }
  1095. break;
  1096. case 79:
  1097. {
  1098.             if (!SamplesSet)
  1099.                 JitSamples = yyvsp[0].i ;
  1100.         }
  1101. break;
  1102. case 80:
  1103. {
  1104.             if (!AdaptiveSet && !JitteredSet)
  1105.                 pixel_div = yyvsp[0].i ;
  1106.         }
  1107. break;
  1108. case 81:
  1109. {
  1110.             if (!ContrastSet) {
  1111.                 RedContrast = yyvsp[-2].d ;
  1112.                 GreenContrast = yyvsp[-1].d ;
  1113.                 BlueContrast = yyvsp[0].d ;
  1114.             }
  1115.         }
  1116. break;
  1117. case 82:
  1118. {
  1119.             if (!CutoffSet)
  1120.                 TreeCutoff = yyvsp[0].d ;
  1121.         }
  1122. break;
  1123. case 83:
  1124. {
  1125.             if (!AdaptiveSet)
  1126.                 Jittered = TRUE;
  1127.         }
  1128. break;
  1129. case 84:
  1130. {
  1131.             if (!ResolutionSet) {
  1132.                 Xres = yyvsp[-1].i ;
  1133.                 Yres = yyvsp[0].i ;
  1134.             }
  1135.         }
  1136. break;
  1137. case 85:
  1138. {
  1139.             if (!ResolutionSet) {
  1140.                 Xres = yyvsp[-1].i ;
  1141.                 Yres = yyvsp[0].i ;
  1142.             }
  1143.         }
  1144. break;
  1145. case 86:
  1146. {
  1147.             aperture = yyvsp[0].d ;
  1148.         }
  1149. break;
  1150. case 87:
  1151. {
  1152.             focaldist = yyvsp[0].d ;
  1153.         }
  1154. break;
  1155. case 88:
  1156. {
  1157.             maxlevel = yyvsp[0].i ;
  1158.         }
  1159. break;
  1160. case 89:
  1161. {
  1162.             background = yyvsp[0].col ;
  1163.         }
  1164. break;
  1165. case 90:
  1166. {
  1167.             light[nlight].pos = yyvsp[0].v ;
  1168.             light[nlight].type = LOCAL;
  1169.             nlight++;
  1170.         }
  1171. break;
  1172. case 91:
  1173. {
  1174.             (void)normalize(&(yyvsp[0].v ));
  1175.             light[nlight].pos = yyvsp[0].v ;
  1176.             light[nlight].type = DIRECTIONAL;
  1177.             nlight++;
  1178.         }
  1179. break;
  1180. case 92:
  1181. {
  1182.             light[nlight].pos = yyvsp[-1].v ;
  1183.             light[nlight].radius = yyvsp[0].d ;
  1184.             light[nlight].type = EXTENDED;
  1185.             nlight++;
  1186.         }
  1187. break;
  1188. case 93:
  1189. {
  1190.             if (nlight == LIGHTS)
  1191.                 yyerror("Too many lights.\n");
  1192.             light[nlight].color.r = yyvsp[0].d ;
  1193.             light[nlight].color.g = yyvsp[0].d ;
  1194.             light[nlight].color.b = yyvsp[0].d ;
  1195.         }
  1196. break;
  1197. case 94:
  1198. {
  1199.             if (nlight == LIGHTS)
  1200.                 yyerror("Too many lights.\n");
  1201.             light[nlight].color = yyvsp[0].col ;
  1202.         }
  1203. break;
  1204. case 95:
  1205. {
  1206.             /*
  1207.              * surface name
  1208.              *     amb
  1209.              *     diff
  1210.              *     spec coef reflect refract krefract
  1211.              */
  1212.             stmp = make_surface(yyvsp[-7].c , &(yyvsp[-6].col ), &(yyvsp[-5].col ), &(yyvsp[-4].col ), yyvsp[-3].d , yyvsp[-2].d ,
  1213.                     yyvsp[-1].d , yyvsp[0].d , 0., 0.);
  1214.             Surfaces = add_surface(stmp, Surfaces);
  1215.  
  1216.         }
  1217. break;
  1218. case 96:
  1219. {
  1220.             /*
  1221.              * surface name
  1222.              *     amb
  1223.              *     diff
  1224.              *     spec coef reflect refract krefract
  1225.              */
  1226.             stmp = make_surface(yyvsp[-9].c , &(yyvsp[-8].col ), &(yyvsp[-7].col ), &(yyvsp[-6].col ), yyvsp[-5].d , yyvsp[-4].d ,
  1227.                     yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d );
  1228.             Surfaces = add_surface(stmp, Surfaces);
  1229.  
  1230.         }
  1231. break;
  1232. case 97:
  1233. {
  1234.             LastObj = makhf(yyvsp[-1].c , yyvsp[0].c );
  1235.         }
  1236. break;
  1237. case 98:
  1238. {
  1239.             LastObj = makpoly(yyvsp[-1].c , Polypoints, Npoints);
  1240.             Polypoints = (PointList *)0;
  1241.             Npoints = 0;
  1242.         }
  1243. break;
  1244. case 101:
  1245. {
  1246.             Point = (PointList *)Malloc(sizeof(PointList));
  1247.             Point->vec = yyvsp[0].v ;
  1248.             Point->next = Polypoints;
  1249.             Polypoints = Point;
  1250.             Npoints++;
  1251.         }
  1252. break;
  1253. case 102:
  1254. {
  1255.             CurTrans = new_transinfo();
  1256.             LastObj = makcone(yyvsp[-4].c , &(yyvsp[-3].v ), &(yyvsp[-2].v ), yyvsp[-1].d , yyvsp[0].d , CurTrans);
  1257.         }
  1258. break;
  1259. case 103:
  1260. {
  1261.             /*
  1262.              * Cylinders automagically define a
  1263.              * transformation matrix.
  1264.              */
  1265.             CurTrans = new_transinfo();
  1266.             LastObj = makcyl(yyvsp[-3].c , &(yyvsp[-2].v ), &(yyvsp[-1].v ), yyvsp[0].d , CurTrans);
  1267.         }
  1268. break;
  1269. case 104:
  1270. {
  1271.             LastObj = maksph(yyvsp[-2].c , yyvsp[-1].d , &(yyvsp[0].v ));
  1272.         }
  1273. break;
  1274. case 105:
  1275. {
  1276.             LastObj = makbox(yyvsp[-6].c , yyvsp[-5].d , yyvsp[-4].d , yyvsp[-3].d , yyvsp[-2].d , yyvsp[-1].d , yyvsp[0].d );
  1277.         }
  1278. break;
  1279. case 106:
  1280. {
  1281.             LastObj = maktri(TRIANGLE, yyvsp[-3].c , &(yyvsp[-2].v ), &(yyvsp[-1].v ), &(yyvsp[0].v ),
  1282.                     (Vector *)0, (Vector *)0, (Vector *)0);
  1283.         }
  1284. break;
  1285. case 107:
  1286. {
  1287.             LastObj = maktri(PHONGTRI, yyvsp[-6].c , &(yyvsp[-5].v ), &(yyvsp[-3].v ),
  1288.                     &(yyvsp[-1].v ), &(yyvsp[-4].v ), &(yyvsp[-2].v ), &(yyvsp[0].v ));
  1289.         }
  1290. break;
  1291. case 108:
  1292. {
  1293.             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 );
  1294.         }
  1295. break;
  1296. case 109:
  1297. {
  1298.             LastObj = makplane(yyvsp[-2].c , &(yyvsp[-1].v ), &(yyvsp[0].v ));
  1299.         }
  1300. break;
  1301. case 110:
  1302. {
  1303.             if (*outfilename != (char)NULL)
  1304.                 yywarning("Ignoring output file name \"%s\".\n",
  1305.                             yyvsp[0].c );
  1306.             else
  1307.                 strcpy(outfilename, yyvsp[0].c );
  1308.         }
  1309. break;
  1310. case 111:
  1311. {
  1312.             GlobalMist = (Mist *)Malloc(sizeof(Mist));
  1313.             GlobalMist->color = yyvsp[-3].col ;
  1314.             GlobalMist->trans = yyvsp[-2].col ;
  1315.             GlobalMist->zero = yyvsp[-1].d ;
  1316.             GlobalMist->scale = 1. / yyvsp[0].d ;
  1317.         }
  1318. break;
  1319. case 112:
  1320. {
  1321.             GlobalFog = (Fog *)Malloc(sizeof(Fog));
  1322.             GlobalFog->trans = 1./yyvsp[-1].d ;
  1323.             GlobalFog->color = yyvsp[0].col ;
  1324.         }
  1325. break;
  1326. case 113:
  1327. {
  1328.             yyval.col .r = yyvsp[-2].d ;
  1329.             yyval.col .g = yyvsp[-1].d ;
  1330.             yyval.col .b = yyvsp[0].d ;
  1331.         }
  1332. break;
  1333. case 114:
  1334. {
  1335.             yyval.v .x = yyvsp[-2].d ;
  1336.             yyval.v .y = yyvsp[-1].d ;
  1337.             yyval.v .z = yyvsp[0].d ;
  1338.         }
  1339. break;
  1340. case 115:
  1341. { yyval.d  = yyvsp[0].d ;}
  1342. break;
  1343. case 116:
  1344. { yyval.d  = yyvsp[0].i ;}
  1345. break;
  1346. case 117:
  1347. { yyval.c  = yyvsp[0].c ;}
  1348. break;
  1349.     }
  1350.     yyssp -= yym;
  1351.     yystate = *yyssp;
  1352.     yyvsp -= yym;
  1353.     yym = yylhs[yyn];
  1354.     if (yystate == 0 && yym == 0)
  1355.     {
  1356. #ifdef YYDEBUG
  1357.         if (yydebug)
  1358.             printf("yydebug: after reduction, shifting from state 0 to\
  1359.  state %d\n", YYFINAL);
  1360. #endif
  1361.         yystate = YYFINAL;
  1362.         *++yyssp = YYFINAL;
  1363.         *++yyvsp = yyval;
  1364.         if (yychar < 0)
  1365.         {
  1366.             if ((yychar = yylex()) < 0) yychar = 0;
  1367. #if YYDEBUG
  1368.             if (yydebug)
  1369.             {
  1370.                 yys = 0;
  1371.                 if (yychar <= YYMAXTOKEN) yys = yyname[yychar];
  1372.                 if (!yys) yys = "illegal-symbol";
  1373.                 printf("yydebug: state %d, reading %d (%s)\n",
  1374.                         YYFINAL, yychar, yys);
  1375.             }
  1376. #endif
  1377.         }
  1378.         if (yychar == 0) goto yyaccept;
  1379.         goto yyloop;
  1380.     }
  1381.     if ((yyn = yygindex[yym]) && (yyn += yystate) >= 0 &&
  1382.             yyn <= YYTABLESIZE && yycheck[yyn] == yystate)
  1383.         yystate = yytable[yyn];
  1384.     else
  1385.         yystate = yydgoto[yym];
  1386. #ifdef YYDEBUG
  1387.     if (yydebug)
  1388.         printf("yydebug: after reduction, shifting from state %d \
  1389. to state %d\n", *yyssp, yystate);
  1390. #endif
  1391.     if (yyssp >= yyss + yystacksize - 1)
  1392.     {
  1393.         goto yyoverflow;
  1394.     }
  1395.     *++yyssp = yystate;
  1396.     *++yyvsp = yyval;
  1397.     goto yyloop;
  1398. yyoverflow:
  1399.     yyerror("yacc stack overflow");
  1400. yyabort:
  1401.     return (1);
  1402. yyaccept:
  1403.     return (0);
  1404. }
  1405.