diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-11-05 15:50:52 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-11-05 15:50:52 -0700 |
commit | 41cb66577c668dac1c83fee512c4eb0501850c8a (patch) | |
tree | 9b03f0164253311d871f18205517ff1bc2bb99d4 | |
parent | 157fd76ee20125f409929b95b768b931268b43cf (diff) | |
download | txr-41cb66577c668dac1c83fee512c4eb0501850c8a.tar.gz txr-41cb66577c668dac1c83fee512c4eb0501850c8a.tar.bz2 txr-41cb66577c668dac1c83fee512c4eb0501850c8a.zip |
Expose slots function.
* struct.c (struct_init): Register slots intrinsic.
(slots): Pass correct name string to stype_handle.
* txr.1: Slots function documented.
-rw-r--r-- | struct.c | 3 | ||||
-rw-r--r-- | txr.1 | 14 |
2 files changed, 16 insertions, 1 deletions
@@ -158,6 +158,7 @@ void struct_init(void) reg_fun(intern(lit("super-method"), user_package), func_n2(super_method)); reg_fun(intern(lit("uslot"), user_package), func_n1(uslot)); reg_fun(intern(lit("umethod"), user_package), func_n1v(umethod)); + reg_fun(intern(lit("slots"), user_package), func_n1(slots)); } static noreturn void no_such_struct(val ctx, val sym) @@ -1109,7 +1110,7 @@ val static_slot_p(val type, val sym) val slots(val stype) { - struct struct_type *st = stype_handle(&stype, lit("static-slot-p")); + struct struct_type *st = stype_handle(&stype, lit("slots")); return st->slots; } @@ -22142,6 +22142,20 @@ isn't bound to a particular object. The binding of .code slot-name to a slot in the structure object occurs when the function is called. +.coNP Function @ slots +.synb +.mets (slots << type ) +.syne +.desc +The +.code slots +function returns a list of all of the slots of struct type +.metn type . + +The +.meta type +argument must be a structure type, or else a symbol +which names a structure type. .coNP Function @ slotp .synb .mets (slotp < type << name ) |