Skip to content
GitLab
Menu
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 @@
...
@@ -10,7 +10,7 @@
/* Version numbers */
/* Version numbers */
#define TTCN3_MAJOR 5
#define TTCN3_MAJOR 5
#define TTCN3_MINOR
2
#define TTCN3_MINOR
3
#define TTCN3_PATCHLEVEL 0
#define TTCN3_PATCHLEVEL 0
//#define TTCN3_BUILDNUMBER 0
//#define TTCN3_BUILDNUMBER 0
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
* TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 +
* TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 +
* TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER
* TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER
*/
*/
#define TTCN3_VERSION 50
2
00
#define TTCN3_VERSION 50
3
00
/* A monotonically increasing version number.
/* A monotonically increasing version number.
* An official release is deemed to have the highest possible build number (99)
* An official release is deemed to have the highest possible build number (99)
...
...
compiler2/AST.cc
View file @
a38c6d4c
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "../common/version.h"
#include "../common/version.h"
#include "CodeGenHelper.hh"
#include "CodeGenHelper.hh"
#include <limits.h>
#include <limits.h>
#include "ttcn3/profiler.h"
reffer
::
reffer
(
const
char
*
)
{}
reffer
::
reffer
(
const
char
*
)
{}
...
@@ -774,7 +775,9 @@ namespace Common {
...
@@ -774,7 +775,9 @@ namespace Common {
}
}
// pre_init function
// pre_init function
bool
has_pre_init
=
false
;
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
=
output
->
source
.
static_function_prototypes
=
mputstr
(
output
->
source
.
static_function_prototypes
,
mputstr
(
output
->
source
.
static_function_prototypes
,
"static void pre_init_module();
\n
"
);
"static void pre_init_module();
\n
"
);
...
@@ -800,11 +803,11 @@ namespace Common {
...
@@ -800,11 +803,11 @@ namespace Common {
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
(
effective_module_functions
?
", "
:
""
),
get_modid
().
get_dispname
().
c_str
());
(
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
,
output
->
source
.
static_function_bodies
=
mputprintf
(
output
->
source
.
static_function_bodies
,
"%s::init_ttcn3_profiler();
\n
"
"TTCN3_Stack_Depth stack_depth;
\n
"
"TTCN3_Stack_Depth stack_depth;
\n
"
"ttcn3_prof.enter_function(
\"
%s
\"
, 0,
\"
%s
\"
);
\n
"
,
"ttcn3_prof.execute_line(
\"
%s
\"
, 0);
\n
"
,
get_modid
().
get_name
().
c_str
(),
get_filename
());
get_filename
(),
get_modid
().
get_dispname
().
c_str
());
}
}
}
}
output
->
source
.
static_function_bodies
=
output
->
source
.
static_function_bodies
=
...
@@ -843,11 +846,10 @@ namespace Common {
...
@@ -843,11 +846,10 @@ namespace Common {
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
(
effective_module_functions
?
", "
:
""
),
get_modid
().
get_dispname
().
c_str
());
(
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
,
output
->
source
.
static_function_bodies
=
mputprintf
(
output
->
source
.
static_function_bodies
,
"TTCN3_Stack_Depth stack_depth;
\n
"
"TTCN3_Stack_Depth stack_depth;
\n
"
"ttcn3_prof.enter_function(
\"
%s
\"
, 0,
\"
%s
\"
);
\n
"
,
"ttcn3_prof.execute_line(
\"
%s
\"
, 0);
\n
"
,
get_filename
());
get_filename
(),
get_modid
().
get_dispname
().
c_str
());
}
}
}
}
output
->
source
.
static_function_bodies
=
output
->
source
.
static_function_bodies
=
...
@@ -1482,13 +1484,38 @@ namespace Common {
...
@@ -1482,13 +1484,38 @@ namespace Common {
// language specific parts (definitions, imports, etc.)
// language specific parts (definitions, imports, etc.)
//generate_code_internal(&target); <- needed to pass cgh
//generate_code_internal(&target); <- needed to pass cgh
generate_code_internal
(
cgh
);
generate_code_internal
(
cgh
);
output_struct
*
output
=
cgh
.
get_current_outputstruct
();
// string literals
// string literals
generate_literals
(
cgh
.
get_current_outputstruct
()
);
generate_literals
(
output
);
// module level entry points
// module level entry points
generate_functions
(
cgh
.
get_current_outputstruct
()
);
generate_functions
(
output
);
// type conversion functions for type compatibility
// 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
void
Module
::
dump
(
unsigned
level
)
const
...
...
compiler2/Setting.cc
View file @
a38c6d4c
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "Value.hh"
#include "Value.hh"
#include "Int.hh"
#include "Int.hh"
#include "main.hh"
#include "main.hh"
#include "ttcn3/profiler.h"
namespace
Common
{
namespace
Common
{
...
@@ -232,11 +233,20 @@ namespace Common {
...
@@ -232,11 +233,20 @@ namespace Common {
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
mputprintf
(
effective_module_functions
,
"%s
\"
%s
\"
"
,
(
effective_module_functions
?
", "
:
""
),
entityname
);
(
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
,
str
=
mputprintf
(
str
,
"TTCN3_Stack_Depth stack_depth;
\n
"
"TTCN3_Stack_Depth stack_depth;
\n
"
"ttcn3_prof.enter_function(
\"
%s
\"
, %d,
\"
%s
\"
);
\n
"
,
"ttcn3_prof.enter_function(
\"
%s
\"
, %d);
\n
"
,
file_name2
,
yyloc
.
first_line
);
filename
,
yyloc
.
first_line
,
entityname
);
insert_profiler_code_line
(
file_name2
,
(
0
==
strcmp
(
entitytype
,
"CONTROLPART"
)
?
"control"
:
entityname
),
yyloc
.
first_line
);
Free
(
file_name2
);
}
}
}
}
return
str
;
return
str
;
...
@@ -248,11 +258,20 @@ namespace Common {
...
@@ -248,11 +258,20 @@ namespace Common {
if
(
include_location_info
&&
!
transparency
)
{
if
(
include_location_info
&&
!
transparency
)
{
str
=
mputprintf
(
str
,
"current_location.update_lineno(%d);
\n
"
,
str
=
mputprintf
(
str
,
"current_location.update_lineno(%d);
\n
"
,
yyloc
.
first_line
);
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
"
,
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
=
effective_module_lines
=
mputprintf
(
effective_module_lines
,
"%s%d"
,
mputprintf
(
effective_module_lines
,
"%s%d"
,
(
effective_module_lines
?
", "
:
""
),
yyloc
.
first_line
);
(
effective_module_lines
?
", "
:
""
),
yyloc
.
first_line
);
...
...
compiler2/Type.cc
View file @
a38c6d4c
...
@@ -149,7 +149,7 @@ namespace Common {
...
@@ -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
)
{
switch
(
encoding_type
)
{
case
CT_BER
:
case
CT_BER
:
...
@@ -159,7 +159,11 @@ namespace Common {
...
@@ -159,7 +159,11 @@ namespace Common {
case
CT_JSON
:
case
CT_JSON
:
return
get_pooltype
(
T_OSTR
);
return
get_pooltype
(
T_OSTR
);
case
CT_TEXT
:
case
CT_TEXT
:
return
get_pooltype
(
T_CSTR
);
if
(
stream_variant
==
0
){
return
get_pooltype
(
T_CSTR
);
}
else
{
return
get_pooltype
(
T_OSTR
);
}
default:
default:
FATAL_ERROR
(
"Type::get_stream_type()"
);
FATAL_ERROR
(
"Type::get_stream_type()"
);
return
0
;
return
0
;
...
@@ -3529,6 +3533,20 @@ namespace Common {
...
@@ -3529,6 +3533,20 @@ namespace Common {
{
{
if
(
typetype
!=
T_SEQOF
)
FATAL_ERROR
(
"Type::is_compatible_record_of()"
);
if
(
typetype
!=
T_SEQOF
)
FATAL_ERROR
(
"Type::is_compatible_record_of()"
);
if
(
this
==
p_type
)
return
true
;
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
else
if
(
!
use_runtime_2
||
!
p_info
||
(
p_info
&&
p_info
->
is_strict
()))
return
false
;
||
(
p_info
&&
p_info
->
is_strict
()))
return
false
;
switch
(
p_type
->
typetype
)
{
switch
(
p_type
->
typetype
)
{
...
@@ -3878,6 +3896,20 @@ namespace Common {
...
@@ -3878,6 +3896,20 @@ namespace Common {
{
{
if
(
typetype
!=
T_SETOF
)
FATAL_ERROR
(
"Type::is_compatible_set_of()"
);
if
(
typetype
!=
T_SETOF
)
FATAL_ERROR
(
"Type::is_compatible_set_of()"
);
if
(
this
==
p_type
)
return
true
;
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
else
if
(
!
use_runtime_2
||
!
p_info
||
(
p_info
&&
p_info
->
is_strict
()))
return
false
;
||
(
p_info
&&
p_info
->
is_strict
()))
return
false
;
Type
*
of_type
=
get_ofType
();
Type
*
of_type
=
get_ofType
();
...
@@ -5523,6 +5555,7 @@ end_ext:
...
@@ -5523,6 +5555,7 @@ end_ext:
case
T_INT
:
case
T_INT
:
case
T_OSTR
:
case
T_OSTR
:
case
T_CSTR
:
case
T_CSTR
:
case
T_USTR
:
// TTCN3 universal charstring
// these basic types support TEXT encoding by default
// these basic types support TEXT encoding by default
return
true
;
return
true
;
default:
default:
...
@@ -6833,6 +6866,50 @@ end_ext:
...
@@ -6833,6 +6866,50 @@ end_ext:
}
}
return
dispname
;
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
}
// namespace Common
compiler2/Type.hh
View file @
a38c6d4c
...
@@ -244,7 +244,7 @@ namespace Common {
...
@@ -244,7 +244,7 @@ namespace Common {
static
const
char
*
get_encoding_name
(
MessageEncodingType_t
encoding_type
);
static
const
char
*
get_encoding_name
(
MessageEncodingType_t
encoding_type
);
/** Returns a pool type that represents the encoded stream of the given
/** Returns a pool type that represents the encoded stream of the given
* \a encoding_type. */
* \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
{
enum
truth
{
No
,
Maybe
,
Yes
No
,
Maybe
,
Yes
...
@@ -1017,6 +1017,10 @@ namespace Common {
...
@@ -1017,6 +1017,10 @@ namespace Common {
otherwise returns false. **/
otherwise returns false. **/
bool
ispresent_anyvalue_embedded_field
(
Type
*
t
,
bool
ispresent_anyvalue_embedded_field
(
Type
*
t
,
Ttcn
::
FieldOrArrayRefs
*
subrefs
,
size_t
begin_index
);
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:
public:
/** Generates type specific call for the reference used in isbound call
/** Generates type specific call for the reference used in isbound call
* into argument \a expr. Argument \a subrefs holds the reference path
* 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)
...
@@ -382,6 +382,16 @@ void Type::generate_code_typedescriptor(output_struct *target)
"NULL, "
);
"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
,
target
->
source
.
global_vars
=
mputprintf
(
target
->
source
.
global_vars
,
"TTCN_Typedescriptor_t::%s };
\n
"
"TTCN_Typedescriptor_t::%s };
\n
"
...
@@ -483,6 +493,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
...
@@ -483,6 +493,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
any_except
=
0
,
nof_ns_uris
=
0
;
any_except
=
0
,
nof_ns_uris
=
0
;
const
char
*
dfe_str
=
0
;
const
char
*
dfe_str
=
0
;
char
**
ns_uris
=
0
;
char
**
ns_uris
=
0
;
char
*
oftype_descr_name
=
0
;
if
(
xerattrib
)
{
if
(
xerattrib
)
{
change_name
(
last_s
,
xerattrib
->
name_
);
change_name
(
last_s
,
xerattrib
->
name_
);
...
@@ -572,6 +583,12 @@ void Type::generate_code_xerdescriptor(output_struct* target)
...
@@ -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
last_len
=
2
+
last_s
.
size
();
// 2 for > \n
size_t
bxer_len
=
2
+
bxer_name
.
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
// Generate a separate variable for the namespace URIs, if there are any
char
*
ns_uris_var
=
0
;
char
*
ns_uris_var
=
0
;
if
(
ns_uris
&&
nof_ns_uris
)
{
if
(
ns_uris
&&
nof_ns_uris
)
{
...
@@ -591,7 +608,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
...
@@ -591,7 +608,7 @@ void Type::generate_code_xerdescriptor(output_struct* target)
target
->
source
.
global_vars
=
mputprintf
(
target
->
source
.
global_vars
,
target
->
source
.
global_vars
=
mputprintf
(
target
->
source
.
global_vars
,
"const XERdescriptor_t %s_xer_ = { {
\"
%s>
\\
n
\"
,
\"
%s>
\\
n
\"
},"
"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, "
" {%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
,
gennameown_str
,
bxer_name
.
c_str
(),
last_s
.
c_str
(),
// names
bxer_name
.
c_str
(),
last_s
.
c_str
(),
// names
(
unsigned
long
)
bxer_len
,
(
unsigned
long
)
last_len
,
// lengths
(
unsigned
long
)
bxer_len
,
(
unsigned
long
)
last_len
,
// lengths
...
@@ -618,10 +635,12 @@ void Type::generate_code_xerdescriptor(output_struct* target)
...
@@ -618,10 +635,12 @@ void Type::generate_code_xerdescriptor(output_struct* target)
"module_object"
,
"module_object"
,
ns_index
,
ns_index
,
nof_ns_uris
,
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
(
ns_uris_var
);
Free
(
oftype_descr_name
);
}
}
void
Type
::
generate_code_rawdescriptor
(
output_struct
*
target
)
void
Type
::
generate_code_rawdescriptor
(
output_struct
*
target
)
...
@@ -1471,6 +1490,7 @@ void Type::generate_code_Se(output_struct *target)
...
@@ -1471,6 +1490,7 @@ void Type::generate_code_Se(output_struct *target)
cur
.
dispname
=
id
.
get_ttcnname
().
c_str
();
cur
.
dispname
=
id
.
get_ttcnname
().
c_str
();
cur
.
isOptional
=
cf
->
get_is_optional
();
cur
.
isOptional
=
cf
->
get_is_optional
();
cur
.
isDefault
=
cf
->
has_default
();
cur
.
isDefault
=
cf
->
has_default
();
cur
.
optimizedMemAlloc
=
cur
.
of_type
&&
(
type
->
get_optimize_attribute
()
==
"memalloc"
);
if
(
cur
.
isDefault
)
{
if
(
cur
.
isDefault
)
{
Value
*
defval
=
cf
->
get_defval
();
Value
*
defval
=
cf
->
get_defval
();
const_def
cdef
;
const_def
cdef
;
...
@@ -1810,6 +1830,41 @@ bool Type::is_untagged() const { return xerattrib && xerattrib->untagged_; }
...
@@ -1810,6 +1830,41 @@ bool Type::is_untagged() const { return xerattrib && xerattrib->untagged_; }
void
Type
::
generate_code_SeOf
(
output_struct
*
target
)
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
;
stringpool
pool
;
struct_of_def
sofdef
;
struct_of_def
sofdef
;
memset
(
&
sofdef
,
0
,
sizeof
(
sofdef
));
memset
(
&
sofdef
,
0
,
sizeof
(
sofdef
));
...
@@ -1826,10 +1881,8 @@ void Type::generate_code_SeOf(output_struct *target)
...
@@ -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
// If a record of UTF8String, we need to prepare for ANY-ATTRIBUTES and
// ANY-ELEMENT
// ANY-ELEMENT
const
Type
*
oftypelast
=
u
.
seof
.
ofType
->
get_type_refd_last
();
sofdef
.
xerAnyAttrElem
=
oftypelast
->
typetype
==
T_USTR
sofdef
.
xerAnyAttrElem
=
oftypelast
->
typetype
==
T_USTR
||
oftypelast
->
typetype
==
T_UTF8STRING
;
||
oftypelast
->
typetype
==
T_UTF8STRING
;
const
string
&
oftypename
=
u
.
seof
.
ofType
->
get_genname_value
(
my_scope
);
sofdef
.
type
=
oftypename
.
c_str
();
sofdef
.
type
=
oftypename
.
c_str
();
sofdef
.
has_opentypes
=
get_has_opentypes
();
sofdef
.
has_opentypes
=
get_has_opentypes
();
const
string
&
oftypedescrname
=
const
string
&
oftypedescrname
=
...
@@ -1895,7 +1948,7 @@ void Type::generate_code_SeOf(output_struct *target)
...
@@ -1895,7 +1948,7 @@ void Type::generate_code_SeOf(output_struct *target)
sofdef
.
hasRaw
=
true
;
sofdef
.
hasRaw
=
true
;
}
else
sofdef
.
hasRaw
=
false
;
}
else
sofdef
.
hasRaw
=
false
;
if
(
!
use_runtime_2
&&
get_optimize_attribute
()
==
"
memalloc
"
)
{
if
(
optimized_
memalloc
)
{
defRecordOfClassMemAllocOptimized
(
&
sofdef
,
target
);
defRecordOfClassMemAllocOptimized
(
&
sofdef
,
target
);
}
else
{
}
else
{
defRecordOfClass
(
&
sofdef
,
target
);
defRecordOfClass
(
&
sofdef
,
target
);
...
...
compiler2/Value.cc
View file @
a38c6d4c
...
@@ -143,6 +143,7 @@ namespace Common {
...
@@ -143,6 +143,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
break
;
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYMINUS
:
case
OPTYPE_UNARYMINUS
:
...
@@ -446,6 +447,7 @@ namespace Common {
...
@@ -446,6 +447,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
break
;
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYPLUS
:
// v1
case
OPTYPE_UNARYMINUS
:
case
OPTYPE_UNARYMINUS
:
...
@@ -809,6 +811,7 @@ namespace Common {
...
@@ -809,6 +811,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_TMR_RUNNING_ANY
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_GETVERDICT
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_TESTCASENAME
:
case
OPTYPE_PROF_RUNNING
:
break
;
break
;
default:
default:
FATAL_ERROR
(
"Value::Value()"
);
FATAL_ERROR
(
"Value::Value()"
);
...
@@ -1388,6 +1391,7 @@ namespace Common {
...
@@ -1388,6 +1391,7 @@ namespace Common {
case
OPTYPE_TMR_RUNNING_ANY
:
case
OP