From a5f71b1a08ac5a9a1aa6f8c601cb8eb186bcfb54 Mon Sep 17 00:00:00 2001 From: Botond Baranyi <botond.baranyi@ericsson.com> Date: Tue, 6 Nov 2018 10:30:30 +0100 Subject: [PATCH] Implemented timestamp redirect (incoming events only) for real-time TTCN-3 (bug 539514) Change-Id: I92c4fc164a68023a5717c5c6d5365cb096f5a3b7 Signed-off-by: Botond Baranyi <botond.baranyi@ericsson.com> --- compiler2/Identifier.cc | 3 + compiler2/ttcn3/Statement.cc | 120 ++- compiler2/ttcn3/Statement.hh | 15 +- compiler2/ttcn3/Ttcnstuff.cc | 6 +- compiler2/ttcn3/Ttcnstuff.hh | 5 +- compiler2/ttcn3/compiler.l | 2 + compiler2/ttcn3/compiler.y | 502 ++++++++++++- compiler2/ttcn3/port.c | 246 +++++-- compiler2/ttcn3/port.h | 1 + core/Array.hh | 111 +-- core/LegacyLogger.cc | 18 +- core/LoggerPluginManager.cc | 2 +- core/Port.cc | 70 +- core/Port.hh | 46 +- .../realtime/realtimeTimestamp_SE.ttcn | 102 +++ loggerplugins/JUnitLogger/JUnitLogger.cc | 4 +- loggerplugins/JUnitLogger2/JUnitLogger2.cc | 4 +- .../LTTngUSTLogger/LTTngUSTLogger.cc | 2 +- loggerplugins/TSTLogger/TSTLogger.cc | 4 +- .../ietf_params_xml_ns_pidf_e.ttcn | 3 +- regression_test/realtime/.gitignore | 3 + regression_test/realtime/Makefile | 16 +- regression_test/realtime/PortMsg.cc | 87 +++ regression_test/realtime/PortMsg.hh | 45 ++ regression_test/realtime/PortProc.cc | 122 ++++ regression_test/realtime/PortProc.hh | 49 ++ regression_test/realtime/config.cfg | 1 + .../realtime/realtimeTimestamp.ttcn | 681 ++++++++++++++++++ xsdconvert/GeneralFunctions.cc | 6 +- 29 files changed, 2057 insertions(+), 219 deletions(-) create mode 100644 function_test/Semantic_Analyser/realtime/realtimeTimestamp_SE.ttcn create mode 100644 regression_test/realtime/PortMsg.cc create mode 100644 regression_test/realtime/PortMsg.hh create mode 100644 regression_test/realtime/PortProc.cc create mode 100644 regression_test/realtime/PortProc.hh create mode 100644 regression_test/realtime/realtimeTimestamp.ttcn diff --git a/compiler2/Identifier.cc b/compiler2/Identifier.cc index cdd2b003a..2333ee8a1 100644 --- a/compiler2/Identifier.cc +++ b/compiler2/Identifier.cc @@ -802,6 +802,7 @@ namespace Common { {"noblock__", "noblock", "noblock_"}, {"none__", "none", "none_"}, {"not4b__", "not4b", "not4b_"}, + {"now__", "now", "now_"}, {"nowait__", "nowait", "nowait_"}, {"null__", "null", "null_"}, {"objid__", "objid", "objid_"}, @@ -821,6 +822,7 @@ namespace Common { {"procedure__", "procedure", "procedure_"}, {"raise__", "raise", "raise_"}, {"read__", "read", "read_"}, + {"realtime__", "realtime", "realtime_"}, {"receive__", "receive", "receive_"}, {"record__", "record", "record_"}, {"recursive__", "recursive", "recursive_"}, @@ -844,6 +846,7 @@ namespace Common { {"testcase__", "testcase", "testcase_"}, {"timeout__", "timeout", "timeout_"}, {"timer__", "timer", "timer_"}, + {"timestamp__", "timestamp", "timestamp_"}, {"to__", "to", "to_"}, {"trigger__", "trigger", "trigger_"}, {"type__", "type", "type_"}, diff --git a/compiler2/ttcn3/Statement.cc b/compiler2/ttcn3/Statement.cc index 6b3ba9bd1..31268e53a 100644 --- a/compiler2/ttcn3/Statement.cc +++ b/compiler2/ttcn3/Statement.cc @@ -612,6 +612,7 @@ namespace Ttcn { delete port_op.r.redirect.value; delete port_op.r.redirect.sender; delete port_op.r.redirect.index; + delete port_op.r.redirect.timestamp; break; case S_GETCALL: case S_CHECK_GETCALL: @@ -621,6 +622,7 @@ namespace Ttcn { delete port_op.r.redirect.param; delete port_op.r.redirect.sender; delete port_op.r.redirect.index; + delete port_op.r.redirect.timestamp; break; case S_GETREPLY: case S_CHECK_GETREPLY: @@ -632,6 +634,7 @@ namespace Ttcn { delete port_op.r.redirect.param; delete port_op.r.redirect.sender; delete port_op.r.redirect.index; + delete port_op.r.redirect.timestamp; break; case S_CATCH: case S_CHECK_CATCH: @@ -642,12 +645,14 @@ namespace Ttcn { delete port_op.r.redirect.value; delete port_op.r.redirect.sender; delete port_op.r.redirect.index; + delete port_op.r.redirect.timestamp; break; case S_CHECK: delete port_op.portref; delete port_op.r.fromclause; delete port_op.r.redirect.sender; delete port_op.r.redirect.index; + delete port_op.r.redirect.timestamp; break; case S_CLEAR: case S_START_PORT: @@ -1170,7 +1175,8 @@ namespace Ttcn { TemplateInstance *p_templinst, TemplateInstance *p_fromclause, ValueRedirect *p_redirectval, Reference *p_redirectsender, - Reference* p_redirectindex, bool p_translate) + Reference* p_redirectindex, Reference* p_timestamp_redirect, + bool p_translate) : statementtype(p_st), my_sb(0) { switch(statementtype) { @@ -1186,6 +1192,7 @@ namespace Ttcn { port_op.r.redirect.param=0; port_op.r.redirect.sender=p_redirectsender; port_op.r.redirect.index = p_redirectindex; + port_op.r.redirect.timestamp = p_timestamp_redirect; break; default: FATAL_ERROR("Statement::Statement()"); @@ -1197,7 +1204,8 @@ namespace Ttcn { TemplateInstance *p_fromclause, ParamRedirect *p_redirectparam, Reference *p_redirectsender, - Reference* p_redirectindex) + Reference* p_redirectindex, + Reference* p_timestamp_redirect) : statementtype(p_st), my_sb(0) { switch(statementtype) { @@ -1211,6 +1219,7 @@ namespace Ttcn { port_op.r.redirect.param=p_redirectparam; port_op.r.redirect.sender=p_redirectsender; port_op.r.redirect.index = p_redirectindex; + port_op.r.redirect.timestamp = p_timestamp_redirect; break; default: FATAL_ERROR("Statement::Statement()"); @@ -1222,7 +1231,8 @@ namespace Ttcn { TemplateInstance *p_valuematch, TemplateInstance *p_fromclause, ValueRedirect *p_redirectval, ParamRedirect *p_redirectparam, - Reference *p_redirectsender, Reference* p_redirectindex) + Reference *p_redirectsender, Reference* p_redirectindex, + Reference* p_timestamp_redirect) : statementtype(p_st), my_sb(0) { switch(statementtype) { @@ -1238,6 +1248,7 @@ namespace Ttcn { port_op.r.redirect.param=p_redirectparam; port_op.r.redirect.sender=p_redirectsender; port_op.r.redirect.index = p_redirectindex; + port_op.r.redirect.timestamp = p_timestamp_redirect; break; default: FATAL_ERROR("Statement::Statement()"); @@ -1248,7 +1259,7 @@ namespace Ttcn { Reference *p_sig, TemplateInstance *p_templinst, bool p_timeout, TemplateInstance *p_fromclause, ValueRedirect *p_redirectval, Reference *p_redirectsender, - Reference* p_redirectindex) + Reference* p_redirectindex, Reference* p_timestamp_redirect) : statementtype(p_st), my_sb(0) { switch(statementtype) { @@ -1270,6 +1281,7 @@ namespace Ttcn { port_op.r.redirect.param=0; port_op.r.redirect.sender=p_redirectsender; port_op.r.redirect.index = p_redirectindex; + port_op.r.redirect.timestamp = p_timestamp_redirect; break; default: FATAL_ERROR("Statement::Statement()"); @@ -1278,7 +1290,8 @@ namespace Ttcn { Statement::Statement(statementtype_t p_st, Reference *p_ref, bool p_anyfrom, TemplateInstance *p_fromclause, - Reference *p_redirectsender, Reference* p_redirectindex) + Reference *p_redirectsender, Reference* p_redirectindex, + Reference* p_timestamp_redirect) : statementtype(p_st), my_sb(0) { switch(statementtype) { @@ -1290,6 +1303,7 @@ namespace Ttcn { port_op.r.redirect.param=0; port_op.r.redirect.sender=p_redirectsender; port_op.r.redirect.index = p_redirectindex; + port_op.r.redirect.timestamp = p_timestamp_redirect; break; default: FATAL_ERROR("Statement::Statement()"); @@ -1838,6 +1852,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_my_scope(p_scope); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_my_scope(p_scope); + } break; case S_GETCALL: case S_CHECK_GETCALL: @@ -1851,6 +1868,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_my_scope(p_scope); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_my_scope(p_scope); + } break; case S_GETREPLY: case S_CHECK_GETREPLY: @@ -1868,6 +1888,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_my_scope(p_scope); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_my_scope(p_scope); + } break; case S_CATCH: case S_CHECK_CATCH: @@ -1883,6 +1906,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_my_scope(p_scope); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_my_scope(p_scope); + } break; case S_CHECK: if(port_op.portref) port_op.portref->set_my_scope(p_scope); @@ -1892,6 +1918,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_my_scope(p_scope); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_my_scope(p_scope); + } break; case S_CLEAR: case S_START_PORT: @@ -2122,6 +2151,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_fullname(p_fullname+".redirindex"); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_fullname(p_fullname+".redirtimestamp"); + } break; case S_GETCALL: case S_CHECK_GETCALL: @@ -2137,6 +2169,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_fullname(p_fullname+".redirindex"); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_fullname(p_fullname+".redirtimestamp"); + } break; case S_GETREPLY: case S_CHECK_GETREPLY: @@ -2156,6 +2191,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_fullname(p_fullname+".redirindex"); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_fullname(p_fullname+".redirtimestamp"); + } break; case S_CATCH: case S_CHECK_CATCH: @@ -2173,6 +2211,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_fullname(p_fullname+".redirindex"); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_fullname(p_fullname+".redirtimestamp"); + } break; case S_CHECK: if(port_op.portref) port_op.portref->set_fullname(p_fullname+".portref"); @@ -2183,6 +2224,9 @@ namespace Ttcn { if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_fullname(p_fullname+".redirindex"); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_fullname(p_fullname+".redirtimestamp"); + } break; case S_CLEAR: case S_START_PORT: @@ -4089,6 +4133,7 @@ error: chk_index_redirect(port_op.r.redirect.index, t_ass != NULL ? t_ass->get_Dimensions() : NULL, port_op.anyfrom, "port"); } + chk_timestamp_redirect(port_type); // checking deterministic if (port_op.r.rcvpar) { @@ -4203,6 +4248,7 @@ error: chk_index_redirect(port_op.r.redirect.index, t_ass != NULL ? t_ass->get_Dimensions() : NULL, port_op.anyfrom, "port"); } + chk_timestamp_redirect(port_type); } void Statement::chk_getreply() @@ -4359,6 +4405,7 @@ error: chk_index_redirect(port_op.r.redirect.index, t_ass != NULL ? t_ass->get_Dimensions() : NULL, port_op.anyfrom, "port"); } + chk_timestamp_redirect(port_type); } void Statement::chk_catch() @@ -4555,6 +4602,7 @@ error: chk_index_redirect(port_op.r.redirect.index, t_ass != NULL ? t_ass->get_Dimensions() : NULL, port_op.anyfrom, "port"); } + chk_timestamp_redirect(port_type); } void Statement::chk_check() @@ -4574,6 +4622,7 @@ error: chk_index_redirect(port_op.r.redirect.index, t_ass != NULL ? t_ass->get_Dimensions() : NULL, port_op.anyfrom, "port"); } + chk_timestamp_redirect(port_type); } void Statement::chk_clear() @@ -5573,6 +5622,26 @@ error: } return t_var_type; } + + void Statement::chk_timestamp_redirect(Type* port_type) + { + if (port_op.r.redirect.timestamp == NULL) { + return; + } + + if (port_type != NULL && !port_type->get_PortBody()->is_realtime()) { + port_op.r.redirect.timestamp->error("The timestamp cannot be redirected, " + "because port type `%s' does not have the 'realtime' clause", + port_type->get_typename().c_str()); + } + + Type* t_var_type = port_op.r.redirect.timestamp->chk_variable_ref(); + if (t_var_type != NULL && + t_var_type->get_type_refd_last()->get_typetype() != Type::T_REAL) { + port_op.r.redirect.timestamp->error("The type of the variable should be " + "float instead of `%s'", t_var_type->get_typename().c_str()); + } + } Type *Statement::chk_signature_ref(Reference *p_ref) { @@ -6001,6 +6070,9 @@ error: if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_code_section(p_code_section); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_code_section(p_code_section); + } break; case S_GETCALL: case S_CHECK_GETCALL: @@ -6015,6 +6087,9 @@ error: if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_code_section(p_code_section); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_code_section(p_code_section); + } break; case S_GETREPLY: case S_CHECK_GETREPLY: @@ -6033,6 +6108,9 @@ error: if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_code_section(p_code_section); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_code_section(p_code_section); + } break; case S_CATCH: case S_CHECK_CATCH: @@ -6047,6 +6125,9 @@ error: if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_code_section(p_code_section); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_code_section(p_code_section); + } break; case S_CHECK: if (port_op.portref) port_op.portref->set_code_section(p_code_section); @@ -6057,6 +6138,9 @@ error: if (port_op.r.redirect.index != NULL) { port_op.r.redirect.index->set_code_section(p_code_section); } + if (port_op.r.redirect.timestamp != NULL) { + port_op.r.redirect.timestamp->set_code_section(p_code_section); + } break; case S_CLEAR: case S_START_PORT: @@ -7911,6 +7995,8 @@ error: generate_code_expr_fromclause(expr); expr->expr = mputstr(expr->expr, ", "); generate_code_expr_senderredirect(expr); + expr->expr = mputstr(expr->expr, ", "); + generate_code_expr_timestamp_redirect(expr); if (port_op.portref || port_op.translate) { expr->expr = mputstr(expr->expr, ", "); if (port_op.r.redirect.index != NULL) { @@ -7964,6 +8050,8 @@ error: generate_code_expr_senderredirect(expr); } expr->expr = mputstr(expr->expr, ", "); + generate_code_expr_timestamp_redirect(expr); + expr->expr = mputstr(expr->expr, ", "); if (port_op.r.redirect.index != NULL) { generate_code_index_redirect(expr, port_op.r.redirect.index, my_sb); } @@ -7976,6 +8064,8 @@ error: generate_code_expr_fromclause(expr); expr->expr = mputstr(expr->expr, ", "); generate_code_expr_senderredirect(expr); + expr->expr = mputstr(expr->expr, ", "); + generate_code_expr_timestamp_redirect(expr); } expr->expr=mputc(expr->expr, ')'); } @@ -8047,6 +8137,8 @@ error: generate_code_expr_senderredirect(expr); } expr->expr = mputstr(expr->expr, ", "); + generate_code_expr_timestamp_redirect(expr); + expr->expr = mputstr(expr->expr, ", "); if (port_op.r.redirect.index != NULL) { generate_code_index_redirect(expr, port_op.r.redirect.index, my_sb); } @@ -8059,6 +8151,8 @@ error: generate_code_expr_fromclause(expr); expr->expr = mputstr(expr->expr, ", "); generate_code_expr_senderredirect(expr); + expr->expr = mputstr(expr->expr, ", "); + generate_code_expr_timestamp_redirect(expr); } expr->expr = mputc(expr->expr, ')'); } @@ -8097,6 +8191,8 @@ error: generate_code_expr_fromclause(expr); expr->expr = mputstr(expr->expr, ", "); generate_code_expr_senderredirect(expr); + expr->expr = mputstr(expr->expr, ", "); + generate_code_expr_timestamp_redirect(expr); if (port_op.portref) { expr->expr = mputstr(expr->expr, ", "); if (port_op.r.redirect.index != NULL) { @@ -8123,6 +8219,8 @@ error: generate_code_expr_fromclause(expr); expr->expr = mputstr(expr->expr, ", "); generate_code_expr_senderredirect(expr); + expr->expr = mputstr(expr->expr, ", "); + generate_code_expr_timestamp_redirect(expr); if (port_op.portref) { expr->expr = mputstr(expr->expr, ", "); if (port_op.r.redirect.index != NULL) { @@ -8286,6 +8384,18 @@ error: expr->expr = mputc(expr->expr, ')'); } else expr->expr = mputstr(expr->expr, "NULL"); } + + void Statement::generate_code_expr_timestamp_redirect(expression_struct* expr) + { + if (port_op.r.redirect.timestamp != NULL) { + expr->expr = mputstr(expr->expr, "&("); + port_op.r.redirect.timestamp->generate_code(expr); + expr->expr = mputstr(expr->expr, ")"); + } + else { + expr->expr = mputstr(expr->expr, "NULL"); + } + } void Statement::generate_code_portref(expression_struct *expr, Reference *p_ref) diff --git a/compiler2/ttcn3/Statement.hh b/compiler2/ttcn3/Statement.hh index 0cafb8be8..18eaff79b 100644 --- a/compiler2/ttcn3/Statement.hh +++ b/compiler2/ttcn3/Statement.hh @@ -317,6 +317,7 @@ namespace Ttcn { ParamRedirect *param; Reference *sender; Reference* index; + Reference* timestamp; } redirect; union { TemplateInstance *getreply_valuematch; @@ -567,31 +568,33 @@ namespace Ttcn { Statement(statementtype_t p_st, Reference *p_ref, bool p_anyfrom, TemplateInstance *p_templinst, TemplateInstance *p_fromclause, ValueRedirect *p_redirectval, Reference *p_redirectsender, - Reference* p_redirectindex, bool p_translate); + Reference* p_redirectindex, Reference* p_timestamp_redirect, + bool p_translate); /** Constructor used by S_GETCALL and S_CHECK_GETCALL. p_ref==0 * means any port. */ Statement(statementtype_t p_st, Reference *p_ref, bool p_anyfrom, TemplateInstance *p_templinst, TemplateInstance *p_fromclause, ParamRedirect *p_redirectparam, Reference *p_redirectsender, - Reference* p_redirectindex); + Reference* p_redirectindex, Reference* p_timestamp_redirect); /** Constructor used by S_GETREPLY and S_CHECK_GETREPLY. p_ref==0 * means any port. */ Statement(statementtype_t p_st, Reference *p_ref, bool p_anyfrom, TemplateInstance *p_templinst, TemplateInstance *p_valuematch, TemplateInstance *p_fromclause, ValueRedirect *p_redirectval, ParamRedirect *p_redirectparam, - Reference *p_redirectsender, Reference* p_redirectindex); + Reference *p_redirectsender, Reference* p_redirectindex, + Reference* p_timestamp_redirect); /** Constructor used by S_CATCH and S_CHECK_CATCH. p_ref==0 means * any port. */ Statement(statementtype_t p_st, Reference *p_ref, bool p_anyfrom, Reference *p_sig, TemplateInstance *p_templinst, bool p_timeout, TemplateInstance *p_fromclause, ValueRedirect *p_redirectval, Reference *p_redirectsender, - Reference* p_redirectindex); + Reference* p_redirectindex, Reference* p_timestamp_redirect); /** Constructor used by S_CHECK. p_ref==0 means any port. */ Statement(statementtype_t p_st, Reference *p_ref, bool p_anyfrom, TemplateInstance *p_fromclause, Reference *p_redirectsender, - Reference* p_redirectindex); + Reference* p_redirectindex, Reference* p_timestamp_redirect); /** Constructor used by S_CLEAR, S_START_PORT and S_STOP_PORT. * p_ref==0 means all port. S_STOP_TIMER (p_ref==0: all timer). */ Statement(statementtype_t p_st, Reference *p_ref); @@ -781,6 +784,7 @@ namespace Ttcn { /** Checks whether \a p_ref points to a signature. The type * describing the respective signature is returned or NULL in * case of error. */ + void chk_timestamp_redirect(Type* port_type); static Type *chk_signature_ref(Reference *p_ref); /** Checks whether \a p_ref points to a timer, timer parameter or timer array. * If \a p_ref refers to a timer array the array indices within @@ -902,6 +906,7 @@ namespace Ttcn { void generate_code_expr_sendpar(expression_struct *expr); void generate_code_expr_fromclause(expression_struct *expr); void generate_code_expr_senderredirect(expression_struct *expr); + void generate_code_expr_timestamp_redirect(expression_struct* expr); /** Creates the string equivalent of port reference \a p_ref and * appends it to \a expr->expr. Used in configuration operations * when the component type cannot be determined from the diff --git a/compiler2/ttcn3/Ttcnstuff.cc b/compiler2/ttcn3/Ttcnstuff.cc index 1ec5216d9..c82c84071 100644 --- a/compiler2/ttcn3/Ttcnstuff.cc +++ b/compiler2/ttcn3/Ttcnstuff.cc @@ -1034,7 +1034,8 @@ namespace Ttcn { PortTypeBody::PortTypeBody(PortOperationMode_t p_operation_mode, Types *p_in_list, Types *p_out_list, Types *p_inout_list, - bool p_in_all, bool p_out_all, bool p_inout_all, Definitions *defs) + bool p_in_all, bool p_out_all, bool p_inout_all, Definitions *defs, + bool p_realtime) : Node(), Location(), my_type(0), operation_mode(p_operation_mode), in_list(p_in_list), out_list(p_out_list), inout_list(p_inout_list), in_all(p_in_all), out_all(p_out_all), inout_all(p_inout_all), @@ -1042,7 +1043,7 @@ namespace Ttcn { in_msgs(0), out_msgs(0), in_sigs(0), out_sigs(0), testport_type(TP_REGULAR), port_type(PT_REGULAR), provider_refs(), provider_types(), mapper_types(), - in_mappings(0), out_mappings(0), vardefs(defs) + in_mappings(0), out_mappings(0), vardefs(defs), realtime(p_realtime) { } @@ -2121,6 +2122,7 @@ namespace Ttcn { port_def pdef; memset(&pdef, 0, sizeof(pdef)); pdef.legacy = legacy; + pdef.realtime = realtime; const string& t_genname = my_type->get_genname_own(); pdef.name = t_genname.c_str(); pdef.dispname = my_type->get_fullname().c_str(); diff --git a/compiler2/ttcn3/Ttcnstuff.hh b/compiler2/ttcn3/Ttcnstuff.hh index c720b530f..0a5389a3e 100644 --- a/compiler2/ttcn3/Ttcnstuff.hh +++ b/compiler2/ttcn3/Ttcnstuff.hh @@ -406,6 +406,7 @@ private: ///< only for PT_USER && !legacy TypeMappings *in_mappings, *out_mappings; ///< mappings for PT_USER Definitions *vardefs; ///< variable definitions inside the port + bool realtime; /** Copy constructor not implemented */ PortTypeBody(const PortTypeBody& p); /** Assignment disabled */ @@ -413,7 +414,8 @@ private: public: PortTypeBody(PortOperationMode_t p_operation_mode, Types *p_in_list, Types *p_out_list, Types *p_inout_list, - bool p_in_all, bool p_out_all, bool p_inout_all, Definitions *defs); + bool p_in_all, bool p_out_all, bool p_inout_all, Definitions *defs, + bool p_realtime); ~PortTypeBody(); virtual PortTypeBody *clone() const; virtual void set_fullname(const string& p_fullname); @@ -425,6 +427,7 @@ public: TypeSet *get_in_sigs() const; TypeSet *get_out_sigs() const; Definitions *get_vardefs() const; + bool is_realtime() const { return realtime; } bool has_queue() const; bool getreply_allowed() const; bool catch_allowed() const; diff --git a/compiler2/ttcn3/compiler.l b/compiler2/ttcn3/compiler.l index 563588c69..fd70560ff 100644 --- a/compiler2/ttcn3/compiler.l +++ b/compiler2/ttcn3/compiler.l @@ -475,6 +475,7 @@ procedure RETURN(ProcedureKeyword); public RETURN(PublicKeyword); raise RETURN_DOT(RaiseKeyword); read RETURN_DOT(ReadKeyword); +realtime RETURN(RealtimeKeyword); receive RETURN_DOT(ReceiveOpKeyword); record RETURN(RecordKeyword); recursive RETURN(RecursiveKeyword); @@ -501,6 +502,7 @@ system RETURN(SystemKeyword); template RETURN(TemplateKeyword); testcase RETURN(TestcaseKeyword); timeout RETURN_DOT(TimeoutKeyword); +timestamp RETURN(TimestampKeyword); timer RETURN(TimerKeyword); to RETURN(ToKeyword); trigger RETURN_DOT(TriggerOpKeyword); diff --git a/compiler2/ttcn3/compiler.y b/compiler2/ttcn3/compiler.y index 42e566f2e..831953505 100644 --- a/compiler2/ttcn3/compiler.y +++ b/compiler2/ttcn3/compiler.y @@ -362,12 +362,14 @@ static const string anyname("anytype"); ValueRedirect *redirectval; Ttcn::Reference *redirectsender; Ttcn::Reference* redirectindex; + Ttcn::Reference* redirecttimestamp; } portredirect; struct { ParamRedirect *redirectparam; Ttcn::Reference *redirectsender; Ttcn::Reference* redirectindex; + Ttcn::Reference* redirecttimestamp; } portredirectwithparam; struct { @@ -375,6 +377,7 @@ static const string anyname("anytype"); ParamRedirect *redirectparam; Ttcn::Reference *redirectsender; Ttcn::Reference* redirectindex; + Ttcn::Reference* redirecttimestamp; } portredirectwithvalueandparam; struct { @@ -388,6 +391,7 @@ static const string anyname("anytype"); ValueRedirect *redirectval; Ttcn::Reference *redirectsender; Ttcn::Reference* redirectindex; + Ttcn::Reference* redirecttimestamp; } portreceiveop; struct { @@ -396,6 +400,7 @@ static const string anyname("anytype"); ParamRedirect *redirectparam; Ttcn::Reference *redirectsender; Ttcn::Reference* redirectindex; + Ttcn::Reference* redirecttimestamp; } portgetcallop; struct { @@ -406,6 +411,7 @@ static const string anyname("anytype"); ParamRedirect *redirectparam; Ttcn::Reference *redirectsender; Ttcn::Reference* redirectindex; + Ttcn::Reference* redirecttimestamp; } portgetreplyop; struct { @@ -422,6 +428,7 @@ static const string anyname("anytype"); ValueRedirect *redirectval; Ttcn::Reference *redirectsender; Ttcn::Reference* redirectindex; + Ttcn::Reference* redirecttimestamp; } portcatchop; struct { @@ -435,6 +442,7 @@ static const string anyname("anytype"); ParamRedirect *redirectparam; Ttcn::Reference *redirectsender; Ttcn::Reference* redirectindex; + Ttcn::Reference* redirecttimestamp; } portcheckop; struct { @@ -743,6 +751,7 @@ static const string anyname("anytype"); %token PublicKeyword %token RaiseKeyword %token ReadKeyword +%token RealtimeKeyword %token ReceiveOpKeyword %token RecordKeyword %token RecursiveKeyword @@ -769,6 +778,7 @@ static const string anyname("anytype"); %token TemplateKeyword %token TestcaseKeyword %token TimeoutKeyword +%token TimestampKeyword %token TimerKeyword %token ToKeyword %token TriggerOpKeyword @@ -929,7 +939,7 @@ static const string anyname("anytype"); *********************************************************************/ %type <bool_val> optAliveKeyword optOptionalKeyword - optErrValueRaw optAllKeyword optDeterministicModifier + optErrValueRaw optAllKeyword optDeterministicModifier optRealtimeClause %type <str> FreeText optLanguageSpec PatternChunk PatternChunkList %type <uchar_val> Group Plane Row Cell %type <id> FieldIdentifier FieldReference GlobalModuleId @@ -1038,7 +1048,7 @@ static const string anyname("anytype"); %type <reference> PortType optDerivedDef DerivedDef IndexSpec Signature VariableRef TimerRef Port PortOrAll ValueStoreSpec SenderSpec ComponentType optRunsOnSpec RunsOnSpec optSystemSpec optPortSpec - optMtcSpec + optMtcSpec TimestampSpec %type <reference_or_any> PortOrAny TimerRefOrAny %type <valuerange> Range %type <type> NestedEnumDef NestedRecordDef NestedRecordOfDef NestedSetDef @@ -1420,6 +1430,7 @@ TimerOps TimerRef TimerStatements TimerValue +TimestampSpec TriggerStatement Type TypeDef @@ -1638,6 +1649,7 @@ PortRaiseOp delete $$.redirectval; delete $$.redirectsender; delete $$.redirectindex; + delete $$.redirecttimestamp; } optPortRedirect @@ -1645,6 +1657,7 @@ optPortRedirect delete $$.redirectparam; delete $$.redirectsender; delete $$.redirectindex; + delete $$.redirecttimestamp; } optPortRedirectWithParam @@ -1653,6 +1666,7 @@ optPortRedirectWithParam delete $$.redirectparam; delete $$.redirectsender; delete $$.redirectindex; + delete $$.redirecttimestamp; } optPortRedirectWithValueAndParam @@ -1668,6 +1682,7 @@ optGetReplyParameter delete $$.redirectval; delete $$.redirectsender; delete $$.redirectindex; + delete $$.redirecttimestamp; } PortReceiveOp PortTriggerOp @@ -1678,6 +1693,7 @@ PortTriggerOp delete $$.redirectparam; delete $$.redirectsender; delete $$.redirectindex; + delete $$.redirecttimestamp; } PortGetCallOp @@ -1689,6 +1705,7 @@ PortGetCallOp delete $$.redirectparam; delete $$.redirectsender; delete $$.redirectindex; + delete $$.redirecttimestamp; } PortGetReplyOp @@ -1706,6 +1723,7 @@ CatchOpParameter delete $$.redirectval; delete $$.redirectsender; delete $$.redirectindex; + delete $$.redirecttimestamp; } PortCatchOp @@ -1718,6 +1736,7 @@ PortCatchOp delete $$.redirectparam; delete $$.redirectsender; delete $$.redirectindex; + delete $$.redirecttimestamp; } optCheckParameter CheckParameter @@ -2850,38 +2869,44 @@ PortDefBody: // 57 } ; +optRealtimeClause: + /* empty */ { $$ = false; } +| RealtimeKeyword { $$ = true; } +; + PortDefAttribs: // 60 - PortOperationMode PortDefLists + PortOperationMode optRealtimeClause PortDefLists { Definitions * defs = new Definitions(); - for (size_t i = 0; i < $2.varnElements; i++) { - defs->add_ass($2.varElements[i]); + for (size_t i = 0; i < $3.varnElements; i++) { + defs->add_ass($3.varElements[i]); } - Free($2.varElements); + Free($3.varElements); PortTypeBody *body = new PortTypeBody($1, - $2.in_list, $2.out_list, $2.inout_list, - $2.in_all, $2.out_all, $2.inout_all, defs); + $3.in_list, $3.out_list, $3.inout_list, + $3.in_all, $3.out_all, $3.inout_all, defs, $2); body->set_location(infile, @$); $$ = new Type(Type::T_PORT, body); $$->set_location(infile, @$); - delete $2.in_mappings; - delete $2.out_mappings; + delete $3.in_mappings; + delete $3.out_mappings; } | - PortOperationMode MapKeyword ToKeyword PortTypeList PortDefLists + PortOperationMode optRealtimeClause MapKeyword ToKeyword PortTypeList + PortDefLists { Definitions * defs = new Definitions(); - for (size_t i = 0; i < $5.varnElements; i++) { - defs->add_ass($5.varElements[i]); + for (size_t i = 0; i < $6.varnElements; i++) { + defs->add_ass($6.varElements[i]); } - Free($5.varElements); + Free($6.varElements); PortTypeBody *body = new PortTypeBody($1, - $5.in_list, $5.out_list, $5.inout_list, - $5.in_all, $5.out_all, $5.inout_all, defs); + $6.in_list, $6.out_list, $6.inout_list, + $6.in_all, $6.out_all, $6.inout_all, defs, $2); body->set_location(infile, @$); $$ = new Type(Type::T_PORT, body); - body->add_user_attribute($4.elements, $4.nElements, $5.in_mappings, $5.out_mappings, false); - delete $4.elements; + body->add_user_attribute($5.elements, $5.nElements, $6.in_mappings, $6.out_mappings, false); + delete $5.elements; $$->set_location(infile, @$); } ; @@ -6575,14 +6600,16 @@ ReceiveStatement: // 380 { $$ = new Statement(Statement::S_RECEIVE, $1.reference, $1.any_from, $3.templ_inst, $3.fromclause, $3.redirectval, - $3.redirectsender, $3.redirectindex, false); + $3.redirectsender, $3.redirectindex, + $3.redirecttimestamp, false); $$->set_location(infile, @$); } | PortKeyword DotReceiveOpKeyword PortReceiveOp { $$ = new Statement(Statement::S_RECEIVE, NULL, false, $3.templ_inst, $3.fromclause, $3.redirectval, - $3.redirectsender, $3.redirectindex, true); + $3.redirectsender, $3.redirectindex, + $3.redirecttimestamp, true); $$->set_location(infile, @$); } ; @@ -6601,6 +6628,7 @@ PortReceiveOp: // 382 $$.redirectval = $3.redirectval; $$.redirectsender = $3.redirectsender; $$.redirectindex = $3.redirectindex; + $$.redirecttimestamp = $3.redirecttimestamp; } ; @@ -6636,54 +6664,119 @@ optPortRedirect: // [387] $$.redirectval=0; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ValueSpec { $$.redirectval=$2; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol SenderSpec { $$.redirectval=0; $$.redirectsender=$2; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol IndexSpec { $$.redirectval=0; $$.redirectsender=0; $$.redirectindex=$2; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol TimestampSpec + { + $$.redirectval=0; + $$.redirectsender=0; + $$.redirectindex=0; + $$.redirecttimestamp=$2; } | PortRedirectSymbol ValueSpec SenderSpec { $$.redirectval=$2; $$.redirectsender=$3; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ValueSpec IndexSpec { $$.redirectval=$2; $$.redirectsender=0; $$.redirectindex=$3; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ValueSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectsender=0; + $$.redirectindex=0; + $$.redirecttimestamp=$3; } | PortRedirectSymbol SenderSpec IndexSpec { $$.redirectval=0; $$.redirectsender=$2; $$.redirectindex=$3; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol SenderSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectsender=$2; + $$.redirectindex=0; + $$.redirecttimestamp=$3; + } +| PortRedirectSymbol IndexSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectsender=0; + $$.redirectindex=$2; + $$.redirecttimestamp=$3; } | PortRedirectSymbol ValueSpec SenderSpec IndexSpec { $$.redirectval=$2; $$.redirectsender=$3; $$.redirectindex=$4; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ValueSpec SenderSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectsender=$3; + $$.redirectindex=0; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol ValueSpec IndexSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectsender=0; + $$.redirectindex=$3; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol SenderSpec IndexSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectsender=$2; + $$.redirectindex=$3; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol ValueSpec SenderSpec IndexSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectsender=$3; + $$.redirectindex=$4; + $$.redirecttimestamp=$5; } | PortRedirectSymbol error { $$.redirectval=0; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } ; @@ -6759,12 +6852,18 @@ IndexSpec: IndexKeyword ValueStoreSpec { $$ = $2; } ; +TimestampSpec: + TimestampKeyword VariableRef { $$ = $2; } +| TimestampKeyword error { $$ = 0; } +; + TriggerStatement: // 393 PortOrAny DotTriggerOpKeyword PortTriggerOp { $$ = new Statement(Statement::S_TRIGGER, $1.reference, $1.any_from, $3.templ_inst, $3.fromclause, $3.redirectval, - $3.redirectsender, $3.redirectindex, false); + $3.redirectsender, $3.redirectindex, + $3.redirecttimestamp, false); $$->set_location(infile, @$); } ; @@ -6777,6 +6876,7 @@ PortTriggerOp: // 394 $$.redirectval = $3.redirectval; $$.redirectsender = $3.redirectsender; $$.redirectindex = $3.redirectindex; + $$.redirecttimestamp = $3.redirecttimestamp; } ; @@ -6785,7 +6885,7 @@ GetCallStatement: // 396 { $$ = new Statement(Statement::S_GETCALL, $1.reference, $1.any_from, $3.templ_inst, $3.fromclause, $3.redirectparam, - $3.redirectsender, $3.redirectindex); + $3.redirectsender, $3.redirectindex, $3.redirecttimestamp); $$->set_location(infile, @$); } ; @@ -6798,6 +6898,7 @@ PortGetCallOp: // 397 $$.redirectparam = $3.redirectparam; $$.redirectsender = $3.redirectsender; $$.redirectindex = $3.redirectindex; + $$.redirecttimestamp = $3.redirecttimestamp; } ; @@ -6807,54 +6908,120 @@ optPortRedirectWithParam: // [399] $$.redirectparam=0; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ParamSpec { $$.redirectparam=$2; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol SenderSpec { $$.redirectparam=0; $$.redirectsender=$2; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol IndexSpec { $$.redirectparam=0; $$.redirectsender=0; $$.redirectindex=$2; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol TimestampSpec + { + $$.redirectparam=0; + $$.redirectsender=0; + $$.redirectindex=0; + $$.redirecttimestamp=$2; } | PortRedirectSymbol ParamSpec SenderSpec { $$.redirectparam=$2; $$.redirectsender=$3; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ParamSpec IndexSpec { $$.redirectparam=$2; $$.redirectsender=0; $$.redirectindex=$3; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ParamSpec TimestampSpec + { + $$.redirectparam=$2; + $$.redirectsender=0; + $$.redirectindex=0; + $$.redirecttimestamp=$3; } | PortRedirectSymbol SenderSpec IndexSpec { $$.redirectparam=0; $$.redirectsender=$2; $$.redirectindex=$3; + $$.redirecttimestamp=0; + } + +| PortRedirectSymbol SenderSpec TimestampSpec + { + $$.redirectparam=0; + $$.redirectsender=$2; + $$.redirectindex=0; + $$.redirecttimestamp=$3; + } +| PortRedirectSymbol IndexSpec TimestampSpec + { + $$.redirectparam=0; + $$.redirectsender=0; + $$.redirectindex=$2; + $$.redirecttimestamp=$3; } | PortRedirectSymbol ParamSpec SenderSpec IndexSpec { $$.redirectparam=$2; $$.redirectsender=$3; $$.redirectindex=$4; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ParamSpec SenderSpec TimestampSpec + { + $$.redirectparam=$2; + $$.redirectsender=$3; + $$.redirectindex=0; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol ParamSpec IndexSpec TimestampSpec + { + $$.redirectparam=$2; + $$.redirectsender=0; + $$.redirectindex=$3; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol SenderSpec IndexSpec TimestampSpec + { + $$.redirectparam=0; + $$.redirectsender=$2; + $$.redirectindex=$3; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol ParamSpec SenderSpec IndexSpec TimestampSpec + { + $$.redirectparam=$2; + $$.redirectsender=$3; + $$.redirectindex=$4; + $$.redirecttimestamp=$5; } | PortRedirectSymbol error { $$.redirectparam=0; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } ; @@ -6964,7 +7131,7 @@ GetReplyStatement: // 409 $$ = new Statement(Statement::S_GETREPLY, $1.reference, $1.any_from, $3.templ_inst, $3.valuematch, $3.fromclause, $3.redirectval, $3.redirectparam, $3.redirectsender, - $3.redirectindex); + $3.redirectindex, $3.redirecttimestamp); $$->set_location(infile, @$); } ; @@ -6979,6 +7146,7 @@ PortGetReplyOp: // 410 $$.redirectparam = $3.redirectparam; $$.redirectsender = $3.redirectsender; $$.redirectindex = $3.redirectindex; + $$.redirecttimestamp = $3.redirecttimestamp; } ; @@ -6989,6 +7157,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ValueSpec { @@ -6996,6 +7165,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ParamSpec { @@ -7003,6 +7173,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=$2; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol SenderSpec { @@ -7010,6 +7181,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=$2; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol IndexSpec { @@ -7017,6 +7189,15 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=0; $$.redirectindex=$2; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol TimestampSpec + { + $$.redirectval=0; + $$.redirectparam=0; + $$.redirectsender=0; + $$.redirectindex=0; + $$.redirecttimestamp=$2; } | PortRedirectSymbol ValueSpec ParamSpec { @@ -7024,6 +7205,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=$3; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ValueSpec SenderSpec { @@ -7031,6 +7213,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=$3; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ValueSpec IndexSpec { @@ -7038,6 +7221,15 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=0; $$.redirectindex=$3; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ValueSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectparam=0; + $$.redirectsender=0; + $$.redirectindex=0; + $$.redirecttimestamp=$3; } | PortRedirectSymbol ParamSpec SenderSpec { @@ -7045,6 +7237,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=$2; $$.redirectsender=$3; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ParamSpec IndexSpec { @@ -7052,6 +7245,15 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=$2; $$.redirectsender=0; $$.redirectindex=$3; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ParamSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectparam=$2; + $$.redirectsender=0; + $$.redirectindex=0; + $$.redirecttimestamp=$3; } | PortRedirectSymbol SenderSpec IndexSpec { @@ -7059,6 +7261,23 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=$2; $$.redirectindex=$3; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol SenderSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectparam=0; + $$.redirectsender=$2; + $$.redirectindex=0; + $$.redirecttimestamp=$3; + } +| PortRedirectSymbol IndexSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectparam=0; + $$.redirectsender=0; + $$.redirectindex=$2; + $$.redirecttimestamp=$3; } | PortRedirectSymbol ValueSpec ParamSpec SenderSpec { @@ -7066,6 +7285,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=$3; $$.redirectsender=$4; $$.redirectindex=0; + $$.redirecttimestamp=0; } | PortRedirectSymbol ValueSpec ParamSpec IndexSpec { @@ -7073,6 +7293,15 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=$3; $$.redirectsender=0; $$.redirectindex=$4; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ValueSpec ParamSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectparam=$3; + $$.redirectsender=0; + $$.redirectindex=0; + $$.redirecttimestamp=$4; } | PortRedirectSymbol ValueSpec SenderSpec IndexSpec { @@ -7080,6 +7309,23 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=$3; $$.redirectindex=$4; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ValueSpec SenderSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectparam=0; + $$.redirectsender=$3; + $$.redirectindex=0; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol ValueSpec IndexSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectparam=0; + $$.redirectsender=0; + $$.redirectindex=$3; + $$.redirecttimestamp=$4; } | PortRedirectSymbol ParamSpec SenderSpec IndexSpec { @@ -7087,6 +7333,31 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=$2; $$.redirectsender=$3; $$.redirectindex=$4; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ParamSpec SenderSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectparam=$2; + $$.redirectsender=$3; + $$.redirectindex=0; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol ParamSpec IndexSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectparam=$2; + $$.redirectsender=0; + $$.redirectindex=$3; + $$.redirecttimestamp=$4; + } +| PortRedirectSymbol SenderSpec IndexSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectparam=0; + $$.redirectsender=$2; + $$.redirectindex=$3; + $$.redirecttimestamp=$4; } | PortRedirectSymbol ValueSpec ParamSpec SenderSpec IndexSpec { @@ -7094,6 +7365,47 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=$3; $$.redirectsender=$4; $$.redirectindex=$5; + $$.redirecttimestamp=0; + } +| PortRedirectSymbol ValueSpec ParamSpec SenderSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectparam=$3; + $$.redirectsender=$4; + $$.redirectindex=0; + $$.redirecttimestamp=$5; + } +| PortRedirectSymbol ValueSpec ParamSpec IndexSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectparam=$3; + $$.redirectsender=0; + $$.redirectindex=$4; + $$.redirecttimestamp=$5; + } +| PortRedirectSymbol ValueSpec SenderSpec IndexSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectparam=0; + $$.redirectsender=$3; + $$.redirectindex=$4; + $$.redirecttimestamp=$5; + } +| PortRedirectSymbol ParamSpec SenderSpec IndexSpec TimestampSpec + { + $$.redirectval=0; + $$.redirectparam=$2; + $$.redirectsender=$3; + $$.redirectindex=$4; + $$.redirecttimestamp=$5; + } +| PortRedirectSymbol ValueSpec ParamSpec SenderSpec IndexSpec TimestampSpec + { + $$.redirectval=$2; + $$.redirectparam=$3; + $$.redirectsender=$4; + $$.redirectindex=$5; + $$.redirecttimestamp=$6; } | PortRedirectSymbol error { @@ -7101,6 +7413,7 @@ optPortRedirectWithValueAndParam: // [411] $$.redirectparam=0; $$.redirectsender=0; $$.redirectindex=0; + $$.redirecttimestamp=0; } ; @@ -7141,28 +7454,32 @@ CheckStatement: // 415 switch ($3.statementtype) { case Statement::S_CHECK: $$ = new Statement(Statement::S_CHECK, $1.reference, $1.any_from, - $3.templ_inst, $3.redirectsender, $3.redirectindex); + $3.templ_inst, $3.redirectsender, $3.redirectindex, + $3.redirecttimestamp); break; case Statement::S_CHECK_RECEIVE: $$ = new Statement(Statement::S_CHECK_RECEIVE, $1.reference, $1.any_from, $3.templ_inst, $3.fromclause, $3.redirectval, - $3.redirectsender, $3.redirectindex, false); + $3.redirectsender, $3.redirectindex, + $3.redirecttimestamp, false); break; case Statement::S_CHECK_GETCALL: $$ = new Statement(Statement::S_CHECK_GETCALL, $1.reference, $1.any_from, $3.templ_inst, $3.fromclause, $3.redirectparam, - $3.redirectsender, $3.redirectindex); + $3.redirectsender, $3.redirectindex, + $3.redirecttimestamp); break; case Statement::S_CHECK_GETREPLY: $$ = new Statement(Statement::S_CHECK_GETREPLY, $1.reference, $1.any_from, $3.templ_inst, $3.valuematch, $3.fromclause, $3.redirectval, $3.redirectparam, $3.redirectsender, - $3.redirectindex); + $3.redirectindex, $3.redirecttimestamp); break; case Statement::S_CHECK_CATCH: $$ = new Statement(Statement::S_CHECK_CATCH, $1.reference, $1.any_from, $3.signature, $3.templ_inst, $3.timeout, $3.fromclause, - $3.redirectval, $3.redirectsender, $3.redirectindex); + $3.redirectval, $3.redirectsender, $3.redirectindex, + $3.redirecttimestamp); break; default: FATAL_ERROR("Internal error."); @@ -7184,6 +7501,7 @@ optCheckParameter: // [418] $$.redirectparam = 0; $$.redirectsender = 0; $$.redirectindex = 0; + $$.redirecttimestamp = 0; } | '(' CheckParameter optError ')' { $$ = $2; } | '(' error ')' @@ -7198,6 +7516,7 @@ optCheckParameter: // [418] $$.redirectparam = 0; $$.redirectsender = 0; $$.redirectindex = 0; + $$.redirecttimestamp = 0; } ; @@ -7220,6 +7539,7 @@ FromClausePresent: // 419 $$.redirectparam = 0; $$.redirectsender = 0; $$.redirectindex = 0; + $$.redirecttimestamp = 0; } | FromClause PortRedirectSymbol IndexSpec { @@ -7233,6 +7553,7 @@ FromClausePresent: // 419 $$.redirectparam = 0; $$.redirectsender = 0; $$.redirectindex = $3; + $$.redirecttimestamp = 0; } | FromClause PortRedirectSymbol SenderSpec { @@ -7246,6 +7567,21 @@ FromClausePresent: // 419 $$.redirectparam = 0; $$.redirectsender = $3; $$.redirectindex = 0; + $$.redirecttimestamp = 0; + } +| FromClause PortRedirectSymbol TimestampSpec + { + $$.statementtype = Statement::S_CHECK; + $$.signature = 0; + $$.templ_inst = $1; + $$.valuematch = 0; + $$.timeout = false; + $$.fromclause = 0; + $$.redirectval = 0; + $$.redirectparam = 0; + $$.redirectsender = 0; + $$.redirectindex = 0; + $$.redirecttimestamp = $3; } | FromClause PortRedirectSymbol SenderSpec IndexSpec { @@ -7259,6 +7595,49 @@ FromClausePresent: // 419 $$.redirectparam = 0; $$.redirectsender = $3; $$.redirectindex = $4; + $$.redirecttimestamp = 0; + } +| FromClause PortRedirectSymbol SenderSpec TimestampSpec + { + $$.statementtype = Statement::S_CHECK; + $$.signature = 0; + $$.templ_inst = $1; + $$.valuematch = 0; + $$.timeout = false; + $$.fromclause = 0; + $$.redirectval = 0; + $$.redirectparam = 0; + $$.redirectsender = $3; + $$.redirectindex = 0; + $$.redirecttimestamp = $4; + } +| FromClause PortRedirectSymbol IndexSpec TimestampSpec + { + $$.statementtype = Statement::S_CHECK; + $$.signature = 0; + $$.templ_inst = $1; + $$.valuematch = 0; + $$.timeout = false; + $$.fromclause = 0; + $$.redirectval = 0; + $$.redirectparam = 0; + $$.redirectsender = 0; + $$.redirectindex = $3; + $$.redirecttimestamp = $4; + } +| FromClause PortRedirectSymbol SenderSpec IndexSpec TimestampSpec + { + $$.statementtype = Statement::S_CHECK; + $$.signature = 0; + $$.templ_inst = $1; + $$.valuematch = 0; + $$.timeout = false; + $$.fromclause = 0; + $$.redirectval = 0; + $$.redirectparam = 0; + $$.redirectsender = $3; + $$.redirectindex = $4; + $$.redirecttimestamp = $5; } ; @@ -7275,6 +7654,7 @@ RedirectPresent: // 420 $$.redirectparam = 0; $$.redirectsender = $2; $$.redirectindex = 0; + $$.redirecttimestamp = 0; } | PortRedirectSymbol IndexSpec { @@ -7288,6 +7668,21 @@ RedirectPresent: // 420 $$.redirectparam = 0; $$.redirectsender = 0; $$.redirectindex = $2; + $$.redirecttimestamp = 0; + } +| PortRedirectSymbol TimestampSpec + { + $$.statementtype = Statement::S_CHECK; + $$.signature = 0; + $$.templ_inst = 0; + $$.valuematch = 0; + $$.timeout = false; + $$.fromclause = 0; + $$.redirectval = 0; + $$.redirectparam = 0; + $$.redirectsender = 0; + $$.redirectindex = 0; + $$.redirecttimestamp = $2; } | PortRedirectSymbol SenderSpec IndexSpec { @@ -7301,6 +7696,49 @@ RedirectPresent: // 420 $$.redirectparam = 0; $$.redirectsender = $2; $$.redirectindex = $3; + $$.redirecttimestamp = 0; + } +| PortRedirectSymbol SenderSpec TimestampSpec + { + $$.statementtype = Statement::S_CHECK; + $$.signature = 0; + $$.templ_inst = 0; + $$.valuematch = 0; + $$.timeout = false; + $$.fromclause = 0; + $$.redirectval = 0; + $$.redirectparam = 0; + $$.redirectsender = $2; + $$.redirectindex = 0; + $$.redirecttimestamp = $3; + } +| PortRedirectSymbol IndexSpec TimestampSpec + { + $$.statementtype = Statement::S_CHECK; + $$.signature = 0; + $$.templ_inst = 0; + $$.valuematch = 0; + $$.timeout = false; + $$.fromclause = 0; + $$.redirectval = 0; + $$.redirectparam = 0; + $$.redirectsender = 0; + $$.redirectindex = $2; + $$.redirecttimestamp = $3; + } +| PortRedirectSymbol SenderSpec IndexSpec TimestampSpec + { + $$.statementtype = Statement::S_CHECK; + $$.signature = 0; + $$.templ_inst = 0; + $$.valuematch = 0; + $$.timeout = false; + $$.fromclause = 0; + $$.redirectval = 0; + $$.redirectparam = 0; + $$.redirectsender = $2; + $$.redirectindex = $3; + $$.redirecttimestamp = $4; } ; @@ -7317,6 +7755,7 @@ CheckPortOpsPresent: // 421 $$.redirectparam = 0; $$.redirectsender = $2.redirectsender; $$.redirectindex = $2.redirectindex; + $$.redirecttimestamp = $2.redirecttimestamp; } | GetCallOpKeyword PortGetCallOp { @@ -7330,6 +7769,7 @@ CheckPortOpsPresent: // 421 $$.redirectparam = $2.redirectparam; $$.redirectsender = $2.redirectsender; $$.redirectindex = $2.redirectindex; + $$.redirecttimestamp = $2.redirecttimestamp; } | GetReplyOpKeyword PortGetReplyOp { @@ -7343,6 +7783,7 @@ CheckPortOpsPresent: // 421 $$.redirectparam = $2.redirectparam; $$.redirectsender = $2.redirectsender; $$.redirectindex = $2.redirectindex; + $$.redirecttimestamp = $2.redirecttimestamp; } | CatchOpKeyword PortCatchOp { @@ -7356,6 +7797,7 @@ CheckPortOpsPresent: // 421 $$.redirectparam = 0; $$.redirectsender = $2.redirectsender; $$.redirectindex = $2.redirectindex; + $$.redirecttimestamp = $2.redirecttimestamp; } ; @@ -7364,7 +7806,8 @@ CatchStatement: // 422 { $$ = new Statement(Statement::S_CATCH, $1.reference, $1.any_from, $3.signature, $3.templ_inst, $3.timeout, $3.fromclause, - $3.redirectval, $3.redirectsender, $3.redirectindex); + $3.redirectval, $3.redirectsender, $3.redirectindex, + $3.redirecttimestamp); $$->set_location(infile, @$); } ; @@ -7379,6 +7822,7 @@ PortCatchOp: // 423 $$.redirectval = $3.redirectval; $$.redirectsender = $3.redirectsender; $$.redirectindex = $3.redirectindex; + $$.redirecttimestamp = $3.redirecttimestamp; } ; diff --git a/compiler2/ttcn3/port.c b/compiler2/ttcn3/port.c index 5808c9f2c..80f17ff24 100644 --- a/compiler2/ttcn3/port.c +++ b/compiler2/ttcn3/port.c @@ -495,10 +495,12 @@ static void generate_generic_receive(char **def_ptr, char **src_ptr, } def = mputprintf(def, "alt_status %s(const %s_template& " - "sender_template, %s *sender_ptr, Index_Redirect*);\n", function_name, + "sender_template, %s *sender_ptr, FLOAT* timestamp_redirect, " + "Index_Redirect*);\n", function_name, sender_type, sender_type); src = mputprintf(src, "alt_status %s::%s(const %s_template& " - "sender_template, %s *sender_ptr, Index_Redirect*)\n" + "sender_template, %s *sender_ptr, FLOAT* timestamp_redirect, " + "Index_Redirect*)\n" "{\n" "msg_queue_item *my_head = (msg_queue_item*)msg_queue_head;\n" "if (msg_queue_head == NULL) {\n" @@ -558,10 +560,16 @@ static void generate_generic_receive(char **def_ptr, char **src_ptr, } if (is_trigger) src = mputstr(src, "remove_msg_queue_head();\n"); src = mputprintf(src, "return %s;\n" - "} else {\n" + "} else {\n", failed_status); + if (pdef->realtime) { + src = mputstr(src, + "if (timestamp_redirect != NULL && my_head->timestamp.is_bound()) {\n" + "*timestamp_redirect = my_head->timestamp;\n" + "}\n"); + } + src = mputprintf(src, "if (sender_ptr != NULL) *sender_ptr = %smy_head->%s;\n", - failed_status, is_address ? "*" : "", - is_address ? "sender_address" : "sender_component"); + is_address ? "*" : "", is_address ? "sender_address" : "sender_component"); if (is_address) { src = mputprintf(src, "TTCN_Logger::log(TTCN_Logger::MATCHING_MMSUCCESS" @@ -644,13 +652,15 @@ static void generate_receive(char **def_ptr, char **src_ptr, def = mputprintf(def, "alt_status %s(const %s_template& value_template, " "%s *value_redirect, const %s_template& sender_template, %s " - "*sender_ptr, Index_Redirect*);\n", function_name, message_type->name, + "*sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*);\n", + function_name, message_type->name, use_runtime_2 ? "Value_Redirect_Interface" : message_type->name, sender_type, sender_type); src = mputprintf(src, "alt_status %s::%s(const %s_template& " "value_template, %s *value_redirect, const %s_template& " - "sender_template, %s *sender_ptr, Index_Redirect*)\n" + "sender_template, %s *sender_ptr, FLOAT* timestamp_redirect, " + "Index_Redirect*)\n" "{\n" "if (value_template.get_selection() == ANY_OR_OMIT) " "TTCN_error(\"%s operation using '*' as matching template\");\n" @@ -750,8 +760,14 @@ static void generate_receive(char **def_ptr, char **src_ptr, src = mputprintf(src, "*value_redirect = *my_head->message_%lu;\n", (unsigned long) message_index); } + src = mputstr(src, "}\n"); + if (pdef->realtime) { + src = mputstr(src, + "if (timestamp_redirect != NULL && my_head->timestamp.is_bound()) {\n" + "*timestamp_redirect = my_head->timestamp;\n" + "}\n"); + } src = mputprintf(src, - "}\n" "if (sender_ptr != NULL) *sender_ptr = %smy_head->%s;\n", is_address ? "*" : "", is_address ? "sender_address" : "sender_component"); @@ -860,10 +876,11 @@ static void generate_generic_getop(getop_t getop, } def = mputprintf(def, "alt_status %s(const %s_template& " - "sender_template, %s *sender_ptr, Index_Redirect*);\n", function_name, sender_type, - sender_type); + "sender_template, %s *sender_ptr, FLOAT* timestamp_redirect, " + "Index_Redirect*);\n", function_name, sender_type, sender_type); src = mputprintf(src, "alt_status %s::%s(const %s_template& " - "sender_template, %s *sender_ptr, Index_Redirect*)\n" + "sender_template, %s *sender_ptr, FLOAT* timestamp_redirect, " + "Index_Redirect*)\n" "{\n" "if (proc_queue_head == NULL) {\n" "if (is_started) return ALT_MAYBE;\n" @@ -933,8 +950,14 @@ static void generate_generic_getop(getop_t getop, (unsigned long) i); } } - src = mputstr(src, "{\n" - "if (sender_ptr != NULL) *sender_ptr = "); + src = mputstr(src, "{\n"); + if (pdef->realtime) { + src = mputstr(src, + "if (timestamp_redirect != NULL && proc_queue_head->timestamp.is_bound()) {\n" + "*timestamp_redirect = proc_queue_head->timestamp;\n" + "}\n"); + } + src = mputstr(src, "if (sender_ptr != NULL) *sender_ptr = "); if (is_address) src = mputstr(src, "*proc_queue_head->sender_address;\n"); else src = mputstr(src, "proc_queue_head->sender_component;\n"); @@ -1058,13 +1081,15 @@ static void generate_getcall(char **def_ptr, char **src_ptr, def = mputprintf(def, "alt_status %s(const %s_template& " "getcall_template, const %s_template& sender_template, " - "const %s_call_redirect& param_ref, %s *sender_ptr, Index_Redirect*);\n", + "const %s_call_redirect& param_ref, %s *sender_ptr, " + "FLOAT* timestamp_redirect, Index_Redirect*);\n", function_name, signature->name, sender_type, signature->name, sender_type); src = mputprintf(src, "alt_status %s::%s(const %s_template& " "getcall_template, const %s_template& sender_template, " - "const %s_call_redirect& param_ref, %s *sender_ptr, Index_Redirect*)\n" + "const %s_call_redirect& param_ref, %s *sender_ptr, " + "FLOAT* timestamp_redirect, Index_Redirect*)\n" "{\n" "if (proc_queue_head == NULL) {\n" "if (is_started) return ALT_MAYBE;\n" @@ -1143,8 +1168,7 @@ static void generate_getcall(char **def_ptr, char **src_ptr, "}\n" "return ALT_NO;\n" "} else {\n" - "param_ref.set_parameters(*proc_queue_head->call_%lu);\n" - "if (sender_ptr != NULL) *sender_ptr = ", + "param_ref.set_parameters(*proc_queue_head->call_%lu);\n", (is_address ? "TTCN_Logger::MATCHING_PMUNSUCC" : "proc_queue_head->sender_component==SYSTEM_COMPREF ? " @@ -1152,6 +1176,13 @@ static void generate_getcall(char **def_ptr, char **src_ptr, (unsigned long) signature_index, (omit_in_value_list ? ", TRUE" : ""), (unsigned long) signature_index); + if (pdef->realtime) { + src = mputstr(src, + "if (timestamp_redirect != NULL && proc_queue_head->timestamp.is_bound()) {\n" + "*timestamp_redirect = proc_queue_head->timestamp;\n" + "}\n"); + } + src = mputstr(src, "if (sender_ptr != NULL) *sender_ptr = "); if (is_address) src = mputstr(src, "*proc_queue_head->sender_address;\n"); else src = mputstr(src, "proc_queue_head->sender_component;\n"); @@ -1181,13 +1212,15 @@ static void generate_getreply(char **def_ptr, char **src_ptr, def = mputprintf(def, "alt_status %s(const %s_template& " "getreply_template, const %s_template& sender_template, " - "const %s_reply_redirect& param_ref, %s *sender_ptr, Index_Redirect*);\n", + "const %s_reply_redirect& param_ref, %s *sender_ptr, " + "FLOAT* timestamp_redirect, Index_Redirect*);\n", function_name, signature->name, sender_type, signature->name, sender_type); src = mputprintf(src, "alt_status %s::%s(const %s_template& " "getreply_template, const %s_template& sender_template, " - "const %s_reply_redirect& param_ref, %s *sender_ptr, Index_Redirect*)\n" + "const %s_reply_redirect& param_ref, %s *sender_ptr, " + "FLOAT* timestamp_redirect, Index_Redirect*)\n" "{\n", class_name, function_name, signature->name, sender_type, signature->name, sender_type); if (signature->has_return_value) { @@ -1272,8 +1305,7 @@ static void generate_getreply(char **def_ptr, char **src_ptr, "}\n" "return ALT_NO;\n" "} else {\n" - "param_ref.set_parameters(*proc_queue_head->reply_%lu);\n" - "if (sender_ptr != NULL) *sender_ptr = ", + "param_ref.set_parameters(*proc_queue_head->reply_%lu);\n", (is_address ? "TTCN_Logger::MATCHING_PMUNSUCC" : "proc_queue_head->sender_component==SYSTEM_COMPREF ? " @@ -1281,6 +1313,13 @@ static void generate_getreply(char **def_ptr, char **src_ptr, (unsigned long) signature_index, (omit_in_value_list ? ", TRUE" : ""), (unsigned long) signature_index); + if (pdef->realtime) { + src = mputstr(src, + "if (timestamp_redirect != NULL && proc_queue_head->timestamp.is_bound()) {\n" + "*timestamp_redirect = proc_queue_head->timestamp;\n" + "}\n"); + } + src = mputstr(src, "if (sender_ptr != NULL) *sender_ptr = "); if (is_address) src = mputstr(src, "*proc_queue_head->sender_address;\n"); else src = mputstr(src, "proc_queue_head->sender_component;\n"); @@ -1310,12 +1349,12 @@ static void generate_catch(char **def_ptr, char **src_ptr, def = mputprintf(def, "alt_status %s(const %s_exception_template& " "catch_template, const %s_template& sender_template, " - "%s *sender_ptr, Index_Redirect*);\n", + "%s *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*);\n", function_name, signature->name, sender_type, sender_type); src = mputprintf(src, "alt_status %s::%s(const %s_exception_template& " "catch_template, const %s_template& sender_template, " - "%s *sender_ptr, Index_Redirect*)\n" + "%s *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*)\n" "{\n" "if (catch_template.is_any_or_omit()) TTCN_error(\"%s operation using '*' " "as matching template\");\n" @@ -1403,12 +1442,18 @@ static void generate_catch(char **def_ptr, char **src_ptr, "}\n" "return ALT_NO;\n" "} else {\n" - "catch_template.set_value(*proc_queue_head->exception_%lu);\n" - "if (sender_ptr != NULL) *sender_ptr = ", + "catch_template.set_value(*proc_queue_head->exception_%lu);\n", (is_address ? "TTCN_Logger::MATCHING_PMUNSUCC" : "log_sev"), (unsigned long) signature_index, (omit_in_value_list ? ", TRUE" : ""), (unsigned long) signature_index); + if (pdef->realtime) { + src = mputstr(src, + "if (timestamp_redirect != NULL && proc_queue_head->timestamp.is_bound()) {\n" + "*timestamp_redirect = proc_queue_head->timestamp;\n" + "}\n"); + } + src = mputstr(src, "if (sender_ptr != NULL) *sender_ptr = "); if (is_address) src = mputstr(src, "*proc_queue_head->sender_address;\n"); else src = mputstr(src, "proc_queue_head->sender_component;\n"); @@ -1516,6 +1561,9 @@ void defPortClass(const port_def* pdef, output_struct* output) if (pdef->testport_type == ADDRESS) { def = mputprintf(def, "%s *sender_address;\n", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, "FLOAT timestamp;\n"); + } def = mputstr(def, "};\n\n"); if (pdef->has_sliding) { def = mputprintf(def, "OCTETSTRING sliding_buffer;\n"); @@ -1595,6 +1643,9 @@ void defPortClass(const port_def* pdef, output_struct* output) if (pdef->testport_type == ADDRESS) { def = mputprintf(def, "%s *sender_address;\n", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, "FLOAT timestamp;\n"); + } def = mputstr(def, "proc_queue_item *next_item;\n" "} *proc_queue_head, *proc_queue_tail;\n"); @@ -2671,6 +2722,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_message(const %s& " @@ -2681,6 +2735,9 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputstr(src, ")\n" "{\n" "if (!is_started) TTCN_error(\"Port %s is not started but a " @@ -2731,10 +2788,13 @@ void defPortClass(const port_def* pdef, output_struct* output) "msg_queue_item *new_item = new msg_queue_item;\n" "new_item->item_selection = MESSAGE_%lu;\n" "new_item->message_%lu = new %s(incoming_par);\n" - "new_item->sender_component = sender_component;\n", + "new_item->sender_component = sender_component;\n" + "%s", (unsigned long) mapped_type->targets[0].target_index, (unsigned long) mapped_type->targets[0].target_index, - mapped_type->name); + mapped_type->name, + pdef->realtime ? "if (timestamp.is_bound()) " + "new_item->timestamp = timestamp;\n" : ""); if (pdef->testport_type == ADDRESS) { src = mputprintf(src, "if (sender_address != NULL) " "new_item->sender_address = new %s(*sender_address);\n" @@ -2758,6 +2818,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_message(const %s& " @@ -2767,6 +2830,9 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputstr(src, ")\n{\n"); if (pdef->port_type == PROVIDER && pdef->n_mapper_name > 0) { // We forward the incoming_message to the mapped port @@ -2774,10 +2840,10 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, "for (size_t i = 0; i < n_%i; i++) {\n" "if (p_%i[i] != NULL) {\n" - "p_%i[i]->incoming_message(incoming_par, sender_component);\n" + "p_%i[i]->incoming_message(incoming_par, sender_component%s);\n" "return;\n}" "}\n", - (int)j, (int)j, (int)j); + (int)j, (int)j, (int)j, pdef->realtime ? ", timestamp" : ""); } } src = mputstr(src, @@ -2810,10 +2876,13 @@ void defPortClass(const port_def* pdef, output_struct* output) "msg_queue_item *new_item = new msg_queue_item;\n" "new_item->item_selection = MESSAGE_%lu;\n" "new_item->message_%lu = new %s(incoming_par);\n" - "new_item->sender_component = sender_component;\n", + "new_item->sender_component = sender_component;\n" + "%s", pdef->msg_in.elements[i].dispname, (unsigned long) i, (unsigned long) i, - pdef->msg_in.elements[i].name); + pdef->msg_in.elements[i].name, + pdef->realtime ? "if (timestamp.is_bound()) " + "new_item->timestamp = timestamp;\n" : ""); if (pdef->testport_type == ADDRESS) { src = mputprintf(src, "if (sender_address != NULL) " "new_item->sender_address = new %s(*sender_address);\n" @@ -2839,6 +2908,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_call(const %s_call& " "incoming_par, component sender_component", class_name, sig->name); @@ -2846,6 +2918,9 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputstr(src, ")\n" "{\n" "if (!is_started) TTCN_error(\"Port %s is not started but a call " @@ -2877,8 +2952,11 @@ void defPortClass(const port_def* pdef, output_struct* output) "proc_queue_item *new_item = new proc_queue_item;\n" "new_item->item_selection = CALL_%lu;\n" "new_item->call_%lu = new %s_call(incoming_par);\n" - "new_item->sender_component = sender_component;\n", - (unsigned long) i, (unsigned long) i, sig->name); + "new_item->sender_component = sender_component;\n" + "%s", + (unsigned long) i, (unsigned long) i, sig->name, + pdef->realtime ? "if (timestamp.is_bound()) " + "new_item->timestamp = timestamp;\n" : ""); if (pdef->testport_type == ADDRESS) { src = mputprintf(src, "if (sender_address != NULL) " "new_item->sender_address = new %s(*sender_address);\n" @@ -2898,6 +2976,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_reply(const %s_reply& " "incoming_par, component sender_component", class_name, @@ -2906,6 +2987,9 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputstr(src, ")\n" "{\n" "if (!is_started) TTCN_error(\"Port %s is not started but a reply " @@ -2933,8 +3017,11 @@ void defPortClass(const port_def* pdef, output_struct* output) "proc_queue_item *new_item = new proc_queue_item;\n" "new_item->item_selection = REPLY_%lu;\n" "new_item->reply_%lu = new %s_reply(incoming_par);\n" - "new_item->sender_component = sender_component;\n", - (unsigned long) i, (unsigned long) i, sig->name); + "new_item->sender_component = sender_component;\n" + "%s", + (unsigned long) i, (unsigned long) i, sig->name, + pdef->realtime ? "if (timestamp.is_bound()) " + "new_item->timestamp = timestamp;\n" : ""); if (pdef->testport_type == ADDRESS) { src = mputprintf(src, "if (sender_address != NULL) " "new_item->sender_address = new %s(*sender_address);\n" @@ -2955,6 +3042,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_exception(const %s_exception& incoming_par, " @@ -2963,6 +3053,9 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputstr(src, ")\n" "{\n" "if (!is_started) TTCN_error(\"Port %s is not started but an " @@ -2992,8 +3085,11 @@ void defPortClass(const port_def* pdef, output_struct* output) "proc_queue_item *new_item = new proc_queue_item;\n" "new_item->item_selection = EXCEPTION_%lu;\n" "new_item->exception_%lu = new %s_exception(incoming_par);\n" - "new_item->sender_component = sender_component;\n", - (unsigned long) i, (unsigned long) i, sig->name); + "new_item->sender_component = sender_component;\n" + "%s", + (unsigned long) i, (unsigned long) i, sig->name, + pdef->realtime ? "if (timestamp.is_bound()) " + "new_item->timestamp = timestamp;\n" : ""); if (pdef->testport_type == ADDRESS) { src = mputprintf(src, "if (sender_address != NULL) " "new_item->sender_address = new %s(*sender_address);\n" @@ -3018,9 +3114,13 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address = NULL", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputprintf(def, ") { incoming_message(incoming_par, " - "SYSTEM_COMPREF%s); }\n", - pdef->testport_type == ADDRESS ? ", sender_address" : ""); + "SYSTEM_COMPREF%s%s); }\n", + pdef->testport_type == ADDRESS ? ", sender_address" : "", + pdef->realtime ? ", timestamp" : ""); } for (i = 0; i < pdef->proc_in.nElements; i++) { /* wrapper for incoming_call */ @@ -3031,9 +3131,13 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address = NULL", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputprintf(def, ") { incoming_call(incoming_par, " - "SYSTEM_COMPREF%s); }\n", - pdef->testport_type == ADDRESS ? ", sender_address" : ""); + "SYSTEM_COMPREF%s%s); }\n", + pdef->testport_type == ADDRESS ? ", sender_address" : "", + pdef->realtime ? ", timestamp" : ""); } for (i = 0; i < pdef->proc_out.nElements; i++) { /* wrapper for incoming_reply */ @@ -3045,9 +3149,13 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address = NULL", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputprintf(def, ") { incoming_reply(incoming_par, " - "SYSTEM_COMPREF%s); }\n", - pdef->testport_type == ADDRESS ? ", sender_address" : ""); + "SYSTEM_COMPREF%s%s); }\n", + pdef->testport_type == ADDRESS ? ", sender_address" : "", + pdef->realtime ? ", timestamp" : ""); } for (i = 0; i < pdef->proc_out.nElements; i++) { /* wrapper for incoming_exception */ @@ -3059,9 +3167,13 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address = NULL", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputprintf(def, ") { incoming_exception(incoming_par, " - "SYSTEM_COMPREF%s); }\n", - pdef->testport_type == ADDRESS ? ", sender_address" : ""); + "SYSTEM_COMPREF%s%s); }\n", + pdef->testport_type == ADDRESS ? ", sender_address" : "", + pdef->realtime ? ", timestamp" : ""); } } else { /** implementation of pure virtual functions that are defined in @@ -3082,6 +3194,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_message(" "const %s& incoming_par", class_name, message_type); @@ -3089,12 +3204,16 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputprintf(src, ")\n" "{\n" - "incoming_message(incoming_par, SYSTEM_COMPREF%s%s);\n" + "incoming_message(incoming_par, SYSTEM_COMPREF%s%s%s);\n" "}\n\n", (pdef->has_sliding ? ", sliding_buffer": ""), - pdef->testport_type == ADDRESS ? ", sender_address" : ""); + pdef->testport_type == ADDRESS ? ", sender_address" : "", + pdef->realtime ? ", timestamp" : ""); } for (i = 0; i < pdef->proc_in.nElements; i++) { /* incoming_call */ @@ -3104,6 +3223,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_call(const %s_call& " "incoming_par", class_name, pdef->proc_in.elements[i].name); @@ -3111,11 +3233,15 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputprintf(src, ")\n" "{\n" - "incoming_call(incoming_par, SYSTEM_COMPREF%s);\n" + "incoming_call(incoming_par, SYSTEM_COMPREF%s%s);\n" "}\n\n", - pdef->testport_type == ADDRESS ? ", sender_address" : ""); + pdef->testport_type == ADDRESS ? ", sender_address" : "", + pdef->realtime ? ", timestamp" : ""); } for (i = 0; i < pdef->proc_out.nElements; i++) { /* incoming_reply */ @@ -3126,6 +3252,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_reply(const %s_reply& " "incoming_par", class_name, @@ -3134,11 +3263,15 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputprintf(src, ")\n" "{\n" - "incoming_reply(incoming_par, SYSTEM_COMPREF%s);\n" + "incoming_reply(incoming_par, SYSTEM_COMPREF%s%s);\n" "}\n\n", - pdef->testport_type == ADDRESS ? ", sender_address" : ""); + pdef->testport_type == ADDRESS ? ", sender_address" : "", + pdef->realtime ? ", timestamp" : ""); } for (i = 0; i < pdef->proc_out.nElements; i++) { /* incoming_exception */ @@ -3150,6 +3283,9 @@ void defPortClass(const port_def* pdef, output_struct* output) def = mputprintf(def, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + def = mputstr(def, ", const FLOAT& timestamp = FLOAT()"); + } def = mputstr(def, ");\n"); src = mputprintf(src, "void %s::incoming_exception(" "const %s_exception& incoming_par", class_name, @@ -3158,11 +3294,15 @@ void defPortClass(const port_def* pdef, output_struct* output) src = mputprintf(src, ", const %s *sender_address", pdef->address_name); } + if (pdef->realtime) { + src = mputstr(src, ", const FLOAT& timestamp"); + } src = mputprintf(src, ")\n" "{\n" - "incoming_exception(incoming_par, SYSTEM_COMPREF%s);\n" + "incoming_exception(incoming_par, SYSTEM_COMPREF%s%s);\n" "}\n\n", - pdef->testport_type == ADDRESS ? ", sender_address" : ""); + pdef->testport_type == ADDRESS ? ", sender_address" : "", + pdef->realtime ? ", timestamp" : ""); } } } diff --git a/compiler2/ttcn3/port.h b/compiler2/ttcn3/port.h index 5499e281a..973e4083d 100644 --- a/compiler2/ttcn3/port.h +++ b/compiler2/ttcn3/port.h @@ -124,6 +124,7 @@ typedef struct port_def_tag { char *var_defs; char *mapping_func_decls; char *mapping_func_defs; + boolean realtime; } port_def; #ifdef __cplusplus diff --git a/core/Array.hh b/core/Array.hh index d17a71690..e7a7683a8 100644 --- a/core/Array.hh +++ b/core/Array.hh @@ -29,6 +29,7 @@ #include "Optional.hh" #include "Parameters.h" #include "Integer.hh" +#include "Float.hh" #include "Struct_of.hh" #include "memory.h" #include "Component.hh" @@ -225,7 +226,8 @@ public: // 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) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -233,7 +235,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -261,7 +263,8 @@ public: // if it's NULL, so a separate function is needed for this case in RT1 alt_status receive(const T_template& value_template, int /* NULL */, const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -269,7 +272,7 @@ public: 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); + sender_template, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -293,7 +296,8 @@ public: T_value_redirect* value_redirect, #endif const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -301,7 +305,7 @@ public: 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); + value_redirect, sender_template, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -321,7 +325,8 @@ public: } alt_status check_receive(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -329,7 +334,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -355,7 +360,8 @@ public: #else alt_status check_receive(const T_template& value_template, int /* NULL */, const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -363,7 +369,7 @@ public: 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); + sender_template, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -387,7 +393,8 @@ public: T_value_redirect* value_redirect, #endif const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -395,7 +402,7 @@ public: 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); + value_redirect, sender_template, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -415,7 +422,8 @@ public: } alt_status trigger(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -423,7 +431,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -449,7 +457,8 @@ public: #else alt_status trigger(const T_template& value_template, int /* NULL */, const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -457,7 +466,7 @@ public: 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); + sender_template, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -481,7 +490,8 @@ public: T_value_redirect* value_redirect, #endif const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -489,7 +499,7 @@ public: 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); + value_redirect, sender_template, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -509,7 +519,8 @@ public: } alt_status getcall(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -517,7 +528,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -540,7 +551,8 @@ public: alt_status getcall(const T_template& getcall_template, const COMPONENT_template& sender_template, const T_parameter_redirect& param_ref, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -548,7 +560,7 @@ public: 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); + sender_template, param_ref, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -568,7 +580,8 @@ public: } alt_status check_getcall(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -576,7 +589,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -599,7 +612,8 @@ public: alt_status check_getcall(const T_template& getcall_template, const COMPONENT_template& sender_template, const T_parameter_redirect& param_ref, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -607,7 +621,7 @@ public: 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); + sender_template, param_ref, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -627,7 +641,8 @@ public: } alt_status getreply(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -635,7 +650,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -658,7 +673,8 @@ public: alt_status getreply(const T_template& getreply_template, const COMPONENT_template& sender_template, const T_parameter_redirect& param_ref, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -666,7 +682,7 @@ public: 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); + sender_template, param_ref, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -686,7 +702,8 @@ public: } alt_status check_getreply(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -694,7 +711,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -717,7 +734,8 @@ public: alt_status check_getreply(const T_template& getreply_template, const COMPONENT_template& sender_template, const T_parameter_redirect& param_ref, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -725,7 +743,7 @@ public: 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); + sender_template, param_ref, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -745,7 +763,8 @@ public: } alt_status get_exception(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -753,7 +772,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -775,7 +794,8 @@ public: template <typename T_template> alt_status get_exception(const T_template& catch_template, const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -783,7 +803,7 @@ public: 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); + sender_template, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -803,7 +823,8 @@ public: } alt_status check_catch(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -811,7 +832,7 @@ public: 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); + sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -833,7 +854,8 @@ public: template <typename T_template> alt_status check_catch(const T_template& catch_template, const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -841,7 +863,7 @@ public: 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); + sender_template, sender_ptr, timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); @@ -861,7 +883,8 @@ public: } alt_status check(const COMPONENT_template& sender_template, - COMPONENT* sender_ptr, Index_Redirect* index_redirect) + COMPONENT* sender_ptr, FLOAT* timestamp_redirect, + Index_Redirect* index_redirect) { if (index_redirect != NULL) { index_redirect->incr_pos(); @@ -869,7 +892,7 @@ public: 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); + timestamp_redirect, index_redirect); if (ret_val == ALT_YES) { if (index_redirect != NULL) { index_redirect->add_index((int)i + index_offset); diff --git a/core/LegacyLogger.cc b/core/LegacyLogger.cc index eaf29ed55..683574118 100644 --- a/core/LegacyLogger.cc +++ b/core/LegacyLogger.cc @@ -264,8 +264,8 @@ boolean LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, if (this->is_disk_full_) { if (this->disk_full_action_.type == TTCN_Logger::DISKFULL_RETRY) { - struct timeval event_timestamp = { (time_t)event.timestamp().seconds(), - (suseconds_t)event.timestamp().microSeconds() }; + struct timeval event_timestamp = { (time_t)event.timestamp__().seconds(), + (suseconds_t)event.timestamp__().microSeconds() }; struct timeval diff; // If the specified time period has elapsed retry logging to file. if (event_timestamp.tv_usec < this->disk_full_time_.tv_usec) { @@ -333,7 +333,7 @@ boolean LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, expstring_t switched = mprintf("Switching to log file `%s'", new_filename); TitanLoggerApi::TitanLogEvent switched_event; - switched_event.timestamp() = event.timestamp(); + switched_event.timestamp__() = event.timestamp__(); switched_event.sourceInfo__list() = event.sourceInfo__list(); switched_event.severity() = (int)TTCN_Logger::EXECUTOR_RUNTIME; switched_event.logEvent().choice().unhandledEvent() = @@ -361,8 +361,8 @@ boolean LegacyLogger::log_file(const TitanLoggerApi::TitanLogEvent& event, case TTCN_Logger::DISKFULL_RETRY: this->is_disk_full_ = TRUE; // Time of failure. TODO: Find a better way to transfer the timestamp. - this->disk_full_time_.tv_sec = event.timestamp().seconds(); - this->disk_full_time_.tv_usec = event.timestamp().microSeconds(); + this->disk_full_time_.tv_sec = event.timestamp__().seconds(); + this->disk_full_time_.tv_usec = event.timestamp__().microSeconds(); break; case TTCN_Logger::DISKFULL_DELETE: // Try to delete older logfiles while writing fails, must leave at least @@ -405,8 +405,8 @@ boolean LegacyLogger::log_console(const TitanLoggerApi::TitanLogEvent& event, return FALSE; } size_t event_str_len = mstrlen(event_str); - if (!TTCN_Communication::send_log((time_t)event.timestamp().seconds(), - (suseconds_t)event.timestamp().microSeconds(), severity, + if (!TTCN_Communication::send_log((time_t)event.timestamp__().seconds(), + (suseconds_t)event.timestamp__().microSeconds(), severity, event_str_len, event_str)) { // The event text shall be printed to stderr when there is no control // connection towards MC (e.g. in single mode or in case of network @@ -1774,8 +1774,8 @@ char *event_to_str(const TitanLoggerApi::TitanLogEvent& event, { char *ret_val = NULL; if (!without_header) { - struct timeval timestamp = { (time_t)event.timestamp().seconds(), - (suseconds_t)event.timestamp().microSeconds() }; + struct timeval timestamp = { (time_t)event.timestamp__().seconds(), + (suseconds_t)event.timestamp__().microSeconds() }; char *sourceinfo = NULL; if (event.sourceInfo__list().is_bound()) { TTCN_Logger::source_info_format_t source_info_format = diff --git a/core/LoggerPluginManager.cc b/core/LoggerPluginManager.cc index affc997a6..d856716fb 100644 --- a/core/LoggerPluginManager.cc +++ b/core/LoggerPluginManager.cc @@ -532,7 +532,7 @@ void LoggerPluginManager::fill_common_fields(API::TitanLogEvent& event, struct timeval tv; if (gettimeofday(&tv, NULL) < 0) TTCN_Logger::fatal_error("The gettimeofday() system call failed."); - event.timestamp() = API::TimestampType(tv.tv_sec, tv.tv_usec); + event.timestamp__() = API::TimestampType(tv.tv_sec, tv.tv_usec); TTCN_Logger::source_info_format_t source_info_format = TTCN_Logger::get_source_info_format(); API::TitanLogEvent_sourceInfo__list& srcinfo = event.sourceInfo__list(); diff --git a/core/Port.cc b/core/Port.cc index aa455e193..cd626e0c6 100644 --- a/core/Port.cc +++ b/core/Port.cc @@ -525,7 +525,7 @@ PORT* PORT::get_provider_port() { return NULL; } -alt_status PORT::receive(const COMPONENT_template&, COMPONENT *, Index_Redirect*) +alt_status PORT::receive(const COMPONENT_template&, COMPONENT *, FLOAT*, Index_Redirect*) { TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::no__incoming__types, @@ -535,12 +535,12 @@ alt_status PORT::receive(const COMPONENT_template&, COMPONENT *, Index_Redirect* } alt_status PORT::any_receive(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->receive(sender_template, sender_ptr)) { + switch (port->receive(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -564,7 +564,8 @@ alt_status PORT::any_receive(const COMPONENT_template& sender_template, } } -alt_status PORT::check_receive(const COMPONENT_template&, COMPONENT *, Index_Redirect*) +alt_status PORT::check_receive(const COMPONENT_template&, COMPONENT *, FLOAT*, + Index_Redirect*) { TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::no__incoming__types, @@ -574,12 +575,12 @@ alt_status PORT::check_receive(const COMPONENT_template&, COMPONENT *, Index_Red } alt_status PORT::any_check_receive(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->check_receive(sender_template, sender_ptr)) { + switch (port->check_receive(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -603,7 +604,8 @@ alt_status PORT::any_check_receive(const COMPONENT_template& sender_template, } } -alt_status PORT::trigger(const COMPONENT_template&, COMPONENT *, Index_Redirect*) +alt_status PORT::trigger(const COMPONENT_template&, COMPONENT *, FLOAT*, + Index_Redirect*) { TTCN_Logger::log_matching_problem( TitanLoggerApi::MatchingProblemType_reason::no__incoming__types, @@ -613,12 +615,12 @@ alt_status PORT::trigger(const COMPONENT_template&, COMPONENT *, Index_Redirect* } alt_status PORT::any_trigger(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->trigger(sender_template, sender_ptr)) { + switch (port->trigger(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -644,7 +646,7 @@ alt_status PORT::any_trigger(const COMPONENT_template& sender_template, } } -alt_status PORT::getcall(const COMPONENT_template&, COMPONENT *, Index_Redirect*) +alt_status PORT::getcall(const COMPONENT_template&, COMPONENT *, FLOAT*, Index_Redirect*) { // ToDo:Unnecessary log matching problem warning removed. // Question: does it unnecessary? @@ -656,12 +658,12 @@ alt_status PORT::getcall(const COMPONENT_template&, COMPONENT *, Index_Redirect* } alt_status PORT::any_getcall(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->getcall(sender_template, sender_ptr)) { + switch (port->getcall(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -685,7 +687,7 @@ alt_status PORT::any_getcall(const COMPONENT_template& sender_template, } } -alt_status PORT::check_getcall(const COMPONENT_template&, COMPONENT *, Index_Redirect*) +alt_status PORT::check_getcall(const COMPONENT_template&, COMPONENT *, FLOAT*, Index_Redirect*) { // ToDo:Unnecessary log matching problem warning removed. // Question: does it unnecessary @@ -697,12 +699,12 @@ alt_status PORT::check_getcall(const COMPONENT_template&, COMPONENT *, Index_Red } alt_status PORT::any_check_getcall(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->check_getcall(sender_template, sender_ptr)) { + switch (port->check_getcall(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -726,7 +728,7 @@ alt_status PORT::any_check_getcall(const COMPONENT_template& sender_template, } } -alt_status PORT::getreply(const COMPONENT_template&, COMPONENT *, Index_Redirect*) +alt_status PORT::getreply(const COMPONENT_template&, COMPONENT *, FLOAT*, Index_Redirect*) { // ToDo:Unnecessary log matching problem warning removed. // Question: does it unnecessary @@ -738,12 +740,12 @@ alt_status PORT::getreply(const COMPONENT_template&, COMPONENT *, Index_Redirect } alt_status PORT::any_getreply(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->getreply(sender_template, sender_ptr)) { + switch (port->getreply(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -767,7 +769,7 @@ alt_status PORT::any_getreply(const COMPONENT_template& sender_template, } } -alt_status PORT::check_getreply(const COMPONENT_template&, COMPONENT *, Index_Redirect*) +alt_status PORT::check_getreply(const COMPONENT_template&, COMPONENT *, FLOAT*, Index_Redirect*) { // ToDo:Unnecessary log matching problem warning removed. // Question: does it unnecessary @@ -779,12 +781,12 @@ alt_status PORT::check_getreply(const COMPONENT_template&, COMPONENT *, Index_Re } alt_status PORT::any_check_getreply(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->check_getreply(sender_template, sender_ptr)) { + switch (port->check_getreply(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -808,7 +810,7 @@ alt_status PORT::any_check_getreply(const COMPONENT_template& sender_template, } } -alt_status PORT::get_exception(const COMPONENT_template&, COMPONENT *, Index_Redirect*) +alt_status PORT::get_exception(const COMPONENT_template&, COMPONENT *, FLOAT*, Index_Redirect*) { // ToDo:Unnecessary log matching problem warning removed. // Question: does it unnecessary @@ -820,12 +822,12 @@ alt_status PORT::get_exception(const COMPONENT_template&, COMPONENT *, Index_Red } alt_status PORT::any_catch(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->get_exception(sender_template, sender_ptr)) { + switch (port->get_exception(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -850,7 +852,7 @@ alt_status PORT::any_catch(const COMPONENT_template& sender_template, } alt_status PORT::check_catch(const COMPONENT_template& , - COMPONENT *, Index_Redirect*) + COMPONENT *, FLOAT*, Index_Redirect*) { // ToDo:Unnecessary log matching problem warning removed. // Question: does it unnecessary @@ -862,12 +864,12 @@ alt_status PORT::check_catch(const COMPONENT_template& , } alt_status PORT::any_check_catch(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->check_catch(sender_template, sender_ptr)) { + switch (port->check_catch(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -892,11 +894,11 @@ alt_status PORT::any_check_catch(const COMPONENT_template& sender_template, } alt_status PORT::check(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr, Index_Redirect*) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect, Index_Redirect*) { alt_status ret_val = ALT_NO; // the procedure-based queue must have the higher priority - switch (check_getcall(sender_template, sender_ptr)) { + switch (check_getcall(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -911,7 +913,7 @@ alt_status PORT::check(const COMPONENT_template& sender_template, if (ret_val != ALT_MAYBE) { // don't try getreply if the procedure-based queue is empty // (i.e. check_getcall() returned ALT_MAYBE) - switch (check_getreply(sender_template, sender_ptr)) { + switch (check_getreply(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -927,7 +929,7 @@ alt_status PORT::check(const COMPONENT_template& sender_template, if (ret_val != ALT_MAYBE) { // don't try catch if the procedure-based queue is empty // (i.e. check_getcall() or check_getreply() returned ALT_MAYBE) - switch (check_catch(sender_template, sender_ptr)) { + switch (check_catch(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -940,7 +942,7 @@ alt_status PORT::check(const COMPONENT_template& sender_template, "unexpected status code on port %s.", port_name); } } - switch (check_receive(sender_template, sender_ptr)) { + switch (check_receive(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: @@ -956,12 +958,12 @@ alt_status PORT::check(const COMPONENT_template& sender_template, } alt_status PORT::any_check(const COMPONENT_template& sender_template, - COMPONENT *sender_ptr) + COMPONENT *sender_ptr, FLOAT* timestamp_redirect) { if (list_head != NULL) { alt_status ret_val = ALT_NO; for (PORT *port = list_head; port != NULL; port = port->list_next) { - switch (port->check(sender_template, sender_ptr)) { + switch (port->check(sender_template, sender_ptr, timestamp_redirect)) { case ALT_YES: return ALT_YES; case ALT_MAYBE: diff --git a/core/Port.hh b/core/Port.hh index 1da726cba..b46e608f2 100644 --- a/core/Port.hh +++ b/core/Port.hh @@ -32,6 +32,7 @@ class COMPONENT_template; class Text_Buf; class OCTETSTRING; class CHARSTRING; +class FLOAT; class Index_Redirect; extern const COMPONENT_template& any_compref; @@ -164,59 +165,64 @@ public: virtual void change_port_state(translation_port_state state); virtual alt_status receive(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL, + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_receive(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL); + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL); virtual alt_status check_receive(const COMPONENT_template& sender_template = any_compref, COMPONENT *sender_ptr = NULL, - Index_Redirect* index_redirect = NULL); + FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_check_receive(const COMPONENT_template& - sender_template = any_compref, COMPONENT *sender_ptr = NULL); + sender_template = any_compref, COMPONENT *sender_ptr = NULL, + FLOAT* timestamp_redirect = NULL); virtual alt_status trigger(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL, + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_trigger(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL); + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL); virtual alt_status getcall(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL, + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_getcall(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL); + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL); virtual alt_status check_getcall(const COMPONENT_template& sender_template = any_compref, COMPONENT *sender_ptr = NULL, - Index_Redirect* index_redirect = NULL); + FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_check_getcall(const COMPONENT_template& - sender_template = any_compref, COMPONENT *sender_ptr = NULL); + sender_template = any_compref, COMPONENT *sender_ptr = NULL, + FLOAT* timestamp_redirect = NULL); virtual alt_status getreply(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL, + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_getreply(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL); + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL); virtual alt_status check_getreply(const COMPONENT_template& sender_template = any_compref, COMPONENT *sender_ptr = NULL, - Index_Redirect* index_redirect = NULL); + FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_check_getreply(const COMPONENT_template& - sender_template = any_compref, COMPONENT *sender_ptr = NULL); + sender_template = any_compref, COMPONENT *sender_ptr = NULL, + FLOAT* timestamp_redirect = NULL); virtual alt_status get_exception(const COMPONENT_template& sender_template = any_compref, COMPONENT *sender_ptr = NULL, - Index_Redirect* index_redirect = NULL); + FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_catch(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL); + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL); virtual alt_status check_catch(const COMPONENT_template& sender_template = any_compref, COMPONENT *sender_ptr = NULL, - Index_Redirect* index_redirect = NULL); + FLOAT* timestamp_redirect = NULL, Index_Redirect* index_redirect = NULL); static alt_status any_check_catch(const COMPONENT_template& - sender_template = any_compref, COMPONENT *sender_ptr = NULL); + sender_template = any_compref, COMPONENT *sender_ptr = NULL, + FLOAT* timestamp_redirect = NULL); alt_status check(const COMPONENT_template& sender_template = any_compref, - COMPONENT *sender_ptr = NULL, Index_Redirect* index_redirect = NULL); + COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL, + Index_Redirect* index_redirect = NULL); static alt_status any_check(const COMPONENT_template& sender_template = - any_compref, COMPONENT *sender_ptr = NULL); + any_compref, COMPONENT *sender_ptr = NULL, FLOAT* timestamp_redirect = NULL); /** Set a parameter on the port. * @param parameter_name string diff --git a/function_test/Semantic_Analyser/realtime/realtimeTimestamp_SE.ttcn b/function_test/Semantic_Analyser/realtime/realtimeTimestamp_SE.ttcn new file mode 100644 index 000000000..793c34aad --- /dev/null +++ b/function_test/Semantic_Analyser/realtime/realtimeTimestamp_SE.ttcn @@ -0,0 +1,102 @@ +/****************************************************************************** + * Copyright (c) 2000-2018 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Baranyi, Botond + * + ******************************************************************************/ + +module realtimeTimestamp_SE { //^In TTCN-3 module// + +signature Sig(inout integer p) return charstring exception(boolean); + +type port BadPortMsg message { + inout integer +} + +type port BadPortProc procedure { + inout Sig +} + +type port PortRtMsg message realtime { + inout integer +} + +type port PortRtProc procedure realtime { + inout Sig +} + +type component CT { + port BadPortMsg badPortMsg; + port BadPortProc badPortProc; + port PortRtMsg portRtMsg; + port PortRtProc portRtProc; +} + +function f() runs on CT { //^In function definition// + var float x; + var hexstring y; + + alt { + [] portRtMsg.receive(integer: ?) -> timestamp x {} + [] portRtMsg.trigger(integer: ?) -> timestamp x {} + [] portRtProc.getcall(Sig: { ? }) -> timestamp x {} + [] portRtProc.getreply(Sig: { ? } value charstring: ?) -> timestamp x {} + [] portRtProc.catch(Sig, boolean: ?) -> timestamp x {} + [] portRtMsg.check(receive(integer: ?) -> timestamp x) {} + [] portRtProc.check(getcall(Sig: { ? }) -> timestamp x) {} + [] portRtProc.check(getreply(Sig: { ? } value charstring: ?) -> timestamp x) {} + [] portRtProc.check(catch(Sig, boolean: ?) -> timestamp x) {} + [] portRtMsg.check(-> timestamp x) {} + } + + alt { //^In alt construct// + [] badPortMsg.receive(integer: ?) -> timestamp x {} //^In guard operation// //^In receive statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortMsg' does not have the 'realtime' clause// + [] badPortMsg.trigger(integer: ?) -> timestamp x {} //^In guard operation// //^In trigger statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortMsg' does not have the 'realtime' clause// + [] badPortProc.getcall(Sig: { ? }) -> timestamp x {} //^In guard operation// //^In getcall statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortProc' does not have the 'realtime' clause// + [] badPortProc.getreply(Sig: { ? } value charstring: ?) -> timestamp x {} //^In guard operation// //^In getreply statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortProc' does not have the 'realtime' clause// + [] badPortProc.catch(Sig, boolean: ?) -> timestamp x {} //^In guard operation// //^In catch statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortProc' does not have the 'realtime' clause// + [] badPortMsg.check(receive(integer: ?) -> timestamp x) {} //^In guard operation// //^In check-receive statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortMsg' does not have the 'realtime' clause// + [] badPortProc.check(getcall(Sig: { ? }) -> timestamp x) {} //^In guard operation// //^In check-getcall statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortProc' does not have the 'realtime' clause// + [] badPortProc.check(getreply(Sig: { ? } value charstring: ?) -> timestamp x) {} //^In guard operation// //^In check-getreply statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortProc' does not have the 'realtime' clause// + [] badPortProc.check(catch(Sig, boolean: ?) -> timestamp x) {} //^In guard operation// //^In check-catch statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortProc' does not have the 'realtime' clause// + [] badPortMsg.check(-> timestamp x) {} //^In guard operation// //^In check statement// //The timestamp cannot be redirected, because port type `@realtimeTimestamp_SE.BadPortMsg' does not have the 'realtime' clause// + } + + alt { + [] any port.receive -> timestamp x {} + [] any port.trigger -> timestamp x {} + [] any port.getcall -> timestamp x {} + [] any port.getreply -> timestamp x {} + [] any port.catch -> timestamp x {} + [] any port.check(receive -> timestamp x) {} + [] any port.check(getcall -> timestamp x) {} + [] any port.check(getreply -> timestamp x) {} + [] any port.check(catch -> timestamp x) {} + [] any port.check(-> timestamp x) {} + } + + alt { //^In alt construct// + [] portRtMsg.receive(integer: ?) -> timestamp y {} //^In guard operation// //^In receive statement// //The type of the variable should be float instead of `hexstring'// + [] portRtMsg.trigger(integer: ?) -> timestamp y {} //^In guard operation// //^In trigger statement// //The type of the variable should be float instead of `hexstring'// + [] portRtProc.getcall(Sig: { ? }) -> timestamp y {} //^In guard operation// //^In getcall statement// //The type of the variable should be float instead of `hexstring'// + [] portRtProc.getreply(Sig: { ? } value charstring: ?) -> timestamp y {} //^In guard operation// //^In getreply statement// //The type of the variable should be float instead of `hexstring'// + [] portRtProc.catch(Sig, boolean: ?) -> timestamp y {} //^In guard operation// //^In catch statement// //The type of the variable should be float instead of `hexstring'// + [] portRtMsg.check(receive(integer: ?) -> timestamp y) {} //^In guard operation// //^In check-receive statement// //The type of the variable should be float instead of `hexstring'// + [] portRtProc.check(getcall(Sig: { ? }) -> timestamp y) {} //^In guard operation// //^In check-getcall statement// //The type of the variable should be float instead of `hexstring'// + [] portRtProc.check(getreply(Sig: { ? } value charstring: ?) -> timestamp y) {} //^In guard operation// //^In check-getreply statement// //The type of the variable should be float instead of `hexstring'// + [] portRtProc.check(catch(Sig, boolean: ?) -> timestamp y) {} //^In guard operation// //^In check-catch statement// //The type of the variable should be float instead of `hexstring'// + [] portRtMsg.check(-> timestamp y) {} //^In guard operation// //^In check statement// //The type of the variable should be float instead of `hexstring'// + } + + portRtProc.call(Sig: { 0 }, 0.5) { //^In call statement// //In response and exception handling part// + [] portRtProc.catch(timeout) -> timestamp x {} + [] portRtProc.catch(timeout) -> timestamp y {} //^In guard operation// //^In catch statement// //The type of the variable should be float instead of// + } +} + +} diff --git a/loggerplugins/JUnitLogger/JUnitLogger.cc b/loggerplugins/JUnitLogger/JUnitLogger.cc index 299762291..769ded9e9 100644 --- a/loggerplugins/JUnitLogger/JUnitLogger.cc +++ b/loggerplugins/JUnitLogger/JUnitLogger.cc @@ -162,7 +162,7 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event, case TitanLoggerApi::TestcaseEvent_choice::ALT_testcaseStarted: { fprintf(file_stream_, "<!-- Testcase %s started -->\n", (const char*)tcev.testcaseStarted().testcase__name()); - const TitanLoggerApi::TimestampType& ts = event.timestamp(); + const TitanLoggerApi::TimestampType& ts = event.timestamp__(); // remember the start time seconds = ts.seconds(); microseconds = ts.microSeconds(); @@ -170,7 +170,7 @@ void JUnitLogger::log(const TitanLoggerApi::TitanLogEvent& event, case TitanLoggerApi::TestcaseEvent_choice::ALT_testcaseFinished: { const TitanLoggerApi::TestcaseType& tct = tcev.testcaseFinished(); - const TitanLoggerApi::TimestampType& ts = event.timestamp(); + const TitanLoggerApi::TimestampType& ts = event.timestamp__(); long long now = 1000000LL * (long long)ts.seconds() + (long long)ts.microSeconds(); long long then= 1000000LL * (long long) seconds + (long long) microseconds ; fprintf(file_stream_, "<!-- Testcase %s finished in %f, verdict: %s%s%s -->\n", diff --git a/loggerplugins/JUnitLogger2/JUnitLogger2.cc b/loggerplugins/JUnitLogger2/JUnitLogger2.cc index 66884d611..bc26c76d0 100644 --- a/loggerplugins/JUnitLogger2/JUnitLogger2.cc +++ b/loggerplugins/JUnitLogger2/JUnitLogger2.cc @@ -146,7 +146,7 @@ void JUnitLogger2::log(const TitanLoggerApi::TitanLogEvent& event, case TitanLoggerApi::TestcaseEvent_choice::ALT_testcaseStarted: { testcase.tc_name = tcev.testcaseStarted().testcase__name(); // remember the start time - testcase.tc_start = 1000000LL * (long long)event.timestamp().seconds() + (long long)event.timestamp().microSeconds(); + testcase.tc_start = 1000000LL * (long long)event.timestamp__().seconds() + (long long)event.timestamp__().microSeconds(); break; } case TitanLoggerApi::TestcaseEvent_choice::ALT_testcaseFinished: { @@ -154,7 +154,7 @@ void JUnitLogger2::log(const TitanLoggerApi::TitanLogEvent& event, testcase.reason = escape_xml_element(tct.reason()); testcase.module_name = tct.name().module__name(); - const TitanLoggerApi::TimestampType& ts = event.timestamp(); + const TitanLoggerApi::TimestampType& ts = event.timestamp__(); long long tc_end = 1000000LL * (long long)ts.seconds() + (long long)ts.microSeconds(); testcase.time = (tc_end - testcase.tc_start) / 1000000.0; diff --git a/loggerplugins/LTTngUSTLogger/LTTngUSTLogger.cc b/loggerplugins/LTTngUSTLogger/LTTngUSTLogger.cc index 538da34d3..720e136ca 100644 --- a/loggerplugins/LTTngUSTLogger/LTTngUSTLogger.cc +++ b/loggerplugins/LTTngUSTLogger/LTTngUSTLogger.cc @@ -93,7 +93,7 @@ void LTTngUSTLogger::log(const TitanLoggerApi::TitanLogEvent& event, } /* Read timestamp and severity (common arguments). */ - const TimestampType& timestamp = event.timestamp(); + const TimestampType& timestamp = event.timestamp__(); int severity = (int) event.severity(); /* Log source infos of this event. */ diff --git a/loggerplugins/TSTLogger/TSTLogger.cc b/loggerplugins/TSTLogger/TSTLogger.cc index bd886e323..1d28f9627 100644 --- a/loggerplugins/TSTLogger/TSTLogger.cc +++ b/loggerplugins/TSTLogger/TSTLogger.cc @@ -458,12 +458,12 @@ void TSTLogger::log(const TitanLoggerApi::TitanLogEvent& event, switch (tec.get_selection()) { case TitanLoggerApi::TestcaseEvent_choice::ALT_testcaseStarted: if (is_main_proc()) { - log_testcase_start(tec.testcaseStarted(), event.timestamp()); + log_testcase_start(tec.testcaseStarted(), event.timestamp__()); } break; case TitanLoggerApi::TestcaseEvent_choice::ALT_testcaseFinished: if (is_main_proc()) { - log_testcase_stop(tec.testcaseFinished(), event.timestamp()); + log_testcase_stop(tec.testcaseFinished(), event.timestamp__()); } break; default: diff --git a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/ietf_params_xml_ns_pidf_e.ttcn b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/ietf_params_xml_ns_pidf_e.ttcn index 7b3599048..a17ed2c82 100644 --- a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/ietf_params_xml_ns_pidf_e.ttcn +++ b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/ietf_params_xml_ns_pidf_e.ttcn @@ -88,7 +88,7 @@ type record Tuple record of XSD.String elem_list, Contact contact optional, record of Note note_list, - XSD.DateTime timestamp optional + XSD.DateTime timestamp_ optional } with { variant "name as uncapitalized"; @@ -97,6 +97,7 @@ with { variant (elem_list[-]) "anyElement except unqualified, 'urn:ietf:params:xml:ns:pidf'"; variant (note_list) "untagged"; variant (note_list[-]) "name as 'note'"; + variant (timestamp_) "name as 'timestamp'"; }; diff --git a/regression_test/realtime/.gitignore b/regression_test/realtime/.gitignore index dde473e4b..c0dbb60f4 100644 --- a/regression_test/realtime/.gitignore +++ b/regression_test/realtime/.gitignore @@ -2,4 +2,7 @@ realtime realtime.exe realtimeNow*.cc realtimeNow*.hh +realtimeTimestamp*.cc +realtimeTimestamp*.hh +compile realtime*.log diff --git a/regression_test/realtime/Makefile b/regression_test/realtime/Makefile index a73eac751..0738336cb 100644 --- a/regression_test/realtime/Makefile +++ b/regression_test/realtime/Makefile @@ -17,7 +17,9 @@ include $(TOPDIR)/Makefile.regression TTCN3_LIB = ttcn3$(RT2_SUFFIX)-parallel$(DYNAMIC_SUFFIX) -TTCN3_MODULES = realtimeNow.ttcn +TTCN3_MODULES = realtimeNow.ttcn realtimeTimestamp.ttcn + +USER_SOURCES = PortMsg.cc PortProc.cc GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) @@ -30,7 +32,7 @@ GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(f GENERATED_SOURCES += $(GENERATED_SOURCES2) endif -OBJECTS = $(GENERATED_SOURCES:.cc=.o) +OBJECTS = $(GENERATED_SOURCES:.cc=.o) $(USER_SOURCES:.cc:.o) TARGET = realtime$(EXESUFFIX) @@ -39,12 +41,16 @@ all: $(TARGET) $(TARGET): $(GENERATED_SOURCES) $(USER_SOURCES) $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ -L$(TTCN3_DIR)/lib -l$(TTCN3_LIB) -L$(OPENSSL_DIR)/lib -lcrypto $($(PLATFORM)_LIBS) -.ttcn.cc .ttcn.hh: - $(TTCN3_COMPILER) $< +$(GENERATED_SOURCES) $(GENERATED_HEADERS): compile + @if [ ! -f $@ ]; then $(RM) compile; $(MAKE) compile; fi + +compile: $(TTCN3_MODULES) + $(filter-out -Nold -E, $(TTCN3_COMPILER)) $(COMPILER_FLAGS) $^ + touch compile clean distclean: -rm -f $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ - $(GENERATED_SOURCES) *.log Makefile.bak + $(GENERATED_SOURCES) *.log Makefile.bak compile dep: $(GENERATED_SOURCES) makedepend $(CPPFLAGS) $(GENERATED_SOURCES) diff --git a/regression_test/realtime/PortMsg.cc b/regression_test/realtime/PortMsg.cc new file mode 100644 index 000000000..fb5c36722 --- /dev/null +++ b/regression_test/realtime/PortMsg.cc @@ -0,0 +1,87 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Fri Oct 26 17:43:41 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "PortMsg.hh" + +namespace realtimeTimestamp { + +void ef__incoming__message(const INTEGER& p__msg, const BOOLEAN& p__set__timestamp) +{ + if (p__set__timestamp) { + CT_component_ptMsg.incoming_message(p__msg, TTCN_Runtime::now()); + } + else { + CT_component_ptMsg.incoming_message(p__msg); + } +} + +PortMsg::PortMsg(const char *par_port_name) + : PortMsg_BASE(par_port_name) +{ + +} + +PortMsg::~PortMsg() +{ + +} + +void PortMsg::set_parameter(const char * /*parameter_name*/, + const char * /*parameter_value*/) +{ + +} + +/*void PortMsg::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + +void PortMsg::Handle_Fd_Event_Error(int /*fd*/) +{ + +} + +void PortMsg::Handle_Fd_Event_Writable(int /*fd*/) +{ + +} + +void PortMsg::Handle_Fd_Event_Readable(int /*fd*/) +{ + +} + +/*void PortMsg::Handle_Timeout(double time_since_last_call) {}*/ + +void PortMsg::user_map(const char * /*system_port*/) +{ + +} + +void PortMsg::user_unmap(const char * /*system_port*/) +{ + +} + +void PortMsg::user_start() +{ + +} + +void PortMsg::user_stop() +{ + +} + +void PortMsg::outgoing_send(const INTEGER& /*send_par*/) +{ + +} + +} /* end of namespace */ + diff --git a/regression_test/realtime/PortMsg.hh b/regression_test/realtime/PortMsg.hh new file mode 100644 index 000000000..19eaa1517 --- /dev/null +++ b/regression_test/realtime/PortMsg.hh @@ -0,0 +1,45 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Fri Oct 26 17:43:41 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef PortMsg_HH +#define PortMsg_HH + +#include "realtimeTimestamp.hh" + +namespace realtimeTimestamp { + +class PortMsg : public PortMsg_BASE { + friend void ef__incoming__message(const INTEGER& p__msg, const BOOLEAN& p__set__timestamp); +public: + PortMsg(const char *par_port_name = NULL); + ~PortMsg(); + + void set_parameter(const char *parameter_name, + const char *parameter_value); + +private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ +protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_send(const INTEGER& send_par); +}; + +} /* end of namespace */ + +#endif diff --git a/regression_test/realtime/PortProc.cc b/regression_test/realtime/PortProc.cc new file mode 100644 index 000000000..eed93b655 --- /dev/null +++ b/regression_test/realtime/PortProc.cc @@ -0,0 +1,122 @@ +// This Test Port skeleton source file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Fri Oct 26 17:43:41 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Complete the body of empty functions and +// add your member functions here. + +#include "PortProc.hh" + +namespace realtimeTimestamp { + +void ef__incoming__call(const INTEGER& p__par, const BOOLEAN& p__set__timestamp) +{ + Sig_call x; + x.p() = p__par; + if (p__set__timestamp) { + CT_component_ptProc.incoming_call(x, TTCN_Runtime::now()); + } + else { + CT_component_ptProc.incoming_call(x); + } +} + +void ef__incoming__reply(const INTEGER& p__par, const CHARSTRING& p__ret, const BOOLEAN& p__set__timestamp) +{ + Sig_reply x; + x.p() = p__par; + x.return_value() = p__ret; + if (p__set__timestamp) { + CT_component_ptProc.incoming_reply(x, TTCN_Runtime::now()); + } + else { + CT_component_ptProc.incoming_reply(x); + } +} + +void ef__incoming__exception(const BOOLEAN& p__ex, const BOOLEAN& p__set__timestamp) +{ + if (p__set__timestamp) { + CT_component_ptProc.incoming_exception(Sig_exception(p__ex), TTCN_Runtime::now()); + } + else { + CT_component_ptProc.incoming_exception(Sig_exception(p__ex)); + } +} + +PortProc::PortProc(const char *par_port_name) + : PortProc_BASE(par_port_name) +{ + +} + +PortProc::~PortProc() +{ + +} + +void PortProc::set_parameter(const char * /*parameter_name*/, + const char * /*parameter_value*/) +{ + +} + +/*void PortProc::Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error) {}*/ + +void PortProc::Handle_Fd_Event_Error(int /*fd*/) +{ + +} + +void PortProc::Handle_Fd_Event_Writable(int /*fd*/) +{ + +} + +void PortProc::Handle_Fd_Event_Readable(int /*fd*/) +{ + +} + +/*void PortProc::Handle_Timeout(double time_since_last_call) {}*/ + +void PortProc::user_map(const char * /*system_port*/) +{ + +} + +void PortProc::user_unmap(const char * /*system_port*/) +{ + +} + +void PortProc::user_start() +{ + +} + +void PortProc::user_stop() +{ + +} + +void PortProc::outgoing_call(const Sig_call& /*call_par*/) +{ + +} + +void PortProc::outgoing_reply(const Sig_reply& /*reply_par*/) +{ + +} + +void PortProc::outgoing_raise(const Sig_exception& /*raise_exception*/) +{ + +} + +} /* end of namespace */ + diff --git a/regression_test/realtime/PortProc.hh b/regression_test/realtime/PortProc.hh new file mode 100644 index 000000000..5ee55bad9 --- /dev/null +++ b/regression_test/realtime/PortProc.hh @@ -0,0 +1,49 @@ +// This Test Port skeleton header file was generated by the +// TTCN-3 Compiler of the TTCN-3 Test Executor version CRL 113 200/6 R5A +// for ebotbar (ebotbar@ebotbarVB) on Fri Oct 26 17:43:41 2018 + +// Copyright (c) 2000-2018 Ericsson Telecom AB + +// You may modify this file. Add your attributes and prototypes of your +// member functions here. + +#ifndef PortProc_HH +#define PortProc_HH + +#include "realtimeTimestamp.hh" + +namespace realtimeTimestamp { + +class PortProc : public PortProc_BASE { + friend void ef__incoming__call(const INTEGER& p__par, const BOOLEAN& p__set__timestamp); + friend void ef__incoming__reply(const INTEGER& p__par, const CHARSTRING& p__ret, const BOOLEAN& p__set__timestamp); + friend void ef__incoming__exception(const BOOLEAN& p__ex, const BOOLEAN& p__set__timestamp); +public: + PortProc(const char *par_port_name = NULL); + ~PortProc(); + + void set_parameter(const char *parameter_name, + const char *parameter_value); + +private: + /* void Handle_Fd_Event(int fd, boolean is_readable, + boolean is_writable, boolean is_error); */ + void Handle_Fd_Event_Error(int fd); + void Handle_Fd_Event_Writable(int fd); + void Handle_Fd_Event_Readable(int fd); + /* void Handle_Timeout(double time_since_last_call); */ +protected: + void user_map(const char *system_port); + void user_unmap(const char *system_port); + + void user_start(); + void user_stop(); + + void outgoing_call(const Sig_call& call_par); + void outgoing_reply(const Sig_reply& reply_par); + void outgoing_raise(const Sig_exception& raise_exception); +}; + +} /* end of namespace */ + +#endif diff --git a/regression_test/realtime/config.cfg b/regression_test/realtime/config.cfg index 6f3814caf..9228015fe 100644 --- a/regression_test/realtime/config.cfg +++ b/regression_test/realtime/config.cfg @@ -16,3 +16,4 @@ ConsoleMask := TTCN_ERROR | TTCN_TESTCASE | TTCN_STATISTICS [EXECUTE] realtimeNow +realtimeTimestamp diff --git a/regression_test/realtime/realtimeTimestamp.ttcn b/regression_test/realtime/realtimeTimestamp.ttcn new file mode 100644 index 000000000..9bfb6acae --- /dev/null +++ b/regression_test/realtime/realtimeTimestamp.ttcn @@ -0,0 +1,681 @@ +/****************************************************************************** + * Copyright (c) 2000-2018 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v2.0 + * which accompanies this distribution, and is available at + * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html + * + * Contributors: + * Baranyi, Botond + * + ******************************************************************************/ + +// This module tests timestamp redirects for real-time port operations +module realtimeTimestamp { + +signature Sig(inout integer p) return charstring exception(boolean); + +type port PortMsg message realtime { + inout integer +} + +type port PortProc procedure realtime { + inout Sig +} + +type component CT { + port PortMsg ptMsg; + port PortProc ptProc; +} + +type enumerated Operation { + Receive, CheckReceive, Trigger, + Getcall, CheckGetcall, Getreply, CheckGetreply, + Catch, CheckCatch, Check } + +external function ef_incoming_message(in integer p_msg, in boolean p_set_timestamp); +external function ef_incoming_call(in integer p_par, in boolean p_set_timestamp); +external function ef_incoming_reply(in integer p_par, in charstring p_ret, in boolean p_set_timestamp); +external function ef_incoming_exception(in boolean p_ex, in boolean p_set_timestamp); + +///////////////////////////////////////////////////////////////////////// +///////////////// Test function for all operations ////////////////////// +///////////////////////////////////////////////////////////////////////// + +function f_test_timestamp(in Operation p_operation, in boolean p_any_port, in boolean p_set_timestamp) runs on CT { + var float time_before := now, time_operation, time_after; + + // initiate the specified operation through an external function + // (these simulate the arrival of a message/call/reply/exception from the system component, + // and either set or don't set the timestamp) + select (p_operation) { + case (Receive, CheckReceive, Trigger, Check) { + ef_incoming_message(5, p_set_timestamp); + } + case (Getcall, CheckGetcall) { + ef_incoming_call(5, p_set_timestamp); + } + case (Getreply, CheckGetreply) { + ef_incoming_reply(5, "x", p_set_timestamp); + } + case (Catch, CheckCatch) { + ef_incoming_exception(true, p_set_timestamp); + } + } + + // start a timer (just in case) + timer t := 0.5; + t.start; + + if (p_any_port) { + alt { // operations on 'any port' + [p_operation == Receive ] any port.receive -> timestamp time_operation { } + [p_operation == CheckReceive ] any port.check(receive -> timestamp time_operation) { } + [p_operation == Trigger ] any port.trigger -> timestamp time_operation { } + [p_operation == Getcall ] any port.getcall -> timestamp time_operation { } + [p_operation == CheckGetcall ] any port.check(getcall -> timestamp time_operation) { } + [p_operation == Getreply ] any port.getreply -> timestamp time_operation { } + [p_operation == CheckGetreply] any port.check(getreply -> timestamp time_operation) { } + [p_operation == Catch ] any port.catch -> timestamp time_operation { } + [p_operation == CheckCatch ] any port.check(catch -> timestamp time_operation) { } + [p_operation == Check ] any port.check(-> timestamp time_operation) { } + [] t.timeout { setverdict(fail, "Operation timed out."); } + } + } + else { + alt { // operations on specific ports + [p_operation == Receive ] ptMsg.receive(integer: ?) -> timestamp time_operation { } + [p_operation == CheckReceive ] ptMsg.check(receive(integer: ?) -> timestamp time_operation) { } + [p_operation == Trigger ] ptMsg.trigger(integer: ?) -> timestamp time_operation { } + [p_operation == Getcall ] ptProc.getcall(Sig: { ? }) -> timestamp time_operation { } + [p_operation == CheckGetcall ] ptProc.check(getcall(Sig: { ? }) -> timestamp time_operation) { } + [p_operation == Getreply ] ptProc.getreply(Sig: { ? } value charstring: ?) -> timestamp time_operation { } + [p_operation == CheckGetreply] ptProc.check(getreply(Sig: { ? } value charstring: ?) -> timestamp time_operation) { } + [p_operation == Catch ] ptProc.catch(Sig, boolean: ?) -> timestamp time_operation { } + [p_operation == CheckCatch ] ptProc.check(catch(Sig, boolean: ?) -> timestamp time_operation) { } + [p_operation == Check ] ptMsg.check(-> timestamp time_operation) { } + [] t.timeout { setverdict(fail, "Operation timed out."); } + } + } + + // check results + time_after := now; + if (p_set_timestamp) { + if (time_before > time_operation or time_operation > time_after) { + setverdict(fail, "Incorrect times measured. Before: ", time_before, ", check-catch: ", time_operation, ", after: ", time_after, "."); + } + } + else if (isbound(time_operation)) { + setverdict(fail, "Timestamp was supposed to be unset."); + } + setverdict(pass); +} + +///////////////////////////////////////////////////////////////////////// +////////////////////////// Test cases /////////////////////////////////// +///////////////////////////////////////////////////////////////////////// + +testcase tc_timestamp_receive_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(Receive, false, true); +} + +testcase tc_timestamp_receive_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(Receive, false, true)); + ct.done; +} + +testcase tc_timestamp_receive_any_port_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(Receive, true, true); +} + +testcase tc_timestamp_receive_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(Receive, true, true)); + ct.done; +} + +testcase tc_timestamp_check_receive_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(CheckReceive, false, true); +} + +testcase tc_timestamp_check_receive_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(CheckReceive, false, true)); + ct.done; +} + +testcase tc_timestamp_check_receive_any_port_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(CheckReceive, true, true); +} + +testcase tc_timestamp_check_receive_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(CheckReceive, true, true)); + ct.done; +} + +testcase tc_timestamp_trigger_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(Trigger, false, true); +} + +testcase tc_timestamp_trigger_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(Trigger, false, true)); + ct.done; +} + +testcase tc_timestamp_trigger_any_port_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(Trigger, true, true); +} + +testcase tc_timestamp_trigger_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(Trigger, true, true)); + ct.done; +} + +testcase tc_timestamp_getcall_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Getcall, false, true); +} + +testcase tc_timestamp_getcall_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Getcall, false, true)); + ct.done; +} + +testcase tc_timestamp_getcall_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Getcall, true, true); +} + +testcase tc_timestamp_getcall_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Getcall, true, true)); + ct.done; +} + +testcase tc_timestamp_check_getcall_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckGetcall, false, true); +} + +testcase tc_timestamp_check_getcall_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckGetcall, false, true)); + ct.done; +} + +testcase tc_timestamp_check_getcall_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckGetcall, true, true); +} + +testcase tc_timestamp_check_getcall_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckGetcall, true, true)); + ct.done; +} + +testcase tc_timestamp_getreply_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Getreply, false, true); +} + +testcase tc_timestamp_getreply_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Getreply, false, true)); + ct.done; +} + +testcase tc_timestamp_getreply_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Getreply, true, true); +} + +testcase tc_timestamp_getreply_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Getreply, true, true)); + ct.done; +} + +testcase tc_timestamp_check_getreply_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckGetreply, false, true); +} + +testcase tc_timestamp_check_getreply_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckGetreply, false, true)); + ct.done; +} + +testcase tc_timestamp_check_getreply_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckGetreply, true, true); +} + +testcase tc_timestamp_check_getreply_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckGetreply, true, true)); + ct.done; +} + +testcase tc_timestamp_catch_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Catch, false, true); +} + +testcase tc_timestamp_catch_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Catch, false, true)); + ct.done; +} + +testcase tc_timestamp_catch_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Catch, true, true); +} + +testcase tc_timestamp_catch_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Catch, true, true)); + ct.done; +} + +testcase tc_timestamp_check_catch_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckCatch, false, true); +} + +testcase tc_timestamp_check_catch_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckCatch, false, true)); + ct.done; +} + +testcase tc_timestamp_check_catch_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckCatch, true, true); +} + +testcase tc_timestamp_check_catch_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckCatch, true, true)); + ct.done; +} + +testcase tc_timestamp_check_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Check, false, true); +} + +testcase tc_timestamp_check_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Check, false, true)); + ct.done; +} + +testcase tc_timestamp_check_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Check, true, true); +} + +testcase tc_timestamp_check_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Check, true, true)); + ct.done; +} + +testcase tc_no_timestamp_receive_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(Receive, false, false); +} + +testcase tc_no_timestamp_receive_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(Receive, false, false)); + ct.done; +} + +testcase tc_no_timestamp_receive_any_port_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(Receive, true, false); +} + +testcase tc_no_timestamp_receive_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(Receive, true, false)); + ct.done; +} + +testcase tc_no_timestamp_check_receive_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(CheckReceive, false, false); +} + +testcase tc_no_timestamp_check_receive_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(CheckReceive, false, false)); + ct.done; +} + +testcase tc_no_timestamp_check_receive_any_port_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(CheckReceive, true, false); +} + +testcase tc_no_timestamp_check_receive_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(CheckReceive, true, false)); + ct.done; +} + +testcase tc_no_timestamp_trigger_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(Trigger, false, false); +} + +testcase tc_no_timestamp_trigger_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(Trigger, false, false)); + ct.done; +} + +testcase tc_no_timestamp_trigger_any_port_mtc() runs on CT { + map(self:ptMsg, system:ptMsg); + f_test_timestamp(Trigger, true, false); +} + +testcase tc_no_timestamp_trigger_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptMsg, system:ptMsg); + ct.start(f_test_timestamp(Trigger, true, false)); + ct.done; +} + +testcase tc_no_timestamp_getcall_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Getcall, false, false); +} + +testcase tc_no_timestamp_getcall_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Getcall, false, false)); + ct.done; +} + +testcase tc_no_timestamp_getcall_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Getcall, true, false); +} + +testcase tc_no_timestamp_getcall_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Getcall, true, false)); + ct.done; +} + +testcase tc_no_timestamp_check_getcall_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckGetcall, false, false); +} + +testcase tc_no_timestamp_check_getcall_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckGetcall, false, false)); + ct.done; +} + +testcase tc_no_timestamp_check_getcall_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckGetcall, true, false); +} + +testcase tc_no_timestamp_check_getcall_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckGetcall, true, false)); + ct.done; +} + +testcase tc_no_timestamp_getreply_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Getreply, false, false); +} + +testcase tc_no_timestamp_getreply_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Getreply, false, false)); + ct.done; +} + +testcase tc_no_timestamp_getreply_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Getreply, true, false); +} + +testcase tc_no_timestamp_getreply_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Getreply, true, false)); + ct.done; +} + +testcase tc_no_timestamp_check_getreply_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckGetreply, false, false); +} + +testcase tc_no_timestamp_check_getreply_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckGetreply, false, false)); + ct.done; +} + +testcase tc_no_timestamp_check_getreply_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckGetreply, true, false); +} + +testcase tc_no_timestamp_check_getreply_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckGetreply, true, false)); + ct.done; +} + +testcase tc_no_timestamp_catch_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Catch, false, false); +} + +testcase tc_no_timestamp_catch_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Catch, false, false)); + ct.done; +} + +testcase tc_no_timestamp_catch_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Catch, true, false); +} + +testcase tc_no_timestamp_catch_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Catch, true, false)); + ct.done; +} + +testcase tc_no_timestamp_check_catch_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckCatch, false, false); +} + +testcase tc_no_timestamp_check_catch_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckCatch, false, false)); + ct.done; +} + +testcase tc_no_timestamp_check_catch_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(CheckCatch, true, false); +} + +testcase tc_no_timestamp_check_catch_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(CheckCatch, true, false)); + ct.done; +} + +testcase tc_no_timestamp_check_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Check, false, false); +} + +testcase tc_no_timestamp_check_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Check, false, false)); + ct.done; +} + +testcase tc_no_timestamp_check_any_port_mtc() runs on CT { + map(self:ptProc, system:ptProc); + f_test_timestamp(Check, true, false); +} + +testcase tc_no_timestamp_check_any_port_ptc() runs on CT { + var CT ct := CT.create; + map(ct:ptProc, system:ptProc); + ct.start(f_test_timestamp(Check, true, false)); + ct.done; +} + +control { + execute(tc_timestamp_receive_mtc()); + execute(tc_timestamp_receive_ptc()); + execute(tc_timestamp_receive_any_port_mtc()); + execute(tc_timestamp_receive_any_port_ptc()); + execute(tc_timestamp_check_receive_mtc()); + execute(tc_timestamp_check_receive_ptc()); + execute(tc_timestamp_check_receive_any_port_mtc()); + execute(tc_timestamp_check_receive_any_port_ptc()); + execute(tc_timestamp_trigger_mtc()); + execute(tc_timestamp_trigger_ptc()); + execute(tc_timestamp_trigger_any_port_mtc()); + execute(tc_timestamp_trigger_any_port_ptc()); + execute(tc_timestamp_getcall_mtc()); + execute(tc_timestamp_getcall_ptc()); + execute(tc_timestamp_getcall_any_port_mtc()); + execute(tc_timestamp_getcall_any_port_ptc()); + execute(tc_timestamp_check_getcall_mtc()); + execute(tc_timestamp_check_getcall_ptc()); + execute(tc_timestamp_check_getcall_any_port_mtc()); + execute(tc_timestamp_check_getcall_any_port_ptc()); + execute(tc_timestamp_getreply_mtc()); + execute(tc_timestamp_getreply_ptc()); + execute(tc_timestamp_getreply_any_port_mtc()); + execute(tc_timestamp_getreply_any_port_ptc()); + execute(tc_timestamp_check_getreply_mtc()); + execute(tc_timestamp_check_getreply_ptc()); + execute(tc_timestamp_check_getreply_any_port_mtc()); + execute(tc_timestamp_check_getreply_any_port_ptc()); + execute(tc_timestamp_catch_mtc()); + execute(tc_timestamp_catch_ptc()); + execute(tc_timestamp_catch_any_port_mtc()); + execute(tc_timestamp_catch_any_port_ptc()); + execute(tc_timestamp_check_catch_mtc()); + execute(tc_timestamp_check_catch_ptc()); + execute(tc_timestamp_check_catch_any_port_mtc()); + execute(tc_timestamp_check_catch_any_port_ptc()); + execute(tc_timestamp_check_mtc()); + execute(tc_timestamp_check_ptc()); + execute(tc_timestamp_check_any_port_mtc()); + execute(tc_timestamp_check_any_port_ptc()); + execute(tc_no_timestamp_receive_mtc()); + execute(tc_no_timestamp_receive_ptc()); + execute(tc_no_timestamp_receive_any_port_mtc()); + execute(tc_no_timestamp_receive_any_port_ptc()); + execute(tc_no_timestamp_check_receive_mtc()); + execute(tc_no_timestamp_check_receive_ptc()); + execute(tc_no_timestamp_check_receive_any_port_mtc()); + execute(tc_no_timestamp_check_receive_any_port_ptc()); + execute(tc_no_timestamp_trigger_mtc()); + execute(tc_no_timestamp_trigger_ptc()); + execute(tc_no_timestamp_trigger_any_port_mtc()); + execute(tc_no_timestamp_trigger_any_port_ptc()); + execute(tc_no_timestamp_getcall_mtc()); + execute(tc_no_timestamp_getcall_ptc()); + execute(tc_no_timestamp_getcall_any_port_mtc()); + execute(tc_no_timestamp_getcall_any_port_ptc()); + execute(tc_no_timestamp_check_getcall_mtc()); + execute(tc_no_timestamp_check_getcall_ptc()); + execute(tc_no_timestamp_check_getcall_any_port_mtc()); + execute(tc_no_timestamp_check_getcall_any_port_ptc()); + execute(tc_no_timestamp_getreply_mtc()); + execute(tc_no_timestamp_getreply_ptc()); + execute(tc_no_timestamp_getreply_any_port_mtc()); + execute(tc_no_timestamp_getreply_any_port_ptc()); + execute(tc_no_timestamp_check_getreply_mtc()); + execute(tc_no_timestamp_check_getreply_ptc()); + execute(tc_no_timestamp_check_getreply_any_port_mtc()); + execute(tc_no_timestamp_check_getreply_any_port_ptc()); + execute(tc_no_timestamp_catch_mtc()); + execute(tc_no_timestamp_catch_ptc()); + execute(tc_no_timestamp_catch_any_port_mtc()); + execute(tc_no_timestamp_catch_any_port_ptc()); + execute(tc_no_timestamp_check_catch_mtc()); + execute(tc_no_timestamp_check_catch_ptc()); + execute(tc_no_timestamp_check_catch_any_port_mtc()); + execute(tc_no_timestamp_check_catch_any_port_ptc()); + execute(tc_no_timestamp_check_mtc()); + execute(tc_no_timestamp_check_ptc()); + execute(tc_no_timestamp_check_any_port_mtc()); + execute(tc_no_timestamp_check_any_port_ptc()); +} + +} diff --git a/xsdconvert/GeneralFunctions.cc b/xsdconvert/GeneralFunctions.cc index 9c9141a4d..95b0314ee 100644 --- a/xsdconvert/GeneralFunctions.cc +++ b/xsdconvert/GeneralFunctions.cc @@ -67,13 +67,13 @@ void XSDName2TTCN3Name(const Mstring& in_str, const Mstring& in_namespace, "kill", "killed", "label", "language", "length", "log", "map", "match", "message", "mixed", "mod", "modifies", "module", "modulepar", "mtc", - "noblock", "none", "not", "not4b", "nowait", "null", + "noblock", "none", "not", "not4b", "now", "nowait", "null", "objid", "octetstring", "of", "omit", "on", "optional", "or", "or4b", "out", "override", "param", "pass", "pattern", "permutation", "port", "present", "private", "procedure", "public", - "raise", "read", "receive", "record", "recursive", "refers", "rem", "repeat", "reply", "return", "running", "runs", + "raise", "read", "realtime", "receive", "record", "recursive", "refers", "rem", "repeat", "reply", "return", "running", "runs", "select", "self", "send", "sender", "set", "setverdict", "signature", "start", "stop", "subset", "superset", "system", - "template", "testcase", "timeout", "timer", "to", "trigger", "true", "type", + "template", "testcase", "timeout", "timer", "timestamp", "to", "trigger", "true", "type", "union", "universal", "unmap", "value", "valueof", "var", "variant", "verdicttype", "while", "with", -- GitLab