diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2016-09-23 21:38:50 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2016-09-23 21:38:50 -0700 |
commit | d510a260dd1755961fe85b6653e9832f49b34201 (patch) | |
tree | f540fedfaed3c0becb8808a7b97c602efb8fd4ac /txr.c | |
parent | 57f625f68909a4420e5621a2f40717427ecf63e2 (diff) | |
download | txr-d510a260dd1755961fe85b6653e9832f49b34201.tar.gz txr-d510a260dd1755961fe85b6653e9832f49b34201.tar.bz2 txr-d510a260dd1755961fe85b6653e9832f49b34201.zip |
Bugfix: -Dvar=val not seen in some Lisp code.
TXR Lisp files run from the command line do not see -Dvar=val
bindings, whereas -p expressions do. The REPL sees the
bindings, but not code loaded from it using (load "file.tl")
because they are lexical.
Let's keep these bindings as local lexicals for -p and -e
forms, but install them as global lexicals for the
other situations.
* parser.c (repl): Get rid of the local repl_env made
from the bindings that are passed in. Instead, before
starting the REPL, loop through the bindings and install
them as global lexicals with reg_varl.
* txr.c (txr_main): Before processing a Lisp file,
install the bindings as global lexicals with reg_varl.
Diffstat (limited to 'txr.c')
-rw-r--r-- | txr.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -979,6 +979,11 @@ int txr_main(int argc, char **argv) } } + for (; bindings; bindings = cdr(bindings)) { + val binding = car(bindings); + reg_varl(car(binding), cdr(binding)); + } + { val result = read_eval_stream(parse_stream, std_error, t); |