aboutsummaryrefslogtreecommitdiff
path: root/Lib/scilab
diff options
context:
space:
mode:
authorAlistair Delva <adelva@google.com>2024-04-10 14:15:29 -0700
committerAlistair Delva <adelva@google.com>2024-04-11 12:58:28 -0700
commitd0f0f90be16c2ac553b5fa08512045273135147a (patch)
tree5d9ebb7a04807ea8a609ddd18b0162bc87530e4b /Lib/scilab
parent6ffc1dbf29ba98c4d8aa71ebc9b484e973fe1030 (diff)
downloadswig-d0f0f90be16c2ac553b5fa08512045273135147a.tar.gz
Update to v4.2.1HEADmastermain
Change-Id: I47cef2be94299220d80265d949a95b58eee2c23b
Diffstat (limited to 'Lib/scilab')
-rw-r--r--Lib/scilab/argcargv.i109
-rw-r--r--Lib/scilab/boost_shared_ptr.i6
-rw-r--r--Lib/scilab/sciarray.swg4
-rw-r--r--Lib/scilab/scidouble.swg14
-rw-r--r--Lib/scilab/scienum.swg2
-rw-r--r--Lib/scilab/sciexception.swg9
-rw-r--r--Lib/scilab/sciint.swg5
-rw-r--r--Lib/scilab/scimatrixdouble.swg12
-rw-r--r--Lib/scilab/scimatrixint.swg12
-rw-r--r--Lib/scilab/scirun.swg43
-rw-r--r--Lib/scilab/sciruntime.swg2
-rw-r--r--Lib/scilab/std_map.i17
-rw-r--r--Lib/scilab/std_string.i8
-rw-r--r--Lib/scilab/swigmove.i1
14 files changed, 192 insertions, 52 deletions
diff --git a/Lib/scilab/argcargv.i b/Lib/scilab/argcargv.i
new file mode 100644
index 000000000..9aeda1a72
--- /dev/null
+++ b/Lib/scilab/argcargv.i
@@ -0,0 +1,109 @@
+/* -------------------------------------------------------------
+ * SWIG library containing argc and argv multi-argument typemaps
+ * ------------------------------------------------------------- */
+
+%{
+SWIGINTERN int SWIG_AsVal_strings (SwigSciObject iVar, int **array, int report) {
+ int iType = 0;
+ SciErr sciErr = getVarAddressFromPosition(pvApiCtx, iVar, array);
+ if (sciErr.iErr) {
+ if (report) printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+ sciErr = getVarType(pvApiCtx, *array, &iType);
+ if (sciErr.iErr) {
+ if (report) printError(&sciErr, 0);
+ return SWIG_ERROR;
+ }
+ if (iType != sci_strings) {
+ /* An empty matrix has type sci_matrix. */
+ if (!isEmptyMatrix(pvApiCtx, *array)) {
+ return SWIG_TypeError;
+ }
+ *array = SWIG_NULLPTR;
+ }
+ return SWIG_OK;
+}
+%}
+
+%typemap(in) (int ARGC, char **ARGV) {
+ SciErr sciErr;
+ size_t memsize;
+ int i, rows, cols, res, len, *aLen, *array;
+ res = SWIG_AsVal_strings ($input, &array, 1);
+ if (!SWIG_IsOK(res)) {
+ if (res == SWIG_TypeError) {
+ SWIG_exception_fail(SWIG_TypeError, "not a string matrix");
+ }
+ SWIG_fail;
+ }
+
+ if (array == SWIG_NULLPTR) {
+ /* Special case for empty matrix. */
+ $1 = 0;
+ $2 = ($2_ltype) malloc(sizeof($*2_ltype));
+ $2[0] = SWIG_NULLPTR;
+ } else {
+ /* first call to retrieve dimensions */
+ rows = 0;
+ cols = 0;
+ sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, SWIG_NULLPTR, SWIG_NULLPTR);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ SWIG_fail;
+ }
+ len = rows * cols;
+ memsize = sizeof(int) * len;
+ aLen = (int*)malloc(memsize);
+ if (aLen == SWIG_NULLPTR) {
+ SWIG_exception_fail(SWIG_MemoryError, "fail allocate sizes array");
+ }
+ memset(aLen, 0, memsize);
+ /*second call to retrieve length of each string */
+ sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, aLen, SWIG_NULLPTR);
+ if (sciErr.iErr) {
+ printError(&sciErr, 0);
+ free((void *)aLen);
+ SWIG_fail;
+ }
+ memsize = sizeof($*2_ltype) * (len + 1);
+ $1 = ($1_ltype) len;
+ $2 = ($2_ltype) malloc(memsize);
+ if ($2 == SWIG_NULLPTR) {
+ free((void *)aLen);
+ SWIG_exception_fail(SWIG_MemoryError, "fail allocate array");
+ }
+ memset($2, 0, memsize);
+ for(i = 0 ; i < len ; i++) {
+ $2[i] = ($*2_ltype)malloc(aLen[i] + 1);
+ if ($2[i] == SWIG_NULLPTR) {
+ free((void *)aLen);
+ SWIG_exception_fail(SWIG_MemoryError, "fail allocate array string element");
+ }
+ }
+ /* third call to retrieve data */
+ sciErr = getMatrixOfString(pvApiCtx, array, &rows, &cols, aLen, $2);
+ if(sciErr.iErr) {
+ printError(&sciErr, 0);
+ free((void *)aLen);
+ SWIG_fail;
+ }
+ $2[len] = SWIG_NULLPTR;
+ free((void *)aLen);
+ }
+}
+
+%typemap(typecheck, precedence=SWIG_TYPECHECK_STRING_ARRAY) (int ARGC, char **ARGV) {
+ int *array;
+ $1 = SWIG_IsOK(SWIG_AsVal_strings ($input, &array, 0));
+}
+
+%typemap(freearg) (int ARGC, char **ARGV) {
+ if ($2 != SWIG_NULLPTR) {
+ $1_ltype i;
+ for (i = 0; i < $1; i++) {
+ free((void *)$2[i]);
+ }
+ free((void *)$2);
+ }
+}
diff --git a/Lib/scilab/boost_shared_ptr.i b/Lib/scilab/boost_shared_ptr.i
index 668bf4354..87c89b5f9 100644
--- a/Lib/scilab/boost_shared_ptr.i
+++ b/Lib/scilab/boost_shared_ptr.i
@@ -35,7 +35,7 @@
}
}
%typemap(out) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1));
%set_output(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
@@ -54,12 +54,12 @@
}
}
%typemap(varout) CONST TYPE {
- SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartresult = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype($1));
%set_varoutput(SWIG_NewPointerObj(%as_voidptr(smartresult), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN));
}
%typemap(directorin,noblock=1) CONST TYPE (SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE > *smartarg = 0) %{
- smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(($1_ltype &)$1));
+ smartarg = new SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< CONST TYPE >(new $1_ltype(SWIG_STD_MOVE($1)));
$input = SWIG_NewPointerObj(%as_voidptr(smartarg), $descriptor(SWIG_SHARED_PTR_QNAMESPACE::shared_ptr< TYPE > *), SWIG_POINTER_OWN | %newpointer_flags);
%}
%typemap(directorout,noblock=1) CONST TYPE (void *swig_argp, int swig_res = 0) {
diff --git a/Lib/scilab/sciarray.swg b/Lib/scilab/sciarray.swg
index c00e3837e..97b30a29e 100644
--- a/Lib/scilab/sciarray.swg
+++ b/Lib/scilab/sciarray.swg
@@ -40,8 +40,8 @@
}
else {
char errmsg[100];
- sprintf(errmsg, "Size of input data (%d) is too big (maximum is %d)",
- iRows*iCols, $1_dim0);
+ SWIG_snprintf2(errmsg, sizeof(errmsg), "Size of input data (%d) is too big (maximum is %d)",
+ iRows*iCols, $1_dim0);
SWIG_exception_fail(SWIG_OverflowError, errmsg);
}
}
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/scienum.swg b/Lib/scilab/scienum.swg
index 54ec1f85c..cc1f7c977 100644
--- a/Lib/scilab/scienum.swg
+++ b/Lib/scilab/scienum.swg
@@ -18,7 +18,7 @@ SWIG_Int_AsEnum(void *pvApiCtx, int iVar, int *enumValue, char *fname) {
}
%fragment(SWIG_From_frag(Enum), "header", fragment="SWIG_Int_FromEnum") {
-%#define SWIG_From_Enum(scilabValue) SWIG_Int_FromEnum(pvApiCtx, SWIG_Scilab_GetOutputPosition(), scilabValue, SWIG_Scilab_GetFuncName())
+%#define SWIG_From_Enum(scilabValue) SWIG_Int_FromEnum(pvApiCtx, SWIG_Scilab_GetOutputPosition(), (int)scilabValue, SWIG_Scilab_GetFuncName())
}
%fragment("SWIG_Int_FromEnum", "header", fragment="SWIG_SciDouble_FromInt") {
SWIGINTERN int
diff --git a/Lib/scilab/sciexception.swg b/Lib/scilab/sciexception.swg
index 1d653b314..9b842cf2f 100644
--- a/Lib/scilab/sciexception.swg
+++ b/Lib/scilab/sciexception.swg
@@ -17,20 +17,20 @@
size_t, size_t&,
ptrdiff_t, ptrdiff_t& {
char obj[20];
- sprintf(obj, "%d", (int)$1);
+ SWIG_snprintf(obj, sizeof(obj), "%d", (int)$1);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
%typemap(throws, noblock=1) enum SWIGTYPE {
char obj[20];
- sprintf(obj, "%d", (int)$1);
+ SWIG_snprintf(obj, sizeof(obj), "%d", (int)$1);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
%typemap(throws, noblock=1) float, double,
float&, double& {
char obj[20];
- sprintf(obj, "%5.3f", (double)$1);
+ SWIG_snprintf(obj, sizeof(obj), "%5.3f", (double)$1);
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
@@ -44,7 +44,8 @@
%typemap(throws, noblock=1) char, char& {
char obj[2];
- sprintf(obj, "%c", (char)$1);
+ obj[0] = (char)$1;
+ obj[1] = 0;
SWIG_Scilab_Raise_Ex(obj, "$type", $descriptor);
}
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;
diff --git a/Lib/scilab/scirun.swg b/Lib/scilab/scirun.swg
index 51df9a59e..481aac7ac 100644
--- a/Lib/scilab/scirun.swg
+++ b/Lib/scilab/scirun.swg
@@ -5,7 +5,6 @@
/* Scilab version macro */
#include "version.h"
-#define SWIG_SCILAB_VERSION (SCI_VERSION_MAJOR * 100) + (SCI_VERSION_MINOR * 10) + SCI_VERSION_MAINTENANCE
/* Scilab standard headers */
@@ -13,11 +12,11 @@
extern "C" {
#endif
#include "api_scilab.h"
-#if SWIG_SCILAB_VERSION < 540
+#if SCI_VERSION_MAJOR < 5 || SCI_VERSION_MAJOR == 5 && SCI_VERSION_MINOR < 4
#define __USE_DEPRECATED_STACK_FUNCTIONS__
#include "stack-c.h"
#endif
-#if SWIG_SCILAB_VERSION < 600
+#if SCI_VERSION_MAJOR < 6
#include "MALLOC.h"
#endif
#include "Scierror.h"
@@ -31,12 +30,12 @@ extern "C" {
/* Gateway signature */
-#if SWIG_SCILAB_VERSION >= 600
-#define SWIG_GatewayParameters char* fname, void *pvApiCtx
-#define SWIG_GatewayArguments fname, pvApiCtx
-#else
+#if SCI_VERSION_MAJOR < 6
#define SWIG_GatewayParameters char* fname, unsigned long fname_len
#define SWIG_GatewayArguments fname, fname_len
+# else
+#define SWIG_GatewayParameters char* fname, void *pvApiCtx
+#define SWIG_GatewayArguments fname, pvApiCtx
#endif
/* Function name management functions */
@@ -47,10 +46,8 @@ static char *SWIG_Scilab_GetFuncName(void) {
return SwigFuncName;
}
static void SWIG_Scilab_SetFuncName(char *funcName) {
- if (SwigFuncName != NULL) {
- free(SwigFuncName);
- SwigFuncName = NULL;
- }
+ free(SwigFuncName);
+ SwigFuncName = NULL;
if (funcName) {
SwigFuncName = (char *)malloc(strlen(funcName) + 1);
if (SwigFuncName)
@@ -60,29 +57,29 @@ static void SWIG_Scilab_SetFuncName(char *funcName) {
/* Api context management functions */
-#if SWIG_SCILAB_VERSION >= 600
+#if SCI_VERSION_MAJOR < 6
+#define SWIG_Scilab_SetApiContext(apiCtx)
+#else
static void *pvApiCtx = NULL;
static void SWIG_Scilab_SetApiContext(void *apiCtx) {
pvApiCtx = apiCtx;
}
-#else
-#define SWIG_Scilab_SetApiContext(apiCtx)
#endif
/* Argument management functions */
-#if SWIG_SCILAB_VERSION >= 540
-#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument)
-#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument)
-#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument)
-#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx)
-#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos
-#else
+#if SCI_VERSION_MAJOR < 5 || SCI_VERSION_MAJOR == 5 && SCI_VERSION_MINOR < 4
#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckRhs(minInputArgument, maxInputArgument)
#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckRhs(minInputArgument, 256)
#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckLhs(minOutputArgument, maxOutputArgument)
#define SWIG_NbInputArgument(pvApiCtx) Rhs
#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) LhsVar(outputArgumentPos) = argumentPos
+#else
+#define SWIG_CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument) CheckInputArgument(pvApiCtx, minInputArgument, maxInputArgument)
+#define SWIG_CheckInputArgumentAtLeast(pvApiCtx, minInputArgument) CheckInputArgumentAtLeast(pvApiCtx, minInputArgument)
+#define SWIG_CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument) CheckOutputArgument(pvApiCtx, minOutputArgument, maxOutputArgument)
+#define SWIG_NbInputArgument(pvApiCtx) nbInputArgument(pvApiCtx)
+#define SWIG_AssignOutputArgument(pvApiCtx, outputArgumentPos, argumentPos) AssignOutputVariable(pvApiCtx, outputArgumentPos) = argumentPos
#endif
typedef int SwigSciObject;
@@ -436,7 +433,7 @@ SWIG_Scilab_NewMemberObj(void *pvApiCtx, int iVarOut, void *ptr, int sz, swig_ty
#ifdef __cplusplus
extern "C"
#endif
-int SWIG_this(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_this(SWIG_GatewayParameters) {
void *ptrValue = NULL;
if (SwigScilabPtrToObject(pvApiCtx, 1, &ptrValue, NULL, 0, fname) == SWIG_OK) {
SWIG_Scilab_SetOutputPosition(1);
@@ -453,7 +450,7 @@ int SWIG_this(SWIG_GatewayParameters) {
#ifdef __cplusplus
extern "C"
#endif
-int SWIG_ptr(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_ptr(SWIG_GatewayParameters) {
if (SWIG_NbInputArgument(pvApiCtx) > 0) {
SciErr sciErr;
int *piAddrVar1 = NULL;
diff --git a/Lib/scilab/sciruntime.swg b/Lib/scilab/sciruntime.swg
index 3de138e11..e772926f7 100644
--- a/Lib/scilab/sciruntime.swg
+++ b/Lib/scilab/sciruntime.swg
@@ -40,7 +40,7 @@ SWIG_Scilab_TypeQuery(const char *name) {
#ifdef __cplusplus
extern "C"
#endif
-int <module>_Init(SWIG_GatewayParameters) {
+SWIGEXPORT int SWIG_<module>_Init(SWIG_GatewayParameters) {
SWIG_InitializeModule(NULL);
SWIG_CreateScilabVariables(pvApiCtx);
swig_module_initialized = 1;
diff --git a/Lib/scilab/std_map.i b/Lib/scilab/std_map.i
index 07eb63fda..aeede6076 100644
--- a/Lib/scilab/std_map.i
+++ b/Lib/scilab/std_map.i
@@ -47,7 +47,11 @@ namespace std {
throw std::out_of_range("key not found");
}
void set(const K& key, const T& x) {
+%#ifdef __cpp_lib_map_try_emplace
+ (*self).insert_or_assign(key, x);
+%#else
(*self)[key] = x;
+%#endif
}
void del(const K& key) throw (std::out_of_range) {
std::map< K, T, C >::iterator i = self->find(key);
@@ -63,17 +67,4 @@ namespace std {
}
};
-// Legacy macros (deprecated)
-%define specialize_std_map_on_key(K,CHECK,CONVERT_FROM,CONVERT_TO)
-#warning "specialize_std_map_on_key ignored - macro is deprecated and no longer necessary"
-%enddef
-
-%define specialize_std_map_on_value(T,CHECK,CONVERT_FROM,CONVERT_TO)
-#warning "specialize_std_map_on_value ignored - macro is deprecated and no longer necessary"
-%enddef
-
-%define specialize_std_map_on_both(K,CHECK_K,CONVERT_K_FROM,CONVERT_K_TO, T,CHECK_T,CONVERT_T_FROM,CONVERT_T_TO)
-#warning "specialize_std_map_on_both ignored - macro is deprecated and no longer necessary"
-%enddef
-
}
diff --git a/Lib/scilab/std_string.i b/Lib/scilab/std_string.i
index 71ac6d2f4..8736c2a28 100644
--- a/Lib/scilab/std_string.i
+++ b/Lib/scilab/std_string.i
@@ -37,3 +37,11 @@ SWIG_From_dec(std::string)(std::string pstValue) {
}
%include <typemaps/std_string.swg>
+
+%typemap(throws, noblock=1) std::string {
+ SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $&descriptor);
+}
+
+%typemap(throws, noblock=1) const std::string & {
+ SWIG_Scilab_Raise_Ex($1.c_str(), "$type", $descriptor);
+}
diff --git a/Lib/scilab/swigmove.i b/Lib/scilab/swigmove.i
new file mode 100644
index 000000000..62ecca768
--- /dev/null
+++ b/Lib/scilab/swigmove.i
@@ -0,0 +1 @@
+%include <typemaps/swigmove.swg>