From 48c8cec1c83d70e23dc1359b85cfd9e36fdaa60f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 13 Jan 2014 22:19:03 -0800 Subject: Support for pushing back bytes and characters into streams. * stream.c (null_ops, stdio_ops, tail_ops, pipe_ops, string_in_ops, byte_in_ops, string_out_ops, strlist_out_ops, dir_ops, cat_stream_ops): Structure definition updated with new initializers for two new virtuals. (stdio_handle): New member, unget_c. (snarf_line, stdio_get_char): Handle pushed-back character in h->unget_c. (stdio_unget_char, stdio_unget_byte, string_in_unget_char, byte_in_unget_byte): New static functions. (make_stdio_stream_common): Initialize unget_c member. (unget_char, unget_byte): New functions. * stream.h (struct strm_ops): New virtuals: unget_char and unget_byte. (unget_char, unget_byte): New functions declared. * syslog.c (syslog_strm_ops): Two new initializers. * eval.c (eval_init): Registered unget_char and unget_byte as intrinsics. * txr.1: Documented. --- syslog.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'syslog.c') diff --git a/syslog.c b/syslog.c index 39581d34..f544c110 100644 --- a/syslog.c +++ b/syslog.c @@ -219,6 +219,8 @@ static struct strm_ops syslog_strm_ops = { 0, /* get_line */ 0, /* get_char */ 0, /* get_byte */ + 0, /* unget_char */ + 0, /* unget_byte */ 0, /* close */ 0, /* flush */ 0, /* seek */ -- cgit v1.2.3