Changeset 1419


Ignore:
Timestamp:
May 30, 2012, 9:12:54 AM (8 years ago)
Author:
sam
Message:

orbital: a lot of scanner and parser refactoring to simplify the source
files and allow to build on MSVC soon.

Location:
trunk
Files:
4 added
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/contrib/NOTES

    r1169 r1419  
    6666Hard to do, requires libogg, libvorbis, mikmod, libsmpeg...
    6767
     68
     69Flex
     70----
     71
     72Just copied FlexLexer.h from a Debian installation.
     73
  • trunk/orbital/Makefile.am

    r1418 r1419  
    44orbital_SOURCES = \
    55    orbital.cpp orbital.h \
    6     mesh.cpp mesh.h \
    76    particlesystem.h tank.h player.h gun.h snake.h starfield.h \
    87    \
    9     mesh-driver.cpp mesh-driver.h \
     8    mesh.h mesh-scanner.h mesh-driver.cpp mesh-driver.h \
    109    generated/mesh-scanner.cpp \
    1110    generated/mesh-parser.cpp
     
    2423        $(MKDIR_P) generated
    2524        rm -f generated/[a-zA-Z]*
    26         flex -o generated/mesh-scanner.cpp mesh.ll
     25        flex -o generated/mesh-scanner.cpp mesh.l
    2726        bison -o generated/mesh-parser.cpp --defines=generated/mesh-parser.h \
    2827              -d -b generated/mesh mesh.yy
  • trunk/orbital/generated/mesh-parser.cpp

    r1418 r1419  
    3737
    3838/* Line 293 of lalr1.cc  */
    39 #line 4 "mesh.yy"
    40  /*** C/C++ Declarations ***/
     39#line 1 "mesh.yy"
     40
     41//
     42// Orbital
     43//
     44// Copyright: (c) 2012 Various People
     45//
     46
    4147#if defined HAVE_CONFIG_H
    4248#   include "config.h"
     
    5561
    5662
    57 
    5863/* Line 293 of lalr1.cc  */
    59 #line 60 "generated/mesh-parser.cpp"
     64#line 65 "generated/mesh-parser.cpp"
    6065
    6166
     
    6570
    6671/* Line 299 of lalr1.cc  */
    67 #line 88 "mesh.yy"
    68 
     72#line 61 "mesh.yy"
    6973
    7074#include "mesh-driver.h"
    7175#include "mesh-scanner.h"
    7276
    73 /* this "connects" the bison parser in the driver to the flex scanner class
    74  * object. it defines the yylex() function call to pull the next token from the
    75  * current lexer object of the driver context. */
    7677#undef yylex
    77 #define yylex driver.lexer->lex
    78 
     78#define yylex driver.m_lexer->lex
    7979
    8080
     
    350350
    351351
    352     /* User initialization code.  */
    353    
    354 /* Line 565 of lalr1.cc  */
    355 #line 49 "mesh.yy"
    356 {
    357     // initialize the initial location object
    358     yylloc.begin.filename = yylloc.end.filename = &driver.streamname;
    359 }
    360 
    361 /* Line 565 of lalr1.cc  */
    362 #line 363 "generated/mesh-parser.cpp"
    363 
    364352    /* Initialize the stacks.  The initial state will be pushed in
    365353       yynewstate, since the latter expects the semantical and the
     
    479467
    480468/* Line 690 of lalr1.cc  */
    481 #line 120 "mesh.yy"
    482     { driver.mesh.Flush(); }
     469#line 88 "mesh.yy"
     470    { driver.m_mesh.Flush(); }
    483471    break;
    484472
     
    486474
    487475/* Line 690 of lalr1.cc  */
    488 #line 121 "mesh.yy"
    489     { driver.mesh.MeshConvert(); }
     476#line 89 "mesh.yy"
     477    { driver.m_mesh.MeshConvert(); }
    490478    break;
    491479
     
    493481
    494482/* Line 690 of lalr1.cc  */
    495 #line 122 "mesh.yy"
     483#line 90 "mesh.yy"
    496484    { /* TODO */ }
    497485    break;
     
    500488
    501489/* Line 690 of lalr1.cc  */
    502 #line 126 "mesh.yy"
    503     { driver.mesh.SetCurColor(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }
     490#line 94 "mesh.yy"
     491    { driver.m_mesh.SetCurColor(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }
    504492    break;
    505493
     
    507495
    508496/* Line 690 of lalr1.cc  */
    509 #line 127 "mesh.yy"
    510     { driver.mesh.SetCurColor2(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }
     497#line 95 "mesh.yy"
     498    { driver.m_mesh.SetCurColor2(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }
    511499    break;
    512500
     
    514502
    515503/* Line 690 of lalr1.cc  */
    516 #line 131 "mesh.yy"
    517     { driver.mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
     504#line 99 "mesh.yy"
     505    { driver.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
    518506    break;
    519507
     
    521509
    522510/* Line 690 of lalr1.cc  */
    523 #line 132 "mesh.yy"
    524     { driver.mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
     511#line 100 "mesh.yy"
     512    { driver.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
    525513    break;
    526514
     
    528516
    529517/* Line 690 of lalr1.cc  */
    530 #line 133 "mesh.yy"
    531     { driver.mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
     518#line 101 "mesh.yy"
     519    { driver.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
    532520    break;
    533521
     
    535523
    536524/* Line 690 of lalr1.cc  */
    537 #line 134 "mesh.yy"
    538     { driver.mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
     525#line 102 "mesh.yy"
     526    { driver.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    539527    break;
    540528
     
    542530
    543531/* Line 690 of lalr1.cc  */
    544 #line 135 "mesh.yy"
    545     { driver.mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); }
     532#line 103 "mesh.yy"
     533    { driver.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); }
    546534    break;
    547535
     
    549537
    550538/* Line 690 of lalr1.cc  */
    551 #line 136 "mesh.yy"
    552     { driver.mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); }
     539#line 104 "mesh.yy"
     540    { driver.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); }
    553541    break;
    554542
     
    556544
    557545/* Line 690 of lalr1.cc  */
    558 #line 137 "mesh.yy"
    559     { driver.mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); }
     546#line 105 "mesh.yy"
     547    { driver.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); }
    560548    break;
    561549
     
    563551
    564552/* Line 690 of lalr1.cc  */
    565 #line 138 "mesh.yy"
    566     { driver.mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
     553#line 106 "mesh.yy"
     554    { driver.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    567555    break;
    568556
     
    570558
    571559/* Line 690 of lalr1.cc  */
    572 #line 139 "mesh.yy"
    573     { driver.mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
     560#line 107 "mesh.yy"
     561    { driver.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    574562    break;
    575563
     
    577565
    578566/* Line 690 of lalr1.cc  */
    579 #line 140 "mesh.yy"
    580     { driver.mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
     567#line 108 "mesh.yy"
     568    { driver.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    581569    break;
    582570
     
    584572
    585573/* Line 690 of lalr1.cc  */
    586 #line 141 "mesh.yy"
    587     { driver.mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
     574#line 109 "mesh.yy"
     575    { driver.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
    588576    break;
    589577
     
    591579
    592580/* Line 690 of lalr1.cc  */
    593 #line 142 "mesh.yy"
    594     { driver.mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
     581#line 110 "mesh.yy"
     582    { driver.m_mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
    595583    break;
    596584
     
    598586
    599587/* Line 690 of lalr1.cc  */
    600 #line 143 "mesh.yy"
    601     { driver.mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
     588#line 111 "mesh.yy"
     589    { driver.m_mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
    602590    break;
    603591
     
    605593
    606594/* Line 690 of lalr1.cc  */
    607 #line 144 "mesh.yy"
    608     { driver.mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
     595#line 112 "mesh.yy"
     596    { driver.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    609597    break;
    610598
     
    612600
    613601/* Line 690 of lalr1.cc  */
    614 #line 145 "mesh.yy"
    615     { driver.mesh.MirrorX(); }
     602#line 113 "mesh.yy"
     603    { driver.m_mesh.MirrorX(); }
    616604    break;
    617605
     
    619607
    620608/* Line 690 of lalr1.cc  */
    621 #line 146 "mesh.yy"
    622     { driver.mesh.MirrorY(); }
     609#line 114 "mesh.yy"
     610    { driver.m_mesh.MirrorY(); }
    623611    break;
    624612
     
    626614
    627615/* Line 690 of lalr1.cc  */
    628 #line 147 "mesh.yy"
    629     { driver.mesh.MirrorZ(); }
     616#line 115 "mesh.yy"
     617    { driver.m_mesh.MirrorZ(); }
    630618    break;
    631619
     
    633621
    634622/* Line 690 of lalr1.cc  */
    635 #line 151 "mesh.yy"
    636     { driver.mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
     623#line 119 "mesh.yy"
     624    { driver.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    637625                                                 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3,
    638626                                                 (int)(yysemantic_stack_[(2) - (2)].args).f4, (int)(yysemantic_stack_[(2) - (2)].args).f5); }
     
    642630
    643631/* Line 690 of lalr1.cc  */
    644 #line 154 "mesh.yy"
    645     { driver.mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
     632#line 122 "mesh.yy"
     633    { driver.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    646634    break;
    647635
     
    649637
    650638/* Line 690 of lalr1.cc  */
    651 #line 155 "mesh.yy"
    652     { driver.mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
     639#line 123 "mesh.yy"
     640    { driver.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    653641                                                            (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); }
    654642    break;
     
    657645
    658646/* Line 690 of lalr1.cc  */
    659 #line 157 "mesh.yy"
    660     { driver.mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
     647#line 125 "mesh.yy"
     648    { driver.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    661649                                                          (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); }
    662650    break;
     
    665653
    666654/* Line 690 of lalr1.cc  */
    667 #line 159 "mesh.yy"
    668     { driver.mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0,
     655#line 127 "mesh.yy"
     656    { driver.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0,
    669657                                               vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }
    670658    break;
     
    673661
    674662/* Line 690 of lalr1.cc  */
    675 #line 161 "mesh.yy"
    676     { driver.mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2,
     663#line 129 "mesh.yy"
     664    { driver.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2,
    677665                                             (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); }
    678666    break;
     
    681669
    682670/* Line 690 of lalr1.cc  */
    683 #line 163 "mesh.yy"
    684     { driver.mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
     671#line 131 "mesh.yy"
     672    { driver.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    685673                                                     (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); }
    686674    break;
     
    689677
    690678/* Line 690 of lalr1.cc  */
    691 #line 165 "mesh.yy"
    692     { driver.mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); }
     679#line 133 "mesh.yy"
     680    { driver.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); }
    693681    break;
    694682
     
    696684
    697685/* Line 690 of lalr1.cc  */
    698 #line 166 "mesh.yy"
    699     { driver.mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
     686#line 134 "mesh.yy"
     687    { driver.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
    700688    break;
    701689
     
    703691
    704692/* Line 690 of lalr1.cc  */
    705 #line 167 "mesh.yy"
    706     { driver.mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
     693#line 135 "mesh.yy"
     694    { driver.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
    707695    break;
    708696
     
    710698
    711699/* Line 690 of lalr1.cc  */
    712 #line 168 "mesh.yy"
    713     { driver.mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3,
     700#line 136 "mesh.yy"
     701    { driver.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3,
    714702                                            (yysemantic_stack_[(2) - (2)].args).f4, (yysemantic_stack_[(2) - (2)].args).f5, (yysemantic_stack_[(2) - (2)].args).f6, (int)(yysemantic_stack_[(2) - (2)].args).f7); }
    715703    break;
     
    718706
    719707/* Line 690 of lalr1.cc  */
    720 #line 172 "mesh.yy"
     708#line 140 "mesh.yy"
    721709    { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); }
    722710    break;
     
    725713
    726714/* Line 690 of lalr1.cc  */
    727 #line 173 "mesh.yy"
     715#line 141 "mesh.yy"
    728716    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); }
    729717    break;
     
    732720
    733721/* Line 690 of lalr1.cc  */
    734 #line 174 "mesh.yy"
     722#line 142 "mesh.yy"
    735723    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); }
    736724    break;
     
    739727
    740728/* Line 690 of lalr1.cc  */
    741 #line 175 "mesh.yy"
     729#line 143 "mesh.yy"
    742730    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(3) - (3)].fval); }
    743731    break;
     
    746734
    747735/* Line 690 of lalr1.cc  */
    748 #line 176 "mesh.yy"
     736#line 144 "mesh.yy"
    749737    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(3) - (3)].fval); }
    750738    break;
     
    753741
    754742/* Line 690 of lalr1.cc  */
    755 #line 177 "mesh.yy"
     743#line 145 "mesh.yy"
    756744    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(3) - (3)].fval); }
    757745    break;
     
    760748
    761749/* Line 690 of lalr1.cc  */
    762 #line 178 "mesh.yy"
     750#line 146 "mesh.yy"
    763751    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(3) - (3)].fval); }
    764752    break;
     
    767755
    768756/* Line 690 of lalr1.cc  */
    769 #line 179 "mesh.yy"
     757#line 147 "mesh.yy"
    770758    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(3) - (3)].fval); }
    771759    break;
     
    774762
    775763/* Line 690 of lalr1.cc  */
    776 #line 182 "mesh.yy"
     764#line 150 "mesh.yy"
    777765    { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); }
    778766    break;
     
    781769
    782770/* Line 690 of lalr1.cc  */
    783 #line 183 "mesh.yy"
     771#line 151 "mesh.yy"
    784772    { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); }
    785773    break;
     
    788776
    789777/* Line 690 of lalr1.cc  */
    790 #line 791 "generated/mesh-parser.cpp"
     778#line 779 "generated/mesh-parser.cpp"
    791779        default:
    792780          break;
     
    12581246  MeshParser::yyrline_[] =
    12591247  {
    1260          0,   104,   104,   108,   109,   113,   114,   115,   116,   120,
    1261      121,   122,   126,   127,   131,   132,   133,   134,   135,   136,
    1262      137,   138,   139,   140,   141,   142,   143,   144,   145,   146,
    1263      147,   151,   154,   155,   157,   159,   161,   163,   165,   166,
    1264      167,   168,   172,   173,   174,   175,   176,   177,   178,   179,
    1265      182,   183
     1248         0,    72,    72,    76,    77,    81,    82,    83,    84,    88,
     1249      89,    90,    94,    95,    99,   100,   101,   102,   103,   104,
     1250     105,   106,   107,   108,   109,   110,   111,   112,   113,   114,
     1251     115,   119,   122,   123,   125,   127,   129,   131,   133,   134,
     1252     135,   136,   140,   141,   142,   143,   144,   145,   146,   147,
     1253     150,   151
    12661254  };
    12671255
     
    13561344
    13571345/* Line 1136 of lalr1.cc  */
    1358 #line 1359 "generated/mesh-parser.cpp"
     1346#line 1347 "generated/mesh-parser.cpp"
    13591347
    13601348
    13611349/* Line 1138 of lalr1.cc  */
    1362 #line 186 "mesh.yy"
    1363  /*** Additional Code ***/
     1350#line 154 "mesh.yy"
     1351
    13641352
    13651353void orbital::MeshParser::error(const MeshParser::location_type& l,
    13661354                                const std::string& m)
    13671355{
    1368     driver.error(l, m);
     1356    driver.Error(l, m);
    13691357}
    13701358
     1359
  • trunk/orbital/generated/mesh-parser.h

    r1418 r1419  
    7777
    7878/* Line 35 of lalr1.cc  */
    79 #line 63 "mesh.yy"
     79#line 35 "mesh.yy"
    8080
    8181    float fval;
  • trunk/orbital/generated/mesh-scanner.cpp

    r1418 r1419  
    66
    77/* A lexical scanner generated by flex */
    8 
    9 /* %not-for-header */
    10 
    11 /* %if-c-only */
    12 /* %if-not-reentrant */
    13 /* %endif */
    14 /* %endif */
    15 /* %ok-for-header */
    168
    179#define FLEX_SCANNER
     
    2315#endif
    2416
    25 /* %if-c++-only */
    2617    /* The c++ scanner is a mess. The FlexLexer.h header file relies on the
    2718     * following macro. This is required in order to pass the c++-multiple-scanners
     
    3122     */
    3223    #define yyFlexLexer MeshFlexLexer
    33 /* %endif */
    34 
    35 /* %if-c-only */
    36 /* %endif */
    37 
    38 /* %if-c-only */
    39 /* %endif */
    4024
    4125/* First, we deal with  platform-specific or compiler-specific issues. */
    4226
    4327/* begin standard C headers. */
    44 /* %if-c-only */
    45 /* %endif */
    46 
    47 /* %if-tables-serialization */
    48 /* %endif */
     28
    4929/* end standard C headers. */
    5030
    51 /* %if-c-or-c++ */
    5231/* flex integer type definitions */
    5332
     
    11493#endif /* ! FLEXINT_H */
    11594
    116 /* %endif */
    117 
    118 /* %if-c++-only */
    11995/* begin standard C++ headers. */
    12096#include <iostream>
     
    124100#include <cstring>
    125101/* end standard C++ headers. */
    126 /* %endif */
    127102
    128103#ifdef __cplusplus
     
    147122#endif
    148123
    149 /* %not-for-header */
    150 
    151124/* Returned upon end-of-file. */
    152125#define YY_NULL 0
    153 /* %ok-for-header */
    154 
    155 /* %not-for-header */
    156126
    157127/* Promotes a possibly negative, possibly signed char to an unsigned
     
    161131 */
    162132#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
    163 /* %ok-for-header */
    164 
    165 /* %if-reentrant */
    166 /* %endif */
    167 
    168 /* %if-not-reentrant */
    169 
    170 /* %endif */
    171133
    172134/* Enter a start condition.  This macro really ought to take a parameter,
     
    213175#endif
    214176
    215 /* %if-not-reentrant */
    216177extern int yyleng;
    217 /* %endif */
    218 
    219 /* %if-c-only */
    220 /* %if-not-reentrant */
    221 /* %endif */
    222 /* %endif */
    223178
    224179#define EOB_ACT_CONTINUE_SCAN 0
     
    253208struct yy_buffer_state
    254209        {
    255 /* %if-c-only */
    256 /* %endif */
    257 
    258 /* %if-c++-only */
     210
    259211        std::istream* yy_input_file;
    260 /* %endif */
    261212
    262213        char *yy_ch_buf;                /* input buffer */
     
    319270#endif /* !YY_STRUCT_YY_BUFFER_STATE */
    320271
    321 /* %if-c-only Standard (non-C++) definition */
    322 /* %not-for-header */
    323 
    324 /* %if-not-reentrant */
    325 /* %endif */
    326 /* %ok-for-header */
    327 
    328 /* %endif */
    329 
    330272/* We provide macros for accessing buffer states in case in the
    331273 * future we want to put the buffer states in a more general
     
    342284 */
    343285#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
    344 
    345 /* %if-c-only Standard (non-C++) definition */
    346 /* %if-not-reentrant */
    347 /* %not-for-header */
    348 
    349 /* %ok-for-header */
    350 
    351 /* %endif */
    352 /* %endif */
    353286
    354287void *Meshalloc (yy_size_t  );
     
    380313#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
    381314
    382 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
    383315/* Begin user sect3 */
    384316
    385 #define FLEX_DEBUG
    386 
    387317typedef unsigned char YY_CHAR;
    388318
     
    390320
    391321#include <FlexLexer.h>
    392 
    393 /* %if-c-only Standard (non-C++) definition */
    394 /* %endif */
    395322
    396323/* Done after the current pattern has been matched and before the
     
    399326#define YY_DO_BEFORE_ACTION \
    400327        (yytext_ptr) = yy_bp; \
    401 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
    402328        yyleng = (size_t) (yy_cp - yy_bp); \
    403329        (yy_hold_char) = *yy_cp; \
    404330        *yy_cp = '\0'; \
    405 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
    406331        (yy_c_buf_p) = yy_cp;
    407332
    408 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
    409333#define YY_NUM_RULES 38
    410334#define YY_END_OF_BUFFER 39
     
    522446    } ;
    523447
    524 static yyconst flex_int16_t yy_rule_linenum[38] =
    525     {   0,
    526        61,   62,   63,   65,   66,   68,   69,   70,   71,   72,
    527        73,   74,   75,   76,   77,   78,   79,   80,   81,   82,
    528        83,   84,   86,   87,   88,   89,   90,   91,   92,   93,
    529        94,   95,   96,   98,  100,  101,  102
    530     } ;
    531 
    532448/* The intent behind this definition is that it'll catch
    533449 * any uses of REJECT which flex missed.
     
    537453#define YY_MORE_ADJ 0
    538454#define YY_RESTORE_YY_MORE_OFFSET
    539 #line 1 "mesh.ll"
    540 /* $Id: scanner.ll 44 2008-10-23 09:03:19Z tb $ -*- mode: c++ -*- */
    541 /** \file scanner.ll Define the orbital Flex lexical scanner */
    542 #line 5 "mesh.ll"
    543 
    544 #include <string>
     455#line 1 "mesh.l"
     456#line 2 "mesh.l"
     457//
     458// Orbital
     459//
     460// Copyright: (c) 2012 Various People
     461//
    545462
    546463#include "mesh-scanner.h"
    547464
    548 /* import the parser's token type into a local typedef */
    549465typedef orbital::MeshParser::token token;
    550466typedef orbital::MeshParser::token_type token_type;
    551467
    552 /* By default yylex returns int, we use token_type. Unfortunately yyterminate
    553  * by default returns 0, which is not of token_type. */
    554468#define yyterminate() return token::T_END
    555 
    556 /* This disables inclusion of unistd.h, which is not available under Visual C++
    557  * on Win32. The C++ scanner uses STL streams instead. */
    558469#define YY_NO_UNISTD_H
    559 
    560 /*** Flex Declarations and Options ***/
    561 /* enable c++ scanner class generation */
    562 /* change the name of the scanner class. results in "MeshFlexLexer" */
    563 /* the manual says "somewhat more optimized" */
    564 /* enable scanner to generate debug output. disable this for release
    565  * versions. */
    566 /* no support for include files is planned */
    567 /* enables the use of start condition stacks */
    568 /* The following paragraph suffices to track locations accurately. Each time
    569  * yylex is invoked, the begin position is moved onto the end position. */
    570 #line 48 "mesh.ll"
    571 #define YY_USER_ACTION  yylloc->columns(yyleng);
    572 #line 573 "generated/mesh-scanner.cpp"
     470#define YY_USER_ACTION yylloc->columns(yyleng);
     471#line 472 "generated/mesh-scanner.cpp"
    573472
    574473#define INITIAL 0
     
    579478 * The user has a chance to override it with an option.
    580479 */
    581 /* %if-c-only */
    582 /* %endif */
    583 /* %if-c++-only */
    584480#include <unistd.h>
    585 /* %endif */
    586481#endif
    587482
     
    590485#endif
    591486
    592 /* %if-c-only Reentrant structure and macros (non-C++). */
    593 /* %if-reentrant */
    594 /* %if-c-only */
    595 /* %endif */
    596 /* %if-reentrant */
    597 /* %endif */
    598 /* %endif End reentrant structures and macros. */
    599 /* %if-bison-bridge */
    600 /* %endif */
    601 /* %not-for-header */
    602 
    603 /* %ok-for-header */
    604 
    605 /* %endif */
    606 
    607487#ifndef yytext_ptr
    608488static void yy_flex_strncpy (char *,yyconst char *,int );
     
    614494
    615495#ifndef YY_NO_INPUT
    616 /* %if-c-only Standard (non-C++) definition */
    617 /* %not-for-header */
    618 
    619 /* %ok-for-header */
    620 
    621 /* %endif */
    622 #endif
    623 
    624 /* %if-c-only */
    625 /* %endif */
     496
     497#endif
    626498
    627499/* Amount of stuff to slurp up with each read. */
     
    637509/* Copy whatever the last rule matched to the standard output. */
    638510#ifndef ECHO
    639 /* %if-c-only Standard (non-C++) definition */
    640 /* %endif */
    641 /* %if-c++-only C++ definition */
    642511#define ECHO LexerOutput( yytext, yyleng )
    643 /* %endif */
    644512#endif
    645513
     
    649517#ifndef YY_INPUT
    650518#define YY_INPUT(buf,result,max_size) \
    651 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
    652519\
    653 /* %if-c++-only C++ definition \ */\
    654520        if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \
    655521                YY_FATAL_ERROR( "input in flex scanner failed" );
    656 /* %endif */
    657522
    658523#endif
     
    673538/* Report a fatal error. */
    674539#ifndef YY_FATAL_ERROR
    675 /* %if-c-only */
    676 /* %endif */
    677 /* %if-c++-only */
    678540#define YY_FATAL_ERROR(msg) LexerError( msg )
    679 /* %endif */
    680 #endif
    681 
    682 /* %if-tables-serialization structures and prototypes */
    683 /* %not-for-header */
    684 
    685 /* %ok-for-header */
    686 
    687 /* %not-for-header */
    688 
    689 /* %tables-yydmap generated elements */
    690 /* %endif */
     541#endif
     542
    691543/* end tables serialization structures and prototypes */
    692 
    693 /* %ok-for-header */
    694544
    695545/* Default declaration of generated scanner - a define so the user can
     
    698548#ifndef YY_DECL
    699549#define YY_DECL_IS_OURS 1
    700 /* %if-c-only Standard (non-C++) definition */
    701 /* %endif */
    702 /* %if-c++-only C++ definition */
    703550#define YY_DECL int yyFlexLexer::yylex()
    704 /* %endif */
    705551#endif /* !YY_DECL */
    706552
     
    717563#endif
    718564
    719 /* %% [6.0] YY_RULE_SETUP definition goes here */
    720565#define YY_RULE_SETUP \
    721566        YY_USER_ACTION
    722 
    723 /* %not-for-header */
    724567
    725568/** The main scanner function which does all the work.
     
    731574        register int yy_act;
    732575   
    733 /* %% [7.0] user's declarations go here */
    734 #line 51 "mesh.ll"
    735 
    736 
    737  /* code to place at the beginning of yylex() */
    738 
    739     // reset location
     576#line 21 "mesh.l"
     577
     578
     579
     580    /* reset location at the beginning of yylex() */
    740581    yylloc->step();
    741582
    742583
    743  /*** BEGIN EXAMPLE - Change the orbital lexer rules below ***/
    744 
    745 #line 746 "generated/mesh-scanner.cpp"
     584#line 585 "generated/mesh-scanner.cpp"
    746585
    747586        if ( !(yy_init) )
     
    757596
    758597                if ( ! yyin )
    759 /* %if-c-only */
    760 /* %endif */
    761 /* %if-c++-only */
    762598                        yyin = & std::cin;
    763 /* %endif */
    764599
    765600                if ( ! yyout )
    766 /* %if-c-only */
    767 /* %endif */
    768 /* %if-c++-only */
    769601                        yyout = & std::cout;
    770 /* %endif */
    771602
    772603                if ( ! YY_CURRENT_BUFFER ) {
     
    781612        while ( 1 )             /* loops until end-of-file is reached */
    782613                {
    783 /* %% [8.0] yymore()-related code goes here */
    784614                yy_cp = (yy_c_buf_p);
    785615
     
    792622                yy_bp = yy_cp;
    793623
    794 /* %% [9.0] code to set up and find next match goes here */
    795624                yy_current_state = (yy_start);
    796625yy_match:
     
    817646
    818647yy_find_action:
    819 /* %% [10.0] code to find the action number goes here */
    820648                yy_act = yy_accept[yy_current_state];
    821649
    822650                YY_DO_BEFORE_ACTION;
    823651
    824 /* %% [11.0] code for yylineno update goes here */
    825 
    826652do_action:      /* This label is used only to access EOF actions. */
    827 
    828 /* %% [12.0] debug code goes here */
    829                 if ( yy_flex_debug )
    830                         {
    831                         if ( yy_act == 0 )
    832                                 std::cerr << "--scanner backing up\n";
    833                         else if ( yy_act < 38 )
    834                                 std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] <<
    835                                          "(\"" << yytext << "\")\n";
    836                         else if ( yy_act == 38 )
    837                                 std::cerr << "--accepting default rule (\"" << yytext << "\")\n";
    838                         else if ( yy_act == 39 )
    839                                 std::cerr << "--(end of buffer or a NUL)\n";
    840                         else
    841                                 std::cerr << "--EOF (start condition " << YY_START << ")\n";
    842                         }
    843653
    844654                switch ( yy_act )
    845655        { /* beginning of action switch */
    846 /* %% [13.0] actions go here */
    847656                        case 0: /* must back up */
    848657                        /* undo the effects of YY_DO_BEFORE_ACTION */
     
    854663case 1:
    855664YY_RULE_SETUP
    856 #line 61 "mesh.ll"
     665#line 28 "mesh.l"
    857666{ return token::T_FLUSH; }
    858667        YY_BREAK
    859668case 2:
    860669YY_RULE_SETUP
    861 #line 62 "mesh.ll"
     670#line 29 "mesh.l"
    862671{ return token::T_INITRB; }
    863672        YY_BREAK
    864673case 3:
    865674YY_RULE_SETUP
    866 #line 63 "mesh.ll"
     675#line 30 "mesh.l"
    867676{ return token::T_FREERB; }
    868677        YY_BREAK
    869678case 4:
    870679YY_RULE_SETUP
    871 #line 65 "mesh.ll"
     680#line 32 "mesh.l"
    872681{ return token::T_COLOR; }
    873682        YY_BREAK
    874683case 5:
    875684YY_RULE_SETUP
    876 #line 66 "mesh.ll"
     685#line 33 "mesh.l"
    877686{ return token::T_BGCOLOR; }
    878687        YY_BREAK
    879688case 6:
    880689YY_RULE_SETUP
    881 #line 68 "mesh.ll"
     690#line 35 "mesh.l"
    882691{ return token::T_TRANSLATEX; }
    883692        YY_BREAK
    884693case 7:
    885694YY_RULE_SETUP
    886 #line 69 "mesh.ll"
     695#line 36 "mesh.l"
    887696{ return token::T_TRANSLATEY; }
    888697        YY_BREAK
    889698case 8:
    890699YY_RULE_SETUP
    891 #line 70 "mesh.ll"
     700#line 37 "mesh.l"
    892701{ return token::T_TRANSLATEZ; }
    893702        YY_BREAK
    894703case 9:
    895704YY_RULE_SETUP
    896 #line 71 "mesh.ll"
     705#line 38 "mesh.l"
    897706{ return token::T_TRANSLATE; }
    898707        YY_BREAK
    899708case 10:
    900709YY_RULE_SETUP
    901 #line 72 "mesh.ll"
     710#line 39 "mesh.l"
    902711{ return token::T_ROTATEX; }
    903712        YY_BREAK
    904713case 11:
    905714YY_RULE_SETUP
    906 #line 73 "mesh.ll"
     715#line 40 "mesh.l"
    907716{ return token::T_ROTATEY; }
    908717        YY_BREAK
    909718case 12:
    910719YY_RULE_SETUP
    911 #line 74 "mesh.ll"
     720#line 41 "mesh.l"
    912721{ return token::T_ROTATEZ; }
    913722        YY_BREAK
    914723case 13:
    915724YY_RULE_SETUP
    916 #line 75 "mesh.ll"
     725#line 42 "mesh.l"
    917726{ return token::T_TAPERX; }
    918727        YY_BREAK
    919728case 14:
    920729YY_RULE_SETUP
    921 #line 76 "mesh.ll"
     730#line 43 "mesh.l"
    922731{ return token::T_TAPERY; }
    923732        YY_BREAK
    924733case 15:
    925734YY_RULE_SETUP
    926 #line 77 "mesh.ll"
     735#line 44 "mesh.l"
    927736{ return token::T_TAPERZ; }
    928737        YY_BREAK
    929738case 16:
    930739YY_RULE_SETUP
    931 #line 78 "mesh.ll"
     740#line 45 "mesh.l"
    932741{ return token::T_SCALEX; }
    933742        YY_BREAK
    934743case 17:
    935744YY_RULE_SETUP
    936 #line 79 "mesh.ll"
     745#line 46 "mesh.l"
    937746{ return token::T_SCALEY; }
    938747        YY_BREAK
    939748case 18:
    940749YY_RULE_SETUP
    941 #line 80 "mesh.ll"
     750#line 47 "mesh.l"
    942751{ return token::T_SCALEZ; }
    943752        YY_BREAK
    944753case 19:
    945754YY_RULE_SETUP
    946 #line 81 "mesh.ll"
     755#line 48 "mesh.l"
    947756{ return token::T_SCALE; }
    948757        YY_BREAK
    949758case 20:
    950759YY_RULE_SETUP
    951 #line 82 "mesh.ll"
     760#line 49 "mesh.l"
    952761{ return token::T_MIRRORX; }
    953762        YY_BREAK
    954763case 21:
    955764YY_RULE_SETUP
    956 #line 83 "mesh.ll"
     765#line 50 "mesh.l"
    957766{ return token::T_MIRRORY; }
    958767        YY_BREAK
    959768case 22:
    960769YY_RULE_SETUP
    961 #line 84 "mesh.ll"
     770#line 51 "mesh.l"
    962771{ return token::T_MIRRORZ; }
    963772        YY_BREAK
    964773case 23:
    965774YY_RULE_SETUP
    966 #line 86 "mesh.ll"
     775#line 53 "mesh.l"
    967776{ return token::T_CYLINDER; }
    968777        YY_BREAK
    969778case 24:
    970779YY_RULE_SETUP
    971 #line 87 "mesh.ll"
     780#line 54 "mesh.l"
    972781{ return token::T_BOX; }
    973782        YY_BREAK
    974783case 25:
    975784YY_RULE_SETUP
    976 #line 88 "mesh.ll"
     785#line 55 "mesh.l"
    977786{ return token::T_SMOOTHCHAMFBOX; }
    978787        YY_BREAK
    979788case 26:
    980789YY_RULE_SETUP
    981 #line 89 "mesh.ll"
     790#line 56 "mesh.l"
    982791{ return token::T_FLATCHAMFBOX; }
    983792        YY_BREAK
    984793case 27:
    985794YY_RULE_SETUP
    986 #line 90 "mesh.ll"
     795#line 57 "mesh.l"
    987796{ return token::T_SPHERE; }
    988797        YY_BREAK
    989798case 28:
    990799YY_RULE_SETUP
    991 #line 91 "mesh.ll"
     800#line 58 "mesh.l"
    992801{ return token::T_STAR; }
    993802        YY_BREAK
    994803case 29:
    995804YY_RULE_SETUP
    996 #line 92 "mesh.ll"
     805#line 59 "mesh.l"
    997806{ return token::T_EXPANDEDSTAR; }
    998807        YY_BREAK
    999808case 30:
    1000809YY_RULE_SETUP
    1001 #line 93 "mesh.ll"
     810#line 60 "mesh.l"
    1002811{ return token::T_DISC; }
    1003812        YY_BREAK
    1004813case 31:
    1005814YY_RULE_SETUP
    1006 #line 94 "mesh.ll"
     815#line 61 "mesh.l"
    1007816{ return token::T_TRIANGLE; }
    1008817        YY_BREAK
    1009818case 32:
    1010819YY_RULE_SETUP
    1011 #line 95 "mesh.ll"
     820#line 62 "mesh.l"
    1012821{ return token::T_QUAD; }
    1013822        YY_BREAK
    1014823case 33:
    1015824YY_RULE_SETUP
    1016 #line 96 "mesh.ll"
     825#line 63 "mesh.l"
    1017826{ return token::T_COG; }
    1018827        YY_BREAK
    1019828case 34:
    1020829YY_RULE_SETUP
    1021 #line 98 "mesh.ll"
    1022 {
    1023                yylval->fval = atof(yytext); return token::NUMBER; }
     830#line 65 "mesh.l"
     831{
     832        yylval->fval = atof(yytext); return token::NUMBER; }
    1024833        YY_BREAK
    1025834case 35:
    1026835YY_RULE_SETUP
    1027 #line 100 "mesh.ll"
     836#line 67 "mesh.l"
    1028837{ return token_type('-'); }
    1029838        YY_BREAK
    1030839case 36:
    1031840YY_RULE_SETUP
    1032 #line 101 "mesh.ll"
     841#line 68 "mesh.l"
    1033842{ return token_type(','); }
    1034843        YY_BREAK
     
    1036845/* rule 37 can match eol */
    1037846YY_RULE_SETUP
    1038 #line 102 "mesh.ll"
     847#line 69 "mesh.l"
    1039848{ /* ignore everything else */ }
    1040849        YY_BREAK
    1041 /*** END EXAMPLE - Change the orbital lexer rules above ***/
    1042850case 38:
    1043851YY_RULE_SETUP
    1044 #line 106 "mesh.ll"
     852#line 71 "mesh.l"
    1045853ECHO;
    1046854        YY_BREAK
    1047 #line 1048 "generated/mesh-scanner.cpp"
     855#line 856 "generated/mesh-scanner.cpp"
    1048856case YY_STATE_EOF(INITIAL):
    1049857        yyterminate();
     
    1112920                        else
    1113921                                {
    1114 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
    1115922                                yy_cp = (yy_last_accepting_cpos);
    1116923                                yy_current_state = (yy_last_accepting_state);
     
    1179986                } /* end of scanning one token */
    1180987} /* end of yylex */
    1181 /* %ok-for-header */
    1182 
    1183 /* %if-c++-only */
    1184 /* %not-for-header */
    1185988
    1186989/* The contents of this function are C++ specific, so the () macro is not used.
     
    12721075        (void) yyout->write( buf, size );
    12731076}
    1274 /* %ok-for-header */
    1275 
    1276 /* %endif */
    12771077
    12781078/* yy_get_next_buffer - try to read in a new buffer
     
    12831083 *      EOB_ACT_END_OF_FILE - end of file
    12841084 */
    1285 /* %if-c-only */
    1286 /* %endif */
    1287 /* %if-c++-only */
    12881085int yyFlexLexer::yy_get_next_buffer()
    1289 /* %endif */
    12901086{
    12911087        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
     
    14211217/* yy_get_previous_state - get the state just before the EOB char was reached */
    14221218
    1423 /* %if-c-only */
    1424 /* %not-for-header */
    1425 
    1426 /* %endif */
    1427 /* %if-c++-only */
    14281219    yy_state_type yyFlexLexer::yy_get_previous_state()
    1429 /* %endif */
    14301220{
    14311221        register yy_state_type yy_current_state;
    14321222        register char *yy_cp;
    14331223   
    1434 /* %% [15.0] code to get the start state into yy_current_state goes here */
    14351224        yy_current_state = (yy_start);
    14361225
    14371226        for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
    14381227                {
    1439 /* %% [16.0] code to find the next state goes here */
    14401228                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
    14411229                if ( yy_accept[yy_current_state] )
     
    14611249 *      next_state = yy_try_NUL_trans( current_state );
    14621250 */
    1463 /* %if-c-only */
    1464 /* %endif */
    1465 /* %if-c++-only */
    14661251    yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state )
    1467 /* %endif */
    14681252{
    14691253        register int yy_is_jam;
    1470     /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
    1471         register char *yy_cp = (yy_c_buf_p);
     1254        register char *yy_cp = (yy_c_buf_p);
    14721255
    14731256        register YY_CHAR yy_c = 1;
     
    14891272}
    14901273
    1491 /* %if-c-only */
    1492 /* %endif */
    1493 /* %if-c++-only */
    14941274    void yyFlexLexer::yyunput( int c, register char* yy_bp)
    1495 /* %endif */
    14961275{
    14971276        register char *yy_cp;
     
    15251304        *--yy_cp = (char) c;
    15261305
    1527 /* %% [18.0] update yylineno here */
    1528 
    15291306        (yytext_ptr) = yy_bp;
    15301307        (yy_hold_char) = *yy_cp;
    15311308        (yy_c_buf_p) = yy_cp;
    15321309}
    1533 /* %if-c-only */
    1534 /* %endif */
    1535 
    1536 /* %if-c-only */
    1537 /* %endif */
    1538 /* %if-c++-only */
     1310
    15391311    int yyFlexLexer::yyinput()
    1540 /* %endif */
    15411312{
    15421313        int c;
     
    16021373        (yy_hold_char) = *++(yy_c_buf_p);
    16031374
    1604 /* %% [19.0] update BOL and yylineno */
    1605 
    16061375        return c;
    16071376}
    1608 /* %if-c-only */
    1609 /* %endif */
    16101377
    16111378/** Immediately switch to a different input stream.
     
    16141381 * @note This function does not reset the start condition to @c INITIAL .
    16151382 */
    1616 /* %if-c-only */
    1617 /* %endif */
    1618 /* %if-c++-only */
    16191383    void yyFlexLexer::yyrestart( std::istream* input_file )
    1620 /* %endif */
    16211384{
    16221385   
     
    16351398 *
    16361399 */
    1637 /* %if-c-only */
    1638 /* %endif */
    1639 /* %if-c++-only */
    16401400    void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
    1641 /* %endif */
    16421401{
    16431402   
     
    16701429}
    16711430
    1672 /* %if-c-only */
    1673 /* %endif */
    1674 /* %if-c++-only */
    16751431    void yyFlexLexer::yy_load_buffer_state()
    1676 /* %endif */
    16771432{
    16781433        (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
     
    16881443 * @return the allocated buffer state.
    16891444 */
    1690 /* %if-c-only */
    1691 /* %endif */
    1692 /* %if-c++-only */
    16931445    YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size )
    1694 /* %endif */
    16951446{
    16961447        YY_BUFFER_STATE b;
     
    17201471 *
    17211472 */
    1722 /* %if-c-only */
    1723 /* %endif */
    1724 /* %if-c++-only */
    17251473    void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b )
    1726 /* %endif */
    17271474{
    17281475   
     
    17391486}
    17401487
    1741 /* %if-c-only */
    1742 /* %endif */
    1743 
    1744 /* %if-c++-only */
    1745 
    17461488extern "C" int isatty (int );
    1747 
    1748 /* %endif */
    17491489
    17501490/* Initializes or reinitializes a buffer.
     
    17521492 * such as during a yyrestart() or at EOF.
    17531493 */
    1754 /* %if-c-only */
    1755 /* %endif */
    1756 /* %if-c++-only */
    17571494    void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file )
    1758 /* %endif */
    17591495
    17601496{
     
    17751511    }
    17761512
    1777 /* %if-c-only */
    1778 /* %endif */
    1779 /* %if-c++-only */
    17801513        b->yy_is_interactive = 0;
    1781 /* %endif */
    17821514        errno = oerrno;
    17831515}
     
    17871519 *
    17881520 */
    1789 /* %if-c-only */
    1790 /* %endif */
    1791 /* %if-c++-only */
    17921521    void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b )
    1793 /* %endif */
    17941522{
    17951523        if ( ! b )
     
    18141542}
    18151543
    1816 /* %if-c-or-c++ */
    18171544/** Pushes the new state onto the stack. The new state becomes
    18181545 *  the current state. This function will allocate the stack
     
    18211548 * 
    18221549 */
    1823 /* %if-c-only */
    1824 /* %endif */
    1825 /* %if-c++-only */
    18261550void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer)
    1827 /* %endif */
    18281551{
    18291552        if (new_buffer == NULL)
     
    18501573        (yy_did_buffer_switch_on_eof) = 1;
    18511574}
    1852 /* %endif */
    1853 
    1854 /* %if-c-or-c++ */
     1575
    18551576/** Removes and deletes the top of the stack, if present.
    18561577 *  The next element becomes the new top.
    18571578 * 
    18581579 */
    1859 /* %if-c-only */
    1860 /* %endif */
    1861 /* %if-c++-only */
    18621580void yyFlexLexer::yypop_buffer_state (void)
    1863 /* %endif */
    18641581{
    18651582        if (!YY_CURRENT_BUFFER)
     
    18761593        }
    18771594}
    1878 /* %endif */
    1879 
    1880 /* %if-c-or-c++ */
     1595
    18811596/* Allocates the stack if it does not exist.
    18821597 *  Guarantees space for at least one push.
    18831598 */
    1884 /* %if-c-only */
    1885 /* %endif */
    1886 /* %if-c++-only */
    18871599void yyFlexLexer::yyensure_buffer_stack(void)
    1888 /* %endif */
    18891600{
    18901601        int num_to_alloc;
     
    19281639        }
    19291640}
    1930 /* %endif */
    1931 
    1932 /* %if-c-only */
    1933 /* %endif */
    1934 
    1935 /* %if-c-only */
    1936 /* %endif */
    1937 
    1938 /* %if-c-only */
    1939 /* %endif */
    1940 
    1941 /* %if-c-only */
    1942 /* %endif */
    1943 /* %if-c++-only */
     1641
    19441642    void yyFlexLexer::yy_push_state( int new_state )
    1945 /* %endif */
    19461643{
    19471644        if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) )
     
    19671664}
    19681665
    1969 /* %if-c-only */
    1970 /* %endif */
    1971 /* %if-c++-only */
    19721666    void yyFlexLexer::yy_pop_state()
    1973 /* %endif */
    19741667{
    19751668        if ( --(yy_start_stack_ptr) < 0 )
     
    19791672}
    19801673
    1981 /* %if-c-only */
    1982 /* %endif */
    1983 /* %if-c++-only */
    19841674    int yyFlexLexer::yy_top_state()
    1985 /* %endif */
    19861675{
    19871676        return (yy_start_stack)[(yy_start_stack_ptr) - 1];
     
    19921681#endif
    19931682
    1994 /* %if-c-only */
    1995 /* %endif */
    1996 /* %if-c++-only */
    19971683void yyFlexLexer::LexerError( yyconst char msg[] )
    19981684{
     
    20001686        exit( YY_EXIT_FAILURE );
    20011687}
    2002 /* %endif */
    20031688
    20041689/* Redefine yyless() so it works in section 3 code. */
     
    20211706/* Accessor  methods (get/set functions) to struct members. */
    20221707
    2023 /* %if-c-only */
    2024 /* %if-reentrant */
    2025 /* %endif */
    2026 /* %if-reentrant */
    2027 /* %endif */
    2028 /* %endif */
    2029 
    2030 /* %if-reentrant */
    2031 /* %if-bison-bridge */
    2032 /* %endif */
    2033 /* %endif if-c-only */
    2034 
    2035 /* %if-c-only */
    2036 /* %endif */
    2037 
    2038 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */
    2039 /* %if-reentrant */
    2040 /* %endif */
    2041 /* %endif */
    2042 
    20431708/*
    20441709 * Internal utility routines.
     
    20871752}
    20881753
    2089 /* %if-tables-serialization definitions */
    2090 /* %define-yytables   The name for this specific scanner's tables. */
    20911754#define YYTABLES_NAME "yytables"
    2092 /* %endif */
    2093 
    2094 /* %ok-for-header */
    2095 
    2096 #line 106 "mesh.ll"
    2097 
    2098 
    2099 
    2100 namespace orbital {
    2101 
    2102 Scanner::Scanner(std::istream* in,
    2103                  std::ostream* out)
    2104     : MeshFlexLexer(in, out)
    2105 {
    2106 }
    2107 
    2108 Scanner::~Scanner()
    2109 {
    2110 }
    2111 
    2112 void Scanner::set_debug(bool b)
    2113 {
    2114     yy_flex_debug = b;
    2115 }
    2116 
    2117 }
    2118 
    2119 /* This implementation of MeshFlexLexer::yylex() is required to fill the
    2120  * vtable of the class MeshFlexLexer. We define the scanner's main yylex
    2121  * function via YY_DECL to reside in the Scanner class instead. */
     1755
     1756#line 71 "mesh.l"
     1757
     1758
     1759
     1760orbital::Scanner::Scanner(char const *command)
     1761    : MeshFlexLexer(0, 0),
     1762      m_input(command)
     1763{
     1764}
     1765
     1766orbital::Scanner::~Scanner()
     1767{
     1768}
     1769
     1770int orbital::Scanner::LexerInput(char* buf, int max_size)
     1771{
     1772    buf[0] = m_input[0];
     1773    if (buf[0])
     1774        ++m_input;
     1775    return buf[0] ? 1 : 0;
     1776}
    21221777
    21231778#ifdef yylex
    21241779#undef yylex
    21251780#endif
    2126 
    21271781int MeshFlexLexer::yylex()
    21281782{
     
    21311785}
    21321786
    2133 /* When the scanner receives an end-of-file indication from YY_INPUT, it then
    2134  * checks the yywrap() function. If yywrap() returns false (zero), then it is
    2135  * assumed that the function has gone ahead and set up `yyin' to point to
    2136  * another input file, and scanning continues. If it returns true (non-zero),
    2137  * then the scanner terminates, returning 0 to its caller. */
    2138 
    21391787int MeshFlexLexer::yywrap()
    21401788{
     
    21421790}
    21431791
     1792
  • trunk/orbital/mesh-driver.cpp

    r1418 r1419  
    1111
    1212Driver::Driver(Mesh &mesh)
    13     : trace_scanning(false),
    14       trace_parsing(false),
    15       mesh(mesh)
     13    : m_mesh(mesh)
    1614{
    1715}
    1816
    19 bool Driver::parse_stream(std::istream& in, const std::string& sname)
     17bool Driver::ParseString(char const *command)
    2018{
    21     streamname = sname;
    22 
    23     Scanner scanner(&in);
    24     scanner.set_debug(trace_scanning);
    25     this->lexer = &scanner;
    26 
     19    Scanner scanner(command);
     20    m_lexer = &scanner;
    2721    MeshParser parser(*this);
    28     parser.set_debug_level(trace_parsing);
    2922    return (parser.parse() == 0);
    3023}
    3124
    32 bool Driver::parse_file(const std::string &filename)
    33 {
    34     std::ifstream in(filename.c_str());
    35     if (!in.good()) return false;
    36     return parse_stream(in, filename);
    37 }
    38 
    39 bool Driver::parse_string(const std::string &input, const std::string& sname)
    40 {
    41     std::istringstream iss(input);
    42     return parse_stream(iss, sname);
    43 }
    44 
    45 void Driver::error(const class location& l,
    46                    const std::string& m)
     25void Driver::Error(const class location& l, const std::string& m)
    4726{
    4827    std::cerr << l << ": " << m << std::endl;
    4928}
    5029
    51 void Driver::error(const std::string& m)
     30void Driver::Error(const std::string& m)
    5231{
    5332    std::cerr << m << std::endl;
  • trunk/orbital/mesh-driver.h

    r1418 r1419  
    1 // $Id: driver.h 17 2007-08-19 18:51:39Z tb $   
    2 /** \file driver.h Declaration of the orbital::Driver class. */
     1//
     2// Orbital
     3//
     4// Copyright: (c) 2012 Various People
     5//
    36
    47#ifndef EXAMPLE_DRIVER_H
     
    69
    710#include <string>
    8 #include <vector>
    911
    10 // forward declaration
    11 class CalcContext;
     12class Mesh;
    1213
    13 /** The example namespace is used to encapsulate the three parser classes
    14  * orbital::Parser, orbital::Scanner and orbital::Driver */
    1514namespace orbital {
    1615
    17 /** The Driver class brings together all components. It creates an instance of
    18  * the Parser and Scanner classes and connects them. Then the input stream is
    19  * fed into the scanner object and the parser gets it's token
    20  * sequence. Furthermore the driver object is available in the grammar rules as
    21  * a parameter. Therefore the driver class contains a reference to the
    22  * structure into which the parsed data is saved. */
    2316class Driver
    2417{
    2518public:
    26     /// construct a new parser driver context
    2719    Driver(class Mesh &mesh);
    2820
    29     /// enable debug output in the flex scanner
    30     bool trace_scanning;
     21    bool ParseString(char const *command);
    3122
    32     /// enable debug output in the bison parser
    33     bool trace_parsing;
     23    void Error(const class location& l, const std::string& m);
     24    void Error(const std::string& m);
    3425
    35     /// stream name (file or input stream) used for error messages.
    36     std::string streamname;
    37 
    38     /** Invoke the scanner and parser for a stream.
    39      * @param in        input stream
    40      * @param sname     stream name for error messages
    41      * @return          true if successfully parsed
    42      */
    43     bool parse_stream(std::istream& in,
    44                       const std::string& sname = "stream input");
    45 
    46     /** Invoke the scanner and parser on an input string.
    47      * @param input     input string
    48      * @param sname     stream name for error messages
    49      * @return          true if successfully parsed
    50      */
    51     bool parse_string(const std::string& input,
    52                       const std::string& sname = "string stream");
    53 
    54     /** Invoke the scanner and parser on a file. Use parse_stream with a
    55      * std::ifstream if detection of file reading errors is required.
    56      * @param filename  input file name
    57      * @return          true if successfully parsed
    58      */
    59     bool parse_file(const std::string& filename);
    60 
    61     // To demonstrate pure handling of parse errors, instead of
    62     // simply dumping them on the standard error output, we will pass
    63     // them to the driver using the following two member functions.
    64 
    65     /** Error handling with associated line number. This can be modified to
    66      * output the error e.g. to a dialog box. */
    67     void error(const class location& l, const std::string& m);
    68 
    69     /** General error handling. This can be modified to output the error
    70      * e.g. to a dialog box. */
    71     void error(const std::string& m);
    72 
    73     /** Pointer to the current lexer instance, this is used to connect the
    74      * parser to the scanner. It is used in the yylex macro. */
    75     class Scanner* lexer;
    76 
    77     class Mesh &mesh;
     26    class Scanner* m_lexer;
     27    class Mesh &m_mesh;
    7828};
    7929
    80 } // namespace example
     30}
    8131
    82 #endif // EXAMPLE_DRIVER_H
     32#endif
     33
  • trunk/orbital/mesh-scanner.h

    r1418 r1419  
    1 // $Id: scanner.h 17 2007-08-19 18:51:39Z tb $
     1//
     2// Orbital
     3//
     4// Copyright: (c) 2012 Various People
     5//
    26
    37#ifndef EXAMPLE_SCANNER_H
    48#define EXAMPLE_SCANNER_H
    59
    6 // Flex expects the signature of yylex to be defined in the macro YY_DECL, and
    7 // the C++ parser expects it to be declared. We can factor both as follows.
    8 
    910#ifndef YY_DECL
    10 #define YY_DECL                                                           \
    11     orbital::MeshParser::token_type                                       \
     11#   define YY_DECL orbital::MeshParser::token_type \
    1212        orbital::Scanner::lex(orbital::MeshParser::semantic_type* yylval, \
    1313                              orbital::MeshParser::location_type* yylloc)
     
    1515
    1616#ifndef __FLEX_LEXER_H
    17 #define yyFlexLexer MeshFlexLexer
    18 #include "FlexLexer.h"
    19 #undef yyFlexLexer
     17#   define yyFlexLexer MeshFlexLexer
     18#   include "FlexLexer.h"
     19#   undef yyFlexLexer
    2020#endif
    2121
     
    2424namespace orbital {
    2525
    26 /** Scanner is a derived class to add some extra function to the scanner
    27  * class. Flex itself creates a class named yyFlexLexer, which is renamed using
    28  * macros to MeshFlexLexer. However we change the context of the generated
    29  * yylex() function to be contained within the Scanner class. This is required
    30  * because the yylex() defined in MeshFlexLexer has no parameters. */
    3126class Scanner : public MeshFlexLexer
    3227{
    3328public:
    34     /** Create a new scanner object. The streams arg_yyin and arg_yyout default
    35      * to cin and cout, but that assignment is only made when initializing in
    36      * yylex(). */
    37     Scanner(std::istream* arg_yyin = 0,
    38             std::ostream* arg_yyout = 0);
     29    Scanner(char const *command);
     30    virtual ~Scanner();
     31    virtual int LexerInput(char* buf, int max_size);
     32    virtual MeshParser::token_type lex(MeshParser::semantic_type* yylval,
     33                                       MeshParser::location_type* yylloc);
    3934
    40     /** Required for virtual functions */
    41     virtual ~Scanner();
    42 
    43     /** This is the main lexing function. It is generated by flex according to
    44      * the macro declaration YY_DECL above. The generated bison parser then
    45      * calls this virtual function to fetch new tokens. */
    46     virtual MeshParser::token_type lex(
    47         MeshParser::semantic_type* yylval,
    48         MeshParser::location_type* yylloc
    49         );
    50 
    51     /** Enable debug output (via arg_yyout) if compiled into the scanner. */
    52     void set_debug(bool b);
     35private:
     36    char const *m_input;
    5337};
    5438
    55 } // namespace orbital
     39}
    5640
    57 #endif // EXAMPLE_SCANNER_H
     41#endif
     42
  • trunk/orbital/mesh.h

    r1415 r1419  
    1515#define __MESH_H__
    1616
    17 #include <string>
     17#include "mesh-driver.h"
    1818
    1919class Mesh
     
    2525    {}
    2626
    27     void SendCommand(char const *command);
     27    void SendCommand(char const *command)
     28    {
     29        orbital::Driver driver(*this);
     30        driver.ParseString(command);
     31    }
    2832
    2933    void Flush()
  • trunk/orbital/mesh.yy

    r1418 r1419  
    1 /* $Id: parser.yy 48 2009-09-05 08:07:10Z tb $ -*- mode: c++ -*- */
    2 /** \file parser.yy Contains the example Bison parser source */
     1%{
     2//
     3// Orbital
     4//
     5// Copyright: (c) 2012 Various People
     6//
    37
    4 %{ /*** C/C++ Declarations ***/
    58#if defined HAVE_CONFIG_H
    69#   include "config.h"
     
    1720#include <string>
    1821#include <vector>
    19 
    2022%}
    2123
    22 /*** yacc/bison Declarations ***/
    23 
    24 /* Require bison 2.3 or later */
    2524%require "2.3"
    26 
    27 /* add debug output code to generated parser. disable this for release
    28  * versions. */
    2925%debug
    30 
    31 /* start symbol */
    32 %start mesh_description
    33 
    34 /* write out a header file containing the token defines */
    3526%defines
    36 
    37 /* use newer C++ skeleton file */
    3827%skeleton "lalr1.cc"
    39 
    40 /* namespace to enclose parser in */
    4128%name-prefix="orbital"
    42 
    43 /* set the parser's class identifier */
    4429%define parser_class_name "MeshParser"
    45 
    46 /* keep track of the current position within the input */
    4730%locations
    48 %initial-action
    49 {
    50     // initialize the initial location object
    51     @$.begin.filename = @$.end.filename = &driver.streamname;
    52 };
    53 
    54 /* The driver is passed by reference to the parser and to the scanner. This
    55  * provides a simple but effective pure interface, not relying on global
    56  * variables. */
    5731%parse-param { class Driver& driver }
    58 
    59 /* verbose error messages */
    6032%error-verbose
    6133
     
    6537    struct { float f0, f1, f2, f3, f4, f5, f6, f7; } args;
    6638}
     39
     40%start mesh_description
    6741
    6842%token T_FLUSH T_INITRB T_FREERB
     
    8357
    8458%type <fval> number
    85 
    8659%type <args> args1 args2 args3 args4 args5 args6 args7 args8
    8760
    8861%{
    89 
    9062#include "mesh-driver.h"
    9163#include "mesh-scanner.h"
    9264
    93 /* this "connects" the bison parser in the driver to the flex scanner class
    94  * object. it defines the yylex() function call to pull the next token from the
    95  * current lexer object of the driver context. */
    9665#undef yylex
    97 #define yylex driver.lexer->lex
    98 
     66#define yylex driver.m_lexer->lex
    9967%}
    10068
    101 %% /*** Grammar Rules ***/
     69%%
    10270
    10371mesh_description:
     
    11886
    11987rb_command:
    120     T_FLUSH    { driver.mesh.Flush(); }
    121   | T_INITRB   { driver.mesh.MeshConvert(); }
     88    T_FLUSH    { driver.m_mesh.Flush(); }
     89  | T_INITRB   { driver.m_mesh.MeshConvert(); }
    12290  | T_FREERB   { /* TODO */ }
    12391    ;
    12492
    12593color_command:
    126     T_COLOR args4   { driver.mesh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
    127   | T_BGCOLOR args4 { driver.mesh.SetCurColor2(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
     94    T_COLOR args4   { driver.m_mesh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
     95  | T_BGCOLOR args4 { driver.m_mesh.SetCurColor2(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
    12896    ;
    12997
    13098transform_command:
    131     T_TRANSLATEX args1  { driver.mesh.Translate(vec3($2.f0, 0, 0)); }
    132   | T_TRANSLATEY args1  { driver.mesh.Translate(vec3(0, $2.f0, 0)); }
    133   | T_TRANSLATEZ args1  { driver.mesh.Translate(vec3(0, 0, $2.f0)); }
    134   | T_TRANSLATE args3   { driver.mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); }
    135   | T_ROTATEX args1     { driver.mesh.RotateX($2.f0); }
    136   | T_ROTATEY args1     { driver.mesh.RotateY($2.f0); }
    137   | T_ROTATEZ args1     { driver.mesh.RotateZ($2.f0); }
    138   | T_TAPERX args3      { driver.mesh.TaperX($2.f0, $2.f1, $2.f2); }
    139   | T_TAPERY args3      { driver.mesh.TaperY($2.f0, $2.f1, $2.f2); }
    140   | T_TAPERZ args3      { driver.mesh.TaperZ($2.f0, $2.f1, $2.f2); }
    141   | T_SCALEX args1      { driver.mesh.Scale(vec3($2.f0, 0, 0)); }
    142   | T_SCALEY args1      { driver.mesh.Scale(vec3(0, $2.f0, 0)); }
    143   | T_SCALEZ args1      { driver.mesh.Scale(vec3(0, 0, $2.f0)); }
    144   | T_SCALE args3       { driver.mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); }
    145   | T_MIRRORX           { driver.mesh.MirrorX(); }
    146   | T_MIRRORY           { driver.mesh.MirrorY(); }
    147   | T_MIRRORZ           { driver.mesh.MirrorZ(); }
     99    T_TRANSLATEX args1  { driver.m_mesh.Translate(vec3($2.f0, 0, 0)); }
     100  | T_TRANSLATEY args1  { driver.m_mesh.Translate(vec3(0, $2.f0, 0)); }
     101  | T_TRANSLATEZ args1  { driver.m_mesh.Translate(vec3(0, 0, $2.f0)); }
     102  | T_TRANSLATE args3   { driver.m_mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); }
     103  | T_ROTATEX args1     { driver.m_mesh.RotateX($2.f0); }
     104  | T_ROTATEY args1     { driver.m_mesh.RotateY($2.f0); }
     105  | T_ROTATEZ args1     { driver.m_mesh.RotateZ($2.f0); }
     106  | T_TAPERX args3      { driver.m_mesh.TaperX($2.f0, $2.f1, $2.f2); }
     107  | T_TAPERY args3      { driver.m_mesh.TaperY($2.f0, $2.f1, $2.f2); }
     108  | T_TAPERZ args3      { driver.m_mesh.TaperZ($2.f0, $2.f1, $2.f2); }
     109  | T_SCALEX args1      { driver.m_mesh.Scale(vec3($2.f0, 0, 0)); }
     110  | T_SCALEY args1      { driver.m_mesh.Scale(vec3(0, $2.f0, 0)); }
     111  | T_SCALEZ args1      { driver.m_mesh.Scale(vec3(0, 0, $2.f0)); }
     112  | T_SCALE args3       { driver.m_mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); }
     113  | T_MIRRORX           { driver.m_mesh.MirrorX(); }
     114  | T_MIRRORY           { driver.m_mesh.MirrorY(); }
     115  | T_MIRRORZ           { driver.m_mesh.MirrorZ(); }
    148116    ;
    149117
    150118primitive_command:
    151     T_CYLINDER args6       { driver.mesh.AppendCylinder((int)$2.f0, $2.f1,
     119    T_CYLINDER args6       { driver.m_mesh.AppendCylinder((int)$2.f0, $2.f1,
    152120                                                 $2.f2, $2.f3,
    153121                                                 (int)$2.f4, (int)$2.f5); }
    154   | T_BOX args3            { driver.mesh.AppendBox(vec3($2.f0, $2.f1, $2.f2)); }
    155   | T_SMOOTHCHAMFBOX args4 { driver.mesh.AppendSmoothChamfBox(vec3($2.f0, $2.f1,
     122  | T_BOX args3            { driver.m_mesh.AppendBox(vec3($2.f0, $2.f1, $2.f2)); }
     123  | T_SMOOTHCHAMFBOX args4 { driver.m_mesh.AppendSmoothChamfBox(vec3($2.f0, $2.f1,
    156124                                                            $2.f2), $2.f3); }
    157   | T_FLATCHAMFBOX args4   { driver.mesh.AppendFlatChamfBox(vec3($2.f0, $2.f1,
     125  | T_FLATCHAMFBOX args4   { driver.m_mesh.AppendFlatChamfBox(vec3($2.f0, $2.f1,
    158126                                                          $2.f2), $2.f3); }
    159   | T_SPHERE args4         { driver.mesh.AppendSphere($2.f0,
     127  | T_SPHERE args4         { driver.m_mesh.AppendSphere($2.f0,
    160128                                               vec3($2.f1, $2.f2, $2.f3)); }
    161   | T_STAR args5           { driver.mesh.AppendStar((int)$2.f0, $2.f1, $2.f2,
     129  | T_STAR args5           { driver.m_mesh.AppendStar((int)$2.f0, $2.f1, $2.f2,
    162130                                             (int)$2.f3, (int)$2.f4); }
    163   | T_EXPANDEDSTAR args4   { driver.mesh.AppendExpandedStar((int)$2.f0, $2.f1,
     131  | T_EXPANDEDSTAR args4   { driver.m_mesh.AppendExpandedStar((int)$2.f0, $2.f1,
    164132                                                     $2.f2, $2.f3); }
    165   | T_DISC args3           { driver.mesh.AppendDisc((int)$2.f0, $2.f1, (int)$2.f2); }
    166   | T_TRIANGLE args2       { driver.mesh.AppendSimpleTriangle($2.f0, (int)$2.f1); }
    167   | T_QUAD args2           { driver.mesh.AppendSimpleQuad($2.f0, (int)$2.f1); }
    168   | T_COG args8            { driver.mesh.AppendCog((int)$2.f0, $2.f1, $2.f2, $2.f3,
     133  | T_DISC args3           { driver.m_mesh.AppendDisc((int)$2.f0, $2.f1, (int)$2.f2); }
     134  | T_TRIANGLE args2       { driver.m_mesh.AppendSimpleTriangle($2.f0, (int)$2.f1); }
     135  | T_QUAD args2           { driver.m_mesh.AppendSimpleQuad($2.f0, (int)$2.f1); }
     136  | T_COG args8            { driver.m_mesh.AppendCog((int)$2.f0, $2.f1, $2.f2, $2.f3,
    169137                                            $2.f4, $2.f5, $2.f6, (int)$2.f7); }
    170138    ;
     
    184152    ;
    185153
    186 %% /*** Additional Code ***/
     154%%
    187155
    188156void orbital::MeshParser::error(const MeshParser::location_type& l,
    189157                                const std::string& m)
    190158{
    191     driver.error(l, m);
     159    driver.Error(l, m);
    192160}
     161
Note: See TracChangeset for help on using the changeset viewer.