| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
So far C#, Java, Lua and PHP are supported.
Closes: #2540
See #1567
|
| |
|
|
|
|
|
|
|
| |
By default SWIG/PHP wraps std::string& as a pass-by-reference PHP
string parameter, but sometimes such a parameter is only for input
or only for output, so add support for the named typemaps that other
target languages support.
|
|
|
|
|
| |
The bulk of this was already removed in
e3b112c69ceed5c39cb07fa45a3ba62b27712679.
|
| |
|
| |
|
|
|
|
|
| |
PHP7 security support ended 2022-11-28 so it doesn't make sense to
include support for it in the SWIG 4.2.x release series.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
We need to include php.h before stdio.h (and probably before most
other libc headers).
|
|
|
|
| |
To fix overloading when using these types.
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replicated Java implementation.
Fully implemented for:
- C#
- D
- Guile
- Javascript (UTL)
- Lua
- MzScheme
- Octave (UTL)
- Perl (UTL)
- PHP
- Python (UTL)
- Ruby (UTL)
- Tcl (UTL)
PHP std::auto_ptr std::unique_ptr minor tweaks and testcase corrections
|
| |
|
|
|
|
| |
Equivalent to Python/Ruby implementations.
|
|
|
|
|
| |
In some cases $value can be an expression without parentheses around
it, and we want to cast the result of the whole expression.
|
|
|
|
|
| |
More removal of casts in the out typemaps when copying objects to enable
C++ compilers to possibly make use of move semantics.
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Use zend_strpprintf() which handles this more cleanly without risk of
buffer overflow and without a fixed length limit.
|
| |
|
|
|
|
|
| |
The default typemap should not be in this library file - this is for
users to add in if they want C default argument support.
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
|
|
|
|
|
|
|
| |
Fix to call cleanup code in exception situations and not to invoke
the freearg typemap twice in certain situations.
Fixes https://sourceforge.net/p/swig/bugs/1211/
|
|\
| |
| | |
Print rename warnings except anonymous template methods
|
| |
| |
| |
| |
| |
| | |
This is necessary for regex-like renames (where you can't use the #define trick
as is done in many of the %keywordwarn directives). It's now unnecessary to print
the "renaming to '`x`'" code explicitly by the kw.swg files.
|
|/ |
|
| |
|
|
|
|
|
|
|
|
|
| |
SWIG_SetPointerZval() requires the zval structure passed to be
initialised (so it can handle the constructor case where the zval is
already initialised as a PHP object.
I couldn't think of a suitable regression test for this, but it fixes 2
issues detected by running director_basic under valgrind.
|
|
|
|
|
| |
This resolves an issue uncovered by adding a _runme.php for testcase
director_alternating.
|
|
|
|
|
|
|
|
| |
The typemaps for long long and unsigned long long didn't handle a
string input correctly, and long_long_runme.php had a flawed test
in this case.
Fixes #2155
|
|
|
|
|
|
|
|
|
| |
It seems instanceof_function_ex() isn't a viable option for PHP 7.3 and
earlier - the implementation is strangely wrong.
So let's just provide a compatibility implementation which does what
zend_class_implements_interface() does in 8.x and use that for all 7.x
so there are fewer variants to worry about testing.
|
| |
|
|
|
|
|
| |
I'm an idiot - I noticed I'd used a // comment after testing, but failed
to retest after fixing that.
|
|
|
|
|
|
| |
The sense of parameter 3 of instanceof_function_ex() appears to have
changed in PHP 7.4 and we need to pass 0 for older versions and 1 for
PHP 7.4. Words fail me.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the switch to wrapping classes using PHP's C API, we now
internally need to be able to tell if a PHP object is of or derived
from a class that is wrapped by SWIG so we know if we can offset the
zend_object pointer to get to the swig_object_wrapper. If we try to
do this to an object which isn't wrapped by SWIG then we invoke C/C++
undefined behaviour (and typically get a segmentation fault).
This check is implemented by having a SWIG\wrapped empty interface which
we make all SWIG-wrapped classes implement simply so we can test for it
to detect such classes.
Fixes #2125
|
|
|
|
|
| |
We now automatically generate PHP type declarations for PHP >= 8.0.
The generated code still compiles with PHP 7.x but without type declarations.
|
|
|
|
|
|
|
| |
We have the swig_type_info available and SWIG_TypeCheckStruct
is more efficient because it uses a pointer comparison instead of the
string comparison SWIG_TypeCheck uses (this change speeds up `make
check-php-test-suite` by about 10%).
|
|
|
|
|
|
| |
Add PHP keyword 'readonly' (added in 8.1) to the list SWIG knows to
automatically rename. This keyword is special in that PHP allows it to
be used as a function (or method) name.
|
|
|
|
|
|
|
| |
Previously the zend_class_entry for Foo was named SWIGTYPE_Foo_ce, but
this can collide in some cases - e.g. if there's a class named p_Foo
then its zend_class entry will be SWIGTYPE_p_Foo_ce, but that's the same
as the swig_type_info for a class named p_Foo_ce.
|
|
|
|
|
|
|
|
|
|
| |
Do more initialisation at module load time.
Use a shared set of handlers for cases when the C/C++ object is
destroyed with free().
Most of the code in the free_obj and create_object handlers is the
same for every wrapped class so factor that out into common functions.
|
|
|
|
|
| |
We shouldn't be using symbols starting `php` as that risks collisions
with future symbols defined by PHP.
|
| |
|
|
|
|
|
|
| |
This typemap which would wrap C++ bool as PHP int is later overridden
by another which wraps it as PHP bool. The current result is what
we want so just remove the redundant one.
|
|
|
|
|
|
|
|
| |
The correct macro to test is PHP_MAJOR_VERSION so these two PHP 8 cases
weren't ever used, which hid that the PHP8 version of the code was
broken in one of them.
Highlighted in #2113.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
`SWIG_ErrorCode()`, `SWIG_ErrorMsg()`, `SWIG_FAIL()` and `goto thrown;`
are no longer supported (these are really all internal implementation
details and none are documented aside from brief mentions in CHANGES
for the first three). I wasn't able to find any uses at least in FOSS
code via code search tools.
If you are using these:
Use `SWIG_PHP_Error(code,msg);` instead of `SWIG_ErrorCode(code);
SWIG_ErrorMsg(msg);` (which will throw a PHP exception in SWIG >= 4.1
and do the same as the individual calls in older SWIG).
`SWIG_FAIL();` and `goto thrown;` can typically be replaced with
`SWIG_fail;`. This will probably also work with older SWIG, but
please test with your wrappers if this is important to you.
Fixes #2014
|