A little more work on the Ruby support for C++ polymorphism. Exception

handling almost works...


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4745 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Logan Johnson 2003-04-29 16:08:16 +00:00
commit 3fd12995c7
5 changed files with 161 additions and 59 deletions

View file

@ -13,13 +13,24 @@
#include <string>
struct swig_body_args
{
VALUE recv;
ID id;
int argc;
VALUE *argv;
};
/* Base class for director exceptions */
class SWIG_DIRECTOR_EXCEPTION {
protected:
std::string _msg;
VALUE _type;
protected:
SWIG_DIRECTOR_EXCEPTION(const char* msg="") : _type(rb_eRuntimeError) {}
public:
SWIG_DIRECTOR_EXCEPTION(const char* msg="") {}
const char *getMessage() const { return _msg.c_str(); }
VALUE getType() const { return _type; }
virtual ~SWIG_DIRECTOR_EXCEPTION() {}
};
@ -29,7 +40,7 @@ public:
SWIG_DIRECTOR_TYPE_MISMATCH(const char* msg="") {
_msg = "Swig director type mismatch: ";
_msg += msg;
// PyErr_SetString(PyExc_TypeError, msg); // FIXME
_type = rb_eTypeError;
}
};

View file

@ -7,9 +7,6 @@
%runtime "rubyhead.swg"
%runtime "common.swg"
/* Exception handling in wrappers */
/* #define SWIG_fail goto fail */
#ifdef SWIG_NOINCLUDE
%runtime "rubydec.swg"
#else