liblinear-ruby-swig 0.2.0

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