stdlib.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. #ifndef _STDLIB_H
  2. #define _STDLIB_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #undef NULL
  7. #ifdef __cplusplus
  8. #define NULL 0
  9. #else
  10. #define NULL ((void*)0)
  11. #endif
  12. #define __NEED_size_t
  13. #define __NEED_wchar_t
  14. #include <bits/alltypes.h>
  15. int atoi (const char *);
  16. long atol (const char *);
  17. long long atoll (const char *);
  18. double atof (const char *);
  19. float strtof (const char *, char **);
  20. double strtod (const char *, char **);
  21. long double strtold (const char *, char **);
  22. long strtol (const char *, char **, int);
  23. unsigned long strtoul (const char *, char **, int);
  24. long long strtoll (const char *, char **, int);
  25. unsigned long long strtoull (const char *, char **, int);
  26. int rand (void);
  27. void srand (unsigned);
  28. void *malloc (size_t);
  29. void *calloc (size_t, size_t);
  30. void *realloc (void *, size_t);
  31. void free (void *);
  32. void abort (void);
  33. int atexit (void (*) (void));
  34. void exit (int);
  35. void _Exit (int);
  36. char *getenv (const char *);
  37. int system (const char *);
  38. void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
  39. void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
  40. int abs (int);
  41. long labs (long);
  42. long long llabs (long long);
  43. typedef struct { int quot, rem; } div_t;
  44. typedef struct { long quot, rem; } ldiv_t;
  45. typedef struct { long long quot, rem; } lldiv_t;
  46. div_t div (int, int);
  47. ldiv_t ldiv (long, long);
  48. lldiv_t lldiv (long long, long long);
  49. int mblen (const char *, size_t);
  50. int mbtowc (wchar_t *, const char *, size_t);
  51. int wctomb (char *, wchar_t);
  52. size_t mbstowcs (wchar_t *, const char *, size_t);
  53. size_t wcstombs (char *, const wchar_t *, size_t);
  54. #define EXIT_FAILURE 1
  55. #define EXIT_SUCCESS 0
  56. #define MB_CUR_MAX ((size_t)+4)
  57. #define RAND_MAX (0x7fffffff)
  58. #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
  59. || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  60. || defined(_BSD_SOURCE)
  61. #ifndef WEXITSTATUS
  62. #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
  63. #define WTERMSIG(s) ((s) & 0x7f)
  64. #define WSTOPSIG(s) WEXITSTATUS(s)
  65. #define WCOREDUMP(s) ((s) & 0x80)
  66. #define WIFEXITED(s) (!WTERMSIG(s))
  67. #define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
  68. #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
  69. #define WIFCONTINUED(s) ((s) == 0xffff)
  70. #endif
  71. int posix_memalign (void **, size_t, size_t);
  72. int setenv (const char *, const char *, int);
  73. int unsetenv (const char *);
  74. int mkstemp (char *);
  75. char *mkdtemp (char *);
  76. int getsubopt (char **, char *const *, char **);
  77. int rand_r (unsigned *);
  78. #endif
  79. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
  80. || defined(_BSD_SOURCE)
  81. char *realpath (const char *, char *);
  82. long int random (void);
  83. void srandom (unsigned int);
  84. char *initstate (unsigned int, char *, size_t);
  85. char *setstate (char *);
  86. #endif
  87. #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
  88. int putenv (char *);
  89. int posix_openpt (int);
  90. int grantpt (int);
  91. int unlockpt (int);
  92. char *ptsname (int);
  93. char *l64a (long);
  94. long a64l (const char *);
  95. void setkey (const char *);
  96. double drand48 (void);
  97. double erand48 (unsigned short [3]);
  98. long int lrand48 (void);
  99. long int nrand48 (unsigned short [3]);
  100. long mrand48 (void);
  101. long jrand48 (unsigned short [3]);
  102. void srand48 (long);
  103. unsigned short *seed48 (unsigned short [3]);
  104. void lcong48 (unsigned short [7]);
  105. #endif
  106. #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
  107. #include <alloca.h>
  108. char *mktemp (char *);
  109. void *valloc (size_t);
  110. void *memalign(size_t, size_t);
  111. #endif
  112. #ifdef _GNU_SOURCE
  113. int clearenv(void);
  114. int ptsname_r(int, char *, size_t);
  115. char *ecvt(double, int, int *, int *);
  116. char *fcvt(double, int, int *, int *);
  117. char *gcvt(double, int, char *);
  118. #endif
  119. #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
  120. #define mkstemp64 mkstemp
  121. #endif
  122. #ifdef __cplusplus
  123. }
  124. #endif
  125. #endif