From 274cb70971d6a2cebcd887350b4b8602b32743d7 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 4 Apr 2018 20:01:02 -0700 Subject: Implement compiled file loading. * eval.c (load): If open_txr_file indicates compiled file by setting txr_lisp_p to character #\o, use read_compiled_file. * match.c (v_load): Likewise. * parser.c (open_txr_file): Recognize the .tlo suffix, and also try to open a .tlo version of an unsuffixed file before trying it as .tl. Indicate a .tlo file by setting txr_lisp_p to the character #\o rather than t. (read_file_common): New static function, made from contents of read_eval_stream. Will either evaluate forms or load compiled code by instantiating virtual machine descriptions and performing their top-level execution. (read_eval_stream): Now a wrapper for read_file_common. (read_compiled_file): New function. * parser.h (read_compiled_file): Declared. * txr.c (help): List new --compiled option. (txr_main): If --compiled is specified, set txr_lisp_p to #\o to load as compiled code. Update error message that -c is not compatible with --lisp or --compiled. If txr_lisp_p is #\o, then use read_compiled_file. --- parser.h | 1 + 1 file changed, 1 insertion(+) (limited to 'parser.h') diff --git a/parser.h b/parser.h index 33b22d00..12378631 100644 --- a/parser.h +++ b/parser.h @@ -121,6 +121,7 @@ val nread(val source_in, val error_stream, val error_return_val, val iread(val source_in, val error_stream, val error_return_val, val name_in, val lineno); val read_eval_stream(val stream, val error_stream); +val read_compiled_file(val stream, val error_stream); #if HAVE_TERMIOS val repl(val bindings, val in_stream, val out_stream); #endif -- cgit v1.2.3