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