summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-11-11 08:18:35 -0800
committerKaz Kylheku <kaz@kylheku.com>2016-11-11 08:18:35 -0800
commite3314a5609df7bc920a99766770c66bac690a873 (patch)
treec27bebfcea2398d86e67ae2724a2d4128636bcb5 /lisplib.c
parent7843bdd7550a1cf3213a184c350b3175d8e8e562 (diff)
downloadtxr-e3314a5609df7bc920a99766770c66bac690a873.tar.gz
txr-e3314a5609df7bc920a99766770c66bac690a873.tar.bz2
txr-e3314a5609df7bc920a99766770c66bac690a873.zip
Add defpackage macro.
* lisplib.c (package_set_entries, package_instantiate): New static functions. (lisplib_init): Register auto-loading for new package.tl file using new functions. * share/txr/stdlib/package.tl: New file. * txr.1: Documented.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lisplib.c b/lisplib.c
index 97cdedb9..06178383 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -407,6 +407,24 @@ static val getopts_instantiate(val set_fun)
return nil;
}
+static val package_set_entries(val dlt, val fun)
+{
+ val name[] = {
+ lit("defpackage"),
+ nil
+ };
+ set_dlt_entries(dlt, name, fun);
+ return nil;
+}
+
+static val package_instantiate(val set_fun)
+{
+ funcall1(set_fun, nil);
+ load(format(nil, lit("~apackage.tl"), stdlib_path, nao));
+ return nil;
+}
+
+
val dlt_register(val dlt,
val (*instantiate)(val),
val (*set_entries)(val, val))
@@ -440,6 +458,7 @@ void lisplib_init(void)
dlt_register(dl_table, build_instantiate, build_set_entries);
dlt_register(dl_table, trace_instantiate, trace_set_entries);
dlt_register(dl_table, getopts_instantiate, getopts_set_entries);
+ dlt_register(dl_table, package_instantiate, package_set_entries);
}
val lisplib_try_load(val sym)