Harmonize parameter names in ecpg code.
authorPeter Geoghegan <pg@bowt.ie>
Thu, 22 Sep 2022 19:53:20 +0000 (12:53 -0700)
committerPeter Geoghegan <pg@bowt.ie>
Thu, 22 Sep 2022 19:53:20 +0000 (12:53 -0700)
Make ecpg function declarations consistently use named parameters.  Also
make sure that the declarations use names that match corresponding names
from function definitions.

Like other recent commits that cleaned up function parameter names, this
commit was written with help from clang-tidy.

Author: Peter Geoghegan <pg@bowt.ie>
Reviewed-By: David Rowley <dgrowleyml@gmail.com>
Discussion: https://postgr.es/m/CAH2-WznJt9CMM9KJTMjJh_zbL5hD9oX44qdJ4aqZtjFi-zA3Tg@mail.gmail.com

18 files changed:
src/interfaces/ecpg/ecpglib/ecpglib_extern.h
src/interfaces/ecpg/include/ecpg_informix.h
src/interfaces/ecpg/include/ecpglib.h
src/interfaces/ecpg/include/pgtypes_date.h
src/interfaces/ecpg/include/pgtypes_interval.h
src/interfaces/ecpg/include/pgtypes_numeric.h
src/interfaces/ecpg/include/pgtypes_timestamp.h
src/interfaces/ecpg/pgtypeslib/dt.h
src/interfaces/ecpg/pgtypeslib/pgtypeslib_extern.h
src/interfaces/ecpg/preproc/c_keywords.c
src/interfaces/ecpg/preproc/ecpg.header
src/interfaces/ecpg/preproc/output.c
src/interfaces/ecpg/preproc/pgc.l
src/interfaces/ecpg/preproc/preproc_extern.h
src/interfaces/ecpg/preproc/type.c
src/interfaces/ecpg/preproc/type.h
src/interfaces/ecpg/test/expected/preproc-outofscope.c
src/interfaces/ecpg/test/expected/sql-sqlda.c

index c438cfb8209ca628bf93d9b602d46af564a9e1bf..8b8f081f27ce8bcc5deea59762caa46cc757ef80 100644 (file)
@@ -172,52 +172,68 @@ bool      ecpg_get_data(const PGresult *, int, int, int, enum ECPGttype type,
 #ifdef ENABLE_THREAD_SAFETY
 void       ecpg_pthreads_init(void);
 #endif
-struct connection *ecpg_get_connection(const char *);
-char      *ecpg_alloc(long, int);
-char      *ecpg_auto_alloc(long, int);
-char      *ecpg_realloc(void *, long, int);
-void       ecpg_free(void *);
-bool       ecpg_init(const struct connection *, const char *, const int);
-char      *ecpg_strdup(const char *, int);
-const char *ecpg_type_name(enum ECPGttype);
-int            ecpg_dynamic_type(Oid);
-int            sqlda_dynamic_type(Oid, enum COMPAT_MODE);
+struct connection *ecpg_get_connection(const char *connection_name);
+char      *ecpg_alloc(long size, int lineno);
+char      *ecpg_auto_alloc(long size, int lineno);
+char      *ecpg_realloc(void *ptr, long size, int lineno);
+void       ecpg_free(void *ptr);
+bool       ecpg_init(const struct connection *con,
+                     const char *connection_name,
+                     const int lineno);
+char      *ecpg_strdup(const char *string, int lineno);
+const char *ecpg_type_name(enum ECPGttype typ);
+int            ecpg_dynamic_type(Oid type);
+int            sqlda_dynamic_type(Oid type, enum COMPAT_MODE compat);
 void       ecpg_clear_auto_mem(void);
 
 struct descriptor *ecpg_find_desc(int line, const char *name);
 
-struct prepared_statement *ecpg_find_prepared_statement(const char *,
-                                                       struct connection *, struct prepared_statement **);
+struct prepared_statement *ecpg_find_prepared_statement(const char *name,
+                                                       struct connection *con,
+                                                       struct prepared_statement **prev_);
 
 bool       ecpg_store_result(const PGresult *results, int act_field,
                              const struct statement *stmt, struct variable *var);
-bool       ecpg_store_input(const int, const bool, const struct variable *, char **, bool);
+bool       ecpg_store_input(const int lineno, const bool force_indicator,
+                            const struct variable *var,
+                            char **tobeinserted_p, bool quote);
 void       ecpg_free_params(struct statement *stmt, bool print);
-bool       ecpg_do_prologue(int, const int, const int, const char *, const bool,
-                            enum ECPG_statement_type, const char *, va_list,
-                            struct statement **);
-bool       ecpg_build_params(struct statement *);
+bool       ecpg_do_prologue(int lineno, const int compat,
+                            const int force_indicator, const char *connection_name,
+                            const bool questionmarks, enum ECPG_statement_type statement_type,
+                            const char *query, va_list args,
+                            struct statement **stmt_out);
+bool       ecpg_build_params(struct statement *stmt);
 bool       ecpg_autostart_transaction(struct statement *stmt);
 bool       ecpg_execute(struct statement *stmt);
-bool       ecpg_process_output(struct statement *, bool);
-void       ecpg_do_epilogue(struct statement *);
-bool       ecpg_do(const int, const int, const int, const char *, const bool,
-                   const int, const char *, va_list);
-
-bool       ecpg_check_PQresult(PGresult *, int, PGconn *, enum COMPAT_MODE);
+bool       ecpg_process_output(struct statement *stmt, bool clear_result);
+void       ecpg_do_epilogue(struct statement *stmt);
+bool       ecpg_do(const int lineno, const int compat,
+                   const int force_indicator, const char *connection_name,
+                   const bool questionmarks, const int st, const char *query,
+                   va_list args);
+
+bool       ecpg_check_PQresult(PGresult *results, int lineno,
+                               PGconn *connection, enum COMPAT_MODE compat);
 void       ecpg_raise(int line, int code, const char *sqlstate, const char *str);
 void       ecpg_raise_backend(int line, PGresult *result, PGconn *conn, int compat);
-char      *ecpg_prepared(const char *, struct connection *);
-bool       ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection *conn);
+char      *ecpg_prepared(const char *name, struct connection *con);
+bool       ecpg_deallocate_all_conn(int lineno, enum COMPAT_MODE c, struct connection *con);
 void       ecpg_log(const char *format,...) pg_attribute_printf(1, 2);
