summaryrefslogtreecommitdiffstats
path: root/txr.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-26 20:04:48 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-26 20:04:48 -0700
commit35c93525878412abba9acbc46071327c8bfcfc9c (patch)
treea7445b4a0bf67b203d0fbc32d5d55a159b020395 /txr.c
parent36f8481e4029ce04776e222653ab3e5aff0c9cd7 (diff)
downloadtxr-35c93525878412abba9acbc46071327c8bfcfc9c.tar.gz
txr-35c93525878412abba9acbc46071327c8bfcfc9c.tar.bz2
txr-35c93525878412abba9acbc46071327c8bfcfc9c.zip
Overhaul of self-load-path mechanism.
The self-load-path symbol macro is as of now deprecated. It simply expands to *load-path*. *load-path* is a new special variable which is dynamically bound to the path of a file being loaded. * eval.c (self_load_path_s): Global variable renamed to load_path_s. (sys_load): Bind *load-path* around processing of loaded file. (me_load): Expand (load x) simply to (sys:load x *load-path*). (set_get_symacro): Function removed. (reg_symacro): New static function. (eval_init): Initialize renamed load_path_s with interned symbol having the name *load-path*. Register the *load-path* special variable. Set up the sel-load-path symbol macro aliasing for *load-path*. * eval.h (self_load_path_s): Declaration renamed. * match.c (v_load): Bind *load-path* around loading or inclusion. * parser.c (load_rcfile): Bind *load-path* around loading of .txr_profile file. * txr.c (txr_main): Bind *load-path* instead of self-load-path symbol macro. * txr.1: Updated documentation for @(load) directive and load macro. Replaced documentation of self-load-path with *load-path*.
Diffstat (limited to 'txr.c')
-rw-r--r--txr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/txr.c b/txr.c
index 10f1f137..3fff8910 100644
--- a/txr.c
+++ b/txr.c
@@ -907,7 +907,8 @@ 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);
+ dyn_env = make_env(nil, nil, dyn_env);
+ env_vbind(dyn_env, load_path_s, spec_file_str);
} else {
drop_privilege();
spec_file_str = lit("stdin");
@@ -933,7 +934,8 @@ 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);
+ dyn_env = make_env(nil, nil, dyn_env);
+ env_vbind(dyn_env, load_path_s, spec_file_str);
} else {
drop_privilege();
spec_file_str = lit("stdin");