mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-04-30 20:00:19 +02:00
Rename scm_t_array_handle.array to .root
Globally rename this field (after shared-array-root), since it's not an array.
This commit is contained in:
parent
99c0a58a2f
commit
d0b47b4946
9 changed files with 23 additions and 23 deletions
|
@ -167,7 +167,7 @@ const SCM *
|
||||||
scm_array_handle_elements (scm_t_array_handle *h)
|
scm_array_handle_elements (scm_t_array_handle *h)
|
||||||
{
|
{
|
||||||
if (h->element_type != SCM_ARRAY_ELEMENT_TYPE_SCM)
|
if (h->element_type != SCM_ARRAY_ELEMENT_TYPE_SCM)
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, "non-uniform array");
|
scm_wrong_type_arg_msg (NULL, 0, h->root, "non-uniform array");
|
||||||
return ((const SCM*)h->elements) + h->base;
|
return ((const SCM*)h->elements) + h->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ SCM *
|
||||||
scm_array_handle_writable_elements (scm_t_array_handle *h)
|
scm_array_handle_writable_elements (scm_t_array_handle *h)
|
||||||
{
|
{
|
||||||
if (h->element_type != SCM_ARRAY_ELEMENT_TYPE_SCM)
|
if (h->element_type != SCM_ARRAY_ELEMENT_TYPE_SCM)
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, "non-uniform array");
|
scm_wrong_type_arg_msg (NULL, 0, h->root, "non-uniform array");
|
||||||
return ((SCM*)h->elements) + h->base;
|
return ((SCM*)h->elements) + h->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ SCM_INTERNAL SCM scm_i_array_element_types[];
|
||||||
|
|
||||||
|
|
||||||
typedef struct scm_t_array_handle {
|
typedef struct scm_t_array_handle {
|
||||||
SCM array;
|
SCM root;
|
||||||
scm_t_array_implementation *impl;
|
scm_t_array_implementation *impl;
|
||||||
/* `Base' is an offset into elements or writable_elements, corresponding to
|
/* `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
|
the first element in the array. It would be nicer just to adjust the
|
||||||
|
@ -135,7 +135,7 @@ scm_array_handle_ref (scm_t_array_handle *h, ssize_t p)
|
||||||
/* catch overflow */
|
/* catch overflow */
|
||||||
scm_out_of_range (NULL, scm_from_ssize_t (p));
|
scm_out_of_range (NULL, scm_from_ssize_t (p));
|
||||||
/* perhaps should catch overflow here too */
|
/* perhaps should catch overflow here too */
|
||||||
return h->impl->vref (h->array, h->base + p);
|
return h->impl->vref (h->root, h->base + p);
|
||||||
}
|
}
|
||||||
|
|
||||||
SCM_INLINE_IMPLEMENTATION void
|
SCM_INLINE_IMPLEMENTATION void
|
||||||
|
@ -145,7 +145,7 @@ scm_array_handle_set (scm_t_array_handle *h, ssize_t p, SCM v)
|
||||||
/* catch overflow */
|
/* catch overflow */
|
||||||
scm_out_of_range (NULL, scm_from_ssize_t (p));
|
scm_out_of_range (NULL, scm_from_ssize_t (p));
|
||||||
/* perhaps should catch overflow here too */
|
/* perhaps should catch overflow here too */
|
||||||
h->impl->vset (h->array, h->base + p, v);
|
h->impl->vset (h->root, h->base + p, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -55,7 +55,7 @@ AREF (SCM v, size_t pos)
|
||||||
scm_t_array_handle h;
|
scm_t_array_handle h;
|
||||||
SCM ret;
|
SCM ret;
|
||||||
scm_array_get_handle (v, &h);
|
scm_array_get_handle (v, &h);
|
||||||
ret = h.impl->vref (h.array, h.base + pos * h.dims[0].inc);
|
ret = h.impl->vref (h.root, h.base + pos * h.dims[0].inc);
|
||||||
scm_array_handle_release (&h);
|
scm_array_handle_release (&h);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,7 @@ ASET (SCM v, size_t pos, SCM val)
|
||||||
{
|
{
|
||||||
scm_t_array_handle h;
|
scm_t_array_handle h;
|
||||||
scm_array_get_handle (v, &h);
|
scm_array_get_handle (v, &h);
|
||||||
h.impl->vset (h.array, pos, val);
|
h.impl->vset (h.root, pos, val);
|
||||||
scm_array_handle_release (&h);
|
scm_array_handle_release (&h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,7 +728,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
||||||
scm_array_get_handle (ra, &h);
|
scm_array_get_handle (ra, &h);
|
||||||
inc = h.dims[0].inc;
|
inc = h.dims[0].inc;
|
||||||
for (i = h.dims[0].lbnd, p = h.base; i <= h.dims[0].ubnd; ++i, p += inc)
|
for (i = h.dims[0].lbnd, p = h.base; i <= h.dims[0].ubnd; ++i, p += inc)
|
||||||
h.impl->vset (h.array, p, scm_call_1 (proc, scm_from_ssize_t (i)));
|
h.impl->vset (h.root, p, scm_call_1 (proc, scm_from_ssize_t (i)));
|
||||||
scm_array_handle_release (&h);
|
scm_array_handle_release (&h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -768,7 +768,7 @@ SCM_DEFINE (scm_array_index_map_x, "array-index-map!", 2, 0, 0,
|
||||||
for (; vi[kmax] <= SCM_I_ARRAY_DIMS (ra)[kmax].ubnd;
|
for (; vi[kmax] <= SCM_I_ARRAY_DIMS (ra)[kmax].ubnd;
|
||||||
*q = scm_from_ssize_t (++vi[kmax]))
|
*q = scm_from_ssize_t (++vi[kmax]))
|
||||||
{
|
{
|
||||||
h.impl->vset (h.array, i, scm_apply_0 (proc, args));
|
h.impl->vset (h.root, i, scm_apply_0 (proc, args));
|
||||||
i += SCM_I_ARRAY_DIMS (ra)[kmax].inc;
|
i += SCM_I_ARRAY_DIMS (ra)[kmax].inc;
|
||||||
}
|
}
|
||||||
k--;
|
k--;
|
||||||
|
|
|
@ -165,12 +165,12 @@ scm_array_handle_bit_elements (scm_t_array_handle *h)
|
||||||
scm_t_uint32 *
|
scm_t_uint32 *
|
||||||
scm_array_handle_bit_writable_elements (scm_t_array_handle *h)
|
scm_array_handle_bit_writable_elements (scm_t_array_handle *h)
|
||||||
{
|
{
|
||||||
SCM vec = h->array;
|
SCM vec = h->root;
|
||||||
if (SCM_I_ARRAYP (vec))
|
if (SCM_I_ARRAYP (vec))
|
||||||
vec = SCM_I_ARRAY_V (vec);
|
vec = SCM_I_ARRAY_V (vec);
|
||||||
if (IS_BITVECTOR (vec))
|
if (IS_BITVECTOR (vec))
|
||||||
return BITVECTOR_BITS (vec) + h->base/32;
|
return BITVECTOR_BITS (vec) + h->base/32;
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, "bit array");
|
scm_wrong_type_arg_msg (NULL, 0, h->root, "bit array");
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
@ -869,7 +869,7 @@ static void
|
||||||
bitvector_get_handle (SCM bv, scm_t_array_handle *h)
|
bitvector_get_handle (SCM bv, scm_t_array_handle *h)
|
||||||
{
|
{
|
||||||
h->base = 0;
|
h->base = 0;
|
||||||
h->array = bv;
|
h->root = bv;
|
||||||
h->ndims = 1;
|
h->ndims = 1;
|
||||||
h->dims = &h->dim0;
|
h->dims = &h->dim0;
|
||||||
h->dim0.lbnd = 0;
|
h->dim0.lbnd = 0;
|
||||||
|
|
|
@ -2204,7 +2204,7 @@ static void
|
||||||
bytevector_get_handle (SCM v, scm_t_array_handle *h)
|
bytevector_get_handle (SCM v, scm_t_array_handle *h)
|
||||||
{
|
{
|
||||||
h->base = 0;
|
h->base = 0;
|
||||||
h->array = v;
|
h->root = v;
|
||||||
h->ndims = 1;
|
h->ndims = 1;
|
||||||
h->dims = &h->dim0;
|
h->dims = &h->dim0;
|
||||||
h->dim0.lbnd = 0;
|
h->dim0.lbnd = 0;
|
||||||
|
|
|
@ -118,13 +118,13 @@
|
||||||
const ctype* scm_array_handle_##tag##_elements (scm_t_array_handle *h) \
|
const ctype* scm_array_handle_##tag##_elements (scm_t_array_handle *h) \
|
||||||
{ \
|
{ \
|
||||||
if (h->element_type != ETYPE (TAG)) \
|
if (h->element_type != ETYPE (TAG)) \
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, #tag "vector"); \
|
scm_wrong_type_arg_msg (NULL, 0, h->root, #tag "vector"); \
|
||||||
return ((const ctype*) h->elements) + h->base*width; \
|
return ((const ctype*) h->elements) + h->base*width; \
|
||||||
} \
|
} \
|
||||||
ctype* scm_array_handle_##tag##_writable_elements (scm_t_array_handle *h) \
|
ctype* scm_array_handle_##tag##_writable_elements (scm_t_array_handle *h) \
|
||||||
{ \
|
{ \
|
||||||
if (h->element_type != ETYPE (TAG)) \
|
if (h->element_type != ETYPE (TAG)) \
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, #tag "vector"); \
|
scm_wrong_type_arg_msg (NULL, 0, h->root, #tag "vector"); \
|
||||||
return ((ctype*) h->writable_elements) + h->base*width; \
|
return ((ctype*) h->writable_elements) + h->base*width; \
|
||||||
} \
|
} \
|
||||||
const ctype *scm_##tag##vector_elements (SCM uvec, \
|
const ctype *scm_##tag##vector_elements (SCM uvec, \
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
return ((ctype*)h->writable_elements) + h->base*width; \
|
return ((ctype*)h->writable_elements) + h->base*width; \
|
||||||
/* otherwise... */ \
|
/* otherwise... */ \
|
||||||
else \
|
else \
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, #tag "vector"); \
|
scm_wrong_type_arg_msg (NULL, 0, h->root, #tag "vector"); \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -2477,7 +2477,7 @@ static void
|
||||||
string_get_handle (SCM v, scm_t_array_handle *h)
|
string_get_handle (SCM v, scm_t_array_handle *h)
|
||||||
{
|
{
|
||||||
h->base = 0;
|
h->base = 0;
|
||||||
h->array = v;
|
h->root = v;
|
||||||
h->ndims = 1;
|
h->ndims = 1;
|
||||||
h->dims = &h->dim0;
|
h->dims = &h->dim0;
|
||||||
h->dim0.lbnd = 0;
|
h->dim0.lbnd = 0;
|
||||||
|
|
|
@ -49,9 +49,9 @@ scm_array_handle_uniform_element_size (scm_t_array_handle *h)
|
||||||
if (ret && ret % 8 == 0)
|
if (ret && ret % 8 == 0)
|
||||||
return ret / 8;
|
return ret / 8;
|
||||||
else if (ret)
|
else if (ret)
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, "byte-aligned uniform array");
|
scm_wrong_type_arg_msg (NULL, 0, h->root, "byte-aligned uniform array");
|
||||||
else
|
else
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, "uniform array");
|
scm_wrong_type_arg_msg (NULL, 0, h->root, "uniform array");
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
@ -61,7 +61,7 @@ scm_array_handle_uniform_element_bit_size (scm_t_array_handle *h)
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
else
|
else
|
||||||
scm_wrong_type_arg_msg (NULL, 0, h->array, "uniform array");
|
scm_wrong_type_arg_msg (NULL, 0, h->root, "uniform array");
|
||||||
}
|
}
|
||||||
|
|
||||||
const void *
|
const void *
|
||||||
|
@ -184,7 +184,7 @@ scm_c_uniform_vector_ref (SCM v, size_t pos)
|
||||||
|
|
||||||
/* need the handle for bitvectors only */
|
/* need the handle for bitvectors only */
|
||||||
scm_array_get_handle (v, &h);
|
scm_array_get_handle (v, &h);
|
||||||
ret = h.impl->vref (h.array, pos);
|
ret = h.impl->vref (h.root, pos);
|
||||||
scm_array_handle_release (&h);
|
scm_array_handle_release (&h);
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ scm_c_uniform_vector_set_x (SCM v, size_t pos, SCM val)
|
||||||
|
|
||||||
/* need the handle for bitvectors only */
|
/* need the handle for bitvectors only */
|
||||||
scm_array_get_handle (v, &h);
|
scm_array_get_handle (v, &h);
|
||||||
h.impl->vset (h.array, pos, val);
|
h.impl->vset (h.root, pos, val);
|
||||||
scm_array_handle_release (&h);
|
scm_array_handle_release (&h);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -451,7 +451,7 @@ static void
|
||||||
vector_get_handle (SCM v, scm_t_array_handle *h)
|
vector_get_handle (SCM v, scm_t_array_handle *h)
|
||||||
{
|
{
|
||||||
h->base = 0;
|
h->base = 0;
|
||||||
h->array = v;
|
h->root = v;
|
||||||
h->ndims = 1;
|
h->ndims = 1;
|
||||||
h->dims = &h->dim0;
|
h->dims = &h->dim0;
|
||||||
h->dim0.lbnd = 0;
|
h->dim0.lbnd = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue