Changed the way symbols are defined in C in INFORMIX mode.
authorMichael Meskes <meskes@postgresql.org>
Fri, 15 Feb 2008 11:20:21 +0000 (11:20 +0000)
committerMichael Meskes <meskes@postgresql.org>
Fri, 15 Feb 2008 11:20:21 +0000 (11:20 +0000)
src/interfaces/ecpg/ChangeLog
src/interfaces/ecpg/include/datetime.h
src/interfaces/ecpg/include/decimal.h
src/interfaces/ecpg/include/ecpg_informix.h
src/interfaces/ecpg/preproc/pgc.l

index 663e044184c9ac8c30c9ed485a3129eef121af7d..7a2f8346a648928225de68884b6def934ea54643 100644 (file)
@@ -2313,3 +2313,7 @@ Thu, 14 Feb 2008 13:11:34 +0100
        - EXECUTE can return NOT FOUND so it should be checked here too.
        - Changed regression test accordingly.
 
+Fri, 15 Feb 2008 12:01:13 +0100
+
+       - Changed the way symbols are defined in C in INFORMIX mode.
+
index 29cefba959257cd6c4ffcf8a8f3b470e67091ef3..03f2091db4af900eb34eb538b12b45fc7f96901c 100644 (file)
@@ -5,7 +5,8 @@
 
 #include <ecpg_informix.h>
 
-typedef timestamp dtime_t;
-typedef interval intrvl_t;
+/* brought in by ecpg_informix.h nowadays
+ * typedef timestamp dtime_t;
+ * typedef interval intrvl_t; */
 
 #endif   /* ndef _ECPG_DATETIME_H */
index 0f13dd1747531bf803911a7aed806f3e176d0de9..ae185a99c01113d351a4111dc92bd6ba9a5ab7f2 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <ecpg_informix.h>
 
-typedef decimal dec_t;
+/* brought in by ecpg_informix.h nowadays
+ * typedef decimal dec_t; */
 
 #endif   /* ndef _ECPG_DECIMAL_H */
index c00914338dcd977fdf06e31fb03ada8a6af9fa1b..4153896c339e24be32429f8ac908373b77415455 100644 (file)
@@ -82,6 +82,11 @@ extern int   dttofmtasc(timestamp *, char *, int, char *);
 extern int     intoasc(interval *, char *);
 extern int     dtcvfmtasc(char *, char *, timestamp *);
 
+/* we also define Informix datatypes here */
+typedef timestamp dtime_t;
+typedef interval intrvl_t;
+typedef decimal dec_t;
+
 #ifdef __cplusplus
 }
 #endif
index bd0a7d265ed463f7622ffc08ea7f80e6cc3cda16..97edc420fb5922b11a3ad2e508331747354169dd 100644 (file)
@@ -47,7 +47,6 @@ static void addlitchar (unsigned char);
 static void parse_include (void);
 static bool ecpg_isspace(char ch);
 static bool isdefine(void);
-static bool isinformixdefine(void);
 
 char *token_start;
 int state_before;
@@ -744,9 +743,7 @@ cppline                     {space}*#(.*\\{space})*.*{newline}
 <C>{identifier}        {
                                                const ScanKeyword               *keyword;
                                                        
-                                               /* Informix uses SQL defines only in SQL space */
-                                               /* however, some defines have to be taken care of for compatibility */
-                                               if ((!INFORMIX_MODE || !isinformixdefine()) && !isdefine())
+                                               if (!isdefine())
                                                {
                                                        keyword = ScanCKeywordLookup(yytext);
                                                        if (keyword != NULL)
@@ -1318,36 +1315,6 @@ static bool isdefine(void)
        return false;
 }
 
-static bool isinformixdefine(void)
-{
-       const char *new = NULL;
-
-       if (strcmp(yytext, "dec_t") == 0)
-               new = "decimal";
-       else if (strcmp(yytext, "intrvl_t") == 0)
-               new = "interval";
-       else if (strcmp(yytext, "dtime_t") == 0)
-                new = "timestamp";
-
-       if (new)
-       {
-               struct _yy_buffer *yb;
-
-               yb = mm_alloc(sizeof(struct _yy_buffer));
-
-               yb->buffer =  YY_CURRENT_BUFFER;
-               yb->lineno = yylineno;
-               yb->filename = mm_strdup(input_filename);
-               yb->next = yy_buffer;
-               yy_buffer = yb;
-
-               yy_scan_string(new);
-               return true;
-       }
-
-       return false;
-}
-
 /*
  * Called before any actual parsing is done
  */