1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
3 * Version 1.3.40
4 *
5 * This file is not intended to be easily readable and contains a number of
6 * coding conventions designed to improve portability and efficiency. Do not make
7 * changes to this file unless you know what you are doing--modify the SWIG
8 * interface file instead.
9 * ----------------------------------------------------------------------------- */
10
11 #define SWIGPYTHON
12 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
13
14 /* -----------------------------------------------------------------------------
15 * This section contains generic SWIG labels for method/variable
16 * declarations/attributes, and other compiler dependent labels.
17 * ----------------------------------------------------------------------------- */
18
19 /* template workaround for compilers that cannot correctly implement the C++ standard */
20 #ifndef SWIGTEMPLATEDISAMBIGUATOR
21 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
22 # define SWIGTEMPLATEDISAMBIGUATOR template
23 # elif defined(__HP_aCC)
24 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
25 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
26 # define SWIGTEMPLATEDISAMBIGUATOR template
27 # else
28 # define SWIGTEMPLATEDISAMBIGUATOR
29 # endif
30 #endif
31
32 /* inline attribute */
33 #ifndef SWIGINLINE
34 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
35 # define SWIGINLINE inline
36 # else
37 # define SWIGINLINE
38 # endif
39 #endif
40
41 /* attribute recognised by some compilers to avoid 'unused' warnings */
42 #ifndef SWIGUNUSED
43 # if defined(__GNUC__)
44 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
45 # define SWIGUNUSED __attribute__ ((__unused__))
46 # else
47 # define SWIGUNUSED
48 # endif
49 # elif defined(__ICC)
50 # define SWIGUNUSED __attribute__ ((__unused__))
51 # else
52 # define SWIGUNUSED
53 # endif
54 #endif
55
56 #ifndef SWIG_MSC_UNSUPPRESS_4505
57 # if defined(_MSC_VER)
58 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
59 # endif
60 #endif
61
62 #ifndef SWIGUNUSEDPARM
63 # ifdef __cplusplus
64 # define SWIGUNUSEDPARM(p)
65 # else
66 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
67 # endif
68 #endif
69
70 /* internal SWIG method */
71 #ifndef SWIGINTERN
72 # define SWIGINTERN static SWIGUNUSED
73 #endif
74
75 /* internal inline SWIG method */
76 #ifndef SWIGINTERNINLINE
77 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
78 #endif
79
80 /* exporting methods */
81 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
82 # ifndef GCC_HASCLASSVISIBILITY
83 # define GCC_HASCLASSVISIBILITY
84 # endif
85 #endif
86
87 #ifndef SWIGEXPORT
88 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
89 # if defined(STATIC_LINKED)
90 # define SWIGEXPORT
91 # else
92 # define SWIGEXPORT __declspec(dllexport)
93 # endif
94 # else
95 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
96 # define SWIGEXPORT __attribute__ ((visibility("default")))
97 # else
98 # define SWIGEXPORT
99 # endif
100 # endif
101 #endif
102
103 /* calling conventions for Windows */
104 #ifndef SWIGSTDCALL
105 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
106 # define SWIGSTDCALL __stdcall
107 # else
108 # define SWIGSTDCALL
109 # endif
110 #endif
111
112 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
113 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
114 # define _CRT_SECURE_NO_DEPRECATE
115 #endif
116
117 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
118 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
119 # define _SCL_SECURE_NO_DEPRECATE
120 #endif
121
122
123
124 /* Python.h has to appear first */
125 #include <Python.h>
126
127 /* -----------------------------------------------------------------------------
128 * swigrun.swg
129 *
130 * This file contains generic C API SWIG runtime support for pointer
131 * type checking.
132 * ----------------------------------------------------------------------------- */
133
134 /* This should only be incremented when either the layout of swig_type_info changes,
135 or for whatever reason, the runtime changes incompatibly */
136 #define SWIG_RUNTIME_VERSION "4"
137
138 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
139 #ifdef SWIG_TYPE_TABLE
140 # define SWIG_QUOTE_STRING(x) #x
141 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
142 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
143 #else
144 # define SWIG_TYPE_TABLE_NAME
145 #endif
146
147 /*
148 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
149 creating a static or dynamic library from the SWIG runtime code.
150 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
151
152 But only do this if strictly necessary, ie, if you have problems
153 with your compiler or suchlike.
154 */
155
156 #ifndef SWIGRUNTIME
157 # define SWIGRUNTIME SWIGINTERN
158 #endif
159
160 #ifndef SWIGRUNTIMEINLINE
161 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
162 #endif
163
164 /* Generic buffer size */
165 #ifndef SWIG_BUFFER_SIZE
166 # define SWIG_BUFFER_SIZE 1024
167 #endif
168
169 /* Flags for pointer conversions */
170 #define SWIG_POINTER_DISOWN 0x1
171 #define SWIG_CAST_NEW_MEMORY 0x2
172
173 /* Flags for new pointer objects */
174 #define SWIG_POINTER_OWN 0x1
175
176
177 /*
178 Flags/methods for returning states.
179
180 The SWIG conversion methods, as ConvertPtr, return and integer
181 that tells if the conversion was successful or not. And if not,
182 an error code can be returned (see swigerrors.swg for the codes).
183
184 Use the following macros/flags to set or process the returning
185 states.
186
187 In old versions of SWIG, code such as the following was usually written:
188
189 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
190 // success code
191 } else {
192 //fail code
193 }
194
195 Now you can be more explicit:
196
197 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
198 if (SWIG_IsOK(res)) {
199 // success code
200 } else {
201 // fail code
202 }
203
204 which is the same really, but now you can also do
205
206 Type *ptr;
207 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
208 if (SWIG_IsOK(res)) {
209 // success code
210 if (SWIG_IsNewObj(res) {
211 ...
212 delete *ptr;
213 } else {
214 ...
215 }
216 } else {
217 // fail code
218 }
219
220 I.e., now SWIG_ConvertPtr can return new objects and you can
221 identify the case and take care of the deallocation. Of course that
222 also requires SWIG_ConvertPtr to return new result values, such as
223
224 int SWIG_ConvertPtr(obj, ptr,...) {
225 if (<obj is ok>) {
226 if (<need new object>) {
227 *ptr = <ptr to new allocated object>;
228 return SWIG_NEWOBJ;
229 } else {
230 *ptr = <ptr to old object>;
231 return SWIG_OLDOBJ;
232 }
233 } else {
234 return SWIG_BADOBJ;
235 }
236 }
237
238 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
239 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
240 SWIG errors code.
241
242 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
243 allows to return the 'cast rank', for example, if you have this
244
245 int food(double)
246 int fooi(int);
247
248 and you call
249
250 food(1) // cast rank '1' (1 -> 1.0)
251 fooi(1) // cast rank '0'
252
253 just use the SWIG_AddCast()/SWIG_CheckState()
254 */
255
256 #define SWIG_OK (0)
257 #define SWIG_ERROR (-1)
258 #define SWIG_IsOK(r) (r >= 0)
259 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
260
261 /* The CastRankLimit says how many bits are used for the cast rank */
262 #define SWIG_CASTRANKLIMIT (1 << 8)
263 /* The NewMask denotes the object was created (using new/malloc) */
264 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
265 /* The TmpMask is for in/out typemaps that use temporal objects */
266 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
267 /* Simple returning values */
268 #define SWIG_BADOBJ (SWIG_ERROR)
269 #define SWIG_OLDOBJ (SWIG_OK)
270 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
271 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
272 /* Check, add and del mask methods */
273 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
274 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
275 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
276 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
277 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
278 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
279
280 /* Cast-Rank Mode */
281 #if defined(SWIG_CASTRANK_MODE)
282 # ifndef SWIG_TypeRank
283 # define SWIG_TypeRank unsigned long
284 # endif
285 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
286 # define SWIG_MAXCASTRANK (2)
287 # endif
288 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
289 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIG_AddCast(int r)290 SWIGINTERNINLINE int SWIG_AddCast(int r) {
291 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
292 }
SWIG_CheckState(int r)293 SWIGINTERNINLINE int SWIG_CheckState(int r) {
294 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
295 }
296 #else /* no cast-rank mode */
297 # define SWIG_AddCast
298 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
299 #endif
300
301
302 #include <string.h>
303
304 #ifdef __cplusplus
305 extern "C" {
306 #endif
307
308 typedef void *(*swig_converter_func)(void *, int *);
309 typedef struct swig_type_info *(*swig_dycast_func)(void **);
310
311 /* Structure to store information on one type */
312 typedef struct swig_type_info {
313 const char *name; /* mangled name of this type */
314 const char *str; /* human readable name of this type */
315 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
316 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
317 void *clientdata; /* language specific type data */
318 int owndata; /* flag if the structure owns the clientdata */
319 } swig_type_info;
320
321 /* Structure to store a type and conversion function used for casting */
322 typedef struct swig_cast_info {
323 swig_type_info *type; /* pointer to type that is equivalent to this type */
324 swig_converter_func converter; /* function to cast the void pointers */
325 struct swig_cast_info *next; /* pointer to next cast in linked list */
326 struct swig_cast_info *prev; /* pointer to the previous cast */
327 } swig_cast_info;
328
329 /* Structure used to store module information
330 * Each module generates one structure like this, and the runtime collects
331 * all of these structures and stores them in a circularly linked list.*/
332 typedef struct swig_module_info {
333 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
334 size_t size; /* Number of types in this module */
335 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
336 swig_type_info **type_initial; /* Array of initially generated type structures */
337 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
338 void *clientdata; /* Language specific module data */
339 } swig_module_info;
340
341 /*
342 Compare two type names skipping the space characters, therefore
343 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
344
345 Return 0 when the two name types are equivalent, as in
346 strncmp, but skipping ' '.
347 */
348 SWIGRUNTIME int
SWIG_TypeNameComp(const char * f1,const char * l1,const char * f2,const char * l2)349 SWIG_TypeNameComp(const char *f1, const char *l1,
350 const char *f2, const char *l2) {
351 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
352 while ((*f1 == ' ') && (f1 != l1)) ++f1;
353 while ((*f2 == ' ') && (f2 != l2)) ++f2;
354 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
355 }
356 return (int)((l1 - f1) - (l2 - f2));
357 }
358
359 /*
360 Check type equivalence in a name list like <name1>|<name2>|...
361 Return 0 if not equal, 1 if equal
362 */
363 SWIGRUNTIME int
SWIG_TypeEquiv(const char * nb,const char * tb)364 SWIG_TypeEquiv(const char *nb, const char *tb) {
365 int equiv = 0;
366 const char* te = tb + strlen(tb);
367 const char* ne = nb;
368 while (!equiv && *ne) {
369 for (nb = ne; *ne; ++ne) {
370 if (*ne == '|') break;
371 }
372 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
373 if (*ne) ++ne;
374 }
375 return equiv;
376 }
377
378 /*
379 Check type equivalence in a name list like <name1>|<name2>|...
380 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
381 */
382 SWIGRUNTIME int
SWIG_TypeCompare(const char * nb,const char * tb)383 SWIG_TypeCompare(const char *nb, const char *tb) {
384 int equiv = 0;
385 const char* te = tb + strlen(tb);
386 const char* ne = nb;
387 while (!equiv && *ne) {
388 for (nb = ne; *ne; ++ne) {
389 if (*ne == '|') break;
390 }
391 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
392 if (*ne) ++ne;
393 }
394 return equiv;
395 }
396
397
398 /*
399 Check the typename
400 */
401 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char * c,swig_type_info * ty)402 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
403 if (ty) {
404 swig_cast_info *iter = ty->cast;
405 while (iter) {
406 if (strcmp(iter->type->name, c) == 0) {
407 if (iter == ty->cast)
408 return iter;
409 /* Move iter to the top of the linked list */
410 iter->prev->next = iter->next;
411 if (iter->next)
412 iter->next->prev = iter->prev;
413 iter->next = ty->cast;
414 iter->prev = 0;
415 if (ty->cast) ty->cast->prev = iter;
416 ty->cast = iter;
417 return iter;
418 }
419 iter = iter->next;
420 }
421 }
422 return 0;
423 }
424
425 /*
426 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
427 */
428 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info * from,swig_type_info * ty)429 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
430 if (ty) {
431 swig_cast_info *iter = ty->cast;
432 while (iter) {
433 if (iter->type == from) {
434 if (iter == ty->cast)
435 return iter;
436 /* Move iter to the top of the linked list */
437 iter->prev->next = iter->next;
438 if (iter->next)
439 iter->next->prev = iter->prev;
440 iter->next = ty->cast;
441 iter->prev = 0;
442 if (ty->cast) ty->cast->prev = iter;
443 ty->cast = iter;
444 return iter;
445 }
446 iter = iter->next;
447 }
448 }
449 return 0;
450 }
451
452 /*
453 Cast a pointer up an inheritance hierarchy
454 */
455 SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info * ty,void * ptr,int * newmemory)456 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
457 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
458 }
459
460 /*
461 Dynamic pointer casting. Down an inheritance hierarchy
462 */
463 SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info * ty,void ** ptr)464 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
465 swig_type_info *lastty = ty;
466 if (!ty || !ty->dcast) return ty;
467 while (ty && (ty->dcast)) {
468 ty = (*ty->dcast)(ptr);
469 if (ty) lastty = ty;
470 }
471 return lastty;
472 }
473
474 /*
475 Return the name associated with this type
476 */
477 SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info * ty)478 SWIG_TypeName(const swig_type_info *ty) {
479 return ty->name;
480 }
481
482 /*
483 Return the pretty name associated with this type,
484 that is an unmangled type name in a form presentable to the user.
485 */
486 SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info * type)487 SWIG_TypePrettyName(const swig_type_info *type) {
488 /* The "str" field contains the equivalent pretty names of the
489 type, separated by vertical-bar characters. We choose
490 to print the last name, as it is often (?) the most
491 specific. */
492 if (!type) return NULL;
493 if (type->str != NULL) {
494 const char *last_name = type->str;
495 const char *s;
496 for (s = type->str; *s; s++)
497 if (*s == '|') last_name = s+1;
498 return last_name;
499 }
500 else
501 return type->name;
502 }
503
504 /*
505 Set the clientdata field for a type
506 */
507 SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info * ti,void * clientdata)508 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
509 swig_cast_info *cast = ti->cast;
510 /* if (ti->clientdata == clientdata) return; */
511 ti->clientdata = clientdata;
512
513 while (cast) {
514 if (!cast->converter) {
515 swig_type_info *tc = cast->type;
516 if (!tc->clientdata) {
517 SWIG_TypeClientData(tc, clientdata);
518 }
519 }
520 cast = cast->next;
521 }
522 }
523 SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info * ti,void * clientdata)524 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
525 SWIG_TypeClientData(ti, clientdata);
526 ti->owndata = 1;
527 }
528
529 /*
530 Search for a swig_type_info structure only by mangled name
531 Search is a O(log #types)
532
533 We start searching at module start, and finish searching when start == end.
534 Note: if start == end at the beginning of the function, we go all the way around
535 the circular list.
536 */
537 SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)538 SWIG_MangledTypeQueryModule(swig_module_info *start,
539 swig_module_info *end,
540 const char *name) {
541 swig_module_info *iter = start;
542 do {
543 if (iter->size) {
544 register size_t l = 0;
545 register size_t r = iter->size - 1;
546 do {
547 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
548 register size_t i = (l + r) >> 1;
549 const char *iname = iter->types[i]->name;
550 if (iname) {
551 register int compare = strcmp(name, iname);
552 if (compare == 0) {
553 return iter->types[i];
554 } else if (compare < 0) {
555 if (i) {
556 r = i - 1;
557 } else {
558 break;
559 }
560 } else if (compare > 0) {
561 l = i + 1;
562 }
563 } else {
564 break; /* should never happen */
565 }
566 } while (l <= r);
567 }
568 iter = iter->next;
569 } while (iter != end);
570 return 0;
571 }
572
573 /*
574 Search for a swig_type_info structure for either a mangled name or a human readable name.
575 It first searches the mangled names of the types, which is a O(log #types)
576 If a type is not found it then searches the human readable names, which is O(#types).
577
578 We start searching at module start, and finish searching when start == end.
579 Note: if start == end at the beginning of the function, we go all the way around
580 the circular list.
581 */
582 SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)583 SWIG_TypeQueryModule(swig_module_info *start,
584 swig_module_info *end,
585 const char *name) {
586 /* STEP 1: Search the name field using binary search */
587 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
588 if (ret) {
589 return ret;
590 } else {
591 /* STEP 2: If the type hasn't been found, do a complete search
592 of the str field (the human readable name) */
593 swig_module_info *iter = start;
594 do {
595 register size_t i = 0;
596 for (; i < iter->size; ++i) {
597 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
598 return iter->types[i];
599 }
600 iter = iter->next;
601 } while (iter != end);
602 }
603
604 /* neither found a match */
605 return 0;
606 }
607
608 /*
609 Pack binary data into a string
610 */
611 SWIGRUNTIME char *
SWIG_PackData(char * c,void * ptr,size_t sz)612 SWIG_PackData(char *c, void *ptr, size_t sz) {
613 static const char hex[17] = "0123456789abcdef";
614 register const unsigned char *u = (unsigned char *) ptr;
615 register const unsigned char *eu = u + sz;
616 for (; u != eu; ++u) {
617 register unsigned char uu = *u;
618 *(c++) = hex[(uu & 0xf0) >> 4];
619 *(c++) = hex[uu & 0xf];
620 }
621 return c;
622 }
623
624 /*
625 Unpack binary data from a string
626 */
627 SWIGRUNTIME const char *
SWIG_UnpackData(const char * c,void * ptr,size_t sz)628 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
629 register unsigned char *u = (unsigned char *) ptr;
630 register const unsigned char *eu = u + sz;
631 for (; u != eu; ++u) {
632 register char d = *(c++);
633 register unsigned char uu;
634 if ((d >= '0') && (d <= '9'))
635 uu = ((d - '0') << 4);
636 else if ((d >= 'a') && (d <= 'f'))
637 uu = ((d - ('a'-10)) << 4);
638 else
639 return (char *) 0;
640 d = *(c++);
641 if ((d >= '0') && (d <= '9'))
642 uu |= (d - '0');
643 else if ((d >= 'a') && (d <= 'f'))
644 uu |= (d - ('a'-10));
645 else
646 return (char *) 0;
647 *u = uu;
648 }
649 return c;
650 }
651
652 /*
653 Pack 'void *' into a string buffer.
654 */
655 SWIGRUNTIME char *
SWIG_PackVoidPtr(char * buff,void * ptr,const char * name,size_t bsz)656 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
657 char *r = buff;
658 if ((2*sizeof(void *) + 2) > bsz) return 0;
659 *(r++) = '_';
660 r = SWIG_PackData(r,&ptr,sizeof(void *));
661 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
662 strcpy(r,name);
663 return buff;
664 }
665
666 SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char * c,void ** ptr,const char * name)667 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
668 if (*c != '_') {
669 if (strcmp(c,"NULL") == 0) {
670 *ptr = (void *) 0;
671 return name;
672 } else {
673 return 0;
674 }
675 }
676 return SWIG_UnpackData(++c,ptr,sizeof(void *));
677 }
678
679 SWIGRUNTIME char *
SWIG_PackDataName(char * buff,void * ptr,size_t sz,const char * name,size_t bsz)680 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
681 char *r = buff;
682 size_t lname = (name ? strlen(name) : 0);
683 if ((2*sz + 2 + lname) > bsz) return 0;
684 *(r++) = '_';
685 r = SWIG_PackData(r,ptr,sz);
686 if (lname) {
687 strncpy(r,name,lname+1);
688 } else {
689 *r = 0;
690 }
691 return buff;
692 }
693
694 SWIGRUNTIME const char *
SWIG_UnpackDataName(const char * c,void * ptr,size_t sz,const char * name)695 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
696 if (*c != '_') {
697 if (strcmp(c,"NULL") == 0) {
698 memset(ptr,0,sz);
699 return name;
700 } else {
701 return 0;
702 }
703 }
704 return SWIG_UnpackData(++c,ptr,sz);
705 }
706
707 #ifdef __cplusplus
708 }
709 #endif
710
711 /* Errors in SWIG */
712 #define SWIG_UnknownError -1
713 #define SWIG_IOError -2
714 #define SWIG_RuntimeError -3
715 #define SWIG_IndexError -4
716 #define SWIG_TypeError -5
717 #define SWIG_DivisionByZero -6
718 #define SWIG_OverflowError -7
719 #define SWIG_SyntaxError -8
720 #define SWIG_ValueError -9
721 #define SWIG_SystemError -10
722 #define SWIG_AttributeError -11
723 #define SWIG_MemoryError -12
724 #define SWIG_NullReferenceError -13
725
726
727
728 /* Compatibility macros for Python 3 */
729 #if PY_VERSION_HEX >= 0x03000000
730
731 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
732 #define PyInt_Check(x) PyLong_Check(x)
733 #define PyInt_AsLong(x) PyLong_AsLong(x)
734 #define PyInt_FromLong(x) PyLong_FromLong(x)
735 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
736
737 #endif
738
739 #ifndef Py_TYPE
740 # define Py_TYPE(op) ((op)->ob_type)
741 #endif
742
743 /* SWIG APIs for compatibility of both Python 2 & 3 */
744
745 #if PY_VERSION_HEX >= 0x03000000
746 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
747 #else
748 # define SWIG_Python_str_FromFormat PyString_FromFormat
749 #endif
750
751
752 /* Warning: This function will allocate a new string in Python 3,
753 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
754 */
755 SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject * str)756 SWIG_Python_str_AsChar(PyObject *str)
757 {
758 #if PY_VERSION_HEX >= 0x03000000
759 char *cstr;
760 char *newstr;
761 Py_ssize_t len;
762 str = PyUnicode_AsUTF8String(str);
763 PyBytes_AsStringAndSize(str, &cstr, &len);
764 newstr = (char *) malloc(len+1);
765 memcpy(newstr, cstr, len+1);
766 Py_XDECREF(str);
767 return newstr;
768 #else
769 return PyString_AsString(str);
770 #endif
771 }
772
773 #if PY_VERSION_HEX >= 0x03000000
774 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
775 #else
776 # define SWIG_Python_str_DelForPy3(x)
777 #endif
778
779
780 SWIGINTERN PyObject*
SWIG_Python_str_FromChar(const char * c)781 SWIG_Python_str_FromChar(const char *c)
782 {
783 #if PY_VERSION_HEX >= 0x03000000
784 return PyUnicode_FromString(c);
785 #else
786 return PyString_FromString(c);
787 #endif
788 }
789
790 /* Add PyOS_snprintf for old Pythons */
791 #if PY_VERSION_HEX < 0x02020000
792 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
793 # define PyOS_snprintf _snprintf
794 # else
795 # define PyOS_snprintf snprintf
796 # endif
797 #endif
798
799 /* A crude PyString_FromFormat implementation for old Pythons */
800 #if PY_VERSION_HEX < 0x02020000
801
802 #ifndef SWIG_PYBUFFER_SIZE
803 # define SWIG_PYBUFFER_SIZE 1024
804 #endif
805
806 static PyObject *
PyString_FromFormat(const char * fmt,...)807 PyString_FromFormat(const char *fmt, ...) {
808 va_list ap;
809 char buf[SWIG_PYBUFFER_SIZE * 2];
810 int res;
811 va_start(ap, fmt);
812 res = vsnprintf(buf, sizeof(buf), fmt, ap);
813 va_end(ap);
814 return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
815 }
816 #endif
817
818 /* Add PyObject_Del for old Pythons */
819 #if PY_VERSION_HEX < 0x01060000
820 # define PyObject_Del(op) PyMem_DEL((op))
821 #endif
822 #ifndef PyObject_DEL
823 # define PyObject_DEL PyObject_Del
824 #endif
825
826 /* A crude PyExc_StopIteration exception for old Pythons */
827 #if PY_VERSION_HEX < 0x02020000
828 # ifndef PyExc_StopIteration
829 # define PyExc_StopIteration PyExc_RuntimeError
830 # endif
831 # ifndef PyObject_GenericGetAttr
832 # define PyObject_GenericGetAttr 0
833 # endif
834 #endif
835
836 /* Py_NotImplemented is defined in 2.1 and up. */
837 #if PY_VERSION_HEX < 0x02010000
838 # ifndef Py_NotImplemented
839 # define Py_NotImplemented PyExc_RuntimeError
840 # endif
841 #endif
842
843 /* A crude PyString_AsStringAndSize implementation for old Pythons */
844 #if PY_VERSION_HEX < 0x02010000
845 # ifndef PyString_AsStringAndSize
846 # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
847 # endif
848 #endif
849
850 /* PySequence_Size for old Pythons */
851 #if PY_VERSION_HEX < 0x02000000
852 # ifndef PySequence_Size
853 # define PySequence_Size PySequence_Length
854 # endif
855 #endif
856
857 /* PyBool_FromLong for old Pythons */
858 #if PY_VERSION_HEX < 0x02030000
859 static
PyBool_FromLong(long ok)860 PyObject *PyBool_FromLong(long ok)
861 {
862 PyObject *result = ok ? Py_True : Py_False;
863 Py_INCREF(result);
864 return result;
865 }
866 #endif
867
868 /* Py_ssize_t for old Pythons */
869 /* This code is as recommended by: */
870 /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
871 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
872 typedef int Py_ssize_t;
873 # define PY_SSIZE_T_MAX INT_MAX
874 # define PY_SSIZE_T_MIN INT_MIN
875 #endif
876
877 /* -----------------------------------------------------------------------------
878 * error manipulation
879 * ----------------------------------------------------------------------------- */
880
881 SWIGRUNTIME PyObject*
SWIG_Python_ErrorType(int code)882 SWIG_Python_ErrorType(int code) {
883 PyObject* type = 0;
884 switch(code) {
885 case SWIG_MemoryError:
886 type = PyExc_MemoryError;
887 break;
888 case SWIG_IOError:
889 type = PyExc_IOError;
890 break;
891 case SWIG_RuntimeError:
892 type = PyExc_RuntimeError;
893 break;
894 case SWIG_IndexError:
895 type = PyExc_IndexError;
896 break;
897 case SWIG_TypeError:
898 type = PyExc_TypeError;
899 break;
900 case SWIG_DivisionByZero:
901 type = PyExc_ZeroDivisionError;
902 break;
903 case SWIG_OverflowError:
904 type = PyExc_OverflowError;
905 break;
906 case SWIG_SyntaxError:
907 type = PyExc_SyntaxError;
908 break;
909 case SWIG_ValueError:
910 type = PyExc_ValueError;
911 break;
912 case SWIG_SystemError:
913 type = PyExc_SystemError;
914 break;
915 case SWIG_AttributeError:
916 type = PyExc_AttributeError;
917 break;
918 default:
919 type = PyExc_RuntimeError;
920 }
921 return type;
922 }
923
924
925 SWIGRUNTIME void
SWIG_Python_AddErrorMsg(const char * mesg)926 SWIG_Python_AddErrorMsg(const char* mesg)
927 {
928 PyObject *type = 0;
929 PyObject *value = 0;
930 PyObject *traceback = 0;
931
932 if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
933 if (value) {
934 char *tmp;
935 PyObject *old_str = PyObject_Str(value);
936 PyErr_Clear();
937 Py_XINCREF(type);
938
939 PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
940 SWIG_Python_str_DelForPy3(tmp);
941 Py_DECREF(old_str);
942 Py_DECREF(value);
943 } else {
944 PyErr_SetString(PyExc_RuntimeError, mesg);
945 }
946 }
947
948 #if defined(SWIG_PYTHON_NO_THREADS)
949 # if defined(SWIG_PYTHON_THREADS)
950 # undef SWIG_PYTHON_THREADS
951 # endif
952 #endif
953 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
954 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
955 # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
956 # define SWIG_PYTHON_USE_GIL
957 # endif
958 # endif
959 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
960 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
961 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
962 # endif
963 # ifdef __cplusplus /* C++ code */
964 class SWIG_Python_Thread_Block {
965 bool status;
966 PyGILState_STATE state;
967 public:
end()968 void end() { if (status) { PyGILState_Release(state); status = false;} }
SWIG_Python_Thread_Block()969 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
~SWIG_Python_Thread_Block()970 ~SWIG_Python_Thread_Block() { end(); }
971 };
972 class SWIG_Python_Thread_Allow {
973 bool status;
974 PyThreadState *save;
975 public:
end()976 void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
SWIG_Python_Thread_Allow()977 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
~SWIG_Python_Thread_Allow()978 ~SWIG_Python_Thread_Allow() { end(); }
979 };
980 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
981 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
982 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
983 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
984 # else /* C code */
985 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
986 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
987 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
988 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
989 # endif
990 # else /* Old thread way, not implemented, user must provide it */
991 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
992 # define SWIG_PYTHON_INITIALIZE_THREADS
993 # endif
994 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
995 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
996 # endif
997 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
998 # define SWIG_PYTHON_THREAD_END_BLOCK
999 # endif
1000 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1001 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1002 # endif
1003 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1004 # define SWIG_PYTHON_THREAD_END_ALLOW
1005 # endif
1006 # endif
1007 #else /* No thread support */
1008 # define SWIG_PYTHON_INITIALIZE_THREADS
1009 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1010 # define SWIG_PYTHON_THREAD_END_BLOCK
1011 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1012 # define SWIG_PYTHON_THREAD_END_ALLOW
1013 #endif
1014
1015 /* -----------------------------------------------------------------------------
1016 * Python API portion that goes into the runtime
1017 * ----------------------------------------------------------------------------- */
1018
1019 #ifdef __cplusplus
1020 extern "C" {
1021 #if 0
1022 } /* cc-mode */
1023 #endif
1024 #endif
1025
1026 /* -----------------------------------------------------------------------------
1027 * Constant declarations
1028 * ----------------------------------------------------------------------------- */
1029
1030 /* Constant Types */
1031 #define SWIG_PY_POINTER 4
1032 #define SWIG_PY_BINARY 5
1033
1034 /* Constant information structure */
1035 typedef struct swig_const_info {
1036 int type;
1037 char *name;
1038 long lvalue;
1039 double dvalue;
1040 void *pvalue;
1041 swig_type_info **ptype;
1042 } swig_const_info;
1043
1044
1045 /* -----------------------------------------------------------------------------
1046 * Wrapper of PyInstanceMethod_New() used in Python 3
1047 * It is exported to the generated module, used for -fastproxy
1048 * ----------------------------------------------------------------------------- */
SWIG_PyInstanceMethod_New(PyObject * self,PyObject * func)1049 SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *self, PyObject *func)
1050 {
1051 #if PY_VERSION_HEX >= 0x03000000
1052 return PyInstanceMethod_New(func);
1053 #else
1054 return NULL;
1055 #endif
1056 }
1057
1058 #ifdef __cplusplus
1059 #if 0
1060 { /* cc-mode */
1061 #endif
1062 }
1063 #endif
1064
1065
1066 /* -----------------------------------------------------------------------------
1067 * See the LICENSE file for information on copyright, usage and redistribution
1068 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1069 *
1070 * pyrun.swg
1071 *
1072 * This file contains the runtime support for Python modules
1073 * and includes code for managing global variables and pointer
1074 * type checking.
1075 *
1076 * ----------------------------------------------------------------------------- */
1077
1078 /* Common SWIG API */
1079
1080 /* for raw pointers */
1081 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1082 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1083 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1084 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(ptr, type, flags)
1085 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1086 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1087 #define swig_owntype int
1088
1089 /* for raw packed data */
1090 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1091 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1092
1093 /* for class or struct pointers */
1094 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1095 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1096
1097 /* for C or C++ function pointers */
1098 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1099 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(ptr, type, 0)
1100
1101 /* for C++ member pointers, ie, member methods */
1102 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1103 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1104
1105
1106 /* Runtime API */
1107
1108 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
1109 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1110 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1111
1112 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1113 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1114 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1115 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1116 #define SWIG_fail goto fail
1117
1118
1119 /* Runtime API implementation */
1120
1121 /* Error manipulation */
1122
1123 SWIGINTERN void
SWIG_Python_SetErrorObj(PyObject * errtype,PyObject * obj)1124 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1125 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1126 PyErr_SetObject(errtype, obj);
1127 Py_DECREF(obj);
1128 SWIG_PYTHON_THREAD_END_BLOCK;
1129 }
1130
1131 SWIGINTERN void
SWIG_Python_SetErrorMsg(PyObject * errtype,const char * msg)1132 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1133 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1134 PyErr_SetString(errtype, (char *) msg);
1135 SWIG_PYTHON_THREAD_END_BLOCK;
1136 }
1137
1138 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1139
1140 /* Set a constant value */
1141
1142 SWIGINTERN void
SWIG_Python_SetConstant(PyObject * d,const char * name,PyObject * obj)1143 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1144 PyDict_SetItemString(d, (char*) name, obj);
1145 Py_DECREF(obj);
1146 }
1147
1148 /* Append a value to the result obj */
1149
1150 SWIGINTERN PyObject*
SWIG_Python_AppendOutput(PyObject * result,PyObject * obj)1151 SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1152 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
1153 if (!result) {
1154 result = obj;
1155 } else if (result == Py_None) {
1156 Py_DECREF(result);
1157 result = obj;
1158 } else {
1159 if (!PyList_Check(result)) {
1160 PyObject *o2 = result;
1161 result = PyList_New(1);
1162 PyList_SetItem(result, 0, o2);
1163 }
1164 PyList_Append(result,obj);
1165 Py_DECREF(obj);
1166 }
1167 return result;
1168 #else
1169 PyObject* o2;
1170 PyObject* o3;
1171 if (!result) {
1172 result = obj;
1173 } else if (result == Py_None) {
1174 Py_DECREF(result);
1175 result = obj;
1176 } else {
1177 if (!PyTuple_Check(result)) {
1178 o2 = result;
1179 result = PyTuple_New(1);
1180 PyTuple_SET_ITEM(result, 0, o2);
1181 }
1182 o3 = PyTuple_New(1);
1183 PyTuple_SET_ITEM(o3, 0, obj);
1184 o2 = result;
1185 result = PySequence_Concat(o2, o3);
1186 Py_DECREF(o2);
1187 Py_DECREF(o3);
1188 }
1189 return result;
1190 #endif
1191 }
1192
1193 /* Unpack the argument tuple */
1194
1195 SWIGINTERN int
SWIG_Python_UnpackTuple(PyObject * args,const char * name,Py_ssize_t min,Py_ssize_t max,PyObject ** objs)1196 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1197 {
1198 if (!args) {
1199 if (!min && !max) {
1200 return 1;
1201 } else {
1202 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1203 name, (min == max ? "" : "at least "), (int)min);
1204 return 0;
1205 }
1206 }
1207 if (!PyTuple_Check(args)) {
1208 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1209 return 0;
1210 } else {
1211 register Py_ssize_t l = PyTuple_GET_SIZE(args);
1212 if (l < min) {
1213 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1214 name, (min == max ? "" : "at least "), (int)min, (int)l);
1215 return 0;
1216 } else if (l > max) {
1217 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1218 name, (min == max ? "" : "at most "), (int)max, (int)l);
1219 return 0;
1220 } else {
1221 register int i;
1222 for (i = 0; i < l; ++i) {
1223 objs[i] = PyTuple_GET_ITEM(args, i);
1224 }
1225 for (; l < max; ++l) {
1226 objs[l] = 0;
1227 }
1228 return i + 1;
1229 }
1230 }
1231 }
1232
1233 /* A functor is a function object with one single object argument */
1234 #if PY_VERSION_HEX >= 0x02020000
1235 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1236 #else
1237 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
1238 #endif
1239
1240 /*
1241 Helper for static pointer initialization for both C and C++ code, for example
1242 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1243 */
1244 #ifdef __cplusplus
1245 #define SWIG_STATIC_POINTER(var) var
1246 #else
1247 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1248 #endif
1249
1250 /* -----------------------------------------------------------------------------
1251 * Pointer declarations
1252 * ----------------------------------------------------------------------------- */
1253
1254 /* Flags for new pointer objects */
1255 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1256 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1257
1258 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1259
1260 #ifdef __cplusplus
1261 extern "C" {
1262 #if 0
1263 } /* cc-mode */
1264 #endif
1265 #endif
1266
1267 /* How to access Py_None */
1268 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
1269 # ifndef SWIG_PYTHON_NO_BUILD_NONE
1270 # ifndef SWIG_PYTHON_BUILD_NONE
1271 # define SWIG_PYTHON_BUILD_NONE
1272 # endif
1273 # endif
1274 #endif
1275
1276 #ifdef SWIG_PYTHON_BUILD_NONE
1277 # ifdef Py_None
1278 # undef Py_None
1279 # define Py_None SWIG_Py_None()
1280 # endif
1281 SWIGRUNTIMEINLINE PyObject *
_SWIG_Py_None(void)1282 _SWIG_Py_None(void)
1283 {
1284 PyObject *none = Py_BuildValue((char*)"");
1285 Py_DECREF(none);
1286 return none;
1287 }
1288 SWIGRUNTIME PyObject *
SWIG_Py_None(void)1289 SWIG_Py_None(void)
1290 {
1291 static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
1292 return none;
1293 }
1294 #endif
1295
1296 /* The python void return value */
1297
1298 SWIGRUNTIMEINLINE PyObject *
SWIG_Py_Void(void)1299 SWIG_Py_Void(void)
1300 {
1301 PyObject *none = Py_None;
1302 Py_INCREF(none);
1303 return none;
1304 }
1305
1306 /* SwigPyClientData */
1307
1308 typedef struct {
1309 PyObject *klass;
1310 PyObject *newraw;
1311 PyObject *newargs;
1312 PyObject *destroy;
1313 int delargs;
1314 int implicitconv;
1315 } SwigPyClientData;
1316
1317 SWIGRUNTIMEINLINE int
SWIG_Python_CheckImplicit(swig_type_info * ty)1318 SWIG_Python_CheckImplicit(swig_type_info *ty)
1319 {
1320 SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1321 return data ? data->implicitconv : 0;
1322 }
1323
1324 SWIGRUNTIMEINLINE PyObject *
SWIG_Python_ExceptionType(swig_type_info * desc)1325 SWIG_Python_ExceptionType(swig_type_info *desc) {
1326 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1327 PyObject *klass = data ? data->klass : 0;
1328 return (klass ? klass : PyExc_RuntimeError);
1329 }
1330
1331
1332 SWIGRUNTIME SwigPyClientData *
SwigPyClientData_New(PyObject * obj)1333 SwigPyClientData_New(PyObject* obj)
1334 {
1335 if (!obj) {
1336 return 0;
1337 } else {
1338 SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1339 /* the klass element */
1340 data->klass = obj;
1341 Py_INCREF(data->klass);
1342 /* the newraw method and newargs arguments used to create a new raw instance */
1343 if (PyClass_Check(obj)) {
1344 data->newraw = 0;
1345 data->newargs = obj;
1346 Py_INCREF(obj);
1347 } else {
1348 #if (PY_VERSION_HEX < 0x02020000)
1349 data->newraw = 0;
1350 #else
1351 data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
1352 #endif
1353 if (data->newraw) {
1354 Py_INCREF(data->newraw);
1355 data->newargs = PyTuple_New(1);
1356 PyTuple_SetItem(data->newargs, 0, obj);
1357 } else {
1358 data->newargs = obj;
1359 }
1360 Py_INCREF(data->newargs);
1361 }
1362 /* the destroy method, aka as the C++ delete method */
1363 data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
1364 if (PyErr_Occurred()) {
1365 PyErr_Clear();
1366 data->destroy = 0;
1367 }
1368 if (data->destroy) {
1369 int flags;
1370 Py_INCREF(data->destroy);
1371 flags = PyCFunction_GET_FLAGS(data->destroy);
1372 #ifdef METH_O
1373 data->delargs = !(flags & (METH_O));
1374 #else
1375 data->delargs = 0;
1376 #endif
1377 } else {
1378 data->delargs = 0;
1379 }
1380 data->implicitconv = 0;
1381 return data;
1382 }
1383 }
1384
1385 SWIGRUNTIME void
SwigPyClientData_Del(SwigPyClientData * data)1386 SwigPyClientData_Del(SwigPyClientData* data)
1387 {
1388 Py_XDECREF(data->newraw);
1389 Py_XDECREF(data->newargs);
1390 Py_XDECREF(data->destroy);
1391 }
1392
1393 /* =============== SwigPyObject =====================*/
1394
1395 typedef struct {
1396 PyObject_HEAD
1397 void *ptr;
1398 swig_type_info *ty;
1399 int own;
1400 PyObject *next;
1401 } SwigPyObject;
1402
1403 SWIGRUNTIME PyObject *
SwigPyObject_long(SwigPyObject * v)1404 SwigPyObject_long(SwigPyObject *v)
1405 {
1406 return PyLong_FromVoidPtr(v->ptr);
1407 }
1408
1409 SWIGRUNTIME PyObject *
SwigPyObject_format(const char * fmt,SwigPyObject * v)1410 SwigPyObject_format(const char* fmt, SwigPyObject *v)
1411 {
1412 PyObject *res = NULL;
1413 PyObject *args = PyTuple_New(1);
1414 if (args) {
1415 if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1416 PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1417 if (ofmt) {
1418 #if PY_VERSION_HEX >= 0x03000000
1419 res = PyUnicode_Format(ofmt,args);
1420 #else
1421 res = PyString_Format(ofmt,args);
1422 #endif
1423 Py_DECREF(ofmt);
1424 }
1425 Py_DECREF(args);
1426 }
1427 }
1428 return res;
1429 }
1430
1431 SWIGRUNTIME PyObject *
SwigPyObject_oct(SwigPyObject * v)1432 SwigPyObject_oct(SwigPyObject *v)
1433 {
1434 return SwigPyObject_format("%o",v);
1435 }
1436
1437 SWIGRUNTIME PyObject *
SwigPyObject_hex(SwigPyObject * v)1438 SwigPyObject_hex(SwigPyObject *v)
1439 {
1440 return SwigPyObject_format("%x",v);
1441 }
1442
1443 SWIGRUNTIME PyObject *
1444 #ifdef METH_NOARGS
SwigPyObject_repr(SwigPyObject * v)1445 SwigPyObject_repr(SwigPyObject *v)
1446 #else
1447 SwigPyObject_repr(SwigPyObject *v, PyObject *args)
1448 #endif
1449 {
1450 const char *name = SWIG_TypePrettyName(v->ty);
1451 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, v);
1452 if (v->next) {
1453 #ifdef METH_NOARGS
1454 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1455 #else
1456 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
1457 #endif
1458 #if PY_VERSION_HEX >= 0x03000000
1459 PyObject *joined = PyUnicode_Concat(repr, nrep);
1460 Py_DecRef(repr);
1461 Py_DecRef(nrep);
1462 repr = joined;
1463 #else
1464 PyString_ConcatAndDel(&repr,nrep);
1465 #endif
1466 }
1467 return repr;
1468 }
1469
1470 SWIGRUNTIME int
SwigPyObject_print(SwigPyObject * v,FILE * fp,int SWIGUNUSEDPARM (flags))1471 SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1472 {
1473 char *str;
1474 #ifdef METH_NOARGS
1475 PyObject *repr = SwigPyObject_repr(v);
1476 #else
1477 PyObject *repr = SwigPyObject_repr(v, NULL);
1478 #endif
1479 if (repr) {
1480 str = SWIG_Python_str_AsChar(repr);
1481 fputs(str, fp);
1482 SWIG_Python_str_DelForPy3(str);
1483 Py_DECREF(repr);
1484 return 0;
1485 } else {
1486 return 1;
1487 }
1488 }
1489
1490 SWIGRUNTIME PyObject *
SwigPyObject_str(SwigPyObject * v)1491 SwigPyObject_str(SwigPyObject *v)
1492 {
1493 char result[SWIG_BUFFER_SIZE];
1494 return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
1495 SWIG_Python_str_FromChar(result) : 0;
1496 }
1497
1498 SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject * v,SwigPyObject * w)1499 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
1500 {
1501 void *i = v->ptr;
1502 void *j = w->ptr;
1503 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1504 }
1505
1506 /* Added for Python 3.x, would it also be useful for Python 2.x? */
1507 SWIGRUNTIME PyObject*
SwigPyObject_richcompare(SwigPyObject * v,SwigPyObject * w,int op)1508 SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
1509 {
1510 PyObject* res;
1511 if( op != Py_EQ && op != Py_NE ) {
1512 Py_INCREF(Py_NotImplemented);
1513 return Py_NotImplemented;
1514 }
1515 if( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) )
1516 res = Py_True;
1517 else
1518 res = Py_False;
1519 Py_INCREF(res);
1520 return res;
1521 }
1522
1523
1524 SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
1525
1526 SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void)1527 SwigPyObject_type(void) {
1528 static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
1529 return type;
1530 }
1531
1532 SWIGRUNTIMEINLINE int
SwigPyObject_Check(PyObject * op)1533 SwigPyObject_Check(PyObject *op) {
1534 return (Py_TYPE(op) == SwigPyObject_type())
1535 || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1536 }
1537
1538 SWIGRUNTIME PyObject *
1539 SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1540
1541 SWIGRUNTIME void
SwigPyObject_dealloc(PyObject * v)1542 SwigPyObject_dealloc(PyObject *v)
1543 {
1544 SwigPyObject *sobj = (SwigPyObject *) v;
1545 PyObject *next = sobj->next;
1546 if (sobj->own == SWIG_POINTER_OWN) {
1547 swig_type_info *ty = sobj->ty;
1548 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1549 PyObject *destroy = data ? data->destroy : 0;
1550 if (destroy) {
1551 /* destroy is always a VARARGS method */
1552 PyObject *res;
1553 if (data->delargs) {
1554 /* we need to create a temporary object to carry the destroy operation */
1555 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1556 res = SWIG_Python_CallFunctor(destroy, tmp);
1557 Py_DECREF(tmp);
1558 } else {
1559 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1560 PyObject *mself = PyCFunction_GET_SELF(destroy);
1561 res = ((*meth)(mself, v));
1562 }
1563 Py_XDECREF(res);
1564 }
1565 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1566 else {
1567 const char *name = SWIG_TypePrettyName(ty);
1568 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1569 }
1570 #endif
1571 }
1572 Py_XDECREF(next);
1573 PyObject_DEL(v);
1574 }
1575
1576 SWIGRUNTIME PyObject*
SwigPyObject_append(PyObject * v,PyObject * next)1577 SwigPyObject_append(PyObject* v, PyObject* next)
1578 {
1579 SwigPyObject *sobj = (SwigPyObject *) v;
1580 #ifndef METH_O
1581 PyObject *tmp = 0;
1582 if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
1583 next = tmp;
1584 #endif
1585 if (!SwigPyObject_Check(next)) {
1586 return NULL;
1587 }
1588 sobj->next = next;
1589 Py_INCREF(next);
1590 return SWIG_Py_Void();
1591 }
1592
1593 SWIGRUNTIME PyObject*
1594 #ifdef METH_NOARGS
SwigPyObject_next(PyObject * v)1595 SwigPyObject_next(PyObject* v)
1596 #else
1597 SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1598 #endif
1599 {
1600 SwigPyObject *sobj = (SwigPyObject *) v;
1601 if (sobj->next) {
1602 Py_INCREF(sobj->next);
1603 return sobj->next;
1604 } else {
1605 return SWIG_Py_Void();
1606 }
1607 }
1608
1609 SWIGINTERN PyObject*
1610 #ifdef METH_NOARGS
SwigPyObject_disown(PyObject * v)1611 SwigPyObject_disown(PyObject *v)
1612 #else
1613 SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1614 #endif
1615 {
1616 SwigPyObject *sobj = (SwigPyObject *)v;
1617 sobj->own = 0;
1618 return SWIG_Py_Void();
1619 }
1620
1621 SWIGINTERN PyObject*
1622 #ifdef METH_NOARGS
SwigPyObject_acquire(PyObject * v)1623 SwigPyObject_acquire(PyObject *v)
1624 #else
1625 SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1626 #endif
1627 {
1628 SwigPyObject *sobj = (SwigPyObject *)v;
1629 sobj->own = SWIG_POINTER_OWN;
1630 return SWIG_Py_Void();
1631 }
1632
1633 SWIGINTERN PyObject*
SwigPyObject_own(PyObject * v,PyObject * args)1634 SwigPyObject_own(PyObject *v, PyObject *args)
1635 {
1636 PyObject *val = 0;
1637 #if (PY_VERSION_HEX < 0x02020000)
1638 if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
1639 #else
1640 if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
1641 #endif
1642 {
1643 return NULL;
1644 }
1645 else
1646 {
1647 SwigPyObject *sobj = (SwigPyObject *)v;
1648 PyObject *obj = PyBool_FromLong(sobj->own);
1649 if (val) {
1650 #ifdef METH_NOARGS
1651 if (PyObject_IsTrue(val)) {
1652 SwigPyObject_acquire(v);
1653 } else {
1654 SwigPyObject_disown(v);
1655 }
1656 #else
1657 if (PyObject_IsTrue(val)) {
1658 SwigPyObject_acquire(v,args);
1659 } else {
1660 SwigPyObject_disown(v,args);
1661 }
1662 #endif
1663 }
1664 return obj;
1665 }
1666 }
1667
1668 #ifdef METH_O
1669 static PyMethodDef
1670 swigobject_methods[] = {
1671 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
1672 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
1673 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1674 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
1675 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
1676 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"},
1677 {0, 0, 0, 0}
1678 };
1679 #else
1680 static PyMethodDef
1681 swigobject_methods[] = {
1682 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
1683 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
1684 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1685 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
1686 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
1687 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"},
1688 {0, 0, 0, 0}
1689 };
1690 #endif
1691
1692 #if PY_VERSION_HEX < 0x02020000
1693 SWIGINTERN PyObject *
SwigPyObject_getattr(SwigPyObject * sobj,char * name)1694 SwigPyObject_getattr(SwigPyObject *sobj,char *name)
1695 {
1696 return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1697 }
1698 #endif
1699
1700 SWIGRUNTIME PyTypeObject*
_PySwigObject_type(void)1701 _PySwigObject_type(void) {
1702 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1703
1704 static PyNumberMethods SwigPyObject_as_number = {
1705 (binaryfunc)0, /*nb_add*/
1706 (binaryfunc)0, /*nb_subtract*/
1707 (binaryfunc)0, /*nb_multiply*/
1708 /* nb_divide removed in Python 3 */
1709 #if PY_VERSION_HEX < 0x03000000
1710 (binaryfunc)0, /*nb_divide*/
1711 #endif
1712 (binaryfunc)0, /*nb_remainder*/
1713 (binaryfunc)0, /*nb_divmod*/
1714 (ternaryfunc)0,/*nb_power*/
1715 (unaryfunc)0, /*nb_negative*/
1716 (unaryfunc)0, /*nb_positive*/
1717 (unaryfunc)0, /*nb_absolute*/
1718 (inquiry)0, /*nb_nonzero*/
1719 0, /*nb_invert*/
1720 0, /*nb_lshift*/
1721 0, /*nb_rshift*/
1722 0, /*nb_and*/
1723 0, /*nb_xor*/
1724 0, /*nb_or*/
1725 #if PY_VERSION_HEX < 0x03000000
1726 0, /*nb_coerce*/
1727 #endif
1728 (unaryfunc)SwigPyObject_long, /*nb_int*/
1729 #if PY_VERSION_HEX < 0x03000000
1730 (unaryfunc)SwigPyObject_long, /*nb_long*/
1731 #else
1732 0, /*nb_reserved*/
1733 #endif
1734 (unaryfunc)0, /*nb_float*/
1735 #if PY_VERSION_HEX < 0x03000000
1736 (unaryfunc)SwigPyObject_oct, /*nb_oct*/
1737 (unaryfunc)SwigPyObject_hex, /*nb_hex*/
1738 #endif
1739 #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1740 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1741 #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
1742 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1743 #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
1744 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
1745 #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
1746 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
1747 #endif
1748 };
1749
1750 static PyTypeObject swigpyobject_type;
1751 static int type_init = 0;
1752 if (!type_init) {
1753 const PyTypeObject tmp
1754 = {
1755 /* PyObject header changed in Python 3 */
1756 #if PY_VERSION_HEX >= 0x03000000
1757 PyVarObject_HEAD_INIT(&PyType_Type, 0)
1758 #else
1759 PyObject_HEAD_INIT(NULL)
1760 0, /* ob_size */
1761 #endif
1762 (char *)"SwigPyObject", /* tp_name */
1763 sizeof(SwigPyObject), /* tp_basicsize */
1764 0, /* tp_itemsize */
1765 (destructor)SwigPyObject_dealloc, /* tp_dealloc */
1766 (printfunc)SwigPyObject_print, /* tp_print */
1767 #if PY_VERSION_HEX < 0x02020000
1768 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */
1769 #else
1770 (getattrfunc)0, /* tp_getattr */
1771 #endif
1772 (setattrfunc)0, /* tp_setattr */
1773 #if PY_VERSION_HEX >= 0x03000000
1774 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1775 #else
1776 (cmpfunc)SwigPyObject_compare, /* tp_compare */
1777 #endif
1778 (reprfunc)SwigPyObject_repr, /* tp_repr */
1779 &SwigPyObject_as_number, /* tp_as_number */
1780 0, /* tp_as_sequence */
1781 0, /* tp_as_mapping */
1782 (hashfunc)0, /* tp_hash */
1783 (ternaryfunc)0, /* tp_call */
1784 (reprfunc)SwigPyObject_str, /* tp_str */
1785 PyObject_GenericGetAttr, /* tp_getattro */
1786 0, /* tp_setattro */
1787 0, /* tp_as_buffer */
1788 Py_TPFLAGS_DEFAULT, /* tp_flags */
1789 swigobject_doc, /* tp_doc */
1790 0, /* tp_traverse */
1791 0, /* tp_clear */
1792 (richcmpfunc)SwigPyObject_richcompare, /* tp_richcompare */
1793 0, /* tp_weaklistoffset */
1794 #if PY_VERSION_HEX >= 0x02020000
1795 0, /* tp_iter */
1796 0, /* tp_iternext */
1797 swigobject_methods, /* tp_methods */
1798 0, /* tp_members */
1799 0, /* tp_getset */
1800 0, /* tp_base */
1801 0, /* tp_dict */
1802 0, /* tp_descr_get */
1803 0, /* tp_descr_set */
1804 0, /* tp_dictoffset */
1805 0, /* tp_init */
1806 0, /* tp_alloc */
1807 0, /* tp_new */
1808 0, /* tp_free */
1809 0, /* tp_is_gc */
1810 0, /* tp_bases */
1811 0, /* tp_mro */
1812 0, /* tp_cache */
1813 0, /* tp_subclasses */
1814 0, /* tp_weaklist */
1815 #endif
1816 #if PY_VERSION_HEX >= 0x02030000
1817 0, /* tp_del */
1818 #endif
1819 #ifdef COUNT_ALLOCS
1820 0,0,0,0 /* tp_alloc -> tp_next */
1821 #endif
1822 };
1823 swigpyobject_type = tmp;
1824 /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */
1825 #if PY_VERSION_HEX < 0x03000000
1826 swigpyobject_type.ob_type = &PyType_Type;
1827 #endif
1828 type_init = 1;
1829 }
1830 return &swigpyobject_type;
1831 }
1832
1833 SWIGRUNTIME PyObject *
SwigPyObject_New(void * ptr,swig_type_info * ty,int own)1834 SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
1835 {
1836 SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1837 if (sobj) {
1838 sobj->ptr = ptr;
1839 sobj->ty = ty;
1840 sobj->own = own;
1841 sobj->next = 0;
1842 }
1843 return (PyObject *)sobj;
1844 }
1845
1846 /* -----------------------------------------------------------------------------
1847 * Implements a simple Swig Packed type, and use it instead of string
1848 * ----------------------------------------------------------------------------- */
1849
1850 typedef struct {
1851 PyObject_HEAD
1852 void *pack;
1853 swig_type_info *ty;
1854 size_t size;
1855 } SwigPyPacked;
1856
1857 SWIGRUNTIME int
SwigPyPacked_print(SwigPyPacked * v,FILE * fp,int SWIGUNUSEDPARM (flags))1858 SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1859 {
1860 char result[SWIG_BUFFER_SIZE];
1861 fputs("<Swig Packed ", fp);
1862 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1863 fputs("at ", fp);
1864 fputs(result, fp);
1865 }
1866 fputs(v->ty->name,fp);
1867 fputs(">", fp);
1868 return 0;
1869 }
1870
1871 SWIGRUNTIME PyObject *
SwigPyPacked_repr(SwigPyPacked * v)1872 SwigPyPacked_repr(SwigPyPacked *v)
1873 {
1874 char result[SWIG_BUFFER_SIZE];
1875 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1876 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1877 } else {
1878 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
1879 }
1880 }
1881
1882 SWIGRUNTIME PyObject *
SwigPyPacked_str(SwigPyPacked * v)1883 SwigPyPacked_str(SwigPyPacked *v)
1884 {
1885 char result[SWIG_BUFFER_SIZE];
1886 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
1887 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
1888 } else {
1889 return SWIG_Python_str_FromChar(v->ty->name);
1890 }
1891 }
1892
1893 SWIGRUNTIME int
SwigPyPacked_compare(SwigPyPacked * v,SwigPyPacked * w)1894 SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
1895 {
1896 size_t i = v->size;
1897 size_t j = w->size;
1898 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1899 return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
1900 }
1901
1902 SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
1903
1904 SWIGRUNTIME PyTypeObject*
SwigPyPacked_type(void)1905 SwigPyPacked_type(void) {
1906 static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
1907 return type;
1908 }
1909
1910 SWIGRUNTIMEINLINE int
SwigPyPacked_Check(PyObject * op)1911 SwigPyPacked_Check(PyObject *op) {
1912 return ((op)->ob_type == _PySwigPacked_type())
1913 || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
1914 }
1915
1916 SWIGRUNTIME void
SwigPyPacked_dealloc(PyObject * v)1917 SwigPyPacked_dealloc(PyObject *v)
1918 {
1919 if (SwigPyPacked_Check(v)) {
1920 SwigPyPacked *sobj = (SwigPyPacked *) v;
1921 free(sobj->pack);
1922 }
1923 PyObject_DEL(v);
1924 }
1925
1926 SWIGRUNTIME PyTypeObject*
_PySwigPacked_type(void)1927 _PySwigPacked_type(void) {
1928 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
1929 static PyTypeObject swigpypacked_type;
1930 static int type_init = 0;
1931 if (!type_init) {
1932 const PyTypeObject tmp
1933 = {
1934 /* PyObject header changed in Python 3 */
1935 #if PY_VERSION_HEX>=0x03000000
1936 PyVarObject_HEAD_INIT(&PyType_Type, 0)
1937 #else
1938 PyObject_HEAD_INIT(NULL)
1939 0, /* ob_size */
1940 #endif
1941 (char *)"SwigPyPacked", /* tp_name */
1942 sizeof(SwigPyPacked), /* tp_basicsize */
1943 0, /* tp_itemsize */
1944 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */
1945 (printfunc)SwigPyPacked_print, /* tp_print */
1946 (getattrfunc)0, /* tp_getattr */
1947 (setattrfunc)0, /* tp_setattr */
1948 #if PY_VERSION_HEX>=0x03000000
1949 0, /* tp_reserved in 3.0.1 */
1950 #else
1951 (cmpfunc)SwigPyPacked_compare, /* tp_compare */
1952 #endif
1953 (reprfunc)SwigPyPacked_repr, /* tp_repr */
1954 0, /* tp_as_number */
1955 0, /* tp_as_sequence */
1956 0, /* tp_as_mapping */
1957 (hashfunc)0, /* tp_hash */
1958 (ternaryfunc)0, /* tp_call */
1959 (reprfunc)SwigPyPacked_str, /* tp_str */
1960 PyObject_GenericGetAttr, /* tp_getattro */
1961 0, /* tp_setattro */
1962 0, /* tp_as_buffer */
1963 Py_TPFLAGS_DEFAULT, /* tp_flags */
1964 swigpacked_doc, /* tp_doc */
1965 0, /* tp_traverse */
1966 0, /* tp_clear */
1967 0, /* tp_richcompare */
1968 0, /* tp_weaklistoffset */
1969 #if PY_VERSION_HEX >= 0x02020000
1970 0, /* tp_iter */
1971 0, /* tp_iternext */
1972 0, /* tp_methods */
1973 0, /* tp_members */
1974 0, /* tp_getset */
1975 0, /* tp_base */
1976 0, /* tp_dict */
1977 0, /* tp_descr_get */
1978 0, /* tp_descr_set */
1979 0, /* tp_dictoffset */
1980 0, /* tp_init */
1981 0, /* tp_alloc */
1982 0, /* tp_new */
1983 0, /* tp_free */
1984 0, /* tp_is_gc */
1985 0, /* tp_bases */
1986 0, /* tp_mro */
1987 0, /* tp_cache */
1988 0, /* tp_subclasses */
1989 0, /* tp_weaklist */
1990 #endif
1991 #if PY_VERSION_HEX >= 0x02030000
1992 0, /* tp_del */
1993 #endif
1994 #ifdef COUNT_ALLOCS
1995 0,0,0,0 /* tp_alloc -> tp_next */
1996 #endif
1997 };
1998 swigpypacked_type = tmp;
1999 /* for Python 3 the ob_type already assigned in PyVarObject_HEAD_INIT() */
2000 #if PY_VERSION_HEX < 0x03000000
2001 swigpypacked_type.ob_type = &PyType_Type;
2002 #endif
2003 type_init = 1;
2004 }
2005 return &swigpypacked_type;
2006 }
2007
2008 SWIGRUNTIME PyObject *
SwigPyPacked_New(void * ptr,size_t size,swig_type_info * ty)2009 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
2010 {
2011 SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
2012 if (sobj) {
2013 void *pack = malloc(size);
2014 if (pack) {
2015 memcpy(pack, ptr, size);
2016 sobj->pack = pack;
2017 sobj->ty = ty;
2018 sobj->size = size;
2019 } else {
2020 PyObject_DEL((PyObject *) sobj);
2021 sobj = 0;
2022 }
2023 }
2024 return (PyObject *) sobj;
2025 }
2026
2027 SWIGRUNTIME swig_type_info *
SwigPyPacked_UnpackData(PyObject * obj,void * ptr,size_t size)2028 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
2029 {
2030 if (SwigPyPacked_Check(obj)) {
2031 SwigPyPacked *sobj = (SwigPyPacked *)obj;
2032 if (sobj->size != size) return 0;
2033 memcpy(ptr, sobj->pack, size);
2034 return sobj->ty;
2035 } else {
2036 return 0;
2037 }
2038 }
2039
2040 /* -----------------------------------------------------------------------------
2041 * pointers/data manipulation
2042 * ----------------------------------------------------------------------------- */
2043
2044 SWIGRUNTIMEINLINE PyObject *
_SWIG_This(void)2045 _SWIG_This(void)
2046 {
2047 return SWIG_Python_str_FromChar("this");
2048 }
2049
2050 SWIGRUNTIME PyObject *
SWIG_This(void)2051 SWIG_This(void)
2052 {
2053 static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
2054 return swig_this;
2055 }
2056
2057 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
2058
2059 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
2060 #if PY_VERSION_HEX>=0x03000000
2061 #define SWIG_PYTHON_SLOW_GETSET_THIS
2062 #endif
2063
2064 SWIGRUNTIME SwigPyObject *
SWIG_Python_GetSwigThis(PyObject * pyobj)2065 SWIG_Python_GetSwigThis(PyObject *pyobj)
2066 {
2067 if (SwigPyObject_Check(pyobj)) {
2068 return (SwigPyObject *) pyobj;
2069 } else {
2070 PyObject *obj = 0;
2071 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
2072 if (PyInstance_Check(pyobj)) {
2073 obj = _PyInstance_Lookup(pyobj, SWIG_This());
2074 } else {
2075 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2076 if (dictptr != NULL) {
2077 PyObject *dict = *dictptr;
2078 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
2079 } else {
2080 #ifdef PyWeakref_CheckProxy
2081 if (PyWeakref_CheckProxy(pyobj)) {
2082 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2083 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2084 }
2085 #endif
2086 obj = PyObject_GetAttr(pyobj,SWIG_This());
2087 if (obj) {
2088 Py_DECREF(obj);
2089 } else {
2090 if (PyErr_Occurred()) PyErr_Clear();
2091 return 0;
2092 }
2093 }
2094 }
2095 #else
2096 obj = PyObject_GetAttr(pyobj,SWIG_This());
2097 if (obj) {
2098 Py_DECREF(obj);
2099 } else {
2100 if (PyErr_Occurred()) PyErr_Clear();
2101 return 0;
2102 }
2103 #endif
2104 if (obj && !SwigPyObject_Check(obj)) {
2105 /* a PyObject is called 'this', try to get the 'real this'
2106 SwigPyObject from it */
2107 return SWIG_Python_GetSwigThis(obj);
2108 }
2109 return (SwigPyObject *)obj;
2110 }
2111 }
2112
2113 /* Acquire a pointer value */
2114
2115 SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject * obj,int own)2116 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2117 if (own == SWIG_POINTER_OWN) {
2118 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2119 if (sobj) {
2120 int oldown = sobj->own;
2121 sobj->own = own;
2122 return oldown;
2123 }
2124 }
2125 return 0;
2126 }
2127
2128 /* Convert a pointer value */
2129
2130 SWIGRUNTIME int
SWIG_Python_ConvertPtrAndOwn(PyObject * obj,void ** ptr,swig_type_info * ty,int flags,int * own)2131 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2132 if (!obj) return SWIG_ERROR;
2133 if (obj == Py_None) {
2134 if (ptr) *ptr = 0;
2135 return SWIG_OK;
2136 } else {
2137 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2138 if (own)
2139 *own = 0;
2140 while (sobj) {
2141 void *vptr = sobj->ptr;
2142 if (ty) {
2143 swig_type_info *to = sobj->ty;
2144 if (to == ty) {
2145 /* no type cast needed */
2146 if (ptr) *ptr = vptr;
2147 break;
2148 } else {
2149 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2150 if (!tc) {
2151 sobj = (SwigPyObject *)sobj->next;
2152 } else {
2153 if (ptr) {
2154 int newmemory = 0;
2155 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2156 if (newmemory == SWIG_CAST_NEW_MEMORY) {
2157 assert(own);
2158 if (own)
2159 *own = *own | SWIG_CAST_NEW_MEMORY;
2160 }
2161 }
2162 break;
2163 }
2164 }
2165 } else {
2166 if (ptr) *ptr = vptr;
2167 break;
2168 }
2169 }
2170 if (sobj) {
2171 if (own)
2172 *own = *own | sobj->own;
2173 if (flags & SWIG_POINTER_DISOWN) {
2174 sobj->own = 0;
2175 }
2176 return SWIG_OK;
2177 } else {
2178 int res = SWIG_ERROR;
2179 if (flags & SWIG_POINTER_IMPLICIT_CONV) {
2180 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2181 if (data && !data->implicitconv) {
2182 PyObject *klass = data->klass;
2183 if (klass) {
2184 PyObject *impconv;
2185 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2186 impconv = SWIG_Python_CallFunctor(klass, obj);
2187 data->implicitconv = 0;
2188 if (PyErr_Occurred()) {
2189 PyErr_Clear();
2190 impconv = 0;
2191 }
2192 if (impconv) {
2193 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2194 if (iobj) {
2195 void *vptr;
2196 res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2197 if (SWIG_IsOK(res)) {
2198 if (ptr) {
2199 *ptr = vptr;
2200 /* transfer the ownership to 'ptr' */
2201 iobj->own = 0;
2202 res = SWIG_AddCast(res);
2203 res = SWIG_AddNewMask(res);
2204 } else {
2205 res = SWIG_AddCast(res);
2206 }
2207 }
2208 }
2209 Py_DECREF(impconv);
2210 }
2211 }
2212 }
2213 }
2214 return res;
2215 }
2216 }
2217 }
2218
2219 /* Convert a function ptr value */
2220
2221 SWIGRUNTIME int
SWIG_Python_ConvertFunctionPtr(PyObject * obj,void ** ptr,swig_type_info * ty)2222 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2223 if (!PyCFunction_Check(obj)) {
2224 return SWIG_ConvertPtr(obj, ptr, ty, 0);
2225 } else {
2226 void *vptr = 0;
2227
2228 /* here we get the method pointer for callbacks */
2229 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2230 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2231 if (desc)
2232 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2233 if (!desc)
2234 return SWIG_ERROR;
2235 if (ty) {
2236 swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
2237 if (tc) {
2238 int newmemory = 0;
2239 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2240 assert(!newmemory); /* newmemory handling not yet implemented */
2241 } else {
2242 return SWIG_ERROR;
2243 }
2244 } else {
2245 *ptr = vptr;
2246 }
2247 return SWIG_OK;
2248 }
2249 }
2250
2251 /* Convert a packed value value */
2252
2253 SWIGRUNTIME int
SWIG_Python_ConvertPacked(PyObject * obj,void * ptr,size_t sz,swig_type_info * ty)2254 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2255 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2256 if (!to) return SWIG_ERROR;
2257 if (ty) {
2258 if (to != ty) {
2259 /* check type cast? */
2260 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2261 if (!tc) return SWIG_ERROR;
2262 }
2263 }
2264 return SWIG_OK;
2265 }
2266
2267 /* -----------------------------------------------------------------------------
2268 * Create a new pointer object
2269 * ----------------------------------------------------------------------------- */
2270
2271 /*
2272 Create a new instance object, without calling __init__, and set the
2273 'this' attribute.
2274 */
2275
2276 SWIGRUNTIME PyObject*
SWIG_Python_NewShadowInstance(SwigPyClientData * data,PyObject * swig_this)2277 SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
2278 {
2279 #if (PY_VERSION_HEX >= 0x02020000)
2280 PyObject *inst = 0;
2281 PyObject *newraw = data->newraw;
2282 if (newraw) {
2283 inst = PyObject_Call(newraw, data->newargs, NULL);
2284 if (inst) {
2285 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2286 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2287 if (dictptr != NULL) {
2288 PyObject *dict = *dictptr;
2289 if (dict == NULL) {
2290 dict = PyDict_New();
2291 *dictptr = dict;
2292 PyDict_SetItem(dict, SWIG_This(), swig_this);
2293 }
2294 }
2295 #else
2296 PyObject *key = SWIG_This();
2297 PyObject_SetAttr(inst, key, swig_this);
2298 #endif
2299 }
2300 } else {
2301 #if PY_VERSION_HEX >= 0x03000000
2302 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
2303 PyObject_SetAttr(inst, SWIG_This(), swig_this);
2304 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2305 #else
2306 PyObject *dict = PyDict_New();
2307 PyDict_SetItem(dict, SWIG_This(), swig_this);
2308 inst = PyInstance_NewRaw(data->newargs, dict);
2309 Py_DECREF(dict);
2310 #endif
2311 }
2312 return inst;
2313 #else
2314 #if (PY_VERSION_HEX >= 0x02010000)
2315 PyObject *inst;
2316 PyObject *dict = PyDict_New();
2317 PyDict_SetItem(dict, SWIG_This(), swig_this);
2318 inst = PyInstance_NewRaw(data->newargs, dict);
2319 Py_DECREF(dict);
2320 return (PyObject *) inst;
2321 #else
2322 PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
2323 if (inst == NULL) {
2324 return NULL;
2325 }
2326 inst->in_class = (PyClassObject *)data->newargs;
2327 Py_INCREF(inst->in_class);
2328 inst->in_dict = PyDict_New();
2329 if (inst->in_dict == NULL) {
2330 Py_DECREF(inst);
2331 return NULL;
2332 }
2333 #ifdef Py_TPFLAGS_HAVE_WEAKREFS
2334 inst->in_weakreflist = NULL;
2335 #endif
2336 #ifdef Py_TPFLAGS_GC
2337 PyObject_GC_Init(inst);
2338 #endif
2339 PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
2340 return (PyObject *) inst;
2341 #endif
2342 #endif
2343 }
2344
2345 SWIGRUNTIME void
SWIG_Python_SetSwigThis(PyObject * inst,PyObject * swig_this)2346 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2347 {
2348 PyObject *dict;
2349 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2350 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2351 if (dictptr != NULL) {
2352 dict = *dictptr;
2353 if (dict == NULL) {
2354 dict = PyDict_New();
2355 *dictptr = dict;
2356 }
2357 PyDict_SetItem(dict, SWIG_This(), swig_this);
2358 return;
2359 }
2360 #endif
2361 dict = PyObject_GetAttrString(inst, (char*)"__dict__");
2362 PyDict_SetItem(dict, SWIG_This(), swig_this);
2363 Py_DECREF(dict);
2364 }
2365
2366
2367 SWIGINTERN PyObject *
SWIG_Python_InitShadowInstance(PyObject * args)2368 SWIG_Python_InitShadowInstance(PyObject *args) {
2369 PyObject *obj[2];
2370 if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
2371 return NULL;
2372 } else {
2373 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2374 if (sthis) {
2375 SwigPyObject_append((PyObject*) sthis, obj[1]);
2376 } else {
2377 SWIG_Python_SetSwigThis(obj[0], obj[1]);
2378 }
2379 return SWIG_Py_Void();
2380 }
2381 }
2382
2383 /* Create a new pointer object */
2384
2385 SWIGRUNTIME PyObject *
SWIG_Python_NewPointerObj(void * ptr,swig_type_info * type,int flags)2386 SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
2387 if (!ptr) {
2388 return SWIG_Py_Void();
2389 } else {
2390 int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2391 PyObject *robj = SwigPyObject_New(ptr, type, own);
2392 SwigPyClientData *clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2393 if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2394 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2395 if (inst) {
2396 Py_DECREF(robj);
2397 robj = inst;
2398 }
2399 }
2400 return robj;
2401 }
2402 }
2403
2404 /* Create a new packed object */
2405
2406 SWIGRUNTIMEINLINE PyObject *
SWIG_Python_NewPackedObj(void * ptr,size_t sz,swig_type_info * type)2407 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2408 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2409 }
2410
2411 /* -----------------------------------------------------------------------------*
2412 * Get type list
2413 * -----------------------------------------------------------------------------*/
2414
2415 #ifdef SWIG_LINK_RUNTIME
2416 void *SWIG_ReturnGlobalTypeList(void *);
2417 #endif
2418
2419 SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void)2420 SWIG_Python_GetModule(void) {
2421 static void *type_pointer = (void *)0;
2422 /* first check if module already created */
2423 if (!type_pointer) {
2424 #ifdef SWIG_LINK_RUNTIME
2425 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2426 #else
2427 type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2428 (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
2429 if (PyErr_Occurred()) {
2430 PyErr_Clear();
2431 type_pointer = (void *)0;
2432 }
2433 #endif
2434 }
2435 return (swig_module_info *) type_pointer;
2436 }
2437
2438 #if PY_MAJOR_VERSION < 2
2439 /* PyModule_AddObject function was introduced in Python 2.0. The following function
2440 is copied out of Python/modsupport.c in python version 2.3.4 */
2441 SWIGINTERN int
PyModule_AddObject(PyObject * m,char * name,PyObject * o)2442 PyModule_AddObject(PyObject *m, char *name, PyObject *o)
2443 {
2444 PyObject *dict;
2445 if (!PyModule_Check(m)) {
2446 PyErr_SetString(PyExc_TypeError,
2447 "PyModule_AddObject() needs module as first arg");
2448 return SWIG_ERROR;
2449 }
2450 if (!o) {
2451 PyErr_SetString(PyExc_TypeError,
2452 "PyModule_AddObject() needs non-NULL value");
2453 return SWIG_ERROR;
2454 }
2455
2456 dict = PyModule_GetDict(m);
2457 if (dict == NULL) {
2458 /* Internal error -- modules must have a dict! */
2459 PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
2460 PyModule_GetName(m));
2461 return SWIG_ERROR;
2462 }
2463 if (PyDict_SetItemString(dict, name, o))
2464 return SWIG_ERROR;
2465 Py_DECREF(o);
2466 return SWIG_OK;
2467 }
2468 #endif
2469
2470 SWIGRUNTIME void
SWIG_Python_DestroyModule(void * vptr)2471 SWIG_Python_DestroyModule(void *vptr)
2472 {
2473 swig_module_info *swig_module = (swig_module_info *) vptr;
2474 swig_type_info **types = swig_module->types;
2475 size_t i;
2476 for (i =0; i < swig_module->size; ++i) {
2477 swig_type_info *ty = types[i];
2478 if (ty->owndata) {
2479 SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
2480 if (data) SwigPyClientData_Del(data);
2481 }
2482 }
2483 Py_DECREF(SWIG_This());
2484 }
2485
2486 SWIGRUNTIME void
SWIG_Python_SetModule(swig_module_info * swig_module)2487 SWIG_Python_SetModule(swig_module_info *swig_module) {
2488 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
2489
2490 #if PY_VERSION_HEX >= 0x03000000
2491 /* Add a dummy module object into sys.modules */
2492 PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
2493 #else
2494 PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2495 swig_empty_runtime_method_table);
2496 #endif
2497 PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
2498 if (pointer && module) {
2499 PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
2500 } else {
2501 Py_XDECREF(pointer);
2502 }
2503 }
2504
2505 /* The python cached type query */
2506 SWIGRUNTIME PyObject *
SWIG_Python_TypeCache(void)2507 SWIG_Python_TypeCache(void) {
2508 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2509 return cache;
2510 }
2511
2512 SWIGRUNTIME swig_type_info *
SWIG_Python_TypeQuery(const char * type)2513 SWIG_Python_TypeQuery(const char *type)
2514 {
2515 PyObject *cache = SWIG_Python_TypeCache();
2516 PyObject *key = SWIG_Python_str_FromChar(type);
2517 PyObject *obj = PyDict_GetItem(cache, key);
2518 swig_type_info *descriptor;
2519 if (obj) {
2520 descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
2521 } else {
2522 swig_module_info *swig_module = SWIG_Python_GetModule();
2523 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2524 if (descriptor) {
2525 obj = PyCObject_FromVoidPtr(descriptor, NULL);
2526 PyDict_SetItem(cache, key, obj);
2527 Py_DECREF(obj);
2528 }
2529 }
2530 Py_DECREF(key);
2531 return descriptor;
2532 }
2533
2534 /*
2535 For backward compatibility only
2536 */
2537 #define SWIG_POINTER_EXCEPTION 0
2538 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2539 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2540
2541 SWIGRUNTIME int
SWIG_Python_AddErrMesg(const char * mesg,int infront)2542 SWIG_Python_AddErrMesg(const char* mesg, int infront)
2543 {
2544 if (PyErr_Occurred()) {
2545 PyObject *type = 0;
2546 PyObject *value = 0;
2547 PyObject *traceback = 0;
2548 PyErr_Fetch(&type, &value, &traceback);
2549 if (value) {
2550 char *tmp;
2551 PyObject *old_str = PyObject_Str(value);
2552 Py_XINCREF(type);
2553 PyErr_Clear();
2554 if (infront) {
2555 PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
2556 } else {
2557 PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
2558 }
2559 SWIG_Python_str_DelForPy3(tmp);
2560 Py_DECREF(old_str);
2561 }
2562 return 1;
2563 } else {
2564 return 0;
2565 }
2566 }
2567
2568 SWIGRUNTIME int
SWIG_Python_ArgFail(int argnum)2569 SWIG_Python_ArgFail(int argnum)
2570 {
2571 if (PyErr_Occurred()) {
2572 /* add information about failing argument */
2573 char mesg[256];
2574 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2575 return SWIG_Python_AddErrMesg(mesg, 1);
2576 } else {
2577 return 0;
2578 }
2579 }
2580
2581 SWIGRUNTIMEINLINE const char *
SwigPyObject_GetDesc(PyObject * self)2582 SwigPyObject_GetDesc(PyObject *self)
2583 {
2584 SwigPyObject *v = (SwigPyObject *)self;
2585 swig_type_info *ty = v ? v->ty : 0;
2586 return ty ? ty->str : (char*)"";
2587 }
2588
2589 SWIGRUNTIME void
SWIG_Python_TypeError(const char * type,PyObject * obj)2590 SWIG_Python_TypeError(const char *type, PyObject *obj)
2591 {
2592 if (type) {
2593 #if defined(SWIG_COBJECT_TYPES)
2594 if (obj && SwigPyObject_Check(obj)) {
2595 const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2596 if (otype) {
2597 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2598 type, otype);
2599 return;
2600 }
2601 } else
2602 #endif
2603 {
2604 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2605 if (otype) {
2606 PyObject *str = PyObject_Str(obj);
2607 const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2608 if (cstr) {
2609 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2610 type, otype, cstr);
2611 SWIG_Python_str_DelForPy3(cstr);
2612 } else {
2613 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2614 type, otype);
2615 }
2616 Py_XDECREF(str);
2617 return;
2618 }
2619 }
2620 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2621 } else {
2622 PyErr_Format(PyExc_TypeError, "unexpected type is received");
2623 }
2624 }
2625
2626
2627 /* Convert a pointer value, signal an exception on a type mismatch */
2628 SWIGRUNTIME void *
SWIG_Python_MustGetPtr(PyObject * obj,swig_type_info * ty,int argnum,int flags)2629 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
2630 void *result;
2631 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2632 PyErr_Clear();
2633 #if SWIG_POINTER_EXCEPTION
2634 if (flags) {
2635 SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2636 SWIG_Python_ArgFail(argnum);
2637 }
2638 #endif
2639 }
2640 return result;
2641 }
2642
2643
2644 #ifdef __cplusplus
2645 #if 0
2646 { /* cc-mode */
2647 #endif
2648 }
2649 #endif
2650
2651
2652
2653 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2654
2655 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2656
2657
2658
2659 /* -------- TYPES TABLE (BEGIN) -------- */
2660
2661 #define SWIGTYPE_p_char swig_types[0]
2662 static swig_type_info *swig_types[2];
2663 static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
2664 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2665 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2666
2667 /* -------- TYPES TABLE (END) -------- */
2668
2669 #if (PY_VERSION_HEX <= 0x02000000)
2670 # if !defined(SWIG_PYTHON_CLASSIC)
2671 # error "This python version requires swig to be run with the '-classic' option"
2672 # endif
2673 #endif
2674 #if PY_VERSION_HEX >= 0x03000000
2675 # define SWIG_init PyInit__cuser_form56
2676
2677 #else
2678 # define SWIG_init init_cuser_form56
2679
2680 #endif
2681 #define SWIG_name "_cuser_form56"
2682
2683 #define SWIGVERSION 0x010340
2684 #define SWIG_VERSION SWIGVERSION
2685
2686
2687 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
2688 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
2689
2690
2691 #include "cuser_form56.h"
2692
2693
2694 #define SWIG_From_long PyInt_FromLong
2695
2696
2697 SWIGINTERNINLINE PyObject *
SWIG_From_int(int value)2698 SWIG_From_int (int value)
2699 {
2700 return SWIG_From_long (value);
2701 }
2702
2703 #ifdef __cplusplus
2704 extern "C" {
2705 #endif
_wrap_myform_create(PyObject * SWIGUNUSEDPARM (self),PyObject * args)2706 SWIGINTERN PyObject *_wrap_myform_create(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2707 PyObject *resultobj = 0;
2708 int result;
2709
2710 if (!PyArg_ParseTuple(args,(char *)":myform_create")) SWIG_fail;
2711 result = (int)myform_create();
2712 resultobj = SWIG_From_int((int)(result));
2713 return resultobj;
2714 fail:
2715 return NULL;
2716 }
2717
2718
2719 static PyMethodDef SwigMethods[] = {
2720 { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
2721 { (char *)"myform_create", _wrap_myform_create, METH_VARARGS, NULL},
2722 { NULL, NULL, 0, NULL }
2723 };
2724
2725
2726 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2727
2728 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
2729
2730 static swig_type_info *swig_type_initial[] = {
2731 &_swigt__p_char,
2732 };
2733
2734 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2735
2736 static swig_cast_info *swig_cast_initial[] = {
2737 _swigc__p_char,
2738 };
2739
2740
2741 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2742
2743 static swig_const_info swig_const_table[] = {
2744 {0, 0, 0, 0.0, 0, 0}};
2745
2746 #ifdef __cplusplus
2747 }
2748 #endif
2749 /* -----------------------------------------------------------------------------
2750 * Type initialization:
2751 * This problem is tough by the requirement that no dynamic
2752 * memory is used. Also, since swig_type_info structures store pointers to
2753 * swig_cast_info structures and swig_cast_info structures store pointers back
2754 * to swig_type_info structures, we need some lookup code at initialization.
2755 * The idea is that swig generates all the structures that are needed.
2756 * The runtime then collects these partially filled structures.
2757 * The SWIG_InitializeModule function takes these initial arrays out of
2758 * swig_module, and does all the lookup, filling in the swig_module.types
2759 * array with the correct data and linking the correct swig_cast_info
2760 * structures together.
2761 *
2762 * The generated swig_type_info structures are assigned staticly to an initial
2763 * array. We just loop through that array, and handle each type individually.
2764 * First we lookup if this type has been already loaded, and if so, use the
2765 * loaded structure instead of the generated one. Then we have to fill in the
2766 * cast linked list. The cast data is initially stored in something like a
2767 * two-dimensional array. Each row corresponds to a type (there are the same
2768 * number of rows as there are in the swig_type_initial array). Each entry in
2769 * a column is one of the swig_cast_info structures for that type.
2770 * The cast_initial array is actually an array of arrays, because each row has
2771 * a variable number of columns. So to actually build the cast linked list,
2772 * we find the array of casts associated with the type, and loop through it
2773 * adding the casts to the list. The one last trick we need to do is making
2774 * sure the type pointer in the swig_cast_info struct is correct.
2775 *
2776 * First off, we lookup the cast->type name to see if it is already loaded.
2777 * There are three cases to handle:
2778 * 1) If the cast->type has already been loaded AND the type we are adding
2779 * casting info to has not been loaded (it is in this module), THEN we
2780 * replace the cast->type pointer with the type pointer that has already
2781 * been loaded.
2782 * 2) If BOTH types (the one we are adding casting info to, and the
2783 * cast->type) are loaded, THEN the cast info has already been loaded by
2784 * the previous module so we just ignore it.
2785 * 3) Finally, if cast->type has not already been loaded, then we add that
2786 * swig_cast_info to the linked list (because the cast->type) pointer will
2787 * be correct.
2788 * ----------------------------------------------------------------------------- */
2789
2790 #ifdef __cplusplus
2791 extern "C" {
2792 #if 0
2793 } /* c-mode */
2794 #endif
2795 #endif
2796
2797 #if 0
2798 #define SWIGRUNTIME_DEBUG
2799 #endif
2800
2801
2802 SWIGRUNTIME void
SWIG_InitializeModule(void * clientdata)2803 SWIG_InitializeModule(void *clientdata) {
2804 size_t i;
2805 swig_module_info *module_head, *iter;
2806 int found, init;
2807
2808 clientdata = clientdata;
2809
2810 /* check to see if the circular list has been setup, if not, set it up */
2811 if (swig_module.next==0) {
2812 /* Initialize the swig_module */
2813 swig_module.type_initial = swig_type_initial;
2814 swig_module.cast_initial = swig_cast_initial;
2815 swig_module.next = &swig_module;
2816 init = 1;
2817 } else {
2818 init = 0;
2819 }
2820
2821 /* Try and load any already created modules */
2822 module_head = SWIG_GetModule(clientdata);
2823 if (!module_head) {
2824 /* This is the first module loaded for this interpreter */
2825 /* so set the swig module into the interpreter */
2826 SWIG_SetModule(clientdata, &swig_module);
2827 module_head = &swig_module;
2828 } else {
2829 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2830 found=0;
2831 iter=module_head;
2832 do {
2833 if (iter==&swig_module) {
2834 found=1;
2835 break;
2836 }
2837 iter=iter->next;
2838 } while (iter!= module_head);
2839
2840 /* if the is found in the list, then all is done and we may leave */
2841 if (found) return;
2842 /* otherwise we must add out module into the list */
2843 swig_module.next = module_head->next;
2844 module_head->next = &swig_module;
2845 }
2846
2847 /* When multiple interpeters are used, a module could have already been initialized in
2848 a different interpreter, but not yet have a pointer in this interpreter.
2849 In this case, we do not want to continue adding types... everything should be
2850 set up already */
2851 if (init == 0) return;
2852
2853 /* Now work on filling in swig_module.types */
2854 #ifdef SWIGRUNTIME_DEBUG
2855 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2856 #endif
2857 for (i = 0; i < swig_module.size; ++i) {
2858 swig_type_info *type = 0;
2859 swig_type_info *ret;
2860 swig_cast_info *cast;
2861
2862 #ifdef SWIGRUNTIME_DEBUG
2863 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2864 #endif
2865
2866 /* if there is another module already loaded */
2867 if (swig_module.next != &swig_module) {
2868 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2869 }
2870 if (type) {
2871 /* Overwrite clientdata field */
2872 #ifdef SWIGRUNTIME_DEBUG
2873 printf("SWIG_InitializeModule: found type %s\n", type->name);
2874 #endif
2875 if (swig_module.type_initial[i]->clientdata) {
2876 type->clientdata = swig_module.type_initial[i]->clientdata;
2877 #ifdef SWIGRUNTIME_DEBUG
2878 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2879 #endif
2880 }
2881 } else {
2882 type = swig_module.type_initial[i];
2883 }
2884
2885 /* Insert casting types */
2886 cast = swig_module.cast_initial[i];
2887 while (cast->type) {
2888 /* Don't need to add information already in the list */
2889 ret = 0;
2890 #ifdef SWIGRUNTIME_DEBUG
2891 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2892 #endif
2893 if (swig_module.next != &swig_module) {
2894 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2895 #ifdef SWIGRUNTIME_DEBUG
2896 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2897 #endif
2898 }
2899 if (ret) {
2900 if (type == swig_module.type_initial[i]) {
2901 #ifdef SWIGRUNTIME_DEBUG
2902 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2903 #endif
2904 cast->type = ret;
2905 ret = 0;
2906 } else {
2907 /* Check for casting already in the list */
2908 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2909 #ifdef SWIGRUNTIME_DEBUG
2910 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2911 #endif
2912 if (!ocast) ret = 0;
2913 }
2914 }
2915
2916 if (!ret) {
2917 #ifdef SWIGRUNTIME_DEBUG
2918 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2919 #endif
2920 if (type->cast) {
2921 type->cast->prev = cast;
2922 cast->next = type->cast;
2923 }
2924 type->cast = cast;
2925 }
2926 cast++;
2927 }
2928 /* Set entry in modules->types array equal to the type */
2929 swig_module.types[i] = type;
2930 }
2931 swig_module.types[i] = 0;
2932
2933 #ifdef SWIGRUNTIME_DEBUG
2934 printf("**** SWIG_InitializeModule: Cast List ******\n");
2935 for (i = 0; i < swig_module.size; ++i) {
2936 int j = 0;
2937 swig_cast_info *cast = swig_module.cast_initial[i];
2938 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2939 while (cast->type) {
2940 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2941 cast++;
2942 ++j;
2943 }
2944 printf("---- Total casts: %d\n",j);
2945 }
2946 printf("**** SWIG_InitializeModule: Cast List ******\n");
2947 #endif
2948 }
2949
2950 /* This function will propagate the clientdata field of type to
2951 * any new swig_type_info structures that have been added into the list
2952 * of equivalent types. It is like calling
2953 * SWIG_TypeClientData(type, clientdata) a second time.
2954 */
2955 SWIGRUNTIME void
SWIG_PropagateClientData(void)2956 SWIG_PropagateClientData(void) {
2957 size_t i;
2958 swig_cast_info *equiv;
2959 static int init_run = 0;
2960
2961 if (init_run) return;
2962 init_run = 1;
2963
2964 for (i = 0; i < swig_module.size; i++) {
2965 if (swig_module.types[i]->clientdata) {
2966 equiv = swig_module.types[i]->cast;
2967 while (equiv) {
2968 if (!equiv->converter) {
2969 if (equiv->type && !equiv->type->clientdata)
2970 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2971 }
2972 equiv = equiv->next;
2973 }
2974 }
2975 }
2976 }
2977
2978 #ifdef __cplusplus
2979 #if 0
2980 {
2981 /* c-mode */
2982 #endif
2983 }
2984 #endif
2985
2986
2987
2988 #ifdef __cplusplus
2989 extern "C" {
2990 #endif
2991
2992 /* Python-specific SWIG API */
2993 #define SWIG_newvarlink() SWIG_Python_newvarlink()
2994 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
2995 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
2996
2997 /* -----------------------------------------------------------------------------
2998 * global variable support code.
2999 * ----------------------------------------------------------------------------- */
3000
3001 typedef struct swig_globalvar {
3002 char *name; /* Name of global variable */
3003 PyObject *(*get_attr)(void); /* Return the current value */
3004 int (*set_attr)(PyObject *); /* Set the value */
3005 struct swig_globalvar *next;
3006 } swig_globalvar;
3007
3008 typedef struct swig_varlinkobject {
3009 PyObject_HEAD
3010 swig_globalvar *vars;
3011 } swig_varlinkobject;
3012
3013 SWIGINTERN PyObject *
swig_varlink_repr(swig_varlinkobject * SWIGUNUSEDPARM (v))3014 swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
3015 #if PY_VERSION_HEX >= 0x03000000
3016 return PyUnicode_InternFromString("<Swig global variables>");
3017 #else
3018 return PyString_FromString("<Swig global variables>");
3019 #endif
3020 }
3021
3022 SWIGINTERN PyObject *
swig_varlink_str(swig_varlinkobject * v)3023 swig_varlink_str(swig_varlinkobject *v) {
3024 #if PY_VERSION_HEX >= 0x03000000
3025 PyObject *str = PyUnicode_InternFromString("(");
3026 PyObject *tail;
3027 PyObject *joined;
3028 swig_globalvar *var;
3029 for (var = v->vars; var; var=var->next) {
3030 tail = PyUnicode_FromString(var->name);
3031 joined = PyUnicode_Concat(str, tail);
3032 Py_DecRef(str);
3033 Py_DecRef(tail);
3034 str = joined;
3035 if (var->next) {
3036 tail = PyUnicode_InternFromString(", ");
3037 joined = PyUnicode_Concat(str, tail);
3038 Py_DecRef(str);
3039 Py_DecRef(tail);
3040 str = joined;
3041 }
3042 }
3043 tail = PyUnicode_InternFromString(")");
3044 joined = PyUnicode_Concat(str, tail);
3045 Py_DecRef(str);
3046 Py_DecRef(tail);
3047 str = joined;
3048 #else
3049 PyObject *str = PyString_FromString("(");
3050 swig_globalvar *var;
3051 for (var = v->vars; var; var=var->next) {
3052 PyString_ConcatAndDel(&str,PyString_FromString(var->name));
3053 if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
3054 }
3055 PyString_ConcatAndDel(&str,PyString_FromString(")"));
3056 #endif
3057 return str;
3058 }
3059
3060 SWIGINTERN int
swig_varlink_print(swig_varlinkobject * v,FILE * fp,int SWIGUNUSEDPARM (flags))3061 swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
3062 char *tmp;
3063 PyObject *str = swig_varlink_str(v);
3064 fprintf(fp,"Swig global variables ");
3065 fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
3066 SWIG_Python_str_DelForPy3(tmp);
3067 Py_DECREF(str);
3068 return 0;
3069 }
3070
3071 SWIGINTERN void
swig_varlink_dealloc(swig_varlinkobject * v)3072 swig_varlink_dealloc(swig_varlinkobject *v) {
3073 swig_globalvar *var = v->vars;
3074 while (var) {
3075 swig_globalvar *n = var->next;
3076 free(var->name);
3077 free(var);
3078 var = n;
3079 }
3080 }
3081
3082 SWIGINTERN PyObject *
swig_varlink_getattr(swig_varlinkobject * v,char * n)3083 swig_varlink_getattr(swig_varlinkobject *v, char *n) {
3084 PyObject *res = NULL;
3085 swig_globalvar *var = v->vars;
3086 while (var) {
3087 if (strcmp(var->name,n) == 0) {
3088 res = (*var->get_attr)();
3089 break;
3090 }
3091 var = var->next;
3092 }
3093 if (res == NULL && !PyErr_Occurred()) {
3094 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
3095 }
3096 return res;
3097 }
3098
3099 SWIGINTERN int
swig_varlink_setattr(swig_varlinkobject * v,char * n,PyObject * p)3100 swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
3101 int res = 1;
3102 swig_globalvar *var = v->vars;
3103 while (var) {
3104 if (strcmp(var->name,n) == 0) {
3105 res = (*var->set_attr)(p);
3106 break;
3107 }
3108 var = var->next;
3109 }
3110 if (res == 1 && !PyErr_Occurred()) {
3111 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
3112 }
3113 return res;
3114 }
3115
3116 SWIGINTERN PyTypeObject*
swig_varlink_type(void)3117 swig_varlink_type(void) {
3118 static char varlink__doc__[] = "Swig var link object";
3119 static PyTypeObject varlink_type;
3120 static int type_init = 0;
3121 if (!type_init) {
3122 const PyTypeObject tmp
3123 = {
3124 /* PyObject header changed in Python 3 */
3125 #if PY_VERSION_HEX >= 0x03000000
3126 PyVarObject_HEAD_INIT(&PyType_Type, 0)
3127 #else
3128 PyObject_HEAD_INIT(NULL)
3129 0, /* Number of items in variable part (ob_size) */
3130 #endif
3131 (char *)"swigvarlink", /* Type name (tp_name) */
3132 sizeof(swig_varlinkobject), /* Basic size (tp_basicsize) */
3133 0, /* Itemsize (tp_itemsize) */
3134 (destructor) swig_varlink_dealloc, /* Deallocator (tp_dealloc) */
3135 (printfunc) swig_varlink_print, /* Print (tp_print) */
3136 (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
3137 (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
3138 0, /* tp_compare */
3139 (reprfunc) swig_varlink_repr, /* tp_repr */
3140 0, /* tp_as_number */
3141 0, /* tp_as_sequence */
3142 0, /* tp_as_mapping */
3143 0, /* tp_hash */
3144 0, /* tp_call */
3145 (reprfunc) swig_varlink_str, /* tp_str */
3146 0, /* tp_getattro */
3147 0, /* tp_setattro */
3148 0, /* tp_as_buffer */
3149 0, /* tp_flags */
3150 varlink__doc__, /* tp_doc */
3151 0, /* tp_traverse */
3152 0, /* tp_clear */
3153 0, /* tp_richcompare */
3154 0, /* tp_weaklistoffset */
3155 #if PY_VERSION_HEX >= 0x02020000
3156 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
3157 #endif
3158 #if PY_VERSION_HEX >= 0x02030000
3159 0, /* tp_del */
3160 #endif
3161 #ifdef COUNT_ALLOCS
3162 0,0,0,0 /* tp_alloc -> tp_next */
3163 #endif
3164 };
3165 varlink_type = tmp;
3166 /* for Python 3 we already assigned ob_type in PyVarObject_HEAD_INIT() */
3167 #if PY_VERSION_HEX < 0x03000000
3168 varlink_type.ob_type = &PyType_Type;
3169 #endif
3170 type_init = 1;
3171 }
3172 return &varlink_type;
3173 }
3174
3175 /* Create a variable linking object for use later */
3176 SWIGINTERN PyObject *
SWIG_Python_newvarlink(void)3177 SWIG_Python_newvarlink(void) {
3178 swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
3179 if (result) {
3180 result->vars = 0;
3181 }
3182 return ((PyObject*) result);
3183 }
3184
3185 SWIGINTERN void
SWIG_Python_addvarlink(PyObject * p,char * name,PyObject * (* get_attr)(void),int (* set_attr)(PyObject * p))3186 SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
3187 swig_varlinkobject *v = (swig_varlinkobject *) p;
3188 swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
3189 if (gv) {
3190 size_t size = strlen(name)+1;
3191 gv->name = (char *)malloc(size);
3192 if (gv->name) {
3193 strncpy(gv->name,name,size);
3194 gv->get_attr = get_attr;
3195 gv->set_attr = set_attr;
3196 gv->next = v->vars;
3197 }
3198 }
3199 v->vars = gv;
3200 }
3201
3202 SWIGINTERN PyObject *
SWIG_globals(void)3203 SWIG_globals(void) {
3204 static PyObject *_SWIG_globals = 0;
3205 if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
3206 return _SWIG_globals;
3207 }
3208
3209 /* -----------------------------------------------------------------------------
3210 * constants/methods manipulation
3211 * ----------------------------------------------------------------------------- */
3212
3213 /* Install Constants */
3214 SWIGINTERN void
SWIG_Python_InstallConstants(PyObject * d,swig_const_info constants[])3215 SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
3216 PyObject *obj = 0;
3217 size_t i;
3218 for (i = 0; constants[i].type; ++i) {
3219 switch(constants[i].type) {
3220 case SWIG_PY_POINTER:
3221 obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
3222 break;
3223 case SWIG_PY_BINARY:
3224 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
3225 break;
3226 default:
3227 obj = 0;
3228 break;
3229 }
3230 if (obj) {
3231 PyDict_SetItemString(d, constants[i].name, obj);
3232 Py_DECREF(obj);
3233 }
3234 }
3235 }
3236
3237 /* -----------------------------------------------------------------------------*/
3238 /* Fix SwigMethods to carry the callback ptrs when needed */
3239 /* -----------------------------------------------------------------------------*/
3240
3241 SWIGINTERN void
SWIG_Python_FixMethods(PyMethodDef * methods,swig_const_info * const_table,swig_type_info ** types,swig_type_info ** types_initial)3242 SWIG_Python_FixMethods(PyMethodDef *methods,
3243 swig_const_info *const_table,
3244 swig_type_info **types,
3245 swig_type_info **types_initial) {
3246 size_t i;
3247 for (i = 0; methods[i].ml_name; ++i) {
3248 const char *c = methods[i].ml_doc;
3249 if (c && (c = strstr(c, "swig_ptr: "))) {
3250 int j;
3251 swig_const_info *ci = 0;
3252 const char *name = c + 10;
3253 for (j = 0; const_table[j].type; ++j) {
3254 if (strncmp(const_table[j].name, name,
3255 strlen(const_table[j].name)) == 0) {
3256 ci = &(const_table[j]);
3257 break;
3258 }
3259 }
3260 if (ci) {
3261 size_t shift = (ci->ptype) - types;
3262 swig_type_info *ty = types_initial[shift];
3263 size_t ldoc = (c - methods[i].ml_doc);
3264 size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
3265 char *ndoc = (char*)malloc(ldoc + lptr + 10);
3266 if (ndoc) {
3267 char *buff = ndoc;
3268 void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
3269 if (ptr) {
3270 strncpy(buff, methods[i].ml_doc, ldoc);
3271 buff += ldoc;
3272 strncpy(buff, "swig_ptr: ", 10);
3273 buff += 10;
3274 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
3275 methods[i].ml_doc = ndoc;
3276 }
3277 }
3278 }
3279 }
3280 }
3281 }
3282
3283 #ifdef __cplusplus
3284 }
3285 #endif
3286
3287 /* -----------------------------------------------------------------------------*
3288 * Partial Init method
3289 * -----------------------------------------------------------------------------*/
3290
3291 #ifdef __cplusplus
3292 extern "C"
3293 #endif
3294
3295 SWIGEXPORT
3296 #if PY_VERSION_HEX >= 0x03000000
3297 PyObject*
3298 #else
3299 void
3300 #endif
SWIG_init(void)3301 SWIG_init(void) {
3302 PyObject *m, *d;
3303 #if PY_VERSION_HEX >= 0x03000000
3304 static struct PyModuleDef SWIG_module = {
3305 PyModuleDef_HEAD_INIT,
3306 (char *) SWIG_name,
3307 NULL,
3308 -1,
3309 SwigMethods,
3310 NULL,
3311 NULL,
3312 NULL,
3313 NULL
3314 };
3315 #endif
3316
3317 /* Fix SwigMethods to carry the callback ptrs when needed */
3318 SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
3319
3320 #if PY_VERSION_HEX >= 0x03000000
3321 m = PyModule_Create(&SWIG_module);
3322 #else
3323 m = Py_InitModule((char *) SWIG_name, SwigMethods);
3324 #endif
3325 d = PyModule_GetDict(m);
3326
3327 SWIG_InitializeModule(0);
3328 SWIG_InstallConstants(d,swig_const_table);
3329
3330
3331 #if PY_VERSION_HEX >= 0x03000000
3332 return m;
3333 #else
3334 return;
3335 #endif
3336 }
3337
3338