summaryrefslogtreecommitdiff
path: root/libguile/print.c
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-05-04 10:31:21 +0200
committerAndy Wingo <wingo@pobox.com>2016-05-04 10:41:07 +0200
commit383df7976f04c45b4f67d9138f238a2d02483e9a (patch)
tree177e7325d53d49c51623465e660888842adee7f3 /libguile/print.c
parentd8711b97596fc52bad1d3139f5be4c8442e1b896 (diff)
downloadguile-383df7976f04c45b4f67d9138f238a2d02483e9a.tar.gz
Port conversion strategies internally are symbols
* libguile/ports.h (scm_t_port): Represent the conversion strategy as a symbol, to make things easier for Scheme. Rename to "conversion_strategy". (scm_c_make_port_with_encoding): Change to take encoding and conversion_strategy arguments as symbols. (scm_i_string_failed_conversion_handler): New internal helper, to turn a symbol to a scm_t_string_failed_conversion_handler. (scm_i_default_port_encoding): Return the default port encoding as a symbol. (scm_i_default_port_conversion_strategy) (scm_i_set_default_port_conversion_strategy): Rename from scm_i_default_port_conversion_handler et al. Take and return Scheme symbols. * libguile/foreign.c (scm_string_to_pointer, scm_pointer_to_string): Use scm_i_default_string_failed_conversion_handler instead of scm_i_default_port_conversion_handler. * libguile/print.c (PORT_CONVERSION_HANDLER): Update definition. (print_normal_symbol): Use PORT_CONVERSION_HANDLER. * libguile/r6rs-ports.c (make_bytevector_input_port): (make_custom_binary_input_port, make_bytevector_output_port): Adapt to changes in scm_c_make_port_with_encoding. * libguile/strings.h: * libguile/strings.c (scm_i_default_string_failed_conversion_handler): New helper. (scm_from_locale_stringn, scm_from_port_stringn): (scm_to_locale_stringn, scm_to_port_stringn): Adapt to interface changes. * libguile/strports.c (scm_mkstrport): Adapt to scm_c_make_port_with_encoding change. * libguile/ports.c (scm_c_make_port): Adapt to scm_c_make_port_with_encoding change. (ascii_toupper, encoding_matches, canonicalize_encoding): Move down in the file. (peek_codepoint, get_codepoint, scm_ungetc): Adapt to port conversion strategy change. Remove duplicate case in get_codepoint. (scm_init_ports): Move symbol initializations to the same place.
Diffstat (limited to 'libguile/print.c')
-rw-r--r--libguile/print.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libguile/print.c b/libguile/print.c
index 4eea12152..0b2d19340 100644
--- a/libguile/print.c
+++ b/libguile/print.c
@@ -62,7 +62,7 @@
/* Character printers. */
#define PORT_CONVERSION_HANDLER(port) \
- SCM_PTAB_ENTRY (port)->ilseq_handler
+ scm_i_string_failed_conversion_handler (scm_port_conversion_strategy (port))
SCM_SYMBOL (sym_UTF_8, "UTF-8");
SCM_SYMBOL (sym_ISO_8859_1, "ISO-8859-1");
@@ -441,7 +441,7 @@ print_normal_symbol (SCM sym, SCM port)
scm_t_string_failed_conversion_handler strategy;
len = scm_i_symbol_length (sym);
- strategy = SCM_PTAB_ENTRY (port)->ilseq_handler;
+ strategy = PORT_CONVERSION_HANDLER (port);
if (scm_i_is_narrow_symbol (sym))
display_string (scm_i_symbol_chars (sym), 1, len, port, strategy);