scilab: add runtime function SWIG_Scilab_TypeQuery() checks runtime is initialized
This commit is contained in:
parent
36156a2295
commit
6b2caca8b9
2 changed files with 26 additions and 0 deletions
|
|
@ -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);
|
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 */
|
/* Pointer conversion functions */
|
||||||
|
|
||||||
|
SWIGRUNTIME swig_type_info *
|
||||||
|
SWIG_Scilab_TypeQuery(const char *name);
|
||||||
|
|
||||||
SWIGINTERN int
|
SWIGINTERN int
|
||||||
SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *fname) {
|
SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *fname) {
|
||||||
SciErr sciErr;
|
SciErr sciErr;
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,19 @@ SWIG_Scilab_SetModule(swig_module_info *swig_module) {
|
||||||
|
|
||||||
%insert(init) "swiginit.swg"
|
%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) %{
|
%insert(init) %{
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
|
@ -28,4 +41,5 @@ extern "C"
|
||||||
int <module>_Init(SWIG_GatewayParameters) {
|
int <module>_Init(SWIG_GatewayParameters) {
|
||||||
SWIG_InitializeModule(NULL);
|
SWIG_InitializeModule(NULL);
|
||||||
SWIG_CreateScilabVariables(pvApiCtx);
|
SWIG_CreateScilabVariables(pvApiCtx);
|
||||||
|
swig_module_initialized = 1;
|
||||||
%}
|
%}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue