ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since 47ecf2b was
c9383ee,
checked in by Peter A. Buhr <pabuhr@…>, 7 years ago
|
update input file and formatting
|
-
Property mode set to
100644
|
File size:
1.9 KB
|
Rev | Line | |
---|
[7d4f6ed] | 1 | // |
---|
| 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo |
---|
| 3 | // |
---|
| 4 | // The contents of this file are covered under the licence agreement in the |
---|
| 5 | // file "LICENCE" distributed with Cforall. |
---|
| 6 | // |
---|
| 7 | // main.cc -- |
---|
| 8 | // |
---|
| 9 | // Author : Peter A. Buhr |
---|
| 10 | // Created On : Wed Jun 28 22:57:26 2017 |
---|
| 11 | // Last Modified By : Peter A. Buhr |
---|
[c9383ee] | 12 | // Last Modified On : Thu Jun 29 09:02:37 2017 |
---|
| 13 | // Update Count : 15 |
---|
[7d4f6ed] | 14 | // |
---|
| 15 | |
---|
| 16 | #include <iostream> |
---|
[c9383ee] | 17 | #include <fstream> |
---|
[7d4f6ed] | 18 | #include <string> |
---|
| 19 | using namespace std; |
---|
[c9383ee] | 20 | #include <unistd.h> // close |
---|
[fda8168] | 21 | #include "filter.h" |
---|
| 22 | |
---|
[c9383ee] | 23 | extern FILE * yyin; |
---|
| 24 | extern int yylineno; |
---|
[fda8168] | 25 | extern int yydebug; |
---|
| 26 | extern int yyparse( void ); |
---|
| 27 | |
---|
| 28 | int main( int argc, char *argv[] ) { |
---|
[c9383ee] | 29 | yyin = stdin; |
---|
| 30 | filter = Nocode; |
---|
| 31 | |
---|
| 32 | try { |
---|
| 33 | switch ( argc ) { |
---|
| 34 | case 3: |
---|
| 35 | yyin = fopen( argv[ 2 ], "r" ); |
---|
| 36 | if ( yyin == nullptr ) { |
---|
| 37 | throw ios_base::failure( "unknown printer option arguments" ); |
---|
| 38 | } // if |
---|
| 39 | // FALL THROUGH |
---|
| 40 | case 2: { |
---|
| 41 | string arg( argv[1] ); |
---|
| 42 | |
---|
| 43 | if ( arg == "-identity" ) { |
---|
| 44 | filter = Identity; |
---|
| 45 | } else if ( arg == "-parse_tree" ) { |
---|
| 46 | filter = Parse_Tree; |
---|
| 47 | } else if ( arg == "-nocode" ) { |
---|
| 48 | filter = Nocode; |
---|
| 49 | } else if ( arg == "-latex" ) { |
---|
| 50 | filter = LaTeX; |
---|
| 51 | } else if ( arg == "-html" ) { |
---|
| 52 | filter = HTML; |
---|
| 53 | } else { |
---|
| 54 | throw ios_base::failure( "unknown printer option arguments" ); |
---|
| 55 | } // if |
---|
| 56 | break; |
---|
| 57 | } |
---|
| 58 | default: |
---|
| 59 | throw ios_base::failure( "wrong number of arguments" ); |
---|
| 60 | } // switch |
---|
| 61 | } catch( ios_base::failure err ) { |
---|
| 62 | cerr << err.what() << endl; |
---|
| 63 | cerr << "Usage: [" << argv[0] |
---|
| 64 | << "-identity |" |
---|
| 65 | << "-parse_tree |" |
---|
| 66 | << "-nocode |" |
---|
| 67 | << "-latex |" |
---|
| 68 | << "-html" |
---|
| 69 | << "] [input-file]" |
---|
| 70 | << endl; |
---|
| 71 | exit( EXIT_FAILURE ); // TERMINATE |
---|
| 72 | } // try |
---|
[fda8168] | 73 | |
---|
[7d4f6ed] | 74 | //yydebug = 1; |
---|
| 75 | yyparse(); |
---|
[c9383ee] | 76 | |
---|
| 77 | if ( yyin != stdin ) fclose( yyin ); // close file, do not delete cin! |
---|
| 78 | } // main |
---|
[fda8168] | 79 | |
---|
| 80 | // Local Variables: // |
---|
[7d4f6ed] | 81 | // mode: c++ // |
---|
| 82 | // tab-width: 4 // |
---|
| 83 | // compile-command: "make install" // |
---|
[fda8168] | 84 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.