diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2015-08-24 22:06:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2015-08-24 22:06:13 -0700 |
commit | 8d78717508e7f49a9af456197369d74352122b91 (patch) | |
tree | c99303cdb7a3678ae97e32c84ff7c842de54b886 /eval.c | |
parent | ba3809f1be41bec92385b3e023269145dde4e5b2 (diff) | |
download | txr-8d78717508e7f49a9af456197369d74352122b91.tar.gz txr-8d78717508e7f49a9af456197369d74352122b91.tar.bz2 txr-8d78717508e7f49a9af456197369d74352122b91.zip |
Replace two-step initialization of args with macros.
* args.h (args_init_list, args_init): Return the
struct args * pointer.
(args_decl_list, args_decl): New macros.
* eval.c (apply, do_eval, expand_macro, op_dwim, op_catch,
(mapcarl, lazy_mapcarl): Switch to new macros.
* hash.c (hashl): Likewise.
* lib.c (generic_funcall, lazy_appendl, maxl, minl, funcall,
funcal1, funcall2, funcall3, funcall4, transpose, juxtv,
do_and, do_or, do_iff, unique): Likewise.
* match.c (h_fun, v_fun): Likewise.
* stream.c (vformat): Likewise.
* syslog.c (syslog_wrap): Likewise.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 23 |
1 files changed, 8 insertions, 15 deletions
@@ -670,7 +670,7 @@ static val get_param_syms(val params) val apply(val fun, val arglist, val ctx_form) { - struct args *args = args_alloc(ARGS_MAX); + args_decl(args, ARGS_MAX); args_init_list(args, ARGS_MAX, arglist); return generic_funcall(fun, args); } @@ -990,9 +990,7 @@ static val do_eval(val form, val env, val ctx_form, cnum alen = if3(consp(arglist), c_num(length(arglist)), 0); cnum argc = max(alen, ARGS_MAX); val ret, lfe_save = last_form_evaled; - struct args *args = args_alloc(argc); - - args_init(args, argc); + args_decl(args, argc); do_eval_args(rest(form), env, form, &lookup_var, args); @@ -1424,8 +1422,8 @@ static val expand_macro(val form, val expander, val menv) val saved_de = set_dyn_env(make_env(nil, nil, dyn_env)); val exp_env = bind_macro_params(env, menv, params, arglist, nil, form); val result; - struct args *args = args_alloc(ARGS_MIN); - args_init_list(args, ARGS_MIN, arglist); + args_decl_list(args, ARGS_MIN, arglist); + debug_frame(name, args, nil, env, nil, nil, nil); result = eval_progn(body, exp_env, body); debug_end; @@ -1841,8 +1839,7 @@ static val op_dwim(val form, val env) val objexpr = pop(&argexps); cnum alen = if3(consp(argexps), c_num(length(argexps)), 0); cnum argc = max(alen, ARGS_MIN); - struct args *args = args_alloc(argc); - args_init(args, argc); + args_decl(args, argc); if (!consp(cdr(form))) eval_error(form, lit("~s: missing argument"), car(form), nao); @@ -1865,12 +1862,10 @@ static val op_catch(val form, val env) result = eval(try_form, env, try_form); uw_catch(exsym, exvals) { - struct args *args = args_alloc(ARGS_MIN); + args_decl_list(args, ARGS_MIN, exvals); val catches = rest(rest(rest(form))); val iter; - args_init_list(args, ARGS_MIN, exvals); - for (iter = catches; iter; iter = cdr(iter)) { val clause = car(iter); val type = first(clause); @@ -3286,8 +3281,7 @@ val mapcarv(val fun, struct args *lists) val mapcarl(val fun, val list_of_lists) { - struct args *args = args_alloc(ARGS_MIN); - args_init_list(args, ARGS_MIN, list_of_lists); + args_decl_list(args, ARGS_MIN, list_of_lists); return mapcarv(fun, args); } @@ -3377,8 +3371,7 @@ static val lazy_mapcarv(val fun, struct args *lists) static val lazy_mapcarl(val fun, val list_of_lists) { - struct args *args = args_alloc(ARGS_MIN); - args_init_list(args, ARGS_MIN, list_of_lists); + args_decl_list(args, ARGS_MIN, list_of_lists); return lazy_mapcarv(fun, args); } |