diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-10-24 06:09:52 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-10-24 06:09:52 -0700 |
commit | 96f7e4ab111b641d2f26b97f75ef4d81151417a1 (patch) | |
tree | dc7fae4f93bff8d2c0d1b67bd7b5a315e6d1bdae /struct.c | |
parent | a513b69fd9b1e0f3925f1e33d44fe127dbb858e5 (diff) | |
download | txr-96f7e4ab111b641d2f26b97f75ef4d81151417a1.tar.gz txr-96f7e4ab111b641d2f26b97f75ef4d81151417a1.tar.bz2 txr-96f7e4ab111b641d2f26b97f75ef4d81151417a1.zip |
Fix non-working quasiquote over struct literals.
Turns out that there is missing support for quasiquoting
over structs. Code analogous to the way vector and hash
literals are handled is missing for structs.
* eval.c (expand_qquote_rec): Handle struct_lit_s forms
specially, like hash_lit_s and vector_lit_s.
commit 1e5bc5708d5763f20a7774f9348e825304a51adc
* struct.c (make_struct_lit_s): New symbol variable.
(struct_init): Store interned sys:make-struct-lit symbol
into make_struct_lit_s, and use that to register the
function.
* struct.h (make_struct_lit_s): Declared.
* tests/012/struct.tl: Update struct literal quasiquote
test cases to reflect fixed behavior.
Diffstat (limited to 'struct.c')
-rw-r--r-- | struct.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -88,7 +88,7 @@ struct struct_inst { val slot[1]; }; -val struct_type_s, meth_s, print_s; +val struct_type_s, meth_s, print_s, make_struct_lit_s; static cnum struct_id_counter; static val struct_type_hash; @@ -111,6 +111,7 @@ void struct_init(void) struct_type_s = intern(lit("struct-type"), user_package); meth_s = intern(lit("meth"), user_package); print_s = intern(lit("print"), user_package); + make_struct_lit_s = intern(lit("make-struct-lit"), system_package); struct_type_hash = make_hash(nil, nil, nil); slot_hash = make_hash(nil, nil, t); struct_type_finalize_f = func_n1(struct_type_finalize); @@ -131,7 +132,7 @@ void struct_init(void) reg_fun(intern(lit("make-struct"), user_package), func_n2v(make_struct)); reg_fun(intern(lit("make-lazy-struct"), user_package), func_n2(make_lazy_struct)); - reg_fun(intern(lit("make-struct-lit"), system_package), func_n2(make_struct_lit)); + reg_fun(make_struct_lit_s, func_n2(make_struct_lit)); reg_fun(intern(lit("copy-struct"), user_package), func_n1(copy_struct)); reg_fun(intern(lit("replace-struct"), user_package), func_n2(replace_struct)); reg_fun(intern(lit("clear-struct"), user_package), func_n2o(clear_struct, 1)); |