Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygen_cstdlib.h
Go to the documentation of this file.
00001 /* 00002 * Copyright (c) 1999 00003 * Boris Fomitchev 00004 * 00005 * This material is provided "as is", with absolutely no warranty expressed 00006 * or implied. Any use is at your own risk. 00007 * 00008 * Permission to use or copy this software for any purpose is hereby granted 00009 * without fee, provided the above notices are retained on all copies. 00010 * Permission to modify the code and to distribute modified code is granted, 00011 * provided the above notices are retained, and a notice that the code was 00012 * modified is included with the above copyright notice. 00013 * 00014 */ 00015 00016 #ifndef _STLP_INTERNAL_CSTDLIB 00017 #define _STLP_INTERNAL_CSTDLIB 00018 00019 #if defined (_STLP_USE_NEW_C_HEADERS) 00020 # if defined (_STLP_HAS_INCLUDE_NEXT) 00021 # include_next <cstdlib> 00022 # else 00023 # include _STLP_NATIVE_CPP_C_HEADER(cstdlib) 00024 # endif 00025 #else 00026 # include <stdlib.h> 00027 #endif 00028 00029 #if defined (__BORLANDC__) && !defined (__linux__) 00030 /* Borland process.h header do not bring anything here and is just included 00031 * in order to avoid inclusion later. This header cannot be included later 00032 * because Borland compiler consider that for instance the abort function 00033 * defined as extern "C" cannot be overloaded and it finds 2 "overloads", 00034 * once in native std namespace and the other in STLport namespace... 00035 */ 00036 # include <process.h> 00037 #endif 00038 00039 /* on evc3/evc4 including stdlib.h also defines setjmp macro */ 00040 #if defined (_STLP_WCE) 00041 # define _STLP_NATIVE_SETJMP_H_INCLUDED 00042 #endif 00043 00044 #if defined (__MSL__) && (__MSL__ <= 0x5003) 00045 namespace std { 00046 typedef ::div_t div_t; 00047 typedef ::ldiv_t ldiv_t; 00048 # ifdef __MSL_LONGLONG_SUPPORT__ 00049 typedef ::lldiv_t lldiv_t; 00050 # endif 00051 } 00052 #endif 00053 00054 #ifdef _STLP_IMPORT_VENDOR_CSTD 00055 _STLP_BEGIN_NAMESPACE 00056 using _STLP_VENDOR_CSTD::div_t; 00057 using _STLP_VENDOR_CSTD::ldiv_t; 00058 using _STLP_VENDOR_CSTD::size_t; 00059 00060 # ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS 00061 # ifndef _STLP_WCE 00062 // these functions just don't exist on Windows CE 00063 using _STLP_VENDOR_CSTD::abort; 00064 using _STLP_VENDOR_CSTD::getenv; 00065 using _STLP_VENDOR_CSTD::mblen; 00066 using _STLP_VENDOR_CSTD::mbtowc; 00067 using _STLP_VENDOR_CSTD::system; 00068 using _STLP_VENDOR_CSTD::bsearch; 00069 # endif 00070 using _STLP_VENDOR_CSTD::atexit; 00071 using _STLP_VENDOR_CSTD::exit; 00072 using _STLP_VENDOR_CSTD::calloc; 00073 using _STLP_VENDOR_CSTD::free; 00074 using _STLP_VENDOR_CSTD::malloc; 00075 using _STLP_VENDOR_CSTD::realloc; 00076 using _STLP_VENDOR_CSTD::atof; 00077 using _STLP_VENDOR_CSTD::atoi; 00078 using _STLP_VENDOR_CSTD::atol; 00079 using _STLP_VENDOR_CSTD::mbstowcs; 00080 using _STLP_VENDOR_CSTD::strtod; 00081 using _STLP_VENDOR_CSTD::strtol; 00082 using _STLP_VENDOR_CSTD::strtoul; 00083 00084 # if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_NATIVE_MBSTATE_T)) 00085 using _STLP_VENDOR_CSTD::wcstombs; 00086 # ifndef _STLP_WCE 00087 using _STLP_VENDOR_CSTD::wctomb; 00088 # endif 00089 # endif 00090 using _STLP_VENDOR_CSTD::qsort; 00091 using _STLP_VENDOR_CSTD::labs; 00092 using _STLP_VENDOR_CSTD::ldiv; 00093 # if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L) 00094 # if !defined(__sun) 00095 using _STLP_VENDOR_CSTD::llabs; 00096 using _STLP_VENDOR_CSTD::lldiv_t; 00097 using _STLP_VENDOR_CSTD::lldiv; 00098 # else 00099 using ::llabs; 00100 using ::lldiv_t; 00101 using ::lldiv; 00102 # endif 00103 # endif 00104 using _STLP_VENDOR_CSTD::rand; 00105 using _STLP_VENDOR_CSTD::srand; 00106 # endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */ 00107 _STLP_END_NAMESPACE 00108 #endif /* _STLP_IMPORT_VENDOR_CSTD */ 00109 00110 #if (defined (__BORLANDC__) || defined (__WATCOMC__)) && defined (_STLP_USE_NEW_C_HEADERS) 00111 //In this config bcc define everything in std namespace and not in 00112 //the global one. 00113 inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); } 00114 inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); } 00115 #endif 00116 00117 #if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300) 00118 # define _STLP_RESTORE_FUNCTION_INTRINSIC 00119 # pragma warning (push) 00120 # pragma warning (disable: 4162) 00121 # pragma function (abs) 00122 #endif 00123 00124 //HP-UX native lib has abs() and div() functions in global namespace 00125 #if !defined (__SUNPRO_CC) && \ 00126 (!defined (__HP_aCC) || (__HP_aCC < 30000)) 00127 00128 //MSVC starting with .Net 2003 already define all math functions in global namespace: 00129 # if !defined (__WATCOMC__) && \ 00130 (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined (UNDER_CE)) 00131 inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); } 00132 # endif 00133 00135 # if !defined (__WATCOMC__) && \ 00136 (!defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined (UNDER_CE)) 00137 inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); } 00138 # endif 00139 00140 #endif 00141 00142 #if defined (_STLP_RESTORE_FUNCTION_INTRINSIC) 00143 # pragma intrinsic (abs) 00144 # pragma warning (pop) 00145 # undef _STLP_RESTORE_FUNCTION_INTRINSIC 00146 #endif 00147 00148 #if defined (_STLP_LONG_LONG) 00149 # if !defined (_STLP_NO_VENDOR_STDLIB_L) 00150 # if !defined (__sun) 00151 inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); } 00152 inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); } 00153 # else 00154 inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); } 00155 inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); } 00156 # endif 00157 /*# else 00158 inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }*/ 00159 # endif 00160 #endif 00161 00162 /* C++ Standard is unclear about several call to 'using ::func' if new overloads 00163 * of ::func appears between 2 successive 'using' calls. To avoid this potential 00164 * problem we provide all abs overload before the 'using' call. 00165 * Beware: This header inclusion has to be after all abs overload of this file. 00166 * The first 'using ::abs' call is going to be in the other header. 00167 */ 00168 #ifndef _STLP_INTERNAL_CMATH 00169 # include <stl/_cmath.h> 00170 #endif 00171 00172 #if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS) 00173 // ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05 00174 _STLP_BEGIN_NAMESPACE 00175 using ::abs; 00176 using ::div; 00177 _STLP_END_NAMESPACE 00178 #endif 00179 00180 #endif /* _STLP_INTERNAL_CSTDLIB */ Generated on Mon May 28 2012 04:28:45 for ReactOS by
1.7.6.1
|