summaryrefslogtreecommitdiffstats
path: root/buf.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-08-14 21:21:05 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-08-14 21:21:05 -0700
commit05d55b8e42f7326b234f74f6114157f1990ac7da (patch)
treed11b880240e991be2d72979f61ebdb59cd31945e /buf.h
parent244c24e0b295023e227f37f62dcab83c28c7614a (diff)
downloadtxr-05d55b8e42f7326b234f74f6114157f1990ac7da.tar.gz
txr-05d55b8e42f7326b234f74f6114157f1990ac7da.tar.bz2
txr-05d55b8e42f7326b234f74f6114157f1990ac7da.zip
buf: new buffer stream.
* buf.c (struct buf_strm): New struct type. (buf_strm_mark, int buf_strm_put_byte_callback, buf_strm_put_string, buf_strm_put_char, buf_strm_put_byte, buf_strm_get_byte_callback, buf_strm_get_char, buf_strm_get_byte, buf_strm_unget_char, buf_strm_unget_byte, buf_strm_seek, buf_strm_truncate, buf_strm_get_prop, buf_strm_set_prop, buf_strm_get_error, buf_strm_get_error_str): New static functions. (buf_strm_ops): New static struct. (buf_strm): New static function. (make_buf_stream, get_buf_from_stream): New functions. (buf_init): Register new intrinsic functiions make-buf-stream and get-buf-from-stream. Call fill_stream_ops on new buf_strm_ops to fill default operations in place of function pointers that have been left null. * buf.h (make_buf_stream, get_buf_from_stream): Declared. * lisplib.c (with_stream_set_entries): Add with-out-buf-stream and with-in-buf-stream to auto-load symbols for with-stream.tl module. * share/txr/stdlib/with-stream.tl (with-out-buf-stream, with-in-buf-stream): New macros. * txr.1: New section about buffer streams.
Diffstat (limited to 'buf.h')
-rw-r--r--buf.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/buf.h b/buf.h
index f3ab4a7b..28978472 100644
--- a/buf.h
+++ b/buf.h
@@ -102,4 +102,7 @@ val buf_get_cptr(val buf, val pos);
val buf_print(val buf, val stream);
val buf_pprint(val buf, val stream);
+val make_buf_stream(val buf_opt);
+val get_buf_from_stream(val stream);
+
void buf_init(void);