summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2019-03-06 21:30:00 -0800
committerKaz Kylheku <kaz@kylheku.com>2019-03-06 21:30:00 -0800
commit4687dad975105144fd04827ca525a6272102b9d0 (patch)
tree262ac1311360d66b2a314da7b3b77ec1545f6e5e /lisplib.c
parent9997fdaffbd9b5061fb7292c8720bce89e64072f (diff)
downloadtxr-4687dad975105144fd04827ca525a6272102b9d0.tar.gz
txr-4687dad975105144fd04827ca525a6272102b9d0.tar.bz2
txr-4687dad975105144fd04827ca525a6272102b9d0.zip
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.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c18
1 files changed, 18 insertions, 0 deletions
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));
}