diff options
author | Simon Marchetto <simon.marchetto@scilab-enterprises.com> | 2016-10-05 13:58:49 +0200 |
---|---|---|
committer | Simon Marchetto <simon.marchetto@scilab-enterprises.com> | 2016-10-05 14:09:08 +0200 |
commit | 6b2caca8b9b1e9f8701e535007391b5afa24ce94 (patch) | |
tree | 3eb9cd41c481a67b19ee70c88961cb5d586ec7eb /Lib/scilab | |
parent | 36156a229574a0f8239b1351e70064aad65b1691 (diff) | |
download | swig-6b2caca8b9b1e9f8701e535007391b5afa24ce94.tar.gz |
scilab: add runtime function SWIG_Scilab_TypeQuery() checks runtime is initialized
Diffstat (limited to 'Lib/scilab')
-rw-r--r-- | Lib/scilab/scirun.swg | 12 | ||||
-rw-r--r-- | Lib/scilab/sciruntime.swg | 14 |
2 files changed, 26 insertions, 0 deletions
diff --git a/Lib/scilab/scirun.swg b/Lib/scilab/scirun.swg index e9766ca8f..ad3a7fa1f 100644 --- a/Lib/scilab/scirun.swg +++ b/Lib/scilab/scirun.swg @@ -163,8 +163,20 @@ SWIG_Scilab_Raise(const int obj, const char *type, swig_type_info *descriptor) { Scierror(SWIG_SCILAB_ERROR, "SWIG/Scilab: Exception (%s) occured.\n", type); } +/* Module initialization */ + +static int swig_module_initialized = 0; + +SWIGRUNTIME int +SWIG_Module_Initialized() { + return swig_module_initialized; +} + /* Pointer conversion functions */ +SWIGRUNTIME swig_type_info * +SWIG_Scilab_TypeQuery(const char *name); + SWIGINTERN int SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *fname) { SciErr sciErr; diff --git a/Lib/scilab/sciruntime.swg b/Lib/scilab/sciruntime.swg index cc9aad5f2..9abedfe3d 100644 --- a/Lib/scilab/sciruntime.swg +++ b/Lib/scilab/sciruntime.swg @@ -22,10 +22,24 @@ SWIG_Scilab_SetModule(swig_module_info *swig_module) { %insert(init) "swiginit.swg" %insert(init) %{ +SWIGRUNTIME swig_type_info * +SWIG_Scilab_TypeQuery(const char *name) { + if (SWIG_Module_Initialized()) { + return SWIG_TypeQuery(name); + } + else { + SWIG_Error(SWIG_RuntimeError, "the module is not initialized"); + return NULL; + } +} +%} + +%insert(init) %{ #ifdef __cplusplus extern "C" #endif int <module>_Init(SWIG_GatewayParameters) { SWIG_InitializeModule(NULL); SWIG_CreateScilabVariables(pvApiCtx); + swig_module_initialized = 1; %} |