equal
deleted
inserted
replaced
99 /* If lexical parser is compiled by itself, we need to define the following |
99 /* If lexical parser is compiled by itself, we need to define the following |
100 * constant to some string. Under normal circumstances LIBDIRECTORY is set |
100 * constant to some string. Under normal circumstances LIBDIRECTORY is set |
101 * in the syntax parser header file... |
101 * in the syntax parser header file... |
102 */ |
102 */ |
103 #ifdef TEST_MAIN |
103 #ifdef TEST_MAIN |
104 #define LIBDIRECTORY "just_testing" |
104 #define DEFAULT_LIBDIR "just_testing" |
105 #endif |
105 #endif |
106 |
106 |
107 |
107 |
108 |
108 |
109 /* Required for strdup() */ |
109 /* Required for strdup() */ |
345 |
345 |
346 include_stack_t include_stack[MAX_INCLUDE_DEPTH]; |
346 include_stack_t include_stack[MAX_INCLUDE_DEPTH]; |
347 int include_stack_ptr = 0; |
347 int include_stack_ptr = 0; |
348 |
348 |
349 const char *INCLUDE_DIRECTORIES[] = { |
349 const char *INCLUDE_DIRECTORIES[] = { |
350 "", |
350 DEFAULT_LIBDIR, |
351 "lib/", |
351 ".", |
352 "/lib/", |
352 "/lib", |
353 "/usr/lib/", |
353 "/usr/lib", |
354 "/usr/lib/iec/", |
354 "/usr/lib/iec", |
355 LIBDIRECTORY "/", |
|
356 NULL /* must end with NULL!! */ |
355 NULL /* must end with NULL!! */ |
357 }; |
356 }; |
358 |
357 |
359 %} |
358 %} |
360 |
359 |
664 include_stack_ptr++; |
663 include_stack_ptr++; |
665 yylineno = 1; |
664 yylineno = 1; |
666 current_filename = strdup(yytext); |
665 current_filename = strdup(yytext); |
667 |
666 |
668 for (i = 0, yyin = NULL; (INCLUDE_DIRECTORIES[i] != NULL) && (yyin == NULL); i++) { |
667 for (i = 0, yyin = NULL; (INCLUDE_DIRECTORIES[i] != NULL) && (yyin == NULL); i++) { |
669 char *full_name = strdup2(INCLUDE_DIRECTORIES[i], yytext); |
668 char *full_name = strdup3(INCLUDE_DIRECTORIES[i], "/", yytext); |
670 if (full_name == NULL) { |
669 if (full_name == NULL) { |
671 fprintf(stderr, "Out of memory!\n"); |
670 fprintf(stderr, "Out of memory!\n"); |
672 exit( 1 ); |
671 exit( 1 ); |
673 } |
672 } |
674 yyin = fopen(full_name, "r"); |
673 yyin = fopen(full_name, "r"); |