tatara 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.circleci/config.yml +17 -1
- data/.gitignore +1 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -2
- data/Makefile +11 -73
- data/README.md +2 -1
- data/docs/tatara/float_array.md +65 -0
- data/docs/tatara/float_vector.md +64 -0
- data/docs/tatara/integer_array.md +64 -0
- data/docs/tatara/integer_vector.md +64 -0
- data/docs/tatara/string_array.md +64 -0
- data/docs/tatara/string_vector.md +64 -0
- data/ext/tatara/array/array.hpp +5 -119
- data/ext/tatara/array/float/float_array.hpp +132 -0
- data/ext/tatara/array/integer/int_array.hpp +132 -0
- data/ext/tatara/array/string/string_array.hpp +133 -0
- data/ext/tatara/extconf.rb +1 -1
- data/ext/tatara/float/float.hpp +148 -0
- data/ext/tatara/integer/integer.hpp +164 -0
- data/ext/tatara/map/float/float_float_map.hpp +66 -0
- data/ext/tatara/map/float/float_int_map.hpp +66 -0
- data/ext/tatara/map/float/float_string_map.hpp +67 -0
- data/ext/tatara/map/integer/int_float_map.hpp +66 -0
- data/ext/tatara/map/integer/int_int_map.hpp +66 -0
- data/ext/tatara/map/integer/int_string_map.hpp +67 -0
- data/ext/tatara/map/map.hpp +14 -27
- data/ext/tatara/map/string/string_float_map.hpp +67 -0
- data/ext/tatara/map/string/string_int_map.hpp +67 -0
- data/ext/tatara/map/string/string_string_map.hpp +67 -0
- data/ext/tatara/string/string.hpp +105 -0
- data/ext/tatara/tatara.cpp +245 -244
- data/ext/tatara/vector/float/float_vector.hpp +132 -0
- data/ext/tatara/vector/integer/int_vector.hpp +132 -0
- data/ext/tatara/vector/string/string_vector.hpp +133 -0
- data/ext/tatara/vector/vector.hpp +4 -0
- data/lib/tatara/array/array.rb +73 -0
- data/lib/tatara/vector/vector.rb +77 -0
- data/lib/tatara/version.rb +1 -1
- data/tatara.gemspec +1 -0
- metadata +31 -2
@@ -0,0 +1,132 @@
|
|
1
|
+
#ifndef INT_ARRAY_HPP_
|
2
|
+
#define INT_ARRAY_HPP_
|
3
|
+
|
4
|
+
#include <ruby.h>
|
5
|
+
#include <vector>
|
6
|
+
|
7
|
+
class IntArray {
|
8
|
+
std::vector<int> container;
|
9
|
+
|
10
|
+
public:
|
11
|
+
IntArray();
|
12
|
+
~IntArray();
|
13
|
+
int first();
|
14
|
+
int last();
|
15
|
+
int bracket(const int index);
|
16
|
+
int bracket_equal(const int index, const int var);
|
17
|
+
void emplace_back(const int var);
|
18
|
+
int size();
|
19
|
+
void clear();
|
20
|
+
IntArray& push_back_object(const int var);
|
21
|
+
};
|
22
|
+
|
23
|
+
IntArray::IntArray() {}
|
24
|
+
|
25
|
+
IntArray::~IntArray() {}
|
26
|
+
|
27
|
+
int IntArray::first() {
|
28
|
+
return this->container.front();
|
29
|
+
}
|
30
|
+
|
31
|
+
int IntArray::last() {
|
32
|
+
return this->container.back();
|
33
|
+
}
|
34
|
+
|
35
|
+
int IntArray::bracket(const int index) {
|
36
|
+
return this->container[index];
|
37
|
+
}
|
38
|
+
|
39
|
+
int IntArray::bracket_equal(const int index, const int var) {
|
40
|
+
return this->container[index] = var;
|
41
|
+
}
|
42
|
+
|
43
|
+
void IntArray::emplace_back(const int var) {
|
44
|
+
this->container.emplace_back(var);
|
45
|
+
}
|
46
|
+
|
47
|
+
int IntArray::size() {
|
48
|
+
return this->container.size();
|
49
|
+
}
|
50
|
+
|
51
|
+
void IntArray::clear() {
|
52
|
+
this->container.clear();
|
53
|
+
}
|
54
|
+
|
55
|
+
IntArray &IntArray::push_back_object(const int var) {
|
56
|
+
this->container.emplace_back(std::move(var));
|
57
|
+
return *this;
|
58
|
+
}
|
59
|
+
|
60
|
+
static IntArray *getIntArray(VALUE self) {
|
61
|
+
IntArray *ptr;
|
62
|
+
Data_Get_Struct(self, IntArray, ptr);
|
63
|
+
return ptr;
|
64
|
+
}
|
65
|
+
|
66
|
+
static void wrap_int_array_free(IntArray *ptr) {
|
67
|
+
ptr->~IntArray();
|
68
|
+
ruby_xfree(ptr);
|
69
|
+
}
|
70
|
+
|
71
|
+
static VALUE wrap_int_array_alloc(VALUE klass) {
|
72
|
+
void *p = ruby_xmalloc(sizeof(IntArray));
|
73
|
+
p = new IntArray;
|
74
|
+
return Data_Wrap_Struct(klass, NULL, wrap_int_array_free, p);
|
75
|
+
}
|
76
|
+
|
77
|
+
static VALUE wrap_int_array_init(VALUE self) {
|
78
|
+
IntArray *p = getIntArray(self);
|
79
|
+
p = new IntArray;
|
80
|
+
return Qnil;
|
81
|
+
}
|
82
|
+
|
83
|
+
static VALUE wrap_int_array_first(VALUE self) {
|
84
|
+
const int value = getIntArray(self)->first();
|
85
|
+
VALUE result = INT2NUM(value);
|
86
|
+
return result;
|
87
|
+
}
|
88
|
+
|
89
|
+
static VALUE wrap_int_array_last(VALUE self) {
|
90
|
+
const int value = getIntArray(self)->last();
|
91
|
+
VALUE result = INT2NUM(value);
|
92
|
+
return result;
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE wrap_int_array_bracket(VALUE self, VALUE index) {
|
96
|
+
const int i = NUM2INT(index);
|
97
|
+
const int value = getIntArray(self)->bracket(i);
|
98
|
+
VALUE result = INT2NUM(value);
|
99
|
+
return result;
|
100
|
+
}
|
101
|
+
|
102
|
+
static VALUE wrap_int_array_bracket_equal(VALUE self, VALUE index, VALUE value) {
|
103
|
+
const int i = NUM2INT(index);
|
104
|
+
const int v = NUM2INT(value);
|
105
|
+
getIntArray(self)->bracket_equal(i, v);
|
106
|
+
return value;
|
107
|
+
}
|
108
|
+
|
109
|
+
static VALUE wrap_int_array_emplace_back(VALUE self, VALUE value) {
|
110
|
+
const int v = NUM2INT(value);
|
111
|
+
getIntArray(self)->emplace_back(v);
|
112
|
+
return Qnil;
|
113
|
+
}
|
114
|
+
|
115
|
+
static VALUE wrap_int_array_size(VALUE self) {
|
116
|
+
const int size = getIntArray(self)->size();
|
117
|
+
VALUE result = INT2NUM(size);
|
118
|
+
return result;
|
119
|
+
}
|
120
|
+
|
121
|
+
static VALUE wrap_int_array_clear(VALUE self) {
|
122
|
+
getIntArray(self)->clear();
|
123
|
+
return Qnil;
|
124
|
+
}
|
125
|
+
|
126
|
+
static VALUE wrap_int_array_push_back_object(VALUE self, VALUE value) {
|
127
|
+
const int v = NUM2INT(value);
|
128
|
+
getIntArray(self)->push_back_object(v);
|
129
|
+
return self;
|
130
|
+
}
|
131
|
+
|
132
|
+
#endif
|
@@ -0,0 +1,133 @@
|
|
1
|
+
#ifndef STRING_ARRAY_HPP_
|
2
|
+
#define STRING_ARRAY_HPP_
|
3
|
+
|
4
|
+
#include <ruby.h>
|
5
|
+
#include <string>
|
6
|
+
#include <vector>
|
7
|
+
|
8
|
+
class StringArray {
|
9
|
+
std::vector<std::string> container;
|
10
|
+
|
11
|
+
public:
|
12
|
+
StringArray();
|
13
|
+
~StringArray();
|
14
|
+
std::string first();
|
15
|
+
std::string last();
|
16
|
+
std::string bracket(const int index);
|
17
|
+
std::string bracket_equal(const int index, const std::string var);
|
18
|
+
void emplace_back(const std::string var);
|
19
|
+
int size();
|
20
|
+
void clear();
|
21
|
+
StringArray& push_back_object(const std::string var);
|
22
|
+
};
|
23
|
+
|
24
|
+
StringArray::StringArray() {}
|
25
|
+
|
26
|
+
StringArray::~StringArray() {}
|
27
|
+
|
28
|
+
std::string StringArray::first() {
|
29
|
+
return this->container.front();
|
30
|
+
}
|
31
|
+
|
32
|
+
std::string StringArray::last() {
|
33
|
+
return this->container.back();
|
34
|
+
}
|
35
|
+
|
36
|
+
std::string StringArray::bracket(const int index) {
|
37
|
+
return this->container[index];
|
38
|
+
}
|
39
|
+
|
40
|
+
std::string StringArray::bracket_equal(const int index, const std::string var) {
|
41
|
+
return this->container[index] = var;
|
42
|
+
}
|
43
|
+
|
44
|
+
void StringArray::emplace_back(const std::string var) {
|
45
|
+
this->container.emplace_back(var);
|
46
|
+
}
|
47
|
+
|
48
|
+
int StringArray::size() {
|
49
|
+
return this->container.size();
|
50
|
+
}
|
51
|
+
|
52
|
+
void StringArray::clear() {
|
53
|
+
this->container.clear();
|
54
|
+
}
|
55
|
+
|
56
|
+
StringArray &StringArray::push_back_object(const std::string var) {
|
57
|
+
this->container.emplace_back(std::move(var));
|
58
|
+
return *this;
|
59
|
+
}
|
60
|
+
|
61
|
+
static StringArray *getStringArray(VALUE self) {
|
62
|
+
StringArray *ptr;
|
63
|
+
Data_Get_Struct(self, StringArray, ptr);
|
64
|
+
return ptr;
|
65
|
+
}
|
66
|
+
|
67
|
+
static void wrap_string_array_free(StringArray *ptr) {
|
68
|
+
ptr->~StringArray();
|
69
|
+
ruby_xfree(ptr);
|
70
|
+
}
|
71
|
+
|
72
|
+
static VALUE wrap_string_array_alloc(VALUE klass) {
|
73
|
+
void *p = ruby_xmalloc(sizeof(StringArray));
|
74
|
+
p = new StringArray;
|
75
|
+
return Data_Wrap_Struct(klass, NULL, wrap_string_array_free, p);
|
76
|
+
}
|
77
|
+
|
78
|
+
static VALUE wrap_string_array_init(VALUE self) {
|
79
|
+
StringArray *p = getStringArray(self);
|
80
|
+
p = new StringArray;
|
81
|
+
return Qnil;
|
82
|
+
}
|
83
|
+
|
84
|
+
static VALUE wrap_string_array_first(VALUE self) {
|
85
|
+
const std::string value = getStringArray(self)->first();
|
86
|
+
VALUE result = rb_str_new(value.data(), value.size());
|
87
|
+
return result;
|
88
|
+
}
|
89
|
+
|
90
|
+
static VALUE wrap_string_array_last(VALUE self) {
|
91
|
+
const std::string value = getStringArray(self)->last();
|
92
|
+
VALUE result = rb_str_new(value.data(), value.size());
|
93
|
+
return result;
|
94
|
+
}
|
95
|
+
|
96
|
+
static VALUE wrap_string_array_bracket(VALUE self, VALUE index) {
|
97
|
+
const int i = NUM2INT(index);
|
98
|
+
const std::string value = getStringArray(self)->bracket(i);
|
99
|
+
VALUE result = rb_str_new(value.data(), value.size());
|
100
|
+
return result;
|
101
|
+
}
|
102
|
+
|
103
|
+
static VALUE wrap_string_array_bracket_equal(VALUE self, VALUE index, VALUE value) {
|
104
|
+
const int i = NUM2INT(index);
|
105
|
+
const std::string v = {StringValueCStr(value)};
|
106
|
+
getStringArray(self)->bracket_equal(i, v);
|
107
|
+
return value;
|
108
|
+
}
|
109
|
+
|
110
|
+
static VALUE wrap_string_array_emplace_back(VALUE self, VALUE value) {
|
111
|
+
const std::string v = {StringValueCStr(value)};
|
112
|
+
getStringArray(self)->emplace_back(v);
|
113
|
+
return Qnil;
|
114
|
+
}
|
115
|
+
|
116
|
+
static VALUE wrap_string_array_size(VALUE self) {
|
117
|
+
const int size = getStringArray(self)->size();
|
118
|
+
VALUE result = INT2NUM(size);
|
119
|
+
return result;
|
120
|
+
}
|
121
|
+
|
122
|
+
static VALUE wrap_string_array_clear(VALUE self) {
|
123
|
+
getStringArray(self)->clear();
|
124
|
+
return Qnil;
|
125
|
+
}
|
126
|
+
|
127
|
+
static VALUE wrap_string_array_push_back_object(VALUE self, VALUE value) {
|
128
|
+
const std::string v = {StringValueCStr(value)};
|
129
|
+
getStringArray(self)->push_back_object(v);
|
130
|
+
return self;
|
131
|
+
}
|
132
|
+
|
133
|
+
#endif
|
data/ext/tatara/extconf.rb
CHANGED
data/ext/tatara/float/float.hpp
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#ifndef FLOAT_H_
|
2
2
|
#define FLOAT_H_
|
3
3
|
|
4
|
+
#include <ruby.h>
|
4
5
|
#include <string>
|
5
6
|
#include <regex>
|
6
7
|
|
@@ -116,4 +117,151 @@ constexpr bool Float::equal(const double var) {
|
|
116
117
|
return this->value == var;
|
117
118
|
}
|
118
119
|
|
120
|
+
static Float *getFloat(VALUE self) {
|
121
|
+
Float *ptr;
|
122
|
+
Data_Get_Struct(self, Float, ptr);
|
123
|
+
return ptr;
|
124
|
+
}
|
125
|
+
|
126
|
+
static void wrap_float_free(Float *ptr) {
|
127
|
+
ptr->~Float();
|
128
|
+
ruby_xfree(ptr);
|
129
|
+
}
|
130
|
+
|
131
|
+
static VALUE wrap_float_alloc(VALUE klass) {
|
132
|
+
void *p = ruby_xmalloc(sizeof(Float));
|
133
|
+
p = new Float;
|
134
|
+
return Data_Wrap_Struct(klass, NULL, wrap_float_free, p);
|
135
|
+
}
|
136
|
+
|
137
|
+
static VALUE wrap_float_init(VALUE self) {
|
138
|
+
Float *p = getFloat(self);
|
139
|
+
p = new Float;
|
140
|
+
return Qnil;
|
141
|
+
}
|
142
|
+
|
143
|
+
static VALUE wrap_float_return_value(VALUE self) {
|
144
|
+
const double value = getFloat(self)->return_value();
|
145
|
+
VALUE result = DBL2NUM(value);
|
146
|
+
return result;
|
147
|
+
}
|
148
|
+
|
149
|
+
static VALUE wrap_float_assignment(VALUE self, VALUE value) {
|
150
|
+
const double v = NUM2DBL(value);
|
151
|
+
getFloat(self)->assignment(v);
|
152
|
+
return value;
|
153
|
+
}
|
154
|
+
|
155
|
+
static VALUE wrap_float_plus(VALUE self, VALUE value) {
|
156
|
+
const double v = NUM2DBL(value);
|
157
|
+
const double r = getFloat(self)->plus(v);
|
158
|
+
VALUE result = DBL2NUM(r);
|
159
|
+
return result;
|
160
|
+
}
|
161
|
+
|
162
|
+
static VALUE wrap_float_plus_equal(VALUE self, VALUE value) {
|
163
|
+
const double v = NUM2DBL(value);
|
164
|
+
const double r = getFloat(self)->plus_equal(v);
|
165
|
+
VALUE result = DBL2NUM(r);
|
166
|
+
return result;
|
167
|
+
}
|
168
|
+
|
169
|
+
static VALUE wrap_float_minus(VALUE self, VALUE value) {
|
170
|
+
const double v = NUM2DBL(value);
|
171
|
+
const double r = getFloat(self)->minus(v);
|
172
|
+
VALUE result = DBL2NUM(r);
|
173
|
+
return result;
|
174
|
+
}
|
175
|
+
|
176
|
+
static VALUE wrap_float_minus_equal(VALUE self, VALUE value) {
|
177
|
+
const double v = NUM2DBL(value);
|
178
|
+
const double r = getFloat(self)->minus_equal(v);
|
179
|
+
VALUE result = DBL2NUM(r);
|
180
|
+
return result;
|
181
|
+
}
|
182
|
+
|
183
|
+
static VALUE wrap_float_multiply(VALUE self, VALUE value) {
|
184
|
+
const double v = NUM2DBL(value);
|
185
|
+
const double r = getFloat(self)->multiply(v);
|
186
|
+
VALUE result = DBL2NUM(r);
|
187
|
+
return result;
|
188
|
+
}
|
189
|
+
|
190
|
+
static VALUE wrap_float_multiply_equal(VALUE self, VALUE value) {
|
191
|
+
const double v = NUM2DBL(value);
|
192
|
+
const double r = getFloat(self)->multiply_equal(v);
|
193
|
+
VALUE result = DBL2NUM(r);
|
194
|
+
return result;
|
195
|
+
}
|
196
|
+
|
197
|
+
static VALUE wrap_float_divided(VALUE self, VALUE value) {
|
198
|
+
const double v = NUM2DBL(value);
|
199
|
+
const double r = getFloat(self)->divided(v);
|
200
|
+
VALUE result = DBL2NUM(r);
|
201
|
+
return result;
|
202
|
+
}
|
203
|
+
|
204
|
+
static VALUE wrap_float_divided_equal(VALUE self, VALUE value) {
|
205
|
+
const double v = NUM2DBL(value);
|
206
|
+
const double r = getFloat(self)->divided_equal(v);
|
207
|
+
VALUE result = DBL2NUM(r);
|
208
|
+
return result;
|
209
|
+
}
|
210
|
+
|
211
|
+
static VALUE wrap_float_power(VALUE self, VALUE value) {
|
212
|
+
const double v = NUM2DBL(value);
|
213
|
+
const double r = getFloat(self)->power(v);
|
214
|
+
VALUE result = DBL2NUM(r);
|
215
|
+
return result;
|
216
|
+
}
|
217
|
+
|
218
|
+
static VALUE wrap_float_power_equal(VALUE self, VALUE value) {
|
219
|
+
const double v = NUM2DBL(value);
|
220
|
+
const double r = getFloat(self)->power_equal(v);
|
221
|
+
VALUE result = DBL2NUM(r);
|
222
|
+
return result;
|
223
|
+
}
|
224
|
+
|
225
|
+
static VALUE wrap_float_increment_value(VALUE self) {
|
226
|
+
const double value = getFloat(self)->increment_value();
|
227
|
+
VALUE result = DBL2NUM(value);
|
228
|
+
return result;
|
229
|
+
}
|
230
|
+
|
231
|
+
static VALUE wrap_float_decrement_value(VALUE self) {
|
232
|
+
const double value = getFloat(self)->decrement_value();
|
233
|
+
VALUE result = DBL2NUM(value);
|
234
|
+
return result;
|
235
|
+
}
|
236
|
+
|
237
|
+
static VALUE wrap_float_to_string(VALUE self) {
|
238
|
+
const std::string value = getFloat(self)->to_string();
|
239
|
+
VALUE result = rb_str_new(value.c_str(), value.size());
|
240
|
+
return result;
|
241
|
+
}
|
242
|
+
|
243
|
+
static VALUE wrap_float_to_integer(VALUE self) {
|
244
|
+
const int value = getFloat(self)->to_integer();
|
245
|
+
VALUE result = INT2NUM(value);
|
246
|
+
return result;
|
247
|
+
}
|
248
|
+
|
249
|
+
static VALUE wrap_float_clear(VALUE self) {
|
250
|
+
const double value = getFloat(self)->clear();
|
251
|
+
VALUE result = DBL2NUM(value);
|
252
|
+
return result;
|
253
|
+
}
|
254
|
+
|
255
|
+
static VALUE wrap_float_equal(VALUE self, VALUE value) {
|
256
|
+
const double v = NUM2DBL(value);
|
257
|
+
bool eval = getFloat(self)->equal(v);
|
258
|
+
return eval ? Qtrue : Qfalse;
|
259
|
+
}
|
260
|
+
|
261
|
+
static VALUE wrap_float_initialize_object(VALUE self, VALUE value) {
|
262
|
+
const double v = NUM2DBL(value);
|
263
|
+
getFloat(self)->initialize_object(v);
|
264
|
+
return self;
|
265
|
+
}
|
266
|
+
|
119
267
|
#endif
|
@@ -1,6 +1,7 @@
|
|
1
1
|
#ifndef INTEGER_H_
|
2
2
|
#define INTEGER_H_
|
3
3
|
|
4
|
+
#include <ruby.h>
|
4
5
|
#include <string>
|
5
6
|
#include <cmath>
|
6
7
|
|
@@ -122,4 +123,167 @@ constexpr bool Integer::equal(const int var) {
|
|
122
123
|
return this->value == var;
|
123
124
|
}
|
124
125
|
|
126
|
+
static Integer *getInteger(VALUE self) {
|
127
|
+
Integer *ptr;
|
128
|
+
Data_Get_Struct(self, Integer, ptr);
|
129
|
+
return ptr;
|
130
|
+
}
|
131
|
+
|
132
|
+
static void wrap_int_free(Integer *ptr) {
|
133
|
+
ptr->~Integer();
|
134
|
+
ruby_xfree(ptr);
|
135
|
+
}
|
136
|
+
|
137
|
+
static VALUE wrap_int_alloc(VALUE klass) {
|
138
|
+
void *p = ruby_xmalloc(sizeof(Integer));
|
139
|
+
p = new Integer;
|
140
|
+
return Data_Wrap_Struct(klass, NULL, wrap_int_free, p);
|
141
|
+
}
|
142
|
+
|
143
|
+
static VALUE wrap_int_init(VALUE self) {
|
144
|
+
Integer *p = getInteger(self);
|
145
|
+
p = new Integer;
|
146
|
+
return Qnil;
|
147
|
+
}
|
148
|
+
|
149
|
+
|
150
|
+
static VALUE wrap_int_return_value(VALUE self) {
|
151
|
+
const int value = getInteger(self)->return_value();
|
152
|
+
VALUE result = INT2NUM(value);
|
153
|
+
return result;
|
154
|
+
}
|
155
|
+
|
156
|
+
static VALUE wrap_int_assignment(VALUE self, VALUE value) {
|
157
|
+
const int v = NUM2INT(value);
|
158
|
+
const int r = getInteger(self)->assignment(v);
|
159
|
+
VALUE result = INT2NUM(r);
|
160
|
+
return result;
|
161
|
+
}
|
162
|
+
|
163
|
+
static VALUE wrap_int_plus(VALUE self, VALUE value) {
|
164
|
+
const int v = NUM2INT(value);
|
165
|
+
const int r = getInteger(self)->plus(v);
|
166
|
+
VALUE result = INT2NUM(r);
|
167
|
+
return result;
|
168
|
+
}
|
169
|
+
|
170
|
+
static VALUE wrap_int_plus_equal(VALUE self, VALUE value) {
|
171
|
+
const int v = NUM2INT(value);
|
172
|
+
const int r = getInteger(self)->plus_equal(v);
|
173
|
+
VALUE result = INT2NUM(r);
|
174
|
+
return result;
|
175
|
+
}
|
176
|
+
|
177
|
+
static VALUE wrap_int_minus(VALUE self, VALUE value) {
|
178
|
+
const int v = NUM2INT(value);
|
179
|
+
const int r = getInteger(self)->minus(v);
|
180
|
+
VALUE result = INT2NUM(r);
|
181
|
+
return result;
|
182
|
+
}
|
183
|
+
|
184
|
+
static VALUE wrap_int_minus_equal(VALUE self, VALUE value) {
|
185
|
+
const int v = NUM2INT(value);
|
186
|
+
const int r = getInteger(self)->minus_equal(v);
|
187
|
+
VALUE result = INT2NUM(r);
|
188
|
+
return result;
|
189
|
+
}
|
190
|
+
|
191
|
+
static VALUE wrap_int_divided(VALUE self, VALUE value) {
|
192
|
+
const int v = NUM2INT(value);
|
193
|
+
const int r = getInteger(self)->divided(v);
|
194
|
+
VALUE result = INT2NUM(r);
|
195
|
+
return result;
|
196
|
+
}
|
197
|
+
|
198
|
+
static VALUE wrap_int_divided_equal(VALUE self, VALUE value) {
|
199
|
+
const int v = NUM2INT(value);
|
200
|
+
const int r = getInteger(self)->divided_equal(v);
|
201
|
+
VALUE result = INT2NUM(r);
|
202
|
+
return result;
|
203
|
+
}
|
204
|
+
|
205
|
+
static VALUE wrap_int_multiply(VALUE self, VALUE value) {
|
206
|
+
const int v = NUM2INT(value);
|
207
|
+
const int r = getInteger(self)->multiply(v);
|
208
|
+
VALUE result = INT2NUM(r);
|
209
|
+
return result;
|
210
|
+
}
|
211
|
+
|
212
|
+
static VALUE wrap_int_multiply_equal(VALUE self, VALUE value) {
|
213
|
+
const int v = NUM2INT(value);
|
214
|
+
const int r = getInteger(self)->multiply_equal(v);
|
215
|
+
VALUE result = INT2NUM(r);
|
216
|
+
return result;
|
217
|
+
}
|
218
|
+
|
219
|
+
static VALUE wrap_int_mod(VALUE self, VALUE value) {
|
220
|
+
const int v = NUM2INT(value);
|
221
|
+
const int r = getInteger(self)->mod(v);
|
222
|
+
VALUE result = INT2NUM(r);
|
223
|
+
return result;
|
224
|
+
}
|
225
|
+
|
226
|
+
static VALUE wrap_int_mod_equal(VALUE self, VALUE value) {
|
227
|
+
const int v = NUM2INT(value);
|
228
|
+
const int r = getInteger(self)->mod_equal(v);
|
229
|
+
VALUE result = INT2NUM(r);
|
230
|
+
return result;
|
231
|
+
}
|
232
|
+
|
233
|
+
static VALUE wrap_int_power(VALUE self, VALUE value) {
|
234
|
+
const int v = NUM2INT(value);
|
235
|
+
const int r = getInteger(self)->power(v);
|
236
|
+
VALUE result = INT2NUM(r);
|
237
|
+
return result;
|
238
|
+
}
|
239
|
+
|
240
|
+
static VALUE wrap_int_power_equal(VALUE self, VALUE value) {
|
241
|
+
const int v = NUM2INT(value);
|
242
|
+
const int r = getInteger(self)->power_equal(v);
|
243
|
+
VALUE result = INT2NUM(r);
|
244
|
+
return result;
|
245
|
+
}
|
246
|
+
|
247
|
+
static VALUE wrap_int_increment_value(VALUE self) {
|
248
|
+
const int value = getInteger(self)->increment_value();
|
249
|
+
VALUE result = INT2NUM(value);
|
250
|
+
return result;
|
251
|
+
}
|
252
|
+
|
253
|
+
static VALUE wrap_int_decrement_value(VALUE self) {
|
254
|
+
const int value = getInteger(self)->decrement_value();
|
255
|
+
VALUE result = INT2NUM(value);
|
256
|
+
return result;
|
257
|
+
}
|
258
|
+
|
259
|
+
static VALUE wrap_int_to_string(VALUE self) {
|
260
|
+
const std::string value = getInteger(self)->to_string();
|
261
|
+
VALUE result = rb_str_new(value.c_str(), value.size());
|
262
|
+
return result;
|
263
|
+
}
|
264
|
+
|
265
|
+
static VALUE wrap_int_to_float(VALUE self) {
|
266
|
+
const double value = getInteger(self)->to_float();
|
267
|
+
VALUE result = DBL2NUM(value);
|
268
|
+
return result;
|
269
|
+
}
|
270
|
+
|
271
|
+
static VALUE wrap_int_clear(VALUE self) {
|
272
|
+
const int value = getInteger(self)->clear();
|
273
|
+
VALUE result = INT2NUM(value);
|
274
|
+
return result;
|
275
|
+
}
|
276
|
+
|
277
|
+
static VALUE wrap_int_equal(VALUE self, VALUE value) {
|
278
|
+
const int v = NUM2INT(value);
|
279
|
+
bool eval = getInteger(self)->equal(v);
|
280
|
+
return eval ? Qtrue : Qfalse;
|
281
|
+
}
|
282
|
+
|
283
|
+
static VALUE wrap_int_initialize_object(VALUE self, VALUE value) {
|
284
|
+
const int v = NUM2INT(value);
|
285
|
+
getInteger(self)->initialize_object(v);
|
286
|
+
return self;
|
287
|
+
}
|
288
|
+
|
125
289
|
#endif
|