summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-05-07 18:55:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-05-07 18:55:09 -0700
commit85e80eb7f9dcc3e24b8a2d618525a4ce901d3982 (patch)
tree6e6e90066658d62acf64bbffbad2e08a4d8cdbe7
parent52fb4be87f0b7c398084866393ac4ce3842272aa (diff)
downloadtxr-85e80eb7f9dcc3e24b8a2d618525a4ce901d3982.tar.gz
txr-85e80eb7f9dcc3e24b8a2d618525a4ce901d3982.tar.bz2
txr-85e80eb7f9dcc3e24b8a2d618525a4ce901d3982.zip
Argument of flush-stream now optional.
* stream.c (flush_stream): Default the argument to std_output. (stream_init): Register flush-stream as having one optional arg. * txr.1: Updated flush-stream description.
-rw-r--r--stream.c5
-rw-r--r--txr.18
2 files changed, 10 insertions, 3 deletions
diff --git a/stream.c b/stream.c
index 358c6eac..86a6cb60 100644
--- a/stream.c
+++ b/stream.c
@@ -3222,8 +3222,9 @@ val put_lines(val lines, val stream)
return t;
}
-val flush_stream(val stream)
+val flush_stream(val stream_in)
{
+ val stream = default_arg(stream_in, std_output);
struct strm_ops *ops = coerce(struct strm_ops *, cobj_ops(stream, stream_s));
return ops->flush(stream);
}
@@ -3963,7 +3964,7 @@ void stream_init(void)
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));
+ reg_fun(intern(lit("flush-stream"), user_package), func_n1o(flush_stream, 0));
reg_fun(intern(lit("seek-stream"), user_package), func_n3(seek_stream));
reg_fun(intern(lit("truncate-stream"), user_package), func_n2(truncate_stream));
reg_fun(intern(lit("streamp"), user_package), func_n1(streamp));
diff --git a/txr.1 b/txr.1
index 1007bf6d..8b1b3d60 100644
--- a/txr.1
+++ b/txr.1
@@ -34519,7 +34519,7 @@ Both functions return
.coNP Function @ flush-stream
.synb
-.mets (flush-stream << stream )
+.mets (flush-stream <> [ stream ])
.syne
.desc
This function is meaningful for output streams which accumulate data
@@ -34533,6 +34533,12 @@ to the operating system. If called on streams for which this function is not
meaningful, it does nothing, and returns
.codn nil .
+If
+.meta stream
+is omitted, the current value of
+.code *stdout*
+is used.
+
.coNP Function @ seek-stream
.synb
.mets (seek-stream < stream < offset << whence )