summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2014-07-19 10:06:37 -0700
committerKaz Kylheku <kaz@kylheku.com>2014-07-19 10:06:37 -0700
commit5b0a9e5fe1032653c745e56a2f39561a1d7b7661 (patch)
treef3482e19ef5016097978388268d0f5f846dade95 /stream.c
parent74880de58e4f3ae6e0a84187f92e6853c37aa64e (diff)
downloadtxr-5b0a9e5fe1032653c745e56a2f39561a1d7b7661.tar.gz
txr-5b0a9e5fe1032653c745e56a2f39561a1d7b7661.tar.bz2
txr-5b0a9e5fe1032653c745e56a2f39561a1d7b7661.zip
* stream.c (put_strings, put_lines): New functions.
(stream_init): Registered new functions as intrinsics. * stream.h (put_strings, put_lines): Declared. * txr.1: Documented.
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/stream.c b/stream.c
index ae05ae80..cc83ea09 100644
--- a/stream.c
+++ b/stream.c
@@ -1967,6 +1967,24 @@ val put_line(val string, val stream)
return (put_string(default_arg(string, null_string), stream), put_char(chr('\n'), stream));
}
+val put_strings(val strings, val stream)
+{
+ strings = nullify(strings);
+
+ for (; strings; strings = cdr(strings))
+ put_string(car(strings), stream);
+ return t;
+}
+
+val put_lines(val lines, val stream)
+{
+ lines = nullify(lines);
+
+ for (; lines; lines = cdr(lines))
+ put_line(car(lines), stream);
+ return t;
+}
+
val flush_stream(val stream)
{
type_check (stream, COBJ);
@@ -2858,6 +2876,8 @@ void stream_init(void)
reg_fun(intern(lit("put-line"), user_package), func_n2o(put_line, 0));
reg_fun(intern(lit("put-char"), user_package), func_n2o(put_char, 1));
reg_fun(intern(lit("put-byte"), user_package), func_n2o(put_byte, 1));
+ reg_fun(intern(lit("put-lines"), user_package), func_n2o(put_lines, 1));
+ reg_fun(intern(lit("put-strings"), user_package), func_n2o(put_strings, 1));
reg_fun(intern(lit("unget-char"), user_package), func_n2o(unget_char, 1));
reg_fun(intern(lit("unget-byte"), user_package), func_n2o(unget_byte, 1));
reg_fun(intern(lit("flush-stream"), user_package), func_n1(flush_stream));