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

Side by Side Diff: swig/Lib/typemaps/ptrtypes.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, 10 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/primtypes.swg ('k') | swig/Lib/typemaps/std_except.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 * See the LICENSE file for information on copyright, usage and redistribution
3 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
4 *
5 * ptrtypes.swg
6 *
7 * Value typemaps (Type, const Type&) for "Ptr" types, such as swig
8 * wrapped classes, that define the AsPtr/From methods
9 *
10 * To apply them, just use one of the following macros:
11 *
12 * %typemaps_asptr(CheckCode, AsPtrMeth, AsPtrFrag, Type)
13 * %typemaps_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, T ype)
14 *
15 * or the simpler and normalize form:
16 *
17 * %typemaps_asptrfromn(CheckCode, Type)
18 *
19 * Also, you can use the individual typemap definitions:
20 *
21 * %ptr_in_typemap(asptr_meth,frag,Type)
22 * %ptr_varin_typemap(asptr_meth,frag,Type)
23 * %ptr_typecheck_typemap(check,asptr_meth,frag,Type)
24 * %ptr_directorout_typemap(asptr_meth,frag,Type)
25 * ----------------------------------------------------------------------------- */
26
27 %include <typemaps/valtypes.swg>
28
29 /* in */
30
31 %define %ptr_in_typemap(asptr_meth,frag,Type...)
32 %typemap(in,fragment=frag) Type {
33 Type *ptr = (Type *)0;
34 int res = asptr_meth($input, &ptr);
35 if (!SWIG_IsOK(res) || !ptr) {
36 %argument_fail((ptr ? res : SWIG_TypeError), "$type", $symname, $argnum);
37 }
38 $1 = *ptr;
39 if (SWIG_IsNewObj(res)) %delete(ptr);
40 }
41 %typemap(freearg) Type "";
42 %typemap(in,fragment=frag) const Type & (int res = SWIG_OLDOBJ) {
43 Type *ptr = (Type *)0;
44 res = asptr_meth($input, &ptr);
45 if (!SWIG_IsOK(res)) { %argument_fail(res,"$type",$symname, $argnum); }
46 if (!ptr) { %argument_nullref("$type",$symname, $argnum); }
47 $1 = ptr;
48 }
49 %typemap(freearg,noblock=1) const Type & {
50 if (SWIG_IsNewObj(res$argnum)) %delete($1);
51 }
52 %enddef
53
54 /* varin */
55
56 %define %ptr_varin_typemap(asptr_meth,frag,Type...)
57 %typemap(varin,fragment=frag) Type {
58 Type *ptr = (Type *)0;
59 int res = asptr_meth($input, &ptr);
60 if (!SWIG_IsOK(res) || !ptr) {
61 %variable_fail((ptr ? res : SWIG_TypeError), "$type", "$name");
62 }
63 $1 = *ptr;
64 if (SWIG_IsNewObj(res)) %delete(ptr);
65 }
66 %enddef
67
68 #if defined(SWIG_DIRECTOR_TYPEMAPS)
69 /* directorout */
70
71 %define %ptr_directorout_typemap(asptr_meth,frag,Type...)
72 %typemap(directorargout,noblock=1,fragment=frag) Type *DIRECTOROUT ($*ltype te mp) {
73 Type *swig_optr = 0;
74 int swig_ores = $input ? asptr_meth($input, &swig_optr) : 0;
75 if (!SWIG_IsOK(swig_ores) || !swig_optr) {
76 %dirout_fail((swig_optr ? swig_ores : SWIG_TypeError),"$type");
77 }
78 temp = *swig_optr;
79 $result = &temp;
80 if (SWIG_IsNewObj(swig_ores)) %delete(swig_optr);
81 }
82
83 %typemap(directorout,noblock=1,fragment=frag) Type {
84 Type *swig_optr = 0;
85 int swig_ores = asptr_meth($input, &swig_optr);
86 if (!SWIG_IsOK(swig_ores) || !swig_optr) {
87 %dirout_fail((swig_optr ? swig_ores : SWIG_TypeError),"$type");
88 }
89 $result = *swig_optr;
90 if (SWIG_IsNewObj(swig_ores)) %delete(swig_optr);
91 }
92
93 %typemap(directorout,noblock=1,fragment=frag,warning=SWIGWARN_TYPEMAP_DIRECTOR OUT_PTR_MSG) Type* {
94 Type *swig_optr = 0;
95 int swig_ores = asptr_meth($input, &swig_optr);
96 if (!SWIG_IsOK(swig_ores)) {
97 %dirout_fail(swig_ores,"$type");
98 }
99 $result = swig_optr;
100 if (SWIG_IsNewObj(swig_ores)) {
101 swig_acquire_ownership(swig_optr);
102 }
103 }
104 %typemap(directorfree,noblock=1) Type*
105 {
106 if (director) {
107 director->swig_release_ownership(%as_voidptr($input));
108 }
109 }
110
111 %typemap(directorout,noblock=1,fragment=frag,warning=SWIGWARN_TYPEMAP_DIRECTOR OUT_PTR_MSG) Type& {
112 Type *swig_optr = 0;
113 int swig_ores = asptr_meth($input, &swig_optr);
114 if (!SWIG_IsOK(swig_ores)) {
115 %dirout_fail(swig_ores,"$type");
116 } else {
117 if (!swig_optr) {
118 %dirout_nullref("$type");
119 }
120 }
121 $result = swig_optr;
122 if (SWIG_IsNewObj(swig_ores)) {
123 swig_acquire_ownership(swig_optr);
124 }
125 }
126 %typemap(directorfree,noblock=1) Type&
127 {
128 if (director) {
129 director->swig_release_ownership(%as_voidptr($input));
130 }
131 }
132
133
134 %typemap(directorout,fragment=frag) Type &DIRECTOROUT = Type
135
136 %enddef
137
138 #else
139
140 #define %ptr_directorout_typemap(asptr_meth,frag,Type...)
141
142 #endif /* SWIG_DIRECTOR_TYPEMAPS */
143
144 /* typecheck */
145
146 %define %ptr_typecheck_typemap(check,asptr_meth,frag,Type...)
147 %typemap(typecheck,noblock=1,precedence=check,fragment=frag) Type * {
148 int res = asptr_meth($input, (Type**)(0));
149 $1 = SWIG_CheckState(res);
150 }
151
152 %typemap(typecheck,noblock=1,precedence=check,fragment=frag) Type, const Type& {
153 int res = asptr_meth($input, (Type**)(0));
154 $1 = SWIG_CheckState(res);
155 }
156 %enddef
157
158
159 /*---------------------------------------------------------------------
160 * typemap definition for types with asptr method
161 *---------------------------------------------------------------------*/
162
163 %define %typemaps_asptr(CheckCode, AsPtrMeth, AsPtrFrag, Type...)
164 %fragment(SWIG_AsVal_frag(Type),"header",fragment=SWIG_AsPtr_frag(Type)) {
165 SWIGINTERNINLINE int
166 SWIG_AsVal(Type)(SWIG_Object obj, Type *val)
167 {
168 Type *v = (Type *)0;
169 int res = SWIG_AsPtr(Type)(obj, &v);
170 if (!SWIG_IsOK(res)) return res;
171 if (v) {
172 if (val) *val = *v;
173 if (SWIG_IsNewObj(res)) {
174 %delete(v);
175 res = SWIG_DelNewMask(res);
176 }
177 return res;
178 }
179 return SWIG_ERROR;
180 }
181 }
182 %ptr_in_typemap(%arg(AsPtrMeth), %arg(AsPtrFrag), Type);
183 %ptr_varin_typemap(%arg(AsPtrMeth), %arg(AsPtrFrag), Type);
184 %ptr_directorout_typemap(%arg(AsPtrMeth), %arg(AsPtrFrag), Type);
185 %ptr_typecheck_typemap(%arg(CheckCode), %arg(AsPtrMeth),%arg(AsPtrFrag), Type) ;
186 %ptr_input_typemap(%arg(CheckCode),%arg(AsPtrMeth),%arg(AsPtrFrag),Type);
187 %enddef
188
189 /*---------------------------------------------------------------------
190 * typemap definition for types with asptr/from methods
191 *---------------------------------------------------------------------*/
192
193 %define %typemaps_asptrfrom(CheckCode, AsPtrMeth, FromMeth, AsPtrFrag, FromFrag, Type...)
194 %typemaps_asptr(%arg(CheckCode), %arg(AsPtrMeth), %arg(AsPtrFrag), Type)
195 %typemaps_from(%arg(FromMeth), %arg(FromFrag), Type);
196 %value_output_typemap(%arg(FromMeth), %arg(FromFrag), Type);
197 %ptr_inout_typemap(Type);
198 %enddef
199
200 /*---------------------------------------------------------------------
201 * typemap definition for types with for 'normalized' asptr/from methods
202 *---------------------------------------------------------------------*/
203
204 %define %typemaps_asptrfromn(CheckCode, Type...)
205 %typemaps_asptrfrom(%arg(CheckCode),
206 %arg(SWIG_AsPtr(Type)),
207 %arg(SWIG_From(Type)),
208 %arg(SWIG_AsPtr_frag(Type)),
209 %arg(SWIG_From_frag(Type)),
210 Type);
211 %enddef
OLDNEW
« no previous file with comments | « swig/Lib/typemaps/primtypes.swg ('k') | swig/Lib/typemaps/std_except.swg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698