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