summaryrefslogtreecommitdiffstats
path: root/stream.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-04 12:13:31 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-04 12:13:31 -0700
commite87581b27ea4635ffda306e9711bd1a63323c5f6 (patch)
tree7521af2febd00f8ba92c238182a803e9f8b1c689 /stream.h
parent6cb7fdec4cebacda48c5610a45e28ecef16f2ce2 (diff)
downloadtxr-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.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/stream.h b/stream.h
index 290af343..2a324ad3 100644
--- a/stream.h
+++ b/stream.h
@@ -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, ...);