From 4c6fa66bc8c407c14c5c1db7e3b717679a2bf451 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sun, 5 Jun 2016 21:20:15 -0700 Subject: The stdlib variable gets a trailing slash. * txr.c (sysroot_init): Add slash to stdlib_path. (sysroot_compat_fixup): Replace user-visible stdlib variable with a path that doesn't have a slash, if compatibility is 143 or lower. (compat): Call sysroot_compat_fixup. * lisplib.c (place_set_entries, ver_set_entries, ifa_set_entries, txr_case_set_entries, with_resources_set_entries, path_test_set_entries, struct_set_entries, with_stream_set_entries, hash_set_entries, except_set_entries, type_set_entries, yield_set_entries, sock_set_entries, termios_set_entries): Remove slash from format string since the directory includes it. * txr.1: Added note under stdlib about the slash, and also an entry COMPATIBILITY. --- lisplib.c | 28 ++++++++++++++-------------- txr.1 | 6 +++++- txr.c | 10 +++++++++- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/lisplib.c b/lisplib.c index 1c65cd92..134264ad 100644 --- a/lisplib.c +++ b/lisplib.c @@ -83,7 +83,7 @@ static val place_set_entries(val dlt, val fun) static val place_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/place.tl"), stdlib_path, nao)); + load(format(nil, lit("~aplace.tl"), stdlib_path, nao)); return nil; } @@ -97,7 +97,7 @@ static val ver_set_entries(val dlt, val fun) static val ver_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/ver.tl"), stdlib_path, nao)); + load(format(nil, lit("~aver.tl"), stdlib_path, nao)); return nil; } @@ -111,7 +111,7 @@ static val ifa_set_entries(val dlt, val fun) static val ifa_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/ifa.tl"), stdlib_path, nao)); + load(format(nil, lit("~aifa.tl"), stdlib_path, nao)); return nil; } @@ -125,7 +125,7 @@ static val txr_case_set_entries(val dlt, val fun) static val txr_case_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/txr-case.tl"), stdlib_path, nao)); + load(format(nil, lit("~atxr-case.tl"), stdlib_path, nao)); return nil; } @@ -143,7 +143,7 @@ static val with_resources_set_entries(val dlt, val fun) static val with_resources_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/with-resources.tl"), stdlib_path, nao)); + load(format(nil, lit("~awith-resources.tl"), stdlib_path, nao)); return nil; } @@ -170,7 +170,7 @@ static val path_test_set_entries(val dlt, val fun) static val path_test_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/path-test.tl"), stdlib_path, nao)); + load(format(nil, lit("~apath-test.tl"), stdlib_path, nao)); return nil; } @@ -194,7 +194,7 @@ static val struct_set_entries(val dlt, val fun) static val struct_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/struct.tl"), stdlib_path, nao)); + load(format(nil, lit("~astruct.tl"), stdlib_path, nao)); return nil; } @@ -215,7 +215,7 @@ static val with_stream_set_entries(val dlt, val fun) static val with_stream_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/with-stream.tl"), stdlib_path, nao)); + load(format(nil, lit("~awith-stream.tl"), stdlib_path, nao)); return nil; } @@ -229,7 +229,7 @@ static val hash_set_entries(val dlt, val fun) static val hash_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/hash.tl"), stdlib_path, nao)); + load(format(nil, lit("~ahash.tl"), stdlib_path, nao)); return nil; } @@ -243,7 +243,7 @@ static val except_set_entries(val dlt, val fun) static val except_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/except.tl"), stdlib_path, nao)); + load(format(nil, lit("~aexcept.tl"), stdlib_path, nao)); return nil; } @@ -257,7 +257,7 @@ static val type_set_entries(val dlt, val fun) static val type_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/type.tl"), stdlib_path, nao)); + load(format(nil, lit("~atype.tl"), stdlib_path, nao)); return nil; } @@ -276,7 +276,7 @@ static val yield_set_entries(val dlt, val fun) static val yield_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/yield.tl"), stdlib_path, nao)); + load(format(nil, lit("~ayield.tl"), stdlib_path, nao)); return nil; } @@ -305,7 +305,7 @@ static val sock_set_entries(val dlt, val fun) static val sock_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/socket.tl"), stdlib_path, nao)); + load(format(nil, lit("~asocket.tl"), stdlib_path, nao)); sock_load_init(); return nil; } @@ -329,7 +329,7 @@ static val termios_set_entries(val dlt, val fun) static val termios_instantiate(val set_fun) { funcall1(set_fun, nil); - load(format(nil, lit("~a/termios.tl"), stdlib_path, nao)); + load(format(nil, lit("~atermios.tl"), stdlib_path, nao)); sock_load_init(); return nil; } diff --git a/txr.1 b/txr.1 index ff20f6fa..451acc93 100644 --- a/txr.1 +++ b/txr.1 @@ -41496,7 +41496,7 @@ holds the suffixed name. The .code stdlib variable expands to the directory where the \*(TX standard library -is installed. +is installed. It includes the trailing slash. Note: there is no need to use the value of this variable to load library modules. Library modules are keyed to specific symbols, and lazily loaded. When @@ -43091,6 +43091,10 @@ of these version values, the described behaviors are provided if is given an argument which is equal or lower. For instance .code "-C 103" selects the behaviors described below for version 105, but not those for 102. +.IP 143 +Until version 143, the +.code stdlib +variable didn't include the trailing slash. .IP 142 Until version 142, the \*(TX pattern language supported a prefix convention on data sources. Data sources beginning with the character diff --git a/txr.c b/txr.c index ef82c84a..56d67771 100644 --- a/txr.c +++ b/txr.c @@ -316,7 +316,7 @@ static void sysroot_init(void) sysroot_path = prog_dir; } - stdlib_path = sysroot(lit("share/txr/stdlib")); + stdlib_path = sysroot(lit("share/txr/stdlib/")); reg_varl(intern(lit("stdlib"), user_package), stdlib_path); reg_varl(intern(lit("*txr-version*"), user_package), @@ -326,6 +326,13 @@ static void sysroot_init(void) reg_varl(intern(lit("txr-path"), user_package), prog_dir); } +static void sysroot_compat_fixup(int compat_ver) +{ + if (compat_ver <= 143) + reg_varl(intern(lit("stdlib"), user_package), + sysroot(lit("share/txr/stdlib"))); +} + static int license(void) { int retval = EXIT_SUCCESS; @@ -411,6 +418,7 @@ static int compat(val optval) return 0; } + sysroot_compat_fixup(compat); opt_compat = compat; return 1; } -- cgit v1.2.3