-bool       ecpg_auto_prepare(int, const char *, const int, char **, const char *);
-bool       ecpg_register_prepared_stmt(struct statement *);
+bool       ecpg_auto_prepare(int lineno, const char *connection_name,
+                             const int compat, char **name, const char *query);
+bool       ecpg_register_prepared_stmt(struct statement *stmt);
 void       ecpg_init_sqlca(struct sqlca_t *sqlca);
 
-struct sqlda_compat *ecpg_build_compat_sqlda(int, PGresult *, int, enum COMPAT_MODE);
-void       ecpg_set_compat_sqlda(int, struct sqlda_compat **, const PGresult *, int, enum COMPAT_MODE);
-struct sqlda_struct *ecpg_build_native_sqlda(int, PGresult *, int, enum COMPAT_MODE);
-void       ecpg_set_native_sqlda(int, struct sqlda_struct **, const PGresult *, int, enum COMPAT_MODE);
+struct sqlda_compat *ecpg_build_compat_sqlda(int line, PGresult *res, int row,
+                                            enum COMPAT_MODE compat);
+void       ecpg_set_compat_sqlda(int lineno, struct sqlda_compat **_sqlda,
+                                 const PGresult *res, int row,
+                                 enum COMPAT_MODE compat);
+struct sqlda_struct *ecpg_build_native_sqlda(int line, PGresult *res, int row,
+                                            enum COMPAT_MODE compat);
+void       ecpg_set_native_sqlda(int lineno, struct sqlda_struct **_sqlda,
+                                 const PGresult *res, int row, enum COMPAT_MODE compat);
 unsigned   ecpg_hex_dec_len(unsigned srclen);
 unsigned   ecpg_hex_enc_len(unsigned srclen);
 unsigned   ecpg_hex_encode(const char *src, unsigned len, char *dst);
index a5260a5542762b69872a55e975a0be5566cf991d..5d918c37972f2e6a2ce46a2a633a40b529b7e9f0 100644 (file)
@@ -33,55 +33,55 @@ extern "C"
 {
 #endif
 
-extern int rdatestr(date, char *);
-extern void rtoday(date *);
-extern int rjulmdy(date, short *);
-extern int rdefmtdate(date *, const char *, const char *);
-extern int rfmtdate(date, const char *, char *);
-extern int rmdyjul(short *, date *);
-extern int rstrdate(const char *, date *);
-extern int rdayofweek(date);
+extern int rdatestr(date d, char *str);
+extern void rtoday(date * d);
+extern int rjulmdy(date d, short *mdy);
+extern int rdefmtdate(date * d, const char *fmt, const char *str);
+extern int rfmtdate(date d, const char *fmt, char *str);
+extern int rmdyjul(short *mdy, date * d);
+extern int rstrdate(const char *str, date * d);
+extern int rdayofweek(date d);
 
-extern int rfmtlong(long, const char *, char *);
-extern int rgetmsg(int, char *, int);
-extern int risnull(int, const 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 rfmtlong(long lng_val, const char *fmt, char *outbuf);
+extern int rgetmsg(int msgnum, char *s, int maxsize);
+extern int risnull(int t, const char *ptr);
+extern int rsetnull(int t, char *ptr);
+extern int rtypalign(int offset, int type);
+extern int rtypmsize(int type, int len);
+extern int rtypwidth(int sqltype, int sqllen);
+extern void rupshift(char *str);
 
-extern int byleng(char *, int);
-extern void ldchar(char *, int, char *);
+extern int byleng(char *str, int len);
+extern void ldchar(char *src, int len, char *dest);
 
-extern void ECPG_informix_set_var(int, void *, int);
-extern void *ECPG_informix_get_var(int);
+extern void ECPG_informix_set_var(int number, void *pointer, int lineno);
+extern void *ECPG_informix_get_var(int number);
 extern void ECPG_informix_reset_sqlca(void);
 
 /* Informix defines these in decimal.h */
-int            decadd(decimal *, decimal *, decimal *);
-int            deccmp(decimal *, decimal *);
-void       deccopy(decimal *, decimal *);
-int            deccvasc(const 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 *);
+int            decadd(decimal *arg1, decimal *arg2, decimal *sum);
+int            deccmp(decimal *arg1, decimal *arg2);
+void       deccopy(decimal *src, decimal *target);
+int            deccvasc(const char *cp, int len, decimal *np);
+int            deccvdbl(double dbl, decimal *np);
+int            deccvint(int in, decimal *np);
+int            deccvlong(long lng, decimal *np);
+int            decdiv(decimal *n1, decimal *n2, decimal *result);
+int            decmul(decimal *n1, decimal *n2, decimal *result);
+int            decsub(decimal *n1, decimal *n2, decimal *result);
+int            dectoasc(decimal *np, char *cp, int len, int right);
+int            dectodbl(decimal *np, double *dblp);
+int            dectoint(decimal *np, int *ip);
+int            dectolong(decimal *np, long *lngp);
 
 /* 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 *);
+extern void dtcurrent(timestamp * ts);
+extern int dtcvasc(char *str, timestamp * ts);
+extern int dtsub(timestamp * ts1, timestamp * ts2, interval * iv);
+extern int dttoasc(timestamp * ts, char *output);
+extern int dttofmtasc(timestamp * ts, char *output, int str_len, char *fmtstr);
+extern int intoasc(interval * i, char *str);
+extern int dtcvfmtasc(char *inbuf, char *fmtstr, timestamp * dtvalue);
 
 #ifdef __cplusplus
 }
index 00240109a6ce629c0e33d69765f5f1c0b07dd57c..21a213448306ce13e32c0821c7388bd295f90a90 100644 (file)
@@ -49,20 +49,24 @@ extern "C"
 {
 #endif
 
-void       ECPGdebug(int, FILE *);
-bool       ECPGstatus(int, const char *);
-bool       ECPGsetcommit(int, const char *, const char *);
-bool       ECPGsetconn(int, const char *);
-bool       ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
-bool       ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...);
-bool       ECPGtrans(int, const char *, const char *);
-bool       ECPGdisconnect(int, const char *);
-bool       ECPGprepare(int, const char *, const bool, const char *, const char *);
-bool       ECPGdeallocate(int, int, const char *, const char *);
-bool       ECPGdeallocate_all(int, int, const char *);
-char      *ECPGprepared_statement(const char *, const char *, int);
-PGconn    *ECPGget_PGconn(const char *);
-PGTransactionStatusType ECPGtransactionStatus(const char *);
+void       ECPGdebug(int n, FILE *dbgs);
+bool       ECPGstatus(int lineno, const char *connection_name);
+bool       ECPGsetcommit(int lineno, const char *mode, const char *connection_name);
+bool       ECPGsetconn(int lineno, const char *connection_name);
+bool       ECPGconnect(int lineno, int c, const char *name, const char *user,
+                       const char *passwd, const char *connection_name, int autocommit);
+bool       ECPGdo(const int lineno, const int compat, const int force_indicator,
+                  const char *connection_name, const bool questionmarks,
+                  const int st, const char *query,...);
+bool       ECPGtrans(int lineno, const char *connection_name, const char *transaction);
+bool       ECPGdisconnect(int lineno, const char *connection_name);
+bool       ECPGprepare(int lineno, const char *connection_name, const bool questionmarks,
+                       const char *name, const char *variable);
+bool       ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name);
+bool       ECPGdeallocate_all(int lineno, int compat, const char *connection_name);
+char      *ECPGprepared_statement(const char *connection_name, const char *name, int lineno);
+PGconn    *ECPGget_PGconn(const char *connection_name);
+PGTransactionStatusType ECPGtransactionStatus(const char *connection_name);
 
  /* print an error message */
 void       sqlprint(void);
@@ -74,19 +78,21 @@ void        sqlprint(void);
 
 /* dynamic SQL */
 
-bool       ECPGdo_descriptor(int, const char *, const char *, const char *);
-bool       ECPGdeallocate_desc(int, const char *);
-bool       ECPGallocate_desc(int, const char *);
-bool       ECPGget_desc_header(int, const char *, int *);
-bool       ECPGget_desc(int, const char *, int,...);
-bool       ECPGset_desc_header(int, const char *, int);
-bool       ECPGset_desc(int, const char *, int,...);
-
-void       ECPGset_noind_null(enum ECPGttype, void *);
-bool       ECPGis_noind_null(enum ECPGttype, const void *);
-bool       ECPGdescribe(int, int, bool, const char *, const char *,...);
-
-void       ECPGset_var(int, void *, int);
+bool       ECPGdo_descriptor(int line, const char *connection,
+                             const char *descriptor, const char *query);
+bool       ECPGdeallocate_desc(int line, const char *name);
+bool       ECPGallocate_desc(int line, const char *name);
+bool       ECPGget_desc_header(int lineno, const char *desc_name, int *count);
+bool       ECPGget_desc(int lineno, const char *desc_name, int index,...);
+bool       ECPGset_desc_header(int lineno, const char *desc_name, int count);
+bool       ECPGset_desc(int lineno, const char *desc_name, int index,...);
+
+void       ECPGset_noind_null(enum ECPGttype type, void *ptr);
+bool       ECPGis_noind_null(enum ECPGttype type, const void *ptr);
+bool       ECPGdescribe(int line, int compat, bool input,
+                        const char *connection_name, const char *stmt_name,...);
+
+void       ECPGset_var(int number, void *pointer, int lineno);
 void      *ECPGget_var(int number);
 
 /* dynamic result allocation */
index c668097466e686de94c611983a73692955b00bc1..5490cf8217dacdfb4b7a88bd6494b5e7c8d7013b 100644 (file)
@@ -14,16 +14,16 @@ extern "C"
 #endif
 
 extern date * PGTYPESdate_new(void);
-extern void PGTYPESdate_free(date *);
-extern date PGTYPESdate_from_asc(char *, char **);
-extern char *PGTYPESdate_to_asc(date);
-extern date PGTYPESdate_from_timestamp(timestamp);
-extern void PGTYPESdate_julmdy(date, int *);
-extern void PGTYPESdate_mdyjul(int *, date *);
-extern int PGTYPESdate_dayofweek(date);
-extern void PGTYPESdate_today(date *);
-extern int PGTYPESdate_defmt_asc(date *, const char *, const char *);
-extern int PGTYPESdate_fmt_asc(date, const char *, char *);
+extern void PGTYPESdate_free(date * d);
+extern date PGTYPESdate_from_asc(char *str, char **endptr);
+extern char *PGTYPESdate_to_asc(date dDate);
+extern date PGTYPESdate_from_timestamp(timestamp dt);
+extern void PGTYPESdate_julmdy(date jd, int *mdy);
+extern void PGTYPESdate_mdyjul(int *mdy, date * jdate);
+extern int PGTYPESdate_dayofweek(date dDate);
+extern void PGTYPESdate_today(date * d);
+extern int PGTYPESdate_defmt_asc(date * d, const char *fmt, const char *str);
+extern int PGTYPESdate_fmt_asc(date dDate, const char *fmtstring, char *outbuf);
 
 #ifdef __cplusplus
 }
index 3b17cd1d115652b44ff0a5a2e7d8f9683a08746b..8471b609db51dcd49cda8047da34385863722e1e 100644 (file)
@@ -36,10 +36,10 @@ extern "C"
 #endif
 
 extern interval * PGTYPESinterval_new(void);
-extern void PGTYPESinterval_free(interval *);
-extern interval * PGTYPESinterval_from_asc(char *, char **);
-extern char *PGTYPESinterval_to_asc(interval *);
-extern int PGTYPESinterval_copy(interval *, interval *);
+extern void PGTYPESinterval_free(interval *intvl);
+extern interval * PGTYPESinterval_from_asc(char *str, char **endptr);
+extern char *PGTYPESinterval_to_asc(interval *span);
+extern int PGTYPESinterval_copy(interval *intvlsrc, interval *intvldest);
 
 #ifdef __cplusplus
 }
index 5c763a9eb61a9f0156d5ca432fd1a34d8de49391..61506f44ca851258207b2a2d93ee9ac05dc4548d 100644 (file)
@@ -43,24 +43,24 @@ extern "C"
 
 numeric    *PGTYPESnumeric_new(void);
 decimal    *PGTYPESdecimal_new(void);
-void       PGTYPESnumeric_free(numeric *);
-void       PGTYPESdecimal_free(decimal *);
-numeric    *PGTYPESnumeric_from_asc(char *, char **);
-char      *PGTYPESnumeric_to_asc(numeric *, int);
-int            PGTYPESnumeric_add(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_sub(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_mul(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_div(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_cmp(numeric *, numeric *);
-int            PGTYPESnumeric_from_int(signed int, numeric *);
-int            PGTYPESnumeric_from_long(signed long int, numeric *);
-int            PGTYPESnumeric_copy(numeric *, numeric *);
-int            PGTYPESnumeric_from_double(double, numeric *);
-int            PGTYPESnumeric_to_double(numeric *, double *);
-int            PGTYPESnumeric_to_int(numeric *, int *);
-int            PGTYPESnumeric_to_long(numeric *, long *);
-int            PGTYPESnumeric_to_decimal(numeric *, decimal *);
-int            PGTYPESnumeric_from_decimal(decimal *, numeric *);
+void       PGTYPESnumeric_free(numeric *var);
+void       PGTYPESdecimal_free(decimal *var);
+numeric    *PGTYPESnumeric_from_asc(char *str, char **endptr);
+char      *PGTYPESnumeric_to_asc(numeric *num, int dscale);
+int            PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_cmp(numeric *var1, numeric *var2);
+int            PGTYPESnumeric_from_int(signed int int_val, numeric *var);
+int            PGTYPESnumeric_from_long(signed long int long_val, numeric *var);
+int            PGTYPESnumeric_copy(numeric *src, numeric *dst);
+int            PGTYPESnumeric_from_double(double d, numeric *dst);
+int            PGTYPESnumeric_to_double(numeric *nv, double *dp);
+int            PGTYPESnumeric_to_int(numeric *nv, int *ip);
+int            PGTYPESnumeric_to_long(numeric *nv, long *lp);
+int            PGTYPESnumeric_to_decimal(numeric *src, decimal *dst);
+int            PGTYPESnumeric_from_decimal(decimal *src, numeric *dst);
 
 #ifdef __cplusplus
 }
index 3e2983789124f3070073694261e5c9b4af2220cf..412ecc2d41145ee1e769b96a24eebdd1d280b1fd 100644 (file)
@@ -15,12 +15,12 @@ extern "C"
 {
 #endif
 
-extern timestamp PGTYPEStimestamp_from_asc(char *, char **);
-extern char *PGTYPEStimestamp_to_asc(timestamp);
-extern int PGTYPEStimestamp_sub(timestamp *, timestamp *, interval *);
-extern int PGTYPEStimestamp_fmt_asc(timestamp *, char *, int, const char *);
-extern void PGTYPEStimestamp_current(timestamp *);
-extern int PGTYPEStimestamp_defmt_asc(const char *, const char *, timestamp *);
+extern timestamp PGTYPEStimestamp_from_asc(char *str, char **endptr);
+extern char *PGTYPEStimestamp_to_asc(timestamp tstamp);
+extern int PGTYPEStimestamp_sub(timestamp * ts1, timestamp * ts2, interval * iv);
+extern int PGTYPEStimestamp_fmt_asc(timestamp * ts, char *output, int str_len, const char *fmtstr);
+extern void PGTYPEStimestamp_current(timestamp * ts);
+extern int PGTYPEStimestamp_defmt_asc(const char *str, const char *fmt, timestamp * d);
 extern int PGTYPEStimestamp_add_interval(timestamp * tin, interval * span, timestamp * tout);
 extern int PGTYPEStimestamp_sub_interval(timestamp * tin, interval * span, timestamp * tout);
 
index 893c9b6194e4437a9651c7cae2fe7522785ba46a..1ec38791f81348e6a05cdf483f945c63737ba85e 100644 (file)
@@ -311,22 +311,22 @@ do { \
 #define TIMESTAMP_IS_NOEND(j)  ((j) == DT_NOEND)
 #define TIMESTAMP_NOT_FINITE(j) (TIMESTAMP_IS_NOBEGIN(j) || TIMESTAMP_IS_NOEND(j))
 
-int            DecodeInterval(char **, int *, int, int *, struct tm *, fsec_t *);
-int            DecodeTime(char *, int *, struct tm *, fsec_t *);
+int            DecodeInterval(char **field, int *ftype, int nf, int *dtype, struct tm *tm, fsec_t *fsec);
+int            DecodeTime(char *str, int *tmask, struct tm *tm, fsec_t *fsec);
 void       EncodeDateTime(struct tm *tm, fsec_t fsec, bool print_tz, int tz, const char *tzn, int style, char *str, bool EuroDates);
 void       EncodeInterval(struct tm *tm, fsec_t fsec, int style, char *str);
-int            tm2timestamp(struct tm *, fsec_t, int *, timestamp *);
+int            tm2timestamp(struct tm *tm, fsec_t fsec, int *tzp, timestamp *result);
 int            DecodeUnits(int field, char *lowtoken, int *val);
 bool       CheckDateTokenTables(void);
 void       EncodeDateOnly(struct tm *tm, int style, char *str, bool EuroDates);
-int            GetEpochTime(struct tm *);
-int            ParseDateTime(char *, char *, char **, int *, int *, char **);
-int            DecodeDateTime(char **, int *, int, int *, struct tm *, fsec_t *, bool);
-void       j2date(int, int *, int *, int *);
-void       GetCurrentDateTime(struct tm *);
-int            date2j(int, int, int);
-void       TrimTrailingZeros(char *);
-void       dt2time(double, int *, int *, int *, fsec_t *);
+int            GetEpochTime(struct tm *tm);
+int            ParseDateTime(char *timestr, char *lowstr, char **field, int *ftype, int *numfields, char **endstr);
+int            DecodeDateTime(char **field, int *ftype, int nf, int *dtype, struct tm *tm, fsec_t *fsec, bool EuroDates);
+void       j2date(int jd, int *year, int *month, int *day);
+void       GetCurrentDateTime(struct tm *tm);
+int            date2j(int y, int m, int d);
+void       TrimTrailingZeros(char *str);
+void       dt2time(double jd, int *hour, int *min, int *sec, fsec_t *fsec);
 int            PGTYPEStimestamp_defmt_scan(char **str, char *fmt, timestamp * d,
                                        int *year, int *month, int *day,
                                        int *hour, int *minute, int *second,
index 1012088b79fe867cab16e118248e34ed0d06eccd..8e980966b0e6ead1465c2d91c533560246dec9d9 100644 (file)
@@ -33,9 +33,11 @@ union un_fmt_comb
    int64       int64_val;
 };
 
-int            pgtypes_fmt_replace(union un_fmt_comb, int, char **, int *);
+int            pgtypes_fmt_replace(union un_fmt_comb replace_val,
+                               int replace_type, char **output,
+                               int *pstr_len);
 
-char      *pgtypes_alloc(long);
-char      *pgtypes_strdup(const char *);
+char      *pgtypes_alloc(long size);
+char      *pgtypes_strdup(const char *str);
 
 #endif                         /* _ECPG_PGTYPESLIB_EXTERN_H */
index e51c036101ea8ef5502f3b2501b705cfb67f93e5..14f20e2d25da3e06b3d0ef1660e38f7196ee5260 100644 (file)
@@ -33,7 +33,7 @@ static const uint16 ScanCKeywordTokens[] = {
  * ScanKeywordLookup(), except we want case-sensitive matching.
  */
 int
-ScanCKeywordLookup(const char *str)
+ScanCKeywordLookup(const char *text)
 {
    size_t      len;
    int         h;
@@ -43,7 +43,7 @@ ScanCKeywordLookup(const char *str)
     * Reject immediately if too long to be any keyword.  This saves useless
     * hashing work on long strings.
     */
-   len = strlen(str);
+   len = strlen(text);
    if (len > ScanCKeywords.max_kw_len)
        return -1;
 
@@ -51,7 +51,7 @@ ScanCKeywordLookup(const char *str)
     * Compute the hash function.  Since it's a perfect hash, we need only
     * match to the specific keyword it identifies.
     */
-   h = ScanCKeywords_hash_func(str, len);
+   h = ScanCKeywords_hash_func(text, len);
 
    /* An out-of-range result implies no match */
    if (h < 0 || h >= ScanCKeywords.num_keywords)
@@ -59,7 +59,7 @@ ScanCKeywordLookup(const char *str)
 
    kw = GetScanKeyword(h, &ScanCKeywords);
 
-   if (strcmp(kw, str) == 0)
+   if (strcmp(kw, text) == 0)
        return ScanCKeywordTokens[h];
 
    return -1;
index b8508a91238f9cd69e5b0ee414156d2383e62cb0..595028942560c13707b16156254e4e161b8503f0 100644 (file)
@@ -64,7 +64,7 @@ static struct ECPGtype ecpg_query = {ECPGt_char_variable, NULL, NULL, NULL, {NUL
 
 static void vmmerror(int error_code, enum errortype type, const char *error, va_list ap) pg_attribute_printf(3, 0);
 
-static bool check_declared_list(const char*);
+static bool check_declared_list(const char *name);
 
 /*
  * Handle parsing errors and warnings
index cf8aadd0b12188d89c161352a92a89a1cafceb47..6c0b8a27b1eb4b7d032065d99f9e775e7d61d514 100644 (file)
@@ -4,7 +4,7 @@
 
 #include "preproc_extern.h"
 
-static void output_escaped_str(char *cmd, bool quoted);
+static void output_escaped_str(char *str, bool quoted);
 
 void
 output_line_number(void)
index c344f8f30fc5f156897ef8798e7a105190a79a2f..c145c9698f1a064da5bd8dda100bd51b57f0d144 100644 (file)
@@ -56,7 +56,7 @@ static bool       include_next;
 
 #define startlit() (literalbuf[0] = '\0', literallen = 0)
 static void addlit(char *ytext, int yleng);
-static void addlitchar(unsigned char);
+static void addlitchar(unsigned char ychar);
 static int process_integer_literal(const char *token, YYSTYPE *lval);
 static void parse_include(void);
 static bool ecpg_isspace(char ch);
index 6be59b7193f22501d52341271903bfc20041ae10..c5fd07fbd8b52e15fc76b5d4611233971dd0d359 100644 (file)
@@ -65,41 +65,50 @@ extern const uint16 SQLScanKeywordTokens[];
 extern const char *get_dtype(enum ECPGdtype);
 extern void lex_init(void);
 extern void output_line_number(void);
-extern void output_statement(char *, int, enum ECPG_statement_type);
-extern void output_prepare_statement(char *, char *);
-extern void output_deallocate_prepare_statement(char *);
-extern void output_simple_statement(char *, int);
+extern void output_statement(char *stmt, int whenever_mode, enum ECPG_statement_type st);
+extern void output_prepare_statement(char *name, char *stmt);
+extern void output_deallocate_prepare_statement(char *name);
+extern void output_simple_statement(char *stmt, int whenever_mode);
 extern char *hashline_number(void);
 extern int base_yyparse(void);
 extern int base_yylex(void);
-extern void base_yyerror(const char *);
-extern void *mm_alloc(size_t);
-extern char *mm_strdup(const char *);
-extern void mmerror(int errorcode, enum errortype type, const char *error,...) pg_attribute_printf(3, 4);
-extern void mmfatal(int errorcode, const char *error,...) pg_attribute_printf(2, 3) pg_attribute_noreturn();
-extern void output_get_descr_header(char *);
-extern void output_get_descr(char *, char *);
-extern void output_set_descr_header(char *);
-extern void output_set_descr(char *, char *);
-extern void push_assignment(char *, enum ECPGdtype);
-extern struct variable *find_variable(char *);
-extern void whenever_action(int);
-extern void add_descriptor(char *, char *);
-extern void drop_descriptor(char *, char *);
-extern struct descriptor *lookup_descriptor(char *, char *);
+extern void base_yyerror(const char *error);
+extern void *mm_alloc(size_t size);
+extern char *mm_strdup(const char *string);
+extern void mmerror(int error_code, enum errortype type, const char *error,...) pg_attribute_printf(3, 4);
+extern void mmfatal(int error_code, const char *error,...) pg_attribute_printf(2, 3) pg_attribute_noreturn();
+extern void output_get_descr_header(char *desc_name);
+extern void output_get_descr(char *desc_name, char *index);
+extern void output_set_descr_header(char *desc_name);
+extern void output_set_descr(char *desc_name, char *index);
+extern void push_assignment(char *var, enum ECPGdtype value);
+extern struct variable *find_variable(char *name);
+extern void whenever_action(int mode);
+extern void add_descriptor(char *name, char *connection);
+extern void drop_descriptor(char *name, char *connection);
+extern struct descriptor *lookup_descriptor(char *name, char *connection);
 extern struct variable *descriptor_variable(const char *name, int input);
 extern struct variable *sqlda_variable(const char *name);
-extern void add_variable_to_head(struct arguments **, struct variable *, struct variable *);
-extern void add_variable_to_tail(struct arguments **, struct variable *, struct variable *);
+extern void add_variable_to_head(struct arguments **list,
+                                struct variable *var,
+                                struct variable *ind);
+extern void add_variable_to_tail(struct arguments **list,
+                                struct variable *var,
+                                struct variable *ind);
 extern void remove_variable_from_list(struct arguments **list, struct variable *var);
-extern void dump_variables(struct arguments *, int);
+extern void dump_variables(struct arguments *list, int mode);
 extern struct typedefs *get_typedef(const char *name, bool noerror);
-extern void adjust_array(enum ECPGttype, char **, char **, char *, char *, int, bool);
+extern void adjust_array(enum ECPGttype type_enum, char **dimension,
+                        char **length, char *type_dimension,
+                        char *type_index, int pointer_len,
+                        bool type_definition);
 extern void reset_variables(void);
-extern void check_indicator(struct ECPGtype *);
-extern void remove_typedefs(int);
-extern void remove_variables(int);
-extern struct variable *new_variable(const char *, struct ECPGtype *, int);
+extern void check_indicator(struct ECPGtype *var);
+extern void remove_typedefs(int brace_level);
+extern void remove_variables(int brace_level);
+extern struct variable *new_variable(const char *name,
+                                    struct ECPGtype *type,
+                                    int brace_level);
 extern int ScanCKeywordLookup(const char *text);
 extern int ScanECPGKeywordLookup(const char *text);
 extern void parser_init(void);
index d4b4da5ffcda34fda463fa3d36b5078c72912fc6..58119d1102996a2d71a52c001ee8d8ea81917c97 100644 (file)
@@ -233,7 +233,7 @@ get_type(enum ECPGttype type)
  */
 static void ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
                              char *varcharsize,
-                             char *arrsize, const char *size, const char *prefix, int);
+                             char *arrsize, const char *size, const char *prefix, int counter);
 static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsize,
                              struct ECPGtype *type, struct ECPGtype *ind_type, const char *prefix, const char *ind_prefix);
 
index 08b739e5f35abd7caf25c62f4baca67393656f6c..5935cd747306377d8a7ec8184149490f8d671c11 100644 (file)
@@ -33,15 +33,18 @@ struct ECPGtype
 };
 
 /* Everything is malloced. */
-void       ECPGmake_struct_member(const char *, struct ECPGtype *, struct ECPGstruct_member **);
-struct ECPGtype *ECPGmake_simple_type(enum ECPGttype, char *, int);
-struct ECPGtype *ECPGmake_array_type(struct ECPGtype *, char *);
-struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *, enum ECPGttype, char *, char *);
-struct ECPGstruct_member *ECPGstruct_member_dup(struct ECPGstruct_member *);
+void       ECPGmake_struct_member(const char *name, struct ECPGtype *type,
+                                  struct ECPGstruct_member **start);
+struct ECPGtype *ECPGmake_simple_type(enum ECPGttype type, char *size, int counter);
+struct ECPGtype *ECPGmake_array_type(struct ECPGtype *type, char *size);
+struct ECPGtype *ECPGmake_struct_type(struct ECPGstruct_member *rm,
+                                     enum ECPGttype type, char *type_name,
+                                     char *struct_sizeof);
+struct ECPGstruct_member *ECPGstruct_member_dup(struct ECPGstruct_member *rm);
 
 /* Frees a type. */
-void       ECPGfree_struct_member(struct ECPGstruct_member *);
-void       ECPGfree_type(struct ECPGtype *);
+void       ECPGfree_struct_member(struct ECPGstruct_member *rm);
+void       ECPGfree_type(struct ECPGtype *type);
 
 /* Dump a type.
    The type is dumped as:
@@ -53,10 +56,12 @@ void        ECPGfree_type(struct ECPGtype *);
    size is the maxsize in case it is a varchar. Otherwise it is the size of
       the variable (required to do array fetches of structs).
  */
-void       ECPGdump_a_type(FILE *, const char *, struct ECPGtype *, const int,
-                           const char *, struct ECPGtype *, const int,
-                           const char *, const char *, char *,
-                           const char *, const char *);
+void       ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *type,
+                           const int brace_level, const char *ind_name,
+                           struct ECPGtype *ind_type, const int ind_brace_level,
+                           const char *prefix, const char *ind_prefix,
+                           char *arr_str_size, const char *struct_sizeof,
+                           const char *ind_struct_sizeof);
 
 /* A simple struct to keep a variable and its type. */
 struct ECPGtemp_type
index 3a27c53e174322c3c560e5d7dd99cc85af93c8c2..a040a69014d0a53623a2c972ffce4f6f48ef65a6 100644 (file)
@@ -70,24 +70,24 @@ extern "C"
 
 numeric    *PGTYPESnumeric_new(void);
 decimal    *PGTYPESdecimal_new(void);
-void       PGTYPESnumeric_free(numeric *);
-void       PGTYPESdecimal_free(decimal *);
-numeric    *PGTYPESnumeric_from_asc(char *, char **);
-char      *PGTYPESnumeric_to_asc(numeric *, int);
-int            PGTYPESnumeric_add(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_sub(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_mul(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_div(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_cmp(numeric *, numeric *);
-int            PGTYPESnumeric_from_int(signed int, numeric *);
-int            PGTYPESnumeric_from_long(signed long int, numeric *);
-int            PGTYPESnumeric_copy(numeric *, numeric *);
-int            PGTYPESnumeric_from_double(double, numeric *);
-int            PGTYPESnumeric_to_double(numeric *, double *);
-int            PGTYPESnumeric_to_int(numeric *, int *);
-int            PGTYPESnumeric_to_long(numeric *, long *);
-int            PGTYPESnumeric_to_decimal(numeric *, decimal *);
-int            PGTYPESnumeric_from_decimal(decimal *, numeric *);
+void       PGTYPESnumeric_free(numeric *var);
+void       PGTYPESdecimal_free(decimal *var);
+numeric    *PGTYPESnumeric_from_asc(char *str, char **endptr);
+char      *PGTYPESnumeric_to_asc(numeric *num, int dscale);
+int            PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_cmp(numeric *var1, numeric *var2);
+int            PGTYPESnumeric_from_int(signed int int_val, numeric *var);
+int            PGTYPESnumeric_from_long(signed long int long_val, numeric *var);
+int            PGTYPESnumeric_copy(numeric *src, numeric *dst);
+int            PGTYPESnumeric_from_double(double d, numeric *dst);
+int            PGTYPESnumeric_to_double(numeric *nv, double *dp);
+int            PGTYPESnumeric_to_int(numeric *nv, int *ip);
+int            PGTYPESnumeric_to_long(numeric *nv, long *lp);
+int            PGTYPESnumeric_to_decimal(numeric *src, decimal *dst);
+int            PGTYPESnumeric_from_decimal(decimal *src, numeric *dst);
 
 #ifdef __cplusplus
 }
index d474bd38bf604c7948838b5b296ed6ccdf482604..ee1a674271f57f3f7dab85b282a1957959dd95de 100644 (file)
@@ -92,24 +92,24 @@ extern "C"
 
 numeric    *PGTYPESnumeric_new(void);
 decimal    *PGTYPESdecimal_new(void);
-void       PGTYPESnumeric_free(numeric *);
-void       PGTYPESdecimal_free(decimal *);
-numeric    *PGTYPESnumeric_from_asc(char *, char **);
-char      *PGTYPESnumeric_to_asc(numeric *, int);
-int            PGTYPESnumeric_add(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_sub(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_mul(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_div(numeric *, numeric *, numeric *);
-int            PGTYPESnumeric_cmp(numeric *, numeric *);
-int            PGTYPESnumeric_from_int(signed int, numeric *);
-int            PGTYPESnumeric_from_long(signed long int, numeric *);
-int            PGTYPESnumeric_copy(numeric *, numeric *);
-int            PGTYPESnumeric_from_double(double, numeric *);
-int            PGTYPESnumeric_to_double(numeric *, double *);
-int            PGTYPESnumeric_to_int(numeric *, int *);
-int            PGTYPESnumeric_to_long(numeric *, long *);
-int            PGTYPESnumeric_to_decimal(numeric *, decimal *);
-int            PGTYPESnumeric_from_decimal(decimal *, numeric *);
+void       PGTYPESnumeric_free(numeric *var);
+void       PGTYPESdecimal_free(decimal *var);
+numeric    *PGTYPESnumeric_from_asc(char *str, char **endptr);
+char      *PGTYPESnumeric_to_asc(numeric *num, int dscale);
+int            PGTYPESnumeric_add(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_sub(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_mul(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_div(numeric *var1, numeric *var2, numeric *result);
+int            PGTYPESnumeric_cmp(numeric *var1, numeric *var2);
+int            PGTYPESnumeric_from_int(signed int int_val, numeric *var);
+int            PGTYPESnumeric_from_long(signed long int long_val, numeric *var);
+int            PGTYPESnumeric_copy(numeric *src, numeric *dst);
+int            PGTYPESnumeric_from_double(double d, numeric *dst);
+int            PGTYPESnumeric_to_double(numeric *nv, double *dp);
+int            PGTYPESnumeric_to_int(numeric *nv, int *ip);
+int            PGTYPESnumeric_to_long(numeric *nv, long *lp);
+int            PGTYPESnumeric_to_decimal(numeric *src, decimal *dst);
+int            PGTYPESnumeric_from_decimal(decimal *src, numeric *dst);
 
 #ifdef __cplusplus
 }