add patch 1025861 for director + exceptions, fix director + enums

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@6562 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2004-10-30 10:58:16 +00:00
commit a34970d9fc
3 changed files with 17 additions and 5 deletions

View file

@ -1,5 +1,11 @@
%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;
%rename(Hallo) EnumDirector::Hello;

View file

@ -5,9 +5,13 @@
/* --- Input typemaps --- */
%typemap(in) enum SWIGTYPE "$1 = ($1_ltype) NUM2INT($input);";
%typemap(directorout) enum SWIGTYPE "$result = NUM2INT($input);";
/* --- Output typemaps --- */
%typemap(out) enum SWIGTYPE "$result = INT2NUM($1);";
%typemap(directorin) enum SWIGTYPE "$input = INT2NUM($1);";
/* --- Variable Input --- */
%{

View file

@ -2012,9 +2012,9 @@ public:
if (argc > 0) {
Wrapper_add_localv(w, "i", "int", "i", NIL);
Printf(w->code, "args.argv = new VALUE[%d];\n", argc);
Printf(w->code, "for (i = 0; i < %d; i++) {\n", argc);
Printv(w->code, "args.argv[i] = Qnil;\n", NIL);
Printv(w->code, "}\n", NIL);
for (int i = 0; i < argc; i++) {
Printf(w->code, "args.argv[%d] = obj%d;\n", i, i);
}
} else {
Printv(w->code, "args.argv = 0;\n", NIL);
}
@ -2369,11 +2369,13 @@ public:
/* any existing helper functions to handle this? */
if (!is_void) {
String* rettype = SwigType_str(return_type, 0);
if (!SwigType_isreference(return_type)) {
Printf(w->code, "return c_result;\n");
Printf(w->code, "return (%s) c_result;\n", rettype);
} else {
Printf(w->code, "return *c_result;\n");
Printf(w->code, "return (%s) *c_result;\n", rettype);
}
Delete(rettype);
}
Printf(w->code, "}\n");