summaryrefslogtreecommitdiff
path: root/libguile/srfi-4.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2009-08-17 23:39:56 +0200
committerLudovic Courtès <ludo@gnu.org>2009-08-18 00:06:45 +0200
commitfbb857a472eb4e69c1cba05e86646b7004f32df6 (patch)
treeff23e64de5a558b575ed812349d8af6e64d8ceb4 /libguile/srfi-4.c
parent49c9839eae84f7f3cd10db45f389fa1ea1050659 (diff)
parente33a910dd0f430f34c32fe6846899aee33fc2cf6 (diff)
downloadguile-fbb857a472eb4e69c1cba05e86646b7004f32df6.tar.gz
Merge branch 'master' into boehm-demers-weiser-gc
Conflicts: lib/Makefile.am libguile/Makefile.am libguile/frames.c libguile/gc-card.c libguile/gc-freelist.c libguile/gc-mark.c libguile/gc-segment.c libguile/gc_os_dep.c libguile/load.c libguile/macros.c libguile/objcodes.c libguile/programs.c libguile/strings.c libguile/vm.c m4/gnulib-cache.m4 m4/gnulib-comp.m4 m4/inline.m4
Diffstat (limited to 'libguile/srfi-4.c')
-rw-r--r--libguile/srfi-4.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/libguile/srfi-4.c b/libguile/srfi-4.c
index 3e43a4985..b45d4029b 100644
--- a/libguile/srfi-4.c
+++ b/libguile/srfi-4.c
@@ -1,20 +1,21 @@
/* srfi-4.c --- Uniform numeric vector datatypes.
*
- * Copyright (C) 2001, 2004, 2006 Free Software Foundation, Inc.
+ * Copyright (C) 2001, 2004, 2006, 2009 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 2.1 of the License, or (at your option) any later version.
+ * 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
+ * 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
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
*/
#ifdef HAVE_CONFIG_H
@@ -28,6 +29,7 @@
#include "libguile/_scm.h"
#include "libguile/__scm.h"
#include "libguile/srfi-4.h"
+#include "libguile/bytevectors.h"
#include "libguile/error.h"
#include "libguile/read.h"
#include "libguile/ports.h"
@@ -580,6 +582,8 @@ scm_i_generalized_vector_type (SCM v)
return scm_sym_b;
else if (scm_is_uniform_vector (v))
return scm_from_locale_symbol (uvec_tags[SCM_UVEC_TYPE(v)]);
+ else if (scm_is_bytevector (v))
+ return scm_from_locale_symbol ("vu8");
else
return SCM_BOOL_F;
}
@@ -721,6 +725,8 @@ scm_array_handle_uniform_element_size (scm_t_array_handle *h)
vec = SCM_I_ARRAY_V (vec);
if (scm_is_uniform_vector (vec))
return uvec_sizes[SCM_UVEC_TYPE(vec)];
+ if (scm_is_bytevector (vec))
+ return 1U;
scm_wrong_type_arg_msg (NULL, 0, h->array, "uniform array");
}
@@ -761,6 +767,8 @@ scm_array_handle_uniform_writable_elements (scm_t_array_handle *h)
char *elts = SCM_UVEC_BASE (vec);
return (void *) (elts + size*h->base);
}
+ if (scm_is_bytevector (vec))
+ return SCM_BYTEVECTOR_CONTENTS (vec);
scm_wrong_type_arg_msg (NULL, 0, h->array, "uniform array");
}