diff options
author | Andy Wingo <wingo@pobox.com> | 2014-02-09 12:31:59 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2014-02-09 12:48:21 +0100 |
commit | cf64dca65c4ee4d845a73e7d7c15ab7583aff15b (patch) | |
tree | 690ecc2fd6357077f0e736df9bf4637bce6b0aa6 /libguile/array-handle.h | |
parent | 8269f0be18c046d94f01f83dcff80794e97e6c27 (diff) | |
download | guile-cf64dca65c4ee4d845a73e7d7c15ab7583aff15b.tar.gz |
Remove array impl. registry; instead, hard-code array handle creation
* libguile/array-handle.h (scm_t_vector_ref, scm_t_vector_set): Rename
from scm_t_array_ref, scm_t_array_set. These were named
scm_i_t_array_ref and scm_i_t_array_set in 1.8 and 2.0. Change to
take the vector directly, instead of the array handle. In this way,
generic array handles are layered on top of specific implementations
of backing stores.
Remove scm_t_array_implementation, introduced in 2.0 but never
documented. It was a failed attempt to layer the array implementation
that actually introduced too many layers, as it prevented the "vref"
and "vset" members of scm_t_array_handle (called "ref" and "set" in
1.8, not present in 2.0) from specializing on array backing stores.
(scm_i_register_array_implementation) (scm_i_array_implementation_for_obj):
Remove these internal interfaces.
(scm_t_array_handle): Adapt to scm_t_vector_ref / scm_t_vector_set
change.
(scm_array_handle_ref, scm_array_handle_set): Adapt to change in
vref/vset prototype.
* libguile/array-handle.c (scm_array_get_handle): Inline all the
necessary initializations here for all specific array types.
* libguile/array-map.c (rafill, racp, ramap, rafe, array_index_map_1):
* libguile/arrays.c: Remove array implementation code.
* libguile/bitvectors.h:
* libguile/bitvectors.c: Remove array implementation code.
(scm_i_bitvector_bits): New internal interface.
* libguile/bytevectors.c: Remove array implementation code.
* libguile/srfi-4.h: Remove declarations for internal procedures that
don't exist (!).
* libguile/strings.c: Remove array implementation code.
* libguile/vectors.c: Remove array implementation code.
Diffstat (limited to 'libguile/array-handle.h')
-rw-r--r-- | libguile/array-handle.h | 40 |
1 files changed, 7 insertions, 33 deletions
diff --git a/libguile/array-handle.h b/libguile/array-handle.h index abe617ff5..a623b4e2e 100644 --- a/libguile/array-handle.h +++ b/libguile/array-handle.h @@ -30,35 +30,8 @@ -struct scm_t_array_handle; - -typedef SCM (*scm_t_array_ref) (struct scm_t_array_handle *, size_t); -typedef void (*scm_t_array_set) (struct scm_t_array_handle *, size_t, SCM); - -typedef struct -{ - scm_t_bits tag; - scm_t_bits mask; - scm_t_array_ref vref; - scm_t_array_set vset; - void (*get_handle)(SCM, struct scm_t_array_handle*); -} scm_t_array_implementation; - -#define SCM_ARRAY_IMPLEMENTATION(tag_,mask_,vref_,vset_,handle_) \ - SCM_SNARF_INIT ({ \ - scm_t_array_implementation impl; \ - impl.tag = tag_; impl.mask = mask_; \ - impl.vref = vref_; impl.vset = vset_; \ - impl.get_handle = handle_; \ - scm_i_register_array_implementation (&impl); \ - }) - - -SCM_INTERNAL void scm_i_register_array_implementation (scm_t_array_implementation *impl); -SCM_INTERNAL scm_t_array_implementation* scm_i_array_implementation_for_obj (SCM obj); - - - +typedef SCM (*scm_t_vector_ref) (SCM, size_t); +typedef void (*scm_t_vector_set) (SCM, size_t, SCM); typedef struct scm_t_array_dim { @@ -93,6 +66,7 @@ SCM_INTERNAL SCM scm_i_array_element_types[]; typedef struct scm_t_array_handle { SCM array; + /* `Base' is an offset into elements or writable_elements, corresponding to the first element in the array. It would be nicer just to adjust the elements/writable_elements pointer, but we can't because that element might @@ -109,8 +83,8 @@ typedef struct scm_t_array_handle { /* The backing store for the array, and its accessors. */ SCM vector; - scm_t_array_ref vref; - scm_t_array_set vset; + scm_t_vector_ref vref; + scm_t_vector_set vset; } scm_t_array_handle; #define scm_array_handle_rank(h) ((h)->ndims) @@ -139,7 +113,7 @@ scm_array_handle_ref (scm_t_array_handle *h, ssize_t p) /* catch overflow */ scm_out_of_range (NULL, scm_from_ssize_t (p)); /* perhaps should catch overflow here too */ - return h->vref (h, h->base + p); + return h->vref (h->vector, h->base + p); } SCM_INLINE_IMPLEMENTATION void @@ -149,7 +123,7 @@ scm_array_handle_set (scm_t_array_handle *h, ssize_t p, SCM v) /* catch overflow */ scm_out_of_range (NULL, scm_from_ssize_t (p)); /* perhaps should catch overflow here too */ - h->vset (h, h->base + p, v); + h->vset (h->vector, h->base + p, v); } #endif |