diff --git a/README.cygwin b/README.cygwin index 99ab5a1278ba497dd06959a93fcb72552ed1cb45..da2ae9c83c5ffb4146108966dd050bca117c1fe7 100644 --- a/README.cygwin +++ b/README.cygwin @@ -9,6 +9,11 @@ * Baranyi, Botond * Pilisi, Gergely ****************************************************************************** + +Please be aware that due to the incompatibility of EPL and GPL licenses, one may not link EPL and GPL code together +and distribute the result. ( see https://mmilinkov.wordpress.com/2010/04/06/epl-gpl-commentary/). However +from pure tehnical standpoint Titan can be compiled on GPL-licensed Cygwin as detailed below. + Cygwin setup - If Cygwin is installed already, refresh your Cygwin installation Titan is always build for the newest Cygwin version available. diff --git a/common/UnicharPattern.cc b/common/UnicharPattern.cc index 42fe288b60e1f92bfbdf01cb4823a239da6fbf65..6746207958cdb7b15a11a78f629db7c3c3a0fe09 100644 --- a/common/UnicharPattern.cc +++ b/common/UnicharPattern.cc @@ -82,23 +82,35 @@ UnicharPattern::UnicharPattern() : mappings_head(NULL) { // if anything goes wrong while parsing the case mappings file, just delete the // partial results, display a warning, and treat all patterns as case-sensitive + FILE* fp = NULL; const char* ttcn3_dir = getenv("TTCN3_DIR"); - if (ttcn3_dir == NULL) { - TTCN_pattern_warning("Environment variable TTCN3_DIR not present. " - "Case-insensitive universal charstring patterns are disabled.\n"); - return; + char* mappings_file = NULL; + if (ttcn3_dir != NULL) { + size_t ttcn3_dir_len = strlen(ttcn3_dir); + bool ends_with_slash = ttcn3_dir_len > 0 && ttcn3_dir[ttcn3_dir_len - 1] == '/'; + mappings_file = mprintf("%s%setc/CaseFolding.txt", ttcn3_dir, + ends_with_slash ? "" : "/"); + fp = fopen(mappings_file, "r"); + if (fp == NULL) { + // during the TITAN build the case mappings file has not been moved to the + // installation directory yet; try its original location + fp = fopen("../etc/CaseFolding.txt", "r"); + } } - size_t ttcn3_dir_len = strlen(ttcn3_dir); - bool ends_with_slash = ttcn3_dir_len > 0 && ttcn3_dir[ttcn3_dir_len - 1] == '/'; - char* mappings_file = mprintf("%s%setc/CaseFolding.txt", ttcn3_dir, - ends_with_slash ? "" : "/"); - FILE* fp = fopen(mappings_file, "r"); if (fp == NULL) { - TTCN_pattern_warning("Cannot open file '%s' for reading. " - "Case-insensitive universal charstring patterns are disabled.\n", mappings_file); + if (ttcn3_dir == NULL) { + TTCN_pattern_warning("Environment variable TTCN3_DIR not present. " + "Case-insensitive universal charstring patterns are disabled.\n"); + } + else { + TTCN_pattern_warning("Cannot open file '%s' for reading. " + "Case-insensitive universal charstring patterns are disabled.\n", + mappings_file); + } Free(mappings_file); return; } + Free(mappings_file); // this always points to the last element of the list diff --git a/common/ttcn3float.hh b/common/ttcn3float.hh index fc46b5594d298cdff4fc4b9ed5cb08fe6b70b8ef..ba67e29324bb53a4413c1fd1bbfd292a0ff2481c 100644 --- a/common/ttcn3float.hh +++ b/common/ttcn3float.hh @@ -14,8 +14,6 @@ #ifndef TTCN3FLOAT_HH_ #define TTCN3FLOAT_HH_ -// TODO: once we can use C++11 as the base platform replace with cmath -// this way the signedbit will become a defined function instead of a macro #include <math.h> /* TTCN-3 float values that have absolute value smaller than this @@ -26,9 +24,9 @@ #define MAX_DECIMAL_FLOAT 1.0E+10 #ifndef signbit -// Probably Solaris. -// Thankfully, IEEE Std 1003.1, 2004 Edition says that signbit is a macro, -// hence it's safe to use ifdef. + Probably Solaris. + Thankfully, IEEE Std 1003.1, 2004 Edition says that signbit is a macro, + hence it's safe to use ifdef. #ifdef __sparc // Big endian @@ -39,7 +37,7 @@ inline int signbitfunc(double d) } #else -// Probably Intel, assume little endian + Probably Intel, assume little endian inline int signbitfunc(double d) { return ((unsigned char*)&d)[sizeof(double)-1] & 0x80; diff --git a/compiler2/Int.cc b/compiler2/Int.cc index 7809967114a5d7768905d41466ed1c3fc1640fc7..a2fed372be9db2c24859175fc111284fd5ed2866 100644 --- a/compiler2/Int.cc +++ b/compiler2/Int.cc @@ -27,7 +27,6 @@ #include <stdlib.h> #include <stdio.h> #include <errno.h> -#include <math.h> // We cannot check without using a "./configure" script or such if we have // llabs() or not. Define our own function instead. diff --git a/compiler2/Real.cc b/compiler2/Real.cc index c9f5a8179783037f979b0a426e4085f1a5b19b4c..54b16ea469bf3cff306f76d17c344fc4fc68508a 100644 --- a/compiler2/Real.cc +++ b/compiler2/Real.cc @@ -25,6 +25,7 @@ #include <stdlib.h> #include <errno.h> #include <string.h> +#include <cmath> namespace Common { diff --git a/compiler2/Real.hh b/compiler2/Real.hh index 1d6ebcf35df7634ade3edc84ff2281d6bdce42e0..46f9655ee7e3bf58d096ecc7270724ba25dd2ef1 100644 --- a/compiler2/Real.hh +++ b/compiler2/Real.hh @@ -18,7 +18,6 @@ #define _Common_Real_HH #include "string.hh" -#include <math.h> // older versions of gcc do not have numeric_limits<double> or it is wrong // and they do not have constants defined by C99 standard diff --git a/compiler2/Value.cc b/compiler2/Value.cc index f62a4180357a8d456d0aa67a787d590727342a85..ead10d58b41a332f0f689bf6303ba5967f375da4 100644 --- a/compiler2/Value.cc +++ b/compiler2/Value.cc @@ -56,7 +56,6 @@ #include "../common/JSON_Tokenizer.hh" #include "ttcn3/Ttcn2Json.hh" -#include <math.h> #include <regex.h> #include <limits.h> @@ -9111,7 +9110,7 @@ error: index = v_index->get_val_Int()->get_val(); index_available = true; } else if (!silent) { - array_index->error("An integer value was expected as index"); + array_index->error("An integer value or a fixed length array or record of integer value was expected as index"); } } if (valuetype == V_OMIT) { diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc index b891ef2266be69327e60b6c20026ee99fe2f8f72..2bc045e2b9e7907268fbeee62a07c9fb039a6cf9 100644 --- a/compiler2/ttcn3/AST_ttcn3.cc +++ b/compiler2/ttcn3/AST_ttcn3.cc @@ -4373,12 +4373,7 @@ namespace Ttcn { if (info_base.needs_conversion()) body->set_needs_conversion(); } - // Check for restriction. - if (Template::is_less_restrictive(base_template->get_template_restriction(), - template_restriction)) { - error("The template restriction is not the same or more " - "restrictive as of base template `%s'", ass->get_fullname().c_str()); - } + // Checking formal parameter lists. FormalParList *base_fpl = base_template->get_FormalParList(); size_t nof_base_fps = base_fpl ? base_fpl->get_nof_fps() : 0; @@ -7490,7 +7485,6 @@ namespace Ttcn { // assemble the function body first (this also determines which parameters // are never used) char* body = create_location_object(memptystr(), "ALTSTEP", dispname_str); - body = fp_list->generate_shadow_objects(body); if (debugger_active) { body = generate_code_debugger_function_init(body, this); } @@ -7505,13 +7499,19 @@ namespace Ttcn { mputprintf(target->header.function_prototypes, "extern alt_status %s_instance(%s);\n", genname_str, formal_par_list); + // generate shadow objects for parameters if needed + // (this needs be done after the body is generated, so it to knows which + // parameters are never used) + char* shadow_objects = fp_list->generate_shadow_objects(memptystr()); + // function for altstep instance: body target->source.function_bodies = mputprintf(target->source.function_bodies, "alt_status %s_instance(%s)\n" "{\n" - "%s" - "}\n\n", genname_str, formal_par_list, body); + "%s%s" + "}\n\n", genname_str, formal_par_list, shadow_objects, body); Free(formal_par_list); + Free(shadow_objects); Free(body); char *actual_par_list = @@ -8069,6 +8069,23 @@ namespace Ttcn { if (!semantic_check_only) defval.ap->set_code_section(GovernedSimple::CS_POST_INIT); } + + if (use_runtime_2 && my_parlist->get_my_def() != NULL && + my_parlist->get_my_def()->get_asstype() == Definition::A_ALTSTEP) { + // altstep 'in' parameters are always shadowed in RT2, because if a default + // altstep deactivates itself, then its parameters are deleted; + // update the genname so that all references in the generated code + // will point to the shadow object + switch (asstype) { + case A_PAR_VAL: + case A_PAR_VAL_IN: + case A_PAR_TEMPL_IN: + set_genname(id->get_name() + "_shadow"); + break; + default: + break; + } + } } bool FormalPar::has_defval() const @@ -8834,7 +8851,9 @@ namespace Ttcn { char *FormalPar::generate_shadow_object(char *str) const { - if (used_as_lvalue && !lazy_eval) { + if ((used_as_lvalue || (use_runtime_2 && usage_found && + my_parlist->get_my_def()->get_asstype() == Definition::A_ALTSTEP)) + && !lazy_eval) { const string& t_genname = get_genname(); const char *genname_str = t_genname.c_str(); const char *name_str = id->get_name().c_str(); @@ -8848,7 +8867,7 @@ namespace Ttcn { type->get_genname_template(my_scope).c_str(), genname_str, name_str); break; default: - FATAL_ERROR("FormalPar::generate_shadow_object()"); + break; } } return str; @@ -10113,13 +10132,30 @@ namespace Ttcn { // add an extra copy constructor call to the referenced value and template // parameters if the referred definition is also passed by reference to // another parameter + bool all_in_params_shadowed = use_runtime_2 && p_fpl != NULL && + p_fpl->get_my_def()->get_asstype() == Common::Assignment::A_ALTSTEP; for (size_t i = 0; i < nof_pars; i++) { if (i > 0) expr->expr = mputstr(expr->expr, ", "); ActualPar *par = params[i]; bool copy_needed = false; // the copy constructor call is not needed if the parameter is copied // into a shadow object in the body of the called function - if (!p_fpl || !p_fpl->get_fp_byIndex(i)->get_used_as_lvalue()) { + bool shadowed = false; + if (p_fpl != NULL) { + switch (p_fpl->get_fp_byIndex(i)->get_asstype()) { + case Common::Assignment::A_PAR_VAL: + case Common::Assignment::A_PAR_VAL_IN: + case Common::Assignment::A_PAR_TEMPL_IN: + // all 'in' parameters are shadowed in altsteps in RT2, otherwise an + // 'in' parameter is shadowed if it is used as lvalue + shadowed = all_in_params_shadowed ? true : + p_fpl->get_fp_byIndex(i)->get_used_as_lvalue(); + break; + default: + break; + } + } + if (!shadowed) { switch (par->get_selection()) { case ActualPar::AP_VALUE: { Value *v = par->get_Value(); diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc index 966e797a8e4aabd3d820177abe502c25cdac6f24..049d468c72ae9a8d645c89b70fa4cae67c4f1d4e 100644 --- a/compiler2/ttcn3/Statement.cc +++ b/compiler2/ttcn3/Statement.cc @@ -3409,8 +3409,18 @@ error: void Statement::chk_deactivate() { + Error_Context cntxt(this, "In deactivate statement"); + if (!use_runtime_2 && + (my_sb->get_my_def()->get_asstype() == Common::Assignment::A_ALTSTEP || + my_sb->get_my_def()->get_asstype() == Common::Assignment::A_FUNCTION)) { + // The automatic shadowing of 'in' parameters in altsteps is not done in RT1 + // for performance reasons. Issue a warning about their possible deletion. + warning("Calling `deactivate()' in a function or altstep. This %s " + "delete the `in' parameters of %s currently running altstep%s.", + deactivate != NULL ? "might" : "will", + deactivate != NULL ? "a" : "all", deactivate != NULL ? "" : "s"); + } if (deactivate) { - Error_Context cntxt(this, "In deactivate statement"); deactivate->chk_expr_default(Type::EXPECTED_DYNAMIC_VALUE); } } diff --git a/conformance_test/core_language_tests/negative_tests/06_types_and_values.script b/conformance_test/core_language_tests/negative_tests/06_types_and_values.script index 0f342af54435f59154fba9cd2f69aa38b6940921..9802bc9ff755b97f6698f843dc5a082cb7f7bf38 100644 --- a/conformance_test/core_language_tests/negative_tests/06_types_and_values.script +++ b/conformance_test/core_language_tests/negative_tests/06_types_and_values.script @@ -3859,6 +3859,446 @@ Dynamic test case error: Performing a valueof or send operation on a non-specifi <END_TC> :exmp +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_016 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - array as a record-of value index on right hand side (less items than record-of dimension) > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_016 NegSem_060203_records_and_sets_of_single_types_016.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, array as a record-of value index on right hand side (less items than record-of dimension) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For nested record of or set of types, an array or record of integer restricted +// to a single size can be used as a short-hand notation for a nested index +// notation. + +module NegSem_060203_records_and_sets_of_single_types_016 { + + type component GeneralComp { + } + + type record of record of integer RoRoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_016() runs on GeneralComp { + + var RoRoI v_rec := {{0, 1}, {2, 3}}; + var integer v_index[3] := { 1, 0, 0 } + if (v_rec[v_index] == 2) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_016()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type `integer\[3\]' contains too many indexes \(3\) in the short-hand notation for nested indexes. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_017 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - array as a record-of value index on left hand side (less items than record-of dimension) > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_017 NegSem_060203_records_and_sets_of_single_types_017.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, array as a record-of value index on left hand side (less items than record-of dimension) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For nested record of or set of types, an array or record of integer restricted +// to a single size can be used as a short-hand notation for a nested index +// notation. + +module NegSem_060203_records_and_sets_of_single_types_017 { + + type component GeneralComp { + } + + type record of record of integer RoRoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_017() runs on GeneralComp { + + var RoRoI v_rec := {{0, 1}, {2, 3}}; + var integer v_index[3] := { 1, 0, 0 } + v_rec[v_index] := 10; + if (v_rec == {{0, 1}, {10, 3}}) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_017()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type `integer\[3\]' contains too many indexes \(3\) in the short-hand notation for nested indexes. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_018 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - fixed-size record-of as a record-of value index on right hand side (less items than record-of dimension) > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_018 NegSem_060203_records_and_sets_of_single_types_018.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, fixed-size record-of as a record-of value index on right hand side (less items than record-of dimension) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For nested record of or set of types, an array or record of integer restricted +// to a single size can be used as a short-hand notation for a nested index +// notation. + +module NegSem_060203_records_and_sets_of_single_types_018 { + + type component GeneralComp { + } + + type record length(3) of integer Indexer; + type record of record of integer RoRoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_018() runs on GeneralComp { + + var RoRoI v_rec := {{0, 1}, {2, 3}}; + var Indexer v_index := { 1, 0, 0 } + if (v_rec[v_index] == 2) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_018()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type `@NegSem_060203_records_and_sets_of_single_types_018.Indexer' contains too many indexes \(3\) in the short-hand notation for nested indexes. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_019 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - fixed-size record-of as a record-of value index on left hand side (less items than record-of dimension) > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_019 NegSem_060203_records_and_sets_of_single_types_019.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, fixed-size record-of as a record-of value index on left hand side (less items than record-of dimension) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For nested record of or set of types, an array or record of integer restricted +// to a single size can be used as a short-hand notation for a nested index +// notation. + +module NegSem_060203_records_and_sets_of_single_types_019 { + + type component GeneralComp { + } + + type record length(3) of integer Indexer; + type record of record of integer RoRoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_019() runs on GeneralComp { + + var RoRoI v_rec := {{0, 1}, {2, 3}}; + var Indexer v_index := { 1, 0, 0 } + v_rec[v_index] := 10; + if (v_rec == {{0, 1}, {10, 3}}) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_019()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type `@NegSem_060203_records_and_sets_of_single_types_019.Indexer' contains too many indexes \(3\) in the short-hand notation for nested indexes. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_020 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - fixed-size set-of as a record-of value index on right hand side > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_020 NegSem_060203_records_and_sets_of_single_types_020.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, fixed-size set-of as a record-of value index on right hand side + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For nested record of or set of types, an array or record of integer restricted +// to a single size can be used as a short-hand notation for a nested index +// notation. + +module NegSem_060203_records_and_sets_of_single_types_020 { + + type component GeneralComp { + } + + type set length(2) of integer Indexer; + type record of record of integer RoRoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_020() runs on GeneralComp { + + var RoRoI v_rec := {{0, 1}, {2, 3}}; + var Indexer v_index := { 1, 0 } + if (v_rec[v_index] == 2) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_020()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> +<RESULT COUNT 1> +error: The operands of operation `==' should be of compatible types +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - fixed-size set-of as a record-of value index on left hand side > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_021 NegSem_060203_records_and_sets_of_single_types_021.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, fixed-size set-of as a record-of value index on left hand side + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For nested record of or set of types, an array or record of integer restricted +// to a single size can be used as a short-hand notation for a nested index +// notation. + +module NegSem_060203_records_and_sets_of_single_types_021 { + + type component GeneralComp { + } + + type set length(2) of integer Indexer; + type record of record of integer RoRoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_021() runs on GeneralComp { + + var RoRoI v_rec := {{0, 1}, {2, 3}}; + var Indexer v_index := { 1, 0 } + v_rec[v_index] := 10; + if (v_rec == {{0, 1}, {10, 3}}) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_021()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: A value or expression of type integer was expected +<END_RESULT> +<RESULT COUNT 1> +error: record of value was expected +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_022 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - variable-size record-of as a record-of value index on right hand side > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_022 NegSem_060203_records_and_sets_of_single_types_022.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, variable-size record-of as a record-of value index on right hand side + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For nested record of or set of types, an array or record of integer restricted +// to a single size can be used as a short-hand notation for a nested index +// notation. + +module NegSem_060203_records_and_sets_of_single_types_022 { + + type component GeneralComp { + } + + type record of integer Indexer; + type record of record of integer RoRoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_022() runs on GeneralComp { + + var RoRoI v_rec := {{0, 1}, {2, 3}}; + var Indexer v_index := { 1, 0 } + if (v_rec[v_index] == 2) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_022()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type `@NegSem_060203_records_and_sets_of_single_types_022.Indexer' must have single size length restriction when used as a short-hand notation for nested indexes. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060203_records_and_sets_of_single_types_023 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - variable-size record-of as a record-of value index on left hand side (less items than record-of dimension) > + +<COMPILE> + +<MODULE TTCN NegSem_060203_records_and_sets_of_single_types_023 NegSem_060203_records_and_sets_of_single_types_023.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.3, variable-size record-of as a record-of value index on left hand side (less items than record-of dimension) + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// For nested record of or set of types, an array or record of integer restricted +// to a single size can be used as a short-hand notation for a nested index +// notation. + +module NegSem_060203_records_and_sets_of_single_types_023 { + + type component GeneralComp { + } + + type record of integer Indexer; + type record of record of integer RoRoI; + + testcase TC_NegSem_060203_records_and_sets_of_single_types_023() runs on GeneralComp { + + var RoRoI v_rec := {{0, 1}, {2, 3}}; + var Indexer v_index := { 1, 0 } + v_rec[v_index] := 10; + if (v_rec == {{0, 1}, {10, 3}}) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(TC_NegSem_060203_records_and_sets_of_single_types_023()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type `@NegSem_060203_records_and_sets_of_single_types_023.Indexer' must have single size length restriction when used as a short-hand notation for nested indexes. +<END_RESULT> + +<END_TC> +:exmp + *---------------------------------------------------------------------* :h3. NegSyn_060203_records_and_sets_of_single_types_001 negative test .*---------------------------------------------------------------------* @@ -5867,6 +6307,105 @@ error: A value or expression of type integer was expected <END_TC> :exmp +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_020 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - integer array with too many items as multidimensional array index > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_020 NegSem_060207_arrays_020.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, integer array with too many items as multidimensional array index + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// An array or record of integer restricted to a single size can be used in the +// index notation as a short-hand for the repeated index notation. + +module NegSem_060207_arrays_020 { + + type component GeneralComp { + } + + testcase TC_NegSem_060207_arrays_020() runs on GeneralComp { + var integer v_rhindexes[3] := { 0, 1, 0 }, v_lhindexes[3] := { 1, 2, 0 } + var integer v_arr[2][3] := { { 1, 2, 3 }, { 4, 5, 6 } }; + // testing both RH and LH side: + v_arr[v_lhindexes] := v_arr[v_rhindexes]; + if (v_arr == { { 1, 2, 3 }, { 4, 5, 2} }) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_060207_arrays_020()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type `integer\[3\]' contains too many indexes \(3\) in the short-hand notation for nested indexes. +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_060207_arrays_021 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - variable-size record of integer as multidimensional array index > + +<COMPILE> + +<MODULE TTCN NegSem_060207_arrays_021 NegSem_060207_arrays_021.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:6.2.7, variable-size record of integer as multidimensional array index + ** @verdict pass reject + ***************************************************/ + +// The following requirement is tested: +// An array or record of integer restricted to a single size can be used in the +// index notation as a short-hand for the repeated index notation. + +module NegSem_060207_arrays_021 { + + type component GeneralComp { + } + + type record length(1..2) of integer RI; + + testcase TC_NegSem_060207_arrays_021() runs on GeneralComp { + var RI v_rhindexes := { 0, 1 }, v_lhindexes := { 1, 2 } + var integer v_arr[2][3] := { { 1, 2, 3 }, { 4, 5, 6 } }; + // testing both RH and LH side: + v_arr[v_lhindexes] := v_arr[v_rhindexes]; + if (v_arr == { { 1, 2, 3 }, { 4, 5, 2} }) { setverdict(pass); } + else { setverdict(fail); } + } + + control { + execute(TC_NegSem_060207_arrays_021()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +error: The type `@NegSem_060207_arrays_021.RI' must have single size length restriction when used as a short-hand notation for nested indexes. +<END_RESULT> + +<END_TC> +:exmp + + *---------------------------------------------------------------------* :h3. NegSem_060207_arrays_022 negative test .*---------------------------------------------------------------------* diff --git a/conformance_test/core_language_tests/negative_tests/07-14_folder.script b/conformance_test/core_language_tests/negative_tests/07-14_folder.script index f7348d9209bc225ee9ceedafd2367e42c4c0fdfa..3d866526a2be1a5c8be58d31e71b4d02a4925edd 100644 --- a/conformance_test/core_language_tests/negative_tests/07-14_folder.script +++ b/conformance_test/core_language_tests/negative_tests/07-14_folder.script @@ -1798,6 +1798,129 @@ error: at or before token `control': syntax error, unexpected ControlKeyword, ex :h2. 09_test_configurations folder .*---------------------------------------------------------------------* +*---------------------------------------------------------------------* +:h3. NegSem_0901_Communication_ports_002 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Ensure that it is not possible to connect a mapped port > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_0901_Communication_ports_002 NegSem_0901_Communication_ports_002.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:9, Ensure that it is not possible to connect a mapped port + ** @verdict pass reject + ***************************************************/ + +/*NOTE: see Figure 7(f): connection of two TSI ports is not allowed + * */ + +module NegSem_0901_Communication_ports_002{ + + + type port loopbackPort message { + inout integer + } with {extension "internal"} + + type component GeneralComp { + port loopbackPort p1; + + } + + type component System { + port loopbackPort p1; + + } + + testcase TC_NegSem_0901_Communication_ports_002() runs on GeneralComp system System { + + var GeneralComp v_ptc := GeneralComp.create; + map(self:p1, system:p1); + connect(self:p1, v_ptc:p1); // error: mtc.p1 is already mapped to SystemComp.p1 + setverdict(pass); + + } + + control{ + execute(TC_NegSem_0901_Communication_ports_002()); + } + +} +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Connect operation cannot be performed on a mapped port \(p1\) +<END_RESULT> + +<END_TC> +:exmp + +*---------------------------------------------------------------------* +:h3. NegSem_0901_Communication_ports_004 negative test +.*---------------------------------------------------------------------* +:xmp tab=0. + +<TC - Verify that it is not possible to map a connected port > + +<COMPILE> +<EXECUTE_PARALLEL> + +<MODULE TTCN NegSem_0901_Communication_ports_004 NegSem_0901_Communication_ports_004.ttcn > +/****************************************************************************** + ** @version 0.0.1 + ** @purpose 1:9.1, Verify that it is not possible to map a connected port + ** @verdict pass reject + ***************************************************/ + +/*NOTE: see Figure 7(b): GeneralComp port p1 is mapped to a TSI port P1. + * Therefore mapping GeneralComp port p2 with TSI port P1 gives an error. + * */ + + + +module NegSem_0901_Communication_ports_004 { + + type port MyPort message { + inout integer + } with {extension "internal"} + + type component GeneralComp + { + port MyPort p1; + port MyPort p2; + } + + type component SystemComp + { + port MyPort p1; + } + + testcase TC_NegSem_0901_Communication_ports_004() runs on GeneralComp system SystemComp { + + //create a test component + var GeneralComp v_ptc := GeneralComp.create; + connect(self:p1, v_ptc:p1); + map(self:p1, system:p1); // error: mtc.p1 is already connected to v_ptc.p1 + setverdict(pass); + } + + control{ + execute(TC_NegSem_0901_Communication_ports_004()); + } +} + +<END_MODULE> + +<RESULT COUNT 1> +Dynamic test case error: Map operation is not allowed on a connected port \(p1\). +<END_RESULT> + +<END_TC> +:exmp + *---------------------------------------------------------------------* :h3. NegSem_0901_Communication_ports_007 negative test .*---------------------------------------------------------------------* @@ -1906,7 +2029,7 @@ error: Both endpoints of the mapping are system ports <COMPILE> -<MODULE TTCN NegSyn_0901_Communication_ports_001 NegSem_0901_Communication_ports_001.ttcn > +<MODULE TTCN NegSyn_0901_Communication_ports_001 NegSyn_0901_Communication_ports_001.ttcn > /*************************************************** ** @version 0.0.1 ** @purpose 1:9.1, Verify that a two TSI port cannot be connected diff --git a/conformance_test/core_language_tests/positive_tests/09_test_configurations/0901_communication_ports/NegSem_0901_Communication_ports_002.ttcn b/conformance_test/core_language_tests/positive_tests/09_test_configurations/0901_communication_ports/NegSem_0901_Communication_ports_002.ttcn index 7075bce4b18467e0c40f4fd0b107db2db3b5b0ac..bca9884d658e33634e96fe37034d36ac75482555 100644 --- a/conformance_test/core_language_tests/positive_tests/09_test_configurations/0901_communication_ports/NegSem_0901_Communication_ports_002.ttcn +++ b/conformance_test/core_language_tests/positive_tests/09_test_configurations/0901_communication_ports/NegSem_0901_Communication_ports_002.ttcn @@ -32,7 +32,7 @@ module NegSem_0901_Communication_ports_002{ var GeneralComp v_ptc := GeneralComp.create; map(self:p1, system:p1); - connect(self:p1, v_ptc:p1); // error: v_ptc.p1 is already connected to SystemComp.p1 + connect(self:p1, v_ptc:p1); // error: mtc.p1 is already mapped to SystemComp.p1 setverdict(pass); } diff --git a/conformance_test/core_language_tests/positive_tests/09_test_configurations/0901_communication_ports/NegSem_0901_Communication_ports_004.ttcn b/conformance_test/core_language_tests/positive_tests/09_test_configurations/0901_communication_ports/NegSem_0901_Communication_ports_004.ttcn index 17da3cf4a3cd98e67b1657ce920ed95a579e0861..1413dc30eebe71f65786db28b584e4f1b07ffe76 100644 --- a/conformance_test/core_language_tests/positive_tests/09_test_configurations/0901_communication_ports/NegSem_0901_Communication_ports_004.ttcn +++ b/conformance_test/core_language_tests/positive_tests/09_test_configurations/0901_communication_ports/NegSem_0901_Communication_ports_004.ttcn @@ -36,7 +36,7 @@ module NegSem_0901_Communication_ports_004 { //create a test component var GeneralComp v_ptc := GeneralComp.create; connect(self:p1, v_ptc:p1); - map(self:p1, system:p1); // error: v_ptc.p1 is already mapped to SystemComp.p1 + map(self:p1, system:p1); // error: mtc.p1 is already connected to v_ptc.p1 setverdict(pass); } diff --git a/conformance_test/core_language_tests/positive_tests/22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_026.ttcn b/conformance_test/core_language_tests/positive_tests/22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_026.ttcn index bc866d22d78762c15f9fd5453ccb876014eccfdb..f221fa0d834d395951ac723f77de862f4fae1a24 100644 --- a/conformance_test/core_language_tests/positive_tests/22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_026.ttcn +++ b/conformance_test/core_language_tests/positive_tests/22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_026.ttcn @@ -32,7 +32,7 @@ module Sem_220202_ReceiveOperation_026 { p[1].send(2); p[1].send(3); - any from p.receive(integer:?) -> @index v_int; + any from p.receive(integer:?) -> @index value v_int; if (v_int == 1) { // evaluation of @lazy (receive shall not be called again) alt { diff --git a/conformance_test/core_language_tests/positive_tests/22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_025.ttcn b/conformance_test/core_language_tests/positive_tests/22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_025.ttcn index 517c1132d6ba96067410cb30b94493f0ab5d0c32..4036efc603f93cfbe7518e589bbc34e031c2721c 100644 --- a/conformance_test/core_language_tests/positive_tests/22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_025.ttcn +++ b/conformance_test/core_language_tests/positive_tests/22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_025.ttcn @@ -30,7 +30,7 @@ module Sem_220203_TriggerOperation_025 { p[1].send(1); p[1].send(2); p[1].send(3); - any from p.trigger(integer:?) -> @index v_int; + any from p.trigger(integer:?) -> @index value v_int; if (v_int == 1) { // evaluation of @lazy (receive shall not be called again) alt { diff --git a/conformance_test/core_language_tests/positive_tests/pos_conf_tests.cfg b/conformance_test/core_language_tests/positive_tests/pos_conf_tests.cfg index 25ab99a3f5978a815060516455186840cf5b8305..2295ff53e41f50c23db261f47cd750c53491b74d 100644 --- a/conformance_test/core_language_tests/positive_tests/pos_conf_tests.cfg +++ b/conformance_test/core_language_tests/positive_tests/pos_conf_tests.cfg @@ -386,6 +386,22 @@ Sem_060203_records_and_sets_of_single_types_019.control Sem_060203_records_and_sets_of_single_types_020.control Sem_060203_records_and_sets_of_single_types_021.control Sem_060203_records_and_sets_of_single_types_022.control +Sem_060203_records_and_sets_of_single_types_023.control +Sem_060203_records_and_sets_of_single_types_024.control +Sem_060203_records_and_sets_of_single_types_025.control +Sem_060203_records_and_sets_of_single_types_026.control +Sem_060203_records_and_sets_of_single_types_027.control +Sem_060203_records_and_sets_of_single_types_028.control +Sem_060203_records_and_sets_of_single_types_029.control +Sem_060203_records_and_sets_of_single_types_030.control +Sem_060203_records_and_sets_of_single_types_031.control +Sem_060203_records_and_sets_of_single_types_032.control +Sem_060203_records_and_sets_of_single_types_033.control +Sem_060203_records_and_sets_of_single_types_034.control +Sem_060203_records_and_sets_of_single_types_035.control +Sem_060203_records_and_sets_of_single_types_036.control +Sem_060203_records_and_sets_of_single_types_037.control +Sem_060203_records_and_sets_of_single_types_038.control Sem_060204_enumerated_type_and_values_001.control Sem_060204_enumerated_type_and_values_002.control Sem_060204_enumerated_type_and_values_003.control @@ -432,6 +448,9 @@ Sem_060207_arrays_013.control Sem_060207_arrays_014.control Sem_060207_arrays_015.control Sem_060207_arrays_016.control +Sem_060207_arrays_017.control +Sem_060207_arrays_018.control +Sem_060207_arrays_019.control Sem_060207_arrays_020.control Sem_060207_arrays_021.control Sem_060207_arrays_022.control @@ -1021,6 +1040,8 @@ Sem_220202_ReceiveOperation_019.control Sem_220202_ReceiveOperation_020.control Sem_220202_ReceiveOperation_021.control Sem_220202_ReceiveOperation_022.control +Sem_220202_ReceiveOperation_024.control +Sem_220202_ReceiveOperation_026.control Sem_220203_TriggerOperation_001.control Sem_220203_TriggerOperation_002.control Sem_220203_TriggerOperation_003.control @@ -1038,6 +1059,8 @@ Sem_220203_TriggerOperation_019.control Sem_220203_TriggerOperation_020.control Sem_220203_TriggerOperation_021.control Sem_220203_TriggerOperation_022.control +Sem_220203_TriggerOperation_023.control +Sem_220203_TriggerOperation_025.control Sem_220301_CallOperation_001.control Sem_220301_CallOperation_002.control Sem_220301_CallOperation_003.control diff --git a/conformance_test/core_language_tests/positive_tests/pos_conf_tests.tpd b/conformance_test/core_language_tests/positive_tests/pos_conf_tests.tpd index 0dd5920b68256b3e76366415a860d36785030a25..6260c3c015bc3fc23eebd8585de79d8aac46dc0b 100644 --- a/conformance_test/core_language_tests/positive_tests/pos_conf_tests.tpd +++ b/conformance_test/core_language_tests/positive_tests/pos_conf_tests.tpd @@ -1014,22 +1014,22 @@ <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_020.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_020.ttcn"/> <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_021.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_021.ttcn"/> <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_022.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_022.ttcn"/> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_023.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_023.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_024.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_024.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_025.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_025.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_026.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_026.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_027.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_027.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_028.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_028.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_029.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_029.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_030.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_030.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_031.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_031.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_032.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_032.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_033.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_033.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_034.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_034.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_035.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_035.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_036.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_036.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_037.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_037.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_038.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_038.ttcn"/>--> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_023.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_023.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_024.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_024.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_025.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_025.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_026.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_026.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_027.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_027.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_028.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_028.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_029.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_029.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_030.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_030.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_031.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_031.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_032.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_032.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_033.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_033.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_034.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_034.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_035.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_035.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_036.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_036.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_037.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_037.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_038.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060203_records_and_sets_of_single_types/Sem_060203_records_and_sets_of_single_types_038.ttcn"/> <!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060204_enumerated_type_and_values/NegSem_060204_enumerated_type_and_values_001.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060204_enumerated_type_and_values/NegSem_060204_enumerated_type_and_values_001.ttcn"/>--> <!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060204_enumerated_type_and_values/NegSem_060204_enumerated_type_and_values_002.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060204_enumerated_type_and_values/NegSem_060204_enumerated_type_and_values_002.ttcn"/>--> <!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060204_enumerated_type_and_values/NegSem_060204_enumerated_type_and_values_003.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060204_enumerated_type_and_values/NegSem_060204_enumerated_type_and_values_003.ttcn"/>--> @@ -1156,9 +1156,9 @@ <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_014.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_014.ttcn"/> <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_015.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_015.ttcn"/> <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_016.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_016.ttcn"/> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_017.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_017.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_018.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_018.ttcn"/>--> -<!-- <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_019.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_019.ttcn"/>--> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_017.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_017.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_018.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_018.ttcn"/> + <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_019.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_019.ttcn"/> <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_020.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_020.ttcn"/> <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_021.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_021.ttcn"/> <FileResource projectRelativePath="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_022.ttcn" relativeURI="06_types_and_values/0602_structured_types_and_values/060207_arrays/Sem_060207_arrays_022.ttcn"/> @@ -2655,9 +2655,9 @@ <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_021.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_021.ttcn"/> <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_022.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_022.ttcn"/> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_023.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_023.ttcn"/>--> -<!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_024.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_024.ttcn"/>--> + <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_024.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_024.ttcn"/> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_025.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_025.ttcn"/>--> -<!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_026.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_026.ttcn"/>--> + <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_026.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_026.ttcn"/> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_027.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_027.ttcn"/>--> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_028.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_028.ttcn"/>--> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_029.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220202_receive_operation/Sem_220202_ReceiveOperation_029.ttcn"/>--> @@ -2706,9 +2706,9 @@ <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_020.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_020.ttcn"/> <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_021.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_021.ttcn"/> <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_022.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_022.ttcn"/> -<!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_023.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_023.ttcn"/>--> + <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_023.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_023.ttcn"/> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_024.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_024.ttcn"/>--> -<!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_025.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_025.ttcn"/>--> + <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_025.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_025.ttcn"/> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_026.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_026.ttcn"/>--> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_027.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_027.ttcn"/>--> <!-- <FileResource projectRelativePath="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_028.ttcn" relativeURI="22_communication_operations/2202_message_based_communication/220203_trigger_operation/Sem_220203_TriggerOperation_028.ttcn"/>--> diff --git a/core/Array.hh b/core/Array.hh index 0369ffdfe4741ecf6d796f33e2b44cb2270d2bec..c12f6b8f9478c164f0fe18a20612fb8ba94b4eb0 100644 --- a/core/Array.hh +++ b/core/Array.hh @@ -35,90 +35,6 @@ class INTEGER; -/** common code for all port, timer and component operations with at least one - * argument, performed on arrays with the help of the 'any from' clause - * - * returns an alt status, depending on the return values of elements - * alt-status priority: ALT_YES (return immediately) > ALT_REPEAT > ALT_MAYBE > ALT_NO - */ -#define ANY_FROM_OPERATION(opname, ...) \ - if (index_redirect != NULL) { \ - index_redirect->incr_pos(); \ - } \ - alt_status result = ALT_NO; \ - for (unsigned int i = 0; i < array_size; ++i) { \ - alt_status ret_val = array_elements[i].opname(__VA_ARGS__, index_redirect); \ - if (ret_val == ALT_YES) { \ - if (index_redirect != NULL) { \ - index_redirect->add_index((int)i + index_offset); \ - } \ - result = ret_val; \ - break; \ - } \ - else if (ret_val == ALT_REPEAT || \ - (ret_val == ALT_MAYBE && result == ALT_NO)) { \ - result = ret_val; \ - } \ - } \ - if (index_redirect != NULL) { \ - index_redirect->decr_pos(); \ - } \ - return result; - -/** common code for all timer and component operations with no arguments, - * performed on arrays with the help of the 'any from' clause - * - * returns an alt status, depending on the return values of elements - * alt-status priority: ALT_YES (return immediately) > ALT_REPEAT > ALT_MAYBE > ALT_NO - */ -#define ANY_FROM_OPERATION_NO_ARGS(opname) \ - if (index_redirect != NULL) { \ - index_redirect->incr_pos(); \ - } \ - alt_status result = ALT_NO; \ - for (unsigned int i = 0; i < array_size; ++i) { \ - alt_status ret_val = array_elements[i].opname(index_redirect); \ - if (ret_val == ALT_YES) { \ - if (index_redirect != NULL) { \ - index_redirect->add_index((int)i + index_offset); \ - } \ - result = ret_val; \ - break; \ - } \ - else if (ret_val == ALT_REPEAT || \ - (ret_val == ALT_MAYBE && result == ALT_NO)) { \ - result = ret_val; \ - } \ - } \ - if (index_redirect != NULL) { \ - index_redirect->decr_pos(); \ - } \ - return result; - -/** common code for all port, timer and component operations with no arguments, - * performed on arrays with the help of the 'any from' clause - * - * returns a boolean: TRUE if at least one of the elements returns TRUE - */ -#define ANY_FROM_OPERATION_NO_ARGS_BOOL(opname) \ - if (index_redirect != NULL) { \ - index_redirect->incr_pos(); \ - } \ - boolean ret_val = FALSE; \ - for (unsigned int i = 0; i < array_size; ++i) { \ - ret_val = array_elements[i].opname(index_redirect); \ - if (ret_val) { \ - if (index_redirect != NULL) { \ - index_redirect->add_index((int)i + index_offset); \ - } \ - break; \ - } \ - } \ - if (index_redirect != NULL) { \ - index_redirect->decr_pos(); \ - } \ - return ret_val; - extern unsigned int get_timer_array_index(int index_value, unsigned int array_size, int index_offset); extern unsigned int get_timer_array_index(const INTEGER& index_value, @@ -187,14 +103,52 @@ public: TTCN_Logger::log_event_str(" }"); } + // alt-status priority: ALT_YES (return immediately) > ALT_REPEAT > ALT_MAYBE > ALT_NO alt_status timeout(Index_Redirect* index_redirect) { - ANY_FROM_OPERATION_NO_ARGS(timeout) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].timeout(index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } boolean running(Index_Redirect* index_redirect) const { - ANY_FROM_OPERATION_NO_ARGS_BOOL(running) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + boolean ret_val = FALSE; + for (unsigned int i = 0; i < array_size; ++i) { + ret_val = array_elements[i].running(index_redirect); + if (ret_val) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + break; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return ret_val; } }; @@ -261,10 +215,33 @@ public: TTCN_Logger::log_event_str(" }"); } + // alt-status priority: ALT_YES (return immediately) > ALT_REPEAT > ALT_MAYBE > ALT_NO alt_status receive(const COMPONENT_template& sender_template, COMPONENT *sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(receive, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].receive(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template> @@ -278,8 +255,29 @@ public: const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(receive, value_template, NULL, - sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].receive(value_template, NULL, + sender_template, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_value_redirect, typename T_template> @@ -289,14 +287,57 @@ public: const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(receive, value_template, value_redirect, - sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].receive(value_template, + value_redirect, sender_template, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status check_receive(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_receive, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_receive(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template> @@ -308,8 +349,29 @@ public: const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_receive, value_template, NULL, - sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_receive(value_template, NULL, + sender_template, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_value_redirect, typename T_template> @@ -319,14 +381,57 @@ public: const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_receive, value_template, value_redirect, - sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_receive(value_template, + value_redirect, sender_template, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status trigger(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(trigger, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].trigger(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template> @@ -338,8 +443,29 @@ public: const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(trigger, value_template, NULL, - sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].trigger(value_template, NULL, + sender_template, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_value_redirect, typename T_template> @@ -349,14 +475,57 @@ public: const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(trigger, value_template, value_redirect, - sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].trigger(value_template, + value_redirect, sender_template, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status getcall(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(getcall, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].getcall(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template, typename T_parameter_redirect> @@ -365,14 +534,57 @@ public: const T_parameter_redirect& param_ref, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(getcall, getcall_template, sender_template, - param_ref, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].getcall(getcall_template, + sender_template, param_ref, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status check_getcall(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_getcall, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_getcall(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template, typename T_parameter_redirect> @@ -381,14 +593,57 @@ public: const T_parameter_redirect& param_ref, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_getcall, getcall_template, sender_template, - param_ref, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_getcall(getcall_template, + sender_template, param_ref, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status getreply(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(getreply, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].getreply(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template, typename T_parameter_redirect> @@ -397,14 +652,57 @@ public: const T_parameter_redirect& param_ref, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(getreply, getreply_template, sender_template, - param_ref, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].getreply(getreply_template, + sender_template, param_ref, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status check_getreply(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_getreply, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_getreply(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template, typename T_parameter_redirect> @@ -413,14 +711,57 @@ public: const T_parameter_redirect& param_ref, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_getreply, getreply_template, sender_template, - param_ref, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_getreply(getreply_template, + sender_template, param_ref, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status get_exception(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(get_exception, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].get_exception(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template> @@ -428,13 +769,57 @@ public: const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(get_exception, catch_template, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].get_exception(catch_template, + sender_template, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status check_catch(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_catch, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_catch(sender_template, + sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } template <typename T_template> @@ -442,13 +827,57 @@ public: const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check_catch, catch_template, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check_catch(catch_template, + sender_template, sender_ptr, index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status check(const COMPONENT_template& sender_template, COMPONENT* sender_ptr, Index_Redirect* index_redirect) { - ANY_FROM_OPERATION(check, sender_template, sender_ptr) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].check(sender_template, sender_ptr, + index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } }; @@ -540,24 +969,99 @@ public: * Returns the length of the decoded data. */ int JSON_decode(const TTCN_Typedescriptor_t&, JSON_Tokenizer&, boolean); + // alt-status priority: ALT_YES (return immediately) > ALT_REPEAT > ALT_MAYBE > ALT_NO alt_status done(Index_Redirect* index_redirect) const { - ANY_FROM_OPERATION_NO_ARGS(done) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].done(index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } alt_status killed(Index_Redirect* index_redirect) const { - ANY_FROM_OPERATION_NO_ARGS(killed) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + alt_status result = ALT_NO; + for (unsigned int i = 0; i < array_size; ++i) { + alt_status ret_val = array_elements[i].killed(index_redirect); + if (ret_val == ALT_YES) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + result = ret_val; + break; + } + else if (ret_val == ALT_REPEAT || + (ret_val == ALT_MAYBE && result == ALT_NO)) { + result = ret_val; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return result; } boolean running(Index_Redirect* index_redirect) const { - ANY_FROM_OPERATION_NO_ARGS_BOOL(running) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + boolean ret_val = FALSE; + for (unsigned int i = 0; i < array_size; ++i) { + ret_val = array_elements[i].running(index_redirect); + if (ret_val) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + break; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return ret_val; } boolean alive(Index_Redirect* index_redirect) const { - ANY_FROM_OPERATION_NO_ARGS_BOOL(alive) + if (index_redirect != NULL) { + index_redirect->incr_pos(); + } + boolean ret_val = FALSE; + for (unsigned int i = 0; i < array_size; ++i) { + ret_val = array_elements[i].alive(index_redirect); + if (ret_val) { + if (index_redirect != NULL) { + index_redirect->add_index((int)i + index_offset); + } + break; + } + } + if (index_redirect != NULL) { + index_redirect->decr_pos(); + } + return ret_val; } }; diff --git a/core/config_process.l b/core/config_process.l index 4e0979486e139a080a74741c3570d8d1aa47a6c2..6382902f3f6cabca68d5d1ec2371de372d3daf09 100644 --- a/core/config_process.l +++ b/core/config_process.l @@ -34,7 +34,6 @@ #include <deque> #include <string> -#include <math.h> #include "../common/cfg_process_utils.hh" #include "../common/Path2.hh" diff --git a/function_test/Semantic_Analyser/template/TempRes_OK.ttcn b/function_test/Semantic_Analyser/template/TempRes_OK.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..75ec620bd219e54518100a979c7a4a4e02ecbb5c --- /dev/null +++ b/function_test/Semantic_Analyser/template/TempRes_OK.ttcn @@ -0,0 +1,64 @@ +/****************************************************************************** + * 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 + * + ******************************************************************************/ +module TempRes_OK { + + template integer MyIntTemplate := 5; + + template integer MyIntTemplate2 modifies MyIntTemplate := 5; + + template (value) integer MyIntTemplate3 modifies MyIntTemplate := 5; + + template (omit) integer MyIntTemplate4 modifies MyIntTemplate := 5; + + template (present) integer MyIntTemplate5 modifies MyIntTemplate := 5; + + + + + template (value) integer MyValueIntTemplate := 5; + + template (value) integer MyValueIntTemplate2 modifies MyValueIntTemplate := 5; + + template integer MyValueIntTemplate3 modifies MyValueIntTemplate := 5; + + template (omit) integer MyValueIntTemplate4 modifies MyValueIntTemplate := 5; + + template (present) integer MyValueIntTemplate5 modifies MyValueIntTemplate := 5; + + + + + template (omit) integer MyOmitIntTemplate := 5; + + template (omit) integer MyOmitIntTemplate2 modifies MyOmitIntTemplate := 5; + + template (value) integer MyOmitIntTemplate3 modifies MyOmitIntTemplate := 5; + + template integer MyOmitIntTemplate4 modifies MyOmitIntTemplate := 5; + + template (present) integer MyOmitIntTemplate5 modifies MyOmitIntTemplate := 5; + + + + + template (present) integer MyPresentIntTemplate := 5; + + template (present) integer MyPresentIntTemplate2 modifies MyPresentIntTemplate := 5; + + template (omit) integer MyPresentIntTemplate3 modifies MyPresentIntTemplate := 5; + + template (value) integer MyPresentIntTemplate4 modifies MyPresentIntTemplate := 5; + + template integer MyPresentIntTemplate5 modifies MyPresentIntTemplate := 5; + + +} \ No newline at end of file diff --git a/mctr2/cli/config_read.l b/mctr2/cli/config_read.l index b0ba7810c306245cbbfefa1197df3cbcd91093c5..81eecc2f21e33a5ca523897d8229db3a76135be2 100644 --- a/mctr2/cli/config_read.l +++ b/mctr2/cli/config_read.l @@ -35,7 +35,6 @@ #include <deque> #include <string> -#include <math.h> #include <openssl/crypto.h> #include <openssl/bn.h> diff --git a/regression_test/commProcedure/ProcPort.ttcn b/regression_test/commProcedure/ProcPort.ttcn index 6c1e792b384ffbf0c1b38db531f73c641c6539cc..e58d4ba04772f6164924c7b13a7ca1e72cc3e692 100644 --- a/regression_test/commProcedure/ProcPort.ttcn +++ b/regression_test/commProcedure/ProcPort.ttcn @@ -621,9 +621,9 @@ testcase tc_Check_2() runs on ProcComponent { } // Address port cannot be connected. -testcase tc_PortAddress_internal_usage() runs on ProcComponentMultiPort { - /* procedure based internal communication with address-supporting port */ - /*var ProcComponent2 PC2; +/*testcase tc_PortAddress_internal_usage() runs on ProcComponentMultiPort { + //procedure based internal communication with address-supporting port + var ProcComponent2 PC2; var integer i:=0; PC2:=ProcComponent2.create; PC2.start(GetCall_behav3()); @@ -650,9 +650,9 @@ testcase tc_PortAddress_internal_usage() runs on ProcComponentMultiPort { []Port4.catch(timeout) { setverdict(fail); } - }*/ + } setverdict(pass); -} +}*/ testcase tc_PortAddress_external_usage1() runs on addressComponent system addressComponent { @@ -794,7 +794,7 @@ control { execute(tc_Call_MultiPTC_anyport()); execute(tc_Check_1()); execute(tc_Check_2()); - execute(tc_PortAddress_internal_usage()); // auto pass: address port cannot be connected. + //execute(tc_PortAddress_internal_usage()); execute(tc_PortAddress_external_usage1()); execute(tc_PortAddress_external_usage2()); execute(tc_GetReplyParameters()); diff --git a/regression_test/defaultOper/Makefile b/regression_test/defaultOper/Makefile index 093f8c295502be3324bca0d00da6102a570d7086..8577bf1403430544ed93f00aa52e9faa1e4f7b58 100644 --- a/regression_test/defaultOper/Makefile +++ b/regression_test/defaultOper/Makefile @@ -23,6 +23,10 @@ TTCN3_LIB = ttcn3$(RT2_SUFFIX)-parallel$(DYNAMIC_SUFFIX) TTCN3_MODULES = TdefaultOper.ttcn +ifdef RT2 +TTCN3_MODULES += TdefaultOperRT2.ttcn +endif + GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) ifdef CODE_SPLIT @@ -54,7 +58,7 @@ dep: $(GENERATED_SOURCES) makedepend $(CPPFLAGS) $(GENERATED_SOURCES) run: $(TARGET) - ttcn3_start $(TARGET) config.cfg + ttcn3_start $(TARGET) config$(RT2_SUFFIX).cfg .NOTPARALLEL: diff --git a/regression_test/defaultOper/TdefaultOperRT2.ttcn b/regression_test/defaultOper/TdefaultOperRT2.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..27be1a169c5b7cd5157d762b6549d0cb2885eb86 --- /dev/null +++ b/regression_test/defaultOper/TdefaultOperRT2.ttcn @@ -0,0 +1,94 @@ +/****************************************************************************** + * 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: + * Baranyi, Botond + * + ******************************************************************************/ + +// This module contains tests for bug fix 500919. +// Description: If an altstep deactivates itself (more specifically deactivates the +// default variable that executed the altstep), then all of its parameters are deleted, +// and accessing them generally causes dynamic test case errors or segmentation faults. +// The bug fix is only available in Runtime 2. +module TdefaultOperRT2 { + +type port PT message { + inout integer +} +with { + extension "internal"; +} + +type component CT { + var default ct_def; + var integer ct_int; + timer ct_tmr[2]; + port PT pt; +} + +altstep as_deactivates_itself(in integer x) runs on CT { + var integer copy := x; + [] ct_tmr[x].timeout { + deactivate(ct_def); + if (x != copy) { + setverdict(fail, "Parameter has changed from ", copy, " to ", x); + } + else { + setverdict(pass); + } + } +} + +testcase tc_altstep_deactivates_itself() runs on CT { + ct_def := activate(as_deactivates_itself(1)); + connect(self:pt, self:pt); + pt.send(1); + ct_tmr[1].start(0.1); + alt { + [] pt.receive(integer:2) { + setverdict(fail, "Invalid alt branch"); + } + } +} + +altstep as_deactivates_everyone(in integer x, inout integer y) runs on CT { + var integer x_copy := x; + [] ct_tmr[x].timeout { + var integer y_copy := y; + deactivate; + if (x != x_copy) { + setverdict(fail, "Parameter 'x' has changed from ", x_copy, " to ", x); + } + else if (y != y_copy) { + setverdict(fail, "Parameter 'y' has changed from ", y_copy, " to ", y); + } + else { + setverdict(pass); + } + } +} + +testcase tc_altstep_deactivates_everyone() runs on CT { + ct_int := 6; + ct_def := activate(as_deactivates_everyone(1, ct_int)); + connect(self:pt, self:pt); + pt.send(1); + ct_tmr[1].start(0.1); + alt { + [] pt.receive(integer:2) { + setverdict(fail, "Invalid alt branch"); + } + } +} + +control { + execute(tc_altstep_deactivates_itself()); + execute(tc_altstep_deactivates_everyone()); +} + +} diff --git a/regression_test/defaultOper/config-rt2.cfg b/regression_test/defaultOper/config-rt2.cfg new file mode 100644 index 0000000000000000000000000000000000000000..74f0dabe65a75229e98aa368081bc292212181e4 --- /dev/null +++ b/regression_test/defaultOper/config-rt2.cfg @@ -0,0 +1,20 @@ +############################################################################### +# 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: +# Balasko, Jeno +# Baranyi, Botond +# +############################################################################### +[MODULE_PARAMETERS] +[LOGGING] +Logfile := "defaultOper.log" +FileMask := LOG_ALL +ConsoleMask := TTCN_WARNING | TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS +[EXECUTE] +TdefaultOper +TdefaultOperRT2 diff --git a/usrguide/SoC_TITAN.docx b/usrguide/SoC_TITAN.docx index 99d53408c019d10060da32ab15e4cf1d3acdb5f8..e45382ebce34fe39668ff7101df3fd058efec68f 100644 Binary files a/usrguide/SoC_TITAN.docx and b/usrguide/SoC_TITAN.docx differ diff --git a/usrguide/referenceguide.doc b/usrguide/referenceguide.doc index 2c65d8a95dc9d0aafe3e69ef8ff941bff9adce9b..c979b127e3be4b7b4a880126a01846e1b8c8ecec 100644 Binary files a/usrguide/referenceguide.doc and b/usrguide/referenceguide.doc differ diff --git a/xsdconvert/GeneralFunctions.cc b/xsdconvert/GeneralFunctions.cc index 818e4fee94a136f5c1215dab29ce2d5381fcbf36..858a4c646d60692b9aa247844691616da8193a25 100644 --- a/xsdconvert/GeneralFunctions.cc +++ b/xsdconvert/GeneralFunctions.cc @@ -24,7 +24,6 @@ #include <cctype> // for using "toupper" function #include <cstring> #include <cstdio> -#include <cmath> #include <regex.h> #include "../common/version_internal.h" diff --git a/xsdconvert/SimpleType.cc b/xsdconvert/SimpleType.cc index cad677b8e0e142170b98163170274236e78eb859..c9c857c952d390e3b7a2ac5d60b4bcd149e90563 100644 --- a/xsdconvert/SimpleType.cc +++ b/xsdconvert/SimpleType.cc @@ -23,7 +23,7 @@ #include "ComplexType.hh" #include "Constant.hh" -#include <cmath> // for using "pow" function +#include <math.h> #include <cfloat> extern bool g_flag_used;