25 |
|
#include <stdio.h> |
26 |
|
#include <string.h> |
27 |
|
|
28 |
< |
#include "BASSyacc.h" |
29 |
< |
#include "BASS_parse.h" |
30 |
< |
#include "simError.h" |
28 |
> |
#include "io/BASSyacc.h" |
29 |
> |
#include "io/BASS_parse.h" |
30 |
> |
#include "utils/simError.h" |
31 |
|
#ifdef IS_MPI |
32 |
|
#define __is_lex__ |
33 |
|
#include "mpiBASS.h" |
38 |
|
|
39 |
|
extern void change_in_file( FILE* in_file ); |
40 |
|
|
41 |
< |
// the following is used by the include start state |
41 |
> |
/* the following is used by the include start state*/ |
42 |
|
|
43 |
|
#define MAX_BUFFER_DEPTH 10 |
44 |
< |
YY_BUFFER_STATE buffer_stack[MAX_BUFFER_DEPTH]; // a stack of the include buffers |
44 |
> |
YY_BUFFER_STATE buffer_stack[MAX_BUFFER_DEPTH]; /* a stack of the include buffers*/ |
45 |
|
int buffer_stack_ptr = 0; |
46 |
|
struct filename_list{ |
47 |
|
char my_name[300]; |
52 |
|
int yylineno_stack[MAX_BUFFER_DEPTH]; |
53 |
|
|
54 |
|
|
55 |
< |
// the following is a check against the define buffer length |
55 |
> |
/* the following is a check against the define buffer length*/ |
56 |
|
|
57 |
|
void check_def_buff( char* defined, int index ); |
58 |
|
|
59 |
< |
//these are used by the ifdef and ifndef statements |
59 |
> |
/*these are used by the ifdef and ifndef statements*/ |
60 |
|
|
61 |
< |
int escape_stack_ptr = 0; //keeps track of the escape stack |
61 |
> |
int escape_stack_ptr = 0; /*keeps track of the escape stack*/ |
62 |
|
|
63 |
|
|
64 |
|
%} |
108 |
|
/* little routine to strip off the quotes */ |
109 |
|
|
110 |
|
my_short i; |
111 |
< |
i = 0; // index |
111 |
> |
i = 0; /* index*/ |
112 |
|
while( yytext[i+1] != '\"' ){ |
113 |
|
|
114 |
|
yytext[i] = yytext[i+1]; |
123 |
|
/* little routine to pass a list string */ |
124 |
|
|
125 |
|
my_short i; |
126 |
< |
i = 0; // index |
126 |
> |
i = 0; /* index*/ |
127 |
|
while( yytext[i+1] != ')' ){ |
128 |
|
|
129 |
|
yytext[i] = yytext[i+1]; |
169 |
|
"#" BEGIN(PRE_P); |
170 |
|
|
171 |
|
. { |
172 |
< |
// pass everything else to yacc |
172 |
> |
/* pass everything else to yacc*/ |
173 |
|
return yytext[0]; |
174 |
|
} |
175 |
|
|
184 |
|
<INCL>\".*\" { |
185 |
|
char foo_name[300]; |
186 |
|
|
187 |
< |
// little routine to strip off the quotes |
187 |
> |
/* little routine to strip off the quotes */ |
188 |
|
|
189 |
|
my_short i; |
190 |
< |
i = 0; // index |
190 |
> |
i = 0; /* index*/ |
191 |
|
while( yytext[i+1] != '\"' ){ |
192 |
|
|
193 |
|
yytext[i] = yytext[i+1]; |
197 |
|
yytext[i] = '\0'; |
198 |
|
strcpy( foo_name, yytext ); |
199 |
|
|
200 |
< |
// now we have the include file name |
200 |
> |
/* now we have the include file name*/ |
201 |
|
|
202 |
|
if( buffer_stack_ptr >= MAX_BUFFER_DEPTH ){ |
203 |
|
|
234 |
|
char c; |
235 |
|
char definition[ DEFINED_BUFFER_SIZE ]; |
236 |
|
short int done; |
237 |
< |
short int c_done; // a done marker for the comments |
237 |
> |
short int c_done; /* a done marker for the comments*/ |
238 |
|
int def_ptr; |
239 |
|
|
240 |
< |
// initialize the definition buffer |
240 |
> |
/* initialize the definition buffer*/ |
241 |
|
|
242 |
|
for( def_ptr = 0; def_ptr < DEFINED_BUFFER_SIZE; def_ptr++ ){ |
243 |
|
definition[def_ptr] = '\0'; |
252 |
|
c = input(); |
253 |
|
if( c == '\"' ){ |
254 |
|
|
255 |
< |
// shove the whole quoted string into the macro |
255 |
> |
/* shove the whole quoted string into the macro*/ |
256 |
|
|
257 |
|
definition[def_ptr] = c; |
258 |
< |
//fprintf( stderr, "%c", c ); |
258 |
> |
/*fprintf( stderr, "%c", c );*/ |
259 |
|
def_ptr++; |
260 |
|
check_def_buff( yytext, def_ptr ); |
261 |
|
|
263 |
|
while( c != '\"' ){ |
264 |
|
|
265 |
|
definition[def_ptr] = c; |
266 |
< |
//fprintf( stderr, "%c", c ); |
266 |
> |
/*fprintf( stderr, "%c", c );*/ |
267 |
|
def_ptr++; |
268 |
|
check_def_buff( yytext, def_ptr ); |
269 |
|
|
270 |
|
c = input(); |
271 |
|
} |
272 |
|
definition[def_ptr] = c; |
273 |
< |
//fprintf( stderr, "%c", c ); |
273 |
> |
/*fprintf( stderr, "%c", c );*/ |
274 |
|
def_ptr++; |
275 |
|
check_def_buff( yytext, def_ptr ); |
276 |
|
c = input(); |
277 |
|
} |
278 |
|
|
279 |
< |
// handle comments |
279 |
> |
/* handle comments*/ |
280 |
|
|
281 |
|
if( c == '/' ){ |
282 |
|
c = input(); |
304 |
|
break; |
305 |
|
|
306 |
|
default: |
307 |
< |
// the '/' char was a normal symbol |
307 |
> |
/* the '/' char was a normal symbol*/ |
308 |
|
definition[def_ptr] = '/'; |
309 |
< |
//fprintf( stderr, "%c", c ); |
309 |
> |
/*fprintf( stderr, "%c", c );*/ |
310 |
|
def_ptr++; |
311 |
|
check_def_buff( yytext, def_ptr ); |
312 |
|
break; |
320 |
|
|
321 |
|
else{ |
322 |
|
|
323 |
< |
// check for the line wrap character '\' |
323 |
> |
/* check for the line wrap character '\'*/ |
324 |
|
|
325 |
|
if( c == '\\' ){ |
326 |
|
|
327 |
< |
// skip the rest of the line until the line return |
327 |
> |
/* skip the rest of the line until the line return*/ |
328 |
|
|
329 |
|
c = input(); |
330 |
|
while( c != '\n' ){ |
334 |
|
|
335 |
|
else{ |
336 |
|
|
337 |
< |
// we now know the character is a good one |
337 |
> |
/* we now know the character is a good one */ |
338 |
|
|
339 |
|
definition[def_ptr] = c; |
340 |
< |
//fprintf( stderr, "%c", c ); |
340 |
> |
/*fprintf( stderr, "%c", c );*/ |
341 |
|
def_ptr++; |
342 |
|
check_def_buff( yytext, def_ptr ); |
343 |
|
} |
403 |
|
<CHECK_ESCAPE>"endif" { |
404 |
|
escape_stack_ptr--; |
405 |
|
if( escape_stack_ptr <= 0){ |
406 |
< |
escape_stack_ptr = 0; // just in case something flubbed |
406 |
> |
escape_stack_ptr = 0; /* just in case something flubbed */ |
407 |
|
BEGIN(INITIAL); |
408 |
|
} |
409 |
|
} |
413 |
|
<<EOF>> { |
414 |
|
buffer_stack_ptr--; |
415 |
|
if( buffer_stack_ptr < 0 ){ |
416 |
< |
|
416 |
> |
/*reinitialize buffer_stack_ptr*/ |
417 |
> |
buffer_stack_ptr = 0; |
418 |
|
yyterminate(); |
419 |
|
} |
420 |
|
|