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