binary-ports.scm 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. ;;;; binary-ports.scm --- Binary IO on ports
  2. ;;;; Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc.
  3. ;;;;
  4. ;;;; This library 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 3 of the License, or (at your option) any later version.
  8. ;;;;
  9. ;;;; This library 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 this library; if not, write to the Free Software
  16. ;;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  17. ;;; Author: Ludovic Courtès <ludo@gnu.org>
  18. ;;; Commentary:
  19. ;;;
  20. ;;; The I/O port API of the R6RS is provided by this module. In many areas
  21. ;;; it complements or refines Guile's own historical port API. For instance,
  22. ;;; it allows for binary I/O with bytevectors.
  23. ;;;
  24. ;;; Code:
  25. (define-module (ice-9 binary-ports)
  26. #:use-module (rnrs bytevectors)
  27. #:export (eof-object
  28. open-bytevector-input-port
  29. make-custom-binary-input-port
  30. get-u8
  31. lookahead-u8
  32. get-bytevector-n
  33. get-bytevector-n!
  34. get-bytevector-some
  35. get-bytevector-all
  36. get-string-n!
  37. put-u8
  38. put-bytevector
  39. open-bytevector-output-port
  40. make-custom-binary-output-port))
  41. ;; Note that this extension also defines %make-transcoded-port, which is
  42. ;; not exported but is used by (rnrs io ports).
  43. (load-extension (string-append "libguile-" (effective-version))
  44. "scm_init_r6rs_ports")