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:
parent
da53351cac
commit
a687b020e2
4 changed files with 114 additions and 58 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -185,6 +185,14 @@ SWIG_ConvertResourcePtr(zval *z, swig_type_info *ty, int flags) {
|
|||
|
||||
type_name=zend_rsrc_list_get_rsrc_type(Z_RES_P(z));
|
||||
|
||||
if (!type_name) {
|
||||
if (Z_TYPE_P(z) == IS_OBJECT) {
|
||||
HashTable * ht = Z_OBJ_HT_P(z)->get_properties(z);
|
||||
zval * _cPtr = zend_hash_str_find(ht, "_cPtr", sizeof("_cPtr") - 1);
|
||||
type_name=zend_rsrc_list_get_rsrc_type(Z_RES_P(_cPtr));
|
||||
}
|
||||
}
|
||||
|
||||
return SWIG_ConvertResourceData(p, type_name, ty);
|
||||
}
|
||||
|
||||
|
|
@ -207,7 +215,13 @@ SWIG_ConvertPtr(zval *z, void **ptr, swig_type_info *ty, int flags) {
|
|||
_cPtr = Z_INDIRECT_P(_cPtr);
|
||||
}
|
||||
if (Z_TYPE_P(_cPtr) == IS_RESOURCE) {
|
||||
*ptr = SWIG_ConvertResourcePtr(_cPtr, ty, flags);
|
||||
zval *zv;
|
||||
if (!zend_hash_str_exists(ht, "SWIG_classWrapper", sizeof("SWIG_classWrapper") - 1))
|
||||
zv = _cPtr;
|
||||
else
|
||||
zv = z;
|
||||
|
||||
*ptr = SWIG_ConvertResourcePtr(zv, ty, flags);
|
||||
return (*ptr == NULL ? -1 : 0);
|
||||
}
|
||||
}
|
||||
|
|
@ -245,6 +259,8 @@ SWIG_generalize_object(zval *zval_obj, void *ptr, int class_obj, int userNewObj
|
|||
zval zv;
|
||||
ZVAL_RES(&zv,zend_register_resource(ptr,*(int *)(type->clientdata)));
|
||||
zend_hash_str_add(ht, "_cPtr", sizeof("_cPtr") - 1, &zv);
|
||||
ZVAL_TRUE(&zv);
|
||||
zend_hash_str_add(ht, "SWIG_classWrapper", sizeof("SWIG_classWrapper") - 1, &zv);
|
||||
}
|
||||
obj->newobject = userNewObj;
|
||||
}
|
||||
|
|
@ -252,7 +268,7 @@ SWIG_generalize_object(zval *zval_obj, void *ptr, int class_obj, int userNewObj
|
|||
static void
|
||||
SWIG_SetZval( zval *zv, zval *class_zv, int userNewObj ,int object, int class_obj ,void *ptr, swig_type_info *type, zend_object *std) {
|
||||
|
||||
if (class_obj) {
|
||||
if (class_obj == 1) {
|
||||
SWIG_generalize_object(class_zv, ptr, class_obj, userNewObj ,type);
|
||||
return;
|
||||
}
|
||||
|
|
@ -268,7 +284,10 @@ SWIG_SetZval( zval *zv, zval *class_zv, int userNewObj ,int object, int class_ob
|
|||
}
|
||||
|
||||
if (object == 2) {
|
||||
SWIG_SetPointerZval(zv,ptr,type,class_obj);
|
||||
int newobj = class_obj;
|
||||
if (class_obj == 2)
|
||||
newobj = 1;
|
||||
SWIG_SetPointerZval(zv,ptr,type,newobj);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue