Changeset 1419
- Timestamp:
- May 30, 2012, 9:12:54 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 2 deleted
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/contrib/NOTES
r1169 r1419 66 66 Hard to do, requires libogg, libvorbis, mikmod, libsmpeg... 67 67 68 69 Flex 70 ---- 71 72 Just copied FlexLexer.h from a Debian installation. 73 -
trunk/orbital/Makefile.am
r1418 r1419 4 4 orbital_SOURCES = \ 5 5 orbital.cpp orbital.h \ 6 mesh.cpp mesh.h \7 6 particlesystem.h tank.h player.h gun.h snake.h starfield.h \ 8 7 \ 9 mesh -driver.cpp mesh-driver.h \8 mesh.h mesh-scanner.h mesh-driver.cpp mesh-driver.h \ 10 9 generated/mesh-scanner.cpp \ 11 10 generated/mesh-parser.cpp … … 24 23 $(MKDIR_P) generated 25 24 rm -f generated/[a-zA-Z]* 26 flex -o generated/mesh-scanner.cpp mesh.l l25 flex -o generated/mesh-scanner.cpp mesh.l 27 26 bison -o generated/mesh-parser.cpp --defines=generated/mesh-parser.h \ 28 27 -d -b generated/mesh mesh.yy -
trunk/orbital/generated/mesh-parser.cpp
r1418 r1419 37 37 38 38 /* Line 293 of lalr1.cc */ 39 #line 4 "mesh.yy" 40 /*** C/C++ Declarations ***/ 39 #line 1 "mesh.yy" 40 41 // 42 // Orbital 43 // 44 // Copyright: (c) 2012 Various People 45 // 46 41 47 #if defined HAVE_CONFIG_H 42 48 # include "config.h" … … 55 61 56 62 57 58 63 /* Line 293 of lalr1.cc */ 59 #line 6 0"generated/mesh-parser.cpp"64 #line 65 "generated/mesh-parser.cpp" 60 65 61 66 … … 65 70 66 71 /* Line 299 of lalr1.cc */ 67 #line 88 "mesh.yy" 68 72 #line 61 "mesh.yy" 69 73 70 74 #include "mesh-driver.h" 71 75 #include "mesh-scanner.h" 72 76 73 /* this "connects" the bison parser in the driver to the flex scanner class74 * object. it defines the yylex() function call to pull the next token from the75 * current lexer object of the driver context. */76 77 #undef yylex 77 #define yylex driver.lexer->lex 78 78 #define yylex driver.m_lexer->lex 79 79 80 80 … … 350 350 351 351 352 /* User initialization code. */353 354 /* Line 565 of lalr1.cc */355 #line 49 "mesh.yy"356 {357 // initialize the initial location object358 yylloc.begin.filename = yylloc.end.filename = &driver.streamname;359 }360 361 /* Line 565 of lalr1.cc */362 #line 363 "generated/mesh-parser.cpp"363 364 352 /* Initialize the stacks. The initial state will be pushed in 365 353 yynewstate, since the latter expects the semantical and the … … 479 467 480 468 /* Line 690 of lalr1.cc */ 481 #line 120"mesh.yy"482 { driver.m esh.Flush(); }469 #line 88 "mesh.yy" 470 { driver.m_mesh.Flush(); } 483 471 break; 484 472 … … 486 474 487 475 /* Line 690 of lalr1.cc */ 488 #line 121"mesh.yy"489 { driver.m esh.MeshConvert(); }476 #line 89 "mesh.yy" 477 { driver.m_mesh.MeshConvert(); } 490 478 break; 491 479 … … 493 481 494 482 /* Line 690 of lalr1.cc */ 495 #line 122"mesh.yy"483 #line 90 "mesh.yy" 496 484 { /* TODO */ } 497 485 break; … … 500 488 501 489 /* Line 690 of lalr1.cc */ 502 #line 126"mesh.yy"503 { driver.m esh.SetCurColor(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }490 #line 94 "mesh.yy" 491 { driver.m_mesh.SetCurColor(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } 504 492 break; 505 493 … … 507 495 508 496 /* Line 690 of lalr1.cc */ 509 #line 127"mesh.yy"510 { driver.m esh.SetCurColor2(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); }497 #line 95 "mesh.yy" 498 { driver.m_mesh.SetCurColor2(vec4((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } 511 499 break; 512 500 … … 514 502 515 503 /* Line 690 of lalr1.cc */ 516 #line 131"mesh.yy"517 { driver.m esh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }504 #line 99 "mesh.yy" 505 { driver.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } 518 506 break; 519 507 … … 521 509 522 510 /* Line 690 of lalr1.cc */ 523 #line 1 32"mesh.yy"524 { driver.m esh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }511 #line 100 "mesh.yy" 512 { driver.m_mesh.Translate(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } 525 513 break; 526 514 … … 528 516 529 517 /* Line 690 of lalr1.cc */ 530 #line 1 33"mesh.yy"531 { driver.m esh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }518 #line 101 "mesh.yy" 519 { driver.m_mesh.Translate(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } 532 520 break; 533 521 … … 535 523 536 524 /* Line 690 of lalr1.cc */ 537 #line 1 34"mesh.yy"538 { driver.m esh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }525 #line 102 "mesh.yy" 526 { driver.m_mesh.Translate(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 539 527 break; 540 528 … … 542 530 543 531 /* Line 690 of lalr1.cc */ 544 #line 1 35"mesh.yy"545 { driver.m esh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); }532 #line 103 "mesh.yy" 533 { driver.m_mesh.RotateX((yysemantic_stack_[(2) - (2)].args).f0); } 546 534 break; 547 535 … … 549 537 550 538 /* Line 690 of lalr1.cc */ 551 #line 1 36"mesh.yy"552 { driver.m esh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); }539 #line 104 "mesh.yy" 540 { driver.m_mesh.RotateY((yysemantic_stack_[(2) - (2)].args).f0); } 553 541 break; 554 542 … … 556 544 557 545 /* Line 690 of lalr1.cc */ 558 #line 1 37"mesh.yy"559 { driver.m esh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); }546 #line 105 "mesh.yy" 547 { driver.m_mesh.RotateZ((yysemantic_stack_[(2) - (2)].args).f0); } 560 548 break; 561 549 … … 563 551 564 552 /* Line 690 of lalr1.cc */ 565 #line 1 38"mesh.yy"566 { driver.m esh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }553 #line 106 "mesh.yy" 554 { driver.m_mesh.TaperX((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 567 555 break; 568 556 … … 570 558 571 559 /* Line 690 of lalr1.cc */ 572 #line 1 39"mesh.yy"573 { driver.m esh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }560 #line 107 "mesh.yy" 561 { driver.m_mesh.TaperY((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 574 562 break; 575 563 … … 577 565 578 566 /* Line 690 of lalr1.cc */ 579 #line 1 40"mesh.yy"580 { driver.m esh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); }567 #line 108 "mesh.yy" 568 { driver.m_mesh.TaperZ((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2); } 581 569 break; 582 570 … … 584 572 585 573 /* Line 690 of lalr1.cc */ 586 #line 1 41"mesh.yy"587 { driver.m esh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); }574 #line 109 "mesh.yy" 575 { driver.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, 0, 0)); } 588 576 break; 589 577 … … 591 579 592 580 /* Line 690 of lalr1.cc */ 593 #line 1 42"mesh.yy"594 { driver.m esh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); }581 #line 110 "mesh.yy" 582 { driver.m_mesh.Scale(vec3(0, (yysemantic_stack_[(2) - (2)].args).f0, 0)); } 595 583 break; 596 584 … … 598 586 599 587 /* Line 690 of lalr1.cc */ 600 #line 1 43"mesh.yy"601 { driver.m esh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); }588 #line 111 "mesh.yy" 589 { driver.m_mesh.Scale(vec3(0, 0, (yysemantic_stack_[(2) - (2)].args).f0)); } 602 590 break; 603 591 … … 605 593 606 594 /* Line 690 of lalr1.cc */ 607 #line 1 44"mesh.yy"608 { driver.m esh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }595 #line 112 "mesh.yy" 596 { driver.m_mesh.Scale(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 609 597 break; 610 598 … … 612 600 613 601 /* Line 690 of lalr1.cc */ 614 #line 1 45"mesh.yy"615 { driver.m esh.MirrorX(); }602 #line 113 "mesh.yy" 603 { driver.m_mesh.MirrorX(); } 616 604 break; 617 605 … … 619 607 620 608 /* Line 690 of lalr1.cc */ 621 #line 1 46"mesh.yy"622 { driver.m esh.MirrorY(); }609 #line 114 "mesh.yy" 610 { driver.m_mesh.MirrorY(); } 623 611 break; 624 612 … … 626 614 627 615 /* Line 690 of lalr1.cc */ 628 #line 1 47"mesh.yy"629 { driver.m esh.MirrorZ(); }616 #line 115 "mesh.yy" 617 { driver.m_mesh.MirrorZ(); } 630 618 break; 631 619 … … 633 621 634 622 /* Line 690 of lalr1.cc */ 635 #line 1 51"mesh.yy"636 { driver.m esh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,623 #line 119 "mesh.yy" 624 { driver.m_mesh.AppendCylinder((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 637 625 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, 638 626 (int)(yysemantic_stack_[(2) - (2)].args).f4, (int)(yysemantic_stack_[(2) - (2)].args).f5); } … … 642 630 643 631 /* Line 690 of lalr1.cc */ 644 #line 1 54"mesh.yy"645 { driver.m esh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); }632 #line 122 "mesh.yy" 633 { driver.m_mesh.AppendBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2)); } 646 634 break; 647 635 … … 649 637 650 638 /* Line 690 of lalr1.cc */ 651 #line 1 55"mesh.yy"652 { driver.m esh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,639 #line 123 "mesh.yy" 640 { driver.m_mesh.AppendSmoothChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 653 641 (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } 654 642 break; … … 657 645 658 646 /* Line 690 of lalr1.cc */ 659 #line 1 57"mesh.yy"660 { driver.m esh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,647 #line 125 "mesh.yy" 648 { driver.m_mesh.AppendFlatChamfBox(vec3((yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 661 649 (yysemantic_stack_[(2) - (2)].args).f2), (yysemantic_stack_[(2) - (2)].args).f3); } 662 650 break; … … 665 653 666 654 /* Line 690 of lalr1.cc */ 667 #line 1 59"mesh.yy"668 { driver.m esh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0,655 #line 127 "mesh.yy" 656 { driver.m_mesh.AppendSphere((yysemantic_stack_[(2) - (2)].args).f0, 669 657 vec3((yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3)); } 670 658 break; … … 673 661 674 662 /* Line 690 of lalr1.cc */ 675 #line 1 61"mesh.yy"676 { driver.m esh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2,663 #line 129 "mesh.yy" 664 { driver.m_mesh.AppendStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, 677 665 (int)(yysemantic_stack_[(2) - (2)].args).f3, (int)(yysemantic_stack_[(2) - (2)].args).f4); } 678 666 break; … … 681 669 682 670 /* Line 690 of lalr1.cc */ 683 #line 1 63"mesh.yy"684 { driver.m esh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1,671 #line 131 "mesh.yy" 672 { driver.m_mesh.AppendExpandedStar((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, 685 673 (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3); } 686 674 break; … … 689 677 690 678 /* Line 690 of lalr1.cc */ 691 #line 1 65"mesh.yy"692 { driver.m esh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); }679 #line 133 "mesh.yy" 680 { driver.m_mesh.AppendDisc((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (int)(yysemantic_stack_[(2) - (2)].args).f2); } 693 681 break; 694 682 … … 696 684 697 685 /* Line 690 of lalr1.cc */ 698 #line 1 66"mesh.yy"699 { driver.m esh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }686 #line 134 "mesh.yy" 687 { driver.m_mesh.AppendSimpleTriangle((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } 700 688 break; 701 689 … … 703 691 704 692 /* Line 690 of lalr1.cc */ 705 #line 1 67"mesh.yy"706 { driver.m esh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); }693 #line 135 "mesh.yy" 694 { driver.m_mesh.AppendSimpleQuad((yysemantic_stack_[(2) - (2)].args).f0, (int)(yysemantic_stack_[(2) - (2)].args).f1); } 707 695 break; 708 696 … … 710 698 711 699 /* Line 690 of lalr1.cc */ 712 #line 1 68"mesh.yy"713 { driver.m esh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3,700 #line 136 "mesh.yy" 701 { driver.m_mesh.AppendCog((int)(yysemantic_stack_[(2) - (2)].args).f0, (yysemantic_stack_[(2) - (2)].args).f1, (yysemantic_stack_[(2) - (2)].args).f2, (yysemantic_stack_[(2) - (2)].args).f3, 714 702 (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); } 715 703 break; … … 718 706 719 707 /* Line 690 of lalr1.cc */ 720 #line 1 72"mesh.yy"708 #line 140 "mesh.yy" 721 709 { (yyval.args).f0 = (yysemantic_stack_[(1) - (1)].fval); } 722 710 break; … … 725 713 726 714 /* Line 690 of lalr1.cc */ 727 #line 1 73"mesh.yy"715 #line 141 "mesh.yy" 728 716 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f1 = (yysemantic_stack_[(3) - (3)].fval); } 729 717 break; … … 732 720 733 721 /* Line 690 of lalr1.cc */ 734 #line 1 74"mesh.yy"722 #line 142 "mesh.yy" 735 723 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f2 = (yysemantic_stack_[(3) - (3)].fval); } 736 724 break; … … 739 727 740 728 /* Line 690 of lalr1.cc */ 741 #line 1 75"mesh.yy"729 #line 143 "mesh.yy" 742 730 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f3 = (yysemantic_stack_[(3) - (3)].fval); } 743 731 break; … … 746 734 747 735 /* Line 690 of lalr1.cc */ 748 #line 1 76"mesh.yy"736 #line 144 "mesh.yy" 749 737 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f4 = (yysemantic_stack_[(3) - (3)].fval); } 750 738 break; … … 753 741 754 742 /* Line 690 of lalr1.cc */ 755 #line 1 77"mesh.yy"743 #line 145 "mesh.yy" 756 744 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f5 = (yysemantic_stack_[(3) - (3)].fval); } 757 745 break; … … 760 748 761 749 /* Line 690 of lalr1.cc */ 762 #line 1 78"mesh.yy"750 #line 146 "mesh.yy" 763 751 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f6 = (yysemantic_stack_[(3) - (3)].fval); } 764 752 break; … … 767 755 768 756 /* Line 690 of lalr1.cc */ 769 #line 1 79"mesh.yy"757 #line 147 "mesh.yy" 770 758 { (yyval.args) = (yysemantic_stack_[(3) - (1)].args); (yyval.args).f7 = (yysemantic_stack_[(3) - (3)].fval); } 771 759 break; … … 774 762 775 763 /* Line 690 of lalr1.cc */ 776 #line 1 82"mesh.yy"764 #line 150 "mesh.yy" 777 765 { (yyval.fval) = (yysemantic_stack_[(1) - (1)].fval); } 778 766 break; … … 781 769 782 770 /* Line 690 of lalr1.cc */ 783 #line 1 83"mesh.yy"771 #line 151 "mesh.yy" 784 772 { (yyval.fval) = -(yysemantic_stack_[(2) - (2)].fval); } 785 773 break; … … 788 776 789 777 /* Line 690 of lalr1.cc */ 790 #line 7 91"generated/mesh-parser.cpp"778 #line 779 "generated/mesh-parser.cpp" 791 779 default: 792 780 break; … … 1258 1246 MeshParser::yyrline_[] = 1259 1247 { 1260 0, 104, 104, 108, 109, 113, 114, 115, 116, 120,1261 121, 122, 126, 127, 131, 132, 133, 134, 135, 136,1262 1 37, 138, 139, 140, 141, 142, 143, 144, 145, 146,1263 1 47, 151, 154, 155, 157, 159, 161, 163, 165, 166,1264 1 67, 168, 172, 173, 174, 175, 176, 177, 178, 179,1265 1 82, 1831248 0, 72, 72, 76, 77, 81, 82, 83, 84, 88, 1249 89, 90, 94, 95, 99, 100, 101, 102, 103, 104, 1250 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 1251 115, 119, 122, 123, 125, 127, 129, 131, 133, 134, 1252 135, 136, 140, 141, 142, 143, 144, 145, 146, 147, 1253 150, 151 1266 1254 }; 1267 1255 … … 1356 1344 1357 1345 /* Line 1136 of lalr1.cc */ 1358 #line 13 59"generated/mesh-parser.cpp"1346 #line 1347 "generated/mesh-parser.cpp" 1359 1347 1360 1348 1361 1349 /* Line 1138 of lalr1.cc */ 1362 #line 1 86"mesh.yy"1363 /*** Additional Code ***/ 1350 #line 154 "mesh.yy" 1351 1364 1352 1365 1353 void orbital::MeshParser::error(const MeshParser::location_type& l, 1366 1354 const std::string& m) 1367 1355 { 1368 driver. error(l, m);1356 driver.Error(l, m); 1369 1357 } 1370 1358 1359 -
trunk/orbital/generated/mesh-parser.h
r1418 r1419 77 77 78 78 /* Line 35 of lalr1.cc */ 79 #line 63"mesh.yy"79 #line 35 "mesh.yy" 80 80 81 81 float fval; -
trunk/orbital/generated/mesh-scanner.cpp
r1418 r1419 6 6 7 7 /* A lexical scanner generated by flex */ 8 9 /* %not-for-header */10 11 /* %if-c-only */12 /* %if-not-reentrant */13 /* %endif */14 /* %endif */15 /* %ok-for-header */16 8 17 9 #define FLEX_SCANNER … … 23 15 #endif 24 16 25 /* %if-c++-only */26 17 /* The c++ scanner is a mess. The FlexLexer.h header file relies on the 27 18 * following macro. This is required in order to pass the c++-multiple-scanners … … 31 22 */ 32 23 #define yyFlexLexer MeshFlexLexer 33 /* %endif */34 35 /* %if-c-only */36 /* %endif */37 38 /* %if-c-only */39 /* %endif */40 24 41 25 /* First, we deal with platform-specific or compiler-specific issues. */ 42 26 43 27 /* begin standard C headers. */ 44 /* %if-c-only */ 45 /* %endif */ 46 47 /* %if-tables-serialization */ 48 /* %endif */ 28 49 29 /* end standard C headers. */ 50 30 51 /* %if-c-or-c++ */52 31 /* flex integer type definitions */ 53 32 … … 114 93 #endif /* ! FLEXINT_H */ 115 94 116 /* %endif */117 118 /* %if-c++-only */119 95 /* begin standard C++ headers. */ 120 96 #include <iostream> … … 124 100 #include <cstring> 125 101 /* end standard C++ headers. */ 126 /* %endif */127 102 128 103 #ifdef __cplusplus … … 147 122 #endif 148 123 149 /* %not-for-header */150 151 124 /* Returned upon end-of-file. */ 152 125 #define YY_NULL 0 153 /* %ok-for-header */154 155 /* %not-for-header */156 126 157 127 /* Promotes a possibly negative, possibly signed char to an unsigned … … 161 131 */ 162 132 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 163 /* %ok-for-header */164 165 /* %if-reentrant */166 /* %endif */167 168 /* %if-not-reentrant */169 170 /* %endif */171 133 172 134 /* Enter a start condition. This macro really ought to take a parameter, … … 213 175 #endif 214 176 215 /* %if-not-reentrant */216 177 extern int yyleng; 217 /* %endif */218 219 /* %if-c-only */220 /* %if-not-reentrant */221 /* %endif */222 /* %endif */223 178 224 179 #define EOB_ACT_CONTINUE_SCAN 0 … … 253 208 struct yy_buffer_state 254 209 { 255 /* %if-c-only */ 256 /* %endif */ 257 258 /* %if-c++-only */ 210 259 211 std::istream* yy_input_file; 260 /* %endif */261 212 262 213 char *yy_ch_buf; /* input buffer */ … … 319 270 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 320 271 321 /* %if-c-only Standard (non-C++) definition */322 /* %not-for-header */323 324 /* %if-not-reentrant */325 /* %endif */326 /* %ok-for-header */327 328 /* %endif */329 330 272 /* We provide macros for accessing buffer states in case in the 331 273 * future we want to put the buffer states in a more general … … 342 284 */ 343 285 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 344 345 /* %if-c-only Standard (non-C++) definition */346 /* %if-not-reentrant */347 /* %not-for-header */348 349 /* %ok-for-header */350 351 /* %endif */352 /* %endif */353 286 354 287 void *Meshalloc (yy_size_t ); … … 380 313 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 381 314 382 /* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */383 315 /* Begin user sect3 */ 384 316 385 #define FLEX_DEBUG386 387 317 typedef unsigned char YY_CHAR; 388 318 … … 390 320 391 321 #include <FlexLexer.h> 392 393 /* %if-c-only Standard (non-C++) definition */394 /* %endif */395 322 396 323 /* Done after the current pattern has been matched and before the … … 399 326 #define YY_DO_BEFORE_ACTION \ 400 327 (yytext_ptr) = yy_bp; \ 401 /* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\402 328 yyleng = (size_t) (yy_cp - yy_bp); \ 403 329 (yy_hold_char) = *yy_cp; \ 404 330 *yy_cp = '\0'; \ 405 /* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\406 331 (yy_c_buf_p) = yy_cp; 407 332 408 /* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */409 333 #define YY_NUM_RULES 38 410 334 #define YY_END_OF_BUFFER 39 … … 522 446 } ; 523 447 524 static yyconst flex_int16_t yy_rule_linenum[38] =525 { 0,526 61, 62, 63, 65, 66, 68, 69, 70, 71, 72,527 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,528 83, 84, 86, 87, 88, 89, 90, 91, 92, 93,529 94, 95, 96, 98, 100, 101, 102530 } ;531 532 448 /* The intent behind this definition is that it'll catch 533 449 * any uses of REJECT which flex missed. … … 537 453 #define YY_MORE_ADJ 0 538 454 #define YY_RESTORE_YY_MORE_OFFSET 539 #line 1 "mesh.ll" 540 /* $Id: scanner.ll 44 2008-10-23 09:03:19Z tb $ -*- mode: c++ -*- */ 541 /** \file scanner.ll Define the orbital Flex lexical scanner */ 542 #line 5 "mesh.ll" 543 544 #include <string> 455 #line 1 "mesh.l" 456 #line 2 "mesh.l" 457 // 458 // Orbital 459 // 460 // Copyright: (c) 2012 Various People 461 // 545 462 546 463 #include "mesh-scanner.h" 547 464 548 /* import the parser's token type into a local typedef */549 465 typedef orbital::MeshParser::token token; 550 466 typedef orbital::MeshParser::token_type token_type; 551 467 552 /* By default yylex returns int, we use token_type. Unfortunately yyterminate553 * by default returns 0, which is not of token_type. */554 468 #define yyterminate() return token::T_END 555 556 /* This disables inclusion of unistd.h, which is not available under Visual C++557 * on Win32. The C++ scanner uses STL streams instead. */558 469 #define YY_NO_UNISTD_H 559 560 /*** Flex Declarations and Options ***/ 561 /* enable c++ scanner class generation */ 562 /* change the name of the scanner class. results in "MeshFlexLexer" */ 563 /* the manual says "somewhat more optimized" */ 564 /* enable scanner to generate debug output. disable this for release 565 * versions. */ 566 /* no support for include files is planned */ 567 /* enables the use of start condition stacks */ 568 /* The following paragraph suffices to track locations accurately. Each time 569 * yylex is invoked, the begin position is moved onto the end position. */ 570 #line 48 "mesh.ll" 571 #define YY_USER_ACTION yylloc->columns(yyleng); 572 #line 573 "generated/mesh-scanner.cpp" 470 #define YY_USER_ACTION yylloc->columns(yyleng); 471 #line 472 "generated/mesh-scanner.cpp" 573 472 574 473 #define INITIAL 0 … … 579 478 * The user has a chance to override it with an option. 580 479 */ 581 /* %if-c-only */582 /* %endif */583 /* %if-c++-only */584 480 #include <unistd.h> 585 /* %endif */586 481 #endif 587 482 … … 590 485 #endif 591 486 592 /* %if-c-only Reentrant structure and macros (non-C++). */593 /* %if-reentrant */594 /* %if-c-only */595 /* %endif */596 /* %if-reentrant */597 /* %endif */598 /* %endif End reentrant structures and macros. */599 /* %if-bison-bridge */600 /* %endif */601 /* %not-for-header */602 603 /* %ok-for-header */604 605 /* %endif */606 607 487 #ifndef yytext_ptr 608 488 static void yy_flex_strncpy (char *,yyconst char *,int ); … … 614 494 615 495 #ifndef YY_NO_INPUT 616 /* %if-c-only Standard (non-C++) definition */ 617 /* %not-for-header */ 618 619 /* %ok-for-header */ 620 621 /* %endif */ 622 #endif 623 624 /* %if-c-only */ 625 /* %endif */ 496 497 #endif 626 498 627 499 /* Amount of stuff to slurp up with each read. */ … … 637 509 /* Copy whatever the last rule matched to the standard output. */ 638 510 #ifndef ECHO 639 /* %if-c-only Standard (non-C++) definition */640 /* %endif */641 /* %if-c++-only C++ definition */642 511 #define ECHO LexerOutput( yytext, yyleng ) 643 /* %endif */644 512 #endif 645 513 … … 649 517 #ifndef YY_INPUT 650 518 #define YY_INPUT(buf,result,max_size) \ 651 /* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\652 519 \ 653 /* %if-c++-only C++ definition \ */\654 520 if ( (result = LexerInput( (char *) buf, max_size )) < 0 ) \ 655 521 YY_FATAL_ERROR( "input in flex scanner failed" ); 656 /* %endif */657 522 658 523 #endif … … 673 538 /* Report a fatal error. */ 674 539 #ifndef YY_FATAL_ERROR 675 /* %if-c-only */676 /* %endif */677 /* %if-c++-only */678 540 #define YY_FATAL_ERROR(msg) LexerError( msg ) 679 /* %endif */ 680 #endif 681 682 /* %if-tables-serialization structures and prototypes */ 683 /* %not-for-header */ 684 685 /* %ok-for-header */ 686 687 /* %not-for-header */ 688 689 /* %tables-yydmap generated elements */ 690 /* %endif */ 541 #endif 542 691 543 /* end tables serialization structures and prototypes */ 692 693 /* %ok-for-header */694 544 695 545 /* Default declaration of generated scanner - a define so the user can … … 698 548 #ifndef YY_DECL 699 549 #define YY_DECL_IS_OURS 1 700 /* %if-c-only Standard (non-C++) definition */701 /* %endif */702 /* %if-c++-only C++ definition */703 550 #define YY_DECL int yyFlexLexer::yylex() 704 /* %endif */705 551 #endif /* !YY_DECL */ 706 552 … … 717 563 #endif 718 564 719 /* %% [6.0] YY_RULE_SETUP definition goes here */720 565 #define YY_RULE_SETUP \ 721 566 YY_USER_ACTION 722 723 /* %not-for-header */724 567 725 568 /** The main scanner function which does all the work. … … 731 574 register int yy_act; 732 575 733 /* %% [7.0] user's declarations go here */ 734 #line 51 "mesh.ll" 735 736 737 /* code to place at the beginning of yylex() */ 738 739 // reset location 576 #line 21 "mesh.l" 577 578 579 580 /* reset location at the beginning of yylex() */ 740 581 yylloc->step(); 741 582 742 583 743 /*** BEGIN EXAMPLE - Change the orbital lexer rules below ***/ 744 745 #line 746 "generated/mesh-scanner.cpp" 584 #line 585 "generated/mesh-scanner.cpp" 746 585 747 586 if ( !(yy_init) ) … … 757 596 758 597 if ( ! yyin ) 759 /* %if-c-only */760 /* %endif */761 /* %if-c++-only */762 598 yyin = & std::cin; 763 /* %endif */764 599 765 600 if ( ! yyout ) 766 /* %if-c-only */767 /* %endif */768 /* %if-c++-only */769 601 yyout = & std::cout; 770 /* %endif */771 602 772 603 if ( ! YY_CURRENT_BUFFER ) { … … 781 612 while ( 1 ) /* loops until end-of-file is reached */ 782 613 { 783 /* %% [8.0] yymore()-related code goes here */784 614 yy_cp = (yy_c_buf_p); 785 615 … … 792 622 yy_bp = yy_cp; 793 623 794 /* %% [9.0] code to set up and find next match goes here */795 624 yy_current_state = (yy_start); 796 625 yy_match: … … 817 646 818 647 yy_find_action: 819 /* %% [10.0] code to find the action number goes here */820 648 yy_act = yy_accept[yy_current_state]; 821 649 822 650 YY_DO_BEFORE_ACTION; 823 651 824 /* %% [11.0] code for yylineno update goes here */825 826 652 do_action: /* This label is used only to access EOF actions. */ 827 828 /* %% [12.0] debug code goes here */829 if ( yy_flex_debug )830 {831 if ( yy_act == 0 )832 std::cerr << "--scanner backing up\n";833 else if ( yy_act < 38 )834 std::cerr << "--accepting rule at line " << yy_rule_linenum[yy_act] <<835 "(\"" << yytext << "\")\n";836 else if ( yy_act == 38 )837 std::cerr << "--accepting default rule (\"" << yytext << "\")\n";838 else if ( yy_act == 39 )839 std::cerr << "--(end of buffer or a NUL)\n";840 else841 std::cerr << "--EOF (start condition " << YY_START << ")\n";842 }843 653 844 654 switch ( yy_act ) 845 655 { /* beginning of action switch */ 846 /* %% [13.0] actions go here */847 656 case 0: /* must back up */ 848 657 /* undo the effects of YY_DO_BEFORE_ACTION */ … … 854 663 case 1: 855 664 YY_RULE_SETUP 856 #line 61 "mesh.ll"665 #line 28 "mesh.l" 857 666 { return token::T_FLUSH; } 858 667 YY_BREAK 859 668 case 2: 860 669 YY_RULE_SETUP 861 #line 62 "mesh.ll"670 #line 29 "mesh.l" 862 671 { return token::T_INITRB; } 863 672 YY_BREAK 864 673 case 3: 865 674 YY_RULE_SETUP 866 #line 63 "mesh.ll"675 #line 30 "mesh.l" 867 676 { return token::T_FREERB; } 868 677 YY_BREAK 869 678 case 4: 870 679 YY_RULE_SETUP 871 #line 65 "mesh.ll"680 #line 32 "mesh.l" 872 681 { return token::T_COLOR; } 873 682 YY_BREAK 874 683 case 5: 875 684 YY_RULE_SETUP 876 #line 66 "mesh.ll"685 #line 33 "mesh.l" 877 686 { return token::T_BGCOLOR; } 878 687 YY_BREAK 879 688 case 6: 880 689 YY_RULE_SETUP 881 #line 68 "mesh.ll"690 #line 35 "mesh.l" 882 691 { return token::T_TRANSLATEX; } 883 692 YY_BREAK 884 693 case 7: 885 694 YY_RULE_SETUP 886 #line 69 "mesh.ll"695 #line 36 "mesh.l" 887 696 { return token::T_TRANSLATEY; } 888 697 YY_BREAK 889 698 case 8: 890 699 YY_RULE_SETUP 891 #line 70 "mesh.ll"700 #line 37 "mesh.l" 892 701 { return token::T_TRANSLATEZ; } 893 702 YY_BREAK 894 703 case 9: 895 704 YY_RULE_SETUP 896 #line 71 "mesh.ll"705 #line 38 "mesh.l" 897 706 { return token::T_TRANSLATE; } 898 707 YY_BREAK 899 708 case 10: 900 709 YY_RULE_SETUP 901 #line 72 "mesh.ll"710 #line 39 "mesh.l" 902 711 { return token::T_ROTATEX; } 903 712 YY_BREAK 904 713 case 11: 905 714 YY_RULE_SETUP 906 #line 73 "mesh.ll"715 #line 40 "mesh.l" 907 716 { return token::T_ROTATEY; } 908 717 YY_BREAK 909 718 case 12: 910 719 YY_RULE_SETUP 911 #line 74 "mesh.ll"720 #line 41 "mesh.l" 912 721 { return token::T_ROTATEZ; } 913 722 YY_BREAK 914 723 case 13: 915 724 YY_RULE_SETUP 916 #line 75 "mesh.ll"725 #line 42 "mesh.l" 917 726 { return token::T_TAPERX; } 918 727 YY_BREAK 919 728 case 14: 920 729 YY_RULE_SETUP 921 #line 76 "mesh.ll"730 #line 43 "mesh.l" 922 731 { return token::T_TAPERY; } 923 732 YY_BREAK 924 733 case 15: 925 734 YY_RULE_SETUP 926 #line 77 "mesh.ll"735 #line 44 "mesh.l" 927 736 { return token::T_TAPERZ; } 928 737 YY_BREAK 929 738 case 16: 930 739 YY_RULE_SETUP 931 #line 78 "mesh.ll"740 #line 45 "mesh.l" 932 741 { return token::T_SCALEX; } 933 742 YY_BREAK 934 743 case 17: 935 744 YY_RULE_SETUP 936 #line 79 "mesh.ll"745 #line 46 "mesh.l" 937 746 { return token::T_SCALEY; } 938 747 YY_BREAK 939 748 case 18: 940 749 YY_RULE_SETUP 941 #line 80 "mesh.ll"750 #line 47 "mesh.l" 942 751 { return token::T_SCALEZ; } 943 752 YY_BREAK 944 753 case 19: 945 754 YY_RULE_SETUP 946 #line 81 "mesh.ll"755 #line 48 "mesh.l" 947 756 { return token::T_SCALE; } 948 757 YY_BREAK 949 758 case 20: 950 759 YY_RULE_SETUP 951 #line 82 "mesh.ll"760 #line 49 "mesh.l" 952 761 { return token::T_MIRRORX; } 953 762 YY_BREAK 954 763 case 21: 955 764 YY_RULE_SETUP 956 #line 83 "mesh.ll"765 #line 50 "mesh.l" 957 766 { return token::T_MIRRORY; } 958 767 YY_BREAK 959 768 case 22: 960 769 YY_RULE_SETUP 961 #line 84 "mesh.ll"770 #line 51 "mesh.l" 962 771 { return token::T_MIRRORZ; } 963 772 YY_BREAK 964 773 case 23: 965 774 YY_RULE_SETUP 966 #line 86 "mesh.ll"775 #line 53 "mesh.l" 967 776 { return token::T_CYLINDER; } 968 777 YY_BREAK 969 778 case 24: 970 779 YY_RULE_SETUP 971 #line 87 "mesh.ll"780 #line 54 "mesh.l" 972 781 { return token::T_BOX; } 973 782 YY_BREAK 974 783 case 25: 975 784 YY_RULE_SETUP 976 #line 88 "mesh.ll"785 #line 55 "mesh.l" 977 786 { return token::T_SMOOTHCHAMFBOX; } 978 787 YY_BREAK 979 788 case 26: 980 789 YY_RULE_SETUP 981 #line 89 "mesh.ll"790 #line 56 "mesh.l" 982 791 { return token::T_FLATCHAMFBOX; } 983 792 YY_BREAK 984 793 case 27: 985 794 YY_RULE_SETUP 986 #line 90 "mesh.ll"795 #line 57 "mesh.l" 987 796 { return token::T_SPHERE; } 988 797 YY_BREAK 989 798 case 28: 990 799 YY_RULE_SETUP 991 #line 91 "mesh.ll"800 #line 58 "mesh.l" 992 801 { return token::T_STAR; } 993 802 YY_BREAK 994 803 case 29: 995 804 YY_RULE_SETUP 996 #line 92 "mesh.ll"805 #line 59 "mesh.l" 997 806 { return token::T_EXPANDEDSTAR; } 998 807 YY_BREAK 999 808 case 30: 1000 809 YY_RULE_SETUP 1001 #line 93 "mesh.ll"810 #line 60 "mesh.l" 1002 811 { return token::T_DISC; } 1003 812 YY_BREAK 1004 813 case 31: 1005 814 YY_RULE_SETUP 1006 #line 94 "mesh.ll"815 #line 61 "mesh.l" 1007 816 { return token::T_TRIANGLE; } 1008 817 YY_BREAK 1009 818 case 32: 1010 819 YY_RULE_SETUP 1011 #line 95 "mesh.ll"820 #line 62 "mesh.l" 1012 821 { return token::T_QUAD; } 1013 822 YY_BREAK 1014 823 case 33: 1015 824 YY_RULE_SETUP 1016 #line 96 "mesh.ll"825 #line 63 "mesh.l" 1017 826 { return token::T_COG; } 1018 827 YY_BREAK 1019 828 case 34: 1020 829 YY_RULE_SETUP 1021 #line 98 "mesh.ll"1022 { 1023 830 #line 65 "mesh.l" 831 { 832 yylval->fval = atof(yytext); return token::NUMBER; } 1024 833 YY_BREAK 1025 834 case 35: 1026 835 YY_RULE_SETUP 1027 #line 100 "mesh.ll"836 #line 67 "mesh.l" 1028 837 { return token_type('-'); } 1029 838 YY_BREAK 1030 839 case 36: 1031 840 YY_RULE_SETUP 1032 #line 101 "mesh.ll"841 #line 68 "mesh.l" 1033 842 { return token_type(','); } 1034 843 YY_BREAK … … 1036 845 /* rule 37 can match eol */ 1037 846 YY_RULE_SETUP 1038 #line 102 "mesh.ll"847 #line 69 "mesh.l" 1039 848 { /* ignore everything else */ } 1040 849 YY_BREAK 1041 /*** END EXAMPLE - Change the orbital lexer rules above ***/1042 850 case 38: 1043 851 YY_RULE_SETUP 1044 #line 106 "mesh.ll"852 #line 71 "mesh.l" 1045 853 ECHO; 1046 854 YY_BREAK 1047 #line 1048"generated/mesh-scanner.cpp"855 #line 856 "generated/mesh-scanner.cpp" 1048 856 case YY_STATE_EOF(INITIAL): 1049 857 yyterminate(); … … 1112 920 else 1113 921 { 1114 /* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */1115 922 yy_cp = (yy_last_accepting_cpos); 1116 923 yy_current_state = (yy_last_accepting_state); … … 1179 986 } /* end of scanning one token */ 1180 987 } /* end of yylex */ 1181 /* %ok-for-header */1182 1183 /* %if-c++-only */1184 /* %not-for-header */1185 988 1186 989 /* The contents of this function are C++ specific, so the () macro is not used. … … 1272 1075 (void) yyout->write( buf, size ); 1273 1076 } 1274 /* %ok-for-header */1275 1276 /* %endif */1277 1077 1278 1078 /* yy_get_next_buffer - try to read in a new buffer … … 1283 1083 * EOB_ACT_END_OF_FILE - end of file 1284 1084 */ 1285 /* %if-c-only */1286 /* %endif */1287 /* %if-c++-only */1288 1085 int yyFlexLexer::yy_get_next_buffer() 1289 /* %endif */1290 1086 { 1291 1087 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; … … 1421 1217 /* yy_get_previous_state - get the state just before the EOB char was reached */ 1422 1218 1423 /* %if-c-only */1424 /* %not-for-header */1425 1426 /* %endif */1427 /* %if-c++-only */1428 1219 yy_state_type yyFlexLexer::yy_get_previous_state() 1429 /* %endif */1430 1220 { 1431 1221 register yy_state_type yy_current_state; 1432 1222 register char *yy_cp; 1433 1223 1434 /* %% [15.0] code to get the start state into yy_current_state goes here */1435 1224 yy_current_state = (yy_start); 1436 1225 1437 1226 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1438 1227 { 1439 /* %% [16.0] code to find the next state goes here */1440 1228 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1441 1229 if ( yy_accept[yy_current_state] ) … … 1461 1249 * next_state = yy_try_NUL_trans( current_state ); 1462 1250 */ 1463 /* %if-c-only */1464 /* %endif */1465 /* %if-c++-only */1466 1251 yy_state_type yyFlexLexer::yy_try_NUL_trans( yy_state_type yy_current_state ) 1467 /* %endif */1468 1252 { 1469 1253 register int yy_is_jam; 1470 /* %% [17.0] code to find the next state, and perhaps do backing up, goes here */ 1471 register char *yy_cp = (yy_c_buf_p); 1254 register char *yy_cp = (yy_c_buf_p); 1472 1255 1473 1256 register YY_CHAR yy_c = 1; … … 1489 1272 } 1490 1273 1491 /* %if-c-only */1492 /* %endif */1493 /* %if-c++-only */1494 1274 void yyFlexLexer::yyunput( int c, register char* yy_bp) 1495 /* %endif */1496 1275 { 1497 1276 register char *yy_cp; … … 1525 1304 *--yy_cp = (char) c; 1526 1305 1527 /* %% [18.0] update yylineno here */1528 1529 1306 (yytext_ptr) = yy_bp; 1530 1307 (yy_hold_char) = *yy_cp; 1531 1308 (yy_c_buf_p) = yy_cp; 1532 1309 } 1533 /* %if-c-only */ 1534 /* %endif */ 1535 1536 /* %if-c-only */ 1537 /* %endif */ 1538 /* %if-c++-only */ 1310 1539 1311 int yyFlexLexer::yyinput() 1540 /* %endif */1541 1312 { 1542 1313 int c; … … 1602 1373 (yy_hold_char) = *++(yy_c_buf_p); 1603 1374 1604 /* %% [19.0] update BOL and yylineno */1605 1606 1375 return c; 1607 1376 } 1608 /* %if-c-only */1609 /* %endif */1610 1377 1611 1378 /** Immediately switch to a different input stream. … … 1614 1381 * @note This function does not reset the start condition to @c INITIAL . 1615 1382 */ 1616 /* %if-c-only */1617 /* %endif */1618 /* %if-c++-only */1619 1383 void yyFlexLexer::yyrestart( std::istream* input_file ) 1620 /* %endif */1621 1384 { 1622 1385 … … 1635 1398 * 1636 1399 */ 1637 /* %if-c-only */1638 /* %endif */1639 /* %if-c++-only */1640 1400 void yyFlexLexer::yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) 1641 /* %endif */1642 1401 { 1643 1402 … … 1670 1429 } 1671 1430 1672 /* %if-c-only */1673 /* %endif */1674 /* %if-c++-only */1675 1431 void yyFlexLexer::yy_load_buffer_state() 1676 /* %endif */1677 1432 { 1678 1433 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; … … 1688 1443 * @return the allocated buffer state. 1689 1444 */ 1690 /* %if-c-only */1691 /* %endif */1692 /* %if-c++-only */1693 1445 YY_BUFFER_STATE yyFlexLexer::yy_create_buffer( std::istream* file, int size ) 1694 /* %endif */1695 1446 { 1696 1447 YY_BUFFER_STATE b; … … 1720 1471 * 1721 1472 */ 1722 /* %if-c-only */1723 /* %endif */1724 /* %if-c++-only */1725 1473 void yyFlexLexer::yy_delete_buffer( YY_BUFFER_STATE b ) 1726 /* %endif */1727 1474 { 1728 1475 … … 1739 1486 } 1740 1487 1741 /* %if-c-only */1742 /* %endif */1743 1744 /* %if-c++-only */1745 1746 1488 extern "C" int isatty (int ); 1747 1748 /* %endif */1749 1489 1750 1490 /* Initializes or reinitializes a buffer. … … 1752 1492 * such as during a yyrestart() or at EOF. 1753 1493 */ 1754 /* %if-c-only */1755 /* %endif */1756 /* %if-c++-only */1757 1494 void yyFlexLexer::yy_init_buffer( YY_BUFFER_STATE b, std::istream* file ) 1758 /* %endif */1759 1495 1760 1496 { … … 1775 1511 } 1776 1512 1777 /* %if-c-only */1778 /* %endif */1779 /* %if-c++-only */1780 1513 b->yy_is_interactive = 0; 1781 /* %endif */1782 1514 errno = oerrno; 1783 1515 } … … 1787 1519 * 1788 1520 */ 1789 /* %if-c-only */1790 /* %endif */1791 /* %if-c++-only */1792 1521 void yyFlexLexer::yy_flush_buffer( YY_BUFFER_STATE b ) 1793 /* %endif */1794 1522 { 1795 1523 if ( ! b ) … … 1814 1542 } 1815 1543 1816 /* %if-c-or-c++ */1817 1544 /** Pushes the new state onto the stack. The new state becomes 1818 1545 * the current state. This function will allocate the stack … … 1821 1548 * 1822 1549 */ 1823 /* %if-c-only */1824 /* %endif */1825 /* %if-c++-only */1826 1550 void yyFlexLexer::yypush_buffer_state (YY_BUFFER_STATE new_buffer) 1827 /* %endif */1828 1551 { 1829 1552 if (new_buffer == NULL) … … 1850 1573 (yy_did_buffer_switch_on_eof) = 1; 1851 1574 } 1852 /* %endif */ 1853 1854 /* %if-c-or-c++ */ 1575 1855 1576 /** Removes and deletes the top of the stack, if present. 1856 1577 * The next element becomes the new top. 1857 1578 * 1858 1579 */ 1859 /* %if-c-only */1860 /* %endif */1861 /* %if-c++-only */1862 1580 void yyFlexLexer::yypop_buffer_state (void) 1863 /* %endif */1864 1581 { 1865 1582 if (!YY_CURRENT_BUFFER) … … 1876 1593 } 1877 1594 } 1878 /* %endif */ 1879 1880 /* %if-c-or-c++ */ 1595 1881 1596 /* Allocates the stack if it does not exist. 1882 1597 * Guarantees space for at least one push. 1883 1598 */ 1884 /* %if-c-only */1885 /* %endif */1886 /* %if-c++-only */1887 1599 void yyFlexLexer::yyensure_buffer_stack(void) 1888 /* %endif */1889 1600 { 1890 1601 int num_to_alloc; … … 1928 1639 } 1929 1640 } 1930 /* %endif */ 1931 1932 /* %if-c-only */ 1933 /* %endif */ 1934 1935 /* %if-c-only */ 1936 /* %endif */ 1937 1938 /* %if-c-only */ 1939 /* %endif */ 1940 1941 /* %if-c-only */ 1942 /* %endif */ 1943 /* %if-c++-only */ 1641 1944 1642 void yyFlexLexer::yy_push_state( int new_state ) 1945 /* %endif */1946 1643 { 1947 1644 if ( (yy_start_stack_ptr) >= (yy_start_stack_depth) ) … … 1967 1664 } 1968 1665 1969 /* %if-c-only */1970 /* %endif */1971 /* %if-c++-only */1972 1666 void yyFlexLexer::yy_pop_state() 1973 /* %endif */1974 1667 { 1975 1668 if ( --(yy_start_stack_ptr) < 0 ) … … 1979 1672 } 1980 1673 1981 /* %if-c-only */1982 /* %endif */1983 /* %if-c++-only */1984 1674 int yyFlexLexer::yy_top_state() 1985 /* %endif */1986 1675 { 1987 1676 return (yy_start_stack)[(yy_start_stack_ptr) - 1]; … … 1992 1681 #endif 1993 1682 1994 /* %if-c-only */1995 /* %endif */1996 /* %if-c++-only */1997 1683 void yyFlexLexer::LexerError( yyconst char msg[] ) 1998 1684 { … … 2000 1686 exit( YY_EXIT_FAILURE ); 2001 1687 } 2002 /* %endif */2003 1688 2004 1689 /* Redefine yyless() so it works in section 3 code. */ … … 2021 1706 /* Accessor methods (get/set functions) to struct members. */ 2022 1707 2023 /* %if-c-only */2024 /* %if-reentrant */2025 /* %endif */2026 /* %if-reentrant */2027 /* %endif */2028 /* %endif */2029 2030 /* %if-reentrant */2031 /* %if-bison-bridge */2032 /* %endif */2033 /* %endif if-c-only */2034 2035 /* %if-c-only */2036 /* %endif */2037 2038 /* %if-c-only SNIP! this currently causes conflicts with the c++ scanner */2039 /* %if-reentrant */2040 /* %endif */2041 /* %endif */2042 2043 1708 /* 2044 1709 * Internal utility routines. … … 2087 1752 } 2088 1753 2089 /* %if-tables-serialization definitions */2090 /* %define-yytables The name for this specific scanner's tables. */2091 1754 #define YYTABLES_NAME "yytables" 2092 /* %endif */ 2093 2094 /* %ok-for-header */ 2095 2096 #line 106 "mesh.ll" 2097 2098 2099 2100 namespace orbital { 2101 2102 Scanner::Scanner(std::istream* in, 2103 std::ostream* out) 2104 : MeshFlexLexer(in, out) 2105 { 2106 } 2107 2108 Scanner::~Scanner() 2109 { 2110 } 2111 2112 void Scanner::set_debug(bool b) 2113 { 2114 yy_flex_debug = b; 2115 } 2116 2117 } 2118 2119 /* This implementation of MeshFlexLexer::yylex() is required to fill the 2120 * vtable of the class MeshFlexLexer. We define the scanner's main yylex 2121 * function via YY_DECL to reside in the Scanner class instead. */ 1755 1756 #line 71 "mesh.l" 1757 1758 1759 1760 orbital::Scanner::Scanner(char const *command) 1761 : MeshFlexLexer(0, 0), 1762 m_input(command) 1763 { 1764 } 1765 1766 orbital::Scanner::~Scanner() 1767 { 1768 } 1769 1770 int orbital::Scanner::LexerInput(char* buf, int max_size) 1771 { 1772 buf[0] = m_input[0]; 1773 if (buf[0]) 1774 ++m_input; 1775 return buf[0] ? 1 : 0; 1776 } 2122 1777 2123 1778 #ifdef yylex 2124 1779 #undef yylex 2125 1780 #endif 2126 2127 1781 int MeshFlexLexer::yylex() 2128 1782 { … … 2131 1785 } 2132 1786 2133 /* When the scanner receives an end-of-file indication from YY_INPUT, it then2134 * checks the yywrap() function. If yywrap() returns false (zero), then it is2135 * assumed that the function has gone ahead and set up `yyin' to point to2136 * another input file, and scanning continues. If it returns true (non-zero),2137 * then the scanner terminates, returning 0 to its caller. */2138 2139 1787 int MeshFlexLexer::yywrap() 2140 1788 { … … 2142 1790 } 2143 1791 1792 -
trunk/orbital/mesh-driver.cpp
r1418 r1419 11 11 12 12 Driver::Driver(Mesh &mesh) 13 : trace_scanning(false), 14 trace_parsing(false), 15 mesh(mesh) 13 : m_mesh(mesh) 16 14 { 17 15 } 18 16 19 bool Driver:: parse_stream(std::istream& in, const std::string& sname)17 bool Driver::ParseString(char const *command) 20 18 { 21 streamname = sname; 22 23 Scanner scanner(&in); 24 scanner.set_debug(trace_scanning); 25 this->lexer = &scanner; 26 19 Scanner scanner(command); 20 m_lexer = &scanner; 27 21 MeshParser parser(*this); 28 parser.set_debug_level(trace_parsing);29 22 return (parser.parse() == 0); 30 23 } 31 24 32 bool Driver::parse_file(const std::string &filename) 33 { 34 std::ifstream in(filename.c_str()); 35 if (!in.good()) return false; 36 return parse_stream(in, filename); 37 } 38 39 bool Driver::parse_string(const std::string &input, const std::string& sname) 40 { 41 std::istringstream iss(input); 42 return parse_stream(iss, sname); 43 } 44 45 void Driver::error(const class location& l, 46 const std::string& m) 25 void Driver::Error(const class location& l, const std::string& m) 47 26 { 48 27 std::cerr << l << ": " << m << std::endl; 49 28 } 50 29 51 void Driver:: error(const std::string& m)30 void Driver::Error(const std::string& m) 52 31 { 53 32 std::cerr << m << std::endl; -
trunk/orbital/mesh-driver.h
r1418 r1419 1 // $Id: driver.h 17 2007-08-19 18:51:39Z tb $ 2 /** \file driver.h Declaration of the orbital::Driver class. */ 1 // 2 // Orbital 3 // 4 // Copyright: (c) 2012 Various People 5 // 3 6 4 7 #ifndef EXAMPLE_DRIVER_H … … 6 9 7 10 #include <string> 8 #include <vector>9 11 10 // forward declaration 11 class CalcContext; 12 class Mesh; 12 13 13 /** The example namespace is used to encapsulate the three parser classes14 * orbital::Parser, orbital::Scanner and orbital::Driver */15 14 namespace orbital { 16 15 17 /** The Driver class brings together all components. It creates an instance of18 * the Parser and Scanner classes and connects them. Then the input stream is19 * fed into the scanner object and the parser gets it's token20 * sequence. Furthermore the driver object is available in the grammar rules as21 * a parameter. Therefore the driver class contains a reference to the22 * structure into which the parsed data is saved. */23 16 class Driver 24 17 { 25 18 public: 26 /// construct a new parser driver context27 19 Driver(class Mesh &mesh); 28 20 29 /// enable debug output in the flex scanner 30 bool trace_scanning; 21 bool ParseString(char const *command); 31 22 32 /// enable debug output in the bison parser33 bool trace_parsing;23 void Error(const class location& l, const std::string& m); 24 void Error(const std::string& m); 34 25 35 /// stream name (file or input stream) used for error messages. 36 std::string streamname; 37 38 /** Invoke the scanner and parser for a stream. 39 * @param in input stream 40 * @param sname stream name for error messages 41 * @return true if successfully parsed 42 */ 43 bool parse_stream(std::istream& in, 44 const std::string& sname = "stream input"); 45 46 /** Invoke the scanner and parser on an input string. 47 * @param input input string 48 * @param sname stream name for error messages 49 * @return true if successfully parsed 50 */ 51 bool parse_string(const std::string& input, 52 const std::string& sname = "string stream"); 53 54 /** Invoke the scanner and parser on a file. Use parse_stream with a 55 * std::ifstream if detection of file reading errors is required. 56 * @param filename input file name 57 * @return true if successfully parsed 58 */ 59 bool parse_file(const std::string& filename); 60 61 // To demonstrate pure handling of parse errors, instead of 62 // simply dumping them on the standard error output, we will pass 63 // them to the driver using the following two member functions. 64 65 /** Error handling with associated line number. This can be modified to 66 * output the error e.g. to a dialog box. */ 67 void error(const class location& l, const std::string& m); 68 69 /** General error handling. This can be modified to output the error 70 * e.g. to a dialog box. */ 71 void error(const std::string& m); 72 73 /** Pointer to the current lexer instance, this is used to connect the 74 * parser to the scanner. It is used in the yylex macro. */ 75 class Scanner* lexer; 76 77 class Mesh &mesh; 26 class Scanner* m_lexer; 27 class Mesh &m_mesh; 78 28 }; 79 29 80 } // namespace example30 } 81 31 82 #endif // EXAMPLE_DRIVER_H 32 #endif 33 -
trunk/orbital/mesh-scanner.h
r1418 r1419 1 // $Id: scanner.h 17 2007-08-19 18:51:39Z tb $ 1 // 2 // Orbital 3 // 4 // Copyright: (c) 2012 Various People 5 // 2 6 3 7 #ifndef EXAMPLE_SCANNER_H 4 8 #define EXAMPLE_SCANNER_H 5 9 6 // Flex expects the signature of yylex to be defined in the macro YY_DECL, and7 // the C++ parser expects it to be declared. We can factor both as follows.8 9 10 #ifndef YY_DECL 10 #define YY_DECL \ 11 orbital::MeshParser::token_type \ 11 # define YY_DECL orbital::MeshParser::token_type \ 12 12 orbital::Scanner::lex(orbital::MeshParser::semantic_type* yylval, \ 13 13 orbital::MeshParser::location_type* yylloc) … … 15 15 16 16 #ifndef __FLEX_LEXER_H 17 # define yyFlexLexer MeshFlexLexer18 # include "FlexLexer.h"19 # undef yyFlexLexer17 # define yyFlexLexer MeshFlexLexer 18 # include "FlexLexer.h" 19 # undef yyFlexLexer 20 20 #endif 21 21 … … 24 24 namespace orbital { 25 25 26 /** Scanner is a derived class to add some extra function to the scanner27 * class. Flex itself creates a class named yyFlexLexer, which is renamed using28 * macros to MeshFlexLexer. However we change the context of the generated29 * yylex() function to be contained within the Scanner class. This is required30 * because the yylex() defined in MeshFlexLexer has no parameters. */31 26 class Scanner : public MeshFlexLexer 32 27 { 33 28 public: 34 /** Create a new scanner object. The streams arg_yyin and arg_yyout default35 * to cin and cout, but that assignment is only made when initializing in36 * yylex(). */37 Scanner(std::istream* arg_yyin = 0,38 std::ostream* arg_yyout = 0);29 Scanner(char const *command); 30 virtual ~Scanner(); 31 virtual int LexerInput(char* buf, int max_size); 32 virtual MeshParser::token_type lex(MeshParser::semantic_type* yylval, 33 MeshParser::location_type* yylloc); 39 34 40 /** Required for virtual functions */ 41 virtual ~Scanner(); 42 43 /** This is the main lexing function. It is generated by flex according to 44 * the macro declaration YY_DECL above. The generated bison parser then 45 * calls this virtual function to fetch new tokens. */ 46 virtual MeshParser::token_type lex( 47 MeshParser::semantic_type* yylval, 48 MeshParser::location_type* yylloc 49 ); 50 51 /** Enable debug output (via arg_yyout) if compiled into the scanner. */ 52 void set_debug(bool b); 35 private: 36 char const *m_input; 53 37 }; 54 38 55 } // namespace orbital39 } 56 40 57 #endif // EXAMPLE_SCANNER_H 41 #endif 42 -
trunk/orbital/mesh.h
r1415 r1419 15 15 #define __MESH_H__ 16 16 17 #include <string>17 #include "mesh-driver.h" 18 18 19 19 class Mesh … … 25 25 {} 26 26 27 void SendCommand(char const *command); 27 void SendCommand(char const *command) 28 { 29 orbital::Driver driver(*this); 30 driver.ParseString(command); 31 } 28 32 29 33 void Flush() -
trunk/orbital/mesh.yy
r1418 r1419 1 /* $Id: parser.yy 48 2009-09-05 08:07:10Z tb $ -*- mode: c++ -*- */ 2 /** \file parser.yy Contains the example Bison parser source */ 1 %{ 2 // 3 // Orbital 4 // 5 // Copyright: (c) 2012 Various People 6 // 3 7 4 %{ /*** C/C++ Declarations ***/5 8 #if defined HAVE_CONFIG_H 6 9 # include "config.h" … … 17 20 #include <string> 18 21 #include <vector> 19 20 22 %} 21 23 22 /*** yacc/bison Declarations ***/23 24 /* Require bison 2.3 or later */25 24 %require "2.3" 26 27 /* add debug output code to generated parser. disable this for release28 * versions. */29 25 %debug 30 31 /* start symbol */32 %start mesh_description33 34 /* write out a header file containing the token defines */35 26 %defines 36 37 /* use newer C++ skeleton file */38 27 %skeleton "lalr1.cc" 39 40 /* namespace to enclose parser in */41 28 %name-prefix="orbital" 42 43 /* set the parser's class identifier */44 29 %define parser_class_name "MeshParser" 45 46 /* keep track of the current position within the input */47 30 %locations 48 %initial-action49 {50 // initialize the initial location object51 @$.begin.filename = @$.end.filename = &driver.streamname;52 };53 54 /* The driver is passed by reference to the parser and to the scanner. This55 * provides a simple but effective pure interface, not relying on global56 * variables. */57 31 %parse-param { class Driver& driver } 58 59 /* verbose error messages */60 32 %error-verbose 61 33 … … 65 37 struct { float f0, f1, f2, f3, f4, f5, f6, f7; } args; 66 38 } 39 40 %start mesh_description 67 41 68 42 %token T_FLUSH T_INITRB T_FREERB … … 83 57 84 58 %type <fval> number 85 86 59 %type <args> args1 args2 args3 args4 args5 args6 args7 args8 87 60 88 61 %{ 89 90 62 #include "mesh-driver.h" 91 63 #include "mesh-scanner.h" 92 64 93 /* this "connects" the bison parser in the driver to the flex scanner class94 * object. it defines the yylex() function call to pull the next token from the95 * current lexer object of the driver context. */96 65 #undef yylex 97 #define yylex driver.lexer->lex 98 66 #define yylex driver.m_lexer->lex 99 67 %} 100 68 101 %% /*** Grammar Rules ***/69 %% 102 70 103 71 mesh_description: … … 118 86 119 87 rb_command: 120 T_FLUSH { driver.m esh.Flush(); }121 | T_INITRB { driver.m esh.MeshConvert(); }88 T_FLUSH { driver.m_mesh.Flush(); } 89 | T_INITRB { driver.m_mesh.MeshConvert(); } 122 90 | T_FREERB { /* TODO */ } 123 91 ; 124 92 125 93 color_command: 126 T_COLOR args4 { driver.m esh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }127 | T_BGCOLOR args4 { driver.m esh.SetCurColor2(vec4($2.f0, $2.f1, $2.f2, $2.f3)); }94 T_COLOR args4 { driver.m_mesh.SetCurColor(vec4($2.f0, $2.f1, $2.f2, $2.f3)); } 95 | T_BGCOLOR args4 { driver.m_mesh.SetCurColor2(vec4($2.f0, $2.f1, $2.f2, $2.f3)); } 128 96 ; 129 97 130 98 transform_command: 131 T_TRANSLATEX args1 { driver.m esh.Translate(vec3($2.f0, 0, 0)); }132 | T_TRANSLATEY args1 { driver.m esh.Translate(vec3(0, $2.f0, 0)); }133 | T_TRANSLATEZ args1 { driver.m esh.Translate(vec3(0, 0, $2.f0)); }134 | T_TRANSLATE args3 { driver.m esh.Translate(vec3($2.f0, $2.f1, $2.f2)); }135 | T_ROTATEX args1 { driver.m esh.RotateX($2.f0); }136 | T_ROTATEY args1 { driver.m esh.RotateY($2.f0); }137 | T_ROTATEZ args1 { driver.m esh.RotateZ($2.f0); }138 | T_TAPERX args3 { driver.m esh.TaperX($2.f0, $2.f1, $2.f2); }139 | T_TAPERY args3 { driver.m esh.TaperY($2.f0, $2.f1, $2.f2); }140 | T_TAPERZ args3 { driver.m esh.TaperZ($2.f0, $2.f1, $2.f2); }141 | T_SCALEX args1 { driver.m esh.Scale(vec3($2.f0, 0, 0)); }142 | T_SCALEY args1 { driver.m esh.Scale(vec3(0, $2.f0, 0)); }143 | T_SCALEZ args1 { driver.m esh.Scale(vec3(0, 0, $2.f0)); }144 | T_SCALE args3 { driver.m esh.Scale(vec3($2.f0, $2.f1, $2.f2)); }145 | T_MIRRORX { driver.m esh.MirrorX(); }146 | T_MIRRORY { driver.m esh.MirrorY(); }147 | T_MIRRORZ { driver.m esh.MirrorZ(); }99 T_TRANSLATEX args1 { driver.m_mesh.Translate(vec3($2.f0, 0, 0)); } 100 | T_TRANSLATEY args1 { driver.m_mesh.Translate(vec3(0, $2.f0, 0)); } 101 | T_TRANSLATEZ args1 { driver.m_mesh.Translate(vec3(0, 0, $2.f0)); } 102 | T_TRANSLATE args3 { driver.m_mesh.Translate(vec3($2.f0, $2.f1, $2.f2)); } 103 | T_ROTATEX args1 { driver.m_mesh.RotateX($2.f0); } 104 | T_ROTATEY args1 { driver.m_mesh.RotateY($2.f0); } 105 | T_ROTATEZ args1 { driver.m_mesh.RotateZ($2.f0); } 106 | T_TAPERX args3 { driver.m_mesh.TaperX($2.f0, $2.f1, $2.f2); } 107 | T_TAPERY args3 { driver.m_mesh.TaperY($2.f0, $2.f1, $2.f2); } 108 | T_TAPERZ args3 { driver.m_mesh.TaperZ($2.f0, $2.f1, $2.f2); } 109 | T_SCALEX args1 { driver.m_mesh.Scale(vec3($2.f0, 0, 0)); } 110 | T_SCALEY args1 { driver.m_mesh.Scale(vec3(0, $2.f0, 0)); } 111 | T_SCALEZ args1 { driver.m_mesh.Scale(vec3(0, 0, $2.f0)); } 112 | T_SCALE args3 { driver.m_mesh.Scale(vec3($2.f0, $2.f1, $2.f2)); } 113 | T_MIRRORX { driver.m_mesh.MirrorX(); } 114 | T_MIRRORY { driver.m_mesh.MirrorY(); } 115 | T_MIRRORZ { driver.m_mesh.MirrorZ(); } 148 116 ; 149 117 150 118 primitive_command: 151 T_CYLINDER args6 { driver.m esh.AppendCylinder((int)$2.f0, $2.f1,119 T_CYLINDER args6 { driver.m_mesh.AppendCylinder((int)$2.f0, $2.f1, 152 120 $2.f2, $2.f3, 153 121 (int)$2.f4, (int)$2.f5); } 154 | T_BOX args3 { driver.m esh.AppendBox(vec3($2.f0, $2.f1, $2.f2)); }155 | T_SMOOTHCHAMFBOX args4 { driver.m esh.AppendSmoothChamfBox(vec3($2.f0, $2.f1,122 | T_BOX args3 { driver.m_mesh.AppendBox(vec3($2.f0, $2.f1, $2.f2)); } 123 | T_SMOOTHCHAMFBOX args4 { driver.m_mesh.AppendSmoothChamfBox(vec3($2.f0, $2.f1, 156 124 $2.f2), $2.f3); } 157 | T_FLATCHAMFBOX args4 { driver.m esh.AppendFlatChamfBox(vec3($2.f0, $2.f1,125 | T_FLATCHAMFBOX args4 { driver.m_mesh.AppendFlatChamfBox(vec3($2.f0, $2.f1, 158 126 $2.f2), $2.f3); } 159 | T_SPHERE args4 { driver.m esh.AppendSphere($2.f0,127 | T_SPHERE args4 { driver.m_mesh.AppendSphere($2.f0, 160 128 vec3($2.f1, $2.f2, $2.f3)); } 161 | T_STAR args5 { driver.m esh.AppendStar((int)$2.f0, $2.f1, $2.f2,129 | T_STAR args5 { driver.m_mesh.AppendStar((int)$2.f0, $2.f1, $2.f2, 162 130 (int)$2.f3, (int)$2.f4); } 163 | T_EXPANDEDSTAR args4 { driver.m esh.AppendExpandedStar((int)$2.f0, $2.f1,131 | T_EXPANDEDSTAR args4 { driver.m_mesh.AppendExpandedStar((int)$2.f0, $2.f1, 164 132 $2.f2, $2.f3); } 165 | T_DISC args3 { driver.m esh.AppendDisc((int)$2.f0, $2.f1, (int)$2.f2); }166 | T_TRIANGLE args2 { driver.m esh.AppendSimpleTriangle($2.f0, (int)$2.f1); }167 | T_QUAD args2 { driver.m esh.AppendSimpleQuad($2.f0, (int)$2.f1); }168 | T_COG args8 { driver.m esh.AppendCog((int)$2.f0, $2.f1, $2.f2, $2.f3,133 | T_DISC args3 { driver.m_mesh.AppendDisc((int)$2.f0, $2.f1, (int)$2.f2); } 134 | T_TRIANGLE args2 { driver.m_mesh.AppendSimpleTriangle($2.f0, (int)$2.f1); } 135 | T_QUAD args2 { driver.m_mesh.AppendSimpleQuad($2.f0, (int)$2.f1); } 136 | T_COG args8 { driver.m_mesh.AppendCog((int)$2.f0, $2.f1, $2.f2, $2.f3, 169 137 $2.f4, $2.f5, $2.f6, (int)$2.f7); } 170 138 ; … … 184 152 ; 185 153 186 %% /*** Additional Code ***/154 %% 187 155 188 156 void orbital::MeshParser::error(const MeshParser::location_type& l, 189 157 const std::string& m) 190 158 { 191 driver. error(l, m);159 driver.Error(l, m); 192 160 } 161
Note: See TracChangeset
for help on using the changeset viewer.