WARN_* constants are user visible, so keep existing WARN_PHP4_* for
backward compatibility, but add preferred forms WARN_PHP_* and use these ourselves. Rename Lib/php4 to Lib/php, Source/Modules/php4.cxx to Source/Modules/php.cxx. Add typemaps for const reference so Examples/test-suite/apply_signed_char.i works. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10633 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9fc127d68b
commit
7dfd9aae31
32 changed files with 2388 additions and 22 deletions
59
Lib/php/utils.i
Normal file
59
Lib/php/utils.i
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
|
||||
%define CONVERT_BOOL_IN(lvar,t,invar)
|
||||
convert_to_boolean_ex(invar);
|
||||
lvar = (t) Z_LVAL_PP(invar);
|
||||
%enddef
|
||||
|
||||
%define CONVERT_INT_IN(lvar,t,invar)
|
||||
convert_to_long_ex(invar);
|
||||
lvar = (t) Z_LVAL_PP(invar);
|
||||
%enddef
|
||||
|
||||
%define CONVERT_INT_OUT(lvar,invar)
|
||||
lvar = (t) Z_LVAL_PP(invar);
|
||||
%enddef
|
||||
|
||||
%define CONVERT_FLOAT_IN(lvar,t,invar)
|
||||
convert_to_double_ex(invar);
|
||||
lvar = (t) Z_DVAL_PP(invar);
|
||||
%enddef
|
||||
|
||||
%define CONVERT_CHAR_IN(lvar,t,invar)
|
||||
convert_to_string_ex(invar);
|
||||
lvar = (t) *Z_STRVAL_PP(invar);
|
||||
%enddef
|
||||
|
||||
%define CONVERT_STRING_IN(lvar,t,invar)
|
||||
convert_to_string_ex(invar);
|
||||
lvar = (t) Z_STRVAL_PP(invar);
|
||||
%enddef
|
||||
|
||||
%define %pass_by_val( TYPE, CONVERT_IN )
|
||||
%typemap(in) TYPE, const TYPE &
|
||||
%{
|
||||
CONVERT_IN($1,$1_ltype,$input);
|
||||
%}
|
||||
%enddef
|
||||
|
||||
%fragment("t_output_helper","header") %{
|
||||
void
|
||||
t_output_helper( zval **target, zval *o) {
|
||||
if ( (*target)->type == IS_ARRAY ) {
|
||||
/* it's already an array, just append */
|
||||
add_next_index_zval( *target, o );
|
||||
return;
|
||||
}
|
||||
if ( (*target)->type == IS_NULL ) {
|
||||
REPLACE_ZVAL_VALUE(target,o,1);
|
||||
return;
|
||||
}
|
||||
zval *tmp;
|
||||
ALLOC_INIT_ZVAL(tmp);
|
||||
*tmp = **target;
|
||||
zval_copy_ctor(tmp);
|
||||
array_init(*target);
|
||||
add_next_index_zval( *target, tmp);
|
||||
add_next_index_zval( *target, o);
|
||||
|
||||
}
|
||||
%}
|
||||
Loading…
Add table
Add a link
Reference in a new issue