scilab: implement null_pointer test

This commit is contained in:
Simon Marchetto 2014-03-04 09:51:43 +01:00
commit 85b1db1a91
2 changed files with 26 additions and 7 deletions

View file

@ -0,0 +1,13 @@
exec("swigtest.start", -1);
try
p = getnull();
if func(p) = %F then swigtesterror(); end
if func([]) = %F then swigtesterror(); end
catch
swigtesterror();
end
exec("swigtest.quit", -1);

View file

@ -107,14 +107,20 @@ SwigScilabPtrToObject(void *_pvApiCtx, int _iVar, void **_pObjValue, swig_type_i
printError(&sciErr, 0);
return SWIG_ERROR;
}
if (iType != sci_pointer) {
//Scierror(999, _("%s: Wrong type for input argument #%d: A pointer expected.\n"), _fname, _iVar);
return SWIG_ERROR;
}
sciErr = getPointer(_pvApiCtx, piAddrVar, _pObjValue);
if (sciErr.iErr) {
printError(&sciErr, 0);
if (iType == sci_pointer) {
sciErr = getPointer(_pvApiCtx, piAddrVar, _pObjValue);
if (sciErr.iErr) {
printError(&sciErr, 0);
return SWIG_ERROR;
}
}
else if (iType == sci_matrix) {
if (!isEmptyMatrix(_pvApiCtx, piAddrVar)) {
return SWIG_ERROR;
}
}
else {
return SWIG_ERROR;
}