diff --git a/CHANGES.current b/CHANGES.current index 97f55bef6..6ce431b60 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.3 (in progress) =========================== +2014-08-15: talby + [Perl] Include guard fix for nested modules from Anthony Heading (SF Patch #350). + 2014-08-04: wsfulton [C#] Merge patch #200 from gpetrou - Changed CSharp license header to include auto-generated tag so that StyleCop ignores the files. diff --git a/Examples/test-suite/director_nestedmodule.i b/Examples/test-suite/director_nestedmodule.i new file mode 100644 index 000000000..4e304340f --- /dev/null +++ b/Examples/test-suite/director_nestedmodule.i @@ -0,0 +1,29 @@ +%module(directors="1") "director::nestedmodule" + +%{ +#include + +class Foo { + public: + virtual ~Foo() {} + virtual std::string ping() { return "Foo::ping()"; } + virtual std::string pong() { return "Foo::pong();" + ping(); } + + static Foo* get_self(Foo *slf) {return slf;} +}; + +%} + +%include + +%feature("director") Foo; + + +class Foo { + public: + virtual ~Foo(); + virtual std::string ping(); + virtual std::string pong(); + + static Foo* get_self(Foo *slf); +}; diff --git a/Examples/test-suite/perl5/Makefile.in b/Examples/test-suite/perl5/Makefile.in index a4628ddcb..ccd12d6e4 100644 --- a/Examples/test-suite/perl5/Makefile.in +++ b/Examples/test-suite/perl5/Makefile.in @@ -17,6 +17,7 @@ CPP_TEST_CASES += \ li_cstring \ li_cdata_carrays \ li_reference \ + director_nestedmodule \ C_TEST_CASES += \ li_cdata \ diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index ff504d461..c67ba554a 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -342,11 +342,18 @@ public: Node *options = Getattr(mod, "options"); module = Copy(Getattr(n,"name")); + String *underscore_module = Copy(module); + Replaceall(underscore_module,":","_"); + + if (verbose > 0) { + fprintf(stdout, "top: using namespace_module: %s\n", Char(namespace_module)); + } + if (directorsEnabled()) { Swig_banner(f_directors_h); Printf(f_directors_h, "\n"); - Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module); - Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module); + Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", underscore_module); + Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", underscore_module); if (dirprot_mode()) { Printf(f_directors_h, "#include \n"); Printf(f_directors_h, "#include \n\n"); @@ -379,13 +386,6 @@ public: fprintf(stdout, "top: No package found\n"); } } - String *underscore_module = Copy(module); - Replaceall(underscore_module,":","_"); - - if (verbose > 0) { - fprintf(stdout, "top: using namespace_module: %s\n", Char(namespace_module)); - } - /* If we're in blessed mode, change the package name to "packagec" */ if (blessed) {