mirror of
https://github.com/postgres/postgres.git
synced 2025-08-31 17:02:12 +03:00
pgindent run.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.56 2002/04/28 17:20:03 meskes Exp $ */
|
||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/ecpg.c,v 1.57 2002/09/04 20:31:46 momjian Exp $ */
|
||||
|
||||
/* New main for ecpg, the PostgreSQL embedded SQL precompiler. */
|
||||
/* (C) Michael Meskes <meskes@postgresql.org> Feb 5th, 1998 */
|
||||
@@ -32,7 +32,7 @@ help(const char *progname)
|
||||
/* printf is a macro some places; don't #ifdef inside its arguments */
|
||||
#ifdef YYDEBUG
|
||||
printf("Usage:\n"
|
||||
" %s [-d] [-I DIRECTORY] [-o OUTFILE] [-t] [-c] [-D symbol] file1 [file2...]\n\n",
|
||||
" %s [-d] [-I DIRECTORY] [-o OUTFILE] [-t] [-c] [-D symbol] file1 [file2...]\n\n",
|
||||
progname);
|
||||
#else
|
||||
printf("Usage:\n"
|
||||
@@ -61,7 +61,7 @@ add_include_path(char *path)
|
||||
include_paths = mm_alloc(sizeof(struct _include_path));
|
||||
include_paths->path = path;
|
||||
include_paths->next = ip;
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@@ -18,7 +18,8 @@ extern char *descriptor_index;
|
||||
extern char *descriptor_name;
|
||||
extern char *connection;
|
||||
extern char *input_filename;
|
||||
extern char *yytext, *token_start,
|
||||
extern char *yytext,
|
||||
*token_start,
|
||||
errortext[128];
|
||||
|
||||
#ifdef YYDEBUG
|
||||
|
@@ -26,7 +26,7 @@ mm_strdup(const char *string)
|
||||
|
||||
if (new == NULL)
|
||||
mmerror(OUT_OF_MEMORY, ET_FATAL, "Out of memory\n");
|
||||
|
||||
|
||||
return new;
|
||||
}
|
||||
|
||||
@@ -183,7 +183,7 @@ get_type(enum ECPGttype type)
|
||||
/* Dump a type.
|
||||
The type is dumped as:
|
||||
type-tag <comma> - enum ECPGttype
|
||||
reference-to-variable <comma> - char *
|
||||
reference-to-variable <comma> - char *
|
||||
size <comma> - long size of this field (if varchar)
|
||||
arrsize <comma> - long number of elements in the arr
|
||||
offset <comma> - offset to the next element
|
||||
@@ -208,7 +208,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const char *i
|
||||
case ECPGt_array:
|
||||
if (indicator_set && ind_type->type != ECPGt_array)
|
||||
mmerror(INDICATOR_NOT_ARRAY, ET_FATAL, "Indicator for array/pointer has to be array/pointer.\n");
|
||||
|
||||
|
||||
switch (type->u.element->type)
|
||||
{
|
||||
case ECPGt_array:
|
||||
@@ -223,7 +223,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const char *i
|
||||
yyerror("Internal error: unknown datatype, please inform pgsql-bugs@postgresql.org");
|
||||
|
||||
ECPGdump_a_simple(o, name, type->u.element->type,
|
||||
type->u.element->size, type->size, NULL, prefix);
|
||||
type->u.element->size, type->size, NULL, prefix);
|
||||
if (ind_type != NULL)
|
||||
{
|
||||
if (ind_type->type == ECPGt_NO_INDICATOR)
|
||||
@@ -325,7 +325,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
|
||||
* we have to use the pointer except for arrays with given
|
||||
* bounds
|
||||
*/
|
||||
if (arrsize > 0 && siz== NULL)
|
||||
if (arrsize > 0 && siz == NULL)
|
||||
sprintf(variable, "(%s%s)", prefix ? prefix : "", name);
|
||||
else
|
||||
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
|
||||
@@ -376,24 +376,22 @@ ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, long arrsiz,
|
||||
sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
|
||||
else
|
||||
sprintf(pbuf, "%s%s->", prefix ? prefix : "", name);
|
||||
|
||||
|
||||
prefix = pbuf;
|
||||
|
||||
if (ind_type == &ecpg_no_indicator)
|
||||
{
|
||||
ind_p = &struct_no_indicator;
|
||||
}
|
||||
else if (ind_type != NULL)
|
||||
{
|
||||
if (arrsiz == 1)
|
||||
sprintf(ind_pbuf, "%s%s.", ind_prefix ? ind_prefix : "", ind_name);
|
||||
else
|
||||
sprintf(ind_pbuf, "%s%s->", ind_prefix ? ind_prefix : "", ind_name);
|
||||
|
||||
|
||||
ind_prefix = ind_pbuf;
|
||||
ind_p = ind_type->u.members;
|
||||
}
|
||||
|
||||
|
||||
for (p = type->u.members; p; p = p->next)
|
||||
{
|
||||
ECPGdump_a_type(o, p->name, p->type, (ind_p != NULL) ? ind_p->name : NULL, (ind_p != NULL) ? ind_p->type : NULL, prefix, ind_prefix, arrsiz, type->struct_sizeof, (ind_p != NULL) ? ind_type->struct_sizeof : NULL);
|
||||
|
@@ -14,7 +14,8 @@ struct ECPGtype
|
||||
long size; /* For array it is the number of elements.
|
||||
* For varchar it is the maxsize of the
|
||||
* area. */
|
||||
char *struct_sizeof; /* For a struct this is the sizeof() type as string */
|
||||
char *struct_sizeof; /* For a struct this is the sizeof() type
|
||||
* as string */
|
||||
union
|
||||
{
|
||||
struct ECPGtype *element; /* For an array this is the type
|
||||
@@ -90,7 +91,7 @@ struct this_type
|
||||
char *type_str;
|
||||
int type_dimension;
|
||||
int type_index;
|
||||
char * type_sizeof;
|
||||
char *type_sizeof;
|
||||
};
|
||||
|
||||
struct _include_path
|
||||
|
@@ -242,7 +242,7 @@ dump_variables(struct arguments * list, int mode)
|
||||
|
||||
/* Then the current element and its indicator */
|
||||
ECPGdump_a_type(yyout, list->variable->name, list->variable->type,
|
||||
list->indicator->name, list->indicator->type, NULL, NULL, 0, NULL, NULL);
|
||||
list->indicator->name, list->indicator->type, NULL, NULL, 0, NULL, NULL);
|
||||
|
||||
/* Then release the list element. */
|
||||
if (mode != 0)
|
||||
@@ -318,16 +318,17 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
|
||||
|
||||
*dimension = type_dimension;
|
||||
}
|
||||
|
||||
if (pointer_len>2)
|
||||
{ snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d",pointer_len);
|
||||
mmerror(PARSE_ERROR, ET_FATAL, errortext);
|
||||
|
||||
if (pointer_len > 2)
|
||||
{
|
||||
snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d", pointer_len);
|
||||
mmerror(PARSE_ERROR, ET_FATAL, errortext);
|
||||
/* mmerror(PARSE_ERROR, ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);*/
|
||||
}
|
||||
if (pointer_len>1 && type_enum!=ECPGt_char && type_enum!=ECPGt_unsigned_char)
|
||||
if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char)
|
||||
mmerror(PARSE_ERROR, ET_FATAL, "No pointer to pointer supported for this type");
|
||||
|
||||
if (pointer_len>1 && (*length >= 0 || *dimension >= 0))
|
||||
if (pointer_len > 1 && (*length >= 0 || *dimension >= 0))
|
||||
mmerror(PARSE_ERROR, ET_FATAL, "No multi-dimensional array support");
|
||||
|
||||
if (*length >= 0 && *dimension >= 0 && pointer_len)
|
||||
@@ -364,14 +365,14 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
|
||||
case ECPGt_char:
|
||||
case ECPGt_unsigned_char:
|
||||
/* char ** */
|
||||
if (pointer_len==2)
|
||||
if (pointer_len == 2)
|
||||
{
|
||||
*length = *dimension = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
/* pointer has to get length 0 */
|
||||
if (pointer_len==1)
|
||||
if (pointer_len == 1)
|
||||
*length = 0;
|
||||
|
||||
/* one index is the string length */
|
||||
|
Reference in New Issue
Block a user