From 2d5fcd953cd1632dece9d4202e477a5b2cc95663 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 7 Sep 2015 13:16:58 -0700 Subject: Go into repl after processing txr file also. * match.c (extract): Return match result as cons, rather than int termination status. * match.h (extract): Declaration updated. * txr.c (txr_main): Handle result cons. If repl mode is selected, pass bindings from car(result) to repl. Otherwise use match success indication in cdr(result) to determine termination status. --- txr.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'txr.c') diff --git a/txr.c b/txr.c index c2fef68f..b395b185 100644 --- a/txr.c +++ b/txr.c @@ -740,8 +740,15 @@ int txr_main(int argc, char **argv) reg_var(intern(lit("self-path"), user_package), spec_file_str); { - int retval = extract(spec, arg_list, bindings); - return parser.errors ? EXIT_FAILURE : retval; + val result = extract(spec, arg_list, bindings); + cons_bind (new_bindings, success, result); + + if (enter_repl) { + bindings = new_bindings; + goto repl; + } + + return (parser.errors || !success) ? EXIT_FAILURE : 0; } } -- cgit v1.2.3