summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-05-18 20:46:23 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-05-18 20:46:23 -0700
commita2d98ba063616fc56c6888641c77b55b562fc9ab (patch)
tree6cf3e0c8a338be5d222ba48b7ffd4ab6165e2960 /txr.c
parentdc791857cfd41fec131d2645409bf6451eb4635b (diff)
downloadtxr-a2d98ba063616fc56c6888641c77b55b562fc9ab.tar.gz
txr-a2d98ba063616fc56c6888641c77b55b562fc9ab.tar.bz2
txr-a2d98ba063616fc56c6888641c77b55b562fc9ab.zip
New feature: self-load-path symbol macro.
* eval.c (self_load_path_s): New symbol variable. (sys_load): Save, set-up and restore self-load-path around load. (set_get_symacro): New function. (eval_init): Register load function using sys_load_s instead of redundant intern. * eval.h (set_get_symacro): Declared. * match.c (v_load): Save, set-up and restore self-load-path macro. * parser.c (load_rcfile): Likewise. * txr.c (txr_main: Set up self-load-path when opening file. * txr.1: Documented self-load-path.
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/txr.c b/txr.c
index da7869c7..4f09bf3e 100644
--- a/txr.c
+++ b/txr.c
@@ -817,6 +817,7 @@ int txr_main(int argc, char **argv)
if (wcscmp(c_str(spec_file), L"-") != 0) {
open_txr_file(spec_file, &txr_lisp_p, &spec_file_str, &parse_stream);
simulate_setuid_setgid(parse_stream);
+ set_get_symacro(self_load_path_s, spec_file_str);
} else {
drop_privilege();
spec_file_str = lit("stdin");
@@ -842,6 +843,7 @@ int txr_main(int argc, char **argv)
if (!equal(arg, lit("-"))) {
open_txr_file(arg, &txr_lisp_p, &spec_file_str, &parse_stream);
simulate_setuid_setgid(parse_stream);
+ set_get_symacro(self_load_path_s, spec_file_str);
} else {
drop_privilege();
spec_file_str = lit("stdin");