Changeset 1424


Ignore:
Timestamp:
May 30, 2012, 3:08:27 PM (11 years ago)
Author:
sam
Message:

orbital: port the gun command compiler to our bison/flex system.

Location:
trunk
Files:
6 added
2 deleted
10 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/orbital/Makefile.am

    r1422 r1424  
    66    particlesystem.h tank.h player.h gun.h snake.h starfield.h \
    77    \
    8     mesh.h mesh-compiler.cpp mesh-compiler.h \
    9     generated/mesh-scanner.cpp generated/mesh-parser.cpp
     8    mesh.cpp mesh.h mesh-compiler.cpp mesh-compiler.h \
     9    generated/mesh-scanner.cpp generated/mesh-parser.cpp \
     10    \
     11    gun.cpp gun.h gun-compiler.cpp gun-compiler.h \
     12    generated/gun-scanner.cpp generated/gun-parser.cpp
    1013nodist_orbital_SOURCES = \
    1114    shiny.lolfx.cpp
     
    2326        rm -f generated/[a-zA-Z]*
    2427        flex -o generated/mesh-scanner.cpp mesh-scanner.l
     28        flex -o generated/gun-scanner.cpp gun-scanner.l
    2529        bison -o generated/mesh-parser.cpp --defines=generated/mesh-parser.h \
    2630              -d -b generated/mesh mesh-parser.y
     31        bison -o generated/gun-parser.cpp --defines=generated/gun-parser.h \
     32              -d -b generated/gun gun-parser.y
    2733.FORCE:
    2834endif
    2935
    30 EXTRA_DIST = mesh-scanner.l mesh-parser.y
     36EXTRA_DIST = mesh-scanner.l mesh-parser.y \
     37             gun-scanner.l gun-parser.y
    3138CLEANFILES = $(noinst_PROGRAMS:%$(EXEEXT)=%.self) \
    3239             $(noinst_PROGRAMS:%$(EXEEXT)=%.elf) \
  • trunk/orbital/generated/gun-parser.cpp

    r1423 r1424  
    3737
    3838/* Line 293 of lalr1.cc  */
    39 #line 1 "mesh-parser.y"
     39#line 1 "gun-parser.y"
    4040
    4141//
    4242// Orbital
    4343//
    44 // Copyright: (c) 2012 Various People
     44// Copyright: (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
     45//            (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
     46//            (c) 2012 Sam Hocevar <sam@hocevar.net>
    4547//
    4648
     
    5456using namespace lol;
    5557
    56 #include "../mesh.h"
     58#include "../gun.h"
    5759
    5860#include <stdio.h>
     
    6264
    6365/* Line 293 of lalr1.cc  */
    64 #line 65 "generated/mesh-parser.cpp"
    65 
    66 
    67 #include "mesh-parser.h"
     66#line 67 "generated/gun-parser.cpp"
     67
     68
     69#include "gun-parser.h"
    6870
    6971/* User implementation prologue.  */
    7072
    7173/* Line 299 of lalr1.cc  */
    72 #line 61 "mesh-parser.y"
    73 
    74 #include "../mesh-compiler.h"
     74#line 68 "gun-parser.y"
     75
     76#include "../gun-compiler.h"
    7577
    7678#undef yylex
    77 #define yylex mc.m_lexer->lex
     79#define yylex gc.m_lexer->lex
    7880
    7981
    8082/* Line 299 of lalr1.cc  */
    81 #line 82 "generated/mesh-parser.cpp"
     83#line 84 "generated/gun-parser.cpp"
    8284
    8385#ifndef YY_
     
    165167
    166168/* Line 382 of lalr1.cc  */
    167 #line 168 "generated/mesh-parser.cpp"
     169#line 170 "generated/gun-parser.cpp"
    168170
    169171  /* Return YYSTR after stripping away unnecessary quotes and
     
    173175     YYSTR is taken from yytname.  */
    174176  std::string
    175   MeshParser::yytnamerr_ (const char *yystr)
     177  GunParser::yytnamerr_ (const char *yystr)
    176178  {
    177179    if (*yystr == '"')
     
    206208
    207209  /// Build a parser object.
    208   MeshParser::MeshParser (class MeshCompiler& mc_yyarg)
     210  GunParser::GunParser (class GunCompiler& gc_yyarg)
    209211    :
    210212#if YYDEBUG
     
    212214      yycdebug_ (&std::cerr),
    213215#endif
    214       mc (mc_yyarg)
    215   {
    216   }
    217 
    218   MeshParser::~MeshParser ()
     216      gc (gc_yyarg)
     217  {
     218  }
     219
     220  GunParser::~GunParser ()
    219221  {
    220222  }
     
    226228
    227229  inline void
    228   MeshParser::yy_symbol_value_print_ (int yytype,
     230  GunParser::yy_symbol_value_print_ (int yytype,
    229231                           const semantic_type* yyvaluep, const location_type* yylocationp)
    230232  {
     
    240242
    241243  void
    242   MeshParser::yy_symbol_print_ (int yytype,
     244  GunParser::yy_symbol_print_ (int yytype,
    243245                           const semantic_type* yyvaluep, const location_type* yylocationp)
    244246  {
     
    252254
    253255  void
    254   MeshParser::yydestruct_ (const char* yymsg,
     256  GunParser::yydestruct_ (const char* yymsg,
    255257                           int yytype, semantic_type* yyvaluep, location_type* yylocationp)
    256258  {
     
    270272
    271273  void
    272   MeshParser::yypop_ (unsigned int n)
     274  GunParser::yypop_ (unsigned int n)
    273275  {
    274276    yystate_stack_.pop (n);
     
    279281#if YYDEBUG
    280282  std::ostream&
    281   MeshParser::debug_stream () const
     283  GunParser::debug_stream () const
    282284  {
    283285    return *yycdebug_;
     
    285287
    286288  void
    287   MeshParser::set_debug_stream (std::ostream& o)
     289  GunParser::set_debug_stream (std::ostream& o)
    288290  {
    289291    yycdebug_ = &o;
     
    291293
    292294
    293   MeshParser::debug_level_type
    294   MeshParser::debug_level () const
     295  GunParser::debug_level_type
     296  GunParser::debug_level () const
    295297  {
    296298    return yydebug_;
     
    298300
    299301  void
    300   MeshParser::set_debug_level (debug_level_type l)
     302  GunParser::set_debug_level (debug_level_type l)
    301303  {
    302304    yydebug_ = l;
     
    305307
    306308  inline bool
    307   MeshParser::yy_pact_value_is_default_ (int yyvalue)
     309  GunParser::yy_pact_value_is_default_ (int yyvalue)
    308310  {
    309311    return yyvalue == yypact_ninf_;
     
    311313
    312314  inline bool
    313   MeshParser::yy_table_value_is_error_ (int yyvalue)
     315  GunParser::yy_table_value_is_error_ (int yyvalue)
    314316  {
    315317    return yyvalue == yytable_ninf_;
     
    317319
    318320  int
    319   MeshParser::parse ()
     321  GunParser::parse ()
    320322  {
    321323    /// Lookahead and lookahead in internal form.
     
    463465    switch (yyn)
    464466      {
    465           case 9:
    466 
    467 /* Line 690 of lalr1.cc  */
    468 #line 87 "mesh-parser.y"
    469     { mc.m_mesh.Flush(); }
     467          case 5:
     468
     469/* Line 690 of lalr1.cc  */
     470#line 87 "gun-parser.y"
     471    { gc.m_gun.m_angle = gc.m_gun.AimActor(); }
     472    break;
     473
     474  case 6:
     475
     476/* Line 690 of lalr1.cc  */
     477#line 88 "gun-parser.y"
     478    { gc.m_gun.PreAimActor((yysemantic_stack_[(2) - (2)].args).f0); }
     479    break;
     480
     481  case 7:
     482
     483/* Line 690 of lalr1.cc  */
     484#line 89 "gun-parser.y"
     485    { gc.m_gun.m_pre_aim = (yysemantic_stack_[(2) - (2)].args).f0; }
     486    break;
     487
     488  case 8:
     489
     490/* Line 690 of lalr1.cc  */
     491#line 90 "gun-parser.y"
     492    { gc.m_gun.m_angle = (yysemantic_stack_[(2) - (2)].args).f0; }
     493    break;
     494
     495  case 9:
     496
     497/* Line 690 of lalr1.cc  */
     498#line 91 "gun-parser.y"
     499    { gc.m_gun.m_round_duration = (yysemantic_stack_[(2) - (2)].args).f0; }
    470500    break;
    471501
     
    473503
    474504/* Line 690 of lalr1.cc  */
    475 #line 88 "mesh-parser.y"
    476     { mc.m_mesh.MeshConvert(); }
     505#line 92 "gun-parser.y"
     506    { gc.m_gun.m_angle_offset = (yysemantic_stack_[(2) - (2)].args).f0; }
    477507    break;
    478508
     
    480510
    481511/* Line 690 of lalr1.cc  */
    482 #line 89 "mesh-parser.y"
    483     { /* TODO */ }
     512#line 93 "gun-parser.y"
     513    { gc.m_gun.m_radius = (yysemantic_stack_[(2) - (2)].args).f0; }
    484514    break;
    485515
     
    487517
    488518/* Line 690 of lalr1.cc  */
    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)); }
     519#line 94 "gun-parser.y"
     520    { gc.m_gun.m_shoot_speed = (yysemantic_stack_[(2) - (2)].args).f0; }
    491521    break;
    492522
     
    494524
    495525/* Line 690 of lalr1.cc  */
    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)); }
     526#line 95 "gun-parser.y"
     527    { /* FIXME: 1st modifier */ }
    498528    break;
    499529
     
    501531
    502532/* Line 690 of lalr1.cc  */
    503 #line 98 "mesh-parser.y"
    504     { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
     533#line 96 "gun-parser.y"
     534    { /* FIXME: 2nd modifier */ }
    505535    break;
    506536
     
    508538
    509539/* Line 690 of lalr1.cc  */
    510 #line 99 "mesh-parser.y"
    511     { mc.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
     540#line 97 "gun-parser.y"
     541    { for (int i = 0; i < (int)(yysemantic_stack_[(2) - (2)].args).f0; i++) gc.m_gun.Shoot(1);
     542                      gc.m_gun.m_shoot_type = 1;
     543                      gc.m_gun.m_round_timer = gc.m_gun.m_round_duration; }
    512544    break;
    513545
     
    515547
    516548/* Line 690 of lalr1.cc  */
    517 #line 100 "mesh-parser.y"
    518     { mc.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
     549#line 100 "gun-parser.y"
     550    { for (int i = 0; i < (int)(yysemantic_stack_[(2) - (2)].args).f0; i++) gc.m_gun.Shoot(0);
     551                      gc.m_gun.m_shoot_type = 0;
     552                      gc.m_gun.m_round_timer = gc.m_gun.m_round_duration; }
    519553    break;
    520554
     
    522556
    523557/* Line 690 of lalr1.cc  */
    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)); }
     558#line 103 "gun-parser.y"
     559    { gc.m_gun.Shoot(1); gc.m_gun.m_nbshoots = (int)(yysemantic_stack_[(2) - (2)].args).f0 - 1;
     560                      gc.m_gun.m_shoot_type = 1;
     561                      gc.m_gun.m_round_timer = gc.m_gun.m_round_duration; }
    526562    break;
    527563
     
    529565
    530566/* Line 690 of lalr1.cc  */
    531 #line 102 "mesh-parser.y"
    532     { mc.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); }
     567#line 106 "gun-parser.y"
     568    { gc.m_gun.Shoot(0); gc.m_gun.m_nbshoots = (int)(yysemantic_stack_[(2) - (2)].args).f0 - 1;
     569                      gc.m_gun.m_shoot_type = 0;
     570                      gc.m_gun.m_round_timer = gc.m_gun.m_round_duration; }
    533571    break;
    534572
     
    536574
    537575/* Line 690 of lalr1.cc  */
    538 #line 103 "mesh-parser.y"
    539     { mc.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); }
     576#line 109 "gun-parser.y"
     577    { gc.m_gun.m_round_timer = gc.m_gun.m_round_duration * (yysemantic_stack_[(2) - (2)].args).f0;
     578                      /* FIXME: modifiers */ }
    540579    break;
    541580
     
    543582
    544583/* Line 690 of lalr1.cc  */
    545 #line 104 "mesh-parser.y"
    546     { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); }
     584#line 111 "gun-parser.y"
     585    { /* FIXME: loops */ }
    547586    break;
    548587
     
    550589
    551590/* Line 690 of lalr1.cc  */
    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); }
     591#line 114 "gun-parser.y"
     592    { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); }
    554593    break;
    555594
     
    557596
    558597/* Line 690 of lalr1.cc  */
    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); }
     598#line 115 "gun-parser.y"
     599    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); }
    561600    break;
    562601
     
    564603
    565604/* Line 690 of lalr1.cc  */
    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); }
     605#line 116 "gun-parser.y"
     606    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); }
    568607    break;
    569608
     
    571610
    572611/* Line 690 of lalr1.cc  */
    573 #line 108 "mesh-parser.y"
    574     { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
     612#line 119 "gun-parser.y"
     613    { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); }
    575614    break;
    576615
     
    578617
    579618/* Line 690 of lalr1.cc  */
    580 #line 109 "mesh-parser.y"
    581     { mc.m_mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
    582     break;
    583 
    584   case 26:
    585 
    586 /* Line 690 of lalr1.cc  */
    587 #line 110 "mesh-parser.y"
    588     { mc.m_mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
    589     break;
    590 
    591   case 27:
    592 
    593 /* Line 690 of lalr1.cc  */
    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)); }
    596     break;
    597 
    598   case 28:
    599 
    600 /* Line 690 of lalr1.cc  */
    601 #line 112 "mesh-parser.y"
    602     { mc.m_mesh.MirrorX(); }
    603     break;
    604 
    605   case 29:
    606 
    607 /* Line 690 of lalr1.cc  */
    608 #line 113 "mesh-parser.y"
    609     { mc.m_mesh.MirrorY(); }
    610     break;
    611 
    612   case 30:
    613 
    614 /* Line 690 of lalr1.cc  */
    615 #line 114 "mesh-parser.y"
    616     { mc.m_mesh.MirrorZ(); }
    617     break;
    618 
    619   case 31:
    620 
    621 /* Line 690 of lalr1.cc  */
    622 #line 118 "mesh-parser.y"
    623     { mc.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    624                                                  (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3,
    625                                                  (int)(yysemantic_stack_[(2) - (2)].args).f4, (int)(yysemantic_stack_[(2) - (2)].args).f5); }
    626     break;
    627 
    628   case 32:
    629 
    630 /* Line 690 of lalr1.cc  */
    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)); }
    633     break;
    634 
    635   case 33:
    636 
    637 /* Line 690 of lalr1.cc  */
    638 #line 122 "mesh-parser.y"
    639     { mc.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    640                                                             (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); }
    641     break;
    642 
    643   case 34:
    644 
    645 /* Line 690 of lalr1.cc  */
    646 #line 124 "mesh-parser.y"
    647     { mc.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    648                                                           (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); }
    649     break;
    650 
    651   case 35:
    652 
    653 /* Line 690 of lalr1.cc  */
    654 #line 126 "mesh-parser.y"
    655     { mc.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0,
    656                                                vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }
    657     break;
    658 
    659   case 36:
    660 
    661 /* Line 690 of lalr1.cc  */
    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,
    664                                              (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); }
    665     break;
    666 
    667   case 37:
    668 
    669 /* Line 690 of lalr1.cc  */
    670 #line 130 "mesh-parser.y"
    671     { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    672                                                      (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); }
    673     break;
    674 
    675   case 38:
    676 
    677 /* Line 690 of lalr1.cc  */
    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); }
    680     break;
    681 
    682   case 39:
    683 
    684 /* Line 690 of lalr1.cc  */
    685 #line 133 "mesh-parser.y"
    686     { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
    687     break;
    688 
    689   case 40:
    690 
    691 /* Line 690 of lalr1.cc  */
    692 #line 134 "mesh-parser.y"
    693     { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
    694     break;
    695 
    696   case 41:
    697 
    698 /* Line 690 of lalr1.cc  */
    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,
    701                                             (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); }
    702     break;
    703 
    704   case 42:
    705 
    706 /* Line 690 of lalr1.cc  */
    707 #line 139 "mesh-parser.y"
    708     { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); }
    709     break;
    710 
    711   case 43:
    712 
    713 /* Line 690 of lalr1.cc  */
    714 #line 140 "mesh-parser.y"
    715     { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); }
    716     break;
    717 
    718   case 44:
    719 
    720 /* Line 690 of lalr1.cc  */
    721 #line 141 "mesh-parser.y"
    722     { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); }
    723     break;
    724 
    725   case 45:
    726 
    727 /* Line 690 of lalr1.cc  */
    728 #line 142 "mesh-parser.y"
    729     { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(3) - (3)].fval); }
    730     break;
    731 
    732   case 46:
    733 
    734 /* Line 690 of lalr1.cc  */
    735 #line 143 "mesh-parser.y"
    736     { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(3) - (3)].fval); }
    737     break;
    738 
    739   case 47:
    740 
    741 /* Line 690 of lalr1.cc  */
    742 #line 144 "mesh-parser.y"
    743     { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(3) - (3)].fval); }
    744     break;
    745 
    746   case 48:
    747 
    748 /* Line 690 of lalr1.cc  */
    749 #line 145 "mesh-parser.y"
    750     { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(3) - (3)].fval); }
    751     break;
    752 
    753   case 49:
    754 
    755 /* Line 690 of lalr1.cc  */
    756 #line 146 "mesh-parser.y"
    757     { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(3) - (3)].fval); }
    758     break;
    759 
    760   case 50:
    761 
    762 /* Line 690 of lalr1.cc  */
    763 #line 149 "mesh-parser.y"
    764     { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); }
    765     break;
    766 
    767   case 51:
    768 
    769 /* Line 690 of lalr1.cc  */
    770 #line 150 "mesh-parser.y"
     619#line 120 "gun-parser.y"
    771620    { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); }
    772621    break;
     
    775624
    776625/* Line 690 of lalr1.cc  */
    777 #line 778 "generated/mesh-parser.cpp"
     626#line 627 "generated/gun-parser.cpp"
    778627        default:
    779628          break;
     
    953802  // Generate an error message.
    954803  std::string
    955   MeshParser::yysyntax_error_ (int yystate, int yytoken)
     804  GunParser::yysyntax_error_ (int yystate, int yytoken)
    956805  {
    957806    std::string yyres;
     
    1049898  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
    1050899     STATE-NUM.  */
    1051   const signed char MeshParser::yypact_ninf_ = -43;
     900  const signed char GunParser::yypact_ninf_ = -23;
    1052901  const signed char
    1053   MeshParser::yypact_[] =
    1054   {
    1055         -1,   -43,   -43,   -43,    12,    12,    12,    12,    12,    12,
    1056      -43,    12,    12,    12,    12,   -43,    12,    12,    12,    12,
    1057      -43,    12,    12,    12,    12,    12,    12,    12,    12,    12,
    1058       12,    12,    12,    12,    37,     1,   -43,   -43,   -43,   -43,
    1059      -43,   -43,    12,     2,    10,    16,   -43,   -43,   -43,   -43,
    1060      -43,   -43,   -43,   -43,   -43,   -43,   -43,   -43,   -43,   -43,
    1061      -43,   -43,   -43,    18,    24,   -43,   -43,   -43,   -43,   -43,
    1062      -43,   -43,   -43,   -43,   -43,    27,    29,   -43,   -43,   -43,
    1063       -1,   -43,    12,    12,    12,    12,    12,    12,    12,   -43,
    1064      -43,   -43,   -43,   -43,   -43,   -43,   -43
     902  GunParser::yypact_[] =
     903  {
     904        -1,   -23,    19,    19,    19,    19,    19,    19,    19,    19,
     905      19,    19,    19,    19,    19,    19,   -23,    18,     1,   -23,
     906     -23,    19,   -23,   -23,   -23,   -23,   -23,   -23,   -23,   -23,
     907       0,    11,   -23,   -23,   -23,   -23,   -23,   -23,   -23,   -23,
     908     -23,    -1,   -23,    19,    19,   -23,   -23,   -23
    1065909  };
    1066910
     
    1069913     default is an error.  */
    1070914  const unsigned char
    1071   MeshParser::yydefact_[] =
    1072   {
    1073          0,     9,    10,    11,     0,     0,     0,     0,     0,     0,
    1074       28,     0,     0,     0,     0,    29,     0,     0,     0,     0,
    1075       30,     0,     0,     0,     0,     0,     0,     0,     0,     0,
    1076        0,     0,     0,     0,     0,     0,     3,     5,     6,     7,
    1077        8,    50,     0,     0,     0,     0,    12,    42,    13,    14,
    1078       18,    21,    24,    15,    19,    22,    25,    16,    20,    23,
    1079       26,    17,    27,     0,     0,    31,    32,    33,    34,    35,
    1080       36,    37,    38,    39,    40,     0,     0,    41,     1,     2,
    1081        0,    51,     0,     0,     0,     0,     0,     0,     0,     4,
    1082       43,    44,    45,    46,    47,    48,    49
     915  GunParser::yydefact_[] =
     916  {
     917         0,     5,     0,     0,     0,     0,     0,     0,     0,     0,
     918       0,     0,     0,     0,     0,     0,    20,     0,     0,     3,
     919      24,     0,     6,    21,     7,     8,     9,    10,    11,    12,
     920       0,     0,    13,    14,    15,    16,    17,    18,    19,     1,
     921       2,     0,    25,     0,     0,     4,    22,    23
    1083922  };
    1084923
    1085924  /* YYPGOTO[NTERM-NUM].  */
    1086925  const signed char
    1087   MeshParser::yypgoto_[] =
    1088   {
    1089        -43,   -43,   -43,   -11,   -43,   -43,   -43,   -43,    61,    20,
    1090       41,    31,    46,    43,   -43,   -43,   -42
     926  GunParser::yypgoto_[] =
     927  {
     928       -23,   -23,   -23,   -22,    22,   -23,    29,   -21
    1091929  };
    1092930
    1093931  /* YYDEFGOTO[NTERM-NUM].  */
    1094932  const signed char
    1095   MeshParser::yydefgoto_[] =
    1096   {
    1097         -1,    34,    35,    36,    37,    38,    39,    40,    43,    44,
    1098       45,    63,    64,    65,    76,    77,    47
     933  GunParser::yydefgoto_[] =
     934  {
     935        -1,    17,    18,    19,    30,    31,    32,    23
    1099936  };
    1100937
     
    1102939     positive, shift that token.  If negative, reduce the rule which
    1103940     number is the opposite.  If YYTABLE_NINF_, syntax error.  */
    1104   const signed char MeshParser::yytable_ninf_ = -1;
     941  const signed char GunParser::yytable_ninf_ = -1;
    1105942  const unsigned char
    1106   MeshParser::yytable_[] =
    1107   {
    1108         81,    79,     1,     2,     3,     4,     5,     6,     7,     8,
    1109        9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
    1110       19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
    1111       29,    30,    31,    32,    33,    46,    48,    78,    80,    82,
    1112       90,    91,    92,    93,    94,    95,    96,    83,    41,    51,
    1113       42,    73,    74,    84,    55,    85,    67,    68,    69,    59,
    1114       71,    86,    61,    62,    87,    66,    88,    49,    50,    89,
    1115       52,    72,    53,    54,    70,    56,    75,    57,    58,     0,
    1116       60
     943  GunParser::yytable_[] =
     944  {
     945        42,    40,     1,     2,     3,     4,     5,     6,     7,     8,
     946       9,    10,    11,    12,    13,    14,    15,    16,    39,    45,
     947      43,    41,    46,    47,    22,    24,    25,    26,    27,    28,
     948      29,    44,     0,    34,    35,    36,    37,    38,    20,    33,
     949      21
    1117950  };
    1118951
    1119952  /* YYCHECK.  */
    1120953  const signed char
    1121   MeshParser::yycheck_[] =
    1122   {
    1123         42,     0,     3,     4,     5,     6,     7,     8,     9,    10,
    1124       11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
    1125       21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
    1126       31,    32,    33,    34,    35,     4,     5,     0,    37,    37,
    1127       82,    83,    84,    85,    86,    87,    88,    37,    36,     8,
    1128       38,    31,    32,    37,    13,    37,    25,    26,    27,    18,
    1129       29,    37,    21,    22,    37,    24,    37,     6,     7,    80,
    1130        9,    30,    11,    12,    28,    14,    33,    16,    17,    -1,
    1131       19
     954  GunParser::yycheck_[] =
     955  {
     956        21,     0,     3,     4,     5,     6,     7,     8,     9,    10,
     957      11,    12,    13,    14,    15,    16,    17,    18,     0,    41,
     958      20,    20,    43,    44,     2,     3,     4,     5,     6,     7,
     959       8,    20,    -1,    11,    12,    13,    14,    15,    19,    10,
     960      21
    1132961  };
    1133962
     
    1135964     symbol of state STATE-NUM.  */
    1136965  const unsigned char
    1137   MeshParser::yystos_[] =
     966  GunParser::yystos_[] =
    1138967  {
    1139968         0,     3,     4,     5,     6,     7,     8,     9,    10,    11,
    1140       12,    13,    14,    15,    16,    17,    18,    19,    20,    21,
    1141       22,    23,    24,    25,    26,    27,    28,    29,    30,    31,
    1142       32,    33,    34,    35,    40,    41,    42,    43,    44,    45,
    1143       46,    36,    38,    47,    48,    49,    50,    55,    50,    47,
    1144       47,    49,    47,    47,    47,    49,    47,    47,    47,    49,
    1145       47,    49,    49,    50,    51,    52,    49,    50,    50,    50,
    1146       51,    50,    49,    48,    48,    52,    53,    54,     0,     0,
    1147       37,    55,    37,    37,    37,    37,    37,    37,    37,    42,
    1148       55,    55,    55,    55,    55,    55,    55
     969      12,    13,    14,    15,    16,    17,    18,    23,    24,    25,
     970      19,    21,    26,    29,    26,    26,    26,    26,    26,    26,
     971      26,    27,    28,    28,    26,    26,    26,    26,    26,     0,
     972       0,    20,    29,    20,    20,    25,    29,    29
    1149973  };
    1150974
     
    1153977     to YYLEX-NUM.  */
    1154978  const unsigned short int
    1155   MeshParser::yytoken_number_[] =
     979  GunParser::yytoken_number_[] =
    1156980  {
    1157981         0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
    1158982     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
    1159      275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
    1160      285,   286,   287,   288,   289,   290,   291,    44,    45
     983      44,    45
    1161984  };
    1162985#endif
     
    1164987  /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
    1165988  const unsigned char
    1166   MeshParser::yyr1_[] =
    1167   {
    1168          0,    39,    40,    41,    41,    42,    42,    42,    42,    43,
    1169       43,    43,    44,    44,    45,    45,    45,    45,    45,    45,
    1170       45,    45,    45,    45,    45,    45,    45,    45,    45,    45,
    1171       45,    46,    46,    46,    46,    46,    46,    46,    46,    46,
    1172       46,    46,    47,    48,    49,    50,    51,    52,    53,    54,
    1173       55,    55
     989  GunParser::yyr1_[] =
     990  {
     991         0,    22,    23,    24,    24,    25,    25,    25,    25,    25,
     992      25,    25,    25,    25,    25,    25,    25,    25,    25,    25,
     993      25,    26,    27,    28,    29,    29
    1174994  };
    1175995
    1176996  /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
    1177997  const unsigned char
    1178   MeshParser::yyr2_[] =
    1179   {
    1180          0,     2,     2,     1,     3,     1,     1,     1,     1,     1,
    1181        1,     1,     2,     2,     2,     2,     2,     2,     2,     2,
    1182        2,     2,     2,     2,     2,     2,     2,     2,     1,     1,
    1183        1,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    1184        2,     2,     1,     3,     3,     3,     3,     3,     3,     3,
    1185        1,     2
     998  GunParser::yyr2_[] =
     999  {
     1000         0,     2,     2,     1,     3,     1,     2,     2,     2,     2,
     1001       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     1002       1,     1,     3,     3,     1,     2
    11861003  };
    11871004
     
    11901007     First, the terminals, then, starting at \a yyntokens_, nonterminals.  */
    11911008  const char*
    1192   const MeshParser::yytname_[] =
    1193   {
    1194     "T_END", "error", "$undefined", "T_FLUSH", "T_INITRB", "T_FREERB",
    1195   "T_COLOR", "T_BGCOLOR", "T_TRANSLATEX", "T_ROTATEX", "T_TAPERX",
    1196   "T_SCALEX", "T_MIRRORX", "T_TRANSLATEY", "T_ROTATEY", "T_TAPERY",
    1197   "T_SCALEY", "T_MIRRORY", "T_TRANSLATEZ", "T_ROTATEZ", "T_TAPERZ",
    1198   "T_SCALEZ", "T_MIRRORZ", "T_TRANSLATE", "T_SCALE", "T_CYLINDER", "T_BOX",
    1199   "T_SMOOTHCHAMFBOX", "T_FLATCHAMFBOX", "T_SPHERE", "T_STAR",
    1200   "T_EXPANDEDSTAR", "T_DISC", "T_TRIANGLE", "T_QUAD", "T_COG", "NUMBER",
    1201   "','", "'-'", "$accept", "mesh_description", "mesh_command_list",
    1202   "mesh_command", "rb_command", "color_command", "transform_command",
    1203   "primitive_command", "args1", "args2", "args3", "args4", "args5",
    1204   "args6", "args7", "args8", "number", 0
     1009  const GunParser::yytname_[] =
     1010  {
     1011    "T_END", "error", "$undefined", "T_AI", "T_PAI", "T_CA", "T_SA",
     1012  "T_TIM", "T_SO", "T_RD", "T_SPD", "T_MODA", "T_MODB", "T_FFB", "T_FFP",
     1013  "T_FB", "T_FP", "T_SK", "T_LOOP", "NUMBER", "','", "'-'", "$accept",
     1014  "gun_description", "gun_command_list", "gun_command", "args1", "args2",
     1015  "args3", "number", 0
    12051016  };
    12061017#endif
     
    12081019#if YYDEBUG
    12091020  /* YYRHS -- A `-1'-separated list of the rules' RHS.  */
    1210   const MeshParser::rhs_number_type
    1211   MeshParser::yyrhs_[] =
    1212   {
    1213         40,     0,    -1,    41,     0,    -1,    42,    -1,    41,    37,
    1214       42,    -1,    43,    -1,    44,    -1,    45,    -1,    46,    -1,
    1215        3,    -1,     4,    -1,     5,    -1,     6,    50,    -1,     7,
    1216       50,    -1,     8,    47,    -1,    13,    47,    -1,    18,    47,
    1217       -1,    23,    49,    -1,     9,    47,    -1,    14,    47,    -1,
    1218       19,    47,    -1,    10,    49,    -1,    15,    49,    -1,    20,
    1219       49,    -1,    11,    47,    -1,    16,    47,    -1,    21,    47,
    1220       -1,    24,    49,    -1,    12,    -1,    17,    -1,    22,    -1,
    1221       25,    52,    -1,    26,    49,    -1,    27,    50,    -1,    28,
    1222       50,    -1,    29,    50,    -1,    30,    51,    -1,    31,    50,
    1223       -1,    32,    49,    -1,    33,    48,    -1,    34,    48,    -1,
    1224       35,    54,    -1,    55,    -1,    47,    37,    55,    -1,    48,
    1225       37,    55,    -1,    49,    37,    55,    -1,    50,    37,    55,
    1226       -1,    51,    37,    55,    -1,    52,    37,    55,    -1,    53,
    1227       37,    55,    -1,    36,    -1,    38,    55,    -1
     1021  const GunParser::rhs_number_type
     1022  GunParser::yyrhs_[] =
     1023  {
     1024        23,     0,    -1,    24,     0,    -1,    25,    -1,    24,    20,
     1025      25,    -1,     3,    -1,     4,    26,    -1,     5,    26,    -1,
     1026       6,    26,    -1,     7,    26,    -1,     8,    26,    -1,     9,
     1027      26,    -1,    10,    26,    -1,    11,    28,    -1,    12,    28,
     1028      -1,    13,    26,    -1,    14,    26,    -1,    15,    26,    -1,
     1029      16,    26,    -1,    17,    26,    -1,    18,    -1,    29,    -1,
     1030      26,    20,    29,    -1,    27,    20,    29,    -1,    19,    -1,
     1031      21,    29,    -1
    12281032  };
    12291033
     
    12311035     YYRHS.  */
    12321036  const unsigned char
    1233   MeshParser::yyprhs_[] =
    1234   {
    1235          0,     0,     3,     6,     8,    12,    14,    16,    18,    20,
    1236       22,    24,    26,    29,    32,    35,    38,    41,    44,    47,
    1237       50,    53,    56,    59,    62,    65,    68,    71,    74,    76,
    1238       78,    80,    83,    86,    89,    92,    95,    98,   101,   104,
    1239      107,   110,   113,   115,   119,   123,   127,   131,   135,   139,
    1240      143,   145
     1037  GunParser::yyprhs_[] =
     1038  {
     1039         0,     0,     3,     6,     8,    12,    14,    17,    20,    23,
     1040      26,    29,    32,    35,    38,    41,    44,    47,    50,    53,
     1041      56,    58,    60,    64,    68,    70
    12411042  };
    12421043
    12431044  /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
    12441045  const unsigned char
    1245   MeshParser::yyrline_[] =
    1246   {
    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
     1046  GunParser::yyrline_[] =
     1047  {
     1048         0,    78,    78,    82,    83,    87,    88,    89,    90,    91,
     1049      92,    93,    94,    95,    96,    97,   100,   103,   106,   109,
     1050     111,   114,   115,   116,   119,   120
    12531051  };
    12541052
    12551053  // Print the state stack on the debug stream.
    12561054  void
    1257   MeshParser::yystack_print_ ()
     1055  GunParser::yystack_print_ ()
    12581056  {
    12591057    *yycdebug_ << "Stack now";
     
    12661064  // Report on the debug stream that the rule \a yyrule is going to be reduced.
    12671065  void
    1268   MeshParser::yy_reduce_print_ (int yyrule)
     1066  GunParser::yy_reduce_print_ (int yyrule)
    12691067  {
    12701068    unsigned int yylno = yyrline_[yyrule];
     
    12831081
    12841082  /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
    1285   MeshParser::token_number_type
    1286   MeshParser::yytranslate_ (int t)
     1083  GunParser::token_number_type
     1084  GunParser::yytranslate_ (int t)
    12871085  {
    12881086    static
     
    12941092       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    12951093       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    1296        2,     2,     2,     2,    37,    38,     2,     2,     2,     2,
     1094       2,     2,     2,     2,    20,    21,     2,     2,     2,     2,
    12971095       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
    12981096       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
     
    13171115       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
    13181116       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
    1319       15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
    1320       25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
    1321       35,    36
     1117      15,    16,    17,    18,    19
    13221118    };
    13231119    if ((unsigned int) t <= yyuser_token_number_max_)
     
    13271123  }
    13281124
    1329   const int MeshParser::yyeof_ = 0;
    1330   const int MeshParser::yylast_ = 80;
    1331   const int MeshParser::yynnts_ = 17;
    1332   const int MeshParser::yyempty_ = -2;
    1333   const int MeshParser::yyfinal_ = 78;
    1334   const int MeshParser::yyterror_ = 1;
    1335   const int MeshParser::yyerrcode_ = 256;
    1336   const int MeshParser::yyntokens_ = 39;
    1337 
    1338   const unsigned int MeshParser::yyuser_token_number_max_ = 291;
    1339   const MeshParser::token_number_type MeshParser::yyundef_token_ = 2;
     1125  const int GunParser::yyeof_ = 0;
     1126  const int GunParser::yylast_ = 40;
     1127  const int GunParser::yynnts_ = 8;
     1128  const int GunParser::yyempty_ = -2;
     1129  const int GunParser::yyfinal_ = 39;
     1130  const int GunParser::yyterror_ = 1;
     1131  const int GunParser::yyerrcode_ = 256;
     1132  const int GunParser::yyntokens_ = 22;
     1133
     1134  const unsigned int GunParser::yyuser_token_number_max_ = 274;
     1135  const GunParser::token_number_type GunParser::yyundef_token_ = 2;
    13401136
    13411137
     
    13431139
    13441140/* Line 1136 of lalr1.cc  */
    1345 #line 1346 "generated/mesh-parser.cpp"
     1141#line 1142 "generated/gun-parser.cpp"
    13461142
    13471143
    13481144/* Line 1138 of lalr1.cc  */
    1349 #line 153 "mesh-parser.y"
    1350 
    1351 
    1352 void orbital::MeshParser::error(const MeshParser::location_type& l,
    1353                                 const std::string& m)
     1145#line 123 "gun-parser.y"
     1146
     1147
     1148void orbital::GunParser::error(const GunParser::location_type& l,
     1149                               const std::string& m)
    13541150{
    1355     mc.Error(l, m);
     1151    gc.Error(l, m);
    13561152}
    13571153
  • trunk/orbital/generated/gun-parser.h

    r1423 r1424  
    6565
    6666/* Line 35 of lalr1.cc  */
    67 #line 68 "generated/mesh-parser.h"
     67#line 68 "generated/gun-parser.h"
    6868
    6969  /// A Bison parser.
    70   class MeshParser
     70  class GunParser
    7171  {
    7272  public:
     
    7777
    7878/* Line 35 of lalr1.cc  */
    79 #line 35 "mesh-parser.y"
     79#line 37 "gun-parser.y"
    8080
    8181    float fval;
     
    8585
    8686/* Line 35 of lalr1.cc  */
    87 #line 88 "generated/mesh-parser.h"
     87#line 88 "generated/gun-parser.h"
    8888    };
    8989#else
     
    9898   enum yytokentype {
    9999     T_END = 0,
    100      T_FLUSH = 258,
    101      T_INITRB = 259,
    102      T_FREERB = 260,
    103      T_COLOR = 261,
    104      T_BGCOLOR = 262,
    105      T_TRANSLATEX = 263,
    106      T_ROTATEX = 264,
    107      T_TAPERX = 265,
    108      T_SCALEX = 266,
    109      T_MIRRORX = 267,
    110      T_TRANSLATEY = 268,
    111      T_ROTATEY = 269,
    112      T_TAPERY = 270,
    113      T_SCALEY = 271,
    114      T_MIRRORY = 272,
    115      T_TRANSLATEZ = 273,
    116      T_ROTATEZ = 274,
    117      T_TAPERZ = 275,
    118      T_SCALEZ = 276,
    119      T_MIRRORZ = 277,
    120      T_TRANSLATE = 278,
    121      T_SCALE = 279,
    122      T_CYLINDER = 280,
    123      T_BOX = 281,
    124      T_SMOOTHCHAMFBOX = 282,
    125      T_FLATCHAMFBOX = 283,
    126      T_SPHERE = 284,
    127      T_STAR = 285,
    128      T_EXPANDEDSTAR = 286,
    129      T_DISC = 287,
    130      T_TRIANGLE = 288,
    131      T_QUAD = 289,
    132      T_COG = 290,
    133      NUMBER = 291
     100     T_AI = 258,
     101     T_PAI = 259,
     102     T_CA = 260,
     103     T_SA = 261,
     104     T_TIM = 262,
     105     T_SO = 263,
     106     T_RD = 264,
     107     T_SPD = 265,
     108     T_MODA = 266,
     109     T_MODB = 267,
     110     T_FFB = 268,
     111     T_FFP = 269,
     112     T_FB = 270,
     113     T_FP = 271,
     114     T_SK = 272,
     115     T_LOOP = 273,
     116     NUMBER = 274
    134117   };
    135118
     
    139122
    140123    /// Build a parser object.
    141     MeshParser (class MeshCompiler& mc_yyarg);
    142     virtual ~MeshParser ();
     124    GunParser (class GunCompiler& gc_yyarg);
     125    virtual ~GunParser ();
    143126
    144127    /// Parse.
     
    305288
    306289    /* User arguments.  */
    307     class MeshCompiler& mc;
     290    class GunCompiler& gc;
    308291  };
    309292
     
    311294
    312295/* Line 35 of lalr1.cc  */
    313 #line 314 "generated/mesh-parser.h"
     296#line 297 "generated/gun-parser.h"
    314297
    315298
  • trunk/orbital/generated/gun-scanner.cpp

    r1423 r1424  
    1 #line 2 "generated/mesh-scanner.cpp"
    2 
    3 #line 4 "generated/mesh-scanner.cpp"
     1#line 2 "generated/gun-scanner.cpp"
     2
     3#line 4 "generated/gun-scanner.cpp"
    44
    55#define  YY_INT_ALIGNED short int
     
    2121     * altogether.
    2222     */
    23     #define yyFlexLexer MeshFlexLexer
     23    #define yyFlexLexer GunFlexLexer
    2424
    2525/* First, we deal with  platform-specific or compiler-specific issues. */
     
    285285#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
    286286
    287 void *Meshalloc (yy_size_t  );
    288 void *Meshrealloc (void *,yy_size_t  );
    289 void Meshfree (void *  );
     287void *Gunalloc (yy_size_t  );
     288void *Gunrealloc (void *,yy_size_t  );
     289void Gunfree (void *  );
    290290
    291291#define yy_new_buffer yy_create_buffer
     
    331331        (yy_c_buf_p) = yy_cp;
    332332
    333 #define YY_NUM_RULES 38
    334 #define YY_END_OF_BUFFER 39
     333#define YY_NUM_RULES 21
     334#define YY_END_OF_BUFFER 22
    335335/* This struct is not used in this scanner,
    336336   but its presence is necessary. */
     
    340340        flex_int32_t yy_nxt;
    341341        };
    342 static yyconst flex_int16_t yy_accept[64] =
     342static yyconst flex_int16_t yy_accept[51] =
    343343    {   0,
    344         0,    0,   39,   38,   37,   38,   36,   35,   37,   34,
    345        38,   38,   38,   38,   38,   19,    9,    0,   34,   34,
    346         0,   24,   23,   30,    0,    0,   32,   28,   31,    1,
    347         0,    0,   20,   21,   22,   10,   11,   12,    4,   16,
    348        17,   18,    0,    6,    7,    8,    0,   34,   33,   29,
    349         0,    0,    0,    3,    2,    5,   13,   14,   15,   26,
    350        25,   27,    0
     344        0,    0,   22,   21,   20,   21,   19,   18,   20,   17,
     345       21,   21,   21,   21,   21,   21,   21,   21,   21,    0,
     346       17,   17,    0,    1,    3,   13,    0,   14,    0,    0,
     347        0,    7,    4,   15,    6,    0,    0,    0,   17,   11,
     348       12,    0,    0,    2,    8,    5,   16,    9,   10,    0
    351349    } ;
    352350
     
    364362        1,    1,    1,    1,    1,    1,    9,   10,   11,   12,
    365363
    366        13,   14,   15,   16,   17,    1,    1,   18,   19,    1,
    367         1,   20,   21,   22,   23,   24,    1,    1,    1,   25,
    368        26,   27,    1,    1,    1,    1,    1,    1,    1,    1,
     364        8,   13,    1,    1,   14,    1,   15,   16,   17,    1,
     365       18,   19,    1,   20,   21,   22,    1,    1,    1,    1,
     366        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    369367        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    370368        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
     
    383381    } ;
    384382
    385 static yyconst flex_int32_t yy_meta[28] =
     383static yyconst flex_int32_t yy_meta[23] =
    386384    {   0,
    387385        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    388386        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    389         1,    1,    1,    1,    1,    1,    1
     387        1,    1
    390388    } ;
    391389
    392 static yyconst flex_int16_t yy_base[64] =
     390static yyconst flex_int16_t yy_base[51] =
    393391    {   0,
    394         0,    0,   89,   90,   90,   22,   90,   24,   81,   26,
    395        30,   27,   65,   10,   21,   39,   43,   79,   49,   64,
    396        56,   90,   70,   90,   61,   72,   90,   47,   90,   90,
    397        72,   71,   90,   90,   90,   90,   90,   90,   70,   90,
    398        90,   90,   48,   90,   90,   90,   72,   71,   90,   90,
    399        66,   50,   22,   90,   90,   90,   90,   90,   90,   90,
    400        90,   90,   90
     392        0,    0,   66,   67,   67,   17,   67,   19,   58,   21,
     393       50,   54,   20,   44,   43,   51,   47,   31,   44,   50,
     394       28,   24,   38,   67,   67,   67,   28,   67,   38,   43,
     395       40,   67,   67,   67,   67,   41,   31,   37,   35,   67,
     396       67,   18,   42,   67,   67,   67,   67,   67,   67,   67
    401397    } ;
    402398
    403 static yyconst flex_int16_t yy_def[64] =
     399static yyconst flex_int16_t yy_def[51] =
    404400    {   0,
    405        63,    1,   63,   63,   63,   63,   63,   63,   63,   63,
    406        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    407        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    408        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    409        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    410        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    411        63,   63,    0
     401       50,    1,   50,   50,   50,   50,   50,   50,   50,   50,
     402       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
     403       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
     404       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
     405       50,   50,   50,   50,   50,   50,   50,   50,   50,    0
    412406    } ;
    413407
    414 static yyconst flex_int16_t yy_nxt[118] =
     408static yyconst flex_int16_t yy_nxt[90] =
    415409    {   0,
    416410        4,    5,    6,    7,    8,    9,   10,    4,   11,    4,
    417         4,    4,    4,   12,    4,    4,   13,    4,   14,    4,
    418         4,   15,   16,   17,    4,    4,    4,   18,   19,   18,
    419        19,   18,   19,   21,   33,   34,   35,   62,   21,   22,
    420        23,   24,   25,   26,   30,   36,   37,   38,   31,   39,
    421        27,   43,   28,   29,   18,   19,   21,   52,   47,   61,
    422        47,   21,   48,   40,   41,   42,   53,   44,   45,   46,
    423        20,   21,   57,   58,   59,   60,   21,   48,   48,   56,
    424        55,   54,   51,   50,   49,   20,   32,   20,   63,    3,
    425        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    426 
    427        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    428        63,   63,   63,   63,   63,   63,   63
     411       12,    4,   13,    4,    4,   14,   15,    4,   16,   17,
     412       18,   19,   20,   21,   20,   21,   20,   21,   23,   26,
     413       22,   23,   27,   20,   21,   23,   47,   40,   28,   33,
     414       38,   39,   38,   39,   39,   34,   41,   46,   35,   36,
     415       48,   49,   45,   44,   43,   42,   22,   37,   32,   31,
     416       30,   29,   25,   24,   22,   50,    3,   50,   50,   50,
     417       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
     418       50,   50,   50,   50,   50,   50,   50,   50,   50
    429419    } ;
    430420
    431 static yyconst flex_int16_t yy_chk[118] =
     421static yyconst flex_int16_t yy_chk[90] =
    432422    {   0,
    433423        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    434424        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
    435         1,    1,    1,    1,    1,    1,    1,    6,    6,    8,
    436         8,   10,   10,   10,   14,   14,   14,   53,   10,   11,
    437        11,   11,   11,   11,   12,   15,   15,   15,   12,   16,
    438        11,   17,   11,   11,   19,   19,   19,   28,   21,   52,
    439        21,   19,   21,   16,   16,   16,   28,   17,   17,   17,
    440        20,   20,   43,   43,   43,   51,   20,   48,   47,   39,
    441        32,   31,   26,   25,   23,   18,   13,    9,    3,   63,
    442        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    443 
    444        63,   63,   63,   63,   63,   63,   63,   63,   63,   63,
    445        63,   63,   63,   63,   63,   63,   63
     425        1,    1,    6,    6,    8,    8,   10,   10,   10,   13,
     426       22,   22,   13,   21,   21,   21,   42,   27,   13,   18,
     427       23,   39,   23,   38,   23,   18,   27,   37,   18,   18,
     428       43,   43,   36,   31,   30,   29,   20,   19,   17,   16,
     429       15,   14,   12,   11,    9,    3,   50,   50,   50,   50,
     430       50,   50,   50,   50,   50,   50,   50,   50,   50,   50,
     431       50,   50,   50,   50,   50,   50,   50,   50,   50
    446432    } ;
    447433
     
    453439#define YY_MORE_ADJ 0
    454440#define YY_RESTORE_YY_MORE_OFFSET
    455 #line 1 "mesh-scanner.l"
    456 #line 2 "mesh-scanner.l"
     441#line 1 "gun-scanner.l"
     442#line 2 "gun-scanner.l"
    457443//
    458444// Orbital
    459445//
    460 // Copyright: (c) 2012 Various People
     446// Copyright: (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
     447//            (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
     448//            (c) 2012 Sam Hocevar <sam@hocevar.net>
    461449//
    462450
    463 #include "../mesh-compiler.h"
    464 
    465 typedef orbital::MeshParser::token token;
    466 typedef orbital::MeshParser::token_type token_type;
     451#include "../gun-compiler.h"
     452
     453typedef orbital::GunParser::token token;
     454typedef orbital::GunParser::token_type token_type;
     455
     456#ifndef YY_DECL
     457#   define YY_DECL orbital::GunParser::token_type \
     458        orbital::GunScanner::lex(orbital::GunParser::semantic_type* yylval, \
     459                                 orbital::GunParser::location_type* yylloc)
     460#endif
    467461
    468462#define yyterminate() return token::T_END
    469463#define YY_NO_UNISTD_H
    470464#define YY_USER_ACTION yylloc->columns(yyleng);
    471 #line 472 "generated/mesh-scanner.cpp"
     465#line 466 "generated/gun-scanner.cpp"
    472466
    473467#define INITIAL 0
     
    574568        register int yy_act;
    575569   
    576 #line 21 "mesh-scanner.l"
     570#line 29 "gun-scanner.l"
    577571
    578572
     
    582576
    583577
    584 #line 585 "generated/mesh-scanner.cpp"
     578#line 579 "generated/gun-scanner.cpp"
    585579
    586580        if ( !(yy_init) )
     
    635629                                {
    636630                                yy_current_state = (int) yy_def[yy_current_state];
    637                                 if ( yy_current_state >= 64 )
     631                                if ( yy_current_state >= 51 )
    638632                                        yy_c = yy_meta[(unsigned int) yy_c];
    639633                                }
     
    641635                        ++yy_cp;
    642636                        }
    643                 while ( yy_current_state != 63 );
     637                while ( yy_current_state != 50 );
    644638                yy_cp = (yy_last_accepting_cpos);
    645639                yy_current_state = (yy_last_accepting_state);
     
    663657case 1:
    664658YY_RULE_SETUP
    665 #line 28 "mesh-scanner.l"
    666 { return token::T_FLUSH; }
     659#line 36 "gun-scanner.l"
     660{ return token::T_AI; }
    667661        YY_BREAK
    668662case 2:
    669663YY_RULE_SETUP
    670 #line 29 "mesh-scanner.l"
    671 { return token::T_INITRB; }
     664#line 37 "gun-scanner.l"
     665{ return token::T_PAI; }
    672666        YY_BREAK
    673667case 3:
    674668YY_RULE_SETUP
    675 #line 30 "mesh-scanner.l"
    676 { return token::T_FREERB; }
     669#line 38 "gun-scanner.l"
     670{ return token::T_CA; }
    677671        YY_BREAK
    678672case 4:
    679673YY_RULE_SETUP
    680 #line 32 "mesh-scanner.l"
    681 { return token::T_COLOR; }
     674#line 39 "gun-scanner.l"
     675{ return token::T_SA; }
    682676        YY_BREAK
    683677case 5:
    684678YY_RULE_SETUP
    685 #line 33 "mesh-scanner.l"
    686 { return token::T_BGCOLOR; }
     679#line 40 "gun-scanner.l"
     680{ return token::T_TIM; }
    687681        YY_BREAK
    688682case 6:
    689683YY_RULE_SETUP
    690 #line 35 "mesh-scanner.l"
    691 { return token::T_TRANSLATEX; }
     684#line 41 "gun-scanner.l"
     685{ return token::T_SO; }
    692686        YY_BREAK
    693687case 7:
    694688YY_RULE_SETUP
    695 #line 36 "mesh-scanner.l"
    696 { return token::T_TRANSLATEY; }
     689#line 42 "gun-scanner.l"
     690{ return token::T_RD; }
    697691        YY_BREAK
    698692case 8:
    699693YY_RULE_SETUP
    700 #line 37 "mesh-scanner.l"
    701 { return token::T_TRANSLATEZ; }
     694#line 43 "gun-scanner.l"
     695{ return token::T_SPD; }
    702696        YY_BREAK
    703697case 9:
    704698YY_RULE_SETUP
    705 #line 38 "mesh-scanner.l"
    706 { return token::T_TRANSLATE; }
     699#line 44 "gun-scanner.l"
     700{ return token::T_MODA; }
    707701        YY_BREAK
    708702case 10:
    709703YY_RULE_SETUP
    710 #line 39 "mesh-scanner.l"
    711 { return token::T_ROTATEX; }
     704#line 45 "gun-scanner.l"
     705{ return token::T_MODB; }
    712706        YY_BREAK
    713707case 11:
    714708YY_RULE_SETUP
    715 #line 40 "mesh-scanner.l"
    716 { return token::T_ROTATEY; }
     709#line 46 "gun-scanner.l"
     710{ return token::T_FFB; }
    717711        YY_BREAK
    718712case 12:
    719713YY_RULE_SETUP
    720 #line 41 "mesh-scanner.l"
    721 { return token::T_ROTATEZ; }
     714#line 47 "gun-scanner.l"
     715{ return token::T_FFP; }
    722716        YY_BREAK
    723717case 13:
    724718YY_RULE_SETUP
    725 #line 42 "mesh-scanner.l"
    726 { return token::T_TAPERX; }
     719#line 48 "gun-scanner.l"
     720{ return token::T_FB; }
    727721        YY_BREAK
    728722case 14:
    729723YY_RULE_SETUP
    730 #line 43 "mesh-scanner.l"
    731 { return token::T_TAPERY; }
     724#line 49 "gun-scanner.l"
     725{ return token::T_FP; }
    732726        YY_BREAK
    733727case 15:
    734728YY_RULE_SETUP
    735 #line 44 "mesh-scanner.l"
    736 { return token::T_TAPERZ; }
     729#line 50 "gun-scanner.l"
     730{ return token::T_SK; }
    737731        YY_BREAK
    738732case 16:
    739733YY_RULE_SETUP
    740 #line 45 "mesh-scanner.l"
    741 { return token::T_SCALEX; }
     734#line 51 "gun-scanner.l"
     735{ return token::T_LOOP; }
    742736        YY_BREAK
    743737case 17:
    744738YY_RULE_SETUP
    745 #line 46 "mesh-scanner.l"
    746 { return token::T_SCALEY; }
     739#line 53 "gun-scanner.l"
     740{
     741        yylval->fval = atof(yytext); return token::NUMBER; }
    747742        YY_BREAK
    748743case 18:
    749744YY_RULE_SETUP
    750 #line 47 "mesh-scanner.l"
    751 { return token::T_SCALEZ; }
     745#line 55 "gun-scanner.l"
     746{ return token_type('-'); }
    752747        YY_BREAK
    753748case 19:
    754749YY_RULE_SETUP
    755 #line 48 "mesh-scanner.l"
    756 { return token::T_SCALE; }
     750#line 56 "gun-scanner.l"
     751{ return token_type(','); }
    757752        YY_BREAK
    758753case 20:
    759 YY_RULE_SETUP
    760 #line 49 "mesh-scanner.l"
    761 { return token::T_MIRRORX; }
     754/* rule 20 can match eol */
     755YY_RULE_SETUP
     756#line 57 "gun-scanner.l"
     757{ /* ignore everything else */ }
    762758        YY_BREAK
    763759case 21:
    764760YY_RULE_SETUP
    765 #line 50 "mesh-scanner.l"
    766 { return token::T_MIRRORY; }
    767         YY_BREAK
    768 case 22:
    769 YY_RULE_SETUP
    770 #line 51 "mesh-scanner.l"
    771 { return token::T_MIRRORZ; }
    772         YY_BREAK
    773 case 23:
    774 YY_RULE_SETUP
    775 #line 53 "mesh-scanner.l"
    776 { return token::T_CYLINDER; }
    777         YY_BREAK
    778 case 24:
    779 YY_RULE_SETUP
    780 #line 54 "mesh-scanner.l"
    781 { return token::T_BOX; }
    782         YY_BREAK
    783 case 25:
    784 YY_RULE_SETUP
    785 #line 55 "mesh-scanner.l"
    786 { return token::T_SMOOTHCHAMFBOX; }
    787         YY_BREAK
    788 case 26:
    789 YY_RULE_SETUP
    790 #line 56 "mesh-scanner.l"
    791 { return token::T_FLATCHAMFBOX; }
    792         YY_BREAK
    793 case 27:
    794 YY_RULE_SETUP
    795 #line 57 "mesh-scanner.l"
    796 { return token::T_SPHERE; }
    797         YY_BREAK
    798 case 28:
    799 YY_RULE_SETUP
    800 #line 58 "mesh-scanner.l"
    801 { return token::T_STAR; }
    802         YY_BREAK
    803 case 29:
    804 YY_RULE_SETUP
    805 #line 59 "mesh-scanner.l"
    806 { return token::T_EXPANDEDSTAR; }
    807         YY_BREAK
    808 case 30:
    809 YY_RULE_SETUP
    810 #line 60 "mesh-scanner.l"
    811 { return token::T_DISC; }
    812         YY_BREAK
    813 case 31:
    814 YY_RULE_SETUP
    815 #line 61 "mesh-scanner.l"
    816 { return token::T_TRIANGLE; }
    817         YY_BREAK
    818 case 32:
    819 YY_RULE_SETUP
    820 #line 62 "mesh-scanner.l"
    821 { return token::T_QUAD; }
    822         YY_BREAK
    823 case 33:
    824 YY_RULE_SETUP
    825 #line 63 "mesh-scanner.l"
    826 { return token::T_COG; }
    827         YY_BREAK
    828 case 34:
    829 YY_RULE_SETUP
    830 #line 65 "mesh-scanner.l"
    831 {
    832         yylval->fval = atof(yytext); return token::NUMBER; }
    833         YY_BREAK
    834 case 35:
    835 YY_RULE_SETUP
    836 #line 67 "mesh-scanner.l"
    837 { return token_type('-'); }
    838         YY_BREAK
    839 case 36:
    840 YY_RULE_SETUP
    841 #line 68 "mesh-scanner.l"
    842 { return token_type(','); }
    843         YY_BREAK
    844 case 37:
    845 /* rule 37 can match eol */
    846 YY_RULE_SETUP
    847 #line 69 "mesh-scanner.l"
    848 { /* ignore everything else */ }
    849         YY_BREAK
    850 case 38:
    851 YY_RULE_SETUP
    852 #line 71 "mesh-scanner.l"
     761#line 59 "gun-scanner.l"
    853762ECHO;
    854763        YY_BREAK
    855 #line 856 "generated/mesh-scanner.cpp"
     764#line 765 "generated/gun-scanner.cpp"
    856765case YY_STATE_EOF(INITIAL):
    857766        yyterminate();
     
    1022931{
    1023932        delete [] yy_state_buf;
    1024         Meshfree(yy_start_stack  );
     933        Gunfree(yy_start_stack  );
    1025934        yy_delete_buffer( YY_CURRENT_BUFFER );
    1026         Meshfree(yy_buffer_stack  );
     935        Gunfree(yy_buffer_stack  );
    1027936}
    1028937
     
    11521061                                b->yy_ch_buf = (char *)
    11531062                                        /* Include room in for 2 EOB chars. */
    1154                                         Meshrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
     1063                                        Gunrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
    11551064                                }
    11561065                        else
     
    12011110                /* Extend the array by 50%, plus the number we really need. */
    12021111                yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
    1203                 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Meshrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
     1112                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) Gunrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size  );
    12041113                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
    12051114                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
     
    12351144                        {
    12361145                        yy_current_state = (int) yy_def[yy_current_state];
    1237                         if ( yy_current_state >= 64 )
     1146                        if ( yy_current_state >= 51 )
    12381147                                yy_c = yy_meta[(unsigned int) yy_c];
    12391148                        }
     
    12631172                {
    12641173                yy_current_state = (int) yy_def[yy_current_state];
    1265                 if ( yy_current_state >= 64 )
     1174                if ( yy_current_state >= 51 )
    12661175                        yy_c = yy_meta[(unsigned int) yy_c];
    12671176                }
    12681177        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
    1269         yy_is_jam = (yy_current_state == 63);
     1178        yy_is_jam = (yy_current_state == 50);
    12701179
    12711180        return yy_is_jam ? 0 : yy_current_state;
     
    14471356        YY_BUFFER_STATE b;
    14481357   
    1449         b = (YY_BUFFER_STATE) Meshalloc(sizeof( struct yy_buffer_state )  );
     1358        b = (YY_BUFFER_STATE) Gunalloc(sizeof( struct yy_buffer_state )  );
    14501359        if ( ! b )
    14511360                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
     
    14561365         * we need to put in 2 end-of-buffer characters.
    14571366         */
    1458         b->yy_ch_buf = (char *) Meshalloc(b->yy_buf_size + 2  );
     1367        b->yy_ch_buf = (char *) Gunalloc(b->yy_buf_size + 2  );
    14591368        if ( ! b->yy_ch_buf )
    14601369                YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
     
    14811390
    14821391        if ( b->yy_is_our_buffer )
    1483                 Meshfree((void *) b->yy_ch_buf  );
    1484 
    1485         Meshfree((void *) b  );
     1392                Gunfree((void *) b->yy_ch_buf  );
     1393
     1394        Gunfree((void *) b  );
    14861395}
    14871396
     
    16081517         */
    16091518                num_to_alloc = 1;
    1610                 (yy_buffer_stack) = (struct yy_buffer_state**)Meshalloc
     1519                (yy_buffer_stack) = (struct yy_buffer_state**)Gunalloc
    16111520                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
    16121521                                                                );
     
    16271536
    16281537                num_to_alloc = (yy_buffer_stack_max) + grow_size;
    1629                 (yy_buffer_stack) = (struct yy_buffer_state**)Meshrealloc
     1538                (yy_buffer_stack) = (struct yy_buffer_state**)Gunrealloc
    16301539                                                                ((yy_buffer_stack),
    16311540                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
     
    16501559
    16511560                if ( ! (yy_start_stack) )
    1652                         (yy_start_stack) = (int *) Meshalloc(new_size  );
     1561                        (yy_start_stack) = (int *) Gunalloc(new_size  );
    16531562
    16541563                else
    1655                         (yy_start_stack) = (int *) Meshrealloc((void *) (yy_start_stack),new_size  );
     1564                        (yy_start_stack) = (int *) Gunrealloc((void *) (yy_start_stack),new_size  );
    16561565
    16571566                if ( ! (yy_start_stack) )
     
    17301639#endif
    17311640
    1732 void *Meshalloc (yy_size_t  size )
     1641void *Gunalloc (yy_size_t  size )
    17331642{
    17341643        return (void *) malloc( size );
    17351644}
    17361645
    1737 void *Meshrealloc  (void * ptr, yy_size_t  size )
     1646void *Gunrealloc  (void * ptr, yy_size_t  size )
    17381647{
    17391648        /* The cast to (char *) in the following accommodates both
     
    17471656}
    17481657
    1749 void Meshfree (void * ptr )
    1750 {
    1751         free( (char *) ptr );   /* see Meshrealloc() for (char *) cast */
     1658void Gunfree (void * ptr )
     1659{
     1660        free( (char *) ptr );   /* see Gunrealloc() for (char *) cast */
    17521661}
    17531662
    17541663#define YYTABLES_NAME "yytables"
    17551664
    1756 #line 71 "mesh-scanner.l"
    1757 
    1758 
    1759 
    1760 orbital::MeshScanner::MeshScanner(char const *command)
    1761     : MeshFlexLexer(0, 0),
     1665#line 59 "gun-scanner.l"
     1666
     1667
     1668
     1669orbital::GunScanner::GunScanner(char const *command)
     1670    : GunFlexLexer(0, 0),
    17621671      m_input(command)
    17631672{
    17641673}
    17651674
    1766 orbital::MeshScanner::~MeshScanner()
    1767 {
    1768 }
    1769 
    1770 int orbital::MeshScanner::LexerInput(char* buf, int max_size)
     1675orbital::GunScanner::~GunScanner()
     1676{
     1677}
     1678
     1679int orbital::GunScanner::LexerInput(char* buf, int max_size)
    17711680{
    17721681    buf[0] = m_input[0];
     
    17791688#undef yylex
    17801689#endif
    1781 int MeshFlexLexer::yylex()
    1782 {
    1783     std::cerr << "in MeshFlexLexer::yylex() !" << std::endl;
     1690int GunFlexLexer::yylex()
     1691{
     1692    std::cerr << "in GunFlexLexer::yylex() !" << std::endl;
    17841693    return 0;
    17851694}
    17861695
    1787 int MeshFlexLexer::yywrap()
     1696int GunFlexLexer::yywrap()
    17881697{
    17891698    return 1;
  • trunk/orbital/generated/mesh-parser.cpp

    r1422 r1424  
    4242// Orbital
    4343//
    44 // Copyright: (c) 2012 Various People
     44// Copyright: (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
     45//            (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
     46//            (c) 2012 Sam Hocevar <sam@hocevar.net>
    4547//
    4648
     
    6264
    6365/* Line 293 of lalr1.cc  */
    64 #line 65 "generated/mesh-parser.cpp"
     66#line 67 "generated/mesh-parser.cpp"
    6567
    6668
     
    7072
    7173/* Line 299 of lalr1.cc  */
    72 #line 61 "mesh-parser.y"
     74#line 63 "mesh-parser.y"
    7375
    7476#include "../mesh-compiler.h"
     
    7981
    8082/* Line 299 of lalr1.cc  */
    81 #line 82 "generated/mesh-parser.cpp"
     83#line 84 "generated/mesh-parser.cpp"
    8284
    8385#ifndef YY_
     
    165167
    166168/* Line 382 of lalr1.cc  */
    167 #line 168 "generated/mesh-parser.cpp"
     169#line 170 "generated/mesh-parser.cpp"
    168170
    169171  /* Return YYSTR after stripping away unnecessary quotes and
     
    466468
    467469/* Line 690 of lalr1.cc  */
    468 #line 87 "mesh-parser.y"
     470#line 89 "mesh-parser.y"
    469471    { mc.m_mesh.Flush(); }
    470472    break;
     
    473475
    474476/* Line 690 of lalr1.cc  */
    475 #line 88 "mesh-parser.y"
     477#line 90 "mesh-parser.y"
    476478    { mc.m_mesh.MeshConvert(); }
    477479    break;
     
    480482
    481483/* Line 690 of lalr1.cc  */
    482 #line 89 "mesh-parser.y"
     484#line 91 "mesh-parser.y"
    483485    { /* TODO */ }
    484486    break;
     
    487489
    488490/* Line 690 of lalr1.cc  */
    489 #line 93 "mesh-parser.y"
     491#line 95 "mesh-parser.y"
    490492    { 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)); }
    491493    break;
     
    494496
    495497/* Line 690 of lalr1.cc  */
    496 #line 94 "mesh-parser.y"
     498#line 96 "mesh-parser.y"
    497499    { 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)); }
    498500    break;
     
    501503
    502504/* Line 690 of lalr1.cc  */
    503 #line 98 "mesh-parser.y"
     505#line 100 "mesh-parser.y"
    504506    { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
    505507    break;
     
    508510
    509511/* Line 690 of lalr1.cc  */
    510 #line 99 "mesh-parser.y"
     512#line 101 "mesh-parser.y"
    511513    { mc.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
    512514    break;
     
    515517
    516518/* Line 690 of lalr1.cc  */
    517 #line 100 "mesh-parser.y"
     519#line 102 "mesh-parser.y"
    518520    { mc.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
    519521    break;
     
    522524
    523525/* Line 690 of lalr1.cc  */
    524 #line 101 "mesh-parser.y"
     526#line 103 "mesh-parser.y"
    525527    { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    526528    break;
     
    529531
    530532/* Line 690 of lalr1.cc  */
    531 #line 102 "mesh-parser.y"
     533#line 104 "mesh-parser.y"
    532534    { mc.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); }
    533535    break;
     
    536538
    537539/* Line 690 of lalr1.cc  */
    538 #line 103 "mesh-parser.y"
     540#line 105 "mesh-parser.y"
    539541    { mc.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); }
    540542    break;
     
    543545
    544546/* Line 690 of lalr1.cc  */
    545 #line 104 "mesh-parser.y"
     547#line 106 "mesh-parser.y"
    546548    { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); }
    547549    break;
     
    550552
    551553/* Line 690 of lalr1.cc  */
    552 #line 105 "mesh-parser.y"
     554#line 107 "mesh-parser.y"
    553555    { mc.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    554556    break;
     
    557559
    558560/* Line 690 of lalr1.cc  */
    559 #line 106 "mesh-parser.y"
     561#line 108 "mesh-parser.y"
    560562    { mc.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    561563    break;
     
    564566
    565567/* Line 690 of lalr1.cc  */
    566 #line 107 "mesh-parser.y"
     568#line 109 "mesh-parser.y"
    567569    { mc.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }
    568570    break;
     
    571573
    572574/* Line 690 of lalr1.cc  */
    573 #line 108 "mesh-parser.y"
     575#line 110 "mesh-parser.y"
    574576    { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }
    575577    break;
     
    578580
    579581/* Line 690 of lalr1.cc  */
    580 #line 109 "mesh-parser.y"
     582#line 111 "mesh-parser.y"
    581583    { mc.m_mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }
    582584    break;
     
    585587
    586588/* Line 690 of lalr1.cc  */
    587 #line 110 "mesh-parser.y"
     589#line 112 "mesh-parser.y"
    588590    { mc.m_mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }
    589591    break;
     
    592594
    593595/* Line 690 of lalr1.cc  */
    594 #line 111 "mesh-parser.y"
     596#line 113 "mesh-parser.y"
    595597    { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    596598    break;
     
    599601
    600602/* Line 690 of lalr1.cc  */
    601 #line 112 "mesh-parser.y"
     603#line 114 "mesh-parser.y"
    602604    { mc.m_mesh.MirrorX(); }
    603605    break;
     
    606608
    607609/* Line 690 of lalr1.cc  */
    608 #line 113 "mesh-parser.y"
     610#line 115 "mesh-parser.y"
    609611    { mc.m_mesh.MirrorY(); }
    610612    break;
     
    613615
    614616/* Line 690 of lalr1.cc  */
    615 #line 114 "mesh-parser.y"
     617#line 116 "mesh-parser.y"
    616618    { mc.m_mesh.MirrorZ(); }
    617619    break;
     
    620622
    621623/* Line 690 of lalr1.cc  */
    622 #line 118 "mesh-parser.y"
     624#line 120 "mesh-parser.y"
    623625    { mc.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    624626                                                 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3,
     
    629631
    630632/* Line 690 of lalr1.cc  */
    631 #line 121 "mesh-parser.y"
     633#line 123 "mesh-parser.y"
    632634    { mc.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }
    633635    break;
     
    636638
    637639/* Line 690 of lalr1.cc  */
    638 #line 122 "mesh-parser.y"
     640#line 124 "mesh-parser.y"
    639641    { mc.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    640642                                                            (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); }
     
    644646
    645647/* Line 690 of lalr1.cc  */
    646 #line 124 "mesh-parser.y"
     648#line 126 "mesh-parser.y"
    647649    { mc.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    648650                                                          (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); }
     
    652654
    653655/* Line 690 of lalr1.cc  */
    654 #line 126 "mesh-parser.y"
     656#line 128 "mesh-parser.y"
    655657    { mc.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0,
    656658                                               vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }
     
    660662
    661663/* Line 690 of lalr1.cc  */
    662 #line 128 "mesh-parser.y"
     664#line 130 "mesh-parser.y"
    663665    { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2,
    664666                                             (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); }
     
    668670
    669671/* Line 690 of lalr1.cc  */
    670 #line 130 "mesh-parser.y"
     672#line 132 "mesh-parser.y"
    671673    { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,
    672674                                                     (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); }
     
    676678
    677679/* Line 690 of lalr1.cc  */
    678 #line 132 "mesh-parser.y"
     680#line 134 "mesh-parser.y"
    679681    { mc.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); }
    680682    break;
     
    683685
    684686/* Line 690 of lalr1.cc  */
    685 #line 133 "mesh-parser.y"
     687#line 135 "mesh-parser.y"
    686688    { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
    687689    break;
     
    690692
    691693/* Line 690 of lalr1.cc  */
    692 #line 134 "mesh-parser.y"
     694#line 136 "mesh-parser.y"
    693695    { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }
    694696    break;
     
    697699
    698700/* Line 690 of lalr1.cc  */
    699 #line 135 "mesh-parser.y"
     701#line 137 "mesh-parser.y"
    700702    { 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,
    701703                                            (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); }
     
    705707
    706708/* Line 690 of lalr1.cc  */
    707 #line 139 "mesh-parser.y"
     709#line 141 "mesh-parser.y"
    708710    { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); }
    709711    break;
     
    712714
    713715/* Line 690 of lalr1.cc  */
    714 #line 140 "mesh-parser.y"
     716#line 142 "mesh-parser.y"
    715717    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); }
    716718    break;
     
    719721
    720722/* Line 690 of lalr1.cc  */
    721 #line 141 "mesh-parser.y"
     723#line 143 "mesh-parser.y"
    722724    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); }
    723725    break;
     
    726728
    727729/* Line 690 of lalr1.cc  */
    728 #line 142 "mesh-parser.y"
     730#line 144 "mesh-parser.y"
    729731    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(3) - (3)].fval); }
    730732    break;
     
    733735
    734736/* Line 690 of lalr1.cc  */
    735 #line 143 "mesh-parser.y"
     737#line 145 "mesh-parser.y"
    736738    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(3) - (3)].fval); }
    737739    break;
     
    740742
    741743/* Line 690 of lalr1.cc  */
    742 #line 144 "mesh-parser.y"
     744#line 146 "mesh-parser.y"
    743745    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(3) - (3)].fval); }
    744746    break;
     
    747749
    748750/* Line 690 of lalr1.cc  */
    749 #line 145 "mesh-parser.y"
     751#line 147 "mesh-parser.y"
    750752    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(3) - (3)].fval); }
    751753    break;
     
    754756
    755757/* Line 690 of lalr1.cc  */
    756 #line 146 "mesh-parser.y"
     758#line 148 "mesh-parser.y"
    757759    { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(3) - (3)].fval); }
    758760    break;
     
    761763
    762764/* Line 690 of lalr1.cc  */
    763 #line 149 "mesh-parser.y"
     765#line 151 "mesh-parser.y"
    764766    { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); }
    765767    break;
     
    768770
    769771/* Line 690 of lalr1.cc  */
    770 #line 150 "mesh-parser.y"
     772#line 152 "mesh-parser.y"
    771773    { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); }
    772774    break;
     
    775777
    776778/* Line 690 of lalr1.cc  */
    777 #line 778 "generated/mesh-parser.cpp"
     779#line 780 "generated/mesh-parser.cpp"
    778780        default:
    779781          break;
     
    12451247  MeshParser::yyrline_[] =
    12461248  {
    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
     1249         0,    73,    73,    77,    78,    82,    83,    84,    85,    89,
     1250      90,    91,    95,    96,   100,   101,   102,   103,   104,   105,
     1251     106,   107,   108,   109,   110,   111,   112,   113,   114,   115,
     1252     116,   120,   123,   124,   126,   128,   130,   132,   134,   135,
     1253     136,   137,   141,   142,   143,   144,   145,   146,   147,   148,
     1254     151,   152
    12531255  };
    12541256
     
    13431345
    13441346/* Line 1136 of lalr1.cc  */
    1345 #line 1346 "generated/mesh-parser.cpp"
     1347#line 1348 "generated/mesh-parser.cpp"
    13461348
    13471349
    13481350/* Line 1138 of lalr1.cc  */
    1349 #line 153 "mesh-parser.y"
     1351#line 155 "mesh-parser.y"
    13501352
    13511353
  • trunk/orbital/generated/mesh-parser.h

    r1422 r1424  
    7777
    7878/* Line 35 of lalr1.cc  */
    79 #line 35 "mesh-parser.y"
     79#line 37 "mesh-parser.y"
    8080
    8181    float fval;
  • trunk/orbital/generated/mesh-scanner.cpp

    r1422 r1424  
    458458// Orbital
    459459//
    460 // Copyright: (c) 2012 Various People
     460// Copyright: (c) 2009-2012 Cédric Lecacheur <jordx@free.fr>
     461//            (c) 2009-2012 Benjamin Huet <huet.benjamin@gmail.com>
     462//            (c) 2012 Sam Hocevar <sam@hocevar.net>
    461463//
    462464
     
    465467typedef orbital::MeshParser::token token;
    466468typedef orbital::MeshParser::token_type token_type;
     469
     470#ifndef YY_DECL
     471#   define YY_DECL orbital::MeshParser::token_type \
     472        orbital::MeshScanner::lex(orbital::MeshParser::semantic_type* yylval, \
     473                                  orbital::MeshParser::location_type* yylloc)
     474#endif
    467475
    468476#define yyterminate() return token::T_END
    469477#define YY_NO_UNISTD_H
    470478#define YY_USER_ACTION yylloc->columns(yyleng);
    471 #line 472 "generated/mesh-scanner.cpp"
     479#line 480 "generated/mesh-scanner.cpp"
    472480
    473481#define INITIAL 0
     
    574582        register int yy_act;
    575583   
    576 #line 21 "mesh-scanner.l"
     584#line 29 "mesh-scanner.l"
    577585
    578586
     
    582590
    583591
    584 #line 585 "generated/mesh-scanner.cpp"
     592#line 593 "generated/mesh-scanner.cpp"
    585593
    586594        if ( !(yy_init) )
     
    663671case 1:
    664672YY_RULE_SETUP
    665 #line 28 "mesh-scanner.l"
     673#line 36 "mesh-scanner.l"
    666674{ return token::T_FLUSH; }
    667675        YY_BREAK
    668676case 2:
    669677YY_RULE_SETUP
    670 #line 29 "mesh-scanner.l"
     678#line 37 "mesh-scanner.l"
    671679{ return token::T_INITRB; }
    672680        YY_BREAK
    673681case 3:
    674682YY_RULE_SETUP
    675 #line 30 "mesh-scanner.l"
     683#line 38 "mesh-scanner.l"
    676684{ return token::T_FREERB; }
    677685        YY_BREAK
    678686case 4:
    679687YY_RULE_SETUP
    680 #line 32 "mesh-scanner.l"
     688#line 40 "mesh-scanner.l"
    681689{ return token::T_COLOR; }
    682690        YY_BREAK
    683691case 5:
    684692YY_RULE_SETUP
    685 #line 33 "mesh-scanner.l"
     693#line 41 "mesh-scanner.l"
    686694{ return token::T_BGCOLOR; }
    687695        YY_BREAK
    688696case 6:
    689697YY_RULE_SETUP
    690 #line 35 "mesh-scanner.l"
     698#line 43 "mesh-scanner.l"
    691699{ return token::T_TRANSLATEX; }
    692700        YY_BREAK
    693701case 7:
    694702YY_RULE_SETUP
    695 #line 36 "mesh-scanner.l"
     703#line 44 "mesh-scanner.l"
    696704{ return token::T_TRANSLATEY; }
    697705        YY_BREAK
    698706case 8:
    699707YY_RULE_SETUP
    700 #line 37 "mesh-scanner.l"
     708#line 45 "mesh-scanner.l"
    701709{ return token::T_TRANSLATEZ; }
    702710        YY_BREAK
    703711case 9:
    704712YY_RULE_SETUP
    705 #line 38 "mesh-scanner.l"
     713#line 46 "mesh-scanner.l"
    706714{ return token::T_TRANSLATE; }
    707715        YY_BREAK
    708716case 10:
    709717YY_RULE_SETUP
    710 #line 39 "mesh-scanner.l"
     718#line 47 "mesh-scanner.l"
    711719{ return token::T_ROTATEX; }
    712720        YY_BREAK
    713721case 11:
    714722YY_RULE_SETUP
    715 #line 40 "mesh-scanner.l"
     723#line 48 "mesh-scanner.l"
    716724{ return token::T_ROTATEY; }
    717725        YY_BREAK
    718726case 12:
    719727YY_RULE_SETUP
    720 #line 41 "mesh-scanner.l"
     728#line 49 "mesh-scanner.l"
    721729{ return token::T_ROTATEZ; }
    722730        YY_BREAK
    723731case 13:
    724732YY_RULE_SETUP
    725 #line 42 "mesh-scanner.l"
     733#line 50 "mesh-scanner.l"
    726734{ return token::T_TAPERX; }
    727735        YY_BREAK
    728736case 14:
    729737YY_RULE_SETUP
    730 #line 43 "mesh-scanner.l"
     738#line 51 "mesh-scanner.l"
    731739{ return token::T_TAPERY; }
    732740        YY_BREAK
    733741case 15:
    734742YY_RULE_SETUP
    735 #line 44 "mesh-scanner.l"
     743#line 52 "mesh-scanner.l"
    736744{ return token::T_TAPERZ; }
    737745        YY_BREAK
    738746case 16:
    739747YY_RULE_SETUP
    740 #line 45 "mesh-scanner.l"
     748#line 53 "mesh-scanner.l"
    741749{ return token::T_SCALEX; }
    742750        YY_BREAK
    743751case 17:
    744752YY_RULE_SETUP
    745 #line 46 "mesh-scanner.l"
     753#line 54 "mesh-scanner.l"
    746754{ return token::T_SCALEY; }
    747755        YY_BREAK
    748756case 18:
    749757YY_RULE_SETUP
    750 #line 47 "mesh-scanner.l"
     758#line 55 "mesh-scanner.l"
    751759{ return token::T_SCALEZ; }
    752760        YY_BREAK
    753761case 19:
    754762YY_RULE_SETUP
    755 #line 48 "mesh-scanner.l"
     763#line 56 "mesh-scanner.l"
    756764{ return token::T_SCALE; }
    757765        YY_BREAK
    758766case 20:
    759767YY_RULE_SETUP
    760 #line 49 "mesh-scanner.l"
     768#line 57 "mesh-scanner.l"
    761769{ return token::T_MIRRORX; }
    762770        YY_BREAK
    763771case 21:
    764772YY_RULE_SETUP
    765 #line 50 "mesh-scanner.l"
     773#line 58 "mesh-scanner.l"
    766774{ return token::T_MIRRORY; }
    767775        YY_BREAK
    768776case 22:
    769777YY_RULE_SETUP
    770 #line 51 "mesh-scanner.l"
     778#line 59 "mesh-scanner.l"
    771779{ return token::T_MIRRORZ; }
    772780        YY_BREAK
    773781case 23:
    774782YY_RULE_SETUP
    775 #line 53 "mesh-scanner.l"
     783#line 61 "mesh-scanner.l"
    776784{ return token::T_CYLINDER; }
    777785        YY_BREAK
    778786case 24:
    779787YY_RULE_SETUP
    780 #line 54 "mesh-scanner.l"
     788#line 62 "mesh-scanner.l"
    781789{ return token::T_BOX; }
    782790        YY_BREAK
    783791case 25:
    784792YY_RULE_SETUP
    785 #line 55 "mesh-scanner.l"
     793#line 63 "mesh-scanner.l"
    786794{ return token::T_SMOOTHCHAMFBOX; }
    787795        YY_BREAK
    788796case 26:
    789797YY_RULE_SETUP
    790 #line 56 "mesh-scanner.l"
     798#line 64 "mesh-scanner.l"
    791799{ return token::T_FLATCHAMFBOX; }
    792800        YY_BREAK
    793801case 27:
    794802YY_RULE_SETUP
    795 #line 57 "mesh-scanner.l"
     803#line 65 "mesh-scanner.l"
    796804{ return token::T_SPHERE; }
    797805        YY_BREAK
    798806case 28:
    799807YY_RULE_SETUP
    800 #line 58 "mesh-scanner.l"
     808#line 66 "mesh-scanner.l"
    801809{ return token::T_STAR; }
    802810        YY_BREAK
    803811case 29:
    804812YY_RULE_SETUP
    805 #line 59 "mesh-scanner.l"
     813#line 67 "mesh-scanner.l"
    806814{ return token::T_EXPANDEDSTAR; }
    807815        YY_BREAK
    808816case 30:
    809817YY_RULE_SETUP
    810 #line 60 "mesh-scanner.l"
     818#line 68 "mesh-scanner.l"
    811819{ return token::T_DISC; }
    812820        YY_BREAK
    813821case 31:
    814822YY_RULE_SETUP
    815 #line 61 "mesh-scanner.l"
     823#line 69 "mesh-scanner.l"
    816824{ return token::T_TRIANGLE; }
    817825        YY_BREAK
    818826case 32:
    819827YY_RULE_SETUP
    820 #line 62 "mesh-scanner.l"
     828#line 70 "mesh-scanner.l"
    821829{ return token::T_QUAD; }
    822830        YY_BREAK
    823831case 33:
    824832YY_RULE_SETUP
    825 #line 63 "mesh-scanner.l"
     833#line 71 "mesh-scanner.l"
    826834{ return token::T_COG; }
    827835        YY_BREAK
    828836case 34:
    829837YY_RULE_SETUP
    830 #line 65 "mesh-scanner.l"
     838#line 73 "mesh-scanner.l"
    831839{
    832840        yylval->fval = atof(yytext); return token::NUMBER; }
     
    834842case 35:
    835843YY_RULE_SETUP
    836 #line 67 "mesh-scanner.l"
     844#line 75 "mesh-scanner.l"
    837845{ return token_type('-'); }
    838846        YY_BREAK
    839847case 36:
    840848YY_RULE_SETUP
    841 #line 68 "mesh-scanner.l"
     849#line 76 "mesh-scanner.l"
    842850{ return token_type(','); }
    843851        YY_BREAK
     
    845853/* rule 37 can match eol */
    846854YY_RULE_SETUP
    847 #line 69 "mesh-scanner.l"
     855#line 77 "mesh-scanner.l"
    848856{ /* ignore everything else */ }
    849857        YY_BREAK
    850858case 38:
    851859YY_RULE_SETUP
    852 #line 71 "mesh-scanner.l"
     860#line 79 "mesh-scanner.l"
    853861ECHO;
    854862        YY_BREAK
    855 #line 856 "generated/mesh-scanner.cpp"
     863#line 864 "generated/mesh-scanner.cpp"
    856864case YY_STATE_EOF(INITIAL):
    857865        yyterminate();
     
    17541762#define YYTABLES_NAME "yytables"
    17551763
    1756 #line 71 "mesh-scanner.l"
     1764#line 79 "mesh-scanner.l"
    17571765
    17581766
  • trunk/orbital/gun.h

    r1423 r1424  
    77//
    88
    9 /* TODO for this file:
    10  *  - rename "AppendQuadVert" to "AddVertex" or something; it has nothing
    11  *    to do with quads.
    12  */
    13 
    14 extern char const *lolfx_shiny;
    15 
    16 #include "CommandParser.h"
    17 
    189#if !defined __GUN_H__
    1910#define __GUN_H__
    2011
    21 class Gun : public CommandParser
     12class Gun
    2213{
    2314public:
     
    3930    {}
    4031
    41     virtual void SwitchCommand(char const *&command)
    42     {
    43         vec4 v4;
    44         vec3 v3;
    45         float f1, f2, f3, f4, f5, f6, f7, f8;
    46 
    47         const char *&p = command;
    48         {
    49 #define CASE(str) if (CheckCommand(str, p))
    50                  CASE("ai") { m_angle = AimActor(); }
    51             else CASE("pai") { p = GetArg(p, f1); PreAimActor(f1); }
    52             else CASE("ca") { p = GetArg(p, f1); m_pre_aim = f1; }
    53             else CASE("sa") { p = GetArg(p, f1); m_angle = f1; }
    54             else CASE("tim") { p = GetArg(p, f1); m_round_duration = f1; }
    55             else CASE("so") { p = GetArg(p, f1); m_angle_offset = f1; }
    56             else CASE("rd") { p = GetArg(p, f1); m_radius = f1; }
    57             else CASE("spd") { p = GetArg(p, f1); m_shoot_speed = f1; }
    58             else CASE("moda") { p = GetArg(p, v3); /* FIXME: 1st modifier */ }
    59             else CASE("modb") { p = GetArg(p, v3); /* FIXME: 2nd modifier */ }
    60             else CASE("ffb") { p = GetArg(p, f1); for (int i = 0; i < (int)f1; i++) Shoot(1); m_shoot_type = 1; m_round_timer = m_round_duration; }
    61             else CASE("ffp") { p = GetArg(p, f1); for (int i = 0; i < (int)f1; i++) Shoot(0); m_shoot_type = 0; m_round_timer = m_round_duration; }
    62             else CASE("fb") { p = GetArg(p, f1); Shoot(1); m_nbshoots = (int)f1 - 1; m_shoot_type = 1; m_round_timer = m_round_duration; }
    63             else CASE("fp") { p = GetArg(p, f1); Shoot(0); m_nbshoots = (int)f1 - 1; m_shoot_type = 0; m_round_timer = m_round_duration; }
    64             else CASE("sk") { p = GetArg(p, f1); m_round_timer = m_round_duration * f1; /* FIXME: modifiers */ }
    65             else CASE("loop") { /* FIXME: loops */ }
    66 #undef CASE
    67         }
    68     }
     32    void SendCommand(char const *command);
    6933
    7034    void Shoot(int count)
     
    8246    }
    8347
    84 private:
    8548    vec3 m_position;
    8649    float m_scrz;
  • trunk/orbital/mesh-compiler.h

    r1423 r1424  
    1111
    1212#include <string>
    13 
    14 #ifndef YY_DECL
    15 #   define YY_DECL orbital::MeshParser::token_type \
    16         orbital::MeshScanner::lex(orbital::MeshParser::semantic_type* yylval, \
    17                                   orbital::MeshParser::location_type* yylloc)
    18 #endif
    1913
    2014#ifndef __FLEX_LEXER_H
  • trunk/orbital/mesh-scanner.l

    r1423 r1424  
    1212typedef orbital::MeshParser::token token;
    1313typedef orbital::MeshParser::token_type token_type;
     14
     15#ifndef YY_DECL
     16#   define YY_DECL orbital::MeshParser::token_type \
     17        orbital::MeshScanner::lex(orbital::MeshParser::semantic_type* yylval, \
     18                                  orbital::MeshParser::location_type* yylloc)
     19#endif
    1420
    1521#define yyterminate() return token::T_END
  • trunk/orbital/mesh.h

    r1423 r1424  
    1212 */
    1313
    14 extern char const *lolfx_shiny;
    15 
    1614#if !defined __MESH_H__
    1715#define __MESH_H__
    1816
    19 #include "mesh-compiler.h"
     17extern char const *lolfx_shiny;
    2018
    2119class Mesh
     
    2725    {}
    2826
    29     void SendCommand(char const *command)
    30     {
    31         orbital::MeshCompiler mc(*this);
    32         mc.ParseString(command);
    33     }
     27    void SendCommand(char const *command);
    3428
    3529    void Flush()
  • trunk/win32/orbital.vcxproj

    r1423 r1424  
    2828  </ItemGroup>
    2929  <ItemGroup>
    30     <ClInclude Include="..\orbital\CommandParser.h" />
    3130    <ClInclude Include="..\orbital\generated\mesh-parser.h" />
     31    <ClInclude Include="..\orbital\generated\gun-parser.h" />
    3232    <ClInclude Include="..\orbital\gun.h" />
    3333    <ClInclude Include="..\orbital\mesh-compiler.h" />
     34    <ClInclude Include="..\orbital\gun-compiler.h" />
    3435    <ClInclude Include="..\orbital\mesh.h" />
    3536    <ClInclude Include="..\orbital\orbital.h" />
     
    4243  <ItemGroup>
    4344    <ClCompile Include="..\orbital\generated\mesh-parser.cpp" />
     45    <ClCompile Include="..\orbital\generated\gun-parser.cpp" />
    4446    <ClCompile Include="..\orbital\generated\mesh-scanner.cpp" />
     47    <ClCompile Include="..\orbital\generated\gun-scanner.cpp" />
    4548    <ClCompile Include="..\orbital\mesh-compiler.cpp" />
     49    <ClCompile Include="..\orbital\mesh.cpp" />
     50    <ClCompile Include="..\orbital\gun-compiler.cpp" />
     51    <ClCompile Include="..\orbital\gun.cpp" />
    4652    <ClCompile Include="..\orbital\orbital.cpp" />
    4753  </ItemGroup>
     
    5965    <None Include="..\orbital\generated\stack.hh" />
    6066    <None Include="..\orbital\mesh-scanner.l" />
     67    <None Include="..\orbital\gun-scanner.l" />
    6168    <None Include="..\orbital\mesh-parser.y" />
     69    <None Include="..\orbital\gun-parser.y" />
    6270  </ItemGroup>
    6371  <PropertyGroup Label="Globals">
  • trunk/win32/orbital.vcxproj.filters

    r1423 r1424  
    44    <ClInclude Include="..\orbital\gun.h" />
    55    <ClInclude Include="..\orbital\mesh.h" />
    6     <ClInclude Include="..\orbital\CommandParser.h" />
    76    <ClInclude Include="..\orbital\player.h" />
    87    <ClInclude Include="..\orbital\tank.h" />
     
    109    <ClInclude Include="..\orbital\snake.h" />
    1110    <ClInclude Include="..\orbital\mesh-compiler.h" />
     11    <ClInclude Include="..\orbital\gun-compiler.h" />
    1212    <ClInclude Include="..\orbital\generated\mesh-parser.h">
     13      <Filter>generated</Filter>
     14    </ClInclude>
     15    <ClInclude Include="..\orbital\generated\gun-parser.h">
    1316      <Filter>generated</Filter>
    1417    </ClInclude>
     
    2326    <ClCompile Include="..\orbital\orbital.cpp" />
    2427    <ClCompile Include="..\orbital\mesh-compiler.cpp" />
     28    <ClCompile Include="..\orbital\mesh.cpp" />
     29    <ClCompile Include="..\orbital\gun-compiler.cpp" />
     30    <ClCompile Include="..\orbital\gun.cpp" />
    2531    <ClCompile Include="..\orbital\generated\mesh-parser.cpp">
    2632      <Filter>generated</Filter>
    2733    </ClCompile>
     34    <ClCompile Include="..\orbital\generated\gun-parser.cpp">
     35      <Filter>generated</Filter>
     36    </ClCompile>
    2837    <ClCompile Include="..\orbital\generated\mesh-scanner.cpp">
     38      <Filter>generated</Filter>
     39    </ClCompile>
     40    <ClCompile Include="..\orbital\generated\gun-scanner.cpp">
    2941      <Filter>generated</Filter>
    3042    </ClCompile>
     
    3547  <ItemGroup>
    3648    <None Include="..\orbital\mesh-scanner.l" />
     49    <None Include="..\orbital\gun-scanner.l" />
    3750    <None Include="..\orbital\mesh-parser.y" />
     51    <None Include="..\orbital\gun-parser.y" />
    3852    <None Include="..\orbital\generated\location.hh">
    3953      <Filter>generated</Filter>
Note: See TracChangeset for help on using the changeset viewer.