From da079c2d2b0ae4c07ff4eb30f2286c96bda0ff77 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Mon, 25 Sep 2006 21:47:08 +0000 Subject: [PATCH] Fix #1505591 Throwing exceptions in extended directors git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@9361 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Source/Modules/csharp.cxx | 3 ++- Source/Modules/java.cxx | 3 ++- Source/Modules/ocaml.cxx | 6 +++++- Source/Modules/python.cxx | 12 +++++++----- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index a27e4c6cd..ff5ff5556 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -359,7 +359,8 @@ class CSHARP : public Language { Printf(f_directors, "/* ---------------------------------------------------\n"); Printf(f_directors, " * C++ director class methods\n"); Printf(f_directors, " * --------------------------------------------------- */\n\n"); - Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h)); + if (outfile_h) + Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h)); } String *wrapper_name = NewString(""); diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index a553f9929..c8aa73138 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -362,7 +362,8 @@ class JAVA : public Language { Printf(f_directors, "/* ---------------------------------------------------\n"); Printf(f_directors, " * C++ director class methods\n"); Printf(f_directors, " * --------------------------------------------------- */\n\n"); - Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h)); + if (outfile_h) + Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h)); } String *wrapper_name = NewString(""); diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index 7d8688f76..29958e85f 100755 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -295,7 +295,6 @@ public: if( directorsEnabled() ) { Printf( f_runtime, "#define SWIG_DIRECTORS\n"); - Swig_insert_file("director.swg", f_directors_h); } /* Produce the enum_to_int and int_to_enum functions */ @@ -347,6 +346,11 @@ public: Printf( f_enumtypes_value, "]\n\n" "type c_obj = c_enum_value c_obj_t\n" ); + if (directorsEnabled()) { + // Insert director runtime into the f_runtime file (make it occur before %header section) + Swig_insert_file("director.swg", f_runtime); + } + SwigType_emit_type_table (f_runtime, f_wrappers); /* Close all of the files */ Dump(f_directors_h,f_header); diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index 4cb3a1e7c..51ef95f0b 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -645,16 +645,13 @@ public: Printf(f_directors_h, "#include \n"); Printf(f_directors_h, "#include \n\n"); } - /* Printf(f_directors_h, "class Swig::Director;\n\n"); */ - Swig_insert_file("director_h.swg", f_directors_h); + Printf(f_directors, "\n\n"); Printf(f_directors, "/* ---------------------------------------------------\n"); Printf(f_directors, " * C++ director class methods\n"); Printf(f_directors, " * --------------------------------------------------- */\n\n"); - if (outfile_h) { + if (outfile_h) Printf(f_directors, "#include \"%s\"\n\n",Swig_file_filename(outfile_h)); - } - Swig_insert_file("director.swg", f_directors); } /* If shadow classing is enabled, we're going to change the module name to "_module" */ @@ -801,6 +798,11 @@ public: /* emit code */ Language::top(n); + if (directorsEnabled()) { + // Insert director runtime into the f_runtime file (make it occur before %header section) + Swig_insert_file("director.swg", f_runtime); + } + /* Close language module */ Append(methods,"\t { NULL, NULL, 0, NULL }\n"); Append(methods,"};\n");