From d527345d0d968bdb2a1a90aaa70aa10319aa29fe Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 27 May 2022 06:43:09 -0700 Subject: gzio: support :byte-oriented prop. * gzio.c (gzio_get_prop, gzio_set_prop): Handle :byte-oriented symbol, connecting it to the is_byte_oriented flag. This is already implemented, by copy and paste from the stdio routines. --- gzio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gzio.c') diff --git a/gzio.c b/gzio.c index 25f2c9d9..4879ce0a 100644 --- a/gzio.c +++ b/gzio.c @@ -381,22 +381,30 @@ static ucnum gzio_put_buf(val stream, mem_t *ptr, ucnum len, ucnum pos) static val gzio_get_prop(val stream, val ind) { + struct gzio_handle *h = coerce(struct gzio_handle *, stream->co.handle); + if (ind == name_k) { struct strm_ops *ops = coerce(struct strm_ops *, stream->co.ops); val name = static_str(ops->name); - struct gzio_handle *h = coerce(struct gzio_handle *, stream->co.handle); return format(nil, lit("~a ~a"), name, h->descr, nao); + } else if (ind == byte_oriented_k) { + return h->is_byte_oriented ? t : nil; } return nil; } static val gzio_set_prop(val stream, val ind, val prop) { + struct gzio_handle *h = coerce(struct gzio_handle *, stream->co.handle); + if (ind == name_k) { - struct gzio_handle *h = coerce(struct gzio_handle *, stream->co.handle); h->descr = prop; return t; + } else if (ind == byte_oriented_k) { + h->is_byte_oriented = prop ? 1 : 0; + return t; } + return nil; } -- cgit v1.2.3