1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
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 * ----------------------------------------------------------------------------- */
12 #define SWIG_PYTHON_DIRECTOR_NO_VTABLE
14 /* -----------------------------------------------------------------------------
15 * This section contains generic SWIG labels for method/variable
16 * declarations/attributes, and other compiler dependent labels.
17 * ----------------------------------------------------------------------------- */
19 /* template workaround for compilers that cannot correctly implement the C++ standard */
20 #ifndef SWIGTEMPLATEDISAMBIGUATOR
21 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
22 # define SWIGTEMPLATEDISAMBIGUATOR template
23 # elif defined(__HP_aCC)
24 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
25 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
26 # define SWIGTEMPLATEDISAMBIGUATOR template
28 # define SWIGTEMPLATEDISAMBIGUATOR
32 /* inline attribute */
34 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
35 # define SWIGINLINE inline
41 /* attribute recognised by some compilers to avoid 'unused' warnings */
43 # if defined(__GNUC__)
44 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
45 # define SWIGUNUSED __attribute__ ((__unused__))
50 # define SWIGUNUSED __attribute__ ((__unused__))
56 #ifndef SWIG_MSC_UNSUPPRESS_4505
57 # if defined(_MSC_VER)
58 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
62 #ifndef SWIGUNUSEDPARM
64 # define SWIGUNUSEDPARM(p)
66 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
70 /* internal SWIG method */
72 # define SWIGINTERN static SWIGUNUSED
75 /* internal inline SWIG method */
76 #ifndef SWIGINTERNINLINE
77 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
80 /* exporting methods */
81 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
82 # ifndef GCC_HASCLASSVISIBILITY
83 # define GCC_HASCLASSVISIBILITY
88 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
89 # if defined(STATIC_LINKED)
92 # define SWIGEXPORT __declspec(dllexport)
95 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
96 # define SWIGEXPORT __attribute__ ((visibility("default")))
103 /* calling conventions for Windows */
105 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
106 # define SWIGSTDCALL __stdcall
112 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
113 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
114 # define _CRT_SECURE_NO_DEPRECATE
117 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
118 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
119 # define _SCL_SECURE_NO_DEPRECATE
124 /* Python.h has to appear first */
127 /* -----------------------------------------------------------------------------
130 * This file contains generic C API SWIG runtime support for pointer
132 * ----------------------------------------------------------------------------- */
134 /* This should only be incremented when either the layout of swig_type_info changes,
135 or for whatever reason, the runtime changes incompatibly */
136 #define SWIG_RUNTIME_VERSION "4"
138 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
139 #ifdef SWIG_TYPE_TABLE
140 # define SWIG_QUOTE_STRING(x) #x
141 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
142 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
144 # define SWIG_TYPE_TABLE_NAME
148 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
149 creating a static or dynamic library from the SWIG runtime code.
150 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
152 But only do this if strictly necessary, ie, if you have problems
153 with your compiler or suchlike.
157 # define SWIGRUNTIME SWIGINTERN
160 #ifndef SWIGRUNTIMEINLINE
161 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
164 /* Generic buffer size */
165 #ifndef SWIG_BUFFER_SIZE
166 # define SWIG_BUFFER_SIZE 1024
169 /* Flags for pointer conversions */
170 #define SWIG_POINTER_DISOWN 0x1
171 #define SWIG_CAST_NEW_MEMORY 0x2
173 /* Flags for new pointer objects */
174 #define SWIG_POINTER_OWN 0x1
178 Flags/methods for returning states.
180 The SWIG conversion methods, as ConvertPtr, return an integer
181 that tells if the conversion was successful or not. And if not,
182 an error code can be returned (see swigerrors.swg for the codes).
184 Use the following macros/flags to set or process the returning
187 In old versions of SWIG, code such as the following was usually written:
189 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
195 Now you can be more explicit:
197 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
198 if (SWIG_IsOK(res)) {
204 which is the same really, but now you can also do
207 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
208 if (SWIG_IsOK(res)) {
210 if (SWIG_IsNewObj(res) {
220 I.e., now SWIG_ConvertPtr can return new objects and you can
221 identify the case and take care of the deallocation. Of course that
222 also requires SWIG_ConvertPtr to return new result values, such as
224 int SWIG_ConvertPtr(obj, ptr,...) {
226 if (<need new object>) {
227 *ptr = <ptr to new allocated object>;
230 *ptr = <ptr to old object>;
238 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
239 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
242 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
243 allows to return the 'cast rank', for example, if you have this
250 food(1) // cast rank '1' (1 -> 1.0)
251 fooi(1) // cast rank '0'
253 just use the SWIG_AddCast()/SWIG_CheckState()
257 #define SWIG_ERROR (-1)
258 #define SWIG_IsOK(r) (r >= 0)
259 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
261 /* The CastRankLimit says how many bits are used for the cast rank */
262 #define SWIG_CASTRANKLIMIT (1 << 8)
263 /* The NewMask denotes the object was created (using new/malloc) */
264 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
265 /* The TmpMask is for in/out typemaps that use temporal objects */
266 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
267 /* Simple returning values */
268 #define SWIG_BADOBJ (SWIG_ERROR)
269 #define SWIG_OLDOBJ (SWIG_OK)
270 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
271 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
272 /* Check, add and del mask methods */
273 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
274 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
275 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
276 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
277 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
278 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
281 #if defined(SWIG_CASTRANK_MODE)
282 # ifndef SWIG_TypeRank
283 # define SWIG_TypeRank unsigned long
285 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
286 # define SWIG_MAXCASTRANK (2)
288 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
289 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
290 SWIGINTERNINLINE int SWIG_AddCast(int r) {
291 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
293 SWIGINTERNINLINE int SWIG_CheckState(int r) {
294 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
296 #else /* no cast-rank mode */
297 # define SWIG_AddCast
298 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
308 typedef void *(*swig_converter_func)(void *, int *);
309 typedef struct swig_type_info *(*swig_dycast_func)(void **);
311 /* Structure to store information on one type */
312 typedef struct swig_type_info {
313 const char *name; /* mangled name of this type */
314 const char *str; /* human readable name of this type */
315 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
316 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
317 void *clientdata; /* language specific type data */
318 int owndata; /* flag if the structure owns the clientdata */
321 /* Structure to store a type and conversion function used for casting */
322 typedef struct swig_cast_info {
323 swig_type_info *type; /* pointer to type that is equivalent to this type */
324 swig_converter_func converter; /* function to cast the void pointers */
325 struct swig_cast_info *next; /* pointer to next cast in linked list */
326 struct swig_cast_info *prev; /* pointer to the previous cast */
329 /* Structure used to store module information
330 * Each module generates one structure like this, and the runtime collects
331 * all of these structures and stores them in a circularly linked list.*/
332 typedef struct swig_module_info {
333 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
334 size_t size; /* Number of types in this module */
335 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
336 swig_type_info **type_initial; /* Array of initially generated type structures */
337 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
338 void *clientdata; /* Language specific module data */
342 Compare two type names skipping the space characters, therefore
343 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
345 Return 0 when the two name types are equivalent, as in
346 strncmp, but skipping ' '.
349 SWIG_TypeNameComp(const char *f1, const char *l1,
350 const char *f2, const char *l2) {
351 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
352 while ((*f1 == ' ') && (f1 != l1)) ++f1;
353 while ((*f2 == ' ') && (f2 != l2)) ++f2;
354 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
356 return (int)((l1 - f1) - (l2 - f2));
360 Check type equivalence in a name list like <name1>|<name2>|...
361 Return 0 if not equal, 1 if equal
364 SWIG_TypeEquiv(const char *nb, const char *tb) {
366 const char* te = tb + strlen(tb);
368 while (!equiv && *ne) {
369 for (nb = ne; *ne; ++ne) {
370 if (*ne == '|') break;
372 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
379 Check type equivalence in a name list like <name1>|<name2>|...
380 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
383 SWIG_TypeCompare(const char *nb, const char *tb) {
385 const char* te = tb + strlen(tb);
387 while (!equiv && *ne) {
388 for (nb = ne; *ne; ++ne) {
389 if (*ne == '|') break;
391 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
401 SWIGRUNTIME swig_cast_info *
402 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
404 swig_cast_info *iter = ty->cast;
406 if (strcmp(iter->type->name, c) == 0) {
407 if (iter == ty->cast)
409 /* Move iter to the top of the linked list */
410 iter->prev->next = iter->next;
412 iter->next->prev = iter->prev;
413 iter->next = ty->cast;
415 if (ty->cast) ty->cast->prev = iter;
426 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
428 SWIGRUNTIME swig_cast_info *
429 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
431 swig_cast_info *iter = ty->cast;
433 if (iter->type == from) {
434 if (iter == ty->cast)
436 /* Move iter to the top of the linked list */
437 iter->prev->next = iter->next;
439 iter->next->prev = iter->prev;
440 iter->next = ty->cast;
442 if (ty->cast) ty->cast->prev = iter;
453 Cast a pointer up an inheritance hierarchy
455 SWIGRUNTIMEINLINE void *
456 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
457 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
461 Dynamic pointer casting. Down an inheritance hierarchy
463 SWIGRUNTIME swig_type_info *
464 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
465 swig_type_info *lastty = ty;
466 if (!ty || !ty->dcast) return ty;
467 while (ty && (ty->dcast)) {
468 ty = (*ty->dcast)(ptr);
475 Return the name associated with this type
477 SWIGRUNTIMEINLINE const char *
478 SWIG_TypeName(const swig_type_info *ty) {
483 Return the pretty name associated with this type,
484 that is an unmangled type name in a form presentable to the user.
486 SWIGRUNTIME const char *
487 SWIG_TypePrettyName(const swig_type_info *type) {
488 /* The "str" field contains the equivalent pretty names of the
489 type, separated by vertical-bar characters. We choose
490 to print the last name, as it is often (?) the most
492 if (!type) return NULL;
493 if (type->str != NULL) {
494 const char *last_name = type->str;
496 for (s = type->str; *s; s++)
497 if (*s == '|') last_name = s+1;
505 Set the clientdata field for a type
508 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
509 swig_cast_info *cast = ti->cast;
510 /* if (ti->clientdata == clientdata) return; */
511 ti->clientdata = clientdata;
514 if (!cast->converter) {
515 swig_type_info *tc = cast->type;
516 if (!tc->clientdata) {
517 SWIG_TypeClientData(tc, clientdata);
524 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
525 SWIG_TypeClientData(ti, clientdata);
530 Search for a swig_type_info structure only by mangled name
531 Search is a O(log #types)
533 We start searching at module start, and finish searching when start == end.
534 Note: if start == end at the beginning of the function, we go all the way around
537 SWIGRUNTIME swig_type_info *
538 SWIG_MangledTypeQueryModule(swig_module_info *start,
539 swig_module_info *end,
541 swig_module_info *iter = start;
544 register size_t l = 0;
545 register size_t r = iter->size - 1;
547 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
548 register size_t i = (l + r) >> 1;
549 const char *iname = iter->types[i]->name;
551 register int compare = strcmp(name, iname);
553 return iter->types[i];
554 } else if (compare < 0) {
560 } else if (compare > 0) {
564 break; /* should never happen */
569 } while (iter != end);
574 Search for a swig_type_info structure for either a mangled name or a human readable name.
575 It first searches the mangled names of the types, which is a O(log #types)
576 If a type is not found it then searches the human readable names, which is O(#types).
578 We start searching at module start, and finish searching when start == end.
579 Note: if start == end at the beginning of the function, we go all the way around
582 SWIGRUNTIME swig_type_info *
583 SWIG_TypeQueryModule(swig_module_info *start,
584 swig_module_info *end,
586 /* STEP 1: Search the name field using binary search */
587 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
591 /* STEP 2: If the type hasn't been found, do a complete search
592 of the str field (the human readable name) */
593 swig_module_info *iter = start;
595 register size_t i = 0;
596 for (; i < iter->size; ++i) {
597 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
598 return iter->types[i];
601 } while (iter != end);
604 /* neither found a match */
609 Pack binary data into a string
612 SWIG_PackData(char *c, void *ptr, size_t sz) {
613 static const char hex[17] = "0123456789abcdef";
614 register const unsigned char *u = (unsigned char *) ptr;
615 register const unsigned char *eu = u + sz;
616 for (; u != eu; ++u) {
617 register unsigned char uu = *u;
618 *(c++) = hex[(uu & 0xf0) >> 4];
619 *(c++) = hex[uu & 0xf];
625 Unpack binary data from a string
627 SWIGRUNTIME const char *
628 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
629 register unsigned char *u = (unsigned char *) ptr;
630 register const unsigned char *eu = u + sz;
631 for (; u != eu; ++u) {
632 register char d = *(c++);
633 register unsigned char uu;
634 if ((d >= '0') && (d <= '9'))
635 uu = ((d - '0') << 4);
636 else if ((d >= 'a') && (d <= 'f'))
637 uu = ((d - ('a'-10)) << 4);
641 if ((d >= '0') && (d <= '9'))
643 else if ((d >= 'a') && (d <= 'f'))
644 uu |= (d - ('a'-10));
653 Pack 'void *' into a string buffer.
656 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
658 if ((2*sizeof(void *) + 2) > bsz) return 0;
660 r = SWIG_PackData(r,&ptr,sizeof(void *));
661 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
666 SWIGRUNTIME const char *
667 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
669 if (strcmp(c,"NULL") == 0) {
676 return SWIG_UnpackData(++c,ptr,sizeof(void *));
680 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
682 size_t lname = (name ? strlen(name) : 0);
683 if ((2*sz + 2 + lname) > bsz) return 0;
685 r = SWIG_PackData(r,ptr,sz);
687 strncpy(r,name,lname+1);
694 SWIGRUNTIME const char *
695 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
697 if (strcmp(c,"NULL") == 0) {
704 return SWIG_UnpackData(++c,ptr,sz);
712 #define SWIG_UnknownError -1
713 #define SWIG_IOError -2
714 #define SWIG_RuntimeError -3
715 #define SWIG_IndexError -4
716 #define SWIG_TypeError -5
717 #define SWIG_DivisionByZero -6
718 #define SWIG_OverflowError -7
719 #define SWIG_SyntaxError -8
720 #define SWIG_ValueError -9
721 #define SWIG_SystemError -10
722 #define SWIG_AttributeError -11
723 #define SWIG_MemoryError -12
724 #define SWIG_NullReferenceError -13
728 /* Compatibility macros for Python 3 */
729 #if PY_VERSION_HEX >= 0x03000000
731 #define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
732 #define PyInt_Check(x) PyLong_Check(x)
733 #define PyInt_AsLong(x) PyLong_AsLong(x)
734 #define PyInt_FromLong(x) PyLong_FromLong(x)
735 #define PyString_Check(name) PyBytes_Check(name)
736 #define PyString_FromString(x) PyUnicode_FromString(x)
737 #define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
738 #define PyString_AsString(str) PyBytes_AsString(str)
739 #define PyString_Size(str) PyBytes_Size(str)
740 #define PyString_InternFromString(key) PyUnicode_InternFromString(key)
741 #define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
742 #define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
743 #define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
748 # define Py_TYPE(op) ((op)->ob_type)
751 /* SWIG APIs for compatibility of both Python 2 & 3 */
753 #if PY_VERSION_HEX >= 0x03000000
754 # define SWIG_Python_str_FromFormat PyUnicode_FromFormat
756 # define SWIG_Python_str_FromFormat PyString_FromFormat
760 /* Warning: This function will allocate a new string in Python 3,
761 * so please call SWIG_Python_str_DelForPy3(x) to free the space.
764 SWIG_Python_str_AsChar(PyObject *str)
766 #if PY_VERSION_HEX >= 0x03000000
770 str = PyUnicode_AsUTF8String(str);
771 PyBytes_AsStringAndSize(str, &cstr, &len);
772 newstr = (char *) malloc(len+1);
773 memcpy(newstr, cstr, len+1);
777 return PyString_AsString(str);
781 #if PY_VERSION_HEX >= 0x03000000
782 # define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
784 # define SWIG_Python_str_DelForPy3(x)
789 SWIG_Python_str_FromChar(const char *c)
791 #if PY_VERSION_HEX >= 0x03000000
792 return PyUnicode_FromString(c);
794 return PyString_FromString(c);
798 /* Add PyOS_snprintf for old Pythons */
799 #if PY_VERSION_HEX < 0x02020000
800 # if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
801 # define PyOS_snprintf _snprintf
803 # define PyOS_snprintf snprintf
807 /* A crude PyString_FromFormat implementation for old Pythons */
808 #if PY_VERSION_HEX < 0x02020000
810 #ifndef SWIG_PYBUFFER_SIZE
811 # define SWIG_PYBUFFER_SIZE 1024
815 PyString_FromFormat(const char *fmt, ...) {
817 char buf[SWIG_PYBUFFER_SIZE * 2];
820 res = vsnprintf(buf, sizeof(buf), fmt, ap);
822 return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
826 /* Add PyObject_Del for old Pythons */
827 #if PY_VERSION_HEX < 0x01060000
828 # define PyObject_Del(op) PyMem_DEL((op))
831 # define PyObject_DEL PyObject_Del
834 /* A crude PyExc_StopIteration exception for old Pythons */
835 #if PY_VERSION_HEX < 0x02020000
836 # ifndef PyExc_StopIteration
837 # define PyExc_StopIteration PyExc_RuntimeError
839 # ifndef PyObject_GenericGetAttr
840 # define PyObject_GenericGetAttr 0
844 /* Py_NotImplemented is defined in 2.1 and up. */
845 #if PY_VERSION_HEX < 0x02010000
846 # ifndef Py_NotImplemented
847 # define Py_NotImplemented PyExc_RuntimeError
851 /* A crude PyString_AsStringAndSize implementation for old Pythons */
852 #if PY_VERSION_HEX < 0x02010000
853 # ifndef PyString_AsStringAndSize
854 # define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
858 /* PySequence_Size for old Pythons */
859 #if PY_VERSION_HEX < 0x02000000
860 # ifndef PySequence_Size
861 # define PySequence_Size PySequence_Length
865 /* PyBool_FromLong for old Pythons */
866 #if PY_VERSION_HEX < 0x02030000
868 PyObject *PyBool_FromLong(long ok)
870 PyObject *result = ok ? Py_True : Py_False;
876 /* Py_ssize_t for old Pythons */
877 /* This code is as recommended by: */
878 /* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
879 #if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
880 typedef int Py_ssize_t;
881 # define PY_SSIZE_T_MAX INT_MAX
882 # define PY_SSIZE_T_MIN INT_MIN
883 typedef inquiry lenfunc;
884 typedef intargfunc ssizeargfunc;
885 typedef intintargfunc ssizessizeargfunc;
886 typedef intobjargproc ssizeobjargproc;
887 typedef intintobjargproc ssizessizeobjargproc;
888 typedef getreadbufferproc readbufferproc;
889 typedef getwritebufferproc writebufferproc;
890 typedef getsegcountproc segcountproc;
891 typedef getcharbufferproc charbufferproc;
892 static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
895 PyObject *i = PyNumber_Int(x);
897 result = PyInt_AsLong(i);
904 #if PY_VERSION_HEX < 0x02040000
905 #define Py_VISIT(op) \
908 int vret = visit((op), arg); \
915 #if PY_VERSION_HEX < 0x02030000
918 PyNumberMethods as_number;
919 PyMappingMethods as_mapping;
920 PySequenceMethods as_sequence;
921 PyBufferProcs as_buffer;
922 PyObject *name, *slots;
926 #if PY_VERSION_HEX < 0x02030000
927 typedef destructor freefunc;
930 #if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
931 (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
932 (PY_MAJOR_VERSION > 3))
933 # define SWIGPY_USE_CAPSULE
934 # define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
937 #if PY_VERSION_HEX < 0x03020000
938 #define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
939 #define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
942 /* -----------------------------------------------------------------------------
944 * ----------------------------------------------------------------------------- */
946 SWIGRUNTIME PyObject*
947 SWIG_Python_ErrorType(int code) {
950 case SWIG_MemoryError:
951 type = PyExc_MemoryError;
954 type = PyExc_IOError;
956 case SWIG_RuntimeError:
957 type = PyExc_RuntimeError;
959 case SWIG_IndexError:
960 type = PyExc_IndexError;
963 type = PyExc_TypeError;
965 case SWIG_DivisionByZero:
966 type = PyExc_ZeroDivisionError;
968 case SWIG_OverflowError:
969 type = PyExc_OverflowError;
971 case SWIG_SyntaxError:
972 type = PyExc_SyntaxError;
974 case SWIG_ValueError:
975 type = PyExc_ValueError;
977 case SWIG_SystemError:
978 type = PyExc_SystemError;
980 case SWIG_AttributeError:
981 type = PyExc_AttributeError;
984 type = PyExc_RuntimeError;
991 SWIG_Python_AddErrorMsg(const char* mesg)
995 PyObject *traceback = 0;
997 if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
1000 PyObject *old_str = PyObject_Str(value);
1004 PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
1005 SWIG_Python_str_DelForPy3(tmp);
1009 PyErr_SetString(PyExc_RuntimeError, mesg);
1013 #if defined(SWIG_PYTHON_NO_THREADS)
1014 # if defined(SWIG_PYTHON_THREADS)
1015 # undef SWIG_PYTHON_THREADS
1018 #if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
1019 # if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
1020 # if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
1021 # define SWIG_PYTHON_USE_GIL
1024 # if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
1025 # ifndef SWIG_PYTHON_INITIALIZE_THREADS
1026 # define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
1028 # ifdef __cplusplus /* C++ code */
1029 class SWIG_Python_Thread_Block {
1031 PyGILState_STATE state;
1033 void end() { if (status) { PyGILState_Release(state); status = false;} }
1034 SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
1035 ~SWIG_Python_Thread_Block() { end(); }
1037 class SWIG_Python_Thread_Allow {
1039 PyThreadState *save;
1041 void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
1042 SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
1043 ~SWIG_Python_Thread_Allow() { end(); }
1045 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
1046 # define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
1047 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
1048 # define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
1050 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
1051 # define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
1052 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
1053 # define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
1055 # else /* Old thread way, not implemented, user must provide it */
1056 # if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
1057 # define SWIG_PYTHON_INITIALIZE_THREADS
1059 # if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
1060 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1062 # if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
1063 # define SWIG_PYTHON_THREAD_END_BLOCK
1065 # if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
1066 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1068 # if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
1069 # define SWIG_PYTHON_THREAD_END_ALLOW
1072 #else /* No thread support */
1073 # define SWIG_PYTHON_INITIALIZE_THREADS
1074 # define SWIG_PYTHON_THREAD_BEGIN_BLOCK
1075 # define SWIG_PYTHON_THREAD_END_BLOCK
1076 # define SWIG_PYTHON_THREAD_BEGIN_ALLOW
1077 # define SWIG_PYTHON_THREAD_END_ALLOW
1080 /* -----------------------------------------------------------------------------
1081 * Python API portion that goes into the runtime
1082 * ----------------------------------------------------------------------------- */
1088 /* -----------------------------------------------------------------------------
1089 * Constant declarations
1090 * ----------------------------------------------------------------------------- */
1092 /* Constant Types */
1093 #define SWIG_PY_POINTER 4
1094 #define SWIG_PY_BINARY 5
1096 /* Constant information structure */
1097 typedef struct swig_const_info {
1103 swig_type_info **ptype;
1107 /* -----------------------------------------------------------------------------
1108 * Wrapper of PyInstanceMethod_New() used in Python 3
1109 * It is exported to the generated module, used for -fastproxy
1110 * ----------------------------------------------------------------------------- */
1111 #if PY_VERSION_HEX >= 0x03000000
1112 SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
1114 return PyInstanceMethod_New(func);
1117 SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
1128 /* -----------------------------------------------------------------------------
1131 * This file contains the runtime support for Python modules
1132 * and includes code for managing global variables and pointer
1135 * ----------------------------------------------------------------------------- */
1137 /* Common SWIG API */
1139 /* for raw pointers */
1140 #define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1141 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
1142 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1144 #ifdef SWIGPYTHON_BUILTIN
1145 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
1147 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1150 #define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
1152 #define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
1153 #define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
1154 #define swig_owntype int
1156 /* for raw packed data */
1157 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1158 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1160 /* for class or struct pointers */
1161 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1162 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1164 /* for C or C++ function pointers */
1165 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
1166 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
1168 /* for C++ member pointers, ie, member methods */
1169 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
1170 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
1175 #define SWIG_GetModule(clientdata) SWIG_Python_GetModule()
1176 #define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
1177 #define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
1179 #define SWIG_SetErrorObj SWIG_Python_SetErrorObj
1180 #define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
1181 #define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
1182 #define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
1183 #define SWIG_fail goto fail
1186 /* Runtime API implementation */
1188 /* Error manipulation */
1191 SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
1192 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1193 PyErr_SetObject(errtype, obj);
1195 SWIG_PYTHON_THREAD_END_BLOCK;
1199 SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
1200 SWIG_PYTHON_THREAD_BEGIN_BLOCK;
1201 PyErr_SetString(errtype, (char *) msg);
1202 SWIG_PYTHON_THREAD_END_BLOCK;
1205 #define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
1207 /* Set a constant value */
1209 #if defined(SWIGPYTHON_BUILTIN)
1212 SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
1213 PyObject *s = PyString_InternFromString(key);
1214 PyList_Append(seq, s);
1219 SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
1220 PyDict_SetItemString(d, (char *)name, obj);
1222 if (public_interface)
1223 SwigPyBuiltin_AddPublicSymbol(public_interface, name);
1229 SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
1230 PyDict_SetItemString(d, (char *)name, obj);
1236 /* Append a value to the result obj */
1238 SWIGINTERN PyObject*
1239 SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
1240 #if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
1243 } else if (result == Py_None) {
1247 if (!PyList_Check(result)) {
1248 PyObject *o2 = result;
1249 result = PyList_New(1);
1250 PyList_SetItem(result, 0, o2);
1252 PyList_Append(result,obj);
1261 } else if (result == Py_None) {
1265 if (!PyTuple_Check(result)) {
1267 result = PyTuple_New(1);
1268 PyTuple_SET_ITEM(result, 0, o2);
1270 o3 = PyTuple_New(1);
1271 PyTuple_SET_ITEM(o3, 0, obj);
1273 result = PySequence_Concat(o2, o3);
1281 /* Unpack the argument tuple */
1284 SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
1290 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
1291 name, (min == max ? "" : "at least "), (int)min);
1295 if (!PyTuple_Check(args)) {
1296 if (min <= 1 && max >= 1) {
1299 for (i = 1; i < max; ++i) {
1304 PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
1307 register Py_ssize_t l = PyTuple_GET_SIZE(args);
1309 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1310 name, (min == max ? "" : "at least "), (int)min, (int)l);
1312 } else if (l > max) {
1313 PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
1314 name, (min == max ? "" : "at most "), (int)max, (int)l);
1318 for (i = 0; i < l; ++i) {
1319 objs[i] = PyTuple_GET_ITEM(args, i);
1321 for (; l < max; ++l) {
1329 /* A functor is a function object with one single object argument */
1330 #if PY_VERSION_HEX >= 0x02020000
1331 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
1333 #define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
1337 Helper for static pointer initialization for both C and C++ code, for example
1338 static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
1341 #define SWIG_STATIC_POINTER(var) var
1343 #define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
1346 /* -----------------------------------------------------------------------------
1347 * Pointer declarations
1348 * ----------------------------------------------------------------------------- */
1350 /* Flags for new pointer objects */
1351 #define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
1352 #define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
1354 #define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
1356 #define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
1357 #define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
1363 /* How to access Py_None */
1364 #if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
1365 # ifndef SWIG_PYTHON_NO_BUILD_NONE
1366 # ifndef SWIG_PYTHON_BUILD_NONE
1367 # define SWIG_PYTHON_BUILD_NONE
1372 #ifdef SWIG_PYTHON_BUILD_NONE
1375 # define Py_None SWIG_Py_None()
1377 SWIGRUNTIMEINLINE PyObject *
1380 PyObject *none = Py_BuildValue((char*)"");
1384 SWIGRUNTIME PyObject *
1387 static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
1392 /* The python void return value */
1394 SWIGRUNTIMEINLINE PyObject *
1397 PyObject *none = Py_None;
1402 /* SwigPyClientData */
1411 PyTypeObject *pytype;
1414 SWIGRUNTIMEINLINE int
1415 SWIG_Python_CheckImplicit(swig_type_info *ty)
1417 SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
1418 return data ? data->implicitconv : 0;
1421 SWIGRUNTIMEINLINE PyObject *
1422 SWIG_Python_ExceptionType(swig_type_info *desc) {
1423 SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
1424 PyObject *klass = data ? data->klass : 0;
1425 return (klass ? klass : PyExc_RuntimeError);
1429 SWIGRUNTIME SwigPyClientData *
1430 SwigPyClientData_New(PyObject* obj)
1435 SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
1436 /* the klass element */
1438 Py_INCREF(data->klass);
1439 /* the newraw method and newargs arguments used to create a new raw instance */
1440 if (PyClass_Check(obj)) {
1442 data->newargs = obj;
1445 #if (PY_VERSION_HEX < 0x02020000)
1448 data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
1451 Py_INCREF(data->newraw);
1452 data->newargs = PyTuple_New(1);
1453 PyTuple_SetItem(data->newargs, 0, obj);
1455 data->newargs = obj;
1457 Py_INCREF(data->newargs);
1459 /* the destroy method, aka as the C++ delete method */
1460 data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
1461 if (PyErr_Occurred()) {
1465 if (data->destroy) {
1467 Py_INCREF(data->destroy);
1468 flags = PyCFunction_GET_FLAGS(data->destroy);
1470 data->delargs = !(flags & (METH_O));
1477 data->implicitconv = 0;
1484 SwigPyClientData_Del(SwigPyClientData *data) {
1485 Py_XDECREF(data->newraw);
1486 Py_XDECREF(data->newargs);
1487 Py_XDECREF(data->destroy);
1490 /* =============== SwigPyObject =====================*/
1498 #ifdef SWIGPYTHON_BUILTIN
1503 SWIGRUNTIME PyObject *
1504 SwigPyObject_long(SwigPyObject *v)
1506 return PyLong_FromVoidPtr(v->ptr);
1509 SWIGRUNTIME PyObject *
1510 SwigPyObject_format(const char* fmt, SwigPyObject *v)
1512 PyObject *res = NULL;
1513 PyObject *args = PyTuple_New(1);
1515 if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
1516 PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
1518 #if PY_VERSION_HEX >= 0x03000000
1519 res = PyUnicode_Format(ofmt,args);
1521 res = PyString_Format(ofmt,args);
1531 SWIGRUNTIME PyObject *
1532 SwigPyObject_oct(SwigPyObject *v)
1534 return SwigPyObject_format("%o",v);
1537 SWIGRUNTIME PyObject *
1538 SwigPyObject_hex(SwigPyObject *v)
1540 return SwigPyObject_format("%x",v);
1543 SWIGRUNTIME PyObject *
1545 SwigPyObject_repr(SwigPyObject *v)
1547 SwigPyObject_repr(SwigPyObject *v, PyObject *args)
1550 const char *name = SWIG_TypePrettyName(v->ty);
1551 PyObject *repr = SWIG_Python_str_FromFormat("<Swig Object of type '%s' at %p>", name, (void *)v);
1554 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
1556 PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
1558 # if PY_VERSION_HEX >= 0x03000000
1559 PyObject *joined = PyUnicode_Concat(repr, nrep);
1564 PyString_ConcatAndDel(&repr,nrep);
1571 SwigPyObject_print(SwigPyObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1575 PyObject *repr = SwigPyObject_repr(v);
1577 PyObject *repr = SwigPyObject_repr(v, NULL);
1580 str = SWIG_Python_str_AsChar(repr);
1582 SWIG_Python_str_DelForPy3(str);
1590 SWIGRUNTIME PyObject *
1591 SwigPyObject_str(SwigPyObject *v)
1593 char result[SWIG_BUFFER_SIZE];
1594 return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
1595 SWIG_Python_str_FromChar(result) : 0;
1599 SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
1603 return (i < j) ? -1 : ((i > j) ? 1 : 0);
1606 /* Added for Python 3.x, would it also be useful for Python 2.x? */
1607 SWIGRUNTIME PyObject*
1608 SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
1611 if( op != Py_EQ && op != Py_NE ) {
1612 Py_INCREF(Py_NotImplemented);
1613 return Py_NotImplemented;
1615 res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
1620 SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
1622 #ifdef SWIGPYTHON_BUILTIN
1623 static swig_type_info *SwigPyObject_stype = 0;
1624 SWIGRUNTIME PyTypeObject*
1625 SwigPyObject_type(void) {
1626 SwigPyClientData *cd;
1627 assert(SwigPyObject_stype);
1628 cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
1634 SWIGRUNTIME PyTypeObject*
1635 SwigPyObject_type(void) {
1636 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
1641 SWIGRUNTIMEINLINE int
1642 SwigPyObject_Check(PyObject *op) {
1643 #ifdef SWIGPYTHON_BUILTIN
1644 PyTypeObject *target_tp = SwigPyObject_type();
1645 if (PyType_IsSubtype(op->ob_type, target_tp))
1647 return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
1649 return (Py_TYPE(op) == SwigPyObject_type())
1650 || (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
1654 SWIGRUNTIME PyObject *
1655 SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
1658 SwigPyObject_dealloc(PyObject *v)
1660 SwigPyObject *sobj = (SwigPyObject *) v;
1661 PyObject *next = sobj->next;
1662 if (sobj->own == SWIG_POINTER_OWN) {
1663 swig_type_info *ty = sobj->ty;
1664 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
1665 PyObject *destroy = data ? data->destroy : 0;
1667 /* destroy is always a VARARGS method */
1669 if (data->delargs) {
1670 /* we need to create a temporary object to carry the destroy operation */
1671 PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
1672 res = SWIG_Python_CallFunctor(destroy, tmp);
1675 PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
1676 PyObject *mself = PyCFunction_GET_SELF(destroy);
1677 res = ((*meth)(mself, v));
1681 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
1683 const char *name = SWIG_TypePrettyName(ty);
1684 printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
1692 SWIGRUNTIME PyObject*
1693 SwigPyObject_append(PyObject* v, PyObject* next)
1695 SwigPyObject *sobj = (SwigPyObject *) v;
1698 if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
1701 if (!SwigPyObject_Check(next)) {
1706 return SWIG_Py_Void();
1709 SWIGRUNTIME PyObject*
1711 SwigPyObject_next(PyObject* v)
1713 SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1716 SwigPyObject *sobj = (SwigPyObject *) v;
1718 Py_INCREF(sobj->next);
1721 return SWIG_Py_Void();
1725 SWIGINTERN PyObject*
1727 SwigPyObject_disown(PyObject *v)
1729 SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1732 SwigPyObject *sobj = (SwigPyObject *)v;
1734 return SWIG_Py_Void();
1737 SWIGINTERN PyObject*
1739 SwigPyObject_acquire(PyObject *v)
1741 SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
1744 SwigPyObject *sobj = (SwigPyObject *)v;
1745 sobj->own = SWIG_POINTER_OWN;
1746 return SWIG_Py_Void();
1749 SWIGINTERN PyObject*
1750 SwigPyObject_own(PyObject *v, PyObject *args)
1753 #if (PY_VERSION_HEX < 0x02020000)
1754 if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
1756 if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
1763 SwigPyObject *sobj = (SwigPyObject *)v;
1764 PyObject *obj = PyBool_FromLong(sobj->own);
1767 if (PyObject_IsTrue(val)) {
1768 SwigPyObject_acquire(v);
1770 SwigPyObject_disown(v);
1773 if (PyObject_IsTrue(val)) {
1774 SwigPyObject_acquire(v,args);
1776 SwigPyObject_disown(v,args);
1786 swigobject_methods[] = {
1787 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
1788 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"aquires ownership of the pointer"},
1789 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1790 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
1791 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
1792 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"},
1797 swigobject_methods[] = {
1798 {(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
1799 {(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"aquires ownership of the pointer"},
1800 {(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
1801 {(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
1802 {(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
1803 {(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"},
1808 #if PY_VERSION_HEX < 0x02020000
1809 SWIGINTERN PyObject *
1810 SwigPyObject_getattr(SwigPyObject *sobj,char *name)
1812 return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
1816 SWIGRUNTIME PyTypeObject*
1817 SwigPyObject_TypeOnce(void) {
1818 static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
1820 static PyNumberMethods SwigPyObject_as_number = {
1821 (binaryfunc)0, /*nb_add*/
1822 (binaryfunc)0, /*nb_subtract*/
1823 (binaryfunc)0, /*nb_multiply*/
1824 /* nb_divide removed in Python 3 */
1825 #if PY_VERSION_HEX < 0x03000000
1826 (binaryfunc)0, /*nb_divide*/
1828 (binaryfunc)0, /*nb_remainder*/
1829 (binaryfunc)0, /*nb_divmod*/
1830 (ternaryfunc)0,/*nb_power*/
1831 (unaryfunc)0, /*nb_negative*/
1832 (unaryfunc)0, /*nb_positive*/
1833 (unaryfunc)0, /*nb_absolute*/
1834 (inquiry)0, /*nb_nonzero*/
1841 #if PY_VERSION_HEX < 0x03000000
1844 (unaryfunc)SwigPyObject_long, /*nb_int*/
1845 #if PY_VERSION_HEX < 0x03000000
1846 (unaryfunc)SwigPyObject_long, /*nb_long*/
1850 (unaryfunc)0, /*nb_float*/
1851 #if PY_VERSION_HEX < 0x03000000
1852 (unaryfunc)SwigPyObject_oct, /*nb_oct*/
1853 (unaryfunc)SwigPyObject_hex, /*nb_hex*/
1855 #if PY_VERSION_HEX >= 0x03000000 /* 3.0 */
1856 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
1857 #elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
1858 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
1859 #elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
1860 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
1861 #elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
1862 0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
1866 static PyTypeObject swigpyobject_type;
1867 static int type_init = 0;
1869 const PyTypeObject tmp = {
1870 /* PyObject header changed in Python 3 */
1871 #if PY_VERSION_HEX >= 0x03000000
1872 PyVarObject_HEAD_INIT(NULL, 0)
1874 PyObject_HEAD_INIT(NULL)
1877 (char *)"SwigPyObject", /* tp_name */
1878 sizeof(SwigPyObject), /* tp_basicsize */
1879 0, /* tp_itemsize */
1880 (destructor)SwigPyObject_dealloc, /* tp_dealloc */
1881 (printfunc)SwigPyObject_print, /* tp_print */
1882 #if PY_VERSION_HEX < 0x02020000
1883 (getattrfunc)SwigPyObject_getattr, /* tp_getattr */
1885 (getattrfunc)0, /* tp_getattr */
1887 (setattrfunc)0, /* tp_setattr */
1888 #if PY_VERSION_HEX >= 0x03000000
1889 0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
1891 (cmpfunc)SwigPyObject_compare, /* tp_compare */
1893 (reprfunc)SwigPyObject_repr, /* tp_repr */
1894 &SwigPyObject_as_number, /* tp_as_number */
1895 0, /* tp_as_sequence */
1896 0, /* tp_as_mapping */
1897 (hashfunc)0, /* tp_hash */
1898 (ternaryfunc)0, /* tp_call */
1899 (reprfunc)SwigPyObject_str, /* tp_str */
1900 PyObject_GenericGetAttr, /* tp_getattro */
1901 0, /* tp_setattro */
1902 0, /* tp_as_buffer */
1903 Py_TPFLAGS_DEFAULT, /* tp_flags */
1904 swigobject_doc, /* tp_doc */
1905 0, /* tp_traverse */
1907 (richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
1908 0, /* tp_weaklistoffset */
1909 #if PY_VERSION_HEX >= 0x02020000
1911 0, /* tp_iternext */
1912 swigobject_methods, /* tp_methods */
1917 0, /* tp_descr_get */
1918 0, /* tp_descr_set */
1919 0, /* tp_dictoffset */
1928 0, /* tp_subclasses */
1929 0, /* tp_weaklist */
1931 #if PY_VERSION_HEX >= 0x02030000
1934 #if PY_VERSION_HEX >= 0x02060000
1938 0,0,0,0 /* tp_alloc -> tp_next */
1941 swigpyobject_type = tmp;
1943 #if PY_VERSION_HEX < 0x02020000
1944 swigpyobject_type.ob_type = &PyType_Type;
1946 if (PyType_Ready(&swigpyobject_type) < 0)
1950 return &swigpyobject_type;
1953 SWIGRUNTIME PyObject *
1954 SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
1956 SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
1963 return (PyObject *)sobj;
1966 /* -----------------------------------------------------------------------------
1967 * Implements a simple Swig Packed type, and use it instead of string
1968 * ----------------------------------------------------------------------------- */
1978 SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
1980 char result[SWIG_BUFFER_SIZE];
1981 fputs("<Swig Packed ", fp);
1982 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1986 fputs(v->ty->name,fp);
1991 SWIGRUNTIME PyObject *
1992 SwigPyPacked_repr(SwigPyPacked *v)
1994 char result[SWIG_BUFFER_SIZE];
1995 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
1996 return SWIG_Python_str_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
1998 return SWIG_Python_str_FromFormat("<Swig Packed %s>", v->ty->name);
2002 SWIGRUNTIME PyObject *
2003 SwigPyPacked_str(SwigPyPacked *v)
2005 char result[SWIG_BUFFER_SIZE];
2006 if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
2007 return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
2009 return SWIG_Python_str_FromChar(v->ty->name);
2014 SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
2018 int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
2019 return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
2022 SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
2024 SWIGRUNTIME PyTypeObject*
2025 SwigPyPacked_type(void) {
2026 static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
2030 SWIGRUNTIMEINLINE int
2031 SwigPyPacked_Check(PyObject *op) {
2032 return ((op)->ob_type == SwigPyPacked_TypeOnce())
2033 || (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
2037 SwigPyPacked_dealloc(PyObject *v)
2039 if (SwigPyPacked_Check(v)) {
2040 SwigPyPacked *sobj = (SwigPyPacked *) v;
2046 SWIGRUNTIME PyTypeObject*
2047 SwigPyPacked_TypeOnce(void) {
2048 static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
2049 static PyTypeObject swigpypacked_type;
2050 static int type_init = 0;
2052 const PyTypeObject tmp = {
2053 /* PyObject header changed in Python 3 */
2054 #if PY_VERSION_HEX>=0x03000000
2055 PyVarObject_HEAD_INIT(NULL, 0)
2057 PyObject_HEAD_INIT(NULL)
2060 (char *)"SwigPyPacked", /* tp_name */
2061 sizeof(SwigPyPacked), /* tp_basicsize */
2062 0, /* tp_itemsize */
2063 (destructor)SwigPyPacked_dealloc, /* tp_dealloc */
2064 (printfunc)SwigPyPacked_print, /* tp_print */
2065 (getattrfunc)0, /* tp_getattr */
2066 (setattrfunc)0, /* tp_setattr */
2067 #if PY_VERSION_HEX>=0x03000000
2068 0, /* tp_reserved in 3.0.1 */
2070 (cmpfunc)SwigPyPacked_compare, /* tp_compare */
2072 (reprfunc)SwigPyPacked_repr, /* tp_repr */
2073 0, /* tp_as_number */
2074 0, /* tp_as_sequence */
2075 0, /* tp_as_mapping */
2076 (hashfunc)0, /* tp_hash */
2077 (ternaryfunc)0, /* tp_call */
2078 (reprfunc)SwigPyPacked_str, /* tp_str */
2079 PyObject_GenericGetAttr, /* tp_getattro */
2080 0, /* tp_setattro */
2081 0, /* tp_as_buffer */
2082 Py_TPFLAGS_DEFAULT, /* tp_flags */
2083 swigpacked_doc, /* tp_doc */
2084 0, /* tp_traverse */
2086 0, /* tp_richcompare */
2087 0, /* tp_weaklistoffset */
2088 #if PY_VERSION_HEX >= 0x02020000
2090 0, /* tp_iternext */
2096 0, /* tp_descr_get */
2097 0, /* tp_descr_set */
2098 0, /* tp_dictoffset */
2107 0, /* tp_subclasses */
2108 0, /* tp_weaklist */
2110 #if PY_VERSION_HEX >= 0x02030000
2113 #if PY_VERSION_HEX >= 0x02060000
2117 0,0,0,0 /* tp_alloc -> tp_next */
2120 swigpypacked_type = tmp;
2122 #if PY_VERSION_HEX < 0x02020000
2123 swigpypacked_type.ob_type = &PyType_Type;
2125 if (PyType_Ready(&swigpypacked_type) < 0)
2129 return &swigpypacked_type;
2132 SWIGRUNTIME PyObject *
2133 SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
2135 SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
2137 void *pack = malloc(size);
2139 memcpy(pack, ptr, size);
2144 PyObject_DEL((PyObject *) sobj);
2148 return (PyObject *) sobj;
2151 SWIGRUNTIME swig_type_info *
2152 SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
2154 if (SwigPyPacked_Check(obj)) {
2155 SwigPyPacked *sobj = (SwigPyPacked *)obj;
2156 if (sobj->size != size) return 0;
2157 memcpy(ptr, sobj->pack, size);
2164 /* -----------------------------------------------------------------------------
2165 * pointers/data manipulation
2166 * ----------------------------------------------------------------------------- */
2168 SWIGRUNTIMEINLINE PyObject *
2171 return SWIG_Python_str_FromChar("this");
2174 static PyObject *swig_this = NULL;
2176 SWIGRUNTIME PyObject *
2179 if (swig_this == NULL)
2180 swig_this = _SWIG_This();
2184 /* #define SWIG_PYTHON_SLOW_GETSET_THIS */
2186 /* TODO: I don't know how to implement the fast getset in Python 3 right now */
2187 #if PY_VERSION_HEX>=0x03000000
2188 #define SWIG_PYTHON_SLOW_GETSET_THIS
2191 SWIGRUNTIME SwigPyObject *
2192 SWIG_Python_GetSwigThis(PyObject *pyobj)
2196 if (SwigPyObject_Check(pyobj))
2197 return (SwigPyObject *) pyobj;
2199 #ifdef SWIGPYTHON_BUILTIN
2201 # ifdef PyWeakref_CheckProxy
2202 if (PyWeakref_CheckProxy(pyobj)) {
2203 pyobj = PyWeakref_GET_OBJECT(pyobj);
2204 if (pyobj && SwigPyObject_Check(pyobj))
2205 return (SwigPyObject*) pyobj;
2213 #if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
2214 if (PyInstance_Check(pyobj)) {
2215 obj = _PyInstance_Lookup(pyobj, SWIG_This());
2217 PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
2218 if (dictptr != NULL) {
2219 PyObject *dict = *dictptr;
2220 obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
2222 #ifdef PyWeakref_CheckProxy
2223 if (PyWeakref_CheckProxy(pyobj)) {
2224 PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
2225 return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
2228 obj = PyObject_GetAttr(pyobj,SWIG_This());
2232 if (PyErr_Occurred()) PyErr_Clear();
2238 obj = PyObject_GetAttr(pyobj,SWIG_This());
2242 if (PyErr_Occurred()) PyErr_Clear();
2246 if (obj && !SwigPyObject_Check(obj)) {
2247 /* a PyObject is called 'this', try to get the 'real this'
2248 SwigPyObject from it */
2249 return SWIG_Python_GetSwigThis(obj);
2251 return (SwigPyObject *)obj;
2255 /* Acquire a pointer value */
2258 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
2259 if (own == SWIG_POINTER_OWN) {
2260 SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
2262 int oldown = sobj->own;
2270 /* Convert a pointer value */
2273 SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
2279 if (obj == Py_None) {
2287 sobj = SWIG_Python_GetSwigThis(obj);
2291 void *vptr = sobj->ptr;
2293 swig_type_info *to = sobj->ty;
2295 /* no type cast needed */
2296 if (ptr) *ptr = vptr;
2299 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2301 sobj = (SwigPyObject *)sobj->next;
2305 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2306 if (newmemory == SWIG_CAST_NEW_MEMORY) {
2307 assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
2309 *own = *own | SWIG_CAST_NEW_MEMORY;
2316 if (ptr) *ptr = vptr;
2322 *own = *own | sobj->own;
2323 if (flags & SWIG_POINTER_DISOWN) {
2328 if (flags & SWIG_POINTER_IMPLICIT_CONV) {
2329 SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
2330 if (data && !data->implicitconv) {
2331 PyObject *klass = data->klass;
2334 data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
2335 impconv = SWIG_Python_CallFunctor(klass, obj);
2336 data->implicitconv = 0;
2337 if (PyErr_Occurred()) {
2342 SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
2345 res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
2346 if (SWIG_IsOK(res)) {
2349 /* transfer the ownership to 'ptr' */
2351 res = SWIG_AddCast(res);
2352 res = SWIG_AddNewMask(res);
2354 res = SWIG_AddCast(res);
2367 /* Convert a function ptr value */
2370 SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
2371 if (!PyCFunction_Check(obj)) {
2372 return SWIG_ConvertPtr(obj, ptr, ty, 0);
2376 /* here we get the method pointer for callbacks */
2377 const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
2378 const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
2380 desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
2384 swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
2387 *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
2388 assert(!newmemory); /* newmemory handling not yet implemented */
2399 /* Convert a packed value value */
2402 SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
2403 swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
2404 if (!to) return SWIG_ERROR;
2407 /* check type cast? */
2408 swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
2409 if (!tc) return SWIG_ERROR;
2415 /* -----------------------------------------------------------------------------
2416 * Create a new pointer object
2417 * ----------------------------------------------------------------------------- */
2420 Create a new instance object, without calling __init__, and set the
2424 SWIGRUNTIME PyObject*
2425 SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
2427 #if (PY_VERSION_HEX >= 0x02020000)
2429 PyObject *newraw = data->newraw;
2431 inst = PyObject_Call(newraw, data->newargs, NULL);
2433 #if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2434 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2435 if (dictptr != NULL) {
2436 PyObject *dict = *dictptr;
2438 dict = PyDict_New();
2440 PyDict_SetItem(dict, SWIG_This(), swig_this);
2444 PyObject *key = SWIG_This();
2445 PyObject_SetAttr(inst, key, swig_this);
2449 #if PY_VERSION_HEX >= 0x03000000
2450 inst = PyBaseObject_Type.tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
2451 PyObject_SetAttr(inst, SWIG_This(), swig_this);
2452 Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
2454 PyObject *dict = PyDict_New();
2455 PyDict_SetItem(dict, SWIG_This(), swig_this);
2456 inst = PyInstance_NewRaw(data->newargs, dict);
2462 #if (PY_VERSION_HEX >= 0x02010000)
2464 PyObject *dict = PyDict_New();
2465 PyDict_SetItem(dict, SWIG_This(), swig_this);
2466 inst = PyInstance_NewRaw(data->newargs, dict);
2468 return (PyObject *) inst;
2470 PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
2474 inst->in_class = (PyClassObject *)data->newargs;
2475 Py_INCREF(inst->in_class);
2476 inst->in_dict = PyDict_New();
2477 if (inst->in_dict == NULL) {
2481 #ifdef Py_TPFLAGS_HAVE_WEAKREFS
2482 inst->in_weakreflist = NULL;
2484 #ifdef Py_TPFLAGS_GC
2485 PyObject_GC_Init(inst);
2487 PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
2488 return (PyObject *) inst;
2494 SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
2497 #if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
2498 PyObject **dictptr = _PyObject_GetDictPtr(inst);
2499 if (dictptr != NULL) {
2502 dict = PyDict_New();
2505 PyDict_SetItem(dict, SWIG_This(), swig_this);
2509 dict = PyObject_GetAttrString(inst, (char*)"__dict__");
2510 PyDict_SetItem(dict, SWIG_This(), swig_this);
2515 SWIGINTERN PyObject *
2516 SWIG_Python_InitShadowInstance(PyObject *args) {
2518 if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
2521 SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
2523 SwigPyObject_append((PyObject*) sthis, obj[1]);
2525 SWIG_Python_SetSwigThis(obj[0], obj[1]);
2527 return SWIG_Py_Void();
2531 /* Create a new pointer object */
2533 SWIGRUNTIME PyObject *
2534 SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
2535 SwigPyClientData *clientdata;
2540 return SWIG_Py_Void();
2542 clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
2543 own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
2544 if (clientdata && clientdata->pytype) {
2545 SwigPyObject *newobj;
2546 if (flags & SWIG_BUILTIN_TP_INIT) {
2547 newobj = (SwigPyObject*) self;
2549 PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
2550 while (newobj->next)
2551 newobj = (SwigPyObject *) newobj->next;
2552 newobj->next = next_self;
2553 newobj = (SwigPyObject *)next_self;
2556 newobj = PyObject_New(SwigPyObject, clientdata->pytype);
2563 #ifdef SWIGPYTHON_BUILTIN
2566 return (PyObject*) newobj;
2568 return SWIG_Py_Void();
2571 assert(!(flags & SWIG_BUILTIN_TP_INIT));
2573 robj = SwigPyObject_New(ptr, type, own);
2574 if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
2575 PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
2584 /* Create a new packed object */
2586 SWIGRUNTIMEINLINE PyObject *
2587 SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
2588 return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
2591 /* -----------------------------------------------------------------------------*
2593 * -----------------------------------------------------------------------------*/
2595 #ifdef SWIG_LINK_RUNTIME
2596 void *SWIG_ReturnGlobalTypeList(void *);
2599 SWIGRUNTIME swig_module_info *
2600 SWIG_Python_GetModule(void) {
2601 static void *type_pointer = (void *)0;
2602 /* first check if module already created */
2603 if (!type_pointer) {
2604 #ifdef SWIG_LINK_RUNTIME
2605 type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
2607 # ifdef SWIGPY_USE_CAPSULE
2608 type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
2610 type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
2611 (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
2613 if (PyErr_Occurred()) {
2615 type_pointer = (void *)0;
2619 return (swig_module_info *) type_pointer;
2622 #if PY_MAJOR_VERSION < 2
2623 /* PyModule_AddObject function was introduced in Python 2.0. The following function
2624 is copied out of Python/modsupport.c in python version 2.3.4 */
2626 PyModule_AddObject(PyObject *m, char *name, PyObject *o)
2629 if (!PyModule_Check(m)) {
2630 PyErr_SetString(PyExc_TypeError,
2631 "PyModule_AddObject() needs module as first arg");
2635 PyErr_SetString(PyExc_TypeError,
2636 "PyModule_AddObject() needs non-NULL value");
2640 dict = PyModule_GetDict(m);
2642 /* Internal error -- modules must have a dict! */
2643 PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
2644 PyModule_GetName(m));
2647 if (PyDict_SetItemString(dict, name, o))
2655 #ifdef SWIGPY_USE_CAPSULE
2656 SWIG_Python_DestroyModule(PyObject *obj)
2658 SWIG_Python_DestroyModule(void *vptr)
2661 #ifdef SWIGPY_USE_CAPSULE
2662 swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
2664 swig_module_info *swig_module = (swig_module_info *) vptr;
2666 swig_type_info **types = swig_module->types;
2668 for (i =0; i < swig_module->size; ++i) {
2669 swig_type_info *ty = types[i];
2671 SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
2672 if (data) SwigPyClientData_Del(data);
2675 Py_DECREF(SWIG_This());
2680 SWIG_Python_SetModule(swig_module_info *swig_module) {
2681 #if PY_VERSION_HEX >= 0x03000000
2682 /* Add a dummy module object into sys.modules */
2683 PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
2685 static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
2686 PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
2688 #ifdef SWIGPY_USE_CAPSULE
2689 PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
2690 if (pointer && module) {
2691 PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
2693 Py_XDECREF(pointer);
2696 PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
2697 if (pointer && module) {
2698 PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
2700 Py_XDECREF(pointer);
2705 /* The python cached type query */
2706 SWIGRUNTIME PyObject *
2707 SWIG_Python_TypeCache(void) {
2708 static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
2712 SWIGRUNTIME swig_type_info *
2713 SWIG_Python_TypeQuery(const char *type)
2715 PyObject *cache = SWIG_Python_TypeCache();
2716 PyObject *key = SWIG_Python_str_FromChar(type);
2717 PyObject *obj = PyDict_GetItem(cache, key);
2718 swig_type_info *descriptor;
2720 #ifdef SWIGPY_USE_CAPSULE
2721 descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
2723 descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
2726 swig_module_info *swig_module = SWIG_Python_GetModule();
2727 descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
2729 #ifdef SWIGPY_USE_CAPSULE
2730 obj = PyCapsule_New((void*) descriptor, NULL, NULL);
2732 obj = PyCObject_FromVoidPtr(descriptor, NULL);
2734 PyDict_SetItem(cache, key, obj);
2743 For backward compatibility only
2745 #define SWIG_POINTER_EXCEPTION 0
2746 #define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
2747 #define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
2750 SWIG_Python_AddErrMesg(const char* mesg, int infront)
2752 if (PyErr_Occurred()) {
2754 PyObject *value = 0;
2755 PyObject *traceback = 0;
2756 PyErr_Fetch(&type, &value, &traceback);
2759 PyObject *old_str = PyObject_Str(value);
2763 PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
2765 PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
2767 SWIG_Python_str_DelForPy3(tmp);
2777 SWIG_Python_ArgFail(int argnum)
2779 if (PyErr_Occurred()) {
2780 /* add information about failing argument */
2782 PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
2783 return SWIG_Python_AddErrMesg(mesg, 1);
2789 SWIGRUNTIMEINLINE const char *
2790 SwigPyObject_GetDesc(PyObject *self)
2792 SwigPyObject *v = (SwigPyObject *)self;
2793 swig_type_info *ty = v ? v->ty : 0;
2794 return ty ? ty->str : (char*)"";
2798 SWIG_Python_TypeError(const char *type, PyObject *obj)
2801 #if defined(SWIG_COBJECT_TYPES)
2802 if (obj && SwigPyObject_Check(obj)) {
2803 const char *otype = (const char *) SwigPyObject_GetDesc(obj);
2805 PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
2812 const char *otype = (obj ? obj->ob_type->tp_name : 0);
2814 PyObject *str = PyObject_Str(obj);
2815 const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
2817 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
2819 SWIG_Python_str_DelForPy3(cstr);
2821 PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
2828 PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
2830 PyErr_Format(PyExc_TypeError, "unexpected type is received");
2835 /* Convert a pointer value, signal an exception on a type mismatch */
2837 SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
2839 if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
2841 #if SWIG_POINTER_EXCEPTION
2843 SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
2844 SWIG_Python_ArgFail(argnum);
2852 SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
2853 PyTypeObject *tp = obj->ob_type;
2855 PyObject *encoded_name;
2859 #ifdef Py_USING_UNICODE
2860 if (PyString_Check(name)) {
2861 name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
2864 } else if (!PyUnicode_Check(name))
2866 if (!PyString_Check(name))
2869 PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
2876 if (PyType_Ready(tp) < 0)
2881 descr = _PyType_Lookup(tp, name);
2884 f = descr->ob_type->tp_descr_set;
2886 if (PyString_Check(name)) {
2887 encoded_name = name;
2890 encoded_name = PyUnicode_AsUTF8String(name);
2892 PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
2893 Py_DECREF(encoded_name);
2895 res = f(descr, obj, value);
2910 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
2912 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
2916 #define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0)
2919 /* -------- TYPES TABLE (BEGIN) -------- */
2921 #define SWIGTYPE_p_char swig_types[0]
2922 #define SWIGTYPE_p_int swig_types[1]
2923 #define SWIGTYPE_p_uint8_t swig_types[2]
2924 static swig_type_info *swig_types[4];
2925 static swig_module_info swig_module = {swig_types, 3, 0, 0, 0, 0};
2926 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
2927 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
2929 /* -------- TYPES TABLE (END) -------- */
2931 #if (PY_VERSION_HEX <= 0x02000000)
2932 # if !defined(SWIG_PYTHON_CLASSIC)
2933 # error "This python version requires swig to be run with the '-classic' option"
2937 /*-----------------------------------------------
2938 @(target):= _libwebp.so
2939 ------------------------------------------------*/
2940 #if PY_VERSION_HEX >= 0x03000000
2941 # define SWIG_init PyInit__libwebp
2944 # define SWIG_init init_libwebp
2947 #define SWIG_name "_libwebp"
2949 #define SWIGVERSION 0x020004
2950 #define SWIG_VERSION SWIGVERSION
2953 #define SWIG_as_voidptr(a) (void *)((const void *)(a))
2954 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
2957 #define SWIG_From_long PyInt_FromLong
2960 SWIGINTERNINLINE PyObject *
2961 SWIG_From_int (int value)
2963 return SWIG_From_long (value);
2967 SWIGINTERN swig_type_info*
2968 SWIG_pchar_descriptor(void)
2970 static int init = 0;
2971 static swig_type_info* info = 0;
2973 info = SWIG_TypeQuery("_p_char");
2981 SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc)
2983 #if PY_VERSION_HEX>=0x03000000
2984 if (PyUnicode_Check(obj))
2986 if (PyString_Check(obj))
2989 char *cstr; Py_ssize_t len;
2990 #if PY_VERSION_HEX>=0x03000000
2991 if (!alloc && cptr) {
2992 /* We can't allow converting without allocation, since the internal
2993 representation of string in Python 3 is UCS-2/UCS-4 but we require
2994 a UTF-8 representation.
2995 TODO(bhy) More detailed explanation */
2996 return SWIG_RuntimeError;
2998 obj = PyUnicode_AsUTF8String(obj);
2999 PyBytes_AsStringAndSize(obj, &cstr, &len);
3000 if(alloc) *alloc = SWIG_NEWOBJ;
3002 PyString_AsStringAndSize(obj, &cstr, &len);
3007 In python the user should not be able to modify the inner
3008 string representation. To warranty that, if you define
3009 SWIG_PYTHON_SAFE_CSTRINGS, a new/copy of the python string
3010 buffer is always returned.
3012 The default behavior is just to return the pointer value,
3015 #if defined(SWIG_PYTHON_SAFE_CSTRINGS)
3016 if (*alloc != SWIG_OLDOBJ)
3018 if (*alloc == SWIG_NEWOBJ)
3021 *cptr = (char *)memcpy((char *)malloc((len + 1)*sizeof(char)), cstr, sizeof(char)*(len + 1));
3022 *alloc = SWIG_NEWOBJ;
3026 *alloc = SWIG_OLDOBJ;
3029 #if PY_VERSION_HEX>=0x03000000
3030 assert(0); /* Should never reach here in Python 3 */
3032 *cptr = SWIG_Python_str_AsChar(obj);
3035 if (psize) *psize = len + 1;
3036 #if PY_VERSION_HEX>=0x03000000
3041 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
3042 if (pchar_descriptor) {
3044 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
3045 if (cptr) *cptr = (char *) vptr;
3046 if (psize) *psize = vptr ? (strlen((char *)vptr) + 1) : 0;
3047 if (alloc) *alloc = SWIG_OLDOBJ;
3052 return SWIG_TypeError;
3057 SWIG_AsVal_double (PyObject *obj, double *val)
3059 int res = SWIG_TypeError;
3060 if (PyFloat_Check(obj)) {
3061 if (val) *val = PyFloat_AsDouble(obj);
3063 } else if (PyInt_Check(obj)) {
3064 if (val) *val = PyInt_AsLong(obj);
3066 } else if (PyLong_Check(obj)) {
3067 double v = PyLong_AsDouble(obj);
3068 if (!PyErr_Occurred()) {
3075 #ifdef SWIG_PYTHON_CAST_MODE
3078 double d = PyFloat_AsDouble(obj);
3079 if (!PyErr_Occurred()) {
3081 return SWIG_AddCast(SWIG_OK);
3086 long v = PyLong_AsLong(obj);
3087 if (!PyErr_Occurred()) {
3089 return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
3106 SWIGINTERNINLINE int
3107 SWIG_CanCastAsInteger(double *d, double min, double max) {
3109 if ((min <= x && x <= max)) {
3110 double fx = floor(x);
3111 double cx = ceil(x);
3112 double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
3113 if ((errno == EDOM) || (errno == ERANGE)) {
3116 double summ, reps, diff;
3119 } else if (rd > x) {
3126 if (reps < 8*DBL_EPSILON) {
3137 SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
3139 if (PyInt_Check(obj)) {
3140 long v = PyInt_AsLong(obj);
3145 return SWIG_OverflowError;
3147 } else if (PyLong_Check(obj)) {
3148 unsigned long v = PyLong_AsUnsignedLong(obj);
3149 if (!PyErr_Occurred()) {
3156 #ifdef SWIG_PYTHON_CAST_MODE
3159 unsigned long v = PyLong_AsUnsignedLong(obj);
3160 if (!PyErr_Occurred()) {
3162 return SWIG_AddCast(SWIG_OK);
3168 int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
3169 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
3170 if (val) *val = (unsigned long)(d);
3176 return SWIG_TypeError;
3180 SWIGINTERNINLINE int
3181 SWIG_AsVal_size_t (PyObject * obj, size_t *val)
3184 int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
3185 if (SWIG_IsOK(res) && val) *val = (size_t)(v);
3190 #include "webp/decode.h"
3191 #include "webp/encode.h"
3194 static size_t ReturnedBufferSize(
3195 const char* function, int* width, int* height) {
3196 static const struct sizemap {
3197 const char* function;
3198 int size_multiplier;
3201 { "Java_com_google_webp_libwebpJNI_WebPDecodeRGB", 3 },
3202 { "Java_com_google_webp_libwebpJNI_WebPDecodeRGBA", 4 },
3203 { "Java_com_google_webp_libwebpJNI_WebPDecodeARGB", 4 },
3204 { "Java_com_google_webp_libwebpJNI_WebPDecodeBGR", 3 },
3205 { "Java_com_google_webp_libwebpJNI_WebPDecodeBGRA", 4 },
3206 { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGB", 1 },
3207 { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGR", 1 },
3208 { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeRGBA", 1 },
3209 { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeBGRA", 1 },
3210 { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessRGB", 1 },
3211 { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessBGR", 1 },
3212 { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessRGBA", 1 },
3213 { "Java_com_google_webp_libwebpJNI_wrap_1WebPEncodeLosslessBGRA", 1 },
3216 { "WebPDecodeRGB", 3 },
3217 { "WebPDecodeRGBA", 4 },
3218 { "WebPDecodeARGB", 4 },
3219 { "WebPDecodeBGR", 3 },
3220 { "WebPDecodeBGRA", 4 },
3221 { "wrap_WebPEncodeRGB", 1 },
3222 { "wrap_WebPEncodeBGR", 1 },
3223 { "wrap_WebPEncodeRGBA", 1 },
3224 { "wrap_WebPEncodeBGRA", 1 },
3225 { "wrap_WebPEncodeLosslessRGB", 1 },
3226 { "wrap_WebPEncodeLosslessBGR", 1 },
3227 { "wrap_WebPEncodeLosslessRGBA", 1 },
3228 { "wrap_WebPEncodeLosslessBGRA", 1 },
3232 const struct sizemap* p;
3235 for (p = size_map; p->function; ++p) {
3236 if (!strcmp(function, p->function)) {
3237 size = *width * *height * p->size_multiplier;
3246 typedef size_t (*WebPEncodeFunction)(const uint8_t* rgb,
3247 int width, int height, int stride,
3248 float quality_factor, uint8_t** output);
3249 typedef size_t (*WebPEncodeLosslessFunction)(const uint8_t* rgb,
3250 int width, int height, int stride,
3253 static uint8_t* EncodeLossy(const uint8_t* rgb,
3254 int width, int height, int stride,
3255 float quality_factor,
3256 WebPEncodeFunction encfn,
3257 int* output_size, int* unused) {
3258 uint8_t* output = NULL;
3259 const size_t image_size =
3260 encfn(rgb, width, height, stride, quality_factor, &output);
3261 // the values of following two will be interpreted by ReturnedBufferSize()
3262 // as 'width' and 'height' in the size calculation.
3263 *output_size = image_size;
3265 return image_size ? output : NULL;
3268 static uint8_t* EncodeLossless(const uint8_t* rgb,
3269 int width, int height, int stride,
3270 WebPEncodeLosslessFunction encfn,
3271 int* output_size, int* unused) {
3272 uint8_t* output = NULL;
3273 const size_t image_size = encfn(rgb, width, height, stride, &output);
3274 // the values of the following two will be interpreted by
3275 // ReturnedBufferSize() as 'width' and 'height' in the size calculation.
3276 *output_size = image_size;
3278 return image_size ? output : NULL;
3282 // Changes the return type of WebPEncode* to more closely match Decode*.
3283 // This also makes it easier to wrap the output buffer in a native type rather
3284 // than dealing with the return pointer.
3285 // The additional parameters are to allow reuse of ReturnedBufferSize(),
3286 // unused2 and output_size will be used in this case.
3287 #define LOSSY_WRAPPER(FUNC) \
3288 static uint8_t* wrap_##FUNC( \
3289 const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
3290 int width, int height, int stride, float quality_factor) { \
3291 return EncodeLossy(rgb, width, height, stride, quality_factor, \
3292 FUNC, output_size, unused2); \
3295 LOSSY_WRAPPER(WebPEncodeRGB)
3296 LOSSY_WRAPPER(WebPEncodeBGR)
3297 LOSSY_WRAPPER(WebPEncodeRGBA)
3298 LOSSY_WRAPPER(WebPEncodeBGRA)
3300 #undef LOSSY_WRAPPER
3302 #define LOSSLESS_WRAPPER(FUNC) \
3303 static uint8_t* wrap_##FUNC( \
3304 const uint8_t* rgb, int* unused1, int* unused2, int* output_size, \
3305 int width, int height, int stride) { \
3306 return EncodeLossless(rgb, width, height, stride, \
3307 FUNC, output_size, unused2); \
3310 LOSSLESS_WRAPPER(WebPEncodeLosslessRGB)
3311 LOSSLESS_WRAPPER(WebPEncodeLosslessBGR)
3312 LOSSLESS_WRAPPER(WebPEncodeLosslessRGBA)
3313 LOSSLESS_WRAPPER(WebPEncodeLosslessBGRA)
3315 #undef LOSSLESS_WRAPPER
3320 #if !defined(SWIG_NO_LLONG_MAX)
3321 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
3322 # define LLONG_MAX __LONG_LONG_MAX__
3323 # define LLONG_MIN (-LLONG_MAX - 1LL)
3324 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
3330 SWIG_AsVal_long (PyObject *obj, long* val)
3332 if (PyInt_Check(obj)) {
3333 if (val) *val = PyInt_AsLong(obj);
3335 } else if (PyLong_Check(obj)) {
3336 long v = PyLong_AsLong(obj);
3337 if (!PyErr_Occurred()) {
3344 #ifdef SWIG_PYTHON_CAST_MODE
3347 long v = PyInt_AsLong(obj);
3348 if (!PyErr_Occurred()) {
3350 return SWIG_AddCast(SWIG_OK);
3356 int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
3357 if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
3358 if (val) *val = (long)(d);
3364 return SWIG_TypeError;
3369 SWIG_AsVal_int (PyObject * obj, int *val)
3372 int res = SWIG_AsVal_long (obj, &v);
3373 if (SWIG_IsOK(res)) {
3374 if ((v < INT_MIN || v > INT_MAX)) {
3375 return SWIG_OverflowError;
3377 if (val) *val = (int)(v);
3385 SWIG_AsVal_float (PyObject * obj, float *val)
3388 int res = SWIG_AsVal_double (obj, &v);
3389 if (SWIG_IsOK(res)) {
3390 if ((v < -FLT_MAX || v > FLT_MAX)) {
3391 return SWIG_OverflowError;
3393 if (val) *val = (float)(v);
3402 SWIGINTERN PyObject *_wrap_WebPGetDecoderVersion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3403 PyObject *resultobj = 0;
3406 if (!PyArg_ParseTuple(args,(char *)":WebPGetDecoderVersion")) SWIG_fail;
3407 result = (int)WebPGetDecoderVersion();
3408 resultobj = SWIG_From_int((int)(result));
3415 SWIGINTERN PyObject *_wrap_WebPGetInfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3416 PyObject *resultobj = 0;
3417 uint8_t *arg1 = (uint8_t *) 0 ;
3419 int *arg3 = (int *) 0 ;
3420 int *arg4 = (int *) 0 ;
3426 int res3 = SWIG_TMPOBJ ;
3428 int res4 = SWIG_TMPOBJ ;
3429 PyObject * obj0 = 0 ;
3434 if (!PyArg_ParseTuple(args,(char *)"O:WebPGetInfo",&obj0)) SWIG_fail;
3435 res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3436 if (!SWIG_IsOK(res1)) {
3437 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPGetInfo" "', argument " "1"" of type '" "uint8_t const *""'");
3439 arg1 = (uint8_t *)(buf1);
3440 arg2 = (size_t)(size1 - 1);
3441 result = (int)WebPGetInfo((uint8_t const *)arg1,arg2,arg3,arg4);
3442 resultobj = SWIG_From_int((int)(result));
3443 if (SWIG_IsTmpObj(res3)) {
3444 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3446 int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3447 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3449 if (SWIG_IsTmpObj(res4)) {
3450 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3452 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3453 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3455 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3458 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3463 SWIGINTERN PyObject *_wrap_WebPDecodeRGB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3464 PyObject *resultobj = 0;
3465 uint8_t *arg1 = (uint8_t *) 0 ;
3467 int *arg3 = (int *) 0 ;
3468 int *arg4 = (int *) 0 ;
3474 int res3 = SWIG_TMPOBJ ;
3476 int res4 = SWIG_TMPOBJ ;
3477 PyObject * obj0 = 0 ;
3478 uint8_t *result = 0 ;
3482 if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeRGB",&obj0)) SWIG_fail;
3483 res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3484 if (!SWIG_IsOK(res1)) {
3485 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeRGB" "', argument " "1"" of type '" "uint8_t const *""'");
3487 arg1 = (uint8_t *)(buf1);
3488 arg2 = (size_t)(size1 - 1);
3489 result = (uint8_t *)WebPDecodeRGB((uint8_t const *)arg1,arg2,arg3,arg4);
3491 resultobj = PyString_FromStringAndSize(
3492 (const char*)result,
3493 (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeRGB", arg3, arg4));
3495 if (SWIG_IsTmpObj(res3)) {
3496 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3498 int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3499 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3501 if (SWIG_IsTmpObj(res4)) {
3502 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3504 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3505 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3507 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3511 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3516 SWIGINTERN PyObject *_wrap_WebPDecodeRGBA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3517 PyObject *resultobj = 0;
3518 uint8_t *arg1 = (uint8_t *) 0 ;
3520 int *arg3 = (int *) 0 ;
3521 int *arg4 = (int *) 0 ;
3527 int res3 = SWIG_TMPOBJ ;
3529 int res4 = SWIG_TMPOBJ ;
3530 PyObject * obj0 = 0 ;
3531 uint8_t *result = 0 ;
3535 if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeRGBA",&obj0)) SWIG_fail;
3536 res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3537 if (!SWIG_IsOK(res1)) {
3538 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeRGBA" "', argument " "1"" of type '" "uint8_t const *""'");
3540 arg1 = (uint8_t *)(buf1);
3541 arg2 = (size_t)(size1 - 1);
3542 result = (uint8_t *)WebPDecodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4);
3544 resultobj = PyString_FromStringAndSize(
3545 (const char*)result,
3546 (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeRGBA", arg3, arg4));
3548 if (SWIG_IsTmpObj(res3)) {
3549 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3551 int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3552 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3554 if (SWIG_IsTmpObj(res4)) {
3555 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3557 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3558 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3560 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3564 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3569 SWIGINTERN PyObject *_wrap_WebPDecodeARGB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3570 PyObject *resultobj = 0;
3571 uint8_t *arg1 = (uint8_t *) 0 ;
3573 int *arg3 = (int *) 0 ;
3574 int *arg4 = (int *) 0 ;
3580 int res3 = SWIG_TMPOBJ ;
3582 int res4 = SWIG_TMPOBJ ;
3583 PyObject * obj0 = 0 ;
3584 uint8_t *result = 0 ;
3588 if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeARGB",&obj0)) SWIG_fail;
3589 res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3590 if (!SWIG_IsOK(res1)) {
3591 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeARGB" "', argument " "1"" of type '" "uint8_t const *""'");
3593 arg1 = (uint8_t *)(buf1);
3594 arg2 = (size_t)(size1 - 1);
3595 result = (uint8_t *)WebPDecodeARGB((uint8_t const *)arg1,arg2,arg3,arg4);
3597 resultobj = PyString_FromStringAndSize(
3598 (const char*)result,
3599 (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeARGB", arg3, arg4));
3601 if (SWIG_IsTmpObj(res3)) {
3602 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3604 int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3605 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3607 if (SWIG_IsTmpObj(res4)) {
3608 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3610 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3611 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3613 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3617 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3622 SWIGINTERN PyObject *_wrap_WebPDecodeBGR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3623 PyObject *resultobj = 0;
3624 uint8_t *arg1 = (uint8_t *) 0 ;
3626 int *arg3 = (int *) 0 ;
3627 int *arg4 = (int *) 0 ;
3633 int res3 = SWIG_TMPOBJ ;
3635 int res4 = SWIG_TMPOBJ ;
3636 PyObject * obj0 = 0 ;
3637 uint8_t *result = 0 ;
3641 if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeBGR",&obj0)) SWIG_fail;
3642 res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3643 if (!SWIG_IsOK(res1)) {
3644 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeBGR" "', argument " "1"" of type '" "uint8_t const *""'");
3646 arg1 = (uint8_t *)(buf1);
3647 arg2 = (size_t)(size1 - 1);
3648 result = (uint8_t *)WebPDecodeBGR((uint8_t const *)arg1,arg2,arg3,arg4);
3650 resultobj = PyString_FromStringAndSize(
3651 (const char*)result,
3652 (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeBGR", arg3, arg4));
3654 if (SWIG_IsTmpObj(res3)) {
3655 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3657 int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3658 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3660 if (SWIG_IsTmpObj(res4)) {
3661 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3663 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3664 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3666 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3670 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3675 SWIGINTERN PyObject *_wrap_WebPDecodeBGRA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3676 PyObject *resultobj = 0;
3677 uint8_t *arg1 = (uint8_t *) 0 ;
3679 int *arg3 = (int *) 0 ;
3680 int *arg4 = (int *) 0 ;
3686 int res3 = SWIG_TMPOBJ ;
3688 int res4 = SWIG_TMPOBJ ;
3689 PyObject * obj0 = 0 ;
3690 uint8_t *result = 0 ;
3694 if (!PyArg_ParseTuple(args,(char *)"O:WebPDecodeBGRA",&obj0)) SWIG_fail;
3695 res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, &size1, &alloc1);
3696 if (!SWIG_IsOK(res1)) {
3697 SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "WebPDecodeBGRA" "', argument " "1"" of type '" "uint8_t const *""'");
3699 arg1 = (uint8_t *)(buf1);
3700 arg2 = (size_t)(size1 - 1);
3701 result = (uint8_t *)WebPDecodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4);
3703 resultobj = PyString_FromStringAndSize(
3704 (const char*)result,
3705 (result == NULL) ? 0 : ReturnedBufferSize("WebPDecodeBGRA", arg3, arg4));
3707 if (SWIG_IsTmpObj(res3)) {
3708 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg3)));
3710 int new_flags = SWIG_IsNewObj(res3) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3711 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg3), SWIGTYPE_p_int, new_flags));
3713 if (SWIG_IsTmpObj(res4)) {
3714 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3716 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3717 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3719 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3723 if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
3728 SWIGINTERN PyObject *_wrap_WebPGetEncoderVersion(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3729 PyObject *resultobj = 0;
3732 if (!PyArg_ParseTuple(args,(char *)":WebPGetEncoderVersion")) SWIG_fail;
3733 result = (int)WebPGetEncoderVersion();
3734 resultobj = SWIG_From_int((int)(result));
3741 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeRGB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3742 PyObject *resultobj = 0;
3743 uint8_t *arg1 = (uint8_t *) 0 ;
3744 int *arg2 = (int *) 0 ;
3745 int *arg3 = (int *) 0 ;
3746 int *arg4 = (int *) 0 ;
3751 Py_buffer rgb_buffer1 ;
3757 int res4 = SWIG_TMPOBJ ;
3766 PyObject * obj0 = 0 ;
3767 PyObject * obj1 = 0 ;
3768 PyObject * obj2 = 0 ;
3769 PyObject * obj3 = 0 ;
3770 PyObject * obj4 = 0 ;
3771 PyObject * obj5 = 0 ;
3772 PyObject * obj6 = 0 ;
3773 uint8_t *result = 0 ;
3776 if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:wrap_WebPEncodeRGB",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
3778 // NB: with Python < 2.6 the old style buffer protocol may be used:
3779 // Py_ssize_t unused;
3780 // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
3781 if (!PyObject_CheckBuffer(obj0)) {
3782 SWIG_exception_fail(SWIG_TypeError,
3783 "in method 'wrap_WebPEncodeRGB', argument 1"
3784 " does not support the buffer interface");
3786 if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
3787 SWIG_exception_fail(SWIG_RuntimeError,
3788 "in method 'wrap_WebPEncodeRGB', unable to get buffer view");
3790 arg1 = (uint8_t *)rgb_buffer1.buf;
3792 if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
3794 int ecode = SWIG_AsVal_int(obj1, &val);
3795 if (!SWIG_IsOK(ecode)) {
3796 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeRGB" "', argument " "2"" of type '" "int""'");
3800 res2 = SWIG_AddTmpMask(ecode);
3802 if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
3804 int ecode = SWIG_AsVal_int(obj2, &val);
3805 if (!SWIG_IsOK(ecode)) {
3806 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeRGB" "', argument " "3"" of type '" "int""'");
3810 res3 = SWIG_AddTmpMask(ecode);
3812 ecode5 = SWIG_AsVal_int(obj3, &val5);
3813 if (!SWIG_IsOK(ecode5)) {
3814 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeRGB" "', argument " "5"" of type '" "int""'");
3817 ecode6 = SWIG_AsVal_int(obj4, &val6);
3818 if (!SWIG_IsOK(ecode6)) {
3819 SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeRGB" "', argument " "6"" of type '" "int""'");
3822 ecode7 = SWIG_AsVal_int(obj5, &val7);
3823 if (!SWIG_IsOK(ecode7)) {
3824 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeRGB" "', argument " "7"" of type '" "int""'");
3827 ecode8 = SWIG_AsVal_float(obj6, &val8);
3828 if (!SWIG_IsOK(ecode8)) {
3829 SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "wrap_WebPEncodeRGB" "', argument " "8"" of type '" "float""'");
3831 arg8 = (float)(val8);
3832 result = (uint8_t *)wrap_WebPEncodeRGB((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
3834 resultobj = PyString_FromStringAndSize(
3835 (const char*)result,
3836 (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeRGB", arg3, arg4));
3838 if (SWIG_IsTmpObj(res4)) {
3839 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3841 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3842 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3845 PyBuffer_Release(&rgb_buffer1);
3847 if (SWIG_IsNewObj(res2)) free((char*)arg2);
3848 if (SWIG_IsNewObj(res3)) free((char*)arg3);
3853 PyBuffer_Release(&rgb_buffer1);
3855 if (SWIG_IsNewObj(res2)) free((char*)arg2);
3856 if (SWIG_IsNewObj(res3)) free((char*)arg3);
3861 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeBGR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3862 PyObject *resultobj = 0;
3863 uint8_t *arg1 = (uint8_t *) 0 ;
3864 int *arg2 = (int *) 0 ;
3865 int *arg3 = (int *) 0 ;
3866 int *arg4 = (int *) 0 ;
3871 Py_buffer rgb_buffer1 ;
3877 int res4 = SWIG_TMPOBJ ;
3886 PyObject * obj0 = 0 ;
3887 PyObject * obj1 = 0 ;
3888 PyObject * obj2 = 0 ;
3889 PyObject * obj3 = 0 ;
3890 PyObject * obj4 = 0 ;
3891 PyObject * obj5 = 0 ;
3892 PyObject * obj6 = 0 ;
3893 uint8_t *result = 0 ;
3896 if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:wrap_WebPEncodeBGR",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
3898 // NB: with Python < 2.6 the old style buffer protocol may be used:
3899 // Py_ssize_t unused;
3900 // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
3901 if (!PyObject_CheckBuffer(obj0)) {
3902 SWIG_exception_fail(SWIG_TypeError,
3903 "in method 'wrap_WebPEncodeBGR', argument 1"
3904 " does not support the buffer interface");
3906 if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
3907 SWIG_exception_fail(SWIG_RuntimeError,
3908 "in method 'wrap_WebPEncodeBGR', unable to get buffer view");
3910 arg1 = (uint8_t *)rgb_buffer1.buf;
3912 if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
3914 int ecode = SWIG_AsVal_int(obj1, &val);
3915 if (!SWIG_IsOK(ecode)) {
3916 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeBGR" "', argument " "2"" of type '" "int""'");
3920 res2 = SWIG_AddTmpMask(ecode);
3922 if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
3924 int ecode = SWIG_AsVal_int(obj2, &val);
3925 if (!SWIG_IsOK(ecode)) {
3926 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeBGR" "', argument " "3"" of type '" "int""'");
3930 res3 = SWIG_AddTmpMask(ecode);
3932 ecode5 = SWIG_AsVal_int(obj3, &val5);
3933 if (!SWIG_IsOK(ecode5)) {
3934 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeBGR" "', argument " "5"" of type '" "int""'");
3937 ecode6 = SWIG_AsVal_int(obj4, &val6);
3938 if (!SWIG_IsOK(ecode6)) {
3939 SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeBGR" "', argument " "6"" of type '" "int""'");
3942 ecode7 = SWIG_AsVal_int(obj5, &val7);
3943 if (!SWIG_IsOK(ecode7)) {
3944 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeBGR" "', argument " "7"" of type '" "int""'");
3947 ecode8 = SWIG_AsVal_float(obj6, &val8);
3948 if (!SWIG_IsOK(ecode8)) {
3949 SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "wrap_WebPEncodeBGR" "', argument " "8"" of type '" "float""'");
3951 arg8 = (float)(val8);
3952 result = (uint8_t *)wrap_WebPEncodeBGR((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
3954 resultobj = PyString_FromStringAndSize(
3955 (const char*)result,
3956 (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeBGR", arg3, arg4));
3958 if (SWIG_IsTmpObj(res4)) {
3959 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
3961 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
3962 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
3965 PyBuffer_Release(&rgb_buffer1);
3967 if (SWIG_IsNewObj(res2)) free((char*)arg2);
3968 if (SWIG_IsNewObj(res3)) free((char*)arg3);
3973 PyBuffer_Release(&rgb_buffer1);
3975 if (SWIG_IsNewObj(res2)) free((char*)arg2);
3976 if (SWIG_IsNewObj(res3)) free((char*)arg3);
3981 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeRGBA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
3982 PyObject *resultobj = 0;
3983 uint8_t *arg1 = (uint8_t *) 0 ;
3984 int *arg2 = (int *) 0 ;
3985 int *arg3 = (int *) 0 ;
3986 int *arg4 = (int *) 0 ;
3991 Py_buffer rgb_buffer1 ;
3997 int res4 = SWIG_TMPOBJ ;
4006 PyObject * obj0 = 0 ;
4007 PyObject * obj1 = 0 ;
4008 PyObject * obj2 = 0 ;
4009 PyObject * obj3 = 0 ;
4010 PyObject * obj4 = 0 ;
4011 PyObject * obj5 = 0 ;
4012 PyObject * obj6 = 0 ;
4013 uint8_t *result = 0 ;
4016 if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:wrap_WebPEncodeRGBA",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
4018 // NB: with Python < 2.6 the old style buffer protocol may be used:
4019 // Py_ssize_t unused;
4020 // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4021 if (!PyObject_CheckBuffer(obj0)) {
4022 SWIG_exception_fail(SWIG_TypeError,
4023 "in method 'wrap_WebPEncodeRGBA', argument 1"
4024 " does not support the buffer interface");
4026 if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4027 SWIG_exception_fail(SWIG_RuntimeError,
4028 "in method 'wrap_WebPEncodeRGBA', unable to get buffer view");
4030 arg1 = (uint8_t *)rgb_buffer1.buf;
4032 if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4034 int ecode = SWIG_AsVal_int(obj1, &val);
4035 if (!SWIG_IsOK(ecode)) {
4036 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeRGBA" "', argument " "2"" of type '" "int""'");
4040 res2 = SWIG_AddTmpMask(ecode);
4042 if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4044 int ecode = SWIG_AsVal_int(obj2, &val);
4045 if (!SWIG_IsOK(ecode)) {
4046 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeRGBA" "', argument " "3"" of type '" "int""'");
4050 res3 = SWIG_AddTmpMask(ecode);
4052 ecode5 = SWIG_AsVal_int(obj3, &val5);
4053 if (!SWIG_IsOK(ecode5)) {
4054 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeRGBA" "', argument " "5"" of type '" "int""'");
4057 ecode6 = SWIG_AsVal_int(obj4, &val6);
4058 if (!SWIG_IsOK(ecode6)) {
4059 SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeRGBA" "', argument " "6"" of type '" "int""'");
4062 ecode7 = SWIG_AsVal_int(obj5, &val7);
4063 if (!SWIG_IsOK(ecode7)) {
4064 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeRGBA" "', argument " "7"" of type '" "int""'");
4067 ecode8 = SWIG_AsVal_float(obj6, &val8);
4068 if (!SWIG_IsOK(ecode8)) {
4069 SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "wrap_WebPEncodeRGBA" "', argument " "8"" of type '" "float""'");
4071 arg8 = (float)(val8);
4072 result = (uint8_t *)wrap_WebPEncodeRGBA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
4074 resultobj = PyString_FromStringAndSize(
4075 (const char*)result,
4076 (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeRGBA", arg3, arg4));
4078 if (SWIG_IsTmpObj(res4)) {
4079 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4081 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
4082 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4085 PyBuffer_Release(&rgb_buffer1);
4087 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4088 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4093 PyBuffer_Release(&rgb_buffer1);
4095 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4096 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4101 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeBGRA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4102 PyObject *resultobj = 0;
4103 uint8_t *arg1 = (uint8_t *) 0 ;
4104 int *arg2 = (int *) 0 ;
4105 int *arg3 = (int *) 0 ;
4106 int *arg4 = (int *) 0 ;
4111 Py_buffer rgb_buffer1 ;
4117 int res4 = SWIG_TMPOBJ ;
4126 PyObject * obj0 = 0 ;
4127 PyObject * obj1 = 0 ;
4128 PyObject * obj2 = 0 ;
4129 PyObject * obj3 = 0 ;
4130 PyObject * obj4 = 0 ;
4131 PyObject * obj5 = 0 ;
4132 PyObject * obj6 = 0 ;
4133 uint8_t *result = 0 ;
4136 if (!PyArg_ParseTuple(args,(char *)"OOOOOOO:wrap_WebPEncodeBGRA",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5,&obj6)) SWIG_fail;
4138 // NB: with Python < 2.6 the old style buffer protocol may be used:
4139 // Py_ssize_t unused;
4140 // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4141 if (!PyObject_CheckBuffer(obj0)) {
4142 SWIG_exception_fail(SWIG_TypeError,
4143 "in method 'wrap_WebPEncodeBGRA', argument 1"
4144 " does not support the buffer interface");
4146 if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4147 SWIG_exception_fail(SWIG_RuntimeError,
4148 "in method 'wrap_WebPEncodeBGRA', unable to get buffer view");
4150 arg1 = (uint8_t *)rgb_buffer1.buf;
4152 if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4154 int ecode = SWIG_AsVal_int(obj1, &val);
4155 if (!SWIG_IsOK(ecode)) {
4156 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeBGRA" "', argument " "2"" of type '" "int""'");
4160 res2 = SWIG_AddTmpMask(ecode);
4162 if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4164 int ecode = SWIG_AsVal_int(obj2, &val);
4165 if (!SWIG_IsOK(ecode)) {
4166 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeBGRA" "', argument " "3"" of type '" "int""'");
4170 res3 = SWIG_AddTmpMask(ecode);
4172 ecode5 = SWIG_AsVal_int(obj3, &val5);
4173 if (!SWIG_IsOK(ecode5)) {
4174 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeBGRA" "', argument " "5"" of type '" "int""'");
4177 ecode6 = SWIG_AsVal_int(obj4, &val6);
4178 if (!SWIG_IsOK(ecode6)) {
4179 SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeBGRA" "', argument " "6"" of type '" "int""'");
4182 ecode7 = SWIG_AsVal_int(obj5, &val7);
4183 if (!SWIG_IsOK(ecode7)) {
4184 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeBGRA" "', argument " "7"" of type '" "int""'");
4187 ecode8 = SWIG_AsVal_float(obj6, &val8);
4188 if (!SWIG_IsOK(ecode8)) {
4189 SWIG_exception_fail(SWIG_ArgError(ecode8), "in method '" "wrap_WebPEncodeBGRA" "', argument " "8"" of type '" "float""'");
4191 arg8 = (float)(val8);
4192 result = (uint8_t *)wrap_WebPEncodeBGRA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8);
4194 resultobj = PyString_FromStringAndSize(
4195 (const char*)result,
4196 (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeBGRA", arg3, arg4));
4198 if (SWIG_IsTmpObj(res4)) {
4199 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4201 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
4202 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4205 PyBuffer_Release(&rgb_buffer1);
4207 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4208 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4213 PyBuffer_Release(&rgb_buffer1);
4215 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4216 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4221 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeLosslessRGB(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4222 PyObject *resultobj = 0;
4223 uint8_t *arg1 = (uint8_t *) 0 ;
4224 int *arg2 = (int *) 0 ;
4225 int *arg3 = (int *) 0 ;
4226 int *arg4 = (int *) 0 ;
4230 Py_buffer rgb_buffer1 ;
4236 int res4 = SWIG_TMPOBJ ;
4243 PyObject * obj0 = 0 ;
4244 PyObject * obj1 = 0 ;
4245 PyObject * obj2 = 0 ;
4246 PyObject * obj3 = 0 ;
4247 PyObject * obj4 = 0 ;
4248 PyObject * obj5 = 0 ;
4249 uint8_t *result = 0 ;
4252 if (!PyArg_ParseTuple(args,(char *)"OOOOOO:wrap_WebPEncodeLosslessRGB",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
4254 // NB: with Python < 2.6 the old style buffer protocol may be used:
4255 // Py_ssize_t unused;
4256 // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4257 if (!PyObject_CheckBuffer(obj0)) {
4258 SWIG_exception_fail(SWIG_TypeError,
4259 "in method 'wrap_WebPEncodeLosslessRGB', argument 1"
4260 " does not support the buffer interface");
4262 if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4263 SWIG_exception_fail(SWIG_RuntimeError,
4264 "in method 'wrap_WebPEncodeLosslessRGB', unable to get buffer view");
4266 arg1 = (uint8_t *)rgb_buffer1.buf;
4268 if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4270 int ecode = SWIG_AsVal_int(obj1, &val);
4271 if (!SWIG_IsOK(ecode)) {
4272 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "2"" of type '" "int""'");
4276 res2 = SWIG_AddTmpMask(ecode);
4278 if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4280 int ecode = SWIG_AsVal_int(obj2, &val);
4281 if (!SWIG_IsOK(ecode)) {
4282 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "3"" of type '" "int""'");
4286 res3 = SWIG_AddTmpMask(ecode);
4288 ecode5 = SWIG_AsVal_int(obj3, &val5);
4289 if (!SWIG_IsOK(ecode5)) {
4290 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "5"" of type '" "int""'");
4293 ecode6 = SWIG_AsVal_int(obj4, &val6);
4294 if (!SWIG_IsOK(ecode6)) {
4295 SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "6"" of type '" "int""'");
4298 ecode7 = SWIG_AsVal_int(obj5, &val7);
4299 if (!SWIG_IsOK(ecode7)) {
4300 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeLosslessRGB" "', argument " "7"" of type '" "int""'");
4303 result = (uint8_t *)wrap_WebPEncodeLosslessRGB((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
4305 resultobj = PyString_FromStringAndSize(
4306 (const char*)result,
4307 (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeLosslessRGB", arg3, arg4));
4309 if (SWIG_IsTmpObj(res4)) {
4310 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4312 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
4313 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4316 PyBuffer_Release(&rgb_buffer1);
4318 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4319 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4324 PyBuffer_Release(&rgb_buffer1);
4326 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4327 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4332 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeLosslessBGR(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4333 PyObject *resultobj = 0;
4334 uint8_t *arg1 = (uint8_t *) 0 ;
4335 int *arg2 = (int *) 0 ;
4336 int *arg3 = (int *) 0 ;
4337 int *arg4 = (int *) 0 ;
4341 Py_buffer rgb_buffer1 ;
4347 int res4 = SWIG_TMPOBJ ;
4354 PyObject * obj0 = 0 ;
4355 PyObject * obj1 = 0 ;
4356 PyObject * obj2 = 0 ;
4357 PyObject * obj3 = 0 ;
4358 PyObject * obj4 = 0 ;
4359 PyObject * obj5 = 0 ;
4360 uint8_t *result = 0 ;
4363 if (!PyArg_ParseTuple(args,(char *)"OOOOOO:wrap_WebPEncodeLosslessBGR",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
4365 // NB: with Python < 2.6 the old style buffer protocol may be used:
4366 // Py_ssize_t unused;
4367 // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4368 if (!PyObject_CheckBuffer(obj0)) {
4369 SWIG_exception_fail(SWIG_TypeError,
4370 "in method 'wrap_WebPEncodeLosslessBGR', argument 1"
4371 " does not support the buffer interface");
4373 if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4374 SWIG_exception_fail(SWIG_RuntimeError,
4375 "in method 'wrap_WebPEncodeLosslessBGR', unable to get buffer view");
4377 arg1 = (uint8_t *)rgb_buffer1.buf;
4379 if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4381 int ecode = SWIG_AsVal_int(obj1, &val);
4382 if (!SWIG_IsOK(ecode)) {
4383 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "2"" of type '" "int""'");
4387 res2 = SWIG_AddTmpMask(ecode);
4389 if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4391 int ecode = SWIG_AsVal_int(obj2, &val);
4392 if (!SWIG_IsOK(ecode)) {
4393 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "3"" of type '" "int""'");
4397 res3 = SWIG_AddTmpMask(ecode);
4399 ecode5 = SWIG_AsVal_int(obj3, &val5);
4400 if (!SWIG_IsOK(ecode5)) {
4401 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "5"" of type '" "int""'");
4404 ecode6 = SWIG_AsVal_int(obj4, &val6);
4405 if (!SWIG_IsOK(ecode6)) {
4406 SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "6"" of type '" "int""'");
4409 ecode7 = SWIG_AsVal_int(obj5, &val7);
4410 if (!SWIG_IsOK(ecode7)) {
4411 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeLosslessBGR" "', argument " "7"" of type '" "int""'");
4414 result = (uint8_t *)wrap_WebPEncodeLosslessBGR((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
4416 resultobj = PyString_FromStringAndSize(
4417 (const char*)result,
4418 (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeLosslessBGR", arg3, arg4));
4420 if (SWIG_IsTmpObj(res4)) {
4421 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4423 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
4424 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4427 PyBuffer_Release(&rgb_buffer1);
4429 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4430 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4435 PyBuffer_Release(&rgb_buffer1);
4437 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4438 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4443 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeLosslessRGBA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4444 PyObject *resultobj = 0;
4445 uint8_t *arg1 = (uint8_t *) 0 ;
4446 int *arg2 = (int *) 0 ;
4447 int *arg3 = (int *) 0 ;
4448 int *arg4 = (int *) 0 ;
4452 Py_buffer rgb_buffer1 ;
4458 int res4 = SWIG_TMPOBJ ;
4465 PyObject * obj0 = 0 ;
4466 PyObject * obj1 = 0 ;
4467 PyObject * obj2 = 0 ;
4468 PyObject * obj3 = 0 ;
4469 PyObject * obj4 = 0 ;
4470 PyObject * obj5 = 0 ;
4471 uint8_t *result = 0 ;
4474 if (!PyArg_ParseTuple(args,(char *)"OOOOOO:wrap_WebPEncodeLosslessRGBA",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
4476 // NB: with Python < 2.6 the old style buffer protocol may be used:
4477 // Py_ssize_t unused;
4478 // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4479 if (!PyObject_CheckBuffer(obj0)) {
4480 SWIG_exception_fail(SWIG_TypeError,
4481 "in method 'wrap_WebPEncodeLosslessRGBA', argument 1"
4482 " does not support the buffer interface");
4484 if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4485 SWIG_exception_fail(SWIG_RuntimeError,
4486 "in method 'wrap_WebPEncodeLosslessRGBA', unable to get buffer view");
4488 arg1 = (uint8_t *)rgb_buffer1.buf;
4490 if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4492 int ecode = SWIG_AsVal_int(obj1, &val);
4493 if (!SWIG_IsOK(ecode)) {
4494 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "2"" of type '" "int""'");
4498 res2 = SWIG_AddTmpMask(ecode);
4500 if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4502 int ecode = SWIG_AsVal_int(obj2, &val);
4503 if (!SWIG_IsOK(ecode)) {
4504 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "3"" of type '" "int""'");
4508 res3 = SWIG_AddTmpMask(ecode);
4510 ecode5 = SWIG_AsVal_int(obj3, &val5);
4511 if (!SWIG_IsOK(ecode5)) {
4512 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "5"" of type '" "int""'");
4515 ecode6 = SWIG_AsVal_int(obj4, &val6);
4516 if (!SWIG_IsOK(ecode6)) {
4517 SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "6"" of type '" "int""'");
4520 ecode7 = SWIG_AsVal_int(obj5, &val7);
4521 if (!SWIG_IsOK(ecode7)) {
4522 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeLosslessRGBA" "', argument " "7"" of type '" "int""'");
4525 result = (uint8_t *)wrap_WebPEncodeLosslessRGBA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
4527 resultobj = PyString_FromStringAndSize(
4528 (const char*)result,
4529 (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeLosslessRGBA", arg3, arg4));
4531 if (SWIG_IsTmpObj(res4)) {
4532 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4534 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
4535 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4538 PyBuffer_Release(&rgb_buffer1);
4540 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4541 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4546 PyBuffer_Release(&rgb_buffer1);
4548 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4549 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4554 SWIGINTERN PyObject *_wrap_wrap_WebPEncodeLosslessBGRA(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
4555 PyObject *resultobj = 0;
4556 uint8_t *arg1 = (uint8_t *) 0 ;
4557 int *arg2 = (int *) 0 ;
4558 int *arg3 = (int *) 0 ;
4559 int *arg4 = (int *) 0 ;
4563 Py_buffer rgb_buffer1 ;
4569 int res4 = SWIG_TMPOBJ ;
4576 PyObject * obj0 = 0 ;
4577 PyObject * obj1 = 0 ;
4578 PyObject * obj2 = 0 ;
4579 PyObject * obj3 = 0 ;
4580 PyObject * obj4 = 0 ;
4581 PyObject * obj5 = 0 ;
4582 uint8_t *result = 0 ;
4585 if (!PyArg_ParseTuple(args,(char *)"OOOOOO:wrap_WebPEncodeLosslessBGRA",&obj0,&obj1,&obj2,&obj3,&obj4,&obj5)) SWIG_fail;
4587 // NB: with Python < 2.6 the old style buffer protocol may be used:
4588 // Py_ssize_t unused;
4589 // PyObject_AsReadBuffer(obj0, (const void**)(&arg1), &unused);
4590 if (!PyObject_CheckBuffer(obj0)) {
4591 SWIG_exception_fail(SWIG_TypeError,
4592 "in method 'wrap_WebPEncodeLosslessBGRA', argument 1"
4593 " does not support the buffer interface");
4595 if (PyObject_GetBuffer(obj0, &rgb_buffer1, PyBUF_SIMPLE)) {
4596 SWIG_exception_fail(SWIG_RuntimeError,
4597 "in method 'wrap_WebPEncodeLosslessBGRA', unable to get buffer view");
4599 arg1 = (uint8_t *)rgb_buffer1.buf;
4601 if (!(SWIG_IsOK((res2 = SWIG_ConvertPtr(obj1,SWIG_as_voidptrptr(&arg2),SWIGTYPE_p_int,0))))) {
4603 int ecode = SWIG_AsVal_int(obj1, &val);
4604 if (!SWIG_IsOK(ecode)) {
4605 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "2"" of type '" "int""'");
4609 res2 = SWIG_AddTmpMask(ecode);
4611 if (!(SWIG_IsOK((res3 = SWIG_ConvertPtr(obj2,SWIG_as_voidptrptr(&arg3),SWIGTYPE_p_int,0))))) {
4613 int ecode = SWIG_AsVal_int(obj2, &val);
4614 if (!SWIG_IsOK(ecode)) {
4615 SWIG_exception_fail(SWIG_ArgError(ecode), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "3"" of type '" "int""'");
4619 res3 = SWIG_AddTmpMask(ecode);
4621 ecode5 = SWIG_AsVal_int(obj3, &val5);
4622 if (!SWIG_IsOK(ecode5)) {
4623 SWIG_exception_fail(SWIG_ArgError(ecode5), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "5"" of type '" "int""'");
4626 ecode6 = SWIG_AsVal_int(obj4, &val6);
4627 if (!SWIG_IsOK(ecode6)) {
4628 SWIG_exception_fail(SWIG_ArgError(ecode6), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "6"" of type '" "int""'");
4631 ecode7 = SWIG_AsVal_int(obj5, &val7);
4632 if (!SWIG_IsOK(ecode7)) {
4633 SWIG_exception_fail(SWIG_ArgError(ecode7), "in method '" "wrap_WebPEncodeLosslessBGRA" "', argument " "7"" of type '" "int""'");
4636 result = (uint8_t *)wrap_WebPEncodeLosslessBGRA((uint8_t const *)arg1,arg2,arg3,arg4,arg5,arg6,arg7);
4638 resultobj = PyString_FromStringAndSize(
4639 (const char*)result,
4640 (result == NULL) ? 0 : ReturnedBufferSize("wrap_WebPEncodeLosslessBGRA", arg3, arg4));
4642 if (SWIG_IsTmpObj(res4)) {
4643 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_From_int((*arg4)));
4645 int new_flags = SWIG_IsNewObj(res4) ? (SWIG_POINTER_OWN | 0 ) : 0 ;
4646 resultobj = SWIG_Python_AppendOutput(resultobj, SWIG_NewPointerObj((void*)(arg4), SWIGTYPE_p_int, new_flags));
4649 PyBuffer_Release(&rgb_buffer1);
4651 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4652 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4657 PyBuffer_Release(&rgb_buffer1);
4659 if (SWIG_IsNewObj(res2)) free((char*)arg2);
4660 if (SWIG_IsNewObj(res3)) free((char*)arg3);
4665 static PyMethodDef SwigMethods[] = {
4666 { (char *)"SWIG_PyInstanceMethod_New", (PyCFunction)SWIG_PyInstanceMethod_New, METH_O, NULL},
4667 { (char *)"WebPGetDecoderVersion", _wrap_WebPGetDecoderVersion, METH_VARARGS, (char *)"WebPGetDecoderVersion() -> int"},
4668 { (char *)"WebPGetInfo", _wrap_WebPGetInfo, METH_VARARGS, (char *)"WebPGetInfo(uint8_t data) -> (width, height)"},
4669 { (char *)"WebPDecodeRGB", _wrap_WebPDecodeRGB, METH_VARARGS, (char *)"WebPDecodeRGB(uint8_t data) -> (rgb, width, height)"},
4670 { (char *)"WebPDecodeRGBA", _wrap_WebPDecodeRGBA, METH_VARARGS, (char *)"WebPDecodeRGBA(uint8_t data) -> (rgb, width, height)"},
4671 { (char *)"WebPDecodeARGB", _wrap_WebPDecodeARGB, METH_VARARGS, (char *)"WebPDecodeARGB(uint8_t data) -> (rgb, width, height)"},
4672 { (char *)"WebPDecodeBGR", _wrap_WebPDecodeBGR, METH_VARARGS, (char *)"WebPDecodeBGR(uint8_t data) -> (rgb, width, height)"},
4673 { (char *)"WebPDecodeBGRA", _wrap_WebPDecodeBGRA, METH_VARARGS, (char *)"WebPDecodeBGRA(uint8_t data) -> (rgb, width, height)"},
4674 { (char *)"WebPGetEncoderVersion", _wrap_WebPGetEncoderVersion, METH_VARARGS, (char *)"WebPGetEncoderVersion() -> int"},
4675 { (char *)"wrap_WebPEncodeRGB", _wrap_wrap_WebPEncodeRGB, METH_VARARGS, (char *)"private, do not call directly."},
4676 { (char *)"wrap_WebPEncodeBGR", _wrap_wrap_WebPEncodeBGR, METH_VARARGS, (char *)"private, do not call directly."},
4677 { (char *)"wrap_WebPEncodeRGBA", _wrap_wrap_WebPEncodeRGBA, METH_VARARGS, (char *)"private, do not call directly."},
4678 { (char *)"wrap_WebPEncodeBGRA", _wrap_wrap_WebPEncodeBGRA, METH_VARARGS, (char *)"private, do not call directly."},
4679 { (char *)"wrap_WebPEncodeLosslessRGB", _wrap_wrap_WebPEncodeLosslessRGB, METH_VARARGS, (char *)"private, do not call directly."},
4680 { (char *)"wrap_WebPEncodeLosslessBGR", _wrap_wrap_WebPEncodeLosslessBGR, METH_VARARGS, (char *)"private, do not call directly."},
4681 { (char *)"wrap_WebPEncodeLosslessRGBA", _wrap_wrap_WebPEncodeLosslessRGBA, METH_VARARGS, (char *)"private, do not call directly."},
4682 { (char *)"wrap_WebPEncodeLosslessBGRA", _wrap_wrap_WebPEncodeLosslessBGRA, METH_VARARGS, (char *)"private, do not call directly."},
4683 { NULL, NULL, 0, NULL }
4687 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4689 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
4690 static swig_type_info _swigt__p_int = {"_p_int", "int *", 0, 0, (void*)0, 0};
4691 static swig_type_info _swigt__p_uint8_t = {"_p_uint8_t", "uint8_t *", 0, 0, (void*)0, 0};
4693 static swig_type_info *swig_type_initial[] = {
4699 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
4700 static swig_cast_info _swigc__p_int[] = { {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
4701 static swig_cast_info _swigc__p_uint8_t[] = { {&_swigt__p_uint8_t, 0, 0, 0},{0, 0, 0, 0}};
4703 static swig_cast_info *swig_cast_initial[] = {
4710 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
4712 static swig_const_info swig_const_table[] = {
4713 {0, 0, 0, 0.0, 0, 0}};
4718 /* -----------------------------------------------------------------------------
4719 * Type initialization:
4720 * This problem is tough by the requirement that no dynamic
4721 * memory is used. Also, since swig_type_info structures store pointers to
4722 * swig_cast_info structures and swig_cast_info structures store pointers back
4723 * to swig_type_info structures, we need some lookup code at initialization.
4724 * The idea is that swig generates all the structures that are needed.
4725 * The runtime then collects these partially filled structures.
4726 * The SWIG_InitializeModule function takes these initial arrays out of
4727 * swig_module, and does all the lookup, filling in the swig_module.types
4728 * array with the correct data and linking the correct swig_cast_info
4729 * structures together.
4731 * The generated swig_type_info structures are assigned staticly to an initial
4732 * array. We just loop through that array, and handle each type individually.
4733 * First we lookup if this type has been already loaded, and if so, use the
4734 * loaded structure instead of the generated one. Then we have to fill in the
4735 * cast linked list. The cast data is initially stored in something like a
4736 * two-dimensional array. Each row corresponds to a type (there are the same
4737 * number of rows as there are in the swig_type_initial array). Each entry in
4738 * a column is one of the swig_cast_info structures for that type.
4739 * The cast_initial array is actually an array of arrays, because each row has
4740 * a variable number of columns. So to actually build the cast linked list,
4741 * we find the array of casts associated with the type, and loop through it
4742 * adding the casts to the list. The one last trick we need to do is making
4743 * sure the type pointer in the swig_cast_info struct is correct.
4745 * First off, we lookup the cast->type name to see if it is already loaded.
4746 * There are three cases to handle:
4747 * 1) If the cast->type has already been loaded AND the type we are adding
4748 * casting info to has not been loaded (it is in this module), THEN we
4749 * replace the cast->type pointer with the type pointer that has already
4751 * 2) If BOTH types (the one we are adding casting info to, and the
4752 * cast->type) are loaded, THEN the cast info has already been loaded by
4753 * the previous module so we just ignore it.
4754 * 3) Finally, if cast->type has not already been loaded, then we add that
4755 * swig_cast_info to the linked list (because the cast->type) pointer will
4757 * ----------------------------------------------------------------------------- */
4767 #define SWIGRUNTIME_DEBUG
4772 SWIG_InitializeModule(void *clientdata) {
4774 swig_module_info *module_head, *iter;
4777 clientdata = clientdata;
4779 /* check to see if the circular list has been setup, if not, set it up */
4780 if (swig_module.next==0) {
4781 /* Initialize the swig_module */
4782 swig_module.type_initial = swig_type_initial;
4783 swig_module.cast_initial = swig_cast_initial;
4784 swig_module.next = &swig_module;
4790 /* Try and load any already created modules */
4791 module_head = SWIG_GetModule(clientdata);
4793 /* This is the first module loaded for this interpreter */
4794 /* so set the swig module into the interpreter */
4795 SWIG_SetModule(clientdata, &swig_module);
4796 module_head = &swig_module;
4798 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
4802 if (iter==&swig_module) {
4807 } while (iter!= module_head);
4809 /* if the is found in the list, then all is done and we may leave */
4811 /* otherwise we must add out module into the list */
4812 swig_module.next = module_head->next;
4813 module_head->next = &swig_module;
4816 /* When multiple interpeters are used, a module could have already been initialized in
4817 a different interpreter, but not yet have a pointer in this interpreter.
4818 In this case, we do not want to continue adding types... everything should be
4820 if (init == 0) return;
4822 /* Now work on filling in swig_module.types */
4823 #ifdef SWIGRUNTIME_DEBUG
4824 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
4826 for (i = 0; i < swig_module.size; ++i) {
4827 swig_type_info *type = 0;
4828 swig_type_info *ret;
4829 swig_cast_info *cast;
4831 #ifdef SWIGRUNTIME_DEBUG
4832 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
4835 /* if there is another module already loaded */
4836 if (swig_module.next != &swig_module) {
4837 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
4840 /* Overwrite clientdata field */
4841 #ifdef SWIGRUNTIME_DEBUG
4842 printf("SWIG_InitializeModule: found type %s\n", type->name);
4844 if (swig_module.type_initial[i]->clientdata) {
4845 type->clientdata = swig_module.type_initial[i]->clientdata;
4846 #ifdef SWIGRUNTIME_DEBUG
4847 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
4851 type = swig_module.type_initial[i];
4854 /* Insert casting types */
4855 cast = swig_module.cast_initial[i];
4856 while (cast->type) {
4857 /* Don't need to add information already in the list */
4859 #ifdef SWIGRUNTIME_DEBUG
4860 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
4862 if (swig_module.next != &swig_module) {
4863 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
4864 #ifdef SWIGRUNTIME_DEBUG
4865 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
4869 if (type == swig_module.type_initial[i]) {
4870 #ifdef SWIGRUNTIME_DEBUG
4871 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
4876 /* Check for casting already in the list */
4877 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
4878 #ifdef SWIGRUNTIME_DEBUG
4879 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
4881 if (!ocast) ret = 0;
4886 #ifdef SWIGRUNTIME_DEBUG
4887 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
4890 type->cast->prev = cast;
4891 cast->next = type->cast;
4897 /* Set entry in modules->types array equal to the type */
4898 swig_module.types[i] = type;
4900 swig_module.types[i] = 0;
4902 #ifdef SWIGRUNTIME_DEBUG
4903 printf("**** SWIG_InitializeModule: Cast List ******\n");
4904 for (i = 0; i < swig_module.size; ++i) {
4906 swig_cast_info *cast = swig_module.cast_initial[i];
4907 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
4908 while (cast->type) {
4909 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
4913 printf("---- Total casts: %d\n",j);
4915 printf("**** SWIG_InitializeModule: Cast List ******\n");
4919 /* This function will propagate the clientdata field of type to
4920 * any new swig_type_info structures that have been added into the list
4921 * of equivalent types. It is like calling
4922 * SWIG_TypeClientData(type, clientdata) a second time.
4925 SWIG_PropagateClientData(void) {
4927 swig_cast_info *equiv;
4928 static int init_run = 0;
4930 if (init_run) return;
4933 for (i = 0; i < swig_module.size; i++) {
4934 if (swig_module.types[i]->clientdata) {
4935 equiv = swig_module.types[i]->cast;
4937 if (!equiv->converter) {
4938 if (equiv->type && !equiv->type->clientdata)
4939 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
4941 equiv = equiv->next;
4961 /* Python-specific SWIG API */
4962 #define SWIG_newvarlink() SWIG_Python_newvarlink()
4963 #define SWIG_addvarlink(p, name, get_attr, set_attr) SWIG_Python_addvarlink(p, name, get_attr, set_attr)
4964 #define SWIG_InstallConstants(d, constants) SWIG_Python_InstallConstants(d, constants)
4966 /* -----------------------------------------------------------------------------
4967 * global variable support code.
4968 * ----------------------------------------------------------------------------- */
4970 typedef struct swig_globalvar {
4971 char *name; /* Name of global variable */
4972 PyObject *(*get_attr)(void); /* Return the current value */
4973 int (*set_attr)(PyObject *); /* Set the value */
4974 struct swig_globalvar *next;
4977 typedef struct swig_varlinkobject {
4979 swig_globalvar *vars;
4980 } swig_varlinkobject;
4982 SWIGINTERN PyObject *
4983 swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
4984 #if PY_VERSION_HEX >= 0x03000000
4985 return PyUnicode_InternFromString("<Swig global variables>");
4987 return PyString_FromString("<Swig global variables>");
4991 SWIGINTERN PyObject *
4992 swig_varlink_str(swig_varlinkobject *v) {
4993 #if PY_VERSION_HEX >= 0x03000000
4994 PyObject *str = PyUnicode_InternFromString("(");
4997 swig_globalvar *var;
4998 for (var = v->vars; var; var=var->next) {
4999 tail = PyUnicode_FromString(var->name);
5000 joined = PyUnicode_Concat(str, tail);
5005 tail = PyUnicode_InternFromString(", ");
5006 joined = PyUnicode_Concat(str, tail);
5012 tail = PyUnicode_InternFromString(")");
5013 joined = PyUnicode_Concat(str, tail);
5018 PyObject *str = PyString_FromString("(");
5019 swig_globalvar *var;
5020 for (var = v->vars; var; var=var->next) {
5021 PyString_ConcatAndDel(&str,PyString_FromString(var->name));
5022 if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
5024 PyString_ConcatAndDel(&str,PyString_FromString(")"));
5030 swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
5032 PyObject *str = swig_varlink_str(v);
5033 fprintf(fp,"Swig global variables ");
5034 fprintf(fp,"%s\n", tmp = SWIG_Python_str_AsChar(str));
5035 SWIG_Python_str_DelForPy3(tmp);
5041 swig_varlink_dealloc(swig_varlinkobject *v) {
5042 swig_globalvar *var = v->vars;
5044 swig_globalvar *n = var->next;
5051 SWIGINTERN PyObject *
5052 swig_varlink_getattr(swig_varlinkobject *v, char *n) {
5053 PyObject *res = NULL;
5054 swig_globalvar *var = v->vars;
5056 if (strcmp(var->name,n) == 0) {
5057 res = (*var->get_attr)();
5062 if (res == NULL && !PyErr_Occurred()) {
5063 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
5069 swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
5071 swig_globalvar *var = v->vars;
5073 if (strcmp(var->name,n) == 0) {
5074 res = (*var->set_attr)(p);
5079 if (res == 1 && !PyErr_Occurred()) {
5080 PyErr_SetString(PyExc_NameError,"Unknown C global variable");
5085 SWIGINTERN PyTypeObject*
5086 swig_varlink_type(void) {
5087 static char varlink__doc__[] = "Swig var link object";
5088 static PyTypeObject varlink_type;
5089 static int type_init = 0;
5091 const PyTypeObject tmp = {
5092 /* PyObject header changed in Python 3 */
5093 #if PY_VERSION_HEX >= 0x03000000
5094 PyVarObject_HEAD_INIT(NULL, 0)
5096 PyObject_HEAD_INIT(NULL)
5099 (char *)"swigvarlink", /* tp_name */
5100 sizeof(swig_varlinkobject), /* tp_basicsize */
5101 0, /* tp_itemsize */
5102 (destructor) swig_varlink_dealloc, /* tp_dealloc */
5103 (printfunc) swig_varlink_print, /* tp_print */
5104 (getattrfunc) swig_varlink_getattr, /* tp_getattr */
5105 (setattrfunc) swig_varlink_setattr, /* tp_setattr */
5107 (reprfunc) swig_varlink_repr, /* tp_repr */
5108 0, /* tp_as_number */
5109 0, /* tp_as_sequence */
5110 0, /* tp_as_mapping */
5113 (reprfunc) swig_varlink_str, /* tp_str */
5114 0, /* tp_getattro */
5115 0, /* tp_setattro */
5116 0, /* tp_as_buffer */
5118 varlink__doc__, /* tp_doc */
5119 0, /* tp_traverse */
5121 0, /* tp_richcompare */
5122 0, /* tp_weaklistoffset */
5123 #if PY_VERSION_HEX >= 0x02020000
5124 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
5126 #if PY_VERSION_HEX >= 0x02030000
5129 #if PY_VERSION_HEX >= 0x02060000
5133 0,0,0,0 /* tp_alloc -> tp_next */
5138 #if PY_VERSION_HEX < 0x02020000
5139 varlink_type.ob_type = &PyType_Type;
5141 if (PyType_Ready(&varlink_type) < 0)
5145 return &varlink_type;
5148 /* Create a variable linking object for use later */
5149 SWIGINTERN PyObject *
5150 SWIG_Python_newvarlink(void) {
5151 swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
5155 return ((PyObject*) result);
5159 SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
5160 swig_varlinkobject *v = (swig_varlinkobject *) p;
5161 swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
5163 size_t size = strlen(name)+1;
5164 gv->name = (char *)malloc(size);
5166 strncpy(gv->name,name,size);
5167 gv->get_attr = get_attr;
5168 gv->set_attr = set_attr;
5175 SWIGINTERN PyObject *
5176 SWIG_globals(void) {
5177 static PyObject *_SWIG_globals = 0;
5178 if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();
5179 return _SWIG_globals;
5182 /* -----------------------------------------------------------------------------
5183 * constants/methods manipulation
5184 * ----------------------------------------------------------------------------- */
5186 /* Install Constants */
5188 SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
5191 for (i = 0; constants[i].type; ++i) {
5192 switch(constants[i].type) {
5193 case SWIG_PY_POINTER:
5194 obj = SWIG_InternalNewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
5196 case SWIG_PY_BINARY:
5197 obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
5204 PyDict_SetItemString(d, constants[i].name, obj);
5210 /* -----------------------------------------------------------------------------*/
5211 /* Fix SwigMethods to carry the callback ptrs when needed */
5212 /* -----------------------------------------------------------------------------*/
5215 SWIG_Python_FixMethods(PyMethodDef *methods,
5216 swig_const_info *const_table,
5217 swig_type_info **types,
5218 swig_type_info **types_initial) {
5220 for (i = 0; methods[i].ml_name; ++i) {
5221 const char *c = methods[i].ml_doc;
5222 if (c && (c = strstr(c, "swig_ptr: "))) {
5224 swig_const_info *ci = 0;
5225 const char *name = c + 10;
5226 for (j = 0; const_table[j].type; ++j) {
5227 if (strncmp(const_table[j].name, name,
5228 strlen(const_table[j].name)) == 0) {
5229 ci = &(const_table[j]);
5234 void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
5236 size_t shift = (ci->ptype) - types;
5237 swig_type_info *ty = types_initial[shift];
5238 size_t ldoc = (c - methods[i].ml_doc);
5239 size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
5240 char *ndoc = (char*)malloc(ldoc + lptr + 10);
5243 strncpy(buff, methods[i].ml_doc, ldoc);
5245 strncpy(buff, "swig_ptr: ", 10);
5247 SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
5248 methods[i].ml_doc = ndoc;
5260 /* -----------------------------------------------------------------------------*
5261 * Partial Init method
5262 * -----------------------------------------------------------------------------*/
5269 #if PY_VERSION_HEX >= 0x03000000
5275 PyObject *m, *d, *md;
5276 #if PY_VERSION_HEX >= 0x03000000
5277 static struct PyModuleDef SWIG_module = {
5278 # if PY_VERSION_HEX >= 0x03020000
5279 PyModuleDef_HEAD_INIT,
5282 PyObject_HEAD_INIT(NULL)
5299 #if defined(SWIGPYTHON_BUILTIN)
5300 static SwigPyClientData SwigPyObject_clientdata = {
5303 static PyGetSetDef this_getset_def = {
5304 (char *)"this", &SwigPyBuiltin_ThisClosure, NULL, NULL, NULL
5306 static SwigPyGetSet thisown_getset_closure = {
5307 (PyCFunction) SwigPyObject_own,
5308 (PyCFunction) SwigPyObject_own
5310 static PyGetSetDef thisown_getset_def = {
5311 (char *)"thisown", SwigPyBuiltin_GetterClosure, SwigPyBuiltin_SetterClosure, NULL, &thisown_getset_closure
5313 PyObject *metatype_args;
5314 PyTypeObject *builtin_pytype;
5315 int builtin_base_count;
5316 swig_type_info *builtin_basetype;
5318 PyGetSetDescrObject *static_getset;
5319 PyTypeObject *metatype;
5320 SwigPyClientData *cd;
5321 PyObject *public_interface, *public_symbol;
5322 PyObject *this_descr;
5323 PyObject *thisown_descr;
5326 (void)builtin_pytype;
5327 (void)builtin_base_count;
5328 (void)builtin_basetype;
5330 (void)static_getset;
5332 /* metatype is used to implement static member variables. */
5333 metatype_args = Py_BuildValue("(s(O){})", "SwigPyObjectType", &PyType_Type);
5334 assert(metatype_args);
5335 metatype = (PyTypeObject *) PyType_Type.tp_call((PyObject *) &PyType_Type, metatype_args, NULL);
5337 Py_DECREF(metatype_args);
5338 metatype->tp_setattro = (setattrofunc) &SwigPyObjectType_setattro;
5339 assert(PyType_Ready(metatype) >= 0);
5342 /* Fix SwigMethods to carry the callback ptrs when needed */
5343 SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
5345 #if PY_VERSION_HEX >= 0x03000000
5346 m = PyModule_Create(&SWIG_module);
5348 m = Py_InitModule((char *) SWIG_name, SwigMethods);
5350 md = d = PyModule_GetDict(m);
5352 SWIG_InitializeModule(0);
5354 #ifdef SWIGPYTHON_BUILTIN
5355 SwigPyObject_stype = SWIG_MangledTypeQuery("_p_SwigPyObject");
5356 assert(SwigPyObject_stype);
5357 cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
5359 SwigPyObject_stype->clientdata = &SwigPyObject_clientdata;
5360 SwigPyObject_clientdata.pytype = SwigPyObject_TypeOnce();
5361 } else if (SwigPyObject_TypeOnce()->tp_basicsize != cd->pytype->tp_basicsize) {
5362 PyErr_SetString(PyExc_RuntimeError, "Import error: attempted to load two incompatible swig-generated modules.");
5363 # if PY_VERSION_HEX >= 0x03000000
5370 /* All objects have a 'this' attribute */
5371 this_descr = PyDescr_NewGetSet(SwigPyObject_type(), &this_getset_def);
5374 /* All objects have a 'thisown' attribute */
5375 thisown_descr = PyDescr_NewGetSet(SwigPyObject_type(), &thisown_getset_def);
5376 (void)thisown_descr;
5378 public_interface = PyList_New(0);
5380 (void)public_symbol;
5382 PyDict_SetItemString(md, "__all__", public_interface);
5383 Py_DECREF(public_interface);
5384 for (i = 0; SwigMethods[i].ml_name != NULL; ++i)
5385 SwigPyBuiltin_AddPublicSymbol(public_interface, SwigMethods[i].ml_name);
5386 for (i = 0; swig_const_table[i].name != 0; ++i)
5387 SwigPyBuiltin_AddPublicSymbol(public_interface, swig_const_table[i].name);
5390 SWIG_InstallConstants(d,swig_const_table);
5392 #if PY_VERSION_HEX >= 0x03000000