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

New export (array-for-each-cell-in-order)

* libguile/arrays.h (array-for-each-cell-in-order): Declare.

* libguile/arrays.c (array-for-each-cell-in-order): Define.
This commit is contained in:
Daniel Llorens 2015-12-09 12:57:19 +01:00
parent a8dd99d0de
commit ffd949e597
2 changed files with 14 additions and 1 deletions

View file

@ -594,6 +594,7 @@ SCM_DEFINE (scm_array_for_each_cell, "array-for-each-cell", 2, 0, 1,
{
// FIXME replace stack by scm_gc_malloc_pointerless()
int const N = scm_ilength(a_);
int const frank = scm_to_int(frank_);
scm_t_array_handle ah[N];
SCM a[N];
scm_t_array_dim * as[N];
@ -606,7 +607,6 @@ SCM_DEFINE (scm_array_for_each_cell, "array-for-each-cell", 2, 0, 1,
rank[n] = scm_array_handle_rank(ah+n);
}
// checks.
int const frank = scm_to_int(frank_);
ssize_t s[frank];
char const * msg = NULL;
if (frank<0)
@ -757,6 +757,17 @@ SCM_DEFINE (scm_array_for_each_cell, "array-for-each-cell", 2, 0, 1,
#undef FUNC_NAME
SCM_DEFINE (scm_array_for_each_cell_in_order, "array-for-each-cell-in-order", 2, 0, 1,
(SCM frank_, SCM op, SCM a_),
"Same as array-for-each-cell, but visit the cells sequentially\n"
"and in row-major order.\n")
#define FUNC_NAME s_scm_array_for_each_cell_in_order
{
return scm_array_for_each_cell (frank_, op, a_);
}
#undef FUNC_NAME
/* args are RA . DIMS */
SCM_DEFINE (scm_transpose_array, "transpose-array", 1, 0, 1,
(SCM ra, SCM args),
@ -1131,6 +1142,7 @@ scm_i_print_array (SCM array, SCM port, scm_print_state *pstate)
return scm_i_print_array_dimension (&h, 0, 0, port, pstate);
}
void
scm_init_arrays ()
{