From eb483eb39fa4570d1178a3f71fb65be908fd0d01 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Thu, 19 Nov 2015 07:06:22 -0800 Subject: Introducing lazy structs. * share/txr/stdlib/struct.tl (lnew): New macro. * struct.c (struct_type): Turn id into a bitfield one bit smaller than cnum. New Boolean bitfield lazy. (struct_init): Register make-lazy-struct intrinsic. (make_struct): Initialize lazy bitfield to zero. (lazy_struct_init, check_init_lazy_struct): New static functions. (make_lazy_struct): New function. (copy_struct, clear_struct, replace_struct, reset_struct, lookup_slot, struct_inst_equal, struct_inst_hash): Call check_init_lazy_struct on all structures involved. (lookup_slot): Call check_init_lazy_struct. (struct_inst_mark): If the struct is lazy, it has one instance slot which must be marked, holding the argfun function passed into make_lazy_struct. * struct.h (make_lazy_struct): Declared. * txr.1: Documented lnew and make-lazy-struct. --- struct.h | 1 + 1 file changed, 1 insertion(+) (limited to 'struct.h') diff --git a/struct.h b/struct.h index d5545bf4..3d5b1942 100644 --- a/struct.h +++ b/struct.h @@ -31,6 +31,7 @@ val make_struct_type(val name, val super, val struct_type_p(val obj); val super(val type); val make_struct(val type, val plist, struct args *); +val make_lazy_struct(val type, val argfun); val copy_struct(val strct); val clear_struct(val strct, val value); val replace_struct(val target, val source); -- cgit v1.2.3