guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Some work on the R6RS I/O libraries


From: Andreas Rottmann
Subject: Some work on the R6RS I/O libraries
Date: Mon, 15 Nov 2010 22:45:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

Fix missing port-table locking and bytevector output port segfault.

* libguile/r6rs-ports.c (make_bip, make_cbip, make_bop, make_cbop): Lock
  the port table.

* libguile/r6rs-ports.c (make_bop): Let the returned extraction
  procedure refer to the port's buffer instead of the port itself.  This
  fixes a segfault if the port is closed before the extraction procedure
  is called.
  (bop_proc_apply): Adapt accordingly.
* test-suite/tests/r6rs-ports.test (8.2.10 Output ports): Add testcase
  for extraction after close.

Add implementation of "transcoded ports".

* libguile/r6rs-ports.c (make_tp, tp_write, tp_fill_input, tp_flush,
  tp_close, initialize_transcoded_ports, scm_transcoded_port): New
  functions.
  (scm_init_r6rs_ports): Call `initialize_transcoded_ports'.
* module/rnrs/ports.scm (transcoded-port): Remove, this is now 
  implemented in C.
* test-suite/tests/r6rs-ports.test (8.2.6 Input and output ports): Added a 
  few tests for `transcoded-port'.

Move the I/O condition types from `(rnrs conditions)', where they were
not exported, to `(rnrs files)', where they are.

* module/rnrs/conditions.scm: Remove definition of I/O condition types.
* module/rnrs/files.scm: Replace references to I/O condition types
  inside `(rnrs conditions)' with the actual definitions.
* module/rnrs/io/simple.scm: Don't `@@'-reference the I/O condition types, just
  imported them from `(rnrs files)'.

Work towards a more complete implementation of `(rnrs io ports)'.

* module/rnrs/io/ports.scm: Change into an R6RS library from a "regular"
  Guile module, so the bookkeeping for #:re-export and #:replace is done
  automatically and we gain control over the imports from `(guile)'.

  (file-option, buffer-mode, eol-style, error-handling-mode,
  make-transcoder, native-transcoder, latin-1-codec, utf-8-codec,
  utf-16-codec, call-with-bytevector-output-port, open-file-input-port,
  open-file-output-port, make-custom-textual-output-port,
  flush-output-port, put-char, put-datum, put-string, get-char,
  get-datum, get-line, get-string-all, lookahead-char,
  standard-input-port, standard-output-port, standard-error-port):
  Define all of these.

  (call-with-port): Don't use `dynamic-wind', as it is against its
  specification in R6RS 8.2.6.

* module/rnrs/io/simple.scm (call-with-input-file,
  call-with-output-file): Define these in terms of R6RS procedures to
  get correct exception behavior.

Attachment: rnrs-io-ports.diff
Description: Text Data

Cheers, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]