1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 04:40:29 +02:00

Don't use array handles in scm_c_array_rank

* libguile/arrays.c (scm_c_array_rank): moved from
  libguile/generalized-arrays.c. Don't use array handles, but follow the
  same type check sequence as the other array functions
  (shared-array-root, etc).

  (scm_array_rank): moved from libguile/generalized-arrays.h.

* libguile/arrays.h: move prototypes here.
This commit is contained in:
Daniel Llorens 2015-02-12 10:15:42 +01:00
parent 3aafc2c857
commit ed6c65507a
4 changed files with 35 additions and 35 deletions

View file

@ -64,6 +64,27 @@
(SCM_SET_CELL_WORD_0 ((x), SCM_CELL_WORD_0 (x) & ~(SCM_I_ARRAY_FLAG_CONTIGUOUS << 16)))
size_t
scm_c_array_rank (SCM array)
{
if (SCM_I_ARRAYP (array))
return SCM_I_ARRAY_NDIM (array);
else if (scm_is_array (array))
return 1;
else
scm_wrong_type_arg_msg ("array-rank", SCM_ARG1, array, "array");
}
SCM_DEFINE (scm_array_rank, "array-rank", 1, 0, 0,
(SCM array),
"Return the number of dimensions of the array @var{array.}\n")
#define FUNC_NAME s_scm_array_rank
{
return scm_from_size_t (scm_c_array_rank (array));
}
#undef FUNC_NAME
SCM_DEFINE (scm_shared_array_root, "shared-array-root", 1, 0, 0,
(SCM ra),
"Return the root vector of a shared array.")