Add PHP typemaps for pointer to method.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11768 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Olly Betts 2009-12-03 12:59:59 +00:00
commit 67bbac4872
6 changed files with 62 additions and 3 deletions

View file

@ -354,6 +354,23 @@
SWIG_SetPointerZval($input, (void *)&$1_name, $1_descriptor, $owner);
%}
%typemap(out) SWIGTYPE (CLASS::*)
{
void * p = emalloc(sizeof($1));
memcpy(p, &$1, sizeof($1));
zval * resource;
MAKE_STD_ZVAL(resource);
ZEND_REGISTER_RESOURCE(resource, p, le_member_ptr);
SWIG_SetPointerZval(return_value, (void *)&$1, $1_descriptor, $owner);
}
%typemap(in) SWIGTYPE (CLASS::*)
{
void * p = (void*)zend_fetch_resource($input TSRMLS_CC, -1, SWIG_MEMBER_PTR, NULL, 1, le_member_ptr);
memcpy(&$1, p, sizeof($1));
}
%typemap(out) SWIGTYPE *DYNAMIC,
SWIGTYPE &DYNAMIC
{