6
// This SWIG library file provides language independent exception handling
9
%section "Exception Handling Library",info,after,pre,nosort,skip=1,chop_left=3,chop_right=0,chop_top=0,chop_bottom=0
14
This library provides language independent support for raising scripting
15
language exceptions in SWIG generated wrapper code. Normally, this is
16
used in conjunction with the %except directive.
18
To raise an exception, use the following function call :
20
SWIG_exception(int exctype, char *msg);
22
'exctype' is an exception type code and may be one of the following :
36
'msg' is an error string that should be reported to the user.
38
The library is normally used in conjunction with the %except directive
45
SWIG_exception(SWIG_IndexError,"Array index out of bounds");
47
SWIG_exception(SWIG_UnknownError,"Uncaught exception");
51
It is important to note that the SWIG_exception() function is only available
52
to the C code generated by SWIG. It is not available in the scripting language
59
#define SWIG_MemoryError 1
60
#define SWIG_IOError 2
61
#define SWIG_RuntimeError 3
62
#define SWIG_IndexError 4
63
#define SWIG_TypeError 5
64
#define SWIG_DivisionByZero 6
65
#define SWIG_OverflowError 7
66
#define SWIG_SyntaxError 8
67
#define SWIG_ValueError 9
68
#define SWIG_SystemError 10
69
#define SWIG_UnknownError 99
74
#define SWIG_exception(a,b) { Tcl_SetResult(interp,b,TCL_VOLATILE); return TCL_ERROR; }
79
#define SWIG_exception(a,b) { Tcl_SetResult(interp,b,TCL_VOLATILE); return TCL_ERROR; }
86
#define SWIG_exception(a,b) croak(b)
92
#define SWIG_exception(a,b) fatal(b)
98
static void _SWIG_exception(int code, char *msg) {
100
case SWIG_MemoryError:
101
PyErr_SetString(PyExc_MemoryError,msg);
104
PyErr_SetString(PyExc_IOError,msg);
106
case SWIG_RuntimeError:
107
PyErr_SetString(PyExc_RuntimeError,msg);
109
case SWIG_IndexError:
110
PyErr_SetString(PyExc_IndexError,msg);
113
PyErr_SetString(PyExc_TypeError,msg);
115
case SWIG_DivisionByZero:
116
PyErr_SetString(PyExc_ZeroDivisionError,msg);
118
case SWIG_OverflowError:
119
PyErr_SetString(PyExc_OverflowError,msg);
121
case SWIG_SyntaxError:
122
PyErr_SetString(PyExc_SyntaxError,msg);
124
case SWIG_ValueError:
125
PyErr_SetString(PyExc_ValueError,msg);
127
case SWIG_SystemError:
128
PyErr_SetString(PyExc_SystemError,msg);
131
PyErr_SetString(PyExc_RuntimeError,msg);
136
#define SWIG_exception(a,b) { _SWIG_exception(a,b); return NULL; }
142
static void _SWIG_exception (int code, const char *msg,
144
#define ERROR(scmerr) \
145
scm_error(gh_symbol2scm((char *) (scmerr)), \
146
(char *) subr, (char *) msg, \
148
#define MAP(swigerr, scmerr) \
153
MAP(SWIG_MemoryError, "swig-memory-error");
154
MAP(SWIG_IOError, "swig-io-error");
155
MAP(SWIG_RuntimeError, "swig-runtime-error");
156
MAP(SWIG_IndexError, "swig-index-error");
157
MAP(SWIG_TypeError, "swig-type-error");
158
MAP(SWIG_DivisionByZero, "swig-division-by-zero");
159
MAP(SWIG_OverflowError, "swig-overflow-error");
160
MAP(SWIG_SyntaxError, "swig-syntax-error");
161
MAP(SWIG_ValueError, "swig-value-error");
162
MAP(SWIG_SystemError, "swig-system-error");
170
#define SWIG_exception(a,b) _SWIG_exception(a, b, FUNC_NAME)
177
static void _SWIG_exception (int code, const char *msg) {
178
#define ERROR(errname) \
179
scheme_signal_error(errname " (%s)", msg);
180
#define MAP(swigerr, errname) \
185
MAP(SWIG_MemoryError, "swig-memory-error");
186
MAP(SWIG_IOError, "swig-io-error");
187
MAP(SWIG_RuntimeError, "swig-runtime-error");
188
MAP(SWIG_IndexError, "swig-index-error");
189
MAP(SWIG_TypeError, "swig-type-error");
190
MAP(SWIG_DivisionByZero, "swig-division-by-zero");
191
MAP(SWIG_OverflowError, "swig-overflow-error");
192
MAP(SWIG_SyntaxError, "swig-syntax-error");
193
MAP(SWIG_ValueError, "swig-value-error");
194
MAP(SWIG_SystemError, "swig-system-error");
202
#define SWIG_exception(a,b) _SWIG_exception(a, b)
208
static void SWIG_JavaException(JNIEnv *jenv, int code, const char *msg) {
209
SWIG_JavaExceptionCodes exception_code = SWIG_JavaUnknownError;
211
case SWIG_MemoryError:
212
exception_code = SWIG_JavaOutOfMemoryError;
215
exception_code = SWIG_JavaIOException;
217
case SWIG_SystemError:
218
case SWIG_RuntimeError:
219
exception_code = SWIG_JavaRuntimeException;
221
case SWIG_OverflowError:
222
case SWIG_IndexError:
223
exception_code = SWIG_JavaIndexOutOfBoundsException;
225
case SWIG_DivisionByZero:
226
exception_code = SWIG_JavaArithmeticException;
228
case SWIG_SyntaxError:
229
case SWIG_ValueError:
231
exception_code = SWIG_JavaIllegalArgumentException;
233
case SWIG_UnknownError:
235
exception_code = SWIG_JavaUnknownError;
238
SWIG_JavaThrowException(jenv, exception_code, msg);
240
#define SWIG_exception(code, msg) { SWIG_JavaException(jenv, code, msg); }
244
/* exception.i ends here */