1997-04-21 16:45  Ulrich Drepper  <drepper@cygnus.com>

	* stdlib/drand48.c: Cleanup namespace.
	* stdlib/drand48_r.c: Cleanup namespace.
	* stdlib/erand48.c: Cleanup namespace.
	* stdlib/erand48_r.c: Cleanup namespace.
	* stdlib/jrand48.c: Cleanup namespace.
	* stdlib/jrand48_r.c: Cleanup namespace.
	* stdlib/lrand48.c: Cleanup namespace.
	* stdlib/lrand48_r.c: Cleanup namespace.
	* stdlib/mrand48.c: Cleanup namespace.
	* stdlib/mrand48_r.c: Cleanup namespace.
	* stdlib/nrand48.c: Cleanup namespace.
	* stdlib/nrand48_r.c: Cleanup namespace.
	* stdlib/lcong48.c: Cleanup namespace.
	* stdlib/lcong48_r.c: Cleanup namespace.
	* stdlib/srand48.c: Cleanup namespace.
	* stdlib/srand48_r.c: Cleanup namespace.
	* stdlib/seed48.c: Cleanup namespace.
	* stdlib/seed48_r.c: Cleanup namespace.

	* stdlib/stdlib.h: Provide new prototypes.
This commit is contained in:
Ulrich Drepper 1997-04-21 14:50:33 +00:00
parent b4012b7542
commit 47f13fd4ba
20 changed files with 84 additions and 29 deletions

View File

@ -1,3 +1,26 @@
1997-04-21 16:45 Ulrich Drepper <drepper@cygnus.com>
* stdlib/drand48.c: Cleanup namespace.
* stdlib/drand48_r.c: Cleanup namespace.
* stdlib/erand48.c: Cleanup namespace.
* stdlib/erand48_r.c: Cleanup namespace.
* stdlib/jrand48.c: Cleanup namespace.
* stdlib/jrand48_r.c: Cleanup namespace.
* stdlib/lrand48.c: Cleanup namespace.
* stdlib/lrand48_r.c: Cleanup namespace.
* stdlib/mrand48.c: Cleanup namespace.
* stdlib/mrand48_r.c: Cleanup namespace.
* stdlib/nrand48.c: Cleanup namespace.
* stdlib/nrand48_r.c: Cleanup namespace.
* stdlib/lcong48.c: Cleanup namespace.
* stdlib/lcong48_r.c: Cleanup namespace.
* stdlib/srand48.c: Cleanup namespace.
* stdlib/srand48_r.c: Cleanup namespace.
* stdlib/seed48.c: Cleanup namespace.
* stdlib/seed48_r.c: Cleanup namespace.
* stdlib/stdlib.h: Provide new prototypes.
1997-04-21 13:25 Ulrich Drepper <drepper@cygnus.com>
* manual/arith.texi: Add description for INFINITY, _Imaginary_I,

View File

@ -27,7 +27,7 @@ drand48 ()
{
double result;
(void) erand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
(void) __erand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
return result;
}

View File

@ -26,5 +26,5 @@ drand48_r (buffer, result)
struct drand48_data *buffer;
double *result;
{
return erand48_r (buffer->X, buffer, result);
return __erand48_r (buffer->X, buffer, result);
}

View File

@ -28,7 +28,7 @@ erand48 (xsubi)
{
double result;
(void) erand48_r (xsubi, &__libc_drand48_data, &result);
(void) __erand48_r (xsubi, &__libc_drand48_data, &result);
return result;
}

View File

@ -23,7 +23,7 @@
int
erand48_r (xsubi, buffer, result)
__erand48_r (xsubi, buffer, result)
unsigned short int xsubi[3];
struct drand48_data *buffer;
double *result;
@ -50,3 +50,4 @@ erand48_r (xsubi, buffer, result)
return 0;
}
weak_alias (__erand48_r, erand48_r)

View File

@ -22,13 +22,13 @@
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data;
long
long int
jrand48 (xsubi)
unsigned short int xsubi[3];
{
long result;
long int result;
(void) jrand48_r (xsubi, &__libc_drand48_data, &result);
(void) __jrand48_r (xsubi, &__libc_drand48_data, &result);
return result;
}

View File

@ -20,10 +20,10 @@
#include <stdlib.h>
int
jrand48_r (xsubi, buffer, result)
__jrand48_r (xsubi, buffer, result)
unsigned short int xsubi[3];
struct drand48_data *buffer;
long *result;
long int *result;
{
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
@ -40,3 +40,4 @@ jrand48_r (xsubi, buffer, result)
return 0;
}
weak_alias (__jrand48_r, jrand48_r)

View File

@ -26,5 +26,5 @@ void
lcong48 (param)
unsigned short int param[7];
{
(void) lcong48_r (param, &__libc_drand48_data);
(void) __lcong48_r (param, &__libc_drand48_data);
}

View File

@ -21,15 +21,26 @@
#include <string.h>
int
lcong48_r (param, buffer)
__lcong48_r (param, buffer)
unsigned short int param[7];
struct drand48_data *buffer;
{
/* Store the given values. */
#if USHRT_MAX == 0xffffU
memcpy (buffer->X, &param[0], sizeof (buffer->X));
memcpy (buffer->a, &param[3], sizeof (buffer->a));
#else
buffer->X[2] = (param[2] << 16) | param[1];
buffer->X[1] = param[0] << 16;
buffer->X[0] = 0;
buffer->a[2] = (param[5] << 16) | param[4];
buffer->a[1] = param[3] << 16;
buffer->a[0] = 0;
#endif
buffer->c = param[6];
buffer->init = 1;
return 0;
}
weak_alias (__lcong48_r, lcong48_r)

