add patch 1025861 for director + exceptions, fix director + enums
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6562 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
33f768f33d
commit
c599db0cd6
3 changed files with 17 additions and 5 deletions
|
|
@ -1,5 +1,11 @@
|
||||||
%module(directors="1") director_enum
|
%module(directors="1") director_enum
|
||||||
|
|
||||||
|
%warnfilter(801) EnumDirector::hi; /* Ruby, wrong constant name */
|
||||||
|
%warnfilter(801) EnumDirector::hello; /* Ruby, wrong constant name */
|
||||||
|
%warnfilter(801) EnumDirector::yo; /* Ruby, wrong constant name */
|
||||||
|
%warnfilter(801) EnumDirector::awright; /* Ruby, wrong constant name */
|
||||||
|
|
||||||
|
|
||||||
%feature("director") Foo;
|
%feature("director") Foo;
|
||||||
|
|
||||||
%rename(Hallo) EnumDirector::Hello;
|
%rename(Hallo) EnumDirector::Hello;
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,13 @@
|
||||||
/* --- Input typemaps --- */
|
/* --- Input typemaps --- */
|
||||||
%typemap(in) enum SWIGTYPE "$1 = ($1_ltype) NUM2INT($input);";
|
%typemap(in) enum SWIGTYPE "$1 = ($1_ltype) NUM2INT($input);";
|
||||||
|
|
||||||
|
%typemap(directorout) enum SWIGTYPE "$result = NUM2INT($input);";
|
||||||
|
|
||||||
/* --- Output typemaps --- */
|
/* --- Output typemaps --- */
|
||||||
%typemap(out) enum SWIGTYPE "$result = INT2NUM($1);";
|
%typemap(out) enum SWIGTYPE "$result = INT2NUM($1);";
|
||||||
|
|
||||||
|
%typemap(directorin) enum SWIGTYPE "$input = INT2NUM($1);";
|
||||||
|
|
||||||
/* --- Variable Input --- */
|
/* --- Variable Input --- */
|
||||||
|
|
||||||
%{
|
%{
|
||||||
|
|
|
||||||
|
|
@ -2012,9 +2012,9 @@ public:
|
||||||
if (argc > 0) {
|
if (argc > 0) {
|
||||||
Wrapper_add_localv(w, "i", "int", "i", NIL);
|
Wrapper_add_localv(w, "i", "int", "i", NIL);
|
||||||
Printf(w->code, "args.argv = new VALUE[%d];\n", argc);
|
Printf(w->code, "args.argv = new VALUE[%d];\n", argc);
|
||||||
Printf(w->code, "for (i = 0; i < %d; i++) {\n", argc);
|
for (int i = 0; i < argc; i++) {
|
||||||
Printv(w->code, "args.argv[i] = Qnil;\n", NIL);
|
Printf(w->code, "args.argv[%d] = obj%d;\n", i, i);
|
||||||
Printv(w->code, "}\n", NIL);
|
}
|
||||||
} else {
|
} else {
|
||||||
Printv(w->code, "args.argv = 0;\n", NIL);
|
Printv(w->code, "args.argv = 0;\n", NIL);
|
||||||
}
|
}
|
||||||
|
|
@ -2369,11 +2369,13 @@ public:
|
||||||
|
|
||||||
/* any existing helper functions to handle this? */
|
/* any existing helper functions to handle this? */
|
||||||
if (!is_void) {
|
if (!is_void) {
|
||||||
|
String* rettype = SwigType_str(return_type, 0);
|
||||||
if (!SwigType_isreference(return_type)) {
|
if (!SwigType_isreference(return_type)) {
|
||||||
Printf(w->code, "return c_result;\n");
|
Printf(w->code, "return (%s) c_result;\n", rettype);
|
||||||
} else {
|
} else {
|
||||||
Printf(w->code, "return *c_result;\n");
|
Printf(w->code, "return (%s) *c_result;\n", rettype);
|
||||||
}
|
}
|
||||||
|
Delete(rettype);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(w->code, "}\n");
|
Printf(w->code, "}\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue