From 78d6a6ed5cd8a141fdae8e7f85faeadbd5b177b2 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 6 Sep 2019 07:26:03 -0700 Subject: subtypep: structs with car or length method are sequences. * lib.c (subtypep): For the sequence supertype, check whether the subtype is a structure that has a length or car method, returning t if so. * struct.c (get_special_slot_by_type): New function. * struct.h (get_special_slot_by_type): Declared. * txr.1: Add to the type hierarchy diagram. --- struct.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'struct.c') diff --git a/struct.c b/struct.c index 87ea9b96..82ea5ef4 100644 --- a/struct.c +++ b/struct.c @@ -1773,6 +1773,13 @@ val get_special_slot(val obj, enum special_slot spidx) return get_special_static_slot(si->type, spidx, slot); } +val get_special_slot_by_type(val stype, enum special_slot spidx) +{ + struct struct_type *st = coerce(struct struct_type *, stype->co.handle); + val slot = *special_sym[spidx]; + return get_special_static_slot(st, spidx, slot); +} + static_def(struct cobj_ops struct_type_ops = cobj_ops_init(eq, struct_type_print, struct_type_destroy, struct_type_mark, cobj_eq_hash_op)); -- cgit v1.2.3