diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-10-28 05:53:27 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-10-28 05:53:27 -0700 |
commit | 422a4cde1940f5d63e349e73e7241c6e2e28b253 (patch) | |
tree | d682731c232bb932850eb6a7b95f63086f432f2e /eval.c | |
parent | d80d25d7bffd8e4dbf8a43870046bc256a12cd66 (diff) | |
download | txr-422a4cde1940f5d63e349e73e7241c6e2e28b253.tar.gz txr-422a4cde1940f5d63e349e73e7241c6e2e28b253.tar.bz2 txr-422a4cde1940f5d63e349e73e7241c6e2e28b253.zip |
New special macro parameter list parameter :form.
* eval.c (form_k): New keyword symbol variable.
(bind_macro_params): Implement form_k.
(eval_init): Initialize form_k.
* txr.1: Documented :form parameter.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -98,7 +98,7 @@ val fbind_s, lbind_s, flet_s, labels_s; val opip_s, oand_s, chain_s, chand_s; val sys_load_s, sys_lisp1_value_s; -val special_s, whole_k, symacro_k; +val special_s, whole_k, form_k, symacro_k; val last_form_evaled, last_form_expanded; @@ -765,7 +765,7 @@ static val bind_macro_params(val env, val menv, val params, val form, while (consp(params)) { val param = car(params); - if (param == whole_k || param == env_k) { + if (param == whole_k || param == form_k || param == env_k) { val nparam; val next = cdr(params); if (!next) @@ -776,7 +776,11 @@ static val bind_macro_params(val env, val menv, val params, val form, err_sym = nparam; goto nbind; } - env_vbind_special(new_env, nparam, if3(param == whole_k, whole, menv), + env_vbind_special(new_env, nparam, + if3(param == whole_k, + whole, + if3(param == form_k, + ctx_form, menv)), specials, ctx_form); params = cdr(next); continue; @@ -4189,6 +4193,7 @@ void eval_init(void) symacrolet_s = intern(lit("symacrolet"), user_package); with_saved_vars_s = intern(lit("with-saved-vars"), system_package); whole_k = intern(lit("whole"), keyword_package); + form_k = intern(lit("form"), keyword_package); special_s = intern(lit("special"), system_package); symacro_k = intern(lit("symacro"), keyword_package); prof_s = intern(lit("prof"), user_package); |