libsvm-ruby-swig 0.4.0

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