mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-17 09:10:22 +02:00
deprecate generalized vectors in favor of arrays
* libguile/generalized-arrays.h: * libguile/generalized-arrays.c (scm_c_array_length): (scm_array_length): New functions. * module/ice-9/deprecated.scm: * libguile/generalized-vectors.c: * libguile/generalized-vectors.h: * libguile/deprecated.h: * libguile/deprecated.c (scm_generalized_vector_p) (scm_generalized_vector_length, scm_generalized_vector_ref) (scm_generalized_vector_set_x, scm_generalized_vector_to_list): Deprecate. * libguile/uniform.c (scm_uniform_vector_to_list): Use scm_array_to_list. * module/ice-9/boot-9.scm (case): Arrays are generalized vectors. * module/srfi/srfi-4/gnu.scm (define-any->vector): Use the array functions instead of the generalized-vector functions. * test-suite/tests/arrays.test: Remove generalized-vector->list test; covered by array->list test. * test-suite/tests/bitvectors.test: * test-suite/tests/bytevectors.test: * test-suite/tests/srfi-4.test: Adapt to test using array interfaces instead of generalized-vector interfaces. * doc/ref/api-compound.texi: Remove generalized vector docs. * doc/ref/api-data.texi: * doc/ref/srfi-modules.texi: Adapt.
This commit is contained in:
parent
336c921146
commit
118ff892be
17 changed files with 209 additions and 246 deletions
|
@ -113,6 +113,36 @@ SCM_DEFINE (scm_array_rank, "array-rank", 1, 0, 0,
|
|||
#undef FUNC_NAME
|
||||
|
||||
|
||||
size_t
|
||||
scm_c_array_length (SCM array)
|
||||
{
|
||||
scm_t_array_handle handle;
|
||||
size_t res;
|
||||
|
||||
scm_array_get_handle (array, &handle);
|
||||
if (scm_array_handle_rank (&handle) < 1)
|
||||
{
|
||||
scm_array_handle_release (&handle);
|
||||
scm_wrong_type_arg_msg (NULL, 0, array, "array of nonzero rank");
|
||||
}
|
||||
res = handle.dims[0].ubnd - handle.dims[0].lbnd + 1;
|
||||
scm_array_handle_release (&handle);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
SCM_DEFINE (scm_array_length, "array-length", 1, 0, 0,
|
||||
(SCM array),
|
||||
"Return the length of an array: the dimension of its first\n"
|
||||
"dimension. It is an error to ask for the length of an\n"
|
||||
"array of rank 0.")
|
||||
#define FUNC_NAME s_scm_array_rank
|
||||
{
|
||||
return scm_from_size_t (scm_c_array_length (array));
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
SCM_DEFINE (scm_array_dimensions, "array-dimensions", 1, 0, 0,
|
||||
(SCM ra),
|
||||
"@code{array-dimensions} is similar to @code{array-shape} but replaces\n"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue