From 695ba9227cfd4c9ce07c9c8ca77c7bdca8979a93 Mon Sep 17 00:00:00 2001
From: Adam Knapp <adam.knapp@sigmatechnology.se>
Date: Thu, 4 Mar 2021 16:45:58 +0100
Subject: [PATCH] Eliminating product numbering, updating version

Change-Id: Ic19c2fce15afc9a027997dd3a1e3176a30ab1b5d
Signed-off-by: Adam Knapp <adam.knapp@sigmatechnology.se>
---
 common/version.h             |  4 ++--
 common/version_internal.h    | 15 +++++++++------
 compiler2/main.cc            |  1 -
 compiler2/makefile.c         |  1 -
 compiler2/tcov2lcov.cc       |  2 +-
 compiler2/ttcn3/AST_ttcn3.cc | 14 +++++++-------
 core/Parallel_main.cc        |  1 -
 core/ProfMerge_main.cc       |  1 -
 core/Single_main.cc          |  1 -
 mctr2/mctr/main.cc           |  2 +-
 repgen/logfilter.c           |  1 -
 repgen/logformat.l           |  1 -
 repgen/logmerge.c            |  1 -
 repgen/parser.l              |  2 +-
 xsdconvert/converter.cc      |  3 +--
 15 files changed, 22 insertions(+), 28 deletions(-)

diff --git a/common/version.h b/common/version.h
index 7e5d326d9..0219a9298 100644
--- a/common/version.h
+++ b/common/version.h
@@ -25,7 +25,7 @@
 /* Version numbers */
 #define TTCN3_MAJOR 7
 #define TTCN3_MINOR 2
-#define TTCN3_PATCHLEVEL 0 //0-> x=A, 1-> x=B, ...
+#define TTCN3_PATCHLEVEL 1 //0-> x=A, 1-> x=B, ...
 //#define TTCN3_BUILDNUMBER 0  //0=R5x, 1=R5x01, 2=R5x02, ...
 
 /* The aggregated version number must be set manually since some stupid
@@ -38,7 +38,7 @@
  * TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 +
  *                 TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER
  */
-#define TTCN3_VERSION 70200
+#define TTCN3_VERSION 70201
 
 /* A monotonically increasing version number.
  * An official release is deemed to have the highest possible build number (99)
diff --git a/common/version_internal.h b/common/version_internal.h
index eeb21ccf1..26b8dead3 100644
--- a/common/version_internal.h
+++ b/common/version_internal.h
@@ -34,15 +34,16 @@
 # define VERSION_STRING GEN_VER(TTCN3_MAJOR, TTCN3_MINOR, TTCN3_PATCHLEVEL, \
     TTCN3_BUILDNUMBER)
 #else
-/* stable release, e.g. "1.4.pl3" */
+/* stable release, e.g. "7.2.1" or "1.4.pl3" */
+# define GEN_VER3(major, minor, patchlevel) #major "." #minor "." #patchlevel
 # define GEN_VER2(major, minor, patchlevel) #major "." #minor ".pl" #patchlevel
-# define GEN_VER(major, minor, patchlevel) GEN_VER2(major, minor, patchlevel)
+# define GEN_VER(major, minor, patchlevel) GEN_VER3(major, minor, patchlevel)
 # define VERSION_STRING GEN_VER(TTCN3_MAJOR, TTCN3_MINOR, TTCN3_PATCHLEVEL)
 #endif
 
 /* Product number */
-#define PRODNR_EXECUTOR  "CAX 105 7730"
-#define LEGACY_PRODNR_EXECUTOR "CRL 113 200"
+#define LEGACY_CAX_PRODNR_EXECUTOR  "CAX 105 7730"
+#define LEGACY_CRL_PRODNR_EXECUTOR "CRL 113 200"
 
 /* Ericsson (legacy) revision: /m Rnx
  * m = TTCN3_MAJOR
@@ -120,11 +121,13 @@
 #define LEGACY_VERSION "/" MAJOR_SUFFIX " R" MINOR_NUMBER PATCH_LETTER \
   DOUBLEDIGIT_BUILDNUMBER
 
-#define LEGACY_PRODUCT_NUMBER  LEGACY_PRODNR_EXECUTOR LEGACY_VERSION
+#define LEGACY_CRL_PRODUCT_NUMBER  LEGACY_CRL_PRODNR_EXECUTOR LEGACY_VERSION
 
-#define PRODUCT_NUMBER MAJOR_SUFFIX "/" PRODNR_EXECUTOR " R" MINOR_NUMBER PATCH_LETTER \
+#define LEGACY_CAX_PRODUCT_NUMBER MAJOR_SUFFIX "/" LEGACY_CAX_PRODNR_EXECUTOR " R" MINOR_NUMBER PATCH_LETTER \
   DOUBLEDIGIT_BUILDNUMBER
 
+#define PRODUCT_NUMBER VERSION_STRING
+
 /* Version of the C/C++ compiler */
 
 #if defined(__GNUC__)
diff --git a/compiler2/main.cc b/compiler2/main.cc
index c1fe92fed..01e3c19d4 100644
--- a/compiler2/main.cc
+++ b/compiler2/main.cc
@@ -972,7 +972,6 @@ int main(int argc, char *argv[])
 
   if (vflag) {
     fputs("TTCN-3 and ASN.1 Compiler for the TTCN-3 Test Executor\n"
-	  "Product number: " PRODUCT_NUMBER "\n"
 	  "Version: " VERSION_STRING "\n"
 	  "Build date: " __DATE__ " " __TIME__ "\n"
 	  "Compiled with: " C_COMPILER_VERSION "\n", stderr);
diff --git a/compiler2/makefile.c b/compiler2/makefile.c
index 61fe40e9f..7da71554e 100644
--- a/compiler2/makefile.c
+++ b/compiler2/makefile.c
@@ -5317,7 +5317,6 @@ int main(int argc, char *argv[])
 
   if (vflag) {
     fputs("Makefile Generator for the TTCN-3 Test Executor\n"
-	  "Product number: " PRODUCT_NUMBER "\n"
 	  "Version: " VERSION_STRING "\n"
 	  "Build date: " __DATE__ " " __TIME__ "\n"
 	  "Compiled with: " C_COMPILER_VERSION "\n\n"
diff --git a/compiler2/tcov2lcov.cc b/compiler2/tcov2lcov.cc
index 027a0b04a..b225f77c5 100644
--- a/compiler2/tcov2lcov.cc
+++ b/compiler2/tcov2lcov.cc
@@ -264,7 +264,7 @@ int Tcov2Lcov::generate()
 
 static void print_version()
 {
-  std::cerr << "Product number: " << PRODUCT_NUMBER << std::endl
+  std::cerr << "Version: " << VERSION_STRING << std::endl
             << "Build date: " << __DATE__ << " " << __TIME__ << std::endl
             << "Compiled with: " << C_COMPILER_VERSION << std::endl << std::endl
             << COPYRIGHT_STRING << std::endl << std::endl;
diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc
index 3f2efb629..cf716ae3f 100644
--- a/compiler2/ttcn3/AST_ttcn3.cc
+++ b/compiler2/ttcn3/AST_ttcn3.cc
@@ -3027,12 +3027,12 @@ namespace Ttcn {
                   prod_match = (0 == strcmp(m->product_number, exp_product_number));
                 }
                 else if (legacy == TTRUE && m->legacy_version == TFALSE) {
-                  prod_match = (0 == strcmp(exp_product_number, LEGACY_PRODNR_EXECUTOR) &&
-                      0 == strcmp(m->product_number, PRODNR_EXECUTOR));
+                  prod_match = (0 == strcmp(exp_product_number, LEGACY_CRL_PRODNR_EXECUTOR) &&
+                      0 == strcmp(m->product_number, LEGACY_CAX_PRODNR_EXECUTOR));
                 }
                 else if (legacy == TFALSE && m->legacy_version == TTRUE) {
-                  prod_match = (0 == strcmp(exp_product_number, PRODNR_EXECUTOR) &&
-                      0 == strcmp(m->product_number, LEGACY_PRODNR_EXECUTOR));
+                  prod_match = (0 == strcmp(exp_product_number, LEGACY_CAX_PRODNR_EXECUTOR) &&
+                      0 == strcmp(m->product_number, LEGACY_CRL_PRODNR_EXECUTOR));
                 }
                 if (!prod_match) {
                   char *req_product_identifier =
@@ -3102,8 +3102,8 @@ namespace Ttcn {
             char* exp_extra;
             tribool legacy;
             (void)ex.get_id(exp_product_number, exp_suffix, exp_minor, exp_patch, exp_build, exp_extra, legacy);
-            if (exp_product_number != NULL && ((legacy != TTRUE && strcmp(exp_product_number, PRODNR_EXECUTOR) != 0) ||
-                (legacy == TTRUE && strcmp(exp_product_number, LEGACY_PRODNR_EXECUTOR) != 0))) {
+            if (exp_product_number != NULL && ((legacy != TTRUE && strcmp(exp_product_number, LEGACY_CAX_PRODNR_EXECUTOR) != 0) ||
+                (legacy == TTRUE && strcmp(exp_product_number, LEGACY_CRL_PRODNR_EXECUTOR) != 0))) {
               ex.error("This module needs to be compiled with TITAN, but "
                 " product number %s is not TITAN"
                 , exp_product_number);
@@ -3119,7 +3119,7 @@ namespace Ttcn {
                     get_product_identifier(exp_product_number, exp_suffix, exp_minor, exp_patch, exp_build, NULL, legacy);
               ex.error("This module needs to be compiled with TITAN version"
                 " %s or higher; version %s detected"
-                , exp_product_identifier, legacy == TTRUE ? LEGACY_PRODUCT_NUMBER : PRODUCT_NUMBER);
+                , exp_product_identifier, legacy == TTRUE ? LEGACY_CRL_PRODUCT_NUMBER : LEGACY_CAX_PRODUCT_NUMBER);
               Free(exp_product_identifier);
             }
             multi->delete_element(i--);
diff --git a/core/Parallel_main.cc b/core/Parallel_main.cc
index 8a399d9ff..ce627f92e 100644
--- a/core/Parallel_main.cc
+++ b/core/Parallel_main.cc
@@ -173,7 +173,6 @@ static boolean process_options(int argc, char *argv[], int& ret_val,
   } else if (vflag) {
     // version printout
     fputs("TTCN-3 Host Controller (parallel mode)\n"
-      "Product number: " PRODUCT_NUMBER "\n"
       "Version: " VERSION_STRING "\n"
       "Build date (Base Library): " __DATE__ " " __TIME__ "\n"
       "Base Library was compiled with: " C_COMPILER_VERSION "\n\n"
diff --git a/core/ProfMerge_main.cc b/core/ProfMerge_main.cc
index 6345f6d25..7c037d092 100644
--- a/core/ProfMerge_main.cc
+++ b/core/ProfMerge_main.cc
@@ -153,7 +153,6 @@ int main(int argc, char* argv[])
     }
     else {
       fputs("Profiler and Code Coverage Merge Tool for the TTCN-3 Test Executor\n"
-	    "Product number: " PRODUCT_NUMBER "\n"
 	    "Version: " VERSION_STRING "\n"
 	    "Build date: " __DATE__ " " __TIME__ "\n"
 	    "Compiled with: " C_COMPILER_VERSION "\n\n"
diff --git a/core/Single_main.cc b/core/Single_main.cc
index f07ac75f9..1af929246 100644
--- a/core/Single_main.cc
+++ b/core/Single_main.cc
@@ -183,7 +183,6 @@ int main(int argc, char *argv[])
     return ret_val;
   } else if (vflag) {
     fputs("TTCN-3 Test Executor (single mode)\n"
-      "Product number: " PRODUCT_NUMBER "\n"
       "Version: " VERSION_STRING "\n"
       "Build date (Base Library): " __DATE__ " " __TIME__ "\n"
       "Base Library was compiled with: " C_COMPILER_VERSION "\n\n"
diff --git a/mctr2/mctr/main.cc b/mctr2/mctr/main.cc
index 4ead21c0c..a2b3b7acf 100644
--- a/mctr2/mctr/main.cc
+++ b/mctr2/mctr/main.cc
@@ -273,7 +273,7 @@ int main(int argc, char *argv[])
       "(CLI)"
 #endif
       " for the TTCN-3 Test Executor\n"
-      "Product number: " PRODUCT_NUMBER "\n"
+      "Version: " VERSION_STRING "\n"
       "Build date: " __DATE__ " " __TIME__ "\n"
       "Compiled with: " C_COMPILER_VERSION "\n", stderr);
     fputs("Using ", stderr);
diff --git a/repgen/logfilter.c b/repgen/logfilter.c
index 445fce76c..e552c49a3 100644
--- a/repgen/logfilter.c
+++ b/repgen/logfilter.c
@@ -249,7 +249,6 @@ int main(int argc,char *argv[])
 	return EXIT_FAILURE;
     } else if (vflag) {
         fputs("Log Filter for the TTCN-3 Test Executor\n"
-	    "Product number: " PRODUCT_NUMBER "\n"
 	    "Version: " VERSION_STRING "\n"
 	    "Build date: " __DATE__ " " __TIME__ "\n"
 	    "Compiled with: " C_COMPILER_VERSION "\n\n"
diff --git a/repgen/logformat.l b/repgen/logformat.l
index 3ffb10319..9d9e598d6 100644
--- a/repgen/logformat.l
+++ b/repgen/logformat.l
@@ -504,7 +504,6 @@ int main(int argc, char *argv[])
         return EXIT_FAILURE;
     } else if (vflag) {
         fputs("Log Formatter for the TTCN-3 Test Executor\n"
-	    "Product number: " PRODUCT_NUMBER "\n"
 	    "Version: " VERSION_STRING "\n"
 	    "Build date: " __DATE__ " " __TIME__ "\n"
 	    "Compiled with: " C_COMPILER_VERSION "\n\n"
diff --git a/repgen/logmerge.c b/repgen/logmerge.c
index b9018195e..9cb36a7a9 100644
--- a/repgen/logmerge.c
+++ b/repgen/logmerge.c
@@ -618,7 +618,6 @@ int main(int argc,char *argv[])
     if(oflag&&vflag){Usage();return 0;}/*both switches are used*/
 	if(vflag) {
 	fputs("Log Merger for the TTCN-3 Test Executor\n"
-	    "Product number: " PRODUCT_NUMBER "\n"
 	    "Version: " VERSION_STRING "\n"
 	    "Build date: " __DATE__ " " __TIME__ "\n"
 	    "Compiled with: " C_COMPILER_VERSION "\n\n"
diff --git a/repgen/parser.l b/repgen/parser.l
index 497ec0520..bc5d97a57 100644
--- a/repgen/parser.l
+++ b/repgen/parser.l
@@ -150,7 +150,7 @@ int	main ( int argc, char *argv[] )
 	{
 
 	 fputs("HTML Report Generator for the TTCN-3 Test Executor\n"
-	    "Product number: " PRODUCT_NUMBER "\n"
+	    "Version: " VERSION_STRING "\n"
 	    "Build date: " __DATE__ " " __TIME__ "\n"
 	    "Compiled with: " C_COMPILER_VERSION "\n\n"
 	     COPYRIGHT_STRING "\n\n"
diff --git a/xsdconvert/converter.cc b/xsdconvert/converter.cc
index fea5e6818..57b3be4a5 100644
--- a/xsdconvert/converter.cc
+++ b/xsdconvert/converter.cc
@@ -276,8 +276,7 @@ static void printUsage(const char * argv0) {
 }
 
 static void printVersion() {
-  fputs("Product number: " PRODUCT_NUMBER "\n"
-    "Version: " VERSION_STRING "\n"
+  fputs("Version: " VERSION_STRING "\n"
     "Build date: " __DATE__ " " __TIME__ "\n"
     "Compiled with: " C_COMPILER_VERSION "\n\n"
     COPYRIGHT_STRING "\n\n", stderr);
-- 
GitLab