swig/SWIG/Lib/php4/phppointers.i
Kevin Ruland 6c87325b91 Fairly major update to php code generation and type library. Brief summary:
- Revised simplified makefile generation using -make switch.
 - Proper support of in, out, argout, ret typemaps.
 - Function overloading with typecheck typemap support.
 - Fragment inclusion in typemaps.
 - Proper handling of object destructors relying on PHP's reference counting.
 - Constants using consttab and varinit typemaps.
 - Global variables using varinit typemaps.
 - Can generate C++ bindings using either objects or no objects (-noproxy).
 - Special phppointer.i typemaps for using php references for pointer passing.


git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@7392 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2005-08-24 17:10:11 +00:00

23 lines
No EOL
709 B
OpenEdge ABL

%define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT )
%typemap(in) TYPE * ($*1_ltype tmp),
TYPE & ($*1_ltype tmp)
{
/* First Check for SWIG wrapped type */
if ( ZVAL_IS_NULL( *$input ) ) {
$1 = 0;
} else if ( PZVAL_IS_REF( *$input ) ) {
/* Not swig wrapped type, so we check if it's a PHP reference type */
CONVERT_IN( tmp, $*1_ltype, $input );
$1 = &tmp;
} else {
SWIG_PHP_Error( E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Excpeted a reference) );
}
}
%typemap(argout) TYPE *,
TYPE & {
CONVERT_OUT(*$input, tmp$argnum );
}
%enddef
%pass_by_ref( int, CONVERT_INT_IN, ZVAL_LONG );
%pass_by_ref( double, CONVERT_FLOAT_IN, ZVAL_DOUBLE );