numo-narray-alt 0.10.0 → 0.10.1
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/ext/numo/narray/narray.c +7 -5
- data/ext/numo/narray/numo/intern.h +0 -7
- data/ext/numo/narray/numo/narray.h +2 -2
- data/ext/numo/narray/src/mh/aset.h +2 -2
- data/ext/numo/narray/src/t_bit.c +3 -5
- data/ext/numo/narray/src/t_dcomplex.c +3 -5
- data/ext/numo/narray/src/t_dfloat.c +3 -5
- data/ext/numo/narray/src/t_int16.c +3 -5
- data/ext/numo/narray/src/t_int32.c +3 -5
- data/ext/numo/narray/src/t_int64.c +3 -5
- data/ext/numo/narray/src/t_int8.c +3 -5
- data/ext/numo/narray/src/t_robject.c +3 -5
- data/ext/numo/narray/src/t_scomplex.c +3 -5
- data/ext/numo/narray/src/t_sfloat.c +3 -5
- data/ext/numo/narray/src/t_uint16.c +3 -5
- data/ext/numo/narray/src/t_uint32.c +3 -5
- data/ext/numo/narray/src/t_uint64.c +3 -5
- data/ext/numo/narray/src/t_uint8.c +3 -5
- metadata +3 -4
- data/ext/numo/narray/kwargs.c +0 -144
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2567fb1002a21b25cf82239f1ecb39cfd3765c52847d431f814c1c1933f5af9d
|
|
4
|
+
data.tar.gz: 9737f59071d0078da064bc1fdc983d5bacaf80e90f871297f72cefd3f944d781
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b8191bdf1b90645a3ef109a84d6c3446b7e8321a4091ea2acd01469f71add1e4832b9acff113edc5ca5cd151a7e68cede491453e2d8040d1ecadfe3fec3ae3e7
|
|
7
|
+
data.tar.gz: f7894fd10299190e1b2ec16a8270990edb80cc5524bd2f279983479f4b9ab266c83ec288683a63fbcffcfef09bd68946b2c939b6b91d2c6e1acd06e067f60d12
|
data/ext/numo/narray/narray.c
CHANGED
|
@@ -202,11 +202,9 @@ static void na_view_free(void* ptr) {
|
|
|
202
202
|
xfree(na->stridx);
|
|
203
203
|
na->stridx = NULL;
|
|
204
204
|
}
|
|
205
|
-
if (na->base.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
na->base.shape = NULL;
|
|
209
|
-
}
|
|
205
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
206
|
+
xfree(na->base.shape);
|
|
207
|
+
na->base.shape = NULL;
|
|
210
208
|
}
|
|
211
209
|
xfree(na);
|
|
212
210
|
}
|
|
@@ -292,6 +290,10 @@ void na_alloc_shape(narray_t* na, int ndim) {
|
|
|
292
290
|
if (ndim > NA_MAX_DIMENSION) {
|
|
293
291
|
rb_raise(nary_eDimensionError, "ndim=%d is too many", ndim);
|
|
294
292
|
}
|
|
293
|
+
if (na->shape != NULL && na->shape != &(na->size)) {
|
|
294
|
+
xfree(na->shape);
|
|
295
|
+
na->shape = NULL;
|
|
296
|
+
}
|
|
295
297
|
na->shape = ALLOC_N(size_t, ndim);
|
|
296
298
|
}
|
|
297
299
|
}
|
|
@@ -111,11 +111,4 @@ int nary_get_result_dimension(
|
|
|
111
111
|
#define na_aref_main nary_aref_main
|
|
112
112
|
VALUE nary_aref_main(int nidx, VALUE* idx, VALUE self, int keep_dim, int nd);
|
|
113
113
|
|
|
114
|
-
#include "ruby/version.h"
|
|
115
|
-
|
|
116
|
-
#if RUBY_API_VERSION_CODE == 20100 // 2.1.0
|
|
117
|
-
int rb_get_kwargs(VALUE keyword_hash, const ID* table, int required, int optional, VALUE*);
|
|
118
|
-
VALUE rb_extract_keywords(VALUE* orighash);
|
|
119
|
-
#endif
|
|
120
|
-
|
|
121
114
|
#endif /* ifndef INTERN_H */
|
|
@@ -13,10 +13,10 @@ extern "C" {
|
|
|
13
13
|
#endif
|
|
14
14
|
#endif
|
|
15
15
|
|
|
16
|
-
#define NARRAY_VERSION "0.10.
|
|
16
|
+
#define NARRAY_VERSION "0.10.1"
|
|
17
17
|
#define NARRAY_VERSION_MAJOR 0
|
|
18
18
|
#define NARRAY_VERSION_MINOR 10
|
|
19
|
-
#define NARRAY_VERSION_PATCH
|
|
19
|
+
#define NARRAY_VERSION_PATCH 1
|
|
20
20
|
#define NARRAY_VERSION_CODE \
|
|
21
21
|
(NARRAY_VERSION_MAJOR * 10000 + NARRAY_VERSION_MINOR * 100 + NARRAY_VERSION_PATCH)
|
|
22
22
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
return m_from_real(*(float*)(ptr + pos)); \
|
|
28
28
|
} \
|
|
29
29
|
if (klass == numo_cInt64) { \
|
|
30
|
-
return m_from_int64(*(int64_t*)(ptr + pos));
|
|
30
|
+
return (tDType)m_from_int64(*(int64_t*)(ptr + pos)); \
|
|
31
31
|
} \
|
|
32
32
|
if (klass == numo_cInt32) { \
|
|
33
33
|
return m_from_int32(*(int32_t*)(ptr + pos)); \
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
return m_from_sint(*(int8_t*)(ptr + pos)); \
|
|
40
40
|
} \
|
|
41
41
|
if (klass == numo_cUInt64) { \
|
|
42
|
-
return m_from_uint64(*(u_int64_t*)(ptr + pos));
|
|
42
|
+
return (tDType)m_from_uint64(*(u_int64_t*)(ptr + pos)); \
|
|
43
43
|
} \
|
|
44
44
|
if (klass == numo_cUInt32) { \
|
|
45
45
|
return m_from_uint32(*(u_int32_t*)(ptr + pos)); \
|
data/ext/numo/narray/src/t_bit.c
CHANGED
|
@@ -92,11 +92,9 @@ static void bit_free(void* ptr) {
|
|
|
92
92
|
}
|
|
93
93
|
na->ptr = NULL;
|
|
94
94
|
}
|
|
95
|
-
if (na->base.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
na->base.shape = NULL;
|
|
99
|
-
}
|
|
95
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
96
|
+
xfree(na->base.shape);
|
|
97
|
+
na->base.shape = NULL;
|
|
100
98
|
}
|
|
101
99
|
xfree(na);
|
|
102
100
|
}
|
|
@@ -236,11 +236,9 @@ static void dcomplex_free(void* ptr) {
|
|
|
236
236
|
}
|
|
237
237
|
na->ptr = NULL;
|
|
238
238
|
}
|
|
239
|
-
if (na->base.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
na->base.shape = NULL;
|
|
243
|
-
}
|
|
239
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
240
|
+
xfree(na->base.shape);
|
|
241
|
+
na->base.shape = NULL;
|
|
244
242
|
}
|
|
245
243
|
xfree(na);
|
|
246
244
|
}
|
|
@@ -306,11 +306,9 @@ static void dfloat_free(void* ptr) {
|
|
|
306
306
|
}
|
|
307
307
|
na->ptr = NULL;
|
|
308
308
|
}
|
|
309
|
-
if (na->base.
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
na->base.shape = NULL;
|
|
313
|
-
}
|
|
309
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
310
|
+
xfree(na->base.shape);
|
|
311
|
+
na->base.shape = NULL;
|
|
314
312
|
}
|
|
315
313
|
xfree(na);
|
|
316
314
|
}
|
|
@@ -218,11 +218,9 @@ static void int16_free(void* ptr) {
|
|
|
218
218
|
}
|
|
219
219
|
na->ptr = NULL;
|
|
220
220
|
}
|
|
221
|
-
if (na->base.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
na->base.shape = NULL;
|
|
225
|
-
}
|
|
221
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
222
|
+
xfree(na->base.shape);
|
|
223
|
+
na->base.shape = NULL;
|
|
226
224
|
}
|
|
227
225
|
xfree(na);
|
|
228
226
|
}
|
|
@@ -219,11 +219,9 @@ static void int32_free(void* ptr) {
|
|
|
219
219
|
}
|
|
220
220
|
na->ptr = NULL;
|
|
221
221
|
}
|
|
222
|
-
if (na->base.
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
na->base.shape = NULL;
|
|
226
|
-
}
|
|
222
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
223
|
+
xfree(na->base.shape);
|
|
224
|
+
na->base.shape = NULL;
|
|
227
225
|
}
|
|
228
226
|
xfree(na);
|
|
229
227
|
}
|
|
@@ -218,11 +218,9 @@ static void int64_free(void* ptr) {
|
|
|
218
218
|
}
|
|
219
219
|
na->ptr = NULL;
|
|
220
220
|
}
|
|
221
|
-
if (na->base.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
na->base.shape = NULL;
|
|
225
|
-
}
|
|
221
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
222
|
+
xfree(na->base.shape);
|
|
223
|
+
na->base.shape = NULL;
|
|
226
224
|
}
|
|
227
225
|
xfree(na);
|
|
228
226
|
}
|
|
@@ -218,11 +218,9 @@ static void int8_free(void* ptr) {
|
|
|
218
218
|
}
|
|
219
219
|
na->ptr = NULL;
|
|
220
220
|
}
|
|
221
|
-
if (na->base.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
na->base.shape = NULL;
|
|
225
|
-
}
|
|
221
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
222
|
+
xfree(na->base.shape);
|
|
223
|
+
na->base.shape = NULL;
|
|
226
224
|
}
|
|
227
225
|
xfree(na);
|
|
228
226
|
}
|
|
@@ -242,11 +242,9 @@ static void robject_free(void* ptr) {
|
|
|
242
242
|
}
|
|
243
243
|
na->ptr = NULL;
|
|
244
244
|
}
|
|
245
|
-
if (na->base.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
na->base.shape = NULL;
|
|
249
|
-
}
|
|
245
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
246
|
+
xfree(na->base.shape);
|
|
247
|
+
na->base.shape = NULL;
|
|
250
248
|
}
|
|
251
249
|
xfree(na);
|
|
252
250
|
}
|
|
@@ -234,11 +234,9 @@ static void scomplex_free(void* ptr) {
|
|
|
234
234
|
}
|
|
235
235
|
na->ptr = NULL;
|
|
236
236
|
}
|
|
237
|
-
if (na->base.
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
na->base.shape = NULL;
|
|
241
|
-
}
|
|
237
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
238
|
+
xfree(na->base.shape);
|
|
239
|
+
na->base.shape = NULL;
|
|
242
240
|
}
|
|
243
241
|
xfree(na);
|
|
244
242
|
}
|
|
@@ -304,11 +304,9 @@ static void sfloat_free(void* ptr) {
|
|
|
304
304
|
}
|
|
305
305
|
na->ptr = NULL;
|
|
306
306
|
}
|
|
307
|
-
if (na->base.
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
na->base.shape = NULL;
|
|
311
|
-
}
|
|
307
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
308
|
+
xfree(na->base.shape);
|
|
309
|
+
na->base.shape = NULL;
|
|
312
310
|
}
|
|
313
311
|
xfree(na);
|
|
314
312
|
}
|
|
@@ -218,11 +218,9 @@ static void uint16_free(void* ptr) {
|
|
|
218
218
|
}
|
|
219
219
|
na->ptr = NULL;
|
|
220
220
|
}
|
|
221
|
-
if (na->base.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
na->base.shape = NULL;
|
|
225
|
-
}
|
|
221
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
222
|
+
xfree(na->base.shape);
|
|
223
|
+
na->base.shape = NULL;
|
|
226
224
|
}
|
|
227
225
|
xfree(na);
|
|
228
226
|
}
|
|
@@ -218,11 +218,9 @@ static void uint32_free(void* ptr) {
|
|
|
218
218
|
}
|
|
219
219
|
na->ptr = NULL;
|
|
220
220
|
}
|
|
221
|
-
if (na->base.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
na->base.shape = NULL;
|
|
225
|
-
}
|
|
221
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
222
|
+
xfree(na->base.shape);
|
|
223
|
+
na->base.shape = NULL;
|
|
226
224
|
}
|
|
227
225
|
xfree(na);
|
|
228
226
|
}
|
|
@@ -218,11 +218,9 @@ static void uint64_free(void* ptr) {
|
|
|
218
218
|
}
|
|
219
219
|
na->ptr = NULL;
|
|
220
220
|
}
|
|
221
|
-
if (na->base.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
na->base.shape = NULL;
|
|
225
|
-
}
|
|
221
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
222
|
+
xfree(na->base.shape);
|
|
223
|
+
na->base.shape = NULL;
|
|
226
224
|
}
|
|
227
225
|
xfree(na);
|
|
228
226
|
}
|
|
@@ -218,11 +218,9 @@ static void uint8_free(void* ptr) {
|
|
|
218
218
|
}
|
|
219
219
|
na->ptr = NULL;
|
|
220
220
|
}
|
|
221
|
-
if (na->base.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
na->base.shape = NULL;
|
|
225
|
-
}
|
|
221
|
+
if (na->base.shape != NULL && na->base.shape != &(na->base.size)) {
|
|
222
|
+
xfree(na->base.shape);
|
|
223
|
+
na->base.shape = NULL;
|
|
226
224
|
}
|
|
227
225
|
xfree(na);
|
|
228
226
|
}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: numo-narray-alt
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.10.
|
|
4
|
+
version: 0.10.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- yoshoku
|
|
@@ -32,7 +32,6 @@ files:
|
|
|
32
32
|
- ext/numo/narray/data.c
|
|
33
33
|
- ext/numo/narray/extconf.rb
|
|
34
34
|
- ext/numo/narray/index.c
|
|
35
|
-
- ext/numo/narray/kwargs.c
|
|
36
35
|
- ext/numo/narray/math.c
|
|
37
36
|
- ext/numo/narray/narray.c
|
|
38
37
|
- ext/numo/narray/narray.def
|
|
@@ -215,7 +214,7 @@ licenses:
|
|
|
215
214
|
metadata:
|
|
216
215
|
homepage_uri: https://github.com/yoshoku/numo-narray-alt
|
|
217
216
|
changelog_uri: https://github.com/yoshoku/numo-narray-alt/blob/main/CHANGELOG.md
|
|
218
|
-
documentation_uri: https://gemdocs.org/gems/numo-narray-alt/0.10.
|
|
217
|
+
documentation_uri: https://gemdocs.org/gems/numo-narray-alt/0.10.1/
|
|
219
218
|
rubygems_mfa_required: 'true'
|
|
220
219
|
post_install_message: |
|
|
221
220
|
===
|
|
@@ -239,7 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
239
238
|
- !ruby/object:Gem::Version
|
|
240
239
|
version: '0'
|
|
241
240
|
requirements: []
|
|
242
|
-
rubygems_version: 4.0.
|
|
241
|
+
rubygems_version: 4.0.6
|
|
243
242
|
specification_version: 4
|
|
244
243
|
summary: Numo::NArray Alternative is a project forked from Numo::NArray.
|
|
245
244
|
test_files: []
|
data/ext/numo/narray/kwargs.c
DELETED
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
/**********************************************************************
|
|
2
|
-
|
|
3
|
-
Function to extract Keyword argument for ruby-2.1.x
|
|
4
|
-
Copied from class.c in ruby-2.4.2
|
|
5
|
-
|
|
6
|
-
Copyright (C) 1993-2007 Yukihiro Matsumoto
|
|
7
|
-
|
|
8
|
-
**********************************************************************/
|
|
9
|
-
#include <ruby.h>
|
|
10
|
-
#define rb_hash_tbl_raw(hash) rb_hash_tbl(hash)
|
|
11
|
-
|
|
12
|
-
/* from internal.h */
|
|
13
|
-
struct RBasicRaw {
|
|
14
|
-
VALUE flags;
|
|
15
|
-
VALUE klass;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
#define RBASIC_SET_CLASS(obj, cls) \
|
|
19
|
-
do { \
|
|
20
|
-
VALUE _obj_ = (obj); \
|
|
21
|
-
RB_OBJ_WRITE(_obj_, &((struct RBasicRaw*)(_obj_))->klass, cls); \
|
|
22
|
-
} while (0)
|
|
23
|
-
|
|
24
|
-
/* from class.c */
|
|
25
|
-
VALUE
|
|
26
|
-
rb_keyword_error_new(const char* error, VALUE keys) {
|
|
27
|
-
const char* msg = "";
|
|
28
|
-
VALUE error_message;
|
|
29
|
-
|
|
30
|
-
if (RARRAY_LEN(keys) == 1) {
|
|
31
|
-
keys = RARRAY_AREF(keys, 0);
|
|
32
|
-
} else {
|
|
33
|
-
keys = rb_ary_join(keys, rb_usascii_str_new2(", "));
|
|
34
|
-
msg = "s";
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
error_message = rb_sprintf("%s keyword%s: %" PRIsVALUE, error, msg, keys);
|
|
38
|
-
|
|
39
|
-
return rb_exc_new_str(rb_eArgError, error_message);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
NORETURN(static void rb_keyword_error(const char* error, VALUE keys));
|
|
43
|
-
static void rb_keyword_error(const char* error, VALUE keys) {
|
|
44
|
-
rb_exc_raise(rb_keyword_error_new(error, keys));
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
NORETURN(static void unknown_keyword_error(VALUE hash, const ID* table, int keywords));
|
|
48
|
-
static void unknown_keyword_error(VALUE hash, const ID* table, int keywords) {
|
|
49
|
-
st_table* tbl = rb_hash_tbl_raw(hash);
|
|
50
|
-
VALUE keys;
|
|
51
|
-
int i;
|
|
52
|
-
for (i = 0; i < keywords; i++) {
|
|
53
|
-
st_data_t key = ID2SYM(table[i]);
|
|
54
|
-
st_delete(tbl, &key, NULL);
|
|
55
|
-
}
|
|
56
|
-
keys = rb_funcallv(hash, rb_intern("keys"), 0, 0);
|
|
57
|
-
if (!RB_TYPE_P(keys, T_ARRAY)) rb_raise(rb_eArgError, "unknown keyword");
|
|
58
|
-
rb_keyword_error("unknown", keys);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
static int separate_symbol(st_data_t key, st_data_t value, st_data_t arg) {
|
|
62
|
-
VALUE* kwdhash = (VALUE*)arg;
|
|
63
|
-
|
|
64
|
-
if (!SYMBOL_P(key)) kwdhash++;
|
|
65
|
-
if (!*kwdhash) *kwdhash = rb_hash_new();
|
|
66
|
-
rb_hash_aset(*kwdhash, (VALUE)key, (VALUE)value);
|
|
67
|
-
return ST_CONTINUE;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
VALUE
|
|
71
|
-
rb_extract_keywords(VALUE* orighash) {
|
|
72
|
-
VALUE parthash[2] = { 0, 0 };
|
|
73
|
-
VALUE hash = *orighash;
|
|
74
|
-
|
|
75
|
-
if (RHASH_EMPTY_P(hash)) {
|
|
76
|
-
*orighash = 0;
|
|
77
|
-
return hash;
|
|
78
|
-
}
|
|
79
|
-
st_foreach(rb_hash_tbl_raw(hash), separate_symbol, (st_data_t)&parthash);
|
|
80
|
-
*orighash = parthash[1];
|
|
81
|
-
if (parthash[1] && RBASIC_CLASS(hash) != rb_cHash) {
|
|
82
|
-
RBASIC_SET_CLASS(parthash[1], RBASIC_CLASS(hash));
|
|
83
|
-
}
|
|
84
|
-
return parthash[0];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
int rb_get_kwargs(
|
|
88
|
-
VALUE keyword_hash, const ID* table, int required, int optional, VALUE* values
|
|
89
|
-
) {
|
|
90
|
-
int i = 0, j;
|
|
91
|
-
int rest = 0;
|
|
92
|
-
VALUE missing = Qnil;
|
|
93
|
-
st_data_t key;
|
|
94
|
-
|
|
95
|
-
#define extract_kwarg(keyword, val) \
|
|
96
|
-
(key = (st_data_t)(keyword), values ? st_delete(rb_hash_tbl_raw(keyword_hash), &key, (val)) \
|
|
97
|
-
: st_lookup(rb_hash_tbl_raw(keyword_hash), key, (val)))
|
|
98
|
-
|
|
99
|
-
if (NIL_P(keyword_hash)) keyword_hash = 0;
|
|
100
|
-
|
|
101
|
-
if (optional < 0) {
|
|
102
|
-
rest = 1;
|
|
103
|
-
optional = -1 - optional;
|
|
104
|
-
}
|
|
105
|
-
if (values) {
|
|
106
|
-
for (j = 0; j < required + optional; j++) {
|
|
107
|
-
values[j] = Qundef;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
if (required) {
|
|
111
|
-
for (; i < required; i++) {
|
|
112
|
-
VALUE keyword = ID2SYM(table[i]);
|
|
113
|
-
if (keyword_hash) {
|
|
114
|
-
st_data_t val;
|
|
115
|
-
if (extract_kwarg(keyword, &val)) {
|
|
116
|
-
if (values) values[i] = (VALUE)val;
|
|
117
|
-
continue;
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
if (NIL_P(missing)) missing = rb_ary_tmp_new(1);
|
|
121
|
-
rb_ary_push(missing, keyword);
|
|
122
|
-
}
|
|
123
|
-
if (!NIL_P(missing)) {
|
|
124
|
-
rb_keyword_error("missing", missing);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
j = i;
|
|
128
|
-
if (optional && keyword_hash) {
|
|
129
|
-
for (i = 0; i < optional; i++) {
|
|
130
|
-
st_data_t val;
|
|
131
|
-
if (extract_kwarg(ID2SYM(table[required + i]), &val)) {
|
|
132
|
-
if (values) values[required + i] = (VALUE)val;
|
|
133
|
-
j++;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
if (!rest && keyword_hash) {
|
|
138
|
-
if (RHASH_SIZE(keyword_hash) > (unsigned int)(values ? 0 : j)) {
|
|
139
|
-
unknown_keyword_error(keyword_hash, table, required + optional);
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
return j;
|
|
143
|
-
#undef extract_kwarg
|
|
144
|
-
}
|