summaryrefslogtreecommitdiffstats
path: root/txr.1
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-01-13 22:19:03 -0800
committerKaz Kylheku <kaz@kylheku.com>2014-01-13 22:19:03 -0800
commit48c8cec1c83d70e23dc1359b85cfd9e36fdaa60f (patch)
tree99586c035526f35154fa916e018c7dcffb80f4c5 /txr.1
parente7dd81f7280612a65b7a466e6d870b808272b34f (diff)
downloadtxr-48c8cec1c83d70e23dc1359b85cfd9e36fdaa60f.tar.gz
txr-48c8cec1c83d70e23dc1359b85cfd9e36fdaa60f.tar.bz2
txr-48c8cec1c83d70e23dc1359b85cfd9e36fdaa60f.zip
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.
Diffstat (limited to 'txr.1')
-rw-r--r--txr.123
1 files changed, 23 insertions, 0 deletions
diff --git a/txr.1 b/txr.1
index 8f87e428..a6760076 100644
--- a/txr.1
+++ b/txr.1
@@ -10465,6 +10465,29 @@ the two operations will interfere with the UTF-8 decoding.
These functions return nil when the end of data is reached. Errors are
represented as exceptions.
+.SS Functions unget-char and unget-byte
+
+.TP
+Syntax:
+
+ (unget-char <char> [<stream>])
+ (unget-byte <byte> [<stream>])
+
+.TP
+Description:
+
+These character put back, into a stream, a character or byte which was
+previously read. The character or byte must match the one which was most
+recently read. If the <stream> parameter is omitted, then the *stdin*
+stream is used.
+
+If the operation succeeds, the byte or character value is returned.
+A nil return indicates that the operation is unsupported.
+
+Some streams do not support these operations; some support
+only one of them. In general, if a stream supports get-char,
+it supports unget-char, and likewise for get-byte and unget-byte.
+
.SS Functions put-string, put-line, put-char and put-byte
.TP