2001-02-10 02:31:31 +00:00
|
|
|
#include "postgres_fe.h"
|
2000-02-17 19:48:58 +00:00
|
|
|
|
|
|
|
#include "extern.h"
|
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
struct variable *allvariables = NULL;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
|
|
|
struct variable *
|
2002-01-13 08:52:09 +00:00
|
|
|
new_variable(const char *name, struct ECPGtype * type, int brace_level)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
struct variable *p = (struct variable *) mm_alloc(sizeof(struct variable));
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
p->name = mm_strdup(name);
|
|
|
|
p->type = type;
|
2002-01-13 08:52:09 +00:00
|
|
|
p->brace_level = brace_level;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
p->next = allvariables;
|
|
|
|
allvariables = p;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
return (p);
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct variable *
|
2002-01-13 08:52:09 +00:00
|
|
|
find_struct_member(char *name, char *str, struct ECPGstruct_member * members, int brace_level)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
char *next = strchr(++str, '.'),
|
|
|
|
c = '\0';
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
if (next != NULL)
|
|
|
|
{
|
|
|
|
c = *next;
|
|
|
|
*next = '\0';
|
|
|
|
}
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
for (; members; members = members->next)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
if (strcmp(members->name, str) == 0)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
if (c == '\0')
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
/* found the end */
|
2001-12-23 12:17:41 +00:00
|
|
|
switch (members->type->type)
|
2000-04-12 17:17:23 +00:00
|
|
|
{
|
|
|
|
case ECPGt_array:
|
2002-01-13 08:52:09 +00:00
|
|
|
return (new_variable(name, ECPGmake_array_type(members->type->u.element, members->type->size), brace_level));
|
2000-04-12 17:17:23 +00:00
|
|
|
case ECPGt_struct:
|
|
|
|
case ECPGt_union:
|
2002-01-13 08:52:09 +00:00
|
|
|
return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->struct_sizeof), brace_level));
|
2000-04-12 17:17:23 +00:00
|
|
|
default:
|
2002-01-13 08:52:09 +00:00
|
|
|
return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size), brace_level));
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
2000-04-12 17:17:23 +00:00
|
|
|
else
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
*next = c;
|
|
|
|
if (c == '-')
|
|
|
|
{
|
|
|
|
next++;
|
2002-01-13 08:52:09 +00:00
|
|
|
return (find_struct_member(name, next, members->type->u.element->u.members, brace_level));
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
|
|
|
else
|
2002-01-13 08:52:09 +00:00
|
|
|
return (find_struct_member(name, next, members->type->u.members, brace_level));
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
return (NULL);
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct variable *
|
2000-04-12 17:17:23 +00:00
|
|
|
find_struct(char *name, char *next)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
struct variable *p;
|
|
|
|
char c = *next;
|
|
|
|
|
|
|
|
/* first get the mother structure entry */
|
|
|
|
*next = '\0';
|
|
|
|
p = find_variable(name);
|
|
|
|
|
|
|
|
if (c == '-')
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2001-12-23 12:17:41 +00:00
|
|
|
if (p->type->type != ECPGt_array)
|
2000-04-12 17:17:23 +00:00
|
|
|
{
|
2002-09-02 06:11:43 +00:00
|
|
|
snprintf(errortext, sizeof(errortext), "variable %s is not a pointer", name);
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, errortext);
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
|
|
|
|
2001-12-23 12:17:41 +00:00
|
|
|
if (p->type->u.element->type != ECPGt_struct && p->type->u.element->type != ECPGt_union)
|
2000-04-12 17:17:23 +00:00
|
|
|
{
|
2002-09-02 06:11:43 +00:00
|
|
|
snprintf(errortext, sizeof(errortext), "variable %s is not a pointer to a structure or a union", name);
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, errortext);
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* restore the name, we will need it later on */
|
|
|
|
*next = c;
|
|
|
|
next++;
|
|
|
|
|
2002-01-13 08:52:09 +00:00
|
|
|
return find_struct_member(name, next, p->type->u.element->u.members, p->brace_level);
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
2000-04-12 17:17:23 +00:00
|
|
|
else
|
|
|
|
{
|
2001-12-23 12:17:41 +00:00
|
|
|
if (p->type->type != ECPGt_struct && p->type->type != ECPGt_union)
|
2000-04-12 17:17:23 +00:00
|
|
|
{
|
2002-09-02 06:11:43 +00:00
|
|
|
snprintf(errortext, sizeof(errortext), "variable %s is neither a structure nor a union", name);
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, errortext);
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
/* restore the name, we will need it later on */
|
|
|
|
*next = c;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2002-01-13 08:52:09 +00:00
|
|
|
return find_struct_member(name, next, p->type->u.members, p->brace_level);
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct variable *
|
2000-04-12 17:17:23 +00:00
|
|
|
find_simple(char *name)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
struct variable *p;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
for (p = allvariables; p; p = p->next)
|
|
|
|
{
|
|
|
|
if (strcmp(p->name, name) == 0)
|
|
|
|
return p;
|
|
|
|
}
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
return (NULL);
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Note that this function will end the program in case of an unknown */
|
|
|
|
/* variable */
|
|
|
|
struct variable *
|
2000-04-12 17:17:23 +00:00
|
|
|
find_variable(char *name)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
char *next;
|
|
|
|
struct variable *p;
|
|
|
|
|
|
|
|
if ((next = strchr(name, '.')) != NULL)
|
|
|
|
p = find_struct(name, next);
|
|
|
|
else if ((next = strstr(name, "->")) != NULL)
|
|
|
|
p = find_struct(name, next);
|
|
|
|
else
|
|
|
|
p = find_simple(name);
|
|
|
|
|
|
|
|
if (p == NULL)
|
|
|
|
{
|
2002-09-02 06:11:43 +00:00
|
|
|
snprintf(errortext, sizeof(errortext), "The variable %s is not declared", name);
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, errortext);
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return (p);
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
remove_variables(int brace_level)
|
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
struct variable *p,
|
|
|
|
*prev;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
for (p = prev = allvariables; p; p = p ? p->next : NULL)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
if (p->brace_level >= brace_level)
|
|
|
|
{
|
|
|
|
/* remove it */
|
|
|
|
if (p == allvariables)
|
|
|
|
prev = allvariables = p->next;
|
|
|
|
else
|
|
|
|
prev->next = p->next;
|
|
|
|
|
|
|
|
ECPGfree_type(p->type);
|
|
|
|
free(p->name);
|
|
|
|
free(p);
|
|
|
|
p = prev;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
prev = p;
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Here are the variables that need to be handled on every request.
|
|
|
|
* These are of two kinds: input and output.
|
|
|
|
* I will make two lists for them.
|
|
|
|
*/
|
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
struct arguments *argsinsert = NULL;
|
|
|
|
struct arguments *argsresult = NULL;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
|
|
|
void
|
|
|
|
reset_variables(void)
|
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
argsinsert = NULL;
|
|
|
|
argsresult = NULL;
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
2000-03-09 09:17:16 +00:00
|
|
|
/* Insert a new variable into our request list. */
|
2000-02-17 19:48:58 +00:00
|
|
|
void
|
2003-05-22 07:58:45 +00:00
|
|
|
add_variable(struct arguments ** list, struct variable * var, char * var_array_element, struct variable * ind, char * ind_array_element)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
struct arguments *p = (struct arguments *) mm_alloc(sizeof(struct arguments));
|
|
|
|
|
|
|
|
p->variable = var;
|
2003-05-22 07:58:45 +00:00
|
|
|
p->var_array_element = var_array_element;
|
2000-04-12 17:17:23 +00:00
|
|
|
p->indicator = ind;
|
2003-05-22 07:58:45 +00:00
|
|
|
p->ind_array_element = ind_array_element;
|
2000-04-12 17:17:23 +00:00
|
|
|
p->next = *list;
|
|
|
|
*list = p;
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
2000-03-09 09:17:16 +00:00
|
|
|
/* Append a new variable to our request list. */
|
|
|
|
void
|
2003-05-22 07:58:45 +00:00
|
|
|
append_variable(struct arguments ** list, struct variable * var, char * var_array_element, struct variable * ind, char * ind_array_element)
|
2000-03-09 09:17:16 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
struct arguments *p,
|
|
|
|
*new = (struct arguments *) mm_alloc(sizeof(struct arguments));
|
|
|
|
|
|
|
|
for (p = *list; p && p->next; p = p->next);
|
|
|
|
|
|
|
|
new->variable = var;
|
2003-05-22 07:58:45 +00:00
|
|
|
new->var_array_element = var_array_element;
|
2000-04-12 17:17:23 +00:00
|
|
|
new->indicator = ind;
|
2003-05-22 07:58:45 +00:00
|
|
|
new->ind_array_element = ind_array_element;
|
2000-04-12 17:17:23 +00:00
|
|
|
new->next = NULL;
|
|
|
|
|
|
|
|
if (p)
|
|
|
|
p->next = new;
|
|
|
|
else
|
|
|
|
*list = new;
|
2000-03-09 09:17:16 +00:00
|
|
|
}
|
2000-02-17 19:48:58 +00:00
|
|
|
|
|
|
|
/* Dump out a list of all the variable on this list.
|
|
|
|
This is a recursive function that works from the end of the list and
|
|
|
|
deletes the list as we go on.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
dump_variables(struct arguments * list, int mode)
|
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
if (list == NULL)
|
|
|
|
return;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
/*
|
|
|
|
* The list is build up from the beginning so lets first dump the end
|
|
|
|
* of the list:
|
|
|
|
*/
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
dump_variables(list->next, mode);
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
/* Then the current element and its indicator */
|
2003-05-22 07:58:45 +00:00
|
|
|
ECPGdump_a_type(yyout, list->variable->name, list->variable->type, list->var_array_element,
|
|
|
|
list->indicator->name, list->indicator->type, list->ind_array_element,
|
|
|
|
NULL, NULL, 0, NULL, NULL);
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
/* Then release the list element. */
|
|
|
|
if (mode != 0)
|
|
|
|
free(list);
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2000-04-12 17:17:23 +00:00
|
|
|
check_indicator(struct ECPGtype * var)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
|
|
|
/* make sure this is a valid indicator variable */
|
2001-12-23 12:17:41 +00:00
|
|
|
switch (var->type)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
struct ECPGstruct_member *p;
|
2000-02-17 19:48:58 +00:00
|
|
|
|
|
|
|
case ECPGt_short:
|
|
|
|
case ECPGt_int:
|
|
|
|
case ECPGt_long:
|
2000-09-19 11:47:16 +00:00
|
|
|
case ECPGt_long_long:
|
2000-02-17 19:48:58 +00:00
|
|
|
case ECPGt_unsigned_short:
|
|
|
|
case ECPGt_unsigned_int:
|
|
|
|
case ECPGt_unsigned_long:
|
2000-09-19 11:47:16 +00:00
|
|
|
case ECPGt_unsigned_long_long:
|
2000-02-17 19:48:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ECPGt_struct:
|
|
|
|
case ECPGt_union:
|
|
|
|
for (p = var->u.members; p; p = p->next)
|
2001-12-23 12:17:41 +00:00
|
|
|
check_indicator(p->type);
|
2000-02-17 19:48:58 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case ECPGt_array:
|
|
|
|
check_indicator(var->u.element);
|
|
|
|
break;
|
2000-04-12 17:17:23 +00:00
|
|
|
default:
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_ERROR, "indicator variable must be integer type");
|
2000-02-17 19:48:58 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct typedefs *
|
|
|
|
get_typedef(char *name)
|
|
|
|
{
|
|
|
|
struct typedefs *this;
|
|
|
|
|
|
|
|
for (this = types; this && strcmp(this->name, name); this = this->next);
|
|
|
|
if (!this)
|
|
|
|
{
|
2002-09-02 06:11:43 +00:00
|
|
|
snprintf(errortext, sizeof(errortext), "invalid datatype '%s'", name);
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, errortext);
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
return (this);
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2003-05-14 14:37:36 +00:00
|
|
|
adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *type_dimension, char *type_index, int pointer_len)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(type_index) >= 0)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(*length) >= 0)
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, "No multi-dimensional array support");
|
2000-02-17 19:48:58 +00:00
|
|
|
|
|
|
|
*length = type_index;
|
|
|
|
}
|
2000-04-12 17:17:23 +00:00
|
|
|
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(type_dimension) >= 0)
|
2000-02-17 19:48:58 +00:00
|
|
|
{
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(*dimension) >= 0 && atoi(*length) >= 0)
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, "No multi-dimensional array support");
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(*dimension) >= 0)
|
2000-02-17 19:48:58 +00:00
|
|
|
*length = *dimension;
|
|
|
|
|
|
|
|
*dimension = type_dimension;
|
|
|
|
}
|
2002-09-04 20:31:48 +00:00
|
|
|
|
|
|
|
if (pointer_len > 2)
|
|
|
|
{
|
|
|
|
snprintf(errortext, sizeof(errortext), "No multilevel (more than 2) pointer supported %d", pointer_len);
|
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, errortext);
|
2001-12-10 14:55:47 +00:00
|
|
|
/* mmerror(PARSE_ERROR, ET_FATAL, "No multilevel (more than 2) pointer supported %d",pointer_len);*/
|
2001-11-16 08:36:37 +00:00
|
|
|
}
|
2002-09-04 20:31:48 +00:00
|
|
|
if (pointer_len > 1 && type_enum != ECPGt_char && type_enum != ECPGt_unsigned_char)
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, "No pointer to pointer supported for this type");
|
2001-11-16 08:36:37 +00:00
|
|
|
|
2003-05-14 14:37:36 +00:00
|
|
|
if (pointer_len > 1 && (atoi(*length) >= 0 || atoi(*dimension) >= 0))
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, "No multi-dimensional array support");
|
2000-02-17 19:48:58 +00:00
|
|
|
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(*length) >= 0 && atoi(*dimension) >= 0 && pointer_len)
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, "No multi-dimensional array support");
|
2000-02-17 19:48:58 +00:00
|
|
|
|
|
|
|
switch (type_enum)
|
|
|
|
{
|
2000-04-12 17:17:23 +00:00
|
|
|
case ECPGt_struct:
|
|
|
|
case ECPGt_union:
|
|
|
|
/* pointer has to get dimension 0 */
|
2001-11-16 08:36:37 +00:00
|
|
|
if (pointer_len)
|
2000-04-12 17:17:23 +00:00
|
|
|
{
|
|
|
|
*length = *dimension;
|
2003-05-14 14:37:36 +00:00
|
|
|
*dimension = make_str("0");
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
|
|
|
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(*length) >= 0)
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, "No multi-dimensional array support for structures");
|
2000-04-12 17:17:23 +00:00
|
|
|
|
|
|
|
break;
|
|
|
|
case ECPGt_varchar:
|
|
|
|
/* pointer has to get dimension 0 */
|
2001-11-16 08:36:37 +00:00
|
|
|
if (pointer_len)
|
2003-05-14 14:37:36 +00:00
|
|
|
*dimension = make_str("0");
|
2000-04-12 17:17:23 +00:00
|
|
|
|
|
|
|
/* one index is the string length */
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(*length) < 0)
|
2000-04-12 17:17:23 +00:00
|
|
|
{
|
|
|
|
*length = *dimension;
|
2003-05-14 14:37:36 +00:00
|
|
|
*dimension = make_str("-1");
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
case ECPGt_char:
|
|
|
|
case ECPGt_unsigned_char:
|
2001-11-16 08:36:37 +00:00
|
|
|
/* char ** */
|
2002-09-04 20:31:48 +00:00
|
|
|
if (pointer_len == 2)
|
2001-11-16 08:36:37 +00:00
|
|
|
{
|
2003-05-14 14:37:36 +00:00
|
|
|
*length = *dimension = make_str("0");
|
2001-11-16 08:36:37 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-09-04 20:31:48 +00:00
|
|
|
|
2000-04-12 17:17:23 +00:00
|
|
|
/* pointer has to get length 0 */
|
2002-09-04 20:31:48 +00:00
|
|
|
if (pointer_len == 1)
|
2003-05-14 14:37:36 +00:00
|
|
|
*length = make_str("0");
|
2000-04-12 17:17:23 +00:00
|
|
|
|
|
|
|
/* one index is the string length */
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(*length) < 0)
|
2000-04-12 17:17:23 +00:00
|
|
|
{
|
2003-05-14 14:37:36 +00:00
|
|
|
*length = (atoi(*dimension) < 0) ? make_str("1") : *dimension;
|
|
|
|
*dimension = make_str("-1");
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* a pointer has dimension = 0 */
|
2001-11-16 08:36:37 +00:00
|
|
|
if (pointer_len)
|
2000-04-12 17:17:23 +00:00
|
|
|
{
|
|
|
|
*length = *dimension;
|
2003-05-14 14:37:36 +00:00
|
|
|
*dimension = make_str("0");
|
2000-04-12 17:17:23 +00:00
|
|
|
}
|
|
|
|
|
2003-05-14 14:37:36 +00:00
|
|
|
if (atoi(*length) >= 0)
|
2001-12-10 14:55:47 +00:00
|
|
|
mmerror(PARSE_ERROR, ET_FATAL, "No multi-dimensional array support for simple data types");
|
2000-04-12 17:17:23 +00:00
|
|
|
|
|
|
|
break;
|
2000-02-17 19:48:58 +00:00
|
|
|
}
|
|
|
|
}
|