diff --git a/compiler2/main.cc b/compiler2/main.cc index a9143eb202b71174e186bbf6a9d964257ccc3c64..69275ce9aea34f707afe144de44a841732d68881 100644 --- a/compiler2/main.cc +++ b/compiler2/main.cc @@ -78,6 +78,7 @@ using namespace Common; const char *output_dir = NULL; const char *tcov_file_name = NULL; const char *profiler_file_name = NULL; +const char *file_list_file_name = NULL; tcov_file_list *tcov_files = NULL; expstring_t effective_module_lines = NULL; expstring_t effective_module_functions = NULL; @@ -384,7 +385,7 @@ static boolean is_valid_asn1_filename(const char* file_name) static void usage() { fprintf(stderr, "\n" - "usage: %s [-abcdEfgijlLMnOpqrRsStuwxXyY] [-K file] [-z file] [-V verb_level]\n" + "usage: %s [-abcdEfgijlLMnOpqrRsStuwxXyY] [-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" @@ -401,6 +402,7 @@ static void usage() " -g: emulate GCC error/warning message format\n" " -i: use only line numbers in error/warning messages\n" " -j: disable JSON encoder/decoder functions\n" + " -J file: read input files from file\n" " -K file: enable selective code coverage\n" " -l: include source line info in C++ code\n" " -L: add source line info for logging\n" @@ -494,6 +496,8 @@ int main(int argc, char *argv[]) size_t n_modules = 0; module_struct *module_list = NULL; char* json_schema_name = NULL; + size_t n_files_from_file = 0; + char ** files_from_file = NULL; if (0 == strcmp(argv[1], "--ttcn2json")) { ttcn2json = true; @@ -575,7 +579,7 @@ int main(int argc, char *argv[]) if (!ttcn2json) { for ( ; ; ) { - int c = getopt(argc, argv, "aA:bBcC:dEfFgijK:lLMno:pP:qQ:rRsStT:uU:vV:wxXyYz:0-"); + int c = getopt(argc, argv, "aA:bBcC:dEfFgijJ:K:lLMno:pP:qQ:rRsStT:uU:vV:wxXyYz:0-"); if (c == -1) break; switch (c) { case 'a': @@ -645,6 +649,9 @@ int main(int argc, char *argv[]) SET_FLAG(i); output_only_linenum = TRUE; break; + case 'J': + file_list_file_name = optarg; + break; case 'K': SET_FLAG(K); tcov_file_name = optarg; @@ -832,7 +839,70 @@ int main(int argc, char *argv[]) output_dir); errflag = true; } - if (optind == argc && n_modules == 0) { + + if (file_list_file_name != NULL) { + FILE *fp = fopen(file_list_file_name, "r"); + if (fp != NULL) { + char buff[1024]; + // We store the -A and -T here too + while (fscanf(fp, "%s", buff) == 1) { + n_files_from_file++; + files_from_file = (char**) + Realloc(files_from_file, n_files_from_file * sizeof(*files_from_file)); + files_from_file[n_files_from_file - 1] = mcopystr(buff); + } + fclose(fp); + } else { + ERROR("Cannot open file `%s' for reading: %s", file_list_file_name, + strerror(errno)); + errno = 0; + errflag = true; + } + bool next_is_asn1 = false; + bool next_is_ttcn = false; + for (size_t i = 0; i < n_files_from_file; i++) { + // Check if -A or -T is present and continue to the next word if yes + if (next_is_ttcn == false && next_is_asn1 == false) { + if (strcmp(files_from_file[i], "-A") == 0) { + next_is_asn1 = true; + continue; + } else if (strcmp(files_from_file[i], "-T") == 0) { + next_is_ttcn = true; + continue; + } + } + Module::moduletype_t module_type = Module::MOD_UNKNOWN; + const char* file = files_from_file[i]; + if (next_is_asn1) { + module_type = Module::MOD_ASN; + next_is_asn1 = false; + } else if(next_is_ttcn) { + module_type = Module::MOD_TTCN; + next_is_ttcn = false; + } else if (strlen(files_from_file[i]) > 2) { + // The -A or -T can be given as -TMyTtcnfile.ttcn too + if (files_from_file[i][0] == '-') { + if (files_from_file[i][1] == 'A') { + file = files_from_file[i] + 2; + module_type = Module::MOD_ASN; + } else if (files_from_file[i][1] == 'T') { + file = files_from_file[i] + 2; + module_type = Module::MOD_TTCN; + } + } + } + if (module_type == Module::MOD_TTCN) { +#ifdef LICENSE + ttcn3_modules_present = true; +#endif + } else if (module_type == Module::MOD_ASN) { + asn1_modules_present = true; + } + add_module(n_modules, module_list, file, module_type); + } + } + + if (optind == argc && n_modules == 0 && n_files_from_file == 0) { ERROR("No input TTCN-3 or ASN.1 module was given."); errflag = true; } @@ -1156,6 +1226,10 @@ int main(int argc, char *argv[]) if (zflag) { free_profiler_data(); } + for (size_t i = 0; i < n_files_from_file; i++) { + Free(files_from_file[i]); + } + Free(files_from_file); // dbgnew.hh already does it: check_mem_leak(argv[0]); diff --git a/compiler2/makefile.c b/compiler2/makefile.c index 34c9176b15fc230357b2831f9b9b9fe0665cf740..2e33c9298db9fc980329c3cdf692ee8104e7ee63 100644 --- a/compiler2/makefile.c +++ b/compiler2/makefile.c @@ -4590,7 +4590,7 @@ static void usage(void) { fprintf(stderr, "\n" "usage: %s [-abc" C_flag "dDEfFglLmMnprRsStTVwWXZ] [-K file] [-z file ] [-P dir]" - " [-j file] [-U none|type|'number'] [-e ets_name] [-o dir|file]\n" + " [-J file] [-U none|type|'number'] [-e ets_name] [-o dir|file]\n" " [-t project_descriptor.tpd [-b buildconfig]]\n" " [-O file] ... module_name ... testport_name ...\n" " or %s -v\n" @@ -4607,7 +4607,7 @@ static void usage(void) " -f: force overwriting of the output Makefile\n" " -g: generate Makefile for use with GNU make\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" + " -J file: The names of files taken from file instead of command line" " -K file: enable selective code coverage\n" " -l: use dynamic linking\n" " -L: create makefile with library archive as the default target\n" @@ -4720,7 +4720,7 @@ int main(int argc, char *argv[]) } for ( ; ; ) { - int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgI:j:K:o:lLmMnpP:rRsSt:TU:vVwWXYz:ZH"); + int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgI:J:K:o:lLmMnpP:rRsSt:TU:vVwWXYz:ZH"); if (c == -1) break; switch (c) { case 'O': @@ -4779,7 +4779,7 @@ int main(int argc, char *argv[]) case 'H': SET_FLAG(H); break; - case 'j': + case 'J': file_list_file_name = optarg; break; case 'o': diff --git a/regression_test/XML/XmlWorkflow/bin/prj2mk.pl b/regression_test/XML/XmlWorkflow/bin/prj2mk.pl index 84021f21b73b20effe15578bcdfc410f25d490e2..54f0f68ecaff894cbda52757ef5727c16b15d619 100644 --- a/regression_test/XML/XmlWorkflow/bin/prj2mk.pl +++ b/regression_test/XML/XmlWorkflow/bin/prj2mk.pl @@ -116,9 +116,9 @@ close FILE; # Generate the makefile print("LD_LIBRARY_PATH is $ENV{LD_LIBRARY_PATH}\n");#temporary debug printout -print("$ENV{TTCN3_DIR}/bin/ttcn3_makefilegen -gs $split $rt2 -e XmlTest -j files.txt $xsdfiles2 \n"); +print("$ENV{TTCN3_DIR}/bin/ttcn3_makefilegen -gs $split $rt2 -e XmlTest -J files.txt $xsdfiles2 \n"); -system( "\$TTCN3_DIR/bin/ttcn3_makefilegen -gs $split $rt2 -e XmlTest -o Makefile.1 -j files.txt $xsdfiles2"); +system( "\$TTCN3_DIR/bin/ttcn3_makefilegen -gs $split $rt2 -e XmlTest -o Makefile.1 -J files.txt $xsdfiles2"); unlink $outfile; diff --git a/regression_test/compileonly/readFromFile/Makefile b/regression_test/compileonly/readFromFile/Makefile index ecd3814cd432e7835dd2ef9aad5e7cd2669d1b91..7e3ef05bf942a4152272d9fc8283443acfae48a4 100644 --- a/regression_test/compileonly/readFromFile/Makefile +++ b/regression_test/compileonly/readFromFile/Makefile @@ -17,7 +17,9 @@ COVERAGE_FLAG := -C endif MFGEN := $(TTCN3_DIR)/bin/ttcn3_makefilegen -MFGEN_FLAGS := -f $(RT2_FLAG) $(SPLIT_FLAG) +MFGEN_FLAGS := -fs $(RT2_FLAG) $(SPLIT_FLAG) -e Main +COMPILER := $(TTCN3_DIR)/bin/ttcn3_compiler +COMPILER_FLAGS := $(RT2_FLAG) $(SPLIT_FLAG) # ${MAKEPROG} has the same content as the built-in ${MAKE}, # except the special handling of ${MAKE} does not apply. @@ -25,8 +27,24 @@ MFGEN_FLAGS := -f $(RT2_FLAG) $(SPLIT_FLAG) # then fail on every subsequent invocation until a 'make clean' is done. MAKEPROG := ${MAKE} -all: - mkdir -p bin && cp files.txt bin/files.txt && cd bin && $(MFGEN) $(MFGEN_FLAGS) -j files.txt \ - && $(MAKEPROG) && make clean && cd .. && rm -rf bin +all: compiler makefile -.PHONY: all clean distclean run +compiler: + mkdir -p bin && cp compiler_files1.txt bin/files.txt && cd bin \ + && $(COMPILER) $(COMPILER_FLAGS) -J files.txt ../src/ASN1Module3.asn \ + && cd .. && rm -rf bin + + mkdir -p bin && cp compiler_files2.txt bin/files.txt && cd bin \ + && $(COMPILER) $(COMPILER_FLAGS) -J files.txt ../src/ASN1Module3.asn \ + && cd .. && rm -rf bin + +makefile: + mkdir -p bin && cp mfgen_files1.txt bin/files.txt && cd bin \ + && $(MFGEN) $(MFGEN_FLAGS) -J files.txt ../src/ASN1Module3.asn \ + && $(MAKEPROG) && ./Main && make clean && cd .. && rm -rf bin + + mkdir -p bin && cp mfgen_files2.txt bin/files.txt && cd bin \ + && $(MFGEN) $(MFGEN_FLAGS) -J files.txt ../src/ASN1Module3.asn \ + && $(MAKEPROG) && ./Main && make clean && cd .. && rm -rf bin + +.PHONY: all clean distclean run compiler makefile diff --git a/regression_test/compileonly/readFromFile/compiler_files1.txt b/regression_test/compileonly/readFromFile/compiler_files1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffa25e65f3ea76848641d7a7b6e8dc4413368085 --- /dev/null +++ b/regression_test/compileonly/readFromFile/compiler_files1.txt @@ -0,0 +1 @@ +../src/UsefulTtcn3Types.ttcn ../src/XSD.ttcn ../src/Module1.ttcn ../src/Module2.ttcn ../src/Module3.ttcn ../src/Module4.ttcn ../src/Module5.ttcn ../src/ASN1Module1.asn ../src/ASN1Module2.asn ../src/Main.ttcn \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/compiler_files2.txt b/regression_test/compileonly/readFromFile/compiler_files2.txt new file mode 100644 index 0000000000000000000000000000000000000000..3041a7225b1d84c33eaa24eccb74f2e24aed0b18 --- /dev/null +++ b/regression_test/compileonly/readFromFile/compiler_files2.txt @@ -0,0 +1,29 @@ + + + + ../src/UsefulTtcn3Types.ttcn + + -T ../src/XSD.ttcn + + + ../src/Module1.ttcn -T + + + ../src/Module2.ttcn + + + ../src/Module3.ttcn -T ../src/Module4.ttcn ../src/Module5.ttcn -A + + + + + + + ../src/ASN1Module1.asn -A../src/ASN1Module2.asn + + + + + + + -T../src/Main.ttcn \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/files.txt b/regression_test/compileonly/readFromFile/files.txt deleted file mode 100644 index 836ca8b34956c00dc6d4c0e00f397e3181efc2d6..0000000000000000000000000000000000000000 --- a/regression_test/compileonly/readFromFile/files.txt +++ /dev/null @@ -1,5 +0,0 @@ - ../src/Definitions.xsd ../src/MainNormal.ttcn - - - - ../src/MainExtNormal.ttcn \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/mfgen_files1.txt b/regression_test/compileonly/readFromFile/mfgen_files1.txt new file mode 100644 index 0000000000000000000000000000000000000000..ffa25e65f3ea76848641d7a7b6e8dc4413368085 --- /dev/null +++ b/regression_test/compileonly/readFromFile/mfgen_files1.txt @@ -0,0 +1 @@ +../src/UsefulTtcn3Types.ttcn ../src/XSD.ttcn ../src/Module1.ttcn ../src/Module2.ttcn ../src/Module3.ttcn ../src/Module4.ttcn ../src/Module5.ttcn ../src/ASN1Module1.asn ../src/ASN1Module2.asn ../src/Main.ttcn \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/mfgen_files2.txt b/regression_test/compileonly/readFromFile/mfgen_files2.txt new file mode 100644 index 0000000000000000000000000000000000000000..26b40d0e0951a98a8620d8456ef049de31c2da8b --- /dev/null +++ b/regression_test/compileonly/readFromFile/mfgen_files2.txt @@ -0,0 +1,31 @@ + + + + ../src/UsefulTtcn3Types.ttcn + + ../src/XSD.ttcn + + + ../src/Module1.ttcn + + + ../src/Module2.ttcn + + + ../src/Module3.ttcn ../src/Module4.ttcn ../src/Module5.ttcn + + + + + + + ../src/ASN1Module1.asn ../src/ASN1Module2.asn + + + + + + + + + ../src/Main.ttcn \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/ASN1Module1.asn b/regression_test/compileonly/readFromFile/src/ASN1Module1.asn new file mode 100644 index 0000000000000000000000000000000000000000..dac6b4c59846892d38fa37db378987851b4fe202 --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/ASN1Module1.asn @@ -0,0 +1,25 @@ +--///////////////////////////////////////////////////////////////////////////// +-- Copyright (c) 2000-2016 Ericsson Telecom AB +-- All rights reserved. This program and the accompanying materials +-- are made available under the terms of the Eclipse Public License v1.0 +-- which accompanies this distribution, and is available at +-- http://www.eclipse.org/legal/epl-v10.html +-- +-- Contributors: +-- Szabo, Bence Janos +-- +--///////////////////////////////////////////////////////////////////////////// +ASN1Module1 +DEFINITIONS + +AUTOMATIC TAGS + +::= + +BEGIN + +IMPORTS ; -- nothing + +asn1module1 INTEGER ::= 1 + +END \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/ASN1Module2.asn b/regression_test/compileonly/readFromFile/src/ASN1Module2.asn new file mode 100644 index 0000000000000000000000000000000000000000..75988338d0c3b7c5764bfc146656d2d6382e0a02 --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/ASN1Module2.asn @@ -0,0 +1,25 @@ +--///////////////////////////////////////////////////////////////////////////// +-- Copyright (c) 2000-2016 Ericsson Telecom AB +-- All rights reserved. This program and the accompanying materials +-- are made available under the terms of the Eclipse Public License v1.0 +-- which accompanies this distribution, and is available at +-- http://www.eclipse.org/legal/epl-v10.html +-- +-- Contributors: +-- Szabo, Bence Janos +-- +--///////////////////////////////////////////////////////////////////////////// +ASN1Module2 +DEFINITIONS + +AUTOMATIC TAGS + +::= + +BEGIN + +IMPORTS ; -- nothing + +asn1module2 INTEGER ::= 2 + +END \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/ASN1Module3.asn b/regression_test/compileonly/readFromFile/src/ASN1Module3.asn new file mode 100644 index 0000000000000000000000000000000000000000..7764bee53ab0cbcd4cda519a5457e87ae02e5f36 --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/ASN1Module3.asn @@ -0,0 +1,25 @@ +--///////////////////////////////////////////////////////////////////////////// +-- Copyright (c) 2000-2016 Ericsson Telecom AB +-- All rights reserved. This program and the accompanying materials +-- are made available under the terms of the Eclipse Public License v1.0 +-- which accompanies this distribution, and is available at +-- http://www.eclipse.org/legal/epl-v10.html +-- +-- Contributors: +-- Szabo, Bence Janos +-- +--///////////////////////////////////////////////////////////////////////////// +ASN1Module3 +DEFINITIONS + +AUTOMATIC TAGS + +::= + +BEGIN + +IMPORTS ; -- nothing + +asn1module3 INTEGER ::= 3 + +END \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/Definitions.xsd b/regression_test/compileonly/readFromFile/src/Definitions.xsd deleted file mode 100644 index 497f1dc98d0ac8a56d8ee3dfcdbdd5dd879a2847..0000000000000000000000000000000000000000 --- a/regression_test/compileonly/readFromFile/src/Definitions.xsd +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- - Copyright (c) 2000-2016 Ericsson Telecom AB - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - which accompanies this distribution, and is available at - http://www.eclipse.org/legal/epl-v10.html - - Contributors: - Szabo, Bence Janos ---> -<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" -xmlns:xsd="http://www.w3.org/2001/XMLSchema" -xmlns:this="www.example.org/Definitions" -targetNamespace="www.example.org/Definitions"> - -<xsd:element name="MyInt" type="xsd:integer"/> - -</xsd:schema> diff --git a/regression_test/compileonly/readFromFile/src/Main.ttcn b/regression_test/compileonly/readFromFile/src/Main.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..f3e9dbd16bb9f18d6b5524e394ec11ae69db9071 --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/Main.ttcn @@ -0,0 +1,40 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Szabo, Bence Janos + * + ******************************************************************************/ +module Main { + import from Module1 all; + import from Module2 all; + import from Module3 all; + import from Module4 all; + import from Module5 all; + import from ASN1Module1 language "ASN.1:2002" all; + import from ASN1Module2 language "ASN.1:2002" all; + import from ASN1Module3 language "ASN.1:2002" all; + import from XSD all; + import from UsefulTtcn3Types all; + + type component EmptyCT {} + + testcase tc_test() runs on EmptyCT { + var XSD.Integer sum := module1 + module2 + module3 + module4 + module5 + + asn1module1 + asn1module2 + asn1module3; + if (sum == 21) { + setverdict(pass); + } else { + setverdict(fail); + } + } + + control { + execute(tc_test()); + } + +} \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/MainNormal.ttcn b/regression_test/compileonly/readFromFile/src/Module1.ttcn similarity index 66% rename from regression_test/compileonly/readFromFile/src/MainNormal.ttcn rename to regression_test/compileonly/readFromFile/src/Module1.ttcn index 64b797c0b89cb2688d6f8792e0b9b6116ad102e5..c7fb83c51e1707b3630c9d90d80cf22433eded35 100644 --- a/regression_test/compileonly/readFromFile/src/MainNormal.ttcn +++ b/regression_test/compileonly/readFromFile/src/Module1.ttcn @@ -9,25 +9,6 @@ * Szabo, Bence Janos * ******************************************************************************/ -module MainNormal { - - -type component EmptyCT {} - -const integer myInt := 5; - -testcase tc_test() runs on EmptyCT { - var integer tempInt := myInt; - if (tempInt == 5) { - setverdict(pass); - } else { - setverdict(fail); - } -} - -control { - execute(tc_test()); -} - -} - + module Module1{ + const integer module1 := 1; +} \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/MainExtNormal.ttcn b/regression_test/compileonly/readFromFile/src/Module2.ttcn similarity index 53% rename from regression_test/compileonly/readFromFile/src/MainExtNormal.ttcn rename to regression_test/compileonly/readFromFile/src/Module2.ttcn index 5a580d67b24734758f9c8ec04b20d6d17260dc58..e1129a7074f35d637a89a1ba38955f5c290cee92 100644 --- a/regression_test/compileonly/readFromFile/src/MainExtNormal.ttcn +++ b/regression_test/compileonly/readFromFile/src/Module2.ttcn @@ -9,32 +9,6 @@ * Szabo, Bence Janos * ******************************************************************************/ -module MainExtNormal { - -import from MainNormal all; - -type component EmptyCT {} - -const universal charstring myString := "almafa"; - -testcase tc_test() runs on EmptyCT { - var universal charstring tempString := myString; - if (tempString == "almafa") { - setverdict(pass); - } else { - setverdict(fail); - } - var integer tempInt := 5; - if (tempInt == 5) { - setverdict(pass); - } else { - setverdict(fail); - } -} - -control { - execute(tc_test()); -} - -} - + module Module2{ + const integer module2 := 2; +} \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/Module3.ttcn b/regression_test/compileonly/readFromFile/src/Module3.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..41c63ceb99e6bb111ac755151193ab1fd19a2680 --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/Module3.ttcn @@ -0,0 +1,14 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Szabo, Bence Janos + * + ******************************************************************************/ + module Module3{ + const integer module3 := 3; +} \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/Module4.ttcn b/regression_test/compileonly/readFromFile/src/Module4.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..a171970b7cebbec0a11e1602952169c1826baf79 --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/Module4.ttcn @@ -0,0 +1,14 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Szabo, Bence Janos + * + ******************************************************************************/ + module Module4{ + const integer module4 := 4; +} \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/Module5.ttcn b/regression_test/compileonly/readFromFile/src/Module5.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..54e60c665d6deb5f3a2d4c0c02c18dd4dc72eb63 --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/Module5.ttcn @@ -0,0 +1,14 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Szabo, Bence Janos + * + ******************************************************************************/ + module Module5{ + const integer module5 := 5; +} \ No newline at end of file diff --git a/regression_test/compileonly/readFromFile/src/UsefulTtcn3Types.ttcn b/regression_test/compileonly/readFromFile/src/UsefulTtcn3Types.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..3d91ab24b5d0e6d912cf8182d5375c18bfb84a94 --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/UsefulTtcn3Types.ttcn @@ -0,0 +1,86 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Szabo, Bence Janos + * + ******************************************************************************/ +module UsefulTtcn3Types { + + + type integer byte (-128 .. 127) with { variant "/* 8 bit */" }; + + type integer unsignedbyte (0 .. 255) with { variant "/*unsigned 8 bit*/" }; + + type integer short (-32768 .. 32767) with { variant "/*16 bit*/" }; + + type integer unsignedshort (0 .. 65535) with { variant "/*unsigned 16 bit*/" }; + + type integer long (-2147483648 .. 2147483647) with { variant "/*32 bit*/" }; + + type integer unsignedlong (0 .. 4294967295) with { variant "/*unsigned 32 bit*/" }; + + type integer longlong /* ( -9223372036854775808 .. 9223372036854775807 ) */ with { variant "/*64 bit*/" }; + + type integer unsignedlonglong /* ( 0 .. 18446744073709551615 ) */ with { variant "/*unsigned 64 bit*/" }; + + type float IEEE754float with { variant "/*IEEE754 float*/" }; + + type float IEEE754double with { variant "/*IEEE754 double*/" }; + + type float IEEE754extfloat with { variant "/*IEEE754 extended float*/" }; + + type float IEEE754extdouble with { variant "/*IEEE754 extended double*/" }; + + type universal charstring utf8string with { variant "/*UTF-8*/" }; + + type universal charstring bmpstring ( char ( 0,0,0,0 ) .. char ( 0,0,255,255) ) with { variant "/*UCS-2*/" }; + + type universal charstring utf16string ( char ( 0,0,0,0 ) .. char ( 0,16,255,255) ) with { variant "/*UTF-16*/" }; + + type universal charstring iso8859string ( char ( 0,0,0,0 ) .. char ( 0,0,0,255) ) with { variant "/*8 bit*/" }; + + type record IDLfixed + { + unsignedshort digits, + short scale, + charstring value_ + } + with { + variant "/*IDL:fixed FORMAL/01-12-01 v.2.6*/"; + }; + + /* + type charstring char length (1); + + NOTE 1: The name of this useful type is the same as the TTCN-3 keyword used to denote universal + charstring values in the quadraple form. In general it is disallowed to use TTCN-3 keywords as + identifiers. The "char" useful type is a solitary exception and allowed only for backward compatibility + with previous versions of the TTCN-3 standard. (except Titan doesn't) + + NOTE 2: The special string "8 bit" defined in clause 28.2.3 may be used with this type to specify a given encoding + for its values. Also, other properties of the base type can be changed by using attribute mechanisms. + */ + + type universal charstring uchar length (1); + + /* + NOTE: Special strings defined in clause 28.2.3 except "8 bit" may be used with this type to specify a given + encoding for its values. Also, other properties of the base type can be changed by using attribute + mechanisms. + */ + + type bitstring bit length (1); + + type hexstring hex length (1); + + type octetstring octet length (1); + +} +with { +encode "XML"; +} diff --git a/regression_test/compileonly/readFromFile/src/XSD.ttcn b/regression_test/compileonly/readFromFile/src/XSD.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..af65a6e8de24c2e599c6962c43ba4a5da697449d --- /dev/null +++ b/regression_test/compileonly/readFromFile/src/XSD.ttcn @@ -0,0 +1,328 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 Ericsson Telecom AB + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Szabo, Bence Janos + * + ******************************************************************************/ +module XSD { + +import from UsefulTtcn3Types all; + +//These constants are used in the XSD date/time type definitions +const charstring + dash := "-", + cln := ":", + year := "[0-9]#4", + yearExpansion := "(-([1-9][0-9]#(0,))#(,1))#(,1)", + month := "(0[1-9]|1[0-2])", + dayOfMonth := "(0[1-9]|[12][0-9]|3[01])", + hour := "([01][0-9]|2[0-3])", + minute := "([0-5][0-9])", + second := "([0-5][0-9])", + sFraction := "(.[0-9]#(1,))#(,1)", + endOfDayExt := "24:00:00(.0#(1,))#(,1)", + nums := "[0-9]#(1,)", + ZorTimeZoneExt := "(Z|[+-]((0[0-9]|1[0-3]):[0-5][0-9]|14:00))#(,1)", + durTime := "(T[0-9]#(1,)"& + "(H([0-9]#(1,)(M([0-9]#(1,)(S|.[0-9]#(1,)S))#(,1)|.[0-9]#(1,)S|S))#(,1)|"& + "M([0-9]#(1,)(S|.[0-9]#(1,)S)|.[0-9]#(1,)M)#(,1)|"& + "S|"& + ".[0-9]#(1,)S))" + +//anySimpleType + +type XMLCompatibleString AnySimpleType +with { +variant "XSD:anySimpleType"; +}; + +//anyType; + +type record AnyType +{ + record of String embed_values optional, + record of String attr optional, + record of String elem_list +} +with { +variant "XSD:anyType"; +variant "embedValues"; +variant (attr) "anyAttributes"; +variant (elem_list) "anyElement"; +}; +// String types + +type XMLCompatibleString String +with { +variant "XSD:string"; +}; + +type XMLStringWithNoCRLFHT NormalizedString +with { +variant "XSD:normalizedString"; +}; + +type NormalizedString Token +with { +variant "XSD:token"; +}; + +type XMLStringWithNoWhitespace Name +with { +variant "XSD:Name"; +}; + +type XMLStringWithNoWhitespace NMTOKEN +with { +variant "XSD:NMTOKEN"; +}; + +type Name NCName +with { +variant "XSD:NCName"; +}; + +type NCName ID +with { +variant "XSD:ID"; +}; + +type NCName IDREF +with { +variant "XSD:IDREF"; +}; + +type NCName ENTITY +with { +variant "XSD:ENTITY"; +}; + +type octetstring HexBinary +with { +variant "XSD:hexBinary"; +}; + +type octetstring Base64Binary +with { +variant "XSD:base64Binary"; +}; + +type XMLStringWithNoCRLFHT AnyURI +with { +variant "XSD:anyURI"; +}; + +type charstring Language (pattern "[a-zA-Z]#(1,8)(-\w#(1,8))#(0,)") +with { +variant "XSD:language"; +}; +// Integer types + +type integer Integer +with { +variant "XSD:integer"; +}; + +type integer PositiveInteger (1 .. infinity) +with { +variant "XSD:positiveInteger"; +}; + +type integer NonPositiveInteger (-infinity .. 0) +with { +variant "XSD:nonPositiveInteger"; +}; + +type integer NegativeInteger (-infinity .. -1) +with { +variant "XSD:negativeInteger"; +}; + +type integer NonNegativeInteger (0 .. infinity) +with { +variant "XSD:nonNegativeInteger"; +}; + +type longlong Long +with { +variant "XSD:long"; +}; + +type unsignedlonglong UnsignedLong +with { +variant "XSD:unsignedLong"; +}; + +type long Int +with { +variant "XSD:int"; +}; + +type unsignedlong UnsignedInt +with { +variant "XSD:unsignedInt"; +}; + +type short Short +with { +variant "XSD:short"; +}; + +type unsignedshort UnsignedShort +with { +variant "XSD:unsignedShort"; +}; + +type byte Byte +with { +variant "XSD:byte"; +}; + +type unsignedbyte UnsignedByte +with { +variant "XSD:unsignedByte"; +}; + +// Float types + +type float Decimal +with { +variant "XSD:decimal"; +}; + +type IEEE754float Float +with { +variant "XSD:float"; +}; + +type IEEE754double Double +with { +variant "XSD:double"; +}; + +// Time types + +type charstring Duration (pattern + "{dash}#(,1)P({nums}(Y({nums}(M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|" & + "{durTime}#(,1))|M({nums}D{durTime}#(,1)|{durTime}#(,1))|D{durTime}#(,1))|{durTime})") +with { +variant "XSD:duration"; +}; + +type charstring DateTime (pattern + "{yearExpansion}{year}{dash}{month}{dash}{dayOfMonth}T({hour}{cln}{minute}{cln}{second}" & + "{sFraction}|{endOfDayExt}){ZorTimeZoneExt}" ) +with { +variant "XSD:dateTime"; +}; + +type charstring Time (pattern + "({hour}{cln}{minute}{cln}{second}{sFraction}|{endOfDayExt}){ZorTimeZoneExt}" ) +with { +variant "XSD:time"; +}; + +type charstring Date (pattern + "{yearExpansion}{year}{dash}{month}{dash}{dayOfMonth}{ZorTimeZoneExt}" ) +with { +variant "XSD:date"; +}; + +type charstring GYearMonth (pattern + "{yearExpansion}{year}{dash}{month}{ZorTimeZoneExt}" ) +with { +variant "XSD:gYearMonth"; +}; + +type charstring GYear (pattern + "{yearExpansion}{year}{ZorTimeZoneExt}" ) +with { +variant "XSD:gYear"; +}; + +type charstring GMonthDay (pattern + "{dash}{dash}{month}{dash}{dayOfMonth}{ZorTimeZoneExt}" ) +with { +variant "XSD:gMonthDay"; +}; + +type charstring GDay (pattern + "{dash}{dash}{dash}{dayOfMonth}{ZorTimeZoneExt}" ) +with { +variant "XSD:gDay"; +}; + +type charstring GMonth (pattern + "{dash}{dash}{month}{ZorTimeZoneExt}" ) +with { +variant "XSD:gMonth"; +}; + +// Sequence types + +type record of NMTOKEN NMTOKENS +with { +variant "XSD:NMTOKENS"; +}; + +type record of IDREF IDREFS +with { +variant "XSD:IDREFS"; +}; + +type record of ENTITY ENTITIES +with { +variant "XSD:ENTITIES"; +}; + +type record QName +{ + AnyURI uri optional, + NCName name +} +with { +variant "XSD:QName"; +}; + +// Boolean type + +type boolean Boolean +with { +variant "XSD:boolean"; +}; + +//TTCN-3 type definitions supporting the mapping of W3C XML Schema built-in datatypes + +type utf8string XMLCompatibleString +( + char(0,0,0,9)..char(0,0,0,9), + char(0,0,0,10)..char(0,0,0,10), + char(0,0,0,13)..char(0,0,0,13), + char(0,0,0,32)..char(0,0,215,255), + char(0,0,224,0)..char(0,0,255,253), + char(0,1,0,0)..char(0,16,255,253) +) + +type utf8string XMLStringWithNoWhitespace +( + char(0,0,0,33)..char(0,0,215,255), + char(0,0,224,0)..char(0,0,255,253), + char(0,1,0,0)..char(0,16,255,253) +) + +type utf8string XMLStringWithNoCRLFHT +( + char(0,0,0,32)..char(0,0,215,255), + char(0,0,224,0)..char(0,0,255,253), + char(0,1,0,0)..char(0,16,255,253) +) + +} +with{ +encode "XML" +} diff --git a/usrguide/referenceguide.doc b/usrguide/referenceguide.doc index a8ca4d9e14b097535084a653f30472824c13139a..b59bc15c0d7ad0dd19ec9c7e706702660face78e 100644 Binary files a/usrguide/referenceguide.doc and b/usrguide/referenceguide.doc differ