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:
parent
e29d93ebd9
commit
44c202d048
7 changed files with 30 additions and 1 deletions
|
|
@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release.
|
||||||
Version 2.0.5 (in progress)
|
Version 2.0.5 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2011-08-04: wsfulton
|
||||||
|
Add in $symname expansion for director methods.
|
||||||
|
|
||||||
2011-07-29: olly
|
2011-07-29: olly
|
||||||
[PHP] Don't generate "return $r;" in cases where $r hasn't been set.
|
[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
|
This was basically harmless, except it generated a PHP E_NOTICE if
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
%module special_variables
|
%module(directors="1") special_variables
|
||||||
|
|
||||||
%include <std_string.i>
|
%include <std_string.i>
|
||||||
|
|
||||||
|
|
@ -88,3 +88,19 @@ namespace SpaceNamespace {
|
||||||
|
|
||||||
%template(TemplateABC) SpaceNamespace::Template<SpaceNamespace::ABC>;
|
%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() {}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -1387,6 +1387,7 @@ public:
|
||||||
String *name;
|
String *name;
|
||||||
String *classname;
|
String *classname;
|
||||||
String *c_classname = Getattr(parent, "name");
|
String *c_classname = Getattr(parent, "name");
|
||||||
|
String *symname = Getattr(n, "sym:name");
|
||||||
String *declaration;
|
String *declaration;
|
||||||
ParmList *l;
|
ParmList *l;
|
||||||
Wrapper *w;
|
Wrapper *w;
|
||||||
|
|
@ -1691,6 +1692,7 @@ public:
|
||||||
/* emit the director method */
|
/* emit the director method */
|
||||||
if (status == SWIG_OK) {
|
if (status == SWIG_OK) {
|
||||||
if (!Getattr(n, "defaultargs")) {
|
if (!Getattr(n, "defaultargs")) {
|
||||||
|
Replaceall(w->code, "$symname", symname);
|
||||||
Wrapper_print(w, f_directors);
|
Wrapper_print(w, f_directors);
|
||||||
Printv(f_directors_h, declaration, NIL);
|
Printv(f_directors_h, declaration, NIL);
|
||||||
Printv(f_directors_h, inline_extra_method, NIL);
|
Printv(f_directors_h, inline_extra_method, NIL);
|
||||||
|
|
|
||||||
|
|
@ -1208,6 +1208,7 @@ public:
|
||||||
String *name;
|
String *name;
|
||||||
String *classname;
|
String *classname;
|
||||||
String *c_classname = Getattr(parent, "name");
|
String *c_classname = Getattr(parent, "name");
|
||||||
|
String *symname = Getattr(n, "sym:name");
|
||||||
String *declaration;
|
String *declaration;
|
||||||
ParmList *l;
|
ParmList *l;
|
||||||
Wrapper *w;
|
Wrapper *w;
|
||||||
|
|
@ -1474,6 +1475,7 @@ public:
|
||||||
// emit the director method
|
// emit the director method
|
||||||
if (status == SWIG_OK) {
|
if (status == SWIG_OK) {
|
||||||
if (!Getattr(n, "defaultargs")) {
|
if (!Getattr(n, "defaultargs")) {
|
||||||
|
Replaceall(w->code, "$symname", symname);
|
||||||
Wrapper_print(w, f_directors);
|
Wrapper_print(w, f_directors);
|
||||||
Printv(f_directors_h, declaration, NIL);
|
Printv(f_directors_h, declaration, NIL);
|
||||||
Printv(f_directors_h, inline_extra_method, NIL);
|
Printv(f_directors_h, inline_extra_method, NIL);
|
||||||
|
|
|
||||||
|
|
@ -2417,6 +2417,7 @@ done:
|
||||||
String *name;
|
String *name;
|
||||||
String *classname;
|
String *classname;
|
||||||
String *c_classname = Getattr(parent, "name");
|
String *c_classname = Getattr(parent, "name");
|
||||||
|
String *symname = Getattr(n, "sym:name");
|
||||||
String *declaration;
|
String *declaration;
|
||||||
ParmList *l;
|
ParmList *l;
|
||||||
Wrapper *w;
|
Wrapper *w;
|
||||||
|
|
@ -2738,6 +2739,7 @@ done:
|
||||||
/* emit the director method */
|
/* emit the director method */
|
||||||
if (status == SWIG_OK) {
|
if (status == SWIG_OK) {
|
||||||
if (!Getattr(n, "defaultargs")) {
|
if (!Getattr(n, "defaultargs")) {
|
||||||
|
Replaceall(w->code, "$symname", symname);
|
||||||
Wrapper_print(w, f_directors);
|
Wrapper_print(w, f_directors);
|
||||||
Printv(f_directors_h, declaration, NIL);
|
Printv(f_directors_h, declaration, NIL);
|
||||||
Printv(f_directors_h, inline_extra_method, NIL);
|
Printv(f_directors_h, inline_extra_method, NIL);
|
||||||
|
|
|
||||||
|
|
@ -4533,6 +4533,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
||||||
String *name;
|
String *name;
|
||||||
String *classname;
|
String *classname;
|
||||||
String *c_classname = Getattr(parent, "name");
|
String *c_classname = Getattr(parent, "name");
|
||||||
|
String *symname = Getattr(n, "sym:name");
|
||||||
String *declaration;
|
String *declaration;
|
||||||
ParmList *l;
|
ParmList *l;
|
||||||
Wrapper *w;
|
Wrapper *w;
|
||||||
|
|
@ -4996,6 +4997,7 @@ int PYTHON::classDirectorMethod(Node *n, Node *parent, String *super) {
|
||||||
/* emit the director method */
|
/* emit the director method */
|
||||||
if (status == SWIG_OK) {
|
if (status == SWIG_OK) {
|
||||||
if (!Getattr(n, "defaultargs")) {
|
if (!Getattr(n, "defaultargs")) {
|
||||||
|
Replaceall(w->code, "$symname", symname);
|
||||||
Wrapper_print(w, f_directors);
|
Wrapper_print(w, f_directors);
|
||||||
Printv(f_directors_h, declaration, NIL);
|
Printv(f_directors_h, declaration, NIL);
|
||||||
Printv(f_directors_h, inline_extra_method, NIL);
|
Printv(f_directors_h, inline_extra_method, NIL);
|
||||||
|
|
|
||||||
|
|
@ -3028,6 +3028,7 @@ public:
|
||||||
String *name;
|
String *name;
|
||||||
String *classname;
|
String *classname;
|
||||||
String *c_classname = Getattr(parent, "name");
|
String *c_classname = Getattr(parent, "name");
|
||||||
|
String *symname = Getattr(n, "sym:name");
|
||||||
String *declaration;
|
String *declaration;
|
||||||
ParmList *l;
|
ParmList *l;
|
||||||
Wrapper *w;
|
Wrapper *w;
|
||||||
|
|
@ -3388,6 +3389,7 @@ public:
|
||||||
/* emit the director method */
|
/* emit the director method */
|
||||||
if (status == SWIG_OK) {
|
if (status == SWIG_OK) {
|
||||||
if (!Getattr(n, "defaultargs")) {
|
if (!Getattr(n, "defaultargs")) {
|
||||||
|
Replaceall(w->code, "$symname", symname);
|
||||||
Wrapper_print(w, f_directors);
|
Wrapper_print(w, f_directors);
|
||||||
Printv(f_directors_h, declaration, NIL);
|
Printv(f_directors_h, declaration, NIL);
|
||||||
Printv(f_directors_h, inline_extra_method, NIL);
|
Printv(f_directors_h, inline_extra_method, NIL);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue