Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    r1ab4ce2 r8686f31  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Jul 15 16:45:24 2015
    13 // Update Count     : 145
     12// Last Modified On : Mon Jul 06 15:01:26 2015
     13// Update Count     : 79
    1414//
    1515
     
    5454        if ( errorp ) std::cerr << x << std::endl;
    5555
    56 static void parse( FILE * input, LinkageSpec::Type t, bool shouldExit = false );
    57 static void dump( std::list< Declaration * > & translationUnit );
     56void parse( FILE * input, LinkageSpec::Type t, bool shouldExit = false );
    5857
    5958bool
     
    6564        libcfap = false,
    6665        nopreludep = false,
    67         noprotop = false,
     66        protop = false,
    6867        parsep = false,
    6968        resolvep = false,                                                                       // used in AlternativeFinder
     
    8281        { "grammar", no_argument, 0, Grammar },
    8382        { "libcfa", no_argument, 0, LibCFA },
    84         { "no-preamble", no_argument, 0, Nopreamble },
     83        { "nopreamble", no_argument, 0, Nopreamble },
    8584        { "parse", no_argument, 0, Parse },
    86         { "no-prototypes", no_argument, 0, Prototypes },
     85        { "prototypes", no_argument, 0, Prototypes },
    8786        { "resolver", no_argument, 0, Resolver },
    8887        { "symbol", no_argument, 0, Symbol },
     
    132131                  case Prototypes:
    133132                  case 'p':                                                                             // generate prototypes for preamble functions
    134                         noprotop = true;
     133                        protop = true;
    135134                        break;
    136135                  case Parse:
     
    222221                Parser::get_parser().freeTree();
    223222                if ( astp ) {
    224                         dump( translationUnit );
     223                        printAll( translationUnit, std::cout );
    225224                        return 0;
    226225                } // if
     
    243242
    244243                if ( validp ) {
    245                         dump( translationUnit );
     244                        printAll( translationUnit, std::cout );
    246245                        return 0;
    247246                } // if
     
    253252
    254253                if ( libcfap ) {
     254                        protop = true;
    255255                        // generate the bodies of cfa library functions
    256256                        LibCfa::makeLibCfa( translationUnit );
     
    258258
    259259                if ( bresolvep ) {
    260                         dump( translationUnit );
     260                        printAll( translationUnit, std::cout );
    261261                        return 0;
    262262                } // if
     
    265265                ResolvExpr::resolve( translationUnit );
    266266                if ( exprp ) {
    267                         dump( translationUnit );
     267                        printAll( translationUnit, std::cout );
    268268                }
    269269
     
    279279                // print tree right before code generation
    280280                if ( codegenp ) {
    281                         dump( translationUnit );
    282                         return 0;
    283                 } // if
    284 
    285                 CodeGen::generate( translationUnit, *output, ! noprotop );
     281                        printAll( translationUnit, std::cout );
     282                        return 0;
     283                } // if
     284
     285                CodeGen::generate( translationUnit, *output, true ); //protop );
    286286
    287287                if ( output != &std::cout ) {
     
    290290        } catch ( SemanticError &e ) {
    291291                if ( errorp ) {
    292                         dump( translationUnit );
     292                        printAll( translationUnit, std::cerr );
    293293                }
    294294                e.print( std::cerr );
     
    315315} // main
    316316
    317 static void parse( FILE * input, LinkageSpec::Type linkage, bool shouldExit ) {
     317void parse( FILE * input, LinkageSpec::Type linkage, bool shouldExit ) {
    318318        Parser::get_parser().set_linkage( linkage );
    319319        Parser::get_parser().parse( input );
     
    325325}
    326326
    327 static bool notPrelude( Declaration * decl ) {
    328         return ! LinkageSpec::isBuiltin( decl->get_linkage() );
    329 }
    330 
    331 static void dump( std::list< Declaration * > & translationUnit ) {
    332         std::list< Declaration * > decls;
    333         if ( noprotop ) {
    334                 filter( translationUnit.begin(), translationUnit.end(),
    335                                 std::back_inserter( decls ), notPrelude );
    336         } else {
    337                 decls = translationUnit;
    338         }
    339 
    340         printAll( decls, std::cout );
    341 }
    342 
    343 
    344327// Local Variables: //
    345328// tab-width: 4 //
Note: See TracChangeset for help on using the changeset viewer.