Commit graph

4,235 commits

Author SHA1 Message Date
William S Fulton
4dd285fad7 Cosmetic rename SwigMovePointer -> SwigSmartPointer
This smart pointer doesn't really offer move semantics as is commonly
understood in C++11, so rename accordingly.
2022-06-16 08:02:02 +01:00
William S Fulton
088dc6e870 Add move assignment operator to SwigValueWrapper
Closes #2039
2022-06-16 08:02:02 +01:00
Olly Betts
d7ed1a8b97 [php] Eliminate sprintf to temp buffer to create ZVAL
Use zend_strpprintf() which handles this more cleanly without risk of
buffer overflow and without a fixed length limit.
2022-06-09 09:06:12 +12:00
William S Fulton
1d6f4b4eae Merge branch 'java-director-leak'
* java-director-leak:
  Cosmetic tidyup in SWIG_JAVA_DETACH_ON_THREAD_END code
  Java: Move auxiliary methods into JObjectWrapper.
  Java: Option to detach from the JVM in the thread destructor.

Conflicts:
	CHANGES.current
2022-05-28 10:24:08 +01:00
William S Fulton
aef97a5783 Cosmetic tidyup in SWIG_JAVA_DETACH_ON_THREAD_END code 2022-05-28 10:22:34 +01:00
William S Fulton
8e3f0fd793 Suppress -Wregister gcc warnings in Python.h
Such as:
/usr/include/python2.7/unicodeobject.h:534:24: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister]

Closes #2227
2022-05-27 20:01:57 +01:00
William S Fulton
7f009eddf0 Merge branch 'python'
* python:
  Define PY_SSIZE_T_CLEAN macro
  Python: define PY_SSIZE_T_CLEAN

Conflicts:
	CHANGES.current
2022-05-27 19:00:05 +01:00
William S Fulton
abc8e0bb27 Define PY_SSIZE_T_CLEAN macro
before #include "Python.h" as recommended in Python 3.7 and later.

Issue #2277
2022-05-27 18:58:04 +01:00
Joachim Kuebart
36dc81808b Java: Move auxiliary methods into JObjectWrapper. 2022-05-24 14:34:09 +02:00
Joachim Kuebart
b58c554cde Java: Option to detach from the JVM in the thread destructor. 2022-05-23 17:17:18 +02:00
William S Fulton
c359f57442 Better Octave typecheck for argc argv typemaps 2022-05-23 08:51:06 +01:00
Erez Geva
34221f223a Add Octave argcargv.i
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2022-05-21 23:07:58 +02:00
William S Fulton
d60724b636 Merge branch 'more_argcargv'
* more_argcargv:
  Document argc argv library
  argcargv.i cosmetic updates
  Typemaps for (int ARGC, char **ARGV) fixup
  Fix argcargv.i in Perl5, Tcl, PHP Add missing type map for type check. Add testing of argcargv.i for Perl5, Tcl, PHP and Ruby.
  Add Lua test for argcargv.i
  Add argcargv.i to more languages: Perl 5, Tcl, PHP
  Add argcargv.i to Lua
2022-05-15 19:42:25 +01:00
William S Fulton
6860e2bc03 Document argc argv library 2022-05-15 19:12:39 +01:00
William S Fulton
e4cdf9d98f argcargv.i cosmetic updates 2022-05-15 18:32:53 +01:00
William S Fulton
0307d0732c Typemaps for (int ARGC, char **ARGV) fixup
The default typemap should not be in this library file - this is for
users to add in if they want C default argument support.
2022-05-15 18:21:59 +01:00
William S Fulton
b15fed7d2d Merge branch 'erezgeva-master' into more_argcargv
* erezgeva-master:
  Add Lua test for argcargv.i
  Add argcargv.i to Lua
2022-05-14 06:54:45 +01:00
Erez Geva
b88fe498ca Fix argcargv.i in Perl5, Tcl, PHP
Add missing type map for type check.
Add testing of argcargv.i for Perl5, Tcl, PHP and Ruby.

Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2022-05-11 01:10:12 +02:00
Heinrich Schuchardt
ca6a73277b Python: define PY_SSIZE_T_CLEAN
It is recommended to always define PY_SSIZE_T_CLEAN before including
Python.h. Cf. https://docs.python.org/3/c-api/intro.html

This avoids errors like:

    SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-05-10 19:37:07 +02:00
William S Fulton
a598abe23d Java wstring throws typemap improvements
Unicode still not working, but works now for ASCII charset.
2022-05-07 08:16:48 +01:00
William S Fulton
72bb68d556 Visual C++ warning fix in Python < 3.2 builtin wrappers
Fixes:
warning C4311: 'type cast': pointer truncation from 'void *' to 'long'
warning C4302: 'type cast': truncation from 'void *' to 'long'
2022-05-07 06:22:25 +01:00
Erez Geva
464d548d71 Add argcargv.i to more languages: Perl 5, Tcl, PHP
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2022-05-06 23:15:06 +02:00
William S Fulton
07a9eece10
Merge pull request #2264 from KrisThielemans/tp_vectorcall_offset_Slot
[Python] Replace tp_print with tp_vectorcall_offset slot from Python 3.8
2022-05-06 20:04:11 +01:00
William S Fulton
72f7b82935 Correct warning message for wchar_t * typemaps
Use separate warning for char * and wchar_t * typemaps
SWIGWARN_TYPEMAP_CHARLEAK_MSG and SWIGWARN_TYPEMAP_WCHARLEAK_MSG
2022-05-06 18:44:02 +01:00
Konrad Eisele
f3ee3f2b12 Add argcargv.i to Lua
Found in https://stackoverflow.com/questions/9860362/swig-lua-call-mint-argv-char-argc
2022-05-06 13:26:17 +02:00
William S Fulton
bb39235c9c Add C# wchar_t * director typemaps
More Python std::wstring directors Python testing
2022-05-04 21:37:47 +01:00
William S Fulton
751d443046 C# std::wstring director support
Updates for #1706
2022-05-04 21:37:47 +01:00
tartanpaint
3377b63dad Fix line endings 2022-05-04 21:37:47 +01:00
tartanpaint
5b7447b20e Fix marshalling of std::wstring parameters in directors
std::wstring parameters on SWIG directors were being truncated to a single character due to marshalling inconsistencies.
This patch applies the same MarshalAs(UnmanagedType.LPWStr) attribute to director delegate methods and allows std::wstrings to be successfully received in the C# code via director calls.
2022-05-04 21:37:47 +01:00
William S Fulton
79a9389355 Add support for throwing wstring exceptions
Throw an ApplicationException for std::wstring and wchar_t * strings
2022-05-02 21:08:19 +01:00
William S Fulton
0fbd6cc364 wchar_t C# marshalling tweak
Use more appropriate unsigned short (2 byte type) pointer
for C# ctype instead of wchar_t pointer
2022-05-02 21:08:19 +01:00
William S Fulton
ed42422d1c Add support for wchar_t * and std::wstring Unicode strings on Linux
Initial contributions for Linux provided in issue #1233, modified to work
on both Windows and Linux. Dual support is possible by detecting
the sizeof wchar_t which is different on each of these systems.
2022-05-02 21:08:19 +01:00
Kris Thielemans
8dc4e3a8cb fix white-space 2022-04-28 08:00:42 +01:00
Kris Thielemans
f5934b099b [Python] Replace tp_print with tp_vectorcall_offset slot for Python 3.8
The tp_print slot is no longer supported and replaced with tp_vectorcall_offset.
The (printfunc) cast that we used caused problems on PyPy.

Fixes #2262
2022-04-21 12:28:54 +01:00
Robin Stocker
962f090001 Fix Ruby 3.2 warning "undefining the allocator of T_DATA class swig_runtime_data"
Ruby 3.2 (still in development) started warning about this, see
https://bugs.ruby-lang.org/issues/18007.

Note that the extension docs mention it in
https://ruby-doc.org/core-3.1.1/doc/extension_rdoc.html#label-C+struct+to+Ruby+object:

> The klass argument is the class for the object. The klass should
> derive from `rb_cObject`, and the allocator must be set by calling
> `rb_define_alloc_func` or `rb_undef_alloc_func`.

So in this case we call `rb_undef_alloc_func` to fix the warning.
Verified that this works in robinst/taglib-ruby#115.

Fixes #2257.
2022-04-12 08:32:42 +12:00
William S Fulton
e4c972c328
Merge pull request #2239 from igt-gteubl/csharp-capacity-cs0034
C#: Fix CS0034 in Capacity method of std::vector
2022-03-30 20:04:08 +01:00
William S Fulton
e1e4e4df28 Add rvalue reference typemaps for D 2022-03-28 19:25:17 +01:00
William S Fulton
d1b93f2c0e Merge branch 'feature/python-builtin-separate-runtime-data'
* feature/python-builtin-separate-runtime-data:
  Rework swig_and_compile_multi_cpp makefile helper
  Different capsule names for builtin changes entry
  Use different capsule names with and without -builtin

Conflicts:
	CHANGES.current
2022-03-26 15:18:55 +00:00
William S Fulton
f068f2c2d6 Add Python < 3.3 support for pyabc.i
pyabc.i for abstract base classes now supports versions of Python
prior to 3.3 by using the collection module for these older versions.
Python-3.3 and later continue to use the collections.abc module.
The -py3 option no longer has any effect on the %pythonabc feature.
2022-03-23 07:58:01 +00:00
Olly Betts
b2c58115d7 Fix previous commit
Revert changes inadvertently included, and fix `=` to `==`.
2022-03-20 19:44:23 +13:00
Olly Betts
029ddab8b5 [ci] Try to fix failing appveyor python builds 2022-03-20 18:42:50 +13:00
Eugene Toder
f733efd3c0 Use different capsule names with and without -builtin
Types generated with and without -builtin are not compatible. Mixing
them in a common type list leads to crashes. Avoid this by using
different capsule names: "type_pointer_capsule" without -builtin and
"type_pointer_capsule_builtin" with.

See #1684
2022-03-18 13:44:54 -04:00
gteubl
8a6290b12f Fix CS0034 in Capacity method of std::vector 2022-03-18 08:01:37 +01:00
William S Fulton
1da824ceff Fix compiler warning using Java std::wstring
Fixes: conversion from 'size_t' to 'jsize', possible loss of data
2022-03-16 22:32:53 +00:00
Olly Betts
2da3815f99 [Go] Make -intgosize optional
We no longer support Go < 1.2 so we can default intgo to ptrdiff_t
and uintgo to size_t.

Fixes #683
Fixes #2233
2022-03-16 18:30:05 +13:00
Ian Lance Taylor
0c0b93f8e0 [Go] add typemaps for std::string*
Fixes #2214
2022-03-15 20:30:53 -07:00
William S Fulton
dea0c3f0b2 Add some code comments about Python objects and capsule reference counting
Issue #2208
2022-03-15 08:46:20 +00:00
YungLee
31f7b437f4
[scilab] Fix to work on Windows
* Change the builder filename to match the loader filename

* Mark extern functions with SWIGEXPORT

* Fix bug: builder.sce not generated if with  '-scilab -builder'  option

Fixes #1853
2022-03-15 15:06:17 +13:00
Olly Betts
b4a92ae34f Fix SWIG_Py*Method_New conditional
This should be a SWIG-time conditional, but was inside %{ %} so was
instead a compile-time conditional.

Fix for bug in the changes in #2191
2022-03-14 12:49:41 +13:00
Ian Lance Taylor
70d530adfc swig -go: treat a nil argument as NULL
Let Go code pass "nil" when calling a C++ function that accepts a
pointer to a class.  The Go "nil" will be treated as a C++ "nullptr".

Fixes #2203
2022-03-08 15:15:05 -08:00