Commit graph

129 commits

Author SHA1 Message Date
Nihal
9c40bbdb85 Refactor SWIG_SetZval to simplify the arguments. Solve constructor rename bug
- Refactor SWIG_SetZval.
- Fix the Renamed constructor - turn into static factory method bug.

Conflicts:
	Source/Modules/php.cxx
2017-08-28 11:22:51 +05:30
Nihal
4252b31f8f Refactor code to rename class entry variables and ConvertPtr to work with wrapped objects.
- Rename class entry variables to SWIGTYPE_class_ce
- Refactor factory code to use SWIGTYPE_class_ce to create objects
- Refactor ConvertPtr to work of wrapped class objects.
2017-08-20 01:54:07 +05:30
Nihal
9fea6fc5ac Refactor code and solve few test cases.
- Change the need of runtime check on old or new flow at wrapper generation time.
- Change the check on add ZEND_ACC_ABSTRACT to GetFlag(n, "abstract") && Swig_directorclass(Swig_methodclass(n))
  - workaround to solve abstract testcases at the moment.
- Remove redundant code in class handler for getting namespaces (Not the correct approact) and use of zend_register_class_alias_ex.
- Refactor choosing of class name to use sym:name by default.
2017-08-18 09:02:47 +05:30
Nihal
a687b020e2 Refactor code and change change enum_scope_template test to use class enums. Fix few test cases.
- Change enum_scope_template test to use class enums.
- Move the conversion of void* of ptr in swig wrapper to class pointer to Lib files.
- Synchronize between old and new flow. Old flow to accept newly created objects,
with the use of a new property SWIG_classWrapper to newly created objects.
- ZEND_BEGIN_ARG_INFO_EX to hold exact number of arguments required.
- Fix the constructor overloading bug in the in-house Swig_class_overload_dispatch function
- Add helper function to check if the class is wrapped.
- Add ZEND_ACC_ABSTRACT to virtual functions to make the class abstract.
- Change how wname is selected for staticmemberfn.
- Helper function to get names without namespace getNameWithoutNamespace.
- Fix bugs on class entry level at class handler.
  - Move all entry level code to class handler from class decleration.
  - Checking if base.item is null before using it.
  - Check if the parent class is wrapped before using its class entry.
2017-08-18 08:54:05 +05:30
Nihal
da53351cac Refactor code and introduce some functionalities.
Code Refactor
- Refactor code for return type of SWIGTYPE
- Workaround for Namespaced classes.
- Refactor code of SWIG_SetZval to take care of objects in class constructor.
- Introduce SWIG_generalize_object to generalize each object to swig object wrapper.
- Catch feature:immutable instead of feature:warnfilter - 462 for missing setter.
- Refactor code to create PHP objects for all instances of value, reference and pointer return types of C++ objects.
- Introduce getAccessMode to get the Access Mode of a method for generating Wrapper.
- Refactor free_object creation to include need_free condition. This is to check if there is a need to free. (Virtual Protected Destructors)
- Support for feature:exceptionclass. Extends class Exception.
- Improve condition check in Director class constructor to distinguish between, extended class creation or not.
  Swig::Director::swig_is_overridden_method is used.
2017-08-12 10:11:47 +05:30
Nihal
a930743932 Refactor Code and Support phpinterfaces, factory dispatch
- rewire return of type SWIGTYPE
- {NULL, NULL, NULL} to ZEND_FE_END
- feature:warnfilter - 462 of missing setter
- refactor code of return type (replaced)
- support conversion_operator
2017-08-04 23:13:19 +05:30
Nihal
67fb198b73 SWIG Director Support with Class Structure. Refactor Code to support rename.
Refactor Code
- Support Director Classes.
- %rename support of class names and method names.
- Creation and destruction methods after inline code.
- Test case check::function return true. - Needs Fixup
2017-08-01 11:01:15 +05:30
Nihal
4c55919975 Refactor Code to use swig_object_wrapper for wrapping classes.
And use void * to store class pointers.
2017-07-19 22:52:46 +05:30
Nihal
b38e6d9584 Remove SWIG_Get_Type function usage in class constants.
Add class constant typemaps. (classconsttab)
2017-07-19 20:49:40 +05:30
Nihal
a71b349204 Add overload Support.
Use in house SWIG_overload_dispatch for class overloaded methods.
2017-07-19 20:49:37 +05:30
Nihal
290198495f Support Disown functionality.
Creating newobject variable under struct which stores this pointer.
Using that to implement Disown.
2017-07-19 20:49:33 +05:30
Nihal
4458040975 Refactor Code: Change Approach to emit necessary code for pointer params.
Use in typemap.
2017-07-19 20:49:26 +05:30
Nihal
11e2f53840 Object Structure approach Code
Takes care of simple class wrapping with pointers, enum, values, variables, and inheritance.
2017-07-19 20:47:53 +05:30
William S Fulton
72ba741d1c Fix wrapping of references/pointers and qualifiers to member pointers
Also fix Go wrapping of member const function pointers.
2017-03-16 21:04:38 +00:00
Olly Betts
26a01e1b83 [PHP7] Fix segfault on module unload
Register internal 'swig_runtime_data_type_pointer' constant as
"CONST_PERSISTENT" to avoid segmentation fault on module unload.  Fixes
https://github.com/swig/swig/issues/859 reported by Timotheus Pokorra -
thanks also to Javier Torres for a minimal reproducer.
2016-12-30 16:05:53 +13:00
Olly Betts
774311f11e Add explicit check for expected PHP version
Should give a clearer error if PHP7 bindings are compiled against
PHP5 or vice versa.
2016-12-01 12:12:06 +13:00
Olly Betts
0ada392cee [PHP] Fix minor misindentation in generated wrapper 2016-12-01 12:02:52 +13:00
Olly Betts
c8a5f84cd1 [PHP7] Wrap bool constants as PHP booleans
Leave PHP5 wrapping them as integers as this change could cause
incompatibilities.

Fixes issue https://github.com/swig/swig/issues/686 noted by Nishant
Gupta.
2016-11-30 17:19:11 +13:00
Olly Betts
1169874f59 [PHP] Add support for PHP7.
PHP5's C extension API has changed substantially so you need to use
-php7 to specify you want PHP7 compatible wrappers.
Fixes https://github.com/swig/swig/issues/571
2016-11-30 13:05:59 +13:00
William S Fulton
08a98437d0 Fix redundant NULL check in php typemaps
Fix for clang compile error as the address of an array will never be NULL.
2016-10-15 17:58:21 +01:00
Olly Betts
c51ce4995c [PHP] Fix "in" typemap for char INPUT[ANY] 2016-09-02 16:38:58 +12:00
Olly Betts
a4015acaca [PHP] Fix out typemap for member function pointers
The existing typemap was just broken - it correctly created the resource
and then did nothing with it, and instead tried to register the member
pointer as a normal pointer, which is never going to work as it's larger
than a normal pointer.

Add cpp_basic_runme.php as a regression test for this.
2016-09-02 09:51:18 +12:00
Olly Betts
3a8f734221 Remove unused SWIG_landfill
It's not been used in any version of SWIG in the repository, isn't
documented, and I can find no trace of user code using it.
2016-08-30 11:18:28 +12:00
William S Fulton
98a31ff633 Fix directorin SWIGTYPE typemaps to make a copy as these are used for pass by value.
Closes #434
2016-05-14 21:32:24 +01:00
William S Fulton
6a61f8271f Php fix for -Wmissing-field-initializers warning
Use ZEND_FE_END (introduced sometime around 5.2) to obtain the correct
number of arguments for zend_function_entry. Fallback to the original
3 argument initializer if not defined, however, this will not fix the
initializer warning though for some older versions of PHP.
2015-12-19 16:21:23 +00:00
William S Fulton
4b23f5d9d4 Consistent memory initialization in php typemaps.
Memory was only initialized in C and not C++ - potential bug?
2015-07-30 20:41:20 +01:00
Olly Betts
7ba0652677 Create director_common.swg for language-indep code
Move -DSWIG_DIRECTOR_STATIC handling there, so this is now supported for
all languages with director support, not just Python and PHP.
2015-03-12 19:51:11 +13:00
Olly Betts
0dd685bad2 Fix PHP crash in director_finalizer 2015-01-14 15:38:55 +13:00
William S Fulton
3efd3affbd Add c++11 strongly typed enum support for PHP 2014-11-27 19:59:20 +00:00
Olly Betts
e12322df86 [PHP] Fix throwing a PHP exception through C++ from a subclassed
director method - PHP NULL gets returned by the subclassed method
in this case, so the directorout typemap needs to allow that (at
least if an exception is active).
2014-09-11 13:09:08 -03:00
Olly Betts
0dd7b61c57 Fix segmentation faults with directors in PHP >= 5.4 2014-09-09 13:39:30 -03:00
Olly Betts
b58caf6978 Add more new PHP5.6 keywords 2014-06-08 22:04:55 +12:00
William S Fulton
3191473523 Fix compiler warnings in generated code when using -std=c++98 -std=gnu89 -pedantic -Wreturn-type 2014-05-24 14:13:19 +01:00
Olly Betts
191e625983 Eliminate unused parameter from SWIG_Php_GetModule() 2014-04-02 23:46:44 +13:00
Olly Betts
18c00e20bc [PHP] Pass ZTS context through to t_output_helper() so it works
with a ZTS-enabled build of PHP.  Reported by Pierre Labastie in
github PR#155.
2014-04-02 23:28:56 +13:00
Olly Betts
06e5a5fb0d [PHP] Update the lists of PHP keywords with new ones from PHP 5.4
and newer (and some missing ones from 5.3).  Reserved PHP constants
names are now checked against enum values and constants, instead
of against function and method names.  Built-in PHP function names
no longer match methods added by %extend.  Functions and methods
named '__sleep', '__wakeup', 'not', 'parent', or 'virtual' are no
longer needlessly renamed.
2014-02-19 17:21:34 +13:00
Olly Betts
36c22b70bd Make PHP %keywordwarn message wording consistent with other languages 2014-02-19 16:51:31 +13:00
Olly Betts
fcf8180751 Whitespace tweaks 2014-02-17 16:27:39 +13:00
Olly Betts
b761131fec "if (strlen(msg))" -> "if (msg[0])" 2014-02-17 16:26:48 +13:00
Olly Betts
7af8b13ef7 Just call strcmp() rather than strlen() twice plus zend_binary_strcmp() 2014-02-17 16:25:29 +13:00
Olly Betts
052d0057c2 Only call strlen(lc_fname) if we are going to use the result 2014-02-17 16:24:04 +13:00
Marvin Greenberg
843aa7cd65 Work around differences in clang libc++ std::vector<bool>::const_reference
clang++ using -stdlib=libc++ defines const_reference as a class,
to map boolean vectors onto a bit set.  Because swig does
not "see" the type as "const &" it generates incorrect code for this case,
generating a declaration like:

  const_reference result;

When const_reference is a typedef to 'bool' as is the case with stdlibc++
this works.  When this is actually a constant reference, this is clearly
invalid since it is not initialized.  For libc++, this is a class
which cannot be default constructed, resulting in an error.  The fix
is to explicitly define the various accessor extensions as having a
bool return type for this specialization.
2014-02-04 16:00:12 -05:00
William S Fulton
cc650e692e Director exceptions now derive from std::exception 2014-01-20 19:40:52 +00:00
William S Fulton
f068be89e5 Fix PHP compilation error in ZTS mode (64 bit windows) due to TSRMLS_FETCH() expansion 2014-01-16 06:48:35 +00:00
William S Fulton
1a19451c1b Error out attempting to use directors without -c++
Remove redundant #ifdef __cplusplus markers in director.swg
2013-12-23 20:23:54 +00:00
William S Fulton
135a7cc558 Beautify director.swg files
Also some comment corrections for Perl
2013-12-23 19:50:41 +00:00
Miklos Vajna
227192f80a Fix Examples/php/pointer to work with PHP 5.5
With this, all examples work with PHP 5.5 for me.
2013-12-12 15:52:51 +13:00
Olly Betts
cecd89f66f [PHP] The usage of $input in PHP directorout typemaps has been
changed to be consistent with other languages.  The typemaps
provided by SWIG have been updated accordingly, but if you
have written your own directorout typemaps, you'll need to
update $input to &$input (or make equivalent changes).

*** POTENTIAL INCOMPATIBILITY  ***
2013-12-12 15:40:15 +13:00
William S Fulton
c151a0d69a Add array function PHP keywords 2013-11-11 19:12:48 +00:00
William S Fulton
7b08378145 Minor cleanup prior to merging to master 2013-10-11 21:48:45 +01:00