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