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
* ----------------------------------------------------------------------------- */
11
/* -----------------------------------------------------------------------------
12
* This section contains generic SWIG labels for method/variable
13
* declarations/attributes, and other compiler dependent labels.
14
* ----------------------------------------------------------------------------- */
16
/* template workaround for compilers that cannot correctly implement the C++ standard */
17
#ifndef SWIGTEMPLATEDISAMBIGUATOR
18
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
19
# define SWIGTEMPLATEDISAMBIGUATOR template
20
# elif defined(__HP_aCC)
21
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
22
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
23
# define SWIGTEMPLATEDISAMBIGUATOR template
25
# define SWIGTEMPLATEDISAMBIGUATOR
29
/* inline attribute */
31
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
32
# define SWIGINLINE inline
38
/* attribute recognised by some compilers to avoid 'unused' warnings */
40
# if defined(__GNUC__)
41
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
42
# define SWIGUNUSED __attribute__ ((__unused__))
47
# define SWIGUNUSED __attribute__ ((__unused__))
53
#ifndef SWIG_MSC_UNSUPPRESS_4505
54
# if defined(_MSC_VER)
55
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
59
#ifndef SWIGUNUSEDPARM
61
# define SWIGUNUSEDPARM(p)
63
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
67
/* internal SWIG method */
69
# define SWIGINTERN static SWIGUNUSED
72
/* internal inline SWIG method */
73
#ifndef SWIGINTERNINLINE
74
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
77
/* exporting methods */
78
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
79
# ifndef GCC_HASCLASSVISIBILITY
80
# define GCC_HASCLASSVISIBILITY
85
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
86
# if defined(STATIC_LINKED)
89
# define SWIGEXPORT __declspec(dllexport)
92
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
93
# define SWIGEXPORT __attribute__ ((visibility("default")))
100
/* calling conventions for Windows */
102
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
103
# define SWIGSTDCALL __stdcall
109
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
110
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
111
# define _CRT_SECURE_NO_DEPRECATE
114
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
115
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
116
# define _SCL_SECURE_NO_DEPRECATE
120
#define SWIG_UnknownError -1
121
#define SWIG_IOError -2
122
#define SWIG_RuntimeError -3
123
#define SWIG_IndexError -4
124
#define SWIG_TypeError -5
125
#define SWIG_DivisionByZero -6
126
#define SWIG_OverflowError -7
127
#define SWIG_SyntaxError -8
128
#define SWIG_ValueError -9
129
#define SWIG_SystemError -10
130
#define SWIG_AttributeError -11
131
#define SWIG_MemoryError -12
132
#define SWIG_NullReferenceError -13
135
/* -----------------------------------------------------------------------------
138
* This file contains generic C API SWIG runtime support for pointer
140
* ----------------------------------------------------------------------------- */
142
/* This should only be incremented when either the layout of swig_type_info changes,
143
or for whatever reason, the runtime changes incompatibly */
144
#define SWIG_RUNTIME_VERSION "4"
146
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
147
#ifdef SWIG_TYPE_TABLE
148
# define SWIG_QUOTE_STRING(x) #x
149
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
150
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
152
# define SWIG_TYPE_TABLE_NAME
156
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
157
creating a static or dynamic library from the SWIG runtime code.
158
In 99.9% of the cases, SWIG just needs to declare them as 'static'.
160
But only do this if strictly necessary, ie, if you have problems
161
with your compiler or suchlike.
165
# define SWIGRUNTIME SWIGINTERN
168
#ifndef SWIGRUNTIMEINLINE
169
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
172
/* Generic buffer size */
173
#ifndef SWIG_BUFFER_SIZE
174
# define SWIG_BUFFER_SIZE 1024
177
/* Flags for pointer conversions */
178
#define SWIG_POINTER_DISOWN 0x1
179
#define SWIG_CAST_NEW_MEMORY 0x2
181
/* Flags for new pointer objects */
182
#define SWIG_POINTER_OWN 0x1
186
Flags/methods for returning states.
188
The SWIG conversion methods, as ConvertPtr, return an integer
189
that tells if the conversion was successful or not. And if not,
190
an error code can be returned (see swigerrors.swg for the codes).
192
Use the following macros/flags to set or process the returning
195
In old versions of SWIG, code such as the following was usually written:
197
if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
203
Now you can be more explicit:
205
int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
206
if (SWIG_IsOK(res)) {
212
which is the same really, but now you can also do
215
int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
216
if (SWIG_IsOK(res)) {
218
if (SWIG_IsNewObj(res) {
228
I.e., now SWIG_ConvertPtr can return new objects and you can
229
identify the case and take care of the deallocation. Of course that
230
also requires SWIG_ConvertPtr to return new result values, such as
232
int SWIG_ConvertPtr(obj, ptr,...) {
234
if (<need new object>) {
235
*ptr = <ptr to new allocated object>;
238
*ptr = <ptr to old object>;
246
Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
247
more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
250
Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
251
allows to return the 'cast rank', for example, if you have this
258
food(1) // cast rank '1' (1 -> 1.0)
259
fooi(1) // cast rank '0'
261
just use the SWIG_AddCast()/SWIG_CheckState()
265
#define SWIG_ERROR (-1)
266
#define SWIG_IsOK(r) (r >= 0)
267
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
269
/* The CastRankLimit says how many bits are used for the cast rank */
270
#define SWIG_CASTRANKLIMIT (1 << 8)
271
/* The NewMask denotes the object was created (using new/malloc) */
272
#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
273
/* The TmpMask is for in/out typemaps that use temporal objects */
274
#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
275
/* Simple returning values */
276
#define SWIG_BADOBJ (SWIG_ERROR)
277
#define SWIG_OLDOBJ (SWIG_OK)
278
#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
279
#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
280
/* Check, add and del mask methods */
281
#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
282
#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
283
#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
284
#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
285
#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
286
#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
289
#if defined(SWIG_CASTRANK_MODE)
290
# ifndef SWIG_TypeRank
291
# define SWIG_TypeRank unsigned long
293
# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
294
# define SWIG_MAXCASTRANK (2)
296
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
297
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
298
SWIGINTERNINLINE int SWIG_AddCast(int r) {
299
return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
301
SWIGINTERNINLINE int SWIG_CheckState(int r) {
302
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
304
#else /* no cast-rank mode */
305
# define SWIG_AddCast
306
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
316
typedef void *(*swig_converter_func)(void *, int *);
317
typedef struct swig_type_info *(*swig_dycast_func)(void **);
319
/* Structure to store information on one type */
320
typedef struct swig_type_info {
321
const char *name; /* mangled name of this type */
322
const char *str; /* human readable name of this type */
323
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
324
struct swig_cast_info *cast; /* linked list of types that can cast into this type */
325
void *clientdata; /* language specific type data */
326
int owndata; /* flag if the structure owns the clientdata */
329
/* Structure to store a type and conversion function used for casting */
330
typedef struct swig_cast_info {
331
swig_type_info *type; /* pointer to type that is equivalent to this type */
332
swig_converter_func converter; /* function to cast the void pointers */
333
struct swig_cast_info *next; /* pointer to next cast in linked list */
334
struct swig_cast_info *prev; /* pointer to the previous cast */
337
/* Structure used to store module information
338
* Each module generates one structure like this, and the runtime collects
339
* all of these structures and stores them in a circularly linked list.*/
340
typedef struct swig_module_info {
341
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
342
size_t size; /* Number of types in this module */
343
struct swig_module_info *next; /* Pointer to next element in circularly linked list */
344
swig_type_info **type_initial; /* Array of initially generated type structures */
345
swig_cast_info **cast_initial; /* Array of initially generated casting structures */
346
void *clientdata; /* Language specific module data */
350
Compare two type names skipping the space characters, therefore
351
"char*" == "char *" and "Class<int>" == "Class<int >", etc.
353
Return 0 when the two name types are equivalent, as in
354
strncmp, but skipping ' '.
357
SWIG_TypeNameComp(const char *f1, const char *l1,
358
const char *f2, const char *l2) {
359
for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
360
while ((*f1 == ' ') && (f1 != l1)) ++f1;
361
while ((*f2 == ' ') && (f2 != l2)) ++f2;
362
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
364
return (int)((l1 - f1) - (l2 - f2));
368
Check type equivalence in a name list like <name1>|<name2>|...
369
Return 0 if not equal, 1 if equal
372
SWIG_TypeEquiv(const char *nb, const char *tb) {
374
const char* te = tb + strlen(tb);
376
while (!equiv && *ne) {
377
for (nb = ne; *ne; ++ne) {
378
if (*ne == '|') break;
380
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
387
Check type equivalence in a name list like <name1>|<name2>|...
388
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
391
SWIG_TypeCompare(const char *nb, const char *tb) {
393
const char* te = tb + strlen(tb);
395
while (!equiv && *ne) {
396
for (nb = ne; *ne; ++ne) {
397
if (*ne == '|') break;
399
equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
409
SWIGRUNTIME swig_cast_info *
410
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
412
swig_cast_info *iter = ty->cast;
414
if (strcmp(iter->type->name, c) == 0) {
415
if (iter == ty->cast)
417
/* Move iter to the top of the linked list */
418
iter->prev->next = iter->next;
420
iter->next->prev = iter->prev;
421
iter->next = ty->cast;
423
if (ty->cast) ty->cast->prev = iter;
434
Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
436
SWIGRUNTIME swig_cast_info *
437
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
439
swig_cast_info *iter = ty->cast;
441
if (iter->type == from) {
442
if (iter == ty->cast)
444
/* Move iter to the top of the linked list */
445
iter->prev->next = iter->next;
447
iter->next->prev = iter->prev;
448
iter->next = ty->cast;
450
if (ty->cast) ty->cast->prev = iter;
461
Cast a pointer up an inheritance hierarchy
463
SWIGRUNTIMEINLINE void *
464
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
465
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
469
Dynamic pointer casting. Down an inheritance hierarchy
471
SWIGRUNTIME swig_type_info *
472
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
473
swig_type_info *lastty = ty;
474
if (!ty || !ty->dcast) return ty;
475
while (ty && (ty->dcast)) {
476
ty = (*ty->dcast)(ptr);
483
Return the name associated with this type
485
SWIGRUNTIMEINLINE const char *
486
SWIG_TypeName(const swig_type_info *ty) {
491
Return the pretty name associated with this type,
492
that is an unmangled type name in a form presentable to the user.
494
SWIGRUNTIME const char *
495
SWIG_TypePrettyName(const swig_type_info *type) {
496
/* The "str" field contains the equivalent pretty names of the
497
type, separated by vertical-bar characters. We choose
498
to print the last name, as it is often (?) the most
500
if (!type) return NULL;
501
if (type->str != NULL) {
502
const char *last_name = type->str;
504
for (s = type->str; *s; s++)
505
if (*s == '|') last_name = s+1;
513
Set the clientdata field for a type
516
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
517
swig_cast_info *cast = ti->cast;
518
/* if (ti->clientdata == clientdata) return; */
519
ti->clientdata = clientdata;
522
if (!cast->converter) {
523
swig_type_info *tc = cast->type;
524
if (!tc->clientdata) {
525
SWIG_TypeClientData(tc, clientdata);
532
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
533
SWIG_TypeClientData(ti, clientdata);
538
Search for a swig_type_info structure only by mangled name
539
Search is a O(log #types)
541
We start searching at module start, and finish searching when start == end.
542
Note: if start == end at the beginning of the function, we go all the way around
545
SWIGRUNTIME swig_type_info *
546
SWIG_MangledTypeQueryModule(swig_module_info *start,
547
swig_module_info *end,
549
swig_module_info *iter = start;
552
register size_t l = 0;
553
register size_t r = iter->size - 1;
555
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
556
register size_t i = (l + r) >> 1;
557
const char *iname = iter->types[i]->name;
559
register int compare = strcmp(name, iname);
561
return iter->types[i];
562
} else if (compare < 0) {
568
} else if (compare > 0) {
572
break; /* should never happen */
577
} while (iter != end);
582
Search for a swig_type_info structure for either a mangled name or a human readable name.
583
It first searches the mangled names of the types, which is a O(log #types)
584
If a type is not found it then searches the human readable names, which is O(#types).
586
We start searching at module start, and finish searching when start == end.
587
Note: if start == end at the beginning of the function, we go all the way around
590
SWIGRUNTIME swig_type_info *
591
SWIG_TypeQueryModule(swig_module_info *start,
592
swig_module_info *end,
594
/* STEP 1: Search the name field using binary search */
595
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
599
/* STEP 2: If the type hasn't been found, do a complete search
600
of the str field (the human readable name) */
601
swig_module_info *iter = start;
603
register size_t i = 0;
604
for (; i < iter->size; ++i) {
605
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
606
return iter->types[i];
609
} while (iter != end);
612
/* neither found a match */
617
Pack binary data into a string
620
SWIG_PackData(char *c, void *ptr, size_t sz) {
621
static const char hex[17] = "0123456789abcdef";
622
register const unsigned char *u = (unsigned char *) ptr;
623
register const unsigned char *eu = u + sz;
624
for (; u != eu; ++u) {
625
register unsigned char uu = *u;
626
*(c++) = hex[(uu & 0xf0) >> 4];
627
*(c++) = hex[uu & 0xf];
633
Unpack binary data from a string
635
SWIGRUNTIME const char *
636
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
637
register unsigned char *u = (unsigned char *) ptr;
638
register const unsigned char *eu = u + sz;
639
for (; u != eu; ++u) {
640
register char d = *(c++);
641
register unsigned char uu;
642
if ((d >= '0') && (d <= '9'))
643
uu = (unsigned char)((d - '0') << 4);
644
else if ((d >= 'a') && (d <= 'f'))
645
uu = (unsigned char)((d - ('a'-10)) << 4);
649
if ((d >= '0') && (d <= '9'))
650
uu |= (unsigned char)(d - '0');
651
else if ((d >= 'a') && (d <= 'f'))
652
uu |= (unsigned char)(d - ('a'-10));
661
Pack 'void *' into a string buffer.
664
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
666
if ((2*sizeof(void *) + 2) > bsz) return 0;
668
r = SWIG_PackData(r,&ptr,sizeof(void *));
669
if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
674
SWIGRUNTIME const char *
675
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
677
if (strcmp(c,"NULL") == 0) {
684
return SWIG_UnpackData(++c,ptr,sizeof(void *));
688
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
690
size_t lname = (name ? strlen(name) : 0);
691
if ((2*sz + 2 + lname) > bsz) return 0;
693
r = SWIG_PackData(r,ptr,sz);
695
strncpy(r,name,lname+1);
702
SWIGRUNTIME const char *
703
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
705
if (strcmp(c,"NULL") == 0) {
712
return SWIG_UnpackData(++c,ptr,sz);
718
/* Compatibility macros for Python 3 */
719
#if PY_VERSION_HEX >= 0x03000000
721
#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
722
#define PyInt_Check(x) PyLong_Check(x)
723
#define PyInt_AsLong(x) PyLong_AsLong(x)
724
#define PyInt_FromLong(x) PyLong_FromLong(x)
725
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
726
#define PyString_Check(name) PyBytes_Check(name)
727
#define PyString_FromString(x) PyUnicode_FromString(x)
728
#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
729
#define PyString_AsString(str) PyBytes_AsString(str)
730
#define PyString_Size(str) PyBytes_Size(str)
731
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
732
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
733
#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
734
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
739
# define Py_TYPE(op) ((op)->ob_type)
742
/* SWIG APIs for compatibility of both Python 2 & 3 */
744
#if PY_VERSION_HEX >= 0x03000000
745
# define SWIG_Python_str_FromFormat PyUnicode_FromFormat
747
# define SWIG_Python_str_FromFormat PyString_FromFormat
751
/* Warning: This function will allocate a new string in Python 3,
752
* so please call SWIG_Python_str_DelForPy3(x) to free the space.
755
SWIG_Python_str_AsChar(PyObject *str)
757
#if PY_VERSION_HEX >= 0x03000000
761
str = PyUnicode_AsUTF8String(str);
762
PyBytes_AsStringAndSize(str, &cstr, &len);
763
newstr = (char *) malloc(len+1);
764
memcpy(newstr, cstr, len+1);
768
return PyString_AsString(str);
772
#if PY_VERSION_HEX >= 0x03000000
773
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
775
# define SWIG_Python_str_DelForPy3(x)
780
SWIG_Python_str_FromChar(const char *c)
782
#if PY_VERSION_HEX >= 0x03000000
783
return PyUnicode_FromString(c);
785
return PyString_FromString(c);
789
/* Add PyOS_snprintf for old Pythons */
790
#if PY_VERSION_HEX < 0x02020000
791
# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
792
# define PyOS_snprintf _snprintf
794
# define PyOS_snprintf snprintf
798
/* A crude PyString_FromFormat implementation for old Pythons */
799
#if PY_VERSION_HEX < 0x02020000
801
#ifndef SWIG_PYBUFFER_SIZE
802
# define SWIG_PYBUFFER_SIZE 1024
806
PyString_FromFormat(const char *fmt, ...) {
808
char buf[SWIG_PYBUFFER_SIZE * 2];
811
res = vsnprintf(buf, sizeof(buf), fmt, ap);
813
return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
817
/* Add PyObject_Del for old Pythons */
818
#if PY_VERSION_HEX < 0x01060000
819
# define PyObject_Del(op) PyMem_DEL((op))
822
# define PyObject_DEL PyObject_Del
825
/* A crude PyExc_StopIteration exception for old Pythons */
826
#if PY_VERSION_HEX < 0x02020000
827
# ifndef PyExc_StopIteration
828
# define PyExc_StopIteration PyExc_RuntimeError
830
# ifndef PyObject_GenericGetAttr
831
# define PyObject_GenericGetAttr 0
835
/* Py_NotImplemented is defined in 2.1 and up. */
836
#if PY_VERSION_HEX < 0x02010000
837
# ifndef Py_NotImplemented
838
# define Py_NotImplemented PyExc_RuntimeError
842
/* A crude PyString_AsStringAndSize implementation for old Pythons */
843
#if PY_VERSION_HEX < 0x02010000
844
# ifndef PyString_AsStringAndSize
845
# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
849
/* PySequence_Size for old Pythons */
850
#if PY_VERSION_HEX < 0x02000000
851
# ifndef PySequence_Size
852
# define PySequence_Size PySequence_Length
856
/* PyBool_FromLong for old Pythons */
857
#if PY_VERSION_HEX < 0x02030000
859
PyObject *PyBool_FromLong(long ok)
861
PyObject *result = ok ? Py_True : Py_False;
867
/* Py_ssize_t for old Pythons */
868
/* This code is as recommended by: */
869
/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
870
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
871
typedef int Py_ssize_t;
872
# define PY_SSIZE_T_MAX INT_MAX
873
# define PY_SSIZE_T_MIN INT_MIN
874
typedef inquiry lenfunc;
875
typedef intargfunc ssizeargfunc;
876
typedef intintargfunc ssizessizeargfunc;
877
typedef intobjargproc ssizeobjargproc;
878
typedef intintobjargproc ssizessizeobjargproc;
879
typedef getreadbufferproc readbufferproc;
880
typedef getwritebufferproc writebufferproc;
881
typedef getsegcountproc segcountproc;
882
typedef getcharbufferproc charbufferproc;
883
static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
886
PyObject *i = PyNumber_Int(x);
888
result = PyInt_AsLong(i);
895
#if PY_VERSION_HEX < 0x02040000
896
#define Py_VISIT(op) \
899
int vret = visit((op), arg); \
906
#if PY_VERSION_HEX < 0x02030000
909
PyNumberMethods as_number;
910
PyMappingMethods as_mapping;
911
PySequenceMethods as_sequence;
912
PyBufferProcs as_buffer;
913
PyObject *name, *slots;
917
#if PY_VERSION_HEX < 0x02030000
918
typedef destructor freefunc;
921
#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
922
(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
923
(PY_MAJOR_VERSION > 3))
924
# define SWIGPY_USE_CAPSULE
925
# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
928
#if PY_VERSION_HEX < 0x03020000
929
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
930
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
932
/* -----------------------------------------------------------------------------
934
* ----------------------------------------------------------------------------- */
936
SWIGRUNTIME PyObject*
937
SWIG_Python_ErrorType(int code) {
940
case SWIG_MemoryError:
941
type = PyExc_MemoryError;
944
type = PyExc_IOError;
946
case SWIG_RuntimeError:
947
type = PyExc_RuntimeError;
949
case SWIG_IndexError:
950
type = PyExc_IndexError;
953
type = PyExc_TypeError;
955
case SWIG_DivisionByZero:
956
type = PyExc_ZeroDivisionError;
958
case SWIG_OverflowError:
959
type = PyExc_OverflowError;
961
case SWIG_SyntaxError:
962
type = PyExc_SyntaxError;
964
case SWIG_ValueError:
965
type = PyExc_ValueError;
967
case SWIG_SystemError:
968
type = PyExc_SystemError;
970
case SWIG_AttributeError:
971
type = PyExc_AttributeError;
974
type = PyExc_RuntimeError;
981
SWIG_Python_AddErrorMsg(const char* mesg)
985
PyObject *traceback = 0;
987
if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
990
PyObject *old_str = PyObject_Str(value);
994
PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
995
SWIG_Python_str_DelForPy3(tmp);
999
PyErr_SetString(PyExc_RuntimeError, mesg);
1002
#if defined(SWIG_PYTHON_NO_THREADS)
1003
# if defined(SWIG_PYTHON_THREADS)
1004
# undef SWIG_PYTHON_THREADS
1007
#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
1008
# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
1009
# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
1010
# define SWIG_PYTHON_USE_GIL
1013
# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
1014
# ifndef SWIG_PYTHON_INITIALIZE_THREADS
1015
# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
1017
# ifdef __cplusplus /* C++ code */
1018
class SWIG_Python_Thread_Block {
1020
PyGILState_STATE state;
1022
void end() { if (status) { PyGILState_Release(state); status = false;} }
1023
SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
1024
~SWIG_Python_Thread_Block() { end(); }
1026
class SWIG_Python_Thread_Allow {
1028
PyThreadState *save;
1030
void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
1031
SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
1032
~SWIG_Python_Thread_Allow() { end(); }
1034
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
1035
# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
1036
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
1037
# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
1039
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1040
# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1041
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1042
# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1044
# else /* Old thread way, not implemented, user must provide it */
1045
# if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1046
# define SWIG_PYTHON_INITIALIZE_THREADS
1048
# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1049
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1051
# if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1052
# define SWIG_PYTHON_THREAD_END_BLOCK
1054
# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1055
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1057
# if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1058
# define SWIG_PYTHON_THREAD_END_ALLOW
1061
#else /* No thread support */
1062
# define SWIG_PYTHON_INITIALIZE_THREADS
1063
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1064
# define SWIG_PYTHON_THREAD_END_BLOCK
1065
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1066
# define SWIG_PYTHON_THREAD_END_ALLOW
1068
/* -----------------------------------------------------------------------------
1069
* Python API portion that goes into the runtime
1070
* ----------------------------------------------------------------------------- */
1076
/* -----------------------------------------------------------------------------
1077
* Constant declarations
1078
* ----------------------------------------------------------------------------- */
1080
/* Constant Types */
1081
#define SWIG_PY_POINTER 4
1082
#define SWIG_PY_BINARY 5
1084
/* Constant information structure */
1085
typedef struct swig_const_info {
1091
swig_type_info **ptype;
1095
/* -----------------------------------------------------------------------------
1096
* Wrapper of PyInstanceMethod_New() used in Python 3
1097
* It is exported to the generated module, used for -fastproxy
1098
* ----------------------------------------------------------------------------- */
1099
#if PY_VERSION_HEX >= 0x03000000
1100
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
1102
return PyInstanceMethod_New(func);
1105
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
1115
/* -----------------------------------------------------------------------------
1118
* This file contains the runtime support for Python modules
1119
* and includes code for managing global variables and pointer
1122
* ----------------------------------------------------------------------------- */
1124
/* Common SWIG API */
1126
/* for raw pointers */
1127
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1128
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1129
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1131
#ifdef SWIGPYTHON_BUILTIN
1132
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1134
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1137
#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1139
#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1140
#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1141
#define swig_owntype int
1143
/* for raw packed data */
1144
#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1145
#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1147
/* for class or struct pointers */
1148
#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1149
#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1151
/* for C or C++ function pointers */
1152
#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1153
#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1155
/* for C++ member pointers, ie, member methods */
1156
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1157
#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1162
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
1163
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1164
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1166
#define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1167
#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1168
#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1169
#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1170
#define SWIG_fail goto fail
1173
/* Runtime API implementation */
1175
/* Error manipulation */
1178
SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1179
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1180
PyErr_SetObject(errtype, obj);
1182
SWIG_PYTHON_THREAD_END_BLOCK;
1186
SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1187
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1188
PyErr_SetString(errtype, msg);
1189
SWIG_PYTHON_THREAD_END_BLOCK;
1192
#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1194
/* Set a constant value */
1196
#if defined(SWIGPYTHON_BUILTIN)
1199
SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1200
PyObject *s = PyString_InternFromString(key);
1201
PyList_Append(seq, s);
1206
SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
1207
#if PY_VERSION_HEX < 0x02030000
1208
PyDict_SetItemString(d, (char *)name, obj);
1210
PyDict_SetItemString(d, name, obj);
1213
if (public_interface)
1214
SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1220
SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1221
#if PY_VERSION_HEX < 0x02030000
1222
PyDict_SetItemString(d, (char *)name, obj);
1224
PyDict_SetItemString(d, name, obj);
1231
/* Append a value to the result obj */
1233
SWIGINTERN PyObject*
1234
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1235
#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
1238
} else if (result == Py_None) {
1242
if (!PyList_Check(result)) {
1243
PyObject *o2 = result;
1244
result = PyList_New(1);
1245
PyList_SetItem(result, 0, o2);
1247
PyList_Append(result,obj);
1256
} else if (result == Py_None) {
1260
if (!PyTuple_Check(result)) {
1262
result = PyTuple_New(1);
1263
PyTuple_SET_ITEM(result, 0, o2);
1265
o3 = PyTuple_New(1);
1266
PyTuple_SET_ITEM(o3, 0, obj);
1268
result = PySequence_Concat(o2, o3);
1276
/* Unpack the argument tuple */
1279
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1285
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1286
name, (min == max ? "" : "at least "), (int)min);
1290
if (!PyTuple_Check(args)) {
1291
if (min <= 1 && max >= 1) {
1294
for (i = 1; i < max; ++i) {
1299
PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1302
register Py_ssize_t l = PyTuple_GET_SIZE(args);
1304
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1305
name, (min == max ? "" : "at least "), (int)min, (int)l);
1307
} else if (l > max) {
1308
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1309
name, (min == max ? "" : "at most "), (int)max, (int)l);
1313
for (i = 0; i < l; ++i) {
1314
objs[i] = PyTuple_GET_ITEM(args, i);
1316
for (; l < max; ++l) {
1324
/* A functor is a function object with one single object argument */
1325
#if PY_VERSION_HEX >= 0x02020000
1326
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1328
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
1332
Helper for static pointer initialization for both C and C++ code, for example
1333
static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1336
#define SWIG_STATIC_POINTER(var) var
1338
#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1341
/* -----------------------------------------------------------------------------
1342
* Pointer declarations
1343
* ----------------------------------------------------------------------------- */
1345
/* Flags for new pointer objects */
1346
#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1347
#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1349
#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1351
#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1352
#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1358
/* How to access Py_None */
1359
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
1360
# ifndef SWIG_PYTHON_NO_BUILD_NONE
1361
# ifndef SWIG_PYTHON_BUILD_NONE
1362
# define SWIG_PYTHON_BUILD_NONE
1367
#ifdef SWIG_PYTHON_BUILD_NONE
1370
# define Py_None SWIG_Py_None()
1372
SWIGRUNTIMEINLINE PyObject *
1375
PyObject *none = Py_BuildValue((char*)"");
1379
SWIGRUNTIME PyObject *
1382
static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
1387
/* The python void return value */
1389
SWIGRUNTIMEINLINE PyObject *
1392
PyObject *none = Py_None;
1397
/* SwigPyClientData */
1406
PyTypeObject *pytype;
1409
SWIGRUNTIMEINLINE int
1410
SWIG_Python_CheckImplicit(swig_type_info *ty)
1412
SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1413
return data ? data->implicitconv : 0;
1416
SWIGRUNTIMEINLINE PyObject *
1417
SWIG_Python_ExceptionType(swig_type_info *desc) {
1418
SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1419
PyObject *klass = data ? data->klass : 0;
1420
return (klass ? klass : PyExc_RuntimeError);
1424
SWIGRUNTIME SwigPyClientData *
1425
SwigPyClientData_New(PyObject* obj)
1430
SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1431
/* the klass element */
1433
Py_INCREF(data->klass);
1434
/* the newraw method and newargs arguments used to create a new raw instance */
1435
if (PyClass_Check(obj)) {
1437
data->newargs = obj;
1440
#if (PY_VERSION_HEX < 0x02020000)
1443
data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
1446
Py_INCREF(data->newraw);
1447
data->newargs = PyTuple_New(1);
1448
PyTuple_SetItem(data->newargs, 0, obj);
1450
data->newargs = obj;
1452
Py_INCREF(data->newargs);
1454
/* the destroy method, aka as the C++ delete method */
1455
data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
1456
if (PyErr_Occurred()) {
1460
if (data->destroy) {
1462
Py_INCREF(data->destroy);
1463
flags = PyCFunction_GET_FLAGS(data->destroy);
1465
data->delargs = !(flags & (METH_O));
1472
data->implicitconv = 0;
1479
SwigPyClientData_Del(SwigPyClientData *data) {
1480
Py_XDECREF(data->newraw);
1481
Py_XDECREF(data->newargs);
1482
Py_XDECREF(data->destroy);
1485
/* =============== SwigPyObject =====================*/
1493
#ifdef SWIGPYTHON_BUILTIN
1498
SWIGRUNTIME PyObject *
1499
SwigPyObject_long(SwigPyObject *v)
1501
return PyLong_FromVoidPtr(v->ptr);
1504
SWIGRUNTIME PyObject *
1505
SwigPyObject_format(const char* fmt, SwigPyObject *v)
1507
PyObject *res = NULL;
1508
PyObject *args = PyTuple_New(1);
1510
if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1511
PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1513
#if PY_VERSION_HEX >= 0x03000000
1514
res = PyUnicode_Format(ofmt,args);
1516
res = PyString_Format(ofmt,args);
1526
SWIGRUNTIME PyObject *
1527
SwigPyObject_oct(SwigPyObject *v)
1529
return SwigPyObject_format("%o",v);
1532
SWIGRUNTIME PyObject *
1533
SwigPyObject_hex(SwigPyObject *v)
1535
return SwigPyObject_format("%x",v);
1538
SWIGRUNTIME PyObject *
1540
SwigPyObject_repr(SwigPyObject *v)
1542
SwigPyObject_repr(SwigPyObject *v, PyObject *args)
1545
const char *name = SWIG_TypePrettyName(v->ty);
1546
PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
1549
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1551
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
1553
# if PY_VERSION_HEX >= 0x03000000
1554
PyObject *joined = PyUnicode_Concat(repr, nrep);
1559
PyString_ConcatAndDel(&repr,nrep);
1566
SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1570
PyObject *repr = SwigPyObject_repr(v);
1572
PyObject *repr = SwigPyObject_repr(v, NULL);
1575
str = SWIG_Python_str_AsChar(repr);
1577
SWIG_Python_str_DelForPy3(str);
1585
SWIGRUNTIME PyObject *
1586
SwigPyObject_str(SwigPyObject *v)
1588
char result[SWIG_BUFFER_SIZE];
1589
return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
1590
SWIG_Python_str_FromChar(result) : 0;
1594
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
1598
return (i < j) ? -1 : ((i > j) ? 1 : 0);
1601
/* Added for Python 3.x, would it also be useful for Python 2.x? */
1602
SWIGRUNTIME PyObject*
1603
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
1606
if( op != Py_EQ && op != Py_NE ) {
1607
Py_INCREF(Py_NotImplemented);
1608
return Py_NotImplemented;
1610
res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
1615
SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
1617
#ifdef SWIGPYTHON_BUILTIN
1618
static swig_type_info *SwigPyObject_stype = 0;
1619
SWIGRUNTIME PyTypeObject*
1620
SwigPyObject_type(void) {
1621
SwigPyClientData *cd;
1622
assert(SwigPyObject_stype);
1623
cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
1629
SWIGRUNTIME PyTypeObject*
1630
SwigPyObject_type(void) {
1631
static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1636
SWIGRUNTIMEINLINE int
1637
SwigPyObject_Check(PyObject *op) {
1638
#ifdef SWIGPYTHON_BUILTIN
1639
PyTypeObject *target_tp = SwigPyObject_type();
1640
if (PyType_IsSubtype(op->ob_type, target_tp))
1642
return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
1644
return (Py_TYPE(op) == SwigPyObject_type())
1645
|| (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1649
SWIGRUNTIME PyObject *
1650
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1653
SwigPyObject_dealloc(PyObject *v)
1655
SwigPyObject *sobj = (SwigPyObject *) v;
1656
PyObject *next = sobj->next;
1657
if (sobj->own == SWIG_POINTER_OWN) {
1658
swig_type_info *ty = sobj->ty;
1659
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1660
PyObject *destroy = data ? data->destroy : 0;
1662
/* destroy is always a VARARGS method */
1664
if (data->delargs) {
1665
/* we need to create a temporary object to carry the destroy operation */
1666
PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1667
res = SWIG_Python_CallFunctor(destroy, tmp);
1670
PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1671
PyObject *mself = PyCFunction_GET_SELF(destroy);
1672
res = ((*meth)(mself, v));
1676
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1678
const char *name = SWIG_TypePrettyName(ty);
1679
printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1687
SWIGRUNTIME PyObject*
1688
SwigPyObject_append(PyObject* v, PyObject* next)
1690
SwigPyObject *sobj = (SwigPyObject *) v;
1693
if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
1696
if (!SwigPyObject_Check(next)) {
1701
return SWIG_Py_Void();
1704
SWIGRUNTIME PyObject*
1706
SwigPyObject_next(PyObject* v)
1708
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1711
SwigPyObject *sobj = (SwigPyObject *) v;
1713
Py_INCREF(sobj->next);
1716
return SWIG_Py_Void();
1720
SWIGINTERN PyObject*
1722
SwigPyObject_disown(PyObject *v)
1724
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1727
SwigPyObject *sobj = (SwigPyObject *)v;
1729
return SWIG_Py_Void();
1732
SWIGINTERN PyObject*
1734
SwigPyObject_acquire(PyObject *v)
1736
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1739
SwigPyObject *sobj = (SwigPyObject *)v;
1740
sobj->own = SWIG_POINTER_OWN;
1741
return SWIG_Py_Void();
1744
SWIGINTERN PyObject*
1745
SwigPyObject_own(PyObject *v, PyObject *args)
1748
#if (PY_VERSION_HEX < 0x02020000)
1749
if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
1750
#elif (PY_VERSION_HEX < 0x02050000)
1751
if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
1753
if (!PyArg_UnpackTuple(args, "own", 0, 1, &val))
1760
SwigPyObject *sobj = (SwigPyObject *)v;
1761
PyObject *obj = PyBool_FromLong(sobj->own);
1764
if (PyObject_IsTrue(val)) {
1765
SwigPyObject_acquire(v);
1767
SwigPyObject_disown(v);
1770
if (PyObject_IsTrue(val)) {
1771
SwigPyObject_acquire(v,args);
1773
SwigPyObject_disown(v,args);
1783
swigobject_methods[] = {
1784
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
1785
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
1786
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1787
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
1788
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
1789
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"},
1794
swigobject_methods[] = {
1795
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
1796
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
1797
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1798
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
1799
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
1800
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"},
1805
#if PY_VERSION_HEX < 0x02020000
1806
SWIGINTERN PyObject *
1807
SwigPyObject_getattr(SwigPyObject *sobj,char *name)
1809
return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1813
SWIGRUNTIME PyTypeObject*
1814
SwigPyObject_TypeOnce(void) {
1815
static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1817
static PyNumberMethods SwigPyObject_as_number = {
1818
(binaryfunc)0, /*nb_add*/
1819
(binaryfunc)0, /*nb_subtract*/
1820
(binaryfunc)0, /*nb_multiply*/
1821
/* nb_divide removed in Python 3 */
1822
#if PY_VERSION_HEX < 0x03000000
1823
(binaryfunc)0, /*nb_divide*/
1825
(binaryfunc)0, /*nb_remainder*/
1826
(binaryfunc)0, /*nb_divmod*/
1827
(ternaryfunc)0,/*nb_power*/
1828
(unaryfunc)0, /*nb_negative*/
1829
(unaryfunc)0, /*nb_positive*/
1830
(unaryfunc)0, /*nb_absolute*/
1831
(inquiry)0, /*nb_nonzero*/
1838
#if PY_VERSION_HEX < 0x03000000
1841
(unaryfunc)SwigPyObject_long, /*nb_int*/
1842
#if PY_VERSION_HEX < 0x03000000
1843
(unaryfunc)SwigPyObject_long, /*nb_long*/
1847
(unaryfunc)0, /*nb_float*/
1848
#if PY_VERSION_HEX < 0x03000000
1849
(unaryfunc)SwigPyObject_oct, /*nb_oct*/
1850
(unaryfunc)SwigPyObject_hex, /*nb_hex*/
1852
#if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1853
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1854
#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
1855
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1856
#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
1857
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
1858
#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
1859
0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
1863
static PyTypeObject swigpyobject_type;
1864
static int type_init = 0;
1866
const PyTypeObject tmp = {
1867
/* PyObject header changed in Python 3 */
1868
#if PY_VERSION_HEX >= 0x03000000
1869
PyVarObject_HEAD_INIT(NULL, 0)
1871
PyObject_HEAD_INIT(NULL)
1874
(char *)"SwigPyObject", /* tp_name */
1875
sizeof(SwigPyObject), /* tp_basicsize */
1876
0, /* tp_itemsize */
1877
(destructor)SwigPyObject_dealloc, /* tp_dealloc */
1878
(printfunc)SwigPyObject_print, /* tp_print */
1879
#if PY_VERSION_HEX < 0x02020000
1880
(getattrfunc)SwigPyObject_getattr, /* tp_getattr */
1882
(getattrfunc)0, /* tp_getattr */
1884
(setattrfunc)0, /* tp_setattr */
1885
#if PY_VERSION_HEX >= 0x03000000
1886
0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1888
(cmpfunc)SwigPyObject_compare, /* tp_compare */
1890
(reprfunc)SwigPyObject_repr, /* tp_repr */
1891
&SwigPyObject_as_number, /* tp_as_number */
1892
0, /* tp_as_sequence */
1893
0, /* tp_as_mapping */
1894
(hashfunc)0, /* tp_hash */
1895
(ternaryfunc)0, /* tp_call */
1896
(reprfunc)SwigPyObject_str, /* tp_str */
1897
PyObject_GenericGetAttr, /* tp_getattro */
1898
0, /* tp_setattro */
1899
0, /* tp_as_buffer */
1900
Py_TPFLAGS_DEFAULT, /* tp_flags */
1901
swigobject_doc, /* tp_doc */
1902
0, /* tp_traverse */
1904
(richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
1905
0, /* tp_weaklistoffset */
1906
#if PY_VERSION_HEX >= 0x02020000
1908
0, /* tp_iternext */
1909
swigobject_methods, /* tp_methods */
1914
0, /* tp_descr_get */
1915
0, /* tp_descr_set */
1916
0, /* tp_dictoffset */
1925
0, /* tp_subclasses */
1926
0, /* tp_weaklist */
1928
#if PY_VERSION_HEX >= 0x02030000
1931
#if PY_VERSION_HEX >= 0x02060000
1935
0,0,0,0 /* tp_alloc -> tp_next */
1938
swigpyobject_type = tmp;
1940
#if PY_VERSION_HEX < 0x02020000
1941
swigpyobject_type.ob_type = &PyType_Type;
1943
if (PyType_Ready(&swigpyobject_type) < 0)
1947
return &swigpyobject_type;
1950
SWIGRUNTIME PyObject *
1951
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
1953
SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1960
return (PyObject *)sobj;
1963
/* -----------------------------------------------------------------------------
1964
* Implements a simple Swig Packed type, and use it instead of string
1965
* ----------------------------------------------------------------------------- */
1975
SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1977
char result[SWIG_BUFFER_SIZE];
1978
fputs("<Swig Packed ", fp);
1979
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1983
fputs(v->ty->name,fp);
1988
SWIGRUNTIME PyObject *
1989
SwigPyPacked_repr(SwigPyPacked *v)
1991
char result[SWIG_BUFFER_SIZE];
1992
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1993
return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1995
return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
1999
SWIGRUNTIME PyObject *
2000
SwigPyPacked_str(SwigPyPacked *v)
2002
char result[SWIG_BUFFER_SIZE];
2003
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
2004
return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
2006
return SWIG_Python_str_FromChar(v->ty->name);
2011
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
2015
int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
2016
return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
2019
SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
2021
SWIGRUNTIME PyTypeObject*
2022
SwigPyPacked_type(void) {
2023
static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
2027
SWIGRUNTIMEINLINE int
2028
SwigPyPacked_Check(PyObject *op) {
2029
return ((op)->ob_type == SwigPyPacked_TypeOnce())
2030
|| (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
2034
SwigPyPacked_dealloc(PyObject *v)
2036
if (SwigPyPacked_Check(v)) {
2037
SwigPyPacked *sobj = (SwigPyPacked *) v;
2043
SWIGRUNTIME PyTypeObject*
2044
SwigPyPacked_TypeOnce(void) {
2045
static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
2046
static PyTypeObject swigpypacked_type;
2047
static int type_init = 0;
2049
const PyTypeObject tmp = {
2050
/* PyObject header changed in Python 3 */
2051
#if PY_VERSION_HEX>=0x03000000
2052
PyVarObject_HEAD_INIT(NULL, 0)
2054
PyObject_HEAD_INIT(NULL)
2057
(char *)"SwigPyPacked", /* tp_name */
2058
sizeof(SwigPyPacked), /* tp_basicsize */
2059
0, /* tp_itemsize */
2060
(destructor)SwigPyPacked_dealloc, /* tp_dealloc */
2061
(printfunc)SwigPyPacked_print, /* tp_print */
2062
(getattrfunc)0, /* tp_getattr */
2063
(setattrfunc)0, /* tp_setattr */
2064
#if PY_VERSION_HEX>=0x03000000
2065
0, /* tp_reserved in 3.0.1 */
2067
(cmpfunc)SwigPyPacked_compare, /* tp_compare */
2069
(reprfunc)SwigPyPacked_repr, /* tp_repr */
2070
0, /* tp_as_number */
2071
0, /* tp_as_sequence */
2072
0, /* tp_as_mapping */
2073
(hashfunc)0, /* tp_hash */
2074
(ternaryfunc)0, /* tp_call */
2075
(reprfunc)SwigPyPacked_str, /* tp_str */
2076
PyObject_GenericGetAttr, /* tp_getattro */
2077
0, /* tp_setattro */
2078
0, /* tp_as_buffer */
2079
Py_TPFLAGS_DEFAULT, /* tp_flags */
2080
swigpacked_doc, /* tp_doc */
2081
0, /* tp_traverse */
2083
0, /* tp_richcompare */
2084
0, /* tp_weaklistoffset */
2085
#if PY_VERSION_HEX >= 0x02020000
2087
0, /* tp_iternext */
2093
0, /* tp_descr_get */
2094
0, /* tp_descr_set */
2095
0, /* tp_dictoffset */
2104
0, /* tp_subclasses */
2105
0, /* tp_weaklist */
2107
#if PY_VERSION_HEX >= 0x02030000
2110
#if PY_VERSION_HEX >= 0x02060000
2114
0,0,0,0 /* tp_alloc -> tp_next */
2117
swigpypacked_type = tmp;
2119
#if PY_VERSION_HEX < 0x02020000
2120
swigpypacked_type.ob_type = &PyType_Type;
2122
if (PyType_Ready(&swigpypacked_type) < 0)
2126
return &swigpypacked_type;
2129
SWIGRUNTIME PyObject *
2130
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
2132
SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
2134
void *pack = malloc(size);
2136
memcpy(pack, ptr, size);
2141
PyObject_DEL((PyObject *) sobj);
2145
return (PyObject *) sobj;
2148
SWIGRUNTIME swig_type_info *
2149
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
2151
if (SwigPyPacked_Check(obj)) {
2152
SwigPyPacked *sobj = (SwigPyPacked *)obj;
2153
if (sobj->size != size) return 0;
2154
memcpy(ptr, sobj->pack, size);
2161
/* -----------------------------------------------------------------------------
2162
* pointers/data manipulation
2163
* ----------------------------------------------------------------------------- */
2165
SWIGRUNTIMEINLINE PyObject *
2168
return SWIG_Python_str_FromChar("this");
2171
static PyObject *swig_this = NULL;
2173
SWIGRUNTIME PyObject *
2176
if (swig_this == NULL)
2177
swig_this = _SWIG_This();
2181
/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
2183
/* TODO: I don't know how to implement the fast getset in Python 3 right now */
2184
#if PY_VERSION_HEX>=0x03000000
2185
#define SWIG_PYTHON_SLOW_GETSET_THIS
2188
SWIGRUNTIME SwigPyObject *
2189
SWIG_Python_GetSwigThis(PyObject *pyobj)
2193
if (SwigPyObject_Check(pyobj))
2194
return (SwigPyObject *) pyobj;
2196
#ifdef SWIGPYTHON_BUILTIN
2198
# ifdef PyWeakref_CheckProxy
2199
if (PyWeakref_CheckProxy(pyobj)) {
2200
pyobj = PyWeakref_GET_OBJECT(pyobj);
2201
if (pyobj && SwigPyObject_Check(pyobj))
2202
return (SwigPyObject*) pyobj;
2210
#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
2211
if (PyInstance_Check(pyobj)) {
2212
obj = _PyInstance_Lookup(pyobj, SWIG_This());
2214
PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2215
if (dictptr != NULL) {
2216
PyObject *dict = *dictptr;
2217
obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
2219
#ifdef PyWeakref_CheckProxy
2220
if (PyWeakref_CheckProxy(pyobj)) {
2221
PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2222
return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2225
obj = PyObject_GetAttr(pyobj,SWIG_This());
2229
if (PyErr_Occurred()) PyErr_Clear();
2235
obj = PyObject_GetAttr(pyobj,SWIG_This());
2239
if (PyErr_Occurred()) PyErr_Clear();
2243
if (obj && !SwigPyObject_Check(obj)) {
2244
/* a PyObject is called 'this', try to get the 'real this'
2245
SwigPyObject from it */
2246
return SWIG_Python_GetSwigThis(obj);
2248
return (SwigPyObject *)obj;
2252
/* Acquire a pointer value */
2255
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2256
if (own == SWIG_POINTER_OWN) {
2257
SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2259
int oldown = sobj->own;
2267
/* Convert a pointer value */
2270
SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2276
if (obj == Py_None) {
2284
sobj = SWIG_Python_GetSwigThis(obj);
2288
void *vptr = sobj->ptr;
2290
swig_type_info *to = sobj->ty;
2292
/* no type cast needed */
2293
if (ptr) *ptr = vptr;
2296
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2298
sobj = (SwigPyObject *)sobj->next;
2302
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2303
if (newmemory == SWIG_CAST_NEW_MEMORY) {
2304
assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2306
*own = *own | SWIG_CAST_NEW_MEMORY;
2313
if (ptr) *ptr = vptr;
2319
*own = *own | sobj->own;
2320
if (flags & SWIG_POINTER_DISOWN) {
2325
if (flags & SWIG_POINTER_IMPLICIT_CONV) {
2326
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2327
if (data && !data->implicitconv) {
2328
PyObject *klass = data->klass;
2331
data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2332
impconv = SWIG_Python_CallFunctor(klass, obj);
2333
data->implicitconv = 0;
2334
if (PyErr_Occurred()) {
2339
SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2342
res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2343
if (SWIG_IsOK(res)) {
2346
/* transfer the ownership to 'ptr' */
2348
res = SWIG_AddCast(res);
2349
res = SWIG_AddNewMask(res);
2351
res = SWIG_AddCast(res);
2364
/* Convert a function ptr value */
2367
SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2368
if (!PyCFunction_Check(obj)) {
2369
return SWIG_ConvertPtr(obj, ptr, ty, 0);
2373
/* here we get the method pointer for callbacks */
2374
const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2375
const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2377
desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2381
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
2384
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2385
assert(!newmemory); /* newmemory handling not yet implemented */
2396
/* Convert a packed value value */
2399
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2400
swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2401
if (!to) return SWIG_ERROR;
2404
/* check type cast? */
2405
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2406
if (!tc) return SWIG_ERROR;
2412
/* -----------------------------------------------------------------------------
2413
* Create a new pointer object
2414
* ----------------------------------------------------------------------------- */
2417
Create a new instance object, without calling __init__, and set the
2421
SWIGRUNTIME PyObject*
2422
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
2424
#if (PY_VERSION_HEX >= 0x02020000)
2426
PyObject *newraw = data->newraw;
2428
inst = PyObject_Call(newraw, data->newargs, NULL);
2430
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2431
PyObject **dictptr = _PyObject_GetDictPtr(inst);
2432
if (dictptr != NULL) {
2433
PyObject *dict = *dictptr;
2435
dict = PyDict_New();
2437
PyDict_SetItem(dict, SWIG_This(), swig_this);
2441
PyObject *key = SWIG_This();
2442
PyObject_SetAttr(inst, key, swig_this);
2446
#if PY_VERSION_HEX >= 0x03000000
2447
inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
2449
PyObject_SetAttr(inst, SWIG_This(), swig_this);
2450
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2453
PyObject *dict = PyDict_New();
2455
PyDict_SetItem(dict, SWIG_This(), swig_this);
2456
inst = PyInstance_NewRaw(data->newargs, dict);
2463
#if (PY_VERSION_HEX >= 0x02010000)
2465
PyObject *dict = PyDict_New();
2467
PyDict_SetItem(dict, SWIG_This(), swig_this);
2468
inst = PyInstance_NewRaw(data->newargs, dict);
2471
return (PyObject *) inst;
2473
PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
2477
inst->in_class = (PyClassObject *)data->newargs;
2478
Py_INCREF(inst->in_class);
2479
inst->in_dict = PyDict_New();
2480
if (inst->in_dict == NULL) {
2484
#ifdef Py_TPFLAGS_HAVE_WEAKREFS
2485
inst->in_weakreflist = NULL;
2487
#ifdef Py_TPFLAGS_GC
2488
PyObject_GC_Init(inst);
2490
PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
2491
return (PyObject *) inst;
2497
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2500
#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2501
PyObject **dictptr = _PyObject_GetDictPtr(inst);
2502
if (dictptr != NULL) {
2505
dict = PyDict_New();
2508
PyDict_SetItem(dict, SWIG_This(), swig_this);
2512
dict = PyObject_GetAttrString(inst, (char*)"__dict__");
2513
PyDict_SetItem(dict, SWIG_This(), swig_this);
2518
SWIGINTERN PyObject *
2519
SWIG_Python_InitShadowInstance(PyObject *args) {
2521
if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
2524
SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2526
SwigPyObject_append((PyObject*) sthis, obj[1]);
2528
SWIG_Python_SetSwigThis(obj[0], obj[1]);
2530
return SWIG_Py_Void();
2534
/* Create a new pointer object */
2536
SWIGRUNTIME PyObject *
2537
SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2538
SwigPyClientData *clientdata;
2543
return SWIG_Py_Void();
2545
clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2546
own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2547
if (clientdata && clientdata->pytype) {
2548
SwigPyObject *newobj;
2549
if (flags & SWIG_BUILTIN_TP_INIT) {
2550
newobj = (SwigPyObject*) self;
2552
PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2553
while (newobj->next)
2554
newobj = (SwigPyObject *) newobj->next;
2555
newobj->next = next_self;
2556
newobj = (SwigPyObject *)next_self;
2559
newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2566
#ifdef SWIGPYTHON_BUILTIN
2569
return (PyObject*) newobj;
2571
return SWIG_Py_Void();
2574
assert(!(flags & SWIG_BUILTIN_TP_INIT));
2576
robj = SwigPyObject_New(ptr, type, own);
2577
if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2578
PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2585
/* Create a new packed object */
2587
SWIGRUNTIMEINLINE PyObject *
2588
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2589
return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2592
/* -----------------------------------------------------------------------------*
2594
* -----------------------------------------------------------------------------*/
2596
#ifdef SWIG_LINK_RUNTIME
2597
void *SWIG_ReturnGlobalTypeList(void *);
2600
SWIGRUNTIME swig_module_info *
2601
SWIG_Python_GetModule(void) {
2602
static void *type_pointer = (void *)0;
2603
/* first check if module already created */
2604
if (!type_pointer) {
2605
#ifdef SWIG_LINK_RUNTIME
2606
type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2608
# ifdef SWIGPY_USE_CAPSULE
2609
type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2611
type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2612
(char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
2614
if (PyErr_Occurred()) {
2616
type_pointer = (void *)0;
2620
return (swig_module_info *) type_pointer;
2623
#if PY_MAJOR_VERSION < 2
2624
/* PyModule_AddObject function was introduced in Python 2.0. The following function
2625
is copied out of Python/modsupport.c in python version 2.3.4 */
2627
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
2630
if (!PyModule_Check(m)) {
2631
PyErr_SetString(PyExc_TypeError,
2632
"PyModule_AddObject() needs module as first arg");
2636
PyErr_SetString(PyExc_TypeError,
2637
"PyModule_AddObject() needs non-NULL value");
2641
dict = PyModule_GetDict(m);
2643
/* Internal error -- modules must have a dict! */
2644
PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
2645
PyModule_GetName(m));
2648
if (PyDict_SetItemString(dict, name, o))
2656
#ifdef SWIGPY_USE_CAPSULE
2657
SWIG_Python_DestroyModule(PyObject *obj)
2659
SWIG_Python_DestroyModule(void *vptr)
2662
#ifdef SWIGPY_USE_CAPSULE
2663
swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2665
swig_module_info *swig_module = (swig_module_info *) vptr;
2667
swig_type_info **types = swig_module->types;
2669
for (i =0; i < swig_module->size; ++i) {
2670
swig_type_info *ty = types[i];
2672
SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
2673
if (data) SwigPyClientData_Del(data);
2676
Py_DECREF(SWIG_This());
2681
SWIG_Python_SetModule(swig_module_info *swig_module) {
2682
#if PY_VERSION_HEX >= 0x03000000
2683
/* Add a dummy module object into sys.modules */
2684
PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
2686
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2687
PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2689
#ifdef SWIGPY_USE_CAPSULE
2690
PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2691
if (pointer && module) {
2692
PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2694
Py_XDECREF(pointer);
2697
PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
2698
if (pointer && module) {
2699
PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
2701
Py_XDECREF(pointer);
2706
/* The python cached type query */
2707
SWIGRUNTIME PyObject *
2708
SWIG_Python_TypeCache(void) {
2709
static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2713
SWIGRUNTIME swig_type_info *
2714
SWIG_Python_TypeQuery(const char *type)
2716
PyObject *cache = SWIG_Python_TypeCache();
2717
PyObject *key = SWIG_Python_str_FromChar(type);
2718
PyObject *obj = PyDict_GetItem(cache, key);
2719
swig_type_info *descriptor;
2721
#ifdef SWIGPY_USE_CAPSULE
2722
descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2724
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
2727
swig_module_info *swig_module = SWIG_Python_GetModule();
2728
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2730
#ifdef SWIGPY_USE_CAPSULE
2731
obj = PyCapsule_New((void*) descriptor, NULL, NULL);
2733
obj = PyCObject_FromVoidPtr(descriptor, NULL);
2735
PyDict_SetItem(cache, key, obj);
2744
For backward compatibility only
2746
#define SWIG_POINTER_EXCEPTION 0
2747
#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2748
#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2751
SWIG_Python_AddErrMesg(const char* mesg, int infront)
2753
if (PyErr_Occurred()) {
2755
PyObject *value = 0;
2756
PyObject *traceback = 0;
2757
PyErr_Fetch(&type, &value, &traceback);
2760
PyObject *old_str = PyObject_Str(value);
2764
PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
2766
PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
2768
SWIG_Python_str_DelForPy3(tmp);
2778
SWIG_Python_ArgFail(int argnum)
2780
if (PyErr_Occurred()) {
2781
/* add information about failing argument */
2783
PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2784
return SWIG_Python_AddErrMesg(mesg, 1);
2790
SWIGRUNTIMEINLINE const char *
2791
SwigPyObject_GetDesc(PyObject *self)
2793
SwigPyObject *v = (SwigPyObject *)self;
2794
swig_type_info *ty = v ? v->ty : 0;
2795
return ty ? ty->str : "";
2799
SWIG_Python_TypeError(const char *type, PyObject *obj)
2802
#if defined(SWIG_COBJECT_TYPES)
2803
if (obj && SwigPyObject_Check(obj)) {
2804
const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2806
PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2813
const char *otype = (obj ? obj->ob_type->tp_name : 0);
2815
PyObject *str = PyObject_Str(obj);
2816
const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2818
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2820
SWIG_Python_str_DelForPy3(cstr);
2822
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2829
PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2831
PyErr_Format(PyExc_TypeError, "unexpected type is received");
2836
/* Convert a pointer value, signal an exception on a type mismatch */
2838
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
2840
if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2842
#if SWIG_POINTER_EXCEPTION
2844
SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2845
SWIG_Python_ArgFail(argnum);
2852
#ifdef SWIGPYTHON_BUILTIN
2854
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
2855
PyTypeObject *tp = obj->ob_type;
2857
PyObject *encoded_name;
2861
# ifdef Py_USING_UNICODE
2862
if (PyString_Check(name)) {
2863
name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2866
} else if (!PyUnicode_Check(name))
2868
if (!PyString_Check(name))
2871
PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2878
if (PyType_Ready(tp) < 0)
2883
descr = _PyType_Lookup(tp, name);
2886
f = descr->ob_type->tp_descr_set;
2888
if (PyString_Check(name)) {
2889
encoded_name = name;
2892
encoded_name = PyUnicode_AsUTF8String(name);
2894
PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2895
Py_DECREF(encoded_name);
2897
res = f(descr, obj, value);
2910
/* -----------------------------------------------------------------------------*
2911
Standard SWIG API for use inside user code.
2913
Don't include this file directly, run the command
2914
swig -python -external-runtime
2915
Also, read the Modules chapter of the SWIG Manual.
2917
* -----------------------------------------------------------------------------*/
2919
#ifdef SWIG_MODULE_CLIENTDATA_TYPE
2921
SWIGRUNTIMEINLINE swig_type_info *
2922
SWIG_TypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
2923
swig_module_info *module = SWIG_GetModule(clientdata);
2924
return SWIG_TypeQueryModule(module, module, name);
2927
SWIGRUNTIMEINLINE swig_type_info *
2928
SWIG_MangledTypeQuery(SWIG_MODULE_CLIENTDATA_TYPE clientdata, const char *name) {
2929
swig_module_info *module = SWIG_GetModule(clientdata);
2930
return SWIG_MangledTypeQueryModule(module, module, name);
2935
SWIGRUNTIMEINLINE swig_type_info *
2936
SWIG_TypeQuery(const char *name) {
2937
swig_module_info *module = SWIG_GetModule(NULL);
2938
return SWIG_TypeQueryModule(module, module, name);
2941
SWIGRUNTIMEINLINE swig_type_info *
2942
SWIG_MangledTypeQuery(const char *name) {
2943
swig_module_info *module = SWIG_GetModule(NULL);
2944
return SWIG_MangledTypeQueryModule(module, module, name);