File: php4.swg

package info (click to toggle)
swig1.3 1.3.11-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 6,852 kB
  • ctags: 4,764
  • sloc: ansic: 20,489; cpp: 10,052; sh: 7,256; yacc: 2,669; makefile: 2,381; python: 873; java: 762; tcl: 686; perl: 474; lisp: 444; ruby: 370; php: 367
file content (113 lines) | stat: -rw-r--r-- 3,048 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/*
 * php4.swg
 *
 * PHP 4 configuration file
 *
 */

%runtime "common.swg"		// common type checking code
%runtime "php4run.swg"		// Php4 runtime functions

/* Typemaps for input parameters */

%typemap(in) int, unsigned int, unsigned short, short, unsigned short, long, unsigned long, signed char, unsigned char, bool, enum SWIGTYPE
	"convert_to_long_ex($input);
	$1 = ($1_ltype) Z_LVAL_PP($input);";

%typemap(in) char
	"convert_to_string_ex($input);
	$1 = ($1_ltype) *Z_STRVAL_PP($input);";

%typemap(in) float,double
	"convert_to_double_ex($input);
	$1 = ($1_ltype) Z_DVAL_PP($input);";

%typemap(in) char *
	"convert_to_string_ex($input);
	$1 = ($1_ltype) Z_STRVAL_PP($input);";

%typemap(in) SWIGTYPE *, SWIGTYPE [], SWIGTYPE & {
	if(SWIG_ConvertPtr(*$input, (void **) &$1, $1_descriptor) < 0) {
	  zend_error(E_ERROR, "Type error in argument $argnum of $symname. Expected ", $1_descriptor->name);
	}
}
	
%typemap(in) void * {
	if(SWIG_ConvertPtr(*$input, (void **) $1, 0) < 0) {
	  zend_error(E_ERROR, "Type error in argument $argnum of $symname. Expected ", $1_descriptor->name);
	}
}

/* Object passed by value. Convert to a pointer */
%typemap(in) SWIGTYPE {
	$&1_ltype argp;
	if(SWIG_ConvertPtr(*$input, (void **) argp, $&1_descriptor) < 0) {
	  zend_error(E_ERROR, "Type error in argument $argnum of $symname. Expected ", $&1_descriptor->name);
	}
}

/* Typemap for output values */

%typemap(out) int, unsigned int, short, unsigned short, long, unsigned long, signed char, unsigned char, bool, enum SWIGTYPE
	"RETURN_LONG($1);";

%typemap(out) float, double
	"RETURN_DOUBLE($1);";

%typemap(out) char {
	"char ctemp[2];
	ctemp[0] = $1;
	ctemp[1] = 0;
	RETURN_STRING(ctemp, 1);";
}

%typemap(out) char *
	"RETURN_STRING($1, 1);";

%typemap(out) SWIGTYPE *, SWIGTYPE [], SWIGTYPE &
	"SWIG_SetPointerZval(return_value, (void *)$1, $1_descriptor);";

%typemap(out) SWIGTYPE
#ifdef __cplusplus
{
  $&1_ltype resultobj = new $1_ltype($1);
  SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor);
}
#else
{
  $&1_ltype resultobj = ($&1_ltype) malloc(sizeof($1_type));
  memmove(resultobj, &$1, sizeof($1_type));
  SWIG_SetPointerZval(return_value, (void *)resultobj, $&1_descriptor);
}
#endif

%typemap(out) void "";

/* Typemap for character array returns */

%typemap(out) char [ANY] {
	char *s;
	s = estrdup($1);
	RETURN_STRING(s, 1);
}

/* Typemaps for constants */

%typemap(consttab) int, unsigned int, short, unsigned short, long, unsigned long, unsigned char, signed char, bool, enum SWIGTYPE
	"REGISTER_LONG_CONSTANT( \"$symname\", $value, CONST_CS);";

%typemap(consttab) float, double
	"REGISTER_DOUBLE_CONSTANT(\"$symname\", $value, CONST_CS);";

%typemap(consttab) char, char *
	"REGISTER_STRING_CONSTANT(\"$symname\", \"$value\", CONST_CS | CONST_PERSISTENT);";

%typemap(consttab) SWIGTYPE *, SWIGTYPE &, SWIGTYPE [] {
	char *cp;
	SWIG_SetPointerChar(&cp, (void*)$value, $descriptor);
	REGISTER_STRING_CONSTANT("$symname", cp, CONST_CS | CONST_PERSISTENT);
}

/* Some ANSI C typemaps */

%apply long { size_t };