Scilab: SWIG exception raise macro : rethrow exceptions

This commit is contained in:
Simon Marchetto 2013-06-19 09:35:42 +02:00
commit eddbb8f59e
2 changed files with 12 additions and 3 deletions

View file

@ -218,7 +218,16 @@ SWIG_Scilab_SetOutput(void *_pvApiCtx, SciObject _output) {
return SWIG_OK; return SWIG_OK;
} }
#define SwigScilabRaise(OBJ, TYPE, DESC) Scierror(999, "C++ side threw an exception of type %s.\n", TYPE) #define SWIG_Scilab_Raise(obj, type, desc) SwigScilabRaise(type)
SWIGRUNTIME int
SwigScilabRaise(const char *type) {
Scierror(999, "An exception of type %s has been thrown.\n", type);
#ifdef __cplusplus
throw;
#endif
}
%} %}
//%insert(init) "swiginit.swg" //%insert(init) "swiginit.swg"

View file

@ -12,7 +12,7 @@
#define %append_output(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR #define %append_output(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR
#define %set_constant(name, obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR // Name is managed by the the function name #define %set_constant(name, obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR // Name is managed by the the function name
#define %raise(obj, type, desc) SwigScilabRaise(obj, type, desc) #define %raise(obj, type, desc) SWIG_Scilab_Raise(obj, type, desc)
#define %set_output(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR #define %set_output(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR
#define %set_varoutput(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR #define %set_varoutput(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR
#define %set_argoutput(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR #define %set_argoutput(obj) if (!SWIG_IsOK(SWIG_Scilab_SetOutput(pvApiCtx, obj))) return SWIG_ERROR