mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-29 19:30:36 +02:00
Arrays are not an array implementation
* libguile/bitvectors.c: match other uses of SCM_ARRAY_IMPLEMENTATION. * libguile/generalized-arrays.c (scm_is_array): don't use scm_i_array_implementation_for_obj on arrays. (scm_is_typed_array): idem. Use impl->get_handle instead of scm_array_get_handle to avoid calling scm_i_array_implementation_for_obj twice. * libguile/arrays.c: remove SCM_ARRAY_IMPLEMENTATION on scm_tc7_array type.
This commit is contained in:
parent
96f7332263
commit
257e163c75
3 changed files with 11 additions and 13 deletions
|
@ -817,8 +817,6 @@ scm_i_print_array (SCM array, SCM port, scm_print_state *pstate)
|
|||
return scm_i_print_array_dimension (&h, 0, 0, port, pstate);
|
||||
}
|
||||
|
||||
SCM_ARRAY_IMPLEMENTATION (scm_tc7_array, 0x7f, NULL, NULL, NULL)
|
||||
|
||||
void
|
||||
scm_init_arrays ()
|
||||
{
|
||||
|
|
|
@ -879,8 +879,7 @@ bitvector_get_handle (SCM bv, scm_t_array_handle *h)
|
|||
h->elements = h->writable_elements = BITVECTOR_BITS (bv);
|
||||
}
|
||||
|
||||
SCM_ARRAY_IMPLEMENTATION (scm_tc7_bitvector,
|
||||
0x7f,
|
||||
SCM_ARRAY_IMPLEMENTATION (scm_tc7_bitvector, 0x7f,
|
||||
bitvector_handle_ref, bitvector_handle_set,
|
||||
bitvector_get_handle)
|
||||
SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_BIT, scm_make_bitvector)
|
||||
|
|
|
@ -42,7 +42,7 @@ SCM_INTERNAL SCM scm_i_array_set_x (SCM v, SCM obj,
|
|||
int
|
||||
scm_is_array (SCM obj)
|
||||
{
|
||||
return scm_i_array_implementation_for_obj (obj) ? 1 : 0;
|
||||
return SCM_I_ARRAYP (obj) || scm_i_array_implementation_for_obj (obj);
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_array_p_2, "array?", 1, 0, 0,
|
||||
|
@ -68,17 +68,18 @@ scm_array_p (SCM obj, SCM unused)
|
|||
int
|
||||
scm_is_typed_array (SCM obj, SCM type)
|
||||
{
|
||||
int ret = 0;
|
||||
if (scm_i_array_implementation_for_obj (obj))
|
||||
scm_t_array_implementation *impl;
|
||||
if (SCM_I_ARRAYP (obj))
|
||||
obj = SCM_I_ARRAY_V (obj);
|
||||
impl = scm_i_array_implementation_for_obj (obj);
|
||||
if (impl)
|
||||
{
|
||||
scm_t_array_handle h;
|
||||
|
||||
scm_array_get_handle (obj, &h);
|
||||
ret = scm_is_eq (scm_array_handle_element_type (&h), type);
|
||||
scm_array_handle_release (&h);
|
||||
impl->get_handle (obj, &h);
|
||||
return scm_is_eq (scm_array_handle_element_type (&h), type);
|
||||
}
|
||||
|
||||
return ret;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_typed_array_p, "typed-array?", 2, 0, 0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue