summaryrefslogtreecommitdiffstats
path: root/lib.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-12-28 06:44:58 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-12-28 06:44:58 -0800
commit92dd3486727d748253b8b1a0dd4416c07e61addb (patch)
tree2d46d0f93e777d457990c5296d659f68280378eb /lib.h
parentd2488974756c21c064ddd293fbb72d5a85b91e12 (diff)
downloadtxr-92dd3486727d748253b8b1a0dd4416c07e61addb.tar.gz
txr-92dd3486727d748253b8b1a0dd4416c07e61addb.tar.bz2
txr-92dd3486727d748253b8b1a0dd4416c07e61addb.zip
Overhaul printing of lazy strings.
The #<lazy-string ...> print syntax is gone. Lazy strings are now printed by traversing their structure, without forcing them to the flat representation. * lib.c (lazy_str_put): New function. (out_str_char, out_str_pretty, out_lazy_str): New static functions. (obj_print_impl): Use out_str_pretty for standard-printing regular strings. Use lazy_put_str for pretty-printing lazy strings, and out_lazy_str for standard-printing them. * lib.h (lazy_str_put): Declared. * stream.c (put_string): Check for a lazy string and route to lazy_str_put, so the string doesn't get forced (though of course the underlying list does, if it is lazy).
Diffstat (limited to 'lib.h')
-rw-r--r--lib.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib.h b/lib.h
index 76274535..29984eb3 100644
--- a/lib.h
+++ b/lib.h
@@ -850,6 +850,7 @@ val lazy_stream_cons(val stream);
val lazy_str(val list, val term, val limit);
val lazy_str_force_upto(val lstr, val index);
val lazy_str_force(val lstr);
+val lazy_str_put(val lstr, val stream);
val lazy_str_get_trailing_list(val lstr, val index);
val length_str_gt(val str, val len);
val length_str_ge(val str, val len);