00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036 #ifndef _CPP_CSTDLIB
00037 #define _CPP_CSTDLIB 1
00038
00039 #include <bits/c++config.h>
00040 #include <bits/std_cstddef.h>
00041
00042 #pragma GCC system_header
00043 #include <stdlib.h>
00044
00045
00046 #undef atof
00047 #undef atoi
00048 #undef atol
00049 #undef strtod
00050 #undef strtof
00051 #undef strtol
00052 #undef strtoul
00053 #undef rand
00054 #undef srand
00055 #undef calloc
00056 #undef free
00057 #undef malloc
00058 #undef realloc
00059 #undef abort
00060 #undef atexit
00061 #undef exit
00062 #undef _Exit
00063 #undef getenv
00064 #undef system
00065 #undef bsearch
00066 #undef qsort
00067 #undef abs
00068 #undef labs
00069 #undef llabs
00070 #undef div
00071 #undef ldiv
00072 #undef lldiv
00073 #undef mblen
00074 #undef mbtowc
00075 #undef wctomb
00076 #undef mbstowcs
00077 #undef wcstombs
00078 #undef atoll
00079 #undef strtoll
00080 #undef strtoull
00081 #undef strtold
00082
00083 namespace std
00084 {
00085 using ::div_t;
00086 using ::ldiv_t;
00087
00088 extern "C" double atof(const char*);
00089 extern "C" int atoi(const char*);
00090 extern "C" long int atol(const char*);
00091 extern "C" double strtod(const char*, char**);
00092 extern "C" float strtof(const char*, char**);
00093 extern "C" long int strtol(const char*, char**, int);
00094 extern "C" unsigned long int strtoul(const char*, char**, int);
00095 extern "C" int rand(void);
00096 extern "C" void srand(unsigned int);
00097 extern "C" void* calloc(size_t, size_t);
00098 extern "C" void free(void*);
00099 extern "C" void* malloc(size_t);
00100 extern "C" void* realloc(void*, size_t);
00101 extern "C" void abort(void);
00102 extern "C" int atexit(void (*func)(void));
00103 extern "C" void exit(int);
00104 extern "C" void _Exit(int);
00105 extern "C" char*getenv(const char*);
00106 extern "C" int system(const char*);
00107 extern "C" void* bsearch(const void*, const void*, size_t, size_t,
00108 int (*comp)(const void *, const void *));
00109 extern "C" void qsort(void*, size_t, size_t,
00110 int (*comp)(const void *, const void *));
00111 extern "C" int abs(int);
00112 extern "C" long int labs(long int);
00113 extern "C" div_t div(int, int);
00114 extern "C" ldiv_t ldiv(long int, long int);
00115 extern "C" int mblen(const char*, size_t);
00116 extern "C" int mbtowc(wchar_t*, const char*, size_t);
00117 extern "C" int wctomb(char*, wchar_t);
00118 extern "C" size_t mbstowcs(wchar_t*, const char*, size_t);
00119 extern "C" size_t wcstombs(char*, const wchar_t*, size_t);
00120
00121 inline long
00122 abs(long __i) { return ::labs(__i); }
00123
00124 inline ldiv_t
00125 div(long __i, long __j) { return ::ldiv(__i, __j); }
00126 }
00127
00128 #if _GLIBCPP_USE_C99
00129 namespace c99
00130 {
00131 using ::lldiv_t;
00132
00133 inline long long
00134 abs(long long __x) { return __x >= 0 ? __x : -__x; }
00135
00136 inline long long
00137 llabs(long long __x) { return __x >= 0 ? __x : -__x; }
00138
00139 inline lldiv_t
00140 div(long long __n, long long __d)
00141 { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
00142
00143 inline lldiv_t
00144 lldiv(long long __n, long long __d)
00145 { lldiv_t __q; __q.quot = __n / __d; __q.rem = __n % __d; return __q; }
00146
00147 extern "C" long long int atoll(const char*);
00148 extern "C" long long int strtoll(const char*, char**, int);
00149 extern "C" unsigned long long int strtoull(const char*, char**, int);
00150
00151 #ifdef _GLIBCPP_HAVE_STRTOLD
00152 extern "C" long double strtold(const char*, char**);
00153 #endif
00154 }
00155
00156 namespace std
00157 {
00158 using c99::lldiv_t;
00159 using c99::abs;
00160
00161 using c99::div;
00162 using c99::lldiv;
00163 using c99::atoll;
00164 using c99::strtoll;
00165 using c99::strtoull;
00166 #ifdef _GLIBCPP_HAVE_STRTOLD
00167 using c99::strtold;
00168 #endif
00169 }
00170 #endif
00171
00172 #endif