diff --git a/Lib/exception.i b/Lib/exception.i index c13c0b74d..f89f277c4 100644 --- a/Lib/exception.i +++ b/Lib/exception.i @@ -138,9 +138,37 @@ static void _SWIG_exception(int code, char *msg) { #endif #ifdef SWIGGUILE -%echo %{ -exception.i : Guile not currently supported. +%{ + static void _SWIG_exception (int code, const char *msg, + const char *subr) { +#define ERROR(scmerr) \ + scm_error(gh_symbol2scm((char *) (scmerr)), \ + (char *) subr, (char *) msg, \ + SCM_EOL, SCM_BOOL_F) +#define MAP(swigerr, scmerr) \ + case swigerr: \ + ERROR(scmerr); \ + break + switch (code) { + MAP(SWIG_MemoryError, "swig-memory-error"); + MAP(SWIG_IOError, "swig-io-error"); + MAP(SWIG_RuntimeError, "swig-runtime-error"); + MAP(SWIG_IndexError, "swig-index-error"); + MAP(SWIG_TypeError, "swig-type-error"); + MAP(SWIG_DivisionByZero, "swig-division-by-zero"); + MAP(SWIG_OverflowError, "swig-overflow-error"); + MAP(SWIG_SyntaxError, "swig-syntax-error"); + MAP(SWIG_ValueError, "swig-value-error"); + MAP(SWIG_SystemError, "swig-system-error"); + default: + ERROR("swig-error"); + } +#undef ERROR +#undef MAP + } + +#define SWIG_exception(a,b) _SWIG_exception(a, b, SCHEME_NAME) %} #endif - +/* exception.i ends here */