]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/libc++/include/cstdlib
MFV: tcpdump 4.3.0.
[FreeBSD/FreeBSD.git] / contrib / libc++ / include / cstdlib
1 // -*- C++ -*-
2 //===--------------------------- cstdlib ----------------------------------===//
3 //
4 //                     The LLVM Compiler Infrastructure
5 //
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. 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
24
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);
69 lldiv_t   div(long long numer, long long denom);                          // C++0X
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 #ifdef _MSC_VER
85 #include "support/win32/locale_win32.h"
86 #endif // _MSC_VER
87
88 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
89 #pragma GCC system_header
90 #endif
91
92 _LIBCPP_BEGIN_NAMESPACE_STD
93
94 using ::size_t;
95 using ::div_t;
96 using ::ldiv_t;
97 using ::lldiv_t;
98 using ::atof;
99 using ::atoi;
100 using ::atol;
101 using ::atoll;
102 using ::strtod;
103 using ::strtof;
104 using ::strtold;
105 using ::strtol;
106 using ::strtoll;
107 using ::strtoul;
108 using ::strtoull;
109 using ::rand;
110 using ::srand;
111 using ::calloc;
112 using ::free;
113 using ::malloc;
114 using ::realloc;
115 using ::abort;
116 using ::atexit;
117 using ::exit;
118 using ::_Exit;
119 using ::getenv;
120 using ::system;
121 using ::bsearch;
122 using ::qsort;
123 using ::abs;
124 using ::labs;
125 using ::llabs;
126 using ::div;
127 using ::ldiv;
128 using ::lldiv;
129 using ::mblen;
130 using ::mbtowc;
131 using ::wctomb;
132 using ::mbstowcs;
133 using ::wcstombs;
134 #ifdef _LIBCPP_HAS_QUICK_EXIT
135 using ::at_quick_exit;
136 using ::quick_exit;
137 #endif
138
139 // MSVC already has the correct prototype in <stdlib.h.h> #ifdef __cplusplus
140 #if !defined(_MSC_VER) && !defined(__sun__)
141 inline _LIBCPP_INLINE_VISIBILITY long      abs(     long __x) {return  labs(__x);}
142 inline _LIBCPP_INLINE_VISIBILITY long long abs(long long __x) {return llabs(__x);}
143
144 inline _LIBCPP_INLINE_VISIBILITY  ldiv_t div(     long __x,      long __y) {return  ldiv(__x, __y);}
145 inline _LIBCPP_INLINE_VISIBILITY lldiv_t div(long long __x, long long __y) {return lldiv(__x, __y);}
146 #endif // _MSC_VER
147
148 _LIBCPP_END_NAMESPACE_STD
149
150 #endif  // _LIBCPP_CSTDLIB