mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-15 05:43:19 -08:00
New function ecl_array_rank()
This commit is contained in:
parent
dac086195d
commit
7c3f72776d
2 changed files with 20 additions and 4 deletions
|
|
@ -847,10 +847,25 @@ ecl_array_elttype(cl_object x)
|
|||
cl_object
|
||||
cl_array_rank(cl_object a)
|
||||
{
|
||||
if (ecl_unlikely(!ECL_ARRAYP(a)))
|
||||
FEwrong_type_only_arg(@[array-rank], a, @[array]);
|
||||
@(return ((type_of(a) == t_array) ? ecl_make_fixnum(a->array.rank)
|
||||
: ecl_make_fixnum(1)))
|
||||
@(return ecl_make_fixnum(ecl_array_rank(a)))
|
||||
}
|
||||
|
||||
cl_index
|
||||
ecl_array_rank(cl_object a)
|
||||
{
|
||||
switch (type_of(a)) {
|
||||
case t_array:
|
||||
return a->array.rank;
|
||||
#ifdef ECL_UNICODE
|
||||
case t_string:
|
||||
#endif
|
||||
case t_base_string:
|
||||
case t_vector:
|
||||
case t_bitvector:
|
||||
return 1;
|
||||
default:
|
||||
FEwrong_type_only_arg(@[array-dimension], a, @[array]);
|
||||
}
|
||||
}
|
||||
|
||||
cl_object
|
||||
|
|
|
|||
|
|
@ -357,6 +357,7 @@ extern ECL_API cl_object si_fill_array_with_elt(cl_object array, cl_object elt,
|
|||
extern ECL_API void FEwrong_dimensions(cl_object a, cl_index rank) ecl_attr_noreturn;
|
||||
extern ECL_API cl_index ecl_to_index(cl_object n);
|
||||
extern ECL_API cl_index ecl_array_dimension(cl_object x, cl_index n);
|
||||
extern ECL_API cl_index ecl_array_rank(cl_object x);
|
||||
extern ECL_API cl_object ecl_aref_unsafe(cl_object x, cl_index index);
|
||||
extern ECL_API cl_object ecl_aset_unsafe(cl_object x, cl_index index, cl_object value);
|
||||
extern ECL_API cl_object ecl_aref(cl_object x, cl_index index);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue