Commit 51fa56b9 authored by Elemer Lelik's avatar Elemer Lelik
Browse files

Sync with 5.4.1

parent 50c8d3f6
......@@ -11,7 +11,7 @@
/* Version numbers */
#define TTCN3_MAJOR 5
#define TTCN3_MINOR 4
#define TTCN3_PATCHLEVEL 0
#define TTCN3_PATCHLEVEL 1
//#define TTCN3_BUILDNUMBER 0
/* The aggregated version number must be set manually since some stupid
......@@ -22,7 +22,7 @@
* TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 +
* TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER
*/
#define TTCN3_VERSION 50400
#define TTCN3_VERSION 50401
/* A monotonically increasing version number.
* An official release is deemed to have the highest possible build number (99)
......
......@@ -2301,6 +2301,27 @@ void Type::chk_xer() { // XERSTUFF semantic check
}
empties.clear();
} // if secho
if (xerattrib->abstract_ || xerattrib->block_) {
switch (ownertype) {
case OT_COMP_FIELD:
if (parent_type->typetype == T_CHOICE_A ||
parent_type->typetype == T_CHOICE_T) {
if (parent_type->xerattrib != NULL && parent_type->xerattrib->useUnion_) {
error("ABSTRACT and BLOCK cannot be used on fields of a union with "
"attribute USE-UNION.");
}
break;
}
// else fall through
case OT_RECORD_OF:
case OT_TYPE_DEF:
warning("ABSTRACT and BLOCK only affects union fields.");
break;
default:
break;
}
}
}
......@@ -3215,7 +3236,7 @@ bool Type::chk_this_refd_value(Value *value, Common::Assignment *lhs, expected_v
#endif
case Assignment::A_EXT_CONST:
if (expected_value == EXPECTED_CONSTANT) {
value->error("Reference to an (evaluatable) constant value was "
value->error("Reference to an (evaluable) constant value was "
"expected instead of %s",
ass->get_description().c_str());
error_flag = true;
......
......@@ -490,7 +490,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
int atrib=0, any_atr=0, any_elem=0, base64=0, decimal=0, embed=0, list=0,
text=0, untagged=0, use_nil=0, use_number=0, use_order=0, use_qname=0,
use_type_attr=0, ws=0, has_1untag=0, form_qualified=0, any_from=0,
any_except=0, nof_ns_uris=0;
any_except=0, nof_ns_uris=0, blocked=0;
const char* dfe_str = 0;
char** ns_uris = 0;
char* oftype_descr_name = 0;
......@@ -507,6 +507,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
any_elem= has_ae(xerattrib);
atrib = xerattrib->attribute_;
base64 = xerattrib->base64_;
blocked = xerattrib->abstract_ || xerattrib->block_;
decimal = xerattrib->decimal_;
embed = xerattrib->embedValues_;
form_qualified = (xerattrib->form_ & XerAttributes::QUALIFIED)
......@@ -607,7 +608,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
// Generate the XER descriptor itself
target->source.global_vars = mputprintf(target->source.global_vars,
"const XERdescriptor_t %s_xer_ = { {\"%s>\\n\", \"%s>\\n\"},"
" {%lu, %lu}, %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s, WHITESPACE_%s, %c%s, "
" {%lu, %lu}, %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s, WHITESPACE_%s, %c%s, "
"&%s, %ld, %u, %s, %s };\n",
gennameown_str,
bxer_name.c_str(), last_s.c_str(), // names
......@@ -616,6 +617,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
(any_elem ? " |ANY_ELEMENT" : ""),
(atrib ? " |XER_ATTRIBUTE" : ""),
(base64 ? " |BASE_64" : ""),
(blocked ? " |BLOCKED" : ""),
(decimal ? " |XER_DECIMAL" : ""),
(embed ? " |EMBED_VALUES" : ""),
(list ? " |XER_LIST" : ""),
......@@ -630,6 +632,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
(form_qualified ? "" : " |FORM_UNQUALIFIED"),
(any_from ? " |ANY_FROM" : ""),
(any_except ? " |ANY_EXCEPT" : ""),
(is_optional_field() ? " |XER_OPTIONAL" : ""),
whitespace_action[ws],
(dfe_str ? '&' : ' '), (dfe_str ? dfe_str : "NULL"),
"module_object",
......
......@@ -4376,7 +4376,7 @@ void Value::chk_expr_operand_execute_refd(Value *v1,
}
switch (exp_val) {
case Type::EXPECTED_CONSTANT:
error("An evaluatable constant value was expected instead of operation "
error("An evaluable constant value was expected instead of operation "
"`apply()'");
set_valuetype(V_ERROR);
break;
......@@ -5637,7 +5637,7 @@ error:
case Assignment::A_MODULEPAR:
case Assignment::A_MODULEPAR_TEMP:
if(exp_val==Type::EXPECTED_CONSTANT) {
u.expr.ti1->error("Reference to an (evaluatable) constant value was "
u.expr.ti1->error("Reference to an (evaluable) constant value was "
"expected instead of %s", t_ass->get_description().c_str());
goto error;
}
......@@ -5980,7 +5980,7 @@ error:
Ttcn::StatementBlock *my_sb;
switch (exp_val) {
case Type::EXPECTED_CONSTANT:
error("An evaluatable constant value was expected instead of operation "
error("An evaluable constant value was expected instead of operation "
"`%s'", get_opname());
goto error;
case Type::EXPECTED_STATIC_VALUE:
......@@ -11113,15 +11113,13 @@ error:
Ttcn::ActualParList *parlist = u.ref.ref->get_parlist();
if (parlist) {
str = parlist->rearrange_init_code(str,
u.ref.ref->get_refd_assignment()->get_my_scope()->get_scope_mod_gen()
== my_scope->get_scope_mod_gen());
u.ref.ref->get_refd_assignment()->get_my_scope()->get_scope_mod_gen());
}
break; }
case V_INVOKE: {
str = u.invoke.v->rearrange_init_code(str);
bool type_is_local = u.invoke.v->get_expr_governor_last()->get_my_scope()
->get_scope_mod_gen() == my_scope->get_scope_mod_gen();
str = u.invoke.ap_list->rearrange_init_code(str, type_is_local);
str = u.invoke.ap_list->rearrange_init_code(str,
u.invoke.v->get_expr_governor_last()->get_my_scope()->get_scope_mod_gen());
break; }
case V_EXPR:
switch (u.expr.v_optype) {
......@@ -11167,15 +11165,11 @@ error:
case OPTYPE_DECODE: {
Ttcn::ActualParList *parlist = u.expr.r1->get_parlist();
Common::Assignment *ass = u.expr.r1->get_refd_assignment();
bool rearrange = (ass->get_my_scope()->get_scope_mod_gen() ==
my_scope->get_scope_mod_gen());
if (parlist) str = parlist->rearrange_init_code(str, rearrange);
if (parlist) str = parlist->rearrange_init_code(str, ass->get_my_scope()->get_scope_mod_gen());
parlist = u.expr.r2->get_parlist();
ass = u.expr.r2->get_refd_assignment();
rearrange = (ass->get_my_scope()->get_scope_mod_gen() ==
my_scope->get_scope_mod_gen());
if (parlist) str = parlist->rearrange_init_code(str, rearrange);
if (parlist) str = parlist->rearrange_init_code(str, ass->get_my_scope()->get_scope_mod_gen());
break; }
case OPTYPE_ADD:
case OPTYPE_SUBTRACT:
......@@ -11214,13 +11208,13 @@ error:
if (u.expr.v2) str = u.expr.v2->rearrange_init_code(str);
break;
case OPTYPE_SUBSTR:
str = u.expr.ti1->rearrange_init_code(str);
str = u.expr.ti1->rearrange_init_code(str, my_scope->get_scope_mod_gen());
str = u.expr.v2->rearrange_init_code(str);
str = u.expr.v3->rearrange_init_code(str);
break;
case OPTYPE_REGEXP:
str = u.expr.ti1->rearrange_init_code(str);
str = u.expr.t2->rearrange_init_code(str);
str = u.expr.ti1->rearrange_init_code(str, my_scope->get_scope_mod_gen());
str = u.expr.t2->rearrange_init_code(str, my_scope->get_scope_mod_gen());
str = u.expr.v3->rearrange_init_code(str);
break;
case OPTYPE_DECOMP:
......@@ -11229,10 +11223,10 @@ error:
str = u.expr.v3->rearrange_init_code(str);
break;
case OPTYPE_REPLACE:
str = u.expr.ti1->rearrange_init_code(str);
str = u.expr.ti1->rearrange_init_code(str, my_scope->get_scope_mod_gen());
str = u.expr.v2->rearrange_init_code(str);
str = u.expr.v3->rearrange_init_code(str);
str = u.expr.ti4->rearrange_init_code(str);
str = u.expr.ti4->rearrange_init_code(str, my_scope->get_scope_mod_gen());
break;
case OPTYPE_LENGTHOF:
case OPTYPE_SIZEOF:
......@@ -11240,14 +11234,14 @@ error:
case OPTYPE_ENCODE:
case OPTYPE_ISPRESENT:
case OPTYPE_TTCN2STRING:
str = u.expr.ti1->rearrange_init_code(str);
str = u.expr.ti1->rearrange_init_code(str, my_scope->get_scope_mod_gen());
break;
case OPTYPE_ISCHOSEN_T:
str = u.expr.t1->rearrange_init_code(str);
str = u.expr.t1->rearrange_init_code(str, my_scope->get_scope_mod_gen());
break;
case OPTYPE_MATCH:
str = u.expr.v1->rearrange_init_code(str);
str = u.expr.t2->rearrange_init_code(str);
str = u.expr.t2->rearrange_init_code(str, my_scope->get_scope_mod_gen());
break;
default:
// other kinds of expressions cannot appear within templates
......
......@@ -25,10 +25,12 @@ static const NamespaceRestriction empty_nsr = {
static const XerAttributes::NameChange nochange= { NamespaceSpecification::NO_MANGLING };
XerAttributes::XerAttributes()
: attribute_(false)
: abstract_(false)
, attribute_(false)
, anyAttributes_(empty_nsr)
, anyElement_(empty_nsr)
, base64_(false)
, block_(false)
, decimal_(false)
, defaultForEmpty_(0)
, defaultValue_(0)
......@@ -127,6 +129,7 @@ void XerAttributes::print(const char *type_name) const {
fprintf(stderr, "XER attributes(%p) for %s:\n", (const void*)this, type_name);
if (empty()) fputs("...Empty...\n", stderr);
else {
fputs(abstract_ ? "ABSTRACT\n" : "", stderr);
fputs(attribute_ ? "ATTRIBUTE\n" : "", stderr);
if (has_aa(this)) {
......@@ -153,6 +156,7 @@ void XerAttributes::print(const char *type_name) const {
}
}
fputs(base64_ ? "BASE64\n" : "", stderr);
fputs(block_ ? "BLOCK\n" : "", stderr);
fputs(decimal_ ? "DECIMAL\n" : "", stderr);
if (defaultForEmpty_) fprintf(stderr, "DEFAULT-FOR-EMPTY '%s'\n", defaultForEmpty_);
......@@ -238,6 +242,7 @@ fprintf(stderr, "@@@ replacing:\n");
print("orig.");
other.print("other");
*/
abstract_ |= other.abstract_;
attribute_ |= other.attribute_;
if (has_aa(&other)) {
FreeNamespaceRestriction(anyAttributes_);
......@@ -260,6 +265,7 @@ other.print("other");
}
}
base64_ |= other.base64_;
block_ |= other.block_;
decimal_ |= other.decimal_;
if (other.defaultForEmpty_ != 0) {
......@@ -362,10 +368,12 @@ other.print("other");
bool XerAttributes::empty() const
{
return !attribute_
return !abstract_
&& !attribute_
&& !has_aa(this)
&& !has_ae(this)
&& !base64_
&& !block_
&& !decimal_
&& defaultForEmpty_ == 0
&& !element_
......
......@@ -136,11 +136,13 @@ public:
/// If the NamespaceSpecification contains a string, free it.
static void FreeNamespace(NamespaceSpecification& ns);
public:
bool abstract_;
bool attribute_;
NamespaceRestriction anyAttributes_;
NamespaceRestriction anyElement_;
/// Base64 encoding for string-like types (XSD:base64Binary)
bool base64_;
bool block_;
/// No scientific notation for float
bool decimal_;
/// String parsed out from the encoding attribute
......
......@@ -1942,7 +1942,7 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc)
" && *p_td.my_module->get_ns(p_td.ns_index)->px == '\\0';\n"
);
src = mputstr(src, " const boolean delay_close = e_xer");
src = mputstr(src, " boolean delay_close = e_xer");
if (!(num_attributes | sdef->xerUseQName)) {
src = mputprintf(src, " && (need_control_ns%s || empty_ns_hack)",
(start_at < sdef->nElements) ? " || num_collected" : "");
......@@ -1973,9 +1973,11 @@ void gen_xer(const struct_def *sdef, char **pdef, char **psrc)
" if (chopped_chars) {\n"
" p_buf.increase_length(-chopped_chars);\n"
" }\n"
"%s"
" }\n"
, (want_namespaces ? "-(delay_close || (e_xer && (p_td.xer_bits & HAS_1UNTAGGED)))" : "")
, (want_namespaces ? " || delay_close" : ""));
, (want_namespaces ? " || delay_close" : "")
, (want_namespaces ? " delay_close = TRUE;\n" : ""));
}
src = mputprintf(src,
......
......@@ -1390,7 +1390,7 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output)
" if ((XML_READER_TYPE_ELEMENT == type && p_reader.MoveToFirstAttribute() == 1)\n"
" || XML_READER_TYPE_ATTRIBUTE == type) {\n"
" verify_name(p_reader, p_td, e_xer);\n"
" break;"
" break;\n"
" }\n"
" }\n"
" if (e_xer && (p_td.xer_bits & XER_LIST)) {\n"
......@@ -1545,6 +1545,9 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output)
" }\n" /* next read */
" }\n" /* if not empty element */
" }\n" /* if not LIST */
" if (!own_tag && e_xer && (p_td.xer_bits & XER_OPTIONAL) && val_ptr->n_elements == 0) {\n"
" clean_up();\n" /* set it to unbound, so the OPTIONAL class sets it to omit */
" }\n"
" return 1;\n"
"}\n\n"
);
......
......@@ -7382,7 +7382,7 @@ namespace Ttcn {
TemplateInstance *p_defval, bool p_lazy_eval)
: Definition(p_asstype, p_name), type(p_type), my_parlist(0),
used_as_lvalue(false), template_restriction(TR_NONE),
lazy_eval(p_lazy_eval)
lazy_eval(p_lazy_eval), defval_generated(false)
{
switch (p_asstype) {
case A_PAR_VAL:
......@@ -7408,7 +7408,7 @@ namespace Ttcn {
Identifier* p_name, TemplateInstance *p_defval, bool p_lazy_eval)
: Definition(p_asstype, p_name), type(p_type), my_parlist(0),
used_as_lvalue(false), template_restriction(p_template_restriction),
lazy_eval(p_lazy_eval)
lazy_eval(p_lazy_eval), defval_generated(false)
{
switch (p_asstype) {
case A_PAR_TEMPL_IN:
......@@ -7427,7 +7427,8 @@ namespace Ttcn {
FormalPar::FormalPar(asstype_t p_asstype, Identifier* p_name,
TemplateInstance *p_defval)
: Definition(p_asstype, p_name), type(0), my_parlist(0),
used_as_lvalue(false), template_restriction(TR_NONE), lazy_eval(false)
used_as_lvalue(false), template_restriction(TR_NONE), lazy_eval(false),
defval_generated(false)
{
if (p_asstype != A_PAR_TIMER)
FATAL_ERROR("Ttcn::FormalPar::FormalPar(): invalid parameter type");
......@@ -8100,34 +8101,23 @@ namespace Ttcn {
}
}
}
void FormalPar::generate_code_defval(output_struct *target, bool)
char* FormalPar::generate_code_defval(char* str)
{
if (!defval.ap) return;
if (!defval.ap || defval_generated) return str;
defval_generated = true;
switch (defval.ap->get_selection()) {
case ActualPar::AP_VALUE: {
Value *val = defval.ap->get_Value();
const_def cdef;
Code::init_cdef(&cdef);
type->generate_code_object(&cdef, val);
Code::merge_cdef(target, &cdef);
Code::free_cdef(&cdef);
if (use_runtime_2 && TypeConv::needs_conv_refd(val)) {
target->functions.post_init = TypeConv::gen_conv_code_refd(target->
functions.post_init, val->get_lhs_name().c_str(), val);
str = TypeConv::gen_conv_code_refd(str, val->get_lhs_name().c_str(), val);
} else {
target->functions.post_init = val->generate_code_init(
target->functions.post_init, val->get_lhs_name().c_str());
str = val->generate_code_init(str, val->get_lhs_name().c_str());
}
break; }
case ActualPar::AP_TEMPLATE: {
TemplateInstance *ti = defval.ap->get_TemplateInstance();
Template *temp = ti->get_Template();
const_def cdef;
Code::init_cdef(&cdef);
type->generate_code_object(&cdef, temp);
Code::merge_cdef(target, &cdef);
Code::free_cdef(&cdef);
Ref_base *dref = ti->get_DerivedRef();
if (dref) {
expression_struct expr;
......@@ -8135,22 +8125,16 @@ namespace Ttcn {
expr.expr = mputprintf(expr.expr, "%s = ",
temp->get_lhs_name().c_str());
dref->generate_code(&expr);
target->functions.post_init =
Code::merge_free_expr(target->functions.post_init, &expr, false);
str = Code::merge_free_expr(str, &expr, false);
}
if (use_runtime_2 && TypeConv::needs_conv_refd(temp)) {
target->functions.post_init = TypeConv::gen_conv_code_refd(target->
functions.post_init, temp->get_lhs_name().c_str(), temp);
str = TypeConv::gen_conv_code_refd(str, temp->get_lhs_name().c_str(), temp);
} else {
target->functions.post_init =
temp->generate_code_init(target->functions.post_init,
temp->get_lhs_name().c_str());
str = temp->generate_code_init(str, temp->get_lhs_name().c_str());
}
if (defval.ap->get_gen_restriction_check() != TR_NONE) {
target->functions.post_init =
Template::generate_restriction_check_code(
target->functions.post_init, temp->get_lhs_name().c_str(),
defval.ap->get_gen_restriction_check());
str = Template::generate_restriction_check_code(str,
temp->get_lhs_name().c_str(), defval.ap->get_gen_restriction_check());
}
break; }
case ActualPar::AP_REF:
......@@ -8158,6 +8142,36 @@ namespace Ttcn {
default:
FATAL_ERROR("FormalPar::generate_code()");
}
return str;
}
void FormalPar::generate_code_defval(output_struct *target, bool)
{
if (!defval.ap) return;
switch (defval.ap->get_selection()) {
case ActualPar::AP_VALUE: {
Value *val = defval.ap->get_Value();
const_def cdef;
Code::init_cdef(&cdef);
type->generate_code_object(&cdef, val);
Code::merge_cdef(target, &cdef);
Code::free_cdef(&cdef);
break; }
case ActualPar::AP_TEMPLATE: {
TemplateInstance *ti = defval.ap->get_TemplateInstance();
Template *temp = ti->get_Template();
const_def cdef;
Code::init_cdef(&cdef);
type->generate_code_object(&cdef, temp);
Code::merge_cdef(target, &cdef);
Code::free_cdef(&cdef);
break; }
case ActualPar::AP_REF:
break;
default:
FATAL_ERROR("FormalPar::generate_code()");
}
target->functions.post_init = generate_code_defval(target->functions.post_init);
}
char *FormalPar::generate_code_fpar(char *str)
......@@ -8900,11 +8914,20 @@ namespace Ttcn {
}
return str;
}
char* FormalParList::generate_code_defval(char* str)
{
for (size_t i = 0; i < pars_v.size(); i++) {
str = pars_v[i]->generate_code_defval(str);
}
return str;
}
void FormalParList::generate_code_defval(output_struct *target)
{
for (size_t i = 0; i < pars_v.size(); i++)
for (size_t i = 0; i < pars_v.size(); i++) {
pars_v[i]->generate_code_defval(target);
}
}
char *FormalParList::generate_code_actual_parlist(char *str,
......@@ -9288,18 +9311,18 @@ namespace Ttcn {
}
}
char *ActualPar::rearrange_init_code(char *str, bool is_local)
char *ActualPar::rearrange_init_code(char *str, Common::Module* usage_mod)
{
switch (selection) {
case AP_VALUE:
str = val->rearrange_init_code(str);
break;
case AP_TEMPLATE:
str = temp->rearrange_init_code(str);
str = temp->rearrange_init_code(str, usage_mod);
case AP_REF:
break;
case AP_DEFAULT:
if (is_local) str = act->rearrange_init_code_defval(str);
str = act->rearrange_init_code_defval(str, usage_mod);
break;
default:
FATAL_ERROR("ActualPar::rearrange_init_code()");
......@@ -9307,24 +9330,28 @@ namespace Ttcn {
return str;
}
char *ActualPar::rearrange_init_code_defval(char *str)
char *ActualPar::rearrange_init_code_defval(char *str, Common::Module* usage_mod)
{
switch (selection) {
case AP_VALUE:
str = val->generate_code_init(str, val->get_lhs_name().c_str());
if (val->get_my_scope()->get_scope_mod_gen() == usage_mod) {
str = val->generate_code_init(str, val->get_lhs_name().c_str());
}
break;
case AP_TEMPLATE: {
str = temp->rearrange_init_code(str);
Ref_base *dref = temp->get_DerivedRef();
str = temp->rearrange_init_code(str, usage_mod);
Template *t = temp->get_Template();
if (dref) {
expression_struct expr;
Code::init_expr(&expr);
expr.expr = mputprintf(expr.expr, "%s = ", t->get_lhs_name().c_str());
dref->generate_code(&expr);
str = Code::merge_free_expr(str, &expr, false);
if (t->get_my_scope()->get_scope_mod_gen() == usage_mod) {
Ref_base *dref = temp->get_DerivedRef();
if (dref) {
expression_struct expr;
Code::init_expr(&expr);
expr.expr = mputprintf(expr.expr, "%s = ", t->get_lhs_name().c_str());
dref->generate_code(&expr);
str = Code::merge_free_expr(str, &expr, false);
}
str = t->generate_code_init(str, t->get_lhs_name().c_str());
}
str = t->generate_code_init(str, t->get_lhs_name().c_str());
break; }
default:
FATAL_ERROR("ActualPar::rearrange_init_code_defval()");
......@@ -9602,10 +9629,10 @@ namespace Ttcn {
template_refs.clear();
}
char *ActualParList::rearrange_init_code(char *str, bool is_local)
char *ActualParList::rearrange_init_code(char *str, Common::Module* usage_mod)
{
for (size_t i = 0; i < params.size(); i++)
str = params[i]->rearrange_init_code(str, is_local);
str = params[i]->rearrange_init_code(str, usage_mod);
return str;
}
......
......@@ -119,12 +119,11 @@ namespace Ttcn {
* aliasing problems with other out/inout parameters. */
void generate_code(expression_struct *expr, bool copy_needed, bool lazy_param=false, bool used_as_lvalue=false) const;
/** Appends the initialization sequence of all (directly or indirectly)
* referred non-parameterized templates to \a str and returns the resulting
* string. Flag \a is_local indicates whether the respective formal
* parameter is in the same module as \a this. It is considered only if
* \a selection is AP_DEFAULT. */
char *rearrange_init_code(char *str, bool is_local);
char *rearrange_init_code_defval(char *str);
* referred non-parameterized templates and the default values of all
* parameterized templates to \a str and returns the resulting string.
* Only objects belonging to module \a usage_mod are initialized. */
char *rearrange_init_code(char *str, Common::Module* usage_mod);
char *rearrange_init_code_defval(char *str, Common::Module* usage_mod);
/** Appends the string representation of the actual parameter to \a str. */
void append_stringRepr(string& str) const;
virtual void dump(unsigned level) const;
......@@ -171,10 +170,10 @@ namespace Ttcn {
Type *p_comptype, bool p_compself);
/** Walks through the parameter list and appends the initialization
* sequence of all (directly or indirectly) referred non-parameterized
* templates to \a str and returns the resulting string. Flag \a is_local
* indicates whether the respective formal parameter list is in the same
* module as \a this. */
char *rearrange_init_code(char *str, bool is_local);
* templates and the default values of all parameterized templates to
* \a str and returns the resulting string.
* Only objects belonging to module \a usage_mod are initialized. */
char *rearrange_init_code(char *str, Common::Module* usage_mod);
virtual void dump(unsigned level) const;
};
......@@ -1588,6 +1587,9 @@ namespace Ttcn {
template_restriction_t template_restriction;
/** normal or lazy evaluation parametrization should be used */
bool lazy_eval;
/** Flag that indicates whether the C++ code for the parameter's default
* value has been generated or not. */
bool defval_generated;
/// Copy constructor disabled
FormalPar(const FormalPar& p);
......@@ -1642,7 +1644,11 @@ namespace Ttcn {
* reporting. */
virtual void use_as_lvalue(const Location& p_loc);
bool get_used_as_lvalue() const { return used_as_lvalue; }
/** Generates the C++ objects that represent the default value for the
/** Partially generates the C++ object that represents the default value for
* the parameter (if present). The object's declaration is not generated,
* only its value assignment. */
char* generate_code_defval(char* str);
/** Generates the C++ object that represents the default value for the
* parameter (if present). */
virtual void generate_code_defval(output_struct *target, bool clean_up = false);