summaryrefslogtreecommitdiff
path: root/libguile/ports.h
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2016-05-04 11:40:22 +0200
committerAndy Wingo <wingo@pobox.com>2016-05-04 11:47:42 +0200
commit36e32138f8559ac4e35ce97ba747b4dc58ba70d3 (patch)
tree6d814c1fd71f556aa4a9c47c6fef9dc68ac0e303 /libguile/ports.h
parent383df7976f04c45b4f67d9138f238a2d02483e9a (diff)
downloadguile-36e32138f8559ac4e35ce97ba747b4dc58ba70d3.tar.gz
Port refactors to help Scheme peek-char
* libguile/ports.h (scm_sys_port_encoding, scm_sys_set_port_encoding): New functions, to expose port encodings as symbols directly to (ice-9 ports). (scm_port_maybe_consume_initial_byte_order_mark): New function. * libguile/ports.c (scm_port_encoding): Dispatch to %port-encoding. (scm_set_port_encoding_x): Dispatch to %set-port-encoding!. (port_maybe_consume_initial_byte_order_mark): New helper, factored out of peek_codepoint. (scm_port_maybe_consume_initial_byte_order_mark, peek_codepoint): Call port_maybe_consume_initial_byte_order_mark. * module/ice-9/ports.scm (port-encoding): Implement in Scheme.
Diffstat (limited to 'libguile/ports.h')
-rw-r--r--libguile/ports.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/libguile/ports.h b/libguile/ports.h
index 1572e40e7..cec60212c 100644
--- a/libguile/ports.h
+++ b/libguile/ports.h
@@ -285,12 +285,15 @@ SCM_INTERNAL void scm_i_set_default_port_encoding (const char *encoding);
SCM_INTERNAL SCM scm_i_default_port_conversion_strategy (void);
SCM_INTERNAL void scm_i_set_default_port_conversion_strategy (SCM strategy);
SCM_INTERNAL void scm_i_set_port_encoding_x (SCM port, const char *str);
+SCM_INTERNAL SCM scm_sys_port_encoding (SCM port);
+SCM_INTERNAL SCM scm_sys_set_port_encoding_x (SCM port, SCM encoding);
SCM_API SCM scm_port_encoding (SCM port);
SCM_API SCM scm_set_port_encoding_x (SCM port, SCM encoding);
SCM_API SCM scm_port_conversion_strategy (SCM port);
SCM_API SCM scm_set_port_conversion_strategy_x (SCM port, SCM behavior);
/* Input. */
+SCM_INTERNAL SCM scm_port_maybe_consume_initial_byte_order_mark (SCM, SCM, SCM);
SCM_API int scm_get_byte_or_eof (SCM port);
SCM_API int scm_peek_byte_or_eof (SCM port);
SCM_API size_t scm_c_read (SCM port, void *buffer, size_t size);