diff options
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/php/const.i | 2 | ||||
-rw-r--r-- | Lib/php/phprun.swg | 67 | ||||
-rw-r--r-- | Lib/ruby/rubyrun.swg | 2 | ||||
-rw-r--r-- | Lib/scilab/scidouble.swg | 14 | ||||
-rw-r--r-- | Lib/scilab/sciint.swg | 5 | ||||
-rw-r--r-- | Lib/scilab/scimatrixdouble.swg | 12 | ||||
-rw-r--r-- | Lib/scilab/scimatrixint.swg | 12 |
7 files changed, 42 insertions, 72 deletions
diff --git a/Lib/php/const.i b/Lib/php/const.i index a74af0d78..1e1fe9cad 100644 --- a/Lib/php/const.i +++ b/Lib/php/const.i @@ -95,7 +95,7 @@ SWIG_SetPointerZval(&c.value, (void*)($value), $1_descriptor, 0); zval_copy_ctor(&c.value); c.name = zend_string_init("$symname", sizeof("$symname") - 1, 0); - SWIG_ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number); + ZEND_CONSTANT_SET_FLAGS(&c, CONST_CS, module_number); zend_register_constant(&c); } diff --git a/Lib/php/phprun.swg b/Lib/php/phprun.swg index d3ad0d26a..588701f9b 100644 --- a/Lib/php/phprun.swg +++ b/Lib/php/phprun.swg @@ -10,35 +10,14 @@ extern "C" { #endif -#if PHP_MAJOR_VERSION < 7 -# error These bindings need PHP 7 or later - to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5 +#if PHP_MAJOR_VERSION < 8 +# error These bindings need PHP 8 or later - to generate PHP7 bindings use SWIG < 4.1.0; to generate PHP5 bindings use: SWIG < 4.0.0 and swig -php5 #endif #include "zend_inheritance.h" #include "zend_exceptions.h" #include "zend_inheritance.h" -#if PHP_MAJOR_VERSION == 7 -/* These macros were new in PHP 8.0. For PHP 7.x we define them to give the - * same result except without any type declarations. PHP 7.x supports type - * declarations, but not for the return type, and alternate types aren't - * supported, so we don't try to support these. - */ -# define ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(name, byref, num_req, classes, types) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, byref, num_req) -# define ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(name, byref, num_req, types) \ - ZEND_BEGIN_ARG_INFO_EX(name, 0, byref, num_req) - -/* NB We can just ignore `default` here we currently always pass NULL for it - * (this mechanism for specifying default parameter values was new in PHP 8.0 - * so it's not useful while we still want to support PHP7 too). - */ -# define ZEND_ARG_OBJ_TYPE_MASK(byref, name, classes, types, default) \ - ZEND_ARG_INFO(byref, name) -# define ZEND_ARG_TYPE_MASK(byref, name, types, default) \ - ZEND_ARG_INFO(byref, name) -#endif - #include <stdlib.h> /* for abort(), used in generated code. */ #define SWIG_BOOL_CONSTANT(N, V) REGISTER_BOOL_CONSTANT(#N, V, CONST_CS | CONST_PERSISTENT) @@ -50,27 +29,6 @@ extern "C" { REGISTER_STRINGL_CONSTANT(#N, &swig_char, 1, CONST_CS | CONST_PERSISTENT);\ } while (0) -/* ZEND_CONSTANT_SET_FLAGS was new in PHP 7.3. */ -#ifdef ZEND_CONSTANT_SET_FLAGS -# define SWIG_ZEND_CONSTANT_SET_FLAGS ZEND_CONSTANT_SET_FLAGS -#else -# define SWIG_ZEND_CONSTANT_SET_FLAGS(C, F, N) do { (C)->flags = (F); (C)->module_number = (N); } while (0) -#endif - -/* zend_object_alloc was new in PHP 7.3. */ -#if PHP_MAJOR_VERSION == 7 && PHP_MINOR_VERSION < 3 -static zend_always_inline void *zend_object_alloc(size_t obj_size, zend_class_entry *ce) { - void *obj = emalloc(obj_size + zend_object_properties_size(ce)); - memset(obj, 0, obj_size - sizeof(zval)); - return obj; -} -#endif - -/* ZEND_THIS was new in PHP 7.4. */ -#ifndef ZEND_THIS -# define ZEND_THIS &EX(This) -#endif - #ifdef __cplusplus } #endif @@ -93,27 +51,6 @@ static int default_error_code = E_ERROR; static zend_class_entry SWIG_Php_swig_wrapped_interface_ce; -#if PHP_MAJOR_VERSION == 7 -/* zend_class_implements_interface() was new in PHP 8.0. - * - * We could use instanceof_function_ex(C, I, 1) here for 7.4, but for 7.3 - * and earlier that doesn't work, so instead we just provide a compatibility - * implementation which does what zend_class_implements_interface() does in 8.x - * and use that for all 7.x so there are fewer variants to worry about testing. - */ -static int zend_class_implements_interface(const zend_class_entry *class_ce, const zend_class_entry *interface_ce) { - uint32_t i; - if (class_ce->num_interfaces) { - for (i = 0; i < class_ce->num_interfaces; i++) { - if (class_ce->interfaces[i] == interface_ce) { - return 1; - } - } - } - return 0; -} -#endif - /* used to wrap returned objects in so we know whether they are newobject and need freeing, or not */ typedef struct { diff --git a/Lib/ruby/rubyrun.swg b/Lib/ruby/rubyrun.swg index 6cac4626a..885292481 100644 --- a/Lib/ruby/rubyrun.swg +++ b/Lib/ruby/rubyrun.swg @@ -157,7 +157,7 @@ SWIG_Ruby_define_class(swig_type_info *type) _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject); rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new"); } - rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer); + rb_undef_alloc_func(rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer)); free((void *) klass_name); } 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; |