summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2018-10-30 17:57:11 -0700
committerKaz Kylheku <kaz@kylheku.com>2018-10-30 17:57:11 -0700
commit50f2661a839a7f76856a5f13733b9a2a7843c135 (patch)
tree6d74f8629b7373a821a13b21fc165fbda905f033
parente7f11c6047409be9ac2b2a3a6eb4e5c58c0bc38b (diff)
downloadtxr-50f2661a839a7f76856a5f13733b9a2a7843c135.tar.gz
txr-50f2661a839a7f76856a5f13733b9a2a7843c135.tar.bz2
txr-50f2661a839a7f76856a5f13733b9a2a7843c135.zip
Hide deprecated, undocumented variables.
* arith.c (arith_init): Do not define *flo-dig*, *flo-max*, *flo-min*, *flo-epsilon*, *pi* and *e* unless compatibility with TXR 199 or earlier is requested. * txr.c (txr_main): Likewise for *self-path*. * txr.1: Compat note added.
-rw-r--r--arith.c19
-rw-r--r--txr.14
-rw-r--r--txr.c3
3 files changed, 19 insertions, 7 deletions
diff --git a/arith.c b/arith.c
index 493492a3..b1fe876c 100644
--- a/arith.c
+++ b/arith.c
@@ -46,6 +46,7 @@
#include "args.h"
#include "eval.h"
#include "itypes.h"
+#include "txr.h"
#include "arith.h"
#define TAG_PAIR(A, B) ((A) << TAG_SHIFT | (B))
@@ -3173,10 +3174,13 @@ void arith_init(void)
mp_neg(&INT_PTR_MAX_SUCC_MP, &INT_PTR_MAX_SUCC_MP);
log2_init();
- reg_varl(intern(lit("*flo-dig*"), user_package), num_fast(DBL_DIG));
- reg_varl(intern(lit("*flo-max*"), user_package), flo(DBL_MAX));
- reg_varl(intern(lit("*flo-min*"), user_package), flo(DBL_MIN));
- reg_varl(intern(lit("*flo-epsilon*"), user_package), flo(DBL_EPSILON));
+ if (opt_compat && opt_compat <= 199) {
+ reg_varl(intern(lit("*flo-dig*"), user_package), num_fast(DBL_DIG));
+ reg_varl(intern(lit("*flo-max*"), user_package), flo(DBL_MAX));
+ reg_varl(intern(lit("*flo-min*"), user_package), flo(DBL_MIN));
+ reg_varl(intern(lit("*flo-epsilon*"), user_package), flo(DBL_EPSILON));
+ }
+
reg_varl(intern(lit("flo-dig"), user_package), num_fast(DBL_DIG));
reg_varl(intern(lit("flo-max-dig"), user_package), num_fast(FLO_MAX_DIG));
reg_varl(intern(lit("flo-max"), user_package), flo(DBL_MAX));
@@ -3188,14 +3192,17 @@ void arith_init(void)
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
- reg_varl(intern(lit("*pi*"), user_package), flo(M_PI));
reg_varl(intern(lit("%pi%"), user_package), flo(M_PI));
#ifndef M_E
#define M_E 2.71828182845904523536
#endif
- reg_varl(intern(lit("*e*"), user_package), flo(M_E));
reg_varl(intern(lit("%e%"), user_package), flo(M_E));
+ if (opt_compat && opt_compat <= 199) {
+ reg_varl(intern(lit("*pi*"), user_package), flo(M_PI));
+ reg_varl(intern(lit("*e*"), user_package), flo(M_E));
+ }
+
reg_fun(intern(lit("signum"), user_package), func_n1(signum));
reg_fun(intern(lit("bignum-len"), user_package), func_n1(bignum_len));
diff --git a/txr.1 b/txr.1
index 073d8df8..69e75b52 100644
--- a/txr.1
+++ b/txr.1
@@ -64906,6 +64906,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 199
+After \*(TX 199, certain global variables that had been deprecated
+for a long time, and no longer documented, were removed. Requesting 199 or
+earlier compatibility restores those variables.
.IP 190
Until \*(TX 190, the
.code reset-struct
diff --git a/txr.c b/txr.c
index 1ef43001..9dda1cc6 100644
--- a/txr.c
+++ b/txr.c
@@ -1022,7 +1022,8 @@ int txr_main(int argc, char **argv)
opt_loglevel = match_loglevel;
- reg_var(intern(lit("*self-path*"), user_package), spec_file_str);
+ if (opt_compat && opt_compat <= 199)
+ reg_var(intern(lit("*self-path*"), user_package), spec_file_str);
if (parser.errors) {
if (enter_repl)