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