Remove incorrect cache_purge() calls in *_rmdir() (OLD API). These could
[dragonfly.git] / contrib / libstdc++3 / include / c_std / std_cstdlib.h
1 // -*- C++ -*- forwarding header.
2
3 // Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003
4 // Free Software Foundation, Inc.
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
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
44 #ifndef _CPP_CSTDLIB
45 #define _CPP_CSTDLIB 1
46
47 #pragma GCC system_header
48
49 #include <bits/c++config.h>
50 #include <cstddef>
51
52 #include <stdlib.h>
53
54 // Get rid of those macros defined in <stdlib.h> in lieu of real functions.
55 #undef abort
56 #undef abs
57 #undef atexit
58 #undef atof
59 #undef atoi
60 #undef atol
61 #undef bsearch
62 #undef calloc
63 #undef div
64 #undef exit
65 #undef free
66 #undef getenv
67 #undef labs
68 #undef ldiv
69 #undef malloc
70 #undef mblen
71 #undef mbstowcs
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
81 #undef wcstombs
82 #undef wctomb
83
84 namespace std 
85 {
86   using ::div_t;
87   using ::ldiv_t;
88
89   using ::abort;
90   using ::abs;
91   using ::atexit;
92   using ::atof;
93   using ::atoi;
94   using ::atol;
95   using ::bsearch;
96   using ::calloc;
97   using ::div;
98   using ::exit;
99   using ::free;
100   using ::getenv;
101   using ::labs;
102   using ::ldiv;
103   using ::malloc;
104   using ::mblen;
105   using ::mbstowcs;
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;
115   using ::wcstombs;
116   using ::wctomb;
117
118   inline long 
119   abs(long __i) { return labs(__i); }
120
121   inline ldiv_t
122   div(long __i, long __j) { return ldiv(__i, __j); }
123
124
125 #if _GLIBCPP_USE_C99
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
136 namespace __gnu_cxx
137 {
138 #if !_GLIBCPP_USE_C99_LONG_LONG_DYNAMIC
139   using ::lldiv_t;
140 #endif
141 #if _GLIBCPP_USE_C99_CHECK || _GLIBCPP_USE_C99_DYNAMIC
142   extern "C" void (_Exit)(int);
143 #endif
144 #if !_GLIBCPP_USE_C99_DYNAMIC
145   using ::_Exit;
146 #endif
147
148   inline long long 
149   abs(long long __x) { return __x >= 0 ? __x : -__x; }
150
151   inline long long 
152   llabs(long long __x) { return __x >= 0 ? __x : -__x; }
153
154 #if !_GLIBCPP_USE_C99_LONG_LONG_DYNAMIC
155   inline lldiv_t 
156   div(long long __n, long long __d)
157   { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
158
159   inline lldiv_t 
160   lldiv(long long __n, long long __d)
161   { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
162 #endif
163
164 #if _GLIBCPP_USE_C99_LONG_LONG_CHECK || _GLIBCPP_USE_C99_LONG_LONG_DYNAMIC
165   extern "C" long long int (atoll)(const char *);
166   extern "C" long long int
167     (strtoll)(const char * restrict, char ** restrict, int);
168   extern "C" unsigned long long int
169     (strtoull)(const char * restrict, char ** restrict, int);
170 #endif
171 #if !_GLIBCPP_USE_C99_LONG_LONG_DYNAMIC
172   using ::atoll;
173   using ::strtoll;
174   using ::strtoull;
175 #endif
176   using ::strtof;
177   using ::strtold; 
178
179
180 namespace std
181 {
182 #if !_GLIBCPP_USE_C99_LONG_LONG_DYNAMIC 
183   using __gnu_cxx::lldiv_t;
184 #endif
185   using __gnu_cxx::_Exit;
186   using __gnu_cxx::abs;
187   using __gnu_cxx::llabs; 
188 #if !_GLIBCPP_USE_C99_LONG_LONG_DYNAMIC 
189   using __gnu_cxx::div;
190   using __gnu_cxx::lldiv;
191 #endif
192   using __gnu_cxx::atoll;
193   using __gnu_cxx::strtof;
194   using __gnu_cxx::strtoll;
195   using __gnu_cxx::strtoull;
196   using __gnu_cxx::strtold;
197 }
198 #endif
199
200 #endif