From 2e4e4d7ad9bb970485703fa4d58635e1b5a33531 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 27 May 2022 07:38:11 -0700 Subject: gzio: include type in printed representation of stream. * gzio.c (gzio_stream_print): New static function. (gzio_ops_rd, gzio_ops_wr): Wire in function instead of stream_print_op. --- gzio.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/gzio.c b/gzio.c index 06f3a6ec..a1948a48 100644 --- a/gzio.c +++ b/gzio.c @@ -63,6 +63,20 @@ struct gzio_handle { struct cobj_class *gzio_stream_cls; +static void gzio_stream_print(val stream, val out, val pretty, + struct strm_ctx *ctx) +{ + struct gzio_handle *h = coerce(struct gzio_handle *, stream->co.handle); + struct strm_ops *ops = coerce(struct strm_ops *, stream->co.ops); + val name = static_str(ops->name); + val descr = ops->get_prop(stream, name_k); + + (void) pretty; + (void) ctx; + + format(out, lit("#<~a ~a ~p>"), name, descr, stream, nao); +} + static void gzio_stream_destroy(val stream) { struct gzio_handle *h = coerce(struct gzio_handle *, stream->co.handle); @@ -410,7 +424,7 @@ static val gzio_set_prop(val stream, val ind, val prop) static struct strm_ops gzio_ops_rd = strm_ops_init(cobj_ops_init(eq, - stream_print_op, + gzio_stream_print, gzio_stream_destroy, gzio_stream_mark, cobj_eq_hash_op), @@ -438,7 +452,7 @@ static struct strm_ops gzio_ops_rd = static struct strm_ops gzio_ops_wr = strm_ops_init(cobj_ops_init(eq, - stream_print_op, + gzio_stream_print, gzio_stream_destroy, gzio_stream_mark, cobj_eq_hash_op), -- cgit v1.2.3