1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 3.0.12
4  *
5  * This file is not intended to be easily readable and contains a number of
6  * coding conventions designed to improve portability and efficiency. Do not make
7  * changes to this file unless you know what you are doing--modify the SWIG
8  * interface file instead.
9  * ----------------------------------------------------------------------------- */
10 
11 #define SWIG_PYTHON_STRICT_BYTE_CHAR
12 
13 
14 
15 #ifndef SWIGPYTHON
16 #define SWIGPYTHON
17 #endif
18 
19 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
20 
21 /* -----------------------------------------------------------------------------
22  *  This section contains generic SWIG labels for method/variable
23  *  declarations/attributes, and other compiler dependent labels.
24  * ----------------------------------------------------------------------------- */
25 
26 /* template workaround for compilers that cannot correctly implement the C++ standard */
27 #ifndef SWIGTEMPLATEDISAMBIGUATOR
28 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
29 #  define SWIGTEMPLATEDISAMBIGUATOR template
30 # elif defined(__HP_aCC)
31 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
32 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
33 #  define SWIGTEMPLATEDISAMBIGUATOR template
34 # else
35 #  define SWIGTEMPLATEDISAMBIGUATOR
36 # endif
37 #endif
38 
39 /* inline attribute */
40 #ifndef SWIGINLINE
41 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
42 #   define SWIGINLINE inline
43 # else
44 #   define SWIGINLINE
45 # endif
46 #endif
47 
48 /* attribute recognised by some compilers to avoid 'unused' warnings */
49 #ifndef SWIGUNUSED
50 # if defined(__GNUC__)
51 #   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
52 #     define SWIGUNUSED __attribute__ ((__unused__))
53 #   else
54 #     define SWIGUNUSED
55 #   endif
56 # elif defined(__ICC)
57 #   define SWIGUNUSED __attribute__ ((__unused__))
58 # else
59 #   define SWIGUNUSED
60 # endif
61 #endif
62 
63 #ifndef SWIG_MSC_UNSUPPRESS_4505
64 # if defined(_MSC_VER)
65 #   pragma warning(disable : 4505) /* unreferenced local function has been removed */
66 # endif
67 #endif
68 
69 #ifndef SWIGUNUSEDPARM
70 # ifdef __cplusplus
71 #   define SWIGUNUSEDPARM(p)
72 # else
73 #   define SWIGUNUSEDPARM(p) p SWIGUNUSED
74 # endif
75 #endif
76 
77 /* internal SWIG method */
78 #ifndef SWIGINTERN
79 # define SWIGINTERN static SWIGUNUSED
80 #endif
81 
82 /* internal inline SWIG method */
83 #ifndef SWIGINTERNINLINE
84 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
85 #endif
86 
87 /* exporting methods */
88 #if defined(__GNUC__)
89 #  if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
90 #    ifndef GCC_HASCLASSVISIBILITY
91 #      define GCC_HASCLASSVISIBILITY
92 #    endif
93 #  endif
94 #endif
95 
96 #ifndef SWIGEXPORT
97 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
98 #   if defined(STATIC_LINKED)
99 #     define SWIGEXPORT
100 #   else
101 #     define SWIGEXPORT __declspec(dllexport)
102 #   endif
103 # else
104 #   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
105 #     define SWIGEXPORT __attribute__ ((visibility("default")))
106 #   else
107 #     define SWIGEXPORT
108 #   endif
109 # endif
110 #endif
111 
112 /* calling conventions for Windows */
113 #ifndef SWIGSTDCALL
114 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
115 #   define SWIGSTDCALL __stdcall
116 # else
117 #   define SWIGSTDCALL
118 # endif
119 #endif
120 
121 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
122 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
123 # define _CRT_SECURE_NO_DEPRECATE
124 #endif
125 
126 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
127 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
128 # define _SCL_SECURE_NO_DEPRECATE
129 #endif
130 
131 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
132 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
133 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
134 #endif
135 
136 /* Intel's compiler complains if a variable which was never initialised is
137  * cast to void, which is a common idiom which we use to indicate that we
138  * are aware a variable isn't used.  So we just silence that warning.
139  * See: https://github.com/swig/swig/issues/192 for more discussion.
140  */
141 #ifdef __INTEL_COMPILER
142 # pragma warning disable 592
143 #endif
144 
145 
146 #if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
147 /* Use debug wrappers with the Python release dll */
148 # undef _DEBUG
149 # include <Python.h>
150 # define _DEBUG
151 #else
152 # include <Python.h>
153 #endif
154 
155 /* -----------------------------------------------------------------------------
156  * swigrun.swg
157  *
158  * This file contains generic C API SWIG runtime support for pointer
159  * type checking.
160  * ----------------------------------------------------------------------------- */
161 
162 /* This should only be incremented when either the layout of swig_type_info changes,
163    or for whatever reason, the runtime changes incompatibly */
164 #define SWIG_RUNTIME_VERSION "4"
165 
166 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
167 #ifdef SWIG_TYPE_TABLE
168 # define SWIG_QUOTE_STRING(x) #x
169 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
170 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
171 #else
172 # define SWIG_TYPE_TABLE_NAME
173 #endif
174 
175 /*
176   You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
177   creating a static or dynamic library from the SWIG runtime code.
178   In 99.9% of the cases, SWIG just needs to declare them as 'static'.
179 
180   But only do this if strictly necessary, ie, if you have problems
181   with your compiler or suchlike.
182 */
183 
184 #ifndef SWIGRUNTIME
185 # define SWIGRUNTIME SWIGINTERN
186 #endif
187 
188 #ifndef SWIGRUNTIMEINLINE
189 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
190 #endif
191 
192 /*  Generic buffer size */
193 #ifndef SWIG_BUFFER_SIZE
194 # define SWIG_BUFFER_SIZE 1024
195 #endif
196 
197 /* Flags for pointer conversions */
198 #define SWIG_POINTER_DISOWN        0x1
199 #define SWIG_CAST_NEW_MEMORY       0x2
200 
201 /* Flags for new pointer objects */
202 #define SWIG_POINTER_OWN           0x1
203 
204 
205 /*
206    Flags/methods for returning states.
207 
208    The SWIG conversion methods, as ConvertPtr, return an integer
209    that tells if the conversion was successful or not. And if not,
210    an error code can be returned (see swigerrors.swg for the codes).
211 
212    Use the following macros/flags to set or process the returning
213    states.
214 
215    In old versions of SWIG, code such as the following was usually written:
216 
217      if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
218        // success code
219      } else {
220        //fail code
221      }
222 
223    Now you can be more explicit:
224 
225     int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
226     if (SWIG_IsOK(res)) {
227       // success code
228     } else {
229       // fail code
230     }
231 
232    which is the same really, but now you can also do
233 
234     Type *ptr;
235     int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
236     if (SWIG_IsOK(res)) {
237       // success code
238       if (SWIG_IsNewObj(res) {
239         ...
240         delete *ptr;
241       } else {
242         ...
243       }
244     } else {
245       // fail code
246     }
247 
248    I.e., now SWIG_ConvertPtr can return new objects and you can
249    identify the case and take care of the deallocation. Of course that
250    also requires SWIG_ConvertPtr to return new result values, such as
251 
252       int SWIG_ConvertPtr(obj, ptr,...) {
253         if (<obj is ok>) {
254           if (<need new object>) {
255             *ptr = <ptr to new allocated object>;
256             return SWIG_NEWOBJ;
257           } else {
258             *ptr = <ptr to old object>;
259             return SWIG_OLDOBJ;
260           }
261         } else {
262           return SWIG_BADOBJ;
263         }
264       }
265 
266    Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
267    more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
268    SWIG errors code.
269 
270    Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
271    allows to return the 'cast rank', for example, if you have this
272 
273        int food(double)
274        int fooi(int);
275 
276    and you call
277 
278       food(1)   // cast rank '1'  (1 -> 1.0)
279       fooi(1)   // cast rank '0'
280 
281    just use the SWIG_AddCast()/SWIG_CheckState()
282 */
283 
284 #define SWIG_OK                    (0)
285 #define SWIG_ERROR                 (-1)
286 #define SWIG_IsOK(r)               (r >= 0)
287 #define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)
288 
289 /* The CastRankLimit says how many bits are used for the cast rank */
290 #define SWIG_CASTRANKLIMIT         (1 << 8)
291 /* The NewMask denotes the object was created (using new/malloc) */
292 #define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
293 /* The TmpMask is for in/out typemaps that use temporal objects */
294 #define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
295 /* Simple returning values */
296 #define SWIG_BADOBJ                (SWIG_ERROR)
297 #define SWIG_OLDOBJ                (SWIG_OK)
298 #define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
299 #define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
300 /* Check, add and del mask methods */
301 #define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
302 #define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
303 #define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
304 #define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
305 #define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
306 #define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
307 
308 /* Cast-Rank Mode */
309 #if defined(SWIG_CASTRANK_MODE)
310 #  ifndef SWIG_TypeRank
311 #    define SWIG_TypeRank             unsigned long
312 #  endif
313 #  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
314 #    define SWIG_MAXCASTRANK          (2)
315 #  endif
316 #  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
317 #  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
SWIG_AddCast(int r)318 SWIGINTERNINLINE int SWIG_AddCast(int r) {
319   return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
320 }
SWIG_CheckState(int r)321 SWIGINTERNINLINE int SWIG_CheckState(int r) {
322   return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
323 }
324 #else /* no cast-rank mode */
325 #  define SWIG_AddCast(r) (r)
326 #  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
327 #endif
328 
329 
330 #include <string.h>
331 
332 #ifdef __cplusplus
333 extern "C" {
334 #endif
335 
336 typedef void *(*swig_converter_func)(void *, int *);
337 typedef struct swig_type_info *(*swig_dycast_func)(void **);
338 
339 /* Structure to store information on one type */
340 typedef struct swig_type_info {
341   const char             *name;                 /* mangled name of this type */
342   const char             *str;                  /* human readable name of this type */
343   swig_dycast_func        dcast;                /* dynamic cast function down a hierarchy */
344   struct swig_cast_info  *cast;                 /* linked list of types that can cast into this type */
345   void                   *clientdata;           /* language specific type data */
346   int                    owndata;               /* flag if the structure owns the clientdata */
347 } swig_type_info;
348 
349 /* Structure to store a type and conversion function used for casting */
350 typedef struct swig_cast_info {
351   swig_type_info         *type;                 /* pointer to type that is equivalent to this type */
352   swig_converter_func     converter;            /* function to cast the void pointers */
353   struct swig_cast_info  *next;                 /* pointer to next cast in linked list */
354   struct swig_cast_info  *prev;                 /* pointer to the previous cast */
355 } swig_cast_info;
356 
357 /* Structure used to store module information
358  * Each module generates one structure like this, and the runtime collects
359  * all of these structures and stores them in a circularly linked list.*/
360 typedef struct swig_module_info {
361   swig_type_info         **types;               /* Array of pointers to swig_type_info structures that are in this module */
362   size_t                 size;                  /* Number of types in this module */
363   struct swig_module_info *next;                /* Pointer to next element in circularly linked list */
364   swig_type_info         **type_initial;        /* Array of initially generated type structures */
365   swig_cast_info         **cast_initial;        /* Array of initially generated casting structures */
366   void                    *clientdata;          /* Language specific module data */
367 } swig_module_info;
368 
369 /*
370   Compare two type names skipping the space characters, therefore
371   "char*" == "char *" and "Class<int>" == "Class<int >", etc.
372 
373   Return 0 when the two name types are equivalent, as in
374   strncmp, but skipping ' '.
375 */
376 SWIGRUNTIME int
SWIG_TypeNameComp(const char * f1,const char * l1,const char * f2,const char * l2)377 SWIG_TypeNameComp(const char *f1, const char *l1,
378                   const char *f2, const char *l2) {
379   for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
380     while ((*f1 == ' ') && (f1 != l1)) ++f1;
381     while ((*f2 == ' ') && (f2 != l2)) ++f2;
382     if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
383   }
384   return (int)((l1 - f1) - (l2 - f2));
385 }
386 
387 /*
388   Check type equivalence in a name list like <name1>|<name2>|...
389   Return 0 if equal, -1 if nb < tb, 1 if nb > tb
390 */
391 SWIGRUNTIME int
SWIG_TypeCmp(const char * nb,const char * tb)392 SWIG_TypeCmp(const char *nb, const char *tb) {
393   int equiv = 1;
394   const char* te = tb + strlen(tb);
395   const char* ne = nb;
396   while (equiv != 0 && *ne) {
397     for (nb = ne; *ne; ++ne) {
398       if (*ne == '|') break;
399     }
400     equiv = SWIG_TypeNameComp(nb, ne, tb, te);
401     if (*ne) ++ne;
402   }
403   return equiv;
404 }
405 
406 /*
407   Check type equivalence in a name list like <name1>|<name2>|...
408   Return 0 if not equal, 1 if equal
409 */
410 SWIGRUNTIME int
SWIG_TypeEquiv(const char * nb,const char * tb)411 SWIG_TypeEquiv(const char *nb, const char *tb) {
412   return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
413 }
414 
415 /*
416   Check the typename
417 */
418 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char * c,swig_type_info * ty)419 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
420   if (ty) {
421     swig_cast_info *iter = ty->cast;
422     while (iter) {
423       if (strcmp(iter->type->name, c) == 0) {
424         if (iter == ty->cast)
425           return iter;
426         /* Move iter to the top of the linked list */
427         iter->prev->next = iter->next;
428         if (iter->next)
429           iter->next->prev = iter->prev;
430         iter->next = ty->cast;
431         iter->prev = 0;
432         if (ty->cast) ty->cast->prev = iter;
433         ty->cast = iter;
434         return iter;
435       }
436       iter = iter->next;
437     }
438   }
439   return 0;
440 }
441 
442 /*
443   Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
444 */
445 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info * from,swig_type_info * ty)446 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
447   if (ty) {
448     swig_cast_info *iter = ty->cast;
449     while (iter) {
450       if (iter->type == from) {
451         if (iter == ty->cast)
452           return iter;
453         /* Move iter to the top of the linked list */
454         iter->prev->next = iter->next;
455         if (iter->next)
456           iter->next->prev = iter->prev;
457         iter->next = ty->cast;
458         iter->prev = 0;
459         if (ty->cast) ty->cast->prev = iter;
460         ty->cast = iter;
461         return iter;
462       }
463       iter = iter->next;
464     }
465   }
466   return 0;
467 }
468 
469 /*
470   Cast a pointer up an inheritance hierarchy
471 */
472 SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info * ty,void * ptr,int * newmemory)473 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
474   return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
475 }
476 
477 /*
478    Dynamic pointer casting. Down an inheritance hierarchy
479 */
480 SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info * ty,void ** ptr)481 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
482   swig_type_info *lastty = ty;
483   if (!ty || !ty->dcast) return ty;
484   while (ty && (ty->dcast)) {
485     ty = (*ty->dcast)(ptr);
486     if (ty) lastty = ty;
487   }
488   return lastty;
489 }
490 
491 /*
492   Return the name associated with this type
493 */
494 SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info * ty)495 SWIG_TypeName(const swig_type_info *ty) {
496   return ty->name;
497 }
498 
499 /*
500   Return the pretty name associated with this type,
501   that is an unmangled type name in a form presentable to the user.
502 */
503 SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info * type)504 SWIG_TypePrettyName(const swig_type_info *type) {
505   /* The "str" field contains the equivalent pretty names of the
506      type, separated by vertical-bar characters.  We choose
507      to print the last name, as it is often (?) the most
508      specific. */
509   if (!type) return NULL;
510   if (type->str != NULL) {
511     const char *last_name = type->str;
512     const char *s;
513     for (s = type->str; *s; s++)
514       if (*s == '|') last_name = s+1;
515     return last_name;
516   }
517   else
518     return type->name;
519 }
520 
521 /*
522    Set the clientdata field for a type
523 */
524 SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info * ti,void * clientdata)525 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
526   swig_cast_info *cast = ti->cast;
527   /* if (ti->clientdata == clientdata) return; */
528   ti->clientdata = clientdata;
529 
530   while (cast) {
531     if (!cast->converter) {
532       swig_type_info *tc = cast->type;
533       if (!tc->clientdata) {
534         SWIG_TypeClientData(tc, clientdata);
535       }
536     }
537     cast = cast->next;
538   }
539 }
540 SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info * ti,void * clientdata)541 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
542   SWIG_TypeClientData(ti, clientdata);
543   ti->owndata = 1;
544 }
545 
546 /*
547   Search for a swig_type_info structure only by mangled name
548   Search is a O(log #types)
549 
550   We start searching at module start, and finish searching when start == end.
551   Note: if start == end at the beginning of the function, we go all the way around
552   the circular list.
553 */
554 SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)555 SWIG_MangledTypeQueryModule(swig_module_info *start,
556                             swig_module_info *end,
557                             const char *name) {
558   swig_module_info *iter = start;
559   do {
560     if (iter->size) {
561       size_t l = 0;
562       size_t r = iter->size - 1;
563       do {
564         /* since l+r >= 0, we can (>> 1) instead (/ 2) */
565         size_t i = (l + r) >> 1;
566         const char *iname = iter->types[i]->name;
567         if (iname) {
568           int compare = strcmp(name, iname);
569           if (compare == 0) {
570             return iter->types[i];
571           } else if (compare < 0) {
572             if (i) {
573               r = i - 1;
574             } else {
575               break;
576             }
577           } else if (compare > 0) {
578             l = i + 1;
579           }
580         } else {
581           break; /* should never happen */
582         }
583       } while (l <= r);
584     }
585     iter = iter->next;
586   } while (iter != end);
587   return 0;
588 }
589 
590 /*
591   Search for a swig_type_info structure for either a mangled name or a human readable name.
592   It first searches the mangled names of the types, which is a O(log #types)
593   If a type is not found it then searches the human readable names, which is O(#types).
594 
595   We start searching at module start, and finish searching when start == end.
596   Note: if start == end at the beginning of the function, we go all the way around
597   the circular list.
598 */
599 SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)600 SWIG_TypeQueryModule(swig_module_info *start,
601                      swig_module_info *end,
602                      const char *name) {
603   /* STEP 1: Search the name field using binary search */
604   swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
605   if (ret) {
606     return ret;
607   } else {
608     /* STEP 2: If the type hasn't been found, do a complete search
609        of the str field (the human readable name) */
610     swig_module_info *iter = start;
611     do {
612       size_t i = 0;
613       for (; i < iter->size; ++i) {
614         if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
615           return iter->types[i];
616       }
617       iter = iter->next;
618     } while (iter != end);
619   }
620 
621   /* neither found a match */
622   return 0;
623 }
624 
625 /*
626    Pack binary data into a string
627 */
628 SWIGRUNTIME char *
SWIG_PackData(char * c,void * ptr,size_t sz)629 SWIG_PackData(char *c, void *ptr, size_t sz) {
630   static const char hex[17] = "0123456789abcdef";
631   const unsigned char *u = (unsigned char *) ptr;
632   const unsigned char *eu =  u + sz;
633   for (; u != eu; ++u) {
634     unsigned char uu = *u;
635     *(c++) = hex[(uu & 0xf0) >> 4];
636     *(c++) = hex[uu & 0xf];
637   }
638   return c;
639 }
640 
641 /*
642    Unpack binary data from a string
643 */
644 SWIGRUNTIME const char *
SWIG_UnpackData(const char * c,void * ptr,size_t sz)645 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
646   unsigned char *u = (unsigned char *) ptr;
647   const unsigned char *eu = u + sz;
648   for (; u != eu; ++u) {
649     char d = *(c++);
650     unsigned char uu;
651     if ((d >= '0') && (d <= '9'))
652       uu = (unsigned char)((d - '0') << 4);
653     else if ((d >= 'a') && (d <= 'f'))
654       uu = (unsigned char)((d - ('a'-10)) << 4);
655     else
656       return (char *) 0;
657     d = *(c++);
658     if ((d >= '0') && (d <= '9'))
659       uu |= (unsigned char)(d - '0');
660     else if ((d >= 'a') && (d <= 'f'))
661       uu |= (unsigned char)(d - ('a'-10));
662     else
663       return (char *) 0;
664     *u = uu;
665   }
666   return c;
667 }
668 
669 /*
670    Pack 'void *' into a string buffer.
671 */
672 SWIGRUNTIME char *
SWIG_PackVoidPtr(char * buff,void * ptr,const char * name,size_t bsz)673 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
674   char *r = buff;
675   if ((2*sizeof(void *) + 2) > bsz) return 0;
676   *(r++) = '_';
677   r = SWIG_PackData(r,&ptr,sizeof(void *));
678   if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
679   strcpy(r,name);
680   return buff;
681 }
682 
683 SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char * c,void ** ptr,const char * name)684 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
685   if (*c != '_') {
686     if (strcmp(c,"NULL") == 0) {
687       *ptr = (void *) 0;
688       return name;
689     } else {
690       return 0;
691     }
692   }
693   return SWIG_UnpackData(++c,ptr,sizeof(void *));
694 }
695 
696 SWIGRUNTIME char *
SWIG_PackDataName(char * buff,void * ptr,size_t sz,const char * name,size_t bsz)697 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
698   char *r = buff;
699   size_t lname = (name ? strlen(name) : 0);
700   if ((2*sz + 2 + lname) > bsz) return 0;
701   *(r++) = '_';
702   r = SWIG_PackData(r,ptr,sz);
703   if (lname) {
704     strncpy(r,name,lname+1);
705   } else {
706     *r = 0;
707   }
708   return buff;
709 }
710 
711 SWIGRUNTIME const char *
SWIG_UnpackDataName(const char * c,void * ptr,size_t sz,const char * name)712 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
713   if (*c != '_') {
714     if (strcmp(c,"NULL") == 0) {
715       memset(ptr,0,sz);
716       return name;
717     } else {
718       return 0;
719     }
720   }
721   return SWIG_UnpackData(++c,ptr,sz);
722 }
723 
724 #ifdef __cplusplus
725 }
726 #endif
727 
728 /*  Errors in SWIG */
729 #define  SWIG_UnknownError         -1
730 #define  SWIG_IOError              -2
731 #define  SWIG_RuntimeError         -3
732 #define  SWIG_IndexError           -4
733 #define  SWIG_TypeError            -5
734 #define  SWIG_DivisionByZero       -6
735 #define  SWIG_OverflowError        -7
736 #define  SWIG_SyntaxError          -8
737 #define  SWIG_ValueError           -9
738 #define  SWIG_SystemError          -10
739 #define  SWIG_AttributeError       -11
740 #define  SWIG_MemoryError          -12
741 #define  SWIG_NullReferenceError   -13
742 
743 
744 
745 /* Compatibility macros for Python 3 */
746 #if PY_VERSION_HEX >= 0x03000000
747 
748 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
749 #define PyInt_Check(x) PyLong_Check(x)
750 #define PyInt_AsLong(x) PyLong_AsLong(x)
751 #define PyInt_FromLong(x) PyLong_FromLong(x)
752 #define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
753 #define PyString_Check(name) PyBytes_Check(name)
754 #define PyString_FromString(x) PyUnicode_FromString(x)
755 #define PyString_FromStringAndSize(x, y) PyBytes_FromStringAndSize(x, y)
756 #define PyString_Format(fmt, args)  PyUnicode_Format(fmt, args)
757 #define PyString_AsString(str) PyBytes_AsString(str)
758 #define PyString_Size(str) PyBytes_Size(str)
759 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
760 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
761 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
762 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
763 
764 #endif
765 
766 #ifndef Py_TYPE
767 #  define Py_TYPE(op) ((op)->ob_type)
768 #endif
769 
770 /* SWIG APIs for compatibility of both Python 2 & 3 */
771 
772 #if PY_VERSION_HEX >= 0x03000000
773 #  define SWIG_Python_str_FromFormat PyUnicode_FromFormat
774 #else
775 #  define SWIG_Python_str_FromFormat PyString_FromFormat
776 #endif
777 
778 
779 /* Warning: This function will allocate a new string in Python 3,
780  * so please call SWIG_Python_str_DelForPy3(x) to free the space.
781  */
782 SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject * str)783 SWIG_Python_str_AsChar(PyObject *str)
784 {
785 #if PY_VERSION_HEX >= 0x03000000
786   char *cstr;
787   char *newstr;
788   Py_ssize_t len;
789   str = PyUnicode_AsUTF8String(str);
790   PyBytes_AsStringAndSize(str, &cstr, &len);
791   newstr = (char *) malloc(len+1);
792   memcpy(newstr, cstr, len+1);
793   Py_XDECREF(str);
794   return newstr;
795 #else
796   return PyString_AsString(str);
797 #endif
798 }
799 
800 #if PY_VERSION_HEX >= 0x03000000
801 #  define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
802 #else
803 #  define SWIG_Python_str_DelForPy3(x)
804 #endif
805 
806 
807 SWIGINTERN PyObject*
SWIG_Python_str_FromChar(const char * c)808 SWIG_Python_str_FromChar(const char *c)
809 {
810 #if PY_VERSION_HEX >= 0x03000000
811   return PyUnicode_FromString(c);
812 #else
813   return PyString_FromString(c);
814 #endif
815 }
816 
817 /* Add PyOS_snprintf for old Pythons */
818 #if PY_VERSION_HEX < 0x02020000
819 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
820 #  define PyOS_snprintf _snprintf
821 # else
822 #  define PyOS_snprintf snprintf
823 # endif
824 #endif
825 
826 /* A crude PyString_FromFormat implementation for old Pythons */
827 #if PY_VERSION_HEX < 0x02020000
828 
829 #ifndef SWIG_PYBUFFER_SIZE
830 # define SWIG_PYBUFFER_SIZE 1024
831 #endif
832 
833 static PyObject *
PyString_FromFormat(const char * fmt,...)834 PyString_FromFormat(const char *fmt, ...) {
835   va_list ap;
836   char buf[SWIG_PYBUFFER_SIZE * 2];
837   int res;
838   va_start(ap, fmt);
839   res = vsnprintf(buf, sizeof(buf), fmt, ap);
840   va_end(ap);
841   return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
842 }
843 #endif
844 
845 #ifndef PyObject_DEL
846 # define PyObject_DEL PyObject_Del
847 #endif
848 
849 /* A crude PyExc_StopIteration exception for old Pythons */
850 #if PY_VERSION_HEX < 0x02020000
851 # ifndef PyExc_StopIteration
852 #  define PyExc_StopIteration PyExc_RuntimeError
853 # endif
854 # ifndef PyObject_GenericGetAttr
855 #  define PyObject_GenericGetAttr 0
856 # endif
857 #endif
858 
859 /* Py_NotImplemented is defined in 2.1 and up. */
860 #if PY_VERSION_HEX < 0x02010000
861 # ifndef Py_NotImplemented
862 #  define Py_NotImplemented PyExc_RuntimeError
863 # endif
864 #endif
865 
866 /* A crude PyString_AsStringAndSize implementation for old Pythons */
867 #if PY_VERSION_HEX < 0x02010000
868 # ifndef PyString_AsStringAndSize
869 #  define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
870 # endif
871 #endif
872 
873 /* PySequence_Size for old Pythons */
874 #if PY_VERSION_HEX < 0x02000000
875 # ifndef PySequence_Size
876 #  define PySequence_Size PySequence_Length
877 # endif
878 #endif
879 
880 /* PyBool_FromLong for old Pythons */
881 #if PY_VERSION_HEX < 0x02030000
882 static
PyBool_FromLong(long ok)883 PyObject *PyBool_FromLong(long ok)
884 {
885   PyObject *result = ok ? Py_True : Py_False;
886   Py_INCREF(result);
887   return result;
888 }
889 #endif
890 
891 /* Py_ssize_t for old Pythons */
892 /* This code is as recommended by: */
893 /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
894 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
895 typedef int Py_ssize_t;
896 # define PY_SSIZE_T_MAX INT_MAX
897 # define PY_SSIZE_T_MIN INT_MIN
898 typedef inquiry lenfunc;
899 typedef intargfunc ssizeargfunc;
900 typedef intintargfunc ssizessizeargfunc;
901 typedef intobjargproc ssizeobjargproc;
902 typedef intintobjargproc ssizessizeobjargproc;
903 typedef getreadbufferproc readbufferproc;
904 typedef getwritebufferproc writebufferproc;
905 typedef getsegcountproc segcountproc;
906 typedef getcharbufferproc charbufferproc;
PyNumber_AsSsize_t(PyObject * x,void * SWIGUNUSEDPARM (exc))907 static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
908 {
909   long result = 0;
910   PyObject *i = PyNumber_Int(x);
911   if (i) {
912     result = PyInt_AsLong(i);
913     Py_DECREF(i);
914   }
915   return result;
916 }
917 #endif
918 
919 #if PY_VERSION_HEX < 0x02050000
920 #define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
921 #endif
922 
923 #if PY_VERSION_HEX < 0x02040000
924 #define Py_VISIT(op)                            \
925   do {                                          \
926     if (op) {                                   \
927       int vret = visit((op), arg);              \
928       if (vret)                                 \
929         return vret;                            \
930     }                                           \
931   } while (0)
932 #endif
933 
934 #if PY_VERSION_HEX < 0x02030000
935 typedef struct {
936   PyTypeObject type;
937   PyNumberMethods as_number;
938   PyMappingMethods as_mapping;
939   PySequenceMethods as_sequence;
940   PyBufferProcs as_buffer;
941   PyObject *name, *slots;
942 } PyHeapTypeObject;
943 #endif
944 
945 #if PY_VERSION_HEX < 0x02030000
946 typedef destructor freefunc;
947 #endif
948 
949 #if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
950      (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
951      (PY_MAJOR_VERSION > 3))
952 # define SWIGPY_USE_CAPSULE
953 # define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
954 #endif
955 
956 #if PY_VERSION_HEX < 0x03020000
957 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
958 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
959 #define Py_hash_t long
960 #endif
961 
962 /* -----------------------------------------------------------------------------
963  * error manipulation
964  * ----------------------------------------------------------------------------- */
965 
966 SWIGRUNTIME PyObject*
SWIG_Python_ErrorType(int code)967 SWIG_Python_ErrorType(int code) {
968   PyObject* type = 0;
969   switch(code) {
970   case SWIG_MemoryError:
971     type = PyExc_MemoryError;
972     break;
973   case SWIG_IOError:
974     type = PyExc_IOError;
975     break;
976   case SWIG_RuntimeError:
977     type = PyExc_RuntimeError;
978     break;
979   case SWIG_IndexError:
980     type = PyExc_IndexError;
981     break;
982   case SWIG_TypeError:
983     type = PyExc_TypeError;
984     break;
985   case SWIG_DivisionByZero:
986     type = PyExc_ZeroDivisionError;
987     break;
988   case SWIG_OverflowError:
989     type = PyExc_OverflowError;
990     break;
991   case SWIG_SyntaxError:
992     type = PyExc_SyntaxError;
993     break;
994   case SWIG_ValueError:
995     type = PyExc_ValueError;
996     break;
997   case SWIG_SystemError:
998     type = PyExc_SystemError;
999     break;
1000   case SWIG_AttributeError:
1001     type = PyExc_AttributeError;
1002     break;
1003   default:
1004     type = PyExc_RuntimeError;
1005   }
1006   return type;
1007 }
1008 
1009 
1010 SWIGRUNTIME void
SWIG_Python_AddErrorMsg(const char * mesg)1011 SWIG_Python_AddErrorMsg(const char* mesg)
1012 {
1013   PyObject *type = 0;
1014   PyObject *value = 0;
1015   PyObject *traceback = 0;
1016 
1017   if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
1018   if (value) {
1019     char *tmp;
1020     PyObject *old_str = PyObject_Str(value);
1021     PyErr_Clear();
1022     Py_XINCREF(type);
1023 
1024     PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
1025     SWIG_Python_str_DelForPy3(tmp);
1026     Py_DECREF(old_str);
1027     Py_DECREF(value);
1028   } else {
1029     PyErr_SetString(PyExc_RuntimeError, mesg);
1030   }
1031 }
1032 
1033 #if defined(SWIG_PYTHON_NO_THREADS)
1034 #  if defined(SWIG_PYTHON_THREADS)
1035 #    undef SWIG_PYTHON_THREADS
1036 #  endif
1037 #endif
1038 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
1039 #  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
1040 #    if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
1041 #      define SWIG_PYTHON_USE_GIL
1042 #    endif
1043 #  endif
1044 #  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
1045 #    ifndef SWIG_PYTHON_INITIALIZE_THREADS
1046 #     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads()
1047 #    endif
1048 #    ifdef __cplusplus /* C++ code */
1049        class SWIG_Python_Thread_Block {
1050          bool status;
1051          PyGILState_STATE state;
1052        public:
end()1053          void end() { if (status) { PyGILState_Release(state); status = false;} }
SWIG_Python_Thread_Block()1054          SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
~SWIG_Python_Thread_Block()1055          ~SWIG_Python_Thread_Block() { end(); }
1056        };
1057        class SWIG_Python_Thread_Allow {
1058          bool status;
1059          PyThreadState *save;
1060        public:
end()1061          void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
SWIG_Python_Thread_Allow()1062          SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
~SWIG_Python_Thread_Allow()1063          ~SWIG_Python_Thread_Allow() { end(); }
1064        };
1065 #      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
1066 #      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
1067 #      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
1068 #      define SWIG_PYTHON_THREAD_END_ALLOW     _swig_thread_allow.end()
1069 #    else /* C code */
1070 #      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1071 #      define SWIG_PYTHON_THREAD_END_BLOCK     PyGILState_Release(_swig_thread_block)
1072 #      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1073 #      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
1074 #    endif
1075 #  else /* Old thread way, not implemented, user must provide it */
1076 #    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1077 #      define SWIG_PYTHON_INITIALIZE_THREADS
1078 #    endif
1079 #    if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1080 #      define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1081 #    endif
1082 #    if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1083 #      define SWIG_PYTHON_THREAD_END_BLOCK
1084 #    endif
1085 #    if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1086 #      define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1087 #    endif
1088 #    if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1089 #      define SWIG_PYTHON_THREAD_END_ALLOW
1090 #    endif
1091 #  endif
1092 #else /* No thread support */
1093 #  define SWIG_PYTHON_INITIALIZE_THREADS
1094 #  define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1095 #  define SWIG_PYTHON_THREAD_END_BLOCK
1096 #  define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1097 #  define SWIG_PYTHON_THREAD_END_ALLOW
1098 #endif
1099 
1100 /* -----------------------------------------------------------------------------
1101  * Python API portion that goes into the runtime
1102  * ----------------------------------------------------------------------------- */
1103 
1104 #ifdef __cplusplus
1105 extern "C" {
1106 #endif
1107 
1108 /* -----------------------------------------------------------------------------
1109  * Constant declarations
1110  * ----------------------------------------------------------------------------- */
1111 
1112 /* Constant Types */
1113 #define SWIG_PY_POINTER 4
1114 #define SWIG_PY_BINARY  5
1115 
1116 /* Constant information structure */
1117 typedef struct swig_const_info {
1118   int type;
1119   char *name;
1120   long lvalue;
1121   double dvalue;
1122   void   *pvalue;
1123   swig_type_info **ptype;
1124 } swig_const_info;
1125 
1126 
1127 /* -----------------------------------------------------------------------------
1128  * Wrapper of PyInstanceMethod_New() used in Python 3
1129  * It is exported to the generated module, used for -fastproxy
1130  * ----------------------------------------------------------------------------- */
1131 #if PY_VERSION_HEX >= 0x03000000
SWIG_PyInstanceMethod_New(PyObject * SWIGUNUSEDPARM (self),PyObject * func)1132 SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
1133 {
1134   return PyInstanceMethod_New(func);
1135 }
1136 #else
SWIG_PyInstanceMethod_New(PyObject * SWIGUNUSEDPARM (self),PyObject * SWIGUNUSEDPARM (func))1137 SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
1138 {
1139   return NULL;
1140 }
1141 #endif
1142 
1143 #ifdef __cplusplus
1144 }
1145 #endif
1146 
1147 
1148 /* -----------------------------------------------------------------------------
1149  * pyrun.swg
1150  *
1151  * This file contains the runtime support for Python modules
1152  * and includes code for managing global variables and pointer
1153  * type checking.
1154  *
1155  * ----------------------------------------------------------------------------- */
1156 
1157 /* Common SWIG API */
1158 
1159 /* for raw pointers */
1160 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1161 #define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1162 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1163 
1164 #ifdef SWIGPYTHON_BUILTIN
1165 #define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(self, ptr, type, flags)
1166 #else
1167 #define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1168 #endif
1169 
1170 #define SWIG_InternalNewPointerObj(ptr, type, flags)    SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1171 
1172 #define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty)
1173 #define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
1174 #define swig_owntype                                    int
1175 
1176 /* for raw packed data */
1177 #define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1178 #define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
1179 
1180 /* for class or struct pointers */
1181 #define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
1182 #define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
1183 
1184 /* for C or C++ function pointers */
1185 #define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1186 #define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1187 
1188 /* for C++ member pointers, ie, member methods */
1189 #define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1190 #define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
1191 
1192 
1193 /* Runtime API */
1194 
1195 #define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule(clientdata)
1196 #define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
1197 #define SWIG_NewClientData(obj)                         SwigPyClientData_New(obj)
1198 
1199 #define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj
1200 #define SWIG_SetErrorMsg                                SWIG_Python_SetErrorMsg
1201 #define SWIG_ErrorType(code)                            SWIG_Python_ErrorType(code)
1202 #define SWIG_Error(code, msg)                           SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1203 #define SWIG_fail                                       goto fail
1204 
1205 
1206 /* Runtime API implementation */
1207 
1208 /* Error manipulation */
1209 
1210 SWIGINTERN void
SWIG_Python_SetErrorObj(PyObject * errtype,PyObject * obj)1211 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1212   SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1213   PyErr_SetObject(errtype, obj);
1214   Py_DECREF(obj);
1215   SWIG_PYTHON_THREAD_END_BLOCK;
1216 }
1217 
1218 SWIGINTERN void
SWIG_Python_SetErrorMsg(PyObject * errtype,const char * msg)1219 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1220   SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1221   PyErr_SetString(errtype, msg);
1222   SWIG_PYTHON_THREAD_END_BLOCK;
1223 }
1224 
1225 #define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1226 
1227 /* Set a constant value */
1228 
1229 #if defined(SWIGPYTHON_BUILTIN)
1230 
1231 SWIGINTERN void
SwigPyBuiltin_AddPublicSymbol(PyObject * seq,const char * key)1232 SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1233   PyObject *s = PyString_InternFromString(key);
1234   PyList_Append(seq, s);
1235   Py_DECREF(s);
1236 }
1237 
1238 SWIGINTERN void
SWIG_Python_SetConstant(PyObject * d,PyObject * public_interface,const char * name,PyObject * obj)1239 SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
1240 #if PY_VERSION_HEX < 0x02030000
1241   PyDict_SetItemString(d, (char *)name, obj);
1242 #else
1243   PyDict_SetItemString(d, name, obj);
1244 #endif
1245   Py_DECREF(obj);
1246   if (public_interface)
1247     SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1248 }
1249 
1250 #else
1251 
1252 SWIGINTERN void
SWIG_Python_SetConstant(PyObject * d,const char * name,PyObject * obj)1253 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1254 #if PY_VERSION_HEX < 0x02030000
1255   PyDict_SetItemString(d, (char *)name, obj);
1256 #else
1257   PyDict_SetItemString(d, name, obj);
1258 #endif
1259   Py_DECREF(obj);
1260 }
1261 
1262 #endif
1263 
1264 /* Append a value to the result obj */
1265 
1266 SWIGINTERN PyObject*
SWIG_Python_AppendOutput(PyObject * result,PyObject * obj)1267 SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1268 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
1269   if (!result) {
1270     result = obj;
1271   } else if (result == Py_None) {
1272     Py_DECREF(result);
1273     result = obj;
1274   } else {
1275     if (!PyList_Check(result)) {
1276       PyObject *o2 = result;
1277       result = PyList_New(1);
1278       PyList_SetItem(result, 0, o2);
1279     }
1280     PyList_Append(result,obj);
1281     Py_DECREF(obj);
1282   }
1283   return result;
1284 #else
1285   PyObject*   o2;
1286   PyObject*   o3;
1287   if (!result) {
1288     result = obj;
1289   } else if (result == Py_None) {
1290     Py_DECREF(result);
1291     result = obj;
1292   } else {
1293     if (!PyTuple_Check(result)) {
1294       o2 = result;
1295       result = PyTuple_New(1);
1296       PyTuple_SET_ITEM(result, 0, o2);
1297     }
1298     o3 = PyTuple_New(1);
1299     PyTuple_SET_ITEM(o3, 0, obj);
1300     o2 = result;
1301     result = PySequence_Concat(o2, o3);
1302     Py_DECREF(o2);
1303     Py_DECREF(o3);
1304   }
1305   return result;
1306 #endif
1307 }
1308 
1309 /* Unpack the argument tuple */
1310 
1311 SWIGINTERN Py_ssize_t
SWIG_Python_UnpackTuple(PyObject * args,const char * name,Py_ssize_t min,Py_ssize_t max,PyObject ** objs)1312 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1313 {
1314   if (!args) {
1315     if (!min && !max) {
1316       return 1;
1317     } else {
1318       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1319                    name, (min == max ? "" : "at least "), (int)min);
1320       return 0;
1321     }
1322   }
1323   if (!PyTuple_Check(args)) {
1324     if (min <= 1 && max >= 1) {
1325       Py_ssize_t i;
1326       objs[0] = args;
1327       for (i = 1; i < max; ++i) {
1328         objs[i] = 0;
1329       }
1330       return 2;
1331     }
1332     PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1333     return 0;
1334   } else {
1335     Py_ssize_t l = PyTuple_GET_SIZE(args);
1336     if (l < min) {
1337       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1338                    name, (min == max ? "" : "at least "), (int)min, (int)l);
1339       return 0;
1340     } else if (l > max) {
1341       PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1342                    name, (min == max ? "" : "at most "), (int)max, (int)l);
1343       return 0;
1344     } else {
1345       Py_ssize_t i;
1346       for (i = 0; i < l; ++i) {
1347         objs[i] = PyTuple_GET_ITEM(args, i);
1348       }
1349       for (; l < max; ++l) {
1350         objs[l] = 0;
1351       }
1352       return i + 1;
1353     }
1354   }
1355 }
1356 
1357 /* A functor is a function object with one single object argument */
1358 #if PY_VERSION_HEX >= 0x02020000
1359 #define SWIG_Python_CallFunctor(functor, obj)           PyObject_CallFunctionObjArgs(functor, obj, NULL);
1360 #else
1361 #define SWIG_Python_CallFunctor(functor, obj)           PyObject_CallFunction(functor, "O", obj);
1362 #endif
1363 
1364 /*
1365   Helper for static pointer initialization for both C and C++ code, for example
1366   static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1367 */
1368 #ifdef __cplusplus
1369 #define SWIG_STATIC_POINTER(var)  var
1370 #else
1371 #define SWIG_STATIC_POINTER(var)  var = 0; if (!var) var
1372 #endif
1373 
1374 /* -----------------------------------------------------------------------------
1375  * Pointer declarations
1376  * ----------------------------------------------------------------------------- */
1377 
1378 /* Flags for new pointer objects */
1379 #define SWIG_POINTER_NOSHADOW       (SWIG_POINTER_OWN      << 1)
1380 #define SWIG_POINTER_NEW            (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1381 
1382 #define SWIG_POINTER_IMPLICIT_CONV  (SWIG_POINTER_DISOWN   << 1)
1383 
1384 #define SWIG_BUILTIN_TP_INIT        (SWIG_POINTER_OWN << 2)
1385 #define SWIG_BUILTIN_INIT           (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1386 
1387 #ifdef __cplusplus
1388 extern "C" {
1389 #endif
1390 
1391 /*  How to access Py_None */
1392 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
1393 #  ifndef SWIG_PYTHON_NO_BUILD_NONE
1394 #    ifndef SWIG_PYTHON_BUILD_NONE
1395 #      define SWIG_PYTHON_BUILD_NONE
1396 #    endif
1397 #  endif
1398 #endif
1399 
1400 #ifdef SWIG_PYTHON_BUILD_NONE
1401 #  ifdef Py_None
1402 #   undef Py_None
1403 #   define Py_None SWIG_Py_None()
1404 #  endif
1405 SWIGRUNTIMEINLINE PyObject *
_SWIG_Py_None(void)1406 _SWIG_Py_None(void)
1407 {
1408   PyObject *none = Py_BuildValue((char*)"");
1409   Py_DECREF(none);
1410   return none;
1411 }
1412 SWIGRUNTIME PyObject *
SWIG_Py_None(void)1413 SWIG_Py_None(void)
1414 {
1415   static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
1416   return none;
1417 }
1418 #endif
1419 
1420 /* The python void return value */
1421 
1422 SWIGRUNTIMEINLINE PyObject *
SWIG_Py_Void(void)1423 SWIG_Py_Void(void)
1424 {
1425   PyObject *none = Py_None;
1426   Py_INCREF(none);
1427   return none;
1428 }
1429 
1430 /* SwigPyClientData */
1431 
1432 typedef struct {
1433   PyObject *klass;
1434   PyObject *newraw;
1435   PyObject *newargs;
1436   PyObject *destroy;
1437   int delargs;
1438   int implicitconv;
1439   PyTypeObject *pytype;
1440 } SwigPyClientData;
1441 
1442 SWIGRUNTIMEINLINE int
SWIG_Python_CheckImplicit(swig_type_info * ty)1443 SWIG_Python_CheckImplicit(swig_type_info *ty)
1444 {
1445   SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1446   return data ? data->implicitconv : 0;
1447 }
1448 
1449 SWIGRUNTIMEINLINE PyObject *
SWIG_Python_ExceptionType(swig_type_info * desc)1450 SWIG_Python_ExceptionType(swig_type_info *desc) {
1451   SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1452   PyObject *klass = data ? data->klass : 0;
1453   return (klass ? klass : PyExc_RuntimeError);
1454 }
1455 
1456 
1457 SWIGRUNTIME SwigPyClientData *
SwigPyClientData_New(PyObject * obj)1458 SwigPyClientData_New(PyObject* obj)
1459 {
1460   if (!obj) {
1461     return 0;
1462   } else {
1463     SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1464     /* the klass element */
1465     data->klass = obj;
1466     Py_INCREF(data->klass);
1467     /* the newraw method and newargs arguments used to create a new raw instance */
1468     if (PyClass_Check(obj)) {
1469       data->newraw = 0;
1470       data->newargs = obj;
1471       Py_INCREF(obj);
1472     } else {
1473 #if (PY_VERSION_HEX < 0x02020000)
1474       data->newraw = 0;
1475 #else
1476       data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
1477 #endif
1478       if (data->newraw) {
1479         Py_INCREF(data->newraw);
1480         data->newargs = PyTuple_New(1);
1481         PyTuple_SetItem(data->newargs, 0, obj);
1482       } else {
1483         data->newargs = obj;
1484       }
1485       Py_INCREF(data->newargs);
1486     }
1487     /* the destroy method, aka as the C++ delete method */
1488     data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
1489     if (PyErr_Occurred()) {
1490       PyErr_Clear();
1491       data->destroy = 0;
1492     }
1493     if (data->destroy) {
1494       int flags;
1495       Py_INCREF(data->destroy);
1496       flags = PyCFunction_GET_FLAGS(data->destroy);
1497 #ifdef METH_O
1498       data->delargs = !(flags & (METH_O));
1499 #else
1500       data->delargs = 0;
1501 #endif
1502     } else {
1503       data->delargs = 0;
1504     }
1505     data->implicitconv = 0;
1506     data->pytype = 0;
1507     return data;
1508   }
1509 }
1510 
1511 SWIGRUNTIME void
SwigPyClientData_Del(SwigPyClientData * data)1512 SwigPyClientData_Del(SwigPyClientData *data) {
1513   Py_XDECREF(data->newraw);
1514   Py_XDECREF(data->newargs);
1515   Py_XDECREF(data->destroy);
1516 }
1517 
1518 /* =============== SwigPyObject =====================*/
1519 
1520 typedef struct {
1521   PyObject_HEAD
1522   void *ptr;
1523   swig_type_info *ty;
1524   int own;
1525   PyObject *next;
1526 #ifdef SWIGPYTHON_BUILTIN
1527   PyObject *dict;
1528 #endif
1529 } SwigPyObject;
1530 
1531 
1532 #ifdef SWIGPYTHON_BUILTIN
1533 
1534 SWIGRUNTIME PyObject *
SwigPyObject_get___dict__(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1535 SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
1536 {
1537   SwigPyObject *sobj = (SwigPyObject *)v;
1538 
1539   if (!sobj->dict)
1540     sobj->dict = PyDict_New();
1541 
1542   Py_INCREF(sobj->dict);
1543   return sobj->dict;
1544 }
1545 
1546 #endif
1547 
1548 SWIGRUNTIME PyObject *
SwigPyObject_long(SwigPyObject * v)1549 SwigPyObject_long(SwigPyObject *v)
1550 {
1551   return PyLong_FromVoidPtr(v->ptr);
1552 }
1553 
1554 SWIGRUNTIME PyObject *
SwigPyObject_format(const char * fmt,SwigPyObject * v)1555 SwigPyObject_format(const char* fmt, SwigPyObject *v)
1556 {
1557   PyObject *res = NULL;
1558   PyObject *args = PyTuple_New(1);
1559   if (args) {
1560     if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1561       PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1562       if (ofmt) {
1563 #if PY_VERSION_HEX >= 0x03000000
1564         res = PyUnicode_Format(ofmt,args);
1565 #else
1566         res = PyString_Format(ofmt,args);
1567 #endif
1568         Py_DECREF(ofmt);
1569       }
1570       Py_DECREF(args);
1571     }
1572   }
1573   return res;
1574 }
1575 
1576 SWIGRUNTIME PyObject *
SwigPyObject_oct(SwigPyObject * v)1577 SwigPyObject_oct(SwigPyObject *v)
1578 {
1579   return SwigPyObject_format("%o",v);
1580 }
1581 
1582 SWIGRUNTIME PyObject *
SwigPyObject_hex(SwigPyObject * v)1583 SwigPyObject_hex(SwigPyObject *v)
1584 {
1585   return SwigPyObject_format("%x",v);
1586 }
1587 
1588 SWIGRUNTIME PyObject *
1589 #ifdef METH_NOARGS
SwigPyObject_repr(SwigPyObject * v)1590 SwigPyObject_repr(SwigPyObject *v)
1591 #else
1592 SwigPyObject_repr(SwigPyObject *v, PyObject *args)
1593 #endif
1594 {
1595   const char *name = SWIG_TypePrettyName(v->ty);
1596   PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", (name ? name : "unknown"), (void *)v);
1597   if (v->next) {
1598 # ifdef METH_NOARGS
1599     PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1600 # else
1601     PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
1602 # endif
1603 # if PY_VERSION_HEX >= 0x03000000
1604     PyObject *joined = PyUnicode_Concat(repr, nrep);
1605     Py_DecRef(repr);
1606     Py_DecRef(nrep);
1607     repr = joined;
1608 # else
1609     PyString_ConcatAndDel(&repr,nrep);
1610 # endif
1611   }
1612   return repr;
1613 }
1614 
1615 /* We need a version taking two PyObject* parameters so it's a valid
1616  * PyCFunction to use in swigobject_methods[]. */
1617 SWIGRUNTIME PyObject *
SwigPyObject_repr2(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1618 SwigPyObject_repr2(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
1619 {
1620   return SwigPyObject_repr((SwigPyObject*)v);
1621 }
1622 
1623 SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject * v,SwigPyObject * w)1624 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
1625 {
1626   void *i = v->ptr;
1627   void *j = w->ptr;
1628   return (i < j) ? -1 : ((i > j) ? 1 : 0);
1629 }
1630 
1631 /* Added for Python 3.x, would it also be useful for Python 2.x? */
1632 SWIGRUNTIME PyObject*
SwigPyObject_richcompare(SwigPyObject * v,SwigPyObject * w,int op)1633 SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
1634 {
1635   PyObject* res;
1636   if( op != Py_EQ && op != Py_NE ) {
1637     Py_INCREF(Py_NotImplemented);
1638     return Py_NotImplemented;
1639   }
1640   res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
1641   return res;
1642 }
1643 
1644 
1645 SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
1646 
1647 #ifdef SWIGPYTHON_BUILTIN
1648 static swig_type_info *SwigPyObject_stype = 0;
1649 SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void)1650 SwigPyObject_type(void) {
1651     SwigPyClientData *cd;
1652     assert(SwigPyObject_stype);
1653     cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
1654     assert(cd);
1655     assert(cd->pytype);
1656     return cd->pytype;
1657 }
1658 #else
1659 SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void)1660 SwigPyObject_type(void) {
1661   static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1662   return type;
1663 }
1664 #endif
1665 
1666 SWIGRUNTIMEINLINE int
SwigPyObject_Check(PyObject * op)1667 SwigPyObject_Check(PyObject *op) {
1668 #ifdef SWIGPYTHON_BUILTIN
1669   PyTypeObject *target_tp = SwigPyObject_type();
1670   if (PyType_IsSubtype(op->ob_type, target_tp))
1671     return 1;
1672   return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
1673 #else
1674   return (Py_TYPE(op) == SwigPyObject_type())
1675     || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1676 #endif
1677 }
1678 
1679 SWIGRUNTIME PyObject *
1680 SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1681 
1682 SWIGRUNTIME void
SwigPyObject_dealloc(PyObject * v)1683 SwigPyObject_dealloc(PyObject *v)
1684 {
1685   SwigPyObject *sobj = (SwigPyObject *) v;
1686   PyObject *next = sobj->next;
1687   if (sobj->own == SWIG_POINTER_OWN) {
1688     swig_type_info *ty = sobj->ty;
1689     SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1690     PyObject *destroy = data ? data->destroy : 0;
1691     if (destroy) {
1692       /* destroy is always a VARARGS method */
1693       PyObject *res;
1694 
1695       /* PyObject_CallFunction() has the potential to silently drop
1696          the active active exception.  In cases of unnamed temporary
1697          variable or where we just finished iterating over a generator
1698          StopIteration will be active right now, and this needs to
1699          remain true upon return from SwigPyObject_dealloc.  So save
1700          and restore. */
1701 
1702       PyObject *val = NULL, *type = NULL, *tb = NULL;
1703       PyErr_Fetch(&val, &type, &tb);
1704 
1705       if (data->delargs) {
1706         /* we need to create a temporary object to carry the destroy operation */
1707         PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1708         res = SWIG_Python_CallFunctor(destroy, tmp);
1709         Py_DECREF(tmp);
1710       } else {
1711         PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1712         PyObject *mself = PyCFunction_GET_SELF(destroy);
1713         res = ((*meth)(mself, v));
1714       }
1715       if (!res)
1716         PyErr_WriteUnraisable(destroy);
1717 
1718       PyErr_Restore(val, type, tb);
1719 
1720       Py_XDECREF(res);
1721     }
1722 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1723     else {
1724       const char *name = SWIG_TypePrettyName(ty);
1725       printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1726     }
1727 #endif
1728   }
1729   Py_XDECREF(next);
1730   PyObject_DEL(v);
1731 }
1732 
1733 SWIGRUNTIME PyObject*
SwigPyObject_append(PyObject * v,PyObject * next)1734 SwigPyObject_append(PyObject* v, PyObject* next)
1735 {
1736   SwigPyObject *sobj = (SwigPyObject *) v;
1737 #ifndef METH_O
1738   PyObject *tmp = 0;
1739   if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
1740   next = tmp;
1741 #endif
1742   if (!SwigPyObject_Check(next)) {
1743     PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
1744     return NULL;
1745   }
1746   sobj->next = next;
1747   Py_INCREF(next);
1748   return SWIG_Py_Void();
1749 }
1750 
1751 SWIGRUNTIME PyObject*
SwigPyObject_next(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1752 SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1753 {
1754   SwigPyObject *sobj = (SwigPyObject *) v;
1755   if (sobj->next) {
1756     Py_INCREF(sobj->next);
1757     return sobj->next;
1758   } else {
1759     return SWIG_Py_Void();
1760   }
1761 }
1762 
1763 SWIGINTERN PyObject*
1764 #ifdef METH_NOARGS
SwigPyObject_disown(PyObject * v)1765 SwigPyObject_disown(PyObject *v)
1766 #else
1767 SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1768 #endif
1769 {
1770   SwigPyObject *sobj = (SwigPyObject *)v;
1771   sobj->own = 0;
1772   return SWIG_Py_Void();
1773 }
1774 
1775 SWIGINTERN PyObject*
1776 #ifdef METH_NOARGS
SwigPyObject_acquire(PyObject * v)1777 SwigPyObject_acquire(PyObject *v)
1778 #else
1779 SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1780 #endif
1781 {
1782   SwigPyObject *sobj = (SwigPyObject *)v;
1783   sobj->own = SWIG_POINTER_OWN;
1784   return SWIG_Py_Void();
1785 }
1786 
1787 #ifdef METH_NOARGS
1788 static PyObject*
SwigPyObject_disown2(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1789 SwigPyObject_disown2(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1790 {
1791   return SwigPyObject_disown(v);
1792 }
1793 
1794 static PyObject*
SwigPyObject_acquire2(PyObject * v,PyObject * SWIGUNUSEDPARM (args))1795 SwigPyObject_acquire2(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1796 {
1797   return SwigPyObject_acquire(v);
1798 }
1799 #endif
1800 
1801 SWIGINTERN PyObject*
SwigPyObject_own(PyObject * v,PyObject * args)1802 SwigPyObject_own(PyObject *v, PyObject *args)
1803 {
1804   PyObject *val = 0;
1805 #if (PY_VERSION_HEX < 0x02020000)
1806   if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
1807 #elif (PY_VERSION_HEX < 0x02050000)
1808   if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
1809 #else
1810   if (!PyArg_UnpackTuple(args, "own", 0, 1, &val))
1811 #endif
1812     {
1813       return NULL;
1814     }
1815   else
1816     {
1817       SwigPyObject *sobj = (SwigPyObject *)v;
1818       PyObject *obj = PyBool_FromLong(sobj->own);
1819       if (val) {
1820 #ifdef METH_NOARGS
1821         if (PyObject_IsTrue(val)) {
1822           SwigPyObject_acquire(v);
1823         } else {
1824           SwigPyObject_disown(v);
1825         }
1826 #else
1827         if (PyObject_IsTrue(val)) {
1828           SwigPyObject_acquire(v,args);
1829         } else {
1830           SwigPyObject_disown(v,args);
1831         }
1832 #endif
1833       }
1834       return obj;
1835     }
1836 }
1837 
1838 #ifdef METH_O
1839 static PyMethodDef
1840 swigobject_methods[] = {
1841   {(char *)"disown",  (PyCFunction)SwigPyObject_disown2, METH_NOARGS,  (char *)"releases ownership of the pointer"},
1842   {(char *)"acquire", (PyCFunction)SwigPyObject_acquire2,METH_NOARGS,  (char *)"acquires ownership of the pointer"},
1843   {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1844   {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_O,       (char *)"appends another 'this' object"},
1845   {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
1846   {(char *)"__repr__",(PyCFunction)SwigPyObject_repr2,   METH_NOARGS,  (char *)"returns object representation"},
1847   {0, 0, 0, 0}
1848 };
1849 #else
1850 static PyMethodDef
1851 swigobject_methods[] = {
1852   {(char *)"disown",  (PyCFunction)SwigPyObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
1853   {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS,  (char *)"acquires ownership of the pointer"},
1854   {(char *)"own",     (PyCFunction)SwigPyObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
1855   {(char *)"append",  (PyCFunction)SwigPyObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
1856   {(char *)"next",    (PyCFunction)SwigPyObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
1857   {(char *)"__repr__",(PyCFunction)SwigPyObject_repr,    METH_VARARGS,  (char *)"returns object representation"},
1858   {0, 0, 0, 0}
1859 };
1860 #endif
1861 
1862 #if PY_VERSION_HEX < 0x02020000
1863 SWIGINTERN PyObject *
SwigPyObject_getattr(SwigPyObject * sobj,char * name)1864 SwigPyObject_getattr(SwigPyObject *sobj,char *name)
1865 {
1866   return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1867 }
1868 #endif
1869 
1870 SWIGRUNTIME PyTypeObject*
SwigPyObject_TypeOnce(void)1871 SwigPyObject_TypeOnce(void) {
1872   static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1873 
1874   static PyNumberMethods SwigPyObject_as_number = {
1875     (binaryfunc)0, /*nb_add*/
1876     (binaryfunc)0, /*nb_subtract*/
1877     (binaryfunc)0, /*nb_multiply*/
1878     /* nb_divide removed in Python 3 */
1879 #if PY_VERSION_HEX < 0x03000000
1880     (binaryfunc)0, /*nb_divide*/
1881 #endif
1882     (binaryfunc)0, /*nb_remainder*/
1883     (binaryfunc)0, /*nb_divmod*/
1884     (ternaryfunc)0,/*nb_power*/
1885     (unaryfunc)0,  /*nb_negative*/
1886     (unaryfunc)0,  /*nb_positive*/
1887     (unaryfunc)0,  /*nb_absolute*/
1888     (inquiry)0,    /*nb_nonzero*/
1889     0,             /*nb_invert*/
1890     0,             /*nb_lshift*/
1891     0,             /*nb_rshift*/
1892     0,             /*nb_and*/
1893     0,             /*nb_xor*/
1894     0,             /*nb_or*/
1895 #if PY_VERSION_HEX < 0x03000000
1896     0,   /*nb_coerce*/
1897 #endif
1898     (unaryfunc)SwigPyObject_long, /*nb_int*/
1899 #if PY_VERSION_HEX < 0x03000000
1900     (unaryfunc)SwigPyObject_long, /*nb_long*/
1901 #else
1902     0, /*nb_reserved*/
1903 #endif
1904     (unaryfunc)0,                 /*nb_float*/
1905 #if PY_VERSION_HEX < 0x03000000
1906     (unaryfunc)SwigPyObject_oct,  /*nb_oct*/
1907     (unaryfunc)SwigPyObject_hex,  /*nb_hex*/
1908 #endif
1909 #if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
1910     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
1911 #elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1912     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1913 #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
1914     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1915 #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
1916     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
1917 #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
1918     0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
1919 #endif
1920   };
1921 
1922   static PyTypeObject swigpyobject_type;
1923   static int type_init = 0;
1924   if (!type_init) {
1925     const PyTypeObject tmp = {
1926 #if PY_VERSION_HEX >= 0x03000000
1927       PyVarObject_HEAD_INIT(NULL, 0)
1928 #else
1929       PyObject_HEAD_INIT(NULL)
1930       0,                                    /* ob_size */
1931 #endif
1932       (char *)"SwigPyObject",               /* tp_name */
1933       sizeof(SwigPyObject),                 /* tp_basicsize */
1934       0,                                    /* tp_itemsize */
1935       (destructor)SwigPyObject_dealloc,     /* tp_dealloc */
1936       0,                                    /* tp_print */
1937 #if PY_VERSION_HEX < 0x02020000
1938       (getattrfunc)SwigPyObject_getattr,    /* tp_getattr */
1939 #else
1940       (getattrfunc)0,                       /* tp_getattr */
1941 #endif
1942       (setattrfunc)0,                       /* tp_setattr */
1943 #if PY_VERSION_HEX >= 0x03000000
1944       0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1945 #else
1946       (cmpfunc)SwigPyObject_compare,        /* tp_compare */
1947 #endif
1948       (reprfunc)SwigPyObject_repr,          /* tp_repr */
1949       &SwigPyObject_as_number,              /* tp_as_number */
1950       0,                                    /* tp_as_sequence */
1951       0,                                    /* tp_as_mapping */
1952       (hashfunc)0,                          /* tp_hash */
1953       (ternaryfunc)0,                       /* tp_call */
1954       0,                                    /* tp_str */
1955       PyObject_GenericGetAttr,              /* tp_getattro */
1956       0,                                    /* tp_setattro */
1957       0,                                    /* tp_as_buffer */
1958       Py_TPFLAGS_DEFAULT,                   /* tp_flags */
1959       swigobject_doc,                       /* tp_doc */
1960       0,                                    /* tp_traverse */
1961       0,                                    /* tp_clear */
1962       (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
1963       0,                                    /* tp_weaklistoffset */
1964 #if PY_VERSION_HEX >= 0x02020000
1965       0,                                    /* tp_iter */
1966       0,                                    /* tp_iternext */
1967       swigobject_methods,                   /* tp_methods */
1968       0,                                    /* tp_members */
1969       0,                                    /* tp_getset */
1970       0,                                    /* tp_base */
1971       0,                                    /* tp_dict */
1972       0,                                    /* tp_descr_get */
1973       0,                                    /* tp_descr_set */
1974       0,                                    /* tp_dictoffset */
1975       0,                                    /* tp_init */
1976       0,                                    /* tp_alloc */
1977       0,                                    /* tp_new */
1978       0,                                    /* tp_free */
1979       0,                                    /* tp_is_gc */
1980       0,                                    /* tp_bases */
1981       0,                                    /* tp_mro */
1982       0,                                    /* tp_cache */
1983       0,                                    /* tp_subclasses */
1984       0,                                    /* tp_weaklist */
1985 #endif
1986 #if PY_VERSION_HEX >= 0x02030000
1987       0,                                    /* tp_del */
1988 #endif
1989 #if PY_VERSION_HEX >= 0x02060000
1990       0,                                    /* tp_version_tag */
1991 #endif
1992 #if PY_VERSION_HEX >= 0x03040000
1993       0,                                    /* tp_finalize */
1994 #endif
1995 #ifdef COUNT_ALLOCS
1996       0,                                    /* tp_allocs */
1997       0,                                    /* tp_frees */
1998       0,                                    /* tp_maxalloc */
1999 #if PY_VERSION_HEX >= 0x02050000
2000       0,                                    /* tp_prev */
2001 #endif
2002       0                                     /* tp_next */
2003 #endif
2004     };
2005     swigpyobject_type = tmp;
2006     type_init = 1;
2007 #if PY_VERSION_HEX < 0x02020000
2008     swigpyobject_type.ob_type = &PyType_Type;
2009 #else
2010     if (PyType_Ready(&swigpyobject_type) < 0)
2011       return NULL;
2012 #endif
2013   }
2014   return &swigpyobject_type;
2015 }
2016 
2017 SWIGRUNTIME PyObject *
SwigPyObject_New(void * ptr,swig_type_info * ty,int own)2018 SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
2019 {
2020   SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
2021   if (sobj) {
2022     sobj->ptr  = ptr;
2023     sobj->ty   = ty;
2024     sobj->own  = own;
2025     sobj->next = 0;
2026   }
2027   return (PyObject *)sobj;
2028 }
2029 
2030 /* -----------------------------------------------------------------------------
2031  * Implements a simple Swig Packed type, and use it instead of string
2032  * ----------------------------------------------------------------------------- */
2033 
2034 typedef struct {
2035   PyObject_HEAD
2036   void *pack;
2037   swig_type_info *ty;
2038   size_t size;
2039 } SwigPyPacked;
2040 
2041 SWIGRUNTIME int
SwigPyPacked_print(SwigPyPacked * v,FILE * fp,int SWIGUNUSEDPARM (flags))2042 SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
2043 {
2044   char result[SWIG_BUFFER_SIZE];
2045   fputs("<Swig Packed ", fp);
2046   if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
2047     fputs("at ", fp);
2048     fputs(result, fp);
2049   }
2050   fputs(v->ty->name,fp);
2051   fputs(">", fp);
2052   return 0;
2053 }
2054 
2055 SWIGRUNTIME PyObject *
SwigPyPacked_repr(SwigPyPacked * v)2056 SwigPyPacked_repr(SwigPyPacked *v)
2057 {
2058   char result[SWIG_BUFFER_SIZE];
2059   if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
2060     return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
2061   } else {
2062     return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
2063   }
2064 }
2065 
2066 SWIGRUNTIME PyObject *
SwigPyPacked_str(SwigPyPacked * v)2067 SwigPyPacked_str(SwigPyPacked *v)
2068 {
2069   char result[SWIG_BUFFER_SIZE];
2070   if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
2071     return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
2072   } else {
2073     return SWIG_Python_str_FromChar(v->ty->name);
2074   }
2075 }
2076 
2077 SWIGRUNTIME int
SwigPyPacked_compare(SwigPyPacked * v,SwigPyPacked * w)2078 SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
2079 {
2080   size_t i = v->size;
2081   size_t j = w->size;
2082   int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
2083   return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
2084 }
2085 
2086 SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
2087 
2088 SWIGRUNTIME PyTypeObject*
SwigPyPacked_type(void)2089 SwigPyPacked_type(void) {
2090   static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
2091   return type;
2092 }
2093 
2094 SWIGRUNTIMEINLINE int
SwigPyPacked_Check(PyObject * op)2095 SwigPyPacked_Check(PyObject *op) {
2096   return ((op)->ob_type == SwigPyPacked_TypeOnce())
2097     || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
2098 }
2099 
2100 SWIGRUNTIME void
SwigPyPacked_dealloc(PyObject * v)2101 SwigPyPacked_dealloc(PyObject *v)
2102 {
2103   if (SwigPyPacked_Check(v)) {
2104     SwigPyPacked *sobj = (SwigPyPacked *) v;
2105     free(sobj->pack);
2106   }
2107   PyObject_DEL(v);
2108 }
2109 
2110 SWIGRUNTIME PyTypeObject*
SwigPyPacked_TypeOnce(void)2111 SwigPyPacked_TypeOnce(void) {
2112   static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
2113   static PyTypeObject swigpypacked_type;
2114   static int type_init = 0;
2115   if (!type_init) {
2116     const PyTypeObject tmp = {
2117 #if PY_VERSION_HEX>=0x03000000
2118       PyVarObject_HEAD_INIT(NULL, 0)
2119 #else
2120       PyObject_HEAD_INIT(NULL)
2121       0,                                    /* ob_size */
2122 #endif
2123       (char *)"SwigPyPacked",               /* tp_name */
2124       sizeof(SwigPyPacked),                 /* tp_basicsize */
2125       0,                                    /* tp_itemsize */
2126       (destructor)SwigPyPacked_dealloc,     /* tp_dealloc */
2127       (printfunc)SwigPyPacked_print,        /* tp_print */
2128       (getattrfunc)0,                       /* tp_getattr */
2129       (setattrfunc)0,                       /* tp_setattr */
2130 #if PY_VERSION_HEX>=0x03000000
2131       0, /* tp_reserved in 3.0.1 */
2132 #else
2133       (cmpfunc)SwigPyPacked_compare,        /* tp_compare */
2134 #endif
2135       (reprfunc)SwigPyPacked_repr,          /* tp_repr */
2136       0,                                    /* tp_as_number */
2137       0,                                    /* tp_as_sequence */
2138       0,                                    /* tp_as_mapping */
2139       (hashfunc)0,                          /* tp_hash */
2140       (ternaryfunc)0,                       /* tp_call */
2141       (reprfunc)SwigPyPacked_str,           /* tp_str */
2142       PyObject_GenericGetAttr,              /* tp_getattro */
2143       0,                                    /* tp_setattro */
2144       0,                                    /* tp_as_buffer */
2145       Py_TPFLAGS_DEFAULT,                   /* tp_flags */
2146       swigpacked_doc,                       /* tp_doc */
2147       0,                                    /* tp_traverse */
2148       0,                                    /* tp_clear */
2149       0,                                    /* tp_richcompare */
2150       0,                                    /* tp_weaklistoffset */
2151 #if PY_VERSION_HEX >= 0x02020000
2152       0,                                    /* tp_iter */
2153       0,                                    /* tp_iternext */
2154       0,                                    /* tp_methods */
2155       0,                                    /* tp_members */
2156       0,                                    /* tp_getset */
2157       0,                                    /* tp_base */
2158       0,                                    /* tp_dict */
2159       0,                                    /* tp_descr_get */
2160       0,                                    /* tp_descr_set */
2161       0,                                    /* tp_dictoffset */
2162       0,                                    /* tp_init */
2163       0,                                    /* tp_alloc */
2164       0,                                    /* tp_new */
2165       0,                                    /* tp_free */
2166       0,                                    /* tp_is_gc */
2167       0,                                    /* tp_bases */
2168       0,                                    /* tp_mro */
2169       0,                                    /* tp_cache */
2170       0,                                    /* tp_subclasses */
2171       0,                                    /* tp_weaklist */
2172 #endif
2173 #if PY_VERSION_HEX >= 0x02030000
2174       0,                                    /* tp_del */
2175 #endif
2176 #if PY_VERSION_HEX >= 0x02060000
2177       0,                                    /* tp_version_tag */
2178 #endif
2179 #if PY_VERSION_HEX >= 0x03040000
2180       0,                                    /* tp_finalize */
2181 #endif
2182 #ifdef COUNT_ALLOCS
2183       0,                                    /* tp_allocs */
2184       0,                                    /* tp_frees */
2185       0,                                    /* tp_maxalloc */
2186 #if PY_VERSION_HEX >= 0x02050000
2187       0,                                    /* tp_prev */
2188 #endif
2189       0                                     /* tp_next */
2190 #endif
2191     };
2192     swigpypacked_type = tmp;
2193     type_init = 1;
2194 #if PY_VERSION_HEX < 0x02020000
2195     swigpypacked_type.ob_type = &PyType_Type;
2196 #else
2197     if (PyType_Ready(&swigpypacked_type) < 0)
2198       return NULL;
2199 #endif
2200   }
2201   return &swigpypacked_type;
2202 }
2203 
2204 SWIGRUNTIME PyObject *
SwigPyPacked_New(void * ptr,size_t size,swig_type_info * ty)2205 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
2206 {
2207   SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
2208   if (sobj) {
2209     void *pack = malloc(size);
2210     if (pack) {
2211       memcpy(pack, ptr, size);
2212       sobj->pack = pack;
2213       sobj->ty   = ty;
2214       sobj->size = size;
2215     } else {
2216       PyObject_DEL((PyObject *) sobj);
2217       sobj = 0;
2218     }
2219   }
2220   return (PyObject *) sobj;
2221 }
2222 
2223 SWIGRUNTIME swig_type_info *
SwigPyPacked_UnpackData(PyObject * obj,void * ptr,size_t size)2224 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
2225 {
2226   if (SwigPyPacked_Check(obj)) {
2227     SwigPyPacked *sobj = (SwigPyPacked *)obj;
2228     if (sobj->size != size) return 0;
2229     memcpy(ptr, sobj->pack, size);
2230     return sobj->ty;
2231   } else {
2232     return 0;
2233   }
2234 }
2235 
2236 /* -----------------------------------------------------------------------------
2237  * pointers/data manipulation
2238  * ----------------------------------------------------------------------------- */
2239 
2240 SWIGRUNTIMEINLINE PyObject *
_SWIG_This(void)2241 _SWIG_This(void)
2242 {
2243     return SWIG_Python_str_FromChar("this");
2244 }
2245 
2246 static PyObject *swig_this = NULL;
2247 
2248 SWIGRUNTIME PyObject *
SWIG_This(void)2249 SWIG_This(void)
2250 {
2251   if (swig_this == NULL)
2252     swig_this = _SWIG_This();
2253   return swig_this;
2254 }
2255 
2256 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
2257 
2258 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
2259 #if PY_VERSION_HEX>=0x03000000
2260 #define SWIG_PYTHON_SLOW_GETSET_THIS
2261 #endif
2262 
2263 SWIGRUNTIME SwigPyObject *
SWIG_Python_GetSwigThis(PyObject * pyobj)2264 SWIG_Python_GetSwigThis(PyObject *pyobj)
2265 {
2266   PyObject *obj;
2267 
2268   if (SwigPyObject_Check(pyobj))
2269     return (SwigPyObject *) pyobj;
2270 
2271 #ifdef SWIGPYTHON_BUILTIN
2272   (void)obj;
2273 # ifdef PyWeakref_CheckProxy
2274   if (PyWeakref_CheckProxy(pyobj)) {
2275     pyobj = PyWeakref_GET_OBJECT(pyobj);
2276     if (pyobj && SwigPyObject_Check(pyobj))
2277       return (SwigPyObject*) pyobj;
2278   }
2279 # endif
2280   return NULL;
2281 #else
2282 
2283   obj = 0;
2284 
2285 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
2286   if (PyInstance_Check(pyobj)) {
2287     obj = _PyInstance_Lookup(pyobj, SWIG_This());
2288   } else {
2289     PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2290     if (dictptr != NULL) {
2291       PyObject *dict = *dictptr;
2292       obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
2293     } else {
2294 #ifdef PyWeakref_CheckProxy
2295       if (PyWeakref_CheckProxy(pyobj)) {
2296         PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2297         return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2298       }
2299 #endif
2300       obj = PyObject_GetAttr(pyobj,SWIG_This());
2301       if (obj) {
2302         Py_DECREF(obj);
2303       } else {
2304         if (PyErr_Occurred()) PyErr_Clear();
2305         return 0;
2306       }
2307     }
2308   }
2309 #else
2310   obj = PyObject_GetAttr(pyobj,SWIG_This());
2311   if (obj) {
2312     Py_DECREF(obj);
2313   } else {
2314     if (PyErr_Occurred()) PyErr_Clear();
2315     return 0;
2316   }
2317 #endif
2318   if (obj && !SwigPyObject_Check(obj)) {
2319     /* a PyObject is called 'this', try to get the 'real this'
2320        SwigPyObject from it */
2321     return SWIG_Python_GetSwigThis(obj);
2322   }
2323   return (SwigPyObject *)obj;
2324 #endif
2325 }
2326 
2327 /* Acquire a pointer value */
2328 
2329 SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject * obj,int own)2330 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2331   if (own == SWIG_POINTER_OWN) {
2332     SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2333     if (sobj) {
2334       int oldown = sobj->own;
2335       sobj->own = own;
2336       return oldown;
2337     }
2338   }
2339   return 0;
2340 }
2341 
2342 /* Convert a pointer value */
2343 
2344 SWIGRUNTIME int
SWIG_Python_ConvertPtrAndOwn(PyObject * obj,void ** ptr,swig_type_info * ty,int flags,int * own)2345 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2346   int res;
2347   SwigPyObject *sobj;
2348   int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;
2349 
2350   if (!obj)
2351     return SWIG_ERROR;
2352   if (obj == Py_None && !implicit_conv) {
2353     if (ptr)
2354       *ptr = 0;
2355     return SWIG_OK;
2356   }
2357 
2358   res = SWIG_ERROR;
2359 
2360   sobj = SWIG_Python_GetSwigThis(obj);
2361   if (own)
2362     *own = 0;
2363   while (sobj) {
2364     void *vptr = sobj->ptr;
2365     if (ty) {
2366       swig_type_info *to = sobj->ty;
2367       if (to == ty) {
2368         /* no type cast needed */
2369         if (ptr) *ptr = vptr;
2370         break;
2371       } else {
2372         swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2373         if (!tc) {
2374           sobj = (SwigPyObject *)sobj->next;
2375         } else {
2376           if (ptr) {
2377             int newmemory = 0;
2378             *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2379             if (newmemory == SWIG_CAST_NEW_MEMORY) {
2380               assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2381               if (own)
2382                 *own = *own | SWIG_CAST_NEW_MEMORY;
2383             }
2384           }
2385           break;
2386         }
2387       }
2388     } else {
2389       if (ptr) *ptr = vptr;
2390       break;
2391     }
2392   }
2393   if (sobj) {
2394     if (own)
2395       *own = *own | sobj->own;
2396     if (flags & SWIG_POINTER_DISOWN) {
2397       sobj->own = 0;
2398     }
2399     res = SWIG_OK;
2400   } else {
2401     if (implicit_conv) {
2402       SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2403       if (data && !data->implicitconv) {
2404         PyObject *klass = data->klass;
2405         if (klass) {
2406           PyObject *impconv;
2407           data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2408           impconv = SWIG_Python_CallFunctor(klass, obj);
2409           data->implicitconv = 0;
2410           if (PyErr_Occurred()) {
2411             PyErr_Clear();
2412             impconv = 0;
2413           }
2414           if (impconv) {
2415             SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2416             if (iobj) {
2417               void *vptr;
2418               res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2419               if (SWIG_IsOK(res)) {
2420                 if (ptr) {
2421                   *ptr = vptr;
2422                   /* transfer the ownership to 'ptr' */
2423                   iobj->own = 0;
2424                   res = SWIG_AddCast(res);
2425                   res = SWIG_AddNewMask(res);
2426                 } else {
2427                   res = SWIG_AddCast(res);
2428                 }
2429               }
2430             }
2431             Py_DECREF(impconv);
2432           }
2433         }
2434       }
2435     }
2436     if (!SWIG_IsOK(res) && obj == Py_None) {
2437       if (ptr)
2438         *ptr = 0;
2439       if (PyErr_Occurred())
2440         PyErr_Clear();
2441       res = SWIG_OK;
2442     }
2443   }
2444   return res;
2445 }
2446 
2447 /* Convert a function ptr value */
2448 
2449 SWIGRUNTIME int
SWIG_Python_ConvertFunctionPtr(PyObject * obj,void ** ptr,swig_type_info * ty)2450 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2451   if (!PyCFunction_Check(obj)) {
2452     return SWIG_ConvertPtr(obj, ptr, ty, 0);
2453   } else {
2454     void *vptr = 0;
2455 
2456     /* here we get the method pointer for callbacks */
2457     const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2458     const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2459     if (desc)
2460       desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2461     if (!desc)
2462       return SWIG_ERROR;
2463     if (ty) {
2464       swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
2465       if (tc) {
2466         int newmemory = 0;
2467         *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2468         assert(!newmemory); /* newmemory handling not yet implemented */
2469       } else {
2470         return SWIG_ERROR;
2471       }
2472     } else {
2473       *ptr = vptr;
2474     }
2475     return SWIG_OK;
2476   }
2477 }
2478 
2479 /* Convert a packed value value */
2480 
2481 SWIGRUNTIME int
SWIG_Python_ConvertPacked(PyObject * obj,void * ptr,size_t sz,swig_type_info * ty)2482 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2483   swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2484   if (!to) return SWIG_ERROR;
2485   if (ty) {
2486     if (to != ty) {
2487       /* check type cast? */
2488       swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2489       if (!tc) return SWIG_ERROR;
2490     }
2491   }
2492   return SWIG_OK;
2493 }
2494 
2495 /* -----------------------------------------------------------------------------
2496  * Create a new pointer object
2497  * ----------------------------------------------------------------------------- */
2498 
2499 /*
2500   Create a new instance object, without calling __init__, and set the
2501   'this' attribute.
2502 */
2503 
2504 SWIGRUNTIME PyObject*
SWIG_Python_NewShadowInstance(SwigPyClientData * data,PyObject * swig_this)2505 SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
2506 {
2507 #if (PY_VERSION_HEX >= 0x02020000)
2508   PyObject *inst = 0;
2509   PyObject *newraw = data->newraw;
2510   if (newraw) {
2511     inst = PyObject_Call(newraw, data->newargs, NULL);
2512     if (inst) {
2513 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2514       PyObject **dictptr = _PyObject_GetDictPtr(inst);
2515       if (dictptr != NULL) {
2516         PyObject *dict = *dictptr;
2517         if (dict == NULL) {
2518           dict = PyDict_New();
2519           *dictptr = dict;
2520           PyDict_SetItem(dict, SWIG_This(), swig_this);
2521         }
2522       }
2523 #else
2524       PyObject *key = SWIG_This();
2525       PyObject_SetAttr(inst, key, swig_this);
2526 #endif
2527     }
2528   } else {
2529 #if PY_VERSION_HEX >= 0x03000000
2530     inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
2531     if (inst) {
2532       PyObject_SetAttr(inst, SWIG_This(), swig_this);
2533       Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2534     }
2535 #else
2536     PyObject *dict = PyDict_New();
2537     if (dict) {
2538       PyDict_SetItem(dict, SWIG_This(), swig_this);
2539       inst = PyInstance_NewRaw(data->newargs, dict);
2540       Py_DECREF(dict);
2541     }
2542 #endif
2543   }
2544   return inst;
2545 #else
2546 #if (PY_VERSION_HEX >= 0x02010000)
2547   PyObject *inst = 0;
2548   PyObject *dict = PyDict_New();
2549   if (dict) {
2550     PyDict_SetItem(dict, SWIG_This(), swig_this);
2551     inst = PyInstance_NewRaw(data->newargs, dict);
2552     Py_DECREF(dict);
2553   }
2554   return (PyObject *) inst;
2555 #else
2556   PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
2557   if (inst == NULL) {
2558     return NULL;
2559   }
2560   inst->in_class = (PyClassObject *)data->newargs;
2561   Py_INCREF(inst->in_class);
2562   inst->in_dict = PyDict_New();
2563   if (inst->in_dict == NULL) {
2564     Py_DECREF(inst);
2565     return NULL;
2566   }
2567 #ifdef Py_TPFLAGS_HAVE_WEAKREFS
2568   inst->in_weakreflist = NULL;
2569 #endif
2570 #ifdef Py_TPFLAGS_GC
2571   PyObject_GC_Init(inst);
2572 #endif
2573   PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
2574   return (PyObject *) inst;
2575 #endif
2576 #endif
2577 }
2578 
2579 SWIGRUNTIME void
SWIG_Python_SetSwigThis(PyObject * inst,PyObject * swig_this)2580 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2581 {
2582  PyObject *dict;
2583 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2584  PyObject **dictptr = _PyObject_GetDictPtr(inst);
2585  if (dictptr != NULL) {
2586    dict = *dictptr;
2587    if (dict == NULL) {
2588      dict = PyDict_New();
2589      *dictptr = dict;
2590    }
2591    PyDict_SetItem(dict, SWIG_This(), swig_this);
2592    return;
2593  }
2594 #endif
2595  dict = PyObject_GetAttrString(inst, (char*)"__dict__");
2596  PyDict_SetItem(dict, SWIG_This(), swig_this);
2597  Py_DECREF(dict);
2598 }
2599 
2600 
2601 SWIGINTERN PyObject *
SWIG_Python_InitShadowInstance(PyObject * args)2602 SWIG_Python_InitShadowInstance(PyObject *args) {
2603   PyObject *obj[2];
2604   if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
2605     return NULL;
2606   } else {
2607     SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2608     if (sthis) {
2609       SwigPyObject_append((PyObject*) sthis, obj[1]);
2610     } else {
2611       SWIG_Python_SetSwigThis(obj[0], obj[1]);
2612     }
2613     return SWIG_Py_Void();
2614   }
2615 }
2616 
2617 /* Create a new pointer object */
2618 
2619 SWIGRUNTIME PyObject *
SWIG_Python_NewPointerObj(PyObject * self,void * ptr,swig_type_info * type,int flags)2620 SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2621   SwigPyClientData *clientdata;
2622   PyObject * robj;
2623   int own;
2624 
2625   if (!ptr)
2626     return SWIG_Py_Void();
2627 
2628   clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2629   own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2630   if (clientdata && clientdata->pytype) {
2631     SwigPyObject *newobj;
2632     if (flags & SWIG_BUILTIN_TP_INIT) {
2633       newobj = (SwigPyObject*) self;
2634       if (newobj->ptr) {
2635         PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2636         while (newobj->next)
2637           newobj = (SwigPyObject *) newobj->next;
2638         newobj->next = next_self;
2639         newobj = (SwigPyObject *)next_self;
2640 #ifdef SWIGPYTHON_BUILTIN
2641         newobj->dict = 0;
2642 #endif
2643       }
2644     } else {
2645       newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2646 #ifdef SWIGPYTHON_BUILTIN
2647       newobj->dict = 0;
2648 #endif
2649     }
2650     if (newobj) {
2651       newobj->ptr = ptr;
2652       newobj->ty = type;
2653       newobj->own = own;
2654       newobj->next = 0;
2655       return (PyObject*) newobj;
2656     }
2657     return SWIG_Py_Void();
2658   }
2659 
2660   assert(!(flags & SWIG_BUILTIN_TP_INIT));
2661 
2662   robj = SwigPyObject_New(ptr, type, own);
2663   if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2664     PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2665     Py_DECREF(robj);
2666     robj = inst;
2667   }
2668   return robj;
2669 }
2670 
2671 /* Create a new packed object */
2672 
2673 SWIGRUNTIMEINLINE PyObject *
SWIG_Python_NewPackedObj(void * ptr,size_t sz,swig_type_info * type)2674 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2675   return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2676 }
2677 
2678 /* -----------------------------------------------------------------------------*
2679  *  Get type list
2680  * -----------------------------------------------------------------------------*/
2681 
2682 #ifdef SWIG_LINK_RUNTIME
2683 void *SWIG_ReturnGlobalTypeList(void *);
2684 #endif
2685 
2686 SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void * SWIGUNUSEDPARM (clientdata))2687 SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
2688   static void *type_pointer = (void *)0;
2689   /* first check if module already created */
2690   if (!type_pointer) {
2691 #ifdef SWIG_LINK_RUNTIME
2692     type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2693 #else
2694 # ifdef SWIGPY_USE_CAPSULE
2695     type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2696 # else
2697     type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2698                                     (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
2699 # endif
2700     if (PyErr_Occurred()) {
2701       PyErr_Clear();
2702       type_pointer = (void *)0;
2703     }
2704 #endif
2705   }
2706   return (swig_module_info *) type_pointer;
2707 }
2708 
2709 #if PY_MAJOR_VERSION < 2
2710 /* PyModule_AddObject function was introduced in Python 2.0.  The following function
2711    is copied out of Python/modsupport.c in python version 2.3.4 */
2712 SWIGINTERN int
PyModule_AddObject(PyObject * m,char * name,PyObject * o)2713 PyModule_AddObject(PyObject *m, char *name, PyObject *o)
2714 {
2715   PyObject *dict;
2716   if (!PyModule_Check(m)) {
2717     PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg");
2718     return SWIG_ERROR;
2719   }
2720   if (!o) {
2721     PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value");
2722     return SWIG_ERROR;
2723   }
2724 
2725   dict = PyModule_GetDict(m);
2726   if (dict == NULL) {
2727     /* Internal error -- modules must have a dict! */
2728     PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
2729                  PyModule_GetName(m));
2730     return SWIG_ERROR;
2731   }
2732   if (PyDict_SetItemString(dict, name, o))
2733     return SWIG_ERROR;
2734   Py_DECREF(o);
2735   return SWIG_OK;
2736 }
2737 #endif
2738 
2739 SWIGRUNTIME void
2740 #ifdef SWIGPY_USE_CAPSULE
SWIG_Python_DestroyModule(PyObject * obj)2741 SWIG_Python_DestroyModule(PyObject *obj)
2742 #else
2743 SWIG_Python_DestroyModule(void *vptr)
2744 #endif
2745 {
2746 #ifdef SWIGPY_USE_CAPSULE
2747   swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2748 #else
2749   swig_module_info *swig_module = (swig_module_info *) vptr;
2750 #endif
2751   swig_type_info **types = swig_module->types;
2752   size_t i;
2753   for (i =0; i < swig_module->size; ++i) {
2754     swig_type_info *ty = types[i];
2755     if (ty->owndata) {
2756       SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
2757       if (data) SwigPyClientData_Del(data);
2758     }
2759   }
2760   Py_DECREF(SWIG_This());
2761   swig_this = NULL;
2762 }
2763 
2764 SWIGRUNTIME void
SWIG_Python_SetModule(swig_module_info * swig_module)2765 SWIG_Python_SetModule(swig_module_info *swig_module) {
2766 #if PY_VERSION_HEX >= 0x03000000
2767  /* Add a dummy module object into sys.modules */
2768   PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
2769 #else
2770   static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2771   PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2772 #endif
2773 #ifdef SWIGPY_USE_CAPSULE
2774   PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2775   if (pointer && module) {
2776     PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2777   } else {
2778     Py_XDECREF(pointer);
2779   }
2780 #else
2781   PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
2782   if (pointer && module) {
2783     PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
2784   } else {
2785     Py_XDECREF(pointer);
2786   }
2787 #endif
2788 }
2789 
2790 /* The python cached type query */
2791 SWIGRUNTIME PyObject *
SWIG_Python_TypeCache(void)2792 SWIG_Python_TypeCache(void) {
2793   static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2794   return cache;
2795 }
2796 
2797 SWIGRUNTIME swig_type_info *
SWIG_Python_TypeQuery(const char * type)2798 SWIG_Python_TypeQuery(const char *type)
2799 {
2800   PyObject *cache = SWIG_Python_TypeCache();
2801   PyObject *key = SWIG_Python_str_FromChar(type);
2802   PyObject *obj = PyDict_GetItem(cache, key);
2803   swig_type_info *descriptor;
2804   if (obj) {
2805 #ifdef SWIGPY_USE_CAPSULE
2806     descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2807 #else
2808     descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
2809 #endif
2810   } else {
2811     swig_module_info *swig_module = SWIG_GetModule(0);
2812     descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2813     if (descriptor) {
2814 #ifdef SWIGPY_USE_CAPSULE
2815       obj = PyCapsule_New((void*) descriptor, NULL, NULL);
2816 #else
2817       obj = PyCObject_FromVoidPtr(descriptor, NULL);
2818 #endif
2819       PyDict_SetItem(cache, key, obj);
2820       Py_DECREF(obj);
2821     }
2822   }
2823   Py_DECREF(key);
2824   return descriptor;
2825 }
2826 
2827 /*
2828    For backward compatibility only
2829 */
2830 #define SWIG_POINTER_EXCEPTION  0
2831 #define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
2832 #define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)
2833 
2834 SWIGRUNTIME int
SWIG_Python_AddErrMesg(const char * mesg,int infront)2835 SWIG_Python_AddErrMesg(const char* mesg, int infront)
2836 {
2837   if (PyErr_Occurred()) {
2838     PyObject *type = 0;
2839     PyObject *value = 0;
2840     PyObject *traceback = 0;
2841     PyErr_Fetch(&type, &value, &traceback);
2842     if (value) {
2843       char *tmp;
2844       PyObject *old_str = PyObject_Str(value);
2845       Py_XINCREF(type);
2846       PyErr_Clear();
2847       if (infront) {
2848         PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
2849       } else {
2850         PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
2851       }
2852       SWIG_Python_str_DelForPy3(tmp);
2853       Py_DECREF(old_str);
2854     }
2855     return 1;
2856   } else {
2857     return 0;
2858   }
2859 }
2860 
2861 SWIGRUNTIME int
SWIG_Python_ArgFail(int argnum)2862 SWIG_Python_ArgFail(int argnum)
2863 {
2864   if (PyErr_Occurred()) {
2865     /* add information about failing argument */
2866     char mesg[256];
2867     PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2868     return SWIG_Python_AddErrMesg(mesg, 1);
2869   } else {
2870     return 0;
2871   }
2872 }
2873 
2874 SWIGRUNTIMEINLINE const char *
SwigPyObject_GetDesc(PyObject * self)2875 SwigPyObject_GetDesc(PyObject *self)
2876 {
2877   SwigPyObject *v = (SwigPyObject *)self;
2878   swig_type_info *ty = v ? v->ty : 0;
2879   return ty ? ty->str : "";
2880 }
2881 
2882 SWIGRUNTIME void
SWIG_Python_TypeError(const char * type,PyObject * obj)2883 SWIG_Python_TypeError(const char *type, PyObject *obj)
2884 {
2885   if (type) {
2886 #if defined(SWIG_COBJECT_TYPES)
2887     if (obj && SwigPyObject_Check(obj)) {
2888       const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2889       if (otype) {
2890         PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2891                      type, otype);
2892         return;
2893       }
2894     } else
2895 #endif
2896     {
2897       const char *otype = (obj ? obj->ob_type->tp_name : 0);
2898       if (otype) {
2899         PyObject *str = PyObject_Str(obj);
2900         const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2901         if (cstr) {
2902           PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2903                        type, otype, cstr);
2904           SWIG_Python_str_DelForPy3(cstr);
2905         } else {
2906           PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2907                        type, otype);
2908         }
2909         Py_XDECREF(str);
2910         return;
2911       }
2912     }
2913     PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2914   } else {
2915     PyErr_Format(PyExc_TypeError, "unexpected type is received");
2916   }
2917 }
2918 
2919 
2920 /* Convert a pointer value, signal an exception on a type mismatch */
2921 SWIGRUNTIME void *
SWIG_Python_MustGetPtr(PyObject * obj,swig_type_info * ty,int SWIGUNUSEDPARM (argnum),int flags)2922 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
2923   void *result;
2924   if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2925     PyErr_Clear();
2926 #if SWIG_POINTER_EXCEPTION
2927     if (flags) {
2928       SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2929       SWIG_Python_ArgFail(argnum);
2930     }
2931 #endif
2932   }
2933   return result;
2934 }
2935 
2936 #ifdef SWIGPYTHON_BUILTIN
2937 SWIGRUNTIME int
SWIG_Python_NonDynamicSetAttr(PyObject * obj,PyObject * name,PyObject * value)2938 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
2939   PyTypeObject *tp = obj->ob_type;
2940   PyObject *descr;
2941   PyObject *encoded_name;
2942   descrsetfunc f;
2943   int res = -1;
2944 
2945 # ifdef Py_USING_UNICODE
2946   if (PyString_Check(name)) {
2947     name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2948     if (!name)
2949       return -1;
2950   } else if (!PyUnicode_Check(name))
2951 # else
2952   if (!PyString_Check(name))
2953 # endif
2954   {
2955     PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2956     return -1;
2957   } else {
2958     Py_INCREF(name);
2959   }
2960 
2961   if (!tp->tp_dict) {
2962     if (PyType_Ready(tp) < 0)
2963       goto done;
2964   }
2965 
2966   descr = _PyType_Lookup(tp, name);
2967   f = NULL;
2968   if (descr != NULL)
2969     f = descr->ob_type->tp_descr_set;
2970   if (!f) {
2971     if (PyString_Check(name)) {
2972       encoded_name = name;
2973       Py_INCREF(name);
2974     } else {
2975       encoded_name = PyUnicode_AsUTF8String(name);
2976     }
2977     PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2978     Py_DECREF(encoded_name);
2979   } else {
2980     res = f(descr, obj, value);
2981   }
2982 
2983   done:
2984   Py_DECREF(name);
2985   return res;
2986 }
2987 #endif
2988 
2989 
2990 #ifdef __cplusplus
2991 }
2992 #endif
2993 
2994 
2995 
2996 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2997 
2998 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2999 
3000 
3001 
3002   #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0)
3003 
3004 
3005 /* -------- TYPES TABLE (BEGIN) -------- */
3006 
3007 #define SWIGTYPE_p_char swig_types[0]
3008 #define SWIGTYPE_p_int swig_types[1]
3009 #define SWIGTYPE_p_uint8_t swig_types[2]
3010 static swig_type_info *swig_types[4];
3011 static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0};
3012 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
3013 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
3014 
3015 /* -------- TYPES TABLE (END) -------- */
3016 
3017 #if (PY_VERSION_HEX <= 0x02000000)
3018 # if !defined(SWIG_PYTHON_CLASSIC)
3019 #  error "This python version requires swig to be run with the '-classic' option"
3020 # endif
3021 #endif
3022 
3023 /*-----------------------------------------------
3024               @(target):= _libwebp.so
3025   ------------------------------------------------*/
3026 #if PY_VERSION_HEX >= 0x03000000
3027 #  define SWIG_init    PyInit__libwebp
3028 
3029 #else
3030 #  define SWIG_init    init_libwebp
3031 
3032 #endif
3033 #define SWIG_name    "_libwebp"
3034 
3035 #define SWIGVERSION 0x030012
3036 #define SWIG_VERSION SWIGVERSION
3037 
3038 
3039 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
3040 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
3041 
3042 
3043 SWIGINTERNINLINE PyObject*
SWIG_From_int(int value)3044   SWIG_From_int  (int value)
3045 {
3046   return PyInt_FromLong((long) value);
3047 }
3048 
3049 
3050 SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)3051 SWIG_pchar_descriptor(void)
3052 {
3053   static int init = 0;
3054   static swig_type_info* info = 0;
3055   if (!init) {
3056     info = SWIG_TypeQuery("_p_char");
3057     init = 1;
3058   }
3059   return info;
3060 }
3061 
3062 
3063 SWIGINTERN int
SWIG_AsCharPtrAndSize(PyObject * obj,char ** cptr,size_t * psize,int * alloc)3064 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
3065 {
3066 #if PY_VERSION_HEX>=0x03000000
3067 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3068   if (PyBytes_Check(obj))
3069 #else
3070   if (PyUnicode_Check(obj))
3071 #endif
3072 #else
3073   if (PyString_Check(obj))
3074 #endif
3075   {
3076     char *cstr; Py_ssize_t len;
3077 #if PY_VERSION_HEX>=0x03000000
3078 #if !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3079     if (!alloc && cptr) {
3080         /* We can't allow converting without allocation, since the internal
3081            representation of string in Python 3 is UCS-2/UCS-4 but we require
3082            a UTF-8 representation.
3083            TODO(bhy) More detailed explanation */
3084         return SWIG_RuntimeError;
3085     }
3086     obj = PyUnicode_AsUTF8String(obj);
3087     if(alloc) *alloc = SWIG_NEWOBJ;
3088 #endif
3089     PyBytes_AsStringAndSize(obj, &cstr, &len);
3090 #else
3091     PyString_AsStringAndSize(obj, &cstr, &len);
3092 #endif
3093     if (cptr) {
3094       if (alloc) {
3095         /*
3096            In python the user should not be able to modify the inner
3097            string representation. To warranty that, if you define
3098            SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
3099            buffer is always returned.
3100 
3101            The default behavior is just to return the pointer value,
3102            so, be careful.
3103         */
3104 #if defined(SWIG_PYTHON_SAFE_CSTRINGS)
3105         if (*alloc != SWIG_OLDOBJ)
3106 #else
3107         if (*alloc == SWIG_NEWOBJ)
3108 #endif
3109         {
3110           *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
3111           *alloc = SWIG_NEWOBJ;
3112         } else {
3113           *cptr = cstr;
3114           *alloc = SWIG_OLDOBJ;
3115         }
3116       } else {
3117 #if PY_VERSION_HEX>=0x03000000
3118 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3119         *cptr = PyBytes_AsString(obj);
3120 #else
3121         assert(0); /* Should never reach here with Unicode strings in Python 3 */
3122 #endif
3123 #else
3124         *cptr = SWIG_Python_str_AsChar(obj);
3125 #endif
3126       }
3127     }
3128     if (psize) *psize = len + 1;
3129 #if PY_VERSION_HEX>=0x03000000 && !defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3130     Py_XDECREF(obj);
3131 #endif
3132     return SWIG_OK;
3133   } else {
3134 #if defined(SWIG_PYTHON_2_UNICODE)
3135 #if defined(SWIG_PYTHON_STRICT_BYTE_CHAR)
3136 #error "Cannot use both SWIG_PYTHON_2_UNICODE and SWIG_PYTHON_STRICT_BYTE_CHAR at once"
3137 #endif
3138 #if PY_VERSION_HEX<0x03000000
3139     if (PyUnicode_Check(obj)) {
3140       char *cstr; Py_ssize_t len;
3141       if (!alloc && cptr) {
3142         return SWIG_RuntimeError;
3143       }
3144       obj = PyUnicode_AsUTF8String(obj);
3145       if (PyString_AsStringAndSize(obj, &cstr, &len) != -1) {
3146         if (cptr) {
3147           if (alloc) *alloc = SWIG_NEWOBJ;
3148           *cptr = (char *)memcpy(malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
3149         }
3150         if (psize) *psize = len + 1;
3151 
3152         Py_XDECREF(obj);
3153         return SWIG_OK;
3154       } else {
3155         Py_XDECREF(obj);
3156       }
3157     }
3158 #endif
3159 #endif
3160 
3161     swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
3162     if (pchar_descriptor) {
3163       void* vptr = 0;
3164       if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
3165         if (cptr) *cptr = (char *) vptr;
3166         if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
3167         if (alloc) *alloc = SWIG_OLDOBJ;
3168         return SWIG_OK;
3169       }
3170     }
3171   }
3172   return SWIG_TypeError;
3173 }
3174 
3175 
3176 SWIGINTERN int
SWIG_AsVal_double(PyObject * obj,double * val)3177 SWIG_AsVal_double (PyObject *obj, double *val)
3178 {
3179   int res = SWIG_TypeError;
3180   if (PyFloat_Check(obj)) {
3181     if (val) *val = PyFloat_AsDouble(obj);
3182     return SWIG_OK;
3183 #if PY_VERSION_HEX < 0x03000000
3184   } else if (PyInt_Check(obj)) {
3185     if (val) *val = (double) PyInt_AsLong(obj);
3186     return SWIG_OK;
3187 #endif
3188   } else if (PyLong_Check(obj)) {
3189     double v = PyLong_AsDouble(obj);
3190     if (!PyErr_Occurred()) {
3191       if (val) *val = v;
3192       return SWIG_OK;
3193     } else {
3194       PyErr_Clear();
3195     }
3196   }
3197 #ifdef SWIG_PYTHON_CAST_MODE
3198   {
3199     int dispatch = 0;
3200     double d = PyFloat_AsDouble(obj);
3201     if (!PyErr_Occurred()) {
3202       if (val) *val = d;
3203       return SWIG_AddCast(SWIG_OK);
3204     } else {
3205       PyErr_Clear();
3206     }
3207     if (!dispatch) {
3208       long v = PyLong_AsLong(obj);
3209       if (!PyErr_Occurred()) {
3210         if (val) *val = v;
3211         return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
3212       } else {
3213         PyErr_Clear();
3214       }
3215     }
3216   }
3217 #endif
3218   return res;
3219 }
3220 
3221 
3222 #include <float.h>
3223 
3224 
3225 #include <math.h>
3226 
3227 
3228 SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double * d,double min,double max)3229 SWIG_CanCastAsInteger(double *d, double min, double max) {
3230   double x = *d;
3231   if ((min <= x && x <= max)) {
3232    double fx = floor(x);
3233    double cx = ceil(x);
3234    double rd =  ((x - fx) < 0.5) ? fx : cx; /* simple rint */
3235    if ((errno == EDOM) || (errno == ERANGE)) {
3236      errno = 0;
3237    } else {
3238      double summ, reps, diff;
3239      if (rd < x) {
3240        diff = x - rd;
3241      } else if (rd > x) {
3242        diff = rd - x;
3243      } else {
3244        return 1;
3245      }
3246      summ = rd + x;
3247      reps = diff/summ;
3248      if (reps < 8*DBL_EPSILON) {
3249        *d = rd;
3250        return 1;
3251      }
3252    }
3253   }
3254   return 0;
3255 }
3256 
3257 
3258 SWIGINTERN int
SWIG_AsVal_unsigned_SS_long(PyObject * obj,unsigned long * val)3259 SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
3260 {
3261 #if PY_VERSION_HEX < 0x03000000
3262   if (PyInt_Check(obj)) {
3263     long v = PyInt_AsLong(obj);
3264     if (v >= 0) {
3265       if (val) *val = v;
3266       return SWIG_OK;
3267     } else {
3268       return SWIG_OverflowError;
3269     }
3270   } else
3271 #endif
3272   if (PyLong_Check(obj)) {
3273     unsigned long v = PyLong_AsUnsignedLong(obj);
3274     if (!PyErr_Occurred()) {
3275       if (val) *val = v;
3276       return SWIG_OK;
3277     } else {
3278       PyErr_Clear();
3279       return SWIG_OverflowError;
3280     }
3281   }
3282 #ifdef SWIG_PYTHON_CAST_MODE
3283   {
3284     int dispatch = 0;
3285     unsigned long v = PyLong_AsUnsignedLong(obj);
3286     if (!PyErr_Occurred()) {
3287       if (val) *val = v;
3288       return SWIG_AddCast(SWIG_OK);
3289     } else {
3290       PyErr_Clear();
3291     }
3292     if (!dispatch) {
3293       double d;
3294       int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
3295       if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
3296         if (val) *val = (unsigned long)(d);
3297         return res;
3298       }
3299     }
3300   }
3301 #endif
3302   return SWIG_TypeError;
3303 }
3304 
3305 
3306 #include <limits.h>
3307 #if !defined(SWIG_NO_LLONG_MAX)
3308 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
3309 #   define LLONG_MAX __LONG_LONG_MAX__
3310 #   define LLONG_MIN (-LLONG_MAX - 1LL)
3311 #   define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
3312 # endif
3313 #endif
3314 
3315 
3316 #if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE)
3317 #  define SWIG_LONG_LONG_AVAILABLE
3318 #endif
3319 
3320 
3321 #ifdef SWIG_LONG_LONG_AVAILABLE
3322 SWIGINTERN int
SWIG_AsVal_unsigned_SS_long_SS_long(PyObject * obj,unsigned long long * val)3323 SWIG_AsVal_unsigned_SS_long_SS_long (PyObject *obj, unsigned long long *val)
3324 {
3325   int res = SWIG_TypeError;
3326   if (PyLong_Check(obj)) {
3327     unsigned long long v = PyLong_AsUnsignedLongLong(obj);
3328     if (!PyErr_Occurred()) {
3329       if (val) *val = v;
3330       return SWIG_OK;
3331     } else {
3332       PyErr_Clear();
3333       res = SWIG_OverflowError;
3334     }
3335   } else {
3336     unsigned long v;
3337     res = SWIG_AsVal_unsigned_SS_long (obj,&v);
3338     if (SWIG_IsOK(res)) {
3339       if (val) *val = v;
3340       return res;
3341     }
3342   }
3343 #ifdef SWIG_PYTHON_CAST_MODE
3344   {
3345     const double mant_max = 1LL << DBL_MANT_DIG;
3346     double d;
3347     res = SWIG_AsVal_double (obj,&d);
3348     if (SWIG_IsOK(res) && !SWIG_CanCastAsInteger(&d, 0, mant_max))
3349       return SWIG_OverflowError;
3350     if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, mant_max)) {
3351       if (val) *val = (unsigned long long)(d);
3352       return SWIG_AddCast(res);
3353     }
3354     res = SWIG_TypeError;
3355   }
3356 #endif
3357   return res;
3358 }
3359 #endif
3360 
3361 
3362 SWIGINTERNINLINE int
SWIG_AsVal_size_t(PyObject * obj,size_t * val)3363 SWIG_AsVal_size_t (PyObject * obj, size_t *val)
3364 {
3365   int res = SWIG_TypeError;
3366 #ifdef SWIG_LONG_LONG_AVAILABLE
3367   if (sizeof(size_t) <= sizeof(unsigned long)) {
3368 #endif
3369     unsigned long v;
3370     res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
3371     if (SWIG_IsOK(res) && val) *val = (size_t)(v);
3372 #ifdef SWIG_LONG_LONG_AVAILABLE
3373   } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
3374     unsigned long long v;
3375     res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0);
3376     if (SWIG_IsOK(res) && val) *val = (size_t)(v);
3377   }
3378 #endif
3379   return res;
3380 }
3381 
3382 
3383 #include "webp/decode.h"
3384 #include "webp/encode.h"
3385 
3386 
ReturnedBufferSize(const char * function,int * width,int * height)3387 static size_t ReturnedBufferSize(
3388     const char* function, int* width, int* height) {
3389   static const struct sizemap {
3390     const char* function;
3391     int size_multiplier;
3392   } size_map[] = {
3393 #ifdef SWIGJAVA
3394     { "Java_com_google_webp_libwebpJNI_WebPDecodeRGB",  3 },
3395     { "Java_com_google_webp_libwebpJNI_WebPDecodeRGBA", 4 },
3396     { "Java_com_google_webp_libwebpJNI_WebPDecodeARGB", 4 },
3397     { "Java_com_google_webp_libwebpJNI_WebPDecodeBGR",  3 },
3398     { "Java_com_google_webp_libwebpJNI_WebPDecodeBGRA", 4 },
3399     { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB",  1 },
3400     { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGR",  1 },
3401     { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGBA", 1 },
3402     { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGRA", 1 },
3403     { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessRGB",  1 },
3404     { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessBGR",  1 },
3405     { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessRGBA", 1 },
3406     { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessBGRA", 1 },
3407 #endif
3408 #ifdef SWIGPYTHON
3409     { "WebPDecodeRGB",  3 },
3410     { "WebPDecodeRGBA", 4 },
3411     { "WebPDecodeARGB", 4 },
3412     { "WebPDecodeBGR",  3 },
3413     { "WebPDecodeBGRA", 4 },
3414     { "wrap_WebPEncodeRGB",  1 },
3415     { "wrap_WebPEncodeBGR",  1 },
3416     { "wrap_WebPEncodeRGBA", 1 },
3417     { "wrap_WebPEncodeBGRA", 1 },
3418     { "wrap_WebPEncodeLosslessRGB",  1 },
3419     { "wrap_WebPEncodeLosslessBGR",  1 },
3420     { "wrap_WebPEncodeLosslessRGBA", 1 },
3421     { "wrap_WebPEncodeLosslessBGRA", 1 },
3422 #endif
3423     { NULL, 0 }
3424   };
3425   const struct sizemap* p;
3426   size_t size = 0;
3427 
3428   for (p = size_map; p->function; ++p) {
3429     if (!strcmp(function, p->function)) {
3430       size = *width * *height * p->size_multiplier;
3431       break;
3432     }
3433   }
3434 
3435   return size;
3436 }
3437 
3438 
3439 typedef size_t (*WebPEncodeFunction)(const uint8_t* rgb,
3440                                      int width, int height, int stride,
3441                                      float quality_factor, uint8_t** output);
3442 typedef size_t (*WebPEncodeLosslessFunction)(const uint8_t* rgb,
3443                                              int width, int height, int stride,
3444                                              uint8_t** output);
3445 
EncodeLossy(const uint8_t * rgb,int width,int height,int stride,float quality_factor,WebPEncodeFunction encfn,int * output_size,int * unused)3446 static uint8_t* EncodeLossy(const uint8_t* rgb,
3447                             int width, int height, int stride,
3448                             float quality_factor,
3449                             WebPEncodeFunction encfn,
3450                             int* output_size, int* unused) {
3451   uint8_t* output = NULL;
3452   const size_t image_size =
3453       encfn(rgb, width, height, stride, quality_factor, &output);
3454   // the values of following two will be interpreted by ReturnedBufferSize()
3455   // as 'width' and 'height' in the size calculation.
3456   *output_size = image_size;
3457   *unused = 1;
3458   return image_size ? output : NULL;
3459 }
3460 
EncodeLossless(const uint8_t * rgb,int width,int height,int stride,WebPEncodeLosslessFunction encfn,int * output_size,int * unused)3461 static uint8_t* EncodeLossless(const uint8_t* rgb,
3462                                int width, int height, int stride,
3463                                WebPEncodeLosslessFunction encfn,
3464                                int* output_size, int* unused) {
3465   uint8_t* output = NULL;
3466   const size_t image_size = encfn(rgb, width, height, stride, &output);
3467   // the values of the following two will be interpreted by
3468   // ReturnedBufferSize() as 'width' and 'height' in the size calculation.
3469   *output_size = image_size;
3470   *unused = 1;
3471   return image_size ? output : NULL;
3472 }
3473 
3474 
3475 // Changes the return type of WebPEncode* to more closely match Decode*.
3476 // This also makes it easier to wrap the output buffer in a native type rather
3477 // than dealing with the return pointer.
3478 // The additional parameters are to allow reuse of ReturnedBufferSize(),
3479 // unused2 and output_size will be used in this case.
3480 #define LOSSY_WRAPPER(FUNC)                                             \
3481   static uint8_t* wrap_##FUNC(                                          \
3482       const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
3483       int width, int height, int stride, float quality_factor) {        \
3484     return EncodeLossy(rgb, width, height, stride, quality_factor,      \
3485                        FUNC, output_size, unused2);                     \
3486   }                                                                     \
3487 
3488 LOSSY_WRAPPER(WebPEncodeRGB)
LOSSY_WRAPPER(WebPEncodeBGR)3489 LOSSY_WRAPPER(WebPEncodeBGR)
3490 LOSSY_WRAPPER(WebPEncodeRGBA)
3491 LOSSY_WRAPPER(WebPEncodeBGRA)
3492 
3493 #undef LOSSY_WRAPPER
3494 
3495 #define LOSSLESS_WRAPPER(FUNC)                                          \
3496   static uint8_t* wrap_##FUNC(                                          \
3497       const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
3498       int width, int height, int stride) {                              \
3499     return EncodeLossless(rgb, width, height, stride,                   \
3500                           FUNC, output_size, unused2);                  \
3501   }                                                                     \
3502 
3503 LOSSLESS_WRAPPER(WebPEncodeLosslessRGB)
3504 LOSSLESS_WRAPPER(WebPEncodeLosslessBGR)
3505 LOSSLESS_WRAPPER(WebPEncodeLosslessRGBA)
3506 LOSSLESS_WRAPPER(WebPEncodeLosslessBGRA)
3507 
3508 #undef LOSSLESS_WRAPPER
3509 
3510 
3511 
3512 SWIGINTERN int
3513 SWIG_AsVal_long (PyObject *obj, long* val)
3514 {
3515 #if PY_VERSION_HEX < 0x03000000
3516   if (PyInt_Check(obj)) {
3517     if (val) *val = PyInt_AsLong(obj);
3518     return SWIG_OK;
3519   } else
3520 #endif
3521   if (PyLong_Check(obj)) {
3522     long v = PyLong_AsLong(obj);
3523     if (!PyErr_Occurred()) {
3524       if (val) *val = v;
3525       return SWIG_OK;
3526     } else {
3527       PyErr_Clear();
3528       return SWIG_OverflowError;
3529     }
3530   }
3531 #ifdef SWIG_PYTHON_CAST_MODE
3532   {
3533     int dispatch = 0;
3534     long v = PyInt_AsLong(obj);
3535     if (!PyErr_Occurred()) {
3536       if (val) *val = v;
3537       return SWIG_AddCast(SWIG_OK);
3538     } else {
3539       PyErr_Clear();
3540     }
3541     if (!dispatch) {
3542       double d;
3543       int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
3544       if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
3545         if (val) *val = (long)(d);
3546         return res;
3547       }
3548     }
3549   }
3550 #endif
3551   return SWIG_TypeError;
3552 }
3553 
3554 
3555 SWIGINTERN int
SWIG_AsVal_int(PyObject * obj,int * val)3556 SWIG_AsVal_int (PyObject * obj, int *val)
3557 {
3558   long v;
3559   int res = SWIG_AsVal_long (obj, &v);
3560   if (SWIG_IsOK(res)) {
3561     if ((v < INT_MIN || v > INT_MAX)) {
3562       return SWIG_OverflowError;
3563     } else {
3564       if (val) *val = (int)(v);
3565     }
3566   }
3567   return res;
3568 }
3569 
3570 
3571 /* Getting isfinite working pre C99 across multiple platforms is non-trivial. Users can provide SWIG_isfinite on older platforms. */
3572 #ifndef SWIG_isfinite
3573 /* isfinite() is a macro for C99 */
3574 # if defined(isfinite)
3575 #  define SWIG_isfinite(X) (isfinite(X))
3576 # elif defined __cplusplus && __cplusplus >= 201103L
3577 /* Use a template so that this works whether isfinite() is std::isfinite() or
3578  * in the global namespace.  The reality seems to vary between compiler
3579  * versions.
3580  *
3581  * Make sure namespace std exists to avoid compiler warnings.
3582  *
3583  * extern "C++" is required as this fragment can end up inside an extern "C" { } block
3584  */
3585 namespace std { }
3586 extern "C++" template<typename T>
SWIG_isfinite_func(T x)3587 inline int SWIG_isfinite_func(T x) {
3588   using namespace std;
3589   return isfinite(x);
3590 }
3591 #  define SWIG_isfinite(X) (SWIG_isfinite_func(X))
3592 # elif defined(_MSC_VER)
3593 #  define SWIG_isfinite(X) (_finite(X))
3594 # elif defined(__sun) && defined(__SVR4)
3595 #  include <ieeefp.h>
3596 #  define SWIG_isfinite(X) (finite(X))
3597 # endif
3598 #endif
3599 
3600 
3601 /* Accept infinite as a valid float value unless we are unable to check if a value is finite */
3602 #ifdef SWIG_isfinite
3603 # define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX) && SWIG_isfinite(X))
3604 #else
3605 # define SWIG_Float_Overflow_Check(X) ((X < -FLT_MAX || X > FLT_MAX))
3606 #endif
3607 
3608 
3609 SWIGINTERN int
SWIG_AsVal_float(PyObject * obj,float * val)3610 SWIG_AsVal_float (PyObject * obj, float *val)
3611 {
3612   double v;
3613   int res = SWIG_AsVal_double (obj, &v);
3614   if (SWIG_IsOK(res)) {
3615     if (SWIG_Float_Overflow_Check(v)) {
3616       return SWIG_OverflowError;
3617     } else {
3618       if (val) *val = (float)(v);
3619     }
3620   }
3621   return res;
3622 }
3623 
3624 #ifdef __cplusplus
3625 extern "C" {
3626 #endif
_wrap_WebPGetDecoderVersion(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3627 SWIGINTERN PyObject *_wrap_WebPGetDecoderVersion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3628   PyObject *resultobj = 0;
3629   int result;
3630 
3631   if (!PyArg_ParseTuple(args,(char *)":WebPGetDecoderVersion")) SWIG_fail;
3632   result = (int)WebPGetDecoderVersion();
3633   resultobj = SWIG_From_int((int)(result));
3634   return resultobj;
3635 fail:
3636   return NULL;
3637 }
3638 
3639 
_wrap_WebPGetInfo(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3640 SWIGINTERN PyObject *_wrap_WebPGetInfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3641   PyObject *resultobj = 0;
3642   uint8_t *arg1 = (uint8_t *) 0 ;
3643   size_t arg2 ;
3644   int *arg3 = (int *) 0 ;
3645   int *arg4 = (int *) 0 ;
3646   int res1 ;
3647   char *buf1 = 0 ;
3648   size_t size1 = 0 ;
3649   int alloc1 = 0 ;
3650   int temp3 ;
3651   int res3 = SWIG_TMPOBJ ;
3652   int temp4 ;
3653   int res4 = SWIG_TMPOBJ ;
3654   PyObject * obj0 = 0 ;
3655   int result;
3656 
3657   arg3 = &temp3;
3658   arg4 = &temp4;
3659   if (!PyArg_ParseTuple(args,(char *)"O:WebPGetInfo",&obj0)) SWIG_fail;
3660   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3661   if (!SWIG_IsOK(res1)) {
3662     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPGetInfo" "', argument " "1"" of type '" "uint8_t const *""'");
3663   }
3664   arg1 = (uint8_t *)(buf1);
3665   arg2 = (size_t)(size1 - 1);
3666   result = (int)WebPGetInfo((uint8_t const *)arg1,arg2,arg3,arg4);
3667   resultobj = SWIG_From_int((int)(result));
3668   if (SWIG_IsTmpObj(res3)) {
3669     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3670   } else {
3671     int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3672     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3673   }
3674   if (SWIG_IsTmpObj(res4)) {
3675     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3676   } else {
3677     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3678     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3679   }
3680   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3681   return resultobj;
3682 fail:
3683   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3684   return NULL;
3685 }
3686 
3687 
_wrap_WebPDecodeRGB(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3688 SWIGINTERN PyObject *_wrap_WebPDecodeRGB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3689   PyObject *resultobj = 0;
3690   uint8_t *arg1 = (uint8_t *) 0 ;
3691   size_t arg2 ;
3692   int *arg3 = (int *) 0 ;
3693   int *arg4 = (int *) 0 ;
3694   int res1 ;
3695   char *buf1 = 0 ;
3696   size_t size1 = 0 ;
3697   int alloc1 = 0 ;
3698   int temp3 ;
3699   int res3 = SWIG_TMPOBJ ;
3700   int temp4 ;
3701   int res4 = SWIG_TMPOBJ ;
3702   PyObject * obj0 = 0 ;
3703   uint8_t *result = 0 ;
3704 
3705   arg3 = &temp3;
3706   arg4 = &temp4;
3707   if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeRGB",&obj0)) SWIG_fail;
3708   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3709   if (!SWIG_IsOK(res1)) {
3710     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeRGB" "', argument " "1"" of type '" "uint8_t const *""'");
3711   }
3712   arg1 = (uint8_t *)(buf1);
3713   arg2 = (size_t)(size1 - 1);
3714   result = (uint8_t *)WebPDecodeRGB((uint8_t const *)arg1,arg2,arg3,arg4);
3715   {
3716     resultobj = PyString_FromStringAndSize(
3717       (const char*)result,
3718       (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeRGB", arg3, arg4));
3719   }
3720   if (SWIG_IsTmpObj(res3)) {
3721     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3722   } else {
3723     int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3724     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3725   }
3726   if (SWIG_IsTmpObj(res4)) {
3727     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3728   } else {
3729     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3730     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3731   }
3732   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3733   free(result);
3734   return resultobj;
3735 fail:
3736   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3737   return NULL;
3738 }
3739 
3740 
_wrap_WebPDecodeRGBA(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3741 SWIGINTERN PyObject *_wrap_WebPDecodeRGBA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3742   PyObject *resultobj = 0;
3743   uint8_t *arg1 = (uint8_t *) 0 ;
3744   size_t arg2 ;
3745   int *arg3 = (int *) 0 ;
3746   int *arg4 = (int *) 0 ;
3747   int res1 ;
3748   char *buf1 = 0 ;
3749   size_t size1 = 0 ;
3750   int alloc1 = 0 ;
3751   int temp3 ;
3752   int res3 = SWIG_TMPOBJ ;
3753   int temp4 ;
3754   int res4 = SWIG_TMPOBJ ;
3755   PyObject * obj0 = 0 ;
3756   uint8_t *result = 0 ;
3757 
3758   arg3 = &temp3;
3759   arg4 = &temp4;
3760   if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeRGBA",&obj0)) SWIG_fail;
3761   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3762   if (!SWIG_IsOK(res1)) {
3763     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeRGBA" "', argument " "1"" of type '" "uint8_t const *""'");
3764   }
3765   arg1 = (uint8_t *)(buf1);
3766   arg2 = (size_t)(size1 - 1);
3767   result = (uint8_t *)WebPDecodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4);
3768   {
3769     resultobj = PyString_FromStringAndSize(
3770       (const char*)result,
3771       (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeRGBA", arg3, arg4));
3772   }
3773   if (SWIG_IsTmpObj(res3)) {
3774     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3775   } else {
3776     int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3777     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3778   }
3779   if (SWIG_IsTmpObj(res4)) {
3780     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3781   } else {
3782     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3783     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3784   }
3785   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3786   free(result);
3787   return resultobj;
3788 fail:
3789   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3790   return NULL;
3791 }
3792 
3793 
_wrap_WebPDecodeARGB(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3794 SWIGINTERN PyObject *_wrap_WebPDecodeARGB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3795   PyObject *resultobj = 0;
3796   uint8_t *arg1 = (uint8_t *) 0 ;
3797   size_t arg2 ;
3798   int *arg3 = (int *) 0 ;
3799   int *arg4 = (int *) 0 ;
3800   int res1 ;
3801   char *buf1 = 0 ;
3802   size_t size1 = 0 ;
3803   int alloc1 = 0 ;
3804   int temp3 ;
3805   int res3 = SWIG_TMPOBJ ;
3806   int temp4 ;
3807   int res4 = SWIG_TMPOBJ ;
3808   PyObject * obj0 = 0 ;
3809   uint8_t *result = 0 ;
3810 
3811   arg3 = &temp3;
3812   arg4 = &temp4;
3813   if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeARGB",&obj0)) SWIG_fail;
3814   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3815   if (!SWIG_IsOK(res1)) {
3816     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeARGB" "', argument " "1"" of type '" "uint8_t const *""'");
3817   }
3818   arg1 = (uint8_t *)(buf1);
3819   arg2 = (size_t)(size1 - 1);
3820   result = (uint8_t *)WebPDecodeARGB((uint8_t const *)arg1,arg2,arg3,arg4);
3821   {
3822     resultobj = PyString_FromStringAndSize(
3823       (const char*)result,
3824       (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeARGB", arg3, arg4));
3825   }
3826   if (SWIG_IsTmpObj(res3)) {
3827     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3828   } else {
3829     int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3830     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3831   }
3832   if (SWIG_IsTmpObj(res4)) {
3833     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3834   } else {
3835     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3836     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3837   }
3838   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3839   free(result);
3840   return resultobj;
3841 fail:
3842   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3843   return NULL;
3844 }
3845 
3846 
_wrap_WebPDecodeBGR(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3847 SWIGINTERN PyObject *_wrap_WebPDecodeBGR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3848   PyObject *resultobj = 0;
3849   uint8_t *arg1 = (uint8_t *) 0 ;
3850   size_t arg2 ;
3851   int *arg3 = (int *) 0 ;
3852   int *arg4 = (int *) 0 ;
3853   int res1 ;
3854   char *buf1 = 0 ;
3855   size_t size1 = 0 ;
3856   int alloc1 = 0 ;
3857   int temp3 ;
3858   int res3 = SWIG_TMPOBJ ;
3859   int temp4 ;
3860   int res4 = SWIG_TMPOBJ ;
3861   PyObject * obj0 = 0 ;
3862   uint8_t *result = 0 ;
3863 
3864   arg3 = &temp3;
3865   arg4 = &temp4;
3866   if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeBGR",&obj0)) SWIG_fail;
3867   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3868   if (!SWIG_IsOK(res1)) {
3869     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeBGR" "', argument " "1"" of type '" "uint8_t const *""'");
3870   }
3871   arg1 = (uint8_t *)(buf1);
3872   arg2 = (size_t)(size1 - 1);
3873   result = (uint8_t *)WebPDecodeBGR((uint8_t const *)arg1,arg2,arg3,arg4);
3874   {
3875     resultobj = PyString_FromStringAndSize(
3876       (const char*)result,
3877       (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeBGR", arg3, arg4));
3878   }
3879   if (SWIG_IsTmpObj(res3)) {
3880     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3881   } else {
3882     int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3883     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3884   }
3885   if (SWIG_IsTmpObj(res4)) {
3886     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3887   } else {
3888     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3889     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3890   }
3891   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3892   free(result);
3893   return resultobj;
3894 fail:
3895   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3896   return NULL;
3897 }
3898 
3899 
_wrap_WebPDecodeBGRA(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3900 SWIGINTERN PyObject *_wrap_WebPDecodeBGRA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3901   PyObject *resultobj = 0;
3902   uint8_t *arg1 = (uint8_t *) 0 ;
3903   size_t arg2 ;
3904   int *arg3 = (int *) 0 ;
3905   int *arg4 = (int *) 0 ;
3906   int res1 ;
3907   char *buf1 = 0 ;
3908   size_t size1 = 0 ;
3909   int alloc1 = 0 ;
3910   int temp3 ;
3911   int res3 = SWIG_TMPOBJ ;
3912   int temp4 ;
3913   int res4 = SWIG_TMPOBJ ;
3914   PyObject * obj0 = 0 ;
3915   uint8_t *result = 0 ;
3916 
3917   arg3 = &temp3;
3918   arg4 = &temp4;
3919   if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeBGRA",&obj0)) SWIG_fail;
3920   res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3921   if (!SWIG_IsOK(res1)) {
3922     SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeBGRA" "', argument " "1"" of type '" "uint8_t const *""'");
3923   }
3924   arg1 = (uint8_t *)(buf1);
3925   arg2 = (size_t)(size1 - 1);
3926   result = (uint8_t *)WebPDecodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4);
3927   {
3928     resultobj = PyString_FromStringAndSize(
3929       (const char*)result,
3930       (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeBGRA", arg3, arg4));
3931   }
3932   if (SWIG_IsTmpObj(res3)) {
3933     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3934   } else {
3935     int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3936     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3937   }
3938   if (SWIG_IsTmpObj(res4)) {
3939     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3940   } else {
3941     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
3942     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3943   }
3944   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3945   free(result);
3946   return resultobj;
3947 fail:
3948   if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3949   return NULL;
3950 }
3951 
3952 
_wrap_WebPGetEncoderVersion(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3953 SWIGINTERN PyObject *_wrap_WebPGetEncoderVersion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3954   PyObject *resultobj = 0;
3955   int result;
3956 
3957   if (!PyArg_ParseTuple(args,(char *)":WebPGetEncoderVersion")) SWIG_fail;
3958   result = (int)WebPGetEncoderVersion();
3959   resultobj = SWIG_From_int((int)(result));
3960   return resultobj;
3961 fail:
3962   return NULL;
3963 }
3964 
3965 
_wrap_wrap_WebPEncodeRGB(PyObject * SWIGUNUSEDPARM (self),PyObject * args)3966 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeRGB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3967   PyObject *resultobj = 0;
3968   uint8_t *arg1 = (uint8_t *) 0 ;
3969   int *arg2 = (int *) 0 ;
3970   int *arg3 = (int *) 0 ;
3971   int *arg4 = (int *) 0 ;
3972   int arg5 ;
3973   int arg6 ;
3974   int arg7 ;
3975   float arg8 ;
3976   Py_buffer rgb_buffer1 ;
3977   int temp2 ;
3978   int res2 = 0 ;
3979   int temp3 ;
3980   int res3 = 0 ;
3981   int temp4 ;
3982   int res4 = SWIG_TMPOBJ ;
3983   int val5 ;
3984   int ecode5 = 0 ;
3985   int val6 ;
3986   int ecode6 = 0 ;
3987   int val7 ;
3988   int ecode7 = 0 ;
3989   float val8 ;
3990   int ecode8 = 0 ;
3991   PyObject * obj0 = 0 ;
3992   PyObject * obj1 = 0 ;
3993   PyObject * obj2 = 0 ;
3994   PyObject * obj3 = 0 ;
3995   PyObject * obj4 = 0 ;
3996   PyObject * obj5 = 0 ;
3997   PyObject * obj6 = 0 ;
3998   uint8_t *result = 0 ;
3999 
4000   arg4 = &temp4;
4001   if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:wrap_WebPEncodeRGB",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
4002   {
4003     // NB: with Python < 2.6 the old style buffer protocol may be used:
4004     // Py_ssize_t unused;
4005     // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4006     if (!PyObject_CheckBuffer(obj0)) {
4007       SWIG_exception_fail(SWIG_TypeError,
4008         "in method 'wrap_WebPEncodeRGB', argument 1"
4009         " does not support the buffer interface");
4010     }
4011     if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4012       SWIG_exception_fail(SWIG_RuntimeError,
4013         "in method 'wrap_WebPEncodeRGB', unable to get buffer view");
4014     }
4015     arg1 = (uint8_t *)rgb_buffer1.buf;
4016   }
4017   if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4018     int val;
4019     int ecode = SWIG_AsVal_int(obj1, &val);
4020     if (!SWIG_IsOK(ecode)) {
4021       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeRGB" "', argument " "2"" of type '" "int""'");
4022     }
4023     temp2 = (int)(val);
4024     arg2 = &temp2;
4025     res2 = SWIG_AddTmpMask(ecode);
4026   }
4027   if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4028     int val;
4029     int ecode = SWIG_AsVal_int(obj2, &val);
4030     if (!SWIG_IsOK(ecode)) {
4031       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeRGB" "', argument " "3"" of type '" "int""'");
4032     }
4033     temp3 = (int)(val);
4034     arg3 = &temp3;
4035     res3 = SWIG_AddTmpMask(ecode);
4036   }
4037   ecode5 = SWIG_AsVal_int(obj3, &val5);
4038   if (!SWIG_IsOK(ecode5)) {
4039     SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeRGB" "', argument " "5"" of type '" "int""'");
4040   }
4041   arg5 = (int)(val5);
4042   ecode6 = SWIG_AsVal_int(obj4, &val6);
4043   if (!SWIG_IsOK(ecode6)) {
4044     SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeRGB" "', argument " "6"" of type '" "int""'");
4045   }
4046   arg6 = (int)(val6);
4047   ecode7 = SWIG_AsVal_int(obj5, &val7);
4048   if (!SWIG_IsOK(ecode7)) {
4049     SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeRGB" "', argument " "7"" of type '" "int""'");
4050   }
4051   arg7 = (int)(val7);
4052   ecode8 = SWIG_AsVal_float(obj6, &val8);
4053   if (!SWIG_IsOK(ecode8)) {
4054     SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "wrap_WebPEncodeRGB" "', argument " "8"" of type '" "float""'");
4055   }
4056   arg8 = (float)(val8);
4057   result = (uint8_t *)wrap_WebPEncodeRGB((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
4058   {
4059     resultobj = PyString_FromStringAndSize(
4060       (const char*)result,
4061       (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeRGB", arg3, arg4));
4062   }
4063   if (SWIG_IsTmpObj(res4)) {
4064     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4065   } else {
4066     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
4067     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4068   }
4069   {
4070     PyBuffer_Release(&rgb_buffer1);
4071   }
4072   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4073   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4074   free(result);
4075   return resultobj;
4076 fail:
4077   {
4078     PyBuffer_Release(&rgb_buffer1);
4079   }
4080   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4081   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4082   return NULL;
4083 }
4084 
4085 
_wrap_wrap_WebPEncodeBGR(PyObject * SWIGUNUSEDPARM (self),PyObject * args)4086 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeBGR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4087   PyObject *resultobj = 0;
4088   uint8_t *arg1 = (uint8_t *) 0 ;
4089   int *arg2 = (int *) 0 ;
4090   int *arg3 = (int *) 0 ;
4091   int *arg4 = (int *) 0 ;
4092   int arg5 ;
4093   int arg6 ;
4094   int arg7 ;
4095   float arg8 ;
4096   Py_buffer rgb_buffer1 ;
4097   int temp2 ;
4098   int res2 = 0 ;
4099   int temp3 ;
4100   int res3 = 0 ;
4101   int temp4 ;
4102   int res4 = SWIG_TMPOBJ ;
4103   int val5 ;
4104   int ecode5 = 0 ;
4105   int val6 ;
4106   int ecode6 = 0 ;
4107   int val7 ;
4108   int ecode7 = 0 ;
4109   float val8 ;
4110   int ecode8 = 0 ;
4111   PyObject * obj0 = 0 ;
4112   PyObject * obj1 = 0 ;
4113   PyObject * obj2 = 0 ;
4114   PyObject * obj3 = 0 ;
4115   PyObject * obj4 = 0 ;
4116   PyObject * obj5 = 0 ;
4117   PyObject * obj6 = 0 ;
4118   uint8_t *result = 0 ;
4119 
4120   arg4 = &temp4;
4121   if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:wrap_WebPEncodeBGR",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
4122   {
4123     // NB: with Python < 2.6 the old style buffer protocol may be used:
4124     // Py_ssize_t unused;
4125     // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4126     if (!PyObject_CheckBuffer(obj0)) {
4127       SWIG_exception_fail(SWIG_TypeError,
4128         "in method 'wrap_WebPEncodeBGR', argument 1"
4129         " does not support the buffer interface");
4130     }
4131     if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4132       SWIG_exception_fail(SWIG_RuntimeError,
4133         "in method 'wrap_WebPEncodeBGR', unable to get buffer view");
4134     }
4135     arg1 = (uint8_t *)rgb_buffer1.buf;
4136   }
4137   if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4138     int val;
4139     int ecode = SWIG_AsVal_int(obj1, &val);
4140     if (!SWIG_IsOK(ecode)) {
4141       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeBGR" "', argument " "2"" of type '" "int""'");
4142     }
4143     temp2 = (int)(val);
4144     arg2 = &temp2;
4145     res2 = SWIG_AddTmpMask(ecode);
4146   }
4147   if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4148     int val;
4149     int ecode = SWIG_AsVal_int(obj2, &val);
4150     if (!SWIG_IsOK(ecode)) {
4151       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeBGR" "', argument " "3"" of type '" "int""'");
4152     }
4153     temp3 = (int)(val);
4154     arg3 = &temp3;
4155     res3 = SWIG_AddTmpMask(ecode);
4156   }
4157   ecode5 = SWIG_AsVal_int(obj3, &val5);
4158   if (!SWIG_IsOK(ecode5)) {
4159     SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeBGR" "', argument " "5"" of type '" "int""'");
4160   }
4161   arg5 = (int)(val5);
4162   ecode6 = SWIG_AsVal_int(obj4, &val6);
4163   if (!SWIG_IsOK(ecode6)) {
4164     SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeBGR" "', argument " "6"" of type '" "int""'");
4165   }
4166   arg6 = (int)(val6);
4167   ecode7 = SWIG_AsVal_int(obj5, &val7);
4168   if (!SWIG_IsOK(ecode7)) {
4169     SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeBGR" "', argument " "7"" of type '" "int""'");
4170   }
4171   arg7 = (int)(val7);
4172   ecode8 = SWIG_AsVal_float(obj6, &val8);
4173   if (!SWIG_IsOK(ecode8)) {
4174     SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "wrap_WebPEncodeBGR" "', argument " "8"" of type '" "float""'");
4175   }
4176   arg8 = (float)(val8);
4177   result = (uint8_t *)wrap_WebPEncodeBGR((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
4178   {
4179     resultobj = PyString_FromStringAndSize(
4180       (const char*)result,
4181       (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeBGR", arg3, arg4));
4182   }
4183   if (SWIG_IsTmpObj(res4)) {
4184     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4185   } else {
4186     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
4187     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4188   }
4189   {
4190     PyBuffer_Release(&rgb_buffer1);
4191   }
4192   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4193   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4194   free(result);
4195   return resultobj;
4196 fail:
4197   {
4198     PyBuffer_Release(&rgb_buffer1);
4199   }
4200   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4201   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4202   return NULL;
4203 }
4204 
4205 
_wrap_wrap_WebPEncodeRGBA(PyObject * SWIGUNUSEDPARM (self),PyObject * args)4206 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeRGBA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4207   PyObject *resultobj = 0;
4208   uint8_t *arg1 = (uint8_t *) 0 ;
4209   int *arg2 = (int *) 0 ;
4210   int *arg3 = (int *) 0 ;
4211   int *arg4 = (int *) 0 ;
4212   int arg5 ;
4213   int arg6 ;
4214   int arg7 ;
4215   float arg8 ;
4216   Py_buffer rgb_buffer1 ;
4217   int temp2 ;
4218   int res2 = 0 ;
4219   int temp3 ;
4220   int res3 = 0 ;
4221   int temp4 ;
4222   int res4 = SWIG_TMPOBJ ;
4223   int val5 ;
4224   int ecode5 = 0 ;
4225   int val6 ;
4226   int ecode6 = 0 ;
4227   int val7 ;
4228   int ecode7 = 0 ;
4229   float val8 ;
4230   int ecode8 = 0 ;
4231   PyObject * obj0 = 0 ;
4232   PyObject * obj1 = 0 ;
4233   PyObject * obj2 = 0 ;
4234   PyObject * obj3 = 0 ;
4235   PyObject * obj4 = 0 ;
4236   PyObject * obj5 = 0 ;
4237   PyObject * obj6 = 0 ;
4238   uint8_t *result = 0 ;
4239 
4240   arg4 = &temp4;
4241   if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:wrap_WebPEncodeRGBA",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
4242   {
4243     // NB: with Python < 2.6 the old style buffer protocol may be used:
4244     // Py_ssize_t unused;
4245     // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4246     if (!PyObject_CheckBuffer(obj0)) {
4247       SWIG_exception_fail(SWIG_TypeError,
4248         "in method 'wrap_WebPEncodeRGBA', argument 1"
4249         " does not support the buffer interface");
4250     }
4251     if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4252       SWIG_exception_fail(SWIG_RuntimeError,
4253         "in method 'wrap_WebPEncodeRGBA', unable to get buffer view");
4254     }
4255     arg1 = (uint8_t *)rgb_buffer1.buf;
4256   }
4257   if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4258     int val;
4259     int ecode = SWIG_AsVal_int(obj1, &val);
4260     if (!SWIG_IsOK(ecode)) {
4261       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeRGBA" "', argument " "2"" of type '" "int""'");
4262     }
4263     temp2 = (int)(val);
4264     arg2 = &temp2;
4265     res2 = SWIG_AddTmpMask(ecode);
4266   }
4267   if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4268     int val;
4269     int ecode = SWIG_AsVal_int(obj2, &val);
4270     if (!SWIG_IsOK(ecode)) {
4271       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeRGBA" "', argument " "3"" of type '" "int""'");
4272     }
4273     temp3 = (int)(val);
4274     arg3 = &temp3;
4275     res3 = SWIG_AddTmpMask(ecode);
4276   }
4277   ecode5 = SWIG_AsVal_int(obj3, &val5);
4278   if (!SWIG_IsOK(ecode5)) {
4279     SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeRGBA" "', argument " "5"" of type '" "int""'");
4280   }
4281   arg5 = (int)(val5);
4282   ecode6 = SWIG_AsVal_int(obj4, &val6);
4283   if (!SWIG_IsOK(ecode6)) {
4284     SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeRGBA" "', argument " "6"" of type '" "int""'");
4285   }
4286   arg6 = (int)(val6);
4287   ecode7 = SWIG_AsVal_int(obj5, &val7);
4288   if (!SWIG_IsOK(ecode7)) {
4289     SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeRGBA" "', argument " "7"" of type '" "int""'");
4290   }
4291   arg7 = (int)(val7);
4292   ecode8 = SWIG_AsVal_float(obj6, &val8);
4293   if (!SWIG_IsOK(ecode8)) {
4294     SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "wrap_WebPEncodeRGBA" "', argument " "8"" of type '" "float""'");
4295   }
4296   arg8 = (float)(val8);
4297   result = (uint8_t *)wrap_WebPEncodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
4298   {
4299     resultobj = PyString_FromStringAndSize(
4300       (const char*)result,
4301       (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeRGBA", arg3, arg4));
4302   }
4303   if (SWIG_IsTmpObj(res4)) {
4304     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4305   } else {
4306     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
4307     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4308   }
4309   {
4310     PyBuffer_Release(&rgb_buffer1);
4311   }
4312   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4313   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4314   free(result);
4315   return resultobj;
4316 fail:
4317   {
4318     PyBuffer_Release(&rgb_buffer1);
4319   }
4320   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4321   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4322   return NULL;
4323 }
4324 
4325 
_wrap_wrap_WebPEncodeBGRA(PyObject * SWIGUNUSEDPARM (self),PyObject * args)4326 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeBGRA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4327   PyObject *resultobj = 0;
4328   uint8_t *arg1 = (uint8_t *) 0 ;
4329   int *arg2 = (int *) 0 ;
4330   int *arg3 = (int *) 0 ;
4331   int *arg4 = (int *) 0 ;
4332   int arg5 ;
4333   int arg6 ;
4334   int arg7 ;
4335   float arg8 ;
4336   Py_buffer rgb_buffer1 ;
4337   int temp2 ;
4338   int res2 = 0 ;
4339   int temp3 ;
4340   int res3 = 0 ;
4341   int temp4 ;
4342   int res4 = SWIG_TMPOBJ ;
4343   int val5 ;
4344   int ecode5 = 0 ;
4345   int val6 ;
4346   int ecode6 = 0 ;
4347   int val7 ;
4348   int ecode7 = 0 ;
4349   float val8 ;
4350   int ecode8 = 0 ;
4351   PyObject * obj0 = 0 ;
4352   PyObject * obj1 = 0 ;
4353   PyObject * obj2 = 0 ;
4354   PyObject * obj3 = 0 ;
4355   PyObject * obj4 = 0 ;
4356   PyObject * obj5 = 0 ;
4357   PyObject * obj6 = 0 ;
4358   uint8_t *result = 0 ;
4359 
4360   arg4 = &temp4;
4361   if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:wrap_WebPEncodeBGRA",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
4362   {
4363     // NB: with Python < 2.6 the old style buffer protocol may be used:
4364     // Py_ssize_t unused;
4365     // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4366     if (!PyObject_CheckBuffer(obj0)) {
4367       SWIG_exception_fail(SWIG_TypeError,
4368         "in method 'wrap_WebPEncodeBGRA', argument 1"
4369         " does not support the buffer interface");
4370     }
4371     if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4372       SWIG_exception_fail(SWIG_RuntimeError,
4373         "in method 'wrap_WebPEncodeBGRA', unable to get buffer view");
4374     }
4375     arg1 = (uint8_t *)rgb_buffer1.buf;
4376   }
4377   if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4378     int val;
4379     int ecode = SWIG_AsVal_int(obj1, &val);
4380     if (!SWIG_IsOK(ecode)) {
4381       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeBGRA" "', argument " "2"" of type '" "int""'");
4382     }
4383     temp2 = (int)(val);
4384     arg2 = &temp2;
4385     res2 = SWIG_AddTmpMask(ecode);
4386   }
4387   if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4388     int val;
4389     int ecode = SWIG_AsVal_int(obj2, &val);
4390     if (!SWIG_IsOK(ecode)) {
4391       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeBGRA" "', argument " "3"" of type '" "int""'");
4392     }
4393     temp3 = (int)(val);
4394     arg3 = &temp3;
4395     res3 = SWIG_AddTmpMask(ecode);
4396   }
4397   ecode5 = SWIG_AsVal_int(obj3, &val5);
4398   if (!SWIG_IsOK(ecode5)) {
4399     SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeBGRA" "', argument " "5"" of type '" "int""'");
4400   }
4401   arg5 = (int)(val5);
4402   ecode6 = SWIG_AsVal_int(obj4, &val6);
4403   if (!SWIG_IsOK(ecode6)) {
4404     SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeBGRA" "', argument " "6"" of type '" "int""'");
4405   }
4406   arg6 = (int)(val6);
4407   ecode7 = SWIG_AsVal_int(obj5, &val7);
4408   if (!SWIG_IsOK(ecode7)) {
4409     SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeBGRA" "', argument " "7"" of type '" "int""'");
4410   }
4411   arg7 = (int)(val7);
4412   ecode8 = SWIG_AsVal_float(obj6, &val8);
4413   if (!SWIG_IsOK(ecode8)) {
4414     SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "wrap_WebPEncodeBGRA" "', argument " "8"" of type '" "float""'");
4415   }
4416   arg8 = (float)(val8);
4417   result = (uint8_t *)wrap_WebPEncodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
4418   {
4419     resultobj = PyString_FromStringAndSize(
4420       (const char*)result,
4421       (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeBGRA", arg3, arg4));
4422   }
4423   if (SWIG_IsTmpObj(res4)) {
4424     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4425   } else {
4426     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
4427     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4428   }
4429   {
4430     PyBuffer_Release(&rgb_buffer1);
4431   }
4432   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4433   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4434   free(result);
4435   return resultobj;
4436 fail:
4437   {
4438     PyBuffer_Release(&rgb_buffer1);
4439   }
4440   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4441   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4442   return NULL;
4443 }
4444 
4445 
_wrap_wrap_WebPEncodeLosslessRGB(PyObject * SWIGUNUSEDPARM (self),PyObject * args)4446 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeLosslessRGB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4447   PyObject *resultobj = 0;
4448   uint8_t *arg1 = (uint8_t *) 0 ;
4449   int *arg2 = (int *) 0 ;
4450   int *arg3 = (int *) 0 ;
4451   int *arg4 = (int *) 0 ;
4452   int arg5 ;
4453   int arg6 ;
4454   int arg7 ;
4455   Py_buffer rgb_buffer1 ;
4456   int temp2 ;
4457   int res2 = 0 ;
4458   int temp3 ;
4459   int res3 = 0 ;
4460   int temp4 ;
4461   int res4 = SWIG_TMPOBJ ;
4462   int val5 ;
4463   int ecode5 = 0 ;
4464   int val6 ;
4465   int ecode6 = 0 ;
4466   int val7 ;
4467   int ecode7 = 0 ;
4468   PyObject * obj0 = 0 ;
4469   PyObject * obj1 = 0 ;
4470   PyObject * obj2 = 0 ;
4471   PyObject * obj3 = 0 ;
4472   PyObject * obj4 = 0 ;
4473   PyObject * obj5 = 0 ;
4474   uint8_t *result = 0 ;
4475 
4476   arg4 = &temp4;
4477   if (!PyArg_ParseTuple(args,(char *)"OOOOOO:wrap_WebPEncodeLosslessRGB",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
4478   {
4479     // NB: with Python < 2.6 the old style buffer protocol may be used:
4480     // Py_ssize_t unused;
4481     // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4482     if (!PyObject_CheckBuffer(obj0)) {
4483       SWIG_exception_fail(SWIG_TypeError,
4484         "in method 'wrap_WebPEncodeLosslessRGB', argument 1"
4485         " does not support the buffer interface");
4486     }
4487     if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4488       SWIG_exception_fail(SWIG_RuntimeError,
4489         "in method 'wrap_WebPEncodeLosslessRGB', unable to get buffer view");
4490     }
4491     arg1 = (uint8_t *)rgb_buffer1.buf;
4492   }
4493   if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4494     int val;
4495     int ecode = SWIG_AsVal_int(obj1, &val);
4496     if (!SWIG_IsOK(ecode)) {
4497       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "2"" of type '" "int""'");
4498     }
4499     temp2 = (int)(val);
4500     arg2 = &temp2;
4501     res2 = SWIG_AddTmpMask(ecode);
4502   }
4503   if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4504     int val;
4505     int ecode = SWIG_AsVal_int(obj2, &val);
4506     if (!SWIG_IsOK(ecode)) {
4507       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "3"" of type '" "int""'");
4508     }
4509     temp3 = (int)(val);
4510     arg3 = &temp3;
4511     res3 = SWIG_AddTmpMask(ecode);
4512   }
4513   ecode5 = SWIG_AsVal_int(obj3, &val5);
4514   if (!SWIG_IsOK(ecode5)) {
4515     SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "5"" of type '" "int""'");
4516   }
4517   arg5 = (int)(val5);
4518   ecode6 = SWIG_AsVal_int(obj4, &val6);
4519   if (!SWIG_IsOK(ecode6)) {
4520     SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "6"" of type '" "int""'");
4521   }
4522   arg6 = (int)(val6);
4523   ecode7 = SWIG_AsVal_int(obj5, &val7);
4524   if (!SWIG_IsOK(ecode7)) {
4525     SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "7"" of type '" "int""'");
4526   }
4527   arg7 = (int)(val7);
4528   result = (uint8_t *)wrap_WebPEncodeLosslessRGB((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
4529   {
4530     resultobj = PyString_FromStringAndSize(
4531       (const char*)result,
4532       (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeLosslessRGB", arg3, arg4));
4533   }
4534   if (SWIG_IsTmpObj(res4)) {
4535     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4536   } else {
4537     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
4538     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4539   }
4540   {
4541     PyBuffer_Release(&rgb_buffer1);
4542   }
4543   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4544   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4545   free(result);
4546   return resultobj;
4547 fail:
4548   {
4549     PyBuffer_Release(&rgb_buffer1);
4550   }
4551   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4552   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4553   return NULL;
4554 }
4555 
4556 
_wrap_wrap_WebPEncodeLosslessBGR(PyObject * SWIGUNUSEDPARM (self),PyObject * args)4557 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeLosslessBGR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4558   PyObject *resultobj = 0;
4559   uint8_t *arg1 = (uint8_t *) 0 ;
4560   int *arg2 = (int *) 0 ;
4561   int *arg3 = (int *) 0 ;
4562   int *arg4 = (int *) 0 ;
4563   int arg5 ;
4564   int arg6 ;
4565   int arg7 ;
4566   Py_buffer rgb_buffer1 ;
4567   int temp2 ;
4568   int res2 = 0 ;
4569   int temp3 ;
4570   int res3 = 0 ;
4571   int temp4 ;
4572   int res4 = SWIG_TMPOBJ ;
4573   int val5 ;
4574   int ecode5 = 0 ;
4575   int val6 ;
4576   int ecode6 = 0 ;
4577   int val7 ;
4578   int ecode7 = 0 ;
4579   PyObject * obj0 = 0 ;
4580   PyObject * obj1 = 0 ;
4581   PyObject * obj2 = 0 ;
4582   PyObject * obj3 = 0 ;
4583   PyObject * obj4 = 0 ;
4584   PyObject * obj5 = 0 ;
4585   uint8_t *result = 0 ;
4586 
4587   arg4 = &temp4;
4588   if (!PyArg_ParseTuple(args,(char *)"OOOOOO:wrap_WebPEncodeLosslessBGR",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
4589   {
4590     // NB: with Python < 2.6 the old style buffer protocol may be used:
4591     // Py_ssize_t unused;
4592     // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4593     if (!PyObject_CheckBuffer(obj0)) {
4594       SWIG_exception_fail(SWIG_TypeError,
4595         "in method 'wrap_WebPEncodeLosslessBGR', argument 1"
4596         " does not support the buffer interface");
4597     }
4598     if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4599       SWIG_exception_fail(SWIG_RuntimeError,
4600         "in method 'wrap_WebPEncodeLosslessBGR', unable to get buffer view");
4601     }
4602     arg1 = (uint8_t *)rgb_buffer1.buf;
4603   }
4604   if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4605     int val;
4606     int ecode = SWIG_AsVal_int(obj1, &val);
4607     if (!SWIG_IsOK(ecode)) {
4608       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "2"" of type '" "int""'");
4609     }
4610     temp2 = (int)(val);
4611     arg2 = &temp2;
4612     res2 = SWIG_AddTmpMask(ecode);
4613   }
4614   if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4615     int val;
4616     int ecode = SWIG_AsVal_int(obj2, &val);
4617     if (!SWIG_IsOK(ecode)) {
4618       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "3"" of type '" "int""'");
4619     }
4620     temp3 = (int)(val);
4621     arg3 = &temp3;
4622     res3 = SWIG_AddTmpMask(ecode);
4623   }
4624   ecode5 = SWIG_AsVal_int(obj3, &val5);
4625   if (!SWIG_IsOK(ecode5)) {
4626     SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "5"" of type '" "int""'");
4627   }
4628   arg5 = (int)(val5);
4629   ecode6 = SWIG_AsVal_int(obj4, &val6);
4630   if (!SWIG_IsOK(ecode6)) {
4631     SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "6"" of type '" "int""'");
4632   }
4633   arg6 = (int)(val6);
4634   ecode7 = SWIG_AsVal_int(obj5, &val7);
4635   if (!SWIG_IsOK(ecode7)) {
4636     SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "7"" of type '" "int""'");
4637   }
4638   arg7 = (int)(val7);
4639   result = (uint8_t *)wrap_WebPEncodeLosslessBGR((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
4640   {
4641     resultobj = PyString_FromStringAndSize(
4642       (const char*)result,
4643       (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeLosslessBGR", arg3, arg4));
4644   }
4645   if (SWIG_IsTmpObj(res4)) {
4646     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4647   } else {
4648     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
4649     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4650   }
4651   {
4652     PyBuffer_Release(&rgb_buffer1);
4653   }
4654   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4655   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4656   free(result);
4657   return resultobj;
4658 fail:
4659   {
4660     PyBuffer_Release(&rgb_buffer1);
4661   }
4662   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4663   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4664   return NULL;
4665 }
4666 
4667 
_wrap_wrap_WebPEncodeLosslessRGBA(PyObject * SWIGUNUSEDPARM (self),PyObject * args)4668 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeLosslessRGBA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4669   PyObject *resultobj = 0;
4670   uint8_t *arg1 = (uint8_t *) 0 ;
4671   int *arg2 = (int *) 0 ;
4672   int *arg3 = (int *) 0 ;
4673   int *arg4 = (int *) 0 ;
4674   int arg5 ;
4675   int arg6 ;
4676   int arg7 ;
4677   Py_buffer rgb_buffer1 ;
4678   int temp2 ;
4679   int res2 = 0 ;
4680   int temp3 ;
4681   int res3 = 0 ;
4682   int temp4 ;
4683   int res4 = SWIG_TMPOBJ ;
4684   int val5 ;
4685   int ecode5 = 0 ;
4686   int val6 ;
4687   int ecode6 = 0 ;
4688   int val7 ;
4689   int ecode7 = 0 ;
4690   PyObject * obj0 = 0 ;
4691   PyObject * obj1 = 0 ;
4692   PyObject * obj2 = 0 ;
4693   PyObject * obj3 = 0 ;
4694   PyObject * obj4 = 0 ;
4695   PyObject * obj5 = 0 ;
4696   uint8_t *result = 0 ;
4697 
4698   arg4 = &temp4;
4699   if (!PyArg_ParseTuple(args,(char *)"OOOOOO:wrap_WebPEncodeLosslessRGBA",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
4700   {
4701     // NB: with Python < 2.6 the old style buffer protocol may be used:
4702     // Py_ssize_t unused;
4703     // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4704     if (!PyObject_CheckBuffer(obj0)) {
4705       SWIG_exception_fail(SWIG_TypeError,
4706         "in method 'wrap_WebPEncodeLosslessRGBA', argument 1"
4707         " does not support the buffer interface");
4708     }
4709     if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4710       SWIG_exception_fail(SWIG_RuntimeError,
4711         "in method 'wrap_WebPEncodeLosslessRGBA', unable to get buffer view");
4712     }
4713     arg1 = (uint8_t *)rgb_buffer1.buf;
4714   }
4715   if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4716     int val;
4717     int ecode = SWIG_AsVal_int(obj1, &val);
4718     if (!SWIG_IsOK(ecode)) {
4719       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "2"" of type '" "int""'");
4720     }
4721     temp2 = (int)(val);
4722     arg2 = &temp2;
4723     res2 = SWIG_AddTmpMask(ecode);
4724   }
4725   if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4726     int val;
4727     int ecode = SWIG_AsVal_int(obj2, &val);
4728     if (!SWIG_IsOK(ecode)) {
4729       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "3"" of type '" "int""'");
4730     }
4731     temp3 = (int)(val);
4732     arg3 = &temp3;
4733     res3 = SWIG_AddTmpMask(ecode);
4734   }
4735   ecode5 = SWIG_AsVal_int(obj3, &val5);
4736   if (!SWIG_IsOK(ecode5)) {
4737     SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "5"" of type '" "int""'");
4738   }
4739   arg5 = (int)(val5);
4740   ecode6 = SWIG_AsVal_int(obj4, &val6);
4741   if (!SWIG_IsOK(ecode6)) {
4742     SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "6"" of type '" "int""'");
4743   }
4744   arg6 = (int)(val6);
4745   ecode7 = SWIG_AsVal_int(obj5, &val7);
4746   if (!SWIG_IsOK(ecode7)) {
4747     SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "7"" of type '" "int""'");
4748   }
4749   arg7 = (int)(val7);
4750   result = (uint8_t *)wrap_WebPEncodeLosslessRGBA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
4751   {
4752     resultobj = PyString_FromStringAndSize(
4753       (const char*)result,
4754       (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeLosslessRGBA", arg3, arg4));
4755   }
4756   if (SWIG_IsTmpObj(res4)) {
4757     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4758   } else {
4759     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
4760     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4761   }
4762   {
4763     PyBuffer_Release(&rgb_buffer1);
4764   }
4765   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4766   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4767   free(result);
4768   return resultobj;
4769 fail:
4770   {
4771     PyBuffer_Release(&rgb_buffer1);
4772   }
4773   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4774   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4775   return NULL;
4776 }
4777 
4778 
_wrap_wrap_WebPEncodeLosslessBGRA(PyObject * SWIGUNUSEDPARM (self),PyObject * args)4779 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeLosslessBGRA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4780   PyObject *resultobj = 0;
4781   uint8_t *arg1 = (uint8_t *) 0 ;
4782   int *arg2 = (int *) 0 ;
4783   int *arg3 = (int *) 0 ;
4784   int *arg4 = (int *) 0 ;
4785   int arg5 ;
4786   int arg6 ;
4787   int arg7 ;
4788   Py_buffer rgb_buffer1 ;
4789   int temp2 ;
4790   int res2 = 0 ;
4791   int temp3 ;
4792   int res3 = 0 ;
4793   int temp4 ;
4794   int res4 = SWIG_TMPOBJ ;
4795   int val5 ;
4796   int ecode5 = 0 ;
4797   int val6 ;
4798   int ecode6 = 0 ;
4799   int val7 ;
4800   int ecode7 = 0 ;
4801   PyObject * obj0 = 0 ;
4802   PyObject * obj1 = 0 ;
4803   PyObject * obj2 = 0 ;
4804   PyObject * obj3 = 0 ;
4805   PyObject * obj4 = 0 ;
4806   PyObject * obj5 = 0 ;
4807   uint8_t *result = 0 ;
4808 
4809   arg4 = &temp4;
4810   if (!PyArg_ParseTuple(args,(char *)"OOOOOO:wrap_WebPEncodeLosslessBGRA",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
4811   {
4812     // NB: with Python < 2.6 the old style buffer protocol may be used:
4813     // Py_ssize_t unused;
4814     // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4815     if (!PyObject_CheckBuffer(obj0)) {
4816       SWIG_exception_fail(SWIG_TypeError,
4817         "in method 'wrap_WebPEncodeLosslessBGRA', argument 1"
4818         " does not support the buffer interface");
4819     }
4820     if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4821       SWIG_exception_fail(SWIG_RuntimeError,
4822         "in method 'wrap_WebPEncodeLosslessBGRA', unable to get buffer view");
4823     }
4824     arg1 = (uint8_t *)rgb_buffer1.buf;
4825   }
4826   if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4827     int val;
4828     int ecode = SWIG_AsVal_int(obj1, &val);
4829     if (!SWIG_IsOK(ecode)) {
4830       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "2"" of type '" "int""'");
4831     }
4832     temp2 = (int)(val);
4833     arg2 = &temp2;
4834     res2 = SWIG_AddTmpMask(ecode);
4835   }
4836   if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4837     int val;
4838     int ecode = SWIG_AsVal_int(obj2, &val);
4839     if (!SWIG_IsOK(ecode)) {
4840       SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "3"" of type '" "int""'");
4841     }
4842     temp3 = (int)(val);
4843     arg3 = &temp3;
4844     res3 = SWIG_AddTmpMask(ecode);
4845   }
4846   ecode5 = SWIG_AsVal_int(obj3, &val5);
4847   if (!SWIG_IsOK(ecode5)) {
4848     SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "5"" of type '" "int""'");
4849   }
4850   arg5 = (int)(val5);
4851   ecode6 = SWIG_AsVal_int(obj4, &val6);
4852   if (!SWIG_IsOK(ecode6)) {
4853     SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "6"" of type '" "int""'");
4854   }
4855   arg6 = (int)(val6);
4856   ecode7 = SWIG_AsVal_int(obj5, &val7);
4857   if (!SWIG_IsOK(ecode7)) {
4858     SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "7"" of type '" "int""'");
4859   }
4860   arg7 = (int)(val7);
4861   result = (uint8_t *)wrap_WebPEncodeLosslessBGRA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
4862   {
4863     resultobj = PyString_FromStringAndSize(
4864       (const char*)result,
4865       (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeLosslessBGRA", arg3, arg4));
4866   }
4867   if (SWIG_IsTmpObj(res4)) {
4868     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4869   } else {
4870     int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN |  0 ) :  0 ;
4871     resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4872   }
4873   {
4874     PyBuffer_Release(&rgb_buffer1);
4875   }
4876   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4877   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4878   free(result);
4879   return resultobj;
4880 fail:
4881   {
4882     PyBuffer_Release(&rgb_buffer1);
4883   }
4884   if (SWIG_IsNewObj(res2)) free((char*)arg2);
4885   if (SWIG_IsNewObj(res3)) free((char*)arg3);
4886   return NULL;
4887 }
4888 
4889 
4890 static PyMethodDef SwigMethods[] = {
4891          { "SWIG_PyInstanceMethod_New", SWIG_PyInstanceMethod_New, METH_O, NULL},
4892          { "WebPGetDecoderVersion", _wrap_WebPGetDecoderVersion, METH_VARARGS, (char *)"WebPGetDecoderVersion() -> int"},
4893          { "WebPGetInfo", _wrap_WebPGetInfo, METH_VARARGS, (char *)"WebPGetInfo(uint8_t data) -> (width, height)"},
4894          { "WebPDecodeRGB", _wrap_WebPDecodeRGB, METH_VARARGS, (char *)"WebPDecodeRGB(uint8_t data) -> (rgb, width, height)"},
4895          { "WebPDecodeRGBA", _wrap_WebPDecodeRGBA, METH_VARARGS, (char *)"WebPDecodeRGBA(uint8_t data) -> (rgb, width, height)"},
4896          { "WebPDecodeARGB", _wrap_WebPDecodeARGB, METH_VARARGS, (char *)"WebPDecodeARGB(uint8_t data) -> (rgb, width, height)"},
4897          { "WebPDecodeBGR", _wrap_WebPDecodeBGR, METH_VARARGS, (char *)"WebPDecodeBGR(uint8_t data) -> (rgb, width, height)"},
4898          { "WebPDecodeBGRA", _wrap_WebPDecodeBGRA, METH_VARARGS, (char *)"WebPDecodeBGRA(uint8_t data) -> (rgb, width, height)"},
4899          { "WebPGetEncoderVersion", _wrap_WebPGetEncoderVersion, METH_VARARGS, (char *)"WebPGetEncoderVersion() -> int"},
4900          { "wrap_WebPEncodeRGB", _wrap_wrap_WebPEncodeRGB, METH_VARARGS, (char *)"private, do not call directly."},
4901          { "wrap_WebPEncodeBGR", _wrap_wrap_WebPEncodeBGR, METH_VARARGS, (char *)"private, do not call directly."},
4902          { "wrap_WebPEncodeRGBA", _wrap_wrap_WebPEncodeRGBA, METH_VARARGS, (char *)"private, do not call directly."},
4903          { "wrap_WebPEncodeBGRA", _wrap_wrap_WebPEncodeBGRA, METH_VARARGS, (char *)"private, do not call directly."},
4904          { "wrap_WebPEncodeLosslessRGB", _wrap_wrap_WebPEncodeLosslessRGB, METH_VARARGS, (char *)"private, do not call directly."},
4905          { "wrap_WebPEncodeLosslessBGR", _wrap_wrap_WebPEncodeLosslessBGR, METH_VARARGS, (char *)"private, do not call directly."},
4906          { "wrap_WebPEncodeLosslessRGBA", _wrap_wrap_WebPEncodeLosslessRGBA, METH_VARARGS, (char *)"private, do not call directly."},
4907          { "wrap_WebPEncodeLosslessBGRA", _wrap_wrap_WebPEncodeLosslessBGRA, METH_VARARGS, (char *)"private, do not call directly."},
4908          { NULL, NULL, 0, NULL }
4909 };
4910 
4911 
4912 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4913 
4914 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
4915 static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
4916 static swig_type_info _swigt__p_uint8_t = {"_p_uint8_t", "uint8_t *", 0, 0, (void*)0, 0};
4917 
4918 static swig_type_info *swig_type_initial[] = {
4919   &_swigt__p_char,
4920   &_swigt__p_int,
4921   &_swigt__p_uint8_t,
4922 };
4923 
4924 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
4925 static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
4926 static swig_cast_info _swigc__p_uint8_t[] = {  {&_swigt__p_uint8_t, 0, 0, 0},{0, 0, 0, 0}};
4927 
4928 static swig_cast_info *swig_cast_initial[] = {
4929   _swigc__p_char,
4930   _swigc__p_int,
4931   _swigc__p_uint8_t,
4932 };
4933 
4934 
4935 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
4936 
4937 static swig_const_info swig_const_table[] = {
4938 {0, 0, 0, 0.0, 0, 0}};
4939 
4940 #ifdef __cplusplus
4941 }
4942 #endif
4943 /* -----------------------------------------------------------------------------
4944  * Type initialization:
4945  * This problem is tough by the requirement that no dynamic
4946  * memory is used. Also, since swig_type_info structures store pointers to
4947  * swig_cast_info structures and swig_cast_info structures store pointers back
4948  * to swig_type_info structures, we need some lookup code at initialization.
4949  * The idea is that swig generates all the structures that are needed.
4950  * The runtime then collects these partially filled structures.
4951  * The SWIG_InitializeModule function takes these initial arrays out of
4952  * swig_module, and does all the lookup, filling in the swig_module.types
4953  * array with the correct data and linking the correct swig_cast_info
4954  * structures together.
4955  *
4956  * The generated swig_type_info structures are assigned statically to an initial
4957  * array. We just loop through that array, and handle each type individually.
4958  * First we lookup if this type has been already loaded, and if so, use the
4959  * loaded structure instead of the generated one. Then we have to fill in the
4960  * cast linked list. The cast data is initially stored in something like a
4961  * two-dimensional array. Each row corresponds to a type (there are the same
4962  * number of rows as there are in the swig_type_initial array). Each entry in
4963  * a column is one of the swig_cast_info structures for that type.
4964  * The cast_initial array is actually an array of arrays, because each row has
4965  * a variable number of columns. So to actually build the cast linked list,
4966  * we find the array of casts associated with the type, and loop through it
4967  * adding the casts to the list. The one last trick we need to do is making
4968  * sure the type pointer in the swig_cast_info struct is correct.
4969  *
4970  * First off, we lookup the cast->type name to see if it is already loaded.
4971  * There are three cases to handle:
4972  *  1) If the cast->type has already been loaded AND the type we are adding
4973  *     casting info to has not been loaded (it is in this module), THEN we
4974  *     replace the cast->type pointer with the type pointer that has already
4975  *     been loaded.
4976  *  2) If BOTH types (the one we are adding casting info to, and the
4977  *     cast->type) are loaded, THEN the cast info has already been loaded by
4978  *     the previous module so we just ignore it.
4979  *  3) Finally, if cast->type has not already been loaded, then we add that
4980  *     swig_cast_info to the linked list (because the cast->type) pointer will
4981  *     be correct.
4982  * ----------------------------------------------------------------------------- */
4983 
4984 #ifdef __cplusplus
4985 extern "C" {
4986 #if 0
4987 } /* c-mode */
4988 #endif
4989 #endif
4990 
4991 #if 0
4992 #define SWIGRUNTIME_DEBUG
4993 #endif
4994 
4995 
4996 SWIGRUNTIME void
SWIG_InitializeModule(void * clientdata)4997 SWIG_InitializeModule(void *clientdata) {
4998   size_t i;
4999   swig_module_info *module_head, *iter;
5000   int init;
5001 
5002   /* check to see if the circular list has been setup, if not, set it up */
5003   if (swig_module.next==0) {
5004     /* Initialize the swig_module */
5005     swig_module.type_initial = swig_type_initial;
5006     swig_module.cast_initial = swig_cast_initial;
5007     swig_module.next = &swig_module;
5008     init = 1;
5009   } else {
5010     init = 0;
5011   }
5012 
5013   /* Try and load any already created modules */
5014   module_head = SWIG_GetModule(clientdata);
5015   if (!module_head) {
5016     /* This is the first module loaded for this interpreter */
5017     /* so set the swig module into the interpreter */
5018     SWIG_SetModule(clientdata, &swig_module);
5019   } else {
5020     /* the interpreter has loaded a SWIG module, but has it loaded this one? */
5021     iter=module_head;
5022     do {
5023       if (iter==&swig_module) {
5024         /* Our module is already in the list, so there's nothing more to do. */
5025         return;
5026       }
5027       iter=iter->next;
5028     } while (iter!= module_head);
5029 
5030     /* otherwise we must add our module into the list */
5031     swig_module.next = module_head->next;
5032     module_head->next = &swig_module;
5033   }
5034 
5035   /* When multiple interpreters are used, a module could have already been initialized in
5036        a different interpreter, but not yet have a pointer in this interpreter.
5037        In this case, we do not want to continue adding types... everything should be
5038        set up already */
5039   if (init == 0) return;
5040 
5041   /* Now work on filling in swig_module.types */
5042 #ifdef SWIGRUNTIME_DEBUG
5043   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
5044 #endif
5045   for (i = 0; i < swig_module.size; ++i) {
5046     swig_type_info *type = 0;
5047     swig_type_info *ret;
5048     swig_cast_info *cast;
5049 
5050 #ifdef SWIGRUNTIME_DEBUG
5051     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
5052 #endif
5053 
5054     /* if there is another module already loaded */
5055     if (swig_module.next != &swig_module) {
5056       type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
5057     }
5058     if (type) {
5059       /* Overwrite clientdata field */
5060 #ifdef SWIGRUNTIME_DEBUG
5061       printf("SWIG_InitializeModule: found type %s\n", type->name);
5062 #endif
5063       if (swig_module.type_initial[i]->clientdata) {
5064         type->clientdata = swig_module.type_initial[i]->clientdata;
5065 #ifdef SWIGRUNTIME_DEBUG
5066         printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
5067 #endif
5068       }
5069     } else {
5070       type = swig_module.type_initial[i];
5071     }
5072 
5073     /* Insert casting types */
5074     cast = swig_module.cast_initial[i];
5075     while (cast->type) {
5076       /* Don't need to add information already in the list */
5077       ret = 0;
5078 #ifdef SWIGRUNTIME_DEBUG
5079       printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
5080 #endif
5081       if (swig_module.next != &swig_module) {
5082         ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
5083 #ifdef SWIGRUNTIME_DEBUG
5084         if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
5085 #endif
5086       }
5087       if (ret) {
5088         if (type == swig_module.type_initial[i]) {
5089 #ifdef SWIGRUNTIME_DEBUG
5090           printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
5091 #endif
5092           cast->type = ret;
5093           ret = 0;
5094         } else {
5095           /* Check for casting already in the list */
5096           swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
5097 #ifdef SWIGRUNTIME_DEBUG
5098           if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
5099 #endif
5100           if (!ocast) ret = 0;
5101         }
5102       }
5103 
5104       if (!ret) {
5105 #ifdef SWIGRUNTIME_DEBUG
5106         printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
5107 #endif
5108         if (type->cast) {
5109           type->cast->prev = cast;
5110           cast->next = type->cast;
5111         }
5112         type->cast = cast;
5113       }
5114       cast++;
5115     }
5116     /* Set entry in modules->types array equal to the type */
5117     swig_module.types[i] = type;
5118   }
5119   swig_module.types[i] = 0;
5120 
5121 #ifdef SWIGRUNTIME_DEBUG
5122   printf("**** SWIG_InitializeModule: Cast List ******\n");
5123   for (i = 0; i < swig_module.size; ++i) {
5124     int j = 0;
5125     swig_cast_info *cast = swig_module.cast_initial[i];
5126     printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
5127     while (cast->type) {
5128       printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
5129       cast++;
5130       ++j;
5131     }
5132     printf("---- Total casts: %d\n",j);
5133   }
5134   printf("**** SWIG_InitializeModule: Cast List ******\n");
5135 #endif
5136 }
5137 
5138 /* This function will propagate the clientdata field of type to
5139 * any new swig_type_info structures that have been added into the list
5140 * of equivalent types.  It is like calling
5141 * SWIG_TypeClientData(type, clientdata) a second time.
5142 */
5143 SWIGRUNTIME void
SWIG_PropagateClientData(void)5144 SWIG_PropagateClientData(void) {
5145   size_t i;
5146   swig_cast_info *equiv;
5147   static int init_run = 0;
5148 
5149   if (init_run) return;
5150   init_run = 1;
5151 
5152   for (i = 0; i < swig_module.size; i++) {
5153     if (swig_module.types[i]->clientdata) {
5154       equiv = swig_module.types[i]->cast;
5155       while (equiv) {
5156         if (!equiv->converter) {
5157           if (equiv->type && !equiv->type->clientdata)
5158           SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
5159         }
5160         equiv = equiv->next;
5161       }
5162     }
5163   }
5164 }
5165 
5166 #ifdef __cplusplus
5167 #if 0
5168 {
5169   /* c-mode */
5170 #endif
5171 }
5172 #endif
5173 
5174 
5175 
5176 #ifdef __cplusplus
5177 extern "C" {
5178 #endif
5179 
5180   /* Python-specific SWIG API */
5181 #define SWIG_newvarlink()                             SWIG_Python_newvarlink()
5182 #define SWIG_addvarlink(p, name, get_attr, set_attr)  SWIG_Python_addvarlink(p, name, get_attr, set_attr)
5183 #define SWIG_InstallConstants(d, constants)           SWIG_Python_InstallConstants(d, constants)
5184 
5185   /* -----------------------------------------------------------------------------
5186    * global variable support code.
5187    * ----------------------------------------------------------------------------- */
5188 
5189   typedef struct swig_globalvar {
5190     char       *name;                  /* Name of global variable */
5191     PyObject *(*get_attr)(void);       /* Return the current value */
5192     int       (*set_attr)(PyObject *); /* Set the value */
5193     struct swig_globalvar *next;
5194   } swig_globalvar;
5195 
5196   typedef struct swig_varlinkobject {
5197     PyObject_HEAD
5198     swig_globalvar *vars;
5199   } swig_varlinkobject;
5200 
5201   SWIGINTERN PyObject *
swig_varlink_repr(swig_varlinkobject * SWIGUNUSEDPARM (v))5202   swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
5203 #if PY_VERSION_HEX >= 0x03000000
5204     return PyUnicode_InternFromString("<Swig global variables>");
5205 #else
5206     return PyString_FromString("<Swig global variables>");
5207 #endif
5208   }
5209 
5210   SWIGINTERN PyObject *
swig_varlink_str(swig_varlinkobject * v)5211   swig_varlink_str(swig_varlinkobject *v) {
5212 #if PY_VERSION_HEX >= 0x03000000
5213     PyObject *str = PyUnicode_InternFromString("(");
5214     PyObject *tail;
5215     PyObject *joined;
5216     swig_globalvar *var;
5217     for (var = v->vars; var; var=var->next) {
5218       tail = PyUnicode_FromString(var->name);
5219       joined = PyUnicode_Concat(str, tail);
5220       Py_DecRef(str);
5221       Py_DecRef(tail);
5222       str = joined;
5223       if (var->next) {
5224         tail = PyUnicode_InternFromString(", ");
5225         joined = PyUnicode_Concat(str, tail);
5226         Py_DecRef(str);
5227         Py_DecRef(tail);
5228         str = joined;
5229       }
5230     }
5231     tail = PyUnicode_InternFromString(")");
5232     joined = PyUnicode_Concat(str, tail);
5233     Py_DecRef(str);
5234     Py_DecRef(tail);
5235     str = joined;
5236 #else
5237     PyObject *str = PyString_FromString("(");
5238     swig_globalvar *var;
5239     for (var = v->vars; var; var=var->next) {
5240       PyString_ConcatAndDel(&str,PyString_FromString(var->name));
5241       if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
5242     }
5243     PyString_ConcatAndDel(&str,PyString_FromString(")"));
5244 #endif
5245     return str;
5246   }
5247 
5248   SWIGINTERN int
swig_varlink_print(swig_varlinkobject * v,FILE * fp,int SWIGUNUSEDPARM (flags))5249   swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
5250     char *tmp;
5251     PyObject *str = swig_varlink_str(v);
5252     fprintf(fp,"Swig global variables ");
5253     fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
5254     SWIG_Python_str_DelForPy3(tmp);
5255     Py_DECREF(str);
5256     return 0;
5257   }
5258 
5259   SWIGINTERN void
swig_varlink_dealloc(swig_varlinkobject * v)5260   swig_varlink_dealloc(swig_varlinkobject *v) {
5261     swig_globalvar *var = v->vars;
5262     while (var) {
5263       swig_globalvar *n = var->next;
5264       free(var->name);
5265       free(var);
5266       var = n;
5267     }
5268   }
5269 
5270   SWIGINTERN PyObject *
swig_varlink_getattr(swig_varlinkobject * v,char * n)5271   swig_varlink_getattr(swig_varlinkobject *v, char *n) {
5272     PyObject *res = NULL;
5273     swig_globalvar *var = v->vars;
5274     while (var) {
5275       if (strcmp(var->name,n) == 0) {
5276         res = (*var->get_attr)();
5277         break;
5278       }
5279       var = var->next;
5280     }
5281     if (res == NULL && !PyErr_Occurred()) {
5282       PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
5283     }
5284     return res;
5285   }
5286 
5287   SWIGINTERN int
swig_varlink_setattr(swig_varlinkobject * v,char * n,PyObject * p)5288   swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
5289     int res = 1;
5290     swig_globalvar *var = v->vars;
5291     while (var) {
5292       if (strcmp(var->name,n) == 0) {
5293         res = (*var->set_attr)(p);
5294         break;
5295       }
5296       var = var->next;
5297     }
5298     if (res == 1 && !PyErr_Occurred()) {
5299       PyErr_Format(PyExc_AttributeError, "Unknown C global variable '%s'", n);
5300     }
5301     return res;
5302   }
5303 
5304   SWIGINTERN PyTypeObject*
swig_varlink_type(void)5305   swig_varlink_type(void) {
5306     static char varlink__doc__[] = "Swig var link object";
5307     static PyTypeObject varlink_type;
5308     static int type_init = 0;
5309     if (!type_init) {
5310       const PyTypeObject tmp = {
5311 #if PY_VERSION_HEX >= 0x03000000
5312         PyVarObject_HEAD_INIT(NULL, 0)
5313 #else
5314         PyObject_HEAD_INIT(NULL)
5315         0,                                  /* ob_size */
5316 #endif
5317         (char *)"swigvarlink",              /* tp_name */
5318         sizeof(swig_varlinkobject),         /* tp_basicsize */
5319         0,                                  /* tp_itemsize */
5320         (destructor) swig_varlink_dealloc,  /* tp_dealloc */
5321         (printfunc) swig_varlink_print,     /* tp_print */
5322         (getattrfunc) swig_varlink_getattr, /* tp_getattr */
5323         (setattrfunc) swig_varlink_setattr, /* tp_setattr */
5324         0,                                  /* tp_compare */
5325         (reprfunc) swig_varlink_repr,       /* tp_repr */
5326         0,                                  /* tp_as_number */
5327         0,                                  /* tp_as_sequence */
5328         0,                                  /* tp_as_mapping */
5329         0,                                  /* tp_hash */
5330         0,                                  /* tp_call */
5331         (reprfunc) swig_varlink_str,        /* tp_str */
5332         0,                                  /* tp_getattro */
5333         0,                                  /* tp_setattro */
5334         0,                                  /* tp_as_buffer */
5335         0,                                  /* tp_flags */
5336         varlink__doc__,                     /* tp_doc */
5337         0,                                  /* tp_traverse */
5338         0,                                  /* tp_clear */
5339         0,                                  /* tp_richcompare */
5340         0,                                  /* tp_weaklistoffset */
5341 #if PY_VERSION_HEX >= 0x02020000
5342         0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
5343 #endif
5344 #if PY_VERSION_HEX >= 0x02030000
5345         0,                                  /* tp_del */
5346 #endif
5347 #if PY_VERSION_HEX >= 0x02060000
5348         0,                                  /* tp_version_tag */
5349 #endif
5350 #if PY_VERSION_HEX >= 0x03040000
5351         0,                                  /* tp_finalize */
5352 #endif
5353 #ifdef COUNT_ALLOCS
5354         0,                                  /* tp_allocs */
5355         0,                                  /* tp_frees */
5356         0,                                  /* tp_maxalloc */
5357 #if PY_VERSION_HEX >= 0x02050000
5358         0,                                  /* tp_prev */
5359 #endif
5360         0                                   /* tp_next */
5361 #endif
5362       };
5363       varlink_type = tmp;
5364       type_init = 1;
5365 #if PY_VERSION_HEX < 0x02020000
5366       varlink_type.ob_type = &PyType_Type;
5367 #else
5368       if (PyType_Ready(&varlink_type) < 0)
5369       return NULL;
5370 #endif
5371     }
5372     return &varlink_type;
5373   }
5374 
5375   /* Create a variable linking object for use later */
5376   SWIGINTERN PyObject *
SWIG_Python_newvarlink(void)5377   SWIG_Python_newvarlink(void) {
5378     swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
5379     if (result) {
5380       result->vars = 0;
5381     }
5382     return ((PyObject*) result);
5383   }
5384 
5385   SWIGINTERN void
SWIG_Python_addvarlink(PyObject * p,char * name,PyObject * (* get_attr)(void),int (* set_attr)(PyObject * p))5386   SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
5387     swig_varlinkobject *v = (swig_varlinkobject *) p;
5388     swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
5389     if (gv) {
5390       size_t size = strlen(name)+1;
5391       gv->name = (char *)malloc(size);
5392       if (gv->name) {
5393         strncpy(gv->name,name,size);
5394         gv->get_attr = get_attr;
5395         gv->set_attr = set_attr;
5396         gv->next = v->vars;
5397       }
5398     }
5399     v->vars = gv;
5400   }
5401 
5402   SWIGINTERN PyObject *
SWIG_globals(void)5403   SWIG_globals(void) {
5404     static PyObject *_SWIG_globals = 0;
5405     if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
5406     return _SWIG_globals;
5407   }
5408 
5409   /* -----------------------------------------------------------------------------
5410    * constants/methods manipulation
5411    * ----------------------------------------------------------------------------- */
5412 
5413   /* Install Constants */
5414   SWIGINTERN void
SWIG_Python_InstallConstants(PyObject * d,swig_const_info constants[])5415   SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
5416     PyObject *obj = 0;
5417     size_t i;
5418     for (i = 0; constants[i].type; ++i) {
5419       switch(constants[i].type) {
5420       case SWIG_PY_POINTER:
5421         obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
5422         break;
5423       case SWIG_PY_BINARY:
5424         obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
5425         break;
5426       default:
5427         obj = 0;
5428         break;
5429       }
5430       if (obj) {
5431         PyDict_SetItemString(d, constants[i].name, obj);
5432         Py_DECREF(obj);
5433       }
5434     }
5435   }
5436 
5437   /* -----------------------------------------------------------------------------*/
5438   /* Fix SwigMethods to carry the callback ptrs when needed */
5439   /* -----------------------------------------------------------------------------*/
5440 
5441   SWIGINTERN void
SWIG_Python_FixMethods(PyMethodDef * methods,swig_const_info * const_table,swig_type_info ** types,swig_type_info ** types_initial)5442   SWIG_Python_FixMethods(PyMethodDef *methods,
5443     swig_const_info *const_table,
5444     swig_type_info **types,
5445     swig_type_info **types_initial) {
5446     size_t i;
5447     for (i = 0; methods[i].ml_name; ++i) {
5448       const char *c = methods[i].ml_doc;
5449       if (!c) continue;
5450       c = strstr(c, "swig_ptr: ");
5451       if (c) {
5452         int j;
5453         swig_const_info *ci = 0;
5454         const char *name = c + 10;
5455         for (j = 0; const_table[j].type; ++j) {
5456           if (strncmp(const_table[j].name, name,
5457               strlen(const_table[j].name)) == 0) {
5458             ci = &(const_table[j]);
5459             break;
5460           }
5461         }
5462         if (ci) {
5463           void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
5464           if (ptr) {
5465             size_t shift = (ci->ptype) - types;
5466             swig_type_info *ty = types_initial[shift];
5467             size_t ldoc = (c - methods[i].ml_doc);
5468             size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
5469             char *ndoc = (char*)malloc(ldoc + lptr + 10);
5470             if (ndoc) {
5471               char *buff = ndoc;
5472               memcpy(buff, methods[i].ml_doc, ldoc);
5473               buff += ldoc;
5474               memcpy(buff, "swig_ptr: ", 10);
5475               buff += 10;
5476               SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
5477               methods[i].ml_doc = ndoc;
5478             }
5479           }
5480         }
5481       }
5482     }
5483   }
5484 
5485 #ifdef __cplusplus
5486 }
5487 #endif
5488 
5489 /* -----------------------------------------------------------------------------*
5490  *  Partial Init method
5491  * -----------------------------------------------------------------------------*/
5492 
5493 #ifdef __cplusplus
5494 extern "C"
5495 #endif
5496 
5497 SWIGEXPORT
5498 #if PY_VERSION_HEX >= 0x03000000
5499 PyObject*
5500 #else
5501 void
5502 #endif
SWIG_init(void)5503 SWIG_init(void) {
5504   PyObject *m, *d, *md;
5505 #if PY_VERSION_HEX >= 0x03000000
5506   static struct PyModuleDef SWIG_module = {
5507 # if PY_VERSION_HEX >= 0x03020000
5508     PyModuleDef_HEAD_INIT,
5509 # else
5510     {
5511       PyObject_HEAD_INIT(NULL)
5512       NULL, /* m_init */
5513       0,    /* m_index */
5514       NULL, /* m_copy */
5515     },
5516 # endif
5517     (char *) SWIG_name,
5518     NULL,
5519     -1,
5520     SwigMethods,
5521     NULL,
5522     NULL,
5523     NULL,
5524     NULL
5525   };
5526 #endif
5527 
5528 #if defined(SWIGPYTHON_BUILTIN)
5529   static SwigPyClientData SwigPyObject_clientdata = {
5530     0, 0, 0, 0, 0, 0, 0
5531   };
5532   static PyGetSetDef this_getset_def = {
5533     (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
5534   };
5535   static SwigPyGetSet thisown_getset_closure = {
5536     SwigPyObject_own,
5537     SwigPyObject_own
5538   };
5539   static PyGetSetDef thisown_getset_def = {
5540     (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
5541   };
5542   PyTypeObject *builtin_pytype;
5543   int builtin_base_count;
5544   swig_type_info *builtin_basetype;
5545   PyObject *tuple;
5546   PyGetSetDescrObject *static_getset;
5547   PyTypeObject *metatype;
5548   PyTypeObject *swigpyobject;
5549   SwigPyClientData *cd;
5550   PyObject *public_interface, *public_symbol;
5551   PyObject *this_descr;
5552   PyObject *thisown_descr;
5553   PyObject *self = 0;
5554   int i;
5555 
5556   (void)builtin_pytype;
5557   (void)builtin_base_count;
5558   (void)builtin_basetype;
5559   (void)tuple;
5560   (void)static_getset;
5561   (void)self;
5562 
5563   /* Metaclass is used to implement static member variables */
5564   metatype = SwigPyObjectType();
5565   assert(metatype);
5566 #endif
5567 
5568   /* Fix SwigMethods to carry the callback ptrs when needed */
5569   SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
5570 
5571 #if PY_VERSION_HEX >= 0x03000000
5572   m = PyModule_Create(&SWIG_module);
5573 #else
5574   m = Py_InitModule((char *) SWIG_name, SwigMethods);
5575 #endif
5576 
5577   md = d = PyModule_GetDict(m);
5578   (void)md;
5579 
5580   SWIG_InitializeModule(0);
5581 
5582 #ifdef SWIGPYTHON_BUILTIN
5583   swigpyobject = SwigPyObject_TypeOnce();
5584 
5585   SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
5586   assert(SwigPyObject_stype);
5587   cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
5588   if (!cd) {
5589     SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
5590     SwigPyObject_clientdata.pytype = swigpyobject;
5591   } else if (swigpyobject->tp_basicsize != cd->pytype->tp_basicsize) {
5592     PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
5593 # if PY_VERSION_HEX >= 0x03000000
5594     return NULL;
5595 # else
5596     return;
5597 # endif
5598   }
5599 
5600   /* All objects have a 'this' attribute */
5601   this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
5602   (void)this_descr;
5603 
5604   /* All objects have a 'thisown' attribute */
5605   thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
5606   (void)thisown_descr;
5607 
5608   public_interface = PyList_New(0);
5609   public_symbol = 0;
5610   (void)public_symbol;
5611 
5612   PyDict_SetItemString(md, "__all__", public_interface);
5613   Py_DECREF(public_interface);
5614   for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
5615   SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
5616   for (i = 0; swig_const_table[i].name != 0; ++i)
5617   SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
5618 #endif
5619 
5620   SWIG_InstallConstants(d,swig_const_table);
5621 
5622 #if PY_VERSION_HEX >= 0x03000000
5623   return m;
5624 #else
5625   return;
5626 #endif
5627 }
5628 
5629