mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
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.
This commit is contained in:
parent
d8711b9759
commit
383df7976f
8 changed files with 162 additions and 175 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue