scilab: fix ret_by_value test
This commit is contained in:
parent
30f4336f59
commit
bca49968f1
1 changed files with 39 additions and 24 deletions
|
|
@ -13,9 +13,7 @@ SWIG_SciInt16_AsShort(void *_pvApiCtx, int _iVar, short *_psValue, char *_fname)
|
||||||
int iType = 0;
|
int iType = 0;
|
||||||
int iRows = 0;
|
int iRows = 0;
|
||||||
int iCols = 0;
|
int iCols = 0;
|
||||||
int iPrec = 0;
|
|
||||||
int *piAddrVar = NULL;
|
int *piAddrVar = NULL;
|
||||||
short *psData = NULL;
|
|
||||||
|
|
||||||
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
|
|
@ -28,32 +26,49 @@ SWIG_SciInt16_AsShort(void *_pvApiCtx, int _iVar, short *_psValue, char *_fname)
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
if (iType != sci_ints) {
|
if (iType == sci_ints) {
|
||||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit signed integer expected.\n"), _fname, _iVar);
|
int iPrec = 0;
|
||||||
return SWIG_ERROR;
|
short *psData = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
sciErr = getMatrixOfIntegerPrecision(_pvApiCtx, piAddrVar, &iPrec);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
if (iPrec != SCI_INT16) {
|
if (iPrec != SCI_INT16) {
|
||||||
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit signed integer expected.\n"), _fname, _iVar);
|
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit signed integer or double expected.\n"), _fname, _iVar);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
sciErr = getMatrixOfInteger16(_pvApiCtx, piAddrVar, &iRows, &iCols, &psData);
|
sciErr = getMatrixOfInteger16(_pvApiCtx, piAddrVar, &iRows, &iCols, &psData);
|
||||||
if (sciErr.iErr) {
|
if (sciErr.iErr) {
|
||||||
printError(&sciErr, 0);
|
printError(&sciErr, 0);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
}
|
}
|
||||||
if (iRows * iCols != 1) {
|
if (iRows * iCols != 1) {
|
||||||
Scierror(999, _("%s: Wrong size for input argument #%d: A 16-bit signed integer expected.\n"), _fname, _iVar);
|
Scierror(999, _("%s: Wrong size for input argument #%d: A 16-bit signed integer or double expected.\n"), _fname, _iVar);
|
||||||
return SWIG_ERROR;
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
*_psValue = *psData;
|
||||||
}
|
}
|
||||||
|
else if (iType == sci_matrix) {
|
||||||
|
double *pdData = NULL;
|
||||||
|
|
||||||
*_psValue = *psData;
|
sciErr = getMatrixOfDouble(_pvApiCtx, piAddrVar, &iRows, &iCols, &pdData);
|
||||||
|
if (sciErr.iErr) {
|
||||||
|
printError(&sciErr, 0);
|
||||||
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
if (iRows * iCols != 1) {
|
||||||
|
Scierror(999, _("%s: Wrong size for input argument #%d: A 16-bit signed integer or double expected.\n"), _fname, _iVar);
|
||||||
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
*_psValue = (short) *pdData;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
Scierror(999, _("%s: Wrong type for input argument #%d: A 16-bit signed integer or double expected.\n"), _fname, _iVar);
|
||||||
|
return SWIG_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
return SWIG_OK;
|
return SWIG_OK;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue