1 %define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT )
2 %typemap(in) TYPE *REF ($*1_ltype tmp),
3 TYPE &REF ($*1_ltype tmp)
5 /* First Check for SWIG wrapped type */
6 if ( ZVAL_IS_NULL( *$input ) ) {
8 } else if ( PZVAL_IS_REF( *$input ) ) {
9 /* Not swig wrapped type, so we check if it's a PHP reference type */
10 CONVERT_IN( tmp, $*1_ltype, $input );
13 SWIG_PHP_Error( E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference) );
16 %typemap(argout) TYPE *REF,
18 "CONVERT_OUT(*$input, tmp$argnum );";
21 %pass_by_ref( size_t, CONVERT_INT_IN, ZVAL_LONG );
23 %pass_by_ref( signed int, CONVERT_INT_IN, ZVAL_LONG );
24 %pass_by_ref( int, CONVERT_INT_IN, ZVAL_LONG );
25 %pass_by_ref( unsigned int, CONVERT_INT_IN, ZVAL_LONG );
27 %pass_by_ref( signed short, CONVERT_INT_IN, ZVAL_LONG );
28 %pass_by_ref( short, CONVERT_INT_IN, ZVAL_LONG );
29 %pass_by_ref( unsigned short, CONVERT_INT_IN, ZVAL_LONG );
31 %pass_by_ref( signed long, CONVERT_INT_IN, ZVAL_LONG );
32 %pass_by_ref( long, CONVERT_INT_IN, ZVAL_LONG );
33 %pass_by_ref( unsigned long, CONVERT_INT_IN, ZVAL_LONG );
35 %pass_by_ref( signed char, CONVERT_INT_IN, ZVAL_LONG );
36 %pass_by_ref( char, CONVERT_CHAR_IN, ZVAL_STRING );
37 %pass_by_ref( unsigned char, CONVERT_INT_IN, ZVAL_LONG );
39 %pass_by_ref( float, CONVERT_FLOAT_IN, ZVAL_DOUBLE );
40 %pass_by_ref( double, CONVERT_FLOAT_IN, ZVAL_DOUBLE );
42 %pass_by_ref( char *, CONVERT_CHAR_IN, ZVAL_STRING );