From b08041e3593ee857b33043140a7bfd00bedc4546 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 17 Feb 2018 20:10:47 -0800 Subject: New listener feature: greedy evaluation feature. * eval.c (eval_intrinsic_noerr): New function. * eval.h (eval_intrinsic_noerr): Declared. * parser.c (listener_greedy_eval_s): New symbol variable. (repl): Implement greedy evaluation loop, enabled by the *listener-greedy-eval-p* special. (parse_init): Intern the *listener-greedy-eval-p* symbol, storing it in the listener_greedy_eval_s variable. Register the symbol as a special variable. * txr.1: Documented *listener-greedy-eval-p* variable and the greedy evaluation feature that it controls. --- eval.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'eval.c') diff --git a/eval.c b/eval.c index 324722d2..ac023eef 100644 --- a/eval.c +++ b/eval.c @@ -1370,6 +1370,32 @@ val eval_intrinsic(val form, val env) return ret; } +val eval_intrinsic_noerr(val form, val env, val *error_p) +{ + val result = nil; + uw_frame_t uw_handler; + uw_push_handler(&uw_handler, cons(defr_warning_s, nil), + func_n1v(uw_muffle_warning)); + + uw_catch_begin (cons(t, nil), exsym, exvals); + + result = eval_intrinsic(form, env); + + uw_catch(exsym, exvals) { + (void) exsym; (void) exvals; + *error_p = t; + break; + } + + uw_unwind; + + uw_catch_end; + + uw_pop_frame(&uw_handler); + + return result; +} + static val do_eval(val form, val env, val ctx, val (*lookup)(val env, val sym)) { -- cgit v1.2.3