diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-11-21 23:01:34 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-11-21 23:01:34 -0800 |
commit | 5974e3e4da9dcbec56723c398073f7859725aade (patch) | |
tree | a39847c8d4338f5d38d6b8443586062aefe22524 | |
parent | 3a84aceb203928c5718553bc56cb3648caa3fcb1 (diff) | |
download | txr-5974e3e4da9dcbec56723c398073f7859725aade.tar.gz txr-5974e3e4da9dcbec56723c398073f7859725aade.tar.bz2 txr-5974e3e4da9dcbec56723c398073f7859725aade.zip |
streams: fixes in few type error diagnostics.
* stream.c (make_string_byte_input_stream,
get_string_from_stream):
Use self in diagnostic, and print bad object
using ~s rather than ~a.
(get_list_from_stream): Likewise, and add missing
nao as well.
(catenated_stream_push): Add self string, use
in diagnostics, print bad object using ~s.
-rw-r--r-- | stream.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -2089,7 +2089,7 @@ static struct strm_ops byte_in_ops = val make_string_byte_input_stream(val string) { val self = lit("make-string-byte-input-stream"); - type_assert (stringp(string), (lit("~a is not a string"), string, nao)); + type_assert (stringp(string), (lit("~a: ~s is not a string"), self, string, nao)); { const wchar_t *wstring = c_str(string, self); @@ -2405,7 +2405,7 @@ val get_string_from_stream(val stream) return out; } else { type_assert (stream->co.ops == &string_in_ops.cobj_ops, - (lit("~a is not a string stream"), stream, nao)); + (lit("~a: ~s is not a string stream"), self, stream, nao)); { struct string_in *si = coerce(struct string_in *, stream->co.handle); return si->string; @@ -2514,7 +2514,7 @@ val get_list_from_stream(val stream) return nreverse(lines); } - type_mismatch(lit("~s is not a string list stream"), stream); + type_mismatch(lit("~a: ~s is not a string list stream"), self, stream, nao); } struct cat_strm { @@ -2702,10 +2702,12 @@ val catenated_stream_p(val obj) val catenated_stream_push(val new_stream, val cat_stream) { + val self = lit("catenated-stream-push"); + type_assert (streamp(new_stream), - (lit("~a is not a stream"), new_stream, nao)); + (lit("~a: ~s is not a stream"), self, new_stream, nao)); type_assert (catenated_stream_p(cat_stream), - (lit("~a is not a stream"), cat_stream, nao)); + (lit("~a: ~s is not a stream"), self, cat_stream, nao)); { struct cat_strm *s = coerce(struct cat_strm *, cat_stream->co.handle); |