diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-11-11 08:18:35 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-11-11 08:18:35 -0800 |
commit | e3314a5609df7bc920a99766770c66bac690a873 (patch) | |
tree | c27bebfcea2398d86e67ae2724a2d4128636bcb5 /lisplib.c | |
parent | 7843bdd7550a1cf3213a184c350b3175d8e8e562 (diff) | |
download | txr-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.c | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -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) |