Home | History | Annotate | Download | only in php
      1 %define %pass_by_ref( TYPE, CONVERT_IN, CONVERT_OUT )
      2 %typemap(in) TYPE *REF ($*1_ltype tmp),
      3              TYPE &REF ($*1_ltype tmp)
      4 %{
      5   /* First Check for SWIG wrapped type */
      6   if ( ZVAL_IS_NULL( *$input ) ) {
      7       $1 = 0;
      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 );
     11       $1 = &tmp;
     12   } else {
     13       SWIG_PHP_Error( E_ERROR, SWIG_PHP_Arg_Error_Msg($argnum, Expected a reference) );
     14   }
     15 %}
     16 %typemap(argout) TYPE *REF,
     17                  TYPE &REF
     18   "CONVERT_OUT(*$input, tmp$argnum );";
     19 %enddef
     20 
     21 %pass_by_ref( size_t, CONVERT_INT_IN, ZVAL_LONG );
     22 
     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 );
     26 
     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 );
     30 
     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 );
     34 
     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 );
     38 
     39 %pass_by_ref( float, CONVERT_FLOAT_IN, ZVAL_DOUBLE );
     40 %pass_by_ref( double, CONVERT_FLOAT_IN, ZVAL_DOUBLE );
     41 
     42 %pass_by_ref( char *, CONVERT_CHAR_IN, ZVAL_STRING );
     43