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

« back to all changes in this revision

Viewing changes to Lib/php4/php4.swg

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2006-12-20 14:43:24 UTC
  • mfrom: (1.2.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20061220144324-bps3kb06xp5oy9w1
Tags: 1.3.31-1ubuntu1
* Merge from debian unstable, remaining changes:
  - drop support for pike
  - use php5 instead of php4
  - clean Runtime/ as well
  - force a few environment variables

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
%include <globalvar.i>  // Global variables.
16
16
%include <const.i>
17
17
 
18
 
// use %init %{ "/*code goes here*/ " %} 
 
18
// use %init %{ "/*code goes here*/ " %}
19
19
// or  %minit %{ "/* code goes here*/ " %} to
20
20
// insert code in the PHP_MINIT_FUNCTION
21
21
#define %minit %insert("init")
76
76
/* Object passed by value. Convert to a pointer */
77
77
%typemap(in) SWIGTYPE ($&1_ltype tmp)
78
78
{
79
 
        if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0) {
 
79
        if(SWIG_ConvertPtr(*$input, (void **) &tmp, $&1_descriptor, 0) < 0 || tmp == NULL) {
80
80
          SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
81
81
        }
82
82
        $1 = *tmp;
83
83
}
84
84
 
85
85
%typemap(in) SWIGTYPE *,
86
 
             SWIGTYPE [],
87
 
             SWIGTYPE &
 
86
             SWIGTYPE []
88
87
{
89
 
        /* typemap(in) SWIGTYPE * */
90
88
        if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0) {
91
89
            SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
92
90
        }
93
91
}
 
92
 
 
93
%typemap(in) SWIGTYPE &
 
94
{
 
95
        if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, 0) < 0 || $1 == NULL) {
 
96
            SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $1_descriptor");
 
97
        }
 
98
}
 
99
 
94
100
%typemap(in) SWIGTYPE *DISOWN
95
101
{
96
 
  /* typemap(in) SWIGTYPE *DISOWN */
97
102
  if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor, SWIG_POINTER_DISOWN ) < 0) {
98
103
    SWIG_PHP_Error(E_ERROR, "Type error in argument $argnum of $symname. Expected $&1_descriptor");
99
104
  }
101
106
%typemap(argout) SWIGTYPE *,
102
107
                 SWIGTYPE [],
103
108
                 SWIGTYPE&;
104
 
        
 
109
 
105
110
%typemap(in) void *
106
111
{
107
112
        if(SWIG_ConvertPtr(*$input, (void **) &$1, 0, 0) < 0) {
163
168
        ZVAL_LONG(return_value,$1);
164
169
}
165
170
 
166
 
%typemap(out) bool 
 
171
%typemap(out) bool
167
172
{
168
173
        ZVAL_BOOL(return_value,($1)?1:0);
169
174
}
176
181
 
177
182
%typemap(out) char
178
183
{
179
 
        // out char
180
184
        ZVAL_STRINGL(return_value,&$1, 1, 1);
181
185
}
182
186
 
225
229
  RETVAL_STRINGL($1,$1_dim0,1);
226
230
}
227
231
 
228
 
// This typecheck would do hard checking for proper argument type.
229
 
//%define %php_typecheck(_type,_prec,is)
230
 
//%typemap(typecheck,precedence=_prec) _type
231
 
// " $1 = Z_TYPE_PP($input) == is ? 1 : 0; "
232
 
//%enddef
233
 
 
 
232
// This typecheck does hard checking for proper argument type.  If you want
 
233
// an argument to be converted from a different PHP type, you must convert
 
234
// it yourself before passing it (e.g. (string)4.7 or (int)"6").
234
235
%define %php_typecheck(_type,_prec,is)
235
236
%typemap(typecheck,precedence=_prec) _type
236
 
 " $1 = (Z_TYPE_PP($input) == IS_LONG ||
237
 
         Z_TYPE_PP($input) == IS_DOUBLE ||
238
 
         Z_TYPE_PP($input) == IS_STRING) ? 1 : 0; "
 
237
 " $1 = (Z_TYPE_PP($input) == is); "
239
238
%enddef
240
239
 
241
240
%php_typecheck(int,SWIG_TYPECHECK_INTEGER,IS_LONG)
264
263
             SWIGTYPE [],
265
264
             SWIGTYPE &
266
265
{
267
 
  /* typecheck SWIGTYPE * */
268
266
  void *tmp;
269
 
  _v = (SWIG_ConvertPtr( *$input, (void**)&tmp, $1_descriptor, 0) < 0)? 0:1;
 
267
  _v = (SWIG_ConvertPtr( *$input, (void**)&tmp, $1_descriptor, 0) >= 0);
270
268
}
271
 
        
 
269
 
272
270
%typecheck(SWIG_TYPECHECK_VOIDPTR) void *
273
 
 " /* tyepcheck void * */ "
 
271
 " /* typecheck void * */ "
274
272
 
275
273
 
276
274
/* Exception handling */