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