Commit 2417b71c authored by BenceJanosSzabo's avatar BenceJanosSzabo
Browse files

Added more info about enc/dec problem (artf190389)



Change-Id: Ieac0cd9a6c1aca8ade00cfae5785d9757897604a
Signed-off-by: default avatarBenceJanosSzabo <bence.janos.szabo@ericsson.com>
parent b603df6d
......@@ -6550,9 +6550,34 @@ namespace Ttcn {
input_type->get_typename().c_str(), encoding_options->c_str());
}
else {
input_type->error("Input type `%s' does not support %s encoding",
input_type->get_typename().c_str(),
// First collect the fields of a record, set, union type which
// does not support the encoding, then write it in the error message.
char* message = NULL;
Type *t = input_type;
if (t->is_ref()) t = t->get_type_refd();
switch(t->get_typetype()) {
case Type::T_SEQ_T:
case Type::T_SET_T:
case Type::T_CHOICE_T: {
for (size_t i = 0; i < t->get_nof_comps(); i++) {
if (!t->get_comp_byIndex(i)->get_type()->has_encoding(encoding_type, encoding_options)) {
if (i == 0) {
message = mputprintf(message, " The following fields do not support %s encoding: ",
Type::get_encoding_name(encoding_type));
} else {
message = mputstr(message, ", ");
}
message = mputstr(message, t->get_comp_id_byIndex(i).get_ttcnname().c_str());
}
}
break; }
default:
break;
}
input_type->error("Input type `%s' does not support %s encoding.%s",
input_type->get_typename().c_str(),
Type::get_encoding_name(encoding_type), message == NULL ? "" : message);
Free(message);
}
}
else {
......
......@@ -89,6 +89,67 @@ external function f_enc_arr1(in AnArray x) return bitstring
external function f_enc_arr2(in AnArray x) return bitstring
with { extension "prototype(convert) encode(codec3)" }
type record A {
integer a
}
type record B {
integer b
}
type record C {
A a,
B b
} with {
encode "XML";
}
type union D {
A a,
B b
} with {
encode "XML";
}
type set E {
A a,
B b
} with {
encode "XML";
}
external function f_enc_C(in C x) return octetstring //^In external function definition \`f_enc_C\'\:// //^error\: Input type \`\@encode_ttcn_SE\.C\' does not support XER encoding\. The following fields do not support XER encoding\: a\, b//
with { extension "prototype(convert) encode(XER:XER_EXTENDED)" };
external function f_enc_D(in D x) return octetstring //^In external function definition \`f_enc_D\'\:// //^error\: Input type \`\@encode_ttcn_SE\.D\' does not support XER encoding\. The following fields do not support XER encoding\: a\, b//
with { extension "prototype(convert) encode(XER:XER_EXTENDED)" };
external function f_enc_E(in E x) return octetstring //^In external function definition \`f_enc_E\'\:// //^error\: Input type \`\@encode_ttcn_SE\.E\' does not support XER encoding\. The following fields do not support XER encoding\: a\, b//
with { extension "prototype(convert) encode(XER:XER_EXTENDED)" };
external function f_enc_A(in A x) return octetstring //^In external function definition \`f_enc_A\'\:// //^error\: Input type \`\@encode_ttcn_SE\.A\' does not support XER encoding\.//
with { extension "prototype(convert) encode(XER:XER_EXTENDED)" };
type record A2 {
integer a
} with {
encode "XML";
}
type record B2 {
integer b
} with {
encode "XML";
}
type record C2 {
A a,
B b
}
external function f_enc_C2(in C2 x) return octetstring //^In external function definition \`f_enc_C2\'\:// //^error\: Input type \`\@encode_ttcn_SE\.C2\' does not support XER encoding\.//
with { extension "prototype(convert) encode(XER:XER_EXTENDED)" };
} with {
encode "whatever"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment