summaryrefslogtreecommitdiffstats
path: root/struct.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-11-19 07:06:22 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-11-20 16:17:19 -0800
commiteb483eb39fa4570d1178a3f71fb65be908fd0d01 (patch)
tree4668efdc1c3c407e2ff21c0559cb23800a0471ce /struct.h
parentec5daf6385b68f08e82c106a925a758cf2b2bf14 (diff)
downloadtxr-eb483eb39fa4570d1178a3f71fb65be908fd0d01.tar.gz
txr-eb483eb39fa4570d1178a3f71fb65be908fd0d01.tar.bz2
txr-eb483eb39fa4570d1178a3f71fb65be908fd0d01.zip
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.
Diffstat (limited to 'struct.h')
-rw-r--r--struct.h1
1 files changed, 1 insertions, 0 deletions
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);