summaryrefslogtreecommitdiffstats
path: root/parser.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-04-04 20:01:02 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-04-04 20:01:02 -0700
commit274cb70971d6a2cebcd887350b4b8602b32743d7 (patch)
tree07344e7330788fa23d35ad34b0a6bf48dcd97661 /parser.h
parent5484325557ee4201fd04772049145ad95ff7dbc4 (diff)
downloadtxr-274cb70971d6a2cebcd887350b4b8602b32743d7.tar.gz
txr-274cb70971d6a2cebcd887350b4b8602b32743d7.tar.bz2
txr-274cb70971d6a2cebcd887350b4b8602b32743d7.zip
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.
Diffstat (limited to 'parser.h')
-rw-r--r--parser.h1
1 files changed, 1 insertions, 0 deletions
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