From d0ccbdc6bea7098edb96cc79c60018b9961ef309 Mon Sep 17 00:00:00 2001 From: Simon Marchetto Date: Tue, 4 Mar 2014 18:15:08 +0100 Subject: [PATCH] scilab: move array typemaps in separate lib sciarray + add float array typemaps --- Lib/scilab/sciarray.swg | 197 +++++++++++++++++++++++++++++++++++++ Lib/scilab/scifloat.swg | 58 +++++++++++ Lib/scilab/scitypemaps.swg | 177 ++------------------------------- 3 files changed, 261 insertions(+), 171 deletions(-) create mode 100644 Lib/scilab/sciarray.swg diff --git a/Lib/scilab/sciarray.swg b/Lib/scilab/sciarray.swg new file mode 100644 index 000000000..996e557a2 --- /dev/null +++ b/Lib/scilab/sciarray.swg @@ -0,0 +1,197 @@ +/* -------------------------------------------------------------------------- + * + * Arrays typemaps + * + * --------------------------------------------------------------------------*/ + +%define %scilab_asarray_withcopy(TYPEMAPTYPE, FRAGMENTNAME, CTYPE, TEMPDATATYPE) +%typemap(TYPEMAPTYPE, fragment="FRAGMENTNAME") CTYPE { + size_t i = 0; + int iRows = 0; + int iCols = 0; + TEMPDATATYPE *pTempData = NULL; + if (FRAGMENTNAME(pvApiCtx, $input, &iRows, &iCols, &pTempData, fname)) { + return SWIG_ERROR; + } + $1 = ($1_ltype)MALLOC(sizeof($*1_ltype) * iRows * iCols); + for (i = 0; i < iRows * iCols; i++) { + $1[i] = ($*1_ltype) pTempData[i]; + } +} +%enddef +%define %scilab_asarrayandsize_withcopy(TYPEMAPTYPE, FRAGMENTNAME, CTYPE, TEMPDATATYPE) +%typemap(TYPEMAPTYPE, fragment="FRAGMENTNAME") CTYPE { + size_t i = 0; + int iRows = 0; + int iCols = 0; + TEMPDATATYPE *pTempData = NULL; + if (FRAGMENTNAME(pvApiCtx, $input, &iRows, &iCols, &pTempData, fname)) { + return SWIG_ERROR; + } + // TODO: add check to be sure iRows*iCols==$1_dim0 + for (i = 0; i < $1_dim0; i++) { + $1[i] = ($*1_ltype) pTempData[i]; + } +} +%enddef + + +/* + * Double + */ + +%scilab_asarrayandsize_withcopy(varin, SWIG_SciDouble_AsDoubleArrayAndSize, double[ANY], double); +%typemap(varout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") double[ANY] { + %set_output(SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%apply SWIGTYPE[] { double[] }; /* double[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciDouble_AsDoubleArrayAndSize, double[], double); + + +/* + * Signed char array + */ + +%typemap(in, fragment="SWIG_SciInt8_AsSignedCharArrayAndSize") signed char[] { + int iRows = 0; + int iCols = 0; + if (SWIG_SciInt8_AsSignedCharArrayAndSize(pvApiCtx, $input, &iRows, &iCols, &$1, fname) != SWIG_OK) { + return 0; + } +} +%typemap(varin, fragment="SWIG_SciInt8_AsSignedCharArrayAndSize") signed char[] { + int iRows = 0; + int iCols = 0; + if (SWIG_SciInt8_AsSignedCharArrayAndSize(pvApiCtx, $input, &iRows, &iCols, (signed char**)&$1, fname) != SWIG_OK) { + return 0; + } +} +%scilab_asarrayandsize_withcopy(varin, SWIG_SciInt8_AsSignedCharArrayAndSize, signed char[ANY], signed char); +%typemap(varout, noblock=1, fragment="SWIG_SciInt8_FromSignedCharArrayAndSize") signed char[ANY] { + %set_output(SWIG_SciInt8_FromSignedCharArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%typemap(varout, noblock=1, fragment="SWIG_SciInt8_FromSignedCharArrayAndSize") signed char[] { + %set_output(SWIG_SciInt8_FromSignedCharArrayAndSize(pvApiCtx, $result, 1, strlen((const char*)$1), $1)); +} + + +/* + * Unsigned char array + */ + +%typemap(in, fragment="SWIG_SciUint8_AsUnsignedCharArrayAndSize") unsigned char[] { + int iRows = 0; + int iCols = 0; + if (SWIG_SciUint8_AsUnsignedCharArrayAndSize(pvApiCtx, $input, &iRows, &iCols, &$1, fname) != SWIG_OK) { + return 0; + } +} +%typemap(varin, fragment="SWIG_SciUint8_AsUnsignedCharArrayAndSize") unsigned char[] { + int iRows = 0; + int iCols = 0; + if (SWIG_SciUint8_AsUnsignedCharArrayAndSize(pvApiCtx, $input, &iRows, &iCols, (unsigned char**)&$1, fname) != SWIG_OK) { + return 0; + } +} + +%scilab_asarrayandsize_withcopy(varin, SWIG_SciUint8_AsUnsignedCharArrayAndSize, unsigned char[ANY], unsigned char); +%typemap(varout, noblock=1, fragment="SWIG_SciUint8_FromUnsignedCharArrayAndSize") unsigned char[ANY] { + %set_output(SWIG_SciUint8_FromUnsignedCharArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%typemap(varout, noblock=1, fragment="SWIG_SciUint8_FromUnsignedCharArrayAndSize") unsigned char[] { + %set_output(SWIG_SciUint8_FromUnsignedCharArrayAndSize(pvApiCtx, $result, 1, strlen((const char*)$1), $1)); +} + + +/* + * Short array + */ + +%scilab_asarrayandsize_withcopy(varin, SWIG_SciInt16_AsShortArrayAndSize, short[ANY], short); +%typemap(varout, noblock=1, fragment="SWIG_SciInt16_FromShortArrayAndSize") short[ANY] { + %set_output(SWIG_SciInt16_FromShortArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%apply SWIGTYPE[] { short[] }; /* short[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciInt16_AsShortArrayAndSize, short[], short); + + +/* + * Unsigned short array + */ + +%scilab_asarrayandsize_withcopy(varin, SWIG_SciUint16_AsUnsignedShortArrayAndSize, unsigned short[ANY], unsigned short); +%typemap(varout, noblock=1, fragment="SWIG_SciUint16_FromUnsignedShortArrayAndSize") unsigned short[ANY] { + %set_output(SWIG_SciUint16_FromUnsignedShortArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%apply SWIGTYPE[] { unsigned short[] }; /* unsigned short[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciUint16_AsUnsignedShortArrayAndSize, unsigned short[], unsigned short); + + +/* + * Int array + */ + +%scilab_asarrayandsize_withcopy(varin, SWIG_SciInt32_AsIntArrayAndSize, int[ANY], int); +%typemap(varout, noblock=1, fragment="SWIG_SciInt32_FromIntArrayAndSize") int[ANY] { + %set_output(SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%apply SWIGTYPE[] { int[] }; /* int[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciInt32_AsIntArrayAndSize, int[], int); + + +/* + * Unsigned int array + */ + +%scilab_asarrayandsize_withcopy(varin, SWIG_SciUint32_AsUnsignedIntArrayAndSize, unsigned int[ANY], unsigned int); +%typemap(varout, noblock=1, fragment="SWIG_SciUint32_FromUnsignedIntArrayAndSize") unsigned int[ANY] { + %set_output(SWIG_SciUint32_FromUnsignedIntArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%apply SWIGTYPE[] { unsigned int[] }; /* unsigned int[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciUint32_AsUnsignedIntArrayAndSize, unsigned int[], unsigned int); + + +/* + * Long array + */ + +%scilab_asarrayandsize_withcopy(varin, SWIG_SciInt32_AsIntArrayAndSize, long[ANY], int); +%typemap(varout, noblock=1, fragment="SWIG_SciInt32_FromIntArrayAndSize") long[ANY] { + %set_output(SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, $result, 1, $1_dim0, (const int*) $1)); +} +%apply SWIGTYPE[] { long[] }; /* long[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciInt32_AsIntArrayAndSize, long[], int); + + +/* + * Unsigned long array + */ + +%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)); +} +%apply SWIGTYPE[] { unsigned long[] }; /* long[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciUint32_AsUnsignedIntArrayAndSize, unsigned long[], unsigned int); + + +/* + * Float array + */ + +%scilab_asarrayandsize_withcopy(varin, SWIG_SciDouble_AsFloatArrayAndSize, float[ANY], float); +%typemap(varout, noblock=1, fragment="SWIG_SciDouble_FromFloatArrayAndSize") float[ANY] { + %set_output(SWIG_SciDouble_FromFloatArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); +} +%apply SWIGTYPE[] { float[] }; /* float[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciDouble_AsFloatArrayAndSize, float[], float); + + +/* + * Bool array + */ + +%apply SWIGTYPE[] { bool[] }; /* bool[] variables managed as pointers */ +%scilab_asarray_withcopy(in, SWIG_SciBoolean_AsIntArrayAndSize, bool[], int); + + diff --git a/Lib/scilab/scifloat.swg b/Lib/scilab/scifloat.swg index e8e4f71da..0c6db9571 100644 --- a/Lib/scilab/scifloat.swg +++ b/Lib/scilab/scifloat.swg @@ -1,6 +1,7 @@ /* * FLOAT SCALAR */ + %fragment(SWIG_AsVal_frag(float), "header", fragment=SWIG_AsVal_frag(double)) { SWIGINTERN int SWIG_AsVal_dec(float)(SwigSciObject _iVar, float *_pfValue) { @@ -22,3 +23,60 @@ SWIG_From_dec(float)(float _flValue) { return SWIG_OK; } } + +%fragment("SWIG_SciDouble_AsFloatArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_AsFloatArrayAndSize(void *_pvApiCtx, int _iVar, int *_iRows, int *_iCols, float **_pfValue, char *_fname) { + SciErr sciErr; + int *piAddrVar = NULL; + double *pdValue = NULL; + + sciErr = getVarAddressFromPosition(_pvApiCtx, _iVar, &piAddrVar); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + if (isDoubleType(_pvApiCtx, piAddrVar) && !isVarComplex(_pvApiCtx, piAddrVar)) { + int i; + + sciErr = getMatrixOfDouble(_pvApiCtx, piAddrVar, _iRows, _iCols, &pdValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + *_pfValue = (float *) malloc((*_iRows) * (*_iCols) * sizeof(float)); + for (i=0; i < (*_iRows) * (*_iCols); i++) + (*_pfValue)[i] = (float) pdValue[i]; + + return SWIG_OK; + } + else { + Scierror(999, _("%s: Wrong type for input argument #%d: A real matrix expected.\n"), _fname, _iVar); + return SWIG_ERROR; + } +} +} + +%fragment("SWIG_SciDouble_FromFloatArrayAndSize", "header") { +SWIGINTERN int +SWIG_SciDouble_FromFloatArrayAndSize(void *_pvApiCtx, int _iVarOut, int _iRows, int _iCols, float *_pfValue) { + SciErr sciErr; + double *pdValue; + int i; + + pdValue = (double *) malloc(_iRows * _iCols * sizeof(double)); + for (i = 0; i < _iRows * _iCols; i++) + pdValue[i] = _pfValue[i]; + + sciErr = createMatrixOfDouble(_pvApiCtx, SWIG_NbInputArgument(_pvApiCtx) + _iVarOut, _iRows, _iCols, pdValue); + if (sciErr.iErr) { + printError(&sciErr, 0); + return SWIG_ERROR; + } + + free(pdValue); + return SWIG_OK; +} +} diff --git a/Lib/scilab/scitypemaps.swg b/Lib/scilab/scitypemaps.swg index bcb7c9465..78219201a 100644 --- a/Lib/scilab/scitypemaps.swg +++ b/Lib/scilab/scitypemaps.swg @@ -38,6 +38,7 @@ } } %enddef + %define %scilab_out_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) %typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { if (FRAGMENTNAME(pvApiCtx, $result, $1) != SWIG_OK) { @@ -45,6 +46,7 @@ } } %enddef + %define %scilab_outptr_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) %typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { if (FRAGMENTNAME(pvApiCtx, $result, %as_voidptr($1)) != SWIG_OK) { @@ -52,6 +54,7 @@ } } %enddef + %define %scilab_varout_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) %typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { if (FRAGMENTNAME(pvApiCtx, $result, $value) != SWIG_OK) { @@ -59,6 +62,7 @@ } } %enddef + %define %scilab_varoutptr_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) %typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { if (FRAGMENTNAME(pvApiCtx, $result, %as_voidptr($value)) != SWIG_OK) { @@ -67,9 +71,6 @@ } %enddef -/************************/ -/*** GENERIC TYPEMAPS ***/ -/************************/ %define %scilab_in_typemap(TYPEMAPTYPE, FRAGMENTNAME, CTYPE) %typemap(TYPEMAPTYPE, noblock=1, fragment="FRAGMENTNAME") CTYPE { if (FRAGMENTNAME(pvApiCtx, $input, &$1, fname) != SWIG_OK) { @@ -77,175 +78,9 @@ } } %enddef -%define %scilab_asarray_withcopy(TYPEMAPTYPE, FRAGMENTNAME, CTYPE, TEMPDATATYPE) -%typemap(TYPEMAPTYPE, fragment="FRAGMENTNAME") CTYPE { - size_t i = 0; - int iRows = 0; - int iCols = 0; - TEMPDATATYPE *pTempData = NULL; - if (FRAGMENTNAME(pvApiCtx, $input, &iRows, &iCols, &pTempData, fname)) { - return SWIG_ERROR; - } - $1 = ($1_ltype)MALLOC(sizeof($*1_ltype) * iRows * iCols); - for (i = 0; i < iRows * iCols; i++) { - $1[i] = ($*1_ltype) pTempData[i]; - } -} -%enddef -%define %scilab_asarrayandsize_withcopy(TYPEMAPTYPE, FRAGMENTNAME, CTYPE, TEMPDATATYPE) -%typemap(TYPEMAPTYPE, fragment="FRAGMENTNAME") CTYPE { - size_t i = 0; - int iRows = 0; - int iCols = 0; - TEMPDATATYPE *pTempData = NULL; - if (FRAGMENTNAME(pvApiCtx, $input, &iRows, &iCols, &pTempData, fname)) { - return SWIG_ERROR; - } - // TODO: add check to be sure iRows*iCols==$1_dim0 - for (i = 0; i < $1_dim0; i++) { - $1[i] = ($*1_ltype) pTempData[i]; - } -} -%enddef -/**************/ -/*** DOUBLE ***/ -/**************/ -%scilab_asarrayandsize_withcopy(varin, SWIG_SciDouble_AsDoubleArrayAndSize, double[ANY], double); -%typemap(varout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") double[ANY] { - %set_output(SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); -} -%apply SWIGTYPE[] { double[] }; /* double[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciDouble_AsDoubleArrayAndSize, double[], double); - -/*******************/ -/*** SIGNED CHAR ***/ -/*******************/ -%typemap(in, fragment="SWIG_SciInt8_AsSignedCharArrayAndSize") signed char[] { - int iRows = 0; - int iCols = 0; - if (SWIG_SciInt8_AsSignedCharArrayAndSize(pvApiCtx, $input, &iRows, &iCols, &$1, fname) != SWIG_OK) { - return 0; - } -} -%typemap(varin, fragment="SWIG_SciInt8_AsSignedCharArrayAndSize") signed char[] { - int iRows = 0; - int iCols = 0; - if (SWIG_SciInt8_AsSignedCharArrayAndSize(pvApiCtx, $input, &iRows, &iCols, (signed char**)&$1, fname) != SWIG_OK) { - return 0; - } -} -%scilab_asarrayandsize_withcopy(varin, SWIG_SciInt8_AsSignedCharArrayAndSize, signed char[ANY], signed char); -%typemap(varout, noblock=1, fragment="SWIG_SciInt8_FromSignedCharArrayAndSize") signed char[ANY] { - %set_output(SWIG_SciInt8_FromSignedCharArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); -} -%typemap(varout, noblock=1, fragment="SWIG_SciInt8_FromSignedCharArrayAndSize") signed char[] { - %set_output(SWIG_SciInt8_FromSignedCharArrayAndSize(pvApiCtx, $result, 1, strlen((const char*)$1), $1)); -} - -/*********************/ -/*** UNSIGNED CHAR ***/ -/*********************/ -%typemap(in, fragment="SWIG_SciUint8_AsUnsignedCharArrayAndSize") unsigned char[] { - int iRows = 0; - int iCols = 0; - if (SWIG_SciUint8_AsUnsignedCharArrayAndSize(pvApiCtx, $input, &iRows, &iCols, &$1, fname) != SWIG_OK) { - return 0; - } -} -%typemap(varin, fragment="SWIG_SciUint8_AsUnsignedCharArrayAndSize") unsigned char[] { - int iRows = 0; - int iCols = 0; - if (SWIG_SciUint8_AsUnsignedCharArrayAndSize(pvApiCtx, $input, &iRows, &iCols, (unsigned char**)&$1, fname) != SWIG_OK) { - return 0; - } -} - -%scilab_asarrayandsize_withcopy(varin, SWIG_SciUint8_AsUnsignedCharArrayAndSize, unsigned char[ANY], unsigned char); -%typemap(varout, noblock=1, fragment="SWIG_SciUint8_FromUnsignedCharArrayAndSize") unsigned char[ANY] { - %set_output(SWIG_SciUint8_FromUnsignedCharArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); -} -%typemap(varout, noblock=1, fragment="SWIG_SciUint8_FromUnsignedCharArrayAndSize") unsigned char[] { - %set_output(SWIG_SciUint8_FromUnsignedCharArrayAndSize(pvApiCtx, $result, 1, strlen((const char*)$1), $1)); -} - -/*************/ -/*** SHORT ***/ -/*************/ -%scilab_asarrayandsize_withcopy(varin, SWIG_SciInt16_AsShortArrayAndSize, short[ANY], short); -%typemap(varout, noblock=1, fragment="SWIG_SciInt16_FromShortArrayAndSize") short[ANY] { - %set_output(SWIG_SciInt16_FromShortArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); -} -%apply SWIGTYPE[] { short[] }; /* short[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciInt16_AsShortArrayAndSize, short[], short); - - - -/**********************/ -/*** UNSIGNED SHORT ***/ -/**********************/ -%scilab_asarrayandsize_withcopy(varin, SWIG_SciUint16_AsUnsignedShortArrayAndSize, unsigned short[ANY], unsigned short); -%typemap(varout, noblock=1, fragment="SWIG_SciUint16_FromUnsignedShortArrayAndSize") unsigned short[ANY] { - %set_output(SWIG_SciUint16_FromUnsignedShortArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); -} -%apply SWIGTYPE[] { unsigned short[] }; /* unsigned short[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciUint16_AsUnsignedShortArrayAndSize, unsigned short[], unsigned short); - -/***********/ -/*** INT ***/ -/***********/ -%scilab_asarrayandsize_withcopy(varin, SWIG_SciInt32_AsIntArrayAndSize, int[ANY], int); -%typemap(varout, noblock=1, fragment="SWIG_SciInt32_FromIntArrayAndSize") int[ANY] { - %set_output(SWIG_SciInt32_FromIntArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); -} -%apply SWIGTYPE[] { int[] }; /* int[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciInt32_AsIntArrayAndSize, int[], int); - -/********************/ -/*** UNSIGNED INT ***/ -/********************/ -%scilab_asarrayandsize_withcopy(varin, SWIG_SciUint32_AsUnsignedIntArrayAndSize, unsigned int[ANY], unsigned int); -%typemap(varout, noblock=1, fragment="SWIG_SciUint32_FromUnsignedIntArrayAndSize") unsigned int[ANY] { - %set_output(SWIG_SciUint32_FromUnsignedIntArrayAndSize(pvApiCtx, $result, 1, $1_dim0, $1)); -} -%apply SWIGTYPE[] { unsigned int[] }; /* unsigned int[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciUint32_AsUnsignedIntArrayAndSize, unsigned int[], unsigned int); - -/*************/ -/*** FLOAT ***/ -/*************/ -%scilab_asarrayandsize_withcopy(varin, SWIG_SciDouble_AsDoubleArrayAndSize, float[ANY], double); -%typemap(varout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") float[ANY] { - %set_output(SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, $result, 1, $1_dim0, (double*) $1)); -} -%apply SWIGTYPE[] { float[] }; /* float[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciDouble_AsDoubleArrayAndSize, float[], double); - -/************/ -/*** BOOL ***/ -/************/ -%apply SWIGTYPE[] { bool[] }; /* bool[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciBoolean_AsIntArrayAndSize, bool[], int); - -/************/ -/*** LONG ***/ -/************/ -%scilab_asarrayandsize_withcopy(varin, SWIG_SciDouble_AsDoubleArrayAndSize, long[ANY], double); -%typemap(varout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") long[ANY] { - %set_output(SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, $result, 1, $1_dim0, (double*) $1)); -} -%apply SWIGTYPE[] { long[] }; /* long[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciDouble_AsDoubleArrayAndSize, long[], double); - -/*********************/ -/*** UNSIGNED LONG ***/ -/*********************/ -%scilab_asarrayandsize_withcopy(varin, SWIG_SciDouble_AsDoubleArrayAndSize, unsigned long[ANY], double); -%typemap(varout, noblock=1, fragment="SWIG_SciDouble_FromDoubleArrayAndSize") unsigned long[ANY] { - %set_output(SWIG_SciDouble_FromDoubleArrayAndSize(pvApiCtx, $result, 1, $1_dim0, (double*) $1)); -} -%apply SWIGTYPE[] { unsigned long[] }; /* long[] variables managed as pointers */ -%scilab_asarray_withcopy(in, SWIG_SciDouble_AsDoubleArrayAndSize, unsigned long[], double); +/* Array typmemaps */ +%include "sciarray.swg" /* ----------------------------------------------------------------------------- * --- Use enum from Scilab ---