home *** CD-ROM | disk | FTP | other *** search
/ Resource Library: Graphics / graphics-16000.iso / msdos / raytrace / rayshade / etc / rsconver / yacc_tab.c < prev    next >
C/C++ Source or Header  |  1992-04-30  |  49KB  |  1,757 lines

  1.  
  2. /*  A Bison parser, made from yacc.y  */
  3.  
  4. #define    tFLOAT    258
  5. #define    tSTRING    259
  6. #define    tHASHTHING    260
  7. #define    tINT    261
  8. #define    tADAPTIVE    262
  9. #define    tAPERTURE    263
  10. #define    tBACKGROUND    264
  11. #define    tBLOTCH    265
  12. #define    tBOX    266
  13. #define    tBUMP    267
  14. #define    tCONE    268
  15. #define    tCYL    269
  16. #define    tDIRECTIONAL    270
  17. #define    tENDDEF    271
  18. #define    tEXTENDED    272
  19. #define    tEYEP    273
  20. #define    tFBM    274
  21. #define    tFBMBUMP    275
  22. #define    tFOCALDIST    276
  23. #define    tFOG    277
  24. #define    tFOV    278
  25. #define    tGLOSS    279
  26. #define    tGRID    280
  27. #define    tHEIGHTFIELD    281
  28. #define    tJITTERED    282
  29. #define    tLIGHT    283
  30. #define    tLIST    284
  31. #define    tLOOKP    285
  32. #define    tMARBLE    286
  33. #define    tMAXDEPTH    287
  34. #define    tMIST    288
  35. #define    tOBJECT    289
  36. #define    tOUTFILE    290
  37. #define    tPLANE    291
  38. #define    tPOINT    292
  39. #define    tPOLY    293
  40. #define    tROTATE    294
  41. #define    tSAMPLES    295
  42. #define    tSCALE    296
  43. #define    tSCREEN    297
  44. #define    tSPHERE    298
  45. #define    tSTARTDEF    299
  46. #define    tSUPERQ    300
  47. #define    tSURFACE    301
  48. #define    tRESOLUTION    302
  49. #define    tTHRESH    303
  50. #define    tTRANSLATE    304
  51. #define    tTRANSFORM    305
  52. #define    tTRIANGLE    306
  53. #define    tUP    307
  54. #define    tENDFILE    308
  55. #define    tTEXTURE    309
  56. #define    tCHECKER    310
  57. #define    tWOOD    311
  58. #define    tCONTRAST    312
  59. #define    tCUTOFF    313
  60.  
  61.  
  62. #include <stdio.h>
  63. #include "common.h"
  64.  
  65. #define NEWLINE()    WriteNewline()
  66. /*#define NEWLINE()    printf("\n")*/
  67. #define LIST    0
  68. #define GRID    1
  69. char yyfilename[BUFSIZ];
  70. int yylineno;
  71.  
  72. typedef union {
  73.     char *c;
  74.     int i;
  75.     double d;
  76.     Color col;
  77.     Vector v;
  78. } YYSTYPE;
  79.  
  80. #ifndef YYLTYPE
  81. typedef
  82.   struct yyltype
  83.     {
  84.       int timestamp;
  85.       int first_line;
  86.       int first_column;
  87.       int last_line;
  88.       int last_column;
  89.       char *text;
  90.    }
  91.   yyltype;
  92.  
  93. #define YYLTYPE yyltype
  94. #endif
  95.  
  96. #include <stdio.h>
  97.  
  98. #ifndef __STDC__
  99. #define const
  100. #endif
  101.  
  102.  
  103.  
  104. #define    YYFINAL        311
  105. #define    YYFLAG        -32768
  106. #define    YYNTBASE    59
  107.  
  108. #define YYTRANSLATE(x) ((unsigned)(x) <= 313 ? yytranslate[x] : 171)
  109.  
  110. static const char yytranslate[] = {     0,
  111.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  112.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  113.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  114.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  115.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  116.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  117.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  118.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  119.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  120.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  121.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  122.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  123.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  124.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  125.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  126.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  127.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  128.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  129.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  130.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  131.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  132.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  133.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  134.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  135.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  136.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  137.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  138.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  139.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  140.     36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
  141.     46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
  142.     56,    57,    58
  143. };
  144.  
  145. #if YYDEBUG != 0
  146. static const short yyrline[] = { 0,
  147.     51,    52,    54,    55,    56,    57,    58,    59,    60,    61,
  148.     62,    63,    64,    65,    66,    67,    68,    69,    70,    71,
  149.     72,    73,    74,    75,    76,    77,    78,    79,    81,    87,
  150.     92,    97,    99,   101,   102,   103,   104,   105,   106,   107,
  151.    108,   109,   111,   116,   118,   126,   127,   129,   130,   131,
  152.    132,   133,   134,   136,   137,   139,   144,   148,   152,   156,
  153.    160,   164,   168,   172,   176,   180,   185,   190,   195,   196,
  154.    198,   202,   207,   211,   221,   234,   239,   244,   249,   253,
  155.    258,   263,   269,   274,   279,   284,   288,   293,   298,   303,
  156.    308,   313,   317,   321,   328,   332,   337,   374,   418,   423,
  157.    428,   429,   431,   436,   446,   472,   477,   491,   495,   500,
  158.    509,   517,   522,   527,   534,   536,   541,   543,   548,   550,
  159.    553,   555,   557,   558,   561,   563,   565,   566,   567,   568,
  160.    569,   570,   571,   572,   573,   574,   575,   576,   577,   578,
  161.    579,   580,   581,   582,   583,   584,   585,   586,   587,   588,
  162.    589,   590,   591,   592,   593,   594,   595,   596,   597,   598,
  163.    599,   600,   601,   602,   603,   604,   605,   606,   607,   608,
  164.    609,   610,   611,   612,   613,   614,   615
  165. };
  166.  
  167. static const char * const yytname[] = {     0,
  168. "error","$illegal.","tFLOAT","tSTRING","tHASHTHING","tINT","tADAPTIVE","tAPERTURE","tBACKGROUND","tBLOTCH",
  169. "tBOX","tBUMP","tCONE","tCYL","tDIRECTIONAL","tENDDEF","tEXTENDED","tEYEP","tFBM","tFBMBUMP",
  170. "tFOCALDIST","tFOG","tFOV","tGLOSS","tGRID","tHEIGHTFIELD","tJITTERED","tLIGHT","tLIST","tLOOKP",
  171. "tMARBLE","tMAXDEPTH","tMIST","tOBJECT","tOUTFILE","tPLANE","tPOINT","tPOLY","tROTATE","tSAMPLES",
  172. "tSCALE","tSCREEN","tSPHERE","tSTARTDEF","tSUPERQ","tSURFACE","tRESOLUTION","tTHRESH","tTRANSLATE","tTRANSFORM",
  173. "tTRIANGLE","tUP","tENDFILE","tTEXTURE","tCHECKER","tWOOD","tCONTRAST","tCUTOFF","Items"
  174. };
  175. #endif
  176.  
  177. static const short yyr1[] = {     0,
  178.     59,    59,    60,    60,    60,    60,    60,    60,    60,    60,
  179.     60,    60,    60,    60,    60,    60,    60,    60,    60,    60,
  180.     60,    60,    60,    60,    60,    60,    60,    60,    61,    62,
  181.     63,    64,    65,    66,    66,    66,    66,    66,    66,    66,
  182.     66,    66,    67,    68,    69,    70,    70,    71,    71,    71,
  183.     71,    71,    71,    72,    72,    73,    74,    74,    74,    74,
  184.     74,    74,    74,    74,    74,    74,    75,    76,    77,    77,
  185.     78,    78,    78,    78,    78,    79,    80,    81,    82,    82,
  186.     83,    84,    85,    86,    87,    88,    88,    89,    90,    91,
  187.     92,    93,    93,    93,    94,    94,    95,    95,    96,    97,
  188.     98,    98,    99,   100,   101,   102,   103,   104,   104,   105,
  189.    106,   107,   108,   109,   110,   111,   112,   113,   114,   114,
  190.    115,   116,   117,   117,   118,   119,   120,   121,   122,   123,
  191.    124,   125,   126,   127,   128,   129,   130,   131,   132,   133,
  192.    134,   135,   136,   137,   138,   139,   140,   141,   142,   143,
  193.    144,   145,   146,   147,   148,   149,   150,   151,   152,   153,
  194.    154,   155,   156,   157,   158,   159,   160,   161,   162,   163,
  195.    164,   165,   166,   167,   168,   169,   170
  196. };
  197.  
  198. static const short yyr2[] = {     0,
  199.      0,     2,     1,     1,     1,     1,     1,     1,     1,     1,
  200.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  201.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  202.      1,     2,     2,     1,     1,     1,     1,     1,     1,     1,
  203.      1,     1,     2,     3,     1,     2,     0,     1,     1,     1,
  204.      1,     1,     1,     2,     0,     3,     2,     3,     2,     1,
  205.      2,     7,     8,     6,     1,     2,     2,     3,     2,     0,
  206.      2,     3,     4,    10,    13,     3,     2,     2,     3,     2,
  207.      2,     2,     4,     2,     1,     3,     3,     2,     2,     2,
  208.      2,     3,     3,     4,     2,     2,     9,    11,     3,     3,
  209.      0,     2,     1,     6,     5,     4,     8,     5,     8,     9,
  210.      4,     2,     5,     3,     3,     3,     3,     3,     1,     1,
  211.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  212.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  213.      1,     1,     1,     1,     4,     1,     1,     1,     1,     1,
  214.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  215.      1,     1,     1,     2,     1,     1,     1,     1,     1,     1,
  216.      1,     1,     1,     1,     1,     1,     1
  217. };
  218.  
  219. static const short yydefact[] = {     1,
  220.      0,    29,   127,   128,   129,   131,   133,   134,   138,   141,
  221.    142,   143,     0,   146,   147,   148,   149,   150,   152,   153,
  222.    154,   155,   156,   158,   160,   162,   163,     0,   165,   166,
  223.    167,   170,   171,   172,   176,   177,     2,    27,    22,    23,
  224.     18,    55,    70,    24,    55,    47,    19,    55,     3,     4,
  225.      5,     6,    11,    13,    14,    15,    12,     7,     8,     9,
  226.     10,    16,    17,     0,    20,    42,    41,    39,    38,    35,
  227.     36,    37,    40,    34,    21,    26,    25,     0,     0,     0,
  228.      0,     0,     0,     0,     0,     0,     0,    31,     0,    85,
  229.      0,    30,     0,     0,     0,     0,     0,     0,     0,     0,
  230.      0,     0,    45,     0,     0,     0,     0,     0,    28,     0,
  231.      0,     0,   164,    32,    33,    43,     0,    67,   135,   137,
  232.    157,     0,     0,     0,   122,    82,   119,   120,    88,    91,
  233.      0,   125,     0,     0,   126,     0,    70,     0,    89,   123,
  234.    124,     0,    80,     0,    96,    95,    77,   121,    90,     0,
  235.     70,   112,     0,   101,    81,     0,     0,     0,     0,     0,
  236.      0,    78,     0,    84,     0,   173,    54,     0,   159,   161,
  237.    168,   169,    69,     0,     0,     0,     0,   136,    51,    52,
  238.     48,    53,    46,    50,    49,    44,    93,     0,     0,    92,
  239.      0,     0,     0,     0,    76,     0,   114,     0,    79,    99,
  240.      0,    68,     0,   100,    86,     0,     0,     0,    87,     0,
  241.      0,   145,   130,   132,   139,   140,   144,   151,   174,   175,
  242.     70,     0,     0,     0,     0,     0,    60,     0,    65,     0,
  243.      0,    71,     0,    94,     0,   115,     0,     0,     0,   117,
  244.      0,     0,   111,   102,   103,   106,     0,     0,     0,    83,
  245.     56,     0,    59,     0,     0,    66,    61,    57,    72,     0,
  246.      0,   118,     0,     0,   105,   116,   113,     0,     0,   108,
  247.     58,     0,     0,    73,     0,     0,   104,     0,     0,     0,
  248.      0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
  249.    107,     0,     0,   109,     0,    64,     0,   110,    97,    62,
  250.      0,     0,    63,     0,    98,    74,     0,     0,    75,     0,
  251.      0
  252. };
  253.  
  254. static const short yydefgoto[] = {     1,
  255.     37,    38,    39,    40,    41,    42,    43,    44,    45,    46,
  256.    117,   183,   114,   167,   221,    47,    48,   115,   173,    49,
  257.     50,    51,    52,    53,    54,    55,    56,    57,    58,    59,
  258.     60,    61,    62,    63,    64,    65,    66,    67,   204,   244,
  259.     68,    69,    70,    71,    72,    73,    74,    75,    76,    77,
  260.    130,   197,   137,   188,   138,   149,   126,   189,   133,   136,
  261.     78,    79,    80,   222,    81,   223,    82,    83,   122,   186,
  262.    123,    84,   224,   225,    85,    86,    87,   226,    88,    89,
  263.     90,    91,    92,    93,   227,    94,    95,    96,    97,    98,
  264.    124,    99,   174,   100,   175,   101,   102,   103,   104,   105,
  265.    106,   176,   177,   107,   108,   109,   168,   228,   229,   110,
  266.    111
  267. };
  268.  
  269. static const short yypact[] = {-32768,
  270.    379,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  271. -32768,-32768,    -2,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  272. -32768,-32768,-32768,-32768,-32768,-32768,-32768,    13,-32768,-32768,
  273. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  274. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  275. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  276. -32768,-32768,-32768,   -12,-32768,-32768,-32768,-32768,-32768,-32768,
  277. -32768,-32768,-32768,-32768,-32768,-32768,-32768,     3,     8,     8,
  278.     19,    19,    26,     8,     8,    12,     8,-32768,    19,-32768,
  279.      8,-32768,     8,    30,     8,    19,    19,    19,    19,    30,
  280.     30,    19,-32768,    19,    19,    30,    19,     8,-32768,     8,
  281.      8,    32,-32768,   -11,     5,   -11,    82,   -11,-32768,-32768,
  282. -32768,     8,    12,     8,-32768,-32768,-32768,-32768,-32768,-32768,
  283.      8,-32768,    12,    12,-32768,    12,-32768,     8,-32768,-32768,
  284. -32768,    12,     8,    19,-32768,     8,-32768,-32768,-32768,     8,
  285. -32768,-32768,    12,-32768,-32768,    30,     8,     8,    12,    30,
  286.      8,-32768,     8,-32768,    36,-32768,-32768,    21,-32768,-32768,
  287. -32768,-32768,-32768,     8,     8,     8,    12,-32768,-32768,-32768,
  288. -32768,-32768,-32768,-32768,-32768,-32768,-32768,    12,    12,-32768,
  289.      8,    12,    12,    12,     5,     8,-32768,    12,-32768,-32768,
  290.      8,     5,    12,     8,-32768,     8,     8,    12,-32768,     8,
  291.      8,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  292. -32768,     8,     8,     8,     8,     8,    19,    19,-32768,    12,
  293.      8,-32768,    12,-32768,    12,-32768,    12,    12,    12,-32768,
  294.     12,     8,-32768,-32768,-32768,-32768,     8,    12,     8,-32768,
  295.      5,    19,-32768,     8,     8,-32768,-32768,-32768,-32768,     8,
  296.     12,-32768,    12,    12,-32768,-32768,-32768,     8,    12,     8,
  297. -32768,     8,     8,-32768,    12,    12,-32768,     8,    12,     8,
  298.      8,     8,    12,    12,     8,    12,     8,    30,    30,    12,
  299. -32768,     8,    12,-32768,     8,-32768,    12,-32768,    12,    19,
  300.     12,    12,-32768,    12,-32768,    12,    12,    12,-32768,    48,
  301. -32768
  302. };
  303.  
  304. static const short yypgoto[] = {-32768,
  305. -32768,-32768,   -68,   -66,   -64,-32768,-32768,   -60,-32768,-32768,
  306. -32768,-32768,   -24,-32768,-32768,   -59,-32768,  -135,-32768,-32768,
  307. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  308. -32768,-32768,-32768,-32768,-32768,   -58,-32768,-32768,-32768,-32768,
  309. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  310.    -85,  -158,   140,  -114,    81,   -93,-32768,   -86,   -70,-32768,
  311. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  312. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  313. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  314. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  315. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  316. -32768
  317. };
  318.  
  319.  
  320. #define    YYLAST        437
  321.  
  322.  
  323. static const short yytable[] = {   142,
  324.    208,   195,   119,   112,   120,   145,   155,   156,   125,   150,
  325.    127,   134,   160,   128,   140,   202,   113,   141,   144,   193,
  326.    116,   194,   132,   118,   121,   151,   152,   153,   154,   135,
  327.    213,   157,   214,   158,   159,   148,   161,   165,   203,   215,
  328.    216,   212,   166,   169,   217,   170,   192,   311,   179,   248,
  329.    180,   218,   181,   171,   172,   198,   182,   184,   185,     0,
  330.      0,     0,   205,     0,   201,     0,   209,     0,     0,     0,
  331.      0,     0,   198,   200,     0,   219,   220,     0,   238,   239,
  332.      0,     0,     0,     0,     0,   251,     0,     0,   243,   269,
  333.    233,     0,     6,     0,     7,     8,     0,   178,     0,     0,
  334.      0,   234,   235,     0,     0,   237,    13,    14,     0,     0,
  335.     17,   241,     0,     0,     0,    21,     0,    23,     0,    24,
  336.      0,   198,     0,     0,    27,    28,    29,    30,     0,     0,
  337.      0,     0,    32,     0,     0,     0,     0,     0,     0,     0,
  338.      0,     0,     0,   259,     0,     0,   261,     0,   262,     0,
  339.    263,   264,   265,     0,   266,     0,   257,   258,     0,   129,
  340.    131,   198,     0,     0,     0,   139,     0,   143,     0,     0,
  341.      0,   146,     0,     0,   275,   131,   276,   277,     0,     0,
  342.      0,   271,   279,     0,     0,     0,     0,     0,   283,   284,
  343.    163,   164,   286,     0,   295,   296,   290,   291,     0,   293,
  344.      0,     0,     0,   297,     0,     0,   299,     0,     0,     0,
  345.    301,   191,   302,     0,   304,   305,     0,   306,   196,   307,
  346.    308,   309,     0,   199,     0,     0,   191,     0,     0,   303,
  347.    131,     0,   147,     0,     0,     0,     0,   206,   207,     0,
  348.      0,     0,     0,   211,     0,     0,     0,   162,     0,     0,
  349.      0,     0,     0,     0,     0,   231,     0,     0,     0,     0,
  350.      0,   187,     0,   190,     0,     0,     0,     0,     0,     0,
  351.      0,   236,     0,     0,     0,     0,   240,     0,     0,     0,
  352.      0,   242,     0,     0,     0,     0,     0,   247,     0,     0,
  353.      0,   250,     0,     0,     0,     0,     0,     0,     0,     0,
  354.    210,     0,   252,   253,   254,   255,   256,     0,     0,     0,
  355.      0,   260,     0,   230,     0,   232,     0,     0,     0,     0,
  356.      0,     0,   267,     0,     0,     0,     0,   268,     0,     0,
  357.      0,     0,     0,     0,   272,   273,     0,     0,     0,     0,
  358.    274,     0,     0,   245,     0,   246,     0,     0,   278,   249,
  359.      0,     0,   281,   282,     0,     0,     0,     0,   285,     0,
  360.      0,   288,   289,     0,     0,   292,     0,     0,     0,     0,
  361.      0,     0,   298,     0,     0,   300,     0,     0,   310,     0,
  362.      0,     0,     0,     2,     0,     3,     4,     5,   270,     6,
  363.      0,     7,     8,     0,     0,     0,     9,     0,     0,    10,
  364.     11,    12,     0,    13,    14,    15,    16,    17,    18,   280,
  365.     19,    20,    21,    22,    23,     0,    24,     0,    25,   287,
  366.     26,    27,    28,    29,    30,    31,   294,     0,     0,    32,
  367.     33,    34,     0,     0,     0,    35,    36
  368. };
  369.  
  370. static const short yycheck[] = {    86,
  371.    159,   137,    15,     6,    17,    91,   100,   101,     6,    95,
  372.      3,    82,   106,     6,     3,   151,     4,     6,    89,   134,
  373.     45,   136,     4,    48,    37,    96,    97,    98,    99,     4,
  374.     10,   102,    12,   104,   105,     6,   107,     6,   153,    19,
  375.     20,     6,    54,    39,    24,    41,   133,     0,   117,   208,
  376.    117,    31,   117,    49,    50,   142,   117,   117,   117,    -1,
  377.     -1,    -1,   156,    -1,   150,    -1,   160,    -1,    -1,    -1,
  378.     -1,    -1,   159,   144,    -1,    55,    56,    -1,   193,   194,
  379.     -1,    -1,    -1,    -1,    -1,   221,    -1,    -1,   203,   248,
  380.    177,    -1,    11,    -1,    13,    14,    -1,    16,    -1,    -1,
  381.     -1,   188,   189,    -1,    -1,   192,    25,    26,    -1,    -1,
  382.     29,   198,    -1,    -1,    -1,    34,    -1,    36,    -1,    38,
  383.     -1,   208,    -1,    -1,    43,    44,    45,    46,    -1,    -1,
  384.     -1,    -1,    51,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  385.     -1,    -1,    -1,   230,    -1,    -1,   233,    -1,   235,    -1,
  386.    237,   238,   239,    -1,   241,    -1,   227,   228,    -1,    79,
  387.     80,   248,    -1,    -1,    -1,    85,    -1,    87,    -1,    -1,
  388.     -1,    91,    -1,    -1,   261,    95,   263,   264,    -1,    -1,
  389.     -1,   252,   269,    -1,    -1,    -1,    -1,    -1,   275,   276,
  390.    110,   111,   279,    -1,   288,   289,   283,   284,    -1,   286,
  391.     -1,    -1,    -1,   290,    -1,    -1,   293,    -1,    -1,    -1,
  392.    297,   131,   299,    -1,   301,   302,    -1,   304,   138,   306,
  393.    307,   308,    -1,   143,    -1,    -1,   146,    -1,    -1,   300,
  394.    150,    -1,    93,    -1,    -1,    -1,    -1,   157,   158,    -1,
  395.     -1,    -1,    -1,   163,    -1,    -1,    -1,   108,    -1,    -1,
  396.     -1,    -1,    -1,    -1,    -1,   175,    -1,    -1,    -1,    -1,
  397.     -1,   122,    -1,   124,    -1,    -1,    -1,    -1,    -1,    -1,
  398.     -1,   191,    -1,    -1,    -1,    -1,   196,    -1,    -1,    -1,
  399.     -1,   201,    -1,    -1,    -1,    -1,    -1,   207,    -1,    -1,
  400.     -1,   211,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
  401.    161,    -1,   222,   223,   224,   225,   226,    -1,    -1,    -1,
  402.     -1,   231,    -1,   174,    -1,   176,    -1,    -1,    -1,    -1,
  403.     -1,    -1,   242,    -1,    -1,    -1,    -1,   247,    -1,    -1,
  404.     -1,    -1,    -1,    -1,   254,   255,    -1,    -1,    -1,    -1,
  405.    260,    -1,    -1,   204,    -1,   206,    -1,    -1,   268,   210,
  406.     -1,    -1,   272,   273,    -1,    -1,    -1,    -1,   278,    -1,
  407.     -1,   281,   282,    -1,    -1,   285,    -1,    -1,    -1,    -1,
  408.     -1,    -1,   292,    -1,    -1,   295,    -1,    -1,     0,    -1,
  409.     -1,    -1,    -1,     5,    -1,     7,     8,     9,   249,    11,
  410.     -1,    13,    14,    -1,    -1,    -1,    18,    -1,    -1,    21,
  411.     22,    23,    -1,    25,    26,    27,    28,    29,    30,   270,
  412.     32,    33,    34,    35,    36,    -1,    38,    -1,    40,   280,
  413.     42,    43,    44,    45,    46,    47,   287,    -1,    -1,    51,
  414.     52,    53,    -1,    -1,    -1,    57,    58
  415. };
  416. #define YYPURE 1
  417.  
  418. /* BISON template */
  419. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  420.  
  421.  
  422. /* Skeleton output parser for bison,
  423.    Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  424.  
  425.    This program is free software; you can redistribute it and/or modify
  426.    it under the terms of the GNU General Public License as published by
  427.    the Free Software Foundation; either version 1, or (at your option)
  428.    any later version.
  429.  
  430.    This program is distributed in the hope that it will be useful,
  431.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  432.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  433.    GNU General Public License for more details.
  434.  
  435.    You should have received a copy of the GNU General Public License
  436.    along with this program; if not, write to the Free Software
  437.    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  438.  
  439.  
  440. #ifdef __GNUC__
  441. #define alloca __builtin_alloca
  442. #else /* Not GNU C.  */
  443. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__)
  444. #include <alloca.h>
  445. #else
  446. #ifdef MSDOS
  447. #include <malloc.h>
  448. #else
  449. void *alloca(unsigned);
  450. #endif /* MSDOS */
  451. #endif /* Sparc. */
  452. #endif /* Not GNU C. */
  453.  
  454. #ifndef bcopy
  455. #define bcopy(s,d,x) memcpy(d,s,x)
  456. #endif
  457.  
  458. /* This is the parser code that is written into each bison parser
  459.   when the %semantic_parser declaration is not specified in the grammar.
  460.   It was written by Richard Stallman by simplifying the hairy parser
  461.   used when %semantic_parser is specified.  */
  462.  
  463. /* Note: there must be only one dollar sign in this file.
  464.    It is replaced by the list of actions, each action
  465.    as one case of the switch.  */
  466.  
  467. #define yyerrok        (yyerrstatus = 0)
  468. #define yyclearin    (yychar = YYEMPTY)
  469. #define YYEMPTY        -2
  470. #define YYEOF        0
  471. #define YYACCEPT    return(0)
  472. #define YYABORT     return(1)
  473. #define YYERROR        goto yyerrlab1
  474. /* Like YYERROR except do call yyerror.
  475.    This remains here temporarily to ease the
  476.    transition to the new meaning of YYERROR, for GCC.
  477.    Once GCC version 2 has supplanted version 1, this can go.  */
  478. #define YYFAIL        goto yyerrlab
  479. #define YYRECOVERING()  (!!yyerrstatus)
  480. #define YYBACKUP(token, value) \
  481. do                                \
  482.   if (yychar == YYEMPTY && yylen == 1)                \
  483.     { yychar = (token), yylval = (value);            \
  484.       yychar1 = YYTRANSLATE (yychar);                \
  485.       YYPOPSTACK;                        \
  486.       goto yybackup;                        \
  487.     }                                \
  488.   else                                \
  489.     { yyerror ("syntax error: cannot back up"); YYERROR; }    \
  490. while (0)
  491.  
  492. #define YYTERROR    1
  493. #define YYERRCODE    256
  494.  
  495. #ifndef YYIMPURE
  496. #define YYLEX        yylex()
  497. #endif
  498.  
  499. #ifndef YYPURE
  500. #define YYLEX        yylex(&yylval, &yylloc)
  501. #endif
  502.  
  503. /* If nonreentrant, generate the variables here */
  504.  
  505. #ifndef YYIMPURE
  506.  
  507. int    yychar;            /*  the lookahead symbol        */
  508. YYSTYPE    yylval;            /*  the semantic value of the        */
  509.                 /*  lookahead symbol            */
  510.  
  511. #ifdef YYLSP_NEEDED
  512. YYLTYPE yylloc;            /*  location data for the lookahead    */
  513.                 /*  symbol                */
  514. #endif
  515.  
  516. int yynerrs;            /*  number of parse errors so far       */
  517. #endif  /* YYIMPURE */
  518.  
  519. #if YYDEBUG != 0
  520. int yydebug;            /*  nonzero means print parse trace    */
  521. /* Since this is uninitialized, it does not stop multiple parsers
  522.    from coexisting.  */
  523. #endif
  524.  
  525. /*  YYINITDEPTH indicates the initial size of the parser's stacks    */
  526.  
  527. #ifndef    YYINITDEPTH
  528. #define YYINITDEPTH 200
  529. #endif
  530.  
  531. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  532.     (effective only if the built-in stack extension method is used).  */
  533.  
  534. #if YYMAXDEPTH == 0
  535. #undef YYMAXDEPTH
  536. #endif
  537.  
  538. #ifndef YYMAXDEPTH
  539. #define YYMAXDEPTH 10000
  540. #endif
  541.  
  542. /* This is the most reliable way to avoid incompatibilities
  543.    in available built-in functions on various systems.  */
  544. static void
  545. __yy_bcopy (from, to, count)
  546.      char *from;
  547.      char *to;
  548.      int count;
  549. {
  550.   register char *f = from;
  551.   register char *t = to;
  552.   register int i = count;
  553.  
  554.   while (i-- > 0)
  555.     *t++ = *f++;
  556. }
  557.  
  558.  
  559. int
  560. yyparse()
  561. {
  562.   register int yystate;
  563.   register int yyn;
  564.   register short *yyssp;
  565.   register YYSTYPE *yyvsp;
  566.   int yyerrstatus;    /*  number of tokens to shift before error messages enabled */
  567.   int yychar1;        /*  lookahead token as an internal (translated) token number */
  568.  
  569.   short    yyssa[YYINITDEPTH];    /*  the state stack            */
  570.   YYSTYPE yyvsa[YYINITDEPTH];    /*  the semantic value stack        */
  571.  
  572.   short *yyss = yyssa;        /*  refer to the stacks thru separate pointers */
  573.   YYSTYPE *yyvs = yyvsa;    /*  to allow yyoverflow to reallocate them elsewhere */
  574.  
  575. #ifdef YYLSP_NEEDED
  576.   YYLTYPE *yyls = yylsa;
  577.   YYLTYPE *yylsp;
  578.   YYLTYPE yylsa[YYINITDEPTH];    /*  the location stack            */
  579.  
  580. #define YYPOPSTACK   (yyvsp--, yysp--, yylsp--)
  581. #else
  582. #define YYPOPSTACK   (yyvsp--, yysp--)
  583. #endif
  584.  
  585.   int yystacksize = YYINITDEPTH;
  586.  
  587. #ifndef YYPURE
  588.   int yychar;
  589.   YYSTYPE yylval;
  590.   int yynerrs;
  591. #ifdef YYLSP_NEEDED
  592.   YYLTYPE yylloc;
  593. #endif
  594. #endif
  595.  
  596.   YYSTYPE yyval;        /*  the variable used to return        */
  597.                 /*  semantic values from the action    */
  598.                 /*  routines                */
  599.  
  600.   int yylen;
  601.  
  602. #if YYDEBUG != 0
  603.   if (yydebug)
  604.     fprintf(stderr, "Starting parse\n");
  605. #endif
  606.  
  607.   yystate = 0;
  608.   yyerrstatus = 0;
  609.   yynerrs = 0;
  610.   yychar = YYEMPTY;        /* Cause a token to be read.  */
  611.  
  612.   /* Initialize stack pointers.
  613.      Waste one element of value and location stack
  614.      so that they stay on the same level as the state stack.  */
  615.  
  616.   yyssp = yyss - 1;
  617.   yyvsp = yyvs;
  618. #ifdef YYLSP_NEEDED
  619.   yylsp = yyls;
  620. #endif
  621.  
  622. /* Push a new state, which is found in  yystate  .  */
  623. /* In all cases, when you get here, the value and location stacks
  624.    have just been pushed. so pushing a state here evens the stacks.  */
  625. yynewstate:
  626.  
  627.   *++yyssp = yystate;
  628.  
  629.   if (yyssp >= yyss + yystacksize - 1)
  630.     {
  631.       /* Give user a chance to reallocate the stack */
  632.       /* Use copies of these so that the &'s don't force the real ones into memory. */
  633.       YYSTYPE *yyvs1 = yyvs;
  634.       short *yyss1 = yyss;
  635. #ifdef YYLSP_NEEDED
  636.       YYLTYPE *yyls1 = yyls;
  637. #endif
  638.  
  639.       /* Get the current used size of the three stacks, in elements.  */
  640.       int size = yyssp - yyss + 1;
  641.  
  642. #ifdef yyoverflow
  643.       /* Each stack pointer address is followed by the size of
  644.      the data in use in that stack, in bytes.  */
  645.       yyoverflow("parser stack overflow",
  646.          &yyss1, size * sizeof (*yyssp),
  647.          &yyvs1, size * sizeof (*yyvsp),
  648. #ifdef YYLSP_NEEDED
  649.          &yyls1, size * sizeof (*yylsp),
  650. #endif
  651.          &yystacksize);
  652.  
  653.       yyss = yyss1; yyvs = yyvs1;
  654. #ifdef YYLSP_NEEDED
  655.       yyls = yyls1;
  656. #endif
  657. #else /* no yyoverflow */
  658.       /* Extend the stack our own way.  */
  659.       if (yystacksize >= YYMAXDEPTH)
  660.     {
  661.       yyerror("parser stack overflow");
  662.       return 2;
  663.     }
  664.       yystacksize *= 2;
  665.       if (yystacksize > YYMAXDEPTH)
  666.     yystacksize = YYMAXDEPTH;
  667.       yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  668.       __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  669.       yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  670.       __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  671. #ifdef YYLSP_NEEDED
  672.       yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  673.       __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  674. #endif
  675. #endif /* no yyoverflow */
  676.  
  677.       yyssp = yyss + size - 1;
  678.       yyvsp = yyvs + size - 1;
  679. #ifdef YYLSP_NEEDED
  680.       yylsp = yyls + size - 1;
  681. #endif
  682.  
  683. #if YYDEBUG != 0
  684.       if (yydebug)
  685.     fprintf(stderr, "Stack size increased to %d\n", yystacksize);
  686. #endif
  687.  
  688.       if (yyssp >= yyss + yystacksize - 1)
  689.     YYABORT;
  690.     }
  691.  
  692. #if YYDEBUG != 0
  693.   if (yydebug)
  694.     fprintf(stderr, "Entering state %d\n", yystate);
  695. #endif
  696.  
  697.  yybackup:
  698.  
  699. /* Do appropriate processing given the current state.  */
  700. /* Read a lookahead token if we need one and don't already have one.  */
  701. /* yyresume: */
  702.  
  703.   /* First try to decide what to do without reference to lookahead token.  */
  704.  
  705.   yyn = yypact[yystate];
  706.   if (yyn == YYFLAG)
  707.     goto yydefault;
  708.  
  709.   /* Not known => get a lookahead token if don't already have one.  */
  710.  
  711.   /* yychar is either YYEMPTY or YYEOF
  712.      or a valid token in external form.  */
  713.  
  714.   if (yychar == YYEMPTY)
  715.     {
  716. #if YYDEBUG != 0
  717.       if (yydebug)
  718.     fprintf(stderr, "Reading a token: ");
  719. #endif
  720.       yychar = YYLEX;
  721.     }
  722.  
  723.   /* Convert token to internal form (in yychar1) for indexing tables with */
  724.  
  725.   if (yychar <= 0)        /* This means end of input. */
  726.     {
  727.       yychar1 = 0;
  728.       yychar = YYEOF;        /* Don't call YYLEX any more */
  729.  
  730. #if YYDEBUG != 0
  731.       if (yydebug)
  732.     fprintf(stderr, "Now at end of input.\n");
  733. #endif
  734.     }
  735.   else
  736.     {
  737.       yychar1 = YYTRANSLATE(yychar);
  738.  
  739. #if YYDEBUG != 0
  740.       if (yydebug)
  741.     fprintf(stderr, "Next token is %d (%s)\n", yychar, yytname[yychar1]);
  742. #endif
  743.     }
  744.  
  745.   yyn += yychar1;
  746.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  747.     goto yydefault;
  748.  
  749.   yyn = yytable[yyn];
  750.  
  751.   /* yyn is what to do for this token type in this state.
  752.      Negative => reduce, -yyn is rule number.
  753.      Positive => shift, yyn is new state.
  754.        New state is final state => don't bother to shift,
  755.        just return success.
  756.      0, or most negative number => error.  */
  757.  
  758.   if (yyn < 0)
  759.     {
  760.       if (yyn == YYFLAG)
  761.     goto yyerrlab;
  762.       yyn = -yyn;
  763.       goto yyreduce;
  764.     }
  765.   else if (yyn == 0)
  766.     goto yyerrlab;
  767.  
  768.   if (yyn == YYFINAL)
  769.     YYACCEPT;
  770.  
  771.   /* Shift the lookahead token.  */
  772.  
  773. #if YYDEBUG != 0
  774.   if (yydebug)
  775.     fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
  776. #endif
  777.  
  778.   /* Discard the token being shifted unless it is eof.  */
  779.   if (yychar != YYEOF)
  780.     yychar = YYEMPTY;
  781.  
  782.   *++yyvsp = yylval;
  783. #ifdef YYLSP_NEEDED
  784.   *++yylsp = yylloc;
  785. #endif
  786.  
  787.   /* count tokens shifted since error; after three, turn off error status.  */
  788.   if (yyerrstatus) yyerrstatus--;
  789.  
  790.   yystate = yyn;
  791.   goto yynewstate;
  792.  
  793. /* Do the default action for the current state.  */
  794. yydefault:
  795.  
  796.   yyn = yydefact[yystate];
  797.   if (yyn == 0)
  798.     goto yyerrlab;
  799.  
  800. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  801. yyreduce:
  802.   yylen = yyr2[yyn];
  803.   yyval = yyvsp[1-yylen]; /* implement default value of the action */
  804.  
  805. #if YYDEBUG != 0
  806.   if (yydebug)
  807.     {
  808.       if (yylen == 1)
  809.     fprintf (stderr, "Reducing 1 value via rule %d (line %d), ",
  810.          yyn, yyrline[yyn]);
  811.       else
  812.     fprintf (stderr, "Reducing %d values via rule %d (line %d), ",
  813.          yylen, yyn, yyrline[yyn]);
  814.     }
  815. #endif
  816.  
  817.  
  818.   switch (yyn) {
  819.  
  820. case 29:
  821. {
  822.             WriteVerbatim("\n#");
  823.             WriteVerbatim(yyvsp[0].c);
  824.             WriteNewline();
  825.         ;
  826.     break;}
  827. case 30:
  828. {
  829.             NEWLINE();
  830.         ;
  831.     break;}
  832. case 31:
  833. {
  834.             NEWLINE();
  835.         ;
  836.     break;}
  837. case 43:
  838. {
  839.             NEWLINE();
  840.         ;
  841.     break;}
  842. case 45:
  843. {
  844.             NEWLINE();
  845.         ;
  846.     break;}
  847. case 56:
  848. {
  849.             NEWLINE();
  850.         ;
  851.     break;}
  852. case 57:
  853. {
  854.             NEWLINE();
  855.         ;
  856.     break;}
  857. case 58:
  858. {
  859.             NEWLINE();
  860.         ;
  861.     break;}
  862. case 59:
  863. {
  864.             NEWLINE();
  865.         ;
  866.     break;}
  867. case 60:
  868. {
  869.             NEWLINE();
  870.         ;
  871.     break;}
  872. case 61:
  873. {
  874.             NEWLINE();
  875.         ;
  876.     break;}
  877. case 62:
  878. {
  879.             NEWLINE();
  880.         ;
  881.     break;}
  882. case 63:
  883. {
  884.             NEWLINE();
  885.         ;
  886.     break;}
  887. case 64:
  888. {
  889.             NEWLINE();
  890.         ;
  891.     break;}
  892. case 65:
  893. {
  894.             NEWLINE();
  895.         ;
  896.     break;}
  897. case 66:
  898. {
  899.             NEWLINE();
  900.         ;
  901.     break;}
  902. case 67:
  903. {
  904.             NEWLINE();
  905.         ;
  906.     break;}
  907. case 68:
  908. {
  909.             NEWLINE();
  910.         ;
  911.     break;}
  912. case 71:
  913. {
  914.             NEWLINE();
  915.         ;
  916.     break;}
  917. case 72:
  918. {
  919.             WriteFloat(-yyvsp[0].d);
  920.             NEWLINE();
  921.         ;
  922.     break;}
  923. case 73:
  924. {
  925.             NEWLINE();
  926.         ;
  927.     break;}
  928. case 74:
  929. {
  930.             /* have to transpose... */
  931.             WriteFloat(yyvsp[-8].d); WriteFloat(yyvsp[-5].d); WriteFloat(yyvsp[-2].d);
  932.             WriteFloat(yyvsp[-7].d); WriteFloat(yyvsp[-4].d); WriteFloat(yyvsp[-1].d);
  933.             WriteFloat(yyvsp[-6].d); WriteFloat(yyvsp[-3].d); WriteFloat(yyvsp[0].d);
  934.             NEWLINE();
  935.         ;
  936.     break;}
  937. case 75:
  938. {
  939.             /* transpose it */
  940.             WriteFloat(yyvsp[-11].d); WriteFloat(yyvsp[-8].d); WriteFloat(yyvsp[-5].d);
  941.             WriteFloat(yyvsp[-10].d); WriteFloat(yyvsp[-7].d); WriteFloat(yyvsp[-4].d);
  942.             WriteFloat(yyvsp[-9].d); WriteFloat(yyvsp[-6].d); WriteFloat(yyvsp[-3].d);
  943.             WriteFloat(yyvsp[-2].d); WriteFloat(yyvsp[-1].d); WriteFloat(yyvsp[0].d);
  944.             NEWLINE();
  945.         ;
  946.     break;}
  947. case 76:
  948. {
  949.             NEWLINE();
  950.         ;
  951.     break;}
  952. case 77:
  953. {
  954.             NEWLINE();
  955.         ;
  956.     break;}
  957. case 78:
  958. {
  959.             NEWLINE();
  960.         ;
  961.     break;}
  962. case 79:
  963. {
  964.             NEWLINE();
  965.         ;
  966.     break;}
  967. case 80:
  968. {
  969.             NEWLINE();
  970.         ;
  971.     break;}
  972. case 81:
  973. {
  974.             NEWLINE();
  975.         ;
  976.     break;}
  977. case 82:
  978. {
  979.             WriteFloat((Float)(yyvsp[0].i+1));
  980.             NEWLINE();
  981.         ;
  982.     break;}
  983. case 83:
  984. {
  985.             NEWLINE();
  986.         ;
  987.     break;}
  988. case 84:
  989. {
  990.             NEWLINE();
  991.         ;
  992.     break;}
  993. case 85:
  994. {
  995.             NEWLINE();
  996.         ;
  997.     break;}
  998. case 86:
  999. {
  1000.             NEWLINE();
  1001.         ;
  1002.     break;}
  1003. case 87:
  1004. {
  1005.             NEWLINE();
  1006.         ;
  1007.     break;}
  1008. case 88:
  1009. {
  1010.             NEWLINE();
  1011.         ;
  1012.     break;}
  1013. case 89:
  1014. {
  1015.             NEWLINE();
  1016.         ;
  1017.     break;}
  1018. case 90:
  1019. {
  1020.             NEWLINE();
  1021.         ;
  1022.     break;}
  1023. case 91:
  1024. {
  1025.             NEWLINE();
  1026.         ;
  1027.     break;}
  1028. case 92:
  1029. {
  1030.             NEWLINE();
  1031.         ;
  1032.     break;}
  1033. case 93:
  1034. {
  1035.             NEWLINE();
  1036.         ;
  1037.     break;}
  1038. case 94:
  1039. {
  1040.             WriteFloat(yyvsp[0].d);
  1041.             WriteVector(&yyvsp[-1].v);
  1042.             NEWLINE();
  1043.         ;
  1044.     break;}
  1045. case 95:
  1046. {
  1047.             NEWLINE();
  1048.         ;
  1049.     break;}
  1050. case 96:
  1051. {
  1052.             NEWLINE();
  1053.         ;
  1054.     break;}
  1055. case 97:
  1056. {
  1057.             if (yyvsp[-6].col.r || yyvsp[-6].col.g || yyvsp[-6].col.b) {
  1058.                 WriteString("\tambient");
  1059.                 WriteColor(&yyvsp[-6].col);
  1060.                 WriteNewline();
  1061.             }
  1062.             if (yyvsp[-5].col.r || yyvsp[-5].col.g || yyvsp[-5].col.b) {
  1063.                 WriteString("\tdiffuse");
  1064.                 WriteColor(&yyvsp[-5].col);
  1065.                 WriteNewline();
  1066.             }
  1067.             if (yyvsp[-4].col.r || yyvsp[-4].col.g || yyvsp[-4].col.b) {
  1068.                 WriteString("\tspecular");
  1069.                 WriteColor(&yyvsp[-4].col);
  1070.                 WriteNewline();
  1071.                 if (yyvsp[-3].d) {
  1072.                     WriteString("\tspecpow");
  1073.                     WriteFloat(yyvsp[-3].d);
  1074.                     WriteNewline();
  1075.                 }
  1076.             }
  1077.             if (yyvsp[-2].d) {
  1078.                 WriteString("\treflect");
  1079.                 WriteFloat(yyvsp[-2].d);
  1080.                 WriteNewline();
  1081.             }
  1082.             if (yyvsp[-1].d) {
  1083.                 WriteString("\ttransp");
  1084.                 WriteFloat(yyvsp[-1].d);
  1085.                 WriteString("index");
  1086.                 WriteFloat(yyvsp[0].d);
  1087.                 WriteNewline();
  1088.             }
  1089.         ;
  1090.     break;}
  1091. case 98:
  1092. {
  1093.             if (yyvsp[-8].col.r || yyvsp[-8].col.g || yyvsp[-8].col.b) {
  1094.                 WriteString("\tambient");
  1095.                 WriteColor(&yyvsp[-8].col);
  1096.                 WriteNewline();
  1097.             }
  1098.             if (yyvsp[-7].col.r || yyvsp[-7].col.g || yyvsp[-7].col.b) {
  1099.                 WriteString("\tdiffuse");
  1100.                 WriteColor(&yyvsp[-7].col);
  1101.                 WriteNewline();
  1102.             }
  1103.             if (yyvsp[-6].col.r || yyvsp[-6].col.g || yyvsp[-6].col.b) {
  1104.                 WriteString("\tspecular");
  1105.                 WriteColor(&yyvsp[-6].col);
  1106.                 WriteNewline();
  1107.                 if (yyvsp[-5].d) {
  1108.                     WriteString("\tspecpow");
  1109.                     WriteFloat(yyvsp[-5].d);
  1110.                     WriteNewline();
  1111.                 }
  1112.             }
  1113.             if (yyvsp[-4].d) {
  1114.                 WriteString("\treflect");
  1115.                 WriteFloat(yyvsp[-4].d);
  1116.                 WriteNewline();
  1117.             }
  1118.             if (yyvsp[-3].d) {
  1119.                 WriteString("\ttransp");
  1120.                 WriteFloat(yyvsp[-3].d);
  1121.                 WriteString("index");
  1122.                 WriteFloat(yyvsp[-2].d);
  1123.                 WriteNewline();
  1124.             }
  1125.             if (yyvsp[-1].d) {
  1126.                 WriteString("\ttranslu");
  1127.                 WriteFloat(yyvsp[-1].d);
  1128.                 WriteString("1 1 1");
  1129.                 WriteFloat(yyvsp[0].d);
  1130.                 WriteNewline();
  1131.             }
  1132.         ;
  1133.     break;}
  1134. case 99:
  1135. {
  1136.             NEWLINE();
  1137.         ;
  1138.     break;}
  1139. case 100:
  1140. {
  1141.             NEWLINE();
  1142.         ;
  1143.     break;}
  1144. case 103:
  1145. {
  1146.             NEWLINE();
  1147.         ;
  1148.     break;}
  1149. case 104:
  1150. {
  1151.             /* Radii now precede points */
  1152.             WriteFloat(yyvsp[-1].d);
  1153.             WriteVector(&yyvsp[-3].v);
  1154.             WriteFloat(yyvsp[0].d);
  1155.             WriteVector(&yyvsp[-2].v);
  1156.             NEWLINE();
  1157.         ;
  1158.     break;}
  1159. case 105:
  1160. {
  1161.             Vector tmp;
  1162.  
  1163.             WriteString(yyvsp[-3].c);
  1164.             /* Radius now goes first */
  1165.             WriteFloat(yyvsp[0].d);
  1166.             WriteVector(&yyvsp[-2].v);
  1167.             WriteVector(&yyvsp[-1].v);
  1168.             NEWLINE();
  1169.             WriteVerbatim("#ifdef ENDCAPS\n");
  1170.                 VecSub(yyvsp[-2].v, yyvsp[-1].v, &tmp);
  1171.                 WriteVerbatim("disc ");
  1172.                 WriteString(yyvsp[-3].c);
  1173.                 WriteFloat(yyvsp[0].d);    /* radius */
  1174.                 WriteVector(&yyvsp[-2].v); /* pos */
  1175.                 WriteVector(&tmp);
  1176.                 WriteVerbatim("\ndisc ");
  1177.                 WriteString(yyvsp[-3].c);
  1178.                 VecScale(-1, tmp, &tmp);
  1179.                 WriteFloat(yyvsp[0].d);    /* radius */
  1180.                 WriteVector(&yyvsp[-1].v); /* pos */
  1181.                 WriteVector(&tmp);
  1182.             WriteVerbatim("\n#endif\n");
  1183.         ;
  1184.     break;}
  1185. case 106:
  1186. {
  1187.             NEWLINE();
  1188.         ;
  1189.     break;}
  1190. case 107:
  1191. {
  1192.             /* give box corners */
  1193.             WriteFloat(yyvsp[-5].d - yyvsp[-2].d);
  1194.             WriteFloat(yyvsp[-4].d - yyvsp[-1].d);
  1195.             WriteFloat(yyvsp[-3].d - yyvsp[0].d);
  1196.             WriteFloat(yyvsp[-5].d + yyvsp[-2].d);
  1197.             WriteFloat(yyvsp[-4].d + yyvsp[-1].d);
  1198.             WriteFloat(yyvsp[-3].d + yyvsp[0].d);
  1199.             NEWLINE();
  1200.         ;
  1201.     break;}
  1202. case 108:
  1203. {
  1204.             NEWLINE();
  1205.         ;
  1206.     break;}
  1207. case 109:
  1208. {
  1209.             NEWLINE();
  1210.         ;
  1211.     break;}
  1212. case 110:
  1213. {
  1214.             WriteVerbatim("*/");
  1215.             NEWLINE();
  1216.         ;
  1217.     break;}
  1218. case 111:
  1219. {
  1220.             /* reverse order of point/normal */
  1221.             WriteVector(&yyvsp[0].v);
  1222.             WriteVector(&yyvsp[-1].v);
  1223.             NEWLINE();
  1224.         ;
  1225.     break;}
  1226. case 112:
  1227. {
  1228.             NEWLINE();
  1229.         ;
  1230.     break;}
  1231. case 113:
  1232. {
  1233.             NEWLINE();
  1234.         ;
  1235.     break;}
  1236. case 114:
  1237. {
  1238.             WriteColor(&yyvsp[0].col);
  1239.             WriteFloat(yyvsp[-1].d); WriteFloat(yyvsp[-1].d); WriteFloat(yyvsp[-1].d);
  1240.             NEWLINE();
  1241.         ;
  1242.     break;}
  1243. case 116:
  1244. {
  1245.             yyval.col.r = yyvsp[-2].d; yyval.col.g = yyvsp[-1].d; yyval.col.b = yyvsp[0].d;
  1246.         ;
  1247.     break;}
  1248. case 118:
  1249. {
  1250.             yyval.v.x = yyvsp[-2].d; yyval.v.y = yyvsp[-1].d; yyval.v.z = yyvsp[0].d;
  1251.         ;
  1252.     break;}
  1253. case 119:
  1254. { WriteFloat(yyvsp[0].d); ;
  1255.     break;}
  1256. case 120:
  1257. { WriteFloat((Float)yyvsp[0].i); ;
  1258.     break;}
  1259. case 121:
  1260. { WriteFloat((Float)yyvsp[0].i); ;
  1261.     break;}
  1262. case 122:
  1263. { yyval.i = (int)yyvsp[0].i; ;
  1264.     break;}
  1265. case 124:
  1266. { yyval.d = (double)yyvsp[0].i; ;
  1267.     break;}
  1268. case 125:
  1269. { WriteString(yyvsp[0].c); ;
  1270.     break;}
  1271. case 126:
  1272. { yyval.c = yyvsp[0].c; ;
  1273.     break;}
  1274. case 127:
  1275. { WriteString("samples"); ;
  1276.     break;}
  1277. case 128:
  1278. { WriteString("aperture"); ;
  1279.     break;}
  1280. case 129:
  1281. { WriteString("background"); ;
  1282.     break;}
  1283. case 130:
  1284. { WriteString("blotch"); ;
  1285.     break;}
  1286. case 131:
  1287. { WriteString("box"); ;
  1288.     break;}
  1289. case 132:
  1290. { WriteString("bump"); ;
  1291.     break;}
  1292. case 133:
  1293. { WriteString("cone"); ;
  1294.     break;}
  1295. case 134:
  1296. { WriteString("cylinder"); ;
  1297.     break;}
  1298. case 135:
  1299. { WriteString("directional"); ;
  1300.     break;}
  1301. case 136:
  1302. { EndDefine(); ;
  1303.     break;}
  1304. case 137:
  1305. { WriteString("extended"); ;
  1306.     break;}
  1307. case 138:
  1308. { WriteString("eyep"); ;
  1309.     break;}
  1310. case 139:
  1311. { WriteString("fbm"); ;
  1312.     break;}
  1313. case 140:
  1314. { WriteString("fbmbump"); ;
  1315.     break;}
  1316. case 141:
  1317. { WriteString("focaldist"); ;
  1318.     break;}
  1319. case 142:
  1320. { WriteString("atmosphere fog"); ;
  1321.     break;}
  1322. case 143:
  1323. { WriteString("fov"); ;
  1324.     break;}
  1325. case 144:
  1326. { WriteString("gloss"); ;
  1327.     break;}
  1328. case 145:
  1329. { SetTypeGrid(yyvsp[-2].i,yyvsp[-1].i,yyvsp[0].i); ;
  1330.     break;}
  1331. case 146:
  1332. { WriteString("heightfield"); ;
  1333.     break;}
  1334. case 147:
  1335. { WriteString("jittered"); ;
  1336.     break;}
  1337. case 148:
  1338. { WriteString("light"); ;
  1339.     break;}
  1340. case 149:
  1341. { SetTypeList(); ;
  1342.     break;}
  1343. case 150:
  1344. { WriteString("lookp"); ;
  1345.     break;}
  1346. case 151:
  1347. { WriteString("marble"); ;
  1348.     break;}
  1349. case 152:
  1350. { WriteString("maxdepth"); ;
  1351.     break;}
  1352. case 153:
  1353. { WriteString("atmosphere mist"); ;
  1354.     break;}
  1355. case 154:
  1356. { WriteString("object"); ;
  1357.     break;}
  1358. case 155:
  1359. { WriteString("outfile"); ;
  1360.     break;}
  1361. case 156:
  1362. { WriteString("plane"); ;
  1363.     break;}
  1364. case 157:
  1365. { WriteString("point"); ;
  1366.     break;}
  1367. case 158:
  1368. { WriteString("poly"); ;
  1369.     break;}
  1370. case 159:
  1371. { WriteString("rotate"); ;
  1372.     break;}
  1373. case 160:
  1374. { WriteString("samples"); ;
  1375.     break;}
  1376. case 161:
  1377. { WriteString("scale"); ;
  1378.     break;}
  1379. case 162:
  1380. { WriteString("screen"); ;
  1381.     break;}
  1382. case 163:
  1383. { WriteString("sphere"); ;
  1384.     break;}
  1385. case 164:
  1386. { StartDefine(yyvsp[0].c); ;
  1387.     break;}
  1388. case 165:
  1389. { WriteString("/* superq"); ;
  1390.     break;}
  1391. case 166:
  1392. { WriteString("surface"); ;
  1393.     break;}
  1394. case 167:
  1395. { WriteString("resolution"); ;
  1396.     break;}
  1397. case 168:
  1398. { WriteString("translate"); ;
  1399.     break;}
  1400. case 169:
  1401. { WriteString("transform"); ;
  1402.     break;}
  1403. case 170:
  1404. { WriteString("triangle"); ;
  1405.     break;}
  1406. case 171:
  1407. { WriteString("up"); ;
  1408.     break;}
  1409. case 172:
  1410. { /* Don't do a thing. */ ;
  1411.     break;}
  1412. case 173:
  1413. { WriteString("texture"); ;
  1414.     break;}
  1415. case 174:
  1416. { WriteString("checker"); ;
  1417.     break;}
  1418. case 175:
  1419. { WriteString("wood"); ;
  1420.     break;}
  1421. case 176:
  1422. { WriteString("contrast"); ;
  1423.     break;}
  1424. case 177:
  1425. { WriteString("cutoff"); ;
  1426.     break;}
  1427. }
  1428.    /* the action file gets copied in in place of this dollarsign */
  1429.  
  1430.  
  1431.   yyvsp -= yylen;
  1432.   yyssp -= yylen;
  1433. #ifdef YYLSP_NEEDED
  1434.   yylsp -= yylen;
  1435. #endif
  1436.  
  1437. #if YYDEBUG != 0
  1438.   if (yydebug)
  1439.     {
  1440.       short *ssp1 = yyss - 1;
  1441.       fprintf (stderr, "state stack now");
  1442.       while (ssp1 != yyssp)
  1443.     fprintf (stderr, " %d", *++ssp1);
  1444.       fprintf (stderr, "\n");
  1445.     }
  1446. #endif
  1447.  
  1448.   *++yyvsp = yyval;
  1449.  
  1450. #ifdef YYLSP_NEEDED
  1451.   yylsp++;
  1452.   if (yylen == 0)
  1453.     {
  1454.       yylsp->first_line = yylloc.first_line;
  1455.       yylsp->first_column = yylloc.first_column;
  1456.       yylsp->last_line = (yylsp-1)->last_line;
  1457.       yylsp->last_column = (yylsp-1)->last_column;
  1458.       yylsp->text = 0;
  1459.     }
  1460.   else
  1461.     {
  1462.       yylsp->last_line = (yylsp+yylen-1)->last_line;
  1463.       yylsp->last_column = (yylsp+yylen-1)->last_column;
  1464.     }
  1465. #endif
  1466.  
  1467.   /* Now "shift" the result of the reduction.
  1468.      Determine what state that goes to,
  1469.      based on the state we popped back to
  1470.      and the rule number reduced by.  */
  1471.  
  1472.   yyn = yyr1[yyn];
  1473.  
  1474.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1475.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1476.     yystate = yytable[yystate];
  1477.   else
  1478.     yystate = yydefgoto[yyn - YYNTBASE];
  1479.  
  1480.   goto yynewstate;
  1481.  
  1482. yyerrlab:   /* here on detecting error */
  1483.  
  1484.   if (! yyerrstatus)
  1485.     /* If not already recovering from an error, report this error.  */
  1486.     {
  1487.       ++yynerrs;
  1488.  
  1489. #ifdef YYERROR_VERBOSE
  1490.       yyn = yypact[yystate];
  1491.  
  1492.       if (yyn > YYFLAG && yyn < YYLAST)
  1493.     {
  1494.       int size = 0;
  1495.       char *msg;
  1496.       int x, count;
  1497.  
  1498.       count = 0;
  1499.       for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  1500.         if (yycheck[x + yyn] == x)
  1501.           size += strlen(yytname[x]) + 15, count++;
  1502.       msg = (char *) xmalloc(size + 15);
  1503.       strcpy(msg, "parse error");
  1504.  
  1505.       if (count < 5)
  1506.         {
  1507.           count = 0;
  1508.           for (x = 0; x < (sizeof(yytname) / sizeof(char *)); x++)
  1509.         if (yycheck[x + yyn] == x)
  1510.           {
  1511.             strcat(msg, count == 0 ? ", expecting `" : " or `");
  1512.             strcat(msg, yytname[x]);
  1513.             strcat(msg, "'");
  1514.             count++;
  1515.           }
  1516.         }
  1517.       yyerror(msg);
  1518.       free(msg);
  1519.     }
  1520.       else
  1521. #endif /* YYERROR_VERBOSE */
  1522.     yyerror("parse error");
  1523.     }
  1524.  
  1525. yyerrlab1:   /* here on error raised explicitly by an action */
  1526.  
  1527.   if (yyerrstatus == 3)
  1528.     {
  1529.       /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1530.  
  1531.       /* return failure if at end of input */
  1532.       if (yychar == YYEOF)
  1533.     YYABORT;
  1534.  
  1535. #if YYDEBUG != 0
  1536.       if (yydebug)
  1537.     fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
  1538. #endif
  1539.  
  1540.       yychar = YYEMPTY;
  1541.     }
  1542.  
  1543.   /* Else will try to reuse lookahead token
  1544.      after shifting the error token.  */
  1545.  
  1546.   yyerrstatus = 3;        /* Each real token shifted decrements this */
  1547.  
  1548.   goto yyerrhandle;
  1549.  
  1550. yyerrdefault:  /* current state does not do anything special for the error token. */
  1551.  
  1552. #if 0
  1553.   /* This is wrong; only states that explicitly want error tokens
  1554.      should shift them.  */
  1555.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1556.   if (yyn) goto yydefault;
  1557. #endif
  1558.  
  1559. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1560.  
  1561.   if (yyssp == yyss) YYABORT;
  1562.   yyvsp--;
  1563.   yystate = *--yyssp;
  1564. #ifdef YYLSP_NEEDED
  1565.   yylsp--;
  1566. #endif
  1567.  
  1568. #if YYDEBUG != 0
  1569.   if (yydebug)
  1570.     {
  1571.       short *ssp1 = yyss - 1;
  1572.       fprintf (stderr, "Error: state stack now");
  1573.       while (ssp1 != yyssp)
  1574.     fprintf (stderr, " %d", *++ssp1);
  1575.       fprintf (stderr, "\n");
  1576.     }
  1577. #endif
  1578.  
  1579. yyerrhandle:
  1580.  
  1581.   yyn = yypact[yystate];
  1582.   if (yyn == YYFLAG)
  1583.     goto yyerrdefault;
  1584.  
  1585.   yyn += YYTERROR;
  1586.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1587.     goto yyerrdefault;
  1588.  
  1589.   yyn = yytable[yyn];
  1590.   if (yyn < 0)
  1591.     {
  1592.       if (yyn == YYFLAG)
  1593.     goto yyerrpop;
  1594.       yyn = -yyn;
  1595.       goto yyreduce;
  1596.     }
  1597.   else if (yyn == 0)
  1598.     goto yyerrpop;
  1599.  
  1600.   if (yyn == YYFINAL)
  1601.     YYACCEPT;
  1602.  
  1603. #if YYDEBUG != 0
  1604.   if (yydebug)
  1605.     fprintf(stderr, "Shifting error token, ");
  1606. #endif
  1607.  
  1608.   *++yyvsp = yylval;
  1609. #ifdef YYLSP_NEEDED
  1610.   *++yylsp = yylloc;
  1611. #endif
  1612.  
  1613.   yystate = yyn;
  1614.   goto yynewstate;
  1615. }
  1616.  
  1617.  
  1618. #define STARTBUFSIZ    (1 << 18)
  1619.  
  1620. typedef struct db {
  1621.     int bufsiz, curpos;
  1622.     int type, x, y, z;
  1623.     char *name;
  1624.     struct db *next;
  1625.     char *memory;
  1626. } DefBuf;
  1627.  
  1628. DefBuf *defbuf = NULL;
  1629.  
  1630. void yyerror(char *s)
  1631. {
  1632.     fprintf(stderr,"rsconvert: %s, line %d: %s \n",
  1633.             yyfilename[0] ? yyfilename : "stdin",
  1634.             yylineno, s);
  1635. }
  1636.  
  1637. StartDefine(name)
  1638. char *name;
  1639. {
  1640.     DefBuf *new;
  1641.     /*
  1642.      * Push new buffer onto define stack.
  1643.      */    
  1644.     new = (DefBuf *)RayMalloc(sizeof(DefBuf));
  1645.     new->bufsiz = STARTBUFSIZ;
  1646.     new->type = LIST;
  1647.     new->curpos = 0;
  1648.     new->name = name;
  1649.     new->memory = (char *)Calloc(new->bufsiz, sizeof(char));
  1650.     new->next = defbuf;
  1651.     defbuf = new;
  1652. }
  1653.  
  1654. EndDefine()
  1655. {
  1656.     char buf[BUFSIZ];
  1657.     DefBuf *old;
  1658.  
  1659.     old = defbuf;
  1660.     defbuf = defbuf->next;
  1661.     if (old->type == LIST) {
  1662.         sprintf(buf, "name %s list", old->name);
  1663.     } else {
  1664.         sprintf(buf, "name %s grid %d %d %d", old->name,
  1665.                 old->x, old->y, old->z);
  1666.     }
  1667.     /*
  1668.      * dump goodies
  1669.      */
  1670.     WriteVerbatim(buf);
  1671.     WriteVerbatim(old->memory);
  1672.     WriteVerbatim("end");
  1673.     free((voidstar)old->memory);
  1674.     free((voidstar)old);
  1675.     
  1676. }
  1677.  
  1678. WriteString(str)
  1679. char *str;
  1680. {
  1681.     WriteVerbatim(str);
  1682.     WriteChar(' ');
  1683. }
  1684.  
  1685. WriteVerbatim(str)
  1686. char *str;
  1687. {
  1688.     int n;
  1689.  
  1690.     for (n = strlen(str); n; n--)
  1691.         WriteChar(*(str++));
  1692. }
  1693.  
  1694. WriteChar(c)
  1695. char c;
  1696. {
  1697.     if (defbuf) {
  1698.         if (defbuf->curpos == defbuf->bufsiz -1) {
  1699.             defbuf->bufsiz *= 2;
  1700.             defbuf->memory = (char *)realloc(defbuf->memory,
  1701.                 defbuf->bufsiz * sizeof(char));
  1702.             if (defbuf->memory == (char *)NULL) {
  1703.                 fprintf(stderr,"realloc failed!\n");
  1704.                 exit(-1);
  1705.             }
  1706.         }
  1707.         defbuf->memory[defbuf->curpos++] = c;
  1708.         defbuf->memory[defbuf->curpos] = (char)NULL;
  1709.     } else
  1710.         putchar(c);
  1711. }
  1712.  
  1713. WriteVector(v)
  1714. Vector *v;
  1715. {
  1716.     WriteFloat(v->x);
  1717.     WriteFloat(v->y);
  1718.     WriteFloat(v->z);
  1719. }
  1720.  
  1721. WriteFloat(x)
  1722. Float x;
  1723. {
  1724.     char buf[BUFSIZ];
  1725.     sprintf(buf, "%g ", x);
  1726.     WriteVerbatim(buf);
  1727. }
  1728.  
  1729. WriteNewline()
  1730. {
  1731.     WriteVerbatim("\n");
  1732. }
  1733.  
  1734. SetTypeList()
  1735. {
  1736.     if (defbuf)
  1737.         defbuf->type = LIST;
  1738.     /* else set world type */
  1739. }
  1740.  
  1741. SetTypeGrid(x,y,z)
  1742. int x, y, z;
  1743. {
  1744.     if (defbuf) {
  1745.         defbuf->type = GRID;
  1746.         defbuf->x = x; defbuf->y = y; defbuf->z = z;
  1747.     } /* else set world type */
  1748. }
  1749.  
  1750. WriteColor(c)
  1751. Color *c;
  1752. {
  1753.     WriteFloat(c->r);
  1754.     WriteFloat(c->g);
  1755.     WriteFloat(c->b);
  1756. }
  1757.