|
12 | 12 | *
|
13 | 13 | *
|
14 | 14 | * IDENTIFICATION
|
15 |
| - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.103 2003/02/13 20:37:28 meskes Exp $ |
| 15 | + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.104 2003/02/14 13:17:13 meskes Exp $ |
16 | 16 | *
|
17 | 17 | *-------------------------------------------------------------------------
|
18 | 18 | */
|
@@ -423,7 +423,6 @@ cppline {space}*#(.*\\{space})*.*
|
423 | 423 | /* are we simulating Informix? */
|
424 | 424 | if (compat == ECPG_COMPAT_INFORMIX)
|
425 | 425 | {
|
426 |
| - printf ("unput $\n"); |
427 | 426 | unput(':');
|
428 | 427 | }
|
429 | 428 | else
|
@@ -560,6 +559,12 @@ cppline {space}*#(.*\\{space})*.*
|
560 | 559 | if (keyword != NULL)
|
561 | 560 | return keyword->value;
|
562 | 561 |
|
| 562 | + /* Is it a C keyword? */ |
| 563 | + keyword = ScanCKeywordLookup(yytext); |
| 564 | + if (keyword != NULL) |
| 565 | + return keyword->value; |
| 566 | + |
| 567 | + |
563 | 568 | /* How about a DEFINE? */
|
564 | 569 | for (ptr = defines; ptr; ptr = ptr->next)
|
565 | 570 | {
|
@@ -697,6 +702,7 @@ cppline {space}*#(.*\\{space})*.*
|
697 | 702 |
|
698 | 703 | <C>{exec_sql}{define}{space}* { BEGIN(def_ident); }
|
699 | 704 | <C>{exec_sql}{include}{space}* { BEGIN(incl); }
|
| 705 | +<C>{informix_special}{include}{space}* { BEGIN(incl); } |
700 | 706 |
|
701 | 707 | <C,xskip>{exec_sql}{ifdef}{space}* { ifcond = TRUE; BEGIN(xcond); }
|
702 | 708 | <C,xskip>{exec_sql}{ifndef}{space}* { ifcond = FALSE; BEGIN(xcond); }
|
@@ -832,32 +838,45 @@ cppline {space}*#(.*\\{space})*.*
|
832 | 838 | i-- )
|
833 | 839 | {}
|
834 | 840 |
|
835 |
| - /* Remove trailing '"' if it exists */ |
836 |
| - if (yytext[i] == '"') |
837 |
| - yytext[i] = '\0'; |
838 |
| - else |
839 |
| - yytext[i+1] = '\0'; |
| 841 | + yytext[i+1] = '\0'; |
| 842 | + yyin = NULL; |
840 | 843 |
|
841 |
| - /* also remove starting '"' */ |
842 |
| - if (yytext[0] == '"') |
| 844 | + /* If file name is enclosed in '"' remove these and look only in '.' */ |
| 845 | + if (yytext[0] == '"' && yytext[i] == '"') |
| 846 | + { |
| 847 | + yytext[i] = '\0'; |
843 | 848 | memmove(yytext, yytext+1, strlen(yytext));
|
844 |
| - |
845 |
| - yyin = NULL; |
846 |
| - for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next) |
847 |
| - { |
848 |
| - if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH) |
849 |
| - { |
850 |
| - fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno); |
851 |
| - continue; |
852 |
| - } |
853 |
| - snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext); |
854 |
| - yyin = fopen( inc_file, "r" ); |
| 849 | + |
| 850 | + strncpy(inc_file, yytext, sizeof(inc_file)); |
| 851 | + yyin = fopen(inc_file, "r"); |
855 | 852 | if (!yyin)
|
856 | 853 | {
|
857 | 854 | if (strcmp(inc_file + strlen(inc_file) - 2, ".h"))
|
858 | 855 | {
|
859 | 856 | strcat(inc_file, ".h");
|
860 |
| - yyin = fopen( inc_file, "r" ); |
| 857 | + yyin = fopen(inc_file, "r"); |
| 858 | + } |
| 859 | + } |
| 860 | + |
| 861 | + } |
| 862 | + else |
| 863 | + { |
| 864 | + for (ip = include_paths; yyin == NULL && ip != NULL; ip = ip->next) |
| 865 | + { |
| 866 | + if (strlen(ip->path) + strlen(yytext) + 3 > MAXPGPATH) |
| 867 | + { |
| 868 | + fprintf(stderr, "Error: Path %s/%s is too long in line %d, skipping.\n", ip->path, yytext, yylineno); |
| 869 | + continue; |
| 870 | + } |
| 871 | + snprintf (inc_file, sizeof(inc_file), "%s/%s", ip->path, yytext); |
| 872 | + yyin = fopen(inc_file, "r"); |
| 873 | + if (!yyin) |
| 874 | + { |
| 875 | + if (strcmp(inc_file + strlen(inc_file) - 2, ".h")) |
| 876 | + { |
| 877 | + strcat(inc_file, ".h"); |
| 878 | + yyin = fopen( inc_file, "r" ); |
| 879 | + } |
861 | 880 | }
|
862 | 881 | }
|
863 | 882 | }
|
|
0 commit comments