summaryrefslogtreecommitdiffstats
path: root/eval.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-11-30 07:17:57 -0800
committerKaz Kylheku <kaz@kylheku.com>2015-11-30 07:17:57 -0800
commit7ef6686ce7020df5618cd5c9ed737c4655f08ef4 (patch)
treec8794a24e9e0a64f9e8bdf09c0cea3c48ccc60ff /eval.h
parent4acf4217af8e9c830f89e8586e5ec62e97cb85b0 (diff)
downloadtxr-7ef6686ce7020df5618cd5c9ed737c4655f08ef4.tar.gz
txr-7ef6686ce7020df5618cd5c9ed737c4655f08ef4.tar.bz2
txr-7ef6686ce7020df5618cd5c9ed737c4655f08ef4.zip
Refactor propagation of contexts in evaluator.
The context form arguments become just context objects in various places. When a context form is actually needed, or the context's symbolic name, they must be retrieved via functions applied to a context. * debug.c (debug): form argument is now a context. Use the ctx_form function to retrieve the form. * debug.h (debug_check): Rename form parameter to ctx. * eval.c (ctx_form, ctx_name): New functions. (eval_error): Leftmost parameter is a context now. Use ctx_form API to obtain the context form from this object, from which the source location info can then be retrieved as before. (abbrev_ctx): Function removed. (bind_args, bindings_helper, fbindings_helper): Convert ctx_form argument to ctx, and use the API to access name or form. (do_eval, do_eval_args, eval, eval_args_lisp1, eval_lisp1, eval_progn, eval_prog1): ctx_form param renamed to ctx. (funcall_interp): Pass the original interpreted function as the context to bind_args, not the extracted code. When ctx_name sees this object, it will compute the function name, which was not possible from the code being used as the context. This is the big reason for all these changes. * eval.h (eval_error): Declaration updated. (ctx_form, ctx_name): Declared.
Diffstat (limited to 'eval.h')
-rw-r--r--eval.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/eval.h b/eval.h
index 311cc8ac..67254820 100644
--- a/eval.h
+++ b/eval.h
@@ -30,7 +30,9 @@ extern val eval_error_s;
extern val eq_s, eql_s, equal_s;
extern val last_form_evaled, last_form_expanded;
-noreturn val eval_error(val form, val fmt, ...);
+noreturn val eval_error(val ctx, val fmt, ...);
+val ctx_form(val obj);
+val ctx_name(val obj);
val lookup_origin(val form);
void error_trace(val exsym, val exvals, val out_stream, val prefix);
val make_env(val fbindings, val vbindings, val up_env);