X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fstdlib.in.h;h=f6ebe253c8775b8b5bd4fee65dfd2e09f103ffb1;hb=b314ca18dc36e59297f66b2508fd58535a1cd724;hp=cf8cf778297fad72cfd419a0c860c11e92c98bc3;hpb=6688506d40c960504c892d8f394beaafc01cf007;p=gnulib.git diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index cf8cf7782..f6ebe253c 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -41,6 +41,23 @@ # include #endif +#if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@ +# include +#endif + +#if !@HAVE_STRUCT_RANDOM_DATA@ +struct random_data +{ + int32_t *fptr; /* Front pointer. */ + int32_t *rptr; /* Rear pointer. */ + int32_t *state; /* Array of state values. */ + int rand_type; /* Type of random number generator. */ + int rand_deg; /* Degree of random number generator. */ + int rand_sep; /* Distance between front and rear. */ + int32_t *end_ptr; /* Pointer behind state table. */ +}; +#endif + /* The definition of GL_LINK_WARNING is copied here. */ @@ -108,6 +125,21 @@ extern void * calloc (size_t nmemb, size_t size); #endif +#if @GNULIB_ATOLL@ +# if !@HAVE_ATOLL@ +/* Parse a signed decimal integer. + Returns the value of the integer. Errors are not detected. */ +extern long long atoll (const char *string); +# endif +#elif defined GNULIB_POSIXCHECK +# undef atoll +# define atoll(s) \ + (GL_LINK_WARNING ("atoll is unportable - " \ + "use gnulib module atoll for portability"), \ + atoll (s)) +#endif + + #if @GNULIB_GETLOADAVG@ # if !@HAVE_DECL_GETLOADAVG@ /* Store max(NELEM,3) load average numbers in LOADAVG[]. @@ -202,6 +234,43 @@ extern int putenv (char *string); #endif +#if @GNULIB_RANDOM_R@ +# if !@HAVE_RANDOM_R@ + +# ifndef RAND_MAX +# define RAND_MAX 2147483647 +# endif + +int srandom_r (unsigned int seed, struct random_data *rand_state); +int initstate_r (unsigned int seed, char *buf, size_t buf_size, + struct random_data *rand_state); +int setstate_r (char *arg_state, struct random_data *rand_state); +int random_r (struct random_data *buf, int32_t *result); +# endif +#elif defined GNULIB_POSIXCHECK +# undef random_r +# define random_r(b,r) \ + (GL_LINK_WARNING ("random_r is unportable - " \ + "use gnulib module random_r for portability"), \ + random_r (b,r)) +# undef initstate_r +# define initstate_r(s,b,sz,r) \ + (GL_LINK_WARNING ("initstate_r is unportable - " \ + "use gnulib module random_r for portability"), \ + initstate_r (s,b,sz,r)) +# undef srandom_r +# define srandom_r(s,r) \ + (GL_LINK_WARNING ("srandom_r is unportable - " \ + "use gnulib module random_r for portability"), \ + srandom_r (s,r)) +# undef setstate_r +# define setstate_r(a,r) \ + (GL_LINK_WARNING ("setstate_r is unportable - " \ + "use gnulib module random_r for portability"), \ + setstate_r (a,r)) +#endif + + #if @GNULIB_RPMATCH@ # if !@HAVE_RPMATCH@ /* Test a user response to a question. @@ -265,8 +334,8 @@ extern double strtod (const char *str, char **endp); "0x"). If ENDPTR is not NULL, the address of the first byte after the integer is stored in *ENDPTR. - Upon overflow or underflow, the return value is LLONG_MAX or LLONG_MIN, - respectively, and errno is set to ERANGE. */ + Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set + to ERANGE. */ extern long long strtoll (const char *string, char **endptr, int base); # endif #elif defined GNULIB_POSIXCHECK @@ -278,6 +347,27 @@ extern long long strtoll (const char *string, char **endptr, int base); #endif +#if @GNULIB_STRTOULL@ +# if !@HAVE_STRTOULL@ +/* Parse an unsigned integer whose textual representation starts at STRING. + The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, + it may be decimal or octal (with prefix "0") or hexadecimal (with prefix + "0x"). + If ENDPTR is not NULL, the address of the first byte after the integer is + stored in *ENDPTR. + Upon overflow, the return value is ULLONG_MAX, and errno is set to + ERANGE. */ +extern unsigned long long strtoull (const char *string, char **endptr, int base); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strtoull +# define strtoull(s,e,b) \ + (GL_LINK_WARNING ("strtoull is unportable - " \ + "use gnulib module strtoull for portability"), \ + strtoull (s, e, b)) +#endif + + #ifdef __cplusplus } #endif