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

Side by Side Diff: swig/Lib/swigrun.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/swigrun.i ('k') | swig/Lib/swigwarn.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 * swigrun.swg
3 *
4 * This file contains generic C API SWIG runtime support for pointer
5 * type checking.
6 * ----------------------------------------------------------------------------- */
7
8 /* This should only be incremented when either the layout of swig_type_info chan ges,
9 or for whatever reason, the runtime changes incompatibly */
10 #define SWIG_RUNTIME_VERSION "4"
11
12 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
13 #ifdef SWIG_TYPE_TABLE
14 # define SWIG_QUOTE_STRING(x) #x
15 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
16 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
17 #else
18 # define SWIG_TYPE_TABLE_NAME
19 #endif
20
21 /*
22 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
23 creating a static or dynamic library from the SWIG runtime code.
24 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
25
26 But only do this if strictly necessary, ie, if you have problems
27 with your compiler or suchlike.
28 */
29
30 #ifndef SWIGRUNTIME
31 # define SWIGRUNTIME SWIGINTERN
32 #endif
33
34 #ifndef SWIGRUNTIMEINLINE
35 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
36 #endif
37
38 /* Generic buffer size */
39 #ifndef SWIG_BUFFER_SIZE
40 # define SWIG_BUFFER_SIZE 1024
41 #endif
42
43 /* Flags for pointer conversions */
44 #define SWIG_POINTER_DISOWN 0x1
45 #define SWIG_CAST_NEW_MEMORY 0x2
46
47 /* Flags for new pointer objects */
48 #define SWIG_POINTER_OWN 0x1
49
50
51 /*
52 Flags/methods for returning states.
53
54 The SWIG conversion methods, as ConvertPtr, return and integer
55 that tells if the conversion was successful or not. And if not,
56 an error code can be returned (see swigerrors.swg for the codes).
57
58 Use the following macros/flags to set or process the returning
59 states.
60
61 In old versions of SWIG, code such as the following was usually written:
62
63 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
64 // success code
65 } else {
66 //fail code
67 }
68
69 Now you can be more explicit:
70
71 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
72 if (SWIG_IsOK(res)) {
73 // success code
74 } else {
75 // fail code
76 }
77
78 which is the same really, but now you can also do
79
80 Type *ptr;
81 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
82 if (SWIG_IsOK(res)) {
83 // success code
84 if (SWIG_IsNewObj(res) {
85 ...
86 delete *ptr;
87 } else {
88 ...
89 }
90 } else {
91 // fail code
92 }
93
94 I.e., now SWIG_ConvertPtr can return new objects and you can
95 identify the case and take care of the deallocation. Of course that
96 also requires SWIG_ConvertPtr to return new result values, such as
97
98 int SWIG_ConvertPtr(obj, ptr,...) {
99 if (<obj is ok>) {
100 if (<need new object>) {
101 *ptr = <ptr to new allocated object>;
102 return SWIG_NEWOBJ;
103 } else {
104 *ptr = <ptr to old object>;
105 return SWIG_OLDOBJ;
106 }
107 } else {
108 return SWIG_BADOBJ;
109 }
110 }
111
112 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
113 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
114 SWIG errors code.
115
116 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
117 allows to return the 'cast rank', for example, if you have this
118
119 int food(double)
120 int fooi(int);
121
122 and you call
123
124 food(1) // cast rank '1' (1 -> 1.0)
125 fooi(1) // cast rank '0'
126
127 just use the SWIG_AddCast()/SWIG_CheckState()
128 */
129
130 #define SWIG_OK (0)
131 #define SWIG_ERROR (-1)
132 #define SWIG_IsOK(r) (r >= 0)
133 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
134
135 /* The CastRankLimit says how many bits are used for the cast rank */
136 #define SWIG_CASTRANKLIMIT (1 << 8)
137 /* The NewMask denotes the object was created (using new/malloc) */
138 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
139 /* The TmpMask is for in/out typemaps that use temporal objects */
140 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
141 /* Simple returning values */
142 #define SWIG_BADOBJ (SWIG_ERROR)
143 #define SWIG_OLDOBJ (SWIG_OK)
144 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
145 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
146 /* Check, add and del mask methods */
147 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
148 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
149 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
150 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
151 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
152 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
153
154 /* Cast-Rank Mode */
155 #if defined(SWIG_CASTRANK_MODE)
156 # ifndef SWIG_TypeRank
157 # define SWIG_TypeRank unsigned long
158 # endif
159 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
160 # define SWIG_MAXCASTRANK (2)
161 # endif
162 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
163 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
164 SWIGINTERNINLINE int SWIG_AddCast(int r) {
165 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ ERROR) : r;
166 }
167 SWIGINTERNINLINE int SWIG_CheckState(int r) {
168 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
169 }
170 #else /* no cast-rank mode */
171 # define SWIG_AddCast
172 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
173 #endif
174
175
176 #include <string.h>
177
178 #ifdef __cplusplus
179 extern "C" {
180 #endif
181
182 typedef void *(*swig_converter_func)(void *, int *);
183 typedef struct swig_type_info *(*swig_dycast_func)(void **);
184
185 /* Structure to store information on one type */
186 typedef struct swig_type_info {
187 const char *name; /* mangled name of this type */
188 const char *str; /* human readable name of this t ype */
189 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
190 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
191 void *clientdata; /* language specific type data * /
192 int owndata; /* flag if the structure owns th e clientdata */
193 } swig_type_info;
194
195 /* Structure to store a type and conversion function used for casting */
196 typedef struct swig_cast_info {
197 swig_type_info *type; /* pointer to type that is equiv alent to this type */
198 swig_converter_func converter; /* function to cast the void poi nters */
199 struct swig_cast_info *next; /* pointer to next cast in linke d list */
200 struct swig_cast_info *prev; /* pointer to the previous cast */
201 } swig_cast_info;
202
203 /* Structure used to store module information
204 * Each module generates one structure like this, and the runtime collects
205 * all of these structures and stores them in a circularly linked list.*/
206 typedef struct swig_module_info {
207 swig_type_info **types; /* Array of pointers to swig_typ e_info structures that are in this module */
208 size_t size; /* Number of types in this modul e */
209 struct swig_module_info *next; /* Pointer to next element in ci rcularly linked list */
210 swig_type_info **type_initial; /* Array of initially generated type structures */
211 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
212 void *clientdata; /* Language specific module data */
213 } swig_module_info;
214
215 /*
216 Compare two type names skipping the space characters, therefore
217 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
218
219 Return 0 when the two name types are equivalent, as in
220 strncmp, but skipping ' '.
221 */
222 SWIGRUNTIME int
223 SWIG_TypeNameComp(const char *f1, const char *l1,
224 const char *f2, const char *l2) {
225 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
226 while ((*f1 == ' ') && (f1 != l1)) ++f1;
227 while ((*f2 == ' ') && (f2 != l2)) ++f2;
228 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
229 }
230 return (int)((l1 - f1) - (l2 - f2));
231 }
232
233 /*
234 Check type equivalence in a name list like <name1>|<name2>|...
235 Return 0 if not equal, 1 if equal
236 */
237 SWIGRUNTIME int
238 SWIG_TypeEquiv(const char *nb, const char *tb) {
239 int equiv = 0;
240 const char* te = tb + strlen(tb);
241 const char* ne = nb;
242 while (!equiv && *ne) {
243 for (nb = ne; *ne; ++ne) {
244 if (*ne == '|') break;
245 }
246 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
247 if (*ne) ++ne;
248 }
249 return equiv;
250 }
251
252 /*
253 Check type equivalence in a name list like <name1>|<name2>|...
254 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
255 */
256 SWIGRUNTIME int
257 SWIG_TypeCompare(const char *nb, const char *tb) {
258 int equiv = 0;
259 const char* te = tb + strlen(tb);
260 const char* ne = nb;
261 while (!equiv && *ne) {
262 for (nb = ne; *ne; ++ne) {
263 if (*ne == '|') break;
264 }
265 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
266 if (*ne) ++ne;
267 }
268 return equiv;
269 }
270
271
272 /*
273 Check the typename
274 */
275 SWIGRUNTIME swig_cast_info *
276 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
277 if (ty) {
278 swig_cast_info *iter = ty->cast;
279 while (iter) {
280 if (strcmp(iter->type->name, c) == 0) {
281 if (iter == ty->cast)
282 return iter;
283 /* Move iter to the top of the linked list */
284 iter->prev->next = iter->next;
285 if (iter->next)
286 iter->next->prev = iter->prev;
287 iter->next = ty->cast;
288 iter->prev = 0;
289 if (ty->cast) ty->cast->prev = iter;
290 ty->cast = iter;
291 return iter;
292 }
293 iter = iter->next;
294 }
295 }
296 return 0;
297 }
298
299 /*
300 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparis on
301 */
302 SWIGRUNTIME swig_cast_info *
303 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
304 if (ty) {
305 swig_cast_info *iter = ty->cast;
306 while (iter) {
307 if (iter->type == from) {
308 if (iter == ty->cast)
309 return iter;
310 /* Move iter to the top of the linked list */
311 iter->prev->next = iter->next;
312 if (iter->next)
313 iter->next->prev = iter->prev;
314 iter->next = ty->cast;
315 iter->prev = 0;
316 if (ty->cast) ty->cast->prev = iter;
317 ty->cast = iter;
318 return iter;
319 }
320 iter = iter->next;
321 }
322 }
323 return 0;
324 }
325
326 /*
327 Cast a pointer up an inheritance hierarchy
328 */
329 SWIGRUNTIMEINLINE void *
330 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
331 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
332 }
333
334 /*
335 Dynamic pointer casting. Down an inheritance hierarchy
336 */
337 SWIGRUNTIME swig_type_info *
338 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
339 swig_type_info *lastty = ty;
340 if (!ty || !ty->dcast) return ty;
341 while (ty && (ty->dcast)) {
342 ty = (*ty->dcast)(ptr);
343 if (ty) lastty = ty;
344 }
345 return lastty;
346 }
347
348 /*
349 Return the name associated with this type
350 */
351 SWIGRUNTIMEINLINE const char *
352 SWIG_TypeName(const swig_type_info *ty) {
353 return ty->name;
354 }
355
356 /*
357 Return the pretty name associated with this type,
358 that is an unmangled type name in a form presentable to the user.
359 */
360 SWIGRUNTIME const char *
361 SWIG_TypePrettyName(const swig_type_info *type) {
362 /* The "str" field contains the equivalent pretty names of the
363 type, separated by vertical-bar characters. We choose
364 to print the last name, as it is often (?) the most
365 specific. */
366 if (!type) return NULL;
367 if (type->str != NULL) {
368 const char *last_name = type->str;
369 const char *s;
370 for (s = type->str; *s; s++)
371 if (*s == '|') last_name = s+1;
372 return last_name;
373 }
374 else
375 return type->name;
376 }
377
378 /*
379 Set the clientdata field for a type
380 */
381 SWIGRUNTIME void
382 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
383 swig_cast_info *cast = ti->cast;
384 /* if (ti->clientdata == clientdata) return; */
385 ti->clientdata = clientdata;
386
387 while (cast) {
388 if (!cast->converter) {
389 swig_type_info *tc = cast->type;
390 if (!tc->clientdata) {
391 SWIG_TypeClientData(tc, clientdata);
392 }
393 }
394 cast = cast->next;
395 }
396 }
397 SWIGRUNTIME void
398 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
399 SWIG_TypeClientData(ti, clientdata);
400 ti->owndata = 1;
401 }
402
403 /*
404 Search for a swig_type_info structure only by mangled name
405 Search is a O(log #types)
406
407 We start searching at module start, and finish searching when start == end.
408 Note: if start == end at the beginning of the function, we go all the way arou nd
409 the circular list.
410 */
411 SWIGRUNTIME swig_type_info *
412 SWIG_MangledTypeQueryModule(swig_module_info *start,
413 swig_module_info *end,
414 const char *name) {
415 swig_module_info *iter = start;
416 do {
417 if (iter->size) {
418 register size_t l = 0;
419 register size_t r = iter->size - 1;
420 do {
421 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
422 register size_t i = (l + r) >> 1;
423 const char *iname = iter->types[i]->name;
424 if (iname) {
425 register int compare = strcmp(name, iname);
426 if (compare == 0) {
427 return iter->types[i];
428 } else if (compare < 0) {
429 if (i) {
430 r = i - 1;
431 } else {
432 break;
433 }
434 } else if (compare > 0) {
435 l = i + 1;
436 }
437 } else {
438 break; /* should never happen */
439 }
440 } while (l <= r);
441 }
442 iter = iter->next;
443 } while (iter != end);
444 return 0;
445 }
446
447 /*
448 Search for a swig_type_info structure for either a mangled name or a human rea dable name.
449 It first searches the mangled names of the types, which is a O(log #types)
450 If a type is not found it then searches the human readable names, which is O(# types).
451
452 We start searching at module start, and finish searching when start == end.
453 Note: if start == end at the beginning of the function, we go all the way arou nd
454 the circular list.
455 */
456 SWIGRUNTIME swig_type_info *
457 SWIG_TypeQueryModule(swig_module_info *start,
458 swig_module_info *end,
459 const char *name) {
460 /* STEP 1: Search the name field using binary search */
461 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
462 if (ret) {
463 return ret;
464 } else {
465 /* STEP 2: If the type hasn't been found, do a complete search
466 of the str field (the human readable name) */
467 swig_module_info *iter = start;
468 do {
469 register size_t i = 0;
470 for (; i < iter->size; ++i) {
471 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
472 return iter->types[i];
473 }
474 iter = iter->next;
475 } while (iter != end);
476 }
477
478 /* neither found a match */
479 return 0;
480 }
481
482 /*
483 Pack binary data into a string
484 */
485 SWIGRUNTIME char *
486 SWIG_PackData(char *c, void *ptr, size_t sz) {
487 static const char hex[17] = "0123456789abcdef";
488 register const unsigned char *u = (unsigned char *) ptr;
489 register const unsigned char *eu = u + sz;
490 for (; u != eu; ++u) {
491 register unsigned char uu = *u;
492 *(c++) = hex[(uu & 0xf0) >> 4];
493 *(c++) = hex[uu & 0xf];
494 }
495 return c;
496 }
497
498 /*
499 Unpack binary data from a string
500 */
501 SWIGRUNTIME const char *
502 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
503 register unsigned char *u = (unsigned char *) ptr;
504 register const unsigned char *eu = u + sz;
505 for (; u != eu; ++u) {
506 register char d = *(c++);
507 register unsigned char uu;
508 if ((d >= '0') && (d <= '9'))
509 uu = ((d - '0') << 4);
510 else if ((d >= 'a') && (d <= 'f'))
511 uu = ((d - ('a'-10)) << 4);
512 else
513 return (char *) 0;
514 d = *(c++);
515 if ((d >= '0') && (d <= '9'))
516 uu |= (d - '0');
517 else if ((d >= 'a') && (d <= 'f'))
518 uu |= (d - ('a'-10));
519 else
520 return (char *) 0;
521 *u = uu;
522 }
523 return c;
524 }
525
526 /*
527 Pack 'void *' into a string buffer.
528 */
529 SWIGRUNTIME char *
530 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
531 char *r = buff;
532 if ((2*sizeof(void *) + 2) > bsz) return 0;
533 *(r++) = '_';
534 r = SWIG_PackData(r,&ptr,sizeof(void *));
535 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
536 strcpy(r,name);
537 return buff;
538 }
539
540 SWIGRUNTIME const char *
541 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
542 if (*c != '_') {
543 if (strcmp(c,"NULL") == 0) {
544 *ptr = (void *) 0;
545 return name;
546 } else {
547 return 0;
548 }
549 }
550 return SWIG_UnpackData(++c,ptr,sizeof(void *));
551 }
552
553 SWIGRUNTIME char *
554 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz ) {
555 char *r = buff;
556 size_t lname = (name ? strlen(name) : 0);
557 if ((2*sz + 2 + lname) > bsz) return 0;
558 *(r++) = '_';
559 r = SWIG_PackData(r,ptr,sz);
560 if (lname) {
561 strncpy(r,name,lname+1);
562 } else {
563 *r = 0;
564 }
565 return buff;
566 }
567
568 SWIGRUNTIME const char *
569 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
570 if (*c != '_') {
571 if (strcmp(c,"NULL") == 0) {
572 memset(ptr,0,sz);
573 return name;
574 } else {
575 return 0;
576 }
577 }
578 return SWIG_UnpackData(++c,ptr,sz);
579 }
580
581 #ifdef __cplusplus
582 }
583 #endif
OLDNEW
« no previous file with comments | « swig/Lib/swigrun.i ('k') | swig/Lib/swigwarn.swg » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698