gcc config
[prop.git] / prop-src / prop-main.cc
blob6c00a6dce8591aa53549e73affd7318d5b3bcb14
1 ///////////////////////////////////////////////////////////////////////////////
2 // This file is generated automatically using Prop (version 2.3.6),
3 // last updated on Nov 2, 1999.
4 // The original source file is "prop-main.pcc".
5 ///////////////////////////////////////////////////////////////////////////////
7 #define PROP_REGEXP_MATCHING_USED
8 #include <propdefs.h>
9 #line 1 "prop-main.pcc"
10 ///////////////////////////////////////////////////////////////////////////////
12 // ////////
13 // // // ////// ///// ///////
14 // //////// // // // // //
15 // // // // // ///////
16 // // // ///// //
17 // // Version 2.3.x
19 // Allen Leung (leunga@cs.nyu.edu)
20 ///////////////////////////////////////////////////////////////////////////////
21 #include <iostream>
22 #include <stdlib.h>
23 #include <string.h>
24 #include "basics.h"
25 #include "config.h"
26 #include "author.h"
27 #include "options.h"
29 ///////////////////////////////////////////////////////////////////////////////
31 // Help message
33 ///////////////////////////////////////////////////////////////////////////////
34 static const char * HELP_MESSAGE =
35 "%s version %s.%s, last updated on %s\n"
36 "usage: %s [options] <files>\n"
37 "options: [-automake]\n"
38 " [-d -debug] [-G -GNU] [-html] [-I<path>]\n"
39 " [-l -no_line_directives] [-M -make_depends]\n"
40 " [-n -no_codegen] [-N -non_linear]\n"
41 " [-o<outfile>] [-O#]\n"
42 " [-Ofast_string_match] [-Oadaptive_matching]\n"
43 " [-Oinline_casts] [-Otagged_pointer] [-Orewriting]\n"
44 " [-r -report] [-s -strict] [-S -save_space]\n"
45 " [-t -stdout] [-v#] [-V# -vector#] [-vcg]\n"
46 " [-new_list_format]\n"
47 " [-use_global_pools]\n"
48 " [-memory_usage]\n"
51 ///////////////////////////////////////////////////////////////////////////////
53 // The global options data structure.
55 ///////////////////////////////////////////////////////////////////////////////
56 PropOptions options;
57 static Bool print_memory_usage = false;
59 ///////////////////////////////////////////////////////////////////////////////
60 //
61 // Routine to process command line arguments
63 ///////////////////////////////////////////////////////////////////////////////
64 void PropOptions::process_command_line_arguments
65 (int argc, const char * argv[])
67 Bool help = false;
68 prog_name = argv[0];
69 for (argc--, argv++; argc > 0; argc--, argv++)
71 #line 61 "prop-main.pcc"
72 #line 110 "prop-main.pcc"
74 char const * _V1 = argv[0];
76 static const DFATables::Offset _X1_base [ 224 ] = {
77 0, 359, 358, 0, 31, 43, 356, 356, 35, 355, 65, 24, 36, 0, 83, 352,
78 352, 352, 0, 99, 0, 0, 129, 351, 349, 344, 344, 344, 86, 343, 343, 0,
79 91, 343, 343, 342, 342, 342, 342, 341, 341, 340, 338, 338, 338, 336, 336, 327,
80 0, 324, 324, 324, 324, 323, 323, 323, 92, 322, 316, 316, 307, 302, 301, 301,
81 299, 298, 298, 297, 297, 0, 297, 297, 297, 297, 297, 297, 297, 296, 296, 296,
82 296, 296, 0, 0, 288, 281, 277, 276, 276, 276, 276, 272, 0, 271, 270, 269,
83 269, 269, 269, 269, 268, 268, 268, 0, 268, 261, 256, 255, 255, 249, 249, 0,
84 0, 249, 0, 249, 249, 247, 244, 244, 238, 238, 238, 235, 235, 234, 232, 232,
85 232, 232, 232, 232, 231, 231, 231, 231, 231, 229, 229, 227, 227, 227, 223, 219,
86 219, 219, 219, 213, 213, 0, 212, 212, 212, 206, 206, 206, 205, 205, 205, 203,
87 203, 200, 199, 199, 199, 199, 199, 199, 196, 191, 0, 191, 191, 191, 185, 0,
88 180, 180, 180, 176, 175, 174, 174, 171, 171, 171, 171, 163, 163, 159, 159, 0,
89 158, 158, 158, 156, 155, 155, 155, 154, 0, 154, 154, 154, 154, 154, 154, 154,
90 146, 136, 132, 0, 0, 104, 97, 0, 91, 91, 80, 75, 26, 24, 0, 0
92 static const DFATables::State _X1_check [ 395 ] = {
93 3, 0, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
94 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
95 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 11, 4, 221, 4, 5, 220,
96 4, 8, 12, 11, 4, 0, 12, 4, 4, 4, 4, 5, 4, 4, 4, 4,
97 4, 10, 8, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
98 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
99 10, 10, 10, 10, 10, 14, 19, 28, 32, 219, 218, 217, 56, 216, 0, 0,
100 0, 19, 14, 28, 56, 32, 19, 214, 0, 19, 0, 0, 0, 0, 0, 0,
101 19, 22, 19, 22, 22, 22, 22, 213, 22, 22, 22, 22, 22, 22, 22, 22,
102 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
103 22, 22, 22, 22, 22, 210, 209, 208, 207, 198, 202, 194, 199, 0, 0, 189,
104 204, 187, 203, 201, 0, 0, 196, 206, 190, 205, 197, 195, 193, 192, 188, 186,
105 182, 180, 0, 0, 0, 184, 0, 0, 0, 183, 185, 181, 179, 178, 177, 174,
106 173, 168, 176, 172, 167, 165, 161, 0, 0, 0, 171, 164, 169, 166, 160, 156,
107 154, 162, 163, 158, 152, 159, 155, 148, 146, 143, 157, 153, 144, 145, 151, 142,
108 150, 141, 138, 147, 136, 130, 128, 127, 0, 135, 129, 137, 131, 124, 126, 122,
109 120, 119, 139, 134, 140, 121, 132, 133, 125, 117, 123, 116, 108, 0, 0, 0,
110 0, 0, 118, 115, 110, 113, 106, 105, 109, 107, 104, 0, 0, 102, 99, 0,
111 0, 0, 100, 97, 0, 0, 0, 98, 91, 86, 88, 95, 96, 94, 93, 101,
112 90, 87, 85, 89, 84, 81, 74, 68, 0, 72, 0, 71, 0, 70, 77, 64,
113 79, 76, 66, 78, 0, 80, 75, 67, 63, 73, 61, 60, 65, 62, 59, 57,
114 55, 49, 47, 46, 50, 53, 0, 58, 40, 0, 51, 25, 0, 0, 54, 52,
115 44, 45, 41, 17, 42, 38, 27, 23, 2, 1, 26, 0, 43, 35, 37, 36,
116 34, 24, 15, 30, 39, 9, 0, 0, 29, 33, 0, 0, 0, 0, 0, 0,
117 16, 7, 6, 0, 0, 0, 0, 0, 0, 0, 0
119 static const DFATables::State _X1_next [ 395 ] = {
120 4, 0, 4, 4, 4, 23, 22, 21, 20, 19, 18, 4, 17, 4, 16, 4,
121 4, 15, 4, 4, 4, 14, 4, 4, 13, 12, 11, 10, 4, 9, 8, 7,
122 6, 5, 4, 4, 4, 4, 4, 4, 4, 4, 33, 4, 223, 4, 25, 222,
123 4, 29, 35, 32, 4, 0, 34, 4, 4, 4, 4, 24, 4, 4, 4, 4,
124 4, 31, 28, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
125 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
126 31, 31, 31, 31, 31, 37, 46, 52, 56, 13, 221, 220, 78, 219, 0, 0,
127 0, 45, 36, 51, 77, 55, 44, 218, 0, 43, 0, 0, 0, 0, 0, 0,
128 42, 22, 41, 22, 22, 22, 22, 217, 22, 22, 22, 22, 22, 22, 22, 22,
129 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
130 22, 22, 22, 22, 22, 216, 215, 214, 213, 205, 208, 201, 206, 0, 0, 197,
131 210, 195, 209, 207, 0, 0, 203, 212, 198, 211, 204, 202, 200, 199, 196, 194,
132 191, 189, 0, 0, 0, 192, 0, 0, 0, 21, 193, 190, 188, 187, 186, 184,
133 183, 179, 185, 182, 178, 176, 172, 0, 0, 0, 181, 175, 180, 177, 171, 18,
134 167, 173, 174, 169, 165, 170, 168, 162, 160, 157, 20, 166, 158, 159, 164, 156,
135 163, 155, 152, 161, 150, 144, 142, 141, 0, 149, 143, 151, 145, 138, 140, 136,
136 134, 133, 153, 148, 154, 135, 146, 147, 139, 131, 137, 130, 125, 0, 0, 0,
137 0, 0, 132, 129, 127, 128, 123, 122, 126, 124, 121, 0, 0, 120, 117, 0,
138 0, 0, 118, 115, 0, 0, 0, 116, 110, 105, 107, 113, 114, 112, 111, 119,
139 109, 106, 104, 108, 103, 102, 95, 90, 0, 93, 0, 92, 0, 91, 98, 86,
140 100, 97, 88, 99, 0, 101, 96, 89, 85, 94, 83, 82, 87, 84, 81, 79,
141 76, 70, 69, 46, 71, 74, 0, 80, 40, 0, 72, 25, 0, 0, 75, 73,
142 67, 68, 64, 40, 65, 62, 50, 47, 3, 3, 49, 0, 66, 59, 61, 60,
143 58, 48, 38, 54, 63, 30, 0, 0, 53, 57, 0, 0, 0, 0, 0, 0,
144 39, 27, 26, 0, 0, 0, 0, 0, 0, 0, 0
146 static const DFATables::State _X1_def [ 224 ] = {
147 0, 0, 0, 0, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
148 4, 4, 4, 4, 4, 4, 3, 4, 4, 4, 4, 4, 4, 4, 4, 10,
149 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
150 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
151 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
152 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
153 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
154 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
155 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
156 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
157 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
158 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
159 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
160 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
162 static const unsigned char _X1_equiv_classes [ 256 ] = {
163 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
164 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
165 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
166 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4,
167 4, 4, 4, 4, 4, 4, 4, 5, 4, 6, 4, 4, 4, 7, 8, 9,
168 4, 4, 4, 10, 4, 11, 12, 4, 4, 4, 4, 4, 4, 4, 4, 13,
169 4, 14, 15, 16, 17, 18, 19, 20, 21, 22, 4, 23, 24, 25, 26, 27,
170 28, 4, 29, 30, 31, 32, 33, 34, 4, 35, 4, 4, 4, 4, 4, 4,
171 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
172 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
173 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
174 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
175 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
176 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
177 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
178 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4
180 static const DFATables::Rule _X1_accept_rule [ 224 ] = {
181 0, 0, 0, 31, 31, 23, 31, 9, 8, 7, 13, 3, 31, 4, 28, 2,
182 31, 31, 21, 31, 20, 25, 11, 5, 31, 23, 31, 31, 31, 31, 31, 12,
183 31, 31, 31, 31, 31, 31, 31, 31, 22, 31, 31, 31, 31, 31, 14, 31,
184 24, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
185 31, 31, 31, 31, 31, 5, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
186 31, 31, 6, 28, 31, 31, 31, 31, 31, 31, 31, 31, 10, 31, 31, 31,
187 31, 31, 31, 31, 31, 31, 31, 2, 31, 31, 31, 31, 31, 31, 31, 8,
188 9, 31, 7, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
189 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
190 31, 31, 31, 31, 31, 1, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
191 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 3, 31, 31, 31, 31, 19,
192 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 30,
193 31, 31, 31, 31, 31, 31, 31, 31, 17, 31, 31, 31, 31, 31, 31, 31,
194 31, 31, 31, 27, 18, 31, 31, 29, 31, 31, 31, 31, 31, 31, 15, 16
196 static const RegexMatch _X1
197 ( _X1_base,
198 _X1_check,
199 _X1_def,
200 _X1_next,
201 _X1_accept_rule,
202 _X1_equiv_classes );
203 switch(_X1.MatchText(_V1)) {
204 case 1: {
205 #line 62 "prop-main.pcc"
206 automake = true;
207 #line 62 "prop-main.pcc"
208 } break;
209 case 2: {
210 #line 63 "prop-main.pcc"
211 debug = true;
212 #line 63 "prop-main.pcc"
213 } break;
214 case 3: {
215 #line 64 "prop-main.pcc"
216 emit_code = false;
217 #line 64 "prop-main.pcc"
218 } break;
219 case 4: {
220 #line 65 "prop-main.pcc"
221 line_directives = false;
222 #line 65 "prop-main.pcc"
223 } break;
224 case 5: {
225 #line 66 "prop-main.pcc"
226 GNU_style_message = true;
227 #line 66 "prop-main.pcc"
228 } break;
229 case 6: {
230 #line 67 "prop-main.pcc"
231 generate_html = true;
232 #line 67 "prop-main.pcc"
233 } break;
234 case 7: {
235 #line 68 "prop-main.pcc"
236 generate_report = true;
237 #line 68 "prop-main.pcc"
238 } break;
239 case 8: {
240 #line 69 "prop-main.pcc"
241 strict_checking = true;
242 #line 69 "prop-main.pcc"
243 } break;
244 case 9: {
245 #line 70 "prop-main.pcc"
246 to_stdout = true;
247 #line 70 "prop-main.pcc"
248 } break;
249 case 10: {
250 #line 71 "prop-main.pcc"
251 trace = true;
252 #line 71 "prop-main.pcc"
253 } break;
254 case 11: {
255 #line 72 "prop-main.pcc"
256 char c[2]; c[0] = FILE_SEPARATOR; c[1] = '\0';
257 strcat(search_paths,c);
258 strcat(search_paths,argv[0]+2);
260 #line 75 "prop-main.pcc"
261 } break;
262 case 12: {
263 #line 76 "prop-main.pcc"
264 strcpy(output_file_name,argv[0]+2);
265 #line 76 "prop-main.pcc"
266 } break;
267 case 13: {
268 #line 77 "prop-main.pcc"
269 if (argc > 1)
270 { argv++; argc--;
271 strcpy(output_file_name,argv[0]);
272 } else help = true;
274 #line 81 "prop-main.pcc"
275 } break;
276 case 14: {
277 #line 82 "prop-main.pcc"
278 int opt = atol(argv[0]+2);
279 optimization_level = opt <= 0 ? 1 : opt;
280 fast_string_match = optimization_level & 1;
281 adaptive_matching = optimization_level & 2;
282 inline_casts = optimization_level & 4;
283 tagged_pointer = optimization_level & 8;
284 optimize_rewrite = optimization_level & 16;
286 #line 89 "prop-main.pcc"
287 } break;
288 case 15: {
289 #line 90 "prop-main.pcc"
290 fast_string_match = true;
291 #line 90 "prop-main.pcc"
292 } break;
293 case 16: {
294 #line 91 "prop-main.pcc"
295 adaptive_matching = true;
296 #line 91 "prop-main.pcc"
297 } break;
298 case 17: {
299 #line 92 "prop-main.pcc"
300 inline_casts = true;
301 #line 92 "prop-main.pcc"
302 } break;
303 case 18: {
304 #line 93 "prop-main.pcc"
305 tagged_pointer = true;
306 #line 93 "prop-main.pcc"
307 } break;
308 case 19: {
309 #line 94 "prop-main.pcc"
310 optimize_rewrite = true;
311 #line 94 "prop-main.pcc"
312 } break;
313 case 20: {
314 #line 95 "prop-main.pcc"
315 nonlinear_patterns = true;
316 #line 95 "prop-main.pcc"
317 } break;
318 case 21: {
319 #line 96 "prop-main.pcc"
320 save_space = true;
321 #line 96 "prop-main.pcc"
322 } break;
323 case 22: {
324 #line 97 "prop-main.pcc"
325 max_vector_len = atol(argv[0]+2);
326 #line 97 "prop-main.pcc"
327 } break;
328 case 23: {
329 #line 98 "prop-main.pcc"
330 verbosity = atol(argv[0]+2);
331 if (verbosity <= 0) verbosity = 1;
333 #line 100 "prop-main.pcc"
334 } break;
335 case 24: {
336 #line 101 "prop-main.pcc"
337 visualization = true;
338 #line 101 "prop-main.pcc"
339 } break;
340 case 25: {
341 #line 102 "prop-main.pcc"
342 gen_dependences = true;
343 #line 102 "prop-main.pcc"
344 } break;
345 case 26: {
346 #line 103 "prop-main.pcc"
347 emit_code = false;
348 #line 103 "prop-main.pcc"
349 } break;
350 case 27: {
351 #line 104 "prop-main.pcc"
352 new_list_format = true;
353 #line 104 "prop-main.pcc"
354 } break;
355 case 28: {
356 #line 105 "prop-main.pcc"
357 help = true;
358 #line 105 "prop-main.pcc"
359 } break;
360 case 29: {
361 #line 106 "prop-main.pcc"
362 MEM::use_global_pools();
363 #line 106 "prop-main.pcc"
364 } break;
365 case 30: {
366 #line 107 "prop-main.pcc"
367 print_memory_usage = true;
368 #line 107 "prop-main.pcc"
369 } break;
370 case 31: {
371 #line 109 "prop-main.pcc"
372 error("%s: unknown option %s\n",prog_name, argv[0]); help = true;
373 #line 109 "prop-main.pcc"
374 } break;
375 default: {
376 #line 110 "prop-main.pcc"
377 input_files[file_count++] = argv[0];
378 #line 110 "prop-main.pcc"
383 #line 111 "prop-main.pcc"
384 #line 111 "prop-main.pcc"
386 if (argv[0][0] == '-') input_options[option_count++] = argv[0];
388 input_file_name = input_files[0];
390 ////////////////////////////////////////////////////////////////////////////
391 // Print help message
392 ////////////////////////////////////////////////////////////////////////////
393 if (help || file_count == 0)
394 { error(HELP_MESSAGE,prog_name,VERSION,PATCH_LEVEL,LAST_UPDATED,prog_name);
395 exit(1);
399 ///////////////////////////////////////////////////////////////////////////////
401 // Run a program recursively.
403 ///////////////////////////////////////////////////////////////////////////////
404 static int run_prog(const char * prog, int argc, const char * argv[])
405 { char command[4096];
406 strcpy(command,prog);
407 for (int i = 0; i < argc; i++)
408 { strcat(command," ");
409 strcat(command,argv[i]);
411 int stat = system(command);
412 if (stat) error("Error in command: %s\n", command);
413 return stat;
416 ///////////////////////////////////////////////////////////////////////////////
418 // The main program.
420 ///////////////////////////////////////////////////////////////////////////////
421 int main(int argc, const char * argv [])
422 { extern int process_input(PropOptions&);
424 options.process_command_line_arguments(argc, argv);
425 options.compute_output_file_name();
427 int stat;
428 if (options.file_count == 1)
429 { stat = process_input(options);
430 if (print_memory_usage)
431 { msg("[global pool size = %i local pool size = %i string pool size = %i]\n",
432 global_pool.bytes_used(), mem_pool.bytes_used(), str_pool.bytes_used());
434 } else
435 { for (int i = 0; i < options.file_count; i++)
436 { options.input_options[options.option_count] = options.input_files[i];
437 stat = run_prog(options.prog_name,
438 options.option_count+1,
439 options.input_options);
440 if (stat) break;
443 exit(stat);
445 #line 171 "prop-main.pcc"
447 ------------------------------- Statistics -------------------------------
448 Merge matching rules = yes
449 Number of DFA nodes merged = 0
450 Number of ifs generated = 0
451 Number of switches generated = 1
452 Number of labels = 0
453 Number of gotos = 0
454 Adaptive matching = enabled
455 Fast string matching = disabled
456 Inline downcasts = enabled
457 --------------------------------------------------------------------------