Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Eclipse Projects
Eclipse Titan
titan.core
Commits
a38c6d4c
Commit
a38c6d4c
authored
May 22, 2015
by
Elemer Lelik
Browse files
Sync with 5.3.0
parent
854bcf96
Changes
147
Expand all
Hide whitespace changes
Inline
Side-by-side
common/version.h
View file @
a38c6d4c
...
...
@@ -10,7 +10,7 @@
/* Version numbers */
#define TTCN3_MAJOR 5
#define TTCN3_MINOR
2
#define TTCN3_MINOR
3
#define TTCN3_PATCHLEVEL 0
//#define TTCN3_BUILDNUMBER 0
...
...
@@ -22,7 +22,7 @@
* TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 +
* TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER
*/
#define TTCN3_VERSION 50
2
00
#define TTCN3_VERSION 50
3
00
/* A monotonically increasing version number.
* An official release is deemed to have the highest possible build number (99)
...
...
compiler2/AST.cc
View file @
a38c6d4c
...
...
@@ -23,6 +23,7 @@
#include
"../common/version.h"
#include
"CodeGenHelper.hh"
#include
<limits.h>
#include
"ttcn3/profiler.h"
reffer
::
reffer
(
const
char
*
)
{}
...
...
@@ -774,7 +775,9 @@ namespace Common {
}
// pre_init function
bool
has_pre_init
=
false
;
if
(
output
->
functions
.
pre_init
)
{
bool
profiled
=
MOD_TTCN
==
get_moduletype
()
&&
is_file_profiled
(
get_filename
());
// always generate pre_init_module if the file is profiled
if
(
output
->
functions
.
pre_init
||
profiled
)
{
output
->
source
.
static_function_prototypes
=
mputstr
(
output
->
source
.
static_function_prototypes
,
"static void pre_init_module();
\n
"
);
...
...
@@ -800,11 +803,11 @@ namespace Common {
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
(
effective_module_functions
?
", "
:
""
),
get_modid
().
get_dispname
().
c_str
());
}
if
(
profile
r_enabled
&&
MOD_TTCN
==
get_moduletype
()
)
{
if
(
profile
d
)
{
output
->
source
.
static_function_bodies
=
mputprintf
(
output
->
source
.
static_function_bodies
,
"%s::init_ttcn3_profiler();
\n
"
"TTCN3_Stack_Depth stack_depth;
\n
"
"ttcn3_prof.enter_function(
\"
%s
\"
, 0,
\"
%s
\"
);
\n
"
,
get_filename
(),
get_modid
().
get_dispname
().
c_str
());
"ttcn3_prof.execute_line(
\"
%s
\"
, 0);
\n
"
,
get_modid
().
get_name
().
c_str
(),
get_filename
());
}
}
output
->
source
.
static_function_bodies
=
...
...
@@ -843,11 +846,10 @@ namespace Common {
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
(
effective_module_functions
?
", "
:
""
),
get_modid
().
get_dispname
().
c_str
());
}
if
(
profiler_enabled
&&
MOD_TTCN
==
get_moduletype
())
{
if
(
MOD_TTCN
==
get_moduletype
()
&&
is_file_profiled
(
get_filename
())
)
{
output
->
source
.
static_function_bodies
=
mputprintf
(
output
->
source
.
static_function_bodies
,
"TTCN3_Stack_Depth stack_depth;
\n
"
"ttcn3_prof.enter_function(
\"
%s
\"
, 0,
\"
%s
\"
);
\n
"
,
get_filename
(),
get_modid
().
get_dispname
().
c_str
());
"ttcn3_prof.execute_line(
\"
%s
\"
, 0);
\n
"
,
get_filename
());
}
}
output
->
source
.
static_function_bodies
=
...
...
@@ -1482,13 +1484,38 @@ namespace Common {
// language specific parts (definitions, imports, etc.)
//generate_code_internal(&target); <- needed to pass cgh
generate_code_internal
(
cgh
);
output_struct
*
output
=
cgh
.
get_current_outputstruct
();
// string literals
generate_literals
(
cgh
.
get_current_outputstruct
()
);
generate_literals
(
output
);
// module level entry points
generate_functions
(
cgh
.
get_current_outputstruct
()
);
generate_functions
(
output
);
// type conversion functions for type compatibility
generate_conversion_functions
(
cgh
.
get_current_outputstruct
());
generate_conversion_functions
(
output
);
/* generate the initializer function for the TTCN-3 profiler
* (this is done at the end of the code generation, to make sure all code
* lines have been added to the profiler database) */
if
(
is_file_profiled
(
get_filename
()))
{
output
->
source
.
global_vars
=
mputstr
(
output
->
source
.
global_vars
,
"
\n
/* Initializing TTCN-3 profiler */
\n
"
"void init_ttcn3_profiler()
\n
"
"{
\n
"
);
char
*
function_name
=
0
;
int
line_no
=
-
1
;
while
(
get_profiler_code_line
(
get_filename
(),
&
function_name
,
&
line_no
))
{
output
->
source
.
global_vars
=
mputprintf
(
output
->
source
.
global_vars
,
" ttcn3_prof.create_line(ttcn3_prof.get_element(
\"
%s
\"
), %d);
\n
"
,
get_filename
(),
line_no
);
if
(
0
!=
function_name
)
{
output
->
source
.
global_vars
=
mputprintf
(
output
->
source
.
global_vars
,
" ttcn3_prof.create_function(ttcn3_prof.get_element(
\"
%s
\"
), %d,
\"
%s
\"
);
\n
"
,
get_filename
(),
line_no
,
function_name
);
}
}
output
->
source
.
global_vars
=
mputstr
(
output
->
source
.
global_vars
,
"}
\n\n
"
);
}
}
void
Module
::
dump
(
unsigned
level
)
const
...
...
compiler2/Setting.cc
View file @
a38c6d4c
...
...
@@ -18,6 +18,7 @@
#include
"Value.hh"
#include
"Int.hh"
#include
"main.hh"
#include
"ttcn3/profiler.h"
namespace
Common
{
...
...
@@ -232,11 +233,20 @@ namespace Common {
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
(
effective_module_functions
?
", "
:
""
),
entityname
);
}
if
(
profiler_enabled
)
{
if
(
is_file_profiled
(
filename
))
{
// .ttcnpp -> .ttcn
size_t
file_name_len
=
strlen
(
filename
);
if
(
'p'
==
filename
[
file_name_len
-
1
]
&&
'p'
==
filename
[
file_name_len
-
2
])
{
file_name_len
-=
2
;
}
char
*
file_name2
=
mcopystrn
(
filename
,
file_name_len
);
str
=
mputprintf
(
str
,
"TTCN3_Stack_Depth stack_depth;
\n
"
"ttcn3_prof.enter_function(
\"
%s
\"
, %d,
\"
%s
\"
);
\n
"
,
filename
,
yyloc
.
first_line
,
entityname
);
"ttcn3_prof.enter_function(
\"
%s
\"
, %d);
\n
"
,
file_name2
,
yyloc
.
first_line
);
insert_profiler_code_line
(
file_name2
,
(
0
==
strcmp
(
entitytype
,
"CONTROLPART"
)
?
"control"
:
entityname
),
yyloc
.
first_line
);
Free
(
file_name2
);
}
}
return
str
;
...
...
@@ -248,11 +258,20 @@ namespace Common {
if
(
include_location_info
&&
!
transparency
)
{
str
=
mputprintf
(
str
,
"current_location.update_lineno(%d);
\n
"
,
yyloc
.
first_line
);
if
(
profiler_enabled
)
{
const
char
*
file_name
=
get_filename
();
if
(
is_file_profiled
(
file_name
))
{
// .ttcnpp -> .ttcn
size_t
file_name_len
=
strlen
(
file_name
);
if
(
'p'
==
file_name
[
file_name_len
-
1
]
&&
'p'
==
file_name
[
file_name_len
-
2
])
{
file_name_len
-=
2
;
}
char
*
file_name2
=
mcopystrn
(
file_name
,
file_name_len
);
str
=
mputprintf
(
str
,
"ttcn3_prof.execute_line(
\"
%s
\"
, %d);
\n
"
,
get_filename
(),
yyloc
.
first_line
);
file_name2
,
yyloc
.
first_line
);
insert_profiler_code_line
(
file_name2
,
NULL
,
yyloc
.
first_line
);
Free
(
file_name2
);
}
if
(
tcov_file_name
&&
in_tcov_files
(
get_
filename
()
))
{
if
(
tcov_file_name
&&
in_tcov_files
(
file
_
name
))
{
effective_module_lines
=
mputprintf
(
effective_module_lines
,
"%s%d"
,
(
effective_module_lines
?
", "
:
""
),
yyloc
.
first_line
);
...
...
compiler2/Type.cc
View file @
a38c6d4c
...
...
@@ -149,7 +149,7 @@ namespace Common {
}
}
Type
*
Type
::
get_stream_type
(
MessageEncodingType_t
encoding_type
)
Type
*
Type
::
get_stream_type
(
MessageEncodingType_t
encoding_type
,
int
stream_variant
)
{
switch
(
encoding_type
)
{
case
CT_BER
:
...
...
@@ -159,7 +159,11 @@ namespace Common {
case
CT_JSON
:
return
get_pooltype
(
T_OSTR
);
case
CT_TEXT
:
return
get_pooltype
(
T_CSTR
);
if
(
stream_variant
==
0
){
return
get_pooltype
(
T_CSTR
);
}
else
{
return
get_pooltype
(
T_OSTR
);
}
default:
FATAL_ERROR
(
"Type::get_stream_type()"
);
return
0
;
...
...
@@ -3529,6 +3533,20 @@ namespace Common {
{
if
(
typetype
!=
T_SEQOF
)
FATAL_ERROR
(
"Type::is_compatible_record_of()"
);
if
(
this
==
p_type
)
return
true
;
else
if
(
T_SEQOF
==
p_type
->
get_type_refd_last
()
->
typetype
&&
is_pregenerated
()
&&
p_type
->
is_pregenerated
()
&&
get_ofType
()
->
get_type_refd_last
()
->
typetype
==
p_type
->
get_ofType
()
->
get_type_refd_last
()
->
typetype
&&
(
use_runtime_2
||
get_optimize_attribute
()
==
p_type
->
get_optimize_attribute
()))
{
// Pre-generated record-ofs of the same element type are compatible with
// each other (in RT1 optimized record-ofs are not compatible with non-optimized ones)
if
(
!
is_subtype_length_compatible
(
p_type
))
{
p_info
->
set_is_erroneous
(
this
,
p_type
,
string
(
"Incompatible "
"record of/SEQUENCE OF subtypes"
));
return
false
;
}
return
true
;
}
else
if
(
!
use_runtime_2
||
!
p_info
||
(
p_info
&&
p_info
->
is_strict
()))
return
false
;
switch
(
p_type
->
typetype
)
{
...
...
@@ -3878,6 +3896,20 @@ namespace Common {
{
if
(
typetype
!=
T_SETOF
)
FATAL_ERROR
(
"Type::is_compatible_set_of()"
);
if
(
this
==
p_type
)
return
true
;
else
if
(
T_SETOF
==
p_type
->
get_type_refd_last
()
->
typetype
&&
is_pregenerated
()
&&
p_type
->
is_pregenerated
()
&&
get_ofType
()
->
get_type_refd_last
()
->
typetype
==
p_type
->
get_ofType
()
->
get_type_refd_last
()
->
typetype
&&
(
use_runtime_2
||
get_optimize_attribute
()
==
p_type
->
get_optimize_attribute
()))
{
// Pre-generated set-ofs of the same element type are compatible with
// each other (in RT1 optimized set-ofs are not compatible with non-optimized ones)
if
(
!
is_subtype_length_compatible
(
p_type
))
{
p_info
->
set_is_erroneous
(
this
,
p_type
,
string
(
"Incompatible "
"set of/SET OF subtypes"
));
return
false
;
}
return
true
;
}
else
if
(
!
use_runtime_2
||
!
p_info
||
(
p_info
&&
p_info
->
is_strict
()))
return
false
;
Type
*
of_type
=
get_ofType
();
...
...
@@ -5523,6 +5555,7 @@ end_ext:
case
T_INT
:
case
T_OSTR
:
case
T_CSTR
:
case
T_USTR
:
// TTCN3 universal charstring
// these basic types support TEXT encoding by default
return
true
;
default:
...
...
@@ -6833,6 +6866,50 @@ end_ext:
}
return
dispname
;
}
bool
Type
::
is_pregenerated
()
{
// records/sets of base types are already pre-generated, only a type alias will be generated
// exception: record of universal charstring with the XER coding instruction "anyElement"
if
(
!
force_gen_seof
&&
(
T_SEQOF
==
get_type_refd_last
()
->
typetype
||
T_SETOF
==
get_type_refd_last
()
->
typetype
)
&&
(
NULL
==
xerattrib
||
/* check for "anyElement" at the record of type */
NamespaceRestriction
::
UNUSED
==
xerattrib
->
anyElement_
.
type_
)
&&
(
NULL
==
u
.
seof
.
ofType
->
xerattrib
||
/* check for "anyElement" at the element type */
NamespaceRestriction
::
UNUSED
==
u
.
seof
.
ofType
->
xerattrib
->
anyElement_
.
type_
))
{
switch
(
u
.
seof
.
ofType
->
get_type_refd_last
()
->
typetype
)
{
case
T_BOOL
:
case
T_INT
:
case
T_INT_A
:
case
T_REAL
:
case
T_BSTR
:
case
T_BSTR_A
:
case
T_HSTR
:
case
T_OSTR
:
case
T_CSTR
:
case
T_NUMERICSTRING
:
case
T_PRINTABLESTRING
:
case
T_IA5STRING
:
case
T_VISIBLESTRING
:
case
T_UNRESTRICTEDSTRING
:
case
T_UTCTIME
:
case
T_GENERALIZEDTIME
:
case
T_USTR
:
case
T_UTF8STRING
:
case
T_TELETEXSTRING
:
case
T_VIDEOTEXSTRING
:
case
T_GRAPHICSTRING
:
case
T_GENERALSTRING
:
case
T_UNIVERSALSTRING
:
case
T_BMPSTRING
:
case
T_OBJECTDESCRIPTOR
:
return
true
;
default:
return
false
;
}
}
return
false
;
}
}
// namespace Common
compiler2/Type.hh
View file @
a38c6d4c
...
...
@@ -244,7 +244,7 @@ namespace Common {
static
const
char
*
get_encoding_name
(
MessageEncodingType_t
encoding_type
);
/** Returns a pool type that represents the encoded stream of the given
* \a encoding_type. */
static
Type
*
get_stream_type
(
MessageEncodingType_t
encoding_type
);
static
Type
*
get_stream_type
(
MessageEncodingType_t
encoding_type
,
int
stream_variant
=
0
);
enum
truth
{
No
,
Maybe
,
Yes
...
...
@@ -1017,6 +1017,10 @@ namespace Common {
otherwise returns false. **/
bool
ispresent_anyvalue_embedded_field
(
Type
*
t
,
Ttcn
::
FieldOrArrayRefs
*
subrefs
,
size_t
begin_index
);
/** Returns true if the C++ class for this type has already been pre-generated
* or false if it still needs to be generated */
bool
is_pregenerated
();
public:
/** Generates type specific call for the reference used in isbound call
* into argument \a expr. Argument \a subrefs holds the reference path
...
...
compiler2/Type_codegen.cc
View file @
a38c6d4c
...
...
@@ -382,6 +382,16 @@ void Type::generate_code_typedescriptor(output_struct *target)
"NULL, "
);
}
}
if
(
T_SEQOF
==
get_type_refd_last
()
->
typetype
||
T_SETOF
==
get_type_refd_last
()
->
typetype
)
{
target
->
source
.
global_vars
=
mputprintf
(
target
->
source
.
global_vars
,
"&%s_descr_, "
,
get_type_refd_last
()
->
u
.
seof
.
ofType
->
get_genname_typedescriptor
(
my_scope
).
c_str
());
}
else
{
target
->
source
.
global_vars
=
mputstr
(
target
->
source
.
global_vars
,
"NULL, "
);
}
target
->
source
.
global_vars
=
mputprintf
(
target
->
source
.
global_vars
,
"TTCN_Typedescriptor_t::%s };
\n
"
...
...
@@ -483,6 +493,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
any_except
=
0
,
nof_ns_uris
=
0
;
const
char
*
dfe_str
=
0
;
char
**
ns_uris
=
0
;
char
*
oftype_descr_name
=
0
;
if
(
xerattrib
)
{
change_name
(
last_s
,
xerattrib
->
name_
);
...
...
@@ -572,6 +583,12 @@ void Type::generate_code_xerdescriptor(output_struct* target)
size_t
last_len
=
2
+
last_s
.
size
();
// 2 for > \n
size_t
bxer_len
=
2
+
bxer_name
.
size
();
// 2 for > \n
if
((
T_SEQOF
==
last
->
typetype
||
T_SETOF
==
last
->
typetype
)
&&
T_ANYTYPE
!=
last
->
u
.
seof
.
ofType
->
get_type_refd_last
()
->
typetype
)
{
// anytypes don't have XER descriptors
oftype_descr_name
=
mprintf
(
"&%s_xer_"
,
last
->
u
.
seof
.
ofType
->
get_genname_typedescriptor
(
my_scope
).
c_str
());
}
// Generate a separate variable for the namespace URIs, if there are any
char
*
ns_uris_var
=
0
;
if
(
ns_uris
&&
nof_ns_uris
)
{
...
...
@@ -591,7 +608,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
target
->
source
.
global_vars
=
mputprintf
(
target
->
source
.
global_vars
,
"const XERdescriptor_t %s_xer_ = { {
\"
%s>
\\
n
\"
,
\"
%s>
\\
n
\"
},"
" {%lu, %lu}, %s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s, WHITESPACE_%s, %c%s, "
"&%s, %ld, %u, %s };
\n
"
,
"&%s, %ld, %u,
%s,
%s };
\n
"
,
gennameown_str
,
bxer_name
.
c_str
(),
last_s
.
c_str
(),
// names
(
unsigned
long
)
bxer_len
,
(
unsigned
long
)
last_len
,
// lengths
...
...
@@ -618,10 +635,12 @@ void Type::generate_code_xerdescriptor(output_struct* target)
"module_object"
,
ns_index
,
nof_ns_uris
,
(
ns_uris_var
?
ns_uris_var
:
"NULL"
)
(
ns_uris_var
?
ns_uris_var
:
"NULL"
),
(
oftype_descr_name
?
oftype_descr_name
:
"NULL"
)
);
Free
(
ns_uris_var
);
Free
(
oftype_descr_name
);
}
void
Type
::
generate_code_rawdescriptor
(
output_struct
*
target
)
...
...
@@ -1471,6 +1490,7 @@ void Type::generate_code_Se(output_struct *target)
cur
.
dispname
=
id
.
get_ttcnname
().
c_str
();
cur
.
isOptional
=
cf
->
get_is_optional
();
cur
.
isDefault
=
cf
->
has_default
();
cur
.
optimizedMemAlloc
=
cur
.
of_type
&&
(
type
->
get_optimize_attribute
()
==
"memalloc"
);
if
(
cur
.
isDefault
)
{
Value
*
defval
=
cf
->
get_defval
();
const_def
cdef
;
...
...
@@ -1810,6 +1830,41 @@ bool Type::is_untagged() const { return xerattrib && xerattrib->untagged_; }
void
Type
::
generate_code_SeOf
(
output_struct
*
target
)
{
const
Type
*
oftypelast
=
u
.
seof
.
ofType
->
get_type_refd_last
();
const
string
&
oftypename
=
u
.
seof
.
ofType
->
get_genname_value
(
my_scope
);
boolean
optimized_memalloc
=
!
use_runtime_2
&&
get_optimize_attribute
()
==
"memalloc"
;
if
(
is_pregenerated
())
{
switch
(
oftypelast
->
typetype
)
{
case
T_USTR
:
case
T_UTF8STRING
:
case
T_TELETEXSTRING
:
case
T_VIDEOTEXSTRING
:
case
T_GRAPHICSTRING
:
case
T_GENERALSTRING
:
case
T_UNIVERSALSTRING
:
case
T_BMPSTRING
:
case
T_OBJECTDESCRIPTOR
:
target
->
header
.
typedefs
=
mputprintf
(
target
->
header
.
typedefs
,
"typedef PreGenRecordOf::PREGEN__%s__OF__UNIVERSAL__CHARSTRING%s %s;
\n
"
"typedef PreGenRecordOf::PREGEN__%s__OF__UNIVERSAL__CHARSTRING%s_template %s_template;
\n
"
,
(
typetype
==
T_SEQOF
)
?
"RECORD"
:
"SET"
,
optimized_memalloc
?
"__OPTIMIZED"
:
""
,
get_genname_own
().
c_str
(),
(
typetype
==
T_SEQOF
)
?
"RECORD"
:
"SET"
,
optimized_memalloc
?
"__OPTIMIZED"
:
""
,
get_genname_own
().
c_str
());
return
;
default:
target
->
header
.
typedefs
=
mputprintf
(
target
->
header
.
typedefs
,
"typedef PreGenRecordOf::PREGEN__%s__OF__%s%s %s;
\n
"
"typedef PreGenRecordOf::PREGEN__%s__OF__%s%s_template %s_template;
\n
"
,
(
typetype
==
T_SEQOF
)
?
"RECORD"
:
"SET"
,
oftypename
.
c_str
(),
optimized_memalloc
?
"__OPTIMIZED"
:
""
,
get_genname_own
().
c_str
(),
(
typetype
==
T_SEQOF
)
?
"RECORD"
:
"SET"
,
oftypename
.
c_str
(),
optimized_memalloc
?
"__OPTIMIZED"
:
""
,
get_genname_own
().
c_str
());
return
;
}
}
stringpool
pool
;
struct_of_def
sofdef
;
memset
(
&
sofdef
,
0
,
sizeof
(
sofdef
));
...
...
@@ -1826,10 +1881,8 @@ void Type::generate_code_SeOf(output_struct *target)
}
// If a record of UTF8String, we need to prepare for ANY-ATTRIBUTES and
// ANY-ELEMENT
const
Type
*
oftypelast
=
u
.
seof
.
ofType
->
get_type_refd_last
();
sofdef
.
xerAnyAttrElem
=
oftypelast
->
typetype
==
T_USTR
||
oftypelast
->
typetype
==
T_UTF8STRING
;
const
string
&
oftypename
=
u
.
seof
.
ofType
->
get_genname_value
(
my_scope
);
sofdef
.
type
=
oftypename
.
c_str
();
sofdef
.
has_opentypes
=
get_has_opentypes
();
const
string
&
oftypedescrname
=
...
...
@@ -1895,7 +1948,7 @@ void Type::generate_code_SeOf(output_struct *target)
sofdef
.
hasRaw
=
true
;
}
else
sofdef
.
hasRaw
=
false
;
if
(
!
use_runtime_2
&&
get_optimize_attribute
()
==
"
memalloc
"
)
{
if
(
optimized_
memalloc
)
{
defRecordOfClassMemAllocOptimized
(
&
sofdef
,
target
);
}
else
{
defRecordOfClass
(
&
sofdef
,
target
);
...
...
compiler2/Value.cc
View file @
a38c6d4c
...
...
@@ -143,6 +143,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYMINUS
:
...
...
@@ -446,6 +447,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYMINUS
:
...
...
@@ -809,6 +811,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
default:
FATAL_ERROR
(
"Value::Value()"
);
...
...
@@ -1388,6 +1391,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYMINUS
:
...
...
@@ -1567,6 +1571,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYMINUS
:
...
...
@@ -1876,6 +1881,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYMINUS
:
...
...
@@ -2765,6 +2771,7 @@ namespace Common {
case
OPTYPE_ISCHOSEN_T
:
case
OPTYPE_ISVALUE
:
case
OPTYPE_ISBOUND
:
case
OPTYPE_PROF_RUNNING
:
return
Type
::
T_BOOL
;
case
OPTYPE_GETVERDICT
:
return
Type
::
T_VERDICT
;
...
...
@@ -3448,6 +3455,8 @@ namespace Common {
return
"log2str()"
;
case
OPTYPE_TTCN2STRING
:
return
"ttcn2string()"
;
case
OPTYPE_PROF_RUNNING
:
return
"@profiler.running"
;
default:
FATAL_ERROR
(
"Value::get_opname()"
);
}
// switch
...
...
@@ -6038,6 +6047,7 @@ error:
switch
(
u
.
expr
.
v_optype
)
{
case
OPTYPE_COMP_NULL
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
case
OPTYPE_COMP_MTC
:
case
OPTYPE_COMP_SYSTEM
:
...
...
@@ -6998,6 +7008,7 @@ error:
case
OPTYPE_COMP_ALIVE_ALL
:
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_PROF_RUNNING
:
case
OPTYPE_RNDWITHVAL
:
// v1
case
OPTYPE_COMP_RUNNING
:
// v1
case
OPTYPE_COMP_ALIVE
:
...
...
@@ -8294,6 +8305,7 @@ error:
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
case
OPTYPE_RNDWITHVAL
:
// v1
case
OPTYPE_MATCH
:
// v1 t2
case
OPTYPE_UNDEF_RUNNING
:
// v1
...
...
@@ -9797,6 +9809,7 @@ error:
case
OPTYPE_COMP_ALIVE_ALL
:
// -
case
OPTYPE_TMR_RUNNING_ANY
:
// -
case
OPTYPE_GETVERDICT
:
// -
case
OPTYPE_PROF_RUNNING
:
// -
break
;
// nothing to do
case
OPTYPE_MATCH
:
// v1 t2
...
...
@@ -10496,6 +10509,8 @@ error:
}
ret_val
+=
')'
;
return
ret_val
;
}
case
OPTYPE_PROF_RUNNING
:
return
string
(
"@profiler.running"
);
default:
return
string
(
"<unsupported optype>"
);
}
// switch u.expr.v_optype
...
...
@@ -11771,6 +11786,9 @@ error:
}
expr
->
expr
=
mputstr
(
expr
->
expr
,
")"
);
}
break
;
case
OPTYPE_PROF_RUNNING
:
expr
->
expr
=
mputstr
(
expr
->
expr
,
"ttcn3_prof.is_running()"
);
break
;
default:
FATAL_ERROR
(
"Value::generate_code_expr_expr()"
);
}
...
...
@@ -12857,6 +12875,7 @@ error:
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
return
true
;
case
OPTYPE_ENCODE
:
case
OPTYPE_DECODE
:
...
...
@@ -13178,13 +13197,16 @@ error:
if
(
t_subrefs
)
{
// the evaluation of the reference does not have side effects
// (i.e. false shall be returned) only if all sub-references point to
// mandatory fields of record/set types
// mandatory fields of record/set types, and neither sub-reference points
// to a field of a union type
Type
*
t_type
=
t_ass
->
get_Type
();
for
(
size_t
i
=
0
;
i
<
t_subrefs
->
get_nof_refs
();
i
++
)
{
Ttcn
::
FieldOrArrayRef
*
t_fieldref
=
t_subrefs
->
get_ref
(
i
);
if
(
t_fieldref
->
get_type
()
==
Ttcn
::
FieldOrArrayRef
::
FIELD_REF
)
{
CompField
*
t_cf
=
t_type
->
get_comp_byName
(
*
t_fieldref
->
get_id
());
if
(
t_cf
->
get_is_optional
())
return
true
;
if
(
Type
::
T_CHOICE_T
==
t_type
->
get_type_refd_last
()
->
get_typetype
()
||
Type
::
T_CHOICE_A
==
t_type
->
get_type_refd_last
()
->
get_typetype
()
||
t_cf
->
get_is_optional
())
return
true
;
t_type
=
t_cf
->
get_type
();
}
else
return
true
;
}
...
...
compiler2/Value.hh
View file @
a38c6d4c
...
...
@@ -238,7 +238,8 @@ namespace Common {
OPTYPE_EXECUTE
,
// r1 [v2]
OPTYPE_EXECUTE_REFD
,
// v1 t_list2 [v3]
OPTYPE_LOG2STR
,
// logagrs 98
OPTYPE_LOG2STR
,
// logagrs
OPTYPE_PROF_RUNNING
,
// - 99
NUMBER_OF_OPTYPES
// must be last
};
...
...
@@ -369,7 +370,8 @@ namespace Common {
Value
(
valuetype_t
p_vt
,
Value
*
p_v
,
Ttcn
::
ParsedActualParameters
*
p_t_list
);
/** Constructor used by V_EXPR "-": RND, TESTCASENAME, COMP_NULL, COMP_MTC,
* COMP_SYSTEM, COMP_SELF, COMP_RUNNING_ANY, COMP_RUNNING_ALL,
* COMP_ALIVE_ALL, COMP_ALIVE_ANY, TMR_RUNNING_ANY, GETVERDICT */
* COMP_ALIVE_ALL, COMP_ALIVE_ANY, TMR_RUNNING_ANY, GETVERDICT,
* PROF_RUNNING */
Value
(
operationtype_t
p_optype
);
/** Constructor used by V_EXPR "v1" */
Value
(
operationtype_t
p_optype
,
Value
*
p_v1
);
...
...
compiler2/compiler.1
View file @
a38c6d4c
...
...
@@ -8,6 +8,8 @@ compiler \- TTCN-3 and ASN.1 to C++ translator
.IR " verb_level" " \|]"
.RB "[\| " \-K
.IR " file" " \|]"
.RB "[\| " \-z
.IR " file" " \|]"
.RB "[\| " \-o
.IR " dir" " \|]"
.RB "[\| " \-P
...
...
@@ -294,6 +296,11 @@ checking
.B \-Y
Enforces legacy behaviour of the "out" function parameters (see refguide).
.TP
.BI \-z " file"
Enables profiling and code coverage in the selected TTCN-3 files. The
.I file
argument contains a list of TTCN-3 files separated by new lines. Each TTCN-3 file must be among the compiler's TTCN-3 file arguments.
.TP
.B \-
The single dash character as command line argument controls the
.I selective code generation
...
...
compiler2/datatypes.h
View file @
a38c6d4c
...
...
@@ -70,6 +70,8 @@ typedef struct {
boolean
jsonOmitAsNull
;
const
char
*
jsonAlias
;
const
char
*
jsonDefaultValue
;
/** true if the field is a record-of or set-of with optimized memory allocation */
boolean
optimizedMemAlloc
;
}
struct_field
;
/** Structure (record, set, union, anytype) descriptor for code generation */
...
...
compiler2/main.cc
View file @
a38c6d4c