Make PHP directors work more like other languages

A PHP exception now gets translated to a C++ exception to skips over C++
code to get back to PHP, avoiding the need to gate every directorout
typemap on EG(exception).
This commit is contained in:
Olly Betts 2021-04-22 14:40:21 +12:00
commit 50426aae20
8 changed files with 50 additions and 88 deletions

View file

@ -93,18 +93,15 @@
%typemap(directorout) SWIGTYPE ($&1_ltype tmp)
%{
/* If exit was via exception, PHP NULL is returned so skip the conversion. */
if (!EG(exception)) {
if ($needNewFlow) {
tmp = ($&1_ltype) &SWIG_Z_FETCH_OBJ_P($1)->ptr;
SWIG_Z_FETCH_OBJ_P($1)->newobject = 0;
} else {
if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
}
if ($needNewFlow) {
tmp = ($&1_ltype) &SWIG_Z_FETCH_OBJ_P($1)->ptr;
SWIG_Z_FETCH_OBJ_P($1)->newobject = 0;
} else {
if (SWIG_ConvertPtr($input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
}
$result = *tmp;
}
$result = *tmp;
%}
%typemap(in) SWIGTYPE *,