scilab: fix arrays_global (<> => isequal)
This commit is contained in:
parent
2e61fda041
commit
d1dface31c
4 changed files with 55 additions and 8 deletions
|
|
@ -167,8 +167,8 @@
|
|||
*/
|
||||
|
||||
%scilab_asarrayandsize_withcopy(varin, SWIG_SciDoubleOrInt32_AsIntArrayAndSize, long[ANY], int);
|
||||
%typemap(varout, noblock=1, fragment="SWIG_SciDouble_FromIntArrayAndSize") long[ANY] {
|
||||
%set_output(SWIG_SciDouble_FromIntArrayAndSize(pvApiCtx, $result, 1, $1_dim0, (const int*) $1));
|
||||
%typemap(varout, noblock=1, fragment="SWIG_SciDouble_FromLongArrayAndSize") long[ANY] {
|
||||
%set_output(SWIG_SciDouble_FromLongArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1));
|
||||
}
|
||||
%apply SWIGTYPE[] { long[] }; /* long[] variables managed as pointers */
|
||||
%scilab_asarray_withcopy(in, SWIG_SciDoubleOrInt32_AsIntArrayAndSize, long[], int);
|
||||
|
|
@ -179,8 +179,8 @@
|
|||
*/
|
||||
|
||||
%scilab_asarrayandsize_withcopy(varin, SWIG_SciUint32_AsUnsignedIntArrayAndSize, unsigned long[ANY], unsigned int);
|
||||
%typemap(varout, noblock=1, fragment="SWIG_SciUint32_AsUnsignedIntArrayAndSize") unsigned long[ANY] {
|
||||
%set_output(SWIG_SciUint32_FromUnsignedIntArrayAndSize(pvApiCtx, $result, 1, $1_dim0, (unsigned int*) $1));
|
||||
%typemap(varout, noblock=1, fragment="SWIG_SciUint32_FromUnsignedLongArrayAndSize") unsigned long[ANY] {
|
||||
%set_output(SWIG_SciUint32_FromUnsignedLongArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1));
|
||||
}
|
||||
%apply SWIGTYPE[] { unsigned long[] }; /* long[] variables managed as pointers */
|
||||
%scilab_asarray_withcopy(in, SWIG_SciUint32_AsUnsignedIntArrayAndSize, unsigned long[], unsigned int);
|
||||
|
|
|
|||
|
|
@ -97,3 +97,27 @@ SWIG_SciDouble_FromLong(void *_pvApiCtx, int _iVarOut, long _lValue, char *_fnam
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
%fragment("SWIG_SciDouble_FromLongArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciDouble_FromLongArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, const long *_plData) {
|
||||
SciErr sciErr;
|
||||
int i;
|
||||
double *pdValues = NULL;
|
||||
|
||||
pdValues = (double*) malloc(_iRows * _iCols * sizeof(double));
|
||||
for (i=0; i<_iRows * _iCols; i++) {
|
||||
pdValues[i] = _plData[i];
|
||||
}
|
||||
|
||||
sciErr = createMatrixOfDouble(_pvApiCtx, SWIG_NbInputArgument(_pvApiCtx) + _iVarOut, _iRows, _iCols, pdValues);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
free(pdValues);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
free(pdValues);
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,3 +27,26 @@ SWIG_UnsignedInt_FromUnsignedLong(void *_pvApiCtx, int _iVarOut, unsigned long _
|
|||
return SWIG_From_unsigned_SS_int((unsigned int)_ulValue);
|
||||
}
|
||||
}
|
||||
|
||||
%fragment("SWIG_SciUint32_FromUnsignedLongArrayAndSize", "header") {
|
||||
SWIGINTERN int
|
||||
SWIG_SciUint32_FromUnsignedLongArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, const unsigned long *_pulData) {
|
||||
SciErr sciErr;
|
||||
int i;
|
||||
unsigned int *puiValues = NULL;
|
||||
|
||||
puiValues = (unsigned int*) malloc(_iRows * _iCols * sizeof(unsigned int));
|
||||
for (i=0; i<_iRows * _iCols; i++) {
|
||||
puiValues[i] = _pulData[i];
|
||||
}
|
||||
|
||||
sciErr = createMatrixOfUnsignedInteger32(_pvApiCtx, SWIG_NbInputArgument(_pvApiCtx) + _iVarOut, _iRows, _iCols, puiValues);
|
||||
if (sciErr.iErr) {
|
||||
printError(&sciErr, 0);
|
||||
free(puiValues);
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
free(puiValues);
|
||||
return SWIG_OK;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue