Changeset cdbab55 for src/main.cc
- Timestamp:
- Aug 21, 2018, 2:24:29 PM (7 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r2b79a70 rcdbab55 73 73 DeclarationNode * parseTree = nullptr; // program parse tree 74 74 75 std::string PreludeDirector = ""; 76 75 77 static void parse_cmdline( int argc, char *argv[], const char *& filename ); 76 78 static void parse( FILE * input, LinkageSpec::Spec linkage, bool shouldExit = false ); … … 182 184 // -l is for initial build ONLY and builtins.cf is not in the lib directory so access it here. 183 185 186 assertf( !PreludeDirector.empty(), "Can't find prelude without option --prelude-dir must be used." ); 187 184 188 // 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" ); 186 190 assertf( gcc_builtins, "cannot open gcc-builtins.cf\n" ); 187 191 parse( gcc_builtins, LinkageSpec::Compiler ); 188 192 189 193 // 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" ); 191 195 assertf( extras, "cannot open extras.cf\n" ); 192 196 parse( extras, LinkageSpec::BuiltinC ); … … 194 198 if ( ! libcfap ) { 195 199 // 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" ); 197 201 assertf( prelude, "cannot open prelude.cf\n" ); 198 202 parse( prelude, LinkageSpec::Intrinsic ); 199 203 200 204 // 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" ); 202 206 assertf( builtins, "cannot open builtins.cf\n" ); 203 207 parse( builtins, LinkageSpec::BuiltinCFA ); … … 323 327 PASS( "codegen", CodeGen::generate( translationUnit, *output, ! noprotop, prettycodegenp, true, linemarks ) ); 324 328 325 CodeGen::FixMain::fix( *output, treep ? "../prelude/bootloader.c" : CFA_LIBDIR "/bootloader.c");329 CodeGen::FixMain::fix( *output, (PreludeDirector + "/bootloader.c").c_str() ); 326 330 if ( output != &cout ) { 327 331 delete output; … … 372 376 373 377 void parse_cmdline( int argc, char * argv[], const char *& filename ) { 374 enum { Ast, Bbox, Bresolver, CtorInitFix, DeclStats, Expr, ExprAlt, Grammar, LibCFA, Linemarks, Nolinemarks, Nopreamble, Parse, Pr ototypes, 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, }; 375 379 376 380 static struct option long_opts[] = { … … 388 392 { "no-preamble", no_argument, 0, Nopreamble }, 389 393 { "parse", no_argument, 0, Parse }, 394 { "prelude-dir", required_argument, 0, PreludeDir }, 390 395 { "no-prototypes", no_argument, 0, Prototypes }, 391 396 { "resolver", no_argument, 0, Resolver }, … … 460 465 case 'p': // generate prototypes for preamble functions 461 466 noprotop = true; 467 break; 468 case PreludeDir: 469 PreludeDirector = optarg; 462 470 break; 463 471 case 'm': // don't replace the main
Note:
See TracChangeset
for help on using the changeset viewer.