Add in $symname expansion for director methods

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12772 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2011-08-04 19:45:19 +00:00
commit 44c202d048
7 changed files with 30 additions and 1 deletions

View file

@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.5 (in progress)
===========================
2011-08-04: wsfulton
Add in $symname expansion for director methods.
2011-07-29: olly
[PHP] Don't generate "return $r;" in cases where $r hasn't been set.
This was basically harmless, except it generated a PHP E_NOTICE if

View file

@ -1,4 +1,4 @@
%module special_variables
%module(directors="1") special_variables
%include <std_string.i>
@ -88,3 +88,19 @@ namespace SpaceNamespace {
%template(TemplateABC) SpaceNamespace::Template<SpaceNamespace::ABC>;
/////////////////////////////////// directors /////////////////////////////////
%{
void DirectorTest_director_testmethod(int i) {}
void DirectorTest_director_testmethodSwigExplicitDirectorTest(int i) {}
%}
%typemap(directorargout) int i {
$symname(99);
}
%feature("director") DirectorTest;
%inline %{
void director_testmethod(int i) {}
struct DirectorTest {
virtual void director_testmethod(int i) {}
virtual ~DirectorTest() {}
};
%}

View file

@ -1387,6 +1387,7 @@ public:
String *name;
String *classname;
String *c_classname = Getattr(parent, "name");
String *symname = Getattr(n, "sym:name");
String *declaration;
ParmList *l;
Wrapper *w;
@ -1691,6 +1692,7 @@ public:
/* emit the director method */
if (status == SWIG_OK) {
if (!Getattr(n, "defaultargs")) {
Replaceall(w->code, "$symname", symname);
Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL);
Printv(f_directors_h, inline_extra_method, NIL);

View file

@ -1208,6 +1208,7 @@ public:
String *name;
String *classname;
String *c_classname = Getattr(parent, "name");
String *symname = Getattr(n, "sym:name");
String *declaration;
ParmList *l;
Wrapper *w;
@ -1474,6 +1475,7 @@ public:
// emit the director method
if (status == SWIG_OK) {
if (!Getattr(n, "defaultargs")) {
Replaceall(w->code, "$symname", symname);
Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL);
Printv(f_directors_h, inline_extra_method, NIL);

View file

@ -2417,6 +2417,7 @@ done:
String *name;
String *classname;
String *c_classname = Getattr(parent, "name");
String *symname = Getattr(n, "sym:name");
String *declaration;
ParmList *l;
Wrapper *w;
@ -2738,6 +2739,7 @@ done:
/* emit the director method */
if (status == SWIG_OK) {
if (!Getattr(n, "defaultargs")) {
Replaceall(w->code, "$symname", symname);
Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL);
Printv(f_directors_h, inline_extra_method, NIL);

View file

@ -4533,6 +4533,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
String *name;
String *classname;
String *c_classname = Getattr(parent, "name");
String *symname = Getattr(n, "sym:name");
String *declaration;
ParmList *l;
Wrapper *w;
@ -4996,6 +4997,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
/* emit the director method */
if (status == SWIG_OK) {
if (!Getattr(n, "defaultargs")) {
Replaceall(w->code, "$symname", symname);
Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL);
Printv(f_directors_h, inline_extra_method, NIL);

View file

@ -3028,6 +3028,7 @@ public:
String *name;
String *classname;
String *c_classname = Getattr(parent, "name");
String *symname = Getattr(n, "sym:name");
String *declaration;
ParmList *l;
Wrapper *w;
@ -3388,6 +3389,7 @@ public:
/* emit the director method */
if (status == SWIG_OK) {
if (!Getattr(n, "defaultargs")) {
Replaceall(w->code, "$symname", symname);
Wrapper_print(w, f_directors);
Printv(f_directors_h, declaration, NIL);
Printv(f_directors_h, inline_extra_method, NIL);