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 SWIGRUBY
12
13
14 #ifdef __cplusplus
15 /* SwigValueWrapper is described in swig.swg */
16 template<typename T> class SwigValueWrapper {
17 struct SwigMovePointer {
18 T *ptr;
SwigMovePointerSwigValueWrapper::SwigMovePointer19 SwigMovePointer(T *p) : ptr(p) { }
~SwigMovePointerSwigValueWrapper::SwigMovePointer20 ~SwigMovePointer() { delete ptr; }
operator =SwigValueWrapper::SwigMovePointer21 SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
22 } pointer;
23 SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
24 SwigValueWrapper(const SwigValueWrapper<T>& rhs);
25 public:
SwigValueWrapper()26 SwigValueWrapper() : pointer(0) { }
operator =(const T & t)27 SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
operator T&() const28 operator T&() const { return *pointer.ptr; }
operator &()29 T *operator&() { return pointer.ptr; }
30 };
31
SwigValueInit()32 template <typename T> T SwigValueInit() {
33 return T();
34 }
35 #endif
36
37 /* -----------------------------------------------------------------------------
38 * This section contains generic SWIG labels for method/variable
39 * declarations/attributes, and other compiler dependent labels.
40 * ----------------------------------------------------------------------------- */
41
42 /* template workaround for compilers that cannot correctly implement the C++ standard */
43 #ifndef SWIGTEMPLATEDISAMBIGUATOR
44 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
45 # define SWIGTEMPLATEDISAMBIGUATOR template
46 # elif defined(__HP_aCC)
47 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
48 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
49 # define SWIGTEMPLATEDISAMBIGUATOR template
50 # else
51 # define SWIGTEMPLATEDISAMBIGUATOR
52 # endif
53 #endif
54
55 /* inline attribute */
56 #ifndef SWIGINLINE
57 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
58 # define SWIGINLINE inline
59 # else
60 # define SWIGINLINE
61 # endif
62 #endif
63
64 /* attribute recognised by some compilers to avoid 'unused' warnings */
65 #ifndef SWIGUNUSED
66 # if defined(__GNUC__)
67 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
68 # define SWIGUNUSED __attribute__ ((__unused__))
69 # else
70 # define SWIGUNUSED
71 # endif
72 # elif defined(__ICC)
73 # define SWIGUNUSED __attribute__ ((__unused__))
74 # else
75 # define SWIGUNUSED
76 # endif
77 #endif
78
79 #ifndef SWIG_MSC_UNSUPPRESS_4505
80 # if defined(_MSC_VER)
81 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
82 # endif
83 #endif
84
85 #ifndef SWIGUNUSEDPARM
86 # ifdef __cplusplus
87 # define SWIGUNUSEDPARM(p)
88 # else
89 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
90 # endif
91 #endif
92
93 /* internal SWIG method */
94 #ifndef SWIGINTERN
95 # define SWIGINTERN static SWIGUNUSED
96 #endif
97
98 /* internal inline SWIG method */
99 #ifndef SWIGINTERNINLINE
100 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
101 #endif
102
103 /* exporting methods */
104 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
105 # ifndef GCC_HASCLASSVISIBILITY
106 # define GCC_HASCLASSVISIBILITY
107 # endif
108 #endif
109
110 #ifndef SWIGEXPORT
111 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
112 # if defined(STATIC_LINKED)
113 # define SWIGEXPORT
114 # else
115 # define SWIGEXPORT __declspec(dllexport)
116 # endif
117 # else
118 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
119 # define SWIGEXPORT __attribute__ ((visibility("default")))
120 # else
121 # define SWIGEXPORT
122 # endif
123 # endif
124 #endif
125
126 /* calling conventions for Windows */
127 #ifndef SWIGSTDCALL
128 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
129 # define SWIGSTDCALL __stdcall
130 # else
131 # define SWIGSTDCALL
132 # endif
133 #endif
134
135 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
136 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
137 # define _CRT_SECURE_NO_DEPRECATE
138 #endif
139
140 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
141 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
142 # define _SCL_SECURE_NO_DEPRECATE
143 #endif
144
145
146 /* -----------------------------------------------------------------------------
147 * This section contains generic SWIG labels for method/variable
148 * declarations/attributes, and other compiler dependent labels.
149 * ----------------------------------------------------------------------------- */
150
151 /* template workaround for compilers that cannot correctly implement the C++ standard */
152 #ifndef SWIGTEMPLATEDISAMBIGUATOR
153 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
154 # define SWIGTEMPLATEDISAMBIGUATOR template
155 # elif defined(__HP_aCC)
156 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
157 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
158 # define SWIGTEMPLATEDISAMBIGUATOR template
159 # else
160 # define SWIGTEMPLATEDISAMBIGUATOR
161 # endif
162 #endif
163
164 /* inline attribute */
165 #ifndef SWIGINLINE
166 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
167 # define SWIGINLINE inline
168 # else
169 # define SWIGINLINE
170 # endif
171 #endif
172
173 /* attribute recognised by some compilers to avoid 'unused' warnings */
174 #ifndef SWIGUNUSED
175 # if defined(__GNUC__)
176 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
177 # define SWIGUNUSED __attribute__ ((__unused__))
178 # else
179 # define SWIGUNUSED
180 # endif
181 # elif defined(__ICC)
182 # define SWIGUNUSED __attribute__ ((__unused__))
183 # else
184 # define SWIGUNUSED
185 # endif
186 #endif
187
188 #ifndef SWIG_MSC_UNSUPPRESS_4505
189 # if defined(_MSC_VER)
190 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
191 # endif
192 #endif
193
194 #ifndef SWIGUNUSEDPARM
195 # ifdef __cplusplus
196 # define SWIGUNUSEDPARM(p)
197 # else
198 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
199 # endif
200 #endif
201
202 /* internal SWIG method */
203 #ifndef SWIGINTERN
204 # define SWIGINTERN static SWIGUNUSED
205 #endif
206
207 /* internal inline SWIG method */
208 #ifndef SWIGINTERNINLINE
209 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
210 #endif
211
212 /* exporting methods */
213 #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
214 # ifndef GCC_HASCLASSVISIBILITY
215 # define GCC_HASCLASSVISIBILITY
216 # endif
217 #endif
218
219 #ifndef SWIGEXPORT
220 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
221 # if defined(STATIC_LINKED)
222 # define SWIGEXPORT
223 # else
224 # define SWIGEXPORT __declspec(dllexport)
225 # endif
226 # else
227 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
228 # define SWIGEXPORT __attribute__ ((visibility("default")))
229 # else
230 # define SWIGEXPORT
231 # endif
232 # endif
233 #endif
234
235 /* calling conventions for Windows */
236 #ifndef SWIGSTDCALL
237 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
238 # define SWIGSTDCALL __stdcall
239 # else
240 # define SWIGSTDCALL
241 # endif
242 #endif
243
244 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
245 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
246 # define _CRT_SECURE_NO_DEPRECATE
247 #endif
248
249 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
250 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
251 # define _SCL_SECURE_NO_DEPRECATE
252 #endif
253
254
255 /* -----------------------------------------------------------------------------
256 * swigrun.swg
257 *
258 * This file contains generic C API SWIG runtime support for pointer
259 * type checking.
260 * ----------------------------------------------------------------------------- */
261
262 /* This should only be incremented when either the layout of swig_type_info changes,
263 or for whatever reason, the runtime changes incompatibly */
264 #define SWIG_RUNTIME_VERSION "4"
265
266 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
267 #ifdef SWIG_TYPE_TABLE
268 # define SWIG_QUOTE_STRING(x) #x
269 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
270 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
271 #else
272 # define SWIG_TYPE_TABLE_NAME
273 #endif
274
275 /*
276 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
277 creating a static or dynamic library from the SWIG runtime code.
278 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
279
280 But only do this if strictly necessary, ie, if you have problems
281 with your compiler or suchlike.
282 */
283
284 #ifndef SWIGRUNTIME
285 # define SWIGRUNTIME SWIGINTERN
286 #endif
287
288 #ifndef SWIGRUNTIMEINLINE
289 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
290 #endif
291
292 /* Generic buffer size */
293 #ifndef SWIG_BUFFER_SIZE
294 # define SWIG_BUFFER_SIZE 1024
295 #endif
296
297 /* Flags for pointer conversions */
298 #define SWIG_POINTER_DISOWN 0x1
299 #define SWIG_CAST_NEW_MEMORY 0x2
300
301 /* Flags for new pointer objects */
302 #define SWIG_POINTER_OWN 0x1
303
304
305 /*
306 Flags/methods for returning states.
307
308 The SWIG conversion methods, as ConvertPtr, return and integer
309 that tells if the conversion was successful or not. And if not,
310 an error code can be returned (see swigerrors.swg for the codes).
311
312 Use the following macros/flags to set or process the returning
313 states.
314
315 In old versions of SWIG, code such as the following was usually written:
316
317 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
318 // success code
319 } else {
320 //fail code
321 }
322
323 Now you can be more explicit:
324
325 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
326 if (SWIG_IsOK(res)) {
327 // success code
328 } else {
329 // fail code
330 }
331
332 which is the same really, but now you can also do
333
334 Type *ptr;
335 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
336 if (SWIG_IsOK(res)) {
337 // success code
338 if (SWIG_IsNewObj(res) {
339 ...
340 delete *ptr;
341 } else {
342 ...
343 }
344 } else {
345 // fail code
346 }
347
348 I.e., now SWIG_ConvertPtr can return new objects and you can
349 identify the case and take care of the deallocation. Of course that
350 also requires SWIG_ConvertPtr to return new result values, such as
351
352 int SWIG_ConvertPtr(obj, ptr,...) {
353 if (<obj is ok>) {
354 if (<need new object>) {
355 *ptr = <ptr to new allocated object>;
356 return SWIG_NEWOBJ;
357 } else {
358 *ptr = <ptr to old object>;
359 return SWIG_OLDOBJ;
360 }
361 } else {
362 return SWIG_BADOBJ;
363 }
364 }
365
366 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
367 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
368 SWIG errors code.
369
370 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
371 allows to return the 'cast rank', for example, if you have this
372
373 int food(double)
374 int fooi(int);
375
376 and you call
377
378 food(1) // cast rank '1' (1 -> 1.0)
379 fooi(1) // cast rank '0'
380
381 just use the SWIG_AddCast()/SWIG_CheckState()
382 */
383
384 #define SWIG_OK (0)
385 #define SWIG_ERROR (-1)
386 #define SWIG_IsOK(r) (r >= 0)
387 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
388
389 /* The CastRankLimit says how many bits are used for the cast rank */
390 #define SWIG_CASTRANKLIMIT (1 << 8)
391 /* The NewMask denotes the object was created (using new/malloc) */
392 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
393 /* The TmpMask is for in/out typemaps that use temporal objects */
394 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
395 /* Simple returning values */
396 #define SWIG_BADOBJ (SWIG_ERROR)
397 #define SWIG_OLDOBJ (SWIG_OK)
398 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
399 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
400 /* Check, add and del mask methods */
401 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
402 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
403 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
404 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
405 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
406 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
407
408 /* Cast-Rank Mode */
409 #if defined(SWIG_CASTRANK_MODE)
410 # ifndef SWIG_TypeRank
411 # define SWIG_TypeRank unsigned long
412 # endif
413 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
414 # define SWIG_MAXCASTRANK (2)
415 # endif
416 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
417 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIG_AddCast(int r)418 SWIGINTERNINLINE int SWIG_AddCast(int r) {
419 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
420 }
SWIG_CheckState(int r)421 SWIGINTERNINLINE int SWIG_CheckState(int r) {
422 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
423 }
424 #else /* no cast-rank mode */
425 # define SWIG_AddCast
426 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
427 #endif
428
429
430 #include <string.h>
431
432 #ifdef __cplusplus
433 extern "C" {
434 #endif
435
436 typedef void *(*swig_converter_func)(void *, int *);
437 typedef struct swig_type_info *(*swig_dycast_func)(void **);
438
439 /* Structure to store information on one type */
440 typedef struct swig_type_info {
441 const char *name; /* mangled name of this type */
442 const char *str; /* human readable name of this type */
443 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
444 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
445 void *clientdata; /* language specific type data */
446 int owndata; /* flag if the structure owns the clientdata */
447 } swig_type_info;
448
449 /* Structure to store a type and conversion function used for casting */
450 typedef struct swig_cast_info {
451 swig_type_info *type; /* pointer to type that is equivalent to this type */
452 swig_converter_func converter; /* function to cast the void pointers */
453 struct swig_cast_info *next; /* pointer to next cast in linked list */
454 struct swig_cast_info *prev; /* pointer to the previous cast */
455 } swig_cast_info;
456
457 /* Structure used to store module information
458 * Each module generates one structure like this, and the runtime collects
459 * all of these structures and stores them in a circularly linked list.*/
460 typedef struct swig_module_info {
461 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
462 size_t size; /* Number of types in this module */
463 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
464 swig_type_info **type_initial; /* Array of initially generated type structures */
465 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
466 void *clientdata; /* Language specific module data */
467 } swig_module_info;
468
469 /*
470 Compare two type names skipping the space characters, therefore
471 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
472
473 Return 0 when the two name types are equivalent, as in
474 strncmp, but skipping ' '.
475 */
476 SWIGRUNTIME int
SWIG_TypeNameComp(const char * f1,const char * l1,const char * f2,const char * l2)477 SWIG_TypeNameComp(const char *f1, const char *l1,
478 const char *f2, const char *l2) {
479 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
480 while ((*f1 == ' ') && (f1 != l1)) ++f1;
481 while ((*f2 == ' ') && (f2 != l2)) ++f2;
482 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
483 }
484 return (int)((l1 - f1) - (l2 - f2));
485 }
486
487 /*
488 Check type equivalence in a name list like <name1>|<name2>|...
489 Return 0 if not equal, 1 if equal
490 */
491 SWIGRUNTIME int
SWIG_TypeEquiv(const char * nb,const char * tb)492 SWIG_TypeEquiv(const char *nb, const char *tb) {
493 int equiv = 0;
494 const char* te = tb + strlen(tb);
495 const char* ne = nb;
496 while (!equiv && *ne) {
497 for (nb = ne; *ne; ++ne) {
498 if (*ne == '|') break;
499 }
500 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
501 if (*ne) ++ne;
502 }
503 return equiv;
504 }
505
506 /*
507 Check type equivalence in a name list like <name1>|<name2>|...
508 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
509 */
510 SWIGRUNTIME int
SWIG_TypeCompare(const char * nb,const char * tb)511 SWIG_TypeCompare(const char *nb, const char *tb) {
512 int equiv = 0;
513 const char* te = tb + strlen(tb);
514 const char* ne = nb;
515 while (!equiv && *ne) {
516 for (nb = ne; *ne; ++ne) {
517 if (*ne == '|') break;
518 }
519 equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
520 if (*ne) ++ne;
521 }
522 return equiv;
523 }
524
525
526 /*
527 Check the typename
528 */
529 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char * c,swig_type_info * ty)530 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
531 if (ty) {
532 swig_cast_info *iter = ty->cast;
533 while (iter) {
534 if (strcmp(iter->type->name, c) == 0) {
535 if (iter == ty->cast)
536 return iter;
537 /* Move iter to the top of the linked list */
538 iter->prev->next = iter->next;
539 if (iter->next)
540 iter->next->prev = iter->prev;
541 iter->next = ty->cast;
542 iter->prev = 0;
543 if (ty->cast) ty->cast->prev = iter;
544 ty->cast = iter;
545 return iter;
546 }
547 iter = iter->next;
548 }
549 }
550 return 0;
551 }
552
553 /*
554 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
555 */
556 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info * from,swig_type_info * ty)557 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
558 if (ty) {
559 swig_cast_info *iter = ty->cast;
560 while (iter) {
561 if (iter->type == from) {
562 if (iter == ty->cast)
563 return iter;
564 /* Move iter to the top of the linked list */
565 iter->prev->next = iter->next;
566 if (iter->next)
567 iter->next->prev = iter->prev;
568 iter->next = ty->cast;
569 iter->prev = 0;
570 if (ty->cast) ty->cast->prev = iter;
571 ty->cast = iter;
572 return iter;
573 }
574 iter = iter->next;
575 }
576 }
577 return 0;
578 }
579
580 /*
581 Cast a pointer up an inheritance hierarchy
582 */
583 SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info * ty,void * ptr,int * newmemory)584 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
585 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
586 }
587
588 /*
589 Dynamic pointer casting. Down an inheritance hierarchy
590 */
591 SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info * ty,void ** ptr)592 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
593 swig_type_info *lastty = ty;
594 if (!ty || !ty->dcast) return ty;
595 while (ty && (ty->dcast)) {
596 ty = (*ty->dcast)(ptr);
597 if (ty) lastty = ty;
598 }
599 return lastty;
600 }
601
602 /*
603 Return the name associated with this type
604 */
605 SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info * ty)606 SWIG_TypeName(const swig_type_info *ty) {
607 return ty->name;
608 }
609
610 /*
611 Return the pretty name associated with this type,
612 that is an unmangled type name in a form presentable to the user.
613 */
614 SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info * type)615 SWIG_TypePrettyName(const swig_type_info *type) {
616 /* The "str" field contains the equivalent pretty names of the
617 type, separated by vertical-bar characters. We choose
618 to print the last name, as it is often (?) the most
619 specific. */
620 if (!type) return NULL;
621 if (type->str != NULL) {
622 const char *last_name = type->str;
623 const char *s;
624 for (s = type->str; *s; s++)
625 if (*s == '|') last_name = s+1;
626 return last_name;
627 }
628 else
629 return type->name;
630 }
631
632 /*
633 Set the clientdata field for a type
634 */
635 SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info * ti,void * clientdata)636 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
637 swig_cast_info *cast = ti->cast;
638 /* if (ti->clientdata == clientdata) return; */
639 ti->clientdata = clientdata;
640
641 while (cast) {
642 if (!cast->converter) {
643 swig_type_info *tc = cast->type;
644 if (!tc->clientdata) {
645 SWIG_TypeClientData(tc, clientdata);
646 }
647 }
648 cast = cast->next;
649 }
650 }
651 SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info * ti,void * clientdata)652 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
653 SWIG_TypeClientData(ti, clientdata);
654 ti->owndata = 1;
655 }
656
657 /*
658 Search for a swig_type_info structure only by mangled name
659 Search is a O(log #types)
660
661 We start searching at module start, and finish searching when start == end.
662 Note: if start == end at the beginning of the function, we go all the way around
663 the circular list.
664 */
665 SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)666 SWIG_MangledTypeQueryModule(swig_module_info *start,
667 swig_module_info *end,
668 const char *name) {
669 swig_module_info *iter = start;
670 do {
671 if (iter->size) {
672 register size_t l = 0;
673 register size_t r = iter->size - 1;
674 do {
675 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
676 register size_t i = (l + r) >> 1;
677 const char *iname = iter->types[i]->name;
678 if (iname) {
679 register int compare = strcmp(name, iname);
680 if (compare == 0) {
681 return iter->types[i];
682 } else if (compare < 0) {
683 if (i) {
684 r = i - 1;
685 } else {
686 break;
687 }
688 } else if (compare > 0) {
689 l = i + 1;
690 }
691 } else {
692 break; /* should never happen */
693 }
694 } while (l <= r);
695 }
696 iter = iter->next;
697 } while (iter != end);
698 return 0;
699 }
700
701 /*
702 Search for a swig_type_info structure for either a mangled name or a human readable name.
703 It first searches the mangled names of the types, which is a O(log #types)
704 If a type is not found it then searches the human readable names, which is O(#types).
705
706 We start searching at module start, and finish searching when start == end.
707 Note: if start == end at the beginning of the function, we go all the way around
708 the circular list.
709 */
710 SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)711 SWIG_TypeQueryModule(swig_module_info *start,
712 swig_module_info *end,
713 const char *name) {
714 /* STEP 1: Search the name field using binary search */
715 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
716 if (ret) {
717 return ret;
718 } else {
719 /* STEP 2: If the type hasn't been found, do a complete search
720 of the str field (the human readable name) */
721 swig_module_info *iter = start;
722 do {
723 register size_t i = 0;
724 for (; i < iter->size; ++i) {
725 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
726 return iter->types[i];
727 }
728 iter = iter->next;
729 } while (iter != end);
730 }
731
732 /* neither found a match */
733 return 0;
734 }
735
736 /*
737 Pack binary data into a string
738 */
739 SWIGRUNTIME char *
SWIG_PackData(char * c,void * ptr,size_t sz)740 SWIG_PackData(char *c, void *ptr, size_t sz) {
741 static const char hex[17] = "0123456789abcdef";
742 register const unsigned char *u = (unsigned char *) ptr;
743 register const unsigned char *eu = u + sz;
744 for (; u != eu; ++u) {
745 register unsigned char uu = *u;
746 *(c++) = hex[(uu & 0xf0) >> 4];
747 *(c++) = hex[uu & 0xf];
748 }
749 return c;
750 }
751
752 /*
753 Unpack binary data from a string
754 */
755 SWIGRUNTIME const char *
SWIG_UnpackData(const char * c,void * ptr,size_t sz)756 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
757 register unsigned char *u = (unsigned char *) ptr;
758 register const unsigned char *eu = u + sz;
759 for (; u != eu; ++u) {
760 register char d = *(c++);
761 register unsigned char uu;
762 if ((d >= '0') && (d <= '9'))
763 uu = ((d - '0') << 4);
764 else if ((d >= 'a') && (d <= 'f'))
765 uu = ((d - ('a'-10)) << 4);
766 else
767 return (char *) 0;
768 d = *(c++);
769 if ((d >= '0') && (d <= '9'))
770 uu |= (d - '0');
771 else if ((d >= 'a') && (d <= 'f'))
772 uu |= (d - ('a'-10));
773 else
774 return (char *) 0;
775 *u = uu;
776 }
777 return c;
778 }
779
780 /*
781 Pack 'void *' into a string buffer.
782 */
783 SWIGRUNTIME char *
SWIG_PackVoidPtr(char * buff,void * ptr,const char * name,size_t bsz)784 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
785 char *r = buff;
786 if ((2*sizeof(void *) + 2) > bsz) return 0;
787 *(r++) = '_';
788 r = SWIG_PackData(r,&ptr,sizeof(void *));
789 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
790 strcpy(r,name);
791 return buff;
792 }
793
794 SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char * c,void ** ptr,const char * name)795 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
796 if (*c != '_') {
797 if (strcmp(c,"NULL") == 0) {
798 *ptr = (void *) 0;
799 return name;
800 } else {
801 return 0;
802 }
803 }
804 return SWIG_UnpackData(++c,ptr,sizeof(void *));
805 }
806
807 SWIGRUNTIME char *
SWIG_PackDataName(char * buff,void * ptr,size_t sz,const char * name,size_t bsz)808 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
809 char *r = buff;
810 size_t lname = (name ? strlen(name) : 0);
811 if ((2*sz + 2 + lname) > bsz) return 0;
812 *(r++) = '_';
813 r = SWIG_PackData(r,ptr,sz);
814 if (lname) {
815 strncpy(r,name,lname+1);
816 } else {
817 *r = 0;
818 }
819 return buff;
820 }
821
822 SWIGRUNTIME const char *
SWIG_UnpackDataName(const char * c,void * ptr,size_t sz,const char * name)823 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
824 if (*c != '_') {
825 if (strcmp(c,"NULL") == 0) {
826 memset(ptr,0,sz);
827 return name;
828 } else {
829 return 0;
830 }
831 }
832 return SWIG_UnpackData(++c,ptr,sz);
833 }
834
835 #ifdef __cplusplus
836 }
837 #endif
838
839 /* Errors in SWIG */
840 #define SWIG_UnknownError -1
841 #define SWIG_IOError -2
842 #define SWIG_RuntimeError -3
843 #define SWIG_IndexError -4
844 #define SWIG_TypeError -5
845 #define SWIG_DivisionByZero -6
846 #define SWIG_OverflowError -7
847 #define SWIG_SyntaxError -8
848 #define SWIG_ValueError -9
849 #define SWIG_SystemError -10
850 #define SWIG_AttributeError -11
851 #define SWIG_MemoryError -12
852 #define SWIG_NullReferenceError -13
853
854
855
856 #include <ruby.h>
857
858 /* Remove global macros defined in Ruby's win32.h */
859 #ifdef write
860 # undef write
861 #endif
862 #ifdef read
863 # undef read
864 #endif
865 #ifdef bind
866 # undef bind
867 #endif
868 #ifdef close
869 # undef close
870 #endif
871 #ifdef connect
872 # undef connect
873 #endif
874
875
876 /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
877 #ifndef NUM2LL
878 #define NUM2LL(x) NUM2LONG((x))
879 #endif
880 #ifndef LL2NUM
881 #define LL2NUM(x) INT2NUM((long) (x))
882 #endif
883 #ifndef ULL2NUM
884 #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
885 #endif
886
887 /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
888 #ifndef NUM2ULL
889 #ifdef HAVE_LONG_LONG
890 #define NUM2ULL(x) rb_num2ull((x))
891 #else
892 #define NUM2ULL(x) NUM2ULONG(x)
893 #endif
894 #endif
895
896 /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
897 /* Define these for older versions so we can just write code the new way */
898 #ifndef RSTRING_LEN
899 # define RSTRING_LEN(x) RSTRING(x)->len
900 #endif
901 #ifndef RSTRING_PTR
902 # define RSTRING_PTR(x) RSTRING(x)->ptr
903 #endif
904 #ifndef RSTRING_END
905 # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
906 #endif
907 #ifndef RARRAY_LEN
908 # define RARRAY_LEN(x) RARRAY(x)->len
909 #endif
910 #ifndef RARRAY_PTR
911 # define RARRAY_PTR(x) RARRAY(x)->ptr
912 #endif
913 #ifndef RFLOAT_VALUE
914 # define RFLOAT_VALUE(x) RFLOAT(x)->value
915 #endif
916 #ifndef DOUBLE2NUM
917 # define DOUBLE2NUM(x) rb_float_new(x)
918 #endif
919 #ifndef RHASH_TBL
920 # define RHASH_TBL(x) (RHASH(x)->tbl)
921 #endif
922 #ifndef RHASH_ITER_LEV
923 # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
924 #endif
925 #ifndef RHASH_IFNONE
926 # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
927 #endif
928 #ifndef RHASH_SIZE
929 # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
930 #endif
931 #ifndef RHASH_EMPTY_P
932 # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
933 #endif
934 #ifndef RSTRUCT_LEN
935 # define RSTRUCT_LEN(x) RSTRUCT(x)->len
936 #endif
937 #ifndef RSTRUCT_PTR
938 # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
939 #endif
940
941
942
943 /*
944 * Need to be very careful about how these macros are defined, especially
945 * when compiling C++ code or C code with an ANSI C compiler.
946 *
947 * VALUEFUNC(f) is a macro used to typecast a C function that implements
948 * a Ruby method so that it can be passed as an argument to API functions
949 * like rb_define_method() and rb_define_singleton_method().
950 *
951 * VOIDFUNC(f) is a macro used to typecast a C function that implements
952 * either the "mark" or "free" stuff for a Ruby Data object, so that it
953 * can be passed as an argument to API functions like Data_Wrap_Struct()
954 * and Data_Make_Struct().
955 */
956
957 #ifdef __cplusplus
958 # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
959 # define PROTECTFUNC(f) ((VALUE (*)()) f)
960 # define VALUEFUNC(f) ((VALUE (*)()) f)
961 # define VOIDFUNC(f) ((void (*)()) f)
962 # else
963 # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
964 # define PROTECTFUNC(f) ((VALUE (*)()) f)
965 # define VALUEFUNC(f) ((VALUE (*)()) f)
966 # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
967 # else /* These definitions should work for Ruby 1.7+ */
968 # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
969 # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
970 # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
971 # endif
972 # endif
973 #else
974 # define VALUEFUNC(f) (f)
975 # define VOIDFUNC(f) (f)
976 #endif
977
978 /* Don't use for expressions have side effect */
979 #ifndef RB_STRING_VALUE
980 #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
981 #endif
982 #ifndef StringValue
983 #define StringValue(s) RB_STRING_VALUE(s)
984 #endif
985 #ifndef StringValuePtr
986 #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
987 #endif
988 #ifndef StringValueLen
989 #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
990 #endif
991 #ifndef SafeStringValue
992 #define SafeStringValue(v) do {\
993 StringValue(v);\
994 rb_check_safe_str(v);\
995 } while (0)
996 #endif
997
998 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
999 #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
1000 #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
1001 #endif
1002
1003 static VALUE _mSWIG = Qnil;
1004
1005 /* -----------------------------------------------------------------------------
1006 * error manipulation
1007 * ----------------------------------------------------------------------------- */
1008
1009
1010 /* Define some additional error types */
1011 #define SWIG_ObjectPreviouslyDeletedError -100
1012
1013
1014 /* Define custom exceptions for errors that do not map to existing Ruby
1015 exceptions. Note this only works for C++ since a global cannot be
1016 initialized by a funtion in C. For C, fallback to rb_eRuntimeError.*/
1017
1018 SWIGINTERN VALUE
getNullReferenceError(void)1019 getNullReferenceError(void) {
1020 static int init = 0;
1021 static VALUE rb_eNullReferenceError ;
1022 if (!init) {
1023 init = 1;
1024 rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
1025 }
1026 return rb_eNullReferenceError;
1027 }
1028
1029 SWIGINTERN VALUE
getObjectPreviouslyDeletedError(void)1030 getObjectPreviouslyDeletedError(void) {
1031 static int init = 0;
1032 static VALUE rb_eObjectPreviouslyDeleted ;
1033 if (!init) {
1034 init = 1;
1035 rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
1036 }
1037 return rb_eObjectPreviouslyDeleted;
1038 }
1039
1040
1041 SWIGINTERN VALUE
SWIG_Ruby_ErrorType(int SWIG_code)1042 SWIG_Ruby_ErrorType(int SWIG_code) {
1043 VALUE type;
1044 switch (SWIG_code) {
1045 case SWIG_MemoryError:
1046 type = rb_eNoMemError;
1047 break;
1048 case SWIG_IOError:
1049 type = rb_eIOError;
1050 break;
1051 case SWIG_RuntimeError:
1052 type = rb_eRuntimeError;
1053 break;
1054 case SWIG_IndexError:
1055 type = rb_eIndexError;
1056 break;
1057 case SWIG_TypeError:
1058 type = rb_eTypeError;
1059 break;
1060 case SWIG_DivisionByZero:
1061 type = rb_eZeroDivError;
1062 break;
1063 case SWIG_OverflowError:
1064 type = rb_eRangeError;
1065 break;
1066 case SWIG_SyntaxError:
1067 type = rb_eSyntaxError;
1068 break;
1069 case SWIG_ValueError:
1070 type = rb_eArgError;
1071 break;
1072 case SWIG_SystemError:
1073 type = rb_eFatal;
1074 break;
1075 case SWIG_AttributeError:
1076 type = rb_eRuntimeError;
1077 break;
1078 case SWIG_NullReferenceError:
1079 type = getNullReferenceError();
1080 break;
1081 case SWIG_ObjectPreviouslyDeletedError:
1082 type = getObjectPreviouslyDeletedError();
1083 break;
1084 case SWIG_UnknownError:
1085 type = rb_eRuntimeError;
1086 break;
1087 default:
1088 type = rb_eRuntimeError;
1089 }
1090 return type;
1091 }
1092
1093
1094 /* This function is called when a user inputs a wrong argument to
1095 a method.
1096 */
1097 SWIGINTERN
Ruby_Format_TypeError(const char * msg,const char * type,const char * name,const int argn,VALUE input)1098 const char* Ruby_Format_TypeError( const char* msg,
1099 const char* type,
1100 const char* name,
1101 const int argn,
1102 VALUE input )
1103 {
1104 char buf[128];
1105 VALUE str;
1106 VALUE asStr;
1107 if ( msg && *msg )
1108 {
1109 str = rb_str_new2(msg);
1110 }
1111 else
1112 {
1113 str = rb_str_new(NULL, 0);
1114 }
1115
1116 str = rb_str_cat2( str, "Expected argument " );
1117 sprintf( buf, "%d of type ", argn-1 );
1118 str = rb_str_cat2( str, buf );
1119 str = rb_str_cat2( str, type );
1120 str = rb_str_cat2( str, ", but got " );
1121 str = rb_str_cat2( str, rb_obj_classname(input) );
1122 str = rb_str_cat2( str, " " );
1123 asStr = rb_inspect(input);
1124 if ( RSTRING_LEN(asStr) > 30 )
1125 {
1126 str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1127 str = rb_str_cat2( str, "..." );
1128 }
1129 else
1130 {
1131 str = rb_str_append( str, asStr );
1132 }
1133
1134 if ( name )
1135 {
1136 str = rb_str_cat2( str, "\n\tin SWIG method '" );
1137 str = rb_str_cat2( str, name );
1138 str = rb_str_cat2( str, "'" );
1139 }
1140
1141 return StringValuePtr( str );
1142 }
1143
1144 /* This function is called when an overloaded method fails */
1145 SWIGINTERN
Ruby_Format_OverloadedError(const int argc,const int maxargs,const char * method,const char * prototypes)1146 void Ruby_Format_OverloadedError(
1147 const int argc,
1148 const int maxargs,
1149 const char* method,
1150 const char* prototypes
1151 )
1152 {
1153 const char* msg = "Wrong # of arguments";
1154 if ( argc <= maxargs ) msg = "Wrong arguments";
1155 rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1156 "Possible C/C++ prototypes are:\n%s",
1157 msg, method, prototypes);
1158 }
1159
1160 /* -----------------------------------------------------------------------------
1161 * See the LICENSE file for information on copyright, usage and redistribution
1162 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1163 *
1164 * rubytracking.swg
1165 *
1166 * This file contains support for tracking mappings from
1167 * Ruby objects to C++ objects. This functionality is needed
1168 * to implement mark functions for Ruby's mark and sweep
1169 * garbage collector.
1170 * ----------------------------------------------------------------------------- */
1171
1172 #ifdef __cplusplus
1173 extern "C" {
1174 #endif
1175
1176 /* Ruby 1.8 actually assumes the first case. */
1177 #if SIZEOF_VOIDP == SIZEOF_LONG
1178 # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1179 # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1180 #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1181 # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1182 # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1183 #else
1184 # error sizeof(void*) is not the same as long or long long
1185 #endif
1186
1187
1188 /* Global Ruby hash table to store Trackings from C/C++
1189 structs to Ruby Objects.
1190 */
1191 static VALUE swig_ruby_trackings = Qnil;
1192
1193 /* Global variable that stores a reference to the ruby
1194 hash table delete function. */
1195 static ID swig_ruby_hash_delete;
1196
1197 /* Setup a Ruby hash table to store Trackings */
SWIG_RubyInitializeTrackings(void)1198 SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1199 /* Create a ruby hash table to store Trackings from C++
1200 objects to Ruby objects. */
1201
1202 /* Try to see if some other .so has already created a
1203 tracking hash table, which we keep hidden in an instance var
1204 in the SWIG module.
1205 This is done to allow multiple DSOs to share the same
1206 tracking table.
1207 */
1208 ID trackings_id = rb_intern( "@__trackings__" );
1209 VALUE verbose = rb_gv_get("VERBOSE");
1210 rb_gv_set("VERBOSE", Qfalse);
1211 swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1212 rb_gv_set("VERBOSE", verbose);
1213
1214 /* No, it hasn't. Create one ourselves */
1215 if ( swig_ruby_trackings == Qnil )
1216 {
1217 swig_ruby_trackings = rb_hash_new();
1218 rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1219 }
1220
1221 /* Now store a reference to the hash table delete function
1222 so that we only have to look it up once.*/
1223 swig_ruby_hash_delete = rb_intern("delete");
1224 }
1225
1226 /* Get a Ruby number to reference a pointer */
SWIG_RubyPtrToReference(void * ptr)1227 SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1228 /* We cast the pointer to an unsigned long
1229 and then store a reference to it using
1230 a Ruby number object. */
1231
1232 /* Convert the pointer to a Ruby number */
1233 return SWIG2NUM(ptr);
1234 }
1235
1236 /* Get a Ruby number to reference an object */
SWIG_RubyObjectToReference(VALUE object)1237 SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1238 /* We cast the object to an unsigned long
1239 and then store a reference to it using
1240 a Ruby number object. */
1241
1242 /* Convert the Object to a Ruby number */
1243 return SWIG2NUM(object);
1244 }
1245
1246 /* Get a Ruby object from a previously stored reference */
SWIG_RubyReferenceToObject(VALUE reference)1247 SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1248 /* The provided Ruby number object is a reference
1249 to the Ruby object we want.*/
1250
1251 /* Convert the Ruby number to a Ruby object */
1252 return NUM2SWIG(reference);
1253 }
1254
1255 /* Add a Tracking from a C/C++ struct to a Ruby object */
SWIG_RubyAddTracking(void * ptr,VALUE object)1256 SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1257 /* In a Ruby hash table we store the pointer and
1258 the associated Ruby object. The trick here is
1259 that we cannot store the Ruby object directly - if
1260 we do then it cannot be garbage collected. So
1261 instead we typecast it as a unsigned long and
1262 convert it to a Ruby number object.*/
1263
1264 /* Get a reference to the pointer as a Ruby number */
1265 VALUE key = SWIG_RubyPtrToReference(ptr);
1266
1267 /* Get a reference to the Ruby object as a Ruby number */
1268 VALUE value = SWIG_RubyObjectToReference(object);
1269
1270 /* Store the mapping to the global hash table. */
1271 rb_hash_aset(swig_ruby_trackings, key, value);
1272 }
1273
1274 /* Get the Ruby object that owns the specified C/C++ struct */
SWIG_RubyInstanceFor(void * ptr)1275 SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1276 /* Get a reference to the pointer as a Ruby number */
1277 VALUE key = SWIG_RubyPtrToReference(ptr);
1278
1279 /* Now lookup the value stored in the global hash table */
1280 VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1281
1282 if (value == Qnil) {
1283 /* No object exists - return nil. */
1284 return Qnil;
1285 }
1286 else {
1287 /* Convert this value to Ruby object */
1288 return SWIG_RubyReferenceToObject(value);
1289 }
1290 }
1291
1292 /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1293 is very important to remove objects once they are destroyed
1294 since the same memory address may be reused later to create
1295 a new object. */
SWIG_RubyRemoveTracking(void * ptr)1296 SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1297 /* Get a reference to the pointer as a Ruby number */
1298 VALUE key = SWIG_RubyPtrToReference(ptr);
1299
1300 /* Delete the object from the hash table by calling Ruby's
1301 do this we need to call the Hash.delete method.*/
1302 rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1303 }
1304
1305 /* This is a helper method that unlinks a Ruby object from its
1306 underlying C++ object. This is needed if the lifetime of the
1307 Ruby object is longer than the C++ object */
SWIG_RubyUnlinkObjects(void * ptr)1308 SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1309 VALUE object = SWIG_RubyInstanceFor(ptr);
1310
1311 if (object != Qnil) {
1312 DATA_PTR(object) = 0;
1313 }
1314 }
1315
1316
1317 #ifdef __cplusplus
1318 }
1319 #endif
1320
1321 /* -----------------------------------------------------------------------------
1322 * Ruby API portion that goes into the runtime
1323 * ----------------------------------------------------------------------------- */
1324
1325 #ifdef __cplusplus
1326 extern "C" {
1327 #endif
1328
1329 SWIGINTERN VALUE
SWIG_Ruby_AppendOutput(VALUE target,VALUE o)1330 SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1331 if (NIL_P(target)) {
1332 target = o;
1333 } else {
1334 if (TYPE(target) != T_ARRAY) {
1335 VALUE o2 = target;
1336 target = rb_ary_new();
1337 rb_ary_push(target, o2);
1338 }
1339 rb_ary_push(target, o);
1340 }
1341 return target;
1342 }
1343
1344 /* For ruby1.8.4 and earlier. */
1345 #ifndef RUBY_INIT_STACK
1346 RUBY_EXTERN void Init_stack(VALUE* addr);
1347 # define RUBY_INIT_STACK \
1348 VALUE variable_in_this_stack_frame; \
1349 Init_stack(&variable_in_this_stack_frame);
1350 #endif
1351
1352
1353 #ifdef __cplusplus
1354 }
1355 #endif
1356
1357
1358 /* -----------------------------------------------------------------------------
1359 * See the LICENSE file for information on copyright, usage and redistribution
1360 * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1361 *
1362 * rubyrun.swg
1363 *
1364 * This file contains the runtime support for Ruby modules
1365 * and includes code for managing global variables and pointer
1366 * type checking.
1367 * ----------------------------------------------------------------------------- */
1368
1369 /* For backward compatibility only */
1370 #define SWIG_POINTER_EXCEPTION 0
1371
1372 /* for raw pointers */
1373 #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1374 #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1375 #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1376 #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1377 #define swig_owntype ruby_owntype
1378
1379 /* for raw packed data */
1380 #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1381 #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1382
1383 /* for class or struct pointers */
1384 #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1385 #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1386
1387 /* for C or C++ function pointers */
1388 #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1389 #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1390
1391 /* for C++ member pointers, ie, member methods */
1392 #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1393 #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1394
1395
1396 /* Runtime API */
1397
1398 #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
1399 #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1400
1401
1402 /* Error manipulation */
1403
1404 #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1405 #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg)
1406 #define SWIG_fail goto fail
1407
1408
1409 /* Ruby-specific SWIG API */
1410
1411 #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1412 #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1413 #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1414 #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1415 #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1416
1417 #include "assert.h"
1418
1419 /* -----------------------------------------------------------------------------
1420 * pointers/data manipulation
1421 * ----------------------------------------------------------------------------- */
1422
1423 #ifdef __cplusplus
1424 extern "C" {
1425 #endif
1426
1427 typedef struct {
1428 VALUE klass;
1429 VALUE mImpl;
1430 void (*mark)(void *);
1431 void (*destroy)(void *);
1432 int trackObjects;
1433 } swig_class;
1434
1435
1436 /* Global pointer used to keep some internal SWIG stuff */
1437 static VALUE _cSWIG_Pointer = Qnil;
1438 static VALUE swig_runtime_data_type_pointer = Qnil;
1439
1440 /* Global IDs used to keep some internal SWIG stuff */
1441 static ID swig_arity_id = 0;
1442 static ID swig_call_id = 0;
1443
1444 /*
1445 If your swig extension is to be run within an embedded ruby and has
1446 director callbacks, you should set -DRUBY_EMBEDDED during compilation.
1447 This will reset ruby's stack frame on each entry point from the main
1448 program the first time a virtual director function is invoked (in a
1449 non-recursive way).
1450 If this is not done, you run the risk of Ruby trashing the stack.
1451 */
1452
1453 #ifdef RUBY_EMBEDDED
1454
1455 # define SWIG_INIT_STACK \
1456 if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
1457 ++swig_virtual_calls;
1458 # define SWIG_RELEASE_STACK --swig_virtual_calls;
1459 # define Ruby_DirectorTypeMismatchException(x) \
1460 rb_raise( rb_eTypeError, x ); return c_result;
1461
1462 static unsigned int swig_virtual_calls = 0;
1463
1464 #else /* normal non-embedded extension */
1465
1466 # define SWIG_INIT_STACK
1467 # define SWIG_RELEASE_STACK
1468 # define Ruby_DirectorTypeMismatchException(x) \
1469 throw Swig::DirectorTypeMismatchException( x );
1470
1471 #endif /* RUBY_EMBEDDED */
1472
1473
1474 SWIGRUNTIME VALUE
getExceptionClass(void)1475 getExceptionClass(void) {
1476 static int init = 0;
1477 static VALUE rubyExceptionClass ;
1478 if (!init) {
1479 init = 1;
1480 rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1481 }
1482 return rubyExceptionClass;
1483 }
1484
1485 /* This code checks to see if the Ruby object being raised as part
1486 of an exception inherits from the Ruby class Exception. If so,
1487 the object is simply returned. If not, then a new Ruby exception
1488 object is created and that will be returned to Ruby.*/
1489 SWIGRUNTIME VALUE
SWIG_Ruby_ExceptionType(swig_type_info * desc,VALUE obj)1490 SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1491 VALUE exceptionClass = getExceptionClass();
1492 if (rb_obj_is_kind_of(obj, exceptionClass)) {
1493 return obj;
1494 } else {
1495 return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1496 }
1497 }
1498
1499 /* Initialize Ruby runtime support */
1500 SWIGRUNTIME void
SWIG_Ruby_InitRuntime(void)1501 SWIG_Ruby_InitRuntime(void)
1502 {
1503 if (_mSWIG == Qnil) {
1504 _mSWIG = rb_define_module("SWIG");
1505 swig_call_id = rb_intern("call");
1506 swig_arity_id = rb_intern("arity");
1507 }
1508 }
1509
1510 /* Define Ruby class for C type */
1511 SWIGRUNTIME void
SWIG_Ruby_define_class(swig_type_info * type)1512 SWIG_Ruby_define_class(swig_type_info *type)
1513 {
1514 VALUE klass;
1515 char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1516 sprintf(klass_name, "TYPE%s", type->name);
1517 if (NIL_P(_cSWIG_Pointer)) {
1518 _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1519 rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1520 }
1521 klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1522 free((void *) klass_name);
1523 }
1524
1525 /* Create a new pointer object */
1526 SWIGRUNTIME VALUE
SWIG_Ruby_NewPointerObj(void * ptr,swig_type_info * type,int flags)1527 SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1528 {
1529 int own = flags & SWIG_POINTER_OWN;
1530 int track;
1531 char *klass_name;
1532 swig_class *sklass;
1533 VALUE klass;
1534 VALUE obj;
1535
1536 if (!ptr)
1537 return Qnil;
1538
1539 if (type->clientdata) {
1540 sklass = (swig_class *) type->clientdata;
1541
1542 /* Are we tracking this class and have we already returned this Ruby object? */
1543 track = sklass->trackObjects;
1544 if (track) {
1545 obj = SWIG_RubyInstanceFor(ptr);
1546
1547 /* Check the object's type and make sure it has the correct type.
1548 It might not in cases where methods do things like
1549 downcast methods. */
1550 if (obj != Qnil) {
1551 VALUE value = rb_iv_get(obj, "@__swigtype__");
1552 char* type_name = RSTRING_PTR(value);
1553
1554 if (strcmp(type->name, type_name) == 0) {
1555 return obj;
1556 }
1557 }
1558 }
1559
1560 /* Create a new Ruby object */
1561 obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1562 ( own ? VOIDFUNC(sklass->destroy) :
1563 (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1564 ), ptr);
1565
1566 /* If tracking is on for this class then track this object. */
1567 if (track) {
1568 SWIG_RubyAddTracking(ptr, obj);
1569 }
1570 } else {
1571 klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1572 sprintf(klass_name, "TYPE%s", type->name);
1573 klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1574 free((void *) klass_name);
1575 obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1576 }
1577 rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1578
1579 return obj;
1580 }
1581
1582 /* Create a new class instance (always owned) */
1583 SWIGRUNTIME VALUE
SWIG_Ruby_NewClassInstance(VALUE klass,swig_type_info * type)1584 SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1585 {
1586 VALUE obj;
1587 swig_class *sklass = (swig_class *) type->clientdata;
1588 obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1589 rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1590 return obj;
1591 }
1592
1593 /* Get type mangle from class name */
1594 SWIGRUNTIMEINLINE char *
SWIG_Ruby_MangleStr(VALUE obj)1595 SWIG_Ruby_MangleStr(VALUE obj)
1596 {
1597 VALUE stype = rb_iv_get(obj, "@__swigtype__");
1598 return StringValuePtr(stype);
1599 }
1600
1601 /* Acquire a pointer value */
1602 typedef void (*ruby_owntype)(void*);
1603
1604 SWIGRUNTIME ruby_owntype
SWIG_Ruby_AcquirePtr(VALUE obj,ruby_owntype own)1605 SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1606 if (obj) {
1607 ruby_owntype oldown = RDATA(obj)->dfree;
1608 RDATA(obj)->dfree = own;
1609 return oldown;
1610 } else {
1611 return 0;
1612 }
1613 }
1614
1615 /* Convert a pointer value */
1616 SWIGRUNTIME int
SWIG_Ruby_ConvertPtrAndOwn(VALUE obj,void ** ptr,swig_type_info * ty,int flags,ruby_owntype * own)1617 SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1618 {
1619 char *c;
1620 swig_cast_info *tc;
1621 void *vptr = 0;
1622
1623 /* Grab the pointer */
1624 if (NIL_P(obj)) {
1625 *ptr = 0;
1626 return SWIG_OK;
1627 } else {
1628 if (TYPE(obj) != T_DATA) {
1629 return SWIG_ERROR;
1630 }
1631 Data_Get_Struct(obj, void, vptr);
1632 }
1633
1634 if (own) *own = RDATA(obj)->dfree;
1635
1636 /* Check to see if the input object is giving up ownership
1637 of the underlying C struct or C++ object. If so then we
1638 need to reset the destructor since the Ruby object no
1639 longer owns the underlying C++ object.*/
1640 if (flags & SWIG_POINTER_DISOWN) {
1641 /* Is tracking on for this class? */
1642 int track = 0;
1643 if (ty && ty->clientdata) {
1644 swig_class *sklass = (swig_class *) ty->clientdata;
1645 track = sklass->trackObjects;
1646 }
1647
1648 if (track) {
1649 /* We are tracking objects for this class. Thus we change the destructor
1650 * to SWIG_RubyRemoveTracking. This allows us to
1651 * remove the mapping from the C++ to Ruby object
1652 * when the Ruby object is garbage collected. If we don't
1653 * do this, then it is possible we will return a reference
1654 * to a Ruby object that no longer exists thereby crashing Ruby. */
1655 RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1656 } else {
1657 RDATA(obj)->dfree = 0;
1658 }
1659 }
1660
1661 /* Do type-checking if type info was provided */
1662 if (ty) {
1663 if (ty->clientdata) {
1664 if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1665 if (vptr == 0) {
1666 /* The object has already been deleted */
1667 return SWIG_ObjectPreviouslyDeletedError;
1668 }
1669 *ptr = vptr;
1670 return SWIG_OK;
1671 }
1672 }
1673 if ((c = SWIG_MangleStr(obj)) == NULL) {
1674 return SWIG_ERROR;
1675 }
1676 tc = SWIG_TypeCheck(c, ty);
1677 if (!tc) {
1678 return SWIG_ERROR;
1679 } else {
1680 int newmemory = 0;
1681 *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1682 assert(!newmemory); /* newmemory handling not yet implemented */
1683 }
1684 } else {
1685 *ptr = vptr;
1686 }
1687
1688 return SWIG_OK;
1689 }
1690
1691 /* Check convert */
1692 SWIGRUNTIMEINLINE int
SWIG_Ruby_CheckConvert(VALUE obj,swig_type_info * ty)1693 SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1694 {
1695 char *c = SWIG_MangleStr(obj);
1696 if (!c) return 0;
1697 return SWIG_TypeCheck(c,ty) != 0;
1698 }
1699
1700 SWIGRUNTIME VALUE
SWIG_Ruby_NewPackedObj(void * ptr,int sz,swig_type_info * type)1701 SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1702 char result[1024];
1703 char *r = result;
1704 if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1705 *(r++) = '_';
1706 r = SWIG_PackData(r, ptr, sz);
1707 strcpy(r, type->name);
1708 return rb_str_new2(result);
1709 }
1710
1711 /* Convert a packed value value */
1712 SWIGRUNTIME int
SWIG_Ruby_ConvertPacked(VALUE obj,void * ptr,int sz,swig_type_info * ty)1713 SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1714 swig_cast_info *tc;
1715 const char *c;
1716
1717 if (TYPE(obj) != T_STRING) goto type_error;
1718 c = StringValuePtr(obj);
1719 /* Pointer values must start with leading underscore */
1720 if (*c != '_') goto type_error;
1721 c++;
1722 c = SWIG_UnpackData(c, ptr, sz);
1723 if (ty) {
1724 tc = SWIG_TypeCheck(c, ty);
1725 if (!tc) goto type_error;
1726 }
1727 return SWIG_OK;
1728
1729 type_error:
1730 return SWIG_ERROR;
1731 }
1732
1733 SWIGRUNTIME swig_module_info *
SWIG_Ruby_GetModule(void)1734 SWIG_Ruby_GetModule(void)
1735 {
1736 VALUE pointer;
1737 swig_module_info *ret = 0;
1738 VALUE verbose = rb_gv_get("VERBOSE");
1739
1740 /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1741 rb_gv_set("VERBOSE", Qfalse);
1742
1743 /* first check if pointer already created */
1744 pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1745 if (pointer != Qnil) {
1746 Data_Get_Struct(pointer, swig_module_info, ret);
1747 }
1748
1749 /* reinstate warnings */
1750 rb_gv_set("VERBOSE", verbose);
1751 return ret;
1752 }
1753
1754 SWIGRUNTIME void
SWIG_Ruby_SetModule(swig_module_info * pointer)1755 SWIG_Ruby_SetModule(swig_module_info *pointer)
1756 {
1757 /* register a new class */
1758 VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1759 /* create and store the structure pointer to a global variable */
1760 swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1761 rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1762 }
1763
1764 /* This function can be used to check whether a proc or method or similarly
1765 callable function has been passed. Usually used in a %typecheck, like:
1766
1767 %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1768 $result = SWIG_Ruby_isCallable( $input );
1769 }
1770 */
1771 SWIGINTERN
SWIG_Ruby_isCallable(VALUE proc)1772 int SWIG_Ruby_isCallable( VALUE proc )
1773 {
1774 if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
1775 return 1;
1776 return 0;
1777 }
1778
1779 /* This function can be used to check the arity (number of arguments)
1780 a proc or method can take. Usually used in a %typecheck.
1781 Valid arities will be that equal to minimal or those < 0
1782 which indicate a variable number of parameters at the end.
1783 */
1784 SWIGINTERN
SWIG_Ruby_arity(VALUE proc,int minimal)1785 int SWIG_Ruby_arity( VALUE proc, int minimal )
1786 {
1787 if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
1788 {
1789 VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1790 int arity = NUM2INT(num);
1791 if ( arity < 0 && (arity+1) < -minimal ) return 1;
1792 if ( arity == minimal ) return 1;
1793 return 1;
1794 }
1795 return 0;
1796 }
1797
1798
1799 #ifdef __cplusplus
1800 }
1801 #endif
1802
1803
1804
1805 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1806
1807 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1808
1809
1810
1811 #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0)
1812
1813
1814 /* -------- TYPES TABLE (BEGIN) -------- */
1815
1816 #define SWIGTYPE_p_char swig_types[0]
1817 #define SWIGTYPE_p_marisa__Key swig_types[1]
1818 #define SWIGTYPE_p_marisa_swig__Agent swig_types[2]
1819 #define SWIGTYPE_p_marisa_swig__Key swig_types[3]
1820 #define SWIGTYPE_p_marisa_swig__Keyset swig_types[4]
1821 #define SWIGTYPE_p_marisa_swig__Query swig_types[5]
1822 #define SWIGTYPE_p_marisa_swig__Trie swig_types[6]
1823 #define SWIGTYPE_p_p_char swig_types[7]
1824 #define SWIGTYPE_p_std__size_t swig_types[8]
1825 static swig_type_info *swig_types[10];
1826 static swig_module_info swig_module = {swig_types, 9, 0, 0, 0, 0};
1827 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1828 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1829
1830 /* -------- TYPES TABLE (END) -------- */
1831
1832 #define SWIG_init Init_marisa
1833 #define SWIG_name "Marisa"
1834
1835 static VALUE mMarisa;
1836
1837 #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1838 #define SWIG_RUBY_THREAD_END_BLOCK
1839
1840
1841 #define SWIGVERSION 0x010340
1842 #define SWIG_VERSION SWIGVERSION
1843
1844
1845 #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
1846 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
1847
1848
1849 #include <stdexcept>
1850
1851
1852 #include "marisa-swig.h"
1853
1854
1855 #include <limits.h>
1856 #if !defined(SWIG_NO_LLONG_MAX)
1857 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1858 # define LLONG_MAX __LONG_LONG_MAX__
1859 # define LLONG_MIN (-LLONG_MAX - 1LL)
1860 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1861 # endif
1862 #endif
1863
1864
1865 #define SWIG_From_long LONG2NUM
1866
1867
1868 SWIGINTERNINLINE VALUE
SWIG_From_int(int value)1869 SWIG_From_int (int value)
1870 {
1871 return SWIG_From_long (value);
1872 }
1873
1874
1875 SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)1876 SWIG_pchar_descriptor(void)
1877 {
1878 static int init = 0;
1879 static swig_type_info* info = 0;
1880 if (!init) {
1881 info = SWIG_TypeQuery("_p_char");
1882 init = 1;
1883 }
1884 return info;
1885 }
1886
1887
1888 SWIGINTERNINLINE VALUE
SWIG_FromCharPtrAndSize(const char * carray,size_t size)1889 SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1890 {
1891 if (carray) {
1892 if (size > LONG_MAX) {
1893 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1894 return pchar_descriptor ?
1895 SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
1896 } else {
1897 return rb_str_new(carray, static_cast< long >(size));
1898 }
1899 } else {
1900 return Qnil;
1901 }
1902 }
1903
1904
1905 SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_long(unsigned long value)1906 SWIG_From_unsigned_SS_long (unsigned long value)
1907 {
1908 return ULONG2NUM(value);
1909 }
1910
1911
1912 SWIGINTERNINLINE VALUE
SWIG_From_size_t(size_t value)1913 SWIG_From_size_t (size_t value)
1914 {
1915 return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value));
1916 }
1917
1918
1919 #define SWIG_From_double rb_float_new
1920
1921
1922 SWIGINTERNINLINE VALUE
SWIG_From_float(float value)1923 SWIG_From_float (float value)
1924 {
1925 return SWIG_From_double (value);
1926 }
1927
1928
1929 SWIGINTERN int
SWIG_AsCharPtrAndSize(VALUE obj,char ** cptr,size_t * psize,int * alloc)1930 SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1931 {
1932 if (TYPE(obj) == T_STRING) {
1933 #if defined(StringValuePtr)
1934 char *cstr = StringValuePtr(obj);
1935 #else
1936 char *cstr = STR2CSTR(obj);
1937 #endif
1938 size_t size = RSTRING_LEN(obj) + 1;
1939 if (cptr) {
1940 if (alloc) {
1941 if (*alloc == SWIG_NEWOBJ) {
1942 *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
1943 } else {
1944 *cptr = cstr;
1945 *alloc = SWIG_OLDOBJ;
1946 }
1947 }
1948 }
1949 if (psize) *psize = size;
1950 return SWIG_OK;
1951 } else {
1952 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1953 if (pchar_descriptor) {
1954 void* vptr = 0;
1955 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
1956 if (cptr) *cptr = (char *)vptr;
1957 if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
1958 if (alloc) *alloc = SWIG_OLDOBJ;
1959 return SWIG_OK;
1960 }
1961 }
1962 }
1963 return SWIG_TypeError;
1964 }
1965
1966
1967 #include <float.h>
1968
1969
1970 SWIGINTERN VALUE
SWIG_ruby_failed(void)1971 SWIG_ruby_failed(void)
1972 {
1973 return Qnil;
1974 }
1975
1976
1977 /*@SWIG:/usr/share/swig1.3/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
SWIG_AUX_NUM2DBL(VALUE * args)1978 SWIGINTERN VALUE SWIG_AUX_NUM2DBL(VALUE *args)
1979 {
1980 VALUE obj = args[0];
1981 VALUE type = TYPE(obj);
1982 double *res = (double *)(args[1]);
1983 *res = NUM2DBL(obj);
1984 return obj;
1985 }
1986 /*@SWIG@*/
1987
1988 SWIGINTERN int
SWIG_AsVal_double(VALUE obj,double * val)1989 SWIG_AsVal_double (VALUE obj, double *val)
1990 {
1991 VALUE type = TYPE(obj);
1992 if ((type == T_FLOAT) || (type == T_FIXNUM) || (type == T_BIGNUM)) {
1993 double v;
1994 VALUE a[2];
1995 a[0] = obj;
1996 a[1] = (VALUE)(&v);
1997 if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2DBL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1998 if (val) *val = v;
1999 return SWIG_OK;
2000 }
2001 }
2002 return SWIG_TypeError;
2003 }
2004
2005
2006 SWIGINTERN int
SWIG_AsVal_float(VALUE obj,float * val)2007 SWIG_AsVal_float (VALUE obj, float *val)
2008 {
2009 double v;
2010 int res = SWIG_AsVal_double (obj, &v);
2011 if (SWIG_IsOK(res)) {
2012 if ((v < -FLT_MAX || v > FLT_MAX)) {
2013 return SWIG_OverflowError;
2014 } else {
2015 if (val) *val = static_cast< float >(v);
2016 }
2017 }
2018 return res;
2019 }
2020
2021
2022
2023
2024
2025 /*@SWIG:/usr/share/swig1.3/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
SWIG_AUX_NUM2ULONG(VALUE * args)2026 SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2027 {
2028 VALUE obj = args[0];
2029 VALUE type = TYPE(obj);
2030 unsigned long *res = (unsigned long *)(args[1]);
2031 *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
2032 return obj;
2033 }
2034 /*@SWIG@*/
2035
2036 SWIGINTERN int
SWIG_AsVal_unsigned_SS_long(VALUE obj,unsigned long * val)2037 SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
2038 {
2039 VALUE type = TYPE(obj);
2040 if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
2041 unsigned long v;
2042 VALUE a[2];
2043 a[0] = obj;
2044 a[1] = (VALUE)(&v);
2045 if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2046 if (val) *val = v;
2047 return SWIG_OK;
2048 }
2049 }
2050 return SWIG_TypeError;
2051 }
2052
2053
2054 SWIGINTERNINLINE int
SWIG_AsVal_size_t(VALUE obj,size_t * val)2055 SWIG_AsVal_size_t (VALUE obj, size_t *val)
2056 {
2057 unsigned long v;
2058 int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
2059 if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
2060 return res;
2061 }
2062
2063
2064 SWIGINTERNINLINE VALUE
SWIG_From_bool(bool value)2065 SWIG_From_bool (bool value)
2066 {
2067 return value ? Qtrue : Qfalse;
2068 }
2069
2070
2071 /*@SWIG:/usr/share/swig1.3/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
SWIG_AUX_NUM2LONG(VALUE * args)2072 SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2073 {
2074 VALUE obj = args[0];
2075 VALUE type = TYPE(obj);
2076 long *res = (long *)(args[1]);
2077 *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
2078 return obj;
2079 }
2080 /*@SWIG@*/
2081
2082 SWIGINTERN int
SWIG_AsVal_long(VALUE obj,long * val)2083 SWIG_AsVal_long (VALUE obj, long* val)
2084 {
2085 VALUE type = TYPE(obj);
2086 if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
2087 long v;
2088 VALUE a[2];
2089 a[0] = obj;
2090 a[1] = (VALUE)(&v);
2091 if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2092 if (val) *val = v;
2093 return SWIG_OK;
2094 }
2095 }
2096 return SWIG_TypeError;
2097 }
2098
2099
2100 SWIGINTERN int
SWIG_AsVal_int(VALUE obj,int * val)2101 SWIG_AsVal_int (VALUE obj, int *val)
2102 {
2103 long v;
2104 int res = SWIG_AsVal_long (obj, &v);
2105 if (SWIG_IsOK(res)) {
2106 if ((v < INT_MIN || v > INT_MAX)) {
2107 return SWIG_OverflowError;
2108 } else {
2109 if (val) *val = static_cast< int >(v);
2110 }
2111 }
2112 return res;
2113 }
2114
2115 swig_class SwigClassKey;
2116
2117 SWIGINTERN VALUE
_wrap_Key_str(int argc,VALUE * argv,VALUE self)2118 _wrap_Key_str(int argc, VALUE *argv, VALUE self) {
2119 marisa_swig::Key *arg1 = (marisa_swig::Key *) 0 ;
2120 char **arg2 = (char **) 0 ;
2121 std::size_t *arg3 = (std::size_t *) 0 ;
2122 void *argp1 = 0 ;
2123 int res1 = 0 ;
2124 char *temp2 = 0 ;
2125 std::size_t tempn2 ;
2126 VALUE vresult = Qnil;
2127
2128 arg2 = &temp2; arg3 = &tempn2;
2129 if ((argc < 0) || (argc > 0)) {
2130 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2131 }
2132 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Key, 0 | 0 );
2133 if (!SWIG_IsOK(res1)) {
2134 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Key const *","str", 1, self ));
2135 }
2136 arg1 = reinterpret_cast< marisa_swig::Key * >(argp1);
2137 {
2138 try {
2139 ((marisa_swig::Key const *)arg1)->str((char const **)arg2,arg3);
2140 } catch (const marisa::Exception &ex) {
2141 SWIG_exception(SWIG_RuntimeError, ex.what());
2142 } catch (...) {
2143 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2144 }
2145 }
2146 if (*arg2) {
2147 vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_FromCharPtrAndSize(*arg2,*arg3));
2148 ;
2149 }
2150 return vresult;
2151 fail:
2152 return Qnil;
2153 }
2154
2155
2156 SWIGINTERN VALUE
_wrap_Key_id(int argc,VALUE * argv,VALUE self)2157 _wrap_Key_id(int argc, VALUE *argv, VALUE self) {
2158 marisa_swig::Key *arg1 = (marisa_swig::Key *) 0 ;
2159 void *argp1 = 0 ;
2160 int res1 = 0 ;
2161 std::size_t result;
2162 VALUE vresult = Qnil;
2163
2164 if ((argc < 0) || (argc > 0)) {
2165 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2166 }
2167 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Key, 0 | 0 );
2168 if (!SWIG_IsOK(res1)) {
2169 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Key const *","id", 1, self ));
2170 }
2171 arg1 = reinterpret_cast< marisa_swig::Key * >(argp1);
2172 {
2173 try {
2174 result = ((marisa_swig::Key const *)arg1)->id();
2175 } catch (const marisa::Exception &ex) {
2176 SWIG_exception(SWIG_RuntimeError, ex.what());
2177 } catch (...) {
2178 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2179 }
2180 }
2181 vresult = SWIG_From_size_t(static_cast< size_t >(result));
2182 return vresult;
2183 fail:
2184 return Qnil;
2185 }
2186
2187
2188 SWIGINTERN VALUE
_wrap_Key_weight(int argc,VALUE * argv,VALUE self)2189 _wrap_Key_weight(int argc, VALUE *argv, VALUE self) {
2190 marisa_swig::Key *arg1 = (marisa_swig::Key *) 0 ;
2191 void *argp1 = 0 ;
2192 int res1 = 0 ;
2193 float result;
2194 VALUE vresult = Qnil;
2195
2196 if ((argc < 0) || (argc > 0)) {
2197 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2198 }
2199 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Key, 0 | 0 );
2200 if (!SWIG_IsOK(res1)) {
2201 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Key const *","weight", 1, self ));
2202 }
2203 arg1 = reinterpret_cast< marisa_swig::Key * >(argp1);
2204 {
2205 try {
2206 result = (float)((marisa_swig::Key const *)arg1)->weight();
2207 } catch (const marisa::Exception &ex) {
2208 SWIG_exception(SWIG_RuntimeError, ex.what());
2209 } catch (...) {
2210 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2211 }
2212 }
2213 vresult = SWIG_From_float(static_cast< float >(result));
2214 return vresult;
2215 fail:
2216 return Qnil;
2217 }
2218
2219
2220 SWIGINTERN void
free_marisa_swig_Key(marisa_swig::Key * arg1)2221 free_marisa_swig_Key(marisa_swig::Key *arg1) {
2222 delete arg1;
2223 }
2224
2225 swig_class SwigClassQuery;
2226
2227 SWIGINTERN VALUE
_wrap_Query_str(int argc,VALUE * argv,VALUE self)2228 _wrap_Query_str(int argc, VALUE *argv, VALUE self) {
2229 marisa_swig::Query *arg1 = (marisa_swig::Query *) 0 ;
2230 char **arg2 = (char **) 0 ;
2231 std::size_t *arg3 = (std::size_t *) 0 ;
2232 void *argp1 = 0 ;
2233 int res1 = 0 ;
2234 char *temp2 = 0 ;
2235 std::size_t tempn2 ;
2236 VALUE vresult = Qnil;
2237
2238 arg2 = &temp2; arg3 = &tempn2;
2239 if ((argc < 0) || (argc > 0)) {
2240 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2241 }
2242 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Query, 0 | 0 );
2243 if (!SWIG_IsOK(res1)) {
2244 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Query const *","str", 1, self ));
2245 }
2246 arg1 = reinterpret_cast< marisa_swig::Query * >(argp1);
2247 {
2248 try {
2249 ((marisa_swig::Query const *)arg1)->str((char const **)arg2,arg3);
2250 } catch (const marisa::Exception &ex) {
2251 SWIG_exception(SWIG_RuntimeError, ex.what());
2252 } catch (...) {
2253 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2254 }
2255 }
2256 if (*arg2) {
2257 vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_FromCharPtrAndSize(*arg2,*arg3));
2258 ;
2259 }
2260 return vresult;
2261 fail:
2262 return Qnil;
2263 }
2264
2265
2266 SWIGINTERN VALUE
_wrap_Query_id(int argc,VALUE * argv,VALUE self)2267 _wrap_Query_id(int argc, VALUE *argv, VALUE self) {
2268 marisa_swig::Query *arg1 = (marisa_swig::Query *) 0 ;
2269 void *argp1 = 0 ;
2270 int res1 = 0 ;
2271 std::size_t result;
2272 VALUE vresult = Qnil;
2273
2274 if ((argc < 0) || (argc > 0)) {
2275 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2276 }
2277 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Query, 0 | 0 );
2278 if (!SWIG_IsOK(res1)) {
2279 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Query const *","id", 1, self ));
2280 }
2281 arg1 = reinterpret_cast< marisa_swig::Query * >(argp1);
2282 {
2283 try {
2284 result = ((marisa_swig::Query const *)arg1)->id();
2285 } catch (const marisa::Exception &ex) {
2286 SWIG_exception(SWIG_RuntimeError, ex.what());
2287 } catch (...) {
2288 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2289 }
2290 }
2291 vresult = SWIG_From_size_t(static_cast< size_t >(result));
2292 return vresult;
2293 fail:
2294 return Qnil;
2295 }
2296
2297
2298 SWIGINTERN void
free_marisa_swig_Query(marisa_swig::Query * arg1)2299 free_marisa_swig_Query(marisa_swig::Query *arg1) {
2300 delete arg1;
2301 }
2302
2303 swig_class SwigClassKeyset;
2304
2305 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2306 SWIGINTERN VALUE
_wrap_Keyset_allocate(VALUE self)2307 _wrap_Keyset_allocate(VALUE self) {
2308 #else
2309 SWIGINTERN VALUE
2310 _wrap_Keyset_allocate(int argc, VALUE *argv, VALUE self) {
2311 #endif
2312
2313
2314 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_marisa_swig__Keyset);
2315 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2316 rb_obj_call_init(vresult, argc, argv);
2317 #endif
2318 return vresult;
2319 }
2320
2321
2322 SWIGINTERN VALUE
2323 _wrap_new_Keyset(int argc, VALUE *argv, VALUE self) {
2324 marisa_swig::Keyset *result = 0 ;
2325
2326 if ((argc < 0) || (argc > 0)) {
2327 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2328 }
2329 {
2330 try {
2331 result = (marisa_swig::Keyset *)new marisa_swig::Keyset();
2332 DATA_PTR(self) = result;
2333 } catch (const marisa::Exception &ex) {
2334 SWIG_exception(SWIG_RuntimeError, ex.what());
2335 } catch (...) {
2336 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2337 }
2338 }
2339 return self;
2340 fail:
2341 return Qnil;
2342 }
2343
2344
2345 SWIGINTERN void
2346 free_marisa_swig_Keyset(marisa_swig::Keyset *arg1) {
2347 delete arg1;
2348 }
2349
2350 SWIGINTERN VALUE
2351 _wrap_Keyset_push_back__SWIG_0(int argc, VALUE *argv, VALUE self) {
2352 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2353 marisa::Key *arg2 = 0 ;
2354 void *argp1 = 0 ;
2355 int res1 = 0 ;
2356 void *argp2 ;
2357 int res2 = 0 ;
2358
2359 if ((argc < 1) || (argc > 1)) {
2360 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2361 }
2362 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2363 if (!SWIG_IsOK(res1)) {
2364 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset *","push_back", 1, self ));
2365 }
2366 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2367 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_marisa__Key, 0 );
2368 if (!SWIG_IsOK(res2)) {
2369 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "marisa::Key const &","push_back", 2, argv[0] ));
2370 }
2371 if (!argp2) {
2372 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "marisa::Key const &","push_back", 2, argv[0]));
2373 }
2374 arg2 = reinterpret_cast< marisa::Key * >(argp2);
2375 {
2376 try {
2377 (arg1)->push_back((marisa::Key const &)*arg2);
2378 } catch (const marisa::Exception &ex) {
2379 SWIG_exception(SWIG_RuntimeError, ex.what());
2380 } catch (...) {
2381 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2382 }
2383 }
2384 return Qnil;
2385 fail:
2386 return Qnil;
2387 }
2388
2389
2390 SWIGINTERN VALUE
2391 _wrap_Keyset_push_back__SWIG_1(int argc, VALUE *argv, VALUE self) {
2392 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2393 char *arg2 = (char *) 0 ;
2394 std::size_t arg3 ;
2395 float arg4 ;
2396 void *argp1 = 0 ;
2397 int res1 = 0 ;
2398 int res2 ;
2399 char *buf2 = 0 ;
2400 size_t size2 = 0 ;
2401 int alloc2 = 0 ;
2402 float val4 ;
2403 int ecode4 = 0 ;
2404
2405 if ((argc < 2) || (argc > 2)) {
2406 rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2407 }
2408 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2409 if (!SWIG_IsOK(res1)) {
2410 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset *","push_back", 1, self ));
2411 }
2412 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2413 res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, &size2, &alloc2);
2414 if (!SWIG_IsOK(res2)) {
2415 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","push_back", 2, argv[0] ));
2416 }
2417 arg2 = reinterpret_cast< char * >(buf2);
2418 arg3 = static_cast< std::size_t >(size2 - 1);
2419 ecode4 = SWIG_AsVal_float(argv[1], &val4);
2420 if (!SWIG_IsOK(ecode4)) {
2421 SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "float","push_back", 4, argv[1] ));
2422 }
2423 arg4 = static_cast< float >(val4);
2424 {
2425 try {
2426 (arg1)->push_back((char const *)arg2,arg3,arg4);
2427 } catch (const marisa::Exception &ex) {
2428 SWIG_exception(SWIG_RuntimeError, ex.what());
2429 } catch (...) {
2430 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2431 }
2432 }
2433 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2434 return Qnil;
2435 fail:
2436 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2437 return Qnil;
2438 }
2439
2440
2441 SWIGINTERN VALUE
2442 _wrap_Keyset_push_back__SWIG_2(int argc, VALUE *argv, VALUE self) {
2443 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2444 char *arg2 = (char *) 0 ;
2445 std::size_t arg3 ;
2446 void *argp1 = 0 ;
2447 int res1 = 0 ;
2448 int res2 ;
2449 char *buf2 = 0 ;
2450 size_t size2 = 0 ;
2451 int alloc2 = 0 ;
2452
2453 if ((argc < 1) || (argc > 1)) {
2454 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2455 }
2456 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2457 if (!SWIG_IsOK(res1)) {
2458 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset *","push_back", 1, self ));
2459 }
2460 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2461 res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, &size2, &alloc2);
2462 if (!SWIG_IsOK(res2)) {
2463 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","push_back", 2, argv[0] ));
2464 }
2465 arg2 = reinterpret_cast< char * >(buf2);
2466 arg3 = static_cast< std::size_t >(size2 - 1);
2467 {
2468 try {
2469 (arg1)->push_back((char const *)arg2,arg3);
2470 } catch (const marisa::Exception &ex) {
2471 SWIG_exception(SWIG_RuntimeError, ex.what());
2472 } catch (...) {
2473 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2474 }
2475 }
2476 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2477 return Qnil;
2478 fail:
2479 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2480 return Qnil;
2481 }
2482
2483
2484 SWIGINTERN VALUE _wrap_Keyset_push_back(int nargs, VALUE *args, VALUE self) {
2485 int argc;
2486 VALUE argv[4];
2487 int ii;
2488
2489 argc = nargs + 1;
2490 argv[0] = self;
2491 if (argc > 4) SWIG_fail;
2492 for (ii = 1; (ii < argc); ++ii) {
2493 argv[ii] = args[ii-1];
2494 }
2495 if (argc == 2) {
2496 int _v;
2497 void *vptr = 0;
2498 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Keyset, 0);
2499 _v = SWIG_CheckState(res);
2500 if (_v) {
2501 void *vptr = 0;
2502 int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_marisa__Key, 0);
2503 _v = SWIG_CheckState(res);
2504 if (_v) {
2505 return _wrap_Keyset_push_back__SWIG_0(nargs, args, self);
2506 }
2507 }
2508 }
2509 if (argc == 2) {
2510 int _v;
2511 void *vptr = 0;
2512 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Keyset, 0);
2513 _v = SWIG_CheckState(res);
2514 if (_v) {
2515 int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
2516 _v = SWIG_CheckState(res);
2517 if (_v) {
2518 if (argc <= 2) {
2519 return _wrap_Keyset_push_back__SWIG_2(nargs, args, self);
2520 }
2521 {
2522 int res = SWIG_AsVal_size_t(argv[2], NULL);
2523 _v = SWIG_CheckState(res);
2524 }
2525 if (_v) {
2526 return _wrap_Keyset_push_back__SWIG_2(nargs, args, self);
2527 }
2528 }
2529 }
2530 }
2531 if (argc == 3) {
2532 int _v;
2533 void *vptr = 0;
2534 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Keyset, 0);
2535 _v = SWIG_CheckState(res);
2536 if (_v) {
2537 int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
2538 _v = SWIG_CheckState(res);
2539 if (_v) {
2540 {
2541 int res = SWIG_AsVal_float(argv[2], NULL);
2542 _v = SWIG_CheckState(res);
2543 }
2544 if (_v) {
2545 return _wrap_Keyset_push_back__SWIG_1(nargs, args, self);
2546 }
2547 }
2548 }
2549 }
2550
2551 fail:
2552 Ruby_Format_OverloadedError( argc, 4, "Keyset.push_back",
2553 " void Keyset.push_back(marisa::Key const &key)\n"
2554 " void Keyset.push_back(char const *ptr, std::size_t length, float weight)\n"
2555 " void Keyset.push_back(char const *ptr, std::size_t length)\n");
2556
2557 return Qnil;
2558 }
2559
2560
2561 SWIGINTERN VALUE
2562 _wrap_Keyset_key(int argc, VALUE *argv, VALUE self) {
2563 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2564 std::size_t arg2 ;
2565 void *argp1 = 0 ;
2566 int res1 = 0 ;
2567 size_t val2 ;
2568 int ecode2 = 0 ;
2569 marisa_swig::Key *result = 0 ;
2570 VALUE vresult = Qnil;
2571
2572 if ((argc < 1) || (argc > 1)) {
2573 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2574 }
2575 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2576 if (!SWIG_IsOK(res1)) {
2577 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset const *","key", 1, self ));
2578 }
2579 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2580 ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
2581 if (!SWIG_IsOK(ecode2)) {
2582 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","key", 2, argv[0] ));
2583 }
2584 arg2 = static_cast< std::size_t >(val2);
2585 {
2586 try {
2587 result = (marisa_swig::Key *) &((marisa_swig::Keyset const *)arg1)->key(arg2);
2588 } catch (const marisa::Exception &ex) {
2589 SWIG_exception(SWIG_RuntimeError, ex.what());
2590 } catch (...) {
2591 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2592 }
2593 }
2594 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_marisa_swig__Key, 0 | 0 );
2595 return vresult;
2596 fail:
2597 return Qnil;
2598 }
2599
2600
2601 SWIGINTERN VALUE
2602 _wrap_Keyset_key_str(int argc, VALUE *argv, VALUE self) {
2603 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2604 std::size_t arg2 ;
2605 char **arg3 = (char **) 0 ;
2606 std::size_t *arg4 = (std::size_t *) 0 ;
2607 void *argp1 = 0 ;
2608 int res1 = 0 ;
2609 size_t val2 ;
2610 int ecode2 = 0 ;
2611 char *temp3 = 0 ;
2612 std::size_t tempn3 ;
2613 VALUE vresult = Qnil;
2614
2615 arg3 = &temp3; arg4 = &tempn3;
2616 if ((argc < 1) || (argc > 1)) {
2617 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2618 }
2619 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2620 if (!SWIG_IsOK(res1)) {
2621 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset const *","key_str", 1, self ));
2622 }
2623 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2624 ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
2625 if (!SWIG_IsOK(ecode2)) {
2626 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","key_str", 2, argv[0] ));
2627 }
2628 arg2 = static_cast< std::size_t >(val2);
2629 {
2630 try {
2631 ((marisa_swig::Keyset const *)arg1)->key_str(arg2,(char const **)arg3,arg4);
2632 } catch (const marisa::Exception &ex) {
2633 SWIG_exception(SWIG_RuntimeError, ex.what());
2634 } catch (...) {
2635 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2636 }
2637 }
2638 if (*arg3) {
2639 vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_FromCharPtrAndSize(*arg3,*arg4));
2640 ;
2641 }
2642 return vresult;
2643 fail:
2644 return Qnil;
2645 }
2646
2647
2648 SWIGINTERN VALUE
2649 _wrap_Keyset_key_id(int argc, VALUE *argv, VALUE self) {
2650 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2651 std::size_t arg2 ;
2652 void *argp1 = 0 ;
2653 int res1 = 0 ;
2654 size_t val2 ;
2655 int ecode2 = 0 ;
2656 std::size_t result;
2657 VALUE vresult = Qnil;
2658
2659 if ((argc < 1) || (argc > 1)) {
2660 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2661 }
2662 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2663 if (!SWIG_IsOK(res1)) {
2664 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset const *","key_id", 1, self ));
2665 }
2666 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2667 ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
2668 if (!SWIG_IsOK(ecode2)) {
2669 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","key_id", 2, argv[0] ));
2670 }
2671 arg2 = static_cast< std::size_t >(val2);
2672 {
2673 try {
2674 result = ((marisa_swig::Keyset const *)arg1)->key_id(arg2);
2675 } catch (const marisa::Exception &ex) {
2676 SWIG_exception(SWIG_RuntimeError, ex.what());
2677 } catch (...) {
2678 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2679 }
2680 }
2681 vresult = SWIG_From_size_t(static_cast< size_t >(result));
2682 return vresult;
2683 fail:
2684 return Qnil;
2685 }
2686
2687
2688 SWIGINTERN VALUE
2689 _wrap_Keyset_num_keys(int argc, VALUE *argv, VALUE self) {
2690 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2691 void *argp1 = 0 ;
2692 int res1 = 0 ;
2693 std::size_t result;
2694 VALUE vresult = Qnil;
2695
2696 if ((argc < 0) || (argc > 0)) {
2697 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2698 }
2699 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2700 if (!SWIG_IsOK(res1)) {
2701 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset const *","num_keys", 1, self ));
2702 }
2703 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2704 {
2705 try {
2706 result = ((marisa_swig::Keyset const *)arg1)->num_keys();
2707 } catch (const marisa::Exception &ex) {
2708 SWIG_exception(SWIG_RuntimeError, ex.what());
2709 } catch (...) {
2710 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2711 }
2712 }
2713 vresult = SWIG_From_size_t(static_cast< size_t >(result));
2714 return vresult;
2715 fail:
2716 return Qnil;
2717 }
2718
2719
2720
2721 /*
2722 Document-method: Marisa::Keyset.empty
2723
2724 call-seq:
2725 empty -> bool
2726
2727 Check if Keyset is empty.
2728 */
2729 SWIGINTERN VALUE
2730 _wrap_Keyset_empty(int argc, VALUE *argv, VALUE self) {
2731 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2732 void *argp1 = 0 ;
2733 int res1 = 0 ;
2734 bool result;
2735 VALUE vresult = Qnil;
2736
2737 if ((argc < 0) || (argc > 0)) {
2738 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2739 }
2740 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2741 if (!SWIG_IsOK(res1)) {
2742 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset const *","empty", 1, self ));
2743 }
2744 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2745 {
2746 try {
2747 result = (bool)((marisa_swig::Keyset const *)arg1)->empty();
2748 } catch (const marisa::Exception &ex) {
2749 SWIG_exception(SWIG_RuntimeError, ex.what());
2750 } catch (...) {
2751 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2752 }
2753 }
2754 vresult = SWIG_From_bool(static_cast< bool >(result));
2755 return vresult;
2756 fail:
2757 return Qnil;
2758 }
2759
2760
2761
2762 /*
2763 Document-method: Marisa::Keyset.size
2764
2765 call-seq:
2766 size -> std::size_t
2767
2768 Size or Length of the Keyset.
2769 */
2770 SWIGINTERN VALUE
2771 _wrap_Keyset_size(int argc, VALUE *argv, VALUE self) {
2772 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2773 void *argp1 = 0 ;
2774 int res1 = 0 ;
2775 std::size_t result;
2776 VALUE vresult = Qnil;
2777
2778 if ((argc < 0) || (argc > 0)) {
2779 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2780 }
2781 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2782 if (!SWIG_IsOK(res1)) {
2783 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset const *","size", 1, self ));
2784 }
2785 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2786 {
2787 try {
2788 result = ((marisa_swig::Keyset const *)arg1)->size();
2789 } catch (const marisa::Exception &ex) {
2790 SWIG_exception(SWIG_RuntimeError, ex.what());
2791 } catch (...) {
2792 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2793 }
2794 }
2795 vresult = SWIG_From_size_t(static_cast< size_t >(result));
2796 return vresult;
2797 fail:
2798 return Qnil;
2799 }
2800
2801
2802 SWIGINTERN VALUE
2803 _wrap_Keyset_total_length(int argc, VALUE *argv, VALUE self) {
2804 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2805 void *argp1 = 0 ;
2806 int res1 = 0 ;
2807 std::size_t result;
2808 VALUE vresult = Qnil;
2809
2810 if ((argc < 0) || (argc > 0)) {
2811 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2812 }
2813 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2814 if (!SWIG_IsOK(res1)) {
2815 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset const *","total_length", 1, self ));
2816 }
2817 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2818 {
2819 try {
2820 result = ((marisa_swig::Keyset const *)arg1)->total_length();
2821 } catch (const marisa::Exception &ex) {
2822 SWIG_exception(SWIG_RuntimeError, ex.what());
2823 } catch (...) {
2824 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2825 }
2826 }
2827 vresult = SWIG_From_size_t(static_cast< size_t >(result));
2828 return vresult;
2829 fail:
2830 return Qnil;
2831 }
2832
2833
2834 SWIGINTERN VALUE
2835 _wrap_Keyset_reset(int argc, VALUE *argv, VALUE self) {
2836 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2837 void *argp1 = 0 ;
2838 int res1 = 0 ;
2839
2840 if ((argc < 0) || (argc > 0)) {
2841 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2842 }
2843 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2844 if (!SWIG_IsOK(res1)) {
2845 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset *","reset", 1, self ));
2846 }
2847 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2848 {
2849 try {
2850 (arg1)->reset();
2851 } catch (const marisa::Exception &ex) {
2852 SWIG_exception(SWIG_RuntimeError, ex.what());
2853 } catch (...) {
2854 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2855 }
2856 }
2857 return Qnil;
2858 fail:
2859 return Qnil;
2860 }
2861
2862
2863 SWIGINTERN VALUE
2864 _wrap_Keyset_clear(int argc, VALUE *argv, VALUE self) {
2865 marisa_swig::Keyset *arg1 = (marisa_swig::Keyset *) 0 ;
2866 void *argp1 = 0 ;
2867 int res1 = 0 ;
2868
2869 if ((argc < 0) || (argc > 0)) {
2870 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2871 }
2872 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Keyset, 0 | 0 );
2873 if (!SWIG_IsOK(res1)) {
2874 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Keyset *","clear", 1, self ));
2875 }
2876 arg1 = reinterpret_cast< marisa_swig::Keyset * >(argp1);
2877 {
2878 try {
2879 (arg1)->clear();
2880 } catch (const marisa::Exception &ex) {
2881 SWIG_exception(SWIG_RuntimeError, ex.what());
2882 } catch (...) {
2883 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2884 }
2885 }
2886 return Qnil;
2887 fail:
2888 return Qnil;
2889 }
2890
2891
2892 swig_class SwigClassAgent;
2893
2894 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
2895 SWIGINTERN VALUE
2896 _wrap_Agent_allocate(VALUE self) {
2897 #else
2898 SWIGINTERN VALUE
2899 _wrap_Agent_allocate(int argc, VALUE *argv, VALUE self) {
2900 #endif
2901
2902
2903 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_marisa_swig__Agent);
2904 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2905 rb_obj_call_init(vresult, argc, argv);
2906 #endif
2907 return vresult;
2908 }
2909
2910
2911 SWIGINTERN VALUE
2912 _wrap_new_Agent(int argc, VALUE *argv, VALUE self) {
2913 marisa_swig::Agent *result = 0 ;
2914
2915 if ((argc < 0) || (argc > 0)) {
2916 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2917 }
2918 {
2919 try {
2920 result = (marisa_swig::Agent *)new marisa_swig::Agent();
2921 DATA_PTR(self) = result;
2922 } catch (const marisa::Exception &ex) {
2923 SWIG_exception(SWIG_RuntimeError, ex.what());
2924 } catch (...) {
2925 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2926 }
2927 }
2928 return self;
2929 fail:
2930 return Qnil;
2931 }
2932
2933
2934 SWIGINTERN void
2935 free_marisa_swig_Agent(marisa_swig::Agent *arg1) {
2936 delete arg1;
2937 }
2938
2939 SWIGINTERN VALUE
2940 _wrap_Agent_set_query__SWIG_0(int argc, VALUE *argv, VALUE self) {
2941 marisa_swig::Agent *arg1 = (marisa_swig::Agent *) 0 ;
2942 char *arg2 = (char *) 0 ;
2943 std::size_t arg3 ;
2944 void *argp1 = 0 ;
2945 int res1 = 0 ;
2946 int res2 ;
2947 char *buf2 = 0 ;
2948 size_t size2 = 0 ;
2949 int alloc2 = 0 ;
2950
2951 if ((argc < 1) || (argc > 1)) {
2952 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2953 }
2954 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Agent, 0 | 0 );
2955 if (!SWIG_IsOK(res1)) {
2956 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Agent *","set_query", 1, self ));
2957 }
2958 arg1 = reinterpret_cast< marisa_swig::Agent * >(argp1);
2959 res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, &size2, &alloc2);
2960 if (!SWIG_IsOK(res2)) {
2961 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","set_query", 2, argv[0] ));
2962 }
2963 arg2 = reinterpret_cast< char * >(buf2);
2964 arg3 = static_cast< std::size_t >(size2 - 1);
2965 {
2966 try {
2967 (arg1)->set_query((char const *)arg2,arg3);
2968 } catch (const marisa::Exception &ex) {
2969 SWIG_exception(SWIG_RuntimeError, ex.what());
2970 } catch (...) {
2971 SWIG_exception(SWIG_UnknownError,"Unknown exception");
2972 }
2973 }
2974 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2975 return Qnil;
2976 fail:
2977 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
2978 return Qnil;
2979 }
2980
2981
2982 SWIGINTERN VALUE
2983 _wrap_Agent_set_query__SWIG_1(int argc, VALUE *argv, VALUE self) {
2984 marisa_swig::Agent *arg1 = (marisa_swig::Agent *) 0 ;
2985 std::size_t arg2 ;
2986 void *argp1 = 0 ;
2987 int res1 = 0 ;
2988 size_t val2 ;
2989 int ecode2 = 0 ;
2990
2991 if ((argc < 1) || (argc > 1)) {
2992 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2993 }
2994 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Agent, 0 | 0 );
2995 if (!SWIG_IsOK(res1)) {
2996 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Agent *","set_query", 1, self ));
2997 }
2998 arg1 = reinterpret_cast< marisa_swig::Agent * >(argp1);
2999 ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
3000 if (!SWIG_IsOK(ecode2)) {
3001 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","set_query", 2, argv[0] ));
3002 }
3003 arg2 = static_cast< std::size_t >(val2);
3004 {
3005 try {
3006 (arg1)->set_query(arg2);
3007 } catch (const marisa::Exception &ex) {
3008 SWIG_exception(SWIG_RuntimeError, ex.what());
3009 } catch (...) {
3010 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3011 }
3012 }
3013 return Qnil;
3014 fail:
3015 return Qnil;
3016 }
3017
3018
3019 SWIGINTERN VALUE _wrap_Agent_set_query(int nargs, VALUE *args, VALUE self) {
3020 int argc;
3021 VALUE argv[3];
3022 int ii;
3023
3024 argc = nargs + 1;
3025 argv[0] = self;
3026 if (argc > 3) SWIG_fail;
3027 for (ii = 1; (ii < argc); ++ii) {
3028 argv[ii] = args[ii-1];
3029 }
3030 if (argc == 2) {
3031 int _v;
3032 void *vptr = 0;
3033 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Agent, 0);
3034 _v = SWIG_CheckState(res);
3035 if (_v) {
3036 {
3037 int res = SWIG_AsVal_size_t(argv[1], NULL);
3038 _v = SWIG_CheckState(res);
3039 }
3040 if (_v) {
3041 return _wrap_Agent_set_query__SWIG_1(nargs, args, self);
3042 }
3043 }
3044 }
3045 if (argc == 2) {
3046 int _v;
3047 void *vptr = 0;
3048 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Agent, 0);
3049 _v = SWIG_CheckState(res);
3050 if (_v) {
3051 int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
3052 _v = SWIG_CheckState(res);
3053 if (_v) {
3054 if (argc <= 2) {
3055 return _wrap_Agent_set_query__SWIG_0(nargs, args, self);
3056 }
3057 {
3058 int res = SWIG_AsVal_size_t(argv[2], NULL);
3059 _v = SWIG_CheckState(res);
3060 }
3061 if (_v) {
3062 return _wrap_Agent_set_query__SWIG_0(nargs, args, self);
3063 }
3064 }
3065 }
3066 }
3067
3068 fail:
3069 Ruby_Format_OverloadedError( argc, 3, "Agent.set_query",
3070 " void Agent.set_query(char const *ptr, std::size_t length)\n"
3071 " void Agent.set_query(std::size_t id)\n");
3072
3073 return Qnil;
3074 }
3075
3076
3077 SWIGINTERN VALUE
3078 _wrap_Agent_key(int argc, VALUE *argv, VALUE self) {
3079 marisa_swig::Agent *arg1 = (marisa_swig::Agent *) 0 ;
3080 void *argp1 = 0 ;
3081 int res1 = 0 ;
3082 marisa_swig::Key *result = 0 ;
3083 VALUE vresult = Qnil;
3084
3085 if ((argc < 0) || (argc > 0)) {
3086 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3087 }
3088 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Agent, 0 | 0 );
3089 if (!SWIG_IsOK(res1)) {
3090 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Agent const *","key", 1, self ));
3091 }
3092 arg1 = reinterpret_cast< marisa_swig::Agent * >(argp1);
3093 {
3094 try {
3095 result = (marisa_swig::Key *) &((marisa_swig::Agent const *)arg1)->key();
3096 } catch (const marisa::Exception &ex) {
3097 SWIG_exception(SWIG_RuntimeError, ex.what());
3098 } catch (...) {
3099 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3100 }
3101 }
3102 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_marisa_swig__Key, 0 | 0 );
3103 return vresult;
3104 fail:
3105 return Qnil;
3106 }
3107
3108
3109 SWIGINTERN VALUE
3110 _wrap_Agent_query(int argc, VALUE *argv, VALUE self) {
3111 marisa_swig::Agent *arg1 = (marisa_swig::Agent *) 0 ;
3112 void *argp1 = 0 ;
3113 int res1 = 0 ;
3114 marisa_swig::Query *result = 0 ;
3115 VALUE vresult = Qnil;
3116
3117 if ((argc < 0) || (argc > 0)) {
3118 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3119 }
3120 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Agent, 0 | 0 );
3121 if (!SWIG_IsOK(res1)) {
3122 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Agent const *","query", 1, self ));
3123 }
3124 arg1 = reinterpret_cast< marisa_swig::Agent * >(argp1);
3125 {
3126 try {
3127 result = (marisa_swig::Query *) &((marisa_swig::Agent const *)arg1)->query();
3128 } catch (const marisa::Exception &ex) {
3129 SWIG_exception(SWIG_RuntimeError, ex.what());
3130 } catch (...) {
3131 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3132 }
3133 }
3134 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_marisa_swig__Query, 0 | 0 );
3135 return vresult;
3136 fail:
3137 return Qnil;
3138 }
3139
3140
3141 SWIGINTERN VALUE
3142 _wrap_Agent_key_str(int argc, VALUE *argv, VALUE self) {
3143 marisa_swig::Agent *arg1 = (marisa_swig::Agent *) 0 ;
3144 char **arg2 = (char **) 0 ;
3145 std::size_t *arg3 = (std::size_t *) 0 ;
3146 void *argp1 = 0 ;
3147 int res1 = 0 ;
3148 char *temp2 = 0 ;
3149 std::size_t tempn2 ;
3150 VALUE vresult = Qnil;
3151
3152 arg2 = &temp2; arg3 = &tempn2;
3153 if ((argc < 0) || (argc > 0)) {
3154 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3155 }
3156 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Agent, 0 | 0 );
3157 if (!SWIG_IsOK(res1)) {
3158 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Agent const *","key_str", 1, self ));
3159 }
3160 arg1 = reinterpret_cast< marisa_swig::Agent * >(argp1);
3161 {
3162 try {
3163 ((marisa_swig::Agent const *)arg1)->key_str((char const **)arg2,arg3);
3164 } catch (const marisa::Exception &ex) {
3165 SWIG_exception(SWIG_RuntimeError, ex.what());
3166 } catch (...) {
3167 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3168 }
3169 }
3170 if (*arg2) {
3171 vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_FromCharPtrAndSize(*arg2,*arg3));
3172 ;
3173 }
3174 return vresult;
3175 fail:
3176 return Qnil;
3177 }
3178
3179
3180 SWIGINTERN VALUE
3181 _wrap_Agent_key_id(int argc, VALUE *argv, VALUE self) {
3182 marisa_swig::Agent *arg1 = (marisa_swig::Agent *) 0 ;
3183 void *argp1 = 0 ;
3184 int res1 = 0 ;
3185 std::size_t result;
3186 VALUE vresult = Qnil;
3187
3188 if ((argc < 0) || (argc > 0)) {
3189 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3190 }
3191 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Agent, 0 | 0 );
3192 if (!SWIG_IsOK(res1)) {
3193 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Agent const *","key_id", 1, self ));
3194 }
3195 arg1 = reinterpret_cast< marisa_swig::Agent * >(argp1);
3196 {
3197 try {
3198 result = ((marisa_swig::Agent const *)arg1)->key_id();
3199 } catch (const marisa::Exception &ex) {
3200 SWIG_exception(SWIG_RuntimeError, ex.what());
3201 } catch (...) {
3202 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3203 }
3204 }
3205 vresult = SWIG_From_size_t(static_cast< size_t >(result));
3206 return vresult;
3207 fail:
3208 return Qnil;
3209 }
3210
3211
3212 SWIGINTERN VALUE
3213 _wrap_Agent_query_str(int argc, VALUE *argv, VALUE self) {
3214 marisa_swig::Agent *arg1 = (marisa_swig::Agent *) 0 ;
3215 char **arg2 = (char **) 0 ;
3216 std::size_t *arg3 = (std::size_t *) 0 ;
3217 void *argp1 = 0 ;
3218 int res1 = 0 ;
3219 char *temp2 = 0 ;
3220 std::size_t tempn2 ;
3221 VALUE vresult = Qnil;
3222
3223 arg2 = &temp2; arg3 = &tempn2;
3224 if ((argc < 0) || (argc > 0)) {
3225 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3226 }
3227 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Agent, 0 | 0 );
3228 if (!SWIG_IsOK(res1)) {
3229 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Agent const *","query_str", 1, self ));
3230 }
3231 arg1 = reinterpret_cast< marisa_swig::Agent * >(argp1);
3232 {
3233 try {
3234 ((marisa_swig::Agent const *)arg1)->query_str((char const **)arg2,arg3);
3235 } catch (const marisa::Exception &ex) {
3236 SWIG_exception(SWIG_RuntimeError, ex.what());
3237 } catch (...) {
3238 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3239 }
3240 }
3241 if (*arg2) {
3242 vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_FromCharPtrAndSize(*arg2,*arg3));
3243 ;
3244 }
3245 return vresult;
3246 fail:
3247 return Qnil;
3248 }
3249
3250
3251 SWIGINTERN VALUE
3252 _wrap_Agent_query_id(int argc, VALUE *argv, VALUE self) {
3253 marisa_swig::Agent *arg1 = (marisa_swig::Agent *) 0 ;
3254 void *argp1 = 0 ;
3255 int res1 = 0 ;
3256 std::size_t result;
3257 VALUE vresult = Qnil;
3258
3259 if ((argc < 0) || (argc > 0)) {
3260 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3261 }
3262 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Agent, 0 | 0 );
3263 if (!SWIG_IsOK(res1)) {
3264 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Agent const *","query_id", 1, self ));
3265 }
3266 arg1 = reinterpret_cast< marisa_swig::Agent * >(argp1);
3267 {
3268 try {
3269 result = ((marisa_swig::Agent const *)arg1)->query_id();
3270 } catch (const marisa::Exception &ex) {
3271 SWIG_exception(SWIG_RuntimeError, ex.what());
3272 } catch (...) {
3273 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3274 }
3275 }
3276 vresult = SWIG_From_size_t(static_cast< size_t >(result));
3277 return vresult;
3278 fail:
3279 return Qnil;
3280 }
3281
3282
3283 swig_class SwigClassTrie;
3284
3285 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
3286 SWIGINTERN VALUE
3287 _wrap_Trie_allocate(VALUE self) {
3288 #else
3289 SWIGINTERN VALUE
3290 _wrap_Trie_allocate(int argc, VALUE *argv, VALUE self) {
3291 #endif
3292
3293
3294 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_marisa_swig__Trie);
3295 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
3296 rb_obj_call_init(vresult, argc, argv);
3297 #endif
3298 return vresult;
3299 }
3300
3301
3302 SWIGINTERN VALUE
3303 _wrap_new_Trie(int argc, VALUE *argv, VALUE self) {
3304 marisa_swig::Trie *result = 0 ;
3305
3306 if ((argc < 0) || (argc > 0)) {
3307 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3308 }
3309 {
3310 try {
3311 result = (marisa_swig::Trie *)new marisa_swig::Trie();
3312 DATA_PTR(self) = result;
3313 } catch (const marisa::Exception &ex) {
3314 SWIG_exception(SWIG_RuntimeError, ex.what());
3315 } catch (...) {
3316 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3317 }
3318 }
3319 return self;
3320 fail:
3321 return Qnil;
3322 }
3323
3324
3325 SWIGINTERN void
3326 free_marisa_swig_Trie(marisa_swig::Trie *arg1) {
3327 delete arg1;
3328 }
3329
3330 SWIGINTERN VALUE
3331 _wrap_Trie_build__SWIG_0(int argc, VALUE *argv, VALUE self) {
3332 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3333 marisa_swig::Keyset *arg2 = 0 ;
3334 int arg3 ;
3335 void *argp1 = 0 ;
3336 int res1 = 0 ;
3337 void *argp2 = 0 ;
3338 int res2 = 0 ;
3339 int val3 ;
3340 int ecode3 = 0 ;
3341
3342 if ((argc < 2) || (argc > 2)) {
3343 rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3344 }
3345 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3346 if (!SWIG_IsOK(res1)) {
3347 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie *","build", 1, self ));
3348 }
3349 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3350 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_marisa_swig__Keyset, 0 );
3351 if (!SWIG_IsOK(res2)) {
3352 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "marisa_swig::Keyset &","build", 2, argv[0] ));
3353 }
3354 if (!argp2) {
3355 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "marisa_swig::Keyset &","build", 2, argv[0]));
3356 }
3357 arg2 = reinterpret_cast< marisa_swig::Keyset * >(argp2);
3358 ecode3 = SWIG_AsVal_int(argv[1], &val3);
3359 if (!SWIG_IsOK(ecode3)) {
3360 SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","build", 3, argv[1] ));
3361 }
3362 arg3 = static_cast< int >(val3);
3363 {
3364 try {
3365 (arg1)->build(*arg2,arg3);
3366 } catch (const marisa::Exception &ex) {
3367 SWIG_exception(SWIG_RuntimeError, ex.what());
3368 } catch (...) {
3369 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3370 }
3371 }
3372 return Qnil;
3373 fail:
3374 return Qnil;
3375 }
3376
3377
3378 SWIGINTERN VALUE
3379 _wrap_Trie_build__SWIG_1(int argc, VALUE *argv, VALUE self) {
3380 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3381 marisa_swig::Keyset *arg2 = 0 ;
3382 void *argp1 = 0 ;
3383 int res1 = 0 ;
3384 void *argp2 = 0 ;
3385 int res2 = 0 ;
3386
3387 if ((argc < 1) || (argc > 1)) {
3388 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3389 }
3390 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3391 if (!SWIG_IsOK(res1)) {
3392 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie *","build", 1, self ));
3393 }
3394 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3395 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_marisa_swig__Keyset, 0 );
3396 if (!SWIG_IsOK(res2)) {
3397 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "marisa_swig::Keyset &","build", 2, argv[0] ));
3398 }
3399 if (!argp2) {
3400 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "marisa_swig::Keyset &","build", 2, argv[0]));
3401 }
3402 arg2 = reinterpret_cast< marisa_swig::Keyset * >(argp2);
3403 {
3404 try {
3405 (arg1)->build(*arg2);
3406 } catch (const marisa::Exception &ex) {
3407 SWIG_exception(SWIG_RuntimeError, ex.what());
3408 } catch (...) {
3409 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3410 }
3411 }
3412 return Qnil;
3413 fail:
3414 return Qnil;
3415 }
3416
3417
3418 SWIGINTERN VALUE _wrap_Trie_build(int nargs, VALUE *args, VALUE self) {
3419 int argc;
3420 VALUE argv[4];
3421 int ii;
3422
3423 argc = nargs + 1;
3424 argv[0] = self;
3425 if (argc > 4) SWIG_fail;
3426 for (ii = 1; (ii < argc); ++ii) {
3427 argv[ii] = args[ii-1];
3428 }
3429 if (argc == 2) {
3430 int _v;
3431 void *vptr = 0;
3432 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Trie, 0);
3433 _v = SWIG_CheckState(res);
3434 if (_v) {
3435 void *vptr = 0;
3436 int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_marisa_swig__Keyset, 0);
3437 _v = SWIG_CheckState(res);
3438 if (_v) {
3439 return _wrap_Trie_build__SWIG_1(nargs, args, self);
3440 }
3441 }
3442 }
3443 if (argc == 3) {
3444 int _v;
3445 void *vptr = 0;
3446 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Trie, 0);
3447 _v = SWIG_CheckState(res);
3448 if (_v) {
3449 void *vptr = 0;
3450 int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_marisa_swig__Keyset, 0);
3451 _v = SWIG_CheckState(res);
3452 if (_v) {
3453 {
3454 int res = SWIG_AsVal_int(argv[2], NULL);
3455 _v = SWIG_CheckState(res);
3456 }
3457 if (_v) {
3458 return _wrap_Trie_build__SWIG_0(nargs, args, self);
3459 }
3460 }
3461 }
3462 }
3463
3464 fail:
3465 Ruby_Format_OverloadedError( argc, 4, "Trie.build",
3466 " void Trie.build(marisa_swig::Keyset &keyset, int config_flags)\n"
3467 " void Trie.build(marisa_swig::Keyset &keyset)\n");
3468
3469 return Qnil;
3470 }
3471
3472
3473 SWIGINTERN VALUE
3474 _wrap_Trie_mmap(int argc, VALUE *argv, VALUE self) {
3475 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3476 char *arg2 = (char *) 0 ;
3477 void *argp1 = 0 ;
3478 int res1 = 0 ;
3479 int res2 ;
3480 char *buf2 = 0 ;
3481 int alloc2 = 0 ;
3482
3483 if ((argc < 1) || (argc > 1)) {
3484 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3485 }
3486 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3487 if (!SWIG_IsOK(res1)) {
3488 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie *","mmap", 1, self ));
3489 }
3490 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3491 res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
3492 if (!SWIG_IsOK(res2)) {
3493 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","mmap", 2, argv[0] ));
3494 }
3495 arg2 = reinterpret_cast< char * >(buf2);
3496 {
3497 try {
3498 (arg1)->mmap((char const *)arg2);
3499 } catch (const marisa::Exception &ex) {
3500 SWIG_exception(SWIG_RuntimeError, ex.what());
3501 } catch (...) {
3502 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3503 }
3504 }
3505 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3506 return Qnil;
3507 fail:
3508 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3509 return Qnil;
3510 }
3511
3512
3513 SWIGINTERN VALUE
3514 _wrap_Trie_load(int argc, VALUE *argv, VALUE self) {
3515 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3516 char *arg2 = (char *) 0 ;
3517 void *argp1 = 0 ;
3518 int res1 = 0 ;
3519 int res2 ;
3520 char *buf2 = 0 ;
3521 int alloc2 = 0 ;
3522
3523 if ((argc < 1) || (argc > 1)) {
3524 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3525 }
3526 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3527 if (!SWIG_IsOK(res1)) {
3528 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie *","load", 1, self ));
3529 }
3530 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3531 res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
3532 if (!SWIG_IsOK(res2)) {
3533 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","load", 2, argv[0] ));
3534 }
3535 arg2 = reinterpret_cast< char * >(buf2);
3536 {
3537 try {
3538 (arg1)->load((char const *)arg2);
3539 } catch (const marisa::Exception &ex) {
3540 SWIG_exception(SWIG_RuntimeError, ex.what());
3541 } catch (...) {
3542 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3543 }
3544 }
3545 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3546 return Qnil;
3547 fail:
3548 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3549 return Qnil;
3550 }
3551
3552
3553 SWIGINTERN VALUE
3554 _wrap_Trie_save(int argc, VALUE *argv, VALUE self) {
3555 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3556 char *arg2 = (char *) 0 ;
3557 void *argp1 = 0 ;
3558 int res1 = 0 ;
3559 int res2 ;
3560 char *buf2 = 0 ;
3561 int alloc2 = 0 ;
3562
3563 if ((argc < 1) || (argc > 1)) {
3564 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3565 }
3566 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3567 if (!SWIG_IsOK(res1)) {
3568 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","save", 1, self ));
3569 }
3570 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3571 res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
3572 if (!SWIG_IsOK(res2)) {
3573 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","save", 2, argv[0] ));
3574 }
3575 arg2 = reinterpret_cast< char * >(buf2);
3576 {
3577 try {
3578 ((marisa_swig::Trie const *)arg1)->save((char const *)arg2);
3579 } catch (const marisa::Exception &ex) {
3580 SWIG_exception(SWIG_RuntimeError, ex.what());
3581 } catch (...) {
3582 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3583 }
3584 }
3585 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3586 return Qnil;
3587 fail:
3588 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3589 return Qnil;
3590 }
3591
3592
3593 SWIGINTERN VALUE
3594 _wrap_Trie_lookup__SWIG_0(int argc, VALUE *argv, VALUE self) {
3595 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3596 marisa_swig::Agent *arg2 = 0 ;
3597 void *argp1 = 0 ;
3598 int res1 = 0 ;
3599 void *argp2 = 0 ;
3600 int res2 = 0 ;
3601 bool result;
3602 VALUE vresult = Qnil;
3603
3604 if ((argc < 1) || (argc > 1)) {
3605 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3606 }
3607 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3608 if (!SWIG_IsOK(res1)) {
3609 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","lookup", 1, self ));
3610 }
3611 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3612 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_marisa_swig__Agent, 0 );
3613 if (!SWIG_IsOK(res2)) {
3614 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "marisa_swig::Agent &","lookup", 2, argv[0] ));
3615 }
3616 if (!argp2) {
3617 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "marisa_swig::Agent &","lookup", 2, argv[0]));
3618 }
3619 arg2 = reinterpret_cast< marisa_swig::Agent * >(argp2);
3620 {
3621 try {
3622 result = (bool)((marisa_swig::Trie const *)arg1)->lookup(*arg2);
3623 } catch (const marisa::Exception &ex) {
3624 SWIG_exception(SWIG_RuntimeError, ex.what());
3625 } catch (...) {
3626 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3627 }
3628 }
3629 vresult = SWIG_From_bool(static_cast< bool >(result));
3630 return vresult;
3631 fail:
3632 return Qnil;
3633 }
3634
3635
3636 SWIGINTERN VALUE
3637 _wrap_Trie_reverse_lookup__SWIG_0(int argc, VALUE *argv, VALUE self) {
3638 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3639 marisa_swig::Agent *arg2 = 0 ;
3640 void *argp1 = 0 ;
3641 int res1 = 0 ;
3642 void *argp2 = 0 ;
3643 int res2 = 0 ;
3644
3645 if ((argc < 1) || (argc > 1)) {
3646 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3647 }
3648 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3649 if (!SWIG_IsOK(res1)) {
3650 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","reverse_lookup", 1, self ));
3651 }
3652 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3653 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_marisa_swig__Agent, 0 );
3654 if (!SWIG_IsOK(res2)) {
3655 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "marisa_swig::Agent &","reverse_lookup", 2, argv[0] ));
3656 }
3657 if (!argp2) {
3658 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "marisa_swig::Agent &","reverse_lookup", 2, argv[0]));
3659 }
3660 arg2 = reinterpret_cast< marisa_swig::Agent * >(argp2);
3661 {
3662 try {
3663 ((marisa_swig::Trie const *)arg1)->reverse_lookup(*arg2);
3664 } catch (const marisa::Exception &ex) {
3665 SWIG_exception(SWIG_RuntimeError, ex.what());
3666 } catch (...) {
3667 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3668 }
3669 }
3670 return Qnil;
3671 fail:
3672 return Qnil;
3673 }
3674
3675
3676 SWIGINTERN VALUE
3677 _wrap_Trie_common_prefix_search(int argc, VALUE *argv, VALUE self) {
3678 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3679 marisa_swig::Agent *arg2 = 0 ;
3680 void *argp1 = 0 ;
3681 int res1 = 0 ;
3682 void *argp2 = 0 ;
3683 int res2 = 0 ;
3684 bool result;
3685 VALUE vresult = Qnil;
3686
3687 if ((argc < 1) || (argc > 1)) {
3688 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3689 }
3690 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3691 if (!SWIG_IsOK(res1)) {
3692 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","common_prefix_search", 1, self ));
3693 }
3694 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3695 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_marisa_swig__Agent, 0 );
3696 if (!SWIG_IsOK(res2)) {
3697 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "marisa_swig::Agent &","common_prefix_search", 2, argv[0] ));
3698 }
3699 if (!argp2) {
3700 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "marisa_swig::Agent &","common_prefix_search", 2, argv[0]));
3701 }
3702 arg2 = reinterpret_cast< marisa_swig::Agent * >(argp2);
3703 {
3704 try {
3705 result = (bool)((marisa_swig::Trie const *)arg1)->common_prefix_search(*arg2);
3706 } catch (const marisa::Exception &ex) {
3707 SWIG_exception(SWIG_RuntimeError, ex.what());
3708 } catch (...) {
3709 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3710 }
3711 }
3712 vresult = SWIG_From_bool(static_cast< bool >(result));
3713 return vresult;
3714 fail:
3715 return Qnil;
3716 }
3717
3718
3719 SWIGINTERN VALUE
3720 _wrap_Trie_predictive_search(int argc, VALUE *argv, VALUE self) {
3721 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3722 marisa_swig::Agent *arg2 = 0 ;
3723 void *argp1 = 0 ;
3724 int res1 = 0 ;
3725 void *argp2 = 0 ;
3726 int res2 = 0 ;
3727 bool result;
3728 VALUE vresult = Qnil;
3729
3730 if ((argc < 1) || (argc > 1)) {
3731 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3732 }
3733 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3734 if (!SWIG_IsOK(res1)) {
3735 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","predictive_search", 1, self ));
3736 }
3737 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3738 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_marisa_swig__Agent, 0 );
3739 if (!SWIG_IsOK(res2)) {
3740 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "marisa_swig::Agent &","predictive_search", 2, argv[0] ));
3741 }
3742 if (!argp2) {
3743 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "marisa_swig::Agent &","predictive_search", 2, argv[0]));
3744 }
3745 arg2 = reinterpret_cast< marisa_swig::Agent * >(argp2);
3746 {
3747 try {
3748 result = (bool)((marisa_swig::Trie const *)arg1)->predictive_search(*arg2);
3749 } catch (const marisa::Exception &ex) {
3750 SWIG_exception(SWIG_RuntimeError, ex.what());
3751 } catch (...) {
3752 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3753 }
3754 }
3755 vresult = SWIG_From_bool(static_cast< bool >(result));
3756 return vresult;
3757 fail:
3758 return Qnil;
3759 }
3760
3761
3762 SWIGINTERN VALUE
3763 _wrap_Trie_lookup__SWIG_1(int argc, VALUE *argv, VALUE self) {
3764 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3765 char *arg2 = (char *) 0 ;
3766 std::size_t arg3 ;
3767 void *argp1 = 0 ;
3768 int res1 = 0 ;
3769 int res2 ;
3770 char *buf2 = 0 ;
3771 size_t size2 = 0 ;
3772 int alloc2 = 0 ;
3773 std::size_t result;
3774 VALUE vresult = Qnil;
3775
3776 if ((argc < 1) || (argc > 1)) {
3777 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3778 }
3779 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3780 if (!SWIG_IsOK(res1)) {
3781 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","lookup", 1, self ));
3782 }
3783 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3784 res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, &size2, &alloc2);
3785 if (!SWIG_IsOK(res2)) {
3786 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","lookup", 2, argv[0] ));
3787 }
3788 arg2 = reinterpret_cast< char * >(buf2);
3789 arg3 = static_cast< std::size_t >(size2 - 1);
3790 {
3791 try {
3792 result = ((marisa_swig::Trie const *)arg1)->lookup((char const *)arg2,arg3);
3793 } catch (const marisa::Exception &ex) {
3794 SWIG_exception(SWIG_RuntimeError, ex.what());
3795 } catch (...) {
3796 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3797 }
3798 }
3799 vresult = SWIG_From_size_t(static_cast< size_t >(result));
3800 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3801 return vresult;
3802 fail:
3803 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3804 return Qnil;
3805 }
3806
3807
3808 SWIGINTERN VALUE _wrap_Trie_lookup(int nargs, VALUE *args, VALUE self) {
3809 int argc;
3810 VALUE argv[3];
3811 int ii;
3812
3813 argc = nargs + 1;
3814 argv[0] = self;
3815 if (argc > 3) SWIG_fail;
3816 for (ii = 1; (ii < argc); ++ii) {
3817 argv[ii] = args[ii-1];
3818 }
3819 if (argc == 2) {
3820 int _v;
3821 void *vptr = 0;
3822 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Trie, 0);
3823 _v = SWIG_CheckState(res);
3824 if (_v) {
3825 void *vptr = 0;
3826 int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_marisa_swig__Agent, 0);
3827 _v = SWIG_CheckState(res);
3828 if (_v) {
3829 return _wrap_Trie_lookup__SWIG_0(nargs, args, self);
3830 }
3831 }
3832 }
3833 if (argc == 2) {
3834 int _v;
3835 void *vptr = 0;
3836 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Trie, 0);
3837 _v = SWIG_CheckState(res);
3838 if (_v) {
3839 int res = SWIG_AsCharPtrAndSize(argv[1], 0, NULL, 0);
3840 _v = SWIG_CheckState(res);
3841 if (_v) {
3842 if (argc <= 2) {
3843 return _wrap_Trie_lookup__SWIG_1(nargs, args, self);
3844 }
3845 {
3846 int res = SWIG_AsVal_size_t(argv[2], NULL);
3847 _v = SWIG_CheckState(res);
3848 }
3849 if (_v) {
3850 return _wrap_Trie_lookup__SWIG_1(nargs, args, self);
3851 }
3852 }
3853 }
3854 }
3855
3856 fail:
3857 Ruby_Format_OverloadedError( argc, 3, "Trie.lookup",
3858 " std::size_t Trie.lookup(marisa_swig::Agent &agent)\n"
3859 " std::size_t Trie.lookup(char const *ptr, std::size_t length)\n");
3860
3861 return Qnil;
3862 }
3863
3864
3865 SWIGINTERN VALUE
3866 _wrap_Trie_reverse_lookup__SWIG_1(int argc, VALUE *argv, VALUE self) {
3867 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3868 std::size_t arg2 ;
3869 char **arg3 = (char **) 0 ;
3870 std::size_t *arg4 = (std::size_t *) 0 ;
3871 void *argp1 = 0 ;
3872 int res1 = 0 ;
3873 size_t val2 ;
3874 int ecode2 = 0 ;
3875 char *temp3 = 0 ;
3876 std::size_t tempn3 ;
3877 VALUE vresult = Qnil;
3878
3879 arg3 = &temp3; arg4 = &tempn3;
3880 if ((argc < 1) || (argc > 1)) {
3881 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3882 }
3883 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3884 if (!SWIG_IsOK(res1)) {
3885 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","reverse_lookup", 1, self ));
3886 }
3887 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3888 ecode2 = SWIG_AsVal_size_t(argv[0], &val2);
3889 if (!SWIG_IsOK(ecode2)) {
3890 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "std::size_t","reverse_lookup", 2, argv[0] ));
3891 }
3892 arg2 = static_cast< std::size_t >(val2);
3893 {
3894 try {
3895 ((marisa_swig::Trie const *)arg1)->reverse_lookup(arg2,(char const **)arg3,arg4);
3896 } catch (const marisa::Exception &ex) {
3897 SWIG_exception(SWIG_RuntimeError, ex.what());
3898 } catch (...) {
3899 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3900 }
3901 }
3902 if (*arg3) {
3903 vresult = SWIG_Ruby_AppendOutput(vresult, SWIG_FromCharPtrAndSize(*arg3,*arg4));
3904 delete [] (*arg3);
3905 }
3906 return vresult;
3907 fail:
3908 return Qnil;
3909 }
3910
3911
3912 SWIGINTERN VALUE _wrap_Trie_reverse_lookup(int nargs, VALUE *args, VALUE self) {
3913 int argc;
3914 VALUE argv[3];
3915 int ii;
3916
3917 argc = nargs + 1;
3918 argv[0] = self;
3919 if (argc > 3) SWIG_fail;
3920 for (ii = 1; (ii < argc); ++ii) {
3921 argv[ii] = args[ii-1];
3922 }
3923 if (argc == 2) {
3924 int _v;
3925 void *vptr = 0;
3926 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Trie, 0);
3927 _v = SWIG_CheckState(res);
3928 if (_v) {
3929 void *vptr = 0;
3930 int res = SWIG_ConvertPtr(argv[1], &vptr, SWIGTYPE_p_marisa_swig__Agent, 0);
3931 _v = SWIG_CheckState(res);
3932 if (_v) {
3933 return _wrap_Trie_reverse_lookup__SWIG_0(nargs, args, self);
3934 }
3935 }
3936 }
3937 if (argc == 2) {
3938 int _v;
3939 void *vptr = 0;
3940 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_marisa_swig__Trie, 0);
3941 _v = SWIG_CheckState(res);
3942 if (_v) {
3943 {
3944 int res = SWIG_AsVal_size_t(argv[1], NULL);
3945 _v = SWIG_CheckState(res);
3946 }
3947 if (_v) {
3948 return _wrap_Trie_reverse_lookup__SWIG_1(nargs, args, self);
3949 }
3950 }
3951 }
3952
3953 fail:
3954 Ruby_Format_OverloadedError( argc, 3, "Trie.reverse_lookup",
3955 " void Trie.reverse_lookup(marisa_swig::Agent &agent)\n"
3956 " void Trie.reverse_lookup(std::size_t id, char const **ptr_out_to_be_deleted, std::size_t *length_out)\n");
3957
3958 return Qnil;
3959 }
3960
3961
3962 SWIGINTERN VALUE
3963 _wrap_Trie_num_tries(int argc, VALUE *argv, VALUE self) {
3964 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3965 void *argp1 = 0 ;
3966 int res1 = 0 ;
3967 std::size_t result;
3968 VALUE vresult = Qnil;
3969
3970 if ((argc < 0) || (argc > 0)) {
3971 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3972 }
3973 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
3974 if (!SWIG_IsOK(res1)) {
3975 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","num_tries", 1, self ));
3976 }
3977 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
3978 {
3979 try {
3980 result = ((marisa_swig::Trie const *)arg1)->num_tries();
3981 } catch (const marisa::Exception &ex) {
3982 SWIG_exception(SWIG_RuntimeError, ex.what());
3983 } catch (...) {
3984 SWIG_exception(SWIG_UnknownError,"Unknown exception");
3985 }
3986 }
3987 vresult = SWIG_From_size_t(static_cast< size_t >(result));
3988 return vresult;
3989 fail:
3990 return Qnil;
3991 }
3992
3993
3994 SWIGINTERN VALUE
3995 _wrap_Trie_num_keys(int argc, VALUE *argv, VALUE self) {
3996 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
3997 void *argp1 = 0 ;
3998 int res1 = 0 ;
3999 std::size_t result;
4000 VALUE vresult = Qnil;
4001
4002 if ((argc < 0) || (argc > 0)) {
4003 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4004 }
4005 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4006 if (!SWIG_IsOK(res1)) {
4007 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","num_keys", 1, self ));
4008 }
4009 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4010 {
4011 try {
4012 result = ((marisa_swig::Trie const *)arg1)->num_keys();
4013 } catch (const marisa::Exception &ex) {
4014 SWIG_exception(SWIG_RuntimeError, ex.what());
4015 } catch (...) {
4016 SWIG_exception(SWIG_UnknownError,"Unknown exception");
4017 }
4018 }
4019 vresult = SWIG_From_size_t(static_cast< size_t >(result));
4020 return vresult;
4021 fail:
4022 return Qnil;
4023 }
4024
4025
4026 SWIGINTERN VALUE
4027 _wrap_Trie_num_nodes(int argc, VALUE *argv, VALUE self) {
4028 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
4029 void *argp1 = 0 ;
4030 int res1 = 0 ;
4031 std::size_t result;
4032 VALUE vresult = Qnil;
4033
4034 if ((argc < 0) || (argc > 0)) {
4035 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4036 }
4037 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4038 if (!SWIG_IsOK(res1)) {
4039 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","num_nodes", 1, self ));
4040 }
4041 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4042 {
4043 try {
4044 result = ((marisa_swig::Trie const *)arg1)->num_nodes();
4045 } catch (const marisa::Exception &ex) {
4046 SWIG_exception(SWIG_RuntimeError, ex.what());
4047 } catch (...) {
4048 SWIG_exception(SWIG_UnknownError,"Unknown exception");
4049 }
4050 }
4051 vresult = SWIG_From_size_t(static_cast< size_t >(result));
4052 return vresult;
4053 fail:
4054 return Qnil;
4055 }
4056
4057
4058 SWIGINTERN VALUE
4059 _wrap_Trie_tail_mode(int argc, VALUE *argv, VALUE self) {
4060 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
4061 void *argp1 = 0 ;
4062 int res1 = 0 ;
4063 marisa_swig::TailMode result;
4064 VALUE vresult = Qnil;
4065
4066 if ((argc < 0) || (argc > 0)) {
4067 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4068 }
4069 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4070 if (!SWIG_IsOK(res1)) {
4071 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","tail_mode", 1, self ));
4072 }
4073 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4074 {
4075 try {
4076 result = (marisa_swig::TailMode)((marisa_swig::Trie const *)arg1)->tail_mode();
4077 } catch (const marisa::Exception &ex) {
4078 SWIG_exception(SWIG_RuntimeError, ex.what());
4079 } catch (...) {
4080 SWIG_exception(SWIG_UnknownError,"Unknown exception");
4081 }
4082 }
4083 vresult = SWIG_From_int(static_cast< int >(result));
4084 return vresult;
4085 fail:
4086 return Qnil;
4087 }
4088
4089
4090 SWIGINTERN VALUE
4091 _wrap_Trie_node_order(int argc, VALUE *argv, VALUE self) {
4092 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
4093 void *argp1 = 0 ;
4094 int res1 = 0 ;
4095 marisa_swig::NodeOrder result;
4096 VALUE vresult = Qnil;
4097
4098 if ((argc < 0) || (argc > 0)) {
4099 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4100 }
4101 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4102 if (!SWIG_IsOK(res1)) {
4103 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","node_order", 1, self ));
4104 }
4105 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4106 {
4107 try {
4108 result = (marisa_swig::NodeOrder)((marisa_swig::Trie const *)arg1)->node_order();
4109 } catch (const marisa::Exception &ex) {
4110 SWIG_exception(SWIG_RuntimeError, ex.what());
4111 } catch (...) {
4112 SWIG_exception(SWIG_UnknownError,"Unknown exception");
4113 }
4114 }
4115 vresult = SWIG_From_int(static_cast< int >(result));
4116 return vresult;
4117 fail:
4118 return Qnil;
4119 }
4120
4121
4122
4123 /*
4124 Document-method: Marisa::Trie.empty
4125
4126 call-seq:
4127 empty -> bool
4128
4129 Check if Trie is empty.
4130 */
4131 SWIGINTERN VALUE
4132 _wrap_Trie_empty(int argc, VALUE *argv, VALUE self) {
4133 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
4134 void *argp1 = 0 ;
4135 int res1 = 0 ;
4136 bool result;
4137 VALUE vresult = Qnil;
4138
4139 if ((argc < 0) || (argc > 0)) {
4140 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4141 }
4142 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4143 if (!SWIG_IsOK(res1)) {
4144 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","empty", 1, self ));
4145 }
4146 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4147 {
4148 try {
4149 result = (bool)((marisa_swig::Trie const *)arg1)->empty();
4150 } catch (const marisa::Exception &ex) {
4151 SWIG_exception(SWIG_RuntimeError, ex.what());
4152 } catch (...) {
4153 SWIG_exception(SWIG_UnknownError,"Unknown exception");
4154 }
4155 }
4156 vresult = SWIG_From_bool(static_cast< bool >(result));
4157 return vresult;
4158 fail:
4159 return Qnil;
4160 }
4161
4162
4163
4164 /*
4165 Document-method: Marisa::Trie.size
4166
4167 call-seq:
4168 size -> std::size_t
4169
4170 Size or Length of the Trie.
4171 */
4172 SWIGINTERN VALUE
4173 _wrap_Trie_size(int argc, VALUE *argv, VALUE self) {
4174 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
4175 void *argp1 = 0 ;
4176 int res1 = 0 ;
4177 std::size_t result;
4178 VALUE vresult = Qnil;
4179
4180 if ((argc < 0) || (argc > 0)) {
4181 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4182 }
4183 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4184 if (!SWIG_IsOK(res1)) {
4185 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","size", 1, self ));
4186 }
4187 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4188 {
4189 try {
4190 result = ((marisa_swig::Trie const *)arg1)->size();
4191 } catch (const marisa::Exception &ex) {
4192 SWIG_exception(SWIG_RuntimeError, ex.what());
4193 } catch (...) {
4194 SWIG_exception(SWIG_UnknownError,"Unknown exception");
4195 }
4196 }
4197 vresult = SWIG_From_size_t(static_cast< size_t >(result));
4198 return vresult;
4199 fail:
4200 return Qnil;
4201 }
4202
4203
4204 SWIGINTERN VALUE
4205 _wrap_Trie_total_size(int argc, VALUE *argv, VALUE self) {
4206 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
4207 void *argp1 = 0 ;
4208 int res1 = 0 ;
4209 std::size_t result;
4210 VALUE vresult = Qnil;
4211
4212 if ((argc < 0) || (argc > 0)) {
4213 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4214 }
4215 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4216 if (!SWIG_IsOK(res1)) {
4217 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","total_size", 1, self ));
4218 }
4219 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4220 {
4221 try {
4222 result = ((marisa_swig::Trie const *)arg1)->total_size();
4223 } catch (const marisa::Exception &ex) {
4224 SWIG_exception(SWIG_RuntimeError, ex.what());
4225 } catch (...) {
4226 SWIG_exception(SWIG_UnknownError,"Unknown exception");
4227 }
4228 }
4229 vresult = SWIG_From_size_t(static_cast< size_t >(result));
4230 return vresult;
4231 fail:
4232 return Qnil;
4233 }
4234
4235
4236 SWIGINTERN VALUE
4237 _wrap_Trie_io_size(int argc, VALUE *argv, VALUE self) {
4238 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
4239 void *argp1 = 0 ;
4240 int res1 = 0 ;
4241 std::size_t result;
4242 VALUE vresult = Qnil;
4243
4244 if ((argc < 0) || (argc > 0)) {
4245 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4246 }
4247 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4248 if (!SWIG_IsOK(res1)) {
4249 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie const *","io_size", 1, self ));
4250 }
4251 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4252 {
4253 try {
4254 result = ((marisa_swig::Trie const *)arg1)->io_size();
4255 } catch (const marisa::Exception &ex) {
4256 SWIG_exception(SWIG_RuntimeError, ex.what());
4257 } catch (...) {
4258 SWIG_exception(SWIG_UnknownError,"Unknown exception");
4259 }
4260 }
4261 vresult = SWIG_From_size_t(static_cast< size_t >(result));
4262 return vresult;
4263 fail:
4264 return Qnil;
4265 }
4266
4267
4268 SWIGINTERN VALUE
4269 _wrap_Trie_clear(int argc, VALUE *argv, VALUE self) {
4270 marisa_swig::Trie *arg1 = (marisa_swig::Trie *) 0 ;
4271 void *argp1 = 0 ;
4272 int res1 = 0 ;
4273
4274 if ((argc < 0) || (argc > 0)) {
4275 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4276 }
4277 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_marisa_swig__Trie, 0 | 0 );
4278 if (!SWIG_IsOK(res1)) {
4279 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "marisa_swig::Trie *","clear", 1, self ));
4280 }
4281 arg1 = reinterpret_cast< marisa_swig::Trie * >(argp1);
4282 {
4283 try {
4284 (arg1)->clear();
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 return Qnil;
4292 fail:
4293 return Qnil;
4294 }
4295
4296
4297
4298 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4299
4300 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
4301 static swig_type_info _swigt__p_marisa__Key = {"_p_marisa__Key", "marisa::Key *", 0, 0, (void*)0, 0};
4302 static swig_type_info _swigt__p_marisa_swig__Agent = {"_p_marisa_swig__Agent", "marisa_swig::Agent *", 0, 0, (void*)0, 0};
4303 static swig_type_info _swigt__p_marisa_swig__Key = {"_p_marisa_swig__Key", "marisa_swig::Key *", 0, 0, (void*)0, 0};
4304 static swig_type_info _swigt__p_marisa_swig__Keyset = {"_p_marisa_swig__Keyset", "marisa_swig::Keyset *", 0, 0, (void*)0, 0};
4305 static swig_type_info _swigt__p_marisa_swig__Query = {"_p_marisa_swig__Query", "marisa_swig::Query *", 0, 0, (void*)0, 0};
4306 static swig_type_info _swigt__p_marisa_swig__Trie = {"_p_marisa_swig__Trie", "marisa_swig::Trie *", 0, 0, (void*)0, 0};
4307 static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
4308 static swig_type_info _swigt__p_std__size_t = {"_p_std__size_t", "std::size_t *", 0, 0, (void*)0, 0};
4309
4310 static swig_type_info *swig_type_initial[] = {
4311 &_swigt__p_char,
4312 &_swigt__p_marisa__Key,
4313 &_swigt__p_marisa_swig__Agent,
4314 &_swigt__p_marisa_swig__Key,
4315 &_swigt__p_marisa_swig__Keyset,
4316 &_swigt__p_marisa_swig__Query,
4317 &_swigt__p_marisa_swig__Trie,
4318 &_swigt__p_p_char,
4319 &_swigt__p_std__size_t,
4320 };
4321
4322 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
4323 static swig_cast_info _swigc__p_marisa__Key[] = { {&_swigt__p_marisa__Key, 0, 0, 0},{0, 0, 0, 0}};
4324 static swig_cast_info _swigc__p_marisa_swig__Agent[] = { {&_swigt__p_marisa_swig__Agent, 0, 0, 0},{0, 0, 0, 0}};
4325 static swig_cast_info _swigc__p_marisa_swig__Key[] = { {&_swigt__p_marisa_swig__Key, 0, 0, 0},{0, 0, 0, 0}};
4326 static swig_cast_info _swigc__p_marisa_swig__Keyset[] = { {&_swigt__p_marisa_swig__Keyset, 0, 0, 0},{0, 0, 0, 0}};
4327 static swig_cast_info _swigc__p_marisa_swig__Query[] = { {&_swigt__p_marisa_swig__Query, 0, 0, 0},{0, 0, 0, 0}};
4328 static swig_cast_info _swigc__p_marisa_swig__Trie[] = { {&_swigt__p_marisa_swig__Trie, 0, 0, 0},{0, 0, 0, 0}};
4329 static swig_cast_info _swigc__p_p_char[] = { {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
4330 static swig_cast_info _swigc__p_std__size_t[] = { {&_swigt__p_std__size_t, 0, 0, 0},{0, 0, 0, 0}};
4331
4332 static swig_cast_info *swig_cast_initial[] = {
4333 _swigc__p_char,
4334 _swigc__p_marisa__Key,
4335 _swigc__p_marisa_swig__Agent,
4336 _swigc__p_marisa_swig__Key,
4337 _swigc__p_marisa_swig__Keyset,
4338 _swigc__p_marisa_swig__Query,
4339 _swigc__p_marisa_swig__Trie,
4340 _swigc__p_p_char,
4341 _swigc__p_std__size_t,
4342 };
4343
4344
4345 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
4346
4347 /* -----------------------------------------------------------------------------
4348 * Type initialization:
4349 * This problem is tough by the requirement that no dynamic
4350 * memory is used. Also, since swig_type_info structures store pointers to
4351 * swig_cast_info structures and swig_cast_info structures store pointers back
4352 * to swig_type_info structures, we need some lookup code at initialization.
4353 * The idea is that swig generates all the structures that are needed.
4354 * The runtime then collects these partially filled structures.
4355 * The SWIG_InitializeModule function takes these initial arrays out of
4356 * swig_module, and does all the lookup, filling in the swig_module.types
4357 * array with the correct data and linking the correct swig_cast_info
4358 * structures together.
4359 *
4360 * The generated swig_type_info structures are assigned staticly to an initial
4361 * array. We just loop through that array, and handle each type individually.
4362 * First we lookup if this type has been already loaded, and if so, use the
4363 * loaded structure instead of the generated one. Then we have to fill in the
4364 * cast linked list. The cast data is initially stored in something like a
4365 * two-dimensional array. Each row corresponds to a type (there are the same
4366 * number of rows as there are in the swig_type_initial array). Each entry in
4367 * a column is one of the swig_cast_info structures for that type.
4368 * The cast_initial array is actually an array of arrays, because each row has
4369 * a variable number of columns. So to actually build the cast linked list,
4370 * we find the array of casts associated with the type, and loop through it
4371 * adding the casts to the list. The one last trick we need to do is making
4372 * sure the type pointer in the swig_cast_info struct is correct.
4373 *
4374 * First off, we lookup the cast->type name to see if it is already loaded.
4375 * There are three cases to handle:
4376 * 1) If the cast->type has already been loaded AND the type we are adding
4377 * casting info to has not been loaded (it is in this module), THEN we
4378 * replace the cast->type pointer with the type pointer that has already
4379 * been loaded.
4380 * 2) If BOTH types (the one we are adding casting info to, and the
4381 * cast->type) are loaded, THEN the cast info has already been loaded by
4382 * the previous module so we just ignore it.
4383 * 3) Finally, if cast->type has not already been loaded, then we add that
4384 * swig_cast_info to the linked list (because the cast->type) pointer will
4385 * be correct.
4386 * ----------------------------------------------------------------------------- */
4387
4388 #ifdef __cplusplus
4389 extern "C" {
4390 #if 0
4391 } /* c-mode */
4392 #endif
4393 #endif
4394
4395 #if 0
4396 #define SWIGRUNTIME_DEBUG
4397 #endif
4398
4399
4400 SWIGRUNTIME void
4401 SWIG_InitializeModule(void *clientdata) {
4402 size_t i;
4403 swig_module_info *module_head, *iter;
4404 int found, init;
4405
4406 clientdata = clientdata;
4407
4408 /* check to see if the circular list has been setup, if not, set it up */
4409 if (swig_module.next==0) {
4410 /* Initialize the swig_module */
4411 swig_module.type_initial = swig_type_initial;
4412 swig_module.cast_initial = swig_cast_initial;
4413 swig_module.next = &swig_module;
4414 init = 1;
4415 } else {
4416 init = 0;
4417 }
4418
4419 /* Try and load any already created modules */
4420 module_head = SWIG_GetModule(clientdata);
4421 if (!module_head) {
4422 /* This is the first module loaded for this interpreter */
4423 /* so set the swig module into the interpreter */
4424 SWIG_SetModule(clientdata, &swig_module);
4425 module_head = &swig_module;
4426 } else {
4427 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
4428 found=0;
4429 iter=module_head;
4430 do {
4431 if (iter==&swig_module) {
4432 found=1;
4433 break;
4434 }
4435 iter=iter->next;
4436 } while (iter!= module_head);
4437
4438 /* if the is found in the list, then all is done and we may leave */
4439 if (found) return;
4440 /* otherwise we must add out module into the list */
4441 swig_module.next = module_head->next;
4442 module_head->next = &swig_module;
4443 }
4444
4445 /* When multiple interpeters are used, a module could have already been initialized in
4446 a different interpreter, but not yet have a pointer in this interpreter.
4447 In this case, we do not want to continue adding types... everything should be
4448 set up already */
4449 if (init == 0) return;
4450
4451 /* Now work on filling in swig_module.types */
4452 #ifdef SWIGRUNTIME_DEBUG
4453 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
4454 #endif
4455 for (i = 0; i < swig_module.size; ++i) {
4456 swig_type_info *type = 0;
4457 swig_type_info *ret;
4458 swig_cast_info *cast;
4459
4460 #ifdef SWIGRUNTIME_DEBUG
4461 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
4462 #endif
4463
4464 /* if there is another module already loaded */
4465 if (swig_module.next != &swig_module) {
4466 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
4467 }
4468 if (type) {
4469 /* Overwrite clientdata field */
4470 #ifdef SWIGRUNTIME_DEBUG
4471 printf("SWIG_InitializeModule: found type %s\n", type->name);
4472 #endif
4473 if (swig_module.type_initial[i]->clientdata) {
4474 type->clientdata = swig_module.type_initial[i]->clientdata;
4475 #ifdef SWIGRUNTIME_DEBUG
4476 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
4477 #endif
4478 }
4479 } else {
4480 type = swig_module.type_initial[i];
4481 }
4482
4483 /* Insert casting types */
4484 cast = swig_module.cast_initial[i];
4485 while (cast->type) {
4486
4487 /* Don't need to add information already in the list */
4488 ret = 0;
4489 #ifdef SWIGRUNTIME_DEBUG
4490 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
4491 #endif
4492 if (swig_module.next != &swig_module) {
4493 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
4494 #ifdef SWIGRUNTIME_DEBUG
4495 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
4496 #endif
4497 }
4498 if (ret) {
4499 if (type == swig_module.type_initial[i]) {
4500 #ifdef SWIGRUNTIME_DEBUG
4501 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
4502 #endif
4503 cast->type = ret;
4504 ret = 0;
4505 } else {
4506 /* Check for casting already in the list */
4507 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
4508 #ifdef SWIGRUNTIME_DEBUG
4509 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
4510 #endif
4511 if (!ocast) ret = 0;
4512 }
4513 }
4514
4515 if (!ret) {
4516 #ifdef SWIGRUNTIME_DEBUG
4517 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
4518 #endif
4519 if (type->cast) {
4520 type->cast->prev = cast;
4521 cast->next = type->cast;
4522 }
4523 type->cast = cast;
4524 }
4525 cast++;
4526 }
4527 /* Set entry in modules->types array equal to the type */
4528 swig_module.types[i] = type;
4529 }
4530 swig_module.types[i] = 0;
4531
4532 #ifdef SWIGRUNTIME_DEBUG
4533 printf("**** SWIG_InitializeModule: Cast List ******\n");
4534 for (i = 0; i < swig_module.size; ++i) {
4535 int j = 0;
4536 swig_cast_info *cast = swig_module.cast_initial[i];
4537 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
4538 while (cast->type) {
4539 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
4540 cast++;
4541 ++j;
4542 }
4543 printf("---- Total casts: %d\n",j);
4544 }
4545 printf("**** SWIG_InitializeModule: Cast List ******\n");
4546 #endif
4547 }
4548
4549 /* This function will propagate the clientdata field of type to
4550 * any new swig_type_info structures that have been added into the list
4551 * of equivalent types. It is like calling
4552 * SWIG_TypeClientData(type, clientdata) a second time.
4553 */
4554 SWIGRUNTIME void
4555 SWIG_PropagateClientData(void) {
4556 size_t i;
4557 swig_cast_info *equiv;
4558 static int init_run = 0;
4559
4560 if (init_run) return;
4561 init_run = 1;
4562
4563 for (i = 0; i < swig_module.size; i++) {
4564 if (swig_module.types[i]->clientdata) {
4565 equiv = swig_module.types[i]->cast;
4566 while (equiv) {
4567 if (!equiv->converter) {
4568 if (equiv->type && !equiv->type->clientdata)
4569 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
4570 }
4571 equiv = equiv->next;
4572 }
4573 }
4574 }
4575 }
4576
4577 #ifdef __cplusplus
4578 #if 0
4579 { /* c-mode */
4580 #endif
4581 }
4582 #endif
4583
4584 /*
4585
4586 */
4587 #ifdef __cplusplus
4588 extern "C"
4589 #endif
4590 SWIGEXPORT void Init_marisa(void) {
4591 size_t i;
4592
4593 SWIG_InitRuntime();
4594 mMarisa = rb_define_module("Marisa");
4595
4596 SWIG_InitializeModule(0);
4597 for (i = 0; i < swig_module.size; i++) {
4598 SWIG_define_class(swig_module.types[i]);
4599 }
4600
4601 SWIG_RubyInitializeTrackings();
4602 rb_define_const(mMarisa, "OK", SWIG_From_int(static_cast< int >(marisa_swig::OK)));
4603 rb_define_const(mMarisa, "STATE_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::STATE_ERROR)));
4604 rb_define_const(mMarisa, "NULL_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::NULL_ERROR)));
4605 rb_define_const(mMarisa, "BOUND_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::BOUND_ERROR)));
4606 rb_define_const(mMarisa, "RANGE_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::RANGE_ERROR)));
4607 rb_define_const(mMarisa, "CODE_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::CODE_ERROR)));
4608 rb_define_const(mMarisa, "RESET_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::RESET_ERROR)));
4609 rb_define_const(mMarisa, "SIZE_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::SIZE_ERROR)));
4610 rb_define_const(mMarisa, "MEMORY_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::MEMORY_ERROR)));
4611 rb_define_const(mMarisa, "IO_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::IO_ERROR)));
4612 rb_define_const(mMarisa, "FORMAT_ERROR", SWIG_From_int(static_cast< int >(marisa_swig::FORMAT_ERROR)));
4613 rb_define_const(mMarisa, "MIN_NUM_TRIES", SWIG_From_int(static_cast< int >(marisa_swig::MIN_NUM_TRIES)));
4614 rb_define_const(mMarisa, "MAX_NUM_TRIES", SWIG_From_int(static_cast< int >(marisa_swig::MAX_NUM_TRIES)));
4615 rb_define_const(mMarisa, "DEFAULT_NUM_TRIES", SWIG_From_int(static_cast< int >(marisa_swig::DEFAULT_NUM_TRIES)));
4616 rb_define_const(mMarisa, "HUGE_CACHE", SWIG_From_int(static_cast< int >(marisa_swig::HUGE_CACHE)));
4617 rb_define_const(mMarisa, "LARGE_CACHE", SWIG_From_int(static_cast< int >(marisa_swig::LARGE_CACHE)));
4618 rb_define_const(mMarisa, "NORMAL_CACHE", SWIG_From_int(static_cast< int >(marisa_swig::NORMAL_CACHE)));
4619 rb_define_const(mMarisa, "SMALL_CACHE", SWIG_From_int(static_cast< int >(marisa_swig::SMALL_CACHE)));
4620 rb_define_const(mMarisa, "TINY_CACHE", SWIG_From_int(static_cast< int >(marisa_swig::TINY_CACHE)));
4621 rb_define_const(mMarisa, "DEFAULT_CACHE", SWIG_From_int(static_cast< int >(marisa_swig::DEFAULT_CACHE)));
4622 rb_define_const(mMarisa, "TEXT_TAIL", SWIG_From_int(static_cast< int >(marisa_swig::TEXT_TAIL)));
4623 rb_define_const(mMarisa, "BINARY_TAIL", SWIG_From_int(static_cast< int >(marisa_swig::BINARY_TAIL)));
4624 rb_define_const(mMarisa, "DEFAULT_TAIL", SWIG_From_int(static_cast< int >(marisa_swig::DEFAULT_TAIL)));
4625 rb_define_const(mMarisa, "LABEL_ORDER", SWIG_From_int(static_cast< int >(marisa_swig::LABEL_ORDER)));
4626 rb_define_const(mMarisa, "WEIGHT_ORDER", SWIG_From_int(static_cast< int >(marisa_swig::WEIGHT_ORDER)));
4627 rb_define_const(mMarisa, "DEFAULT_ORDER", SWIG_From_int(static_cast< int >(marisa_swig::DEFAULT_ORDER)));
4628
4629 SwigClassKey.klass = rb_define_class_under(mMarisa, "Key", rb_cObject);
4630 SWIG_TypeClientData(SWIGTYPE_p_marisa_swig__Key, (void *) &SwigClassKey);
4631 rb_undef_alloc_func(SwigClassKey.klass);
4632 rb_define_method(SwigClassKey.klass, "str", VALUEFUNC(_wrap_Key_str), -1);
4633 rb_define_method(SwigClassKey.klass, "id", VALUEFUNC(_wrap_Key_id), -1);
4634 rb_define_method(SwigClassKey.klass, "weight", VALUEFUNC(_wrap_Key_weight), -1);
4635 SwigClassKey.mark = 0;
4636 SwigClassKey.destroy = (void (*)(void *)) free_marisa_swig_Key;
4637 SwigClassKey.trackObjects = 0;
4638
4639 SwigClassQuery.klass = rb_define_class_under(mMarisa, "Query", rb_cObject);
4640 SWIG_TypeClientData(SWIGTYPE_p_marisa_swig__Query, (void *) &SwigClassQuery);
4641 rb_undef_alloc_func(SwigClassQuery.klass);
4642 rb_define_method(SwigClassQuery.klass, "str", VALUEFUNC(_wrap_Query_str), -1);
4643 rb_define_method(SwigClassQuery.klass, "id", VALUEFUNC(_wrap_Query_id), -1);
4644 SwigClassQuery.mark = 0;
4645 SwigClassQuery.destroy = (void (*)(void *)) free_marisa_swig_Query;
4646 SwigClassQuery.trackObjects = 0;
4647
4648 SwigClassKeyset.klass = rb_define_class_under(mMarisa, "Keyset", rb_cObject);
4649 SWIG_TypeClientData(SWIGTYPE_p_marisa_swig__Keyset, (void *) &SwigClassKeyset);
4650 rb_define_alloc_func(SwigClassKeyset.klass, _wrap_Keyset_allocate);
4651 rb_define_method(SwigClassKeyset.klass, "initialize", VALUEFUNC(_wrap_new_Keyset), -1);
4652 rb_define_method(SwigClassKeyset.klass, "push_back", VALUEFUNC(_wrap_Keyset_push_back), -1);
4653 rb_define_method(SwigClassKeyset.klass, "key", VALUEFUNC(_wrap_Keyset_key), -1);
4654 rb_define_method(SwigClassKeyset.klass, "key_str", VALUEFUNC(_wrap_Keyset_key_str), -1);
4655 rb_define_method(SwigClassKeyset.klass, "key_id", VALUEFUNC(_wrap_Keyset_key_id), -1);
4656 rb_define_method(SwigClassKeyset.klass, "num_keys", VALUEFUNC(_wrap_Keyset_num_keys), -1);
4657 rb_define_method(SwigClassKeyset.klass, "empty", VALUEFUNC(_wrap_Keyset_empty), -1);
4658 rb_define_method(SwigClassKeyset.klass, "size", VALUEFUNC(_wrap_Keyset_size), -1);
4659 rb_define_method(SwigClassKeyset.klass, "total_length", VALUEFUNC(_wrap_Keyset_total_length), -1);
4660 rb_define_method(SwigClassKeyset.klass, "reset", VALUEFUNC(_wrap_Keyset_reset), -1);
4661 rb_define_method(SwigClassKeyset.klass, "clear", VALUEFUNC(_wrap_Keyset_clear), -1);
4662 SwigClassKeyset.mark = 0;
4663 SwigClassKeyset.destroy = (void (*)(void *)) free_marisa_swig_Keyset;
4664 SwigClassKeyset.trackObjects = 0;
4665
4666 SwigClassAgent.klass = rb_define_class_under(mMarisa, "Agent", rb_cObject);
4667 SWIG_TypeClientData(SWIGTYPE_p_marisa_swig__Agent, (void *) &SwigClassAgent);
4668 rb_define_alloc_func(SwigClassAgent.klass, _wrap_Agent_allocate);
4669 rb_define_method(SwigClassAgent.klass, "initialize", VALUEFUNC(_wrap_new_Agent), -1);
4670 rb_define_method(SwigClassAgent.klass, "set_query", VALUEFUNC(_wrap_Agent_set_query), -1);
4671 rb_define_method(SwigClassAgent.klass, "key", VALUEFUNC(_wrap_Agent_key), -1);
4672 rb_define_method(SwigClassAgent.klass, "query", VALUEFUNC(_wrap_Agent_query), -1);
4673 rb_define_method(SwigClassAgent.klass, "key_str", VALUEFUNC(_wrap_Agent_key_str), -1);
4674 rb_define_method(SwigClassAgent.klass, "key_id", VALUEFUNC(_wrap_Agent_key_id), -1);
4675 rb_define_method(SwigClassAgent.klass, "query_str", VALUEFUNC(_wrap_Agent_query_str), -1);
4676 rb_define_method(SwigClassAgent.klass, "query_id", VALUEFUNC(_wrap_Agent_query_id), -1);
4677 SwigClassAgent.mark = 0;
4678 SwigClassAgent.destroy = (void (*)(void *)) free_marisa_swig_Agent;
4679 SwigClassAgent.trackObjects = 0;
4680
4681 SwigClassTrie.klass = rb_define_class_under(mMarisa, "Trie", rb_cObject);
4682 SWIG_TypeClientData(SWIGTYPE_p_marisa_swig__Trie, (void *) &SwigClassTrie);
4683 rb_define_alloc_func(SwigClassTrie.klass, _wrap_Trie_allocate);
4684 rb_define_method(SwigClassTrie.klass, "initialize", VALUEFUNC(_wrap_new_Trie), -1);
4685 rb_define_method(SwigClassTrie.klass, "build", VALUEFUNC(_wrap_Trie_build), -1);
4686 rb_define_method(SwigClassTrie.klass, "mmap", VALUEFUNC(_wrap_Trie_mmap), -1);
4687 rb_define_method(SwigClassTrie.klass, "load", VALUEFUNC(_wrap_Trie_load), -1);
4688 rb_define_method(SwigClassTrie.klass, "save", VALUEFUNC(_wrap_Trie_save), -1);
4689 rb_define_method(SwigClassTrie.klass, "common_prefix_search", VALUEFUNC(_wrap_Trie_common_prefix_search), -1);
4690 rb_define_method(SwigClassTrie.klass, "predictive_search", VALUEFUNC(_wrap_Trie_predictive_search), -1);
4691 rb_define_method(SwigClassTrie.klass, "lookup", VALUEFUNC(_wrap_Trie_lookup), -1);
4692 rb_define_method(SwigClassTrie.klass, "reverse_lookup", VALUEFUNC(_wrap_Trie_reverse_lookup), -1);
4693 rb_define_method(SwigClassTrie.klass, "num_tries", VALUEFUNC(_wrap_Trie_num_tries), -1);
4694 rb_define_method(SwigClassTrie.klass, "num_keys", VALUEFUNC(_wrap_Trie_num_keys), -1);
4695 rb_define_method(SwigClassTrie.klass, "num_nodes", VALUEFUNC(_wrap_Trie_num_nodes), -1);
4696 rb_define_method(SwigClassTrie.klass, "tail_mode", VALUEFUNC(_wrap_Trie_tail_mode), -1);
4697 rb_define_method(SwigClassTrie.klass, "node_order", VALUEFUNC(_wrap_Trie_node_order), -1);
4698 rb_define_method(SwigClassTrie.klass, "empty", VALUEFUNC(_wrap_Trie_empty), -1);
4699 rb_define_method(SwigClassTrie.klass, "size", VALUEFUNC(_wrap_Trie_size), -1);
4700 rb_define_method(SwigClassTrie.klass, "total_size", VALUEFUNC(_wrap_Trie_total_size), -1);
4701 rb_define_method(SwigClassTrie.klass, "io_size", VALUEFUNC(_wrap_Trie_io_size), -1);
4702 rb_define_method(SwigClassTrie.klass, "clear", VALUEFUNC(_wrap_Trie_clear), -1);
4703 SwigClassTrie.mark = 0;
4704 SwigClassTrie.destroy = (void (*)(void *)) free_marisa_swig_Trie;
4705 SwigClassTrie.trackObjects = 0;
4706 rb_define_const(mMarisa, "INVALID_KEY_ID", SWIG_From_size_t(static_cast< size_t >(MARISA_INVALID_KEY_ID)));
4707 }
4708
4709