Changes in src/main.cc [711eee5:7b937575]
- File:
-
- 1 edited
-
src/main.cc (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/main.cc
r711eee5 r7b937575 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // main.cc -- 7 // main.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Fri May 15 23:12:02 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Wed May 04 16:54:52201613 // Update Count : 19911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 4 23:32:59 2016 13 // Update Count : 203 14 14 // 15 15 … … 41 41 #include "InitTweak/Mutate.h" 42 42 #include "InitTweak/RemoveInit.h" 43 #include "InitTweak/FixGlobalInit.h"44 43 //#include "Explain/GenProlog.h" 45 44 //#include "Try/Visit.h" … … 98 97 std::ostream *output = &std::cout; 99 98 int long_index; 100 std::list< Declaration* > translationUnit; 99 std::list< Declaration * > translationUnit; 100 const char *filename = NULL;; 101 101 102 102 opterr = 0; // prevent getopt from printing error messages 103 103 104 104 int c; 105 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD: ", long_opts, &long_index )) != -1 ) {105 while ( (c = getopt_long( argc, argv, "abefglnpqrstvyzD:F:", long_opts, &long_index )) != -1 ) { 106 106 switch ( c ) { 107 107 case Ast: … … 163 163 break; 164 164 case 'D': // ignore -Dxxx 165 break; 166 case 'F': // source file-name without suffix 167 filename = optarg; 165 168 break; 166 169 case '?': … … 173 176 174 177 try { 175 std::string fileName;176 177 178 // choose to read the program from a file or stdin 178 179 if ( optind < argc ) { 179 180 input = fopen( argv[ optind ], "r" ); 180 181 if ( ! input ) { 181 std::cout << "Error: can't open " << argv[ optind] << std::endl;182 std::cout << "Error: can't open " << argv[optind] << std::endl; 182 183 exit( 1 ); 183 184 } // if 184 185 optind += 1; 185 186 // assert( optind < argc );187 fileName = argv[ optind-1 ]; // placeholder188 // optind += 1;189 186 } else { 190 187 input = stdin; … … 194 191 output = new ofstream( argv[ optind ] ); 195 192 } // if 196 193 197 194 Parser::get_parser().set_debug( grammarp ); 198 195 … … 215 212 exit( 1 ); 216 213 } // if 217 214 218 215 parse( prelude, LinkageSpec::Intrinsic ); 219 216 } // if 220 217 } // if 221 218 222 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 223 219 parse( input, libcfap ? LinkageSpec::Intrinsic : LinkageSpec::Cforall, grammarp ); 220 224 221 if ( parsep ) { 225 222 Parser::get_parser().get_parseTree()->printList( std::cout ); … … 256 253 OPTPRINT( "mutate" ) 257 254 ControlStruct::mutate( translationUnit ); 258 OPTPRINT( "fixNames" ) 255 OPTPRINT( "fixNames" ) 259 256 CodeGen::fixNames( translationUnit ); 260 OPTPRINT( "fixGlobalInit" );261 InitTweak::fixGlobalInit( translationUnit, fileName );262 257 OPTPRINT( "tweak" ) 263 258 InitTweak::tweak( translationUnit ); … … 287 282 OPTPRINT( "box" ) 288 283 GenPoly::box( translationUnit ); 289 284 290 285 // print tree right before code generation 291 286 if ( codegenp ) { … … 343 338 std::list< Declaration * > decls; 344 339 if ( noprotop ) { 345 filter( translationUnit.begin(), translationUnit.end(), 340 filter( translationUnit.begin(), translationUnit.end(), 346 341 std::back_inserter( decls ), notPrelude ); 347 342 } else {
Note:
See TracChangeset
for help on using the changeset viewer.