Changeset 1422


Ignore:
Timestamp:
May 30, 2012, 1:35:48 PM (8 years ago)
Author:
sam
Message:

orbital: fine tune the mesh compiler.

Location:
trunk
Files:
2 added
3 deleted
7 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/orbital/Makefile.am

    r1419 r1422  
    66    particlesystem.h tank.h player.h gun.h snake.h starfield.h \
    77    \
    8     mesh.h mesh-scanner.h mesh-driver.cpp mesh-driver.h \
    9     generated/mesh-scanner.cpp \
    10     generated/mesh-parser.cpp
     8    mesh.h mesh-compiler.cpp mesh-compiler.h \
     9    generated/mesh-scanner.cpp generated/mesh-parser.cpp
    1110nodist_orbital_SOURCES = \
    1211    shiny.lolfx.cpp
     
    2322        $(MKDIR_P) generated
    2423        rm -f generated/[a-zA-Z]*
    25         flex -o generated/mesh-scanner.cpp mesh.l
     24        flex -o generated/mesh-scanner.cpp mesh-scanner.l
    2625        bison -o generated/mesh-parser.cpp --defines=generated/mesh-parser.h \
    27               -d -b generated/mesh mesh.yy
     26              -d -b generated/mesh mesh-parser.y
    2827.FORCE:
    2928endif
    3029
    31 EXTRA_DIST = mesh.l mesh.yy
     30EXTRA_DIST = mesh-scanner.l mesh-parser.y
    3231CLEANFILES = $(noinst_PROGRAMS:%$(EXEEXT)=%.self) \
    3332             $(noinst_PROGRAMS:%$(EXEEXT)=%.elf) \
  • trunk/orbital/generated/mesh-parser.cpp

    r1421 r1422  
    3737
    3838/* Line 293 of lalr1.cc  */
    39 #line 1 "mesh.yy"
     39#line 1 "mesh-parser.y"
    4040
    4141//
     
    7070
    7171/* Line 299 of lalr1.cc  */
    72 #line 61 "mesh.yy"
    73 
    74 #include "../mesh-driver.h"
    75 #include "../mesh-scanner.h"
     72#line 61 "mesh-parser.y"
     73
     74#include "../mesh-compiler.h"
    7675
    7776#undef yylex
    78 #define yylex driver.m_lexer->lex
     77#define yylex mc.m_lexer->lex
    7978
    8079
    8180/* Line 299 of lalr1.cc  */
    82 #line 83 "generated/mesh-parser.cpp"
     81#line 82 "generated/mesh-parser.cpp"
    8382
    8483#ifndef YY_
     
    166165
    167166/* Line 382 of lalr1.cc  */
    168 #line 169 "generated/mesh-parser.cpp"
     167#line 168 "generated/mesh-parser.cpp"
    169168
    170169  /* Return YYSTR after stripping away unnecessary quotes and
     
    207206
    208207  /// Build a parser object.
    209   MeshParser::MeshParser (class Driver& driver_yyarg)
     208  MeshParser::MeshParser (class MeshCompiler& mc_yyarg)
    210209    :
    211210#if YYDEBUG
     
    213212      yycdebug_ (&std::cerr),
    214213#endif
    215       driver (driver_yyarg)
     214      mc (mc_yyarg)
    216215  {
    217216  }
     
    467466
    468467/* Line 690 of lalr1.cc  */
    469 #line 88 "mesh.yy"
    470     { driver.m_mesh.Flush(); }
     468#line 87 "mesh-parser.y"
     469    { mc.m_mesh.Flush(); }
    471470    break;
    472471
     
    474473
    475474/* Line 690 of lalr1.cc  */
    476 #line 89 "mesh.yy"
    477     { driver.m_mesh.MeshConvert(); }
     475#line 88 "mesh-parser.y"
     476    { mc.m_mesh.MeshConvert(); }
    478477    break;
    479478
     
    481480
    482481/* Line 690 of lalr1.cc  */
    483 #line 90 "mesh.yy"
     482#line 89 "mesh-parser.y"
    484483    { /* TODO */ }
    485484    break;
     
    488487
    489488/* Line 690 of lalr1.cc  */
    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)); }
     489#line 93 "mesh-parser.y"
     490    { mc.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)); }
    492491    break;
    493492
     
    495494
    496495/* Line 690 of lalr1.cc  */
    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)); }
     496#line 94 "mesh-parser.y"
     497    { mc.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)); }
    499498    break;
    500499
     
    502501
    503502/* Line 690 of lalr1.cc  */
    504 #line 99 "mesh.yy"
    505     { driver.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
     503#line 98 "mesh-parser.y"
     504    { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
    506505    break;
    507506
     
    509508
    510509/* Line 690 of lalr1.cc  */
    511 #line 100 "mesh.yy"
    512     { driver.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
     510#line 99 "mesh-parser.y"
     511    { mc.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
    513512    break;
    514513
     
    516515
    517516/* Line 690 of lalr1.cc  */
    518 #line 101 "mesh.yy"
    519     { driver.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
     517#line 100 "mesh-parser.y"
     518    { mc.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
    520519    break;
    521520
     
    523522
    524523/* Line 690 of lalr1.cc  */
    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)); }
     524#line 101 "mesh-parser.y"
     525    { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    527526    break;
    528527
     
    530529
    531530/* Line 690 of lalr1.cc  */
    532 #line 103 "mesh.yy"
    533     { driver.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); }
     531#line 102 "mesh-parser.y"
     532    { mc.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); }
    534533    break;
    535534
     
    537536
    538537/* Line 690 of lalr1.cc  */
    539 #line 104 "mesh.yy"
    540     { driver.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); }
     538#line 103 "mesh-parser.y"
     539    { mc.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); }
    541540    break;
    542541
     
    544543
    545544/* Line 690 of lalr1.cc  */
    546 #line 105 "mesh.yy"
    547     { driver.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); }
     545#line 104 "mesh-parser.y"
     546    { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); }
    548547    break;
    549548
     
    551550
    552551/* Line 690 of lalr1.cc  */
    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); }
     552#line 105 "mesh-parser.y"
     553    { mc.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    555554    break;
    556555
     
    558557
    559558/* Line 690 of lalr1.cc  */
    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); }
     559#line 106 "mesh-parser.y"
     560    { mc.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    562561    break;
    563562
     
    565564
    566565/* Line 690 of lalr1.cc  */
    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); }
     566#line 107 "mesh-parser.y"
     567    { mc.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    569568    break;
    570569
     
    572571
    573572/* Line 690 of lalr1.cc  */
    574 #line 109 "mesh.yy"
    575     { driver.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
     573#line 108 "mesh-parser.y"
     574    { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
    576575    break;
    577576
     
    579578
    580579/* Line 690 of lalr1.cc  */
    581 #line 110 "mesh.yy"
    582     { driver.m_mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
     580#line 109 "mesh-parser.y"
     581    { mc.m_mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
    583582    break;
    584583
     
    586585
    587586/* Line 690 of lalr1.cc  */
    588 #line 111 "mesh.yy"
    589     { driver.m_mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
     587#line 110 "mesh-parser.y"
     588    { mc.m_mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
    590589    break;
    591590
     
    593592
    594593/* Line 690 of lalr1.cc  */
    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)); }
     594#line 111 "mesh-parser.y"
     595    { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    597596    break;
    598597
     
    600599
    601600/* Line 690 of lalr1.cc  */
    602 #line 113 "mesh.yy"
    603     { driver.m_mesh.MirrorX(); }
     601#line 112 "mesh-parser.y"
     602    { mc.m_mesh.MirrorX(); }
    604603    break;
    605604
     
    607606
    608607/* Line 690 of lalr1.cc  */
    609 #line 114 "mesh.yy"
    610     { driver.m_mesh.MirrorY(); }
     608#line 113 "mesh-parser.y"
     609    { mc.m_mesh.MirrorY(); }
    611610    break;
    612611
     
    614613
    615614/* Line 690 of lalr1.cc  */
    616 #line 115 "mesh.yy"
    617     { driver.m_mesh.MirrorZ(); }
     615#line 114 "mesh-parser.y"
     616    { mc.m_mesh.MirrorZ(); }
    618617    break;
    619618
     
    621620
    622621/* Line 690 of lalr1.cc  */
    623 #line 119 "mesh.yy"
    624     { driver.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
     622#line 118 "mesh-parser.y"
     623    { mc.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    625624                                                 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3,
    626625                                                 (int)(yysemantic_stack_[(2) - (2)].args).f4, (int)(yysemantic_stack_[(2) - (2)].args).f5); }
     
    630629
    631630/* Line 690 of lalr1.cc  */
    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)); }
     631#line 121 "mesh-parser.y"
     632    { mc.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    634633    break;
    635634
     
    637636
    638637/* Line 690 of lalr1.cc  */
    639 #line 123 "mesh.yy"
    640     { driver.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
     638#line 122 "mesh-parser.y"
     639    { mc.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    641640                                                            (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); }
    642641    break;
     
    645644
    646645/* Line 690 of lalr1.cc  */
    647 #line 125 "mesh.yy"
    648     { driver.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
     646#line 124 "mesh-parser.y"
     647    { mc.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    649648                                                          (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); }
    650649    break;
     
    653652
    654653/* Line 690 of lalr1.cc  */
    655 #line 127 "mesh.yy"
    656     { driver.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0,
     654#line 126 "mesh-parser.y"
     655    { mc.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0,
    657656                                               vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }
    658657    break;
     
    661660
    662661/* Line 690 of lalr1.cc  */
    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,
     662#line 128 "mesh-parser.y"
     663    { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2,
    665664                                             (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); }
    666665    break;
     
    669668
    670669/* Line 690 of lalr1.cc  */
    671 #line 131 "mesh.yy"
    672     { driver.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
     670#line 130 "mesh-parser.y"
     671    { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    673672                                                     (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); }
    674673    break;
     
    677676
    678677/* Line 690 of lalr1.cc  */
    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); }
     678#line 132 "mesh-parser.y"
     679    { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); }
    681680    break;
    682681
     
    684683
    685684/* Line 690 of lalr1.cc  */
    686 #line 134 "mesh.yy"
    687     { driver.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
     685#line 133 "mesh-parser.y"
     686    { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
    688687    break;
    689688
     
    691690
    692691/* Line 690 of lalr1.cc  */
    693 #line 135 "mesh.yy"
    694     { driver.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
     692#line 134 "mesh-parser.y"
     693    { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
    695694    break;
    696695
     
    698697
    699698/* Line 690 of lalr1.cc  */
    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,
     699#line 135 "mesh-parser.y"
     700    { mc.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,
    702701                                            (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); }
    703702    break;
     
    706705
    707706/* Line 690 of lalr1.cc  */
    708 #line 140 "mesh.yy"
     707#line 139 "mesh-parser.y"
    709708    { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); }
    710709    break;
     
    713712
    714713/* Line 690 of lalr1.cc  */
    715 #line 141 "mesh.yy"
     714#line 140 "mesh-parser.y"
    716715    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); }
    717716    break;
     
    720719
    721720/* Line 690 of lalr1.cc  */
    722 #line 142 "mesh.yy"
     721#line 141 "mesh-parser.y"
    723722    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); }
    724723    break;
     
    727726
    728727/* Line 690 of lalr1.cc  */
    729 #line 143 "mesh.yy"
     728#line 142 "mesh-parser.y"
    730729    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(3) - (3)].fval); }
    731730    break;
     
    734733
    735734/* Line 690 of lalr1.cc  */
    736 #line 144 "mesh.yy"
     735#line 143 "mesh-parser.y"
    737736    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(3) - (3)].fval); }
    738737    break;
     
    741740
    742741/* Line 690 of lalr1.cc  */
    743 #line 145 "mesh.yy"
     742#line 144 "mesh-parser.y"
    744743    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(3) - (3)].fval); }
    745744    break;
     
    748747
    749748/* Line 690 of lalr1.cc  */
    750 #line 146 "mesh.yy"
     749#line 145 "mesh-parser.y"
    751750    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(3) - (3)].fval); }
    752751    break;
     
    755754
    756755/* Line 690 of lalr1.cc  */
    757 #line 147 "mesh.yy"
     756#line 146 "mesh-parser.y"
    758757    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(3) - (3)].fval); }
    759758    break;
     
    762761
    763762/* Line 690 of lalr1.cc  */
    764 #line 150 "mesh.yy"
     763#line 149 "mesh-parser.y"
    765764    { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); }
    766765    break;
     
    769768
    770769/* Line 690 of lalr1.cc  */
    771 #line 151 "mesh.yy"
     770#line 150 "mesh-parser.y"
    772771    { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); }
    773772    break;
     
    776775
    777776/* Line 690 of lalr1.cc  */
    778 #line 779 "generated/mesh-parser.cpp"
     777#line 778 "generated/mesh-parser.cpp"
    779778        default:
    780779          break;
     
    12461245  MeshParser::yyrline_[] =
    12471246  {
    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
     1247         0,    71,    71,    75,    76,    80,    81,    82,    83,    87,
     1248      88,    89,    93,    94,    98,    99,   100,   101,   102,   103,
     1249     104,   105,   106,   107,   108,   109,   110,   111,   112,   113,
     1250     114,   118,   121,   122,   124,   126,   128,   130,   132,   133,
     1251     134,   135,   139,   140,   141,   142,   143,   144,   145,   146,
     1252     149,   150
    12541253  };
    12551254
     
    13441343
    13451344/* Line 1136 of lalr1.cc  */
    1346 #line 1347 "generated/mesh-parser.cpp"
     1345#line 1346 "generated/mesh-parser.cpp"
    13471346
    13481347
    13491348/* Line 1138 of lalr1.cc  */
    1350 #line 154 "mesh.yy"
     1349#line 153 "mesh-parser.y"
    13511350
    13521351
     
    13541353                                const std::string& m)
    13551354{
    1356     driver.Error(l, m);
     1355    mc.Error(l, m);
    13571356}
    13581357
  • trunk/orbital/generated/mesh-parser.h

    r1419 r1422  
    7777
    7878/* Line 35 of lalr1.cc  */
    79 #line 35 "mesh.yy"
     79#line 35 "mesh-parser.y"
    8080
    8181    float fval;
     
    139139
    140140    /// Build a parser object.
    141     MeshParser (class Driver& driver_yyarg);
     141    MeshParser (class MeshCompiler& mc_yyarg);
    142142    virtual ~MeshParser ();
    143143
     
    305305
    306306    /* User arguments.  */
    307     class Driver& driver;
     307    class MeshCompiler& mc;
    308308  };
    309309
  • trunk/orbital/generated/mesh-scanner.cpp

    r1421 r1422  
    453453#define YY_MORE_ADJ 0
    454454#define YY_RESTORE_YY_MORE_OFFSET
    455 #line 1 "mesh.l"
    456 #line 2 "mesh.l"
     455#line 1 "mesh-scanner.l"
     456#line 2 "mesh-scanner.l"
    457457//
    458458// Orbital
     
    461461//
    462462
    463 #include "../mesh-scanner.h"
     463#include "../mesh-compiler.h"
    464464
    465465typedef orbital::MeshParser::token token;
     
    574574        register int yy_act;
    575575   
    576 #line 21 "mesh.l"
     576#line 21 "mesh-scanner.l"
    577577
    578578
     
    663663case 1:
    664664YY_RULE_SETUP
    665 #line 28 "mesh.l"
     665#line 28 "mesh-scanner.l"
    666666{ return token::T_FLUSH; }
    667667        YY_BREAK
    668668case 2:
    669669YY_RULE_SETUP
    670 #line 29 "mesh.l"
     670#line 29 "mesh-scanner.l"
    671671{ return token::T_INITRB; }
    672672        YY_BREAK
    673673case 3:
    674674YY_RULE_SETUP
    675 #line 30 "mesh.l"
     675#line 30 "mesh-scanner.l"
    676676{ return token::T_FREERB; }
    677677        YY_BREAK
    678678case 4:
    679679YY_RULE_SETUP
    680 #line 32 "mesh.l"
     680#line 32 "mesh-scanner.l"
    681681{ return token::T_COLOR; }
    682682        YY_BREAK
    683683case 5:
    684684YY_RULE_SETUP
    685 #line 33 "mesh.l"
     685#line 33 "mesh-scanner.l"
    686686{ return token::T_BGCOLOR; }
    687687        YY_BREAK
    688688case 6:
    689689YY_RULE_SETUP
    690 #line 35 "mesh.l"
     690#line 35 "mesh-scanner.l"
    691691{ return token::T_TRANSLATEX; }
    692692        YY_BREAK
    693693case 7:
    694694YY_RULE_SETUP
    695 #line 36 "mesh.l"
     695#line 36 "mesh-scanner.l"
    696696{ return token::T_TRANSLATEY; }
    697697        YY_BREAK
    698698case 8:
    699699YY_RULE_SETUP
    700 #line 37 "mesh.l"
     700#line 37 "mesh-scanner.l"
    701701{ return token::T_TRANSLATEZ; }
    702702        YY_BREAK
    703703case 9:
    704704YY_RULE_SETUP
    705 #line 38 "mesh.l"
     705#line 38 "mesh-scanner.l"
    706706{ return token::T_TRANSLATE; }
    707707        YY_BREAK
    708708case 10:
    709709YY_RULE_SETUP
    710 #line 39 "mesh.l"
     710#line 39 "mesh-scanner.l"
    711711{ return token::T_ROTATEX; }
    712712        YY_BREAK
    713713case 11:
    714714YY_RULE_SETUP
    715 #line 40 "mesh.l"
     715#line 40 "mesh-scanner.l"
    716716{ return token::T_ROTATEY; }
    717717        YY_BREAK
    718718case 12:
    719719YY_RULE_SETUP
    720 #line 41 "mesh.l"
     720#line 41 "mesh-scanner.l"
    721721{ return token::T_ROTATEZ; }
    722722        YY_BREAK
    723723case 13:
    724724YY_RULE_SETUP
    725 #line 42 "mesh.l"
     725#line 42 "mesh-scanner.l"
    726726{ return token::T_TAPERX; }
    727727        YY_BREAK
    728728case 14:
    729729YY_RULE_SETUP
    730 #line 43 "mesh.l"
     730#line 43 "mesh-scanner.l"
    731731{ return token::T_TAPERY; }
    732732        YY_BREAK
    733733case 15:
    734734YY_RULE_SETUP
    735 #line 44 "mesh.l"
     735#line 44 "mesh-scanner.l"
    736736{ return token::T_TAPERZ; }
    737737        YY_BREAK
    738738case 16:
    739739YY_RULE_SETUP
    740 #line 45 "mesh.l"
     740#line 45 "mesh-scanner.l"
    741741{ return token::T_SCALEX; }
    742742        YY_BREAK
    743743case 17:
    744744YY_RULE_SETUP
    745 #line 46 "mesh.l"
     745#line 46 "mesh-scanner.l"
    746746{ return token::T_SCALEY; }
    747747        YY_BREAK
    748748case 18:
    749749YY_RULE_SETUP
    750 #line 47 "mesh.l"
     750#line 47 "mesh-scanner.l"
    751751{ return token::T_SCALEZ; }
    752752        YY_BREAK
    753753case 19:
    754754YY_RULE_SETUP
    755 #line 48 "mesh.l"
     755#line 48 "mesh-scanner.l"
    756756{ return token::T_SCALE; }
    757757        YY_BREAK
    758758case 20:
    759759YY_RULE_SETUP
    760 #line 49 "mesh.l"
     760#line 49 "mesh-scanner.l"
    761761{ return token::T_MIRRORX; }
    762762        YY_BREAK
    763763case 21:
    764764YY_RULE_SETUP
    765 #line 50 "mesh.l"
     765#line 50 "mesh-scanner.l"
    766766{ return token::T_MIRRORY; }
    767767        YY_BREAK
    768768case 22:
    769769YY_RULE_SETUP
    770 #line 51 "mesh.l"
     770#line 51 "mesh-scanner.l"
    771771{ return token::T_MIRRORZ; }
    772772        YY_BREAK
    773773case 23:
    774774YY_RULE_SETUP
    775 #line 53 "mesh.l"
     775#line 53 "mesh-scanner.l"
    776776{ return token::T_CYLINDER; }
    777777        YY_BREAK
    778778case 24:
    779779YY_RULE_SETUP
    780 #line 54 "mesh.l"
     780#line 54 "mesh-scanner.l"
    781781{ return token::T_BOX; }
    782782        YY_BREAK
    783783case 25:
    784784YY_RULE_SETUP
    785 #line 55 "mesh.l"
     785#line 55 "mesh-scanner.l"
    786786{ return token::T_SMOOTHCHAMFBOX; }
    787787        YY_BREAK
    788788case 26:
    789789YY_RULE_SETUP
    790 #line 56 "mesh.l"
     790#line 56 "mesh-scanner.l"
    791791{ return token::T_FLATCHAMFBOX; }
    792792        YY_BREAK
    793793case 27:
    794794YY_RULE_SETUP
    795 #line 57 "mesh.l"
     795#line 57 "mesh-scanner.l"
    796796{ return token::T_SPHERE; }
    797797        YY_BREAK
    798798case 28:
    799799YY_RULE_SETUP
    800 #line 58 "mesh.l"
     800#line 58 "mesh-scanner.l"
    801801{ return token::T_STAR; }
    802802        YY_BREAK
    803803case 29:
    804804YY_RULE_SETUP
    805 #line 59 "mesh.l"
     805#line 59 "mesh-scanner.l"
    806806{ return token::T_EXPANDEDSTAR; }
    807807        YY_BREAK
    808808case 30:
    809809YY_RULE_SETUP
    810 #line 60 "mesh.l"
     810#line 60 "mesh-scanner.l"
    811811{ return token::T_DISC; }
    812812        YY_BREAK
    813813case 31:
    814814YY_RULE_SETUP
    815 #line 61 "mesh.l"
     815#line 61 "mesh-scanner.l"
    816816{ return token::T_TRIANGLE; }
    817817        YY_BREAK
    818818case 32:
    819819YY_RULE_SETUP
    820 #line 62 "mesh.l"
     820#line 62 "mesh-scanner.l"
    821821{ return token::T_QUAD; }
    822822        YY_BREAK
    823823case 33:
    824824YY_RULE_SETUP
    825 #line 63 "mesh.l"
     825#line 63 "mesh-scanner.l"
    826826{ return token::T_COG; }
    827827        YY_BREAK
    828828case 34:
    829829YY_RULE_SETUP
    830 #line 65 "mesh.l"
     830#line 65 "mesh-scanner.l"
    831831{
    832832        yylval->fval = atof(yytext); return token::NUMBER; }
     
    834834case 35:
    835835YY_RULE_SETUP
    836 #line 67 "mesh.l"
     836#line 67 "mesh-scanner.l"
    837837{ return token_type('-'); }
    838838        YY_BREAK
    839839case 36:
    840840YY_RULE_SETUP
    841 #line 68 "mesh.l"
     841#line 68 "mesh-scanner.l"
    842842{ return token_type(','); }
    843843        YY_BREAK
     
    845845/* rule 37 can match eol */
    846846YY_RULE_SETUP
    847 #line 69 "mesh.l"
     847#line 69 "mesh-scanner.l"
    848848{ /* ignore everything else */ }
    849849        YY_BREAK
    850850case 38:
    851851YY_RULE_SETUP
    852 #line 71 "mesh.l"
     852#line 71 "mesh-scanner.l"
    853853ECHO;
    854854        YY_BREAK
     
    17541754#define YYTABLES_NAME "yytables"
    17551755
    1756 #line 71 "mesh.l"
    1757 
    1758 
    1759 
    1760 orbital::Scanner::Scanner(char const *command)
     1756#line 71 "mesh-scanner.l"
     1757
     1758
     1759
     1760orbital::MeshScanner::MeshScanner(char const *command)
    17611761    : MeshFlexLexer(0, 0),
    17621762      m_input(command)
     
    17641764}
    17651765
    1766 orbital::Scanner::~Scanner()
    1767 {
    1768 }
    1769 
    1770 int orbital::Scanner::LexerInput(char* buf, int max_size)
     1766orbital::MeshScanner::~MeshScanner()
     1767{
     1768}
     1769
     1770int orbital::MeshScanner::LexerInput(char* buf, int max_size)
    17711771{
    17721772    buf[0] = m_input[0];
  • trunk/orbital/mesh-parser.y

    r1421 r1422  
    2929%define parser_class_name "MeshParser"
    3030%locations
    31 %parse-param { class Driver& driver }
     31%parse-param { class MeshCompiler& mc }
    3232%error-verbose
    3333
     
    6060
    6161%{
    62 #include "../mesh-driver.h"
    63 #include "../mesh-scanner.h"
     62#include "../mesh-compiler.h"
    6463
    6564#undef yylex
    66 #define yylex driver.m_lexer->lex
     65#define yylex mc.m_lexer->lex
    6766%}
    6867
     
    8685
    8786rb_command:
    88     T_FLUSH    { driver.m_mesh.Flush(); }
    89   | T_INITRB   { driver.m_mesh.MeshConvert(); }
     87    T_FLUSH    { mc.m_mesh.Flush(); }
     88  | T_INITRB   { mc.m_mesh.MeshConvert(); }
    9089  | T_FREERB   { /* TODO */ }
    9190    ;
    9291
    9392color_command:
    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)); }
     93    T_COLOR args4   { mc.m_mesh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
     94  | T_BGCOLOR args4 { mc.m_mesh.SetCurColor2(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }
    9695    ;
    9796
    9897transform_command:
    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(); }
     98    T_TRANSLATEX args1  { mc.m_mesh.Translate(vec3($2.f0, 0, 0)); }
     99  | T_TRANSLATEY args1  { mc.m_mesh.Translate(vec3(0, $2.f0, 0)); }
     100  | T_TRANSLATEZ args1  { mc.m_mesh.Translate(vec3(0, 0, $2.f0)); }
     101  | T_TRANSLATE args3   { mc.m_mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); }
     102  | T_ROTATEX args1     { mc.m_mesh.RotateX($2.f0); }
     103  | T_ROTATEY args1     { mc.m_mesh.RotateY($2.f0); }
     104  | T_ROTATEZ args1     { mc.m_mesh.RotateZ($2.f0); }
     105  | T_TAPERX args3      { mc.m_mesh.TaperX($2.f0, $2.f1, $2.f2); }
     106  | T_TAPERY args3      { mc.m_mesh.TaperY($2.f0, $2.f1, $2.f2); }
     107  | T_TAPERZ args3      { mc.m_mesh.TaperZ($2.f0, $2.f1, $2.f2); }
     108  | T_SCALEX args1      { mc.m_mesh.Scale(vec3($2.f0, 0, 0)); }
     109  | T_SCALEY args1      { mc.m_mesh.Scale(vec3(0, $2.f0, 0)); }
     110  | T_SCALEZ args1      { mc.m_mesh.Scale(vec3(0, 0, $2.f0)); }
     111  | T_SCALE args3       { mc.m_mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); }
     112  | T_MIRRORX           { mc.m_mesh.MirrorX(); }
     113  | T_MIRRORY           { mc.m_mesh.MirrorY(); }
     114  | T_MIRRORZ           { mc.m_mesh.MirrorZ(); }
    116115    ;
    117116
    118117primitive_command:
    119     T_CYLINDER args6       { driver.m_mesh.AppendCylinder((int)$2.f0, $2.f1,
     118    T_CYLINDER args6       { mc.m_mesh.AppendCylinder((int)$2.f0, $2.f1,
    120119                                                 $2.f2, $2.f3,
    121120                                                 (int)$2.f4, (int)$2.f5); }
    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,
     121  | T_BOX args3            { mc.m_mesh.AppendBox(vec3($2.f0, $2.f1, $2.f2)); }
     122  | T_SMOOTHCHAMFBOX args4 { mc.m_mesh.AppendSmoothChamfBox(vec3($2.f0, $2.f1,
    124123                                                            $2.f2), $2.f3); }
    125   | T_FLATCHAMFBOX args4   { driver.m_mesh.AppendFlatChamfBox(vec3($2.f0, $2.f1,
     124  | T_FLATCHAMFBOX args4   { mc.m_mesh.AppendFlatChamfBox(vec3($2.f0, $2.f1,
    126125                                                          $2.f2), $2.f3); }
    127   | T_SPHERE args4         { driver.m_mesh.AppendSphere($2.f0,
     126  | T_SPHERE args4         { mc.m_mesh.AppendSphere($2.f0,
    128127                                               vec3($2.f1, $2.f2, $2.f3)); }
    129   | T_STAR args5           { driver.m_mesh.AppendStar((int)$2.f0, $2.f1, $2.f2,
     128  | T_STAR args5           { mc.m_mesh.AppendStar((int)$2.f0, $2.f1, $2.f2,
    130129                                             (int)$2.f3, (int)$2.f4); }
    131   | T_EXPANDEDSTAR args4   { driver.m_mesh.AppendExpandedStar((int)$2.f0, $2.f1,
     130  | T_EXPANDEDSTAR args4   { mc.m_mesh.AppendExpandedStar((int)$2.f0, $2.f1,
    132131                                                     $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,
     132  | T_DISC args3           { mc.m_mesh.AppendDisc((int)$2.f0, $2.f1, (int)$2.f2); }
     133  | T_TRIANGLE args2       { mc.m_mesh.AppendSimpleTriangle($2.f0, (int)$2.f1); }
     134  | T_QUAD args2           { mc.m_mesh.AppendSimpleQuad($2.f0, (int)$2.f1); }
     135  | T_COG args8            { mc.m_mesh.AppendCog((int)$2.f0, $2.f1, $2.f2, $2.f3,
    137136                                            $2.f4, $2.f5, $2.f6, (int)$2.f7); }
    138137    ;
     
    157156                                const std::string& m)
    158157{
    159     driver.Error(l, m);
     158    mc.Error(l, m);
    160159}
    161160
  • trunk/orbital/mesh-scanner.l

    r1421 r1422  
    66//
    77
    8 #include "../mesh-scanner.h"
     8#include "../mesh-compiler.h"
    99
    1010typedef orbital::MeshParser::token token;
     
    7171%%
    7272
    73 orbital::Scanner::Scanner(char const *command)
     73orbital::MeshScanner::MeshScanner(char const *command)
    7474    : MeshFlexLexer(0, 0),
    7575      m_input(command)
     
    7777}
    7878
    79 orbital::Scanner::~Scanner()
     79orbital::MeshScanner::~MeshScanner()
    8080{
    8181}
    8282
    83 int orbital::Scanner::LexerInput(char* buf, int max_size)
     83int orbital::MeshScanner::LexerInput(char* buf, int max_size)
    8484{
    8585    buf[0] = m_input[0];
  • trunk/orbital/mesh.h

    r1419 r1422  
    1515#define __MESH_H__
    1616
    17 #include "mesh-driver.h"
     17#include "mesh-compiler.h"
    1818
    1919class Mesh
     
    2727    void SendCommand(char const *command)
    2828    {
    29         orbital::Driver driver(*this);
    30         driver.ParseString(command);
     29        orbital::MeshCompiler mc(*this);
     30        mc.ParseString(command);
    3131    }
    3232
  • trunk/win32/orbital.vcxproj

    r1421 r1422  
    3131    <ClInclude Include="..\orbital\generated\mesh-parser.h" />
    3232    <ClInclude Include="..\orbital\gun.h" />
    33     <ClInclude Include="..\orbital\mesh-driver.h" />
    34     <ClInclude Include="..\orbital\mesh-scanner.h" />
     33    <ClInclude Include="..\orbital\mesh-compiler.h" />
    3534    <ClInclude Include="..\orbital\mesh.h" />
    3635    <ClInclude Include="..\orbital\orbital.h" />
     
    4443    <ClCompile Include="..\orbital\generated\mesh-parser.cpp" />
    4544    <ClCompile Include="..\orbital\generated\mesh-scanner.cpp" />
    46     <ClCompile Include="..\orbital\mesh-driver.cpp" />
     45    <ClCompile Include="..\orbital\mesh-compiler.cpp" />
    4746    <ClCompile Include="..\orbital\orbital.cpp" />
    4847  </ItemGroup>
  • trunk/win32/orbital.vcxproj.filters

    r1421 r1422  
    99    <ClInclude Include="..\orbital\starfield.h" />
    1010    <ClInclude Include="..\orbital\snake.h" />
    11     <ClInclude Include="..\orbital\mesh-driver.h" />
    12     <ClInclude Include="..\orbital\mesh-scanner.h" />
     11    <ClInclude Include="..\orbital\mesh-compiler.h" />
    1312    <ClInclude Include="..\orbital\generated\mesh-parser.h">
    1413      <Filter>generated</Filter>
     
    2322  <ItemGroup>
    2423    <ClCompile Include="..\orbital\orbital.cpp" />
    25     <ClCompile Include="..\orbital\mesh-driver.cpp" />
     24    <ClCompile Include="..\orbital\mesh-compiler.cpp" />
    2625    <ClCompile Include="..\orbital\generated\mesh-parser.cpp">
    2726      <Filter>generated</Filter>
Note: See TracChangeset for help on using the changeset viewer.