1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (https://www.swig.org).
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
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
28 # define SWIGTEMPLATEDISAMBIGUATOR
32 /* inline attribute */
34 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
35 # define SWIGINLINE inline
41 /* attribute recognised by some compilers to avoid 'unused' warnings */
43 # if defined(__GNUC__)
44 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
45 # define SWIGUNUSED __attribute__ ((__unused__))
50 # define SWIGUNUSED __attribute__ ((__unused__))
56 #ifndef SWIG_MSC_UNSUPPRESS_4505
57 # if defined(_MSC_VER)
58 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
62 #ifndef SWIGUNUSEDPARM
64 # define SWIGUNUSEDPARM(p)
66 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
70 /* internal SWIG method */
72 # define SWIGINTERN static SWIGUNUSED
75 /* internal inline SWIG method */
76 #ifndef SWIGINTERNINLINE
77 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
80 /* exporting methods */
82 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
83 # ifndef GCC_HASCLASSVISIBILITY
84 # define GCC_HASCLASSVISIBILITY
90 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
91 # if defined(STATIC_LINKED)
94 # define SWIGEXPORT __declspec(dllexport)
97 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
98 # define SWIGEXPORT __attribute__ ((visibility("default")))
105 /* calling conventions for Windows */
107 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
108 # define SWIGSTDCALL __stdcall
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
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
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
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
138 #if defined(__cplusplus) && __cplusplus >=201103L
139 # define SWIG_NULLPTR nullptr
141 # define SWIG_NULLPTR NULL
144 /* -----------------------------------------------------------------------------
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)
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
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)
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 */
174 #if !defined(PY_SSIZE_T_CLEAN) && !defined(SWIG_NO_PY_SSIZE_T_CLEAN)
175 #define PY_SSIZE_T_CLEAN
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 */
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>
202 #pragma GCC diagnostic pop
207 /* -----------------------------------------------------------------------------
210 * This file contains generic C API SWIG runtime support for pointer
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)
224 # define SWIG_TYPE_TABLE_NAME
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.
237 # define SWIGRUNTIME SWIGINTERN
240 #ifndef SWIGRUNTIMEINLINE
241 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
244 /* Generic buffer size */
245 #ifndef SWIG_BUFFER_SIZE
246 # define SWIG_BUFFER_SIZE 1024
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
270 In old versions of SWIG, code such as the following was usually written:
272 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
278 Now you can be more explicit:
280 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
281 if (SWIG_IsOK(res)) {
287 which is the same really, but now you can also do
290 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
291 if (SWIG_IsOK(res)) {
293 if (SWIG_IsNewObj(res) {
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,...) {
309 if (<need new object>) {
310 *ptr = <ptr to new allocated object>;
313 *ptr = <ptr to old object>;
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
325 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
326 allows returning the 'cast rank', for example, if you have this
333 food(1) // cast rank '1' (1 -> 1.0)
334 fooi(1) // cast rank '0'
336 just use the SWIG_AddCast()/SWIG_CheckState()
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))
370 #if defined(SWIG_CASTRANK_MODE)
371 # ifndef SWIG_TypeRank
372 # define SWIG_TypeRank unsigned long
374 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
375 # define SWIG_MAXCASTRANK (2)
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)
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 */
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 */
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 */
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 ' '.
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
453 SWIG_TypeCmp(const char *nb
, const char *tb
) {
455 const char *te
= tb
+ strlen(tb
);
457 while (equiv
!= 0 && *ne
) {
458 for (nb
= ne
; *ne
; ++ne
) {
459 if (*ne
== '|') break;
461 equiv
= SWIG_TypeNameComp(nb
, ne
, tb
, te
);
468 Check type equivalence in a name list like <name1>|<name2>|...
469 Return 0 if not equal, 1 if equal
472 SWIG_TypeEquiv(const char *nb
, const char *tb
) {
473 return SWIG_TypeCmp(nb
, tb
) == 0 ? 1 : 0;
479 SWIGRUNTIME swig_cast_info
*
480 SWIG_TypeCheck(const char *c
, swig_type_info
*ty
) {
482 swig_cast_info
*iter
= ty
->cast
;
484 if (strcmp(iter
->type
->name
, c
) == 0) {
485 if (iter
== ty
->cast
)
487 /* Move iter to the top of the linked list */
488 iter
->prev
->next
= iter
->next
;
490 iter
->next
->prev
= iter
->prev
;
491 iter
->next
= ty
->cast
;
493 if (ty
->cast
) ty
->cast
->prev
= iter
;
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
) {
509 swig_cast_info
*iter
= ty
->cast
;
511 if (iter
->type
== from
) {
512 if (iter
== ty
->cast
)
514 /* Move iter to the top of the linked list */
515 iter
->prev
->next
= iter
->next
;
517 iter
->next
->prev
= iter
->prev
;
518 iter
->next
= ty
->cast
;
520 if (ty
->cast
) ty
->cast
->prev
= iter
;
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
);
553 Return the name associated with this type
555 SWIGRUNTIMEINLINE
const char *
556 SWIG_TypeName(const swig_type_info
*ty
) {
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
;
574 for (s
= type
->str
; *s
; s
++)
575 if (*s
== '|') last_name
= s
+ 1;
582 Set the clientdata field for a type
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
;
591 if (!cast
->converter
) {
592 swig_type_info
*tc
= cast
->type
;
593 if (!tc
->clientdata
) {
594 SWIG_TypeClientData(tc
, clientdata
);
601 SWIG_TypeNewClientData(swig_type_info
*ti
, void *clientdata
) {
602 SWIG_TypeClientData(ti
, clientdata
);
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
614 SWIGRUNTIME swig_type_info
*
615 SWIG_MangledTypeQueryModule(swig_module_info
*start
,
616 swig_module_info
*end
,
618 swig_module_info
*iter
= start
;
622 size_t r
= iter
->size
- 1;
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
;
628 int compare
= strcmp(name
, iname
);
630 return iter
->types
[i
];
631 } else if (compare
< 0) {
637 } else if (compare
> 0) {
641 break; /* should never happen */
646 } while (iter
!= end
);
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
659 SWIGRUNTIME swig_type_info
*
660 SWIG_TypeQueryModule(swig_module_info
*start
,
661 swig_module_info
*end
,
663 /* STEP 1: Search the name field using binary search */
664 swig_type_info
*ret
= SWIG_MangledTypeQueryModule(start
, end
, name
);
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
;
673 for (; i
< iter
->size
; ++i
) {
674 if (iter
->types
[i
]->str
&& (SWIG_TypeEquiv(iter
->types
[i
]->str
, name
)))
675 return iter
->types
[i
];
678 } while (iter
!= end
);
681 /* neither found a match */
686 Pack binary data into a string
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];
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
) {
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);
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));
730 Pack 'void *' into a string buffer.
733 SWIG_PackVoidPtr(char *buff
, void *ptr
, const char *name
, size_t bsz
) {
735 if ((2 * sizeof(void *) + 2) > bsz
) return 0;
737 r
= SWIG_PackData(r
, &ptr
, sizeof(void *));
738 if (strlen(name
) + 1 > (bsz
- (r
- buff
))) return 0;
743 SWIGRUNTIME
const char *
744 SWIG_UnpackVoidPtr(const char *c
, void **ptr
, const char *name
) {
746 if (strcmp(c
, "NULL") == 0) {
753 return SWIG_UnpackData(++c
, ptr
, sizeof(void *));
757 SWIG_PackDataName(char *buff
, void *ptr
, size_t sz
, const char *name
, size_t bsz
) {
759 size_t lname
= (name
? strlen(name
) : 0);
760 if ((2 * sz
+ 2 + lname
) > bsz
) return 0;
762 r
= SWIG_PackData(r
, ptr
, sz
);
764 strncpy(r
, name
, lname
+ 1);
771 SWIGRUNTIME
const char *
772 SWIG_UnpackDataName(const char *c
, void *ptr
, size_t sz
, const char *name
) {
774 if (strcmp(c
, "NULL") == 0) {
781 return SWIG_UnpackData(++c
, ptr
, sz
);
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)
824 # define Py_TYPE(op) ((op)->ob_type)
827 /* SWIG APIs for compatibility of both Python 2 & 3 */
829 #if PY_VERSION_HEX >= 0x03000000
830 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
832 # define SWIG_Python_str_FromFormat PyString_FromFormat
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
842 return PyUnicode_AsUTF8AndSize(str
, psize
);
844 *pbytes
= PyUnicode_AsUTF8String(str
);
845 const char *chars
= *pbytes
? PyBytes_AsString(*pbytes
) : NULL
;
847 *psize
= PyBytes_Size(*pbytes
);
853 PyString_AsStringAndSize(str
, &chars
, psize
);
858 SWIGINTERN PyObject
*
859 SWIG_Python_str_FromChar(const char *c
) {
860 #if PY_VERSION_HEX >= 0x03000000
861 return PyUnicode_FromString(c
);
863 return PyString_FromString(c
);
868 # define PyObject_DEL PyObject_Del
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
876 # define SWIGPY_CAPSULE_ATTR_NAME "type_pointer_capsule" SWIG_TYPE_TABLE_NAME
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
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
900 /* -----------------------------------------------------------------------------
902 * ----------------------------------------------------------------------------- */
904 SWIGRUNTIME PyObject
*
905 SWIG_Python_ErrorType(int code
) {
908 case SWIG_MemoryError
:
909 type
= PyExc_MemoryError
;
912 type
= PyExc_IOError
;
914 case SWIG_RuntimeError
:
915 type
= PyExc_RuntimeError
;
917 case SWIG_IndexError
:
918 type
= PyExc_IndexError
;
921 type
= PyExc_TypeError
;
923 case SWIG_DivisionByZero
:
924 type
= PyExc_ZeroDivisionError
;
926 case SWIG_OverflowError
:
927 type
= PyExc_OverflowError
;
929 case SWIG_SyntaxError
:
930 type
= PyExc_SyntaxError
;
932 case SWIG_ValueError
:
933 type
= PyExc_ValueError
;
935 case SWIG_SystemError
:
936 type
= PyExc_SystemError
;
938 case SWIG_AttributeError
:
939 type
= PyExc_AttributeError
;
942 type
= PyExc_RuntimeError
;
949 SWIG_Python_AddErrorMsg(const char *mesg
) {
952 PyObject
*traceback
= 0;
954 if (PyErr_Occurred())
955 PyErr_Fetch(&type
, &value
, &traceback
);
957 PyObject
*old_str
= PyObject_Str(value
);
958 PyObject
*bytes
= NULL
;
959 const char *tmp
= SWIG_PyUnicode_AsUTF8AndSize(old_str
, NULL
, &bytes
);
963 PyErr_Format(type
, "%s %s", tmp
, mesg
);
965 PyErr_Format(type
, "%s", mesg
);
970 PyErr_SetString(PyExc_RuntimeError
, mesg
);
975 SWIG_Python_TypeErrorOccurred(PyObject
*obj
) {
979 error
= PyErr_Occurred();
980 return error
&& PyErr_GivenExceptionMatches(error
, PyExc_TypeError
);
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 */
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
);
993 newvalue
= PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value
), message
);
997 PyErr_Restore(type
, newvalue
, traceback
);
999 PyErr_Restore(type
, value
, traceback
);
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
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
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()
1021 # define SWIG_PYTHON_INITIALIZE_THREADS
1024 # ifdef __cplusplus /* C++ code */
1025 class SWIG_Python_Thread_Block
{
1027 PyGILState_STATE state
;
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
{
1035 PyThreadState
*save
;
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()
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)
1051 # else /* Old thread way, not implemented, user must provide it */
1052 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1053 # define SWIG_PYTHON_INITIALIZE_THREADS
1055 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1056 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1058 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1059 # define SWIG_PYTHON_THREAD_END_BLOCK
1061 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1062 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1064 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1065 # define SWIG_PYTHON_THREAD_END_ALLOW
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
1076 /* -----------------------------------------------------------------------------
1077 * Python API portion that goes into the runtime
1078 * ----------------------------------------------------------------------------- */
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
{
1099 swig_type_info
**ptype
;
1107 /* -----------------------------------------------------------------------------
1110 * This file contains the runtime support for Python modules
1111 * and includes code for managing global variables and pointer
1114 * ----------------------------------------------------------------------------- */
1116 #if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
1117 # error "This version of SWIG only supports Python >= 2.7"
1120 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03030000
1121 # error "This version of SWIG only supports Python 3 >= 3.3"
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)
1134 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
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)
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 */
1178 SWIG_Python_SetErrorObj(PyObject
*errtype
, PyObject
*obj
) {
1179 SWIG_PYTHON_THREAD_BEGIN_BLOCK
;
1180 PyErr_SetObject(errtype
, obj
);
1182 SWIG_PYTHON_THREAD_END_BLOCK
;
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)
1199 SwigPyBuiltin_AddPublicSymbol(PyObject
*seq
, const char *key
) {
1200 PyObject
*s
= PyString_InternFromString(key
);
1201 PyList_Append(seq
, s
);
1206 SWIG_Python_SetConstant(PyObject
*d
, PyObject
*public_interface
, const char *name
, PyObject
*obj
) {
1207 PyDict_SetItemString(d
, name
, obj
);
1209 if (public_interface
)
1210 SwigPyBuiltin_AddPublicSymbol(public_interface
, name
);
1216 SWIG_Python_SetConstant(PyObject
*d
, const char *name
, PyObject
*obj
) {
1217 PyDict_SetItemString(d
, name
, obj
);
1223 /* Append a value to the result obj */
1225 SWIGINTERN PyObject
*
1226 SWIG_Python_AppendOutput(PyObject
*result
, PyObject
*obj
) {
1229 } else if (result
== Py_None
) {
1233 if (!PyList_Check(result
)) {
1234 PyObject
*o2
= result
;
1235 result
= PyList_New(1);
1237 PyList_SET_ITEM(result
, 0, o2
);
1243 PyList_Append(result
, obj
);
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
) {
1257 PyErr_Format(PyExc_TypeError
, "%s expected %s%d arguments, got none",
1258 name
, (min
== max
? "" : "at least "), (int)min
);
1262 if (!PyTuple_Check(args
)) {
1263 if (min
<= 1 && max
>= 1) {
1266 for (i
= 1; i
< max
; ++i
) {
1271 PyErr_SetString(PyExc_SystemError
, "UnpackTuple() argument list is not a tuple");
1274 Py_ssize_t l
= PyTuple_GET_SIZE(args
);
1276 PyErr_Format(PyExc_TypeError
, "%s expected %s%d arguments, got %d",
1277 name
, (min
== max
? "" : "at least "), (int)min
, (int)l
);
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
);
1285 for (i
= 0; i
< l
; ++i
) {
1286 objs
[i
] = PyTuple_GET_ITEM(args
, i
);
1288 for (; l
< max
; ++l
) {
1297 SWIG_Python_CheckNoKeywords(PyObject
*kwargs
, const char *name
) {
1300 assert(PyDict_Check(kwargs
));
1301 if (PyDict_Size(kwargs
) > 0) {
1302 PyErr_Format(PyExc_TypeError
, "%s() does not take keyword arguments", name
);
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(...);
1317 #define SWIG_STATIC_POINTER(var) var
1319 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
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
;
1342 typedef struct swig_varlinkobject
{
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>");
1352 return PyString_FromString("<Swig global variables>");
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("(");
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
);
1371 tail
= PyUnicode_InternFromString(", ");
1372 joined
= PyUnicode_Concat(str
, tail
);
1378 tail
= PyUnicode_InternFromString(")");
1379 joined
= PyUnicode_Concat(str
, tail
);
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(")"));
1396 swig_varlink_dealloc(PyObject
*o
) {
1397 swig_varlinkobject
*v
= (swig_varlinkobject
*) o
;
1398 swig_globalvar
*var
= v
->vars
;
1400 swig_globalvar
*n
= var
->next
;
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
;
1413 if (strcmp(var
->name
, n
) == 0) {
1414 res
= (*var
->get_attr
)();
1419 if (res
== NULL
&& !PyErr_Occurred()) {
1420 PyErr_Format(PyExc_AttributeError
, "Unknown C global variable '%s'", n
);
1426 swig_varlink_setattr(PyObject
*o
, char *n
, PyObject
*p
) {
1427 swig_varlinkobject
*v
= (swig_varlinkobject
*) o
;
1429 swig_globalvar
*var
= v
->vars
;
1431 if (strcmp(var
->name
, n
) == 0) {
1432 res
= (*var
->set_attr
)(p
);
1437 if (res
== 1 && !PyErr_Occurred()) {
1438 PyErr_Format(PyExc_AttributeError
, "Unknown C global variable '%s'", n
);
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;
1450 const PyTypeObject tmp
= {
1451 #if PY_VERSION_HEX >= 0x03000000
1452 PyVarObject_HEAD_INIT(NULL
, 0)
1454 PyObject_HEAD_INIT(NULL
)
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*/
1464 (Py_ssize_t
)0, /*tp_vectorcall_offset*/
1466 (getattrfunc
) swig_varlink_getattr
, /* tp_getattr */
1467 (setattrfunc
) swig_varlink_setattr
, /* tp_setattr */
1469 (reprfunc
) swig_varlink_repr
, /* tp_repr */
1470 0, /* tp_as_number */
1471 0, /* tp_as_sequence */
1472 0, /* tp_as_mapping */
1475 (reprfunc
) swig_varlink_str
, /* tp_str */
1476 0, /* tp_getattro */
1477 0, /* tp_setattro */
1478 0, /* tp_as_buffer */
1480 varlink__doc__
, /* tp_doc */
1481 0, /* tp_traverse */
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 */
1487 0, /* tp_version_tag */
1488 #if PY_VERSION_HEX >= 0x03040000
1489 0, /* tp_finalize */
1491 #if PY_VERSION_HEX >= 0x03080000
1492 0, /* tp_vectorcall */
1494 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
1497 #if PY_VERSION_HEX >= 0x030C0000
1503 0, /* tp_maxalloc */
1510 if (PyType_Ready(&varlink_type
) < 0)
1513 return &varlink_type
;
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__
},
1524 PyType_Spec spec
= {
1526 sizeof(swig_varlinkobject
),
1531 return (PyTypeObject
*)PyType_FromSpec(&spec
);
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());
1542 return ((PyObject
*) result
);
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
));
1550 size_t size
= strlen(name
) + 1;
1551 gv
->name
= (char *)malloc(size
);
1553 memcpy(gv
->name
, name
, size
);
1554 gv
->get_attr
= get_attr
;
1555 gv
->set_attr
= set_attr
;
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
;
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)
1594 /* The python void return value */
1596 SWIGRUNTIMEINLINE PyObject
*
1597 SWIG_Py_Void(void) {
1598 PyObject
*none
= Py_None
;
1603 /* SwigPyClientData */
1612 PyTypeObject
*pytype
;
1615 SWIGRUNTIMEINLINE
int
1616 SWIG_Python_CheckImplicit(swig_type_info
*ty
) {
1617 SwigPyClientData
*data
= (SwigPyClientData
*)ty
->clientdata
;
1618 int fail
= data
? data
->implicitconv
: 0;
1620 PyErr_SetString(PyExc_TypeError
, "Implicit conversion is prohibited for explicit constructors.");
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
) {
1637 SwigPyClientData
*data
= (SwigPyClientData
*)malloc(sizeof(SwigPyClientData
));
1638 /* the klass element */
1640 Py_INCREF(data
->klass
);
1641 /* the newraw method and newargs arguments used to create a new raw instance */
1642 if (PyClass_Check(obj
)) {
1645 data
->newargs
= obj
;
1647 data
->newraw
= PyObject_GetAttrString(data
->klass
, "__new__");
1649 data
->newargs
= PyTuple_New(1);
1650 if (data
->newargs
) {
1652 PyTuple_SET_ITEM(data
->newargs
, 0, obj
);
1654 Py_DECREF(data
->newraw
);
1655 Py_DECREF(data
->klass
);
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()) {
1670 if (data
->destroy
) {
1671 data
->delargs
= !(PyCFunction_GET_FLAGS(data
->destroy
) & METH_O
);
1675 data
->implicitconv
= 0;
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
);
1690 /* =============== SwigPyObject =====================*/
1698 #ifdef SWIGPYTHON_BUILTIN
1704 #ifdef SWIGPYTHON_BUILTIN
1706 SWIGRUNTIME PyObject
*
1707 SwigPyObject_get___dict__(PyObject
*v
, PyObject
*SWIGUNUSEDPARM(args
)) {
1708 SwigPyObject
*sobj
= (SwigPyObject
*)v
;
1711 sobj
->dict
= PyDict_New();
1713 Py_XINCREF(sobj
->dict
);
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);
1729 PyObject
*val
= SwigPyObject_long(v
);
1732 PyTuple_SET_ITEM(args
, 0, val
);
1733 ofmt
= SWIG_Python_str_FromChar(fmt
);
1735 #if PY_VERSION_HEX >= 0x03000000
1736 res
= PyUnicode_Format(ofmt
, args
);
1738 res
= PyString_Format(ofmt
, args
);
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
);
1765 # if PY_VERSION_HEX >= 0x03000000
1766 PyObject
*joined
= PyUnicode_Concat(repr
, nrep
);
1771 PyString_ConcatAndDel(&repr
, nrep
);
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
);
1789 SwigPyObject_compare(SwigPyObject
*v
, SwigPyObject
*w
) {
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);
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
;
1824 SWIGRUNTIME PyTypeObject
*
1825 SwigPyObject_type(void) {
1826 static PyTypeObject
*SWIG_STATIC_POINTER(type
) = SwigPyObject_TypeOnce();
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
))
1838 return (strcmp(op_type
->tp_name
, "SwigPyObject") == 0);
1840 if (op_type
== target_tp
)
1842 # ifdef Py_LIMITED_API
1844 PyObject
*tp_name
= PyObject_GetAttrString((PyObject
*)op_type
, "__name__");
1847 cmp
= PyUnicode_CompareWithASCIIString(tp_name
, "SwigPyObject");
1851 return (strcmp(op_type
->tp_name
, "SwigPyObject") == 0);
1856 SWIGRUNTIME PyObject
*
1857 SwigPyObject_New(void *ptr
, swig_type_info
*ty
, int own
);
1859 static PyObject
*Swig_Capsule_global
= NULL
;
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;
1870 /* destroy is always a VARARGS method */
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
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);
1887 res
= SWIG_Python_CallFunctor(destroy
, tmp
);
1893 PyCFunction meth
= PyCFunction_GET_FUNCTION(destroy
);
1894 PyObject
*mself
= PyCFunction_GET_SELF(destroy
);
1895 res
= ((*meth
)(mself
, v
));
1898 PyErr_WriteUnraisable(destroy
);
1900 PyErr_Restore(type
, value
, traceback
);
1904 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
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"));
1910 Py_XDECREF(Swig_Capsule_global
);
1913 #ifdef SWIGPYTHON_BUILTIN
1914 Py_XDECREF(sobj
->dict
);
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");
1926 ((SwigPyObject
*)next
)->next
= sobj
->next
;
1929 return SWIG_Py_Void();
1932 SWIGRUNTIME PyObject
*
1933 SwigPyObject_next(PyObject
*v
, PyObject
*SWIGUNUSEDPARM(args
)) {
1934 SwigPyObject
*sobj
= (SwigPyObject
*) v
;
1936 Py_INCREF(sobj
->next
);
1939 return SWIG_Py_Void();
1943 SWIGINTERN PyObject
*
1944 SwigPyObject_disown(PyObject
*v
, PyObject
*SWIGUNUSEDPARM(args
)) {
1945 SwigPyObject
*sobj
= (SwigPyObject
*)v
;
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
) {
1960 if (!PyArg_UnpackTuple(args
, "own", 0, 1, &val
)) {
1963 SwigPyObject
*sobj
= (SwigPyObject
*)v
;
1964 PyObject
*obj
= PyBool_FromLong(sobj
->own
);
1966 if (PyObject_IsTrue(val
)) {
1967 Py_DECREF(SwigPyObject_acquire(v
, args
));
1969 Py_DECREF(SwigPyObject_disown(v
, args
));
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"},
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*/
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*/
2012 #if PY_VERSION_HEX < 0x03000000
2015 (unaryfunc
)SwigPyObject_long
, /*nb_int*/
2016 #if PY_VERSION_HEX < 0x03000000
2017 (unaryfunc
)SwigPyObject_long
, /*nb_long*/
2021 (unaryfunc
)0, /*nb_float*/
2022 #if PY_VERSION_HEX < 0x03000000
2023 (unaryfunc
)SwigPyObject_oct
, /*nb_oct*/
2024 (unaryfunc
)SwigPyObject_hex
, /*nb_hex*/
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 */
2031 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_index */
2035 static PyTypeObject swigpyobject_type
;
2036 static int type_init
= 0;
2038 const PyTypeObject tmp
= {
2039 #if PY_VERSION_HEX >= 0x03000000
2040 PyVarObject_HEAD_INIT(NULL
, 0)
2042 PyObject_HEAD_INIT(NULL
)
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*/
2052 (Py_ssize_t
)0, /*tp_vectorcall_offset*/
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 */
2059 (cmpfunc
)SwigPyObject_compare
, /* tp_compare */
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 */
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 */
2075 (richcmpfunc
)SwigPyObject_richcompare
,/* tp_richcompare */
2076 0, /* tp_weaklistoffset */
2078 0, /* tp_iternext */
2079 swigobject_methods
, /* tp_methods */
2084 0, /* tp_descr_get */
2085 0, /* tp_descr_set */
2086 0, /* tp_dictoffset */
2095 0, /* tp_subclasses */
2096 0, /* tp_weaklist */
2098 0, /* tp_version_tag */
2099 #if PY_VERSION_HEX >= 0x03040000
2100 0, /* tp_finalize */
2102 #if PY_VERSION_HEX >= 0x03080000
2103 0, /* tp_vectorcall */
2105 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
2108 #if PY_VERSION_HEX >= 0x030C0000
2114 0, /* tp_maxalloc */
2119 swigpyobject_type
= tmp
;
2121 if (PyType_Ready(&swigpyobject_type
) != 0)
2124 return &swigpyobject_type
;
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
},
2136 PyType_Spec spec
= {
2138 sizeof(SwigPyObject
),
2143 return (PyTypeObject
*)PyType_FromSpec(&spec
);
2147 SWIGRUNTIME PyObject
*
2148 SwigPyObject_New(void *ptr
, swig_type_info
*ty
, int own
) {
2149 SwigPyObject
*sobj
= PyObject_New(SwigPyObject
, SwigPyObject_type());
2155 #ifdef SWIGPYTHON_BUILTIN
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 * ----------------------------------------------------------------------------- */
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
);
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
);
2195 return SWIG_Python_str_FromChar(v
->ty
->name
);
2200 SwigPyPacked_compare(SwigPyPacked
*v
, SwigPyPacked
*w
) {
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();
2215 SWIGRUNTIMEINLINE
int
2216 SwigPyPacked_Check(PyObject
*op
) {
2217 PyTypeObject
*op_type
= Py_TYPE(op
);
2218 if (op_type
== SwigPyPacked_TypeOnce())
2220 #ifdef Py_LIMITED_API
2222 PyObject
*tp_name
= PyObject_GetAttrString((PyObject
*)op_type
, "__name__");
2225 cmp
= PyUnicode_CompareWithASCIIString(tp_name
, "SwigPyPacked");
2229 return (strcmp(op_type
->tp_name
, "SwigPyPacked") == 0);
2234 SwigPyPacked_dealloc(PyObject
*v
) {
2235 if (SwigPyPacked_Check(v
)) {
2236 SwigPyPacked
*sobj
= (SwigPyPacked
*) 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;
2249 const PyTypeObject tmp
= {
2250 #if PY_VERSION_HEX>=0x03000000
2251 PyVarObject_HEAD_INIT(NULL
, 0)
2253 PyObject_HEAD_INIT(NULL
)
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*/
2263 (Py_ssize_t
)0, /*tp_vectorcall_offset*/
2265 (getattrfunc
)0, /* tp_getattr */
2266 (setattrfunc
)0, /* tp_setattr */
2267 #if PY_VERSION_HEX>=0x03000000
2268 0, /* tp_reserved in 3.0.1 */
2270 (cmpfunc
)SwigPyPacked_compare
, /* tp_compare */
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 */
2286 0, /* tp_richcompare */
2287 0, /* tp_weaklistoffset */
2289 0, /* tp_iternext */
2295 0, /* tp_descr_get */
2296 0, /* tp_descr_set */
2297 0, /* tp_dictoffset */
2306 0, /* tp_subclasses */
2307 0, /* tp_weaklist */
2309 0, /* tp_version_tag */
2310 #if PY_VERSION_HEX >= 0x03040000
2311 0, /* tp_finalize */
2313 #if PY_VERSION_HEX >= 0x03080000
2314 0, /* tp_vectorcall */
2316 #if (PY_VERSION_HEX >= 0x03080000) && (PY_VERSION_HEX < 0x03090000)
2319 #if PY_VERSION_HEX >= 0x030C0000
2325 0, /* tp_maxalloc */
2330 swigpypacked_type
= tmp
;
2332 if (PyType_Ready(&swigpypacked_type
) != 0)
2335 return &swigpypacked_type
;
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
},
2345 PyType_Spec spec
= {
2347 sizeof(SwigPyPacked
),
2352 return (PyTypeObject
*)PyType_FromSpec(&spec
);
2356 SWIGRUNTIME PyObject
*
2357 SwigPyPacked_New(void *ptr
, size_t size
, swig_type_info
*ty
) {
2358 SwigPyPacked
*sobj
= PyObject_New(SwigPyPacked
, SwigPyPacked_type());
2360 void *pack
= malloc(size
);
2362 memcpy(pack
, ptr
, size
);
2367 PyObject_DEL((PyObject
*) sobj
);
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
);
2386 /* -----------------------------------------------------------------------------
2387 * pointers/data manipulation
2388 * ----------------------------------------------------------------------------- */
2390 static PyObject
*Swig_This_global
= NULL
;
2392 SWIGRUNTIME PyObject
*
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
2406 SWIGRUNTIME SwigPyObject
*
2407 SWIG_Python_GetSwigThis(PyObject
*pyobj
) {
2410 if (SwigPyObject_Check(pyobj
))
2411 return (SwigPyObject
*) pyobj
;
2413 #ifdef SWIGPYTHON_BUILTIN
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
;
2427 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2428 if (PyInstance_Check(pyobj
)) {
2429 obj
= _PyInstance_Lookup(pyobj
, SWIG_This());
2431 PyObject
**dictptr
= _PyObject_GetDictPtr(pyobj
);
2432 if (dictptr
!= NULL
) {
2433 PyObject
*dict
= *dictptr
;
2434 obj
= dict
? PyDict_GetItem(dict
, SWIG_This()) : 0;
2436 #ifdef PyWeakref_CheckProxy
2437 if (PyWeakref_CheckProxy(pyobj
)) {
2438 PyObject
*wobj
= PyWeakref_GET_OBJECT(pyobj
);
2439 return wobj
? SWIG_Python_GetSwigThis(wobj
) : 0;
2442 obj
= PyObject_GetAttr(pyobj
, SWIG_This());
2446 if (PyErr_Occurred()) PyErr_Clear();
2452 obj
= PyObject_GetAttr(pyobj
, SWIG_This());
2456 if (PyErr_Occurred()) PyErr_Clear();
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
;
2469 /* Acquire a pointer value */
2472 SWIG_Python_AcquirePtr(PyObject
*obj
, int own
) {
2473 if (own
== SWIG_POINTER_OWN
) {
2474 SwigPyObject
*sobj
= SWIG_Python_GetSwigThis(obj
);
2476 int oldown
= sobj
->own
;
2484 /* Convert a pointer value */
2487 SWIG_Python_ConvertPtrAndOwn(PyObject
*obj
, void **ptr
, swig_type_info
*ty
, int flags
, int *own
) {
2490 int implicit_conv
= (flags
& SWIG_POINTER_IMPLICIT_CONV
) != 0;
2494 if (obj
== Py_None
&& !implicit_conv
) {
2497 return (flags
& SWIG_POINTER_NO_NULL
) ? SWIG_NullReferenceError
: SWIG_OK
;
2502 sobj
= SWIG_Python_GetSwigThis(obj
);
2506 void *vptr
= sobj
->ptr
;
2508 swig_type_info
*to
= sobj
->ty
;
2510 /* no type cast needed */
2511 if (ptr
) *ptr
= vptr
;
2514 swig_cast_info
*tc
= SWIG_TypeCheck(to
->name
, ty
);
2516 sobj
= (SwigPyObject
*)sobj
->next
;
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 */
2524 *own
= *own
| SWIG_CAST_NEW_MEMORY
;
2531 if (ptr
) *ptr
= vptr
;
2536 if (((flags
& SWIG_POINTER_RELEASE
) == SWIG_POINTER_RELEASE
) && !sobj
->own
) {
2537 res
= SWIG_ERROR_RELEASE_NOT_OWNED
;
2540 *own
= *own
| sobj
->own
;
2541 if (flags
& SWIG_POINTER_DISOWN
) {
2544 if (flags
& SWIG_POINTER_CLEAR
) {
2550 if (implicit_conv
) {
2551 SwigPyClientData
*data
= ty
? (SwigPyClientData
*) ty
->clientdata
: 0;
2552 if (data
&& !data
->implicitconv
) {
2553 PyObject
*klass
= data
->klass
;
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()) {
2564 SwigPyObject
*iobj
= SWIG_Python_GetSwigThis(impconv
);
2567 res
= SWIG_Python_ConvertPtrAndOwn((PyObject
*)iobj
, &vptr
, ty
, 0, 0);
2568 if (SWIG_IsOK(res
)) {
2571 /* transfer the ownership to 'ptr' */
2573 res
= SWIG_AddCast(res
);
2574 res
= SWIG_AddNewMask(res
);
2576 res
= SWIG_AddCast(res
);
2584 if (!SWIG_IsOK(res
) && obj
== Py_None
) {
2587 if (PyErr_Occurred())
2596 /* Convert a function ptr value */
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);
2606 /* here we get the method pointer for callbacks */
2607 #ifndef Py_LIMITED_API
2608 const char *doc
= (((PyCFunctionObject
*)obj
) -> m_ml
-> ml_doc
);
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;
2614 const char *desc
= doc
? strstr(doc
, "swig_ptr: ") : 0;
2616 desc
= ty
? SWIG_UnpackVoidPtr(desc
+ 10, &vptr
, ty
->name
) : 0;
2617 #ifdef Py_LIMITED_API
2619 Py_XDECREF(pystr_doc
);
2623 tc
= SWIG_TypeCheck(desc
, ty
);
2626 *ptr
= SWIG_TypeCast(tc
, vptr
, &newmemory
);
2627 assert(!newmemory
); /* newmemory handling not yet implemented */
2635 /* Convert a packed pointer value */
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
;
2643 /* check type cast? */
2644 swig_cast_info
*tc
= SWIG_TypeCheck(to
->name
, ty
);
2645 if (!tc
) return SWIG_ERROR
;
2651 /* -----------------------------------------------------------------------------
2652 * Create a new pointer object
2653 * ----------------------------------------------------------------------------- */
2656 Create a new instance object, without calling __init__, and set the
2660 SWIGRUNTIME PyObject
*
2661 SWIG_Python_NewShadowInstance(SwigPyClientData
*data
, PyObject
*swig_this
) {
2663 PyObject
*newraw
= data
->newraw
;
2665 inst
= PyObject_Call(newraw
, data
->newargs
, NULL
);
2667 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2668 PyObject
**dictptr
= _PyObject_GetDictPtr(inst
);
2669 if (dictptr
!= NULL
) {
2670 PyObject
*dict
= *dictptr
;
2672 dict
= PyDict_New();
2676 PyDict_SetItem(dict
, SWIG_This(), swig_this
);
2683 if (PyObject_SetAttr(inst
, SWIG_This(), swig_this
) == -1) {
2690 #if PY_VERSION_HEX >= 0x03000000
2691 PyObject
*empty_args
= PyTuple_New(0);
2693 PyObject
*empty_kwargs
= PyDict_New();
2695 #ifndef Py_LIMITED_API
2696 newfunc newfn
= ((PyTypeObject
*)data
->newargs
)->tp_new
;
2698 newfunc newfn
= (newfunc
)PyType_GetSlot((PyTypeObject
*)data
->newargs
, Py_tp_new
);
2700 inst
= newfn((PyTypeObject
*)data
->newargs
, empty_args
, empty_kwargs
);
2701 Py_DECREF(empty_kwargs
);
2703 if (PyObject_SetAttr(inst
, SWIG_This(), swig_this
) == -1) {
2707 PyType_Modified(Py_TYPE(inst
));
2711 Py_DECREF(empty_args
);
2714 PyObject
*dict
= PyDict_New();
2716 PyDict_SetItem(dict
, SWIG_This(), swig_this
);
2717 inst
= PyInstance_NewRaw(data
->newargs
, dict
);
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
;
2732 dict
= PyDict_New();
2736 return PyDict_SetItem(dict
, SWIG_This(), swig_this
);
2742 return PyObject_SetAttr(inst
, SWIG_This(), swig_this
);
2746 SWIGINTERN PyObject
*
2747 SWIG_Python_InitShadowInstance(PyObject
*args
) {
2749 if (!SWIG_Python_UnpackTuple(args
, "swiginit", 2, 2, obj
)) {
2752 SwigPyObject
*sthis
= SWIG_Python_GetSwigThis(obj
[0]);
2754 Py_DECREF(SwigPyObject_append((PyObject
*) sthis
, obj
[1]));
2756 if (SWIG_Python_SetSwigThis(obj
[0], obj
[1]) != 0)
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
;
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
;
2781 #ifndef Py_LIMITED_API
2782 allocfunc alloc
= clientdata
->pytype
->tp_alloc
;
2784 allocfunc alloc
= (allocfunc
)PyType_GetSlot(clientdata
->pytype
, Py_tp_alloc
);
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
2796 newobj
= PyObject_New(SwigPyObject
, clientdata
->pytype
);
2797 #ifdef SWIGPYTHON_BUILTIN
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
);
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 /* -----------------------------------------------------------------------------*
2833 * -----------------------------------------------------------------------------*/
2835 #ifdef SWIG_LINK_RUNTIME
2836 void *SWIG_ReturnGlobalTypeList(void *);
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);
2859 void *type_pointer
= PyCapsule_Import(SWIGPY_CAPSULE_NAME
, 0);
2860 if (PyErr_Occurred()) {
2862 type_pointer
= (void *)0;
2865 return (swig_module_info
*) type_pointer
;
2869 static int interpreter_counter
= 0; /* how many (sub-)interpreters are using swig_module's types */
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
;
2876 if (--interpreter_counter
!= 0) /* another sub-interpreter may still be using the swig_module's types */
2878 for (i
= 0; i
< swig_module
->size
; ++i
) {
2879 swig_type_info
*ty
= types
[i
];
2881 SwigPyClientData
*data
= (SwigPyClientData
*) ty
->clientdata
;
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
;
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
);
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
);
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
;
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
;
2924 descriptor
= (swig_type_info
*) PyCapsule_GetPointer(obj
, NULL
);
2926 swig_module_info
*swig_module
= SWIG_GetModule(0);
2927 descriptor
= SWIG_TypeQueryModule(swig_module
, swig_module
, type
);
2929 obj
= PyCapsule_New((void *) descriptor
, NULL
, NULL
);
2931 PyDict_SetItem(cache
, key
, obj
);
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)
2948 SWIG_Python_AddErrMesg(const char *mesg
, int infront
) {
2949 if (PyErr_Occurred()) {
2951 PyObject
*value
= 0;
2952 PyObject
*traceback
= 0;
2953 PyErr_Fetch(&type
, &value
, &traceback
);
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";
2962 PyErr_Format(type
, "%s %s", mesg
, errmesg
);
2964 PyErr_Format(type
, "%s %s", errmesg
, mesg
);
2976 SWIG_Python_ArgFail(int argnum
) {
2977 if (PyErr_Occurred()) {
2978 /* add information about failing argument */
2980 PyOS_snprintf(mesg
, sizeof(mesg
), "argument number %d:", argnum
);
2981 return SWIG_Python_AddErrMesg(mesg
, 1);
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
: "";
2995 SWIG_Python_TypeError(const char *type
, PyObject
*obj
) {
2997 #if defined(SWIG_COBJECT_TYPES)
2998 if (obj
&& SwigPyObject_Check(obj
)) {
2999 const char *otype
= (const char *) SwigPyObject_GetDesc(obj
);
3001 PyErr_Format(PyExc_TypeError
, "a '%s' is expected, 'SwigPyObject(%s)' is received",
3008 #ifndef Py_LIMITED_API
3009 /* tp_name is not accessible */
3010 const char *otype
= (obj
? obj
->ob_type
->tp_name
: 0);
3012 PyObject
*str
= PyObject_Str(obj
);
3013 PyObject
*bytes
= NULL
;
3014 const char *cstr
= str
? SWIG_PyUnicode_AsUTF8AndSize(str
, NULL
, &bytes
) : 0;
3016 PyErr_Format(PyExc_TypeError
, "a '%s' is expected, '%s(%s)' is received",
3019 PyErr_Format(PyExc_TypeError
, "a '%s' is expected, '%s' is received",
3028 PyErr_Format(PyExc_TypeError
, "a '%s' is expected", type
);
3030 PyErr_Format(PyExc_TypeError
, "unexpected type is received");
3035 /* Convert a pointer value, signal an exception on a type mismatch */
3037 SWIG_Python_MustGetPtr(PyObject
*obj
, swig_type_info
*ty
, int SWIGUNUSEDPARM(argnum
), int flags
) {
3039 if (SWIG_Python_ConvertPtr(obj
, &result
, ty
, flags
) == -1) {
3045 #ifdef SWIGPYTHON_BUILTIN
3047 SWIG_Python_NonDynamicSetAttr(PyObject
*obj
, PyObject
*name
, PyObject
*value
) {
3048 PyTypeObject
*tp
= obj
->ob_type
;
3050 PyObject
*encoded_name
;
3054 # ifdef Py_USING_UNICODE
3055 if (PyString_Check(name
)) {
3056 name
= PyUnicode_Decode(PyString_AsString(name
), PyString_Size(name
), NULL
, NULL
);
3059 } else if (!PyUnicode_Check(name
))
3061 if (!PyString_Check(name
))
3064 PyErr_Format(PyExc_TypeError
, "attribute name must be string, not '%.200s'", name
->ob_type
->tp_name
);
3071 if (PyType_Ready(tp
) != 0)
3075 descr
= _PyType_Lookup(tp
, name
);
3078 f
= descr
->ob_type
->tp_descr_set
;
3080 if (PyString_Check(name
)) {
3081 encoded_name
= name
;
3084 encoded_name
= PyUnicode_AsUTF8String(name
);
3088 PyErr_Format(PyExc_AttributeError
, "'%.100s' object has no attribute '%.200s'", tp
->tp_name
, PyString_AsString(encoded_name
));
3089 Py_DECREF(encoded_name
);
3091 res
= f(descr
, obj
, value
);
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
3127 #define SWIG_TypeQuery SWIG_Python_TypeQuery
3129 /*-----------------------------------------------
3131 ------------------------------------------------*/
3132 #if PY_VERSION_HEX >= 0x03000000
3133 # define SWIG_init PyInit__pm3
3136 # define SWIG_init init_pm3
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 */
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;
3156 SWIGINTERN swig_type_info
*
3157 SWIG_pchar_descriptor(void) {
3158 static int init
= 0;
3159 static swig_type_info
*info
= 0;
3161 info
= SWIG_TypeQuery("_p_char");
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) */
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
))
3176 if (PyUnicode_Check(obj
))
3179 if (PyString_Check(obj
))
3184 PyObject
*bytes
= NULL
;
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
;
3192 cstr
= (char *)SWIG_PyUnicode_AsUTF8AndSize(obj
, &len
, &bytes
);
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
) {
3198 cstr
= (char *)memcpy(malloc((len
+ 1) * sizeof(char)), cstr
, sizeof(char) * (len
+ 1));
3199 *alloc
= SWIG_NEWOBJ
;
3201 /* alloc must be set in order to clean up allocated memory */
3202 return SWIG_RuntimeError
;
3206 if (cptr
) *cptr
= cstr
;
3207 if (psize
) *psize
= len
+ 1;
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"
3215 #if PY_VERSION_HEX<0x03000000
3216 if (PyUnicode_Check(obj
)) {
3219 if (!alloc
&& cptr
) {
3220 return SWIG_RuntimeError
;
3222 obj
= PyUnicode_AsUTF8String(obj
);
3224 return SWIG_TypeError
;
3225 if (PyString_AsStringAndSize(obj
, &cstr
, &len
) != -1) {
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;
3241 swig_type_info
*pchar_descriptor
= SWIG_pchar_descriptor();
3242 if (pchar_descriptor
) {
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
;
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;
3264 SWIGINTERN
void delete_pm3(pm3
*self
) {
3265 if (self
->script_embedded
) {
3266 // printf("SWIG pm3 destructor, nothing to do\n");
3268 // printf("SWIG pm3 destructor, close pm3\n");
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
);
3279 #if PY_VERSION_HEX < 0x03000000
3280 } else if (PyInt_Check(obj
)) {
3281 if (val
) *val
= (double) PyInt_AsLong(obj
);
3284 } else if (PyLong_Check(obj
)) {
3285 double v
= PyLong_AsDouble(obj
);
3286 if (!PyErr_Occurred()) {
3293 #ifdef SWIG_PYTHON_CAST_MODE
3296 double d
= PyFloat_AsDouble(obj
);
3297 if (!PyErr_Occurred()) {
3299 return SWIG_AddCast(SWIG_OK
);
3304 long v
= PyLong_AsLong(obj
);
3305 if (!PyErr_Occurred()) {
3307 return SWIG_AddCast(SWIG_AddCast(SWIG_OK
));
3324 SWIGINTERNINLINE
int
3325 SWIG_CanCastAsInteger(double *d
, double min
, double max
) {
3327 if ((min
<= x
&& x
<= max
)) {
3332 rd
= ((x
- fx
) < 0.5) ? fx
: cx
; /* simple rint */
3333 if ((errno
== EDOM
) || (errno
== ERANGE
)) {
3336 double summ
, reps
, diff
;
3339 } else if (rd
> x
) {
3346 if (reps
< 8 * DBL_EPSILON
) {
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
);
3364 if (PyLong_Check(obj
)) {
3365 long v
= PyLong_AsLong(obj
);
3366 if (!PyErr_Occurred()) {
3371 return SWIG_OverflowError
;
3374 #ifdef SWIG_PYTHON_CAST_MODE
3377 long v
= PyInt_AsLong(obj
);
3378 if (!PyErr_Occurred()) {
3380 return SWIG_AddCast(SWIG_OK
);
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
);
3399 return SWIG_TypeError
;
3404 SWIG_AsVal_bool(PyObject
*obj
, bool *val
) {
3406 if (!PyBool_Check(obj
))
3408 r
= PyObject_IsTrue(obj
);
3411 if (val
) *val
= r
? true : false;
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
) {
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();
3430 #if PY_VERSION_HEX >= 0x03000000
3431 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3432 return PyBytes_FromStringAndSize(carray
, (Py_ssize_t
)(size
));
3434 return PyUnicode_DecodeUTF8(carray
, (Py_ssize_t
)(size
), "surrogateescape");
3437 return PyString_FromStringAndSize(carray
, (Py_ssize_t
)(size
));
3441 return SWIG_Py_Void();
3446 SWIGINTERNINLINE PyObject
*
3447 SWIG_FromCharPtr(const char *cptr
) {
3448 return SWIG_FromCharPtrAndSize(cptr
, (cptr
? strlen(cptr
) : 0));
3454 SWIGINTERN PyObject
*_wrap_new_pm3__SWIG_0(PyObject
*self
, Py_ssize_t nobjs
, PyObject
**SWIGUNUSEDPARM(swig_obj
)) {
3455 PyObject
*resultobj
= 0;
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);
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 ;
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
);
3488 if (alloc1
== SWIG_NEWOBJ
) free((char *)buf1
);
3493 SWIGINTERN PyObject
*_wrap_new_pm3(PyObject
*self
, PyObject
*args
) {
3495 PyObject
*argv
[2] = {
3499 if (!(argc
= SWIG_Python_UnpackTuple(args
, "new_pm3", 0, 1, argv
))) SWIG_fail
;
3502 return _wrap_new_pm3__SWIG_0(self
, argc
, argv
);
3506 int res
= SWIG_AsCharPtrAndSize(argv
[0], 0, NULL
, 0);
3507 _v
= SWIG_CheckState(res
);
3509 return _wrap_new_pm3__SWIG_1(self
, argc
, argv
);
3514 SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_pm3'.\n"
3515 " Possible C/C++ prototypes are:\n"
3517 " pm3::pm3(char *)\n");
3522 SWIGINTERN PyObject
*_wrap_delete_pm3(PyObject
*self
, PyObject
*args
) {
3523 PyObject
*resultobj
= 0;
3524 pm3
*arg1
= (pm3
*) 0 ;
3527 PyObject
*swig_obj
[1] ;
3530 if (!args
) SWIG_fail
;
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
);
3538 resultobj
= SWIG_Py_Void();
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 ;
3557 PyObject
*swig_obj
[3] ;
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
);
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
);
3584 if (alloc2
== SWIG_NEWOBJ
) free((char *)buf2
);
3589 SWIGINTERN PyObject
*_wrap_pm3_name_get(PyObject
*self
, PyObject
*args
) {
3590 PyObject
*resultobj
= 0;
3591 pm3
*arg1
= (pm3
*) 0 ;
3594 PyObject
*swig_obj
[1] ;
3598 if (!args
) SWIG_fail
;
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
);
3613 SWIGINTERN PyObject
*_wrap_pm3_grabbed_output_get(PyObject
*self
, PyObject
*args
) {
3614 PyObject
*resultobj
= 0;
3615 pm3
*arg1
= (pm3
*) 0 ;
3618 PyObject
*swig_obj
[1] ;
3622 if (!args
) SWIG_fail
;
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
);
3637 SWIGINTERN PyObject
*pm3_swigregister(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*args
) {
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
[] = {
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
[] = {
3679 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3681 static swig_const_info swig_const_table
[] = {
3682 {0, 0, 0, 0.0, 0, 0}
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
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
3727 * ----------------------------------------------------------------------------- */
3737 #define SWIGRUNTIME_DEBUG
3740 #ifndef SWIG_INIT_CLIENT_DATA_TYPE
3741 #define SWIG_INIT_CLIENT_DATA_TYPE void *
3745 SWIG_InitializeModule(SWIG_INIT_CLIENT_DATA_TYPE clientdata
) {
3747 swig_module_info
*module_head
, *iter
;
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
;
3761 /* Try and load any already created modules */
3762 module_head
= SWIG_GetModule(clientdata
);
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
);
3768 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3771 if (iter
== &swig_module
) {
3772 /* Our module is already in the list, so there's nothing more to do. */
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
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
);
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
);
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
);
3807 /* Overwrite clientdata field */
3808 #ifdef SWIGRUNTIME_DEBUG
3809 printf("SWIG_InitializeModule: found type %s\n", type
->name
);
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
);
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 */
3826 #ifdef SWIGRUNTIME_DEBUG
3827 printf("SWIG_InitializeModule: look cast %s\n", cast
->type
->name
);
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
);
3836 if (type
== swig_module
.type_initial
[i
]) {
3837 #ifdef SWIGRUNTIME_DEBUG
3838 printf("SWIG_InitializeModule: skip old type %s\n", ret
->name
);
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
);
3848 if (!ocast
) ret
= 0;
3853 #ifdef SWIGRUNTIME_DEBUG
3854 printf("SWIG_InitializeModule: adding cast %s\n", cast
->type
->name
);
3857 type
->cast
->prev
= cast
;
3858 cast
->next
= type
->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
) {
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
);
3880 printf("---- Total casts: %d\n", j
);
3882 printf("**** SWIG_InitializeModule: Cast List ******\n");
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.
3892 SWIG_PropagateClientData(void) {
3894 swig_cast_info
*equiv
;
3895 static int init_run
= 0;
3897 if (init_run
) return;
3900 for (i
= 0; i
< swig_module
.size
; i
++) {
3901 if (swig_module
.types
[i
]->clientdata
) {
3902 equiv
= swig_module
.types
[i
]->cast
;
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
;
3928 /* -----------------------------------------------------------------------------
3929 * constants/methods manipulation
3930 * ----------------------------------------------------------------------------- */
3932 /* Install Constants */
3934 SWIG_Python_InstallConstants(PyObject
*d
, swig_const_info constants
[]) {
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);
3942 case SWIG_PY_BINARY
:
3943 obj
= SWIG_NewPackedObj(constants
[i
].pvalue
, constants
[i
].lvalue
, *(constants
[i
].ptype
));
3950 PyDict_SetItemString(d
, constants
[i
].name
, obj
);
3956 /* -----------------------------------------------------------------------------
3957 * Patch %callback methods' docstrings to hold the callback ptrs
3958 * -----------------------------------------------------------------------------*/
3961 SWIG_Python_FixMethods(PyMethodDef
*methods
, const swig_const_info
*const_table
, swig_type_info
**types
, swig_type_info
**types_initial
) {
3963 for (i
= 0; methods
[i
].ml_name
; ++i
) {
3964 const char *c
= methods
[i
].ml_doc
;
3966 c
= strstr(c
, "swig_ptr: ");
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
]);
3979 void *ptr
= (ci
->type
== SWIG_PY_POINTER
) ? ci
->pvalue
: 0;
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);
3988 memcpy(buff
, methods
[i
].ml_doc
, ldoc
);
3990 memcpy(buff
, "swig_ptr: ", 10);
3992 SWIG_PackVoidPtr(buff
, ptr
, ty
->name
, lptr
);
3993 methods
[i
].ml_doc
= ndoc
;
4008 /* -----------------------------------------------------------------------------*
4009 * Partial Init method
4010 * -----------------------------------------------------------------------------*/
4017 #if PY_VERSION_HEX >= 0x03000000
4023 PyObject
*m
, *d
, *md
, *globals
;
4025 #if PY_VERSION_HEX >= 0x03000000
4026 static struct PyModuleDef SWIG_module
= {
4027 PyModuleDef_HEAD_INIT
,
4039 #if defined(SWIGPYTHON_BUILTIN)
4040 static SwigPyClientData SwigPyObject_clientdata
= {
4043 static PyGetSetDef this_getset_def
= {
4044 (char *)"this", &SwigPyBuiltin_ThisClosure
, NULL
, NULL
, NULL
4046 static SwigPyGetSet thisown_getset_closure
= {
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
;
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
;
4067 (void)builtin_pytype
;
4068 (void)builtin_base_count
;
4069 (void)builtin_basetype
;
4071 (void)static_getset
;
4074 /* Metaclass is used to implement static member variables */
4075 metatype
= SwigPyObjectType();
4081 /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
4083 SWIG_Python_TypeCache();
4084 SwigPyPacked_type();
4085 #ifndef SWIGPYTHON_BUILTIN
4086 SwigPyObject_type();
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
);
4095 m
= Py_InitModule(SWIG_name
, SwigMethods
);
4098 md
= d
= PyModule_GetDict(m
);
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
;
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
4121 /* All objects have a 'this' attribute */
4122 this_descr
= PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def
);
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);
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
);
4141 SWIG_InstallConstants(d
, swig_const_table
);
4143 #if PY_VERSION_HEX >= 0x03000000