summaryrefslogtreecommitdiff
path: root/Lib
diff options
context:
space:
mode:
authorClément DAVID <clement.david@3ds.com>2023-04-19 09:32:02 +1200
committerOlly Betts <olly@survex.com>2023-04-19 09:32:41 +1200
commite1d59d0016f65cc4b15f0f1840b3beef5555267a (patch)
tree967f6cbe4855ad00f232d587bfa19840254c57a3 /Lib
parent5c165f5cc86a0906570f430ffe150ded072f78c9 (diff)
downloadswig-e1d59d0016f65cc4b15f0f1840b3beef5555267a.tar.gz
[scilab] Extract values with ":"
Fixes #894
Diffstat (limited to 'Lib')
-rw-r--r--Lib/scilab/scidouble.swg14
-rw-r--r--Lib/scilab/sciint.swg5
-rw-r--r--Lib/scilab/scimatrixdouble.swg12
-rw-r--r--Lib/scilab/scimatrixint.swg12
4 files changed, 38 insertions, 5 deletions
diff --git a/Lib/scilab/scidouble.swg b/Lib/scilab/scidouble.swg
index 1b8263306..e14c84647 100644
--- a/Lib/scilab/scidouble.swg
+++ b/Lib/scilab/scidouble.swg
@@ -56,6 +56,7 @@ SWIG_SciDouble_FromDouble(void *pvApiCtx, int iVarOut, double dblValue, char *fn
SWIGINTERN int
SWIG_SciDouble_AsDoubleArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *iCols, double **pdValue, char *fname) {
SciErr sciErr;
+ int iType = 0;
int *piAddrVar = NULL;
sciErr = getVarAddressFromPosition(pvApiCtx, iVar, &piAddrVar);
@@ -64,13 +65,24 @@ SWIG_SciDouble_AsDoubleArrayAndSize(void *pvApiCtx, int iVar, int *iRows, int *i
return SWIG_ERROR;
}
- if (isDoubleType(pvApiCtx, piAddrVar) && !isVarComplex(pvApiCtx, piAddrVar)) {
+ sciErr = getVarType(pvApiCtx, piAddrVar, &iType);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+
+ if (iType == sci_matrix && !isVarComplex(pvApiCtx, piAddrVar)) {
sciErr = getMatrixOfDouble(pvApiCtx, piAddrVar, iRows, iCols, pdValue);
if (sciErr.iErr) {
printError(&sciErr, 0);
return SWIG_ERROR;
}
}
+ else if (iType == sci_implicit_poly) {
+ *iRows = -1;
+ *iCols = 0;
+ *pdValue = NULL;
+ }
else {
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A real matrix expected.\n"), fname, iVar);
return SWIG_ERROR;
diff --git a/Lib/scilab/sciint.swg b/Lib/scilab/sciint.swg
index 2d6993569..b7b2563e8 100644
--- a/Lib/scilab/sciint.swg
+++ b/Lib/scilab/sciint.swg
@@ -157,6 +157,11 @@ SWIG_SciDoubleOrInt32_AsIntArrayAndSize(void *pvApiCtx, int iVar, int *iRows, in
return SWIG_ERROR;
}
}
+ else if (iType == sci_implicit_poly) {
+ *iRows = -1;
+ *iCols = 0;
+ *piValue = NULL;
+ }
else {
Scierror(SCILAB_API_ARGUMENT_ERROR, _("%s: Wrong type for input argument #%d: A 32-bit signed integer or a double matrix expected.\n"), fname, iVar);
return SWIG_ERROR;
diff --git a/Lib/scilab/scimatrixdouble.swg b/Lib/scilab/scimatrixdouble.swg
index 9444a8078..bb9403edd 100644
--- a/Lib/scilab/scimatrixdouble.swg
+++ b/Lib/scilab/scimatrixdouble.swg
@@ -28,7 +28,11 @@
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (double *IN, int IN_SIZE) (int rowCount, int colCount)
{
if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) {
- $2 = rowCount * colCount;
+ if (rowCount < 0) {
+ $2 = rowCount;
+ } else {
+ $2 = rowCount * colCount;
+ }
}
else {
return SWIG_ERROR;
@@ -40,7 +44,11 @@
%typemap(in, noblock=1, fragment="SWIG_SciDouble_AsDoubleArrayAndSize") (int IN_SIZE, double *IN) (int rowCount, int colCount)
{
if (SWIG_SciDouble_AsDoubleArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) {
- $1 = rowCount * colCount;
+ if (rowCount < 0) {
+ $1 = rowCount;
+ } else {
+ $1 = rowCount * colCount;
+ }
}
else {
return SWIG_ERROR;
diff --git a/Lib/scilab/scimatrixint.swg b/Lib/scilab/scimatrixint.swg
index e304d4f64..057710725 100644
--- a/Lib/scilab/scimatrixint.swg
+++ b/Lib/scilab/scimatrixint.swg
@@ -30,7 +30,11 @@
%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int *IN, int IN_SIZE) (int rowCount, int colCount)
{
if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$1, fname) == SWIG_OK) {
- $2 = rowCount * colCount;
+ if (rowCount < 0) {
+ $2 = rowCount;
+ } else {
+ $2 = rowCount * colCount;
+ }
}
else {
return SWIG_ERROR;
@@ -43,7 +47,11 @@
%typemap(in, noblock=1, fragment="SWIG_SciDoubleOrInt32_AsIntArrayAndSize") (int IN_SIZE, int *IN) (int rowCount, int colCount)
{
if (SWIG_SciDoubleOrInt32_AsIntArrayAndSize(pvApiCtx, $input, &rowCount, &colCount, &$2, fname) == SWIG_OK) {
- $1 = rowCount * colCount;
+ if (rowCount < 0) {
+ $1 = rowCount;
+ } else {
+ $1 = rowCount * colCount;
+ }
}
else {
return SWIG_ERROR;