jwilkins-spamsum 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2405 @@
1
+ /* ----------------------------------------------------------------------------
2
+ * This file was automatically generated by SWIG (http://www.swig.org).
3
+ * Version 1.3.35
4
+ *
5
+ * This file is not intended to be easily readable and contains a number of
6
+ * coding conventions designed to improve portability and efficiency. Do not make
7
+ * changes to this file unless you know what you are doing--modify the SWIG
8
+ * interface file instead.
9
+ * ----------------------------------------------------------------------------- */
10
+
11
+ #define SWIGRUBY
12
+ /* -----------------------------------------------------------------------------
13
+ * This section contains generic SWIG labels for method/variable
14
+ * declarations/attributes, and other compiler dependent labels.
15
+ * ----------------------------------------------------------------------------- */
16
+
17
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
18
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
19
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
20
+ # define SWIGTEMPLATEDISAMBIGUATOR template
21
+ # elif defined(__HP_aCC)
22
+ /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
23
+ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
24
+ # define SWIGTEMPLATEDISAMBIGUATOR template
25
+ # else
26
+ # define SWIGTEMPLATEDISAMBIGUATOR
27
+ # endif
28
+ #endif
29
+
30
+ /* inline attribute */
31
+ #ifndef SWIGINLINE
32
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
33
+ # define SWIGINLINE inline
34
+ # else
35
+ # define SWIGINLINE
36
+ # endif
37
+ #endif
38
+
39
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
40
+ #ifndef SWIGUNUSED
41
+ # if defined(__GNUC__)
42
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
43
+ # define SWIGUNUSED __attribute__ ((__unused__))
44
+ # else
45
+ # define SWIGUNUSED
46
+ # endif
47
+ # elif defined(__ICC)
48
+ # define SWIGUNUSED __attribute__ ((__unused__))
49
+ # else
50
+ # define SWIGUNUSED
51
+ # endif
52
+ #endif
53
+
54
+ #ifndef SWIGUNUSEDPARM
55
+ # ifdef __cplusplus
56
+ # define SWIGUNUSEDPARM(p)
57
+ # else
58
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
59
+ # endif
60
+ #endif
61
+
62
+ /* internal SWIG method */
63
+ #ifndef SWIGINTERN
64
+ # define SWIGINTERN static SWIGUNUSED
65
+ #endif
66
+
67
+ /* internal inline SWIG method */
68
+ #ifndef SWIGINTERNINLINE
69
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
70
+ #endif
71
+
72
+ /* exporting methods */
73
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
74
+ # ifndef GCC_HASCLASSVISIBILITY
75
+ # define GCC_HASCLASSVISIBILITY
76
+ # endif
77
+ #endif
78
+
79
+ #ifndef SWIGEXPORT
80
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
81
+ # if defined(STATIC_LINKED)
82
+ # define SWIGEXPORT
83
+ # else
84
+ # define SWIGEXPORT __declspec(dllexport)
85
+ # endif
86
+ # else
87
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
88
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
89
+ # else
90
+ # define SWIGEXPORT
91
+ # endif
92
+ # endif
93
+ #endif
94
+
95
+ /* calling conventions for Windows */
96
+ #ifndef SWIGSTDCALL
97
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
98
+ # define SWIGSTDCALL __stdcall
99
+ # else
100
+ # define SWIGSTDCALL
101
+ # endif
102
+ #endif
103
+
104
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
105
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
106
+ # define _CRT_SECURE_NO_DEPRECATE
107
+ #endif
108
+
109
+ /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
110
+ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
111
+ # define _SCL_SECURE_NO_DEPRECATE
112
+ #endif
113
+
114
+
115
+ /* -----------------------------------------------------------------------------
116
+ * This section contains generic SWIG labels for method/variable
117
+ * declarations/attributes, and other compiler dependent labels.
118
+ * ----------------------------------------------------------------------------- */
119
+
120
+ /* template workaround for compilers that cannot correctly implement the C++ standard */
121
+ #ifndef SWIGTEMPLATEDISAMBIGUATOR
122
+ # if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
123
+ # define SWIGTEMPLATEDISAMBIGUATOR template
124
+ # elif defined(__HP_aCC)
125
+ /* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
126
+ /* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
127
+ # define SWIGTEMPLATEDISAMBIGUATOR template
128
+ # else
129
+ # define SWIGTEMPLATEDISAMBIGUATOR
130
+ # endif
131
+ #endif
132
+
133
+ /* inline attribute */
134
+ #ifndef SWIGINLINE
135
+ # if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
136
+ # define SWIGINLINE inline
137
+ # else
138
+ # define SWIGINLINE
139
+ # endif
140
+ #endif
141
+
142
+ /* attribute recognised by some compilers to avoid 'unused' warnings */
143
+ #ifndef SWIGUNUSED
144
+ # if defined(__GNUC__)
145
+ # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
146
+ # define SWIGUNUSED __attribute__ ((__unused__))
147
+ # else
148
+ # define SWIGUNUSED
149
+ # endif
150
+ # elif defined(__ICC)
151
+ # define SWIGUNUSED __attribute__ ((__unused__))
152
+ # else
153
+ # define SWIGUNUSED
154
+ # endif
155
+ #endif
156
+
157
+ #ifndef SWIGUNUSEDPARM
158
+ # ifdef __cplusplus
159
+ # define SWIGUNUSEDPARM(p)
160
+ # else
161
+ # define SWIGUNUSEDPARM(p) p SWIGUNUSED
162
+ # endif
163
+ #endif
164
+
165
+ /* internal SWIG method */
166
+ #ifndef SWIGINTERN
167
+ # define SWIGINTERN static SWIGUNUSED
168
+ #endif
169
+
170
+ /* internal inline SWIG method */
171
+ #ifndef SWIGINTERNINLINE
172
+ # define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
173
+ #endif
174
+
175
+ /* exporting methods */
176
+ #if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
177
+ # ifndef GCC_HASCLASSVISIBILITY
178
+ # define GCC_HASCLASSVISIBILITY
179
+ # endif
180
+ #endif
181
+
182
+ #ifndef SWIGEXPORT
183
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
184
+ # if defined(STATIC_LINKED)
185
+ # define SWIGEXPORT
186
+ # else
187
+ # define SWIGEXPORT __declspec(dllexport)
188
+ # endif
189
+ # else
190
+ # if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
191
+ # define SWIGEXPORT __attribute__ ((visibility("default")))
192
+ # else
193
+ # define SWIGEXPORT
194
+ # endif
195
+ # endif
196
+ #endif
197
+
198
+ /* calling conventions for Windows */
199
+ #ifndef SWIGSTDCALL
200
+ # if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
201
+ # define SWIGSTDCALL __stdcall
202
+ # else
203
+ # define SWIGSTDCALL
204
+ # endif
205
+ #endif
206
+
207
+ /* Deal with Microsoft's attempt at deprecating C standard runtime functions */
208
+ #if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
209
+ # define _CRT_SECURE_NO_DEPRECATE
210
+ #endif
211
+
212
+ /* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
213
+ #if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
214
+ # define _SCL_SECURE_NO_DEPRECATE
215
+ #endif
216
+
217
+
218
+ /* -----------------------------------------------------------------------------
219
+ * swigrun.swg
220
+ *
221
+ * This file contains generic CAPI SWIG runtime support for pointer
222
+ * type checking.
223
+ * ----------------------------------------------------------------------------- */
224
+
225
+ /* This should only be incremented when either the layout of swig_type_info changes,
226
+ or for whatever reason, the runtime changes incompatibly */
227
+ #define SWIG_RUNTIME_VERSION "4"
228
+
229
+ /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
230
+ #ifdef SWIG_TYPE_TABLE
231
+ # define SWIG_QUOTE_STRING(x) #x
232
+ # define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
233
+ # define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
234
+ #else
235
+ # define SWIG_TYPE_TABLE_NAME
236
+ #endif
237
+
238
+ /*
239
+ You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
240
+ creating a static or dynamic library from the swig runtime code.
241
+ In 99.9% of the cases, swig just needs to declare them as 'static'.
242
+
243
+ But only do this if is strictly necessary, ie, if you have problems
244
+ with your compiler or so.
245
+ */
246
+
247
+ #ifndef SWIGRUNTIME
248
+ # define SWIGRUNTIME SWIGINTERN
249
+ #endif
250
+
251
+ #ifndef SWIGRUNTIMEINLINE
252
+ # define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
253
+ #endif
254
+
255
+ /* Generic buffer size */
256
+ #ifndef SWIG_BUFFER_SIZE
257
+ # define SWIG_BUFFER_SIZE 1024
258
+ #endif
259
+
260
+ /* Flags for pointer conversions */
261
+ #define SWIG_POINTER_DISOWN 0x1
262
+ #define SWIG_CAST_NEW_MEMORY 0x2
263
+
264
+ /* Flags for new pointer objects */
265
+ #define SWIG_POINTER_OWN 0x1
266
+
267
+
268
+ /*
269
+ Flags/methods for returning states.
270
+
271
+ The swig conversion methods, as ConvertPtr, return and integer
272
+ that tells if the conversion was successful or not. And if not,
273
+ an error code can be returned (see swigerrors.swg for the codes).
274
+
275
+ Use the following macros/flags to set or process the returning
276
+ states.
277
+
278
+ In old swig versions, you usually write code as:
279
+
280
+ if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
281
+ // success code
282
+ } else {
283
+ //fail code
284
+ }
285
+
286
+ Now you can be more explicit as:
287
+
288
+ int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
289
+ if (SWIG_IsOK(res)) {
290
+ // success code
291
+ } else {
292
+ // fail code
293
+ }
294
+
295
+ that seems to be the same, but now you can also do
296
+
297
+ Type *ptr;
298
+ int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
299
+ if (SWIG_IsOK(res)) {
300
+ // success code
301
+ if (SWIG_IsNewObj(res) {
302
+ ...
303
+ delete *ptr;
304
+ } else {
305
+ ...
306
+ }
307
+ } else {
308
+ // fail code
309
+ }
310
+
311
+ I.e., now SWIG_ConvertPtr can return new objects and you can
312
+ identify the case and take care of the deallocation. Of course that
313
+ requires also to SWIG_ConvertPtr to return new result values, as
314
+
315
+ int SWIG_ConvertPtr(obj, ptr,...) {
316
+ if (<obj is ok>) {
317
+ if (<need new object>) {
318
+ *ptr = <ptr to new allocated object>;
319
+ return SWIG_NEWOBJ;
320
+ } else {
321
+ *ptr = <ptr to old object>;
322
+ return SWIG_OLDOBJ;
323
+ }
324
+ } else {
325
+ return SWIG_BADOBJ;
326
+ }
327
+ }
328
+
329
+ Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
330
+ more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
331
+ swig errors code.
332
+
333
+ Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
334
+ allows to return the 'cast rank', for example, if you have this
335
+
336
+ int food(double)
337
+ int fooi(int);
338
+
339
+ and you call
340
+
341
+ food(1) // cast rank '1' (1 -> 1.0)
342
+ fooi(1) // cast rank '0'
343
+
344
+ just use the SWIG_AddCast()/SWIG_CheckState()
345
+
346
+
347
+ */
348
+ #define SWIG_OK (0)
349
+ #define SWIG_ERROR (-1)
350
+ #define SWIG_IsOK(r) (r >= 0)
351
+ #define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
352
+
353
+ /* The CastRankLimit says how many bits are used for the cast rank */
354
+ #define SWIG_CASTRANKLIMIT (1 << 8)
355
+ /* The NewMask denotes the object was created (using new/malloc) */
356
+ #define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
357
+ /* The TmpMask is for in/out typemaps that use temporal objects */
358
+ #define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
359
+ /* Simple returning values */
360
+ #define SWIG_BADOBJ (SWIG_ERROR)
361
+ #define SWIG_OLDOBJ (SWIG_OK)
362
+ #define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
363
+ #define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
364
+ /* Check, add and del mask methods */
365
+ #define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
366
+ #define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
367
+ #define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
368
+ #define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
369
+ #define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
370
+ #define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
371
+
372
+
373
+ /* Cast-Rank Mode */
374
+ #if defined(SWIG_CASTRANK_MODE)
375
+ # ifndef SWIG_TypeRank
376
+ # define SWIG_TypeRank unsigned long
377
+ # endif
378
+ # ifndef SWIG_MAXCASTRANK /* Default cast allowed */
379
+ # define SWIG_MAXCASTRANK (2)
380
+ # endif
381
+ # define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
382
+ # define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
383
+ SWIGINTERNINLINE int SWIG_AddCast(int r) {
384
+ return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
385
+ }
386
+ SWIGINTERNINLINE int SWIG_CheckState(int r) {
387
+ return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
388
+ }
389
+ #else /* no cast-rank mode */
390
+ # define SWIG_AddCast
391
+ # define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
392
+ #endif
393
+
394
+
395
+
396
+
397
+ #include <string.h>
398
+
399
+ #ifdef __cplusplus
400
+ extern "C" {
401
+ #endif
402
+
403
+ typedef void *(*swig_converter_func)(void *, int *);
404
+ typedef struct swig_type_info *(*swig_dycast_func)(void **);
405
+
406
+ /* Structure to store information on one type */
407
+ typedef struct swig_type_info {
408
+ const char *name; /* mangled name of this type */
409
+ const char *str; /* human readable name of this type */
410
+ swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
411
+ struct swig_cast_info *cast; /* linked list of types that can cast into this type */
412
+ void *clientdata; /* language specific type data */
413
+ int owndata; /* flag if the structure owns the clientdata */
414
+ } swig_type_info;
415
+
416
+ /* Structure to store a type and conversion function used for casting */
417
+ typedef struct swig_cast_info {
418
+ swig_type_info *type; /* pointer to type that is equivalent to this type */
419
+ swig_converter_func converter; /* function to cast the void pointers */
420
+ struct swig_cast_info *next; /* pointer to next cast in linked list */
421
+ struct swig_cast_info *prev; /* pointer to the previous cast */
422
+ } swig_cast_info;
423
+
424
+ /* Structure used to store module information
425
+ * Each module generates one structure like this, and the runtime collects
426
+ * all of these structures and stores them in a circularly linked list.*/
427
+ typedef struct swig_module_info {
428
+ swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
429
+ size_t size; /* Number of types in this module */
430
+ struct swig_module_info *next; /* Pointer to next element in circularly linked list */
431
+ swig_type_info **type_initial; /* Array of initially generated type structures */
432
+ swig_cast_info **cast_initial; /* Array of initially generated casting structures */
433
+ void *clientdata; /* Language specific module data */
434
+ } swig_module_info;
435
+
436
+ /*
437
+ Compare two type names skipping the space characters, therefore
438
+ "char*" == "char *" and "Class<int>" == "Class<int >", etc.
439
+
440
+ Return 0 when the two name types are equivalent, as in
441
+ strncmp, but skipping ' '.
442
+ */
443
+ SWIGRUNTIME int
444
+ SWIG_TypeNameComp(const char *f1, const char *l1,
445
+ const char *f2, const char *l2) {
446
+ for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
447
+ while ((*f1 == ' ') && (f1 != l1)) ++f1;
448
+ while ((*f2 == ' ') && (f2 != l2)) ++f2;
449
+ if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
450
+ }
451
+ return (int)((l1 - f1) - (l2 - f2));
452
+ }
453
+
454
+ /*
455
+ Check type equivalence in a name list like <name1>|<name2>|...
456
+ Return 0 if not equal, 1 if equal
457
+ */
458
+ SWIGRUNTIME int
459
+ SWIG_TypeEquiv(const char *nb, const char *tb) {
460
+ int equiv = 0;
461
+ const char* te = tb + strlen(tb);
462
+ const char* ne = nb;
463
+ while (!equiv && *ne) {
464
+ for (nb = ne; *ne; ++ne) {
465
+ if (*ne == '|') break;
466
+ }
467
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
468
+ if (*ne) ++ne;
469
+ }
470
+ return equiv;
471
+ }
472
+
473
+ /*
474
+ Check type equivalence in a name list like <name1>|<name2>|...
475
+ Return 0 if equal, -1 if nb < tb, 1 if nb > tb
476
+ */
477
+ SWIGRUNTIME int
478
+ SWIG_TypeCompare(const char *nb, const char *tb) {
479
+ int equiv = 0;
480
+ const char* te = tb + strlen(tb);
481
+ const char* ne = nb;
482
+ while (!equiv && *ne) {
483
+ for (nb = ne; *ne; ++ne) {
484
+ if (*ne == '|') break;
485
+ }
486
+ equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
487
+ if (*ne) ++ne;
488
+ }
489
+ return equiv;
490
+ }
491
+
492
+
493
+ /* think of this as a c++ template<> or a scheme macro */
494
+ #define SWIG_TypeCheck_Template(comparison, ty) \
495
+ if (ty) { \
496
+ swig_cast_info *iter = ty->cast; \
497
+ while (iter) { \
498
+ if (comparison) { \
499
+ if (iter == ty->cast) return iter; \
500
+ /* Move iter to the top of the linked list */ \
501
+ iter->prev->next = iter->next; \
502
+ if (iter->next) \
503
+ iter->next->prev = iter->prev; \
504
+ iter->next = ty->cast; \
505
+ iter->prev = 0; \
506
+ if (ty->cast) ty->cast->prev = iter; \
507
+ ty->cast = iter; \
508
+ return iter; \
509
+ } \
510
+ iter = iter->next; \
511
+ } \
512
+ } \
513
+ return 0
514
+
515
+ /*
516
+ Check the typename
517
+ */
518
+ SWIGRUNTIME swig_cast_info *
519
+ SWIG_TypeCheck(const char *c, swig_type_info *ty) {
520
+ SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
521
+ }
522
+
523
+ /* Same as previous function, except strcmp is replaced with a pointer comparison */
524
+ SWIGRUNTIME swig_cast_info *
525
+ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
526
+ SWIG_TypeCheck_Template(iter->type == from, into);
527
+ }
528
+
529
+ /*
530
+ Cast a pointer up an inheritance hierarchy
531
+ */
532
+ SWIGRUNTIMEINLINE void *
533
+ SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
534
+ return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
535
+ }
536
+
537
+ /*
538
+ Dynamic pointer casting. Down an inheritance hierarchy
539
+ */
540
+ SWIGRUNTIME swig_type_info *
541
+ SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
542
+ swig_type_info *lastty = ty;
543
+ if (!ty || !ty->dcast) return ty;
544
+ while (ty && (ty->dcast)) {
545
+ ty = (*ty->dcast)(ptr);
546
+ if (ty) lastty = ty;
547
+ }
548
+ return lastty;
549
+ }
550
+
551
+ /*
552
+ Return the name associated with this type
553
+ */
554
+ SWIGRUNTIMEINLINE const char *
555
+ SWIG_TypeName(const swig_type_info *ty) {
556
+ return ty->name;
557
+ }
558
+
559
+ /*
560
+ Return the pretty name associated with this type,
561
+ that is an unmangled type name in a form presentable to the user.
562
+ */
563
+ SWIGRUNTIME const char *
564
+ SWIG_TypePrettyName(const swig_type_info *type) {
565
+ /* The "str" field contains the equivalent pretty names of the
566
+ type, separated by vertical-bar characters. We choose
567
+ to print the last name, as it is often (?) the most
568
+ specific. */
569
+ if (!type) return NULL;
570
+ if (type->str != NULL) {
571
+ const char *last_name = type->str;
572
+ const char *s;
573
+ for (s = type->str; *s; s++)
574
+ if (*s == '|') last_name = s+1;
575
+ return last_name;
576
+ }
577
+ else
578
+ return type->name;
579
+ }
580
+
581
+ /*
582
+ Set the clientdata field for a type
583
+ */
584
+ SWIGRUNTIME void
585
+ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
586
+ swig_cast_info *cast = ti->cast;
587
+ /* if (ti->clientdata == clientdata) return; */
588
+ ti->clientdata = clientdata;
589
+
590
+ while (cast) {
591
+ if (!cast->converter) {
592
+ swig_type_info *tc = cast->type;
593
+ if (!tc->clientdata) {
594
+ SWIG_TypeClientData(tc, clientdata);
595
+ }
596
+ }
597
+ cast = cast->next;
598
+ }
599
+ }
600
+ SWIGRUNTIME void
601
+ SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
602
+ SWIG_TypeClientData(ti, clientdata);
603
+ ti->owndata = 1;
604
+ }
605
+
606
+ /*
607
+ Search for a swig_type_info structure only by mangled name
608
+ Search is a O(log #types)
609
+
610
+ We start searching at module start, and finish searching when start == end.
611
+ Note: if start == end at the beginning of the function, we go all the way around
612
+ the circular list.
613
+ */
614
+ SWIGRUNTIME swig_type_info *
615
+ SWIG_MangledTypeQueryModule(swig_module_info *start,
616
+ swig_module_info *end,
617
+ const char *name) {
618
+ swig_module_info *iter = start;
619
+ do {
620
+ if (iter->size) {
621
+ register size_t l = 0;
622
+ register size_t r = iter->size - 1;
623
+ do {
624
+ /* since l+r >= 0, we can (>> 1) instead (/ 2) */
625
+ register size_t i = (l + r) >> 1;
626
+ const char *iname = iter->types[i]->name;
627
+ if (iname) {
628
+ register int compare = strcmp(name, iname);
629
+ if (compare == 0) {
630
+ return iter->types[i];
631
+ } else if (compare < 0) {
632
+ if (i) {
633
+ r = i - 1;
634
+ } else {
635
+ break;
636
+ }
637
+ } else if (compare > 0) {
638
+ l = i + 1;
639
+ }
640
+ } else {
641
+ break; /* should never happen */
642
+ }
643
+ } while (l <= r);
644
+ }
645
+ iter = iter->next;
646
+ } while (iter != end);
647
+ return 0;
648
+ }
649
+
650
+ /*
651
+ Search for a swig_type_info structure for either a mangled name or a human readable name.
652
+ It first searches the mangled names of the types, which is a O(log #types)
653
+ If a type is not found it then searches the human readable names, which is O(#types).
654
+
655
+ We start searching at module start, and finish searching when start == end.
656
+ Note: if start == end at the beginning of the function, we go all the way around
657
+ the circular list.
658
+ */
659
+ SWIGRUNTIME swig_type_info *
660
+ SWIG_TypeQueryModule(swig_module_info *start,
661
+ swig_module_info *end,
662
+ const char *name) {
663
+ /* STEP 1: Search the name field using binary search */
664
+ swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
665
+ if (ret) {
666
+ return ret;
667
+ } else {
668
+ /* STEP 2: If the type hasn't been found, do a complete search
669
+ of the str field (the human readable name) */
670
+ swig_module_info *iter = start;
671
+ do {
672
+ register size_t i = 0;
673
+ for (; i < iter->size; ++i) {
674
+ if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
675
+ return iter->types[i];
676
+ }
677
+ iter = iter->next;
678
+ } while (iter != end);
679
+ }
680
+
681
+ /* neither found a match */
682
+ return 0;
683
+ }
684
+
685
+ /*
686
+ Pack binary data into a string
687
+ */
688
+ SWIGRUNTIME char *
689
+ SWIG_PackData(char *c, void *ptr, size_t sz) {
690
+ static const char hex[17] = "0123456789abcdef";
691
+ register const unsigned char *u = (unsigned char *) ptr;
692
+ register const unsigned char *eu = u + sz;
693
+ for (; u != eu; ++u) {
694
+ register unsigned char uu = *u;
695
+ *(c++) = hex[(uu & 0xf0) >> 4];
696
+ *(c++) = hex[uu & 0xf];
697
+ }
698
+ return c;
699
+ }
700
+
701
+ /*
702
+ Unpack binary data from a string
703
+ */
704
+ SWIGRUNTIME const char *
705
+ SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
706
+ register unsigned char *u = (unsigned char *) ptr;
707
+ register const unsigned char *eu = u + sz;
708
+ for (; u != eu; ++u) {
709
+ register char d = *(c++);
710
+ register unsigned char uu;
711
+ if ((d >= '0') && (d <= '9'))
712
+ uu = ((d - '0') << 4);
713
+ else if ((d >= 'a') && (d <= 'f'))
714
+ uu = ((d - ('a'-10)) << 4);
715
+ else
716
+ return (char *) 0;
717
+ d = *(c++);
718
+ if ((d >= '0') && (d <= '9'))
719
+ uu |= (d - '0');
720
+ else if ((d >= 'a') && (d <= 'f'))
721
+ uu |= (d - ('a'-10));
722
+ else
723
+ return (char *) 0;
724
+ *u = uu;
725
+ }
726
+ return c;
727
+ }
728
+
729
+ /*
730
+ Pack 'void *' into a string buffer.
731
+ */
732
+ SWIGRUNTIME char *
733
+ SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
734
+ char *r = buff;
735
+ if ((2*sizeof(void *) + 2) > bsz) return 0;
736
+ *(r++) = '_';
737
+ r = SWIG_PackData(r,&ptr,sizeof(void *));
738
+ if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
739
+ strcpy(r,name);
740
+ return buff;
741
+ }
742
+
743
+ SWIGRUNTIME const char *
744
+ SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
745
+ if (*c != '_') {
746
+ if (strcmp(c,"NULL") == 0) {
747
+ *ptr = (void *) 0;
748
+ return name;
749
+ } else {
750
+ return 0;
751
+ }
752
+ }
753
+ return SWIG_UnpackData(++c,ptr,sizeof(void *));
754
+ }
755
+
756
+ SWIGRUNTIME char *
757
+ SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
758
+ char *r = buff;
759
+ size_t lname = (name ? strlen(name) : 0);
760
+ if ((2*sz + 2 + lname) > bsz) return 0;
761
+ *(r++) = '_';
762
+ r = SWIG_PackData(r,ptr,sz);
763
+ if (lname) {
764
+ strncpy(r,name,lname+1);
765
+ } else {
766
+ *r = 0;
767
+ }
768
+ return buff;
769
+ }
770
+
771
+ SWIGRUNTIME const char *
772
+ SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
773
+ if (*c != '_') {
774
+ if (strcmp(c,"NULL") == 0) {
775
+ memset(ptr,0,sz);
776
+ return name;
777
+ } else {
778
+ return 0;
779
+ }
780
+ }
781
+ return SWIG_UnpackData(++c,ptr,sz);
782
+ }
783
+
784
+ #ifdef __cplusplus
785
+ }
786
+ #endif
787
+
788
+ /* Errors in SWIG */
789
+ #define SWIG_UnknownError -1
790
+ #define SWIG_IOError -2
791
+ #define SWIG_RuntimeError -3
792
+ #define SWIG_IndexError -4
793
+ #define SWIG_TypeError -5
794
+ #define SWIG_DivisionByZero -6
795
+ #define SWIG_OverflowError -7
796
+ #define SWIG_SyntaxError -8
797
+ #define SWIG_ValueError -9
798
+ #define SWIG_SystemError -10
799
+ #define SWIG_AttributeError -11
800
+ #define SWIG_MemoryError -12
801
+ #define SWIG_NullReferenceError -13
802
+
803
+
804
+
805
+ #include <ruby.h>
806
+
807
+ /* Remove global macros defined in Ruby's win32.h */
808
+ #ifdef write
809
+ # undef write
810
+ #endif
811
+ #ifdef read
812
+ # undef read
813
+ #endif
814
+
815
+
816
+ /* Ruby 1.7 defines NUM2LL(), LL2NUM() and ULL2NUM() macros */
817
+ #ifndef NUM2LL
818
+ #define NUM2LL(x) NUM2LONG((x))
819
+ #endif
820
+ #ifndef LL2NUM
821
+ #define LL2NUM(x) INT2NUM((long) (x))
822
+ #endif
823
+ #ifndef ULL2NUM
824
+ #define ULL2NUM(x) UINT2NUM((unsigned long) (x))
825
+ #endif
826
+
827
+ /* Ruby 1.7 doesn't (yet) define NUM2ULL() */
828
+ #ifndef NUM2ULL
829
+ #ifdef HAVE_LONG_LONG
830
+ #define NUM2ULL(x) rb_num2ull((x))
831
+ #else
832
+ #define NUM2ULL(x) NUM2ULONG(x)
833
+ #endif
834
+ #endif
835
+
836
+ /* RSTRING_LEN, etc are new in Ruby 1.9, but ->ptr and ->len no longer work */
837
+ /* Define these for older versions so we can just write code the new way */
838
+ #ifndef RSTRING_LEN
839
+ # define RSTRING_LEN(x) RSTRING(x)->len
840
+ #endif
841
+ #ifndef RSTRING_PTR
842
+ # define RSTRING_PTR(x) RSTRING(x)->ptr
843
+ #endif
844
+ #ifndef RSTRING_END
845
+ # define RSTRING_END(x) (RSTRING_PTR(x) + RSTRING_LEN(x))
846
+ #endif
847
+ #ifndef RARRAY_LEN
848
+ # define RARRAY_LEN(x) RARRAY(x)->len
849
+ #endif
850
+ #ifndef RARRAY_PTR
851
+ # define RARRAY_PTR(x) RARRAY(x)->ptr
852
+ #endif
853
+ #ifndef RFLOAT_VALUE
854
+ # define RFLOAT_VALUE(x) RFLOAT(x)->value
855
+ #endif
856
+ #ifndef DOUBLE2NUM
857
+ # define DOUBLE2NUM(x) rb_float_new(x)
858
+ #endif
859
+ #ifndef RHASH_TBL
860
+ # define RHASH_TBL(x) (RHASH(x)->tbl)
861
+ #endif
862
+ #ifndef RHASH_ITER_LEV
863
+ # define RHASH_ITER_LEV(x) (RHASH(x)->iter_lev)
864
+ #endif
865
+ #ifndef RHASH_IFNONE
866
+ # define RHASH_IFNONE(x) (RHASH(x)->ifnone)
867
+ #endif
868
+ #ifndef RHASH_SIZE
869
+ # define RHASH_SIZE(x) (RHASH(x)->tbl->num_entries)
870
+ #endif
871
+ #ifndef RHASH_EMPTY_P
872
+ # define RHASH_EMPTY_P(x) (RHASH_SIZE(x) == 0)
873
+ #endif
874
+ #ifndef RSTRUCT_LEN
875
+ # define RSTRUCT_LEN(x) RSTRUCT(x)->len
876
+ #endif
877
+ #ifndef RSTRUCT_PTR
878
+ # define RSTRUCT_PTR(x) RSTRUCT(x)->ptr
879
+ #endif
880
+
881
+
882
+
883
+ /*
884
+ * Need to be very careful about how these macros are defined, especially
885
+ * when compiling C++ code or C code with an ANSI C compiler.
886
+ *
887
+ * VALUEFUNC(f) is a macro used to typecast a C function that implements
888
+ * a Ruby method so that it can be passed as an argument to API functions
889
+ * like rb_define_method() and rb_define_singleton_method().
890
+ *
891
+ * VOIDFUNC(f) is a macro used to typecast a C function that implements
892
+ * either the "mark" or "free" stuff for a Ruby Data object, so that it
893
+ * can be passed as an argument to API functions like Data_Wrap_Struct()
894
+ * and Data_Make_Struct().
895
+ */
896
+
897
+ #ifdef __cplusplus
898
+ # ifndef RUBY_METHOD_FUNC /* These definitions should work for Ruby 1.4.6 */
899
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
900
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
901
+ # define VOIDFUNC(f) ((void (*)()) f)
902
+ # else
903
+ # ifndef ANYARGS /* These definitions should work for Ruby 1.6 */
904
+ # define PROTECTFUNC(f) ((VALUE (*)()) f)
905
+ # define VALUEFUNC(f) ((VALUE (*)()) f)
906
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
907
+ # else /* These definitions should work for Ruby 1.7+ */
908
+ # define PROTECTFUNC(f) ((VALUE (*)(VALUE)) f)
909
+ # define VALUEFUNC(f) ((VALUE (*)(ANYARGS)) f)
910
+ # define VOIDFUNC(f) ((RUBY_DATA_FUNC) f)
911
+ # endif
912
+ # endif
913
+ #else
914
+ # define VALUEFUNC(f) (f)
915
+ # define VOIDFUNC(f) (f)
916
+ #endif
917
+
918
+ /* Don't use for expressions have side effect */
919
+ #ifndef RB_STRING_VALUE
920
+ #define RB_STRING_VALUE(s) (TYPE(s) == T_STRING ? (s) : (*(volatile VALUE *)&(s) = rb_str_to_str(s)))
921
+ #endif
922
+ #ifndef StringValue
923
+ #define StringValue(s) RB_STRING_VALUE(s)
924
+ #endif
925
+ #ifndef StringValuePtr
926
+ #define StringValuePtr(s) RSTRING_PTR(RB_STRING_VALUE(s))
927
+ #endif
928
+ #ifndef StringValueLen
929
+ #define StringValueLen(s) RSTRING_LEN(RB_STRING_VALUE(s))
930
+ #endif
931
+ #ifndef SafeStringValue
932
+ #define SafeStringValue(v) do {\
933
+ StringValue(v);\
934
+ rb_check_safe_str(v);\
935
+ } while (0)
936
+ #endif
937
+
938
+ #ifndef HAVE_RB_DEFINE_ALLOC_FUNC
939
+ #define rb_define_alloc_func(klass, func) rb_define_singleton_method((klass), "new", VALUEFUNC((func)), -1)
940
+ #define rb_undef_alloc_func(klass) rb_undef_method(CLASS_OF((klass)), "new")
941
+ #endif
942
+
943
+ static VALUE _mSWIG = Qnil;
944
+
945
+ /* -----------------------------------------------------------------------------
946
+ * error manipulation
947
+ * ----------------------------------------------------------------------------- */
948
+
949
+
950
+ /* Define some additional error types */
951
+ #define SWIG_ObjectPreviouslyDeletedError -100
952
+
953
+
954
+ /* Define custom exceptions for errors that do not map to existing Ruby
955
+ exceptions. Note this only works for C++ since a global cannot be
956
+ initialized by a funtion in C. For C, fallback to rb_eRuntimeError.*/
957
+
958
+ SWIGINTERN VALUE
959
+ getNullReferenceError(void) {
960
+ static int init = 0;
961
+ static VALUE rb_eNullReferenceError ;
962
+ if (!init) {
963
+ init = 1;
964
+ rb_eNullReferenceError = rb_define_class("NullReferenceError", rb_eRuntimeError);
965
+ }
966
+ return rb_eNullReferenceError;
967
+ }
968
+
969
+ SWIGINTERN VALUE
970
+ getObjectPreviouslyDeletedError(void) {
971
+ static int init = 0;
972
+ static VALUE rb_eObjectPreviouslyDeleted ;
973
+ if (!init) {
974
+ init = 1;
975
+ rb_eObjectPreviouslyDeleted = rb_define_class("ObjectPreviouslyDeleted", rb_eRuntimeError);
976
+ }
977
+ return rb_eObjectPreviouslyDeleted;
978
+ }
979
+
980
+
981
+ SWIGINTERN VALUE
982
+ SWIG_Ruby_ErrorType(int SWIG_code) {
983
+ VALUE type;
984
+ switch (SWIG_code) {
985
+ case SWIG_MemoryError:
986
+ type = rb_eNoMemError;
987
+ break;
988
+ case SWIG_IOError:
989
+ type = rb_eIOError;
990
+ break;
991
+ case SWIG_RuntimeError:
992
+ type = rb_eRuntimeError;
993
+ break;
994
+ case SWIG_IndexError:
995
+ type = rb_eIndexError;
996
+ break;
997
+ case SWIG_TypeError:
998
+ type = rb_eTypeError;
999
+ break;
1000
+ case SWIG_DivisionByZero:
1001
+ type = rb_eZeroDivError;
1002
+ break;
1003
+ case SWIG_OverflowError:
1004
+ type = rb_eRangeError;
1005
+ break;
1006
+ case SWIG_SyntaxError:
1007
+ type = rb_eSyntaxError;
1008
+ break;
1009
+ case SWIG_ValueError:
1010
+ type = rb_eArgError;
1011
+ break;
1012
+ case SWIG_SystemError:
1013
+ type = rb_eFatal;
1014
+ break;
1015
+ case SWIG_AttributeError:
1016
+ type = rb_eRuntimeError;
1017
+ break;
1018
+ case SWIG_NullReferenceError:
1019
+ type = getNullReferenceError();
1020
+ break;
1021
+ case SWIG_ObjectPreviouslyDeletedError:
1022
+ type = getObjectPreviouslyDeletedError();
1023
+ break;
1024
+ case SWIG_UnknownError:
1025
+ type = rb_eRuntimeError;
1026
+ break;
1027
+ default:
1028
+ type = rb_eRuntimeError;
1029
+ }
1030
+ return type;
1031
+ }
1032
+
1033
+
1034
+ /* This function is called when a user inputs a wrong argument to
1035
+ a method.
1036
+ */
1037
+ SWIGINTERN
1038
+ const char* Ruby_Format_TypeError( const char* msg,
1039
+ const char* type,
1040
+ const char* name,
1041
+ const int argn,
1042
+ VALUE input )
1043
+ {
1044
+ char buf[128];
1045
+ VALUE str;
1046
+ VALUE asStr;
1047
+ if ( msg && *msg )
1048
+ {
1049
+ str = rb_str_new2(msg);
1050
+ }
1051
+ else
1052
+ {
1053
+ str = rb_str_new(NULL, 0);
1054
+ }
1055
+
1056
+ str = rb_str_cat2( str, "Expected argument " );
1057
+ sprintf( buf, "%d of type ", argn-1 );
1058
+ str = rb_str_cat2( str, buf );
1059
+ str = rb_str_cat2( str, type );
1060
+ str = rb_str_cat2( str, ", but got " );
1061
+ str = rb_str_cat2( str, rb_obj_classname(input) );
1062
+ str = rb_str_cat2( str, " " );
1063
+ asStr = rb_inspect(input);
1064
+ if ( RSTRING_LEN(asStr) > 30 )
1065
+ {
1066
+ str = rb_str_cat( str, StringValuePtr(asStr), 30 );
1067
+ str = rb_str_cat2( str, "..." );
1068
+ }
1069
+ else
1070
+ {
1071
+ str = rb_str_append( str, asStr );
1072
+ }
1073
+
1074
+ if ( name )
1075
+ {
1076
+ str = rb_str_cat2( str, "\n\tin SWIG method '" );
1077
+ str = rb_str_cat2( str, name );
1078
+ str = rb_str_cat2( str, "'" );
1079
+ }
1080
+
1081
+ return StringValuePtr( str );
1082
+ }
1083
+
1084
+ /* This function is called when an overloaded method fails */
1085
+ SWIGINTERN
1086
+ void Ruby_Format_OverloadedError(
1087
+ const int argc,
1088
+ const int maxargs,
1089
+ const char* method,
1090
+ const char* prototypes
1091
+ )
1092
+ {
1093
+ const char* msg = "Wrong # of arguments";
1094
+ if ( argc <= maxargs ) msg = "Wrong arguments";
1095
+ rb_raise(rb_eArgError,"%s for overloaded method '%s'.\n"
1096
+ "Possible C/C++ prototypes are:\n%s",
1097
+ msg, method, prototypes);
1098
+ }
1099
+
1100
+ /* -----------------------------------------------------------------------------
1101
+ * See the LICENSE file for information on copyright, usage and redistribution
1102
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1103
+ *
1104
+ * rubytracking.swg
1105
+ *
1106
+ * This file contains support for tracking mappings from
1107
+ * Ruby objects to C++ objects. This functionality is needed
1108
+ * to implement mark functions for Ruby's mark and sweep
1109
+ * garbage collector.
1110
+ * ----------------------------------------------------------------------------- */
1111
+
1112
+ #ifdef __cplusplus
1113
+ extern "C" {
1114
+ #endif
1115
+
1116
+ /* Ruby 1.8 actually assumes the first case. */
1117
+ #if SIZEOF_VOIDP == SIZEOF_LONG
1118
+ # define SWIG2NUM(v) LONG2NUM((unsigned long)v)
1119
+ # define NUM2SWIG(x) (unsigned long)NUM2LONG(x)
1120
+ #elif SIZEOF_VOIDP == SIZEOF_LONG_LONG
1121
+ # define SWIG2NUM(v) LL2NUM((unsigned long long)v)
1122
+ # define NUM2SWIG(x) (unsigned long long)NUM2LL(x)
1123
+ #else
1124
+ # error sizeof(void*) is not the same as long or long long
1125
+ #endif
1126
+
1127
+
1128
+ /* Global Ruby hash table to store Trackings from C/C++
1129
+ structs to Ruby Objects.
1130
+ */
1131
+ static VALUE swig_ruby_trackings = Qnil;
1132
+
1133
+ /* Global variable that stores a reference to the ruby
1134
+ hash table delete function. */
1135
+ static ID swig_ruby_hash_delete;
1136
+
1137
+ /* Setup a Ruby hash table to store Trackings */
1138
+ SWIGRUNTIME void SWIG_RubyInitializeTrackings(void) {
1139
+ /* Create a ruby hash table to store Trackings from C++
1140
+ objects to Ruby objects. */
1141
+
1142
+ /* Try to see if some other .so has already created a
1143
+ tracking hash table, which we keep hidden in an instance var
1144
+ in the SWIG module.
1145
+ This is done to allow multiple DSOs to share the same
1146
+ tracking table.
1147
+ */
1148
+ ID trackings_id = rb_intern( "@__trackings__" );
1149
+ VALUE verbose = rb_gv_get("VERBOSE");
1150
+ rb_gv_set("VERBOSE", Qfalse);
1151
+ swig_ruby_trackings = rb_ivar_get( _mSWIG, trackings_id );
1152
+ rb_gv_set("VERBOSE", verbose);
1153
+
1154
+ /* No, it hasn't. Create one ourselves */
1155
+ if ( swig_ruby_trackings == Qnil )
1156
+ {
1157
+ swig_ruby_trackings = rb_hash_new();
1158
+ rb_ivar_set( _mSWIG, trackings_id, swig_ruby_trackings );
1159
+ }
1160
+
1161
+ /* Now store a reference to the hash table delete function
1162
+ so that we only have to look it up once.*/
1163
+ swig_ruby_hash_delete = rb_intern("delete");
1164
+ }
1165
+
1166
+ /* Get a Ruby number to reference a pointer */
1167
+ SWIGRUNTIME VALUE SWIG_RubyPtrToReference(void* ptr) {
1168
+ /* We cast the pointer to an unsigned long
1169
+ and then store a reference to it using
1170
+ a Ruby number object. */
1171
+
1172
+ /* Convert the pointer to a Ruby number */
1173
+ return SWIG2NUM(ptr);
1174
+ }
1175
+
1176
+ /* Get a Ruby number to reference an object */
1177
+ SWIGRUNTIME VALUE SWIG_RubyObjectToReference(VALUE object) {
1178
+ /* We cast the object to an unsigned long
1179
+ and then store a reference to it using
1180
+ a Ruby number object. */
1181
+
1182
+ /* Convert the Object to a Ruby number */
1183
+ return SWIG2NUM(object);
1184
+ }
1185
+
1186
+ /* Get a Ruby object from a previously stored reference */
1187
+ SWIGRUNTIME VALUE SWIG_RubyReferenceToObject(VALUE reference) {
1188
+ /* The provided Ruby number object is a reference
1189
+ to the Ruby object we want.*/
1190
+
1191
+ /* Convert the Ruby number to a Ruby object */
1192
+ return NUM2SWIG(reference);
1193
+ }
1194
+
1195
+ /* Add a Tracking from a C/C++ struct to a Ruby object */
1196
+ SWIGRUNTIME void SWIG_RubyAddTracking(void* ptr, VALUE object) {
1197
+ /* In a Ruby hash table we store the pointer and
1198
+ the associated Ruby object. The trick here is
1199
+ that we cannot store the Ruby object directly - if
1200
+ we do then it cannot be garbage collected. So
1201
+ instead we typecast it as a unsigned long and
1202
+ convert it to a Ruby number object.*/
1203
+
1204
+ /* Get a reference to the pointer as a Ruby number */
1205
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1206
+
1207
+ /* Get a reference to the Ruby object as a Ruby number */
1208
+ VALUE value = SWIG_RubyObjectToReference(object);
1209
+
1210
+ /* Store the mapping to the global hash table. */
1211
+ rb_hash_aset(swig_ruby_trackings, key, value);
1212
+ }
1213
+
1214
+ /* Get the Ruby object that owns the specified C/C++ struct */
1215
+ SWIGRUNTIME VALUE SWIG_RubyInstanceFor(void* ptr) {
1216
+ /* Get a reference to the pointer as a Ruby number */
1217
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1218
+
1219
+ /* Now lookup the value stored in the global hash table */
1220
+ VALUE value = rb_hash_aref(swig_ruby_trackings, key);
1221
+
1222
+ if (value == Qnil) {
1223
+ /* No object exists - return nil. */
1224
+ return Qnil;
1225
+ }
1226
+ else {
1227
+ /* Convert this value to Ruby object */
1228
+ return SWIG_RubyReferenceToObject(value);
1229
+ }
1230
+ }
1231
+
1232
+ /* Remove a Tracking from a C/C++ struct to a Ruby object. It
1233
+ is very important to remove objects once they are destroyed
1234
+ since the same memory address may be reused later to create
1235
+ a new object. */
1236
+ SWIGRUNTIME void SWIG_RubyRemoveTracking(void* ptr) {
1237
+ /* Get a reference to the pointer as a Ruby number */
1238
+ VALUE key = SWIG_RubyPtrToReference(ptr);
1239
+
1240
+ /* Delete the object from the hash table by calling Ruby's
1241
+ do this we need to call the Hash.delete method.*/
1242
+ rb_funcall(swig_ruby_trackings, swig_ruby_hash_delete, 1, key);
1243
+ }
1244
+
1245
+ /* This is a helper method that unlinks a Ruby object from its
1246
+ underlying C++ object. This is needed if the lifetime of the
1247
+ Ruby object is longer than the C++ object */
1248
+ SWIGRUNTIME void SWIG_RubyUnlinkObjects(void* ptr) {
1249
+ VALUE object = SWIG_RubyInstanceFor(ptr);
1250
+
1251
+ if (object != Qnil) {
1252
+ DATA_PTR(object) = 0;
1253
+ }
1254
+ }
1255
+
1256
+
1257
+ #ifdef __cplusplus
1258
+ }
1259
+ #endif
1260
+
1261
+ /* -----------------------------------------------------------------------------
1262
+ * Ruby API portion that goes into the runtime
1263
+ * ----------------------------------------------------------------------------- */
1264
+
1265
+ #ifdef __cplusplus
1266
+ extern "C" {
1267
+ #endif
1268
+
1269
+ SWIGINTERN VALUE
1270
+ SWIG_Ruby_AppendOutput(VALUE target, VALUE o) {
1271
+ if (NIL_P(target)) {
1272
+ target = o;
1273
+ } else {
1274
+ if (TYPE(target) != T_ARRAY) {
1275
+ VALUE o2 = target;
1276
+ target = rb_ary_new();
1277
+ rb_ary_push(target, o2);
1278
+ }
1279
+ rb_ary_push(target, o);
1280
+ }
1281
+ return target;
1282
+ }
1283
+
1284
+ /* For ruby1.8.4 and earlier. */
1285
+ #ifndef RUBY_INIT_STACK
1286
+ RUBY_EXTERN void Init_stack(VALUE* addr);
1287
+ # define RUBY_INIT_STACK \
1288
+ VALUE variable_in_this_stack_frame; \
1289
+ Init_stack(&variable_in_this_stack_frame);
1290
+ #endif
1291
+
1292
+
1293
+ #ifdef __cplusplus
1294
+ }
1295
+ #endif
1296
+
1297
+
1298
+ /* -----------------------------------------------------------------------------
1299
+ * See the LICENSE file for information on copyright, usage and redistribution
1300
+ * of SWIG, and the README file for authors - http://www.swig.org/release.html.
1301
+ *
1302
+ * rubyrun.swg
1303
+ *
1304
+ * This file contains the runtime support for Ruby modules
1305
+ * and includes code for managing global variables and pointer
1306
+ * type checking.
1307
+ * ----------------------------------------------------------------------------- */
1308
+
1309
+ /* For backward compatibility only */
1310
+ #define SWIG_POINTER_EXCEPTION 0
1311
+
1312
+ /* for raw pointers */
1313
+ #define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
1314
+ #define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Ruby_ConvertPtrAndOwn(obj, pptr, type, flags, own)
1315
+ #define SWIG_NewPointerObj(ptr, type, flags) SWIG_Ruby_NewPointerObj(ptr, type, flags)
1316
+ #define SWIG_AcquirePtr(ptr, own) SWIG_Ruby_AcquirePtr(ptr, own)
1317
+ #define swig_owntype ruby_owntype
1318
+
1319
+ /* for raw packed data */
1320
+ #define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty, flags)
1321
+ #define SWIG_NewPackedObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1322
+
1323
+ /* for class or struct pointers */
1324
+ #define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
1325
+ #define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
1326
+
1327
+ /* for C or C++ function pointers */
1328
+ #define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_ConvertPtr(obj, pptr, type, 0)
1329
+ #define SWIG_NewFunctionPtrObj(ptr, type) SWIG_NewPointerObj(ptr, type, 0)
1330
+
1331
+ /* for C++ member pointers, ie, member methods */
1332
+ #define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Ruby_ConvertPacked(obj, ptr, sz, ty)
1333
+ #define SWIG_NewMemberObj(ptr, sz, type) SWIG_Ruby_NewPackedObj(ptr, sz, type)
1334
+
1335
+
1336
+ /* Runtime API */
1337
+
1338
+ #define SWIG_GetModule(clientdata) SWIG_Ruby_GetModule()
1339
+ #define SWIG_SetModule(clientdata, pointer) SWIG_Ruby_SetModule(pointer)
1340
+
1341
+
1342
+ /* Error manipulation */
1343
+
1344
+ #define SWIG_ErrorType(code) SWIG_Ruby_ErrorType(code)
1345
+ #define SWIG_Error(code, msg) rb_raise(SWIG_Ruby_ErrorType(code), msg)
1346
+ #define SWIG_fail goto fail
1347
+
1348
+
1349
+ /* Ruby-specific SWIG API */
1350
+
1351
+ #define SWIG_InitRuntime() SWIG_Ruby_InitRuntime()
1352
+ #define SWIG_define_class(ty) SWIG_Ruby_define_class(ty)
1353
+ #define SWIG_NewClassInstance(value, ty) SWIG_Ruby_NewClassInstance(value, ty)
1354
+ #define SWIG_MangleStr(value) SWIG_Ruby_MangleStr(value)
1355
+ #define SWIG_CheckConvert(value, ty) SWIG_Ruby_CheckConvert(value, ty)
1356
+
1357
+ #include "assert.h"
1358
+
1359
+ /* -----------------------------------------------------------------------------
1360
+ * pointers/data manipulation
1361
+ * ----------------------------------------------------------------------------- */
1362
+
1363
+ #ifdef __cplusplus
1364
+ extern "C" {
1365
+ #endif
1366
+
1367
+ typedef struct {
1368
+ VALUE klass;
1369
+ VALUE mImpl;
1370
+ void (*mark)(void *);
1371
+ void (*destroy)(void *);
1372
+ int trackObjects;
1373
+ } swig_class;
1374
+
1375
+
1376
+ /* Global pointer used to keep some internal SWIG stuff */
1377
+ static VALUE _cSWIG_Pointer = Qnil;
1378
+ static VALUE swig_runtime_data_type_pointer = Qnil;
1379
+
1380
+ /* Global IDs used to keep some internal SWIG stuff */
1381
+ static ID swig_arity_id = 0;
1382
+ static ID swig_call_id = 0;
1383
+
1384
+ /*
1385
+ If your swig extension is to be run within an embedded ruby and has
1386
+ director callbacks, you should set -DRUBY_EMBEDDED during compilation.
1387
+ This will reset ruby's stack frame on each entry point from the main
1388
+ program the first time a virtual director function is invoked (in a
1389
+ non-recursive way).
1390
+ If this is not done, you run the risk of Ruby trashing the stack.
1391
+ */
1392
+
1393
+ #ifdef RUBY_EMBEDDED
1394
+
1395
+ # define SWIG_INIT_STACK \
1396
+ if ( !swig_virtual_calls ) { RUBY_INIT_STACK } \
1397
+ ++swig_virtual_calls;
1398
+ # define SWIG_RELEASE_STACK --swig_virtual_calls;
1399
+ # define Ruby_DirectorTypeMismatchException(x) \
1400
+ rb_raise( rb_eTypeError, x ); return c_result;
1401
+
1402
+ static unsigned int swig_virtual_calls = 0;
1403
+
1404
+ #else /* normal non-embedded extension */
1405
+
1406
+ # define SWIG_INIT_STACK
1407
+ # define SWIG_RELEASE_STACK
1408
+ # define Ruby_DirectorTypeMismatchException(x) \
1409
+ throw Swig::DirectorTypeMismatchException( x );
1410
+
1411
+ #endif /* RUBY_EMBEDDED */
1412
+
1413
+
1414
+ SWIGRUNTIME VALUE
1415
+ getExceptionClass(void) {
1416
+ static int init = 0;
1417
+ static VALUE rubyExceptionClass ;
1418
+ if (!init) {
1419
+ init = 1;
1420
+ rubyExceptionClass = rb_const_get(_mSWIG, rb_intern("Exception"));
1421
+ }
1422
+ return rubyExceptionClass;
1423
+ }
1424
+
1425
+ /* This code checks to see if the Ruby object being raised as part
1426
+ of an exception inherits from the Ruby class Exception. If so,
1427
+ the object is simply returned. If not, then a new Ruby exception
1428
+ object is created and that will be returned to Ruby.*/
1429
+ SWIGRUNTIME VALUE
1430
+ SWIG_Ruby_ExceptionType(swig_type_info *desc, VALUE obj) {
1431
+ VALUE exceptionClass = getExceptionClass();
1432
+ if (rb_obj_is_kind_of(obj, exceptionClass)) {
1433
+ return obj;
1434
+ } else {
1435
+ return rb_exc_new3(rb_eRuntimeError, rb_obj_as_string(obj));
1436
+ }
1437
+ }
1438
+
1439
+ /* Initialize Ruby runtime support */
1440
+ SWIGRUNTIME void
1441
+ SWIG_Ruby_InitRuntime(void)
1442
+ {
1443
+ if (_mSWIG == Qnil) {
1444
+ _mSWIG = rb_define_module("SWIG");
1445
+ swig_call_id = rb_intern("call");
1446
+ swig_arity_id = rb_intern("arity");
1447
+ }
1448
+ }
1449
+
1450
+ /* Define Ruby class for C type */
1451
+ SWIGRUNTIME void
1452
+ SWIG_Ruby_define_class(swig_type_info *type)
1453
+ {
1454
+ VALUE klass;
1455
+ char *klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1456
+ sprintf(klass_name, "TYPE%s", type->name);
1457
+ if (NIL_P(_cSWIG_Pointer)) {
1458
+ _cSWIG_Pointer = rb_define_class_under(_mSWIG, "Pointer", rb_cObject);
1459
+ rb_undef_method(CLASS_OF(_cSWIG_Pointer), "new");
1460
+ }
1461
+ klass = rb_define_class_under(_mSWIG, klass_name, _cSWIG_Pointer);
1462
+ free((void *) klass_name);
1463
+ }
1464
+
1465
+ /* Create a new pointer object */
1466
+ SWIGRUNTIME VALUE
1467
+ SWIG_Ruby_NewPointerObj(void *ptr, swig_type_info *type, int flags)
1468
+ {
1469
+ int own = flags & SWIG_POINTER_OWN;
1470
+ int track;
1471
+ char *klass_name;
1472
+ swig_class *sklass;
1473
+ VALUE klass;
1474
+ VALUE obj;
1475
+
1476
+ if (!ptr)
1477
+ return Qnil;
1478
+
1479
+ if (type->clientdata) {
1480
+ sklass = (swig_class *) type->clientdata;
1481
+
1482
+ /* Are we tracking this class and have we already returned this Ruby object? */
1483
+ track = sklass->trackObjects;
1484
+ if (track) {
1485
+ obj = SWIG_RubyInstanceFor(ptr);
1486
+
1487
+ /* Check the object's type and make sure it has the correct type.
1488
+ It might not in cases where methods do things like
1489
+ downcast methods. */
1490
+ if (obj != Qnil) {
1491
+ VALUE value = rb_iv_get(obj, "@__swigtype__");
1492
+ char* type_name = RSTRING_PTR(value);
1493
+
1494
+ if (strcmp(type->name, type_name) == 0) {
1495
+ return obj;
1496
+ }
1497
+ }
1498
+ }
1499
+
1500
+ /* Create a new Ruby object */
1501
+ obj = Data_Wrap_Struct(sklass->klass, VOIDFUNC(sklass->mark),
1502
+ ( own ? VOIDFUNC(sklass->destroy) :
1503
+ (track ? VOIDFUNC(SWIG_RubyRemoveTracking) : 0 )
1504
+ ), ptr);
1505
+
1506
+ /* If tracking is on for this class then track this object. */
1507
+ if (track) {
1508
+ SWIG_RubyAddTracking(ptr, obj);
1509
+ }
1510
+ } else {
1511
+ klass_name = (char *) malloc(4 + strlen(type->name) + 1);
1512
+ sprintf(klass_name, "TYPE%s", type->name);
1513
+ klass = rb_const_get(_mSWIG, rb_intern(klass_name));
1514
+ free((void *) klass_name);
1515
+ obj = Data_Wrap_Struct(klass, 0, 0, ptr);
1516
+ }
1517
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1518
+
1519
+ return obj;
1520
+ }
1521
+
1522
+ /* Create a new class instance (always owned) */
1523
+ SWIGRUNTIME VALUE
1524
+ SWIG_Ruby_NewClassInstance(VALUE klass, swig_type_info *type)
1525
+ {
1526
+ VALUE obj;
1527
+ swig_class *sklass = (swig_class *) type->clientdata;
1528
+ obj = Data_Wrap_Struct(klass, VOIDFUNC(sklass->mark), VOIDFUNC(sklass->destroy), 0);
1529
+ rb_iv_set(obj, "@__swigtype__", rb_str_new2(type->name));
1530
+ return obj;
1531
+ }
1532
+
1533
+ /* Get type mangle from class name */
1534
+ SWIGRUNTIMEINLINE char *
1535
+ SWIG_Ruby_MangleStr(VALUE obj)
1536
+ {
1537
+ VALUE stype = rb_iv_get(obj, "@__swigtype__");
1538
+ return StringValuePtr(stype);
1539
+ }
1540
+
1541
+ /* Acquire a pointer value */
1542
+ typedef void (*ruby_owntype)(void*);
1543
+
1544
+ SWIGRUNTIME ruby_owntype
1545
+ SWIG_Ruby_AcquirePtr(VALUE obj, ruby_owntype own) {
1546
+ if (obj) {
1547
+ ruby_owntype oldown = RDATA(obj)->dfree;
1548
+ RDATA(obj)->dfree = own;
1549
+ return oldown;
1550
+ } else {
1551
+ return 0;
1552
+ }
1553
+ }
1554
+
1555
+ /* Convert a pointer value */
1556
+ SWIGRUNTIME int
1557
+ SWIG_Ruby_ConvertPtrAndOwn(VALUE obj, void **ptr, swig_type_info *ty, int flags, ruby_owntype *own)
1558
+ {
1559
+ char *c;
1560
+ swig_cast_info *tc;
1561
+ void *vptr = 0;
1562
+
1563
+ /* Grab the pointer */
1564
+ if (NIL_P(obj)) {
1565
+ *ptr = 0;
1566
+ return SWIG_OK;
1567
+ } else {
1568
+ if (TYPE(obj) != T_DATA) {
1569
+ return SWIG_ERROR;
1570
+ }
1571
+ Data_Get_Struct(obj, void, vptr);
1572
+ }
1573
+
1574
+ if (own) *own = RDATA(obj)->dfree;
1575
+
1576
+ /* Check to see if the input object is giving up ownership
1577
+ of the underlying C struct or C++ object. If so then we
1578
+ need to reset the destructor since the Ruby object no
1579
+ longer owns the underlying C++ object.*/
1580
+ if (flags & SWIG_POINTER_DISOWN) {
1581
+ /* Is tracking on for this class? */
1582
+ int track = 0;
1583
+ if (ty && ty->clientdata) {
1584
+ swig_class *sklass = (swig_class *) ty->clientdata;
1585
+ track = sklass->trackObjects;
1586
+ }
1587
+
1588
+ if (track) {
1589
+ /* We are tracking objects for this class. Thus we change the destructor
1590
+ * to SWIG_RubyRemoveTracking. This allows us to
1591
+ * remove the mapping from the C++ to Ruby object
1592
+ * when the Ruby object is garbage collected. If we don't
1593
+ * do this, then it is possible we will return a reference
1594
+ * to a Ruby object that no longer exists thereby crashing Ruby. */
1595
+ RDATA(obj)->dfree = SWIG_RubyRemoveTracking;
1596
+ } else {
1597
+ RDATA(obj)->dfree = 0;
1598
+ }
1599
+ }
1600
+
1601
+ /* Do type-checking if type info was provided */
1602
+ if (ty) {
1603
+ if (ty->clientdata) {
1604
+ if (rb_obj_is_kind_of(obj, ((swig_class *) (ty->clientdata))->klass)) {
1605
+ if (vptr == 0) {
1606
+ /* The object has already been deleted */
1607
+ return SWIG_ObjectPreviouslyDeletedError;
1608
+ }
1609
+ *ptr = vptr;
1610
+ return SWIG_OK;
1611
+ }
1612
+ }
1613
+ if ((c = SWIG_MangleStr(obj)) == NULL) {
1614
+ return SWIG_ERROR;
1615
+ }
1616
+ tc = SWIG_TypeCheck(c, ty);
1617
+ if (!tc) {
1618
+ return SWIG_ERROR;
1619
+ } else {
1620
+ int newmemory = 0;
1621
+ *ptr = SWIG_TypeCast(tc, vptr, &newmemory);
1622
+ assert(!newmemory); /* newmemory handling not yet implemented */
1623
+ }
1624
+ } else {
1625
+ *ptr = vptr;
1626
+ }
1627
+
1628
+ return SWIG_OK;
1629
+ }
1630
+
1631
+ /* Check convert */
1632
+ SWIGRUNTIMEINLINE int
1633
+ SWIG_Ruby_CheckConvert(VALUE obj, swig_type_info *ty)
1634
+ {
1635
+ char *c = SWIG_MangleStr(obj);
1636
+ if (!c) return 0;
1637
+ return SWIG_TypeCheck(c,ty) != 0;
1638
+ }
1639
+
1640
+ SWIGRUNTIME VALUE
1641
+ SWIG_Ruby_NewPackedObj(void *ptr, int sz, swig_type_info *type) {
1642
+ char result[1024];
1643
+ char *r = result;
1644
+ if ((2*sz + 1 + strlen(type->name)) > 1000) return 0;
1645
+ *(r++) = '_';
1646
+ r = SWIG_PackData(r, ptr, sz);
1647
+ strcpy(r, type->name);
1648
+ return rb_str_new2(result);
1649
+ }
1650
+
1651
+ /* Convert a packed value value */
1652
+ SWIGRUNTIME int
1653
+ SWIG_Ruby_ConvertPacked(VALUE obj, void *ptr, int sz, swig_type_info *ty) {
1654
+ swig_cast_info *tc;
1655
+ const char *c;
1656
+
1657
+ if (TYPE(obj) != T_STRING) goto type_error;
1658
+ c = StringValuePtr(obj);
1659
+ /* Pointer values must start with leading underscore */
1660
+ if (*c != '_') goto type_error;
1661
+ c++;
1662
+ c = SWIG_UnpackData(c, ptr, sz);
1663
+ if (ty) {
1664
+ tc = SWIG_TypeCheck(c, ty);
1665
+ if (!tc) goto type_error;
1666
+ }
1667
+ return SWIG_OK;
1668
+
1669
+ type_error:
1670
+ return SWIG_ERROR;
1671
+ }
1672
+
1673
+ SWIGRUNTIME swig_module_info *
1674
+ SWIG_Ruby_GetModule(void)
1675
+ {
1676
+ VALUE pointer;
1677
+ swig_module_info *ret = 0;
1678
+ VALUE verbose = rb_gv_get("VERBOSE");
1679
+
1680
+ /* temporarily disable warnings, since the pointer check causes warnings with 'ruby -w' */
1681
+ rb_gv_set("VERBOSE", Qfalse);
1682
+
1683
+ /* first check if pointer already created */
1684
+ pointer = rb_gv_get("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME);
1685
+ if (pointer != Qnil) {
1686
+ Data_Get_Struct(pointer, swig_module_info, ret);
1687
+ }
1688
+
1689
+ /* reinstate warnings */
1690
+ rb_gv_set("VERBOSE", verbose);
1691
+ return ret;
1692
+ }
1693
+
1694
+ SWIGRUNTIME void
1695
+ SWIG_Ruby_SetModule(swig_module_info *pointer)
1696
+ {
1697
+ /* register a new class */
1698
+ VALUE cl = rb_define_class("swig_runtime_data", rb_cObject);
1699
+ /* create and store the structure pointer to a global variable */
1700
+ swig_runtime_data_type_pointer = Data_Wrap_Struct(cl, 0, 0, pointer);
1701
+ rb_define_readonly_variable("$swig_runtime_data_type_pointer" SWIG_RUNTIME_VERSION SWIG_TYPE_TABLE_NAME, &swig_runtime_data_type_pointer);
1702
+ }
1703
+
1704
+ /* This function can be used to check whether a proc or method or similarly
1705
+ callable function has been passed. Usually used in a %typecheck, like:
1706
+
1707
+ %typecheck(c_callback_t, precedence=SWIG_TYPECHECK_POINTER) {
1708
+ $result = SWIG_Ruby_isCallable( $input );
1709
+ }
1710
+ */
1711
+ SWIGINTERN
1712
+ int SWIG_Ruby_isCallable( VALUE proc )
1713
+ {
1714
+ if ( rb_respond_to( proc, swig_call_id ) == Qtrue )
1715
+ return 1;
1716
+ return 0;
1717
+ }
1718
+
1719
+ /* This function can be used to check the arity (number of arguments)
1720
+ a proc or method can take. Usually used in a %typecheck.
1721
+ Valid arities will be that equal to minimal or those < 0
1722
+ which indicate a variable number of parameters at the end.
1723
+ */
1724
+ SWIGINTERN
1725
+ int SWIG_Ruby_arity( VALUE proc, int minimal )
1726
+ {
1727
+ if ( rb_respond_to( proc, swig_arity_id ) == Qtrue )
1728
+ {
1729
+ VALUE num = rb_funcall( proc, swig_arity_id, 0 );
1730
+ int arity = NUM2INT(num);
1731
+ if ( arity < 0 && (arity+1) < -minimal ) return 1;
1732
+ if ( arity == minimal ) return 1;
1733
+ return 1;
1734
+ }
1735
+ return 0;
1736
+ }
1737
+
1738
+
1739
+ #ifdef __cplusplus
1740
+ }
1741
+ #endif
1742
+
1743
+
1744
+
1745
+ #define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
1746
+
1747
+ #define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
1748
+
1749
+
1750
+
1751
+ /* -------- TYPES TABLE (BEGIN) -------- */
1752
+
1753
+ #define SWIGTYPE_p_char swig_types[0]
1754
+ static swig_type_info *swig_types[2];
1755
+ static swig_module_info swig_module = {swig_types, 1, 0, 0, 0, 0};
1756
+ #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
1757
+ #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
1758
+
1759
+ /* -------- TYPES TABLE (END) -------- */
1760
+
1761
+ #define SWIG_init Init_spamsum_swig
1762
+ #define SWIG_name "Spamsum_swig"
1763
+
1764
+ static VALUE mSpamsum_swig;
1765
+
1766
+ #define SWIG_RUBY_THREAD_BEGIN_BLOCK
1767
+ #define SWIG_RUBY_THREAD_END_BLOCK
1768
+
1769
+
1770
+ #define SWIGVERSION 0x010335
1771
+ #define SWIG_VERSION SWIGVERSION
1772
+
1773
+
1774
+ #define SWIG_as_voidptr(a) (void *)((const void *)(a))
1775
+ #define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a))
1776
+
1777
+
1778
+ #ifdef __cplusplus
1779
+ extern "C" {
1780
+ #endif
1781
+ #include "rubyio.h"
1782
+ #ifdef __cplusplus
1783
+ }
1784
+ #endif
1785
+
1786
+
1787
+ #ifdef __cplusplus
1788
+ extern "C" {
1789
+ #endif
1790
+ #ifdef HAVE_SYS_TIME_H
1791
+ # include <sys/time.h>
1792
+ struct timeval rb_time_timeval(VALUE);
1793
+ #endif
1794
+ #ifdef __cplusplus
1795
+ }
1796
+ #endif
1797
+
1798
+
1799
+ SWIGINTERN swig_type_info*
1800
+ SWIG_pchar_descriptor(void)
1801
+ {
1802
+ static int init = 0;
1803
+ static swig_type_info* info = 0;
1804
+ if (!init) {
1805
+ info = SWIG_TypeQuery("_p_char");
1806
+ init = 1;
1807
+ }
1808
+ return info;
1809
+ }
1810
+
1811
+
1812
+ SWIGINTERN int
1813
+ SWIG_AsCharPtrAndSize(VALUE obj, char** cptr, size_t* psize, int *alloc)
1814
+ {
1815
+ if (TYPE(obj) == T_STRING) {
1816
+ #if defined(StringValuePtr)
1817
+ char *cstr = StringValuePtr(obj);
1818
+ #else
1819
+ char *cstr = STR2CSTR(obj);
1820
+ #endif
1821
+ size_t size = RSTRING_LEN(obj) + 1;
1822
+ if (cptr) {
1823
+ if (alloc) {
1824
+ if (*alloc == SWIG_NEWOBJ) {
1825
+ *cptr = (char *)memcpy((char *)malloc((size)*sizeof(char)), cstr, sizeof(char)*(size));
1826
+ } else {
1827
+ *cptr = cstr;
1828
+ *alloc = SWIG_OLDOBJ;
1829
+ }
1830
+ }
1831
+ }
1832
+ if (psize) *psize = size;
1833
+ return SWIG_OK;
1834
+ } else {
1835
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1836
+ if (pchar_descriptor) {
1837
+ void* vptr = 0;
1838
+ if (SWIG_ConvertPtr(obj, &vptr, pchar_descriptor, 0) == SWIG_OK) {
1839
+ if (cptr) *cptr = (char *)vptr;
1840
+ if (psize) *psize = vptr ? (strlen((char*)vptr) + 1) : 0;
1841
+ if (alloc) *alloc = SWIG_OLDOBJ;
1842
+ return SWIG_OK;
1843
+ }
1844
+ }
1845
+ }
1846
+ return SWIG_TypeError;
1847
+ }
1848
+
1849
+
1850
+
1851
+
1852
+
1853
+ #include <limits.h>
1854
+ #if !defined(SWIG_NO_LLONG_MAX)
1855
+ # if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__)
1856
+ # define LLONG_MAX __LONG_LONG_MAX__
1857
+ # define LLONG_MIN (-LLONG_MAX - 1LL)
1858
+ # define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
1859
+ # endif
1860
+ #endif
1861
+
1862
+
1863
+ SWIGINTERN VALUE
1864
+ SWIG_ruby_failed(void)
1865
+ {
1866
+ return Qnil;
1867
+ }
1868
+
1869
+
1870
+ /*@SWIG:/sw/share/swig/1.3.35/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
1871
+ SWIGINTERN VALUE SWIG_AUX_NUM2LONG(VALUE *args)
1872
+ {
1873
+ VALUE obj = args[0];
1874
+ VALUE type = TYPE(obj);
1875
+ long *res = (long *)(args[1]);
1876
+ *res = type == T_FIXNUM ? NUM2LONG(obj) : rb_big2long(obj);
1877
+ return obj;
1878
+ }
1879
+ /*@SWIG@*/
1880
+
1881
+ SWIGINTERN int
1882
+ SWIG_AsVal_long (VALUE obj, long* val)
1883
+ {
1884
+ VALUE type = TYPE(obj);
1885
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1886
+ long v;
1887
+ VALUE a[2];
1888
+ a[0] = obj;
1889
+ a[1] = (VALUE)(&v);
1890
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2LONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1891
+ if (val) *val = v;
1892
+ return SWIG_OK;
1893
+ }
1894
+ }
1895
+ return SWIG_TypeError;
1896
+ }
1897
+
1898
+
1899
+ SWIGINTERN int
1900
+ SWIG_AsVal_int (VALUE obj, int *val)
1901
+ {
1902
+ long v;
1903
+ int res = SWIG_AsVal_long (obj, &v);
1904
+ if (SWIG_IsOK(res)) {
1905
+ if ((v < INT_MIN || v > INT_MAX)) {
1906
+ return SWIG_OverflowError;
1907
+ } else {
1908
+ if (val) *val = (int)(v);
1909
+ }
1910
+ }
1911
+ return res;
1912
+ }
1913
+
1914
+
1915
+ #define SWIG_From_long LONG2NUM
1916
+
1917
+
1918
+ SWIGINTERNINLINE VALUE
1919
+ SWIG_From_int (int value)
1920
+ {
1921
+ return SWIG_From_long (value);
1922
+ }
1923
+
1924
+
1925
+ /*@SWIG:/sw/share/swig/1.3.35/ruby/rubyprimtypes.swg,23,%ruby_aux_method@*/
1926
+ SWIGINTERN VALUE SWIG_AUX_NUM2ULONG(VALUE *args)
1927
+ {
1928
+ VALUE obj = args[0];
1929
+ VALUE type = TYPE(obj);
1930
+ unsigned long *res = (unsigned long *)(args[1]);
1931
+ *res = type == T_FIXNUM ? NUM2ULONG(obj) : rb_big2ulong(obj);
1932
+ return obj;
1933
+ }
1934
+ /*@SWIG@*/
1935
+
1936
+ SWIGINTERN int
1937
+ SWIG_AsVal_unsigned_SS_long (VALUE obj, unsigned long *val)
1938
+ {
1939
+ VALUE type = TYPE(obj);
1940
+ if ((type == T_FIXNUM) || (type == T_BIGNUM)) {
1941
+ unsigned long v;
1942
+ VALUE a[2];
1943
+ a[0] = obj;
1944
+ a[1] = (VALUE)(&v);
1945
+ if (rb_rescue(RUBY_METHOD_FUNC(SWIG_AUX_NUM2ULONG), (VALUE)a, RUBY_METHOD_FUNC(SWIG_ruby_failed), 0) != Qnil) {
1946
+ if (val) *val = v;
1947
+ return SWIG_OK;
1948
+ }
1949
+ }
1950
+ return SWIG_TypeError;
1951
+ }
1952
+
1953
+
1954
+ SWIGINTERN int
1955
+ SWIG_AsVal_unsigned_SS_int (VALUE obj, unsigned int *val)
1956
+ {
1957
+ unsigned long v;
1958
+ int res = SWIG_AsVal_unsigned_SS_long (obj, &v);
1959
+ if (SWIG_IsOK(res)) {
1960
+ if ((v > UINT_MAX)) {
1961
+ return SWIG_OverflowError;
1962
+ } else {
1963
+ if (val) *val = (unsigned int)(v);
1964
+ }
1965
+ }
1966
+ return res;
1967
+ }
1968
+
1969
+
1970
+ SWIGINTERNINLINE VALUE
1971
+ SWIG_FromCharPtrAndSize(const char* carray, size_t size)
1972
+ {
1973
+ if (carray) {
1974
+ if (size > LONG_MAX) {
1975
+ swig_type_info* pchar_descriptor = SWIG_pchar_descriptor();
1976
+ return pchar_descriptor ?
1977
+ SWIG_NewPointerObj((char *)(carray), pchar_descriptor, 0) : Qnil;
1978
+ } else {
1979
+ return rb_str_new(carray, (long)(size));
1980
+ }
1981
+ } else {
1982
+ return Qnil;
1983
+ }
1984
+ }
1985
+
1986
+
1987
+ SWIGINTERNINLINE VALUE
1988
+ SWIG_FromCharPtr(const char *cptr)
1989
+ {
1990
+ return SWIG_FromCharPtrAndSize(cptr, (cptr ? strlen(cptr) : 0));
1991
+ }
1992
+
1993
+
1994
+ SWIGINTERNINLINE VALUE
1995
+ SWIG_From_unsigned_SS_long (unsigned long value)
1996
+ {
1997
+ return ULONG2NUM(value);
1998
+ }
1999
+
2000
+
2001
+ SWIGINTERNINLINE VALUE
2002
+ SWIG_From_unsigned_SS_int (unsigned int value)
2003
+ {
2004
+ return SWIG_From_unsigned_SS_long (value);
2005
+ }
2006
+
2007
+ SWIGINTERN VALUE
2008
+ _wrap_edit_distn(int argc, VALUE *argv, VALUE self) {
2009
+ char *arg1 = (char *) 0 ;
2010
+ int arg2 ;
2011
+ char *arg3 = (char *) 0 ;
2012
+ int arg4 ;
2013
+ int result;
2014
+ VALUE vresult = Qnil;
2015
+
2016
+ if ((argc < 2) || (argc > 2)) {
2017
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2018
+ }
2019
+ {
2020
+ arg1 = STR2CSTR(argv[0]);
2021
+ arg2 = (int) RSTRING(argv[0])->len;
2022
+ }
2023
+ {
2024
+ arg3 = STR2CSTR(argv[1]);
2025
+ arg4 = (int) RSTRING(argv[1])->len;
2026
+ }
2027
+ result = (int)edit_distn(arg1,arg2,arg3,arg4);
2028
+ vresult = SWIG_From_int((int)(result));
2029
+ return vresult;
2030
+ fail:
2031
+ return Qnil;
2032
+ }
2033
+
2034
+
2035
+ SWIGINTERN VALUE
2036
+ _wrap_spamsum(int argc, VALUE *argv, VALUE self) {
2037
+ char *arg1 = (char *) 0 ;
2038
+ unsigned int arg2 ;
2039
+ unsigned int arg3 = (unsigned int) 0 ;
2040
+ unsigned int arg4 = (unsigned int) 0 ;
2041
+ char *result = 0 ;
2042
+ int res1 ;
2043
+ char *buf1 = 0 ;
2044
+ int alloc1 = 0 ;
2045
+ unsigned int val2 ;
2046
+ int ecode2 = 0 ;
2047
+ unsigned int val3 ;
2048
+ int ecode3 = 0 ;
2049
+ unsigned int val4 ;
2050
+ int ecode4 = 0 ;
2051
+ VALUE vresult = Qnil;
2052
+
2053
+ if ((argc < 2) || (argc > 4)) {
2054
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2055
+ }
2056
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2057
+ if (!SWIG_IsOK(res1)) {
2058
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char *","spamsum", 1, argv[0] ));
2059
+ }
2060
+ arg1 = (char *)(buf1);
2061
+ ecode2 = SWIG_AsVal_unsigned_SS_int(argv[1], &val2);
2062
+ if (!SWIG_IsOK(ecode2)) {
2063
+ SWIG_exception_fail(SWIG_ArgError(ecode2), Ruby_Format_TypeError( "", "unsigned int","spamsum", 2, argv[1] ));
2064
+ }
2065
+ arg2 = (unsigned int)(val2);
2066
+ if (argc > 2) {
2067
+ ecode3 = SWIG_AsVal_unsigned_SS_int(argv[2], &val3);
2068
+ if (!SWIG_IsOK(ecode3)) {
2069
+ SWIG_exception_fail(SWIG_ArgError(ecode3), Ruby_Format_TypeError( "", "unsigned int","spamsum", 3, argv[2] ));
2070
+ }
2071
+ arg3 = (unsigned int)(val3);
2072
+ }
2073
+ if (argc > 3) {
2074
+ ecode4 = SWIG_AsVal_unsigned_SS_int(argv[3], &val4);
2075
+ if (!SWIG_IsOK(ecode4)) {
2076
+ SWIG_exception_fail(SWIG_ArgError(ecode4), Ruby_Format_TypeError( "", "unsigned int","spamsum", 4, argv[3] ));
2077
+ }
2078
+ arg4 = (unsigned int)(val4);
2079
+ }
2080
+ result = (char *)spamsum(arg1,arg2,arg3,arg4);
2081
+ vresult = SWIG_FromCharPtr((const char *)result);
2082
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2083
+ return vresult;
2084
+ fail:
2085
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2086
+ return Qnil;
2087
+ }
2088
+
2089
+
2090
+ SWIGINTERN VALUE
2091
+ _wrap_spamsum_match(int argc, VALUE *argv, VALUE self) {
2092
+ char *arg1 = (char *) 0 ;
2093
+ char *arg2 = (char *) 0 ;
2094
+ unsigned int result;
2095
+ int res1 ;
2096
+ char *buf1 = 0 ;
2097
+ int alloc1 = 0 ;
2098
+ int res2 ;
2099
+ char *buf2 = 0 ;
2100
+ int alloc2 = 0 ;
2101
+ VALUE vresult = Qnil;
2102
+
2103
+ if ((argc < 2) || (argc > 2)) {
2104
+ rb_raise(rb_eArgError, "wrong # of arguments(%d for 2)",argc); SWIG_fail;
2105
+ }
2106
+ res1 = SWIG_AsCharPtrAndSize(argv[0], &buf1, NULL, &alloc1);
2107
+ if (!SWIG_IsOK(res1)) {
2108
+ SWIG_exception_fail(SWIG_ArgError(res1), Ruby_Format_TypeError( "", "char *","spamsum_match", 1, argv[0] ));
2109
+ }
2110
+ arg1 = (char *)(buf1);
2111
+ res2 = SWIG_AsCharPtrAndSize(argv[1], &buf2, NULL, &alloc2);
2112
+ if (!SWIG_IsOK(res2)) {
2113
+ SWIG_exception_fail(SWIG_ArgError(res2), Ruby_Format_TypeError( "", "char *","spamsum_match", 2, argv[1] ));
2114
+ }
2115
+ arg2 = (char *)(buf2);
2116
+ result = (unsigned int)spamsum_match(arg1,arg2);
2117
+ vresult = SWIG_From_unsigned_SS_int((unsigned int)(result));
2118
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2119
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2120
+ return vresult;
2121
+ fail:
2122
+ if (alloc1 == SWIG_NEWOBJ) free((char*)buf1);
2123
+ if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
2124
+ return Qnil;
2125
+ }
2126
+
2127
+
2128
+
2129
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
2130
+
2131
+ static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
2132
+
2133
+ static swig_type_info *swig_type_initial[] = {
2134
+ &_swigt__p_char,
2135
+ };
2136
+
2137
+ static swig_cast_info _swigc__p_char[] = { {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
2138
+
2139
+ static swig_cast_info *swig_cast_initial[] = {
2140
+ _swigc__p_char,
2141
+ };
2142
+
2143
+
2144
+ /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
2145
+
2146
+ /* -----------------------------------------------------------------------------
2147
+ * Type initialization:
2148
+ * This problem is tough by the requirement that no dynamic
2149
+ * memory is used. Also, since swig_type_info structures store pointers to
2150
+ * swig_cast_info structures and swig_cast_info structures store pointers back
2151
+ * to swig_type_info structures, we need some lookup code at initialization.
2152
+ * The idea is that swig generates all the structures that are needed.
2153
+ * The runtime then collects these partially filled structures.
2154
+ * The SWIG_InitializeModule function takes these initial arrays out of
2155
+ * swig_module, and does all the lookup, filling in the swig_module.types
2156
+ * array with the correct data and linking the correct swig_cast_info
2157
+ * structures together.
2158
+ *
2159
+ * The generated swig_type_info structures are assigned staticly to an initial
2160
+ * array. We just loop through that array, and handle each type individually.
2161
+ * First we lookup if this type has been already loaded, and if so, use the
2162
+ * loaded structure instead of the generated one. Then we have to fill in the
2163
+ * cast linked list. The cast data is initially stored in something like a
2164
+ * two-dimensional array. Each row corresponds to a type (there are the same
2165
+ * number of rows as there are in the swig_type_initial array). Each entry in
2166
+ * a column is one of the swig_cast_info structures for that type.
2167
+ * The cast_initial array is actually an array of arrays, because each row has
2168
+ * a variable number of columns. So to actually build the cast linked list,
2169
+ * we find the array of casts associated with the type, and loop through it
2170
+ * adding the casts to the list. The one last trick we need to do is making
2171
+ * sure the type pointer in the swig_cast_info struct is correct.
2172
+ *
2173
+ * First off, we lookup the cast->type name to see if it is already loaded.
2174
+ * There are three cases to handle:
2175
+ * 1) If the cast->type has already been loaded AND the type we are adding
2176
+ * casting info to has not been loaded (it is in this module), THEN we
2177
+ * replace the cast->type pointer with the type pointer that has already
2178
+ * been loaded.
2179
+ * 2) If BOTH types (the one we are adding casting info to, and the
2180
+ * cast->type) are loaded, THEN the cast info has already been loaded by
2181
+ * the previous module so we just ignore it.
2182
+ * 3) Finally, if cast->type has not already been loaded, then we add that
2183
+ * swig_cast_info to the linked list (because the cast->type) pointer will
2184
+ * be correct.
2185
+ * ----------------------------------------------------------------------------- */
2186
+
2187
+ #ifdef __cplusplus
2188
+ extern "C" {
2189
+ #if 0
2190
+ } /* c-mode */
2191
+ #endif
2192
+ #endif
2193
+
2194
+ #if 0
2195
+ #define SWIGRUNTIME_DEBUG
2196
+ #endif
2197
+
2198
+
2199
+ SWIGRUNTIME void
2200
+ SWIG_InitializeModule(void *clientdata) {
2201
+ size_t i;
2202
+ swig_module_info *module_head, *iter;
2203
+ int found, init;
2204
+
2205
+ clientdata = clientdata;
2206
+
2207
+ /* check to see if the circular list has been setup, if not, set it up */
2208
+ if (swig_module.next==0) {
2209
+ /* Initialize the swig_module */
2210
+ swig_module.type_initial = swig_type_initial;
2211
+ swig_module.cast_initial = swig_cast_initial;
2212
+ swig_module.next = &swig_module;
2213
+ init = 1;
2214
+ } else {
2215
+ init = 0;
2216
+ }
2217
+
2218
+ /* Try and load any already created modules */
2219
+ module_head = SWIG_GetModule(clientdata);
2220
+ if (!module_head) {
2221
+ /* This is the first module loaded for this interpreter */
2222
+ /* so set the swig module into the interpreter */
2223
+ SWIG_SetModule(clientdata, &swig_module);
2224
+ module_head = &swig_module;
2225
+ } else {
2226
+ /* the interpreter has loaded a SWIG module, but has it loaded this one? */
2227
+ found=0;
2228
+ iter=module_head;
2229
+ do {
2230
+ if (iter==&swig_module) {
2231
+ found=1;
2232
+ break;
2233
+ }
2234
+ iter=iter->next;
2235
+ } while (iter!= module_head);
2236
+
2237
+ /* if the is found in the list, then all is done and we may leave */
2238
+ if (found) return;
2239
+ /* otherwise we must add out module into the list */
2240
+ swig_module.next = module_head->next;
2241
+ module_head->next = &swig_module;
2242
+ }
2243
+
2244
+ /* When multiple interpeters are used, a module could have already been initialized in
2245
+ a different interpreter, but not yet have a pointer in this interpreter.
2246
+ In this case, we do not want to continue adding types... everything should be
2247
+ set up already */
2248
+ if (init == 0) return;
2249
+
2250
+ /* Now work on filling in swig_module.types */
2251
+ #ifdef SWIGRUNTIME_DEBUG
2252
+ printf("SWIG_InitializeModule: size %d\n", swig_module.size);
2253
+ #endif
2254
+ for (i = 0; i < swig_module.size; ++i) {
2255
+ swig_type_info *type = 0;
2256
+ swig_type_info *ret;
2257
+ swig_cast_info *cast;
2258
+
2259
+ #ifdef SWIGRUNTIME_DEBUG
2260
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2261
+ #endif
2262
+
2263
+ /* if there is another module already loaded */
2264
+ if (swig_module.next != &swig_module) {
2265
+ type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
2266
+ }
2267
+ if (type) {
2268
+ /* Overwrite clientdata field */
2269
+ #ifdef SWIGRUNTIME_DEBUG
2270
+ printf("SWIG_InitializeModule: found type %s\n", type->name);
2271
+ #endif
2272
+ if (swig_module.type_initial[i]->clientdata) {
2273
+ type->clientdata = swig_module.type_initial[i]->clientdata;
2274
+ #ifdef SWIGRUNTIME_DEBUG
2275
+ printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
2276
+ #endif
2277
+ }
2278
+ } else {
2279
+ type = swig_module.type_initial[i];
2280
+ }
2281
+
2282
+ /* Insert casting types */
2283
+ cast = swig_module.cast_initial[i];
2284
+ while (cast->type) {
2285
+
2286
+ /* Don't need to add information already in the list */
2287
+ ret = 0;
2288
+ #ifdef SWIGRUNTIME_DEBUG
2289
+ printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
2290
+ #endif
2291
+ if (swig_module.next != &swig_module) {
2292
+ ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
2293
+ #ifdef SWIGRUNTIME_DEBUG
2294
+ if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
2295
+ #endif
2296
+ }
2297
+ if (ret) {
2298
+ if (type == swig_module.type_initial[i]) {
2299
+ #ifdef SWIGRUNTIME_DEBUG
2300
+ printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
2301
+ #endif
2302
+ cast->type = ret;
2303
+ ret = 0;
2304
+ } else {
2305
+ /* Check for casting already in the list */
2306
+ swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
2307
+ #ifdef SWIGRUNTIME_DEBUG
2308
+ if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
2309
+ #endif
2310
+ if (!ocast) ret = 0;
2311
+ }
2312
+ }
2313
+
2314
+ if (!ret) {
2315
+ #ifdef SWIGRUNTIME_DEBUG
2316
+ printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
2317
+ #endif
2318
+ if (type->cast) {
2319
+ type->cast->prev = cast;
2320
+ cast->next = type->cast;
2321
+ }
2322
+ type->cast = cast;
2323
+ }
2324
+ cast++;
2325
+ }
2326
+ /* Set entry in modules->types array equal to the type */
2327
+ swig_module.types[i] = type;
2328
+ }
2329
+ swig_module.types[i] = 0;
2330
+
2331
+ #ifdef SWIGRUNTIME_DEBUG
2332
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2333
+ for (i = 0; i < swig_module.size; ++i) {
2334
+ int j = 0;
2335
+ swig_cast_info *cast = swig_module.cast_initial[i];
2336
+ printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
2337
+ while (cast->type) {
2338
+ printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
2339
+ cast++;
2340
+ ++j;
2341
+ }
2342
+ printf("---- Total casts: %d\n",j);
2343
+ }
2344
+ printf("**** SWIG_InitializeModule: Cast List ******\n");
2345
+ #endif
2346
+ }
2347
+
2348
+ /* This function will propagate the clientdata field of type to
2349
+ * any new swig_type_info structures that have been added into the list
2350
+ * of equivalent types. It is like calling
2351
+ * SWIG_TypeClientData(type, clientdata) a second time.
2352
+ */
2353
+ SWIGRUNTIME void
2354
+ SWIG_PropagateClientData(void) {
2355
+ size_t i;
2356
+ swig_cast_info *equiv;
2357
+ static int init_run = 0;
2358
+
2359
+ if (init_run) return;
2360
+ init_run = 1;
2361
+
2362
+ for (i = 0; i < swig_module.size; i++) {
2363
+ if (swig_module.types[i]->clientdata) {
2364
+ equiv = swig_module.types[i]->cast;
2365
+ while (equiv) {
2366
+ if (!equiv->converter) {
2367
+ if (equiv->type && !equiv->type->clientdata)
2368
+ SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
2369
+ }
2370
+ equiv = equiv->next;
2371
+ }
2372
+ }
2373
+ }
2374
+ }
2375
+
2376
+ #ifdef __cplusplus
2377
+ #if 0
2378
+ { /* c-mode */
2379
+ #endif
2380
+ }
2381
+ #endif
2382
+
2383
+ /*
2384
+
2385
+ */
2386
+ #ifdef __cplusplus
2387
+ extern "C"
2388
+ #endif
2389
+ SWIGEXPORT void Init_spamsum_swig(void) {
2390
+ size_t i;
2391
+
2392
+ SWIG_InitRuntime();
2393
+ mSpamsum_swig = rb_define_module("Spamsum_swig");
2394
+
2395
+ SWIG_InitializeModule(0);
2396
+ for (i = 0; i < swig_module.size; i++) {
2397
+ SWIG_define_class(swig_module.types[i]);
2398
+ }
2399
+
2400
+ SWIG_RubyInitializeTrackings();
2401
+ rb_define_module_function(mSpamsum_swig, "edit_distn", _wrap_edit_distn, -1);
2402
+ rb_define_module_function(mSpamsum_swig, "spamsum", _wrap_spamsum, -1);
2403
+ rb_define_module_function(mSpamsum_swig, "spamsum_match", _wrap_spamsum_match, -1);
2404
+ }
2405
+