liblinear-ruby 0.0.1

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