Changeset cdbab55 for src/main.cc


Ignore:
Timestamp:
Aug 21, 2018, 2:24:29 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
Children:
2a6292d
Parents:
2b79a70 (diff), efa8b6a (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:/u/cforall/software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main.cc

    r2b79a70 rcdbab55  
    7373DeclarationNode * parseTree = nullptr;                                  // program parse tree
    7474
     75std::string PreludeDirector = "";
     76
    7577static void parse_cmdline( int argc, char *argv[], const char *& filename );
    7678static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false );
     
    182184                        // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here.
    183185
     186                        assertf( !PreludeDirector.empty(), "Can't find prelude without option --prelude-dir must be used." );
     187
    184188                        // Read to gcc builtins, if not generating the cfa library
    185                         FILE * gcc_builtins = fopen( buildingLibrary() ? "../prelude/gcc-builtins.cf" : CFA_LIBDIR "/gcc-builtins.cf", "r" );
     189                        FILE * gcc_builtins = fopen( (PreludeDirector + "/gcc-builtins.cf").c_str(), "r" );
    186190                        assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" );
    187191                        parse( gcc_builtins, LinkageSpec::Compiler );
    188192
    189193                        // read the extra prelude in, if not generating the cfa library
    190                         FILE * extras = fopen( buildingLibrary() ? "../prelude/extras.cf" : CFA_LIBDIR "/extras.cf", "r" );
     194                        FILE * extras = fopen( (PreludeDirector + "/extras.cf").c_str(), "r" );
    191195                        assertf( extras, "cannot open extras.cf\n" );
    192196                        parse( extras, LinkageSpec::BuiltinC );
     
    194198                        if ( ! libcfap ) {
    195199                                // read the prelude in, if not generating the cfa library
    196                                 FILE * prelude = fopen( buildingLibrary() ? "../prelude/prelude.cf" : CFA_LIBDIR "/prelude.cf", "r" );
     200                                FILE * prelude = fopen( (PreludeDirector + "/prelude.cf").c_str(), "r" );
    197201                                assertf( prelude, "cannot open prelude.cf\n" );
    198202                                parse( prelude, LinkageSpec::Intrinsic );
    199203
    200204                                // Read to cfa builtins, if not generating the cfa library
    201                                 FILE * builtins = fopen( buildingLibrary() ? "../prelude/builtins.cf" : CFA_LIBDIR "/builtins.cf", "r" );
     205                                FILE * builtins = fopen( (PreludeDirector + "/builtins.cf").c_str(), "r" );
    202206                                assertf( builtins, "cannot open builtins.cf\n" );
    203207                                parse( builtins, LinkageSpec::BuiltinCFA );
     
    323327                PASS( "codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) );
    324328
    325                 CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c" );
     329                CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() );
    326330                if ( output != &cout ) {
    327331                        delete output;
     
    372376
    373377void parse_cmdline( int argc, char * argv[], const char *& filename ) {
    374         enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, Prototypes, Resolver, Symbol, Tree, TupleExpansion, Validate, };
     378        enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, PreludeDir, Prototypes, Resolver, Symbol, Tree, TupleExpansion, Validate, };
    375379
    376380        static struct option long_opts[] = {
     
    388392                { "no-preamble", no_argument, 0, Nopreamble },
    389393                { "parse", no_argument, 0, Parse },
     394                { "prelude-dir", required_argument, 0, PreludeDir },
    390395                { "no-prototypes", no_argument, 0, Prototypes },
    391396                { "resolver", no_argument, 0, Resolver },
     
    460465                  case 'p':                                                                             // generate prototypes for preamble functions
    461466                        noprotop = true;
     467                        break;
     468                  case PreludeDir:
     469                        PreludeDirector = optarg;
    462470                        break;
    463471                  case 'm':                                                                             // don't replace the main
Note: See TracChangeset for help on using the changeset viewer.