From 7ba06526776274d779fb12636e1ab7e4063c0f72 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Thu, 12 Mar 2015 19:51:11 +1300 Subject: [PATCH] Create director_common.swg for language-indep code Move -DSWIG_DIRECTOR_STATIC handling there, so this is now supported for all languages with director support, not just Python and PHP. --- CHANGES.current | 4 ++++ Lib/director_common.swg | 15 +++++++++++++++ Lib/php/director.swg | 9 --------- Lib/python/director.swg | 10 ---------- Source/Modules/csharp.cxx | 1 + Source/Modules/d.cxx | 1 + Source/Modules/java.cxx | 1 + Source/Modules/ocaml.cxx | 1 + Source/Modules/octave.cxx | 4 +++- Source/Modules/perl5.cxx | 1 + Source/Modules/php.cxx | 1 + Source/Modules/python.cxx | 1 + Source/Modules/ruby.cxx | 1 + 13 files changed, 30 insertions(+), 20 deletions(-) create mode 100644 Lib/director_common.swg diff --git a/CHANGES.current b/CHANGES.current index 93e5fb943..c8a376e0a 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.6 (in progress) =========================== +2015-03-12: olly + -DSWIG_DIRECTOR_STATIC is now supported for all languages with + director support, not only Python and PHP. + 2015-03-02: ianlancetaylor [Go] Add -cgo option, required for Go versions 1.5 and later. diff --git a/Lib/director_common.swg b/Lib/director_common.swg new file mode 100644 index 000000000..9ce93c7e7 --- /dev/null +++ b/Lib/director_common.swg @@ -0,0 +1,15 @@ +/* ----------------------------------------------------------------------------- + * director_common.swg + * + * This file contains support for director classes which is common between + * languages. + * ----------------------------------------------------------------------------- */ + +/* + Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the + 'Swig' namespace. This could be useful for multi-modules projects. +*/ +#ifdef SWIG_DIRECTOR_STATIC +/* Force anonymous (static) namespace */ +#define Swig +#endif diff --git a/Lib/php/director.swg b/Lib/php/director.swg index 92c149999..638a1697d 100644 --- a/Lib/php/director.swg +++ b/Lib/php/director.swg @@ -12,15 +12,6 @@ #include #include -/* - Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the - 'Swig' namespace. This could be useful for multi-modules projects. -*/ -#ifdef SWIG_DIRECTOR_STATIC -/* Force anonymous (static) namespace */ -#define Swig -#endif - namespace Swig { /* memory handler */ diff --git a/Lib/python/director.swg b/Lib/python/director.swg index 90c58c107..6e69e544c 100644 --- a/Lib/python/director.swg +++ b/Lib/python/director.swg @@ -40,16 +40,6 @@ #endif -/* - Use -DSWIG_DIRECTOR_STATIC if you prefer to avoid the use of the - 'Swig' namespace. This could be useful for multi-modules projects. -*/ -#ifdef SWIG_DIRECTOR_STATIC -/* Force anonymous (static) namespace */ -#define Swig -#endif - - /* Use -DSWIG_DIRECTOR_NORTTI if you prefer to avoid the use of the native C++ RTTI and dynamic_cast<>. But be aware that directors diff --git a/Source/Modules/csharp.cxx b/Source/Modules/csharp.cxx index 3b1e03560..52d230d99 100644 --- a/Source/Modules/csharp.cxx +++ b/Source/Modules/csharp.cxx @@ -418,6 +418,7 @@ public: if (directorsEnabled()) { // Insert director runtime into the f_runtime file (make it occur before %header section) + Swig_insert_file("director_common.swg", f_runtime); Swig_insert_file("director.swg", f_runtime); } // Generate the intermediary class diff --git a/Source/Modules/d.cxx b/Source/Modules/d.cxx index 8546372ea..8b0bdded1 100644 --- a/Source/Modules/d.cxx +++ b/Source/Modules/d.cxx @@ -508,6 +508,7 @@ public: if (directorsEnabled()) { // Insert director runtime into the f_runtime file (before %header section). + Swig_insert_file("director_common.swg", f_runtime); Swig_insert_file("director.swg", f_runtime); } diff --git a/Source/Modules/java.cxx b/Source/Modules/java.cxx index 82ecb41a4..b010d10d5 100644 --- a/Source/Modules/java.cxx +++ b/Source/Modules/java.cxx @@ -481,6 +481,7 @@ public: if (directorsEnabled()) { // Insert director runtime into the f_runtime file (make it occur before %header section) + Swig_insert_file("director_common.swg", f_runtime); Swig_insert_file("director.swg", f_runtime); } // Generate the intermediary class diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index ac73c1f0c..72f0d98d3 100644 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -325,6 +325,7 @@ public: if (directorsEnabled()) { // Insert director runtime into the f_runtime file (make it occur before %header section) + Swig_insert_file("director_common.swg", f_runtime); Swig_insert_file("director.swg", f_runtime); } diff --git a/Source/Modules/octave.cxx b/Source/Modules/octave.cxx index 236598c1f..6d225575d 100644 --- a/Source/Modules/octave.cxx +++ b/Source/Modules/octave.cxx @@ -228,8 +228,10 @@ public: if (Len(docs)) emit_doc_texinfo(); - if (directorsEnabled()) + if (directorsEnabled()) { + Swig_insert_file("director_common.swg", f_runtime); Swig_insert_file("director.swg", f_runtime); + } Printf(f_init, "return true;\n}\n"); Printf(s_global_tab, "{0,0,0,0,0}\n};\n"); diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index e1b0e69c6..3963abf5d 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -470,6 +470,7 @@ public: if (directorsEnabled()) { // Insert director runtime into the f_runtime file (make it occur before %header section) + Swig_insert_file("director_common.swg", f_runtime); Swig_insert_file("director.swg", f_runtime); } diff --git a/Source/Modules/php.cxx b/Source/Modules/php.cxx index e6105eb3e..b50470ede 100644 --- a/Source/Modules/php.cxx +++ b/Source/Modules/php.cxx @@ -473,6 +473,7 @@ public: if (directorsEnabled()) { // Insert director runtime + Swig_insert_file("director_common.swg", s_header); Swig_insert_file("director.swg", s_header); } diff --git a/Source/Modules/python.cxx b/Source/Modules/python.cxx index c71a0f364..0e4a40229 100644 --- a/Source/Modules/python.cxx +++ b/Source/Modules/python.cxx @@ -967,6 +967,7 @@ public: if (directorsEnabled()) { // Insert director runtime into the f_runtime file (make it occur before %header section) + Swig_insert_file("director_common.swg", f_runtime); Swig_insert_file("director.swg", f_runtime); } diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index 310e89b82..5aadf86df 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -1171,6 +1171,7 @@ public: if (directorsEnabled()) { // Insert director runtime into the f_runtime file (make it occur before %header section) + Swig_insert_file("director_common.swg", f_runtime); Swig_insert_file("director.swg", f_runtime); }