Commit graph

5,687 commits

Author SHA1 Message Date
William S Fulton
3cbcdbf681 Merge branch 'unique_ptr'
* unique_ptr:
  Add std::unique_ptr<type> to Perl5.
2022-07-12 08:23:28 +01:00
Olly Betts
29354ed19d Update comment in PHP testcase
The PHP7 workaround we currently use has evolved a bit since this
comment was written.
2022-07-11 13:20:25 +12:00
Erez Geva
adb85d3d05 Add std::unique_ptr<type> to Perl5.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
2022-07-09 13:52:43 +02:00
Olly Betts
22a4355f34 [xml] Move to "Experimental" target language status
The XML target language support is not in good shape and is likely to be
removed unless somebody steps up to bring it up to the expected standard
(it fails to even meet the criteria for "Experimental" currently).

Closes #2213
2022-07-08 16:34:19 +12:00
Olly Betts
04abbcf4ae Turn an unmatched ]] back into two ]
Needed to handle e.g. `a[a[0]]`.  SWIG's parser doesn't seem to handle
that currently though.  See #2286.
2022-07-08 15:50:51 +12:00
Olly Betts
5ddcbac56b Test [[ and ]] in string literal are preserved
Suggested by wsfulton in #1158
2022-07-08 15:33:01 +12:00
Julien Marrec
d3759a9b36 Avoid parse errors for C++ attributes
Just ignore anything in between [[ and ]] in the scanner, which is better
that failing with a parse error.

Fixes #1158
Fixes #2286
2022-07-08 15:27:02 +12:00
Olly Betts
8987259959 Fix ticket reference in comment 2022-07-07 11:44:51 +12:00
Ian Lance Taylor
87cbf8c341 [Go] #2245 Handle NULL pointers for string* conversions.
Rearrange generation of director methods and rename
receiver argument from p to swig_p.

Fixes #2245
2022-07-05 17:00:48 -07:00
William S Fulton
71cd6a38fe Performance optimisation for directors for classes passed by value
The directorin typemaps in the director methods now use std::move on the
input parameter when copying the object from the stack to the heap prior
to the callback into the target language, thereby taking advantage of
move semantics if available.
2022-07-04 11:19:29 +01:00
William S Fulton
299880e6a6 Add std::unique support
Simple copy of current auto_ptr support (just suppport for
functions returning std::unique_ptr).

Closes #1722
2022-07-02 16:17:18 +01:00
William S Fulton
bf36bf7d8a Movable and move-only types supported in "out" typemaps.
Enhance SWIGTYPE "out" typemaps to use std::move when copying
objects, thereby making use of move semantics when wrapping a function returning
by value if the returned type supports move semantics.

Wrapping functions that return move only types 'by value' now work out the box
without having to provide custom typemaps.

The implementation removed all casts in the "out" typemaps to allow the compiler to
appropriately choose calling a move constructor, where possible, otherwise a copy
constructor. The implementation alsoand required modifying SwigValueWrapper to
change a cast operator from:

  SwigValueWrapper::operator T&() const;

to

  #if __cplusplus >=201103L
    SwigValueWrapper::operator T&&() const;
  #else
    SwigValueWrapper::operator T&() const;
  #endif

This is not backwards compatible for C++11 and later when using the valuewrapper feature
if a cast is explicitly being made in user supplied "out" typemaps. Suggested change
in custom "out" typemaps for C++11 and later code:

1. Try remove the cast altogether to let the compiler use an appropriate implicit cast.
2. Change the cast, for example, from static_cast<X &> to static_cast<X &&>, using the
   __cplusplus macro if all versions of C++ need to be supported.

Issue #999
Closes #1044

More about the commit:
Added some missing "varout" typemaps for Ocaml which was falling back to
use "out" typemaps as they were missing.

Ruby std::set fix for SwigValueWrapper C++11 changes.
2022-06-30 17:26:48 +01:00
William S Fulton
6ccef6dae1 Ocaml clean fixes 2022-06-30 09:36:29 +01:00
William S Fulton
088dc6e870 Add move assignment operator to SwigValueWrapper
Closes #2039
2022-06-16 08:02:02 +01:00
Olly Betts
9b096e6561 WIP 2022-06-14 17:40:12 +12:00
Olly Betts
9cdf46e8c8 [php] Adjust #required params for subclass methods
If the same method name is implemented in a parent class then the
subclass can't have more required parameters than that or else we
get a compatibility error when the module is loaded.

The testsuite wasn't catching this problem because it was no longer
trying to load the modules for testcases without _runme.php, because
the mechanism to do that relied on there being a generated .php
wrapper, which we no longer have by default.  Fix that to provide a
regression test for this fix.

See #2151
2022-06-14 16:00:46 +12:00
Olly Betts
b41fede827 [php] Fix default_args_runme.php for PHP7.0 2022-06-12 15:27:49 +12:00
Olly Betts
cdcb8cc9ee [php] Try again to fix default_args_runme.php for PHP7 2022-06-12 15:02:26 +12:00
Olly Betts
3a84a4dd96 [php] Fix new default_args_runme.php for PHP < 7.3 2022-06-12 10:20:13 +12:00
Olly Betts
c95df57976 [php] Fix missing parameter type declarations
In some cases of overloaded functions the parameter type information was
missing for some or all parameters.

See #2151
2022-06-12 09:22:27 +12:00
Olly Betts
b7f82d78e9 Fix director_classes_runme.php for PHP 7.0
PHP 7.0 fails to parse `?` before a parameter type (meaning Nullable in
newer versions), so just omit these parameter type declarations in
the testcase until we drop PHP 7.0 support.

Also drop some `var_dump($x);` left over from debugging this testcase.
2022-06-10 13:39:39 +12:00
Olly Betts
14df91f8a0 Fix new director_classes_runme.php for PHP7 2022-06-10 12:01:23 +12:00
Olly Betts
2de2efb0bb Fix PHP parameter type declarations compatibility
Ensure PHP parameter type declarations are compatible with those for
the same method in any classes we inherit from.

See #2151
2022-06-10 11:12:54 +12:00
Olly Betts
d43d62cd7a Revert "Fix PHP parameter type declarations compatibility"
I missed that this change breaks cpp_static, which seems to be to do
with handling the combined getter and setter we emit for static
member variables.  Reverting while I figure out how to handle that.

This reverts commit a277748870.
2022-06-09 17:55:09 +12:00
Olly Betts
a277748870 Fix PHP parameter type declarations compatibility
Ensure PHP parameter type declarations are compatible with those for
the same method in any classes we inherit from.

See #2151
2022-06-09 17:36:11 +12:00
Olly Betts
a1b45a8333 [php] Add runme.php for two more testcases 2022-06-08 13:20:19 +12:00
William S Fulton
da40946aaa Merge branch 'typemap-colon'
* typemap-colon:
  Incoporate review suggestions
  Allow referencing of typemap keywords inside of "$typemap("
2022-06-01 07:57:01 +01:00
William S Fulton
34c219b5f7 Merge branch 'imfunc'
* imfunc:
  Add special variable imfuncname expansion for C# and D
  Test and document imfuncname special variable expansion
  Update docs.
  Also expose  in proxyClassFunctionHandler
  Expose  to javaout typemaps.

Conflicts:
	CHANGES.current
2022-05-30 19:45:28 +01:00
William S Fulton
954f29b032 Add special variable imfuncname expansion for C# and D
Same functionality as Java
2022-05-30 19:43:04 +01:00
William S Fulton
62e0685df6 Test and document imfuncname special variable expansion 2022-05-30 19:00:04 +01:00
William S Fulton
34a27359ae Final tidy up for improved C# SwigDerviedClassHasMethod implementation 2022-05-26 08:44:51 +01:00
William S Fulton
d5d5891866 Remove ocaml from argcargv testing 2022-05-23 08:54:40 +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
Xavier Delacour
96337b266c Octave argcargvtest 2022-05-21 18:48:54 +02:00
William S Fulton
35ec8ca210 Add argcargv test case to test-suite 2022-05-15 19:49:59 +01: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
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
Erez Geva
5851eb09a2 Add Lua test for argcargv.i
Signed-off-by: Erez Geva <erezgeva2@gmail.com>
2022-05-10 20:13:55 +02:00
William S Fulton
15d69ec270 Add runme.class file to Java test-suite clean 2022-05-07 08:17:48 +01:00
William S Fulton
fd846be18b Remove some usage of strdup
To fix visual c++ warning:
  warning C4996: 'strdup': The POSIX name for this item is deprecated.
2022-05-07 07:09:44 +01:00
William S Fulton
f029beffe8 Ruby li_std_set test failure workaround
Prevent GC from collecting "hello" string in testcase
as workaround to prevent GC occasionally causing segfault.

Issue #2115
2022-05-06 08:11:29 +01: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
9fd59650cf Apply C# test updates for directors with std::wstring supplied by wsfulton 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
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
Corey Minyard
3cc67d42f3 [Go] Add a test for godirectorin with const char **
This exercises a bug that was found with this fairly complex mapping, it
wasn't putting newlines in the proper place.  A previous commit added
the newlines, this makes sure it doesn't happen again.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2022-04-18 19:55:34 -05:00
Corey Minyard
546763ffbc [Go] Add an example for goin and godirectorin
Shows how to use a go directory for passing an NULL terminated argv type
array.

This also exercises the bug in the previous commit.  That's why the
call1 function isn't assigned to zero, that the only case where that bug
happens.

Signed-off-by: Corey Minyard <cminyard@mvista.com>
2022-04-18 19:55:34 -05:00