ReactOS 0.4.15-dev-7842-g558ab78
Prefix.h
Go to the documentation of this file.
1/***********************************************************************************
2 Prefix.h
3
4 * Copyright (c) 1997
5 * Mark of the Unicorn, Inc.
6 *
7 * Permission to use, copy, modify, distribute and sell this software
8 * and its documentation for any purpose is hereby granted without fee,
9 * provided that the above copyright notice appear in all copies and
10 * that both that copyright notice and this permission notice appear
11 * in supporting documentation. Mark of the Unicorn makes no
12 * representations about the suitability of this software for any
13 * purpose. It is provided "as is" without express or implied warranty.
14
15 SUMMARY: Configuration #defines for STL EH test suite
16
17***********************************************************************************/
18
19#ifndef INCLUDED_MOTU_Prefix
20#define INCLUDED_MOTU_Prefix 1
21
22// Gives much more thorough checking, but may slow the tests
23// considerably if your malloc is slow.
24#define TESTCLASS_DEEP_DATA 1
25
26# ifndef NO_FAST_ALLOCATOR
27// # define NO_FAST_ALLOCATOR
28# endif
29
30// Define this to use the SGI STL. Undefine it to test a different installation
31#ifndef EH_NO_SGI_STL
32# define EH_USE_SGI_STL 1
33#endif
34
35#if EH_USE_SGI_STL
36
37#define EH_ASSERT _STLP_ASSERT
38
39//=========================================================================
40// SGI STL-specific #defines
41// These control the behavior of the test suite when used with the SGI
42// STL. They have no effect when testing other STL implementations.
43//=========================================================================
44
45#ifndef _STLP_USE_NEWALLOC
46# define _STLP_USE_NEWALLOC
47#endif
48
49#if 0 // !defined (_STLP_NO_CUSTOM_IO) && ! defined (__BORLANDC__)
50# define _STLP_NO_CUSTOM_IO
51#endif
52
53// Just include something to get whatever configuration header we're using.
54#include <utility>
55
56#ifndef _STLP_CALL
57# define _STLP_CALL
58#endif
59
60#if defined(_STLP_USE_NAMESPACES)
61# define EH_USE_NAMESPACES _STLP_USE_NAMESPACES
62#endif
63
64#define EH_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE
65#define EH_END_NAMESPACE _STLP_END_NAMESPACE
66
67#define EH_NEW_HEADERS 1
68
69//#if defined (_STLP_USE_NEW_IOSTREAMS)
70#define EH_NEW_IOSTREAMS 1
71//#endif
72
73#if !defined (_STLP_USE_EXCEPTIONS)
74# define EH_NO_EXCEPTIONS
75#endif
76
77#if defined (_STLP_TEMPLATE_PARAM_SUBTYPE_BUG)
78# define EH_TEMPLATE_PARAM_SUBTYPE_BUG _STLP_TEMPLATE_PARAM_SUBTYPE_BUG
79#endif
80
81#if defined(_STLP_MULTI_CONST_TEMPLATE_ARG_BUG)
82# define EH_MULTI_CONST_TEMPLATE_ARG_BUG _STLP_MULTI_CONST_TEMPLATE_ARG_BUG
83#endif
84
85#if defined (STLPORT)
86# define EH_STD STLPORT
87#elif defined(__STD)
88# define EH_STD __STD
89#endif
90
91// we want to be portable here, so std:: won't work.
92#if defined(STLPORT_CSTD)
93# define EH_CSTD STLPORT_CSTD
94#else
95# define EH_CSTD std
96#endif
97
98#define EH_DISTANCE(a, b, result) EH_STD::distance(a, b, result)
99
100#define EH_HASHED_CONTAINERS_IMPLEMENTED 1
101#define EH_HASH_CONTAINERS_SUPPORT_RESIZE 1
102#define EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION 1
103#define EH_SLIST_IMPLEMENTED 1
104#define EH_SELECT1ST_HINT __select1st_hint
105// fbp : DEC cxx is unable to compile it for some reason
106#if !(defined (__DECCXX) || defined (__amigaos__) || \
107 (defined (__GNUC__) && (__GNUC__ <= 2) && (__GNUC_MINOR__ < 8)))
108# define EH_ROPE_IMPLEMENTED 1
109#endif
110#define EH_STRING_IMPLEMENTED 1
111// # define EH_BITSET_IMPLEMENTED 1
112//# define EH_VALARRAY_IMPLEMENTED 1 - we have no tests yet for valarray
113
114#define stl_destroy EH_STD::destroy
115#include <memory>
116
117template <class _Tp>
118class /*_STLP_CLASS_DECLSPEC*/ EH_allocator;
119
120template <class _Tp>
121class /*_STLP_CLASS_DECLSPEC*/ EH_allocator {
122public:
123
124 typedef _Tp value_type;
126 typedef const _Tp* const_pointer;
127 typedef _Tp& reference;
128 typedef const _Tp& const_reference;
129 typedef EH_CSTD::size_t size_type;
130 typedef EH_CSTD::ptrdiff_t difference_type;
131# if defined (_STLP_MEMBER_TEMPLATE_CLASSES)
132 template <class _Tp1> struct rebind {
134 };
135# endif
137 # if defined (_STLP_MEMBER_TEMPLATES)
138 template <class _Tp1> EH_allocator(const EH_allocator<_Tp1>&) _STLP_NOTHROW {}
139 # endif
142 pointer address(reference __x) { return &__x; }
143 const_pointer address(const_reference __x) const { return &__x; }
144 // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0.
145 _Tp* allocate(size_type __n, const void* = 0) const {
146 return __n != 0 ? __REINTERPRET_CAST(value_type*,EH_STD::__new_alloc::allocate(__n * sizeof(value_type))) : 0;
147 }
148 // __p is permitted to be a null pointer, only if n==0.
149 void deallocate(pointer __p, size_type __n) const {
150 _STLP_ASSERT( (__p == 0) == (__n == 0) )
151 if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, __n * sizeof(value_type));
152 }
153 // backwards compatibility
154 void deallocate(pointer __p) const { if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, sizeof(value_type)); }
156 void construct(pointer __p, const _Tp& __val) const { stlport::construct(__p, __val); }
157 void destroy(pointer __p) const { stlport::destroy(__p); }
158};
159
160template <class _T1> inline bool _STLP_CALL operator==(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return true; }
161template <class _T1> inline bool _STLP_CALL operator!=(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return false; }
162
164// If custom allocators are being used without member template classes support :
165// user (on purpose) is forced to define rebind/get operations !!!
166template <class _Tp1, class _Tp2>
168__stl_alloc_rebind(EH_allocator<_Tp1>& __a, const _Tp2*) { return (EH_allocator<_Tp2>&)(__a); }
169template <class _Tp1, class _Tp2>
173
174# define eh_allocator(T) ::EH_allocator<T>
175
176# define EH_BIT_VECTOR_IMPLEMENTED
177
178# if defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined(_STLP_NO_BOOL)
179# define EH_BIT_VECTOR EH_STD::vector<bool, eh_allocator(bool) >
180# else
181# ifdef _STLP_NO_BOOL
182# undef EH_BIT_VECTOR_IMPLEMENTED
183# else
184# define EH_BIT_VECTOR EH_STD::vector<bool, eh_allocator(bool) >
185# endif
186# endif
187
188#else // !USE_SGI_STL
189//=========================================================================
190// Configuration for testing other non-SGI STL implementations
191//=========================================================================
192
193// Metrowerks configuration
194# ifdef __MWERKS__
195
196# define EH_ASSERT assert
197// Get MSL configuration header
198# include <ansi_parms.h>
199
200# if __MSL__ >= 24
201
202# define EH_NEW_HEADERS 1
203# if defined (_MSL_USING_NAMESPACE)
204# define EH_USE_NAMESPACES 1
205# endif
206# define EH_BIT_VECTOR vector<bool>
207# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0)
208
209# else
210
211# error No configuration for earlier versions of MSL
212
213# endif // __MSL__ >= 24
214
215// Bugs fixed in CWPro3
216# if __MWERKS__ < 0x2100
217# define EH_TEMPLATE_PARAM_SUBTYPE_BUG 1
218# endif
219
220// Bugs in CWPro3
221# if __MWERKS__ <= 0x2110
222# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1
223# else
224# pragma warning not sure the above bug is fixed yet
225# endif
226
227# define EH_SLIST_IMPLEMENTED 1
228//# define EH_HASHED_CONTAINERS_IMPLEMENTED 1
229
230# define EH_NEW_IOSTREAMS 1
231# define EH_USE_NOTHROW 1
232# endif // Metrowerks configuration
233
234#if defined (__SUNPRO_CC)
235# define stl_destroy __RWSTD::__destroy
236# define EH_DISTANCE( a, b, result ) distance( a, b, result )
237# define EH_BIT_VECTOR EH_STD::vector<bool>
238# define EH_NEW_HEADERS 1
239# define EH_USE_NAMESPACES 1
240# define EH_NEW_IOSTREAMS 1
241# define EH_ASSERT assert
242# define EH_STRING_IMPLEMENTED 1
243# elif defined (__KCC)
244# define stl_destroy EH_STD::destroy
245# define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0)
246# define EH_BIT_VECTOR EH_STD::vector<bool>
247# define EH_NEW_HEADERS 1
248# define EH_USE_NAMESPACES 1
249# define EH_NEW_IOSTREAMS 1
250# define EH_ASSERT assert
251# define EH_CSTD
252# define EH_STRING_IMPLEMENTED 1
253# define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1
254# define EH_SELECT1ST_HINT select1st
255# else
256# define stl_destroy destroy
257#endif
258
259//
260// Compiler-independent configuration
261//
262# ifdef EH_USE_NAMESPACES
263# ifdef STLPORT
264# define EH_STD STLPORT
265# else
266# define EH_STD std
267# endif
268# ifdef STLPORT_CSTD
269# define EH_STD STLPORT_CSTD
270# else
271# define EH_STD std
272# endif
273# define EH_BEGIN_NAMESPACE namespace EH_STD {
274# define EH_END_NAMESPACE }
275# else
276# define EH_BEGIN_NAMESPACE
277# define EH_END_NAMESPACE
278# define EH_STD
279# endif
280
281# ifndef EH_CSTD
282# define EH_CSTD EH_STD
283# endif
284
285#endif // !USE_SGI_STL
286
287
288//
289// Library-independent configuration.
290//
291#if defined( EH_MULTI_CONST_TEMPLATE_ARG_BUG) && !defined( EH_SELECT1ST_HINT )
292template <class Pair, class U>
293// JDJ (CW Pro1 doesn't like const when first_type is also const)
294struct eh_select1st_hint : public unary_function<Pair, U> {
295 const U& operator () (const Pair& x) const { return x.first; }
296};
297# define EH_SELECT1ST_HINT eh_select1st_hint
298#endif
299
300
301#if EH_USE_NAMESPACES
302# define EH_USE_STD using namespace EH_STD;
303#else
304# define EH_USE_STD
305#endif
306
307#if defined (EH_USE_NAMESPACES) && !defined(_STLP_VENDOR_GLOBAL_CSTD)
308# define USING_CSTD_NAME(name) using EH_CSTD :: name;
309#else
310# define USING_CSTD_NAME(name)
311#endif
312
313#endif // INCLUDED_MOTU_Prefix
bool _STLP_CALL operator!=(const EH_allocator< _T1 > &, const EH_allocator< _T1 > &)
Definition: Prefix.h:161
#define _STLP_CALL
Definition: Prefix.h:57
EH_allocator< _Tp2 > _STLP_CALL __stl_alloc_create(const EH_allocator< _Tp1 > &, const _Tp2 *)
Definition: Prefix.h:171
bool _STLP_CALL operator==(const EH_allocator< _T1 > &, const EH_allocator< _T1 > &)
Definition: Prefix.h:160
_STLP_BEGIN_NAMESPACE EH_allocator< _Tp2 > &_STLP_CALL __stl_alloc_rebind(EH_allocator< _Tp1 > &__a, const _Tp2 *)
Definition: Prefix.h:168
return __n
Definition: _algo.h:75
_STLP_INLINE_LOOP _InputIter const _Tp & __val
Definition: _algobase.h:656
#define _STLP_ASSERT(expr)
Definition: _debug.h:165
#define _STLP_NOTHROW
Definition: _intel.h:35
#define U(x)
Definition: wordpad.c:45
EH_CSTD::ptrdiff_t difference_type
Definition: Prefix.h:130
size_type max_size() const _STLP_NOTHROW
Definition: Prefix.h:155
pointer address(reference __x)
Definition: Prefix.h:142
const _Tp * const_pointer
Definition: Prefix.h:126
EH_allocator(const EH_allocator< _Tp > &) _STLP_NOTHROW
Definition: Prefix.h:140
void deallocate(pointer __p) const
Definition: Prefix.h:154
value_type * pointer
Definition: Prefix.h:125
const _Tp & const_reference
Definition: Prefix.h:128
void destroy(pointer __p) const
Definition: Prefix.h:157
void construct(pointer __p, const _Tp &__val) const
Definition: Prefix.h:156
const_pointer address(const_reference __x) const
Definition: Prefix.h:143
_Tp & reference
Definition: Prefix.h:127
EH_allocator() _STLP_NOTHROW
Definition: Prefix.h:136
~EH_allocator() _STLP_NOTHROW
Definition: Prefix.h:141
EH_CSTD::size_t size_type
Definition: Prefix.h:129
void deallocate(pointer __p, size_type __n) const
Definition: Prefix.h:149
_Tp value_type
Definition: Prefix.h:124
_Tp * allocate(size_type __n, const void *=0) const
Definition: Prefix.h:145
__kernel_size_t size_t
Definition: linux.h:237
#define __REINTERPRET_CAST(__x, __y)
Definition: features.h:586
#define _STLP_BEGIN_NAMESPACE
Definition: features.h:501
#define _STLP_END_NAMESPACE
Definition: features.h:503
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int other
Definition: msacm.c:1376
Definition: _pair.h:47
#define const
Definition: zconf.h:233