textual
[RRG-proxmark3.git] / client / src / pm3_pywrap.c
blob279b26d21b6ee1dc88e10ea76d66d915780867f5
1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
3 * Version 4.0.1
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 * ----------------------------------------------------------------------------- */
12 #ifndef SWIGPYTHON
13 #define SWIGPYTHON
14 #endif
16 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
18 /* -----------------------------------------------------------------------------
19 * This section contains generic SWIG labels for method/variable
20 * declarations/attributes, and other compiler dependent labels.
21 * ----------------------------------------------------------------------------- */
23 /* template workaround for compilers that cannot correctly implement the C++ standard */
24 #ifndef SWIGTEMPLATEDISAMBIGUATOR
25 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
26 # define SWIGTEMPLATEDISAMBIGUATOR template
27 # elif defined(__HP_aCC)
28 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
29 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
30 # define SWIGTEMPLATEDISAMBIGUATOR template
31 # else
32 # define SWIGTEMPLATEDISAMBIGUATOR
33 # endif
34 #endif
36 /* inline attribute */
37 #ifndef SWIGINLINE
38 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
39 # define SWIGINLINE inline
40 # else
41 # define SWIGINLINE
42 # endif
43 #endif
45 /* attribute recognised by some compilers to avoid 'unused' warnings */
46 #ifndef SWIGUNUSED
47 # if defined(__GNUC__)
48 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
49 # define SWIGUNUSED __attribute__ ((__unused__))
50 # else
51 # define SWIGUNUSED
52 # endif
53 # elif defined(__ICC)
54 # define SWIGUNUSED __attribute__ ((__unused__))
55 # else
56 # define SWIGUNUSED
57 # endif
58 #endif
60 #ifndef SWIG_MSC_UNSUPPRESS_4505
61 # if defined(_MSC_VER)
62 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
63 # endif
64 #endif
66 #ifndef SWIGUNUSEDPARM
67 # ifdef __cplusplus
68 # define SWIGUNUSEDPARM(p)
69 # else
70 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
71 # endif
72 #endif
74 /* internal SWIG method */
75 #ifndef SWIGINTERN
76 # define SWIGINTERN static SWIGUNUSED
77 #endif
79 /* internal inline SWIG method */
80 #ifndef SWIGINTERNINLINE
81 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
82 #endif
84 /* exporting methods */
85 #if defined(__GNUC__)
86 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
87 # ifndef GCC_HASCLASSVISIBILITY
88 # define GCC_HASCLASSVISIBILITY
89 # endif
90 # endif
91 #endif
93 #ifndef SWIGEXPORT
94 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
95 # if defined(STATIC_LINKED)
96 # define SWIGEXPORT
97 # else
98 # define SWIGEXPORT __declspec(dllexport)
99 # endif
100 # else
101 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
102 # define SWIGEXPORT __attribute__ ((visibility("default")))
103 # else
104 # define SWIGEXPORT
105 # endif
106 # endif
107 #endif
109 /* calling conventions for Windows */
110 #ifndef SWIGSTDCALL
111 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
112 # define SWIGSTDCALL __stdcall
113 # else
114 # define SWIGSTDCALL
115 # endif
116 #endif
118 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
119 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
120 # define _CRT_SECURE_NO_DEPRECATE
121 #endif
123 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
124 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
125 # define _SCL_SECURE_NO_DEPRECATE
126 #endif
128 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
129 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
130 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
131 #endif
133 /* Intel's compiler complains if a variable which was never initialised is
134 * cast to void, which is a common idiom which we use to indicate that we
135 * are aware a variable isn't used. So we just silence that warning.
136 * See: https://github.com/swig/swig/issues/192 for more discussion.
138 #ifdef __INTEL_COMPILER
139 # pragma warning disable 592
140 #endif
143 #if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
144 /* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
145 # include <math.h>
146 #endif
148 #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
149 /* Use debug wrappers with the Python release dll */
150 # undef _DEBUG
151 # include <Python.h>
152 # define _DEBUG 1
153 #else
154 # include <Python.h>
155 #endif
157 /* -----------------------------------------------------------------------------
158 * swigrun.swg
160 * This file contains generic C API SWIG runtime support for pointer
161 * type checking.
162 * ----------------------------------------------------------------------------- */
164 /* This should only be incremented when either the layout of swig_type_info changes,
165 or for whatever reason, the runtime changes incompatibly */
166 #define SWIG_RUNTIME_VERSION "4"
168 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
169 #ifdef SWIG_TYPE_TABLE
170 # define SWIG_QUOTE_STRING(x) #x
171 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
172 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
173 #else
174 # define SWIG_TYPE_TABLE_NAME
175 #endif
178 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
179 creating a static or dynamic library from the SWIG runtime code.
180 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
182 But only do this if strictly necessary, ie, if you have problems
183 with your compiler or suchlike.
186 #ifndef SWIGRUNTIME
187 # define SWIGRUNTIME SWIGINTERN
188 #endif
190 #ifndef SWIGRUNTIMEINLINE
191 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
192 #endif
194 /* Generic buffer size */
195 #ifndef SWIG_BUFFER_SIZE
196 # define SWIG_BUFFER_SIZE 1024
197 #endif
199 /* Flags for pointer conversions */
200 #define SWIG_POINTER_DISOWN 0x1
201 #define SWIG_CAST_NEW_MEMORY 0x2
202 #define SWIG_POINTER_NO_NULL 0x4
204 /* Flags for new pointer objects */
205 #define SWIG_POINTER_OWN 0x1
209 Flags/methods for returning states.
211 The SWIG conversion methods, as ConvertPtr, return an integer
212 that tells if the conversion was successful or not. And if not,
213 an error code can be returned (see swigerrors.swg for the codes).
215 Use the following macros/flags to set or process the returning
216 states.
218 In old versions of SWIG, code such as the following was usually written:
220 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
221 // success code
222 } else {
223 //fail code
226 Now you can be more explicit:
228 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
229 if (SWIG_IsOK(res)) {
230 // success code
231 } else {
232 // fail code
235 which is the same really, but now you can also do
237 Type *ptr;
238 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
239 if (SWIG_IsOK(res)) {
240 // success code
241 if (SWIG_IsNewObj(res) {
243 delete *ptr;
244 } else {
247 } else {
248 // fail code
251 I.e., now SWIG_ConvertPtr can return new objects and you can
252 identify the case and take care of the deallocation. Of course that
253 also requires SWIG_ConvertPtr to return new result values, such as
255 int SWIG_ConvertPtr(obj, ptr,...) {
256 if (<obj is ok>) {
257 if (<need new object>) {
258 *ptr = <ptr to new allocated object>;
259 return SWIG_NEWOBJ;
260 } else {
261 *ptr = <ptr to old object>;
262 return SWIG_OLDOBJ;
264 } else {
265 return SWIG_BADOBJ;
269 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
270 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
271 SWIG errors code.
273 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
274 allows to return the 'cast rank', for example, if you have this
276 int food(double)
277 int fooi(int);
279 and you call
281 food(1) // cast rank '1' (1 -> 1.0)
282 fooi(1) // cast rank '0'
284 just use the SWIG_AddCast()/SWIG_CheckState()
287 #define SWIG_OK (0)
288 #define SWIG_ERROR (-1)
289 #define SWIG_IsOK(r) (r >= 0)
290 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
292 /* The CastRankLimit says how many bits are used for the cast rank */
293 #define SWIG_CASTRANKLIMIT (1 << 8)
294 /* The NewMask denotes the object was created (using new/malloc) */
295 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
296 /* The TmpMask is for in/out typemaps that use temporal objects */
297 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
298 /* Simple returning values */
299 #define SWIG_BADOBJ (SWIG_ERROR)
300 #define SWIG_OLDOBJ (SWIG_OK)
301 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
302 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
303 /* Check, add and del mask methods */
304 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
305 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
306 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
307 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
308 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
309 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
311 /* Cast-Rank Mode */
312 #if defined(SWIG_CASTRANK_MODE)
313 # ifndef SWIG_TypeRank
314 # define SWIG_TypeRank unsigned long
315 # endif
316 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
317 # define SWIG_MAXCASTRANK (2)
318 # endif
319 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
320 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
321 SWIGINTERNINLINE int SWIG_AddCast(int r) {
322 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
324 SWIGINTERNINLINE int SWIG_CheckState(int r) {
325 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
327 #else /* no cast-rank mode */
328 # define SWIG_AddCast(r) (r)
329 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
330 #endif
333 #include <string.h>
335 #ifdef __cplusplus
336 extern "C" {
337 #endif
339 typedef void *(*swig_converter_func)(void *, int *);
340 typedef struct swig_type_info *(*swig_dycast_func)(void **);
342 /* Structure to store information on one type */
343 typedef struct swig_type_info {
344 const char *name; /* mangled name of this type */
345 const char *str; /* human readable name of this type */
346 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
347 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
348 void *clientdata; /* language specific type data */
349 int owndata; /* flag if the structure owns the clientdata */
350 } swig_type_info;
352 /* Structure to store a type and conversion function used for casting */
353 typedef struct swig_cast_info {
354 swig_type_info *type; /* pointer to type that is equivalent to this type */
355 swig_converter_func converter; /* function to cast the void pointers */
356 struct swig_cast_info *next; /* pointer to next cast in linked list */
357 struct swig_cast_info *prev; /* pointer to the previous cast */
358 } swig_cast_info;
360 /* Structure used to store module information
361 * Each module generates one structure like this, and the runtime collects
362 * all of these structures and stores them in a circularly linked list.*/
363 typedef struct swig_module_info {
364 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
365 size_t size; /* Number of types in this module */
366 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
367 swig_type_info **type_initial; /* Array of initially generated type structures */
368 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
369 void *clientdata; /* Language specific module data */
370 } swig_module_info;
373 Compare two type names skipping the space characters, therefore
374 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
376 Return 0 when the two name types are equivalent, as in
377 strncmp, but skipping ' '.
379 SWIGRUNTIME int
380 SWIG_TypeNameComp(const char *f1, const char *l1,
381 const char *f2, const char *l2) {
382 for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
383 while ((*f1 == ' ') && (f1 != l1)) ++f1;
384 while ((*f2 == ' ') && (f2 != l2)) ++f2;
385 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
387 return (int)((l1 - f1) - (l2 - f2));
391 Check type equivalence in a name list like <name1>|<name2>|...
392 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
394 SWIGRUNTIME int
395 SWIG_TypeCmp(const char *nb, const char *tb) {
396 int equiv = 1;
397 const char *te = tb + strlen(tb);
398 const char *ne = nb;
399 while (equiv != 0 && *ne) {
400 for (nb = ne; *ne; ++ne) {
401 if (*ne == '|') break;
403 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
404 if (*ne) ++ne;
406 return equiv;
410 Check type equivalence in a name list like <name1>|<name2>|...
411 Return 0 if not equal, 1 if equal
413 SWIGRUNTIME int
414 SWIG_TypeEquiv(const char *nb, const char *tb) {
415 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
419 Check the typename
421 SWIGRUNTIME swig_cast_info *
422 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
423 if (ty) {
424 swig_cast_info *iter = ty->cast;
425 while (iter) {
426 if (strcmp(iter->type->name, c) == 0) {
427 if (iter == ty->cast)
428 return iter;
429 /* Move iter to the top of the linked list */
430 iter->prev->next = iter->next;
431 if (iter->next)
432 iter->next->prev = iter->prev;
433 iter->next = ty->cast;
434 iter->prev = 0;
435 if (ty->cast) ty->cast->prev = iter;
436 ty->cast = iter;
437 return iter;
439 iter = iter->next;
442 return 0;
446 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
448 SWIGRUNTIME swig_cast_info *
449 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
450 if (ty) {
451 swig_cast_info *iter = ty->cast;
452 while (iter) {
453 if (iter->type == from) {
454 if (iter == ty->cast)
455 return iter;
456 /* Move iter to the top of the linked list */
457 iter->prev->next = iter->next;
458 if (iter->next)
459 iter->next->prev = iter->prev;
460 iter->next = ty->cast;
461 iter->prev = 0;
462 if (ty->cast) ty->cast->prev = iter;
463 ty->cast = iter;
464 return iter;
466 iter = iter->next;
469 return 0;
473 Cast a pointer up an inheritance hierarchy
475 SWIGRUNTIMEINLINE void *
476 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
477 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
481 Dynamic pointer casting. Down an inheritance hierarchy
483 SWIGRUNTIME swig_type_info *
484 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
485 swig_type_info *lastty = ty;
486 if (!ty || !ty->dcast) return ty;
487 while (ty && (ty->dcast)) {
488 ty = (*ty->dcast)(ptr);
489 if (ty) lastty = ty;
491 return lastty;
495 Return the name associated with this type
497 SWIGRUNTIMEINLINE const char *
498 SWIG_TypeName(const swig_type_info *ty) {
499 return ty->name;
503 Return the pretty name associated with this type,
504 that is an unmangled type name in a form presentable to the user.
506 SWIGRUNTIME const char *
507 SWIG_TypePrettyName(const swig_type_info *type) {
508 /* The "str" field contains the equivalent pretty names of the
509 type, separated by vertical-bar characters. We choose
510 to print the last name, as it is often (?) the most
511 specific. */
512 if (!type) return NULL;
513 if (type->str != NULL) {
514 const char *last_name = type->str;
515 const char *s;
516 for (s = type->str; *s; s++)
517 if (*s == '|') last_name = s + 1;
518 return last_name;
519 } else
520 return type->name;
524 Set the clientdata field for a type
526 SWIGRUNTIME void
527 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
528 swig_cast_info *cast = ti->cast;
529 /* if (ti->clientdata == clientdata) return; */
530 ti->clientdata = clientdata;
532 while (cast) {
533 if (!cast->converter) {
534 swig_type_info *tc = cast->type;
535 if (!tc->clientdata) {
536 SWIG_TypeClientData(tc, clientdata);
539 cast = cast->next;
542 SWIGRUNTIME void
543 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
544 SWIG_TypeClientData(ti, clientdata);
545 ti->owndata = 1;
549 Search for a swig_type_info structure only by mangled name
550 Search is a O(log #types)
552 We start searching at module start, and finish searching when start == end.
553 Note: if start == end at the beginning of the function, we go all the way around
554 the circular list.
556 SWIGRUNTIME swig_type_info *
557 SWIG_MangledTypeQueryModule(swig_module_info *start,
558 swig_module_info *end,
559 const char *name) {
560 swig_module_info *iter = start;
561 do {
562 if (iter->size) {
563 size_t l = 0;
564 size_t r = iter->size - 1;
565 do {
566 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
567 size_t i = (l + r) >> 1;
568 const char *iname = iter->types[i]->name;
569 if (iname) {
570 int compare = strcmp(name, iname);
571 if (compare == 0) {
572 return iter->types[i];
573 } else if (compare < 0) {
574 if (i) {
575 r = i - 1;
576 } else {
577 break;
579 } else if (compare > 0) {
580 l = i + 1;
582 } else {
583 break; /* should never happen */
585 } while (l <= r);
587 iter = iter->next;
588 } while (iter != end);
589 return 0;
593 Search for a swig_type_info structure for either a mangled name or a human readable name.
594 It first searches the mangled names of the types, which is a O(log #types)
595 If a type is not found it then searches the human readable names, which is O(#types).
597 We start searching at module start, and finish searching when start == end.
598 Note: if start == end at the beginning of the function, we go all the way around
599 the circular list.
601 SWIGRUNTIME swig_type_info *
602 SWIG_TypeQueryModule(swig_module_info *start,
603 swig_module_info *end,
604 const char *name) {
605 /* STEP 1: Search the name field using binary search */
606 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
607 if (ret) {
608 return ret;
609 } else {
610 /* STEP 2: If the type hasn't been found, do a complete search
611 of the str field (the human readable name) */
612 swig_module_info *iter = start;
613 do {
614 size_t i = 0;
615 for (; i < iter->size; ++i) {
616 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
617 return iter->types[i];
619 iter = iter->next;
620 } while (iter != end);
623 /* neither found a match */
624 return 0;
628 Pack binary data into a string
630 SWIGRUNTIME char *
631 SWIG_PackData(char *c, void *ptr, size_t sz) {
632 static const char hex[17] = "0123456789abcdef";
633 const unsigned char *u = (unsigned char *) ptr;
634 const unsigned char *eu = u + sz;
635 for (; u != eu; ++u) {
636 unsigned char uu = *u;
637 *(c++) = hex[(uu & 0xf0) >> 4];
638 *(c++) = hex[uu & 0xf];
640 return c;
644 Unpack binary data from a string
646 SWIGRUNTIME const char *
647 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
648 unsigned char *u = (unsigned char *) ptr;
649 const unsigned char *eu = u + sz;
650 for (; u != eu; ++u) {
651 char d = *(c++);
652 unsigned char uu;
653 if ((d >= '0') && (d <= '9'))
654 uu = (unsigned char)((d - '0') << 4);
655 else if ((d >= 'a') && (d <= 'f'))
656 uu = (unsigned char)((d - ('a' - 10)) << 4);
657 else
658 return (char *) 0;
659 d = *(c++);
660 if ((d >= '0') && (d <= '9'))
661 uu |= (unsigned char)(d - '0');
662 else if ((d >= 'a') && (d <= 'f'))
663 uu |= (unsigned char)(d - ('a' - 10));
664 else
665 return (char *) 0;
666 *u = uu;
668 return c;
672 Pack 'void *' into a string buffer.
674 SWIGRUNTIME char *
675 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
676 char *r = buff;
677 if ((2 * sizeof(void *) + 2) > bsz) return 0;
678 *(r++) = '_';
679 r = SWIG_PackData(r, &ptr, sizeof(void *));
680 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
681 strcpy(r, name);
682 return buff;
685 SWIGRUNTIME const char *
686 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
687 if (*c != '_') {
688 if (strcmp(c, "NULL") == 0) {
689 *ptr = (void *) 0;
690 return name;
691 } else {
692 return 0;
695 return SWIG_UnpackData(++c, ptr, sizeof(void *));
698 SWIGRUNTIME char *
699 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
700 char *r = buff;
701 size_t lname = (name ? strlen(name) : 0);
702 if ((2 * sz + 2 + lname) > bsz) return 0;
703 *(r++) = '_';
704 r = SWIG_PackData(r, ptr, sz);
705 if (lname) {
706 strncpy(r, name, lname + 1);
707 } else {
708 *r = 0;
710 return buff;
713 SWIGRUNTIME const char *
714 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
715 if (*c != '_') {
716 if (strcmp(c, "NULL") == 0) {
717 memset(ptr, 0, sz);
718 return name;
719 } else {
720 return 0;
723 return SWIG_UnpackData(++c, ptr, sz);
726 #ifdef __cplusplus
728 #endif
730 /* Errors in SWIG */
731 #define SWIG_UnknownError -1
732 #define SWIG_IOError -2
733 #define SWIG_RuntimeError -3
734 #define SWIG_IndexError -4
735 #define SWIG_TypeError -5
736 #define SWIG_DivisionByZero -6
737 #define SWIG_OverflowError -7
738 #define SWIG_SyntaxError -8
739 #define SWIG_ValueError -9
740 #define SWIG_SystemError -10
741 #define SWIG_AttributeError -11
742 #define SWIG_MemoryError -12
743 #define SWIG_NullReferenceError -13
747 /* Compatibility macros for Python 3 */
748 #if PY_VERSION_HEX >= 0x03000000
750 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
751 #define PyInt_Check(x) PyLong_Check(x)
752 #define PyInt_AsLong(x) PyLong_AsLong(x)
753 #define PyInt_FromLong(x) PyLong_FromLong(x)
754 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
755 #define PyString_Check(name) PyBytes_Check(name)
756 #define PyString_FromString(x) PyUnicode_FromString(x)
757 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
758 #define PyString_AsString(str) PyBytes_AsString(str)
759 #define PyString_Size(str) PyBytes_Size(str)
760 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
761 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
762 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
763 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
765 #endif
767 #ifndef Py_TYPE
768 # define Py_TYPE(op) ((op)->ob_type)
769 #endif
771 /* SWIG APIs for compatibility of both Python 2 & 3 */
773 #if PY_VERSION_HEX >= 0x03000000
774 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
775 #else
776 # define SWIG_Python_str_FromFormat PyString_FromFormat
777 #endif
780 /* Warning: This function will allocate a new string in Python 3,
781 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
783 SWIGINTERN char *
784 SWIG_Python_str_AsChar(PyObject *str) {
785 #if PY_VERSION_HEX >= 0x03000000
786 char *newstr = 0;
787 str = PyUnicode_AsUTF8String(str);
788 if (str) {
789 char *cstr;
790 Py_ssize_t len;
791 PyBytes_AsStringAndSize(str, &cstr, &len);
792 newstr = (char *) malloc(len + 1);
793 memcpy(newstr, cstr, len + 1);
794 Py_XDECREF(str);
796 return newstr;
797 #else
798 return PyString_AsString(str);
799 #endif
802 #if PY_VERSION_HEX >= 0x03000000
803 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
804 #else
805 # define SWIG_Python_str_DelForPy3(x)
806 #endif
809 SWIGINTERN PyObject *
810 SWIG_Python_str_FromChar(const char *c) {
811 #if PY_VERSION_HEX >= 0x03000000
812 return PyUnicode_FromString(c);
813 #else
814 return PyString_FromString(c);
815 #endif
818 #ifndef PyObject_DEL
819 # define PyObject_DEL PyObject_Del
820 #endif
822 // SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
823 // interface files check for it.
824 # define SWIGPY_USE_CAPSULE
825 # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
827 #if PY_VERSION_HEX < 0x03020000
828 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
829 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
830 #define Py_hash_t long
831 #endif
833 /* -----------------------------------------------------------------------------
834 * error manipulation
835 * ----------------------------------------------------------------------------- */
837 SWIGRUNTIME PyObject *
838 SWIG_Python_ErrorType(int code) {
839 PyObject *type = 0;
840 switch (code) {
841 case SWIG_MemoryError:
842 type = PyExc_MemoryError;
843 break;
844 case SWIG_IOError:
845 type = PyExc_IOError;
846 break;
847 case SWIG_RuntimeError:
848 type = PyExc_RuntimeError;
849 break;
850 case SWIG_IndexError:
851 type = PyExc_IndexError;
852 break;
853 case SWIG_TypeError:
854 type = PyExc_TypeError;
855 break;
856 case SWIG_DivisionByZero:
857 type = PyExc_ZeroDivisionError;
858 break;
859 case SWIG_OverflowError:
860 type = PyExc_OverflowError;
861 break;
862 case SWIG_SyntaxError:
863 type = PyExc_SyntaxError;
864 break;
865 case SWIG_ValueError:
866 type = PyExc_ValueError;
867 break;
868 case SWIG_SystemError:
869 type = PyExc_SystemError;
870 break;
871 case SWIG_AttributeError:
872 type = PyExc_AttributeError;
873 break;
874 default:
875 type = PyExc_RuntimeError;
877 return type;
881 SWIGRUNTIME void
882 SWIG_Python_AddErrorMsg(const char *mesg) {
883 PyObject *type = 0;
884 PyObject *value = 0;
885 PyObject *traceback = 0;
887 if (PyErr_Occurred())
888 PyErr_Fetch(&type, &value, &traceback);
889 if (value) {
890 PyObject *old_str = PyObject_Str(value);
891 const char *tmp = SWIG_Python_str_AsChar(old_str);
892 PyErr_Clear();
893 Py_XINCREF(type);
894 if (tmp)
895 PyErr_Format(type, "%s %s", tmp, mesg);
896 else
897 PyErr_Format(type, "%s", mesg);
898 SWIG_Python_str_DelForPy3(tmp);
899 Py_DECREF(old_str);
900 Py_DECREF(value);
901 } else {
902 PyErr_SetString(PyExc_RuntimeError, mesg);
906 SWIGRUNTIME int
907 SWIG_Python_TypeErrorOccurred(PyObject *obj) {
908 PyObject *error;
909 if (obj)
910 return 0;
911 error = PyErr_Occurred();
912 return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
915 SWIGRUNTIME void
916 SWIG_Python_RaiseOrModifyTypeError(const char *message) {
917 if (SWIG_Python_TypeErrorOccurred(NULL)) {
918 /* Use existing TypeError to preserve stacktrace and enhance with given message */
919 PyObject *newvalue;
920 PyObject *type = NULL, *value = NULL, *traceback = NULL;
921 PyErr_Fetch(&type, &value, &traceback);
922 #if PY_VERSION_HEX >= 0x03000000
923 newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message);
924 #else
925 newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
926 #endif
927 Py_XDECREF(value);
928 PyErr_Restore(type, newvalue, traceback);
929 } else {
930 /* Raise TypeError using given message */
931 PyErr_SetString(PyExc_TypeError, message);
935 #if defined(SWIG_PYTHON_NO_THREADS)
936 # if defined(SWIG_PYTHON_THREADS)
937 # undef SWIG_PYTHON_THREADS
938 # endif
939 #endif
940 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
941 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
942 # define SWIG_PYTHON_USE_GIL
943 # endif
944 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
945 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
946 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
947 # endif
948 # ifdef __cplusplus /* C++ code */
949 class SWIG_Python_Thread_Block {
950 bool status;
951 PyGILState_STATE state;
952 public:
953 void end() { if (status) { PyGILState_Release(state); status = false;} }
954 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
955 ~SWIG_Python_Thread_Block() { end(); }
957 class SWIG_Python_Thread_Allow {
958 bool status;
959 PyThreadState *save;
960 public:
961 void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
962 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
963 ~SWIG_Python_Thread_Allow() { end(); }
965 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
966 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
967 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
968 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
969 # else /* C code */
970 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
971 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
972 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
973 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
974 # endif
975 # else /* Old thread way, not implemented, user must provide it */
976 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
977 # define SWIG_PYTHON_INITIALIZE_THREADS
978 # endif
979 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
980 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
981 # endif
982 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
983 # define SWIG_PYTHON_THREAD_END_BLOCK
984 # endif
985 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
986 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
987 # endif
988 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
989 # define SWIG_PYTHON_THREAD_END_ALLOW
990 # endif
991 # endif
992 #else /* No thread support */
993 # define SWIG_PYTHON_INITIALIZE_THREADS
994 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
995 # define SWIG_PYTHON_THREAD_END_BLOCK
996 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
997 # define SWIG_PYTHON_THREAD_END_ALLOW
998 #endif
1000 /* -----------------------------------------------------------------------------
1001 * Python API portion that goes into the runtime
1002 * ----------------------------------------------------------------------------- */
1004 #ifdef __cplusplus
1005 extern "C" {
1006 #endif
1008 /* -----------------------------------------------------------------------------
1009 * Constant declarations
1010 * ----------------------------------------------------------------------------- */
1012 /* Constant Types */
1013 #define SWIG_PY_POINTER 4
1014 #define SWIG_PY_BINARY 5
1016 /* Constant information structure */
1017 typedef struct swig_const_info {
1018 int type;
1019 const char *name;
1020 long lvalue;
1021 double dvalue;
1022 void *pvalue;
1023 swig_type_info **ptype;
1024 } swig_const_info;
1026 #ifdef __cplusplus
1028 #endif
1031 /* -----------------------------------------------------------------------------
1032 * pyrun.swg
1034 * This file contains the runtime support for Python modules
1035 * and includes code for managing global variables and pointer
1036 * type checking.
1038 * ----------------------------------------------------------------------------- */
1040 #if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
1041 # error "This version of SWIG only supports Python >= 2.7"
1042 #endif
1044 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
1045 # error "This version of SWIG only supports Python 3 >= 3.2"
1046 #endif
1048 /* Common SWIG API */
1050 /* for raw pointers */
1051 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1052 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1053 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1055 #ifdef SWIGPYTHON_BUILTIN
1056 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1057 #else
1058 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1059 #endif
1061 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1063 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1064 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1065 #define swig_owntype int
1067 /* for raw packed data */
1068 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1069 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1071 /* for class or struct pointers */
1072 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1073 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1075 /* for C or C++ function pointers */
1076 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1077 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1079 /* for C++ member pointers, ie, member methods */
1080 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1081 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1084 /* Runtime API */
1086 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1087 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1088 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1090 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1091 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1092 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1093 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1094 #define SWIG_fail goto fail
1097 /* Runtime API implementation */
1099 /* Error manipulation */
1101 SWIGINTERN void
1102 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1103 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1104 PyErr_SetObject(errtype, obj);
1105 Py_DECREF(obj);
1106 SWIG_PYTHON_THREAD_END_BLOCK;
1109 SWIGINTERN void
1110 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1111 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1112 PyErr_SetString(errtype, msg);
1113 SWIG_PYTHON_THREAD_END_BLOCK;
1116 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1118 /* Set a constant value */
1120 #if defined(SWIGPYTHON_BUILTIN)
1122 SWIGINTERN void
1123 SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1124 PyObject *s = PyString_InternFromString(key);
1125 PyList_Append(seq, s);
1126 Py_DECREF(s);
1129 SWIGINTERN void
1130 SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
1131 PyDict_SetItemString(d, name, obj);
1132 Py_DECREF(obj);
1133 if (public_interface)
1134 SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1137 #else
1139 SWIGINTERN void
1140 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1141 PyDict_SetItemString(d, name, obj);
1142 Py_DECREF(obj);
1145 #endif
1147 /* Append a value to the result obj */
1149 SWIGINTERN PyObject *
1150 SWIG_Python_AppendOutput(PyObject *result, PyObject *obj) {
1151 if (!result) {
1152 result = obj;
1153 } else if (result == Py_None) {
1154 Py_DECREF(result);
1155 result = obj;
1156 } else {
1157 if (!PyList_Check(result)) {
1158 PyObject *o2 = result;
1159 result = PyList_New(1);
1160 PyList_SetItem(result, 0, o2);
1162 PyList_Append(result, obj);
1163 Py_DECREF(obj);
1165 return result;
1168 /* Unpack the argument tuple */
1170 SWIGINTERN Py_ssize_t
1171 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) {
1172 if (!args) {
1173 if (!min && !max) {
1174 return 1;
1175 } else {
1176 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1177 name, (min == max ? "" : "at least "), (int)min);
1178 return 0;
1181 if (!PyTuple_Check(args)) {
1182 if (min <= 1 && max >= 1) {
1183 Py_ssize_t i;
1184 objs[0] = args;
1185 for (i = 1; i < max; ++i) {
1186 objs[i] = 0;
1188 return 2;
1190 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1191 return 0;
1192 } else {
1193 Py_ssize_t l = PyTuple_GET_SIZE(args);
1194 if (l < min) {
1195 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1196 name, (min == max ? "" : "at least "), (int)min, (int)l);
1197 return 0;
1198 } else if (l > max) {
1199 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1200 name, (min == max ? "" : "at most "), (int)max, (int)l);
1201 return 0;
1202 } else {
1203 Py_ssize_t i;
1204 for (i = 0; i < l; ++i) {
1205 objs[i] = PyTuple_GET_ITEM(args, i);
1207 for (; l < max; ++l) {
1208 objs[l] = 0;
1210 return i + 1;
1215 /* A functor is a function object with one single object argument */
1216 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1219 Helper for static pointer initialization for both C and C++ code, for example
1220 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1222 #ifdef __cplusplus
1223 #define SWIG_STATIC_POINTER(var) var
1224 #else
1225 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1226 #endif
1228 /* -----------------------------------------------------------------------------
1229 * Pointer declarations
1230 * ----------------------------------------------------------------------------- */
1232 /* Flags for new pointer objects */
1233 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1234 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1236 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1238 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1239 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1241 #ifdef __cplusplus
1242 extern "C" {
1243 #endif
1245 /* The python void return value */
1247 SWIGRUNTIMEINLINE PyObject *
1248 SWIG_Py_Void(void) {
1249 PyObject *none = Py_None;
1250 Py_INCREF(none);
1251 return none;
1254 /* SwigPyClientData */
1256 typedef struct {
1257 PyObject *klass;
1258 PyObject *newraw;
1259 PyObject *newargs;
1260 PyObject *destroy;
1261 int delargs;
1262 int implicitconv;
1263 PyTypeObject *pytype;
1264 } SwigPyClientData;
1266 SWIGRUNTIMEINLINE int
1267 SWIG_Python_CheckImplicit(swig_type_info *ty) {
1268 SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1269 int fail = data ? data->implicitconv : 0;
1270 if (fail)
1271 PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors.");
1272 return fail;
1275 SWIGRUNTIMEINLINE PyObject *
1276 SWIG_Python_ExceptionType(swig_type_info *desc) {
1277 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1278 PyObject *klass = data ? data->klass : 0;
1279 return (klass ? klass : PyExc_RuntimeError);
1283 SWIGRUNTIME SwigPyClientData *
1284 SwigPyClientData_New(PyObject *obj) {
1285 if (!obj) {
1286 return 0;
1287 } else {
1288 SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1289 /* the klass element */
1290 data->klass = obj;
1291 Py_INCREF(data->klass);
1292 /* the newraw method and newargs arguments used to create a new raw instance */
1293 if (PyClass_Check(obj)) {
1294 data->newraw = 0;
1295 data->newargs = obj;
1296 Py_INCREF(obj);
1297 } else {
1298 data->newraw = PyObject_GetAttrString(data->klass, "__new__");
1299 if (data->newraw) {
1300 Py_INCREF(data->newraw);
1301 data->newargs = PyTuple_New(1);
1302 PyTuple_SetItem(data->newargs, 0, obj);
1303 } else {
1304 data->newargs = obj;
1306 Py_INCREF(data->newargs);
1308 /* the destroy method, aka as the C++ delete method */
1309 data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
1310 if (PyErr_Occurred()) {
1311 PyErr_Clear();
1312 data->destroy = 0;
1314 if (data->destroy) {
1315 int flags;
1316 Py_INCREF(data->destroy);
1317 flags = PyCFunction_GET_FLAGS(data->destroy);
1318 data->delargs = !(flags & (METH_O));
1319 } else {
1320 data->delargs = 0;
1322 data->implicitconv = 0;
1323 data->pytype = 0;
1324 return data;
1328 SWIGRUNTIME void
1329 SwigPyClientData_Del(SwigPyClientData *data) {
1330 Py_XDECREF(data->newraw);
1331 Py_XDECREF(data->newargs);
1332 Py_XDECREF(data->destroy);
1335 /* =============== SwigPyObject =====================*/
1337 typedef struct {
1338 PyObject_HEAD
1339 void *ptr;
1340 swig_type_info *ty;
1341 int own;
1342 PyObject *next;
1343 #ifdef SWIGPYTHON_BUILTIN
1344 PyObject *dict;
1345 #endif
1346 } SwigPyObject;
1349 #ifdef SWIGPYTHON_BUILTIN
1351 SWIGRUNTIME PyObject *
1352 SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1353 SwigPyObject *sobj = (SwigPyObject *)v;
1355 if (!sobj->dict)
1356 sobj->dict = PyDict_New();
1358 Py_INCREF(sobj->dict);
1359 return sobj->dict;
1362 #endif
1364 SWIGRUNTIME PyObject *
1365 SwigPyObject_long(SwigPyObject *v) {
1366 return PyLong_FromVoidPtr(v->ptr);
1369 SWIGRUNTIME PyObject *
1370 SwigPyObject_format(const char *fmt, SwigPyObject *v) {
1371 PyObject *res = NULL;
1372 PyObject *args = PyTuple_New(1);
1373 if (args) {
1374 if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1375 PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1376 if (ofmt) {
1377 #if PY_VERSION_HEX >= 0x03000000
1378 res = PyUnicode_Format(ofmt, args);
1379 #else
1380 res = PyString_Format(ofmt, args);
1381 #endif
1382 Py_DECREF(ofmt);
1384 Py_DECREF(args);
1387 return res;
1390 SWIGRUNTIME PyObject *
1391 SwigPyObject_oct(SwigPyObject *v) {
1392 return SwigPyObject_format("%o", v);
1395 SWIGRUNTIME PyObject *
1396 SwigPyObject_hex(SwigPyObject *v) {
1397 return SwigPyObject_format("%x", v);
1400 SWIGRUNTIME PyObject *
1401 SwigPyObject_repr(SwigPyObject *v) {
1402 const char *name = SWIG_TypePrettyName(v->ty);
1403 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
1404 if (v->next) {
1405 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1406 # if PY_VERSION_HEX >= 0x03000000
1407 PyObject *joined = PyUnicode_Concat(repr, nrep);
1408 Py_DecRef(repr);
1409 Py_DecRef(nrep);
1410 repr = joined;
1411 # else
1412 PyString_ConcatAndDel(&repr, nrep);
1413 # endif
1415 return repr;
1418 /* We need a version taking two PyObject* parameters so it's a valid
1419 * PyCFunction to use in swigobject_methods[]. */
1420 SWIGRUNTIME PyObject *
1421 SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1422 return SwigPyObject_repr((SwigPyObject *)v);
1425 SWIGRUNTIME int
1426 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) {
1427 void *i = v->ptr;
1428 void *j = w->ptr;
1429 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1432 /* Added for Python 3.x, would it also be useful for Python 2.x? */
1433 SWIGRUNTIME PyObject *
1434 SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) {
1435 PyObject *res;
1436 if (op != Py_EQ && op != Py_NE) {
1437 Py_INCREF(Py_NotImplemented);
1438 return Py_NotImplemented;
1440 res = PyBool_FromLong((SwigPyObject_compare(v, w) == 0) == (op == Py_EQ) ? 1 : 0);
1441 return res;
1445 SWIGRUNTIME PyTypeObject *SwigPyObject_TypeOnce(void);
1447 #ifdef SWIGPYTHON_BUILTIN
1448 static swig_type_info *SwigPyObject_stype = 0;
1449 SWIGRUNTIME PyTypeObject *
1450 SwigPyObject_type(void) {
1451 SwigPyClientData *cd;
1452 assert(SwigPyObject_stype);
1453 cd = (SwigPyClientData *) SwigPyObject_stype->clientdata;
1454 assert(cd);
1455 assert(cd->pytype);
1456 return cd->pytype;
1458 #else
1459 SWIGRUNTIME PyTypeObject *
1460 SwigPyObject_type(void) {
1461 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1462 return type;
1464 #endif
1466 SWIGRUNTIMEINLINE int
1467 SwigPyObject_Check(PyObject *op) {
1468 #ifdef SWIGPYTHON_BUILTIN
1469 PyTypeObject *target_tp = SwigPyObject_type();
1470 if (PyType_IsSubtype(op->ob_type, target_tp))
1471 return 1;
1472 return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
1473 #else
1474 return (Py_TYPE(op) == SwigPyObject_type())
1475 || (strcmp(Py_TYPE(op)->tp_name, "SwigPyObject") == 0);
1476 #endif
1479 SWIGRUNTIME PyObject *
1480 SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1482 SWIGRUNTIME void
1483 SwigPyObject_dealloc(PyObject *v) {
1484 SwigPyObject *sobj = (SwigPyObject *) v;
1485 PyObject *next = sobj->next;
1486 if (sobj->own == SWIG_POINTER_OWN) {
1487 swig_type_info *ty = sobj->ty;
1488 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1489 PyObject *destroy = data ? data->destroy : 0;
1490 if (destroy) {
1491 /* destroy is always a VARARGS method */
1492 PyObject *res;
1494 /* PyObject_CallFunction() has the potential to silently drop
1495 the active exception. In cases of unnamed temporary
1496 variable or where we just finished iterating over a generator
1497 StopIteration will be active right now, and this needs to
1498 remain true upon return from SwigPyObject_dealloc. So save
1499 and restore. */
1501 PyObject *type = NULL, *value = NULL, *traceback = NULL;
1502 PyErr_Fetch(&type, &value, &traceback);
1504 if (data->delargs) {
1505 /* we need to create a temporary object to carry the destroy operation */
1506 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1507 res = SWIG_Python_CallFunctor(destroy, tmp);
1508 Py_DECREF(tmp);
1509 } else {
1510 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1511 PyObject *mself = PyCFunction_GET_SELF(destroy);
1512 res = ((*meth)(mself, v));
1514 if (!res)
1515 PyErr_WriteUnraisable(destroy);
1517 PyErr_Restore(type, value, traceback);
1519 Py_XDECREF(res);
1521 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1522 else {
1523 const char *name = SWIG_TypePrettyName(ty);
1524 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1526 #endif
1528 Py_XDECREF(next);
1529 PyObject_DEL(v);
1532 SWIGRUNTIME PyObject *
1533 SwigPyObject_append(PyObject *v, PyObject *next) {
1534 SwigPyObject *sobj = (SwigPyObject *) v;
1535 if (!SwigPyObject_Check(next)) {
1536 PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
1537 return NULL;
1539 sobj->next = next;
1540 Py_INCREF(next);
1541 return SWIG_Py_Void();
1544 SWIGRUNTIME PyObject *
1545 SwigPyObject_next(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1546 SwigPyObject *sobj = (SwigPyObject *) v;
1547 if (sobj->next) {
1548 Py_INCREF(sobj->next);
1549 return sobj->next;
1550 } else {
1551 return SWIG_Py_Void();
1555 SWIGINTERN PyObject *
1556 SwigPyObject_disown(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1557 SwigPyObject *sobj = (SwigPyObject *)v;
1558 sobj->own = 0;
1559 return SWIG_Py_Void();
1562 SWIGINTERN PyObject *
1563 SwigPyObject_acquire(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1564 SwigPyObject *sobj = (SwigPyObject *)v;
1565 sobj->own = SWIG_POINTER_OWN;
1566 return SWIG_Py_Void();
1569 SWIGINTERN PyObject *
1570 SwigPyObject_own(PyObject *v, PyObject *args) {
1571 PyObject *val = 0;
1572 if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) {
1573 return NULL;
1574 } else {
1575 SwigPyObject *sobj = (SwigPyObject *)v;
1576 PyObject *obj = PyBool_FromLong(sobj->own);
1577 if (val) {
1578 if (PyObject_IsTrue(val)) {
1579 SwigPyObject_acquire(v, args);
1580 } else {
1581 SwigPyObject_disown(v, args);
1584 return obj;
1588 static PyMethodDef
1589 swigobject_methods[] = {
1590 {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"},
1591 {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"},
1592 {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"},
1593 {"append", SwigPyObject_append, METH_O, "appends another 'this' object"},
1594 {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"},
1595 {"__repr__", SwigPyObject_repr2, METH_NOARGS, "returns object representation"},
1596 {0, 0, 0, 0}
1599 SWIGRUNTIME PyTypeObject *
1600 SwigPyObject_TypeOnce(void) {
1601 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1603 static PyNumberMethods SwigPyObject_as_number = {
1604 (binaryfunc)0, /*nb_add*/
1605 (binaryfunc)0, /*nb_subtract*/
1606 (binaryfunc)0, /*nb_multiply*/
1607 /* nb_divide removed in Python 3 */
1608 #if PY_VERSION_HEX < 0x03000000
1609 (binaryfunc)0, /*nb_divide*/
1610 #endif
1611 (binaryfunc)0, /*nb_remainder*/
1612 (binaryfunc)0, /*nb_divmod*/
1613 (ternaryfunc)0,/*nb_power*/
1614 (unaryfunc)0, /*nb_negative*/
1615 (unaryfunc)0, /*nb_positive*/
1616 (unaryfunc)0, /*nb_absolute*/
1617 (inquiry)0, /*nb_nonzero*/
1618 0, /*nb_invert*/
1619 0, /*nb_lshift*/
1620 0, /*nb_rshift*/
1621 0, /*nb_and*/
1622 0, /*nb_xor*/
1623 0, /*nb_or*/
1624 #if PY_VERSION_HEX < 0x03000000
1625 0, /*nb_coerce*/
1626 #endif
1627 (unaryfunc)SwigPyObject_long, /*nb_int*/
1628 #if PY_VERSION_HEX < 0x03000000
1629 (unaryfunc)SwigPyObject_long, /*nb_long*/
1630 #else
1631 0, /*nb_reserved*/
1632 #endif
1633 (unaryfunc)0, /*nb_float*/
1634 #if PY_VERSION_HEX < 0x03000000
1635 (unaryfunc)SwigPyObject_oct, /*nb_oct*/
1636 (unaryfunc)SwigPyObject_hex, /*nb_hex*/
1637 #endif
1638 #if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
1639 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
1640 #elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1641 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1642 #else
1643 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_index */
1644 #endif
1647 static PyTypeObject swigpyobject_type;
1648 static int type_init = 0;
1649 if (!type_init) {
1650 const PyTypeObject tmp = {
1651 #if PY_VERSION_HEX >= 0x03000000
1652 PyVarObject_HEAD_INIT(NULL, 0)
1653 #else
1654 PyObject_HEAD_INIT(NULL)
1655 0, /* ob_size */
1656 #endif
1657 "SwigPyObject", /* tp_name */
1658 sizeof(SwigPyObject), /* tp_basicsize */
1659 0, /* tp_itemsize */
1660 (destructor)SwigPyObject_dealloc, /* tp_dealloc */
1661 0, /* tp_print */
1662 (getattrfunc)0, /* tp_getattr */
1663 (setattrfunc)0, /* tp_setattr */
1664 #if PY_VERSION_HEX >= 0x03000000
1665 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1666 #else
1667 (cmpfunc)SwigPyObject_compare, /* tp_compare */
1668 #endif
1669 (reprfunc)SwigPyObject_repr, /* tp_repr */
1670 &SwigPyObject_as_number, /* tp_as_number */
1671 0, /* tp_as_sequence */
1672 0, /* tp_as_mapping */
1673 (hashfunc)0, /* tp_hash */
1674 (ternaryfunc)0, /* tp_call */
1675 0, /* tp_str */
1676 PyObject_GenericGetAttr, /* tp_getattro */
1677 0, /* tp_setattro */
1678 0, /* tp_as_buffer */
1679 Py_TPFLAGS_DEFAULT, /* tp_flags */
1680 swigobject_doc, /* tp_doc */
1681 0, /* tp_traverse */
1682 0, /* tp_clear */
1683 (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
1684 0, /* tp_weaklistoffset */
1685 0, /* tp_iter */
1686 0, /* tp_iternext */
1687 swigobject_methods, /* tp_methods */
1688 0, /* tp_members */
1689 0, /* tp_getset */
1690 0, /* tp_base */
1691 0, /* tp_dict */
1692 0, /* tp_descr_get */
1693 0, /* tp_descr_set */
1694 0, /* tp_dictoffset */
1695 0, /* tp_init */
1696 0, /* tp_alloc */
1697 0, /* tp_new */
1698 0, /* tp_free */
1699 0, /* tp_is_gc */
1700 0, /* tp_bases */
1701 0, /* tp_mro */
1702 0, /* tp_cache */
1703 0, /* tp_subclasses */
1704 0, /* tp_weaklist */
1705 0, /* tp_del */
1706 0, /* tp_version_tag */
1707 #if PY_VERSION_HEX >= 0x03040000
1708 0, /* tp_finalize */
1709 #endif
1710 #ifdef COUNT_ALLOCS
1711 0, /* tp_allocs */
1712 0, /* tp_frees */
1713 0, /* tp_maxalloc */
1714 0, /* tp_prev */
1715 0 /* tp_next */
1716 #endif
1718 swigpyobject_type = tmp;
1719 type_init = 1;
1720 if (PyType_Ready(&swigpyobject_type) < 0)
1721 return NULL;
1723 return &swigpyobject_type;
1726 SWIGRUNTIME PyObject *
1727 SwigPyObject_New(void *ptr, swig_type_info *ty, int own) {
1728 SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1729 if (sobj) {
1730 sobj->ptr = ptr;
1731 sobj->ty = ty;
1732 sobj->own = own;
1733 sobj->next = 0;
1735 return (PyObject *)sobj;
1738 /* -----------------------------------------------------------------------------
1739 * Implements a simple Swig Packed type, and use it instead of string
1740 * ----------------------------------------------------------------------------- */
1742 typedef struct {
1743 PyObject_HEAD
1744 void *pack;
1745 swig_type_info *ty;
1746 size_t size;
1747 } SwigPyPacked;
1749 SWIGRUNTIME PyObject *
1750 SwigPyPacked_repr(SwigPyPacked *v) {
1751 char result[SWIG_BUFFER_SIZE];
1752 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1753 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1754 } else {
1755 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
1759 SWIGRUNTIME PyObject *
1760 SwigPyPacked_str(SwigPyPacked *v) {
1761 char result[SWIG_BUFFER_SIZE];
1762 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1763 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
1764 } else {
1765 return SWIG_Python_str_FromChar(v->ty->name);
1769 SWIGRUNTIME int
1770 SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) {
1771 size_t i = v->size;
1772 size_t j = w->size;
1773 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1774 return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2 * v->size);
1777 SWIGRUNTIME PyTypeObject *SwigPyPacked_TypeOnce(void);
1779 SWIGRUNTIME PyTypeObject *
1780 SwigPyPacked_type(void) {
1781 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
1782 return type;
1785 SWIGRUNTIMEINLINE int
1786 SwigPyPacked_Check(PyObject *op) {
1787 return ((op)->ob_type == SwigPyPacked_TypeOnce())
1788 || (strcmp((op)->ob_type->tp_name, "SwigPyPacked") == 0);
1791 SWIGRUNTIME void
1792 SwigPyPacked_dealloc(PyObject *v) {
1793 if (SwigPyPacked_Check(v)) {
1794 SwigPyPacked *sobj = (SwigPyPacked *) v;
1795 free(sobj->pack);
1797 PyObject_DEL(v);
1800 SWIGRUNTIME PyTypeObject *
1801 SwigPyPacked_TypeOnce(void) {
1802 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
1803 static PyTypeObject swigpypacked_type;
1804 static int type_init = 0;
1805 if (!type_init) {
1806 const PyTypeObject tmp = {
1807 #if PY_VERSION_HEX>=0x03000000
1808 PyVarObject_HEAD_INIT(NULL, 0)
1809 #else
1810 PyObject_HEAD_INIT(NULL)
1811 0, /* ob_size */
1812 #endif
1813 "SwigPyPacked", /* tp_name */
1814 sizeof(SwigPyPacked), /* tp_basicsize */
1815 0, /* tp_itemsize */
1816 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */
1817 0, /* tp_print */
1818 (getattrfunc)0, /* tp_getattr */
1819 (setattrfunc)0, /* tp_setattr */
1820 #if PY_VERSION_HEX>=0x03000000
1821 0, /* tp_reserved in 3.0.1 */
1822 #else
1823 (cmpfunc)SwigPyPacked_compare, /* tp_compare */
1824 #endif
1825 (reprfunc)SwigPyPacked_repr, /* tp_repr */
1826 0, /* tp_as_number */
1827 0, /* tp_as_sequence */
1828 0, /* tp_as_mapping */
1829 (hashfunc)0, /* tp_hash */
1830 (ternaryfunc)0, /* tp_call */
1831 (reprfunc)SwigPyPacked_str, /* tp_str */
1832 PyObject_GenericGetAttr, /* tp_getattro */
1833 0, /* tp_setattro */
1834 0, /* tp_as_buffer */
1835 Py_TPFLAGS_DEFAULT, /* tp_flags */
1836 swigpacked_doc, /* tp_doc */
1837 0, /* tp_traverse */
1838 0, /* tp_clear */
1839 0, /* tp_richcompare */
1840 0, /* tp_weaklistoffset */
1841 0, /* tp_iter */
1842 0, /* tp_iternext */
1843 0, /* tp_methods */
1844 0, /* tp_members */
1845 0, /* tp_getset */
1846 0, /* tp_base */
1847 0, /* tp_dict */
1848 0, /* tp_descr_get */
1849 0, /* tp_descr_set */
1850 0, /* tp_dictoffset */
1851 0, /* tp_init */
1852 0, /* tp_alloc */
1853 0, /* tp_new */
1854 0, /* tp_free */
1855 0, /* tp_is_gc */
1856 0, /* tp_bases */
1857 0, /* tp_mro */
1858 0, /* tp_cache */
1859 0, /* tp_subclasses */
1860 0, /* tp_weaklist */
1861 0, /* tp_del */
1862 0, /* tp_version_tag */
1863 #if PY_VERSION_HEX >= 0x03040000
1864 0, /* tp_finalize */
1865 #endif
1866 #ifdef COUNT_ALLOCS
1867 0, /* tp_allocs */
1868 0, /* tp_frees */
1869 0, /* tp_maxalloc */
1870 0, /* tp_prev */
1871 0 /* tp_next */
1872 #endif
1874 swigpypacked_type = tmp;
1875 type_init = 1;
1876 if (PyType_Ready(&swigpypacked_type) < 0)
1877 return NULL;
1879 return &swigpypacked_type;
1882 SWIGRUNTIME PyObject *
1883 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) {
1884 SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
1885 if (sobj) {
1886 void *pack = malloc(size);
1887 if (pack) {
1888 memcpy(pack, ptr, size);
1889 sobj->pack = pack;
1890 sobj->ty = ty;
1891 sobj->size = size;
1892 } else {
1893 PyObject_DEL((PyObject *) sobj);
1894 sobj = 0;
1897 return (PyObject *) sobj;
1900 SWIGRUNTIME swig_type_info *
1901 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) {
1902 if (SwigPyPacked_Check(obj)) {
1903 SwigPyPacked *sobj = (SwigPyPacked *)obj;
1904 if (sobj->size != size) return 0;
1905 memcpy(ptr, sobj->pack, size);
1906 return sobj->ty;
1907 } else {
1908 return 0;
1912 /* -----------------------------------------------------------------------------
1913 * pointers/data manipulation
1914 * ----------------------------------------------------------------------------- */
1916 static PyObject *Swig_This_global = NULL;
1918 SWIGRUNTIME PyObject *
1919 SWIG_This(void) {
1920 if (Swig_This_global == NULL)
1921 Swig_This_global = SWIG_Python_str_FromChar("this");
1922 return Swig_This_global;
1925 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
1927 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
1928 #if PY_VERSION_HEX>=0x03000000
1929 #define SWIG_PYTHON_SLOW_GETSET_THIS
1930 #endif
1932 SWIGRUNTIME SwigPyObject *
1933 SWIG_Python_GetSwigThis(PyObject *pyobj) {
1934 PyObject *obj;
1936 if (SwigPyObject_Check(pyobj))
1937 return (SwigPyObject *) pyobj;
1939 #ifdef SWIGPYTHON_BUILTIN
1940 (void)obj;
1941 # ifdef PyWeakref_CheckProxy
1942 if (PyWeakref_CheckProxy(pyobj)) {
1943 pyobj = PyWeakref_GET_OBJECT(pyobj);
1944 if (pyobj && SwigPyObject_Check(pyobj))
1945 return (SwigPyObject *) pyobj;
1947 # endif
1948 return NULL;
1949 #else
1951 obj = 0;
1953 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
1954 if (PyInstance_Check(pyobj)) {
1955 obj = _PyInstance_Lookup(pyobj, SWIG_This());
1956 } else {
1957 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
1958 if (dictptr != NULL) {
1959 PyObject *dict = *dictptr;
1960 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
1961 } else {
1962 #ifdef PyWeakref_CheckProxy
1963 if (PyWeakref_CheckProxy(pyobj)) {
1964 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
1965 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
1967 #endif
1968 obj = PyObject_GetAttr(pyobj, SWIG_This());
1969 if (obj) {
1970 Py_DECREF(obj);
1971 } else {
1972 if (PyErr_Occurred()) PyErr_Clear();
1973 return 0;
1977 #else
1978 obj = PyObject_GetAttr(pyobj, SWIG_This());
1979 if (obj) {
1980 Py_DECREF(obj);
1981 } else {
1982 if (PyErr_Occurred()) PyErr_Clear();
1983 return 0;
1985 #endif
1986 if (obj && !SwigPyObject_Check(obj)) {
1987 /* a PyObject is called 'this', try to get the 'real this'
1988 SwigPyObject from it */
1989 return SWIG_Python_GetSwigThis(obj);
1991 return (SwigPyObject *)obj;
1992 #endif
1995 /* Acquire a pointer value */
1997 SWIGRUNTIME int
1998 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
1999 if (own == SWIG_POINTER_OWN) {
2000 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2001 if (sobj) {
2002 int oldown = sobj->own;
2003 sobj->own = own;
2004 return oldown;
2007 return 0;
2010 /* Convert a pointer value */
2012 SWIGRUNTIME int
2013 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2014 int res;
2015 SwigPyObject *sobj;
2016 int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;
2018 if (!obj)
2019 return SWIG_ERROR;
2020 if (obj == Py_None && !implicit_conv) {
2021 if (ptr)
2022 *ptr = 0;
2023 return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
2026 res = SWIG_ERROR;
2028 sobj = SWIG_Python_GetSwigThis(obj);
2029 if (own)
2030 *own = 0;
2031 while (sobj) {
2032 void *vptr = sobj->ptr;
2033 if (ty) {
2034 swig_type_info *to = sobj->ty;
2035 if (to == ty) {
2036 /* no type cast needed */
2037 if (ptr) *ptr = vptr;
2038 break;
2039 } else {
2040 swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
2041 if (!tc) {
2042 sobj = (SwigPyObject *)sobj->next;
2043 } else {
2044 if (ptr) {
2045 int newmemory = 0;
2046 *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
2047 if (newmemory == SWIG_CAST_NEW_MEMORY) {
2048 assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2049 if (own)
2050 *own = *own | SWIG_CAST_NEW_MEMORY;
2053 break;
2056 } else {
2057 if (ptr) *ptr = vptr;
2058 break;
2061 if (sobj) {
2062 if (own)
2063 *own = *own | sobj->own;
2064 if (flags & SWIG_POINTER_DISOWN) {
2065 sobj->own = 0;
2067 res = SWIG_OK;
2068 } else {
2069 if (implicit_conv) {
2070 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2071 if (data && !data->implicitconv) {
2072 PyObject *klass = data->klass;
2073 if (klass) {
2074 PyObject *impconv;
2075 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2076 impconv = SWIG_Python_CallFunctor(klass, obj);
2077 data->implicitconv = 0;
2078 if (PyErr_Occurred()) {
2079 PyErr_Clear();
2080 impconv = 0;
2082 if (impconv) {
2083 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2084 if (iobj) {
2085 void *vptr;
2086 res = SWIG_Python_ConvertPtrAndOwn((PyObject *)iobj, &vptr, ty, 0, 0);
2087 if (SWIG_IsOK(res)) {
2088 if (ptr) {
2089 *ptr = vptr;
2090 /* transfer the ownership to 'ptr' */
2091 iobj->own = 0;
2092 res = SWIG_AddCast(res);
2093 res = SWIG_AddNewMask(res);
2094 } else {
2095 res = SWIG_AddCast(res);
2099 Py_DECREF(impconv);
2103 if (!SWIG_IsOK(res) && obj == Py_None) {
2104 if (ptr)
2105 *ptr = 0;
2106 if (PyErr_Occurred())
2107 PyErr_Clear();
2108 res = SWIG_OK;
2112 return res;
2115 /* Convert a function ptr value */
2117 SWIGRUNTIME int
2118 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2119 if (!PyCFunction_Check(obj)) {
2120 return SWIG_ConvertPtr(obj, ptr, ty, 0);
2121 } else {
2122 void *vptr = 0;
2123 swig_cast_info *tc;
2125 /* here we get the method pointer for callbacks */
2126 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2127 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2128 if (desc)
2129 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2130 if (!desc)
2131 return SWIG_ERROR;
2132 tc = SWIG_TypeCheck(desc, ty);
2133 if (tc) {
2134 int newmemory = 0;
2135 *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
2136 assert(!newmemory); /* newmemory handling not yet implemented */
2137 } else {
2138 return SWIG_ERROR;
2140 return SWIG_OK;
2144 /* Convert a packed pointer value */
2146 SWIGRUNTIME int
2147 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2148 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2149 if (!to) return SWIG_ERROR;
2150 if (ty) {
2151 if (to != ty) {
2152 /* check type cast? */
2153 swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
2154 if (!tc) return SWIG_ERROR;
2157 return SWIG_OK;
2160 /* -----------------------------------------------------------------------------
2161 * Create a new pointer object
2162 * ----------------------------------------------------------------------------- */
2165 Create a new instance object, without calling __init__, and set the
2166 'this' attribute.
2169 SWIGRUNTIME PyObject *
2170 SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) {
2171 PyObject *inst = 0;
2172 PyObject *newraw = data->newraw;
2173 if (newraw) {
2174 inst = PyObject_Call(newraw, data->newargs, NULL);
2175 if (inst) {
2176 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2177 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2178 if (dictptr != NULL) {
2179 PyObject *dict = *dictptr;
2180 if (dict == NULL) {
2181 dict = PyDict_New();
2182 *dictptr = dict;
2183 PyDict_SetItem(dict, SWIG_This(), swig_this);
2186 #else
2187 PyObject *key = SWIG_This();
2188 PyObject_SetAttr(inst, key, swig_this);
2189 #endif
2191 } else {
2192 #if PY_VERSION_HEX >= 0x03000000
2193 PyObject *empty_args = PyTuple_New(0);
2194 if (empty_args) {
2195 PyObject *empty_kwargs = PyDict_New();
2196 if (empty_kwargs) {
2197 inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
2198 Py_DECREF(empty_kwargs);
2199 if (inst) {
2200 PyObject_SetAttr(inst, SWIG_This(), swig_this);
2201 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2204 Py_DECREF(empty_args);
2206 #else
2207 PyObject *dict = PyDict_New();
2208 if (dict) {
2209 PyDict_SetItem(dict, SWIG_This(), swig_this);
2210 inst = PyInstance_NewRaw(data->newargs, dict);
2211 Py_DECREF(dict);
2213 #endif
2215 return inst;
2218 SWIGRUNTIME void
2219 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) {
2220 PyObject *dict;
2221 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2222 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2223 if (dictptr != NULL) {
2224 dict = *dictptr;
2225 if (dict == NULL) {
2226 dict = PyDict_New();
2227 *dictptr = dict;
2229 PyDict_SetItem(dict, SWIG_This(), swig_this);
2230 return;
2232 #endif
2233 dict = PyObject_GetAttrString(inst, "__dict__");
2234 PyDict_SetItem(dict, SWIG_This(), swig_this);
2235 Py_DECREF(dict);
2239 SWIGINTERN PyObject *
2240 SWIG_Python_InitShadowInstance(PyObject *args) {
2241 PyObject *obj[2];
2242 if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
2243 return NULL;
2244 } else {
2245 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2246 if (sthis) {
2247 SwigPyObject_append((PyObject *) sthis, obj[1]);
2248 } else {
2249 SWIG_Python_SetSwigThis(obj[0], obj[1]);
2251 return SWIG_Py_Void();
2255 /* Create a new pointer object */
2257 SWIGRUNTIME PyObject *
2258 SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2259 SwigPyClientData *clientdata;
2260 PyObject *robj;
2261 int own;
2263 if (!ptr)
2264 return SWIG_Py_Void();
2266 clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2267 own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2268 if (clientdata && clientdata->pytype) {
2269 SwigPyObject *newobj;
2270 if (flags & SWIG_BUILTIN_TP_INIT) {
2271 newobj = (SwigPyObject *) self;
2272 if (newobj->ptr) {
2273 PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2274 while (newobj->next)
2275 newobj = (SwigPyObject *) newobj->next;
2276 newobj->next = next_self;
2277 newobj = (SwigPyObject *)next_self;
2278 #ifdef SWIGPYTHON_BUILTIN
2279 newobj->dict = 0;
2280 #endif
2282 } else {
2283 newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2284 #ifdef SWIGPYTHON_BUILTIN
2285 newobj->dict = 0;
2286 #endif
2288 if (newobj) {
2289 newobj->ptr = ptr;
2290 newobj->ty = type;
2291 newobj->own = own;
2292 newobj->next = 0;
2293 return (PyObject *) newobj;
2295 return SWIG_Py_Void();
2298 assert(!(flags & SWIG_BUILTIN_TP_INIT));
2300 robj = SwigPyObject_New(ptr, type, own);
2301 if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2302 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2303 Py_DECREF(robj);
2304 robj = inst;
2306 return robj;
2309 /* Create a new packed object */
2311 SWIGRUNTIMEINLINE PyObject *
2312 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2313 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2316 /* -----------------------------------------------------------------------------*
2317 * Get type list
2318 * -----------------------------------------------------------------------------*/
2320 #ifdef SWIG_LINK_RUNTIME
2321 void *SWIG_ReturnGlobalTypeList(void *);
2322 #endif
2324 SWIGRUNTIME swig_module_info *
2325 SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
2326 static void *type_pointer = (void *)0;
2327 /* first check if module already created */
2328 if (!type_pointer) {
2329 #ifdef SWIG_LINK_RUNTIME
2330 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2331 #else
2332 type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2333 if (PyErr_Occurred()) {
2334 PyErr_Clear();
2335 type_pointer = (void *)0;
2337 #endif
2339 return (swig_module_info *) type_pointer;
2342 SWIGRUNTIME void
2343 SWIG_Python_DestroyModule(PyObject *obj) {
2344 swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2345 swig_type_info **types = swig_module->types;
2346 size_t i;
2347 for (i = 0; i < swig_module->size; ++i) {
2348 swig_type_info *ty = types[i];
2349 if (ty->owndata) {
2350 SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
2351 if (data) SwigPyClientData_Del(data);
2354 Py_DECREF(SWIG_This());
2355 Swig_This_global = NULL;
2358 SWIGRUNTIME void
2359 SWIG_Python_SetModule(swig_module_info *swig_module) {
2360 #if PY_VERSION_HEX >= 0x03000000
2361 /* Add a dummy module object into sys.modules */
2362 PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION);
2363 #else
2364 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2365 PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2366 #endif
2367 PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2368 if (pointer && module) {
2369 PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2370 } else {
2371 Py_XDECREF(pointer);
2375 /* The python cached type query */
2376 SWIGRUNTIME PyObject *
2377 SWIG_Python_TypeCache(void) {
2378 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2379 return cache;
2382 SWIGRUNTIME swig_type_info *
2383 SWIG_Python_TypeQuery(const char *type) {
2384 PyObject *cache = SWIG_Python_TypeCache();
2385 PyObject *key = SWIG_Python_str_FromChar(type);
2386 PyObject *obj = PyDict_GetItem(cache, key);
2387 swig_type_info *descriptor;
2388 if (obj) {
2389 descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2390 } else {
2391 swig_module_info *swig_module = SWIG_GetModule(0);
2392 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2393 if (descriptor) {
2394 obj = PyCapsule_New((void *) descriptor, NULL, NULL);
2395 PyDict_SetItem(cache, key, obj);
2396 Py_DECREF(obj);
2399 Py_DECREF(key);
2400 return descriptor;
2404 For backward compatibility only
2406 #define SWIG_POINTER_EXCEPTION 0
2407 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2408 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2410 SWIGRUNTIME int
2411 SWIG_Python_AddErrMesg(const char *mesg, int infront) {
2412 if (PyErr_Occurred()) {
2413 PyObject *type = 0;
2414 PyObject *value = 0;
2415 PyObject *traceback = 0;
2416 PyErr_Fetch(&type, &value, &traceback);
2417 if (value) {
2418 PyObject *old_str = PyObject_Str(value);
2419 const char *tmp = SWIG_Python_str_AsChar(old_str);
2420 const char *errmesg = tmp ? tmp : "Invalid error message";
2421 Py_XINCREF(type);
2422 PyErr_Clear();
2423 if (infront) {
2424 PyErr_Format(type, "%s %s", mesg, errmesg);
2425 } else {
2426 PyErr_Format(type, "%s %s", errmesg, mesg);
2428 SWIG_Python_str_DelForPy3(tmp);
2429 Py_DECREF(old_str);
2431 return 1;
2432 } else {
2433 return 0;
2437 SWIGRUNTIME int
2438 SWIG_Python_ArgFail(int argnum) {
2439 if (PyErr_Occurred()) {
2440 /* add information about failing argument */
2441 char mesg[256];
2442 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2443 return SWIG_Python_AddErrMesg(mesg, 1);
2444 } else {
2445 return 0;
2449 SWIGRUNTIMEINLINE const char *
2450 SwigPyObject_GetDesc(PyObject *self) {
2451 SwigPyObject *v = (SwigPyObject *)self;
2452 swig_type_info *ty = v ? v->ty : 0;
2453 return ty ? ty->str : "";
2456 SWIGRUNTIME void
2457 SWIG_Python_TypeError(const char *type, PyObject *obj) {
2458 if (type) {
2459 #if defined(SWIG_COBJECT_TYPES)
2460 if (obj && SwigPyObject_Check(obj)) {
2461 const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2462 if (otype) {
2463 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2464 type, otype);
2465 return;
2467 } else
2468 #endif
2470 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2471 if (otype) {
2472 PyObject *str = PyObject_Str(obj);
2473 const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2474 if (cstr) {
2475 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2476 type, otype, cstr);
2477 SWIG_Python_str_DelForPy3(cstr);
2478 } else {
2479 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2480 type, otype);
2482 Py_XDECREF(str);
2483 return;
2486 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2487 } else {
2488 PyErr_Format(PyExc_TypeError, "unexpected type is received");
2493 /* Convert a pointer value, signal an exception on a type mismatch */
2494 SWIGRUNTIME void *
2495 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
2496 void *result;
2497 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2498 PyErr_Clear();
2499 #if SWIG_POINTER_EXCEPTION
2500 if (flags) {
2501 SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2502 SWIG_Python_ArgFail(argnum);
2504 #endif
2506 return result;
2509 #ifdef SWIGPYTHON_BUILTIN
2510 SWIGRUNTIME int
2511 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
2512 PyTypeObject *tp = obj->ob_type;
2513 PyObject *descr;
2514 PyObject *encoded_name;
2515 descrsetfunc f;
2516 int res = -1;
2518 # ifdef Py_USING_UNICODE
2519 if (PyString_Check(name)) {
2520 name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2521 if (!name)
2522 return -1;
2523 } else if (!PyUnicode_Check(name))
2524 # else
2525 if (!PyString_Check(name))
2526 # endif
2528 PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2529 return -1;
2530 } else {
2531 Py_INCREF(name);
2534 if (!tp->tp_dict) {
2535 if (PyType_Ready(tp) < 0)
2536 goto done;
2539 descr = _PyType_Lookup(tp, name);
2540 f = NULL;
2541 if (descr != NULL)
2542 f = descr->ob_type->tp_descr_set;
2543 if (!f) {
2544 if (PyString_Check(name)) {
2545 encoded_name = name;
2546 Py_INCREF(name);
2547 } else {
2548 encoded_name = PyUnicode_AsUTF8String(name);
2549 if (!encoded_name)
2550 return -1;
2552 PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2553 Py_DECREF(encoded_name);
2554 } else {
2555 res = f(descr, obj, value);
2558 done:
2559 Py_DECREF(name);
2560 return res;
2562 #endif
2565 #ifdef __cplusplus
2567 #endif
2571 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2573 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2577 #ifdef __cplusplus
2578 extern "C" {
2579 #endif
2581 /* Method creation and docstring support functions */
2583 SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name);
2584 SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
2585 SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
2587 #ifdef __cplusplus
2589 #endif
2592 /* -------- TYPES TABLE (BEGIN) -------- */
2594 #define SWIGTYPE_p_char swig_types[0]
2595 #define SWIGTYPE_p_pm3 swig_types[1]
2596 static swig_type_info *swig_types[3];
2597 static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
2598 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2599 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2601 /* -------- TYPES TABLE (END) -------- */
2603 #ifdef SWIG_TypeQuery
2604 # undef SWIG_TypeQuery
2605 #endif
2606 #define SWIG_TypeQuery SWIG_Python_TypeQuery
2608 /*-----------------------------------------------
2609 @(target):= _pm3.so
2610 ------------------------------------------------*/
2611 #if PY_VERSION_HEX >= 0x03000000
2612 # define SWIG_init PyInit__pm3
2614 #else
2615 # define SWIG_init init_pm3
2617 #endif
2618 #define SWIG_name "_pm3"
2620 #define SWIGVERSION 0x040001
2621 #define SWIG_VERSION SWIGVERSION
2624 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
2625 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
2628 /* Include the header in the wrapper code */
2629 #include "pm3.h"
2630 #include "comms.h"
2632 SWIGINTERN pm3 *new_pm3__SWIG_0(void) {
2633 // printf("SWIG pm3 constructor, get current pm3\n");
2634 pm3_device *p = pm3_get_current_dev();
2635 p->script_embedded = 1;
2636 return p;
2639 SWIGINTERN swig_type_info *
2640 SWIG_pchar_descriptor(void) {
2641 static int init = 0;
2642 static swig_type_info *info = 0;
2643 if (!init) {
2644 info = SWIG_TypeQuery("_p_char");
2645 init = 1;
2647 return info;
2651 SWIGINTERN int
2652 SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) {
2653 #if PY_VERSION_HEX>=0x03000000
2654 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2655 if (PyBytes_Check(obj))
2656 #else
2657 if (PyUnicode_Check(obj))
2658 #endif
2659 #else
2660 if (PyString_Check(obj))
2661 #endif
2663 char *cstr;
2664 Py_ssize_t len;
2665 int ret = SWIG_OK;
2666 #if PY_VERSION_HEX>=0x03000000
2667 #if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2668 if (!alloc && cptr) {
2669 /* We can't allow converting without allocation, since the internal
2670 representation of string in Python 3 is UCS-2/UCS-4 but we require
2671 a UTF-8 representation.
2672 TODO(bhy) More detailed explanation */
2673 return SWIG_RuntimeError;
2675 obj = PyUnicode_AsUTF8String(obj);
2676 if (!obj)
2677 return SWIG_TypeError;
2678 if (alloc)
2679 *alloc = SWIG_NEWOBJ;
2680 #endif
2681 PyBytes_AsStringAndSize(obj, &cstr, &len);
2682 #else
2683 PyString_AsStringAndSize(obj, &cstr, &len);
2684 #endif
2685 if (cptr) {
2686 if (alloc) {
2687 if (*alloc == SWIG_NEWOBJ) {
2688 *cptr = (char *)memcpy(malloc((len + 1) * sizeof(char)), cstr, sizeof(char) * (len + 1));
2689 *alloc = SWIG_NEWOBJ;
2690 } else {
2691 *cptr = cstr;
2692 *alloc = SWIG_OLDOBJ;
2694 } else {
2695 #if PY_VERSION_HEX>=0x03000000
2696 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2697 *cptr = PyBytes_AsString(obj);
2698 #else
2699 assert(0); /* Should never reach here with Unicode strings in Python 3 */
2700 #endif
2701 #else
2702 *cptr = SWIG_Python_str_AsChar(obj);
2703 if (!*cptr)
2704 ret = SWIG_TypeError;
2705 #endif
2708 if (psize) *psize = len + 1;
2709 #if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2710 Py_XDECREF(obj);
2711 #endif
2712 return ret;
2713 } else {
2714 #if defined(SWIG_PYTHON_2_UNICODE)
2715 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2716 #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
2717 #endif
2718 #if PY_VERSION_HEX<0x03000000
2719 if (PyUnicode_Check(obj)) {
2720 char *cstr;
2721 Py_ssize_t len;
2722 if (!alloc && cptr) {
2723 return SWIG_RuntimeError;
2725 obj = PyUnicode_AsUTF8String(obj);
2726 if (!obj)
2727 return SWIG_TypeError;
2728 if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
2729 if (cptr) {
2730 if (alloc) *alloc = SWIG_NEWOBJ;
2731 *cptr = (char *)memcpy(malloc((len + 1) * sizeof(char)), cstr, sizeof(char) * (len + 1));
2733 if (psize) *psize = len + 1;
2735 Py_XDECREF(obj);
2736 return SWIG_OK;
2737 } else {
2738 Py_XDECREF(obj);
2741 #endif
2742 #endif
2744 swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
2745 if (pchar_descriptor) {
2746 void *vptr = 0;
2747 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
2748 if (cptr) *cptr = (char *) vptr;
2749 if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
2750 if (alloc) *alloc = SWIG_OLDOBJ;
2751 return SWIG_OK;
2755 return SWIG_TypeError;
2761 SWIGINTERN pm3 *new_pm3__SWIG_1(char *port) {
2762 // printf("SWIG pm3 constructor with port, open pm3\n");
2763 pm3_device *p = pm3_open(port);
2764 p->script_embedded = 0;
2765 return p;
2767 SWIGINTERN void delete_pm3(pm3 *self) {
2768 if (self->script_embedded) {
2769 // printf("SWIG pm3 destructor, nothing to do\n");
2770 } else {
2771 // printf("SWIG pm3 destructor, close pm3\n");
2772 pm3_close(self);
2776 SWIGINTERNINLINE PyObject *
2777 SWIG_From_int(int value) {
2778 return PyInt_FromLong((long) value);
2782 SWIGINTERNINLINE PyObject *
2783 SWIG_FromCharPtrAndSize(const char *carray, size_t size) {
2784 if (carray) {
2785 if (size > INT_MAX) {
2786 swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
2787 return pchar_descriptor ?
2788 SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
2789 } else {
2790 #if PY_VERSION_HEX >= 0x03000000
2791 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2792 return PyBytes_FromStringAndSize(carray, (Py_ssize_t)(size));
2793 #else
2794 return PyUnicode_DecodeUTF8(carray, (Py_ssize_t)(size), "surrogateescape");
2795 #endif
2796 #else
2797 return PyString_FromStringAndSize(carray, (Py_ssize_t)(size));
2798 #endif
2800 } else {
2801 return SWIG_Py_Void();
2806 SWIGINTERNINLINE PyObject *
2807 SWIG_FromCharPtr(const char *cptr) {
2808 return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
2811 #ifdef __cplusplus
2812 extern "C" {
2813 #endif
2814 SWIGINTERN PyObject *_wrap_new_pm3__SWIG_0(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
2815 PyObject *resultobj = 0;
2816 pm3 *result = 0 ;
2818 if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
2819 result = (pm3 *)new_pm3__SWIG_0();
2820 resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pm3, SWIG_POINTER_NEW | 0);
2821 return resultobj;
2822 fail:
2823 return NULL;
2827 SWIGINTERN PyObject *_wrap_new_pm3__SWIG_1(PyObject *SWIGUNUSEDPARM(self), Py_ssize_t nobjs, PyObject **swig_obj) {
2828 PyObject *resultobj = 0;
2829 char *arg1 = (char *) 0 ;
2830 int res1 ;
2831 char *buf1 = 0 ;
2832 int alloc1 = 0 ;
2833 pm3 *result = 0 ;
2835 if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
2836 res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
2837 if (!SWIG_IsOK(res1)) {
2838 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_pm3" "', argument " "1"" of type '" "char *""'");
2840 arg1 = (char *)(buf1);
2841 result = (pm3 *)new_pm3__SWIG_1(arg1);
2842 resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pm3, SWIG_POINTER_NEW | 0);
2843 if (alloc1 == SWIG_NEWOBJ) free((char *)buf1);
2844 return resultobj;
2845 fail:
2846 if (alloc1 == SWIG_NEWOBJ) free((char *)buf1);
2847 return NULL;
2851 SWIGINTERN PyObject *_wrap_new_pm3(PyObject *self, PyObject *args) {
2852 Py_ssize_t argc;
2853 PyObject *argv[2] = {
2857 if (!(argc = SWIG_Python_UnpackTuple(args, "new_pm3", 0, 1, argv))) SWIG_fail;
2858 --argc;
2859 if (argc == 0) {
2860 return _wrap_new_pm3__SWIG_0(self, argc, argv);
2862 if (argc == 1) {
2863 int _v;
2864 int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2865 _v = SWIG_CheckState(res);
2866 if (_v) {
2867 return _wrap_new_pm3__SWIG_1(self, argc, argv);
2871 fail:
2872 SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_pm3'.\n"
2873 " Possible C/C++ prototypes are:\n"
2874 " pm3::pm3()\n"
2875 " pm3::pm3(char *)\n");
2876 return 0;
2880 SWIGINTERN PyObject *_wrap_delete_pm3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2881 PyObject *resultobj = 0;
2882 pm3 *arg1 = (pm3 *) 0 ;
2883 void *argp1 = 0 ;
2884 int res1 = 0 ;
2885 PyObject *swig_obj[1] ;
2887 if (!args) SWIG_fail;
2888 swig_obj[0] = args;
2889 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_pm3, SWIG_POINTER_DISOWN | 0);
2890 if (!SWIG_IsOK(res1)) {
2891 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_pm3" "', argument " "1"" of type '" "pm3 *""'");
2893 arg1 = (pm3 *)(argp1);
2894 delete_pm3(arg1);
2895 resultobj = SWIG_Py_Void();
2896 return resultobj;
2897 fail:
2898 return NULL;
2902 SWIGINTERN PyObject *_wrap_pm3_console(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2903 PyObject *resultobj = 0;
2904 pm3 *arg1 = (pm3 *) 0 ;
2905 char *arg2 = (char *) 0 ;
2906 void *argp1 = 0 ;
2907 int res1 = 0 ;
2908 int res2 ;
2909 char *buf2 = 0 ;
2910 int alloc2 = 0 ;
2911 PyObject *swig_obj[2] ;
2912 int result;
2914 if (!SWIG_Python_UnpackTuple(args, "pm3_console", 2, 2, swig_obj)) SWIG_fail;
2915 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_pm3, 0 | 0);
2916 if (!SWIG_IsOK(res1)) {
2917 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm3_console" "', argument " "1"" of type '" "pm3 *""'");
2919 arg1 = (pm3 *)(argp1);
2920 res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
2921 if (!SWIG_IsOK(res2)) {
2922 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pm3_console" "', argument " "2"" of type '" "char *""'");
2924 arg2 = (char *)(buf2);
2925 result = (int)pm3_console(arg1, arg2);
2926 resultobj = SWIG_From_int((int)(result));
2927 if (alloc2 == SWIG_NEWOBJ) free((char *)buf2);
2928 return resultobj;
2929 fail:
2930 if (alloc2 == SWIG_NEWOBJ) free((char *)buf2);
2931 return NULL;
2935 SWIGINTERN PyObject *_wrap_pm3_name_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2936 PyObject *resultobj = 0;
2937 pm3 *arg1 = (pm3 *) 0 ;
2938 void *argp1 = 0 ;
2939 int res1 = 0 ;
2940 PyObject *swig_obj[1] ;
2941 char *result = 0 ;
2943 if (!args) SWIG_fail;
2944 swig_obj[0] = args;
2945 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_pm3, 0 | 0);
2946 if (!SWIG_IsOK(res1)) {
2947 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm3_name_get" "', argument " "1"" of type '" "pm3 *""'");
2949 arg1 = (pm3 *)(argp1);
2950 result = (char *)pm3_name_get(arg1);
2951 resultobj = SWIG_FromCharPtr((const char *)result);
2952 return resultobj;
2953 fail:
2954 return NULL;
2958 SWIGINTERN PyObject *pm3_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2959 PyObject *obj;
2960 if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
2961 SWIG_TypeNewClientData(SWIGTYPE_p_pm3, SWIG_NewClientData(obj));
2962 return SWIG_Py_Void();
2965 SWIGINTERN PyObject *pm3_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2966 return SWIG_Python_InitShadowInstance(args);
2969 static PyMethodDef SwigMethods[] = {
2970 { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
2971 { "new_pm3", _wrap_new_pm3, METH_VARARGS, NULL},
2972 { "delete_pm3", _wrap_delete_pm3, METH_O, NULL},
2973 { "pm3_console", _wrap_pm3_console, METH_VARARGS, NULL},
2974 { "pm3_name_get", _wrap_pm3_name_get, METH_O, NULL},
2975 { "pm3_swigregister", pm3_swigregister, METH_O, NULL},
2976 { "pm3_swiginit", pm3_swiginit, METH_VARARGS, NULL},
2977 { NULL, NULL, 0, NULL }
2980 static PyMethodDef SwigMethods_proxydocs[] = {
2981 { NULL, NULL, 0, NULL }
2985 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2987 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void *)0, 0};
2988 static swig_type_info _swigt__p_pm3 = {"_p_pm3", "pm3 *", 0, 0, (void *)0, 0};
2990 static swig_type_info *swig_type_initial[] = {
2991 &_swigt__p_char,
2992 &_swigt__p_pm3,
2995 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0}};
2996 static swig_cast_info _swigc__p_pm3[] = { {&_swigt__p_pm3, 0, 0, 0}, {0, 0, 0, 0}};
2998 static swig_cast_info *swig_cast_initial[] = {
2999 _swigc__p_char,
3000 _swigc__p_pm3,
3004 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3006 static swig_const_info swig_const_table[] = {
3007 {0, 0, 0, 0.0, 0, 0}
3010 #ifdef __cplusplus
3012 #endif
3013 /* -----------------------------------------------------------------------------
3014 * Type initialization:
3015 * This problem is tough by the requirement that no dynamic
3016 * memory is used. Also, since swig_type_info structures store pointers to
3017 * swig_cast_info structures and swig_cast_info structures store pointers back
3018 * to swig_type_info structures, we need some lookup code at initialization.
3019 * The idea is that swig generates all the structures that are needed.
3020 * The runtime then collects these partially filled structures.
3021 * The SWIG_InitializeModule function takes these initial arrays out of
3022 * swig_module, and does all the lookup, filling in the swig_module.types
3023 * array with the correct data and linking the correct swig_cast_info
3024 * structures together.
3026 * The generated swig_type_info structures are assigned statically to an initial
3027 * array. We just loop through that array, and handle each type individually.
3028 * First we lookup if this type has been already loaded, and if so, use the
3029 * loaded structure instead of the generated one. Then we have to fill in the
3030 * cast linked list. The cast data is initially stored in something like a
3031 * two-dimensional array. Each row corresponds to a type (there are the same
3032 * number of rows as there are in the swig_type_initial array). Each entry in
3033 * a column is one of the swig_cast_info structures for that type.
3034 * The cast_initial array is actually an array of arrays, because each row has
3035 * a variable number of columns. So to actually build the cast linked list,
3036 * we find the array of casts associated with the type, and loop through it
3037 * adding the casts to the list. The one last trick we need to do is making
3038 * sure the type pointer in the swig_cast_info struct is correct.
3040 * First off, we lookup the cast->type name to see if it is already loaded.
3041 * There are three cases to handle:
3042 * 1) If the cast->type has already been loaded AND the type we are adding
3043 * casting info to has not been loaded (it is in this module), THEN we
3044 * replace the cast->type pointer with the type pointer that has already
3045 * been loaded.
3046 * 2) If BOTH types (the one we are adding casting info to, and the
3047 * cast->type) are loaded, THEN the cast info has already been loaded by
3048 * the previous module so we just ignore it.
3049 * 3) Finally, if cast->type has not already been loaded, then we add that
3050 * swig_cast_info to the linked list (because the cast->type) pointer will
3051 * be correct.
3052 * ----------------------------------------------------------------------------- */
3054 #ifdef __cplusplus
3055 extern "C" {
3056 #if 0
3057 } /* c-mode */
3058 #endif
3059 #endif
3061 #if 0
3062 #define SWIGRUNTIME_DEBUG
3063 #endif
3066 SWIGRUNTIME void
3067 SWIG_InitializeModule(void *clientdata) {
3068 size_t i;
3069 swig_module_info *module_head, *iter;
3070 int init;
3072 /* check to see if the circular list has been setup, if not, set it up */
3073 if (swig_module.next == 0) {
3074 /* Initialize the swig_module */
3075 swig_module.type_initial = swig_type_initial;
3076 swig_module.cast_initial = swig_cast_initial;
3077 swig_module.next = &swig_module;
3078 init = 1;
3079 } else {
3080 init = 0;
3083 /* Try and load any already created modules */
3084 module_head = SWIG_GetModule(clientdata);
3085 if (!module_head) {
3086 /* This is the first module loaded for this interpreter */
3087 /* so set the swig module into the interpreter */
3088 SWIG_SetModule(clientdata, &swig_module);
3089 } else {
3090 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3091 iter = module_head;
3092 do {
3093 if (iter == &swig_module) {
3094 /* Our module is already in the list, so there's nothing more to do. */
3095 return;
3097 iter = iter->next;
3098 } while (iter != module_head);
3100 /* otherwise we must add our module into the list */
3101 swig_module.next = module_head->next;
3102 module_head->next = &swig_module;
3105 /* When multiple interpreters are used, a module could have already been initialized in
3106 a different interpreter, but not yet have a pointer in this interpreter.
3107 In this case, we do not want to continue adding types... everything should be
3108 set up already */
3109 if (init == 0) return;
3111 /* Now work on filling in swig_module.types */
3112 #ifdef SWIGRUNTIME_DEBUG
3113 printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
3114 #endif
3115 for (i = 0; i < swig_module.size; ++i) {
3116 swig_type_info *type = 0;
3117 swig_type_info *ret;
3118 swig_cast_info *cast;
3120 #ifdef SWIGRUNTIME_DEBUG
3121 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3122 #endif
3124 /* if there is another module already loaded */
3125 if (swig_module.next != &swig_module) {
3126 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3128 if (type) {
3129 /* Overwrite clientdata field */
3130 #ifdef SWIGRUNTIME_DEBUG
3131 printf("SWIG_InitializeModule: found type %s\n", type->name);
3132 #endif
3133 if (swig_module.type_initial[i]->clientdata) {
3134 type->clientdata = swig_module.type_initial[i]->clientdata;
3135 #ifdef SWIGRUNTIME_DEBUG
3136 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3137 #endif
3139 } else {
3140 type = swig_module.type_initial[i];
3143 /* Insert casting types */
3144 cast = swig_module.cast_initial[i];
3145 while (cast->type) {
3146 /* Don't need to add information already in the list */
3147 ret = 0;
3148 #ifdef SWIGRUNTIME_DEBUG
3149 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3150 #endif
3151 if (swig_module.next != &swig_module) {
3152 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3153 #ifdef SWIGRUNTIME_DEBUG
3154 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3155 #endif
3157 if (ret) {
3158 if (type == swig_module.type_initial[i]) {
3159 #ifdef SWIGRUNTIME_DEBUG
3160 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3161 #endif
3162 cast->type = ret;
3163 ret = 0;
3164 } else {
3165 /* Check for casting already in the list */
3166 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3167 #ifdef SWIGRUNTIME_DEBUG
3168 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3169 #endif
3170 if (!ocast) ret = 0;
3174 if (!ret) {
3175 #ifdef SWIGRUNTIME_DEBUG
3176 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3177 #endif
3178 if (type->cast) {
3179 type->cast->prev = cast;
3180 cast->next = type->cast;
3182 type->cast = cast;
3184 cast++;
3186 /* Set entry in modules->types array equal to the type */
3187 swig_module.types[i] = type;
3189 swig_module.types[i] = 0;
3191 #ifdef SWIGRUNTIME_DEBUG
3192 printf("**** SWIG_InitializeModule: Cast List ******\n");
3193 for (i = 0; i < swig_module.size; ++i) {
3194 int j = 0;
3195 swig_cast_info *cast = swig_module.cast_initial[i];
3196 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3197 while (cast->type) {
3198 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3199 cast++;
3200 ++j;
3202 printf("---- Total casts: %d\n", j);
3204 printf("**** SWIG_InitializeModule: Cast List ******\n");
3205 #endif
3208 /* This function will propagate the clientdata field of type to
3209 * any new swig_type_info structures that have been added into the list
3210 * of equivalent types. It is like calling
3211 * SWIG_TypeClientData(type, clientdata) a second time.
3213 SWIGRUNTIME void
3214 SWIG_PropagateClientData(void) {
3215 size_t i;
3216 swig_cast_info *equiv;
3217 static int init_run = 0;
3219 if (init_run) return;
3220 init_run = 1;
3222 for (i = 0; i < swig_module.size; i++) {
3223 if (swig_module.types[i]->clientdata) {
3224 equiv = swig_module.types[i]->cast;
3225 while (equiv) {
3226 if (!equiv->converter) {
3227 if (equiv->type && !equiv->type->clientdata)
3228 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3230 equiv = equiv->next;
3236 #ifdef __cplusplus
3237 #if 0
3239 /* c-mode */
3240 #endif
3242 #endif
3246 #ifdef __cplusplus
3247 extern "C" {
3248 #endif
3250 /* Python-specific SWIG API */
3251 #define SWIG_newvarlink() SWIG_Python_newvarlink()
3252 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
3253 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
3255 /* -----------------------------------------------------------------------------
3256 * global variable support code.
3257 * ----------------------------------------------------------------------------- */
3259 typedef struct swig_globalvar {
3260 char *name; /* Name of global variable */
3261 PyObject *(*get_attr)(void); /* Return the current value */
3262 int (*set_attr)(PyObject *); /* Set the value */
3263 struct swig_globalvar *next;
3264 } swig_globalvar;
3266 typedef struct swig_varlinkobject {
3267 PyObject_HEAD
3268 swig_globalvar *vars;
3269 } swig_varlinkobject;
3271 SWIGINTERN PyObject *
3272 swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
3273 #if PY_VERSION_HEX >= 0x03000000
3274 return PyUnicode_InternFromString("<Swig global variables>");
3275 #else
3276 return PyString_FromString("<Swig global variables>");
3277 #endif
3280 SWIGINTERN PyObject *
3281 swig_varlink_str(swig_varlinkobject *v) {
3282 #if PY_VERSION_HEX >= 0x03000000
3283 PyObject *str = PyUnicode_InternFromString("(");
3284 PyObject *tail;
3285 PyObject *joined;
3286 swig_globalvar *var;
3287 for (var = v->vars; var; var = var->next) {
3288 tail = PyUnicode_FromString(var->name);
3289 joined = PyUnicode_Concat(str, tail);
3290 Py_DecRef(str);
3291 Py_DecRef(tail);
3292 str = joined;
3293 if (var->next) {
3294 tail = PyUnicode_InternFromString(", ");
3295 joined = PyUnicode_Concat(str, tail);
3296 Py_DecRef(str);
3297 Py_DecRef(tail);
3298 str = joined;
3301 tail = PyUnicode_InternFromString(")");
3302 joined = PyUnicode_Concat(str, tail);
3303 Py_DecRef(str);
3304 Py_DecRef(tail);
3305 str = joined;
3306 #else
3307 PyObject *str = PyString_FromString("(");
3308 swig_globalvar *var;
3309 for (var = v->vars; var; var = var->next) {
3310 PyString_ConcatAndDel(&str, PyString_FromString(var->name));
3311 if (var->next) PyString_ConcatAndDel(&str, PyString_FromString(", "));
3313 PyString_ConcatAndDel(&str, PyString_FromString(")"));
3314 #endif
3315 return str;
3318 SWIGINTERN void
3319 swig_varlink_dealloc(swig_varlinkobject *v) {
3320 swig_globalvar *var = v->vars;
3321 while (var) {
3322 swig_globalvar *n = var->next;
3323 free(var->name);
3324 free(var);
3325 var = n;
3329 SWIGINTERN PyObject *
3330 swig_varlink_getattr(swig_varlinkobject *v, char *n) {
3331 PyObject *res = NULL;
3332 swig_globalvar *var = v->vars;
3333 while (var) {
3334 if (strcmp(var->name, n) == 0) {
3335 res = (*var->get_attr)();
3336 break;
3338 var = var->next;
3340 if (res == NULL && !PyErr_Occurred()) {
3341 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
3343 return res;
3346 SWIGINTERN int
3347 swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
3348 int res = 1;
3349 swig_globalvar *var = v->vars;
3350 while (var) {
3351 if (strcmp(var->name, n) == 0) {
3352 res = (*var->set_attr)(p);
3353 break;
3355 var = var->next;
3357 if (res == 1 && !PyErr_Occurred()) {
3358 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
3360 return res;
3363 SWIGINTERN PyTypeObject *
3364 swig_varlink_type(void) {
3365 static char varlink__doc__[] = "Swig var link object";
3366 static PyTypeObject varlink_type;
3367 static int type_init = 0;
3368 if (!type_init) {
3369 const PyTypeObject tmp = {
3370 #if PY_VERSION_HEX >= 0x03000000
3371 PyVarObject_HEAD_INIT(NULL, 0)
3372 #else
3373 PyObject_HEAD_INIT(NULL)
3374 0, /* ob_size */
3375 #endif
3376 "swigvarlink", /* tp_name */
3377 sizeof(swig_varlinkobject), /* tp_basicsize */
3378 0, /* tp_itemsize */
3379 (destructor) swig_varlink_dealloc, /* tp_dealloc */
3380 0, /* tp_print */
3381 (getattrfunc) swig_varlink_getattr, /* tp_getattr */
3382 (setattrfunc) swig_varlink_setattr, /* tp_setattr */
3383 0, /* tp_compare */
3384 (reprfunc) swig_varlink_repr, /* tp_repr */
3385 0, /* tp_as_number */
3386 0, /* tp_as_sequence */
3387 0, /* tp_as_mapping */
3388 0, /* tp_hash */
3389 0, /* tp_call */
3390 (reprfunc) swig_varlink_str, /* tp_str */
3391 0, /* tp_getattro */
3392 0, /* tp_setattro */
3393 0, /* tp_as_buffer */
3394 0, /* tp_flags */
3395 varlink__doc__, /* tp_doc */
3396 0, /* tp_traverse */
3397 0, /* tp_clear */
3398 0, /* tp_richcompare */
3399 0, /* tp_weaklistoffset */
3400 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* tp_iter -> tp_weaklist */
3401 0, /* tp_del */
3402 0, /* tp_version_tag */
3403 #if PY_VERSION_HEX >= 0x03040000
3404 0, /* tp_finalize */
3405 #endif
3406 #ifdef COUNT_ALLOCS
3407 0, /* tp_allocs */
3408 0, /* tp_frees */
3409 0, /* tp_maxalloc */
3410 0, /* tp_prev */
3411 0 /* tp_next */
3412 #endif
3414 varlink_type = tmp;
3415 type_init = 1;
3416 if (PyType_Ready(&varlink_type) < 0)
3417 return NULL;
3419 return &varlink_type;
3422 /* Create a variable linking object for use later */
3423 SWIGINTERN PyObject *
3424 SWIG_Python_newvarlink(void) {
3425 swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
3426 if (result) {
3427 result->vars = 0;
3429 return ((PyObject *) result);
3432 SWIGINTERN void
3433 SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject * (*get_attr)(void), int (*set_attr)(PyObject *p)) {
3434 swig_varlinkobject *v = (swig_varlinkobject *) p;
3435 swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
3436 if (gv) {
3437 size_t size = strlen(name) + 1;
3438 gv->name = (char *)malloc(size);
3439 if (gv->name) {
3440 memcpy(gv->name, name, size);
3441 gv->get_attr = get_attr;
3442 gv->set_attr = set_attr;
3443 gv->next = v->vars;
3446 v->vars = gv;
3449 SWIGINTERN PyObject *
3450 SWIG_globals(void) {
3451 static PyObject *globals = 0;
3452 if (!globals) {
3453 globals = SWIG_newvarlink();
3455 return globals;
3458 /* -----------------------------------------------------------------------------
3459 * constants/methods manipulation
3460 * ----------------------------------------------------------------------------- */
3462 /* Install Constants */
3463 SWIGINTERN void
3464 SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
3465 PyObject *obj = 0;
3466 size_t i;
3467 for (i = 0; constants[i].type; ++i) {
3468 switch (constants[i].type) {
3469 case SWIG_PY_POINTER:
3470 obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype, 0);
3471 break;
3472 case SWIG_PY_BINARY:
3473 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
3474 break;
3475 default:
3476 obj = 0;
3477 break;
3479 if (obj) {
3480 PyDict_SetItemString(d, constants[i].name, obj);
3481 Py_DECREF(obj);
3486 /* -----------------------------------------------------------------------------*/
3487 /* Fix SwigMethods to carry the callback ptrs when needed */
3488 /* -----------------------------------------------------------------------------*/
3490 SWIGINTERN void
3491 SWIG_Python_FixMethods(PyMethodDef *methods,
3492 swig_const_info *const_table,
3493 swig_type_info **types,
3494 swig_type_info **types_initial) {
3495 size_t i;
3496 for (i = 0; methods[i].ml_name; ++i) {
3497 const char *c = methods[i].ml_doc;
3498 if (!c) continue;
3499 c = strstr(c, "swig_ptr: ");
3500 if (c) {
3501 int j;
3502 swig_const_info *ci = 0;
3503 const char *name = c + 10;
3504 for (j = 0; const_table[j].type; ++j) {
3505 if (strncmp(const_table[j].name, name,
3506 strlen(const_table[j].name)) == 0) {
3507 ci = &(const_table[j]);
3508 break;
3511 if (ci) {
3512 void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
3513 if (ptr) {
3514 size_t shift = (ci->ptype) - types;
3515 swig_type_info *ty = types_initial[shift];
3516 size_t ldoc = (c - methods[i].ml_doc);
3517 size_t lptr = strlen(ty->name) + 2 * sizeof(void *) +2;
3518 char *ndoc = (char *)malloc(ldoc + lptr + 10);
3519 if (ndoc) {
3520 char *buff = ndoc;
3521 memcpy(buff, methods[i].ml_doc, ldoc);
3522 buff += ldoc;
3523 memcpy(buff, "swig_ptr: ", 10);
3524 buff += 10;
3525 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
3526 methods[i].ml_doc = ndoc;
3534 /* -----------------------------------------------------------------------------
3535 * Method creation and docstring support functions
3536 * ----------------------------------------------------------------------------- */
3538 /* -----------------------------------------------------------------------------
3539 * Function to find the method definition with the correct docstring for the
3540 * proxy module as opposed to the low-level API
3541 * ----------------------------------------------------------------------------- */
3543 SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) {
3544 /* Find the function in the modified method table */
3545 size_t offset = 0;
3546 int found = 0;
3547 while (SwigMethods_proxydocs[offset].ml_meth != NULL) {
3548 if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) {
3549 found = 1;
3550 break;
3552 offset++;
3554 /* Use the copy with the modified docstring if available */
3555 return found ? &SwigMethods_proxydocs[offset] : NULL;
3558 /* -----------------------------------------------------------------------------
3559 * Wrapper of PyInstanceMethod_New() used in Python 3
3560 * It is exported to the generated module, used for -fastproxy
3561 * ----------------------------------------------------------------------------- */
3563 SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
3564 if (PyCFunction_Check(func)) {
3565 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
3566 PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
3567 if (ml)
3568 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
3570 #if PY_VERSION_HEX >= 0x03000000
3571 return PyInstanceMethod_New(func);
3572 #else
3573 return PyMethod_New(func, NULL, NULL);
3574 #endif
3577 /* -----------------------------------------------------------------------------
3578 * Wrapper of PyStaticMethod_New()
3579 * It is exported to the generated module, used for -fastproxy
3580 * ----------------------------------------------------------------------------- */
3582 SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
3583 if (PyCFunction_Check(func)) {
3584 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
3585 PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
3586 if (ml)
3587 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
3589 return PyStaticMethod_New(func);
3592 #ifdef __cplusplus
3594 #endif
3596 /* -----------------------------------------------------------------------------*
3597 * Partial Init method
3598 * -----------------------------------------------------------------------------*/
3600 #ifdef __cplusplus
3601 extern "C"
3602 #endif
3604 SWIGEXPORT
3605 #if PY_VERSION_HEX >= 0x03000000
3606 PyObject *
3607 #else
3608 void
3609 #endif
3610 SWIG_init(void) {
3611 PyObject *m, *d, *md, *globals;
3613 #if PY_VERSION_HEX >= 0x03000000
3614 static struct PyModuleDef SWIG_module = {
3615 PyModuleDef_HEAD_INIT,
3616 SWIG_name,
3617 NULL,
3619 SwigMethods,
3620 NULL,
3621 NULL,
3622 NULL,
3623 NULL
3625 #endif
3627 #if defined(SWIGPYTHON_BUILTIN)
3628 static SwigPyClientData SwigPyObject_clientdata = {
3629 0, 0, 0, 0, 0, 0, 0
3631 static PyGetSetDef this_getset_def = {
3632 (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
3634 static SwigPyGetSet thisown_getset_closure = {
3635 SwigPyObject_own,
3636 SwigPyObject_own
3638 static PyGetSetDef thisown_getset_def = {
3639 (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
3641 PyTypeObject *builtin_pytype;
3642 int builtin_base_count;
3643 swig_type_info *builtin_basetype;
3644 PyObject *tuple;
3645 PyGetSetDescrObject *static_getset;
3646 PyTypeObject *metatype;
3647 PyTypeObject *swigpyobject;
3648 SwigPyClientData *cd;
3649 PyObject *public_interface, *public_symbol;
3650 PyObject *this_descr;
3651 PyObject *thisown_descr;
3652 PyObject *self = 0;
3653 int i;
3655 (void)builtin_pytype;
3656 (void)builtin_base_count;
3657 (void)builtin_basetype;
3658 (void)tuple;
3659 (void)static_getset;
3660 (void)self;
3662 /* Metaclass is used to implement static member variables */
3663 metatype = SwigPyObjectType();
3664 assert(metatype);
3665 #endif
3667 (void)globals;
3669 /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
3670 SWIG_This();
3671 SWIG_Python_TypeCache();
3672 SwigPyPacked_type();
3673 #ifndef SWIGPYTHON_BUILTIN
3674 SwigPyObject_type();
3675 #endif
3677 /* Fix SwigMethods to carry the callback ptrs when needed */
3678 SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
3680 #if PY_VERSION_HEX >= 0x03000000
3681 m = PyModule_Create(&SWIG_module);
3682 #else
3683 m = Py_InitModule(SWIG_name, SwigMethods);
3684 #endif
3686 md = d = PyModule_GetDict(m);
3687 (void)md;
3689 SWIG_InitializeModule(0);
3691 #ifdef SWIGPYTHON_BUILTIN
3692 swigpyobject = SwigPyObject_TypeOnce();
3694 SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
3695 assert(SwigPyObject_stype);
3696 cd = (SwigPyClientData *) SwigPyObject_stype->clientdata;
3697 if (!cd) {
3698 SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
3699 SwigPyObject_clientdata.pytype = swigpyobject;
3700 } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
3701 PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
3702 # if PY_VERSION_HEX >= 0x03000000
3703 return NULL;
3704 # else
3705 return;
3706 # endif
3709 /* All objects have a 'this' attribute */
3710 this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
3711 (void)this_descr;
3713 /* All objects have a 'thisown' attribute */
3714 thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
3715 (void)thisown_descr;
3717 public_interface = PyList_New(0);
3718 public_symbol = 0;
3719 (void)public_symbol;
3721 PyDict_SetItemString(md, "__all__", public_interface);
3722 Py_DECREF(public_interface);
3723 for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
3724 SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
3725 for (i = 0; swig_const_table[i].name != 0; ++i)
3726 SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
3727 #endif
3729 SWIG_InstallConstants(d, swig_const_table);
3731 #if PY_VERSION_HEX >= 0x03000000
3732 return m;
3733 #else
3734 return;
3735 #endif