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

Side by Side Diff: swig/Lib/typemaps/strings.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/string.swg ('k') | swig/Lib/typemaps/swigmacros.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 // Use the macro SWIG_PRESERVE_CARRAY_SIZE if you prefer to preserve
3 // the size of char arrays, ie
4 // ------------------------------------------
5 // C Side => Language Side
6 // ------------------------------------------
7 // char name[5] = "hola" => 'hola\0'
8 //
9 // the default behaviour is
10 //
11 // char name[5] = "hola" => 'hola'
12 //
13 //
14 //#define SWIG_PRESERVE_CARRAY_SIZE
15
16 /* ------------------------------------------------------------
17 * String typemaps for type Char (char or wchar_t)
18 * ------------------------------------------------------------ */
19
20 %define %_typemap_string(StringCode,
21 Char,
22 SWIG_AsCharPtrAndSize,
23 SWIG_FromCharPtrAndSize,
24 SWIG_CharPtrLen,
25 SWIG_AsCharPtr,
26 SWIG_FromCharPtr,
27 SWIG_AsCharArray)
28
29 /* in */
30
31 %typemap(in,noblock=1,fragment=#SWIG_AsCharPtr)
32 Char * (int res, Char *buf = 0, int alloc = 0),
33 const Char * (int res, Char *buf = 0, int alloc = 0) {
34 res = SWIG_AsCharPtr($input, &buf, &alloc);
35 if (!SWIG_IsOK(res)) {
36 %argument_fail(res,"$type",$symname, $argnum);
37 }
38 $1 = %reinterpret_cast(buf, $1_ltype);
39 }
40 %typemap(freearg,noblock=1,match="in") Char *, const Char * {
41 if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
42 }
43
44 %typemap(in,noblock=1,fragment=#SWIG_AsCharPtr) Char const*& (int res, Char *buf = 0, int alloc = 0) {
45 res = SWIG_AsCharPtr($input, &buf, &alloc);
46 if (!SWIG_IsOK(res)) {
47 %argument_fail(res,"$type",$symname, $argnum);
48 }
49 $1 = &buf;
50 }
51 %typemap(freearg, noblock=1,match="in") Char const*& {
52 if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
53 }
54
55 /* out */
56
57 %typemap(out,noblock=1,fragment=#SWIG_FromCharPtr) Char *, const Char* {
58 %set_output(SWIG_FromCharPtr((const Char *)$1));
59 }
60
61
62 %typemap(out,noblock=1,fragment=#SWIG_FromCharPtr) Char const*& {
63 %set_output(SWIG_FromCharPtr(*$1));
64 }
65
66 %typemap(newfree,noblock=1) Char * {
67 %delete_array($1);
68 }
69
70 /* varin */
71
72 %typemap(varin,fragment=#SWIG_AsCharPtrAndSize) Char * {
73 Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ;
74 int res = SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc);
75 if (!SWIG_IsOK(res)) {
76 %variable_fail(res,"$type","$name");
77 }
78 if ($1) %delete_array($1);
79 if (alloc == SWIG_NEWOBJ) {
80 $1 = cptr;
81 } else {
82 $1 = csize ? ($1_type)%new_copy_array(cptr, csize, Char) : 0;
83 }
84 }
85
86 %typemap(varin,fragment=#SWIG_AsCharPtrAndSize,warning=SWIGWARN_TYPEMAP_CHARLEAK _MSG) const Char * {
87 Char *cptr = 0; size_t csize = 0; int alloc = SWIG_NEWOBJ;
88 int res = SWIG_AsCharPtrAndSize($input, &cptr, &csize, &alloc);
89 if (!SWIG_IsOK(res)) {
90 %variable_fail(res, "$type", "$name");
91 }
92 if (alloc == SWIG_NEWOBJ) {
93 $1 = cptr;
94 } else {
95 $1 = csize ? ($1_type)%new_copy_array(cptr, csize, Char) : 0;
96 }
97 }
98
99 /* varout */
100
101 %typemap(varout,noblock=1,fragment=#SWIG_FromCharPtr) Char*, const Char* {
102 %set_varoutput(SWIG_FromCharPtr($1));
103 }
104
105 /* memberin */
106
107 %typemap(memberin,noblock=1) Char * {
108 if ($1) %delete_array($1);
109 if ($input) {
110 size_t size = SWIG_CharPtrLen(%reinterpret_cast($input, const Char *)) + 1;
111 $1 = ($1_type)%new_copy_array(%reinterpret_cast($input, const Char *), size, Char);
112 } else {
113 $1 = 0;
114 }
115 }
116
117 %typemap(memberin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
118 if ($input) {
119 size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, co nst Char *), const Char *)) + 1;
120 $1 = ($1_type)%new_copy_array($input, size, Char);
121 } else {
122 $1 = 0;
123 }
124 }
125
126 /* globalin */
127
128 %typemap(globalin,noblock=1) Char * {
129 if ($1) %delete_array($1);
130 if ($input) {
131 size_t size = SWIG_CharPtrLen(%reinterpret_cast(%reinterpret_cast($input, co nst Char *), const Char *)) + 1;
132 $1 = ($1_type)%new_copy_array($input, size, Char);
133 } else {
134 $1 = 0;
135 }
136 }
137
138 %typemap(globalin,noblock=1,warning=SWIGWARN_TYPEMAP_CHARLEAK_MSG) const Char * {
139 if ($input) {
140 size_t size = SWIG_CharPtrLen($input) + 1;
141 $1 = ($1_type)%new_copy_array($input, size, Char);
142 } else {
143 $1 = 0;
144 }
145 }
146
147 /* constant */
148
149 %typemap(constcode,noblock=1,fragment=#SWIG_FromCharPtr)
150 Char *, Char const*, Char * const, Char const* const {
151 %set_constant("$symname", SWIG_FromCharPtr($value));
152 }
153
154
155 #if defined(SWIG_DIRECTOR_TYPEMAPS)
156
157 /* directorin */
158
159 %typemap(directorin,noblock=1,fragment=#SWIG_FromCharPtr)
160 Char *, Char const*, Char *const, Char const *const,
161 Char const *&, Char *const &, Char const *const & {
162 $input = SWIG_FromCharPtr((const Char *)$1_name);
163 }
164
165
166 /* directorout */
167
168 %typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIGWARN_TYPEMAP _DIRECTOROUT_PTR_MSG)
169 Char * (int res, Char* buf = 0, int alloc = SWIG_NEWOBJ) {
170 res = SWIG_AsCharPtr($input, &buf, &alloc);
171 if (!SWIG_IsOK(res)) {
172 %dirout_fail(res, "$type");
173 }
174 if (alloc == SWIG_NEWOBJ) {
175 swig_acquire_ownership_array(buf);
176 }
177 $result = %reinterpret_cast(buf, $1_ltype);
178 }
179 %typemap(directorfree,noblock=1) Char *
180 {
181 if (director) {
182 director->swig_release_ownership(%as_voidptr($input));
183 }
184 }
185
186
187 %typemap(directorout,noblock=1,fragment=#SWIG_AsCharPtr,warning=SWIGWARN_TYPEMAP _DIRECTOROUT_PTR_MSG)
188 Char * const& (int res, Char* buf = 0, int alloc = SWIG_NEWOBJ),
189 Char const* const& (int res, Char* buf = 0, int alloc = SWIG_NEWOBJ) {
190 res = SWIG_AsCharPtr($input, &buf, &alloc);
191 if (!SWIG_IsOK(res)) {
192 %dirout_fail(res, "$type");
193 }
194 static $*1_ltype tmp = buf;
195 $result = &tmp;
196 if (alloc == SWIG_NEWOBJ) {
197 swig_acquire_ownership_array(buf);
198 }
199 }
200 %typemap(directorfree,noblock=1)
201 Char * const&, Char const* const& {
202 if (director) {
203 director->swig_release_ownership(%as_voidptr(*$input));
204 }
205 }
206
207 #endif /* SWIG_DIRECTOR_TYPEMAPS */
208
209 /* typecheck */
210
211 %typemap(typecheck,noblock=1,precedence=StringCode,
212 fragment=#SWIG_AsCharPtr) Char *, Char const*& {
213 int res = SWIG_AsCharPtr($input, 0, 0);
214 $1 = SWIG_CheckState(res);
215 }
216
217
218 /* throws */
219
220 %typemap(throws,noblock=1,fragment=#SWIG_FromCharPtr) Char * {
221 %raise(SWIG_FromCharPtr($1), "$type", 0);
222 }
223
224
225 /* ------------------------------------------------------------
226 * Unknown size const Character array Char[ANY] handling
227 * ------------------------------------------------------------ */
228
229 %apply Char* { Char [] };
230 %apply const Char* { const Char [] };
231
232 %typemap(varin,noblock=1,warning="462:Unable to set variable of type Char []") C har []
233 {
234 %variable_fail(SWIG_AttributeError, "$type", "read-only $name");
235 }
236
237
238 /* ------------------------------------------------------------
239 * Fixed size Character array Char[ANY] handling
240 * ------------------------------------------------------------ */
241
242 /* memberin and globalin typemaps */
243
244 %typemap(memberin,noblock=1) Char [ANY]
245 {
246 if ($input) memcpy($1,$input,$1_dim0*sizeof(Char));
247 else memset($1,0,$1_dim0*sizeof(Char));
248 }
249
250 %typemap(globalin,noblock=1) Char [ANY]
251 {
252 if ($input) memcpy($1,$input,$1_dim0*sizeof(Char));
253 else memset($1,0,$1_dim0*sizeof(Char));
254 }
255
256 /* in */
257
258 %typemap(in,noblock=1,fragment=#SWIG_AsCharArray)
259 Char [ANY] (Char temp[$1_dim0], int res),
260 const Char [ANY](Char temp[$1_dim0], int res)
261 {
262 res = SWIG_AsCharArray($input, temp, $1_dim0);
263 if (!SWIG_IsOK(res)) {
264 %argument_fail(res,"$type",$symname, $argnum);
265 }
266 $1 = %reinterpret_cast(temp, $1_ltype);
267 }
268 %typemap(freearg) Char [ANY], const Char [ANY] "";
269
270 %typemap(in,noblock=1,fragment=#SWIG_AsCharArray) const Char (&)[ANY] (Char temp [$1_dim0], int res)
271 {
272 res = SWIG_AsCharArray($input, temp, $1_dim0);
273 if (!SWIG_IsOK(res)) {
274 %argument_fail(res,"$type",$symname, $argnum);
275 }
276 $1 = &temp;
277 }
278 %typemap(freearg) const Char (&)[ANY] "";
279
280 %typemap(out,fragment=#SWIG_FromCharPtrAndSize)
281 Char [ANY], const Char[ANY]
282 {
283 size_t size = $1_dim0;
284 %#ifndef SWIG_PRESERVE_CARRAY_SIZE
285 while (size && ($1[size - 1] == '\0')) --size;
286 %#endif
287 %set_output(SWIG_FromCharPtrAndSize($1, size));
288 }
289
290 /* varin */
291
292 %typemap(varin,fragment=#SWIG_AsCharArray) Char [ANY]
293 {
294 int res = SWIG_AsCharArray($input, $1, $1_dim0);
295 if (!SWIG_IsOK(res)) {
296 %variable_fail(res, "$type", "$name");
297 }
298 }
299
300 /* varout */
301
302 %typemap(varout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
303 Char [ANY], const Char [ANY] {
304 size_t size = $1_dim0;
305 %#ifndef SWIG_PRESERVE_CARRAY_SIZE
306 while (size && ($1[size - 1] == '\0')) --size;
307 %#endif
308 %set_varoutput(SWIG_FromCharPtrAndSize($1, size));
309 }
310
311 /* constant */
312
313 %typemap(constcode,fragment=#SWIG_FromCharPtrAndSize)
314 Char [ANY], const Char [ANY]
315 {
316 size_t size = $value_dim0;
317 %#ifndef SWIG_PRESERVE_CARRAY_SIZE
318 while (size && ($value[size - 1] == '\0')) --size;
319 %#endif
320 %set_constant("$symname", SWIG_FromCharPtrAndSize($value,size));
321 }
322
323
324 #if defined(SWIG_DIRECTOR_TYPEMAPS)
325
326 /* directorin */
327 %typemap(directorin,fragment=#SWIG_FromCharPtrAndSize)
328 Char [ANY], const Char [ANY]
329 {
330 size_t size = $1_dim0;
331 %#ifndef SWIG_PRESERVE_CARRAY_SIZE
332 while (size && ($1_name[size - 1] == '\0')) --size;
333 %#endif
334 $input = SWIG_FromCharPtrAndSize($1_name, size);
335 }
336
337 /* directorout */
338
339 %typemap(directorout,noblock=1,fragment=#SWIG_AsCharArray)
340 Char [ANY] (Char temp[$result_dim0]),
341 const Char [ANY] (Char temp[$result_dim0], int res)
342 {
343 res = SWIG_AsCharArray($input, temp, $result_dim0);
344 if (!SWIG_IsOK(res)) {
345 %dirout_fail(res, "$type");
346 }
347 $result = temp;
348 }
349
350 #endif /* SWIG_DIRECTOR_TYPEMAPS */
351
352 /* typecheck */
353
354 %typemap(typecheck,noblock=1,precedence=StringCode,
355 fragment=#SWIG_AsCharArray)
356 Char [ANY], const Char[ANY] {
357 int res = SWIG_AsCharArray($input, (Char *)0, 0);
358 $1 = SWIG_CheckState(res);
359 }
360
361
362 /* throws */
363
364 %typemap(throws,fragment=#SWIG_FromCharPtrAndSize)
365 Char [ANY], const Char[ANY]
366 {
367 size_t size = $1_dim0;
368 %#ifndef SWIG_PRESERVE_CARRAY_SIZE
369 while (size && ($1[size - 1] == '\0')) --size;
370 %#endif
371 %raise(SWIG_FromCharPtrAndSize($1, size), "$type", 0);
372 }
373
374 /* -------------------------------------------------------------------
375 * --- Really fix size Char arrays, including '\0'chars at the end ---
376 * ------------------------------------------------------------------- */
377
378 %typemap(varout,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
379 Char FIXSIZE[ANY], const Char FIXSIZE[ANY]
380 {
381 %set_varoutput(SWIG_FromCharPtrAndSize($1, $1_dim0));
382 }
383
384 %typemap(out,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
385 Char FIXSIZE[ANY], const Char FIXSIZE[ANY]
386 {
387 %set_output(SWIG_FromCharPtrAndSize($1, $1_dim0));
388 }
389
390 #if defined(SWIG_DIRECTOR_TYPEMAPS)
391
392 %typemap(directorin,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
393 Char FIXSIZE[ANY], const Char FIXSIZE[ANY]
394 {
395 $input = SWIG_FromCharPtrAndSize($1_name, $1_dim0);
396 }
397
398 #endif /* SWIG_DIRECTOR_TYPEMAPS */
399
400 %typemap(throws,noblock=1,fragment=#SWIG_FromCharPtrAndSize)
401 Char FIXSIZE[ANY], const Char FIXSIZE[ANY] {
402 %raise(SWIG_FromCharPtrAndSize($1, $1_dim0), "$type", 0);
403 }
404
405 /* ------------------------------------------------------------
406 * --- String & length ---
407 * ------------------------------------------------------------ */
408
409 /* Here len doesn't include the '0' terminator */
410 %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize)
411 (Char *STRING, size_t LENGTH) (int res, Char *buf = 0, size_t size = 0, int al loc = 0),
412 (const Char *STRING, size_t LENGTH) (int res, Char *buf = 0, size_t size = 0, int alloc = 0)
413 {
414 res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc);
415 if (!SWIG_IsOK(res)) {
416 %argument_fail(res,"$type",$symname, $argnum);
417 }
418 $1 = %reinterpret_cast(buf, $1_ltype);
419 $2 = %numeric_cast(size - 1, $2_ltype);
420 }
421 %typemap(freearg,noblock=1,match="in") (Char *STRING, size_t LENGTH) {
422 if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
423 }
424 /* old 'int' form */
425 %typemap(in) (Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH);
426 %typemap(freearg) (Char *STRING, int LENGTH) = (Char *STRING, size_t LENGTH);
427
428
429 /* Here size includes the '0' terminator */
430 %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize)
431 (Char *STRING, size_t SIZE) (int res, Char *buf = 0, size_t size = 0, int allo c = 0),
432 (const Char *STRING, size_t SIZE) (int res, Char *buf = 0, size_t size = 0, in t alloc = 0)
433 {
434 res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc);
435 if (!SWIG_IsOK(res)) {
436 %argument_fail(res,"$type",$symname, $argnum);
437 }
438 $1 = %reinterpret_cast(buf, $1_ltype);
439 $2 = %numeric_cast(size, $2_ltype);
440 }
441 %typemap(freearg,noblock=1,match="in") (Char *STRING, size_t SIZE) {
442 if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
443 }
444 /* old 'int' form */
445 %typemap(in) (Char *STRING, int SIZE) = (Char *STRING, size_t SIZE);
446 %typemap(freearg) (Char *STRING, int SIZE) = (Char *STRING, size_t SIZE);
447
448
449 /* reverse order versions */
450
451 /* Here len doesn't include the '0' terminator */
452 %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize)
453 (size_t LENGTH, Char *STRING) (int res, Char *buf = 0, size_t size = 0, int al loc = 0),
454 (size_t LENGHT, const Char *STRING) (int res, Char *buf = 0, size_t size = 0, int alloc = 0)
455 {
456 res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc);
457 if (!SWIG_IsOK(res)) {
458 %argument_fail(res,"$type",$symname, $argnum);
459 }
460 $2 = %reinterpret_cast(buf, $2_ltype) ;
461 $1 = %numeric_cast(size - 1, $1_ltype) ;
462 }
463 %typemap(freearg, noblock=1, match="in") (size_t LENGTH, Char *STRING) {
464 if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
465 }
466 /* old 'int' form */
467 %typemap(in) (int LENGTH, Char *STRING) = (size_t LENGTH, Char *STRING);
468 %typemap(freearg) (int LENGTH, Char *STRING) = (size_t LENGTH, Char *STRING);
469
470 /* Here size includes the '0' terminator */
471 %typemap(in,noblock=1,fragment=#SWIG_AsCharPtrAndSize)
472 (size_t SIZE, Char *STRING) (int res, Char *buf = 0, size_t size = 0, int allo c = 0),
473 (size_t SIZE, const Char *STRING) (int res, Char *buf = 0, size_t size = 0, in t alloc = 0)
474 {
475 res = SWIG_AsCharPtrAndSize($input, &buf, &size, &alloc);
476 if (!SWIG_IsOK(res)) {
477 %argument_fail(res, "$type",$symname, $argnum);
478 }
479 $2 = %reinterpret_cast(buf, $2_ltype) ;
480 $1 = %numeric_cast(size, $1_ltype) ;
481 }
482 %typemap(freearg, noblock=1, match="in") (size_t SIZE, Char *STRING) {
483 if (alloc$argnum == SWIG_NEWOBJ) %delete_array(buf$argnum);
484 }
485 /* old 'int' form */
486 %typemap(in) (int SIZE, Char *STRING) = (size_t SIZE, Char *STRING);
487 %typemap(freearg) (int SIZE, Char *STRING) = (size_t SIZE, Char *STRING);
488
489
490 %enddef
491
492
493 /* ------------------------------------------------------------
494 * --- String fragment methods ---
495 * ------------------------------------------------------------ */
496
497
498 %define %typemaps_string(StringCode, CharCode,
499 Char, CharName,
500 SWIG_AsCharPtrAndSize,
501 SWIG_FromCharPtrAndSize,
502 SWIG_CharPtrLen,
503 FragLimits, CHAR_MIN, CHAR_MAX)
504
505 %fragment("SWIG_From"#CharName"Ptr","header",fragment=#SWIG_FromCharPtrAndSize) {
506 SWIGINTERNINLINE SWIG_Object
507 SWIG_From##CharName##Ptr(const Char *cptr)
508 {
509 return SWIG_FromCharPtrAndSize(cptr, (cptr ? SWIG_CharPtrLen(cptr) : 0));
510 }
511 }
512
513 %fragment("SWIG_From"#CharName"Array","header",fragment=#SWIG_FromCharPtrAndSize ) {
514 SWIGINTERNINLINE SWIG_Object
515 SWIG_From##CharName##Array(const Char *cptr, size_t size)
516 {
517 return SWIG_FromCharPtrAndSize(cptr, size);
518 }
519 }
520
521 %fragment("SWIG_As" #CharName "Ptr","header",fragment=#SWIG_AsCharPtrAndSize) {
522 %define_as(SWIG_As##CharName##Ptr(obj, val, alloc), SWIG_AsCharPtrAndSize(obj, v al, NULL, alloc))
523 }
524
525 %fragment("SWIG_As" #CharName "Array","header",fragment=#SWIG_AsCharPtrAndSize) {
526 SWIGINTERN int
527 SWIG_As##CharName##Array(SWIG_Object obj, Char *val, size_t size)
528 {
529 Char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
530 int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
531 if (SWIG_IsOK(res)) {
532 if ((csize == size + 1) && cptr && !(cptr[csize-1])) --csize;
533 if (csize <= size) {
534 if (val) {
535 if (csize) memcpy(val, cptr, csize*sizeof(Char));
536 if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(Char));
537 }
538 if (alloc == SWIG_NEWOBJ) {
539 %delete_array(cptr);
540 res = SWIG_DelNewMask(res);
541 }
542 return res;
543 }
544 if (alloc == SWIG_NEWOBJ) %delete_array(cptr);
545 }
546 return SWIG_TypeError;
547 }
548 }
549
550 /* Char */
551
552 %fragment(SWIG_From_frag(Char),"header",fragment=#SWIG_FromCharPtrAndSize) {
553 SWIGINTERNINLINE SWIG_Object
554 SWIG_From_dec(Char)(Char c)
555 {
556 return SWIG_FromCharPtrAndSize(&c,1);
557 }
558 }
559
560 %fragment(SWIG_AsVal_frag(Char),"header",
561 fragment="SWIG_As"#CharName"Array",
562 fragment=FragLimits,
563 fragment=SWIG_AsVal_frag(long)) {
564 SWIGINTERN int
565 SWIG_AsVal_dec(Char)(SWIG_Object obj, Char *val)
566 {
567 int res = SWIG_As##CharName##Array(obj, val, 1);
568 if (!SWIG_IsOK(res)) {
569 long v;
570 res = SWIG_AddCast(SWIG_AsVal(long)(obj, &v));
571 if (SWIG_IsOK(res)) {
572 if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
573 if (val) *val = %numeric_cast(v, Char);
574 } else {
575 res = SWIG_OverflowError;
576 }
577 }
578 }
579 return res;
580 }
581 }
582
583 %typemaps_asvalfromn(CharCode, Char);
584
585 %_typemap_string(StringCode,
586 Char,
587 SWIG_AsCharPtrAndSize,
588 SWIG_FromCharPtrAndSize,
589 SWIG_CharPtrLen,
590 SWIG_As##CharName##Ptr,
591 SWIG_From##CharName##Ptr,
592 SWIG_As##CharName##Array)
593
594 %enddef
OLDNEW
« no previous file with comments | « swig/Lib/typemaps/string.swg ('k') | swig/Lib/typemaps/swigmacros.swg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698