From eddbb8f59e3e7190b9787476baca208b71478344 Mon Sep 17 00:00:00 2001 From: Simon Marchetto Date: Wed, 19 Jun 2013 09:35:42 +0200 Subject: [PATCH] Scilab: SWIG exception raise macro : rethrow exceptions --- Lib/scilab/sciruntime.swg | 13 +++++++++++-- Lib/scilab/scitypemaps.swg | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Lib/scilab/sciruntime.swg b/Lib/scilab/sciruntime.swg index 956a8094a..9b9d9b3d2 100644 --- a/Lib/scilab/sciruntime.swg +++ b/Lib/scilab/sciruntime.swg @@ -69,7 +69,7 @@ SWIG_Scilab_ErrorMsg(int code, const char *mesg) #define SWIG_fail return SWIG_ERROR; -#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code) +#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code) #define SWIG_Error(code, msg) SWIG_Scilab_ErrorMsg(code,msg) /* Used for C++ enums */ @@ -218,7 +218,16 @@ SWIG_Scilab_SetOutput(void *_pvApiCtx, SciObject _output) { 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" diff --git a/Lib/scilab/scitypemaps.swg b/Lib/scilab/scitypemaps.swg index 537bb43d5..657717cda 100644 --- a/Lib/scilab/scitypemaps.swg +++ b/Lib/scilab/scitypemaps.swg @@ -12,7 +12,7 @@ #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 %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_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