~ubuntu-branches/ubuntu/maverick/swig1.3/maverick

« back to all changes in this revision

Viewing changes to Lib/php/utils.i

  • Committer: Bazaar Package Importer
  • Author(s): Benjamin Drung
  • Date: 2009-11-15 14:00:28 UTC
  • mfrom: (1.2.9 upstream) (2.1.4 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091115140028-me7amr2rie8zz1xn
Tags: 1.3.40-2ubuntu1
* Merge from Debian testing (LP: #356529), remaining changes:
  - Drop libchicken-dev from the build-depends (it's in universe)
  - Remove Pike from package description and from configure flags
  - drop "--without-mzscheme", we don't have it in our build-depends
  - use php-config5
  - Clean Runtime/ as well.
  - debian/rules (clean): Remove Lib/ocaml/swigp4.ml.
* debian/rules: Remove hardcoded python version.
* Remove upper limit for python from Build-Depends.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
%define CONVERT_BOOL_IN(lvar,t,invar)
 
3
  convert_to_boolean_ex(invar);
 
4
  lvar = (t) Z_LVAL_PP(invar);
 
5
%enddef
 
6
 
 
7
%define CONVERT_INT_IN(lvar,t,invar)
 
8
  convert_to_long_ex(invar);
 
9
  lvar = (t) Z_LVAL_PP(invar);
 
10
%enddef
 
11
 
 
12
%define CONVERT_INT_OUT(lvar,invar)
 
13
  lvar = (t) Z_LVAL_PP(invar);
 
14
%enddef
 
15
 
 
16
%define CONVERT_FLOAT_IN(lvar,t,invar)
 
17
  convert_to_double_ex(invar);
 
18
  lvar = (t) Z_DVAL_PP(invar);
 
19
%enddef
 
20
 
 
21
%define CONVERT_CHAR_IN(lvar,t,invar)
 
22
  convert_to_string_ex(invar);
 
23
  lvar = (t) *Z_STRVAL_PP(invar);
 
24
%enddef
 
25
 
 
26
%define CONVERT_STRING_IN(lvar,t,invar)
 
27
  if ((*invar)->type==IS_NULL) {
 
28
    lvar = (t) 0;
 
29
  } else {
 
30
    convert_to_string_ex(invar);
 
31
    lvar = (t) Z_STRVAL_PP(invar);
 
32
  }
 
33
%enddef
 
34
 
 
35
%define %pass_by_val( TYPE, CONVERT_IN )
 
36
%typemap(in) TYPE
 
37
%{
 
38
  CONVERT_IN($1,$1_ltype,$input);
 
39
%}
 
40
%typemap(in) const TYPE & ($*1_ltype temp)
 
41
%{
 
42
  CONVERT_IN(temp,$*1_ltype,$input);
 
43
  $1 = &temp;
 
44
%}
 
45
%typemap(directorout) TYPE
 
46
%{
 
47
  CONVERT_IN($result,$1_ltype,$input);
 
48
%}
 
49
%typemap(directorout) const TYPE & ($*1_ltype temp)
 
50
%{
 
51
  CONVERT_IN(temp,$*1_ltype,$input);
 
52
  $result = &temp;
 
53
%}
 
54
%enddef
 
55
 
 
56
%fragment("t_output_helper","header") %{
 
57
static void
 
58
t_output_helper( zval **target, zval *o) {
 
59
  if ( (*target)->type == IS_ARRAY ) {
 
60
    /* it's already an array, just append */
 
61
    add_next_index_zval( *target, o );
 
62
    return;
 
63
  }
 
64
  if ( (*target)->type == IS_NULL ) {
 
65
    REPLACE_ZVAL_VALUE(target,o,1);
 
66
    FREE_ZVAL(o);
 
67
    return;
 
68
  }
 
69
  zval *tmp;
 
70
  ALLOC_INIT_ZVAL(tmp);
 
71
  *tmp = **target;
 
72
  zval_copy_ctor(tmp);
 
73
  array_init(*target);
 
74
  add_next_index_zval( *target, tmp);
 
75
  add_next_index_zval( *target, o);
 
76
 
 
77
}
 
78
%}