diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-02-17 20:10:47 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-02-17 20:10:47 -0800 |
commit | b08041e3593ee857b33043140a7bfd00bedc4546 (patch) | |
tree | e4b44d1857f52585021447ffe65ec6e1068e58ca /eval.c | |
parent | 4c8dfaaf842db7c8e34d34b83d9cf38627f120da (diff) | |
download | txr-b08041e3593ee857b33043140a7bfd00bedc4546.tar.gz txr-b08041e3593ee857b33043140a7bfd00bedc4546.tar.bz2 txr-b08041e3593ee857b33043140a7bfd00bedc4546.zip |
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.
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -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)) { |