From 92dd3486727d748253b8b1a0dd4416c07e61addb Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 28 Dec 2015 06:44:58 -0800 Subject: Overhaul printing of lazy strings. The # 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). --- lib.h | 1 + 1 file changed, 1 insertion(+) (limited to 'lib.h') 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); -- cgit v1.2.3