Skip to content

Commit a9bc069

Browse files
author
Michael Meskes
committed
- Removed duplicate include of ecpgtype.h which meant I had to adapt all expected results.
- Changed INFORMIX mode symbol definition yet again because the old way didn't work on NetBSD. Hopefully this one does.
1 parent b120382 commit a9bc069

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+52
-63
lines changed

src/interfaces/ecpg/ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2317,3 +2317,8 @@ Fri, 15 Feb 2008 12:01:13 +0100
23172317

23182318
- Changed the way symbols are defined in C in INFORMIX mode.
23192319

2320+
Sun, 17 Feb 2008 18:45:39 +0100
2321+
2322+
- Removed duplicate include of ecpgtype.h.
2323+
- Changed INFORMIX mode symbol definition yet again because the old
2324+
way didn't work on NetBSD.
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/datetime.h,v 1.15 2008/02/15 11:20:21 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/datetime.h,v 1.16 2008/02/17 18:14:29 meskes Exp $ */
22

33
#ifndef _ECPG_DATETIME_H
44
#define _ECPG_DATETIME_H
55

66
#include <ecpg_informix.h>
77

8-
/* brought in by ecpg_informix.h nowadays
9-
* typedef timestamp dtime_t;
10-
* typedef interval intrvl_t; */
8+
#ifndef _ECPGLIB_H /* source created by ecpg which defines these symbols */
9+
typedef timestamp dtime_t;
10+
typedef interval intrvl_t;
11+
#endif /* ndef _ECPGLIB_H */
1112

1213
#endif /* ndef _ECPG_DATETIME_H */

src/interfaces/ecpg/include/decimal.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/decimal.h,v 1.17 2008/02/15 11:20:21 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/include/decimal.h,v 1.18 2008/02/17 18:14:29 meskes Exp $ */
22

33
#ifndef _ECPG_DECIMAL_H
44
#define _ECPG_DECIMAL_H
55

66
#include <ecpg_informix.h>
77

8-
/* brought in by ecpg_informix.h nowadays
9-
* typedef decimal dec_t; */
8+
#ifndef _ECPGLIB_H /* source created by ecpg which defines this symbol */
9+
typedef decimal dec_t;
10+
#endif /* ndef _ECPGLIB_H */
1011

1112
#endif /* ndef _ECPG_DECIMAL_H */

src/interfaces/ecpg/include/ecpg_informix.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* This file contains stuff needed to be as compatible to Informix as possible.
3-
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.21 2008/02/15 11:20:21 meskes Exp $
3+
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.22 2008/02/17 18:14:29 meskes Exp $
44
*/
55
#ifndef _ECPG_INFORMIX_H
66
#define _ECPG_INFORMIX_H
@@ -82,11 +82,6 @@ extern int dttofmtasc(timestamp *, char *, int, char *);
8282
extern int intoasc(interval *, char *);
8383
extern int dtcvfmtasc(char *, char *, timestamp *);
8484

85-
/* we also define Informix datatypes here */
86-
typedef timestamp dtime_t;
87-
typedef interval intrvl_t;
88-
typedef decimal dec_t;
89-
9085
#ifdef __cplusplus
9186
}
9287
#endif

src/interfaces/ecpg/preproc/ecpg.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.103 2007/12/21 14:33:20 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.104 2008/02/17 18:14:29 meskes Exp $ */
22

33
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
44
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -439,7 +439,7 @@ main(int argc, char *const argv[])
439439

440440
if (header_mode == false)
441441
{
442-
fprintf(yyout, "/* These include files are added by the preprocessor */\n#include <ecpgtype.h>\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n");
442+
fprintf(yyout, "/* These include files are added by the preprocessor */\n#include <ecpglib.h>\n#include <ecpgerrno.h>\n#include <sqlca.h>\n");
443443

444444
/* add some compatibility headers */
445445
if (INFORMIX_MODE)

src/interfaces/ecpg/preproc/pgc.l

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.162 2008/02/15 11:20:21 meskes Exp $
15+
* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.163 2008/02/17 18:14:29 meskes Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -47,6 +47,7 @@ static void addlitchar (unsigned char);
4747
static void parse_include (void);
4848
static bool ecpg_isspace(char ch);
4949
static bool isdefine(void);
50+
static bool isinformixdefine(void);
5051

5152
char *token_start;
5253
int state_before;
@@ -743,7 +744,9 @@ cppline {space}*#(.*\\{space})*.*{newline}
743744
<C>{identifier} {
744745
const ScanKeyword *keyword;
745746

746-
if (!isdefine())
747+
/* Informix uses SQL defines only in SQL space */
748+
/* however, some defines have to be taken care of for compatibility */
749+
if ((!INFORMIX_MODE || !isinformixdefine()) && !isdefine())
747750
{
748751
keyword = ScanCKeywordLookup(yytext);
749752
if (keyword != NULL)
@@ -1315,6 +1318,36 @@ static bool isdefine(void)
13151318
return false;
13161319
}
13171320

1321+
static bool isinformixdefine(void)
1322+
{
1323+
const char *new = NULL;
1324+
1325+
if (strcmp(yytext, "dec_t") == 0)
1326+
new = "decimal";
1327+
else if (strcmp(yytext, "intrvl_t") == 0)
1328+
new = "interval";
1329+
else if (strcmp(yytext, "dtime_t") == 0)
1330+
new = "timestamp";
1331+
1332+
if (new)
1333+
{
1334+
struct _yy_buffer *yb;
1335+
1336+
yb = mm_alloc(sizeof(struct _yy_buffer));
1337+
1338+
yb->buffer = YY_CURRENT_BUFFER;
1339+
yb->lineno = yylineno;
1340+
yb->filename = mm_strdup(input_filename);
1341+
yb->next = yy_buffer;
1342+
yy_buffer = yb;
1343+
1344+
yy_scan_string(new);
1345+
return true;
1346+
}
1347+
1348+
return false;
1349+
}
1350+
13181351
/*
13191352
* Called before any actual parsing is done
13201353
*/

src/interfaces/ecpg/test/expected/compat_informix-charfuncs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* Processed by ecpg (regression mode) */
22
/* These include files are added by the preprocessor */
3-
#include <ecpgtype.h>
43
#include <ecpglib.h>
54
#include <ecpgerrno.h>
65
#include <sqlca.h>

src/interfaces/ecpg/test/expected/compat_informix-dec_test.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* Processed by ecpg (regression mode) */
22
/* These include files are added by the preprocessor */
3-
#include <ecpgtype.h>
43
#include <ecpglib.h>
54
#include <ecpgerrno.h>
65
#include <sqlca.h>

src/interfaces/ecpg/test/expected/compat_informix-rfmtdate.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* Processed by ecpg (regression mode) */
22
/* These include files are added by the preprocessor */
3-
#include <ecpgtype.h>
43
#include <ecpglib.h>
54
#include <ecpgerrno.h>
65
#include <sqlca.h>

src/interfaces/ecpg/test/expected/compat_informix-rfmtlong.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* Processed by ecpg (regression mode) */
22
/* These include files are added by the preprocessor */
3-
#include <ecpgtype.h>
43
#include <ecpglib.h>
54
#include <ecpgerrno.h>
65
#include <sqlca.h>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy