bytevector: Add support for `utfXX->string'.
[guile-r6rs-libs.git] / modules / r6rs / bytevector.scm
blobe791122971ed1dc748721a4116fdafd74d222235
1 ;;; Guile-R6RS-Libs --- Implementation of R6RS standard libraries.
2 ;;; Copyright (C) 2007  Ludovic Courtès <ludovic.courtes@laas.fr>
3 ;;;
4 ;;; Guile-R6RS-Libs is free software; you can redistribute it and/or
5 ;;; modify it under the terms of the GNU Lesser General Public
6 ;;; License as published by the Free Software Foundation; either
7 ;;; version 2.1 of the License, or (at your option) any later version.
8 ;;;
9 ;;; Guile-R6RS-Libs is distributed in the hope that it will be useful,
10 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
11 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 ;;; Lesser General Public License for more details.
13 ;;;
14 ;;; You should have received a copy of the GNU Lesser General Public
15 ;;; License along with Guile-R6RS-Libs; if not, write to the Free Software
16 ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
18 (define-module (r6rs bytevector)
19   :export-syntax (endianness)
20   :export (native-endianness bytevector?
21            make-bytevector bytevector-length bytevector=? bytevector-fill!
22            bytevector-copy! bytevector-copy bytevector-u8-ref
23            bytevector-s8-ref
24            bytevector-u8-set! bytevector-s8-set! bytevector->u8-list
25            u8-list->bytevector
26            bytevector-uint-ref bytevector-uint-set!
27            bytevector-sint-ref bytevector-sint-set!
28            bytevector->sint-list bytevector->uint-list
29            uint-list->bytevector sint-list->bytevector
31            bytevector-u16-ref bytevector-s16-ref
32            bytevector-u16-set! bytevector-s16-set!
33            bytevector-u16-native-ref bytevector-s16-native-ref
34            bytevector-u16-native-set! bytevector-s16-native-set!
36            bytevector-u32-ref bytevector-s32-ref
37            bytevector-u32-set! bytevector-s32-set!
38            bytevector-u32-native-ref bytevector-s32-native-ref
39            bytevector-u32-native-set! bytevector-s32-native-set!
41            bytevector-u64-ref bytevector-s64-ref
42            bytevector-u64-set! bytevector-s64-set!
43            bytevector-u64-native-ref bytevector-s64-native-ref
44            bytevector-u64-native-set! bytevector-s64-native-set!
46            bytevector-ieee-single-ref
47            bytevector-ieee-single-set!
48            bytevector-ieee-single-native-ref
49            bytevector-ieee-single-native-set!
51            bytevector-ieee-double-ref
52            bytevector-ieee-double-set!
53            bytevector-ieee-double-native-ref
54            bytevector-ieee-double-native-set!
56            string->utf8 string->utf16 string->utf32
57            utf8->string utf16->string utf32->string))
60 (load-extension "libguile-r6rs-libs-v-0" "scm_init_r6rs_bytevector")
62 (define-macro (endianness sym)
63   (if (memq sym '(big little))
64       `(quote ,sym)
65       (error "unsupported endianness" sym)))
67 ;;; arch-tag: 87dcf8cd-88a6-4489-8370-32ef5b3b1d62