%ignore director fixes
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9326 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
27d9ebb942
commit
edd5bfeb1a
8 changed files with 262 additions and 176 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
Version 1.3.30 (in progress)
|
Version 1.3.30 (in progress)
|
||||||
============================
|
============================
|
||||||
|
|
||||||
|
09/22/2006: wsfulton
|
||||||
|
Fix %ignore on director methods - Bugs #1546254, #1543533
|
||||||
|
|
||||||
09/20/2006: wsfulton
|
09/20/2006: wsfulton
|
||||||
Fix %ignore on director constructors
|
Fix %ignore on director constructors
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,13 @@ public class runme
|
||||||
|
|
||||||
void run()
|
void run()
|
||||||
{
|
{
|
||||||
|
// Just check the classes can be instantiated and other methods work as expected
|
||||||
|
DIgnoresDerived a = new DIgnoresDerived();
|
||||||
|
if (a.Triple(5) != 15)
|
||||||
|
throw new Exception("Triple failed");
|
||||||
|
DAbstractIgnoresDerived b = new DAbstractIgnoresDerived();
|
||||||
|
if (b.Quadruple(5) != 20)
|
||||||
|
throw new Exception("Quadruple failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -22,13 +29,29 @@ class DIgnoresDerived : DIgnores
|
||||||
}
|
}
|
||||||
|
|
||||||
// These will give a warning if the %ignore is not working
|
// These will give a warning if the %ignore is not working
|
||||||
public virtual void OverloadedMethod(int n, int xoffset, int yoffset) {}
|
public virtual int OverloadedMethod(int n, int xoffset, int yoffset) { return 0; }
|
||||||
public virtual void OverloadedMethod(int n, int xoffset) {}
|
public virtual int OverloadedMethod(int n, int xoffset) { return 0; }
|
||||||
public virtual void OverloadedMethod(int n) {}
|
public virtual int OverloadedMethod(int n) { return 0; }
|
||||||
|
|
||||||
public virtual void ProtectedMethod(int n, int xoffset, int yoffset) {}
|
public virtual int OverloadedProtectedMethod(int n, int xoffset, int yoffset) { return 0; }
|
||||||
public virtual void ProtectedMethod(int n, int xoffset) {}
|
public virtual int OverloadedProtectedMethod(int n, int xoffset) { return 0; }
|
||||||
public virtual void ProtectedMethod(int n) {}
|
public virtual int OverloadedProtectedMethod(int n) { return 0; }
|
||||||
|
}
|
||||||
|
|
||||||
|
class DAbstractIgnoresDerived : DAbstractIgnores
|
||||||
|
{
|
||||||
|
public DAbstractIgnoresDerived() : base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
// These will give a warning if the %ignore is not working
|
||||||
|
public virtual int OverloadedMethod(int n, int xoffset, int yoffset) { return 0; }
|
||||||
|
public virtual int OverloadedMethod(int n, int xoffset) { return 0; }
|
||||||
|
public virtual int OverloadedMethod(int n) { return 0; }
|
||||||
|
|
||||||
|
public virtual int OverloadedProtectedMethod(int n, int xoffset, int yoffset) { return 0; }
|
||||||
|
public virtual int OverloadedProtectedMethod(int n, int xoffset) { return 0; }
|
||||||
|
public virtual int OverloadedProtectedMethod(int n) { return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,17 @@
|
||||||
%module(directors="1") director_ignore
|
%module(directors="1") director_ignore
|
||||||
|
|
||||||
|
%warnfilter(SWIGWARN_LANG_DIRECTOR_ABSTRACT) DIgnoreOnlyConstructor;
|
||||||
|
|
||||||
%include "std_string.i"
|
%include "std_string.i"
|
||||||
|
|
||||||
%feature("director");
|
%feature("director");
|
||||||
|
|
||||||
%ignore OverloadedMethod(int n, int xoffset = 0, int yoffset = 0);
|
%ignore OverloadedMethod(int n, int xoffset = 0, int yoffset = 0);
|
||||||
%ignore ProtectedMethod(int n, int xoffset = 0, int yoffset = 0);
|
%ignore OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0);
|
||||||
%ignore DIgnoreConstructor(bool b);
|
%ignore DIgnoreConstructor(bool b);
|
||||||
%ignore DIgnoreOnlyConstructor(bool b);
|
%ignore DIgnoreOnlyConstructor(bool b);
|
||||||
|
%ignore Pointers;
|
||||||
|
%ignore References;
|
||||||
|
|
||||||
%inline %{
|
%inline %{
|
||||||
|
|
||||||
|
|
@ -18,8 +22,26 @@ class DIgnores
|
||||||
virtual ~DIgnores() {}
|
virtual ~DIgnores() {}
|
||||||
virtual void OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) {}
|
virtual void OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) {}
|
||||||
virtual void OverloadedMethod(bool b) {}
|
virtual void OverloadedMethod(bool b) {}
|
||||||
|
virtual int Triple(int n) { return n*3; }
|
||||||
|
virtual int& References(int& n) { static int nn; nn=n; return nn; }
|
||||||
|
virtual int* Pointers(int* n) { static int nn; nn=*n; return &nn; }
|
||||||
protected:
|
protected:
|
||||||
virtual void ProtectedMethod(int n, int xoffset = 0, int yoffset = 0) {}
|
virtual void OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0) {}
|
||||||
|
virtual void OverloadedProtectedMethod() {}
|
||||||
|
};
|
||||||
|
|
||||||
|
class DAbstractIgnores
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual ~DAbstractIgnores() {}
|
||||||
|
virtual double OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
|
||||||
|
virtual double OverloadedMethod(bool b) = 0;
|
||||||
|
virtual int Quadruple(int n) { return n*4; }
|
||||||
|
virtual int& References(int& n) { static int nn; nn=n; return nn; }
|
||||||
|
virtual int* Pointers(int* n) { static int nn; nn=*n; return &nn; }
|
||||||
|
protected:
|
||||||
|
virtual double OverloadedProtectedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
|
||||||
|
virtual double OverloadedProtectedMethod() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DIgnoreConstructor
|
class DIgnoreConstructor
|
||||||
|
|
@ -37,16 +59,5 @@ class DIgnoreOnlyConstructor
|
||||||
DIgnoreOnlyConstructor(bool b) {}
|
DIgnoreOnlyConstructor(bool b) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
|
||||||
class DAbstractIgnores
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual ~DAbstractIgnores() {}
|
|
||||||
virtual void OverloadedMethod(int n, int xoffset = 0, int yoffset = 0) = 0;
|
|
||||||
virtual void OverloadedMethod(bool b) = 0;
|
|
||||||
};
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
|
||||||
40
SWIG/Examples/test-suite/java/director_ignore_runme.java
Executable file
40
SWIG/Examples/test-suite/java/director_ignore_runme.java
Executable file
|
|
@ -0,0 +1,40 @@
|
||||||
|
import director_ignore.*;
|
||||||
|
|
||||||
|
public class director_ignore_runme {
|
||||||
|
static {
|
||||||
|
try {
|
||||||
|
System.loadLibrary("director_ignore");
|
||||||
|
} catch (UnsatisfiedLinkError e) {
|
||||||
|
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String argv[])
|
||||||
|
{
|
||||||
|
// Just check the classes can be instantiated and other methods work as expected
|
||||||
|
DIgnoresDerived a = new DIgnoresDerived();
|
||||||
|
if (a.Triple(5) != 15)
|
||||||
|
throw new RuntimeException("Triple failed");
|
||||||
|
DAbstractIgnoresDerived b = new DAbstractIgnoresDerived();
|
||||||
|
if (b.Quadruple(5) != 20)
|
||||||
|
throw new RuntimeException("Quadruple failed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DIgnoresDerived extends DIgnores
|
||||||
|
{
|
||||||
|
public DIgnoresDerived()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class DAbstractIgnoresDerived extends DAbstractIgnores
|
||||||
|
{
|
||||||
|
public DAbstractIgnoresDerived()
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -26,6 +26,10 @@ namespace std {
|
||||||
template<class K, class T> class map {
|
template<class K, class T> class map {
|
||||||
// add typemaps here
|
// add typemaps here
|
||||||
public:
|
public:
|
||||||
|
typedef size_t size_type;
|
||||||
|
typedef ptrdiff_t difference_type;
|
||||||
|
typedef K key_type;
|
||||||
|
typedef T mapped_type;
|
||||||
map();
|
map();
|
||||||
map(const map<K,T> &);
|
map(const map<K,T> &);
|
||||||
|
|
||||||
|
|
@ -33,7 +37,7 @@ namespace std {
|
||||||
bool empty() const;
|
bool empty() const;
|
||||||
void clear();
|
void clear();
|
||||||
%extend {
|
%extend {
|
||||||
T& get(const K& key) throw (std::out_of_range) {
|
const T& get(const K& key) throw (std::out_of_range) {
|
||||||
std::map<K,T >::iterator i = self->find(key);
|
std::map<K,T >::iterator i = self->find(key);
|
||||||
if (i != self->end())
|
if (i != self->end())
|
||||||
return i->second;
|
return i->second;
|
||||||
|
|
|
||||||
|
|
@ -586,6 +586,8 @@ class CSHARP : public Language {
|
||||||
Hash *new_udata;
|
Hash *new_udata;
|
||||||
String *key = NewStringf("%s|%s", imclass_method, decl);
|
String *key = NewStringf("%s|%s", imclass_method, decl);
|
||||||
|
|
||||||
|
++curr_class_dmethod;
|
||||||
|
|
||||||
/* Do we know about this director class already? */
|
/* Do we know about this director class already? */
|
||||||
if ((udata = Getattr(dmethods_table, key))) {
|
if ((udata = Getattr(dmethods_table, key))) {
|
||||||
Delete(key);
|
Delete(key);
|
||||||
|
|
@ -2989,7 +2991,7 @@ class CSHARP : public Language {
|
||||||
String *callback_code = NewString("");
|
String *callback_code = NewString("");
|
||||||
String *imcall_args = NewString("");
|
String *imcall_args = NewString("");
|
||||||
int gencomma = 0;
|
int gencomma = 0;
|
||||||
|
bool ignored_method = GetFlag(n, "feature:ignore") ? true : false;
|
||||||
|
|
||||||
// Kludge Alert: functionWrapper sets sym:overload properly, but it
|
// Kludge Alert: functionWrapper sets sym:overload properly, but it
|
||||||
// isn't at this point, so we have to manufacture it ourselves. At least
|
// isn't at this point, so we have to manufacture it ourselves. At least
|
||||||
|
|
@ -3005,9 +3007,10 @@ class CSHARP : public Language {
|
||||||
c_classname = classname;
|
c_classname = classname;
|
||||||
|
|
||||||
if (returntype) {
|
if (returntype) {
|
||||||
if (!is_void) {
|
|
||||||
|
|
||||||
qualified_return = SwigType_rcaststr(returntype, "result");
|
qualified_return = SwigType_rcaststr(returntype, "result");
|
||||||
|
|
||||||
|
if (!is_void && !ignored_method) {
|
||||||
if (!SwigType_isclass(returntype)) {
|
if (!SwigType_isclass(returntype)) {
|
||||||
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
Wrapper_add_localv(w, "result", SwigType_lstr(returntype, "result"), NIL);
|
Wrapper_add_localv(w, "result", SwigType_lstr(returntype, "result"), NIL);
|
||||||
|
|
@ -3051,6 +3054,7 @@ class CSHARP : public Language {
|
||||||
Delete(vt);
|
Delete(vt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the intermediate class wrapper */
|
/* Create the intermediate class wrapper */
|
||||||
Parm *tp = NewParmFromNode(returntype, empty_str, n);
|
Parm *tp = NewParmFromNode(returntype, empty_str, n);
|
||||||
|
|
@ -3061,28 +3065,22 @@ class CSHARP : public Language {
|
||||||
if (imtypeout)
|
if (imtypeout)
|
||||||
tm = imtypeout;
|
tm = imtypeout;
|
||||||
Printf(callback_def, " private %s SwigDirector%s(", tm, symname);
|
Printf(callback_def, " private %s SwigDirector%s(", tm, symname);
|
||||||
|
if (!ignored_method)
|
||||||
Printf(director_delegate_definitions, " public delegate %s", tm);
|
Printf(director_delegate_definitions, " public delegate %s", tm);
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number,
|
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number,
|
||||||
"No imtype typemap defined for %s\n", SwigType_str(returntype,0));
|
"No imtype typemap defined for %s\n", SwigType_str(returntype,0));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
Printf(callback_def, " private void SwigDirector%s(", symname);
|
|
||||||
Printf(director_delegate_definitions, " public delegate void");
|
|
||||||
}
|
|
||||||
|
|
||||||
Parm *retpm = NewParmFromNode(returntype, empty_str, n);
|
Parm *retpm = NewParmFromNode(returntype, empty_str, n);
|
||||||
|
|
||||||
if ((c_ret_type = Swig_typemap_lookup_new("ctype", retpm, "", 0))) {
|
if ((c_ret_type = Swig_typemap_lookup_new("ctype", retpm, "", 0))) {
|
||||||
|
|
||||||
if (!is_void) {
|
if (!is_void && !ignored_method) {
|
||||||
String *jretval_decl = NewStringf("%s jresult", c_ret_type);
|
String *jretval_decl = NewStringf("%s jresult", c_ret_type);
|
||||||
Wrapper_add_localv(w, "jresult", jretval_decl, " = 0", NIL);
|
Wrapper_add_localv(w, "jresult", jretval_decl, " = 0", NIL);
|
||||||
Delete(jretval_decl);
|
Delete(jretval_decl);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(director_callback_typedefs, " typedef %s", c_ret_type);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number,
|
Swig_warning(WARN_CSHARP_TYPEMAP_CTYPE_UNDEF, input_file, line_number,
|
||||||
"No ctype typemap defined for %s\n", SwigType_str(returntype,0));
|
"No ctype typemap defined for %s\n", SwigType_str(returntype,0));
|
||||||
|
|
@ -3115,7 +3113,7 @@ class CSHARP : public Language {
|
||||||
Swig_typemap_attach_parms("csdirectorin", l, 0);
|
Swig_typemap_attach_parms("csdirectorin", l, 0);
|
||||||
|
|
||||||
/* Preamble code */
|
/* Preamble code */
|
||||||
|
if (!ignored_method)
|
||||||
Printf(w->code, "if (!swig_callback%s) {\n", overloaded_name);
|
Printf(w->code, "if (!swig_callback%s) {\n", overloaded_name);
|
||||||
|
|
||||||
if (!pure_virtual) {
|
if (!pure_virtual) {
|
||||||
|
|
@ -3129,15 +3127,9 @@ class CSHARP : public Language {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Printf(w->code, " throw Swig::DirectorPureVirtualException(\"%s::%s\");\n", c_classname, name);
|
Printf(w->code, " throw Swig::DirectorPureVirtualException(\"%s::%s\");\n", c_classname, name);
|
||||||
|
|
||||||
/* Make sure that we return something in the case of a pure
|
|
||||||
* virtual method call for syntactical reasons. */
|
|
||||||
if (!is_void)
|
|
||||||
Printf(w->code, "return %s;", qualified_return);
|
|
||||||
else
|
|
||||||
Printf(w->code, "return;\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ignored_method)
|
||||||
Printf(w->code, "} else {\n");
|
Printf(w->code, "} else {\n");
|
||||||
|
|
||||||
/* Go through argument list, convert from native to Java */
|
/* Go through argument list, convert from native to Java */
|
||||||
|
|
@ -3175,6 +3167,7 @@ class CSHARP : public Language {
|
||||||
|
|
||||||
/* Add to local variables */
|
/* Add to local variables */
|
||||||
Printf(c_decl, "%s %s", c_param_type, arg);
|
Printf(c_decl, "%s %s", c_param_type, arg);
|
||||||
|
if (!ignored_method)
|
||||||
Wrapper_add_localv(w, arg, c_decl, (!(SwigType_ispointer(pt) || SwigType_isreference(pt)) ? "" : "= 0"), NIL);
|
Wrapper_add_localv(w, arg, c_decl, (!(SwigType_ispointer(pt) || SwigType_isreference(pt)) ? "" : "= 0"), NIL);
|
||||||
|
|
||||||
/* Add input marshalling code */
|
/* Add input marshalling code */
|
||||||
|
|
@ -3184,6 +3177,7 @@ class CSHARP : public Language {
|
||||||
Replaceall(tm,"$input", arg);
|
Replaceall(tm,"$input", arg);
|
||||||
|
|
||||||
if (Len(tm))
|
if (Len(tm))
|
||||||
|
if (!ignored_method)
|
||||||
Printf(w->code,"%s\n", tm);
|
Printf(w->code,"%s\n", tm);
|
||||||
|
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
|
|
@ -3348,10 +3342,7 @@ class CSHARP : public Language {
|
||||||
Printf(callback_code, " }\n");
|
Printf(callback_code, " }\n");
|
||||||
Delete(upcall);
|
Delete(upcall);
|
||||||
|
|
||||||
/* Emit the actual upcall through */
|
if (!ignored_method) {
|
||||||
UpcallData *udata = addUpcallMethod(imclass_dmethod, symname, decl, overloaded_name);
|
|
||||||
String *methid = Getattr(udata, "class_methodidx");
|
|
||||||
|
|
||||||
if (!is_void) Printf(w->code, "jresult = (%s) ", c_ret_type);
|
if (!is_void) Printf(w->code, "jresult = (%s) ", c_ret_type);
|
||||||
|
|
||||||
Printf(w->code, "swig_callback%s(%s);\n",
|
Printf(w->code, "swig_callback%s(%s);\n",
|
||||||
|
|
@ -3381,11 +3372,11 @@ class CSHARP : public Language {
|
||||||
Delete(result_str);
|
Delete(result_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Terminate wrapper code */
|
/* Terminate wrapper code */
|
||||||
Printf(w->code, "}\n");
|
Printf(w->code, "}\n");
|
||||||
if (!is_void)
|
if (!is_void)
|
||||||
Printf(w->code, "return %s;", qualified_return);
|
Printf(w->code, "return %s;", qualified_return);
|
||||||
|
}
|
||||||
|
|
||||||
Printf(w->code, "}");
|
Printf(w->code, "}");
|
||||||
|
|
||||||
|
|
@ -3412,6 +3403,7 @@ class CSHARP : public Language {
|
||||||
} else {
|
} else {
|
||||||
Replaceall(w->code,"$null","");
|
Replaceall(w->code,"$null","");
|
||||||
}
|
}
|
||||||
|
if (!ignored_method)
|
||||||
Printv(director_delegate_callback, "\n", callback_def, callback_code, NIL);
|
Printv(director_delegate_callback, "\n", callback_def, callback_code, NIL);
|
||||||
if (!Getattr(n,"defaultargs")) {
|
if (!Getattr(n,"defaultargs")) {
|
||||||
Wrapper_print(w, f_directors);
|
Wrapper_print(w, f_directors);
|
||||||
|
|
@ -3420,7 +3412,12 @@ class CSHARP : public Language {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(director_callback_typedefs, " (SWIGSTDCALL* SWIG_Callback%s_t)(", methid);
|
if (!ignored_method) {
|
||||||
|
/* Emit the actual upcall through */
|
||||||
|
UpcallData *udata = addUpcallMethod(imclass_dmethod, symname, decl, overloaded_name);
|
||||||
|
String *methid = Getattr(udata, "class_methodidx");
|
||||||
|
|
||||||
|
Printf(director_callback_typedefs, " typedef %s (SWIGSTDCALL* SWIG_Callback%s_t)(", c_ret_type, methid);
|
||||||
Printf(director_callback_typedefs, "%s);\n", callback_typedef_parms);
|
Printf(director_callback_typedefs, "%s);\n", callback_typedef_parms);
|
||||||
Printf(director_callbacks, " SWIG_Callback%s_t swig_callback%s;\n", methid, overloaded_name);
|
Printf(director_callbacks, " SWIG_Callback%s_t swig_callback%s;\n", methid, overloaded_name);
|
||||||
|
|
||||||
|
|
@ -3428,6 +3425,7 @@ class CSHARP : public Language {
|
||||||
Printf(director_delegate_instances, " private SwigDelegate%s_%s swigDelegate%s;\n", classname, methid, methid);
|
Printf(director_delegate_instances, " private SwigDelegate%s_%s swigDelegate%s;\n", classname, methid, methid);
|
||||||
Printf(director_method_types, " private static Type[] swigMethodTypes%s = new Type[] { %s };\n", methid, proxy_method_types);
|
Printf(director_method_types, " private static Type[] swigMethodTypes%s = new Type[] { %s };\n", methid, proxy_method_types);
|
||||||
Printf(director_connect_parms, "SwigDirector%s%s delegate%s", classname, methid, methid);
|
Printf(director_connect_parms, "SwigDirector%s%s delegate%s", classname, methid, methid);
|
||||||
|
}
|
||||||
|
|
||||||
Delete(qualified_return);
|
Delete(qualified_return);
|
||||||
Delete(c_ret_type);
|
Delete(c_ret_type);
|
||||||
|
|
@ -3439,7 +3437,6 @@ class CSHARP : public Language {
|
||||||
Delete(callback_code);
|
Delete(callback_code);
|
||||||
DelWrapper(w);
|
DelWrapper(w);
|
||||||
|
|
||||||
++curr_class_dmethod;
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -643,6 +643,8 @@ class JAVA : public Language {
|
||||||
Hash *new_udata;
|
Hash *new_udata;
|
||||||
String *key = NewStringf("%s|%s", imclass_method, decl);
|
String *key = NewStringf("%s|%s", imclass_method, decl);
|
||||||
|
|
||||||
|
++curr_class_dmethod;
|
||||||
|
|
||||||
/* Do we know about this director class already? */
|
/* Do we know about this director class already? */
|
||||||
if ((udata = Getattr(dmethods_table, key))) {
|
if ((udata = Getattr(dmethods_table, key))) {
|
||||||
Delete(key);
|
Delete(key);
|
||||||
|
|
@ -3019,7 +3021,7 @@ class JAVA : public Language {
|
||||||
String *imcall_args = NewString("");
|
String *imcall_args = NewString("");
|
||||||
int gencomma = 0;
|
int gencomma = 0;
|
||||||
int classmeth_off = curr_class_dmethod - first_class_dmethod;
|
int classmeth_off = curr_class_dmethod - first_class_dmethod;
|
||||||
|
bool ignored_method = GetFlag(n, "feature:ignore") ? true : false;
|
||||||
|
|
||||||
// Kludge Alert: functionWrapper sets sym:overload properly, but it
|
// Kludge Alert: functionWrapper sets sym:overload properly, but it
|
||||||
// isn't at this point, so we have to manufacture it ourselves. At least
|
// isn't at this point, so we have to manufacture it ourselves. At least
|
||||||
|
|
@ -3035,9 +3037,10 @@ class JAVA : public Language {
|
||||||
c_classname = classname;
|
c_classname = classname;
|
||||||
|
|
||||||
if (returntype) {
|
if (returntype) {
|
||||||
if (!is_void) {
|
|
||||||
|
|
||||||
qualified_return = SwigType_rcaststr(returntype, "result");
|
qualified_return = SwigType_rcaststr(returntype, "result");
|
||||||
|
|
||||||
|
if (!is_void && (!ignored_method || pure_virtual)) {
|
||||||
if (!SwigType_isclass(returntype)) {
|
if (!SwigType_isclass(returntype)) {
|
||||||
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
if (!(SwigType_ispointer(returntype) || SwigType_isreference(returntype))) {
|
||||||
Wrapper_add_localv(w, "result", SwigType_lstr(returntype, "result"), NIL);
|
Wrapper_add_localv(w, "result", SwigType_lstr(returntype, "result"), NIL);
|
||||||
|
|
@ -3081,6 +3084,7 @@ class JAVA : public Language {
|
||||||
Delete(vt);
|
Delete(vt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Create the intermediate class wrapper */
|
/* Create the intermediate class wrapper */
|
||||||
Parm *tp = NewParmFromNode(returntype, empty_str, n);
|
Parm *tp = NewParmFromNode(returntype, empty_str, n);
|
||||||
|
|
@ -3092,8 +3096,6 @@ class JAVA : public Language {
|
||||||
Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number,
|
Swig_warning(WARN_JAVA_TYPEMAP_JTYPE_UNDEF, input_file, line_number,
|
||||||
"No jtype typemap defined for %s\n", SwigType_str(returntype,0));
|
"No jtype typemap defined for %s\n", SwigType_str(returntype,0));
|
||||||
}
|
}
|
||||||
} else
|
|
||||||
Printf(callback_def, " public static void %s(%s self", imclass_dmethod, classname);
|
|
||||||
|
|
||||||
/* Get the JNI field descriptor for this return type, add the JNI field descriptor
|
/* Get the JNI field descriptor for this return type, add the JNI field descriptor
|
||||||
to jniret_desc */
|
to jniret_desc */
|
||||||
|
|
@ -3104,7 +3106,7 @@ class JAVA : public Language {
|
||||||
String *jdesc;
|
String *jdesc;
|
||||||
Parm *tp = NewParmFromNode(c_ret_type, empty_str, n);
|
Parm *tp = NewParmFromNode(c_ret_type, empty_str, n);
|
||||||
|
|
||||||
if (!is_void) {
|
if (!is_void && !ignored_method) {
|
||||||
String *jretval_decl = NewStringf("%s jresult", c_ret_type);
|
String *jretval_decl = NewStringf("%s jresult", c_ret_type);
|
||||||
Wrapper_add_localv(w, "jresult", jretval_decl, " = 0", NIL);
|
Wrapper_add_localv(w, "jresult", jretval_decl, " = 0", NIL);
|
||||||
Delete(jretval_decl);
|
Delete(jretval_decl);
|
||||||
|
|
@ -3177,6 +3179,7 @@ class JAVA : public Language {
|
||||||
Swig_typemap_attach_parms("directorin", l, 0);
|
Swig_typemap_attach_parms("directorin", l, 0);
|
||||||
Swig_typemap_attach_parms("javadirectorin", l, 0);
|
Swig_typemap_attach_parms("javadirectorin", l, 0);
|
||||||
|
|
||||||
|
if (!ignored_method) {
|
||||||
/* Add Java environment pointer to wrapper */
|
/* Add Java environment pointer to wrapper */
|
||||||
String *jenvstr = NewString("jenv");
|
String *jenvstr = NewString("jenv");
|
||||||
String *jobjstr = NewString("jobj");
|
String *jobjstr = NewString("jobj");
|
||||||
|
|
@ -3188,8 +3191,8 @@ class JAVA : public Language {
|
||||||
Delete(jobjstr);
|
Delete(jobjstr);
|
||||||
|
|
||||||
/* Preamble code */
|
/* Preamble code */
|
||||||
|
|
||||||
Printf(w->code, "if (!swig_override[%d]) {\n", classmeth_off);
|
Printf(w->code, "if (!swig_override[%d]) {\n", classmeth_off);
|
||||||
|
}
|
||||||
|
|
||||||
if (!pure_virtual) {
|
if (!pure_virtual) {
|
||||||
if (is_void) {
|
if (is_void) {
|
||||||
|
|
@ -3201,9 +3204,8 @@ class JAVA : public Language {
|
||||||
Delete(super_call);
|
Delete(super_call);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Printf(w->code, "SWIG_JavaThrowException(jenv, SWIG_JavaDirectorPureVirtual,\n");
|
Printf(w->code, "SWIG_JavaThrowException(JNIEnvWrapper(this).getJNIEnv(), SWIG_JavaDirectorPureVirtual, ");
|
||||||
Printf(w->code, " \"Attempted to invoke pure virtual method %s::%s.\");\n",
|
Printf(w->code, "\"Attempted to invoke pure virtual method %s::%s.\");\n", c_classname, name);
|
||||||
c_classname, name);
|
|
||||||
|
|
||||||
/* Make sure that we return something in the case of a pure
|
/* Make sure that we return something in the case of a pure
|
||||||
* virtual method call for syntactical reasons. */
|
* virtual method call for syntactical reasons. */
|
||||||
|
|
@ -3213,9 +3215,11 @@ class JAVA : public Language {
|
||||||
Printf(w->code, "return;\n");
|
Printf(w->code, "return;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ignored_method) {
|
||||||
Printf(w->code, "}\n");
|
Printf(w->code, "}\n");
|
||||||
Printf(w->code, "jobj = swig_get_self(jenv);\n");
|
Printf(w->code, "jobj = swig_get_self(jenv);\n");
|
||||||
Printf(w->code, "if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) {\n");
|
Printf(w->code, "if (jobj && jenv->IsSameObject(jobj, NULL) == JNI_FALSE) {\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Start the Java field descriptor for the intermediate class's upcall (insert self object) */
|
/* Start the Java field descriptor for the intermediate class's upcall (insert self object) */
|
||||||
Parm *tp = NewParmFromNode(c_classname, empty_str, n);
|
Parm *tp = NewParmFromNode(c_classname, empty_str, n);
|
||||||
|
|
@ -3266,6 +3270,7 @@ class JAVA : public Language {
|
||||||
|
|
||||||
/* Add to local variables */
|
/* Add to local variables */
|
||||||
Printf(c_decl, "%s %s", c_param_type, arg);
|
Printf(c_decl, "%s %s", c_param_type, arg);
|
||||||
|
if (!ignored_method)
|
||||||
Wrapper_add_localv(w, arg, c_decl, (!(SwigType_ispointer(pt) || SwigType_isreference(pt)) ? "" : "= 0"), NIL);
|
Wrapper_add_localv(w, arg, c_decl, (!(SwigType_ispointer(pt) || SwigType_isreference(pt)) ? "" : "= 0"), NIL);
|
||||||
|
|
||||||
/* Add input marshalling code and update JNI field descriptor */
|
/* Add input marshalling code and update JNI field descriptor */
|
||||||
|
|
@ -3282,6 +3287,7 @@ class JAVA : public Language {
|
||||||
Replaceall(tm,"$input", arg);
|
Replaceall(tm,"$input", arg);
|
||||||
|
|
||||||
if (Len(tm))
|
if (Len(tm))
|
||||||
|
if (!ignored_method)
|
||||||
Printf(w->code,"%s\n", tm);
|
Printf(w->code,"%s\n", tm);
|
||||||
|
|
||||||
Delete(tm);
|
Delete(tm);
|
||||||
|
|
@ -3437,6 +3443,7 @@ class JAVA : public Language {
|
||||||
Printf(callback_code, " }\n");
|
Printf(callback_code, " }\n");
|
||||||
Delete(upcall);
|
Delete(upcall);
|
||||||
|
|
||||||
|
if (!ignored_method) {
|
||||||
/* Emit the actual upcall through */
|
/* Emit the actual upcall through */
|
||||||
String *imclass_desc = NewStringf("(%s)%s", jnidesc, jniret_desc);
|
String *imclass_desc = NewStringf("(%s)%s", jnidesc, jniret_desc);
|
||||||
String *class_desc = NewStringf("(%s)%s", classdesc, classret_desc);
|
String *class_desc = NewStringf("(%s)%s", classdesc, classret_desc);
|
||||||
|
|
@ -3487,6 +3494,7 @@ class JAVA : public Language {
|
||||||
|
|
||||||
if (!is_void)
|
if (!is_void)
|
||||||
Printf(w->code, "return %s;", qualified_return);
|
Printf(w->code, "return %s;", qualified_return);
|
||||||
|
}
|
||||||
|
|
||||||
Printf(w->code, "}");
|
Printf(w->code, "}");
|
||||||
|
|
||||||
|
|
@ -3513,6 +3521,7 @@ class JAVA : public Language {
|
||||||
} else {
|
} else {
|
||||||
Replaceall(w->code,"$null","");
|
Replaceall(w->code,"$null","");
|
||||||
}
|
}
|
||||||
|
if (!GetFlag(n, "feature:ignore"))
|
||||||
Printv(imclass_directors, callback_def, callback_code, NIL);
|
Printv(imclass_directors, callback_def, callback_code, NIL);
|
||||||
if (!Getattr(n,"defaultargs")) {
|
if (!Getattr(n,"defaultargs")) {
|
||||||
Wrapper_print(w, f_directors);
|
Wrapper_print(w, f_directors);
|
||||||
|
|
@ -3531,7 +3540,6 @@ class JAVA : public Language {
|
||||||
Delete(callback_code);
|
Delete(callback_code);
|
||||||
DelWrapper(w);
|
DelWrapper(w);
|
||||||
|
|
||||||
++curr_class_dmethod;
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1954,8 +1954,8 @@ int Language::classDirectorMethods(Node *n) {
|
||||||
item = k.item;
|
item = k.item;
|
||||||
String *method = Getattr(item, "methodNode");
|
String *method = Getattr(item, "methodNode");
|
||||||
String *fqdname = Getattr(item, "fqdname");
|
String *fqdname = Getattr(item, "fqdname");
|
||||||
if (GetFlag(method,"feature:ignore"))
|
// if (GetFlag(method,"feature:ignore"))
|
||||||
continue;
|
// continue;
|
||||||
if (GetFlag(method, "feature:nodirector"))
|
if (GetFlag(method, "feature:nodirector"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue