fix matrix input issue
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-sploving@12124 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
090ec2d78c
commit
e16a959732
6 changed files with 317 additions and 100 deletions
|
|
@ -1,6 +1,6 @@
|
|||
%typemap(in) (double*, int, int) {
|
||||
%typemap(in) (double* matrixAsInput, int rows, int cols) {
|
||||
int *piAddr = NULL;
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, ++scilabArgNumber, &piAddr);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
|
|
@ -11,3 +11,28 @@
|
|||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
%typemap(in,numinputs=0) (double** matrixAsArgOutput,int* rows, int* cols)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
%typemap(arginit) (double** matrixAsArgOutput,int* rows, int* cols)
|
||||
{
|
||||
$1=(double**)malloc(16*sizeof(double*));
|
||||
$2=(int*)malloc(sizeof(int));
|
||||
$3=(int*)malloc(sizeof(int));
|
||||
}
|
||||
|
||||
%typemap(argout) (double** matrixAsArgOutput,int* rows, int* cols)
|
||||
{
|
||||
sciErr = createMatrixOfDouble(pvApiCtx, iVarOut, *$2, *$3, (double *)*$1);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
LhsVar(iOutNum) = iVarOut;
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -63,7 +63,7 @@ or you can use the %apply directive :
|
|||
int iType;
|
||||
double *_piData;
|
||||
int typearg;
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, $argnum, &piAddrVar);
|
||||
sciErr = getVarAddressFromPosition(pvApiCtx, ++scilabArgNumber, &piAddrVar);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
|
|
@ -155,6 +155,8 @@ output values.
|
|||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
}
|
||||
|
||||
%typemap(argout) short *OUTPUT(int iRowsOut, int iColsOut),
|
||||
|
|
@ -166,6 +168,8 @@ output values.
|
|||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
}
|
||||
|
||||
%typemap(argout) int *OUTPUT(int iRowsOut,int iColsOut),
|
||||
|
|
@ -180,6 +184,8 @@ output values.
|
|||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -194,6 +200,8 @@ output values.
|
|||
printError(&sciErr, 0);
|
||||
return 0;
|
||||
}
|
||||
iOutNum++;
|
||||
iVarOut++;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue