guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 16/27: Pull generalized-vectors from under bitvector/str


From: Daniel Llorens
Subject: [Guile-commits] 16/27: Pull generalized-vectors from under bitvector/string/vector
Date: Thu, 20 Feb 2020 03:45:44 -0500 (EST)

lloda pushed a commit to branch wip-vector-cleanup
in repository guile.

commit fc981ddf90b334e3f1a142fffefdf5ce1ebcddcb
Author: Daniel Llorens <address@hidden>
AuthorDate: Thu Feb 6 15:18:14 2020 +0100

    Pull generalized-vectors from under bitvector/string/vector
    
    * libguile/generalized-vectors.c: Collect the register array type functions 
here.
    * libguile/strings.c: Remove array registry code. Fix includes.
    * libguile/vectors.c: Remove array registry code. Fix includes.
    * libguile/bitvectors.c: Remove array registry code. Fix includes.
---
 libguile/bitvectors.c          | 14 ++++++--------
 libguile/generalized-vectors.c | 10 +++++++++-
 libguile/srfi-4.h              |  2 ++
 libguile/strings.c             |  3 ---
 libguile/vectors.c             |  7 -------
 5 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/libguile/bitvectors.c b/libguile/bitvectors.c
index 9ae410d..3b305fe 100644
--- a/libguile/bitvectors.c
+++ b/libguile/bitvectors.c
@@ -25,21 +25,21 @@
 #endif
 
 #include <string.h>
+#include <stdbool.h>
 
-#include "array-handle.h"
-#include "arrays.h"
 #include "boolean.h"
-#include "generalized-vectors.h"
 #include "gsubr.h"
 #include "list.h"
 #include "numbers.h"
 #include "pairs.h"
 #include "ports.h"
-#include "srfi-4.h"
-#include <stdbool.h>
-
 #include "bitvectors.h"
 
+/* FIXME move functions using these (operating on rank-1 bit arrays, not
+   bitvectors) to a separate source file
+*/
+#include "arrays.h"
+#include "srfi-4.h"
 
 /* Bit vectors. Would be nice if they were implemented on top of bytevectors,
  * but alack, all we have is this crufty C.
@@ -756,8 +756,6 @@ scm_istr2bve (SCM str)
   return res;
 }
 
-SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_BIT, scm_make_bitvector)
-
 void
 scm_init_bitvectors ()
 {
diff --git a/libguile/generalized-vectors.c b/libguile/generalized-vectors.c
index b7516a3..68c1d23 100644
--- a/libguile/generalized-vectors.c
+++ b/libguile/generalized-vectors.c
@@ -28,7 +28,10 @@
 #include "gsubr.h"
 
 #include "generalized-vectors.h"
-
+#include "array-handle.h"
+#include "vectors.h"
+#include "bitvectors.h"
+#include "strings.h"
 
 struct scm_t_vector_ctor
 {
@@ -67,6 +70,11 @@ SCM_DEFINE (scm_make_generalized_vector, 
"make-generalized-vector", 2, 1, 0,
 }
 #undef FUNC_NAME
 
+
+SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_SCM, scm_make_vector)
+SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_BIT, scm_make_bitvector)
+SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_CHAR, scm_make_string)
+
 void
 scm_init_generalized_vectors ()
 {
diff --git a/libguile/srfi-4.h b/libguile/srfi-4.h
index b519dfc..6ce5900 100644
--- a/libguile/srfi-4.h
+++ b/libguile/srfi-4.h
@@ -22,6 +22,8 @@
    <https://www.gnu.org/licenses/>.  */
 
 
+/* FIXME move array-handle functions to array-handle.[hc] */
+
 #include "libguile/array-handle.h"
 
 SCM_API SCM scm_make_srfi_4_vector (SCM type, SCM len, SCM fill);
diff --git a/libguile/strings.c b/libguile/strings.c
index aab1044..00f2141 100644
--- a/libguile/strings.c
+++ b/libguile/strings.c
@@ -37,7 +37,6 @@
 #include "chars.h"
 #include "deprecation.h"
 #include "error.h"
-#include "generalized-vectors.h"
 #include "gsubr.h"
 #include "numbers.h"
 #include "pairs.h"
@@ -2493,8 +2492,6 @@ scm_i_get_substring_spec (size_t len,
     *cend = scm_to_unsigned_integer (end, *cstart, len);
 }
                  
-SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_CHAR, scm_make_string)
-
 void
 scm_init_strings ()
 {
diff --git a/libguile/vectors.c b/libguile/vectors.c
index dc483c4..16823d3 100644
--- a/libguile/vectors.c
+++ b/libguile/vectors.c
@@ -34,10 +34,6 @@
 #include "vectors.h"
 #include <string.h>
 
-// You're next
-#include "array-handle.h"
-#include "generalized-vectors.h"
-
 
 
 #define VECTOR_MAX_LENGTH (SCM_T_BITS_MAX >> 8)
@@ -425,9 +421,6 @@ SCM_DEFINE (scm_vector_move_right_x, "vector-move-right!", 
5, 0, 0,
 }
 #undef FUNC_NAME
 
-
-SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_SCM, scm_make_vector)
-
 void
 scm_init_vectors ()
 {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]