diff options
author | Ludovic Courtès <ludo@gnu.org> | 2009-08-17 23:39:56 +0200 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2009-08-18 00:06:45 +0200 |
commit | fbb857a472eb4e69c1cba05e86646b7004f32df6 (patch) | |
tree | ff23e64de5a558b575ed812349d8af6e64d8ceb4 /libguile/vectors.c | |
parent | 49c9839eae84f7f3cd10db45f389fa1ea1050659 (diff) | |
parent | e33a910dd0f430f34c32fe6846899aee33fc2cf6 (diff) |
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/vectors.c')
-rw-r--r-- | libguile/vectors.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/libguile/vectors.c b/libguile/vectors.c index c01b3e3b6..255323f25 100644 --- a/libguile/vectors.c +++ b/libguile/vectors.c @@ -1,18 +1,19 @@ -/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1995,1996,1998,1999,2000,2001, 2006, 2008, 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 */ @@ -30,6 +31,7 @@ #include "libguile/validate.h" #include "libguile/vectors.h" #include "libguile/unif.h" +#include "libguile/bytevectors.h" #include "libguile/ramap.h" #include "libguile/srfi-4.h" #include "libguile/strings.h" @@ -606,7 +608,7 @@ SCM_DEFINE (scm_vector_move_right_x, "vector-move-right!", 5, 0, 0, } #undef FUNC_NAME - + /* Generalized vectors. */ int @@ -615,7 +617,8 @@ scm_is_generalized_vector (SCM obj) return (scm_is_vector (obj) || scm_is_string (obj) || scm_is_bitvector (obj) - || scm_is_uniform_vector (obj)); + || scm_is_uniform_vector (obj) + || scm_is_bytevector (obj)); } SCM_DEFINE (scm_generalized_vector_p, "generalized-vector?", 1, 0, 0, @@ -647,6 +650,8 @@ scm_c_generalized_vector_length (SCM v) return scm_c_bitvector_length (v); else if (scm_is_uniform_vector (v)) return scm_c_uniform_vector_length (v); + else if (scm_is_bytevector (v)) + return scm_c_bytevector_length (v); else scm_wrong_type_arg_msg (NULL, 0, v, "generalized vector"); } @@ -671,6 +676,8 @@ scm_c_generalized_vector_ref (SCM v, size_t idx) return scm_c_bitvector_ref (v, idx); else if (scm_is_uniform_vector (v)) return scm_c_uniform_vector_ref (v, idx); + else if (scm_is_bytevector (v)) + return scm_from_uint8 (scm_c_bytevector_ref (v, idx)); else scm_wrong_type_arg_msg (NULL, 0, v, "generalized vector"); } @@ -696,6 +703,8 @@ scm_c_generalized_vector_set_x (SCM v, size_t idx, SCM val) scm_c_bitvector_set_x (v, idx, val); else if (scm_is_uniform_vector (v)) scm_c_uniform_vector_set_x (v, idx, val); + else if (scm_is_bytevector (v)) + scm_i_bytevector_generalized_set_x (v, idx, val); else scm_wrong_type_arg_msg (NULL, 0, v, "generalized vector"); } |