summaryrefslogtreecommitdiffstats
path: root/rand.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2015-09-08 06:43:11 -0700
committerKaz Kylheku <kaz@kylheku.com>2015-09-08 06:43:11 -0700
commitf72fa1121f2571aba9f16f95d58d8e915965d765 (patch)
tree5a69df1dd47b2b912604bbcff3303088f4ea5ab1 /rand.h
parent67e450455d7514d9a03da48e7830e59f98b6a958 (diff)
downloadtxr-f72fa1121f2571aba9f16f95d58d8e915965d765.tar.gz
txr-f72fa1121f2571aba9f16f95d58d8e915965d765.tar.bz2
txr-f72fa1121f2571aba9f16f95d58d8e915965d765.zip
Random states of type random-state, not *random-state*.
* lib.c (compat_fixup): Call rand_compat_fixup. * rand.c (random_state_var_s): New global symbol variable. (rand_compat_fixup): New static function. (rand_init): Initialize random_state_var_s by intering the earmuffed symbol *random-state*. Initialize random_state_s to the non-earmuffed symbol random-state. * rand.h (random_state_var_s): Declared. (random_state): Macro updated to look up the special variable using random_state_var_s, rather than random_state_s. (rand_compat_fixup): Declared.
Diffstat (limited to 'rand.h')
-rw-r--r--rand.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/rand.h b/rand.h
index 23c4167a..d68be1f9 100644
--- a/rand.h
+++ b/rand.h
@@ -24,11 +24,12 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#define random_state (deref(lookup_var_l(nil, random_state_s)))
-extern val random_state_s;
+#define random_state (deref(lookup_var_l(nil, random_state_var_s)))
+extern val random_state_s, random_state_var_s;
val make_random_state(val seed);
val random_state_p(val obj);
val random_fixnum(val state);
val random(val state, val modulus);
val rnd(val modulus, val state);
+void rand_compat_fixup(int compat_ver);
void rand_init(void);