mirror of https://github.com/postgres/postgres
Clean up indentation and whitespace inconsistencies in ecpg.
ecpg's lexer and parser files aren't normally processed by
pgindent, and unsurprisingly there's a lot of code in there
that doesn't really match project style. I spent some time
running pgindent over the fragments of these files that are
C code, and this is the result. This is in the same spirit
as commit 30ed71e42
, though apparently Peter used a different
method for that one, since it didn't find these problems.
Discussion: https://postgr.es/m/2011420.1713493114@sss.pgh.pa.us
This commit is contained in:
parent
516b87502d
commit
97add39c03
|
@ -22,7 +22,9 @@ ECPG: stmtDeallocateStmt block
|
||||||
output_deallocate_prepare_statement($1);
|
output_deallocate_prepare_statement($1);
|
||||||
}
|
}
|
||||||
ECPG: stmtDeclareCursorStmt block
|
ECPG: stmtDeclareCursorStmt block
|
||||||
{ output_simple_statement($1, (strncmp($1, "ECPGset_var", strlen("ECPGset_var")) == 0) ? 4 : 0); }
|
{
|
||||||
|
output_simple_statement($1, (strncmp($1, "ECPGset_var", strlen("ECPGset_var")) == 0) ? 4 : 0);
|
||||||
|
}
|
||||||
ECPG: stmtDiscardStmt block
|
ECPG: stmtDiscardStmt block
|
||||||
ECPG: stmtFetchStmt block
|
ECPG: stmtFetchStmt block
|
||||||
{ output_statement($1, 1, ECPGst_normal); }
|
{ output_statement($1, 1, ECPGst_normal); }
|
||||||
|
@ -47,7 +49,10 @@ ECPG: stmtExecuteStmt block
|
||||||
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
|
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
|
||||||
char *str = mm_strdup($1.name + 1);
|
char *str = mm_strdup($1.name + 1);
|
||||||
|
|
||||||
/* It must be cut off double quotation because new_variable() double-quotes. */
|
/*
|
||||||
|
* It must be cut off double quotation because new_variable()
|
||||||
|
* double-quotes.
|
||||||
|
*/
|
||||||
str[strlen(str) - 1] = '\0';
|
str[strlen(str) - 1] = '\0';
|
||||||
sprintf(length, "%zu", strlen(str));
|
sprintf(length, "%zu", strlen(str));
|
||||||
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
|
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
|
||||||
|
@ -63,6 +68,7 @@ ECPG: stmtPrepareStmt block
|
||||||
else if (strlen($1.type) == 0)
|
else if (strlen($1.type) == 0)
|
||||||
{
|
{
|
||||||
char *stmt = cat_str(3, mm_strdup("\""), $1.stmt, mm_strdup("\""));
|
char *stmt = cat_str(3, mm_strdup("\""), $1.stmt, mm_strdup("\""));
|
||||||
|
|
||||||
output_prepare_statement($1.name, stmt);
|
output_prepare_statement($1.name, stmt);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -75,7 +81,10 @@ ECPG: stmtPrepareStmt block
|
||||||
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
|
char *length = mm_alloc(sizeof(int) * CHAR_BIT * 10 / 3);
|
||||||
char *str = mm_strdup($1.name + 1);
|
char *str = mm_strdup($1.name + 1);
|
||||||
|
|
||||||
/* It must be cut off double quotation because new_variable() double-quotes. */
|
/*
|
||||||
|
* It must be cut off double quotation because new_variable()
|
||||||
|
* double-quotes.
|
||||||
|
*/
|
||||||
str[strlen(str) - 1] = '\0';
|
str[strlen(str) - 1] = '\0';
|
||||||
sprintf(length, "%zu", strlen(str));
|
sprintf(length, "%zu", strlen(str));
|
||||||
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
|
add_variable_to_tail(&argsinsert, new_variable(str, ECPGmake_simple_type(ECPGt_const, length, 0), 0), &no_indicator);
|
||||||
|
@ -152,7 +161,10 @@ ECPG: stmtViewStmt rule
|
||||||
whenever_action(2);
|
whenever_action(2);
|
||||||
free($1);
|
free($1);
|
||||||
}
|
}
|
||||||
| ECPGExecuteImmediateStmt { output_statement($1, 0, ECPGst_exec_immediate); }
|
| ECPGExecuteImmediateStmt
|
||||||
|
{
|
||||||
|
output_statement($1, 0, ECPGst_exec_immediate);
|
||||||
|
}
|
||||||
| ECPGFree
|
| ECPGFree
|
||||||
{
|
{
|
||||||
const char *con = connection ? connection : "NULL";
|
const char *con = connection ? connection : "NULL";
|
||||||
|
@ -245,6 +257,7 @@ ECPG: stmtViewStmt rule
|
||||||
ECPG: where_or_current_clauseWHERECURRENT_POFcursor_name block
|
ECPG: where_or_current_clauseWHERECURRENT_POFcursor_name block
|
||||||
{
|
{
|
||||||
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
||||||
|
|
||||||
$$ = cat_str(2, mm_strdup("where current of"), cursor_marker);
|
$$ = cat_str(2, mm_strdup("where current of"), cursor_marker);
|
||||||
}
|
}
|
||||||
ECPG: CopyStmtCOPYopt_binaryqualified_nameopt_column_listcopy_fromopt_programcopy_file_namecopy_delimiteropt_withcopy_optionswhere_clause addon
|
ECPG: CopyStmtCOPYopt_binaryqualified_nameopt_column_listcopy_fromopt_programcopy_file_namecopy_delimiteropt_withcopy_optionswhere_clause addon
|
||||||
|
@ -259,9 +272,9 @@ ECPG: var_valueNumericOnly addon
|
||||||
}
|
}
|
||||||
ECPG: fetch_argscursor_name addon
|
ECPG: fetch_argscursor_name addon
|
||||||
struct cursor *ptr = add_additional_variables($1, false);
|
struct cursor *ptr = add_additional_variables($1, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
if ($1[0] == ':')
|
if ($1[0] == ':')
|
||||||
{
|
{
|
||||||
free($1);
|
free($1);
|
||||||
|
@ -269,9 +282,9 @@ ECPG: fetch_argscursor_name addon
|
||||||
}
|
}
|
||||||
ECPG: fetch_argsfrom_incursor_name addon
|
ECPG: fetch_argsfrom_incursor_name addon
|
||||||
struct cursor *ptr = add_additional_variables($2, false);
|
struct cursor *ptr = add_additional_variables($2, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
if ($2[0] == ':')
|
if ($2[0] == ':')
|
||||||
{
|
{
|
||||||
free($2);
|
free($2);
|
||||||
|
@ -283,9 +296,9 @@ ECPG: fetch_argsFIRST_Popt_from_incursor_name addon
|
||||||
ECPG: fetch_argsLAST_Popt_from_incursor_name addon
|
ECPG: fetch_argsLAST_Popt_from_incursor_name addon
|
||||||
ECPG: fetch_argsALLopt_from_incursor_name addon
|
ECPG: fetch_argsALLopt_from_incursor_name addon
|
||||||
struct cursor *ptr = add_additional_variables($3, false);
|
struct cursor *ptr = add_additional_variables($3, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
if ($3[0] == ':')
|
if ($3[0] == ':')
|
||||||
{
|
{
|
||||||
free($3);
|
free($3);
|
||||||
|
@ -293,9 +306,9 @@ ECPG: fetch_argsALLopt_from_incursor_name addon
|
||||||
}
|
}
|
||||||
ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
|
ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
|
||||||
struct cursor *ptr = add_additional_variables($3, false);
|
struct cursor *ptr = add_additional_variables($3, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
if ($3[0] == ':')
|
if ($3[0] == ':')
|
||||||
{
|
{
|
||||||
free($3);
|
free($3);
|
||||||
|
@ -309,9 +322,9 @@ ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon
|
ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
|
ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
|
||||||
struct cursor *ptr = add_additional_variables($4, false);
|
struct cursor *ptr = add_additional_variables($4, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
if ($4[0] == ':')
|
if ($4[0] == ':')
|
||||||
{
|
{
|
||||||
free($4);
|
free($4);
|
||||||
|
@ -322,9 +335,9 @@ ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon
|
ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon
|
ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon
|
||||||
struct cursor *ptr = add_additional_variables($4, false);
|
struct cursor *ptr = add_additional_variables($4, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
if ($4[0] == ':')
|
if ($4[0] == ':')
|
||||||
{
|
{
|
||||||
free($4);
|
free($4);
|
||||||
|
@ -339,6 +352,7 @@ ECPG: cursor_namename rule
|
||||||
| char_civar
|
| char_civar
|
||||||
{
|
{
|
||||||
char *curname = mm_alloc(strlen($1) + 2);
|
char *curname = mm_alloc(strlen($1) + 2);
|
||||||
|
|
||||||
sprintf(curname, ":%s", $1);
|
sprintf(curname, ":%s", $1);
|
||||||
free($1);
|
free($1);
|
||||||
$1 = curname;
|
$1 = curname;
|
||||||
|
@ -375,9 +389,12 @@ ECPG: ExecuteStmtCREATEOptTempTABLEIF_PNOTEXISTScreate_as_targetASEXECUTEprepare
|
||||||
}
|
}
|
||||||
ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
|
ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
|
||||||
{
|
{
|
||||||
struct cursor *ptr, *this;
|
struct cursor *ptr,
|
||||||
|
*this;
|
||||||
char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : mm_strdup($2);
|
char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : mm_strdup($2);
|
||||||
char *comment, *c1, *c2;
|
char *comment,
|
||||||
|
*c1,
|
||||||
|
*c2;
|
||||||
int (*strcmp_fn) (const char *, const char *) = (($2[0] == ':' || $2[0] == '"') ? strcmp : pg_strcasecmp);
|
int (*strcmp_fn) (const char *, const char *) = (($2[0] == ':' || $2[0] == '"') ? strcmp : pg_strcasecmp);
|
||||||
|
|
||||||
if (INFORMIX_MODE && pg_strcasecmp($2, "database") == 0)
|
if (INFORMIX_MODE && pg_strcasecmp($2, "database") == 0)
|
||||||
|
@ -424,13 +441,13 @@ ECPG: ClosePortalStmtCLOSEcursor_name block
|
||||||
{
|
{
|
||||||
char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : $2;
|
char *cursor_marker = $2[0] == ':' ? mm_strdup("$0") : $2;
|
||||||
struct cursor *ptr = NULL;
|
struct cursor *ptr = NULL;
|
||||||
|
|
||||||
for (ptr = cur; ptr != NULL; ptr = ptr->next)
|
for (ptr = cur; ptr != NULL; ptr = ptr->next)
|
||||||
{
|
{
|
||||||
if (strcmp($2, ptr->name) == 0)
|
if (strcmp($2, ptr->name) == 0)
|
||||||
{
|
{
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -448,11 +465,18 @@ ECPG: into_clauseINTOOptTempTableName block
|
||||||
FoundInto = 1;
|
FoundInto = 1;
|
||||||
$$ = cat2_str(mm_strdup("into"), $2);
|
$$ = cat2_str(mm_strdup("into"), $2);
|
||||||
}
|
}
|
||||||
| ecpg_into { $$ = EMPTY; }
|
| ecpg_into
|
||||||
|
{
|
||||||
|
$$ = EMPTY;
|
||||||
|
}
|
||||||
ECPG: TypenameSimpleTypenameopt_array_bounds block
|
ECPG: TypenameSimpleTypenameopt_array_bounds block
|
||||||
{ $$ = cat2_str($1, $2.str); }
|
{
|
||||||
|
$$ = cat2_str($1, $2.str);
|
||||||
|
}
|
||||||
ECPG: TypenameSETOFSimpleTypenameopt_array_bounds block
|
ECPG: TypenameSETOFSimpleTypenameopt_array_bounds block
|
||||||
{ $$ = cat_str(3, mm_strdup("setof"), $2, $3.str); }
|
{
|
||||||
|
$$ = cat_str(3, mm_strdup("setof"), $2, $3.str);
|
||||||
|
}
|
||||||
ECPG: opt_array_boundsopt_array_bounds'['']' block
|
ECPG: opt_array_boundsopt_array_bounds'['']' block
|
||||||
{
|
{
|
||||||
$$.index1 = $1.index1;
|
$$.index1 = $1.index1;
|
||||||
|
@ -480,7 +504,9 @@ ECPG: opt_array_bounds
|
||||||
$$.str = EMPTY;
|
$$.str = EMPTY;
|
||||||
}
|
}
|
||||||
ECPG: IconstICONST block
|
ECPG: IconstICONST block
|
||||||
{ $$ = make_name(); }
|
{
|
||||||
|
$$ = make_name();
|
||||||
|
}
|
||||||
ECPG: AexprConstNULL_P rule
|
ECPG: AexprConstNULL_P rule
|
||||||
| civar { $$ = $1; }
|
| civar { $$ = $1; }
|
||||||
| civarind { $$ = $1; }
|
| civarind { $$ = $1; }
|
||||||
|
@ -507,6 +533,7 @@ ECPG: FetchStmtMOVEfetch_args rule
|
||||||
{
|
{
|
||||||
char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
|
char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
|
||||||
struct cursor *ptr = add_additional_variables($3, false);
|
struct cursor *ptr = add_additional_variables($3, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
|
@ -516,6 +543,7 @@ ECPG: FetchStmtMOVEfetch_args rule
|
||||||
{
|
{
|
||||||
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
||||||
struct cursor *ptr = add_additional_variables($4, false);
|
struct cursor *ptr = add_additional_variables($4, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
|
@ -525,6 +553,7 @@ ECPG: FetchStmtMOVEfetch_args rule
|
||||||
{
|
{
|
||||||
char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
|
char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
|
||||||
struct cursor *ptr = add_additional_variables($3, false);
|
struct cursor *ptr = add_additional_variables($3, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
|
@ -534,6 +563,7 @@ ECPG: FetchStmtMOVEfetch_args rule
|
||||||
{
|
{
|
||||||
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
||||||
struct cursor *ptr = add_additional_variables($4, false);
|
struct cursor *ptr = add_additional_variables($4, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
|
@ -543,6 +573,7 @@ ECPG: FetchStmtMOVEfetch_args rule
|
||||||
{
|
{
|
||||||
char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
|
char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
|
||||||
struct cursor *ptr = add_additional_variables($3, false);
|
struct cursor *ptr = add_additional_variables($3, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
|
@ -552,6 +583,7 @@ ECPG: FetchStmtMOVEfetch_args rule
|
||||||
{
|
{
|
||||||
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
||||||
struct cursor *ptr = add_additional_variables($4, false);
|
struct cursor *ptr = add_additional_variables($4, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
|
@ -561,6 +593,7 @@ ECPG: FetchStmtMOVEfetch_args rule
|
||||||
{
|
{
|
||||||
char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
|
char *cursor_marker = $3[0] == ':' ? mm_strdup("$0") : $3;
|
||||||
struct cursor *ptr = add_additional_variables($3, false);
|
struct cursor *ptr = add_additional_variables($3, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
|
@ -570,6 +603,7 @@ ECPG: FetchStmtMOVEfetch_args rule
|
||||||
{
|
{
|
||||||
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
char *cursor_marker = $4[0] == ':' ? mm_strdup("$0") : $4;
|
||||||
struct cursor *ptr = add_additional_variables($4, false);
|
struct cursor *ptr = add_additional_variables($4, false);
|
||||||
|
|
||||||
if (ptr->connection)
|
if (ptr->connection)
|
||||||
connection = mm_strdup(ptr->connection);
|
connection = mm_strdup(ptr->connection);
|
||||||
|
|
||||||
|
@ -581,4 +615,7 @@ ECPG: limit_clauseLIMITselect_limit_value','select_offset_value block
|
||||||
$$ = cat_str(4, mm_strdup("limit"), $2, mm_strdup(","), $4);
|
$$ = cat_str(4, mm_strdup("limit"), $2, mm_strdup(","), $4);
|
||||||
}
|
}
|
||||||
ECPG: SignedIconstIconst rule
|
ECPG: SignedIconstIconst rule
|
||||||
| civar { $$ = $1; }
|
| civar
|
||||||
|
{
|
||||||
|
$$ = $1;
|
||||||
|
}
|
||||||
|
|
|
@ -47,7 +47,8 @@ char *input_filename = NULL;
|
||||||
static int FoundInto = 0;
|
static int FoundInto = 0;
|
||||||
static int initializer = 0;
|
static int initializer = 0;
|
||||||
static int pacounter = 1;
|
static int pacounter = 1;
|
||||||
static char pacounter_buffer[sizeof(int) * CHAR_BIT * 10 / 3]; /* a rough guess at the size we need */
|
static char pacounter_buffer[sizeof(int) * CHAR_BIT * 10 / 3]; /* a rough guess at the
|
||||||
|
* size we need */
|
||||||
static struct this_type actual_type[STRUCT_DEPTH];
|
static struct this_type actual_type[STRUCT_DEPTH];
|
||||||
static char *actual_startline[STRUCT_DEPTH];
|
static char *actual_startline[STRUCT_DEPTH];
|
||||||
static int varchar_counter = 1;
|
static int varchar_counter = 1;
|
||||||
|
@ -213,10 +214,15 @@ create_questionmarks(char *name, bool array)
|
||||||
int count;
|
int count;
|
||||||
char *result = EMPTY;
|
char *result = EMPTY;
|
||||||
|
|
||||||
/* In case we have a struct, we have to print as many "?" as there are attributes in the struct
|
/*
|
||||||
|
* In case we have a struct, we have to print as many "?" as there are
|
||||||
|
* attributes in the struct
|
||||||
|
*
|
||||||
* An array is only allowed together with an element argument
|
* An array is only allowed together with an element argument
|
||||||
* This is essentially only used for inserts, but using a struct as input parameter is an error anywhere else
|
*
|
||||||
* so we don't have to worry here. */
|
* This is essentially only used for inserts, but using a struct as input
|
||||||
|
* parameter is an error anywhere else so we don't have to worry here.
|
||||||
|
*/
|
||||||
|
|
||||||
if (p->type->type == ECPGt_struct || (array && p->type->type == ECPGt_array && p->type->u.element->type == ECPGt_struct))
|
if (p->type->type == ECPGt_struct || (array && p->type->type == ECPGt_array && p->type->u.element->type == ECPGt_struct))
|
||||||
{
|
{
|
||||||
|
@ -247,15 +253,17 @@ create_questionmarks(char *name, bool array)
|
||||||
static char *
|
static char *
|
||||||
adjust_outofscope_cursor_vars(struct cursor *cur)
|
adjust_outofscope_cursor_vars(struct cursor *cur)
|
||||||
{
|
{
|
||||||
/* Informix accepts DECLARE with variables that are out of scope when OPEN is called.
|
/*
|
||||||
* For instance you can DECLARE a cursor in one function, and OPEN/FETCH/CLOSE
|
* Informix accepts DECLARE with variables that are out of scope when OPEN
|
||||||
* it in another functions. This is very useful for e.g. event-driver programming,
|
* is called. For instance you can DECLARE a cursor in one function, and
|
||||||
* but may also lead to dangerous programming. The limitation when this is allowed
|
* OPEN/FETCH/CLOSE it in another functions. This is very useful for e.g.
|
||||||
* and doesn't cause problems have to be documented, like the allocated variables
|
* event-driver programming, but may also lead to dangerous programming.
|
||||||
* must not be realloc()'ed.
|
* The limitation when this is allowed and doesn't cause problems have to
|
||||||
|
* be documented, like the allocated variables must not be realloc()'ed.
|
||||||
*
|
*
|
||||||
* We have to change the variables to our own struct and just store the pointer
|
* We have to change the variables to our own struct and just store the
|
||||||
* instead of the variable. Do it only for local variables, not for globals.
|
* pointer instead of the variable. Do it only for local variables, not
|
||||||
|
* for globals.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char *result = EMPTY;
|
char *result = EMPTY;
|
||||||
|
@ -266,7 +274,8 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
|
||||||
struct arguments *list;
|
struct arguments *list;
|
||||||
struct arguments *ptr;
|
struct arguments *ptr;
|
||||||
struct arguments *newlist = NULL;
|
struct arguments *newlist = NULL;
|
||||||
struct variable *newvar, *newind;
|
struct variable *newvar,
|
||||||
|
*newind;
|
||||||
|
|
||||||
list = (insert ? cur->argsinsert : cur->argsresult);
|
list = (insert ? cur->argsinsert : cur->argsresult);
|
||||||
|
|
||||||
|
@ -387,7 +396,10 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
|
||||||
var_ptr = true;
|
var_ptr = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create call to "ECPGset_var(<counter>, <connection>, <pointer>. <line number>)" */
|
/*
|
||||||
|
* create call to "ECPGset_var(<counter>, <connection>, <pointer>.
|
||||||
|
* <line number>)"
|
||||||
|
*/
|
||||||
if (!skip_set_var)
|
if (!skip_set_var)
|
||||||
{
|
{
|
||||||
sprintf(var_text, "%d, %s", ecpg_internal_var++, var_ptr ? "&(" : "(");
|
sprintf(var_text, "%d, %s", ecpg_internal_var++, var_ptr ? "&(" : "(");
|
||||||
|
@ -396,7 +408,10 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
|
||||||
mm_strdup("), __LINE__);\n"));
|
mm_strdup("), __LINE__);\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* now the indicator if there is one and it's not a global variable */
|
/*
|
||||||
|
* 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))
|
if ((ptr->indicator->type->type == ECPGt_NO_INDICATOR) || (ptr->indicator->brace_level == 0))
|
||||||
{
|
{
|
||||||
newind = ptr->indicator;
|
newind = ptr->indicator;
|
||||||
|
@ -476,7 +491,10 @@ adjust_outofscope_cursor_vars(struct cursor *cur)
|
||||||
var_ptr = true;
|
var_ptr = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create call to "ECPGset_var(<counter>, <pointer>. <line number>)" */
|
/*
|
||||||
|
* create call to "ECPGset_var(<counter>, <pointer>. <line
|
||||||
|
* number>)"
|
||||||
|
*/
|
||||||
sprintf(var_text, "%d, %s", ecpg_internal_var++, var_ptr ? "&(" : "(");
|
sprintf(var_text, "%d, %s", ecpg_internal_var++, var_ptr ? "&(" : "(");
|
||||||
result = cat_str(5, result, mm_strdup("ECPGset_var("),
|
result = cat_str(5, result, mm_strdup("ECPGset_var("),
|
||||||
mm_strdup(var_text), mm_strdup(original_var),
|
mm_strdup(var_text), mm_strdup(original_var),
|
||||||
|
@ -521,8 +539,12 @@ add_additional_variables(char *name, bool insert)
|
||||||
|
|
||||||
if (insert)
|
if (insert)
|
||||||
{
|
{
|
||||||
/* add all those input variables that were given earlier
|
/*
|
||||||
* note that we have to append here but have to keep the existing order */
|
* add all those input variables that were given earlier
|
||||||
|
*
|
||||||
|
* note that we have to append here but have to keep the existing
|
||||||
|
* order
|
||||||
|
*/
|
||||||
for (p = (SAMEFUNC(ptr) ? ptr->argsinsert : ptr->argsinsert_oos); p; p = p->next)
|
for (p = (SAMEFUNC(ptr) ? ptr->argsinsert : ptr->argsinsert_oos); p; p = p->next)
|
||||||
add_variable_to_tail(&argsinsert, p->variable, p->indicator);
|
add_variable_to_tail(&argsinsert, p->variable, p->indicator);
|
||||||
}
|
}
|
||||||
|
@ -539,7 +561,8 @@ add_typedef(char *name, char *dimension, char *length, enum ECPGttype type_enum,
|
||||||
char *type_dimension, char *type_index, int initializer, int array)
|
char *type_dimension, char *type_index, int initializer, int array)
|
||||||
{
|
{
|
||||||
/* add entry to list */
|
/* add entry to list */
|
||||||
struct typedefs *ptr, *this;
|
struct typedefs *ptr,
|
||||||
|
*this;
|
||||||
|
|
||||||
if ((type_enum == ECPGt_struct ||
|
if ((type_enum == ECPGt_struct ||
|
||||||
type_enum == ECPGt_union) &&
|
type_enum == ECPGt_union) &&
|
||||||
|
@ -593,6 +616,7 @@ static bool
|
||||||
check_declared_list(const char *name)
|
check_declared_list(const char *name)
|
||||||
{
|
{
|
||||||
struct declared_list *ptr = NULL;
|
struct declared_list *ptr = NULL;
|
||||||
|
|
||||||
for (ptr = g_declared_list; ptr != NULL; ptr = ptr->next)
|
for (ptr = g_declared_list; ptr != NULL; ptr = ptr->next)
|
||||||
{
|
{
|
||||||
if (!ptr->connection)
|
if (!ptr->connection)
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -541,7 +541,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
<xb>{xbinside} {
|
<xb>{xbinside} {
|
||||||
addlit(yytext, yyleng);
|
addlit(yytext, yyleng);
|
||||||
}
|
}
|
||||||
<xb><<EOF>> { mmfatal(PARSE_ERROR, "unterminated bit string literal"); }
|
<xb><<EOF>> {
|
||||||
|
mmfatal(PARSE_ERROR, "unterminated bit string literal");
|
||||||
|
}
|
||||||
|
|
||||||
<SQL>{xhstart} {
|
<SQL>{xhstart} {
|
||||||
token_start = yytext;
|
token_start = yytext;
|
||||||
|
@ -549,7 +551,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
BEGIN(xh);
|
BEGIN(xh);
|
||||||
startlit();
|
startlit();
|
||||||
}
|
}
|
||||||
<xh><<EOF>> { mmfatal(PARSE_ERROR, "unterminated hexadecimal string literal"); }
|
<xh><<EOF>> {
|
||||||
|
mmfatal(PARSE_ERROR, "unterminated hexadecimal string literal");
|
||||||
|
}
|
||||||
|
|
||||||
<C>{xqstart} {
|
<C>{xqstart} {
|
||||||
token_start = yytext;
|
token_start = yytext;
|
||||||
|
@ -560,9 +564,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
|
|
||||||
<SQL>{
|
<SQL>{
|
||||||
{xnstart} {
|
{xnstart} {
|
||||||
/* National character.
|
/* National character. Transfer it as-is to the backend. */
|
||||||
* Transfer it as-is to the backend.
|
|
||||||
*/
|
|
||||||
token_start = yytext;
|
token_start = yytext;
|
||||||
state_before_str_start = YYSTATE;
|
state_before_str_start = YYSTATE;
|
||||||
BEGIN(xn);
|
BEGIN(xn);
|
||||||
|
@ -651,9 +653,15 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<xq,xe,xn,xus>{xqdouble} { addlit(yytext, yyleng); }
|
<xq,xe,xn,xus>{xqdouble} {
|
||||||
<xqc>{xqcquote} { addlit(yytext, yyleng); }
|
addlit(yytext, yyleng);
|
||||||
<xq,xqc,xn,xus>{xqinside} { addlit(yytext, yyleng); }
|
}
|
||||||
|
<xqc>{xqcquote} {
|
||||||
|
addlit(yytext, yyleng);
|
||||||
|
}
|
||||||
|
<xq,xqc,xn,xus>{xqinside} {
|
||||||
|
addlit(yytext, yyleng);
|
||||||
|
}
|
||||||
<xe>{xeinside} {
|
<xe>{xeinside} {
|
||||||
addlit(yytext, yyleng);
|
addlit(yytext, yyleng);
|
||||||
}
|
}
|
||||||
|
@ -673,7 +681,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
/* This is only needed for \ just before EOF */
|
/* This is only needed for \ just before EOF */
|
||||||
addlitchar(yytext[0]);
|
addlitchar(yytext[0]);
|
||||||
}
|
}
|
||||||
<xq,xqc,xe,xn,xus><<EOF>> { mmfatal(PARSE_ERROR, "unterminated quoted string"); }
|
<xq,xqc,xe,xn,xus><<EOF>> {
|
||||||
|
mmfatal(PARSE_ERROR, "unterminated quoted string");
|
||||||
|
}
|
||||||
|
|
||||||
<SQL>{
|
<SQL>{
|
||||||
{dolqdelim} {
|
{dolqdelim} {
|
||||||
|
@ -724,7 +734,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
/* single quote or dollar sign */
|
/* single quote or dollar sign */
|
||||||
addlitchar(yytext[0]);
|
addlitchar(yytext[0]);
|
||||||
}
|
}
|
||||||
<xdolq><<EOF>> { mmfatal(PARSE_ERROR, "unterminated dollar-quoted string"); }
|
<xdolq><<EOF>> {
|
||||||
|
mmfatal(PARSE_ERROR, "unterminated dollar-quoted string");
|
||||||
|
}
|
||||||
|
|
||||||
<SQL>{
|
<SQL>{
|
||||||
{xdstart} {
|
{xdstart} {
|
||||||
|
@ -743,6 +755,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
BEGIN(state_before_str_start);
|
BEGIN(state_before_str_start);
|
||||||
if (literallen == 0)
|
if (literallen == 0)
|
||||||
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
|
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The server will truncate the identifier here. We do
|
* The server will truncate the identifier here. We do
|
||||||
* not, as (1) it does not change the result; (2) we don't
|
* not, as (1) it does not change the result; (2) we don't
|
||||||
|
@ -763,7 +776,11 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
BEGIN(state_before_str_start);
|
BEGIN(state_before_str_start);
|
||||||
if (literallen == 0)
|
if (literallen == 0)
|
||||||
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
|
mmerror(PARSE_ERROR, ET_ERROR, "zero-length delimited identifier");
|
||||||
/* The backend will truncate the identifier here. We do not as it does not change the result. */
|
|
||||||
|
/*
|
||||||
|
* The backend will truncate the identifier here. We do
|
||||||
|
* not as it does not change the result.
|
||||||
|
*/
|
||||||
base_yylval.str = psprintf("U&\"%s\"", literalbuf);
|
base_yylval.str = psprintf("U&\"%s\"", literalbuf);
|
||||||
return UIDENT;
|
return UIDENT;
|
||||||
}
|
}
|
||||||
|
@ -773,7 +790,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
<xd,xui>{xdinside} {
|
<xd,xui>{xdinside} {
|
||||||
addlit(yytext, yyleng);
|
addlit(yytext, yyleng);
|
||||||
}
|
}
|
||||||
<xd,xui><<EOF>> { mmfatal(PARSE_ERROR, "unterminated quoted identifier"); }
|
<xd,xui><<EOF>> {
|
||||||
|
mmfatal(PARSE_ERROR, "unterminated quoted identifier");
|
||||||
|
}
|
||||||
<C>{xdstart} {
|
<C>{xdstart} {
|
||||||
state_before_str_start = YYSTATE;
|
state_before_str_start = YYSTATE;
|
||||||
BEGIN(xdc);
|
BEGIN(xdc);
|
||||||
|
@ -782,7 +801,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
<xdc>{xdcinside} {
|
<xdc>{xdcinside} {
|
||||||
addlit(yytext, yyleng);
|
addlit(yytext, yyleng);
|
||||||
}
|
}
|
||||||
<xdc><<EOF>> { mmfatal(PARSE_ERROR, "unterminated quoted string"); }
|
<xdc><<EOF>> {
|
||||||
|
mmfatal(PARSE_ERROR, "unterminated quoted string");
|
||||||
|
}
|
||||||
|
|
||||||
<SQL>{
|
<SQL>{
|
||||||
{typecast} {
|
{typecast} {
|
||||||
|
@ -831,9 +852,8 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
|
|
||||||
{self} {
|
{self} {
|
||||||
/*
|
/*
|
||||||
* We may find a ';' inside a structure
|
* We may find a ';' inside a structure definition in a
|
||||||
* definition in a TYPE or VAR statement.
|
* TYPE or VAR statement. This is not an EOL marker.
|
||||||
* This is not an EOL marker.
|
|
||||||
*/
|
*/
|
||||||
if (yytext[0] == ';' && struct_level == 0)
|
if (yytext[0] == ';' && struct_level == 0)
|
||||||
BEGIN(C);
|
BEGIN(C);
|
||||||
|
@ -879,6 +899,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
for (ic = nchars - 2; ic >= 0; ic--)
|
for (ic = nchars - 2; ic >= 0; ic--)
|
||||||
{
|
{
|
||||||
char c = yytext[ic];
|
char c = yytext[ic];
|
||||||
|
|
||||||
if (c == '~' || c == '!' || c == '@' ||
|
if (c == '~' || c == '!' || c == '@' ||
|
||||||
c == '#' || c == '^' || c == '&' ||
|
c == '#' || c == '^' || c == '&' ||
|
||||||
c == '|' || c == '`' || c == '?' ||
|
c == '|' || c == '`' || c == '?' ||
|
||||||
|
@ -891,7 +912,8 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
* didn't find a qualifying character, so remove
|
* didn't find a qualifying character, so remove
|
||||||
* all trailing [+-]
|
* all trailing [+-]
|
||||||
*/
|
*/
|
||||||
do {
|
do
|
||||||
|
{
|
||||||
nchars--;
|
nchars--;
|
||||||
} while (nchars > 1 &&
|
} while (nchars > 1 &&
|
||||||
(yytext[nchars - 1] == '+' ||
|
(yytext[nchars - 1] == '+' ||
|
||||||
|
@ -903,6 +925,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
{
|
{
|
||||||
/* Strip the unwanted chars from the token */
|
/* Strip the unwanted chars from the token */
|
||||||
yyless(nchars);
|
yyless(nchars);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If what we have left is only one char, and it's
|
* If what we have left is only one char, and it's
|
||||||
* one of the characters matching "self", then
|
* one of the characters matching "self", then
|
||||||
|
@ -912,6 +935,7 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
if (nchars == 1 &&
|
if (nchars == 1 &&
|
||||||
strchr(",()[].;:+-*/%^<>=", yytext[0]))
|
strchr(",()[].;:+-*/%^<>=", yytext[0]))
|
||||||
return yytext[0];
|
return yytext[0];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Likewise, if what we have left is two chars, and
|
* Likewise, if what we have left is two chars, and
|
||||||
* those match the tokens ">=", "<=", "=>", "<>" or
|
* those match the tokens ">=", "<=", "=>", "<>" or
|
||||||
|
@ -1053,8 +1077,8 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
*
|
*
|
||||||
* The backend will attempt to truncate and case-fold
|
* The backend will attempt to truncate and case-fold
|
||||||
* the identifier, but I see no good reason for ecpg
|
* the identifier, but I see no good reason for ecpg
|
||||||
* to do so; that's just another way that ecpg could get
|
* to do so; that's just another way that ecpg could
|
||||||
* out of step with the backend.
|
* get out of step with the backend.
|
||||||
*/
|
*/
|
||||||
base_yylval.str = mm_strdup(yytext);
|
base_yylval.str = mm_strdup(yytext);
|
||||||
return IDENT;
|
return IDENT;
|
||||||
|
@ -1070,7 +1094,10 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
* Begin ECPG-specific rules
|
* Begin ECPG-specific rules
|
||||||
*/
|
*/
|
||||||
|
|
||||||
<C>{exec_sql} { BEGIN(SQL); return SQL_START; }
|
<C>{exec_sql} {
|
||||||
|
BEGIN(SQL);
|
||||||
|
return SQL_START;
|
||||||
|
}
|
||||||
<C>{informix_special} {
|
<C>{informix_special} {
|
||||||
/* are we simulating Informix? */
|
/* are we simulating Informix? */
|
||||||
if (INFORMIX_MODE)
|
if (INFORMIX_MODE)
|
||||||
|
@ -1081,7 +1108,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
else
|
else
|
||||||
return S_ANYTHING;
|
return S_ANYTHING;
|
||||||
}
|
}
|
||||||
<C>{ccomment} { ECHO; }
|
<C>{ccomment} {
|
||||||
|
ECHO;
|
||||||
|
}
|
||||||
<C>{cppinclude} {
|
<C>{cppinclude} {
|
||||||
if (system_includes)
|
if (system_includes)
|
||||||
{
|
{
|
||||||
|
@ -1138,7 +1167,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<C>{xcstop} { mmerror(PARSE_ERROR, ET_ERROR, "nested /* ... */ comments"); }
|
<C>{xcstop} {
|
||||||
|
mmerror(PARSE_ERROR, ET_ERROR, "nested /* ... */ comments");
|
||||||
|
}
|
||||||
<C>":" { return ':'; }
|
<C>":" { return ':'; }
|
||||||
<C>";" { return ';'; }
|
<C>";" { return ';'; }
|
||||||
<C>"," { return ','; }
|
<C>"," { return ','; }
|
||||||
|
@ -1185,7 +1216,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
return S_ANYTHING;
|
return S_ANYTHING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<C>{exec_sql}{undef}{space}* { BEGIN(undef); }
|
<C>{exec_sql}{undef}{space}* {
|
||||||
|
BEGIN(undef);
|
||||||
|
}
|
||||||
<C>{informix_special}{undef}{space}* {
|
<C>{informix_special}{undef}{space}* {
|
||||||
/* are we simulating Informix? */
|
/* are we simulating Informix? */
|
||||||
if (INFORMIX_MODE)
|
if (INFORMIX_MODE)
|
||||||
|
@ -1199,7 +1232,8 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
<undef>{identifier}{space}*";" {
|
<undef>{identifier}{space}*";" {
|
||||||
struct _defines *ptr, *ptr2 = NULL;
|
struct _defines *ptr,
|
||||||
|
*ptr2 = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1212,7 +1246,6 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
;
|
;
|
||||||
yytext[i + 1] = '\0';
|
yytext[i + 1] = '\0';
|
||||||
|
|
||||||
|
|
||||||
/* Find and unset any matching define; should be only 1 */
|
/* Find and unset any matching define; should be only 1 */
|
||||||
for (ptr = defines; ptr; ptr2 = ptr, ptr = ptr->next)
|
for (ptr = defines; ptr; ptr2 = ptr, ptr = ptr->next)
|
||||||
{
|
{
|
||||||
|
@ -1240,7 +1273,9 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
mmfatal(PARSE_ERROR, "missing identifier in EXEC SQL UNDEF command");
|
mmfatal(PARSE_ERROR, "missing identifier in EXEC SQL UNDEF command");
|
||||||
yyterminate();
|
yyterminate();
|
||||||
}
|
}
|
||||||
<C>{exec_sql}{include}{space}* { BEGIN(incl); }
|
<C>{exec_sql}{include}{space}* {
|
||||||
|
BEGIN(incl);
|
||||||
|
}
|
||||||
<C>{informix_special}{include}{space}* {
|
<C>{informix_special}{include}{space}* {
|
||||||
/* are we simulating Informix? */
|
/* are we simulating Informix? */
|
||||||
if (INFORMIX_MODE)
|
if (INFORMIX_MODE)
|
||||||
|
@ -1337,7 +1372,8 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<C,xskip>{exec_sql}{else}{space}*";" { /* only exec sql endif pops the stack, so take care of duplicated 'else' */
|
<C,xskip>{exec_sql}{else}{space}*";" {
|
||||||
|
/* only exec sql endif pops the stack, so take care of duplicated 'else' */
|
||||||
if (preproc_tos == 0)
|
if (preproc_tos == 0)
|
||||||
mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
|
mmfatal(PARSE_ERROR, "missing matching \"EXEC SQL IFDEF\" / \"EXEC SQL IFNDEF\"");
|
||||||
else if (stacked_if_value[preproc_tos].else_branch)
|
else if (stacked_if_value[preproc_tos].else_branch)
|
||||||
|
@ -1425,13 +1461,14 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
bool this_active;
|
bool this_active;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Skip the ";" and trailing whitespace. Note that yytext
|
* Skip the ";" and trailing whitespace. Note that
|
||||||
* contains at least one non-space character plus the ";"
|
* yytext contains at least one non-space character
|
||||||
|
* plus the ";"
|
||||||
*/
|
*/
|
||||||
for (i = strlen(yytext) - 2;
|
for (i = strlen(yytext) - 2;
|
||||||
i > 0 && ecpg_isspace(yytext[i]);
|
i > 0 && ecpg_isspace(yytext[i]);
|
||||||
i--)
|
i--)
|
||||||
;
|
/* skip */ ;
|
||||||
yytext[i + 1] = '\0';
|
yytext[i + 1] = '\0';
|
||||||
|
|
||||||
/* Does a definition exist? */
|
/* Does a definition exist? */
|
||||||
|
@ -1559,11 +1596,12 @@ cppline {space}*#([^i][A-Za-z]*|{if}|{ifdef}|{ifndef}|{import})((\/\*[^*/]*\*+
|
||||||
|
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
output_line_number();
|
output_line_number();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
<INITIAL>{other}|\n { mmfatal(PARSE_ERROR, "internal error: unreachable state; please report this to <%s>", PACKAGE_BUGREPORT); }
|
<INITIAL>{other}|\n {
|
||||||
|
mmfatal(PARSE_ERROR, "internal error: unreachable state; please report this to <%s>", PACKAGE_BUGREPORT);
|
||||||
|
}
|
||||||
|
|
||||||
%%
|
%%
|
||||||
|
|
||||||
|
@ -1668,8 +1706,8 @@ parse_include(void)
|
||||||
yy_buffer = yb;
|
yy_buffer = yb;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* skip the ";" if there is one and trailing whitespace. Note that
|
* skip the ";" if there is one and trailing whitespace. Note that yytext
|
||||||
* yytext contains at least one non-space character plus the ";"
|
* contains at least one non-space character plus the ";"
|
||||||
*/
|
*/
|
||||||
for (i = strlen(yytext) - 2;
|
for (i = strlen(yytext) - 2;
|
||||||
i > 0 && ecpg_isspace(yytext[i]);
|
i > 0 && ecpg_isspace(yytext[i]);
|
||||||
|
@ -1684,7 +1722,11 @@ parse_include(void)
|
||||||
yyin = NULL;
|
yyin = NULL;
|
||||||
|
|
||||||
/* If file name is enclosed in '"' remove these and look only in '.' */
|
/* If file name is enclosed in '"' remove these and look only in '.' */
|
||||||
/* Informix does look into all include paths though, except filename starts with '/' */
|
|
||||||
|
/*
|
||||||
|
* Informix does look into all include paths though, except filename
|
||||||
|
* starts with '/'
|
||||||
|
*/
|
||||||
if (yytext[0] == '"' && yytext[i] == '"' &&
|
if (yytext[0] == '"' && yytext[i] == '"' &&
|
||||||
((compat != ECPG_COMPAT_INFORMIX && compat != ECPG_COMPAT_INFORMIX_SE) || yytext[1] == '/'))
|
((compat != ECPG_COMPAT_INFORMIX && compat != ECPG_COMPAT_INFORMIX_SE) || yytext[1] == '/'))
|
||||||
{
|
{
|
||||||
|
@ -1728,7 +1770,11 @@ parse_include(void)
|
||||||
yyin = fopen(inc_file, "r");
|
yyin = fopen(inc_file, "r");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* if the command was "include_next" we have to disregard the first hit */
|
|
||||||
|
/*
|
||||||
|
* if the command was "include_next" we have to disregard the
|
||||||
|
* first hit
|
||||||
|
*/
|
||||||
if (yyin && include_next)
|
if (yyin && include_next)
|
||||||
{
|
{
|
||||||
fclose(yyin);
|
fclose(yyin);
|
||||||
|
|
Loading…
Reference in New Issue