carray 3.0.6 → 3.1.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/.yardopts +1 -1
- data/CHANGELOG.md +7 -1830
- data/README.md +62 -35
- data/carray.gemspec +16 -4
- data/docs/changelogs/CHANGELOG-3.0.md +2464 -0
- data/ext/ca_array_pool.c +4 -5
- data/ext/ca_axis_descriptor.h +45 -30
- data/ext/ca_axis_dispatch.c +7 -4
- data/ext/ca_axis_group.c +12 -15
- data/ext/ca_bincmp_dispatch.h +16 -38
- data/ext/ca_binop_dispatch.c +35 -0
- data/ext/ca_binop_dispatch.h +22 -46
- data/ext/ca_categorical_iterator.c +36 -34
- data/ext/ca_compare.c +0 -1
- data/ext/ca_compare.h +8 -1
- data/ext/ca_composite_dispatch.h +6 -0
- data/ext/ca_for_buffer.h +6 -1
- data/ext/ca_group_iter.c +17 -18
- data/ext/ca_iter_state_fields.h +196 -0
- data/ext/ca_iter_substrate.h +84 -103
- data/ext/ca_kernel_iterator.c +125 -89
- data/ext/ca_kernel_iterator.h +229 -1504
- data/ext/ca_kernel_iterator_internal.h +1167 -0
- data/ext/ca_moncmp_dispatch.h +17 -24
- data/ext/ca_monop_dispatch.h +25 -74
- data/ext/ca_obj_array.c +92 -165
- data/ext/ca_obj_bincmp.c +65 -48
- data/ext/ca_obj_binop.c +74 -49
- data/ext/ca_obj_bitarray.c +7 -21
- data/ext/ca_obj_bitfield.c +93 -26
- data/ext/ca_obj_block.c +11 -12
- data/ext/ca_obj_byte_swap.c +34 -34
- data/ext/ca_obj_const_string.c +464 -304
- data/ext/ca_obj_face.c +167 -121
- data/ext/ca_obj_face.h +32 -170
- data/ext/ca_obj_fake.c +127 -34
- data/ext/ca_obj_farray.c +13 -9
- data/ext/ca_obj_field.c +17 -13
- data/ext/ca_obj_fixlen_string.c +57 -34
- data/ext/ca_obj_grid.c +149 -113
- data/ext/ca_obj_meld.c +28 -26
- data/ext/ca_obj_moncmp.c +10 -21
- data/ext/ca_obj_monop.c +88 -73
- data/ext/ca_obj_object.c +60 -46
- data/ext/ca_obj_record.c +74 -22
- data/ext/ca_obj_reduce.c +10 -14
- data/ext/ca_obj_refer.c +146 -39
- data/ext/ca_obj_remap.c +11 -29
- data/ext/ca_obj_repeat.c +41 -23
- data/ext/ca_obj_roll.c +20 -28
- data/ext/ca_obj_select.c +17 -27
- data/ext/ca_obj_select_axis.c +35 -42
- data/ext/ca_obj_shift.c +22 -42
- data/ext/ca_obj_source.c +1 -5
- data/ext/ca_obj_stack.c +33 -29
- data/ext/ca_obj_stride.c +99 -62
- data/ext/ca_obj_string.c +8 -20
- data/ext/ca_obj_tile.c +14 -16
- data/ext/ca_obj_time.c +12 -23
- data/ext/ca_obj_timedelta.c +12 -23
- data/ext/ca_obj_transpose.c +8 -10
- data/ext/ca_obj_triop.c +48 -49
- data/ext/ca_obj_window.c +87 -99
- data/ext/ca_op_cmplx64.h +4 -0
- data/ext/ca_op_ipower.c +97 -27
- data/ext/ca_op_powi.h +9 -28
- data/ext/ca_pow5_table.h +2 -1
- data/ext/ca_rng_normal.h +4 -0
- data/ext/ca_rng_xoshiro256pp.h +3 -0
- data/ext/ca_sort_kernels.h +23 -26
- data/ext/ca_sweep_engine.c +92 -26
- data/ext/ca_sweep_engine.h +22 -15
- data/ext/ca_transform_common.c +3 -8
- data/ext/ca_triop_dispatch.h +20 -32
- data/ext/caframe_csv_reader.c +12 -12
- data/ext/carray.h +300 -1009
- data/ext/carray_access.c +320 -207
- data/ext/carray_address_basis.c +128 -59
- data/ext/carray_attribute.c +81 -104
- data/ext/carray_bincount.c +12 -14
- data/ext/carray_broadcast.c +31 -27
- data/ext/carray_call_cfunc.c +174 -285
- data/ext/carray_call_cfunc.h +36 -28
- data/ext/carray_cast.c +1191 -351
- data/ext/carray_cast_func.rb +68 -8
- data/ext/carray_class.c +6 -11
- data/ext/carray_conversion.c +98 -39
- data/ext/carray_copy.c +52 -26
- data/ext/carray_core.c +286 -132
- data/ext/carray_count.c +53 -22
- data/ext/carray_element.c +49 -28
- data/ext/carray_factorize.c +64 -63
- data/ext/carray_generate.c +26 -19
- data/ext/carray_histogram.c +9 -11
- data/ext/carray_hold.c +7 -9
- data/ext/carray_index_classifier.c +127 -230
- data/ext/carray_index_classifier.h +11 -10
- data/ext/carray_integer_total.c +523 -0
- data/ext/carray_internal.h +1364 -156
- data/ext/carray_key_windows.c +3 -3
- data/ext/carray_lazy.c +37 -37
- data/ext/carray_loop.c +27 -23
- data/ext/carray_mask.c +235 -150
- data/ext/carray_math_kernel.h +23 -47
- data/ext/carray_mathfunc.c +10 -3
- data/ext/carray_median_percentile.c +106 -100
- data/ext/carray_memory_view.c +83 -69
- data/ext/carray_operator.c +490 -128
- data/ext/carray_order.c +163 -84
- data/ext/carray_partition.c +14 -16
- data/ext/carray_random.c +48 -42
- data/ext/carray_round.c +33 -5
- data/ext/carray_scatter.c +57 -39
- data/ext/carray_segment.c +42 -46
- data/ext/carray_slab.c +77 -51
- data/ext/carray_slab.h +44 -33
- data/ext/carray_sort.c +37 -31
- data/ext/carray_sort_kernel.c +36 -10
- data/ext/carray_struct.c +44 -34
- data/ext/carray_test.c +131 -81
- data/ext/carray_time_text.c +30 -31
- data/ext/carray_undef.c +50 -7
- data/ext/carray_utils.c +373 -139
- data/ext/extconf.rb +24 -17
- data/ext/mk_call_cfunc.rb +25 -31
- data/ext/mk_pow5_table.rb +2 -1
- data/ext/mkkernel.rb +819 -488
- data/ext/ruby_carray.c +47 -42
- data/ext/version.h +7 -5
- data/lib/carray/attribute.rb +19 -18
- data/lib/carray/autoload_carray.rb +20 -15
- data/lib/carray/autoload_method_extension.rb +64 -57
- data/lib/carray/axis_group.rb +272 -185
- data/lib/carray/basics.rb +298 -56
- data/lib/carray/bincount_nd.rb +41 -18
- data/lib/carray/block_iterator.rb +167 -119
- data/lib/carray/boolean_reduce.rb +7 -4
- data/lib/carray/categorical.rb +84 -59
- data/lib/carray/categorical_iterator.rb +90 -67
- data/lib/carray/complex.rb +61 -41
- data/lib/carray/conditional.rb +98 -23
- data/lib/carray/const_string.rb +112 -46
- data/lib/carray/core_extensions.rb +20 -69
- data/lib/carray/distance_limit.rb +7 -5
- data/lib/carray/factories.rb +269 -0
- data/lib/carray/fixlen_string.rb +95 -12
- data/lib/carray/frame/column_verbs.rb +76 -9
- data/lib/carray/frame/concat.rb +51 -7
- data/lib/carray/frame/convert.rb +2 -1
- data/lib/carray/frame/csv_parser.rb +20 -5
- data/lib/carray/frame/frame.rb +73 -31
- data/lib/carray/frame/group.rb +247 -187
- data/lib/carray/frame/io.rb +36 -12
- data/lib/carray/frame/join.rb +56 -17
- data/lib/carray/frame/records.rb +7 -5
- data/lib/carray/frame/reshape.rb +27 -7
- data/lib/carray/frame/sort.rb +10 -8
- data/lib/carray/frame/verbs.rb +217 -134
- data/lib/carray/frame/windows.rb +254 -19
- data/lib/carray/frame.rb +1 -2
- data/lib/carray/fuse_source.rb +28 -23
- data/lib/carray/fusion.rb +30 -30
- data/lib/carray/histogram.rb +35 -16
- data/lib/carray/inspect.rb +7 -7
- data/lib/carray/iterator.rb +104 -23
- data/lib/carray/key_windows.rb +93 -61
- data/lib/carray/lazy.rb +208 -111
- data/lib/carray/limits.rb +80 -0
- data/lib/carray/mask_gap_fill.rb +21 -16
- data/lib/carray/math.rb +87 -50
- data/lib/carray/meld_reduce.rb +30 -8
- data/lib/carray/methods/align_addr.rb +29 -17
- data/lib/carray/methods/bin.rb +8 -1
- data/lib/carray/methods/bincount.rb +4 -2
- data/lib/carray/methods/bit_string.rb +19 -31
- data/lib/carray/methods/broadcast.rb +8 -3
- data/lib/carray/methods/choose.rb +5 -5
- data/lib/carray/methods/composition.rb +73 -72
- data/lib/carray/methods/{index.rb → coordinate.rb} +13 -13
- data/lib/carray/methods/discovery_along.rb +3 -3
- data/lib/carray/methods/factorize.rb +2 -0
- data/lib/carray/methods/gather_nd.rb +106 -103
- data/lib/carray/methods/insert_block.rb +2 -2
- data/lib/carray/methods/is_between.rb +6 -4
- data/lib/carray/methods/is_in.rb +183 -143
- data/lib/carray/methods/join.rb +2 -1
- data/lib/carray/methods/lag.rb +6 -2
- data/lib/carray/methods/locate_addr.rb +157 -94
- data/lib/carray/methods/mask_duplicates.rb +1 -1
- data/lib/carray/methods/meshgrid.rb +28 -16
- data/lib/carray/methods/mode.rb +67 -67
- data/lib/carray/methods/nunique.rb +9 -7
- data/lib/carray/methods/repeat.rb +23 -13
- data/lib/carray/methods/resize.rb +1 -1
- data/lib/carray/methods/snap.rb +24 -20
- data/lib/carray/methods/string_format.rb +2 -2
- data/lib/carray/methods/unique.rb +4 -2
- data/lib/carray/methods/value_counts.rb +1 -1
- data/lib/carray/mkmf.rb +25 -28
- data/lib/carray/percentile_arguments.rb +82 -0
- data/lib/carray/record_order.rb +50 -20
- data/lib/carray/rng.rb +1 -0
- data/lib/carray/runtime.rb +195 -17
- data/lib/carray/segment_iterator.rb +262 -137
- data/lib/carray/serialize.rb +635 -566
- data/lib/carray/slab_iterator.rb +114 -114
- data/lib/carray/stack.rb +14 -15
- data/lib/carray/string.rb +16 -22
- data/lib/carray/string_operation_extension.rb +97 -52
- data/lib/carray/struct.rb +122 -164
- data/lib/carray/struct_builder.rb +247 -73
- data/lib/carray/time.rb +663 -365
- data/lib/carray/window_iterator.rb +232 -155
- data/lib/carray.rb +6 -11
- data/yard-stubs/ca_obj_array.rb +20 -135
- data/yard-stubs/ca_obj_bitarray.rb +1 -8
- data/yard-stubs/ca_obj_bitfield.rb +6 -2
- data/yard-stubs/ca_obj_byte_swap.rb +21 -7
- data/yard-stubs/ca_obj_fake.rb +3 -1
- data/yard-stubs/ca_obj_farray.rb +1 -1
- data/yard-stubs/ca_obj_field.rb +8 -6
- data/yard-stubs/ca_obj_refer.rb +10 -5
- data/yard-stubs/ca_obj_roll.rb +7 -6
- data/yard-stubs/ca_obj_shift.rb +2 -3
- data/yard-stubs/ca_obj_stride.rb +5 -7
- data/yard-stubs/ca_obj_tile.rb +1 -1
- data/yard-stubs/ca_obj_time.rb +43 -0
- data/yard-stubs/ca_obj_transpose.rb +1 -1
- data/yard-stubs/ca_obj_window.rb +28 -16
- data/yard-stubs/carray_access.rb +55 -6
- data/yard-stubs/carray_attribute.rb +26 -38
- data/yard-stubs/carray_cast.rb +121 -162
- data/yard-stubs/carray_class.rb +3 -4
- data/yard-stubs/carray_conversion.rb +6 -7
- data/yard-stubs/carray_copy.rb +2 -1
- data/yard-stubs/carray_count.rb +10 -5
- data/yard-stubs/carray_element.rb +4 -3
- data/yard-stubs/carray_limits.rb +100 -0
- data/yard-stubs/carray_loop.rb +0 -20
- data/yard-stubs/carray_mask.rb +59 -41
- data/yard-stubs/carray_math.rb +162 -100
- data/yard-stubs/carray_mathfunc.rb +415 -3
- data/yard-stubs/carray_median_percentile.rb +29 -11
- data/yard-stubs/carray_memory_view.rb +2 -2
- data/yard-stubs/carray_order.rb +72 -33
- data/yard-stubs/carray_random.rb +6 -6
- data/yard-stubs/carray_reduce.rb +353 -0
- data/yard-stubs/carray_rng.rb +92 -0
- data/yard-stubs/carray_scatter.rb +12 -3
- data/yard-stubs/carray_slab.rb +7 -4
- data/yard-stubs/carray_sort.rb +7 -6
- data/yard-stubs/carray_test.rb +18 -5
- data/yard-stubs/carray_undef.rb +44 -5
- data/yard-stubs/ruby_carray.rb +75 -40
- metadata +63 -25
- data/CHANGELOG.v1.md +0 -126
- data/ext/carray_build_flags.h +0 -3
- data/ext/carray_config.h +0 -28
- data/ext/carray_data_type.c +0 -90
- data/ext/carray_kernels_bincmp.c +0 -6457
- data/ext/carray_kernels_binop.c +0 -31534
- data/ext/carray_kernels_init.c +0 -1734
- data/ext/carray_kernels_moncmp.c +0 -2104
- data/ext/carray_kernels_monop.c +0 -25387
- data/ext/carray_kernels_reduce_aggregate.c +0 -27545
- data/ext/carray_kernels_reduce_boolean.c +0 -1924
- data/ext/carray_kernels_reduce_cumulative.c +0 -11646
- data/ext/carray_kernels_reduce_extreme.c +0 -21631
- data/ext/carray_kernels_reduce_variance.c +0 -5981
- data/ext/carray_kernels_scan.c +0 -4302
- data/ext/carray_kernels_search.c +0 -37776
- data/ext/carray_kernels_sort.c +0 -10814
- data/ext/carray_kernels_triop.c +0 -1864
- data/lib/carray/construct.rb +0 -360
- data/lib/carray/data_type_extension.rb +0 -261
- data/lib/carray/data_type_limits.rb +0 -91
data/ext/ca_obj_roll.c
CHANGED
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
---------------------------------------------------------------------------- */
|
|
18
18
|
|
|
19
19
|
#include "carray.h"
|
|
20
|
-
#include "carray_internal.h"
|
|
21
20
|
#include "ca_composite_dispatch.h"
|
|
22
21
|
#include "ca_obj_face.h"
|
|
23
22
|
|
|
@@ -55,7 +54,7 @@ const rb_data_type_t caroll_data_type = {
|
|
|
55
54
|
|
|
56
55
|
const rb_data_type_t caroll_mask_data_type = {
|
|
57
56
|
.parent = &caroll_data_type,
|
|
58
|
-
.wrap_struct_name = "
|
|
57
|
+
.wrap_struct_name = "CARoll::Mask",
|
|
59
58
|
.function = {
|
|
60
59
|
.dmark = ca_mark,
|
|
61
60
|
.dfree = ca_free_nop,
|
|
@@ -65,7 +64,7 @@ const rb_data_type_t caroll_mask_data_type = {
|
|
|
65
64
|
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
|
66
65
|
};
|
|
67
66
|
|
|
68
|
-
|
|
67
|
+
int16_t CA_OBJ_ROLL;
|
|
69
68
|
|
|
70
69
|
VALUE rb_cCARoll;
|
|
71
70
|
VALUE rb_cCARollMask;
|
|
@@ -80,7 +79,7 @@ ca_operation_function_t ca_roll_func;
|
|
|
80
79
|
shift[k] > 0 : shift right (last shift[k] elements wrap to front)
|
|
81
80
|
shift[k] < 0 : shift left
|
|
82
81
|
shift[k] is normalised into [0, parent.dim[k]) modulo dim[k].
|
|
83
|
-
|
|
82
|
+
Ruby's roll takes one shift for each axis. */
|
|
84
83
|
int
|
|
85
84
|
ca_roll_setup (CARoll *ca, CArray *parent, ca_size_t *shift)
|
|
86
85
|
{
|
|
@@ -525,16 +524,14 @@ static void
|
|
|
525
524
|
ca_roll_func_allocate (void *ap)
|
|
526
525
|
{
|
|
527
526
|
CARoll *ca = (CARoll *) ap;
|
|
528
|
-
|
|
529
|
-
ca->ptr = ca_alloc_cells((CArray *) ca);
|
|
527
|
+
ca->ptr = ca_alloc_cells_then_attach((CArray *) ca, 1, &ca->parent);
|
|
530
528
|
}
|
|
531
529
|
|
|
532
530
|
static void
|
|
533
531
|
ca_roll_func_attach (void *ap)
|
|
534
532
|
{
|
|
535
533
|
CARoll *ca = (CARoll *) ap;
|
|
536
|
-
|
|
537
|
-
ca->ptr = ca_alloc_cells((CArray *) ca);
|
|
534
|
+
ca->ptr = ca_alloc_cells_then_attach((CArray *) ca, 1, &ca->parent);
|
|
538
535
|
ca_roll_iterate_regions(ca, ca->ptr, 0);
|
|
539
536
|
}
|
|
540
537
|
|
|
@@ -611,48 +608,43 @@ ca_roll_func_create_mask (void *ap)
|
|
|
611
608
|
/* ------------------------------------------------------------------- */
|
|
612
609
|
|
|
613
610
|
VALUE
|
|
614
|
-
rb_ca_roll_new (VALUE cary, ca_size_t *shift)
|
|
611
|
+
rb_ca_roll_new (volatile VALUE cary, ca_size_t *shift)
|
|
615
612
|
{
|
|
616
613
|
volatile VALUE obj;
|
|
617
614
|
CArray *parent;
|
|
618
615
|
CARoll *ca;
|
|
619
616
|
rb_check_carray_object(cary);
|
|
620
|
-
|
|
617
|
+
GetCArray(cary, parent);
|
|
621
618
|
ca = ca_roll_new(parent, shift);
|
|
622
619
|
obj = ca_wrap_struct(ca);
|
|
623
620
|
rb_ca_set_parent(obj, cary);
|
|
624
621
|
return obj;
|
|
625
622
|
}
|
|
626
623
|
|
|
627
|
-
/* CArray#roll(*shifts) — cyclic shift along each axis
|
|
628
|
-
|
|
629
|
-
argc > ndim : ArgumentError. */
|
|
624
|
+
/* CArray#roll(*shifts) — cyclic shift along each axis, one shift per
|
|
625
|
+
axis (ndim of them); any other number is an ArgumentError. */
|
|
630
626
|
static VALUE
|
|
631
|
-
rb_ca_roll (int argc, VALUE *argv, VALUE self)
|
|
627
|
+
rb_ca_roll (int argc, VALUE *argv, volatile VALUE self)
|
|
632
628
|
{
|
|
633
629
|
CArray *ca;
|
|
634
630
|
volatile VALUE ropt;
|
|
635
631
|
ca_size_t shift[CA_RANK_MAX];
|
|
636
632
|
int8_t i;
|
|
637
633
|
|
|
638
|
-
|
|
634
|
+
GetCArray(self, ca);
|
|
639
635
|
|
|
640
636
|
/* Shifts are positional only. A trailing Hash is a keyword argument
|
|
641
637
|
that would otherwise reach NUM2SIZE and surface as a TypeError. */
|
|
642
638
|
ropt = rb_pop_options(&argc, &argv);
|
|
643
639
|
rb_reject_options(ropt);
|
|
644
640
|
|
|
645
|
-
if ( argc
|
|
641
|
+
if ( argc != ca->ndim ) {
|
|
646
642
|
rb_raise(rb_eArgError,
|
|
647
|
-
"roll:
|
|
648
|
-
|
|
643
|
+
"roll: give one shift per axis (%d for this array, got %d)",
|
|
644
|
+
(int) ca->ndim, argc);
|
|
649
645
|
}
|
|
650
646
|
for ( i = 0; i < ca->ndim; i++ ) {
|
|
651
|
-
|
|
652
|
-
shift[i] = ca_integer_arg(argv[i], "a shift", NULL);
|
|
653
|
-
} else {
|
|
654
|
-
shift[i] = 0;
|
|
655
|
-
}
|
|
647
|
+
shift[i] = ca_integer_arg(argv[i], "a shift", NULL);
|
|
656
648
|
}
|
|
657
649
|
{
|
|
658
650
|
VALUE obj = rb_ca_roll_new(self, shift);
|
|
@@ -672,7 +664,7 @@ rb_ca_roll_s_allocate (VALUE klass)
|
|
|
672
664
|
}
|
|
673
665
|
|
|
674
666
|
static VALUE
|
|
675
|
-
rb_ca_roll_initialize_copy (VALUE self, VALUE other)
|
|
667
|
+
rb_ca_roll_initialize_copy (volatile VALUE self, volatile VALUE other)
|
|
676
668
|
{
|
|
677
669
|
CARoll *ca, *cs;
|
|
678
670
|
TypedData_Get_Struct(self, CARoll, &caroll_data_type, ca);
|
|
@@ -687,12 +679,13 @@ rb_ca_roll_initialize_copy (VALUE self, VALUE other)
|
|
|
687
679
|
/* Debug-only accessor returning the roll descriptor as a Hash
|
|
688
680
|
(`shifts`, `n_regions`, `ndim`). Not part of the public surface. */
|
|
689
681
|
static VALUE
|
|
690
|
-
rb_ca_roll_descriptor (VALUE self)
|
|
682
|
+
rb_ca_roll_descriptor (volatile VALUE self)
|
|
691
683
|
{
|
|
692
|
-
CARoll *ca
|
|
684
|
+
CARoll *ca;
|
|
693
685
|
VALUE hash, shifts_ary;
|
|
694
686
|
int8_t k;
|
|
695
687
|
int n_shifted = 0;
|
|
688
|
+
TypedData_Get_Struct(self, CARoll, &caroll_data_type, ca);
|
|
696
689
|
|
|
697
690
|
shifts_ary = rb_ary_new_capa(ca->ndim);
|
|
698
691
|
for ( k = 0; k < ca->ndim; k++ ) {
|
|
@@ -727,14 +720,13 @@ Init_ca_obj_roll (void)
|
|
|
727
720
|
ca_roll_func.xfer_all = ca_roll_func_xfer_all;
|
|
728
721
|
|
|
729
722
|
rb_cCARoll = rb_define_class("CARoll", rb_cCATile);
|
|
730
|
-
rb_cCARollMask =
|
|
723
|
+
rb_cCARollMask = rb_define_class_under(rb_cCARoll, "Mask", rb_cCARoll);
|
|
731
724
|
|
|
732
725
|
CA_OBJ_ROLL = ca_install_obj_type(rb_cCARoll,
|
|
733
726
|
&caroll_data_type,
|
|
734
727
|
rb_cCARollMask,
|
|
735
728
|
&caroll_mask_data_type, &ca_roll_func, sizeof(ca_roll_func));
|
|
736
729
|
ca_register_cell_moving_view(CA_OBJ_ROLL);
|
|
737
|
-
rb_define_const(rb_cObject, "CA_OBJ_ROLL", INT2NUM(CA_OBJ_ROLL));
|
|
738
730
|
|
|
739
731
|
rb_define_method(rb_cCArray, "roll", rb_ca_roll, -1);
|
|
740
732
|
|
data/ext/ca_obj_select.c
CHANGED
|
@@ -15,20 +15,10 @@
|
|
|
15
15
|
---------------------------------------------------------------------------- */
|
|
16
16
|
|
|
17
17
|
#include "carray.h"
|
|
18
|
-
#include "carray_internal.h" /* per-obj_type view constructors */
|
|
19
18
|
#include "ca_obj_face.h"
|
|
20
19
|
|
|
21
20
|
typedef struct {
|
|
22
|
-
|
|
23
|
-
int8_t data_type;
|
|
24
|
-
int8_t ndim;
|
|
25
|
-
int32_t flags;
|
|
26
|
-
ca_size_t bytes;
|
|
27
|
-
ca_size_t elements;
|
|
28
|
-
ca_size_t *dim; /* point to _dim */
|
|
29
|
-
char *ptr;
|
|
30
|
-
CArray *mask;
|
|
31
|
-
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path). */
|
|
21
|
+
CA_ARRAY_HEADER
|
|
32
22
|
CArray *parent;
|
|
33
23
|
uint32_t attach;
|
|
34
24
|
uint8_t nosync;
|
|
@@ -67,7 +57,7 @@ const rb_data_type_t caselect_data_type = {
|
|
|
67
57
|
|
|
68
58
|
const rb_data_type_t caselect_mask_data_type = {
|
|
69
59
|
.parent = &caselect_data_type,
|
|
70
|
-
.wrap_struct_name = "
|
|
60
|
+
.wrap_struct_name = "CASelect::Mask",
|
|
71
61
|
.function = {
|
|
72
62
|
.dmark = NULL,
|
|
73
63
|
.dfree = ca_free_nop,
|
|
@@ -465,9 +455,11 @@ ca_select_func_allocate (void *ap)
|
|
|
465
455
|
{
|
|
466
456
|
CASelect *ca = (CASelect *) ap;
|
|
467
457
|
if ( ! ca_parent_lends_no_memory(ca->parent) ) {
|
|
468
|
-
|
|
458
|
+
ca->ptr = ca_alloc_cells_then_attach((CArray *) ca, 1, &ca->parent);
|
|
459
|
+
}
|
|
460
|
+
else {
|
|
461
|
+
ca->ptr = ca_alloc_cells((CArray *) ca);
|
|
469
462
|
}
|
|
470
|
-
ca->ptr = ca_alloc_cells((CArray *) ca);
|
|
471
463
|
}
|
|
472
464
|
|
|
473
465
|
static void
|
|
@@ -482,10 +474,10 @@ ca_select_func_attach (void *ap)
|
|
|
482
474
|
return;
|
|
483
475
|
}
|
|
484
476
|
|
|
485
|
-
|
|
477
|
+
ca->ptr = ca_alloc_cells_then_attach((CArray *) ca, 1, &ca->parent);
|
|
486
478
|
ca_select_describe_axes(ca, desc, pdims);
|
|
487
|
-
|
|
488
|
-
|
|
479
|
+
ca_axis_dispatch_gather(ca->parent, pdims, desc, ca->ndim,
|
|
480
|
+
ca->bytes, ca->elements, NULL, ca->ptr);
|
|
489
481
|
}
|
|
490
482
|
|
|
491
483
|
static void
|
|
@@ -554,8 +546,7 @@ ca_select_func_fill_data (void *ap, void *ptr)
|
|
|
554
546
|
the unselected cells make the round trip for nothing -- and through a
|
|
555
547
|
lossy transform layer they do not come back the same. Descend per cell
|
|
556
548
|
instead; the cost then follows the selection. Kept in step with the
|
|
557
|
-
CAStride form, so both spellings of a partial fill behave alike.
|
|
558
|
-
(PROPOSAL_PARTIAL_FILL_WHOLE_ROOT_WRITEBACK.md sections 3.3 / 6.2) */
|
|
549
|
+
CAStride form, so both spellings of a partial fill behave alike. */
|
|
559
550
|
if ( !ca_is_attached(ca->parent) && !ca_attach_is_alias(ca->parent) ) {
|
|
560
551
|
/* indices[] are already the selected positions in the parent's flat
|
|
561
552
|
space, so the selection passes down as it stands -- one hop, no
|
|
@@ -600,15 +591,15 @@ ca_operation_function_t ca_select_func = {
|
|
|
600
591
|
/* ------------------------------------------------------------------- */
|
|
601
592
|
|
|
602
593
|
VALUE
|
|
603
|
-
rb_ca_select_new (VALUE cary, VALUE select)
|
|
594
|
+
rb_ca_select_new (volatile VALUE cary, volatile VALUE select)
|
|
604
595
|
{
|
|
605
596
|
volatile VALUE obj;
|
|
606
597
|
CArray *parent, *cselect;
|
|
607
598
|
CASelect *ca;
|
|
608
599
|
rb_check_carray_object(cary);
|
|
609
600
|
rb_check_carray_object(select);
|
|
610
|
-
|
|
611
|
-
|
|
601
|
+
GetCArray(cary, parent);
|
|
602
|
+
GetCArray(select, cselect);
|
|
612
603
|
ca = (CASelect *) ca_select_new(parent, cselect);
|
|
613
604
|
if ( ! ca ) {
|
|
614
605
|
return Qnil;
|
|
@@ -620,7 +611,7 @@ rb_ca_select_new (VALUE cary, VALUE select)
|
|
|
620
611
|
}
|
|
621
612
|
|
|
622
613
|
VALUE
|
|
623
|
-
rb_ca_select_new_share (VALUE cary, VALUE select)
|
|
614
|
+
rb_ca_select_new_share (volatile VALUE cary, volatile VALUE select)
|
|
624
615
|
{
|
|
625
616
|
/* Alias of the snapshot constructor. The `referred_index` ivar is
|
|
626
617
|
set so consumers that expect the original selector to be
|
|
@@ -630,8 +621,8 @@ rb_ca_select_new_share (VALUE cary, VALUE select)
|
|
|
630
621
|
CASelect *ca;
|
|
631
622
|
rb_check_carray_object(cary);
|
|
632
623
|
rb_check_carray_object(select);
|
|
633
|
-
|
|
634
|
-
|
|
624
|
+
GetCArray(cary, parent);
|
|
625
|
+
GetCArray(select, cselect);
|
|
635
626
|
ca = (CASelect *) ca_select_new_share(parent, cselect);
|
|
636
627
|
if ( ! ca ) {
|
|
637
628
|
return Qnil;
|
|
@@ -652,7 +643,7 @@ rb_cm_s_allocate (VALUE klass)
|
|
|
652
643
|
}
|
|
653
644
|
|
|
654
645
|
static VALUE
|
|
655
|
-
rb_cm_initialize_copy (VALUE self, VALUE other)
|
|
646
|
+
rb_cm_initialize_copy (volatile VALUE self, volatile VALUE other)
|
|
656
647
|
{
|
|
657
648
|
CASelect *ca, *cs;
|
|
658
649
|
|
|
@@ -673,7 +664,6 @@ Init_ca_obj_select (void)
|
|
|
673
664
|
ca_register_cell_moving_view(CA_OBJ_SELECT);
|
|
674
665
|
/* rb_cCASelect and CA_OBJ_SELECT are defined in ruby_carray.c;
|
|
675
666
|
this file only registers the constant + allocator. */
|
|
676
|
-
rb_define_const(rb_cObject, "CA_OBJ_SELECT", INT2NUM(CA_OBJ_SELECT));
|
|
677
667
|
|
|
678
668
|
rb_define_alloc_func(rb_cCASelect, rb_cm_s_allocate);
|
|
679
669
|
rb_define_method(rb_cCASelect, "initialize_copy", rb_cm_initialize_copy, 1);
|
data/ext/ca_obj_select_axis.c
CHANGED
|
@@ -18,20 +18,10 @@
|
|
|
18
18
|
---------------------------------------------------------------------------- */
|
|
19
19
|
|
|
20
20
|
#include "carray.h"
|
|
21
|
-
#include "carray_internal.h" /* ca_select_snapshot */
|
|
22
21
|
|
|
23
22
|
typedef struct {
|
|
24
23
|
/* CAView prefix (mirrors carray.h ca_virtual layout) */
|
|
25
|
-
|
|
26
|
-
int8_t data_type;
|
|
27
|
-
int8_t ndim;
|
|
28
|
-
int32_t flags;
|
|
29
|
-
ca_size_t bytes;
|
|
30
|
-
ca_size_t elements;
|
|
31
|
-
ca_size_t *dim;
|
|
32
|
-
char *ptr;
|
|
33
|
-
CArray *mask;
|
|
34
|
-
char *_pool; /* framework-managed pool buffer (NULL = legacy ALLOC_N path). */
|
|
24
|
+
CA_ARRAY_HEADER
|
|
35
25
|
CArray *parent;
|
|
36
26
|
uint32_t attach;
|
|
37
27
|
uint8_t nosync;
|
|
@@ -99,7 +89,7 @@ const rb_data_type_t caselectaxis_data_type = {
|
|
|
99
89
|
|
|
100
90
|
const rb_data_type_t caselectaxis_mask_data_type = {
|
|
101
91
|
.parent = &caselectaxis_data_type,
|
|
102
|
-
.wrap_struct_name = "
|
|
92
|
+
.wrap_struct_name = "CASelectAxis::Mask",
|
|
103
93
|
.function = {
|
|
104
94
|
.dmark = NULL,
|
|
105
95
|
.dfree = ca_free_nop,
|
|
@@ -109,7 +99,7 @@ const rb_data_type_t caselectaxis_mask_data_type = {
|
|
|
109
99
|
.flags = RUBY_TYPED_FREE_IMMEDIATELY
|
|
110
100
|
};
|
|
111
101
|
|
|
112
|
-
static
|
|
102
|
+
static int16_t CA_OBJ_SELECT_AXIS;
|
|
113
103
|
|
|
114
104
|
/* Benchmark-only bypass flag: when non-zero, rb_ca_grid skips the
|
|
115
105
|
CASelectAxis dispatch hook and falls through to the pre-CSA CAGrid path.
|
|
@@ -174,7 +164,9 @@ ca_select_axis_setup (CASelectAxis *ca, CArray *parent, int8_t indirect_axis,
|
|
|
174
164
|
}
|
|
175
165
|
if ( selector->dim[0] != parent->dim[indirect_axis] ) {
|
|
176
166
|
rb_raise(rb_eArgError,
|
|
177
|
-
"
|
|
167
|
+
"%s: boolean selector of %lld elements for axis %d of length %lld "
|
|
168
|
+
"(one element per index along the axis)",
|
|
169
|
+
ca_calling_method_name(),
|
|
178
170
|
(long long) selector->dim[0],
|
|
179
171
|
(int) indirect_axis,
|
|
180
172
|
(long long) parent->dim[indirect_axis]);
|
|
@@ -726,9 +718,11 @@ ca_select_axis_func_allocate (void *ap)
|
|
|
726
718
|
{
|
|
727
719
|
CASelectAxis *ca = (CASelectAxis *) ap;
|
|
728
720
|
if ( ! ca_parent_lends_no_memory(ca->parent) ) {
|
|
729
|
-
|
|
721
|
+
ca->ptr = ca_alloc_cells_then_attach((CArray *) ca, 1, &ca->parent);
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
ca->ptr = ca_alloc_cells((CArray *) ca);
|
|
730
725
|
}
|
|
731
|
-
ca->ptr = ca_alloc_cells((CArray *) ca);
|
|
732
726
|
}
|
|
733
727
|
|
|
734
728
|
static void
|
|
@@ -743,10 +737,10 @@ ca_select_axis_func_attach (void *ap)
|
|
|
743
737
|
return;
|
|
744
738
|
}
|
|
745
739
|
|
|
746
|
-
|
|
740
|
+
ca->ptr = ca_alloc_cells_then_attach((CArray *) ca, 1, &ca->parent);
|
|
747
741
|
ca_select_axis_describe_axes(ca, desc, pdims);
|
|
748
|
-
|
|
749
|
-
|
|
742
|
+
ca_axis_dispatch_gather(ca->parent, pdims, desc, ca->ndim,
|
|
743
|
+
ca->bytes, ca->elements, NULL, ca->ptr);
|
|
750
744
|
}
|
|
751
745
|
|
|
752
746
|
static void
|
|
@@ -817,14 +811,14 @@ ca_select_axis_func_fill_data (void *ap, void *val)
|
|
|
817
811
|
sync. Where that attach is a gather rather than an alias, the cells this
|
|
818
812
|
view did not select make the round trip for nothing -- and through a
|
|
819
813
|
lossy layer they do not come back the same. Hand each slab to the parent
|
|
820
|
-
as a region instead.
|
|
814
|
+
as a region instead. */
|
|
821
815
|
if ( !ca_is_attached(ca->parent) && !ca_attach_is_alias(ca->parent) ) {
|
|
822
816
|
ca_axis_dispatch_fill_value_via_parent(ca->parent, pdims, desc, ca->ndim,
|
|
823
817
|
ca->bytes, ca->elements, val);
|
|
824
818
|
return;
|
|
825
819
|
}
|
|
826
820
|
|
|
827
|
-
ca_attach(ca->parent); /*
|
|
821
|
+
ca_attach(ca->parent); /* attach: nothing raises before the detach */
|
|
828
822
|
ca_axis_dispatch_fill_value(ca->parent, pdims, desc, ca->ndim, ca->bytes,
|
|
829
823
|
ca->elements, val);
|
|
830
824
|
ca_sync_detach(ca->parent);
|
|
@@ -870,7 +864,7 @@ rb_ca_select_axis_s_allocate (VALUE klass)
|
|
|
870
864
|
}
|
|
871
865
|
|
|
872
866
|
static VALUE
|
|
873
|
-
rb_ca_select_axis_initialize_copy (VALUE self, VALUE other)
|
|
867
|
+
rb_ca_select_axis_initialize_copy (volatile VALUE self, volatile VALUE other)
|
|
874
868
|
{
|
|
875
869
|
CASelectAxis *ca, *cs;
|
|
876
870
|
TypedData_Get_Struct(self, CASelectAxis, &caselectaxis_data_type, ca);
|
|
@@ -893,8 +887,8 @@ rb_ca_select_axis_initialize_copy (VALUE self, VALUE other)
|
|
|
893
887
|
are ignored. Intended for testing only; production dispatch runs
|
|
894
888
|
through rb_ca_select_axis (from the `[]` indexer in carray_access.c). */
|
|
895
889
|
static VALUE
|
|
896
|
-
rb_ca_select_axis_s_new_debug (VALUE klass, VALUE rparent, VALUE rindirect,
|
|
897
|
-
VALUE rselector, VALUE rap_start,
|
|
890
|
+
rb_ca_select_axis_s_new_debug (VALUE klass, volatile VALUE rparent, VALUE rindirect,
|
|
891
|
+
volatile VALUE rselector, VALUE rap_start,
|
|
898
892
|
VALUE rap_count, VALUE rap_step)
|
|
899
893
|
{
|
|
900
894
|
CArray *parent, *selector;
|
|
@@ -909,8 +903,8 @@ rb_ca_select_axis_s_new_debug (VALUE klass, VALUE rparent, VALUE rindirect,
|
|
|
909
903
|
Check_Type(rap_count, T_ARRAY);
|
|
910
904
|
Check_Type(rap_step, T_ARRAY);
|
|
911
905
|
|
|
912
|
-
|
|
913
|
-
|
|
906
|
+
GetCArray(rparent, parent);
|
|
907
|
+
GetCArray(rselector, selector);
|
|
914
908
|
|
|
915
909
|
ndim = parent->ndim;
|
|
916
910
|
if ( RARRAY_LEN(rap_start) != ndim ||
|
|
@@ -953,7 +947,7 @@ rb_ca_select_axis_s_new_debug (VALUE klass, VALUE rparent, VALUE rindirect,
|
|
|
953
947
|
Other configurations (interleaved AP+INDIRECT, indirect inner, AP with
|
|
954
948
|
step != 1) are routed to CAGrid to avoid regressions. */
|
|
955
949
|
int
|
|
956
|
-
rb_ca_select_axis_eligible_p (int argc, VALUE *argv, VALUE self)
|
|
950
|
+
rb_ca_select_axis_eligible_p (int argc, VALUE *argv, volatile VALUE self)
|
|
957
951
|
{
|
|
958
952
|
CArray *ca;
|
|
959
953
|
int i;
|
|
@@ -967,7 +961,7 @@ rb_ca_select_axis_eligible_p (int argc, VALUE *argv, VALUE self)
|
|
|
967
961
|
if ( ! rb_obj_is_carray(argv[0]) ) return 0;
|
|
968
962
|
if ( ! rb_ca_is_boolean_type(argv[0]) ) return 0;
|
|
969
963
|
|
|
970
|
-
|
|
964
|
+
GetCArray(self, ca);
|
|
971
965
|
if ( argc != ca->ndim ) return 0;
|
|
972
966
|
|
|
973
967
|
/* axis 0 is the boolean (indirect). The rest are read as the indexer
|
|
@@ -987,7 +981,7 @@ rb_ca_select_axis_eligible_p (int argc, VALUE *argv, VALUE self)
|
|
|
987
981
|
/* Construct a CASelectAxis from the indexer's argc/argv. Assumes
|
|
988
982
|
rb_ca_select_axis_eligible_p has already returned 1. */
|
|
989
983
|
VALUE
|
|
990
|
-
rb_ca_select_axis (int argc, VALUE *argv, VALUE self)
|
|
984
|
+
rb_ca_select_axis (int argc, VALUE *argv, volatile VALUE self)
|
|
991
985
|
{
|
|
992
986
|
CArray *parent;
|
|
993
987
|
CArray *selector = NULL;
|
|
@@ -1000,7 +994,7 @@ rb_ca_select_axis (int argc, VALUE *argv, VALUE self)
|
|
|
1000
994
|
CASelectAxis *ca;
|
|
1001
995
|
int i;
|
|
1002
996
|
|
|
1003
|
-
|
|
997
|
+
GetCArray(self, parent);
|
|
1004
998
|
|
|
1005
999
|
if ( argc != parent->ndim ) {
|
|
1006
1000
|
rb_raise(rb_eArgError,
|
|
@@ -1008,14 +1002,14 @@ rb_ca_select_axis (int argc, VALUE *argv, VALUE self)
|
|
|
1008
1002
|
}
|
|
1009
1003
|
|
|
1010
1004
|
for ( i = 0; i < argc; i++ ) {
|
|
1011
|
-
VALUE arg = argv[i];
|
|
1005
|
+
volatile VALUE arg = argv[i];
|
|
1012
1006
|
|
|
1013
1007
|
if ( ! rb_obj_is_carray(arg) ) {
|
|
1014
1008
|
ca_index_axis_key(arg, parent->dim[i], i,
|
|
1015
1009
|
&ap_start[i], &ap_count[i], &ap_step[i]);
|
|
1016
1010
|
}
|
|
1017
1011
|
else if ( rb_obj_is_carray(arg) && rb_ca_is_boolean_type(arg) ) {
|
|
1018
|
-
|
|
1012
|
+
GetCArray(arg, selector);
|
|
1019
1013
|
indirect_axis = (int8_t) i;
|
|
1020
1014
|
rselector_keep = arg;
|
|
1021
1015
|
ap_start[i] = 0;
|
|
@@ -1095,14 +1089,14 @@ ca_select_axis_describe_axes (void *ap, ca_axis_desc_t *out,
|
|
|
1095
1089
|
* or `CARRAY_DEV=1 rake build_ext`). They expose the per-axis descriptor
|
|
1096
1090
|
* and the engine's raw output to Ruby so spec_ai can pin them; nothing in
|
|
1097
1091
|
* lib/ or the rest of ext/ consumes them. CAGrid carries the same four
|
|
1098
|
-
* under the same
|
|
1092
|
+
* under the same #ifdef.
|
|
1099
1093
|
* ============================================================ */
|
|
1100
1094
|
|
|
1101
1095
|
/* Returns an Array of per-axis Arrays:
|
|
1102
1096
|
STRIDE axis -> [:stride, count, start, step]
|
|
1103
1097
|
INDEX axis -> [:index, count, [indices...]] */
|
|
1104
1098
|
static VALUE
|
|
1105
|
-
rb_ca_select_axis_describe_axes (VALUE self)
|
|
1099
|
+
rb_ca_select_axis_describe_axes (volatile VALUE self)
|
|
1106
1100
|
{
|
|
1107
1101
|
CASelectAxis *ca;
|
|
1108
1102
|
ca_axis_desc_t desc[CA_RANK_MAX];
|
|
@@ -1141,7 +1135,7 @@ rb_ca_select_axis_describe_axes (VALUE self)
|
|
|
1141
1135
|
Compared against `view.to_ca.dump_binary` in tests to verify binary
|
|
1142
1136
|
equality with the existing attach path. */
|
|
1143
1137
|
static VALUE
|
|
1144
|
-
rb_ca_select_axis_dispatch_attach_debug (VALUE self)
|
|
1138
|
+
rb_ca_select_axis_dispatch_attach_debug (volatile VALUE self)
|
|
1145
1139
|
{
|
|
1146
1140
|
CASelectAxis *ca;
|
|
1147
1141
|
ca_axis_desc_t desc[CA_RANK_MAX];
|
|
@@ -1152,7 +1146,7 @@ rb_ca_select_axis_dispatch_attach_debug (VALUE self)
|
|
|
1152
1146
|
TypedData_Get_Struct(self, CASelectAxis, &caselectaxis_data_type, ca);
|
|
1153
1147
|
ca_select_axis_describe_axes(ca, desc, pdims);
|
|
1154
1148
|
|
|
1155
|
-
ca_attach(ca->parent); /*
|
|
1149
|
+
ca_attach(ca->parent); /* attach: nothing raises before the detach */
|
|
1156
1150
|
buf = ca_axis_dispatch_attach(ca->parent, pdims, desc, ca->ndim, ca->bytes,
|
|
1157
1151
|
ca->elements, NULL);
|
|
1158
1152
|
ca_detach(ca->parent);
|
|
@@ -1167,7 +1161,7 @@ rb_ca_select_axis_dispatch_attach_debug (VALUE self)
|
|
|
1167
1161
|
compare the resulting parent state against the same scatter performed
|
|
1168
1162
|
through the view's sync path. */
|
|
1169
1163
|
static VALUE
|
|
1170
|
-
rb_ca_select_axis_dispatch_scatter_debug (VALUE self, VALUE in_str)
|
|
1164
|
+
rb_ca_select_axis_dispatch_scatter_debug (volatile VALUE self, volatile VALUE in_str)
|
|
1171
1165
|
{
|
|
1172
1166
|
CASelectAxis *ca;
|
|
1173
1167
|
ca_axis_desc_t desc[CA_RANK_MAX];
|
|
@@ -1186,7 +1180,7 @@ rb_ca_select_axis_dispatch_scatter_debug (VALUE self, VALUE in_str)
|
|
|
1186
1180
|
ca_size_t pdims[CA_RANK_MAX];
|
|
1187
1181
|
ca_select_axis_describe_axes(ca, desc, pdims);
|
|
1188
1182
|
|
|
1189
|
-
ca_attach(ca->parent); /*
|
|
1183
|
+
ca_attach(ca->parent); /* attach: nothing raises before the detach */
|
|
1190
1184
|
ca_axis_dispatch_scatter(ca->parent, pdims, desc, ca->ndim, ca->bytes,
|
|
1191
1185
|
ca->elements, RSTRING_PTR(in_str));
|
|
1192
1186
|
ca_sync_detach(ca->parent);
|
|
@@ -1196,7 +1190,7 @@ rb_ca_select_axis_dispatch_scatter_debug (VALUE self, VALUE in_str)
|
|
|
1196
1190
|
/* Broadcasts a String of length == bytes (one value) into every selected
|
|
1197
1191
|
parent cell through ca_axis_dispatch_fill_value. */
|
|
1198
1192
|
static VALUE
|
|
1199
|
-
rb_ca_select_axis_dispatch_fill_value_debug (VALUE self, VALUE val_str)
|
|
1193
|
+
rb_ca_select_axis_dispatch_fill_value_debug (volatile VALUE self, volatile VALUE val_str)
|
|
1200
1194
|
{
|
|
1201
1195
|
CASelectAxis *ca;
|
|
1202
1196
|
ca_axis_desc_t desc[CA_RANK_MAX];
|
|
@@ -1213,7 +1207,7 @@ rb_ca_select_axis_dispatch_fill_value_debug (VALUE self, VALUE val_str)
|
|
|
1213
1207
|
ca_size_t pdims[CA_RANK_MAX];
|
|
1214
1208
|
ca_select_axis_describe_axes(ca, desc, pdims);
|
|
1215
1209
|
|
|
1216
|
-
ca_attach(ca->parent); /*
|
|
1210
|
+
ca_attach(ca->parent); /* attach: nothing raises before the detach */
|
|
1217
1211
|
ca_axis_dispatch_fill_value(ca->parent, pdims, desc, ca->ndim, ca->bytes,
|
|
1218
1212
|
ca->elements, RSTRING_PTR(val_str));
|
|
1219
1213
|
ca_sync_detach(ca->parent);
|
|
@@ -1227,7 +1221,7 @@ void
|
|
|
1227
1221
|
Init_ca_obj_select_axis (void)
|
|
1228
1222
|
{
|
|
1229
1223
|
rb_cCASelectAxis = rb_define_class("CASelectAxis", rb_cCAView);
|
|
1230
|
-
rb_cCASelectAxisMask =
|
|
1224
|
+
rb_cCASelectAxisMask = rb_define_class_under(rb_cCASelectAxis, "Mask", rb_cCASelectAxis);
|
|
1231
1225
|
|
|
1232
1226
|
ca_select_axis_func.struct_size = sizeof(CASelectAxis);
|
|
1233
1227
|
ca_select_axis_func.pool_bytes = ca_select_axis_pool_bytes;
|
|
@@ -1239,7 +1233,6 @@ Init_ca_obj_select_axis (void)
|
|
|
1239
1233
|
&caselectaxis_mask_data_type,
|
|
1240
1234
|
&ca_select_axis_func, sizeof(ca_select_axis_func));
|
|
1241
1235
|
ca_register_cell_moving_view(CA_OBJ_SELECT_AXIS);
|
|
1242
|
-
rb_define_const(rb_cObject, "CA_OBJ_SELECT_AXIS", INT2NUM(CA_OBJ_SELECT_AXIS));
|
|
1243
1236
|
|
|
1244
1237
|
rb_define_alloc_func(rb_cCASelectAxis, rb_ca_select_axis_s_allocate);
|
|
1245
1238
|
rb_define_method(rb_cCASelectAxis, "initialize_copy",
|