161 #define TEMP_VAR VAR_LEADER "TMP_" |
161 #define TEMP_VAR VAR_LEADER "TMP_" |
162 #define SOURCE_VAR VAR_LEADER "SRC_" |
162 #define SOURCE_VAR VAR_LEADER "SRC_" |
163 |
163 |
164 /* please see the comment before the RET_operator_c visitor for details... */ |
164 /* please see the comment before the RET_operator_c visitor for details... */ |
165 #define END_LABEL VAR_LEADER "end" |
165 #define END_LABEL VAR_LEADER "end" |
|
166 |
|
167 |
|
168 /***********************************************************************/ |
|
169 /***********************************************************************/ |
|
170 /***********************************************************************/ |
|
171 /***********************************************************************/ |
|
172 |
|
173 /* Parse command line options passed from main.c !! */ |
|
174 #include <stdlib.h> // for getsybopt() |
|
175 |
|
176 static int generate_line_directives__ = 0; |
|
177 |
|
178 int stage4_parse_options(char *options) { |
|
179 enum { LINE_OPT = 0 /*, SOME_OTHER_OPT, YET_ANOTHER_OPT */}; |
|
180 char *const token[] = { /*[LINE_OPT]=*/(char *)"l" /*, SOME_OTHER_OPT, ... */, NULL }; |
|
181 /* unfortunately, the above commented out syntax for array initialization is valid in C, but not in C++ */ |
|
182 |
|
183 char *subopts = options; |
|
184 char *value; |
|
185 int opt; |
|
186 |
|
187 while (*subopts != '\0') { |
|
188 switch (getsubopt(&subopts, token, &value)) { |
|
189 case LINE_OPT: generate_line_directives__ = 1; break; |
|
190 default : fprintf(stderr, "Unrecognized option: -O %s\n", value); return -1; break; |
|
191 } |
|
192 } |
|
193 return 0; |
|
194 } |
|
195 |
|
196 |
|
197 void stage4_print_options(void) { |
|
198 printf(" (options must be separated by commas. Example: 'l,w,x')\n"); |
|
199 printf(" l : insert '#line' directives in generated C code.\n"); |
|
200 } |
166 |
201 |
167 |
202 |
168 /***********************************************************************/ |
203 /***********************************************************************/ |
169 /***********************************************************************/ |
204 /***********************************************************************/ |
170 /***********************************************************************/ |
205 /***********************************************************************/ |