mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Clean up whitespace and indentation in parser and scanner files
These are not touched by pgindent, so clean them up a bit manually.
This commit is contained in:
@ -47,13 +47,13 @@ static NDBOX * write_point_as_box(char *s, int dim);
|
||||
/* Grammar follows */
|
||||
%%
|
||||
|
||||
box:
|
||||
O_BRACKET paren_list COMMA paren_list C_BRACKET {
|
||||
|
||||
box: O_BRACKET paren_list COMMA paren_list C_BRACKET
|
||||
{
|
||||
int dim;
|
||||
|
||||
dim = delim_count($2, ',') + 1;
|
||||
if ( (delim_count($4, ',') + 1) != dim ) {
|
||||
if ((delim_count($4, ',') + 1) != dim)
|
||||
{
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_SYNTAX_ERROR),
|
||||
errmsg("bad cube representation"),
|
||||
@ -73,8 +73,9 @@ box:
|
||||
*((void **)result) = write_box( dim, $2, $4 );
|
||||
|
||||
}
|
||||
|
|
||||
paren_list COMMA paren_list {
|
||||
|
||||
| paren_list COMMA paren_list
|
||||
{
|
||||
int dim;
|
||||
|
||||
dim = delim_count($1, ',') + 1;
|
||||
@ -98,9 +99,9 @@ box:
|
||||
|
||||
*((void **)result) = write_box( dim, $1, $3 );
|
||||
}
|
||||
|
|
||||
|
||||
paren_list {
|
||||
| paren_list
|
||||
{
|
||||
int dim;
|
||||
|
||||
dim = delim_count($1, ',') + 1;
|
||||
@ -116,9 +117,8 @@ box:
|
||||
*((void **)result) = write_point_as_box($1, dim);
|
||||
}
|
||||
|
||||
|
|
||||
|
||||
list {
|
||||
| list
|
||||
{
|
||||
int dim;
|
||||
|
||||
dim = delim_count($1, ',') + 1;
|
||||
@ -134,20 +134,20 @@ box:
|
||||
}
|
||||
;
|
||||
|
||||
paren_list:
|
||||
O_PAREN list C_PAREN {
|
||||
paren_list: O_PAREN list C_PAREN
|
||||
{
|
||||
$$ = $2;
|
||||
}
|
||||
;
|
||||
|
||||
list:
|
||||
CUBEFLOAT {
|
||||
list: CUBEFLOAT
|
||||
{
|
||||
/* alloc enough space to be sure whole list will fit */
|
||||
$$ = palloc(scanbuflen + 1);
|
||||
strcpy($$, $1);
|
||||
}
|
||||
|
|
||||
list COMMA CUBEFLOAT {
|
||||
| list COMMA CUBEFLOAT
|
||||
{
|
||||
$$ = $1;
|
||||
strcat($$, ",");
|
||||
strcat($$, $3);
|
||||
@ -172,8 +172,8 @@ delim_count(char *s, char delim)
|
||||
static NDBOX *
|
||||
write_box(unsigned int dim, char *str1, char *str2)
|
||||
{
|
||||
NDBOX * bp;
|
||||
char * s;
|
||||
NDBOX *bp;
|
||||
char *s;
|
||||
int i;
|
||||
int size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
|
||||
|
||||
@ -183,14 +183,16 @@ write_box(unsigned int dim, char *str1, char *str2)
|
||||
|
||||
s = str1;
|
||||
bp->x[i=0] = strtod(s, NULL);
|
||||
while ((s = strchr(s, ',')) != NULL) {
|
||||
while ((s = strchr(s, ',')) != NULL)
|
||||
{
|
||||
s++; i++;
|
||||
bp->x[i] = strtod(s, NULL);
|
||||
}
|
||||
|
||||
s = str2;
|
||||
bp->x[i=dim] = strtod(s, NULL);
|
||||
while ((s = strchr(s, ',')) != NULL) {
|
||||
while ((s = strchr(s, ',')) != NULL)
|
||||
{
|
||||
s++; i++;
|
||||
bp->x[i] = strtod(s, NULL);
|
||||
}
|
||||
@ -198,14 +200,14 @@ write_box(unsigned int dim, char *str1, char *str2)
|
||||
return(bp);
|
||||
}
|
||||
|
||||
|
||||
static NDBOX *
|
||||
write_point_as_box(char *str, int dim)
|
||||
{
|
||||
NDBOX * bp;
|
||||
int i, size;
|
||||
NDBOX *bp;
|
||||
int i,
|
||||
size;
|
||||
double x;
|
||||
char * s = str;
|
||||
char *s = str;
|
||||
|
||||
size = offsetof(NDBOX, x[0]) + sizeof(double) * dim * 2;
|
||||
|
||||
@ -217,7 +219,8 @@ write_point_as_box(char *str, int dim)
|
||||
x = strtod(s, NULL);
|
||||
bp->x[0] = x;
|
||||
bp->x[dim] = x;
|
||||
while ((s = strchr(s, ',')) != NULL) {
|
||||
while ((s = strchr(s, ',')) != NULL)
|
||||
{
|
||||
s++; i++;
|
||||
x = strtod(s, NULL);
|
||||
bp->x[i] = x;
|
||||
|
@ -20,22 +20,22 @@
|
||||
#define YYMALLOC palloc
|
||||
#define YYFREE pfree
|
||||
|
||||
extern int seg_yylex(void);
|
||||
extern int seg_yylex(void);
|
||||
|
||||
extern int significant_digits(char *str); /* defined in seg.c */
|
||||
extern int significant_digits(char *str); /* defined in seg.c */
|
||||
|
||||
void seg_yyerror(const char *message);
|
||||
int seg_yyparse(void *result);
|
||||
void seg_yyerror(const char *message);
|
||||
int seg_yyparse(void *result);
|
||||
|
||||
static float seg_atof(char *value);
|
||||
static float seg_atof(char *value);
|
||||
|
||||
static char strbuf[25] = {
|
||||
static char strbuf[25] = {
|
||||
'0', '0', '0', '0', '0',
|
||||
'0', '0', '0', '0', '0',
|
||||
'0', '0', '0', '0', '0',
|
||||
'0', '0', '0', '0', '0',
|
||||
'0', '0', '0', '0', '\0'
|
||||
};
|
||||
};
|
||||
|
||||
%}
|
||||
|
||||
@ -63,8 +63,8 @@
|
||||
%%
|
||||
|
||||
|
||||
range:
|
||||
boundary PLUMIN deviation {
|
||||
range: boundary PLUMIN deviation
|
||||
{
|
||||
((SEG *)result)->lower = $1.val - $3.val;
|
||||
((SEG *)result)->upper = $1.val + $3.val;
|
||||
sprintf(strbuf, "%g", ((SEG *)result)->lower);
|
||||
@ -74,8 +74,9 @@ range:
|
||||
((SEG *)result)->l_ext = '\0';
|
||||
((SEG *)result)->u_ext = '\0';
|
||||
}
|
||||
|
|
||||
boundary RANGE boundary {
|
||||
|
||||
| boundary RANGE boundary
|
||||
{
|
||||
((SEG *)result)->lower = $1.val;
|
||||
((SEG *)result)->upper = $3.val;
|
||||
if ( ((SEG *)result)->lower > ((SEG *)result)->upper ) {
|
||||
@ -91,8 +92,9 @@ range:
|
||||
((SEG *)result)->l_ext = ( $1.ext ? $1.ext : '\0' );
|
||||
((SEG *)result)->u_ext = ( $3.ext ? $3.ext : '\0' );
|
||||
}
|
||||
|
|
||||
boundary RANGE {
|
||||
|
||||
| boundary RANGE
|
||||
{
|
||||
((SEG *)result)->lower = $1.val;
|
||||
((SEG *)result)->upper = HUGE_VAL;
|
||||
((SEG *)result)->l_sigd = $1.sigd;
|
||||
@ -100,8 +102,9 @@ range:
|
||||
((SEG *)result)->l_ext = ( $1.ext ? $1.ext : '\0' );
|
||||
((SEG *)result)->u_ext = '-';
|
||||
}
|
||||
|
|
||||
RANGE boundary {
|
||||
|
||||
| RANGE boundary
|
||||
{
|
||||
((SEG *)result)->lower = -HUGE_VAL;
|
||||
((SEG *)result)->upper = $2.val;
|
||||
((SEG *)result)->l_sigd = 0;
|
||||
@ -109,16 +112,17 @@ range:
|
||||
((SEG *)result)->l_ext = '-';
|
||||
((SEG *)result)->u_ext = ( $2.ext ? $2.ext : '\0' );
|
||||
}
|
||||
|
|
||||
boundary {
|
||||
|
||||
| boundary
|
||||
{
|
||||
((SEG *)result)->lower = ((SEG *)result)->upper = $1.val;
|
||||
((SEG *)result)->l_sigd = ((SEG *)result)->u_sigd = $1.sigd;
|
||||
((SEG *)result)->l_ext = ((SEG *)result)->u_ext = ( $1.ext ? $1.ext : '\0' );
|
||||
}
|
||||
;
|
||||
|
||||
boundary:
|
||||
SEGFLOAT {
|
||||
boundary: SEGFLOAT
|
||||
{
|
||||
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */
|
||||
float val = seg_atof($1);
|
||||
|
||||
@ -126,8 +130,8 @@ boundary:
|
||||
$$.sigd = significant_digits($1);
|
||||
$$.val = val;
|
||||
}
|
||||
|
|
||||
EXTENSION SEGFLOAT {
|
||||
| EXTENSION SEGFLOAT
|
||||
{
|
||||
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */
|
||||
float val = seg_atof($2);
|
||||
|
||||
@ -137,8 +141,8 @@ boundary:
|
||||
}
|
||||
;
|
||||
|
||||
deviation:
|
||||
SEGFLOAT {
|
||||
deviation: SEGFLOAT
|
||||
{
|
||||
/* temp variable avoids a gcc 3.3.x bug on Sparc64 */
|
||||
float val = seg_atof($1);
|
||||
|
||||
|
@ -261,53 +261,111 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
|
||||
newvar = ptr->variable;
|
||||
skip_set_var = true;
|
||||
}
|
||||
else if ((ptr->variable->type->type == ECPGt_char_variable) && (!strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement"))))
|
||||
else if ((ptr->variable->type->type == ECPGt_char_variable)
|
||||
&& (!strncmp(ptr->variable->name, "ECPGprepared_statement", strlen("ECPGprepared_statement"))))
|
||||
{
|
||||
newvar = ptr->variable;
|
||||
skip_set_var = true;
|
||||
}
|
||||
else if ((ptr->variable->type->type != ECPGt_varchar && ptr->variable->type->type != ECPGt_char && ptr->variable->type->type != ECPGt_unsigned_char && ptr->variable->type->type != ECPGt_string) && atoi(ptr->variable->type->size) > 1)
|
||||
else if ((ptr->variable->type->type != ECPGt_varchar
|
||||
&& ptr->variable->type->type != ECPGt_char
|
||||
&& ptr->variable->type->type != ECPGt_unsigned_char
|
||||
&& ptr->variable->type->type != ECPGt_string)
|
||||
&& atoi(ptr->variable->type->size) > 1)
|
||||
{
|
||||
newvar = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, mm_strdup("1"), ptr->variable->type->u.element->counter), ptr->variable->type->size), 0);
|
||||
newvar = new_variable(cat_str(4, mm_strdup("("),
|
||||
mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)),
|
||||
mm_strdup(" *)(ECPGget_var("),
|
||||
mm_strdup(temp)),
|
||||
ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
|
||||
mm_strdup("1"),
|
||||
ptr->variable->type->u.element->counter),
|
||||
ptr->variable->type->size),
|
||||
0);
|
||||
sprintf(temp, "%d, (", ecpg_internal_var++);
|
||||
}
|
||||
else if ((ptr->variable->type->type == ECPGt_varchar || ptr->variable->type->type == ECPGt_char || ptr->variable->type->type == ECPGt_unsigned_char || ptr->variable->type->type == ECPGt_string) && atoi(ptr->variable->type->size) > 1)
|
||||
else if ((ptr->variable->type->type == ECPGt_varchar
|
||||
|| ptr->variable->type->type == ECPGt_char
|
||||
|| ptr->variable->type->type == ECPGt_unsigned_char
|
||||
|| ptr->variable->type->type == ECPGt_string)
|
||||
&& atoi(ptr->variable->type->size) > 1)
|
||||
{
|
||||
newvar = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->counter), 0);
|
||||
newvar = new_variable(cat_str(4, mm_strdup("("),
|
||||
mm_strdup(ecpg_type_name(ptr->variable->type->type)),
|
||||
mm_strdup(" *)(ECPGget_var("),
|
||||
mm_strdup(temp)),
|
||||
ECPGmake_simple_type(ptr->variable->type->type,
|
||||
ptr->variable->type->size,
|
||||
ptr->variable->type->counter),
|
||||
0);
|
||||
if (ptr->variable->type->type == ECPGt_varchar)
|
||||
sprintf(temp, "%d, &(", ecpg_internal_var++);
|
||||
else
|
||||
sprintf(temp, "%d, (", ecpg_internal_var++);
|
||||
}
|
||||
else if (ptr->variable->type->type == ECPGt_struct || ptr->variable->type->type == ECPGt_union)
|
||||
else if (ptr->variable->type->type == ECPGt_struct
|
||||
|| ptr->variable->type->type == ECPGt_union)
|
||||
{
|
||||
sprintf(temp, "%d)))", ecpg_internal_var);
|
||||
newvar = new_variable(cat_str(4, mm_strdup("(*("), mm_strdup(ptr->variable->type->type_name), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->variable->type->u.members, ptr->variable->type->type, ptr->variable->type->type_name, ptr->variable->type->struct_sizeof), 0);
|
||||
newvar = new_variable(cat_str(4, mm_strdup("(*("),
|
||||
mm_strdup(ptr->variable->type->type_name),
|
||||
mm_strdup(" *)(ECPGget_var("),
|
||||
mm_strdup(temp)),
|
||||
ECPGmake_struct_type(ptr->variable->type->u.members,
|
||||
ptr->variable->type->type,
|
||||
ptr->variable->type->type_name,
|
||||
ptr->variable->type->struct_sizeof),
|
||||
0);
|
||||
sprintf(temp, "%d, &(", ecpg_internal_var++);
|
||||
}
|
||||
else if (ptr->variable->type->type == ECPGt_array)
|
||||
{
|
||||
if (ptr->variable->type->u.element->type == ECPGt_struct || ptr->variable->type->u.element->type == ECPGt_union)
|
||||
if (ptr->variable->type->u.element->type == ECPGt_struct
|
||||
|| ptr->variable->type->u.element->type == ECPGt_union)
|
||||
{
|
||||
sprintf(temp, "%d)))", ecpg_internal_var);
|
||||
newvar = new_variable(cat_str(4, mm_strdup("(*("), mm_strdup(ptr->variable->type->u.element->type_name), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->variable->type->u.element->u.members, ptr->variable->type->u.element->type, ptr->variable->type->u.element->type_name, ptr->variable->type->u.element->struct_sizeof), 0);
|
||||
newvar = new_variable(cat_str(4, mm_strdup("(*("),
|
||||
mm_strdup(ptr->variable->type->u.element->type_name),
|
||||
mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)),
|
||||
ECPGmake_struct_type(ptr->variable->type->u.element->u.members,
|
||||
ptr->variable->type->u.element->type,
|
||||
ptr->variable->type->u.element->type_name,
|
||||
ptr->variable->type->u.element->struct_sizeof),
|
||||
0);
|
||||
sprintf(temp, "%d, (", ecpg_internal_var++);
|
||||
}
|
||||
else
|
||||
{
|
||||
newvar = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, ptr->variable->type->u.element->size, ptr->variable->type->u.element->counter), ptr->variable->type->size), 0);
|
||||
newvar = new_variable(cat_str(4, mm_strdup("("),
|
||||
mm_strdup(ecpg_type_name(ptr->variable->type->type)),
|
||||
mm_strdup(" *)(ECPGget_var("),
|
||||
mm_strdup(temp)),
|
||||
ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type,
|
||||
ptr->variable->type->u.element->size,
|
||||
ptr->variable->type->u.element->counter),
|
||||
ptr->variable->type->size),
|
||||
0);
|
||||
sprintf(temp, "%d, &(", ecpg_internal_var++);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
newvar = new_variable(cat_str(4, mm_strdup("*("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->counter), 0);
|
||||
newvar = new_variable(cat_str(4, mm_strdup("*("),
|
||||
mm_strdup(ecpg_type_name(ptr->variable->type->type)),
|
||||
mm_strdup(" *)(ECPGget_var("),
|
||||
mm_strdup(temp)),
|
||||
ECPGmake_simple_type(ptr->variable->type->type,
|
||||
ptr->variable->type->size,
|
||||
ptr->variable->type->counter),
|
||||
0);
|
||||
sprintf(temp, "%d, &(", ecpg_internal_var++);
|
||||
}
|
||||
|
||||
/* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
|
||||
if (!skip_set_var)
|
||||
result = cat_str(5, result, mm_strdup("ECPGset_var("), mm_strdup(temp), mm_strdup(original_var), mm_strdup("), __LINE__);\n"));
|
||||
result = cat_str(5, result, mm_strdup("ECPGset_var("),
|
||||
mm_strdup(temp), mm_strdup(original_var),
|
||||
mm_strdup("), __LINE__);\n"));
|
||||
|
||||
/* now the indicator if there is one and it's not a global variable */
|
||||
if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
|
||||
@ -320,39 +378,79 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
|
||||
original_var = ptr->indicator->name;
|
||||
sprintf(temp, "%d))", ecpg_internal_var);
|
||||
|
||||
if (ptr->indicator->type->type == ECPGt_struct || ptr->indicator->type->type == ECPGt_union)
|
||||
if (ptr->indicator->type->type == ECPGt_struct
|
||||
|| ptr->indicator->type->type == ECPGt_union)
|
||||
{
|
||||
sprintf(temp, "%d)))", ecpg_internal_var);
|
||||
newind = new_variable(cat_str(4, mm_strdup("(*("), mm_strdup(ptr->indicator->type->type_name), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->indicator->type->u.members, ptr->indicator->type->type, ptr->indicator->type->type_name, ptr->indicator->type->struct_sizeof), 0);
|
||||
newind = new_variable(cat_str(4, mm_strdup("(*("),
|
||||
mm_strdup(ptr->indicator->type->type_name),
|
||||
mm_strdup(" *)(ECPGget_var("),
|
||||
mm_strdup(temp)),
|
||||
ECPGmake_struct_type(ptr->indicator->type->u.members,
|
||||
ptr->indicator->type->type,
|
||||
ptr->indicator->type->type_name,
|
||||
ptr->indicator->type->struct_sizeof),
|
||||
0);
|
||||
sprintf(temp, "%d, &(", ecpg_internal_var++);
|
||||
}
|
||||
else if (ptr->indicator->type->type == ECPGt_array)
|
||||
{
|
||||
if (ptr->indicator->type->u.element->type == ECPGt_struct || ptr->indicator->type->u.element->type == ECPGt_union)
|
||||
if (ptr->indicator->type->u.element->type == ECPGt_struct
|
||||
|| ptr->indicator->type->u.element->type == ECPGt_union)
|
||||
{
|
||||
sprintf(temp, "%d)))", ecpg_internal_var);
|
||||
newind = new_variable(cat_str(4, mm_strdup("(*("), mm_strdup(ptr->indicator->type->u.element->type_name), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_struct_type(ptr->indicator->type->u.element->u.members, ptr->indicator->type->u.element->type, ptr->indicator->type->u.element->type_name, ptr->indicator->type->u.element->struct_sizeof), 0);
|
||||
newind = new_variable(cat_str(4, mm_strdup("(*("),
|
||||
mm_strdup(ptr->indicator->type->u.element->type_name),
|
||||
mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)),
|
||||
ECPGmake_struct_type(ptr->indicator->type->u.element->u.members,
|
||||
ptr->indicator->type->u.element->type,
|
||||
ptr->indicator->type->u.element->type_name,
|
||||
ptr->indicator->type->u.element->struct_sizeof),
|
||||
0);
|
||||
sprintf(temp, "%d, (", ecpg_internal_var++);
|
||||
}
|
||||
else
|
||||
{
|
||||
newind = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type, ptr->indicator->type->u.element->size, ptr->indicator->type->u.element->counter), ptr->indicator->type->size), 0);
|
||||
newind = new_variable(cat_str(4, mm_strdup("("),
|
||||
mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)),
|
||||
mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)),
|
||||
ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type,
|
||||
ptr->indicator->type->u.element->size,
|
||||
ptr->indicator->type->u.element->counter),
|
||||
ptr->indicator->type->size),
|
||||
0);
|
||||
sprintf(temp, "%d, &(", ecpg_internal_var++);
|
||||
}
|
||||
}
|
||||
else if (atoi(ptr->indicator->type->size) > 1)
|
||||
{
|
||||
newind = new_variable(cat_str(4, mm_strdup("("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->counter), 0);
|
||||
newind = new_variable(cat_str(4, mm_strdup("("),
|
||||
mm_strdup(ecpg_type_name(ptr->indicator->type->type)),
|
||||
mm_strdup(" *)(ECPGget_var("),
|
||||
mm_strdup(temp)),
|
||||
ECPGmake_simple_type(ptr->indicator->type->type,
|
||||
ptr->indicator->type->size,
|
||||
ptr->variable->type->counter),
|
||||
0);
|
||||
sprintf(temp, "%d, (", ecpg_internal_var++);
|
||||
}
|
||||
else
|
||||
{
|
||||
newind = new_variable(cat_str(4, mm_strdup("*("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->counter), 0);
|
||||
newind = new_variable(cat_str(4, mm_strdup("*("),
|
||||
mm_strdup(ecpg_type_name(ptr->indicator->type->type)),
|
||||
mm_strdup(" *)(ECPGget_var("),
|
||||
mm_strdup(temp)),
|
||||
ECPGmake_simple_type(ptr->indicator->type->type,
|
||||
ptr->indicator->type->size,
|
||||
ptr->variable->type->counter),
|
||||
0);
|
||||
sprintf(temp, "%d, &(", ecpg_internal_var++);
|
||||
}
|
||||
|
||||
/* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
|
||||
result = cat_str(5, result, mm_strdup("ECPGset_var("), mm_strdup(temp), mm_strdup(original_var), mm_strdup("), __LINE__);\n"));
|
||||
result = cat_str(5, result, mm_strdup("ECPGset_var("),
|
||||
mm_strdup(temp), mm_strdup(original_var),
|
||||
mm_strdup("), __LINE__);\n"));
|
||||
}
|
||||
|
||||
add_variable_to_tail(&newlist, newvar, newind);
|
||||
@ -407,7 +505,8 @@ add_additional_variables(char *name, bool insert)
|
||||
}
|
||||
|
||||
static void
|
||||
add_typedef(char *name, char * dimension, char * length, enum ECPGttype type_enum, char *type_dimension, char *type_index, int initializer, int array)
|
||||
add_typedef(char *name, char *dimension, char *length, enum ECPGttype type_enum,
|
||||
char *type_dimension, char *type_index, int initializer, int array)
|
||||
{
|
||||
/* add entry to list */
|
||||
struct typedefs *ptr, *this;
|
||||
|
@ -42,9 +42,8 @@ at: AT connection_object
|
||||
{
|
||||
connection = $2;
|
||||
/*
|
||||
* Do we have a variable as connection target?
|
||||
* Remove the variable from the variable
|
||||
* list or else it will be used twice
|
||||
* Do we have a variable as connection target? Remove the variable
|
||||
* from the variable list or else it will be used twice.
|
||||
*/
|
||||
if (argsinsert != NULL)
|
||||
argsinsert = NULL;
|
||||
@ -242,7 +241,9 @@ opt_options: Op connect_options
|
||||
;
|
||||
|
||||
connect_options: ColId opt_opt_value
|
||||
{ $$ = make2_str($1, $2); }
|
||||
{
|
||||
$$ = make2_str($1, $2);
|
||||
}
|
||||
| ColId opt_opt_value Op connect_options
|
||||
{
|
||||
if (strlen($3) == 0)
|
||||
@ -265,7 +266,8 @@ opt_opt_value: /*EMPTY*/
|
||||
{ $$ = make2_str(mm_strdup("="), $2); }
|
||||
;
|
||||
|
||||
prepared_name: name {
|
||||
prepared_name: name
|
||||
{
|
||||
if ($1[0] == '\"' && $1[strlen($1)-1] == '\"') /* already quoted? */
|
||||
$$ = $1;
|
||||
else /* not quoted => convert to lowercase */
|
||||
@ -767,7 +769,10 @@ s_struct_union: SQL_STRUCT
|
||||
ECPGstruct_sizeof = mm_strdup(""); /* This must not be NULL to distinguish from simple types. */
|
||||
$$ = mm_strdup("struct");
|
||||
}
|
||||
| UNION { $$ = mm_strdup("union"); }
|
||||
| UNION
|
||||
{
|
||||
$$ = mm_strdup("union");
|
||||
}
|
||||
;
|
||||
|
||||
simple_type: unsigned_type { $$=$1; }
|
||||
@ -1163,7 +1168,10 @@ IntConstVar: Iconst
|
||||
new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
|
||||
$$ = $1;
|
||||
}
|
||||
| cvariable { $$ = $1; }
|
||||
| cvariable
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
;
|
||||
|
||||
desc_header_item: SQL_COUNT { $$ = ECPGd_count; }
|
||||
@ -1206,7 +1214,12 @@ AllConstVar: ecpg_fconst
|
||||
new_variable($1, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
|
||||
$$ = $1;
|
||||
}
|
||||
| IntConstVar { $$ = $1; }
|
||||
|
||||
| IntConstVar
|
||||
{
|
||||
$$ = $1;
|
||||
}
|
||||
|
||||
| '-' ecpg_fconst
|
||||
{
|
||||
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
|
||||
@ -1216,6 +1229,7 @@ AllConstVar: ecpg_fconst
|
||||
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
|
||||
$$ = var;
|
||||
}
|
||||
|
||||
| '-' Iconst
|
||||
{
|
||||
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
|
||||
@ -1225,6 +1239,7 @@ AllConstVar: ecpg_fconst
|
||||
new_variable(var, ECPGmake_simple_type(ECPGt_const, length, 0), 0);
|
||||
$$ = var;
|
||||
}
|
||||
|
||||
| ecpg_sconst
|
||||
{
|
||||
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
|
||||
|
Reference in New Issue
Block a user