Have `scm_getc' honor the port's conversion strategy.
authorLudovic Courtès <ludo@gnu.org>
Tue, 25 Jan 2011 23:16:10 +0000 (00:16 +0100)
committerLudovic Courtès <ludo@gnu.org>
Tue, 25 Jan 2011 23:29:51 +0000 (00:29 +0100)
commitcc540d0bbd4595be32d760bfd6e9e5ec3cdbd3d3
treeb4dbe96ef780a2aa06dfe982fe0b8dcce4a9913a
parent2e59af2100f05c1461ca2913027cc499959b67f8
Have `scm_getc' honor the port's conversion strategy.

* libguile/ports.c (get_codepoint): Reset `pt->input_cd' upon failure.
  If `pt->ilseq_handler' is `SCM_ICONVEH_QUESTION_MARK', then return a
  question mark.
  [failure]: Use `scm_encoding_error' when raising an error.

* test-suite/lib.scm (exception:encoding-error): Adjust regexp.

* test-suite/tests/ports.test ("string ports")["read-char, wrong
  encoding, error", "read-char, wrong encoding, escape", "read-char,
  wrong encoding, substitute"]: New tests.
libguile/ports.c
test-suite/lib.scm
test-suite/tests/ports.test