/* 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
* 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)
}
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;
+ }
+ }
}
#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;
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;
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)
// 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
(any_elem ? " |ANY_ELEMENT" : ""),
(atrib ? " |XER_ATTRIBUTE" : ""),
(base64 ? " |BASE_64" : ""),
+ (blocked ? " |BLOCKED" : ""),
(decimal ? " |XER_DECIMAL" : ""),
(embed ? " |EMBED_VALUES" : ""),
(list ? " |XER_LIST" : ""),
(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",
}
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;
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;
}
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:
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) {
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:
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:
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:
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
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)
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)) {
}
}
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_);
print("orig.");
other.print("other");
*/
+ abstract_ |= other.abstract_;
attribute_ |= other.attribute_;
if (has_aa(&other)) {
FreeNamespaceRestriction(anyAttributes_);
}
}
base64_ |= other.base64_;
+ block_ |= other.block_;
decimal_ |= other.decimal_;
if (other.defaultForEmpty_ != 0) {
bool XerAttributes::empty() const
{
- return !attribute_
+ return !abstract_
+ && !attribute_
&& !has_aa(this)
&& !has_ae(this)
&& !base64_
+ && !block_
&& !decimal_
&& defaultForEmpty_ == 0
&& !element_
/// 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
" && *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" : "");
" 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,
" 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"
" }\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"
);
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:
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:
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");
}
}
}
-
- 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;
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:
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)
}
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,
}
}
- 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()");
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()");
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;
}
* 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;
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;
};
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);
* 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);
/** Generates the C++ equivalent of the formal parameter, appends it to
/** Generates the C++ equivalent of the formal parameter list, appends it
* to \a str and returns the resulting string. */
char *generate_code(char *str);
+ /** Partially generates the C++ objects that represent the default value for
+ * the parameters (if present). The objects' declarations are not generated,
+ * only their value assignments. */
+ char* generate_code_defval(char* str);
/** Generates the C++ objects that represent the default values for the
* parameters (if present). */
void generate_code_defval(output_struct *target);
break;
case TEMPLATE_INVOKE:
if (get_code_section() == CS_POST_INIT)
- str = rearrange_init_code_invoke(str);
+ str = rearrange_init_code_invoke(str, my_scope->get_scope_mod_gen());
str = generate_code_init_invoke(str, name);
break;
case TEMPLATE_LIST:
return str;
}
- char *Template::rearrange_init_code(char *str)
+ char *Template::rearrange_init_code(char *str, Common::Module* usage_mod)
{
switch (templatetype) {
case SPECIFIC_VALUE:
str = u.specific_value->rearrange_init_code(str);
break;
case TEMPLATE_REFD:
- str = rearrange_init_code_refd(str);
+ str = rearrange_init_code_refd(str, usage_mod);
break;
case TEMPLATE_INVOKE:
- str = rearrange_init_code_invoke(str);
+ str = rearrange_init_code_invoke(str, usage_mod);
break;
case TEMPLATE_LIST:
case VALUE_LIST:
case SUBSET_MATCH:
case PERMUTATION_MATCH:
for (size_t i = 0; i < u.templates->get_nof_ts(); i++)
- str = u.templates->get_t_byIndex(i)->rearrange_init_code(str);
+ str = u.templates->get_t_byIndex(i)->rearrange_init_code(str, usage_mod);
break;
case NAMED_TEMPLATE_LIST:
for (size_t i = 0; i < u.named_templates->get_nof_nts(); i++)
str = u.named_templates->get_nt_byIndex(i)->get_template()
- ->rearrange_init_code(str);
+ ->rearrange_init_code(str, usage_mod);
break;
case INDEXED_TEMPLATE_LIST:
for (size_t i = 0; i < u.indexed_templates->get_nof_its(); i++)
str = u.indexed_templates->get_it_byIndex(i)->get_template()
- ->rearrange_init_code(str);
+ ->rearrange_init_code(str, usage_mod);
break;
case VALUE_RANGE:
str = u.value_range->rearrange_init_code(str);
if (get_code_section() == CS_POST_INIT) {
// the referencing template is a part of a non-parameterized template
Common::Assignment *ass = u.ref.ref->get_refd_assignment();
- if (ass->get_asstype() == Common::Assignment::A_TEMPLATE &&
- ass->get_my_scope()->get_scope_mod_gen() ==
- my_scope->get_scope_mod_gen()) {
+ if (ass->get_asstype() == Common::Assignment::A_TEMPLATE) {
// the reference points to (a field of) a template
- // within the local module
if (ass->get_FormalParList()) {
// the referred template is parameterized
// generate the initialization sequence first for all dependent
// non-parameterized templates
- str = rearrange_init_code_refd(str);
- } else {
+ str = rearrange_init_code_refd(str, my_scope->get_scope_mod_gen());
+ } else if (ass->get_my_scope()->get_scope_mod_gen() ==
+ my_scope->get_scope_mod_gen()) {
// the referred template is non-parameterized
// use a different algorithm for code generation
str = generate_rearrange_init_code_refd(str, &expr);
expr->expr = mputc(expr->expr, ')');
}
- char *Template::rearrange_init_code_refd(char *str)
+ char *Template::rearrange_init_code_refd(char *str, Common::Module* usage_mod)
{
if (templatetype != TEMPLATE_REFD)
FATAL_ERROR("Template::rearrange_init_code_refd()");
- ActualParList *parlist = u.ref.ref->get_parlist();
+ ActualParList *actual_parlist = u.ref.ref->get_parlist();
// generate code for the templates that are used in the actual parameter
// list of the reference
Common::Assignment *ass = u.ref.ref->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 (actual_parlist) str = actual_parlist->rearrange_init_code(str, usage_mod);
// do nothing if the reference does not point to a template definition
if (ass->get_asstype() != Common::Assignment::A_TEMPLATE) return str;
- // do nothing if the referenced template is in another module
- if (ass->get_my_scope()->get_scope_mod_gen() !=
- my_scope->get_scope_mod_gen()) return str;
Template *t = ass->get_Template();
- if (parlist) {
+ FormalParList *formal_parlist = ass->get_FormalParList();
+ if (formal_parlist) {
// the reference points to a parameterized template
// we must perform the rearrangement for all non-parameterized templates
- // that are referred by the parameterized template regardless the
+ // that are referred by the parameterized template regardless of the
// sub-references of u.ref.ref
- str = t->rearrange_init_code(str);
+ str = t->rearrange_init_code(str, usage_mod);
+ // the parameterized template's default values must also be generated
+ // (this only generates their value assignments, their declarations will
+ // be generated when the template's definition is reached)
+ if (ass->get_my_scope()->get_scope_mod_gen() == usage_mod) {
+ str = formal_parlist->generate_code_defval(str);
+ }
} else {
// the reference points to a non-parameterized template
FieldOrArrayRefs *subrefs = u.ref.ref->get_subrefs();
}
// otherwise if the reference points to a top-level template
// we should initialize its entire body
- str = t->generate_code_init(str, t->get_lhs_name().c_str());
+ if (ass->get_my_scope()->get_scope_mod_gen() == usage_mod) {
+ str = t->generate_code_init(str, t->get_lhs_name().c_str());
+ }
}
return str;
}
- char *Template::rearrange_init_code_invoke(char *str)
+ char *Template::rearrange_init_code_invoke(char *str, Common::Module* usage_mod)
{
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, usage_mod);
return str;
}
} else template_body->generate_code_expr(expr, template_restriction);
}
- char *TemplateInstance::rearrange_init_code(char *str)
+ char *TemplateInstance::rearrange_init_code(char *str, Common::Module* usage_mod)
{
if (derived_reference) {
- ActualParList *parlist = derived_reference->get_parlist();
+ ActualParList *actual_parlist = derived_reference->get_parlist();
Common::Assignment *ass = derived_reference->get_refd_assignment();
if (!ass) FATAL_ERROR("TemplateInstance::rearrange_init_code()");
- bool is_local = (ass->get_my_scope()->get_scope_mod_gen() ==
- derived_reference->get_my_scope()->get_scope_mod_gen());
- if (parlist) str = parlist->rearrange_init_code(str, is_local);
- if (is_local && ass->get_asstype() == Common::Assignment::A_TEMPLATE) {
- // the base template reference refers to a template within the local
- // module
+ if (actual_parlist) str = actual_parlist->rearrange_init_code(str, usage_mod);
+ if (ass->get_asstype() == Common::Assignment::A_TEMPLATE) {
Template *t = ass->get_Template();
- if (parlist) {
+ FormalParList *formal_parlist = ass->get_FormalParList();
+ if (formal_parlist) {
// the referred template is parameterized
// the embedded referenced templates shall be visited
- str = t->rearrange_init_code(str);
+ str = t->rearrange_init_code(str, usage_mod);
+ // the constants used for default values have to be initialized now
+ if (ass->get_my_scope()->get_scope_mod_gen() == usage_mod) {
+ str = formal_parlist->generate_code_defval(str);
+ }
} else {
// the referred template is not parameterized
// its entire body has to be initialized now
- str = t->generate_code_init(str, t->get_lhs_name().c_str());
+ if (ass->get_my_scope()->get_scope_mod_gen() == usage_mod) {
+ str = t->generate_code_init(str, t->get_lhs_name().c_str());
+ }
}
}
}
- str = template_body->rearrange_init_code(str);
+ str = template_body->rearrange_init_code(str, usage_mod);
return str;
}
char *generate_code_init(char *str, const char *name);
/** Walks through the template recursively and appends the C++
* initialization sequence of all (directly or indirectly)
- * referenced non-parameterized templates to \a str and returns
- * the resulting string. Templates imported from other modules
- * are not visited. */
- char *rearrange_init_code(char *str);
+ * referenced 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);
private:
/** Private helper functions for code generation. */
/** Helper function for \a rearrange_init_code(). It handles the
* referenced templates (i.e. it does the real work). */
- char *rearrange_init_code_refd(char *str);
- char *rearrange_init_code_invoke(char *str);
+ char *rearrange_init_code_refd(char *str, Common::Module* usage_mod);
+ char *rearrange_init_code_invoke(char *str, Common::Module* usage_mod);
/** Returns whether the C++ initialization sequence requires a
* temporary variable reference to be introduced for efficiency
void generate_code(expression_struct *expr,
template_restriction_t template_restriction = TR_NONE);
/** Appends the initialization sequence of the referred templates
- * to \a str. Only those templates are considered that are in
- * the same module as \a this. */
- char *rearrange_init_code(char *str);
+ * and their default values to \a str. Only templates from module
+ * \a usage_mod are considered. */
+ char *rearrange_init_code(char *str, Common::Module* usage_mod);
/** Appends the string representation of the template instance to
* \a str. */
$$ = new Identifier(Identifier::ID_TTCN, at_field);
}
+| NullValue
+ {
+ $$ = new Identifier(Identifier::ID_NAME, string("NULL"));
+ }
IschosenArg: /* see also Reference... */
IDentifier '.' PredefOrIdentifier
HEXORDER { BEGIN(rawcodec); RETURN(XHexOrderKeyword); }
TOPLEVEL { BEGIN(rawcodec); RETURN(XToplevelKeyword); }
IntX { RETURN(XIntXKeyword); }
+bit { RETURN(XBitKeyword); }
+unsigned { RETURN(XUnsignedKeyword); }
<rawcodec>{
yes { yylval.enumval = XDEFYES; RETURN(XYes); }
* when to return to INITIAL) */
/* First, the "starter" attributes */
+abstract RETURN(XKWabstract);
anyAttributes RETURN(XKWanyAttributes);
anyElement RETURN(XKWanyElement);
attribute RETURN(XKWattribute);
attributeFormQualified RETURN(XKWattributeFormQualified);
+block RETURN(XKWblock);
controlNamespace RETURN(XKWcontrolNamespace);
defaultForEmpty RETURN(XKWdefaultForEmpty);
element RETURN(XKWelement);
%token XToplevelKeyword
%token XRepeatableKeyword
%token XIntXKeyword
+%token XBitKeyword
+%token XUnsignedKeyword
/* XER attributes */
%token XKWall "all"
%token XKWprefix "prefix"
+%token XKWabstract "abstact"
%token XKWanyAttributes "anyAttributes"
%token XKWanyElement "anyElement"
%token XKWattribute "attribute"
%token XKWattributeFormQualified "attributeFormQualified"
+%token XKWblock "block"
%token XKWcontrolNamespace "controlNamespace"
%token XKWdefaultForEmpty "defaultForEmpty"
%token XKWelement "element"
{ rawstruct->topleveleind=1; raw_f=true;}
| XIntXKeyword
{ rawstruct->intx = true; raw_f = true; }
+ | XBitDef
+ { raw_f = true; }
/* TEXT encoder keywords */
| XBeginDef
{ text_f=true; }
}
;
+/* Alternative RAW attributes for types defined in annex E of the TTCN-3 standard */
+XBitDef:
+ XNumber XBitKeyword
+ {
+ rawstruct->fieldlength = $1;
+ rawstruct->comp = XDEFSIGNBIT;
+ rawstruct->byteorder = XDEFLAST;
+ }
+| XUnsignedKeyword XNumber XBitKeyword
+ {
+ rawstruct->fieldlength = $2;
+ rawstruct->comp = XDEFUNSIGNED;
+ rawstruct->byteorder = XDEFLAST;
+ }
+;
+
/* Text encoder */
XBeginDef:
XBeginKeyword '(' XEncodeToken ')' {
;
XERattribute:
- anyAttributes { FreeNamespaceRestriction(xerstruct->anyAttributes_); xerstruct->anyAttributes_ = $1; }
+ XKWabstract { xerstruct->abstract_ = true; }
+ | anyAttributes { FreeNamespaceRestriction(xerstruct->anyAttributes_); xerstruct->anyAttributes_ = $1; }
| anyElement { FreeNamespaceRestriction(xerstruct->anyElement_); xerstruct->anyElement_ = $1; }
| XKWattribute { xerstruct->attribute_ = true; }
| XKWattributeFormQualified { xerstruct->form_ |= XerAttributes::ATTRIBUTE_DEFAULT_QUALIFIED; }
+ | XKWblock { xerstruct->block_ = true; }
| controlNamespace /* directly on the module */
{
mymod->set_controlns($1.uri, $1.prefix);
src = mputstr(src,
" const boolean e_xer = is_exer(p_flavor);\n"
" char *type_atr = NULL;\n"
- " unsigned short name_len = 0;\n"
" if (e_xer && (p_td.xer_bits & USE_TYPE_ATTR)) {\n"
- " const char *type_name = 0;\n"
+ " char *type_name = 0;\n"
" const namespace_t *control_ns;\n"
" switch (union_selection) {\n");
/* In case of USE-TYPE the first field won't need the type attribute */
for (i = start_at; i < sdef->nElements; i++) {
src = mputprintf(src,
" case %s_%s:\n"
- " type_name = %s_xer_.names[1];\n"
- " name_len = %s_xer_.namelens[1] - 2;\n"
+ " if (%s_xer_.my_module != 0 && %s_xer_.ns_index != -1 &&\n"
+ " %s_xer_.namelens[1] > 2) {\n"
+ /* add the namespace prefix to the type attribute (if the name is not empty) */
+ " const namespace_t *my_ns = %s_xer_.my_module->get_ns(%s_xer_.ns_index);\n"
+ " if (my_ns->px[0] != 0) {\n"
+ " type_name = mprintf(\"%%s:\", my_ns->px);\n"
+ " }\n"
+ " }\n"
+ " type_name = mputstrn(type_name, %s_xer_.names[1], %s_xer_.namelens[1] - 2);\n"
" %s\n"
, selection_prefix, sdef->elements[i].name
- , sdef->elements[i].typegen
+ , sdef->elements[i].typegen, sdef->elements[i].typegen
+ , sdef->elements[i].typegen, sdef->elements[i].typegen
+ , sdef->elements[i].typegen, sdef->elements[i].typegen
, sdef->elements[i].typegen
, i < sdef->nElements - 1 ? "goto write_atr;" : "" /* no break */
);
}
src = mputprintf(src,
"%s" /* label only if more than two elements total */
- " if (name_len > 0) {\n" /* 38.3.8, no atr if NAME AS "" */
+ " if (mstrlen(type_name) > 0) {\n" /* 38.3.8, no atr if NAME AS "" */
" control_ns = p_td.my_module->get_controlns();\n"
" type_atr = mcopystr(\" \");\n"
- " type_atr = mputstr (type_atr, control_ns->px);\n"
- " type_atr = mputstr (type_atr, \":type='\");\n"
- " type_atr = mputstrn(type_atr, type_name, name_len);\n"
- " type_atr = mputc (type_atr, '\\'');\n"
+ " type_atr = mputstr(type_atr, control_ns->px);\n"
+ " type_atr = mputstr(type_atr, \":type='\");\n"
+ " type_atr = mputstr(type_atr, type_name);\n"
+ " type_atr = mputc (type_atr, '\\'');\n"
+ " Free(type_name);\n"
" }\n"
" break;\n"
" default: break;\n"
src = mputstr(src,
" const boolean e_xer = is_exer(p_flavor);\n"
" char *type_atr = NULL;\n"
- " unsigned short name_len = 0;\n"
" if (e_xer && (p_td.xer_bits & USE_TYPE_ATTR)) {\n"
- " const char *type_name = 0;\n"
+ " char *type_name = 0;\n"
" const namespace_t *control_ns;\n"
" switch (union_selection) {\n");
int start_at = sdef->xerUseUnion ? 0 : 1;
for (i = start_at; i < sdef->nElements; i++) {
src = mputprintf(src,
" case %s_%s:\n"
- " type_name = %s_xer_.names[1];\n"
- " name_len = %s_xer_.namelens[1] - 2;\n"
+ " if (%s_xer_.my_module != 0 && %s_xer_.ns_index != -1 &&\n"
+ " %s_xer_.namelens[1] > 2) {\n"
+ /* add the namespace prefix to the type attribute (if the name is not empty) */
+ " const namespace_t *my_ns = %s_xer_.my_module->get_ns(%s_xer_.ns_index);\n"
+ " if (my_ns->px[0] != 0) {\n"
+ " type_name = mprintf(\"%%s:\", my_ns->px);\n"
+ " }\n"
+ " }\n"
+ " type_name = mputstrn(type_name, %s_xer_.names[1], %s_xer_.namelens[1] - 2);\n"
" %s\n"
, selection_prefix, sdef->elements[i].name
- , sdef->elements[i].typegen
+ , sdef->elements[i].typegen, sdef->elements[i].typegen
+ , sdef->elements[i].typegen, sdef->elements[i].typegen
+ , sdef->elements[i].typegen, sdef->elements[i].typegen
, sdef->elements[i].typegen
, i < sdef->nElements - 1 ? "goto write_atr;" : "" /* no break */
);
}
src = mputprintf(src,
"%s" /* label only if more than two elements total */
- " if (name_len > 0) {\n" /* 38.3.8, no atr if NAME AS "" */
+ " if (mstrlen(type_name) > 0) {\n" /* 38.3.8, no atr if NAME AS "" */
" control_ns = p_td.my_module->get_controlns();\n"
" type_atr = mcopystr(\" \");\n"
- " type_atr = mputstr (type_atr, control_ns->px);\n"
- " type_atr = mputstr (type_atr, \":type='\");\n"
- " type_atr = mputstrn(type_atr, type_name, name_len);\n"
- " type_atr = mputc (type_atr, '\\'');\n"
+ " type_atr = mputstr(type_atr, control_ns->px);\n"
+ " type_atr = mputstr(type_atr, \":type='\");\n"
+ " type_atr = mputstr(type_atr, type_name);\n"
+ " type_atr = mputc (type_atr, '\\'');\n"
+ " Free(type_name);\n"
" }\n"
" break;\n"
" default: break;\n"
/* USE-TYPE: No type attribute means the first alternative */
src = mputprintf(src,
" if (typeatr == NULL) {\n"
- " typeatr = mcopystr(%s_xer_.names[1]);\n"
- " typeatr = mtruncstr(typeatr, %s_xer_.namelens[1] - 2);\n"
+ " typeatr = mcopystrn(%s_xer_.names[1], %s_xer_.namelens[1] - 2);\n"
" }\n"
, sdef->elements[0].typegen
, sdef->elements[0].typegen);
if (sdef->xerUseTypeAttr) {
src = mputstr(src,
" if (e_xer) {\n" /* USE-TYPE => no XML element, use typeatr */
- " elem_name = typeatr;\n"
+ " char *token_1 = strtok(typeatr, \":\");\n" /* extract the namespace (if any) */
+ " char *token_2 = strtok(NULL, \":\");\n"
+ " if (token_2) {\n" /* namespace found */
+ " elem_name = token_2;\n"
+ " ns_uri = get_ns_uri_from_prefix(token_1, p_td);\n"
+ " }\n"
+ " else {\n" /* no namespace */
+ " elem_name = token_1;\n"
+ " }\n"
" flavor_1 |= USE_TYPE_ATTR;\n"
" }\n"
" else" /* no newline, gobbles up the next {} */);
src = mputprintf(src,
" %sif (%s::can_start(elem_name, ns_uri, %s_xer_, flavor_1) || (%s_xer_.xer_bits & ANY_ELEMENT)) {\n"
" ec_2.set_msg(\"%s': \");\n"
+ " if (e_xer && (%s_xer_.xer_bits & BLOCKED)) {\n"
+ " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG,\n"
+ " \"Attempting to decode blocked or abstract field.\");\n"
+ " }\n"
" %s%s().XER_decode(%s_xer_, p_reader, flavor_1, 0);\n"
" if (!%s%s().is_bound()) {\n"
" TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG, \"Failed to decode field.\");\n"
i && !(i==1 && sdef->exerMaybeEmptyIndex==0) ? "else " : "", /* print "if(" if generate code for the first field or if the first field is the MaybeEmpty field and we generate the code for the second one*/
sdef->elements[i].type, sdef->elements[i].typegen, sdef->elements[i].typegen,
sdef->elements[i].dispname,
+ sdef->elements[i].typegen,
at_field, sdef->elements[i].name, sdef->elements[i].typegen,
at_field, sdef->elements[i].name);
}
src = mputprintf(src,
" %sif ((e_xer && (type==XML_READER_TYPE_END_ELEMENT || !own_tag)) || %s::can_start(elem_name, ns_uri, %s_xer_, flavor_1) || (%s_xer_.xer_bits & ANY_ELEMENT)) {\n"
"empty_xml: ec_2.set_msg(\"%s': \");\n"
+ " if (e_xer && (%s_xer_.xer_bits & BLOCKED)) {\n"
+ " TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG,\n"
+ " \"Attempting to decode blocked or abstract field.\");\n"
+ " }\n"
" %s%s().XER_decode(%s_xer_, p_reader, flavor_1, 0);\n"
" if (!%s%s().is_bound()) {\n"
" TTCN_EncDec_ErrorContext::error(TTCN_EncDec::ET_INVAL_MSG, \"Failed to decode field.\");\n"
sdef->nElements>0 ? "else " : "",
sdef->elements[i].type, sdef->elements[i].typegen, sdef->elements[i].typegen,
sdef->elements[i].dispname,
+ sdef->elements[i].typegen,
at_field, sdef->elements[i].name, sdef->elements[i].typegen,
at_field, sdef->elements[i].name);
}
else bc = myleaf.body.leaf.data_array;
memset(bc, tmp, length * sizeof(*bc));
+ if (boolean_value && loc_length % 8 != 0) {
+ // remove the extra ones from the last octet
+ bc[length - 1] &= BitMaskTable[loc_length % 8];
+ }
return myleaf.length = loc_length;
}
INTEGER::~INTEGER()
{
+ if (!bound_flag) return;
if (unlikely(!native_flag)) BN_free(val.openssl);
}
PARALLEL_SHAREDLIB := libttcn3$(RT2_SUFFIX)-parallel-dynamic.so
# Executables
+ifneq ($(FUNCTION_TEST_RUNTIME), yes)
PROGRAMS := ttcn3_profmerge$(EXESUFFIX)
+endif
TARGETS := $(LIBRARY) $(PARALLEL_LIBRARY)
CHARSTRING TTCN_Runtime::get_testcasename()
{
- if (in_controlpart()) return CHARSTRING(""); // No error here.
+ if (in_controlpart() || is_hc()) return CHARSTRING(""); // No error here.
if (!testcase_name.definition_name || testcase_name.definition_name[0] == 0)
TTCN_error("Internal error: Evaluating predefined function testcasename()"
TTCN_error("Internal error: Invalid PTC verdict was "
"received from MC: %d.", ptc_verdict);
}
- verdicttype new_verdict =
- local_verdict < ptc_verdict ? ptc_verdict : local_verdict;
+ verdicttype new_verdict = local_verdict;
+ if (ptc_verdict > local_verdict) {
+ new_verdict = ptc_verdict;
+ verdict_reason = CHARSTRING(ptc_verdict_reason);
+ }
TTCN_Logger::log_final_verdict(true, ptc_verdict, local_verdict,
new_verdict, ptc_verdict_reason, -1, ptc_compref, ptc_name);
delete [] ptc_name;
}
}
+const char* get_ns_uri_from_prefix(const char *prefix, const XERdescriptor_t& p_td)
+{
+ if (p_td.my_module != 0 && prefix != NULL && prefix[0] != 0) {
+ for (size_t i = 0; i < p_td.my_module->get_num_ns(); ++i) {
+ const namespace_t *ns = p_td.my_module->get_ns(i);
+ if (ns->px != NULL && strcmp(ns->px, prefix) == 0) {
+ return ns->ns;
+ }
+ }
+ }
+ return NULL;
+}
+
void check_namespace_restrictions(const XERdescriptor_t& p_td, const char* p_xmlns)
{
// In case of "anyElement from ..." matching namespaces is good
as empty elements in BXER only. This also influences them in record-of */
ANY_FROM = 1U << 27, // 0x8000000 anyElement from ... or anyAttributes from ...
ANY_EXCEPT = 1U << 28, // 0x10000000 anyElement except ... or anyAttributes except ...
- EXIT_ON_ERROR = 1U << 29 /* 0x20000000 clean up and exit instead of throwing
+ EXIT_ON_ERROR = 1U << 29, /* 0x20000000 clean up and exit instead of throwing
a decoding error, used on alternatives of a union with USE-UNION */
+ XER_OPTIONAL = 1U << 30, // 0x40000000 is an optional field of a record or set
+ BLOCKED = 1U << 31 // 0x80000000 either ABSTRACT or BLOCK
};
/** WHITESPACE actions.
*/
void write_ns_prefix(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf);
+/** Return the namespace referred to by a prefix
+ *
+ * Finds the namespace specified by \a prefix in the module's namespace table
+ * and returns its URI. Returns NULL if the namespace is not found.
+ *
+ * @param prefix namespace prefix to be found
+ * @param p_td XER descriptor (contains the module to search in)
+ */
+const char* get_ns_uri_from_prefix(const char *prefix, const XERdescriptor_t& p_td);
+
/** Output the beginning of an XML attribute.
*
* Writes a space, the attribute name (from \p p_td), and the string "='".
} /* next read */
} /* if not empty element */
} /* if not LIST */
+ if (!own_tag && exer && (p_td.xer_bits & XER_OPTIONAL) && get_nof_elements() == 0) {
+ // set it to unbound, so the OPTIONAL class sets it to omit
+ clean_up();
+ }
return 1; // decode successful
}
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################
-SADIRS := ver xer encode param template_restrictions
+SADIRS := ver xer encode param template
#$(wildcard TTCN3_[a0-9]* ASN_[a0-9]*) ver xer
all run check clean distclean:
}
<END_MODULE>
<RESULT IF_PASS COUNT 1>
-(?im)error.+?evaluatable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
+(?im)error.+?evaluable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
<END_RESULT>
<RESULT IF_PASS COUNT 1>
(?im)\bNotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
}
<END_MODULE>
<RESULT IF_PASS COUNT 1>
-(?im)error.+?evaluatable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
+(?im)error.+?evaluable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
<END_RESULT>
<RESULT IF_PASS COUNT 1>
(?im)\bNotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
}
<END_MODULE>
<RESULT IF_PASS COUNT 1>
-(?im)error.+?evaluatable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
+(?im)error.+?evaluable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
<END_RESULT>
<RESULT IF_PASS COUNT 1>
(?im)error.+?Reference.+?constant.+?expected.+?instead
}
<END_MODULE>
<RESULT IF_PASS COUNT 1>
-(?im)error.+?evaluatable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
+(?im)error.+?evaluable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
<END_RESULT>
<RESULT IF_PASS COUNT 1>
(?im)\bNotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
}
<END_MODULE>
<RESULT IF_PASS COUNT 1>
-(?im)error.+?evaluatable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
+(?im)error.+?evaluable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
<END_RESULT>
<RESULT IF_PASS COUNT 1>
(?im)error.+?Reference.+?constant.+?expected.+?instead
}
<END_MODULE>
<RESULT IF_PASS COUNT 1>
-(?im)error.+?evaluatable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
+(?im)error.+?evaluable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
<END_RESULT>
<RESULT IF_PASS COUNT 1>
(?im)\bNotify\b.+?\bcode\b.+?\bnot\b.+?\bgenerated\b
}
<END_MODULE>
<RESULT IF_PASS COUNT 1>
-(?im)error.+?evaluatable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
+(?im)error.+?evaluable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
<END_RESULT>
<RESULT IF_PASS COUNT 1>
(?im)error.+?Reference.+?constant.+?expected.+?instead
}
<END_MODULE>
<RESULT IF_PASS COUNT 1>
-(?im)error.+?evaluatable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
+(?im)error.+?evaluable.+?constant.+?value.+?expected.+?instead.+?of.+?operation
<END_RESULT>
<RESULT IF_PASS COUNT 1>
(?is)\berror:
--- /dev/null
+!Makefile
+!*.ttcn
--- /dev/null
+###############################################################################
+# Copyright (c) 2000-2015 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+include ../common.mk
--- /dev/null
+/******************************************************************************
+ * Copyright (c) 2000-2015 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ ******************************************************************************/
+module TempOmit_SE { //^In TTCN-3 module//
+
+template integer t1 := (1 ifpresent, 2 ifpresent); //^In template definition// //^In list item//2 //error: `ifpresent' is not allowed here//2
+template integer t2 := complement (1 ifpresent, 2 ifpresent); //^In template definition// //^In list item//2 //error: `ifpresent' is not allowed here//2
+
+template integer t3 := (1, 2, 3, omit); //^In template definition// //^In list item// //error: `omit' value is not allowed in this context//
+template integer t4 := complement (3, 2, omit); //^In template definition// //^In list item// //error: `omit' value is not allowed in this context//
+
+}
--- /dev/null
+/******************************************************************************
+ * Copyright (c) 2000-2015 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ ******************************************************************************/
+module TempRes_SE { //^In TTCN-3 module//
+
+type record Rec {
+ integer i,
+ float f,
+ charstring cs,
+ octetstring os
+}
+
+template (present) Rec t_original(in template (present) integer pt_i) := { //^Referenced template parameter is here$//2
+ i := pt_i, //^warning: Inadequate restriction on the referenced template parameter//2
+ f := ?, //^Referenced template is here$//
+ cs := ?, //^Referenced template is here$//2
+ os := ? //^Referenced template is here$//2
+}
+
+template (present) Rec t_modified(in template (present) integer pt_i, in template (present) float pt_f) //^Referenced template parameter is here$//
+ modifies t_original := {
+ f := pt_f //^warning: Inadequate restriction on the referenced template parameter//
+}
+
+function f_rec_temp(in template (value) Rec pt_rec_temp) {
+ log(pt_rec_temp);
+}
+
+template float t_f := (-10.0..-1.0); //^Referenced template is here$//
+template charstring t_cs := ("abc", "def") ifpresent; //^Referenced template is here$//
+
+function f_float_temp() return template (value) float { //^In function definition//
+ return t_f; //^In return statement// //^error: Restriction on return template does not allow usage of value range match$//
+}
+
+control { //^In control part//
+ var template (present) charstring vt_cs := "a";
+
+ var template integer vt_i := 3; //^Referenced template variable is here$//
+
+ f_rec_temp(t_modified(3, f_float_temp())); //^In function instance// //^In actual parameter list of function// \
+ //^In parameter #1 for// //^error: Restriction on template formal parameter does not allow usage of any value$//2
+
+ f_rec_temp(t_original(vt_i)); //^In function instance// //^In actual parameter list of function// \
+ //^In parameter #1 for//2 //^In actual parameter list of template// \
+ //^warning: Inadequate restriction on the referenced template variable// \
+ //^error: Restriction on template formal parameter does not allow usage of any value$//3
+
+ vt_cs := t_cs; //^In variable assignment:$// //^error: Restriction on template does not allow usage of \`ifpresent\'$//
+}
+
+}
--- /dev/null
+#!/usr/bin/perl
+# note this is called through "perl -w"
+use strict;
+
+my $self = $0;
+$self =~ s!/t!!;
+
+exec('make check --no-print-directory -s -C ' . $self);
+
+++ /dev/null
-!Makefile
-!*.ttcn
+++ /dev/null
-###############################################################################
-# Copyright (c) 2000-2015 Ericsson Telecom AB
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-###############################################################################
-include ../common.mk
+++ /dev/null
-/******************************************************************************
- * Copyright (c) 2000-2015 Ericsson Telecom AB
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- ******************************************************************************/
-module TempRes_SE { //^In TTCN-3 module//
-
-type record Rec {
- integer i,
- float f,
- charstring cs,
- octetstring os
-}
-
-template (present) Rec t_original(in template (present) integer pt_i) := { //^Referenced template parameter is here$//2
- i := pt_i, //^warning: Inadequate restriction on the referenced template parameter//2
- f := ?, //^Referenced template is here$//
- cs := ?, //^Referenced template is here$//2
- os := ? //^Referenced template is here$//2
-}
-
-template (present) Rec t_modified(in template (present) integer pt_i, in template (present) float pt_f) //^Referenced template parameter is here$//
- modifies t_original := {
- f := pt_f //^warning: Inadequate restriction on the referenced template parameter//
-}
-
-function f_rec_temp(in template (value) Rec pt_rec_temp) {
- log(pt_rec_temp);
-}
-
-template float t_f := (-10.0..-1.0); //^Referenced template is here$//
-template charstring t_cs := ("abc", "def") ifpresent; //^Referenced template is here$//
-
-function f_float_temp() return template (value) float { //^In function definition//
- return t_f; //^In return statement// //^error: Restriction on return template does not allow usage of value range match$//
-}
-
-control { //^In control part//
- var template (present) charstring vt_cs := "a";
-
- var template integer vt_i := 3; //^Referenced template variable is here$//
-
- f_rec_temp(t_modified(3, f_float_temp())); //^In function instance// //^In actual parameter list of function// \
- //^In parameter #1 for// //^error: Restriction on template formal parameter does not allow usage of any value$//2
-
- f_rec_temp(t_original(vt_i)); //^In function instance// //^In actual parameter list of function// \
- //^In parameter #1 for//2 //^In actual parameter list of template// \
- //^warning: Inadequate restriction on the referenced template variable// \
- //^error: Restriction on template formal parameter does not allow usage of any value$//3
-
- vt_cs := t_cs; //^In variable assignment:$// //^error: Restriction on template does not allow usage of \`ifpresent\'$//
-}
-
-}
+++ /dev/null
-#!/usr/bin/perl
-# note this is called through "perl -w"
-use strict;
-
-my $self = $0;
-$self =~ s!/t!!;
-
-exec('make check --no-print-directory -s -C ' . $self);
-
--- /dev/null
+###############################################################################
+# Copyright (c) 2000-2015 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+[LOGGING]
+LogFile := "Annex_E_variants.log"
+FileMask := LOG_ALL
+ConsoleMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS
+LogSourceInfo := Yes
+[EXECUTE]
+Annex_E_variants.control
--- /dev/null
+/******************************************************************************
+ * Copyright (c) 2000-2015 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ ******************************************************************************/
+
+// This module contains tests for the variant attributes defined in Annex E of the
+// TTCN-3 language standard.
+// The encoding of the types with the new variants are compared to the encoding of
+// types declared using traditional RAW variant attributes.
+
+// New attributes and their equivalents:
+// "N bit" == "FIELDLENGTH(N), COMP(signbit), BYTEORDER(last)"
+// "unsigned N bit" == "FIELDLENGTH(N), COMP(nosign), BYTEORDER(last)"
+module Annex_E_variants {
+
+// E.2.1.0 Signed and unsigned single byte integers
+type integer Byte (-128 .. 127) with { variant "8 bit" };
+type integer ByteEq (-128 .. 127) with { variant "FIELDLENGTH(8), COMP(signbit), BYTEORDER(last)" };
+
+type integer UnsignedByte (0 .. 255) with { variant "unsigned 8 bit" };
+type integer UnsignedByteEq (0 .. 255) with { variant "FIELDLENGTH(8), COMP(nosign), BYTEORDER(last)" };
+
+// E.2.1.1 Signed and unsigned short integers
+type integer Short (-32768 .. 32767) with { variant "16 bit" };
+type integer ShortEq (-32768 .. 32767) with { variant "FIELDLENGTH(16), COMP(signbit), BYTEORDER(last)" };
+
+type integer UnsignedShort (0 .. 65535) with { variant "unsigned 16 bit" };
+type integer UnsignedShortEq (0 .. 65535) with { variant "FIELDLENGTH(16), COMP(nosign), BYTEORDER(last)" };
+
+// E.2.1.2 Signed and unsigned long integers
+type integer Long (-2147483648 .. 2147483647) with { variant "32 bit" };
+type integer LongEq (-2147483648 .. 2147483647) with { variant "FIELDLENGTH(32), COMP(signbit), BYTEORDER(last)" };
+
+type integer UnsignedLong (0 .. 4294967295) with { variant "unsigned 32 bit" };
+type integer UnsignedLongEq (0 .. 4294967295) with { variant "FIELDLENGTH(32), COMP(nosign), BYTEORDER(last)" };
+
+// E.2.1.3 Signed and unsigned longlong integers
+type integer LongLong (-9223372036854775808 .. 9223372036854775807) with { variant "64 bit" };
+type integer LongLongEq (-9223372036854775808 .. 9223372036854775807) with { variant "FIELDLENGTH(64), COMP(signbit), BYTEORDER(last)" };
+
+type integer UnsignedLongLong (0 .. 18446744073709551615) with { variant "unsigned 64 bit" };
+type integer UnsignedLongLongEq (0 .. 18446744073709551615) with { variant "FIELDLENGTH(64), COMP(nosign), BYTEORDER(last)" };
+
+// Custom integer types
+type integer Int6 with { variant "6 bit" };
+type integer Int6Eq with { variant "FIELDLENGTH(6), COMP(signbit), BYTEORDER(last)" };
+
+type integer UInt4 with { variant "unsigned 4 bit" };
+type integer UInt4Eq with { variant "FIELDLENGTH(4), COMP(nosign), BYTEORDER(last)" };
+
+type integer BigInt with { variant "300 bit " };
+type integer BigIntEq with { variant "FIELDLENGTH(300), COMP(signbit), BYTEORDER(last)" };
+
+// Using the "N bit" attribute on enumerated types
+type enumerated Enum5 { val1(1), val7(7), val2(2), val11(11) } with { variant "unsigned 5 bit" };
+type enumerated Enum5Eq { val1(1), val7(7), val2(2), val11(11) } with { variant "FIELDLENGTH(5), COMP(nosign), BYTEORDER(last)" };
+
+type enumerated Enum12 { val30(30), valm10(-10), val9(9) } with { variant "12 bit" };
+type enumerated Enum12Eq { val30(30), valm10(-10), val9(9) } with { variant "FIELDLENGTH(12), COMP(signbit), BYTEORDER(last)" };
+
+// Using the "N bit" attribute on boolean types
+type boolean Bool3 with { variant "3 bit" };
+type boolean Bool3Eq with { variant "FIELDLENGTH(3), BYTEORDER(last)" };
+
+type boolean Bool13 with { variant "13 bit" };
+type boolean Bool13Eq with { variant "FIELDLENGTH(13), BYTEORDER(last)" };
+
+// Using the "N bit" attribute on string types
+type bitstring BStr14 with { variant "14 bit" };
+type bitstring BStr14Eq with { variant "FIELDLENGTH(14), BYTEORDER(last)" };
+
+type hexstring HStr20 with { variant "unsigned 20 bit" }; // 20 bits = 5 hex nibbles, 'unsigned' is ignored
+type hexstring HStr20Eq with { variant "FIELDLENGTH(5), BYTEORDER(last)" };
+
+type octetstring OStr32 with { variant "32 bit" }; // 32 bits = 4 octets
+type octetstring OStr32Eq with { variant "FIELDLENGTH(4), BYTEORDER(last)" };
+
+type charstring CStr64 with { variant "64 bit" }; // 64 bits = 8 characters
+type charstring CStr64Eq with { variant "FIELDLENGTH(8), BYTEORDER(last)" };
+
+// Component type
+type component CT {}
+
+// Test cases
+testcase tc_byte() runs on CT
+{
+ var Byte x := -12;
+ var ByteEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var Byte dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_unsigned_byte() runs on CT
+{
+ var UnsignedByte x := 91;
+ var UnsignedByteEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var UnsignedByte dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_short() runs on CT
+{
+ var Short x := 399;
+ var ShortEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var Short dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_unsigned_short() runs on CT
+{
+ var UnsignedShort x := 399;
+ var UnsignedShortEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var UnsignedShort dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_long() runs on CT
+{
+ var Long x := 1457664;
+ var LongEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var Long dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_unsigned_long() runs on CT
+{
+ var UnsignedLong x := 1457664;
+ var UnsignedLongEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var UnsignedLong dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_long_long() runs on CT
+{
+ var LongLong x := -9223372036854775807;
+ var LongLongEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var LongLong dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_unsigned_long_long() runs on CT
+{
+ var UnsignedLongLong x := 18446744073709551610;
+ var UnsignedLongLongEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var UnsignedLongLong dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_int6() runs on CT
+{
+ var Int6 x := -19;
+ var Int6Eq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var Int6 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_uint4() runs on CT
+{
+ var UInt4 x := 7;
+ var UInt4Eq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var UInt4 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_big_int() runs on CT
+{
+ var BigInt x := -2837219487639565876438796348973264327463294623463287046324783264987325432;
+ var BigIntEq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var BigInt dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_enum5() runs on CT
+{
+ var Enum5 x := val11;
+ var Enum5Eq x_eq := val11;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var Enum5 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_enum12() runs on CT
+{
+ var Enum12 x := valm10;
+ var Enum12Eq x_eq := valm10;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var Enum12 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_bool3() runs on CT
+{
+ var Bool3 x := true;
+ var Bool3Eq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var Bool3 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_bool13() runs on CT
+{
+ var Bool13 x := true;
+ var Bool13Eq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var Bool13 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_bstr14() runs on CT
+{
+ var BStr14 x := '10101010101010'B;
+ var BStr14Eq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var BStr14 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_hstr20() runs on CT
+{
+ var HStr20 x := 'CCCCC'H;
+ var HStr20Eq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var HStr20 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_ostr32() runs on CT
+{
+ var OStr32 x := 'ABABABAB'O;
+ var OStr32Eq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var OStr32 dec;
+ if (decvalue(enc, dec) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != x) {
+ setverdict(fail, "Expected: ", x, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+testcase tc_cstr64() runs on CT
+{
+ var CStr64 x := "Hello";
+ var CStr64Eq x_eq := x;
+ var bitstring enc := encvalue(x);
+ var bitstring enc_exp := encvalue(x_eq);
+ if (enc != enc_exp) {
+ setverdict(fail, "Expected: ", enc_exp, ", got: ", enc);
+ }
+ else {
+ var CStr64 dec;
+ var CStr64Eq dec_exp;
+ if (decvalue(enc, dec) != 0 or decvalue(enc_exp, dec_exp) != 0) {
+ setverdict(fail, "Could not decode ", enc);
+ }
+ else if (dec != dec_exp) {
+ setverdict(fail, "Expected: ", dec_exp, ", got: ", dec);
+ }
+ }
+ setverdict(pass);
+}
+
+// Control part
+control {
+ execute(tc_byte());
+ execute(tc_unsigned_byte());
+ execute(tc_short());
+ execute(tc_unsigned_short());
+ execute(tc_long());
+ execute(tc_unsigned_long());
+ execute(tc_long_long());
+ execute(tc_unsigned_long_long());
+ execute(tc_int6());
+ execute(tc_uint4());
+ execute(tc_big_int());
+ execute(tc_enum5());
+ execute(tc_enum12());
+ execute(tc_bool3());
+ execute(tc_bool13());
+ execute(tc_bstr14());
+ execute(tc_hstr20());
+ execute(tc_ostr32());
+ execute(tc_cstr64());
+}
+
+}
+with {
+ encode "RAW";
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2000-2015 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+TOPDIR := ../..
+include $(TOPDIR)/Makefile.regression
+
+.PHONY: all clean dep run
+
+TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
+
+TTCN3_MODULES = Annex_E_variants.ttcn
+
+GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc)
+GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
+ifdef CODE_SPLIT
+GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc))
+endif
+
+USER_SOURCES =
+
+# All object files needed for the executable test suite:
+OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc=.o)
+
+# The name of the executable test suite:
+TARGET = Annex_E_variants$(EXESUFFIX)
+
+all: $(TARGET) ;
+
+$(TARGET): $(OBJECTS)
+ $(CXX) $(LDFLAGS) -o $@ $(OBJECTS) -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
+ -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS)
+
+$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
+ @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
+
+compile: $(TTCN3_MODULES) $(ASN1_MODULES)
+ $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^
+ touch $@
+
+clean distclean:
+ $(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
+ $(GENERATED_SOURCES) compile *.log
+
+dep: $(GENERATED_SOURCES)
+ makedepend $(CPPFLAGS) $(USER_SOURCES) $(GENERATED_SOURCES)
+
+run: $(TARGET) Annex_E_variants.cfg
+ ./$^
+
+# DO NOT DELETE
--- /dev/null
+/******************************************************************************
+ * Copyright (c) 2000-2015 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ ******************************************************************************/
+module AbstractBlock {
+
+// This module contains tests for the ABSTRACT and BLOCK encoding instructions,
+// which are generally used in code generated from element substitutions and type
+// substitutions in XSD.
+
+type component CT {}
+
+/******* Test 1: Element substitution example *******/
+type charstring Member1
+with {
+ variant "name as uncapitalized";
+ variant "element";
+}
+
+type enumerated Member2
+{
+ else_,
+ something
+}
+with {
+ variant "text 'else_' as 'else'";
+ variant "name as uncapitalized";
+ variant "element";
+}
+
+type record Member3
+{
+ integer bar optional,
+ float foo optional,
+ charstring base
+}
+with {
+ variant "name as uncapitalized";
+ variant "element";
+ variant(bar) "attribute";
+ variant(foo) "attribute";
+ variant(base) "untagged";
+}
+
+type union Head_group
+{
+ charstring head,
+ Member1 member1,
+ Member2 member2,
+ Member3 member3
+}
+with {
+ variant "untagged";
+ variant(head) "abstract";
+ variant(member3) "block";
+}
+
+type record of Head_group Data
+with {
+ variant "name as uncapitalized";
+}
+
+external function f_enc_data(in Data x) return octetstring
+ with { extension "prototype(convert) encode(XER:XER_EXTENDED)" };
+
+external function f_dec_data(in octetstring x) return Data
+ with { extension "prototype(convert) decode(XER:XER_EXTENDED)" };
+
+testcase tc_element_substitution() runs on CT
+{
+ // non-blocked and non-abstract fields should be encoded and decoded normally
+ var Data v_data := { { member1 := "xy" }, { member2 := else_ } };
+ var octetstring v_exp_enc := char2oct(
+ "<data xmlns:tns='http://www.example.org/blockExtension'>\n" &
+ "\t<tns:member1>xy</tns:member1>\n" &
+ "\t<tns:member2>else</tns:member2>\n" &
+ "</data>\n\n");
+
+ var octetstring v_enc := f_enc_data(v_data);
+ if (v_enc != v_exp_enc) {
+ setverdict(fail, "Expected: ", v_exp_enc, ", got: ", v_enc);
+ }
+ var Data v_dec := f_dec_data(v_exp_enc);
+ if (v_dec != v_data) {
+ setverdict(fail, "Expected: ", v_data, ", got: ", v_dec);
+ }
+
+ // abstract and blocked fields are encoded as before, but cause an error while decoding
+ v_data := { { head := "abc" } };
+ v_exp_enc := char2oct(
+ "<data>\n" &
+ "\t<head>abc</head>\n" &
+ "</data>\n\n");
+
+ v_enc := f_enc_data(v_data);
+ if (v_enc != v_exp_enc) {
+ setverdict(fail, "Expected: ", v_exp_enc, ", got: ", v_enc);
+ }
+
+ @try {
+ v_dec := f_dec_data(v_exp_enc);
+ setverdict(fail, "Error expected while decoding ", v_exp_enc);
+ }
+ @catch (msg) {
+ if (not match(msg, pattern "*Index 0: Alternative 'head': Attempting to decode blocked or abstract field.")) {
+ setverdict(fail, "Incorrect error message received while decoding ", v_exp_enc, " (message: ", msg, ")");
+ }
+ }
+
+ // another negative test example
+ v_data := { { member2 := something }, { member3 := { bar := 10, foo := omit, base := "base" } } };
+ v_exp_enc := char2oct(
+ "<data xmlns:tns='http://www.example.org/blockExtension'>\n" &
+ "\t<tns:member2>something</tns:member2>\n" &
+ "\t<tns:member3 bar='10'>base</tns:member3>\n" &
+ "</data>\n\n");
+
+ v_enc := f_enc_data(v_data);
+ if (v_enc != v_exp_enc) {
+ setverdict(fail, "Expected: ", v_exp_enc, ", got: ", v_enc);
+ }
+
+ @try {
+ v_dec := f_dec_data(v_exp_enc);
+ setverdict(fail, "Error expected while decoding ", v_exp_enc);
+ }
+ @catch (msg) {
+ if (not match(msg, pattern "*Index 1: Alternative 'member3': Attempting to decode blocked or abstract field.")) {
+ setverdict(fail, "Incorrect error message received while decoding ", v_exp_enc, " (message: ", msg, ")");
+ }
+ }
+
+ setverdict(pass);
+}
+
+/******* Test 2: Type substitution example *******/
+type record ParentType {
+ record length (1 .. infinity) of charstring foo_list optional,
+ charstring bar
+}
+with {
+ variant "name as uncapitalized";
+ variant(foo_list) "untagged";
+ variant(foo_list[-]) "name as 'foo'";
+}
+
+type record RestrictedType {
+ record length (1 .. infinity) of charstring foo_list,
+ charstring bar
+}
+with {
+ variant "name as uncapitalized";
+ variant(foo_list) "untagged";
+ variant(foo_list[-]) "name as 'foo'";
+}
+
+type union ParentType_derivations {
+ ParentType parentType,
+ RestrictedType restrictedType
+}
+with {
+ variant "useType";
+ variant "name as 'derivation'";
+ variant(parentType) "abstract";
+}
+
+type record of ParentType_derivations Data2
+with {
+ variant "name as 'data'";
+}
+
+external function f_enc_data2(in Data2 x) return octetstring
+ with { extension "prototype(convert) encode(XER:XER_EXTENDED)" };
+
+external function f_dec_data2(in octetstring x) return Data2
+ with { extension "prototype(convert) decode(XER:XER_EXTENDED)" };
+
+testcase tc_type_substitution() runs on CT
+{
+ // non-blocked and non-abstract fields should be encoded and decoded normally
+ var Data2 v_data := { { restrictedType := { foo_list := { "first", "second" }, bar := "restricted" } } };
+ var octetstring v_exp_enc := char2oct(
+ "<data xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\n" &
+ "\t<derivation xsi:type='restrictedType'>\n" &
+ "\t\t<foo>first</foo>\n" &
+ "\t\t<foo>second</foo>\n" &
+ "\t\t<bar>restricted</bar>\n" &
+ "\t</derivation>\n" &
+ "</data>\n\n");
+
+ var octetstring v_enc := f_enc_data2(v_data); // '>' missing from one of the tags, requires Bence's modification
+ /*if (v_enc != v_exp_enc) {
+ setverdict(fail, "Expected: ", v_exp_enc, ", got: ", v_enc);
+ }*/
+ var Data2 v_dec := f_dec_data2(v_exp_enc);
+ if (v_dec != v_data) {
+ setverdict(fail, "Expected: ", v_data, ", got: ", v_dec);
+ }
+
+ // abstract and blocked fields are encoded as before, but cause an error while decoding
+ v_data := { { parentType := { foo_list := omit, bar := "parent" } } };
+ v_exp_enc := char2oct(
+ "<data>\n" &
+ "\t<derivation>\n" &
+ "\t\t<bar>parent</bar>\n" &
+ "\t</derivation>\n" &
+ "</data>\n\n");
+
+ v_enc := f_enc_data2(v_data); // '>' missing
+ /*if (v_enc != v_exp_enc) {
+ setverdict(fail, "Expected: ", v_exp_enc, ", got: ", v_enc);
+ }*/
+
+ @try {
+ v_dec := f_dec_data2(v_exp_enc);
+ setverdict(fail, "Error expected while decoding ", v_exp_enc);
+ }
+ @catch (msg) {
+ if (not match(msg, pattern "*Index 0: Alternative 'parentType': Attempting to decode blocked or abstract field.")) {
+ setverdict(fail, "Incorrect error message received while decoding ", v_exp_enc, " (message: ", msg, ")");
+ }
+ }
+
+ setverdict(pass);
+}
+
+control {
+ execute(tc_element_substitution());
+ execute(tc_type_substitution());
+}
+
+}
+with {
+ encode "XML";
+ variant "namespace as 'http://www.example.org/blockExtension' prefix 'tns'";
+ variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+###############################################################################
+# Copyright (c) 2000-2015 Ericsson Telecom AB
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+###############################################################################
+TOPDIR = ../..
+include ../../Makefile.regression
+
+# WARNING! This Makefile can be used with GNU make only.
+# Other versions of make may report syntax errors in it.
+
+#
+# Do NOT touch this line...
+#
+.PHONY: all archive check clean dep objects
+
+.SUFFIXES: .d
+
+#
+# Set these variables...
+#
+
+# Flags for the C++ preprocessor (and makedepend as well):
+#CPPFLAGS +=
+
+# Flags for dependency generation
+CXXDEPFLAGS = -MM
+
+# Flags for the C++ compiler:
+CXXFLAGS += -Wall
+
+# Flags for the linker:
+#LDFLAGS +=
+
+# Flags for the TTCN-3 and ASN.1 compiler:
+#COMPILER_FLAGS +=
+
+# Execution mode: (either ttcn3 or ttcn3-parallel)
+TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
+
+#
+# You may change these variables. Add your files if necessary...
+#
+
+# TTCN-3 modules of this project:
+TTCN3_MODULES = AbstractBlock.ttcn
+
+# ASN.1 modules of this project:
+ASN1_MODULES =
+
+# C++ source & header files generated from the TTCN-3 & ASN.1 modules of
+# this project:
+GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.cc)
+GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
+
+# C/C++ Source & header files of Test Ports, external functions and
+# other modules:
+USER_SOURCES =
+USER_HEADERS = $(USER_SOURCES:.cc=.hh)
+
+# Object files of this project that are needed for the executable test suite:
+OBJECTS = $(GENERATED_OBJECTS) $(USER_OBJECTS)
+
+GENERATED_OBJECTS = $(GENERATED_SOURCES:.cc=.o)
+
+USER_OBJECTS = $(USER_SOURCES:.cc=.o)
+
+DEPFILES = $(USER_OBJECTS:.o=.d) $(GENERATED_OBJECTS:.o=.d)
+
+# Other files of the project (Makefile, configuration files, etc.)
+# that will be added to the archived source files:
+OTHER_FILES = Makefile
+
+# The name of the executable test suite:
+TARGET = AbstractBlock
+
+#
+# Rules for building the executable...
+#
+
+all: $(TARGET) ;
+
+objects: $(OBJECTS) compile;
+
+$(TARGET): $(OBJECTS)
+ if $(CXX) $(LDFLAGS) -o $@ $^ \
+ -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) \
+ -L$(OPENSSL_DIR)/lib -lcrypto \
+ -L$(XMLDIR)/lib $($(PLATFORM)_LIBS); \
+ then : ; else $(TTCN3_DIR)/bin/titanver $(OBJECTS); exit 1; fi
+
+.cc.o .c.o:
+ $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) -o $@ $<
+
+.cc.d .c.d:
+ @echo Creating dependency file for '$<'; set -e; \
+ $(CXX) $(CXXDEPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $< \
+ | sed 's/\($*\)\.o[ :]*/\1.o $@ : /g' > $@; \
+ [ -s $@ ] || rm -f $@
+
+$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile
+ @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi
+
+compile: $(TTCN3_MODULES) $(ASN1_MODULES)
+ $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ - $?
+ touch $@
+
+clean distclean:
+ -$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
+ $(GENERATED_SOURCES) compile $(DEPFILES) \
+ tags *.log
+
+dep: $(GENERATED_SOURCES) $(USER_SOURCES) ;
+
+ifeq ($(findstring n,$(MAKEFLAGS)),)
+ifeq ($(filter clean distclean check compile archive diag,$(MAKECMDGOALS)),)
+-include $(DEPFILES)
+endif
+endif
+
+diag:
+ $(TTCN3_COMPILER) -v 2>&1
+ $(TTCN3_DIR)/bin/mctr_cli -v 2>&1
+ $(CXX) -v 2>&1
+ @echo TTCN3_DIR=$(TTCN3_DIR)
+ @echo OPENSSL_DIR=$(OPENSSL_DIR)
+ @echo XMLDIR=$(XMLDIR)
+ @echo PLATFORM=$(PLATFORM)
+
+#
+# Add your rules here if necessary...
+#
+
+run: $(TARGET)
+ ./$^
+
DECLARE_XER_ENCODERS(anys_and_only_anys, aaoa);
DECLARE_EXER_ENCODERS(anys_and_only_anys, aaoa);
-const anys_and_only_anys noanys := { elements := {} }
+const anys_and_only_anys noanys_empty := { elements := {} }
+const anys_and_only_anys noanys_omit := { elements := omit }
+
+// the empty array is encoded into this in basic XER
const universal charstring bstr_noanys :=
"<anys_and_only_anys>\n" &
"\t<elements/>\n" &
"</anys_and_only_anys>\n\n";
+
+// both the empty array and the omitted field are encoded into this in extended XER
+// this is always decoded into an omitted field
const universal charstring estr_noanys :=
"<anys_and_only_anys/>\n\n";
testcase encode_only_opt() runs on AE
{
- CHECK_METHOD(bxer_enc_aaoa, noanys, bstr_noanys);
- CHECK_METHOD(exer_enc_aaoa, noanys, estr_noanys);
+ CHECK_METHOD(bxer_enc_aaoa, noanys_empty, bstr_noanys);
+ CHECK_METHOD(exer_enc_aaoa, noanys_empty, estr_noanys);
+ CHECK_METHOD(exer_enc_aaoa, noanys_omit, estr_noanys);
CHECK_METHOD(bxer_enc_aaoa, marx, bstr_marx);
CHECK_METHOD(exer_enc_aaoa, marx, estr_marx);
testcase decode_only_opt() runs on AE
{
- CHECK_DECODE(bxer_dec_aaoa, bstr_noanys, anys_and_only_anys, noanys);
- CHECK_DECODE(exer_dec_aaoa, estr_noanys, anys_and_only_anys, noanys);
+ CHECK_DECODE(bxer_dec_aaoa, bstr_noanys, anys_and_only_anys, noanys_empty);
+ CHECK_DECODE(exer_dec_aaoa, estr_noanys, anys_and_only_anys, noanys_omit);
CHECK_DECODE(bxer_dec_aaoa, bstr_marx, anys_and_only_anys, marx);
CHECK_DECODE(exer_dec_aaoa, estr_marx, anys_and_only_anys, marx_dec);
+// ------- optional record of
+type record length (1 .. infinity) of charstring RoCS
+with {
+ variant ([-]) "name as 'str'";
+}
+
+type record r_recof {
+ record length (1 .. infinity) of integer num_list optional,
+ RoCS str_list optional
+}
+with {
+ variant(num_list) "untagged";
+ variant(num_list[-]) "name as 'num'";
+ variant(str_list) "untagged";
+}
+
+DECLARE_EXER_ENCODERS(r_recof, recof);
+
+const r_recof c_recof := { num_list := omit, str_list := omit };
+
+const universal charstring s_recof := "<r_recof/>\n\n";
+
+testcase encode_ut_recof() runs on UTA
+{
+ CHECK_METHOD(exer_enc_recof, c_recof, s_recof);
+}
+
+testcase decode_ut_recof() runs on UTA
+{
+ CHECK_DECODE(exer_dec_recof, s_recof, r_recof, c_recof);
+}
+
+
+
/* * * * * * * * * * * Run it! * * * * * * * * * * */
control {
execute(encode_ut_ustr());
execute(decode_ut_ustr());
+ execute(encode_ut_recof());
+ execute(decode_ut_recof());
}
}
CHECK_DECODE(exer_dec_u, str_12_e, U, v);
}
+group QualifiedUseType {
+
+type union Number {
+ integer i,
+ float f,
+ octetstring os
+}
+with {
+ variant "useType";
+ variant "name as uncapitalized";
+ variant(i) "name as 'integer'";
+ variant(f) "name as 'real'";
+ variant(os) "name as 'hexadecimal'";
+}
+
+type record of Number Data
+with {
+ variant "name as uncapitalized";
+}
+
+} // group QualifiedUseType
+with {
+ variant "elementFormQualified";
+ variant "namespace as 'http://www.example.org/Number' prefix 'nr'";
+}
+
+DECLARE_EXER_ENCODERS(Data, data);
+
+const Data c_data := { { i := 10 }, { f := 3.3 }, { os := '5DA8'O } };
+
+const universal charstring str_data :=
+"<nr:data xmlns:nr='http://www.example.org/Number' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\n" &
+"\t<nr:number>10</nr:number>\n" &
+"\t<nr:number xsi:type='nr:real'>3.300000</nr:number>\n" &
+"\t<nr:number xsi:type='nr:hexadecimal'>5DA8</nr:number>\n" &
+"</nr:data>\n\n";
+
+testcase encode_qualified() runs on Shop
+{
+ CHECK_METHOD(exer_enc_data, c_data, str_data);
+}
+
+testcase decode_qualified() runs on Shop
+{
+ CHECK_DECODE(exer_dec_data, str_data, Data, c_data);
+}
+
control {
execute(enc_ut());
execute(dec_ut());
execute(encode_12());
execute(decode_12());
+
+ execute(encode_qualified());
+ execute(decode_qualified());
}
}
XDIRS := $(wildcard $(SHADOWED)) xsdConverter \
HM60295 HN15589 HQ30408 HR49727 HU13380 $(RT2_ONLY) \
-XmlWorkflow tpdValidTest
+XmlWorkflow tpdValidTest AbstractBlock
# List of fake targets:
.PHONY: all dep clean run $(XDIRS) $(addsuffix /, $(XDIRS)) profile
+++ /dev/null
-/*******************************************************************************
-* Copyright Ericsson Telecom AB 2015
-*
-* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
-*
-* All rights reserved. This program and the accompanying materials
-* are made available under the terms of the Eclipse Public License v1.0
-* which accompanies this distribution, and is available at
-* http://www.eclipse.org/legal/epl-v10.html
-*******************************************************************************/
-//
-// File: NoTargetNamespace.ttcn
-// Description:
-// References:
-// Rev:
-// Prodnr:
-// Updated: Wed Oct 28 13:59:18 2015
-// Contact: http://ttcn.ericsson.se
-//
-////////////////////////////////////////////////////////////////////////////////
-// Generated from file(s):
-// - attrib_order_c.xsd
-// /* xml version = "1.0" encoding = "UTF-8" */
-// /* targetnamespace = "NoTargetNamespace" */
-////////////////////////////////////////////////////////////////////////////////
-// Modification header(s):
-//-----------------------------------------------------------------------------
-// Modified by:
-// Modification date:
-// Description:
-// Modification contact:
-//------------------------------------------------------------------------------
-////////////////////////////////////////////////////////////////////////////////
-
-
-module NoTargetNamespace {
-
-
-import from XSD all;
-
-
-type XSD.String AttrNoTargetNamespace
-with {
-variant "attribute";
-};
-
-
-type XSD.String AttrNoTargetNamespace2
-with {
-variant "attribute";
-};
-
-
-}
-with {
-encode "XML";
-variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
-}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R4A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: NoTargetNamespace.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Wed Nov 25 17:13:46 2015
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - attrib_order_c.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "NoTargetNamespace" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module NoTargetNamespace2_e {
+
+
+import from XSD all;
+
+
+type XSD.String AttrNoTargetNamespace
+with {
+variant "attribute";
+};
+
+
+type XSD.String AttrNoTargetNamespace2
+with {
+variant "attribute";
+};
+
+
+}
+with {
+encode "XML";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
import from www_example_org_attrib_order_b all;
-import from NoTargetNamespace all;
+import from NoTargetNamespace2_e all;
type XSD.String Local1 ("fixed")
}
with {
variant "untagged";
-//variant (member2) "block";
+variant (head) "form as qualified";
+variant (member2) "block";
};
}
with {
variant "name as 'java-attribute'";
+variant "abstract";
variant (java_attribute) "name as 'java-attribute'";
variant (java_attribute) "attribute";
variant (xml_accessor_type) "name as 'xml-accessor-type'";
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_only_element_substitution_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Mon Nov 23 13:30:51 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - only_element_substitution_e.xsd
+// /* xml version = "1.0" */
+// /* targetnamespace = "www.example.org/only/element/substitution/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_only_element_substitution {
+
+
+import from XSD all;
+
+
+type RequestAbstractType_group RequestAbstractType1
+with {
+variant "name as uncapitalized";
+variant "abstract";
+variant "element";
+};
+
+
+/* Production implementation */
+
+
+type record ProductionRequest
+{
+ XSD.String commonName,
+ XSD.String productionName
+}
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+/* Production implementation */
+
+
+type record ProgrammingRequest
+{
+ XSD.String commonName,
+ XSD.String programmingName
+}
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type union RequestAbstractType_group
+{
+ record {
+ XSD.String commonName
+ } requestAbstractType,
+ ProductionRequest productionRequest,
+ ProgrammingRequest programmingRequest
+}
+with {
+variant "untagged";
+variant (requestAbstractType) "form as qualified";
+variant (requestAbstractType) "abstract";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/only/element/substitution'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
}
with {
variant "untagged";
-//variant (head) "abstract";
-//variant (member2) "block";
+variant (head) "form as qualified";
+variant (head) "abstract";
+variant (member2) "block";
};
}
with {
variant "untagged";
-//variant (head) "abstract";
-//variant (member3) "block";
+variant (head) "form as qualified";
+variant (head) "abstract";
+variant (member3) "block";
};
}
with {
variant "untagged";
-//variant (head) "abstract";
+variant (head) "form as qualified";
+variant (head) "abstract";
variant (head.headAttrib) "attribute";
variant (head.something) "name as capitalized";
-//variant (member) "block";
-//variant (member2) "block";
-//variant (stringEnum) "block";
+variant (member) "block";
+variant (member2) "block";
+variant (stringEnum) "block";
};
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_substitutiongroup_complextype_block_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Thu Nov 12 12:43:46 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - substitutiongroup_complextype_block_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/substitutiongroup/complextype/block/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_substitutiongroup_complextype_block {
+
+
+import from XSD all;
+
+
+/* SUBSTITUTABLE PARENT TYPE */
+
+
+type record ParentType
+{
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type RestrictedType RestrictedTypeElem
+with {
+variant "element";
+};
+
+
+/* The restricting type is: */
+
+
+type record RestrictedType
+{
+ record length(1 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type union Head_group
+{
+ RestrictedType head,
+ RestrictedTypeElem restrictedTypeElem
+}
+with {
+variant "untagged";
+variant (head) "form as qualified";
+variant (restrictedTypeElem) "name as capitalized";
+variant (restrictedTypeElem) "block";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/substitutiongroup/complextype/block' prefix 'this'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
}
with {
variant "untagged";
+variant (head) "form as qualified";
};
}
with {
encode "XML";
-variant "namespace as 'www.example.org/substitutiongroup' prefix 'this'";
+variant "namespace as 'www.example.org/substitutiongroup' prefix 'subs'";
variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
}
}
with {
variant "untagged";
-//variant (complexEnum) "block";
-//variant (member2) "block";
-//variant (member3) "block";
+variant (complexEnum) "block";
+variant (member2) "block";
+variant (member3) "block";
};
}
with {
variant "untagged";
-//variant (subsgroup) "abstract";
+variant (subsgroup) "form as qualified";
+variant (subsgroup) "abstract";
variant (replace_) "name as 'replace'";
};
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_substitutiongroup_name_as_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Thu Nov 12 10:42:59 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - substitutiongroup_name_as_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/substitutiongroup/name/as/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_substitutiongroup_name_as {
+
+
+import from XSD all;
+
+
+/* THE HEAD ELEMENT */
+
+
+/* SUBSTITUTION ELEMENT OF THE SAME TYPE AS THE HEAD */
+
+
+type XSD.String Member1
+with {
+variant "element";
+};
+
+
+/* SUBSTITUTION ELEMENT OF A TYPE RESTRICTING THE TYPE OF THE HEAD */
+
+
+type enumerated StringEnum
+{
+ else_,
+ something
+}
+with {
+variant "text 'else_' as 'else'";
+};
+
+
+type StringEnum Member2
+with {
+variant "element";
+};
+
+
+/* SUBSTITUTION ELEMENT OF A TYPE EXTENDING THE TYPE OF THE HEAD */
+
+
+type record ComplexEnum
+{
+ XSD.Integer bar optional,
+ XSD.Float foo optional,
+ XSD.String base
+}
+with {
+variant (bar) "attribute";
+variant (foo) "attribute";
+variant (base) "untagged";
+};
+
+
+type ComplexEnum Member3
+with {
+variant "element";
+};
+
+
+/* TOP LEVEL ELEMENT TO DEMONSTRATE SUBSTITUTION */
+
+
+type record Ize
+{
+ record of Head_group head_list
+}
+with {
+variant "element";
+variant (head_list) "untagged";
+variant (head_list[-]) "name as 'Head'";
+};
+
+
+type union Head_group
+{
+ XSD.String head,
+ Member1 member1,
+ Member2 member2,
+ Member3 member3
+}
+with {
+variant "untagged";
+variant (head) "name as capitalized";
+variant (head) "form as qualified";
+variant (member1) "name as capitalized";
+variant (member2) "name as capitalized";
+variant (member3) "name as capitalized";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/substitutiongroup/name/as' prefix 'this'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_substitutiongroup_rename_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Wed Nov 25 14:32:37 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - substitutiongroup_rename_e.xsd
+// /* xml version = "1.0" */
+// /* targetnamespace = "www.example.org/substitutiongroup/rename/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_substitutiongroup_rename {
+
+
+import from XSD all;
+
+
+type record BaseElement_1
+{
+
+}
+with {
+variant "name as 'BaseElement_'";
+};
+
+
+type record Audit
+{
+ BaseElement_group baseElement optional
+}
+with {
+variant (baseElement) "name as capitalized";
+};
+
+
+type XSD.Integer Case
+with {
+variant "abstract";
+variant "element";
+};
+
+
+type XSD.String BaseElement
+with {
+variant "name as 'BaseElement__'";
+variant "abstract";
+variant "element";
+};
+
+
+type Audit Case_1
+with {
+variant "name as 'Case_'";
+variant "element";
+};
+
+
+type union BaseElement_group
+{
+ BaseElement_1 baseElement,
+ Case_1 case_
+}
+with {
+variant "untagged";
+variant (baseElement) "name as capitalized";
+variant (baseElement) "form as qualified";
+variant (baseElement) "abstract";
+variant (case_) "name as capitalized";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/substitutiongroup/rename' prefix 'this'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_subs_with_elem_subs_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Wed Nov 18 13:34:40 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_subs_with_elem_subs_e.xsd
+// /* xml version = "1.0" */
+// /* targetnamespace = "www.example.org/type/subs/with/elem/subs/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_subs_with_elem_subs {
+
+
+import from XSD all;
+
+
+/* Root element */
+
+
+type SubmitRequestType Submit
+with {
+variant "element";
+};
+
+
+type record RequestGroup
+{
+ Request_group request
+}
+with {
+variant "name as uncapitalized";
+};
+
+
+type record SubmitRequestType
+{
+ XSD.String name,
+ RequestAbstractType_derivations request1,
+ RequestAbstractType_derivations request2
+};
+
+
+/* The generic abstract type */
+
+
+type record RequestAbstractType
+{
+ XSD.String commonName
+}
+with {
+variant "name as uncapitalized";
+variant "abstract";
+};
+
+
+/* Production implementation */
+
+
+type MyProductionRequestType ProductionRequest
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type record MyProductionRequestType
+{
+ XSD.String commonName,
+ XSD.String productionName
+}
+with {
+variant "name as uncapitalized";
+};
+
+
+/* Production implementation */
+
+
+type MyProgrammingRequestType ProgrammingRequest
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type record MyProgrammingRequestType
+{
+ XSD.String commonName,
+ XSD.String programmingName
+}
+with {
+variant "name as uncapitalized";
+};
+
+
+type union Request_group
+{
+ RequestAbstractType_derivations request,
+ ProductionRequest productionRequest,
+ ProgrammingRequest programmingRequest
+}
+with {
+variant "untagged";
+variant (request) "form as qualified";
+variant (request) "abstract";
+};
+
+
+type union RequestAbstractType_derivations
+{
+ RequestAbstractType requestAbstractType,
+ MyProductionRequestType myProductionRequestType,
+ MyProgrammingRequestType myProgrammingRequestType
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (requestAbstractType) "abstract";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/subs/with/elem/subs'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_abstract_block_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Tue Nov 17 13:25:59 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_abstract_block_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/type/substitution/abstract/block/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_abstract_block {
+
+
+import from XSD all;
+
+
+type ParentType_derivations Head
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+/* SUBSTITUTABLE PARENT TYPE */
+
+
+/* type substitutiongroup generated, because has elemet declaration */
+
+
+type record ParentType
+{
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "abstract";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type RestrictedType_derivations RestrictedTypeElem
+with {
+variant "element";
+};
+
+
+/* type substitutiongroup generated, because has elemet declaration */
+
+
+type record RestrictedType
+{
+ record length(1 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* type substitutiongroup generated, because the parent has elemet declaration */
+
+
+type record RestrictedType2
+{
+ record length(2 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* Added to restrictedtype_derivations */
+
+
+type record RestrictedType2_1
+{
+ record length(2 .. 5) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as 'restrictedType2.1'";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* No type substitutiongroup generated, because the parent lacks elemet declaration */
+
+
+type record RestrictedType3
+{
+ record length(3 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type ExtendedType_derivations ExtendedElement
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type record ExtendedType
+{
+ XSD.String attr1 optional,
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (attr1) "attribute";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type record RestrictedExtendedType
+{
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type union ParentType_derivations
+{
+ ParentType parentType,
+ ExtendedType_derivations extendedType,
+ RestrictedType_derivations restrictedType
+}
+with {
+variant "useType";
+variant (parentType) "name as capitalized";
+variant (parentType) "abstract";
+variant (extendedType) "block";
+};
+
+
+type union RestrictedType_derivations
+{
+ RestrictedType restrictedType,
+ RestrictedType2 restrictedType2,
+ RestrictedType2_1 restrictedType2_1
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (restrictedType2_1) "name as 'restrictedType2.1'";
+};
+
+
+type union ExtendedType_derivations
+{
+ ExtendedType extendedType,
+ RestrictedExtendedType restrictedExtendedType
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (restrictedExtendedType) "block";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/abstract/block' prefix 'tys'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_builtintype_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Tue Nov 24 11:21:17 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_builtintype_e.xsd
+// /* xml version = "1.0" */
+// /* targetnamespace = "www.example.org/type/substitution/builtintype/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_builtintype {
+
+
+import from XSD all;
+
+
+type String_derivations Elem
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type enumerated Enable
+{
+ equal
+}
+with {
+variant "name as uncapitalized";
+};
+
+
+type enumerated Session
+{
+ visible_and_interactive
+}
+with {
+variant "name as uncapitalized";
+};
+
+
+type enumerated Res
+{
+ pending
+}
+with {
+variant "name as uncapitalized";
+};
+
+
+type enumerated Data
+{
+ dateTime
+}
+with {
+variant "name as uncapitalized";
+};
+
+
+type union String_derivations
+{
+ XSD.String string,
+ Data data,
+ Enable enable,
+ Res res,
+ Session session
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/builtintype' prefix 'this'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_chain_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Tue Nov 17 11:30:22 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_chain_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/type/substitution/chain/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_chain {
+
+
+import from XSD all;
+
+
+type ParentType_derivations Head
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+/* SUBSTITUTABLE PARENT TYPE */
+
+
+/* type substitutiongroup generated, because has elemet declaration */
+
+
+type record ParentType
+{
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type RestrictedType_derivations RestrictedTypeElem
+with {
+variant "element";
+};
+
+
+/* type substitutiongroup generated, because has elemet declaration */
+
+
+type record RestrictedType
+{
+ record length(1 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* type substitutiongroup generated, because the parent has elemet declaration */
+
+
+type record RestrictedType2
+{
+ record length(2 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* Added to restrictedtype_derivations */
+
+
+type record RestrictedType2_1
+{
+ record length(2 .. 5) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as 'restrictedType2.1'";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* No type substitutiongroup generated, because the parent lacks elemet declaration */
+
+
+type record RestrictedType3
+{
+ record length(3 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type union ParentType_derivations
+{
+ ParentType parentType,
+ RestrictedType_derivations restrictedType
+}
+with {
+variant "useType";
+variant (parentType) "name as capitalized";
+};
+
+
+type union RestrictedType_derivations
+{
+ RestrictedType restrictedType,
+ RestrictedType2 restrictedType2,
+ RestrictedType2_1 restrictedType2_1
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (restrictedType2_1) "name as 'restrictedType2.1'";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/chain' prefix 'tys'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Mon Nov 16 10:01:25 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/type/substitution/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution {
+
+
+import from XSD all;
+
+
+type ParentType_derivations Head
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+/* SUBSTITUTABLE PARENT TYPE */
+
+
+type record ParentType
+{
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type RestrictedType RestrictedTypeElem
+with {
+variant "element";
+};
+
+
+/* The restricting type is: */
+
+
+type record RestrictedType
+{
+ record length(1 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type SubmitRequestType Submit
+with {
+variant "element";
+};
+
+
+type record SubmitRequestType
+{
+ ParentType_derivations request1,
+ ParentType_derivations request2
+};
+
+
+type union ParentType_derivations
+{
+ ParentType parentType,
+ RestrictedType restrictedType
+}
+with {
+variant "useType";
+variant (parentType) "name as capitalized";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution' prefix 'tysub'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_elem_in_ct_mod1_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Wed Nov 18 15:03:25 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_elem_in_ct_mod1_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/type/substitution/elem/in/ct/mod1/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_elem_in_ct_mod1 {
+
+
+import from XSD all;
+
+
+type record Complex
+{
+ String_derivations string,
+ ParentType_derivations parentType
+}
+with {
+variant "element";
+};
+
+
+type XSD.String Stringtype
+with {
+variant "name as uncapitalized";
+};
+
+
+type XSD.String Stringtype2 length(5)
+with {
+variant "name as uncapitalized";
+};
+
+
+type record ParentType
+{
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type record RestrictedType
+{
+ record length(1 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type record MorerestrictedType
+{
+ record length(2 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type union String_derivations
+{
+ XSD.String string,
+ Stringtype_derivations stringtype
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+};
+
+
+type union Stringtype_derivations
+{
+ Stringtype stringtype,
+ Stringtype2 stringtype2
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+};
+
+
+type union ParentType_derivations
+{
+ ParentType parentType,
+ RestrictedType_derivations restrictedType
+}
+with {
+variant "useType";
+variant (parentType) "name as capitalized";
+variant (restrictedType) "block";
+};
+
+
+type union RestrictedType_derivations
+{
+ RestrictedType restrictedType,
+ MorerestrictedType morerestrictedType
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (morerestrictedType) "block";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/elem/in/ct/mod1' prefix 'this'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_elem_in_ct_mod2_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Wed Nov 18 15:03:25 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_elem_in_ct_mod2_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/type/substitution/elem/in/ct/mod2/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_elem_in_ct_mod2 {
+
+
+import from XSD all;
+
+
+import from www_example_org_type_substitution_elem_in_ct_mod1 all;
+
+
+type record Complex2
+{
+ Stringtype_derivations stringType,
+ ParentType_derivations parentType,
+ RestrictedType_derivations restrictedType
+}
+with {
+variant "element";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/elem/in/ct/mod2'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_mod1_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Tue Nov 17 14:10:37 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_mod1_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/type/substitution/mod1/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_mod1 {
+
+
+import from XSD all;
+
+
+import from www_example_org_type_substitution_mod2 all;
+
+
+/* SUBSTITUTABLE PARENT TYPE */
+
+
+/* type substitutiongroup generated, because has elemet declaration */
+
+
+type record ParentType
+{
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "abstract";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type RestrictedType_derivations RestrictedTypeElem
+with {
+variant "element";
+};
+
+
+/* type substitutiongroup generated, because has elemet declaration */
+
+
+type record RestrictedType
+{
+ record length(1 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* type substitutiongroup generated, because the parent has elemet declaration */
+
+
+type record RestrictedType2
+{
+ record length(2 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* Added to restrictedtype_derivations */
+
+
+type record RestrictedType2_1
+{
+ record length(2 .. 5) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as 'restrictedType2.1'";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+/* No type substitutiongroup generated, because the parent lacks elemet declaration */
+
+
+type record RestrictedType3
+{
+ record length(3 .. infinity) of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type ExtendedType_derivations ExtendedElement
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type union ParentType_derivations
+{
+ ParentType parentType,
+ ExtendedType_derivations extendedType,
+ RestrictedType_derivations restrictedType
+}
+with {
+variant "useType";
+variant (parentType) "name as capitalized";
+variant (parentType) "abstract";
+variant (extendedType) "block";
+};
+
+
+type union RestrictedType_derivations
+{
+ RestrictedType restrictedType,
+ RestrictedType2 restrictedType2,
+ RestrictedType2_1 restrictedType2_1
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (restrictedType2_1) "name as 'restrictedType2.1'";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/mod1' prefix 'tys'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_mod2_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Tue Nov 17 14:10:37 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_mod2_e.xsd
+// /* xml version = "1.0" */
+// /* targetnamespace = "www.example.org/type/substitution/mod2/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_mod2 {
+
+
+import from XSD all;
+
+
+import from www_example_org_type_substitution_mod1 all;
+
+
+type ParentType_derivations Subsgroup
+with {
+variant "name as uncapitalized";
+variant "abstract";
+variant "element";
+};
+
+
+type record ExtendedType
+{
+ XSD.String attr1 optional,
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (attr1) "attribute";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type record RestrictedExtendedType
+{
+ record of XSD.String foo_list,
+ XSD.String bar
+}
+with {
+variant "name as uncapitalized";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type RestrictedType_derivations NameTest
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type ExtendedType_derivations NameTest2
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type union ExtendedType_derivations
+{
+ ExtendedType extendedType,
+ RestrictedExtendedType restrictedExtendedType
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (restrictedExtendedType) "block";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/mod2'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_rename_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Wed Nov 25 14:43:08 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_rename_e.xsd
+// /* xml version = "1.0" */
+// /* targetnamespace = "www.example.org/type/substitution/rename/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_rename {
+
+
+import from XSD all;
+
+
+type record Complex
+{
+ ParentType parentType,
+ ParentType_derivations sd
+}
+with {
+variant "element";
+};
+
+
+type ParentType_derivations ParentType
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type record ParentType_1
+{
+ record of XSD.String foo_list
+}
+with {
+variant "name as 'ParentType'";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type RestrictedType_1 RestrictedType
+with {
+variant "element";
+};
+
+
+type record RestrictedType_1
+{
+ record length(1 .. infinity) of XSD.String foo_list
+}
+with {
+variant "name as 'restrictedType'";
+variant (foo_list) "untagged";
+variant (foo_list[-]) "name as 'foo'";
+};
+
+
+type union ParentType_derivations
+{
+ ParentType_1 parentType,
+ RestrictedType_1 restrictedType
+}
+with {
+variant "useType";
+variant (parentType) "name as capitalized";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/rename' prefix 'this'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
--- /dev/null
+/*******************************************************************************
+* Copyright (c) 2000-2015 Ericsson Telecom AB
+*
+* XSD to TTCN-3 Translator version: CRL 113 200/5 R3A
+*
+* All rights reserved. This program and the accompanying materials
+* are made available under the terms of the Eclipse Public License v1.0
+* which accompanies this distribution, and is available at
+* http://www.eclipse.org/legal/epl-v10.html
+*******************************************************************************/
+//
+// File: www_example_org_type_substitution_simpletype_e.ttcn
+// Description:
+// References:
+// Rev:
+// Prodnr:
+// Updated: Wed Nov 18 11:56:35 2014
+// Contact: http://ttcn.ericsson.se
+//
+////////////////////////////////////////////////////////////////////////////////
+// Generated from file(s):
+// - type_substitution_simpletype_e.xsd
+// /* xml version = "1.0" encoding = "UTF-8" */
+// /* targetnamespace = "www.example.org/type/substitution/simpletype/e" */
+////////////////////////////////////////////////////////////////////////////////
+// Modification header(s):
+//-----------------------------------------------------------------------------
+// Modified by:
+// Modification date:
+// Description:
+// Modification contact:
+//------------------------------------------------------------------------------
+////////////////////////////////////////////////////////////////////////////////
+
+
+module www_example_org_type_substitution_simpletype {
+
+
+import from XSD all;
+
+
+type String_derivations Head
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type String_derivations Head_1
+with {
+variant "name as 'head_'";
+variant "element";
+};
+
+
+type Stringtype_derivations Head2
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type XSD.String Stringtype
+with {
+variant "name as uncapitalized";
+};
+
+
+type XSD.String Stringtype2 length(5)
+with {
+variant "name as uncapitalized";
+};
+
+
+type Integer_derivations Int
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type XSD.Integer ExtInt
+with {
+variant "name as uncapitalized";
+};
+
+
+/* Test if the elements are changed in a complextype */
+
+
+type Base64Binary_derivations Elem
+with {
+variant "name as uncapitalized";
+variant "element";
+};
+
+
+type XSD.Base64Binary CrypBinary;
+
+
+type Signature SignatureValue
+with {
+variant "element";
+};
+
+
+type record Signature
+{
+ XSD.ID id optional,
+ XSD.Base64Binary base
+}
+with {
+variant (id) "name as capitalized";
+variant (id) "attribute";
+variant (base) "untagged";
+};
+
+
+type DataType Data
+with {
+variant "element";
+};
+
+
+type record DataType
+{
+ union {
+ Base64Binary_derivations sKI,
+ Base64Binary_derivations cert
+ } choice
+}
+with {
+variant (choice) "untagged";
+variant (choice.sKI) "name as capitalized";
+variant (choice.cert) "name as capitalized";
+};
+
+
+type union String_derivations
+{
+ XSD.String string,
+ Stringtype_derivations stringtype
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+};
+
+
+type union Stringtype_derivations
+{
+ Stringtype stringtype,
+ Stringtype2 stringtype2
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+};
+
+
+type union Integer_derivations
+{
+ XSD.Integer integer_,
+ ExtInt extInt
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (integer_) "name as 'integer'";
+};
+
+
+type union Base64Binary_derivations
+{
+ XSD.Base64Binary base64Binary,
+ CrypBinary crypBinary
+}
+with {
+variant "name as uncapitalized";
+variant "useType";
+variant (crypBinary) "name as capitalized";
+};
+
+
+}
+with {
+encode "XML";
+variant "namespace as 'www.example.org/type/substitution/simpletype' prefix 'this'";
+variant "controlNamespace 'http://www.w3.org/2001/XMLSchema-instance' prefix 'xsi'";
+}
<File path="../xsd/module_typename_conversion.xsd" />
<File path="../xsd/module_typename_conversion_1.xsd" />
<File path="../xsd/substitutiongroup.xsd" />
+ <File path="../xsd/substitutiongroup_name_as.xsd" />
<File path="../xsd/substitutiongroup_abstract_block_1.xsd" />
<File path="../xsd/substitutiongroup_abstract_block_2.xsd" />
<File path="../xsd/substitutiongroup_complex_without_element.xsd" />
<File path="../xsd/substitutiongroup_long_extension.xsd" />
+ <File path="../xsd/substitutiongroup_complextype_block.xsd" />
+ <File path="../xsd/substitutiongroup_notargetnamespace.xsd" />
+ <File path="../xsd/substitutiongroup_rename.xsd" />
<File path="../xsd/generate_element_substitution.xsd" />
<File path="../xsd/dont_generate_element_substitution.xsd" />
<File path="../xsd/substitutiongroup_neg.xsd" />
<File path="../xsd/substitutiongroup_main.xsd" />
<File path="../xsd/substitutiongroup_ref.xsd" />
<File path="../xsd/simpletype_base.xsd" />
+ <File path="../xsd/type_substitution.xsd" />
+ <File path="../xsd/type_substitution_chain.xsd" />
+ <File path="../xsd/type_substitution_abstract_block.xsd" />
+ <File path="../xsd/type_substitution_mod1.xsd" />
+ <File path="../xsd/type_substitution_mod2.xsd" />
+ <File path="../xsd/type_subs_with_elem_subs.xsd" />
+ <File path="../xsd/type_substitution_simpletype.xsd" />
+ <File path="../xsd/type_substitution_elem_in_ct_mod1.xsd" />
+ <File path="../xsd/type_substitution_elem_in_ct_mod2.xsd" />
+ <File path="../xsd/only_element_substitution.xsd" />
+ <File path="../xsd/type_substitution_builtintype.xsd" />
+ <File path="../xsd/type_substitution_rename.xsd" />
</File_Group>
<File_Group name="XmlTest_xsds" >
<File path="../XmlTest_xsds/XmlTest_boolean.xsd" />
<File path="../XmlTest_expectedTtcns/www_example_org_anyattrib_single_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_attrib_order_a_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_attrib_order_b_e.ttcn" />
- <File path="../XmlTest_expectedTtcns/NoTargetNamespace.ttcn" />
+ <File path="../XmlTest_expectedTtcns/NoTargetNamespace2_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_fixed_value_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_self_recursion_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_enumeration_remove_dup_e.ttcn" />
<File path="../XmlTest_expectedTtcns/module_typename_conversion_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_all_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_name_as_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_abstract_block_1_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_abstract_block_2_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_complex_without_element_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_long_extension_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_complextype_block_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_generate_element_substitution_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_dont_generate_element_substitution_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_rename_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_list_simpletype_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_no_ns_connector_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_anyattr_in_complex_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_ref_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_substitutiongroup_main_e.ttcn" />
<File path="../XmlTest_expectedTtcns/www_example_org_simpletype_base_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_chain_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_abstract_block_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_mod1_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_mod2_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_subs_with_elem_subs_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_simpletype_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_elem_in_ct_mod1_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_elem_in_ct_mod2_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_only_element_substitution_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_builtintype_e.ttcn" />
+ <File path="../XmlTest_expectedTtcns/www_example_org_type_substitution_rename_e.ttcn" />
</File_Group>
<File_Group name="XmlTest_src" >
<File path="xmlTest_Shell.ttcn" />
import from www_XmlTest_org_element_recordOfElements5_e all;
import from www_XmlTest_org_element_nameInheritance_e all;
import from www_ericsson_com_is_isco_Tgc_R6A48_R6H01 all;
+import from www_example_org_substitutiongroup all;
+import from www_example_org_type_substitution all;
import from XmlTest_imsike_e all;
import from xmlTest_Shell all;
//==============================================================================
external function f_dec_Tgc(in octetstring stream, out Tgc pdu) return integer
with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
+external function f_enc_ize_subs(in Ize pdu, out octetstring stream)
+with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
+
+external function f_dec_ize_subs(in octetstring stream, out Ize pdu) return integer
+with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
+
+external function f_enc_type_subs(in Submit pdu, out octetstring stream)
+with { extension "prototype(fast) encode(XER:XER_EXTENDED)" }
+
+external function f_dec_type_subs(in octetstring stream, out Submit pdu) return integer
+with { extension "prototype(backtrack) decode(XER:XER_EXTENDED)" }
+
//==============================================================================
// Encoding decoding test
//==============================================================================
}//f_
+//==========================================
+//f_encDecTest_Ize
+//==========================================
+function f_encDecTest_ize_subs() runs on Shell_CT {
+
+ var Ize vl_pdu := { head_list := {
+ { head := "anything" },
+ { member1 := "any thing" },
+ { member2 := something },
+ { member3 := { bar:= 5, foo := omit, base := "anything else" } } }
+ },
+ vl_decodedPdu;
+
+ var octetstring vl_expectedEncodedPdu:=char2oct(
+ "<subs:ize "&
+ "xmlns:subs='www.example.org/substitutiongroup'>\n"&
+ "\t<subs:head>anything</subs:head>\n"&
+ "\t<subs:member1>any thing</subs:member1>\n"&
+ "\t<subs:member2>something</subs:member2>\n"&
+ "\t<subs:member3 bar='5'>anything else</subs:member3>\n"&
+ "</subs:ize>\n\n");
+
+ var octetstring vl_stream:=''O;
+ f_enc_ize_subs(vl_pdu,vl_stream);
+
+ if( match(vl_stream,vl_expectedEncodedPdu)) {
+ setverdict(pass);
+ } else {
+ log("Expected encoded value: ",vl_expectedEncodedPdu);
+ log("Actual encoded value: ", vl_stream);
+ setverdict(fail);
+ }
+
+ //log("===Checking encoded value (xml) against the xsd file by xmllint ===");
+ var boolean vl_success:=false;
+ f_shell_validateXml(vl_stream,"substitutiongroup.xsd", c_shell_successWithoutWarningAndError, vl_success);
+ if(vl_success) {
+ setverdict(pass);
+ }else{
+ log("Xml validation against xsd failed");
+ setverdict(fail);
+ }
+
+ //log("===Checking value decoded from the encoded value vs original value===");
+ var integer vl_retval:=f_dec_ize_subs(vl_stream, vl_decodedPdu);
+ //log("retval:",vl_retval);
+ if(f_dec_ize_subs(vl_stream, vl_decodedPdu)==0) {
+ //log("The decoded pdu: ", vl_decodedPdu);
+ if(match(vl_pdu,vl_decodedPdu)) {
+ setverdict(pass);
+ } else {
+ log("Pdu differs from the expected value");
+ log(match(vl_pdu,vl_decodedPdu));
+ setverdict(fail);
+ }
+ }else{
+ log("Pdu could not decoded");
+ setverdict(fail);
+ }
+
+ //log("===Checking value decoded from the expected value vs original value===");
+ if( f_dec_ize_subs(vl_expectedEncodedPdu, vl_decodedPdu)==0) {
+ //log("The decoded pdu: ", vl_decodedPdu);
+ if(match(vl_pdu,vl_decodedPdu)) {
+ setverdict(pass);
+ } else {
+ log("Pdu could not decoded from the expected value");
+ log(match(vl_pdu,vl_decodedPdu));
+ setverdict(fail);
+ }
+ } else {
+ log("Pdu could not decoded from the expected value");
+ setverdict(fail);
+ }
+}//f_
+
+
+//==========================================
+//f_encDecTest_type_subs
+//==========================================
+function f_encDecTest_type_subs() runs on Shell_CT {
+
+ var Submit vl_pdu := {
+ request1 := {
+ restrictedType := {
+ foo_list := { "string1", "string2", "string3" },
+ bar := "bar"
+ }
+ },
+ request2 := {
+ parentType := {
+ foo_list := { "parentstring1", "parentstring2", "parentstring3" },
+ bar := "parentbar"
+ }
+ }
+ },
+ vl_decodedPdu;
+ var octetstring vl_expectedEncodedPdu:=char2oct(
+ "<tysub:Submit xmlns:tysub='www.example.org/type/substitution' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>\n"&
+ "\t<request1 xsi:type='tysub:restrictedType'>\n"&
+ "\t\t<foo>string1</foo>\n"&
+ "\t\t<foo>string2</foo>\n"&
+ "\t\t<foo>string3</foo>\n"&
+ "\t\t<bar>bar</bar>\n"&
+ "\t</request1>\n"&
+ "\t<request2>\n"&
+ "\t\t<foo>parentstring1</foo>\n"&
+ "\t\t<foo>parentstring2</foo>\n"&
+ "\t\t<foo>parentstring3</foo>\n"&
+ "\t\t<bar>parentbar</bar>\n"&
+ "\t</request2>\n"&
+ "</tysub:Submit>\n\n");
+
+ var octetstring vl_stream:=''O;
+ f_enc_type_subs(vl_pdu,vl_stream);
+
+ if( match(vl_stream,vl_expectedEncodedPdu)) {
+ setverdict(pass);
+ } else {
+ log("Expected encoded value: ",vl_expectedEncodedPdu);
+ log("Actual encoded value: ", vl_stream);
+ setverdict(fail);
+ }
+
+ //log("===Checking encoded value (xml) against the xsd file by xmllint ===");
+ var boolean vl_success:=false;
+ f_shell_validateXml(vl_stream,"type_substitution.xsd", c_shell_successWithoutWarningAndError, vl_success);
+ if(vl_success) {
+ setverdict(pass);
+ }else{
+ log("Xml validation against xsd failed");
+ setverdict(fail);
+ }
+
+ //log("===Checking value decoded from the encoded value vs original value===");
+ var integer vl_retval:=f_dec_type_subs(vl_stream, vl_decodedPdu);
+ //log("retval:",vl_retval);
+ if(f_dec_type_subs(vl_stream, vl_decodedPdu)==0) {
+ //log("The decoded pdu: ", vl_decodedPdu);
+ if(match(vl_pdu,vl_decodedPdu)) {
+ setverdict(pass);
+ } else {
+ log("Pdu differs from the expected value");
+ log(match(vl_pdu,vl_decodedPdu));
+ setverdict(fail);
+ }
+ }else{
+ log("Pdu could not decoded");
+ setverdict(fail);
+ }
+
+ //log("===Checking value decoded from the expected value vs original value===");
+ if( f_dec_type_subs(vl_expectedEncodedPdu, vl_decodedPdu)==0) {
+ //log("The decoded pdu: ", vl_decodedPdu);
+ if(match(vl_pdu,vl_decodedPdu)) {
+ setverdict(pass);
+ } else {
+ log("Pdu could not decoded from the expected value");
+ log(match(vl_pdu,vl_decodedPdu));
+ setverdict(fail);
+ }
+ } else {
+ log("Pdu could not decoded from the expected value");
+ setverdict(fail);
+ }
+}//f_
+
+
}//module
}//tc_
testcase tc_no_ns_connector() runs on xmlTest_CT {
- f_shellCommandWithVerdict("xsd2ttcn no_ns_connector.xsd","",c_shell_successWithWarning)
+ f_shellCommandWithVerdict("xsd2ttcn no_ns_connector.xsd","",c_shell_successWithoutWarningAndError)
if(getverdict==pass) {
f_compareFiles(
}//tc_
+ testcase tc_substitutiongroup_name_as() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_name_as.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_substitutiongroup_name_as_e.ttcn","www_example_org_substitutiongroup_name_as.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
testcase tc_substitutiongroup_abstract_block_rest() runs on xmlTest_CT {
- f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_abstract_block_1.xsd","",c_shell_successWithWarning)
+ f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_abstract_block_1.xsd","",c_shell_successWithoutWarningAndError)
if(getverdict==pass) {
f_compareFiles(
testcase tc_substitutiongroup_abstract_block_ext() runs on xmlTest_CT {
- f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_abstract_block_2.xsd","",c_shell_successWithWarning)
+ f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_abstract_block_2.xsd","",c_shell_successWithoutWarningAndError)
if(getverdict==pass) {
f_compareFiles(
testcase tc_substitutiongroup_complex_without_element() runs on xmlTest_CT {
- f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_complex_without_element.xsd","",c_shell_successWithWarning)
+ f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_complex_without_element.xsd","",c_shell_successWithoutWarningAndError)
if(getverdict==pass) {
f_compareFiles(
testcase tc_substitutiongroup_long_extension() runs on xmlTest_CT {
- f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_complex_without_element.xsd","",c_shell_successWithWarning)
+ f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_complex_without_element.xsd","",c_shell_successWithoutWarningAndError)
if(getverdict==pass) {
f_compareFiles(
}//tc_
+ testcase tc_substitutiongroup_complextype_block() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_complextype_block.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_substitutiongroup_complextype_block_e.ttcn",
+ "www_example_org_substitutiongroup_complextype_block.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ //Test if we find the substitutiongroup references in notargetnamespace
+ testcase tc_substitutiongroup_notargetnamespace() runs on xmlTest_CT {
+
+ //f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_notargetnamespace.xsd","",c_shell_successWithoutWarningAndError)
+ setverdict(pass);
+
+ }//tc_
+
testcase tc_substitutiongroup_neg() runs on xmlTest_CT {
f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_neg.xsd","",c_shell_error)
testcase tc_substitutiongroup_diff_module() runs on xmlTest_CT {
- f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_main.xsd substitutiongroup_ref.xsd","",c_shell_successWithWarning)
+ f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_main.xsd substitutiongroup_ref.xsd","",c_shell_successWithoutWarningAndError)
if(getverdict==pass) {
f_compareFiles(
}//tc_
+ testcase tc_substitutiongroup_rename() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn substitutiongroup_rename.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_substitutiongroup_rename_e.ttcn",
+ "www_example_org_substitutiongroup_rename.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_substitutiongroup_endDec() runs on xmlTest_CT {
+
+ f_encDecTest_ize_subs();
+ }
+
+ testcase tc_type_substitution() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_substitution.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_e.ttcn",
+ "www_example_org_type_substitution.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_type_substitution_encDec() runs on xmlTest_CT {
+
+ f_encDecTest_type_subs();
+
+ }//tc_
+
+ testcase tc_type_substitution_chain() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_substitution_chain.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_chain_e.ttcn",
+ "www_example_org_type_substitution_chain.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_type_substitution_abstract_block() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_substitution_abstract_block.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_abstract_block_e.ttcn",
+ "www_example_org_type_substitution_abstract_block.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_type_substitution_diff_module() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_substitution_mod1.xsd type_substitution_mod2.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_mod1_e.ttcn",
+ "www_example_org_type_substitution_mod1.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_mod2_e.ttcn",
+ "www_example_org_type_substitution_mod2.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_type_substitution_simpletype() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_substitution_simpletype.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_simpletype_e.ttcn",
+ "www_example_org_type_substitution_simpletype.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_type_substitution_with_elem_substitution() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_subs_with_elem_subs.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_subs_with_elem_subs_e.ttcn",
+ "www_example_org_type_subs_with_elem_subs.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_type_substitution_element_in_ct() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_substitution_elem_in_ct_mod1.xsd type_substitution_elem_in_ct_mod2.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_elem_in_ct_mod1_e.ttcn",
+ "www_example_org_type_substitution_elem_in_ct_mod1.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_elem_in_ct_mod2_e.ttcn",
+ "www_example_org_type_substitution_elem_in_ct_mod2.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_only_element_substitution() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h only_element_substitution.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_only_element_substitution_e.ttcn",
+ "www_example_org_only_element_substitution.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_type_substitution_builtintype() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_substitution_builtintype.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_builtintype_e.ttcn",
+ "www_example_org_type_substitution_builtintype.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
+ testcase tc_type_substitution_rename() runs on xmlTest_CT {
+
+ f_shellCommandWithVerdict("xsd2ttcn -h type_substitution_rename.xsd","",c_shell_successWithoutWarningAndError)
+
+ if(getverdict==pass) {
+ f_compareFiles(
+ "www_example_org_type_substitution_rename_e.ttcn",
+ "www_example_org_type_substitution_rename.ttcn", c_numOfDiff_headerModNameAndNamespace);
+ }
+
+ }//tc_
+
//========================================================
//"Abstract" are not supported. Therefore converter sends WARNINGs
testcase tc_element_abstract_conv() runs on xmlTest_CT {
- f_shellCommandWithVerdict("xsd2ttcn XmlTest_element_abstract.xsd","",c_shell_successWithWarning);
+ f_shellCommandWithVerdict("xsd2ttcn XmlTest_element_abstract.xsd","",c_shell_successWithoutWarningAndError);
}//tc_
testcase tc_element_nillable_converter() runs on xmlTest_CT {
//===substitutiongroup===
execute(tc_substitutiongroup());
+ execute(tc_substitutiongroup_name_as());
execute(tc_substitutiongroup_abstract_block_rest());
execute(tc_substitutiongroup_abstract_block_ext());
execute(tc_substitutiongroup_complex_without_element());
execute(tc_substitutiongroup_long_extension());
+ execute(tc_substitutiongroup_complextype_block());
+ execute(tc_substitutiongroup_notargetnamespace());
execute(tc_substitutiongroup_neg());
execute(tc_substitutiongroup_diff_module());
+ execute(tc_substitutiongroup_rename());
+ execute(tc_substitutiongroup_endDec());
+
+ //===type substitution===
+ execute(tc_type_substitution());
+ execute(tc_type_substitution_encDec());
+ execute(tc_type_substitution_chain());
+ execute(tc_type_substitution_abstract_block());
+ execute(tc_type_substitution_diff_module());
+ execute(tc_type_substitution_simpletype());
+ execute(tc_type_substitution_with_elem_substitution());
+ execute(tc_type_substitution_element_in_ct());
+ execute(tc_only_element_substitution());
+ execute(tc_type_substitution_builtintype());
+ execute(tc_type_substitution_rename());
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="www.example.org/only/element/substitution"
+ xmlns="www.example.org/only/element/substitution">
+
+<xsd:element name="requestAbstractType1" type="requestAbstractType" abstract="true"/>
+
+<xsd:complexType name="requestAbstractType" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="commonName" type="xsd:string" />
+ </xsd:sequence>
+</xsd:complexType>
+
+<!-- Production implementation -->
+
+<xsd:element name="productionRequest" substitutionGroup="requestAbstractType" >
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="requestAbstractType">
+ <xsd:sequence>
+ <xsd:element name="productionName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+</xsd:element>
+
+<!-- Production implementation -->
+<xsd:element name="programmingRequest" substitutionGroup="requestAbstractType" >
+ <xsd:complexType>
+ <xsd:complexContent>
+ <xsd:extension base="requestAbstractType">
+ <xsd:sequence>
+ <xsd:element name="programmingName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+ </xsd:complexType>
+</xsd:element>
+
+</xsd:schema>
+
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:this="www.example.org/substitutiongroup"
+ xmlns:subs="www.example.org/substitutiongroup"
targetNamespace="www.example.org/substitutiongroup">
<!-- THE HEAD ELEMENT -->
<xsd:element name="head" type="xsd:string" />
<!-- SUBSTITUTION ELEMENT OF THE SAME TYPE AS THE HEAD -->
-<xsd:element name="member1" type="xsd:string" substitutionGroup="this:head"/>
+<xsd:element name="member1" type="xsd:string" substitutionGroup="subs:head"/>
<!-- SUBSTITUTION ELEMENT OF A TYPE RESTRICTING THE TYPE OF THE HEAD -->
<xsd:simpleType name="stringEnum">
</xsd:restriction>
</xsd:simpleType>
-<xsd:element name="member2" type="this:stringEnum" substitutionGroup="this:head"/>
+<xsd:element name="member2" type="subs:stringEnum" substitutionGroup="subs:head"/>
<!-- SUBSTITUTION ELEMENT OF A TYPE EXTENDING THE TYPE OF THE HEAD -->
<xsd:complexType name="complexEnum">
</xsd:simpleContent>
</xsd:complexType>
-<xsd:element name="member3" type="this:complexEnum" substitutionGroup="this:head"/>
+<xsd:element name="member3" type="subs:complexEnum" substitutionGroup="subs:head"/>
<!-- TOP LEVEL ELEMENT TO DEMONSTRATE SUBSTITUTION -->
<xsd:element name="ize">
<xsd:complexType>
<xsd:sequence>
- <xsd:element ref="this:head" minOccurs="0" maxOccurs="unbounded"/>
+ <xsd:element ref="subs:head" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:this="www.example.org/substitutiongroup/complextype/block"
+ targetNamespace="www.example.org/substitutiongroup/complextype/block" blockDefault="extension">
+
+
+<xsd:element name="head" type="this:restrictedType" block="restriction" />
+
+<!-- SUBSTITUTABLE PARENT TYPE -->
+<xsd:complexType name="ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="RestrictedTypeElem" type="this:restrictedType" substitutionGroup="this:head"/>
+<!-- The restricting type is: -->
+<xsd:complexType name="restrictedType">
+ <xsd:complexContent>
+ <xsd:restriction base="this:ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="1" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+
+</xsd:schema>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:this="www.example.org/substitutiongroup/name/as"
+ targetNamespace="www.example.org/substitutiongroup/name/as">
+
+<!-- THE HEAD ELEMENT -->
+<xsd:element name="Head" type="xsd:string" />
+
+<!-- SUBSTITUTION ELEMENT OF THE SAME TYPE AS THE HEAD -->
+<xsd:element name="Member1" type="xsd:string" substitutionGroup="this:Head"/>
+
+<!-- SUBSTITUTION ELEMENT OF A TYPE RESTRICTING THE TYPE OF THE HEAD -->
+<xsd:simpleType name="StringEnum">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="something"/>
+ <xsd:enumeration value="else"/>
+ </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:element name="Member2" type="this:StringEnum" substitutionGroup="this:Head"/>
+
+<!-- SUBSTITUTION ELEMENT OF A TYPE EXTENDING THE TYPE OF THE HEAD -->
+<xsd:complexType name="ComplexEnum">
+ <xsd:simpleContent>
+ <xsd:extension base="xsd:string">
+ <xsd:attribute name="foo" type="xsd:float"/>
+ <xsd:attribute name="bar" type="xsd:integer"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+<xsd:element name="Member3" type="this:ComplexEnum" substitutionGroup="this:Head"/>
+
+<!-- TOP LEVEL ELEMENT TO DEMONSTRATE SUBSTITUTION -->
+<xsd:element name="Ize">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="this:Head" minOccurs="0" maxOccurs="unbounded"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:element>
+
+</xsd:schema>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="unqualified" attributeFormDefault="unqualified">
+
+<xsd:element name="request" type="requestAbstractType"/>
+
+<xsd:complexType name="requestAbstractType">
+ <xsd:sequence>
+ <xsd:element name="commonName" type="xsd:string" />
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="productionRequest" type="myProductionRequestType" substitutionGroup="request" />
+
+<xsd:complexType name="myProductionRequestType">
+ <xsd:complexContent>
+ <xsd:extension base="requestAbstractType">
+ <xsd:sequence>
+ <xsd:element name="productionName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+</xsd:complexType>
+
+
+</xsd:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="www.example.org/substitutiongroup/rename"
+ xmlns:this="www.example.org/substitutiongroup/rename">
+
+<xsd:complexType name="BaseElement_">
+ <xsd:sequence>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:complexType name="Audit" mixed="false">
+ <xsd:complexContent mixed="false">
+ <xsd:extension base="this:BaseElement_">
+ <xsd:sequence>
+ <xsd:element ref="this:BaseElement" minOccurs="0"/>
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<xsd:element name="Case" type="integer" abstract="true"/>
+
+<xsd:element name="BaseElement__" type="string" abstract="true"/>
+
+<xsd:element name="BaseElement" type="this:BaseElement_" abstract="true"/>
+
+<xsd:element name="Case_" type="this:Audit" substitutionGroup="this:BaseElement"/>
+
+</xsd:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="www.example.org/type/subs/with/elem/subs"
+ xmlns="www.example.org/type/subs/with/elem/subs"
+ elementFormDefault="unqualified"
+ attributeFormDefault="unqualified">
+
+ <!-- Root element -->
+<xsd:element name="Submit" type="SubmitRequestType" />
+
+<xsd:complexType name="requestGroup">
+ <xsd:sequence>
+ <xsd:element ref="request"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:complexType name="SubmitRequestType">
+ <xsd:sequence>
+ <xsd:element name="name" type="xsd:string" />
+ <xsd:element name="request1" type="requestAbstractType" />
+ <xsd:element name="request2" type="requestAbstractType" />
+ </xsd:sequence>
+</xsd:complexType>
+
+
+ <!-- The generic abstract type -->
+<xsd:element name="request" type="requestAbstractType" abstract="true" />
+
+<xsd:complexType name="requestAbstractType" abstract="true">
+ <xsd:sequence>
+ <xsd:element name="commonName" type="xsd:string" />
+ </xsd:sequence>
+</xsd:complexType>
+
+ <!-- Production implementation -->
+<xsd:element name="productionRequest" type="myProductionRequestType" substitutionGroup="request" />
+
+<xsd:complexType name="myProductionRequestType">
+ <xsd:complexContent>
+ <xsd:extension base="requestAbstractType">
+ <xsd:sequence>
+ <xsd:element name="productionName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+</xsd:complexType>
+
+ <!-- Production implementation -->
+<xsd:element name="programmingRequest" type="myProgrammingRequestType" substitutionGroup="request" />
+
+<xsd:complexType name="myProgrammingRequestType">
+ <xsd:complexContent>
+ <xsd:extension base="requestAbstractType">
+ <xsd:sequence>
+ <xsd:element name="programmingName" type="xsd:string" />
+ </xsd:sequence>
+ </xsd:extension>
+ </xsd:complexContent>
+</xsd:complexType>
+
+</xsd:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tysub="www.example.org/type/substitution"
+ targetNamespace="www.example.org/type/substitution">
+
+
+<xsd:element name="head" type="tysub:ParentType" block="restriction"/>
+
+<!-- SUBSTITUTABLE PARENT TYPE -->
+<xsd:complexType name="ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="RestrictedTypeElem" type="tysub:restrictedType"/>
+<!-- The restricting type is: -->
+<xsd:complexType name="restrictedType">
+ <xsd:complexContent>
+ <xsd:restriction base="tysub:ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="1" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<xsd:element name="Submit" type="tysub:SubmitRequestType" />
+
+<xsd:complexType name="SubmitRequestType">
+ <xsd:sequence>
+ <xsd:element name="request1" type="tysub:ParentType" />
+ <xsd:element name="request2" type="tysub:ParentType" />
+ </xsd:sequence>
+</xsd:complexType>
+
+
+</xsd:schema>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tys="www.example.org/type/substitution/abstract/block"
+ targetNamespace="www.example.org/type/substitution/abstract/block" blockDefault="extension">
+
+
+<xsd:element name="head" type="tys:ParentType"/>
+
+<!-- SUBSTITUTABLE PARENT TYPE -->
+<!-- type substitutiongroup generated, because has elemet declaration -->
+<xsd:complexType name="ParentType" abstract="true" block="restriction extension">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="RestrictedTypeElem" type="tys:restrictedType"/>
+<!-- type substitutiongroup generated, because has elemet declaration -->
+<xsd:complexType name="restrictedType">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="1" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- type substitutiongroup generated, because the parent has elemet declaration -->
+<xsd:complexType name="restrictedType2">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="2" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- Added to restrictedtype_derivations -->
+<xsd:complexType name="restrictedType2.1">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="2" maxOccurs="5" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- No type substitutiongroup generated, because the parent lacks elemet declaration -->
+<xsd:complexType name="restrictedType3">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType2">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="3" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<xsd:element name="extendedElement" type="tys:extendedType"/>
+<xsd:complexType name="extendedType" block="restriction">
+ <xsd:complexContent>
+ <xsd:extension base="tys:ParentType">
+ <xsd:sequence>
+ </xsd:sequence>
+ <xsd:attribute name="attr1" type="string" />
+ </xsd:extension>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<xsd:complexType name="restrictedExtendedType">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:extendedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="attr1" type="string" use="prohibited" />
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+</xsd:schema>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="www.example.org/type/substitution/builtintype"
+ xmlns:this="www.example.org/type/substitution/builtintype">
+
+<xsd:element name="elem" type="xsd:string"/>
+
+<xsd:simpleType name="enable">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="equal"/>
+ </xsd:restriction>
+</xsd:simpleType>
+<xsd:simpleType name="session">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="visible_and_interactive"/>
+ </xsd:restriction>
+</xsd:simpleType>
+<xsd:simpleType name="res">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="pending"/>
+ </xsd:restriction>
+</xsd:simpleType>
+<xsd:simpleType name="data">
+ <xsd:restriction base="xsd:string">
+ <xsd:enumeration value="dateTime"/>
+ </xsd:restriction>
+</xsd:simpleType>
+
+
+</xsd:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tys="www.example.org/type/substitution/chain"
+ targetNamespace="www.example.org/type/substitution/chain">
+
+<xsd:element name="head" type="tys:ParentType"/>
+
+<!-- SUBSTITUTABLE PARENT TYPE -->
+<!-- type substitutiongroup generated, because has elemet declaration -->
+<xsd:complexType name="ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="RestrictedTypeElem" type="tys:restrictedType"/>
+
+<!-- type substitutiongroup generated, because has elemet declaration -->
+<xsd:complexType name="restrictedType">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="1" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- type substitutiongroup generated, because the parent has elemet declaration -->
+<xsd:complexType name="restrictedType2">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="2" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- Added to restrictedtype_derivations -->
+<xsd:complexType name="restrictedType2.1">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="2" maxOccurs="5" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- No type substitutiongroup generated, because the parent lacks elemet declaration -->
+<xsd:complexType name="restrictedType3">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType2">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="3" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+</xsd:schema>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:this="www.example.org/type/substitution/elem/in/ct/mod1"
+ targetNamespace="www.example.org/type/substitution/elem/in/ct/mod1"
+ blockDefault="restriction">
+
+<xsd:element name="Complex">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="string" type="xsd:string"/>
+ <xsd:element name="parentType" type="this:ParentType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="stringtype">
+ <xsd:restriction base="string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="stringtype2">
+ <xsd:restriction base="this:stringtype">
+ <xsd:length value="5"/>
+ </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:complexType name="ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:complexType name="restrictedType">
+ <xsd:complexContent>
+ <xsd:restriction base="this:ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="1" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<xsd:complexType name="morerestrictedType">
+ <xsd:complexContent>
+ <xsd:restriction base="this:restrictedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="2" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+</xsd:schema>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:A="www.example.org/type/substitution/elem/in/ct/mod1"
+ targetNamespace="www.example.org/type/substitution/elem/in/ct/mod2"
+ blockDefault="restriction">
+<xsd:import namespace="www.example.org/type/substitution/elem/in/ct/mod1" schemaLocation="type_substitution_elem_in_ct_mod1.xsd"/>
+
+<xsd:element name="Complex2">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="stringType" type="A:stringtype"/>
+ <xsd:element name="parentType" type="A:ParentType"/>
+ <xsd:element name="restrictedType" type="A:restrictedType"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:element>
+
+</xsd:schema>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:tys="www.example.org/type/substitution/mod1"
+ xmlns:A="www.example.org/type/substitution/mod2"
+ targetNamespace="www.example.org/type/substitution/mod1" blockDefault="extension">
+<xsd:import namespace="www.example.org/type/substitution/mod2" schemaLocation="type_substitution_mod2.xsd"/>
+
+<!-- SUBSTITUTABLE PARENT TYPE -->
+<!-- type substitutiongroup generated, because has elemet declaration -->
+<xsd:complexType name="ParentType" abstract="true" block="restriction extension">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="RestrictedTypeElem" type="tys:restrictedType"/>
+<!-- type substitutiongroup generated, because has elemet declaration -->
+<xsd:complexType name="restrictedType">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="1" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- type substitutiongroup generated, because the parent has elemet declaration -->
+<xsd:complexType name="restrictedType2">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="2" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- Added to restrictedtype_derivations -->
+<xsd:complexType name="restrictedType2.1">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="2" maxOccurs="5" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<!-- No type substitutiongroup generated, because the parent lacks elemet declaration -->
+<xsd:complexType name="restrictedType3">
+ <xsd:complexContent>
+ <xsd:restriction base="tys:restrictedType2">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="3" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<xsd:element name="extendedElement" type="A:extendedType"/>
+
+</xsd:schema>
--- /dev/null
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:A="www.example.org/type/substitution/mod1"
+ targetNamespace="www.example.org/type/substitution/mod2"
+ xmlns="www.example.org/type/substitution/mod2">
+<xsd:import namespace="www.example.org/type/substitution/mod1" schemaLocation="type_substitution_mod1.xsd"/>
+
+<xsd:element name="subsgroup" type="A:ParentType" abstract="true" />
+
+<xsd:complexType name="extendedType" block="restriction">
+ <xsd:complexContent>
+ <xsd:extension base="A:ParentType">
+ <xsd:sequence>
+ </xsd:sequence>
+ <xsd:attribute name="attr1" type="string" />
+ </xsd:extension>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<xsd:complexType name="restrictedExtendedType">
+ <xsd:complexContent>
+ <xsd:restriction base="extendedType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string"/>
+ <xsd:element name="bar" type="xsd:string"/>
+ </xsd:sequence>
+ <xsd:attribute name="attr1" type="string" use="prohibited" />
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+<xsd:element name="nameTest" type="A:restrictedType"/>
+
+<xsd:element name="nameTest2" type="extendedType"/>
+
+</xsd:schema>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ targetNamespace="www.example.org/type/substitution/rename"
+ xmlns:this="www.example.org/type/substitution/rename">
+
+
+<xsd:element name="Complex">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element ref="this:parentType" />
+ <xsd:element type="this:ParentType" name="sd"/>
+ </xsd:sequence>
+ </xsd:complexType>
+</xsd:element>
+
+<xsd:element name="parentType" type="this:ParentType"/>
+
+<xsd:complexType name="ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="0" maxOccurs="unbounded" type="xsd:string" />
+ </xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="RestrictedType" type="this:restrictedType"/>
+
+<xsd:complexType name="restrictedType">
+ <xsd:complexContent>
+ <xsd:restriction base="this:ParentType">
+ <xsd:sequence>
+ <xsd:element name="foo" minOccurs="1" maxOccurs="unbounded" type="xsd:string"/>
+ </xsd:sequence>
+ </xsd:restriction>
+ </xsd:complexContent>
+</xsd:complexType>
+
+
+</xsd:schema>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+ xmlns:this="www.example.org/type/substitution/simpletype"
+ targetNamespace="www.example.org/type/substitution/simpletype">
+
+
+<xsd:element name="head" type="string" />
+
+<xsd:element name="head_" type="string" />
+
+<xsd:element name="head2" type="this:stringtype" />
+
+<xsd:simpleType name="stringtype">
+ <xsd:restriction base="string"/>
+</xsd:simpleType>
+
+<xsd:simpleType name="stringtype2">
+ <xsd:restriction base="this:stringtype">
+ <xsd:length value="5"/>
+ </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:element name="int" type="xsd:integer"/>
+
+<xsd:simpleType name="extInt">
+ <xsd:restriction base="xsd:integer"/>
+</xsd:simpleType>
+
+
+
+<!-- Test if the elements are changed in a complextype -->
+<xsd:element name="elem" type="base64Binary"/>
+
+<xsd:simpleType name="CrypBinary">
+ <xsd:restriction base="base64Binary">
+ </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:element name="SignatureValue" type="this:Signature"/>
+
+<xsd:complexType name="Signature">
+ <xsd:simpleContent>
+ <xsd:extension base="base64Binary">
+ <xsd:attribute name="Id" type="ID"/>
+ </xsd:extension>
+ </xsd:simpleContent>
+</xsd:complexType>
+
+
+<xsd:element name="Data" type="this:DataType"/>
+
+<xsd:complexType name="DataType">
+ <xsd:sequence>
+ <xsd:choice>
+ <xsd:element name="SKI" type="base64Binary"/>
+ <xsd:element name="Cert" type="base64Binary"/>
+ </xsd:choice>
+ </xsd:sequence>
+</xsd:complexType>
+
+
+</xsd:schema>
\r
myIo3 MY-CLASS ::= { ID 3 TYPE INTEGER }\r
\r
+myIo4 MY-CLASS ::= { ID 4 TYPE NULL }\r
+\r
-- Defining IO set to be used in message contraction\r
\r
-MyIOSet MY-CLASS ::= { myIo1 | myIo2 | myIo3 }\r
+MyIOSet MY-CLASS ::= { myIo1 | myIo2 | myIo3 | myIo4 }\r
\r
-- and now finally constructing the type\r
\r
id 3,\r
content iNTEGER : 7\r
}\r
+\r
+a-message-id4-lower MyMessage ::= {\r
+ id 4,\r
+ content nULL : NULL\r
+}\r
/*\r
-- Not supported values\r
a-message-id1-upper MyMessage ::= {\r
id 3,\r
content INTEGER : 7\r
}\r
+\r
+a-message-id4-lower MyMessage ::= {\r
+ id 4,\r
+ content NULL : NULL\r
+}\r
*/\r
END\r
content := { iNTEGER := 42 }\r
}\r
\r
+const MyMessage c_message_id4_lower := {\r
+ id := 4,\r
+ content := { nULL := NULL }\r
+}\r
+\r
// Constants (uppercase first letter)\r
const MyMessage c_message_id1_upper := {\r
id := 1,\r
content := { INTEGER := 42 }\r
}\r
\r
+const MyMessage c_message_id4_upper := {\r
+ id := 4,\r
+ content := { NULL := NULL }\r
+}\r
+\r
// Templates (lowercase first letter)\r
template MyMessage t_message_id1_lower := {\r
id := 1,\r
content := { iNTEGER := 42 }\r
}\r
\r
+template MyMessage t_message_id4_lower := {\r
+ id := 4,\r
+ content := { nULL := NULL }\r
+}\r
+\r
// Templates (uppercase first letter)\r
template MyMessage t_message_id1_upper := {\r
id := 1,\r
content := { INTEGER := 42 }\r
}\r
\r
+template MyMessage t_message_id4_upper := {\r
+ id := 4,\r
+ content := { NULL := NULL }\r
+}\r
+\r
// Value list template (contains both lowercase and uppercase examples)\r
template MyMessage t_message_value_list := (\r
{ id := 1, content := { mySeq := { field1 := 42, field2 := omit }} },\r
{ id := 2, content := { myEnum := first} },\r
{ id := 3, content := { iNTEGER := 42 } },\r
+ { id := 4, content := { nULL := NULL } },\r
{ id := 1, content := { MySeq := { field1 := -42, field2 := omit }} },\r
{ id := 2, content := { MyEnum := second} },\r
- { id := 3, content := { INTEGER := -42 } }\r
+ { id := 3, content := { INTEGER := -42 } },\r
+ { id := 4, content := { NULL := NULL } }\r
);\r
\r
// Dummy function to declare variables in\r
id := 3,\r
content := { iNTEGER := 42 }\r
}\r
+ \r
+ var MyMessage v_message_id4_lower := {\r
+ id := 4,\r
+ content := { nULL := NULL }\r
+ }\r
\r
// Variables (uppercase first letter)\r
var MyMessage v_message_id1_upper := {\r
id := 3,\r
content := { INTEGER := 42 }\r
}\r
+ \r
+ var MyMessage v_message_id4_upper := {\r
+ id := 4,\r
+ content := { NULL := NULL }\r
+ }\r
\r
// Template variables (lowercase first letter)\r
var template MyMessage vt_message_id1_lower := {\r
id := 3,\r
content := { iNTEGER := 42 }\r
}\r
+ \r
+ var template MyMessage vt_message_id4_lower := {\r
+ id := 4,\r
+ content := { nULL := NULL }\r
+ }\r
\r
// Template variables (uppercase first letter)\r
var template MyMessage vt_message_id1_upper := {\r
content := { INTEGER := 42 }\r
}\r
\r
+ var template MyMessage vt_message_id4_upper := {\r
+ id := 4,\r
+ content := { NULL := NULL }\r
+ }\r
+ \r
// Value list template variable (contains both lowercase and uppercase examples)\r
var template MyMessage vt_message_value_list := (\r
{ id := 1, content := { mySeq := { field1 := 42, field2 := omit }} },\r
{ id := 2, content := { myEnum := first} },\r
{ id := 3, content := { iNTEGER := 42 } },\r
+ { id := 4, content := { nULL := NULL } },\r
{ id := 1, content := { MySeq := { field1 := -42, field2 := omit }} },\r
{ id := 2, content := { MyEnum := second} },\r
- { id := 3, content := { INTEGER := -42 } }\r
+ { id := 3, content := { INTEGER := -42 } },\r
+ { id := 4, content := { NULL := NULL } }\r
);\r
\r
// Referencing fields of open types (contains both lowercase and uppercase examples)\r
v_message_id2_upper.content.MyEnum := second;\r
v_message_id3_lower.content.iNTEGER := 15;\r
v_message_id3_upper.content.INTEGER := 15;\r
+ v_message_id4_lower.content.nULL := NULL;\r
+ v_message_id4_upper.content.NULL := NULL;\r
vt_message_id1_lower.content.mySeq := { field1 := 41, field2 := omit };\r
vt_message_id1_upper.content.MySeq := { field1 := 41, field2 := omit };\r
vt_message_id2_lower.content.myEnum := second;\r
vt_message_id2_upper.content.MyEnum := second;\r
vt_message_id3_lower.content.iNTEGER := 15;\r
vt_message_id3_upper.content.INTEGER := 15;\r
+ vt_message_id4_lower.content.nULL := NULL;\r
+ vt_message_id4_upper.content.NULL := NULL;\r
if (c_message_id1_lower.content.mySeq == { field1 := 41, field2 := omit } and\r
c_message_id1_upper.content.MySeq == { field1 := 41, field2 := omit } and\r
c_message_id2_lower.content.myEnum == second and\r
c_message_id2_upper.content.MyEnum == second and\r
c_message_id3_lower.content.iNTEGER == 15 and\r
- c_message_id3_upper.content.INTEGER == 15) {\r
+ c_message_id3_upper.content.INTEGER == 15 and\r
+ c_message_id4_lower.content.nULL == NULL and // NULL != NULL !?\r
+ c_message_id4_upper.content.NULL == NULL) {\r
log("a");\r
}\r
if (v_message_id1_lower.content.mySeq == { field1 := 41, field2 := omit } and\r
v_message_id2_lower.content.myEnum == second and\r
v_message_id2_upper.content.MyEnum == second and\r
v_message_id3_lower.content.iNTEGER == 15 and\r
- v_message_id3_upper.content.INTEGER == 15) {\r
+ v_message_id3_upper.content.INTEGER == 15 and\r
+ v_message_id4_lower.content.nULL == NULL and\r
+ v_message_id4_upper.content.NULL == NULL) {\r
log("b");\r
}\r
if (match({ field1 := 41, field2 := omit }, t_message_id1_lower.content.mySeq) and\r
match(second, t_message_id2_lower.content.myEnum) and\r
match(second, t_message_id2_lower.content.MyEnum) and\r
match(15, t_message_id3_lower.content.iNTEGER) and\r
- match(15, t_message_id3_lower.content.INTEGER)) {\r
+ match(15, t_message_id3_lower.content.INTEGER) and\r
+ match(NULL, t_message_id4_lower.content.nULL) and\r
+ match(NULL, t_message_id4_lower.content.NULL)) {\r
log("c");\r
}\r
if (match({ field1 := 41, field2 := omit }, vt_message_id1_upper.content.mySeq) and\r
match(second, vt_message_id2_upper.content.myEnum) and\r
match(second, vt_message_id2_upper.content.MyEnum) and\r
match(15, vt_message_id3_upper.content.iNTEGER) and\r
- match(15, vt_message_id3_upper.content.INTEGER)) {\r
+ match(15, vt_message_id3_upper.content.INTEGER) and\r
+ match(NULL, vt_message_id4_upper.content.nULL) and\r
+ match(NULL, vt_message_id4_upper.content.NULL)) {\r
log("d");\r
}\r
}\r
FILTERED_LOG_FILE="filtered.log"
EXPECTED_LOG_FILE="filtered_e.log2"
-ttcn3_logfilter -o $FILTERED_LOG_FILE $LOGFILE MATCHING+ PARALLEL+
+../../Install/bin/ttcn3_logfilter -o $FILTERED_LOG_FILE $LOGFILE MATCHING+ PARALLEL+
diff $FILTERED_LOG_FILE $EXPECTED_LOG_FILE
if [ $? -ne 0 ]; then
echo "Logfilter test failed! Overall verdict: fail"
var RawSetOfRawUnionBT32 vl_expected :={ {r:="\x01\x01\xFF"}, {i:=2}, {b:=true}}; // oct2char('0101FF'O)
f_compareAndVerdict(
encode_rawSetOfInt32(valueof(t_msetofiValueDiffTypeRaw(1,2,3))),
- '0101FF02000000FF'O);
+ '0101FF0200000001'O);
f_compareAndVerdict(
encode_rawSetOfInt32(valueof(t_msetofiValueDiffTypeRaw(1,2,3))),
encode_rawSetOfRawUnionBT32( vl_expected ));
f_compareAndVerdict(
actual,
'0101FF'O // first raw value
- & 'FE'O); // bottom 2 bits: '10'B for second; top 6 bits '111111'B for true
- //'FE'O = bit2oct('111111'B & '10'B)
+ & '06'O); // bottom 2 bits: '10'B for second, 3rd bit is '1'B for true, top 5 bits are '00000'B (filler zeros)
+ //'06'O = bit2oct('00000'B & '1'B & '10'B)
var RawSetOfRawUnionBT vl_expected :={ {os:='0101FF'O}, {e:=second}, {b:=true}};
var octetstring expected := encode_rawSetOfRawUnionBT(vl_expected);
f_compareAndVerdict(actual, expected);
//var RawSetOfRawUnionBT vl_expected :={ {b:=true}, {r:="Two"}, {b:=true}};
f_compareAndVerdict(
encode_rawSetOfCharstring(valueof(t_msetofrValueDiffTypeRaw("One", "Two", "Three"))),
- '0101FF'O & char2oct("Two") & 'FF'O
+ '0101FF'O & char2oct("Two") & '01'O
); //'0101FF'O
//encode_rawSetOfRawUnionBT( vl_expected ));
}
testcase tc_rawUnionBasicTypes_boolean3() runs on RawComp {
//0. just for fun:
var RawUnionBasicTypesT vl_mubt:={b:=true};
- f_compareAndVerdict(encode_rawUnionBasicTypesT(vl_mubt), 'FF'O);
+ f_compareAndVerdict(encode_rawUnionBasicTypesT(vl_mubt), '01'O);
//1.
vl_mubt:={b:=false};
f_compareAndVerdict(
--- /dev/null
+/******************************************************************************
+ * Copyright (c) 2000-2015 Ericsson Telecom AB
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ ******************************************************************************/
+module ImportedTemplates {
+
+template integer tImported(template integer pt) := pt;
+
+}
TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
-TTCN3_MODULES = TtemplateInt.ttcn
+TTCN3_MODULES = TtemplateInt.ttcn ImportedTemplates.ttcn
GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc)
GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh)
$(TARGET): $(GENERATED_SOURCES) $(USER_SOURCES)
$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS)
-.ttcn.cc .ttcn.hh:
- $(TTCN3_COMPILER) $<
+$(GENERATED_SOURCES) $(GENERATED_HEADERS): $(TTCN3_MODULES)
+ $(TTCN3_COMPILER) $^
clean distclean:
-rm -f $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
******************************************************************************/
module TtemplateInt {
+import from ImportedTemplates all;
+
type component templateInt_mycomp {};
type record templateInt_rec {
integer x1,
setverdict(pass);
}
+// test case: using a parameterized template with no actual parameters (using default values)
+// before its declaration
+template integer tReverse := tPard;
+
+template integer tPard(integer p := 6) := p;
+
+testcase templateIntReverseOrder() runs on templateInt_mycomp {
+ var template integer vtExpected := 6;
+ if (log2str(tReverse) == log2str(vtExpected)) {
+ setverdict(pass);
+ }
+ else {
+ setverdict(fail, "Expected: ", vtExpected, ", got: ", tReverse);
+ }
+}
+
+// same test, but the parameterized template is passed as a parameter to
+// an imported parameterized template
+template integer tReverse2 := tImported(tPard2);
+
+template integer tPard2(integer p := 4) := p;
+
+testcase templateIntReverseOrderImported() runs on templateInt_mycomp {
+ var template integer vtExpected := 4;
+ if (log2str(tReverse2) == log2str(vtExpected)) {
+ setverdict(pass);
+ }
+ else {
+ setverdict(fail, "Expected: ", vtExpected, ", got: ", tReverse2);
+ }
+}
+
+// same as the previous test, but with a non-parameterized template
+template integer tReverse3 := tImported(tNonPard);
+
+template integer tNonPard := (1, 2);
+
+testcase templateIntReverseOrderImported2() runs on templateInt_mycomp {
+ var template integer vtExpected := (1, 2);
+ if (log2str(tReverse3) == log2str(vtExpected)) {
+ setverdict(pass);
+ }
+ else {
+ setverdict(fail, "Expected: ", vtExpected, ", got: ", tReverse3);
+ }
+}
+
control {
execute(templateIntSpec());
execute(templateIntList());
execute(templateIntIfpresent());
execute(TR_HJ94652());
execute(templateIntSubtype());
+ execute(templateIntReverseOrder());
+ execute(templateIntReverseOrderImported());
+ execute(templateIntReverseOrderImported2());
}
}
, enumfields()
, tagNames() {
- if(c != fromTagSubstition){
+ if(c != fromTagSubstitution && c != fromTypeSubstitution){
module->replaceLastMainType(this);
module->setActualXsdConstruct(c_complexType);
}
type.upload(Mstring("record"));
xsdtype = n_complexType;
break;
- case fromTagSubstition:
+ case fromTagSubstitution:
type.upload(Mstring("union"));
name.upload(getName().originalValueWoPrefix + Mstring("_group"));
xsdtype = n_union;
subsGroup = this;
variant.clear();
+ hidden_variant.clear();
enumeration.modified = false;
value.modified = false;
pattern.modified = false;
length.modified = false;
whitespace.modified = false;
break;
+ case fromTypeSubstitution:
+ type.upload(Mstring("union"));
+ name.upload(getName().originalValueWoPrefix + Mstring("_derivations"));
+ xsdtype = n_union;
+ substitutionGroup = empty_string;
+ typeSubsGroup = this;
+ variant.clear();
+ hidden_variant.clear();
+ enumeration.modified = false;
+ value.modified = false;
+ pattern.modified = false;
+ length.modified = false;
+ whitespace.modified = false;
}
}
reference_resolving_funtion();
- if(!substitionGroup.empty()){
+ if(!substitutionGroup.empty()){
addToSubstitutions();
}
resolved = Yes;
void ComplexType::reference_resolving_funtion() {
//Every child element references are resolved here.
if (outside_reference.empty() && basefield == NULL) {
+ //Its not in the resolveElement function because we need the built in type
+ //reference too, and then the outside_reference is empty.
+ if(xsdtype == n_element){
+ collectElementTypes(NULL, NULL);
+ }
return;
}
resolveUnion(st);
+ addToTypeSubstitutions();
+
}
void ComplexType::setParent(ComplexType * par, SimpleType * child) {
void ComplexType::applyReference(const SimpleType & other, const bool on_attributes) {
type.convertedValue = other.getType().convertedValue;
- type.originalValueWoPrefix = other.getType().convertedValue;
+ type.originalValueWoPrefix = other.getType().convertedValue.getValueWithoutPrefix(':');
if (other.getMinOccurs() > minOccurs || other.getMaxOccurs() < maxOccurs) {
if (!on_attributes) {
}
//Substitution group ordering
- if(subsGroup == this){ //We are a generated substitution group
+ if(subsGroup == this || typeSubsGroup == this){ //We are a generated substitution group
//Substitution group never empty
ComplexType * front = complexfields.front();
List<ComplexType*>::iterator it = complexfields.begin();
if (useUnionVariantWhenMainTypeIsRecordOf) {
container.push_back(Mstring("variant ([-]) \"useUnion\";\n"));
}
+ for (List<Mstring>::iterator var = hidden_variant.end(); var; var = var->Prev) {
+ container.push_back(Mstring("//variant ") + Mstring(var->Data.c_str()) + Mstring(";\n"));
+ }
}
//Collect variants of attributes
} else {
attr->setTypeOfField(st->getName().convertedValue);
if (st->getType().convertedValue == "record" || st->getType().convertedValue == "union") {
- st->addToNameDepList(attr);
+ st->addToNameDepList(attr);
+ }
}
- }
} else {
printError(module->getSchemaname(), name.convertedValue,
"Reference for a non-defined type: " + attr->getReference().repr());
if (xsdtype == n_element && !outside_reference.empty()) {
outside_reference.set_resolved(st);
type.upload(st->getModule()->getTargetNamespaceConnector() + Mstring(":") + st->getName().convertedValue);
- st->addToNameDepList(this);
- nameDep = st;
if (name.originalValueWoPrefix.empty()) {
name.upload(st->getName().convertedValue);
}
if (fromRef) {
addNameSpaceAsVariant(this, st);
}
+
+ collectElementTypes(st, NULL);
+
+ //Namedep is added to the substitutions, if any
if(st->getSubstitution() != NULL){
st->getSubstitution()->addToNameDepList(this);
nameDep = st->getSubstitution();
+ }if(st->getTypeSubstitution() != NULL){
+ st->getTypeSubstitution()->addToNameDepList(this);
+ nameDep = st->getTypeSubstitution();
+ }else {
+ st->addToNameDepList(this);
+ nameDep = st;
}
}
}
st->referenceResolving();
}
st->addToNameDepList(basefield);
- addNameSpaceAsVariant(basefield, st);
basefield->nameDep = st;
+ addNameSpaceAsVariant(basefield, st);
}
} else if(!isBuiltInType(basefield->getType().convertedValue)){
printError(module->getSchemaname(), name.convertedValue,
}
}
-void ComplexType::addSubstitution(SimpleType* st){
+//Element substitution
+void ComplexType::addSubstitution(SimpleType * st){
ComplexType * element;
if(st->getXsdtype() == n_NOTSET || !complexfields.empty()){
- element = new ComplexType(*st, fromTagSubstition);
+ element = new ComplexType(*st, fromTagSubstitution);
}else {
element = new ComplexType(*(ComplexType*)st);
element->variant.clear();
}
element->subsGroup = this;
element->parent = this;
- if(complexfields.empty()){ //The first element(head)
+ if(complexfields.empty()){ //The first element(head) is the st
element->setTypeValue(st->getType().convertedValue);
if(st->hasVariant(Mstring("\"abstract\""))){
- element->addVariant(V_onlyValueHidden, Mstring("\"abstract\""));
+ element->addVariant(V_abstract);
+ }
+ if(st->getReference().get_ref() != NULL){
+ ((SimpleType*)st->getReference().get_ref())->addToNameDepList(element);
+ nameDep = ((SimpleType*)st->getReference().get_ref());
}
+ module->addElementType(element->getType().convertedValue, element);
+ element->addVariant(V_formAs, Mstring("qualified"));
}else {
Mstring newType;
if(st->getType().convertedValue == "anyType"){
}else {
newType = st->getName().convertedValue;
st->addToNameDepList(element);
+ element->nameDep = st;
}
element->setTypeValue(newType);
BlockValue front_block = complexfields.front()->getBlock();
if(front_block == all || front_block == substitution){
- element->addVariant(V_onlyValueHidden, Mstring("\"block\""));
+ element->addVariant(V_block);
}else if(front_block == restriction || front_block == extension){
const Mstring& head_type = complexfields.front()->getType().convertedValue.getValueWithoutPrefix(':');
+ //To decide if they came from a common ancestor
Mstring elem_type = findRoot(front_block, st, head_type, true);
if(head_type == elem_type){
- element->addVariant(V_onlyValueHidden, Mstring("\"block\""));
+ element->addVariant(V_block);
}
}
}
complexfields.push_back(element);
}
+void ComplexType::addTypeSubstitution(SimpleType * st){
+ ComplexType * element;
+ if(st->getXsdtype() == n_NOTSET || !complexfields.empty()){
+ element = new ComplexType(*st, fromTypeSubstitution);
+ }else {
+ //Only need a plain complextype
+ //Head element
+ element = new ComplexType(this);
+ //Just the block needed from st
+ element->block = st->getBlock();
+ }
+ st->addToNameDepList(element);
+ element->nameDep = st;
+ element->typeSubsGroup = this;
+ element->parent = this;
+ if(complexfields.empty()){ //The first element(head) is the st
+ if(st->hasVariant(Mstring("\"abstract\""))){
+ element->addVariant(V_abstract);
+ }
+ }else {
+ BlockValue front_block = complexfields.front()->getBlock();
+ if(front_block == all){
+ element->addVariant(V_block);
+ }else if(front_block == restriction || front_block == extension){
+ const Mstring& head_type = complexfields.front()->getType().convertedValue.getValueWithoutPrefix(':');
+ //To decide if they came from a common ancestor
+ Mstring elem_type = findRoot(front_block, st, head_type, true);
+ if(head_type == elem_type){
+ element->addVariant(V_block);
+ }
+ }
+ }
+ element->top = false;
+ complexfields.push_back(element);
+ element->setTypeValue(st->getName().convertedValue.getValueWithoutPrefix(':'));
+ element->setNameValue(st->getName().convertedValue.getValueWithoutPrefix(':'));
+}
+
Mstring ComplexType::findRoot(const BlockValue block_value, SimpleType* elem, const Mstring& head_type, const bool first){
- if(!first && elem->getType().convertedValue.getValueWithoutPrefix(':') == head_type && !isFromRef()){
- return elem->getType().convertedValue.getValueWithoutPrefix(':');
- }else if(elem->getType().convertedValue.getValueWithoutPrefix(':') == head_type && (isFromRef() && ((elem->getMode() == restrictionMode && block_value == restriction) || (elem->getMode() == extensionMode && block_value == extension)))){
- return elem->getType().convertedValue.getValueWithoutPrefix(':');
+ const Mstring elemName = elem->getName().convertedValue.getValueWithoutPrefix(':');
+ const Mstring elemType = elem->getType().convertedValue.getValueWithoutPrefix(':');
+
+ if(!first && !isFromRef() && elemType == head_type){
+ return elemType;
+ }else if((isFromRef() &&
+ ((elem->getMode() == restrictionMode && block_value == restriction) ||
+ (elem->getMode() == extensionMode && block_value == extension))) && elemType == head_type){
+ return elemType;
+ }else if(!first && elemName == head_type){
+ return elemName;
}else {
SimpleType * st = NULL;
if((elem->getMode() == restrictionMode && block_value == restriction) ||
}
}
if(elem->getMode() == noMode && !first){
- return elem->getType().convertedValue.getValueWithoutPrefix(':');
+ return elemType;
}else {
return empty_string;
}
fromTagUnion,
fromTagNillable,
fromTagComplexType,
- fromTagSubstition
+ fromTagSubstitution,
+ fromTypeSubstitution
};
enum Resolv_State {
~ComplexType();
void modifyAttributeParent();
- void addSubstitution(SimpleType* st);
+ void addSubstitution(SimpleType * st);
+ void addTypeSubstitution(SimpleType * st);
/** Virtual methods
* inherited from RootType
void nameConversion(NameConversionMode mode, const List<NamespaceType> & ns);
void finalModification();
bool hasUnresolvedReference(){ return resolved == No; }
+ void setNameDep(SimpleType * dep) { nameDep = dep; }
void dump(unsigned int depth) const;
# libraries for the linker
LDLIBS += -lxml2 -lcrypto
+ifdef MINGW
+LDLIBS += -lregex
+endif
+
all run: $(TARGETS) $(PROGRAMS)
xsd2ttcn$(EXESUFFIX): $(OBJECTS)
case V_useOrder:
variantstring = "\"useOrder\"";
break;
+ case V_useType:
+ variantstring = "\"useType\"";
+ break;
case V_useUnion:
variantstring = "\"useUnion\"";
break;
return true;
}
}
+ for(List<Mstring>::iterator vars = hidden_variant.begin(); vars; vars = vars->Next){
+ if(vars->Data.isFound(var)){
+ return true;
+ }
+ }
return false;
}
\ No newline at end of file
V_useNil,
V_useNumber,
V_useOrder,
+ V_useType,
V_useUnion,
V_whiteSpace,
V_fractionDigits
visible = false;
}
+ void setVisible() {
+ visible = true;
+ }
+
const NameType & getName() const {
return name;
}
return comment;
}
+ List<SimpleType*> & getNameDepList() {
+ return nameDepList;
+ }
+
XMLParser * getParser() const {
return parser;
}
#include "ComplexType.hh"
extern bool g_flag_used;
+extern bool h_flag_used;
SimpleType::SimpleType(XMLParser * a_parser, TTCN3Module * a_module, ConstructType a_construct)
: RootType(a_parser, a_module, a_construct)
, fromRef(false)
, xsdtype(n_NOTSET)
, isOptional(false)
-, substitionGroup(empty_string)
+, substitutionGroup(empty_string)
, subsGroup(NULL)
+, typeSubsGroup(NULL)
+, addedToTypeSubstitution(false)
, block(not_set)
, parent(NULL) {
}
, fromRef(other.fromRef)
, xsdtype(other.xsdtype)
, isOptional(other.isOptional)
-, substitionGroup(other.substitionGroup)
+, substitutionGroup(other.substitutionGroup)
, subsGroup(other.subsGroup)
+, typeSubsGroup(other.typeSubsGroup)
+, addedToTypeSubstitution(other.addedToTypeSubstitution)
, block(other.block)
, parent(NULL) {
length.parent = this;
void SimpleType::applyAbstractAttribute(const bool abstract_value) {
if (abstract_value) {
- addVariant(V_onlyValueHidden, Mstring("\"abstract\""));
+ addVariant(V_abstract);
}
}
-void SimpleType::applySubstitionGroupAttribute(const Mstring& substition_group){
- if(!substition_group.empty()){
- substitionGroup = substition_group;
+void SimpleType::applySubstitionGroupAttribute(const Mstring& substitution_group){
+ if(!substitution_group.empty()){
+ substitutionGroup = substitution_group;
}
}
}
void SimpleType::addToSubstitutions(){
- if(!g_flag_used){
+ if(!g_flag_used || substitutionGroup.empty()){
return;
}
- SimpleType * st_ = (SimpleType*) TTCN3ModuleInventory::getInstance().lookup(this, substitionGroup, want_BOTH);
+ SimpleType * st_ = (SimpleType*) TTCN3ModuleInventory::getInstance().lookup(this, substitutionGroup, want_BOTH);
if(st_ == NULL){
printError(module->getSchemaname(), name.convertedValue,
- "Reference for a non-defined type: " + substitionGroup);
+ "Reference for a non-defined type: " + substitutionGroup);
TTCN3ModuleInventory::getInstance().incrNumErrors();
- return;
return;
}
SimpleType * st = (SimpleType*)st_;
}
st->referenceResolving();
- substitionGroup = empty_string;
+ substitutionGroup = empty_string;
//Simpletype
if(st->subsGroup == NULL){
- ComplexType * head_element = new ComplexType(*st, ComplexType::fromTagSubstition);
+ ComplexType * head_element = new ComplexType(*st, ComplexType::fromTagSubstitution);
for(List<SimpleType*>::iterator simpletype = st->nameDepList.begin(); simpletype; simpletype = simpletype->Next){
- head_element->nameDepList.push_back(simpletype->Data);
+ head_element->getNameDepList().push_back(simpletype->Data);
}
st->nameDepList.clear();
st->getModule()->addMainType(head_element);
}
}
+void SimpleType::addToTypeSubstitutions() {
+ //If the user did not request type substitution generation or
+ //the type is already added to type substitution
+ if(!h_flag_used || addedToTypeSubstitution){
+ return;
+ }
+ //Only available if it is a restricion or extension
+ if(mode != extensionMode && mode != restrictionMode){
+ return;
+ }
+ //Only top level complexTypes or simpleTypes, ergo no elements
+ if(parent != NULL || hasVariant(Mstring("\"element\""))){
+ return;
+ }
+
+ //It would be nice if here outside_reference.resolved to everything
+ SimpleType * st = (SimpleType*)outside_reference.get_ref();
+ bool newST = false;
+ if(st == NULL && !isBuiltInType(type.convertedValue)){
+ //Not even a reference, and not a built in type
+ return;
+ }else if(st == NULL && isBuiltInType(type.convertedValue)){
+ st = new SimpleType(parser, module, construct);
+ st->type.upload(type.convertedValue);
+ st->name.upload(type.convertedValue);
+ st->typeSubsGroup = findBuiltInTypeInStoredTypeSubstitutions(type.convertedValue);
+ newST = true;
+ }
+
+ addedToTypeSubstitution = true;
+
+ //If type substitution is NULL then we need to create the union
+ if(st->getTypeSubstitution() == NULL){
+ ComplexType * head_element = new ComplexType(*st, ComplexType::fromTypeSubstitution);
+ for(List<SimpleType*>::iterator simpletype = st->nameDepList.begin(); simpletype; simpletype = simpletype->Next){
+ head_element->getNameDepList().push_back(simpletype->Data);
+ }
+ st->nameDepList.clear();
+ st->getModule()->addMainType(head_element);
+ head_element->addVariant(V_useType);
+ head_element->addTypeSubstitution(st);
+ head_element->addTypeSubstitution(this);
+ bool found = false;
+ //Check to find if there was already an element reference with this type
+ for(List<typeNameDepList>::iterator str = module->getElementTypes().begin(); str; str = str->Next){
+ Mstring prefix = str->Data.type.getPrefix(':');
+ Mstring value = str->Data.type.getValueWithoutPrefix(':');
+
+ if((value == st->getName().convertedValue.getValueWithoutPrefix(':') && prefix == module->getTargetNamespaceConnector()) ||
+ (isBuiltInType(value) && !isBuiltInType(st->getType().convertedValue) && value == st->getType().convertedValue && prefix == module->getTargetNamespaceConnector())){
+ //Push the namedeplist
+ for(List<SimpleType*>::iterator simpletype = str->Data.nameDepList.begin(); simpletype; simpletype = simpletype->Next){
+ head_element->getNameDepList().push_back(simpletype->Data);
+ }
+ found = true;
+ str->Data.typeSubsGroup = head_element;
+ break;
+ }
+ }
+ if(!found){
+ head_element->setInvisible();
+ }
+ st->typeSubsGroup = head_element;
+ st->getModule()->addStoredTypeSubstitution(head_element);
+ }else {
+ st->getTypeSubstitution()->addTypeSubstitution(this);
+ }
+
+ //Free pointer
+ if(newST){
+ delete st;
+ st = NULL;
+ }
+}
+
+void SimpleType::collectElementTypes(SimpleType* found_ST, ComplexType* found_CT){
+ //Only if type substitution is enabled and it is a top level(simpletype) element or
+ //it is a not top level element(complextype)
+ if(h_flag_used && (hasVariant(Mstring("\"element\"")) || xsdtype == n_element)){
+ SimpleType * st = NULL, *nameDep = NULL;
+ Mstring uri, value, type_;
+ if(found_ST != NULL || found_CT != NULL){
+ // st := found_ST or found_CT, which is not null
+ st = found_ST != NULL ? found_ST : found_CT;
+ uri = outside_reference.get_uri();
+ value = outside_reference.get_val();
+ type_ = value;
+ }else if(isBuiltInType(type.convertedValue)){
+ st = this;
+ uri = module->getTargetNamespace();
+ value = type.convertedValue;
+ if(outside_reference.empty()){
+ type_ = value;
+ nameDep = this;
+ }else {
+ type_ = outside_reference.get_val();
+ }
+ }else {
+ //It is not possible to reach here (should be)
+ return;
+ }
+ type_ = type_.getValueWithoutPrefix(':');
+ bool found = false;
+ const Mstring typeSubsName = value + Mstring("_derivations");
+ //Find if we already have a substitution type to this element reference
+ for(List<ComplexType*>::iterator complex = st->getModule()->getStoredTypeSubstitutions().begin(); complex; complex = complex->Next){
+
+ if(uri == st->getModule()->getTargetNamespace() && typeSubsName == complex->Data->getName().convertedValue){
+ complex->Data->setVisible();
+ if(st->getXsdtype() != n_NOTSET && this == st){ //otherwise records would be renamed too
+ complex->Data->addToNameDepList(st);
+ ((ComplexType*)st)->setNameDep(nameDep);
+ }
+ found = true;
+ break;
+ }
+ }
+ //Add the reference, to future possible type substitution
+ if(!found){
+ Mstring prefix = st->getModule()->getTargetNamespaceConnector();
+ if(prefix != empty_string){
+ prefix += ":";
+ }
+ st->getModule()->addElementType(prefix + type_, nameDep);
+ }
+ }
+}
+
+ComplexType * SimpleType::findBuiltInTypeInStoredTypeSubstitutions(const Mstring& builtInType){
+ const Mstring typeSubsName = builtInType.getValueWithoutPrefix(':') + Mstring("_derivations");
+ for(List<ComplexType*>::iterator complex = module->getStoredTypeSubstitutions().begin(); complex; complex = complex->Next){
+ if(typeSubsName == complex->Data->getName().convertedValue){
+ return complex->Data;
+ }
+ }
+ return NULL;
+}
+
+
void SimpleType::setReference(const Mstring& ref, bool only_name_dependency) {
if (ref.empty()) {
return;
}
void SimpleType::referenceResolving() {
- if (outside_reference.empty() && substitionGroup.empty()) return;
+ if (outside_reference.empty()){
+ addToTypeSubstitutions();
+ collectElementTypes();
+ }
+ if(outside_reference.empty() && substitutionGroup.empty()) return;
if (outside_reference.is_resolved()) return;
if(!outside_reference.empty()){
ComplexType * found_CT = static_cast<ComplexType*> (
TTCN3ModuleInventory::getInstance().lookup(this, want_CT));
// It _is_ possible to find both
-
+ collectElementTypes(found_ST, found_CT);
if (found_ST != NULL) {
if (!found_ST->outside_reference.empty() && !found_ST->outside_reference.is_resolved() && found_ST != this) {
found_ST->outside_reference.set_resolved(NULL);
found_ST->referenceResolving();
}
referenceForST(found_ST);
+ addToTypeSubstitutions();
if (!isBuiltInType(type.convertedValue)) {
found_ST->addToNameDepList(this);
}
} else if (found_CT != NULL) {
referenceForCT(found_CT);
+ addToTypeSubstitutions();
if (!isBuiltInType(type.convertedValue)) {
found_CT->addToNameDepList(this);
}
TTCN3ModuleInventory::getInstance().incrNumErrors();
outside_reference.set_resolved(NULL);
}
- if(!substitionGroup.empty()){
- addToSubstitutions();
- }
- }else if(!substitionGroup.empty()){
+ addToSubstitutions();
+ }else {
addToSubstitutions();
}
}
// XSD Type of the type
TagName xsdtype;
bool isOptional;
- Mstring substitionGroup;
+ Mstring substitutionGroup;
+ //Pointer to the generated element substitution group
ComplexType * subsGroup;
+ //Pointer to the generated type substitution group
+ ComplexType * typeSubsGroup;
+ //To determine if already added to type substitution
+ bool addedToTypeSubstitution;
BlockValue block;
+
+ //Element substitution
+ void addToSubstitutions();
+ //Type substitution
+ void addToTypeSubstitutions();
+ //Returns the type substitution which the builtInType belongs
+ ComplexType * findBuiltInTypeInStoredTypeSubstitutions(const Mstring& builtInType);
- void addToSubstitutions();
+ //Only used when type substitution is enabled
+ //If an element reference is found then it is put to a container
+ //to know if type substitution is possible
+ void collectElementTypes(SimpleType * found_ST = NULL, ComplexType * found_CT = NULL);
void nameConversion_names();
virtual void nameConversion_types(const List<NamespaceType> & ns);
return subsGroup;
}
+ ComplexType * getTypeSubstitution() const {
+ return typeSubsGroup;
+ }
+
BlockValue getBlock() const {
return block;
}
void addToNameDepList(SimpleType * t) {
+ //If the type has a substitution, we add the namedep to the substitution
if(subsGroup != NULL && this != (SimpleType*)subsGroup){
SimpleType * substitution = (SimpleType*)subsGroup;
substitution->addToNameDepList(t);
+ }else if(typeSubsGroup != NULL && this != (SimpleType*)typeSubsGroup){
+ SimpleType * substitution = (SimpleType*)typeSubsGroup;
+ substitution->addToNameDepList(t);
}else {
nameDepList.push_back(t);
}
, elementFormDefault(notset)
, attributeFormDefault(notset)
, blockDefault(not_set)
+, storedTypeSubstitutions()
+, element_types()
//, importedModules()
, variant()
, moduleNotIntoFile(false)
class TTCN3ModuleInventory;
class RootType;
+//Used only in type substitution, when we have to change the type or a builtintype
+//due to type substitution
+struct typeNameDepList {
+ Mstring type;
+ List<SimpleType*> nameDepList;
+ //Used only with builtInTypes
+ ComplexType* typeSubsGroup;
+};
+
/**
* Type that contains information about one TTCN-3 module
* and performs the generation of that module
List<const TTCN3Module*> importedModules; // pointers not owned
+ //Used only in type substitution, stores every possibly substituted type definitions
+ List<ComplexType*> storedTypeSubstitutions; //pointers not owned
+
+ //Used only in type substitution, stores every element that references a type
+ List<typeNameDepList> element_types;
+
List<Mstring> variant;
bool moduleNotIntoFile;
return importedModules;
}
+ List<ComplexType*> & getStoredTypeSubstitutions() {
+ return storedTypeSubstitutions;
+ }
+
+ void addStoredTypeSubstitution(ComplexType * type){
+ storedTypeSubstitutions.push_back(type);
+ }
+
+ List<typeNameDepList> & getElementTypes() {
+ return element_types;
+ }
+
+ void addElementType(const Mstring& type, SimpleType* st) {
+ List<typeNameDepList>::iterator it = element_types.begin();
+ for(; it; it = it->Next){
+ if(it->Data.type == type && st != NULL){
+ it->Data.nameDepList.push_back(st);
+ break;
+ }
+ }
+ //New type that has not been in the element_types before
+ if(it == NULL){
+ typeNameDepList list;
+ list.type = type;
+ list.typeSubsGroup = NULL;
+ if(st != NULL){
+ list.nameDepList.push_back(st);
+ }
+ element_types.push_back(list);
+ }
+ }
+
/// Compute the TTCN-3 module name
void TargetNamespace2ModuleName();
break;
}
}
+ if(uri.empty()){
+ //If the targetnamespace is NoTargetNamespace therefore no prefix connector used
+ uri = ref->getModule()->getTargetNamespace();
+ }
}else {
uri = getNameSpaceByPrefix(ref, uri);
}
att_name_e[i] = a_NOTSET;
if (att_name_s[i] == "abstract") {
att_name_e[i] = a_abstract;
- printWarning(filename, xmlSAX2GetLineNumber(context),
- Mstring("The 'abstract' attribute is currently not supported."));
- ++num_warnings;
} else if (att_name_s[i] == "attributeFormDefault")
att_name_e[i] = a_attributeFormDefault;
else if (att_name_s[i] == "base")
att_name_e[i] = a_base;
else if (att_name_s[i] == "block") {
att_name_e[i] = a_block;
- printWarning(filename, xmlSAX2GetLineNumber(context),
- Mstring("The 'block' attribute is currently not supported."));
- ++num_warnings;
} else if (att_name_s[i] == "blockDefault"){
att_name_e[i] = a_blockDefault;
} else if (att_name_s[i] == "default")
att_name_e[i] = a_schemaLocation;
else if (att_name_s[i] == "substitutionGroup") {
att_name_e[i] = a_substitutionGroup;
- //printWarning(filename, xmlSAX2GetLineNumber(context),
- //Mstring("The 'substitutionGroup' attribute is currently not supported."));
- //++num_warnings;
} else if (att_name_s[i] == "targetNamespace")
att_name_e[i] = a_targetNamespace;
else if (att_name_s[i] == "type")
bool e_flag_used = false;
bool f_flag_used = false;
bool g_flag_used = true;
+bool h_flag_used = false;
bool p_flag_used = false;
bool s_flag_used = false;
bool t_flag_used = false;
char c;
opterr = 0;
- while ((c = getopt(argc, argv, "cdef:gpqstvwxz")) != -1) {
+ while ((c = getopt(argc, argv, "cdef:ghpqstvwxz")) != -1) {
switch (c) {
case 'c':
c_flag_used = true;
case 'g':
g_flag_used = false;
break;
+ case 'h':
+ h_flag_used = true;
+ break;
case 'p':
p_flag_used = true;
break;
" -e: disable the generation of encoding instructions in TTCN-3 modules\n"
" -f file: the names of XSD files are taken from file instead of the command line\n"
" -g: generate TTCN-3 code disallowing element substitution\n"
+ " -h: generate TTCN-3 code allowing type substitution\n"
" -p: do not generate the UsefulTtcn3Types and XSD predefined modules\n"
" -q: quiet mode - disable the issue of status messages\n"
" -s: parse and validate only - no TTCN-3 module generation\n"