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

commit 4c58fc6f91147083ac62b4f5409a854d1557acf9
Author: Daniel Llorens <ll...@sarc.name>
AuthorDate: Thu Feb 6 15:40:51 2020 +0100

    Pull generalized-vectors from under typed vectors
---
 libguile/generalized-vectors.c | 25 ++++++++++++++++++++++++-
 libguile/generalized-vectors.h |  4 ----
 libguile/srfi-4.c              | 19 -------------------
 3 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/libguile/generalized-vectors.c b/libguile/generalized-vectors.c
index 68c1d23..e3d0f69 100644
--- a/libguile/generalized-vectors.c
+++ b/libguile/generalized-vectors.c
@@ -29,9 +29,10 @@
 
 #include "generalized-vectors.h"
 #include "array-handle.h"
-#include "vectors.h"
 #include "bitvectors.h"
 #include "strings.h"
+#include "vectors.h"
+#include "srfi-4.h"
 
 struct scm_t_vector_ctor
 {
@@ -70,6 +71,10 @@ SCM_DEFINE (scm_make_generalized_vector, 
"make-generalized-vector", 2, 1, 0,
 }
 #undef FUNC_NAME
 
+#define SCM_VECTOR_IMPLEMENTATION(type, ctor)                   \
+  SCM_SNARF_INIT (scm_i_register_vector_constructor             \
+                  (scm_i_array_element_types[type], ctor))
+
 
 SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_SCM, scm_make_vector)
 SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_BIT, scm_make_bitvector)
@@ -78,5 +83,23 @@ SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_CHAR, 
scm_make_string)
 void
 scm_init_generalized_vectors ()
 {
+#define REGISTER(tag, TAG)                                      \
+  scm_i_register_vector_constructor                             \
+    (scm_i_array_element_types[SCM_ARRAY_ELEMENT_TYPE_##TAG],   \
+     scm_make_##tag##vector)
+
+  REGISTER (u8, U8); 
+  REGISTER (s8, S8); 
+  REGISTER (u16, U16);
+  REGISTER (s16, S16);
+  REGISTER (u32, U32);
+  REGISTER (s32, S32);
+  REGISTER (u64, U64);
+  REGISTER (s64, S64);
+  REGISTER (f32, F32);
+  REGISTER (f64, F64);
+  REGISTER (c32, C32);
+  REGISTER (c64, C64);
+  
 #include "generalized-vectors.x"
 }
diff --git a/libguile/generalized-vectors.h b/libguile/generalized-vectors.h
index 7a8da6a..1c5d021 100644
--- a/libguile/generalized-vectors.h
+++ b/libguile/generalized-vectors.h
@@ -31,10 +31,6 @@
 SCM_API SCM scm_make_generalized_vector (SCM type, SCM len, SCM fill);
 SCM_INTERNAL void scm_i_register_vector_constructor (SCM type, SCM 
(*ctor)(SCM, SCM));
 
-#define SCM_VECTOR_IMPLEMENTATION(type, ctor)                   \
-  SCM_SNARF_INIT (scm_i_register_vector_constructor             \
-                  (scm_i_array_element_types[type], ctor))
-
 SCM_INTERNAL void scm_init_generalized_vectors (void);
 
 #endif  /* SCM_GENERALIZED_VECTORS_H */
diff --git a/libguile/srfi-4.c b/libguile/srfi-4.c
index 912feeb..0107b9a 100644
--- a/libguile/srfi-4.c
+++ b/libguile/srfi-4.c
@@ -31,7 +31,6 @@
 #include "error.h"
 #include "eval.h"
 #include "extensions.h"
-#include "generalized-vectors.h"
 #include "gsubr.h"
 #include "modules.h"
 #include "numbers.h"
@@ -273,24 +272,6 @@ SCM_DEFINE (scm_make_srfi_4_vector, "make-srfi-4-vector", 
2, 1, 0,
 void
 scm_init_srfi_4 (void)
 {
-#define REGISTER(tag, TAG)                                       \
-  scm_i_register_vector_constructor                              \
-    (scm_i_array_element_types[SCM_ARRAY_ELEMENT_TYPE_##TAG],    \
-     scm_make_##tag##vector)
-
-  REGISTER (u8, U8); 
-  REGISTER (s8, S8); 
-  REGISTER (u16, U16);
-  REGISTER (s16, S16);
-  REGISTER (u32, U32);
-  REGISTER (s32, S32);
-  REGISTER (u64, U64);
-  REGISTER (s64, S64);
-  REGISTER (f32, F32);
-  REGISTER (f64, F64);
-  REGISTER (c32, C32);
-  REGISTER (c64, C64);
-
 #include "srfi-4.x"
 }
 

Reply via email to