summaryrefslogtreecommitdiffstats
path: root/newlib/libc/include
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/include')
-rw-r--r--newlib/libc/include/stdlib.h21
-rw-r--r--newlib/libc/include/sys/reent.h33
2 files changed, 52 insertions, 2 deletions
diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h
index 46cb2e970..b05510847 100644
--- a/newlib/libc/include/stdlib.h
+++ b/newlib/libc/include/stdlib.h
@@ -114,6 +114,27 @@ char * _EXFUN(ecvtf,(float,int,int *,int *));
char * _EXFUN(dtoa,(double, int, int, int *, int*, char**));
int _EXFUN(rand_r,(unsigned *__seed));
+double _EXFUN(drand48,(_VOID));
+double _EXFUN(_drand48_r,(struct _reent *));
+double _EXFUN(erand48,(unsigned short [3]));
+double _EXFUN(_erand48_r,(struct _reent *, unsigned short [3]));
+long _EXFUN(jrand48,(unsigned short [3]));
+long _EXFUN(_jrand48_r,(struct _reent *, unsigned short [3]));
+_VOID _EXFUN(lcong48,(unsigned short [7]));
+_VOID _EXFUN(_lcong48_r,(struct _reent *, unsigned short [7]));
+long _EXFUN(lrand48,(_VOID));
+long _EXFUN(_lrand48_r,(struct _reent *));
+long _EXFUN(mrand48,(_VOID));
+long _EXFUN(_mrand48_r,(struct _reent *));
+long _EXFUN(nrand48,(unsigned short [3]));
+long _EXFUN(_nrand48_r,(struct _reent *, unsigned short [3]));
+unsigned short *
+ _EXFUN(seed48,(unsigned short [3]));
+unsigned short *
+ _EXFUN(_seed48_r,(struct _reent *, unsigned short [3]));
+_VOID _EXFUN(srand48,(long));
+_VOID _EXFUN(_srand48_r,(struct _reent *, long));
+
#ifndef __CYGWIN__
_VOID _EXFUN(cfree,(_PTR));
#else
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.