[Scilab-Dev] regression with AssignOutputVariable in scilab 6

Stéphane Mottelet stephane.mottelet at utc.fr
Tue Sep 15 16:31:08 CEST 2015


Hello,

I have noted a different behaviour of same gateway code between scilab 
5.5.2 and scilab 6.

The statement

AssignOutputVariable(pvApiCtx, 1) = 1;

is supposed to allow to return as first output variable the first input 
variable of the scilab function.

Under scilab 5.5.2 the following code allows to modifiy the non-zeros 
terms of a sparse matrix a with elements of a vector v (with the syntax 
spset(a,v)), and outputs the modified matrix:

int sparse_set(char *fname)
{
     SciErr sciErr;
     int i,j,k;
     int* piAddr                     = NULL;
     int* vAddr          = NULL;
     int iRows                       = 0;
     int iCols                       = 0;
     int viRows                      = 0;
     int viCols                      = 0;
     int iNbItem                     = 0;
     int* piNbItemRow        = NULL;
     int* piColPos           = NULL;
     double* pdblReal        = NULL;
     double* vpdblReal   = NULL;

     CheckInputArgument(pvApiCtx, 2, 2);
     CheckOutputArgument(pvApiCtx, 0, 1);

     sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
     sciErr = getSparseMatrix(pvApiCtx, piAddr, &iRows, &iCols, 
&iNbItem, &piNbItemRow, &piColPos, &pdblReal);
     sciErr = getVarAddressFromPosition(pvApiCtx, 2, &vAddr);
     sciErr = getMatrixOfDouble(pvApiCtx, vAddr, &viRows, &viCols, 
&vpdblReal);

     memcpy(pdblReal, vpdblReal,min(iNbItem,viRows*viCols)*sizeof(double));

     AssignOutputVariable(pvApiCtx, 1) = 1;

     return 0;
}

Under Scilab 6 (function prototype has to be updated ;-)), the same code 
outputs the original, unmodified matrix a.

My question is : is the (expected) behavior of scilab 5.5.2 erroneous or 
is there a bug/regression in scilab 6 ?

Thanks for help

S.


-- 
Département de Génie Informatique
EA 4297 Transformations Intégrées de la Matière Renouvelable
Université de Technologie de Compiègne -  CS 60319
60203 Compiègne cedex	




More information about the dev mailing list