diff --git a/compiler2/AST.cc b/compiler2/AST.cc index fcaf27e50ebdaec2a2e583b763ae9765ea07f690..77b889de39ca18d17cadbddd0abbf254a3a56234 100644 --- a/compiler2/AST.cc +++ b/compiler2/AST.cc @@ -1000,7 +1000,7 @@ namespace Common { } else has_set_param = false; // get_param function bool has_get_param; - if (output->functions.get_param) { + if (use_runtime_2 && output->functions.get_param) { output->source.static_function_prototypes = mputprintf(output->source.static_function_prototypes, "%sModule_Param* get_module_param(Module_Param_Name& param_name);\n", split_to_slices ? "extern " : "static "); output->source.static_function_bodies = mputprintf(output->source.static_function_bodies, diff --git a/compiler2/enum.c b/compiler2/enum.c index 2bd1e89364b6367501c69949d40bc1be2cd29d73..c1d1d006bd639a7adca08c26bbb4a370926ed9a6 100644 --- a/compiler2/enum.c +++ b/compiler2/enum.c @@ -381,7 +381,9 @@ void defEnumClass(const enum_def *edef, output_struct *output) (src, "void %s::set_param(Module_Param& param)\n" "{\n" - " param.basic_check(Module_Param::BC_VALUE, \"enumerated value\");\n" + " param.basic_check(Module_Param::BC_VALUE, \"enumerated value\");\n", name); + if (use_runtime_2) { + src = mputprintf(src, " Module_Param_Ptr m_p = ¶m;\n" " if (param.get_type() == Module_Param::MP_Reference) {\n" /* enumerated values are also treated as references (containing only 1 name) by the parser; @@ -394,24 +396,29 @@ void defEnumClass(const enum_def *edef, output_struct *output) " }\n" /* it's not a valid enum value => dereference it! */ " m_p = param.get_referenced_param();\n" - " }\n" - " if (m_p->get_type()!=Module_Param::MP_Enumerated) param.type_error(\"enumerated value\", \"%s\");\n" - " enum_value = str_to_enum(m_p->get_enumerated());\n" + " }\n", unknown_value); + } + src = mputprintf(src, + " if (%sget_type()!=Module_Param::MP_Enumerated) param.type_error(\"enumerated value\", \"%s\");\n" + " enum_value = str_to_enum(%sget_enumerated());\n" " if (!is_valid_enum(enum_value)) {\n" " param.error(\"Invalid enumerated value for type %s.\");\n" " }\n" - "}\n\n", name, unknown_value, dispname, dispname); + "}\n\n", use_runtime_2 ? "m_p->" : "param.", dispname, + use_runtime_2 ? "m_p->" : "param.", dispname); - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf - (src, - "Module_Param* %s::get_param(Module_Param_Name& /* param_name */) const\n" - "{\n" - " if (!is_bound()) {\n" - " return new Module_Param_Unbound();\n" - " }\n" - " return new Module_Param_Enumerated(mcopystr(enum_to_str(enum_value)));\n" - "}\n\n", name); + if (use_runtime_2) { + def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); + src = mputprintf + (src, + "Module_Param* %s::get_param(Module_Param_Name& /* param_name */) const\n" + "{\n" + " if (!is_bound()) {\n" + " return new Module_Param_Unbound();\n" + " }\n" + " return new Module_Param_Enumerated(mcopystr(enum_to_str(enum_value)));\n" + "}\n\n", name); + } /* encoders/decoders */ def = mputstr(def, "void encode_text(Text_Buf& text_buf) const;\n"); @@ -1359,7 +1366,9 @@ void defEnumTemplate(const enum_def *edef, output_struct *output) "void %s_template::set_param(Module_Param& param)\n" "{\n" " param.basic_check(Module_Param::BC_TEMPLATE, \"enumerated template\");\n" - " Module_Param_Ptr m_p = ¶m;\n" + " Module_Param_Ptr m_p = ¶m;\n", name); + if (use_runtime_2) { + src = mputprintf(src, " if (param.get_type() == Module_Param::MP_Reference) {\n" /* enumerated values are also treated as references (containing only 1 name) by the parser; first check if the reference name is a valid enumerated value */ @@ -1373,7 +1382,9 @@ void defEnumTemplate(const enum_def *edef, output_struct *output) " }\n" /* it's not a valid enum value => dereference it! */ " m_p = param.get_referenced_param();\n" - " }\n" + " }\n", enum_type, name, unknown_value, name); + } + src = mputprintf(src, " switch (m_p->get_type()) {\n" " case Module_Param::MP_Omit:\n" " *this = OMIT_VALUE;\n" @@ -1404,53 +1415,55 @@ void defEnumTemplate(const enum_def *edef, output_struct *output) " default:\n" " param.type_error(\"enumerated template\", \"%s\");\n" " }\n" - " is_ifpresent = param.get_ifpresent() || m_p->get_ifpresent();\n" - "}\n\n", name, enum_type, name, unknown_value, name - , name, enum_type, name, name, dispname, dispname); + " is_ifpresent = param.get_ifpresent()%s;\n" + "}\n\n", name, enum_type, name, name, dispname, dispname, + use_runtime_2 ? " || m_p->get_ifpresent()" : ""); - /* get_param() */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf - (src, - "Module_Param* %s_template::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " Module_Param* m_p = NULL;\n" - " switch (template_selection) {\n" - " case UNINITIALIZED_TEMPLATE:\n" - " m_p = new Module_Param_Unbound();\n" - " break;\n" - " case OMIT_VALUE:\n" - " m_p = new Module_Param_Omit();\n" - " break;\n" - " case ANY_VALUE:\n" - " m_p = new Module_Param_Any();\n" - " break;\n" - " case ANY_OR_OMIT:\n" - " m_p = new Module_Param_AnyOrNone();\n" - " break;\n" - " case SPECIFIC_VALUE:\n" - " m_p = new Module_Param_Enumerated(mcopystr(%s::enum_to_str(single_value)));\n" - " break;\n" - " case VALUE_LIST:\n" - " case COMPLEMENTED_LIST: {\n" - " if (template_selection == VALUE_LIST) {\n" - " m_p = new Module_Param_List_Template();\n" - " }\n" - " else {\n" - " m_p = new Module_Param_ComplementList_Template();\n" - " }\n" - " for (size_t i_i = 0; i_i < value_list.n_values; ++i_i) {\n" - " m_p->add_elem(value_list.list_value[i_i].get_param(param_name));\n" - " }\n" - " break; }\n" - " default:\n" - " break;\n" - " }\n" - " if (is_ifpresent) {\n" - " m_p->set_ifpresent();\n" - " }\n" - " return m_p;\n" - "}\n\n", name, name); + /* get_param(), RT2 only */ + if (use_runtime_2) { + def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); + src = mputprintf + (src, + "Module_Param* %s_template::get_param(Module_Param_Name& param_name) const\n" + "{\n" + " Module_Param* m_p = NULL;\n" + " switch (template_selection) {\n" + " case UNINITIALIZED_TEMPLATE:\n" + " m_p = new Module_Param_Unbound();\n" + " break;\n" + " case OMIT_VALUE:\n" + " m_p = new Module_Param_Omit();\n" + " break;\n" + " case ANY_VALUE:\n" + " m_p = new Module_Param_Any();\n" + " break;\n" + " case ANY_OR_OMIT:\n" + " m_p = new Module_Param_AnyOrNone();\n" + " break;\n" + " case SPECIFIC_VALUE:\n" + " m_p = new Module_Param_Enumerated(mcopystr(%s::enum_to_str(single_value)));\n" + " break;\n" + " case VALUE_LIST:\n" + " case COMPLEMENTED_LIST: {\n" + " if (template_selection == VALUE_LIST) {\n" + " m_p = new Module_Param_List_Template();\n" + " }\n" + " else {\n" + " m_p = new Module_Param_ComplementList_Template();\n" + " }\n" + " for (size_t i_i = 0; i_i < value_list.n_values; ++i_i) {\n" + " m_p->add_elem(value_list.list_value[i_i].get_param(param_name));\n" + " }\n" + " break; }\n" + " default:\n" + " break;\n" + " }\n" + " if (is_ifpresent) {\n" + " m_p->set_ifpresent();\n" + " }\n" + " return m_p;\n" + "}\n\n", name, name); + } if (!use_runtime_2) { /* check template restriction */ diff --git a/compiler2/functionref.c b/compiler2/functionref.c index cf9a2f22da50a0bf53f3e8f133f948b36e0db423..5eb44842452a6a76bbdace5be86245b4f0d6619b 100644 --- a/compiler2/functionref.c +++ b/compiler2/functionref.c @@ -287,12 +287,14 @@ void defFunctionrefClass(const funcref_def *fdef, output_struct *output) " param.error(\"Not supported.\");\n" "}\n\n", name); - /* get_param */ - def = mputstr(def,"Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf(src,"Module_Param* %s::get_param(Module_Param_Name& /* param_name */) const\n" - "{\n" - " return NULL;\n" - "}\n\n", name); + /* get_param, RT2 only */ + if (use_runtime_2) { + def = mputstr(def,"Module_Param* get_param(Module_Param_Name& param_name) const;\n"); + src = mputprintf(src,"Module_Param* %s::get_param(Module_Param_Name& /* param_name */) const\n" + "{\n" + " return NULL;\n" + "}\n\n", name); + } /* encode_text / decode_text */ def = mputstr(def,"void encode_text(Text_Buf& text_buf) const;\n"); @@ -777,12 +779,14 @@ void defFunctionrefTemplate(const funcref_def *fdef, output_struct *output) " param.error(\"Not supported.\");\n" "}\n\n", name); - /* get_param */ - def = mputstr(def,"Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf(src,"Module_Param* %s_template::get_param(Module_Param_Name& /* param_name */) const\n" - "{\n" - " return NULL;\n" - "}\n\n", name); + /* get_param, RT2 only */ + if (use_runtime_2) { + def = mputstr(def,"Module_Param* get_param(Module_Param_Name& param_name) const;\n"); + src = mputprintf(src,"Module_Param* %s_template::get_param(Module_Param_Name& /* param_name */) const\n" + "{\n" + " return NULL;\n" + "}\n\n", name); + } if (!use_runtime_2) { /* check template restriction */ diff --git a/compiler2/makefile.c b/compiler2/makefile.c index 2e33c9298db9fc980329c3cdf692ee8104e7ee63..0b06642e98669dc25e3e2116fbd678fe975b8053 100644 --- a/compiler2/makefile.c +++ b/compiler2/makefile.c @@ -1250,7 +1250,8 @@ static void add_file_to_makefile(struct makefile_struct *makefile, char *argumen add_ttcn3_module(makefile, file_name, module_name); } } else if (is_asn1_module(file_name, fp, &module_name)) { - if (is_valid_asn1_filename(file_name)) { + expstring_t only_file_name = get_file_from_path(file_name); + if (is_valid_asn1_filename(only_file_name)) { add_asn1_module(makefile, file_name, module_name); } else { ERROR("The file name `%s' (without suffix) shall be identical to the module name `%s'.\n" @@ -1258,6 +1259,7 @@ static void add_file_to_makefile(struct makefile_struct *makefile, char *argumen "file name shall contain an underscore character instead.", file_name, module_name); Free(module_name); } + Free(only_file_name); } else if (is_xsd_module(file_name, &module_name)) { add_xsd_module(makefile, file_name, module_name); } else { diff --git a/compiler2/record.c b/compiler2/record.c index 88c06f4aaafb3de963cde6d162b44ebc25aac7f2..66e70ef82a59cbc8fae9f9cc619828d11357f959 100644 --- a/compiler2/record.c +++ b/compiler2/record.c @@ -3411,31 +3411,27 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) "param.error(\"Field `%%s' not found in %s type `%s'\", param_field);\n" " }\n" " param.basic_check(Module_Param::BC_VALUE, \"%s value\");\n" - " Module_Param_Ptr m_p = ¶m;\n" - " if (param.get_type() == Module_Param::MP_Reference) {\n" - " m_p = param.get_referenced_param();\n" - " }\n" - " switch (m_p->get_type()) {\n" + " switch (param.get_type()) {\n" " case Module_Param::MP_Value_List:\n" - " if (%lu<m_p->get_size()) {\n" - " param.error(\"%s value of type %s has %lu fields but list value has %%d fields\", (int)m_p->get_size());\n" + " if (%lu<param.get_size()) {\n" + " param.error(\"%s value of type %s has %lu fields but list value has %%d fields\", (int)param.get_size());\n" " }\n", kind_str, dispname, kind_str, (unsigned long)sdef->nElements, kind_str, dispname, (unsigned long)sdef->nElements); for (i = 0; i < sdef->nElements; ++i) { src = mputprintf(src, - " if (m_p->get_size()>%lu && m_p->get_elem(%lu)->get_type()!=Module_Param::MP_NotUsed) %s().set_param(*m_p->get_elem(%lu));\n", + " if (param.get_size()>%lu && param.get_elem(%lu)->get_type()!=Module_Param::MP_NotUsed) %s().set_param(*param.get_elem(%lu));\n", (unsigned long)i, (unsigned long)i, sdef->elements[i].name, (unsigned long)i); } src = mputstr(src, " break;\n" " case Module_Param::MP_Assignment_List: {\n" - " Vector<bool> value_used(m_p->get_size());\n" - " value_used.resize(m_p->get_size(), false);\n"); + " Vector<bool> value_used(param.get_size());\n" + " value_used.resize(param.get_size(), false);\n"); for (i = 0; i < sdef->nElements; ++i) { src = mputprintf(src, - " for (size_t val_idx=0; val_idx<m_p->get_size(); val_idx++) {\n" - " Module_Param* const curr_param = m_p->get_elem(val_idx);\n" + " for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {\n" + " Module_Param* const curr_param = param.get_elem(val_idx);\n" " if (!strcmp(curr_param->get_id()->get_name(), \"%s\")) {\n" " if (curr_param->get_type()!=Module_Param::MP_NotUsed) {\n" " %s().set_param(*curr_param);\n" @@ -3446,8 +3442,8 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) , sdef->elements[i].dispname, sdef->elements[i].name); } src = mputprintf(src, - " for (size_t val_idx=0; val_idx<m_p->get_size(); val_idx++) if (!value_used[val_idx]) {\n" - " m_p->get_elem(val_idx)->error(\"Non existent field name in type %s: %%s\", m_p->get_elem(val_idx)->get_id()->get_name());\n" + " for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {\n" + " param.get_elem(val_idx)->error(\"Non existent field name in type %s: %%s\", param.get_elem(val_idx)->get_id()->get_name());\n" " break;\n" " }\n" " } break;\n" @@ -3455,48 +3451,6 @@ void defRecordClass1(const struct_def *sdef, output_struct *output) " param.type_error(\"%s value\", \"%s\");\n" " }\n" "}\n\n", dispname, kind_str, dispname); - - /* get param function */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf(src, - "Module_Param* %s::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " if (!is_bound()) {\n" - " return new Module_Param_Unbound();\n" - " }\n" - " if (param_name.next_name()) {\n" - // Haven't reached the end of the module parameter name - // => the name refers to one of the fields, not to the whole record - " char* param_field = param_name.get_current_name();\n" - " if (param_field[0] >= '0' && param_field[0] <= '9') {\n" - " TTCN_error(\"Unexpected array index in module parameter reference, \"\n" - " \"expected a valid field name for %s type `%s'\");\n" - " }\n" - " ", name, kind_str, dispname); - for (i = 0; i < sdef->nElements; i++) { - src = mputprintf(src, - "if (strcmp(\"%s\", param_field) == 0) {\n" - " return %s().get_param(param_name);\n" - " } else ", - sdef->elements[i].dispname, sdef->elements[i].name); - } - src = mputprintf(src, - "TTCN_error(\"Field `%%s' not found in %s type `%s'\", param_field);\n" - " }\n" - " Module_Param_Assignment_List* m_p = new Module_Param_Assignment_List();\n" - , kind_str, dispname); - for (i = 0; i < sdef->nElements; i++) { - src = mputprintf(src, - " Module_Param* mp_field_%s = field_%s.get_param(param_name);\n" - " mp_field_%s->set_id(new Module_Param_FieldName(mcopystr(\"%s\")));\n" - " m_p->add_elem(mp_field_%s);\n" - , sdef->elements[i].name, sdef->elements[i].name - , sdef->elements[i].name, sdef->elements[i].dispname - , sdef->elements[i].name); - } - src = mputstr(src, - " return m_p;\n" - " }\n\n"); /* set implicit omit function, recursive */ def = mputstr(def, " void set_implicit_omit();\n"); @@ -5675,11 +5629,7 @@ void defRecordTemplate1(const struct_def *sdef, output_struct *output) "param.error(\"Field `%%s' not found in %s template type `%s'\", param_field);\n" " }\n" " param.basic_check(Module_Param::BC_TEMPLATE, \"%s template\");\n" - " Module_Param_Ptr m_p = ¶m;\n" - " if (param.get_type() == Module_Param::MP_Reference) {\n" - " m_p = param.get_referenced_param();\n" - " }\n" - " switch (m_p->get_type()) {\n" + " switch (param.get_type()) {\n" " case Module_Param::MP_Omit:\n" " *this = OMIT_VALUE;\n" " break;\n" @@ -5692,32 +5642,32 @@ void defRecordTemplate1(const struct_def *sdef, output_struct *output) " case Module_Param::MP_List_Template:\n" " case Module_Param::MP_ComplementList_Template: {\n" " %s_template new_temp;\n" - " new_temp.set_type(m_p->get_type()==Module_Param::MP_List_Template ? " - "VALUE_LIST : COMPLEMENTED_LIST, m_p->get_size());\n" - " for (size_t p_i=0; p_i<m_p->get_size(); p_i++) {\n" - " new_temp.list_item(p_i).set_param(*m_p->get_elem(p_i));\n" + " new_temp.set_type(param.get_type()==Module_Param::MP_List_Template ? " + "VALUE_LIST : COMPLEMENTED_LIST, param.get_size());\n" + " for (size_t p_i=0; p_i<param.get_size(); p_i++) {\n" + " new_temp.list_item(p_i).set_param(*param.get_elem(p_i));\n" " }\n" " *this = new_temp;\n" " break; }\n" " case Module_Param::MP_Value_List:\n" - " if (%lu<m_p->get_size()) {\n" - " param.error(\"%s template of type %s has %lu fields but list value has %%d fields\", (int)m_p->get_size());\n" + " if (%lu<param.get_size()) {\n" + " param.error(\"%s template of type %s has %lu fields but list value has %%d fields\", (int)param.get_size());\n" " }\n", kind_str, dispname, kind_str, name, (unsigned long)sdef->nElements, kind_str, dispname, (unsigned long)sdef->nElements); for (i = 0; i < sdef->nElements; ++i) { src = mputprintf(src, - " if (m_p->get_size()>%lu && m_p->get_elem(%lu)->get_type()!=Module_Param::MP_NotUsed) %s().set_param(*m_p->get_elem(%lu));\n", + " if (param.get_size()>%lu && param.get_elem(%lu)->get_type()!=Module_Param::MP_NotUsed) %s().set_param(*param.get_elem(%lu));\n", (unsigned long)i, (unsigned long)i, sdef->elements[i].name, (unsigned long)i); } src = mputstr(src, " break;\n" " case Module_Param::MP_Assignment_List: {\n" - " Vector<bool> value_used(m_p->get_size());\n" - " value_used.resize(m_p->get_size(), false);\n"); + " Vector<bool> value_used(param.get_size());\n" + " value_used.resize(param.get_size(), false);\n"); for (i = 0; i < sdef->nElements; ++i) { src = mputprintf(src, - " for (size_t val_idx=0; val_idx<m_p->get_size(); val_idx++) {\n" - " Module_Param* const curr_param = m_p->get_elem(val_idx);\n" + " for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) {\n" + " Module_Param* const curr_param = param.get_elem(val_idx);\n" " if (!strcmp(curr_param->get_id()->get_name(), \"%s\")) {\n" " if (curr_param->get_type()!=Module_Param::MP_NotUsed) {\n" " %s().set_param(*curr_param);\n" @@ -5728,89 +5678,16 @@ void defRecordTemplate1(const struct_def *sdef, output_struct *output) , sdef->elements[i].dispname, sdef->elements[i].name); } src = mputprintf(src, - " for (size_t val_idx=0; val_idx<m_p->get_size(); val_idx++) if (!value_used[val_idx]) {\n" - " m_p->get_elem(val_idx)->error(\"Non existent field name in type %s: %%s\", m_p->get_elem(val_idx)->get_id()->get_name());\n" + " for (size_t val_idx=0; val_idx<param.get_size(); val_idx++) if (!value_used[val_idx]) {\n" + " param.get_elem(val_idx)->error(\"Non existent field name in type %s: %%s\", param.get_elem(val_idx)->get_id()->get_name());\n" " break;\n" " }\n" " } break;\n" " default:\n" " param.type_error(\"%s template\", \"%s\");\n" " }\n" - " is_ifpresent = param.get_ifpresent() || m_p->get_ifpresent();\n" + " is_ifpresent = param.get_ifpresent();\n" "}\n\n", dispname, kind_str, dispname); - - /* get_param() */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf(src, - "Module_Param* %s_template::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " if (param_name.next_name()) {\n" - // Haven't reached the end of the module parameter name - // => the name refers to one of the fields, not to the whole record - " char* param_field = param_name.get_current_name();\n" - " if (param_field[0] >= '0' && param_field[0] <= '9') {\n" - " TTCN_error(\"Unexpected array index in module parameter reference, \"\n" - " \"expected a valid field name for %s template type `%s'\");\n" - " }\n" - " ", name, kind_str, dispname); - for (i = 0; i < sdef->nElements; i++) { - src = mputprintf(src, - "if (strcmp(\"%s\", param_field) == 0) {\n" - " return %s().get_param(param_name);\n" - " } else ", - sdef->elements[i].dispname, sdef->elements[i].name); - } - src = mputprintf(src, - "TTCN_error(\"Field `%%s' not found in %s type `%s'\", param_field);\n" - " }\n" - " Module_Param* m_p = NULL;\n" - " switch (template_selection) {\n" - " case UNINITIALIZED_TEMPLATE:\n" - " m_p = new Module_Param_Unbound();\n" - " break;\n" - " case OMIT_VALUE:\n" - " m_p = new Module_Param_Omit();\n" - " break;\n" - " case ANY_VALUE:\n" - " m_p = new Module_Param_Any();\n" - " break;\n" - " case ANY_OR_OMIT:\n" - " m_p = new Module_Param_AnyOrNone();\n" - " break;\n" - " case SPECIFIC_VALUE: {\n" - " m_p = new Module_Param_Assignment_List();\n" - , kind_str, dispname); - for (i = 0; i < sdef->nElements; i++) { - src = mputprintf(src, - " Module_Param* mp_field_%s = single_value->field_%s.get_param(param_name);\n" - " mp_field_%s->set_id(new Module_Param_FieldName(mcopystr(\"%s\")));\n" - " m_p->add_elem(mp_field_%s);\n" - , sdef->elements[i].name, sdef->elements[i].name - , sdef->elements[i].name, sdef->elements[i].dispname - , sdef->elements[i].name); - } - src = mputstr(src, - " break; }\n" - " case VALUE_LIST:\n" - " case COMPLEMENTED_LIST: {\n" - " if (template_selection == VALUE_LIST) {\n" - " m_p = new Module_Param_List_Template();\n" - " }\n" - " else {\n" - " m_p = new Module_Param_ComplementList_Template();\n" - " }\n" - " for (size_t i_i = 0; i_i < value_list.n_values; ++i_i) {\n" - " m_p->add_elem(value_list.list_value[i_i].get_param(param_name));\n" - " }\n" - " break; }\n" - " default:\n" - " break;\n" - " }\n" - " if (is_ifpresent) {\n" - " m_p->set_ifpresent();\n" - " }\n" - " return m_p;\n" - "}\n\n"); /* check template restriction */ def = mputstr(def, "void check_restriction(template_res t_res, " @@ -5981,26 +5858,11 @@ static void defEmptyRecordClass(const struct_def *sdef, src = mputprintf(src, "void %s::set_param(Module_Param& param)\n" "{\n" " param.basic_check(Module_Param::BC_VALUE, \"empty record/set value (i.e. { })\");\n" - " Module_Param_Ptr mp = ¶m;\n" - " if (param.get_type() == Module_Param::MP_Reference) {\n" - " mp = param.get_referenced_param();\n" - " }\n" - " if (mp->get_type()!=Module_Param::MP_Value_List || mp->get_size()>0) {\n" + " if (param.get_type()!=Module_Param::MP_Value_List || param.get_size()>0) {\n" " param.type_error(\"empty record/set value (i.e. { })\", \"%s\");\n" " }\n" " bound_flag = TRUE;\n" "}\n\n", name, dispname); - - /* get param function */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf(src, - "Module_Param* %s::get_param(Module_Param_Name& /* param_name */) const\n" - "{\n" - " if (!is_bound()) {\n" - " return new Module_Param_Unbound();\n" - " }\n" - " return new Module_Param_Value_List();\n" - "}\n\n", name); /* encode_text function */ def = mputstr(def, "void encode_text(Text_Buf& text_buf) const;\n"); @@ -6628,11 +6490,7 @@ static void defEmptyRecordTemplate(const char *name, const char *dispname, "void %s_template::set_param(Module_Param& param)\n" "{\n" " param.basic_check(Module_Param::BC_TEMPLATE, \"empty record/set template\");\n" - " Module_Param_Ptr mp = ¶m;\n" - " if (param.get_type() == Module_Param::MP_Reference) {\n" - " mp = param.get_referenced_param();\n" - " }\n" - " switch (mp->get_type()) {\n" + " switch (param.get_type()) {\n" " case Module_Param::MP_Omit:\n" " *this = OMIT_VALUE;\n" " break;\n" @@ -6645,65 +6503,22 @@ static void defEmptyRecordTemplate(const char *name, const char *dispname, " case Module_Param::MP_List_Template:\n" " case Module_Param::MP_ComplementList_Template: {\n" " %s_template temp;\n" - " temp.set_type(mp->get_type()==Module_Param::MP_List_Template ? " - "VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());\n" - " for (size_t p_i=0; p_i<mp->get_size(); p_i++) {\n" - " temp.list_item(p_i).set_param(*mp->get_elem(p_i));\n" + " temp.set_type(param.get_type()==Module_Param::MP_List_Template ? " + "VALUE_LIST : COMPLEMENTED_LIST, param.get_size());\n" + " for (size_t p_i=0; p_i<param.get_size(); p_i++) {\n" + " temp.list_item(p_i).set_param(*param.get_elem(p_i));\n" " }\n" " *this = temp;\n" " break; }\n" " case Module_Param::MP_Value_List:\n" - " if (mp->get_size()>0) param.type_error(\"empty record/set template\", \"%s\");\n" + " if (param.get_size()>0) param.type_error(\"empty record/set template\", \"%s\");\n" " *this = NULL_VALUE;\n" " break;\n" " default:\n" " param.type_error(\"empty record/set template\", \"%s\");\n" " }\n" - " is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();\n" + " is_ifpresent = param.get_ifpresent();\n" "}\n\n", name, name, dispname, dispname); - - /* get_param() */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf(src, - "Module_Param* %s_template::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " Module_Param* mp = NULL;\n" - " switch (template_selection) {\n" - " case UNINITIALIZED_TEMPLATE:\n" - " mp = new Module_Param_Unbound();\n" - " break;\n" - " case OMIT_VALUE:\n" - " mp = new Module_Param_Omit();\n" - " break;\n" - " case ANY_VALUE:\n" - " mp = new Module_Param_Any();\n" - " break;\n" - " case ANY_OR_OMIT:\n" - " mp = new Module_Param_AnyOrNone();\n" - " break;\n" - " case SPECIFIC_VALUE:\n" - " mp = new Module_Param_Value_List();\n" - " break;\n" - " case VALUE_LIST:\n" - " case COMPLEMENTED_LIST: {\n" - " if (template_selection == VALUE_LIST) {\n" - " mp = new Module_Param_List_Template();\n" - " }\n" - " else {\n" - " mp = new Module_Param_ComplementList_Template();\n" - " }\n" - " for (size_t i = 0; i < value_list.n_values; ++i) {\n" - " mp->add_elem(value_list.list_value[i].get_param(param_name));\n" - " }\n" - " break; }\n" - " default:\n" - " break;\n" - " }\n" - " if (is_ifpresent) {\n" - " mp->set_ifpresent();\n" - " }\n" - " return mp;\n" - "}\n\n", name); /* check template restriction */ def = mputstr(def, "void check_restriction(template_res t_res, " diff --git a/compiler2/record_of.c b/compiler2/record_of.c index c29b4eb548594d51ef4a8bdd69c186d9e403bec2..0e8fc1ab3b942adab6305a073314193bf0e654d2 100644 --- a/compiler2/record_of.c +++ b/compiler2/record_of.c @@ -619,21 +619,17 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " return;\n" " }\n" " param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, \"%s value\");\n" - " Module_Param_Ptr mp = ¶m;\n" - " if (param.get_type() == Module_Param::MP_Reference) {\n" - " mp = param.get_referenced_param();\n" - " }\n" " switch (param.get_operation_type()) {\n" " case Module_Param::OT_ASSIGN:\n" - " if (mp->get_type()==Module_Param::MP_Value_List && mp->get_size()==0) {\n" + " if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {\n" " *this = NULL_VALUE;\n" " return;\n" " }\n" - " switch (mp->get_type()) {\n" + " switch (param.get_type()) {\n" " case Module_Param::MP_Value_List:\n" - " set_size(mp->get_size());\n" - " for (size_t i=0; i<mp->get_size(); ++i) {\n" - " Module_Param* const curr = mp->get_elem(i);\n" + " set_size(param.get_size());\n" + " for (size_t i=0; i<param.get_size(); ++i) {\n" + " Module_Param* const curr = param.get_elem(i);\n" " if (curr->get_type()!=Module_Param::MP_NotUsed) {\n" " (*this)[i].set_param(*curr);\n" " if (!(*this)[i].is_bound()) {\n" @@ -644,8 +640,8 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " }\n" " break;\n" " case Module_Param::MP_Indexed_List:\n" - " for (size_t i=0; i<mp->get_size(); ++i) {\n" - " Module_Param* const curr = mp->get_elem(i);\n" + " for (size_t i=0; i<param.get_size(); ++i) {\n" + " Module_Param* const curr = param.get_elem(i);\n" " (*this)[curr->get_id()->get_index()].set_param(*curr);\n" " if (!(*this)[curr->get_id()->get_index()].is_bound()) {\n" " delete val_ptr->value_elements[curr->get_id()->get_index()];\n" @@ -658,12 +654,12 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) " }\n" " break;\n" " case Module_Param::OT_CONCAT:\n" - " switch (mp->get_type()) {\n" + " switch (param.get_type()) {\n" " case Module_Param::MP_Value_List: {\n" " if (!is_bound()) *this = NULL_VALUE;\n" " int start_idx = lengthof();\n" - " for (size_t i=0; i<mp->get_size(); ++i) {\n" - " Module_Param* const curr = mp->get_elem(i);\n" + " for (size_t i=0; i<param.get_size(); ++i) {\n" + " Module_Param* const curr = param.get_elem(i);\n" " if ((curr->get_type()!=Module_Param::MP_NotUsed)) {\n" " (*this)[start_idx+(int)i].set_param(*curr);\n" " }\n" @@ -683,37 +679,6 @@ void defRecordOfClass1(const struct_of_def *sdef, output_struct *output) dispname, sdef->kind == RECORD_OF ? "record of" : "set of", sdef->kind == RECORD_OF ? "record of" : "set of", dispname, sdef->kind == RECORD_OF ? "record of" : "set of", dispname); - - /* get param function */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf - (src, - "Module_Param* %s::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " if (!is_bound()) {\n" - " return new Module_Param_Unbound();\n" - " }\n" - " if (param_name.next_name()) {\n" - // Haven't reached the end of the module parameter name - // => the name refers to one of the elements, not to the whole record of - " char* param_field = param_name.get_current_name();\n" - " if (param_field[0] < '0' || param_field[0] > '9') {\n" - " TTCN_error(\"Unexpected record field name in module parameter reference, \"\n" - " \"expected a valid index for %s type `%s'\");\n" - " }\n" - " int param_index = -1;\n" - " sscanf(param_field, \"%%d\", ¶m_index);\n" - " return (*this)[param_index].get_param(param_name);\n" - " }\n" - " Vector<Module_Param*> values;\n" - " for (int i = 0; i < val_ptr->n_elements; ++i) {\n" - " values.push_back((*this)[i].get_param(param_name));\n" - " }\n" - " Module_Param_Value_List* mp = new Module_Param_Value_List();\n" - " mp->add_list_with_implicit_ids(&values);\n" - " values.clear();\n" - " return mp;\n" - "}\n\n", name, sdef->kind == RECORD_OF ? "record of" : "set of", dispname); /* set implicit omit function, recursive */ def = mputstr(def, " void set_implicit_omit();\n"); @@ -2178,29 +2143,25 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " return;\n" " }\n" " param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, \"%s value\");\n" - " Module_Param_Ptr mp = ¶m;\n" - " if (param.get_type() == Module_Param::MP_Reference) {\n" - " mp = param.get_referenced_param();\n" - " }\n" " switch (param.get_operation_type()) {\n" " case Module_Param::OT_ASSIGN:\n" - " if (mp->get_type()==Module_Param::MP_Value_List && mp->get_size()==0) {\n" + " if (param.get_type()==Module_Param::MP_Value_List && param.get_size()==0) {\n" " *this = NULL_VALUE;\n" " return;\n" " }\n" - " switch (mp->get_type()) {\n" + " switch (param.get_type()) {\n" " case Module_Param::MP_Value_List:\n" - " set_size(mp->get_size());\n" - " for (size_t i=0; i<mp->get_size(); ++i) {\n" - " Module_Param* const curr = mp->get_elem(i);\n" + " set_size(param.get_size());\n" + " for (size_t i=0; i<param.get_size(); ++i) {\n" + " Module_Param* const curr = param.get_elem(i);\n" " if (curr->get_type()!=Module_Param::MP_NotUsed) {\n" " (*this)[i].set_param(*curr);\n" " }\n" " }\n" " break;\n" " case Module_Param::MP_Indexed_List:\n" - " for (size_t i=0; i<mp->get_size(); ++i) {\n" - " Module_Param* const curr = mp->get_elem(i);\n" + " for (size_t i=0; i<param.get_size(); ++i) {\n" + " Module_Param* const curr = param.get_elem(i);\n" " (*this)[curr->get_id()->get_index()].set_param(*curr);\n" " }\n" " break;\n" @@ -2209,12 +2170,12 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct " }\n" " break;\n" " case Module_Param::OT_CONCAT:\n" - " switch (mp->get_type()) {\n" + " switch (param.get_type()) {\n" " case Module_Param::MP_Value_List: {\n" " if (!is_bound()) *this = NULL_VALUE;\n" " int start_idx = lengthof();\n" - " for (size_t i=0; i<mp->get_size(); ++i) {\n" - " Module_Param* const curr = mp->get_elem(i);\n" + " for (size_t i=0; i<param.get_size(); ++i) {\n" + " Module_Param* const curr = param.get_elem(i);\n" " if ((curr->get_type()!=Module_Param::MP_NotUsed)) {\n" " (*this)[start_idx+(int)i].set_param(*curr);\n" " }\n" @@ -2234,37 +2195,6 @@ void defRecordOfClassMemAllocOptimized(const struct_of_def *sdef, output_struct sdef->kind == RECORD_OF ? "record of" : "set of", sdef->kind == RECORD_OF ? "record of" : "set of", dispname, sdef->kind == RECORD_OF ? "record of" : "set of", dispname); - - /* get param function */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf - (src, - "Module_Param* %s::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " if (!is_bound()) {\n" - " return new Module_Param_Unbound();\n" - " }\n" - " if (param_name.next_name()) {\n" - // Haven't reached the end of the module parameter name - // => the name refers to one of the elements, not to the whole record of - " char* param_field = param_name.get_current_name();\n" - " if (param_field[0] < '0' || param_field[0] > '9') {\n" - " TTCN_error(\"Unexpected record field name in module parameter reference, \"\n" - " \"expected a valid index for %s type `%s'\");\n" - " }\n" - " int param_index = -1;\n" - " sscanf(param_field, \"%%d\", ¶m_index);\n" - " return (*this)[param_index].get_param(param_name);\n" - " }\n" - " Vector<Module_Param*> values;\n" - " for (int i = 0; i < n_elements; ++i) {\n" - " values.push_back((*this)[i].get_param(param_name));\n" - " }\n" - " Module_Param_Value_List* mp = new Module_Param_Value_List();\n" - " mp->add_list_with_implicit_ids(&values);\n" - " values.clear();\n" - " return mp;\n" - "}\n\n", name, sdef->kind == RECORD_OF ? "record of" : "set of", dispname); /* encoding / decoding functions */ def = mputstr(def, "void encode_text(Text_Buf& text_buf) const;\n"); @@ -4488,11 +4418,7 @@ void defRecordOfTemplate1(const struct_of_def *sdef, output_struct *output) " return;\n" " }\n" " param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, \"%s of template\");\n" - " Module_Param_Ptr mp = ¶m;\n" - " if (param.get_type() == Module_Param::MP_Reference) {\n" - " mp = param.get_referenced_param();\n" - " }\n" - " switch (mp->get_type()) {\n" + " switch (param.get_type()) {\n" " case Module_Param::MP_Omit:\n" " *this = OMIT_VALUE;\n" " break;\n" @@ -4505,41 +4431,41 @@ void defRecordOfTemplate1(const struct_of_def *sdef, output_struct *output) " case Module_Param::MP_List_Template:\n" " case Module_Param::MP_ComplementList_Template: {\n" " %s_template temp;\n" - " temp.set_type(mp->get_type()==Module_Param::MP_List_Template ? " - "VALUE_LIST : COMPLEMENTED_LIST, mp->get_size());\n" - " for (size_t p_i=0; p_i<mp->get_size(); p_i++) {\n" - " temp.list_item(p_i).set_param(*mp->get_elem(p_i));\n" + " temp.set_type(param.get_type()==Module_Param::MP_List_Template ? " + "VALUE_LIST : COMPLEMENTED_LIST, param.get_size());\n" + " for (size_t p_i=0; p_i<param.get_size(); p_i++) {\n" + " temp.list_item(p_i).set_param(*param.get_elem(p_i));\n" " }\n" " *this = temp;\n" " break; }\n" " case Module_Param::MP_Indexed_List:\n" " if (template_selection!=SPECIFIC_VALUE) set_size(0);\n" - " for (size_t p_i=0; p_i<mp->get_size(); ++p_i) {\n" - " (*this)[(int)(mp->get_elem(p_i)->get_id()->get_index())].set_param(*mp->get_elem(p_i));\n" + " for (size_t p_i=0; p_i<param.get_size(); ++p_i) {\n" + " (*this)[(int)(param.get_elem(p_i)->get_id()->get_index())].set_param(*param.get_elem(p_i));\n" " }\n" " break;\n", name, sdef->kind==RECORD_OF?"record":"set", dispname, sdef->kind==RECORD_OF?"record":"set", name); if (sdef->kind == RECORD_OF) { src = mputstr(src, " case Module_Param::MP_Value_List: {\n" - " set_size(mp->get_size());\n" + " set_size(param.get_size());\n" " int curr_idx = 0;\n" - " for (size_t p_i=0; p_i<mp->get_size(); ++p_i) {\n" - " switch (mp->get_elem(p_i)->get_type()) {\n" + " for (size_t p_i=0; p_i<param.get_size(); ++p_i) {\n" + " switch (param.get_elem(p_i)->get_type()) {\n" " case Module_Param::MP_NotUsed:\n" " curr_idx++;\n" " break;\n" " case Module_Param::MP_Permutation_Template: {\n" " int perm_start_idx = curr_idx;\n" - " for (size_t perm_i=0; perm_i<mp->get_elem(p_i)->get_size(); perm_i++) {\n" - " (*this)[curr_idx].set_param(*(mp->get_elem(p_i)->get_elem(perm_i)));\n" + " for (size_t perm_i=0; perm_i<param.get_elem(p_i)->get_size(); perm_i++) {\n" + " (*this)[curr_idx].set_param(*(param.get_elem(p_i)->get_elem(perm_i)));\n" " curr_idx++;\n" " }\n" " int perm_end_idx = curr_idx - 1;\n" " add_permutation(perm_start_idx, perm_end_idx);\n" " } break;\n" " default:\n" - " (*this)[curr_idx].set_param(*mp->get_elem(p_i));\n" + " (*this)[curr_idx].set_param(*param.get_elem(p_i));\n" " curr_idx++;\n" " }\n" " }\n" @@ -4547,18 +4473,18 @@ void defRecordOfTemplate1(const struct_of_def *sdef, output_struct *output) } else { src = mputstr(src, " case Module_Param::MP_Value_List:\n" - " set_size(mp->get_size());\n" - " for (size_t p_i=0; p_i<mp->get_size(); ++p_i) {\n" - " if (mp->get_elem(p_i)->get_type()!=Module_Param::MP_NotUsed) {\n" - " (*this)[p_i].set_param(*mp->get_elem(p_i));\n" + " set_size(param.get_size());\n" + " for (size_t p_i=0; p_i<param.get_size(); ++p_i) {\n" + " if (param.get_elem(p_i)->get_type()!=Module_Param::MP_NotUsed) {\n" + " (*this)[p_i].set_param(*param.get_elem(p_i));\n" " }\n" " }\n" " break;\n" " case Module_Param::MP_Superset_Template:\n" " case Module_Param::MP_Subset_Template:\n" - " set_type(mp->get_type()==Module_Param::MP_Superset_Template ? SUPERSET_MATCH : SUBSET_MATCH, mp->get_size());\n" - " for (size_t p_i=0; p_i<mp->get_size(); p_i++) {\n" - " set_item(p_i).set_param(*mp->get_elem(p_i));\n" + " set_type(param.get_type()==Module_Param::MP_Superset_Template ? SUPERSET_MATCH : SUBSET_MATCH, param.get_size());\n" + " for (size_t p_i=0; p_i<param.get_size(); p_i++) {\n" + " set_item(p_i).set_param(*param.get_elem(p_i));\n" " }\n" " break;\n"); } @@ -4566,77 +4492,9 @@ void defRecordOfTemplate1(const struct_of_def *sdef, output_struct *output) " default:\n" " param.type_error(\"%s of template\", \"%s\");\n" " }\n" - " is_ifpresent = param.get_ifpresent() || mp->get_ifpresent();\n" - " if (param.get_length_restriction() != NULL) {\n" - " set_length_range(param);\n" - " }\n" - " else {\n" - " set_length_range(*mp);\n" - " };\n" + " is_ifpresent = param.get_ifpresent();\n" + " set_length_range(param);\n" "}\n\n", sdef->kind==RECORD_OF?"record":"set", dispname); - - /* get_param() */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf - (src, - "Module_Param* %s_template::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " if (param_name.next_name()) {\n" - // Haven't reached the end of the module parameter name - // => the name refers to one of the elements, not to the whole record of - " char* param_field = param_name.get_current_name();\n" - " if (param_field[0] < '0' || param_field[0] > '9') {\n" - " TTCN_error(\"Unexpected record field name in module parameter reference, \"\n" - " \"expected a valid index for %s template type `%s'\");\n" - " }\n" - " int param_index = -1;\n" - " sscanf(param_field, \"%%d\", ¶m_index);\n" - " return (*this)[param_index].get_param(param_name);\n" - " }\n" - " Module_Param* mp = NULL;\n" - " switch (template_selection) {\n" - " case UNINITIALIZED_TEMPLATE:\n" - " mp = new Module_Param_Unbound();\n" - " break;\n" - " case OMIT_VALUE:\n" - " mp = new Module_Param_Omit();\n" - " break;\n" - " case ANY_VALUE:\n" - " mp = new Module_Param_Any();\n" - " break;\n" - " case ANY_OR_OMIT:\n" - " mp = new Module_Param_AnyOrNone();\n" - " break;\n" - " case SPECIFIC_VALUE: {\n" - " Vector<Module_Param*> values;\n" - " for (int i = 0; i < single_value.n_elements; ++i) {\n" - " values.push_back((*this)[i].get_param(param_name));\n" - " }\n" - " mp = new Module_Param_Value_List();\n" - " mp->add_list_with_implicit_ids(&values);\n" - " values.clear();\n" - " break; }\n" - " case VALUE_LIST:\n" - " case COMPLEMENTED_LIST: {\n" - " if (template_selection == VALUE_LIST) {\n" - " mp = new Module_Param_List_Template();\n" - " }\n" - " else {\n" - " mp = new Module_Param_ComplementList_Template();\n" - " }\n" - " for (size_t i = 0; i < value_list.n_values; ++i) {\n" - " mp->add_elem(value_list.list_value[i].get_param(param_name));\n" - " }\n" - " break; }\n" - " default:\n" - " break;\n" - " }\n" - " if (is_ifpresent) {\n" - " mp->set_ifpresent();\n" - " }\n" - " mp->set_length_restriction(get_length_range());\n" - " return mp;\n" - "}\n\n", name, sdef->kind==RECORD_OF ? "record of" : "set of", dispname); /* check template restriction */ def = mputstr(def, "void check_restriction(template_res t_res, " diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc index 708582a6f6506a6c9110fe9a0c632e7316775922..55bbbc47e7ae810f4b0fbb7f25a8f648fba4817e 100644 --- a/compiler2/ttcn3/AST_ttcn3.cc +++ b/compiler2/ttcn3/AST_ttcn3.cc @@ -3845,10 +3845,12 @@ namespace Ttcn { "modulepar_%s.set_param(param);\n" "return TRUE;\n" "} else ", dispname, name); - target->functions.get_param = mputprintf(target->functions.get_param, - "if (!strcmp(par_name, \"%s\")) {\n" - "return modulepar_%s.get_param(param_name);\n" - "} else ", dispname, name); + if (use_runtime_2) { + target->functions.get_param = mputprintf(target->functions.get_param, + "if (!strcmp(par_name, \"%s\")) {\n" + "return modulepar_%s.get_param(param_name);\n" + "} else ", dispname, name); + } if (target->functions.log_param) { // this is not the first modulepar diff --git a/compiler2/union.c b/compiler2/union.c index 72dbbd068468ffe0dc0d02281738ee9fc6a59afe..22f9d0d9cbc2a35fc9702402b0de4965b2009e98 100644 --- a/compiler2/union.c +++ b/compiler2/union.c @@ -385,15 +385,19 @@ void defUnionClass(struct_def const *sdef, output_struct *output) "param.error(\"Field `%%s' not found in union type `%s'\", param_field);\n" " }\n" " param.basic_check(Module_Param::BC_VALUE, \"union value\");\n" - " Module_Param_Ptr m_p = ¶m;\n" + " Module_Param_Ptr m_p = ¶m;\n", dispname); + if (use_runtime_2) { + src = mputstr(src, " if (param.get_type() == Module_Param::MP_Reference) {\n" " m_p = param.get_referenced_param();\n" - " }\n" + " }\n"); + } + src = mputstr(src, " if (m_p->get_type()==Module_Param::MP_Value_List && m_p->get_size()==0) return;\n" " if (m_p->get_type()!=Module_Param::MP_Assignment_List) {\n" " param.error(\"union value with field name was expected\");\n" " }\n" - " Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);\n", dispname); + " Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);\n"); for (i = 0; i < sdef->nElements; i++) { src = mputprintf(src, @@ -420,53 +424,55 @@ void defUnionClass(struct_def const *sdef, output_struct *output) " mp_last->error(\"Field %%s does not exist in type %s.\", mp_last->get_id()->get_name());\n" "}\n\n", dispname); - /* get param function */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf(src, - "Module_Param* %s::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " if (!is_bound()) {\n" - " return new Module_Param_Unbound();\n" - " }\n" - " if (param_name.next_name()) {\n" - // Haven't reached the end of the module parameter name - // => the name refers to one of the fields, not to the whole union - " char* param_field = param_name.get_current_name();\n" - " if (param_field[0] >= '0' && param_field[0] <= '9') {\n" - " TTCN_error(\"Unexpected array index in module parameter reference, \"\n" - " \"expected a valid field name for union type `%s'\");\n" - " }\n" - " ", name, dispname); - for (i = 0; i < sdef->nElements; i++) { + /* get param function, RT2 only */ + if (use_runtime_2) { + def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); src = mputprintf(src, - "if (strcmp(\"%s\", param_field) == 0) {\n" - " return %s%s().get_param(param_name);\n" - " } else ", - sdef->elements[i].dispname, at_field, sdef->elements[i].name); - } - src = mputprintf(src, - "TTCN_error(\"Field `%%s' not found in union type `%s'\", param_field);\n" - " }\n" - " Module_Param* mp_field = NULL;\n" - " switch(union_selection) {\n" - , name); - for (i = 0; i < sdef->nElements; ++i) { - src = mputprintf(src, - " case %s_%s:\n" - " mp_field = field_%s->get_param(param_name);\n" - " mp_field->set_id(new Module_Param_FieldName(mcopystr(\"%s\")));\n" - " break;\n" - , selection_prefix, sdef->elements[i].name - , sdef->elements[i].name, sdef->elements[i].dispname); + "Module_Param* %s::get_param(Module_Param_Name& param_name) const\n" + "{\n" + " if (!is_bound()) {\n" + " return new Module_Param_Unbound();\n" + " }\n" + " if (param_name.next_name()) {\n" + // Haven't reached the end of the module parameter name + // => the name refers to one of the fields, not to the whole union + " char* param_field = param_name.get_current_name();\n" + " if (param_field[0] >= '0' && param_field[0] <= '9') {\n" + " TTCN_error(\"Unexpected array index in module parameter reference, \"\n" + " \"expected a valid field name for union type `%s'\");\n" + " }\n" + " ", name, dispname); + for (i = 0; i < sdef->nElements; i++) { + src = mputprintf(src, + "if (strcmp(\"%s\", param_field) == 0) {\n" + " return %s%s().get_param(param_name);\n" + " } else ", + sdef->elements[i].dispname, at_field, sdef->elements[i].name); } - src = mputstr(src, - " default:\n" - " break;\n" - " }\n" - " Module_Param_Assignment_List* m_p = new Module_Param_Assignment_List();\n" - " m_p->add_elem(mp_field);\n" - " return m_p;\n" - "}\n\n"); + src = mputprintf(src, + "TTCN_error(\"Field `%%s' not found in union type `%s'\", param_field);\n" + " }\n" + " Module_Param* mp_field = NULL;\n" + " switch(union_selection) {\n" + , name); + for (i = 0; i < sdef->nElements; ++i) { + src = mputprintf(src, + " case %s_%s:\n" + " mp_field = field_%s->get_param(param_name);\n" + " mp_field->set_id(new Module_Param_FieldName(mcopystr(\"%s\")));\n" + " break;\n" + , selection_prefix, sdef->elements[i].name + , sdef->elements[i].name, sdef->elements[i].dispname); + } + src = mputstr(src, + " default:\n" + " break;\n" + " }\n" + " Module_Param_Assignment_List* m_p = new Module_Param_Assignment_List();\n" + " m_p->add_elem(mp_field);\n" + " return m_p;\n" + "}\n\n"); + } /* set implicit omit function, recursive */ def = mputstr(def, " void set_implicit_omit();\n"); @@ -2902,10 +2908,14 @@ void defUnionTemplate(const struct_def *sdef, output_struct *output) "param.error(\"Field `%%s' not found in union template type `%s'\", param_field);\n" " }\n" " param.basic_check(Module_Param::BC_TEMPLATE, \"union template\");\n" - " Module_Param_Ptr m_p = ¶m;\n" + " Module_Param_Ptr m_p = ¶m;\n", dispname); + if (use_runtime_2) { + src = mputstr(src, " if (param.get_type() == Module_Param::MP_Reference) {\n" " m_p = param.get_referenced_param();\n" - " }\n" + " }\n"); + } + src = mputprintf(src, " switch (m_p->get_type()) {\n" " case Module_Param::MP_Omit:\n" " *this = OMIT_VALUE;\n" @@ -2932,7 +2942,7 @@ void defUnionTemplate(const struct_def *sdef, output_struct *output) " break;\n" " case Module_Param::MP_Assignment_List: {\n" " Module_Param* mp_last = m_p->get_elem(m_p->get_size()-1);\n", - dispname, name, dispname); + name, dispname); for (i = 0; i < sdef->nElements; i++) { src = mputprintf(src, " if (!strcmp(mp_last->get_id()->get_name(), \"%s\")) {\n" @@ -2946,87 +2956,89 @@ void defUnionTemplate(const struct_def *sdef, output_struct *output) " default:\n" " param.type_error(\"union template\", \"%s\");\n" " }\n" - " is_ifpresent = param.get_ifpresent() || m_p->get_ifpresent();\n" - "}\n\n", dispname, dispname); + " is_ifpresent = param.get_ifpresent()%s;\n" + "}\n\n", dispname, dispname, use_runtime_2 ? " || m_p->get_ifpresent()" : ""); - /* get_param() */ - def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); - src = mputprintf(src, - "Module_Param* %s_template::get_param(Module_Param_Name& param_name) const\n" - "{\n" - " if (param_name.next_name()) {\n" - // Haven't reached the end of the module parameter name - // => the name refers to one of the fields, not to the whole union - " char* param_field = param_name.get_current_name();\n" - " if (param_field[0] >= '0' && param_field[0] <= '9') {\n" - " TTCN_error(\"Unexpected array index in module parameter reference, \"\n" - " \"expected a valid field name for union template type `%s'\");\n" - " }\n" - " ", name, dispname); - for (i = 0; i < sdef->nElements; i++) { + /* get_param(), RT2 only */ + if (use_runtime_2) { + def = mputstr(def, "Module_Param* get_param(Module_Param_Name& param_name) const;\n"); src = mputprintf(src, - "if (strcmp(\"%s\", param_field) == 0) {\n" - " return %s%s().get_param(param_name);\n" - " } else ", - sdef->elements[i].dispname, at_field, sdef->elements[i].name); - } - src = mputprintf(src, - "TTCN_error(\"Field `%%s' not found in union type `%s'\", param_field);\n" - " }\n" - " Module_Param* m_p = NULL;\n" - " switch (template_selection) {\n" - " case UNINITIALIZED_TEMPLATE:\n" - " m_p = new Module_Param_Unbound();\n" - " break;\n" - " case OMIT_VALUE:\n" - " m_p = new Module_Param_Omit();\n" - " break;\n" - " case ANY_VALUE:\n" - " m_p = new Module_Param_Any();\n" - " break;\n" - " case ANY_OR_OMIT:\n" - " m_p = new Module_Param_AnyOrNone();\n" - " break;\n" - " case SPECIFIC_VALUE: {\n" - " Module_Param* mp_field = NULL;\n" - " switch(single_value.union_selection) {\n" - , name); - for (i = 0; i < sdef->nElements; ++i) { - src = mputprintf(src, - " case %s_%s:\n" - " mp_field = single_value.field_%s->get_param(param_name);\n" - " mp_field->set_id(new Module_Param_FieldName(mcopystr(\"%s\")));\n" - " break;\n" - , selection_prefix, sdef->elements[i].name - , sdef->elements[i].name, sdef->elements[i].dispname); + "Module_Param* %s_template::get_param(Module_Param_Name& param_name) const\n" + "{\n" + " if (param_name.next_name()) {\n" + // Haven't reached the end of the module parameter name + // => the name refers to one of the fields, not to the whole union + " char* param_field = param_name.get_current_name();\n" + " if (param_field[0] >= '0' && param_field[0] <= '9') {\n" + " TTCN_error(\"Unexpected array index in module parameter reference, \"\n" + " \"expected a valid field name for union template type `%s'\");\n" + " }\n" + " ", name, dispname); + for (i = 0; i < sdef->nElements; i++) { + src = mputprintf(src, + "if (strcmp(\"%s\", param_field) == 0) {\n" + " return %s%s().get_param(param_name);\n" + " } else ", + sdef->elements[i].dispname, at_field, sdef->elements[i].name); } - src = mputstr(src, - " default:\n" - " break;\n" - " }\n" - " m_p = new Module_Param_Assignment_List();\n" - " m_p->add_elem(mp_field);\n" - " break; }\n" - " case VALUE_LIST:\n" - " case COMPLEMENTED_LIST: {\n" - " if (template_selection == VALUE_LIST) {\n" - " m_p = new Module_Param_List_Template();\n" - " }\n" - " else {\n" - " m_p = new Module_Param_ComplementList_Template();\n" - " }\n" - " for (size_t i_i = 0; i_i < value_list.n_values; ++i_i) {\n" - " m_p->add_elem(value_list.list_value[i_i].get_param(param_name));\n" - " }\n" - " break; }\n" - " default:\n" - " break;\n" - " }\n" - " if (is_ifpresent) {\n" - " m_p->set_ifpresent();\n" - " }\n" - " return m_p;\n" - "}\n\n"); + src = mputprintf(src, + "TTCN_error(\"Field `%%s' not found in union type `%s'\", param_field);\n" + " }\n" + " Module_Param* m_p = NULL;\n" + " switch (template_selection) {\n" + " case UNINITIALIZED_TEMPLATE:\n" + " m_p = new Module_Param_Unbound();\n" + " break;\n" + " case OMIT_VALUE:\n" + " m_p = new Module_Param_Omit();\n" + " break;\n" + " case ANY_VALUE:\n" + " m_p = new Module_Param_Any();\n" + " break;\n" + " case ANY_OR_OMIT:\n" + " m_p = new Module_Param_AnyOrNone();\n" + " break;\n" + " case SPECIFIC_VALUE: {\n" + " Module_Param* mp_field = NULL;\n" + " switch(single_value.union_selection) {\n" + , name); + for (i = 0; i < sdef->nElements; ++i) { + src = mputprintf(src, + " case %s_%s:\n" + " mp_field = single_value.field_%s->get_param(param_name);\n" + " mp_field->set_id(new Module_Param_FieldName(mcopystr(\"%s\")));\n" + " break;\n" + , selection_prefix, sdef->elements[i].name + , sdef->elements[i].name, sdef->elements[i].dispname); + } + src = mputstr(src, + " default:\n" + " break;\n" + " }\n" + " m_p = new Module_Param_Assignment_List();\n" + " m_p->add_elem(mp_field);\n" + " break; }\n" + " case VALUE_LIST:\n" + " case COMPLEMENTED_LIST: {\n" + " if (template_selection == VALUE_LIST) {\n" + " m_p = new Module_Param_List_Template();\n" + " }\n" + " else {\n" + " m_p = new Module_Param_ComplementList_Template();\n" + " }\n" + " for (size_t i_i = 0; i_i < value_list.n_values; ++i_i) {\n" + " m_p->add_elem(value_list.list_value[i_i].get_param(param_name));\n" + " }\n" + " break; }\n" + " default:\n" + " break;\n" + " }\n" + " if (is_ifpresent) {\n" + " m_p->set_ifpresent();\n" + " }\n" + " return m_p;\n" + "}\n\n"); + } /* check template restriction */ def = mputstr(def, "void check_restriction(template_res t_res, " diff --git a/core/ASN_CharacterString.cc b/core/ASN_CharacterString.cc index 44a280ac352e891c719333ff937f965b0b600d4f..fb49217c5055826fc1a7075f605ac71085b6ab4c 100644 --- a/core/ASN_CharacterString.cc +++ b/core/ASN_CharacterString.cc @@ -389,9 +389,11 @@ void CHARACTER_STRING_identification::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "union value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (mp->get_type()==Module_Param::MP_Value_List && mp->get_size()==0) return; if (mp->get_type()!=Module_Param::MP_Assignment_List) { param.error("union value with field name was expected"); @@ -424,6 +426,7 @@ void CHARACTER_STRING_identification::set_param(Module_Param& param) mp_last->error("Field %s does not exist in type CHARACTER STRING.identification.", mp_last->get_id()->get_name()); } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARACTER_STRING_identification::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -462,14 +465,17 @@ Module_Param* CHARACTER_STRING_identification::get_param(Module_Param_Name& para mp->add_elem(mp_field); return mp; } +#endif void CHARACTER_STRING_identification_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "union template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -528,6 +534,7 @@ void CHARACTER_STRING_identification_template::set_param(Module_Param& param) is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARACTER_STRING_identification_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -597,6 +604,7 @@ Module_Param* CHARACTER_STRING_identification_template::get_param(Module_Param_N } return mp; } +#endif void CHARACTER_STRING_identification::encode_text(Text_Buf& text_buf) const { @@ -1661,9 +1669,11 @@ void CHARACTER_STRING_identification_syntaxes::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -1700,6 +1710,7 @@ void CHARACTER_STRING_identification_syntaxes::set_param(Module_Param& param) } } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARACTER_STRING_identification_syntaxes::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -1714,6 +1725,7 @@ Module_Param* CHARACTER_STRING_identification_syntaxes::get_param(Module_Param_N mp->add_elem(mp_field_transfer); return mp; } +#endif void CHARACTER_STRING_identification_syntaxes::encode_text(Text_Buf& text_buf) const { @@ -1821,9 +1833,11 @@ void CHARACTER_STRING_identification_syntaxes_template::set_param(Module_Param& { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -1880,6 +1894,7 @@ void CHARACTER_STRING_identification_syntaxes_template::set_param(Module_Param& is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARACTER_STRING_identification_syntaxes_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -1925,6 +1940,7 @@ Module_Param* CHARACTER_STRING_identification_syntaxes_template::get_param(Modul } return mp; } +#endif void CHARACTER_STRING_identification_syntaxes_template::clean_up() { @@ -2384,9 +2400,11 @@ void CHARACTER_STRING_identification_context__negotiation::set_param(Module_Para { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -2423,6 +2441,7 @@ void CHARACTER_STRING_identification_context__negotiation::set_param(Module_Para } } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARACTER_STRING_identification_context__negotiation::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -2437,6 +2456,7 @@ Module_Param* CHARACTER_STRING_identification_context__negotiation::get_param(Mo mp->add_elem(mp_field_transfer_syntax); return mp; } +#endif void CHARACTER_STRING_identification_context__negotiation::encode_text(Text_Buf& text_buf) const { @@ -2546,9 +2566,11 @@ void CHARACTER_STRING_identification_context__negotiation_template::set_param(Mo { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -2605,6 +2627,7 @@ void CHARACTER_STRING_identification_context__negotiation_template::set_param(Mo is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARACTER_STRING_identification_context__negotiation_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -2650,6 +2673,7 @@ Module_Param* CHARACTER_STRING_identification_context__negotiation_template::get } return mp; } +#endif void CHARACTER_STRING_identification_context__negotiation_template::clean_up() { @@ -3118,9 +3142,11 @@ void CHARACTER_STRING::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -3165,6 +3191,7 @@ void CHARACTER_STRING::set_param(Module_Param& param) } } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARACTER_STRING::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -3182,6 +3209,7 @@ Module_Param* CHARACTER_STRING::get_param(Module_Param_Name& param_name) const mp->add_elem(mp_field_string_value); return mp; } +#endif void CHARACTER_STRING::encode_text(Text_Buf& text_buf) const { @@ -3402,9 +3430,11 @@ void CHARACTER_STRING_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -3469,6 +3499,7 @@ void CHARACTER_STRING_template::set_param(Module_Param& param) is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARACTER_STRING_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -3517,6 +3548,7 @@ Module_Param* CHARACTER_STRING_template::get_param(Module_Param_Name& param_name } return mp; } +#endif void CHARACTER_STRING_template::clean_up() { diff --git a/core/ASN_CharacterString.hh b/core/ASN_CharacterString.hh index 73ddceb91b5d1cb152b5b21c095707cdf7023793..d53a767912de17eed0191547ddc05ed463ce0c4c 100644 --- a/core/ASN_CharacterString.hh +++ b/core/ASN_CharacterString.hh @@ -87,11 +87,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const CHARACTER_STRING_identification*>(other_value)); } Base_Type* clone() const { return new CHARACTER_STRING_identification(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &CHARACTER_STRING_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); //void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -168,8 +168,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<CHARACTER_STRING_identification*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const CHARACTER_STRING_identification*>(other_value)); } @@ -208,6 +208,7 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const CHARACTER_STRING_identification_syntaxes*>(other_value)); } Base_Type* clone() const { return new CHARACTER_STRING_identification_syntaxes(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &CHARACTER_STRING_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif @@ -215,7 +216,6 @@ public: boolean is_value() const; void clean_up(); void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); //void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -277,8 +277,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<CHARACTER_STRING_identification_syntaxes*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const CHARACTER_STRING_identification_syntaxes*>(other_value)); } @@ -320,11 +320,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const CHARACTER_STRING_identification_context__negotiation*>(other_value)); } Base_Type* clone() const { return new CHARACTER_STRING_identification_context__negotiation(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &CHARACTER_STRING_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); //void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -386,8 +386,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<CHARACTER_STRING_identification_context__negotiation*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const CHARACTER_STRING_identification_context__negotiation*>(other_value)); } @@ -438,11 +438,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const CHARACTER_STRING*>(other_value)); } Base_Type* clone() const { return new CHARACTER_STRING(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &CHARACTER_STRING_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -504,8 +504,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<CHARACTER_STRING*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const CHARACTER_STRING*>(other_value)); } diff --git a/core/ASN_EmbeddedPDV.cc b/core/ASN_EmbeddedPDV.cc index 1b92f8ce834dc37e04615a1bdb3d6b6f2cfce916..8f4b7f22ca0890b724ce4f9db722acfab9992603 100644 --- a/core/ASN_EmbeddedPDV.cc +++ b/core/ASN_EmbeddedPDV.cc @@ -376,9 +376,11 @@ void EMBEDDED_PDV_identification::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "union value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (mp->get_type()==Module_Param::MP_Value_List && mp->get_size()==0) return; if (mp->get_type()!=Module_Param::MP_Assignment_List) { param.error("union value with field name was expected"); @@ -411,6 +413,7 @@ void EMBEDDED_PDV_identification::set_param(Module_Param& param) mp_last->error("Field %s does not exist in type EMBEDDED PDV.identification.", mp_last->get_id()->get_name()); } +#ifdef TITAN_RUNTIME_2 Module_Param* EMBEDDED_PDV_identification::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -449,14 +452,17 @@ Module_Param* EMBEDDED_PDV_identification::get_param(Module_Param_Name& param_na mp->add_elem(mp_field); return mp; } +#endif void EMBEDDED_PDV_identification_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "union template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -515,6 +521,7 @@ void EMBEDDED_PDV_identification_template::set_param(Module_Param& param) is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* EMBEDDED_PDV_identification_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -584,6 +591,7 @@ Module_Param* EMBEDDED_PDV_identification_template::get_param(Module_Param_Name& } return mp; } +#endif void EMBEDDED_PDV_identification::encode_text(Text_Buf& text_buf) const { @@ -1656,9 +1664,11 @@ void EMBEDDED_PDV_identification_syntaxes::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -1695,6 +1705,7 @@ void EMBEDDED_PDV_identification_syntaxes::set_param(Module_Param& param) } } +#ifdef TITAN_RUNTIME_2 Module_Param* EMBEDDED_PDV_identification_syntaxes::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -1709,6 +1720,7 @@ Module_Param* EMBEDDED_PDV_identification_syntaxes::get_param(Module_Param_Name& mp->add_elem(mp_field_transfer); return mp; } +#endif void EMBEDDED_PDV_identification_syntaxes::encode_text(Text_Buf& text_buf) const { @@ -1825,9 +1837,11 @@ void EMBEDDED_PDV_identification_syntaxes_template::set_param(Module_Param& para { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -1884,6 +1898,7 @@ void EMBEDDED_PDV_identification_syntaxes_template::set_param(Module_Param& para is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* EMBEDDED_PDV_identification_syntaxes_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -1929,6 +1944,7 @@ Module_Param* EMBEDDED_PDV_identification_syntaxes_template::get_param(Module_Pa } return mp; } +#endif void EMBEDDED_PDV_identification_syntaxes_template::clean_up() { @@ -2388,9 +2404,11 @@ void EMBEDDED_PDV_identification_context__negotiation::set_param(Module_Param& p { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -2427,6 +2445,7 @@ void EMBEDDED_PDV_identification_context__negotiation::set_param(Module_Param& p } } +#ifdef TITAN_RUNTIME_2 Module_Param* EMBEDDED_PDV_identification_context__negotiation::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -2441,6 +2460,7 @@ Module_Param* EMBEDDED_PDV_identification_context__negotiation::get_param(Module mp->add_elem(mp_field_transfer_syntax); return mp; } +#endif void EMBEDDED_PDV_identification_context__negotiation::encode_text(Text_Buf& text_buf) const { @@ -2558,9 +2578,11 @@ void EMBEDDED_PDV_identification_context__negotiation_template::set_param(Module { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -2617,6 +2639,7 @@ void EMBEDDED_PDV_identification_context__negotiation_template::set_param(Module is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* EMBEDDED_PDV_identification_context__negotiation_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -2662,6 +2685,7 @@ Module_Param* EMBEDDED_PDV_identification_context__negotiation_template::get_par } return mp; } +#endif void EMBEDDED_PDV_identification_context__negotiation_template::clean_up() { @@ -3130,9 +3154,11 @@ void EMBEDDED_PDV::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -3177,6 +3203,7 @@ void EMBEDDED_PDV::set_param(Module_Param& param) } } +#ifdef TITAN_RUNTIME_2 Module_Param* EMBEDDED_PDV::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -3194,6 +3221,7 @@ Module_Param* EMBEDDED_PDV::get_param(Module_Param_Name& param_name) const mp->add_elem(mp_field_data_value); return mp; } +#endif void EMBEDDED_PDV::encode_text(Text_Buf& text_buf) const { @@ -3419,9 +3447,11 @@ void EMBEDDED_PDV_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -3486,6 +3516,7 @@ void EMBEDDED_PDV_template::set_param(Module_Param& param) is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* EMBEDDED_PDV_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -3534,6 +3565,7 @@ Module_Param* EMBEDDED_PDV_template::get_param(Module_Param_Name& param_name) co } return mp; } +#endif void EMBEDDED_PDV_template::clean_up() { diff --git a/core/ASN_EmbeddedPDV.hh b/core/ASN_EmbeddedPDV.hh index 07079196200913982af3b1d3a362e32cb11e6eec..8b962c974ea1d0dbec09b70362fe074a2c5dc9b5 100644 --- a/core/ASN_EmbeddedPDV.hh +++ b/core/ASN_EmbeddedPDV.hh @@ -87,11 +87,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const EMBEDDED_PDV_identification*>(other_value)); } Base_Type* clone() const { return new EMBEDDED_PDV_identification(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &EMBEDDED_PDV_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); //void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -168,8 +168,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<EMBEDDED_PDV_identification*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EMBEDDED_PDV_identification*>(other_value)); } @@ -211,11 +211,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const EMBEDDED_PDV_identification_syntaxes*>(other_value)); } Base_Type* clone() const { return new EMBEDDED_PDV_identification_syntaxes(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &EMBEDDED_PDV_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); //void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -275,8 +275,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<EMBEDDED_PDV_identification_syntaxes*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EMBEDDED_PDV_identification_syntaxes*>(other_value)); } @@ -318,11 +318,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const EMBEDDED_PDV_identification_context__negotiation*>(other_value)); } Base_Type* clone() const { return new EMBEDDED_PDV_identification_context__negotiation(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &EMBEDDED_PDV_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); //void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -382,8 +382,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<EMBEDDED_PDV_identification_context__negotiation*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EMBEDDED_PDV_identification_context__negotiation*>(other_value)); } @@ -430,12 +430,12 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const EMBEDDED_PDV*>(other_value)); } Base_Type* clone() const { return new EMBEDDED_PDV(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &EMBEDDED_PDV_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void log() const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -497,8 +497,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<EMBEDDED_PDV*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EMBEDDED_PDV*>(other_value)); } diff --git a/core/ASN_External.cc b/core/ASN_External.cc index 19e189520d06f05da8803a39aa97cb0748a19955..c1690ce25b4aec0069196763720192a8ff6cd188 100644 --- a/core/ASN_External.cc +++ b/core/ASN_External.cc @@ -1000,9 +1000,11 @@ void EXTERNAL_identification::log() const void EXTERNAL_identification::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "union value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (mp->get_type()==Module_Param::MP_Value_List && mp->get_size()==0) return; if (mp->get_type()!=Module_Param::MP_Assignment_List) { param.error("union value with field name was expected"); @@ -1035,6 +1037,7 @@ void EXTERNAL_identification::set_param(Module_Param& param) { mp_last->error("Field %s does not exist in type EXTERNAL.identification.", mp_last->get_id()->get_name()); } +#ifdef TITAN_RUNTIME_2 Module_Param* EXTERNAL_identification::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -1074,14 +1077,17 @@ Module_Param* EXTERNAL_identification::get_param(Module_Param_Name& param_name) mp->add_elem(mp_field); return mp; } +#endif void EXTERNAL_identification_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "union template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -1140,6 +1146,7 @@ void EXTERNAL_identification_template::set_param(Module_Param& param) is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* EXTERNAL_identification_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -1209,6 +1216,7 @@ Module_Param* EXTERNAL_identification_template::get_param(Module_Param_Name& par } return mp; } +#endif void EXTERNAL_identification::encode_text(Text_Buf& text_buf) const { @@ -2047,9 +2055,11 @@ void EXTERNAL_identification_syntaxes::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -2086,6 +2096,7 @@ void EXTERNAL_identification_syntaxes::set_param(Module_Param& param) } } +#ifdef TITAN_RUNTIME_2 Module_Param* EXTERNAL_identification_syntaxes::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -2100,6 +2111,7 @@ Module_Param* EXTERNAL_identification_syntaxes::get_param(Module_Param_Name& par mp->add_elem(mp_field_transfer); return mp; } +#endif void EXTERNAL_identification_syntaxes::encode_text(Text_Buf& text_buf) const { @@ -2122,9 +2134,11 @@ void EXTERNAL_identification_syntaxes_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -2181,6 +2195,7 @@ void EXTERNAL_identification_syntaxes_template::set_param(Module_Param& param) is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* EXTERNAL_identification_syntaxes_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -2226,6 +2241,7 @@ Module_Param* EXTERNAL_identification_syntaxes_template::get_param(Module_Param_ } return mp; } +#endif void EXTERNAL_identification_syntaxes_template::clean_up() { @@ -2685,9 +2701,11 @@ void EXTERNAL_identification_context__negotiation::set_param(Module_Param& param { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -2724,6 +2742,7 @@ void EXTERNAL_identification_context__negotiation::set_param(Module_Param& param } } +#ifdef TITAN_RUNTIME_2 Module_Param* EXTERNAL_identification_context__negotiation::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -2738,6 +2757,7 @@ Module_Param* EXTERNAL_identification_context__negotiation::get_param(Module_Par mp->add_elem(mp_field_transfer_syntax); return mp; } +#endif void EXTERNAL_identification_context__negotiation::encode_text(Text_Buf& text_buf) const { @@ -2760,9 +2780,11 @@ void EXTERNAL_identification_context__negotiation_template::set_param(Module_Par { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -2819,6 +2841,7 @@ void EXTERNAL_identification_context__negotiation_template::set_param(Module_Par is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* EXTERNAL_identification_context__negotiation_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -2864,6 +2887,7 @@ Module_Param* EXTERNAL_identification_context__negotiation_template::get_param(M } return mp; } +#endif void EXTERNAL_identification_context__negotiation_template::clean_up() { @@ -3332,9 +3356,11 @@ void EXTERNAL::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "record value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()==0) return; @@ -3379,6 +3405,7 @@ void EXTERNAL::set_param(Module_Param& param) } } +#ifdef TITAN_RUNTIME_2 Module_Param* EXTERNAL::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -3396,6 +3423,7 @@ Module_Param* EXTERNAL::get_param(Module_Param_Name& param_name) const mp->add_elem(mp_field_data_value); return mp; } +#endif void EXTERNAL::encode_text(Text_Buf& text_buf) const { @@ -3508,9 +3536,11 @@ void EXTERNAL_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "record template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -3575,6 +3605,7 @@ void EXTERNAL_template::set_param(Module_Param& param) is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* EXTERNAL_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -3623,6 +3654,7 @@ Module_Param* EXTERNAL_template::get_param(Module_Param_Name& param_name) const } return mp; } +#endif void EXTERNAL_template::clean_up() { diff --git a/core/ASN_External.hh b/core/ASN_External.hh index 0786ee4a04e258608ab23a70dd964a2daa521dbc..5ff895ea1bc792a3cd222f7783c861334e333a15 100644 --- a/core/ASN_External.hh +++ b/core/ASN_External.hh @@ -87,11 +87,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification*>(other_value)); } Base_Type* clone() const { return new EXTERNAL_identification(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); }; @@ -157,8 +157,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<EXTERNAL_identification*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification*>(other_value)); } @@ -200,11 +200,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification_syntaxes*>(other_value)); } Base_Type* clone() const { return new EXTERNAL_identification_syntaxes(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); }; @@ -258,8 +258,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<EXTERNAL_identification_syntaxes*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification_syntaxes*>(other_value)); } @@ -301,11 +301,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification_context__negotiation*>(other_value)); } Base_Type* clone() const { return new EXTERNAL_identification_context__negotiation(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); }; @@ -359,8 +359,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<EXTERNAL_identification_context__negotiation*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL_identification_context__negotiation*>(other_value)); } @@ -410,11 +410,11 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL*>(other_value)); } Base_Type* clone() const { return new EXTERNAL(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &EXTERNAL_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); void encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const; @@ -478,8 +478,8 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<EXTERNAL*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const EXTERNAL*>(other_value)); } diff --git a/core/ASN_Null.cc b/core/ASN_Null.cc index fb81911e42b94b5c9efa002ef7cf67a37f800bc7..107d47585469f7247a49a6ad3249d05d3b3c6734 100644 --- a/core/ASN_Null.cc +++ b/core/ASN_Null.cc @@ -89,13 +89,16 @@ void ASN_NULL::log() const void ASN_NULL::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "NULL value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (mp->get_type()!=Module_Param::MP_Asn_Null) param.type_error("NULL value"); bound_flag = TRUE; } +#ifdef TITAN_RUNTIME_2 Module_Param* ASN_NULL::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -103,6 +106,7 @@ Module_Param* ASN_NULL::get_param(Module_Param_Name& /* param_name */) const } return new Module_Param_Asn_Null(); } +#endif void ASN_NULL::encode_text(Text_Buf&) const { @@ -548,9 +552,11 @@ void ASN_NULL_template::log_match(const ASN_NULL& match_value, void ASN_NULL_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "NULL template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -580,6 +586,7 @@ void ASN_NULL_template::set_param(Module_Param& param) { is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* ASN_NULL_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -619,6 +626,7 @@ Module_Param* ASN_NULL_template::get_param(Module_Param_Name& param_name) const } return mp; } +#endif void ASN_NULL_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/ASN_Null.hh b/core/ASN_Null.hh index 7ede6bbc540d8593d86aebcda1f0744da0d650c9..58b8874abf2b492a0a7ad2cc08b5dfc3035f8394 100644 --- a/core/ASN_Null.hh +++ b/core/ASN_Null.hh @@ -61,12 +61,12 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const ASN_NULL*>(other_value)); } Base_Type* clone() const { return new ASN_NULL(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &ASN_NULL_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -136,7 +136,6 @@ public: void log_match(const ASN_NULL& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -144,6 +143,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<ASN_NULL*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const ASN_NULL*>(other_value)); } diff --git a/core/Array.hh b/core/Array.hh index f84f69bf855f34a4c1eb83d340c662b28d25c0e0..1806b52a3d70811942b83bbabab343216e7d21c7 100644 --- a/core/Array.hh +++ b/core/Array.hh @@ -225,9 +225,9 @@ public: int lengthof() const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; boolean is_equal(const Base_Type* other_value) const { return *this == *(static_cast<const VALUE_ARRAY*>(other_value)); } void set_value(const Base_Type* other_value) { *this = *(static_cast<const VALUE_ARRAY*>(other_value)); } Base_Type* clone() const { return new VALUE_ARRAY(*this); } @@ -392,9 +392,11 @@ void VALUE_ARRAY<T_type,array_size,index_offset>::set_param( param.basic_check(Module_Param::BC_VALUE, "array value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Value_List: if (mp->get_size()!=array_size) { @@ -418,6 +420,7 @@ void VALUE_ARRAY<T_type,array_size,index_offset>::set_param( } } +#ifdef TITAN_RUNTIME_2 template <typename T_type, unsigned int array_size, int index_offset> Module_Param* VALUE_ARRAY<T_type,array_size,index_offset>::get_param (Module_Param_Name& param_name) const @@ -449,6 +452,7 @@ Module_Param* VALUE_ARRAY<T_type,array_size,index_offset>::get_param values.clear(); return mp; } +#endif template <typename T_type, unsigned int array_size, int index_offset> void VALUE_ARRAY<T_type,array_size,index_offset>::encode_text @@ -726,7 +730,6 @@ public: match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -735,6 +738,7 @@ public: boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<VALUE_ARRAY<T_value_type, array_size, index_offset>*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const VALUE_ARRAY<T_value_type, array_size, index_offset>*>(other_value)); } @@ -1531,9 +1535,11 @@ void TEMPLATE_ARRAY<T_value_type,T_template_type,array_size,index_offset>::set_p param.basic_check(Module_Param::BC_TEMPLATE, "array template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: @@ -1576,6 +1582,7 @@ void TEMPLATE_ARRAY<T_value_type,T_template_type,array_size,index_offset>::set_p is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 template <typename T_value_type, typename T_template_type, unsigned int array_size, int index_offset> Module_Param* TEMPLATE_ARRAY<T_value_type,T_template_type,array_size,index_offset>:: @@ -1639,6 +1646,7 @@ Module_Param* TEMPLATE_ARRAY<T_value_type,T_template_type,array_size,index_offse } return mp; } +#endif template <typename T_value_type, typename T_template_type, unsigned int array_size, int index_offset> diff --git a/core/Bitstring.cc b/core/Bitstring.cc index 3491fa74f4d12ca973dce266fd4bfcc9928014aa..571b342424b382148e2e5bda19934e59019fc395 100644 --- a/core/Bitstring.cc +++ b/core/Bitstring.cc @@ -560,9 +560,11 @@ void BITSTRING::log() const void BITSTRING::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "bitstring value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Bitstring: switch (param.get_operation_type()) { @@ -605,6 +607,7 @@ void BITSTRING::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* BITSTRING::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -615,6 +618,7 @@ Module_Param* BITSTRING::get_param(Module_Param_Name& /* param_name */) const memcpy(val_cpy, val_ptr->bits_ptr, n_bytes); return new Module_Param_Bitstring(val_ptr->n_bits, val_cpy); } +#endif void BITSTRING::encode_text(Text_Buf& text_buf) const { @@ -1903,9 +1907,11 @@ void BITSTRING_template::log_match(const BITSTRING& match_value, void BITSTRING_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "bitstring template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -1955,6 +1961,7 @@ void BITSTRING_template::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* BITSTRING_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -2003,6 +2010,7 @@ Module_Param* BITSTRING_template::get_param(Module_Param_Name& param_name) const mp->set_length_restriction(get_length_range()); return mp; } +#endif void BITSTRING_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Bitstring.hh b/core/Bitstring.hh index 95db2ab6a5aa01d46e72d613243347de7d5c7792..98cf7b4d663df874c869125705a2ca4486403a0e 100644 --- a/core/Bitstring.hh +++ b/core/Bitstring.hh @@ -146,12 +146,12 @@ public: Base_Type* clone() const { return new BITSTRING(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &BITSTRING_descr_; } virtual int RAW_encode_negtest_raw(RAW_enc_tree& p_myleaf) const; + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -307,7 +307,6 @@ public: void log_match(const BITSTRING& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -315,6 +314,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<BITSTRING*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const BITSTRING*>(other_value)); } diff --git a/core/Boolean.cc b/core/Boolean.cc index 1f8ff50de04f490cdfd51b27557f7ef057bca730..4faa62f051fada2d53d4a73234cd0131feec5b68 100644 --- a/core/Boolean.cc +++ b/core/Boolean.cc @@ -181,14 +181,17 @@ void BOOLEAN::decode_text(Text_Buf& text_buf) void BOOLEAN::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "boolean value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (mp->get_type()!=Module_Param::MP_Boolean) param.type_error("boolean value"); bound_flag = TRUE; boolean_value = mp->get_boolean(); } +#ifdef TITAN_RUNTIME_2 Module_Param* BOOLEAN::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -196,6 +199,7 @@ Module_Param* BOOLEAN::get_param(Module_Param_Name& /* param_name */) const } return new Module_Param_Boolean(boolean_value); } +#endif void BOOLEAN::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const @@ -1037,9 +1041,11 @@ void BOOLEAN_template::log_match(const BOOLEAN& match_value, void BOOLEAN_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "boolean template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -1069,6 +1075,7 @@ void BOOLEAN_template::set_param(Module_Param& param) { is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* BOOLEAN_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -1108,6 +1115,7 @@ Module_Param* BOOLEAN_template::get_param(Module_Param_Name& param_name) const } return mp; } +#endif void BOOLEAN_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Boolean.hh b/core/Boolean.hh index 8d92dc7317ac34ded9da30f3e595b09f40876cab..e0812f667fa263e6e2756e02beb9ee43f262112b 100644 --- a/core/Boolean.hh +++ b/core/Boolean.hh @@ -78,6 +78,7 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const BOOLEAN*>(other_value)); } Base_Type* clone() const { return new BOOLEAN(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &BOOLEAN_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif @@ -85,7 +86,6 @@ public: void log() const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -182,7 +182,6 @@ public: void log_match(const BOOLEAN& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -190,6 +189,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<BOOLEAN*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const BOOLEAN*>(other_value)); } diff --git a/core/Charstring.cc b/core/Charstring.cc index 575f81ba51c2e35a108a8d92d1765e82f177eee0..f2994c9c770c31d39202beecdc589fab346fcbc7 100644 --- a/core/Charstring.cc +++ b/core/Charstring.cc @@ -654,9 +654,11 @@ boolean CHARSTRING::set_param_internal(Module_Param& param, boolean allow_patter boolean is_pattern = FALSE; param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "charstring value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Universal_Charstring: case Module_Param::MP_Charstring: @@ -738,6 +740,7 @@ void CHARSTRING::set_param(Module_Param& param) { set_param_internal(param, FALSE); } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARSTRING::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -745,6 +748,7 @@ Module_Param* CHARSTRING::get_param(Module_Param_Name& /* param_name */) const } return new Module_Param_Charstring(val_ptr->n_chars, mcopystr(val_ptr->chars_ptr)); } +#endif void CHARSTRING::encode_text(Text_Buf& text_buf) const { @@ -2678,9 +2682,11 @@ void CHARSTRING_template::log_match(const CHARSTRING& match_value, void CHARSTRING_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "charstring template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -2759,6 +2765,7 @@ void CHARSTRING_template::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* CHARSTRING_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -2810,6 +2817,7 @@ Module_Param* CHARSTRING_template::get_param(Module_Param_Name& param_name) cons mp->set_length_restriction(get_length_range()); return mp; } +#endif void CHARSTRING_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Charstring.hh b/core/Charstring.hh index 90cf64e215d284c1af05c445e2ae743330b48cb5..05bd99cb66510f146808571b61e7ecd8db188a9d 100644 --- a/core/Charstring.hh +++ b/core/Charstring.hh @@ -190,6 +190,7 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const CHARSTRING*>(other_value)); } Base_Type* clone() const { return new CHARSTRING(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &CHARSTRING_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif @@ -199,7 +200,6 @@ public: * @note UFT-8 strings will be decoded. If the decoding results in multi-octet * characters an error will be thrown. */ void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -440,7 +440,6 @@ public: void log_match(const CHARSTRING& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -448,6 +447,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<CHARSTRING*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const CHARSTRING*>(other_value)); } diff --git a/core/Component.cc b/core/Component.cc index 72d63ef7f3fd90066ddb5f338c0ae9a6943ca7c8..9b412cef02f32afd30d9bd0b410b0148efa7ccdb 100644 --- a/core/Component.cc +++ b/core/Component.cc @@ -138,9 +138,11 @@ void COMPONENT::kill() const void COMPONENT::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "component reference (integer or null) value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (Ttcn_String_Parsing::happening() || Debugger_Value_Parsing::happening()) { // accept all component values in case it's a string2ttcn operation or // an overwrite operation through the debugger @@ -170,6 +172,7 @@ void COMPONENT::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* COMPONENT::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -177,6 +180,7 @@ Module_Param* COMPONENT::get_param(Module_Param_Name& /* param_name */) const } return new Module_Param_Ttcn_Null(); } +#endif void COMPONENT::encode_text(Text_Buf& text_buf) const { @@ -653,9 +657,11 @@ void COMPONENT_template::log_match(const COMPONENT& match_value, void COMPONENT_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "component reference (integer or null) template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -694,6 +700,7 @@ void COMPONENT_template::set_param(Module_Param& param) { is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* COMPONENT_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -746,6 +753,7 @@ Module_Param* COMPONENT_template::get_param(Module_Param_Name& param_name) const } return mp; } +#endif void COMPONENT_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Component.hh b/core/Component.hh index d4b48f71135b8f3b358e51d19261d28eb43bbeb8..468c2370e7e5a427e112f6d34153f06cc0e8095a 100644 --- a/core/Component.hh +++ b/core/Component.hh @@ -71,6 +71,7 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const COMPONENT*>(other_value)); } Base_Type* clone() const { return new COMPONENT(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &COMPONENT_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif @@ -85,7 +86,6 @@ public: void kill() const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -163,7 +163,6 @@ public: void log_match(const COMPONENT& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -171,6 +170,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<COMPONENT*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const COMPONENT*>(other_value)); } diff --git a/core/Default.cc b/core/Default.cc index f0f62538f1976e44faf0ef613c385462a1f7681e..bd903f04e2204d2645d273e3e8ea0aa2de9deb65 100644 --- a/core/Default.cc +++ b/core/Default.cc @@ -153,13 +153,16 @@ void DEFAULT::log() const void DEFAULT::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "default reference (null) value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (mp->get_type()!=Module_Param::MP_Ttcn_Null) param.type_error("default reference (null) value"); default_ptr = NULL; } +#ifdef TITAN_RUNTIME_2 Module_Param* DEFAULT::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -167,6 +170,7 @@ Module_Param* DEFAULT::get_param(Module_Param_Name& /* param_name */) const } return new Module_Param_Ttcn_Null(); } +#endif void DEFAULT::encode_text(Text_Buf&) const { @@ -464,9 +468,11 @@ void DEFAULT_template::log_match(const DEFAULT& match_value, void DEFAULT_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "default reference (null) template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -496,6 +502,7 @@ void DEFAULT_template::set_param(Module_Param& param) { is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* DEFAULT_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -535,6 +542,7 @@ Module_Param* DEFAULT_template::get_param(Module_Param_Name& param_name) const } return mp; } +#endif void DEFAULT_template::encode_text(Text_Buf&) const { diff --git a/core/Default.hh b/core/Default.hh index d479901fdfe51af3d61bf222a9a1b7d6ca79abd1..a24e21e1b5812013b079a4cd144f0132939f5f13 100644 --- a/core/Default.hh +++ b/core/Default.hh @@ -90,12 +90,12 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const DEFAULT*>(other_value)); } Base_Type* clone() const { return new DEFAULT(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &DEFAULT_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -154,7 +154,6 @@ public: void log_match(const DEFAULT& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -162,6 +161,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<DEFAULT*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const DEFAULT*>(other_value)); } diff --git a/core/Float.cc b/core/Float.cc index 4b7812652856465b00efb9dc5b35170c9983e4ad..721420353ed6498e369a1363a30e03ddf8cdc83a 100644 --- a/core/Float.cc +++ b/core/Float.cc @@ -262,9 +262,11 @@ void FLOAT::log() const void FLOAT::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "float value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Float: { clean_up(); @@ -316,6 +318,7 @@ void FLOAT::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* FLOAT::get_param(Module_Param_Name& /* param_name */) const { if (!bound_flag) { @@ -323,6 +326,7 @@ Module_Param* FLOAT::get_param(Module_Param_Name& /* param_name */) const } return new Module_Param_Float(float_value); } +#endif void FLOAT::encode_text(Text_Buf& text_buf) const { @@ -839,6 +843,10 @@ int FLOAT::RAW_decode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& buff, return decode_length + prepaddlength; } +const char* XER_POS_INF_STR = "INF"; +const char* XER_NEG_INF_STR = "-INF"; +const char* XER_NAN_STR = "NaN"; + int FLOAT::XER_encode(const XERdescriptor_t& p_td, TTCN_Buffer& p_buf, unsigned int flavor, int indent, embed_values_enc_struct_t*) const { @@ -855,11 +863,29 @@ int FLOAT::XER_encode(const XERdescriptor_t& p_td, if (exer && (p_td.xer_bits & XER_DECIMAL)) { char buf[312]; - int n = snprintf(buf, sizeof(buf), "%f", (double)float_value); + int n = 0; + if (isnan((double)float_value)) { + n = snprintf(buf, sizeof(buf), "%s", XER_NAN_STR); + } else if ((double)float_value == (double)INFINITY) { + n = snprintf(buf, sizeof(buf), "%s", XER_POS_INF_STR); + } else if ((double)float_value == -(double)INFINITY) { + n = snprintf(buf, sizeof(buf), "%s", XER_NEG_INF_STR); + } else { + n = snprintf(buf, sizeof(buf), "%f", (double)float_value); + } p_buf.put_s((size_t)n, (const unsigned char*)buf); } else { - CHARSTRING value = float2str(float_value); + CHARSTRING value; + if (isnan((double)float_value)) { + value = XER_NAN_STR; + } else if ((double)float_value == (double)INFINITY) { + value = XER_POS_INF_STR; + } else if ((double)float_value == -(double)INFINITY) { + value = XER_NEG_INF_STR; + } else { + value = float2str(float_value); + } p_buf.put_string(value); } @@ -938,12 +964,25 @@ int FLOAT::XER_decode(const XERdescriptor_t& p_td, XmlReaderWrap& reader, verify_name(reader, p_td, exer); tagless: const char * value = (const char *)reader.Value(); - - if (value && is_float(value)) { - bound_flag = true; - sscanf(value, "%lf", &float_value); + if (value) { + if (is_float(value)) { + bound_flag = true; + sscanf(value, "%lf", &float_value); + } else if (strcmp(XER_NAN_STR, value) == 0 ) { + bound_flag = true; +#ifdef NAN + float_value = NAN; +#else + float_value = INFINITY + (-INFINITY); +#endif + } else if (strcmp(XER_POS_INF_STR, value) == 0) { + bound_flag = true; + float_value = (double)INFINITY; + } else if (strcmp(XER_NEG_INF_STR, value) == 0) { + bound_flag = true; + float_value = -(double)INFINITY; + } } - // Let the caller do reader.AdvanceAttribute(); } else { @@ -962,9 +1001,24 @@ tagless: } else if (XML_READER_TYPE_TEXT == type && depth != -1) { const char * value = (const char*)reader.Value(); - if (value && is_float(value)) { - bound_flag = true; - sscanf(value, "%lf", &float_value); + if (value) { + if (is_float(value)) { + bound_flag = true; + sscanf(value, "%lf", &float_value); + } else if (strcmp("NaN", value) == 0 ) { + bound_flag = true; +#ifdef NAN + float_value = NAN; +#else + float_value = INFINITY + (-INFINITY); +#endif + } else if (strcmp("INF", value) == 0) { + bound_flag = true; + float_value = (double)INFINITY; + } else if (strcmp("-INF", value) == 0) { + bound_flag = true; + float_value = -(double)INFINITY; + } } } else if (XML_READER_TYPE_END_ELEMENT == type) { @@ -1431,9 +1485,11 @@ void FLOAT_template::log_match(const FLOAT& match_value, void FLOAT_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "float template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -1507,6 +1563,7 @@ void FLOAT_template::set_param(Module_Param& param) { is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* FLOAT_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -1551,6 +1608,7 @@ Module_Param* FLOAT_template::get_param(Module_Param_Name& param_name) const } return mp; } +#endif void FLOAT_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Float.hh b/core/Float.hh index 4b694c9cec4b12063c41a93a70fdd8a3d25e88ad..212d50343984e2c07906dca7c0bd0c4b8bc0967a 100644 --- a/core/Float.hh +++ b/core/Float.hh @@ -113,12 +113,12 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const FLOAT*>(other_value)); } Base_Type* clone() const { return new FLOAT(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &FLOAT_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -237,7 +237,6 @@ public: void log_match(const FLOAT& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -245,6 +244,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<FLOAT*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const FLOAT*>(other_value)); } diff --git a/core/Hexstring.cc b/core/Hexstring.cc index 6bfa8b05f492b436e4eb66813e909aef62de628d..639c5e30816846bb40e4dfde082dee98159b3ec4 100644 --- a/core/Hexstring.cc +++ b/core/Hexstring.cc @@ -600,9 +600,11 @@ void HEXSTRING::decode_text(Text_Buf& text_buf) void HEXSTRING::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "hexstring value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Hexstring: switch (param.get_operation_type()) { @@ -646,6 +648,7 @@ void HEXSTRING::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* HEXSTRING::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -656,6 +659,7 @@ Module_Param* HEXSTRING::get_param(Module_Param_Name& /* param_name */) const memcpy(val_cpy, val_ptr->nibbles_ptr, n_bytes); return new Module_Param_Hexstring(val_ptr->n_nibbles, val_cpy); } +#endif void HEXSTRING::encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf, TTCN_EncDec::coding_t p_coding, ...) const @@ -1795,9 +1799,11 @@ void HEXSTRING_template::log_match(const HEXSTRING& match_value, void HEXSTRING_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "hexstring template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -1847,6 +1853,7 @@ void HEXSTRING_template::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* HEXSTRING_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -1895,6 +1902,7 @@ Module_Param* HEXSTRING_template::get_param(Module_Param_Name& param_name) const mp->set_length_restriction(get_length_range()); return mp; } +#endif void HEXSTRING_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Hexstring.hh b/core/Hexstring.hh index c8b8816b8e6080829bdc2a574589231861108a71..786fabc492fed15549fa1304ec633f188d4e188b 100644 --- a/core/Hexstring.hh +++ b/core/Hexstring.hh @@ -117,13 +117,13 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const HEXSTRING*>(other_value)); } Base_Type* clone() const { return new HEXSTRING(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &HEXSTRING_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void log() const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -261,7 +261,6 @@ public: void log_match(const HEXSTRING& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -269,6 +268,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<HEXSTRING*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const HEXSTRING*>(other_value)); } diff --git a/core/Integer.cc b/core/Integer.cc index 52f884e0e88a2055d2f4cfa1f2da079acd166f53..f84fe0f59996d617011f3ff4fd8026e364044238 100644 --- a/core/Integer.cc +++ b/core/Integer.cc @@ -657,9 +657,11 @@ void INTEGER::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "integer value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Integer: { clean_up(); @@ -717,6 +719,7 @@ void INTEGER::set_param(Module_Param& param) } } +#ifdef TITAN_RUNTIME_2 Module_Param* INTEGER::get_param(Module_Param_Name& /* param_name */) const { if (!bound_flag) { @@ -727,6 +730,7 @@ Module_Param* INTEGER::get_param(Module_Param_Name& /* param_name */) const } return new Module_Param_Integer(new int_val_t(BN_dup(val.openssl))); } +#endif void INTEGER::encode_text(Text_Buf& text_buf) const { @@ -2343,9 +2347,11 @@ void INTEGER_template::log_match(const INTEGER& match_value, void INTEGER_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "integer template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -2429,6 +2435,7 @@ void INTEGER_template::set_param(Module_Param& param) { is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* INTEGER_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -2494,6 +2501,7 @@ Module_Param* INTEGER_template::get_param(Module_Param_Name& param_name) const } return mp; } +#endif void INTEGER_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Integer.hh b/core/Integer.hh index f35bab31c18d2bc8c359340d5f0e10d46e19123c..d0c087ff297f4906e3bfeb0420058e2d625dc43e 100644 --- a/core/Integer.hh +++ b/core/Integer.hh @@ -139,12 +139,12 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const INTEGER*>(other_value)); } Base_Type* clone() const { return new INTEGER(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &INTEGER_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -326,7 +326,6 @@ public: void log_match(const INTEGER& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -335,6 +334,7 @@ public: boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<INTEGER*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const INTEGER*>(other_value)); } diff --git a/core/Module_list.cc b/core/Module_list.cc index f3a90fead19e76f9b57a23ace596426c6f5eafbc..4bf63730e8e456deb2bef8de852fb0503fece95e 100644 --- a/core/Module_list.cc +++ b/core/Module_list.cc @@ -203,6 +203,7 @@ void Module_List::set_param(Module_Param& param) } } +#ifdef TITAN_RUNTIME_2 Module_Param* Module_List::get_param(Module_Param_Name& param_name) { // The first segment in the parameter name can either be the module name, @@ -258,6 +259,7 @@ Module_Param* Module_List::get_param(Module_Param_Name& param_name) return param; } +#endif void Module_List::log_param() { diff --git a/core/Module_list.hh b/core/Module_list.hh index 352492fe00f1d2819edef97f19684cc478979273..75351602d66017e3153b8b3878893dbd4974fe39 100644 --- a/core/Module_list.hh +++ b/core/Module_list.hh @@ -52,7 +52,9 @@ public: const char *component_type, boolean init_base_comps); static void set_param(Module_Param& param); +#ifdef TITAN_RUNTIME_2 static Module_Param* get_param(Module_Param_Name& param_name); +#endif static void log_param(); static void execute_control(const char *module_name); diff --git a/core/Objid.cc b/core/Objid.cc index beab7b3e7203feb68de56146b5cc954082f9de2e..dd09fd65778b8220476f3cd799356603f0e85864 100644 --- a/core/Objid.cc +++ b/core/Objid.cc @@ -231,9 +231,11 @@ void OBJID::log() const void OBJID::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "objid value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (mp->get_type()!=Module_Param::MP_Objid) param.type_error("objid value"); if (sizeof(objid_element)!=sizeof(int)) TTCN_error("Internal error: OBJID::set_param()"); clean_up(); @@ -241,15 +243,17 @@ void OBJID::set_param(Module_Param& param) { memcpy(val_ptr->components_ptr, mp->get_string_data(), val_ptr->n_components * sizeof(objid_element)); } +#ifdef TITAN_RUNTIME_2 Module_Param* OBJID::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { return new Module_Param_Unbound(); } - int* val_cpy = (int *)Malloc(val_ptr->n_components); + int* val_cpy = (int *)Malloc(val_ptr->n_components * sizeof(int)); memcpy(val_cpy, val_ptr->components_ptr, val_ptr->n_components * sizeof(int)); return new Module_Param_Objid(val_ptr->n_components, val_cpy); } +#endif void OBJID::encode_text(Text_Buf& text_buf) const { @@ -901,9 +905,11 @@ void OBJID_template::log_match(const OBJID& match_value, void OBJID_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "objid template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -937,6 +943,7 @@ void OBJID_template::set_param(Module_Param& param) { is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* OBJID_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -976,6 +983,7 @@ Module_Param* OBJID_template::get_param(Module_Param_Name& param_name) const } return mp; } +#endif void OBJID_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Objid.hh b/core/Objid.hh index e0cfcb06b600a76ca39041502436de03ffa14c5f..04d4b0756610125c7b32b86e30c5802209537a8a 100644 --- a/core/Objid.hh +++ b/core/Objid.hh @@ -79,6 +79,7 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const OBJID*>(other_value)); } Base_Type* clone() const { return new OBJID(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &OBJID_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif @@ -86,7 +87,6 @@ public: void log() const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -154,7 +154,6 @@ public: void log_match(const OBJID& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -162,6 +161,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<OBJID*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const OBJID*>(other_value)); } diff --git a/core/Octetstring.cc b/core/Octetstring.cc index fab2f843ce6c51ba3e0318e31127489fd057754a..b652ed43e8db6197de8b5b03f709917a3fd41ec0 100644 --- a/core/Octetstring.cc +++ b/core/Octetstring.cc @@ -517,9 +517,11 @@ void OCTETSTRING::log() const void OCTETSTRING::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "octetstring value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Octetstring: switch (param.get_operation_type()) { @@ -561,6 +563,7 @@ void OCTETSTRING::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* OCTETSTRING::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -570,6 +573,7 @@ Module_Param* OCTETSTRING::get_param(Module_Param_Name& /* param_name */) const memcpy(val_cpy, val_ptr->octets_ptr, val_ptr->n_octets); return new Module_Param_Octetstring(val_ptr->n_octets, val_cpy); } +#endif void OCTETSTRING::encode_text(Text_Buf& text_buf) const { @@ -2025,9 +2029,11 @@ void OCTETSTRING_template::log_match(const OCTETSTRING& match_value, void OCTETSTRING_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "octetstring template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -2077,6 +2083,7 @@ void OCTETSTRING_template::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* OCTETSTRING_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -2127,6 +2134,7 @@ Module_Param* OCTETSTRING_template::get_param(Module_Param_Name& param_name) con mp->set_length_restriction(get_length_range()); return mp; } +#endif void OCTETSTRING_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Octetstring.hh b/core/Octetstring.hh index 2988df311ed11665b6cb1149033299be19fcce97..f104eaf1ed4f9e720b0b478c92eabfbaf1652b7a 100644 --- a/core/Octetstring.hh +++ b/core/Octetstring.hh @@ -125,13 +125,13 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const OCTETSTRING*>(other_value)); } Base_Type* clone() const { return new OCTETSTRING(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &OCTETSTRING_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif void log() const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -292,7 +292,6 @@ public: void log_match(const OCTETSTRING& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -300,6 +299,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<OCTETSTRING*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const OCTETSTRING*>(other_value)); } diff --git a/core/Optional.hh b/core/Optional.hh index 59c6aaed22b8fd9b9df050d5a70a1a1e87a9325c..8182f7ef0e835af033662e60dadd2001c756dcf1 100644 --- a/core/Optional.hh +++ b/core/Optional.hh @@ -271,7 +271,9 @@ public: void log() const; void set_param(Module_Param& param); +#ifdef TITAN_RUNTIME_2 Module_Param* get_param(Module_Param_Name& param_name) const; +#endif void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -765,6 +767,7 @@ void OPTIONAL<T_type>::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 template <typename T_type> Module_Param* OPTIONAL<T_type>::get_param(Module_Param_Name& param_name) const { @@ -781,6 +784,7 @@ Module_Param* OPTIONAL<T_type>::get_param(Module_Param_Name& param_name) const return new Module_Param_Unbound(); } } +#endif template<typename T_type> void OPTIONAL<T_type>::encode_text(Text_Buf& text_buf) const diff --git a/core/Param_Types.cc b/core/Param_Types.cc index 0b8a2bfc6b6fc4c2aa9f2e3f5b2528536d0313ca..53d9823032f5aee575d162411f46fff9e5755498 100644 --- a/core/Param_Types.cc +++ b/core/Param_Types.cc @@ -260,10 +260,12 @@ char* Module_Param::get_enumerated() const { return NULL; } +#ifdef TITAN_RUNTIME_2 Module_Param_Ptr Module_Param::get_referenced_param() const { TTCN_error("Internal error: Module_Param::get_referenced_param()"); return NULL; } +#endif Module_Param::expression_operand_t Module_Param::get_expr_type() const { TTCN_error("Internal error: Module_Param::get_expr_type()"); @@ -317,6 +319,7 @@ Module_Param_Ptr& Module_Param_Ptr::operator=(const Module_Param_Ptr& r) { return *this; } +#ifdef TITAN_RUNTIME_2 Module_Param_Reference::Module_Param_Reference(Module_Param_Name* p): mp_ref(p) { if (mp_ref == NULL) { TTCN_error("Internal error: Module_Param_Reference::Module_Param_Reference()"); @@ -347,6 +350,7 @@ void Module_Param_Reference::log_value() const { void Module_Param_Unbound::log_value() const { TTCN_Logger::log_event_str("<unbound>"); } +#endif Module_Param_Expression::Module_Param_Expression(expression_operand_t p_type, Module_Param* p_op1, Module_Param* p_op2) @@ -725,11 +729,23 @@ void Module_Param::type_error(const char* expected, const char* type_name /* = N } // either use this parameter's or the referenced parameter's type string // (but never the head's type string) - reporter->error("Type mismatch: %s or reference to %s was expected%s%s instead of %s%s.", - expected, expected, + reporter->error("Type mismatch: %s " +#ifdef TITAN_RUNTIME_2 + "or reference to %s " +#endif + "was expected%s%s instead of %s%s.", + expected, +#ifdef TITAN_RUNTIME_2 + expected, +#endif (type_name != NULL) ? " for type " : "", (type_name != NULL) ? type_name : "", +#ifdef TITAN_RUNTIME_2 (get_type() == MP_Reference) ? "reference to " : "", - (get_type() == MP_Reference) ? get_referenced_param()->get_type_str() : get_type_str()); + (get_type() == MP_Reference) ? get_referenced_param()->get_type_str() : get_type_str() +#else + "", get_type_str() +#endif + ); } } diff --git a/core/Param_Types.hh b/core/Param_Types.hh index b677c3fe257b8527ecb6db45a91e134edf2fa675..67766d075e8348b1777f6e867d1f832e913e18d9 100644 --- a/core/Param_Types.hh +++ b/core/Param_Types.hh @@ -284,7 +284,9 @@ public: virtual boolean get_nocase() const; virtual verdicttype get_verdict() const; virtual char* get_enumerated() const; +#ifdef TITAN_RUNTIME_2 virtual Module_Param_Ptr get_referenced_param() const; +#endif virtual expression_operand_t get_expr_type() const; virtual const char* get_expr_type_str() const; virtual Module_Param* get_operand1() const; @@ -311,6 +313,7 @@ public: Module_Param* operator->() { return ptr->mp_ptr; } }; +#ifdef TITAN_RUNTIME_2 /** Module parameter reference (and enumerated value) * Stores a reference to another module parameter, that can be retrieved with the * method get_referenced_param(). @@ -336,6 +339,7 @@ class Module_Param_Unbound : public Module_Param { const char* get_type_str() const { return "<unbound>"; } void log_value() const; }; +#endif /** Module parameter expression * Contains an unprocessed module parameter expression with one or two operands. diff --git a/core/Template.cc b/core/Template.cc index 1893c2996606c55b52b7723bd1811b016e6e1720..181bf368149af1340b2a70371e561f33a8cc6ee5 100644 --- a/core/Template.cc +++ b/core/Template.cc @@ -186,11 +186,13 @@ void Base_Template::set_param(Module_Param& /*param*/) TTCN_error("Internal error: Base_Template::set_param()"); } +#ifdef TITAN_RUNTIME_2 Module_Param* Base_Template::get_param(Module_Param_Name& /* param_name */) const { TTCN_error("Internal error: Base_Template::get_param()"); return NULL; } +#endif Restricted_Length_Template::Restricted_Length_Template() { diff --git a/core/Template.hh b/core/Template.hh index 5da9d531c30b6467340b93dad1c0a1db75b22f80..997300782ec2667782de1fdf5d7d9444ae124978 100644 --- a/core/Template.hh +++ b/core/Template.hh @@ -115,10 +115,13 @@ public: * templates, as the list of templates might contain a reference to this object. * @param param module parameter value (its ID specifies which object is to be set) */ VIRTUAL_IF_RUNTIME_2 void set_param(Module_Param& param); + +#ifdef TITAN_RUNTIME_2 /** Create a module parameter value equivalent to this object (or one of its * fields/elements) * @param param_name module parameter ID, specifies which object to convert */ - VIRTUAL_IF_RUNTIME_2 Module_Param* get_param(Module_Param_Name& param_name) const; + virtual Module_Param* get_param(Module_Param_Name& param_name) const; +#endif /** not a component by default (component templates will return true) */ inline boolean is_component() { return FALSE; } diff --git a/core/Universal_charstring.cc b/core/Universal_charstring.cc index 8f25162a8755bc9d63cf23d38a312c5d55efd57a..a826ff1d4c97f190721e2dd3003ade5c1205c48d 100644 --- a/core/Universal_charstring.cc +++ b/core/Universal_charstring.cc @@ -967,9 +967,11 @@ boolean UNIVERSAL_CHARSTRING::set_param_internal(Module_Param& param, boolean al boolean is_pattern = FALSE; param.basic_check(Module_Param::BC_VALUE|Module_Param::BC_LIST, "universal charstring value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Charstring: { switch (param.get_operation_type()) { @@ -1042,6 +1044,7 @@ void UNIVERSAL_CHARSTRING::set_param(Module_Param& param) { set_param_internal(param, FALSE); } +#ifdef TITAN_RUNTIME_2 Module_Param* UNIVERSAL_CHARSTRING::get_param(Module_Param_Name& param_name) const { if (!is_bound()) { @@ -1054,6 +1057,7 @@ Module_Param* UNIVERSAL_CHARSTRING::get_param(Module_Param_Name& param_name) con memcpy(val_cpy, val_ptr->uchars_ptr, val_ptr->n_uchars * sizeof(universal_char)); return new Module_Param_Universal_Charstring(val_ptr->n_uchars, val_cpy); } +#endif void UNIVERSAL_CHARSTRING::encode_text(Text_Buf& text_buf) const { @@ -4362,9 +4366,11 @@ void UNIVERSAL_CHARSTRING_template::log_match void UNIVERSAL_CHARSTRING_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE|Module_Param::BC_LIST, "universal charstring template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -4450,6 +4456,7 @@ void UNIVERSAL_CHARSTRING_template::set_param(Module_Param& param) { } } +#ifdef TITAN_RUNTIME_2 Module_Param* UNIVERSAL_CHARSTRING_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -4499,6 +4506,7 @@ Module_Param* UNIVERSAL_CHARSTRING_template::get_param(Module_Param_Name& param_ mp->set_length_restriction(get_length_range()); return mp; } +#endif void UNIVERSAL_CHARSTRING_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Universal_charstring.hh b/core/Universal_charstring.hh index fc1d56882f55a172183295a011c2617ef15c1a25..f2f65ce034329c471fa727f5ded5d5a7c21317dc 100644 --- a/core/Universal_charstring.hh +++ b/core/Universal_charstring.hh @@ -317,6 +317,7 @@ public: void set_value(const Base_Type* other_value) { *this = *(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)); } Base_Type* clone() const { return new UNIVERSAL_CHARSTRING(*this); } const TTCN_Typedescriptor_t* get_descriptor() const { return &UNIVERSAL_CHARSTRING_descr_; } + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif @@ -328,7 +329,6 @@ public: * @note UFT-8 strings (whose characters were not in quadruple notation) will * be decoded */ void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -624,7 +624,6 @@ public: void log_match(const UNIVERSAL_CHARSTRING& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -633,6 +632,7 @@ public: boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const { *(static_cast<UNIVERSAL_CHARSTRING*>(value)) = valueof(); } void set_value(template_sel other_value) { *this = other_value; } void copy_value(const Base_Type* other_value) { *this = *(static_cast<const UNIVERSAL_CHARSTRING*>(other_value)); } diff --git a/core/Verdicttype.cc b/core/Verdicttype.cc index dbf980d7ca07267becb8c9f77768459b9046f7ce..82a47649865a32e3cddde01c71e440f900b58a4f 100644 --- a/core/Verdicttype.cc +++ b/core/Verdicttype.cc @@ -111,15 +111,18 @@ void VERDICTTYPE::log() const void VERDICTTYPE::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_VALUE, "verdict value"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif if (mp->get_type()!=Module_Param::MP_Verdict) param.type_error("verdict value"); const verdicttype verdict = mp->get_verdict(); if (!IS_VALID(verdict)) param.error("Internal error: invalid verdict value (%d).", verdict); verdict_value = verdict; } +#ifdef TITAN_RUNTIME_2 Module_Param* VERDICTTYPE::get_param(Module_Param_Name& /* param_name */) const { if (!is_bound()) { @@ -127,6 +130,7 @@ Module_Param* VERDICTTYPE::get_param(Module_Param_Name& /* param_name */) const } return new Module_Param_Verdict(verdict_value); } +#endif void VERDICTTYPE::encode_text(Text_Buf& text_buf) const { @@ -682,9 +686,11 @@ void VERDICTTYPE_template::log_match(const VERDICTTYPE& match_value, void VERDICTTYPE_template::set_param(Module_Param& param) { param.basic_check(Module_Param::BC_TEMPLATE, "verdict template"); Module_Param_Ptr mp = ¶m; +#ifdef TITAN_RUNTIME_2 if (param.get_type() == Module_Param::MP_Reference) { mp = param.get_referenced_param(); } +#endif switch (mp->get_type()) { case Module_Param::MP_Omit: *this = OMIT_VALUE; @@ -714,6 +720,7 @@ void VERDICTTYPE_template::set_param(Module_Param& param) { is_ifpresent = param.get_ifpresent() || mp->get_ifpresent(); } +#ifdef TITAN_RUNTIME_2 Module_Param* VERDICTTYPE_template::get_param(Module_Param_Name& param_name) const { Module_Param* mp = NULL; @@ -753,6 +760,7 @@ Module_Param* VERDICTTYPE_template::get_param(Module_Param_Name& param_name) con } return mp; } +#endif void VERDICTTYPE_template::encode_text(Text_Buf& text_buf) const { diff --git a/core/Verdicttype.hh b/core/Verdicttype.hh index 0970bfb8efdd5d504df89e64d2b799a3a7cfdd48..c979618c13da85085d9a142d40b97bb870c8976b 100644 --- a/core/Verdicttype.hh +++ b/core/Verdicttype.hh @@ -77,6 +77,7 @@ public: void set_value(const Base_Type* other_value) {*this = *(static_cast<const VERDICTTYPE*>(other_value));} Base_Type* clone() const {return new VERDICTTYPE(*this);} const TTCN_Typedescriptor_t* get_descriptor() const {return &VERDICTTYPE_descr_;} + Module_Param* get_param(Module_Param_Name& param_name) const; #else inline boolean is_present() const { return is_bound(); } #endif @@ -84,7 +85,6 @@ public: void log() const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -168,7 +168,6 @@ public: void log_match(const VERDICTTYPE& match_value, boolean legacy = FALSE) const; void set_param(Module_Param& param); - Module_Param* get_param(Module_Param_Name& param_name) const; void encode_text(Text_Buf& text_buf) const; void decode_text(Text_Buf& text_buf); @@ -176,6 +175,7 @@ public: boolean is_present(boolean legacy = FALSE) const; boolean match_omit(boolean legacy = FALSE) const; #ifdef TITAN_RUNTIME_2 + Module_Param* get_param(Module_Param_Name& param_name) const; void valueofv(Base_Type* value) const {*(static_cast<VERDICTTYPE*>(value)) = valueof();} void set_value(template_sel other_value) {*this = other_value;} void copy_value(const Base_Type* other_value) {*this = *(static_cast<const VERDICTTYPE*>(other_value));} diff --git a/core/config_process.y b/core/config_process.y index d08b1a45f7d3dec5fc6abee921b79bd27ff5d2db..e3b35c1d1af96f02a9ae79f74323036b8f7c26bb 100644 --- a/core/config_process.y +++ b/core/config_process.y @@ -572,7 +572,18 @@ ParameterReference: // these will be sorted out later during set_param() ParameterNameSegment { +#ifdef TITAN_RUNTIME_2 $$ = new Module_Param_Reference(new Module_Param_Name(*$1)); +#else + // no references allowed in RT1, so the name segment must be an enumerated value + // (which means it can only contain 1 name) + if ($1->size() != 1) { + config_process_error("Module parameter references are not allowed in the " + "Load Test Runtime."); + } + $$ = new Module_Param_Enumerated($1->front()); +#endif + delete $1; } ; diff --git a/regression_test/XML/UseNilLong/UseNilLong.ttcn b/regression_test/XML/UseNilLong/UseNilLong.ttcn index 2fb8be3aca70a93475ea289377a4622676d26236..549bf14820c7e888f044f27d8d657a16a6bdbd96 100644 --- a/regression_test/XML/UseNilLong/UseNilLong.ttcn +++ b/regression_test/XML/UseNilLong/UseNilLong.ttcn @@ -223,8 +223,8 @@ testcase tc_encode_decode() runs on CT { testcase tc_decode() runs on CT { const charstring result := -"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'"& -"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/'"& +"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' "& +"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/' "& "xmlns:mc='http://schemas.ericsson.com/mtas/mmtel/cai3g'>"& "<S:Body>"& "<ns2:GetResponse>"& @@ -253,10 +253,11 @@ testcase tc_decode() runs on CT { "</ns2:GetResponse>"& "</S:Body>"& "</S:Envelope>"; +log(result); const charstring result_omit_attr := -"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'"& -"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/'"& +"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' "& +"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/' "& "xmlns:mc='http://schemas.ericsson.com/mtas/mmtel/cai3g'>"& "<S:Body>"& "<ns2:GetResponse>"& @@ -287,8 +288,8 @@ const charstring result_omit_attr := "</S:Envelope>"; const charstring result_omit_attr2 := -"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'"& -"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/'"& +"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' "& +"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/' "& "xmlns:mc='http://schemas.ericsson.com/mtas/mmtel/cai3g'>"& "<S:Body>"& "<ns2:GetResponse>"& @@ -318,8 +319,8 @@ const charstring result_omit_attr2 := "</S:Envelope>"; const charstring result_single := -"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'"& -"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/'"& +"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' "& +"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/' "& "xmlns:mc='http://schemas.ericsson.com/mtas/mmtel/cai3g'>"& "<S:Body>"& "<ns2:GetResponse>"& @@ -344,8 +345,8 @@ const charstring result_single := "</S:Envelope>"; const charstring result_single_omit_attr := -"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/'"& -"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/'"& +"<S:Envelope xmlns:S='http://schemas.xmlsoap.org/soap/envelope/' "& +"xmlns:ns2='http://schemas.ericsson.com/cai3g1.2/' "& "xmlns:mc='http://schemas.ericsson.com/mtas/mmtel/cai3g'>"& "<S:Body>"& "<ns2:GetResponse>"& diff --git a/regression_test/XML/XER/Txerfloat.ttcnpp b/regression_test/XML/XER/Txerfloat.ttcnpp index 048caaa22582f09e2bb2ace6e44183a1b6f39f0d..e705e89d2fb2383c8fac038699ce2a74a8d264fa 100644 --- a/regression_test/XML/XER/Txerfloat.ttcnpp +++ b/regression_test/XML/XER/Txerfloat.ttcnpp @@ -8,6 +8,7 @@ * Contributors: * Balasko, Jeno * Raduly, Csaba + * Szabo, Bence Janos * ******************************************************************************/ module Txerfloat { @@ -28,6 +29,8 @@ DECLARE_XER_ENCODERS(rfloat, rfloat); DECLARE_EXER_ENCODERS(rfloat,rfloat) DECLARE_XER_ENCODERS(ufloat, ufloat); DECLARE_EXER_ENCODERS(ufloat,ufloat) +DECLARE_XER_ENCODERS(attrfloat, attrfloat); +DECLARE_EXER_ENCODERS(attrfloat, attrfloat) type record rfloat { float f optional @@ -37,6 +40,13 @@ type union ufloat { float f } +type record attrfloat { + float f optional +} +with { + variant (f) "attribute" +} + testcase encode_float() runs on TFLOAT { var float plain := 3.141592; @@ -62,6 +72,24 @@ testcase encode_float() runs on TFLOAT CHECK_METHOD(cxer_enc_float, plain, expected); CHECK_METHOD(bxer_enc_float, plain, expected & lf); CHECK_METHOD(exer_enc_float, plain, expected & lf); + + plain := infinity; + expected := "<REAL>INF</REAL>"; + CHECK_METHOD(cxer_enc_float, plain, expected); + CHECK_METHOD(bxer_enc_float, plain, expected & lf); + CHECK_METHOD(exer_enc_float, plain, expected & lf); + + plain := -infinity; + expected := "<REAL>-INF</REAL>"; + CHECK_METHOD(cxer_enc_float, plain, expected); + CHECK_METHOD(bxer_enc_float, plain, expected & lf); + CHECK_METHOD(exer_enc_float, plain, expected & lf); + + plain := not_a_number; + expected := "<REAL>NaN</REAL>"; + CHECK_METHOD(cxer_enc_float, plain, expected); + CHECK_METHOD(bxer_enc_float, plain, expected & lf); + CHECK_METHOD(exer_enc_float, plain, expected & lf); } testcase decode_float() runs on TFLOAT @@ -72,10 +100,25 @@ testcase decode_float() runs on TFLOAT CHECK_DECODE(bxer_dec_float, pie, float, expected); // causes rounding errors : -2.718281828459045 - const charstring ee := "<REAL>-2.7182818284590</REAL>"; + var charstring ee := "<REAL>-2.7182818284590</REAL>"; expected := -2.7182818284590; CHECK_DECODE(cxer_dec_float, ee, float, expected); CHECK_DECODE(bxer_dec_float, ee, float, expected); + + ee := "<REAL>INF</REAL>"; + expected := infinity; + CHECK_DECODE(cxer_dec_float, ee, float, expected); + CHECK_DECODE(bxer_dec_float, ee, float, expected); + + ee := "<REAL>-INF</REAL>"; + expected := -infinity; + CHECK_DECODE(cxer_dec_float, ee, float, expected); + CHECK_DECODE(bxer_dec_float, ee, float, expected); + + ee := "<REAL>NaN</REAL>"; + expected := not_a_number; + CHECK_DECODE(cxer_dec_float, ee, float, expected); + CHECK_DECODE(bxer_dec_float, ee, float, expected); } testcase encode_float_omit() runs on TFLOAT @@ -136,6 +179,37 @@ testcase decode_float_choice() runs on TFLOAT CHECK_DECODE(bxer_dec_ufloat, electron, ufloat, expected); } +testcase encode_float_attribute() runs on TFLOAT +{ + var attrfloat plain := { f := infinity }; + var universal charstring expected := "<attrfloat f='INF'/>\n"; + CHECK_METHOD(exer_enc_attrfloat, plain, expected & lf); + + plain := { f := -infinity } + expected := "<attrfloat f='-INF'/>\n"; + CHECK_METHOD(exer_enc_attrfloat, plain, expected & lf); + + plain := { f := not_a_number } + expected := "<attrfloat f='NaN'/>\n"; + CHECK_METHOD(exer_enc_attrfloat, plain, expected & lf); +} + +testcase decode_float_attribute() runs on TFLOAT +{ + var attrfloat expected := { f := infinity }; + var universal charstring plain := "<attrfloat f='INF'/>\n"; + CHECK_DECODE(exer_dec_attrfloat, plain, attrfloat, expected); + + expected := { f := -infinity } + plain := "<attrfloat f='-INF'/>\n"; + CHECK_DECODE(exer_dec_attrfloat, plain, attrfloat, expected); + + expected := { f := not_a_number } + plain := "<attrfloat f='NaN'/>\n"; + CHECK_DECODE(exer_dec_attrfloat, plain, attrfloat, expected); +} + + control { execute(encode_float()); @@ -144,6 +218,8 @@ control { execute(decode_float_omit()) execute(encode_float_choice()); execute(decode_float_choice()); + execute(encode_float_attribute()); + execute(decode_float_attribute()); } } diff --git a/regression_test/XML/XmlWorkflow/src/xmlTest.prj b/regression_test/XML/XmlWorkflow/src/xmlTest.prj index df3e15608e4dc6aa8795339064de45c065ef1143..5b19850d3a097c34b464aa35931a21939f69de5f 100644 --- a/regression_test/XML/XmlWorkflow/src/xmlTest.prj +++ b/regression_test/XML/XmlWorkflow/src/xmlTest.prj @@ -165,9 +165,9 @@ <File path="../xsd/list_complextype.xsd" /> <File path="../xsd/enumeration_restriction3.xsd" /> <File path="../xsd/MyXMLSchema.xsd" /> - <File path="../xsd/www_example_org_pref1.xsd" /> - <File path="../xsd/www_example_org_pref2.xsd" /> - <File path="../xsd/www_example_org_pref3.xsd" /> + <File path="../xsd/www_example_org_pref1.xsd" /> + <File path="../xsd/www_example_org_pref2.xsd" /> + <File path="../xsd/www_example_org_pref3.xsd" /> </File_Group> <File_Group name="XmlTest_xsds" > <File path="../XmlTest_xsds/XmlTest_boolean.xsd" /> @@ -403,9 +403,9 @@ <File path="../XmlTest_expectedTtcns/www_example_org_list_complextype_e.ttcn" /> <File path="../XmlTest_expectedTtcns/www_example_org_enumeration_restriction3_e.ttcn" /> <File path="../XmlTest_expectedTtcns/http_www_example_org_2001_XMLSchema_e.ttcn" /> - <File path="../XmlTest_expectedTtcns/www_example_org_pref1_e.ttcn" /> - <File path="../XmlTest_expectedTtcns/www_example_org_pref2_e.ttcn" /> - <File path="../XmlTest_expectedTtcns/www_example_org_pref3_e.ttcn" /> + <File path="../XmlTest_expectedTtcns/www_example_org_pref1_e.ttcn" /> + <File path="../XmlTest_expectedTtcns/www_example_org_pref2_e.ttcn" /> + <File path="../XmlTest_expectedTtcns/www_example_org_pref3_e.ttcn" /> </File_Group> <File_Group name="XmlTest_src" > <File path="xmlTest_Shell.ttcn" /> diff --git a/regression_test/cfgFile/define/macro_reference/Makefile b/regression_test/cfgFile/define/macro_reference/Makefile index 5513772cceebbf3be87ee828b96c91d69ead2c89..b4505dd4cee7022db1d45ca65abc71a0570246a4 100644 --- a/regression_test/cfgFile/define/macro_reference/Makefile +++ b/regression_test/cfgFile/define/macro_reference/Makefile @@ -49,12 +49,12 @@ all: $(GENERATED_DIRS) $(DIR_SINGLE): mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) -s ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) -s ./* && $(MAKE_PROG) $(DIR_PARALLEL): mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) ./* && $(MAKE_PROG) run: $(GENERATED_DIRS) cd $(DIR_SINGLE) && ./$(RUNNABLE) $(CFG) diff --git a/regression_test/cfgFile/define/structured/Makefile b/regression_test/cfgFile/define/structured/Makefile index 30617920baa52385a6304cddabb7e45ae6b946fa..50ff61b6eb3f68346aaacb839c213b5b71ced8c8 100644 --- a/regression_test/cfgFile/define/structured/Makefile +++ b/regression_test/cfgFile/define/structured/Makefile @@ -49,12 +49,12 @@ all: $(GENERATED_DIRS) $(DIR_SINGLE): mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) -s ./* && $(MAKE_PROG) 'CXXFLAGS=$(CXXFLAGS)' 'LDFLAGS=$(LDFLAGS)' + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) -s ./* && $(MAKE_PROG) 'CXXFLAGS=$(CXXFLAGS)' 'LDFLAGS=$(LDFLAGS)' $(DIR_PARALLEL): mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) ./* && $(MAKE_PROG) 'CXXFLAGS=$(CXXFLAGS)' 'LDFLAGS=$(LDFLAGS)' + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) ./* && $(MAKE_PROG) 'CXXFLAGS=$(CXXFLAGS)' 'LDFLAGS=$(LDFLAGS)' run: $(GENERATED_DIRS) cd $(DIR_SINGLE) && ./$(RUNNABLE) $(CFG) diff --git a/regression_test/cfgFile/module_parameters/Makefile b/regression_test/cfgFile/module_parameters/Makefile index 2704c6019cef5000c6652464ab1adbc3d25694d9..88fedbb4f6db17f4a04eb918e0a740d73cf78beb 100644 --- a/regression_test/cfgFile/module_parameters/Makefile +++ b/regression_test/cfgFile/module_parameters/Makefile @@ -16,7 +16,10 @@ include $(TOPDIR)/Makefile.regression unexport ABS_SRC unexport SRCDIR -DIRS := assignment concat references +DIRS := assignment concat +ifdef RT2 +DIRS += references +endif # List of fake targets: .PHONY: all dep clean run $(DIRS) $(addsuffix /, $(DIRS)) profile diff --git a/regression_test/cfgFile/module_parameters/assignment/Makefile b/regression_test/cfgFile/module_parameters/assignment/Makefile index 8a88a731c377b93e3ed6584e7ae89cb74e05bccf..70456c85e510b7fef3114550498d30763991330a 100644 --- a/regression_test/cfgFile/module_parameters/assignment/Makefile +++ b/regression_test/cfgFile/module_parameters/assignment/Makefile @@ -46,12 +46,12 @@ all: $(GENERATED_DIRS) dir_single_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) -s ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) -s ./* && $(MAKE_PROG) dir_parallel_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) ./* && $(MAKE_PROG) run: $(GENERATED_DIRS) cd $(DIR_SINGLE) && ./$(RUNNABLE) $(CFG) diff --git a/regression_test/cfgFile/module_parameters/concat/Makefile b/regression_test/cfgFile/module_parameters/concat/Makefile index 73665316a15f410e53333fb23ae9192a9c757cc2..fa1af8a0919e9a4bc8d9d7417ff9fe0385c18604 100644 --- a/regression_test/cfgFile/module_parameters/concat/Makefile +++ b/regression_test/cfgFile/module_parameters/concat/Makefile @@ -46,12 +46,12 @@ all: $(GENERATED_DIRS) dir_single_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) -s ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) -s ./* && $(MAKE_PROG) dir_parallel_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) ./* && $(MAKE_PROG) run: $(GENERATED_DIRS) cd $(DIR_SINGLE) && ./$(RUNNABLE) $(CFG) diff --git a/regression_test/cfgFile/module_parameters/references/Makefile b/regression_test/cfgFile/module_parameters/references/Makefile index 6337ff948c052fb339e59f7b5969a46260c3f55e..4117ec72e5bb9c4b7b0bc783351fd4d8407b8e90 100644 --- a/regression_test/cfgFile/module_parameters/references/Makefile +++ b/regression_test/cfgFile/module_parameters/references/Makefile @@ -44,12 +44,12 @@ all: $(GENERATED_DIRS) dir_single_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) -s ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) -s ./* && $(MAKE_PROG) dir_parallel_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) ./* && $(MAKE_PROG) run: $(GENERATED_DIRS) cd $(DIR_SINGLE) && ./$(RUNNABLE) $(CFG) diff --git a/regression_test/cfgFile/ordered_include/Makefile b/regression_test/cfgFile/ordered_include/Makefile index dfde53440c3557a89c5ac157fbee1ee2c1ee0eb9..2f2f99d184b92f94df6d3516f2fd86614eb7abb3 100644 --- a/regression_test/cfgFile/ordered_include/Makefile +++ b/regression_test/cfgFile/ordered_include/Makefile @@ -47,12 +47,12 @@ all: $(GENERATED_DIRS) dir_single_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) -s ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) -s ./* && $(MAKE_PROG) dir_parallel_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) ./* && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) ./* && $(MAKE_PROG) run: clean run_single run_parallel diff --git a/regression_test/cfgFile/testport_parameters/Makefile b/regression_test/cfgFile/testport_parameters/Makefile index 4c0d3bd8de9a2092f5ec9defe0cc95146026ab85..7d3f0ff5b6d4f8a9a5307790ede1af358b0130eb 100644 --- a/regression_test/cfgFile/testport_parameters/Makefile +++ b/regression_test/cfgFile/testport_parameters/Makefile @@ -47,12 +47,12 @@ all: $(GENERATED_DIRS) dir_single_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) -s $(TTCN_MODULE) $(PORT) && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) -s $(TTCN_MODULE) $(PORT) && $(MAKE_PROG) dir_parallel_mode: mkdir $@ cd $@ && for file in $(FILES); do ln -s ../$$file || exit; done - cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(TTCN_MODULE) $(PORT) && $(MAKE_PROG) + cd $@ && $(TTCN3_DIR)/bin/ttcn3_makefilegen $(COVERAGE_FLAG) $(SPLIT_FLAG) $(RT2_FLAG) $(TTCN_MODULE) $(PORT) && $(MAKE_PROG) run: $(GENERATED_DIRS) cd $(DIR_SINGLE) && ./$(RUNNABLE) $(CFG) diff --git a/regression_test/compileonly/asn1_hyphen/Makefile b/regression_test/compileonly/asn1_hyphen/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..61da58947b3429fff03caf827a23c2f5e78e22a1 --- /dev/null +++ b/regression_test/compileonly/asn1_hyphen/Makefile @@ -0,0 +1,37 @@ +############################################################################## +# Copyright (c) 2000-2016 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 +# +# Contributors: +# Szabo, Bence Janos +# +############################################################################## +TOPDIR := ../.. +include $(TOPDIR)/Makefile.regression + +ifdef LCOV +COVERAGE_FLAG := -C +endif + +MFGEN := $(TTCN3_DIR)/bin/ttcn3_makefilegen +MFGEN_FLAGS := -sf $(RT2_FLAG) $(SPLIT_FLAG) + +FOLDER := folder-with-hyphen +FILES := $(FOLDER)/ASN1Module1.asn + + +# ${MAKEPROG} has the same content as the built-in ${MAKE}, +# except the special handling of ${MAKE} does not apply. +# If we used ${MAKE} in the rules below, 'make -n' would succeed once, +# then fail on every subsequent invocation until a 'make clean' is done. +MAKEPROG := ${MAKE} + +all: + $(MFGEN) $(MFGEN_FLAGS) -o GenMakefile $(FILES) && rm GenMakefile + + +.PHONY: all clean distclean run + diff --git a/regression_test/compileonly/asn1_hyphen/folder-with-hyphen/ASN1Module1.asn b/regression_test/compileonly/asn1_hyphen/folder-with-hyphen/ASN1Module1.asn new file mode 100644 index 0000000000000000000000000000000000000000..dac6b4c59846892d38fa37db378987851b4fe202 --- /dev/null +++ b/regression_test/compileonly/asn1_hyphen/folder-with-hyphen/ASN1Module1.asn @@ -0,0 +1,25 @@ +--///////////////////////////////////////////////////////////////////////////// +-- Copyright (c) 2000-2016 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 +-- +-- Contributors: +-- Szabo, Bence Janos +-- +--///////////////////////////////////////////////////////////////////////////// +ASN1Module1 +DEFINITIONS + +AUTOMATIC TAGS + +::= + +BEGIN + +IMPORTS ; -- nothing + +asn1module1 INTEGER ::= 1 + +END \ No newline at end of file diff --git a/xsdconvert/PredefinedModules.cc b/xsdconvert/PredefinedModules.cc index 649fb4c0511634513505fe447866a09b4d4229b3..09726cc69896d01dfa0ffca29b004076a236c59d 100644 --- a/xsdconvert/PredefinedModules.cc +++ b/xsdconvert/PredefinedModules.cc @@ -34,9 +34,9 @@ const char * moduleUsefulTtcn3Types = { " type integer unsignedlong (0 .. 4294967295) with { variant \"/*unsigned 32 bit*/\" };\n\n" - " type integer longlong /* ( -9223372036854775808 .. 9223372036854775807 ) */ with { variant \"/*64 bit*/\" };\n\n" + " type integer longlong ( -9223372036854775808 .. 9223372036854775807 ) with { variant \"/*64 bit*/\" };\n\n" - " type integer unsignedlonglong /* ( 0 .. 18446744073709551615 ) */ with { variant \"/*unsigned 64 bit*/\" };\n\n" + " type integer unsignedlonglong ( 0 .. 18446744073709551615 ) with { variant \"/*unsigned 64 bit*/\" };\n\n" " type float IEEE754float with { variant \"/*IEEE754 float*/\" };\n\n"