go-libwebp

Experimental translation from libwebp to Go source.
Log | Files | Refs | README | LICENSE

libwebp_python_wrap.c (173666B)


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