diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-01-04 22:31:03 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-01-04 22:31:03 -0800 |
commit | eaebe42f734d31e1f1c44802ad315f004c126ddc (patch) | |
tree | d154f2f9ff30048944d88b53fbc3eea0b7622155 /lisplib.c | |
parent | 65f31ed7d51a9b0dd79ec9c30355fb2f3929fe49 (diff) | |
download | txr-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.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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) |