guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 01/01: Remove scm_generalized_vector_get_handle


From: Daniel Llorens
Subject: [Guile-commits] 01/01: Remove scm_generalized_vector_get_handle
Date: Tue, 31 Oct 2017 08:54:41 -0400 (EDT)

lloda pushed a commit to branch master
in repository guile.

commit 2d8c75f9f252b41aad93b5dfcdf10a1aee86e463
Author: Daniel Llorens <address@hidden>
Date:   Mon Feb 13 13:41:45 2017 +0100

    Remove scm_generalized_vector_get_handle
    
    This was deprecated in 2.0.9 (118ff892be199f0af359d1b027645d4783a364ec).
    
    * libguile/bitvectors.c (scm_bitvector_writable_elements): Replace
      scm_generalized_vector_get_handle.
      Remove unnecessary #includes.
    * libguile/vectors.c (scm_vector_writable_elements): Replace
      scm_generalized_vector_get_handle.
      Remove unnecessary #includes.
    * libguile/random.c (scm_random_normal_vector_x): Replace
      scm_generalized_vector_get_handle.
    * libguile/generalized-vectors.h, libguile/generalized-vectors.c
      (scm_generalized_vector_get_handle): Remove.
      Remove unnecessary #includes.
    * NEWS: Add removal notice.
---
 NEWS                           |  5 +++++
 libguile/bitvectors.c          | 10 ++++++----
 libguile/generalized-vectors.c | 13 -------------
 libguile/generalized-vectors.h |  7 ++-----
 libguile/random.c              |  8 +++++++-
 libguile/vectors.c             | 15 ++++++++-------
 6 files changed, 28 insertions(+), 30 deletions(-)

diff --git a/NEWS b/NEWS
index f941767..92666af 100644
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,11 @@ All code deprecated in Guile 2.2 has been removed.  See 
older NEWS, and
 check that your programs can compile without linker warnings and run
 without runtime warnings.  See "Deprecation" in the manual.
 
+In particular, the function `scm_generalized_vector_get_handle' which
+was deprecated in 2.0.9 but remained in 2.2, has now finally been
+removed. As a replacement, use `scm_array_get_handle' to get a handle
+and `scm_array_handle_rank' to check the rank.
+
 ** Remove "self" field from vtables and "redefined" field from classes
 
 These fields were used as part of the machinery for class redefinition
diff --git a/libguile/bitvectors.c b/libguile/bitvectors.c
index cfca4ab..a6527f5 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 276b9d8..68c1042 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 77d6272..9df8a0c 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 1ee0459..a8ad075 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 328cf6f..d183022 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);



reply via email to

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