[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 22/27: Remove scm_from_contiguous_typed_array
From: |
Daniel Llorens |
Subject: |
[Guile-commits] 22/27: Remove scm_from_contiguous_typed_array |
Date: |
Thu, 9 Apr 2020 11:00:10 -0400 (EDT) |
lloda pushed a commit to branch wip-vector-cleanup
in repository guile.
commit d88d4d55588198754478731713e1450cae16446f
Author: Daniel Llorens <address@hidden>
AuthorDate: Fri Feb 7 10:53:59 2020 +0100
Remove scm_from_contiguous_typed_array
This function was undocumented and not used anywhere.
libguile/arrays.h:
libguile/arrays.c: As stated.
---
doc/ref/api-data.texi | 6 ++----
libguile/arrays.c | 58 ---------------------------------------------------
libguile/arrays.h | 3 ---
3 files changed, 2 insertions(+), 65 deletions(-)
diff --git a/doc/ref/api-data.texi b/doc/ref/api-data.texi
index 5c49272..54586a1 100644
--- a/doc/ref/api-data.texi
+++ b/doc/ref/api-data.texi
@@ -6459,8 +6459,6 @@ Return a pointer to the elements of @var{vec}. This
pointer can only be
used to read the elements of @var{vec}. When @var{vec} is not a vector,
an error is signaled.
-For use with general arrays, see @code{scm_array_handle_elements}.
-
The following example shows the typical way to use this function. It
creates a list of all elements of @var{vec} (in reverse order).
@@ -6473,14 +6471,13 @@ for (size_t i = 0; i < len; ++i)
list = scm_cons (elt[i], list);
@end example
+For use with general arrays, see @code{scm_array_handle_elements}.
@end deftypefn
@deftypefn {C Function} {SCM *} scm_vector_writable_elements (SCM vec, size_t
*lenp)
Like @code{scm_vector_elements} but the pointer can be used to modify
the vector.
-For use with general arrays, see @code{scm_array_handle_writable_elements}.
-
The following example shows the typical way to use this function. It
fills a vector with @code{#t} (but see @code{vector-fill!}).
@@ -6492,6 +6489,7 @@ for (size_t i = 0; i < len; ++i)
elt[i] = SCM_BOOL_T;
@end example
+For use with general arrays, see @code{scm_array_handle_writable_elements}.
@end deftypefn
@node Uniform Numeric Vectors
diff --git a/libguile/arrays.c b/libguile/arrays.c
index 26e2fab..95bc6e1 100644
--- a/libguile/arrays.c
+++ b/libguile/arrays.c
@@ -628,64 +628,6 @@ SCM_DEFINE (scm_make_typed_array, "make-typed-array", 2,
0, 1,
}
#undef FUNC_NAME
-SCM
-scm_from_contiguous_typed_array (SCM type, SCM bounds, const void *bytes,
- size_t byte_len)
-#define FUNC_NAME "scm_from_contiguous_typed_array"
-{
- size_t k, rlen = 1;
- scm_t_array_dim *s;
- SCM ra;
- scm_t_array_handle h;
- void *elts;
- size_t sz;
-
- ra = scm_i_shap2ra (bounds);
- SCM_SET_ARRAY_CONTIGUOUS_FLAG (ra);
- s = SCM_I_ARRAY_DIMS (ra);
- k = SCM_I_ARRAY_NDIM (ra);
-
- while (k--)
- {
- s[k].inc = rlen;
- SCM_ASSERT_RANGE (1, bounds, s[k].lbnd <= s[k].ubnd + 1);
- rlen = (s[k].ubnd - s[k].lbnd + 1) * s[k].inc;
- }
- SCM_I_ARRAY_SET_V (ra, scm_make_generalized_vector (type, scm_from_size_t
(rlen), SCM_UNDEFINED));
-
-
- scm_array_get_handle (ra, &h);
- elts = h.writable_elements;
- sz = scm_array_handle_uniform_element_bit_size (&h);
- scm_array_handle_release (&h);
-
- if (sz >= 8 && ((sz % 8) == 0))
- {
- if (byte_len % (sz / 8))
- SCM_MISC_ERROR ("byte length not a multiple of the unit size",
SCM_EOL);
- if (byte_len / (sz / 8) != rlen)
- SCM_MISC_ERROR ("byte length and dimensions do not match", SCM_EOL);
- }
- else if (sz < 8)
- {
- /* Elements of sub-byte size (bitvectors) are addressed in 32-bit
- units. */
- if (byte_len != ((rlen * sz + 31) / 32) * 4)
- SCM_MISC_ERROR ("byte length and dimensions do not match", SCM_EOL);
- }
- else
- /* an internal guile error, really */
- SCM_MISC_ERROR ("uniform elements larger than 8 bits must fill whole
bytes", SCM_EOL);
-
- memcpy (elts, bytes, byte_len);
-
- if (1 == SCM_I_ARRAY_NDIM (ra) && 0 == SCM_I_ARRAY_BASE (ra))
- if (0 == s->lbnd)
- return SCM_I_ARRAY_V (ra);
- return ra;
-}
-#undef FUNC_NAME
-
SCM_DEFINE (scm_make_array, "make-array", 1, 0, 1,
(SCM fill, SCM bounds),
"Create and return an array.")
diff --git a/libguile/arrays.h b/libguile/arrays.h
index dc8cf86..0d2f334 100644
--- a/libguile/arrays.h
+++ b/libguile/arrays.h
@@ -69,9 +69,6 @@ SCM_API SCM scm_array_to_list (SCM v);
SCM_API SCM scm_make_array (SCM fill, SCM bounds);
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,
- size_t byte_len);
SCM_API SCM scm_shared_array_root (SCM ra);
SCM_API SCM scm_shared_array_offset (SCM ra);
- [Guile-commits] 07/27: Simplify interfaces to scm_bitvector_elements and scm_bitvector_writable_elements, (continued)
- [Guile-commits] 07/27: Simplify interfaces to scm_bitvector_elements and scm_bitvector_writable_elements, Daniel Llorens, 2020/04/09
- [Guile-commits] 09/27: Simplify interfaces to scm_TYPEvector_(writable_)elements, Daniel Llorens, 2020/04/09
- [Guile-commits] 11/27: Add lenp parameter back to scm_bitvector_(writable_)elements, Daniel Llorens, 2020/04/09
- [Guile-commits] 14/27: Golf in srfi-4.h, Daniel Llorens, 2020/04/09
- [Guile-commits] 16/27: Pull generalized-vectors from under bitvector/string/vector, Daniel Llorens, 2020/04/09
- [Guile-commits] 17/27: Pull generalized-vectors from under typed vectors, Daniel Llorens, 2020/04/09
- [Guile-commits] 19/27: Remove generalized-vectors.[hc], Daniel Llorens, 2020/04/09
- [Guile-commits] 05/27: Simple vectors are just vectors, Daniel Llorens, 2020/04/09
- [Guile-commits] 15/27: Rewrite vector-copy! using memmove, Daniel Llorens, 2020/04/09
- [Guile-commits] 12/27: Remove generalized vector support for vector-move-right!, vector-move-left!, Daniel Llorens, 2020/04/09
- [Guile-commits] 22/27: Remove scm_from_contiguous_typed_array,
Daniel Llorens <=
- [Guile-commits] 13/27: Move bitvector functions using array_handle to libguile/array-handle.[ch], Daniel Llorens, 2020/04/09
- [Guile-commits] 18/27: Pull generalized-vectors from under bytevectors, Daniel Llorens, 2020/04/09
- [Guile-commits] 25/27: Remove superfluous type check in bitvector->list, Daniel Llorens, 2020/04/09
- [Guile-commits] 26/27: Simplify vector constructor, Daniel Llorens, 2020/04/09
- [Guile-commits] 23/27: Remove 'contiguous' flag in arrays, Daniel Llorens, 2020/04/09
- [Guile-commits] 24/27: Move uniform-array->bytevector from (rnrs bytevectors) to core, Daniel Llorens, 2020/04/09
- [Guile-commits] 20/27: Update branch news file, Daniel Llorens, 2020/04/09
- [Guile-commits] 27/27: Reuse SCM_ASSERT_RANGE in scm_c_vector_ref, scm_c_vector_set_x, Daniel Llorens, 2020/04/09
- [Guile-commits] 21/27: Merge generalized-arrays.[ch] in arrays.[ch], Daniel Llorens, 2020/04/09