Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
1066dbfb
Commit
1066dbfb
authored
Jan 09, 2011
by
Michael Meskes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
There is no need to have to identical functions in ecpg thus removing one of them.
parent
fdf2dbda
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
371 additions
and
381 deletions
+371
-381
src/interfaces/ecpg/preproc/descriptor.c
src/interfaces/ecpg/preproc/descriptor.c
+2
-2
src/interfaces/ecpg/preproc/ecpg.addons
src/interfaces/ecpg/preproc/ecpg.addons
+46
-46
src/interfaces/ecpg/preproc/ecpg.header
src/interfaces/ecpg/preproc/ecpg.header
+15
-24
src/interfaces/ecpg/preproc/ecpg.trailer
src/interfaces/ecpg/preproc/ecpg.trailer
+286
-286
src/interfaces/ecpg/preproc/extern.h
src/interfaces/ecpg/preproc/extern.h
+1
-2
src/interfaces/ecpg/preproc/parse.pl
src/interfaces/ecpg/preproc/parse.pl
+2
-2
src/interfaces/ecpg/preproc/type.c
src/interfaces/ecpg/preproc/type.c
+9
-9
src/interfaces/ecpg/preproc/variable.c
src/interfaces/ecpg/preproc/variable.c
+10
-10
No files found.
src/interfaces/ecpg/preproc/descriptor.c
View file @
1066dbfb
...
...
@@ -188,7 +188,7 @@ output_get_descr(char *desc_name, char *index)
break
;
}
fprintf
(
yyout
,
"%s,"
,
get_dtype
(
results
->
value
));
ECPGdump_a_type
(
yyout
,
v
->
name
,
v
->
type
,
v
->
brace_level
,
NULL
,
NULL
,
-
1
,
NULL
,
NULL
,
m
ake_str
(
"0"
),
NULL
,
NULL
);
ECPGdump_a_type
(
yyout
,
v
->
name
,
v
->
type
,
v
->
brace_level
,
NULL
,
NULL
,
-
1
,
NULL
,
NULL
,
m
m_strdup
(
"0"
),
NULL
,
NULL
);
}
drop_assignments
();
fputs
(
"ECPGd_EODT);
\n
"
,
yyout
);
...
...
@@ -293,7 +293,7 @@ output_set_descr(char *desc_name, char *index)
case
ECPGd_length
:
case
ECPGd_type
:
fprintf
(
yyout
,
"%s,"
,
get_dtype
(
results
->
value
));
ECPGdump_a_type
(
yyout
,
v
->
name
,
v
->
type
,
v
->
brace_level
,
NULL
,
NULL
,
-
1
,
NULL
,
NULL
,
m
ake_str
(
"0"
),
NULL
,
NULL
);
ECPGdump_a_type
(
yyout
,
v
->
name
,
v
->
type
,
v
->
brace_level
,
NULL
,
NULL
,
-
1
,
NULL
,
NULL
,
m
m_strdup
(
"0"
),
NULL
,
NULL
);
break
;
default:
...
...
src/interfaces/ecpg/preproc/ecpg.addons
View file @
1066dbfb
...
...
@@ -41,7 +41,7 @@ ECPG: stmtPrepareStmt block
if ($1.type == NULL || strlen($1.type) == 0)
output_prepare_statement($1.name, $1.stmt);
else
output_statement(cat_str(5, m
ake_str("prepare"), $1.name, $1.type, make_str
("as"), $1.stmt), 0, ECPGst_normal);
output_statement(cat_str(5, m
m_strdup("prepare"), $1.name, $1.type, mm_strdup
("as"), $1.stmt), 0, ECPGst_normal);
}
ECPG: stmtTransactionStmt block
{
...
...
@@ -212,21 +212,21 @@ ECPG: var_valueNumericOnly addon
if ($1[0] == '$')
{
free($1);
$1 = m
ake_str
("$0");
$1 = m
m_strdup
("$0");
}
ECPG: fetch_argscursor_name addon
add_additional_variables($1, false);
if ($1[0] == ':')
{
free($1);
$1 = m
ake_str
("$0");
$1 = m
m_strdup
("$0");
}
ECPG: fetch_argsfrom_incursor_name addon
add_additional_variables($2, false);
if ($2[0] == ':')
{
free($2);
$2 = m
ake_str
("$0");
$2 = m
m_strdup
("$0");
}
ECPG: fetch_argsNEXTopt_from_incursor_name addon
ECPG: fetch_argsPRIORopt_from_incursor_name addon
...
...
@@ -237,19 +237,19 @@ ECPG: fetch_argsALLopt_from_incursor_name addon
if ($3[0] == ':')
{
free($3);
$3 = m
ake_str
("$0");
$3 = m
m_strdup
("$0");
}
ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
add_additional_variables($3, false);
if ($3[0] == ':')
{
free($3);
$3 = m
ake_str
("$0");
$3 = m
m_strdup
("$0");
}
if ($1[0] == '$')
{
free($1);
$1 = m
ake_str
("$0");
$1 = m
m_strdup
("$0");
}
ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon
ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
...
...
@@ -257,7 +257,7 @@ ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
if ($4[0] == ':')
{
free($4);
$4 = m
ake_str
("$0");
$4 = m
m_strdup
("$0");
}
ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon
ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon
...
...
@@ -267,12 +267,12 @@ ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon
if ($4[0] == ':')
{
free($4);
$4 = m
ake_str
("$0");
$4 = m
m_strdup
("$0");
}
if ($2[0] == '$')
{
free($2);
$2 = m
ake_str
("$0");
$2 = m
m_strdup
("$0");
}
ECPG: cursor_namename rule
| char_civar
...
...
@@ -287,7 +287,7 @@ ECPG: PrepareStmtPREPAREprepared_nameprep_type_clauseASPreparableStmt block
{
$$.name = $2;
$$.type = $3;
$$.stmt = cat_str(3, m
ake_str("\""), $5, make_str
("\""));
$$.stmt = cat_str(3, m
m_strdup("\""), $5, mm_strdup
("\""));
}
| PREPARE prepared_name FROM execstring
{
...
...
@@ -300,7 +300,7 @@ ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
{
struct cursor *ptr, *this;
char *cursor_marker = $2[0] == ':' ? m
ake_str
("$0") : mm_strdup($2);
char *cursor_marker = $2[0] == ':' ? m
m_strdup
("$0") : mm_strdup($2);
char *comment, *c1, *c2;
int (* strcmp_fn)(const char *, const char *) = ($2[0] == ':' ? strcmp : pg_strcasecmp);
...
...
@@ -322,7 +322,7 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt
this->function = (current_function ? mm_strdup(current_function) : NULL);
this->connection = connection;
this->opened = false;
this->command = cat_str(7, m
ake_str("declare"), cursor_marker, $3, make_str("cursor"), $5, make_str
("for"), $7);
this->command = cat_str(7, m
m_strdup("declare"), cursor_marker, $3, mm_strdup("cursor"), $5, mm_strdup
("for"), $7);
this->argsinsert = argsinsert;
this->argsinsert_oos = NULL;
this->argsresult = argsresult;
...
...
@@ -337,31 +337,31 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt
c2[0] = '.';
c2[1] = '.';
}
comment = cat_str(3, m
ake_str("/*"), c1, make_str
("*/"));
comment = cat_str(3, m
m_strdup("/*"), c1, mm_strdup
("*/"));
if ((braces_open > 0) && INFORMIX_MODE) /* we're in a function */
$$ = cat_str(3, adjust_outofscope_cursor_vars(this),
m
ake_str
("ECPG_informix_reset_sqlca();"),
m
m_strdup
("ECPG_informix_reset_sqlca();"),
comment);
else
$$ = cat2_str(adjust_outofscope_cursor_vars(this), comment);
}
ECPG: ClosePortalStmtCLOSEcursor_name block
{
char *cursor_marker = $2[0] == ':' ? m
ake_str
("$0") : $2;
$$ = cat2_str(m
ake_str
("close"), cursor_marker);
char *cursor_marker = $2[0] == ':' ? m
m_strdup
("$0") : $2;
$$ = cat2_str(m
m_strdup
("close"), cursor_marker);
}
ECPG: opt_hold block
{
if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit)
$$ = m
ake_str
("with hold");
$$ = m
m_strdup
("with hold");
else
$$ = EMPTY;
}
ECPG: into_clauseINTOOptTempTableName block
{
FoundInto = 1;
$$= cat2_str(m
ake_str
("into"), $2);
$$= cat2_str(m
m_strdup
("into"), $2);
}
| ecpg_into { $$ = EMPTY; }
ECPG: table_refselect_with_parens addon
...
...
@@ -369,16 +369,16 @@ ECPG: table_refselect_with_parens addon
ECPG: TypenameSimpleTypenameopt_array_bounds block
{ $$ = cat2_str($1, $2.str); }
ECPG: TypenameSETOFSimpleTypenameopt_array_bounds block
{ $$ = cat_str(3, m
ake_str
("setof"), $2, $3.str); }
{ $$ = cat_str(3, m
m_strdup
("setof"), $2, $3.str); }
ECPG: opt_array_boundsopt_array_bounds'['']' block
{
$$.index1 = $1.index1;
$$.index2 = $1.index2;
if (strcmp($$.index1, "-1") == 0)
$$.index1 = m
ake_str
("0");
$$.index1 = m
m_strdup
("0");
else if (strcmp($1.index2, "-1") == 0)
$$.index2 = m
ake_str
("0");
$$.str = cat_str(2, $1.str, m
ake_str
("[]"));
$$.index2 = m
m_strdup
("0");
$$.str = cat_str(2, $1.str, m
m_strdup
("[]"));
}
| opt_array_bounds '[' Iresult ']'
{
...
...
@@ -388,12 +388,12 @@ ECPG: opt_array_boundsopt_array_bounds'['']' block
$$.index1 = strdup($3);
else if (strcmp($1.index2, "-1") == 0)
$$.index2 = strdup($3);
$$.str = cat_str(4, $1.str, m
ake_str("["), $3, make_str
("]"));
$$.str = cat_str(4, $1.str, m
m_strdup("["), $3, mm_strdup
("]"));
}
ECPG: opt_array_bounds
{
$$.index1 = m
ake_str
("-1");
$$.index2 = m
ake_str
("-1");
$$.index1 = m
m_strdup
("-1");
$$.index2 = m
m_strdup
("-1");
$$.str= EMPTY;
}
ECPG: IconstICONST block
...
...
@@ -404,8 +404,8 @@ ECPG: AexprConstNULL_P rule
ECPG: ColIdcol_name_keyword rule
| ECPGKeywords { $$ = $1; }
| ECPGCKeywords { $$ = $1; }
| CHAR_P { $$ = m
ake_str
("char"); }
| VALUES { $$ = m
ake_str
("values"); }
| CHAR_P { $$ = m
m_strdup
("char"); }
| VALUES { $$ = m
m_strdup
("values"); }
ECPG: type_function_nametype_func_name_keyword rule
| ECPGKeywords { $$ = $1; }
| ECPGTypeName { $$ = $1; }
...
...
@@ -418,60 +418,60 @@ ECPG: VariableShowStmtSHOWALL block
ECPG: FetchStmtMOVEfetch_args rule
| FETCH fetch_args ecpg_fetch_into
{
$$ = cat2_str(m
ake_str
("fetch"), $2);
$$ = cat2_str(m
m_strdup
("fetch"), $2);
}
| FETCH FORWARD cursor_name opt_ecpg_fetch_into
{
char *cursor_marker = $3[0] == ':' ? m
ake_str
("$0") : $3;
char *cursor_marker = $3[0] == ':' ? m
m_strdup
("$0") : $3;
add_additional_variables($3, false);
$$ = cat_str(2, m
ake_str
("fetch forward"), cursor_marker);
$$ = cat_str(2, m
m_strdup
("fetch forward"), cursor_marker);
}
| FETCH FORWARD from_in cursor_name opt_ecpg_fetch_into
{
char *cursor_marker = $4[0] == ':' ? m
ake_str
("$0") : $4;
char *cursor_marker = $4[0] == ':' ? m
m_strdup
("$0") : $4;
add_additional_variables($4, false);
$$ = cat_str(2, m
ake_str
("fetch forward from"), cursor_marker);
$$ = cat_str(2, m
m_strdup
("fetch forward from"), cursor_marker);
}
| FETCH BACKWARD cursor_name opt_ecpg_fetch_into
{
char *cursor_marker = $3[0] == ':' ? m
ake_str
("$0") : $3;
char *cursor_marker = $3[0] == ':' ? m
m_strdup
("$0") : $3;
add_additional_variables($3, false);
$$ = cat_str(2, m
ake_str
("fetch backward"), cursor_marker);
$$ = cat_str(2, m
m_strdup
("fetch backward"), cursor_marker);
}
| FETCH BACKWARD from_in cursor_name opt_ecpg_fetch_into
{
char *cursor_marker = $4[0] == ':' ? m
ake_str
("$0") : $4;
char *cursor_marker = $4[0] == ':' ? m
m_strdup
("$0") : $4;
add_additional_variables($4, false);
$$ = cat_str(2, m
ake_str
("fetch backward from"), cursor_marker);
$$ = cat_str(2, m
m_strdup
("fetch backward from"), cursor_marker);
}
| MOVE FORWARD cursor_name
{
char *cursor_marker = $3[0] == ':' ? m
ake_str
("$0") : $3;
char *cursor_marker = $3[0] == ':' ? m
m_strdup
("$0") : $3;
add_additional_variables($3, false);
$$ = cat_str(2, m
ake_str
("move forward"), cursor_marker);
$$ = cat_str(2, m
m_strdup
("move forward"), cursor_marker);
}
| MOVE FORWARD from_in cursor_name
{
char *cursor_marker = $4[0] == ':' ? m
ake_str
("$0") : $4;
char *cursor_marker = $4[0] == ':' ? m
m_strdup
("$0") : $4;
add_additional_variables($4, false);
$$ = cat_str(2, m
ake_str
("move forward from"), cursor_marker);
$$ = cat_str(2, m
m_strdup
("move forward from"), cursor_marker);
}
| MOVE BACKWARD cursor_name
{
char *cursor_marker = $3[0] == ':' ? m
ake_str
("$0") : $3;
char *cursor_marker = $3[0] == ':' ? m
m_strdup
("$0") : $3;
add_additional_variables($3, false);
$$ = cat_str(2, m
ake_str
("move backward"), cursor_marker);
$$ = cat_str(2, m
m_strdup
("move backward"), cursor_marker);
}
| MOVE BACKWARD from_in cursor_name
{
char *cursor_marker = $4[0] == ':' ? m
ake_str
("$0") : $4;
char *cursor_marker = $4[0] == ':' ? m
m_strdup
("$0") : $4;
add_additional_variables($4, false);
$$ = cat_str(2, m
ake_str
("move backward from"), cursor_marker);
$$ = cat_str(2, m
m_strdup
("move backward from"), cursor_marker);
}
ECPG: limit_clauseLIMITselect_limit_value','select_offset_value block
{
mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server");
$$ = cat_str(4, m
ake_str("limit"), $2, make_str
(","), $4);
$$ = cat_str(4, m
m_strdup("limit"), $2, mm_strdup
(","), $4);
}
ECPG: SignedIconstIconst rule
| civar { $$ = $1; }
src/interfaces/ecpg/preproc/ecpg.header
View file @
1066dbfb
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/preproc/ecpg.trailer
View file @
1066dbfb
This diff is collapsed.
Click to expand it.
src/interfaces/ecpg/preproc/extern.h
View file @
1066dbfb
...
...
@@ -14,7 +14,7 @@
/* defines */
#define STRUCT_DEPTH 128
#define EMPTY m
ake_str
("")
#define EMPTY m
m_strdup
("")
/* variables */
...
...
@@ -62,7 +62,6 @@ extern struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH];
extern
const
char
*
get_dtype
(
enum
ECPGdtype
);
extern
void
lex_init
(
void
);
extern
char
*
make_str
(
const
char
*
);
extern
void
output_line_number
(
void
);
extern
void
output_statement
(
char
*
,
int
,
enum
ECPG_statement_type
);
extern
void
output_prepare_statement
(
char
*
,
char
*
);
...
...
src/interfaces/ecpg/preproc/parse.pl
View file @
1066dbfb
...
...
@@ -397,7 +397,7 @@ sub dump_fields {
&
add_to_buffer
('
rules
',
"
\
$
\
$=EMPTY; }
");
}
else
{
# Go through each field and try to 'aggregate' the tokens into a single 'm
ake_str
' where possible
# Go through each field and try to 'aggregate' the tokens into a single 'm
m_strdup
' where possible
$cnt
=
0
;
for
(
$z
=
0
;
$z
<
$len
;
$z
++
)
{
if
(
substr
(
$flds
{
$z
},
1
,
1
)
eq
"
\
$
")
{
...
...
@@ -410,7 +410,7 @@ sub dump_fields {
while
(
1
)
{
if
(
$z
>=
$len
-
1
||
substr
(
$flds
{
$z
+
1
},
1
,
1
)
eq
"
\
$
")
{
# We're at the end...
$flds_new
{
$cnt
++
}
=
"
m
ake_str
(
\"
"
.
$str
.
"
\"
)
";
$flds_new
{
$cnt
++
}
=
"
m
m_strdup
(
\"
"
.
$str
.
"
\"
)
";
last
;
}
$z
++
;
...
...
src/interfaces/ecpg/preproc/type.c
View file @
1066dbfb
...
...
@@ -120,7 +120,7 @@ ECPGmake_array_type(struct ECPGtype * type, char *size)
struct
ECPGtype
*
ECPGmake_struct_type
(
struct
ECPGstruct_member
*
rm
,
enum
ECPGttype
type
,
char
*
type_name
,
char
*
struct_sizeof
)
{
struct
ECPGtype
*
ne
=
ECPGmake_simple_type
(
type
,
m
ake_str
(
"1"
),
0
);
struct
ECPGtype
*
ne
=
ECPGmake_simple_type
(
type
,
m
m_strdup
(
"1"
),
0
);
ne
->
type_name
=
mm_strdup
(
type_name
);
ne
->
u
.
members
=
ECPGstruct_member_dup
(
rm
);
...
...
@@ -308,7 +308,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
if
(
ind_type
!=
NULL
)
{
if
(
ind_type
->
type
==
ECPGt_NO_INDICATOR
)
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
type
,
ind_type
->
size
,
m
ake_str
(
"-1"
),
NULL
,
ind_prefix
,
0
);
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
type
,
ind_type
->
size
,
m
m_strdup
(
"-1"
),
NULL
,
ind_prefix
,
0
);
else
{
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
u
.
element
->
type
,
...
...
@@ -321,7 +321,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
if
(
indicator_set
&&
ind_type
->
type
!=
ECPGt_struct
)
mmerror
(
INDICATOR_NOT_STRUCT
,
ET_FATAL
,
"indicator for struct has to be a struct"
);
ECPGdump_a_struct
(
o
,
name
,
ind_name
,
m
ake_str
(
"1"
),
type
,
ind_type
,
prefix
,
ind_prefix
);
ECPGdump_a_struct
(
o
,
name
,
ind_name
,
m
m_strdup
(
"1"
),
type
,
ind_type
,
prefix
,
ind_prefix
);
break
;
case
ECPGt_union
:
/* cannot dump a complete union */
base_yyerror
(
"type of union has to be specified"
);
...
...
@@ -330,25 +330,25 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, const int bra
if
(
indicator_set
&&
(
ind_type
->
type
==
ECPGt_struct
||
ind_type
->
type
==
ECPGt_array
))
mmerror
(
INDICATOR_NOT_SIMPLE
,
ET_FATAL
,
"indicator for simple data type has to be simple"
);
ECPGdump_a_simple
(
o
,
name
,
type
->
type
,
m
ake_str
(
"1"
),
(
arr_str_siz
&&
strcmp
(
arr_str_siz
,
"0"
)
!=
0
)
?
arr_str_siz
:
make_str
(
"1"
),
struct_sizeof
,
prefix
,
0
);
ECPGdump_a_simple
(
o
,
name
,
type
->
type
,
m
m_strdup
(
"1"
),
(
arr_str_siz
&&
strcmp
(
arr_str_siz
,
"0"
)
!=
0
)
?
arr_str_siz
:
mm_strdup
(
"1"
),
struct_sizeof
,
prefix
,
0
);
if
(
ind_type
!=
NULL
)
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
type
,
ind_type
->
size
,
(
arr_str_siz
&&
strcmp
(
arr_str_siz
,
"0"
)
!=
0
)
?
arr_str_siz
:
m
ake_str
(
"-1"
),
ind_struct_sizeof
,
ind_prefix
,
0
);
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
type
,
ind_type
->
size
,
(
arr_str_siz
&&
strcmp
(
arr_str_siz
,
"0"
)
!=
0
)
?
arr_str_siz
:
m
m_strdup
(
"-1"
),
ind_struct_sizeof
,
ind_prefix
,
0
);
break
;
case
ECPGt_descriptor
:
if
(
indicator_set
&&
(
ind_type
->
type
==
ECPGt_struct
||
ind_type
->
type
==
ECPGt_array
))
mmerror
(
INDICATOR_NOT_SIMPLE
,
ET_FATAL
,
"indicator for simple data type has to be simple"
);
ECPGdump_a_simple
(
o
,
name
,
type
->
type
,
NULL
,
m
ake_str
(
"-1"
),
NULL
,
prefix
,
0
);
ECPGdump_a_simple
(
o
,
name
,
type
->
type
,
NULL
,
m
m_strdup
(
"-1"
),
NULL
,
prefix
,
0
);
if
(
ind_type
!=
NULL
)
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
type
,
ind_type
->
size
,
m
ake_str
(
"-1"
),
NULL
,
ind_prefix
,
0
);
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
type
,
ind_type
->
size
,
m
m_strdup
(
"-1"
),
NULL
,
ind_prefix
,
0
);
break
;
default:
if
(
indicator_set
&&
(
ind_type
->
type
==
ECPGt_struct
||
ind_type
->
type
==
ECPGt_array
))
mmerror
(
INDICATOR_NOT_SIMPLE
,
ET_FATAL
,
"indicator for simple data type has to be simple"
);
ECPGdump_a_simple
(
o
,
name
,
type
->
type
,
type
->
size
,
(
arr_str_siz
&&
strcmp
(
arr_str_siz
,
"0"
)
!=
0
)
?
arr_str_siz
:
m
ake_str
(
"-1"
),
struct_sizeof
,
prefix
,
type
->
counter
);
ECPGdump_a_simple
(
o
,
name
,
type
->
type
,
type
->
size
,
(
arr_str_siz
&&
strcmp
(
arr_str_siz
,
"0"
)
!=
0
)
?
arr_str_siz
:
m
m_strdup
(
"-1"
),
struct_sizeof
,
prefix
,
type
->
counter
);
if
(
ind_type
!=
NULL
)
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
type
,
ind_type
->
size
,
(
arr_str_siz
&&
strcmp
(
arr_str_siz
,
"0"
)
!=
0
)
?
arr_str_siz
:
m
ake_str
(
"-1"
),
ind_struct_sizeof
,
ind_prefix
,
0
);
ECPGdump_a_simple
(
o
,
ind_name
,
ind_type
->
type
,
ind_type
->
size
,
(
arr_str_siz
&&
strcmp
(
arr_str_siz
,
"0"
)
!=
0
)
?
arr_str_siz
:
m
m_strdup
(
"-1"
),
ind_struct_sizeof
,
ind_prefix
,
0
);
break
;
}
}
...
...
src/interfaces/ecpg/preproc/variable.c
View file @
1066dbfb
...
...
@@ -446,7 +446,7 @@ dump_variables(struct arguments * list, int mode)
/* Then the current element and its indicator */
ECPGdump_a_type
(
yyout
,
list
->
variable
->
name
,
list
->
variable
->
type
,
list
->
variable
->
brace_level
,
list
->
indicator
->
name
,
list
->
indicator
->
type
,
list
->
indicator
->
brace_level
,
NULL
,
NULL
,
m
ake_str
(
"0"
),
NULL
,
NULL
);
NULL
,
NULL
,
m
m_strdup
(
"0"
),
NULL
,
NULL
);
/* Then release the list element. */
if
(
mode
!=
0
)
...
...
@@ -542,7 +542,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
if
(
pointer_len
)
{
*
length
=
*
dimension
;
*
dimension
=
m
ake_str
(
"0"
);
*
dimension
=
m
m_strdup
(
"0"
);
}
if
(
atoi
(
*
length
)
>=
0
)
...
...
@@ -552,13 +552,13 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
case
ECPGt_varchar
:
/* pointer has to get dimension 0 */
if
(
pointer_len
)
*
dimension
=
m
ake_str
(
"0"
);
*
dimension
=
m
m_strdup
(
"0"
);
/* one index is the string length */
if
(
atoi
(
*
length
)
<
0
)
{
*
length
=
*
dimension
;
*
dimension
=
m
ake_str
(
"-1"
);
*
dimension
=
m
m_strdup
(
"-1"
);
}
break
;
...
...
@@ -568,13 +568,13 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
/* char ** */
if
(
pointer_len
==
2
)
{
*
length
=
*
dimension
=
m
ake_str
(
"0"
);
*
length
=
*
dimension
=
m
m_strdup
(
"0"
);
break
;
}
/* pointer has to get length 0 */
if
(
pointer_len
==
1
)
*
length
=
m
ake_str
(
"0"
);
*
length
=
m
m_strdup
(
"0"
);
/* one index is the string length */
if
(
atoi
(
*
length
)
<
0
)
...
...
@@ -589,13 +589,13 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
* do not change this for typedefs since it will be
* changed later on when the variable is defined
*/
*
length
=
m
ake_str
(
"1"
);
*
length
=
m
m_strdup
(
"1"
);
else
if
(
strcmp
(
*
dimension
,
"0"
)
==
0
)
*
length
=
m
ake_str
(
"-1"
);
*
length
=
m
m_strdup
(
"-1"
);
else
*
length
=
*
dimension
;
*
dimension
=
m
ake_str
(
"-1"
);
*
dimension
=
m
m_strdup
(
"-1"
);
}
break
;
default:
...
...
@@ -603,7 +603,7 @@ adjust_array(enum ECPGttype type_enum, char **dimension, char **length, char *ty
if
(
pointer_len
)
{
*
length
=
*
dimension
;
*
dimension
=
m
ake_str
(
"0"
);
*
dimension
=
m
m_strdup
(
"0"
);
}
if
(
atoi
(
*
length
)
>=
0
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment