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