From 2cead732f52f281a14b27d575185415306029e3f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ludovic=20Court=C3=A8s?= Date: Sat, 4 Apr 2009 17:24:53 +0200 Subject: [PATCH] Make modules available under the `rnrs' hierarchy. * modules/Makefile.am (nobase_dist_guilemodule_DATA): Add. * modules/r6rs/bytevector.scm: Re-export the interface of `(rnrs bytevector)'. * modules/r6rs/io/ports.scm: Likewise. * NEWS: Update. --- NEWS | 6 ++ modules/Makefile.am | 3 + modules/r6rs/bytevector.scm | 93 ++++++++------------------- modules/r6rs/io/ports.scm | 118 ++++++++-------------------------- modules/{r6rs => rnrs}/bytevector.scm | 4 +- modules/{r6rs => rnrs}/io/ports.scm | 4 +- 6 files changed, 65 insertions(+), 163 deletions(-) rewrite modules/r6rs/bytevector.scm (70%) rewrite modules/r6rs/io/ports.scm (72%) copy modules/{r6rs => rnrs}/bytevector.scm (96%) copy modules/{r6rs => rnrs}/io/ports.scm (96%) diff --git a/NEWS b/NEWS index 2fc8637..5610ebe 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,11 @@ * New in Guile-R6RS-Libs 0.2 +** API modifications +*** Modules are now visible under the `rnrs' hierarchy +Applications should now use module names like `(rnrs bytevector)' +instead of `(r6rs bytevector)'; the latter is still supported for +backward compatibility, though. + ** Bug fixes *** Fix custom binary input ports for Guile >= 1.8.6 *** Add missing `STATUS' file diff --git a/modules/Makefile.am b/modules/Makefile.am index 4cab71b..0972dd6 100644 --- a/modules/Makefile.am +++ b/modules/Makefile.am @@ -1,4 +1,7 @@ nobase_dist_guilemodule_DATA = \ + rnrs/bytevector.scm \ + rnrs/io/ports.scm \ + \ r6rs/bytevector.scm \ r6rs/io/ports.scm \ r6rs/i/o/ports.scm diff --git a/modules/r6rs/bytevector.scm b/modules/r6rs/bytevector.scm dissimilarity index 70% index e791122..628a817 100644 --- a/modules/r6rs/bytevector.scm +++ b/modules/r6rs/bytevector.scm @@ -1,67 +1,26 @@ -;;; Guile-R6RS-Libs --- Implementation of R6RS standard libraries. -;;; Copyright (C) 2007 Ludovic Courtès -;;; -;;; Guile-R6RS-Libs 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. -;;; -;;; Guile-R6RS-Libs 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-R6RS-Libs; if not, write to the Free Software -;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -(define-module (r6rs bytevector) - :export-syntax (endianness) - :export (native-endianness bytevector? - make-bytevector bytevector-length bytevector=? bytevector-fill! - bytevector-copy! bytevector-copy bytevector-u8-ref - bytevector-s8-ref - bytevector-u8-set! bytevector-s8-set! bytevector->u8-list - u8-list->bytevector - bytevector-uint-ref bytevector-uint-set! - bytevector-sint-ref bytevector-sint-set! - bytevector->sint-list bytevector->uint-list - uint-list->bytevector sint-list->bytevector - - bytevector-u16-ref bytevector-s16-ref - bytevector-u16-set! bytevector-s16-set! - bytevector-u16-native-ref bytevector-s16-native-ref - bytevector-u16-native-set! bytevector-s16-native-set! - - bytevector-u32-ref bytevector-s32-ref - bytevector-u32-set! bytevector-s32-set! - bytevector-u32-native-ref bytevector-s32-native-ref - bytevector-u32-native-set! bytevector-s32-native-set! - - bytevector-u64-ref bytevector-s64-ref - bytevector-u64-set! bytevector-s64-set! - bytevector-u64-native-ref bytevector-s64-native-ref - bytevector-u64-native-set! bytevector-s64-native-set! - - bytevector-ieee-single-ref - bytevector-ieee-single-set! - bytevector-ieee-single-native-ref - bytevector-ieee-single-native-set! - - bytevector-ieee-double-ref - bytevector-ieee-double-set! - bytevector-ieee-double-native-ref - bytevector-ieee-double-native-set! - - string->utf8 string->utf16 string->utf32 - utf8->string utf16->string utf32->string)) - - -(load-extension "libguile-r6rs-libs-v-0" "scm_init_r6rs_bytevector") - -(define-macro (endianness sym) - (if (memq sym '(big little)) - `(quote ,sym) - (error "unsupported endianness" sym))) - -;;; arch-tag: 87dcf8cd-88a6-4489-8370-32ef5b3b1d62 +;;; Guile-R6RS-Libs --- Implementation of R6RS standard libraries. +;;; Copyright (C) 2009 Ludovic Courtès +;;; +;;; Guile-R6RS-Libs 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. +;;; +;;; Guile-R6RS-Libs 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-R6RS-Libs; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (r6rs bytevector)) + +;;; +;;; This module provides a compatibility layer with Guile-R6RS-Libs 0.1. It +;;; should not be used by new programs. +;;; + +(let ((iface (resolve-interface '(rnrs bytevector)))) + (set-module-public-interface! (current-module) iface)) diff --git a/modules/r6rs/io/ports.scm b/modules/r6rs/io/ports.scm dissimilarity index 72% index 39fc989..f82ffb9 100644 --- a/modules/r6rs/io/ports.scm +++ b/modules/r6rs/io/ports.scm @@ -1,92 +1,26 @@ -;;; Guile-R6RS-Libs --- Implementation of R6RS standard libraries. -;;; Copyright (C) 2007 Ludovic Courtès -;;; -;;; Guile-R6RS-Libs 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. -;;; -;;; Guile-R6RS-Libs 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-R6RS-Libs; if not, write to the Free Software -;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -(define-module (r6rs io ports) - :re-export (eof-object? port? input-port? output-port?) - :export (eof-object - - ;; input & output ports - port-transcoder binary-port? transcoded-port - port-position set-port-position! - port-has-port-position? port-has-set-port-position!? - call-with-port - - ;; input ports - open-bytevector-input-port - make-custom-binary-input-port - - ;; binary input - get-u8 lookahead-u8 - get-bytevector-n get-bytevector-n! - get-bytevector-some get-bytevector-all - - ;; binary output - put-u8 put-bytevector - open-bytevector-output-port)) - -(load-extension "libguile-r6rs-libs-v-0" "scm_init_r6rs_ports") - - - -;;; -;;; Input and output ports. -;;; - -(define (port-transcoder port) - (error "port transcoders are not supported" port)) - -(define (binary-port? port) - ;; So far, we don't support transcoders other than the binary transcoder. - #t) - -(define (transcoded-port port) - (error "port transcoders are not supported" port)) - -(define (port-position port) - "Return the offset (an integer) indicating where the next octet will be -read from/written to in @var{port}." - - ;; FIXME: We should raise an `&assertion' error when not supported. - (seek port 0 SEEK_CUR)) - -(define (set-port-position! port offset) - "Set the position where the next octet will be read from/written to -@var{port}." - - ;; FIXME: We should raise an `&assertion' error when not supported. - (seek port offset SEEK_SET)) - -(define (port-has-port-position? port) - "Return @code{#t} is @var{port} supports @code{port-position}." - (and (false-if-exception (port-position port)) #t)) - -(define (port-has-set-port-position!? port) - "Return @code{#t} is @var{port} supports @code{set-port-position!}." - (and (false-if-exception (set-port-position! port (port-position port))) - #t)) - -(define (call-with-port port proc) - "Call @var{proc}, passing it @var{port} and closing @var{port} upon exit of -@var{proc}. Return the return values of @var{proc}." - (dynamic-wind - (lambda () - #t) - (lambda () - (proc port)) - (lambda () - (close-port port)))) - +;;; Guile-R6RS-Libs --- Implementation of R6RS standard libraries. +;;; Copyright (C) 2009 Ludovic Courtès +;;; +;;; Guile-R6RS-Libs 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. +;;; +;;; Guile-R6RS-Libs 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-R6RS-Libs; if not, write to the Free Software +;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +(define-module (r6rs io ports)) + +;;; +;;; This module provides a compatibility layer with Guile-R6RS-Libs 0.1. It +;;; should not be used by new programs. +;;; + +(let ((iface (resolve-interface '(rnrs io ports)))) + (set-module-public-interface! (current-module) iface)) diff --git a/modules/r6rs/bytevector.scm b/modules/rnrs/bytevector.scm similarity index 96% copy from modules/r6rs/bytevector.scm copy to modules/rnrs/bytevector.scm index e791122..bb62db7 100644 --- a/modules/r6rs/bytevector.scm +++ b/modules/rnrs/bytevector.scm @@ -1,5 +1,5 @@ ;;; Guile-R6RS-Libs --- Implementation of R6RS standard libraries. -;;; Copyright (C) 2007 Ludovic Courtès +;;; Copyright (C) 2007, 2009 Ludovic Courtès ;;; ;;; Guile-R6RS-Libs is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Lesser General Public @@ -15,7 +15,7 @@ ;;; License along with Guile-R6RS-Libs; if not, write to the Free Software ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -(define-module (r6rs bytevector) +(define-module (rnrs bytevector) :export-syntax (endianness) :export (native-endianness bytevector? make-bytevector bytevector-length bytevector=? bytevector-fill! diff --git a/modules/r6rs/io/ports.scm b/modules/rnrs/io/ports.scm similarity index 96% copy from modules/r6rs/io/ports.scm copy to modules/rnrs/io/ports.scm index 39fc989..1a783c8 100644 --- a/modules/r6rs/io/ports.scm +++ b/modules/rnrs/io/ports.scm @@ -1,5 +1,5 @@ ;;; Guile-R6RS-Libs --- Implementation of R6RS standard libraries. -;;; Copyright (C) 2007 Ludovic Courtès +;;; Copyright (C) 2007, 2009 Ludovic Courtès ;;; ;;; Guile-R6RS-Libs is free software; you can redistribute it and/or ;;; modify it under the terms of the GNU Lesser General Public @@ -15,7 +15,7 @@ ;;; License along with Guile-R6RS-Libs; if not, write to the Free Software ;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -(define-module (r6rs io ports) +(define-module (rnrs io ports) :re-export (eof-object? port? input-port? output-port?) :export (eof-object -- 2.11.4.GIT