]>
Commit | Line | Data |
---|---|---|
98e6e789 | 1 | // -*- C++ -*- forwarding header. |
22aef514 | 2 | |
34ff0b99 BK |
3 | // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 |
4 | // Free Software Foundation, Inc. | |
22aef514 BK |
5 | // |
6 | // This file is part of the GNU ISO C++ Library. This library is free | |
7 | // software; you can redistribute it and/or modify it under the | |
8 | // terms of the GNU General Public License as published by the | |
9 | // Free Software Foundation; either version 2, or (at your option) | |
10 | // any later version. | |
11 | ||
12 | // This library is distributed in the hope that it will be useful, | |
13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | // GNU General Public License for more details. | |
16 | ||
17 | // You should have received a copy of the GNU General Public License along | |
18 | // with this library; see the file COPYING. If not, write to the Free | |
19 | // Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
20 | // USA. | |
21 | ||
22 | // As a special exception, you may use this file as part of a free software | |
23 | // library without restriction. Specifically, if other files instantiate | |
24 | // templates or use macros or inline functions from this file, or you compile | |
25 | // this file and link it with other files to produce an executable, this | |
26 | // file does not by itself cause the resulting executable to be covered by | |
27 | // the GNU General Public License. This exception does not however | |
28 | // invalidate any other reasons why the executable file might be covered by | |
29 | // the GNU General Public License. | |
30 | ||
31 | // | |
32 | // ISO C++ 14882: 20.4.6 C library | |
33 | // | |
34 | ||
ffe94f83 PE |
35 | /** @file cstdlib |
36 | * This is a Standard C++ Library file. You should @c #include this file | |
37 | * in your programs, rather than any of the "*.h" implementation files. | |
38 | * | |
39 | * This is the C++ version of the Standard C Library header @c stdlib.h, | |
40 | * and its contents are (mostly) the same as that header, but are all | |
41 | * contained in the namespace @c std. | |
42 | */ | |
43 | ||
3eb35fcf BK |
44 | #ifndef _CPP_CSTDLIB |
45 | #define _CPP_CSTDLIB 1 | |
34ff0b99 BK |
46 | |
47 | #pragma GCC system_header | |
22aef514 | 48 | |
98e6e789 | 49 | #include <bits/c++config.h> |
54c1bf78 | 50 | #include <cstddef> |
22aef514 | 51 | |
c0dae541 | 52 | #include <stdlib.h> |
22aef514 | 53 | |
8089616e | 54 | // Get rid of those macros defined in <stdlib.h> in lieu of real functions. |
61c71946 BK |
55 | #undef abort |
56 | #undef abs | |
57 | #undef atexit | |
8089616e BK |
58 | #undef atof |
59 | #undef atoi | |
60 | #undef atol | |
61c71946 | 61 | #undef bsearch |
8089616e | 62 | #undef calloc |
61c71946 | 63 | #undef div |
8089616e | 64 | #undef exit |
61c71946 | 65 | #undef free |
8089616e | 66 | #undef getenv |
8089616e | 67 | #undef labs |
8089616e | 68 | #undef ldiv |
61c71946 | 69 | #undef malloc |
7b331228 | 70 | #undef mblen |
8089616e | 71 | #undef mbstowcs |
61c71946 BK |
72 | #undef mbtowc |
73 | #undef qsort | |
74 | #undef rand | |
75 | #undef realloc | |
76 | #undef srand | |
77 | #undef strtod | |
78 | #undef strtol | |
79 | #undef strtoul | |
80 | #undef system | |
8089616e | 81 | #undef wcstombs |
61c71946 | 82 | #undef wctomb |
7b331228 | 83 | |
98e6e789 BK |
84 | namespace std |
85 | { | |
86 | using ::div_t; | |
87 | using ::ldiv_t; | |
22aef514 | 88 | |
61c71946 BK |
89 | using ::abort; |
90 | using ::abs; | |
91 | using ::atexit; | |
de96ac46 BK |
92 | using ::atof; |
93 | using ::atoi; | |
94 | using ::atol; | |
61c71946 | 95 | using ::bsearch; |
de96ac46 | 96 | using ::calloc; |
61c71946 | 97 | using ::div; |
de96ac46 | 98 | using ::exit; |
61c71946 | 99 | using ::free; |
de96ac46 | 100 | using ::getenv; |
de96ac46 | 101 | using ::labs; |
de96ac46 | 102 | using ::ldiv; |
61c71946 | 103 | using ::malloc; |
de96ac46 | 104 | using ::mblen; |
de96ac46 | 105 | using ::mbstowcs; |
61c71946 BK |
106 | using ::mbtowc; |
107 | using ::qsort; | |
108 | using ::rand; | |
109 | using ::realloc; | |
110 | using ::srand; | |
111 | using ::strtod; | |
112 | using ::strtol; | |
113 | using ::strtoul; | |
114 | using ::system; | |
de96ac46 | 115 | using ::wcstombs; |
61c71946 | 116 | using ::wctomb; |
22aef514 | 117 | |
21aaf8bf | 118 | inline long |
de96ac46 | 119 | abs(long __i) { return labs(__i); } |
21aaf8bf SS |
120 | |
121 | inline ldiv_t | |
de96ac46 | 122 | div(long __i, long __j) { return ldiv(__i, __j); } |
61c71946 | 123 | } |
7cda84dc BK |
124 | |
125 | #if _GLIBCPP_USE_C99 | |
61c71946 BK |
126 | |
127 | #undef _Exit | |
128 | #undef llabs | |
129 | #undef lldiv | |
130 | #undef atoll | |
131 | #undef strtoll | |
132 | #undef strtoull | |
133 | #undef strtof | |
134 | #undef strtold | |
135 | ||
3702c634 | 136 | namespace __gnu_cxx |
7cda84dc BK |
137 | { |
138 | using ::lldiv_t; | |
61c71946 | 139 | using ::_Exit; |
21aaf8bf | 140 | |
22aef514 | 141 | inline long long |
98e6e789 | 142 | abs(long long __x) { return __x >= 0 ? __x : -__x; } |
22aef514 BK |
143 | |
144 | inline long long | |
98e6e789 | 145 | llabs(long long __x) { return __x >= 0 ? __x : -__x; } |
22aef514 BK |
146 | |
147 | inline lldiv_t | |
98e6e789 | 148 | div(long long __n, long long __d) |
22aef514 BK |
149 | { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } |
150 | ||
151 | inline lldiv_t | |
98e6e789 | 152 | lldiv(long long __n, long long __d) |
22aef514 | 153 | { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; } |
98e6e789 | 154 | |
de96ac46 | 155 | using ::atoll; |
61c71946 | 156 | using ::strtof; |
de96ac46 BK |
157 | using ::strtoll; |
158 | using ::strtoull; | |
de96ac46 | 159 | using ::strtold; |
61c71946 | 160 | } |
5db6f3de BK |
161 | |
162 | namespace std | |
163 | { | |
3702c634 | 164 | using __gnu_cxx::lldiv_t; |
61c71946 | 165 | using __gnu_cxx::_Exit; |
3702c634 | 166 | using __gnu_cxx::abs; |
de96ac46 | 167 | using __gnu_cxx::llabs; |
3702c634 GDR |
168 | using __gnu_cxx::div; |
169 | using __gnu_cxx::lldiv; | |
170 | using __gnu_cxx::atoll; | |
61c71946 | 171 | using __gnu_cxx::strtof; |
3702c634 GDR |
172 | using __gnu_cxx::strtoll; |
173 | using __gnu_cxx::strtoull; | |
3702c634 | 174 | using __gnu_cxx::strtold; |
5db6f3de | 175 | } |
7cda84dc | 176 | #endif |
98e6e789 BK |
177 | |
178 | #endif |