[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 17/18: New export (array-for-each-cell-in-order)
From: |
Daniel Llorens |
Subject: |
[Guile-commits] 17/18: New export (array-for-each-cell-in-order) |
Date: |
Fri, 18 Mar 2016 10:38:12 +0000 |
lloda pushed a commit to branch lloda-array-support
in repository guile.
commit 2d2e3683806be32206f4b5a748c70a460e882c82
Author: Daniel Llorens <address@hidden>
Date: Wed Dec 9 12:57:19 2015 +0100
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.
---
libguile/arrays.c | 14 +++++++++++++-
libguile/arrays.h | 1 +
2 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/libguile/arrays.c b/libguile/arrays.c
index 6a9ec9a..dea65be 100644
--- a/libguile/arrays.c
+++ b/libguile/arrays.c
@@ -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 ()
{
diff --git a/libguile/arrays.h b/libguile/arrays.h
index 5a88b72..b43e93c 100644
--- a/libguile/arrays.h
+++ b/libguile/arrays.h
@@ -53,6 +53,7 @@ SCM_API SCM scm_array_from_s (SCM ra, SCM indices);
SCM_API SCM scm_array_from (SCM ra, SCM indices);
SCM_API SCM scm_array_amend_x (SCM ra, SCM b, SCM indices);
SCM_API SCM scm_array_for_each_cell (SCM frank, SCM op, SCM args);
+SCM_API SCM scm_array_for_each_cell_in_order (SCM frank, SCM op, SCM args);
SCM_API SCM scm_list_to_array (SCM ndim, SCM lst);
SCM_API SCM scm_list_to_typed_array (SCM type, SCM ndim, SCM lst);
- [Guile-commits] branch lloda-array-support updated (00a38cc -> ae03809), Daniel Llorens, 2016/03/18
- [Guile-commits] 03/18: Unuse array 'contiguous' flag, Daniel Llorens, 2016/03/18
- [Guile-commits] 04/18: Reuse SCM_BYTEVECTOR_TYPED_LENGTH in scm_array_get_handle, Daniel Llorens, 2016/03/18
- [Guile-commits] 17/18: New export (array-for-each-cell-in-order),
Daniel Llorens <=
- [Guile-commits] 13/18: Remove deprecated and unused generalized-vector functions, Daniel Llorens, 2016/03/18
- [Guile-commits] 01/18: Avoid unneeded internal use of array handles, Daniel Llorens, 2016/03/18
- [Guile-commits] 02/18: Remove scm_from_contiguous_array, Daniel Llorens, 2016/03/18
- [Guile-commits] 07/18: Tests & doc for array-from, array-from*, array-set-from!, Daniel Llorens, 2016/03/18
- [Guile-commits] 08/18: Rename array-set-from!, scm_array_set_from_x to array-amend!, scm_array_amend_x, Daniel Llorens, 2016/03/18
- [Guile-commits] 05/18: Compile in C99 mode, Daniel Llorens, 2016/03/18
- [Guile-commits] 12/18: Speed up for multi-arg cases of scm_ramap functions, Daniel Llorens, 2016/03/18
- [Guile-commits] 16/18: Draft documentation for (array-for-each-cell), Daniel Llorens, 2016/03/18
- [Guile-commits] 11/18: Remove deprecated array functions, Daniel Llorens, 2016/03/18
- [Guile-commits] 15/18: Draft of (array-for-each-cell), Daniel Llorens, 2016/03/18