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.y < prev    next >
Text File  |  1990-05-08  |  15KB  |  725 lines

  1. /* input_yacc.y                                    */
  2. /*                                        */
  3. /* Copyright (C) 1989, Craig E. Kolb                        */
  4. /*                                        */
  5. /* This software may be freely copied, modified, and redistributed,        */
  6. /* provided that this copyright notice is preserved on all copies.        */
  7. /*                                         */
  8. /* There is no warranty or other guarantee of fitness for this software,    */
  9. /* it is provided solely "as is".  Bug reports or fixes may be sent        */
  10. /* to the author, who may or may not act on them as he desires.            */
  11. /*                                        */
  12. /* You may not include this software in a program or other software product */
  13. /* without supplying the source, or without informing the end-user that the */
  14. /* source is available for no extra charge.                    */
  15. /*                                        */
  16. /* If you modify this software, you should include a notice giving the        */
  17. /* name of the person performing the modification, the date of modification,*/
  18. /* and the reason for such modification.                    */
  19. /*                                        */
  20. /* $Id: input_yacc.y,v 3.0.1.9 90/04/04 18:58:50 craig Exp $ */
  21. %{
  22. #include <stdio.h>
  23. #include "constants.h"
  24. #include "typedefs.h"
  25. #include "funcdefs.h"
  26. #include "texture.h"
  27. #include "atmosphere.h"
  28.  
  29. char yyfilename[BUFSIZ];
  30. int Npoints=0, CurXSize, CurYSize, CurZSize;
  31. Object    *LastObj = (Object *)0;
  32. ObjList *CurObj, *ListTmp;
  33. Surface *stmp;
  34. Texture *CurText;
  35. TransInfo *CurTrans = (TransInfo *)0, CurITrans;
  36. PointList *Polypoints, *Point;
  37. extern FILE *yyin;
  38. extern Object *World;
  39. extern int WorldXSize, WorldYSize, WorldZSize, nlight, Xres, Yres, maxlevel;
  40. extern int yylineno, Jittered, JitSamples, pixel_div;
  41. extern int ResolutionSet, ContrastSet, SamplesSet, CutoffSet;
  42. extern int AdaptiveSet, JitteredSet;
  43. extern double hfov, vfov, RedContrast, GreenContrast, BlueContrast;
  44. extern double TreeCutoff, aperture, focaldist;
  45. extern Vector eyep, lookp, up;
  46. extern char outfilename[];
  47. extern Color background;
  48. extern SurfaceList *Surfaces;
  49. extern Light light[];
  50. extern Fog *GlobalFog;
  51. extern Mist *GlobalMist;
  52. %}
  53. %union {
  54.     char *c;
  55.     int i;
  56.     double d;
  57.     Vector v;
  58.     Color col;
  59.     struct Texture *text;
  60. }
  61. %token <i> tINT
  62. %token <d> tFLOAT
  63. %token <c> tSTRING
  64. %token tADAPTIVE tAPERTURE 
  65. %token tBACKGROUND tBLOTCH tBOX tBUMP tCONE tCYL tDIRECTIONAL
  66. %token tENDDEF tEXTENDED tEYEP tFBM tFBMBUMP tFOCALDIST tFOG tFOV tGLOSS tGRID
  67. %token tHEIGHTFIELD tJITTERED tLIGHT tLIST tLOOKP tMARBLE tMAXDEPTH tMIST
  68. %token tOBJECT tOUTFILE
  69. %token tPLANE tPOINT tPOLY tROTATE tSAMPLES
  70. %token tSCALE tSCREEN tSPHERE tSTARTDEF tSUPERQ tSURFACE tRESOLUTION
  71. %token tTHRESH tTRANSLATE tTRANSFORM tTRIANGLE tUP tENDFILE
  72. %token tTEXTURE tCHECKER tWOOD tCONTRAST tCUTOFF
  73. %type <d> Fnumber
  74. %type <c> String
  75. %type <v> Vector
  76. %type <col> Color
  77. %type <text> Texturetype
  78. %%
  79. Items        : /* empty */
  80.         | Items Item
  81.         ;
  82. Item        : Eyep
  83.         | Lookp
  84.         | Up
  85.         | Fov
  86.         | Screen
  87.         | Aperture
  88.         | Focaldist
  89.         | Maxdepth
  90.         | Samples
  91.         | Jittered
  92.         | Adaptive
  93.         | Contrast
  94.         | Cutoff
  95.         | Background
  96.         | Light
  97.         | Primitive
  98.         | Child
  99.         | Surface
  100.         | Outfile
  101.         | List
  102.         | Grid
  103.         | Object
  104.         | Fog
  105.         | Mist
  106.         | tENDFILE        /* For backward compatibility */
  107.         ;
  108. List        : tLIST
  109.         {
  110.             if (CurObj->data)
  111.                 CurObj->data->type = LIST;
  112.             else
  113.                 World->type = LIST;
  114.         }
  115.         ;
  116. Grid        : tGRID tINT tINT tINT
  117.         {
  118.             if (CurObj->data) {
  119.                 CurObj->data->type = GRID;
  120.                 CurXSize = $2;
  121.                 CurYSize = $3;
  122.                 CurZSize = $4;
  123.             } else {
  124.                 World->type = GRID;
  125.                 WorldXSize = $2;
  126.                 WorldYSize = $3;
  127.                 WorldZSize = $4;
  128.             }
  129.         }
  130.         ;
  131. Primitive    : Prim Textures
  132.         {
  133.             if (LastObj) {
  134.                 /* User may have botched prim. def. */
  135.                 LastObj->texture = CurText;
  136.                 if (CurObj->data)
  137.                     CurObj->data->prims++;
  138.                 else
  139.                     World->prims++;
  140.             }
  141.             CurText = (Texture *)0;
  142.             LastObj = (Object *)0;
  143.         }
  144.         ;
  145. Prim        : Primtype Transforms
  146.         {
  147.             if (LastObj != (Object *)0) {
  148.                 /*
  149.                  * Compute boundings box of primitive.
  150.                  * if box's low X is > its high X,
  151.                  * then the prim is unbounded.
  152.                  */
  153.                 set_prim_bounds(LastObj);
  154.                 /*
  155.                  * Add primitive to current object
  156.                  * list.  When the obj. def. is complete
  157.                  * make_list() will calculate the
  158.                  * bounding box of the entire object.
  159.                  */
  160.                 add_prim(LastObj, CurObj->data);
  161.                 if (CurTrans) {
  162.                     /*
  163.                      * Compute the bounding box of the
  164.                      * transformed object.
  165.                      */
  166.                     transform_bounds(CurTrans,
  167.                             LastObj->bounds);
  168.                     invert_trans(&CurITrans, CurTrans);
  169.                     LastObj->trans = new_trans(CurTrans,
  170.                                 &CurITrans);
  171.                     free((char *)CurTrans);
  172.                     CurTrans = (TransInfo *)0;
  173.                 }
  174.             } else {
  175.                 /*
  176.                  * There was something wrong with the def.
  177.                  */
  178.                 if (CurTrans) {
  179.                     free((char *)CurTrans);
  180.                     CurTrans = (TransInfo *)0;
  181.                 }
  182.             }
  183.         }
  184.         ;
  185. Primtype    : Plane
  186.         | Sphere
  187.         | Box
  188.         | Triangle
  189.         | Cylinder
  190.         | Cone
  191.         | Superq
  192.         | Poly
  193.         | HeightField
  194.         ;
  195. Object        : Objectdef Textures
  196.         {
  197.             CurObj->data->texture = CurText;
  198.             CurText = (Texture *)0;
  199.             ListTmp = CurObj->next;
  200.             free((char *)CurObj);
  201.             CurObj = ListTmp;
  202.         }
  203.         ;
  204. Objectdef    : Startdef Objdefs tENDDEF
  205.         {
  206.             /*
  207.              * Object definition.
  208.              */
  209.             LastObj = (Object *)NULL;
  210.             if (CurObj->data->data == (char *)0) {
  211.                 yywarning("Null object \"%s\" defined.\n",
  212.                     CurObj->data->name);
  213.             } else {
  214.                 if (CurObj->data->type == GRID) {
  215.                     list2grid(CurObj->data, CurXSize,
  216.                         CurYSize, CurZSize);
  217.                 } else {
  218.                     /*
  219.                       * Object is a list -- transform the
  220.                       * linked list (ObjList) into a List.
  221.                       */
  222.                     make_list(CurObj->data);
  223.                 }
  224.                 /*
  225.                   * Add this new object to the list of
  226.                   * defined objects.
  227.                   */
  228.                 add_to_objects(CurObj->data);
  229.             }
  230.         }
  231.         ;
  232. Startdef    : tSTARTDEF String
  233.         /*
  234.          * define <name>
  235.          */
  236.         {
  237.             /*
  238.              * Once we know the bounding box of this object
  239.              * (and the user hasn't specified that this object
  240.              * is stored in a List), then we enlist everything
  241.              * it contains.
  242.              * The new object's DATA field points to an ObjList
  243.              * until the definition complete, when the ObjList
  244.              * is then turned into either a Grid or a List.
  245.              */
  246.             ListTmp = (ObjList *)Malloc(sizeof(ObjList));
  247.             ListTmp->data = new_object($2, LIST, (char *)NULL,
  248.                         (Trans *)NULL);
  249.             ListTmp->next = CurObj;
  250.             CurObj = ListTmp;
  251.         }
  252.         ;
  253. Objdefs        : Objdefs Objdef
  254.         |
  255.         ;
  256. Objdef        : Primitive
  257.         | Surface
  258.         | Child
  259.         | List
  260.         | Grid
  261.         | Object
  262.         ;
  263. Textures    : Textures Texture
  264.         |
  265.         ;
  266. Texture        : tTEXTURE Texturetype Transforms
  267.         {
  268.             /*
  269.              * Set transformation information.
  270.              */
  271.             if (CurTrans) {
  272.                 invert_trans(&CurITrans, CurTrans);
  273.                 $2->trans = new_trans(CurTrans,&CurITrans);
  274.                 free((char *)CurTrans);
  275.                 CurTrans = (TransInfo *)NULL;
  276.             }
  277.             /*
  278.              * Walk to the end of list of textures and
  279.              * append new texture.  This is done so that
  280.              * textures are implied in the expected order.
  281.              */
  282.             {
  283.                 Texture *tp;
  284.  
  285.                 $2->next = (Texture *)0;
  286.  
  287.                 if (CurText) {
  288.                     for (tp=CurText;tp->next;tp=tp->next)
  289.                             ;
  290.                     tp->next = $2;
  291.  
  292.                 } else {
  293.                     CurText = $2;
  294.                 }
  295.             }
  296.         }
  297.         ;
  298. Texturetype    : tCHECKER String
  299.         {
  300.             $$ = NewCheckText($2);
  301.         }
  302.         | tBLOTCH Fnumber String
  303.         {
  304.             $$ = NewBlotchText($2, $3);
  305.         }
  306.         | tBUMP Fnumber
  307.         {
  308.             $$ = NewBumpText($2);
  309.         }
  310.         | tMARBLE
  311.         {
  312.             $$ = NewMarbleText((char *)NULL);
  313.         }
  314.         | tMARBLE String
  315.         {
  316.             $$ = NewMarbleText($2);
  317.         }
  318.         | tFBM Fnumber Fnumber Fnumber Fnumber tINT Fnumber
  319.         {
  320.             $$ = NewfBmText($2, $3, $4, $5, $6, $7, (char *)0);
  321.         }
  322.         | tFBM Fnumber Fnumber Fnumber Fnumber tINT Fnumber tSTRING
  323.         {
  324.             $$ = NewfBmText($2, $3, $4, $5, $6, $7, $8);
  325.         }
  326.         | tFBMBUMP Fnumber Fnumber Fnumber Fnumber tINT
  327.         {
  328.             $$ = NewfBmBumpText($2, $3, $4, $5, $6);
  329.         }
  330.         | tWOOD
  331.         {
  332.             $$ = NewWoodText();
  333.         }
  334.         | tGLOSS Fnumber
  335.         {
  336.             $$ = NewGlossText($2);
  337.         }
  338.         ;
  339. Child        : Childdef Textures
  340.         {
  341.             LastObj->texture = CurText;
  342.             CurText = (Texture *)0;
  343.             LastObj = (Object *)0;
  344.         }
  345.         ;
  346. Childdef    : tOBJECT String Transforms
  347.         {
  348.             LastObj = add_child_named($2, CurObj->data);
  349.             if (CurTrans) {
  350.                 transform_bounds(CurTrans, LastObj->bounds);
  351.                 invert_trans(&CurITrans, CurTrans);
  352.                 if (LastObj->trans) {
  353.                     mmult(&LastObj->trans->obj2world,
  354.                         CurTrans,
  355.                         &LastObj->trans->obj2world);
  356.                     mmult(&LastObj->trans->world2obj,
  357.                         &CurITrans,
  358.                         &LastObj->trans->world2obj);
  359.                 } else
  360.                     LastObj->trans = new_trans(CurTrans,
  361.                                 &CurITrans);
  362.                 free((char *)CurTrans);
  363.                 CurTrans = (TransInfo *)NULL;
  364.             }
  365.         }
  366.         ;
  367. Transforms    : Transforms Transform
  368.         | /* empty */
  369.         ;
  370. Transform    : tTRANSLATE Vector
  371.         {
  372.             if (CurTrans == (TransInfo *)0)
  373.                 CurTrans = new_transinfo();
  374.             RS_translate(CurTrans, &($2));
  375.         }
  376.         | tROTATE Vector Fnumber
  377.         {
  378.             if (CurTrans == (TransInfo *)0)
  379.                 CurTrans = new_transinfo();
  380.  
  381.             RS_rotate(CurTrans, &($2), deg2rad($3));
  382.         }
  383.         | tSCALE Fnumber Fnumber Fnumber
  384.         {
  385.             if (CurTrans == (TransInfo *)0)
  386.                 CurTrans = new_transinfo();
  387.             RS_scale(CurTrans, $2, $3, $4);
  388.         }
  389.         | tTRANSFORM Fnumber Fnumber Fnumber
  390.                 Fnumber Fnumber Fnumber
  391.                 Fnumber Fnumber Fnumber
  392.         {
  393.             if (CurTrans == (TransInfo *)0)
  394.                 CurTrans = new_transinfo();
  395.             explicit_trans(CurTrans,
  396.                 $2, $3, $4, $5, $6, $7, $8, $9, $10,
  397.                 0., 0., 0., CurTrans);
  398.         }
  399.         | tTRANSFORM Fnumber Fnumber Fnumber
  400.                 Fnumber Fnumber Fnumber
  401.                 Fnumber Fnumber Fnumber
  402.                 Fnumber Fnumber Fnumber
  403.         {
  404.             if (CurTrans == (TransInfo *)0)
  405.                 CurTrans = new_transinfo();
  406.             explicit_trans(CurTrans,
  407.                 $2, $3, $4, $5, $6, $7, $8, $9, $10,
  408.                 $11, $12, $13,CurTrans);
  409.         }
  410.         ;
  411. Eyep        : tEYEP Vector Transforms
  412.         {
  413.             eyep = $2;
  414.             if (CurTrans) {
  415.                 transform_point(&eyep, CurTrans);
  416.                 free((char *)CurTrans);
  417.                 CurTrans = (TransInfo *)0;
  418.             }
  419.         }
  420.         ;
  421. Lookp        : tLOOKP Vector
  422.         {
  423.             lookp = $2;
  424.         }
  425.         ;
  426. Up        : tUP Vector
  427.         {
  428.             up = $2;
  429.         }
  430.         ;
  431. Fov        : tFOV Fnumber Fnumber
  432.         {
  433.             hfov = $2; vfov = $3;
  434.         }
  435.         | tFOV Fnumber
  436.         {
  437.             hfov = $2;
  438.         }
  439.         ;
  440. Samples        : tSAMPLES tINT
  441.         {
  442.             if (!SamplesSet)
  443.                 JitSamples = $2;
  444.         }
  445.         ;
  446. Adaptive    : tADAPTIVE tINT
  447.         {
  448.             if (!AdaptiveSet && !JitteredSet)
  449.                 pixel_div = $2;
  450.         }
  451.         ;
  452. Contrast    : tCONTRAST Fnumber Fnumber Fnumber
  453.         {
  454.             if (!ContrastSet) {
  455.                 RedContrast = $2;
  456.                 GreenContrast = $3;
  457.                 BlueContrast = $4;
  458.             }
  459.         }
  460.         ;
  461. Cutoff        : tCUTOFF Fnumber
  462.         {
  463.             if (!CutoffSet)
  464.                 TreeCutoff = $2;
  465.         }
  466.         ;
  467. Jittered    : tJITTERED
  468.         {
  469.             if (!AdaptiveSet)
  470.                 Jittered = TRUE;
  471.         }
  472.         ;
  473. Screen        : tSCREEN tINT tINT
  474.         {
  475.             if (!ResolutionSet) {
  476.                 Xres = $2;
  477.                 Yres = $3;
  478.             }
  479.         }
  480.         | tRESOLUTION tINT tINT
  481.         {
  482.             if (!ResolutionSet) {
  483.                 Xres = $2;
  484.                 Yres = $3;
  485.             }
  486.         }
  487.         ;
  488. Aperture    : tAPERTURE Fnumber
  489.         {
  490.             aperture = $2;
  491.         }
  492.         ;
  493. Focaldist    : tFOCALDIST Fnumber
  494.         {
  495.             focaldist = $2;
  496.         }
  497.         ;
  498. Maxdepth    : tMAXDEPTH tINT
  499.         {
  500.             maxlevel = $2;
  501.         }
  502.         ;
  503. Background    : tBACKGROUND Color
  504.         {
  505.             background = $2;
  506.         }
  507.         ;
  508. Light        : Lightdef tPOINT Vector
  509.         {
  510.             light[nlight].pos = $3;
  511.             light[nlight].type = LOCAL;
  512.             nlight++;
  513.         }
  514.         | Lightdef tDIRECTIONAL Vector
  515.         {
  516.             (void)normalize(&($3));
  517.             light[nlight].pos = $3;
  518.             light[nlight].type = DIRECTIONAL;
  519.             nlight++;
  520.         }
  521.         | Lightdef tEXTENDED Vector Fnumber
  522.         {
  523.             light[nlight].pos = $3;
  524.             light[nlight].radius = $4;
  525.             light[nlight].type = EXTENDED;
  526.             nlight++;
  527.         }
  528.         ;
  529. Lightdef    : tLIGHT Fnumber
  530.         {
  531.             if (nlight == LIGHTS)
  532.                 yyerror("Too many lights.\n");
  533.             light[nlight].color.r = $2;
  534.             light[nlight].color.g = $2;
  535.             light[nlight].color.b = $2;
  536.         }
  537.         | tLIGHT Color
  538.         {
  539.             if (nlight == LIGHTS)
  540.                 yyerror("Too many lights.\n");
  541.             light[nlight].color = $2;
  542.         }
  543.         ;
  544. Surface        : tSURFACE String
  545.             Color Color Color
  546.             Fnumber Fnumber Fnumber Fnumber
  547.         {
  548.             /*
  549.              * surface name
  550.              *     amb
  551.              *     diff
  552.              *     spec coef reflect refract krefract
  553.              */
  554.             stmp = make_surface($2, &($3), &($4), &($5), $6, $7,
  555.                     $8, $9, 0., 0.);
  556.             Surfaces = add_surface(stmp, Surfaces);
  557.  
  558.         }
  559.         | tSURFACE String Color Color Color
  560.             Fnumber Fnumber Fnumber Fnumber Fnumber Fnumber
  561.         {
  562.             /*
  563.              * surface name
  564.              *     amb
  565.              *     diff
  566.              *     spec coef reflect refract krefract
  567.              */
  568.             stmp = make_surface($2, &($3), &($4), &($5), $6, $7,
  569.                     $8, $9, $10, $11);
  570.             Surfaces = add_surface(stmp, Surfaces);
  571.  
  572.         }
  573.         ;
  574. HeightField    : tHEIGHTFIELD tSTRING tSTRING
  575.         {
  576.             LastObj = makhf($2, $3);
  577.         }
  578.         ;
  579. Poly        : tPOLY tSTRING Polypoints
  580.         {
  581.             LastObj = makpoly($2, Polypoints, Npoints);
  582.             Polypoints = (PointList *)0;
  583.             Npoints = 0;
  584.         }
  585.         ;
  586. Polypoints    : /* empty */
  587.         | Polypoints Polypoint
  588.         ;
  589. Polypoint    : Vector
  590.         {
  591.             Point = (PointList *)Malloc(sizeof(PointList));
  592.             Point->vec = $1;
  593.             Point->next = Polypoints;
  594.             Polypoints = Point;
  595.             Npoints++;
  596.         }
  597.         ;
  598. Cone        : tCONE tSTRING Vector Vector Fnumber Fnumber
  599.         {
  600.             CurTrans = new_transinfo();
  601.             LastObj = makcone($2, &($3), &($4), $5, $6, CurTrans);
  602.         }
  603.         ;
  604. Cylinder    : tCYL tSTRING Vector Vector Fnumber
  605.         {
  606.             /*
  607.              * Cylinders automagically define a
  608.              * transformation matrix.
  609.              */
  610.             CurTrans = new_transinfo();
  611.             LastObj = makcyl($2, &($3), &($4), $5, CurTrans);
  612.         }
  613.         ;
  614. Sphere        : tSPHERE tSTRING Fnumber Vector
  615.         {
  616.             LastObj = maksph($2, $3, &($4));
  617.         }
  618.         ;
  619. Box        : tBOX tSTRING
  620.             Fnumber Fnumber Fnumber
  621.             Fnumber Fnumber Fnumber
  622.         {
  623.             LastObj = makbox($2, $3, $4, $5, $6, $7, $8);
  624.         }
  625.         ;
  626. Triangle    : tTRIANGLE tSTRING Vector Vector Vector
  627.         {
  628.             LastObj = maktri(TRIANGLE, $2, &($3), &($4), &($5),
  629.                     (Vector *)0, (Vector *)0, (Vector *)0);
  630.         }
  631.         | tTRIANGLE tSTRING Vector Vector Vector Vector Vector Vector
  632.         {
  633.             LastObj = maktri(PHONGTRI, $2, &($3), &($5),
  634.                     &($7), &($4), &($6), &($8));
  635.         }
  636.         ;
  637. Superq        : tSUPERQ tSTRING
  638.             Fnumber Fnumber Fnumber
  639.             Fnumber Fnumber Fnumber
  640.             Fnumber
  641.         {
  642.             LastObj = maksup($2, $3, $4, $5, $6, $7, $8, $9);
  643.         }
  644.         ;
  645. Plane        : tPLANE tSTRING Vector Vector
  646.         {
  647.             LastObj = makplane($2, &($3), &($4));
  648.         }
  649.         ;
  650. Outfile        : tOUTFILE String
  651.         {
  652.             if (*outfilename != (char)NULL)
  653.                 yywarning("Ignoring output file name \"%s\".\n",
  654.                             $2);
  655.             else
  656.                 strcpy(outfilename, $2);
  657.         }
  658.         ;
  659. Mist        : tMIST Color Color Fnumber Fnumber
  660.         {
  661.             GlobalMist = (Mist *)Malloc(sizeof(Mist));
  662.             GlobalMist->color = $2;
  663.             GlobalMist->trans = $3;
  664.             GlobalMist->zero = $4;
  665.             GlobalMist->scale = 1. / $5;
  666.         }
  667.         ;
  668. Fog        : tFOG Fnumber Color
  669.         {
  670.             GlobalFog = (Fog *)Malloc(sizeof(Fog));
  671.             GlobalFog->trans = 1./$2;
  672.             GlobalFog->color = $3;
  673.         }
  674.         ;
  675. Color        : Fnumber Fnumber Fnumber
  676.         {
  677.             $$.r = $1;
  678.             $$.g = $2;
  679.             $$.b = $3;
  680.         }
  681.         ;
  682. Vector        : Fnumber Fnumber Fnumber
  683.         {
  684.             $$.x = $1;
  685.             $$.y = $2;
  686.             $$.z = $3;
  687.         }
  688.         ;
  689. Fnumber        : tFLOAT
  690.         { $$ = $1;}
  691.         | tINT
  692.         { $$ = $1;}
  693.         ;
  694. String        : tSTRING
  695.         { $$ = $1;}
  696. %%
  697. /*
  698.  * Issue error message containing filename and line number, and exit.
  699.  */
  700. /*VARARGS1*/
  701. yyerror(s, pat1, pat2)
  702. char *s, *pat1, *pat2;
  703. {
  704.     RSmessage("Error", "%s, line %d: ", yyfilename, yylineno);
  705.     fprintf(stderr, s, pat1, pat2);
  706.     fprintf(stderr,"\n");    /* yacc doesn't use newlines on syntax errors */
  707.     exit(1);
  708. }
  709.  
  710. /*
  711.  * Issue warning message containing filename and line number if not in
  712.  * Quiet mode.
  713.  */
  714. /*VARARGS1*/
  715. yywarning(s, pat1, pat2)
  716. char *s, *pat1, *pat2;
  717. {
  718.     extern int Quiet;
  719.  
  720.     if (!Quiet) {
  721.         RSmessage("Warning", "%s, line %d: ",yyfilename, yylineno);
  722.         fprintf(stderr, s, pat1, pat2);
  723.     }
  724. }
  725.