summaryrefslogtreecommitdiffstats
path: root/lisplib.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-01-04 22:31:03 -0800
committerKaz Kylheku <kaz@kylheku.com>2017-01-04 22:31:03 -0800
commiteaebe42f734d31e1f1c44802ad315f004c126ddc (patch)
treed154f2f9ff30048944d88b53fbc3eea0b7622155 /lisplib.c
parent65f31ed7d51a9b0dd79ec9c30355fb2f3929fe49 (diff)
downloadtxr-eaebe42f734d31e1f1c44802ad315f004c126ddc.tar.gz
txr-eaebe42f734d31e1f1c44802ad315f004c126ddc.tar.bz2
txr-eaebe42f734d31e1f1c44802ad315f004c126ddc.zip
New Lisp feature: param list expander.
* eval.c (pm_table): New static variable. (expand_param_macro): New static function. (expand_params): Expand parameter list macros via expand_param_macro. (eval_init): gc-protect pm_table and initialize it. Register *param-macro* variable. * lisplib.v (pmac_set_entries, pmac_instantiate): New static functions. (lisplib_init): Register autoloading of pmac.tl via new functions. * share/txr/stdlib/pmac.tl: New file. * txr.1: Notes under defun, lambds, flet/labels and defmacro about the existence of parameter macros which add to the syntax. New Parameter List Macros section. Documented *param-macro* and define-param-expander.
Diffstat (limited to 'lisplib.c')
-rw-r--r--lisplib.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/lisplib.c b/lisplib.c
index 2423274a..9d0472e4 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -465,6 +465,22 @@ static val tagbody_instantiate(val set_fun)
return nil;
}
+static val pmac_set_entries(val dlt, val fun)
+{
+ val name[] = {
+ lit("define-param-expander"), nil
+ };
+ set_dlt_entries(dlt, name, fun);
+ return nil;
+}
+
+static val pmac_instantiate(val set_fun)
+{
+ funcall1(set_fun, nil);
+ load(format(nil, lit("~apmac.tl"), stdlib_path, nao));
+ return nil;
+}
+
val dlt_register(val dlt,
val (*instantiate)(val),
val (*set_entries)(val, val))
@@ -501,6 +517,7 @@ void lisplib_init(void)
dlt_register(dl_table, package_instantiate, package_set_entries);
dlt_register(dl_table, getput_instantiate, getput_set_entries);
dlt_register(dl_table, tagbody_instantiate, tagbody_set_entries);
+ dlt_register(dl_table, pmac_instantiate, pmac_set_entries);
}
val lisplib_try_load(val sym)