View File

@ -22,12 +22,12 @@
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data;
long
long int
lrand48 ()
{
long result;
long int result;
(void) nrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
(void) __nrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
return result;
}

View File

@ -22,7 +22,7 @@
int
lrand48_r (buffer, result)
struct drand48_data *buffer;
long *result;
long int *result;
{
/* Be generous for the arguments, detect some errors. */
if (buffer == NULL)

View File

@ -22,12 +22,12 @@
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data;
long
long int
mrand48 ()
{
long result;
long int result;
(void) jrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
(void) __jrand48_r (__libc_drand48_data.X, &__libc_drand48_data, &result);
return result;
}

View File

@ -22,7 +22,7 @@
int
mrand48_r (buffer, result)
struct drand48_data *buffer;
long *result;
long int *result;
{
/* Be generous for the arguments, detect some errors. */
if (buffer == NULL)

View File

@ -22,13 +22,13 @@
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data;
long
long int
nrand48 (xsubi)
unsigned short int xsubi[3];
{
long result;
long int result;
(void) nrand48_r (xsubi, &__libc_drand48_data, &result);
(void) __nrand48_r (xsubi, &__libc_drand48_data, &result);
return result;
}

View File

@ -20,10 +20,10 @@
#include <stdlib.h>
int
nrand48_r (xsubi, buffer, result)
__nrand48_r (xsubi, buffer, result)
unsigned short int xsubi[3];
struct drand48_data *buffer;
long *result;
long int *result;
{
/* Compute next state. */
if (__drand48_iterate (xsubi, buffer) < 0)
@ -37,3 +37,4 @@ nrand48_r (xsubi, buffer, result)
return 0;
}
weak_alias (__nrand48_r, nrand48_r)

View File

@ -26,7 +26,7 @@ unsigned short int *
seed48 (seed16v)
unsigned short int seed16v[3];
{
(void) seed48_r (seed16v, &__libc_drand48_data);
(void) __seed48_r (seed16v, &__libc_drand48_data);
return __libc_drand48_data.old_X;
}

View File

@ -21,7 +21,7 @@
#include <string.h>
int
seed48_r (seed16v, buffer)
__seed48_r (seed16v, buffer)
unsigned short int seed16v[3];
struct drand48_data *buffer;
{
@ -51,3 +51,4 @@ seed48_r (seed16v, buffer)
return 0;
}
weak_alias (__seed48_r, seed48_r)

View File

@ -26,5 +26,5 @@ void
srand48 (seedval)
long seedval;
{
(void) srand48_r (seedval, &__libc_drand48_data);
(void) __srand48_r (seedval, &__libc_drand48_data);
}

View File

@ -21,7 +21,7 @@
#include <limits.h>
int
srand48_r (seedval, buffer)
__srand48_r (seedval, buffer)
long int seedval;
struct drand48_data *buffer;
{
@ -51,3 +51,4 @@ srand48_r (seedval, buffer)
return 0;
}
weak_alias (__srand48_r, srand48_r)

View File

@ -211,7 +211,7 @@ extern __inline int atoi (__const char *__nptr)
extern __inline long int atol (__const char *__nptr)
{ return strtol (__nptr, (char **) NULL, 10); }
#if defined __USE_ISOC9X && (defined __GNUC__ || defined __USE_MISC)
#if defined __USE_MISC || defined __USE_ISOC9X
extern __inline long long int atoll (__const char *__nptr)
{ return strtoll (__nptr, (char **) NULL, 10); }
#endif
@ -335,23 +335,39 @@ struct drand48_data
#ifdef __USE_MISC
/* Return non-negative, double-precision floating-point value in [0.0,1.0). */
extern int drand48_r __P ((struct drand48_data *__buffer, double *__result));
extern int __erand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer, double *__result));
extern int erand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer, double *__result));
/* Return non-negative, long integer in [0,2^31). */
extern int lrand48_r __P ((struct drand48_data *__buffer, long int *__result));
extern int __nrand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer,
long int *__result));
extern int nrand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer, long int *__result));
/* Return signed, long integers in [-2^31,2^31). */
extern int mrand48_r __P ((struct drand48_data *__buffer, long int *__result));
extern int __jrand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer,
long int *__result));
extern int jrand48_r __P ((unsigned short int __xsubi[3],
struct drand48_data *__buffer, long int *__result));
/* Seed random number generator. */
extern int __srand48_r __P ((long int __seedval,
struct drand48_data *__buffer));
extern int srand48_r __P ((long int __seedval, struct drand48_data *__buffer));
extern int __seed48_r __P ((unsigned short int __seed16v[3],
struct drand48_data *__buffer));
extern int seed48_r __P ((unsigned short int __seed16v[3],
struct drand48_data *__buffer));
extern int __lcong48_r __P ((unsigned short int __param[7],
struct drand48_data *__buffer));
extern int lcong48_r __P ((unsigned short int __param[7],
struct drand48_data *__buffer));
#endif /* Use misc. */