diff --git a/compiler2/makefile.c b/compiler2/makefile.c index cb188c2125ff703ddf60b23ed79ce731572e1750..63bedbe6ef2ed0baa785283d2e757ce7eb910c4d 100644 --- a/compiler2/makefile.c +++ b/compiler2/makefile.c @@ -245,7 +245,7 @@ struct makefile_struct { struct string_list* prep_includes; /* not owned */ struct string_list* prep_defines; /* not owned */ struct string_list* prep_undefines; /* not owned */ - boolean codesplittpd; + const char *codesplittpd; boolean quietly; boolean disablesubtypecheck; const char *cxxcompiler; @@ -2207,13 +2207,6 @@ static void print_makefile(struct makefile_struct *makefile) fputs("\n\n", fp); } - /* code splitting: command line argument wins */ - if (makefile->code_splitting_mode == NULL) { - if (makefile->codesplittpd) { - makefile->code_splitting_mode = mcopystr("-U type"); - } - } - fprintf(fp, "# Flags for the C++ compiler:\n" "CXXFLAGS = %s%s %s %s" #ifdef MEMORY_DEBUG @@ -2649,8 +2642,51 @@ static void print_makefile(struct makefile_struct *makefile) fputs("\nGENERATED_HEADERS =", fp); if (makefile->gnu_make) { - fputs(" $(GENERATED_SOURCES:.cc=.hh)", fp); - } + int n_slices; + // If GNU make and split to slices code splitting set, then if we would + // use the .cc=.hh then the _part_i.hh header files would be printed into + // the makefile that would cause weird behavior. + if (makefile->code_splitting_mode != NULL && (n_slices = atoi(makefile->code_splitting_mode + 2))) { + if (makefile->TTCN3ModulesRegular) { + fputs(" $(TTCN3_MODULES:.ttcn=.hh)", fp); + if (makefile->preprocess) { + fputs(" $(TTCN3_PP_MODULES:.ttcnpp=.hh)", fp); + } + } else { + for (i = 0; i < makefile->nTTCN3Modules; i++) { + const struct module_struct *module = makefile->TTCN3Modules + i; + if (module->dir_name == NULL || !makefile->central_storage) + print_generated_file_name(fp, module, FALSE, ".hh"); + } + if (makefile->preprocess) { + for (i = 0; i < makefile->nTTCN3PPModules; i++) { + const struct module_struct *module = makefile->TTCN3PPModules + i; + if (module->dir_name == NULL || !makefile->central_storage) + print_generated_file_name(fp, module, FALSE, ".hh"); + } + } + if (makefile->nXSDModules) { + for (i = 0; i < makefile->nXSDModules; i++) { + const struct module_struct *module = makefile->XSDModules + i; + if (module->dir_name == NULL || !makefile->central_storage) + print_generated_file_name(fp, module, FALSE, ".hh"); + } + } + } + if (makefile->ASN1ModulesRegular) { + fputs(" $(ASN1_MODULES:.asn=.hh)", fp); + } else { + for (i = 0; i < makefile->nASN1Modules; i++) { + const struct module_struct *module = makefile->ASN1Modules + i; + if (module->dir_name == NULL || !makefile->central_storage) + print_generated_file_name(fp, module, FALSE, ".hh"); + } + } + } else { + // Generate normally + fputs(" $(GENERATED_SOURCES:.cc=.hh)", fp); + } + } else { for (i = 0; i < makefile->nTTCN3Modules; i++) { const struct module_struct *module = makefile->TTCN3Modules + i; @@ -2762,7 +2798,50 @@ static void print_makefile(struct makefile_struct *makefile) } fputs("\nBASE_GENERATED_HEADERS =", fp); if (makefile->gnu_make) { - fputs(" $(BASE_GENERATED_SOURCES:.cc=.hh)", fp); + int n_slices; + // If GNU make and split to slices code splitting set, then if we would + // use the .cc=.hh then the _part_i.hh header files would be printed into + // the makefile that would cause weird behavior. + if (makefile->code_splitting_mode != NULL && (n_slices = atoi(makefile->code_splitting_mode + 2))) { + if (makefile->TTCN3ModulesRegular) { + fputs(" $(BASE_TTCN3_MODULES:.ttcn=.hh)", fp); + if (makefile->preprocess) { + fputs(" $(BASE_TTCN3_PP_MODULES:.ttcnpp=.hh)", fp); + } + } else { + for (i = 0; i < makefile->nTTCN3Modules; i++) { + const struct module_struct *module = makefile->TTCN3Modules + i; + if (module->dir_name != NULL) + print_generated_file_name(fp, module, TRUE, ".hh"); + } + if (makefile->preprocess) { + for (i = 0; i < makefile->nTTCN3PPModules; i++) { + const struct module_struct *module = makefile->TTCN3PPModules + i; + if (module->dir_name != NULL) + print_generated_file_name(fp, module, TRUE, ".hh"); + } + } + if (makefile->nXSDModules) { + for (i = 0; i < makefile->nXSDModules; i++) { + const struct module_struct *module = makefile->XSDModules + i; + if (module->dir_name != NULL) + print_generated_file_name(fp, module, TRUE, ".hh"); + } + } + } + if (makefile->ASN1ModulesRegular) { + fputs(" $(BASE_ASN1_MODULES:.asn=.hh)", fp); + } else { + for (i = 0; i < makefile->nASN1Modules; i++) { + const struct module_struct *module = makefile->ASN1Modules + i; + if (module->dir_name != NULL) + print_generated_file_name(fp, module, TRUE, ".hh"); + } + } + } else { + // Generate normally + fputs(" $(BASE_GENERATED_SOURCES:.cc=.hh)", fp); + } } else { for (i = 0; i < makefile->nTTCN3Modules; i++) { const struct module_struct *module = makefile->TTCN3Modules + i; @@ -2826,7 +2905,7 @@ static void print_makefile(struct makefile_struct *makefile) fputs("\nBASE2_GENERATED_HEADERS =", fp); if (makefile->gnu_make) { - fputs(" $(BASE2_GENERATED_SOURCES:.cc=.hh)", fp); + fputs(" $(BASE2_GENERATED_SOURCES:.cc=.hh)", fp); } else ERROR("the usage of 'Z' flag requires GNU make"); @@ -3165,26 +3244,94 @@ static void print_makefile(struct makefile_struct *makefile) else { for (i = 0; i < makefile->nTTCN3Modules; i++) { const struct module_struct *module = makefile->TTCN3Modules + i; - if (module->dir_name != NULL) + if (module->dir_name != NULL) { print_generated_file_name(fp, module, TRUE, ".so"); + if (makefile->code_splitting_mode != NULL) { + int n_slices; + if (strcmp(makefile->code_splitting_mode, "-U type") == 0) { + print_generated_file_name(fp, module, TRUE, "_seq.so"); + print_generated_file_name(fp, module, TRUE, "_set.so"); + print_generated_file_name(fp, module, TRUE, "_seqof.so"); + print_generated_file_name(fp, module, TRUE, "_setof.so"); + print_generated_file_name(fp, module, TRUE, "_union.so"); + } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) { + for (int slice = 1; slice < n_slices; slice++) { + char buffer[16]; // 6 digits + 4 chars + _part + sprintf(buffer, "_part_%i.so", slice); + print_generated_file_name(fp, module, TRUE, buffer); + } + } + } + } } if (makefile->preprocess) { for (i = 0; i < makefile->nTTCN3PPModules; i++) { const struct module_struct *module = makefile->TTCN3PPModules + i; - if (module->dir_name != NULL) + if (module->dir_name != NULL) { print_generated_file_name(fp, module, TRUE, ".so"); + if (makefile->code_splitting_mode != NULL) { + int n_slices; + if (strcmp(makefile->code_splitting_mode, "-U type") == 0) { + print_generated_file_name(fp, module, TRUE, "_seq.so"); + print_generated_file_name(fp, module, TRUE, "_set.so"); + print_generated_file_name(fp, module, TRUE, "_seqof.so"); + print_generated_file_name(fp, module, TRUE, "_setof.so"); + print_generated_file_name(fp, module, TRUE, "_union.so"); + } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) { + for (int slice = 1; slice < n_slices; slice++) { + char buffer[16]; // 6 digits + 4 chars + _part + sprintf(buffer, "_part_%i.so", slice); + print_generated_file_name(fp, module, TRUE, buffer); + } + } + } + } } } for (i = 0; i < makefile->nASN1Modules; i++) { const struct module_struct *module = makefile->ASN1Modules + i; - if (module->dir_name != NULL) + if (module->dir_name != NULL) { print_generated_file_name(fp, module, TRUE, ".so"); + if (makefile->code_splitting_mode != NULL) { + int n_slices; + if (strcmp(makefile->code_splitting_mode, "-U type") == 0) { + print_generated_file_name(fp, module, TRUE, "_seq.so"); + print_generated_file_name(fp, module, TRUE, "_set.so"); + print_generated_file_name(fp, module, TRUE, "_seqof.so"); + print_generated_file_name(fp, module, TRUE, "_setof.so"); + print_generated_file_name(fp, module, TRUE, "_union.so"); + } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) { + for (int slice = 1; slice < n_slices; slice++) { + char buffer[16]; // 6 digits + 4 chars + _part + sprintf(buffer, "_part_%i.so", slice); + print_generated_file_name(fp, module, TRUE, buffer); + } + } + } + } } for (i = 0; i < makefile->nXSDModules; i++) { const struct module_struct *module = makefile->XSDModules + i; - if (module->dir_name != NULL) + if (module->dir_name != NULL) { print_generated_file_name(fp, module, TRUE, ".so"); + if (makefile->code_splitting_mode != NULL) { + int n_slices; + if (strcmp(makefile->code_splitting_mode, "-U type") == 0) { + print_generated_file_name(fp, module, TRUE, "_seq.so"); + print_generated_file_name(fp, module, TRUE, "_set.so"); + print_generated_file_name(fp, module, TRUE, "_seqof.so"); + print_generated_file_name(fp, module, TRUE, "_setof.so"); + print_generated_file_name(fp, module, TRUE, "_union.so"); + } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) { + for (int slice = 1; slice < n_slices; slice++) { + char buffer[16]; // 6 digits + 4 chars + _part + sprintf(buffer, "_part_%i.so", slice); + print_generated_file_name(fp, module, TRUE, buffer); + } + } + } + } } } if (makefile->gnu_make && makefile->BaseUserSourcesRegular) { @@ -3230,6 +3377,22 @@ static void print_makefile(struct makefile_struct *makefile) const struct module_struct *module = makefile->TTCN3Modules + i; if (module->dir_name != NULL) { print_generated_file_name(fp, module, TRUE, ".o"); + if (makefile->code_splitting_mode != NULL) { + int n_slices; + if (strcmp(makefile->code_splitting_mode, "-U type") == 0) { + print_generated_file_name(fp, module, TRUE, "_seq.o"); + print_generated_file_name(fp, module, TRUE, "_set.o"); + print_generated_file_name(fp, module, TRUE, "_seqof.o"); + print_generated_file_name(fp, module, TRUE, "_setof.o"); + print_generated_file_name(fp, module, TRUE, "_union.o"); + } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) { + for (int slice = 1; slice < n_slices; slice++) { + char buffer[16]; // 6 digits + 4 chars + _part + sprintf(buffer, "_part_%i.o", slice); + print_generated_file_name(fp, module, TRUE, buffer); + } + } + } } } if (makefile->preprocess) { @@ -3237,6 +3400,22 @@ static void print_makefile(struct makefile_struct *makefile) const struct module_struct *module = makefile->TTCN3PPModules + i; if (module->dir_name != NULL) { print_generated_file_name(fp, module, TRUE, ".o"); + if (makefile->code_splitting_mode != NULL) { + int n_slices; + if (strcmp(makefile->code_splitting_mode, "-U type") == 0) { + print_generated_file_name(fp, module, TRUE, "_seq.o"); + print_generated_file_name(fp, module, TRUE, "_set.o"); + print_generated_file_name(fp, module, TRUE, "_seqof.o"); + print_generated_file_name(fp, module, TRUE, "_setof.o"); + print_generated_file_name(fp, module, TRUE, "_union.o"); + } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) { + for (int slice = 1; slice < n_slices; slice++) { + char buffer[16]; // 6 digits + 4 chars + _part + sprintf(buffer, "_part_%i.o", slice); + print_generated_file_name(fp, module, TRUE, buffer); + } + } + } } } } @@ -3244,12 +3423,44 @@ static void print_makefile(struct makefile_struct *makefile) const struct module_struct *module = makefile->ASN1Modules + i; if (module->dir_name != NULL) { print_generated_file_name(fp, module, TRUE, ".o"); + if (makefile->code_splitting_mode != NULL) { + int n_slices; + if (strcmp(makefile->code_splitting_mode, "-U type") == 0) { + print_generated_file_name(fp, module, TRUE, "_seq.o"); + print_generated_file_name(fp, module, TRUE, "_set.o"); + print_generated_file_name(fp, module, TRUE, "_seqof.o"); + print_generated_file_name(fp, module, TRUE, "_setof.o"); + print_generated_file_name(fp, module, TRUE, "_union.o"); + } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) { + for (int slice = 1; slice < n_slices; slice++) { + char buffer[16]; // 6 digits + 4 chars + _part + sprintf(buffer, "_part_%i.o", slice); + print_generated_file_name(fp, module, TRUE, buffer); + } + } + } } } for (i = 0; i < makefile->nXSDModules; i++) { const struct module_struct *module = makefile->XSDModules + i; if (module->dir_name != NULL) { print_generated_file_name(fp, module, TRUE, ".o"); + if (makefile->code_splitting_mode != NULL) { + int n_slices; + if (strcmp(makefile->code_splitting_mode, "-U type") == 0) { + print_generated_file_name(fp, module, TRUE, "_seq.o"); + print_generated_file_name(fp, module, TRUE, "_set.o"); + print_generated_file_name(fp, module, TRUE, "_seqof.o"); + print_generated_file_name(fp, module, TRUE, "_setof.o"); + print_generated_file_name(fp, module, TRUE, "_union.o"); + } else if((n_slices = atoi(makefile->code_splitting_mode + 2))) { + for (int slice = 1; slice < n_slices; slice++) { + char buffer[16]; // 6 digits + 4 chars + _part + sprintf(buffer, "_part_%i.o", slice); + print_generated_file_name(fp, module, TRUE, buffer); + } + } + } } } } @@ -4424,7 +4635,7 @@ static void generate_makefile(size_t n_arguments, char *arguments[], const char *code_splitting_mode, const char *tcov_file_name, struct string_list* profiled_file_list, const char* file_list_file_name, boolean Lflag, boolean Zflag, boolean Hflag, struct string_list* sub_project_dirs, struct string_list* ttcn3_prep_includes, struct string_list* ttcn3_prep_defines, struct string_list* ttcn3_prep_undefines, struct string_list* prep_includes, - struct string_list* prep_defines, struct string_list* prep_undefines, boolean codesplittpd, boolean quietly, boolean disablesubtypecheck, + struct string_list* prep_defines, struct string_list* prep_undefines, char *codesplittpd, boolean quietly, boolean disablesubtypecheck, const char* cxxcompiler, const char* optlevel, const char* optflags, boolean disableber, boolean disableraw, boolean disabletext, boolean disablexer, boolean disablejson, boolean forcexerinasn, boolean defaultasomit, boolean gccmsgformat, boolean linenumbersonlymsg, boolean includesourceinfo, boolean addsourcelineinfo, boolean suppresswarnings, @@ -4460,7 +4671,6 @@ static void generate_makefile(size_t n_arguments, char *arguments[], makefile.prep_includes = prep_includes; makefile.prep_defines = prep_defines; makefile.prep_undefines = prep_undefines; - makefile.codesplittpd = codesplittpd; makefile.quietly = quietly; makefile.disablesubtypecheck = disablesubtypecheck; makefile.cxxcompiler = cxxcompiler; @@ -4546,6 +4756,21 @@ static void generate_makefile(size_t n_arguments, char *arguments[], if (code_splitting_mode != NULL) { makefile.code_splitting_mode = mputprintf(makefile.code_splitting_mode, "-U %s", code_splitting_mode); } + if (codesplittpd != NULL) { // TPD code splitting overrides console code splitting + makefile.code_splitting_mode = mputprintf(makefile.code_splitting_mode, "-U %s", codesplittpd); + } + + if (makefile.code_splitting_mode != NULL && makefile.linkingStrategy == TRUE) { + WARNING("Code splitting from TPD file is not supported when the improved linking method is used (Z flag)."); + Free(makefile.code_splitting_mode); + makefile.code_splitting_mode = NULL; + } + + if (makefile.code_splitting_mode != NULL && makefile.hierarchical == TRUE) { + WARNING("Code splitting from TPD file is not supported when hierarchical makefile generation is used (H flag)."); + Free(makefile.code_splitting_mode); + makefile.code_splitting_mode = NULL; + } if (tcov_file_name != NULL) { makefile.tcov_file_name = mprintf(" -K %s", tcov_file_name); @@ -4679,7 +4904,7 @@ int main(int argc, char *argv[]) Pflag = FALSE, Rflag = FALSE, sflag = FALSE, tflag = FALSE, wflag = FALSE, vflag = FALSE, mflag = FALSE, Uflag = FALSE, Lflag = FALSE, rflag = FALSE, Fflag = FALSE, Xflag = FALSE, - Tflag = FALSE, Yflag = FALSE, csflag = FALSE, quflag = FALSE, + Tflag = FALSE, Yflag = FALSE, quflag = FALSE, dsflag = FALSE, dbflag = FALSE, drflag = FALSE, dtflag = FALSE, dxflag = FALSE, fxflag = FALSE, doflag = FALSE, gfflag = FALSE, lnflag = FALSE, isflag = FALSE, asflag = FALSE, @@ -4690,6 +4915,7 @@ int main(int argc, char *argv[]) char *output_file = NULL; char *ets_name = NULL; char *project_name = NULL; + char *csmode = NULL; size_t n_other_files = 0; const char **other_files = NULL; const char *code_splitting_mode = NULL; @@ -5116,7 +5342,7 @@ int main(int argc, char *argv[]) &argc, &argv, &free_argv, &optind, &ets_name, &project_name, &gflag, &sflag, &cflag, &aflag, &pflag, &Rflag, &lflag, &mflag, &Pflag, &Lflag, rflag, Fflag, Tflag, output_file, &abs_work_dir, sub_project_dirs, program_name, prj_graph_fp, - create_symlink_list, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, &csflag, + create_symlink_list, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, &csmode, &quflag, &dsflag, &cxxcompiler, &optlevel, &optflags, &dbflag, &drflag, &dtflag, &dxflag, &djflag, &fxflag, &doflag, &gfflag, &lnflag, &isflag, &asflag, &temp_wflag, &Yflag, &Mflag, &Eflag, &nflag, &diflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, &ttcn3prep, linkerlibraries, additionalObjects, linkerlibsearchpath, Vflag, Dflag, &Zflag, &Hflag, @@ -5164,7 +5390,7 @@ int main(int argc, char *argv[]) output_file, ets_name, project_name, gflag, sflag, cflag, aflag, pflag, dflag, fflag||Fflag, Rflag, lflag, mflag, Cflag, code_splitting_mode, tcov_file_name, profiled_file_list, file_list_file_name, Lflag, Zflag, Hflag, rflag ? sub_project_dirs : NULL, ttcn3_prep_includes, - ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, csflag, quflag, dsflag, cxxcompiler, optlevel, optflags, dbflag, + ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, prep_undefines, csmode, quflag, dsflag, cxxcompiler, optlevel, optflags, dbflag, drflag, dtflag, dxflag, djflag, fxflag, doflag, gfflag, lnflag, isflag, asflag, wflag, Yflag, Mflag, Eflag, nflag, diflag, solspeclibraries, sol8speclibraries, linuxspeclibraries, freebsdspeclibraries, win32speclibraries, ttcn3prep, linkerlibraries, additionalObjects, linkerlibsearchpath, generatorCommandOutput, target_placement_list); @@ -5196,6 +5422,7 @@ int main(int argc, char *argv[]) free_string_list(profiled_file_list); Free(search_paths); + Free(csmode); Free(generatorCommandOutput); free_string2_list(target_placement_list); diff --git a/compiler2/ttcn3/AST_ttcn3.cc b/compiler2/ttcn3/AST_ttcn3.cc index 2bc045e2b9e7907268fbeee62a07c9fb039a6cf9..30393a8fd17ae4b963238cf7b77c3d0b94a7a2b8 100644 --- a/compiler2/ttcn3/AST_ttcn3.cc +++ b/compiler2/ttcn3/AST_ttcn3.cc @@ -3847,8 +3847,8 @@ namespace Ttcn { if (t->get_fat_runs_on_self()) { error("Type of module parameter cannot be of function reference type" " `%s' which has runs on self clause", t->get_fullname().c_str()); + break; } - break; default: #if defined(MINGW) checked = true; diff --git a/compiler2/xpather.cc b/compiler2/xpather.cc index 488c787c0a6fbee4b6f9980ee8992f372e71cca4..66f263b6b70bb4e7746b48afc2c5c4d8f891e15d 100644 --- a/compiler2/xpather.cc +++ b/compiler2/xpather.cc @@ -635,7 +635,11 @@ int is_xsd_module(const char *file_name, char **module_name) { FILE *fp; char line[1024]; char *command = NULL; - command = mputprintf(command, "xsd2ttcn -q -n %s", file_name); + char *ttcn3_dir = getenv("TTCN3_DIR"); + command = mputprintf(command, "%s%sxsd2ttcn -q -n %s", + ttcn3_dir != NULL ? ttcn3_dir : "", + ttcn3_dir != NULL ? "/bin/" : "", + file_name); fp = popen(command, "r"); Free(command); if (fp == NULL) { @@ -1261,7 +1265,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char* tpdName, co const char *output_file, char** abs_work_dir_p, struct string_list* sub_project_dirs, const char* program_name, FILE* prj_graph_fp, struct string2_list* create_symlink_list, struct string_list* ttcn3_prep_includes, struct string_list* ttcn3_prep_defines, struct string_list* ttcn3_prep_undefines, struct string_list* prep_includes, - struct string_list* prep_defines, struct string_list* prep_undefines, boolean *p_csflag, boolean *p_quflag, boolean* p_dsflag, + struct string_list* prep_defines, struct string_list* prep_undefines, char **p_csmode, boolean *p_quflag, boolean* p_dsflag, char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, 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, @@ -1281,7 +1285,7 @@ extern "C" tpd_result process_tpd(const char *p_tpd_name, const char *actcfg, const char *output_file, char** abs_work_dir_p, struct string_list* sub_project_dirs, const char* program_name, FILE* prj_graph_fp, struct string2_list* create_symlink_list, struct string_list* ttcn3_prep_includes, struct string_list* ttcn3_prep_defines, struct string_list* ttcn3_prep_undefines, struct string_list* prep_includes, - struct string_list* prep_defines, struct string_list* prep_undefines, boolean *p_csflag, boolean *p_quflag, boolean* p_dsflag, + struct string_list* prep_defines, struct string_list* prep_undefines, char **p_csmode, boolean *p_quflag, boolean* p_dsflag, char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, 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, @@ -1311,7 +1315,7 @@ extern "C" tpd_result process_tpd(const char *p_tpd_name, const char *actcfg, output_file, abs_work_dir_p, sub_project_dirs, program_name, prj_graph_fp, create_symlink_list, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, - prep_undefines, p_csflag, p_quflag, p_dsflag, cxxcompiler, + prep_undefines, p_csmode, p_quflag, p_dsflag, cxxcompiler, optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag, p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag, p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_diflag, solspeclibs, sol8speclibs, @@ -1339,7 +1343,7 @@ extern "C" tpd_result process_tpd(const char *p_tpd_name, const char *actcfg, output_file, abs_work_dir_p, sub_project_dirs, program_name, prj_graph_fp, create_symlink_list, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, prep_includes, prep_defines, - prep_undefines, p_csflag, p_quflag, p_dsflag, cxxcompiler, + prep_undefines, p_csmode, p_quflag, p_dsflag, cxxcompiler, optlevel, optflags, p_dbflag, p_drflag, p_dtflag, p_dxflag, p_djflag, p_fxflag, p_doflag, p_gfflag, p_lnflag, p_isflag, p_asflag, p_swflag, p_Yflag, p_Mflag, p_Eflag, p_nflag, p_diflag, solspeclibs, sol8speclibs, @@ -1442,7 +1446,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co const char *output_file, char** abs_work_dir_p, struct string_list* sub_project_dirs, const char* program_name, FILE* prj_graph_fp, struct string2_list* create_symlink_list, struct string_list* ttcn3_prep_includes, struct string_list* ttcn3_prep_defines, struct string_list* ttcn3_prep_undefines, struct string_list* prep_includes, - struct string_list* prep_defines, struct string_list* prep_undefines, boolean *p_csflag, boolean *p_quflag, boolean* p_dsflag, + struct string_list* prep_defines, struct string_list* prep_undefines, char **p_csmode, boolean *p_quflag, boolean* p_dsflag, char** cxxcompiler, char** optlevel, char** optflags, boolean* p_dbflag, boolean* p_drflag, boolean* p_dtflag, boolean* p_dxflag, boolean* p_djflag, 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, @@ -1991,6 +1995,32 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co } } // next FileResource } + + // Gather the code splitting mode from the active configuration + { + expstring_t xpathActCfgCodeSplitting = mprintf( + "/TITAN_Project_File_Information/Configurations/Configuration[@name='%s']" + "//ProjectProperties/MakefileSettings/codeSplitting/text()", + actcfg); + XPathObject codeSplittingObj(run_xpath(xpathCtx, xpathActCfgCodeSplitting)); + Free(xpathActCfgCodeSplitting); + if (codeSplittingObj->nodesetval && codeSplittingObj->nodesetval->nodeNr > 0) { + const char* content = (const char*)codeSplittingObj->nodesetval->nodeTab[0]->content; + if (local_argc != 0) { // top level project + // Get the code splitting without thinking + *p_csmode = mcopystr(content); + } else if (*p_csmode == NULL && strcmp(content, "none") != 0) { // todo config in error message? + ERROR("The top level project does not have code splitting set, but the `%s' project has `%s' code splitting set.", + *p_project_name, content); + } else if (*p_csmode != NULL && strcmp(content, *p_csmode)) { + ERROR("Code splitting must be the same. Top level project has `%s', `%s' project has `%s' code splitting set.", + *p_csmode, *p_project_name, content); + } + } else if (*p_csmode != NULL && strcmp(*p_csmode, "none") != 0) { + ERROR("The top level project have `%s' code splitting set, but the `%s' project has none.", + *p_csmode, *p_project_name); + } + } // Check options xsdbool2boolean(xpathCtx, actcfg, "useAbsolutePath", p_aflag); @@ -1999,7 +2029,6 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co xsdbool2boolean(xpathCtx, actcfg, "dynamicLinking", p_lflag); xsdbool2boolean(xpathCtx, actcfg, "functiontestRuntime", p_Rflag); xsdbool2boolean(xpathCtx, actcfg, "singleMode", p_sflag); - xsdbool2boolean(xpathCtx, actcfg, "codeSplitting", p_csflag); xsdbool2boolean(xpathCtx, actcfg, "quietly", p_quflag); xsdbool2boolean(xpathCtx, actcfg, "disableSubtypeChecking", p_dsflag); xsdbool2boolean(xpathCtx, actcfg, "disableBER", p_dbflag); @@ -2905,7 +2934,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co int my_optind = 0; boolean my_gflag = *p_gflag, my_aflag = *p_aflag, my_cflag = *p_cflag, // pass down my_Rflag = *p_Rflag, my_Pflag = *p_Pflag, my_Zflag = *p_Zflag, my_Hflag = *p_Hflag, - my_sflag = 0, my_Lflag = 0, my_lflag = 0, my_mflag = 0, my_csflag = 0, + my_sflag = 0, my_Lflag = 0, my_lflag = 0, my_mflag = 0, my_quflag = 0, my_dsflag = 0, my_dbflag = 0, my_drflag = 0, my_dtflag = 0, my_dxflag = 0, my_djflag = 0, my_fxflag = 0, my_doflag = 0, my_gfflag = 0, my_lnflag = 0, my_isflag = 0, my_asflag = 0, @@ -2914,6 +2943,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co char *my_ets = NULL; char *my_proj_name = NULL; + char *my_csmode = *p_csmode; autostring abs_projectLocationURI; if (not_abs_path) { abs_projectLocationURI = compose_path_name(abs_tpd_dir, projectLocationURI); @@ -2957,7 +2987,7 @@ static tpd_result process_tpd_internal(const char *p_tpd_name, char *tpdName, co &my_gflag, &my_sflag, &my_cflag, &my_aflag, preprocess, &my_Rflag, &my_lflag, &my_mflag, &my_Pflag, &my_Lflag, recursive, force_overwrite, gen_only_top_level, NULL, &sub_proj_abs_work_dir, sub_project_dirs, program_name, prj_graph_fp, create_symlink_list, ttcn3_prep_includes, ttcn3_prep_defines, ttcn3_prep_undefines, - prep_includes, prep_defines, prep_undefines, &my_csflag, + prep_includes, prep_defines, prep_undefines, &my_csmode, &my_quflag, &my_dsflag, cxxcompiler, optlevel, optflags, &my_dbflag, &my_drflag, &my_dtflag, &my_dxflag, &my_djflag, &my_fxflag, &my_doflag, &my_gfflag, &my_lnflag, &my_isflag, &my_asflag, &my_swflag, &my_Yflag, &my_Mflag, &my_Eflag, &my_nflag, &my_diflag, diff --git a/compiler2/xpather.h b/compiler2/xpather.h index c4565b7c51e84e1d6f407f4b4b6c706fa53d7642..1d53ac7583c93bfe8c88e47c1c36c34543e7e274 100644 --- a/compiler2/xpather.h +++ b/compiler2/xpather.h @@ -282,7 +282,7 @@ tpd_result process_tpd(const char *p_tpd_name, const char *actcfg, const char *output_file, char** abs_work_dir, struct string_list* sub_project_dirs, const char* program_name, FILE* prj_graph_fp, struct string2_list* create_symlink_list, struct string_list* ttcn3_prep_includes, struct string_list* ttcn3_prep_defines, struct string_list* ttcn3_prep_undefines, struct string_list* prep_includes, - struct string_list* prep_defines, struct string_list* prep_undefines, boolean *codesplit, boolean *quietly, boolean *disablesubtypecheck, + struct string_list* prep_defines, struct string_list* prep_undefines, char **codesplit, boolean *quietly, boolean *disablesubtypecheck, char** cxxcompiler, char** optlevel, char** optflags, boolean *disableber, boolean *disableraw, boolean *disabletext, boolean *disablexer, boolean *disablejson, boolean *forcexerinasn, boolean *defaultasomit, boolean *gccmessageformat, boolean *linenumber, boolean *includesourceinfo, boolean *addsourcelineinfo, boolean *suppresswarnings, diff --git a/etc/xsd/TPD.xsd b/etc/xsd/TPD.xsd index 7812e8f45712d0419f88def2def9920d68791650..b1af754aec20e3370c6a6fe8e95719cb8b15a2d7 100644 --- a/etc/xsd/TPD.xsd +++ b/etc/xsd/TPD.xsd @@ -41,7 +41,24 @@ <xs:element name="dynamicLinking" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="functiontestRuntime" minOccurs="0" maxOccurs="1" type="xs:boolean" /> <xs:element name="singleMode" minOccurs="0" maxOccurs="1" type="xs:boolean" /> - <xs:element name="codeSplitting" minOccurs="0" maxOccurs="1" type="xs:normalizedString" /> + <xs:element name="codeSplitting" minOccurs="0" maxOccurs="1"> + <xs:simpleType> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:normalizedString"> + <xs:enumeration value=""/> + <xs:enumeration value="none"/> + <xs:enumeration value="type"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:restriction base="xs:positiveInteger"> + <xs:maxExclusive value="1000000"/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> + </xs:element> <xs:element name="defaultTarget" minOccurs="0" maxOccurs="1"> <xs:simpleType> <xs:restriction base="xs:normalizedString"> diff --git a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction_e.ttcn b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction_e.ttcn index 7b4d4157841ce61d4273378c409b40dacd1788bb..7b10e177fbcfa8cce5e4109f2c5abbbdc7b0b06c 100644 --- a/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction_e.ttcn +++ b/regression_test/XML/XmlWorkflow/XmlTest_expectedTtcns/www_example_org_enumeration_restriction_e.ttcn @@ -154,6 +154,26 @@ type Only_int Ints ( ); +type union UnionWithEnumField +{ + enumerated { + x, + none_, + type_ + } alt_, + XSD.PositiveInteger alt_1 (1 .. !1000000) +} +with { + variant "useUnion"; + variant "element"; + variant (alt_) "name as ''"; + variant (alt_) "text 'none_' as 'none'"; + variant (alt_) "text 'type_' as 'type'"; + variant (alt_) "text 'x' as ''"; + variant (alt_1) "name as ''"; +}; + + } with { encode "XML"; diff --git a/regression_test/XML/XmlWorkflow/xsd/enumeration_restriction.xsd b/regression_test/XML/XmlWorkflow/xsd/enumeration_restriction.xsd index ccb09e6bab3a3e2ace53fbd56b3e50fdd787152a..64720a2077b9e1f95d8e2d6993290a350de70608 100644 --- a/regression_test/XML/XmlWorkflow/xsd/enumeration_restriction.xsd +++ b/regression_test/XML/XmlWorkflow/xsd/enumeration_restriction.xsd @@ -125,4 +125,23 @@ </xs:restriction> </xs:simpleType> +<xs:element name="UnionWithEnumField"> + <xs:simpleType> + <xs:union> + <xs:simpleType> + <xs:restriction base="xs:normalizedString"> + <xs:enumeration value=""/> + <xs:enumeration value="none"/> + <xs:enumeration value="type"/> + </xs:restriction> + </xs:simpleType> + <xs:simpleType> + <xs:restriction base="xs:positiveInteger"> + <xs:maxExclusive value="1000000"/> + </xs:restriction> + </xs:simpleType> + </xs:union> + </xs:simpleType> +</xs:element> + </xs:schema> diff --git a/regression_test/compileonly/mfgen-tpd/Makefile b/regression_test/compileonly/mfgen-tpd/Makefile index 937389b4ffa641ee3e0ac2eba9c809b45e6bf330..e85be62fb8acc5ee30ef4885b817816d27769e3e 100644 --- a/regression_test/compileonly/mfgen-tpd/Makefile +++ b/regression_test/compileonly/mfgen-tpd/Makefile @@ -32,7 +32,7 @@ MAKEPROG := ${MAKE} DIRLIST := buildconfig_param invalid_buildconfig_param invalid_buildconfig_tpd \ HP79745 HQ56829 HQ56834 HQ56848 library HR30356 flagTest HR30365 dependency_check \ required_config required_config_v2 required_config_v3 disablePredefinedExternalFolder \ - makefileScript + makefileScript splitting # The default target. ifeq ($(findstring c,$(MFGEN_FLAGS)),) # no -c diff --git a/regression_test/compileonly/mfgen-tpd/splitting/Makefile b/regression_test/compileonly/mfgen-tpd/splitting/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..969126f299fd3767cbe22ee045066ab26e412fa7 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/Makefile @@ -0,0 +1,65 @@ +############################################################################## +# Copyright (c) 2000-2016 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 + +ifdef LCOV +COVERAGE_FLAG := -C +endif + + +MAKEPROG := ${MAKE} + +all: Normal Recursive RecursiveDynamic + +Normal: + cd a && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -b None && cd binDefault && make && cd .. && rm -rf binDefault && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -b Type && cd binDefault && make && cd .. && rm -rf binDefault && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -f $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -b Number && cd binDefault && make && cd .. && rm -rf binDefault + +Recursive: + cd a && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -rgpcb None && cd binDefault && make && cd .. && \ + rm -rf binDefault ../b/binDefault ../c/binDefault && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -rgpcb Type && cd binDefault && make && cd .. && \ + rm -rf binDefault ../b/binDefault ../c/binDefault && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -rgpcb Number && cd binDefault && make && cd .. && \ + rm -rf binDefault ../b/binDefault ../c/binDefault + +RecursiveDynamic: + cd a && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -rcplb None && cd binDefault && make && cd .. && \ + rm -rf binDefault ../b/binDefault ../c/binDefault && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -rcplb Type && cd binDefault && make && cd .. && \ + rm -rf binDefault ../b/binDefault ../c/binDefault && \ + $(TTCN3_DIR)/bin/ttcn3_makefilegen -F $(MFGEN_FLAGS) $(COVERAGE_FLAG) \ + -t a.tpd -rcplb Number && cd binDefault && make && cd .. && \ + rm -rf binDefault ../b/binDefault ../c/binDefault + + +clean: + -rm -rf a/binDefault b/binDefault c/binDefault + +distclean: clean + -rm -f *.out + +.PHONY: all clean distclean Normal Recursive RecursiveDynamic + diff --git a/regression_test/compileonly/mfgen-tpd/splitting/a/a.tpd b/regression_test/compileonly/mfgen-tpd/splitting/a/a.tpd new file mode 100644 index 0000000000000000000000000000000000000000..9fecdce8c2f4e043d1d72974a69524c3640875cc --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/a/a.tpd @@ -0,0 +1,113 @@ +<!-- + Copyright (c) 2000-2016 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 – initial implementation +--> +<TITAN_Project_File_Information version="1.0"> + <ProjectName>a</ProjectName> + <ReferencedProjects> + <ReferencedProject name="b" projectLocationURI="../b/b.tpd"/> + <ReferencedProject name="c" projectLocationURI="../c/c.tpd"/> + </ReferencedProjects> + <Folders> + <FolderResource projectRelativePath="src" relativeURI="src"/> + </Folders> + <Files> + <FileResource projectRelativePath="src/ModuleA.ttcn" relativeURI="src/ModuleA.ttcn"/> + <FileResource projectRelativePath="src/ModuleA2.ttcnpp" relativeURI="src/ModuleA2.ttcnpp"/> + <FileResource projectRelativePath="src/ModuleA3.asn" relativeURI="src/ModuleA3.asn"/> + <FileResource projectRelativePath="src/ModuleA4.xsd" relativeURI="src/ModuleA4.xsd"/> + </Files> + <ActiveConfiguration>None</ActiveConfiguration> + <Configurations> + <Configuration name="None"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>none</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + <ConfigurationRequirements> + <configurationRequirement> + <projectName>b</projectName> + <requiredConfiguration>None</requiredConfiguration> + </configurationRequirement> + <configurationRequirement> + <projectName>c</projectName> + <requiredConfiguration>None</requiredConfiguration> + </configurationRequirement> + </ConfigurationRequirements> + </ProjectProperties> + </Configuration> + <Configuration name="Empty"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting></codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + <ConfigurationRequirements> + <configurationRequirement> + <projectName>b</projectName> + <requiredConfiguration>Empty</requiredConfiguration> + </configurationRequirement> + <configurationRequirement> + <projectName>c</projectName> + <requiredConfiguration>Empty</requiredConfiguration> + </configurationRequirement> + </ConfigurationRequirements> + </ProjectProperties> + </Configuration> + <Configuration name="Type"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>type</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + <ConfigurationRequirements> + <configurationRequirement> + <projectName>b</projectName> + <requiredConfiguration>Type</requiredConfiguration> + </configurationRequirement> + <configurationRequirement> + <projectName>c</projectName> + <requiredConfiguration>Type</requiredConfiguration> + </configurationRequirement> + </ConfigurationRequirements> + </ProjectProperties> + </Configuration> + <Configuration name="Number"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>5</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + <ConfigurationRequirements> + <configurationRequirement> + <projectName>b</projectName> + <requiredConfiguration>Number</requiredConfiguration> + </configurationRequirement> + <configurationRequirement> + <projectName>c</projectName> + <requiredConfiguration>Number</requiredConfiguration> + </configurationRequirement> + </ConfigurationRequirements> + </ProjectProperties> + </Configuration> + </Configurations> +</TITAN_Project_File_Information> diff --git a/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA.ttcn b/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..5e92299a6ea598c7f058f3c064090d9138866398 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA.ttcn @@ -0,0 +1,38 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 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 ModuleAMain { + import from ModuleB all; + import from ModuleC all; + + import from ModuleA2 all; + import from ModuleA3 all; + + import from ModuleB2 all; + import from ModuleB3 all; + import from ModuleC2 all; + import from ModuleC3 all; + + import from ModuleA4 all; + import from ModuleB4 all; + import from ModuleC4 all; + + const My_Integer_A a := 1; + const My_Integer_B b_1 := 1; + const My_Integer_C c_1 := 1; + const XSDA x_1 := 1; + const XSDB x_2 := 1; + const XSDC x_3 := 1; + + function f() return integer { + return a + b + c + b_1 + c_1 + a2 + b2 + c2 + x_1 + x_2 + x_3; + } +} \ No newline at end of file diff --git a/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA2.ttcnpp b/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA2.ttcnpp new file mode 100644 index 0000000000000000000000000000000000000000..32059435b61b0595836131a599f021ba12ef1945 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA2.ttcnpp @@ -0,0 +1,14 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 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 ModuleA2 { + const integer a2 := 1; +} \ No newline at end of file diff --git a/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA3.asn b/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA3.asn new file mode 100644 index 0000000000000000000000000000000000000000..cf607940d37de7d8a0133448f6ee855933269b42 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA3.asn @@ -0,0 +1,27 @@ +--///////////////////////////////////////////////////////////////////////////// +-- Copyright (c) 2000-2016 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 +-- +--///////////////////////////////////////////////////////////////////////////// +ModuleA3 +DEFINITIONS + +AUTOMATIC TAGS + +::= + +BEGIN + +IMPORTS ; -- nothing + +My-Integer ::= INTEGER + +My-Integer-A ::= INTEGER + +END diff --git a/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA4.xsd b/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA4.xsd new file mode 100644 index 0000000000000000000000000000000000000000..3b45c0b796db21a98a8e0139aba79ac4d9ba6cf3 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/a/src/ModuleA4.xsd @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="ModuleA4"> + +<xs:element name="XSDA" type="xs:integer"/> + +</xs:schema> diff --git a/regression_test/compileonly/mfgen-tpd/splitting/b/b.tpd b/regression_test/compileonly/mfgen-tpd/splitting/b/b.tpd new file mode 100644 index 0000000000000000000000000000000000000000..8bddc4217cf0d16d94b27e7ffea64f62b009ebbf --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/b/b.tpd @@ -0,0 +1,96 @@ +<!-- + Copyright (c) 2000-2016 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 – initial implementation +--> +<TITAN_Project_File_Information version="1.0"> + <ProjectName>b</ProjectName> + <ReferencedProjects> + <ReferencedProject name="c" projectLocationURI="../c/c.tpd"/> + </ReferencedProjects> + <Folders> + <FolderResource projectRelativePath="src" relativeURI="src"/> + </Folders> + <Files> + <FileResource projectRelativePath="src/ModuleB.ttcn" relativeURI="src/ModuleB.ttcn"/> + <FileResource projectRelativePath="src/ModuleB2.ttcnpp" relativeURI="src/ModuleB2.ttcnpp"/> + <FileResource projectRelativePath="src/ModuleB3.asn" relativeURI="src/ModuleB3.asn"/> + <FileResource projectRelativePath="src/ModuleB4.xsd" relativeURI="src/ModuleB4.xsd"/> + </Files> + <ActiveConfiguration>None</ActiveConfiguration> + <Configurations> + <Configuration name="None"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>none</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + <ConfigurationRequirements> + <configurationRequirement> + <projectName>c</projectName> + <requiredConfiguration>None</requiredConfiguration> + </configurationRequirement> + </ConfigurationRequirements> + </ProjectProperties> + </Configuration> + <Configuration name="Empty"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting></codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + <ConfigurationRequirements> + <configurationRequirement> + <projectName>c</projectName> + <requiredConfiguration>Empty</requiredConfiguration> + </configurationRequirement> + </ConfigurationRequirements> + </ProjectProperties> + </Configuration> + <Configuration name="Type"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>type</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + <ConfigurationRequirements> + <configurationRequirement> + <projectName>c</projectName> + <requiredConfiguration>Type</requiredConfiguration> + </configurationRequirement> + </ConfigurationRequirements> + </ProjectProperties> + </Configuration> + <Configuration name="Number"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>5</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + <ConfigurationRequirements> + <configurationRequirement> + <projectName>c</projectName> + <requiredConfiguration>Number</requiredConfiguration> + </configurationRequirement> + </ConfigurationRequirements> + </ProjectProperties> + </Configuration> + </Configurations> +</TITAN_Project_File_Information> diff --git a/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB.ttcn b/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..c4ee151c1442c29a22af5e11e0e357ec9213b642 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB.ttcn @@ -0,0 +1,19 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 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 ModuleB { + import from ModuleC all; + import from ModuleB2 all; + import from ModuleB3 all; + import from ModuleB4 all; + + const integer b := 2; +} \ No newline at end of file diff --git a/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB2.ttcnpp b/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB2.ttcnpp new file mode 100644 index 0000000000000000000000000000000000000000..a479ae8a55582d69a018d8fb0c07adc2d9fa3249 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB2.ttcnpp @@ -0,0 +1,14 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 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 ModuleB2 { + const integer b2 := 1; +} \ No newline at end of file diff --git a/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB3.asn b/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB3.asn new file mode 100644 index 0000000000000000000000000000000000000000..bac40d7a6006ae2cd4e4981edd37f57934799651 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB3.asn @@ -0,0 +1,27 @@ +--///////////////////////////////////////////////////////////////////////////// +-- Copyright (c) 2000-2016 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 +-- +--///////////////////////////////////////////////////////////////////////////// +ModuleB3 +DEFINITIONS + +AUTOMATIC TAGS + +::= + +BEGIN + +IMPORTS ; -- nothing + +My-Integer ::= INTEGER + +My-Integer-B ::= INTEGER + +END diff --git a/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB4.xsd b/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB4.xsd new file mode 100644 index 0000000000000000000000000000000000000000..fe46d878e6a471e0157e8a14380012b143e70206 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/b/src/ModuleB4.xsd @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="ModuleB4"> + +<xs:element name="XSDB" type="xs:integer"/> + +</xs:schema> diff --git a/regression_test/compileonly/mfgen-tpd/splitting/c/c.tpd b/regression_test/compileonly/mfgen-tpd/splitting/c/c.tpd new file mode 100644 index 0000000000000000000000000000000000000000..f0fc8fa057703edf590543051cc18b86398ec642 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/c/c.tpd @@ -0,0 +1,69 @@ +<!-- + Copyright (c) 2000-2016 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 – initial implementation +--> +<TITAN_Project_File_Information version="1.0"> + <ProjectName>c</ProjectName> + <Folders> + <FolderResource projectRelativePath="src" relativeURI="src"/> + </Folders> + <Files> + <FileResource projectRelativePath="src/ModuleC.ttcn" relativeURI="src/ModuleC.ttcn"/> + <FileResource projectRelativePath="src/ModuleC2.ttcnpp" relativeURI="src/ModuleC2.ttcnpp"/> + <FileResource projectRelativePath="src/ModuleC3.asn" relativeURI="src/ModuleC3.asn"/> + <FileResource projectRelativePath="src/ModuleC4.xsd" relativeURI="src/ModuleC4.xsd"/> + </Files> + <ActiveConfiguration>None</ActiveConfiguration> + <Configurations> + <Configuration name="None"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>none</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + </ProjectProperties> + </Configuration> + <Configuration name="Empty"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting></codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + </ProjectProperties> + </Configuration> + <Configuration name="Type"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>type</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + </ProjectProperties> + </Configuration> + <Configuration name="Number"> + <ProjectProperties> + <MakefileSettings> + <codeSplitting>5</codeSplitting> + <targetExecutable>binDefault/binDefault</targetExecutable> + </MakefileSettings> + <LocalBuildSettings> + <workingDirectory>binDefault</workingDirectory> + </LocalBuildSettings> + </ProjectProperties> + </Configuration> + </Configurations> +</TITAN_Project_File_Information> diff --git a/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC.ttcn b/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC.ttcn new file mode 100644 index 0000000000000000000000000000000000000000..70057eebf4f67b6c9d0465dba6253f8557fa31f3 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC.ttcn @@ -0,0 +1,18 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 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 ModuleC { + import from ModuleC2 all; + import from ModuleC3 all; + import from ModuleC4 all; + + const integer c := 3; +} \ No newline at end of file diff --git a/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC2.ttcnpp b/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC2.ttcnpp new file mode 100644 index 0000000000000000000000000000000000000000..3b0c183fd65a11e817ad42b70c7eed2bac6bcaa9 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC2.ttcnpp @@ -0,0 +1,14 @@ +/****************************************************************************** + * Copyright (c) 2000-2016 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 ModuleC2 { + const integer c2 := 1; +} \ No newline at end of file diff --git a/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC3.asn b/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC3.asn new file mode 100644 index 0000000000000000000000000000000000000000..bf87fd9d5a7670bbbd43a03a597bb0e8c0e34c26 --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC3.asn @@ -0,0 +1,27 @@ +--///////////////////////////////////////////////////////////////////////////// +-- Copyright (c) 2000-2016 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 +-- +--///////////////////////////////////////////////////////////////////////////// +ModuleC3 +DEFINITIONS + +AUTOMATIC TAGS + +::= + +BEGIN + +IMPORTS ; -- nothing + +My-Integer ::= INTEGER + +My-Integer-C ::= INTEGER + +END diff --git a/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC4.xsd b/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC4.xsd new file mode 100644 index 0000000000000000000000000000000000000000..fdb72706551edd977262eb67ef42cac7cd2e5b3f --- /dev/null +++ b/regression_test/compileonly/mfgen-tpd/splitting/c/src/ModuleC4.xsd @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="ModuleC4"> + +<xs:element name="XSDC" type="xs:integer"/> + +</xs:schema> diff --git a/regression_test/functionReference/FuncRef.ttcn b/regression_test/functionReference/FuncRef.ttcn index 99c7b06355308310bb6d700156ec70c6700d828e..ff99e58317579791fac916c9b9ee2bca89916d43 100644 --- a/regression_test/functionReference/FuncRef.ttcn +++ b/regression_test/functionReference/FuncRef.ttcn @@ -29,6 +29,16 @@ function add(in integer a, in integer b) return integer { return a+b; } function sub(in integer a, in integer b) return integer { return a-b; } function mul(in integer a, in integer b) return integer { return a*b; } +public function my_int2str(in integer a) return charstring { + var charstring f := int2str(a); + return f; +} + +type function my_int2str_type(in integer a) return charstring; + +modulepar my_int2str_type modulepar_my_intstr := refers(my_int2str); + + type union operator_type { un_oper unary, @@ -443,6 +453,15 @@ function f_refers() { var f_FT vf := valueof(f_FT:refers(f_refers)); } +// for Bug 511976 +testcase tc_modulepar_refer() runs on FuncRef_comp { + if (modulepar_my_intstr.apply(4) == "4") { + setverdict(pass); + } else { + setverdict(fail); + } +} + control { @@ -465,6 +484,7 @@ control execute(tc_runsonself()); execute(tc_functionrefIsbound()); execute(tc_send_tc()); + execute(tc_modulepar_refer()); } } diff --git a/usrguide/referenceguide.doc b/usrguide/referenceguide.doc index c979b127e3be4b7b4a880126a01846e1b8c8ecec..4c00bd524ce94bbbad3724195c4b1efaf0906771 100644 Binary files a/usrguide/referenceguide.doc and b/usrguide/referenceguide.doc differ diff --git a/xsdconvert/GeneralTypes.hh b/xsdconvert/GeneralTypes.hh index 01adeac7d23346370c8f39d412da1d49c05277e2..d364accf9f5919a12e5c97287df684da3a4d0670 100644 --- a/xsdconvert/GeneralTypes.hh +++ b/xsdconvert/GeneralTypes.hh @@ -148,7 +148,7 @@ public: } QualifiedName(const Mstring& ns, const Mstring nm) - : nsuri(ns), name(nm), dup(false) { + : nsuri(ns), name(nm), orig_name(nm), dup(false) { } QualifiedName(const Mstring& ns, const Mstring nm, const Mstring orig)