Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
5 * This material is provided "as is", with absolutely no warranty expressed
6 * or implied. Any use is at your own risk.
8 * Permission to use or copy this software for any purpose is hereby granted
9 * without fee, provided the above notices are retained on all copies.
10 * Permission to modify the code and to distribute modified code is granted,
11 * provided the above notices are retained, and a notice that the code was
12 * modified is included with the above copyright notice.
16 #ifndef _STLP_INTERNAL_CSTDLIB
17 #define _STLP_INTERNAL_CSTDLIB
19 #if defined (_STLP_USE_NEW_C_HEADERS)
20 # include _STLP_NATIVE_CPP_C_HEADER(cstdlib)
25 #if defined (__BORLANDC__)
26 /* Borland process.h header do not bring anything here and is just included
27 * in order to avoid inclusion later. This header cannot be included later
28 * because Borland compiler consider that for instance the abort function
29 * defined as extern "C" cannot be overloaded and it finds 2 "overloads",
30 * once in native std namespace and the other in STLport namespace...
35 /* on evc3/evc4 including stdlib.h also defines setjmp macro */
36 #if defined (_STLP_WCE)
37 # define _STLP_NATIVE_SETJMP_H_INCLUDED
40 #if defined (__MSL__) && (__MSL__ <= 0x5003)
42 typedef ::div_t div_t;
43 typedef ::ldiv_t ldiv_t;
44 # ifdef __MSL_LONGLONG_SUPPORT__
45 typedef ::lldiv_t lldiv_t;
50 #ifdef _STLP_IMPORT_VENDOR_CSTD
52 using _STLP_VENDOR_CSTD::div_t;
53 using _STLP_VENDOR_CSTD::ldiv_t;
54 using _STLP_VENDOR_CSTD::size_t;
56 # ifndef _STLP_NO_CSTD_FUNCTION_IMPORTS
58 // these functions just don't exist on Windows CE
59 using _STLP_VENDOR_CSTD::abort;
60 using _STLP_VENDOR_CSTD::getenv;
61 using _STLP_VENDOR_CSTD::mblen;
62 using _STLP_VENDOR_CSTD::mbtowc;
63 using _STLP_VENDOR_CSTD::system;
64 using _STLP_VENDOR_CSTD::bsearch;
66 using _STLP_VENDOR_CSTD::atexit;
67 using _STLP_VENDOR_CSTD::exit;
68 using _STLP_VENDOR_CSTD::calloc;
69 using _STLP_VENDOR_CSTD::free;
70 using _STLP_VENDOR_CSTD::malloc;
71 using _STLP_VENDOR_CSTD::realloc;
72 using _STLP_VENDOR_CSTD::atof;
73 using _STLP_VENDOR_CSTD::atoi;
74 using _STLP_VENDOR_CSTD::atol;
75 using _STLP_VENDOR_CSTD::mbstowcs;
76 using _STLP_VENDOR_CSTD::strtod;
77 using _STLP_VENDOR_CSTD::strtol;
78 using _STLP_VENDOR_CSTD::strtoul;
80 # if !(defined (_STLP_NO_NATIVE_WIDE_STREAMS) || defined (_STLP_NO_MBSTATE_T))
81 using _STLP_VENDOR_CSTD::wcstombs;
83 using _STLP_VENDOR_CSTD::wctomb;
86 using _STLP_VENDOR_CSTD::qsort;
87 using _STLP_VENDOR_CSTD::labs;
88 using _STLP_VENDOR_CSTD::ldiv;
89 # if defined (_STLP_LONG_LONG) && !defined (_STLP_NO_VENDOR_STDLIB_L)
91 using _STLP_VENDOR_CSTD::llabs;
92 using _STLP_VENDOR_CSTD::lldiv_t;
93 using _STLP_VENDOR_CSTD::lldiv;
100 using _STLP_VENDOR_CSTD::rand;
101 using _STLP_VENDOR_CSTD::srand;
102 # endif /* _STLP_NO_CSTD_FUNCTION_IMPORTS */
104 #endif /* _STLP_IMPORT_VENDOR_CSTD */
106 #if defined (__BORLANDC__) && defined (_STLP_USE_NEW_C_HEADERS)
107 //In this config bcc define everything in std namespace and not in
109 inline int abs(int __x) { return _STLP_VENDOR_CSTD::abs(__x); }
110 inline _STLP_VENDOR_CSTD::div_t div(int __x, int __y) { return _STLP_VENDOR_CSTD::div(__x, __y); }
113 #if defined(_MSC_EXTENSIONS) && defined(_STLP_MSVC) && (_STLP_MSVC <= 1300)
114 # define _STLP_RESTORE_FUNCTION_INTRINSIC
115 # pragma warning (push)
116 # pragma warning (disable: 4162)
117 # pragma function (abs)
120 //HP-UX native lib has abs() and div() functions in global namespace
121 #if !defined (__HP_aCC) || (__HP_aCC < 30000)
123 //MSVC starting with .Net 2003 already define all math functions in global namespace:
124 # if !defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1310) || defined(UNDER_CE)
125 inline long abs(long __x) { return _STLP_VENDOR_CSTD::labs(__x); }
128 /** VC since version 8 has this, the platform SDK and CE SDKs hanging behind. */
129 # if !defined (_STLP_MSVC_LIB) || (_STLP_MSVC_LIB < 1400) || defined (_STLP_USING_PLATFORM_SDK_COMPILER) || defined(UNDER_CE)
130 inline _STLP_VENDOR_CSTD::ldiv_t div(long __x, long __y) { return _STLP_VENDOR_CSTD::ldiv(__x, __y); }
135 #if defined (_STLP_RESTORE_FUNCTION_INTRINSIC)
136 # pragma intrinsic (abs)
137 # pragma warning (pop)
138 # undef _STLP_RESTORE_FUNCTION_INTRINSIC
141 #if defined (_STLP_LONG_LONG)
142 # if !defined (_STLP_NO_VENDOR_STDLIB_L)
143 # if !defined (__sun)
144 inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return _STLP_VENDOR_CSTD::llabs(__x); }
145 inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return _STLP_VENDOR_CSTD::lldiv(__x, __y); }
147 inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return ::llabs(__x); }
148 inline lldiv_t div(_STLP_LONG_LONG __x, _STLP_LONG_LONG __y) { return ::lldiv(__x, __y); }
151 inline _STLP_LONG_LONG abs(_STLP_LONG_LONG __x) { return __x < 0 ? -__x : __x; }
155 /* C++ Standard is unclear about several call to 'using ::func' if new overloads
156 * of ::func appears between 2 successive 'using' calls. To avoid this potential
157 * problem we provide all abs overload before the 'using' call.
158 * Beware: This header inclusion has to be after all abs overload of this file.
159 * The first 'using ::abs' call is going to be in the other header.
161 #ifndef _STLP_INTERNAL_CMATH
162 # include <stl/_cmath.h>
165 #if defined (_STLP_IMPORT_VENDOR_CSTD) && !defined (_STLP_NO_CSTD_FUNCTION_IMPORTS)
166 // ad hoc, don't replace with _STLP_VENDOR_CSTD::abs here! - ptr 2005-03-05
167 _STLP_BEGIN_NAMESPACE
169 # if !defined (N_PLAT_NLM)
172 // Don't use div from clib or libc on NetWare---buggy! - ptr 2005-06-06
173 inline div_t div(int __x, int __y) { div_t d; d.quot = __x / __y; d.rem = __x % __y; return d; }
174 inline ldiv_t div(long __x, long __y) { ldiv_t d; d.quot = __x / __y; d.rem = __x % __y; return d; }
179 #endif /* _STLP_INTERNAL_CSTDLIB */