diff options
author | Ludovic Courtès <ludo@gnu.org> | 2011-02-02 17:38:03 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2011-02-02 18:06:29 +0100 |
commit | 6851d3be80bef46993e192b0f4ea708248f97921 (patch) | |
tree | d941bdb5be27848c5b1366e66ad688d1eedb6833 /libguile/print.c | |
parent | 7174bc08ddd6cc64f2ea321910042cf2233d586a (diff) | |
download | guile-6851d3be80bef46993e192b0f4ea708248f97921.tar.gz |
Change `scm_encoding_error' to pass the port and faulty character.
* libguile/strings.c (scm_encoding_error): Remove the `from', `to', and
`string_or_bv' parameters; add `port' and `chr'.
(scm_to_stringn): Update accordingly.
* libguile/strings.h (scm_encoding_error): Update accordingly.
* libguile/ports.c (scm_ungetc): Update accordingly.
* libguile/print.c (iprin1, scm_write_char): Update accordingly.
* test-suite/tests/encoding-escapes.test ("display output
errors")["ultima", "Rashomon"]: Check the arguments of
`encoding-error'.
["tekniko"]: New test.
* test-suite/tests/ports.test ("string ports")["wrong encoding"]: Adjust
to new `encoding-error' arguments.
Diffstat (limited to 'libguile/print.c')
-rw-r--r-- | libguile/print.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libguile/print.c b/libguile/print.c index 9e48589f4..59b109380 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -484,8 +484,7 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate) scm_i_get_conversion_strategy (port))) scm_encoding_error (__func__, errno, "cannot convert to output locale", - "UTF-32", scm_i_get_port_encoding (port), - scm_string (scm_list_1 (exp))); + port, exp); } } else if (SCM_IFLAGP (exp) @@ -570,11 +569,9 @@ iprin1 (SCM exp, SCM port, scm_print_state *pstate) len, port, scm_i_get_conversion_strategy (port)); if (SCM_UNLIKELY (printed < len)) - /* FIXME: Provide the error location. */ scm_encoding_error (__func__, errno, "cannot convert to output locale", - "UTF-32", scm_i_get_port_encoding (port), - exp); + port, scm_c_string_ref (exp, printed)); } scm_remember_upto_here_1 (exp); @@ -1388,8 +1385,7 @@ SCM_DEFINE (scm_write_char, "write-char", 1, 1, 0, scm_i_get_conversion_strategy (port))) scm_encoding_error (__func__, errno, "cannot convert to output locale", - "UTF-32", scm_i_get_port_encoding (port), - scm_string (scm_list_1 (chr))); + port, chr); return SCM_UNSPECIFIED; } |