Commit d0f6e30d authored by Jeno Attila Balasko's avatar Jeno Attila Balasko Committed by Gerrit Code Review
Browse files

Merge "Fixed asn1 opentype codegen issue (Bug 527244)"

parents eb72b6bb f7032824
......@@ -9,6 +9,7 @@
* Balasko, Jeno
* Delic, Adam
* Raduly, Csaba
* Szabo, Bence Janos
*
******************************************************************************/
#include "TableConstraint.hh"
......@@ -258,6 +259,7 @@ namespace Asn {
const Common::Identifier& altname = t_type->get_otaltname(is_strange);
if(!t_ot->has_comp_withName(altname)) {
Type * otype = new Type(Type::T_REFDSPEC, t_type);
otype->set_my_scope(t_type->get_my_scope());
otype->set_genname(t_type->get_genname_own());
t_ot->add_comp(new CompField(altname.clone(),
otype));
......@@ -268,7 +270,6 @@ namespace Asn {
"open type `%s'", dispname_str, t_ot->get_fullname().c_str());
} // t_ot ! has the type
} // for i (objs)
t_ot->set_my_scope(t_ot->get_my_scope());
t_ot->set_fullname(t_ot->get_fullname());
t_ot->chk();
} // if ans
......
......@@ -2371,8 +2371,8 @@ void defUnionClass(struct_def const *sdef, output_struct *output)
if (oer_needed) {
// OER encode
src = mputprintf(src,
"int %s::OER_encode(const TTCN_Typedescriptor_t& p_td, TTCN_Buffer& p_buf) const\n"
"{\n", name);
"int %s::OER_encode(const TTCN_Typedescriptor_t&%s, TTCN_Buffer& p_buf) const\n"
"{\n", name, use_runtime_2 ? " p_td" : "");
if (use_runtime_2) {
src = mputstr(src, " if (err_descr) return OER_encode_negtest(err_descr, p_td, p_buf);\n");
}
......@@ -2474,21 +2474,27 @@ void defUnionClass(struct_def const *sdef, output_struct *output)
"int %s::OER_decode(const TTCN_Typedescriptor_t&, TTCN_Buffer& p_buf, OER_struct& p_oer)\n"
"{\n", name);
if (sdef->ot == NULL) {
src = mputstr(src,
" const ASN_Tag_t& descr = decode_oer_tag(p_buf);\n");
for (i = 0; i < sdef->nElements; ++i) {
if (sdef->nElements > 0) {
src = mputstr(src,
" const ASN_Tag_t& descr = decode_oer_tag(p_buf);\n");
for (i = 0; i < sdef->nElements; ++i) {
src = mputprintf(src,
" if (%s_descr_.ber->tags[%s_descr_.ber->n_tags-1].tagclass == descr.tagclass &&\n"
" %s_descr_.ber->tags[%s_descr_.ber->n_tags-1].tagnumber == descr.tagnumber) {\n"
" %s%s().OER_decode(%s_descr_, p_buf, p_oer);\n"
" } else \n"
, sdef->elements[i].typedescrname, sdef->elements[i].typedescrname, sdef->elements[i].typedescrname
, sdef->elements[i].typedescrname, at_field, sdef->elements[i].name, sdef->elements[i].typedescrname);
}
src = mputprintf(src,
"{\n"
" TTCN_error(\"Cannot find matching tag for type %s\");\n"
"}\n", name);
} else {
src = mputprintf(src,
" if (%s_descr_.ber->tags[%s_descr_.ber->n_tags-1].tagclass == descr.tagclass &&\n"
" %s_descr_.ber->tags[%s_descr_.ber->n_tags-1].tagnumber == descr.tagnumber) {\n"
" %s%s().OER_decode(%s_descr_, p_buf, p_oer);\n"
" } else \n"
, sdef->elements[i].typedescrname, sdef->elements[i].typedescrname, sdef->elements[i].typedescrname
, sdef->elements[i].typedescrname, at_field, sdef->elements[i].name, sdef->elements[i].typedescrname);
" TTCN_error(\"Decoding empty union type %s\");\n", name);
}
src = mputprintf(src,
"{\n"
" TTCN_error(\"Cannot find matching tag for type %s\");\n"
"}\n", name);
} else {
src = mputstr(src,
" size_t pos = decode_oer_length(p_buf, FALSE);\n"
......
......@@ -29,7 +29,7 @@ CODIRS := dynamicTemplate styleGuide topLevelPdu \
attribQualif HT48786 selectCase openTypeNames \
defaultParamUsageBeforeDecl deterministic readFromFile \
asn1_hyphen nameClash portTranslation UntaggedOnTopLevelUnionSwitch \
typeDescrGenWIthNoXER languageSpec
typeDescrGenWIthNoXER languageSpec asn1_opentype
ifdef DYN
CODIRS += mfgen-xsd
......
--/////////////////////////////////////////////////////////////////////////////
-- Copyright (c) 2000-2017 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
--
--/////////////////////////////////////////////////////////////////////////////
Definitions
DEFINITIONS IMPLICIT TAGS ::=
BEGIN
IMPORTS
releaseCall-CAPv2
FROM Imported-Definitions ;
OPERATION ::= CLASS {
&ArgumentType ,
&operationCode INTEGER UNIQUE
}
WITH SYNTAX {
[ARGUMENT &ArgumentType]
[CODE &operationCode]
}
Invoke{OPERATION:Operations} ::= SEQUENCE {
opcode
OPERATION.&operationCode
({Operations}),
argument
OPERATION.&ArgumentType
({Operations}{@opcode})
}
CAPv2-Invoke ::= Invoke{{Supported-CAP-Operations-CAPv2}}
Supported-CAP-Operations-CAPv2 OPERATION ::= {
releaseCall-CAPv2
}
END
--/////////////////////////////////////////////////////////////////////////////
-- Copyright (c) 2000-2017 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
--
--/////////////////////////////////////////////////////////////////////////////
Imported-Definitions
DEFINITIONS IMPLICIT TAGS ::=
BEGIN
IMPORTS OPERATION FROM Definitions ;
releaseCall-CAPv2 OPERATION ::= {
ARGUMENT
INTEGER
CODE 22
}
END
##############################################################################
# Copyright (c) 2000-2017 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
#
##############################################################################
TOPDIR := ../..
include $(TOPDIR)/Makefile.regression
.PHONY: all clean dep
TTCN3_LIB = ttcn3$(RT2_SUFFIX)$(DYNAMIC_SUFFIX)
TTCN3_MODULES = Test.ttcn
ASN1_MODULES = Definitions.asn Imported_Definitions.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))
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 = opentype$(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) $(ASN1_MODULES)
$(TTCN3_COMPILER) $(COMPILER_FLAGS) $^
clean distclean:
$(RM) $(TARGET) $(OBJECTS) $(GENERATED_HEADERS) \
$(GENERATED_SOURCES) compile *.log
dep: $(GENERATED_SOURCES)
makedepend $(CPPFLAGS) $(GENERATED_SOURCES)
/******************************************************************************
* Copyright (c) 2000-2017 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 Test {
import from Definitions all;
function f_EPTF_CAPv2_createRCFromParams() return CAPv2_Invoke
{
var CAPv2_Invoke vl_CAPv2_RCMsg;
vl_CAPv2_RCMsg.argument.iNTEGER := 4;
return vl_CAPv2_RCMsg;
}
}
\ No newline at end of file
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