diff options
Diffstat (limited to 'gl/stdlib.in.h')
| -rw-r--r-- | gl/stdlib.in.h | 171 |
1 files changed, 170 insertions, 1 deletions
diff --git a/gl/stdlib.in.h b/gl/stdlib.in.h index 100ff526..3820b109 100644 --- a/gl/stdlib.in.h +++ b/gl/stdlib.in.h | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* A GNU-like <stdlib.h>. | 1 | /* A GNU-like <stdlib.h>. |
| 2 | 2 | ||
| 3 | Copyright (C) 1995, 2001-2004, 2006-2007 Free Software Foundation, Inc. | 3 | Copyright (C) 1995, 2001-2004, 2006-2008 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This program is free software: you can redistribute it and/or modify | 5 | This program is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
| @@ -15,6 +15,10 @@ | |||
| 15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
| 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | 16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
| 17 | 17 | ||
| 18 | #if __GNUC__ >= 3 | ||
| 19 | @PRAGMA_SYSTEM_HEADER@ | ||
| 20 | #endif | ||
| 21 | |||
| 18 | #if defined __need_malloc_and_calloc | 22 | #if defined __need_malloc_and_calloc |
| 19 | /* Special invocation convention inside glibc header files. */ | 23 | /* Special invocation convention inside glibc header files. */ |
| 20 | 24 | ||
| @@ -32,6 +36,28 @@ | |||
| 32 | #define _GL_STDLIB_H | 36 | #define _GL_STDLIB_H |
| 33 | 37 | ||
| 34 | 38 | ||
| 39 | /* Solaris declares getloadavg() in <sys/loadavg.h>. */ | ||
| 40 | #if @GNULIB_GETLOADAVG@ && @HAVE_SYS_LOADAVG_H@ | ||
| 41 | # include <sys/loadavg.h> | ||
| 42 | #endif | ||
| 43 | |||
| 44 | #if @GNULIB_RANDOM_R@ || !@HAVE_STRUCT_RANDOM_DATA@ | ||
| 45 | # include <stdint.h> | ||
| 46 | #endif | ||
| 47 | |||
| 48 | #if !@HAVE_STRUCT_RANDOM_DATA@ | ||
| 49 | struct random_data | ||
| 50 | { | ||
| 51 | int32_t *fptr; /* Front pointer. */ | ||
| 52 | int32_t *rptr; /* Rear pointer. */ | ||
| 53 | int32_t *state; /* Array of state values. */ | ||
| 54 | int rand_type; /* Type of random number generator. */ | ||
| 55 | int rand_deg; /* Degree of random number generator. */ | ||
| 56 | int rand_sep; /* Distance between front and rear. */ | ||
| 57 | int32_t *end_ptr; /* Pointer behind state table. */ | ||
| 58 | }; | ||
| 59 | #endif | ||
| 60 | |||
| 35 | /* The definition of GL_LINK_WARNING is copied here. */ | 61 | /* The definition of GL_LINK_WARNING is copied here. */ |
| 36 | 62 | ||
| 37 | 63 | ||
| @@ -99,6 +125,38 @@ extern void * calloc (size_t nmemb, size_t size); | |||
| 99 | #endif | 125 | #endif |
| 100 | 126 | ||
| 101 | 127 | ||
| 128 | #if @GNULIB_ATOLL@ | ||
| 129 | # if !@HAVE_ATOLL@ | ||
| 130 | /* Parse a signed decimal integer. | ||
| 131 | Returns the value of the integer. Errors are not detected. */ | ||
| 132 | extern long long atoll (const char *string); | ||
| 133 | # endif | ||
| 134 | #elif defined GNULIB_POSIXCHECK | ||
| 135 | # undef atoll | ||
| 136 | # define atoll(s) \ | ||
| 137 | (GL_LINK_WARNING ("atoll is unportable - " \ | ||
| 138 | "use gnulib module atoll for portability"), \ | ||
| 139 | atoll (s)) | ||
| 140 | #endif | ||
| 141 | |||
| 142 | |||
| 143 | #if @GNULIB_GETLOADAVG@ | ||
| 144 | # if !@HAVE_DECL_GETLOADAVG@ | ||
| 145 | /* Store max(NELEM,3) load average numbers in LOADAVG[]. | ||
| 146 | The three numbers are the load average of the last 1 minute, the last 5 | ||
| 147 | minutes, and the last 15 minutes, respectively. | ||
| 148 | LOADAVG is an array of NELEM numbers. */ | ||
| 149 | extern int getloadavg (double loadavg[], int nelem); | ||
| 150 | # endif | ||
| 151 | #elif defined GNULIB_POSIXCHECK | ||
| 152 | # undef getloadavg | ||
| 153 | # define getloadavg(l,n) \ | ||
| 154 | (GL_LINK_WARNING ("getloadavg is not portable - " \ | ||
| 155 | "use gnulib module getloadavg for portability"), \ | ||
| 156 | getloadavg (l, n)) | ||
| 157 | #endif | ||
| 158 | |||
| 159 | |||
| 102 | #if @GNULIB_GETSUBOPT@ | 160 | #if @GNULIB_GETSUBOPT@ |
| 103 | /* Assuming *OPTIONP is a comma separated list of elements of the form | 161 | /* Assuming *OPTIONP is a comma separated list of elements of the form |
| 104 | "token" or "token=value", getsubopt parses the first of these elements. | 162 | "token" or "token=value", getsubopt parses the first of these elements. |
| @@ -176,6 +234,58 @@ extern int putenv (char *string); | |||
| 176 | #endif | 234 | #endif |
| 177 | 235 | ||
| 178 | 236 | ||
| 237 | #if @GNULIB_RANDOM_R@ | ||
| 238 | # if !@HAVE_RANDOM_R@ | ||
| 239 | |||
| 240 | # ifndef RAND_MAX | ||
| 241 | # define RAND_MAX 2147483647 | ||
| 242 | # endif | ||
| 243 | |||
| 244 | int srandom_r (unsigned int seed, struct random_data *rand_state); | ||
| 245 | int initstate_r (unsigned int seed, char *buf, size_t buf_size, | ||
| 246 | struct random_data *rand_state); | ||
| 247 | int setstate_r (char *arg_state, struct random_data *rand_state); | ||
| 248 | int random_r (struct random_data *buf, int32_t *result); | ||
| 249 | # endif | ||
| 250 | #elif defined GNULIB_POSIXCHECK | ||
| 251 | # undef random_r | ||
| 252 | # define random_r(b,r) \ | ||
| 253 | (GL_LINK_WARNING ("random_r is unportable - " \ | ||
| 254 | "use gnulib module random_r for portability"), \ | ||
| 255 | random_r (b,r)) | ||
| 256 | # undef initstate_r | ||
| 257 | # define initstate_r(s,b,sz,r) \ | ||
| 258 | (GL_LINK_WARNING ("initstate_r is unportable - " \ | ||
| 259 | "use gnulib module random_r for portability"), \ | ||
| 260 | initstate_r (s,b,sz,r)) | ||
| 261 | # undef srandom_r | ||
| 262 | # define srandom_r(s,r) \ | ||
| 263 | (GL_LINK_WARNING ("srandom_r is unportable - " \ | ||
| 264 | "use gnulib module random_r for portability"), \ | ||
| 265 | srandom_r (s,r)) | ||
| 266 | # undef setstate_r | ||
| 267 | # define setstate_r(a,r) \ | ||
| 268 | (GL_LINK_WARNING ("setstate_r is unportable - " \ | ||
| 269 | "use gnulib module random_r for portability"), \ | ||
| 270 | setstate_r (a,r)) | ||
| 271 | #endif | ||
| 272 | |||
| 273 | |||
| 274 | #if @GNULIB_RPMATCH@ | ||
| 275 | # if !@HAVE_RPMATCH@ | ||
| 276 | /* Test a user response to a question. | ||
| 277 | Return 1 if it is affirmative, 0 if it is negative, or -1 if not clear. */ | ||
| 278 | extern int rpmatch (const char *response); | ||
| 279 | # endif | ||
| 280 | #elif defined GNULIB_POSIXCHECK | ||
| 281 | # undef rpmatch | ||
| 282 | # define rpmatch(r) \ | ||
| 283 | (GL_LINK_WARNING ("rpmatch is unportable - " \ | ||
| 284 | "use gnulib module rpmatch for portability"), \ | ||
| 285 | rpmatch (r)) | ||
| 286 | #endif | ||
| 287 | |||
| 288 | |||
| 179 | #if @GNULIB_SETENV@ | 289 | #if @GNULIB_SETENV@ |
| 180 | # if !@HAVE_SETENV@ | 290 | # if !@HAVE_SETENV@ |
| 181 | /* Set NAME to VALUE in the environment. | 291 | /* Set NAME to VALUE in the environment. |
| @@ -199,6 +309,65 @@ extern int unsetenv (const char *name); | |||
| 199 | #endif | 309 | #endif |
| 200 | 310 | ||
| 201 | 311 | ||
| 312 | #if @GNULIB_STRTOD@ | ||
| 313 | # if @REPLACE_STRTOD@ | ||
| 314 | # define strtod rpl_strtod | ||
| 315 | # endif | ||
| 316 | # if !@HAVE_STRTOD@ || @REPLACE_STRTOD@ | ||
| 317 | /* Parse a double from STRING, updating ENDP if appropriate. */ | ||
| 318 | extern double strtod (const char *str, char **endp); | ||
| 319 | # endif | ||
| 320 | #elif defined GNULIB_POSIXCHECK | ||
| 321 | # undef strtod | ||
| 322 | # define strtod(s, e) \ | ||
| 323 | (GL_LINK_WARNING ("strtod is unportable - " \ | ||
| 324 | "use gnulib module strtod for portability"), \ | ||
| 325 | strtod (s, e)) | ||
| 326 | #endif | ||
| 327 | |||
| 328 | |||
| 329 | #if @GNULIB_STRTOLL@ | ||
| 330 | # if !@HAVE_STRTOLL@ | ||
| 331 | /* Parse a signed integer whose textual representation starts at STRING. | ||
| 332 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, | ||
| 333 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix | ||
| 334 | "0x"). | ||
| 335 | If ENDPTR is not NULL, the address of the first byte after the integer is | ||
| 336 | stored in *ENDPTR. | ||
| 337 | Upon overflow, the return value is LLONG_MAX or LLONG_MIN, and errno is set | ||
| 338 | to ERANGE. */ | ||
| 339 | extern long long strtoll (const char *string, char **endptr, int base); | ||
| 340 | # endif | ||
| 341 | #elif defined GNULIB_POSIXCHECK | ||
| 342 | # undef strtoll | ||
| 343 | # define strtoll(s,e,b) \ | ||
| 344 | (GL_LINK_WARNING ("strtoll is unportable - " \ | ||
| 345 | "use gnulib module strtoll for portability"), \ | ||
| 346 | strtoll (s, e, b)) | ||
| 347 | #endif | ||
| 348 | |||
| 349 | |||
| 350 | #if @GNULIB_STRTOULL@ | ||
| 351 | # if !@HAVE_STRTOULL@ | ||
| 352 | /* Parse an unsigned integer whose textual representation starts at STRING. | ||
| 353 | The integer is expected to be in base BASE (2 <= BASE <= 36); if BASE == 0, | ||
| 354 | it may be decimal or octal (with prefix "0") or hexadecimal (with prefix | ||
| 355 | "0x"). | ||
| 356 | If ENDPTR is not NULL, the address of the first byte after the integer is | ||
| 357 | stored in *ENDPTR. | ||
| 358 | Upon overflow, the return value is ULLONG_MAX, and errno is set to | ||
| 359 | ERANGE. */ | ||
| 360 | extern unsigned long long strtoull (const char *string, char **endptr, int base); | ||
| 361 | # endif | ||
| 362 | #elif defined GNULIB_POSIXCHECK | ||
| 363 | # undef strtoull | ||
| 364 | # define strtoull(s,e,b) \ | ||
| 365 | (GL_LINK_WARNING ("strtoull is unportable - " \ | ||
| 366 | "use gnulib module strtoull for portability"), \ | ||
| 367 | strtoull (s, e, b)) | ||
| 368 | #endif | ||
| 369 | |||
| 370 | |||
| 202 | #ifdef __cplusplus | 371 | #ifdef __cplusplus |
| 203 | } | 372 | } |
| 204 | #endif | 373 | #endif |
