diff options
author | Simon Marchetto <simon.marchetto@scilab-enterprises.com> | 2016-10-05 12:00:20 +0200 |
---|---|---|
committer | Simon Marchetto <simon.marchetto@scilab-enterprises.com> | 2016-10-05 14:09:08 +0200 |
commit | 36156a229574a0f8239b1351e70064aad65b1691 (patch) | |
tree | f5693e87f9c3eb92067c604d84fa682e696aee52 /Lib/scilab | |
parent | 08e32e794c992459f6429b3e6af8d75e1aab0d89 (diff) | |
download | swig-36156a229574a0f8239b1351e70064aad65b1691.tar.gz |
scilab: clean runtime code (move error functions..)
Diffstat (limited to 'Lib/scilab')
-rw-r--r-- | Lib/scilab/scirun.swg | 127 | ||||
-rw-r--r-- | Lib/scilab/sciruntime.swg | 14 |
2 files changed, 70 insertions, 71 deletions
diff --git a/Lib/scilab/scirun.swg b/Lib/scilab/scirun.swg index 3b8289199..e9766ca8f 100644 --- a/Lib/scilab/scirun.swg +++ b/Lib/scilab/scirun.swg @@ -100,6 +100,69 @@ SWIG_Scilab_SetOutput(void *pvApiCtx, SwigSciObject output) { return SWIG_OK; } +/* Error functions */ + +#define SCILAB_API_ARGUMENT_ERROR 999 + +SWIGINTERN const char* +SWIG_Scilab_ErrorType(int code) { + switch(code) { + case SWIG_MemoryError: + return "MemoryError"; + case SWIG_IOError: + return "IOError"; + case SWIG_RuntimeError: + return "RuntimeError"; + case SWIG_IndexError: + return "IndexError"; + case SWIG_TypeError: + return "TypeError"; + case SWIG_DivisionByZero: + return "ZeroDivisionError"; + case SWIG_OverflowError: + return "OverflowError"; + case SWIG_SyntaxError: + return "SyntaxError"; + case SWIG_ValueError: + return "ValueError"; + case SWIG_SystemError: + return "SystemError"; + case SWIG_AttributeError: + return "AttributeError"; + default: + return "RuntimeError"; + } +} +#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code) + +#ifndef SWIG_SCILAB_ERROR +#define SWIG_SCILAB_ERROR 20000 +#endif + +SWIGINTERN void +SWIG_Scilab_Error(int code, const char *msg) { + Scierror(SWIG_SCILAB_ERROR - code, _("SWIG/Scilab: %s: %s\n"), SWIG_Scilab_ErrorType(code), msg); +} + +#define SWIG_Error(code, msg) SWIG_Scilab_Error(code, msg) + +#define SWIG_fail return SWIG_ERROR; + +SWIGRUNTIME void +SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) { + if (type) { + if (obj) + Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured: %s\n", type, obj); + else + Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type); + } +} + +SWIGRUNTIME void +SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) { + Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type); +} + /* Pointer conversion functions */ SWIGINTERN int @@ -245,7 +308,7 @@ SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info } if (pstTypeName == NULL) { - pstTypeName = SWIG_TypeName(descriptor); + pstTypeName = SWIG_TypeName(descriptor); } sciErr = createMatrixOfStringInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 1, 1, 1, &pstTypeName); @@ -344,69 +407,7 @@ SWIG_Scilab_NewMemberObj(void *pvApiCtx, int iVarOut, void *ptr, int sz, swig_ty } -/* Error functions */ - -#define SCILAB_API_ARGUMENT_ERROR 999 -SWIGINTERN const char* -SWIG_Scilab_ErrorType(int code) { - switch(code) { - case SWIG_MemoryError: - return "MemoryError"; - case SWIG_IOError: - return "IOError"; - case SWIG_RuntimeError: - return "RuntimeError"; - case SWIG_IndexError: - return "IndexError"; - case SWIG_TypeError: - return "TypeError"; - case SWIG_DivisionByZero: - return "ZeroDivisionError"; - case SWIG_OverflowError: - return "OverflowError"; - case SWIG_SyntaxError: - return "SyntaxError"; - case SWIG_ValueError: - return "ValueError"; - case SWIG_SystemError: - return "SystemError"; - case SWIG_AttributeError: - return "AttributeError"; - default: - return "RuntimeError"; - } -} -#define SWIG_ErrorType(code) SWIG_Scilab_ErrorType(code) - -#ifndef SWIG_SCILAB_ERROR -#define SWIG_SCILAB_ERROR 20000 -#endif - -SWIGINTERN void -SWIG_Scilab_Error(int code, const char *msg) -{ - Scierror(SWIG_SCILAB_ERROR - code, _("SWIG/Scilab: %s: %s\n"), SWIG_Scilab_ErrorType(code), msg); -} - -#define SWIG_Error(code, msg) SWIG_Scilab_Error(code, msg) - -#define SWIG_fail return SWIG_ERROR; - -SWIGRUNTIME void -SWIG_Scilab_Raise_Ex(const char *obj, const char *type, swig_type_info *descriptor) { - if (type) { - if (obj) - Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured: %s\n", type, obj); - else - Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type); - } -} - -SWIGRUNTIME void -SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) { - Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type); -} /* * Pointer utility functions diff --git a/Lib/scilab/sciruntime.swg b/Lib/scilab/sciruntime.swg index 9832ed411..cc9aad5f2 100644 --- a/Lib/scilab/sciruntime.swg +++ b/Lib/scilab/sciruntime.swg @@ -1,29 +1,27 @@ %insert(runtime) "swigrun.swg"; %insert(runtime) "swigerrors.swg"; -#define %scilabcode %insert("scilab") - %insert(runtime) "scirun.swg"; -%init %{ +%insert(init) %{ +/* Module management functions */ + #define SWIG_GetModule(clientdata) SWIG_Scilab_GetModule() #define SWIG_SetModule(clientdata, pointer) SWIG_Scilab_SetModule(pointer) SWIGRUNTIME swig_module_info* -SWIG_Scilab_GetModule(void) -{ +SWIG_Scilab_GetModule(void) { return NULL; } SWIGRUNTIME void -SWIG_Scilab_SetModule(swig_module_info *swig_module) -{ +SWIG_Scilab_SetModule(swig_module_info *swig_module) { } %} %insert(init) "swiginit.swg" -%init %{ +%insert(init) %{ #ifdef __cplusplus extern "C" #endif |