scilab: implement null_pointer test
This commit is contained in:
parent
9ecb38976d
commit
85b1db1a91
2 changed files with 26 additions and 7 deletions
13
Examples/test-suite/scilab/null_pointer_runme.sci
Normal file
13
Examples/test-suite/scilab/null_pointer_runme.sci
Normal 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);
|
||||||
|
|
@ -107,16 +107,22 @@ SwigScilabPtrToObject(void *_pvApiCtx, int _iVar, void **_pObjValue, swig_type_i
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (iType == sci_pointer) {
|
||||||
sciErr = getPointer(_pvApiCtx, piAddrVar, _pObjValue);
|
sciErr = getPointer(_pvApiCtx, piAddrVar, _pObjValue);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else if (iType == sci_matrix) {
|
||||||
|
if (!isEmptyMatrix(_pvApiCtx, piAddrVar)) {
|
||||||
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue