summaryrefslogtreecommitdiff
path: root/libguile/vectors.c
diff options
context:
space:
mode:
Diffstat (limited to 'libguile/vectors.c')
-rw-r--r--libguile/vectors.c79
1 files changed, 37 insertions, 42 deletions
diff --git a/libguile/vectors.c b/libguile/vectors.c
index acdda5dcd..87a50a3dd 100644
--- a/libguile/vectors.c
+++ b/libguile/vectors.c
@@ -1,41 +1,40 @@
-/* Copyright (C) 1995, 1996, 1998-2001, 2006, 2008-2012, 2014, 2019
- * 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
- * as published by the Free Software Foundation; either version 3 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301 USA
- */
+/* Copyright 1995-1996,1998-2001,2006,2008-2012,2014,2018-2019
+ Free Software Foundation, Inc.
+
+ This file is part of Guile.
+
+ Guile is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ Guile is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+ License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with Guile. If not, see
+ <https://www.gnu.org/licenses/>. */
+
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
-#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 "array-handle.h"
+#include "bdw-gc.h"
+#include "boolean.h"
+#include "eq.h"
+#include "gsubr.h"
+#include "list.h"
+#include "numbers.h"
+#include "pairs.h"
+#include "vectors.h"
-#include "libguile/bdw-gc.h"
+#include "generalized-vectors.h"
@@ -64,11 +63,13 @@ const SCM *
scm_vector_elements (SCM vec, scm_t_array_handle *h,
size_t *lenp, ssize_t *incp)
{
- /* it's unsafe to access the memory of a weak vector */
- 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);
@@ -436,12 +437,6 @@ SCM_VECTOR_IMPLEMENTATION (SCM_ARRAY_ELEMENT_TYPE_SCM, scm_make_vector)
void
scm_init_vectors ()
{
-#include "libguile/vectors.x"
+#include "vectors.x"
}
-
-/*
- Local Variables:
- c-file-style: "gnu"
- End:
-*/