diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-04 12:13:31 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-04 12:13:31 -0700 |
commit | e87581b27ea4635ffda306e9711bd1a63323c5f6 (patch) | |
tree | 7521af2febd00f8ba92c238182a803e9f8b1c689 /stream.h | |
parent | 6cb7fdec4cebacda48c5610a45e28ecef16f2ce2 (diff) | |
download | txr-e87581b27ea4635ffda306e9711bd1a63323c5f6.tar.gz txr-e87581b27ea4635ffda306e9711bd1a63323c5f6.tar.bz2 txr-e87581b27ea4635ffda306e9711bd1a63323c5f6.zip |
streams: put-buf and fill-buf functions.
* stream.h (struct strm_ops): New function pointer members,
put_buf and fill_buf.
(strm_ops_init): Two new parameters in macro.
(put_buf, fill_buf): Declared.
* stream.c (unimpl_put_buf, unimpl_fill_buf, generic_put_buf,
generic_fill_buf): New static functions.
(fill_stream_ops): Default new fill_buf and fill_buf virtual
functions intelligently based on whether get_byte and put_byte
are available.
(stdio_put_buf, stdio_fill_buf): New static functions.
(stdio_ops, tail_ops, pipe_ops, dir_ops, string_in_ops,
byte_in_ops, strlist_in_ops, string_out_ops, strlist_out_ops,
cat_stream_ops): Add arguments to strm_ops_init macro for
get_buf and fill_buf.
(delegate_put_buf, delegate_fill_buf): New static functions.
(record_adapter_ops): Add arguments to strm_ops_init macro
for get_buf and fill_buf.
(put_buf, fill_buf): New functions.
(stream_init): Register put-buf and fill-buf intrinsics.
* socket.c (dgram_strm_ops): Add arguments to strm_ops_init
macro call.
* syslog.c (syslog_strm_ops): Likewise.
Diffstat (limited to 'stream.h')
-rw-r--r-- | stream.h | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -63,6 +63,8 @@ struct strm_ops { val (*get_byte)(val); val (*unget_char)(val, val); val (*unget_byte)(val, int); + val (*put_buf)(val, val); + val (*fill_buf)(val, val); val (*close)(val, val); val (*flush)(val); val (*seek)(val, val, enum strm_whence); @@ -81,11 +83,12 @@ struct strm_ops { #define strm_ops_init(cobj_init_macro, name, put_string, put_char, put_byte, \ get_line, get_char, get_byte, unget_char, unget_byte, \ + put_buf, fill_buf, \ close, flush, seek, truncate, get_prop, set_prop, \ get_error, get_error_str, clear_error, get_fd) \ { \ cobj_init_macro, name, put_string, put_char, put_byte, get_line, \ - get_char, get_byte, unget_char, unget_byte, \ + get_char, get_byte, unget_char, unget_byte, put_buf, fill_buf, \ close, flush, seek, truncate, get_prop, set_prop, \ get_error, get_error_str, clear_error, get_fd, 0, 0, 0, 0 \ } @@ -177,6 +180,8 @@ val get_char(val); val get_byte(val); val unget_char(val ch, val stream); val unget_byte(val byte, val stream); +val put_buf(val buf, val stream); +val fill_buf(val buf, val stream); val vformat(val stream, val string, va_list); val vformat_to_string(val string, va_list); val format(val stream, val string, ...); |