From 4687dad975105144fd04827ca525a6272102b9d0 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 6 Mar 2019 21:30:00 -0800 Subject: New macro: defset. * lisplib.c (defset_instantiate, defset_set_entries): New static functions. (lisplib_init): Register auto-load of defset.tl, keyed on defset symbol. * share/txr/stdlib/defset.tl: New file. * share/txr/stdlib/paramt.tl (param-parser-base opt-syms): New method. * txr.1: Documented. --- lisplib.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lisplib.c') diff --git a/lisplib.c b/lisplib.c index 0ef52934..a3f0e9f6 100644 --- a/lisplib.c +++ b/lisplib.c @@ -757,6 +757,23 @@ static val save_exe_set_entries(val dlt, val fun) return nil; } +static val defset_instantiate(val set_fun) +{ + funcall1(set_fun, nil); + load(format(nil, lit("~adefset"), stdlib_path, nao)); + return nil; +} + +static val defset_set_entries(val dlt, val fun) +{ + val name[] = { + lit("defset"), + nil + }; + set_dlt_entries(dlt, name, fun); + return nil; +} + val dlt_register(val dlt, val (*instantiate)(val), val (*set_entries)(val, val)) @@ -806,6 +823,7 @@ void lisplib_init(void) dlt_register(dl_table, op_instantiate, op_set_entries); dlt_register(dl_table, save_exe_instantiate, save_exe_set_entries); + dlt_register(dl_table, defset_instantiate, defset_set_entries); reg_fun(intern(lit("try-load"), system_package), func_n1(lisplib_try_load)); } -- cgit v1.2.3