aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/ecpg/preproc/variable.c
diff options
context:
space:
mode:
authorMichael Meskes <meskes@postgresql.org>2001-11-16 08:36:37 +0000
committerMichael Meskes <meskes@postgresql.org>2001-11-16 08:36:37 +0000
commit7845954e49c111f48f65f400fd26ef4cadfd7dd4 (patch)
treeb72876ea50ce134b9b5632a5d5114f1fd050db53 /src/interfaces/ecpg/preproc/variable.c
parent949af991fc8c1f03af4eb1f940b96b4b5499e937 (diff)
downloadpostgresql-7845954e49c111f48f65f400fd26ef4cadfd7dd4.tar.gz
postgresql-7845954e49c111f48f65f400fd26ef4cadfd7dd4.zip
Committed again to add the missing files/patches.
Diffstat (limited to 'src/interfaces/ecpg/preproc/variable.c')
-rw-r--r--src/interfaces/ecpg/preproc/variable.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c
index 0c5749b7891..b39c0e60ef4 100644
--- a/src/interfaces/ecpg/preproc/variable.c
+++ b/src/interfaces/ecpg/preproc/variable.c
@@ -298,7 +298,7 @@ get_typedef(char *name)
}
void
-adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dimension, int type_index, bool pointer)
+adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dimension, int type_index, int pointer_len)
{
if (type_index >= 0)
{
@@ -318,8 +318,19 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
*dimension = type_dimension;
}
+
+ if (pointer_len>2)
+ { sprintf(errortext, "No multilevel (more than 2) pointer supported %d",pointer_len);
+ mmerror(ET_FATAL, errortext);
+// mmerror(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)
+ mmerror(ET_FATAL, "No pointer to pointer supported for this type");
+
+ if (pointer_len>1 && (*length >= 0 || *dimension >= 0))
+ mmerror(ET_FATAL, "No multi-dimensional array support");
- if (*length >= 0 && *dimension >= 0 && pointer)
+ if (*length >= 0 && *dimension >= 0 && pointer_len)
mmerror(ET_FATAL, "No multi-dimensional array support");
switch (type_enum)
@@ -327,7 +338,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
case ECPGt_struct:
case ECPGt_union:
/* pointer has to get dimension 0 */
- if (pointer)
+ if (pointer_len)
{
*length = *dimension;
*dimension = 0;
@@ -339,7 +350,7 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
break;
case ECPGt_varchar:
/* pointer has to get dimension 0 */
- if (pointer)
+ if (pointer_len)
*dimension = 0;
/* one index is the string length */
@@ -352,8 +363,15 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
break;
case ECPGt_char:
case ECPGt_unsigned_char:
+ /* char ** */
+ if (pointer_len==2)
+ {
+ *length = *dimension = 0;
+ break;
+ }
+
/* pointer has to get length 0 */
- if (pointer)
+ if (pointer_len==1)
*length = 0;
/* one index is the string length */
@@ -362,11 +380,10 @@ adjust_array(enum ECPGttype type_enum, int *dimension, int *length, int type_dim
*length = (*dimension < 0) ? 1 : *dimension;
*dimension = -1;
}
-
break;
default:
/* a pointer has dimension = 0 */
- if (pointer)
+ if (pointer_len)
{
*length = *dimension;
*dimension = 0;