summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include/sys/reent.h
diff options
context:
space:
mode:
authorJeff Johnston <jjohnstn@redhat.com>2001-02-15 02:04:55 +0000
committerJeff Johnston <jjohnstn@redhat.com>2001-02-15 02:04:55 +0000
commitab4745dcb21ead97ebc469f93609a0b4a451f778 (patch)
tree78db58592891c02ef44134bae0b24b61d6311d94 /newlib/libc/include/sys/reent.h
parentee2c7251d0069de6fe5e20f9295ddc0cfd41fb5c (diff)
downloadcygnal-ab4745dcb21ead97ebc469f93609a0b4a451f778.tar.gz
cygnal-ab4745dcb21ead97ebc469f93609a0b4a451f778.tar.bz2
cygnal-ab4745dcb21ead97ebc469f93609a0b4a451f778.zip
2001-02-14 Kazuhiro Fujieda <fujieda@jaist.ac.jp>
* libc/include/stdlib.h: Add declarations of rand48 functions and their reentrant versions. * libc/include/sys/reent.h: Move macros from rand48.h. Add struct _rand48 for shared parameters of rand48 functions. (struct _reent): Add a variable _r48 of struct _rand48. (_REENT_INIT): Add _r48 initialization. * libc/stdlib/Makefile.am (lib_a_SOURCES): Add rand48 functions. (CHEWOUT_FILES): Add rand48.def. * libc/stdlib/Makefile.am: Add dependencies for rand48 functions. * libc/stdlib/Makefile.in: Regenerated. * libc/stdlib/drand48.c (drand48, _drand48_r): Derived from the NetBSD C library. * libc/stdlib/erand48.c (erand48, _erand48_r): Ditto. * libc/stdlib/jrand48.c (jrand48, _jrand48_r): Ditto. * libc/stdlib/lcong48.c (lcong48, _lcong48_r): Ditto. * libc/stdlib/lrand48.c (lrand48, _lrand48_r): Ditto. * libc/stdlib/mrand48.c (mrand48, _mrand48_r): Ditto. * libc/stdlib/nrand48.c (nrand48, _nrand48_r): Ditto. * libc/stdlib/seed48.c (seed48, _seed48_r): Ditto. * libc/stdlib/srand48.c (srand48, _srand48_r): Ditto. * libc/stdlib/rand48.c (__dorand48): Ditto. * libc/stdlib/rand48.h: Ditto, and modify declarations of global parameters into macros referring them in the reentrant structure.
Diffstat (limited to 'newlib/libc/include/sys/reent.h')
-rw-r--r--newlib/libc/include/sys/reent.h33
1 files changed, 31 insertions, 2 deletions
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 760638676..8a0fb7f12 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -136,6 +136,33 @@ struct __sFILE {
};
/*
+ * rand48 family support
+ *
+ * Copyright (c) 1993 Martin Birgmeier
+ * All rights reserved.
+ *
+ * You may redistribute unmodified or modified versions of this source
+ * code provided that the above copyright notice and this and the
+ * following conditions are retained.
+ *
+ * This software is provided ``as is'', and comes with no warranties
+ * of any kind. I shall in no event be liable for anything that happens
+ * to anyone/anything when using this software.
+ */
+#define _RAND48_SEED_0 (0x330e)
+#define _RAND48_SEED_1 (0xabcd)
+#define _RAND48_SEED_2 (0x1234)
+#define _RAND48_MULT_0 (0xe66d)
+#define _RAND48_MULT_1 (0xdeec)
+#define _RAND48_MULT_2 (0x0005)
+#define _RAND48_ADD (0x000b)
+struct _rand48 {
+ unsigned short _seed[3];
+ unsigned short _mult[3];
+ unsigned short _add;
+};
+
+/*
* struct _reent
*
* This structure contains *all* globals needed by the library.
@@ -183,7 +210,7 @@ struct _reent
struct tm _localtime_buf;
int _gamma_signgam;
__extension__ unsigned long long _rand_next;
-
+ struct _rand48 _r48;
} _reent;
/* Two next two fields were once used by malloc. They are no longer
used. They are used to preserve the space used before so as to
@@ -213,7 +240,9 @@ struct _reent
#define _REENT_INIT(var) \
{ 0, &var.__sf[0], &var.__sf[1], &var.__sf[2], 0, "", 0, "C", \
0, NULL, NULL, 0, NULL, NULL, 0, NULL, { {0, NULL, "", \
- { 0,0,0,0,0,0,0,0}, 0, 1} } }
+ { 0,0,0,0,0,0,0,0}, 0, 1, \
+ {{_RAND48_SEED_0, _RAND48_SEED_1, _RAND48_SEED_2}, \
+ {_RAND48_MULT_0, _RAND48_MULT_1, _RAND48_MULT_2}, _RAND48_ADD}} } }
/*
* All references to struct _reent are via this pointer.