diff options
| author | Bruce Momjian | 2004-08-30 02:54:42 +0000 |
|---|---|---|
| committer | Bruce Momjian | 2004-08-30 02:54:42 +0000 |
| commit | 15d3f9f6b7849a70281f151f0def7a6d335767d7 (patch) | |
| tree | 98d285e17c671a56e484e98916703280e1947a78 /src/interfaces/ecpg | |
| parent | 166300f318f5b4795c0f7679144a1c23c0118163 (diff) | |
Another pgindent run with lib typedefs added.
Diffstat (limited to 'src/interfaces/ecpg')
| -rw-r--r-- | src/interfaces/ecpg/compatlib/informix.c | 54 | ||||
| -rw-r--r-- | src/interfaces/ecpg/include/pgtypes_interval.h | 2 | ||||
| -rw-r--r-- | src/interfaces/ecpg/include/pgtypes_numeric.h | 6 | ||||
| -rw-r--r-- | src/interfaces/ecpg/pgtypeslib/datetime.c | 10 | ||||
| -rw-r--r-- | src/interfaces/ecpg/pgtypeslib/dt_common.c | 2 | ||||
| -rw-r--r-- | src/interfaces/ecpg/pgtypeslib/interval.c | 6 | ||||
| -rw-r--r-- | src/interfaces/ecpg/pgtypeslib/numeric.c | 52 | ||||
| -rw-r--r-- | src/interfaces/ecpg/pgtypeslib/timestamp.c | 12 | ||||
| -rw-r--r-- | src/interfaces/ecpg/preproc/keywords.c | 679 |
9 files changed, 412 insertions, 411 deletions
diff --git a/src/interfaces/ecpg/compatlib/informix.c b/src/interfaces/ecpg/compatlib/informix.c index d8d95c03ccc..8acfc1ecf07 100644 --- a/src/interfaces/ecpg/compatlib/informix.c +++ b/src/interfaces/ecpg/compatlib/informix.c @@ -15,7 +15,7 @@ char *ECPGalloc(long, int); static int -deccall2(decimal * arg1, decimal * arg2, int (*ptr) (numeric *, numeric *)) +deccall2(decimal *arg1, decimal *arg2, int (*ptr) (numeric *, numeric *)) { numeric *a1, *a2; @@ -53,7 +53,7 @@ deccall2(decimal * arg1, decimal * arg2, int (*ptr) (numeric *, numeric *)) } static int -deccall3(decimal * arg1, decimal * arg2, decimal * result, int (*ptr) (numeric *, numeric *, numeric *)) +deccall3(decimal *arg1, decimal *arg2, decimal *result, int (*ptr) (numeric *, numeric *, numeric *)) { numeric *a1, *a2, @@ -118,7 +118,7 @@ deccall3(decimal * arg1, decimal * arg2, decimal * result, int (*ptr) (numeric * /* we start with the numeric functions */ int -decadd(decimal * arg1, decimal * arg2, decimal * sum) +decadd(decimal *arg1, decimal *arg2, decimal *sum) { deccall3(arg1, arg2, sum, PGTYPESnumeric_add); @@ -131,13 +131,13 @@ decadd(decimal * arg1, decimal * arg2, decimal * sum) } int -deccmp(decimal * arg1, decimal * arg2) +deccmp(decimal *arg1, decimal *arg2) { return (deccall2(arg1, arg2, PGTYPESnumeric_cmp)); } void -deccopy(decimal * src, decimal * target) +deccopy(decimal *src, decimal *target) { memcpy(target, src, sizeof(decimal)); } @@ -162,7 +162,7 @@ ecpg_strndup(const char *str, size_t len) } int -deccvasc(char *cp, int len, decimal * np) +deccvasc(char *cp, int len, decimal *np) { char *str = ecpg_strndup(cp, len); /* decimal_in always * converts the complete @@ -208,7 +208,7 @@ deccvasc(char *cp, int len, decimal * np) } int -deccvdbl(double dbl, decimal * np) +deccvdbl(double dbl, decimal *np) { numeric *nres = PGTYPESnumeric_new(); int result = 1; @@ -229,7 +229,7 @@ deccvdbl(double dbl, decimal * np) } int -deccvint(int in, decimal * np) +deccvint(int in, decimal *np) { numeric *nres = PGTYPESnumeric_new(); int result = 1; @@ -250,7 +250,7 @@ deccvint(int in, decimal * np) } int -deccvlong(long lng, decimal * np) +deccvlong(long lng, decimal *np) { numeric *nres = PGTYPESnumeric_new(); int result = 1; @@ -271,7 +271,7 @@ deccvlong(long lng, decimal * np) } int -decdiv(decimal * n1, decimal * n2, decimal * result) +decdiv(decimal *n1, decimal *n2, decimal *result) { int i; @@ -296,7 +296,7 @@ decdiv(decimal * n1, decimal * n2, decimal * result) } int -decmul(decimal * n1, decimal * n2, decimal * result) +decmul(decimal *n1, decimal *n2, decimal *result) { int i; @@ -317,7 +317,7 @@ decmul(decimal * n1, decimal * n2, decimal * result) } int -decsub(decimal * n1, decimal * n2, decimal * result) +decsub(decimal *n1, decimal *n2, decimal *result) { int i; @@ -338,7 +338,7 @@ decsub(decimal * n1, decimal * n2, decimal * result) } int -dectoasc(decimal * np, char *cp, int len, int right) +dectoasc(decimal *np, char *cp, int len, int right) { char *str; numeric *nres = PGTYPESnumeric_new(); @@ -373,7 +373,7 @@ dectoasc(decimal * np, char *cp, int len, int right) } int -dectodbl(decimal * np, double *dblp) +dectodbl(decimal *np, double *dblp) { numeric *nres = PGTYPESnumeric_new(); int i; @@ -391,7 +391,7 @@ dectodbl(decimal * np, double *dblp) } int -dectoint(decimal * np, int *ip) +dectoint(decimal *np, int *ip) { int ret; numeric *nres = PGTYPESnumeric_new(); @@ -411,7 +411,7 @@ dectoint(decimal * np, int *ip) } int -dectolong(decimal * np, long *lngp) +dectolong(decimal *np, long *lngp) { int ret; numeric *nres = PGTYPESnumeric_new();; @@ -453,7 +453,7 @@ rdatestr(date d, char *str) * */ int -rstrdate(char *str, date * d) +rstrdate(char *str, date *d) { date dat; char strbuf[10]; @@ -511,7 +511,7 @@ rstrdate(char *str, date * d) } void -rtoday(date * d) +rtoday(date *d) { PGTYPESdate_today(d); return; @@ -530,7 +530,7 @@ rjulmdy(date d, short mdy[3]) } int -rdefmtdate(date * d, char *fmt, char *str) +rdefmtdate(date *d, char *fmt, char *str) { /* TODO: take care of DBCENTURY environment variable */ /* PGSQL functions allow all centuries */ @@ -567,7 +567,7 @@ rfmtdate(date d, char *fmt, char *str) } int -rmdyjul(short mdy[3], date * d) +rmdyjul(short mdy[3], date *d) { int mdy_int[3]; @@ -587,13 +587,13 @@ rdayofweek(date d) /* And the datetime stuff */ void -dtcurrent(timestamp * ts) +dtcurrent(timestamp *ts) { PGTYPEStimestamp_current(ts); } int -dtcvasc(char *str, timestamp * ts) +dtcvasc(char *str, timestamp *ts) { timestamp ts_tmp; int i; @@ -616,13 +616,13 @@ dtcvasc(char *str, timestamp * ts) } int -dtsub(timestamp * ts1, timestamp * ts2, interval * iv) +dtsub(timestamp *ts1, timestamp *ts2, interval *iv) { return PGTYPEStimestamp_sub(ts1, ts2, iv); } int -dttoasc(timestamp * ts, char *output) +dttoasc(timestamp *ts, char *output) { char *asctime = PGTYPEStimestamp_to_asc(*ts); @@ -632,13 +632,13 @@ dttoasc(timestamp * ts, char *output) } int -dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr) +dttofmtasc(timestamp *ts, char *output, int str_len, char *fmtstr) { return PGTYPEStimestamp_fmt_asc(ts, output, str_len, fmtstr); } int -intoasc(interval * i, char *str) +intoasc(interval *i, char *str) { str = PGTYPESinterval_to_asc(i); @@ -963,7 +963,7 @@ rtypwidth(int sqltype, int sqllen) } int -dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue) +dtcvfmtasc(char *inbuf, char *fmtstr, timestamp *dtvalue) { return PGTYPEStimestamp_defmt_asc(inbuf, fmtstr, dtvalue); } diff --git a/src/interfaces/ecpg/include/pgtypes_interval.h b/src/interfaces/ecpg/include/pgtypes_interval.h index f1edf1618cb..fba723f40d5 100644 --- a/src/interfaces/ecpg/include/pgtypes_interval.h +++ b/src/interfaces/ecpg/include/pgtypes_interval.h @@ -12,7 +12,7 @@ typedef struct #endif long month; /* months and years, after time for * alignment */ -} interval; +} interval; #ifdef __cplusplus extern "C" diff --git a/src/interfaces/ecpg/include/pgtypes_numeric.h b/src/interfaces/ecpg/include/pgtypes_numeric.h index d4846a337ab..70856728cd6 100644 --- a/src/interfaces/ecpg/include/pgtypes_numeric.h +++ b/src/interfaces/ecpg/include/pgtypes_numeric.h @@ -23,7 +23,7 @@ typedef struct * NUMERIC_NAN */ NumericDigit *buf; /* start of alloc'd space for digits[] */ NumericDigit *digits; /* decimal digits */ -} numeric; +} numeric; typedef struct { @@ -35,14 +35,14 @@ typedef struct int sign; /* NUMERIC_POS, NUMERIC_NEG, or * NUMERIC_NAN */ NumericDigit digits[DECSIZE]; /* decimal digits */ -} decimal; +} decimal; #ifdef __cplusplus extern "C" { #endif - numeric * PGTYPESnumeric_new(void); +numeric *PGTYPESnumeric_new(void); void PGTYPESnumeric_free(numeric *); numeric *PGTYPESnumeric_from_asc(char *, char **); char *PGTYPESnumeric_to_asc(numeric *, int); diff --git a/src/interfaces/ecpg/pgtypeslib/datetime.c b/src/interfaces/ecpg/pgtypeslib/datetime.c index cc8788af578..30781d734f5 100644 --- a/src/interfaces/ecpg/pgtypeslib/datetime.c +++ b/src/interfaces/ecpg/pgtypeslib/datetime.c @@ -111,7 +111,7 @@ PGTYPESdate_julmdy(date jd, int *mdy) } void -PGTYPESdate_mdyjul(int *mdy, date * jdate) +PGTYPESdate_mdyjul(int *mdy, date *jdate) { /* month is mdy[0] */ /* day is mdy[1] */ @@ -124,14 +124,14 @@ int PGTYPESdate_dayofweek(date dDate) { /* - * Sunday: 0 Monday: 1 Tuesday: 2 Wednesday: 3 Thursday: - * 4 Friday: 5 Saturday: 6 + * Sunday: 0 Monday: 1 Tuesday: 2 Wednesday: 3 Thursday: 4 + * Friday: 5 Saturday: 6 */ return (int) (dDate + date2j(2000, 1, 1) + 1) % 7; } void -PGTYPESdate_today(date * d) +PGTYPESdate_today(date *d) { struct tm ts; @@ -316,7 +316,7 @@ PGTYPESdate_fmt_asc(date dDate, char *fmtstring, char *outbuf) #define PGTYPES_DATE_MONTH_MAXLENGTH 20 /* probably even less :-) */ int -PGTYPESdate_defmt_asc(date * d, char *fmt, char *str) +PGTYPESdate_defmt_asc(date *d, char *fmt, char *str) { /* * token[2] = { 4,6 } means that token 2 starts at position 4 and ends diff --git a/src/interfaces/ecpg/pgtypeslib/dt_common.c b/src/interfaces/ecpg/pgtypeslib/dt_common.c index a5a13f8b537..f906b449b08 100644 --- a/src/interfaces/ecpg/pgtypeslib/dt_common.c +++ b/src/interfaces/ecpg/pgtypeslib/dt_common.c @@ -2729,7 +2729,7 @@ int PGTYPEStimestamp_defmt_scan(char **, char *, timestamp *, int *, int *, int int *, int *, int *, int *); int -PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d, +PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp *d, int *year, int *month, int *day, int *hour, int *minute, int *second, int *tz) diff --git a/src/interfaces/ecpg/pgtypeslib/interval.c b/src/interfaces/ecpg/pgtypeslib/interval.c index 39576bf369e..e1d34e8a7b2 100644 --- a/src/interfaces/ecpg/pgtypeslib/interval.c +++ b/src/interfaces/ecpg/pgtypeslib/interval.c @@ -720,7 +720,7 @@ interval2tm(interval span, struct tm * tm, fsec_t *fsec) } /* interval2tm() */ static int -tm2interval(struct tm * tm, fsec_t fsec, interval * span) +tm2interval(struct tm * tm, fsec_t fsec, interval *span) { span->month = ((tm->tm_year * 12) + tm->tm_mon); #ifdef HAVE_INT64_TIMESTAMP @@ -797,7 +797,7 @@ PGTYPESinterval_from_asc(char *str, char **endptr) } char * -PGTYPESinterval_to_asc(interval * span) +PGTYPESinterval_to_asc(interval *span) { struct tm tt, *tm = &tt; @@ -821,7 +821,7 @@ PGTYPESinterval_to_asc(interval * span) } int -PGTYPESinterval_copy(interval * intvlsrc, interval * intrcldest) +PGTYPESinterval_copy(interval *intvlsrc, interval *intrcldest) { intrcldest->time = intvlsrc->time; intrcldest->month = intvlsrc->month; diff --git a/src/interfaces/ecpg/pgtypeslib/numeric.c b/src/interfaces/ecpg/pgtypeslib/numeric.c index a79d8bcf90c..a59a7478d80 100644 --- a/src/interfaces/ecpg/pgtypeslib/numeric.c +++ b/src/interfaces/ecpg/pgtypeslib/numeric.c @@ -28,7 +28,7 @@ * ---------- */ static int -apply_typmod(numeric * var, long typmod) +apply_typmod(numeric *var, long typmod) { int precision; int scale; @@ -108,7 +108,7 @@ apply_typmod(numeric * var, long typmod) * ---------- */ static int -alloc_var(numeric * var, int ndigits) +alloc_var(numeric *var, int ndigits) { digitbuf_free(var->buf); var->buf = digitbuf_alloc(ndigits + 1); @@ -141,7 +141,7 @@ PGTYPESnumeric_new(void) * ---------- */ static int -set_var_from_str(char *str, char **ptr, numeric * dest) +set_var_from_str(char *str, char **ptr, numeric *dest) { bool have_dp = FALSE; int i = 0; @@ -271,7 +271,7 @@ set_var_from_str(char *str, char **ptr, numeric * dest) * ---------- */ static char * -get_str_from_var(numeric * var, int dscale) +get_str_from_var(numeric *var, int dscale) { char *str; char *cp; @@ -385,7 +385,7 @@ PGTYPESnumeric_from_asc(char *str, char **endptr) } char * -PGTYPESnumeric_to_asc(numeric * num, int dscale) +PGTYPESnumeric_to_asc(numeric *num, int dscale) { if (dscale < 0) dscale = num->dscale; @@ -401,7 +401,7 @@ PGTYPESnumeric_to_asc(numeric * num, int dscale) * ---------- */ static void -zero_var(numeric * var) +zero_var(numeric *var) { digitbuf_free(var->buf); var->buf = NULL; @@ -412,7 +412,7 @@ zero_var(numeric * var) } void -PGTYPESnumeric_free(numeric * var) +PGTYPESnumeric_free(numeric *var) { digitbuf_free(var->buf); free(var); @@ -428,7 +428,7 @@ PGTYPESnumeric_free(numeric * var) * ---------- */ static int -cmp_abs(numeric * var1, numeric * var2) +cmp_abs(numeric *var1, numeric *var2) { int i1 = 0; int i2 = 0; @@ -486,7 +486,7 @@ cmp_abs(numeric * var1, numeric * var2) * ---------- */ static int -add_abs(numeric * var1, numeric * var2, numeric * result) +add_abs(numeric *var1, numeric *var2, numeric *result) { NumericDigit *res_buf; NumericDigit *res_digits; @@ -574,7 +574,7 @@ add_abs(numeric * var1, numeric * var2, numeric * result) * ---------- */ static int -sub_abs(numeric * var1, numeric * var2, numeric * result) +sub_abs(numeric *var1, numeric *var2, numeric *result) { NumericDigit *res_buf; NumericDigit *res_digits; @@ -658,7 +658,7 @@ sub_abs(numeric * var1, numeric * var2, numeric * result) * ---------- */ int -PGTYPESnumeric_add(numeric * var1, numeric * var2, numeric * result) +PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result) { /* * Decide on the signs of the two variables what to do @@ -787,7 +787,7 @@ PGTYPESnumeric_add(numeric * var1, numeric * var2, numeric * result) * ---------- */ int -PGTYPESnumeric_sub(numeric * var1, numeric * var2, numeric * result) +PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result) { /* * Decide on the signs of the two variables what to do @@ -918,7 +918,7 @@ PGTYPESnumeric_sub(numeric * var1, numeric * var2, numeric * result) * ---------- */ int -PGTYPESnumeric_mul(numeric * var1, numeric * var2, numeric * result) +PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result) { NumericDigit *res_buf; NumericDigit *res_digits; @@ -1009,7 +1009,7 @@ PGTYPESnumeric_mul(numeric * var1, numeric * var2, numeric * result) * Note that this must be called before div_var. */ static int -select_div_scale(numeric * var1, numeric * var2, int *rscale) +select_div_scale(numeric *var1, numeric *var2, int *rscale) { int weight1, weight2, @@ -1076,7 +1076,7 @@ select_div_scale(numeric * var1, numeric * var2, int *rscale) } int -PGTYPESnumeric_div(numeric * var1, numeric * var2, numeric * result) +PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result) { NumericDigit *res_digits; int res_ndigits; @@ -1282,7 +1282,7 @@ PGTYPESnumeric_div(numeric * var1, numeric * var2, numeric * result) int -PGTYPESnumeric_cmp(numeric * var1, numeric * var2) +PGTYPESnumeric_cmp(numeric *var1, numeric *var2) { /* use cmp_abs function to calculate the result */ @@ -1313,7 +1313,7 @@ PGTYPESnumeric_cmp(numeric * var1, numeric * var2) } int -PGTYPESnumeric_from_int(signed int int_val, numeric * var) +PGTYPESnumeric_from_int(signed int int_val, numeric *var) { /* implicit conversion */ signed long int long_int = int_val; @@ -1322,7 +1322,7 @@ PGTYPESnumeric_from_int(signed int int_val, numeric * var) } int -PGTYPESnumeric_from_long(signed long int long_val, numeric * var) +PGTYPESnumeric_from_long(signed long int long_val, numeric *var) { /* calculate the size of the long int number */ /* a number n needs log_10 n digits */ @@ -1392,7 +1392,7 @@ PGTYPESnumeric_from_long(signed long int long_val, numeric * var) } int -PGTYPESnumeric_copy(numeric * src, numeric * dst) +PGTYPESnumeric_copy(numeric *src, numeric *dst) { int i; @@ -1415,7 +1415,7 @@ PGTYPESnumeric_copy(numeric * src, numeric * dst) } int -PGTYPESnumeric_from_double(double d, numeric * dst) +PGTYPESnumeric_from_double(double d, numeric *dst) { char buffer[100]; numeric *tmp; @@ -1432,7 +1432,7 @@ PGTYPESnumeric_from_double(double d, numeric * dst) } static int -numericvar_to_double_no_overflow(numeric * var, double *dp) +numericvar_to_double_no_overflow(numeric *var, double *dp) { char *tmp; double val; @@ -1456,7 +1456,7 @@ numericvar_to_double_no_overflow(numeric * var, double *dp) } int -PGTYPESnumeric_to_double(numeric * nv, double *dp) +PGTYPESnumeric_to_double(numeric *nv, double *dp) { double tmp; int i; @@ -1468,7 +1468,7 @@ PGTYPESnumeric_to_double(numeric * nv, double *dp) } int -PGTYPESnumeric_to_int(numeric * nv, int *ip) +PGTYPESnumeric_to_int(numeric *nv, int *ip) { long l; int i; @@ -1487,7 +1487,7 @@ PGTYPESnumeric_to_int(numeric * nv, int *ip) } int -PGTYPESnumeric_to_long(numeric * nv, long *lp) +PGTYPESnumeric_to_long(numeric *nv, long *lp) { int i; long l = 0; @@ -1515,7 +1515,7 @@ PGTYPESnumeric_to_long(numeric * nv, long *lp) } int -PGTYPESnumeric_to_decimal(numeric * src, decimal * dst) +PGTYPESnumeric_to_decimal(numeric *src, decimal *dst) { int i; @@ -1538,7 +1538,7 @@ PGTYPESnumeric_to_decimal(numeric * src, decimal * dst) } int -PGTYPESnumeric_from_decimal(decimal * src, numeric * dst) +PGTYPESnumeric_from_decimal(decimal *src, numeric *dst) { int i; diff --git a/src/interfaces/ecpg/pgtypeslib/timestamp.c b/src/interfaces/ecpg/pgtypeslib/timestamp.c index 671d42e67d2..fc168170396 100644 --- a/src/interfaces/ecpg/pgtypeslib/timestamp.c +++ b/src/interfaces/ecpg/pgtypeslib/timestamp.c @@ -50,7 +50,7 @@ dt2local(timestamp dt, int tz) * Returns -1 on failure (overflow). */ int -tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp * result) +tm2timestamp(struct tm * tm, fsec_t fsec, int *tzp, timestamp *result) { #ifdef HAVE_INT64_TIMESTAMP int dDate; @@ -372,7 +372,7 @@ PGTYPEStimestamp_to_asc(timestamp tstamp) } void -PGTYPEStimestamp_current(timestamp * ts) +PGTYPEStimestamp_current(timestamp *ts) { struct tm tm; @@ -382,7 +382,7 @@ PGTYPEStimestamp_current(timestamp * ts) } static int -dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm, +dttofmtasc_replace(timestamp *ts, date dDate, int dow, struct tm * tm, char *output, int *pstr_len, char *fmtstr) { union un_fmt_comb replace_val; @@ -772,7 +772,7 @@ dttofmtasc_replace(timestamp * ts, date dDate, int dow, struct tm * tm, int -PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, char *fmtstr) +PGTYPEStimestamp_fmt_asc(timestamp *ts, char *output, int str_len, char *fmtstr) { struct tm tm; fsec_t fsec; @@ -787,7 +787,7 @@ PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, char *fmtstr } int -PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv) +PGTYPEStimestamp_sub(timestamp *ts1, timestamp *ts2, interval *iv) { if (TIMESTAMP_NOT_FINITE(*ts1) || TIMESTAMP_NOT_FINITE(*ts2)) return PGTYPES_TS_ERR_EINFTIME; @@ -804,7 +804,7 @@ PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv) } int -PGTYPEStimestamp_defmt_asc(char *str, char *fmt, timestamp * d) +PGTYPEStimestamp_defmt_asc(char *str, char *fmt, timestamp *d) { int year, month, diff --git a/src/interfaces/ecpg/preproc/keywords.c b/src/interfaces/ecpg/preproc/keywords.c index 5004f0eff00..004e533267b 100644 --- a/src/interfaces/ecpg/preproc/keywords.c +++ b/src/interfaces/ecpg/preproc/keywords.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.65 2004/08/29 04:13:11 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/keywords.c,v 1.66 2004/08/30 02:54:41 momjian Exp $ * *------------------------------------------------------------------------- */ @@ -42,300 +42,300 @@ static ScanKeyword ScanKeywords[] = { {"analyze", ANALYZE}, {"and", AND}, {"any", ANY}, - {"array", ARRAY}, - {"as", AS}, - {"asc", ASC}, - {"assertion", ASSERTION}, - {"assignment", ASSIGNMENT}, - {"at", AT}, - {"authorization", AUTHORIZATION}, - {"backward", BACKWARD}, - {"before", BEFORE}, - {"begin", BEGIN_P}, - {"between", BETWEEN}, - {"bigint", BIGINT}, - {"binary", BINARY}, - {"bit", BIT}, - {"boolean", BOOLEAN_P}, - {"both", BOTH}, - {"by", BY}, - {"cache", CACHE}, - {"called", CALLED}, - {"cascade", CASCADE}, - {"case", CASE}, - {"cast", CAST}, - {"chain", CHAIN}, - {"char", CHAR_P}, - {"character", CHARACTER}, - {"characteristics", CHARACTERISTICS}, - {"check", CHECK}, - {"checkpoint", CHECKPOINT}, - {"class", CLASS}, - {"close", CLOSE}, - {"cluster", CLUSTER}, - {"coalesce", COALESCE}, - {"collate", COLLATE}, - {"column", COLUMN}, - {"comment", COMMENT}, - {"commit", COMMIT}, - {"committed", COMMITTED}, - {"constraint", CONSTRAINT}, - {"constraints", CONSTRAINTS}, - {"conversion", CONVERSION_P}, - {"convert", CONVERT}, - {"copy", COPY}, - {"create", CREATE}, - {"createdb", CREATEDB}, - {"createuser", CREATEUSER}, - {"cross", CROSS}, - {"csv", CSV}, - {"current_date", CURRENT_DATE}, - {"current_time", CURRENT_TIME}, - {"current_timestamp", CURRENT_TIMESTAMP}, - {"current_user", CURRENT_USER}, - {"cursor", CURSOR}, - {"cycle", CYCLE}, - {"database", DATABASE}, - {"day", DAY_P}, - {"deallocate", DEALLOCATE}, - {"dec", DEC}, - {"decimal", DECIMAL_P}, - {"declare", DECLARE}, - {"default", DEFAULT}, - {"defaults", DEFAULTS}, - {"deferrable", DEFERRABLE}, - {"deferred", DEFERRED}, - {"definer", DEFINER}, - {"delete", DELETE_P}, - {"delimiter", DELIMITER}, - {"delimiters", DELIMITERS}, - {"desc", DESC}, - {"distinct", DISTINCT}, - {"do", DO}, - {"domain", DOMAIN_P}, - {"double", DOUBLE_P}, - {"drop", DROP}, - {"each", EACH}, - {"else", ELSE}, - {"encoding", ENCODING}, - {"encrypted", ENCRYPTED}, - {"end", END_P}, - {"escape", ESCAPE}, - {"except", EXCEPT}, - {"excluding", EXCLUDING}, - {"exclusive", EXCLUSIVE}, - {"execute", EXECUTE}, - {"exists", EXISTS}, - {"explain", EXPLAIN}, - {"external", EXTERNAL}, - {"extract", EXTRACT}, - {"false", FALSE_P}, - {"fetch", FETCH}, - {"first", FIRST_P}, - {"float", FLOAT_P}, - {"for", FOR}, - {"force", FORCE}, - {"foreign", FOREIGN}, - {"forward", FORWARD}, - {"freeze", FREEZE}, - {"from", FROM}, - {"full", FULL}, - {"function", FUNCTION}, - {"get", GET}, - {"global", GLOBAL}, - {"grant", GRANT}, - {"group", GROUP_P}, - {"handler", HANDLER}, - {"having", HAVING}, - {"hold", HOLD}, - {"hour", HOUR_P}, - {"ilike", ILIKE}, - {"immediate", IMMEDIATE}, - {"immutable", IMMUTABLE}, - {"implicit", IMPLICIT_P}, - {"in", IN_P}, - {"including", INCLUDING}, - {"increment", INCREMENT}, - {"index", INDEX}, - {"inherits", INHERITS}, - {"initially", INITIALLY}, - {"inner", INNER_P}, - {"inout", INOUT}, - {"input", INPUT_P}, - {"insensitive", INSENSITIVE}, - {"insert", INSERT}, - {"instead", INSTEAD}, - {"int", INT_P}, - {"integer", INTEGER}, - {"intersect", INTERSECT}, - {"interval", INTERVAL}, - {"into", INTO}, - {"invoker", INVOKER}, - {"is", IS}, - {"isnull", ISNULL}, - {"isolation", ISOLATION}, - {"join", JOIN}, - {"key", KEY}, - {"lancompiler", LANCOMPILER}, - {"language", LANGUAGE}, - {"large", LARGE_P}, - {"last", LAST_P}, - {"leading", LEADING}, - {"left", LEFT}, - {"level", LEVEL}, - {"like", LIKE}, - {"limit", LIMIT}, - {"listen", LISTEN}, - {"load", LOAD}, - {"local", LOCAL}, - {"location", LOCATION}, - {"lock", LOCK_P}, - {"match", MATCH}, - {"maxvalue", MAXVALUE}, - {"minute", MINUTE_P}, - {"minvalue", MINVALUE}, - {"mode", MODE}, - {"month", MONTH_P}, - {"move", MOVE}, - {"names", NAMES}, - {"national", NATIONAL}, - {"natural", NATURAL}, - {"nchar", NCHAR}, - {"new", NEW}, - {"next", NEXT}, - {"no", NO}, - {"nocreatedb", NOCREATEDB}, - {"nocreateuser", NOCREATEUSER}, - {"none", NONE}, - {"not", NOT}, - {"nothing", NOTHING}, - {"notify", NOTIFY}, - {"notnull", NOTNULL}, - {"nowait", NOWAIT}, - {"null", NULL_P}, - {"nullif", NULLIF}, - {"numeric", NUMERIC}, - {"object", OBJECT_P}, - {"of", OF}, - {"off", OFF}, - {"offset", OFFSET}, - {"oids", OIDS}, - {"old", OLD}, - {"on", ON}, - {"only", ONLY}, - {"operator", OPERATOR}, - {"option", OPTION}, - {"or", OR}, - {"order", ORDER}, - {"out", OUT_P}, - {"outer", OUTER_P}, - {"overlaps", OVERLAPS}, - {"owner", OWNER}, - {"partial", PARTIAL}, - {"password", PASSWORD}, - {"position", POSITION}, - {"precision", PRECISION}, - {"prepare", PREPARE}, - {"preserve", PRESERVE}, - {"primary", PRIMARY}, - {"prior", PRIOR}, - {"privileges", PRIVILEGES}, - {"procedural", PROCEDURAL}, - {"procedure", PROCEDURE}, - {"quote", QUOTE}, - {"read", READ}, - {"real", REAL}, - {"recheck", RECHECK}, - {"references", REFERENCES}, - {"reindex", REINDEX}, - {"relative", RELATIVE_P}, - {"rename", RENAME}, - {"repeatable", REPEATABLE}, - {"replace", REPLACE}, - {"reset", RESET}, - {"restart", RESTART}, - {"restrict", RESTRICT}, - {"returns", RETURNS}, - {"revoke", REVOKE}, - {"right", RIGHT}, - {"rollback", ROLLBACK}, - {"row", ROW}, - {"rows", ROWS}, - {"rule", RULE}, - {"schema", SCHEMA}, - {"scroll", SCROLL}, - {"second", SECOND_P}, - {"security", SECURITY}, - {"select", SELECT}, - {"sequence", SEQUENCE}, - {"serializable", SERIALIZABLE}, - {"session", SESSION}, - {"session_user", SESSION_USER}, - {"set", SET}, - {"setof", SETOF}, - {"share", SHARE}, - {"show", SHOW}, - {"similar", SIMILAR}, - {"simple", SIMPLE}, - {"smallint", SMALLINT}, - {"some", SOME}, - {"stable", STABLE}, - {"start", START}, - {"statement", STATEMENT}, - {"statistics", STATISTICS}, - {"stdin", STDIN}, - {"stdout", STDOUT}, - {"storage", STORAGE}, - {"strict", STRICT_P}, - {"substring", SUBSTRING}, - {"sysid", SYSID}, - {"table", TABLE}, - {"tablespace", TABLESPACE}, - {"temp", TEMP}, - {"template", TEMPLATE}, - {"temporary", TEMPORARY}, - {"then", THEN}, - {"time", TIME}, - {"timestamp", TIMESTAMP}, - {"to", TO}, - {"toast", TOAST}, - {"trailing", TRAILING}, - {"transaction", TRANSACTION}, - {"treat", TREAT}, - {"trigger", TRIGGER}, - {"trim", TRIM}, - {"true", TRUE_P}, - {"truncate", TRUNCATE}, - {"trusted", TRUSTED}, - {"type", TYPE_P}, - {"uncommitted", UNCOMMITTED}, - {"unencrypted", UNENCRYPTED}, - {"union", UNION}, - {"unique", UNIQUE}, - {"unknown", UNKNOWN}, - {"unlisten", UNLISTEN}, - {"until", UNTIL}, - {"update", UPDATE}, - {"usage", USAGE}, - {"user", USER}, - {"using", USING}, - {"vacuum", VACUUM}, - {"valid", VALID}, - {"values", VALUES}, - {"varchar", VARCHAR}, - {"varying", VARYING}, - {"verbose", VERBOSE}, - {"view", VIEW}, - {"volatile", VOLATILE}, - {"when", WHEN}, - {"where", WHERE}, - {"with", WITH}, - {"without", WITHOUT}, - {"work", WORK}, - {"write", WRITE}, - {"year", YEAR_P}, - {"zone", ZONE}, -}; + {"array", ARRAY}, + {"as", AS}, + {"asc", ASC}, + {"assertion", ASSERTION}, + {"assignment", ASSIGNMENT}, + {"at", AT}, + {"authorization", AUTHORIZATION}, + {"backward", BACKWARD}, + {"before", BEFORE}, + {"begin", BEGIN_P}, + {"between", BETWEEN}, + {"bigint", BIGINT}, + {"binary", BINARY}, + {"bit", BIT}, + {"boolean", BOOLEAN_P}, + {"both", BOTH}, + {"by", BY}, + {"cache", CACHE}, + {"called", CALLED}, + {"cascade", CASCADE}, + {"case", CASE}, + {"cast", CAST}, + {"chain", CHAIN}, + {"char", CHAR_P}, + {"character", CHARACTER}, + {"characteristics", CHARACTERISTICS}, + {"check", CHECK}, + {"checkpoint", CHECKPOINT}, + {"class", CLASS}, + {"close", CLOSE}, + {"cluster", CLUSTER}, + {"coalesce", COALESCE}, + {"collate", COLLATE}, + {"column", COLUMN}, + {"comment", COMMENT}, + {"commit", COMMIT}, + {"committed", COMMITTED}, + {"constraint", CONSTRAINT}, + {"constraints", CONSTRAINTS}, + {"conversion", CONVERSION_P}, + {"convert", CONVERT}, + {"copy", COPY}, + {"create", CREATE}, + {"createdb", CREATEDB}, + {"createuser", CREATEUSER}, + {"cross", CROSS}, + {"csv", CSV}, + {"current_date", CURRENT_DATE}, + {"current_time", CURRENT_TIME}, + {"current_timestamp", CURRENT_TIMESTAMP}, + {"current_user", CURRENT_USER}, + {"cursor", CURSOR}, + {"cycle", CYCLE}, + {"database", DATABASE}, + {"day", DAY_P}, + {"deallocate", DEALLOCATE}, + {"dec", DEC}, + {"decimal", DECIMAL_P}, + {"declare", DECLARE}, + {"default", DEFAULT}, + {"defaults", DEFAULTS}, + {"deferrable", DEFERRABLE}, + {"deferred", DEFERRED}, + {"definer", DEFINER}, + {"delete", DELETE_P}, + {"delimiter", DELIMITER}, + {"delimiters", DELIMITERS}, + {"desc", DESC}, + {"distinct", DISTINCT}, + {"do", DO}, + {"domain", DOMAIN_P}, + {"double", DOUBLE_P}, + {"drop", DROP}, + {"each", EACH}, + {"else", ELSE}, + {"encoding", ENCODING}, + {"encrypted", ENCRYPTED}, + {"end", END_P}, + {"escape", ESCAPE}, + {"except", EXCEPT}, + {"excluding", EXCLUDING}, + {"exclusive", EXCLUSIVE}, + {"execute", EXECUTE}, + {"exists", EXISTS}, + {"explain", EXPLAIN}, + {"external", EXTERNAL}, + {"extract", EXTRACT}, + {"false", FALSE_P}, + {"fetch", FETCH}, + {"first", FIRST_P}, + {"float", FLOAT_P}, + {"for", FOR}, + {"force", FORCE}, + {"foreign", FOREIGN}, + {"forward", FORWARD}, + {"freeze", FREEZE}, + {"from", FROM}, + {"full", FULL}, + {"function", FUNCTION}, + {"get", GET}, + {"global", GLOBAL}, + {"grant", GRANT}, + {"group", GROUP_P}, + {"handler", HANDLER}, + {"having", HAVING}, + {"hold", HOLD}, + {"hour", HOUR_P}, + {"ilike", ILIKE}, + {"immediate", IMMEDIATE}, + {"immutable", IMMUTABLE}, + {"implicit", IMPLICIT_P}, + {"in", IN_P}, + {"including", INCLUDING}, + {"increment", INCREMENT}, + {"index", INDEX}, + {"inherits", INHERITS}, + {"initially", INITIALLY}, + {"inner", INNER_P}, + {"inout", INOUT}, + {"input", INPUT_P}, + {"insensitive", INSENSITIVE}, + {"insert", INSERT}, + {"instead", INSTEAD}, + {"int", INT_P}, + {"integer", INTEGER}, + {"intersect", INTERSECT}, + {"interval", INTERVAL}, + {"into", INTO}, + {"invoker", INVOKER}, + {"is", IS}, + {"isnull", ISNULL}, + {"isolation", ISOLATION}, + {"join", JOIN}, + {"key", KEY}, + {"lancompiler", LANCOMPILER}, + {"language", LANGUAGE}, + {"large", LARGE_P}, + {"last", LAST_P}, + {"leading", LEADING}, + {"left", LEFT}, + {"level", LEVEL}, + {"like", LIKE}, + {"limit", LIMIT}, + {"listen", LISTEN}, + {"load", LOAD}, + {"local", LOCAL}, + {"location", LOCATION}, + {"lock", LOCK_P}, + {"match", MATCH}, + {"maxvalue", MAXVALUE}, + {"minute", MINUTE_P}, + {"minvalue", MINVALUE}, + {"mode", MODE}, + {"month", MONTH_P}, + {"move", MOVE}, + {"names", NAMES}, + {"national", NATIONAL}, + {"natural", NATURAL}, + {"nchar", NCHAR}, + {"new", NEW}, + {"next", NEXT}, + {"no", NO}, + {"nocreatedb", NOCREATEDB}, + {"nocreateuser", NOCREATEUSER}, + {"none", NONE}, + {"not", NOT}, + {"nothing", NOTHING}, + {"notify", NOTIFY}, + {"notnull", NOTNULL}, + {"nowait", NOWAIT}, + {"null", NULL_P}, + {"nullif", NULLIF}, + {"numeric", NUMERIC}, + {"object", OBJECT_P}, + {"of", OF}, + {"off", OFF}, + {"offset", OFFSET}, + {"oids", OIDS}, + {"old", OLD}, + {"on", ON}, + {"only", ONLY}, + {"operator", OPERATOR}, + {"option", OPTION}, + {"or", OR}, + {"order", ORDER}, + {"out", OUT_P}, + {"outer", OUTER_P}, + {"overlaps", OVERLAPS}, + {"owner", OWNER}, + {"partial", PARTIAL}, + {"password", PASSWORD}, + {"position", POSITION}, + {"precision", PRECISION}, + {"prepare", PREPARE}, + {"preserve", PRESERVE}, + {"primary", PRIMARY}, + {"prior", PRIOR}, + {"privileges", PRIVILEGES}, + {"procedural", PROCEDURAL}, + {"procedure", PROCEDURE}, + {"quote", QUOTE}, + {"read", READ}, + {"real", REAL}, + {"recheck", RECHECK}, + {"references", REFERENCES}, + {"reindex", REINDEX}, + {"relative", RELATIVE_P}, + {"rename", RENAME}, + {"repeatable", REPEATABLE}, + {"replace", REPLACE}, + {"reset", RESET}, + {"restart", RESTART}, + {"restrict", RESTRICT}, + {"returns", RETURNS}, + {"revoke", REVOKE}, + {"right", RIGHT}, + {"rollback", ROLLBACK}, + {"row", ROW}, + {"rows", ROWS}, + {"rule", RULE}, + {"schema", SCHEMA}, + {"scroll", SCROLL}, + {"second", SECOND_P}, + {"security", SECURITY}, + {"select", SELECT}, + {"sequence", SEQUENCE}, + {"serializable", SERIALIZABLE}, + {"session", SESSION}, + {"session_user", SESSION_USER}, + {"set", SET}, + {"setof", SETOF}, + {"share", SHARE}, + {"show", SHOW}, + {"similar", SIMILAR}, + {"simple", SIMPLE}, + {"smallint", SMALLINT}, + {"some", SOME}, + {"stable", STABLE}, + {"start", START}, + {"statement", STATEMENT}, + {"statistics", STATISTICS}, + {"stdin", STDIN}, + {"stdout", STDOUT}, + {"storage", STORAGE}, + {"strict", STRICT_P}, + {"substring", SUBSTRING}, + {"sysid", SYSID}, + {"table", TABLE}, + {"tablespace", TABLESPACE}, + {"temp", TEMP}, + {"template", TEMPLATE}, + {"temporary", TEMPORARY}, + {"then", THEN}, + {"time", TIME}, + {"timestamp", TIMESTAMP}, + {"to", TO}, + {"toast", TOAST}, + {"trailing", TRAILING}, + {"transaction", TRANSACTION}, + {"treat", TREAT}, + {"trigger", TRIGGER}, + {"trim", TRIM}, + {"true", TRUE_P}, + {"truncate", TRUNCATE}, + {"trusted", TRUSTED}, + {"type", TYPE_P}, + {"uncommitted", UNCOMMITTED}, + {"unencrypted", UNENCRYPTED}, + {"union", UNION}, + {"unique", UNIQUE}, + {"unknown", UNKNOWN}, + {"unlisten", UNLISTEN}, + {"until", UNTIL}, + {"update", UPDATE}, + {"usage", USAGE}, + {"user", USER}, + {"using", USING}, + {"vacuum", VACUUM}, + {"valid", VALID}, + {"values", VALUES}, + {"varchar", VARCHAR}, + {"varying", VARYING}, + {"verbose", VERBOSE}, + {"view", VIEW}, + {"volatile", VOLATILE}, + {"when", WHEN}, + {"where", WHERE}, + {"with", WITH}, + {"without", WITHOUT}, + {"work", WORK}, + {"write", WRITE}, + {"year", YEAR_P}, + {"zone", ZONE}, + }; /* * ScanKeywordLookup - see if a given word is a keyword @@ -349,53 +349,54 @@ static ScanKeyword ScanKeywords[] = { * keywords are to be matched in this way even though non-keyword identifiers * receive a different case-normalization mapping. */ -ScanKeyword * -ScanKeywordLookup(char *text) -{ - int len, - i; - char word[NAMEDATALEN]; - ScanKeyword *low; - ScanKeyword *high; + ScanKeyword * + ScanKeywordLookup(char *text) + { + int len, + i; + char word[NAMEDATALEN]; + ScanKeyword *low; + ScanKeyword *high; - len = strlen(text); - /* We assume all keywords are shorter than NAMEDATALEN. */ - if (len >= NAMEDATALEN) - return NULL; + len = strlen(text); + /* We assume all keywords are shorter than NAMEDATALEN. */ + if (len >= NAMEDATALEN) + return NULL; - /* - * Apply an ASCII-only downcasing. We must not use tolower() since it - * may produce the wrong translation in some locales (eg, Turkish). - */ - for (i = 0; i < len; i++) - { - char ch = text[i]; + /* + * Apply an ASCII-only downcasing. We must not use tolower() + * since it may produce the wrong translation in some locales (eg, + * Turkish). + */ + for (i = 0; i < len; i++) + { + char ch = text[i]; - if (ch >= 'A' && ch <= 'Z') - ch += 'a' - 'A'; - word[i] = ch; - } - word[len] = '\0'; + if (ch >= 'A' && ch <= 'Z') + ch += 'a' - 'A'; + word[i] = ch; + } + word[len] = '\0'; - /* - * Now do a binary search using plain strcmp() comparison. - */ - low = &ScanKeywords[0]; - high = endof(ScanKeywords) - 1; - while (low <= high) - { - ScanKeyword *middle; - int difference; + /* + * Now do a binary search using plain strcmp() comparison. + */ + low = &ScanKeywords[0]; + high = endof(ScanKeywords) - 1; + while (low <= high) + { + ScanKeyword *middle; + int difference; - middle = low + (high - low) / 2; - difference = strcmp(middle->name, word); - if (difference == 0) - return middle; - else if (difference < 0) - low = middle + 1; - else - high = middle - 1; - } + middle = low + (high - low) / 2; + difference = strcmp(middle->name, word); + if (difference == 0) + return middle; + else if (difference < 0) + low = middle + 1; + else + high = middle - 1; + } - return NULL; -} + return NULL; + } |
