Skip to content
Snippets Groups Projects
Commit ad8c09c2 authored by Peter Eisentraut's avatar Peter Eisentraut
Browse files

Move Informix compatibility include files out of the way. compatlib.h

was integrated into ecpg_informix.h, the other ones go into their own
subdirectory that is automatically considered by the embedded preprocessor
when in Informix mode.
parent b4ed1edb
No related branches found
No related tags found
No related merge requests found
......@@ -2,16 +2,22 @@ subdir = src/interfaces/ecpg/include
top_builddir = ../../../..
include $(top_builddir)/src/Makefile.global
informix_esql_dir = $(pkgincludedir)/informix/esql
install: all installdirs install-headers
.PHONY: install-headers
ecpg_headers = ecpgerrno.h ecpglib.h ecpgtype.h sqlca.h sql3types.h ecpg_informix.h pgtypes_error.h pgtypes_numeric.h pgtypes_timestamp.h pgtypes_date.h datetime.h decimal.h pgtypes_interval.h sqltypes.h compatlib.h sqlda.h
ecpg_headers = ecpgerrno.h ecpglib.h ecpgtype.h sqlca.h sql3types.h ecpg_informix.h \
pgtypes_error.h pgtypes_numeric.h pgtypes_timestamp.h pgtypes_date.h pgtypes_interval.h
informix_headers = datetime.h decimal.h sqltypes.h sqlda.h
install-headers: $(ecpg_headers)
for i in $^; do $(INSTALL_DATA) $$i $(DESTDIR)$(includedir); done
install-headers: $(ecpg_headers) $(informix_headers)
for i in $(ecpg_headers); do $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(includedir) || exit; done
for i in $(informix_headers); do $(INSTALL_DATA) $(srcdir)/$$i $(DESTDIR)$(informix_esql_dir) || exit; done
installdirs:
$(mkinstalldirs) $(DESTDIR)$(includedir)
$(mkinstalldirs) $(DESTDIR)$(includedir) $(DESTDIR)$(informix_esql_dir)
uninstall:
rm -f $(addprefix $(DESTDIR)$(includedir)/, $(ecpg_headers))
rm -f $(addprefix $(DESTDIR)$(informix_esql_dir)/, $(informix_headers))
#ifndef _COMPATLIB_H
#define _COMPATLIB_H
/*
* This file contains stuff needed to be as compatible to other DBMS as possible.
*/
#include <ecpglib.h>
#include <pgtypes_date.h>
#include <pgtypes_interval.h>
#include <pgtypes_numeric.h>
#include <pgtypes_timestamp.h>
/* The following stuff is for Informix compatibility */
#define SQLNOTFOUND 100
#define ECPG_INFORMIX_NUM_OVERFLOW -1200
#define ECPG_INFORMIX_NUM_UNDERFLOW -1201
#define ECPG_INFORMIX_DIVIDE_ZERO -1202
#define ECPG_INFORMIX_BAD_YEAR -1204
#define ECPG_INFORMIX_BAD_MONTH -1205
#define ECPG_INFORMIX_BAD_DAY -1206
#define ECPG_INFORMIX_ENOSHORTDATE -1209
#define ECPG_INFORMIX_DATE_CONVERT -1210
#define ECPG_INFORMIX_OUT_OF_MEMORY -1211
#define ECPG_INFORMIX_ENOTDMY -1212
#define ECPG_INFORMIX_BAD_NUMERIC -1213
#define ECPG_INFORMIX_BAD_EXPONENT -1216
#define ECPG_INFORMIX_BAD_DATE -1218
#define ECPG_INFORMIX_EXTRA_CHARS -1264
extern int rdatestr(date, char *);
extern void rtoday(date *);
extern int rjulmdy(date, short *);
extern int rdefmtdate(date *, char *, char *);
extern int rfmtdate(date, char *, char *);
extern int rmdyjul(short *, date *);
extern int rstrdate(char *, date *);
extern int rdayofweek(date);
extern int rfmtlong(long, char *, char *);
extern int rgetmsg(int, char *, int);
extern int risnull(int, char *);
extern int rsetnull(int, char *);
extern int rtypalign(int, int);
extern int rtypmsize(int, int);
extern int rtypwidth(int, int);
extern void rupshift(char *);
extern int byleng(char *, int);
extern void ldchar(char *, int, char *);
extern void ECPG_informix_set_var(int, void *, int);
extern void *ECPG_informix_get_var(int);
/* Informix defines these in decimal.h */
int decadd(decimal *, decimal *, decimal *);
int deccmp(decimal *, decimal *);
void deccopy(decimal *, decimal *);
int deccvasc(char *, int, decimal *);
int deccvdbl(double, decimal *);
int deccvint(int, decimal *);
int deccvlong(long, decimal *);
int decdiv(decimal *, decimal *, decimal *);
int decmul(decimal *, decimal *, decimal *);
int decsub(decimal *, decimal *, decimal *);
int dectoasc(decimal *, char *, int, int);
int dectodbl(decimal *, double *);
int dectoint(decimal *, int *);
int dectolong(decimal *, long *);
/* Informix defines these in datetime.h */
extern void dtcurrent(timestamp *);
extern int dtcvasc(char *, timestamp *);
extern int dtsub(timestamp *, timestamp *, interval *);
extern int dttoasc(timestamp *, char *);
extern int dttofmtasc(timestamp *, char *, int, char *);
extern int intoasc(interval *, char *);
extern int dtcvfmtasc(char *, char *, timestamp *);
#endif /* ndef _COMPATLIB_H */
#ifndef _ECPG_DATETIME_H
#define _ECPG_DATETIME_H
#include <compatlib.h>
#include <ecpg_informix.h>
typedef timestamp dtime_t;
typedef interval intrvl_t;
......
#ifndef _ECPG_DECIMAL_H
#define _ECPG_DECIMAL_H
#include <compatlib.h>
#include <ecpg_informix.h>
typedef decimal dec_t;
......
#ifndef _ECPG_INFORMIX_H
#define _ECPG_INFORMIX_H
/*
* This file contains stuff needed to be as compatible to Informix as possible.
*
* $PostgreSQL: pgsql/src/interfaces/ecpg/include/ecpg_informix.h,v 1.14 2003/12/18 18:55:09 petere Exp $
*/
#ifndef _ECPG_INFORMIX_H
#define _ECPG_INFORMIX_H
#include <ecpglib.h>
#include <pgtypes_date.h>
#include <pgtypes_interval.h>
#include <pgtypes_numeric.h>
#include <pgtypes_timestamp.h>
#define SQLNOTFOUND 100
#define ECPG_INFORMIX_NUM_OVERFLOW -1200
#define ECPG_INFORMIX_NUM_UNDERFLOW -1201
#define ECPG_INFORMIX_DIVIDE_ZERO -1202
#define ECPG_INFORMIX_BAD_YEAR -1204
#define ECPG_INFORMIX_BAD_MONTH -1205
#define ECPG_INFORMIX_BAD_DAY -1206
#define ECPG_INFORMIX_ENOSHORTDATE -1209
#define ECPG_INFORMIX_DATE_CONVERT -1210
#define ECPG_INFORMIX_OUT_OF_MEMORY -1211
#define ECPG_INFORMIX_ENOTDMY -1212
#define ECPG_INFORMIX_BAD_NUMERIC -1213
#define ECPG_INFORMIX_BAD_EXPONENT -1216
#define ECPG_INFORMIX_BAD_DATE -1218
#define ECPG_INFORMIX_EXTRA_CHARS -1264
extern int rdatestr(date, char *);
extern void rtoday(date *);
extern int rjulmdy(date, short *);
extern int rdefmtdate(date *, char *, char *);
extern int rfmtdate(date, char *, char *);
extern int rmdyjul(short *, date *);
extern int rstrdate(char *, date *);
extern int rdayofweek(date);
extern int rfmtlong(long, char *, char *);
extern int rgetmsg(int, char *, int);
extern int risnull(int, char *);
extern int rsetnull(int, char *);
extern int rtypalign(int, int);
extern int rtypmsize(int, int);
extern int rtypwidth(int, int);
extern void rupshift(char *);
extern int byleng(char *, int);
extern void ldchar(char *, int, char *);
extern void ECPG_informix_set_var(int, void *, int);
extern void *ECPG_informix_get_var(int);
/* Informix defines these in decimal.h */
int decadd(decimal *, decimal *, decimal *);
int deccmp(decimal *, decimal *);
void deccopy(decimal *, decimal *);
int deccvasc(char *, int, decimal *);
int deccvdbl(double, decimal *);
int deccvint(int, decimal *);
int deccvlong(long, decimal *);
int decdiv(decimal *, decimal *, decimal *);
int decmul(decimal *, decimal *, decimal *);
int decsub(decimal *, decimal *, decimal *);
int dectoasc(decimal *, char *, int, int);
int dectodbl(decimal *, double *);
int dectoint(decimal *, int *);
int dectolong(decimal *, long *);
#include <decimal.h>
#include <datetime.h>
#include <compatlib.h>
/* Informix defines these in datetime.h */
extern void dtcurrent(timestamp *);
extern int dtcvasc(char *, timestamp *);
extern int dtsub(timestamp *, timestamp *, interval *);
extern int dttoasc(timestamp *, char *);
extern int dttofmtasc(timestamp *, char *, int, char *);
extern int intoasc(interval *, char *);
extern int dtcvfmtasc(char *, char *, timestamp *);
#endif /* ndef _ECPG_INFORMIX_H */
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.96 2003/11/30 06:09:47 momjian Exp $
# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.97 2003/12/18 18:55:09 petere Exp $
subdir = src/interfaces/ecpg/preproc
top_builddir = ../../../..
......@@ -11,7 +11,8 @@ PATCHLEVEL=0
override CPPFLAGS := -I$(srcdir)/../include -I$(srcdir) $(CPPFLAGS) $(THREAD_CPPFLAGS) \
-DMAJOR_VERSION=$(MAJOR_VERSION) \
-DMINOR_VERSION=$(MINOR_VERSION) -DPATCHLEVEL=$(PATCHLEVEL) \
-DINCLUDE_PATH=\"$(includedir)\"
-DINCLUDEDIR=\"$(includedir)\" \
-DPKGINCLUDEDIR=\"$(pkgincludedir)\"
ifeq ($(GCC), yes)
override CFLAGS += -Wno-error
......
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.82 2003/11/29 19:52:08 pgsql Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.83 2003/12/18 18:55:09 petere Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
......@@ -174,6 +174,7 @@ main(int argc, char *const argv[])
add_preprocessor_define("dec_t=decimal");
add_preprocessor_define("intrvl_t=interval");
add_preprocessor_define("dtime_t=timestamp");
add_include_path(PKGINCLUDEDIR "/informix/esql");
}
else
{
......@@ -209,7 +210,7 @@ main(int argc, char *const argv[])
add_include_path(".");
add_include_path("/usr/local/include");
add_include_path(INCLUDE_PATH);
add_include_path(INCLUDEDIR);
add_include_path("/usr/include");
if (verbose)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment