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.
This commit is contained in:
Nihal 2017-08-13 12:14:09 +05:30
commit a687b020e2
4 changed files with 114 additions and 58 deletions

View file

@ -86,7 +86,7 @@
%typemap(in) SWIGTYPE ($&1_ltype tmp)
%{
if (zend_lookup_class(zend_string_init("$lower_param",sizeof("$lower_param")-1,0))) {
$1 = *$obj_value;
$1 = *(($1_ltype *)$obj_value);
}
else {
if (SWIG_ConvertPtr(&$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL)
@ -109,7 +109,7 @@
SWIGTYPE []
%{
if (zend_lookup_class(zend_string_init("$lower_param",sizeof("$lower_param")-1,0))) {
$1 = $obj_value;
$1 = ($1_ltype) $obj_value;
}
else {
if (SWIG_ConvertPtr(&$linput, (void **) &$1, $1_descriptor, 0) < 0)
@ -120,7 +120,7 @@
%typemap(in) SWIGTYPE &
%{
if (zend_lookup_class(zend_string_init("$lower_param",sizeof("$lower_param")-1,0))) {
$1 = $obj_value;
$1 = ($1_ltype) $obj_value;
}
else {
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL)
@ -131,7 +131,7 @@
%typemap(in) SWIGTYPE &&
%{
if (zend_lookup_class(zend_string_init("$lower_param",sizeof("$lower_param")-1,0))) {
$1 = $obj_value;
$1 = ($1_ltype) $obj_value;
}
else {
if (SWIG_ConvertPtr(&$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) {
@ -142,10 +142,15 @@
%typemap(in) SWIGTYPE *const& ($*ltype temp)
%{
if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
if (zend_lookup_class(zend_string_init("$lower_param",sizeof("$lower_param")-1,0))) {
$1 = ($1_ltype) $obj_value;
}
else {
if (SWIG_ConvertPtr(&$input, (void **) &temp, $*1_descriptor, 0) < 0) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $*1_descriptor");
}
$1 = ($1_ltype)&temp;
}
%}
%typemap(in) SWIGTYPE *DISOWN