1
0

stdlib.h 4.8 KB

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