diff options
author | Daniel Llorens <daniel.llorens@bluewin.ch> | 2016-11-18 16:23:05 +0100 |
---|---|---|
committer | Daniel Llorens <daniel.llorens@bluewin.ch> | 2016-11-23 13:05:49 +0100 |
commit | fa4a22971a122e30e6b167bfe7ac209d02ffafc4 (patch) | |
tree | e89cbfa9d6f5ce3bdae7f1725971cf697e3ced18 /libguile/arrays.h | |
parent | 0bd7562c961223cd70e772bac8b7ae21b34f1aed (diff) | |
download | guile-fa4a22971a122e30e6b167bfe7ac209d02ffafc4.tar.gz |
Deprecate scm_from_contiguous_array
scm_from_contiguous_array() was undocumented, unused within Guile, and
can be replaced by make-array + array-copy! without requiring contiguity
and without loss of performance.
* libguile/arrays.c (scm_array_contents): Do not rely on
SCM_I_ARRAY_CONTP.
* test-suite/tests/arrays.test: Test array-contents with 0-rank array.
* libguile/arrays.h: Declare scm_i_shap2ra(),
SCM_SET_ARRAY_CONTIGUOUS_FLAG, SCM_CLR_ARRAY_CONTIGUOUS_FLAG so that
scm_from_contiguous_array() can keep using them.
* libguile/deprecated.c (scm_from_contiguous_array): Move here from
arrays.c.
* libguile/deprecated.h (scm_from_contiguous_array): Deprecate.
* NEWS: Add deprecation notice.
Diffstat (limited to 'libguile/arrays.h')
-rw-r--r-- | libguile/arrays.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libguile/arrays.h b/libguile/arrays.h index 977d30760..37eea69bd 100644 --- a/libguile/arrays.h +++ b/libguile/arrays.h @@ -37,8 +37,6 @@ /** Arrays */ SCM_API SCM scm_make_array (SCM fill, SCM bounds); -SCM_API SCM scm_from_contiguous_array (SCM bounds, const SCM *elts, - size_t len); SCM_API SCM scm_make_typed_array (SCM type, SCM fill, SCM bounds); SCM_API SCM scm_from_contiguous_typed_array (SCM type, SCM bounds, const void *bytes, @@ -63,7 +61,12 @@ SCM_API SCM scm_array_rank (SCM ra); /* internal. */ -#define SCM_I_ARRAY_FLAG_CONTIGUOUS (1 << 0) +/* see scm_from_contiguous_array for these three */ +#define SCM_I_ARRAY_FLAG_CONTIGUOUS (1 << 0) +#define SCM_SET_ARRAY_CONTIGUOUS_FLAG(x) \ + (SCM_SET_CELL_WORD_0 ((x), SCM_CELL_WORD_0 (x) | (SCM_I_ARRAY_FLAG_CONTIGUOUS << 16))) +#define SCM_CLR_ARRAY_CONTIGUOUS_FLAG(x) \ + (SCM_SET_CELL_WORD_0 ((x), SCM_CELL_WORD_0 (x) & ~(SCM_I_ARRAY_FLAG_CONTIGUOUS << 16))) #define SCM_I_ARRAYP(a) SCM_TYP16_PREDICATE (scm_tc7_array, a) #define SCM_I_ARRAY_NDIM(x) ((size_t) (SCM_CELL_WORD_0 (x)>>17)) @@ -78,6 +81,7 @@ SCM_API SCM scm_array_rank (SCM ra); SCM_INTERNAL SCM scm_i_make_array (int ndim); SCM_INTERNAL int scm_i_print_array (SCM array, SCM port, scm_print_state *pstate); +SCM_INTERNAL SCM scm_i_shap2ra (SCM args); SCM_INTERNAL void scm_init_arrays (void); |