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

Added new compiler option '-h', which allows converting universal charstrings...


Added new compiler option '-h', which allows converting universal charstrings to charstrings (bug 564585)
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
Change-Id: Ib73c458ba631710cabc1ef1e9b64928e0f79db31
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 2a2a977d
......@@ -4518,6 +4518,14 @@ namespace Common {
case T_GENERALIZEDTIME:
is_type_comp = true;
break;
case T_USTR:
case T_TELETEXSTRING:
case T_VIDEOTEXSTRING:
case T_GRAPHICSTRING:
case T_OBJECTDESCRIPTOR:
case T_GENERALSTRING:
is_type_comp = charstring_compat && (t1->typetype == T_CSTR);
break;
default:
is_type_comp = false;
break;
......
......@@ -4370,6 +4370,10 @@ bool Type::chk_this_refd_value(Value *value, Common::Assignment *lhs, expected_v
if (v_last->get_valuetype() == Value::V_CSTR
&& get_typetype_ttcn3(get_type_refd_last()->typetype) == T_USTR)
value->set_valuetype(Value::V_USTR);
if (v_last->get_valuetype() == Value::V_USTR &&
get_type_refd_last()->typetype == T_CSTR) {
value->set_valuetype(Value::V_CSTR);
}
// Check v_last against the subtype constraints.
if (sub_type!=NULL) sub_type->chk_this_value(value);
}
......
......@@ -3203,7 +3203,39 @@ namespace Common {
delete u.ref.ref;
set_val_ustr(ustr);
u.ustr.convert_str = true; // will be converted back to string
} else FATAL_ERROR("Value::set_valuetype()");
}
else if (p_valuetype == V_CSTR) {
Value *v_last = get_value_refd_last();
if (v_last->valuetype != V_USTR) {
FATAL_ERROR("Value::set_valuetype()");
}
ustring* old_str = v_last->u.ustr.val_ustr;
size_t nof_chars = old_str->size();
for (size_t i = 0; i < nof_chars; i++) {
const ustring::universal_char& uchar = (*old_str)[i];
if (uchar.group != 0 || uchar.plane != 0 || uchar.row != 0) {
error("This string value cannot contain multiple-byte characters, "
"but it has quadruple char(%u, %u, %u, %u) at index %lu",
uchar.group, uchar.plane, uchar.row, uchar.cell,
(unsigned long) i);
p_valuetype = V_ERROR;
break;
}
else if (uchar.cell > 127) {
error("This string value may not contain characters with code "
"higher than 127, but it has character with code %u (0x%02X) "
"at index %lu", uchar.cell, uchar.cell, (unsigned long) i);
p_valuetype = V_ERROR;
break;
}
}
delete u.ref.ref;
if (p_valuetype != V_ERROR) {
set_val_str(new string(*old_str));
}
u.ustr.convert_str = true; // will be converted back to string
}
else FATAL_ERROR("Value::set_valuetype()");
break;
case V_CHARSYMS:
switch(p_valuetype) {
......@@ -3294,7 +3326,7 @@ namespace Common {
warning("This string value may not contain characters with code "
"higher than 127, but it has character with code %u (0x%02X) "
"at index %lu", uchar.cell, uchar.cell, (unsigned long) i);
warning_flag = true;
warning_flag = true;
}
}
if (p_valuetype != V_ERROR) set_val_str(new string(*old_str));
......
......@@ -3,7 +3,7 @@
compiler \- TTCN-3 and ASN.1 to C++ translator
.SH SYNOPSIS
.B compiler
.RB "[\| " \-abcdDeEfFgiIjklLMnNpqrRsStuwxXyY0 " \|]"
.RB "[\| " \-abcdDeEfFghiIjklLMnNpqrRsStuwxXyY0 " \|]"
.RB "[\| " \-V
.IR " verb_level" " \|]"
.RB "[\| " \-J
......@@ -115,6 +115,9 @@ takes precedence over
.B \-i
if both are specified.
.TP
.B \-h
Allows unsafe universal charstring to charstring conversion.
.TP
.B \-i
The compiler error/warning messages
will contain only the
......
......@@ -100,7 +100,7 @@ boolean generate_skeleton = FALSE, force_overwrite = FALSE,
warnings_for_bad_variants = FALSE, debugger_active = FALSE,
legacy_unbound_union_fields = FALSE, split_to_slices = FALSE,
legacy_untagged_union, disable_user_info, legacy_codec_handling = FALSE,
realtime_features = FALSE, oop_features = FALSE;
realtime_features = FALSE, oop_features = FALSE, charstring_compat = FALSE;
// Default code splitting mode is set to 'no splitting'.
CodeGenHelper::split_type code_splitting_mode = CodeGenHelper::SPLIT_NONE;
......@@ -395,7 +395,7 @@ static boolean is_valid_asn1_filename(const char* file_name)
static void usage()
{
fprintf(stderr, "\n"
"usage: %s [-abcdDeEfFgiIjklLMnNOpqrRsStuwxXyY0] [-J file] [-K file] [-z file] [-V verb_level]\n"
"usage: %s [-abcdDeEfFghiIjklLMnNOpqrRsStuwxXyY0] [-J file] [-K file] [-z file] [-V verb_level]\n"
" [-o dir] [-U none|type|'number'] [-P modulename.top_level_pdu_name] [-Q number] ...\n"
" [-T] module.ttcn [-A] module.asn ...\n"
" or %s -v\n"
......@@ -413,6 +413,7 @@ static void usage()
" -f: force overwriting of output files\n"
" -F: force generation of records of/sets of basic types and remove their compatibility\n"
" -g: emulate GCC error/warning message format\n"
" -h: allow unsafe universal charstring to charstring conversion\n"
" -i: use only line numbers in error/warning messages\n"
" -I: enable real-time testing features\n"
" -j: disable JSON encoder/decoder functions\n"
......@@ -504,7 +505,7 @@ int main(int argc, char *argv[])
Sflag = false, Kflag = false, jflag = false, zflag = false, Fflag = false,
Mflag = false, Eflag = false, nflag = false, Bflag = false, errflag = false,
print_usage = false, ttcn2json = false, Nflag = false, Dflag = false,
eflag = false, Oflag = false, Iflag = false, kflag = false;
eflag = false, Oflag = false, Iflag = false, kflag = false, hflag = false;
CodeGenHelper cgh;
......@@ -600,7 +601,7 @@ int main(int argc, char *argv[])
if (!ttcn2json) {
for ( ; ; ) {
int c = getopt(argc, argv, "aA:bBcC:dDeEfFgiIjJ:kK:lLMnNo:OpP:qQ:rRsStT:uU:vV:wxXyYz:0-");
int c = getopt(argc, argv, "aA:bBcC:dDeEfFghiIjJ:kK:lLMnNo:OpP:qQ:rRsStT:uU:vV:wxXyYz:0-");
if (c == -1) break;
switch (c) {
case 'a':
......@@ -670,6 +671,10 @@ int main(int argc, char *argv[])
SET_FLAG(g);
gcc_compat = TRUE;
break;
case 'h':
SET_FLAG(h);
charstring_compat = TRUE;
break;
case 'i':
SET_FLAG(i);
output_only_linenum = TRUE;
......@@ -851,7 +856,8 @@ int main(int argc, char *argv[])
bflag || fflag || iflag || lflag || oflag || pflag || qflag ||
rflag || sflag || tflag || uflag || wflag || xflag || Xflag || Rflag ||
Uflag || yflag || Kflag || jflag || zflag || Fflag || Mflag || Eflag ||
nflag || Bflag || Dflag || eflag || Oflag || Iflag || s0flag || kflag) {
nflag || Bflag || Dflag || eflag || Oflag || Iflag || s0flag || kflag ||
hflag) {
errflag = true;
print_usage = true;
}
......
......@@ -52,7 +52,8 @@ extern boolean generate_skeleton, force_overwrite, include_line_info,
implicit_json_encoding, json_refs_for_all_types, force_gen_seof,
omit_in_value_list, warnings_for_bad_variants, debugger_active,
legacy_unbound_union_fields, split_to_slices, legacy_untagged_union,
disable_user_info, legacy_codec_handling, realtime_features, oop_features;
disable_user_info, legacy_codec_handling, realtime_features, oop_features,
charstring_compat;
extern const char *expected_platform;
......
......@@ -277,6 +277,7 @@ struct makefile_struct {
boolean disable_userinfo;
boolean realtime_features;
boolean oop_features;
boolean charstring_compat;
struct string_list* solspeclibraries; /* not owned */
struct string_list* sol8speclibraries; /* not owned */
struct string_list* linuxspeclibraries; /* not owned */
......@@ -350,6 +351,7 @@ static void init_makefile_struct(struct makefile_struct *makefile)
makefile->disable_userinfo = FALSE;
makefile->realtime_features = FALSE;
makefile->oop_features = FALSE;
makefile->charstring_compat = FALSE;
makefile->solspeclibraries = NULL;
makefile->sol8speclibraries = NULL;
makefile->linuxspeclibraries = NULL;
......@@ -2262,7 +2264,7 @@ static void print_makefile(struct makefile_struct *makefile)
"AR = ar\n"
"ARFLAGS = \n\n"
"# Flags for the TTCN-3 and ASN.1 compiler:\n"
"COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n"
"COMPILER_FLAGS =%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n\n"
"# Execution mode: (either ttcn3 or ttcn3-parallel)\n"
"TTCN3_LIB = ttcn3%s%s%s\n\n"
#ifdef LICENSE
......@@ -2312,6 +2314,7 @@ static void print_makefile(struct makefile_struct *makefile)
(makefile->disable_userinfo ? " -D" : ""),
(makefile->realtime_features ? " -I" : ""),
(makefile->oop_features ? " -k" : ""),
(makefile->charstring_compat ? " -h" : ""),
/* end of COMPILER FLAGS */
(makefile->use_runtime_2 ? "-rt2" : ""), /* TTCN3_LIB */
(makefile->single_mode ? "" : "-parallel"),
......@@ -4693,7 +4696,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[],
boolean linenumbersonlymsg, boolean includesourceinfo, boolean addsourcelineinfo, boolean suppresswarnings,
boolean outparamboundness, boolean omit_in_value_list, boolean warnings_for_bad_variants, boolean activate_debugger,
boolean ignore_untagged_on_top_union, boolean disable_predef_ext_folder, boolean enable_legacy_encoding, boolean disable_userinfo,
boolean realtime_features, boolean oop_features, struct string_list* solspeclibraries, struct string_list* sol8speclibraries,
boolean realtime_features, boolean oop_features, boolean charstring_compat, struct string_list* solspeclibraries, struct string_list* sol8speclibraries,
struct string_list* linuxspeclibraries, struct string_list* freebsdspeclibraries,
struct string_list* win32speclibraries, const char* ttcn3preprocessor, struct string_list* linkerlibraries,
struct string_list* additionalObjects, struct string_list* linkerlibsearchpath, char* generatorCommandOutput,
......@@ -4755,6 +4758,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[],
makefile.disable_userinfo = disable_userinfo;
makefile.realtime_features = realtime_features;
makefile.oop_features = oop_features;
makefile.charstring_compat = charstring_compat;
makefile.solspeclibraries = solspeclibraries;
makefile.sol8speclibraries = sol8speclibraries;
makefile.linuxspeclibraries = linuxspeclibraries;
......@@ -4977,7 +4981,8 @@ int main(int argc, char *argv[])
Sflag = FALSE, Vflag = FALSE, Dflag = FALSE, Wflag = FALSE,
djflag = FALSE, doerflag = FALSE, Zflag = FALSE, Hflag = FALSE, Mflag = FALSE,
diflag = FALSE, zflag = FALSE, Eflag = FALSE, nflag = FALSE,
Nflag = FALSE, Gflag = FALSE, duflag = FALSE, iflag = FALSE, kflag = FALSE;
Nflag = FALSE, Gflag = FALSE, duflag = FALSE, iflag = FALSE, kflag = FALSE,
hflag = FALSE;
boolean error_flag = FALSE;
char *output_file = NULL;
char *ets_name = NULL;
......@@ -5038,7 +5043,7 @@ int main(int argc, char *argv[])
}
for ( ; ; ) {
int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgGiI:J:kK:o:lLmMnNpP:rRsSt:TU:vVwWXYz:ZH");
int c = getopt(argc, argv, "O:ab:c" C_flag "dDe:EfFgGhHiI:J:kK:o:lLmMnNpP:rRsSt:TU:vVwWXYz:Z");
if (c == -1) break;
switch (c) {
case 'O':
......@@ -5097,6 +5102,9 @@ int main(int argc, char *argv[])
case 'G':
SET_FLAG(G);
break;
case 'h':
SET_FLAG(h);
break;
case 'H':
SET_FLAG(H);
break;
......@@ -5225,7 +5233,7 @@ int main(int argc, char *argv[])
if ( aflag || bflag || cflag || Cflag || dflag || eflag || fflag || Fflag || gflag
|| mflag || oflag || lflag || pflag || Pflag || rflag || Rflag || sflag || Gflag
|| tflag || Tflag || Vflag || wflag || Xflag || Kflag || Dflag || Wflag || Yflag
|| Zflag || Hflag || Mflag || zflag || Eflag || nflag || iflag || kflag
|| Zflag || Hflag || Mflag || zflag || Eflag || nflag || iflag || kflag || hflag
|| n_other_files > 0 || n_search_paths > 0)
error_flag = TRUE;
}
......@@ -5430,7 +5438,7 @@ int main(int argc, char *argv[])
create_symlink_list, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, &csmode,
&quflag, &dsflag, &cxxcompiler, &optlevel, &optflags, &linkerOptions, &semantic_check_only, &disable_attibute_validation,
&dbflag, &drflag, &dtflag, &dxflag, &djflag, &doerflag, &fxflag, &doflag, &gfflag, &lnflag, &isflag,
&asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &Nflag, &diflag, &Gflag, &duflag, &iflag, &kflag,
&asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &Nflag, &diflag, &Gflag, &duflag, &iflag, &kflag, &hflag,
solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, &ttcn3prep,
linkerlibraries, additionalObjects, linkerlibsearchpath, Vflag, Dflag, &Zflag, &Hflag,
&generatorCommandOutput, target_placement_list, Wflag, run_command_list, required_configs, &profiled_file_list, search_paths, n_search_paths, &makefileScript);
......@@ -5481,7 +5489,7 @@ int main(int argc, char *argv[])
cxxcompiler, optlevel, optflags, linkerOptions,
semantic_check_only, disable_attibute_validation, dbflag, drflag, dtflag, dxflag, djflag, doerflag,
fxflag, doflag, gfflag, lnflag, isflag, asflag, wflag, Yflag, Mflag, Eflag, nflag, Nflag, diflag,
Gflag, duflag, iflag, kflag, solspeclibraries, sol8speclibraries, linuxspeclibraries,
Gflag, duflag, iflag, kflag, hflag, solspeclibraries, sol8speclibraries, linuxspeclibraries,
freebsdspeclibraries, win32speclibraries, ttcn3prep, linkerlibraries, additionalObjects,
linkerlibsearchpath, generatorCommandOutput, target_placement_list);
if (makefileScript != NULL) {
......
......@@ -3,7 +3,7 @@
ttcn3_makefilegen \- Makefile Generator
.SH SYNOPSIS
.B ttcn3_makefilegen
.RB "[\| " \-acdEfgiklMnpRsSw " \|]"
.RB "[\| " \-acdEfghiklMnpRsSw " \|]"
.RB "[\| " \-e
.IR " ETS_name" " \|]"
.RB "[\| " \-o
......@@ -68,6 +68,9 @@ only. The resulting Makefile will be smaller and less redundant. It
exploits the pattern substitution features of GNU make, which may cause
syntax errors with other versions of make.
.TP
.B \-h
Allows unsafe universal charstring to charstring conversion.
.TP
.B \-i
Enables real-time testing features.
.TP
......
......@@ -1271,7 +1271,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char* tpdName, c
boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag,
boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean *p_Eflag, boolean* p_nflag, boolean* p_Nflag,
boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, boolean* p_realtime_features, boolean* p_oop_features,
struct string_list* solspeclibs, struct string_list* sol8speclibs,
boolean* p_charstring_compat, struct string_list* solspeclibs, struct string_list* sol8speclibs,
struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep,
struct string_list* linkerlibs, struct string_list* additionalObjects, struct string_list* linkerlibsearchp, boolean Vflag, boolean Dflag,
boolean *p_Zflag, boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir,
......@@ -1293,7 +1293,7 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg,
boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag,
boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean* p_Eflag, boolean* p_nflag, boolean* p_Nflag,
boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, boolean* p_realtime_features, boolean* p_oop_features,
struct string_list* solspeclibs, struct string_list* sol8speclibs,
boolean* p_charstring_compat, struct string_list* solspeclibs, struct string_list* sol8speclibs,
struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep,
string_list* linkerlibs, string_list* additionalObjects, string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, boolean *p_Zflag,
boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir,
......@@ -1325,7 +1325,7 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg,
p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag,
p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_Nflag,
p_diflag, p_enable_legacy_encoding, p_disable_userinfo,
p_realtime_features, p_oop_features, solspeclibs, sol8speclibs,
p_realtime_features, p_oop_features, p_charstring_compat, solspeclibs, sol8speclibs,
linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep,
linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag,
p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir,
......@@ -1356,7 +1356,7 @@ extern "C" tpd_result process_tpd(const char **p_tpd_name, const char *actcfg,
p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag,
p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_Nflag,
p_diflag, p_enable_legacy_encoding, p_disable_userinfo,
p_realtime_features, p_oop_features, solspeclibs, sol8speclibs,
p_realtime_features, p_oop_features, p_charstring_compat, solspeclibs, sol8speclibs,
linuxspeclibs, freebsdspeclibs, win32speclibs, ttcn3prep,
linkerlibs, additionalObjects, linkerlibsearchp, Vflag, Dflag, p_Zflag,
p_Hflag, generatorCommandOutput, target_placement_list, prefix_workdir,
......@@ -1463,7 +1463,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c
boolean* p_fxflag, boolean* p_doflag, boolean* p_gfflag, boolean* p_lnflag, boolean* p_isflag,
boolean* p_asflag, boolean* p_swflag, boolean* p_Yflag, boolean* p_Mflag, boolean* p_Eflag, boolean* p_nflag, boolean* p_Nflag,
boolean* p_diflag, boolean* p_enable_legacy_encoding, boolean* p_disable_userinfo, boolean* p_realtime_features, boolean* p_oop_features,
struct string_list* solspeclibs, struct string_list* sol8speclibs,
boolean* p_charstring_compat, struct string_list* solspeclibs, struct string_list* sol8speclibs,
struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs, char** ttcn3prep,
string_list* linkerlibs, string_list* additionalObjects, string_list* linkerlibsearchp, boolean Vflag, boolean Dflag, boolean *p_Zflag,
boolean *p_Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir,
......@@ -2075,6 +2075,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c
xsdbool2boolean(xpathCtx, actcfg, "disableUserInformation", p_disable_userinfo);
xsdbool2boolean(xpathCtx, actcfg, "enableRealtimeTesting", p_realtime_features);
xsdbool2boolean(xpathCtx, actcfg, "enableOOP", p_oop_features);
xsdbool2boolean(xpathCtx, actcfg, "charstringCompat", p_charstring_compat);
projDesc = projGenHelper.getTargetOfProject(*p_project_name);
if (projDesc) projDesc->setLinkingStrategy(*p_lflag);
......@@ -2983,6 +2984,7 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c
boolean my_enable_legacy_encoding = 0;
boolean my_realtime_features = 0;
boolean my_oop_features = 0;
boolean my_charstring_compat = 0;
char *my_ets = NULL;
char *my_proj_name = NULL;
......@@ -3035,7 +3037,8 @@ static tpd_result process_tpd_internal(const char **p_tpd_name, char *tpdName, c
&my_quflag, &my_dsflag, cxxcompiler, optlevel, optflags, linkerOptions, semantic_check_only, disable_attibute_validation,
&my_dbflag, &my_drflag, &my_dtflag, &my_dxflag, &my_djflag, &my_doerflag, &my_fxflag, &my_doflag,
&my_gfflag, &my_lnflag, &my_isflag, &my_asflag, &my_swflag, &my_Yflag, &my_Mflag, &my_Eflag, &my_nflag, &my_Nflag, &my_diflag,
&my_enable_legacy_encoding, &my_duflag, &my_realtime_features, &my_oop_features, solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs,
&my_enable_legacy_encoding, &my_duflag, &my_realtime_features, &my_oop_features, &my_charstring_compat,
solspeclibs, sol8speclibs, linuxspeclibs, freebsdspeclibs, win32speclibs,
ttcn3prep, linkerlibs, additionalObjects, linkerlibsearchp, Vflag, FALSE, &my_Zflag,
&my_Hflag, NULL, NULL, prefix_workdir, run_command_list, seen_tpd_files, required_configs, profiled_file_list,
search_paths, n_search_paths, makefileScript, all_configs);
......
......@@ -290,7 +290,7 @@ tpd_result process_tpd(const char **p_tpd_name, const char *actcfg,
boolean *linenumber, boolean *includesourceinfo, boolean *addsourcelineinfo, boolean *suppresswarnings,
boolean *outparamboundness, boolean *omit_in_value_list, boolean *warnings_for_bad_variants, boolean *activate_debugger, boolean* ignore_untagged_union,
boolean *disable_predef_exp_folder, boolean* enable_legacy_encoding, boolean* disable_userinfo, boolean* realtime_features, boolean* oop_features,
struct string_list* solspeclibs, struct string_list* sol8speclibs,
boolean* charstring_compat, struct string_list* solspeclibs, struct string_list* sol8speclibs,
struct string_list* linuxspeclibs, struct string_list* freebsdspeclibs, struct string_list* win32speclibs,
char** ttcn3preprocessor, struct string_list* linkerlibs, struct string_list* additionalObjects, struct string_list* linkerlibsearchpath, boolean Vflag, boolean Dflag,
boolean *Zflag, boolean *Hflag, char** generatorCommandOutput, struct string2_list* target_placement_list, boolean prefix_workdir, struct string2_list* run_command_list,
......
......@@ -1665,6 +1665,18 @@ UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
}
}
UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
const CHARSTRING& expression, int groupno, boolean nocase)
{
return regexp(instr, (UNIVERSAL_CHARSTRING)expression, groupno, nocase);
}
UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
const CHARSTRING& expression, const INTEGER& groupno, boolean nocase)
{
return regexp(instr, (UNIVERSAL_CHARSTRING)expression, groupno, nocase);
}
UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
const UNIVERSAL_CHARSTRING& expression, int groupno, boolean nocase)
{
......
......@@ -188,6 +188,11 @@ extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
const UNIVERSAL_CHARSTRING& expression, const INTEGER& groupno,
boolean nocase);
extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
const CHARSTRING& expression, int groupno, boolean nocase);
extern UNIVERSAL_CHARSTRING regexp(const UNIVERSAL_CHARSTRING& instr,
const CHARSTRING& expression, const INTEGER& groupno,
boolean nocase);
// regexp on templates
extern CHARSTRING regexp(const CHARSTRING_template& instr,
const CHARSTRING_template& expression, int groupno, boolean nocase);
......
......@@ -155,6 +155,30 @@ CHARSTRING::CHARSTRING(const CHARSTRING_ELEMENT& other_value)
val_ptr->chars_ptr[0] = other_value.get_char();
}
CHARSTRING::CHARSTRING(const UNIVERSAL_CHARSTRING& other_value)
{
other_value.must_bound("Initialization of a charstring with an unbound "
"universal charstring.");
if (other_value.charstring) {
val_ptr = other_value.cstr.val_ptr;
val_ptr->ref_count++;
}
else {
int n_chars = other_value.val_ptr->n_uchars;
init_struct(n_chars);
for (int i = 0; i < n_chars; ++i) {
const universal_char& uc = other_value.val_ptr->uchars_ptr[i];
if (uc.uc_group != 0 || uc.uc_plane != 0 || uc.uc_row != 0 || uc.uc_cell > 127) {
Free(val_ptr);
TTCN_error("Non-ASCII characters cannot be used to initialize a charstring, "
"invalid character char(%u, %u, %u, %u) at index %d.",
uc.uc_group, uc.uc_plane, uc.uc_row, uc.uc_cell, i);
}
val_ptr->chars_ptr[i] = other_value.val_ptr->uchars_ptr[i].uc_cell;
}
}
}
CHARSTRING::~CHARSTRING()
{
clean_up();
......@@ -219,8 +243,9 @@ CHARSTRING& CHARSTRING::operator=(const UNIVERSAL_CHARSTRING& other_value)
init_struct(n_chars);
for (int i = 0; i < n_chars; ++i) {
const universal_char& uc = other_value.val_ptr->uchars_ptr[i];
if (uc.uc_group != 0 || uc.uc_plane != 0 || uc.uc_row != 0) {
TTCN_error("Multiple-byte characters cannot be assigned to a charstring, "
if (uc.uc_group != 0 || uc.uc_plane != 0 || uc.uc_row != 0 || uc.uc_cell > 127) {
Free(val_ptr);
TTCN_error("Non-ASCII characters cannot be assigned to a charstring, "
"invalid character char(%u, %u, %u, %u) at index %d.",
uc.uc_group, uc.uc_plane, uc.uc_row, uc.uc_cell, i);
}
......
......@@ -137,6 +137,8 @@ public:
CHARSTRING(const CHARSTRING& other_value);
/** Construct a CHARSTRING of length one */
CHARSTRING(const CHARSTRING_ELEMENT& other_value);
/** Construct a CHARSTRING from a UNIVERSAL_CHARSTRING */
CHARSTRING(const UNIVERSAL_CHARSTRING& other_value);
/** Destructor. Simply calls clean_up() */
~CHARSTRING();
......@@ -159,6 +161,10 @@ public:
{ return !(*this == other_value); }
inline boolean operator!=(const CHARSTRING_ELEMENT& other_value) const
{ return !(*this == other_value); }
inline boolean operator!=(const UNIVERSAL_CHARSTRING& other_value) const
{ return !(*this == other_value); }
inline boolean operator!=(const UNIVERSAL_CHARSTRING_ELEMENT& other_value) const
{ return !(*this == other_value); }
CHARSTRING operator+(const char* other_value) const;
CHARSTRING operator+(const CHARSTRING& other_value) const;
......
......@@ -144,6 +144,7 @@
<xs:element name="disableSubtypeChecking" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="forceGenSeof" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="enableOOP" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<xs:element name="charstringCompat" minOccurs="0" maxOccurs="1" type="xs:boolean" />
<!-- *******C++ compiler:****** -->
<xs:element name="CxxCompiler" minOccurs="0" maxOccurs="1" type="xs:normalizedString" />
<xs:element name="optimizationLevel" minOccurs="0" maxOccurs="1" type="xs:normalizedString" />
......
......@@ -50,7 +50,7 @@ customEncoding makefilegen uidChars checkstate hostid templateIstemplatekind \
selectUnion templateExclusiveRange any_from templatePatternRef indexWithRecofArray \
connectMapOperTest fuzzy portTranslation ischosen functionSubref done \
nondeterministicDefaultParam predefFunction2 realtime portTranslationCentralStorage \
locale oop references
locale oop references unicharstrToCharstr
ifdef DYN
DIRS += loggerplugin junitlogger
......
......@@ -33,7 +33,7 @@ DIRLIST := buildconfig_param invalid_buildconfig_param invalid_buildconfig_tpd \
HP79745 HQ56829 HQ56834 HQ56848 library HR30356 flagTest HR30365 dependency_check \
required_config required_config_v2 disablePredefinedExternalFolder \
makefileScript diff_tpd_name_error enable_legacy_encoding disable_oer \
disableUserInformation freeTextLinkerOptions oop_features
disableUserInformation freeTextLinkerOptions oop_features charstring_compat
ifdef DYN
DIRS += required_config_v3 splitting compile_once
......
##############################################################################
# Copyright (c) 2000-2020 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
#
##############################################################################
TOPDIR := ../../..
include $(TOPDIR)/Makefile.regression
ifdef LCOV
COVERAGE_FLAG := -C
endif
# ${MAKEPROG} has the same content as the built-in ${MAKE},
# except the special handling of ${MAKE} does not apply.
# If we used ${MAKE} in the rules below, 'make -n' would succeed once,
# then fail on every subsequent invocation until a 'make clean' is done.
MAKEPROG := ${MAKE}
all: CheckTpdTrue CheckTpdFalse CheckTpdMissing
BuildTpdTrue:
$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
-t a.tpd
CheckTpdTrue: BuildTpdTrue
if [ ! -f "./bin/Makefile" ] \
|| [ `grep -c "COMPILER_FLAGS = -L -h" ./bin/Makefile` -ne 1 ]; \
then echo "Makefilegen charstring compat test: Overall verdict: fail" && exit 1; fi
BuildTpdFalse:
$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
-t a.tpd -b False
CheckTpdFalse: BuildTpdFalse
if [ ! -f "./bin2/Makefile" ] \
|| [ `grep -c "COMPILER_FLAGS = -L -h" ./bin2/Makefile` -ne 0 ]; \
then echo "Makefilegen charstring compat test: Overall verdict: fail" && exit 1; fi
BuildTpdMissing:
$(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \
-t a.tpd -b Missing
CheckTpdMissing: BuildTpdMissing
if [ ! -f "./bin3/Makefile" ] \
|| [ `grep -c "COMPILER_FLAGS = -L -h" ./bin3/Makefile` -ne 0 ]; \
then echo "Makefilegen charstring compat test: Overall verdict: fail" && exit 1; fi
clean:
-rm -rf bin bin2 bin3
distclean: clean
-rm -f *.out
.PHONY: all clean distclean CheckTpdTrue CheckTpdFalse CheckTpdMissing BuildTpdTrue BuildTpdFalse BuildTpdMissing
<!--
Copyright (c) 2000-2020 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 – initial implementation
-->
<TITAN_Project_File_Information version="1.0">
<ProjectName>a</ProjectName>
<ActiveConfiguration>Default</ActiveConfiguration>
<Configurations>
<Configuration name="Default">
<ProjectProperties>
<MakefileSettings>
<GNUMake>true</GNUMake>
<targetExecutable>bin</targetExecutable>
<charstringCompat>true</charstringCompat>
</MakefileSettings>
<LocalBuildSettings>
<workingDirectory>bin</workingDirectory>
</LocalBuildSettings>
</ProjectProperties>
</Configuration>
<Configuration name="False">
<ProjectProperties>
<MakefileSettings>
<