Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 1 | // -*- C++ -*- |
| 2 | //===--------------------------- cstdlib ----------------------------------===// |
| 3 | // |
Howard Hinnant | f5256e1 | 2010-05-11 21:36:01 +0000 | [diff] [blame] | 4 | // The LLVM Compiler Infrastructure |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 5 | // |
| 6 | // This file is distributed under the University of Illinois Open Source |
| 7 | // License. See LICENSE.TXT for details. |
| 8 | // |
| 9 | //===----------------------------------------------------------------------===// |
| 10 | |
| 11 | #ifndef _LIBCPP_CSTDLIB |
| 12 | #define _LIBCPP_CSTDLIB |
| 13 | |
| 14 | /* |
| 15 | cstdlib synopsis |
| 16 | |
| 17 | Macros: |
| 18 | |
| 19 | EXIT_FAILURE |
| 20 | EXIT_SUCCESS |
| 21 | MB_CUR_MAX |
| 22 | NULL |
| 23 | RAND_MAX |
Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 24 | |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 25 | namespace std |
| 26 | { |
| 27 | |
| 28 | Types: |
| 29 | |
| 30 | size_t |
| 31 | div_t |
| 32 | ldiv_t |
| 33 | lldiv_t // C99 |
| 34 | |
| 35 | double atof (const char* nptr); |
| 36 | int atoi (const char* nptr); |
| 37 | long atol (const char* nptr); |
| 38 | long long atoll(const char* nptr); // C99 |
| 39 | double strtod (const char* restrict nptr, char** restrict endptr); |
| 40 | float strtof (const char* restrict nptr, char** restrict endptr); // C99 |
| 41 | long double strtold (const char* restrict nptr, char** restrict endptr); // C99 |
| 42 | long strtol (const char* restrict nptr, char** restrict endptr, int base); |
| 43 | long long strtoll (const char* restrict nptr, char** restrict endptr, int base); // C99 |
| 44 | unsigned long strtoul (const char* restrict nptr, char** restrict endptr, int base); |
| 45 | unsigned long long strtoull(const char* restrict nptr, char** restrict endptr, int base); // C99 |
| 46 | int rand(void); |
| 47 | void srand(unsigned int seed); |
| 48 | void* calloc(size_t nmemb, size_t size); |
| 49 | void free(void* ptr); |
| 50 | void* malloc(size_t size); |
| 51 | void* realloc(void* ptr, size_t size); |
| 52 | void abort(void); |
| 53 | int atexit(void (*func)(void)); |
| 54 | void exit(int status); |
| 55 | void _Exit(int status); |
| 56 | char* getenv(const char* name); |
| 57 | int system(const char* string); |
| 58 | void* bsearch(const void* key, const void* base, size_t nmemb, size_t size, |
| 59 | int (*compar)(const void *, const void *)); |
| 60 | void qsort(void* base, size_t nmemb, size_t size, |
| 61 | int (*compar)(const void *, const void *)); |
| 62 | int abs( int j); |
| 63 | long abs( long j); |
| 64 | long long abs(long long j); // C++0X |
| 65 | long labs( long j); |
| 66 | long long llabs(long long j); // C99 |
| 67 | div_t div( int numer, int denom); |
| 68 | ldiv_t div( long numer, long denom); |
Howard Hinnant | 324bb03 | 2010-08-22 00:02:43 +0000 | [diff] [blame^] | 69 | lldiv_t div(long long numer, long long denom); // C++0X |
Howard Hinnant | bc8d3f9 | 2010-05-11 19:42:16 +0000 | [diff] [blame] | 70 | ldiv_t ldiv( long numer, long denom); |
| 71 | lldiv_t lldiv(long long numer, long long denom); // C99 |
| 72 | int mblen(const char* s, size_t n); |
| 73 | int mbtowc(wchar_t* restrict pwc, const char* restrict s, size_t n); |
| 74 | int wctomb(char* s, wchar_t wchar); |
| 75 | size_t mbstowcs(wchar_t* restrict pwcs, const char* restrict s, size_t n); |
| 76 | size_t wcstombs(char* restrict s, const wchar_t* restrict pwcs, size_t n); |
| 77 | |
| 78 | } // std |
| 79 | |
| 80 | */ |
| 81 | |
| 82 | #include <__config> |
| 83 | #include <stdlib.h> |
| 84 | |
| 85 | #pragma GCC system_header |
| 86 | |
| 87 | _LIBCPP_BEGIN_NAMESPACE_STD |
| 88 | |
| 89 | using ::size_t; |
| 90 | using ::div_t; |
| 91 | using ::ldiv_t; |
| 92 | using ::lldiv_t; |
| 93 | using ::atof; |
| 94 | using ::atoi; |
| 95 | using ::atol; |
| 96 | using ::atoll; |
| 97 | using ::strtod; |
| 98 | using ::strtof; |
| 99 | using ::strtold; |
| 100 | using ::strtol; |
| 101 | using ::strtoll; |
| 102 | using ::strtoul; |
| 103 | using ::strtoull; |
| 104 | using ::rand; |
| 105 | using ::srand; |
| 106 | using ::calloc; |
| 107 | using ::free; |
| 108 | using ::malloc; |
| 109 | using ::realloc; |
| 110 | using ::abort; |
| 111 | using ::atexit; |
| 112 | using ::exit; |
| 113 | using ::_Exit; |
| 114 | using ::getenv; |
| 115 | using ::system; |
| 116 | using ::bsearch; |
| 117 | using ::qsort; |
| 118 | using ::abs; |
| 119 | using ::labs; |
| 120 | using ::llabs; |
| 121 | using ::div; |
| 122 | using ::ldiv; |
| 123 | using ::lldiv; |
| 124 | using ::mblen; |
| 125 | using ::mbtowc; |
| 126 | using ::wctomb; |
| 127 | using ::mbstowcs; |
| 128 | using ::wcstombs; |
| 129 | |
| 130 | inline _LIBCPP_INLINE_VISIBILITY long abs( long __x) {return labs(__x);} |
| 131 | inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);} |
| 132 | |
| 133 | inline _LIBCPP_INLINE_VISIBILITY ldiv_t div( long __x, long __y) {return ldiv(__x, __y);} |
| 134 | inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);} |
| 135 | |
| 136 | _LIBCPP_END_NAMESPACE_STD |
| 137 | |
| 138 | #endif // _LIBCPP_CSTDLIB |