summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2021-08-07 00:25:46 -0700
committerKaz Kylheku <kaz@kylheku.com>2021-08-07 00:25:46 -0700
commit25eb966ccb8b61dbe4ff2b2e1970e1e9caa0282f (patch)
tree427b31848c6040b83e69003c95f5f7c2d06bfd0d /txr.c
parent586d5d840219a76bd8d36e3b04951e3377709fbd (diff)
downloadtxr-25eb966ccb8b61dbe4ff2b2e1970e1e9caa0282f.tar.gz
txr-25eb966ccb8b61dbe4ff2b2e1970e1e9caa0282f.tar.bz2
txr-25eb966ccb8b61dbe4ff2b2e1970e1e9caa0282f.zip
lazy-stream-cons: control close throwing behavior.
* eval.c (eval_init): Update registrations of lazy-stream-cons and get-lines with one more optional argument. * lib.c (simple_lazy_stream_func_nt, lazy_stream_func_nt): New static functions. (lazy_stream_cons): Take a new argument, no_throw_close, defaulting it to nil. When calling close_stream directly, pass the inverted value of no_throw_close. Choose the new _nt functions for the lazy list if no_throw_close is true; those functions pass nil as the second argument of close_stream. * lib.h (lazy_stream_cons): Declaration updated. * match.c (v_next_impl, open_data_source, match_fun): Pass down the nothrow value to lazy_stream_cons, or else nil in situations when that is not applicable or there is no such value. Thus the :nothrow feature of v_next will now not only ensure that there is no exception when opening the stream but also when closing it. Unusual situations encountered when the lazy list reads from the stream still throw. * txr.1: Documented.
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/txr.c b/txr.c
index 159218a9..341b242a 100644
--- a/txr.c
+++ b/txr.c
@@ -381,7 +381,7 @@ static int license(void)
for (iter = path_list; iter; iter = cdr(iter)) {
val lic = open_file(car(iter), lit("r"));
- put_lines(lazy_stream_cons(lic), std_output);
+ put_lines(lazy_stream_cons(lic, nil), std_output);
put_char(chr('\n'), std_output);
}
}