fixes entering bootload messages to be less scary
[RRG-proxmark3.git] / client / src / pm3_pywrap.c
blob93a26e2d07a333d186e5ff8dfb1a4b0560f38d6b
1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (https://www.swig.org).
3 * Version 4.2.1
5 * Do not make changes to this file unless you know what you are doing - modify
6 * the SWIG interface file instead.
7 * ----------------------------------------------------------------------------- */
10 #define SWIG_VERSION 0x040201
11 #define SWIGPYTHON
12 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
14 /* -----------------------------------------------------------------------------
15 * This section contains generic SWIG labels for method/variable
16 * declarations/attributes, and other compiler dependent labels.
17 * ----------------------------------------------------------------------------- */
19 /* template workaround for compilers that cannot correctly implement the C++ standard */
20 #ifndef SWIGTEMPLATEDISAMBIGUATOR
21 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
22 # define SWIGTEMPLATEDISAMBIGUATOR template
23 # elif defined(__HP_aCC)
24 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
25 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
26 # define SWIGTEMPLATEDISAMBIGUATOR template
27 # else
28 # define SWIGTEMPLATEDISAMBIGUATOR
29 # endif
30 #endif
32 /* inline attribute */
33 #ifndef SWIGINLINE
34 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
35 # define SWIGINLINE inline
36 # else
37 # define SWIGINLINE
38 # endif
39 #endif
41 /* attribute recognised by some compilers to avoid 'unused' warnings */
42 #ifndef SWIGUNUSED
43 # if defined(__GNUC__)
44 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
45 # define SWIGUNUSED __attribute__ ((__unused__))
46 # else
47 # define SWIGUNUSED
48 # endif
49 # elif defined(__ICC)
50 # define SWIGUNUSED __attribute__ ((__unused__))
51 # else
52 # define SWIGUNUSED
53 # endif
54 #endif
56 #ifndef SWIG_MSC_UNSUPPRESS_4505
57 # if defined(_MSC_VER)
58 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
59 # endif
60 #endif
62 #ifndef SWIGUNUSEDPARM
63 # ifdef __cplusplus
64 # define SWIGUNUSEDPARM(p)
65 # else
66 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
67 # endif
68 #endif
70 /* internal SWIG method */
71 #ifndef SWIGINTERN
72 # define SWIGINTERN static SWIGUNUSED
73 #endif
75 /* internal inline SWIG method */
76 #ifndef SWIGINTERNINLINE
77 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
78 #endif
80 /* exporting methods */
81 #if defined(__GNUC__)
82 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
83 # ifndef GCC_HASCLASSVISIBILITY
84 # define GCC_HASCLASSVISIBILITY
85 # endif
86 # endif
87 #endif
89 #ifndef SWIGEXPORT
90 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
91 # if defined(STATIC_LINKED)
92 # define SWIGEXPORT
93 # else
94 # define SWIGEXPORT __declspec(dllexport)
95 # endif
96 # else
97 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
98 # define SWIGEXPORT __attribute__ ((visibility("default")))
99 # else
100 # define SWIGEXPORT
101 # endif
102 # endif
103 #endif
105 /* calling conventions for Windows */
106 #ifndef SWIGSTDCALL
107 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
108 # define SWIGSTDCALL __stdcall
109 # else
110 # define SWIGSTDCALL
111 # endif
112 #endif
114 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
115 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
116 # define _CRT_SECURE_NO_DEPRECATE
117 #endif
119 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
120 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
121 # define _SCL_SECURE_NO_DEPRECATE
122 #endif
124 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
125 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
126 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
127 #endif
129 /* Intel's compiler complains if a variable which was never initialised is
130 * cast to void, which is a common idiom which we use to indicate that we
131 * are aware a variable isn't used. So we just silence that warning.
132 * See: https://github.com/swig/swig/issues/192 for more discussion.
134 #ifdef __INTEL_COMPILER
135 # pragma warning disable 592
136 #endif
138 #if defined(__cplusplus) && __cplusplus >=201103L
139 # define SWIG_NULLPTR nullptr
140 #else
141 # define SWIG_NULLPTR NULL
142 #endif
144 /* -----------------------------------------------------------------------------
145 * swigcompat.swg
147 * Macros to provide support compatibility with older C and C++ standards.
148 * ----------------------------------------------------------------------------- */
150 /* C99 and C++11 should provide snprintf, but define SWIG_NO_SNPRINTF
151 * if you're missing it.
153 #if ((defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L) || \
154 (defined __cplusplus && __cplusplus >= 201103L) || \
155 defined SWIG_HAVE_SNPRINTF) && \
156 !defined SWIG_NO_SNPRINTF
157 # define SWIG_snprintf(O,S,F,A) snprintf(O,S,F,A)
158 # define SWIG_snprintf2(O,S,F,A,B) snprintf(O,S,F,A,B)
159 #else
160 /* Fallback versions ignore the buffer size, but most of our uses either have a
161 * fixed maximum possible size or dynamically allocate a buffer that's large
162 * enough.
164 # define SWIG_snprintf(O,S,F,A) sprintf(O,F,A)
165 # define SWIG_snprintf2(O,S,F,A,B) sprintf(O,F,A,B)
166 #endif
169 #if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
170 /* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
171 # include <math.h>
172 #endif
174 #if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN)
175 #define PY_SSIZE_T_CLEAN
176 #endif
178 #if __GNUC__ >= 7
179 #pragma GCC diagnostic push
180 #if defined(__cplusplus) && __cplusplus >=201703L
181 #pragma GCC diagnostic ignored "-Wregister" /* For python-2.7 headers that use register */
182 #endif
183 #endif
185 #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
186 /* Use debug wrappers with the Python release dll */
188 #if defined(_MSC_VER) && _MSC_VER >= 1929
189 /* Workaround compilation errors when redefining _DEBUG in MSVC 2019 version 16.10 and later
190 * See https://github.com/swig/swig/issues/2090 */
191 # include <corecrt.h>
192 #endif
194 # undef _DEBUG
195 # include <Python.h>
196 # define _DEBUG 1
197 #else
198 # include <Python.h>
199 #endif
201 #if __GNUC__ >= 7
202 #pragma GCC diagnostic pop
203 #endif
205 #include <stdio.h>
207 /* -----------------------------------------------------------------------------
208 * swigrun.swg
210 * This file contains generic C API SWIG runtime support for pointer
211 * type checking.
212 * ----------------------------------------------------------------------------- */
214 /* This should only be incremented when either the layout of swig_type_info changes,
215 or for whatever reason, the runtime changes incompatibly */
216 #define SWIG_RUNTIME_VERSION "4"
218 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
219 #ifdef SWIG_TYPE_TABLE
220 # define SWIG_QUOTE_STRING(x) #x
221 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
222 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
223 #else
224 # define SWIG_TYPE_TABLE_NAME
225 #endif
228 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
229 creating a static or dynamic library from the SWIG runtime code.
230 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
232 But only do this if strictly necessary, ie, if you have problems
233 with your compiler or suchlike.
236 #ifndef SWIGRUNTIME
237 # define SWIGRUNTIME SWIGINTERN
238 #endif
240 #ifndef SWIGRUNTIMEINLINE
241 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
242 #endif
244 /* Generic buffer size */
245 #ifndef SWIG_BUFFER_SIZE
246 # define SWIG_BUFFER_SIZE 1024
247 #endif
249 /* Flags for pointer conversions */
250 #define SWIG_POINTER_DISOWN 0x1
251 #define SWIG_CAST_NEW_MEMORY 0x2
252 #define SWIG_POINTER_NO_NULL 0x4
253 #define SWIG_POINTER_CLEAR 0x8
254 #define SWIG_POINTER_RELEASE (SWIG_POINTER_CLEAR | SWIG_POINTER_DISOWN)
256 /* Flags for new pointer objects */
257 #define SWIG_POINTER_OWN 0x1
261 Flags/methods for returning states.
263 The SWIG conversion methods, as ConvertPtr, return an integer
264 that tells if the conversion was successful or not. And if not,
265 an error code can be returned (see swigerrors.swg for the codes).
267 Use the following macros/flags to set or process the returning
268 states.
270 In old versions of SWIG, code such as the following was usually written:
272 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
273 // success code
274 } else {
275 //fail code
278 Now you can be more explicit:
280 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
281 if (SWIG_IsOK(res)) {
282 // success code
283 } else {
284 // fail code
287 which is the same really, but now you can also do
289 Type *ptr;
290 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
291 if (SWIG_IsOK(res)) {
292 // success code
293 if (SWIG_IsNewObj(res) {
295 delete *ptr;
296 } else {
299 } else {
300 // fail code
303 I.e., now SWIG_ConvertPtr can return new objects and you can
304 identify the case and take care of the deallocation. Of course that
305 also requires SWIG_ConvertPtr to return new result values, such as
307 int SWIG_ConvertPtr(obj, ptr,...) {
308 if (<obj is ok>) {
309 if (<need new object>) {
310 *ptr = <ptr to new allocated object>;
311 return SWIG_NEWOBJ;
312 } else {
313 *ptr = <ptr to old object>;
314 return SWIG_OLDOBJ;
316 } else {
317 return SWIG_BADOBJ;
321 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
322 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
323 SWIG errors code.
325 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
326 allows returning the 'cast rank', for example, if you have this
328 int food(double)
329 int fooi(int);
331 and you call
333 food(1) // cast rank '1' (1 -> 1.0)
334 fooi(1) // cast rank '0'
336 just use the SWIG_AddCast()/SWIG_CheckState()
339 #define SWIG_OK (0)
340 /* Runtime errors are < 0 */
341 #define SWIG_ERROR (-1)
342 /* Errors in range -1 to -99 are in swigerrors.swg (errors for all languages including those not using the runtime) */
343 /* Errors in range -100 to -199 are language specific errors defined in *errors.swg */
344 /* Errors < -200 are generic runtime specific errors */
345 #define SWIG_ERROR_RELEASE_NOT_OWNED (-200)
347 #define SWIG_IsOK(r) (r >= 0)
348 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
350 /* The CastRankLimit says how many bits are used for the cast rank */
351 #define SWIG_CASTRANKLIMIT (1 << 8)
352 /* The NewMask denotes the object was created (using new/malloc) */
353 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
354 /* The TmpMask is for in/out typemaps that use temporary objects */
355 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
356 /* Simple returning values */
357 #define SWIG_BADOBJ (SWIG_ERROR)
358 #define SWIG_OLDOBJ (SWIG_OK)
359 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
360 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
361 /* Check, add and del object mask methods */
362 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
363 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
364 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
365 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
366 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
367 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
369 /* Cast-Rank Mode */
370 #if defined(SWIG_CASTRANK_MODE)
371 # ifndef SWIG_TypeRank
372 # define SWIG_TypeRank unsigned long
373 # endif
374 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
375 # define SWIG_MAXCASTRANK (2)
376 # endif
377 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
378 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
379 SWIGINTERNINLINE int SWIG_AddCast(int r) {
380 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
382 SWIGINTERNINLINE int SWIG_CheckState(int r) {
383 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
385 #else /* no cast-rank mode */
386 # define SWIG_AddCast(r) (r)
387 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
388 #endif
391 #include <string.h>
393 #ifdef __cplusplus
394 extern "C" {
395 #endif
397 typedef void *(*swig_converter_func)(void *, int *);
398 typedef struct swig_type_info *(*swig_dycast_func)(void **);
400 /* Structure to store information on one type */
401 typedef struct swig_type_info {
402 const char *name; /* mangled name of this type */
403 const char *str; /* human readable name of this type */
404 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
405 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
406 void *clientdata; /* language specific type data */
407 int owndata; /* flag if the structure owns the clientdata */
408 } swig_type_info;
410 /* Structure to store a type and conversion function used for casting */
411 typedef struct swig_cast_info {
412 swig_type_info *type; /* pointer to type that is equivalent to this type */
413 swig_converter_func converter; /* function to cast the void pointers */
414 struct swig_cast_info *next; /* pointer to next cast in linked list */
415 struct swig_cast_info *prev; /* pointer to the previous cast */
416 } swig_cast_info;
418 /* Structure used to store module information
419 * Each module generates one structure like this, and the runtime collects
420 * all of these structures and stores them in a circularly linked list.*/
421 typedef struct swig_module_info {
422 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
423 size_t size; /* Number of types in this module */
424 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
425 swig_type_info **type_initial; /* Array of initially generated type structures */
426 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
427 void *clientdata; /* Language specific module data */
428 } swig_module_info;
431 Compare two type names skipping the space characters, therefore
432 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
434 Return 0 when the two name types are equivalent, as in
435 strncmp, but skipping ' '.
437 SWIGRUNTIME int
438 SWIG_TypeNameComp(const char *f1, const char *l1,
439 const char *f2, const char *l2) {
440 for (; (f1 != l1) && (f2 != l2); ++f1, ++f2) {
441 while ((*f1 == ' ') && (f1 != l1)) ++f1;
442 while ((*f2 == ' ') && (f2 != l2)) ++f2;
443 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
445 return (int)((l1 - f1) - (l2 - f2));
449 Check type equivalence in a name list like <name1>|<name2>|...
450 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
452 SWIGRUNTIME int
453 SWIG_TypeCmp(const char *nb, const char *tb) {
454 int equiv = 1;
455 const char *te = tb + strlen(tb);
456 const char *ne = nb;
457 while (equiv != 0 && *ne) {
458 for (nb = ne; *ne; ++ne) {
459 if (*ne == '|') break;
461 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
462 if (*ne) ++ne;
464 return equiv;
468 Check type equivalence in a name list like <name1>|<name2>|...
469 Return 0 if not equal, 1 if equal
471 SWIGRUNTIME int
472 SWIG_TypeEquiv(const char *nb, const char *tb) {
473 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
477 Check the typename
479 SWIGRUNTIME swig_cast_info *
480 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
481 if (ty) {
482 swig_cast_info *iter = ty->cast;
483 while (iter) {
484 if (strcmp(iter->type->name, c) == 0) {
485 if (iter == ty->cast)
486 return iter;
487 /* Move iter to the top of the linked list */
488 iter->prev->next = iter->next;
489 if (iter->next)
490 iter->next->prev = iter->prev;
491 iter->next = ty->cast;
492 iter->prev = 0;
493 if (ty->cast) ty->cast->prev = iter;
494 ty->cast = iter;
495 return iter;
497 iter = iter->next;
500 return 0;
504 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
506 SWIGRUNTIME swig_cast_info *
507 SWIG_TypeCheckStruct(const swig_type_info *from, swig_type_info *ty) {
508 if (ty) {
509 swig_cast_info *iter = ty->cast;
510 while (iter) {
511 if (iter->type == from) {
512 if (iter == ty->cast)
513 return iter;
514 /* Move iter to the top of the linked list */
515 iter->prev->next = iter->next;
516 if (iter->next)
517 iter->next->prev = iter->prev;
518 iter->next = ty->cast;
519 iter->prev = 0;
520 if (ty->cast) ty->cast->prev = iter;
521 ty->cast = iter;
522 return iter;
524 iter = iter->next;
527 return 0;
531 Cast a pointer up an inheritance hierarchy
533 SWIGRUNTIMEINLINE void *
534 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
535 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
539 Dynamic pointer casting. Down an inheritance hierarchy
541 SWIGRUNTIME swig_type_info *
542 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
543 swig_type_info *lastty = ty;
544 if (!ty || !ty->dcast) return ty;
545 while (ty && (ty->dcast)) {
546 ty = (*ty->dcast)(ptr);
547 if (ty) lastty = ty;
549 return lastty;
553 Return the name associated with this type
555 SWIGRUNTIMEINLINE const char *
556 SWIG_TypeName(const swig_type_info *ty) {
557 return ty->name;
561 Return the pretty name associated with this type,
562 that is an unmangled type name in a form presentable to the user.
564 SWIGRUNTIME const char *
565 SWIG_TypePrettyName(const swig_type_info *type) {
566 /* The "str" field contains the equivalent pretty names of the
567 type, separated by vertical-bar characters. Choose the last
568 name. It should be the most specific; a fully resolved name
569 but not necessarily with default template parameters expanded. */
570 if (!type) return NULL;
571 if (type->str != NULL) {
572 const char *last_name = type->str;
573 const char *s;
574 for (s = type->str; *s; s++)
575 if (*s == '|') last_name = s + 1;
576 return last_name;
577 } else
578 return type->name;
582 Set the clientdata field for a type
584 SWIGRUNTIME void
585 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
586 swig_cast_info *cast = ti->cast;
587 /* if (ti->clientdata == clientdata) return; */
588 ti->clientdata = clientdata;
590 while (cast) {
591 if (!cast->converter) {
592 swig_type_info *tc = cast->type;
593 if (!tc->clientdata) {
594 SWIG_TypeClientData(tc, clientdata);
597 cast = cast->next;
600 SWIGRUNTIME void
601 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
602 SWIG_TypeClientData(ti, clientdata);
603 ti->owndata = 1;
607 Search for a swig_type_info structure only by mangled name
608 Search is a O(log #types)
610 We start searching at module start, and finish searching when start == end.
611 Note: if start == end at the beginning of the function, we go all the way around
612 the circular list.
614 SWIGRUNTIME swig_type_info *
615 SWIG_MangledTypeQueryModule(swig_module_info *start,
616 swig_module_info *end,
617 const char *name) {
618 swig_module_info *iter = start;
619 do {
620 if (iter->size) {
621 size_t l = 0;
622 size_t r = iter->size - 1;
623 do {
624 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
625 size_t i = (l + r) >> 1;
626 const char *iname = iter->types[i]->name;
627 if (iname) {
628 int compare = strcmp(name, iname);
629 if (compare == 0) {
630 return iter->types[i];
631 } else if (compare < 0) {
632 if (i) {
633 r = i - 1;
634 } else {
635 break;
637 } else if (compare > 0) {
638 l = i + 1;
640 } else {
641 break; /* should never happen */
643 } while (l <= r);
645 iter = iter->next;
646 } while (iter != end);
647 return 0;
651 Search for a swig_type_info structure for either a mangled name or a human readable name.
652 It first searches the mangled names of the types, which is a O(log #types)
653 If a type is not found it then searches the human readable names, which is O(#types).
655 We start searching at module start, and finish searching when start == end.
656 Note: if start == end at the beginning of the function, we go all the way around
657 the circular list.
659 SWIGRUNTIME swig_type_info *
660 SWIG_TypeQueryModule(swig_module_info *start,
661 swig_module_info *end,
662 const char *name) {
663 /* STEP 1: Search the name field using binary search */
664 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
665 if (ret) {
666 return ret;
667 } else {
668 /* STEP 2: If the type hasn't been found, do a complete search
669 of the str field (the human readable name) */
670 swig_module_info *iter = start;
671 do {
672 size_t i = 0;
673 for (; i < iter->size; ++i) {
674 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
675 return iter->types[i];
677 iter = iter->next;
678 } while (iter != end);
681 /* neither found a match */
682 return 0;
686 Pack binary data into a string
688 SWIGRUNTIME char *
689 SWIG_PackData(char *c, void *ptr, size_t sz) {
690 static const char hex[17] = "0123456789abcdef";
691 const unsigned char *u = (unsigned char *) ptr;
692 const unsigned char *eu = u + sz;
693 for (; u != eu; ++u) {
694 unsigned char uu = *u;
695 *(c++) = hex[(uu & 0xf0) >> 4];
696 *(c++) = hex[uu & 0xf];
698 return c;
702 Unpack binary data from a string
704 SWIGRUNTIME const char *
705 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
706 unsigned char *u = (unsigned char *) ptr;
707 const unsigned char *eu = u + sz;
708 for (; u != eu; ++u) {
709 char d = *(c++);
710 unsigned char uu;
711 if ((d >= '0') && (d <= '9'))
712 uu = (unsigned char)((d - '0') << 4);
713 else if ((d >= 'a') && (d <= 'f'))
714 uu = (unsigned char)((d - ('a' - 10)) << 4);
715 else
716 return (char *) 0;
717 d = *(c++);
718 if ((d >= '0') && (d <= '9'))
719 uu |= (unsigned char)(d - '0');
720 else if ((d >= 'a') && (d <= 'f'))
721 uu |= (unsigned char)(d - ('a' - 10));
722 else
723 return (char *) 0;
724 *u = uu;
726 return c;
730 Pack 'void *' into a string buffer.
732 SWIGRUNTIME char *
733 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
734 char *r = buff;
735 if ((2 * sizeof(void *) + 2) > bsz) return 0;
736 *(r++) = '_';
737 r = SWIG_PackData(r, &ptr, sizeof(void *));
738 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
739 strcpy(r, name);
740 return buff;
743 SWIGRUNTIME const char *
744 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
745 if (*c != '_') {
746 if (strcmp(c, "NULL") == 0) {
747 *ptr = (void *) 0;
748 return name;
749 } else {
750 return 0;
753 return SWIG_UnpackData(++c, ptr, sizeof(void *));
756 SWIGRUNTIME char *
757 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
758 char *r = buff;
759 size_t lname = (name ? strlen(name) : 0);
760 if ((2 * sz + 2 + lname) > bsz) return 0;
761 *(r++) = '_';
762 r = SWIG_PackData(r, ptr, sz);
763 if (lname) {
764 strncpy(r, name, lname + 1);
765 } else {
766 *r = 0;
768 return buff;
771 SWIGRUNTIME const char *
772 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
773 if (*c != '_') {
774 if (strcmp(c, "NULL") == 0) {
775 memset(ptr, 0, sz);
776 return name;
777 } else {
778 return 0;
781 return SWIG_UnpackData(++c, ptr, sz);
784 #ifdef __cplusplus
786 #endif
788 /* SWIG Errors applicable to all language modules, values are reserved from -1 to -99 */
789 #define SWIG_UnknownError -1
790 #define SWIG_IOError -2
791 #define SWIG_RuntimeError -3
792 #define SWIG_IndexError -4
793 #define SWIG_TypeError -5
794 #define SWIG_DivisionByZero -6
795 #define SWIG_OverflowError -7
796 #define SWIG_SyntaxError -8
797 #define SWIG_ValueError -9
798 #define SWIG_SystemError -10
799 #define SWIG_AttributeError -11
800 #define SWIG_MemoryError -12
801 #define SWIG_NullReferenceError -13
804 /* Compatibility macros for Python 3 */
805 #if PY_VERSION_HEX >= 0x03000000
807 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
808 #define PyInt_Check(x) PyLong_Check(x)
809 #define PyInt_AsLong(x) PyLong_AsLong(x)
810 #define PyInt_FromLong(x) PyLong_FromLong(x)
811 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
812 #define PyString_Check(name) PyBytes_Check(name)
813 #define PyString_FromString(x) PyUnicode_FromString(x)
814 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
815 #define PyString_AsString(str) PyBytes_AsString(str)
816 #define PyString_Size(str) PyBytes_Size(str)
817 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
818 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
819 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
821 #endif
823 #ifndef Py_TYPE
824 # define Py_TYPE(op) ((op)->ob_type)
825 #endif
827 /* SWIG APIs for compatibility of both Python 2 & 3 */
829 #if PY_VERSION_HEX >= 0x03000000
830 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
831 #else
832 # define SWIG_Python_str_FromFormat PyString_FromFormat
833 #endif
836 /* Wrapper around PyUnicode_AsUTF8AndSize - call Py_XDECREF on the returned pbytes when finished with the returned string */
837 SWIGINTERN const char *
838 SWIG_PyUnicode_AsUTF8AndSize(PyObject *str, Py_ssize_t *psize, PyObject **pbytes) {
839 #if PY_VERSION_HEX >= 0x03030000
840 # if !defined(Py_LIMITED_API) || Py_LIMITED_API+0 >= 0x030A0000
841 *pbytes = NULL;
842 return PyUnicode_AsUTF8AndSize(str, psize);
843 # else
844 *pbytes = PyUnicode_AsUTF8String(str);
845 const char *chars = *pbytes ? PyBytes_AsString(*pbytes) : NULL;
846 if (chars && psize)
847 *psize = PyBytes_Size(*pbytes);
848 return chars;
849 # endif
850 #else
851 char *chars = NULL;
852 *pbytes = NULL;
853 PyString_AsStringAndSize(str, &chars, psize);
854 return chars;
855 #endif
858 SWIGINTERN PyObject *
859 SWIG_Python_str_FromChar(const char *c) {
860 #if PY_VERSION_HEX >= 0x03000000
861 return PyUnicode_FromString(c);
862 #else
863 return PyString_FromString(c);
864 #endif
867 #ifndef PyObject_DEL
868 # define PyObject_DEL PyObject_Del
869 #endif
871 /* SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user interface files check for it. */
872 # define SWIGPY_USE_CAPSULE
873 #ifdef SWIGPYTHON_BUILTIN
874 # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule_builtin" SWIG_TYPE_TABLE_NAME
875 #else
876 # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME
877 #endif
878 # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION "." SWIGPY_CAPSULE_ATTR_NAME)
880 #if PY_VERSION_HEX < 0x03020000
881 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
882 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
883 #define Py_hash_t long
884 #endif
886 #ifdef Py_LIMITED_API
887 # define PyTuple_GET_ITEM PyTuple_GetItem
888 /* Note that PyTuple_SetItem() has different semantics from PyTuple_SET_ITEM as it decref's the original tuple item, so in general they cannot be used
889 interchangeably. However in SWIG-generated code PyTuple_SET_ITEM is only used with newly initialized tuples without any items and for them this does work. */
890 # define PyTuple_SET_ITEM PyTuple_SetItem
891 # define PyTuple_GET_SIZE PyTuple_Size
892 # define PyCFunction_GET_FLAGS PyCFunction_GetFlags
893 # define PyCFunction_GET_FUNCTION PyCFunction_GetFunction
894 # define PyCFunction_GET_SELF PyCFunction_GetSelf
895 # define PyList_GET_ITEM PyList_GetItem
896 # define PyList_SET_ITEM PyList_SetItem
897 # define PySliceObject PyObject
898 #endif
900 /* -----------------------------------------------------------------------------
901 * error manipulation
902 * ----------------------------------------------------------------------------- */
904 SWIGRUNTIME PyObject *
905 SWIG_Python_ErrorType(int code) {
906 PyObject *type = 0;
907 switch (code) {
908 case SWIG_MemoryError:
909 type = PyExc_MemoryError;
910 break;
911 case SWIG_IOError:
912 type = PyExc_IOError;
913 break;
914 case SWIG_RuntimeError:
915 type = PyExc_RuntimeError;
916 break;
917 case SWIG_IndexError:
918 type = PyExc_IndexError;
919 break;
920 case SWIG_TypeError:
921 type = PyExc_TypeError;
922 break;
923 case SWIG_DivisionByZero:
924 type = PyExc_ZeroDivisionError;
925 break;
926 case SWIG_OverflowError:
927 type = PyExc_OverflowError;
928 break;
929 case SWIG_SyntaxError:
930 type = PyExc_SyntaxError;
931 break;
932 case SWIG_ValueError:
933 type = PyExc_ValueError;
934 break;
935 case SWIG_SystemError:
936 type = PyExc_SystemError;
937 break;
938 case SWIG_AttributeError:
939 type = PyExc_AttributeError;
940 break;
941 default:
942 type = PyExc_RuntimeError;
944 return type;
948 SWIGRUNTIME void
949 SWIG_Python_AddErrorMsg(const char *mesg) {
950 PyObject *type = 0;
951 PyObject *value = 0;
952 PyObject *traceback = 0;
954 if (PyErr_Occurred())
955 PyErr_Fetch(&type, &value, &traceback);
956 if (value) {
957 PyObject *old_str = PyObject_Str(value);
958 PyObject *bytes = NULL;
959 const char *tmp = SWIG_PyUnicode_AsUTF8AndSize(old_str, NULL, &bytes);
960 PyErr_Clear();
961 Py_XINCREF(type);
962 if (tmp)
963 PyErr_Format(type, "%s %s", tmp, mesg);
964 else
965 PyErr_Format(type, "%s", mesg);
966 Py_XDECREF(bytes);
967 Py_DECREF(old_str);
968 Py_DECREF(value);
969 } else {
970 PyErr_SetString(PyExc_RuntimeError, mesg);
974 SWIGRUNTIME int
975 SWIG_Python_TypeErrorOccurred(PyObject *obj) {
976 PyObject *error;
977 if (obj)
978 return 0;
979 error = PyErr_Occurred();
980 return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
983 SWIGRUNTIME void
984 SWIG_Python_RaiseOrModifyTypeError(const char *message) {
985 if (SWIG_Python_TypeErrorOccurred(NULL)) {
986 /* Use existing TypeError to preserve stacktrace and enhance with given message */
987 PyObject *newvalue;
988 PyObject *type = NULL, *value = NULL, *traceback = NULL;
989 PyErr_Fetch(&type, &value, &traceback);
990 #if PY_VERSION_HEX >= 0x03000000
991 newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message);
992 #else
993 newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
994 #endif
995 if (newvalue) {
996 Py_XDECREF(value);
997 PyErr_Restore(type, newvalue, traceback);
998 } else {
999 PyErr_Restore(type, value, traceback);
1001 } else {
1002 /* Raise TypeError using given message */
1003 PyErr_SetString(PyExc_TypeError, message);
1007 #if defined(SWIG_PYTHON_NO_THREADS)
1008 # if defined(SWIG_PYTHON_THREADS)
1009 # undef SWIG_PYTHON_THREADS
1010 # endif
1011 #endif
1012 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
1013 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
1014 # define SWIG_PYTHON_USE_GIL
1015 # endif
1016 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
1017 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1018 # if PY_VERSION_HEX < 0x03070000
1019 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
1020 # else
1021 # define SWIG_PYTHON_INITIALIZE_THREADS
1022 # endif
1023 # endif
1024 # ifdef __cplusplus /* C++ code */
1025 class SWIG_Python_Thread_Block {
1026 bool status;
1027 PyGILState_STATE state;
1028 public:
1029 void end() { if (status) { PyGILState_Release(state); status = false;} }
1030 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
1031 ~SWIG_Python_Thread_Block() { end(); }
1033 class SWIG_Python_Thread_Allow {
1034 bool status;
1035 PyThreadState *save;
1036 public:
1037 void end() { if (status) { status = false; PyEval_RestoreThread(save); }}
1038 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
1039 ~SWIG_Python_Thread_Allow() { end(); }
1041 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
1042 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
1043 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
1044 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
1045 # else /* C code */
1046 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1047 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1048 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1049 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1050 # endif
1051 # else /* Old thread way, not implemented, user must provide it */
1052 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1053 # define SWIG_PYTHON_INITIALIZE_THREADS
1054 # endif
1055 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1056 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1057 # endif
1058 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1059 # define SWIG_PYTHON_THREAD_END_BLOCK
1060 # endif
1061 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1062 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1063 # endif
1064 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1065 # define SWIG_PYTHON_THREAD_END_ALLOW
1066 # endif
1067 # endif
1068 #else /* No thread support */
1069 # define SWIG_PYTHON_INITIALIZE_THREADS
1070 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1071 # define SWIG_PYTHON_THREAD_END_BLOCK
1072 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1073 # define SWIG_PYTHON_THREAD_END_ALLOW
1074 #endif
1076 /* -----------------------------------------------------------------------------
1077 * Python API portion that goes into the runtime
1078 * ----------------------------------------------------------------------------- */
1080 #ifdef __cplusplus
1081 extern "C" {
1082 #endif
1084 /* -----------------------------------------------------------------------------
1085 * Constant declarations
1086 * ----------------------------------------------------------------------------- */
1088 /* Constant Types */
1089 #define SWIG_PY_POINTER 4
1090 #define SWIG_PY_BINARY 5
1092 /* Constant information structure */
1093 typedef struct swig_const_info {
1094 int type;
1095 const char *name;
1096 long lvalue;
1097 double dvalue;
1098 void *pvalue;
1099 swig_type_info **ptype;
1100 } swig_const_info;
1102 #ifdef __cplusplus
1104 #endif
1107 /* -----------------------------------------------------------------------------
1108 * pyrun.swg
1110 * This file contains the runtime support for Python modules
1111 * and includes code for managing global variables and pointer
1112 * type checking.
1114 * ----------------------------------------------------------------------------- */
1116 #if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
1117 # error "This version of SWIG only supports Python >= 2.7"
1118 #endif
1120 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000
1121 # error "This version of SWIG only supports Python 3 >= 3.3"
1122 #endif
1124 /* Common SWIG API */
1126 /* for raw pointers */
1127 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1128 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1129 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1131 #ifdef SWIGPYTHON_BUILTIN
1132 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1133 #else
1134 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1135 #endif
1137 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1139 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1140 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1141 #define swig_owntype int
1143 /* for raw packed data */
1144 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1145 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1147 /* for class or struct pointers */
1148 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1149 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1151 /* for C or C++ function pointers */
1152 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1153 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1155 /* for C++ member pointers, ie, member methods */
1156 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1157 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1160 /* Runtime API */
1162 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1163 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1164 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1166 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1167 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1168 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1169 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1170 #define SWIG_fail goto fail
1173 /* Runtime API implementation */
1175 /* Error manipulation */
1177 SWIGINTERN void
1178 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1179 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1180 PyErr_SetObject(errtype, obj);
1181 Py_DECREF(obj);
1182 SWIG_PYTHON_THREAD_END_BLOCK;
1185 SWIGINTERN void
1186 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1187 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1188 PyErr_SetString(errtype, msg);
1189 SWIG_PYTHON_THREAD_END_BLOCK;
1192 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1194 /* Set a constant value */
1196 #if defined(SWIGPYTHON_BUILTIN)
1198 SWIGINTERN void
1199 SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1200 PyObject *s = PyString_InternFromString(key);
1201 PyList_Append(seq, s);
1202 Py_DECREF(s);
1205 SWIGINTERN void
1206 SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
1207 PyDict_SetItemString(d, name, obj);
1208 Py_DECREF(obj);
1209 if (public_interface)
1210 SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1213 #else
1215 SWIGINTERN void
1216 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1217 PyDict_SetItemString(d, name, obj);
1218 Py_DECREF(obj);
1221 #endif
1223 /* Append a value to the result obj */
1225 SWIGINTERN PyObject *
1226 SWIG_Python_AppendOutput(PyObject *result, PyObject *obj) {
1227 if (!result) {
1228 result = obj;
1229 } else if (result == Py_None) {
1230 Py_DECREF(result);
1231 result = obj;
1232 } else {
1233 if (!PyList_Check(result)) {
1234 PyObject *o2 = result;
1235 result = PyList_New(1);
1236 if (result) {
1237 PyList_SET_ITEM(result, 0, o2);
1238 } else {
1239 Py_DECREF(obj);
1240 return o2;
1243 PyList_Append(result, obj);
1244 Py_DECREF(obj);
1246 return result;
1249 /* Unpack the argument tuple */
1251 SWIGINTERN Py_ssize_t
1252 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs) {
1253 if (!args) {
1254 if (!min && !max) {
1255 return 1;
1256 } else {
1257 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1258 name, (min == max ? "" : "at least "), (int)min);
1259 return 0;
1262 if (!PyTuple_Check(args)) {
1263 if (min <= 1 && max >= 1) {
1264 Py_ssize_t i;
1265 objs[0] = args;
1266 for (i = 1; i < max; ++i) {
1267 objs[i] = 0;
1269 return 2;
1271 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1272 return 0;
1273 } else {
1274 Py_ssize_t l = PyTuple_GET_SIZE(args);
1275 if (l < min) {
1276 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1277 name, (min == max ? "" : "at least "), (int)min, (int)l);
1278 return 0;
1279 } else if (l > max) {
1280 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1281 name, (min == max ? "" : "at most "), (int)max, (int)l);
1282 return 0;
1283 } else {
1284 Py_ssize_t i;
1285 for (i = 0; i < l; ++i) {
1286 objs[i] = PyTuple_GET_ITEM(args, i);
1288 for (; l < max; ++l) {
1289 objs[l] = 0;
1291 return i + 1;
1296 SWIGINTERN int
1297 SWIG_Python_CheckNoKeywords(PyObject *kwargs, const char *name) {
1298 int no_kwargs = 1;
1299 if (kwargs) {
1300 assert(PyDict_Check(kwargs));
1301 if (PyDict_Size(kwargs) > 0) {
1302 PyErr_Format(PyExc_TypeError, "%s() does not take keyword arguments", name);
1303 no_kwargs = 0;
1306 return no_kwargs;
1309 /* A functor is a function object with one single object argument */
1310 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1313 Helper for static pointer initialization for both C and C++ code, for example
1314 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1316 #ifdef __cplusplus
1317 #define SWIG_STATIC_POINTER(var) var
1318 #else
1319 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1320 #endif
1322 #ifdef __cplusplus
1323 extern "C" {
1324 #endif
1326 /* Python-specific SWIG API */
1327 #define SWIG_newvarlink() SWIG_Python_newvarlink()
1328 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
1329 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
1331 /* -----------------------------------------------------------------------------
1332 * global variable support code.
1333 * ----------------------------------------------------------------------------- */
1335 typedef struct swig_globalvar {
1336 char *name; /* Name of global variable */
1337 PyObject *(*get_attr)(void); /* Return the current value */
1338 int (*set_attr)(PyObject *); /* Set the value */
1339 struct swig_globalvar *next;
1340 } swig_globalvar;
1342 typedef struct swig_varlinkobject {
1343 PyObject_HEAD
1344 swig_globalvar *vars;
1345 } swig_varlinkobject;
1347 SWIGINTERN PyObject *
1348 swig_varlink_repr(PyObject *SWIGUNUSEDPARM(v)) {
1349 #if PY_VERSION_HEX >= 0x03000000
1350 return PyUnicode_InternFromString("<Swig global variables>");
1351 #else
1352 return PyString_FromString("<Swig global variables>");
1353 #endif
1356 SWIGINTERN PyObject *
1357 swig_varlink_str(PyObject *o) {
1358 swig_varlinkobject *v = (swig_varlinkobject *) o;
1359 #if PY_VERSION_HEX >= 0x03000000
1360 PyObject *str = PyUnicode_InternFromString("(");
1361 PyObject *tail;
1362 PyObject *joined;
1363 swig_globalvar *var;
1364 for (var = v->vars; var; var = var->next) {
1365 tail = PyUnicode_FromString(var->name);
1366 joined = PyUnicode_Concat(str, tail);
1367 Py_DecRef(str);
1368 Py_DecRef(tail);
1369 str = joined;
1370 if (var->next) {
1371 tail = PyUnicode_InternFromString(", ");
1372 joined = PyUnicode_Concat(str, tail);
1373 Py_DecRef(str);
1374 Py_DecRef(tail);
1375 str = joined;
1378 tail = PyUnicode_InternFromString(")");
1379 joined = PyUnicode_Concat(str, tail);
1380 Py_DecRef(str);
1381 Py_DecRef(tail);
1382 str = joined;
1383 #else
1384 PyObject *str = PyString_FromString("(");
1385 swig_globalvar *var;
1386 for (var = v->vars; var; var = var->next) {
1387 PyString_ConcatAndDel(&str, PyString_FromString(var->name));
1388 if (var->next) PyString_ConcatAndDel(&str, PyString_FromString(", "));
1390 PyString_ConcatAndDel(&str, PyString_FromString(")"));
1391 #endif
1392 return str;
1395 SWIGINTERN void
1396 swig_varlink_dealloc(PyObject *o) {
1397 swig_varlinkobject *v = (swig_varlinkobject *) o;
1398 swig_globalvar *var = v->vars;
1399 while (var) {
1400 swig_globalvar *n = var->next;
1401 free(var->name);
1402 free(var);
1403 var = n;
1407 SWIGINTERN PyObject *
1408 swig_varlink_getattr(PyObject *o, char *n) {
1409 swig_varlinkobject *v = (swig_varlinkobject *) o;
1410 PyObject *res = NULL;
1411 swig_globalvar *var = v->vars;
1412 while (var) {
1413 if (strcmp(var->name, n) == 0) {
1414 res = (*var->get_attr)();
1415 break;
1417 var = var->next;
1419 if (res == NULL && !PyErr_Occurred()) {
1420 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
1422 return res;
1425 SWIGINTERN int
1426 swig_varlink_setattr(PyObject *o, char *n, PyObject *p) {
1427 swig_varlinkobject *v = (swig_varlinkobject *) o;
1428 int res = 1;
1429 swig_globalvar *var = v->vars;
1430 while (var) {
1431 if (strcmp(var->name, n) == 0) {
1432 res = (*var->set_attr)(p);
1433 break;
1435 var = var->next;
1437 if (res == 1 && !PyErr_Occurred()) {
1438 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
1440 return res;
1443 SWIGINTERN PyTypeObject *
1444 swig_varlink_type(void) {
1445 static char varlink__doc__[] = "Swig var link object";
1446 #ifndef Py_LIMITED_API
1447 static PyTypeObject varlink_type;
1448 static int type_init = 0;
1449 if (!type_init) {
1450 const PyTypeObject tmp = {
1451 #if PY_VERSION_HEX >= 0x03000000
1452 PyVarObject_HEAD_INIT(NULL, 0)
1453 #else
1454 PyObject_HEAD_INIT(NULL)
1455 0, /* ob_size */
1456 #endif
1457 "swigvarlink", /* tp_name */
1458 sizeof(swig_varlinkobject), /* tp_basicsize */
1459 0, /* tp_itemsize */
1460 (destructor) swig_varlink_dealloc, /* tp_dealloc */
1461 #if PY_VERSION_HEX < 0x030800b4
1462 (printfunc)0, /*tp_print*/
1463 #else
1464 (Py_ssize_t)0, /*tp_vectorcall_offset*/
1465 #endif
1466 (getattrfunc) swig_varlink_getattr, /* tp_getattr */
1467 (setattrfunc) swig_varlink_setattr, /* tp_setattr */
1468 0, /* tp_compare */
1469 (reprfunc) swig_varlink_repr, /* tp_repr */
1470 0, /* tp_as_number */
1471 0, /* tp_as_sequence */
1472 0, /* tp_as_mapping */
1473 0, /* tp_hash */
1474 0, /* tp_call */
1475 (reprfunc) swig_varlink_str, /* tp_str */
1476 0, /* tp_getattro */
1477 0, /* tp_setattro */
1478 0, /* tp_as_buffer */
1479 0, /* tp_flags */
1480 varlink__doc__, /* tp_doc */
1481 0, /* tp_traverse */
1482 0, /* tp_clear */
1483 0, /* tp_richcompare */
1484 0, /* tp_weaklistoffset */
1485 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* tp_iter -> tp_weaklist */
1486 0, /* tp_del */
1487 0, /* tp_version_tag */
1488 #if PY_VERSION_HEX >= 0x03040000
1489 0, /* tp_finalize */
1490 #endif
1491 #if PY_VERSION_HEX >= 0x03080000
1492 0, /* tp_vectorcall */
1493 #endif
1494 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1495 0, /* tp_print */
1496 #endif
1497 #if PY_VERSION_HEX >= 0x030C0000
1498 0, /* tp_watched */
1499 #endif
1500 #ifdef COUNT_ALLOCS
1501 0, /* tp_allocs */
1502 0, /* tp_frees */
1503 0, /* tp_maxalloc */
1504 0, /* tp_prev */
1505 0 /* tp_next */
1506 #endif
1508 varlink_type = tmp;
1509 type_init = 1;
1510 if (PyType_Ready(&varlink_type) < 0)
1511 return NULL;
1513 return &varlink_type;
1514 #else
1515 PyType_Slot slots[] = {
1516 { Py_tp_dealloc, (void *)swig_varlink_dealloc },
1517 { Py_tp_repr, (void *)swig_varlink_repr },
1518 { Py_tp_getattr, (void *)swig_varlink_getattr },
1519 { Py_tp_setattr, (void *)swig_varlink_setattr },
1520 { Py_tp_str, (void *)swig_varlink_str },
1521 { Py_tp_doc, (void *)varlink__doc__ },
1522 { 0, NULL }
1524 PyType_Spec spec = {
1525 "swigvarlink",
1526 sizeof(swig_varlinkobject),
1528 Py_TPFLAGS_DEFAULT,
1529 slots
1531 return (PyTypeObject *)PyType_FromSpec(&spec);
1532 #endif
1535 /* Create a variable linking object for use later */
1536 SWIGINTERN PyObject *
1537 SWIG_Python_newvarlink(void) {
1538 swig_varlinkobject *result = PyObject_New(swig_varlinkobject, swig_varlink_type());
1539 if (result) {
1540 result->vars = 0;
1542 return ((PyObject *) result);
1545 SWIGINTERN void
1546 SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject * (*get_attr)(void), int (*set_attr)(PyObject *p)) {
1547 swig_varlinkobject *v = (swig_varlinkobject *) p;
1548 swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
1549 if (gv) {
1550 size_t size = strlen(name) + 1;
1551 gv->name = (char *)malloc(size);
1552 if (gv->name) {
1553 memcpy(gv->name, name, size);
1554 gv->get_attr = get_attr;
1555 gv->set_attr = set_attr;
1556 gv->next = v->vars;
1559 v->vars = gv;
1563 static PyObject *Swig_Globals_global = NULL;
1565 SWIGINTERN PyObject *
1566 SWIG_globals(void) {
1567 if (Swig_Globals_global == NULL) {
1568 Swig_Globals_global = SWIG_newvarlink();
1570 return Swig_Globals_global;
1573 #ifdef __cplusplus
1575 #endif
1577 /* -----------------------------------------------------------------------------
1578 * Pointer declarations
1579 * ----------------------------------------------------------------------------- */
1581 /* Flags for new pointer objects */
1582 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1583 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1585 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1587 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1588 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1590 #ifdef __cplusplus
1591 extern "C" {
1592 #endif
1594 /* The python void return value */
1596 SWIGRUNTIMEINLINE PyObject *
1597 SWIG_Py_Void(void) {
1598 PyObject *none = Py_None;
1599 Py_INCREF(none);
1600 return none;
1603 /* SwigPyClientData */
1605 typedef struct {
1606 PyObject *klass;
1607 PyObject *newraw;
1608 PyObject *newargs;
1609 PyObject *destroy;
1610 int delargs;
1611 int implicitconv;
1612 PyTypeObject *pytype;
1613 } SwigPyClientData;
1615 SWIGRUNTIMEINLINE int
1616 SWIG_Python_CheckImplicit(swig_type_info *ty) {
1617 SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1618 int fail = data ? data->implicitconv : 0;
1619 if (fail)
1620 PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors.");
1621 return fail;
1624 SWIGRUNTIMEINLINE PyObject *
1625 SWIG_Python_ExceptionType(swig_type_info *desc) {
1626 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1627 PyObject *klass = data ? data->klass : 0;
1628 return (klass ? klass : PyExc_RuntimeError);
1632 SWIGRUNTIME SwigPyClientData *
1633 SwigPyClientData_New(PyObject *obj) {
1634 if (!obj) {
1635 return 0;
1636 } else {
1637 SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1638 /* the klass element */
1639 data->klass = obj;
1640 Py_INCREF(data->klass);
1641 /* the newraw method and newargs arguments used to create a new raw instance */
1642 if (PyClass_Check(obj)) {
1643 data->newraw = 0;
1644 Py_INCREF(obj);
1645 data->newargs = obj;
1646 } else {
1647 data->newraw = PyObject_GetAttrString(data->klass, "__new__");
1648 if (data->newraw) {
1649 data->newargs = PyTuple_New(1);
1650 if (data->newargs) {
1651 Py_INCREF(obj);
1652 PyTuple_SET_ITEM(data->newargs, 0, obj);
1653 } else {
1654 Py_DECREF(data->newraw);
1655 Py_DECREF(data->klass);
1656 free(data);
1657 return 0;
1659 } else {
1660 Py_INCREF(obj);
1661 data->newargs = obj;
1664 /* the destroy method, aka as the C++ delete method */
1665 data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
1666 if (PyErr_Occurred()) {
1667 PyErr_Clear();
1668 data->destroy = 0;
1670 if (data->destroy) {
1671 data->delargs = !(PyCFunction_GET_FLAGS(data->destroy) & METH_O);
1672 } else {
1673 data->delargs = 0;
1675 data->implicitconv = 0;
1676 data->pytype = 0;
1677 return data;
1681 SWIGRUNTIME void
1682 SwigPyClientData_Del(SwigPyClientData *data) {
1683 Py_XDECREF(data->klass);
1684 Py_XDECREF(data->newraw);
1685 Py_XDECREF(data->newargs);
1686 Py_XDECREF(data->destroy);
1687 free(data);
1690 /* =============== SwigPyObject =====================*/
1692 typedef struct {
1693 PyObject_HEAD
1694 void *ptr;
1695 swig_type_info *ty;
1696 int own;
1697 PyObject *next;
1698 #ifdef SWIGPYTHON_BUILTIN
1699 PyObject *dict;
1700 #endif
1701 } SwigPyObject;
1704 #ifdef SWIGPYTHON_BUILTIN
1706 SWIGRUNTIME PyObject *
1707 SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1708 SwigPyObject *sobj = (SwigPyObject *)v;
1710 if (!sobj->dict)
1711 sobj->dict = PyDict_New();
1713 Py_XINCREF(sobj->dict);
1714 return sobj->dict;
1717 #endif
1719 SWIGRUNTIME PyObject *
1720 SwigPyObject_long(SwigPyObject *v) {
1721 return PyLong_FromVoidPtr(v->ptr);
1724 SWIGRUNTIME PyObject *
1725 SwigPyObject_format(const char *fmt, SwigPyObject *v) {
1726 PyObject *res = NULL;
1727 PyObject *args = PyTuple_New(1);
1728 if (args) {
1729 PyObject *val = SwigPyObject_long(v);
1730 if (val) {
1731 PyObject *ofmt;
1732 PyTuple_SET_ITEM(args, 0, val);
1733 ofmt = SWIG_Python_str_FromChar(fmt);
1734 if (ofmt) {
1735 #if PY_VERSION_HEX >= 0x03000000
1736 res = PyUnicode_Format(ofmt, args);
1737 #else
1738 res = PyString_Format(ofmt, args);
1739 #endif
1740 Py_DECREF(ofmt);
1743 Py_DECREF(args);
1745 return res;
1748 SWIGRUNTIME PyObject *
1749 SwigPyObject_oct(SwigPyObject *v) {
1750 return SwigPyObject_format("%o", v);
1753 SWIGRUNTIME PyObject *
1754 SwigPyObject_hex(SwigPyObject *v) {
1755 return SwigPyObject_format("%x", v);
1758 SWIGRUNTIME PyObject *
1759 SwigPyObject_repr(SwigPyObject *v) {
1760 const char *name = SWIG_TypePrettyName(v->ty);
1761 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
1762 if (repr && v->next) {
1763 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1764 if (nrep) {
1765 # if PY_VERSION_HEX >= 0x03000000
1766 PyObject *joined = PyUnicode_Concat(repr, nrep);
1767 Py_DecRef(repr);
1768 Py_DecRef(nrep);
1769 repr = joined;
1770 # else
1771 PyString_ConcatAndDel(&repr, nrep);
1772 # endif
1773 } else {
1774 Py_DecRef(repr);
1775 repr = NULL;
1778 return repr;
1781 /* We need a version taking two PyObject* parameters so it's a valid
1782 * PyCFunction to use in swigobject_methods[]. */
1783 SWIGRUNTIME PyObject *
1784 SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1785 return SwigPyObject_repr((SwigPyObject *)v);
1788 SWIGRUNTIME int
1789 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w) {
1790 void *i = v->ptr;
1791 void *j = w->ptr;
1792 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1795 /* Added for Python 3.x, would it also be useful for Python 2.x? */
1796 SWIGRUNTIME PyObject *
1797 SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op) {
1798 PyObject *res = NULL;
1799 if (!PyErr_Occurred()) {
1800 if (op != Py_EQ && op != Py_NE) {
1801 Py_INCREF(Py_NotImplemented);
1802 return Py_NotImplemented;
1804 res = PyBool_FromLong((SwigPyObject_compare(v, w) == 0) == (op == Py_EQ) ? 1 : 0);
1806 return res;
1810 SWIGRUNTIME PyTypeObject *SwigPyObject_TypeOnce(void);
1812 #ifdef SWIGPYTHON_BUILTIN
1813 static swig_type_info *SwigPyObject_stype = 0;
1814 SWIGRUNTIME PyTypeObject *
1815 SwigPyObject_type(void) {
1816 SwigPyClientData *cd;
1817 assert(SwigPyObject_stype);
1818 cd = (SwigPyClientData *) SwigPyObject_stype->clientdata;
1819 assert(cd);
1820 assert(cd->pytype);
1821 return cd->pytype;
1823 #else
1824 SWIGRUNTIME PyTypeObject *
1825 SwigPyObject_type(void) {
1826 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1827 return type;
1829 #endif
1831 SWIGRUNTIMEINLINE int
1832 SwigPyObject_Check(PyObject *op) {
1833 PyTypeObject *target_tp = SwigPyObject_type();
1834 PyTypeObject *op_type = Py_TYPE(op);
1835 #ifdef SWIGPYTHON_BUILTIN
1836 if (PyType_IsSubtype(op_type, target_tp))
1837 return 1;
1838 return (strcmp(op_type->tp_name, "SwigPyObject") == 0);
1839 #else
1840 if (op_type == target_tp)
1841 return 1;
1842 # ifdef Py_LIMITED_API
1843 int cmp;
1844 PyObject *tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__");
1845 if (!tp_name)
1846 return 0;
1847 cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyObject");
1848 Py_DECREF(tp_name);
1849 return cmp == 0;
1850 # else
1851 return (strcmp(op_type->tp_name, "SwigPyObject") == 0);
1852 # endif
1853 #endif
1856 SWIGRUNTIME PyObject *
1857 SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1859 static PyObject *Swig_Capsule_global = NULL;
1861 SWIGRUNTIME void
1862 SwigPyObject_dealloc(PyObject *v) {
1863 SwigPyObject *sobj = (SwigPyObject *) v;
1864 PyObject *next = sobj->next;
1865 if (sobj->own == SWIG_POINTER_OWN) {
1866 swig_type_info *ty = sobj->ty;
1867 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1868 PyObject *destroy = data ? data->destroy : 0;
1869 if (destroy) {
1870 /* destroy is always a VARARGS method */
1871 PyObject *res;
1873 /* PyObject_CallFunction() has the potential to silently drop
1874 the active exception. In cases of unnamed temporary
1875 variable or where we just finished iterating over a generator
1876 StopIteration will be active right now, and this needs to
1877 remain true upon return from SwigPyObject_dealloc. So save
1878 and restore. */
1880 PyObject *type = NULL, *value = NULL, *traceback = NULL;
1881 PyErr_Fetch(&type, &value, &traceback);
1883 if (data->delargs) {
1884 /* we need to create a temporary object to carry the destroy operation */
1885 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1886 if (tmp) {
1887 res = SWIG_Python_CallFunctor(destroy, tmp);
1888 } else {
1889 res = 0;
1891 Py_XDECREF(tmp);
1892 } else {
1893 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1894 PyObject *mself = PyCFunction_GET_SELF(destroy);
1895 res = ((*meth)(mself, v));
1897 if (!res)
1898 PyErr_WriteUnraisable(destroy);
1900 PyErr_Restore(type, value, traceback);
1902 Py_XDECREF(res);
1904 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1905 else {
1906 const char *name = SWIG_TypePrettyName(ty);
1907 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1909 #endif
1910 Py_XDECREF(Swig_Capsule_global);
1912 Py_XDECREF(next);
1913 #ifdef SWIGPYTHON_BUILTIN
1914 Py_XDECREF(sobj->dict);
1915 #endif
1916 PyObject_DEL(v);
1919 SWIGRUNTIME PyObject *
1920 SwigPyObject_append(PyObject *v, PyObject *next) {
1921 SwigPyObject *sobj = (SwigPyObject *) v;
1922 if (!SwigPyObject_Check(next)) {
1923 PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
1924 return NULL;
1926 ((SwigPyObject *)next)->next = sobj->next;
1927 sobj->next = next;
1928 Py_INCREF(next);
1929 return SWIG_Py_Void();
1932 SWIGRUNTIME PyObject *
1933 SwigPyObject_next(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1934 SwigPyObject *sobj = (SwigPyObject *) v;
1935 if (sobj->next) {
1936 Py_INCREF(sobj->next);
1937 return sobj->next;
1938 } else {
1939 return SWIG_Py_Void();
1943 SWIGINTERN PyObject *
1944 SwigPyObject_disown(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1945 SwigPyObject *sobj = (SwigPyObject *)v;
1946 sobj->own = 0;
1947 return SWIG_Py_Void();
1950 SWIGINTERN PyObject *
1951 SwigPyObject_acquire(PyObject *v, PyObject *SWIGUNUSEDPARM(args)) {
1952 SwigPyObject *sobj = (SwigPyObject *)v;
1953 sobj->own = SWIG_POINTER_OWN;
1954 return SWIG_Py_Void();
1957 SWIGINTERN PyObject *
1958 SwigPyObject_own(PyObject *v, PyObject *args) {
1959 PyObject *val = 0;
1960 if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) {
1961 return NULL;
1962 } else {
1963 SwigPyObject *sobj = (SwigPyObject *)v;
1964 PyObject *obj = PyBool_FromLong(sobj->own);
1965 if (val) {
1966 if (PyObject_IsTrue(val)) {
1967 Py_DECREF(SwigPyObject_acquire(v, args));
1968 } else {
1969 Py_DECREF(SwigPyObject_disown(v, args));
1972 return obj;
1976 static PyMethodDef
1977 swigobject_methods[] = {
1978 {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"},
1979 {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"},
1980 {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"},
1981 {"append", SwigPyObject_append, METH_O, "appends another 'this' object"},
1982 {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"},
1983 {"__repr__", SwigPyObject_repr2, METH_NOARGS, "returns object representation"},
1984 {0, 0, 0, 0}
1987 SWIGRUNTIME PyTypeObject *
1988 SwigPyObject_TypeOnce(void) {
1989 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1990 #ifndef Py_LIMITED_API
1991 static PyNumberMethods SwigPyObject_as_number = {
1992 (binaryfunc)0, /*nb_add*/
1993 (binaryfunc)0, /*nb_subtract*/
1994 (binaryfunc)0, /*nb_multiply*/
1995 /* nb_divide removed in Python 3 */
1996 #if PY_VERSION_HEX < 0x03000000
1997 (binaryfunc)0, /*nb_divide*/
1998 #endif
1999 (binaryfunc)0, /*nb_remainder*/
2000 (binaryfunc)0, /*nb_divmod*/
2001 (ternaryfunc)0,/*nb_power*/
2002 (unaryfunc)0, /*nb_negative*/
2003 (unaryfunc)0, /*nb_positive*/
2004 (unaryfunc)0, /*nb_absolute*/
2005 (inquiry)0, /*nb_nonzero*/
2006 0, /*nb_invert*/
2007 0, /*nb_lshift*/
2008 0, /*nb_rshift*/
2009 0, /*nb_and*/
2010 0, /*nb_xor*/
2011 0, /*nb_or*/
2012 #if PY_VERSION_HEX < 0x03000000
2013 0, /*nb_coerce*/
2014 #endif
2015 (unaryfunc)SwigPyObject_long, /*nb_int*/
2016 #if PY_VERSION_HEX < 0x03000000
2017 (unaryfunc)SwigPyObject_long, /*nb_long*/
2018 #else
2019 0, /*nb_reserved*/
2020 #endif
2021 (unaryfunc)0, /*nb_float*/
2022 #if PY_VERSION_HEX < 0x03000000
2023 (unaryfunc)SwigPyObject_oct, /*nb_oct*/
2024 (unaryfunc)SwigPyObject_hex, /*nb_hex*/
2025 #endif
2026 #if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
2027 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
2028 #elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
2029 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
2030 #else
2031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_index */
2032 #endif
2035 static PyTypeObject swigpyobject_type;
2036 static int type_init = 0;
2037 if (!type_init) {
2038 const PyTypeObject tmp = {
2039 #if PY_VERSION_HEX >= 0x03000000
2040 PyVarObject_HEAD_INIT(NULL, 0)
2041 #else
2042 PyObject_HEAD_INIT(NULL)
2043 0, /* ob_size */
2044 #endif
2045 "SwigPyObject", /* tp_name */
2046 sizeof(SwigPyObject), /* tp_basicsize */
2047 0, /* tp_itemsize */
2048 (destructor)SwigPyObject_dealloc, /* tp_dealloc */
2049 #if PY_VERSION_HEX < 0x030800b4
2050 (printfunc)0, /*tp_print*/
2051 #else
2052 (Py_ssize_t)0, /*tp_vectorcall_offset*/
2053 #endif
2054 (getattrfunc)0, /* tp_getattr */
2055 (setattrfunc)0, /* tp_setattr */
2056 #if PY_VERSION_HEX >= 0x03000000
2057 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
2058 #else
2059 (cmpfunc)SwigPyObject_compare, /* tp_compare */
2060 #endif
2061 (reprfunc)SwigPyObject_repr, /* tp_repr */
2062 &SwigPyObject_as_number, /* tp_as_number */
2063 0, /* tp_as_sequence */
2064 0, /* tp_as_mapping */
2065 (hashfunc)0, /* tp_hash */
2066 (ternaryfunc)0, /* tp_call */
2067 0, /* tp_str */
2068 PyObject_GenericGetAttr, /* tp_getattro */
2069 0, /* tp_setattro */
2070 0, /* tp_as_buffer */
2071 Py_TPFLAGS_DEFAULT, /* tp_flags */
2072 swigobject_doc, /* tp_doc */
2073 0, /* tp_traverse */
2074 0, /* tp_clear */
2075 (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
2076 0, /* tp_weaklistoffset */
2077 0, /* tp_iter */
2078 0, /* tp_iternext */
2079 swigobject_methods, /* tp_methods */
2080 0, /* tp_members */
2081 0, /* tp_getset */
2082 0, /* tp_base */
2083 0, /* tp_dict */
2084 0, /* tp_descr_get */
2085 0, /* tp_descr_set */
2086 0, /* tp_dictoffset */
2087 0, /* tp_init */
2088 0, /* tp_alloc */
2089 0, /* tp_new */
2090 0, /* tp_free */
2091 0, /* tp_is_gc */
2092 0, /* tp_bases */
2093 0, /* tp_mro */
2094 0, /* tp_cache */
2095 0, /* tp_subclasses */
2096 0, /* tp_weaklist */
2097 0, /* tp_del */
2098 0, /* tp_version_tag */
2099 #if PY_VERSION_HEX >= 0x03040000
2100 0, /* tp_finalize */
2101 #endif
2102 #if PY_VERSION_HEX >= 0x03080000
2103 0, /* tp_vectorcall */
2104 #endif
2105 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
2106 0, /* tp_print */
2107 #endif
2108 #if PY_VERSION_HEX >= 0x030C0000
2109 0, /* tp_watched */
2110 #endif
2111 #ifdef COUNT_ALLOCS
2112 0, /* tp_allocs */
2113 0, /* tp_frees */
2114 0, /* tp_maxalloc */
2115 0, /* tp_prev */
2116 0 /* tp_next */
2117 #endif
2119 swigpyobject_type = tmp;
2120 type_init = 1;
2121 if (PyType_Ready(&swigpyobject_type) != 0)
2122 return NULL;
2124 return &swigpyobject_type;
2125 #else
2126 PyType_Slot slots[] = {
2127 { Py_tp_dealloc, (void *)SwigPyObject_dealloc },
2128 { Py_tp_repr, (void *)SwigPyObject_repr },
2129 { Py_tp_getattro, (void *)PyObject_GenericGetAttr },
2130 { Py_tp_doc, (void *)swigobject_doc },
2131 { Py_tp_richcompare, (void *)SwigPyObject_richcompare },
2132 { Py_tp_methods, (void *)swigobject_methods },
2133 { Py_nb_int, (void *)SwigPyObject_long },
2134 { 0, NULL }
2136 PyType_Spec spec = {
2137 "SwigPyObject",
2138 sizeof(SwigPyObject),
2140 Py_TPFLAGS_DEFAULT,
2141 slots
2143 return (PyTypeObject *)PyType_FromSpec(&spec);
2144 #endif
2147 SWIGRUNTIME PyObject *
2148 SwigPyObject_New(void *ptr, swig_type_info *ty, int own) {
2149 SwigPyObject *sobj = PyObject_New(SwigPyObject, SwigPyObject_type());
2150 if (sobj) {
2151 sobj->ptr = ptr;
2152 sobj->ty = ty;
2153 sobj->own = own;
2154 sobj->next = 0;
2155 #ifdef SWIGPYTHON_BUILTIN
2156 sobj->dict = 0;
2157 #endif
2158 if (own == SWIG_POINTER_OWN) {
2159 /* Obtain a reference to the Python capsule wrapping the module information, so that the
2160 * module information is correctly destroyed after all SWIG python objects have been freed
2161 * by the GC (and corresponding destructors invoked) */
2162 Py_XINCREF(Swig_Capsule_global);
2165 return (PyObject *)sobj;
2168 /* -----------------------------------------------------------------------------
2169 * Implements a simple Swig Packed type, and use it instead of string
2170 * ----------------------------------------------------------------------------- */
2172 typedef struct {
2173 PyObject_HEAD
2174 void *pack;
2175 swig_type_info *ty;
2176 size_t size;
2177 } SwigPyPacked;
2179 SWIGRUNTIME PyObject *
2180 SwigPyPacked_repr(SwigPyPacked *v) {
2181 char result[SWIG_BUFFER_SIZE];
2182 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
2183 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
2184 } else {
2185 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
2189 SWIGRUNTIME PyObject *
2190 SwigPyPacked_str(SwigPyPacked *v) {
2191 char result[SWIG_BUFFER_SIZE];
2192 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
2193 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
2194 } else {
2195 return SWIG_Python_str_FromChar(v->ty->name);
2199 SWIGRUNTIME int
2200 SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w) {
2201 size_t i = v->size;
2202 size_t j = w->size;
2203 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
2204 return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2 * v->size);
2207 SWIGRUNTIME PyTypeObject *SwigPyPacked_TypeOnce(void);
2209 SWIGRUNTIME PyTypeObject *
2210 SwigPyPacked_type(void) {
2211 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
2212 return type;
2215 SWIGRUNTIMEINLINE int
2216 SwigPyPacked_Check(PyObject *op) {
2217 PyTypeObject *op_type = Py_TYPE(op);
2218 if (op_type == SwigPyPacked_TypeOnce())
2219 return 1;
2220 #ifdef Py_LIMITED_API
2221 int cmp;
2222 PyObject *tp_name = PyObject_GetAttrString((PyObject *)op_type, "__name__");
2223 if (!tp_name)
2224 return 0;
2225 cmp = PyUnicode_CompareWithASCIIString(tp_name, "SwigPyPacked");
2226 Py_DECREF(tp_name);
2227 return cmp == 0;
2228 #else
2229 return (strcmp(op_type->tp_name, "SwigPyPacked") == 0);
2230 #endif
2233 SWIGRUNTIME void
2234 SwigPyPacked_dealloc(PyObject *v) {
2235 if (SwigPyPacked_Check(v)) {
2236 SwigPyPacked *sobj = (SwigPyPacked *) v;
2237 free(sobj->pack);
2239 PyObject_DEL(v);
2242 SWIGRUNTIME PyTypeObject *
2243 SwigPyPacked_TypeOnce(void) {
2244 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
2245 #ifndef Py_LIMITED_API
2246 static PyTypeObject swigpypacked_type;
2247 static int type_init = 0;
2248 if (!type_init) {
2249 const PyTypeObject tmp = {
2250 #if PY_VERSION_HEX>=0x03000000
2251 PyVarObject_HEAD_INIT(NULL, 0)
2252 #else
2253 PyObject_HEAD_INIT(NULL)
2254 0, /* ob_size */
2255 #endif
2256 "SwigPyPacked", /* tp_name */
2257 sizeof(SwigPyPacked), /* tp_basicsize */
2258 0, /* tp_itemsize */
2259 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */
2260 #if PY_VERSION_HEX < 0x030800b4
2261 (printfunc)0, /*tp_print*/
2262 #else
2263 (Py_ssize_t)0, /*tp_vectorcall_offset*/
2264 #endif
2265 (getattrfunc)0, /* tp_getattr */
2266 (setattrfunc)0, /* tp_setattr */
2267 #if PY_VERSION_HEX>=0x03000000
2268 0, /* tp_reserved in 3.0.1 */
2269 #else
2270 (cmpfunc)SwigPyPacked_compare, /* tp_compare */
2271 #endif
2272 (reprfunc)SwigPyPacked_repr, /* tp_repr */
2273 0, /* tp_as_number */
2274 0, /* tp_as_sequence */
2275 0, /* tp_as_mapping */
2276 (hashfunc)0, /* tp_hash */
2277 (ternaryfunc)0, /* tp_call */
2278 (reprfunc)SwigPyPacked_str, /* tp_str */
2279 PyObject_GenericGetAttr, /* tp_getattro */
2280 0, /* tp_setattro */
2281 0, /* tp_as_buffer */
2282 Py_TPFLAGS_DEFAULT, /* tp_flags */
2283 swigpacked_doc, /* tp_doc */
2284 0, /* tp_traverse */
2285 0, /* tp_clear */
2286 0, /* tp_richcompare */
2287 0, /* tp_weaklistoffset */
2288 0, /* tp_iter */
2289 0, /* tp_iternext */
2290 0, /* tp_methods */
2291 0, /* tp_members */
2292 0, /* tp_getset */
2293 0, /* tp_base */
2294 0, /* tp_dict */
2295 0, /* tp_descr_get */
2296 0, /* tp_descr_set */
2297 0, /* tp_dictoffset */
2298 0, /* tp_init */
2299 0, /* tp_alloc */
2300 0, /* tp_new */
2301 0, /* tp_free */
2302 0, /* tp_is_gc */
2303 0, /* tp_bases */
2304 0, /* tp_mro */
2305 0, /* tp_cache */
2306 0, /* tp_subclasses */
2307 0, /* tp_weaklist */
2308 0, /* tp_del */
2309 0, /* tp_version_tag */
2310 #if PY_VERSION_HEX >= 0x03040000
2311 0, /* tp_finalize */
2312 #endif
2313 #if PY_VERSION_HEX >= 0x03080000
2314 0, /* tp_vectorcall */
2315 #endif
2316 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
2317 0, /* tp_print */
2318 #endif
2319 #if PY_VERSION_HEX >= 0x030C0000
2320 0, /* tp_watched */
2321 #endif
2322 #ifdef COUNT_ALLOCS
2323 0, /* tp_allocs */
2324 0, /* tp_frees */
2325 0, /* tp_maxalloc */
2326 0, /* tp_prev */
2327 0 /* tp_next */
2328 #endif
2330 swigpypacked_type = tmp;
2331 type_init = 1;
2332 if (PyType_Ready(&swigpypacked_type) != 0)
2333 return NULL;
2335 return &swigpypacked_type;
2336 #else
2337 PyType_Slot slots[] = {
2338 { Py_tp_dealloc, (void *)SwigPyPacked_dealloc },
2339 { Py_tp_repr, (void *)SwigPyPacked_repr },
2340 { Py_tp_str, (void *)SwigPyPacked_str },
2341 { Py_tp_getattro, (void *)PyObject_GenericGetAttr },
2342 { Py_tp_doc, (void *)swigpacked_doc },
2343 { 0, NULL }
2345 PyType_Spec spec = {
2346 "SwigPyPacked",
2347 sizeof(SwigPyPacked),
2349 Py_TPFLAGS_DEFAULT,
2350 slots
2352 return (PyTypeObject *)PyType_FromSpec(&spec);
2353 #endif
2356 SWIGRUNTIME PyObject *
2357 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty) {
2358 SwigPyPacked *sobj = PyObject_New(SwigPyPacked, SwigPyPacked_type());
2359 if (sobj) {
2360 void *pack = malloc(size);
2361 if (pack) {
2362 memcpy(pack, ptr, size);
2363 sobj->pack = pack;
2364 sobj->ty = ty;
2365 sobj->size = size;
2366 } else {
2367 PyObject_DEL((PyObject *) sobj);
2368 sobj = 0;
2371 return (PyObject *) sobj;
2374 SWIGRUNTIME swig_type_info *
2375 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size) {
2376 if (SwigPyPacked_Check(obj)) {
2377 SwigPyPacked *sobj = (SwigPyPacked *)obj;
2378 if (sobj->size != size) return 0;
2379 memcpy(ptr, sobj->pack, size);
2380 return sobj->ty;
2381 } else {
2382 return 0;
2386 /* -----------------------------------------------------------------------------
2387 * pointers/data manipulation
2388 * ----------------------------------------------------------------------------- */
2390 static PyObject *Swig_This_global = NULL;
2392 SWIGRUNTIME PyObject *
2393 SWIG_This(void) {
2394 if (Swig_This_global == NULL)
2395 Swig_This_global = SWIG_Python_str_FromChar("this");
2396 return Swig_This_global;
2399 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
2401 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
2402 #if PY_VERSION_HEX>=0x03000000
2403 #define SWIG_PYTHON_SLOW_GETSET_THIS
2404 #endif
2406 SWIGRUNTIME SwigPyObject *
2407 SWIG_Python_GetSwigThis(PyObject *pyobj) {
2408 PyObject *obj;
2410 if (SwigPyObject_Check(pyobj))
2411 return (SwigPyObject *) pyobj;
2413 #ifdef SWIGPYTHON_BUILTIN
2414 (void)obj;
2415 # ifdef PyWeakref_CheckProxy
2416 if (PyWeakref_CheckProxy(pyobj)) {
2417 pyobj = PyWeakref_GET_OBJECT(pyobj);
2418 if (pyobj && SwigPyObject_Check(pyobj))
2419 return (SwigPyObject *) pyobj;
2421 # endif
2422 return NULL;
2423 #else
2425 obj = 0;
2427 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2428 if (PyInstance_Check(pyobj)) {
2429 obj = _PyInstance_Lookup(pyobj, SWIG_This());
2430 } else {
2431 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2432 if (dictptr != NULL) {
2433 PyObject *dict = *dictptr;
2434 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
2435 } else {
2436 #ifdef PyWeakref_CheckProxy
2437 if (PyWeakref_CheckProxy(pyobj)) {
2438 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2439 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2441 #endif
2442 obj = PyObject_GetAttr(pyobj, SWIG_This());
2443 if (obj) {
2444 Py_DECREF(obj);
2445 } else {
2446 if (PyErr_Occurred()) PyErr_Clear();
2447 return 0;
2451 #else
2452 obj = PyObject_GetAttr(pyobj, SWIG_This());
2453 if (obj) {
2454 Py_DECREF(obj);
2455 } else {
2456 if (PyErr_Occurred()) PyErr_Clear();
2457 return 0;
2459 #endif
2460 if (obj && !SwigPyObject_Check(obj)) {
2461 /* a PyObject is called 'this', try to get the 'real this'
2462 SwigPyObject from it */
2463 return SWIG_Python_GetSwigThis(obj);
2465 return (SwigPyObject *)obj;
2466 #endif
2469 /* Acquire a pointer value */
2471 SWIGRUNTIME int
2472 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2473 if (own == SWIG_POINTER_OWN) {
2474 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2475 if (sobj) {
2476 int oldown = sobj->own;
2477 sobj->own = own;
2478 return oldown;
2481 return 0;
2484 /* Convert a pointer value */
2486 SWIGRUNTIME int
2487 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2488 int res;
2489 SwigPyObject *sobj;
2490 int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;
2492 if (!obj)
2493 return SWIG_ERROR;
2494 if (obj == Py_None && !implicit_conv) {
2495 if (ptr)
2496 *ptr = 0;
2497 return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
2500 res = SWIG_ERROR;
2502 sobj = SWIG_Python_GetSwigThis(obj);
2503 if (own)
2504 *own = 0;
2505 while (sobj) {
2506 void *vptr = sobj->ptr;
2507 if (ty) {
2508 swig_type_info *to = sobj->ty;
2509 if (to == ty) {
2510 /* no type cast needed */
2511 if (ptr) *ptr = vptr;
2512 break;
2513 } else {
2514 swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
2515 if (!tc) {
2516 sobj = (SwigPyObject *)sobj->next;
2517 } else {
2518 if (ptr) {
2519 int newmemory = 0;
2520 *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
2521 if (newmemory == SWIG_CAST_NEW_MEMORY) {
2522 assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2523 if (own)
2524 *own = *own | SWIG_CAST_NEW_MEMORY;
2527 break;
2530 } else {
2531 if (ptr) *ptr = vptr;
2532 break;
2535 if (sobj) {
2536 if (((flags & SWIG_POINTER_RELEASE) == SWIG_POINTER_RELEASE) && !sobj->own) {
2537 res = SWIG_ERROR_RELEASE_NOT_OWNED;
2538 } else {
2539 if (own)
2540 *own = *own | sobj->own;
2541 if (flags & SWIG_POINTER_DISOWN) {
2542 sobj->own = 0;
2544 if (flags & SWIG_POINTER_CLEAR) {
2545 sobj->ptr = 0;
2547 res = SWIG_OK;
2549 } else {
2550 if (implicit_conv) {
2551 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2552 if (data && !data->implicitconv) {
2553 PyObject *klass = data->klass;
2554 if (klass) {
2555 PyObject *impconv;
2556 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2557 impconv = SWIG_Python_CallFunctor(klass, obj);
2558 data->implicitconv = 0;
2559 if (PyErr_Occurred()) {
2560 PyErr_Clear();
2561 impconv = 0;
2563 if (impconv) {
2564 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2565 if (iobj) {
2566 void *vptr;
2567 res = SWIG_Python_ConvertPtrAndOwn((PyObject *)iobj, &vptr, ty, 0, 0);
2568 if (SWIG_IsOK(res)) {
2569 if (ptr) {
2570 *ptr = vptr;
2571 /* transfer the ownership to 'ptr' */
2572 iobj->own = 0;
2573 res = SWIG_AddCast(res);
2574 res = SWIG_AddNewMask(res);
2575 } else {
2576 res = SWIG_AddCast(res);
2580 Py_DECREF(impconv);
2584 if (!SWIG_IsOK(res) && obj == Py_None) {
2585 if (ptr)
2586 *ptr = 0;
2587 if (PyErr_Occurred())
2588 PyErr_Clear();
2589 res = SWIG_OK;
2593 return res;
2596 /* Convert a function ptr value */
2598 SWIGRUNTIME int
2599 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2600 if (!PyCFunction_Check(obj)) {
2601 return SWIG_ConvertPtr(obj, ptr, ty, 0);
2602 } else {
2603 void *vptr = 0;
2604 swig_cast_info *tc;
2606 /* here we get the method pointer for callbacks */
2607 #ifndef Py_LIMITED_API
2608 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2609 #else
2610 PyObject *pystr_doc = PyObject_GetAttrString(obj, "__doc__");
2611 PyObject *bytes = NULL;
2612 const char *doc = pystr_doc ? SWIG_PyUnicode_AsUTF8AndSize(pystr_doc, NULL, &bytes) : 0;
2613 #endif
2614 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2615 if (desc)
2616 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2617 #ifdef Py_LIMITED_API
2618 Py_XDECREF(bytes);
2619 Py_XDECREF(pystr_doc);
2620 #endif
2621 if (!desc)
2622 return SWIG_ERROR;
2623 tc = SWIG_TypeCheck(desc, ty);
2624 if (tc) {
2625 int newmemory = 0;
2626 *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
2627 assert(!newmemory); /* newmemory handling not yet implemented */
2628 } else {
2629 return SWIG_ERROR;
2631 return SWIG_OK;
2635 /* Convert a packed pointer value */
2637 SWIGRUNTIME int
2638 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2639 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2640 if (!to) return SWIG_ERROR;
2641 if (ty) {
2642 if (to != ty) {
2643 /* check type cast? */
2644 swig_cast_info *tc = SWIG_TypeCheck(to->name, ty);
2645 if (!tc) return SWIG_ERROR;
2648 return SWIG_OK;
2651 /* -----------------------------------------------------------------------------
2652 * Create a new pointer object
2653 * ----------------------------------------------------------------------------- */
2656 Create a new instance object, without calling __init__, and set the
2657 'this' attribute.
2660 SWIGRUNTIME PyObject *
2661 SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this) {
2662 PyObject *inst = 0;
2663 PyObject *newraw = data->newraw;
2664 if (newraw) {
2665 inst = PyObject_Call(newraw, data->newargs, NULL);
2666 if (inst) {
2667 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2668 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2669 if (dictptr != NULL) {
2670 PyObject *dict = *dictptr;
2671 if (dict == NULL) {
2672 dict = PyDict_New();
2673 *dictptr = dict;
2675 if (dict) {
2676 PyDict_SetItem(dict, SWIG_This(), swig_this);
2677 } else {
2678 Py_DECREF(inst);
2679 inst = 0;
2682 #else
2683 if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
2684 Py_DECREF(inst);
2685 inst = 0;
2687 #endif
2689 } else {
2690 #if PY_VERSION_HEX >= 0x03000000
2691 PyObject *empty_args = PyTuple_New(0);
2692 if (empty_args) {
2693 PyObject *empty_kwargs = PyDict_New();
2694 if (empty_kwargs) {
2695 #ifndef Py_LIMITED_API
2696 newfunc newfn = ((PyTypeObject *)data->newargs)->tp_new;
2697 #else
2698 newfunc newfn = (newfunc)PyType_GetSlot((PyTypeObject *)data->newargs, Py_tp_new);
2699 #endif
2700 inst = newfn((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
2701 Py_DECREF(empty_kwargs);
2702 if (inst) {
2703 if (PyObject_SetAttr(inst, SWIG_This(), swig_this) == -1) {
2704 Py_DECREF(inst);
2705 inst = 0;
2706 } else {
2707 PyType_Modified(Py_TYPE(inst));
2711 Py_DECREF(empty_args);
2713 #else
2714 PyObject *dict = PyDict_New();
2715 if (dict) {
2716 PyDict_SetItem(dict, SWIG_This(), swig_this);
2717 inst = PyInstance_NewRaw(data->newargs, dict);
2718 Py_DECREF(dict);
2720 #endif
2722 return inst;
2725 SWIGRUNTIME int
2726 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this) {
2727 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2728 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2729 if (dictptr != NULL) {
2730 PyObject *dict = *dictptr;
2731 if (dict == NULL) {
2732 dict = PyDict_New();
2733 *dictptr = dict;
2735 if (dict) {
2736 return PyDict_SetItem(dict, SWIG_This(), swig_this);
2737 } else {
2738 return -1;
2741 #endif
2742 return PyObject_SetAttr(inst, SWIG_This(), swig_this);
2746 SWIGINTERN PyObject *
2747 SWIG_Python_InitShadowInstance(PyObject *args) {
2748 PyObject *obj[2];
2749 if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
2750 return NULL;
2751 } else {
2752 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2753 if (sthis) {
2754 Py_DECREF(SwigPyObject_append((PyObject *) sthis, obj[1]));
2755 } else {
2756 if (SWIG_Python_SetSwigThis(obj[0], obj[1]) != 0)
2757 return NULL;
2759 return SWIG_Py_Void();
2763 /* Create a new pointer object */
2765 SWIGRUNTIME PyObject *
2766 SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2767 SwigPyClientData *clientdata;
2768 PyObject *robj;
2769 int own;
2771 if (!ptr)
2772 return SWIG_Py_Void();
2774 clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2775 own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2776 if (clientdata && clientdata->pytype) {
2777 SwigPyObject *newobj;
2778 if (flags & SWIG_BUILTIN_TP_INIT) {
2779 newobj = (SwigPyObject *) self;
2780 if (newobj->ptr) {
2781 #ifndef Py_LIMITED_API
2782 allocfunc alloc = clientdata->pytype->tp_alloc;
2783 #else
2784 allocfunc alloc = (allocfunc)PyType_GetSlot(clientdata->pytype, Py_tp_alloc);
2785 #endif
2786 PyObject *next_self = alloc(clientdata->pytype, 0);
2787 while (newobj->next)
2788 newobj = (SwigPyObject *) newobj->next;
2789 newobj->next = next_self;
2790 newobj = (SwigPyObject *)next_self;
2791 #ifdef SWIGPYTHON_BUILTIN
2792 newobj->dict = 0;
2793 #endif
2795 } else {
2796 newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2797 #ifdef SWIGPYTHON_BUILTIN
2798 if (newobj) {
2799 newobj->dict = 0;
2801 #endif
2803 if (newobj) {
2804 newobj->ptr = ptr;
2805 newobj->ty = type;
2806 newobj->own = own;
2807 newobj->next = 0;
2808 return (PyObject *) newobj;
2810 return SWIG_Py_Void();
2813 assert(!(flags & SWIG_BUILTIN_TP_INIT));
2815 robj = SwigPyObject_New(ptr, type, own);
2816 if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2817 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2818 Py_DECREF(robj);
2819 robj = inst;
2821 return robj;
2824 /* Create a new packed object */
2826 SWIGRUNTIMEINLINE PyObject *
2827 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2828 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2831 /* -----------------------------------------------------------------------------*
2832 * Get type list
2833 * -----------------------------------------------------------------------------*/
2835 #ifdef SWIG_LINK_RUNTIME
2836 void *SWIG_ReturnGlobalTypeList(void *);
2837 #endif
2839 static PyObject *Swig_TypeCache_global = NULL;
2841 /* The python cached type query */
2842 SWIGRUNTIME PyObject *
2843 SWIG_Python_TypeCache(void) {
2844 if (Swig_TypeCache_global == NULL) {
2845 Swig_TypeCache_global = PyDict_New();
2847 return Swig_TypeCache_global;
2850 SWIGRUNTIME swig_module_info *
2851 SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
2852 #ifdef SWIG_LINK_RUNTIME
2853 static void *type_pointer = (void *)0;
2854 /* first check if module already created */
2855 if (!type_pointer) {
2856 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2858 #else
2859 void *type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2860 if (PyErr_Occurred()) {
2861 PyErr_Clear();
2862 type_pointer = (void *)0;
2864 #endif
2865 return (swig_module_info *) type_pointer;
2869 static int interpreter_counter = 0; /* how many (sub-)interpreters are using swig_module's types */
2871 SWIGRUNTIME void
2872 SWIG_Python_DestroyModule(PyObject *obj) {
2873 swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2874 swig_type_info **types = swig_module->types;
2875 size_t i;
2876 if (--interpreter_counter != 0) /* another sub-interpreter may still be using the swig_module's types */
2877 return;
2878 for (i = 0; i < swig_module->size; ++i) {
2879 swig_type_info *ty = types[i];
2880 if (ty->owndata) {
2881 SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
2882 ty->clientdata = 0;
2883 if (data) SwigPyClientData_Del(data);
2886 Py_DECREF(SWIG_This());
2887 Swig_This_global = NULL;
2888 Py_DECREF(SWIG_globals());
2889 Swig_Globals_global = NULL;
2890 Py_DECREF(SWIG_Python_TypeCache());
2891 Swig_TypeCache_global = NULL;
2892 Swig_Capsule_global = NULL;
2895 SWIGRUNTIME void
2896 SWIG_Python_SetModule(swig_module_info *swig_module) {
2897 #if PY_VERSION_HEX >= 0x03000000
2898 /* Add a dummy module object into sys.modules */
2899 PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION);
2900 #else
2901 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2902 PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2903 #endif
2904 PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2905 if (pointer && module) {
2906 if (PyModule_AddObject(module, SWIGPY_CAPSULE_ATTR_NAME, pointer) == 0) {
2907 ++interpreter_counter;
2908 Swig_Capsule_global = pointer;
2909 } else {
2910 Py_DECREF(pointer);
2912 } else {
2913 Py_XDECREF(pointer);
2917 SWIGRUNTIME swig_type_info *
2918 SWIG_Python_TypeQuery(const char *type) {
2919 PyObject *cache = SWIG_Python_TypeCache();
2920 PyObject *key = SWIG_Python_str_FromChar(type);
2921 PyObject *obj = PyDict_GetItem(cache, key);
2922 swig_type_info *descriptor;
2923 if (obj) {
2924 descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2925 } else {
2926 swig_module_info *swig_module = SWIG_GetModule(0);
2927 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2928 if (descriptor) {
2929 obj = PyCapsule_New((void *) descriptor, NULL, NULL);
2930 if (obj) {
2931 PyDict_SetItem(cache, key, obj);
2932 Py_DECREF(obj);
2936 Py_DECREF(key);
2937 return descriptor;
2941 For backward compatibility only
2943 #define SWIG_POINTER_EXCEPTION 0
2944 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2945 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2947 SWIGRUNTIME int
2948 SWIG_Python_AddErrMesg(const char *mesg, int infront) {
2949 if (PyErr_Occurred()) {
2950 PyObject *type = 0;
2951 PyObject *value = 0;
2952 PyObject *traceback = 0;
2953 PyErr_Fetch(&type, &value, &traceback);
2954 if (value) {
2955 PyObject *old_str = PyObject_Str(value);
2956 PyObject *bytes = NULL;
2957 const char *tmp = SWIG_PyUnicode_AsUTF8AndSize(old_str, NULL, &bytes);
2958 const char *errmesg = tmp ? tmp : "Invalid error message";
2959 Py_XINCREF(type);
2960 PyErr_Clear();
2961 if (infront) {
2962 PyErr_Format(type, "%s %s", mesg, errmesg);
2963 } else {
2964 PyErr_Format(type, "%s %s", errmesg, mesg);
2966 Py_XDECREF(bytes);
2967 Py_DECREF(old_str);
2969 return 1;
2970 } else {
2971 return 0;
2975 SWIGRUNTIME int
2976 SWIG_Python_ArgFail(int argnum) {
2977 if (PyErr_Occurred()) {
2978 /* add information about failing argument */
2979 char mesg[256];
2980 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2981 return SWIG_Python_AddErrMesg(mesg, 1);
2982 } else {
2983 return 0;
2987 SWIGRUNTIMEINLINE const char *
2988 SwigPyObject_GetDesc(PyObject *self) {
2989 SwigPyObject *v = (SwigPyObject *)self;
2990 swig_type_info *ty = v ? v->ty : 0;
2991 return ty ? ty->str : "";
2994 SWIGRUNTIME void
2995 SWIG_Python_TypeError(const char *type, PyObject *obj) {
2996 if (type) {
2997 #if defined(SWIG_COBJECT_TYPES)
2998 if (obj && SwigPyObject_Check(obj)) {
2999 const char *otype = (const char *) SwigPyObject_GetDesc(obj);
3000 if (otype) {
3001 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
3002 type, otype);
3003 return;
3005 } else
3006 #endif
3008 #ifndef Py_LIMITED_API
3009 /* tp_name is not accessible */
3010 const char *otype = (obj ? obj->ob_type->tp_name : 0);
3011 if (otype) {
3012 PyObject *str = PyObject_Str(obj);
3013 PyObject *bytes = NULL;
3014 const char *cstr = str ? SWIG_PyUnicode_AsUTF8AndSize(str, NULL, &bytes) : 0;
3015 if (cstr) {
3016 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
3017 type, otype, cstr);
3018 } else {
3019 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
3020 type, otype);
3022 Py_XDECREF(bytes);
3023 Py_XDECREF(str);
3024 return;
3026 #endif
3028 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
3029 } else {
3030 PyErr_Format(PyExc_TypeError, "unexpected type is received");
3035 /* Convert a pointer value, signal an exception on a type mismatch */
3036 SWIGRUNTIME void *
3037 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
3038 void *result;
3039 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
3040 PyErr_Clear();
3042 return result;
3045 #ifdef SWIGPYTHON_BUILTIN
3046 SWIGRUNTIME int
3047 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
3048 PyTypeObject *tp = obj->ob_type;
3049 PyObject *descr;
3050 PyObject *encoded_name;
3051 descrsetfunc f;
3052 int res = -1;
3054 # ifdef Py_USING_UNICODE
3055 if (PyString_Check(name)) {
3056 name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
3057 if (!name)
3058 return -1;
3059 } else if (!PyUnicode_Check(name))
3060 # else
3061 if (!PyString_Check(name))
3062 # endif
3064 PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
3065 return -1;
3066 } else {
3067 Py_INCREF(name);
3070 if (!tp->tp_dict) {
3071 if (PyType_Ready(tp) != 0)
3072 goto done;
3075 descr = _PyType_Lookup(tp, name);
3076 f = NULL;
3077 if (descr != NULL)
3078 f = descr->ob_type->tp_descr_set;
3079 if (!f) {
3080 if (PyString_Check(name)) {
3081 encoded_name = name;
3082 Py_INCREF(name);
3083 } else {
3084 encoded_name = PyUnicode_AsUTF8String(name);
3085 if (!encoded_name)
3086 goto done;
3088 PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
3089 Py_DECREF(encoded_name);
3090 } else {
3091 res = f(descr, obj, value);
3094 done:
3095 Py_DECREF(name);
3096 return res;
3098 #endif
3101 #ifdef __cplusplus
3103 #endif
3107 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
3109 #define SWIG_contract_assert(expr, msg) do { if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } } while (0)
3113 /* -------- TYPES TABLE (BEGIN) -------- */
3115 #define SWIGTYPE_p_char swig_types[0]
3116 #define SWIGTYPE_p_pm3 swig_types[1]
3117 static swig_type_info *swig_types[3];
3118 static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
3119 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
3120 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
3122 /* -------- TYPES TABLE (END) -------- */
3124 #ifdef SWIG_TypeQuery
3125 # undef SWIG_TypeQuery
3126 #endif
3127 #define SWIG_TypeQuery SWIG_Python_TypeQuery
3129 /*-----------------------------------------------
3130 @(target):= _pm3.so
3131 ------------------------------------------------*/
3132 #if PY_VERSION_HEX >= 0x03000000
3133 # define SWIG_init PyInit__pm3
3135 #else
3136 # define SWIG_init init_pm3
3138 #endif
3139 #define SWIG_name "_pm3"
3141 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
3142 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
3145 /* Include the header in the wrapper code */
3146 #include "pm3.h"
3147 #include "comms.h"
3149 SWIGINTERN pm3 *new_pm3__SWIG_0(void) {
3150 // printf("SWIG pm3 constructor, get current pm3\n");
3151 pm3_device_t *p = pm3_get_current_dev();
3152 p->script_embedded = 1;
3153 return p;
3156 SWIGINTERN swig_type_info *
3157 SWIG_pchar_descriptor(void) {
3158 static int init = 0;
3159 static swig_type_info *info = 0;
3160 if (!init) {
3161 info = SWIG_TypeQuery("_p_char");
3162 init = 1;
3164 return info;
3168 /* Return string from Python obj. NOTE: obj must remain in scope in order
3169 to use the returned cptr (but only when alloc is set to SWIG_OLDOBJ) */
3170 SWIGINTERN int
3171 SWIG_AsCharPtrAndSize(PyObject *obj, char **cptr, size_t *psize, int *alloc) {
3172 #if PY_VERSION_HEX>=0x03000000
3173 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3174 if (PyBytes_Check(obj))
3175 #else
3176 if (PyUnicode_Check(obj))
3177 #endif
3178 #else
3179 if (PyString_Check(obj))
3180 #endif
3182 char *cstr;
3183 Py_ssize_t len;
3184 PyObject *bytes = NULL;
3185 int ret = SWIG_OK;
3186 if (alloc)
3187 *alloc = SWIG_OLDOBJ;
3188 #if PY_VERSION_HEX>=0x03000000 && defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3189 if (PyBytes_AsStringAndSize(obj, &cstr, &len) == -1)
3190 return SWIG_TypeError;
3191 #else
3192 cstr = (char *)SWIG_PyUnicode_AsUTF8AndSize(obj, &len, &bytes);
3193 if (!cstr)
3194 return SWIG_TypeError;
3195 /* The returned string is only duplicated if the char * returned is not owned and memory managed by obj */
3196 if (bytes && cptr) {
3197 if (alloc) {
3198 cstr = (char *)memcpy(malloc((len + 1) * sizeof(char)), cstr, sizeof(char) * (len + 1));
3199 *alloc = SWIG_NEWOBJ;
3200 } else {
3201 /* alloc must be set in order to clean up allocated memory */
3202 return SWIG_RuntimeError;
3205 #endif
3206 if (cptr) *cptr = cstr;
3207 if (psize) *psize = len + 1;
3208 Py_XDECREF(bytes);
3209 return ret;
3210 } else {
3211 #if defined(SWIG_PYTHON_2_UNICODE)
3212 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3213 #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
3214 #endif
3215 #if PY_VERSION_HEX<0x03000000
3216 if (PyUnicode_Check(obj)) {
3217 char *cstr;
3218 Py_ssize_t len;
3219 if (!alloc && cptr) {
3220 return SWIG_RuntimeError;
3222 obj = PyUnicode_AsUTF8String(obj);
3223 if (!obj)
3224 return SWIG_TypeError;
3225 if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
3226 if (cptr) {
3227 if (alloc) *alloc = SWIG_NEWOBJ;
3228 *cptr = (char *)memcpy(malloc((len + 1) * sizeof(char)), cstr, sizeof(char) * (len + 1));
3230 if (psize) *psize = len + 1;
3232 Py_XDECREF(obj);
3233 return SWIG_OK;
3234 } else {
3235 Py_XDECREF(obj);
3238 #endif
3239 #endif
3241 swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
3242 if (pchar_descriptor) {
3243 void *vptr = 0;
3244 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
3245 if (cptr) *cptr = (char *) vptr;
3246 if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
3247 if (alloc) *alloc = SWIG_OLDOBJ;
3248 return SWIG_OK;
3252 return SWIG_TypeError;
3258 SWIGINTERN pm3 *new_pm3__SWIG_1(char *port) {
3259 // printf("SWIG pm3 constructor with port, open pm3\n");
3260 pm3_device_t *p = pm3_open(port);
3261 p->script_embedded = 0;
3262 return p;
3264 SWIGINTERN void delete_pm3(pm3 *self) {
3265 if (self->script_embedded) {
3266 // printf("SWIG pm3 destructor, nothing to do\n");
3267 } else {
3268 // printf("SWIG pm3 destructor, close pm3\n");
3269 pm3_close(self);
3273 SWIGINTERN int
3274 SWIG_AsVal_double(PyObject *obj, double *val) {
3275 int res = SWIG_TypeError;
3276 if (PyFloat_Check(obj)) {
3277 if (val) *val = PyFloat_AsDouble(obj);
3278 return SWIG_OK;
3279 #if PY_VERSION_HEX < 0x03000000
3280 } else if (PyInt_Check(obj)) {
3281 if (val) *val = (double) PyInt_AsLong(obj);
3282 return SWIG_OK;
3283 #endif
3284 } else if (PyLong_Check(obj)) {
3285 double v = PyLong_AsDouble(obj);
3286 if (!PyErr_Occurred()) {
3287 if (val) *val = v;
3288 return SWIG_OK;
3289 } else {
3290 PyErr_Clear();
3293 #ifdef SWIG_PYTHON_CAST_MODE
3295 int dispatch = 0;
3296 double d = PyFloat_AsDouble(obj);
3297 if (!PyErr_Occurred()) {
3298 if (val) *val = d;
3299 return SWIG_AddCast(SWIG_OK);
3300 } else {
3301 PyErr_Clear();
3303 if (!dispatch) {
3304 long v = PyLong_AsLong(obj);
3305 if (!PyErr_Occurred()) {
3306 if (val) *val = v;
3307 return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
3308 } else {
3309 PyErr_Clear();
3313 #endif
3314 return res;
3318 #include <float.h>
3321 #include <math.h>
3324 SWIGINTERNINLINE int
3325 SWIG_CanCastAsInteger(double *d, double min, double max) {
3326 double x = *d;
3327 if ((min <= x && x <= max)) {
3328 double fx, cx, rd;
3329 errno = 0;
3330 fx = floor(x);
3331 cx = ceil(x);
3332 rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
3333 if ((errno == EDOM) || (errno == ERANGE)) {
3334 errno = 0;
3335 } else {
3336 double summ, reps, diff;
3337 if (rd < x) {
3338 diff = x - rd;
3339 } else if (rd > x) {
3340 diff = rd - x;
3341 } else {
3342 return 1;
3344 summ = rd + x;
3345 reps = diff / summ;
3346 if (reps < 8 * DBL_EPSILON) {
3347 *d = rd;
3348 return 1;
3352 return 0;
3356 SWIGINTERN int
3357 SWIG_AsVal_long(PyObject *obj, long *val) {
3358 #if PY_VERSION_HEX < 0x03000000
3359 if (PyInt_Check(obj)) {
3360 if (val) *val = PyInt_AsLong(obj);
3361 return SWIG_OK;
3362 } else
3363 #endif
3364 if (PyLong_Check(obj)) {
3365 long v = PyLong_AsLong(obj);
3366 if (!PyErr_Occurred()) {
3367 if (val) *val = v;
3368 return SWIG_OK;
3369 } else {
3370 PyErr_Clear();
3371 return SWIG_OverflowError;
3374 #ifdef SWIG_PYTHON_CAST_MODE
3376 int dispatch = 0;
3377 long v = PyInt_AsLong(obj);
3378 if (!PyErr_Occurred()) {
3379 if (val) *val = v;
3380 return SWIG_AddCast(SWIG_OK);
3381 } else {
3382 PyErr_Clear();
3384 if (!dispatch) {
3385 double d;
3386 int res = SWIG_AddCast(SWIG_AsVal_double(obj, &d));
3387 // Largest double not larger than LONG_MAX (not portably calculated easily)
3388 // Note that double(LONG_MAX) is stored in a double rounded up by one (for 64-bit long)
3389 // 0x7ffffffffffffc00LL == (int64_t)std::nextafter(double(__uint128_t(LONG_MAX)+1), double(0))
3390 const double long_max = sizeof(long) == 8 ? 0x7ffffffffffffc00LL : LONG_MAX;
3391 // No equivalent needed for 64-bit double(LONG_MIN) is exactly LONG_MIN
3392 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, long_max)) {
3393 if (val) *val = (long)(d);
3394 return res;
3398 #endif
3399 return SWIG_TypeError;
3403 SWIGINTERN int
3404 SWIG_AsVal_bool(PyObject *obj, bool *val) {
3405 int r;
3406 if (!PyBool_Check(obj))
3407 return SWIG_ERROR;
3408 r = PyObject_IsTrue(obj);
3409 if (r == -1)
3410 return SWIG_ERROR;
3411 if (val) *val = r ? true : false;
3412 return SWIG_OK;
3416 SWIGINTERNINLINE PyObject *
3417 SWIG_From_int(int value) {
3418 return PyInt_FromLong((long) value);
3422 SWIGINTERNINLINE PyObject *
3423 SWIG_FromCharPtrAndSize(const char *carray, size_t size) {
3424 if (carray) {
3425 if (size > INT_MAX) {
3426 swig_type_info *pchar_descriptor = SWIG_pchar_descriptor();
3427 return pchar_descriptor ?
3428 SWIG_InternalNewPointerObj((char *)(carray), pchar_descriptor, 0) : SWIG_Py_Void();
3429 } else {
3430 #if PY_VERSION_HEX >= 0x03000000
3431 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3432 return PyBytes_FromStringAndSize(carray, (Py_ssize_t)(size));
3433 #else
3434 return PyUnicode_DecodeUTF8(carray, (Py_ssize_t)(size), "surrogateescape");
3435 #endif
3436 #else
3437 return PyString_FromStringAndSize(carray, (Py_ssize_t)(size));
3438 #endif
3440 } else {
3441 return SWIG_Py_Void();
3446 SWIGINTERNINLINE PyObject *
3447 SWIG_FromCharPtr(const char *cptr) {
3448 return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
3451 #ifdef __cplusplus
3452 extern "C" {
3453 #endif
3454 SWIGINTERN PyObject *_wrap_new_pm3__SWIG_0(PyObject *self, Py_ssize_t nobjs, PyObject **SWIGUNUSEDPARM(swig_obj)) {
3455 PyObject *resultobj = 0;
3456 pm3 *result = 0 ;
3458 (void)self;
3459 if ((nobjs < 0) || (nobjs > 0)) SWIG_fail;
3460 result = (pm3 *)new_pm3__SWIG_0();
3461 resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pm3, SWIG_POINTER_NEW | 0);
3462 return resultobj;
3463 fail:
3464 return NULL;
3468 SWIGINTERN PyObject *_wrap_new_pm3__SWIG_1(PyObject *self, Py_ssize_t nobjs, PyObject **swig_obj) {
3469 PyObject *resultobj = 0;
3470 char *arg1 = (char *) 0 ;
3471 int res1 ;
3472 char *buf1 = 0 ;
3473 int alloc1 = 0 ;
3474 pm3 *result = 0 ;
3476 (void)self;
3477 if ((nobjs < 1) || (nobjs > 1)) SWIG_fail;
3478 res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
3479 if (!SWIG_IsOK(res1)) {
3480 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_pm3" "', argument " "1"" of type '" "char *""'");
3482 arg1 = (char *)(buf1);
3483 result = (pm3 *)new_pm3__SWIG_1(arg1);
3484 resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_pm3, SWIG_POINTER_NEW | 0);
3485 if (alloc1 == SWIG_NEWOBJ) free((char *)buf1);
3486 return resultobj;
3487 fail:
3488 if (alloc1 == SWIG_NEWOBJ) free((char *)buf1);
3489 return NULL;
3493 SWIGINTERN PyObject *_wrap_new_pm3(PyObject *self, PyObject *args) {
3494 Py_ssize_t argc;
3495 PyObject *argv[2] = {
3499 if (!(argc = SWIG_Python_UnpackTuple(args, "new_pm3", 0, 1, argv))) SWIG_fail;
3500 --argc;
3501 if (argc == 0) {
3502 return _wrap_new_pm3__SWIG_0(self, argc, argv);
3504 if (argc == 1) {
3505 int _v = 0;
3506 int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
3507 _v = SWIG_CheckState(res);
3508 if (_v) {
3509 return _wrap_new_pm3__SWIG_1(self, argc, argv);
3513 fail:
3514 SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_pm3'.\n"
3515 " Possible C/C++ prototypes are:\n"
3516 " pm3::pm3()\n"
3517 " pm3::pm3(char *)\n");
3518 return 0;
3522 SWIGINTERN PyObject *_wrap_delete_pm3(PyObject *self, PyObject *args) {
3523 PyObject *resultobj = 0;
3524 pm3 *arg1 = (pm3 *) 0 ;
3525 void *argp1 = 0 ;
3526 int res1 = 0 ;
3527 PyObject *swig_obj[1] ;
3529 (void)self;
3530 if (!args) SWIG_fail;
3531 swig_obj[0] = args;
3532 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_pm3, SWIG_POINTER_DISOWN | 0);
3533 if (!SWIG_IsOK(res1)) {
3534 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_pm3" "', argument " "1"" of type '" "pm3 *""'");
3536 arg1 = (pm3 *)(argp1);
3537 delete_pm3(arg1);
3538 resultobj = SWIG_Py_Void();
3539 return resultobj;
3540 fail:
3541 return NULL;
3545 SWIGINTERN PyObject *_wrap_pm3_console(PyObject *self, PyObject *args) {
3546 PyObject *resultobj = 0;
3547 pm3 *arg1 = (pm3 *) 0 ;
3548 char *arg2 = (char *) 0 ;
3549 bool arg3 = (bool) false ;
3550 void *argp1 = 0 ;
3551 int res1 = 0 ;
3552 int res2 ;
3553 char *buf2 = 0 ;
3554 int alloc2 = 0 ;
3555 bool val3 ;
3556 int ecode3 = 0 ;
3557 PyObject *swig_obj[3] ;
3558 int result;
3560 (void)self;
3561 if (!SWIG_Python_UnpackTuple(args, "pm3_console", 2, 3, swig_obj)) SWIG_fail;
3562 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_pm3, 0 | 0);
3563 if (!SWIG_IsOK(res1)) {
3564 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm3_console" "', argument " "1"" of type '" "pm3 *""'");
3566 arg1 = (pm3 *)(argp1);
3567 res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2);
3568 if (!SWIG_IsOK(res2)) {
3569 SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "pm3_console" "', argument " "2"" of type '" "char *""'");
3571 arg2 = (char *)(buf2);
3572 if (swig_obj[2]) {
3573 ecode3 = SWIG_AsVal_bool(swig_obj[2], &val3);
3574 if (!SWIG_IsOK(ecode3)) {
3575 SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "pm3_console" "', argument " "3"" of type '" "bool""'");
3577 arg3 = (bool)(val3);
3579 result = (int)pm3_console(arg1, arg2, arg3);
3580 resultobj = SWIG_From_int((int)(result));
3581 if (alloc2 == SWIG_NEWOBJ) free((char *)buf2);
3582 return resultobj;
3583 fail:
3584 if (alloc2 == SWIG_NEWOBJ) free((char *)buf2);
3585 return NULL;
3589 SWIGINTERN PyObject *_wrap_pm3_name_get(PyObject *self, PyObject *args) {
3590 PyObject *resultobj = 0;
3591 pm3 *arg1 = (pm3 *) 0 ;
3592 void *argp1 = 0 ;
3593 int res1 = 0 ;
3594 PyObject *swig_obj[1] ;
3595 char *result = 0 ;
3597 (void)self;
3598 if (!args) SWIG_fail;
3599 swig_obj[0] = args;
3600 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_pm3, 0 | 0);
3601 if (!SWIG_IsOK(res1)) {
3602 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm3_name_get" "', argument " "1"" of type '" "pm3 *""'");
3604 arg1 = (pm3 *)(argp1);
3605 result = (char *)pm3_name_get(arg1);
3606 resultobj = SWIG_FromCharPtr((const char *)result);
3607 return resultobj;
3608 fail:
3609 return NULL;
3613 SWIGINTERN PyObject *_wrap_pm3_grabbed_output_get(PyObject *self, PyObject *args) {
3614 PyObject *resultobj = 0;
3615 pm3 *arg1 = (pm3 *) 0 ;
3616 void *argp1 = 0 ;
3617 int res1 = 0 ;
3618 PyObject *swig_obj[1] ;
3619 char *result = 0 ;
3621 (void)self;
3622 if (!args) SWIG_fail;
3623 swig_obj[0] = args;
3624 res1 = SWIG_ConvertPtr(swig_obj[0], &argp1, SWIGTYPE_p_pm3, 0 | 0);
3625 if (!SWIG_IsOK(res1)) {
3626 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "pm3_grabbed_output_get" "', argument " "1"" of type '" "pm3 *""'");
3628 arg1 = (pm3 *)(argp1);
3629 result = (char *)pm3_grabbed_output_get(arg1);
3630 resultobj = SWIG_FromCharPtr((const char *)result);
3631 return resultobj;
3632 fail:
3633 return NULL;
3637 SWIGINTERN PyObject *pm3_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3638 PyObject *obj;
3639 if (!SWIG_Python_UnpackTuple(args, "swigregister", 1, 1, &obj)) return NULL;
3640 SWIG_TypeNewClientData(SWIGTYPE_p_pm3, SWIG_NewClientData(obj));
3641 return SWIG_Py_Void();
3644 SWIGINTERN PyObject *pm3_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3645 return SWIG_Python_InitShadowInstance(args);
3648 static PyMethodDef SwigMethods[] = {
3649 { "new_pm3", _wrap_new_pm3, METH_VARARGS, NULL},
3650 { "delete_pm3", _wrap_delete_pm3, METH_O, NULL},
3651 { "pm3_console", _wrap_pm3_console, METH_VARARGS, NULL},
3652 { "pm3_name_get", _wrap_pm3_name_get, METH_O, NULL},
3653 { "pm3_grabbed_output_get", _wrap_pm3_grabbed_output_get, METH_O, NULL},
3654 { "pm3_swigregister", pm3_swigregister, METH_O, NULL},
3655 { "pm3_swiginit", pm3_swiginit, METH_VARARGS, NULL},
3656 { NULL, NULL, 0, NULL }
3660 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3662 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void *)0, 0};
3663 static swig_type_info _swigt__p_pm3 = {"_p_pm3", "pm3 *", 0, 0, (void *)0, 0};
3665 static swig_type_info *swig_type_initial[] = {
3666 &_swigt__p_char,
3667 &_swigt__p_pm3,
3670 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0}, {0, 0, 0, 0}};
3671 static swig_cast_info _swigc__p_pm3[] = { {&_swigt__p_pm3, 0, 0, 0}, {0, 0, 0, 0}};
3673 static swig_cast_info *swig_cast_initial[] = {
3674 _swigc__p_char,
3675 _swigc__p_pm3,
3679 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3681 static swig_const_info swig_const_table[] = {
3682 {0, 0, 0, 0.0, 0, 0}
3685 #ifdef __cplusplus
3687 #endif
3688 /* -----------------------------------------------------------------------------
3689 * Type initialization:
3690 * This problem is tough by the requirement that no dynamic
3691 * memory is used. Also, since swig_type_info structures store pointers to
3692 * swig_cast_info structures and swig_cast_info structures store pointers back
3693 * to swig_type_info structures, we need some lookup code at initialization.
3694 * The idea is that swig generates all the structures that are needed.
3695 * The runtime then collects these partially filled structures.
3696 * The SWIG_InitializeModule function takes these initial arrays out of
3697 * swig_module, and does all the lookup, filling in the swig_module.types
3698 * array with the correct data and linking the correct swig_cast_info
3699 * structures together.
3701 * The generated swig_type_info structures are assigned statically to an initial
3702 * array. We just loop through that array, and handle each type individually.
3703 * First we lookup if this type has been already loaded, and if so, use the
3704 * loaded structure instead of the generated one. Then we have to fill in the
3705 * cast linked list. The cast data is initially stored in something like a
3706 * two-dimensional array. Each row corresponds to a type (there are the same
3707 * number of rows as there are in the swig_type_initial array). Each entry in
3708 * a column is one of the swig_cast_info structures for that type.
3709 * The cast_initial array is actually an array of arrays, because each row has
3710 * a variable number of columns. So to actually build the cast linked list,
3711 * we find the array of casts associated with the type, and loop through it
3712 * adding the casts to the list. The one last trick we need to do is making
3713 * sure the type pointer in the swig_cast_info struct is correct.
3715 * First off, we lookup the cast->type name to see if it is already loaded.
3716 * There are three cases to handle:
3717 * 1) If the cast->type has already been loaded AND the type we are adding
3718 * casting info to has not been loaded (it is in this module), THEN we
3719 * replace the cast->type pointer with the type pointer that has already
3720 * been loaded.
3721 * 2) If BOTH types (the one we are adding casting info to, and the
3722 * cast->type) are loaded, THEN the cast info has already been loaded by
3723 * the previous module so we just ignore it.
3724 * 3) Finally, if cast->type has not already been loaded, then we add that
3725 * swig_cast_info to the linked list (because the cast->type) pointer will
3726 * be correct.
3727 * ----------------------------------------------------------------------------- */
3729 #ifdef __cplusplus
3730 extern "C" {
3731 #if 0
3732 } /* c-mode */
3733 #endif
3734 #endif
3736 #if 0
3737 #define SWIGRUNTIME_DEBUG
3738 #endif
3740 #ifndef SWIG_INIT_CLIENT_DATA_TYPE
3741 #define SWIG_INIT_CLIENT_DATA_TYPE void *
3742 #endif
3744 SWIGRUNTIME void
3745 SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata) {
3746 size_t i;
3747 swig_module_info *module_head, *iter;
3748 int init;
3750 /* check to see if the circular list has been setup, if not, set it up */
3751 if (swig_module.next == 0) {
3752 /* Initialize the swig_module */
3753 swig_module.type_initial = swig_type_initial;
3754 swig_module.cast_initial = swig_cast_initial;
3755 swig_module.next = &swig_module;
3756 init = 1;
3757 } else {
3758 init = 0;
3761 /* Try and load any already created modules */
3762 module_head = SWIG_GetModule(clientdata);
3763 if (!module_head) {
3764 /* This is the first module loaded for this interpreter */
3765 /* so set the swig module into the interpreter */
3766 SWIG_SetModule(clientdata, &swig_module);
3767 } else {
3768 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3769 iter = module_head;
3770 do {
3771 if (iter == &swig_module) {
3772 /* Our module is already in the list, so there's nothing more to do. */
3773 return;
3775 iter = iter->next;
3776 } while (iter != module_head);
3778 /* otherwise we must add our module into the list */
3779 swig_module.next = module_head->next;
3780 module_head->next = &swig_module;
3783 /* When multiple interpreters are used, a module could have already been initialized in
3784 a different interpreter, but not yet have a pointer in this interpreter.
3785 In this case, we do not want to continue adding types... everything should be
3786 set up already */
3787 if (init == 0) return;
3789 /* Now work on filling in swig_module.types */
3790 #ifdef SWIGRUNTIME_DEBUG
3791 printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
3792 #endif
3793 for (i = 0; i < swig_module.size; ++i) {
3794 swig_type_info *type = 0;
3795 swig_type_info *ret;
3796 swig_cast_info *cast;
3798 #ifdef SWIGRUNTIME_DEBUG
3799 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3800 #endif
3802 /* if there is another module already loaded */
3803 if (swig_module.next != &swig_module) {
3804 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3806 if (type) {
3807 /* Overwrite clientdata field */
3808 #ifdef SWIGRUNTIME_DEBUG
3809 printf("SWIG_InitializeModule: found type %s\n", type->name);
3810 #endif
3811 if (swig_module.type_initial[i]->clientdata) {
3812 type->clientdata = swig_module.type_initial[i]->clientdata;
3813 #ifdef SWIGRUNTIME_DEBUG
3814 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3815 #endif
3817 } else {
3818 type = swig_module.type_initial[i];
3821 /* Insert casting types */
3822 cast = swig_module.cast_initial[i];
3823 while (cast->type) {
3824 /* Don't need to add information already in the list */
3825 ret = 0;
3826 #ifdef SWIGRUNTIME_DEBUG
3827 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3828 #endif
3829 if (swig_module.next != &swig_module) {
3830 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3831 #ifdef SWIGRUNTIME_DEBUG
3832 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3833 #endif
3835 if (ret) {
3836 if (type == swig_module.type_initial[i]) {
3837 #ifdef SWIGRUNTIME_DEBUG
3838 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3839 #endif
3840 cast->type = ret;
3841 ret = 0;
3842 } else {
3843 /* Check for casting already in the list */
3844 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3845 #ifdef SWIGRUNTIME_DEBUG
3846 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3847 #endif
3848 if (!ocast) ret = 0;
3852 if (!ret) {
3853 #ifdef SWIGRUNTIME_DEBUG
3854 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3855 #endif
3856 if (type->cast) {
3857 type->cast->prev = cast;
3858 cast->next = type->cast;
3860 type->cast = cast;
3862 cast++;
3864 /* Set entry in modules->types array equal to the type */
3865 swig_module.types[i] = type;
3867 swig_module.types[i] = 0;
3869 #ifdef SWIGRUNTIME_DEBUG
3870 printf("**** SWIG_InitializeModule: Cast List ******\n");
3871 for (i = 0; i < swig_module.size; ++i) {
3872 int j = 0;
3873 swig_cast_info *cast = swig_module.cast_initial[i];
3874 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3875 while (cast->type) {
3876 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3877 cast++;
3878 ++j;
3880 printf("---- Total casts: %d\n", j);
3882 printf("**** SWIG_InitializeModule: Cast List ******\n");
3883 #endif
3886 /* This function will propagate the clientdata field of type to
3887 * any new swig_type_info structures that have been added into the list
3888 * of equivalent types. It is like calling
3889 * SWIG_TypeClientData(type, clientdata) a second time.
3891 SWIGRUNTIME void
3892 SWIG_PropagateClientData(void) {
3893 size_t i;
3894 swig_cast_info *equiv;
3895 static int init_run = 0;
3897 if (init_run) return;
3898 init_run = 1;
3900 for (i = 0; i < swig_module.size; i++) {
3901 if (swig_module.types[i]->clientdata) {
3902 equiv = swig_module.types[i]->cast;
3903 while (equiv) {
3904 if (!equiv->converter) {
3905 if (equiv->type && !equiv->type->clientdata)
3906 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3908 equiv = equiv->next;
3914 #ifdef __cplusplus
3915 #if 0
3917 /* c-mode */
3918 #endif
3920 #endif
3924 #ifdef __cplusplus
3925 extern "C" {
3926 #endif
3928 /* -----------------------------------------------------------------------------
3929 * constants/methods manipulation
3930 * ----------------------------------------------------------------------------- */
3932 /* Install Constants */
3933 SWIGINTERN void
3934 SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
3935 PyObject *obj = 0;
3936 size_t i;
3937 for (i = 0; constants[i].type; ++i) {
3938 switch (constants[i].type) {
3939 case SWIG_PY_POINTER:
3940 obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype, 0);
3941 break;
3942 case SWIG_PY_BINARY:
3943 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
3944 break;
3945 default:
3946 obj = 0;
3947 break;
3949 if (obj) {
3950 PyDict_SetItemString(d, constants[i].name, obj);
3951 Py_DECREF(obj);
3956 /* -----------------------------------------------------------------------------
3957 * Patch %callback methods' docstrings to hold the callback ptrs
3958 * -----------------------------------------------------------------------------*/
3960 SWIGINTERN void
3961 SWIG_Python_FixMethods(PyMethodDef *methods, const swig_const_info *const_table, swig_type_info **types, swig_type_info **types_initial) {
3962 size_t i;
3963 for (i = 0; methods[i].ml_name; ++i) {
3964 const char *c = methods[i].ml_doc;
3965 if (!c) continue;
3966 c = strstr(c, "swig_ptr: ");
3967 if (c) {
3968 int j;
3969 const swig_const_info *ci = 0;
3970 const char *name = c + 10;
3971 for (j = 0; const_table[j].type; ++j) {
3972 if (strncmp(const_table[j].name, name,
3973 strlen(const_table[j].name)) == 0) {
3974 ci = &(const_table[j]);
3975 break;
3978 if (ci) {
3979 void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
3980 if (ptr) {
3981 size_t shift = (ci->ptype) - types;
3982 swig_type_info *ty = types_initial[shift];
3983 size_t ldoc = (c - methods[i].ml_doc);
3984 size_t lptr = strlen(ty->name) + 2 * sizeof(void *) +2;
3985 char *ndoc = (char *)malloc(ldoc + lptr + 10);
3986 if (ndoc) {
3987 char *buff = ndoc;
3988 memcpy(buff, methods[i].ml_doc, ldoc);
3989 buff += ldoc;
3990 memcpy(buff, "swig_ptr: ", 10);
3991 buff += 10;
3992 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
3993 methods[i].ml_doc = ndoc;
4001 #ifdef __cplusplus
4003 #endif
4008 /* -----------------------------------------------------------------------------*
4009 * Partial Init method
4010 * -----------------------------------------------------------------------------*/
4012 #ifdef __cplusplus
4013 extern "C"
4014 #endif
4016 SWIGEXPORT
4017 #if PY_VERSION_HEX >= 0x03000000
4018 PyObject *
4019 #else
4020 void
4021 #endif
4022 SWIG_init(void) {
4023 PyObject *m, *d, *md, *globals;
4025 #if PY_VERSION_HEX >= 0x03000000
4026 static struct PyModuleDef SWIG_module = {
4027 PyModuleDef_HEAD_INIT,
4028 SWIG_name,
4029 NULL,
4031 SwigMethods,
4032 NULL,
4033 NULL,
4034 NULL,
4035 NULL
4037 #endif
4039 #if defined(SWIGPYTHON_BUILTIN)
4040 static SwigPyClientData SwigPyObject_clientdata = {
4041 0, 0, 0, 0, 0, 0, 0
4043 static PyGetSetDef this_getset_def = {
4044 (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
4046 static SwigPyGetSet thisown_getset_closure = {
4047 SwigPyObject_own,
4048 SwigPyObject_own
4050 static PyGetSetDef thisown_getset_def = {
4051 (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
4053 PyTypeObject *builtin_pytype;
4054 int builtin_base_count;
4055 swig_type_info *builtin_basetype;
4056 PyObject *tuple;
4057 PyGetSetDescrObject *static_getset;
4058 PyTypeObject *metatype;
4059 PyTypeObject *swigpyobject;
4060 SwigPyClientData *cd;
4061 PyObject *public_interface, *public_symbol;
4062 PyObject *this_descr;
4063 PyObject *thisown_descr;
4064 PyObject *self = 0;
4065 int i;
4067 (void)builtin_pytype;
4068 (void)builtin_base_count;
4069 (void)builtin_basetype;
4070 (void)tuple;
4071 (void)static_getset;
4072 (void)self;
4074 /* Metaclass is used to implement static member variables */
4075 metatype = SwigPyObjectType();
4076 assert(metatype);
4077 #endif
4079 (void)globals;
4081 /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
4082 SWIG_This();
4083 SWIG_Python_TypeCache();
4084 SwigPyPacked_type();
4085 #ifndef SWIGPYTHON_BUILTIN
4086 SwigPyObject_type();
4087 #endif
4089 /* Fix SwigMethods to carry the callback ptrs when needed */
4090 SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
4092 #if PY_VERSION_HEX >= 0x03000000
4093 m = PyModule_Create(&SWIG_module);
4094 #else
4095 m = Py_InitModule(SWIG_name, SwigMethods);
4096 #endif
4098 md = d = PyModule_GetDict(m);
4099 (void)md;
4101 SWIG_InitializeModule(0);
4103 #ifdef SWIGPYTHON_BUILTIN
4104 swigpyobject = SwigPyObject_TypeOnce();
4106 SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
4107 assert(SwigPyObject_stype);
4108 cd = (SwigPyClientData *) SwigPyObject_stype->clientdata;
4109 if (!cd) {
4110 SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
4111 SwigPyObject_clientdata.pytype = swigpyobject;
4112 } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
4113 PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
4114 # if PY_VERSION_HEX >= 0x03000000
4115 return NULL;
4116 # else
4117 return;
4118 # endif
4121 /* All objects have a 'this' attribute */
4122 this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
4123 (void)this_descr;
4125 /* All objects have a 'thisown' attribute */
4126 thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
4127 (void)thisown_descr;
4129 public_interface = PyList_New(0);
4130 public_symbol = 0;
4131 (void)public_symbol;
4133 PyDict_SetItemString(md, "__all__", public_interface);
4134 Py_DECREF(public_interface);
4135 for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
4136 SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
4137 for (i = 0; swig_const_table[i].name != 0; ++i)
4138 SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
4139 #endif
4141 SWIG_InstallConstants(d, swig_const_table);
4143 #if PY_VERSION_HEX >= 0x03000000
4144 return m;
4145 #else
4146 return;
4147 #endif