Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: swig/Lib/typemaps/valtypes.swg

Issue 553095: Checkin swig binaries for win, linux and Mac... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/
Patch Set: '' Created 10 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « swig/Lib/typemaps/typemaps.swg ('k') | swig/Lib/typemaps/void.swg » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*---------------------------------------------------------------------
2 * Value typemaps (Type, const Type&) for value types, such as
3 * fundamental types (int, double), that define the AsVal/From
4 * methods.
5 *
6 * To apply them, just use one of the following macros:
7 *
8 * %typemaps_from(FromMeth, FromFrag, Type)
9 * %typemaps_asval(CheckCode, AsValMeth, AsValFrag, Type)
10 * %typemaps_asvalfrom(CheckCode, AsValMeth, FromMeth, AsValFrag, FromFrag, Ty pe)
11 *
12 * or the simpler and normalize form:
13 *
14 * %typemaps_asvalfromn(CheckCode, Type)
15 *
16 * Also, you can use the individual typemap definitions:
17 *
18 * %value_in_typemap(asval_meth,frag,Type)
19 * %value_varin_typemap(asval_meth,frag,Type)
20 * %value_typecheck_typemap(checkcode,asval_meth,frag,Type)
21 * %value_directorout_typemap(asval_meth,frag,Type)
22 *
23 * %value_out_typemap(from_meth,frag,Type)
24 * %value_varout_typemap(from_meth,frag,Type)
25 * %value_constcode_typemap(from_meth,frag,Type)
26 * %value_directorin_typemap(from_meth,frag,Type)
27 * %value_throws_typemap(from_meth,frag,Type)
28 *
29 *---------------------------------------------------------------------*/
30
31 /* in */
32
33 %define %value_in_typemap(asval_meth,frag,Type...)
34 %typemap(in,noblock=1,fragment=frag) Type (Type val, int ecode = 0) {
35 ecode = asval_meth($input, &val);
36 if (!SWIG_IsOK(ecode)) {
37 %argument_fail(ecode, "$ltype", $symname, $argnum);
38 }
39 $1 = %static_cast(val,$ltype);
40 }
41 %typemap(freearg) Type "";
42 %typemap(in,noblock=1,fragment=frag) const Type & ($*ltype temp, Type val, int ecode = 0) {
43 ecode = asval_meth($input, &val);
44 if (!SWIG_IsOK(ecode)) {
45 %argument_fail(ecode, "$*ltype", $symname, $argnum);
46 }
47 temp = %static_cast(val, $*ltype);
48 $1 = &temp;
49 }
50 %typemap(freearg) const Type& "";
51 %enddef
52
53 /* out */
54
55 %define %value_out_typemap(from_meth,frag,Type...)
56 %typemap(out,noblock=1,fragment=frag) Type, const Type {
57 %set_output(from_meth(%static_cast($1,Type)));
58 }
59 %typemap(out,noblock=1,fragment=frag) const Type& {
60 %set_output(from_meth(%static_cast(*$1,Type)));
61 }
62 %enddef
63
64 /* varin */
65
66 %define %value_varin_typemap(asval_meth,frag,Type...)
67 %typemap(varin,fragment=frag) Type {
68 Type val;
69 int res = asval_meth($input, &val);
70 if (!SWIG_IsOK(res)) {
71 %variable_fail(res, "$type", "$name");
72 }
73 $1 = %static_cast(val,$ltype);
74 }
75 %enddef
76
77 /* varout */
78
79 %define %value_varout_typemap(from_meth,frag,Type...)
80 %typemap(varout,noblock=1,fragment=frag) Type, const Type& {
81 %set_varoutput(from_meth(%static_cast($1,Type)));
82 }
83 %enddef
84
85 /* constant installation code */
86
87 %define %value_constcode_typemap(from_meth,frag,Type...)
88 %typemap(constcode,noblock=1,fragment=frag) Type {
89 %set_constant("$symname", from_meth(%static_cast($value,Type)));
90 }
91 %enddef
92
93
94 #if defined(SWIG_DIRECTOR_TYPEMAPS)
95
96 /* directorin */
97
98 %define %value_directorin_typemap(from_meth,frag,Type...)
99 %typemap(directorin,noblock=1,fragment=frag) Type *DIRECTORIN {
100 $input = from_meth(%static_cast(*$1_name,Type));
101 }
102 %typemap(directorin,noblock=1,fragment=frag) Type, const Type& {
103 $input = from_meth(%static_cast($1_name,Type));
104 }
105 %enddef
106
107 /* directorout */
108
109 %define %value_directorout_typemap(asval_meth,frag,Type...)
110 %typemap(directorargout,noblock=1,fragment=frag) Type *DIRECTOROUT {
111 Type swig_val;
112 int swig_res = asval_meth($input, &swig_val);
113 if (!SWIG_IsOK(swig_res)) {
114 %dirout_fail(swig_res, "$type");
115 }
116 *$result = %static_cast(swig_val, $type);
117 }
118 %typemap(directorout,noblock=1,fragment=frag) Type {
119 Type swig_val;
120 int swig_res = asval_meth($input, &swig_val);
121 if (!SWIG_IsOK(swig_res)) {
122 %dirout_fail(swig_res, "$type");
123 }
124 $result = %static_cast(swig_val,$type);
125 }
126 %typemap(directorout,noblock=1,fragment=frag,warning=SWIGWARN_TYPEMAP_DIRECTOR OUT_PTR_MSG) const Type& {
127 Type swig_val;
128 int swig_res = asval_meth($input, &swig_val);
129 if (!SWIG_IsOK(swig_res)) {
130 %dirout_fail(swig_res, "$type");
131 }
132 $basetype *temp = new $basetype(($basetype)swig_val);
133 swig_acquire_ownership(temp);
134 $result = temp;
135 }
136 %typemap(directorfree,noblock=1) const Type & {
137 if (director) {
138 director->swig_release_ownership(%as_voidptr($input));
139 }
140 }
141 %typemap(directorout,fragment=frag) Type &DIRECTOROUT = Type
142 %enddef
143
144 #else
145
146 #define %value_directorin_typemap(from_meth,frag,Type...)
147 #define %value_directorout_typemap(asval_meth,frag,Type...)
148
149 #endif /* SWIG_DIRECTOR_TYPEMAPS */
150
151
152 /* throws */
153
154 %define %value_throws_typemap(from_meth,frag,Type...)
155 %typemap(throws,noblock=1,fragment=frag) Type {
156 %raise(from_meth(%static_cast($1,Type)), "$type", 0);
157 }
158 %enddef
159
160 /* typecheck */
161
162 %define %value_typecheck_typemap(check,asval_meth,frag,Type...)
163 %typemap(typecheck,precedence=check,fragment=frag) Type, const Type& {
164 int res = asval_meth($input, NULL);
165 $1 = SWIG_CheckState(res);
166 }
167 %enddef
168
169 /*---------------------------------------------------------------------
170 * typemap definition for types with AsVal methods
171 *---------------------------------------------------------------------*/
172 %define %typemaps_asval(CheckCode, AsValMeth, AsValFrag, Type...)
173 %value_in_typemap(%arg(AsValMeth), %arg(AsValFrag), Type);
174 %value_varin_typemap(%arg(AsValMeth), %arg(AsValFrag), Type);
175 %value_directorout_typemap(%arg(AsValMeth), %arg(AsValFrag), Type);
176 %value_typecheck_typemap(%arg(CheckCode), %arg(AsValMeth), %arg(AsValFrag), Ty pe);
177 %value_input_typemap(%arg(CheckCode), %arg(AsValMeth), %arg(AsValFrag), Type);
178 %enddef
179
180
181 /*---------------------------------------------------------------------
182 * typemap definition for types with from method
183 *---------------------------------------------------------------------*/
184 %define %typemaps_from(FromMeth, FromFrag, Type...)
185 %value_out_typemap(%arg(FromMeth), %arg(FromFrag), Type);
186 %value_varout_typemap(%arg(FromMeth), %arg(FromFrag), Type);
187 %value_constcode_typemap(%arg(FromMeth), %arg(FromFrag), Type);
188 %value_directorin_typemap(%arg(FromMeth), %arg(FromFrag), Type);
189 %value_throws_typemap(%arg(FromMeth), %arg(FromFrag), Type);
190 %value_output_typemap(%arg(FromMeth), %arg(FromFrag), Type);
191 %enddef
192
193
194 /*---------------------------------------------------------------------
195 * typemap definition for types with alval/from method
196 *---------------------------------------------------------------------*/
197
198 %define %typemaps_asvalfrom(CheckCode, AsValMeth, FromMeth,
199 AsValFrag, FromFrag, Type...)
200 %typemaps_asval(%arg(CheckCode), %arg(AsValMeth), %arg(AsValFrag), Type);
201 %typemaps_from(%arg(FromMeth), %arg(FromFrag), Type);
202 %value_inout_typemap(Type);
203 %enddef
204
205
206 /*---------------------------------------------------------------------
207 * typemap definition for types with for 'normalized' asval/from methods
208 *---------------------------------------------------------------------*/
209 %define %typemaps_asvalfromn(CheckCode, Type...)
210 %typemaps_asvalfrom(%arg(CheckCode),
211 SWIG_AsVal(Type),
212 SWIG_From(Type),
213 %arg(SWIG_AsVal_frag(Type)),
214 %arg(SWIG_From_frag(Type)),
215 Type);
216 %enddef
OLDNEW
« no previous file with comments | « swig/Lib/typemaps/typemaps.swg ('k') | swig/Lib/typemaps/void.swg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698