summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--libguile/bitvectors.c10
-rw-r--r--libguile/generalized-vectors.c13
-rw-r--r--libguile/generalized-vectors.h7
-rw-r--r--libguile/random.c8
-rw-r--r--libguile/vectors.c15
6 files changed, 27 insertions, 30 deletions
diff --git a/NEWS b/NEWS
index 7620cfd55..8c0281d81 100644
--- a/NEWS
+++ b/NEWS
@@ -891,6 +891,10 @@ but not specifically mentioned earlier in this file, have been removed:
removed. Use `get-bytevector-n!' and `put-bytevector' from (rnrs io
ports) instead.
+*** `scm_generalized_vector_get_handle' has been removed. Use
+ `scm_array_get_handle' to get a handle and `scm_array_handle_rank'
+ to check the rank.
+
** Remove miscellaneous unused interfaces
We have removed accidentally public, undocumented interfaces that we
diff --git a/libguile/bitvectors.c b/libguile/bitvectors.c
index cfca4ab6c..a6527f56e 100644
--- a/libguile/bitvectors.c
+++ b/libguile/bitvectors.c
@@ -27,12 +27,9 @@
#include "libguile/_scm.h"
#include "libguile/__scm.h"
-#include "libguile/strings.h"
#include "libguile/array-handle.h"
#include "libguile/bitvectors.h"
#include "libguile/arrays.h"
-#include "libguile/generalized-vectors.h"
-#include "libguile/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.
@@ -205,7 +202,12 @@ scm_bitvector_elements (SCM vec,
size_t *lenp,
ssize_t *incp)
{
- scm_generalized_vector_get_handle (vec, h);
+ scm_array_get_handle (vec, h);
+ if (1 != scm_array_handle_rank (h))
+ {
+ scm_array_handle_release (h);
+ scm_wrong_type_arg_msg (NULL, 0, vec, "rank 1 bit array");
+ }
if (offp)
{
scm_t_array_dim *dim = scm_array_handle_dims (h);
diff --git a/libguile/generalized-vectors.c b/libguile/generalized-vectors.c
index 276b9d865..68c1042ec 100644
--- a/libguile/generalized-vectors.c
+++ b/libguile/generalized-vectors.c
@@ -27,8 +27,6 @@
#include "libguile/_scm.h"
#include "libguile/__scm.h"
-#include "libguile/array-handle.h"
-#include "libguile/generalized-arrays.h"
#include "libguile/generalized-vectors.h"
@@ -70,17 +68,6 @@ SCM_DEFINE (scm_make_generalized_vector, "make-generalized-vector", 2, 1, 0,
#undef FUNC_NAME
void
-scm_generalized_vector_get_handle (SCM vec, scm_t_array_handle *h)
-{
- scm_array_get_handle (vec, h);
- if (scm_array_handle_rank (h) != 1)
- {
- scm_array_handle_release (h);
- scm_wrong_type_arg_msg (NULL, 0, vec, "vector");
- }
-}
-
-void
scm_init_generalized_vectors ()
{
#include "libguile/generalized-vectors.x"
diff --git a/libguile/generalized-vectors.h b/libguile/generalized-vectors.h
index 77d62726f..9df8a0c0a 100644
--- a/libguile/generalized-vectors.h
+++ b/libguile/generalized-vectors.h
@@ -3,7 +3,8 @@
#ifndef SCM_GENERALIZED_VECTORS_H
#define SCM_GENERALIZED_VECTORS_H
-/* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008, 2009, 2013 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1999,2000,2001, 2004, 2006, 2008, 2009, 2013
+ * Free Software Foundation, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
@@ -24,15 +25,11 @@
#include "libguile/__scm.h"
-#include "libguile/array-handle.h"
/* Generalized vectors */
-SCM_API void scm_generalized_vector_get_handle (SCM vec,
- scm_t_array_handle *h);
-
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));
diff --git a/libguile/random.c b/libguile/random.c
index 1ee0459de..a8ad07567 100644
--- a/libguile/random.c
+++ b/libguile/random.c
@@ -621,7 +621,13 @@ SCM_DEFINE (scm_random_normal_vector_x, "random:normal-vector!", 1, 1, 0,
state = SCM_VARIABLE_REF (scm_var_random_state);
SCM_VALIDATE_RSTATE (2, state);
- scm_generalized_vector_get_handle (v, &handle);
+ scm_array_get_handle (v, &handle);
+ if (1 != scm_array_handle_rank (&handle))
+ {
+ scm_array_handle_release (&handle);
+ scm_wrong_type_arg_msg (NULL, 0, v, "rank 1 array");
+ }
+
dim = scm_array_handle_dims (&handle);
if (handle.element_type == SCM_ARRAY_ELEMENT_TYPE_SCM)
diff --git a/libguile/vectors.c b/libguile/vectors.c
index 328cf6f5f..d18302258 100644
--- a/libguile/vectors.c
+++ b/libguile/vectors.c
@@ -25,15 +25,10 @@
#include "libguile/_scm.h"
#include "libguile/eq.h"
-#include "libguile/strings.h"
#include "libguile/validate.h"
#include "libguile/vectors.h"
-#include "libguile/arrays.h" /* Hit me with the ugly stick */
-#include "libguile/generalized-vectors.h"
-#include "libguile/strings.h"
-#include "libguile/srfi-13.h"
-#include "libguile/dynwind.h"
+#include "libguile/array-handle.h"
#include "libguile/bdw-gc.h"
@@ -68,7 +63,13 @@ scm_vector_elements (SCM vec, scm_t_array_handle *h,
if (SCM_I_WVECTP (vec))
scm_wrong_type_arg_msg (NULL, 0, vec, "non-weak vector");
- scm_generalized_vector_get_handle (vec, h);
+ scm_array_get_handle (vec, h);
+ if (1 != scm_array_handle_rank (h))
+ {
+ scm_array_handle_release (h);
+ scm_wrong_type_arg_msg (NULL, 0, vec, "rank 1 array of Scheme values");
+ }
+
if (lenp)
{
scm_t_array_dim *dim = scm_array_handle_dims (h);