aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc
diff options
context:
space:
mode:
Diffstat (limited to 'src/interfaces/ecpg/preproc')
-rw-r--r--src/interfaces/ecpg/preproc/descriptor.c6
-rw-r--r--src/interfaces/ecpg/preproc/ecpg.c33
-rw-r--r--src/interfaces/ecpg/preproc/extern.h2
-rw-r--r--src/interfaces/ecpg/preproc/type.c6
-rw-r--r--src/interfaces/ecpg/preproc/type.h24
-rw-r--r--src/interfaces/ecpg/preproc/variable.c9
6 files changed, 44 insertions, 36 deletions
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c
index 43193364b47..7ba6aa520d7 100644
--- a/src/interfaces/ecpg/preproc/descriptor.c
+++ b/src/interfaces/ecpg/preproc/descriptor.c
@@ -315,10 +315,10 @@ struct variable *
descriptor_variable(const char *name, int input)
{
static char descriptor_names[2][MAX_DESCRIPTOR_NAMELEN];
- static const struct ECPGtype descriptor_type = { ECPGt_descriptor, 0 };
+ static const struct ECPGtype descriptor_type = {ECPGt_descriptor, 0};
static const struct variable varspace[2] = {
- { descriptor_names[0], (struct ECPGtype *) & descriptor_type, 0, NULL },
- { descriptor_names[1], (struct ECPGtype *) & descriptor_type, 0, NULL }
+ {descriptor_names[0], (struct ECPGtype *) & descriptor_type, 0, NULL},
+ {descriptor_names[1], (struct ECPGtype *) & descriptor_type, 0, NULL}
};
strncpy(descriptor_names[input], name, MAX_DESCRIPTOR_NAMELEN);
diff --git a/src/interfaces/ecpg/preproc/ecpg.c b/src/interfaces/ecpg/preproc/ecpg.c
index 5592b42a79d..9d0648289cf 100644
--- a/src/interfaces/ecpg/preproc/ecpg.c
+++ b/src/interfaces/ecpg/preproc/ecpg.c
@@ -1,4 +1,4 @@
-/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.89 2004/07/20 18:06:41 meskes Exp $ */
+/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.90 2004/08/29 05:07:00 momjian Exp $ */
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
@@ -121,9 +121,9 @@ main(int argc, char *const argv[])
out_option = 0;
struct _include_path *ip;
const char *progname;
- char my_exec_path[MAXPGPATH];
- char include_path[MAXPGPATH];
-
+ char my_exec_path[MAXPGPATH];
+ char include_path[MAXPGPATH];
+
progname = get_progname(argv[0]);
if (argc > 1)
@@ -180,9 +180,9 @@ main(int argc, char *const argv[])
case 'C':
if (strncmp(optarg, "INFORMIX", strlen("INFORMIX")) == 0)
{
- char pkginclude_path[MAXPGPATH];
- char informix_path[MAXPGPATH];
-
+ char pkginclude_path[MAXPGPATH];
+ char informix_path[MAXPGPATH];
+
compat = (strcmp(optarg, "INFORMIX") == 0) ? ECPG_COMPAT_INFORMIX : ECPG_COMPAT_INFORMIX_SE;
/* system_includes = true; */
add_preprocessor_define("dec_t=decimal");
@@ -281,7 +281,7 @@ main(int argc, char *const argv[])
ptr2ext[0] = '.';
ptr2ext[1] = 'p';
ptr2ext[2] = 'g';
- ptr2ext[3] = (header_mode == true)? 'h' : 'c';
+ ptr2ext[3] = (header_mode == true) ? 'h' : 'c';
ptr2ext[4] = '\0';
}
@@ -298,7 +298,7 @@ main(int argc, char *const argv[])
ptr2ext = strrchr(output_filename, '.');
/* make extension = .c resp. .h */
- ptr2ext[1] = (header_mode == true)? 'h' : 'c';
+ ptr2ext[1] = (header_mode == true) ? 'h' : 'c';
ptr2ext[2] = '\0';
yyout = fopen(output_filename, PG_BINARY_W);
@@ -403,7 +403,7 @@ main(int argc, char *const argv[])
/* we need several includes */
/* but not if we are in header mode */
fprintf(yyout, "/* Processed by ecpg (%d.%d.%d) */\n", MAJOR_VERSION, MINOR_VERSION, PATCHLEVEL);
-
+
if (header_mode == false)
{
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");
@@ -416,24 +416,27 @@ main(int argc, char *const argv[])
}
fprintf(yyout, "#line 1 \"%s\"\n", input_filename);
-
+
/* and parse the source */
yyparse();
/* check if all cursors were indeed opened */
for (ptr = cur; ptr != NULL;)
{
- char errortext[128];
-
+ char errortext[128];
+
if (!(ptr->opened))
{
- /* Does not really make sense to declare a cursor but not open it */
+ /*
+ * Does not really make sense to declare a cursor
+ * but not open it
+ */
snprintf(errortext, sizeof(errortext), "cursor `%s´ has been declared but ot opened\n", ptr->name);
mmerror(PARSE_ERROR, ET_WARNING, errortext);
}
ptr = ptr->next;
}
-
+
if (yyin != NULL && yyin != stdin)
fclose(yyin);
if (out_option == 0 && yyout != stdout)
diff --git a/src/interfaces/ecpg/preproc/extern.h b/src/interfaces/ecpg/preproc/extern.h
index 6f9518f7e61..06cc74f2040 100644
--- a/src/interfaces/ecpg/preproc/extern.h
+++ b/src/interfaces/ecpg/preproc/extern.h
@@ -62,7 +62,7 @@ extern int yylex(void);
extern void yyerror(char *);
extern void *mm_alloc(size_t), *mm_realloc(void *, size_t);
extern char *mm_strdup(const char *);
-extern void mmerror(int, enum errortype, char *, ...);
+extern void mmerror(int, enum errortype, char *,...);
extern ScanKeyword *ScanECPGKeywordLookup(char *);
extern ScanKeyword *ScanCKeywordLookup(char *);
extern void output_get_descr_header(char *);
diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c
index 77caff9ac2a..24185222046 100644
--- a/src/interfaces/ecpg/preproc/type.c
+++ b/src/interfaces/ecpg/preproc/type.c
@@ -47,7 +47,11 @@ ECPGstruct_member_dup(struct ECPGstruct_member * rm)
type = ECPGmake_struct_type(rm->type->u.members, rm->type->type, rm->type->struct_sizeof);
break;
case ECPGt_array:
- /* if this array does contain a struct again, we have to create the struct too */
+
+ /*
+ * if this array does contain a struct again, we have to
+ * create the struct too
+ */
if (rm->type->u.element->type == ECPGt_struct)
type = ECPGmake_struct_type(rm->type->u.element->u.members, rm->type->u.element->type, rm->type->u.element->struct_sizeof);
else
diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h
index 9aab463aa1c..1a5471fe153 100644
--- a/src/interfaces/ecpg/preproc/type.h
+++ b/src/interfaces/ecpg/preproc/type.h
@@ -115,7 +115,7 @@ struct cursor
char *name;
char *command;
char *connection;
- bool opened;
+ bool opened;
struct arguments *argsinsert;
struct arguments *argsresult;
struct cursor *next;
@@ -123,28 +123,28 @@ struct cursor
struct typedefs
{
- char *name;
- struct this_type *type;
- struct ECPGstruct_member *struct_member_list;
- int brace_level;
- struct typedefs *next;
+ char *name;
+ struct this_type *type;
+ struct ECPGstruct_member *struct_member_list;
+ int brace_level;
+ struct typedefs *next;
};
struct _defines
{
- char *old;
- char *new;
- int pertinent;
- void *used;
+ char *old;
+ char *new;
+ int pertinent;
+ void *used;
struct _defines *next;
};
/* This is a linked list of the variable names and types. */
struct variable
{
- char *name;
+ char *name;
struct ECPGtype *type;
- int brace_level;
+ int brace_level;
struct variable *next;
};
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index 207d2647718..6037d978c70 100644
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -267,7 +267,7 @@ remove_typedefs(int brace_level)
else
prev->next = p->next;
- if (p->type->type_enum == ECPGt_struct || p->type->type_enum == ECPGt_union)
+ if (p->type->type_enum == ECPGt_struct || p->type->type_enum == ECPGt_union)
free(p->struct_member_list);
free(p->type);
free(p->name);
@@ -366,7 +366,7 @@ reset_variables(void)
argsresult = NULL;
}
-/* Insert a new variable into our request list.
+/* Insert a new variable into our request list.
* Note: The list is dumped from the end,
* so we have to add new entries at the beginning */
void
@@ -554,9 +554,10 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
* given bounds
*/
if (atoi(*dimension) < 0 && !type_definition)
+
/*
- * do not change this for typedefs
- * since it will be changed later on when the variable is defined
+ * do not change this for typedefs since it will be
+ * changed later on when the variable is defined
*/
*length = make_str("1");
else if (atoi(*dimension) == 0)