freeArrayOfString(str, size);
}
- AssignOutputVariable(1) = 0;
+ AssignOutputVariable(pvApiCtx, 1) = 0;
return 0;
}
CheckOutputArgument(pvApiCtx, 2, 2);
// create results on stack
- sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument + 1, 0, 0, &dOut);
+ sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + + 1, 0, 0, &dOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createMatrixOfString(pvApiCtx, nbInputArgument + 2, 0, 0, &cOut);
+ sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + + 2, 0, 0, &cOut);
if (sciErr.iErr)
{
return 0;
}
- AssignOutputVariable(1) = nbInputArgument + 1;
- AssignOutputVariable(2) = nbInputArgument + 2;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + + 1;
+ AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + + 2;
return 0;
}
return iRet;
}
- sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos);
+ sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos);
if (sciErr.iErr)
{
freeAllocatedBooleanSparse(piNbItemRow, piColPos);
}
freeAllocatedBooleanSparse(piNbItemRow, piColPos);
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
}
return 0;
}
}
//no return value
- AssignOutputVariable(0) = 1;
+ AssignOutputVariable(pvApiCtx, 0) = 1;
return 0;
}
#include "sciprint.h"
#include "MALLOC.h"
-SciErr printf_info(int _iVar);
+SciErr printf_info(void* _pvCtx, int _iVar);
int common_function(char *fname, unsigned long fname_len)
{
int *piAddr1 = NULL;
int iBool = 0;
- for (i = 0 ; i < nbInputArgument ; i++)
+ for (i = 0 ; i < nbInputArgument(pvApiCtx) ; i++)
{
- sciErr = printf_info(i + 1);
+ sciErr = printf_info(pvApiCtx, i + 1);
if (sciErr.iErr)
{
printError(&sciErr, 0);
//1 for true, 0 for false
iBool = sciErr.iErr == 0 ? 1 : 0;
- sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument + 1, 1, 1, &iBool);
+ sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1, 1, &iBool);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//assign allocated variables to Lhs position
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
-SciErr printf_info(int _iVar)
+
+SciErr printf_info(void* _pvCtx, int _iVar)
{
SciErr sciErr;
int* piAddr = NULL;
int iItem = 0;
int iComplex = 0;
- sciErr = getVarAddressFromPosition(pvApiCtx, _iVar, &piAddr);
+ sciErr = getVarAddressFromPosition(_pvCtx, _iVar, &piAddr);
if (sciErr.iErr)
{
return sciErr;
sciprint("Variable %d information:\n", _iVar);
- sciErr = getVarType(pvApiCtx, piAddr, &iType);
+ sciErr = getVarType(_pvCtx, piAddr, &iType);
if (sciErr.iErr)
{
return sciErr;
char* pstSign = pstSigned;
int iPrec = 0;
- sciErr = getMatrixOfIntegerPrecision(pvApiCtx, piAddr, &iPrec);
+ sciErr = getMatrixOfIntegerPrecision(_pvCtx, piAddr, &iPrec);
if (sciErr.iErr)
{
return sciErr;
return sciErr;
}
- if (isVarComplex(pvApiCtx, piAddr))
+ if (isVarComplex(_pvCtx, piAddr))
{
sciprint("\tComplex: Yes\n");
}
sciprint("\tDimensions: ");
- if (isVarMatrixType(pvApiCtx, piAddr))
+ if (isVarMatrixType(_pvCtx, piAddr))
{
- sciErr = getVarDimension(pvApiCtx, piAddr, &iRows, &iCols);
+ sciErr = getVarDimension(_pvCtx, piAddr, &iRows, &iCols);
if (sciErr.iErr)
{
return sciErr;
}
else
{
- sciErr = getListItemNumber(pvApiCtx, piAddr, &iItem);
+ sciErr = getListItemNumber(_pvCtx, piAddr, &iItem);
if (sciErr.iErr)
{
return sciErr;
#include "sciprint.h"
#include "MALLOC.h"
-int get_list_info(int* _piAddress);
+int get_list_info(void* _pvCtx, int* _piAddress);
void insert_indent(void);
-static int iLocalTab = 0;
+static int iLocalTab = 1;
int common_list(char *fname,unsigned long fname_len)
{
return 0;
}
- get_list_info(piAddr);
- AssignOutputVariable(1) = 0;
+ get_list_info(pvApiCtx, piAddr);
+ AssignOutputVariable(pvApiCtx, 1) = 0;
return 0;
}
-int get_list_info(int* _piAddress)
+int get_list_info(void* _pvCtx, int* _piAddress)
{
SciErr sciErr;
int i = 0;
int iItem = 0;
//get list item number, failed if variable is not a kind of list
- sciErr = getListItemNumber(pvApiCtx, _piAddress, &iItem);
+ sciErr = getListItemNumber(_pvCtx, _piAddress, &iItem);
if(sciErr.iErr)
{
printError(&sciErr, 0);
int iType = 0;
int* piAddrChild = NULL;
- sciErr = getListItemAddress(pvApiCtx, _piAddress, i + 1, &piAddrChild);
+ sciErr = getListItemAddress(_pvCtx, _piAddress, i + 1, &piAddrChild);
if(sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = getVarType(pvApiCtx, piAddrChild, &iType);
+ sciErr = getVarType(_pvCtx, piAddrChild, &iType);
if(sciErr.iErr)
{
printError(&sciErr, 0);
insert_indent();
sciprint("Child %d -> ", i + 1);
iLocalTab++;
- iRet = get_list_info(piAddrChild);
+ iRet = get_list_info(_pvCtx, piAddrChild);
iLocalTab--;
if(iRet)
}
}
-int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
-int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_list_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_double_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_poly_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_boolean_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_sparse_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_bsparse_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_integer_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_string_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
+int get_pointer_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos);
int common_read(char *fname,unsigned long fname_len)
{
return 0;
}
- get_info(1, NULL, piAddr, 0);
- AssignOutputVariable(1) = 0;
+ get_info(pvApiCtx, 1, NULL, piAddr, 0);
+ AssignOutputVariable(pvApiCtx, 1) = 0;
return 0;
}
-int get_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int iRet = 0;
int iType = 0;
- sciErr = getVarType(pvApiCtx, _piAddr, &iType);
+ sciErr = getVarType(_pvCtx, _piAddr, &iType);
switch(iType)
{
case sci_matrix :
- iRet = get_double_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_double_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_poly :
- iRet = get_poly_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_poly_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_boolean :
- iRet = get_boolean_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_boolean_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_sparse :
- iRet = get_sparse_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_sparse_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_boolean_sparse :
- iRet = get_bsparse_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_bsparse_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_ints :
- iRet = get_integer_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_integer_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_strings :
- iRet = get_string_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_string_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_list :
insert_indent();
sciprint("List ");
- iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_tlist :
insert_indent();
sciprint("TList ");
- iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_mlist :
insert_indent();
sciprint("MList ");
- iRet = get_list_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_list_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
case sci_pointer :
- iRet = get_pointer_info(_iRhs, _piParent, _piAddr, _iItemPos);
+ iRet = get_pointer_info(_pvCtx, _iRhs, _piParent, _piAddr, _iItemPos);
break;
default :
insert_indent();
return iRet;
}
-int get_list_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_list_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int i;
int iItem = 0;
int* piChild = NULL;
- sciErr = getListItemNumber(pvApiCtx, _piAddr, &iItem);
+ sciErr = getListItemNumber(_pvCtx, _piAddr, &iItem);
if(sciErr.iErr)
{
printError(&sciErr, 0);
sciprint("(%d)\n", iItem);
for(i = 0 ; i < iItem ; i++)
{
- sciErr = getListItemAddress(pvApiCtx, _piAddr, i + 1, &piChild);
+ sciErr = getListItemAddress(_pvCtx, _piAddr, i + 1, &piChild);
if(sciErr.iErr)
{
printError(&sciErr, 0);
}
iTab++;
- iRet = get_info(_iRhs, _piAddr, piChild, i + 1);
+ iRet = get_info(_pvCtx, _iRhs, _piAddr, piChild, i + 1);
iTab--;
}
return 0;;
}
-int get_double_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_double_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int iRows = 0;
if(_iItemPos == 0)
{//not in list
- if(isVarComplex(pvApiCtx, _piAddr))
+ if(isVarComplex(_pvCtx, _piAddr))
{
- sciErr = getComplexMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
+ sciErr = getComplexMatrixOfDouble(_pvCtx, _piAddr, &iRows, &iCols, &pdblReal, &pdblImg);
}
else
{
- sciErr = getMatrixOfDouble(pvApiCtx, _piAddr, &iRows, &iCols, &pdblReal);
+ sciErr = getMatrixOfDouble(_pvCtx, _piAddr, &iRows, &iCols, &pdblReal);
}
}
else
{
- if(isVarComplex(pvApiCtx, _piAddr))
+ if(isVarComplex(_pvCtx, _piAddr))
{
- sciErr = getComplexMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg);
+ sciErr = getComplexMatrixOfDoubleInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal, &pdblImg);
}
else
{
- sciErr = getMatrixOfDoubleInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal);
+ sciErr = getMatrixOfDoubleInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pdblReal);
}
}
return 0;;
}
-int get_poly_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_poly_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int i;
double** pdblReal = NULL;
double** pdblImg = NULL;
- sciErr = getPolyVariableName(pvApiCtx, _piAddr, pstVar, &iLen);
+ sciErr = getPolyVariableName(_pvCtx, _piAddr, pstVar, &iLen);
if(sciErr.iErr)
{
printError(&sciErr, 0);
if(_iItemPos == 0)
{//not in list
- sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL);
+ sciErr = getMatrixOfPoly(_pvCtx, _piAddr, &iRows, &iCols, NULL, NULL);
if(sciErr.iErr)
{
printError(&sciErr, 0);
}
piCoeff = (int*)malloc(sizeof(int) * iRows * iCols);
- sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, NULL);
+ sciErr = getMatrixOfPoly(_pvCtx, _piAddr, &iRows, &iCols, piCoeff, NULL);
if(sciErr.iErr)
{
printError(&sciErr, 0);
pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]);
}
- if(isVarComplex(pvApiCtx, _piAddr))
+ if(isVarComplex(_pvCtx, _piAddr))
{
- sciErr = getComplexMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+ sciErr = getComplexMatrixOfPoly(_pvCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
if(sciErr.iErr)
{
printError(&sciErr, 0);
}
else
{
- sciErr = getMatrixOfPoly(pvApiCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal);
+ sciErr = getMatrixOfPoly(_pvCtx, _piAddr, &iRows, &iCols, piCoeff, pdblReal);
if(sciErr.iErr)
{
printError(&sciErr, 0);
}
else
{
- sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL);
+ sciErr = getMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL);
if(sciErr.iErr)
{
printError(&sciErr, 0);
piCoeff = (int*)malloc(sizeof(int) * iRows * iCols);
- sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL);
+ sciErr = getMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, NULL);
if(sciErr.iErr)
{
printError(&sciErr, 0);
pdblImg[i] = (double*)malloc(sizeof(double) * piCoeff[i]);
}
- if(isVarComplex(pvApiCtx, _piAddr))
+ if(isVarComplex(_pvCtx, _piAddr))
{
- sciErr = getComplexMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
+ sciErr = getComplexMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal, pdblImg);
}
else
{
- sciErr = getMatrixOfPolyInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal);
+ sciErr = getMatrixOfPolyInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piCoeff, pdblReal);
}
}
free(piCoeff);
return 0;;
}
-int get_boolean_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_boolean_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int iRows = 0;
if(_iItemPos == 0)
{
- sciErr = getMatrixOfBoolean(pvApiCtx, _piAddr, &iRows, &iCols, &piBool);
+ sciErr = getMatrixOfBoolean(_pvCtx, _piAddr, &iRows, &iCols, &piBool);
}
else
{
- sciErr = getMatrixOfBooleanInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool);
+ sciErr = getMatrixOfBooleanInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &piBool);
}
if(sciErr.iErr)
sciprint("Boolean (%d x %d)\n", iRows, iCols);
return 0;
}
-int get_sparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_sparse_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int iRows = 0;
if(_iItemPos == 0)
{//Not in list
- if(isVarComplex(pvApiCtx, _piAddr))
+ if(isVarComplex(_pvCtx, _piAddr))
{
- sciErr = getComplexSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg);
+ sciErr = getComplexSparseMatrix(_pvCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg);
}
else
{
- sciErr = getSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal);
+ sciErr = getSparseMatrix(_pvCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal);
}
}
else
{
- if(isVarComplex(pvApiCtx, _piAddr))
+ if(isVarComplex(_pvCtx, _piAddr))
{
- sciErr = getComplexSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg);
+ sciErr = getComplexSparseMatrixInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal, &pdblImg);
}
else
{
- sciErr = getSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal);
+ sciErr = getSparseMatrixInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos, &pdblReal);
}
}
return 0;;
}
-int get_bsparse_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_bsparse_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int iRows = 0;
if(_iItemPos == 0)
{//Not in list
- sciErr = getBooleanSparseMatrix(pvApiCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos);
+ sciErr = getBooleanSparseMatrix(_pvCtx, _piAddr, &iRows, &iCols, &iItem, &piNbRow, &piColPos);
}
else
{
- sciErr = getBooleanSparseMatrixInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos);
+ sciErr = getBooleanSparseMatrixInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &iItem, &piNbRow, &piColPos);
}
if(sciErr.iErr)
sciprint("Boolean Sparse (%d x %d), Item(s) : %d \n", iRows, iCols, iItem);
return 0;;
}
-int get_integer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_integer_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int iPrec = 0;
if(_iItemPos == 0)
{//Not in list
- sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec);
+ sciErr = getMatrixOfIntegerPrecision(_pvCtx, _piAddr, &iPrec);
if(sciErr.iErr)
{
printError(&sciErr, 0);
switch(iPrec)
{
case SCI_INT8 :
- sciErr = getMatrixOfInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pcData);
+ sciErr = getMatrixOfInteger8(_pvCtx, _piAddr, &iRows, &iCols, &pcData);
break;
case SCI_INT16 :
- sciErr = getMatrixOfInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &psData);
+ sciErr = getMatrixOfInteger16(_pvCtx, _piAddr, &iRows, &iCols, &psData);
break;
case SCI_INT32 :
- sciErr = getMatrixOfInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &piData);
+ sciErr = getMatrixOfInteger32(_pvCtx, _piAddr, &iRows, &iCols, &piData);
break;
case SCI_UINT8 :
- sciErr = getMatrixOfUnsignedInteger8(pvApiCtx, _piAddr, &iRows, &iCols, &pucData);
+ sciErr = getMatrixOfUnsignedInteger8(_pvCtx, _piAddr, &iRows, &iCols, &pucData);
break;
case SCI_UINT16 :
- sciErr = getMatrixOfUnsignedInteger16(pvApiCtx, _piAddr, &iRows, &iCols, &pusData);
+ sciErr = getMatrixOfUnsignedInteger16(_pvCtx, _piAddr, &iRows, &iCols, &pusData);
break;
case SCI_UINT32 :
- sciErr = getMatrixOfUnsignedInteger32(pvApiCtx, _piAddr, &iRows, &iCols, &puiData);
+ sciErr = getMatrixOfUnsignedInteger32(_pvCtx, _piAddr, &iRows, &iCols, &puiData);
break;
default :
return 1;
}
else
{
- sciErr = getMatrixOfIntegerPrecision(pvApiCtx, _piAddr, &iPrec);
+ sciErr = getMatrixOfIntegerPrecision(_pvCtx, _piAddr, &iPrec);
if(sciErr.iErr)
{
printError(&sciErr, 0);
switch(iPrec)
{
case SCI_INT8 :
- sciErr = getMatrixOfInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData);
+ sciErr = getMatrixOfInteger8InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pcData);
break;
case SCI_INT16 :
- sciErr = getMatrixOfInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &psData);
+ sciErr = getMatrixOfInteger16InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &psData);
break;
case SCI_INT32 :
- sciErr = getMatrixOfInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &piData);
+ sciErr = getMatrixOfInteger32InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &piData);
break;
case SCI_UINT8 :
- sciErr = getMatrixOfUnsignedInteger8InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData);
+ sciErr = getMatrixOfUnsignedInteger8InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pucData);
break;
case SCI_UINT16 :
- sciErr = getMatrixOfUnsignedInteger16InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData);
+ sciErr = getMatrixOfUnsignedInteger16InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &pusData);
break;
case SCI_UINT32 :
- sciErr = getMatrixOfUnsignedInteger32InList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData);
+ sciErr = getMatrixOfUnsignedInteger32InList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, &puiData);
break;
default :
return 1;
sciprint("Integer %d bits (%d x %d)\n", (iPrec % 10) * 8, iRows, iCols);
return 0;;
}
-int get_string_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_string_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
int i;
if(_iItemPos == 0)
{//Not in list
- sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, NULL, NULL);
+ sciErr = getMatrixOfString(_pvCtx, _piAddr, &iRows, &iCols, NULL, NULL);
if(sciErr.iErr)
{
printError(&sciErr, 0);
}
piLen = (int*)malloc(sizeof(int) * iRows * iCols);
- sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, NULL);
+ sciErr = getMatrixOfString(_pvCtx, _piAddr, &iRows, &iCols, piLen, NULL);
if(sciErr.iErr)
{
printError(&sciErr, 0);
pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination
}
- sciErr = getMatrixOfString(pvApiCtx, _piAddr, &iRows, &iCols, piLen, pstData);
+ sciErr = getMatrixOfString(_pvCtx, _piAddr, &iRows, &iCols, piLen, pstData);
if(sciErr.iErr)
{
printError(&sciErr, 0);
}
else
{
- sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL);
+ sciErr = getMatrixOfStringInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, NULL, NULL);
if(sciErr.iErr)
{
printError(&sciErr, 0);
piLen = (int*)malloc(sizeof(int) * iRows * iCols);
- sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL);
+ sciErr = getMatrixOfStringInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, NULL);
if(sciErr.iErr)
{
printError(&sciErr, 0);
pstData[i] = (char*)malloc(sizeof(char) * (piLen[i] + 1));//+ 1 for null termination
}
- sciErr = getMatrixOfStringInList(pvApiCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData);
+ sciErr = getMatrixOfStringInList(_pvCtx, _piParent, _iItemPos, &iRows, &iCols, piLen, pstData);
if(sciErr.iErr)
{
printError(&sciErr, 0);
sciprint("Strings (%d x %d)\n", iRows, iCols);
return 0;;
}
-int get_pointer_info(int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
+int get_pointer_info(void* _pvCtx, int _iRhs, int* _piParent, int *_piAddr, int _iItemPos)
{
SciErr sciErr;
void* pvPtr = NULL;
if(_iItemPos == 0)
{
- sciErr = getPointer(pvApiCtx, _piAddr, &pvPtr);
+ sciErr = getPointer(_pvCtx, _piAddr, &pvPtr);
}
else
{
- sciErr = getPointerInList(pvApiCtx, _piParent, _iItemPos, &pvPtr);
+ sciErr = getPointerInList(_pvCtx, _piParent, _iItemPos, &pvPtr);
}
if(sciErr.iErr)
}
createScalarBoolean(pvApiCtx, Rhs + 1, iRet);
- AssignOutputVariable(1) = Rhs + 1;
+ AssignOutputVariable(pvApiCtx, 1) = Rhs + 1;
return 0;
}
if (isEmptyMatrix(pvApiCtx, piAddr))
{
- iRet = createEmptyMatrix(pvApiCtx, nbInputArgument + 1);
+ iRet = createEmptyMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1);
if (iRet)
{
return iRet;
}
- AssignOutputVariable(1) = 0;
+ AssignOutputVariable(pvApiCtx, 1) = 0;
}
else if (isDoubleType(pvApiCtx, piAddr))
{
return iRet;
}
- iRet = createScalarComplexDouble(pvApiCtx, nbInputArgument + 1, dblReal, dblImg);
+ iRet = createScalarComplexDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblReal, dblImg);
if (iRet)
{
return iRet;
return iRet;
}
- iRet = createScalarDouble(pvApiCtx, nbInputArgument + 1, dblReal);
+ iRet = createScalarDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, dblReal);
if (iRet)
{
return iRet;
return sciErr.iErr;
}
- sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument + 1, iRows, iCols, pdblReal, pdblImg);
+ sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal, pdblImg);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return sciErr.iErr;
}
- sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument + 1, iRows, iCols, pdblReal);
+ sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
}
return 0;
//if variable is complex, switch real part and imaginary part otherwise multiply by -1
if (iComplex)
{
- sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument + 1, iRows, iCols, pdblImg, pdblReal);
+ sciErr = createComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblImg, pdblReal);
}
else
{
{
pdblReal[i] = pdblReal[i] * -1;
}
- sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument + 1, iRows, iCols, pdblReal);
+ sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, pdblReal);
}
if (sciErr.iErr)
return 0;
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
//}
//create a variable from a existing data array
- sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument + 1, iRows1, iCols1, pdblReal1);
+ sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows1, iCols1, pdblReal1);
if (sciErr.iErr)
{
printError(&sciErr, 0);
*************************/
//reserve space in scilab memory and fill it
- sciErr = allocComplexMatrixOfDouble(pvApiCtx, nbInputArgument + 2, iRows2, iCols2, &pdblReal2, &pdblImg2);
+ sciErr = allocComplexMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRows2, iCols2, &pdblReal2, &pdblImg2);
if (sciErr.iErr)
{
printError(&sciErr, 0);
// /!\ DO NOT FREE MEMORY, in this case, it's the Scilab memory
//assign allocated variables to Lhs position
- AssignOutputVariable(1) = nbInputArgument + 1;
- AssignOutputVariable(2) = nbInputArgument + 2;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2;
return 0;
}
puiDataOut = (unsigned int*)create_output(64, 4, iRowsu32, iColsu32, (void*)puiData);
//create new variable
- sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument + 1, iRows8, iCols8, pcDataOut);
+ sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows8, iCols8, pcDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument + 2, iRowsu8, iColsu8, pucDataOut);
+ sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRowsu8, iColsu8, pucDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument + 3, iRows16, iCols16, psDataOut);
+ sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 3, iRows16, iCols16, psDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument + 4, iRowsu16, iColsu16, pusDataOut);
+ sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 4, iRowsu16, iColsu16, pusDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument + 5, iRows32, iCols32, piDataOut);
+ sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 5, iRows32, iCols32, piDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument + 6, iRowsu32, iColsu32, puiDataOut);
+ sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 6, iRowsu32, iColsu32, puiDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//assign allocated variables to Lhs position
- AssignOutputVariable(1) = nbInputArgument + 1;
- AssignOutputVariable(2) = nbInputArgument + 2;
- AssignOutputVariable(3) = nbInputArgument + 3;
- AssignOutputVariable(4) = nbInputArgument + 4;
- AssignOutputVariable(5) = nbInputArgument + 5;
- AssignOutputVariable(6) = nbInputArgument + 6;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2;
+ AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3;
+ AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4;
+ AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5;
+ AssignOutputVariable(pvApiCtx, 6) = nbInputArgument(pvApiCtx) + 6;
return 0;
}
puiDataOut = (unsigned int*)create_output(64, 4, iRowsu32, iColsu32, (void*)puiData);
//create new variable
- sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument + 1, iRows8, iCols8, pcDataOut);
+ sciErr = createMatrixOfInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows8, iCols8, pcDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument + 2, iRowsu8, iColsu8, pucDataOut);
+ sciErr = createMatrixOfUnsignedInteger8(pvApiCtx, nbInputArgument(pvApiCtx) + 2, iRowsu8, iColsu8, pucDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument + 3, iRows16, iCols16, psDataOut);
+ sciErr = createMatrixOfInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 3, iRows16, iCols16, psDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument + 4, iRowsu16, iColsu16, pusDataOut);
+ sciErr = createMatrixOfUnsignedInteger16(pvApiCtx, nbInputArgument(pvApiCtx) + 4, iRowsu16, iColsu16, pusDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument + 5, iRows32, iCols32, piDataOut);
+ sciErr = createMatrixOfInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 5, iRows32, iCols32, piDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//create new variable
- sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument + 6, iRowsu32, iColsu32, puiDataOut);
+ sciErr = createMatrixOfUnsignedInteger32(pvApiCtx, nbInputArgument(pvApiCtx) + 6, iRowsu32, iColsu32, puiDataOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//assign allocated variables to Lhs position
- AssignOutputVariable(1) = nbInputArgument + 1;
- AssignOutputVariable(2) = nbInputArgument + 2;
- AssignOutputVariable(3) = nbInputArgument + 3;
- AssignOutputVariable(4) = nbInputArgument + 4;
- AssignOutputVariable(5) = nbInputArgument + 5;
- AssignOutputVariable(6) = nbInputArgument + 6;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
+ AssignOutputVariable(pvApiCtx, 2) = nbInputArgument(pvApiCtx) + 2;
+ AssignOutputVariable(pvApiCtx, 3) = nbInputArgument(pvApiCtx) + 3;
+ AssignOutputVariable(pvApiCtx, 4) = nbInputArgument(pvApiCtx) + 4;
+ AssignOutputVariable(pvApiCtx, 5) = nbInputArgument(pvApiCtx) + 5;
+ AssignOutputVariable(pvApiCtx, 6) = nbInputArgument(pvApiCtx) + 6;
return 0;
}
int piBool[] = {1, 0, 1, 0, 1, 0, 1, 0, 1};
double* pdblDataPtr = NULL;
- sciErr = createList(pvApiCtx, nbInputArgument + 1, 8, &piAddr);
+ sciErr = createList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 8, &piAddr);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument + 1, piAddr, 1, 3, 2, pdblData1, pdblData2);
+ sciErr = createComplexMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 1, 3, 2, pdblData1, pdblData2);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument + 1, piAddr, 2, 2, 3, pstData);
+ sciErr = createMatrixOfStringInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 2, 2, 3, pstData);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument + 1, piAddr, 3, 2, 3, psData);
+ sciErr = createMatrixOfInteger16InList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 3, 2, 3, psData);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly);
+ sciErr = createMatrixOfPolyInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 4, "x", 3, 2, piCoef, pdblPoly);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg);
+ sciErr = createComplexSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 5, 3, 10, 4, piNbItemRow, piColPos, pdblSReal, pdblSImg);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument + 1, piAddr, 6, 3, 3, piBool);
+ sciErr = createMatrixOfBooleanInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 6, 3, 3, piBool);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos);
+ sciErr = createBooleanSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 7, 3, 10, 4, piNbItemRow, piColPos);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//add list in list
- sciErr = createListInList(pvApiCtx, nbInputArgument + 1, piAddr, 8, 3, &piChild);
+ sciErr = createListInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piAddr, 8, 3, &piChild);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument + 1, piChild, 1, 3, 2, pdblData1);
+ sciErr = createMatrixOfDoubleInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 1, 3, 2, pdblData1);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal);
+ sciErr = createSparseMatrixInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 2, 3, 10, 4, piNbItemRow, piColPos, pdblSReal);
if (sciErr.iErr)
{
printError(&sciErr, 0);
pdblDataPtr[2] = 3;
pdblDataPtr[3] = 4;
- sciErr = createPointerInList(pvApiCtx, nbInputArgument + 1, piChild, 3, pdblDataPtr);
+ sciErr = createPointerInList(pvApiCtx, nbInputArgument(pvApiCtx) + 1, piChild, 3, pdblDataPtr);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
* http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
*
*/
-
+#include <stdlib.h>
#include "api_scilab.h"
#include "Scierror.h"
#include "localization.h"
CheckInputArgument(pvApiCtx, 0, 1);
CheckOutputArgument(pvApiCtx, 1, 1);
- if (nbInputArgument == 0)
+ if (nbInputArgument(pvApiCtx) == 0)
{
//create mode
double* pdblData = (double*)malloc(sizeof(double) * 2 * 2);
pdblData[1] = 3;
pdblData[2] = 2;
pdblData[3] = 4;
- sciErr = createPointer(pvApiCtx, nbInputArgument + 1, (void*)pdblData);
+ sciErr = createPointer(pvApiCtx, nbInputArgument(pvApiCtx) + 1, (void*)pdblData);
}
- else if (nbInputArgument == 1)
+ else if (nbInputArgument(pvApiCtx) == 1)
{
//read mode
int iType = 0;
return 0;
}
pdblData = (double*)pvPtr;
- sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument + 1, 2, 2, pdblData);
+ sciErr = createMatrixOfDouble(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 2, 2, pdblData);
}
else
{
printError(&sciErr, 0);
return 0;
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
return iRet;
}
- sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal, &pdblImg);
+ sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal, &pdblImg);
if (sciErr.iErr)
{
freeAllocatedSingleComplexPoly(pdblReal, pdblImg);
return iRet;
}
- sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal);
+ sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, 1, 1, &iNbCoef, &pdblReal);
if (sciErr.iErr)
{
freeAllocatedSinglePoly(pdblReal);
return iRet;
}
- sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg);
+ sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal, pdblImg);
if (sciErr.iErr)
{
freeAllocatedMatrixOfComplexPoly(iRows, iCols, piNbCoef, pdblReal, pdblImg);
return iRet;
}
- sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal);
+ sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal);
if (sciErr.iErr)
{
freeAllocatedMatrixOfPoly(iRows, iCols, piNbCoef, pdblReal);
}
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
}
else
{
- AssignOutputVariable(1) = 0;
+ AssignOutputVariable(pvApiCtx, 1) = 0;
}
return 0;
}
}
}
- sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument + 1, pstVarname, iRows, iCols, piNbCoef, pdblReal, pdblImg);
+ sciErr = createComplexMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarname, iRows, iCols, piNbCoef, pdblReal, pdblImg);
if (sciErr.iErr)
{
printError(&sciErr, 0);
free(pdblReal);
free(pdblImg);
//assign allocated variables to Lhs position
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
pdblReal[4] = pdblPoly4;
pdblReal[5] = pdblPoly5;
- sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal);
+ sciErr = createMatrixOfPoly(pvApiCtx, nbInputArgument(pvApiCtx) + 1, pstVarName, iRows, iCols, piNbCoef, pdblReal);
if (sciErr.iErr)
{
printError(&sciErr, 0);
}
//assign allocated variables to Lhs position
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
piBool[i] = piBool[i] == 0 ? 1 : 0;
}
- sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument + 1, iRows, iCols, piBool);
+ sciErr = createMatrixOfBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, piBool);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
iCol += piNbItemRow[i];
}
- sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument + 1, iRows, iCols, iNewItem, piNewRow, piNewCol);
+ sciErr = createBooleanSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNewItem, piNewRow, piNewCol);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
return 0;
}
return iRet;
}
- sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg);
+ sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal, pdblImg);
if (sciErr.iErr)
{
freeAllocatedComplexSparseMatrix(piNbItemRow, piColPos, pdblReal, pdblImg);
return iRet;
}
- sciErr = createSparseMatrix(pvApiCtx, nbInputArgument + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
+ sciErr = createSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + 1, iRows, iCols, iNbItem, piNbItemRow, piColPos, pdblReal);
if (sciErr.iErr)
{
freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal);
freeAllocatedSparseMatrix(piNbItemRow, piColPos, pdblReal);
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
}
else
{
- AssignOutputVariable(1) = 0;
+ AssignOutputVariable(pvApiCtx, 1) = 0;
}
return 0;
}
}
//assign allocated variables to Lhs position
- AssignOutputVariable(1) = 0;
+ AssignOutputVariable(pvApiCtx, 1) = 0;
return 0;
}
double pdblSImg[] = {4, 3, 2, 1};
int iNbItem = 4;
- sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument + 1, 3, 10, iNbItem, piNbItemRow, piColPos, pdblSReal, pdblSImg);
+ sciErr = createComplexSparseMatrix(pvApiCtx, nbInputArgument(pvApiCtx) + + 1, 3, 10, iNbItem, piNbItemRow, piColPos, pdblSReal, pdblSImg);
if (sciErr.iErr)
{
printError(&sciErr, 0);
return 0;
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + + 1;
return 0;
}
return iRet;
}
- iRet = createSingleString(pvApiCtx, nbInputArgument + 1, pstData);
+ iRet = createSingleString(pvApiCtx, nbInputArgument(pvApiCtx) + + 1, pstData);
if (iRet)
{
freeAllocatedSingleString(pstData);
return iRet;
}
- sciErr = createMatrixOfString(pvApiCtx, nbInputArgument + 1, iRows, iCols, pstData);
+ sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + + 1, iRows, iCols, pstData);
if (sciErr.iErr)
{
freeAllocatedMatrixOfString(iRows, iCols, pstData);
freeAllocatedMatrixOfString(iRows, iCols, pstData);
}
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + + 1;
}
else
{
- AssignOutputVariable(1) = 0;
+ AssignOutputVariable(pvApiCtx, 1) = 0;
}
return 0;
}
}
//create new variable
- sciErr = createMatrixOfString(pvApiCtx, nbInputArgument + 1, iRowsOut, iColsOut, &pstOut);
+ sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + + 1, iRowsOut, iColsOut, &pstOut);
if (sciErr.iErr)
{
printError(&sciErr, 0);
free(pstData);
free(pstOut);
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + + 1;
return 0;
}
pstData[5] = string23;
//create the variable
- sciErr = createMatrixOfString(pvApiCtx, nbInputArgument + 1, iRows, iCols, pstData);
+ sciErr = createMatrixOfString(pvApiCtx, nbInputArgument(pvApiCtx) + + 1, iRows, iCols, pstData);
if (sciErr.iErr)
{
printError(&sciErr, 0);
//free container
free(pstData);
//assign allocated variables to Lhs position
- AssignOutputVariable(1) = nbInputArgument + 1;
+ AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + + 1;
return 0;
}
'#include ""api_scilab.h""'
'int sci_bug_11544(char* fname, int len)'
'{'
- ' AssignOutputVariable(0) = 1;'
+ ' AssignOutputVariable(pvApiCtx, 0) = 1;'
' return 0;'
'}'];
mputl(src, "bug_11544.c');
'#include ""api_scilab.h""'
'int sci_bug_11544(char* fname, int len)'
'{'
- ' AssignOutputVariable(0) = 1;'
+ ' AssignOutputVariable(pvApiCtx, 0) = 1;'
' return 0;'
'}'];