Commit | Line | Data |
---|---|---|
d44e3c4f | 1 | /****************************************************************************** |
2 | * Copyright (c) 2000-2016 Ericsson Telecom AB | |
3 | * All rights reserved. This program and the accompanying materials | |
4 | * are made available under the terms of the Eclipse Public License v1.0 | |
5 | * which accompanies this distribution, and is available at | |
6 | * http://www.eclipse.org/legal/epl-v10.html | |
7 | * | |
8 | * Contributors: | |
9 | * Balasko, Jeno | |
10 | * Baranyi, Botond | |
11 | * Beres, Szabolcs | |
12 | * Delic, Adam | |
13 | * Kovacs, Ferenc | |
14 | * Pandi, Krisztian | |
15 | * Raduly, Csaba | |
16 | * Szabados, Kristof | |
17 | * Szabo, Janos Zoltan – initial implementation | |
18 | * Szalai, Gabor | |
19 | * | |
20 | ******************************************************************************/ | |
970ed795 EL |
21 | #ifndef VERSION_H |
22 | #define VERSION_H | |
23 | ||
24 | /* Version numbers */ | |
25 | #define TTCN3_MAJOR 5 | |
acfdc7e1 | 26 | #define TTCN3_MINOR 5 |
27 | #define TTCN3_PATCHLEVEL 0 | |
970ed795 EL |
28 | //#define TTCN3_BUILDNUMBER 0 |
29 | ||
30 | /* The aggregated version number must be set manually since some stupid | |
31 | * 'makedepend' programs cannot calculate arithmetic expressions. | |
32 | * In official releases: | |
33 | * TTCN3_VERSION = TTCN3_MAJOR * 10000 + TTCN3_MINOR * 100 + TTCN3_PATCHLEVEL | |
34 | * In pre-release builds: | |
35 | * TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 + | |
36 | * TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER | |
37 | */ | |
acfdc7e1 | 38 | #define TTCN3_VERSION 50500 |
970ed795 EL |
39 | |
40 | /* A monotonically increasing version number. | |
41 | * An official release is deemed to have the highest possible build number (99) | |
42 | */ | |
43 | #ifdef TTCN3_BUILDNUMBER | |
44 | #define TTCN3_VERSION_MONOTONE TTCN3_VERSION | |
45 | #else | |
46 | #define TTCN3_VERSION_MONOTONE (TTCN3_VERSION * 100 + 99) | |
47 | #endif | |
48 | ||
49 | ||
50 | #if defined (SOLARIS) | |
51 | #define PLATFORM_STRING "SOLARIS" | |
52 | #elif defined (SOLARIS8) | |
53 | #define PLATFORM_STRING "SOLARIS8" | |
54 | #elif defined (LINUX) | |
55 | #define PLATFORM_STRING "LINUX" | |
56 | #elif defined (WIN32) | |
57 | /* MINGW is defined only if CYGWIN is defined */ | |
58 | #if defined (MINGW) | |
59 | #define PLATFORM_STRING "MINGW" | |
60 | #else | |
61 | #define PLATFORM_STRING "WIN32" | |
62 | #endif | |
63 | #elif defined (FREEBSD) | |
64 | #define PLATFORM_STRING "FREEBSD" | |
65 | #elif defined (INTERIX) | |
66 | #define PLATFORM_STRING "INTERIX" | |
67 | /* TODO more */ | |
68 | #endif | |
69 | ||
70 | ||
71 | #ifndef PLATFORM_STRING | |
72 | /* Just to suppress error later */ | |
73 | #define PLATFORM_STRING "UNKNOWN" | |
74 | #error "No supported platform has been defined in the Makefile. The supported ones: SOLARIS, SOLARIS8, LINUX, WIN32" | |
75 | #endif | |
76 | ||
77 | #define STRINGIFY(x) #x | |
78 | #define STR(x) STRINGIFY(x) | |
79 | ||
80 | #if defined(__GNUC__) | |
81 | ||
82 | #ifdef __GNUC_PATCHLEVEL__ | |
83 | #define GCC_PATCHLEVEL_STRING "." STR(__GNUC_PATCHLEVEL__) | |
84 | #else | |
85 | /* __GNUC_PATCHLEVEL__ appeared in gcc 3.0 */ | |
86 | #define GCC_PATCHLEVEL_STRING | |
87 | #endif | |
88 | ||
89 | #ifdef __clang__ | |
90 | #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100) | |
91 | #else | |
92 | #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) | |
93 | #endif | |
94 | /* Ignore __GNUC_PATCHLEVEL__ */ | |
95 | #define COMPILER_VERSION_STRING " GCC: (GNU) " STR(__GNUC__) "." STR(__GNUC_MINOR__) GCC_PATCHLEVEL_STRING | |
96 | ||
97 | ||
98 | static const char titan_[] __attribute__ ((section (".titan"))) = \ | |
99 | "TITAN: " STR(TTCN3_VERSION) " PLATFORM: " PLATFORM_STRING COMPILER_VERSION_STRING; | |
100 | ||
101 | #ifdef __cplusplus | |
102 | struct reffer { | |
103 | reffer(const char *); | |
104 | }; | |
105 | ||
106 | /* Prevents the version string from being optimized away */ | |
107 | static const reffer ref_ver(titan_); | |
108 | #endif | |
109 | ||
110 | #else /* not a GNU compiler */ | |
111 | ||
112 | #ifndef __attribute__ | |
113 | #define __attribute__(arg) | |
114 | #endif | |
115 | ||
116 | #if defined(__SUNPRO_C) | |
117 | ||
118 | #define COMPILER_VERSION_STRING " SunPro: " STR(__SUNPRO_C) | |
119 | ||
120 | #elif defined(__SUNPRO_CC) | |
121 | ||
122 | #define COMPILER_VERSION_STRING " SunPro: " STR(__SUNPRO_CC) | |
123 | ||
124 | #pragma ident "TITAN: " STR(TTCN3_VERSION) " PLATFORM: " PLATFORM_STRING COMPILER_VERSION_STRING; | |
125 | ||
126 | #else | |
127 | /* Luft! unknown compiler */ | |
128 | #endif /* not SunPro */ | |
129 | ||
130 | #endif | |
131 | /* __SUNPRO_CC is an all-in-one value */ | |
132 | ||
133 | ||
134 | #define FN(f,x) requires_ ## f ## _ ## x | |
135 | #define FIELD_NAME(f,x) FN(f,x) | |
136 | ||
137 | #ifdef TITAN_RUNTIME_2 | |
138 | #define TITAN_RUNTIME_NR 2 | |
139 | #else | |
140 | #define TITAN_RUNTIME_NR 1 | |
141 | #endif | |
142 | ||
143 | struct runtime_version { | |
144 | int FIELD_NAME(major_version, TTCN3_MAJOR); | |
145 | int FIELD_NAME(minor_version, TTCN3_MINOR); | |
146 | int FIELD_NAME(patch_level, TTCN3_PATCHLEVEL); | |
147 | int FIELD_NAME(runtime, TITAN_RUNTIME_NR); | |
148 | }; | |
149 | ||
150 | extern const struct runtime_version current_runtime_version; | |
151 | ||
152 | #ifdef __cplusplus | |
153 | class RuntimeVersionChecker { | |
154 | public: | |
155 | RuntimeVersionChecker(int ver_major, int ver_minor, int patch_level, int rt); | |
156 | }; | |
157 | #endif | |
158 | ||
159 | #undef FIELD_NAME | |
160 | #undef FN | |
161 | ||
162 | #endif |