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 8c680e9 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
|
Line | |
---|
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 |
---|
12 | // Last Modified On : Thu Jun 29 09:02:37 2017 |
---|
13 | // Update Count : 15 |
---|
14 | // |
---|
15 | |
---|
16 | #include <iostream> |
---|
17 | #include <fstream> |
---|
18 | #include <string> |
---|
19 | using namespace std; |
---|
20 | #include <unistd.h> // close |
---|
21 | #include "filter.h" |
---|
22 | |
---|
23 | extern FILE * yyin; |
---|
24 | extern int yylineno; |
---|
25 | extern int yydebug; |
---|
26 | extern int yyparse( void ); |
---|
27 | |
---|
28 | int main( int argc, char *argv[] ) { |
---|
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 |
---|
73 | |
---|
74 | //yydebug = 1; |
---|
75 | yyparse(); |
---|
76 | |
---|
77 | if ( yyin != stdin ) fclose( yyin ); // close file, do not delete cin! |
---|
78 | } // main |
---|
79 | |
---|
80 | // Local Variables: // |
---|
81 | // mode: c++ // |
---|
82 | // tab-width: 4 // |
---|
83 | // compile-command: "make install" // |
---|
84 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.