1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
5 * This file is not intended to be easily readable and contains a number of
6 * coding conventions designed to improve portability and efficiency. Do not make
7 * changes to this file unless you know what you are doing--modify the SWIG
8 * interface file instead.
9 * ----------------------------------------------------------------------------- */
16 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
18 /* -----------------------------------------------------------------------------
19 * This section contains generic SWIG labels for method/variable
20 * declarations/attributes, and other compiler dependent labels.
21 * ----------------------------------------------------------------------------- */
23 /* template workaround for compilers that cannot correctly implement the C++ standard */
24 #ifndef SWIGTEMPLATEDISAMBIGUATOR
25 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
26 # define SWIGTEMPLATEDISAMBIGUATOR template
27 # elif defined(__HP_aCC)
28 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
29 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
30 # define SWIGTEMPLATEDISAMBIGUATOR template
32 # define SWIGTEMPLATEDISAMBIGUATOR
36 /* inline attribute */
38 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
39 # define SWIGINLINE inline
45 /* attribute recognised by some compilers to avoid 'unused' warnings */
47 # if defined(__GNUC__)
48 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
49 # define SWIGUNUSED __attribute__ ((__unused__))
54 # define SWIGUNUSED __attribute__ ((__unused__))
60 #ifndef SWIG_MSC_UNSUPPRESS_4505
61 # if defined(_MSC_VER)
62 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
66 #ifndef SWIGUNUSEDPARM
68 # define SWIGUNUSEDPARM(p)
70 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
74 /* internal SWIG method */
76 # define SWIGINTERN static SWIGUNUSED
79 /* internal inline SWIG method */
80 #ifndef SWIGINTERNINLINE
81 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
84 /* exporting methods */
86 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
87 # ifndef GCC_HASCLASSVISIBILITY
88 # define GCC_HASCLASSVISIBILITY
94 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
95 # if defined(STATIC_LINKED)
98 # define SWIGEXPORT __declspec(dllexport)
101 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
102 # define SWIGEXPORT __attribute__ ((visibility("default")))
109 /* calling conventions for Windows */
111 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
112 # define SWIGSTDCALL __stdcall
118 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
119 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
120 # define _CRT_SECURE_NO_DEPRECATE
123 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
124 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
125 # define _SCL_SECURE_NO_DEPRECATE
128 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
129 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
130 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
133 /* Intel's compiler complains if a variable which was never initialised is
134 * cast to void, which is a common idiom which we use to indicate that we
135 * are aware a variable isn't used. So we just silence that warning.
136 * See: https://github.com/swig/swig/issues/192 for more discussion.
138 #ifdef __INTEL_COMPILER
139 # pragma warning disable 592
143 #if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
144 /* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
148 #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
149 /* Use debug wrappers with the Python release dll */
157 /* -----------------------------------------------------------------------------
160 * This file contains generic C API SWIG runtime support for pointer
162 * ----------------------------------------------------------------------------- */
164 /* This should only be incremented when either the layout of swig_type_info changes,
165 or for whatever reason, the runtime changes incompatibly */
166 #define SWIG_RUNTIME_VERSION "4"
168 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
169 #ifdef SWIG_TYPE_TABLE
170 # define SWIG_QUOTE_STRING(x) #x
171 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
172 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
174 # define SWIG_TYPE_TABLE_NAME
178 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
179 creating a static or dynamic library from the SWIG runtime code.
180 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
182 But only do this if strictly necessary, ie, if you have problems
183 with your compiler or suchlike.
187 # define SWIGRUNTIME SWIGINTERN
190 #ifndef SWIGRUNTIMEINLINE
191 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
194 /* Generic buffer size */
195 #ifndef SWIG_BUFFER_SIZE
196 # define SWIG_BUFFER_SIZE 1024
199 /* Flags for pointer conversions */
200 #define SWIG_POINTER_DISOWN 0x1
201 #define SWIG_CAST_NEW_MEMORY 0x2
202 #define SWIG_POINTER_NO_NULL 0x4
204 /* Flags for new pointer objects */
205 #define SWIG_POINTER_OWN 0x1
209 Flags/methods for returning states.
211 The SWIG conversion methods, as ConvertPtr, return an integer
212 that tells if the conversion was successful or not. And if not,
213 an error code can be returned (see swigerrors.swg for the codes).
215 Use the following macros/flags to set or process the returning
218 In old versions of SWIG, code such as the following was usually written:
220 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
226 Now you can be more explicit:
228 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
229 if (SWIG_IsOK(res)) {
235 which is the same really, but now you can also do
238 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
239 if (SWIG_IsOK(res)) {
241 if (SWIG_IsNewObj(res) {
251 I.e., now SWIG_ConvertPtr can return new objects and you can
252 identify the case and take care of the deallocation. Of course that
253 also requires SWIG_ConvertPtr to return new result values, such as
255 int SWIG_ConvertPtr(obj, ptr,...) {
257 if (<need new object>) {
258 *ptr = <ptr to new allocated object>;
261 *ptr = <ptr to old object>;
269 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
270 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
273 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
274 allows to return the 'cast rank', for example, if you have this
281 food(1) // cast rank '1' (1 -> 1.0)
282 fooi(1) // cast rank '0'
284 just use the SWIG_AddCast()/SWIG_CheckState()
288 #define SWIG_ERROR (-1)
289 #define SWIG_IsOK(r) (r >= 0)
290 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
292 /* The CastRankLimit says how many bits are used for the cast rank */
293 #define SWIG_CASTRANKLIMIT (1 << 8)
294 /* The NewMask denotes the object was created (using new/malloc) */
295 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
296 /* The TmpMask is for in/out typemaps that use temporal objects */
297 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
298 /* Simple returning values */
299 #define SWIG_BADOBJ (SWIG_ERROR)
300 #define SWIG_OLDOBJ (SWIG_OK)
301 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
302 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
303 /* Check, add and del mask methods */
304 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
305 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
306 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
307 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
308 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
309 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
312 #if defined(SWIG_CASTRANK_MODE)
313 # ifndef SWIG_TypeRank
314 # define SWIG_TypeRank unsigned long
316 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
317 # define SWIG_MAXCASTRANK (2)
319 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
320 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
321 SWIGINTERNINLINE
int SWIG_AddCast(int r
) {
322 return SWIG_IsOK(r
) ? ((SWIG_CastRank(r
) < SWIG_MAXCASTRANK
) ? (r
+ 1) : SWIG_ERROR
) : r
;
324 SWIGINTERNINLINE
int SWIG_CheckState(int r
) {
325 return SWIG_IsOK(r
) ? SWIG_CastRank(r
) + 1 : 0;
327 #else /* no cast-rank mode */
328 # define SWIG_AddCast(r) (r)
329 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
339 typedef void *(*swig_converter_func
)(void *, int *);
340 typedef struct swig_type_info
*(*swig_dycast_func
)(void **);
342 /* Structure to store information on one type */
343 typedef struct swig_type_info
{
344 const char *name
; /* mangled name of this type */
345 const char *str
; /* human readable name of this type */
346 swig_dycast_func dcast
; /* dynamic cast function down a hierarchy */
347 struct swig_cast_info
*cast
; /* linked list of types that can cast into this type */
348 void *clientdata
; /* language specific type data */
349 int owndata
; /* flag if the structure owns the clientdata */
352 /* Structure to store a type and conversion function used for casting */
353 typedef struct swig_cast_info
{
354 swig_type_info
*type
; /* pointer to type that is equivalent to this type */
355 swig_converter_func converter
; /* function to cast the void pointers */
356 struct swig_cast_info
*next
; /* pointer to next cast in linked list */
357 struct swig_cast_info
*prev
; /* pointer to the previous cast */
360 /* Structure used to store module information
361 * Each module generates one structure like this, and the runtime collects
362 * all of these structures and stores them in a circularly linked list.*/
363 typedef struct swig_module_info
{
364 swig_type_info
**types
; /* Array of pointers to swig_type_info structures that are in this module */
365 size_t size
; /* Number of types in this module */
366 struct swig_module_info
*next
; /* Pointer to next element in circularly linked list */
367 swig_type_info
**type_initial
; /* Array of initially generated type structures */
368 swig_cast_info
**cast_initial
; /* Array of initially generated casting structures */
369 void *clientdata
; /* Language specific module data */
373 Compare two type names skipping the space characters, therefore
374 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
376 Return 0 when the two name types are equivalent, as in
377 strncmp, but skipping ' '.
380 SWIG_TypeNameComp(const char *f1
, const char *l1
,
381 const char *f2
, const char *l2
) {
382 for (; (f1
!= l1
) && (f2
!= l2
); ++f1
, ++f2
) {
383 while ((*f1
== ' ') && (f1
!= l1
)) ++f1
;
384 while ((*f2
== ' ') && (f2
!= l2
)) ++f2
;
385 if (*f1
!= *f2
) return (*f1
> *f2
) ? 1 : -1;
387 return (int)((l1
- f1
) - (l2
- f2
));
391 Check type equivalence in a name list like <name1>|<name2>|...
392 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
395 SWIG_TypeCmp(const char *nb
, const char *tb
) {
397 const char *te
= tb
+ strlen(tb
);
399 while (equiv
!= 0 && *ne
) {
400 for (nb
= ne
; *ne
; ++ne
) {
401 if (*ne
== '|') break;
403 equiv
= SWIG_TypeNameComp(nb
, ne
, tb
, te
);
410 Check type equivalence in a name list like <name1>|<name2>|...
411 Return 0 if not equal, 1 if equal
414 SWIG_TypeEquiv(const char *nb
, const char *tb
) {
415 return SWIG_TypeCmp(nb
, tb
) == 0 ? 1 : 0;
421 SWIGRUNTIME swig_cast_info
*
422 SWIG_TypeCheck(const char *c
, swig_type_info
*ty
) {
424 swig_cast_info
*iter
= ty
->cast
;
426 if (strcmp(iter
->type
->name
, c
) == 0) {
427 if (iter
== ty
->cast
)
429 /* Move iter to the top of the linked list */
430 iter
->prev
->next
= iter
->next
;
432 iter
->next
->prev
= iter
->prev
;
433 iter
->next
= ty
->cast
;
435 if (ty
->cast
) ty
->cast
->prev
= iter
;
446 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
448 SWIGRUNTIME swig_cast_info
*
449 SWIG_TypeCheckStruct(swig_type_info
*from
, swig_type_info
*ty
) {
451 swig_cast_info
*iter
= ty
->cast
;
453 if (iter
->type
== from
) {
454 if (iter
== ty
->cast
)
456 /* Move iter to the top of the linked list */
457 iter
->prev
->next
= iter
->next
;
459 iter
->next
->prev
= iter
->prev
;
460 iter
->next
= ty
->cast
;
462 if (ty
->cast
) ty
->cast
->prev
= iter
;
473 Cast a pointer up an inheritance hierarchy
475 SWIGRUNTIMEINLINE
void *
476 SWIG_TypeCast(swig_cast_info
*ty
, void *ptr
, int *newmemory
) {
477 return ((!ty
) || (!ty
->converter
)) ? ptr
: (*ty
->converter
)(ptr
, newmemory
);
481 Dynamic pointer casting. Down an inheritance hierarchy
483 SWIGRUNTIME swig_type_info
*
484 SWIG_TypeDynamicCast(swig_type_info
*ty
, void **ptr
) {
485 swig_type_info
*lastty
= ty
;
486 if (!ty
|| !ty
->dcast
) return ty
;
487 while (ty
&& (ty
->dcast
)) {
488 ty
= (*ty
->dcast
)(ptr
);
495 Return the name associated with this type
497 SWIGRUNTIMEINLINE
const char *
498 SWIG_TypeName(const swig_type_info
*ty
) {
503 Return the pretty name associated with this type,
504 that is an unmangled type name in a form presentable to the user.
506 SWIGRUNTIME
const char *
507 SWIG_TypePrettyName(const swig_type_info
*type
) {
508 /* The "str" field contains the equivalent pretty names of the
509 type, separated by vertical-bar characters. We choose
510 to print the last name, as it is often (?) the most
512 if (!type
) return NULL
;
513 if (type
->str
!= NULL
) {
514 const char *last_name
= type
->str
;
516 for (s
= type
->str
; *s
; s
++)
517 if (*s
== '|') last_name
= s
+ 1;
524 Set the clientdata field for a type
527 SWIG_TypeClientData(swig_type_info
*ti
, void *clientdata
) {
528 swig_cast_info
*cast
= ti
->cast
;
529 /* if (ti->clientdata == clientdata) return; */
530 ti
->clientdata
= clientdata
;
533 if (!cast
->converter
) {
534 swig_type_info
*tc
= cast
->type
;
535 if (!tc
->clientdata
) {
536 SWIG_TypeClientData(tc
, clientdata
);
543 SWIG_TypeNewClientData(swig_type_info
*ti
, void *clientdata
) {
544 SWIG_TypeClientData(ti
, clientdata
);
549 Search for a swig_type_info structure only by mangled name
550 Search is a O(log #types)
552 We start searching at module start, and finish searching when start == end.
553 Note: if start == end at the beginning of the function, we go all the way around
556 SWIGRUNTIME swig_type_info
*
557 SWIG_MangledTypeQueryModule(swig_module_info
*start
,
558 swig_module_info
*end
,
560 swig_module_info
*iter
= start
;
564 size_t r
= iter
->size
- 1;
566 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
567 size_t i
= (l
+ r
) >> 1;
568 const char *iname
= iter
->types
[i
]->name
;
570 int compare
= strcmp(name
, iname
);
572 return iter
->types
[i
];
573 } else if (compare
< 0) {
579 } else if (compare
> 0) {
583 break; /* should never happen */
588 } while (iter
!= end
);
593 Search for a swig_type_info structure for either a mangled name or a human readable name.
594 It first searches the mangled names of the types, which is a O(log #types)
595 If a type is not found it then searches the human readable names, which is O(#types).
597 We start searching at module start, and finish searching when start == end.
598 Note: if start == end at the beginning of the function, we go all the way around
601 SWIGRUNTIME swig_type_info
*
602 SWIG_TypeQueryModule(swig_module_info
*start
,
603 swig_module_info
*end
,
605 /* STEP 1: Search the name field using binary search */
606 swig_type_info
*ret
= SWIG_MangledTypeQueryModule(start
, end
, name
);
610 /* STEP 2: If the type hasn't been found, do a complete search
611 of the str field (the human readable name) */
612 swig_module_info
*iter
= start
;
615 for (; i
< iter
->size
; ++i
) {
616 if (iter
->types
[i
]->str
&& (SWIG_TypeEquiv(iter
->types
[i
]->str
, name
)))
617 return iter
->types
[i
];
620 } while (iter
!= end
);
623 /* neither found a match */
628 Pack binary data into a string
631 SWIG_PackData(char *c
, void *ptr
, size_t sz
) {
632 static const char hex
[17] = "0123456789abcdef";
633 const unsigned char *u
= (unsigned char *) ptr
;
634 const unsigned char *eu
= u
+ sz
;
635 for (; u
!= eu
; ++u
) {
636 unsigned char uu
= *u
;
637 *(c
++) = hex
[(uu
& 0xf0) >> 4];
638 *(c
++) = hex
[uu
& 0xf];
644 Unpack binary data from a string
646 SWIGRUNTIME
const char *
647 SWIG_UnpackData(const char *c
, void *ptr
, size_t sz
) {
648 unsigned char *u
= (unsigned char *) ptr
;
649 const unsigned char *eu
= u
+ sz
;
650 for (; u
!= eu
; ++u
) {
653 if ((d
>= '0') && (d
<= '9'))
654 uu
= (unsigned char)((d
- '0') << 4);
655 else if ((d
>= 'a') && (d
<= 'f'))
656 uu
= (unsigned char)((d
- ('a' - 10)) << 4);
660 if ((d
>= '0') && (d
<= '9'))
661 uu
|= (unsigned char)(d
- '0');
662 else if ((d
>= 'a') && (d
<= 'f'))
663 uu
|= (unsigned char)(d
- ('a' - 10));
672 Pack 'void *' into a string buffer.
675 SWIG_PackVoidPtr(char *buff
, void *ptr
, const char *name
, size_t bsz
) {
677 if ((2 * sizeof(void *) + 2) > bsz
) return 0;
679 r
= SWIG_PackData(r
, &ptr
, sizeof(void *));
680 if (strlen(name
) + 1 > (bsz
- (r
- buff
))) return 0;
685 SWIGRUNTIME
const char *
686 SWIG_UnpackVoidPtr(const char *c
, void **ptr
, const char *name
) {
688 if (strcmp(c
, "NULL") == 0) {
695 return SWIG_UnpackData(++c
, ptr
, sizeof(void *));
699 SWIG_PackDataName(char *buff
, void *ptr
, size_t sz
, const char *name
, size_t bsz
) {
701 size_t lname
= (name
? strlen(name
) : 0);
702 if ((2 * sz
+ 2 + lname
) > bsz
) return 0;
704 r
= SWIG_PackData(r
, ptr
, sz
);
706 strncpy(r
, name
, lname
+ 1);
713 SWIGRUNTIME
const char *
714 SWIG_UnpackDataName(const char *c
, void *ptr
, size_t sz
, const char *name
) {
716 if (strcmp(c
, "NULL") == 0) {
723 return SWIG_UnpackData(++c
, ptr
, sz
);
731 #define SWIG_UnknownError -1
732 #define SWIG_IOError -2
733 #define SWIG_RuntimeError -3
734 #define SWIG_IndexError -4
735 #define SWIG_TypeError -5
736 #define SWIG_DivisionByZero -6
737 #define SWIG_OverflowError -7
738 #define SWIG_SyntaxError -8
739 #define SWIG_ValueError -9
740 #define SWIG_SystemError -10
741 #define SWIG_AttributeError -11
742 #define SWIG_MemoryError -12
743 #define SWIG_NullReferenceError -13
747 /* Compatibility macros for Python 3 */
748 #if PY_VERSION_HEX >= 0x03000000
750 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
751 #define PyInt_Check(x) PyLong_Check(x)
752 #define PyInt_AsLong(x) PyLong_AsLong(x)
753 #define PyInt_FromLong(x) PyLong_FromLong(x)
754 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
755 #define PyString_Check(name) PyBytes_Check(name)
756 #define PyString_FromString(x) PyUnicode_FromString(x)
757 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
758 #define PyString_AsString(str) PyBytes_AsString(str)
759 #define PyString_Size(str) PyBytes_Size(str)
760 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
761 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
762 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
763 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
768 # define Py_TYPE(op) ((op)->ob_type)
771 /* SWIG APIs for compatibility of both Python 2 & 3 */
773 #if PY_VERSION_HEX >= 0x03000000
774 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
776 # define SWIG_Python_str_FromFormat PyString_FromFormat
780 /* Warning: This function will allocate a new string in Python 3,
781 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
784 SWIG_Python_str_AsChar(PyObject
*str
) {
785 #if PY_VERSION_HEX >= 0x03000000
787 str
= PyUnicode_AsUTF8String(str
);
791 PyBytes_AsStringAndSize(str
, &cstr
, &len
);
792 newstr
= (char *) malloc(len
+ 1);
793 memcpy(newstr
, cstr
, len
+ 1);
798 return PyString_AsString(str
);
802 #if PY_VERSION_HEX >= 0x03000000
803 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
805 # define SWIG_Python_str_DelForPy3(x)
809 SWIGINTERN PyObject
*
810 SWIG_Python_str_FromChar(const char *c
) {
811 #if PY_VERSION_HEX >= 0x03000000
812 return PyUnicode_FromString(c
);
814 return PyString_FromString(c
);
819 # define PyObject_DEL PyObject_Del
822 // SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
823 // interface files check for it.
824 # define SWIGPY_USE_CAPSULE
825 # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
827 #if PY_VERSION_HEX < 0x03020000
828 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
829 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
830 #define Py_hash_t long
833 /* -----------------------------------------------------------------------------
835 * ----------------------------------------------------------------------------- */
837 SWIGRUNTIME PyObject
*
838 SWIG_Python_ErrorType(int code
) {
841 case SWIG_MemoryError
:
842 type
= PyExc_MemoryError
;
845 type
= PyExc_IOError
;
847 case SWIG_RuntimeError
:
848 type
= PyExc_RuntimeError
;
850 case SWIG_IndexError
:
851 type
= PyExc_IndexError
;
854 type
= PyExc_TypeError
;
856 case SWIG_DivisionByZero
:
857 type
= PyExc_ZeroDivisionError
;
859 case SWIG_OverflowError
:
860 type
= PyExc_OverflowError
;
862 case SWIG_SyntaxError
:
863 type
= PyExc_SyntaxError
;
865 case SWIG_ValueError
:
866 type
= PyExc_ValueError
;
868 case SWIG_SystemError
:
869 type
= PyExc_SystemError
;
871 case SWIG_AttributeError
:
872 type
= PyExc_AttributeError
;
875 type
= PyExc_RuntimeError
;
882 SWIG_Python_AddErrorMsg(const char *mesg
) {
885 PyObject
*traceback
= 0;
887 if (PyErr_Occurred())
888 PyErr_Fetch(&type
, &value
, &traceback
);
890 PyObject
*old_str
= PyObject_Str(value
);
891 const char *tmp
= SWIG_Python_str_AsChar(old_str
);
895 PyErr_Format(type
, "%s %s", tmp
, mesg
);
897 PyErr_Format(type
, "%s", mesg
);
898 SWIG_Python_str_DelForPy3(tmp
);
902 PyErr_SetString(PyExc_RuntimeError
, mesg
);
907 SWIG_Python_TypeErrorOccurred(PyObject
*obj
) {
911 error
= PyErr_Occurred();
912 return error
&& PyErr_GivenExceptionMatches(error
, PyExc_TypeError
);
916 SWIG_Python_RaiseOrModifyTypeError(const char *message
) {
917 if (SWIG_Python_TypeErrorOccurred(NULL
)) {
918 /* Use existing TypeError to preserve stacktrace and enhance with given message */
920 PyObject
*type
= NULL
, *value
= NULL
, *traceback
= NULL
;
921 PyErr_Fetch(&type
, &value
, &traceback
);
922 #if PY_VERSION_HEX >= 0x03000000
923 newvalue
= PyUnicode_FromFormat("%S\nAdditional information:\n%s", value
, message
);
925 newvalue
= PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value
), message
);
928 PyErr_Restore(type
, newvalue
, traceback
);
930 /* Raise TypeError using given message */
931 PyErr_SetString(PyExc_TypeError
, message
);
935 #if defined(SWIG_PYTHON_NO_THREADS)
936 # if defined(SWIG_PYTHON_THREADS)
937 # undef SWIG_PYTHON_THREADS
940 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
941 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
942 # define SWIG_PYTHON_USE_GIL
944 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
945 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
946 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
948 # ifdef __cplusplus /* C++ code */
949 class SWIG_Python_Thread_Block
{
951 PyGILState_STATE state
;
953 void end() { if (status
) { PyGILState_Release(state
); status
= false;} }
954 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
955 ~SWIG_Python_Thread_Block() { end(); }
957 class SWIG_Python_Thread_Allow
{
961 void end() { if (status
) { PyEval_RestoreThread(save
); status
= false; }}
962 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
963 ~SWIG_Python_Thread_Allow() { end(); }
965 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
966 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
967 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
968 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
970 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
971 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
972 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
973 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
975 # else /* Old thread way, not implemented, user must provide it */
976 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
977 # define SWIG_PYTHON_INITIALIZE_THREADS
979 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
980 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
982 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
983 # define SWIG_PYTHON_THREAD_END_BLOCK
985 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
986 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
988 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
989 # define SWIG_PYTHON_THREAD_END_ALLOW
992 #else /* No thread support */
993 # define SWIG_PYTHON_INITIALIZE_THREADS
994 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
995 # define SWIG_PYTHON_THREAD_END_BLOCK
996 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
997 # define SWIG_PYTHON_THREAD_END_ALLOW
1000 /* -----------------------------------------------------------------------------
1001 * Python API portion that goes into the runtime
1002 * ----------------------------------------------------------------------------- */
1008 /* -----------------------------------------------------------------------------
1009 * Constant declarations
1010 * ----------------------------------------------------------------------------- */
1012 /* Constant Types */
1013 #define SWIG_PY_POINTER 4
1014 #define SWIG_PY_BINARY 5
1016 /* Constant information structure */
1017 typedef struct swig_const_info
{
1023 swig_type_info
**ptype
;
1031 /* -----------------------------------------------------------------------------
1034 * This file contains the runtime support for Python modules
1035 * and includes code for managing global variables and pointer
1038 * ----------------------------------------------------------------------------- */
1040 #if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
1041 # error "This version of SWIG only supports Python >= 2.7"
1044 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
1045 # error "This version of SWIG only supports Python 3 >= 3.2"
1048 /* Common SWIG API */
1050 /* for raw pointers */
1051 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1052 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1053 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1055 #ifdef SWIGPYTHON_BUILTIN
1056 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1058 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1061 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1063 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1064 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1065 #define swig_owntype int
1067 /* for raw packed data */
1068 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1069 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1071 /* for class or struct pointers */
1072 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1073 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1075 /* for C or C++ function pointers */
1076 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1077 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1079 /* for C++ member pointers, ie, member methods */
1080 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1081 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1086 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1087 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1088 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1090 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1091 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1092 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1093 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1094 #define SWIG_fail goto fail
1097 /* Runtime API implementation */
1099 /* Error manipulation */
1102 SWIG_Python_SetErrorObj(PyObject
*errtype
, PyObject
*obj
) {
1103 SWIG_PYTHON_THREAD_BEGIN_BLOCK
;
1104 PyErr_SetObject(errtype
, obj
);
1106 SWIG_PYTHON_THREAD_END_BLOCK
;
1110 SWIG_Python_SetErrorMsg(PyObject
*errtype
, const char *msg
) {
1111 SWIG_PYTHON_THREAD_BEGIN_BLOCK
;
1112 PyErr_SetString(errtype
, msg
);
1113 SWIG_PYTHON_THREAD_END_BLOCK
;
1116 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1118 /* Set a constant value */
1120 #if defined(SWIGPYTHON_BUILTIN)
1123 SwigPyBuiltin_AddPublicSymbol(PyObject
*seq
, const char *key
) {
1124 PyObject
*s
= PyString_InternFromString(key
);
1125 PyList_Append(seq
, s
);
1130 SWIG_Python_SetConstant(PyObject
*d
, PyObject
*public_interface
, const char *name
, PyObject
*obj
) {
1131 PyDict_SetItemString(d
, name
, obj
);
1133 if (public_interface
)
1134 SwigPyBuiltin_AddPublicSymbol(public_interface
, name
);
1140 SWIG_Python_SetConstant(PyObject
*d
, const char *name
, PyObject
*obj
) {
1141 PyDict_SetItemString(d
, name
, obj
);
1147 /* Append a value to the result obj */
1149 SWIGINTERN PyObject
*
1150 SWIG_Python_AppendOutput(PyObject
*result
, PyObject
*obj
) {
1153 } else if (result
== Py_None
) {
1157 if (!PyList_Check(result
)) {
1158 PyObject
*o2
= result
;
1159 result
= PyList_New(1);
1160 PyList_SetItem(result
, 0, o2
);
1162 PyList_Append(result
, obj
);
1168 /* Unpack the argument tuple */
1170 SWIGINTERN Py_ssize_t
1171 SWIG_Python_UnpackTuple(PyObject
*args
, const char *name
, Py_ssize_t min
, Py_ssize_t max
, PyObject
**objs
) {
1176 PyErr_Format(PyExc_TypeError
, "%s expected %s%d arguments, got none",
1177 name
, (min
== max
? "" : "at least "), (int)min
);
1181 if (!PyTuple_Check(args
)) {
1182 if (min
<= 1 && max
>= 1) {
1185 for (i
= 1; i
< max
; ++i
) {
1190 PyErr_SetString(PyExc_SystemError
, "UnpackTuple() argument list is not a tuple");
1193 Py_ssize_t l
= PyTuple_GET_SIZE(args
);
1195 PyErr_Format(PyExc_TypeError
, "%s expected %s%d arguments, got %d",
1196 name
, (min
== max
? "" : "at least "), (int)min
, (int)l
);
1198 } else if (l
> max
) {
1199 PyErr_Format(PyExc_TypeError
, "%s expected %s%d arguments, got %d",
1200 name
, (min
== max
? "" : "at most "), (int)max
, (int)l
);
1204 for (i
= 0; i
< l
; ++i
) {
1205 objs
[i
] = PyTuple_GET_ITEM(args
, i
);
1207 for (; l
< max
; ++l
) {
1215 /* A functor is a function object with one single object argument */
1216 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1219 Helper for static pointer initialization for both C and C++ code, for example
1220 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1223 #define SWIG_STATIC_POINTER(var) var
1225 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1228 /* -----------------------------------------------------------------------------
1229 * Pointer declarations
1230 * ----------------------------------------------------------------------------- */
1232 /* Flags for new pointer objects */
1233 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1234 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1236 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1238 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1239 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1245 /* The python void return value */
1247 SWIGRUNTIMEINLINE PyObject
*
1248 SWIG_Py_Void(void) {
1249 PyObject
*none
= Py_None
;
1254 /* SwigPyClientData */
1263 PyTypeObject
*pytype
;
1266 SWIGRUNTIMEINLINE
int
1267 SWIG_Python_CheckImplicit(swig_type_info
*ty
) {
1268 SwigPyClientData
*data
= (SwigPyClientData
*)ty
->clientdata
;
1269 int fail
= data
? data
->implicitconv
: 0;
1271 PyErr_SetString(PyExc_TypeError
, "Implicit conversion is prohibited for explicit constructors.");
1275 SWIGRUNTIMEINLINE PyObject
*
1276 SWIG_Python_ExceptionType(swig_type_info
*desc
) {
1277 SwigPyClientData
*data
= desc
? (SwigPyClientData
*) desc
->clientdata
: 0;
1278 PyObject
*klass
= data
? data
->klass
: 0;
1279 return (klass
? klass
: PyExc_RuntimeError
);
1283 SWIGRUNTIME SwigPyClientData
*
1284 SwigPyClientData_New(PyObject
*obj
) {
1288 SwigPyClientData
*data
= (SwigPyClientData
*)malloc(sizeof(SwigPyClientData
));
1289 /* the klass element */
1291 Py_INCREF(data
->klass
);
1292 /* the newraw method and newargs arguments used to create a new raw instance */
1293 if (PyClass_Check(obj
)) {
1295 data
->newargs
= obj
;
1298 data
->newraw
= PyObject_GetAttrString(data
->klass
, "__new__");
1300 Py_INCREF(data
->newraw
);
1301 data
->newargs
= PyTuple_New(1);
1302 PyTuple_SetItem(data
->newargs
, 0, obj
);
1304 data
->newargs
= obj
;
1306 Py_INCREF(data
->newargs
);
1308 /* the destroy method, aka as the C++ delete method */
1309 data
->destroy
= PyObject_GetAttrString(data
->klass
, "__swig_destroy__");
1310 if (PyErr_Occurred()) {
1314 if (data
->destroy
) {
1316 Py_INCREF(data
->destroy
);
1317 flags
= PyCFunction_GET_FLAGS(data
->destroy
);
1318 data
->delargs
= !(flags
& (METH_O
));
1322 data
->implicitconv
= 0;
1329 SwigPyClientData_Del(SwigPyClientData
*data
) {
1330 Py_XDECREF(data
->newraw
);
1331 Py_XDECREF(data
->newargs
);
1332 Py_XDECREF(data
->destroy
);
1335 /* =============== SwigPyObject =====================*/
1343 #ifdef SWIGPYTHON_BUILTIN
1349 #ifdef SWIGPYTHON_BUILTIN
1351 SWIGRUNTIME PyObject
*
1352 SwigPyObject_get___dict__(PyObject
*v
, PyObject
*SWIGUNUSEDPARM(args
)) {
1353 SwigPyObject
*sobj
= (SwigPyObject
*)v
;
1356 sobj
->dict
= PyDict_New();
1358 Py_INCREF(sobj
->dict
);
1364 SWIGRUNTIME PyObject
*
1365 SwigPyObject_long(SwigPyObject
*v
) {
1366 return PyLong_FromVoidPtr(v
->ptr
);
1369 SWIGRUNTIME PyObject
*
1370 SwigPyObject_format(const char *fmt
, SwigPyObject
*v
) {
1371 PyObject
*res
= NULL
;
1372 PyObject
*args
= PyTuple_New(1);
1374 if (PyTuple_SetItem(args
, 0, SwigPyObject_long(v
)) == 0) {
1375 PyObject
*ofmt
= SWIG_Python_str_FromChar(fmt
);
1377 #if PY_VERSION_HEX >= 0x03000000
1378 res
= PyUnicode_Format(ofmt
, args
);
1380 res
= PyString_Format(ofmt
, args
);
1390 SWIGRUNTIME PyObject
*
1391 SwigPyObject_oct(SwigPyObject
*v
) {
1392 return SwigPyObject_format("%o", v
);
1395 SWIGRUNTIME PyObject
*
1396 SwigPyObject_hex(SwigPyObject
*v
) {
1397 return SwigPyObject_format("%x", v
);
1400 SWIGRUNTIME PyObject
*
1401 SwigPyObject_repr(SwigPyObject
*v
) {
1402 const char *name
= SWIG_TypePrettyName(v
->ty
);
1403 PyObject
*repr
= SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name
? name
: "unknown"), (void *)v
);
1405 PyObject
*nrep
= SwigPyObject_repr((SwigPyObject
*)v
->next
);
1406 # if PY_VERSION_HEX >= 0x03000000
1407 PyObject
*joined
= PyUnicode_Concat(repr
, nrep
);
1412 PyString_ConcatAndDel(&repr
, nrep
);
1418 /* We need a version taking two PyObject* parameters so it's a valid
1419 * PyCFunction to use in swigobject_methods[]. */
1420 SWIGRUNTIME PyObject
*
1421 SwigPyObject_repr2(PyObject
*v
, PyObject
*SWIGUNUSEDPARM(args
)) {
1422 return SwigPyObject_repr((SwigPyObject
*)v
);
1426 SwigPyObject_compare(SwigPyObject
*v
, SwigPyObject
*w
) {
1429 return (i
< j
) ? -1 : ((i
> j
) ? 1 : 0);
1432 /* Added for Python 3.x, would it also be useful for Python 2.x? */
1433 SWIGRUNTIME PyObject
*
1434 SwigPyObject_richcompare(SwigPyObject
*v
, SwigPyObject
*w
, int op
) {
1436 if (op
!= Py_EQ
&& op
!= Py_NE
) {
1437 Py_INCREF(Py_NotImplemented
);
1438 return Py_NotImplemented
;
1440 res
= PyBool_FromLong((SwigPyObject_compare(v
, w
) == 0) == (op
== Py_EQ
) ? 1 : 0);
1445 SWIGRUNTIME PyTypeObject
*SwigPyObject_TypeOnce(void);
1447 #ifdef SWIGPYTHON_BUILTIN
1448 static swig_type_info
*SwigPyObject_stype
= 0;
1449 SWIGRUNTIME PyTypeObject
*
1450 SwigPyObject_type(void) {
1451 SwigPyClientData
*cd
;
1452 assert(SwigPyObject_stype
);
1453 cd
= (SwigPyClientData
*) SwigPyObject_stype
->clientdata
;
1459 SWIGRUNTIME PyTypeObject
*
1460 SwigPyObject_type(void) {
1461 static PyTypeObject
*SWIG_STATIC_POINTER(type
) = SwigPyObject_TypeOnce();
1466 SWIGRUNTIMEINLINE
int
1467 SwigPyObject_Check(PyObject
*op
) {
1468 #ifdef SWIGPYTHON_BUILTIN
1469 PyTypeObject
*target_tp
= SwigPyObject_type();
1470 if (PyType_IsSubtype(op
->ob_type
, target_tp
))
1472 return (strcmp(op
->ob_type
->tp_name
, "SwigPyObject") == 0);
1474 return (Py_TYPE(op
) == SwigPyObject_type())
1475 || (strcmp(Py_TYPE(op
)->tp_name
, "SwigPyObject") == 0);
1479 SWIGRUNTIME PyObject
*
1480 SwigPyObject_New(void *ptr
, swig_type_info
*ty
, int own
);
1483 SwigPyObject_dealloc(PyObject
*v
) {
1484 SwigPyObject
*sobj
= (SwigPyObject
*) v
;
1485 PyObject
*next
= sobj
->next
;
1486 if (sobj
->own
== SWIG_POINTER_OWN
) {
1487 swig_type_info
*ty
= sobj
->ty
;
1488 SwigPyClientData
*data
= ty
? (SwigPyClientData
*) ty
->clientdata
: 0;
1489 PyObject
*destroy
= data
? data
->destroy
: 0;
1491 /* destroy is always a VARARGS method */
1494 /* PyObject_CallFunction() has the potential to silently drop
1495 the active exception. In cases of unnamed temporary
1496 variable or where we just finished iterating over a generator
1497 StopIteration will be active right now, and this needs to
1498 remain true upon return from SwigPyObject_dealloc. So save
1501 PyObject
*type
= NULL
, *value
= NULL
, *traceback
= NULL
;
1502 PyErr_Fetch(&type
, &value
, &traceback
);
1504 if (data
->delargs
) {
1505 /* we need to create a temporary object to carry the destroy operation */
1506 PyObject
*tmp
= SwigPyObject_New(sobj
->ptr
, ty
, 0);
1507 res
= SWIG_Python_CallFunctor(destroy
, tmp
);
1510 PyCFunction meth
= PyCFunction_GET_FUNCTION(destroy
);
1511 PyObject
*mself
= PyCFunction_GET_SELF(destroy
);
1512 res
= ((*meth
)(mself
, v
));
1515 PyErr_WriteUnraisable(destroy
);
1517 PyErr_Restore(type
, value
, traceback
);
1521 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1523 const char *name
= SWIG_TypePrettyName(ty
);
1524 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name
? name
: "unknown"));
1532 SWIGRUNTIME PyObject
*
1533 SwigPyObject_append(PyObject
*v
, PyObject
*next
) {
1534 SwigPyObject
*sobj
= (SwigPyObject
*) v
;
1535 if (!SwigPyObject_Check(next
)) {
1536 PyErr_SetString(PyExc_TypeError
, "Attempt to append a non SwigPyObject");
1541 return SWIG_Py_Void();
1544 SWIGRUNTIME PyObject
*
1545 SwigPyObject_next(PyObject
*v
, PyObject
*SWIGUNUSEDPARM(args
)) {
1546 SwigPyObject
*sobj
= (SwigPyObject
*) v
;
1548 Py_INCREF(sobj
->next
);
1551 return SWIG_Py_Void();
1555 SWIGINTERN PyObject
*
1556 SwigPyObject_disown(PyObject
*v
, PyObject
*SWIGUNUSEDPARM(args
)) {
1557 SwigPyObject
*sobj
= (SwigPyObject
*)v
;
1559 return SWIG_Py_Void();
1562 SWIGINTERN PyObject
*
1563 SwigPyObject_acquire(PyObject
*v
, PyObject
*SWIGUNUSEDPARM(args
)) {
1564 SwigPyObject
*sobj
= (SwigPyObject
*)v
;
1565 sobj
->own
= SWIG_POINTER_OWN
;
1566 return SWIG_Py_Void();
1569 SWIGINTERN PyObject
*
1570 SwigPyObject_own(PyObject
*v
, PyObject
*args
) {
1572 if (!PyArg_UnpackTuple(args
, "own", 0, 1, &val
)) {
1575 SwigPyObject
*sobj
= (SwigPyObject
*)v
;
1576 PyObject
*obj
= PyBool_FromLong(sobj
->own
);
1578 if (PyObject_IsTrue(val
)) {
1579 SwigPyObject_acquire(v
, args
);
1581 SwigPyObject_disown(v
, args
);
1589 swigobject_methods
[] = {
1590 {"disown", SwigPyObject_disown
, METH_NOARGS
, "releases ownership of the pointer"},
1591 {"acquire", SwigPyObject_acquire
, METH_NOARGS
, "acquires ownership of the pointer"},
1592 {"own", SwigPyObject_own
, METH_VARARGS
, "returns/sets ownership of the pointer"},
1593 {"append", SwigPyObject_append
, METH_O
, "appends another 'this' object"},
1594 {"next", SwigPyObject_next
, METH_NOARGS
, "returns the next 'this' object"},
1595 {"__repr__", SwigPyObject_repr2
, METH_NOARGS
, "returns object representation"},
1599 SWIGRUNTIME PyTypeObject
*
1600 SwigPyObject_TypeOnce(void) {
1601 static char swigobject_doc
[] = "Swig object carries a C/C++ instance pointer";
1603 static PyNumberMethods SwigPyObject_as_number
= {
1604 (binaryfunc
)0, /*nb_add*/
1605 (binaryfunc
)0, /*nb_subtract*/
1606 (binaryfunc
)0, /*nb_multiply*/
1607 /* nb_divide removed in Python 3 */
1608 #if PY_VERSION_HEX < 0x03000000
1609 (binaryfunc
)0, /*nb_divide*/
1611 (binaryfunc
)0, /*nb_remainder*/
1612 (binaryfunc
)0, /*nb_divmod*/
1613 (ternaryfunc
)0,/*nb_power*/
1614 (unaryfunc
)0, /*nb_negative*/
1615 (unaryfunc
)0, /*nb_positive*/
1616 (unaryfunc
)0, /*nb_absolute*/
1617 (inquiry
)0, /*nb_nonzero*/
1624 #if PY_VERSION_HEX < 0x03000000
1627 (unaryfunc
)SwigPyObject_long
, /*nb_int*/
1628 #if PY_VERSION_HEX < 0x03000000
1629 (unaryfunc
)SwigPyObject_long
, /*nb_long*/
1633 (unaryfunc
)0, /*nb_float*/
1634 #if PY_VERSION_HEX < 0x03000000
1635 (unaryfunc
)SwigPyObject_oct
, /*nb_oct*/
1636 (unaryfunc
)SwigPyObject_hex
, /*nb_hex*/
1638 #if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
1639 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
1640 #elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1641 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1643 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* nb_inplace_add -> nb_index */
1647 static PyTypeObject swigpyobject_type
;
1648 static int type_init
= 0;
1650 const PyTypeObject tmp
= {
1651 #if PY_VERSION_HEX >= 0x03000000
1652 PyVarObject_HEAD_INIT(NULL
, 0)
1654 PyObject_HEAD_INIT(NULL
)
1657 "SwigPyObject", /* tp_name */
1658 sizeof(SwigPyObject
), /* tp_basicsize */
1659 0, /* tp_itemsize */
1660 (destructor
)SwigPyObject_dealloc
, /* tp_dealloc */
1662 (getattrfunc
)0, /* tp_getattr */
1663 (setattrfunc
)0, /* tp_setattr */
1664 #if PY_VERSION_HEX >= 0x03000000
1665 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1667 (cmpfunc
)SwigPyObject_compare
, /* tp_compare */
1669 (reprfunc
)SwigPyObject_repr
, /* tp_repr */
1670 &SwigPyObject_as_number
, /* tp_as_number */
1671 0, /* tp_as_sequence */
1672 0, /* tp_as_mapping */
1673 (hashfunc
)0, /* tp_hash */
1674 (ternaryfunc
)0, /* tp_call */
1676 PyObject_GenericGetAttr
, /* tp_getattro */
1677 0, /* tp_setattro */
1678 0, /* tp_as_buffer */
1679 Py_TPFLAGS_DEFAULT
, /* tp_flags */
1680 swigobject_doc
, /* tp_doc */
1681 0, /* tp_traverse */
1683 (richcmpfunc
)SwigPyObject_richcompare
,/* tp_richcompare */
1684 0, /* tp_weaklistoffset */
1686 0, /* tp_iternext */
1687 swigobject_methods
, /* tp_methods */
1692 0, /* tp_descr_get */
1693 0, /* tp_descr_set */
1694 0, /* tp_dictoffset */
1703 0, /* tp_subclasses */
1704 0, /* tp_weaklist */
1706 0, /* tp_version_tag */
1707 #if PY_VERSION_HEX >= 0x03040000
1708 0, /* tp_finalize */
1713 0, /* tp_maxalloc */
1718 swigpyobject_type
= tmp
;
1720 if (PyType_Ready(&swigpyobject_type
) < 0)
1723 return &swigpyobject_type
;
1726 SWIGRUNTIME PyObject
*
1727 SwigPyObject_New(void *ptr
, swig_type_info
*ty
, int own
) {
1728 SwigPyObject
*sobj
= PyObject_NEW(SwigPyObject
, SwigPyObject_type());
1735 return (PyObject
*)sobj
;
1738 /* -----------------------------------------------------------------------------
1739 * Implements a simple Swig Packed type, and use it instead of string
1740 * ----------------------------------------------------------------------------- */
1749 SWIGRUNTIME PyObject
*
1750 SwigPyPacked_repr(SwigPyPacked
*v
) {
1751 char result
[SWIG_BUFFER_SIZE
];
1752 if (SWIG_PackDataName(result
, v
->pack
, v
->size
, 0, sizeof(result
))) {
1753 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result
, v
->ty
->name
);
1755 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v
->ty
->name
);
1759 SWIGRUNTIME PyObject
*
1760 SwigPyPacked_str(SwigPyPacked
*v
) {
1761 char result
[SWIG_BUFFER_SIZE
];
1762 if (SWIG_PackDataName(result
, v
->pack
, v
->size
, 0, sizeof(result
))) {
1763 return SWIG_Python_str_FromFormat("%s%s", result
, v
->ty
->name
);
1765 return SWIG_Python_str_FromChar(v
->ty
->name
);
1770 SwigPyPacked_compare(SwigPyPacked
*v
, SwigPyPacked
*w
) {
1773 int s
= (i
< j
) ? -1 : ((i
> j
) ? 1 : 0);
1774 return s
? s
: strncmp((const char *)v
->pack
, (const char *)w
->pack
, 2 * v
->size
);
1777 SWIGRUNTIME PyTypeObject
*SwigPyPacked_TypeOnce(void);
1779 SWIGRUNTIME PyTypeObject
*
1780 SwigPyPacked_type(void) {
1781 static PyTypeObject
*SWIG_STATIC_POINTER(type
) = SwigPyPacked_TypeOnce();
1785 SWIGRUNTIMEINLINE
int
1786 SwigPyPacked_Check(PyObject
*op
) {
1787 return ((op
)->ob_type
== SwigPyPacked_TypeOnce())
1788 || (strcmp((op
)->ob_type
->tp_name
, "SwigPyPacked") == 0);
1792 SwigPyPacked_dealloc(PyObject
*v
) {
1793 if (SwigPyPacked_Check(v
)) {
1794 SwigPyPacked
*sobj
= (SwigPyPacked
*) v
;
1800 SWIGRUNTIME PyTypeObject
*
1801 SwigPyPacked_TypeOnce(void) {
1802 static char swigpacked_doc
[] = "Swig object carries a C/C++ instance pointer";
1803 static PyTypeObject swigpypacked_type
;
1804 static int type_init
= 0;
1806 const PyTypeObject tmp
= {
1807 #if PY_VERSION_HEX>=0x03000000
1808 PyVarObject_HEAD_INIT(NULL
, 0)
1810 PyObject_HEAD_INIT(NULL
)
1813 "SwigPyPacked", /* tp_name */
1814 sizeof(SwigPyPacked
), /* tp_basicsize */
1815 0, /* tp_itemsize */
1816 (destructor
)SwigPyPacked_dealloc
, /* tp_dealloc */
1818 (getattrfunc
)0, /* tp_getattr */
1819 (setattrfunc
)0, /* tp_setattr */
1820 #if PY_VERSION_HEX>=0x03000000
1821 0, /* tp_reserved in 3.0.1 */
1823 (cmpfunc
)SwigPyPacked_compare
, /* tp_compare */
1825 (reprfunc
)SwigPyPacked_repr
, /* tp_repr */
1826 0, /* tp_as_number */
1827 0, /* tp_as_sequence */
1828 0, /* tp_as_mapping */
1829 (hashfunc
)0, /* tp_hash */
1830 (ternaryfunc
)0, /* tp_call */
1831 (reprfunc
)SwigPyPacked_str
, /* tp_str */
1832 PyObject_GenericGetAttr
, /* tp_getattro */
1833 0, /* tp_setattro */
1834 0, /* tp_as_buffer */
1835 Py_TPFLAGS_DEFAULT
, /* tp_flags */
1836 swigpacked_doc
, /* tp_doc */
1837 0, /* tp_traverse */
1839 0, /* tp_richcompare */
1840 0, /* tp_weaklistoffset */
1842 0, /* tp_iternext */
1848 0, /* tp_descr_get */
1849 0, /* tp_descr_set */
1850 0, /* tp_dictoffset */
1859 0, /* tp_subclasses */
1860 0, /* tp_weaklist */
1862 0, /* tp_version_tag */
1863 #if PY_VERSION_HEX >= 0x03040000
1864 0, /* tp_finalize */
1869 0, /* tp_maxalloc */
1874 swigpypacked_type
= tmp
;
1876 if (PyType_Ready(&swigpypacked_type
) < 0)
1879 return &swigpypacked_type
;
1882 SWIGRUNTIME PyObject
*
1883 SwigPyPacked_New(void *ptr
, size_t size
, swig_type_info
*ty
) {
1884 SwigPyPacked
*sobj
= PyObject_NEW(SwigPyPacked
, SwigPyPacked_type());
1886 void *pack
= malloc(size
);
1888 memcpy(pack
, ptr
, size
);
1893 PyObject_DEL((PyObject
*) sobj
);
1897 return (PyObject
*) sobj
;
1900 SWIGRUNTIME swig_type_info
*
1901 SwigPyPacked_UnpackData(PyObject
*obj
, void *ptr
, size_t size
) {
1902 if (SwigPyPacked_Check(obj
)) {
1903 SwigPyPacked
*sobj
= (SwigPyPacked
*)obj
;
1904 if (sobj
->size
!= size
) return 0;
1905 memcpy(ptr
, sobj
->pack
, size
);
1912 /* -----------------------------------------------------------------------------
1913 * pointers/data manipulation
1914 * ----------------------------------------------------------------------------- */
1916 static PyObject
*Swig_This_global
= NULL
;
1918 SWIGRUNTIME PyObject
*
1920 if (Swig_This_global
== NULL
)
1921 Swig_This_global
= SWIG_Python_str_FromChar("this");
1922 return Swig_This_global
;
1925 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
1927 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
1928 #if PY_VERSION_HEX>=0x03000000
1929 #define SWIG_PYTHON_SLOW_GETSET_THIS
1932 SWIGRUNTIME SwigPyObject
*
1933 SWIG_Python_GetSwigThis(PyObject
*pyobj
) {
1936 if (SwigPyObject_Check(pyobj
))
1937 return (SwigPyObject
*) pyobj
;
1939 #ifdef SWIGPYTHON_BUILTIN
1941 # ifdef PyWeakref_CheckProxy
1942 if (PyWeakref_CheckProxy(pyobj
)) {
1943 pyobj
= PyWeakref_GET_OBJECT(pyobj
);
1944 if (pyobj
&& SwigPyObject_Check(pyobj
))
1945 return (SwigPyObject
*) pyobj
;
1953 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
1954 if (PyInstance_Check(pyobj
)) {
1955 obj
= _PyInstance_Lookup(pyobj
, SWIG_This());
1957 PyObject
**dictptr
= _PyObject_GetDictPtr(pyobj
);
1958 if (dictptr
!= NULL
) {
1959 PyObject
*dict
= *dictptr
;
1960 obj
= dict
? PyDict_GetItem(dict
, SWIG_This()) : 0;
1962 #ifdef PyWeakref_CheckProxy
1963 if (PyWeakref_CheckProxy(pyobj
)) {
1964 PyObject
*wobj
= PyWeakref_GET_OBJECT(pyobj
);
1965 return wobj
? SWIG_Python_GetSwigThis(wobj
) : 0;
1968 obj
= PyObject_GetAttr(pyobj
, SWIG_This());
1972 if (PyErr_Occurred()) PyErr_Clear();
1978 obj
= PyObject_GetAttr(pyobj
, SWIG_This());
1982 if (PyErr_Occurred()) PyErr_Clear();
1986 if (obj
&& !SwigPyObject_Check(obj
)) {
1987 /* a PyObject is called 'this', try to get the 'real this'
1988 SwigPyObject from it */
1989 return SWIG_Python_GetSwigThis(obj
);
1991 return (SwigPyObject
*)obj
;
1995 /* Acquire a pointer value */
1998 SWIG_Python_AcquirePtr(PyObject
*obj
, int own
) {
1999 if (own
== SWIG_POINTER_OWN
) {
2000 SwigPyObject
*sobj
= SWIG_Python_GetSwigThis(obj
);
2002 int oldown
= sobj
->own
;
2010 /* Convert a pointer value */
2013 SWIG_Python_ConvertPtrAndOwn(PyObject
*obj
, void **ptr
, swig_type_info
*ty
, int flags
, int *own
) {
2016 int implicit_conv
= (flags
& SWIG_POINTER_IMPLICIT_CONV
) != 0;
2020 if (obj
== Py_None
&& !implicit_conv
) {
2023 return (flags
& SWIG_POINTER_NO_NULL
) ? SWIG_NullReferenceError
: SWIG_OK
;
2028 sobj
= SWIG_Python_GetSwigThis(obj
);
2032 void *vptr
= sobj
->ptr
;
2034 swig_type_info
*to
= sobj
->ty
;
2036 /* no type cast needed */
2037 if (ptr
) *ptr
= vptr
;
2040 swig_cast_info
*tc
= SWIG_TypeCheck(to
->name
, ty
);
2042 sobj
= (SwigPyObject
*)sobj
->next
;
2046 *ptr
= SWIG_TypeCast(tc
, vptr
, &newmemory
);
2047 if (newmemory
== SWIG_CAST_NEW_MEMORY
) {
2048 assert(own
); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2050 *own
= *own
| SWIG_CAST_NEW_MEMORY
;
2057 if (ptr
) *ptr
= vptr
;
2063 *own
= *own
| sobj
->own
;
2064 if (flags
& SWIG_POINTER_DISOWN
) {
2069 if (implicit_conv
) {
2070 SwigPyClientData
*data
= ty
? (SwigPyClientData
*) ty
->clientdata
: 0;
2071 if (data
&& !data
->implicitconv
) {
2072 PyObject
*klass
= data
->klass
;
2075 data
->implicitconv
= 1; /* avoid recursion and call 'explicit' constructors*/
2076 impconv
= SWIG_Python_CallFunctor(klass
, obj
);
2077 data
->implicitconv
= 0;
2078 if (PyErr_Occurred()) {
2083 SwigPyObject
*iobj
= SWIG_Python_GetSwigThis(impconv
);
2086 res
= SWIG_Python_ConvertPtrAndOwn((PyObject
*)iobj
, &vptr
, ty
, 0, 0);
2087 if (SWIG_IsOK(res
)) {
2090 /* transfer the ownership to 'ptr' */
2092 res
= SWIG_AddCast(res
);
2093 res
= SWIG_AddNewMask(res
);
2095 res
= SWIG_AddCast(res
);
2103 if (!SWIG_IsOK(res
) && obj
== Py_None
) {
2106 if (PyErr_Occurred())
2115 /* Convert a function ptr value */
2118 SWIG_Python_ConvertFunctionPtr(PyObject
*obj
, void **ptr
, swig_type_info
*ty
) {
2119 if (!PyCFunction_Check(obj
)) {
2120 return SWIG_ConvertPtr(obj
, ptr
, ty
, 0);
2125 /* here we get the method pointer for callbacks */
2126 const char *doc
= (((PyCFunctionObject
*)obj
) -> m_ml
-> ml_doc
);
2127 const char *desc
= doc
? strstr(doc
, "swig_ptr: ") : 0;
2129 desc
= ty
? SWIG_UnpackVoidPtr(desc
+ 10, &vptr
, ty
->name
) : 0;
2132 tc
= SWIG_TypeCheck(desc
, ty
);
2135 *ptr
= SWIG_TypeCast(tc
, vptr
, &newmemory
);
2136 assert(!newmemory
); /* newmemory handling not yet implemented */
2144 /* Convert a packed pointer value */
2147 SWIG_Python_ConvertPacked(PyObject
*obj
, void *ptr
, size_t sz
, swig_type_info
*ty
) {
2148 swig_type_info
*to
= SwigPyPacked_UnpackData(obj
, ptr
, sz
);
2149 if (!to
) return SWIG_ERROR
;
2152 /* check type cast? */
2153 swig_cast_info
*tc
= SWIG_TypeCheck(to
->name
, ty
);
2154 if (!tc
) return SWIG_ERROR
;
2160 /* -----------------------------------------------------------------------------
2161 * Create a new pointer object
2162 * ----------------------------------------------------------------------------- */
2165 Create a new instance object, without calling __init__, and set the
2169 SWIGRUNTIME PyObject
*
2170 SWIG_Python_NewShadowInstance(SwigPyClientData
*data
, PyObject
*swig_this
) {
2172 PyObject
*newraw
= data
->newraw
;
2174 inst
= PyObject_Call(newraw
, data
->newargs
, NULL
);
2176 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2177 PyObject
**dictptr
= _PyObject_GetDictPtr(inst
);
2178 if (dictptr
!= NULL
) {
2179 PyObject
*dict
= *dictptr
;
2181 dict
= PyDict_New();
2183 PyDict_SetItem(dict
, SWIG_This(), swig_this
);
2187 PyObject
*key
= SWIG_This();
2188 PyObject_SetAttr(inst
, key
, swig_this
);
2192 #if PY_VERSION_HEX >= 0x03000000
2193 PyObject
*empty_args
= PyTuple_New(0);
2195 PyObject
*empty_kwargs
= PyDict_New();
2197 inst
= ((PyTypeObject
*)data
->newargs
)->tp_new((PyTypeObject
*)data
->newargs
, empty_args
, empty_kwargs
);
2198 Py_DECREF(empty_kwargs
);
2200 PyObject_SetAttr(inst
, SWIG_This(), swig_this
);
2201 Py_TYPE(inst
)->tp_flags
&= ~Py_TPFLAGS_VALID_VERSION_TAG
;
2204 Py_DECREF(empty_args
);
2207 PyObject
*dict
= PyDict_New();
2209 PyDict_SetItem(dict
, SWIG_This(), swig_this
);
2210 inst
= PyInstance_NewRaw(data
->newargs
, dict
);
2219 SWIG_Python_SetSwigThis(PyObject
*inst
, PyObject
*swig_this
) {
2221 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2222 PyObject
**dictptr
= _PyObject_GetDictPtr(inst
);
2223 if (dictptr
!= NULL
) {
2226 dict
= PyDict_New();
2229 PyDict_SetItem(dict
, SWIG_This(), swig_this
);
2233 dict
= PyObject_GetAttrString(inst
, "__dict__");
2234 PyDict_SetItem(dict
, SWIG_This(), swig_this
);
2239 SWIGINTERN PyObject
*
2240 SWIG_Python_InitShadowInstance(PyObject
*args
) {
2242 if (!SWIG_Python_UnpackTuple(args
, "swiginit", 2, 2, obj
)) {
2245 SwigPyObject
*sthis
= SWIG_Python_GetSwigThis(obj
[0]);
2247 SwigPyObject_append((PyObject
*) sthis
, obj
[1]);
2249 SWIG_Python_SetSwigThis(obj
[0], obj
[1]);
2251 return SWIG_Py_Void();
2255 /* Create a new pointer object */
2257 SWIGRUNTIME PyObject
*
2258 SWIG_Python_NewPointerObj(PyObject
*self
, void *ptr
, swig_type_info
*type
, int flags
) {
2259 SwigPyClientData
*clientdata
;
2264 return SWIG_Py_Void();
2266 clientdata
= type
? (SwigPyClientData
*)(type
->clientdata
) : 0;
2267 own
= (flags
& SWIG_POINTER_OWN
) ? SWIG_POINTER_OWN
: 0;
2268 if (clientdata
&& clientdata
->pytype
) {
2269 SwigPyObject
*newobj
;
2270 if (flags
& SWIG_BUILTIN_TP_INIT
) {
2271 newobj
= (SwigPyObject
*) self
;
2273 PyObject
*next_self
= clientdata
->pytype
->tp_alloc(clientdata
->pytype
, 0);
2274 while (newobj
->next
)
2275 newobj
= (SwigPyObject
*) newobj
->next
;
2276 newobj
->next
= next_self
;
2277 newobj
= (SwigPyObject
*)next_self
;
2278 #ifdef SWIGPYTHON_BUILTIN
2283 newobj
= PyObject_New(SwigPyObject
, clientdata
->pytype
);
2284 #ifdef SWIGPYTHON_BUILTIN
2293 return (PyObject
*) newobj
;
2295 return SWIG_Py_Void();
2298 assert(!(flags
& SWIG_BUILTIN_TP_INIT
));
2300 robj
= SwigPyObject_New(ptr
, type
, own
);
2301 if (robj
&& clientdata
&& !(flags
& SWIG_POINTER_NOSHADOW
)) {
2302 PyObject
*inst
= SWIG_Python_NewShadowInstance(clientdata
, robj
);
2309 /* Create a new packed object */
2311 SWIGRUNTIMEINLINE PyObject
*
2312 SWIG_Python_NewPackedObj(void *ptr
, size_t sz
, swig_type_info
*type
) {
2313 return ptr
? SwigPyPacked_New((void *) ptr
, sz
, type
) : SWIG_Py_Void();
2316 /* -----------------------------------------------------------------------------*
2318 * -----------------------------------------------------------------------------*/
2320 #ifdef SWIG_LINK_RUNTIME
2321 void *SWIG_ReturnGlobalTypeList(void *);
2324 SWIGRUNTIME swig_module_info
*
2325 SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata
)) {
2326 static void *type_pointer
= (void *)0;
2327 /* first check if module already created */
2328 if (!type_pointer
) {
2329 #ifdef SWIG_LINK_RUNTIME
2330 type_pointer
= SWIG_ReturnGlobalTypeList((void *)0);
2332 type_pointer
= PyCapsule_Import(SWIGPY_CAPSULE_NAME
, 0);
2333 if (PyErr_Occurred()) {
2335 type_pointer
= (void *)0;
2339 return (swig_module_info
*) type_pointer
;
2343 SWIG_Python_DestroyModule(PyObject
*obj
) {
2344 swig_module_info
*swig_module
= (swig_module_info
*) PyCapsule_GetPointer(obj
, SWIGPY_CAPSULE_NAME
);
2345 swig_type_info
**types
= swig_module
->types
;
2347 for (i
= 0; i
< swig_module
->size
; ++i
) {
2348 swig_type_info
*ty
= types
[i
];
2350 SwigPyClientData
*data
= (SwigPyClientData
*) ty
->clientdata
;
2351 if (data
) SwigPyClientData_Del(data
);
2354 Py_DECREF(SWIG_This());
2355 Swig_This_global
= NULL
;
2359 SWIG_Python_SetModule(swig_module_info
*swig_module
) {
2360 #if PY_VERSION_HEX >= 0x03000000
2361 /* Add a dummy module object into sys.modules */
2362 PyObject
*module
= PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION
);
2364 static PyMethodDef swig_empty_runtime_method_table
[] = { {NULL
, NULL
, 0, NULL
} }; /* Sentinel */
2365 PyObject
*module
= Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION
, swig_empty_runtime_method_table
);
2367 PyObject
*pointer
= PyCapsule_New((void *) swig_module
, SWIGPY_CAPSULE_NAME
, SWIG_Python_DestroyModule
);
2368 if (pointer
&& module
) {
2369 PyModule_AddObject(module
, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME
, pointer
);
2371 Py_XDECREF(pointer
);
2375 /* The python cached type query */
2376 SWIGRUNTIME PyObject
*
2377 SWIG_Python_TypeCache(void) {
2378 static PyObject
*SWIG_STATIC_POINTER(cache
) = PyDict_New();
2382 SWIGRUNTIME swig_type_info
*
2383 SWIG_Python_TypeQuery(const char *type
) {
2384 PyObject
*cache
= SWIG_Python_TypeCache();
2385 PyObject
*key
= SWIG_Python_str_FromChar(type
);
2386 PyObject
*obj
= PyDict_GetItem(cache
, key
);
2387 swig_type_info
*descriptor
;
2389 descriptor
= (swig_type_info
*) PyCapsule_GetPointer(obj
, NULL
);
2391 swig_module_info
*swig_module
= SWIG_GetModule(0);
2392 descriptor
= SWIG_TypeQueryModule(swig_module
, swig_module
, type
);
2394 obj
= PyCapsule_New((void *) descriptor
, NULL
, NULL
);
2395 PyDict_SetItem(cache
, key
, obj
);
2404 For backward compatibility only
2406 #define SWIG_POINTER_EXCEPTION 0
2407 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2408 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2411 SWIG_Python_AddErrMesg(const char *mesg
, int infront
) {
2412 if (PyErr_Occurred()) {
2414 PyObject
*value
= 0;
2415 PyObject
*traceback
= 0;
2416 PyErr_Fetch(&type
, &value
, &traceback
);
2418 PyObject
*old_str
= PyObject_Str(value
);
2419 const char *tmp
= SWIG_Python_str_AsChar(old_str
);
2420 const char *errmesg
= tmp
? tmp
: "Invalid error message";
2424 PyErr_Format(type
, "%s %s", mesg
, errmesg
);
2426 PyErr_Format(type
, "%s %s", errmesg
, mesg
);
2428 SWIG_Python_str_DelForPy3(tmp
);
2438 SWIG_Python_ArgFail(int argnum
) {
2439 if (PyErr_Occurred()) {
2440 /* add information about failing argument */
2442 PyOS_snprintf(mesg
, sizeof(mesg
), "argument number %d:", argnum
);
2443 return SWIG_Python_AddErrMesg(mesg
, 1);
2449 SWIGRUNTIMEINLINE
const char *
2450 SwigPyObject_GetDesc(PyObject
*self
) {
2451 SwigPyObject
*v
= (SwigPyObject
*)self
;
2452 swig_type_info
*ty
= v
? v
->ty
: 0;
2453 return ty
? ty
->str
: "";
2457 SWIG_Python_TypeError(const char *type
, PyObject
*obj
) {
2459 #if defined(SWIG_COBJECT_TYPES)
2460 if (obj
&& SwigPyObject_Check(obj
)) {
2461 const char *otype
= (const char *) SwigPyObject_GetDesc(obj
);
2463 PyErr_Format(PyExc_TypeError
, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2470 const char *otype
= (obj
? obj
->ob_type
->tp_name
: 0);
2472 PyObject
*str
= PyObject_Str(obj
);
2473 const char *cstr
= str
? SWIG_Python_str_AsChar(str
) : 0;
2475 PyErr_Format(PyExc_TypeError
, "a '%s' is expected, '%s(%s)' is received",
2477 SWIG_Python_str_DelForPy3(cstr
);
2479 PyErr_Format(PyExc_TypeError
, "a '%s' is expected, '%s' is received",
2486 PyErr_Format(PyExc_TypeError
, "a '%s' is expected", type
);
2488 PyErr_Format(PyExc_TypeError
, "unexpected type is received");
2493 /* Convert a pointer value, signal an exception on a type mismatch */
2495 SWIG_Python_MustGetPtr(PyObject
*obj
, swig_type_info
*ty
, int SWIGUNUSEDPARM(argnum
), int flags
) {
2497 if (SWIG_Python_ConvertPtr(obj
, &result
, ty
, flags
) == -1) {
2499 #if SWIG_POINTER_EXCEPTION
2501 SWIG_Python_TypeError(SWIG_TypePrettyName(ty
), obj
);
2502 SWIG_Python_ArgFail(argnum
);
2509 #ifdef SWIGPYTHON_BUILTIN
2511 SWIG_Python_NonDynamicSetAttr(PyObject
*obj
, PyObject
*name
, PyObject
*value
) {
2512 PyTypeObject
*tp
= obj
->ob_type
;
2514 PyObject
*encoded_name
;
2518 # ifdef Py_USING_UNICODE
2519 if (PyString_Check(name
)) {
2520 name
= PyUnicode_Decode(PyString_AsString(name
), PyString_Size(name
), NULL
, NULL
);
2523 } else if (!PyUnicode_Check(name
))
2525 if (!PyString_Check(name
))
2528 PyErr_Format(PyExc_TypeError
, "attribute name must be string, not '%.200s'", name
->ob_type
->tp_name
);
2535 if (PyType_Ready(tp
) < 0)
2539 descr
= _PyType_Lookup(tp
, name
);
2542 f
= descr
->ob_type
->tp_descr_set
;
2544 if (PyString_Check(name
)) {
2545 encoded_name
= name
;
2548 encoded_name
= PyUnicode_AsUTF8String(name
);
2552 PyErr_Format(PyExc_AttributeError
, "'%.100s' object has no attribute '%.200s'", tp
->tp_name
, PyString_AsString(encoded_name
));
2553 Py_DECREF(encoded_name
);
2555 res
= f(descr
, obj
, value
);
2571 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2573 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2581 /* Method creation and docstring support functions */
2583 SWIGINTERN PyMethodDef
*SWIG_PythonGetProxyDoc(const char *name
);
2584 SWIGINTERN PyObject
*SWIG_PyInstanceMethod_New(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*func
);
2585 SWIGINTERN PyObject
*SWIG_PyStaticMethod_New(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*func
);
2592 /* -------- TYPES TABLE (BEGIN) -------- */
2594 #define SWIGTYPE_p_char swig_types[0]
2595 #define SWIGTYPE_p_pm3 swig_types[1]
2596 static swig_type_info
*swig_types
[3];
2597 static swig_module_info swig_module
= {swig_types
, 2, 0, 0, 0, 0};
2598 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2599 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2601 /* -------- TYPES TABLE (END) -------- */
2603 #ifdef SWIG_TypeQuery
2604 # undef SWIG_TypeQuery
2606 #define SWIG_TypeQuery SWIG_Python_TypeQuery
2608 /*-----------------------------------------------
2610 ------------------------------------------------*/
2611 #if PY_VERSION_HEX >= 0x03000000
2612 # define SWIG_init PyInit__pm3
2615 # define SWIG_init init_pm3
2618 #define SWIG_name "_pm3"
2620 #define SWIGVERSION 0x040001
2621 #define SWIG_VERSION SWIGVERSION
2624 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
2625 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
2628 /* Include the header in the wrapper code */
2632 SWIGINTERN pm3
*new_pm3__SWIG_0(void) {
2633 // printf("SWIG pm3 constructor, get current pm3\n");
2634 pm3_device
*p
= pm3_get_current_dev();
2635 p
->script_embedded
= 1;
2639 SWIGINTERN swig_type_info
*
2640 SWIG_pchar_descriptor(void) {
2641 static int init
= 0;
2642 static swig_type_info
*info
= 0;
2644 info
= SWIG_TypeQuery("_p_char");
2652 SWIG_AsCharPtrAndSize(PyObject
*obj
, char **cptr
, size_t *psize
, int *alloc
) {
2653 #if PY_VERSION_HEX>=0x03000000
2654 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2655 if (PyBytes_Check(obj
))
2657 if (PyUnicode_Check(obj
))
2660 if (PyString_Check(obj
))
2666 #if PY_VERSION_HEX>=0x03000000
2667 #if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2668 if (!alloc
&& cptr
) {
2669 /* We can't allow converting without allocation, since the internal
2670 representation of string in Python 3 is UCS-2/UCS-4 but we require
2671 a UTF-8 representation.
2672 TODO(bhy) More detailed explanation */
2673 return SWIG_RuntimeError
;
2675 obj
= PyUnicode_AsUTF8String(obj
);
2677 return SWIG_TypeError
;
2679 *alloc
= SWIG_NEWOBJ
;
2681 PyBytes_AsStringAndSize(obj
, &cstr
, &len
);
2683 PyString_AsStringAndSize(obj
, &cstr
, &len
);
2687 if (*alloc
== SWIG_NEWOBJ
) {
2688 *cptr
= (char *)memcpy(malloc((len
+ 1) * sizeof(char)), cstr
, sizeof(char) * (len
+ 1));
2689 *alloc
= SWIG_NEWOBJ
;
2692 *alloc
= SWIG_OLDOBJ
;
2695 #if PY_VERSION_HEX>=0x03000000
2696 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2697 *cptr
= PyBytes_AsString(obj
);
2699 assert(0); /* Should never reach here with Unicode strings in Python 3 */
2702 *cptr
= SWIG_Python_str_AsChar(obj
);
2704 ret
= SWIG_TypeError
;
2708 if (psize
) *psize
= len
+ 1;
2709 #if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2714 #if defined(SWIG_PYTHON_2_UNICODE)
2715 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2716 #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
2718 #if PY_VERSION_HEX<0x03000000
2719 if (PyUnicode_Check(obj
)) {
2722 if (!alloc
&& cptr
) {
2723 return SWIG_RuntimeError
;
2725 obj
= PyUnicode_AsUTF8String(obj
);
2727 return SWIG_TypeError
;
2728 if (PyString_AsStringAndSize(obj
, &cstr
, &len
) != -1) {
2730 if (alloc
) *alloc
= SWIG_NEWOBJ
;
2731 *cptr
= (char *)memcpy(malloc((len
+ 1) * sizeof(char)), cstr
, sizeof(char) * (len
+ 1));
2733 if (psize
) *psize
= len
+ 1;
2744 swig_type_info
*pchar_descriptor
= SWIG_pchar_descriptor();
2745 if (pchar_descriptor
) {
2747 if (SWIG_ConvertPtr(obj
, &vptr
, pchar_descriptor
, 0) == SWIG_OK
) {
2748 if (cptr
) *cptr
= (char *) vptr
;
2749 if (psize
) *psize
= vptr
? (strlen((char *)vptr
) + 1) : 0;
2750 if (alloc
) *alloc
= SWIG_OLDOBJ
;
2755 return SWIG_TypeError
;
2761 SWIGINTERN pm3
*new_pm3__SWIG_1(char *port
) {
2762 // printf("SWIG pm3 constructor with port, open pm3\n");
2763 pm3_device
*p
= pm3_open(port
);
2764 p
->script_embedded
= 0;
2767 SWIGINTERN
void delete_pm3(pm3
*self
) {
2768 if (self
->script_embedded
) {
2769 // printf("SWIG pm3 destructor, nothing to do\n");
2771 // printf("SWIG pm3 destructor, close pm3\n");
2776 SWIGINTERNINLINE PyObject
*
2777 SWIG_From_int(int value
) {
2778 return PyInt_FromLong((long) value
);
2782 SWIGINTERNINLINE PyObject
*
2783 SWIG_FromCharPtrAndSize(const char *carray
, size_t size
) {
2785 if (size
> INT_MAX
) {
2786 swig_type_info
*pchar_descriptor
= SWIG_pchar_descriptor();
2787 return pchar_descriptor
?
2788 SWIG_InternalNewPointerObj((char *)(carray
), pchar_descriptor
, 0) : SWIG_Py_Void();
2790 #if PY_VERSION_HEX >= 0x03000000
2791 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2792 return PyBytes_FromStringAndSize(carray
, (Py_ssize_t
)(size
));
2794 return PyUnicode_DecodeUTF8(carray
, (Py_ssize_t
)(size
), "surrogateescape");
2797 return PyString_FromStringAndSize(carray
, (Py_ssize_t
)(size
));
2801 return SWIG_Py_Void();
2806 SWIGINTERNINLINE PyObject
*
2807 SWIG_FromCharPtr(const char *cptr
) {
2808 return SWIG_FromCharPtrAndSize(cptr
, (cptr
? strlen(cptr
) : 0));
2814 SWIGINTERN PyObject
*_wrap_new_pm3__SWIG_0(PyObject
*SWIGUNUSEDPARM(self
), Py_ssize_t nobjs
, PyObject
**SWIGUNUSEDPARM(swig_obj
)) {
2815 PyObject
*resultobj
= 0;
2818 if ((nobjs
< 0) || (nobjs
> 0)) SWIG_fail
;
2819 result
= (pm3
*)new_pm3__SWIG_0();
2820 resultobj
= SWIG_NewPointerObj(SWIG_as_voidptr(result
), SWIGTYPE_p_pm3
, SWIG_POINTER_NEW
| 0);
2827 SWIGINTERN PyObject
*_wrap_new_pm3__SWIG_1(PyObject
*SWIGUNUSEDPARM(self
), Py_ssize_t nobjs
, PyObject
**swig_obj
) {
2828 PyObject
*resultobj
= 0;
2829 char *arg1
= (char *) 0 ;
2835 if ((nobjs
< 1) || (nobjs
> 1)) SWIG_fail
;
2836 res1
= SWIG_AsCharPtrAndSize(swig_obj
[0], &buf1
, NULL
, &alloc1
);
2837 if (!SWIG_IsOK(res1
)) {
2838 SWIG_exception_fail(SWIG_ArgError(res1
), "in method '" "new_pm3" "', argument " "1"" of type '" "char *""'");
2840 arg1
= (char *)(buf1
);
2841 result
= (pm3
*)new_pm3__SWIG_1(arg1
);
2842 resultobj
= SWIG_NewPointerObj(SWIG_as_voidptr(result
), SWIGTYPE_p_pm3
, SWIG_POINTER_NEW
| 0);
2843 if (alloc1
== SWIG_NEWOBJ
) free((char *)buf1
);
2846 if (alloc1
== SWIG_NEWOBJ
) free((char *)buf1
);
2851 SWIGINTERN PyObject
*_wrap_new_pm3(PyObject
*self
, PyObject
*args
) {
2853 PyObject
*argv
[2] = {
2857 if (!(argc
= SWIG_Python_UnpackTuple(args
, "new_pm3", 0, 1, argv
))) SWIG_fail
;
2860 return _wrap_new_pm3__SWIG_0(self
, argc
, argv
);
2864 int res
= SWIG_AsCharPtrAndSize(argv
[0], 0, NULL
, 0);
2865 _v
= SWIG_CheckState(res
);
2867 return _wrap_new_pm3__SWIG_1(self
, argc
, argv
);
2872 SWIG_Python_RaiseOrModifyTypeError("Wrong number or type of arguments for overloaded function 'new_pm3'.\n"
2873 " Possible C/C++ prototypes are:\n"
2875 " pm3::pm3(char *)\n");
2880 SWIGINTERN PyObject
*_wrap_delete_pm3(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*args
) {
2881 PyObject
*resultobj
= 0;
2882 pm3
*arg1
= (pm3
*) 0 ;
2885 PyObject
*swig_obj
[1] ;
2887 if (!args
) SWIG_fail
;
2889 res1
= SWIG_ConvertPtr(swig_obj
[0], &argp1
, SWIGTYPE_p_pm3
, SWIG_POINTER_DISOWN
| 0);
2890 if (!SWIG_IsOK(res1
)) {
2891 SWIG_exception_fail(SWIG_ArgError(res1
), "in method '" "delete_pm3" "', argument " "1"" of type '" "pm3 *""'");
2893 arg1
= (pm3
*)(argp1
);
2895 resultobj
= SWIG_Py_Void();
2902 SWIGINTERN PyObject
*_wrap_pm3_console(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*args
) {
2903 PyObject
*resultobj
= 0;
2904 pm3
*arg1
= (pm3
*) 0 ;
2905 char *arg2
= (char *) 0 ;
2911 PyObject
*swig_obj
[2] ;
2914 if (!SWIG_Python_UnpackTuple(args
, "pm3_console", 2, 2, swig_obj
)) SWIG_fail
;
2915 res1
= SWIG_ConvertPtr(swig_obj
[0], &argp1
, SWIGTYPE_p_pm3
, 0 | 0);
2916 if (!SWIG_IsOK(res1
)) {
2917 SWIG_exception_fail(SWIG_ArgError(res1
), "in method '" "pm3_console" "', argument " "1"" of type '" "pm3 *""'");
2919 arg1
= (pm3
*)(argp1
);
2920 res2
= SWIG_AsCharPtrAndSize(swig_obj
[1], &buf2
, NULL
, &alloc2
);
2921 if (!SWIG_IsOK(res2
)) {
2922 SWIG_exception_fail(SWIG_ArgError(res2
), "in method '" "pm3_console" "', argument " "2"" of type '" "char *""'");
2924 arg2
= (char *)(buf2
);
2925 result
= (int)pm3_console(arg1
, arg2
);
2926 resultobj
= SWIG_From_int((int)(result
));
2927 if (alloc2
== SWIG_NEWOBJ
) free((char *)buf2
);
2930 if (alloc2
== SWIG_NEWOBJ
) free((char *)buf2
);
2935 SWIGINTERN PyObject
*_wrap_pm3_name_get(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*args
) {
2936 PyObject
*resultobj
= 0;
2937 pm3
*arg1
= (pm3
*) 0 ;
2940 PyObject
*swig_obj
[1] ;
2943 if (!args
) SWIG_fail
;
2945 res1
= SWIG_ConvertPtr(swig_obj
[0], &argp1
, SWIGTYPE_p_pm3
, 0 | 0);
2946 if (!SWIG_IsOK(res1
)) {
2947 SWIG_exception_fail(SWIG_ArgError(res1
), "in method '" "pm3_name_get" "', argument " "1"" of type '" "pm3 *""'");
2949 arg1
= (pm3
*)(argp1
);
2950 result
= (char *)pm3_name_get(arg1
);
2951 resultobj
= SWIG_FromCharPtr((const char *)result
);
2958 SWIGINTERN PyObject
*pm3_swigregister(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*args
) {
2960 if (!SWIG_Python_UnpackTuple(args
, "swigregister", 1, 1, &obj
)) return NULL
;
2961 SWIG_TypeNewClientData(SWIGTYPE_p_pm3
, SWIG_NewClientData(obj
));
2962 return SWIG_Py_Void();
2965 SWIGINTERN PyObject
*pm3_swiginit(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*args
) {
2966 return SWIG_Python_InitShadowInstance(args
);
2969 static PyMethodDef SwigMethods
[] = {
2970 { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New
, METH_O
, NULL
},
2971 { "new_pm3", _wrap_new_pm3
, METH_VARARGS
, NULL
},
2972 { "delete_pm3", _wrap_delete_pm3
, METH_O
, NULL
},
2973 { "pm3_console", _wrap_pm3_console
, METH_VARARGS
, NULL
},
2974 { "pm3_name_get", _wrap_pm3_name_get
, METH_O
, NULL
},
2975 { "pm3_swigregister", pm3_swigregister
, METH_O
, NULL
},
2976 { "pm3_swiginit", pm3_swiginit
, METH_VARARGS
, NULL
},
2977 { NULL
, NULL
, 0, NULL
}
2980 static PyMethodDef SwigMethods_proxydocs
[] = {
2981 { NULL
, NULL
, 0, NULL
}
2985 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2987 static swig_type_info _swigt__p_char
= {"_p_char", "char *", 0, 0, (void *)0, 0};
2988 static swig_type_info _swigt__p_pm3
= {"_p_pm3", "pm3 *", 0, 0, (void *)0, 0};
2990 static swig_type_info
*swig_type_initial
[] = {
2995 static swig_cast_info _swigc__p_char
[] = { {&_swigt__p_char
, 0, 0, 0}, {0, 0, 0, 0}};
2996 static swig_cast_info _swigc__p_pm3
[] = { {&_swigt__p_pm3
, 0, 0, 0}, {0, 0, 0, 0}};
2998 static swig_cast_info
*swig_cast_initial
[] = {
3004 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3006 static swig_const_info swig_const_table
[] = {
3007 {0, 0, 0, 0.0, 0, 0}
3013 /* -----------------------------------------------------------------------------
3014 * Type initialization:
3015 * This problem is tough by the requirement that no dynamic
3016 * memory is used. Also, since swig_type_info structures store pointers to
3017 * swig_cast_info structures and swig_cast_info structures store pointers back
3018 * to swig_type_info structures, we need some lookup code at initialization.
3019 * The idea is that swig generates all the structures that are needed.
3020 * The runtime then collects these partially filled structures.
3021 * The SWIG_InitializeModule function takes these initial arrays out of
3022 * swig_module, and does all the lookup, filling in the swig_module.types
3023 * array with the correct data and linking the correct swig_cast_info
3024 * structures together.
3026 * The generated swig_type_info structures are assigned statically to an initial
3027 * array. We just loop through that array, and handle each type individually.
3028 * First we lookup if this type has been already loaded, and if so, use the
3029 * loaded structure instead of the generated one. Then we have to fill in the
3030 * cast linked list. The cast data is initially stored in something like a
3031 * two-dimensional array. Each row corresponds to a type (there are the same
3032 * number of rows as there are in the swig_type_initial array). Each entry in
3033 * a column is one of the swig_cast_info structures for that type.
3034 * The cast_initial array is actually an array of arrays, because each row has
3035 * a variable number of columns. So to actually build the cast linked list,
3036 * we find the array of casts associated with the type, and loop through it
3037 * adding the casts to the list. The one last trick we need to do is making
3038 * sure the type pointer in the swig_cast_info struct is correct.
3040 * First off, we lookup the cast->type name to see if it is already loaded.
3041 * There are three cases to handle:
3042 * 1) If the cast->type has already been loaded AND the type we are adding
3043 * casting info to has not been loaded (it is in this module), THEN we
3044 * replace the cast->type pointer with the type pointer that has already
3046 * 2) If BOTH types (the one we are adding casting info to, and the
3047 * cast->type) are loaded, THEN the cast info has already been loaded by
3048 * the previous module so we just ignore it.
3049 * 3) Finally, if cast->type has not already been loaded, then we add that
3050 * swig_cast_info to the linked list (because the cast->type) pointer will
3052 * ----------------------------------------------------------------------------- */
3062 #define SWIGRUNTIME_DEBUG
3067 SWIG_InitializeModule(void *clientdata
) {
3069 swig_module_info
*module_head
, *iter
;
3072 /* check to see if the circular list has been setup, if not, set it up */
3073 if (swig_module
.next
== 0) {
3074 /* Initialize the swig_module */
3075 swig_module
.type_initial
= swig_type_initial
;
3076 swig_module
.cast_initial
= swig_cast_initial
;
3077 swig_module
.next
= &swig_module
;
3083 /* Try and load any already created modules */
3084 module_head
= SWIG_GetModule(clientdata
);
3086 /* This is the first module loaded for this interpreter */
3087 /* so set the swig module into the interpreter */
3088 SWIG_SetModule(clientdata
, &swig_module
);
3090 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3093 if (iter
== &swig_module
) {
3094 /* Our module is already in the list, so there's nothing more to do. */
3098 } while (iter
!= module_head
);
3100 /* otherwise we must add our module into the list */
3101 swig_module
.next
= module_head
->next
;
3102 module_head
->next
= &swig_module
;
3105 /* When multiple interpreters are used, a module could have already been initialized in
3106 a different interpreter, but not yet have a pointer in this interpreter.
3107 In this case, we do not want to continue adding types... everything should be
3109 if (init
== 0) return;
3111 /* Now work on filling in swig_module.types */
3112 #ifdef SWIGRUNTIME_DEBUG
3113 printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module
.size
);
3115 for (i
= 0; i
< swig_module
.size
; ++i
) {
3116 swig_type_info
*type
= 0;
3117 swig_type_info
*ret
;
3118 swig_cast_info
*cast
;
3120 #ifdef SWIGRUNTIME_DEBUG
3121 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i
, swig_module
.type_initial
[i
]->name
);
3124 /* if there is another module already loaded */
3125 if (swig_module
.next
!= &swig_module
) {
3126 type
= SWIG_MangledTypeQueryModule(swig_module
.next
, &swig_module
, swig_module
.type_initial
[i
]->name
);
3129 /* Overwrite clientdata field */
3130 #ifdef SWIGRUNTIME_DEBUG
3131 printf("SWIG_InitializeModule: found type %s\n", type
->name
);
3133 if (swig_module
.type_initial
[i
]->clientdata
) {
3134 type
->clientdata
= swig_module
.type_initial
[i
]->clientdata
;
3135 #ifdef SWIGRUNTIME_DEBUG
3136 printf("SWIG_InitializeModule: found and overwrite type %s \n", type
->name
);
3140 type
= swig_module
.type_initial
[i
];
3143 /* Insert casting types */
3144 cast
= swig_module
.cast_initial
[i
];
3145 while (cast
->type
) {
3146 /* Don't need to add information already in the list */
3148 #ifdef SWIGRUNTIME_DEBUG
3149 printf("SWIG_InitializeModule: look cast %s\n", cast
->type
->name
);
3151 if (swig_module
.next
!= &swig_module
) {
3152 ret
= SWIG_MangledTypeQueryModule(swig_module
.next
, &swig_module
, cast
->type
->name
);
3153 #ifdef SWIGRUNTIME_DEBUG
3154 if (ret
) printf("SWIG_InitializeModule: found cast %s\n", ret
->name
);
3158 if (type
== swig_module
.type_initial
[i
]) {
3159 #ifdef SWIGRUNTIME_DEBUG
3160 printf("SWIG_InitializeModule: skip old type %s\n", ret
->name
);
3165 /* Check for casting already in the list */
3166 swig_cast_info
*ocast
= SWIG_TypeCheck(ret
->name
, type
);
3167 #ifdef SWIGRUNTIME_DEBUG
3168 if (ocast
) printf("SWIG_InitializeModule: skip old cast %s\n", ret
->name
);
3170 if (!ocast
) ret
= 0;
3175 #ifdef SWIGRUNTIME_DEBUG
3176 printf("SWIG_InitializeModule: adding cast %s\n", cast
->type
->name
);
3179 type
->cast
->prev
= cast
;
3180 cast
->next
= type
->cast
;
3186 /* Set entry in modules->types array equal to the type */
3187 swig_module
.types
[i
] = type
;
3189 swig_module
.types
[i
] = 0;
3191 #ifdef SWIGRUNTIME_DEBUG
3192 printf("**** SWIG_InitializeModule: Cast List ******\n");
3193 for (i
= 0; i
< swig_module
.size
; ++i
) {
3195 swig_cast_info
*cast
= swig_module
.cast_initial
[i
];
3196 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i
, swig_module
.type_initial
[i
]->name
);
3197 while (cast
->type
) {
3198 printf("SWIG_InitializeModule: cast type %s\n", cast
->type
->name
);
3202 printf("---- Total casts: %d\n", j
);
3204 printf("**** SWIG_InitializeModule: Cast List ******\n");
3208 /* This function will propagate the clientdata field of type to
3209 * any new swig_type_info structures that have been added into the list
3210 * of equivalent types. It is like calling
3211 * SWIG_TypeClientData(type, clientdata) a second time.
3214 SWIG_PropagateClientData(void) {
3216 swig_cast_info
*equiv
;
3217 static int init_run
= 0;
3219 if (init_run
) return;
3222 for (i
= 0; i
< swig_module
.size
; i
++) {
3223 if (swig_module
.types
[i
]->clientdata
) {
3224 equiv
= swig_module
.types
[i
]->cast
;
3226 if (!equiv
->converter
) {
3227 if (equiv
->type
&& !equiv
->type
->clientdata
)
3228 SWIG_TypeClientData(equiv
->type
, swig_module
.types
[i
]->clientdata
);
3230 equiv
= equiv
->next
;
3250 /* Python-specific SWIG API */
3251 #define SWIG_newvarlink() SWIG_Python_newvarlink()
3252 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
3253 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
3255 /* -----------------------------------------------------------------------------
3256 * global variable support code.
3257 * ----------------------------------------------------------------------------- */
3259 typedef struct swig_globalvar
{
3260 char *name
; /* Name of global variable */
3261 PyObject
*(*get_attr
)(void); /* Return the current value */
3262 int (*set_attr
)(PyObject
*); /* Set the value */
3263 struct swig_globalvar
*next
;
3266 typedef struct swig_varlinkobject
{
3268 swig_globalvar
*vars
;
3269 } swig_varlinkobject
;
3271 SWIGINTERN PyObject
*
3272 swig_varlink_repr(swig_varlinkobject
*SWIGUNUSEDPARM(v
)) {
3273 #if PY_VERSION_HEX >= 0x03000000
3274 return PyUnicode_InternFromString("<Swig global variables>");
3276 return PyString_FromString("<Swig global variables>");
3280 SWIGINTERN PyObject
*
3281 swig_varlink_str(swig_varlinkobject
*v
) {
3282 #if PY_VERSION_HEX >= 0x03000000
3283 PyObject
*str
= PyUnicode_InternFromString("(");
3286 swig_globalvar
*var
;
3287 for (var
= v
->vars
; var
; var
= var
->next
) {
3288 tail
= PyUnicode_FromString(var
->name
);
3289 joined
= PyUnicode_Concat(str
, tail
);
3294 tail
= PyUnicode_InternFromString(", ");
3295 joined
= PyUnicode_Concat(str
, tail
);
3301 tail
= PyUnicode_InternFromString(")");
3302 joined
= PyUnicode_Concat(str
, tail
);
3307 PyObject
*str
= PyString_FromString("(");
3308 swig_globalvar
*var
;
3309 for (var
= v
->vars
; var
; var
= var
->next
) {
3310 PyString_ConcatAndDel(&str
, PyString_FromString(var
->name
));
3311 if (var
->next
) PyString_ConcatAndDel(&str
, PyString_FromString(", "));
3313 PyString_ConcatAndDel(&str
, PyString_FromString(")"));
3319 swig_varlink_dealloc(swig_varlinkobject
*v
) {
3320 swig_globalvar
*var
= v
->vars
;
3322 swig_globalvar
*n
= var
->next
;
3329 SWIGINTERN PyObject
*
3330 swig_varlink_getattr(swig_varlinkobject
*v
, char *n
) {
3331 PyObject
*res
= NULL
;
3332 swig_globalvar
*var
= v
->vars
;
3334 if (strcmp(var
->name
, n
) == 0) {
3335 res
= (*var
->get_attr
)();
3340 if (res
== NULL
&& !PyErr_Occurred()) {
3341 PyErr_Format(PyExc_AttributeError
, "Unknown C global variable '%s'", n
);
3347 swig_varlink_setattr(swig_varlinkobject
*v
, char *n
, PyObject
*p
) {
3349 swig_globalvar
*var
= v
->vars
;
3351 if (strcmp(var
->name
, n
) == 0) {
3352 res
= (*var
->set_attr
)(p
);
3357 if (res
== 1 && !PyErr_Occurred()) {
3358 PyErr_Format(PyExc_AttributeError
, "Unknown C global variable '%s'", n
);
3363 SWIGINTERN PyTypeObject
*
3364 swig_varlink_type(void) {
3365 static char varlink__doc__
[] = "Swig var link object";
3366 static PyTypeObject varlink_type
;
3367 static int type_init
= 0;
3369 const PyTypeObject tmp
= {
3370 #if PY_VERSION_HEX >= 0x03000000
3371 PyVarObject_HEAD_INIT(NULL
, 0)
3373 PyObject_HEAD_INIT(NULL
)
3376 "swigvarlink", /* tp_name */
3377 sizeof(swig_varlinkobject
), /* tp_basicsize */
3378 0, /* tp_itemsize */
3379 (destructor
) swig_varlink_dealloc
, /* tp_dealloc */
3381 (getattrfunc
) swig_varlink_getattr
, /* tp_getattr */
3382 (setattrfunc
) swig_varlink_setattr
, /* tp_setattr */
3384 (reprfunc
) swig_varlink_repr
, /* tp_repr */
3385 0, /* tp_as_number */
3386 0, /* tp_as_sequence */
3387 0, /* tp_as_mapping */
3390 (reprfunc
) swig_varlink_str
, /* tp_str */
3391 0, /* tp_getattro */
3392 0, /* tp_setattro */
3393 0, /* tp_as_buffer */
3395 varlink__doc__
, /* tp_doc */
3396 0, /* tp_traverse */
3398 0, /* tp_richcompare */
3399 0, /* tp_weaklistoffset */
3400 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* tp_iter -> tp_weaklist */
3402 0, /* tp_version_tag */
3403 #if PY_VERSION_HEX >= 0x03040000
3404 0, /* tp_finalize */
3409 0, /* tp_maxalloc */
3416 if (PyType_Ready(&varlink_type
) < 0)
3419 return &varlink_type
;
3422 /* Create a variable linking object for use later */
3423 SWIGINTERN PyObject
*
3424 SWIG_Python_newvarlink(void) {
3425 swig_varlinkobject
*result
= PyObject_NEW(swig_varlinkobject
, swig_varlink_type());
3429 return ((PyObject
*) result
);
3433 SWIG_Python_addvarlink(PyObject
*p
, const char *name
, PyObject
* (*get_attr
)(void), int (*set_attr
)(PyObject
*p
)) {
3434 swig_varlinkobject
*v
= (swig_varlinkobject
*) p
;
3435 swig_globalvar
*gv
= (swig_globalvar
*) malloc(sizeof(swig_globalvar
));
3437 size_t size
= strlen(name
) + 1;
3438 gv
->name
= (char *)malloc(size
);
3440 memcpy(gv
->name
, name
, size
);
3441 gv
->get_attr
= get_attr
;
3442 gv
->set_attr
= set_attr
;
3449 SWIGINTERN PyObject
*
3450 SWIG_globals(void) {
3451 static PyObject
*globals
= 0;
3453 globals
= SWIG_newvarlink();
3458 /* -----------------------------------------------------------------------------
3459 * constants/methods manipulation
3460 * ----------------------------------------------------------------------------- */
3462 /* Install Constants */
3464 SWIG_Python_InstallConstants(PyObject
*d
, swig_const_info constants
[]) {
3467 for (i
= 0; constants
[i
].type
; ++i
) {
3468 switch (constants
[i
].type
) {
3469 case SWIG_PY_POINTER
:
3470 obj
= SWIG_InternalNewPointerObj(constants
[i
].pvalue
, *(constants
[i
]).ptype
, 0);
3472 case SWIG_PY_BINARY
:
3473 obj
= SWIG_NewPackedObj(constants
[i
].pvalue
, constants
[i
].lvalue
, *(constants
[i
].ptype
));
3480 PyDict_SetItemString(d
, constants
[i
].name
, obj
);
3486 /* -----------------------------------------------------------------------------*/
3487 /* Fix SwigMethods to carry the callback ptrs when needed */
3488 /* -----------------------------------------------------------------------------*/
3491 SWIG_Python_FixMethods(PyMethodDef
*methods
,
3492 swig_const_info
*const_table
,
3493 swig_type_info
**types
,
3494 swig_type_info
**types_initial
) {
3496 for (i
= 0; methods
[i
].ml_name
; ++i
) {
3497 const char *c
= methods
[i
].ml_doc
;
3499 c
= strstr(c
, "swig_ptr: ");
3502 swig_const_info
*ci
= 0;
3503 const char *name
= c
+ 10;
3504 for (j
= 0; const_table
[j
].type
; ++j
) {
3505 if (strncmp(const_table
[j
].name
, name
,
3506 strlen(const_table
[j
].name
)) == 0) {
3507 ci
= &(const_table
[j
]);
3512 void *ptr
= (ci
->type
== SWIG_PY_POINTER
) ? ci
->pvalue
: 0;
3514 size_t shift
= (ci
->ptype
) - types
;
3515 swig_type_info
*ty
= types_initial
[shift
];
3516 size_t ldoc
= (c
- methods
[i
].ml_doc
);
3517 size_t lptr
= strlen(ty
->name
) + 2 * sizeof(void *) +2;
3518 char *ndoc
= (char *)malloc(ldoc
+ lptr
+ 10);
3521 memcpy(buff
, methods
[i
].ml_doc
, ldoc
);
3523 memcpy(buff
, "swig_ptr: ", 10);
3525 SWIG_PackVoidPtr(buff
, ptr
, ty
->name
, lptr
);
3526 methods
[i
].ml_doc
= ndoc
;
3534 /* -----------------------------------------------------------------------------
3535 * Method creation and docstring support functions
3536 * ----------------------------------------------------------------------------- */
3538 /* -----------------------------------------------------------------------------
3539 * Function to find the method definition with the correct docstring for the
3540 * proxy module as opposed to the low-level API
3541 * ----------------------------------------------------------------------------- */
3543 SWIGINTERN PyMethodDef
*SWIG_PythonGetProxyDoc(const char *name
) {
3544 /* Find the function in the modified method table */
3547 while (SwigMethods_proxydocs
[offset
].ml_meth
!= NULL
) {
3548 if (strcmp(SwigMethods_proxydocs
[offset
].ml_name
, name
) == 0) {
3554 /* Use the copy with the modified docstring if available */
3555 return found
? &SwigMethods_proxydocs
[offset
] : NULL
;
3558 /* -----------------------------------------------------------------------------
3559 * Wrapper of PyInstanceMethod_New() used in Python 3
3560 * It is exported to the generated module, used for -fastproxy
3561 * ----------------------------------------------------------------------------- */
3563 SWIGINTERN PyObject
*SWIG_PyInstanceMethod_New(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*func
) {
3564 if (PyCFunction_Check(func
)) {
3565 PyCFunctionObject
*funcobj
= (PyCFunctionObject
*)func
;
3566 PyMethodDef
*ml
= SWIG_PythonGetProxyDoc(funcobj
->m_ml
->ml_name
);
3568 func
= PyCFunction_NewEx(ml
, funcobj
->m_self
, funcobj
->m_module
);
3570 #if PY_VERSION_HEX >= 0x03000000
3571 return PyInstanceMethod_New(func
);
3573 return PyMethod_New(func
, NULL
, NULL
);
3577 /* -----------------------------------------------------------------------------
3578 * Wrapper of PyStaticMethod_New()
3579 * It is exported to the generated module, used for -fastproxy
3580 * ----------------------------------------------------------------------------- */
3582 SWIGINTERN PyObject
*SWIG_PyStaticMethod_New(PyObject
*SWIGUNUSEDPARM(self
), PyObject
*func
) {
3583 if (PyCFunction_Check(func
)) {
3584 PyCFunctionObject
*funcobj
= (PyCFunctionObject
*)func
;
3585 PyMethodDef
*ml
= SWIG_PythonGetProxyDoc(funcobj
->m_ml
->ml_name
);
3587 func
= PyCFunction_NewEx(ml
, funcobj
->m_self
, funcobj
->m_module
);
3589 return PyStaticMethod_New(func
);
3596 /* -----------------------------------------------------------------------------*
3597 * Partial Init method
3598 * -----------------------------------------------------------------------------*/
3605 #if PY_VERSION_HEX >= 0x03000000
3611 PyObject
*m
, *d
, *md
, *globals
;
3613 #if PY_VERSION_HEX >= 0x03000000
3614 static struct PyModuleDef SWIG_module
= {
3615 PyModuleDef_HEAD_INIT
,
3627 #if defined(SWIGPYTHON_BUILTIN)
3628 static SwigPyClientData SwigPyObject_clientdata
= {
3631 static PyGetSetDef this_getset_def
= {
3632 (char *)"this", &SwigPyBuiltin_ThisClosure
, NULL
, NULL
, NULL
3634 static SwigPyGetSet thisown_getset_closure
= {
3638 static PyGetSetDef thisown_getset_def
= {
3639 (char *)"thisown", SwigPyBuiltin_GetterClosure
, SwigPyBuiltin_SetterClosure
, NULL
, &thisown_getset_closure
3641 PyTypeObject
*builtin_pytype
;
3642 int builtin_base_count
;
3643 swig_type_info
*builtin_basetype
;
3645 PyGetSetDescrObject
*static_getset
;
3646 PyTypeObject
*metatype
;
3647 PyTypeObject
*swigpyobject
;
3648 SwigPyClientData
*cd
;
3649 PyObject
*public_interface
, *public_symbol
;
3650 PyObject
*this_descr
;
3651 PyObject
*thisown_descr
;
3655 (void)builtin_pytype
;
3656 (void)builtin_base_count
;
3657 (void)builtin_basetype
;
3659 (void)static_getset
;
3662 /* Metaclass is used to implement static member variables */
3663 metatype
= SwigPyObjectType();
3669 /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
3671 SWIG_Python_TypeCache();
3672 SwigPyPacked_type();
3673 #ifndef SWIGPYTHON_BUILTIN
3674 SwigPyObject_type();
3677 /* Fix SwigMethods to carry the callback ptrs when needed */
3678 SWIG_Python_FixMethods(SwigMethods
, swig_const_table
, swig_types
, swig_type_initial
);
3680 #if PY_VERSION_HEX >= 0x03000000
3681 m
= PyModule_Create(&SWIG_module
);
3683 m
= Py_InitModule(SWIG_name
, SwigMethods
);
3686 md
= d
= PyModule_GetDict(m
);
3689 SWIG_InitializeModule(0);
3691 #ifdef SWIGPYTHON_BUILTIN
3692 swigpyobject
= SwigPyObject_TypeOnce();
3694 SwigPyObject_stype
= SWIG_MangledTypeQuery("_p_SwigPyObject");
3695 assert(SwigPyObject_stype
);
3696 cd
= (SwigPyClientData
*) SwigPyObject_stype
->clientdata
;
3698 SwigPyObject_stype
->clientdata
= &SwigPyObject_clientdata
;
3699 SwigPyObject_clientdata
.pytype
= swigpyobject
;
3700 } else if (swigpyobject
->tp_basicsize
!= cd
->pytype
->tp_basicsize
) {
3701 PyErr_SetString(PyExc_RuntimeError
, "Import error: attempted to load two incompatible swig-generated modules.");
3702 # if PY_VERSION_HEX >= 0x03000000
3709 /* All objects have a 'this' attribute */
3710 this_descr
= PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def
);
3713 /* All objects have a 'thisown' attribute */
3714 thisown_descr
= PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def
);
3715 (void)thisown_descr
;
3717 public_interface
= PyList_New(0);
3719 (void)public_symbol
;
3721 PyDict_SetItemString(md
, "__all__", public_interface
);
3722 Py_DECREF(public_interface
);
3723 for (i
= 0; SwigMethods
[i
].ml_name
!= NULL
; ++i
)
3724 SwigPyBuiltin_AddPublicSymbol(public_interface
, SwigMethods
[i
].ml_name
);
3725 for (i
= 0; swig_const_table
[i
].name
!= 0; ++i
)
3726 SwigPyBuiltin_AddPublicSymbol(public_interface
, swig_const_table
[i
].name
);
3729 SWIG_InstallConstants(d
, swig_const_table
);
3731 #if PY_VERSION_HEX >= 0x03000000