equal
deleted
inserted
replaced
76 |
76 |
77 |
77 |
78 |
78 |
79 |
79 |
80 #include "stage1_2/stage1_2.hh" |
80 #include "stage1_2/stage1_2.hh" |
81 #include "search_utils/search_utils.hh" |
81 #include "absyntax_utils/absyntax_utils.hh" |
82 |
82 |
83 //int stage3(symbol_c *tree_root); |
83 //int stage3(symbol_c *tree_root); |
84 int stage4(symbol_c *tree_root, const char *builddir); |
84 int stage4(symbol_c *tree_root, const char *builddir); |
85 |
85 |
86 |
86 |
108 /* |
108 /* |
109 extern char *optarg; |
109 extern char *optarg; |
110 extern int optind, optopt; |
110 extern int optind, optopt; |
111 */ |
111 */ |
112 |
112 |
|
113 /******************************************/ |
|
114 /* Parse command line options... */ |
|
115 /******************************************/ |
113 while ((optres = getopt(argc, argv, ":hfsI:T:")) != -1) { |
116 while ((optres = getopt(argc, argv, ":hfsI:T:")) != -1) { |
114 switch(optres) { |
117 switch(optres) { |
115 case 'h': |
118 case 'h': |
116 printusage(argv[0]); |
119 printusage(argv[0]); |
117 return 0; |
120 return 0; |
131 case ':': /* -I or -T without operand */ |
134 case ':': /* -I or -T without operand */ |
132 fprintf(stderr, "Option -%c requires an operand\n", optopt); |
135 fprintf(stderr, "Option -%c requires an operand\n", optopt); |
133 errflg++; |
136 errflg++; |
134 break; |
137 break; |
135 case '?': |
138 case '?': |
|
139 fprintf(stderr, "Unrecognized option: -%c\n", optopt); |
|
140 errflg++; |
|
141 break; |
136 default: |
142 default: |
137 fprintf(stderr, "Unrecognized option: -%c\n", optopt); |
143 fprintf(stderr, "Unknown error while parsing command line options."); |
138 errflg++; |
144 errflg++; |
139 break; |
145 break; |
140 } |
146 } |
141 } |
147 } |
142 |
148 |
154 printusage(argv[0]); |
160 printusage(argv[0]); |
155 return EXIT_FAILURE; |
161 return EXIT_FAILURE; |
156 } |
162 } |
157 |
163 |
158 |
164 |
|
165 /***************************/ |
|
166 /* Run the compiler... */ |
|
167 /***************************/ |
159 /* 1st Pass */ |
168 /* 1st Pass */ |
160 if (stage1_2(argv[optind], &tree_root, stage1_2_options) < 0) |
169 if (stage1_2(argv[optind], &tree_root, stage1_2_options) < 0) |
161 return EXIT_FAILURE; |
170 return EXIT_FAILURE; |
162 |
171 |
163 /* 2nd Pass */ |
172 /* 2nd Pass */ |
164 printf("loading symbol tables...\n"); |
173 absyntax_utils_init(tree_root); |
165 search_utils_init(tree_root); |
|
166 printf("loading symbol tables... DONE!\n"); |
|
167 /* not yet implemented... */ |
174 /* not yet implemented... */ |
168 /* |
175 /* |
169 if (stage3(tree_root) < 0) |
176 if (stage3(tree_root) < 0) |
170 return EXIT_FAILURE; |
177 return EXIT_FAILURE; |
171 */ |
178 */ |