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
This commit is contained in:
Nihal 2017-07-27 18:33:20 +05:30
commit 67fb198b73
4 changed files with 137 additions and 86 deletions

View file

@ -86,21 +86,15 @@ namespace Swig {
ZVAL_COPY_VALUE(&swig_self, self);
}
static bool swig_is_overridden_method(const char *cname, const char *lc_fname) {
bool result = false;
static bool swig_is_overridden_method(const char *cname, zval *ptr) {
zend_string * cname_str = zend_string_init(cname, strlen(cname), 0);
zend_class_entry *ce = zend_lookup_class(cname_str);
if (ce) {
zval * mptr = zend_hash_str_find(&ce->function_table, lc_fname, strlen(lc_fname));
if (mptr) {
// common.scope points to zend_class_entry for the declaring class,
// and there's only one of those per class, so we can just use a
// pointer compare here.
result = Z_FUNC_P(mptr)->common.scope != ce;
}
}
zend_string_release(cname_str);
return result;
zend_class_entry *cname_ce = zend_lookup_class(cname_str);
zend_class_entry *ptr_ce = Z_OBJCE_P(ptr);
if (cname_ce == ptr_ce)
return true;
return false;
}
template <typename Type>

View file

@ -381,7 +381,7 @@
SWIGTYPE &,
SWIGTYPE &&
%{
SWIG_SetZval($result, $newobj , $c_obj, (void *)result, SWIGTYPE$swig_type, $zend_obj);
SWIG_SetZval($result, $newobj , $c_obj, (void *)result, $1_descriptor, $zend_obj);
%}
%typemap(out) SWIGTYPE *const&