1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
3 * Version 4.0.1
4 *
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 * ----------------------------------------------------------------------------- */
10
11
12 #ifndef SWIGPYTHON
13 #define SWIGPYTHON
14 #endif
15
16 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
17
18 /* -----------------------------------------------------------------------------
19 * This section contains generic SWIG labels for method/variable
20 * declarations/attributes, and other compiler dependent labels.
21 * ----------------------------------------------------------------------------- */
22
23 /* template workaround for compilers that cannot correctly implement the C++ standard */
24 #ifndef SWIGTEMPLATEDISAMBIGUATOR
25 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
26 # define SWIGTEMPLATEDISAMBIGUATOR template
27 # elif defined(__HP_aCC)
28 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
29 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
30 # define SWIGTEMPLATEDISAMBIGUATOR template
31 # else
32 # define SWIGTEMPLATEDISAMBIGUATOR
33 # endif
34 #endif
35
36 /* inline attribute */
37 #ifndef SWIGINLINE
38 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
39 # define SWIGINLINE inline
40 # else
41 # define SWIGINLINE
42 # endif
43 #endif
44
45 /* attribute recognised by some compilers to avoid 'unused' warnings */
46 #ifndef SWIGUNUSED
47 # if defined(__GNUC__)
48 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
49 # define SWIGUNUSED __attribute__ ((__unused__))
50 # else
51 # define SWIGUNUSED
52 # endif
53 # elif defined(__ICC)
54 # define SWIGUNUSED __attribute__ ((__unused__))
55 # else
56 # define SWIGUNUSED
57 # endif
58 #endif
59
60 #ifndef SWIG_MSC_UNSUPPRESS_4505
61 # if defined(_MSC_VER)
62 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
63 # endif
64 #endif
65
66 #ifndef SWIGUNUSEDPARM
67 # ifdef __cplusplus
68 # define SWIGUNUSEDPARM(p)
69 # else
70 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
71 # endif
72 #endif
73
74 /* internal SWIG method */
75 #ifndef SWIGINTERN
76 # define SWIGINTERN static SWIGUNUSED
77 #endif
78
79 /* internal inline SWIG method */
80 #ifndef SWIGINTERNINLINE
81 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
82 #endif
83
84 /* exporting methods */
85 #if defined(__GNUC__)
86 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
87 # ifndef GCC_HASCLASSVISIBILITY
88 # define GCC_HASCLASSVISIBILITY
89 # endif
90 # endif
91 #endif
92
93 #ifndef SWIGEXPORT
94 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
95 # if defined(STATIC_LINKED)
96 # define SWIGEXPORT
97 # else
98 # define SWIGEXPORT __declspec(dllexport)
99 # endif
100 # else
101 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
102 # define SWIGEXPORT __attribute__ ((visibility("default")))
103 # else
104 # define SWIGEXPORT
105 # endif
106 # endif
107 #endif
108
109 /* calling conventions for Windows */
110 #ifndef SWIGSTDCALL
111 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
112 # define SWIGSTDCALL __stdcall
113 # else
114 # define SWIGSTDCALL
115 # endif
116 #endif
117
118 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
119 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
120 # define _CRT_SECURE_NO_DEPRECATE
121 #endif
122
123 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
124 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
125 # define _SCL_SECURE_NO_DEPRECATE
126 #endif
127
128 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
129 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
130 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
131 #endif
132
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.
137 */
138 #ifdef __INTEL_COMPILER
139 # pragma warning disable 592
140 #endif
141
142
143 #if defined(__GNUC__) && defined(_WIN32) && !defined(SWIG_PYTHON_NO_HYPOT_WORKAROUND)
144 /* Workaround for '::hypot' has not been declared', see https://bugs.python.org/issue11566 */
145 # include <math.h>
146 #endif
147
148 #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
149 /* Use debug wrappers with the Python release dll */
150 # undef _DEBUG
151 # include <Python.h>
152 # define _DEBUG 1
153 #else
154 # include <Python.h>
155 #endif
156
157 /* -----------------------------------------------------------------------------
158 * swigrun.swg
159 *
160 * This file contains generic C API SWIG runtime support for pointer
161 * type checking.
162 * ----------------------------------------------------------------------------- */
163
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"
167
168 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
169 #ifdef SWIG_TYPE_TABLE
170 # define SWIG_QUOTE_STRING(x) #x
171 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
172 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
173 #else
174 # define SWIG_TYPE_TABLE_NAME
175 #endif
176
177 /*
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'.
181
182 But only do this if strictly necessary, ie, if you have problems
183 with your compiler or suchlike.
184 */
185
186 #ifndef SWIGRUNTIME
187 # define SWIGRUNTIME SWIGINTERN
188 #endif
189
190 #ifndef SWIGRUNTIMEINLINE
191 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
192 #endif
193
194 /* Generic buffer size */
195 #ifndef SWIG_BUFFER_SIZE
196 # define SWIG_BUFFER_SIZE 1024
197 #endif
198
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
203
204 /* Flags for new pointer objects */
205 #define SWIG_POINTER_OWN 0x1
206
207
208 /*
209 Flags/methods for returning states.
210
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).
214
215 Use the following macros/flags to set or process the returning
216 states.
217
218 In old versions of SWIG, code such as the following was usually written:
219
220 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
221 // success code
222 } else {
223 //fail code
224 }
225
226 Now you can be more explicit:
227
228 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
229 if (SWIG_IsOK(res)) {
230 // success code
231 } else {
232 // fail code
233 }
234
235 which is the same really, but now you can also do
236
237 Type *ptr;
238 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
239 if (SWIG_IsOK(res)) {
240 // success code
241 if (SWIG_IsNewObj(res) {
242 ...
243 delete *ptr;
244 } else {
245 ...
246 }
247 } else {
248 // fail code
249 }
250
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
254
255 int SWIG_ConvertPtr(obj, ptr,...) {
256 if (<obj is ok>) {
257 if (<need new object>) {
258 *ptr = <ptr to new allocated object>;
259 return SWIG_NEWOBJ;
260 } else {
261 *ptr = <ptr to old object>;
262 return SWIG_OLDOBJ;
263 }
264 } else {
265 return SWIG_BADOBJ;
266 }
267 }
268
269 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
270 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
271 SWIG errors code.
272
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
275
276 int food(double)
277 int fooi(int);
278
279 and you call
280
281 food(1) // cast rank '1' (1 -> 1.0)
282 fooi(1) // cast rank '0'
283
284 just use the SWIG_AddCast()/SWIG_CheckState()
285 */
286
287 #define SWIG_OK (0)
288 #define SWIG_ERROR (-1)
289 #define SWIG_IsOK(r) (r >= 0)
290 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
291
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))
310
311 /* Cast-Rank Mode */
312 #if defined(SWIG_CASTRANK_MODE)
313 # ifndef SWIG_TypeRank
314 # define SWIG_TypeRank unsigned long
315 # endif
316 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
317 # define SWIG_MAXCASTRANK (2)
318 # endif
319 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
320 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIG_AddCast(int r)321 SWIGINTERNINLINE int SWIG_AddCast(int r) {
322 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
323 }
SWIG_CheckState(int r)324 SWIGINTERNINLINE int SWIG_CheckState(int r) {
325 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
326 }
327 #else /* no cast-rank mode */
328 # define SWIG_AddCast(r) (r)
329 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
330 #endif
331
332
333 #include <string.h>
334
335 #ifdef __cplusplus
336 extern "C" {
337 #endif
338
339 typedef void *(*swig_converter_func)(void *, int *);
340 typedef struct swig_type_info *(*swig_dycast_func)(void **);
341
342 /* Structure to store information on one type */
343 typedef struct swig_type_info {
344 const char *name; /* mangled name of this type */
345 const char *str; /* human readable name of this type */
346 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
347 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
348 void *clientdata; /* language specific type data */
349 int owndata; /* flag if the structure owns the clientdata */
350 } swig_type_info;
351
352 /* Structure to store a type and conversion function used for casting */
353 typedef struct swig_cast_info {
354 swig_type_info *type; /* pointer to type that is equivalent to this type */
355 swig_converter_func converter; /* function to cast the void pointers */
356 struct swig_cast_info *next; /* pointer to next cast in linked list */
357 struct swig_cast_info *prev; /* pointer to the previous cast */
358 } swig_cast_info;
359
360 /* Structure used to store module information
361 * Each module generates one structure like this, and the runtime collects
362 * all of these structures and stores them in a circularly linked list.*/
363 typedef struct swig_module_info {
364 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
365 size_t size; /* Number of types in this module */
366 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
367 swig_type_info **type_initial; /* Array of initially generated type structures */
368 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
369 void *clientdata; /* Language specific module data */
370 } swig_module_info;
371
372 /*
373 Compare two type names skipping the space characters, therefore
374 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
375
376 Return 0 when the two name types are equivalent, as in
377 strncmp, but skipping ' '.
378 */
379 SWIGRUNTIME int
SWIG_TypeNameComp(const char * f1,const char * l1,const char * f2,const char * l2)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;
386 }
387 return (int)((l1 - f1) - (l2 - f2));
388 }
389
390 /*
391 Check type equivalence in a name list like <name1>|<name2>|...
392 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
393 */
394 SWIGRUNTIME int
SWIG_TypeCmp(const char * nb,const char * tb)395 SWIG_TypeCmp(const char *nb, const char *tb) {
396 int equiv = 1;
397 const char* te = tb + strlen(tb);
398 const char* ne = nb;
399 while (equiv != 0 && *ne) {
400 for (nb = ne; *ne; ++ne) {
401 if (*ne == '|') break;
402 }
403 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
404 if (*ne) ++ne;
405 }
406 return equiv;
407 }
408
409 /*
410 Check type equivalence in a name list like <name1>|<name2>|...
411 Return 0 if not equal, 1 if equal
412 */
413 SWIGRUNTIME int
SWIG_TypeEquiv(const char * nb,const char * tb)414 SWIG_TypeEquiv(const char *nb, const char *tb) {
415 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
416 }
417
418 /*
419 Check the typename
420 */
421 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char * c,swig_type_info * ty)422 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
423 if (ty) {
424 swig_cast_info *iter = ty->cast;
425 while (iter) {
426 if (strcmp(iter->type->name, c) == 0) {
427 if (iter == ty->cast)
428 return iter;
429 /* Move iter to the top of the linked list */
430 iter->prev->next = iter->next;
431 if (iter->next)
432 iter->next->prev = iter->prev;
433 iter->next = ty->cast;
434 iter->prev = 0;
435 if (ty->cast) ty->cast->prev = iter;
436 ty->cast = iter;
437 return iter;
438 }
439 iter = iter->next;
440 }
441 }
442 return 0;
443 }
444
445 /*
446 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
447 */
448 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info * from,swig_type_info * ty)449 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
450 if (ty) {
451 swig_cast_info *iter = ty->cast;
452 while (iter) {
453 if (iter->type == from) {
454 if (iter == ty->cast)
455 return iter;
456 /* Move iter to the top of the linked list */
457 iter->prev->next = iter->next;
458 if (iter->next)
459 iter->next->prev = iter->prev;
460 iter->next = ty->cast;
461 iter->prev = 0;
462 if (ty->cast) ty->cast->prev = iter;
463 ty->cast = iter;
464 return iter;
465 }
466 iter = iter->next;
467 }
468 }
469 return 0;
470 }
471
472 /*
473 Cast a pointer up an inheritance hierarchy
474 */
475 SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info * ty,void * ptr,int * newmemory)476 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
477 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
478 }
479
480 /*
481 Dynamic pointer casting. Down an inheritance hierarchy
482 */
483 SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info * ty,void ** ptr)484 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
485 swig_type_info *lastty = ty;
486 if (!ty || !ty->dcast) return ty;
487 while (ty && (ty->dcast)) {
488 ty = (*ty->dcast)(ptr);
489 if (ty) lastty = ty;
490 }
491 return lastty;
492 }
493
494 /*
495 Return the name associated with this type
496 */
497 SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info * ty)498 SWIG_TypeName(const swig_type_info *ty) {
499 return ty->name;
500 }
501
502 /*
503 Return the pretty name associated with this type,
504 that is an unmangled type name in a form presentable to the user.
505 */
506 SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info * type)507 SWIG_TypePrettyName(const swig_type_info *type) {
508 /* The "str" field contains the equivalent pretty names of the
509 type, separated by vertical-bar characters. We choose
510 to print the last name, as it is often (?) the most
511 specific. */
512 if (!type) return NULL;
513 if (type->str != NULL) {
514 const char *last_name = type->str;
515 const char *s;
516 for (s = type->str; *s; s++)
517 if (*s == '|') last_name = s+1;
518 return last_name;
519 }
520 else
521 return type->name;
522 }
523
524 /*
525 Set the clientdata field for a type
526 */
527 SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info * ti,void * clientdata)528 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
529 swig_cast_info *cast = ti->cast;
530 /* if (ti->clientdata == clientdata) return; */
531 ti->clientdata = clientdata;
532
533 while (cast) {
534 if (!cast->converter) {
535 swig_type_info *tc = cast->type;
536 if (!tc->clientdata) {
537 SWIG_TypeClientData(tc, clientdata);
538 }
539 }
540 cast = cast->next;
541 }
542 }
543 SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info * ti,void * clientdata)544 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
545 SWIG_TypeClientData(ti, clientdata);
546 ti->owndata = 1;
547 }
548
549 /*
550 Search for a swig_type_info structure only by mangled name
551 Search is a O(log #types)
552
553 We start searching at module start, and finish searching when start == end.
554 Note: if start == end at the beginning of the function, we go all the way around
555 the circular list.
556 */
557 SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)558 SWIG_MangledTypeQueryModule(swig_module_info *start,
559 swig_module_info *end,
560 const char *name) {
561 swig_module_info *iter = start;
562 do {
563 if (iter->size) {
564 size_t l = 0;
565 size_t r = iter->size - 1;
566 do {
567 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
568 size_t i = (l + r) >> 1;
569 const char *iname = iter->types[i]->name;
570 if (iname) {
571 int compare = strcmp(name, iname);
572 if (compare == 0) {
573 return iter->types[i];
574 } else if (compare < 0) {
575 if (i) {
576 r = i - 1;
577 } else {
578 break;
579 }
580 } else if (compare > 0) {
581 l = i + 1;
582 }
583 } else {
584 break; /* should never happen */
585 }
586 } while (l <= r);
587 }
588 iter = iter->next;
589 } while (iter != end);
590 return 0;
591 }
592
593 /*
594 Search for a swig_type_info structure for either a mangled name or a human readable name.
595 It first searches the mangled names of the types, which is a O(log #types)
596 If a type is not found it then searches the human readable names, which is O(#types).
597
598 We start searching at module start, and finish searching when start == end.
599 Note: if start == end at the beginning of the function, we go all the way around
600 the circular list.
601 */
602 SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)603 SWIG_TypeQueryModule(swig_module_info *start,
604 swig_module_info *end,
605 const char *name) {
606 /* STEP 1: Search the name field using binary search */
607 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
608 if (ret) {
609 return ret;
610 } else {
611 /* STEP 2: If the type hasn't been found, do a complete search
612 of the str field (the human readable name) */
613 swig_module_info *iter = start;
614 do {
615 size_t i = 0;
616 for (; i < iter->size; ++i) {
617 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
618 return iter->types[i];
619 }
620 iter = iter->next;
621 } while (iter != end);
622 }
623
624 /* neither found a match */
625 return 0;
626 }
627
628 /*
629 Pack binary data into a string
630 */
631 SWIGRUNTIME char *
SWIG_PackData(char * c,void * ptr,size_t sz)632 SWIG_PackData(char *c, void *ptr, size_t sz) {
633 static const char hex[17] = "0123456789abcdef";
634 const unsigned char *u = (unsigned char *) ptr;
635 const unsigned char *eu = u + sz;
636 for (; u != eu; ++u) {
637 unsigned char uu = *u;
638 *(c++) = hex[(uu & 0xf0) >> 4];
639 *(c++) = hex[uu & 0xf];
640 }
641 return c;
642 }
643
644 /*
645 Unpack binary data from a string
646 */
647 SWIGRUNTIME const char *
SWIG_UnpackData(const char * c,void * ptr,size_t sz)648 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
649 unsigned char *u = (unsigned char *) ptr;
650 const unsigned char *eu = u + sz;
651 for (; u != eu; ++u) {
652 char d = *(c++);
653 unsigned char uu;
654 if ((d >= '0') && (d <= '9'))
655 uu = (unsigned char)((d - '0') << 4);
656 else if ((d >= 'a') && (d <= 'f'))
657 uu = (unsigned char)((d - ('a'-10)) << 4);
658 else
659 return (char *) 0;
660 d = *(c++);
661 if ((d >= '0') && (d <= '9'))
662 uu |= (unsigned char)(d - '0');
663 else if ((d >= 'a') && (d <= 'f'))
664 uu |= (unsigned char)(d - ('a'-10));
665 else
666 return (char *) 0;
667 *u = uu;
668 }
669 return c;
670 }
671
672 /*
673 Pack 'void *' into a string buffer.
674 */
675 SWIGRUNTIME char *
SWIG_PackVoidPtr(char * buff,void * ptr,const char * name,size_t bsz)676 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
677 char *r = buff;
678 if ((2*sizeof(void *) + 2) > bsz) return 0;
679 *(r++) = '_';
680 r = SWIG_PackData(r,&ptr,sizeof(void *));
681 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
682 strcpy(r,name);
683 return buff;
684 }
685
686 SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char * c,void ** ptr,const char * name)687 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
688 if (*c != '_') {
689 if (strcmp(c,"NULL") == 0) {
690 *ptr = (void *) 0;
691 return name;
692 } else {
693 return 0;
694 }
695 }
696 return SWIG_UnpackData(++c,ptr,sizeof(void *));
697 }
698
699 SWIGRUNTIME char *
SWIG_PackDataName(char * buff,void * ptr,size_t sz,const char * name,size_t bsz)700 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
701 char *r = buff;
702 size_t lname = (name ? strlen(name) : 0);
703 if ((2*sz + 2 + lname) > bsz) return 0;
704 *(r++) = '_';
705 r = SWIG_PackData(r,ptr,sz);
706 if (lname) {
707 strncpy(r,name,lname+1);
708 } else {
709 *r = 0;
710 }
711 return buff;
712 }
713
714 SWIGRUNTIME const char *
SWIG_UnpackDataName(const char * c,void * ptr,size_t sz,const char * name)715 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
716 if (*c != '_') {
717 if (strcmp(c,"NULL") == 0) {
718 memset(ptr,0,sz);
719 return name;
720 } else {
721 return 0;
722 }
723 }
724 return SWIG_UnpackData(++c,ptr,sz);
725 }
726
727 #ifdef __cplusplus
728 }
729 #endif
730
731 /* Errors in SWIG */
732 #define SWIG_UnknownError -1
733 #define SWIG_IOError -2
734 #define SWIG_RuntimeError -3
735 #define SWIG_IndexError -4
736 #define SWIG_TypeError -5
737 #define SWIG_DivisionByZero -6
738 #define SWIG_OverflowError -7
739 #define SWIG_SyntaxError -8
740 #define SWIG_ValueError -9
741 #define SWIG_SystemError -10
742 #define SWIG_AttributeError -11
743 #define SWIG_MemoryError -12
744 #define SWIG_NullReferenceError -13
745
746
747
748 /* Compatibility macros for Python 3 */
749 #if PY_VERSION_HEX >= 0x03000000
750
751 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
752 #define PyInt_Check(x) PyLong_Check(x)
753 #define PyInt_AsLong(x) PyLong_AsLong(x)
754 #define PyInt_FromLong(x) PyLong_FromLong(x)
755 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
756 #define PyString_Check(name) PyBytes_Check(name)
757 #define PyString_FromString(x) PyUnicode_FromString(x)
758 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
759 #define PyString_AsString(str) PyBytes_AsString(str)
760 #define PyString_Size(str) PyBytes_Size(str)
761 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
762 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
763 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
764 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
765
766 #endif
767
768 #ifndef Py_TYPE
769 # define Py_TYPE(op) ((op)->ob_type)
770 #endif
771
772 /* SWIG APIs for compatibility of both Python 2 & 3 */
773
774 #if PY_VERSION_HEX >= 0x03000000
775 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
776 #else
777 # define SWIG_Python_str_FromFormat PyString_FromFormat
778 #endif
779
780
781 /* Warning: This function will allocate a new string in Python 3,
782 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
783 */
784 SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject * str)785 SWIG_Python_str_AsChar(PyObject *str)
786 {
787 #if PY_VERSION_HEX >= 0x03000000
788 char *newstr = 0;
789 str = PyUnicode_AsUTF8String(str);
790 if (str) {
791 char *cstr;
792 Py_ssize_t len;
793 PyBytes_AsStringAndSize(str, &cstr, &len);
794 newstr = (char *) malloc(len+1);
795 memcpy(newstr, cstr, len+1);
796 Py_XDECREF(str);
797 }
798 return newstr;
799 #else
800 return PyString_AsString(str);
801 #endif
802 }
803
804 #if PY_VERSION_HEX >= 0x03000000
805 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
806 #else
807 # define SWIG_Python_str_DelForPy3(x)
808 #endif
809
810
811 SWIGINTERN PyObject*
SWIG_Python_str_FromChar(const char * c)812 SWIG_Python_str_FromChar(const char *c)
813 {
814 #if PY_VERSION_HEX >= 0x03000000
815 return PyUnicode_FromString(c);
816 #else
817 return PyString_FromString(c);
818 #endif
819 }
820
821 #ifndef PyObject_DEL
822 # define PyObject_DEL PyObject_Del
823 #endif
824
825 // SWIGPY_USE_CAPSULE is no longer used within SWIG itself, but some user
826 // interface files check for it.
827 # define SWIGPY_USE_CAPSULE
828 # define SWIGPY_CAPSULE_NAME ("swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
829
830 #if PY_VERSION_HEX < 0x03020000
831 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
832 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
833 #define Py_hash_t long
834 #endif
835
836 /* -----------------------------------------------------------------------------
837 * error manipulation
838 * ----------------------------------------------------------------------------- */
839
840 SWIGRUNTIME PyObject*
SWIG_Python_ErrorType(int code)841 SWIG_Python_ErrorType(int code) {
842 PyObject* type = 0;
843 switch(code) {
844 case SWIG_MemoryError:
845 type = PyExc_MemoryError;
846 break;
847 case SWIG_IOError:
848 type = PyExc_IOError;
849 break;
850 case SWIG_RuntimeError:
851 type = PyExc_RuntimeError;
852 break;
853 case SWIG_IndexError:
854 type = PyExc_IndexError;
855 break;
856 case SWIG_TypeError:
857 type = PyExc_TypeError;
858 break;
859 case SWIG_DivisionByZero:
860 type = PyExc_ZeroDivisionError;
861 break;
862 case SWIG_OverflowError:
863 type = PyExc_OverflowError;
864 break;
865 case SWIG_SyntaxError:
866 type = PyExc_SyntaxError;
867 break;
868 case SWIG_ValueError:
869 type = PyExc_ValueError;
870 break;
871 case SWIG_SystemError:
872 type = PyExc_SystemError;
873 break;
874 case SWIG_AttributeError:
875 type = PyExc_AttributeError;
876 break;
877 default:
878 type = PyExc_RuntimeError;
879 }
880 return type;
881 }
882
883
884 SWIGRUNTIME void
SWIG_Python_AddErrorMsg(const char * mesg)885 SWIG_Python_AddErrorMsg(const char* mesg)
886 {
887 PyObject *type = 0;
888 PyObject *value = 0;
889 PyObject *traceback = 0;
890
891 if (PyErr_Occurred())
892 PyErr_Fetch(&type, &value, &traceback);
893 if (value) {
894 PyObject *old_str = PyObject_Str(value);
895 const char *tmp = SWIG_Python_str_AsChar(old_str);
896 PyErr_Clear();
897 Py_XINCREF(type);
898 if (tmp)
899 PyErr_Format(type, "%s %s", tmp, mesg);
900 else
901 PyErr_Format(type, "%s", mesg);
902 SWIG_Python_str_DelForPy3(tmp);
903 Py_DECREF(old_str);
904 Py_DECREF(value);
905 } else {
906 PyErr_SetString(PyExc_RuntimeError, mesg);
907 }
908 }
909
910 SWIGRUNTIME int
SWIG_Python_TypeErrorOccurred(PyObject * obj)911 SWIG_Python_TypeErrorOccurred(PyObject *obj)
912 {
913 PyObject *error;
914 if (obj)
915 return 0;
916 error = PyErr_Occurred();
917 return error && PyErr_GivenExceptionMatches(error, PyExc_TypeError);
918 }
919
920 SWIGRUNTIME void
SWIG_Python_RaiseOrModifyTypeError(const char * message)921 SWIG_Python_RaiseOrModifyTypeError(const char *message)
922 {
923 if (SWIG_Python_TypeErrorOccurred(NULL)) {
924 /* Use existing TypeError to preserve stacktrace and enhance with given message */
925 PyObject *newvalue;
926 PyObject *type = NULL, *value = NULL, *traceback = NULL;
927 PyErr_Fetch(&type, &value, &traceback);
928 #if PY_VERSION_HEX >= 0x03000000
929 newvalue = PyUnicode_FromFormat("%S\nAdditional information:\n%s", value, message);
930 #else
931 newvalue = PyString_FromFormat("%s\nAdditional information:\n%s", PyString_AsString(value), message);
932 #endif
933 Py_XDECREF(value);
934 PyErr_Restore(type, newvalue, traceback);
935 } else {
936 /* Raise TypeError using given message */
937 PyErr_SetString(PyExc_TypeError, message);
938 }
939 }
940
941 #if defined(SWIG_PYTHON_NO_THREADS)
942 # if defined(SWIG_PYTHON_THREADS)
943 # undef SWIG_PYTHON_THREADS
944 # endif
945 #endif
946 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
947 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
948 # define SWIG_PYTHON_USE_GIL
949 # endif
950 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
951 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
952 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
953 # endif
954 # ifdef __cplusplus /* C++ code */
955 class SWIG_Python_Thread_Block {
956 bool status;
957 PyGILState_STATE state;
958 public:
end()959 void end() { if (status) { PyGILState_Release(state); status = false;} }
SWIG_Python_Thread_Block()960 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
~SWIG_Python_Thread_Block()961 ~SWIG_Python_Thread_Block() { end(); }
962 };
963 class SWIG_Python_Thread_Allow {
964 bool status;
965 PyThreadState *save;
966 public:
end()967 void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
SWIG_Python_Thread_Allow()968 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
~SWIG_Python_Thread_Allow()969 ~SWIG_Python_Thread_Allow() { end(); }
970 };
971 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
972 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
973 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
974 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
975 # else /* C code */
976 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
977 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
978 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
979 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
980 # endif
981 # else /* Old thread way, not implemented, user must provide it */
982 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
983 # define SWIG_PYTHON_INITIALIZE_THREADS
984 # endif
985 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
986 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
987 # endif
988 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
989 # define SWIG_PYTHON_THREAD_END_BLOCK
990 # endif
991 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
992 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
993 # endif
994 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
995 # define SWIG_PYTHON_THREAD_END_ALLOW
996 # endif
997 # endif
998 #else /* No thread support */
999 # define SWIG_PYTHON_INITIALIZE_THREADS
1000 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1001 # define SWIG_PYTHON_THREAD_END_BLOCK
1002 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1003 # define SWIG_PYTHON_THREAD_END_ALLOW
1004 #endif
1005
1006 /* -----------------------------------------------------------------------------
1007 * Python API portion that goes into the runtime
1008 * ----------------------------------------------------------------------------- */
1009
1010 #ifdef __cplusplus
1011 extern "C" {
1012 #endif
1013
1014 /* -----------------------------------------------------------------------------
1015 * Constant declarations
1016 * ----------------------------------------------------------------------------- */
1017
1018 /* Constant Types */
1019 #define SWIG_PY_POINTER 4
1020 #define SWIG_PY_BINARY 5
1021
1022 /* Constant information structure */
1023 typedef struct swig_const_info {
1024 int type;
1025 const char *name;
1026 long lvalue;
1027 double dvalue;
1028 void *pvalue;
1029 swig_type_info **ptype;
1030 } swig_const_info;
1031
1032 #ifdef __cplusplus
1033 }
1034 #endif
1035
1036
1037 /* -----------------------------------------------------------------------------
1038 * pyrun.swg
1039 *
1040 * This file contains the runtime support for Python modules
1041 * and includes code for managing global variables and pointer
1042 * type checking.
1043 *
1044 * ----------------------------------------------------------------------------- */
1045
1046 #if PY_VERSION_HEX < 0x02070000 /* 2.7.0 */
1047 # error "This version of SWIG only supports Python >= 2.7"
1048 #endif
1049
1050 #if PY_VERSION_HEX >= 0x03000000 && PY_VERSION_HEX < 0x03020000
1051 # error "This version of SWIG only supports Python 3 >= 3.2"
1052 #endif
1053
1054 /* Common SWIG API */
1055
1056 /* for raw pointers */
1057 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1058 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1059 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1060
1061 #ifdef SWIGPYTHON_BUILTIN
1062 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1063 #else
1064 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1065 #endif
1066
1067 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1068
1069 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1070 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1071 #define swig_owntype int
1072
1073 /* for raw packed data */
1074 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1075 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1076
1077 /* for class or struct pointers */
1078 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1079 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1080
1081 /* for C or C++ function pointers */
1082 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1083 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1084
1085 /* for C++ member pointers, ie, member methods */
1086 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1087 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1088
1089
1090 /* Runtime API */
1091
1092 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
1093 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1094 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1095
1096 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1097 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1098 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1099 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1100 #define SWIG_fail goto fail
1101
1102
1103 /* Runtime API implementation */
1104
1105 /* Error manipulation */
1106
1107 SWIGINTERN void
SWIG_Python_SetErrorObj(PyObject * errtype,PyObject * obj)1108 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1109 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1110 PyErr_SetObject(errtype, obj);
1111 Py_DECREF(obj);
1112 SWIG_PYTHON_THREAD_END_BLOCK;
1113 }
1114
1115 SWIGINTERN void
SWIG_Python_SetErrorMsg(PyObject * errtype,const char * msg)1116 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1117 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1118 PyErr_SetString(errtype, msg);
1119 SWIG_PYTHON_THREAD_END_BLOCK;
1120 }
1121
1122 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1123
1124 /* Set a constant value */
1125
1126 #if defined(SWIGPYTHON_BUILTIN)
1127
1128 SWIGINTERN void
SwigPyBuiltin_AddPublicSymbol(PyObject * seq,const char * key)1129 SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1130 PyObject *s = PyString_InternFromString(key);
1131 PyList_Append(seq, s);
1132 Py_DECREF(s);
1133 }
1134
1135 SWIGINTERN void
SWIG_Python_SetConstant(PyObject * d,PyObject * public_interface,const char * name,PyObject * obj)1136 SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
1137 PyDict_SetItemString(d, name, obj);
1138 Py_DECREF(obj);
1139 if (public_interface)
1140 SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1141 }
1142
1143 #else
1144
1145 SWIGINTERN void
SWIG_Python_SetConstant(PyObject * d,const char * name,PyObject * obj)1146 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1147 PyDict_SetItemString(d, name, obj);
1148 Py_DECREF(obj);
1149 }
1150
1151 #endif
1152
1153 /* Append a value to the result obj */
1154
1155 SWIGINTERN PyObject*
SWIG_Python_AppendOutput(PyObject * result,PyObject * obj)1156 SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1157 if (!result) {
1158 result = obj;
1159 } else if (result == Py_None) {
1160 Py_DECREF(result);
1161 result = obj;
1162 } else {
1163 if (!PyList_Check(result)) {
1164 PyObject *o2 = result;
1165 result = PyList_New(1);
1166 PyList_SetItem(result, 0, o2);
1167 }
1168 PyList_Append(result,obj);
1169 Py_DECREF(obj);
1170 }
1171 return result;
1172 }
1173
1174 /* Unpack the argument tuple */
1175
1176 SWIGINTERN Py_ssize_t
SWIG_Python_UnpackTuple(PyObject * args,const char * name,Py_ssize_t min,Py_ssize_t max,PyObject ** objs)1177 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1178 {
1179 if (!args) {
1180 if (!min && !max) {
1181 return 1;
1182 } else {
1183 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1184 name, (min == max ? "" : "at least "), (int)min);
1185 return 0;
1186 }
1187 }
1188 if (!PyTuple_Check(args)) {
1189 if (min <= 1 && max >= 1) {
1190 Py_ssize_t i;
1191 objs[0] = args;
1192 for (i = 1; i < max; ++i) {
1193 objs[i] = 0;
1194 }
1195 return 2;
1196 }
1197 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1198 return 0;
1199 } else {
1200 Py_ssize_t l = PyTuple_GET_SIZE(args);
1201 if (l < min) {
1202 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1203 name, (min == max ? "" : "at least "), (int)min, (int)l);
1204 return 0;
1205 } else if (l > max) {
1206 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1207 name, (min == max ? "" : "at most "), (int)max, (int)l);
1208 return 0;
1209 } else {
1210 Py_ssize_t i;
1211 for (i = 0; i < l; ++i) {
1212 objs[i] = PyTuple_GET_ITEM(args, i);
1213 }
1214 for (; l < max; ++l) {
1215 objs[l] = 0;
1216 }
1217 return i + 1;
1218 }
1219 }
1220 }
1221
1222 /* A functor is a function object with one single object argument */
1223 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1224
1225 /*
1226 Helper for static pointer initialization for both C and C++ code, for example
1227 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1228 */
1229 #ifdef __cplusplus
1230 #define SWIG_STATIC_POINTER(var) var
1231 #else
1232 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1233 #endif
1234
1235 /* -----------------------------------------------------------------------------
1236 * Pointer declarations
1237 * ----------------------------------------------------------------------------- */
1238
1239 /* Flags for new pointer objects */
1240 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1241 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1242
1243 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1244
1245 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1246 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1247
1248 #ifdef __cplusplus
1249 extern "C" {
1250 #endif
1251
1252 /* The python void return value */
1253
1254 SWIGRUNTIMEINLINE PyObject *
SWIG_Py_Void(void)1255 SWIG_Py_Void(void)
1256 {
1257 PyObject *none = Py_None;
1258 Py_INCREF(none);
1259 return none;
1260 }
1261
1262 /* SwigPyClientData */
1263
1264 typedef struct {
1265 PyObject *klass;
1266 PyObject *newraw;
1267 PyObject *newargs;
1268 PyObject *destroy;
1269 int delargs;
1270 int implicitconv;
1271 PyTypeObject *pytype;
1272 } SwigPyClientData;
1273
1274 SWIGRUNTIMEINLINE int
SWIG_Python_CheckImplicit(swig_type_info * ty)1275 SWIG_Python_CheckImplicit(swig_type_info *ty)
1276 {
1277 SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1278 int fail = data ? data->implicitconv : 0;
1279 if (fail)
1280 PyErr_SetString(PyExc_TypeError, "Implicit conversion is prohibited for explicit constructors.");
1281 return fail;
1282 }
1283
1284 SWIGRUNTIMEINLINE PyObject *
SWIG_Python_ExceptionType(swig_type_info * desc)1285 SWIG_Python_ExceptionType(swig_type_info *desc) {
1286 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1287 PyObject *klass = data ? data->klass : 0;
1288 return (klass ? klass : PyExc_RuntimeError);
1289 }
1290
1291
1292 SWIGRUNTIME SwigPyClientData *
SwigPyClientData_New(PyObject * obj)1293 SwigPyClientData_New(PyObject* obj)
1294 {
1295 if (!obj) {
1296 return 0;
1297 } else {
1298 SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1299 /* the klass element */
1300 data->klass = obj;
1301 Py_INCREF(data->klass);
1302 /* the newraw method and newargs arguments used to create a new raw instance */
1303 if (PyClass_Check(obj)) {
1304 data->newraw = 0;
1305 data->newargs = obj;
1306 Py_INCREF(obj);
1307 } else {
1308 data->newraw = PyObject_GetAttrString(data->klass, "__new__");
1309 if (data->newraw) {
1310 Py_INCREF(data->newraw);
1311 data->newargs = PyTuple_New(1);
1312 PyTuple_SetItem(data->newargs, 0, obj);
1313 } else {
1314 data->newargs = obj;
1315 }
1316 Py_INCREF(data->newargs);
1317 }
1318 /* the destroy method, aka as the C++ delete method */
1319 data->destroy = PyObject_GetAttrString(data->klass, "__swig_destroy__");
1320 if (PyErr_Occurred()) {
1321 PyErr_Clear();
1322 data->destroy = 0;
1323 }
1324 if (data->destroy) {
1325 int flags;
1326 Py_INCREF(data->destroy);
1327 flags = PyCFunction_GET_FLAGS(data->destroy);
1328 data->delargs = !(flags & (METH_O));
1329 } else {
1330 data->delargs = 0;
1331 }
1332 data->implicitconv = 0;
1333 data->pytype = 0;
1334 return data;
1335 }
1336 }
1337
1338 SWIGRUNTIME void
SwigPyClientData_Del(SwigPyClientData * data)1339 SwigPyClientData_Del(SwigPyClientData *data) {
1340 Py_XDECREF(data->newraw);
1341 Py_XDECREF(data->newargs);
1342 Py_XDECREF(data->destroy);
1343 }
1344
1345 /* =============== SwigPyObject =====================*/
1346
1347 typedef struct {
1348 PyObject_HEAD
1349 void *ptr;
1350 swig_type_info *ty;
1351 int own;
1352 PyObject *next;
1353 #ifdef SWIGPYTHON_BUILTIN
1354 PyObject *dict;
1355 #endif
1356 } SwigPyObject;
1357
1358
1359 #ifdef SWIGPYTHON_BUILTIN
1360
1361 SWIGRUNTIME PyObject *
SwigPyObject_get___dict__(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1362 SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
1363 {
1364 SwigPyObject *sobj = (SwigPyObject *)v;
1365
1366 if (!sobj->dict)
1367 sobj->dict = PyDict_New();
1368
1369 Py_INCREF(sobj->dict);
1370 return sobj->dict;
1371 }
1372
1373 #endif
1374
1375 SWIGRUNTIME PyObject *
SwigPyObject_long(SwigPyObject * v)1376 SwigPyObject_long(SwigPyObject *v)
1377 {
1378 return PyLong_FromVoidPtr(v->ptr);
1379 }
1380
1381 SWIGRUNTIME PyObject *
SwigPyObject_format(const char * fmt,SwigPyObject * v)1382 SwigPyObject_format(const char* fmt, SwigPyObject *v)
1383 {
1384 PyObject *res = NULL;
1385 PyObject *args = PyTuple_New(1);
1386 if (args) {
1387 if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1388 PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1389 if (ofmt) {
1390 #if PY_VERSION_HEX >= 0x03000000
1391 res = PyUnicode_Format(ofmt,args);
1392 #else
1393 res = PyString_Format(ofmt,args);
1394 #endif
1395 Py_DECREF(ofmt);
1396 }
1397 Py_DECREF(args);
1398 }
1399 }
1400 return res;
1401 }
1402
1403 SWIGRUNTIME PyObject *
SwigPyObject_oct(SwigPyObject * v)1404 SwigPyObject_oct(SwigPyObject *v)
1405 {
1406 return SwigPyObject_format("%o",v);
1407 }
1408
1409 SWIGRUNTIME PyObject *
SwigPyObject_hex(SwigPyObject * v)1410 SwigPyObject_hex(SwigPyObject *v)
1411 {
1412 return SwigPyObject_format("%x",v);
1413 }
1414
1415 SWIGRUNTIME PyObject *
SwigPyObject_repr(SwigPyObject * v)1416 SwigPyObject_repr(SwigPyObject *v)
1417 {
1418 const char *name = SWIG_TypePrettyName(v->ty);
1419 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
1420 if (v->next) {
1421 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1422 # if PY_VERSION_HEX >= 0x03000000
1423 PyObject *joined = PyUnicode_Concat(repr, nrep);
1424 Py_DecRef(repr);
1425 Py_DecRef(nrep);
1426 repr = joined;
1427 # else
1428 PyString_ConcatAndDel(&repr,nrep);
1429 # endif
1430 }
1431 return repr;
1432 }
1433
1434 /* We need a version taking two PyObject* parameters so it's a valid
1435 * PyCFunction to use in swigobject_methods[]. */
1436 SWIGRUNTIME PyObject *
SwigPyObject_repr2(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1437 SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
1438 {
1439 return SwigPyObject_repr((SwigPyObject*)v);
1440 }
1441
1442 SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject * v,SwigPyObject * w)1443 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
1444 {
1445 void *i = v->ptr;
1446 void *j = w->ptr;
1447 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1448 }
1449
1450 /* Added for Python 3.x, would it also be useful for Python 2.x? */
1451 SWIGRUNTIME PyObject*
SwigPyObject_richcompare(SwigPyObject * v,SwigPyObject * w,int op)1452 SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
1453 {
1454 PyObject* res;
1455 if( op != Py_EQ && op != Py_NE ) {
1456 Py_INCREF(Py_NotImplemented);
1457 return Py_NotImplemented;
1458 }
1459 res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
1460 return res;
1461 }
1462
1463
1464 SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
1465
1466 #ifdef SWIGPYTHON_BUILTIN
1467 static swig_type_info *SwigPyObject_stype = 0;
1468 SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void)1469 SwigPyObject_type(void) {
1470 SwigPyClientData *cd;
1471 assert(SwigPyObject_stype);
1472 cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
1473 assert(cd);
1474 assert(cd->pytype);
1475 return cd->pytype;
1476 }
1477 #else
1478 SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void)1479 SwigPyObject_type(void) {
1480 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1481 return type;
1482 }
1483 #endif
1484
1485 SWIGRUNTIMEINLINE int
SwigPyObject_Check(PyObject * op)1486 SwigPyObject_Check(PyObject *op) {
1487 #ifdef SWIGPYTHON_BUILTIN
1488 PyTypeObject *target_tp = SwigPyObject_type();
1489 if (PyType_IsSubtype(op->ob_type, target_tp))
1490 return 1;
1491 return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
1492 #else
1493 return (Py_TYPE(op) == SwigPyObject_type())
1494 || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1495 #endif
1496 }
1497
1498 SWIGRUNTIME PyObject *
1499 SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1500
1501 SWIGRUNTIME void
SwigPyObject_dealloc(PyObject * v)1502 SwigPyObject_dealloc(PyObject *v)
1503 {
1504 SwigPyObject *sobj = (SwigPyObject *) v;
1505 PyObject *next = sobj->next;
1506 if (sobj->own == SWIG_POINTER_OWN) {
1507 swig_type_info *ty = sobj->ty;
1508 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1509 PyObject *destroy = data ? data->destroy : 0;
1510 if (destroy) {
1511 /* destroy is always a VARARGS method */
1512 PyObject *res;
1513
1514 /* PyObject_CallFunction() has the potential to silently drop
1515 the active exception. In cases of unnamed temporary
1516 variable or where we just finished iterating over a generator
1517 StopIteration will be active right now, and this needs to
1518 remain true upon return from SwigPyObject_dealloc. So save
1519 and restore. */
1520
1521 PyObject *type = NULL, *value = NULL, *traceback = NULL;
1522 PyErr_Fetch(&type, &value, &traceback);
1523
1524 if (data->delargs) {
1525 /* we need to create a temporary object to carry the destroy operation */
1526 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1527 res = SWIG_Python_CallFunctor(destroy, tmp);
1528 Py_DECREF(tmp);
1529 } else {
1530 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1531 PyObject *mself = PyCFunction_GET_SELF(destroy);
1532 res = ((*meth)(mself, v));
1533 }
1534 if (!res)
1535 PyErr_WriteUnraisable(destroy);
1536
1537 PyErr_Restore(type, value, traceback);
1538
1539 Py_XDECREF(res);
1540 }
1541 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1542 else {
1543 const char *name = SWIG_TypePrettyName(ty);
1544 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1545 }
1546 #endif
1547 }
1548 Py_XDECREF(next);
1549 PyObject_DEL(v);
1550 }
1551
1552 SWIGRUNTIME PyObject*
SwigPyObject_append(PyObject * v,PyObject * next)1553 SwigPyObject_append(PyObject* v, PyObject* next)
1554 {
1555 SwigPyObject *sobj = (SwigPyObject *) v;
1556 if (!SwigPyObject_Check(next)) {
1557 PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
1558 return NULL;
1559 }
1560 sobj->next = next;
1561 Py_INCREF(next);
1562 return SWIG_Py_Void();
1563 }
1564
1565 SWIGRUNTIME PyObject*
SwigPyObject_next(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1566 SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1567 {
1568 SwigPyObject *sobj = (SwigPyObject *) v;
1569 if (sobj->next) {
1570 Py_INCREF(sobj->next);
1571 return sobj->next;
1572 } else {
1573 return SWIG_Py_Void();
1574 }
1575 }
1576
1577 SWIGINTERN PyObject*
SwigPyObject_disown(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1578 SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1579 {
1580 SwigPyObject *sobj = (SwigPyObject *)v;
1581 sobj->own = 0;
1582 return SWIG_Py_Void();
1583 }
1584
1585 SWIGINTERN PyObject*
SwigPyObject_acquire(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1586 SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1587 {
1588 SwigPyObject *sobj = (SwigPyObject *)v;
1589 sobj->own = SWIG_POINTER_OWN;
1590 return SWIG_Py_Void();
1591 }
1592
1593 SWIGINTERN PyObject*
SwigPyObject_own(PyObject * v,PyObject * args)1594 SwigPyObject_own(PyObject *v, PyObject *args)
1595 {
1596 PyObject *val = 0;
1597 if (!PyArg_UnpackTuple(args, "own", 0, 1, &val)) {
1598 return NULL;
1599 } else {
1600 SwigPyObject *sobj = (SwigPyObject *)v;
1601 PyObject *obj = PyBool_FromLong(sobj->own);
1602 if (val) {
1603 if (PyObject_IsTrue(val)) {
1604 SwigPyObject_acquire(v,args);
1605 } else {
1606 SwigPyObject_disown(v,args);
1607 }
1608 }
1609 return obj;
1610 }
1611 }
1612
1613 static PyMethodDef
1614 swigobject_methods[] = {
1615 {"disown", SwigPyObject_disown, METH_NOARGS, "releases ownership of the pointer"},
1616 {"acquire", SwigPyObject_acquire, METH_NOARGS, "acquires ownership of the pointer"},
1617 {"own", SwigPyObject_own, METH_VARARGS, "returns/sets ownership of the pointer"},
1618 {"append", SwigPyObject_append, METH_O, "appends another 'this' object"},
1619 {"next", SwigPyObject_next, METH_NOARGS, "returns the next 'this' object"},
1620 {"__repr__",SwigPyObject_repr2, METH_NOARGS, "returns object representation"},
1621 {0, 0, 0, 0}
1622 };
1623
1624 SWIGRUNTIME PyTypeObject*
SwigPyObject_TypeOnce(void)1625 SwigPyObject_TypeOnce(void) {
1626 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1627
1628 static PyNumberMethods SwigPyObject_as_number = {
1629 (binaryfunc)0, /*nb_add*/
1630 (binaryfunc)0, /*nb_subtract*/
1631 (binaryfunc)0, /*nb_multiply*/
1632 /* nb_divide removed in Python 3 */
1633 #if PY_VERSION_HEX < 0x03000000
1634 (binaryfunc)0, /*nb_divide*/
1635 #endif
1636 (binaryfunc)0, /*nb_remainder*/
1637 (binaryfunc)0, /*nb_divmod*/
1638 (ternaryfunc)0,/*nb_power*/
1639 (unaryfunc)0, /*nb_negative*/
1640 (unaryfunc)0, /*nb_positive*/
1641 (unaryfunc)0, /*nb_absolute*/
1642 (inquiry)0, /*nb_nonzero*/
1643 0, /*nb_invert*/
1644 0, /*nb_lshift*/
1645 0, /*nb_rshift*/
1646 0, /*nb_and*/
1647 0, /*nb_xor*/
1648 0, /*nb_or*/
1649 #if PY_VERSION_HEX < 0x03000000
1650 0, /*nb_coerce*/
1651 #endif
1652 (unaryfunc)SwigPyObject_long, /*nb_int*/
1653 #if PY_VERSION_HEX < 0x03000000
1654 (unaryfunc)SwigPyObject_long, /*nb_long*/
1655 #else
1656 0, /*nb_reserved*/
1657 #endif
1658 (unaryfunc)0, /*nb_float*/
1659 #if PY_VERSION_HEX < 0x03000000
1660 (unaryfunc)SwigPyObject_oct, /*nb_oct*/
1661 (unaryfunc)SwigPyObject_hex, /*nb_hex*/
1662 #endif
1663 #if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
1664 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
1665 #elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1666 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1667 #else
1668 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1669 #endif
1670 };
1671
1672 static PyTypeObject swigpyobject_type;
1673 static int type_init = 0;
1674 if (!type_init) {
1675 const PyTypeObject tmp = {
1676 #if PY_VERSION_HEX >= 0x03000000
1677 PyVarObject_HEAD_INIT(NULL, 0)
1678 #else
1679 PyObject_HEAD_INIT(NULL)
1680 0, /* ob_size */
1681 #endif
1682 "SwigPyObject", /* tp_name */
1683 sizeof(SwigPyObject), /* tp_basicsize */
1684 0, /* tp_itemsize */
1685 (destructor)SwigPyObject_dealloc, /* tp_dealloc */
1686 0, /* tp_print */
1687 (getattrfunc)0, /* tp_getattr */
1688 (setattrfunc)0, /* tp_setattr */
1689 #if PY_VERSION_HEX >= 0x03000000
1690 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1691 #else
1692 (cmpfunc)SwigPyObject_compare, /* tp_compare */
1693 #endif
1694 (reprfunc)SwigPyObject_repr, /* tp_repr */
1695 &SwigPyObject_as_number, /* tp_as_number */
1696 0, /* tp_as_sequence */
1697 0, /* tp_as_mapping */
1698 (hashfunc)0, /* tp_hash */
1699 (ternaryfunc)0, /* tp_call */
1700 0, /* tp_str */
1701 PyObject_GenericGetAttr, /* tp_getattro */
1702 0, /* tp_setattro */
1703 0, /* tp_as_buffer */
1704 Py_TPFLAGS_DEFAULT, /* tp_flags */
1705 swigobject_doc, /* tp_doc */
1706 0, /* tp_traverse */
1707 0, /* tp_clear */
1708 (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
1709 0, /* tp_weaklistoffset */
1710 0, /* tp_iter */
1711 0, /* tp_iternext */
1712 swigobject_methods, /* tp_methods */
1713 0, /* tp_members */
1714 0, /* tp_getset */
1715 0, /* tp_base */
1716 0, /* tp_dict */
1717 0, /* tp_descr_get */
1718 0, /* tp_descr_set */
1719 0, /* tp_dictoffset */
1720 0, /* tp_init */
1721 0, /* tp_alloc */
1722 0, /* tp_new */
1723 0, /* tp_free */
1724 0, /* tp_is_gc */
1725 0, /* tp_bases */
1726 0, /* tp_mro */
1727 0, /* tp_cache */
1728 0, /* tp_subclasses */
1729 0, /* tp_weaklist */
1730 0, /* tp_del */
1731 0, /* tp_version_tag */
1732 #if PY_VERSION_HEX >= 0x03040000
1733 0, /* tp_finalize */
1734 #endif
1735 #ifdef COUNT_ALLOCS
1736 0, /* tp_allocs */
1737 0, /* tp_frees */
1738 0, /* tp_maxalloc */
1739 0, /* tp_prev */
1740 0 /* tp_next */
1741 #endif
1742 };
1743 swigpyobject_type = tmp;
1744 type_init = 1;
1745 if (PyType_Ready(&swigpyobject_type) < 0)
1746 return NULL;
1747 }
1748 return &swigpyobject_type;
1749 }
1750
1751 SWIGRUNTIME PyObject *
SwigPyObject_New(void * ptr,swig_type_info * ty,int own)1752 SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
1753 {
1754 SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1755 if (sobj) {
1756 sobj->ptr = ptr;
1757 sobj->ty = ty;
1758 sobj->own = own;
1759 sobj->next = 0;
1760 }
1761 return (PyObject *)sobj;
1762 }
1763
1764 /* -----------------------------------------------------------------------------
1765 * Implements a simple Swig Packed type, and use it instead of string
1766 * ----------------------------------------------------------------------------- */
1767
1768 typedef struct {
1769 PyObject_HEAD
1770 void *pack;
1771 swig_type_info *ty;
1772 size_t size;
1773 } SwigPyPacked;
1774
1775 SWIGRUNTIME PyObject *
SwigPyPacked_repr(SwigPyPacked * v)1776 SwigPyPacked_repr(SwigPyPacked *v)
1777 {
1778 char result[SWIG_BUFFER_SIZE];
1779 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1780 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1781 } else {
1782 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
1783 }
1784 }
1785
1786 SWIGRUNTIME PyObject *
SwigPyPacked_str(SwigPyPacked * v)1787 SwigPyPacked_str(SwigPyPacked *v)
1788 {
1789 char result[SWIG_BUFFER_SIZE];
1790 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
1791 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
1792 } else {
1793 return SWIG_Python_str_FromChar(v->ty->name);
1794 }
1795 }
1796
1797 SWIGRUNTIME int
SwigPyPacked_compare(SwigPyPacked * v,SwigPyPacked * w)1798 SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
1799 {
1800 size_t i = v->size;
1801 size_t j = w->size;
1802 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
1803 return s ? s : strncmp((const char *)v->pack, (const char *)w->pack, 2*v->size);
1804 }
1805
1806 SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
1807
1808 SWIGRUNTIME PyTypeObject*
SwigPyPacked_type(void)1809 SwigPyPacked_type(void) {
1810 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
1811 return type;
1812 }
1813
1814 SWIGRUNTIMEINLINE int
SwigPyPacked_Check(PyObject * op)1815 SwigPyPacked_Check(PyObject *op) {
1816 return ((op)->ob_type == SwigPyPacked_TypeOnce())
1817 || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
1818 }
1819
1820 SWIGRUNTIME void
SwigPyPacked_dealloc(PyObject * v)1821 SwigPyPacked_dealloc(PyObject *v)
1822 {
1823 if (SwigPyPacked_Check(v)) {
1824 SwigPyPacked *sobj = (SwigPyPacked *) v;
1825 free(sobj->pack);
1826 }
1827 PyObject_DEL(v);
1828 }
1829
1830 SWIGRUNTIME PyTypeObject*
SwigPyPacked_TypeOnce(void)1831 SwigPyPacked_TypeOnce(void) {
1832 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
1833 static PyTypeObject swigpypacked_type;
1834 static int type_init = 0;
1835 if (!type_init) {
1836 const PyTypeObject tmp = {
1837 #if PY_VERSION_HEX>=0x03000000
1838 PyVarObject_HEAD_INIT(NULL, 0)
1839 #else
1840 PyObject_HEAD_INIT(NULL)
1841 0, /* ob_size */
1842 #endif
1843 "SwigPyPacked", /* tp_name */
1844 sizeof(SwigPyPacked), /* tp_basicsize */
1845 0, /* tp_itemsize */
1846 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */
1847 0, /* tp_print */
1848 (getattrfunc)0, /* tp_getattr */
1849 (setattrfunc)0, /* tp_setattr */
1850 #if PY_VERSION_HEX>=0x03000000
1851 0, /* tp_reserved in 3.0.1 */
1852 #else
1853 (cmpfunc)SwigPyPacked_compare, /* tp_compare */
1854 #endif
1855 (reprfunc)SwigPyPacked_repr, /* tp_repr */
1856 0, /* tp_as_number */
1857 0, /* tp_as_sequence */
1858 0, /* tp_as_mapping */
1859 (hashfunc)0, /* tp_hash */
1860 (ternaryfunc)0, /* tp_call */
1861 (reprfunc)SwigPyPacked_str, /* tp_str */
1862 PyObject_GenericGetAttr, /* tp_getattro */
1863 0, /* tp_setattro */
1864 0, /* tp_as_buffer */
1865 Py_TPFLAGS_DEFAULT, /* tp_flags */
1866 swigpacked_doc, /* tp_doc */
1867 0, /* tp_traverse */
1868 0, /* tp_clear */
1869 0, /* tp_richcompare */
1870 0, /* tp_weaklistoffset */
1871 0, /* tp_iter */
1872 0, /* tp_iternext */
1873 0, /* tp_methods */
1874 0, /* tp_members */
1875 0, /* tp_getset */
1876 0, /* tp_base */
1877 0, /* tp_dict */
1878 0, /* tp_descr_get */
1879 0, /* tp_descr_set */
1880 0, /* tp_dictoffset */
1881 0, /* tp_init */
1882 0, /* tp_alloc */
1883 0, /* tp_new */
1884 0, /* tp_free */
1885 0, /* tp_is_gc */
1886 0, /* tp_bases */
1887 0, /* tp_mro */
1888 0, /* tp_cache */
1889 0, /* tp_subclasses */
1890 0, /* tp_weaklist */
1891 0, /* tp_del */
1892 0, /* tp_version_tag */
1893 #if PY_VERSION_HEX >= 0x03040000
1894 0, /* tp_finalize */
1895 #endif
1896 #ifdef COUNT_ALLOCS
1897 0, /* tp_allocs */
1898 0, /* tp_frees */
1899 0, /* tp_maxalloc */
1900 0, /* tp_prev */
1901 0 /* tp_next */
1902 #endif
1903 };
1904 swigpypacked_type = tmp;
1905 type_init = 1;
1906 if (PyType_Ready(&swigpypacked_type) < 0)
1907 return NULL;
1908 }
1909 return &swigpypacked_type;
1910 }
1911
1912 SWIGRUNTIME PyObject *
SwigPyPacked_New(void * ptr,size_t size,swig_type_info * ty)1913 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
1914 {
1915 SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
1916 if (sobj) {
1917 void *pack = malloc(size);
1918 if (pack) {
1919 memcpy(pack, ptr, size);
1920 sobj->pack = pack;
1921 sobj->ty = ty;
1922 sobj->size = size;
1923 } else {
1924 PyObject_DEL((PyObject *) sobj);
1925 sobj = 0;
1926 }
1927 }
1928 return (PyObject *) sobj;
1929 }
1930
1931 SWIGRUNTIME swig_type_info *
SwigPyPacked_UnpackData(PyObject * obj,void * ptr,size_t size)1932 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
1933 {
1934 if (SwigPyPacked_Check(obj)) {
1935 SwigPyPacked *sobj = (SwigPyPacked *)obj;
1936 if (sobj->size != size) return 0;
1937 memcpy(ptr, sobj->pack, size);
1938 return sobj->ty;
1939 } else {
1940 return 0;
1941 }
1942 }
1943
1944 /* -----------------------------------------------------------------------------
1945 * pointers/data manipulation
1946 * ----------------------------------------------------------------------------- */
1947
1948 static PyObject *Swig_This_global = NULL;
1949
1950 SWIGRUNTIME PyObject *
SWIG_This(void)1951 SWIG_This(void)
1952 {
1953 if (Swig_This_global == NULL)
1954 Swig_This_global = SWIG_Python_str_FromChar("this");
1955 return Swig_This_global;
1956 }
1957
1958 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
1959
1960 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
1961 #if PY_VERSION_HEX>=0x03000000
1962 #define SWIG_PYTHON_SLOW_GETSET_THIS
1963 #endif
1964
1965 SWIGRUNTIME SwigPyObject *
SWIG_Python_GetSwigThis(PyObject * pyobj)1966 SWIG_Python_GetSwigThis(PyObject *pyobj)
1967 {
1968 PyObject *obj;
1969
1970 if (SwigPyObject_Check(pyobj))
1971 return (SwigPyObject *) pyobj;
1972
1973 #ifdef SWIGPYTHON_BUILTIN
1974 (void)obj;
1975 # ifdef PyWeakref_CheckProxy
1976 if (PyWeakref_CheckProxy(pyobj)) {
1977 pyobj = PyWeakref_GET_OBJECT(pyobj);
1978 if (pyobj && SwigPyObject_Check(pyobj))
1979 return (SwigPyObject*) pyobj;
1980 }
1981 # endif
1982 return NULL;
1983 #else
1984
1985 obj = 0;
1986
1987 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
1988 if (PyInstance_Check(pyobj)) {
1989 obj = _PyInstance_Lookup(pyobj, SWIG_This());
1990 } else {
1991 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
1992 if (dictptr != NULL) {
1993 PyObject *dict = *dictptr;
1994 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
1995 } else {
1996 #ifdef PyWeakref_CheckProxy
1997 if (PyWeakref_CheckProxy(pyobj)) {
1998 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
1999 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2000 }
2001 #endif
2002 obj = PyObject_GetAttr(pyobj,SWIG_This());
2003 if (obj) {
2004 Py_DECREF(obj);
2005 } else {
2006 if (PyErr_Occurred()) PyErr_Clear();
2007 return 0;
2008 }
2009 }
2010 }
2011 #else
2012 obj = PyObject_GetAttr(pyobj,SWIG_This());
2013 if (obj) {
2014 Py_DECREF(obj);
2015 } else {
2016 if (PyErr_Occurred()) PyErr_Clear();
2017 return 0;
2018 }
2019 #endif
2020 if (obj && !SwigPyObject_Check(obj)) {
2021 /* a PyObject is called 'this', try to get the 'real this'
2022 SwigPyObject from it */
2023 return SWIG_Python_GetSwigThis(obj);
2024 }
2025 return (SwigPyObject *)obj;
2026 #endif
2027 }
2028
2029 /* Acquire a pointer value */
2030
2031 SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject * obj,int own)2032 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2033 if (own == SWIG_POINTER_OWN) {
2034 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2035 if (sobj) {
2036 int oldown = sobj->own;
2037 sobj->own = own;
2038 return oldown;
2039 }
2040 }
2041 return 0;
2042 }
2043
2044 /* Convert a pointer value */
2045
2046 SWIGRUNTIME int
SWIG_Python_ConvertPtrAndOwn(PyObject * obj,void ** ptr,swig_type_info * ty,int flags,int * own)2047 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2048 int res;
2049 SwigPyObject *sobj;
2050 int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;
2051
2052 if (!obj)
2053 return SWIG_ERROR;
2054 if (obj == Py_None && !implicit_conv) {
2055 if (ptr)
2056 *ptr = 0;
2057 return (flags & SWIG_POINTER_NO_NULL) ? SWIG_NullReferenceError : SWIG_OK;
2058 }
2059
2060 res = SWIG_ERROR;
2061
2062 sobj = SWIG_Python_GetSwigThis(obj);
2063 if (own)
2064 *own = 0;
2065 while (sobj) {
2066 void *vptr = sobj->ptr;
2067 if (ty) {
2068 swig_type_info *to = sobj->ty;
2069 if (to == ty) {
2070 /* no type cast needed */
2071 if (ptr) *ptr = vptr;
2072 break;
2073 } else {
2074 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2075 if (!tc) {
2076 sobj = (SwigPyObject *)sobj->next;
2077 } else {
2078 if (ptr) {
2079 int newmemory = 0;
2080 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2081 if (newmemory == SWIG_CAST_NEW_MEMORY) {
2082 assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2083 if (own)
2084 *own = *own | SWIG_CAST_NEW_MEMORY;
2085 }
2086 }
2087 break;
2088 }
2089 }
2090 } else {
2091 if (ptr) *ptr = vptr;
2092 break;
2093 }
2094 }
2095 if (sobj) {
2096 if (own)
2097 *own = *own | sobj->own;
2098 if (flags & SWIG_POINTER_DISOWN) {
2099 sobj->own = 0;
2100 }
2101 res = SWIG_OK;
2102 } else {
2103 if (implicit_conv) {
2104 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2105 if (data && !data->implicitconv) {
2106 PyObject *klass = data->klass;
2107 if (klass) {
2108 PyObject *impconv;
2109 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2110 impconv = SWIG_Python_CallFunctor(klass, obj);
2111 data->implicitconv = 0;
2112 if (PyErr_Occurred()) {
2113 PyErr_Clear();
2114 impconv = 0;
2115 }
2116 if (impconv) {
2117 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2118 if (iobj) {
2119 void *vptr;
2120 res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2121 if (SWIG_IsOK(res)) {
2122 if (ptr) {
2123 *ptr = vptr;
2124 /* transfer the ownership to 'ptr' */
2125 iobj->own = 0;
2126 res = SWIG_AddCast(res);
2127 res = SWIG_AddNewMask(res);
2128 } else {
2129 res = SWIG_AddCast(res);
2130 }
2131 }
2132 }
2133 Py_DECREF(impconv);
2134 }
2135 }
2136 }
2137 if (!SWIG_IsOK(res) && obj == Py_None) {
2138 if (ptr)
2139 *ptr = 0;
2140 if (PyErr_Occurred())
2141 PyErr_Clear();
2142 res = SWIG_OK;
2143 }
2144 }
2145 }
2146 return res;
2147 }
2148
2149 /* Convert a function ptr value */
2150
2151 SWIGRUNTIME int
SWIG_Python_ConvertFunctionPtr(PyObject * obj,void ** ptr,swig_type_info * ty)2152 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2153 if (!PyCFunction_Check(obj)) {
2154 return SWIG_ConvertPtr(obj, ptr, ty, 0);
2155 } else {
2156 void *vptr = 0;
2157 swig_cast_info *tc;
2158
2159 /* here we get the method pointer for callbacks */
2160 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2161 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2162 if (desc)
2163 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2164 if (!desc)
2165 return SWIG_ERROR;
2166 tc = SWIG_TypeCheck(desc,ty);
2167 if (tc) {
2168 int newmemory = 0;
2169 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2170 assert(!newmemory); /* newmemory handling not yet implemented */
2171 } else {
2172 return SWIG_ERROR;
2173 }
2174 return SWIG_OK;
2175 }
2176 }
2177
2178 /* Convert a packed pointer value */
2179
2180 SWIGRUNTIME int
SWIG_Python_ConvertPacked(PyObject * obj,void * ptr,size_t sz,swig_type_info * ty)2181 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2182 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2183 if (!to) return SWIG_ERROR;
2184 if (ty) {
2185 if (to != ty) {
2186 /* check type cast? */
2187 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2188 if (!tc) return SWIG_ERROR;
2189 }
2190 }
2191 return SWIG_OK;
2192 }
2193
2194 /* -----------------------------------------------------------------------------
2195 * Create a new pointer object
2196 * ----------------------------------------------------------------------------- */
2197
2198 /*
2199 Create a new instance object, without calling __init__, and set the
2200 'this' attribute.
2201 */
2202
2203 SWIGRUNTIME PyObject*
SWIG_Python_NewShadowInstance(SwigPyClientData * data,PyObject * swig_this)2204 SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
2205 {
2206 PyObject *inst = 0;
2207 PyObject *newraw = data->newraw;
2208 if (newraw) {
2209 inst = PyObject_Call(newraw, data->newargs, NULL);
2210 if (inst) {
2211 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2212 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2213 if (dictptr != NULL) {
2214 PyObject *dict = *dictptr;
2215 if (dict == NULL) {
2216 dict = PyDict_New();
2217 *dictptr = dict;
2218 PyDict_SetItem(dict, SWIG_This(), swig_this);
2219 }
2220 }
2221 #else
2222 PyObject *key = SWIG_This();
2223 PyObject_SetAttr(inst, key, swig_this);
2224 #endif
2225 }
2226 } else {
2227 #if PY_VERSION_HEX >= 0x03000000
2228 PyObject *empty_args = PyTuple_New(0);
2229 if (empty_args) {
2230 PyObject *empty_kwargs = PyDict_New();
2231 if (empty_kwargs) {
2232 inst = ((PyTypeObject *)data->newargs)->tp_new((PyTypeObject *)data->newargs, empty_args, empty_kwargs);
2233 Py_DECREF(empty_kwargs);
2234 if (inst) {
2235 PyObject_SetAttr(inst, SWIG_This(), swig_this);
2236 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2237 }
2238 }
2239 Py_DECREF(empty_args);
2240 }
2241 #else
2242 PyObject *dict = PyDict_New();
2243 if (dict) {
2244 PyDict_SetItem(dict, SWIG_This(), swig_this);
2245 inst = PyInstance_NewRaw(data->newargs, dict);
2246 Py_DECREF(dict);
2247 }
2248 #endif
2249 }
2250 return inst;
2251 }
2252
2253 SWIGRUNTIME void
SWIG_Python_SetSwigThis(PyObject * inst,PyObject * swig_this)2254 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2255 {
2256 PyObject *dict;
2257 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2258 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2259 if (dictptr != NULL) {
2260 dict = *dictptr;
2261 if (dict == NULL) {
2262 dict = PyDict_New();
2263 *dictptr = dict;
2264 }
2265 PyDict_SetItem(dict, SWIG_This(), swig_this);
2266 return;
2267 }
2268 #endif
2269 dict = PyObject_GetAttrString(inst, "__dict__");
2270 PyDict_SetItem(dict, SWIG_This(), swig_this);
2271 Py_DECREF(dict);
2272 }
2273
2274
2275 SWIGINTERN PyObject *
SWIG_Python_InitShadowInstance(PyObject * args)2276 SWIG_Python_InitShadowInstance(PyObject *args) {
2277 PyObject *obj[2];
2278 if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
2279 return NULL;
2280 } else {
2281 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2282 if (sthis) {
2283 SwigPyObject_append((PyObject*) sthis, obj[1]);
2284 } else {
2285 SWIG_Python_SetSwigThis(obj[0], obj[1]);
2286 }
2287 return SWIG_Py_Void();
2288 }
2289 }
2290
2291 /* Create a new pointer object */
2292
2293 SWIGRUNTIME PyObject *
SWIG_Python_NewPointerObj(PyObject * self,void * ptr,swig_type_info * type,int flags)2294 SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2295 SwigPyClientData *clientdata;
2296 PyObject * robj;
2297 int own;
2298
2299 if (!ptr)
2300 return SWIG_Py_Void();
2301
2302 clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2303 own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2304 if (clientdata && clientdata->pytype) {
2305 SwigPyObject *newobj;
2306 if (flags & SWIG_BUILTIN_TP_INIT) {
2307 newobj = (SwigPyObject*) self;
2308 if (newobj->ptr) {
2309 PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2310 while (newobj->next)
2311 newobj = (SwigPyObject *) newobj->next;
2312 newobj->next = next_self;
2313 newobj = (SwigPyObject *)next_self;
2314 #ifdef SWIGPYTHON_BUILTIN
2315 newobj->dict = 0;
2316 #endif
2317 }
2318 } else {
2319 newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2320 #ifdef SWIGPYTHON_BUILTIN
2321 newobj->dict = 0;
2322 #endif
2323 }
2324 if (newobj) {
2325 newobj->ptr = ptr;
2326 newobj->ty = type;
2327 newobj->own = own;
2328 newobj->next = 0;
2329 return (PyObject*) newobj;
2330 }
2331 return SWIG_Py_Void();
2332 }
2333
2334 assert(!(flags & SWIG_BUILTIN_TP_INIT));
2335
2336 robj = SwigPyObject_New(ptr, type, own);
2337 if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2338 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2339 Py_DECREF(robj);
2340 robj = inst;
2341 }
2342 return robj;
2343 }
2344
2345 /* Create a new packed object */
2346
2347 SWIGRUNTIMEINLINE PyObject *
SWIG_Python_NewPackedObj(void * ptr,size_t sz,swig_type_info * type)2348 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2349 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2350 }
2351
2352 /* -----------------------------------------------------------------------------*
2353 * Get type list
2354 * -----------------------------------------------------------------------------*/
2355
2356 #ifdef SWIG_LINK_RUNTIME
2357 void *SWIG_ReturnGlobalTypeList(void *);
2358 #endif
2359
2360 SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void * SWIGUNUSEDPARM (clientdata))2361 SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
2362 static void *type_pointer = (void *)0;
2363 /* first check if module already created */
2364 if (!type_pointer) {
2365 #ifdef SWIG_LINK_RUNTIME
2366 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2367 #else
2368 type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2369 if (PyErr_Occurred()) {
2370 PyErr_Clear();
2371 type_pointer = (void *)0;
2372 }
2373 #endif
2374 }
2375 return (swig_module_info *) type_pointer;
2376 }
2377
2378 SWIGRUNTIME void
SWIG_Python_DestroyModule(PyObject * obj)2379 SWIG_Python_DestroyModule(PyObject *obj)
2380 {
2381 swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2382 swig_type_info **types = swig_module->types;
2383 size_t i;
2384 for (i =0; i < swig_module->size; ++i) {
2385 swig_type_info *ty = types[i];
2386 if (ty->owndata) {
2387 SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
2388 if (data) SwigPyClientData_Del(data);
2389 }
2390 }
2391 Py_DECREF(SWIG_This());
2392 Swig_This_global = NULL;
2393 }
2394
2395 SWIGRUNTIME void
SWIG_Python_SetModule(swig_module_info * swig_module)2396 SWIG_Python_SetModule(swig_module_info *swig_module) {
2397 #if PY_VERSION_HEX >= 0x03000000
2398 /* Add a dummy module object into sys.modules */
2399 PyObject *module = PyImport_AddModule("swig_runtime_data" SWIG_RUNTIME_VERSION);
2400 #else
2401 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2402 PyObject *module = Py_InitModule("swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2403 #endif
2404 PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2405 if (pointer && module) {
2406 PyModule_AddObject(module, "type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2407 } else {
2408 Py_XDECREF(pointer);
2409 }
2410 }
2411
2412 /* The python cached type query */
2413 SWIGRUNTIME PyObject *
SWIG_Python_TypeCache(void)2414 SWIG_Python_TypeCache(void) {
2415 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2416 return cache;
2417 }
2418
2419 SWIGRUNTIME swig_type_info *
SWIG_Python_TypeQuery(const char * type)2420 SWIG_Python_TypeQuery(const char *type)
2421 {
2422 PyObject *cache = SWIG_Python_TypeCache();
2423 PyObject *key = SWIG_Python_str_FromChar(type);
2424 PyObject *obj = PyDict_GetItem(cache, key);
2425 swig_type_info *descriptor;
2426 if (obj) {
2427 descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2428 } else {
2429 swig_module_info *swig_module = SWIG_GetModule(0);
2430 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2431 if (descriptor) {
2432 obj = PyCapsule_New((void*) descriptor, NULL, NULL);
2433 PyDict_SetItem(cache, key, obj);
2434 Py_DECREF(obj);
2435 }
2436 }
2437 Py_DECREF(key);
2438 return descriptor;
2439 }
2440
2441 /*
2442 For backward compatibility only
2443 */
2444 #define SWIG_POINTER_EXCEPTION 0
2445 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2446 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2447
2448 SWIGRUNTIME int
SWIG_Python_AddErrMesg(const char * mesg,int infront)2449 SWIG_Python_AddErrMesg(const char* mesg, int infront)
2450 {
2451 if (PyErr_Occurred()) {
2452 PyObject *type = 0;
2453 PyObject *value = 0;
2454 PyObject *traceback = 0;
2455 PyErr_Fetch(&type, &value, &traceback);
2456 if (value) {
2457 PyObject *old_str = PyObject_Str(value);
2458 const char *tmp = SWIG_Python_str_AsChar(old_str);
2459 const char *errmesg = tmp ? tmp : "Invalid error message";
2460 Py_XINCREF(type);
2461 PyErr_Clear();
2462 if (infront) {
2463 PyErr_Format(type, "%s %s", mesg, errmesg);
2464 } else {
2465 PyErr_Format(type, "%s %s", errmesg, mesg);
2466 }
2467 SWIG_Python_str_DelForPy3(tmp);
2468 Py_DECREF(old_str);
2469 }
2470 return 1;
2471 } else {
2472 return 0;
2473 }
2474 }
2475
2476 SWIGRUNTIME int
SWIG_Python_ArgFail(int argnum)2477 SWIG_Python_ArgFail(int argnum)
2478 {
2479 if (PyErr_Occurred()) {
2480 /* add information about failing argument */
2481 char mesg[256];
2482 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2483 return SWIG_Python_AddErrMesg(mesg, 1);
2484 } else {
2485 return 0;
2486 }
2487 }
2488
2489 SWIGRUNTIMEINLINE const char *
SwigPyObject_GetDesc(PyObject * self)2490 SwigPyObject_GetDesc(PyObject *self)
2491 {
2492 SwigPyObject *v = (SwigPyObject *)self;
2493 swig_type_info *ty = v ? v->ty : 0;
2494 return ty ? ty->str : "";
2495 }
2496
2497 SWIGRUNTIME void
SWIG_Python_TypeError(const char * type,PyObject * obj)2498 SWIG_Python_TypeError(const char *type, PyObject *obj)
2499 {
2500 if (type) {
2501 #if defined(SWIG_COBJECT_TYPES)
2502 if (obj && SwigPyObject_Check(obj)) {
2503 const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2504 if (otype) {
2505 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2506 type, otype);
2507 return;
2508 }
2509 } else
2510 #endif
2511 {
2512 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2513 if (otype) {
2514 PyObject *str = PyObject_Str(obj);
2515 const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2516 if (cstr) {
2517 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2518 type, otype, cstr);
2519 SWIG_Python_str_DelForPy3(cstr);
2520 } else {
2521 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2522 type, otype);
2523 }
2524 Py_XDECREF(str);
2525 return;
2526 }
2527 }
2528 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2529 } else {
2530 PyErr_Format(PyExc_TypeError, "unexpected type is received");
2531 }
2532 }
2533
2534
2535 /* Convert a pointer value, signal an exception on a type mismatch */
2536 SWIGRUNTIME void *
SWIG_Python_MustGetPtr(PyObject * obj,swig_type_info * ty,int SWIGUNUSEDPARM (argnum),int flags)2537 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
2538 void *result;
2539 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2540 PyErr_Clear();
2541 #if SWIG_POINTER_EXCEPTION
2542 if (flags) {
2543 SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2544 SWIG_Python_ArgFail(argnum);
2545 }
2546 #endif
2547 }
2548 return result;
2549 }
2550
2551 #ifdef SWIGPYTHON_BUILTIN
2552 SWIGRUNTIME int
SWIG_Python_NonDynamicSetAttr(PyObject * obj,PyObject * name,PyObject * value)2553 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
2554 PyTypeObject *tp = obj->ob_type;
2555 PyObject *descr;
2556 PyObject *encoded_name;
2557 descrsetfunc f;
2558 int res = -1;
2559
2560 # ifdef Py_USING_UNICODE
2561 if (PyString_Check(name)) {
2562 name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2563 if (!name)
2564 return -1;
2565 } else if (!PyUnicode_Check(name))
2566 # else
2567 if (!PyString_Check(name))
2568 # endif
2569 {
2570 PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2571 return -1;
2572 } else {
2573 Py_INCREF(name);
2574 }
2575
2576 if (!tp->tp_dict) {
2577 if (PyType_Ready(tp) < 0)
2578 goto done;
2579 }
2580
2581 descr = _PyType_Lookup(tp, name);
2582 f = NULL;
2583 if (descr != NULL)
2584 f = descr->ob_type->tp_descr_set;
2585 if (!f) {
2586 if (PyString_Check(name)) {
2587 encoded_name = name;
2588 Py_INCREF(name);
2589 } else {
2590 encoded_name = PyUnicode_AsUTF8String(name);
2591 if (!encoded_name)
2592 return -1;
2593 }
2594 PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2595 Py_DECREF(encoded_name);
2596 } else {
2597 res = f(descr, obj, value);
2598 }
2599
2600 done:
2601 Py_DECREF(name);
2602 return res;
2603 }
2604 #endif
2605
2606
2607 #ifdef __cplusplus
2608 }
2609 #endif
2610
2611
2612
2613 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2614
2615 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2616
2617
2618
2619 #ifdef __cplusplus
2620 extern "C" {
2621 #endif
2622
2623 /* Method creation and docstring support functions */
2624
2625 SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name);
2626 SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
2627 SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func);
2628
2629 #ifdef __cplusplus
2630 }
2631 #endif
2632
2633
2634 /* -------- TYPES TABLE (BEGIN) -------- */
2635
2636 #define SWIGTYPE_p_char swig_types[0]
2637 #define SWIGTYPE_p_double swig_types[1]
2638 static swig_type_info *swig_types[3];
2639 static swig_module_info swig_module = {swig_types, 2, 0, 0, 0, 0};
2640 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2641 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2642
2643 /* -------- TYPES TABLE (END) -------- */
2644
2645 #ifdef SWIG_TypeQuery
2646 # undef SWIG_TypeQuery
2647 #endif
2648 #define SWIG_TypeQuery SWIG_Python_TypeQuery
2649
2650 /*-----------------------------------------------
2651 @(target):= _wcscon.so
2652 ------------------------------------------------*/
2653 #if PY_VERSION_HEX >= 0x03000000
2654 # define SWIG_init PyInit__wcscon
2655
2656 #else
2657 # define SWIG_init init_wcscon
2658
2659 #endif
2660 #define SWIG_name "_wcscon"
2661
2662 #define SWIGVERSION 0x040001
2663 #define SWIG_VERSION SWIGVERSION
2664
2665
2666 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
2667 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
2668
2669
2670 #include <limits.h>
2671 #if !defined(SWIG_NO_LLONG_MAX)
2672 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
2673 # define LLONG_MAX __LONG_LONG_MAX__
2674 # define LLONG_MIN (-LLONG_MAX - 1LL)
2675 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
2676 # endif
2677 #endif
2678
2679
2680 SWIGINTERN int
SWIG_AsVal_double(PyObject * obj,double * val)2681 SWIG_AsVal_double (PyObject *obj, double *val)
2682 {
2683 int res = SWIG_TypeError;
2684 if (PyFloat_Check(obj)) {
2685 if (val) *val = PyFloat_AsDouble(obj);
2686 return SWIG_OK;
2687 #if PY_VERSION_HEX < 0x03000000
2688 } else if (PyInt_Check(obj)) {
2689 if (val) *val = (double) PyInt_AsLong(obj);
2690 return SWIG_OK;
2691 #endif
2692 } else if (PyLong_Check(obj)) {
2693 double v = PyLong_AsDouble(obj);
2694 if (!PyErr_Occurred()) {
2695 if (val) *val = v;
2696 return SWIG_OK;
2697 } else {
2698 PyErr_Clear();
2699 }
2700 }
2701 #ifdef SWIG_PYTHON_CAST_MODE
2702 {
2703 int dispatch = 0;
2704 double d = PyFloat_AsDouble(obj);
2705 if (!PyErr_Occurred()) {
2706 if (val) *val = d;
2707 return SWIG_AddCast(SWIG_OK);
2708 } else {
2709 PyErr_Clear();
2710 }
2711 if (!dispatch) {
2712 long v = PyLong_AsLong(obj);
2713 if (!PyErr_Occurred()) {
2714 if (val) *val = v;
2715 return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
2716 } else {
2717 PyErr_Clear();
2718 }
2719 }
2720 }
2721 #endif
2722 return res;
2723 }
2724
2725
2726 #include <float.h>
2727
2728
2729 #include <math.h>
2730
2731
2732 SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double * d,double min,double max)2733 SWIG_CanCastAsInteger(double *d, double min, double max) {
2734 double x = *d;
2735 if ((min <= x && x <= max)) {
2736 double fx = floor(x);
2737 double cx = ceil(x);
2738 double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
2739 if ((errno == EDOM) || (errno == ERANGE)) {
2740 errno = 0;
2741 } else {
2742 double summ, reps, diff;
2743 if (rd < x) {
2744 diff = x - rd;
2745 } else if (rd > x) {
2746 diff = rd - x;
2747 } else {
2748 return 1;
2749 }
2750 summ = rd + x;
2751 reps = diff/summ;
2752 if (reps < 8*DBL_EPSILON) {
2753 *d = rd;
2754 return 1;
2755 }
2756 }
2757 }
2758 return 0;
2759 }
2760
2761
2762 SWIGINTERN int
SWIG_AsVal_long(PyObject * obj,long * val)2763 SWIG_AsVal_long (PyObject *obj, long* val)
2764 {
2765 #if PY_VERSION_HEX < 0x03000000
2766 if (PyInt_Check(obj)) {
2767 if (val) *val = PyInt_AsLong(obj);
2768 return SWIG_OK;
2769 } else
2770 #endif
2771 if (PyLong_Check(obj)) {
2772 long v = PyLong_AsLong(obj);
2773 if (!PyErr_Occurred()) {
2774 if (val) *val = v;
2775 return SWIG_OK;
2776 } else {
2777 PyErr_Clear();
2778 return SWIG_OverflowError;
2779 }
2780 }
2781 #ifdef SWIG_PYTHON_CAST_MODE
2782 {
2783 int dispatch = 0;
2784 long v = PyInt_AsLong(obj);
2785 if (!PyErr_Occurred()) {
2786 if (val) *val = v;
2787 return SWIG_AddCast(SWIG_OK);
2788 } else {
2789 PyErr_Clear();
2790 }
2791 if (!dispatch) {
2792 double d;
2793 int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
2794 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
2795 if (val) *val = (long)(d);
2796 return res;
2797 }
2798 }
2799 }
2800 #endif
2801 return SWIG_TypeError;
2802 }
2803
2804
2805 SWIGINTERN int
SWIG_AsVal_int(PyObject * obj,int * val)2806 SWIG_AsVal_int (PyObject * obj, int *val)
2807 {
2808 long v;
2809 int res = SWIG_AsVal_long (obj, &v);
2810 if (SWIG_IsOK(res)) {
2811 if ((v < INT_MIN || v > INT_MAX)) {
2812 return SWIG_OverflowError;
2813 } else {
2814 if (val) *val = (int)(v);
2815 }
2816 }
2817 return res;
2818 }
2819
2820
2821 #define SWIG_From_double PyFloat_FromDouble
2822
2823
2824 SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)2825 SWIG_pchar_descriptor(void)
2826 {
2827 static int init = 0;
2828 static swig_type_info* info = 0;
2829 if (!init) {
2830 info = SWIG_TypeQuery("_p_char");
2831 init = 1;
2832 }
2833 return info;
2834 }
2835
2836
2837 SWIGINTERN int
SWIG_AsCharPtrAndSize(PyObject * obj,char ** cptr,size_t * psize,int * alloc)2838 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
2839 {
2840 #if PY_VERSION_HEX>=0x03000000
2841 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2842 if (PyBytes_Check(obj))
2843 #else
2844 if (PyUnicode_Check(obj))
2845 #endif
2846 #else
2847 if (PyString_Check(obj))
2848 #endif
2849 {
2850 char *cstr; Py_ssize_t len;
2851 int ret = SWIG_OK;
2852 #if PY_VERSION_HEX>=0x03000000
2853 #if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2854 if (!alloc && cptr) {
2855 /* We can't allow converting without allocation, since the internal
2856 representation of string in Python 3 is UCS-2/UCS-4 but we require
2857 a UTF-8 representation.
2858 TODO(bhy) More detailed explanation */
2859 return SWIG_RuntimeError;
2860 }
2861 obj = PyUnicode_AsUTF8String(obj);
2862 if (!obj)
2863 return SWIG_TypeError;
2864 if (alloc)
2865 *alloc = SWIG_NEWOBJ;
2866 #endif
2867 PyBytes_AsStringAndSize(obj, &cstr, &len);
2868 #else
2869 PyString_AsStringAndSize(obj, &cstr, &len);
2870 #endif
2871 if (cptr) {
2872 if (alloc) {
2873 if (*alloc == SWIG_NEWOBJ) {
2874 *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
2875 *alloc = SWIG_NEWOBJ;
2876 } else {
2877 *cptr = cstr;
2878 *alloc = SWIG_OLDOBJ;
2879 }
2880 } else {
2881 #if PY_VERSION_HEX>=0x03000000
2882 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2883 *cptr = PyBytes_AsString(obj);
2884 #else
2885 assert(0); /* Should never reach here with Unicode strings in Python 3 */
2886 #endif
2887 #else
2888 *cptr = SWIG_Python_str_AsChar(obj);
2889 if (!*cptr)
2890 ret = SWIG_TypeError;
2891 #endif
2892 }
2893 }
2894 if (psize) *psize = len + 1;
2895 #if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2896 Py_XDECREF(obj);
2897 #endif
2898 return ret;
2899 } else {
2900 #if defined(SWIG_PYTHON_2_UNICODE)
2901 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
2902 #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
2903 #endif
2904 #if PY_VERSION_HEX<0x03000000
2905 if (PyUnicode_Check(obj)) {
2906 char *cstr; Py_ssize_t len;
2907 if (!alloc && cptr) {
2908 return SWIG_RuntimeError;
2909 }
2910 obj = PyUnicode_AsUTF8String(obj);
2911 if (!obj)
2912 return SWIG_TypeError;
2913 if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
2914 if (cptr) {
2915 if (alloc) *alloc = SWIG_NEWOBJ;
2916 *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
2917 }
2918 if (psize) *psize = len + 1;
2919
2920 Py_XDECREF(obj);
2921 return SWIG_OK;
2922 } else {
2923 Py_XDECREF(obj);
2924 }
2925 }
2926 #endif
2927 #endif
2928
2929 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
2930 if (pchar_descriptor) {
2931 void* vptr = 0;
2932 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
2933 if (cptr) *cptr = (char *) vptr;
2934 if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
2935 if (alloc) *alloc = SWIG_OLDOBJ;
2936 return SWIG_OK;
2937 }
2938 }
2939 }
2940 return SWIG_TypeError;
2941 }
2942
2943
2944
2945
2946
2947 SWIGINTERNINLINE PyObject*
SWIG_From_int(int value)2948 SWIG_From_int (int value)
2949 {
2950 return PyInt_FromLong((long) value);
2951 }
2952
2953 #ifdef __cplusplus
2954 extern "C" {
2955 #endif
_wrap_wcscon(PyObject * SWIGUNUSEDPARM (self),PyObject * args)2956 SWIGINTERN PyObject *_wrap_wcscon(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
2957 PyObject *resultobj = 0;
2958 int arg1 ;
2959 int arg2 ;
2960 double arg3 ;
2961 double arg4 ;
2962 double *arg5 = (double *) 0 ;
2963 double *arg6 = (double *) 0 ;
2964 double arg7 ;
2965 int val1 ;
2966 int ecode1 = 0 ;
2967 int val2 ;
2968 int ecode2 = 0 ;
2969 double val3 ;
2970 int ecode3 = 0 ;
2971 double val4 ;
2972 int ecode4 = 0 ;
2973 double temp5 ;
2974 int res5 = 0 ;
2975 double temp6 ;
2976 int res6 = 0 ;
2977 double val7 ;
2978 int ecode7 = 0 ;
2979 PyObject *swig_obj[7] ;
2980
2981 if (!SWIG_Python_UnpackTuple(args, "wcscon", 7, 7, swig_obj)) SWIG_fail;
2982 ecode1 = SWIG_AsVal_int(swig_obj[0], &val1);
2983 if (!SWIG_IsOK(ecode1)) {
2984 SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "wcscon" "', argument " "1"" of type '" "int""'");
2985 }
2986 arg1 = (int)(val1);
2987 ecode2 = SWIG_AsVal_int(swig_obj[1], &val2);
2988 if (!SWIG_IsOK(ecode2)) {
2989 SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "wcscon" "', argument " "2"" of type '" "int""'");
2990 }
2991 arg2 = (int)(val2);
2992 ecode3 = SWIG_AsVal_double(swig_obj[2], &val3);
2993 if (!SWIG_IsOK(ecode3)) {
2994 SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "wcscon" "', argument " "3"" of type '" "double""'");
2995 }
2996 arg3 = (double)(val3);
2997 ecode4 = SWIG_AsVal_double(swig_obj[3], &val4);
2998 if (!SWIG_IsOK(ecode4)) {
2999 SWIG_exception_fail(SWIG_ArgError(ecode4), "in method '" "wcscon" "', argument " "4"" of type '" "double""'");
3000 }
3001 arg4 = (double)(val4);
3002 if (!(SWIG_IsOK((res5 = SWIG_ConvertPtr(swig_obj[4],SWIG_as_voidptrptr(&arg5),SWIGTYPE_p_double,0))))) {
3003 double val;
3004 int ecode = SWIG_AsVal_double(swig_obj[4], &val);
3005 if (!SWIG_IsOK(ecode)) {
3006 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wcscon" "', argument " "5"" of type '" "double""'");
3007 }
3008 temp5 = (double)(val);
3009 arg5 = &temp5;
3010 res5 = SWIG_AddTmpMask(ecode);
3011 }
3012 if (!(SWIG_IsOK((res6 = SWIG_ConvertPtr(swig_obj[5],SWIG_as_voidptrptr(&arg6),SWIGTYPE_p_double,0))))) {
3013 double val;
3014 int ecode = SWIG_AsVal_double(swig_obj[5], &val);
3015 if (!SWIG_IsOK(ecode)) {
3016 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wcscon" "', argument " "6"" of type '" "double""'");
3017 }
3018 temp6 = (double)(val);
3019 arg6 = &temp6;
3020 res6 = SWIG_AddTmpMask(ecode);
3021 }
3022 ecode7 = SWIG_AsVal_double(swig_obj[6], &val7);
3023 if (!SWIG_IsOK(ecode7)) {
3024 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wcscon" "', argument " "7"" of type '" "double""'");
3025 }
3026 arg7 = (double)(val7);
3027 wcscon(arg1,arg2,arg3,arg4,arg5,arg6,arg7);
3028 resultobj = SWIG_Py_Void();
3029 if (SWIG_IsTmpObj(res5)) {
3030 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_double((*arg5)));
3031 } else {
3032 int new_flags = SWIG_IsNewObj(res5) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3033 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg5), SWIGTYPE_p_double, new_flags));
3034 }
3035 if (SWIG_IsTmpObj(res6)) {
3036 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_double((*arg6)));
3037 } else {
3038 int new_flags = SWIG_IsNewObj(res6) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3039 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg6), SWIGTYPE_p_double, new_flags));
3040 }
3041 return resultobj;
3042 fail:
3043 return NULL;
3044 }
3045
3046
_wrap_wcscsys(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3047 SWIGINTERN PyObject *_wrap_wcscsys(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3048 PyObject *resultobj = 0;
3049 char *arg1 = (char *) 0 ;
3050 int res1 ;
3051 char *buf1 = 0 ;
3052 int alloc1 = 0 ;
3053 PyObject *swig_obj[1] ;
3054 int result;
3055
3056 if (!args) SWIG_fail;
3057 swig_obj[0] = args;
3058 res1 = SWIG_AsCharPtrAndSize(swig_obj[0], &buf1, NULL, &alloc1);
3059 if (!SWIG_IsOK(res1)) {
3060 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "wcscsys" "', argument " "1"" of type '" "char *""'");
3061 }
3062 arg1 = (char *)(buf1);
3063 result = (int)wcscsys(arg1);
3064 resultobj = SWIG_From_int((int)(result));
3065 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3066 return resultobj;
3067 fail:
3068 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3069 return NULL;
3070 }
3071
3072
3073 static PyMethodDef SwigMethods[] = {
3074 { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
3075 { "wcscon", _wrap_wcscon, METH_VARARGS, "wcscon(sys1, sys2, eq1, eq2, arg5, arg6, epoch)"},
3076 { "wcscsys", _wrap_wcscsys, METH_O, "wcscsys(wcstring) -> int"},
3077 { NULL, NULL, 0, NULL }
3078 };
3079
3080 static PyMethodDef SwigMethods_proxydocs[] = {
3081 { NULL, NULL, 0, NULL }
3082 };
3083
3084
3085 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
3086
3087 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
3088 static swig_type_info _swigt__p_double = {"_p_double", "double *", 0, 0, (void*)0, 0};
3089
3090 static swig_type_info *swig_type_initial[] = {
3091 &_swigt__p_char,
3092 &_swigt__p_double,
3093 };
3094
3095 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
3096 static swig_cast_info _swigc__p_double[] = { {&_swigt__p_double, 0, 0, 0},{0, 0, 0, 0}};
3097
3098 static swig_cast_info *swig_cast_initial[] = {
3099 _swigc__p_char,
3100 _swigc__p_double,
3101 };
3102
3103
3104 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
3105
3106 static swig_const_info swig_const_table[] = {
3107 {0, 0, 0, 0.0, 0, 0}};
3108
3109 #ifdef __cplusplus
3110 }
3111 #endif
3112 /* -----------------------------------------------------------------------------
3113 * Type initialization:
3114 * This problem is tough by the requirement that no dynamic
3115 * memory is used. Also, since swig_type_info structures store pointers to
3116 * swig_cast_info structures and swig_cast_info structures store pointers back
3117 * to swig_type_info structures, we need some lookup code at initialization.
3118 * The idea is that swig generates all the structures that are needed.
3119 * The runtime then collects these partially filled structures.
3120 * The SWIG_InitializeModule function takes these initial arrays out of
3121 * swig_module, and does all the lookup, filling in the swig_module.types
3122 * array with the correct data and linking the correct swig_cast_info
3123 * structures together.
3124 *
3125 * The generated swig_type_info structures are assigned statically to an initial
3126 * array. We just loop through that array, and handle each type individually.
3127 * First we lookup if this type has been already loaded, and if so, use the
3128 * loaded structure instead of the generated one. Then we have to fill in the
3129 * cast linked list. The cast data is initially stored in something like a
3130 * two-dimensional array. Each row corresponds to a type (there are the same
3131 * number of rows as there are in the swig_type_initial array). Each entry in
3132 * a column is one of the swig_cast_info structures for that type.
3133 * The cast_initial array is actually an array of arrays, because each row has
3134 * a variable number of columns. So to actually build the cast linked list,
3135 * we find the array of casts associated with the type, and loop through it
3136 * adding the casts to the list. The one last trick we need to do is making
3137 * sure the type pointer in the swig_cast_info struct is correct.
3138 *
3139 * First off, we lookup the cast->type name to see if it is already loaded.
3140 * There are three cases to handle:
3141 * 1) If the cast->type has already been loaded AND the type we are adding
3142 * casting info to has not been loaded (it is in this module), THEN we
3143 * replace the cast->type pointer with the type pointer that has already
3144 * been loaded.
3145 * 2) If BOTH types (the one we are adding casting info to, and the
3146 * cast->type) are loaded, THEN the cast info has already been loaded by
3147 * the previous module so we just ignore it.
3148 * 3) Finally, if cast->type has not already been loaded, then we add that
3149 * swig_cast_info to the linked list (because the cast->type) pointer will
3150 * be correct.
3151 * ----------------------------------------------------------------------------- */
3152
3153 #ifdef __cplusplus
3154 extern "C" {
3155 #if 0
3156 } /* c-mode */
3157 #endif
3158 #endif
3159
3160 #if 0
3161 #define SWIGRUNTIME_DEBUG
3162 #endif
3163
3164
3165 SWIGRUNTIME void
SWIG_InitializeModule(void * clientdata)3166 SWIG_InitializeModule(void *clientdata) {
3167 size_t i;
3168 swig_module_info *module_head, *iter;
3169 int init;
3170
3171 /* check to see if the circular list has been setup, if not, set it up */
3172 if (swig_module.next==0) {
3173 /* Initialize the swig_module */
3174 swig_module.type_initial = swig_type_initial;
3175 swig_module.cast_initial = swig_cast_initial;
3176 swig_module.next = &swig_module;
3177 init = 1;
3178 } else {
3179 init = 0;
3180 }
3181
3182 /* Try and load any already created modules */
3183 module_head = SWIG_GetModule(clientdata);
3184 if (!module_head) {
3185 /* This is the first module loaded for this interpreter */
3186 /* so set the swig module into the interpreter */
3187 SWIG_SetModule(clientdata, &swig_module);
3188 } else {
3189 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
3190 iter=module_head;
3191 do {
3192 if (iter==&swig_module) {
3193 /* Our module is already in the list, so there's nothing more to do. */
3194 return;
3195 }
3196 iter=iter->next;
3197 } while (iter!= module_head);
3198
3199 /* otherwise we must add our module into the list */
3200 swig_module.next = module_head->next;
3201 module_head->next = &swig_module;
3202 }
3203
3204 /* When multiple interpreters are used, a module could have already been initialized in
3205 a different interpreter, but not yet have a pointer in this interpreter.
3206 In this case, we do not want to continue adding types... everything should be
3207 set up already */
3208 if (init == 0) return;
3209
3210 /* Now work on filling in swig_module.types */
3211 #ifdef SWIGRUNTIME_DEBUG
3212 printf("SWIG_InitializeModule: size %lu\n", (unsigned long)swig_module.size);
3213 #endif
3214 for (i = 0; i < swig_module.size; ++i) {
3215 swig_type_info *type = 0;
3216 swig_type_info *ret;
3217 swig_cast_info *cast;
3218
3219 #ifdef SWIGRUNTIME_DEBUG
3220 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3221 #endif
3222
3223 /* if there is another module already loaded */
3224 if (swig_module.next != &swig_module) {
3225 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
3226 }
3227 if (type) {
3228 /* Overwrite clientdata field */
3229 #ifdef SWIGRUNTIME_DEBUG
3230 printf("SWIG_InitializeModule: found type %s\n", type->name);
3231 #endif
3232 if (swig_module.type_initial[i]->clientdata) {
3233 type->clientdata = swig_module.type_initial[i]->clientdata;
3234 #ifdef SWIGRUNTIME_DEBUG
3235 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
3236 #endif
3237 }
3238 } else {
3239 type = swig_module.type_initial[i];
3240 }
3241
3242 /* Insert casting types */
3243 cast = swig_module.cast_initial[i];
3244 while (cast->type) {
3245 /* Don't need to add information already in the list */
3246 ret = 0;
3247 #ifdef SWIGRUNTIME_DEBUG
3248 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
3249 #endif
3250 if (swig_module.next != &swig_module) {
3251 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
3252 #ifdef SWIGRUNTIME_DEBUG
3253 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
3254 #endif
3255 }
3256 if (ret) {
3257 if (type == swig_module.type_initial[i]) {
3258 #ifdef SWIGRUNTIME_DEBUG
3259 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
3260 #endif
3261 cast->type = ret;
3262 ret = 0;
3263 } else {
3264 /* Check for casting already in the list */
3265 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
3266 #ifdef SWIGRUNTIME_DEBUG
3267 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
3268 #endif
3269 if (!ocast) ret = 0;
3270 }
3271 }
3272
3273 if (!ret) {
3274 #ifdef SWIGRUNTIME_DEBUG
3275 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
3276 #endif
3277 if (type->cast) {
3278 type->cast->prev = cast;
3279 cast->next = type->cast;
3280 }
3281 type->cast = cast;
3282 }
3283 cast++;
3284 }
3285 /* Set entry in modules->types array equal to the type */
3286 swig_module.types[i] = type;
3287 }
3288 swig_module.types[i] = 0;
3289
3290 #ifdef SWIGRUNTIME_DEBUG
3291 printf("**** SWIG_InitializeModule: Cast List ******\n");
3292 for (i = 0; i < swig_module.size; ++i) {
3293 int j = 0;
3294 swig_cast_info *cast = swig_module.cast_initial[i];
3295 printf("SWIG_InitializeModule: type %lu %s\n", (unsigned long)i, swig_module.type_initial[i]->name);
3296 while (cast->type) {
3297 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
3298 cast++;
3299 ++j;
3300 }
3301 printf("---- Total casts: %d\n",j);
3302 }
3303 printf("**** SWIG_InitializeModule: Cast List ******\n");
3304 #endif
3305 }
3306
3307 /* This function will propagate the clientdata field of type to
3308 * any new swig_type_info structures that have been added into the list
3309 * of equivalent types. It is like calling
3310 * SWIG_TypeClientData(type, clientdata) a second time.
3311 */
3312 SWIGRUNTIME void
SWIG_PropagateClientData(void)3313 SWIG_PropagateClientData(void) {
3314 size_t i;
3315 swig_cast_info *equiv;
3316 static int init_run = 0;
3317
3318 if (init_run) return;
3319 init_run = 1;
3320
3321 for (i = 0; i < swig_module.size; i++) {
3322 if (swig_module.types[i]->clientdata) {
3323 equiv = swig_module.types[i]->cast;
3324 while (equiv) {
3325 if (!equiv->converter) {
3326 if (equiv->type && !equiv->type->clientdata)
3327 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
3328 }
3329 equiv = equiv->next;
3330 }
3331 }
3332 }
3333 }
3334
3335 #ifdef __cplusplus
3336 #if 0
3337 {
3338 /* c-mode */
3339 #endif
3340 }
3341 #endif
3342
3343
3344
3345 #ifdef __cplusplus
3346 extern "C" {
3347 #endif
3348
3349 /* Python-specific SWIG API */
3350 #define SWIG_newvarlink() SWIG_Python_newvarlink()
3351 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
3352 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
3353
3354 /* -----------------------------------------------------------------------------
3355 * global variable support code.
3356 * ----------------------------------------------------------------------------- */
3357
3358 typedef struct swig_globalvar {
3359 char *name; /* Name of global variable */
3360 PyObject *(*get_attr)(void); /* Return the current value */
3361 int (*set_attr)(PyObject *); /* Set the value */
3362 struct swig_globalvar *next;
3363 } swig_globalvar;
3364
3365 typedef struct swig_varlinkobject {
3366 PyObject_HEAD
3367 swig_globalvar *vars;
3368 } swig_varlinkobject;
3369
3370 SWIGINTERN PyObject *
swig_varlink_repr(swig_varlinkobject * SWIGUNUSEDPARM (v))3371 swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
3372 #if PY_VERSION_HEX >= 0x03000000
3373 return PyUnicode_InternFromString("<Swig global variables>");
3374 #else
3375 return PyString_FromString("<Swig global variables>");
3376 #endif
3377 }
3378
3379 SWIGINTERN PyObject *
swig_varlink_str(swig_varlinkobject * v)3380 swig_varlink_str(swig_varlinkobject *v) {
3381 #if PY_VERSION_HEX >= 0x03000000
3382 PyObject *str = PyUnicode_InternFromString("(");
3383 PyObject *tail;
3384 PyObject *joined;
3385 swig_globalvar *var;
3386 for (var = v->vars; var; var=var->next) {
3387 tail = PyUnicode_FromString(var->name);
3388 joined = PyUnicode_Concat(str, tail);
3389 Py_DecRef(str);
3390 Py_DecRef(tail);
3391 str = joined;
3392 if (var->next) {
3393 tail = PyUnicode_InternFromString(", ");
3394 joined = PyUnicode_Concat(str, tail);
3395 Py_DecRef(str);
3396 Py_DecRef(tail);
3397 str = joined;
3398 }
3399 }
3400 tail = PyUnicode_InternFromString(")");
3401 joined = PyUnicode_Concat(str, tail);
3402 Py_DecRef(str);
3403 Py_DecRef(tail);
3404 str = joined;
3405 #else
3406 PyObject *str = PyString_FromString("(");
3407 swig_globalvar *var;
3408 for (var = v->vars; var; var=var->next) {
3409 PyString_ConcatAndDel(&str,PyString_FromString(var->name));
3410 if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
3411 }
3412 PyString_ConcatAndDel(&str,PyString_FromString(")"));
3413 #endif
3414 return str;
3415 }
3416
3417 SWIGINTERN void
swig_varlink_dealloc(swig_varlinkobject * v)3418 swig_varlink_dealloc(swig_varlinkobject *v) {
3419 swig_globalvar *var = v->vars;
3420 while (var) {
3421 swig_globalvar *n = var->next;
3422 free(var->name);
3423 free(var);
3424 var = n;
3425 }
3426 }
3427
3428 SWIGINTERN PyObject *
swig_varlink_getattr(swig_varlinkobject * v,char * n)3429 swig_varlink_getattr(swig_varlinkobject *v, char *n) {
3430 PyObject *res = NULL;
3431 swig_globalvar *var = v->vars;
3432 while (var) {
3433 if (strcmp(var->name,n) == 0) {
3434 res = (*var->get_attr)();
3435 break;
3436 }
3437 var = var->next;
3438 }
3439 if (res == NULL && !PyErr_Occurred()) {
3440 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
3441 }
3442 return res;
3443 }
3444
3445 SWIGINTERN int
swig_varlink_setattr(swig_varlinkobject * v,char * n,PyObject * p)3446 swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
3447 int res = 1;
3448 swig_globalvar *var = v->vars;
3449 while (var) {
3450 if (strcmp(var->name,n) == 0) {
3451 res = (*var->set_attr)(p);
3452 break;
3453 }
3454 var = var->next;
3455 }
3456 if (res == 1 && !PyErr_Occurred()) {
3457 PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
3458 }
3459 return res;
3460 }
3461
3462 SWIGINTERN PyTypeObject*
swig_varlink_type(void)3463 swig_varlink_type(void) {
3464 static char varlink__doc__[] = "Swig var link object";
3465 static PyTypeObject varlink_type;
3466 static int type_init = 0;
3467 if (!type_init) {
3468 const PyTypeObject tmp = {
3469 #if PY_VERSION_HEX >= 0x03000000
3470 PyVarObject_HEAD_INIT(NULL, 0)
3471 #else
3472 PyObject_HEAD_INIT(NULL)
3473 0, /* ob_size */
3474 #endif
3475 "swigvarlink", /* tp_name */
3476 sizeof(swig_varlinkobject), /* tp_basicsize */
3477 0, /* tp_itemsize */
3478 (destructor) swig_varlink_dealloc, /* tp_dealloc */
3479 0, /* tp_print */
3480 (getattrfunc) swig_varlink_getattr, /* tp_getattr */
3481 (setattrfunc) swig_varlink_setattr, /* tp_setattr */
3482 0, /* tp_compare */
3483 (reprfunc) swig_varlink_repr, /* tp_repr */
3484 0, /* tp_as_number */
3485 0, /* tp_as_sequence */
3486 0, /* tp_as_mapping */
3487 0, /* tp_hash */
3488 0, /* tp_call */
3489 (reprfunc) swig_varlink_str, /* tp_str */
3490 0, /* tp_getattro */
3491 0, /* tp_setattro */
3492 0, /* tp_as_buffer */
3493 0, /* tp_flags */
3494 varlink__doc__, /* tp_doc */
3495 0, /* tp_traverse */
3496 0, /* tp_clear */
3497 0, /* tp_richcompare */
3498 0, /* tp_weaklistoffset */
3499 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
3500 0, /* tp_del */
3501 0, /* tp_version_tag */
3502 #if PY_VERSION_HEX >= 0x03040000
3503 0, /* tp_finalize */
3504 #endif
3505 #ifdef COUNT_ALLOCS
3506 0, /* tp_allocs */
3507 0, /* tp_frees */
3508 0, /* tp_maxalloc */
3509 0, /* tp_prev */
3510 0 /* tp_next */
3511 #endif
3512 };
3513 varlink_type = tmp;
3514 type_init = 1;
3515 if (PyType_Ready(&varlink_type) < 0)
3516 return NULL;
3517 }
3518 return &varlink_type;
3519 }
3520
3521 /* Create a variable linking object for use later */
3522 SWIGINTERN PyObject *
SWIG_Python_newvarlink(void)3523 SWIG_Python_newvarlink(void) {
3524 swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
3525 if (result) {
3526 result->vars = 0;
3527 }
3528 return ((PyObject*) result);
3529 }
3530
3531 SWIGINTERN void
SWIG_Python_addvarlink(PyObject * p,const char * name,PyObject * (* get_attr)(void),int (* set_attr)(PyObject * p))3532 SWIG_Python_addvarlink(PyObject *p, const char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
3533 swig_varlinkobject *v = (swig_varlinkobject *) p;
3534 swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
3535 if (gv) {
3536 size_t size = strlen(name)+1;
3537 gv->name = (char *)malloc(size);
3538 if (gv->name) {
3539 memcpy(gv->name, name, size);
3540 gv->get_attr = get_attr;
3541 gv->set_attr = set_attr;
3542 gv->next = v->vars;
3543 }
3544 }
3545 v->vars = gv;
3546 }
3547
3548 SWIGINTERN PyObject *
SWIG_globals(void)3549 SWIG_globals(void) {
3550 static PyObject *globals = 0;
3551 if (!globals) {
3552 globals = SWIG_newvarlink();
3553 }
3554 return globals;
3555 }
3556
3557 /* -----------------------------------------------------------------------------
3558 * constants/methods manipulation
3559 * ----------------------------------------------------------------------------- */
3560
3561 /* Install Constants */
3562 SWIGINTERN void
SWIG_Python_InstallConstants(PyObject * d,swig_const_info constants[])3563 SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
3564 PyObject *obj = 0;
3565 size_t i;
3566 for (i = 0; constants[i].type; ++i) {
3567 switch(constants[i].type) {
3568 case SWIG_PY_POINTER:
3569 obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
3570 break;
3571 case SWIG_PY_BINARY:
3572 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
3573 break;
3574 default:
3575 obj = 0;
3576 break;
3577 }
3578 if (obj) {
3579 PyDict_SetItemString(d, constants[i].name, obj);
3580 Py_DECREF(obj);
3581 }
3582 }
3583 }
3584
3585 /* -----------------------------------------------------------------------------*/
3586 /* Fix SwigMethods to carry the callback ptrs when needed */
3587 /* -----------------------------------------------------------------------------*/
3588
3589 SWIGINTERN void
SWIG_Python_FixMethods(PyMethodDef * methods,swig_const_info * const_table,swig_type_info ** types,swig_type_info ** types_initial)3590 SWIG_Python_FixMethods(PyMethodDef *methods,
3591 swig_const_info *const_table,
3592 swig_type_info **types,
3593 swig_type_info **types_initial) {
3594 size_t i;
3595 for (i = 0; methods[i].ml_name; ++i) {
3596 const char *c = methods[i].ml_doc;
3597 if (!c) continue;
3598 c = strstr(c, "swig_ptr: ");
3599 if (c) {
3600 int j;
3601 swig_const_info *ci = 0;
3602 const char *name = c + 10;
3603 for (j = 0; const_table[j].type; ++j) {
3604 if (strncmp(const_table[j].name, name,
3605 strlen(const_table[j].name)) == 0) {
3606 ci = &(const_table[j]);
3607 break;
3608 }
3609 }
3610 if (ci) {
3611 void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
3612 if (ptr) {
3613 size_t shift = (ci->ptype) - types;
3614 swig_type_info *ty = types_initial[shift];
3615 size_t ldoc = (c - methods[i].ml_doc);
3616 size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
3617 char *ndoc = (char*)malloc(ldoc + lptr + 10);
3618 if (ndoc) {
3619 char *buff = ndoc;
3620 memcpy(buff, methods[i].ml_doc, ldoc);
3621 buff += ldoc;
3622 memcpy(buff, "swig_ptr: ", 10);
3623 buff += 10;
3624 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
3625 methods[i].ml_doc = ndoc;
3626 }
3627 }
3628 }
3629 }
3630 }
3631 }
3632
3633 /* -----------------------------------------------------------------------------
3634 * Method creation and docstring support functions
3635 * ----------------------------------------------------------------------------- */
3636
3637 /* -----------------------------------------------------------------------------
3638 * Function to find the method definition with the correct docstring for the
3639 * proxy module as opposed to the low-level API
3640 * ----------------------------------------------------------------------------- */
3641
SWIG_PythonGetProxyDoc(const char * name)3642 SWIGINTERN PyMethodDef *SWIG_PythonGetProxyDoc(const char *name) {
3643 /* Find the function in the modified method table */
3644 size_t offset = 0;
3645 int found = 0;
3646 while (SwigMethods_proxydocs[offset].ml_meth != NULL) {
3647 if (strcmp(SwigMethods_proxydocs[offset].ml_name, name) == 0) {
3648 found = 1;
3649 break;
3650 }
3651 offset++;
3652 }
3653 /* Use the copy with the modified docstring if available */
3654 return found ? &SwigMethods_proxydocs[offset] : NULL;
3655 }
3656
3657 /* -----------------------------------------------------------------------------
3658 * Wrapper of PyInstanceMethod_New() used in Python 3
3659 * It is exported to the generated module, used for -fastproxy
3660 * ----------------------------------------------------------------------------- */
3661
SWIG_PyInstanceMethod_New(PyObject * SWIGUNUSEDPARM (self),PyObject * func)3662 SWIGINTERN PyObject *SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
3663 if (PyCFunction_Check(func)) {
3664 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
3665 PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
3666 if (ml)
3667 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
3668 }
3669 #if PY_VERSION_HEX >= 0x03000000
3670 return PyInstanceMethod_New(func);
3671 #else
3672 return PyMethod_New(func, NULL, NULL);
3673 #endif
3674 }
3675
3676 /* -----------------------------------------------------------------------------
3677 * Wrapper of PyStaticMethod_New()
3678 * It is exported to the generated module, used for -fastproxy
3679 * ----------------------------------------------------------------------------- */
3680
SWIG_PyStaticMethod_New(PyObject * SWIGUNUSEDPARM (self),PyObject * func)3681 SWIGINTERN PyObject *SWIG_PyStaticMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func) {
3682 if (PyCFunction_Check(func)) {
3683 PyCFunctionObject *funcobj = (PyCFunctionObject *)func;
3684 PyMethodDef *ml = SWIG_PythonGetProxyDoc(funcobj->m_ml->ml_name);
3685 if (ml)
3686 func = PyCFunction_NewEx(ml, funcobj->m_self, funcobj->m_module);
3687 }
3688 return PyStaticMethod_New(func);
3689 }
3690
3691 #ifdef __cplusplus
3692 }
3693 #endif
3694
3695 /* -----------------------------------------------------------------------------*
3696 * Partial Init method
3697 * -----------------------------------------------------------------------------*/
3698
3699 #ifdef __cplusplus
3700 extern "C"
3701 #endif
3702
3703 SWIGEXPORT
3704 #if PY_VERSION_HEX >= 0x03000000
3705 PyObject*
3706 #else
3707 void
3708 #endif
SWIG_init(void)3709 SWIG_init(void) {
3710 PyObject *m, *d, *md, *globals;
3711
3712 #if PY_VERSION_HEX >= 0x03000000
3713 static struct PyModuleDef SWIG_module = {
3714 PyModuleDef_HEAD_INIT,
3715 SWIG_name,
3716 NULL,
3717 -1,
3718 SwigMethods,
3719 NULL,
3720 NULL,
3721 NULL,
3722 NULL
3723 };
3724 #endif
3725
3726 #if defined(SWIGPYTHON_BUILTIN)
3727 static SwigPyClientData SwigPyObject_clientdata = {
3728 0, 0, 0, 0, 0, 0, 0
3729 };
3730 static PyGetSetDef this_getset_def = {
3731 (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
3732 };
3733 static SwigPyGetSet thisown_getset_closure = {
3734 SwigPyObject_own,
3735 SwigPyObject_own
3736 };
3737 static PyGetSetDef thisown_getset_def = {
3738 (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
3739 };
3740 PyTypeObject *builtin_pytype;
3741 int builtin_base_count;
3742 swig_type_info *builtin_basetype;
3743 PyObject *tuple;
3744 PyGetSetDescrObject *static_getset;
3745 PyTypeObject *metatype;
3746 PyTypeObject *swigpyobject;
3747 SwigPyClientData *cd;
3748 PyObject *public_interface, *public_symbol;
3749 PyObject *this_descr;
3750 PyObject *thisown_descr;
3751 PyObject *self = 0;
3752 int i;
3753
3754 (void)builtin_pytype;
3755 (void)builtin_base_count;
3756 (void)builtin_basetype;
3757 (void)tuple;
3758 (void)static_getset;
3759 (void)self;
3760
3761 /* Metaclass is used to implement static member variables */
3762 metatype = SwigPyObjectType();
3763 assert(metatype);
3764 #endif
3765
3766 (void)globals;
3767
3768 /* Create singletons now to avoid potential deadlocks with multi-threaded usage after module initialization */
3769 SWIG_This();
3770 SWIG_Python_TypeCache();
3771 SwigPyPacked_type();
3772 #ifndef SWIGPYTHON_BUILTIN
3773 SwigPyObject_type();
3774 #endif
3775
3776 /* Fix SwigMethods to carry the callback ptrs when needed */
3777 SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
3778
3779 #if PY_VERSION_HEX >= 0x03000000
3780 m = PyModule_Create(&SWIG_module);
3781 #else
3782 m = Py_InitModule(SWIG_name, SwigMethods);
3783 #endif
3784
3785 md = d = PyModule_GetDict(m);
3786 (void)md;
3787
3788 SWIG_InitializeModule(0);
3789
3790 #ifdef SWIGPYTHON_BUILTIN
3791 swigpyobject = SwigPyObject_TypeOnce();
3792
3793 SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
3794 assert(SwigPyObject_stype);
3795 cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
3796 if (!cd) {
3797 SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
3798 SwigPyObject_clientdata.pytype = swigpyobject;
3799 } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
3800 PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
3801 # if PY_VERSION_HEX >= 0x03000000
3802 return NULL;
3803 # else
3804 return;
3805 # endif
3806 }
3807
3808 /* All objects have a 'this' attribute */
3809 this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
3810 (void)this_descr;
3811
3812 /* All objects have a 'thisown' attribute */
3813 thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
3814 (void)thisown_descr;
3815
3816 public_interface = PyList_New(0);
3817 public_symbol = 0;
3818 (void)public_symbol;
3819
3820 PyDict_SetItemString(md, "__all__", public_interface);
3821 Py_DECREF(public_interface);
3822 for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
3823 SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
3824 for (i = 0; swig_const_table[i].name != 0; ++i)
3825 SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
3826 #endif
3827
3828 SWIG_InstallConstants(d,swig_const_table);
3829
3830 #if PY_VERSION_HEX >= 0x03000000
3831 return m;
3832 #else
3833 return;
3834 #endif
3835 }
3836
3837