2010-09-20 22:08:53 +02:00
|
|
|
/* src/interfaces/ecpg/preproc/type.c */
|
2006-07-30 12:24:10 +02:00
|
|
|
|
2001-02-10 03:31:31 +01:00
|
|
|
#include "postgres_fe.h"
|
1998-02-05 16:46:43 +01:00
|
|
|
|
1998-02-27 13:59:33 +01:00
|
|
|
#include "extern.h"
|
1998-02-05 16:46:43 +01:00
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
#define indicator_set ind_type != NULL && ind_type->type != ECPGt_NO_INDICATOR
|
2001-12-09 16:27:49 +01:00
|
|
|
|
2007-12-21 15:33:20 +01:00
|
|
|
static struct ECPGstruct_member struct_no_indicator = {"no_indicator", &ecpg_no_indicator, NULL};
|
2001-12-04 13:33:15 +01:00
|
|
|
|
1998-02-17 02:48:12 +01:00
|
|
|
/* malloc + error check */
|
1998-02-26 05:46:47 +01:00
|
|
|
void *
|
|
|
|
mm_alloc(size_t size)
|
1998-02-17 02:48:12 +01:00
|
|
|
{
|
1998-02-26 05:46:47 +01:00
|
|
|
void *ptr = malloc(size);
|
1998-02-17 02:48:12 +01:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
if (ptr == NULL)
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(OUT_OF_MEMORY, ET_FATAL, "out of memory");
|
1998-02-17 02:48:12 +01:00
|
|
|
|
1998-09-01 05:29:17 +02:00
|
|
|
return ptr;
|
1998-02-17 02:48:12 +01:00
|
|
|
}
|
|
|
|
|
1998-10-03 04:33:51 +02:00
|
|
|
/* strdup + error check */
|
|
|
|
char *
|
|
|
|
mm_strdup(const char *string)
|
|
|
|
{
|
|
|
|
char *new = strdup(string);
|
|
|
|
|
|
|
|
if (new == NULL)
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(OUT_OF_MEMORY, ET_FATAL, "out of memory");
|
2002-09-04 22:31:48 +02:00
|
|
|
|
1998-10-03 04:33:51 +02:00
|
|
|
return new;
|
|
|
|
}
|
|
|
|
|
1998-05-06 15:03:47 +02:00
|
|
|
/* duplicate memberlist */
|
1999-02-20 08:01:08 +01:00
|
|
|
struct ECPGstruct_member *
|
|
|
|
ECPGstruct_member_dup(struct ECPGstruct_member * rm)
|
1998-05-06 15:03:47 +02:00
|
|
|
{
|
1998-09-01 06:40:42 +02:00
|
|
|
struct ECPGstruct_member *new = NULL;
|
|
|
|
|
|
|
|
while (rm)
|
|
|
|
{
|
|
|
|
struct ECPGtype *type;
|
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
switch (rm->type->type)
|
1998-09-01 06:40:42 +02:00
|
|
|
{
|
|
|
|
case ECPGt_struct:
|
1999-02-28 08:25:34 +01:00
|
|
|
case ECPGt_union:
|
2010-01-26 10:07:32 +01:00
|
|
|
type = ECPGmake_struct_type(rm->type->u.members, rm->type->type, rm->type->type_name, rm->type->struct_sizeof);
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
|
|
|
case ECPGt_array:
|
2004-08-29 07:07:03 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* if this array does contain a struct again, we have to
|
|
|
|
* create the struct too
|
|
|
|
*/
|
2010-04-01 10:41:01 +02:00
|
|
|
if (rm->type->u.element->type == ECPGt_struct || rm->type->u.element->type == ECPGt_union)
|
2010-01-26 10:07:32 +01:00
|
|
|
type = ECPGmake_struct_type(rm->type->u.element->u.members, rm->type->u.element->type, rm->type->u.element->type_name, rm->type->u.element->struct_sizeof);
|
2004-01-28 10:52:14 +01:00
|
|
|
else
|
2010-03-09 12:09:46 +01:00
|
|
|
type = ECPGmake_array_type(ECPGmake_simple_type(rm->type->u.element->type, rm->type->u.element->size, rm->type->u.element->counter), rm->type->size);
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
|
|
|
default:
|
2010-03-09 12:09:46 +01:00
|
|
|
type = ECPGmake_simple_type(rm->type->type, rm->type->size, rm->type->counter);
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ECPGmake_struct_member(rm->name, type, &new);
|
|
|
|
|
|
|
|
rm = rm->next;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (new);
|
1998-05-06 15:03:47 +02:00
|
|
|
}
|
1998-02-05 16:46:43 +01:00
|
|
|
|
|
|
|
/* The NAME argument is copied. The type argument is preserved as a pointer. */
|
1998-05-26 15:43:55 +02:00
|
|
|
void
|
1998-04-27 16:35:58 +02:00
|
|
|
ECPGmake_struct_member(char *name, struct ECPGtype * type, struct ECPGstruct_member ** start)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
1998-04-27 16:35:58 +02:00
|
|
|
struct ECPGstruct_member *ptr,
|
1999-02-20 08:01:08 +01:00
|
|
|
*ne =
|
|
|
|
(struct ECPGstruct_member *) mm_alloc(sizeof(struct ECPGstruct_member));
|
1998-02-17 02:48:12 +01:00
|
|
|
|
2007-08-22 10:20:58 +02:00
|
|
|
ne->name = mm_strdup(name);
|
2001-12-23 13:17:41 +01:00
|
|
|
ne->type = type;
|
1998-02-26 05:46:47 +01:00
|
|
|
ne->next = NULL;
|
1998-02-05 16:46:43 +01:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
for (ptr = *start; ptr && ptr->next; ptr = ptr->next);
|
1998-02-05 16:46:43 +01:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
if (ptr)
|
|
|
|
ptr->next = ne;
|
|
|
|
else
|
|
|
|
*start = ne;
|
1998-02-05 16:46:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ECPGtype *
|
2010-03-09 12:09:46 +01:00
|
|
|
ECPGmake_simple_type(enum ECPGttype type, char *size, int counter)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
1998-02-26 05:46:47 +01:00
|
|
|
struct ECPGtype *ne = (struct ECPGtype *) mm_alloc(sizeof(struct ECPGtype));
|
1998-02-05 16:46:43 +01:00
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
ne->type = type;
|
2010-01-26 10:07:32 +01:00
|
|
|
ne->type_name = NULL;
|
2001-12-23 13:17:41 +01:00
|
|
|
ne->size = size;
|
2004-10-11 01:37:45 +02:00
|
|
|
ne->u.element = NULL;
|
2001-12-23 13:17:41 +01:00
|
|
|
ne->struct_sizeof = NULL;
|
2010-03-09 12:09:46 +01:00
|
|
|
ne->counter = counter; /* only needed for varchar */
|
1998-02-05 16:46:43 +01:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
return ne;
|
1998-02-05 16:46:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ECPGtype *
|
2003-05-14 16:37:36 +02:00
|
|
|
ECPGmake_array_type(struct ECPGtype * type, char *size)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
2007-08-14 12:01:54 +02:00
|
|
|
struct ECPGtype *ne = ECPGmake_simple_type(ECPGt_array, size, 0);
|
1998-02-05 16:46:43 +01:00
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
ne->u.element = type;
|
1998-02-05 16:46:43 +01:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
return ne;
|
1998-02-05 16:46:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
struct ECPGtype *
|
2010-01-26 10:07:32 +01:00
|
|
|
ECPGmake_struct_type(struct ECPGstruct_member * rm, enum ECPGttype type, char *type_name, char *struct_sizeof)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
2011-01-09 02:45:56 +01:00
|
|
|
struct ECPGtype *ne = ECPGmake_simple_type(type, mm_strdup("1"), 0);
|
1998-02-05 16:46:43 +01:00
|
|
|
|
2010-01-26 10:07:32 +01:00
|
|
|
ne->type_name = mm_strdup(type_name);
|
1999-02-20 08:01:08 +01:00
|
|
|
ne->u.members = ECPGstruct_member_dup(rm);
|
2001-12-23 13:17:41 +01:00
|
|
|
ne->struct_sizeof = struct_sizeof;
|
1998-02-05 16:46:43 +01:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
return ne;
|
1998-02-05 16:46:43 +01:00
|
|
|
}
|
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
static const char *
|
2001-12-23 13:17:41 +01:00
|
|
|
get_type(enum ECPGttype type)
|
1998-05-06 15:03:47 +02:00
|
|
|
{
|
2001-12-23 13:17:41 +01:00
|
|
|
switch (type)
|
1998-09-01 06:40:42 +02:00
|
|
|
{
|
2001-10-25 07:50:21 +02:00
|
|
|
case ECPGt_char:
|
1998-09-01 06:40:42 +02:00
|
|
|
return ("ECPGt_char");
|
|
|
|
break;
|
|
|
|
case ECPGt_unsigned_char:
|
|
|
|
return ("ECPGt_unsigned_char");
|
|
|
|
break;
|
|
|
|
case ECPGt_short:
|
|
|
|
return ("ECPGt_short");
|
|
|
|
break;
|
|
|
|
case ECPGt_unsigned_short:
|
|
|
|
return ("ECPGt_unsigned_short");
|
|
|
|
break;
|
|
|
|
case ECPGt_int:
|
|
|
|
return ("ECPGt_int");
|
|
|
|
break;
|
|
|
|
case ECPGt_unsigned_int:
|
|
|
|
return ("ECPGt_unsigned_int");
|
|
|
|
break;
|
|
|
|
case ECPGt_long:
|
|
|
|
return ("ECPGt_long");
|
|
|
|
break;
|
|
|
|
case ECPGt_unsigned_long:
|
2000-09-19 13:47:16 +02:00
|
|
|
return ("ECPGt_unsigned_long");
|
|
|
|
break;
|
|
|
|
case ECPGt_long_long:
|
|
|
|
return ("ECPGt_long_long");
|
|
|
|
break;
|
|
|
|
case ECPGt_unsigned_long_long:
|
|
|
|
return ("ECPGt_unsigned_long_long");
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
|
|
|
case ECPGt_float:
|
|
|
|
return ("ECPGt_float");
|
|
|
|
break;
|
|
|
|
case ECPGt_double:
|
|
|
|
return ("ECPGt_double");
|
|
|
|
break;
|
|
|
|
case ECPGt_bool:
|
|
|
|
return ("ECPGt_bool");
|
|
|
|
break;
|
|
|
|
case ECPGt_varchar:
|
|
|
|
return ("ECPGt_varchar");
|
|
|
|
case ECPGt_NO_INDICATOR: /* no indicator */
|
|
|
|
return ("ECPGt_NO_INDICATOR");
|
|
|
|
break;
|
2005-10-15 04:49:52 +02:00
|
|
|
case ECPGt_char_variable: /* string that should not be quoted */
|
1999-02-20 08:01:08 +01:00
|
|
|
return ("ECPGt_char_variable");
|
|
|
|
break;
|
2003-06-20 14:00:59 +02:00
|
|
|
case ECPGt_const: /* constant string quoted */
|
|
|
|
return ("ECPGt_const");
|
|
|
|
break;
|
2003-07-01 14:40:52 +02:00
|
|
|
case ECPGt_decimal:
|
|
|
|
return ("ECPGt_decimal");
|
|
|
|
break;
|
2003-03-16 11:42:54 +01:00
|
|
|
case ECPGt_numeric:
|
|
|
|
return ("ECPGt_numeric");
|
|
|
|
break;
|
2003-03-27 15:29:17 +01:00
|
|
|
case ECPGt_interval:
|
|
|
|
return ("ECPGt_interval");
|
|
|
|
break;
|
2001-09-19 16:09:32 +02:00
|
|
|
case ECPGt_descriptor:
|
|
|
|
return ("ECPGt_descriptor");
|
|
|
|
break;
|
2010-01-05 17:38:23 +01:00
|
|
|
case ECPGt_sqlda:
|
|
|
|
return ("ECPGt_sqlda");
|
|
|
|
break;
|
2003-03-20 16:56:50 +01:00
|
|
|
case ECPGt_date:
|
|
|
|
return ("ECPGt_date");
|
|
|
|
break;
|
|
|
|
case ECPGt_timestamp:
|
|
|
|
return ("ECPGt_timestamp");
|
|
|
|
break;
|
2009-08-07 12:51:21 +02:00
|
|
|
case ECPGt_string:
|
|
|
|
return ("ECPGt_string");
|
|
|
|
break;
|
1998-09-01 06:40:42 +02:00
|
|
|
default:
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type);
|
1998-09-01 06:40:42 +02:00
|
|
|
}
|
1999-05-25 18:15:34 +02:00
|
|
|
|
1999-02-28 08:25:34 +01:00
|
|
|
return NULL;
|
1998-05-06 15:03:47 +02:00
|
|
|
}
|
1998-02-05 16:46:43 +01:00
|
|
|
|
|
|
|
/* Dump a type.
|
|
|
|
The type is dumped as:
|
1998-02-26 05:46:47 +01:00
|
|
|
type-tag <comma> - enum ECPGttype
|
2002-09-04 22:31:48 +02:00
|
|
|
reference-to-variable <comma> - char *
|
1998-02-26 05:46:47 +01:00
|
|
|
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
|
1998-02-05 16:46:43 +01:00
|
|
|
Where:
|
|
|
|
type-tag is one of the simple types or varchar.
|
|
|
|
reference-to-variable can be a reference to a struct element.
|
|
|
|
arrsize is the size of the array in case of array fetches. Otherwise 0.
|
|
|
|
size is the maxsize in case it is a varchar. Otherwise it is the size of
|
1998-04-27 16:35:58 +02:00
|
|
|
the variable (required to do array fetches of structs).
|
1998-02-05 16:46:43 +01:00
|
|
|
*/
|
2001-12-23 13:17:41 +01:00
|
|
|
static void ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
|
2003-05-14 16:37:36 +02:00
|
|
|
char *varcharsize,
|
2007-08-14 12:01:54 +02:00
|
|
|
char *arrsiz, const char *siz, const char *prefix, int);
|
2003-05-14 16:37:36 +02:00
|
|
|
static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz,
|
2009-09-03 11:59:20 +02:00
|
|
|
struct ECPGtype * type, struct ECPGtype * ind_type, const char *prefix, const char *ind_prefix);
|
1998-02-05 16:46:43 +01:00
|
|
|
|
|
|
|
void
|
2010-04-01 12:30:53 +02:00
|
|
|
ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int brace_level,
|
2010-07-06 21:19:02 +02:00
|
|
|
const char *ind_name, struct ECPGtype * ind_type, const int ind_brace_level,
|
2003-08-04 02:43:34 +02:00
|
|
|
const char *prefix, const char *ind_prefix,
|
|
|
|
char *arr_str_siz, const char *struct_sizeof,
|
2010-04-01 12:30:53 +02:00
|
|
|
const char *ind_struct_sizeof)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
2010-04-01 10:41:01 +02:00
|
|
|
struct variable *var;
|
|
|
|
|
|
|
|
if (type->type != ECPGt_descriptor && type->type != ECPGt_sqlda &&
|
2011-03-11 14:44:40 +01:00
|
|
|
type->type != ECPGt_char_variable && type->type != ECPGt_const &&
|
2010-04-01 10:41:01 +02:00
|
|
|
brace_level >= 0)
|
|
|
|
{
|
|
|
|
char *str;
|
|
|
|
|
2010-04-01 12:30:53 +02:00
|
|
|
str = mm_strdup(name);
|
2010-04-01 10:41:01 +02:00
|
|
|
var = find_variable(str);
|
|
|
|
free(str);
|
|
|
|
|
|
|
|
if ((var->type->type != type->type) ||
|
|
|
|
(var->type->type_name && !type->type_name) ||
|
|
|
|
(!var->type->type_name && type->type_name) ||
|
2011-12-27 20:19:09 +01:00
|
|
|
(var->type->type_name && type->type_name && strcmp(var->type->type_name, type->type_name) != 0))
|
2010-04-03 09:53:29 +02:00
|
|
|
mmerror(PARSE_ERROR, ET_ERROR, "variable \"%s\" is hidden by a local variable of a different type", name);
|
2010-04-01 10:41:01 +02:00
|
|
|
else if (var->brace_level != brace_level)
|
2010-04-03 09:53:29 +02:00
|
|
|
mmerror(PARSE_ERROR, ET_WARNING, "variable \"%s\" is hidden by a local variable", name);
|
2010-04-01 10:41:01 +02:00
|
|
|
|
|
|
|
if (ind_name && ind_type && ind_type->type != ECPGt_NO_INDICATOR && ind_brace_level >= 0)
|
|
|
|
{
|
2010-04-01 12:30:53 +02:00
|
|
|
str = mm_strdup(ind_name);
|
2010-04-01 10:41:01 +02:00
|
|
|
var = find_variable(str);
|
|
|
|
free(str);
|
2010-04-01 12:30:53 +02:00
|
|
|
|
2010-04-01 10:41:01 +02:00
|
|
|
if ((var->type->type != ind_type->type) ||
|
|
|
|
(var->type->type_name && !ind_type->type_name) ||
|
|
|
|
(!var->type->type_name && ind_type->type_name) ||
|
2011-12-27 20:19:09 +01:00
|
|
|
(var->type->type_name && ind_type->type_name && strcmp(var->type->type_name, ind_type->type_name) != 0))
|
2010-04-03 09:53:29 +02:00
|
|
|
mmerror(PARSE_ERROR, ET_ERROR, "indicator variable \"%s\" is hidden by a local variable of a different type", ind_name);
|
2010-04-01 10:41:01 +02:00
|
|
|
else if (var->brace_level != ind_brace_level)
|
2010-04-03 09:53:29 +02:00
|
|
|
mmerror(PARSE_ERROR, ET_WARNING, "indicator variable \"%s\" is hidden by a local variable", ind_name);
|
2010-04-01 10:41:01 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
switch (type->type)
|
1998-09-01 06:40:42 +02:00
|
|
|
{
|
2001-10-25 07:50:21 +02:00
|
|
|
case ECPGt_array:
|
2001-12-23 13:17:41 +01:00
|
|
|
if (indicator_set && ind_type->type != ECPGt_array)
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(INDICATOR_NOT_ARRAY, ET_FATAL, "indicator for array/pointer has to be array/pointer");
|
2001-12-23 13:17:41 +01:00
|
|
|
switch (type->u.element->type)
|
1998-09-01 06:40:42 +02:00
|
|
|
{
|
2001-10-25 07:50:21 +02:00
|
|
|
case ECPGt_array:
|
2009-06-11 16:49:15 +02:00
|
|
|
mmerror(PARSE_ERROR, ET_ERROR, "nested arrays are not supported (except strings)"); /* array of array */
|
1999-02-28 08:25:34 +01:00
|
|
|
break;
|
|
|
|
case ECPGt_struct:
|
|
|
|
case ECPGt_union:
|
2003-05-29 15:59:26 +02:00
|
|
|
ECPGdump_a_struct(o, name,
|
2003-08-04 02:43:34 +02:00
|
|
|
ind_name,
|
|
|
|
type->size,
|
|
|
|
type->u.element,
|
2006-08-13 12:18:31 +02:00
|
|
|
(ind_type == NULL) ? NULL : ((ind_type->type == ECPGt_NO_INDICATOR) ? ind_type : ind_type->u.element),
|
2009-09-03 11:59:20 +02:00
|
|
|
prefix, ind_prefix);
|
1999-02-28 08:25:34 +01:00
|
|
|
break;
|
1999-05-25 18:15:34 +02:00
|
|
|
default:
|
2001-12-23 13:17:41 +01:00
|
|
|
if (!IS_SIMPLE_TYPE(type->u.element->type))
|
2008-05-16 17:20:04 +02:00
|
|
|
base_yyerror("internal error: unknown datatype, please report this to <pgsql-bugs@postgresql.org>");
|
1999-05-25 18:15:34 +02:00
|
|
|
|
2003-05-29 15:59:26 +02:00
|
|
|
ECPGdump_a_simple(o, name,
|
2003-08-04 02:43:34 +02:00
|
|
|
type->u.element->type,
|
2010-03-09 12:09:46 +01:00
|
|
|
type->u.element->size, type->size, NULL, prefix, type->u.element->counter);
|
2003-08-04 02:43:34 +02:00
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
if (ind_type != NULL)
|
1999-02-20 08:01:08 +01:00
|
|
|
{
|
2001-12-23 13:17:41 +01:00
|
|
|
if (ind_type->type == ECPGt_NO_INDICATOR)
|
2011-01-09 02:45:56 +01:00
|
|
|
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, mm_strdup("-1"), NULL, ind_prefix, 0);
|
2000-10-16 21:53:04 +02:00
|
|
|
else
|
2003-05-23 17:19:36 +02:00
|
|
|
{
|
2003-05-29 15:59:26 +02:00
|
|
|
ECPGdump_a_simple(o, ind_name, ind_type->u.element->type,
|
2007-08-14 12:01:54 +02:00
|
|
|
ind_type->u.element->size, ind_type->size, NULL, ind_prefix, 0);
|
2003-05-23 17:19:36 +02:00
|
|
|
}
|
1999-02-28 08:25:34 +01:00
|
|
|
}
|
1998-09-01 06:40:42 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ECPGt_struct:
|
2001-12-23 13:17:41 +01:00
|
|
|
if (indicator_set && ind_type->type != ECPGt_struct)
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(INDICATOR_NOT_STRUCT, ET_FATAL, "indicator for struct has to be a struct");
|
2001-12-09 16:27:49 +01:00
|
|
|
|
2011-01-09 02:45:56 +01:00
|
|
|
ECPGdump_a_struct(o, name, ind_name, mm_strdup("1"), type, ind_type, prefix, ind_prefix);
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
1999-05-25 18:15:34 +02:00
|
|
|
case ECPGt_union: /* cannot dump a complete union */
|
2008-05-16 17:20:04 +02:00
|
|
|
base_yyerror("type of union has to be specified");
|
1999-02-28 08:25:34 +01:00
|
|
|
break;
|
|
|
|
case ECPGt_char_variable:
|
2001-12-23 13:17:41 +01:00
|
|
|
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple");
|
2001-12-09 16:27:49 +01:00
|
|
|
|
2011-01-09 02:45:56 +01:00
|
|
|
ECPGdump_a_simple(o, name, type->type, mm_strdup("1"), (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : mm_strdup("1"), struct_sizeof, prefix, 0);
|
2006-08-09 11:08:32 +02:00
|
|
|
if (ind_type != NULL)
|
2011-01-09 02:45:56 +01:00
|
|
|
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : mm_strdup("-1"), ind_struct_sizeof, ind_prefix, 0);
|
1999-02-28 08:25:34 +01:00
|
|
|
break;
|
2001-09-19 16:09:32 +02:00
|
|
|
case ECPGt_descriptor:
|
2001-12-23 13:17:41 +01:00
|
|
|
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple");
|
2001-12-09 16:27:49 +01:00
|
|
|
|
2011-01-09 02:45:56 +01:00
|
|
|
ECPGdump_a_simple(o, name, type->type, NULL, mm_strdup("-1"), NULL, prefix, 0);
|
2006-08-09 11:08:32 +02:00
|
|
|
if (ind_type != NULL)
|
2011-01-09 02:45:56 +01:00
|
|
|
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, mm_strdup("-1"), NULL, ind_prefix, 0);
|
2001-09-19 16:09:32 +02:00
|
|
|
break;
|
1998-09-01 06:40:42 +02:00
|
|
|
default:
|
2001-12-23 13:17:41 +01:00
|
|
|
if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array))
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple");
|
2001-12-09 16:27:49 +01:00
|
|
|
|
2011-01-09 02:45:56 +01:00
|
|
|
ECPGdump_a_simple(o, name, type->type, type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : mm_strdup("-1"), struct_sizeof, prefix, type->counter);
|
2001-12-23 13:17:41 +01:00
|
|
|
if (ind_type != NULL)
|
2011-01-09 02:45:56 +01:00
|
|
|
ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : mm_strdup("-1"), ind_struct_sizeof, ind_prefix, 0);
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
1998-02-26 05:46:47 +01:00
|
|
|
}
|
1998-02-05 16:46:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* If siz is NULL, then the offset is 0, if not use siz as a
|
1998-04-27 16:35:58 +02:00
|
|
|
string, it represents the offset needed if we are in an array of structs. */
|
1998-05-18 18:05:05 +02:00
|
|
|
static void
|
2001-12-23 13:17:41 +01:00
|
|
|
ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type,
|
2003-05-14 16:37:36 +02:00
|
|
|
char *varcharsize,
|
|
|
|
char *arrsize,
|
1998-02-26 05:46:47 +01:00
|
|
|
const char *siz,
|
2007-08-14 12:01:54 +02:00
|
|
|
const char *prefix,
|
2010-03-09 12:09:46 +01:00
|
|
|
int counter)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
2001-12-23 13:17:41 +01:00
|
|
|
if (type == ECPGt_NO_INDICATOR)
|
1998-09-01 06:40:42 +02:00
|
|
|
fprintf(o, "\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ");
|
2001-12-23 13:17:41 +01:00
|
|
|
else if (type == ECPGt_descriptor)
|
2001-09-19 16:09:32 +02:00
|
|
|
/* remember that name here already contains quotes (if needed) */
|
|
|
|
fprintf(o, "\n\tECPGt_descriptor, %s, 0L, 0L, 0L, ", name);
|
2010-01-05 17:38:23 +01:00
|
|
|
else if (type == ECPGt_sqlda)
|
|
|
|
fprintf(o, "\n\tECPGt_sqlda, &%s, 0L, 0L, 0L, ", name);
|
1998-09-01 06:40:42 +02:00
|
|
|
else
|
|
|
|
{
|
2009-06-11 16:49:15 +02:00
|
|
|
char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4);
|
|
|
|
char *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1 + strlen(varcharsize) + sizeof(int) * CHAR_BIT * 10 / 3);
|
2003-08-04 02:43:34 +02:00
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
switch (type)
|
1998-09-01 06:40:42 +02:00
|
|
|
{
|
2003-08-04 02:43:34 +02:00
|
|
|
/*
|
|
|
|
* we have to use the & operator except for arrays and
|
|
|
|
* pointers
|
|
|
|
*/
|
|
|
|
|
1998-09-01 06:40:42 +02:00
|
|
|
case ECPGt_varchar:
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* we have to use the pointer except for arrays with given
|
|
|
|
* bounds
|
|
|
|
*/
|
2003-08-04 02:43:34 +02:00
|
|
|
if (((atoi(arrsize) > 0) ||
|
|
|
|
(atoi(arrsize) == 0 && strcmp(arrsize, "0") != 0)) &&
|
|
|
|
siz == NULL)
|
2000-04-05 11:05:40 +02:00
|
|
|
sprintf(variable, "(%s%s)", prefix ? prefix : "", name);
|
|
|
|
else
|
|
|
|
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
|
|
|
|
|
2012-02-10 03:58:57 +01:00
|
|
|
/* If we created a varchar structure atomatically, counter is greater than 0. */
|
2010-03-09 12:09:46 +01:00
|
|
|
if (counter)
|
2012-02-10 03:58:57 +01:00
|
|
|
sprintf(offset, "sizeof(struct varchar_%d)", counter);
|
2007-08-14 12:01:54 +02:00
|
|
|
else
|
2012-02-10 03:58:57 +01:00
|
|
|
sprintf(offset, "sizeof(struct varchar)");
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
|
|
|
case ECPGt_char:
|
|
|
|
case ECPGt_unsigned_char:
|
1999-02-20 08:01:08 +01:00
|
|
|
case ECPGt_char_variable:
|
2009-08-07 12:51:21 +02:00
|
|
|
case ECPGt_string:
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* we have to use the pointer except for arrays with given
|
2003-08-04 02:43:34 +02:00
|
|
|
* bounds, ecpglib will distinguish between * and []
|
2000-04-12 19:17:23 +02:00
|
|
|
*/
|
2003-05-14 16:37:36 +02:00
|
|
|
if ((atoi(varcharsize) > 1 ||
|
2003-08-04 02:43:34 +02:00
|
|
|
(atoi(arrsize) > 0) ||
|
2005-10-15 04:49:52 +02:00
|
|
|
(atoi(varcharsize) == 0 && strcmp(varcharsize, "0") != 0) ||
|
2003-08-04 02:43:34 +02:00
|
|
|
(atoi(arrsize) == 0 && strcmp(arrsize, "0") != 0))
|
|
|
|
&& siz == NULL)
|
2000-04-05 11:05:40 +02:00
|
|
|
sprintf(variable, "(%s%s)", prefix ? prefix : "", name);
|
|
|
|
else
|
|
|
|
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
|
|
|
|
|
2004-12-06 21:35:35 +01:00
|
|
|
sprintf(offset, "(%s)*sizeof(char)", strcmp(varcharsize, "0") == 0 ? "1" : varcharsize);
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
2003-03-16 11:42:54 +01:00
|
|
|
case ECPGt_numeric:
|
|
|
|
|
|
|
|
/*
|
2003-08-04 02:43:34 +02:00
|
|
|
* we have to use a pointer here
|
2003-03-16 11:42:54 +01:00
|
|
|
*/
|
|
|
|
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
|
2003-09-09 12:46:42 +02:00
|
|
|
sprintf(offset, "sizeof(numeric)");
|
2003-03-27 15:29:17 +01:00
|
|
|
break;
|
|
|
|
case ECPGt_interval:
|
|
|
|
|
|
|
|
/*
|
2003-08-04 02:43:34 +02:00
|
|
|
* we have to use a pointer here
|
2003-03-27 15:29:17 +01:00
|
|
|
*/
|
|
|
|
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
|
2003-09-09 12:46:42 +02:00
|
|
|
sprintf(offset, "sizeof(interval)");
|
2003-03-16 11:42:54 +01:00
|
|
|
break;
|
2003-03-20 16:56:50 +01:00
|
|
|
case ECPGt_date:
|
|
|
|
|
|
|
|
/*
|
2005-10-15 04:49:52 +02:00
|
|
|
* we have to use a pointer and translate the variable type
|
2003-03-20 16:56:50 +01:00
|
|
|
*/
|
|
|
|
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
|
2003-09-09 12:46:42 +02:00
|
|
|
sprintf(offset, "sizeof(date)");
|
2003-03-20 16:56:50 +01:00
|
|
|
break;
|
|
|
|
case ECPGt_timestamp:
|
|
|
|
|
|
|
|
/*
|
2005-10-15 04:49:52 +02:00
|
|
|
* we have to use a pointer and translate the variable type
|
2003-03-20 16:56:50 +01:00
|
|
|
*/
|
|
|
|
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
|
2003-09-09 12:46:42 +02:00
|
|
|
sprintf(offset, "sizeof(timestamp)");
|
2003-03-20 16:56:50 +01:00
|
|
|
break;
|
2003-06-20 14:00:59 +02:00
|
|
|
case ECPGt_const:
|
|
|
|
|
|
|
|
/*
|
2003-08-04 02:43:34 +02:00
|
|
|
* just dump the const as string
|
2003-06-20 14:00:59 +02:00
|
|
|
*/
|
|
|
|
sprintf(variable, "\"%s\"", name);
|
|
|
|
sprintf(offset, "strlen(\"%s\")", name);
|
|
|
|
break;
|
1998-09-01 06:40:42 +02:00
|
|
|
default:
|
2000-04-12 19:17:23 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* we have to use the pointer except for arrays with given
|
|
|
|
* bounds
|
|
|
|
*/
|
2003-08-04 02:43:34 +02:00
|
|
|
if (((atoi(arrsize) > 0) ||
|
|
|
|
(atoi(arrsize) == 0 && strcmp(arrsize, "0") != 0)) &&
|
|
|
|
siz == NULL)
|
2000-04-05 11:05:40 +02:00
|
|
|
sprintf(variable, "(%s%s)", prefix ? prefix : "", name);
|
|
|
|
else
|
|
|
|
sprintf(variable, "&(%s%s)", prefix ? prefix : "", name);
|
|
|
|
|
2007-10-03 13:11:12 +02:00
|
|
|
sprintf(offset, "sizeof(%s)", ecpg_type_name(type));
|
1998-09-01 06:40:42 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-05-14 16:37:36 +02:00
|
|
|
if (atoi(arrsize) < 0)
|
|
|
|
strcpy(arrsize, "1");
|
2003-08-04 02:43:34 +02:00
|
|
|
|
2007-08-14 12:01:54 +02:00
|
|
|
if (siz == NULL || strlen(siz) == 0 || strcmp(arrsize, "0") == 0 || strcmp(arrsize, "1") == 0)
|
2003-05-14 16:37:36 +02:00
|
|
|
fprintf(o, "\n\t%s,%s,(long)%s,(long)%s,%s, ", get_type(type), variable, varcharsize, arrsize, offset);
|
1998-09-01 06:40:42 +02:00
|
|
|
else
|
2003-05-14 16:37:36 +02:00
|
|
|
fprintf(o, "\n\t%s,%s,(long)%s,(long)%s,%s, ", get_type(type), variable, varcharsize, arrsize, siz);
|
1998-09-01 06:40:42 +02:00
|
|
|
|
|
|
|
free(variable);
|
|
|
|
free(offset);
|
1998-02-26 05:46:47 +01:00
|
|
|
}
|
1998-02-05 16:46:43 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-04-27 16:35:58 +02:00
|
|
|
/* Penetrate a struct and dump the contents. */
|
1998-05-18 18:05:05 +02:00
|
|
|
static void
|
2009-09-03 11:59:20 +02:00
|
|
|
ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsiz, struct ECPGtype * type, struct ECPGtype * ind_type, const char *prefix, const char *ind_prefix)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
1998-02-26 05:46:47 +01:00
|
|
|
/*
|
2005-10-15 04:49:52 +02:00
|
|
|
* If offset is NULL, then this is the first recursive level. If not then
|
|
|
|
* we are in a struct in a struct and the offset is used as offset.
|
1998-02-26 05:46:47 +01:00
|
|
|
*/
|
1998-09-01 06:40:42 +02:00
|
|
|
struct ECPGstruct_member *p,
|
|
|
|
*ind_p = NULL;
|
2001-12-09 16:27:49 +01:00
|
|
|
char pbuf[BUFSIZ],
|
1998-09-01 06:40:42 +02:00
|
|
|
ind_pbuf[BUFSIZ];
|
1998-02-26 05:46:47 +01:00
|
|
|
|
2003-05-14 16:37:36 +02:00
|
|
|
if (atoi(arrsiz) == 1)
|
2001-12-08 21:43:35 +01:00
|
|
|
sprintf(pbuf, "%s%s.", prefix ? prefix : "", name);
|
|
|
|
else
|
|
|
|
sprintf(pbuf, "%s%s->", prefix ? prefix : "", name);
|
2002-09-04 22:31:48 +02:00
|
|
|
|
1998-02-26 05:46:47 +01:00
|
|
|
prefix = pbuf;
|
1998-09-01 06:40:42 +02:00
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
if (ind_type == &ecpg_no_indicator)
|
2001-12-04 13:33:15 +01:00
|
|
|
ind_p = &struct_no_indicator;
|
2001-12-23 13:17:41 +01:00
|
|
|
else if (ind_type != NULL)
|
2001-12-04 13:33:15 +01:00
|
|
|
{
|
2003-05-14 16:37:36 +02:00
|
|
|
if (atoi(arrsiz) == 1)
|
2001-12-08 21:43:35 +01:00
|
|
|
sprintf(ind_pbuf, "%s%s.", ind_prefix ? ind_prefix : "", ind_name);
|
|
|
|
else
|
|
|
|
sprintf(ind_pbuf, "%s%s->", ind_prefix ? ind_prefix : "", ind_name);
|
2002-09-04 22:31:48 +02:00
|
|
|
|
2001-12-04 13:33:15 +01:00
|
|
|
ind_prefix = ind_pbuf;
|
2001-12-23 13:17:41 +01:00
|
|
|
ind_p = ind_type->u.members;
|
2001-12-04 13:33:15 +01:00
|
|
|
}
|
2002-09-04 22:31:48 +02:00
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
for (p = type->u.members; p; p = p->next)
|
1998-02-26 05:46:47 +01:00
|
|
|
{
|
2010-04-01 12:30:53 +02:00
|
|
|
ECPGdump_a_type(o, p->name, p->type, -1,
|
2003-08-04 02:43:34 +02:00
|
|
|
(ind_p != NULL) ? ind_p->name : NULL,
|
|
|
|
(ind_p != NULL) ? ind_p->type : NULL,
|
2010-04-01 12:30:53 +02:00
|
|
|
-1,
|
2003-08-04 02:43:34 +02:00
|
|
|
prefix, ind_prefix, arrsiz, type->struct_sizeof,
|
2010-04-01 12:30:53 +02:00
|
|
|
(ind_p != NULL) ? ind_type->struct_sizeof : NULL);
|
2001-12-04 13:33:15 +01:00
|
|
|
if (ind_p != NULL && ind_p != &struct_no_indicator)
|
1998-09-01 06:40:42 +02:00
|
|
|
ind_p = ind_p->next;
|
1998-02-26 05:46:47 +01:00
|
|
|
}
|
1998-02-05 16:46:43 +01:00
|
|
|
}
|
|
|
|
|
1998-05-06 15:03:47 +02:00
|
|
|
void
|
1998-04-27 16:35:58 +02:00
|
|
|
ECPGfree_struct_member(struct ECPGstruct_member * rm)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
1998-09-01 06:40:42 +02:00
|
|
|
while (rm)
|
|
|
|
{
|
|
|
|
struct ECPGstruct_member *p = rm;
|
|
|
|
|
|
|
|
rm = rm->next;
|
|
|
|
free(p->name);
|
2001-12-23 13:17:41 +01:00
|
|
|
free(p->type);
|
1998-09-01 06:40:42 +02:00
|
|
|
free(p);
|
|
|
|
}
|
1998-05-06 15:03:47 +02:00
|
|
|
}
|
1998-02-05 16:46:43 +01:00
|
|
|
|
|
|
|
void
|
2001-12-23 13:17:41 +01:00
|
|
|
ECPGfree_type(struct ECPGtype * type)
|
1998-02-05 16:46:43 +01:00
|
|
|
{
|
2001-12-23 13:17:41 +01:00
|
|
|
if (!IS_SIMPLE_TYPE(type->type))
|
1998-02-26 05:46:47 +01:00
|
|
|
{
|
2001-12-23 13:17:41 +01:00
|
|
|
switch (type->type)
|
1998-02-26 05:46:47 +01:00
|
|
|
{
|
2001-10-25 07:50:21 +02:00
|
|
|
case ECPGt_array:
|
2001-12-23 13:17:41 +01:00
|
|
|
switch (type->u.element->type)
|
1999-02-28 08:25:34 +01:00
|
|
|
{
|
2001-10-25 07:50:21 +02:00
|
|
|
case ECPGt_array:
|
2008-05-16 17:20:04 +02:00
|
|
|
base_yyerror("internal error: found multidimensional array\n");
|
1999-02-28 08:25:34 +01:00
|
|
|
break;
|
|
|
|
case ECPGt_struct:
|
|
|
|
case ECPGt_union:
|
|
|
|
/* Array of structs. */
|
2001-12-23 13:17:41 +01:00
|
|
|
ECPGfree_struct_member(type->u.element->u.members);
|
|
|
|
free(type->u.element);
|
1999-02-28 08:25:34 +01:00
|
|
|
break;
|
1999-05-25 18:15:34 +02:00
|
|
|
default:
|
2001-12-23 13:17:41 +01:00
|
|
|
if (!IS_SIMPLE_TYPE(type->u.element->type))
|
2008-05-16 17:20:04 +02:00
|
|
|
base_yyerror("internal error: unknown datatype, please report this to <pgsql-bugs@postgresql.org>");
|
1999-02-28 08:25:34 +01:00
|
|
|
|
2001-12-23 13:17:41 +01:00
|
|
|
free(type->u.element);
|
1999-02-28 08:25:34 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ECPGt_struct:
|
|
|
|
case ECPGt_union:
|
2001-12-23 13:17:41 +01:00
|
|
|
ECPGfree_struct_member(type->u.members);
|
1999-02-28 08:25:34 +01:00
|
|
|
break;
|
|
|
|
default:
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized variable type code %d", type->type);
|
1999-02-28 08:25:34 +01:00
|
|
|
break;
|
1999-02-23 13:57:03 +01:00
|
|
|
}
|
1998-02-26 05:46:47 +01:00
|
|
|
}
|
2001-12-23 13:17:41 +01:00
|
|
|
free(type);
|
1998-02-05 16:46:43 +01:00
|
|
|
}
|
2000-02-22 20:57:12 +01:00
|
|
|
|
|
|
|
const char *
|
2001-12-23 13:17:41 +01:00
|
|
|
get_dtype(enum ECPGdtype type)
|
2000-02-22 20:57:12 +01:00
|
|
|
{
|
2001-12-23 13:17:41 +01:00
|
|
|
switch (type)
|
2000-02-22 20:57:12 +01:00
|
|
|
{
|
2001-10-25 07:50:21 +02:00
|
|
|
case ECPGd_count:
|
2000-02-22 20:57:12 +01:00
|
|
|
return ("ECPGd_countr");
|
|
|
|
break;
|
|
|
|
case ECPGd_data:
|
|
|
|
return ("ECPGd_data");
|
|
|
|
break;
|
|
|
|
case ECPGd_di_code:
|
|
|
|
return ("ECPGd_di_code");
|
|
|
|
break;
|
|
|
|
case ECPGd_di_precision:
|
|
|
|
return ("ECPGd_di_precision");
|
|
|
|
break;
|
|
|
|
case ECPGd_indicator:
|
|
|
|
return ("ECPGd_indicator");
|
|
|
|
break;
|
|
|
|
case ECPGd_key_member:
|
|
|
|
return ("ECPGd_key_member");
|
|
|
|
break;
|
|
|
|
case ECPGd_length:
|
|
|
|
return ("ECPGd_length");
|
|
|
|
break;
|
|
|
|
case ECPGd_name:
|
|
|
|
return ("ECPGd_name");
|
|
|
|
break;
|
|
|
|
case ECPGd_nullable:
|
|
|
|
return ("ECPGd_nullable");
|
|
|
|
break;
|
|
|
|
case ECPGd_octet:
|
|
|
|
return ("ECPGd_octet");
|
|
|
|
break;
|
|
|
|
case ECPGd_precision:
|
|
|
|
return ("ECPGd_precision");
|
|
|
|
break;
|
|
|
|
case ECPGd_ret_length:
|
|
|
|
return ("ECPGd_ret_length");
|
|
|
|
case ECPGd_ret_octet:
|
|
|
|
return ("ECPGd_ret_octet");
|
|
|
|
break;
|
2000-04-12 19:17:23 +02:00
|
|
|
case ECPGd_scale:
|
2000-02-22 20:57:12 +01:00
|
|
|
return ("ECPGd_scale");
|
|
|
|
break;
|
2000-04-12 19:17:23 +02:00
|
|
|
case ECPGd_type:
|
2000-02-22 20:57:12 +01:00
|
|
|
return ("ECPGd_type");
|
|
|
|
break;
|
2001-08-19 11:21:45 +02:00
|
|
|
case ECPGd_cardinality:
|
|
|
|
return ("ECPGd_cardinality");
|
2000-02-22 20:57:12 +01:00
|
|
|
default:
|
2009-01-23 13:43:32 +01:00
|
|
|
mmerror(PARSE_ERROR, ET_ERROR, "unrecognized descriptor item code %d", type);
|
2000-02-22 20:57:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|