Changeset 1424
- Timestamp:
- May 30, 2012, 3:08:27 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 2 deleted
- 10 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/orbital/Makefile.am
r1422 r1424 6 6 particlesystem.h tank.h player.h gun.h snake.h starfield.h \ 7 7 \ 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 10 13 nodist_orbital_SOURCES = \ 11 14 shiny.lolfx.cpp … … 23 26 rm -f generated/[a-zA-Z]* 24 27 flex -o generated/mesh-scanner.cpp mesh-scanner.l 28 flex -o generated/gun-scanner.cpp gun-scanner.l 25 29 bison -o generated/mesh-parser.cpp --defines=generated/mesh-parser.h \ 26 30 -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 27 33 .FORCE: 28 34 endif 29 35 30 EXTRA_DIST = mesh-scanner.l mesh-parser.y 36 EXTRA_DIST = mesh-scanner.l mesh-parser.y \ 37 gun-scanner.l gun-parser.y 31 38 CLEANFILES = $(noinst_PROGRAMS:%$(EXEEXT)=%.self) \ 32 39 $(noinst_PROGRAMS:%$(EXEEXT)=%.elf) \ -
trunk/orbital/generated/gun-parser.cpp
r1423 r1424 37 37 38 38 /* Line 293 of lalr1.cc */ 39 #line 1 " mesh-parser.y"39 #line 1 "gun-parser.y" 40 40 41 41 // 42 42 // Orbital 43 43 // 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> 45 47 // 46 48 … … 54 56 using namespace lol; 55 57 56 #include "../ mesh.h"58 #include "../gun.h" 57 59 58 60 #include <stdio.h> … … 62 64 63 65 /* Line 293 of lalr1.cc */ 64 #line 6 5 "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" 68 70 69 71 /* User implementation prologue. */ 70 72 71 73 /* Line 299 of lalr1.cc */ 72 #line 6 1 "mesh-parser.y"73 74 #include "../ mesh-compiler.h"74 #line 68 "gun-parser.y" 75 76 #include "../gun-compiler.h" 75 77 76 78 #undef yylex 77 #define yylex mc.m_lexer->lex79 #define yylex gc.m_lexer->lex 78 80 79 81 80 82 /* Line 299 of lalr1.cc */ 81 #line 8 2 "generated/mesh-parser.cpp"83 #line 84 "generated/gun-parser.cpp" 82 84 83 85 #ifndef YY_ … … 165 167 166 168 /* Line 382 of lalr1.cc */ 167 #line 1 68 "generated/mesh-parser.cpp"169 #line 170 "generated/gun-parser.cpp" 168 170 169 171 /* Return YYSTR after stripping away unnecessary quotes and … … 173 175 YYSTR is taken from yytname. */ 174 176 std::string 175 MeshParser::yytnamerr_ (const char *yystr)177 GunParser::yytnamerr_ (const char *yystr) 176 178 { 177 179 if (*yystr == '"') … … 206 208 207 209 /// Build a parser object. 208 MeshParser::MeshParser (class MeshCompiler& mc_yyarg)210 GunParser::GunParser (class GunCompiler& gc_yyarg) 209 211 : 210 212 #if YYDEBUG … … 212 214 yycdebug_ (&std::cerr), 213 215 #endif 214 mc (mc_yyarg)215 { 216 } 217 218 MeshParser::~MeshParser ()216 gc (gc_yyarg) 217 { 218 } 219 220 GunParser::~GunParser () 219 221 { 220 222 } … … 226 228 227 229 inline void 228 MeshParser::yy_symbol_value_print_ (int yytype,230 GunParser::yy_symbol_value_print_ (int yytype, 229 231 const semantic_type* yyvaluep, const location_type* yylocationp) 230 232 { … … 240 242 241 243 void 242 MeshParser::yy_symbol_print_ (int yytype,244 GunParser::yy_symbol_print_ (int yytype, 243 245 const semantic_type* yyvaluep, const location_type* yylocationp) 244 246 { … … 252 254 253 255 void 254 MeshParser::yydestruct_ (const char* yymsg,256 GunParser::yydestruct_ (const char* yymsg, 255 257 int yytype, semantic_type* yyvaluep, location_type* yylocationp) 256 258 { … … 270 272 271 273 void 272 MeshParser::yypop_ (unsigned int n)274 GunParser::yypop_ (unsigned int n) 273 275 { 274 276 yystate_stack_.pop (n); … … 279 281 #if YYDEBUG 280 282 std::ostream& 281 MeshParser::debug_stream () const283 GunParser::debug_stream () const 282 284 { 283 285 return *yycdebug_; … … 285 287 286 288 void 287 MeshParser::set_debug_stream (std::ostream& o)289 GunParser::set_debug_stream (std::ostream& o) 288 290 { 289 291 yycdebug_ = &o; … … 291 293 292 294 293 MeshParser::debug_level_type294 MeshParser::debug_level () const295 GunParser::debug_level_type 296 GunParser::debug_level () const 295 297 { 296 298 return yydebug_; … … 298 300 299 301 void 300 MeshParser::set_debug_level (debug_level_type l)302 GunParser::set_debug_level (debug_level_type l) 301 303 { 302 304 yydebug_ = l; … … 305 307 306 308 inline bool 307 MeshParser::yy_pact_value_is_default_ (int yyvalue)309 GunParser::yy_pact_value_is_default_ (int yyvalue) 308 310 { 309 311 return yyvalue == yypact_ninf_; … … 311 313 312 314 inline bool 313 MeshParser::yy_table_value_is_error_ (int yyvalue)315 GunParser::yy_table_value_is_error_ (int yyvalue) 314 316 { 315 317 return yyvalue == yytable_ninf_; … … 317 319 318 320 int 319 MeshParser::parse ()321 GunParser::parse () 320 322 { 321 323 /// Lookahead and lookahead in internal form. … … 463 465 switch (yyn) 464 466 { 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; } 470 500 break; 471 501 … … 473 503 474 504 /* 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; } 477 507 break; 478 508 … … 480 510 481 511 /* 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; } 484 514 break; 485 515 … … 487 517 488 518 /* Line 690 of lalr1.cc */ 489 #line 9 3 "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; } 491 521 break; 492 522 … … 494 524 495 525 /* Line 690 of lalr1.cc */ 496 #line 9 4 "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 */ } 498 528 break; 499 529 … … 501 531 502 532 /* Line 690 of lalr1.cc */ 503 #line 9 8 "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 */ } 505 535 break; 506 536 … … 508 538 509 539 /* 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; } 512 544 break; 513 545 … … 515 547 516 548 /* 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; } 519 553 break; 520 554 … … 522 556 523 557 /* 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; } 526 562 break; 527 563 … … 529 565 530 566 /* 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; } 533 571 break; 534 572 … … 536 574 537 575 /* 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 */ } 540 579 break; 541 580 … … 543 582 544 583 /* Line 690 of lalr1.cc */ 545 #line 1 04 "mesh-parser.y"546 { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0);}584 #line 111 "gun-parser.y" 585 { /* FIXME: loops */ } 547 586 break; 548 587 … … 550 589 551 590 /* Line 690 of lalr1.cc */ 552 #line 1 05 "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); } 554 593 break; 555 594 … … 557 596 558 597 /* Line 690 of lalr1.cc */ 559 #line 1 06 "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); } 561 600 break; 562 601 … … 564 603 565 604 /* Line 690 of lalr1.cc */ 566 #line 1 07 "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); } 568 607 break; 569 608 … … 571 610 572 611 /* Line 690 of lalr1.cc */ 573 #line 1 08 "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); } 575 614 break; 576 615 … … 578 617 579 618 /* 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" 771 620 { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); } 772 621 break; … … 775 624 776 625 /* Line 690 of lalr1.cc */ 777 #line 778 "generated/mesh-parser.cpp"626 #line 627 "generated/gun-parser.cpp" 778 627 default: 779 628 break; … … 953 802 // Generate an error message. 954 803 std::string 955 MeshParser::yysyntax_error_ (int yystate, int yytoken)804 GunParser::yysyntax_error_ (int yystate, int yytoken) 956 805 { 957 806 std::string yyres; … … 1049 898 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 1050 899 STATE-NUM. */ 1051 const signed char MeshParser::yypact_ninf_ = -43;900 const signed char GunParser::yypact_ninf_ = -23; 1052 901 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 1065 909 }; 1066 910 … … 1069 913 default is an error. */ 1070 914 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 1083 922 }; 1084 923 1085 924 /* YYPGOTO[NTERM-NUM]. */ 1086 925 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 1091 929 }; 1092 930 1093 931 /* YYDEFGOTO[NTERM-NUM]. */ 1094 932 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 1099 936 }; 1100 937 … … 1102 939 positive, shift that token. If negative, reduce the rule which 1103 940 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; 1105 942 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 1117 950 }; 1118 951 1119 952 /* YYCHECK. */ 1120 953 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 1132 961 }; 1133 962 … … 1135 964 symbol of state STATE-NUM. */ 1136 965 const unsigned char 1137 MeshParser::yystos_[] =966 GunParser::yystos_[] = 1138 967 { 1139 968 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 1149 973 }; 1150 974 … … 1153 977 to YYLEX-NUM. */ 1154 978 const unsigned short int 1155 MeshParser::yytoken_number_[] =979 GunParser::yytoken_number_[] = 1156 980 { 1157 981 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 1158 982 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 1161 984 }; 1162 985 #endif … … 1164 987 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 1165 988 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 1174 994 }; 1175 995 1176 996 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 1177 997 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 1186 1003 }; 1187 1004 … … 1190 1007 First, the terminals, then, starting at \a yyntokens_, nonterminals. */ 1191 1008 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 1205 1016 }; 1206 1017 #endif … … 1208 1019 #if YYDEBUG 1209 1020 /* 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 1228 1032 }; 1229 1033 … … 1231 1035 YYRHS. */ 1232 1036 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 1241 1042 }; 1242 1043 1243 1044 /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ 1244 1045 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 1253 1051 }; 1254 1052 1255 1053 // Print the state stack on the debug stream. 1256 1054 void 1257 MeshParser::yystack_print_ ()1055 GunParser::yystack_print_ () 1258 1056 { 1259 1057 *yycdebug_ << "Stack now"; … … 1266 1064 // Report on the debug stream that the rule \a yyrule is going to be reduced. 1267 1065 void 1268 MeshParser::yy_reduce_print_ (int yyrule)1066 GunParser::yy_reduce_print_ (int yyrule) 1269 1067 { 1270 1068 unsigned int yylno = yyrline_[yyrule]; … … 1283 1081 1284 1082 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 1285 MeshParser::token_number_type1286 MeshParser::yytranslate_ (int t)1083 GunParser::token_number_type 1084 GunParser::yytranslate_ (int t) 1287 1085 { 1288 1086 static … … 1294 1092 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1295 1093 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, 1297 1095 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1298 1096 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, … … 1317 1115 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 1318 1116 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 1322 1118 }; 1323 1119 if ((unsigned int) t <= yyuser_token_number_max_) … … 1327 1123 } 1328 1124 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; 1340 1136 1341 1137 … … 1343 1139 1344 1140 /* Line 1136 of lalr1.cc */ 1345 #line 1 346 "generated/mesh-parser.cpp"1141 #line 1142 "generated/gun-parser.cpp" 1346 1142 1347 1143 1348 1144 /* Line 1138 of lalr1.cc */ 1349 #line 1 53 "mesh-parser.y"1350 1351 1352 void orbital:: MeshParser::error(const MeshParser::location_type& l,1353 1145 #line 123 "gun-parser.y" 1146 1147 1148 void orbital::GunParser::error(const GunParser::location_type& l, 1149 const std::string& m) 1354 1150 { 1355 mc.Error(l, m);1151 gc.Error(l, m); 1356 1152 } 1357 1153 -
trunk/orbital/generated/gun-parser.h
r1423 r1424 65 65 66 66 /* Line 35 of lalr1.cc */ 67 #line 68 "generated/ mesh-parser.h"67 #line 68 "generated/gun-parser.h" 68 68 69 69 /// A Bison parser. 70 class MeshParser70 class GunParser 71 71 { 72 72 public: … … 77 77 78 78 /* Line 35 of lalr1.cc */ 79 #line 3 5 "mesh-parser.y"79 #line 37 "gun-parser.y" 80 80 81 81 float fval; … … 85 85 86 86 /* Line 35 of lalr1.cc */ 87 #line 88 "generated/ mesh-parser.h"87 #line 88 "generated/gun-parser.h" 88 88 }; 89 89 #else … … 98 98 enum yytokentype { 99 99 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 134 117 }; 135 118 … … 139 122 140 123 /// Build a parser object. 141 MeshParser (class MeshCompiler& mc_yyarg);142 virtual ~ MeshParser ();124 GunParser (class GunCompiler& gc_yyarg); 125 virtual ~GunParser (); 143 126 144 127 /// Parse. … … 305 288 306 289 /* User arguments. */ 307 class MeshCompiler& mc;290 class GunCompiler& gc; 308 291 }; 309 292 … … 311 294 312 295 /* Line 35 of lalr1.cc */ 313 #line 314 "generated/mesh-parser.h"296 #line 297 "generated/gun-parser.h" 314 297 315 298 -
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" 4 4 5 5 #define YY_INT_ALIGNED short int … … 21 21 * altogether. 22 22 */ 23 #define yyFlexLexer MeshFlexLexer23 #define yyFlexLexer GunFlexLexer 24 24 25 25 /* First, we deal with platform-specific or compiler-specific issues. */ … … 285 285 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 286 286 287 void * Meshalloc (yy_size_t );288 void * Meshrealloc (void *,yy_size_t );289 void Meshfree (void * );287 void *Gunalloc (yy_size_t ); 288 void *Gunrealloc (void *,yy_size_t ); 289 void Gunfree (void * ); 290 290 291 291 #define yy_new_buffer yy_create_buffer … … 331 331 (yy_c_buf_p) = yy_cp; 332 332 333 #define YY_NUM_RULES 38334 #define YY_END_OF_BUFFER 39333 #define YY_NUM_RULES 21 334 #define YY_END_OF_BUFFER 22 335 335 /* This struct is not used in this scanner, 336 336 but its presence is necessary. */ … … 340 340 flex_int32_t yy_nxt; 341 341 }; 342 static yyconst flex_int16_t yy_accept[ 64] =342 static yyconst flex_int16_t yy_accept[51] = 343 343 { 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 351 349 } ; 352 350 … … 364 362 1, 1, 1, 1, 1, 1, 9, 10, 11, 12, 365 363 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, 369 367 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 370 368 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, … … 383 381 } ; 384 382 385 static yyconst flex_int32_t yy_meta[2 8] =383 static yyconst flex_int32_t yy_meta[23] = 386 384 { 0, 387 385 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 388 386 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 389 1, 1 , 1, 1, 1, 1, 1387 1, 1 390 388 } ; 391 389 392 static yyconst flex_int16_t yy_base[ 64] =390 static yyconst flex_int16_t yy_base[51] = 393 391 { 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 401 397 } ; 402 398 403 static yyconst flex_int16_t yy_def[ 64] =399 static yyconst flex_int16_t yy_def[51] = 404 400 { 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 412 406 } ; 413 407 414 static yyconst flex_int16_t yy_nxt[ 118] =408 static yyconst flex_int16_t yy_nxt[90] = 415 409 { 0, 416 410 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 429 419 } ; 430 420 431 static yyconst flex_int16_t yy_chk[ 118] =421 static yyconst flex_int16_t yy_chk[90] = 432 422 { 0, 433 423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 434 424 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 446 432 } ; 447 433 … … 453 439 #define YY_MORE_ADJ 0 454 440 #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" 457 443 // 458 444 // Orbital 459 445 // 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> 461 449 // 462 450 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 453 typedef orbital::GunParser::token token; 454 typedef 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 467 461 468 462 #define yyterminate() return token::T_END 469 463 #define YY_NO_UNISTD_H 470 464 #define YY_USER_ACTION yylloc->columns(yyleng); 471 #line 4 72 "generated/mesh-scanner.cpp"465 #line 466 "generated/gun-scanner.cpp" 472 466 473 467 #define INITIAL 0 … … 574 568 register int yy_act; 575 569 576 #line 2 1 "mesh-scanner.l"570 #line 29 "gun-scanner.l" 577 571 578 572 … … 582 576 583 577 584 #line 5 85 "generated/mesh-scanner.cpp"578 #line 579 "generated/gun-scanner.cpp" 585 579 586 580 if ( !(yy_init) ) … … 635 629 { 636 630 yy_current_state = (int) yy_def[yy_current_state]; 637 if ( yy_current_state >= 64)631 if ( yy_current_state >= 51 ) 638 632 yy_c = yy_meta[(unsigned int) yy_c]; 639 633 } … … 641 635 ++yy_cp; 642 636 } 643 while ( yy_current_state != 63);637 while ( yy_current_state != 50 ); 644 638 yy_cp = (yy_last_accepting_cpos); 645 639 yy_current_state = (yy_last_accepting_state); … … 663 657 case 1: 664 658 YY_RULE_SETUP 665 #line 28 "mesh-scanner.l"666 { return token::T_ FLUSH; }659 #line 36 "gun-scanner.l" 660 { return token::T_AI; } 667 661 YY_BREAK 668 662 case 2: 669 663 YY_RULE_SETUP 670 #line 29 "mesh-scanner.l"671 { return token::T_ INITRB; }664 #line 37 "gun-scanner.l" 665 { return token::T_PAI; } 672 666 YY_BREAK 673 667 case 3: 674 668 YY_RULE_SETUP 675 #line 3 0 "mesh-scanner.l"676 { return token::T_ FREERB; }669 #line 38 "gun-scanner.l" 670 { return token::T_CA; } 677 671 YY_BREAK 678 672 case 4: 679 673 YY_RULE_SETUP 680 #line 3 2 "mesh-scanner.l"681 { return token::T_ COLOR; }674 #line 39 "gun-scanner.l" 675 { return token::T_SA; } 682 676 YY_BREAK 683 677 case 5: 684 678 YY_RULE_SETUP 685 #line 33 "mesh-scanner.l"686 { return token::T_ BGCOLOR; }679 #line 40 "gun-scanner.l" 680 { return token::T_TIM; } 687 681 YY_BREAK 688 682 case 6: 689 683 YY_RULE_SETUP 690 #line 35 "mesh-scanner.l"691 { return token::T_ TRANSLATEX; }684 #line 41 "gun-scanner.l" 685 { return token::T_SO; } 692 686 YY_BREAK 693 687 case 7: 694 688 YY_RULE_SETUP 695 #line 36 "mesh-scanner.l"696 { return token::T_ TRANSLATEY; }689 #line 42 "gun-scanner.l" 690 { return token::T_RD; } 697 691 YY_BREAK 698 692 case 8: 699 693 YY_RULE_SETUP 700 #line 37 "mesh-scanner.l"701 { return token::T_ TRANSLATEZ; }694 #line 43 "gun-scanner.l" 695 { return token::T_SPD; } 702 696 YY_BREAK 703 697 case 9: 704 698 YY_RULE_SETUP 705 #line 38 "mesh-scanner.l"706 { return token::T_ TRANSLATE; }699 #line 44 "gun-scanner.l" 700 { return token::T_MODA; } 707 701 YY_BREAK 708 702 case 10: 709 703 YY_RULE_SETUP 710 #line 39 "mesh-scanner.l"711 { return token::T_ ROTATEX; }704 #line 45 "gun-scanner.l" 705 { return token::T_MODB; } 712 706 YY_BREAK 713 707 case 11: 714 708 YY_RULE_SETUP 715 #line 4 0 "mesh-scanner.l"716 { return token::T_ ROTATEY; }709 #line 46 "gun-scanner.l" 710 { return token::T_FFB; } 717 711 YY_BREAK 718 712 case 12: 719 713 YY_RULE_SETUP 720 #line 4 1 "mesh-scanner.l"721 { return token::T_ ROTATEZ; }714 #line 47 "gun-scanner.l" 715 { return token::T_FFP; } 722 716 YY_BREAK 723 717 case 13: 724 718 YY_RULE_SETUP 725 #line 4 2 "mesh-scanner.l"726 { return token::T_ TAPERX; }719 #line 48 "gun-scanner.l" 720 { return token::T_FB; } 727 721 YY_BREAK 728 722 case 14: 729 723 YY_RULE_SETUP 730 #line 4 3 "mesh-scanner.l"731 { return token::T_ TAPERY; }724 #line 49 "gun-scanner.l" 725 { return token::T_FP; } 732 726 YY_BREAK 733 727 case 15: 734 728 YY_RULE_SETUP 735 #line 44 "mesh-scanner.l"736 { return token::T_ TAPERZ; }729 #line 50 "gun-scanner.l" 730 { return token::T_SK; } 737 731 YY_BREAK 738 732 case 16: 739 733 YY_RULE_SETUP 740 #line 45 "mesh-scanner.l"741 { return token::T_ SCALEX; }734 #line 51 "gun-scanner.l" 735 { return token::T_LOOP; } 742 736 YY_BREAK 743 737 case 17: 744 738 YY_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; } 747 742 YY_BREAK 748 743 case 18: 749 744 YY_RULE_SETUP 750 #line 47 "mesh-scanner.l"751 { return token ::T_SCALEZ; }745 #line 55 "gun-scanner.l" 746 { return token_type('-'); } 752 747 YY_BREAK 753 748 case 19: 754 749 YY_RULE_SETUP 755 #line 48 "mesh-scanner.l"756 { return token ::T_SCALE; }750 #line 56 "gun-scanner.l" 751 { return token_type(','); } 757 752 YY_BREAK 758 753 case 20: 759 YY_RULE_SETUP 760 #line 49 "mesh-scanner.l" 761 { return token::T_MIRRORX; } 754 /* rule 20 can match eol */ 755 YY_RULE_SETUP 756 #line 57 "gun-scanner.l" 757 { /* ignore everything else */ } 762 758 YY_BREAK 763 759 case 21: 764 760 YY_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" 853 762 ECHO; 854 763 YY_BREAK 855 #line 856 "generated/mesh-scanner.cpp"764 #line 765 "generated/gun-scanner.cpp" 856 765 case YY_STATE_EOF(INITIAL): 857 766 yyterminate(); … … 1022 931 { 1023 932 delete [] yy_state_buf; 1024 Meshfree(yy_start_stack );933 Gunfree(yy_start_stack ); 1025 934 yy_delete_buffer( YY_CURRENT_BUFFER ); 1026 Meshfree(yy_buffer_stack );935 Gunfree(yy_buffer_stack ); 1027 936 } 1028 937 … … 1152 1061 b->yy_ch_buf = (char *) 1153 1062 /* 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 ); 1155 1064 } 1156 1065 else … … 1201 1110 /* Extend the array by 50%, plus the number we really need. */ 1202 1111 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 ); 1204 1113 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1205 1114 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); … … 1235 1144 { 1236 1145 yy_current_state = (int) yy_def[yy_current_state]; 1237 if ( yy_current_state >= 64)1146 if ( yy_current_state >= 51 ) 1238 1147 yy_c = yy_meta[(unsigned int) yy_c]; 1239 1148 } … … 1263 1172 { 1264 1173 yy_current_state = (int) yy_def[yy_current_state]; 1265 if ( yy_current_state >= 64)1174 if ( yy_current_state >= 51 ) 1266 1175 yy_c = yy_meta[(unsigned int) yy_c]; 1267 1176 } 1268 1177 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); 1270 1179 1271 1180 return yy_is_jam ? 0 : yy_current_state; … … 1447 1356 YY_BUFFER_STATE b; 1448 1357 1449 b = (YY_BUFFER_STATE) Meshalloc(sizeof( struct yy_buffer_state ) );1358 b = (YY_BUFFER_STATE) Gunalloc(sizeof( struct yy_buffer_state ) ); 1450 1359 if ( ! b ) 1451 1360 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); … … 1456 1365 * we need to put in 2 end-of-buffer characters. 1457 1366 */ 1458 b->yy_ch_buf = (char *) Meshalloc(b->yy_buf_size + 2 );1367 b->yy_ch_buf = (char *) Gunalloc(b->yy_buf_size + 2 ); 1459 1368 if ( ! b->yy_ch_buf ) 1460 1369 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); … … 1481 1390 1482 1391 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 ); 1486 1395 } 1487 1396 … … 1608 1517 */ 1609 1518 num_to_alloc = 1; 1610 (yy_buffer_stack) = (struct yy_buffer_state**) Meshalloc1519 (yy_buffer_stack) = (struct yy_buffer_state**)Gunalloc 1611 1520 (num_to_alloc * sizeof(struct yy_buffer_state*) 1612 1521 ); … … 1627 1536 1628 1537 num_to_alloc = (yy_buffer_stack_max) + grow_size; 1629 (yy_buffer_stack) = (struct yy_buffer_state**) Meshrealloc1538 (yy_buffer_stack) = (struct yy_buffer_state**)Gunrealloc 1630 1539 ((yy_buffer_stack), 1631 1540 num_to_alloc * sizeof(struct yy_buffer_state*) … … 1650 1559 1651 1560 if ( ! (yy_start_stack) ) 1652 (yy_start_stack) = (int *) Meshalloc(new_size );1561 (yy_start_stack) = (int *) Gunalloc(new_size ); 1653 1562 1654 1563 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 ); 1656 1565 1657 1566 if ( ! (yy_start_stack) ) … … 1730 1639 #endif 1731 1640 1732 void * Meshalloc (yy_size_t size )1641 void *Gunalloc (yy_size_t size ) 1733 1642 { 1734 1643 return (void *) malloc( size ); 1735 1644 } 1736 1645 1737 void * Meshrealloc (void * ptr, yy_size_t size )1646 void *Gunrealloc (void * ptr, yy_size_t size ) 1738 1647 { 1739 1648 /* The cast to (char *) in the following accommodates both … … 1747 1656 } 1748 1657 1749 void Meshfree (void * ptr )1750 { 1751 free( (char *) ptr ); /* see Meshrealloc() for (char *) cast */1658 void Gunfree (void * ptr ) 1659 { 1660 free( (char *) ptr ); /* see Gunrealloc() for (char *) cast */ 1752 1661 } 1753 1662 1754 1663 #define YYTABLES_NAME "yytables" 1755 1664 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 1669 orbital::GunScanner::GunScanner(char const *command) 1670 : GunFlexLexer(0, 0), 1762 1671 m_input(command) 1763 1672 { 1764 1673 } 1765 1674 1766 orbital:: MeshScanner::~MeshScanner()1767 { 1768 } 1769 1770 int orbital:: MeshScanner::LexerInput(char* buf, int max_size)1675 orbital::GunScanner::~GunScanner() 1676 { 1677 } 1678 1679 int orbital::GunScanner::LexerInput(char* buf, int max_size) 1771 1680 { 1772 1681 buf[0] = m_input[0]; … … 1779 1688 #undef yylex 1780 1689 #endif 1781 int MeshFlexLexer::yylex()1782 { 1783 std::cerr << "in MeshFlexLexer::yylex() !" << std::endl;1690 int GunFlexLexer::yylex() 1691 { 1692 std::cerr << "in GunFlexLexer::yylex() !" << std::endl; 1784 1693 return 0; 1785 1694 } 1786 1695 1787 int MeshFlexLexer::yywrap()1696 int GunFlexLexer::yywrap() 1788 1697 { 1789 1698 return 1; -
trunk/orbital/generated/mesh-parser.cpp
r1422 r1424 42 42 // Orbital 43 43 // 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> 45 47 // 46 48 … … 62 64 63 65 /* Line 293 of lalr1.cc */ 64 #line 6 5"generated/mesh-parser.cpp"66 #line 67 "generated/mesh-parser.cpp" 65 67 66 68 … … 70 72 71 73 /* Line 299 of lalr1.cc */ 72 #line 6 1"mesh-parser.y"74 #line 63 "mesh-parser.y" 73 75 74 76 #include "../mesh-compiler.h" … … 79 81 80 82 /* Line 299 of lalr1.cc */ 81 #line 8 2"generated/mesh-parser.cpp"83 #line 84 "generated/mesh-parser.cpp" 82 84 83 85 #ifndef YY_ … … 165 167 166 168 /* Line 382 of lalr1.cc */ 167 #line 1 68"generated/mesh-parser.cpp"169 #line 170 "generated/mesh-parser.cpp" 168 170 169 171 /* Return YYSTR after stripping away unnecessary quotes and … … 466 468 467 469 /* Line 690 of lalr1.cc */ 468 #line 8 7"mesh-parser.y"470 #line 89 "mesh-parser.y" 469 471 { mc.m_mesh.Flush(); } 470 472 break; … … 473 475 474 476 /* Line 690 of lalr1.cc */ 475 #line 88"mesh-parser.y"477 #line 90 "mesh-parser.y" 476 478 { mc.m_mesh.MeshConvert(); } 477 479 break; … … 480 482 481 483 /* Line 690 of lalr1.cc */ 482 #line 89"mesh-parser.y"484 #line 91 "mesh-parser.y" 483 485 { /* TODO */ } 484 486 break; … … 487 489 488 490 /* Line 690 of lalr1.cc */ 489 #line 9 3"mesh-parser.y"491 #line 95 "mesh-parser.y" 490 492 { 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)); } 491 493 break; … … 494 496 495 497 /* Line 690 of lalr1.cc */ 496 #line 9 4"mesh-parser.y"498 #line 96 "mesh-parser.y" 497 499 { 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)); } 498 500 break; … … 501 503 502 504 /* Line 690 of lalr1.cc */ 503 #line 98"mesh-parser.y"505 #line 100 "mesh-parser.y" 504 506 { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } 505 507 break; … … 508 510 509 511 /* Line 690 of lalr1.cc */ 510 #line 99"mesh-parser.y"512 #line 101 "mesh-parser.y" 511 513 { mc.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } 512 514 break; … … 515 517 516 518 /* Line 690 of lalr1.cc */ 517 #line 10 0"mesh-parser.y"519 #line 102 "mesh-parser.y" 518 520 { mc.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } 519 521 break; … … 522 524 523 525 /* Line 690 of lalr1.cc */ 524 #line 10 1"mesh-parser.y"526 #line 103 "mesh-parser.y" 525 527 { mc.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 526 528 break; … … 529 531 530 532 /* Line 690 of lalr1.cc */ 531 #line 10 2"mesh-parser.y"533 #line 104 "mesh-parser.y" 532 534 { mc.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); } 533 535 break; … … 536 538 537 539 /* Line 690 of lalr1.cc */ 538 #line 10 3"mesh-parser.y"540 #line 105 "mesh-parser.y" 539 541 { mc.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); } 540 542 break; … … 543 545 544 546 /* Line 690 of lalr1.cc */ 545 #line 10 4"mesh-parser.y"547 #line 106 "mesh-parser.y" 546 548 { mc.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); } 547 549 break; … … 550 552 551 553 /* Line 690 of lalr1.cc */ 552 #line 10 5"mesh-parser.y"554 #line 107 "mesh-parser.y" 553 555 { mc.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 554 556 break; … … 557 559 558 560 /* Line 690 of lalr1.cc */ 559 #line 10 6"mesh-parser.y"561 #line 108 "mesh-parser.y" 560 562 { mc.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 561 563 break; … … 564 566 565 567 /* Line 690 of lalr1.cc */ 566 #line 10 7"mesh-parser.y"568 #line 109 "mesh-parser.y" 567 569 { mc.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 568 570 break; … … 571 573 572 574 /* Line 690 of lalr1.cc */ 573 #line 1 08"mesh-parser.y"575 #line 110 "mesh-parser.y" 574 576 { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } 575 577 break; … … 578 580 579 581 /* Line 690 of lalr1.cc */ 580 #line 1 09"mesh-parser.y"582 #line 111 "mesh-parser.y" 581 583 { mc.m_mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } 582 584 break; … … 585 587 586 588 /* Line 690 of lalr1.cc */ 587 #line 11 0"mesh-parser.y"589 #line 112 "mesh-parser.y" 588 590 { mc.m_mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } 589 591 break; … … 592 594 593 595 /* Line 690 of lalr1.cc */ 594 #line 11 1"mesh-parser.y"596 #line 113 "mesh-parser.y" 595 597 { mc.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 596 598 break; … … 599 601 600 602 /* Line 690 of lalr1.cc */ 601 #line 11 2"mesh-parser.y"603 #line 114 "mesh-parser.y" 602 604 { mc.m_mesh.MirrorX(); } 603 605 break; … … 606 608 607 609 /* Line 690 of lalr1.cc */ 608 #line 11 3"mesh-parser.y"610 #line 115 "mesh-parser.y" 609 611 { mc.m_mesh.MirrorY(); } 610 612 break; … … 613 615 614 616 /* Line 690 of lalr1.cc */ 615 #line 11 4"mesh-parser.y"617 #line 116 "mesh-parser.y" 616 618 { mc.m_mesh.MirrorZ(); } 617 619 break; … … 620 622 621 623 /* Line 690 of lalr1.cc */ 622 #line 1 18"mesh-parser.y"624 #line 120 "mesh-parser.y" 623 625 { mc.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 624 626 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, … … 629 631 630 632 /* Line 690 of lalr1.cc */ 631 #line 12 1"mesh-parser.y"633 #line 123 "mesh-parser.y" 632 634 { mc.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 633 635 break; … … 636 638 637 639 /* Line 690 of lalr1.cc */ 638 #line 12 2"mesh-parser.y"640 #line 124 "mesh-parser.y" 639 641 { mc.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 640 642 (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } … … 644 646 645 647 /* Line 690 of lalr1.cc */ 646 #line 12 4"mesh-parser.y"648 #line 126 "mesh-parser.y" 647 649 { mc.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 648 650 (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } … … 652 654 653 655 /* Line 690 of lalr1.cc */ 654 #line 12 6"mesh-parser.y"656 #line 128 "mesh-parser.y" 655 657 { mc.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0, 656 658 vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } … … 660 662 661 663 /* Line 690 of lalr1.cc */ 662 #line 1 28"mesh-parser.y"664 #line 130 "mesh-parser.y" 663 665 { mc.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, 664 666 (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); } … … 668 670 669 671 /* Line 690 of lalr1.cc */ 670 #line 13 0"mesh-parser.y"672 #line 132 "mesh-parser.y" 671 673 { mc.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 672 674 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); } … … 676 678 677 679 /* Line 690 of lalr1.cc */ 678 #line 13 2"mesh-parser.y"680 #line 134 "mesh-parser.y" 679 681 { 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 682 break; … … 683 685 684 686 /* Line 690 of lalr1.cc */ 685 #line 13 3"mesh-parser.y"687 #line 135 "mesh-parser.y" 686 688 { mc.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } 687 689 break; … … 690 692 691 693 /* Line 690 of lalr1.cc */ 692 #line 13 4"mesh-parser.y"694 #line 136 "mesh-parser.y" 693 695 { mc.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } 694 696 break; … … 697 699 698 700 /* Line 690 of lalr1.cc */ 699 #line 13 5"mesh-parser.y"701 #line 137 "mesh-parser.y" 700 702 { 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 703 (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); } … … 705 707 706 708 /* Line 690 of lalr1.cc */ 707 #line 1 39"mesh-parser.y"709 #line 141 "mesh-parser.y" 708 710 { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } 709 711 break; … … 712 714 713 715 /* Line 690 of lalr1.cc */ 714 #line 14 0"mesh-parser.y"716 #line 142 "mesh-parser.y" 715 717 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); } 716 718 break; … … 719 721 720 722 /* Line 690 of lalr1.cc */ 721 #line 14 1"mesh-parser.y"723 #line 143 "mesh-parser.y" 722 724 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); } 723 725 break; … … 726 728 727 729 /* Line 690 of lalr1.cc */ 728 #line 14 2"mesh-parser.y"730 #line 144 "mesh-parser.y" 729 731 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(3) - (3)].fval); } 730 732 break; … … 733 735 734 736 /* Line 690 of lalr1.cc */ 735 #line 14 3"mesh-parser.y"737 #line 145 "mesh-parser.y" 736 738 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(3) - (3)].fval); } 737 739 break; … … 740 742 741 743 /* Line 690 of lalr1.cc */ 742 #line 14 4"mesh-parser.y"744 #line 146 "mesh-parser.y" 743 745 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(3) - (3)].fval); } 744 746 break; … … 747 749 748 750 /* Line 690 of lalr1.cc */ 749 #line 14 5"mesh-parser.y"751 #line 147 "mesh-parser.y" 750 752 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(3) - (3)].fval); } 751 753 break; … … 754 756 755 757 /* Line 690 of lalr1.cc */ 756 #line 14 6"mesh-parser.y"758 #line 148 "mesh-parser.y" 757 759 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(3) - (3)].fval); } 758 760 break; … … 761 763 762 764 /* Line 690 of lalr1.cc */ 763 #line 1 49"mesh-parser.y"765 #line 151 "mesh-parser.y" 764 766 { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } 765 767 break; … … 768 770 769 771 /* Line 690 of lalr1.cc */ 770 #line 15 0"mesh-parser.y"772 #line 152 "mesh-parser.y" 771 773 { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); } 772 774 break; … … 775 777 776 778 /* Line 690 of lalr1.cc */ 777 #line 7 78"generated/mesh-parser.cpp"779 #line 780 "generated/mesh-parser.cpp" 778 780 default: 779 781 break; … … 1245 1247 MeshParser::yyrline_[] = 1246 1248 { 1247 0, 7 1, 71, 75, 76, 80, 81, 82, 83, 87,1248 88, 89, 93, 94, 98, 99, 100, 101, 102, 103,1249 10 4, 105, 106, 107, 108, 109, 110, 111, 112, 113,1250 11 4, 118, 121, 122, 124, 126, 128, 130, 132, 133,1251 13 4, 135, 139, 140, 141, 142, 143, 144, 145, 146,1252 1 49, 1501249 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 1253 1255 }; 1254 1256 … … 1343 1345 1344 1346 /* Line 1136 of lalr1.cc */ 1345 #line 134 6"generated/mesh-parser.cpp"1347 #line 1348 "generated/mesh-parser.cpp" 1346 1348 1347 1349 1348 1350 /* Line 1138 of lalr1.cc */ 1349 #line 15 3"mesh-parser.y"1351 #line 155 "mesh-parser.y" 1350 1352 1351 1353 -
trunk/orbital/generated/mesh-parser.h
r1422 r1424 77 77 78 78 /* Line 35 of lalr1.cc */ 79 #line 3 5"mesh-parser.y"79 #line 37 "mesh-parser.y" 80 80 81 81 float fval; -
trunk/orbital/generated/mesh-scanner.cpp
r1422 r1424 458 458 // Orbital 459 459 // 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> 461 463 // 462 464 … … 465 467 typedef orbital::MeshParser::token token; 466 468 typedef 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 467 475 468 476 #define yyterminate() return token::T_END 469 477 #define YY_NO_UNISTD_H 470 478 #define YY_USER_ACTION yylloc->columns(yyleng); 471 #line 4 72"generated/mesh-scanner.cpp"479 #line 480 "generated/mesh-scanner.cpp" 472 480 473 481 #define INITIAL 0 … … 574 582 register int yy_act; 575 583 576 #line 2 1"mesh-scanner.l"584 #line 29 "mesh-scanner.l" 577 585 578 586 … … 582 590 583 591 584 #line 5 85"generated/mesh-scanner.cpp"592 #line 593 "generated/mesh-scanner.cpp" 585 593 586 594 if ( !(yy_init) ) … … 663 671 case 1: 664 672 YY_RULE_SETUP 665 #line 28"mesh-scanner.l"673 #line 36 "mesh-scanner.l" 666 674 { return token::T_FLUSH; } 667 675 YY_BREAK 668 676 case 2: 669 677 YY_RULE_SETUP 670 #line 29"mesh-scanner.l"678 #line 37 "mesh-scanner.l" 671 679 { return token::T_INITRB; } 672 680 YY_BREAK 673 681 case 3: 674 682 YY_RULE_SETUP 675 #line 3 0"mesh-scanner.l"683 #line 38 "mesh-scanner.l" 676 684 { return token::T_FREERB; } 677 685 YY_BREAK 678 686 case 4: 679 687 YY_RULE_SETUP 680 #line 32"mesh-scanner.l"688 #line 40 "mesh-scanner.l" 681 689 { return token::T_COLOR; } 682 690 YY_BREAK 683 691 case 5: 684 692 YY_RULE_SETUP 685 #line 33"mesh-scanner.l"693 #line 41 "mesh-scanner.l" 686 694 { return token::T_BGCOLOR; } 687 695 YY_BREAK 688 696 case 6: 689 697 YY_RULE_SETUP 690 #line 35"mesh-scanner.l"698 #line 43 "mesh-scanner.l" 691 699 { return token::T_TRANSLATEX; } 692 700 YY_BREAK 693 701 case 7: 694 702 YY_RULE_SETUP 695 #line 36"mesh-scanner.l"703 #line 44 "mesh-scanner.l" 696 704 { return token::T_TRANSLATEY; } 697 705 YY_BREAK 698 706 case 8: 699 707 YY_RULE_SETUP 700 #line 37"mesh-scanner.l"708 #line 45 "mesh-scanner.l" 701 709 { return token::T_TRANSLATEZ; } 702 710 YY_BREAK 703 711 case 9: 704 712 YY_RULE_SETUP 705 #line 38"mesh-scanner.l"713 #line 46 "mesh-scanner.l" 706 714 { return token::T_TRANSLATE; } 707 715 YY_BREAK 708 716 case 10: 709 717 YY_RULE_SETUP 710 #line 39"mesh-scanner.l"718 #line 47 "mesh-scanner.l" 711 719 { return token::T_ROTATEX; } 712 720 YY_BREAK 713 721 case 11: 714 722 YY_RULE_SETUP 715 #line 4 0"mesh-scanner.l"723 #line 48 "mesh-scanner.l" 716 724 { return token::T_ROTATEY; } 717 725 YY_BREAK 718 726 case 12: 719 727 YY_RULE_SETUP 720 #line 4 1"mesh-scanner.l"728 #line 49 "mesh-scanner.l" 721 729 { return token::T_ROTATEZ; } 722 730 YY_BREAK 723 731 case 13: 724 732 YY_RULE_SETUP 725 #line 42"mesh-scanner.l"733 #line 50 "mesh-scanner.l" 726 734 { return token::T_TAPERX; } 727 735 YY_BREAK 728 736 case 14: 729 737 YY_RULE_SETUP 730 #line 43"mesh-scanner.l"738 #line 51 "mesh-scanner.l" 731 739 { return token::T_TAPERY; } 732 740 YY_BREAK 733 741 case 15: 734 742 YY_RULE_SETUP 735 #line 44"mesh-scanner.l"743 #line 52 "mesh-scanner.l" 736 744 { return token::T_TAPERZ; } 737 745 YY_BREAK 738 746 case 16: 739 747 YY_RULE_SETUP 740 #line 45"mesh-scanner.l"748 #line 53 "mesh-scanner.l" 741 749 { return token::T_SCALEX; } 742 750 YY_BREAK 743 751 case 17: 744 752 YY_RULE_SETUP 745 #line 46"mesh-scanner.l"753 #line 54 "mesh-scanner.l" 746 754 { return token::T_SCALEY; } 747 755 YY_BREAK 748 756 case 18: 749 757 YY_RULE_SETUP 750 #line 47"mesh-scanner.l"758 #line 55 "mesh-scanner.l" 751 759 { return token::T_SCALEZ; } 752 760 YY_BREAK 753 761 case 19: 754 762 YY_RULE_SETUP 755 #line 48"mesh-scanner.l"763 #line 56 "mesh-scanner.l" 756 764 { return token::T_SCALE; } 757 765 YY_BREAK 758 766 case 20: 759 767 YY_RULE_SETUP 760 #line 49"mesh-scanner.l"768 #line 57 "mesh-scanner.l" 761 769 { return token::T_MIRRORX; } 762 770 YY_BREAK 763 771 case 21: 764 772 YY_RULE_SETUP 765 #line 5 0"mesh-scanner.l"773 #line 58 "mesh-scanner.l" 766 774 { return token::T_MIRRORY; } 767 775 YY_BREAK 768 776 case 22: 769 777 YY_RULE_SETUP 770 #line 5 1"mesh-scanner.l"778 #line 59 "mesh-scanner.l" 771 779 { return token::T_MIRRORZ; } 772 780 YY_BREAK 773 781 case 23: 774 782 YY_RULE_SETUP 775 #line 53"mesh-scanner.l"783 #line 61 "mesh-scanner.l" 776 784 { return token::T_CYLINDER; } 777 785 YY_BREAK 778 786 case 24: 779 787 YY_RULE_SETUP 780 #line 54"mesh-scanner.l"788 #line 62 "mesh-scanner.l" 781 789 { return token::T_BOX; } 782 790 YY_BREAK 783 791 case 25: 784 792 YY_RULE_SETUP 785 #line 55"mesh-scanner.l"793 #line 63 "mesh-scanner.l" 786 794 { return token::T_SMOOTHCHAMFBOX; } 787 795 YY_BREAK 788 796 case 26: 789 797 YY_RULE_SETUP 790 #line 56"mesh-scanner.l"798 #line 64 "mesh-scanner.l" 791 799 { return token::T_FLATCHAMFBOX; } 792 800 YY_BREAK 793 801 case 27: 794 802 YY_RULE_SETUP 795 #line 57"mesh-scanner.l"803 #line 65 "mesh-scanner.l" 796 804 { return token::T_SPHERE; } 797 805 YY_BREAK 798 806 case 28: 799 807 YY_RULE_SETUP 800 #line 58"mesh-scanner.l"808 #line 66 "mesh-scanner.l" 801 809 { return token::T_STAR; } 802 810 YY_BREAK 803 811 case 29: 804 812 YY_RULE_SETUP 805 #line 59"mesh-scanner.l"813 #line 67 "mesh-scanner.l" 806 814 { return token::T_EXPANDEDSTAR; } 807 815 YY_BREAK 808 816 case 30: 809 817 YY_RULE_SETUP 810 #line 6 0"mesh-scanner.l"818 #line 68 "mesh-scanner.l" 811 819 { return token::T_DISC; } 812 820 YY_BREAK 813 821 case 31: 814 822 YY_RULE_SETUP 815 #line 6 1"mesh-scanner.l"823 #line 69 "mesh-scanner.l" 816 824 { return token::T_TRIANGLE; } 817 825 YY_BREAK 818 826 case 32: 819 827 YY_RULE_SETUP 820 #line 62"mesh-scanner.l"828 #line 70 "mesh-scanner.l" 821 829 { return token::T_QUAD; } 822 830 YY_BREAK 823 831 case 33: 824 832 YY_RULE_SETUP 825 #line 63"mesh-scanner.l"833 #line 71 "mesh-scanner.l" 826 834 { return token::T_COG; } 827 835 YY_BREAK 828 836 case 34: 829 837 YY_RULE_SETUP 830 #line 65"mesh-scanner.l"838 #line 73 "mesh-scanner.l" 831 839 { 832 840 yylval->fval = atof(yytext); return token::NUMBER; } … … 834 842 case 35: 835 843 YY_RULE_SETUP 836 #line 67"mesh-scanner.l"844 #line 75 "mesh-scanner.l" 837 845 { return token_type('-'); } 838 846 YY_BREAK 839 847 case 36: 840 848 YY_RULE_SETUP 841 #line 68"mesh-scanner.l"849 #line 76 "mesh-scanner.l" 842 850 { return token_type(','); } 843 851 YY_BREAK … … 845 853 /* rule 37 can match eol */ 846 854 YY_RULE_SETUP 847 #line 69"mesh-scanner.l"855 #line 77 "mesh-scanner.l" 848 856 { /* ignore everything else */ } 849 857 YY_BREAK 850 858 case 38: 851 859 YY_RULE_SETUP 852 #line 7 1"mesh-scanner.l"860 #line 79 "mesh-scanner.l" 853 861 ECHO; 854 862 YY_BREAK 855 #line 8 56"generated/mesh-scanner.cpp"863 #line 864 "generated/mesh-scanner.cpp" 856 864 case YY_STATE_EOF(INITIAL): 857 865 yyterminate(); … … 1754 1762 #define YYTABLES_NAME "yytables" 1755 1763 1756 #line 7 1"mesh-scanner.l"1764 #line 79 "mesh-scanner.l" 1757 1765 1758 1766 -
trunk/orbital/gun.h
r1423 r1424 7 7 // 8 8 9 /* TODO for this file:10 * - rename "AppendQuadVert" to "AddVertex" or something; it has nothing11 * to do with quads.12 */13 14 extern char const *lolfx_shiny;15 16 #include "CommandParser.h"17 18 9 #if !defined __GUN_H__ 19 10 #define __GUN_H__ 20 11 21 class Gun : public CommandParser12 class Gun 22 13 { 23 14 public: … … 39 30 {} 40 31 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); 69 33 70 34 void Shoot(int count) … … 82 46 } 83 47 84 private:85 48 vec3 m_position; 86 49 float m_scrz; -
trunk/orbital/mesh-compiler.h
r1423 r1424 11 11 12 12 #include <string> 13 14 #ifndef YY_DECL15 # define YY_DECL orbital::MeshParser::token_type \16 orbital::MeshScanner::lex(orbital::MeshParser::semantic_type* yylval, \17 orbital::MeshParser::location_type* yylloc)18 #endif19 13 20 14 #ifndef __FLEX_LEXER_H -
trunk/orbital/mesh-scanner.l
r1423 r1424 12 12 typedef orbital::MeshParser::token token; 13 13 typedef 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 14 20 15 21 #define yyterminate() return token::T_END -
trunk/orbital/mesh.h
r1423 r1424 12 12 */ 13 13 14 extern char const *lolfx_shiny;15 16 14 #if !defined __MESH_H__ 17 15 #define __MESH_H__ 18 16 19 #include "mesh-compiler.h" 17 extern char const *lolfx_shiny; 20 18 21 19 class Mesh … … 27 25 {} 28 26 29 void SendCommand(char const *command) 30 { 31 orbital::MeshCompiler mc(*this); 32 mc.ParseString(command); 33 } 27 void SendCommand(char const *command); 34 28 35 29 void Flush() -
trunk/win32/orbital.vcxproj
r1423 r1424 28 28 </ItemGroup> 29 29 <ItemGroup> 30 <ClInclude Include="..\orbital\CommandParser.h" />31 30 <ClInclude Include="..\orbital\generated\mesh-parser.h" /> 31 <ClInclude Include="..\orbital\generated\gun-parser.h" /> 32 32 <ClInclude Include="..\orbital\gun.h" /> 33 33 <ClInclude Include="..\orbital\mesh-compiler.h" /> 34 <ClInclude Include="..\orbital\gun-compiler.h" /> 34 35 <ClInclude Include="..\orbital\mesh.h" /> 35 36 <ClInclude Include="..\orbital\orbital.h" /> … … 42 43 <ItemGroup> 43 44 <ClCompile Include="..\orbital\generated\mesh-parser.cpp" /> 45 <ClCompile Include="..\orbital\generated\gun-parser.cpp" /> 44 46 <ClCompile Include="..\orbital\generated\mesh-scanner.cpp" /> 47 <ClCompile Include="..\orbital\generated\gun-scanner.cpp" /> 45 48 <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" /> 46 52 <ClCompile Include="..\orbital\orbital.cpp" /> 47 53 </ItemGroup> … … 59 65 <None Include="..\orbital\generated\stack.hh" /> 60 66 <None Include="..\orbital\mesh-scanner.l" /> 67 <None Include="..\orbital\gun-scanner.l" /> 61 68 <None Include="..\orbital\mesh-parser.y" /> 69 <None Include="..\orbital\gun-parser.y" /> 62 70 </ItemGroup> 63 71 <PropertyGroup Label="Globals"> -
trunk/win32/orbital.vcxproj.filters
r1423 r1424 4 4 <ClInclude Include="..\orbital\gun.h" /> 5 5 <ClInclude Include="..\orbital\mesh.h" /> 6 <ClInclude Include="..\orbital\CommandParser.h" />7 6 <ClInclude Include="..\orbital\player.h" /> 8 7 <ClInclude Include="..\orbital\tank.h" /> … … 10 9 <ClInclude Include="..\orbital\snake.h" /> 11 10 <ClInclude Include="..\orbital\mesh-compiler.h" /> 11 <ClInclude Include="..\orbital\gun-compiler.h" /> 12 12 <ClInclude Include="..\orbital\generated\mesh-parser.h"> 13 <Filter>generated</Filter> 14 </ClInclude> 15 <ClInclude Include="..\orbital\generated\gun-parser.h"> 13 16 <Filter>generated</Filter> 14 17 </ClInclude> … … 23 26 <ClCompile Include="..\orbital\orbital.cpp" /> 24 27 <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" /> 25 31 <ClCompile Include="..\orbital\generated\mesh-parser.cpp"> 26 32 <Filter>generated</Filter> 27 33 </ClCompile> 34 <ClCompile Include="..\orbital\generated\gun-parser.cpp"> 35 <Filter>generated</Filter> 36 </ClCompile> 28 37 <ClCompile Include="..\orbital\generated\mesh-scanner.cpp"> 38 <Filter>generated</Filter> 39 </ClCompile> 40 <ClCompile Include="..\orbital\generated\gun-scanner.cpp"> 29 41 <Filter>generated</Filter> 30 42 </ClCompile> … … 35 47 <ItemGroup> 36 48 <None Include="..\orbital\mesh-scanner.l" /> 49 <None Include="..\orbital\gun-scanner.l" /> 37 50 <None Include="..\orbital\mesh-parser.y" /> 51 <None Include="..\orbital\gun-parser.y" /> 38 52 <None Include="..\orbital\generated\location.hh"> 39 53 <Filter>generated</Filter>
Note: See TracChangeset
for help on using the changeset viewer.