diff options
Diffstat (limited to 'Source/Modules/main.cxx')
-rw-r--r-- | Source/Modules/main.cxx | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/Source/Modules/main.cxx b/Source/Modules/main.cxx index 4076b9206..f3aff2349 100644 --- a/Source/Modules/main.cxx +++ b/Source/Modules/main.cxx @@ -483,6 +483,10 @@ void SWIG_getoptions(int argc, char *argv[]) { Preprocessor_define((DOH *) "__cplusplus __cplusplus", 0); Swig_cparse_cplusplus(1); Swig_mark_arg(i); + } else if (strcmp(argv[i], "-c++out") == 0) { + // Undocumented + Swig_cparse_cplusplusout(1); + Swig_mark_arg(i); } else if (strcmp(argv[i], "-fcompact") == 0) { Wrapper_compact_print_mode_set(1); Swig_mark_arg(i); @@ -855,8 +859,9 @@ void SWIG_getoptions(int argc, char *argv[]) { } } - - +static void flatten_nested() { + Swig_feature_set(Swig_cparse_features(), "", 0, "feature:flatnested", "1", 0); +} int SWIG_main(int argc, char *argv[], Language *l) { @@ -947,6 +952,11 @@ int SWIG_main(int argc, char *argv[], Language *l) { // Don't check for an input file if -external-runtime is passed Swig_check_options(external_runtime ? 0 : 1); + if (CPlusPlus && cparse_cplusplusout) { + Printf(stderr, "The -c++out option is for C input but C++ input has been requested via -c++\n"); + SWIG_exit(EXIT_FAILURE); + } + install_opts(argc, argv); // Add language dependent directory to the search path @@ -1151,6 +1161,10 @@ int SWIG_main(int argc, char *argv[], Language *l) { fflush(stdout); } + // add "ignore" directive if nested classes are not supported + if (!lang->nestedClassesSupported()) + flatten_nested(); + Node *top = Swig_cparse(cpps); if (dump_top & STAGE1) { @@ -1161,6 +1175,11 @@ int SWIG_main(int argc, char *argv[], Language *l) { Printf(stdout, "debug-module stage 1\n"); Swig_print_tree(Getattr(top, "module")); } + if (!CPlusPlus) { + if (Verbose) + Printf(stdout, "Processing unnamed structs...\n"); + Swig_nested_name_unnamed_c_structs(top); + } if (Verbose) { Printf(stdout, "Processing types...\n"); @@ -1181,6 +1200,12 @@ int SWIG_main(int argc, char *argv[], Language *l) { } Swig_default_allocators(top); + if (CPlusPlus) { + if (Verbose) + Printf(stdout, "Processing nested classes...\n"); + Swig_nested_process_classes(top); + } + if (dump_top & STAGE3) { Printf(stdout, "debug-top stage 3\n"); Swig_print_tree(top); |