From 4c8dfaaf842db7c8e34d34b83d9cf38627f120da Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Fri, 16 Feb 2018 16:03:38 -0800 Subject: Lisp load function supports .txr files. * eval.c (load): Instead of throwing error when a .txr file is opened, process it according to sensible requirements. * match.c (v_load): Store bindings in the current environment frame before evaluating Lisp, and then update afterward. This allows .txr files loaded from Lisp to continue matching with the current bindings and extend those bindings. * txr.1: Update documentation of load. --- match.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'match.c') diff --git a/match.c b/match.c index 5ce37849..10fd1770 100644 --- a/match.c +++ b/match.c @@ -4308,11 +4308,15 @@ static val v_load(match_files_ctx *c) } } } else { + uw_set_match_context(cons(c->spec, c->bindings)); + if (!read_eval_stream(stream, std_error)){ close_stream(stream, nil); sem_error(specline, lit("load: ~a contains errors"), path, nao); } + c->bindings = cdr(uw_get_match_context()); + ret = (sym == include_s) ? nil : next_spec_k; } -- cgit v1.2.3