summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2022-05-27 06:43:09 -0700
committerKaz Kylheku <kaz@kylheku.com>2022-05-27 06:43:09 -0700
commitd527345d0d968bdb2a1a90aaa70aa10319aa29fe (patch)
tree37fbd94767dab59c8fb7198ad441b6b08d2fcbbb
parent070c343bfb9dc26248ab73719f37f6b5888f5217 (diff)
downloadtxr-d527345d0d968bdb2a1a90aaa70aa10319aa29fe.tar.gz
txr-d527345d0d968bdb2a1a90aaa70aa10319aa29fe.tar.bz2
txr-d527345d0d968bdb2a1a90aaa70aa10319aa29fe.zip
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.
-rw-r--r--gzio.c12
1 files changed, 10 insertions, 2 deletions
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;
}