diff --git a/CHANGES.current b/CHANGES.current index a27b73de2..11f364f5c 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -5,6 +5,9 @@ See the RELEASENOTES file for a summary of changes in each release. Version 3.0.11 (in progress) ============================ +2016-09-26: smarchetto + [Scilab] mlists that map pointers can be given a custom type name. + 2016-09-25: wsfulton Patch #793 from q-p to expand exception handling to include std::bad_cast in std_except.i. diff --git a/Lib/scilab/scipointer.swg b/Lib/scilab/scipointer.swg index 8d0526d4d..94ca4ef37 100644 --- a/Lib/scilab/scipointer.swg +++ b/Lib/scilab/scipointer.swg @@ -6,7 +6,7 @@ } %fragment("SWIG_NewPointerObj", "header") { -#define SWIG_NewPointerObj(pointer, pointerDescriptor, flags) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, flags) +#define SWIG_NewPointerObj(pointer, pointerDescriptor, flags) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, flags, NULL) } /* @@ -17,7 +17,7 @@ } %fragment("SWIG_NewFunctionPtrObj", "header") { -#define SWIG_NewFunctionPtrObj(pointer, pointerDescriptor) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, 0) +#define SWIG_NewFunctionPtrObj(pointer, pointerDescriptor) SwigScilabPtrFromObject(pvApiCtx, SWIG_Scilab_GetOutputPosition(), pointer, pointerDescriptor, 0, NULL) } // No fragment used here, the functions "SwigScilabPtrToObject" and "SwigScilabPtrFromObject" are defined in sciruntime.swg diff --git a/Lib/scilab/scirun.swg b/Lib/scilab/scirun.swg index 58c313df7..3b8289199 100644 --- a/Lib/scilab/scirun.swg +++ b/Lib/scilab/scirun.swg @@ -142,10 +142,10 @@ SwigScilabCheckPtr(void *pvApiCtx, int iVar, swig_type_info *descriptor, char *f if (descriptor) { swig_cast_info *cast = SWIG_TypeCheck(SWIG_TypeName((swig_type_info*)pvTypeinfo), descriptor); return (cast != NULL); - } + } else { return SWIG_ERROR; - } + } } else { return (iType == sci_pointer); @@ -232,12 +232,11 @@ SwigScilabPtrToObject(void *pvApiCtx, int iVar, void **pvObj, swig_type_info *de } SWIGRUNTIMEINLINE int -SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info *descriptor, int flags) { +SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info *descriptor, int flags, const char *pstTypeName) { SciErr sciErr; if (descriptor) { int *piMListAddr = NULL; - const char *pstString; sciErr = createMList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, 3, &piMListAddr); if (sciErr.iErr) { @@ -245,8 +244,11 @@ SwigScilabPtrFromObject(void *pvApiCtx, int iVarOut, void *pvObj, swig_type_info return SWIG_ERROR; } - pstString = SWIG_TypeName(descriptor); - sciErr = createMatrixOfStringInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 1, 1, 1, &pstString); + if (pstTypeName == NULL) { + pstTypeName = SWIG_TypeName(descriptor); + } + + sciErr = createMatrixOfStringInList(pvApiCtx, SWIG_NbInputArgument(pvApiCtx) + iVarOut, piMListAddr, 1, 1, 1, &pstTypeName); if (sciErr.iErr) { printError(&sciErr, 0); return SWIG_ERROR; @@ -451,7 +453,7 @@ int SWIG_ptr(SWIG_GatewayParameters) { } SWIG_Scilab_SetOutputPosition(1); return SWIG_Scilab_SetOutput(pvApiCtx, - SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0)); + SwigScilabPtrFromObject(pvApiCtx, 1, (void *) (uintptr_t)dValue, NULL, 0, NULL)); } else { return SWIG_ERROR;