Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-11, windows-2022]
ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1', head]
ruby: [ '2.5', '2.6', '2.7', '3.0', '3.1', '3.2', '3.3', head]
include:
- { os: windows-2022 , ruby: mswin }
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Build and Install
run: |
gem install --no-document bundler
gem build numo-narray.gemspec
gem install numo-narray-*.gem
bundle install
Expand All @@ -37,14 +36,13 @@ jobs:
matrix:
ruby: [ 'debug' ]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Build and Install
run: |
gem install --no-document bundler
gem build numo-narray.gemspec
gem install numo-narray-*.gem
bundle install
Expand Down
1 change: 1 addition & 0 deletions ext/numo/narray/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def d(file)
end
have_func("exp10")
have_func("rb_arithmetic_sequence_extract")
have_func("RTYPEDDATA_GET_DATA")

have_var("rb_cComplex")

Expand Down
4 changes: 2 additions & 2 deletions ext/numo/narray/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ na_parse_enumerator_step(VALUE enum_obj, VALUE *pstep )
if (!RB_TYPE_P(enum_obj, T_DATA)) {
rb_raise(rb_eTypeError,"wrong argument type (not T_DATA)");
}
e = (struct enumerator *)DATA_PTR(enum_obj);
e = RENUMERATOR_PTR(enum_obj);

if (!rb_obj_is_kind_of(e->obj, rb_cRange)) {
rb_raise(rb_eTypeError,"not Range object");
Expand Down Expand Up @@ -306,7 +306,7 @@ na_parse_enumerator(VALUE enum_obj, int orig_dim, ssize_t size, na_index_arg_t *
rb_raise(rb_eTypeError,"wrong argument type (not T_DATA)");
}
na_parse_enumerator_step(enum_obj, &step);
e = (struct enumerator *)DATA_PTR(enum_obj);
e = RENUMERATOR_PTR(enum_obj);
na_parse_range(e->obj, NUM2SSIZET(step), orig_dim, size, q); // e->obj : Range Object
}

Expand Down
6 changes: 6 additions & 0 deletions ext/numo/narray/numo/narray.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,12 @@ _na_get_narray_t(VALUE obj, unsigned char na_type)
#define RNARRAY_VIEW(val) ((narray_view_t*)DATA_PTR(val))
#define RNARRAY_FILEMAP(val) ((narray_filemap_t*)DATA_PTR(val))

#ifdef HAVE_RTYPEDDATA_GET_DATA
#define RENUMERATOR_PTR(ptr) ((struct enumerator *)RTYPEDDATA_GET_DATA(ptr))
#else
#define RENUMERATOR_PTR(ptr) ((struct enumerator *)DATA_PTR(ptr))
#endif

#define RNARRAY_NDIM(val) (RNARRAY(val)->ndim)
#define RNARRAY_TYPE(val) (RNARRAY(val)->type)
#define RNARRAY_FLAG(val) (RNARRAY(val)->flag)
Expand Down
4 changes: 2 additions & 2 deletions ext/numo/narray/step.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ nary_step_array_index(VALUE obj, size_t ary_size,
vstep = rb_ivar_get(obj, id_step);
} else { // Enumerator
na_parse_enumerator_step(obj, &vstep);
e = (struct enumerator *)DATA_PTR(obj);
e = RENUMERATOR_PTR(obj);
obj = e->obj; // Range
}

Expand Down Expand Up @@ -208,7 +208,7 @@ nary_step_sequence( VALUE obj, size_t *plen, double *pbeg, double *pstep )
vstep = rb_ivar_get(obj, id_step);
} else { // Enumerator
na_parse_enumerator_step(obj, &vstep);
e = (struct enumerator *)DATA_PTR(obj);
e = RENUMERATOR_PTR(obj);
obj = e->obj; // Range
}

Expand Down
5 changes: 0 additions & 5 deletions numo-narray.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"]
spec.extensions = ["ext/numo/narray/extconf.rb"]

if RUBY_VERSION < '2.3' # Ruby 2.2.x
spec.add_development_dependency "bundler", "~> 1.3", "< 1.14.0"
else
spec.add_development_dependency "bundler", ">= 2.2.33"
end
spec.add_development_dependency "rake", ">= 12.3.3"
spec.add_development_dependency "rake-compiler", "~> 1.1"
spec.add_development_dependency "test-unit"
Expand Down