1 /* ----------------------------------------------------------------------------
2 * This file was automatically generated by SWIG (http://www.swig.org).
3 * Version 3.0.10
4 *
5 * This file is not intended to be easily readable and contains a number of
6 * coding conventions designed to improve portability and efficiency. Do not make
7 * changes to this file unless you know what you are doing--modify the SWIG
8 * interface file instead.
9 * ----------------------------------------------------------------------------- */
10
11
12 #ifndef SWIGRUBY
13 #define SWIGRUBY
14 #endif
15
16
17
18 #ifdef __cplusplus
19 /* SwigValueWrapper is described in swig.swg */
20 template<typename T> class SwigValueWrapper {
21 struct SwigMovePointer {
22 T *ptr;
SwigMovePointerSwigValueWrapper::SwigMovePointer23 SwigMovePointer(T *p) : ptr(p) { }
~SwigMovePointerSwigValueWrapper::SwigMovePointer24 ~SwigMovePointer() { delete ptr; }
operator =SwigValueWrapper::SwigMovePointer25 SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
26 } pointer;
27 SwigValueWrapper& operator=(const SwigValueWrapper<T>& rhs);
28 SwigValueWrapper(const SwigValueWrapper<T>& rhs);
29 public:
SwigValueWrapper()30 SwigValueWrapper() : pointer(0) { }
operator =(const T & t)31 SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
operator T&() const32 operator T&() const { return *pointer.ptr; }
operator &()33 T *operator&() { return pointer.ptr; }
34 };
35
SwigValueInit()36 template <typename T> T SwigValueInit() {
37 return T();
38 }
39 #endif
40
41 /* -----------------------------------------------------------------------------
42 * This section contains generic SWIG labels for method/variable
43 * declarations/attributes, and other compiler dependent labels.
44 * ----------------------------------------------------------------------------- */
45
46 /* template workaround for compilers that cannot correctly implement the C++ standard */
47 #ifndef SWIGTEMPLATEDISAMBIGUATOR
48 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
49 # define SWIGTEMPLATEDISAMBIGUATOR template
50 # elif defined(__HP_aCC)
51 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
52 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
53 # define SWIGTEMPLATEDISAMBIGUATOR template
54 # else
55 # define SWIGTEMPLATEDISAMBIGUATOR
56 # endif
57 #endif
58
59 /* inline attribute */
60 #ifndef SWIGINLINE
61 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
62 # define SWIGINLINE inline
63 # else
64 # define SWIGINLINE
65 # endif
66 #endif
67
68 /* attribute recognised by some compilers to avoid 'unused' warnings */
69 #ifndef SWIGUNUSED
70 # if defined(__GNUC__)
71 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
72 # define SWIGUNUSED __attribute__ ((__unused__))
73 # else
74 # define SWIGUNUSED
75 # endif
76 # elif defined(__ICC)
77 # define SWIGUNUSED __attribute__ ((__unused__))
78 # else
79 # define SWIGUNUSED
80 # endif
81 #endif
82
83 #ifndef SWIG_MSC_UNSUPPRESS_4505
84 # if defined(_MSC_VER)
85 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
86 # endif
87 #endif
88
89 #ifndef SWIGUNUSEDPARM
90 # ifdef __cplusplus
91 # define SWIGUNUSEDPARM(p)
92 # else
93 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
94 # endif
95 #endif
96
97 /* internal SWIG method */
98 #ifndef SWIGINTERN
99 # define SWIGINTERN static SWIGUNUSED
100 #endif
101
102 /* internal inline SWIG method */
103 #ifndef SWIGINTERNINLINE
104 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
105 #endif
106
107 /* exporting methods */
108 #if defined(__GNUC__)
109 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
110 # ifndef GCC_HASCLASSVISIBILITY
111 # define GCC_HASCLASSVISIBILITY
112 # endif
113 # endif
114 #endif
115
116 #ifndef SWIGEXPORT
117 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
118 # if defined(STATIC_LINKED)
119 # define SWIGEXPORT
120 # else
121 # define SWIGEXPORT __declspec(dllexport)
122 # endif
123 # else
124 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
125 # define SWIGEXPORT __attribute__ ((visibility("default")))
126 # else
127 # define SWIGEXPORT
128 # endif
129 # endif
130 #endif
131
132 /* calling conventions for Windows */
133 #ifndef SWIGSTDCALL
134 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
135 # define SWIGSTDCALL __stdcall
136 # else
137 # define SWIGSTDCALL
138 # endif
139 #endif
140
141 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
142 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
143 # define _CRT_SECURE_NO_DEPRECATE
144 #endif
145
146 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
147 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
148 # define _SCL_SECURE_NO_DEPRECATE
149 #endif
150
151 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
152 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
153 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
154 #endif
155
156 /* Intel's compiler complains if a variable which was never initialised is
157 * cast to void, which is a common idiom which we use to indicate that we
158 * are aware a variable isn't used. So we just silence that warning.
159 * See: https://github.com/swig/swig/issues/192 for more discussion.
160 */
161 #ifdef __INTEL_COMPILER
162 # pragma warning disable 592
163 #endif
164
165 /* -----------------------------------------------------------------------------
166 * This section contains generic SWIG labels for method/variable
167 * declarations/attributes, and other compiler dependent labels.
168 * ----------------------------------------------------------------------------- */
169
170 /* template workaround for compilers that cannot correctly implement the C++ standard */
171 #ifndef SWIGTEMPLATEDISAMBIGUATOR
172 # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
173 # define SWIGTEMPLATEDISAMBIGUATOR template
174 # elif defined(__HP_aCC)
175 /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
176 /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
177 # define SWIGTEMPLATEDISAMBIGUATOR template
178 # else
179 # define SWIGTEMPLATEDISAMBIGUATOR
180 # endif
181 #endif
182
183 /* inline attribute */
184 #ifndef SWIGINLINE
185 # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
186 # define SWIGINLINE inline
187 # else
188 # define SWIGINLINE
189 # endif
190 #endif
191
192 /* attribute recognised by some compilers to avoid 'unused' warnings */
193 #ifndef SWIGUNUSED
194 # if defined(__GNUC__)
195 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
196 # define SWIGUNUSED __attribute__ ((__unused__))
197 # else
198 # define SWIGUNUSED
199 # endif
200 # elif defined(__ICC)
201 # define SWIGUNUSED __attribute__ ((__unused__))
202 # else
203 # define SWIGUNUSED
204 # endif
205 #endif
206
207 #ifndef SWIG_MSC_UNSUPPRESS_4505
208 # if defined(_MSC_VER)
209 # pragma warning(disable : 4505) /* unreferenced local function has been removed */
210 # endif
211 #endif
212
213 #ifndef SWIGUNUSEDPARM
214 # ifdef __cplusplus
215 # define SWIGUNUSEDPARM(p)
216 # else
217 # define SWIGUNUSEDPARM(p) p SWIGUNUSED
218 # endif
219 #endif
220
221 /* internal SWIG method */
222 #ifndef SWIGINTERN
223 # define SWIGINTERN static SWIGUNUSED
224 #endif
225
226 /* internal inline SWIG method */
227 #ifndef SWIGINTERNINLINE
228 # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
229 #endif
230
231 /* exporting methods */
232 #if defined(__GNUC__)
233 # if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
234 # ifndef GCC_HASCLASSVISIBILITY
235 # define GCC_HASCLASSVISIBILITY
236 # endif
237 # endif
238 #endif
239
240 #ifndef SWIGEXPORT
241 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
242 # if defined(STATIC_LINKED)
243 # define SWIGEXPORT
244 # else
245 # define SWIGEXPORT __declspec(dllexport)
246 # endif
247 # else
248 # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
249 # define SWIGEXPORT __attribute__ ((visibility("default")))
250 # else
251 # define SWIGEXPORT
252 # endif
253 # endif
254 #endif
255
256 /* calling conventions for Windows */
257 #ifndef SWIGSTDCALL
258 # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
259 # define SWIGSTDCALL __stdcall
260 # else
261 # define SWIGSTDCALL
262 # endif
263 #endif
264
265 /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
266 #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
267 # define _CRT_SECURE_NO_DEPRECATE
268 #endif
269
270 /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
271 #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
272 # define _SCL_SECURE_NO_DEPRECATE
273 #endif
274
275 /* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
276 #if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
277 # define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
278 #endif
279
280 /* Intel's compiler complains if a variable which was never initialised is
281 * cast to void, which is a common idiom which we use to indicate that we
282 * are aware a variable isn't used. So we just silence that warning.
283 * See: https://github.com/swig/swig/issues/192 for more discussion.
284 */
285 #ifdef __INTEL_COMPILER
286 # pragma warning disable 592
287 #endif
288
289 /* -----------------------------------------------------------------------------
290 * swigrun.swg
291 *
292 * This file contains generic C API SWIG runtime support for pointer
293 * type checking.
294 * ----------------------------------------------------------------------------- */
295
296 /* This should only be incremented when either the layout of swig_type_info changes,
297 or for whatever reason, the runtime changes incompatibly */
298 #define SWIG_RUNTIME_VERSION "4"
299
300 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
301 #ifdef SWIG_TYPE_TABLE
302 # define SWIG_QUOTE_STRING(x) #x
303 # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
304 # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
305 #else
306 # define SWIG_TYPE_TABLE_NAME
307 #endif
308
309 /*
310 You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
311 creating a static or dynamic library from the SWIG runtime code.
312 In 99.9% of the cases, SWIG just needs to declare them as 'static'.
313
314 But only do this if strictly necessary, ie, if you have problems
315 with your compiler or suchlike.
316 */
317
318 #ifndef SWIGRUNTIME
319 # define SWIGRUNTIME SWIGINTERN
320 #endif
321
322 #ifndef SWIGRUNTIMEINLINE
323 # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
324 #endif
325
326 /* Generic buffer size */
327 #ifndef SWIG_BUFFER_SIZE
328 # define SWIG_BUFFER_SIZE 1024
329 #endif
330
331 /* Flags for pointer conversions */
332 #define SWIG_POINTER_DISOWN 0x1
333 #define SWIG_CAST_NEW_MEMORY 0x2
334
335 /* Flags for new pointer objects */
336 #define SWIG_POINTER_OWN 0x1
337
338
339 /*
340 Flags/methods for returning states.
341
342 The SWIG conversion methods, as ConvertPtr, return an integer
343 that tells if the conversion was successful or not. And if not,
344 an error code can be returned (see swigerrors.swg for the codes).
345
346 Use the following macros/flags to set or process the returning
347 states.
348
349 In old versions of SWIG, code such as the following was usually written:
350
351 if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
352 // success code
353 } else {
354 //fail code
355 }
356
357 Now you can be more explicit:
358
359 int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
360 if (SWIG_IsOK(res)) {
361 // success code
362 } else {
363 // fail code
364 }
365
366 which is the same really, but now you can also do
367
368 Type *ptr;
369 int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
370 if (SWIG_IsOK(res)) {
371 // success code
372 if (SWIG_IsNewObj(res) {
373 ...
374 delete *ptr;
375 } else {
376 ...
377 }
378 } else {
379 // fail code
380 }
381
382 I.e., now SWIG_ConvertPtr can return new objects and you can
383 identify the case and take care of the deallocation. Of course that
384 also requires SWIG_ConvertPtr to return new result values, such as
385
386 int SWIG_ConvertPtr(obj, ptr,...) {
387 if (<obj is ok>) {
388 if (<need new object>) {
389 *ptr = <ptr to new allocated object>;
390 return SWIG_NEWOBJ;
391 } else {
392 *ptr = <ptr to old object>;
393 return SWIG_OLDOBJ;
394 }
395 } else {
396 return SWIG_BADOBJ;
397 }
398 }
399
400 Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
401 more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
402 SWIG errors code.
403
404 Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
405 allows to return the 'cast rank', for example, if you have this
406
407 int food(double)
408 int fooi(int);
409
410 and you call
411
412 food(1) // cast rank '1' (1 -> 1.0)
413 fooi(1) // cast rank '0'
414
415 just use the SWIG_AddCast()/SWIG_CheckState()
416 */
417
418 #define SWIG_OK (0)
419 #define SWIG_ERROR (-1)
420 #define SWIG_IsOK(r) (r >= 0)
421 #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
422
423 /* The CastRankLimit says how many bits are used for the cast rank */
424 #define SWIG_CASTRANKLIMIT (1 << 8)
425 /* The NewMask denotes the object was created (using new/malloc) */
426 #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
427 /* The TmpMask is for in/out typemaps that use temporal objects */
428 #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
429 /* Simple returning values */
430 #define SWIG_BADOBJ (SWIG_ERROR)
431 #define SWIG_OLDOBJ (SWIG_OK)
432 #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
433 #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
434 /* Check, add and del mask methods */
435 #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
436 #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
437 #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
438 #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
439 #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
440 #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
441
442 /* Cast-Rank Mode */
443 #if defined(SWIG_CASTRANK_MODE)
444 # ifndef SWIG_TypeRank
445 # define SWIG_TypeRank unsigned long
446 # endif
447 # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
448 # define SWIG_MAXCASTRANK (2)
449 # endif
450 # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
451 # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIG_AddCast(int r)452 SWIGINTERNINLINE int SWIG_AddCast(int r) {
453 return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
454 }
SWIG_CheckState(int r)455 SWIGINTERNINLINE int SWIG_CheckState(int r) {
456 return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
457 }
458 #else /* no cast-rank mode */
459 # define SWIG_AddCast(r) (r)
460 # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
461 #endif
462
463
464 #include <string.h>
465
466 #ifdef __cplusplus
467 extern "C" {
468 #endif
469
470 typedef void *(*swig_converter_func)(void *, int *);
471 typedef struct swig_type_info *(*swig_dycast_func)(void **);
472
473 /* Structure to store information on one type */
474 typedef struct swig_type_info {
475 const char *name; /* mangled name of this type */
476 const char *str; /* human readable name of this type */
477 swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
478 struct swig_cast_info *cast; /* linked list of types that can cast into this type */
479 void *clientdata; /* language specific type data */
480 int owndata; /* flag if the structure owns the clientdata */
481 } swig_type_info;
482
483 /* Structure to store a type and conversion function used for casting */
484 typedef struct swig_cast_info {
485 swig_type_info *type; /* pointer to type that is equivalent to this type */
486 swig_converter_func converter; /* function to cast the void pointers */
487 struct swig_cast_info *next; /* pointer to next cast in linked list */
488 struct swig_cast_info *prev; /* pointer to the previous cast */
489 } swig_cast_info;
490
491 /* Structure used to store module information
492 * Each module generates one structure like this, and the runtime collects
493 * all of these structures and stores them in a circularly linked list.*/
494 typedef struct swig_module_info {
495 swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
496 size_t size; /* Number of types in this module */
497 struct swig_module_info *next; /* Pointer to next element in circularly linked list */
498 swig_type_info **type_initial; /* Array of initially generated type structures */
499 swig_cast_info **cast_initial; /* Array of initially generated casting structures */
500 void *clientdata; /* Language specific module data */
501 } swig_module_info;
502
503 /*
504 Compare two type names skipping the space characters, therefore
505 "char*" == "char *" and "Class<int>" == "Class<int >", etc.
506
507 Return 0 when the two name types are equivalent, as in
508 strncmp, but skipping ' '.
509 */
510 SWIGRUNTIME int
SWIG_TypeNameComp(const char * f1,const char * l1,const char * f2,const char * l2)511 SWIG_TypeNameComp(const char *f1, const char *l1,
512 const char *f2, const char *l2) {
513 for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
514 while ((*f1 == ' ') && (f1 != l1)) ++f1;
515 while ((*f2 == ' ') && (f2 != l2)) ++f2;
516 if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
517 }
518 return (int)((l1 - f1) - (l2 - f2));
519 }
520
521 /*
522 Check type equivalence in a name list like <name1>|<name2>|...
523 Return 0 if equal, -1 if nb < tb, 1 if nb > tb
524 */
525 SWIGRUNTIME int
SWIG_TypeCmp(const char * nb,const char * tb)526 SWIG_TypeCmp(const char *nb, const char *tb) {
527 int equiv = 1;
528 const char* te = tb + strlen(tb);
529 const char* ne = nb;
530 while (equiv != 0 && *ne) {
531 for (nb = ne; *ne; ++ne) {
532 if (*ne == '|') break;
533 }
534 equiv = SWIG_TypeNameComp(nb, ne, tb, te);
535 if (*ne) ++ne;
536 }
537 return equiv;
538 }
539
540 /*
541 Check type equivalence in a name list like <name1>|<name2>|...
542 Return 0 if not equal, 1 if equal
543 */
544 SWIGRUNTIME int
SWIG_TypeEquiv(const char * nb,const char * tb)545 SWIG_TypeEquiv(const char *nb, const char *tb) {
546 return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
547 }
548
549 /*
550 Check the typename
551 */
552 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char * c,swig_type_info * ty)553 SWIG_TypeCheck(const char *c, swig_type_info *ty) {
554 if (ty) {
555 swig_cast_info *iter = ty->cast;
556 while (iter) {
557 if (strcmp(iter->type->name, c) == 0) {
558 if (iter == ty->cast)
559 return iter;
560 /* Move iter to the top of the linked list */
561 iter->prev->next = iter->next;
562 if (iter->next)
563 iter->next->prev = iter->prev;
564 iter->next = ty->cast;
565 iter->prev = 0;
566 if (ty->cast) ty->cast->prev = iter;
567 ty->cast = iter;
568 return iter;
569 }
570 iter = iter->next;
571 }
572 }
573 return 0;
574 }
575
576 /*
577 Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
578 */
579 SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info * from,swig_type_info * ty)580 SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
581 if (ty) {
582 swig_cast_info *iter = ty->cast;
583 while (iter) {
584 if (iter->type == from) {
585 if (iter == ty->cast)
586 return iter;
587 /* Move iter to the top of the linked list */
588 iter->prev->next = iter->next;
589 if (iter->next)
590 iter->next->prev = iter->prev;
591 iter->next = ty->cast;
592 iter->prev = 0;
593 if (ty->cast) ty->cast->prev = iter;
594 ty->cast = iter;
595 return iter;
596 }
597 iter = iter->next;
598 }
599 }
600 return 0;
601 }
602
603 /*
604 Cast a pointer up an inheritance hierarchy
605 */
606 SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info * ty,void * ptr,int * newmemory)607 SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
608 return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
609 }
610
611 /*
612 Dynamic pointer casting. Down an inheritance hierarchy
613 */
614 SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info * ty,void ** ptr)615 SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
616 swig_type_info *lastty = ty;
617 if (!ty || !ty->dcast) return ty;
618 while (ty && (ty->dcast)) {
619 ty = (*ty->dcast)(ptr);
620 if (ty) lastty = ty;
621 }
622 return lastty;
623 }
624
625 /*
626 Return the name associated with this type
627 */
628 SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info * ty)629 SWIG_TypeName(const swig_type_info *ty) {
630 return ty->name;
631 }
632
633 /*
634 Return the pretty name associated with this type,
635 that is an unmangled type name in a form presentable to the user.
636 */
637 SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info * type)638 SWIG_TypePrettyName(const swig_type_info *type) {
639 /* The "str" field contains the equivalent pretty names of the
640 type, separated by vertical-bar characters. We choose
641 to print the last name, as it is often (?) the most
642 specific. */
643 if (!type) return NULL;
644 if (type->str != NULL) {
645 const char *last_name = type->str;
646 const char *s;
647 for (s = type->str; *s; s++)
648 if (*s == '|') last_name = s+1;
649 return last_name;
650 }
651 else
652 return type->name;
653 }
654
655 /*
656 Set the clientdata field for a type
657 */
658 SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info * ti,void * clientdata)659 SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
660 swig_cast_info *cast = ti->cast;
661 /* if (ti->clientdata == clientdata) return; */
662 ti->clientdata = clientdata;
663
664 while (cast) {
665 if (!cast->converter) {
666 swig_type_info *tc = cast->type;
667 if (!tc->clientdata) {
668 SWIG_TypeClientData(tc, clientdata);
669 }
670 }
671 cast = cast->next;
672 }
673 }
674 SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info * ti,void * clientdata)675 SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
676 SWIG_TypeClientData(ti, clientdata);
677 ti->owndata = 1;
678 }
679
680 /*
681 Search for a swig_type_info structure only by mangled name
682 Search is a O(log #types)
683
684 We start searching at module start, and finish searching when start == end.
685 Note: if start == end at the beginning of the function, we go all the way around
686 the circular list.
687 */
688 SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)689 SWIG_MangledTypeQueryModule(swig_module_info *start,
690 swig_module_info *end,
691 const char *name) {
692 swig_module_info *iter = start;
693 do {
694 if (iter->size) {
695 size_t l = 0;
696 size_t r = iter->size - 1;
697 do {
698 /* since l+r >= 0, we can (>> 1) instead (/ 2) */
699 size_t i = (l + r) >> 1;
700 const char *iname = iter->types[i]->name;
701 if (iname) {
702 int compare = strcmp(name, iname);
703 if (compare == 0) {
704 return iter->types[i];
705 } else if (compare < 0) {
706 if (i) {
707 r = i - 1;
708 } else {
709 break;
710 }
711 } else if (compare > 0) {
712 l = i + 1;
713 }
714 } else {
715 break; /* should never happen */
716 }
717 } while (l <= r);
718 }
719 iter = iter->next;
720 } while (iter != end);
721 return 0;
722 }
723
724 /*
725 Search for a swig_type_info structure for either a mangled name or a human readable name.
726 It first searches the mangled names of the types, which is a O(log #types)
727 If a type is not found it then searches the human readable names, which is O(#types).
728
729 We start searching at module start, and finish searching when start == end.
730 Note: if start == end at the beginning of the function, we go all the way around
731 the circular list.
732 */
733 SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info * start,swig_module_info * end,const char * name)734 SWIG_TypeQueryModule(swig_module_info *start,
735 swig_module_info *end,
736 const char *name) {
737 /* STEP 1: Search the name field using binary search */
738 swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
739 if (ret) {
740 return ret;
741 } else {
742 /* STEP 2: If the type hasn't been found, do a complete search
743 of the str field (the human readable name) */
744 swig_module_info *iter = start;
745 do {
746 size_t i = 0;
747 for (; i < iter->size; ++i) {
748 if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
749 return iter->types[i];
750 }
751 iter = iter->next;
752 } while (iter != end);
753 }
754
755 /* neither found a match */
756 return 0;
757 }
758
759 /*
760 Pack binary data into a string
761 */
762 SWIGRUNTIME char *
SWIG_PackData(char * c,void * ptr,size_t sz)763 SWIG_PackData(char *c, void *ptr, size_t sz) {
764 static const char hex[17] = "0123456789abcdef";
765 const unsigned char *u = (unsigned char *) ptr;
766 const unsigned char *eu = u + sz;
767 for (; u != eu; ++u) {
768 unsigned char uu = *u;
769 *(c++) = hex[(uu & 0xf0) >> 4];
770 *(c++) = hex[uu & 0xf];
771 }
772 return c;
773 }
774
775 /*
776 Unpack binary data from a string
777 */
778 SWIGRUNTIME const char *
SWIG_UnpackData(const char * c,void * ptr,size_t sz)779 SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
780 unsigned char *u = (unsigned char *) ptr;
781 const unsigned char *eu = u + sz;
782 for (; u != eu; ++u) {
783 char d = *(c++);
784 unsigned char uu;
785 if ((d >= '0') && (d <= '9'))
786 uu = (unsigned char)((d - '0') << 4);
787 else if ((d >= 'a') && (d <= 'f'))
788 uu = (unsigned char)((d - ('a'-10)) << 4);
789 else
790 return (char *) 0;
791 d = *(c++);
792 if ((d >= '0') && (d <= '9'))
793 uu |= (unsigned char)(d - '0');
794 else if ((d >= 'a') && (d <= 'f'))
795 uu |= (unsigned char)(d - ('a'-10));
796 else
797 return (char *) 0;
798 *u = uu;
799 }
800 return c;
801 }
802
803 /*
804 Pack 'void *' into a string buffer.
805 */
806 SWIGRUNTIME char *
SWIG_PackVoidPtr(char * buff,void * ptr,const char * name,size_t bsz)807 SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
808 char *r = buff;
809 if ((2*sizeof(void *) + 2) > bsz) return 0;
810 *(r++) = '_';
811 r = SWIG_PackData(r,&ptr,sizeof(void *));
812 if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
813 strcpy(r,name);
814 return buff;
815 }
816
817 SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char * c,void ** ptr,const char * name)818 SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
819 if (*c != '_') {
820 if (strcmp(c,"NULL") == 0) {
821 *ptr = (void *) 0;
822 return name;
823 } else {
824 return 0;
825 }
826 }
827 return SWIG_UnpackData(++c,ptr,sizeof(void *));
828 }
829
830 SWIGRUNTIME char *
SWIG_PackDataName(char * buff,void * ptr,size_t sz,const char * name,size_t bsz)831 SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
832 char *r = buff;
833 size_t lname = (name ? strlen(name) : 0);
834 if ((2*sz + 2 + lname) > bsz) return 0;
835 *(r++) = '_';
836 r = SWIG_PackData(r,ptr,sz);
837 if (lname) {
838 strncpy(r,name,lname+1);
839 } else {
840 *r = 0;
841 }
842 return buff;
843 }
844
845 SWIGRUNTIME const char *
SWIG_UnpackDataName(const char * c,void * ptr,size_t sz,const char * name)846 SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
847 if (*c != '_') {
848 if (strcmp(c,"NULL") == 0) {
849 memset(ptr,0,sz);
850 return name;
851 } else {
852 return 0;
853 }
854 }
855 return SWIG_UnpackData(++c,ptr,sz);
856 }
857
858 #ifdef __cplusplus
859 }
860 #endif
861
862 /* Errors in SWIG */
863 #define SWIG_UnknownError -1
864 #define SWIG_IOError -2
865 #define SWIG_RuntimeError -3
866 #define SWIG_IndexError -4
867 #define SWIG_TypeError -5
868 #define SWIG_DivisionByZero -6
869 #define SWIG_OverflowError -7
870 #define SWIG_SyntaxError -8
871 #define SWIG_ValueError -9
872 #define SWIG_SystemError -10
873 #define SWIG_AttributeError -11
874 #define SWIG_MemoryError -12
875 #define SWIG_NullReferenceError -13
876
877
878
879 #include <ruby.h>
880
881 /* Ruby 1.9.1 has a "memoisation optimisation" when compiling with GCC which
882 * breaks using rb_intern as an lvalue, as SWIG does. We work around this
883 * issue for now by disabling this.
884 * https://sourceforge.net/tracker/?func=detail&aid=2859614&group_id=1645&atid=101645
885 */
886 #ifdef rb_intern
887 # undef rb_intern
888 #endif
889
890 /* Remove global macros defined in Ruby's win32.h */
891 #ifdef write
892 # undef write
893 #endif
894 #ifdef read
895 # undef read
896 #endif
897 #ifdef bind
898 # undef bind
899 #endif
900 #ifdef close
901 # undef close
902 #endif
903 #ifdef connect
904 # undef connect
905 #endif
906
907
908 /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
909 #ifndef NUM2LL
910 #define NUM2LL(x) NUM2LONG((x))
911 #endif
912 #ifndef LL2NUM
913 #define LL2NUM(x) INT2NUM((long) (x))
914 #endif
915 #ifndef ULL2NUM
916 #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
917 #endif
918
919 /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
920 #ifndef NUM2ULL
921 #ifdef HAVE_LONG_LONG
922 #define NUM2ULL(x) rb_num2ull((x))
923 #else
924 #define NUM2ULL(x) NUM2ULONG(x)
925 #endif
926 #endif
927
928 /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
929 /* Define these for older versions so we can just write code the new way */
930 #ifndef RSTRING_LEN
931 # define RSTRING_LEN(x) RSTRING(x)->len
932 #endif
933 #ifndef RSTRING_PTR
934 # define RSTRING_PTR(x) RSTRING(x)->ptr
935 #endif
936 #ifndef RSTRING_END
937 # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
938 #endif
939 #ifndef RARRAY_LEN
940 # define RARRAY_LEN(x) RARRAY(x)->len
941 #endif
942 #ifndef RARRAY_PTR
943 # define RARRAY_PTR(x) RARRAY(x)->ptr
944 #endif
945 #ifndef RFLOAT_VALUE
946 # define RFLOAT_VALUE(x) RFLOAT(x)->value
947 #endif
948 #ifndef DOUBLE2NUM
949 # define DOUBLE2NUM(x) rb_float_new(x)
950 #endif
951 #ifndef RHASH_TBL
952 # define RHASH_TBL(x) (RHASH(x)->tbl)
953 #endif
954 #ifndef RHASH_ITER_LEV
955 # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
956 #endif
957 #ifndef RHASH_IFNONE
958 # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
959 #endif
960 #ifndef RHASH_SIZE
961 # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
962 #endif
963 #ifndef RHASH_EMPTY_P
964 # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
965 #endif
966 #ifndef RSTRUCT_LEN
967 # define RSTRUCT_LEN(x) RSTRUCT(x)->len
968 #endif
969 #ifndef RSTRUCT_PTR
970 # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
971 #endif
972
973
974
975 /*
976 * Need to be very careful about how these macros are defined, especially
977 * when compiling C++ code or C code with an ANSI C compiler.
978 *
979 * VALUEFUNC(f) is a macro used to typecast a C function that implements
980 * a Ruby method so that it can be passed as an argument to API functions
981 * like rb_define_method() and rb_define_singleton_method().
982 *
983 * VOIDFUNC(f) is a macro used to typecast a C function that implements
984 * either the "mark" or "free" stuff for a Ruby Data object, so that it
985 * can be passed as an argument to API functions like Data_Wrap_Struct()
986 * and Data_Make_Struct().
987 */
988
989 #ifdef __cplusplus
990 # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
991 # define PROTECTFUNC(f) ((VALUE (*)()) f)
992 # define VALUEFUNC(f) ((VALUE (*)()) f)
993 # define VOIDFUNC(f) ((void (*)()) f)
994 # else
995 # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
996 # define PROTECTFUNC(f) ((VALUE (*)()) f)
997 # define VALUEFUNC(f) ((VALUE (*)()) f)
998 # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
999 # else /* These definitions should work for Ruby 1.7+ */
1000 # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
1001 # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
1002 # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
1003 # endif
1004 # endif
1005 #else
1006 # define VALUEFUNC(f) (f)
1007 # define VOIDFUNC(f) (f)
1008 #endif
1009
1010 /* Don't use for expressions have side effect */
1011 #ifndef RB_STRING_VALUE
1012 #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
1013 #endif
1014 #ifndef StringValue
1015 #define StringValue(s) RB_STRING_VALUE(s)
1016 #endif
1017 #ifndef StringValuePtr
1018 #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
1019 #endif
1020 #ifndef StringValueLen
1021 #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
1022 #endif
1023 #ifndef SafeStringValue
1024 #define SafeStringValue(v) do {\
1025 StringValue(v);\
1026 rb_check_safe_str(v);\
1027 } while (0)
1028 #endif
1029
1030 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
1031 #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
1032 #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
1033 #endif
1034
1035 static VALUE _mSWIG = Qnil;
1036
1037 /* -----------------------------------------------------------------------------
1038 * error manipulation
1039 * ----------------------------------------------------------------------------- */
1040
1041
1042 /* Define some additional error types */
1043 #define SWIG_ObjectPreviouslyDeletedError -100
1044
1045
1046 /* Define custom exceptions for errors that do not map to existing Ruby
1047 exceptions. Note this only works for C++ since a global cannot be
1048 initialized by a function in C. For C, fallback to rb_eRuntimeError.*/
1049
1050 SWIGINTERN VALUE
getNullReferenceError(void)1051 getNullReferenceError(void) {
1052 static int init = 0;
1053 static VALUE rb_eNullReferenceError ;
1054 if (!init) {
1055 init = 1;
1056 rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
1057 }
1058 return rb_eNullReferenceError;
1059 }
1060
1061 SWIGINTERN VALUE
getObjectPreviouslyDeletedError(void)1062 getObjectPreviouslyDeletedError(void) {
1063 static int init = 0;
1064 static VALUE rb_eObjectPreviouslyDeleted ;
1065 if (!init) {
1066 init = 1;
1067 rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
1068 }
1069 return rb_eObjectPreviouslyDeleted;
1070 }
1071
1072
1073 SWIGINTERN VALUE
SWIG_Ruby_ErrorType(int SWIG_code)1074 SWIG_Ruby_ErrorType(int SWIG_code) {
1075 VALUE type;
1076 switch (SWIG_code) {
1077 case SWIG_MemoryError:
1078 type = rb_eNoMemError;
1079 break;
1080 case SWIG_IOError:
1081 type = rb_eIOError;
1082 break;
1083 case SWIG_RuntimeError:
1084 type = rb_eRuntimeError;
1085 break;
1086 case SWIG_IndexError:
1087 type = rb_eIndexError;
1088 break;
1089 case SWIG_TypeError:
1090 type = rb_eTypeError;
1091 break;
1092 case SWIG_DivisionByZero:
1093 type = rb_eZeroDivError;
1094 break;
1095 case SWIG_OverflowError:
1096 type = rb_eRangeError;
1097 break;
1098 case SWIG_SyntaxError:
1099 type = rb_eSyntaxError;
1100 break;
1101 case SWIG_ValueError:
1102 type = rb_eArgError;
1103 break;
1104 case SWIG_SystemError:
1105 type = rb_eFatal;
1106 break;
1107 case SWIG_AttributeError:
1108 type = rb_eRuntimeError;
1109 break;
1110 case SWIG_NullReferenceError:
1111 type = getNullReferenceError();
1112 break;
1113 case SWIG_ObjectPreviouslyDeletedError:
1114 type = getObjectPreviouslyDeletedError();
1115 break;
1116 case SWIG_UnknownError:
1117 type = rb_eRuntimeError;
1118 break;
1119 default:
1120 type = rb_eRuntimeError;
1121 }
1122 return type;
1123 }
1124
1125
1126 /* This function is called when a user inputs a wrong argument to
1127 a method.
1128 */
1129 SWIGINTERN
Ruby_Format_TypeError(const char * msg,const char * type,const char * name,const int argn,VALUE input)1130 const char* Ruby_Format_TypeError( const char* msg,
1131 const char* type,
1132 const char* name,
1133 const int argn,
1134 VALUE input )
1135 {
1136 char buf[128];
1137 VALUE str;
1138 VALUE asStr;
1139 if ( msg && *msg )
1140 {
1141 str = rb_str_new2(msg);
1142 }
1143 else
1144 {
1145 str = rb_str_new(NULL, 0);
1146 }
1147
1148 str = rb_str_cat2( str, "Expected argument " );
1149 sprintf( buf, "%d of type ", argn-1 );
1150 str = rb_str_cat2( str, buf );
1151 str = rb_str_cat2( str, type );
1152 str = rb_str_cat2( str, ", but got " );
1153 str = rb_str_cat2( str, rb_obj_classname(input) );
1154 str = rb_str_cat2( str, " " );
1155 asStr = rb_inspect(input);
1156 if ( RSTRING_LEN(asStr) > 30 )
1157 {
1158 str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1159 str = rb_str_cat2( str, "..." );
1160 }
1161 else
1162 {
1163 str = rb_str_append( str, asStr );
1164 }
1165
1166 if ( name )
1167 {
1168 str = rb_str_cat2( str, "\n\tin SWIG method '" );
1169 str = rb_str_cat2( str, name );
1170 str = rb_str_cat2( str, "'" );
1171 }
1172
1173 return StringValuePtr( str );
1174 }
1175
1176 /* This function is called when an overloaded method fails */
1177 SWIGINTERN
Ruby_Format_OverloadedError(const int argc,const int maxargs,const char * method,const char * prototypes)1178 void Ruby_Format_OverloadedError(
1179 const int argc,
1180 const int maxargs,
1181 const char* method,
1182 const char* prototypes
1183 )
1184 {
1185 const char* msg = "Wrong # of arguments";
1186 if ( argc <= maxargs ) msg = "Wrong arguments";
1187 rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1188 "Possible C/C++ prototypes are:\n%s",
1189 msg, method, prototypes);
1190 }
1191
1192 /* -----------------------------------------------------------------------------
1193 * rubytracking.swg
1194 *
1195 * This file contains support for tracking mappings from
1196 * Ruby objects to C++ objects. This functionality is needed
1197 * to implement mark functions for Ruby's mark and sweep
1198 * garbage collector.
1199 * ----------------------------------------------------------------------------- */
1200
1201 #ifdef __cplusplus
1202 extern "C" {
1203 #endif
1204
1205 #if !defined(ST_DATA_T_DEFINED)
1206 /* Needs to be explicitly included for Ruby 1.8 and earlier */
1207 #include <st.h>
1208 #endif
1209
1210 /* Ruby 1.8 actually assumes the first case. */
1211 #if SIZEOF_VOIDP == SIZEOF_LONG
1212 # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1213 # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1214 #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1215 # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1216 # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1217 #else
1218 # error sizeof(void*) is not the same as long or long long
1219 #endif
1220
1221 /* Global hash table to store Trackings from C/C++
1222 structs to Ruby Objects.
1223 */
1224 static st_table* swig_ruby_trackings = NULL;
1225
swig_ruby_trackings_count(ANYARGS)1226 static VALUE swig_ruby_trackings_count(ANYARGS) {
1227 return SWIG2NUM(swig_ruby_trackings->num_entries);
1228 }
1229
1230
1231 /* Setup a hash table to store Trackings */
SWIG_RubyInitializeTrackings(void)1232 SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1233 /* Create a hash table to store Trackings from C++
1234 objects to Ruby objects. */
1235
1236 /* Try to see if some other .so has already created a
1237 tracking hash table, which we keep hidden in an instance var
1238 in the SWIG module.
1239 This is done to allow multiple DSOs to share the same
1240 tracking table.
1241 */
1242 VALUE trackings_value = Qnil;
1243 /* change the variable name so that we can mix modules
1244 compiled with older SWIG's - this used to be called "@__trackings__" */
1245 ID trackings_id = rb_intern( "@__safetrackings__" );
1246 VALUE verbose = rb_gv_get("VERBOSE");
1247 rb_gv_set("VERBOSE", Qfalse);
1248 trackings_value = rb_ivar_get( _mSWIG, trackings_id );
1249 rb_gv_set("VERBOSE", verbose);
1250
1251 /* The trick here is that we have to store the hash table
1252 pointer in a Ruby variable. We do not want Ruby's GC to
1253 treat this pointer as a Ruby object, so we convert it to
1254 a Ruby numeric value. */
1255 if (trackings_value == Qnil) {
1256 /* No, it hasn't. Create one ourselves */
1257 swig_ruby_trackings = st_init_numtable();
1258 rb_ivar_set( _mSWIG, trackings_id, SWIG2NUM(swig_ruby_trackings) );
1259 } else {
1260 swig_ruby_trackings = (st_table*)NUM2SWIG(trackings_value);
1261 }
1262
1263 rb_define_virtual_variable("SWIG_TRACKINGS_COUNT", swig_ruby_trackings_count, NULL);
1264 }
1265
1266 /* Add a Tracking from a C/C++ struct to a Ruby object */
SWIG_RubyAddTracking(void * ptr,VALUE object)1267 SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1268 /* Store the mapping to the global hash table. */
1269 st_insert(swig_ruby_trackings, (st_data_t)ptr, object);
1270 }
1271
1272 /* Get the Ruby object that owns the specified C/C++ struct */
SWIG_RubyInstanceFor(void * ptr)1273 SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1274 /* Now lookup the value stored in the global hash table */
1275 VALUE value;
1276
1277 if (st_lookup(swig_ruby_trackings, (st_data_t)ptr, &value)) {
1278 return value;
1279 } else {
1280 return Qnil;
1281 }
1282 }
1283
1284 /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1285 is very important to remove objects once they are destroyed
1286 since the same memory address may be reused later to create
1287 a new object. */
SWIG_RubyRemoveTracking(void * ptr)1288 SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1289 /* Delete the object from the hash table */
1290 st_delete(swig_ruby_trackings, (st_data_t *)&ptr, NULL);
1291 }
1292
1293 /* This is a helper method that unlinks a Ruby object from its
1294 underlying C++ object. This is needed if the lifetime of the
1295 Ruby object is longer than the C++ object */
SWIG_RubyUnlinkObjects(void * ptr)1296 SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1297 VALUE object = SWIG_RubyInstanceFor(ptr);
1298
1299 if (object != Qnil) {
1300 if (TYPE(object) != T_DATA)
1301 abort();
1302 DATA_PTR(object) = 0;
1303 }
1304 }
1305
1306 /* This is a helper method that iterates over all the trackings
1307 passing the C++ object pointer and its related Ruby object
1308 to the passed callback function. */
1309
1310 /* Proxy method to abstract the internal trackings datatype */
swig_ruby_internal_iterate_callback(void * ptr,VALUE obj,void (* meth)(void * ptr,VALUE obj))1311 static int swig_ruby_internal_iterate_callback(void* ptr, VALUE obj, void(*meth)(void* ptr, VALUE obj)) {
1312 (*meth)(ptr, obj);
1313 return ST_CONTINUE;
1314 }
1315
SWIG_RubyIterateTrackings(void (* meth)(void * ptr,VALUE obj))1316 SWIGRUNTIME void SWIG_RubyIterateTrackings( void(*meth)(void* ptr, VALUE obj) ) {
1317 st_foreach(swig_ruby_trackings, (int (*)(ANYARGS))&swig_ruby_internal_iterate_callback, (st_data_t)meth);
1318 }
1319
1320 #ifdef __cplusplus
1321 }
1322 #endif
1323
1324 /* -----------------------------------------------------------------------------
1325 * Ruby API portion that goes into the runtime
1326 * ----------------------------------------------------------------------------- */
1327
1328 #ifdef __cplusplus
1329 extern "C" {
1330 #endif
1331
1332 SWIGINTERN VALUE
SWIG_Ruby_AppendOutput(VALUE target,VALUE o)1333 SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1334 if (NIL_P(target)) {
1335 target = o;
1336 } else {
1337 if (TYPE(target) != T_ARRAY) {
1338 VALUE o2 = target;
1339 target = rb_ary_new();
1340 rb_ary_push(target, o2);
1341 }
1342 rb_ary_push(target, o);
1343 }
1344 return target;
1345 }
1346
1347 /* For ruby1.8.4 and earlier. */
1348 #ifndef RUBY_INIT_STACK
1349 RUBY_EXTERN void Init_stack(VALUE* addr);
1350 # define RUBY_INIT_STACK \
1351 VALUE variable_in_this_stack_frame; \
1352 Init_stack(&variable_in_this_stack_frame);
1353 #endif
1354
1355
1356 #ifdef __cplusplus
1357 }
1358 #endif
1359
1360
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 swig_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(clientdata)
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), "%s", 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, "%s", 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 char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1515 sprintf(klass_name, "TYPE%s", type->name);
1516 if (NIL_P(_cSWIG_Pointer)) {
1517 _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1518 rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1519 }
1520 rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1521 free((void *) klass_name);
1522 }
1523
1524 /* Create a new pointer object */
1525 SWIGRUNTIME VALUE
SWIG_Ruby_NewPointerObj(void * ptr,swig_type_info * type,int flags)1526 SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1527 {
1528 int own = flags & SWIG_POINTER_OWN;
1529 int track;
1530 char *klass_name;
1531 swig_class *sklass;
1532 VALUE klass;
1533 VALUE obj;
1534
1535 if (!ptr)
1536 return Qnil;
1537
1538 if (type->clientdata) {
1539 sklass = (swig_class *) type->clientdata;
1540
1541 /* Are we tracking this class and have we already returned this Ruby object? */
1542 track = sklass->trackObjects;
1543 if (track) {
1544 obj = SWIG_RubyInstanceFor(ptr);
1545
1546 /* Check the object's type and make sure it has the correct type.
1547 It might not in cases where methods do things like
1548 downcast methods. */
1549 if (obj != Qnil) {
1550 VALUE value = rb_iv_get(obj, "@__swigtype__");
1551 const char* type_name = RSTRING_PTR(value);
1552
1553 if (strcmp(type->name, type_name) == 0) {
1554 return obj;
1555 }
1556 }
1557 }
1558
1559 /* Create a new Ruby object */
1560 obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1561 ( own ? VOIDFUNC(sklass->destroy) :
1562 (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1563 ), ptr);
1564
1565 /* If tracking is on for this class then track this object. */
1566 if (track) {
1567 SWIG_RubyAddTracking(ptr, obj);
1568 }
1569 } else {
1570 klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1571 sprintf(klass_name, "TYPE%s", type->name);
1572 klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1573 free((void *) klass_name);
1574 obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1575 }
1576 rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1577
1578 return obj;
1579 }
1580
1581 /* Create a new class instance (always owned) */
1582 SWIGRUNTIME VALUE
SWIG_Ruby_NewClassInstance(VALUE klass,swig_type_info * type)1583 SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1584 {
1585 VALUE obj;
1586 swig_class *sklass = (swig_class *) type->clientdata;
1587 obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1588 rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1589 return obj;
1590 }
1591
1592 /* Get type mangle from class name */
1593 SWIGRUNTIMEINLINE char *
SWIG_Ruby_MangleStr(VALUE obj)1594 SWIG_Ruby_MangleStr(VALUE obj)
1595 {
1596 VALUE stype = rb_iv_get(obj, "@__swigtype__");
1597 return StringValuePtr(stype);
1598 }
1599
1600 /* Acquire a pointer value */
1601 typedef struct {
1602 void (*datafree)(void *);
1603 int own;
1604 } swig_ruby_owntype;
1605
1606 SWIGRUNTIME swig_ruby_owntype
SWIG_Ruby_AcquirePtr(VALUE obj,swig_ruby_owntype own)1607 SWIG_Ruby_AcquirePtr(VALUE obj, swig_ruby_owntype own) {
1608 swig_ruby_owntype oldown = {0, 0};
1609 if (obj) {
1610 oldown.datafree = RDATA(obj)->dfree;
1611 RDATA(obj)->dfree = own.datafree;
1612 }
1613 return oldown;
1614 }
1615
1616 /* Convert a pointer value */
1617 SWIGRUNTIME int
SWIG_Ruby_ConvertPtrAndOwn(VALUE obj,void ** ptr,swig_type_info * ty,int flags,swig_ruby_owntype * own)1618 SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, swig_ruby_owntype *own)
1619 {
1620 char *c;
1621 swig_cast_info *tc;
1622 void *vptr = 0;
1623
1624 /* Grab the pointer */
1625 if (NIL_P(obj)) {
1626 if (ptr)
1627 *ptr = 0;
1628 return SWIG_OK;
1629 } else {
1630 if (TYPE(obj) != T_DATA) {
1631 return SWIG_ERROR;
1632 }
1633 Data_Get_Struct(obj, void, vptr);
1634 }
1635
1636 if (own) {
1637 own->datafree = RDATA(obj)->dfree;
1638 own->own = 0;
1639 }
1640
1641 /* Check to see if the input object is giving up ownership
1642 of the underlying C struct or C++ object. If so then we
1643 need to reset the destructor since the Ruby object no
1644 longer owns the underlying C++ object.*/
1645 if (flags & SWIG_POINTER_DISOWN) {
1646 /* Is tracking on for this class? */
1647 int track = 0;
1648 if (ty && ty->clientdata) {
1649 swig_class *sklass = (swig_class *) ty->clientdata;
1650 track = sklass->trackObjects;
1651 }
1652
1653 if (track) {
1654 /* We are tracking objects for this class. Thus we change the destructor
1655 * to SWIG_RubyRemoveTracking. This allows us to
1656 * remove the mapping from the C++ to Ruby object
1657 * when the Ruby object is garbage collected. If we don't
1658 * do this, then it is possible we will return a reference
1659 * to a Ruby object that no longer exists thereby crashing Ruby. */
1660 RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1661 } else {
1662 RDATA(obj)->dfree = 0;
1663 }
1664 }
1665
1666 /* Do type-checking if type info was provided */
1667 if (ty) {
1668 if (ty->clientdata) {
1669 if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1670 if (vptr == 0) {
1671 /* The object has already been deleted */
1672 return SWIG_ObjectPreviouslyDeletedError;
1673 }
1674 }
1675 }
1676 if ((c = SWIG_MangleStr(obj)) == NULL) {
1677 return SWIG_ERROR;
1678 }
1679 tc = SWIG_TypeCheck(c, ty);
1680 if (!tc) {
1681 return SWIG_ERROR;
1682 } else {
1683 if (ptr) {
1684 if (tc->type == ty) {
1685 *ptr = vptr;
1686 } else {
1687 int newmemory = 0;
1688 *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1689 if (newmemory == SWIG_CAST_NEW_MEMORY) {
1690 assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
1691 if (own)
1692 own->own = own->own | SWIG_CAST_NEW_MEMORY;
1693 }
1694 }
1695 }
1696 }
1697 } else {
1698 if (ptr)
1699 *ptr = vptr;
1700 }
1701
1702 return SWIG_OK;
1703 }
1704
1705 /* Check convert */
1706 SWIGRUNTIMEINLINE int
SWIG_Ruby_CheckConvert(VALUE obj,swig_type_info * ty)1707 SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1708 {
1709 char *c = SWIG_MangleStr(obj);
1710 if (!c) return 0;
1711 return SWIG_TypeCheck(c,ty) != 0;
1712 }
1713
1714 SWIGRUNTIME VALUE
SWIG_Ruby_NewPackedObj(void * ptr,int sz,swig_type_info * type)1715 SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1716 char result[1024];
1717 char *r = result;
1718 if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1719 *(r++) = '_';
1720 r = SWIG_PackData(r, ptr, sz);
1721 strcpy(r, type->name);
1722 return rb_str_new2(result);
1723 }
1724
1725 /* Convert a packed value value */
1726 SWIGRUNTIME int
SWIG_Ruby_ConvertPacked(VALUE obj,void * ptr,int sz,swig_type_info * ty)1727 SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1728 swig_cast_info *tc;
1729 const char *c;
1730
1731 if (TYPE(obj) != T_STRING) goto type_error;
1732 c = StringValuePtr(obj);
1733 /* Pointer values must start with leading underscore */
1734 if (*c != '_') goto type_error;
1735 c++;
1736 c = SWIG_UnpackData(c, ptr, sz);
1737 if (ty) {
1738 tc = SWIG_TypeCheck(c, ty);
1739 if (!tc) goto type_error;
1740 }
1741 return SWIG_OK;
1742
1743 type_error:
1744 return SWIG_ERROR;
1745 }
1746
1747 SWIGRUNTIME swig_module_info *
SWIG_Ruby_GetModule(void * SWIGUNUSEDPARM (clientdata))1748 SWIG_Ruby_GetModule(void *SWIGUNUSEDPARM(clientdata))
1749 {
1750 VALUE pointer;
1751 swig_module_info *ret = 0;
1752 VALUE verbose = rb_gv_get("VERBOSE");
1753
1754 /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1755 rb_gv_set("VERBOSE", Qfalse);
1756
1757 /* first check if pointer already created */
1758 pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1759 if (pointer != Qnil) {
1760 Data_Get_Struct(pointer, swig_module_info, ret);
1761 }
1762
1763 /* reinstate warnings */
1764 rb_gv_set("VERBOSE", verbose);
1765 return ret;
1766 }
1767
1768 SWIGRUNTIME void
SWIG_Ruby_SetModule(swig_module_info * pointer)1769 SWIG_Ruby_SetModule(swig_module_info *pointer)
1770 {
1771 /* register a new class */
1772 VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1773 /* create and store the structure pointer to a global variable */
1774 swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1775 rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1776 }
1777
1778 /* This function can be used to check whether a proc or method or similarly
1779 callable function has been passed. Usually used in a %typecheck, like:
1780
1781 %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1782 $result = SWIG_Ruby_isCallable( $input );
1783 }
1784 */
1785 SWIGINTERN
SWIG_Ruby_isCallable(VALUE proc)1786 int SWIG_Ruby_isCallable( VALUE proc )
1787 {
1788 if ( rb_respond_to( proc, swig_call_id ) )
1789 return 1;
1790 return 0;
1791 }
1792
1793 /* This function can be used to check the arity (number of arguments)
1794 a proc or method can take. Usually used in a %typecheck.
1795 Valid arities will be that equal to minimal or those < 0
1796 which indicate a variable number of parameters at the end.
1797 */
1798 SWIGINTERN
SWIG_Ruby_arity(VALUE proc,int minimal)1799 int SWIG_Ruby_arity( VALUE proc, int minimal )
1800 {
1801 if ( rb_respond_to( proc, swig_arity_id ) )
1802 {
1803 VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1804 int arity = NUM2INT(num);
1805 if ( arity < 0 && (arity+1) < -minimal ) return 1;
1806 if ( arity == minimal ) return 1;
1807 return 1;
1808 }
1809 return 0;
1810 }
1811
1812
1813 #ifdef __cplusplus
1814 }
1815 #endif
1816
1817
1818
1819 #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1820
1821 #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1822
1823
1824
1825 #define SWIG_exception(code, msg) do { SWIG_Error(code, msg);; } while(0)
1826
1827
1828 /* -------- TYPES TABLE (BEGIN) -------- */
1829
1830 #define SWIGTYPE_p_HashCounter swig_types[0]
1831 #define SWIGTYPE_p_HashSet swig_types[1]
1832 #define SWIGTYPE_p_MerDNA swig_types[2]
1833 #define SWIGTYPE_p_QueryMerFile swig_types[3]
1834 #define SWIGTYPE_p_ReadMerFile swig_types[4]
1835 #define SWIGTYPE_p_StringMers swig_types[5]
1836 #define SWIGTYPE_p_char swig_types[6]
1837 #define SWIGTYPE_p_std__pairT_bool_uint64_t_t swig_types[7]
1838 static swig_type_info *swig_types[9];
1839 static swig_module_info swig_module = {swig_types, 8, 0, 0, 0, 0};
1840 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1841 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1842
1843 /* -------- TYPES TABLE (END) -------- */
1844
1845 #define SWIG_init Init_jellyfish
1846 #define SWIG_name "Jellyfish"
1847
1848 /*
1849 Document-module: Jellyfish
1850
1851 Jellyfish binding
1852 */
1853 static VALUE mJellyfish;
1854
1855 #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1856 #define SWIG_RUBY_THREAD_END_BLOCK
1857
1858
1859 #define SWIGVERSION 0x030010
1860 #define SWIG_VERSION SWIGVERSION
1861
1862
1863 #define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
1864 #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
1865
1866
1867 #include <stdexcept>
1868
1869
1870 #include <string>
1871
1872
1873 #include <stdexcept>
1874
1875
1876 #ifdef __cplusplus
1877 extern "C" {
1878 #endif
1879
1880 /* Ruby 1.9 changed the file name of this header */
1881 #ifdef HAVE_RUBY_IO_H
1882 #include "ruby/io.h"
1883 #else
1884 #include "rubyio.h"
1885 #endif
1886
1887 #ifdef __cplusplus
1888 }
1889 #endif
1890
1891
1892 #ifdef __cplusplus
1893 extern "C" {
1894 #endif
1895 #ifdef HAVE_SYS_TIME_H
1896 # include <sys/time.h>
1897 struct timeval rb_time_timeval(VALUE);
1898 #endif
1899 #ifdef __cplusplus
1900 }
1901 #endif
1902
1903
1904 #ifdef SWIGPYTHON
1905 #endif
1906
1907 #ifdef SWIGPERL
1908 #undef seed
1909 #undef random
1910 #endif
1911
1912 #include <fstream>
1913 #include <stdexcept>
1914 #undef die
1915 #include <jellyfish/mer_dna.hpp>
1916 #include <jellyfish/file_header.hpp>
1917 #include <jellyfish/mer_dna_bloom_counter.hpp>
1918 #include <jellyfish/hash_counter.hpp>
1919 #include <jellyfish/jellyfish.hpp>
1920 #undef die
1921
1922
1923 class MerDNA : public jellyfish::mer_dna {
1924 public:
1925 MerDNA() = default;
MerDNA(const char * s)1926 MerDNA(const char* s) : jellyfish::mer_dna(s) { }
MerDNA(const MerDNA & m)1927 MerDNA(const MerDNA& m) : jellyfish::mer_dna(m) { }
operator =(const jellyfish::mer_dna & m)1928 MerDNA& operator=(const jellyfish::mer_dna& m) { *static_cast<jellyfish::mer_dna*>(this) = m; return *this; }
1929 };
1930
1931
1932 SWIGINTERN swig_type_info*
SWIG_pchar_descriptor(void)1933 SWIG_pchar_descriptor(void)
1934 {
1935 static int init = 0;
1936 static swig_type_info* info = 0;
1937 if (!init) {
1938 info = SWIG_TypeQuery("_p_char");
1939 init = 1;
1940 }
1941 return info;
1942 }
1943
1944
1945 SWIGINTERN int
SWIG_AsCharPtrAndSize(VALUE obj,char ** cptr,size_t * psize,int * alloc)1946 SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1947 {
1948 if (TYPE(obj) == T_STRING) {
1949 char *cstr = StringValuePtr(obj);
1950 size_t size = RSTRING_LEN(obj) + 1;
1951 if (cptr) {
1952 if (alloc) {
1953 if (*alloc == SWIG_NEWOBJ) {
1954 *cptr = reinterpret_cast< char* >(memcpy((new char[size]), cstr, sizeof(char)*(size)));
1955 } else {
1956 *cptr = cstr;
1957 *alloc = SWIG_OLDOBJ;
1958 }
1959 }
1960 }
1961 if (psize) *psize = size;
1962 return SWIG_OK;
1963 } else {
1964 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1965 if (pchar_descriptor) {
1966 void* vptr = 0;
1967 if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
1968 if (cptr) *cptr = (char *)vptr;
1969 if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
1970 if (alloc) *alloc = SWIG_OLDOBJ;
1971 return SWIG_OK;
1972 }
1973 }
1974 }
1975 return SWIG_TypeError;
1976 }
1977
1978
1979
1980
1981
1982 #include <limits.h>
1983 #if !defined(SWIG_NO_LLONG_MAX)
1984 # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1985 # define LLONG_MAX __LONG_LONG_MAX__
1986 # define LLONG_MIN (-LLONG_MAX - 1LL)
1987 # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1988 # endif
1989 #endif
1990
1991
1992 SWIGINTERN VALUE
SWIG_ruby_failed(void)1993 SWIG_ruby_failed(void)
1994 {
1995 return Qnil;
1996 }
1997
1998
1999 /*@SWIG:/opt/local/stow/swig-3.0.10/share/swig/3.0.10/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
SWIG_AUX_NUM2ULONG(VALUE * args)2000 SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
2001 {
2002 VALUE obj = args[0];
2003 VALUE type = TYPE(obj);
2004 unsigned long *res = (unsigned long *)(args[1]);
2005 *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
2006 return obj;
2007 }
2008 /*@SWIG@*/
2009
2010 SWIGINTERN int
SWIG_AsVal_unsigned_SS_long(VALUE obj,unsigned long * val)2011 SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
2012 {
2013 VALUE type = TYPE(obj);
2014 if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
2015 unsigned long v;
2016 VALUE a[2];
2017 a[0] = obj;
2018 a[1] = (VALUE)(&v);
2019 if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2020 if (val) *val = v;
2021 return SWIG_OK;
2022 }
2023 }
2024 return SWIG_TypeError;
2025 }
2026
2027
2028 SWIGINTERN int
SWIG_AsVal_unsigned_SS_int(VALUE obj,unsigned int * val)2029 SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
2030 {
2031 unsigned long v;
2032 int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
2033 if (SWIG_IsOK(res)) {
2034 if ((v > UINT_MAX)) {
2035 return SWIG_OverflowError;
2036 } else {
2037 if (val) *val = static_cast< unsigned int >(v);
2038 }
2039 }
2040 return res;
2041 }
2042
2043
2044 #define SWIG_From_long LONG2NUM
2045
2046
2047 SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_long(unsigned long value)2048 SWIG_From_unsigned_SS_long (unsigned long value)
2049 {
2050 return ULONG2NUM(value);
2051 }
2052
2053
2054 SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_int(unsigned int value)2055 SWIG_From_unsigned_SS_int (unsigned int value)
2056 {
2057 return SWIG_From_unsigned_SS_long (value);
2058 }
2059
2060
2061 SWIGINTERNINLINE VALUE
SWIG_From_bool(bool value)2062 SWIG_From_bool (bool value)
2063 {
2064 return value ? Qtrue : Qfalse;
2065 }
2066
2067
2068 SWIGINTERN int
SWIG_AsCharArray(VALUE obj,char * val,size_t size)2069 SWIG_AsCharArray(VALUE obj, char *val, size_t size)
2070 {
2071 char* cptr = 0; size_t csize = 0; int alloc = SWIG_OLDOBJ;
2072 int res = SWIG_AsCharPtrAndSize(obj, &cptr, &csize, &alloc);
2073 if (SWIG_IsOK(res)) {
2074 /* special case of single char conversion when we don't need space for NUL */
2075 if (size == 1 && csize == 2 && cptr && !cptr[1]) --csize;
2076 if (csize <= size) {
2077 if (val) {
2078 if (csize) memcpy(val, cptr, csize*sizeof(char));
2079 if (csize < size) memset(val + csize, 0, (size - csize)*sizeof(char));
2080 }
2081 if (alloc == SWIG_NEWOBJ) {
2082 delete[] cptr;
2083 res = SWIG_DelNewMask(res);
2084 }
2085 return res;
2086 }
2087 if (alloc == SWIG_NEWOBJ) delete[] cptr;
2088 }
2089 return SWIG_TypeError;
2090 }
2091
2092
2093 /*@SWIG:/opt/local/stow/swig-3.0.10/share/swig/3.0.10/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
SWIG_AUX_NUM2LONG(VALUE * args)2094 SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
2095 {
2096 VALUE obj = args[0];
2097 VALUE type = TYPE(obj);
2098 long *res = (long *)(args[1]);
2099 *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
2100 return obj;
2101 }
2102 /*@SWIG@*/
2103
2104 SWIGINTERN int
SWIG_AsVal_long(VALUE obj,long * val)2105 SWIG_AsVal_long (VALUE obj, long* val)
2106 {
2107 VALUE type = TYPE(obj);
2108 if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
2109 long v;
2110 VALUE a[2];
2111 a[0] = obj;
2112 a[1] = (VALUE)(&v);
2113 if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2114 if (val) *val = v;
2115 return SWIG_OK;
2116 }
2117 }
2118 return SWIG_TypeError;
2119 }
2120
2121
2122 SWIGINTERN int
SWIG_AsVal_char(VALUE obj,char * val)2123 SWIG_AsVal_char (VALUE obj, char *val)
2124 {
2125 int res = SWIG_AsCharArray(obj, val, 1);
2126 if (!SWIG_IsOK(res)) {
2127 long v;
2128 res = SWIG_AddCast(SWIG_AsVal_long (obj, &v));
2129 if (SWIG_IsOK(res)) {
2130 if ((CHAR_MIN <= v) && (v <= CHAR_MAX)) {
2131 if (val) *val = static_cast< char >(v);
2132 } else {
2133 res = SWIG_OverflowError;
2134 }
2135 }
2136 }
2137 return res;
2138 }
2139
2140
2141 SWIGINTERNINLINE VALUE
SWIG_FromCharPtrAndSize(const char * carray,size_t size)2142 SWIG_FromCharPtrAndSize(const char* carray, size_t size)
2143 {
2144 if (carray) {
2145 if (size > LONG_MAX) {
2146 swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
2147 return pchar_descriptor ?
2148 SWIG_NewPointerObj(const_cast< char * >(carray), pchar_descriptor, 0) : Qnil;
2149 } else {
2150 return rb_str_new(carray, static_cast< long >(size));
2151 }
2152 } else {
2153 return Qnil;
2154 }
2155 }
2156
2157
2158 SWIGINTERNINLINE VALUE
SWIG_From_char(char c)2159 SWIG_From_char (char c)
2160 {
2161 return SWIG_FromCharPtrAndSize(&c,1);
2162 }
2163
MerDNA_dup(MerDNA const * self)2164 SWIGINTERN MerDNA MerDNA_dup(MerDNA const *self){ return MerDNA(*self); }
MerDNA___str__(MerDNA * self)2165 SWIGINTERN std::string MerDNA___str__(MerDNA *self){ return self->to_str(); }
2166
2167 SWIGINTERNINLINE VALUE
SWIG_From_std_string(const std::string & s)2168 SWIG_From_std_string (const std::string& s)
2169 {
2170 return SWIG_FromCharPtrAndSize(s.data(), s.size());
2171 }
2172
MerDNA_set(MerDNA * self,char const * s)2173 SWIGINTERN void MerDNA_set(MerDNA *self,char const *s){ *static_cast<jellyfish::mer_dna*>(self) = s; }
MerDNA___getitem__(MerDNA * self,unsigned int i)2174 SWIGINTERN char MerDNA___getitem__(MerDNA *self,unsigned int i){ return (char)self->base(i); }
MerDNA___setitem__(MerDNA * self,unsigned int i,char b)2175 SWIGINTERN void MerDNA___setitem__(MerDNA *self,unsigned int i,char b){ self->base(i) = b; }
MerDNA___lshift__(MerDNA * self,char b)2176 SWIGINTERN MerDNA &MerDNA___lshift__(MerDNA *self,char b){ self->shift_left(b); return *self; }
MerDNA___rshift__(MerDNA * self,char b)2177 SWIGINTERN MerDNA &MerDNA___rshift__(MerDNA *self,char b){ self->shift_right(b); return *self; }
2178
2179 class QueryMerFile {
2180 std::unique_ptr<jellyfish::mer_dna_bloom_filter> bf;
2181 jellyfish::mapped_file binary_map;
2182 std::unique_ptr<binary_query> jf;
2183
2184 public:
QueryMerFile(const char * path)2185 QueryMerFile(const char* path) {
2186 std::ifstream in(path);
2187 if(!in.good())
2188 throw std::runtime_error(std::string("Can't open file '") + path + "'");
2189 jellyfish::file_header header(in);
2190 jellyfish::mer_dna::k(header.key_len() / 2);
2191 if(header.format() == "bloomcounter") {
2192 jellyfish::hash_pair<jellyfish::mer_dna> fns(header.matrix(1), header.matrix(2));
2193 bf.reset(new jellyfish::mer_dna_bloom_filter(header.size(), header.nb_hashes(), in, fns));
2194 if(!in.good())
2195 throw std::runtime_error("Bloom filter file is truncated");
2196 } else if(header.format() == "binary/sorted") {
2197 binary_map.map(path);
2198 jf.reset(new binary_query(binary_map.base() + header.offset(), header.key_len(), header.counter_len(), header.matrix(),
2199 header.size() - 1, binary_map.length() - header.offset()));
2200 } else {
2201 throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'");
2202 }
2203 }
2204
2205 #ifdef SWIGPERL
get(const MerDNA & m)2206 unsigned int get(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); }
2207 #else
__getitem__(const MerDNA & m)2208 unsigned int __getitem__(const MerDNA& m) { return jf ? jf->check(m) : bf->check(m); }
2209 #endif
2210 };
2211
2212
2213 class ReadMerFile {
2214 std::ifstream in;
2215 std::unique_ptr<binary_reader> binary;
2216 std::unique_ptr<text_reader> text;
2217
next_mer__()2218 std::pair<const MerDNA*, uint64_t> next_mer__() {
2219 std::pair<const MerDNA*, uint64_t> res((const MerDNA*)0, 0);
2220 if(next_mer()) {
2221 res.first = mer();
2222 res.second = count();
2223 }
2224 return res;
2225 }
2226
2227 public:
ReadMerFile(const char * path)2228 ReadMerFile(const char* path) :
2229 in(path)
2230 {
2231 if(!in.good())
2232 throw std::runtime_error(std::string("Can't open file '") + path + "'");
2233 jellyfish::file_header header(in);
2234 jellyfish::mer_dna::k(header.key_len() / 2);
2235 if(header.format() == binary_dumper::format)
2236 binary.reset(new binary_reader(in, &header));
2237 else if(header.format() == text_dumper::format)
2238 text.reset(new text_reader(in, &header));
2239 else
2240 throw std::runtime_error(std::string("Unsupported format '") + header.format() + "'");
2241 }
2242
next_mer()2243 bool next_mer() {
2244 if(binary) {
2245 if(binary->next()) return true;
2246 binary.reset();
2247 } else if(text) {
2248 if(text->next()) return true;
2249 text.reset();
2250 }
2251 return false;
2252 }
2253
mer() const2254 const MerDNA* mer() const { return static_cast<const MerDNA*>(binary ? &binary->key() : &text->key()); }
count() const2255 unsigned long count() const { return binary ? binary->val() : text->val(); }
2256
2257 #ifdef SWIGRUBY
each()2258 void each() {
2259 if(!rb_block_given_p()) return;
2260 while(next_mer()) {
2261 auto m = SWIG_NewPointerObj(const_cast<MerDNA*>(mer()), SWIGTYPE_p_MerDNA, 0);
2262 auto c = SWIG_From_unsigned_SS_long(count());
2263 rb_yield(rb_ary_new3(2, m, c));
2264 }
2265 }
2266 #endif
2267
2268 #ifdef SWIGPERL
each()2269 std::pair<const MerDNA*, uint64_t> each() { return next_mer__(); }
2270 #endif
2271
2272 #ifdef SWIGPYTHON
__iter__()2273 ReadMerFile* __iter__() { return this; }
__next__()2274 std::pair<const MerDNA*, uint64_t> __next__() { return next_mer__(); }
next()2275 std::pair<const MerDNA*, uint64_t> next() { return next_mer__(); }
2276 #endif
2277 };
2278
2279
2280 class HashCounter : public jellyfish::cooperative::hash_counter<jellyfish::mer_dna> {
2281 typedef jellyfish::cooperative::hash_counter<jellyfish::mer_dna> super;
2282 public:
HashCounter(size_t size,unsigned int val_len,unsigned int nb_threads=1)2283 HashCounter(size_t size, unsigned int val_len, unsigned int nb_threads = 1) : \
2284 super(size, jellyfish::mer_dna::k() * 2, val_len, nb_threads)
2285 { }
2286
add(const MerDNA & m,const int & x)2287 bool add(const MerDNA& m, const int& x) {
2288 bool res;
2289 size_t id;
2290 super::add(m, x, &res, &id);
2291 return res;
2292 }
2293
2294 };
2295
2296
2297 #if defined(LLONG_MAX) && !defined(SWIG_LONG_LONG_AVAILABLE)
2298 # define SWIG_LONG_LONG_AVAILABLE
2299 #endif
2300
2301
2302 #ifdef SWIG_LONG_LONG_AVAILABLE
2303 /*@SWIG:/opt/local/stow/swig-3.0.10/share/swig/3.0.10/ruby/rubyprimtypes.swg,19,%ruby_aux_method@*/
SWIG_AUX_NUM2ULL(VALUE * args)2304 SWIGINTERN VALUE SWIG_AUX_NUM2ULL(VALUE *args)
2305 {
2306 VALUE obj = args[0];
2307 VALUE type = TYPE(obj);
2308 long long *res = (long long *)(args[1]);
2309 *res = type == T_FIXNUM ? NUM2ULL(obj) : rb_big2ull(obj);
2310 return obj;
2311 }
2312 /*@SWIG@*/
2313
2314 SWIGINTERN int
SWIG_AsVal_unsigned_SS_long_SS_long(VALUE obj,unsigned long long * val)2315 SWIG_AsVal_unsigned_SS_long_SS_long (VALUE obj, unsigned long long *val)
2316 {
2317 VALUE type = TYPE(obj);
2318 if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
2319 unsigned long long v;
2320 VALUE a[2];
2321 a[0] = obj;
2322 a[1] = (VALUE)(&v);
2323 if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULL), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
2324 if (val) *val = v;
2325 return SWIG_OK;
2326 }
2327 }
2328 return SWIG_TypeError;
2329 }
2330 #endif
2331
2332
2333 SWIGINTERNINLINE int
SWIG_AsVal_size_t(VALUE obj,size_t * val)2334 SWIG_AsVal_size_t (VALUE obj, size_t *val)
2335 {
2336 int res = SWIG_TypeError;
2337 #ifdef SWIG_LONG_LONG_AVAILABLE
2338 if (sizeof(size_t) <= sizeof(unsigned long)) {
2339 #endif
2340 unsigned long v;
2341 res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
2342 if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
2343 #ifdef SWIG_LONG_LONG_AVAILABLE
2344 } else if (sizeof(size_t) <= sizeof(unsigned long long)) {
2345 unsigned long long v;
2346 res = SWIG_AsVal_unsigned_SS_long_SS_long (obj, val ? &v : 0);
2347 if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
2348 }
2349 #endif
2350 return res;
2351 }
2352
2353
2354 #ifdef SWIG_LONG_LONG_AVAILABLE
2355 SWIGINTERNINLINE VALUE
SWIG_From_unsigned_SS_long_SS_long(unsigned long long value)2356 SWIG_From_unsigned_SS_long_SS_long (unsigned long long value)
2357 {
2358 return ULL2NUM(value);
2359 }
2360 #endif
2361
2362
2363 SWIGINTERNINLINE VALUE
SWIG_From_size_t(size_t value)2364 SWIG_From_size_t (size_t value)
2365 {
2366 #ifdef SWIG_LONG_LONG_AVAILABLE
2367 if (sizeof(size_t) <= sizeof(unsigned long)) {
2368 #endif
2369 return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value));
2370 #ifdef SWIG_LONG_LONG_AVAILABLE
2371 } else {
2372 /* assume sizeof(size_t) <= sizeof(unsigned long long) */
2373 return SWIG_From_unsigned_SS_long_SS_long (static_cast< unsigned long long >(value));
2374 }
2375 #endif
2376 }
2377
2378
2379 SWIGINTERN int
SWIG_AsVal_int(VALUE obj,int * val)2380 SWIG_AsVal_int (VALUE obj, int *val)
2381 {
2382 long v;
2383 int res = SWIG_AsVal_long (obj, &v);
2384 if (SWIG_IsOK(res)) {
2385 if ((v < INT_MIN || v > INT_MAX)) {
2386 return SWIG_OverflowError;
2387 } else {
2388 if (val) *val = static_cast< int >(v);
2389 }
2390 }
2391 return res;
2392 }
2393
HashCounter_get(HashCounter const * self,MerDNA const & m,std::pair<bool,uint64_t> * COUNT)2394 SWIGINTERN void HashCounter_get(HashCounter const *self,MerDNA const &m,std::pair< bool,uint64_t > *COUNT){
2395 COUNT->first = self->ary()->get_val_for_key(m, &COUNT->second);
2396 }
HashCounter___getitem__(HashCounter const * self,MerDNA const & m,std::pair<bool,uint64_t> * COUNT)2397 SWIGINTERN void HashCounter___getitem__(HashCounter const *self,MerDNA const &m,std::pair< bool,uint64_t > *COUNT){
2398 COUNT->first = self->ary()->get_val_for_key(m, &COUNT->second);
2399 }
2400
2401 class HashSet : public jellyfish::cooperative::hash_counter<jellyfish::mer_dna> {
2402 typedef jellyfish::cooperative::hash_counter<jellyfish::mer_dna> super;
2403 public:
HashSet(size_t size,unsigned int nb_threads=1)2404 HashSet(size_t size, unsigned int nb_threads = 1) : \
2405 super(size, jellyfish::mer_dna::k() * 2, 0, nb_threads)
2406 { }
2407
add(const MerDNA & m)2408 bool add(const MerDNA& m) {
2409 bool res;
2410 size_t id;
2411 super::set(m, &res, &id);
2412 return res;
2413 }
2414 };
2415
HashSet_get(HashSet const * self,MerDNA const & m)2416 SWIGINTERN bool HashSet_get(HashSet const *self,MerDNA const &m){ return self->ary()->has_key(m); }
HashSet___getitem__(HashSet const * self,MerDNA const & m)2417 SWIGINTERN bool HashSet___getitem__(HashSet const *self,MerDNA const &m){ return self->ary()->has_key(m); }
2418
2419 class StringMers {
2420 #ifdef SWIGPYTHON
2421 const char* const m_str;
2422 #endif
2423 const char* m_current;
2424 const char* const m_last;
2425 const bool m_canonical;
2426 MerDNA m_m, m_rcm;
2427 unsigned int m_filled;
2428
2429 public:
StringMers(const char * str,int len,bool canonical)2430 StringMers(const char* str, int len, bool canonical)
2431 #ifdef SWIGPYTHON
2432 : m_str(strndup(str, len)) // In Python, duplicate the string! Can this be improved?
2433 , m_current(m_str)
2434 #else
2435 : m_current(str)
2436 #endif
2437 , m_last(m_current + len)
2438 , m_canonical(canonical)
2439 , m_filled(0)
2440 { }
2441
2442 #ifdef SWIGPYTHON
~StringMers()2443 ~StringMers() {
2444 free((void*)m_str);
2445 }
2446 #endif
2447
next_mer()2448 bool next_mer() {
2449 if(m_current == m_last)
2450 return false;
2451
2452 do {
2453 int code = jellyfish::mer_dna::code(*m_current);
2454 ++m_current;
2455 if(code >= 0) {
2456 m_m.shift_left(code);
2457 if(m_canonical)
2458 m_rcm.shift_right(m_rcm.complement(code));
2459 m_filled = std::min(m_filled + 1, m_m.k());
2460 } else
2461 m_filled = 0;
2462 } while(m_filled < m_m.k() && m_current != m_last);
2463 return m_filled == m_m.k();
2464 }
2465
mer() const2466 const MerDNA* mer() const { return !m_canonical || m_m < m_rcm ? &m_m : &m_rcm; }
2467
next_mer__()2468 const MerDNA* next_mer__() {
2469 return next_mer() ? mer() : nullptr;
2470 }
2471
2472
2473 #ifdef SWIGRUBY
each()2474 void each() {
2475 if(!rb_block_given_p()) return;
2476 while(next_mer()) {
2477 auto m = SWIG_NewPointerObj(const_cast<MerDNA*>(mer()), SWIGTYPE_p_MerDNA, 0);
2478 rb_yield(m);
2479 }
2480 }
2481 #endif
2482
2483 #ifdef SWIGPYTHON
__iter__()2484 StringMers* __iter__() { return this; }
__next__()2485 const MerDNA* __next__() { return next_mer__(); }
next()2486 const MerDNA* next() { return next_mer__(); }
2487 #endif
2488
2489 #ifdef SWIGPERL
each()2490 const MerDNA* each() { return next_mer__(); }
2491 #endif
2492
2493 };
2494
string_mers(char * str,int length)2495 StringMers* string_mers(char* str, int length) { return new StringMers(str, length, false); }
string_canonicals(char * str,int length)2496 StringMers* string_canonicals(char* str, int length) { return new StringMers(str, length, true); }
2497
2498
2499 SWIGINTERN int
SWIG_AsVal_bool(VALUE obj,bool * val)2500 SWIG_AsVal_bool (VALUE obj, bool *val)
2501 {
2502 if (obj == Qtrue) {
2503 if (val) *val = true;
2504 return SWIG_OK;
2505 } else if (obj == Qfalse) {
2506 if (val) *val = false;
2507 return SWIG_OK;
2508 } else {
2509 int res = 0;
2510 if (SWIG_AsVal_int (obj, &res) == SWIG_OK) {
2511 if (val) *val = res ? true : false;
2512 return SWIG_OK;
2513 }
2514 }
2515 return SWIG_TypeError;
2516 }
2517
2518
2519 /*
2520 Document-class: Jellyfish::MerDNA
2521
2522 call-seq:
2523
2524
2525 Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int).
2526 */
2527 static swig_class SwigClassMerDNA;
2528
2529
2530 /*
2531 Document-method: Jellyfish::MerDNA.new
2532
2533 call-seq:
2534
2535
2536
2537
2538 Class representing a mer. All the mers have the same length, which must be set BEFORE instantiating any mers with jellyfish::MerDNA::k(int).
2539 */
2540 SWIGINTERN VALUE
_wrap_new_MerDNA__SWIG_0(int argc,VALUE * argv,VALUE self)2541 _wrap_new_MerDNA__SWIG_0(int argc, VALUE *argv, VALUE self) {
2542 MerDNA *result = 0 ;
2543
2544 if ((argc < 0) || (argc > 0)) {
2545 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2546 }
2547 result = (MerDNA *)new MerDNA();
2548 DATA_PTR(self) = result;
2549 return self;
2550 fail:
2551 return Qnil;
2552 }
2553
2554
2555 SWIGINTERN VALUE
_wrap_new_MerDNA__SWIG_1(int argc,VALUE * argv,VALUE self)2556 _wrap_new_MerDNA__SWIG_1(int argc, VALUE *argv, VALUE self) {
2557 char *arg1 = (char *) 0 ;
2558 int res1 ;
2559 char *buf1 = 0 ;
2560 int alloc1 = 0 ;
2561 MerDNA *result = 0 ;
2562
2563 if ((argc < 1) || (argc > 1)) {
2564 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2565 }
2566 res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2567 if (!SWIG_IsOK(res1)) {
2568 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","MerDNA", 1, argv[0] ));
2569 }
2570 arg1 = reinterpret_cast< char * >(buf1);
2571 result = (MerDNA *)new MerDNA((char const *)arg1);
2572 DATA_PTR(self) = result;
2573 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
2574 return self;
2575 fail:
2576 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
2577 return Qnil;
2578 }
2579
2580
2581 SWIGINTERN VALUE
2582 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
_wrap_MerDNA_allocate(VALUE self)2583 _wrap_MerDNA_allocate(VALUE self)
2584 #else
2585 _wrap_MerDNA_allocate(int argc, VALUE *argv, VALUE self)
2586 #endif
2587 {
2588 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_MerDNA);
2589 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
2590 rb_obj_call_init(vresult, argc, argv);
2591 #endif
2592 return vresult;
2593 }
2594
2595
2596 SWIGINTERN VALUE
_wrap_new_MerDNA__SWIG_2(int argc,VALUE * argv,VALUE self)2597 _wrap_new_MerDNA__SWIG_2(int argc, VALUE *argv, VALUE self) {
2598 MerDNA *arg1 = 0 ;
2599 void *argp1 ;
2600 int res1 = 0 ;
2601 MerDNA *result = 0 ;
2602
2603 if ((argc < 1) || (argc > 1)) {
2604 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2605 }
2606 res1 = SWIG_ConvertPtr(argv[0], &argp1, SWIGTYPE_p_MerDNA, 0 );
2607 if (!SWIG_IsOK(res1)) {
2608 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const &","MerDNA", 1, argv[0] ));
2609 }
2610 if (!argp1) {
2611 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","MerDNA", 1, argv[0]));
2612 }
2613 arg1 = reinterpret_cast< MerDNA * >(argp1);
2614 result = (MerDNA *)new MerDNA((MerDNA const &)*arg1);
2615 DATA_PTR(self) = result;
2616 return self;
2617 fail:
2618 return Qnil;
2619 }
2620
2621
_wrap_new_MerDNA(int nargs,VALUE * args,VALUE self)2622 SWIGINTERN VALUE _wrap_new_MerDNA(int nargs, VALUE *args, VALUE self) {
2623 int argc;
2624 VALUE argv[1];
2625 int ii;
2626
2627 argc = nargs;
2628 if (argc > 1) SWIG_fail;
2629 for (ii = 0; (ii < argc); ++ii) {
2630 argv[ii] = args[ii];
2631 }
2632 if (argc == 0) {
2633 return _wrap_new_MerDNA__SWIG_0(nargs, args, self);
2634 }
2635 if (argc == 1) {
2636 int _v;
2637 void *vptr = 0;
2638 int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_MerDNA, 0);
2639 _v = SWIG_CheckState(res);
2640 if (_v) {
2641 return _wrap_new_MerDNA__SWIG_2(nargs, args, self);
2642 }
2643 }
2644 if (argc == 1) {
2645 int _v;
2646 int res = SWIG_AsCharPtrAndSize(argv[0], 0, NULL, 0);
2647 _v = SWIG_CheckState(res);
2648 if (_v) {
2649 return _wrap_new_MerDNA__SWIG_1(nargs, args, self);
2650 }
2651 }
2652
2653 fail:
2654 Ruby_Format_OverloadedError( argc, 1, "MerDNA.new",
2655 " MerDNA.new()\n"
2656 " MerDNA.new(char const *)\n"
2657 " MerDNA.new(MerDNA const &)\n");
2658
2659 return Qnil;
2660 }
2661
2662
2663
2664 /*
2665 Document-method: Jellyfish::MerDNA.k
2666
2667 call-seq:
2668 k -> unsigned int
2669 k(arg2) -> unsigned int
2670
2671 Get the length of the k-mers.
2672 */
2673 SWIGINTERN VALUE
_wrap_MerDNA_k__SWIG_0(int argc,VALUE * argv,VALUE self)2674 _wrap_MerDNA_k__SWIG_0(int argc, VALUE *argv, VALUE self) {
2675 unsigned int result;
2676 VALUE vresult = Qnil;
2677
2678 if ((argc < 0) || (argc > 0)) {
2679 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2680 }
2681 result = (unsigned int)MerDNA::k();
2682 vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
2683 return vresult;
2684 fail:
2685 return Qnil;
2686 }
2687
2688
2689 SWIGINTERN VALUE
_wrap_MerDNA_k__SWIG_1(int argc,VALUE * argv,VALUE self)2690 _wrap_MerDNA_k__SWIG_1(int argc, VALUE *argv, VALUE self) {
2691 unsigned int arg1 ;
2692 unsigned int val1 ;
2693 int ecode1 = 0 ;
2694 unsigned int result;
2695 VALUE vresult = Qnil;
2696
2697 if ((argc < 1) || (argc > 1)) {
2698 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2699 }
2700 ecode1 = SWIG_AsVal_unsigned_SS_int(argv[0], &val1);
2701 if (!SWIG_IsOK(ecode1)) {
2702 SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "unsigned int","MerDNA::k", 1, argv[0] ));
2703 }
2704 arg1 = static_cast< unsigned int >(val1);
2705 result = (unsigned int)MerDNA::k(arg1);
2706 vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
2707 return vresult;
2708 fail:
2709 return Qnil;
2710 }
2711
2712
_wrap_MerDNA_k(int nargs,VALUE * args,VALUE self)2713 SWIGINTERN VALUE _wrap_MerDNA_k(int nargs, VALUE *args, VALUE self) {
2714 int argc;
2715 VALUE argv[1];
2716 int ii;
2717
2718 argc = nargs;
2719 if (argc > 1) SWIG_fail;
2720 for (ii = 0; (ii < argc); ++ii) {
2721 argv[ii] = args[ii];
2722 }
2723 if (argc == 0) {
2724 return _wrap_MerDNA_k__SWIG_0(nargs, args, self);
2725 }
2726 if (argc == 1) {
2727 int _v;
2728 {
2729 int res = SWIG_AsVal_unsigned_SS_int(argv[0], NULL);
2730 _v = SWIG_CheckState(res);
2731 }
2732 if (_v) {
2733 return _wrap_MerDNA_k__SWIG_1(nargs, args, self);
2734 }
2735 }
2736
2737 fail:
2738 Ruby_Format_OverloadedError( argc, 1, "MerDNA.k",
2739 " unsigned int MerDNA.k()\n"
2740 " unsigned int MerDNA.k(unsigned int)\n");
2741
2742 return Qnil;
2743 }
2744
2745
2746
2747 /*
2748 Document-method: Jellyfish::MerDNA.polyA
2749
2750 call-seq:
2751 polyA
2752
2753 Change the mer to a homopolymer of A.
2754 */
2755 SWIGINTERN VALUE
_wrap_MerDNA_polyAN___(int argc,VALUE * argv,VALUE self)2756 _wrap_MerDNA_polyAN___(int argc, VALUE *argv, VALUE self) {
2757 MerDNA *arg1 = (MerDNA *) 0 ;
2758 void *argp1 = 0 ;
2759 int res1 = 0 ;
2760
2761 if ((argc < 0) || (argc > 0)) {
2762 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2763 }
2764 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
2765 if (!SWIG_IsOK(res1)) {
2766 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","polyA", 1, self ));
2767 }
2768 arg1 = reinterpret_cast< MerDNA * >(argp1);
2769 (arg1)->polyA();
2770 return Qnil;
2771 fail:
2772 return Qnil;
2773 }
2774
2775
2776
2777 /*
2778 Document-method: Jellyfish::MerDNA.polyC
2779
2780 call-seq:
2781 polyC
2782
2783 Change the mer to a homopolymer of C.
2784 */
2785 SWIGINTERN VALUE
_wrap_MerDNA_polyCN___(int argc,VALUE * argv,VALUE self)2786 _wrap_MerDNA_polyCN___(int argc, VALUE *argv, VALUE self) {
2787 MerDNA *arg1 = (MerDNA *) 0 ;
2788 void *argp1 = 0 ;
2789 int res1 = 0 ;
2790
2791 if ((argc < 0) || (argc > 0)) {
2792 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2793 }
2794 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
2795 if (!SWIG_IsOK(res1)) {
2796 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","polyC", 1, self ));
2797 }
2798 arg1 = reinterpret_cast< MerDNA * >(argp1);
2799 (arg1)->polyC();
2800 return Qnil;
2801 fail:
2802 return Qnil;
2803 }
2804
2805
2806
2807 /*
2808 Document-method: Jellyfish::MerDNA.polyG
2809
2810 call-seq:
2811 polyG
2812
2813 Change the mer to a homopolymer of G.
2814 */
2815 SWIGINTERN VALUE
_wrap_MerDNA_polyGN___(int argc,VALUE * argv,VALUE self)2816 _wrap_MerDNA_polyGN___(int argc, VALUE *argv, VALUE self) {
2817 MerDNA *arg1 = (MerDNA *) 0 ;
2818 void *argp1 = 0 ;
2819 int res1 = 0 ;
2820
2821 if ((argc < 0) || (argc > 0)) {
2822 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2823 }
2824 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
2825 if (!SWIG_IsOK(res1)) {
2826 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","polyG", 1, self ));
2827 }
2828 arg1 = reinterpret_cast< MerDNA * >(argp1);
2829 (arg1)->polyG();
2830 return Qnil;
2831 fail:
2832 return Qnil;
2833 }
2834
2835
2836
2837 /*
2838 Document-method: Jellyfish::MerDNA.polyT
2839
2840 call-seq:
2841 polyT
2842
2843 Change the mer to a homopolymer of T.
2844 */
2845 SWIGINTERN VALUE
_wrap_MerDNA_polyTN___(int argc,VALUE * argv,VALUE self)2846 _wrap_MerDNA_polyTN___(int argc, VALUE *argv, VALUE self) {
2847 MerDNA *arg1 = (MerDNA *) 0 ;
2848 void *argp1 = 0 ;
2849 int res1 = 0 ;
2850
2851 if ((argc < 0) || (argc > 0)) {
2852 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2853 }
2854 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
2855 if (!SWIG_IsOK(res1)) {
2856 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","polyT", 1, self ));
2857 }
2858 arg1 = reinterpret_cast< MerDNA * >(argp1);
2859 (arg1)->polyT();
2860 return Qnil;
2861 fail:
2862 return Qnil;
2863 }
2864
2865
2866
2867 /*
2868 Document-method: Jellyfish::MerDNA.randomize
2869
2870 call-seq:
2871 randomize
2872
2873 Change the mer to a random one.
2874 */
2875 SWIGINTERN VALUE
_wrap_MerDNA_randomizeN___(int argc,VALUE * argv,VALUE self)2876 _wrap_MerDNA_randomizeN___(int argc, VALUE *argv, VALUE self) {
2877 MerDNA *arg1 = (MerDNA *) 0 ;
2878 void *argp1 = 0 ;
2879 int res1 = 0 ;
2880
2881 if ((argc < 0) || (argc > 0)) {
2882 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2883 }
2884 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
2885 if (!SWIG_IsOK(res1)) {
2886 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","randomize", 1, self ));
2887 }
2888 arg1 = reinterpret_cast< MerDNA * >(argp1);
2889 (arg1)->randomize();
2890 return Qnil;
2891 fail:
2892 return Qnil;
2893 }
2894
2895
2896
2897 /*
2898 Document-method: Jellyfish::MerDNA.is_homopolymer
2899
2900 call-seq:
2901 is_homopolymer -> bool
2902
2903 Check if the mer is a homopolymer.
2904 */
2905 SWIGINTERN VALUE
_wrap_MerDNA_is_homopolymer(int argc,VALUE * argv,VALUE self)2906 _wrap_MerDNA_is_homopolymer(int argc, VALUE *argv, VALUE self) {
2907 MerDNA *arg1 = (MerDNA *) 0 ;
2908 void *argp1 = 0 ;
2909 int res1 = 0 ;
2910 bool result;
2911 VALUE vresult = Qnil;
2912
2913 if ((argc < 0) || (argc > 0)) {
2914 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
2915 }
2916 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
2917 if (!SWIG_IsOK(res1)) {
2918 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","is_homopolymer", 1, self ));
2919 }
2920 arg1 = reinterpret_cast< MerDNA * >(argp1);
2921 result = (bool)((MerDNA const *)arg1)->is_homopolymer();
2922 vresult = SWIG_From_bool(static_cast< bool >(result));
2923 return vresult;
2924 fail:
2925 return Qnil;
2926 }
2927
2928
2929
2930 /*
2931 Document-method: Jellyfish::MerDNA.shift_left
2932
2933 call-seq:
2934 shift_left(arg2) -> char
2935
2936 Shift a base to the left and the leftmost base is return . "ACGT", shift_left('A') becomes "CGTA" and 'A' is returned.
2937 */
2938 SWIGINTERN VALUE
_wrap_MerDNA_shift_left(int argc,VALUE * argv,VALUE self)2939 _wrap_MerDNA_shift_left(int argc, VALUE *argv, VALUE self) {
2940 MerDNA *arg1 = (MerDNA *) 0 ;
2941 char arg2 ;
2942 void *argp1 = 0 ;
2943 int res1 = 0 ;
2944 char val2 ;
2945 int ecode2 = 0 ;
2946 char result;
2947 VALUE vresult = Qnil;
2948
2949 if ((argc < 1) || (argc > 1)) {
2950 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2951 }
2952 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
2953 if (!SWIG_IsOK(res1)) {
2954 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","shift_left", 1, self ));
2955 }
2956 arg1 = reinterpret_cast< MerDNA * >(argp1);
2957 ecode2 = SWIG_AsVal_char(argv[0], &val2);
2958 if (!SWIG_IsOK(ecode2)) {
2959 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "char","shift_left", 2, argv[0] ));
2960 }
2961 arg2 = static_cast< char >(val2);
2962 result = (char)(arg1)->shift_left(arg2);
2963 vresult = SWIG_From_char(static_cast< char >(result));
2964 return vresult;
2965 fail:
2966 return Qnil;
2967 }
2968
2969
2970
2971 /*
2972 Document-method: Jellyfish::MerDNA.shift_right
2973
2974 call-seq:
2975 shift_right(arg2) -> char
2976
2977 Shift a base to the right and the rightmost base is return . "ACGT", shift_right('A') becomes "AACG" and 'T' is returned.
2978 */
2979 SWIGINTERN VALUE
_wrap_MerDNA_shift_right(int argc,VALUE * argv,VALUE self)2980 _wrap_MerDNA_shift_right(int argc, VALUE *argv, VALUE self) {
2981 MerDNA *arg1 = (MerDNA *) 0 ;
2982 char arg2 ;
2983 void *argp1 = 0 ;
2984 int res1 = 0 ;
2985 char val2 ;
2986 int ecode2 = 0 ;
2987 char result;
2988 VALUE vresult = Qnil;
2989
2990 if ((argc < 1) || (argc > 1)) {
2991 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
2992 }
2993 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
2994 if (!SWIG_IsOK(res1)) {
2995 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","shift_right", 1, self ));
2996 }
2997 arg1 = reinterpret_cast< MerDNA * >(argp1);
2998 ecode2 = SWIG_AsVal_char(argv[0], &val2);
2999 if (!SWIG_IsOK(ecode2)) {
3000 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "char","shift_right", 2, argv[0] ));
3001 }
3002 arg2 = static_cast< char >(val2);
3003 result = (char)(arg1)->shift_right(arg2);
3004 vresult = SWIG_From_char(static_cast< char >(result));
3005 return vresult;
3006 fail:
3007 return Qnil;
3008 }
3009
3010
3011
3012 /*
3013 Document-method: Jellyfish::MerDNA.canonicalize
3014
3015 call-seq:
3016 canonicalize
3017
3018 Change the mer to its canonical representation.
3019 */
3020 SWIGINTERN VALUE
_wrap_MerDNA_canonicalizeN___(int argc,VALUE * argv,VALUE self)3021 _wrap_MerDNA_canonicalizeN___(int argc, VALUE *argv, VALUE self) {
3022 MerDNA *arg1 = (MerDNA *) 0 ;
3023 void *argp1 = 0 ;
3024 int res1 = 0 ;
3025
3026 if ((argc < 0) || (argc > 0)) {
3027 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3028 }
3029 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3030 if (!SWIG_IsOK(res1)) {
3031 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","canonicalize", 1, self ));
3032 }
3033 arg1 = reinterpret_cast< MerDNA * >(argp1);
3034 (arg1)->canonicalize();
3035 return Qnil;
3036 fail:
3037 return Qnil;
3038 }
3039
3040
3041
3042 /*
3043 Document-method: Jellyfish::MerDNA.reverse_complement
3044
3045 call-seq:
3046 reverse_complement
3047
3048 Change the mer to its reverse complement.
3049 */
3050 SWIGINTERN VALUE
_wrap_MerDNA_reverse_complementN___(int argc,VALUE * argv,VALUE self)3051 _wrap_MerDNA_reverse_complementN___(int argc, VALUE *argv, VALUE self) {
3052 MerDNA *arg1 = (MerDNA *) 0 ;
3053 void *argp1 = 0 ;
3054 int res1 = 0 ;
3055
3056 if ((argc < 0) || (argc > 0)) {
3057 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3058 }
3059 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3060 if (!SWIG_IsOK(res1)) {
3061 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","reverse_complement", 1, self ));
3062 }
3063 arg1 = reinterpret_cast< MerDNA * >(argp1);
3064 (arg1)->reverse_complement();
3065 return Qnil;
3066 fail:
3067 return Qnil;
3068 }
3069
3070
3071
3072 /*
3073 Document-method: Jellyfish::MerDNA.get_canonical
3074
3075 call-seq:
3076 get_canonical -> MerDNA
3077
3078 Return canonical representation of the mer.
3079 */
3080 SWIGINTERN VALUE
_wrap_MerDNA_get_canonical(int argc,VALUE * argv,VALUE self)3081 _wrap_MerDNA_get_canonical(int argc, VALUE *argv, VALUE self) {
3082 MerDNA *arg1 = (MerDNA *) 0 ;
3083 void *argp1 = 0 ;
3084 int res1 = 0 ;
3085 MerDNA result;
3086 VALUE vresult = Qnil;
3087
3088 if ((argc < 0) || (argc > 0)) {
3089 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3090 }
3091 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3092 if (!SWIG_IsOK(res1)) {
3093 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","get_canonical", 1, self ));
3094 }
3095 arg1 = reinterpret_cast< MerDNA * >(argp1);
3096 result = ((MerDNA const *)arg1)->get_canonical();
3097 vresult = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 );
3098 return vresult;
3099 fail:
3100 return Qnil;
3101 }
3102
3103
3104
3105 /*
3106 Document-method: Jellyfish::MerDNA.get_reverse_complement
3107
3108 call-seq:
3109 get_reverse_complement -> MerDNA
3110
3111 Return the reverse complement of the mer.
3112 */
3113 SWIGINTERN VALUE
_wrap_MerDNA_get_reverse_complement(int argc,VALUE * argv,VALUE self)3114 _wrap_MerDNA_get_reverse_complement(int argc, VALUE *argv, VALUE self) {
3115 MerDNA *arg1 = (MerDNA *) 0 ;
3116 void *argp1 = 0 ;
3117 int res1 = 0 ;
3118 MerDNA result;
3119 VALUE vresult = Qnil;
3120
3121 if ((argc < 0) || (argc > 0)) {
3122 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3123 }
3124 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3125 if (!SWIG_IsOK(res1)) {
3126 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","get_reverse_complement", 1, self ));
3127 }
3128 arg1 = reinterpret_cast< MerDNA * >(argp1);
3129 result = ((MerDNA const *)arg1)->get_reverse_complement();
3130 vresult = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 );
3131 return vresult;
3132 fail:
3133 return Qnil;
3134 }
3135
3136
3137
3138 /*
3139 Document-method: Jellyfish::MerDNA.==
3140
3141 call-seq:
3142 ==(arg2) -> bool
3143
3144 Equality between mers.
3145 */
3146 SWIGINTERN VALUE
_wrap_MerDNA___eq__(int argc,VALUE * argv,VALUE self)3147 _wrap_MerDNA___eq__(int argc, VALUE *argv, VALUE self) {
3148 MerDNA *arg1 = (MerDNA *) 0 ;
3149 MerDNA *arg2 = 0 ;
3150 void *argp1 = 0 ;
3151 int res1 = 0 ;
3152 void *argp2 ;
3153 int res2 = 0 ;
3154 bool result;
3155 VALUE vresult = Qnil;
3156
3157 if ((argc < 1) || (argc > 1)) {
3158 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3159 }
3160 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3161 if (!SWIG_IsOK(res1)) {
3162 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","operator ==", 1, self ));
3163 }
3164 arg1 = reinterpret_cast< MerDNA * >(argp1);
3165 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
3166 if (!SWIG_IsOK(res2)) {
3167 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","operator ==", 2, argv[0] ));
3168 }
3169 if (!argp2) {
3170 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","operator ==", 2, argv[0]));
3171 }
3172 arg2 = reinterpret_cast< MerDNA * >(argp2);
3173 result = (bool)((MerDNA const *)arg1)->operator ==((MerDNA const &)*arg2);
3174 vresult = SWIG_From_bool(static_cast< bool >(result));
3175 return vresult;
3176 fail:
3177 return Qnil;
3178 }
3179
3180
3181
3182 /*
3183 Document-method: Jellyfish::MerDNA.<
3184
3185 call-seq:
3186 <(arg2) -> bool
3187
3188 Lexicographic less-than.
3189 */
3190 SWIGINTERN VALUE
_wrap_MerDNA___lt__(int argc,VALUE * argv,VALUE self)3191 _wrap_MerDNA___lt__(int argc, VALUE *argv, VALUE self) {
3192 MerDNA *arg1 = (MerDNA *) 0 ;
3193 MerDNA *arg2 = 0 ;
3194 void *argp1 = 0 ;
3195 int res1 = 0 ;
3196 void *argp2 ;
3197 int res2 = 0 ;
3198 bool result;
3199 VALUE vresult = Qnil;
3200
3201 if ((argc < 1) || (argc > 1)) {
3202 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3203 }
3204 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3205 if (!SWIG_IsOK(res1)) {
3206 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","operator <", 1, self ));
3207 }
3208 arg1 = reinterpret_cast< MerDNA * >(argp1);
3209 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
3210 if (!SWIG_IsOK(res2)) {
3211 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","operator <", 2, argv[0] ));
3212 }
3213 if (!argp2) {
3214 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","operator <", 2, argv[0]));
3215 }
3216 arg2 = reinterpret_cast< MerDNA * >(argp2);
3217 result = (bool)((MerDNA const *)arg1)->operator <((MerDNA const &)*arg2);
3218 vresult = SWIG_From_bool(static_cast< bool >(result));
3219 return vresult;
3220 fail:
3221 return Qnil;
3222 }
3223
3224
3225
3226 /*
3227 Document-method: Jellyfish::MerDNA.>
3228
3229 call-seq:
3230 >(arg2) -> bool
3231
3232 Lexicographic greater-than.
3233 */
3234 SWIGINTERN VALUE
_wrap_MerDNA___gt__(int argc,VALUE * argv,VALUE self)3235 _wrap_MerDNA___gt__(int argc, VALUE *argv, VALUE self) {
3236 MerDNA *arg1 = (MerDNA *) 0 ;
3237 MerDNA *arg2 = 0 ;
3238 void *argp1 = 0 ;
3239 int res1 = 0 ;
3240 void *argp2 ;
3241 int res2 = 0 ;
3242 bool result;
3243 VALUE vresult = Qnil;
3244
3245 if ((argc < 1) || (argc > 1)) {
3246 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3247 }
3248 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3249 if (!SWIG_IsOK(res1)) {
3250 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","operator >", 1, self ));
3251 }
3252 arg1 = reinterpret_cast< MerDNA * >(argp1);
3253 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
3254 if (!SWIG_IsOK(res2)) {
3255 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","operator >", 2, argv[0] ));
3256 }
3257 if (!argp2) {
3258 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","operator >", 2, argv[0]));
3259 }
3260 arg2 = reinterpret_cast< MerDNA * >(argp2);
3261 result = (bool)((MerDNA const *)arg1)->operator >((MerDNA const &)*arg2);
3262 vresult = SWIG_From_bool(static_cast< bool >(result));
3263 return vresult;
3264 fail:
3265 return Qnil;
3266 }
3267
3268
3269
3270 /*
3271 Document-method: Jellyfish::MerDNA.dup
3272
3273 call-seq:
3274 dup -> MerDNA
3275
3276 Duplicate the mer.
3277 */
3278 SWIGINTERN VALUE
_wrap_MerDNA_dup(int argc,VALUE * argv,VALUE self)3279 _wrap_MerDNA_dup(int argc, VALUE *argv, VALUE self) {
3280 MerDNA *arg1 = (MerDNA *) 0 ;
3281 void *argp1 = 0 ;
3282 int res1 = 0 ;
3283 MerDNA result;
3284 VALUE vresult = Qnil;
3285
3286 if ((argc < 0) || (argc > 0)) {
3287 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3288 }
3289 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3290 if (!SWIG_IsOK(res1)) {
3291 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA const *","dup", 1, self ));
3292 }
3293 arg1 = reinterpret_cast< MerDNA * >(argp1);
3294 result = MerDNA_dup((MerDNA const *)arg1);
3295 vresult = SWIG_NewPointerObj((new MerDNA(static_cast< const MerDNA& >(result))), SWIGTYPE_p_MerDNA, SWIG_POINTER_OWN | 0 );
3296 return vresult;
3297 fail:
3298 return Qnil;
3299 }
3300
3301
3302
3303 /*
3304 Document-method: Jellyfish::MerDNA.to_s
3305
3306 call-seq:
3307 to_s -> std::string
3308
3309 Return string representation of the mer.
3310 */
3311 SWIGINTERN VALUE
_wrap_MerDNA___str__(int argc,VALUE * argv,VALUE self)3312 _wrap_MerDNA___str__(int argc, VALUE *argv, VALUE self) {
3313 MerDNA *arg1 = (MerDNA *) 0 ;
3314 void *argp1 = 0 ;
3315 int res1 = 0 ;
3316 std::string result;
3317 VALUE vresult = Qnil;
3318
3319 if ((argc < 0) || (argc > 0)) {
3320 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3321 }
3322 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3323 if (!SWIG_IsOK(res1)) {
3324 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__str__", 1, self ));
3325 }
3326 arg1 = reinterpret_cast< MerDNA * >(argp1);
3327 result = MerDNA___str__(arg1);
3328 vresult = SWIG_From_std_string(static_cast< std::string >(result));
3329 return vresult;
3330 fail:
3331 return Qnil;
3332 }
3333
3334
3335
3336 /*
3337 Document-method: Jellyfish::MerDNA.set
3338
3339 call-seq:
3340 set(s)
3341
3342 Set the mer from a string.
3343 */
3344 SWIGINTERN VALUE
_wrap_MerDNA_set(int argc,VALUE * argv,VALUE self)3345 _wrap_MerDNA_set(int argc, VALUE *argv, VALUE self) {
3346 MerDNA *arg1 = (MerDNA *) 0 ;
3347 char *arg2 = (char *) 0 ;
3348 void *argp1 = 0 ;
3349 int res1 = 0 ;
3350 int res2 ;
3351 char *buf2 = 0 ;
3352 int alloc2 = 0 ;
3353
3354 if ((argc < 1) || (argc > 1)) {
3355 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3356 }
3357 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3358 if (!SWIG_IsOK(res1)) {
3359 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","set", 1, self ));
3360 }
3361 arg1 = reinterpret_cast< MerDNA * >(argp1);
3362 res2 = SWIG_AsCharPtrAndSize(argv[0], &buf2, NULL, &alloc2);
3363 if (!SWIG_IsOK(res2)) {
3364 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char const *","set", 2, argv[0] ));
3365 }
3366 arg2 = reinterpret_cast< char * >(buf2);
3367 try {
3368 MerDNA_set(arg1,(char const *)arg2);
3369 }
3370 catch(std::length_error &_e) {
3371 SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
3372 }
3373
3374 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3375 return Qnil;
3376 fail:
3377 if (alloc2 == SWIG_NEWOBJ) delete[] buf2;
3378 return Qnil;
3379 }
3380
3381
3382
3383 /*
3384 Document-method: Jellyfish::MerDNA.[]
3385
3386 call-seq:
3387 [](i) -> char
3388
3389 Get base i (0 <= i < k).
3390 */
3391 SWIGINTERN VALUE
_wrap_MerDNA___getitem__(int argc,VALUE * argv,VALUE self)3392 _wrap_MerDNA___getitem__(int argc, VALUE *argv, VALUE self) {
3393 MerDNA *arg1 = (MerDNA *) 0 ;
3394 unsigned int arg2 ;
3395 void *argp1 = 0 ;
3396 int res1 = 0 ;
3397 unsigned int val2 ;
3398 int ecode2 = 0 ;
3399 char result;
3400 VALUE vresult = Qnil;
3401
3402 if ((argc < 1) || (argc > 1)) {
3403 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3404 }
3405 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3406 if (!SWIG_IsOK(res1)) {
3407 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__getitem__", 1, self ));
3408 }
3409 arg1 = reinterpret_cast< MerDNA * >(argp1);
3410 ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
3411 if (!SWIG_IsOK(ecode2)) {
3412 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","__getitem__", 2, argv[0] ));
3413 }
3414 arg2 = static_cast< unsigned int >(val2);
3415 result = (char)MerDNA___getitem__(arg1,arg2);
3416 vresult = SWIG_From_char(static_cast< char >(result));
3417 return vresult;
3418 fail:
3419 return Qnil;
3420 }
3421
3422
3423
3424 /*
3425 Document-method: Jellyfish::MerDNA.[]=
3426
3427 call-seq:
3428 []=(i, b)
3429
3430 Set base i (0 <= i < k).
3431 */
3432 SWIGINTERN VALUE
_wrap_MerDNA___setitem__(int argc,VALUE * argv,VALUE self)3433 _wrap_MerDNA___setitem__(int argc, VALUE *argv, VALUE self) {
3434 MerDNA *arg1 = (MerDNA *) 0 ;
3435 unsigned int arg2 ;
3436 char arg3 ;
3437 void *argp1 = 0 ;
3438 int res1 = 0 ;
3439 unsigned int val2 ;
3440 int ecode2 = 0 ;
3441 char val3 ;
3442 int ecode3 = 0 ;
3443
3444 if ((argc < 2) || (argc > 2)) {
3445 rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3446 }
3447 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3448 if (!SWIG_IsOK(res1)) {
3449 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__setitem__", 1, self ));
3450 }
3451 arg1 = reinterpret_cast< MerDNA * >(argp1);
3452 ecode2 = SWIG_AsVal_unsigned_SS_int(argv[0], &val2);
3453 if (!SWIG_IsOK(ecode2)) {
3454 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","__setitem__", 2, argv[0] ));
3455 }
3456 arg2 = static_cast< unsigned int >(val2);
3457 ecode3 = SWIG_AsVal_char(argv[1], &val3);
3458 if (!SWIG_IsOK(ecode3)) {
3459 SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "char","__setitem__", 3, argv[1] ));
3460 }
3461 arg3 = static_cast< char >(val3);
3462 MerDNA___setitem__(arg1,arg2,arg3);
3463 return Qnil;
3464 fail:
3465 return Qnil;
3466 }
3467
3468
3469
3470 /*
3471 Document-method: Jellyfish::MerDNA.<<
3472
3473 call-seq:
3474 <<(b) -> MerDNA
3475
3476 Shift a base to the left and return the mer.
3477 */
3478 SWIGINTERN VALUE
_wrap_MerDNA___lshift__(int argc,VALUE * argv,VALUE self)3479 _wrap_MerDNA___lshift__(int argc, VALUE *argv, VALUE self) {
3480 MerDNA *arg1 = (MerDNA *) 0 ;
3481 char arg2 ;
3482 void *argp1 = 0 ;
3483 int res1 = 0 ;
3484 char val2 ;
3485 int ecode2 = 0 ;
3486 MerDNA *result = 0 ;
3487 VALUE vresult = Qnil;
3488
3489 if ((argc < 1) || (argc > 1)) {
3490 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3491 }
3492 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3493 if (!SWIG_IsOK(res1)) {
3494 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__lshift__", 1, self ));
3495 }
3496 arg1 = reinterpret_cast< MerDNA * >(argp1);
3497 ecode2 = SWIG_AsVal_char(argv[0], &val2);
3498 if (!SWIG_IsOK(ecode2)) {
3499 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "char","__lshift__", 2, argv[0] ));
3500 }
3501 arg2 = static_cast< char >(val2);
3502 result = (MerDNA *) &MerDNA___lshift__(arg1,arg2);
3503 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 );
3504 return vresult;
3505 fail:
3506 return Qnil;
3507 }
3508
3509
3510
3511 /*
3512 Document-method: Jellyfish::MerDNA.>>
3513
3514 call-seq:
3515 >>(b) -> MerDNA
3516
3517 Shift a base to the right and return the mer.
3518 */
3519 SWIGINTERN VALUE
_wrap_MerDNA___rshift__(int argc,VALUE * argv,VALUE self)3520 _wrap_MerDNA___rshift__(int argc, VALUE *argv, VALUE self) {
3521 MerDNA *arg1 = (MerDNA *) 0 ;
3522 char arg2 ;
3523 void *argp1 = 0 ;
3524 int res1 = 0 ;
3525 char val2 ;
3526 int ecode2 = 0 ;
3527 MerDNA *result = 0 ;
3528 VALUE vresult = Qnil;
3529
3530 if ((argc < 1) || (argc > 1)) {
3531 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3532 }
3533 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_MerDNA, 0 | 0 );
3534 if (!SWIG_IsOK(res1)) {
3535 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "MerDNA *","__rshift__", 1, self ));
3536 }
3537 arg1 = reinterpret_cast< MerDNA * >(argp1);
3538 ecode2 = SWIG_AsVal_char(argv[0], &val2);
3539 if (!SWIG_IsOK(ecode2)) {
3540 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "char","__rshift__", 2, argv[0] ));
3541 }
3542 arg2 = static_cast< char >(val2);
3543 result = (MerDNA *) &MerDNA___rshift__(arg1,arg2);
3544 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 );
3545 return vresult;
3546 fail:
3547 return Qnil;
3548 }
3549
3550
3551 SWIGINTERN void
free_MerDNA(void * self)3552 free_MerDNA(void *self) {
3553 MerDNA *arg1 = (MerDNA *)self;
3554 delete arg1;
3555 }
3556
3557
3558 /*
3559 Document-class: Jellyfish::QueryMerFile
3560
3561 call-seq:
3562
3563
3564 Give random access to a Jellyfish database. Given a mer, it returns the count associated with that mer.
3565 */
3566 static swig_class SwigClassQueryMerFile;
3567
3568 SWIGINTERN VALUE
3569 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
_wrap_QueryMerFile_allocate(VALUE self)3570 _wrap_QueryMerFile_allocate(VALUE self)
3571 #else
3572 _wrap_QueryMerFile_allocate(int argc, VALUE *argv, VALUE self)
3573 #endif
3574 {
3575 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_QueryMerFile);
3576 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
3577 rb_obj_call_init(vresult, argc, argv);
3578 #endif
3579 return vresult;
3580 }
3581
3582
3583
3584 /*
3585 Document-method: Jellyfish::QueryMerFile.new
3586
3587 call-seq:
3588
3589
3590 Open the jellyfish database.
3591 */
3592 SWIGINTERN VALUE
_wrap_new_QueryMerFile(int argc,VALUE * argv,VALUE self)3593 _wrap_new_QueryMerFile(int argc, VALUE *argv, VALUE self) {
3594 char *arg1 = (char *) 0 ;
3595 int res1 ;
3596 char *buf1 = 0 ;
3597 int alloc1 = 0 ;
3598 QueryMerFile *result = 0 ;
3599
3600 if ((argc < 1) || (argc > 1)) {
3601 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3602 }
3603 res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3604 if (!SWIG_IsOK(res1)) {
3605 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","QueryMerFile", 1, argv[0] ));
3606 }
3607 arg1 = reinterpret_cast< char * >(buf1);
3608 try {
3609 result = (QueryMerFile *)new QueryMerFile((char const *)arg1);
3610 DATA_PTR(self) = result;
3611 }
3612 catch(std::runtime_error &_e) {
3613 SWIG_exception_fail(SWIG_RuntimeError, (&_e)->what());
3614 }
3615
3616 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3617 return self;
3618 fail:
3619 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3620 return Qnil;
3621 }
3622
3623
3624
3625 /*
3626 Document-method: Jellyfish::QueryMerFile.[]
3627
3628 call-seq:
3629 [](m) -> unsigned int
3630
3631 Get the count for the mer m.
3632 */
3633 SWIGINTERN VALUE
_wrap_QueryMerFile___getitem__(int argc,VALUE * argv,VALUE self)3634 _wrap_QueryMerFile___getitem__(int argc, VALUE *argv, VALUE self) {
3635 QueryMerFile *arg1 = (QueryMerFile *) 0 ;
3636 MerDNA *arg2 = 0 ;
3637 void *argp1 = 0 ;
3638 int res1 = 0 ;
3639 void *argp2 ;
3640 int res2 = 0 ;
3641 unsigned int result;
3642 VALUE vresult = Qnil;
3643
3644 if ((argc < 1) || (argc > 1)) {
3645 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3646 }
3647 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_QueryMerFile, 0 | 0 );
3648 if (!SWIG_IsOK(res1)) {
3649 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "QueryMerFile *","__getitem__", 1, self ));
3650 }
3651 arg1 = reinterpret_cast< QueryMerFile * >(argp1);
3652 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
3653 if (!SWIG_IsOK(res2)) {
3654 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","__getitem__", 2, argv[0] ));
3655 }
3656 if (!argp2) {
3657 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","__getitem__", 2, argv[0]));
3658 }
3659 arg2 = reinterpret_cast< MerDNA * >(argp2);
3660 result = (unsigned int)(arg1)->__getitem__((MerDNA const &)*arg2);
3661 vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
3662 return vresult;
3663 fail:
3664 return Qnil;
3665 }
3666
3667
3668 SWIGINTERN void
free_QueryMerFile(void * self)3669 free_QueryMerFile(void *self) {
3670 QueryMerFile *arg1 = (QueryMerFile *)self;
3671 delete arg1;
3672 }
3673
3674
3675 /*
3676 Document-class: Jellyfish::ReadMerFile
3677
3678 call-seq:
3679
3680
3681 Read a Jellyfish database sequentially.
3682 */
3683 static swig_class SwigClassReadMerFile;
3684
3685 SWIGINTERN VALUE
3686 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
_wrap_ReadMerFile_allocate(VALUE self)3687 _wrap_ReadMerFile_allocate(VALUE self)
3688 #else
3689 _wrap_ReadMerFile_allocate(int argc, VALUE *argv, VALUE self)
3690 #endif
3691 {
3692 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_ReadMerFile);
3693 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
3694 rb_obj_call_init(vresult, argc, argv);
3695 #endif
3696 return vresult;
3697 }
3698
3699
3700
3701 /*
3702 Document-method: Jellyfish::ReadMerFile.new
3703
3704 call-seq:
3705
3706
3707 Open the jellyfish database.
3708 */
3709 SWIGINTERN VALUE
_wrap_new_ReadMerFile(int argc,VALUE * argv,VALUE self)3710 _wrap_new_ReadMerFile(int argc, VALUE *argv, VALUE self) {
3711 char *arg1 = (char *) 0 ;
3712 int res1 ;
3713 char *buf1 = 0 ;
3714 int alloc1 = 0 ;
3715 ReadMerFile *result = 0 ;
3716
3717 if ((argc < 1) || (argc > 1)) {
3718 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
3719 }
3720 res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
3721 if (!SWIG_IsOK(res1)) {
3722 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","ReadMerFile", 1, argv[0] ));
3723 }
3724 arg1 = reinterpret_cast< char * >(buf1);
3725 try {
3726 result = (ReadMerFile *)new ReadMerFile((char const *)arg1);
3727 DATA_PTR(self) = result;
3728 }
3729 catch(std::runtime_error &_e) {
3730 SWIG_exception_fail(SWIG_RuntimeError, (&_e)->what());
3731 }
3732
3733 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3734 return self;
3735 fail:
3736 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
3737 return Qnil;
3738 }
3739
3740
3741
3742 /*
3743 Document-method: Jellyfish::ReadMerFile.next_mer
3744
3745 call-seq:
3746 next_mer -> bool
3747
3748 Move to the next mer in the file. Returns false if no mers left, true otherwise.
3749 */
3750 SWIGINTERN VALUE
_wrap_ReadMerFile_next_mer(int argc,VALUE * argv,VALUE self)3751 _wrap_ReadMerFile_next_mer(int argc, VALUE *argv, VALUE self) {
3752 ReadMerFile *arg1 = (ReadMerFile *) 0 ;
3753 void *argp1 = 0 ;
3754 int res1 = 0 ;
3755 bool result;
3756 VALUE vresult = Qnil;
3757
3758 if ((argc < 0) || (argc > 0)) {
3759 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3760 }
3761 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 );
3762 if (!SWIG_IsOK(res1)) {
3763 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ReadMerFile *","next_mer", 1, self ));
3764 }
3765 arg1 = reinterpret_cast< ReadMerFile * >(argp1);
3766 result = (bool)(arg1)->next_mer();
3767 vresult = SWIG_From_bool(static_cast< bool >(result));
3768 return vresult;
3769 fail:
3770 return Qnil;
3771 }
3772
3773
3774
3775 /*
3776 Document-method: Jellyfish::ReadMerFile.mer
3777
3778 call-seq:
3779 mer -> MerDNA
3780
3781 Returns current mer.
3782 */
3783 SWIGINTERN VALUE
_wrap_ReadMerFile_mer(int argc,VALUE * argv,VALUE self)3784 _wrap_ReadMerFile_mer(int argc, VALUE *argv, VALUE self) {
3785 ReadMerFile *arg1 = (ReadMerFile *) 0 ;
3786 void *argp1 = 0 ;
3787 int res1 = 0 ;
3788 MerDNA *result = 0 ;
3789 VALUE vresult = Qnil;
3790
3791 if ((argc < 0) || (argc > 0)) {
3792 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3793 }
3794 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 );
3795 if (!SWIG_IsOK(res1)) {
3796 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ReadMerFile const *","mer", 1, self ));
3797 }
3798 arg1 = reinterpret_cast< ReadMerFile * >(argp1);
3799 result = (MerDNA *)((ReadMerFile const *)arg1)->mer();
3800 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 );
3801 return vresult;
3802 fail:
3803 return Qnil;
3804 }
3805
3806
3807
3808 /*
3809 Document-method: Jellyfish::ReadMerFile.count
3810
3811 call-seq:
3812 count -> unsigned long
3813
3814 Returns the count of the current mer.
3815 */
3816 SWIGINTERN VALUE
_wrap_ReadMerFile_count(int argc,VALUE * argv,VALUE self)3817 _wrap_ReadMerFile_count(int argc, VALUE *argv, VALUE self) {
3818 ReadMerFile *arg1 = (ReadMerFile *) 0 ;
3819 void *argp1 = 0 ;
3820 int res1 = 0 ;
3821 unsigned long result;
3822 VALUE vresult = Qnil;
3823
3824 if ((argc < 0) || (argc > 0)) {
3825 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3826 }
3827 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 );
3828 if (!SWIG_IsOK(res1)) {
3829 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ReadMerFile const *","count", 1, self ));
3830 }
3831 arg1 = reinterpret_cast< ReadMerFile * >(argp1);
3832 result = (unsigned long)((ReadMerFile const *)arg1)->count();
3833 vresult = SWIG_From_unsigned_SS_long(static_cast< unsigned long >(result));
3834 return vresult;
3835 fail:
3836 return Qnil;
3837 }
3838
3839
3840
3841 /*
3842 Document-method: Jellyfish::ReadMerFile.each
3843
3844 call-seq:
3845 each
3846
3847 Iterate through all the mers in the file, passing two values: a mer and its count.
3848 */
3849 SWIGINTERN VALUE
_wrap_ReadMerFile_each(int argc,VALUE * argv,VALUE self)3850 _wrap_ReadMerFile_each(int argc, VALUE *argv, VALUE self) {
3851 ReadMerFile *arg1 = (ReadMerFile *) 0 ;
3852 void *argp1 = 0 ;
3853 int res1 = 0 ;
3854
3855 if ((argc < 0) || (argc > 0)) {
3856 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
3857 }
3858 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_ReadMerFile, 0 | 0 );
3859 if (!SWIG_IsOK(res1)) {
3860 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "ReadMerFile *","each", 1, self ));
3861 }
3862 arg1 = reinterpret_cast< ReadMerFile * >(argp1);
3863 (arg1)->each();
3864 return Qnil;
3865 fail:
3866 return Qnil;
3867 }
3868
3869
3870 SWIGINTERN void
free_ReadMerFile(void * self)3871 free_ReadMerFile(void *self) {
3872 ReadMerFile *arg1 = (ReadMerFile *)self;
3873 delete arg1;
3874 }
3875
3876
3877 /*
3878 Document-class: Jellyfish::HashCounter
3879
3880 call-seq:
3881
3882
3883 Read a Jellyfish database sequentially.
3884 */
3885 static swig_class SwigClassHashCounter;
3886
3887
3888 /*
3889 Document-method: Jellyfish::HashCounter.new
3890
3891 call-seq:
3892
3893
3894
3895 Read a Jellyfish database sequentially.
3896 */
3897 SWIGINTERN VALUE
_wrap_new_HashCounter__SWIG_0(int argc,VALUE * argv,VALUE self)3898 _wrap_new_HashCounter__SWIG_0(int argc, VALUE *argv, VALUE self) {
3899 size_t arg1 ;
3900 unsigned int arg2 ;
3901 unsigned int arg3 ;
3902 size_t val1 ;
3903 int ecode1 = 0 ;
3904 unsigned int val2 ;
3905 int ecode2 = 0 ;
3906 unsigned int val3 ;
3907 int ecode3 = 0 ;
3908 HashCounter *result = 0 ;
3909
3910 if ((argc < 3) || (argc > 3)) {
3911 rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
3912 }
3913 ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
3914 if (!SWIG_IsOK(ecode1)) {
3915 SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","HashCounter", 1, argv[0] ));
3916 }
3917 arg1 = static_cast< size_t >(val1);
3918 ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
3919 if (!SWIG_IsOK(ecode2)) {
3920 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","HashCounter", 2, argv[1] ));
3921 }
3922 arg2 = static_cast< unsigned int >(val2);
3923 ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
3924 if (!SWIG_IsOK(ecode3)) {
3925 SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned int","HashCounter", 3, argv[2] ));
3926 }
3927 arg3 = static_cast< unsigned int >(val3);
3928 result = (HashCounter *)new HashCounter(arg1,arg2,arg3);
3929 DATA_PTR(self) = result;
3930 return self;
3931 fail:
3932 return Qnil;
3933 }
3934
3935
3936 SWIGINTERN VALUE
3937 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
_wrap_HashCounter_allocate(VALUE self)3938 _wrap_HashCounter_allocate(VALUE self)
3939 #else
3940 _wrap_HashCounter_allocate(int argc, VALUE *argv, VALUE self)
3941 #endif
3942 {
3943 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_HashCounter);
3944 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
3945 rb_obj_call_init(vresult, argc, argv);
3946 #endif
3947 return vresult;
3948 }
3949
3950
3951 SWIGINTERN VALUE
_wrap_new_HashCounter__SWIG_1(int argc,VALUE * argv,VALUE self)3952 _wrap_new_HashCounter__SWIG_1(int argc, VALUE *argv, VALUE self) {
3953 size_t arg1 ;
3954 unsigned int arg2 ;
3955 size_t val1 ;
3956 int ecode1 = 0 ;
3957 unsigned int val2 ;
3958 int ecode2 = 0 ;
3959 HashCounter *result = 0 ;
3960
3961 if ((argc < 2) || (argc > 2)) {
3962 rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
3963 }
3964 ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
3965 if (!SWIG_IsOK(ecode1)) {
3966 SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","HashCounter", 1, argv[0] ));
3967 }
3968 arg1 = static_cast< size_t >(val1);
3969 ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
3970 if (!SWIG_IsOK(ecode2)) {
3971 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","HashCounter", 2, argv[1] ));
3972 }
3973 arg2 = static_cast< unsigned int >(val2);
3974 result = (HashCounter *)new HashCounter(arg1,arg2);
3975 DATA_PTR(self) = result;
3976 return self;
3977 fail:
3978 return Qnil;
3979 }
3980
3981
_wrap_new_HashCounter(int nargs,VALUE * args,VALUE self)3982 SWIGINTERN VALUE _wrap_new_HashCounter(int nargs, VALUE *args, VALUE self) {
3983 int argc;
3984 VALUE argv[3];
3985 int ii;
3986
3987 argc = nargs;
3988 if (argc > 3) SWIG_fail;
3989 for (ii = 0; (ii < argc); ++ii) {
3990 argv[ii] = args[ii];
3991 }
3992 if (argc == 2) {
3993 int _v;
3994 {
3995 int res = SWIG_AsVal_size_t(argv[0], NULL);
3996 _v = SWIG_CheckState(res);
3997 }
3998 if (_v) {
3999 {
4000 int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
4001 _v = SWIG_CheckState(res);
4002 }
4003 if (_v) {
4004 return _wrap_new_HashCounter__SWIG_1(nargs, args, self);
4005 }
4006 }
4007 }
4008 if (argc == 3) {
4009 int _v;
4010 {
4011 int res = SWIG_AsVal_size_t(argv[0], NULL);
4012 _v = SWIG_CheckState(res);
4013 }
4014 if (_v) {
4015 {
4016 int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
4017 _v = SWIG_CheckState(res);
4018 }
4019 if (_v) {
4020 {
4021 int res = SWIG_AsVal_unsigned_SS_int(argv[2], NULL);
4022 _v = SWIG_CheckState(res);
4023 }
4024 if (_v) {
4025 return _wrap_new_HashCounter__SWIG_0(nargs, args, self);
4026 }
4027 }
4028 }
4029 }
4030
4031 fail:
4032 Ruby_Format_OverloadedError( argc, 3, "HashCounter.new",
4033 " HashCounter.new(size_t size, unsigned int val_len, unsigned int nb_threads)\n"
4034 " HashCounter.new(size_t size, unsigned int val_len)\n");
4035
4036 return Qnil;
4037 }
4038
4039
4040
4041 /*
4042 Document-method: Jellyfish::HashCounter.size
4043
4044 call-seq:
4045 size -> size_t
4046
4047 Size or Length of the HashCounter.
4048 */
4049 SWIGINTERN VALUE
_wrap_HashCounter_size(int argc,VALUE * argv,VALUE self)4050 _wrap_HashCounter_size(int argc, VALUE *argv, VALUE self) {
4051 HashCounter *arg1 = (HashCounter *) 0 ;
4052 void *argp1 = 0 ;
4053 int res1 = 0 ;
4054 size_t result;
4055 VALUE vresult = Qnil;
4056
4057 if ((argc < 0) || (argc > 0)) {
4058 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4059 }
4060 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 );
4061 if (!SWIG_IsOK(res1)) {
4062 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter const *","size", 1, self ));
4063 }
4064 arg1 = reinterpret_cast< HashCounter * >(argp1);
4065 result = ((HashCounter const *)arg1)->size();
4066 vresult = SWIG_From_size_t(static_cast< size_t >(result));
4067 return vresult;
4068 fail:
4069 return Qnil;
4070 }
4071
4072
4073
4074 /*
4075 Document-method: Jellyfish::HashCounter.val_len
4076
4077 call-seq:
4078 val_len -> unsigned int
4079
4080 Read a Jellyfish database sequentially.
4081 */
4082 SWIGINTERN VALUE
_wrap_HashCounter_val_len(int argc,VALUE * argv,VALUE self)4083 _wrap_HashCounter_val_len(int argc, VALUE *argv, VALUE self) {
4084 HashCounter *arg1 = (HashCounter *) 0 ;
4085 void *argp1 = 0 ;
4086 int res1 = 0 ;
4087 unsigned int result;
4088 VALUE vresult = Qnil;
4089
4090 if ((argc < 0) || (argc > 0)) {
4091 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4092 }
4093 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 );
4094 if (!SWIG_IsOK(res1)) {
4095 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter const *","val_len", 1, self ));
4096 }
4097 arg1 = reinterpret_cast< HashCounter * >(argp1);
4098 result = (unsigned int)((HashCounter const *)arg1)->val_len();
4099 vresult = SWIG_From_unsigned_SS_int(static_cast< unsigned int >(result));
4100 return vresult;
4101 fail:
4102 return Qnil;
4103 }
4104
4105
4106
4107 /*
4108 Document-method: Jellyfish::HashCounter.add
4109
4110 call-seq:
4111 add(m, x) -> bool
4112
4113 Read a Jellyfish database sequentially.
4114 */
4115 SWIGINTERN VALUE
_wrap_HashCounter_add(int argc,VALUE * argv,VALUE self)4116 _wrap_HashCounter_add(int argc, VALUE *argv, VALUE self) {
4117 HashCounter *arg1 = (HashCounter *) 0 ;
4118 MerDNA *arg2 = 0 ;
4119 int *arg3 = 0 ;
4120 void *argp1 = 0 ;
4121 int res1 = 0 ;
4122 void *argp2 ;
4123 int res2 = 0 ;
4124 int temp3 ;
4125 int val3 ;
4126 int ecode3 = 0 ;
4127 bool result;
4128 VALUE vresult = Qnil;
4129
4130 if ((argc < 2) || (argc > 2)) {
4131 rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
4132 }
4133 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 );
4134 if (!SWIG_IsOK(res1)) {
4135 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter *","add", 1, self ));
4136 }
4137 arg1 = reinterpret_cast< HashCounter * >(argp1);
4138 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
4139 if (!SWIG_IsOK(res2)) {
4140 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","add", 2, argv[0] ));
4141 }
4142 if (!argp2) {
4143 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","add", 2, argv[0]));
4144 }
4145 arg2 = reinterpret_cast< MerDNA * >(argp2);
4146 ecode3 = SWIG_AsVal_int(argv[1], &val3);
4147 if (!SWIG_IsOK(ecode3)) {
4148 SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","add", 3, argv[1] ));
4149 }
4150 temp3 = static_cast< int >(val3);
4151 arg3 = &temp3;
4152 result = (bool)(arg1)->add((MerDNA const &)*arg2,(int const &)*arg3);
4153 vresult = SWIG_From_bool(static_cast< bool >(result));
4154 return vresult;
4155 fail:
4156 return Qnil;
4157 }
4158
4159
4160
4161 /*
4162 Document-method: Jellyfish::HashCounter.update_add
4163
4164 call-seq:
4165 update_add(arg2, arg3) -> bool
4166
4167 Read a Jellyfish database sequentially.
4168 */
4169 SWIGINTERN VALUE
_wrap_HashCounter_update_add(int argc,VALUE * argv,VALUE self)4170 _wrap_HashCounter_update_add(int argc, VALUE *argv, VALUE self) {
4171 HashCounter *arg1 = (HashCounter *) 0 ;
4172 MerDNA *arg2 = 0 ;
4173 int *arg3 = 0 ;
4174 void *argp1 = 0 ;
4175 int res1 = 0 ;
4176 void *argp2 ;
4177 int res2 = 0 ;
4178 int temp3 ;
4179 int val3 ;
4180 int ecode3 = 0 ;
4181 bool result;
4182 VALUE vresult = Qnil;
4183
4184 if ((argc < 2) || (argc > 2)) {
4185 rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
4186 }
4187 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 );
4188 if (!SWIG_IsOK(res1)) {
4189 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter *","update_add", 1, self ));
4190 }
4191 arg1 = reinterpret_cast< HashCounter * >(argp1);
4192 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
4193 if (!SWIG_IsOK(res2)) {
4194 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","update_add", 2, argv[0] ));
4195 }
4196 if (!argp2) {
4197 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","update_add", 2, argv[0]));
4198 }
4199 arg2 = reinterpret_cast< MerDNA * >(argp2);
4200 ecode3 = SWIG_AsVal_int(argv[1], &val3);
4201 if (!SWIG_IsOK(ecode3)) {
4202 SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "int","update_add", 3, argv[1] ));
4203 }
4204 temp3 = static_cast< int >(val3);
4205 arg3 = &temp3;
4206 result = (bool)(arg1)->update_add((MerDNA const &)*arg2,(int const &)*arg3);
4207 vresult = SWIG_From_bool(static_cast< bool >(result));
4208 return vresult;
4209 fail:
4210 return Qnil;
4211 }
4212
4213
4214
4215 /*
4216 Document-method: Jellyfish::HashCounter.get
4217
4218 call-seq:
4219 get(m)
4220
4221 Read a Jellyfish database sequentially.
4222 */
4223 SWIGINTERN VALUE
_wrap_HashCounter_get(int argc,VALUE * argv,VALUE self)4224 _wrap_HashCounter_get(int argc, VALUE *argv, VALUE self) {
4225 HashCounter *arg1 = (HashCounter *) 0 ;
4226 MerDNA *arg2 = 0 ;
4227 std::pair< bool,uint64_t > *arg3 = (std::pair< bool,uint64_t > *) 0 ;
4228 void *argp1 = 0 ;
4229 int res1 = 0 ;
4230 void *argp2 ;
4231 int res2 = 0 ;
4232 std::pair< bool,uint64_t > tmp3 ;
4233 VALUE vresult = Qnil;
4234
4235 {
4236 arg3 = &tmp3;
4237 }
4238 if ((argc < 1) || (argc > 1)) {
4239 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4240 }
4241 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 );
4242 if (!SWIG_IsOK(res1)) {
4243 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter const *","get", 1, self ));
4244 }
4245 arg1 = reinterpret_cast< HashCounter * >(argp1);
4246 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
4247 if (!SWIG_IsOK(res2)) {
4248 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","get", 2, argv[0] ));
4249 }
4250 if (!argp2) {
4251 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","get", 2, argv[0]));
4252 }
4253 arg2 = reinterpret_cast< MerDNA * >(argp2);
4254 HashCounter_get((HashCounter const *)arg1,(MerDNA const &)*arg2,arg3);
4255 {
4256 if((arg3)->first) {
4257 VALUE o = SWIG_From_unsigned_SS_long ((arg3)->second);
4258 vresult = SWIG_Ruby_AppendOutput(vresult, o);
4259 } else {
4260 vresult = SWIG_Ruby_AppendOutput(vresult, Qnil);
4261 }
4262 }
4263 return vresult;
4264 fail:
4265 return Qnil;
4266 }
4267
4268
4269
4270 /*
4271 Document-method: Jellyfish::HashCounter.[]
4272
4273 call-seq:
4274 [](m)
4275
4276 Element accessor/slicing.
4277 */
4278 SWIGINTERN VALUE
_wrap_HashCounter___getitem__(int argc,VALUE * argv,VALUE self)4279 _wrap_HashCounter___getitem__(int argc, VALUE *argv, VALUE self) {
4280 HashCounter *arg1 = (HashCounter *) 0 ;
4281 MerDNA *arg2 = 0 ;
4282 std::pair< bool,uint64_t > *arg3 = (std::pair< bool,uint64_t > *) 0 ;
4283 void *argp1 = 0 ;
4284 int res1 = 0 ;
4285 void *argp2 ;
4286 int res2 = 0 ;
4287 std::pair< bool,uint64_t > tmp3 ;
4288 VALUE vresult = Qnil;
4289
4290 {
4291 arg3 = &tmp3;
4292 }
4293 if ((argc < 1) || (argc > 1)) {
4294 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4295 }
4296 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashCounter, 0 | 0 );
4297 if (!SWIG_IsOK(res1)) {
4298 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashCounter const *","__getitem__", 1, self ));
4299 }
4300 arg1 = reinterpret_cast< HashCounter * >(argp1);
4301 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
4302 if (!SWIG_IsOK(res2)) {
4303 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","__getitem__", 2, argv[0] ));
4304 }
4305 if (!argp2) {
4306 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","__getitem__", 2, argv[0]));
4307 }
4308 arg2 = reinterpret_cast< MerDNA * >(argp2);
4309 HashCounter___getitem__((HashCounter const *)arg1,(MerDNA const &)*arg2,arg3);
4310 {
4311 if((arg3)->first) {
4312 VALUE o = SWIG_From_unsigned_SS_long ((arg3)->second);
4313 vresult = SWIG_Ruby_AppendOutput(vresult, o);
4314 } else {
4315 vresult = SWIG_Ruby_AppendOutput(vresult, Qnil);
4316 }
4317 }
4318 return vresult;
4319 fail:
4320 return Qnil;
4321 }
4322
4323
4324 SWIGINTERN void
free_HashCounter(void * self)4325 free_HashCounter(void *self) {
4326 HashCounter *arg1 = (HashCounter *)self;
4327 delete arg1;
4328 }
4329
4330
4331 /*
4332 Document-class: Jellyfish::HashSet
4333
4334 call-seq:
4335
4336
4337 Read a Jellyfish database sequentially.
4338 */
4339 static swig_class SwigClassHashSet;
4340
4341
4342 /*
4343 Document-method: Jellyfish::HashSet.new
4344
4345 call-seq:
4346
4347
4348
4349 Read a Jellyfish database sequentially.
4350 */
4351 SWIGINTERN VALUE
_wrap_new_HashSet__SWIG_0(int argc,VALUE * argv,VALUE self)4352 _wrap_new_HashSet__SWIG_0(int argc, VALUE *argv, VALUE self) {
4353 size_t arg1 ;
4354 unsigned int arg2 ;
4355 size_t val1 ;
4356 int ecode1 = 0 ;
4357 unsigned int val2 ;
4358 int ecode2 = 0 ;
4359 HashSet *result = 0 ;
4360
4361 if ((argc < 2) || (argc > 2)) {
4362 rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
4363 }
4364 ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
4365 if (!SWIG_IsOK(ecode1)) {
4366 SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","HashSet", 1, argv[0] ));
4367 }
4368 arg1 = static_cast< size_t >(val1);
4369 ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
4370 if (!SWIG_IsOK(ecode2)) {
4371 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","HashSet", 2, argv[1] ));
4372 }
4373 arg2 = static_cast< unsigned int >(val2);
4374 result = (HashSet *)new HashSet(arg1,arg2);
4375 DATA_PTR(self) = result;
4376 return self;
4377 fail:
4378 return Qnil;
4379 }
4380
4381
4382 SWIGINTERN VALUE
4383 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
_wrap_HashSet_allocate(VALUE self)4384 _wrap_HashSet_allocate(VALUE self)
4385 #else
4386 _wrap_HashSet_allocate(int argc, VALUE *argv, VALUE self)
4387 #endif
4388 {
4389 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_HashSet);
4390 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
4391 rb_obj_call_init(vresult, argc, argv);
4392 #endif
4393 return vresult;
4394 }
4395
4396
4397 SWIGINTERN VALUE
_wrap_new_HashSet__SWIG_1(int argc,VALUE * argv,VALUE self)4398 _wrap_new_HashSet__SWIG_1(int argc, VALUE *argv, VALUE self) {
4399 size_t arg1 ;
4400 size_t val1 ;
4401 int ecode1 = 0 ;
4402 HashSet *result = 0 ;
4403
4404 if ((argc < 1) || (argc > 1)) {
4405 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4406 }
4407 ecode1 = SWIG_AsVal_size_t(argv[0], &val1);
4408 if (!SWIG_IsOK(ecode1)) {
4409 SWIG_exception_fail(SWIG_ArgError(ecode1), Ruby_Format_TypeError( "", "size_t","HashSet", 1, argv[0] ));
4410 }
4411 arg1 = static_cast< size_t >(val1);
4412 result = (HashSet *)new HashSet(arg1);
4413 DATA_PTR(self) = result;
4414 return self;
4415 fail:
4416 return Qnil;
4417 }
4418
4419
_wrap_new_HashSet(int nargs,VALUE * args,VALUE self)4420 SWIGINTERN VALUE _wrap_new_HashSet(int nargs, VALUE *args, VALUE self) {
4421 int argc;
4422 VALUE argv[2];
4423 int ii;
4424
4425 argc = nargs;
4426 if (argc > 2) SWIG_fail;
4427 for (ii = 0; (ii < argc); ++ii) {
4428 argv[ii] = args[ii];
4429 }
4430 if (argc == 1) {
4431 int _v;
4432 {
4433 int res = SWIG_AsVal_size_t(argv[0], NULL);
4434 _v = SWIG_CheckState(res);
4435 }
4436 if (_v) {
4437 return _wrap_new_HashSet__SWIG_1(nargs, args, self);
4438 }
4439 }
4440 if (argc == 2) {
4441 int _v;
4442 {
4443 int res = SWIG_AsVal_size_t(argv[0], NULL);
4444 _v = SWIG_CheckState(res);
4445 }
4446 if (_v) {
4447 {
4448 int res = SWIG_AsVal_unsigned_SS_int(argv[1], NULL);
4449 _v = SWIG_CheckState(res);
4450 }
4451 if (_v) {
4452 return _wrap_new_HashSet__SWIG_0(nargs, args, self);
4453 }
4454 }
4455 }
4456
4457 fail:
4458 Ruby_Format_OverloadedError( argc, 2, "HashSet.new",
4459 " HashSet.new(size_t size, unsigned int nb_threads)\n"
4460 " HashSet.new(size_t size)\n");
4461
4462 return Qnil;
4463 }
4464
4465
4466
4467 /*
4468 Document-method: Jellyfish::HashSet.size
4469
4470 call-seq:
4471 size -> size_t
4472
4473 Size or Length of the HashSet.
4474 */
4475 SWIGINTERN VALUE
_wrap_HashSet_size(int argc,VALUE * argv,VALUE self)4476 _wrap_HashSet_size(int argc, VALUE *argv, VALUE self) {
4477 HashSet *arg1 = (HashSet *) 0 ;
4478 void *argp1 = 0 ;
4479 int res1 = 0 ;
4480 size_t result;
4481 VALUE vresult = Qnil;
4482
4483 if ((argc < 0) || (argc > 0)) {
4484 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4485 }
4486 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashSet, 0 | 0 );
4487 if (!SWIG_IsOK(res1)) {
4488 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashSet const *","size", 1, self ));
4489 }
4490 arg1 = reinterpret_cast< HashSet * >(argp1);
4491 result = ((HashSet const *)arg1)->size();
4492 vresult = SWIG_From_size_t(static_cast< size_t >(result));
4493 return vresult;
4494 fail:
4495 return Qnil;
4496 }
4497
4498
4499
4500 /*
4501 Document-method: Jellyfish::HashSet.add
4502
4503 call-seq:
4504 add(m) -> bool
4505
4506 Read a Jellyfish database sequentially.
4507 */
4508 SWIGINTERN VALUE
_wrap_HashSet_add(int argc,VALUE * argv,VALUE self)4509 _wrap_HashSet_add(int argc, VALUE *argv, VALUE self) {
4510 HashSet *arg1 = (HashSet *) 0 ;
4511 MerDNA *arg2 = 0 ;
4512 void *argp1 = 0 ;
4513 int res1 = 0 ;
4514 void *argp2 ;
4515 int res2 = 0 ;
4516 bool result;
4517 VALUE vresult = Qnil;
4518
4519 if ((argc < 1) || (argc > 1)) {
4520 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4521 }
4522 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashSet, 0 | 0 );
4523 if (!SWIG_IsOK(res1)) {
4524 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashSet *","add", 1, self ));
4525 }
4526 arg1 = reinterpret_cast< HashSet * >(argp1);
4527 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
4528 if (!SWIG_IsOK(res2)) {
4529 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","add", 2, argv[0] ));
4530 }
4531 if (!argp2) {
4532 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","add", 2, argv[0]));
4533 }
4534 arg2 = reinterpret_cast< MerDNA * >(argp2);
4535 result = (bool)(arg1)->add((MerDNA const &)*arg2);
4536 vresult = SWIG_From_bool(static_cast< bool >(result));
4537 return vresult;
4538 fail:
4539 return Qnil;
4540 }
4541
4542
4543
4544 /*
4545 Document-method: Jellyfish::HashSet.get
4546
4547 call-seq:
4548 get(m) -> bool
4549
4550 Read a Jellyfish database sequentially.
4551 */
4552 SWIGINTERN VALUE
_wrap_HashSet_get(int argc,VALUE * argv,VALUE self)4553 _wrap_HashSet_get(int argc, VALUE *argv, VALUE self) {
4554 HashSet *arg1 = (HashSet *) 0 ;
4555 MerDNA *arg2 = 0 ;
4556 void *argp1 = 0 ;
4557 int res1 = 0 ;
4558 void *argp2 ;
4559 int res2 = 0 ;
4560 bool result;
4561 VALUE vresult = Qnil;
4562
4563 if ((argc < 1) || (argc > 1)) {
4564 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4565 }
4566 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashSet, 0 | 0 );
4567 if (!SWIG_IsOK(res1)) {
4568 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashSet const *","get", 1, self ));
4569 }
4570 arg1 = reinterpret_cast< HashSet * >(argp1);
4571 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
4572 if (!SWIG_IsOK(res2)) {
4573 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","get", 2, argv[0] ));
4574 }
4575 if (!argp2) {
4576 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","get", 2, argv[0]));
4577 }
4578 arg2 = reinterpret_cast< MerDNA * >(argp2);
4579 result = (bool)HashSet_get((HashSet const *)arg1,(MerDNA const &)*arg2);
4580 vresult = SWIG_From_bool(static_cast< bool >(result));
4581 return vresult;
4582 fail:
4583 return Qnil;
4584 }
4585
4586
4587
4588 /*
4589 Document-method: Jellyfish::HashSet.[]
4590
4591 call-seq:
4592 [](m) -> bool
4593
4594 Element accessor/slicing.
4595 */
4596 SWIGINTERN VALUE
_wrap_HashSet___getitem__(int argc,VALUE * argv,VALUE self)4597 _wrap_HashSet___getitem__(int argc, VALUE *argv, VALUE self) {
4598 HashSet *arg1 = (HashSet *) 0 ;
4599 MerDNA *arg2 = 0 ;
4600 void *argp1 = 0 ;
4601 int res1 = 0 ;
4602 void *argp2 ;
4603 int res2 = 0 ;
4604 bool result;
4605 VALUE vresult = Qnil;
4606
4607 if ((argc < 1) || (argc > 1)) {
4608 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4609 }
4610 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_HashSet, 0 | 0 );
4611 if (!SWIG_IsOK(res1)) {
4612 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "HashSet const *","__getitem__", 1, self ));
4613 }
4614 arg1 = reinterpret_cast< HashSet * >(argp1);
4615 res2 = SWIG_ConvertPtr(argv[0], &argp2, SWIGTYPE_p_MerDNA, 0 );
4616 if (!SWIG_IsOK(res2)) {
4617 SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "MerDNA const &","__getitem__", 2, argv[0] ));
4618 }
4619 if (!argp2) {
4620 SWIG_exception_fail(SWIG_ValueError, Ruby_Format_TypeError("invalid null reference ", "MerDNA const &","__getitem__", 2, argv[0]));
4621 }
4622 arg2 = reinterpret_cast< MerDNA * >(argp2);
4623 result = (bool)HashSet___getitem__((HashSet const *)arg1,(MerDNA const &)*arg2);
4624 vresult = SWIG_From_bool(static_cast< bool >(result));
4625 return vresult;
4626 fail:
4627 return Qnil;
4628 }
4629
4630
4631 SWIGINTERN void
free_HashSet(void * self)4632 free_HashSet(void *self) {
4633 HashSet *arg1 = (HashSet *)self;
4634 delete arg1;
4635 }
4636
4637
4638 /*
4639 Document-method: Jellyfish.string_mers
4640
4641 call-seq:
4642 string_mers(str) -> StringMers
4643
4644 Get an iterator to the mers in the string.
4645 */
4646 SWIGINTERN VALUE
_wrap_string_mers(int argc,VALUE * argv,VALUE self)4647 _wrap_string_mers(int argc, VALUE *argv, VALUE self) {
4648 char *arg1 = (char *) 0 ;
4649 int arg2 ;
4650 int res1 ;
4651 char *buf1 = 0 ;
4652 size_t size1 = 0 ;
4653 int alloc1 = 0 ;
4654 StringMers *result = 0 ;
4655 VALUE vresult = Qnil;
4656
4657 if ((argc < 1) || (argc > 1)) {
4658 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4659 }
4660 res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, &size1, &alloc1);
4661 if (!SWIG_IsOK(res1)) {
4662 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char *","string_mers", 1, argv[0] ));
4663 }
4664 arg1 = reinterpret_cast< char * >(buf1);
4665 arg2 = static_cast< int >(size1 - 1);
4666 result = (StringMers *)string_mers(arg1,arg2);
4667 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_POINTER_OWN | 0 );
4668 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
4669 return vresult;
4670 fail:
4671 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
4672 return Qnil;
4673 }
4674
4675
4676
4677 /*
4678 Document-method: Jellyfish.string_canonicals
4679
4680 call-seq:
4681 string_canonicals(str) -> StringMers
4682
4683 Get an iterator to the canonical mers in the string.
4684 */
4685 SWIGINTERN VALUE
_wrap_string_canonicals(int argc,VALUE * argv,VALUE self)4686 _wrap_string_canonicals(int argc, VALUE *argv, VALUE self) {
4687 char *arg1 = (char *) 0 ;
4688 int arg2 ;
4689 int res1 ;
4690 char *buf1 = 0 ;
4691 size_t size1 = 0 ;
4692 int alloc1 = 0 ;
4693 StringMers *result = 0 ;
4694 VALUE vresult = Qnil;
4695
4696 if ((argc < 1) || (argc > 1)) {
4697 rb_raise(rb_eArgError, "wrong # of arguments(%d for 1)",argc); SWIG_fail;
4698 }
4699 res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, &size1, &alloc1);
4700 if (!SWIG_IsOK(res1)) {
4701 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char *","string_canonicals", 1, argv[0] ));
4702 }
4703 arg1 = reinterpret_cast< char * >(buf1);
4704 arg2 = static_cast< int >(size1 - 1);
4705 result = (StringMers *)string_canonicals(arg1,arg2);
4706 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_StringMers, SWIG_POINTER_OWN | 0 );
4707 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
4708 return vresult;
4709 fail:
4710 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
4711 return Qnil;
4712 }
4713
4714
4715
4716 /*
4717 Document-class: Jellyfish::StringMers
4718
4719 call-seq:
4720
4721
4722 Extract k-mers from a sequence string.
4723 */
4724 static swig_class SwigClassStringMers;
4725
4726 SWIGINTERN VALUE
4727 #ifdef HAVE_RB_DEFINE_ALLOC_FUNC
_wrap_StringMers_allocate(VALUE self)4728 _wrap_StringMers_allocate(VALUE self)
4729 #else
4730 _wrap_StringMers_allocate(int argc, VALUE *argv, VALUE self)
4731 #endif
4732 {
4733 VALUE vresult = SWIG_NewClassInstance(self, SWIGTYPE_p_StringMers);
4734 #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
4735 rb_obj_call_init(vresult, argc, argv);
4736 #endif
4737 return vresult;
4738 }
4739
4740
4741
4742 /*
4743 Document-method: Jellyfish::StringMers.new
4744
4745 call-seq:
4746
4747
4748 Create a k-mers parser from a string. Pass true as a second argument to get canonical mers.
4749 */
4750 SWIGINTERN VALUE
_wrap_new_StringMers(int argc,VALUE * argv,VALUE self)4751 _wrap_new_StringMers(int argc, VALUE *argv, VALUE self) {
4752 char *arg1 = (char *) 0 ;
4753 int arg2 ;
4754 bool arg3 ;
4755 int res1 ;
4756 char *buf1 = 0 ;
4757 int alloc1 = 0 ;
4758 int val2 ;
4759 int ecode2 = 0 ;
4760 bool val3 ;
4761 int ecode3 = 0 ;
4762 StringMers *result = 0 ;
4763
4764 if ((argc < 3) || (argc > 3)) {
4765 rb_raise(rb_eArgError, "wrong # of arguments(%d for 3)",argc); SWIG_fail;
4766 }
4767 res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
4768 if (!SWIG_IsOK(res1)) {
4769 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char const *","StringMers", 1, argv[0] ));
4770 }
4771 arg1 = reinterpret_cast< char * >(buf1);
4772 ecode2 = SWIG_AsVal_int(argv[1], &val2);
4773 if (!SWIG_IsOK(ecode2)) {
4774 SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "int","StringMers", 2, argv[1] ));
4775 }
4776 arg2 = static_cast< int >(val2);
4777 ecode3 = SWIG_AsVal_bool(argv[2], &val3);
4778 if (!SWIG_IsOK(ecode3)) {
4779 SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "bool","StringMers", 3, argv[2] ));
4780 }
4781 arg3 = static_cast< bool >(val3);
4782 result = (StringMers *)new StringMers((char const *)arg1,arg2,arg3);
4783 DATA_PTR(self) = result;
4784 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
4785 return self;
4786 fail:
4787 if (alloc1 == SWIG_NEWOBJ) delete[] buf1;
4788 return Qnil;
4789 }
4790
4791
4792
4793 /*
4794 Document-method: Jellyfish::StringMers.next_mer
4795
4796 call-seq:
4797 next_mer -> bool
4798
4799 Get the next mer. Return false if reached the end of the string..
4800 */
4801 SWIGINTERN VALUE
_wrap_StringMers_next_mer(int argc,VALUE * argv,VALUE self)4802 _wrap_StringMers_next_mer(int argc, VALUE *argv, VALUE self) {
4803 StringMers *arg1 = (StringMers *) 0 ;
4804 void *argp1 = 0 ;
4805 int res1 = 0 ;
4806 bool result;
4807 VALUE vresult = Qnil;
4808
4809 if ((argc < 0) || (argc > 0)) {
4810 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4811 }
4812 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_StringMers, 0 | 0 );
4813 if (!SWIG_IsOK(res1)) {
4814 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "StringMers *","next_mer", 1, self ));
4815 }
4816 arg1 = reinterpret_cast< StringMers * >(argp1);
4817 result = (bool)(arg1)->next_mer();
4818 vresult = SWIG_From_bool(static_cast< bool >(result));
4819 return vresult;
4820 fail:
4821 return Qnil;
4822 }
4823
4824
4825
4826 /*
4827 Document-method: Jellyfish::StringMers.mer
4828
4829 call-seq:
4830 mer -> MerDNA
4831
4832 Return the current mer (or its canonical representation).
4833 */
4834 SWIGINTERN VALUE
_wrap_StringMers_mer(int argc,VALUE * argv,VALUE self)4835 _wrap_StringMers_mer(int argc, VALUE *argv, VALUE self) {
4836 StringMers *arg1 = (StringMers *) 0 ;
4837 void *argp1 = 0 ;
4838 int res1 = 0 ;
4839 MerDNA *result = 0 ;
4840 VALUE vresult = Qnil;
4841
4842 if ((argc < 0) || (argc > 0)) {
4843 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4844 }
4845 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_StringMers, 0 | 0 );
4846 if (!SWIG_IsOK(res1)) {
4847 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "StringMers const *","mer", 1, self ));
4848 }
4849 arg1 = reinterpret_cast< StringMers * >(argp1);
4850 result = (MerDNA *)((StringMers const *)arg1)->mer();
4851 vresult = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_MerDNA, 0 | 0 );
4852 return vresult;
4853 fail:
4854 return Qnil;
4855 }
4856
4857
4858
4859 /*
4860 Document-method: Jellyfish::StringMers.each
4861
4862 call-seq:
4863 each
4864
4865 Iterate through all the mers in the string.
4866 */
4867 SWIGINTERN VALUE
_wrap_StringMers_each(int argc,VALUE * argv,VALUE self)4868 _wrap_StringMers_each(int argc, VALUE *argv, VALUE self) {
4869 StringMers *arg1 = (StringMers *) 0 ;
4870 void *argp1 = 0 ;
4871 int res1 = 0 ;
4872
4873 if ((argc < 0) || (argc > 0)) {
4874 rb_raise(rb_eArgError, "wrong # of arguments(%d for 0)",argc); SWIG_fail;
4875 }
4876 res1 = SWIG_ConvertPtr(self, &argp1,SWIGTYPE_p_StringMers, 0 | 0 );
4877 if (!SWIG_IsOK(res1)) {
4878 SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "StringMers *","each", 1, self ));
4879 }
4880 arg1 = reinterpret_cast< StringMers * >(argp1);
4881 (arg1)->each();
4882 return Qnil;
4883 fail:
4884 return Qnil;
4885 }
4886
4887
4888 SWIGINTERN void
free_StringMers(void * self)4889 free_StringMers(void *self) {
4890 StringMers *arg1 = (StringMers *)self;
4891 delete arg1;
4892 }
4893
4894
4895 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
4896
4897 static swig_type_info _swigt__p_HashCounter = {"_p_HashCounter", "HashCounter *", 0, 0, (void*)0, 0};
4898 static swig_type_info _swigt__p_HashSet = {"_p_HashSet", "HashSet *", 0, 0, (void*)0, 0};
4899 static swig_type_info _swigt__p_MerDNA = {"_p_MerDNA", "MerDNA *", 0, 0, (void*)0, 0};
4900 static swig_type_info _swigt__p_QueryMerFile = {"_p_QueryMerFile", "QueryMerFile *", 0, 0, (void*)0, 0};
4901 static swig_type_info _swigt__p_ReadMerFile = {"_p_ReadMerFile", "ReadMerFile *", 0, 0, (void*)0, 0};
4902 static swig_type_info _swigt__p_StringMers = {"_p_StringMers", "StringMers *", 0, 0, (void*)0, 0};
4903 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
4904 static swig_type_info _swigt__p_std__pairT_bool_uint64_t_t = {"_p_std__pairT_bool_uint64_t_t", "std::pair< bool,uint64_t > *", 0, 0, (void*)0, 0};
4905
4906 static swig_type_info *swig_type_initial[] = {
4907 &_swigt__p_HashCounter,
4908 &_swigt__p_HashSet,
4909 &_swigt__p_MerDNA,
4910 &_swigt__p_QueryMerFile,
4911 &_swigt__p_ReadMerFile,
4912 &_swigt__p_StringMers,
4913 &_swigt__p_char,
4914 &_swigt__p_std__pairT_bool_uint64_t_t,
4915 };
4916
4917 static swig_cast_info _swigc__p_HashCounter[] = { {&_swigt__p_HashCounter, 0, 0, 0},{0, 0, 0, 0}};
4918 static swig_cast_info _swigc__p_HashSet[] = { {&_swigt__p_HashSet, 0, 0, 0},{0, 0, 0, 0}};
4919 static swig_cast_info _swigc__p_MerDNA[] = { {&_swigt__p_MerDNA, 0, 0, 0},{0, 0, 0, 0}};
4920 static swig_cast_info _swigc__p_QueryMerFile[] = { {&_swigt__p_QueryMerFile, 0, 0, 0},{0, 0, 0, 0}};
4921 static swig_cast_info _swigc__p_ReadMerFile[] = { {&_swigt__p_ReadMerFile, 0, 0, 0},{0, 0, 0, 0}};
4922 static swig_cast_info _swigc__p_StringMers[] = { {&_swigt__p_StringMers, 0, 0, 0},{0, 0, 0, 0}};
4923 static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
4924 static swig_cast_info _swigc__p_std__pairT_bool_uint64_t_t[] = { {&_swigt__p_std__pairT_bool_uint64_t_t, 0, 0, 0},{0, 0, 0, 0}};
4925
4926 static swig_cast_info *swig_cast_initial[] = {
4927 _swigc__p_HashCounter,
4928 _swigc__p_HashSet,
4929 _swigc__p_MerDNA,
4930 _swigc__p_QueryMerFile,
4931 _swigc__p_ReadMerFile,
4932 _swigc__p_StringMers,
4933 _swigc__p_char,
4934 _swigc__p_std__pairT_bool_uint64_t_t,
4935 };
4936
4937
4938 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
4939
4940 /* -----------------------------------------------------------------------------
4941 * Type initialization:
4942 * This problem is tough by the requirement that no dynamic
4943 * memory is used. Also, since swig_type_info structures store pointers to
4944 * swig_cast_info structures and swig_cast_info structures store pointers back
4945 * to swig_type_info structures, we need some lookup code at initialization.
4946 * The idea is that swig generates all the structures that are needed.
4947 * The runtime then collects these partially filled structures.
4948 * The SWIG_InitializeModule function takes these initial arrays out of
4949 * swig_module, and does all the lookup, filling in the swig_module.types
4950 * array with the correct data and linking the correct swig_cast_info
4951 * structures together.
4952 *
4953 * The generated swig_type_info structures are assigned statically to an initial
4954 * array. We just loop through that array, and handle each type individually.
4955 * First we lookup if this type has been already loaded, and if so, use the
4956 * loaded structure instead of the generated one. Then we have to fill in the
4957 * cast linked list. The cast data is initially stored in something like a
4958 * two-dimensional array. Each row corresponds to a type (there are the same
4959 * number of rows as there are in the swig_type_initial array). Each entry in
4960 * a column is one of the swig_cast_info structures for that type.
4961 * The cast_initial array is actually an array of arrays, because each row has
4962 * a variable number of columns. So to actually build the cast linked list,
4963 * we find the array of casts associated with the type, and loop through it
4964 * adding the casts to the list. The one last trick we need to do is making
4965 * sure the type pointer in the swig_cast_info struct is correct.
4966 *
4967 * First off, we lookup the cast->type name to see if it is already loaded.
4968 * There are three cases to handle:
4969 * 1) If the cast->type has already been loaded AND the type we are adding
4970 * casting info to has not been loaded (it is in this module), THEN we
4971 * replace the cast->type pointer with the type pointer that has already
4972 * been loaded.
4973 * 2) If BOTH types (the one we are adding casting info to, and the
4974 * cast->type) are loaded, THEN the cast info has already been loaded by
4975 * the previous module so we just ignore it.
4976 * 3) Finally, if cast->type has not already been loaded, then we add that
4977 * swig_cast_info to the linked list (because the cast->type) pointer will
4978 * be correct.
4979 * ----------------------------------------------------------------------------- */
4980
4981 #ifdef __cplusplus
4982 extern "C" {
4983 #if 0
4984 } /* c-mode */
4985 #endif
4986 #endif
4987
4988 #if 0
4989 #define SWIGRUNTIME_DEBUG
4990 #endif
4991
4992
4993 SWIGRUNTIME void
SWIG_InitializeModule(void * clientdata)4994 SWIG_InitializeModule(void *clientdata) {
4995 size_t i;
4996 swig_module_info *module_head, *iter;
4997 int init;
4998
4999 /* check to see if the circular list has been setup, if not, set it up */
5000 if (swig_module.next==0) {
5001 /* Initialize the swig_module */
5002 swig_module.type_initial = swig_type_initial;
5003 swig_module.cast_initial = swig_cast_initial;
5004 swig_module.next = &swig_module;
5005 init = 1;
5006 } else {
5007 init = 0;
5008 }
5009
5010 /* Try and load any already created modules */
5011 module_head = SWIG_GetModule(clientdata);
5012 if (!module_head) {
5013 /* This is the first module loaded for this interpreter */
5014 /* so set the swig module into the interpreter */
5015 SWIG_SetModule(clientdata, &swig_module);
5016 } else {
5017 /* the interpreter has loaded a SWIG module, but has it loaded this one? */
5018 iter=module_head;
5019 do {
5020 if (iter==&swig_module) {
5021 /* Our module is already in the list, so there's nothing more to do. */
5022 return;
5023 }
5024 iter=iter->next;
5025 } while (iter!= module_head);
5026
5027 /* otherwise we must add our module into the list */
5028 swig_module.next = module_head->next;
5029 module_head->next = &swig_module;
5030 }
5031
5032 /* When multiple interpreters are used, a module could have already been initialized in
5033 a different interpreter, but not yet have a pointer in this interpreter.
5034 In this case, we do not want to continue adding types... everything should be
5035 set up already */
5036 if (init == 0) return;
5037
5038 /* Now work on filling in swig_module.types */
5039 #ifdef SWIGRUNTIME_DEBUG
5040 printf("SWIG_InitializeModule: size %d\n", swig_module.size);
5041 #endif
5042 for (i = 0; i < swig_module.size; ++i) {
5043 swig_type_info *type = 0;
5044 swig_type_info *ret;
5045 swig_cast_info *cast;
5046
5047 #ifdef SWIGRUNTIME_DEBUG
5048 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
5049 #endif
5050
5051 /* if there is another module already loaded */
5052 if (swig_module.next != &swig_module) {
5053 type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
5054 }
5055 if (type) {
5056 /* Overwrite clientdata field */
5057 #ifdef SWIGRUNTIME_DEBUG
5058 printf("SWIG_InitializeModule: found type %s\n", type->name);
5059 #endif
5060 if (swig_module.type_initial[i]->clientdata) {
5061 type->clientdata = swig_module.type_initial[i]->clientdata;
5062 #ifdef SWIGRUNTIME_DEBUG
5063 printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
5064 #endif
5065 }
5066 } else {
5067 type = swig_module.type_initial[i];
5068 }
5069
5070 /* Insert casting types */
5071 cast = swig_module.cast_initial[i];
5072 while (cast->type) {
5073
5074 /* Don't need to add information already in the list */
5075 ret = 0;
5076 #ifdef SWIGRUNTIME_DEBUG
5077 printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
5078 #endif
5079 if (swig_module.next != &swig_module) {
5080 ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
5081 #ifdef SWIGRUNTIME_DEBUG
5082 if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
5083 #endif
5084 }
5085 if (ret) {
5086 if (type == swig_module.type_initial[i]) {
5087 #ifdef SWIGRUNTIME_DEBUG
5088 printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
5089 #endif
5090 cast->type = ret;
5091 ret = 0;
5092 } else {
5093 /* Check for casting already in the list */
5094 swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
5095 #ifdef SWIGRUNTIME_DEBUG
5096 if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
5097 #endif
5098 if (!ocast) ret = 0;
5099 }
5100 }
5101
5102 if (!ret) {
5103 #ifdef SWIGRUNTIME_DEBUG
5104 printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
5105 #endif
5106 if (type->cast) {
5107 type->cast->prev = cast;
5108 cast->next = type->cast;
5109 }
5110 type->cast = cast;
5111 }
5112 cast++;
5113 }
5114 /* Set entry in modules->types array equal to the type */
5115 swig_module.types[i] = type;
5116 }
5117 swig_module.types[i] = 0;
5118
5119 #ifdef SWIGRUNTIME_DEBUG
5120 printf("**** SWIG_InitializeModule: Cast List ******\n");
5121 for (i = 0; i < swig_module.size; ++i) {
5122 int j = 0;
5123 swig_cast_info *cast = swig_module.cast_initial[i];
5124 printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
5125 while (cast->type) {
5126 printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
5127 cast++;
5128 ++j;
5129 }
5130 printf("---- Total casts: %d\n",j);
5131 }
5132 printf("**** SWIG_InitializeModule: Cast List ******\n");
5133 #endif
5134 }
5135
5136 /* This function will propagate the clientdata field of type to
5137 * any new swig_type_info structures that have been added into the list
5138 * of equivalent types. It is like calling
5139 * SWIG_TypeClientData(type, clientdata) a second time.
5140 */
5141 SWIGRUNTIME void
SWIG_PropagateClientData(void)5142 SWIG_PropagateClientData(void) {
5143 size_t i;
5144 swig_cast_info *equiv;
5145 static int init_run = 0;
5146
5147 if (init_run) return;
5148 init_run = 1;
5149
5150 for (i = 0; i < swig_module.size; i++) {
5151 if (swig_module.types[i]->clientdata) {
5152 equiv = swig_module.types[i]->cast;
5153 while (equiv) {
5154 if (!equiv->converter) {
5155 if (equiv->type && !equiv->type->clientdata)
5156 SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
5157 }
5158 equiv = equiv->next;
5159 }
5160 }
5161 }
5162 }
5163
5164 #ifdef __cplusplus
5165 #if 0
5166 { /* c-mode */
5167 #endif
5168 }
5169 #endif
5170
5171 /*
5172
5173 */
5174 #ifdef __cplusplus
5175 extern "C"
5176 #endif
Init_jellyfish(void)5177 SWIGEXPORT void Init_jellyfish(void) {
5178 size_t i;
5179
5180 SWIG_InitRuntime();
5181 mJellyfish = rb_define_module("Jellyfish");
5182
5183 SWIG_InitializeModule(0);
5184 for (i = 0; i < swig_module.size; i++) {
5185 SWIG_define_class(swig_module.types[i]);
5186 }
5187
5188 SWIG_RubyInitializeTrackings();
5189
5190 SwigClassMerDNA.klass = rb_define_class_under(mJellyfish, "MerDNA", rb_cObject);
5191 SWIG_TypeClientData(SWIGTYPE_p_MerDNA, (void *) &SwigClassMerDNA);
5192 rb_define_alloc_func(SwigClassMerDNA.klass, _wrap_MerDNA_allocate);
5193 rb_define_method(SwigClassMerDNA.klass, "initialize", VALUEFUNC(_wrap_new_MerDNA), -1);
5194 rb_define_singleton_method(SwigClassMerDNA.klass, "k", VALUEFUNC(_wrap_MerDNA_k), -1);
5195 rb_define_method(SwigClassMerDNA.klass, "polyA!", VALUEFUNC(_wrap_MerDNA_polyAN___), -1);
5196 rb_define_method(SwigClassMerDNA.klass, "polyC!", VALUEFUNC(_wrap_MerDNA_polyCN___), -1);
5197 rb_define_method(SwigClassMerDNA.klass, "polyG!", VALUEFUNC(_wrap_MerDNA_polyGN___), -1);
5198 rb_define_method(SwigClassMerDNA.klass, "polyT!", VALUEFUNC(_wrap_MerDNA_polyTN___), -1);
5199 rb_define_method(SwigClassMerDNA.klass, "randomize!", VALUEFUNC(_wrap_MerDNA_randomizeN___), -1);
5200 rb_define_method(SwigClassMerDNA.klass, "is_homopolymer", VALUEFUNC(_wrap_MerDNA_is_homopolymer), -1);
5201 rb_define_method(SwigClassMerDNA.klass, "shift_left", VALUEFUNC(_wrap_MerDNA_shift_left), -1);
5202 rb_define_method(SwigClassMerDNA.klass, "shift_right", VALUEFUNC(_wrap_MerDNA_shift_right), -1);
5203 rb_define_method(SwigClassMerDNA.klass, "canonicalize!", VALUEFUNC(_wrap_MerDNA_canonicalizeN___), -1);
5204 rb_define_method(SwigClassMerDNA.klass, "reverse_complement!", VALUEFUNC(_wrap_MerDNA_reverse_complementN___), -1);
5205 rb_define_method(SwigClassMerDNA.klass, "get_canonical", VALUEFUNC(_wrap_MerDNA_get_canonical), -1);
5206 rb_define_method(SwigClassMerDNA.klass, "get_reverse_complement", VALUEFUNC(_wrap_MerDNA_get_reverse_complement), -1);
5207 rb_define_method(SwigClassMerDNA.klass, "==", VALUEFUNC(_wrap_MerDNA___eq__), -1);
5208 rb_define_method(SwigClassMerDNA.klass, "<", VALUEFUNC(_wrap_MerDNA___lt__), -1);
5209 rb_define_method(SwigClassMerDNA.klass, ">", VALUEFUNC(_wrap_MerDNA___gt__), -1);
5210 rb_define_method(SwigClassMerDNA.klass, "dup", VALUEFUNC(_wrap_MerDNA_dup), -1);
5211 rb_define_method(SwigClassMerDNA.klass, "to_s", VALUEFUNC(_wrap_MerDNA___str__), -1);
5212 rb_define_method(SwigClassMerDNA.klass, "set", VALUEFUNC(_wrap_MerDNA_set), -1);
5213 rb_define_method(SwigClassMerDNA.klass, "[]", VALUEFUNC(_wrap_MerDNA___getitem__), -1);
5214 rb_define_method(SwigClassMerDNA.klass, "[]=", VALUEFUNC(_wrap_MerDNA___setitem__), -1);
5215 rb_define_method(SwigClassMerDNA.klass, "<<", VALUEFUNC(_wrap_MerDNA___lshift__), -1);
5216 rb_define_method(SwigClassMerDNA.klass, ">>", VALUEFUNC(_wrap_MerDNA___rshift__), -1);
5217 SwigClassMerDNA.mark = 0;
5218 SwigClassMerDNA.destroy = (void (*)(void *)) free_MerDNA;
5219 SwigClassMerDNA.trackObjects = 0;
5220
5221 SwigClassQueryMerFile.klass = rb_define_class_under(mJellyfish, "QueryMerFile", rb_cObject);
5222 SWIG_TypeClientData(SWIGTYPE_p_QueryMerFile, (void *) &SwigClassQueryMerFile);
5223 rb_define_alloc_func(SwigClassQueryMerFile.klass, _wrap_QueryMerFile_allocate);
5224 rb_define_method(SwigClassQueryMerFile.klass, "initialize", VALUEFUNC(_wrap_new_QueryMerFile), -1);
5225 rb_define_method(SwigClassQueryMerFile.klass, "[]", VALUEFUNC(_wrap_QueryMerFile___getitem__), -1);
5226 SwigClassQueryMerFile.mark = 0;
5227 SwigClassQueryMerFile.destroy = (void (*)(void *)) free_QueryMerFile;
5228 SwigClassQueryMerFile.trackObjects = 0;
5229
5230 SwigClassReadMerFile.klass = rb_define_class_under(mJellyfish, "ReadMerFile", rb_cObject);
5231 SWIG_TypeClientData(SWIGTYPE_p_ReadMerFile, (void *) &SwigClassReadMerFile);
5232 rb_include_module(SwigClassReadMerFile.klass, rb_eval_string("Enumerable"));
5233 rb_define_alloc_func(SwigClassReadMerFile.klass, _wrap_ReadMerFile_allocate);
5234 rb_define_method(SwigClassReadMerFile.klass, "initialize", VALUEFUNC(_wrap_new_ReadMerFile), -1);
5235 rb_define_method(SwigClassReadMerFile.klass, "next_mer", VALUEFUNC(_wrap_ReadMerFile_next_mer), -1);
5236 rb_define_method(SwigClassReadMerFile.klass, "mer", VALUEFUNC(_wrap_ReadMerFile_mer), -1);
5237 rb_define_method(SwigClassReadMerFile.klass, "count", VALUEFUNC(_wrap_ReadMerFile_count), -1);
5238 rb_define_method(SwigClassReadMerFile.klass, "each", VALUEFUNC(_wrap_ReadMerFile_each), -1);
5239 SwigClassReadMerFile.mark = 0;
5240 SwigClassReadMerFile.destroy = (void (*)(void *)) free_ReadMerFile;
5241 SwigClassReadMerFile.trackObjects = 0;
5242
5243 SwigClassHashCounter.klass = rb_define_class_under(mJellyfish, "HashCounter", rb_cObject);
5244 SWIG_TypeClientData(SWIGTYPE_p_HashCounter, (void *) &SwigClassHashCounter);
5245 rb_define_alloc_func(SwigClassHashCounter.klass, _wrap_HashCounter_allocate);
5246 rb_define_method(SwigClassHashCounter.klass, "initialize", VALUEFUNC(_wrap_new_HashCounter), -1);
5247 rb_define_method(SwigClassHashCounter.klass, "size", VALUEFUNC(_wrap_HashCounter_size), -1);
5248 rb_define_method(SwigClassHashCounter.klass, "val_len", VALUEFUNC(_wrap_HashCounter_val_len), -1);
5249 rb_define_method(SwigClassHashCounter.klass, "add", VALUEFUNC(_wrap_HashCounter_add), -1);
5250 rb_define_method(SwigClassHashCounter.klass, "update_add", VALUEFUNC(_wrap_HashCounter_update_add), -1);
5251 rb_define_method(SwigClassHashCounter.klass, "get", VALUEFUNC(_wrap_HashCounter_get), -1);
5252 rb_define_method(SwigClassHashCounter.klass, "[]", VALUEFUNC(_wrap_HashCounter___getitem__), -1);
5253 SwigClassHashCounter.mark = 0;
5254 SwigClassHashCounter.destroy = (void (*)(void *)) free_HashCounter;
5255 SwigClassHashCounter.trackObjects = 0;
5256
5257 SwigClassHashSet.klass = rb_define_class_under(mJellyfish, "HashSet", rb_cObject);
5258 SWIG_TypeClientData(SWIGTYPE_p_HashSet, (void *) &SwigClassHashSet);
5259 rb_define_alloc_func(SwigClassHashSet.klass, _wrap_HashSet_allocate);
5260 rb_define_method(SwigClassHashSet.klass, "initialize", VALUEFUNC(_wrap_new_HashSet), -1);
5261 rb_define_method(SwigClassHashSet.klass, "size", VALUEFUNC(_wrap_HashSet_size), -1);
5262 rb_define_method(SwigClassHashSet.klass, "add", VALUEFUNC(_wrap_HashSet_add), -1);
5263 rb_define_method(SwigClassHashSet.klass, "get", VALUEFUNC(_wrap_HashSet_get), -1);
5264 rb_define_method(SwigClassHashSet.klass, "[]", VALUEFUNC(_wrap_HashSet___getitem__), -1);
5265 SwigClassHashSet.mark = 0;
5266 SwigClassHashSet.destroy = (void (*)(void *)) free_HashSet;
5267 SwigClassHashSet.trackObjects = 0;
5268 rb_define_module_function(mJellyfish, "string_mers", VALUEFUNC(_wrap_string_mers), -1);
5269 rb_define_module_function(mJellyfish, "string_canonicals", VALUEFUNC(_wrap_string_canonicals), -1);
5270
5271 rb_eval_string("class String\n"
5272 " def mers(&b); it = Jellyfish::string_mers(self); b ? it.each(&b) : it; end\n"
5273 " def canonicals(&b); it = Jellyfish::string_canonicals(self, &b); b ? it.each(&b) : it; end\n"
5274 "end");
5275
5276
5277 SwigClassStringMers.klass = rb_define_class_under(mJellyfish, "StringMers", rb_cObject);
5278 SWIG_TypeClientData(SWIGTYPE_p_StringMers, (void *) &SwigClassStringMers);
5279 rb_include_module(SwigClassStringMers.klass, rb_eval_string("Enumerable"));
5280 rb_define_alloc_func(SwigClassStringMers.klass, _wrap_StringMers_allocate);
5281 rb_define_method(SwigClassStringMers.klass, "initialize", VALUEFUNC(_wrap_new_StringMers), -1);
5282 rb_define_method(SwigClassStringMers.klass, "next_mer", VALUEFUNC(_wrap_StringMers_next_mer), -1);
5283 rb_define_method(SwigClassStringMers.klass, "mer", VALUEFUNC(_wrap_StringMers_mer), -1);
5284 rb_define_method(SwigClassStringMers.klass, "each", VALUEFUNC(_wrap_StringMers_each), -1);
5285 SwigClassStringMers.mark = 0;
5286 SwigClassStringMers.destroy = (void (*)(void *)) free_StringMers;
5287 SwigClassStringMers.trackObjects = 0;
5288 }
5289
5290