summaryrefslogtreecommitdiffstats
path: root/arith.c
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-08-03 09:59:49 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-08-03 09:59:49 -0700
commit1878f60ebdacdd52fb05a171eb07b4bc91e9704c (patch)
treef794b0600c8a68c5e162f1aae53d5e230bcebd30 /arith.c
parenteb657afe78925f7905bc3ca7093bb5e5f441bf4f (diff)
downloadtxr-1878f60ebdacdd52fb05a171eb07b4bc91e9704c.tar.gz
txr-1878f60ebdacdd52fb05a171eb07b4bc91e9704c.tar.bz2
txr-1878f60ebdacdd52fb05a171eb07b4bc91e9704c.zip
Switching some globals to lexical and changing some names.
* arith.c (arith-init): Changing *flo-...* from special to lexical, and adding un-earmuffed variants. The earmuffed versions are obsolescent. Adding %pi% and %e% global lexicals. Earmuffed versions are also made global lexical, and obsolescent. * eval.c (lookup_global_var, lookup_global_var_l): New functions. (lookup_var): Uses lookup_global_var. (reg_varl): New function. (reg_var): Uses reg_var. (eval_init): Register global lexicals user-package, system-package and keyword-package. Old symbols with earmuffs are obsoleted, and also turned into global lexicals. (top-vb, top-fb): Changed to lexical. * eval.h (lookup_global_var, lookup_global_var_l, reg_varl): Declared. * genvim.txr: Scan ver.tl so that the lib-version variable is included. Extract reg_varl calls. * glob.c (glob_init): glob-err and other variables made lexical. * lib.c (get_user_package, get_system_package, get_keyword_package): Use lookup_global_var_l to avoid searching dynamic scope for lexicals which cannot be dynamically rebound. * share/txr/stdlib/ver.tl (lib-version): New global lexical variable. (*lib-version*): Turned lexical. Obsolescent. * signal.c (sig-init): sig-* variables turned lexical. * sysif.c (sysif-init): s-*, poll-* and w-* variables turned lexical. * syslog.c (syslog-init): log-* variables turned lexical. * txr.c (sysroot-init): stdlib and *txr-version* variables turned lexical. txr-version variable added, and *txr-version* is obsolescent. (txr-main): self-path variable added. *self-path* turns lexical and is obsolescent. * txr.1: Documentation updated. Lexical variables not referred to as special. Special variables referred to as special.
Diffstat (limited to 'arith.c')
-rw-r--r--arith.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/arith.c b/arith.c
index 9aeb0875..afbc07dc 100644
--- a/arith.c
+++ b/arith.c
@@ -2276,16 +2276,22 @@ void arith_init(void)
mp_set_intptr(&INT_PTR_MAX_MP, INT_PTR_MAX);
log2_init();
- reg_var(intern(lit("*flo-dig*"), user_package), num_fast(DBL_DIG));
- reg_var(intern(lit("*flo-max*"), user_package), flo(DBL_MAX));
- reg_var(intern(lit("*flo-min*"), user_package), flo(DBL_MIN));
- reg_var(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*"), 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"), 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));
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
- reg_var(intern(lit("*pi*"), user_package), flo(M_PI));
+ 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_var(intern(lit("*e*"), user_package), flo(M_E));
+ reg_varl(intern(lit("*e*"), user_package), flo(M_E));
+ reg_varl(intern(lit("%e%"), user_package), flo(M_E));
}