diff options
author | Andy Wingo <wingo@pobox.com> | 2016-06-01 23:48:08 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2016-06-09 10:59:02 +0200 |
commit | d8067213dc3728a37c3c60d15aa0f1113d2e8daa (patch) | |
tree | 7bbafa1767494c901eb482c91d41588b9cdbf35b /libguile | |
parent | c7c11f3af9774a07d885dad1eb0c653ab4b45ef7 (diff) | |
download | guile-d8067213dc3728a37c3c60d15aa0f1113d2e8daa.tar.gz |
put-char in Scheme
* libguile/ports.c (scm_port_encode_char): New function.
* module/ice-9/ports.scm (port-encode-char): Export port-encode-char to
the internals module.
* module/ice-9/sports.scm (put-char): New function.
(port-bindings): Add put-char and put-string.
Diffstat (limited to 'libguile')
-rw-r--r-- | libguile/ports.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libguile/ports.c b/libguile/ports.c index a464aaf56..2694dcf5f 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -3238,6 +3238,25 @@ SCM_DEFINE (scm_port_encode_chars, "port-encode-chars", 5, 0, 0, } #undef FUNC_NAME +SCM scm_port_encode_char (SCM, SCM, SCM); +SCM_DEFINE (scm_port_encode_char, "port-encode-char", 3, 0, 0, + (SCM port, SCM buf, SCM ch), + "") +#define FUNC_NAME s_scm_port_encode_char +{ + scm_t_uint32 codepoint; + + SCM_VALIDATE_OPOUTPORT (1, port); + SCM_VALIDATE_VECTOR (2, buf); + SCM_VALIDATE_CHAR (3, ch); + + codepoint = SCM_CHAR (ch); + encode_utf32_chars (port, buf, &codepoint, 1); + + return SCM_UNSPECIFIED; +} +#undef FUNC_NAME + void scm_c_put_latin1_chars (SCM port, const scm_t_uint8 *chars, size_t len) { |