Commit graph

22,561 commits

Author SHA1 Message Date
benjamin-sch
a2992fe42e always get the type_pointer from capsule instead of using a static variable
as the value may change after re-initilization/due to subinterpreters
2022-02-08 09:09:17 +01:00
benjamin-sch
a9f76c89ec added interpreter_counter to deinitialize only once in case of subinterpreters 2022-02-08 09:09:00 +01:00
William S Fulton
a5315e1159 gcc warning fix
warning: control reaches end of non-void function [-Wreturn-type]
2022-02-07 21:50:13 +00:00
William S Fulton
d59cbf1c39 Fragments: additional testing and documentation enhancements
Add test for original syntax when using a single fragment key containing
the list of dependent fragments. I couldn't find a test for this.

Spaces in the fragment list don't seem to work - document it.
2022-02-07 21:45:33 +00:00
William S Fulton
013be550ed Merge branch 'fragment-typemap' into upstream-master
* fragment-typemap:
  Add documentation
  Enable multiple 'fragment' keywords to be attached to typemaps
2022-02-07 20:35:08 +00:00
Olly Betts
467c530e65 Remove support for the "command" encoder
The "command" encoder was mostly intended for use in `%rename` - most
uses can be achieved using the "regex" encoder, so we recommend using
that instead.

The "command" encoder suffers from a number of issues - as the
documentation for it admitted, "[it] is extremely slow compared to all
the other [encoders] as it involves spawning a separate process and
using it for many declarations is not recommended" and that it "should
generally be avoided because of performance considerations".

But it's also not portable.  The design assumes that `/bin/sh` supports
`<<<` but that's a bash-specific feature so it doesn't work on platforms
where `/bin/sh` is not bash - it fails on Debian, Ubuntu and probably
some other Linux distros, plus most non-Linux platforms.  Microsoft
Windows doesn't even have a /bin/sh as standard.

Finally, no escaping of the passed string is done, so it has potential
security issues (though at least with %rename the input is limited to
valid C/C++ symbol names).

Fixes #1806
2022-02-07 09:47:01 +13:00
Olly Betts
d47970e2fd Fix problem with recent commit
I failed to fully remove the conditional from one example in
1a03840172.
2022-02-06 16:50:30 +13:00
Seth R Johnson
6c41db3b8c Add documentation 2022-02-05 19:12:06 -05:00
Seth R Johnson
325056453a Enable multiple 'fragment' keywords to be attached to typemaps
This is consistent with the use of `%fragment`. Previously only the last
`fragment=` keyword would be added.
2022-02-05 19:03:43 -05:00
Olly Betts
b06ab566cb -DFOO on the SWIG command line now sets FOO to 1
This is consistent with C/C++ compiler preprocessors.  Previously
SWIG set FOO to an empty value.

Fixes #2193
2022-02-06 10:18:49 +13:00
Olly Betts
9d7c962ee8 Clean up uses of Replace()
We were passing flags of DOH_REPLACE_ANY|DOH_REPLACE_FIRST in three
places, which doesn't make sense as those are mutually exclusive
concepts.  In the current implementation DOH_REPLACE_FIRST wins in
this situation, so replace with that and clarify the docs.
2022-02-06 09:59:30 +13:00
William S Fulton
3354423c15 changes file edits 2022-02-05 20:52:56 +00:00
William S Fulton
34d80dcb8b attribute library documentation edits 2022-02-05 20:52:50 +00:00
William S Fulton
aef4a0f90a Merge branch 'doc-work' into upstream-master
* doc-work:
  Move the attribute.i docs into Library.html
  Move %attribute documentation into the manual
2022-02-05 20:52:42 +00:00
Olly Betts
ad6c81817f Add CHANGES.current entry for #2194 2022-02-06 09:47:08 +13:00
Olly Betts
f85626207c
Merge pull request #2194 from swig-fortran/mark-noassign
Auto-detect non-assignable classes
2022-02-06 09:44:29 +13:00
Olly Betts
1a03840172 [octave] Simply checks on exist()
As suggested by kwwette in #1672, just check exist() is non-zero in
cases where the non-zero value returned varies depending on Octave
version.
2022-02-06 09:03:16 +13:00
Seth R Johnson
5b7edebdba Placate scilab character limit 2022-02-04 14:54:11 -05:00
Seth R Johnson
5a2656ab80 Don't mark as "noassign" when a variable is immutable
I had assumed member variables could only be noassign by being "const",
but I had forgotten about the `%immutable` keyword being applied via
SWIG.
2022-02-04 14:03:01 -05:00
Seth R Johnson
03dd2ec39d Auto-detect non-assignable classes
Classes with references or const data are now marked as 'noassign'.
This renders many explicit `private: operator=` declarations redundant.
2022-02-04 09:51:18 -05:00
Olly Betts
073d144b0e Add CHANGES.current entry for #1672 2022-02-04 16:38:30 +13:00
Olly Betts
a60655a86b Merge branch 'octave-4-4-bugfix' of https://github.com/friedrichatgc/swig
Fixes #1672
2022-02-04 16:36:05 +13:00
Olly Betts
bf8ee5fb70 Fix stale links to doxygen docs 2022-02-04 14:04:48 +13:00
Olly Betts
633bf60131 Make download links https:
The http: links just redirect to https: anyway, so let's better
protect our users by using https: from the start.
2022-02-04 14:04:48 +13:00
Olly Betts
951f946341 [Python] Improve handling of SWIG_Py*Method_New
The SWIG_PyInstanceMethod_New method is no longer added to wrapped
classes except when it's actually needed, which is when
(!builtin && fastproxy) is true (which it isn't by default).

The SWIG_PyStaticMethod_New method is no longer is now similarly
gated - previously only (fastproxy) was checked.

Finally the C/C++ functions that implement these were always compiled
into the module, but now they're only included if
(!builtin && fastproxy) is true.

Issue noted by vadz in #2190.
2022-02-04 12:58:56 +13:00
Olly Betts
07f3637f06 [PHP] Remove useless shadowed variable in example 2022-02-03 23:04:58 +13:00
Olly Betts
7a21da90fd [C#] Fix memory leak in directorin typemap for std::string.
Fixes #998
2022-02-03 22:50:28 +13:00
Olly Betts
7cb2f46e06 [Python] Sort out handling of self parameter
When not using -builtin, the self parameter is now still made
available so that user typemaps can use it.  Fixes #967.

When using -builtin, fix -Wunused-parameter warnings in the generated
wrapper code.  See #801.

Based on a commit peeled out of #801 by teythoon.
2022-02-03 18:31:18 +13:00
Olly Betts
b77c0d02bc CHANGES.current: Add entry for recent change 2022-02-03 18:25:09 +13:00
Olly Betts
bede0b407b [python] Workaround MSVC2022-related bug
Fixes #2090
2022-02-03 17:54:50 +13:00
Justus Winter
5691f3f685 Fix function prototypes of generated pointer functions
Previously, the emitted constructors were incomplete prototypes.  When
compiling the wrapper code using gcc 6 and -Wstrict-prototypes, the
following warnings were emitted:

  warning: function declaration isn’t a prototype [-Wstrict-prototypes]

See #801
2022-02-03 17:25:44 +13:00
Olly Betts
0cdbbf326b Fix -Wstrict-prototypes warning in generated PHP wrappers 2022-02-03 17:21:17 +13:00
Olly Betts
ebbf2e6077 Allow method calls in expressions
This allows default parameter values containing method calls to be
parsed and handled - e.g. `x->foo(3,4)` and `y.z()`.
Fixes #660 and https://sourceforge.net/p/swig/bugs/1081/
2022-02-03 17:20:30 +13:00
Olly Betts
20588a4dc7 Uncomment line in testcase which now works
03ef3ecb6e86aa78a64119f30e683ee474ddb56 added support for ID PERIOD ID
in an expression.
2022-02-03 17:20:30 +13:00
Olly Betts
11009f8e23 Document calling extend methods from C/C++
Note that it's necessary to use the naming scheme we already document
to do this.

Fixes https://sourceforge.net/p/swig/bugs/889/
2022-02-03 11:22:16 +13:00
Olly Betts
2e98189564 [Ruby] Fix remove of prefix from method name
The prefix is now only removed at the start.

Fixes https://sourceforge.net/p/swig/bugs/1136/
2022-02-02 15:53:23 +13:00
Olly Betts
27a3d16ac6 Allow object reference in C++ trailing return type
Fixes #231
2022-02-02 11:31:45 +13:00
Clement David
aee380ce82 [scilab] Name init function name to avoid collision
Use SWIG_<module>_Init() function to init the module rather than
<module>_Init() as the latter can collide with a function being wrapped.

Fixes #745
Fixes #1739
2022-02-02 09:43:06 +13:00
Olly Betts
eb13261950 [Java] Note use of %ignore with %native
This is needed if you're wanting to effectively replace the generated
JNI wrapper for a C/C++ function.

Fixes https://sourceforge.net/p/swig/bugs/368/
2022-02-01 16:38:16 +13:00
Olly Betts
9d06d4ac45 [Tcl] Add changed file missed recent commit
This should have been in 6f4adde4b4
2022-02-01 16:00:12 +13:00
Olly Betts
3e019977c5
Merge pull request #1398 from swig-fortran/missing-includes
Add missing includes to library and test cases
2022-02-01 14:05:17 +13:00
Olly Betts
b66926b98d Add CHANGES entry for #2083 2022-02-01 13:34:17 +13:00
Olly Betts
9f74955e8d [Ocaml] Fix to work with CAML_SAFE_STRING
CAML_SAFE_STRING is on by default in current Ocaml versions, and was
stopping SWIG-generated wrappers from compiling.

Fixes #2083
2022-02-01 13:29:53 +13:00
Olly Betts
6f4adde4b4 [Tcl] Fix std_vector typecheck typemaps
In some cases the typecheck typemap would try to access the first
element of an empty Tcl list.

Fixes https://sourceforge.net/p/swig/bugs/1309/
2022-02-01 13:09:00 +13:00
Olly Betts
f003e9bcba [Tcl] Document objects aren't destroyed on exit
Fixes https://sourceforge.net/p/swig/bugs/1330/
2022-02-01 12:47:19 +13:00
Olly Betts
9c16ce8ab3 [ocaml] Improve the Qt example
Drop a method which has been deprecated then removed in Qt (but isn't
actually used in the example anyway) and clean up the steps a bit.

The example still doesn't build for me as the final step fails with:

File "_none_", line 1:
Error: Module `Dynlink' is unavailable (required by `Camlp4')

I know next to nothing about ocaml, so that may be something I've
failed to install, but I couldn't work out what.  I think the Qt
library linking needs updating too - there doesn't seem to be a
single `-lqt` now, but I don't use Qt either.
2022-02-01 11:46:39 +13:00
Olly Betts
7813793511 [R] Fix CopyToR() generated for struct in namespace
Fixes https://sourceforge.net/p/swig/bugs/1147/
2022-01-31 12:05:09 +13:00
Olly Betts
25f996a5c8 [python] Replace uses of assert in testsuite
We're not supposed to assert for this, as mentioned in #1488.
2022-01-30 13:38:56 +13:00
Olly Betts
16238102c7 Add CHANGES entry for #655 2022-01-30 11:10:16 +13:00
Olly Betts
7b5a615e50 Merge branch 'fschlimb/using-fixes'
Fixes #655
Fixes #1488
2022-01-30 11:06:37 +13:00