diff --git a/compiler2/compiler.1 b/compiler2/compiler.1 index 997b09368dccaf138c2503da0aba7aae1e64574d..dd9051efa61fbfff38cb768a788b1cc6613cacfa 100644 --- a/compiler2/compiler.1 +++ b/compiler2/compiler.1 @@ -3,7 +3,7 @@ compiler \- TTCN-3 and ASN.1 to C++ translator .SH SYNOPSIS .B compiler -.RB "[\| " \-abcdDeEfgijlLMnNpqrRsStuwxXyY " \|]" +.RB "[\| " \-abcdDeEfgiIjlLMnNpqrRsStuwxXyY " \|]" .RB "[\| " \-V .IR " verb_level" " \|]" .RB "[\| " \-J @@ -119,6 +119,9 @@ will contain only the the column numbers will remain hidden. This option provides backward compatibility with the error message format of earlier versions. .TP +.B \-I +Enables real-time testing features. +.TP .B \-j Disables JSON encoder/decoder functions. .TP diff --git a/compiler2/main.cc b/compiler2/main.cc index 59372954c21efcb1429c1f0916c04caacf2f0a92..e6a43882f44423cdfc6aad97deae175162169895 100644 --- a/compiler2/main.cc +++ b/compiler2/main.cc @@ -99,8 +99,8 @@ boolean generate_skeleton = FALSE, force_overwrite = FALSE, force_gen_seof = FALSE, omit_in_value_list = FALSE, warnings_for_bad_variants = FALSE, debugger_active = FALSE, legacy_unbound_union_fields = FALSE, split_to_slices = FALSE, - legacy_untagged_union, disable_user_info, legacy_codec_handling = FALSE; - // use legacy codec handling until the implementation of the new one is finished + legacy_untagged_union, disable_user_info, legacy_codec_handling = FALSE, + realtime_features = FALSE; // Default code splitting mode is set to 'no splitting'. CodeGenHelper::split_type code_splitting_mode = CodeGenHelper::SPLIT_NONE; @@ -395,7 +395,7 @@ static boolean is_valid_asn1_filename(const char* file_name) static void usage() { fprintf(stderr, "\n" - "usage: %s [-abcdDeEfgijlLMnNOpqrRsStuwxXyY] [-J file] [-K file] [-z file] [-V verb_level]\n" + "usage: %s [-abcdDeEfgiIjlLMnNOpqrRsStuwxXyY] [-J file] [-K file] [-z file] [-V verb_level]\n" " [-o dir] [-U none|type|'number'] [-P modulename.top_level_pdu_name] [-Q number] ...\n" " [-T] module.ttcn [-A] module.asn ...\n" " or %s -v\n" @@ -413,6 +413,7 @@ static void usage() " -f: force overwriting of output files\n" " -g: emulate GCC error/warning message format\n" " -i: use only line numbers in error/warning messages\n" + " -I: enable real-time testing features\n" " -j: disable JSON encoder/decoder functions\n" " -J file: read input files from file\n" " -K file: enable selective code coverage\n" @@ -500,7 +501,7 @@ int main(int argc, char *argv[]) Sflag = false, Kflag = false, jflag = false, zflag = false, Fflag = false, Mflag = false, Eflag = false, nflag = false, Bflag = false, errflag = false, print_usage = false, ttcn2json = false, Nflag = false, Dflag = false, - eflag = false, Oflag = false; + eflag = false, Oflag = false, Iflag = false; CodeGenHelper cgh; @@ -596,7 +597,7 @@ int main(int argc, char *argv[]) if (!ttcn2json) { for ( ; ; ) { - int c = getopt(argc, argv, "aA:bBcC:dDeEfFgijJ:K:lLMnNo:OpP:qQ:rRsStT:uU:vV:wxXyYz:0-"); + int c = getopt(argc, argv, "aA:bBcC:dDeEfFgiIjJ:K:lLMnNo:OpP:qQ:rRsStT:uU:vV:wxXyYz:0-"); if (c == -1) break; switch (c) { case 'a': @@ -670,6 +671,10 @@ int main(int argc, char *argv[]) SET_FLAG(i); output_only_linenum = TRUE; break; + case 'I': + SET_FLAG(I); + realtime_features = TRUE; + break; case 'J': file_list_file_name = optarg; break; @@ -839,7 +844,7 @@ int main(int argc, char *argv[]) bflag || fflag || iflag || lflag || oflag || pflag || qflag || rflag || sflag || tflag || uflag || wflag || xflag || Xflag || Rflag || Uflag || yflag || Kflag || jflag || zflag || Fflag || Mflag || Eflag || - nflag || Bflag || Dflag || eflag || Oflag) { + nflag || Bflag || Dflag || eflag || Oflag || Iflag) { errflag = true; print_usage = true; } diff --git a/compiler2/main.hh b/compiler2/main.hh index b3172d11dceed058635a5b30fcd484682ecba2f6..700d3c2dcf1f8d0c736e863146c7a266616c488b 100644 --- a/compiler2/main.hh +++ b/compiler2/main.hh @@ -52,7 +52,7 @@ extern boolean generate_skeleton, force_overwrite, include_line_info, implicit_json_encoding, json_refs_for_all_types, force_gen_seof, omit_in_value_list, warnings_for_bad_variants, debugger_active, legacy_unbound_union_fields, split_to_slices, legacy_untagged_union, - disable_user_info, legacy_codec_handling; + disable_user_info, legacy_codec_handling, realtime_features; extern const char *expected_platform; diff --git a/compiler2/makefile.c b/compiler2/makefile.c index 3fc4e93fb721acf96915405828ff5c90f52ffbed..b8f21cde4614f23ff7acb872d3d4ccd94b3a6b94 100644 --- a/compiler2/makefile.c +++ b/compiler2/makefile.c @@ -272,6 +272,7 @@ struct makefile_struct { boolean disable_predef_ext_folder; boolean enable_legacy_encoding; boolean disable_userinfo; + boolean realtime_features; struct string_list* solspeclibraries; /* not owned */ struct string_list* sol8speclibraries; /* not owned */ struct string_list* linuxspeclibraries; /* not owned */ @@ -343,6 +344,7 @@ static void init_makefile_struct(struct makefile_struct *makefile) makefile->disable_predef_ext_folder = FALSE; makefile->enable_legacy_encoding = FALSE; makefile->disable_userinfo = FALSE; + makefile->realtime_features = FALSE; makefile->solspeclibraries = NULL; makefile->sol8speclibraries = NULL; makefile->linuxspeclibraries = NULL; @@ -2250,7 +2252,7 @@ static void print_makefile(struct makefile_struct *makefile) "AR = ar\n" "ARFLAGS = \n\n" "# Flags for the TTCN-3 and ASN.1 compiler:\n" - "COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n" + "COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n" "# Execution mode: (either ttcn3 or ttcn3-parallel)\n" "TTCN3_LIB = ttcn3%s%s%s\n\n" #ifdef LICENSE @@ -2295,6 +2297,7 @@ static void print_makefile(struct makefile_struct *makefile) (makefile->tcov_file_name ? makefile->tcov_file_name : ""), (makefile->profiled_file_list ? " -z $(PROFILED_FILE_LIST)" : ""), (makefile->disable_userinfo ? " -D" : ""), + (makefile->realtime_features ? " -I" : ""), /* end of COMPILER FLAGS */ (makefile->use_runtime_2 ? "-rt2" : ""), /* TTCN3_LIB */ (makefile->single_mode ? "" : "-parallel"), @@ -4675,7 +4678,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[], boolean linenumbersonlymsg, boolean includesourceinfo, boolean addsourcelineinfo, boolean suppresswarnings, boolean outparamboundness, boolean omit_in_value_list, boolean warnings_for_bad_variants, boolean activate_debugger, boolean ignore_untagged_on_top_union, boolean disable_predef_ext_folder, boolean enable_legacy_encoding, boolean disable_userinfo, - struct string_list* solspeclibraries, struct string_list* sol8speclibraries, + boolean realtime_features, struct string_list* solspeclibraries, struct string_list* sol8speclibraries, struct string_list* linuxspeclibraries, struct string_list* freebsdspeclibraries, struct string_list* win32speclibraries, const char* ttcn3preprocessor, struct string_list* linkerlibraries, struct string_list* additionalObjects, struct string_list* linkerlibsearchpath, char* generatorCommandOutput, @@ -4732,6 +4735,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[], makefile.disable_predef_ext_folder = disable_predef_ext_folder; makefile.enable_legacy_encoding = enable_legacy_encoding; makefile.disable_userinfo = disable_userinfo; + makefile.realtime_features = realtime_features; makefile.solspeclibraries = solspeclibraries; makefile.sol8speclibraries = sol8speclibraries; makefile.linuxspeclibraries = linuxspeclibraries; @@ -4895,6 +4899,7 @@ static void usage(void) " -f: force overwriting of the output Makefile\n" " -g: generate Makefile for use with GNU make\n" " -G: enable legacy encoding rules\n" + " -i: enable real-time testing features\n" " -I path: Add path to the search paths when using TPD files\n" " -J file: The names of files taken from file instead of command line\n" " -K file: enable selective code coverage\n" @@ -4952,7 +4957,7 @@ int main(int argc, char *argv[]) Sflag = FALSE, Vflag = FALSE, Dflag = FALSE, Wflag = FALSE, djflag = FALSE, doerflag = FALSE, Zflag = FALSE, Hflag = FALSE, Mflag = FALSE, diflag = FALSE, zflag = FALSE, Eflag = FALSE, nflag = FALSE, - Nflag = FALSE, Gflag = FALSE, duflag = FALSE; + Nflag = FALSE, Gflag = FALSE, duflag = FALSE, iflag = FALSE; boolean error_flag = FALSE; char *output_file = NULL; char *ets_name = NULL; @@ -5012,7 +5017,7 @@ int main(int argc, char *argv[]) } for ( ; ; ) { - int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgGI:J:K:o:lLmMnNpP:rRsSt:TU:vVwWXYz:ZH"); + int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgGiI:J:K:o:lLmMnNpP:rRsSt:TU:vVwWXYz:ZH"); if (c == -1) break; switch (c) { case 'O': @@ -5074,6 +5079,9 @@ int main(int argc, char *argv[]) case 'H': SET_FLAG(H); break; + case 'i': + SET_FLAG(i); + break; case 'J': file_list_file_name = optarg; break; @@ -5193,7 +5201,8 @@ int main(int argc, char *argv[]) if ( aflag || bflag || cflag || Cflag || dflag || eflag || fflag || Fflag || gflag || mflag || oflag || lflag || pflag || Pflag || rflag || Rflag || sflag || Gflag || tflag || Tflag || Vflag || wflag || Xflag || Kflag || Dflag || Wflag || Yflag - || Zflag || Hflag || Mflag || zflag || Eflag || nflag || n_other_files > 0 || n_search_paths > 0) + || Zflag || Hflag || Mflag || zflag || Eflag || nflag || iflag + || n_other_files > 0 || n_search_paths > 0) error_flag = TRUE; } @@ -5392,7 +5401,7 @@ int main(int argc, char *argv[]) &Rflag, &lflag, &mflag, &Pflag, &Lflag, rflag, Fflag, Tflag, output_file, &abs_work_dir, sub_project_dirs, program_name, prj_graph_fp, create_symlink_list, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, &csmode, &quflag, &dsflag, &cxxcompiler, &optlevel, &optflags, &dbflag, &drflag, &dtflag, &dxflag, &djflag, &doerflag, &fxflag, &doflag, &gfflag, &lnflag, &isflag, - &asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &Nflag, &diflag, &Gflag, &duflag, + &asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &Nflag, &diflag, &Gflag, &duflag, &iflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, &ttcn3prep, linkerlibraries, additionalObjects, linkerlibsearchpath, Vflag, Dflag, &Zflag, &Hflag, &generatorCommandOutput, target_placement_list, Wflag, run_command_list, required_configs, &profiled_file_list, search_paths, n_search_paths, &makefileScript); @@ -5441,7 +5450,7 @@ int main(int argc, char *argv[]) file_list_file_name, Lflag, Zflag, Hflag, rflag ? sub_project_dirs : NULL, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, csmode, quflag, dsflag, cxxcompiler, optlevel, optflags, dbflag, drflag, dtflag, dxflag, djflag, doerflag, fxflag, doflag, gfflag, lnflag, isflag, asflag, wflag, Yflag, Mflag, Eflag, nflag, Nflag, diflag, - Gflag, duflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, + Gflag, duflag, iflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, ttcn3prep, linkerlibraries, additionalObjects, linkerlibsearchpath, generatorCommandOutput, target_placement_list); if (makefileScript != NULL) { diff --git a/compiler2/ttcn3/compiler.l b/compiler2/ttcn3/compiler.l index fd70560ff055d1ef3ea8394366ef4fdde0dd0ea1..a61697e9b5666457779c65aed31e09462272e747 100644 --- a/compiler2/ttcn3/compiler.l +++ b/compiler2/ttcn3/compiler.l @@ -39,6 +39,7 @@ #include "Ttcnstuff.hh" // at least for PortTypeBody::PortOperationMode_t #include "Statement.hh" // for Statement::statementtype_t #include "Attributes.hh" +#include "../main.hh" #include <string.h> #include <ctype.h> @@ -451,7 +452,6 @@ none RETURN(NoneKeyword); not RETURN(NotKeyword); not_a_number RETURN(NaNKeyword); not4b RETURN(Not4bKeyword); -now RETURN(NowKeyword); nowait RETURN(NowaitKeyword); null RETURN(NullKeyword); objid RETURN(ObjectIdentifierKeyword); @@ -475,7 +475,6 @@ 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); @@ -502,7 +501,6 @@ 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); @@ -521,6 +519,46 @@ with RETURN(WithKeyword); xor RETURN(XorKeyword); xor4b RETURN(Xor4bKeyword); + /* condition-based keywords + * (can be switched to identifiers with a command line option) */ + +now { + if (realtime_features) { + RETURN(NowKeyword); + } + else { + Location loc(infile, yylloc); + loc.warning("Keyword 'now' is treated as an identifier. Activate compiler " + "option '-I' to use real-time testing features."); + yylval.id = new Identifier(Identifier::ID_TTCN, string(yyleng, yytext)); + RETURN_LVAL(IDentifier); + } +} +realtime { + if (realtime_features) { + RETURN(RealtimeKeyword); + } + else { + Location loc(infile, yylloc); + loc.warning("Keyword 'realtime' is treated as an identifier. Activate " + "compiler option '-I' to use real-time testing features."); + yylval.id = new Identifier(Identifier::ID_TTCN, string(yyleng, yytext)); + RETURN_LVAL(IDentifier); + } +} +timestamp { + if (realtime_features) { + RETURN(TimestampKeyword); + } + else { + Location loc(infile, yylloc); + loc.warning("Keyword 'timestamp' is treated as an identifier. Activate " + "compiler option '-I' to use real-time testing features."); + yylval.id = new Identifier(Identifier::ID_TTCN, string(yyleng, yytext)); + RETURN_LVAL(IDentifier); + } +} + /* modifier keywords */ "@nocase" RETURN(NocaseKeyword); diff --git a/compiler2/ttcn3_makefilegen.1 b/compiler2/ttcn3_makefilegen.1 index c8c92df79b3329d26aca0c4ff225e63e76daa4c9..3277b717c82b44f86b062485c6d970a089fc529e 100644 --- a/compiler2/ttcn3_makefilegen.1 +++ b/compiler2/ttcn3_makefilegen.1 @@ -3,7 +3,7 @@ ttcn3_makefilegen \- Makefile Generator .SH SYNOPSIS .B ttcn3_makefilegen -.RB "[\| " \-acdEfglMnpRsSw " \|]" +.RB "[\| " \-acdEfgilMnpRsSw " \|]" .RB "[\| " \-e .IR " ETS_name" " \|]" .RB "[\| " \-o @@ -68,6 +68,9 @@ only. The resulting Makefile will be smaller and less redundant. It exploits the pattern substitution features of GNU make, which may cause syntax errors with other versions of make. .TP +.B \-i +Enables real-time testing features. +.TP .BI \-I " path" Adds the path to the list of search paths. .I path diff --git a/compiler2/xpather.cc b/compiler2/xpather.cc index 972a3c1bb8158c8bfd381f1790c62d466e2ac462..17f01d24b53f865e081b5d7c065d810f0376eb79 100644 --- a/compiler2/xpather.cc +++ b/compiler2/xpather.cc @@ -1269,7 +1269,8 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char* tpdName, c char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, boolean* p_doerflag, boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag, boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean *p_Eflag, boolean* p_nflag, boolean* p_Nflag, - boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, struct string_list* solspeclibs, struct string_list* sol8speclibs, + boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, boolean* p_realtime_features, + struct string_list* solspeclibs, struct string_list* sol8speclibs, struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep, struct string_list* linkerlibs, struct string_list* additionalObjects, struct string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, boolean *p_Zflag, boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir, @@ -1289,7 +1290,8 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg, char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, boolean* p_doerflag, boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag, boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean* p_Eflag, boolean* p_nflag, boolean* p_Nflag, - boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, struct string_list* solspeclibs, struct string_list* sol8speclibs, + boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, boolean* p_realtime_features, + struct string_list* solspeclibs, struct string_list* sol8speclibs, struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep, string_list* linkerlibs, string_list* additionalObjects, string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, boolean *p_Zflag, boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir, @@ -1319,7 +1321,8 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg, optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag, p_doerflag, p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag, p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_Nflag, - p_diflag, p_enable_legacy_encoding, p_disable_userinfo, solspeclibs, sol8speclibs, + p_diflag, p_enable_legacy_encoding, p_disable_userinfo, + p_realtime_features, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep, linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag, p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir, @@ -1348,7 +1351,8 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg, optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag, p_doerflag, p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag, p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_Nflag, - p_diflag, p_enable_legacy_encoding, p_disable_userinfo, solspeclibs, sol8speclibs, + p_diflag, p_enable_legacy_encoding, p_disable_userinfo, + p_realtime_features, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep, linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag, p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir, @@ -1452,7 +1456,8 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, boolean* p_doerflag, boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag, boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean* p_Eflag, boolean* p_nflag, boolean* p_Nflag, - boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, struct string_list* solspeclibs, struct string_list* sol8speclibs, + boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, boolean* p_realtime_features, + struct string_list* solspeclibs, struct string_list* sol8speclibs, struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep, string_list* linkerlibs, string_list* additionalObjects, string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, boolean *p_Zflag, boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir, @@ -2060,6 +2065,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c xsdbool2boolean(xpathCtx, actcfg, "ignoreUntaggedOnTopLevelUnion", p_Nflag); xsdbool2boolean(xpathCtx, actcfg, "enableLegacyEncoding", p_enable_legacy_encoding); xsdbool2boolean(xpathCtx, actcfg, "disableUserInformation", p_disable_userinfo); + xsdbool2boolean(xpathCtx, actcfg, "enableRealtimeTesting", p_realtime_features); projDesc = projGenHelper.getTargetOfProject(*p_project_name); if (projDesc) projDesc->setLinkingStrategy(*p_lflag); @@ -2954,6 +2960,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c my_diflag = *p_diflag, my_duflag = 0; boolean my_enable_legacy_encoding = 0; + boolean my_realtime_features = 0; char *my_ets = NULL; char *my_proj_name = NULL; @@ -3006,7 +3013,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c &my_quflag, &my_dsflag, cxxcompiler, optlevel, optflags, &my_dbflag, &my_drflag, &my_dtflag, &my_dxflag, &my_djflag, &my_doerflag, &my_fxflag, &my_doflag, &my_gfflag, &my_lnflag, &my_isflag, &my_asflag, &my_swflag, &my_Yflag, &my_Mflag, &my_Eflag, &my_nflag, &my_Nflag, &my_diflag, - &my_enable_legacy_encoding, &my_duflag, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs, + &my_enable_legacy_encoding, &my_duflag, &my_realtime_features, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep, linkerlibs, additionalObjects, linkerlibsearchp, Vflag, FALSE, &my_Zflag, &my_Hflag, NULL, NULL, prefix_workdir, run_command_list, seen_tpd_files, required_configs, profiled_file_list, search_paths, n_search_paths, makefileScript, all_configs); diff --git a/compiler2/xpather.h b/compiler2/xpather.h index 3b25e0fdf1a9b1377c32eddcee98bff2e03065d1..16aefa225b7c0fc555d5c232a5988ed824c070ef 100644 --- a/compiler2/xpather.h +++ b/compiler2/xpather.h @@ -287,7 +287,8 @@ tpd_result process_tpd(const char **p_tpd_name, const char *actcfg, boolean *disablejson, boolean *disableoer, boolean *forcexerinasn, boolean *defaultasomit, boolean *gccmessageformat, boolean *linenumber, boolean *includesourceinfo, boolean *addsourcelineinfo, boolean *suppresswarnings, boolean *outparamboundness, boolean *omit_in_value_list, boolean *warnings_for_bad_variants, boolean *activate_debugger, boolean* ignore_untagged_union, - boolean *disable_predef_exp_folder, boolean* enable_legacy_encoding, boolean* disable_userinfo, struct string_list* solspeclibs, struct string_list* sol8speclibs, + boolean *disable_predef_exp_folder, boolean* enable_legacy_encoding, boolean* disable_userinfo, boolean* realtime_features, + struct string_list* solspeclibs, struct string_list* sol8speclibs, struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3preprocessor, struct string_list* linkerlibs, struct string_list* additionalObjects, struct string_list* linkerlibsearchpath, boolean Vflag, boolean Dflag, boolean *Zflag, boolean *Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir, struct string2_list* run_command_list, diff --git a/etc/xsd/TPD.xsd b/etc/xsd/TPD.xsd index 04f070c2d740963c10a7ea9a94ba2b204ba8f2ae..594dda3ab7dddeacd562f1ca23d6952b4f2b2d72 100644 --- a/etc/xsd/TPD.xsd +++ b/etc/xsd/TPD.xsd @@ -136,6 +136,7 @@ <xs:element name="quietly" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="enableLegacyEncoding" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="disableUserInformation" minOccurs="0" maxOccurs="1" type="xs:boolean" /> + <xs:element name="enableRealtimeTesting" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="namingRules" minOccurs="0" maxOccurs="1" type="xs:normalizedString" /> <xs:element name="disableSubtypeChecking" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="CxxCompiler" minOccurs="0" maxOccurs="1" type="xs:normalizedString" /> diff --git a/function_test/Semantic_Analyser/realtime/Makefile b/function_test/Semantic_Analyser/realtime/Makefile index 8c650452065be483f7b5a23c9c4721c06812f962..ba1afbcc1f882338603db5703bbdcd307cbf7736 100644 --- a/function_test/Semantic_Analyser/realtime/Makefile +++ b/function_test/Semantic_Analyser/realtime/Makefile @@ -10,3 +10,5 @@ # ############################################################################## include ../common.mk + +COMPILER_FLAGS += -I diff --git a/regression_test/compileonly/Makefile b/regression_test/compileonly/Makefile index 811de6357720c4efbdd5ee296f162300a991cb0a..6ecc07bb430182009b4f341c43b25674a467dd0c 100644 --- a/regression_test/compileonly/Makefile +++ b/regression_test/compileonly/Makefile @@ -30,7 +30,7 @@ CODIRS := dynamicTemplate styleGuide topLevelPdu \ defaultParamUsageBeforeDecl deterministic readFromFile \ asn1_hyphen nameClash portTranslation UntaggedOnTopLevelUnionSwitch \ typeDescrGenWIthNoXER languageSpec asn1_opentype openTypeXER \ - asnStringSubtypes componentParameter + asnStringSubtypes componentParameter realtimeKeywords ifdef DYN CODIRS += mfgen-xsd diff --git a/regression_test/compileonly/realtimeKeywords/.gitignore b/regression_test/compileonly/realtimeKeywords/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..311f6e289fce796b8dae9d0c9b61398ea7f397ab --- /dev/null +++ b/regression_test/compileonly/realtimeKeywords/.gitignore @@ -0,0 +1,4 @@ +realtimeKeywords +realtimeKeywords.exe +realtimeKeywords*.cc +realtimeKeywords*.hh diff --git a/regression_test/compileonly/realtimeKeywords/Makefile b/regression_test/compileonly/realtimeKeywords/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..b8db0f70bcc902fd4ae5cdce545e37909bd64694 --- /dev/null +++ b/regression_test/compileonly/realtimeKeywords/Makefile @@ -0,0 +1,50 @@ +############################################################################## +# 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 +# +############################################################################## +TOPDIR := ../.. +include $(TOPDIR)/Makefile.regression + +.PHONY: all clean dep + +TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX) + +TTCN3_MODULES = realtimeKeywords.ttcn + +GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) +GENERATED_HEADERS = $(GENERATED_SOURCES:.cc=.hh) +ifdef CODE_SPLIT +GENERATED_SOURCES := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), .cc _seq.cc _set.cc _seqof.cc _setof.cc _union.cc)) +else ifdef SPLIT_TO_SLICES +POSTFIXES := $(foreach file, $(SPLIT_TO_SLICES), $(addsuffix $(file), _part_)) +POSTFIXES := $(foreach file, $(POSTFIXES), $(addprefix $(file), .cc)) +GENERATED_SOURCES2 := $(foreach file, $(GENERATED_SOURCES:.cc=), $(addprefix $(file), $(POSTFIXES))) +GENERATED_SOURCES += $(GENERATED_SOURCES2) +endif + +OBJECTS = $(GENERATED_SOURCES:.cc=.o) + +TARGET = realtimeKeywords$(EXESUFFIX) + +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) + +$(GENERATED_SOURCES) $(GENERATED_HEADERS): $(TTCN3_MODULES) + $(TTCN3_COMPILER) $(COMPILER_FLAGS) $^ + +clean distclean: + $(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \ + $(GENERATED_SOURCES) compile *.log + +dep: $(GENERATED_SOURCES) + makedepend $(CPPFLAGS) $(GENERATED_SOURCES) diff --git a/regression_test/compileonly/realtimeKeywords/realtimeKeywords.ttcn b/regression_test/compileonly/realtimeKeywords/realtimeKeywords.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..df6ad4dfa7bf8c98d847e13c83dc85bfb91a24df --- /dev/null +++ b/regression_test/compileonly/realtimeKeywords/realtimeKeywords.ttcn @@ -0,0 +1,25 @@ +/****************************************************************************** + * 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 + * + ******************************************************************************/ + +// Keywords from the real-time testing feature should behave as identifiers if the +// feature is disabled (for backward compatibility). +module realtimeKeywords { + +type record realtime {} + +template boolean now := true; + +function timestamp() return float { + return -1.0; +} + +} diff --git a/regression_test/realtime/Makefile b/regression_test/realtime/Makefile index 0738336cb5671a9c518b82860fd3f8fcf537c464..ae33679d11629f8f9a360c10e3c47a0590441743 100644 --- a/regression_test/realtime/Makefile +++ b/regression_test/realtime/Makefile @@ -15,6 +15,8 @@ include $(TOPDIR)/Makefile.regression .SUFFIXES: .ttcn .hh .PHONY: all clean dep run +COMPILER_FLAGS += -I + TTCN3_LIB = ttcn3$(RT2_SUFFIX)-parallel$(DYNAMIC_SUFFIX) TTCN3_MODULES = realtimeNow.ttcn realtimeTimestamp.ttcn diff --git a/usrguide/referenceguide/2-ttcn-3_limitations_in_this_version.adoc b/usrguide/referenceguide/2-ttcn-3_limitations_in_this_version.adoc index b05d298619e743e362186f025cc33c304f36da45..a7293ff0d7334b7e2730361283988ab65e6b967e 100644 --- a/usrguide/referenceguide/2-ttcn-3_limitations_in_this_version.adoc +++ b/usrguide/referenceguide/2-ttcn-3_limitations_in_this_version.adoc @@ -77,3 +77,4 @@ x := { i1 := x.i2 }; // assignment notation with self-reference (not OK) x.i3 := x.i1; // individual field assignment with self-reference (OK) // result: x := { i1 := 3, i2 := <unbound>, i3 := 3 } ---- +* Declaring multiple user ports (i.e. non-internal ports) with the same name is not fully supported. The generated headers of two modules containing user ports with the same name will cause C++ compilation errors, if one of the modules imports the other, or if it imports a module that imports the other, etc. It is advised to give all user ports unique names. diff --git a/usrguide/referenceguide/6-compiling_ttcn3_and_asn1_modules.adoc b/usrguide/referenceguide/6-compiling_ttcn3_and_asn1_modules.adoc index 76961fd5437313e1af86ab97168347f0b241a913..4581a971de5fa59e6f7a6c5dd49b65e66cdd62a7 100644 --- a/usrguide/referenceguide/6-compiling_ttcn3_and_asn1_modules.adoc +++ b/usrguide/referenceguide/6-compiling_ttcn3_and_asn1_modules.adoc @@ -18,7 +18,7 @@ The program compiler resides in the directory `$TTCN3_DIR/bin`. The command line syntax of the compiler is the following: [source] -compiler [ -abBcdDeEfgijlLMnNOpqrRstuwxXyY ] [ -J file ] [ -K file ] [ -z file ] [ -N old|new ][ -o dir ] [ -V n ] [ -P toplevel pdu ] [ -Qn ] [ -U none|type|"number" ] …[ -T ] module.ttcn [ -A ] module.asn … [ - module.ttcn module.asn … ] +compiler [ -abBcdDeEfgiIjlLMnNOpqrRstuwxXyY ] [ -J file ] [ -K file ] [ -z file ] [ -N old|new ][ -o dir ] [ -V n ] [ -P toplevel pdu ] [ -Qn ] [ -U none|type|"number" ] …[ -T ] module.ttcn [ -A ] module.asn … [ - module.ttcn module.asn … ] or @@ -114,6 +114,10 @@ If both `–g` and `–i` are specified, `-g` takes precedence. + The compiler error/warning messages will contain only the line numbers, the column numbers will remain hidden. This option provides backward compatibility with the error message format of earlier versions. +* `-I` ++ +Enables the use of real-time testing features, i.e. the test system clock ('now') and timestamp redirects. These features are disabled by default for backward compatibility. + * `-j` + Disables the generation of JSON encoder/decoder routines for all TTCN–3 types. @@ -310,7 +314,7 @@ The command line syntax of the makefile generator is the following: [source] ---- -usage: makefilegen [-abcdDEfFgGlLmMnNprRsStTVwWXZ] [-K file] [-P dir] +usage: makefilegen [-abcdDEfFgGilLmMnNprRsStTVwWXZ] [-K file] [-P dir] [-J file] [-U none|type|’number’] [-e ets_name] [-o dir|file] [-z file] [-t project_descriptor.tpd [-b buildconfig]] [-I path] [-O file] TTCN3_module[.ttcn] ... ASN1_module[.asn] ... XSD_MODULE.xsd ... Testport_name[.cc] ... @@ -359,6 +363,10 @@ Generates a Makefile that can be used with GNU `make` only. The resulting Makefi + Instructs the compiler to use the legacy encoding rules for semantic checking and for generating the code (see compiler option "-e" and its description in <<4-ttcn3_language_extensions.adoc#legacy-codec-handling, Legacy codec handling>>). +* `-i` ++ +Enables the use of real-time testing features, i.e. the test system clock ('now') and timestamp redirects. These features are disabled by default for backward compatibility. + * `-I path` + Add path to the list of search paths which are used to search for referred TPD-s. `path` must be an absolute path and multiple `–I` switches can be used. The search paths are used when the `–t` switch is also present and a referred TPD project cannot be found at the location specified by `projectRelativeURI`. In this case the `makefilegen` tool tries to find the TPD file using the paths provided by `path`. If the `tpdName` attribute of a `ReferencedProject` element is present in the TPD, then the value of the `tpdName` attribute will be used as a TPD filename during the search. However if the `tpdName` attribute is missing, then the name attribute’s value with the `.tpd` suffix will be used. If there are multiple paths specified then the first `.tpd` file with the correct name found in the list of search paths is taken. See 6.1.3.4 for an example. diff --git a/usrguide/referenceguide/8-the_titan_project_descriptor_file.adoc b/usrguide/referenceguide/8-the_titan_project_descriptor_file.adoc index 07c4881ecf9414b8faa6f5188440df052cbdc594..850480d3230b2b5012dc2504afa12abfae527210 100644 --- a/usrguide/referenceguide/8-the_titan_project_descriptor_file.adoc +++ b/usrguide/referenceguide/8-the_titan_project_descriptor_file.adoc @@ -228,6 +228,7 @@ Useful information can be found in TITAN Designer documentation <<13-references. |`disablePredefinedExternalFolder (OPENSSL_DIR and XMLDIR)` |- |- |false |O |`enableLegacyEncoding` |-G |-e |false |O |`disableUserInformation` |- |-D |false |O +|`enableRealtimeTesting` |-i |-I |false |O |`buildLevel (only in Eclipse, see below and in 6.1.6 The actual building in [17])`|- |- |"Level 5 - Creating Executable Test Suite with dependency update" |O |`ProjectSpecificRulesGenerator` |- |- |Used to place custom rules and new targets into the generated Makefile |O |`profiledFileList (enables profiling and code coverage in the specified modules)` |-z |-z |empty |O