summaryrefslogtreecommitdiff
path: root/Lib
Commit message (Collapse)AuthorAgeFilesLines
* Update octrun.swg to work with Octave v8.1.0Andrea L2023-03-141-1/+5
|
* Merge pull request #2460 from swig-fortran/remove-python-sprintfWilliam S Fulton2022-12-301-3/+3
|\ | | | | [Python] Eliminate sprintf in generated code
| * Eliminate sprintf in generated python codeSeth R Johnson2022-12-061-3/+3
| | | | | | | | | | | | | | Newer clang versions emit warnings in generated code: ``` warning: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Wdeprecated-declarations] ```
* | Lua variadic templates sizeof... constants fixWilliam S Fulton2022-12-221-2/+2
|/
* Fix push/pop mismatchBernhard Rosenkränzer2022-11-291-0/+3
| | | | | | | | | Without this, perlhead.swg does `#pragma GCC diagnostic pop` if `__GNUC__ >= 10` - without any prior `#pragma GCC diagnostic push`. There's also a mismatch between the conditions that trigger `#pragma GCC diagnostic ignored` (where the `push` should be) and the attempt to `#pragma GCC diagnostic pop`.
* R rtypecheck typemapsWilliam S Fulton2022-11-051-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | Further switch to use rtypecheck typemaps instead of hard coded logic. The full switch to typemaps is deferred until swig-4.2 as it can't be fully backwards compatible. For now a warning is provided to help the transition. It provides the full typemap that should be placed into a user's interface file, for example: %typemap("rtype") int32_t * "integer" void testmethod(int32_t * i); void testmethod(); If there is no rtypecheck typemap for int32_t *, the warning shown is: example.i:7: Warning 750: Optional rtypecheck code is deprecated. Add the following typemap to fix as the next version of SWIG will not work without it: %typemap("rtypecheck") int32_t * %{ (is.integer($arg) || is.numeric($arg)) %} The warning is shown for any code that previously used "numeric", "integer" or "character" for the rtype typemap. Copying the rtypecheck typemap as shown into the user interface file will provide the appropriate fix and the warning will disappear. This is important to do as swig-4.2 will not be able to provide this helpful warning.
* Overloading fixes for R and rtypecheck typemapWilliam S Fulton2022-11-051-0/+6
| | | | | | | | - Fix for special variable $argtype expansion in rtypecheck typemap. - Remove unnecessary () brackets when using rtypecheck typemap for single parameter functions. - Add rtypecheck typemaps for shared_ptr so that NULL can be used in overloaded functions taking shared_ptr.
* Fix memory leak in R shared_ptr wrappersWilliam S Fulton2022-11-052-6/+16
| | | | | | | | | Fix leak when a cast up a class inheritance chain is required. Adds implementation of SWIG_ConvertPtrAndOwn for R. Closes #2386
* Use more portable PyUnicode_AsUTF8* methods.Clinton Stimpson2022-11-011-1/+8
| | | | | This supports the use of Py_LIMITED_API and also uses PyUnicode_AsUTF8AndSize if Py_LIMITED_API is set to 3.10 or newer.
* R shared_ptr fixesWilliam S Fulton2022-10-241-0/+19
| | | | | | | | Fix problems in shared_ptr wrappers where the class names were not consistent when using the shared_ptr template or the actual underlying type. Move $R_class substitution to typemaps. Issue #2386
* [python] Avoid undefined behaviourOlly Betts2022-10-201-5/+9
| | | | | | | Cast a parameter type explicitly rather than implicitly by casting the function pointer type, as the latter is undefined behaviour. Caught by ubsan.
* [Lua] Fix type resolution between SWIG-wrapped modulesOlly Betts2022-10-201-1/+1
| | | | See #2126
* [php] Fix handling of multi-module casesOlly Betts2022-10-181-1/+1
| | | | | | | | | | | | | | | | Look up unknown base classes using SWIG_MangledTypeQueryModule(). Revert to using SWIG_TypeCheck() instead of SWIG_TypeCheckStruct() as the latter doesn't seem to work for this case (at least for PHP right now). Add mod_runme.php as a regression test for this. Adjust the PHP test harness not to set up reflection for the module unless it's actually needed for a testcase. Currently the approach to find the module name doesn't work for multi-module testcases. See #2126
* R - Add support for std::vector<std::vector<std::string>>William S Fulton2022-10-171-3/+35
| | | | Closes #2385
* Fix for Java 7 - std::set and std::unordered_setWilliam S Fulton2022-10-152-0/+8
|
* Correct new Raise functions to be staticWilliam S Fulton2022-10-142-2/+2
|
* Remove STRING_VALUE to keep supporting older versions of RWilliam S Fulton2022-10-141-1/+1
| | | | | STRING_VALUE does not work with R_NO_REMAP in older versions (it broke 3.0.2)
* Merge branch 'fix-cast'William S Fulton2022-10-141-2/+2
|\ | | | | | | | | | | | | | | | | * fix-cast: add tests for new casting behavior skip tests when value is out of range refactor integers JS testcase to avoid repeating code Return uint64_t as double if is bigger than uint32_t Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match (#3)
| * Merge branch 'fix-cast' into masterSergio Garcia Murillo2021-11-2978-5876/+724
| |\
| * | Return uint64_t as double if is bigger than uint32_tSergio Garcia Murillo2021-11-291-2/+2
| | |
| * | Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match (#3)Sergio Garcia Murillo2021-03-051-1/+5
| | | | | | | | | Use SWIG_TypeCast in SWIG_V8_ConvertInstancePtr if types don't match
* | | Define PY_SSIZE_T_CLEAN only when not defined yetMichal Suchanek2022-10-132-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Users of swig 4.0.2 and python 3.10 will likely define the PY_SSIZE_T_CLEAN macro by hand when relevant because their bindings won't build otherwise. Unconditionally defining PY_SSIZE_T_CLEAN in swig 4.10 will lead to macro redefinition warning. Signed-off-by: Michal Suchanek <msuchanek@suse.de>
* | | Add missing SWIGTYPE *const& typemapsWilliam S Fulton2022-10-131-2/+7
| | |
* | | Cleanup SWIG_VERSION definitionWilliam S Fulton2022-10-1311-35/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Swig_obligatory_macros which must be called by each target language to define SWIG_VERSION correctly in the generated code, as well as the language specific macro SWIGXXX where XXX is the target language name. Drop the #ifdef SWIGXXX that was previously generated - I can't see the point of this and if users are defining this macro somehow, then users will need to change this Closes #1050
* | | Quick fix SWIG_VERSION not being defined correctly in wrappersWilliam S Fulton2022-10-131-1/+0
| | |
* | | Fix compile error when using directorsWilliam S Fulton2022-10-102-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | Fix when using templates with more than one template parameter and used as an input parameter in a virtual method in a director class (problem affecting most of the scripting languages). Fixes #2160
* | | Completely remove CFFIWilliam S Fulton2022-10-061-286/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | No meaningful progress to update CFFI to experimental status has been made since CFFI was disabled in SWIG-4.0.0 as the first stage to removal. This commit is the final stage to remove it. See issue #1966 for an attempt at updating CFFI to experimental status. Anyone wishing for SWIG to support CFFI again might want to utilise this work.
* | | Remove dead conditional codeOlly Betts2022-10-061-6/+0
| | | | | | | | | | | | | | | SWIG_POINTER_EXCEPTION has had the value zero since 2006 (it's only still present for backward compatibility).
* | | Use https for swig.org linksOlly Betts2022-10-061-1/+1
| | |
* | | [Python] Remove deprecated and apparently useless defarg.swgOlly Betts2022-10-062-38/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only documentation is in the file itself and describes a Python wrapper around the C function defined here, but digging though the git history this Python wrapper doesn't seem to have ever actually been generated by SWIG. This file was also marked as deprecated in 2005. Fixes #2390 Fixes #2391
* | | Merge branch 'python_subinterpreter_issues'William S Fulton2022-10-051-7/+13
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * python_subinterpreter_issues: added comment in CHANGES.current always get the type_pointer from capsule instead of using a static variable as the value may change after re-initilization/due to subinterpreters added interpreter_counter to deinitialize only once in case of subinterpreters Conflicts: CHANGES.current Lib/python/pyrun.swg
| * | | always get the type_pointer from capsule instead of using a static variablebenjamin-sch2022-02-081-7/+7
| | | | | | | | | | | | | | | | as the value may change after re-initilization/due to subinterpreters
| * | | added interpreter_counter to deinitialize only once in case of subinterpretersbenjamin-sch2022-02-081-0/+6
| | | |
* | | | Sort out predefined SWIG-specific macrosOlly Betts2022-10-0511-9/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ensure that SWIG_VERSION is defined both at SWIG-time and in the generated C/C++ wrapper code (it was only defined in the wrapper for some target languages previously). SWIGGO and SWIGJAVASCRIPT are now defined in the generated wrappers to match behaviour for all other target languages. Stop defining SWIGVERSION in the wrapper. This only happened as a side-effect of how SWIG_VERSION was defined but was never documented and is redundant. The new testcase also checks that SWIG is defined at SWIG-time but not in the generated wrapper, and that exactly one of a list of target-language specific macros is defined. Fixes #1050
* | | | C# CreateWStringFromUTF32 optimisationWilliam S Fulton2022-09-301-3/+1
| | | | | | | | | | | | | | | | | | | | Avoid UTF-32 to UTF-8 conversion then get string from UTF-8 Missing change that should have gone into eaf468e9e8d3ef17f397ef6bc5e73807a2bf3594
* | | | Runtime tables deterministic ordering (4)William S Fulton2022-09-291-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Output C/C++ type strings (| separated) in swig_type_info tables in fixed order. The types are output in alphabetically sorted order, with an exception. The final type is a fully resolved type, but does not necessarily include default template parameters. This type is the one used by SWIG_TypePrettyName which is commonly used to display a type when the wrong type is passed in as a parameter. Previously the order was not very deterministic due to the use of internal hash tables which do not have an ordering guarantee.
* | | | [php] Fix testcase segfaults with PHP 8.0Olly Betts2022-09-291-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These testcases were segfaulting: prefix director_using_member_scopes virtual_poly The fix here is admittedly a hack - we perform the initialisation of EG(class_table) from CG(class_table) which PHP will do, but hasn't yet. PHP doesn't seem to clearly document which API calls are actually valid in minit or other initialisation contexts, but the code we're generating works with all PHP 7.x and PHP 8.x versions aside from PHP 8.0 so it seems this is a bug in PHP 8.0 rather than that we're doing something invalid, and we need to work with existing PHP 8.0 releases so this hack seems a necessary evil. It will at least have a limited life as PHP 8.0 is only in active support until 2022-11-26, with security support ending a year later. Fixes #2383.
* | | | [php] Workaround PHP 8.2 header problemOlly Betts2022-09-281-2/+0
| | | | | | | | | | | | | | | | | | | | We need to include php.h before stdio.h (and probably before most other libc headers).
* | | | C# CreateWStringFromUTF32 optimisationWilliam S Fulton2022-09-221-2/+1
| | | | | | | | | | | | | | | | | | | | Avoid UTF-32 to UTF-8 conversion then get string from UTF-8 Issue #2369
* | | | Move SWIG_Octave_Raise into a functionWilliam S Fulton2022-09-191-2/+9
| | | | | | | | | | | | | | | | For efficiency and to fix some warnings
* | | | std::string throws typemapsWilliam S Fulton2022-09-194-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Go, Guile, Racket, Scilab: Add throws typemaps for std::string so that thrown string exception messages can be seen. Test all language for std::string throws typemaps
* | | | Add Racket throws typemaps for char *William S Fulton2022-09-191-0/+4
| | | |
* | | | Javascript v8 object to string exceptions improvementWilliam S Fulton2022-09-191-1/+1
| | | |
* | | | Javascript, Octave, R - Improve exceptions for %catchesWilliam S Fulton2022-09-196-11/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and exception specifications for native types. Now the raised exception contains the string value as the exception message instead of just the C/C++ type of the exception. R exceptions were completely swallowed beforehand
* | | | Add missing typecheck typemaps for std::auto_ptr and std::unique_ptrWilliam S Fulton2022-09-1728-0/+144
| | | | | | | | | | | | | | | | To fix overloading when using these types.
* | | | Correct error handling in Guile pointer conversionWilliam S Fulton2022-09-161-0/+2
| | | |
* | | | Guile - Add error checking to SWIGTYPE and SWIGTYPE & in typemapsWilliam S Fulton2022-09-161-2/+8
| | | | | | | | | | | | | | | | To prevent seg faults when passing #nil to these parameter types.
* | | | Provide SWIGTYPE MOVE typemaps in swigmove.iWilliam S Fulton2022-09-1620-0/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For implementing full move semantics when passing parameters by value. Based on SWIGTYPE && and std::unique_ptr typemaps which implement move semantics. Added for all languages, but untested for: Go, Ocaml, R, Scilab (and unlikely to be fully functional for same reasons as for std::unique_ptr support). Issue #999
* | | | Update comments re _DEBUG redefinition before including Python.hWilliam S Fulton2022-09-091-3/+2
| | | |
* | | | Move SwigValueWrapper to header sectionWilliam S Fulton2022-09-091-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Recent change to SwigValueWrapper required the <utility> header. Included headers should be after the include of the language specific header files (which go into the earlier runtime section). Testcase required -Winit-list-lifetime warning suppression change for Perl which somehow lost the warning suppression when put into the %begin section.