Commit b14c6db4 authored by Botond Baranyi's avatar Botond Baranyi
Browse files

Fixed importing of ASN.1 identifiers that match realtime keywords, when the...


Fixed importing of ASN.1 identifiers that match realtime keywords, when the feature is disabled (bug 539514)

Change-Id: Iebb66c2b92db4fa6e75126166a7c62d3a437a66f
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 5d6f9288
......@@ -22,6 +22,7 @@
#include <ctype.h>
#include "Setting.hh"
#include "CompilerError.hh"
#include "main.hh"
namespace Common {
......@@ -96,6 +97,7 @@ namespace Common {
private:
static internal_data_t *instance;
static const char* const keywords[][3];
static const char* const realtime_keywords[][3];
size_t identifier_counter;
public:
const string string_invalid;
......@@ -802,7 +804,6 @@ namespace Common {
{"noblock__", "noblock", "noblock_"},
{"none__", "none", "none_"},
{"not4b__", "not4b", "not4b_"},
{"now__", "now", "now_"},
{"nowait__", "nowait", "nowait_"},
{"null__", "null", "null_"},
{"objid__", "objid", "objid_"},
......@@ -822,7 +823,6 @@ namespace Common {
{"procedure__", "procedure", "procedure_"},
{"raise__", "raise", "raise_"},
{"read__", "read", "read_"},
{"realtime__", "realtime", "realtime_"},
{"receive__", "receive", "receive_"},
{"record__", "record", "record_"},
{"recursive__", "recursive", "recursive_"},
......@@ -846,7 +846,6 @@ namespace Common {
{"testcase__", "testcase", "testcase_"},
{"timeout__", "timeout", "timeout_"},
{"timer__", "timer", "timer_"},
{"timestamp__", "timestamp", "timestamp_"},
{"to__", "to", "to_"},
{"trigger__", "trigger", "trigger_"},
{"type__", "type", "type_"},
......@@ -869,6 +868,15 @@ namespace Common {
/* the last must be all zeros */
{0, 0, 0}
}; // keywords
// keywords for the real-time testing feature
// (can be switched on or off with a command line option)
const char* const internal_data_t::realtime_keywords[][3] = {
{"now__", "now", "now_"},
{"realtime__", "realtime", "realtime_"},
{"timestamp__", "timestamp", "timestamp_"},
{0, 0, 0}
};
internal_data_t::internal_data_t()
: identifier_counter(0), string_invalid("<invalid>"), id_map_name(),
......@@ -973,6 +981,11 @@ namespace Common {
Error_Context cntx(&loc, "While adding keywords");
for(size_t i=0; keywords[i][0]; i++)
add_keyword(keywords[i]);
if (realtime_features) {
for(size_t i=0; realtime_keywords[i][0] != 0; i++) {
add_keyword(realtime_keywords[i]);
}
}
}
/* Perhaps it were good to read a file which contains
user-defined mappings :) */
......
......@@ -2,3 +2,5 @@ realtimeKeywords
realtimeKeywords.exe
realtimeKeywords*.cc
realtimeKeywords*.hh
RealtimeKeywordsAsn*.cc
RealtimeKeywordsAsn*.hh
......@@ -18,7 +18,9 @@ TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
TTCN3_MODULES = realtimeKeywords.ttcn
GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc)
ASN1_MODULES = RealtimeKeywordsAsn.asn
GENERATED_SOURCES = $(TTCN3_MODULES:.ttcn=.cc) $(ASN1_MODULES:.asn=.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))
......@@ -39,7 +41,7 @@ $(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)
$(GENERATED_SOURCES) $(GENERATED_HEADERS): $(TTCN3_MODULES) $(ASN1_MODULES)
$(TTCN3_COMPILER) $(COMPILER_FLAGS) $^
clean distclean:
......
--/////////////////////////////////////////////////////////////////////////////
-- 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
--
--/////////////////////////////////////////////////////////////////////////////
RealtimeKeywordsAsn
DEFINITIONS ::=
BEGIN
IMPORTS ; -- nothing
Seq ::= SEQUENCE {
now REAL,
realtime BOOLEAN
}
timestamp INTEGER ::= 5
END
......@@ -14,12 +14,15 @@
// feature is disabled (for backward compatibility).
module realtimeKeywords {
import from RealtimeKeywordsAsn all;
type record realtime {}
template boolean now := true;
function timestamp() return float {
return -1.0;
function timestamp() return Seq {
var integer x := RealtimeKeywordsAsn.timestamp;
return { now := -1.0, realtime := false };
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment