Commit graph

1,752 commits

Author SHA1 Message Date
William S Fulton
2072ae19c9 Python function annotations removed from -py3 option.
Python function annotations containing C/C++ types are no longer
generated when using the -py3 option. Function annotations support
has been moved to a feature to provide finer grained control.
It can be turned on globally by adding:

  %feature("python:annotations", "c");

or by using the command line argument:

  -features python:annotations=c

The implementation is designed to be expandable to support different
annotations implementations. Future implementations could implement
something like the following for generating pure Python types:

  %feature("python:annotations", "python");

or typing module types to conform to PEP-484:

  %feature("python:annotations", "typing");

Closes #1561
Issue #735
2022-02-27 10:47:50 +00:00
Olly Betts
b127e11f1e Fix typos in docs and comments 2022-02-27 18:15:46 +13:00
William S Fulton
f995bad785 Add detailed docs and info on match in %rename 2022-02-26 12:49:07 +00:00
William S Fulton
546062fdf1 Add %rename matching docs and improvements
Add in %$isusing macro for %rename.
Improve docs for %$not and notmatch.
2022-02-26 12:49:07 +00:00
William S Fulton
79a1bbee8b Using declarations in inheritance hierarchy improvements.
- Improved documentation for using declarations.
- Issue new warning WARN_LANG_USING_NAME_DIFFERENT when there
  is a conflict in the target language name to be used when
  introducing a method via a using declaration. Previously
  the method was silently ignored. Issue #1840. Issue #655.
2022-02-26 12:46:06 +00:00
Olly Betts
e95af9c474 Merge branch 'scilab-6' of https://github.com/davidcl/swig
Fixes #1751
2022-02-24 10:45:13 +13:00
Olly Betts
4db4b999ca Document strings in preprocessor expressions
These appear to have been supported for at least 20 years and are used
in SWIG's library files.
2022-02-24 09:39:21 +13:00
Clément DAVID
f93f8ad1d5 [Scilab] remove targetversion argument
This commit handles multi-version support at runtime, it
fixes:
 * 5.5.2 - with cutted long identifier name
 * 6.0.0 - with full string identifier
 * 6.1.0 - with 1 or 0 output argument

It also improves the codebase by:
 * Using `Char(X)` instead of `DohCheck(X)` and `Data(X)`
 * Using `Len(X)` instead of `strlen()`
 * Correctly detecting old Scilab versions
2022-02-21 10:01:59 +01:00
Olly Betts
0b12398b2c Perl.html: Fix incorrect references to python 2022-02-16 11:16:36 +13:00
Olly Betts
a7ed8be8b4 Improve wording in docs 2022-02-10 16:13:43 +13:00
Dimitris Apostolou
40c3bf30b2 Fix typos 2022-02-10 16:12:24 +13: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
Seth R Johnson
6c41db3b8c Add documentation 2022-02-05 19:12:06 -05: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
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
bf8ee5fb70 Fix stale links to doxygen docs 2022-02-04 14:04:48 +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
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
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
7ec2f89fe2
Remove redundant NULL checks before free()/delete (#2184)
Remove redundant NULL checks before free()/delete

The ISO C and C++ standards guarantee that it's safe to call these
on a NULL pointer, so it's not necessary for the calling code to
also check.

Fixes https://sourceforge.net/p/swig/feature-requests/70/
2022-01-29 22:03:48 +13:00
sethg
c7cfabd0a7 Update CMake build to use NuGet Bison3 2022-01-29 09:19:04 +13:00
Corey Minyard
97b4cccbbd Talk about namespaces and unignoring
It was not obvious to at least one person that namespaces need to be
unignored just like classes and methods.  Add an explicit reference to
that in the docs.

Also add something to unignore all classes in the example that shows how
to ignore all classes, as that might not be obvious.

Fixes #193
2022-01-29 09:18:33 +13:00
Corey Minyard
4949b2e760 Add an example for unignoring everything
In the example for ignoring everything, it didn't show how to undo the
ignore all, and the obvious '%rename("") ""' didnt work.
'"%rename("%s") ""' is the right way to do that, so add it to the
example.

Fixes #2173
2022-01-29 08:58:25 +13:00
Corey Minyard
69f94723d2 Fix the recent %rename docs
The example I recently added about renaming didn't compile.  Here's the
fix.

There was also a use of the term "override" which should have been
changed to "replace".
2022-01-29 08:57:17 +13:00
Corey Minyard
562effb50f Move the attribute.i docs into Library.html
Per comments on the merge request, this is the appropriate place for it,
and add a reference to it from the structures and unions section so
someone looking there will see it.

Also remove the changes in Contents.html, since that is regenerated and
those changes are just noise in the commit.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2022-01-28 08:59:08 -06:00
William S Fulton
fa8c89ddf5 Move docs on replacing c++ class methods to C++ section
[skip ci]
2022-01-27 21:25:35 +00:00
William S Fulton
7c44526180 Merge branch 'doc-work2-v2'
* doc-work2-v2:
  Improve documentation on %rename
2022-01-27 20:54:20 +00:00
William S Fulton
67de990506 HTML formatting fixes 2022-01-27 20:39:04 +00:00
Corey Minyard
f878b17679 Improve documentation on %rename
Add documentation on %rename of names replacing previous %renames of
the same name, and how to replace methods in classes using %rename.
2022-01-26 19:37:58 -06:00
sethg
720397baba Add CXX flag 2022-01-26 23:12:18 +01:00
Corey Minyard
f77af57bd7 Move %attribute documentation into the manual
It's fairly hidden where it is, put it where users can see it more
easily.

Fixes #2166
2022-01-26 09:18:55 -06:00
sethg
e941f7e3fa Updated and verified CMake build docs 2022-01-26 14:30:06 +01:00
Olly Betts
005ffc76de [python] Fix double free on error in docs example
Closes #2073
2022-01-26 13:30:15 +13:00
William S Fulton
017900d57e Extern template tweaks
Document extern template functions support.
Extern templates result in new warning to differentiate
from template explicit instantiation definition warning.
2022-01-25 00:28:08 +00:00
William S Fulton
99ceab2cdf Building SWIG on Windows doc re-organisation 2022-01-22 16:36:03 +00:00
William S Fulton
f8e4a5cc25 Few more PCRE to PCRE2 changes 2022-01-21 18:35:20 +00:00
Julien Schueller
15515f390c PCRE2
Closes #2120
2022-01-21 07:46:08 +01:00
Olly Betts
1f1349741f
[php] Generate PHP type declarations
We now automatically generate PHP type declarations for PHP >= 8.0.

The generated code still compiles with PHP 7.x but without type declarations.
2022-01-20 10:07:44 +13:00
Olly Betts
748a9a5452 [perl] Require at least Perl 5.8.0
As discussed and agreed in #1629, it's become hard to test with Perl
5.6 or earlier, such old versions are no longer in active use, and
4.1.0 is an appropriate time to make such a change.

I've dropped the compatibility code that was obvious to me, but there's
probably more that can be cleaned up now.
2022-01-19 10:07:30 +13:00
Olly Betts
c839066405 [perl] Document explicitly not to use %OWNER directly
See #1771
2022-01-18 14:53:02 +13:00
Olly Betts
45c1255933 Fix missing HTML escaping in Octave docs 2022-01-18 13:56:07 +13:00
Olly Betts
0fbf23a77b Fix PHP docs formatting issue 2022-01-16 12:36:05 +13:00
Olly Betts
130813b320 Escape a literal > in PHP.html 2021-12-29 19:15:08 +13:00
Olly Betts
c42e8970a4 [php] Improve wording in the manual 2021-12-24 15:53:00 +13:00
Olly Betts
7418da9e5d Fix transposed outputs in internals doc 2021-12-15 19:25:53 +13:00
William S Fulton
5bdc20781b Remove bom in Windows.html 2021-12-02 11:53:13 +00:00