sl@0: /*********************************************************************************** sl@0: Prefix.h sl@0: sl@0: * Copyright (c) 1997 sl@0: * Mark of the Unicorn, Inc. sl@0: * sl@0: * Permission to use, copy, modify, distribute and sell this software sl@0: * and its documentation for any purpose is hereby granted without fee, sl@0: * provided that the above copyright notice appear in all copies and sl@0: * that both that copyright notice and this permission notice appear sl@0: * in supporting documentation. Mark of the Unicorn makes no sl@0: * representations about the suitability of this software for any sl@0: * purpose. It is provided "as is" without express or implied warranty. sl@0: sl@0: SUMMARY: Configuration #defines for STL EH test suite sl@0: sl@0: ***********************************************************************************/ sl@0: sl@0: #ifndef INCLUDED_MOTU_Prefix sl@0: #define INCLUDED_MOTU_Prefix 1 sl@0: sl@0: // Gives much more thorough checking, but may slow the tests sl@0: // considerably if your malloc is slow. sl@0: #define TESTCLASS_DEEP_DATA 1 sl@0: sl@0: # ifndef NO_FAST_ALLOCATOR sl@0: // # define NO_FAST_ALLOCATOR sl@0: # endif sl@0: sl@0: // Define this to use the SGI STL. Undefine it to test a different installation sl@0: #ifndef EH_NO_SGI_STL sl@0: # define EH_USE_SGI_STL 1 sl@0: #endif sl@0: sl@0: #if EH_USE_SGI_STL sl@0: sl@0: #define EH_ASSERT _STLP_ASSERT sl@0: sl@0: #define _STLP_46_COMPATIBILITY sl@0: sl@0: //========================================================================= sl@0: // SGI STL-specific #defines sl@0: // These control the behavior of the test suite when used with the SGI sl@0: // STL. They have no effect when testing other STL implementations. sl@0: //========================================================================= sl@0: sl@0: // # define _STLP_USE_RAW_SGI_ALLOCATORS sl@0: #ifndef _STLP_USE_NEWALLOC sl@0: # define _STLP_USE_NEWALLOC sl@0: #endif sl@0: sl@0: #if 0 // !defined (_STLP_NO_CUSTOM_IO) && ! defined (__BORLANDC__) sl@0: # define _STLP_NO_CUSTOM_IO sl@0: #endif sl@0: sl@0: // Just include something to get whatever configuration header we're using. sl@0: #include sl@0: sl@0: #ifndef _STLP_CALL sl@0: # define _STLP_CALL sl@0: #endif sl@0: sl@0: #if defined(_STLP_USE_NAMESPACES) sl@0: # define EH_USE_NAMESPACES _STLP_USE_NAMESPACES sl@0: #endif sl@0: sl@0: #define EH_BEGIN_NAMESPACE _STLP_BEGIN_NAMESPACE sl@0: #define EH_END_NAMESPACE _STLP_END_NAMESPACE sl@0: sl@0: #define EH_NEW_HEADERS 1 sl@0: sl@0: //#if defined (_STLP_USE_NEW_IOSTREAMS) sl@0: #define EH_NEW_IOSTREAMS 1 sl@0: //#endif sl@0: sl@0: #if !defined (_STLP_USE_EXCEPTIONS) sl@0: # define EH_NO_EXCEPTIONS sl@0: #endif sl@0: sl@0: #if defined (_STLP_TEMPLATE_PARAM_SUBTYPE_BUG) sl@0: # define EH_TEMPLATE_PARAM_SUBTYPE_BUG _STLP_TEMPLATE_PARAM_SUBTYPE_BUG sl@0: #endif sl@0: sl@0: #if defined(_STLP_MULTI_CONST_TEMPLATE_ARG_BUG) sl@0: # define EH_MULTI_CONST_TEMPLATE_ARG_BUG _STLP_MULTI_CONST_TEMPLATE_ARG_BUG sl@0: #endif sl@0: sl@0: #if defined (STLPORT) sl@0: # define EH_STD STLPORT sl@0: #elif defined(__STD) sl@0: # define EH_STD __STD sl@0: #endif sl@0: sl@0: // we want to be portable here, so std:: won't work. sl@0: #if defined(STLPORT_CSTD) sl@0: # define EH_CSTD STLPORT_CSTD sl@0: #else sl@0: # define EH_CSTD std sl@0: #endif sl@0: sl@0: #define EH_DISTANCE(a, b, result) EH_STD::distance(a, b, result) sl@0: sl@0: #define EH_HASHED_CONTAINERS_IMPLEMENTED 1 sl@0: #define EH_HASH_CONTAINERS_SUPPORT_RESIZE 1 sl@0: #define EH_HASH_CONTAINERS_SUPPORT_ITERATOR_CONSTRUCTION 1 sl@0: #define EH_SLIST_IMPLEMENTED 1 sl@0: #define EH_SELECT1ST_HINT __select1st_hint sl@0: // fbp : DEC cxx is unable to compile it for some reason sl@0: #if !(defined (__DECCXX) || defined (__amigaos__) || \ sl@0: (defined (__GNUC__) && (__GNUC__ <= 2) && (__GNUC_MINOR__ < 8))) sl@0: # define EH_ROPE_IMPLEMENTED 1 sl@0: #endif sl@0: #define EH_STRING_IMPLEMENTED 1 sl@0: // # define EH_BITSET_IMPLEMENTED 1 sl@0: //# define EH_VALARRAY_IMPLEMENTED 1 - we have no tests yet for valarray sl@0: sl@0: #define stl_destroy EH_STD::destroy sl@0: #include sl@0: sl@0: template sl@0: class /*_STLP_CLASS_DECLSPEC*/ EH_allocator; sl@0: sl@0: template sl@0: class /*_STLP_CLASS_DECLSPEC*/ EH_allocator { sl@0: public: sl@0: sl@0: typedef _Tp value_type; sl@0: typedef value_type * pointer; sl@0: typedef const _Tp* const_pointer; sl@0: typedef _Tp& reference; sl@0: typedef const _Tp& const_reference; sl@0: typedef EH_CSTD::size_t size_type; sl@0: typedef EH_CSTD::ptrdiff_t difference_type; sl@0: # if defined (_STLP_MEMBER_TEMPLATE_CLASSES) sl@0: template struct rebind { sl@0: typedef EH_allocator<_Tp1> other; sl@0: }; sl@0: # endif sl@0: EH_allocator() _STLP_NOTHROW {} sl@0: # if defined (_STLP_MEMBER_TEMPLATES) sl@0: template EH_allocator(const EH_allocator<_Tp1>&) _STLP_NOTHROW {} sl@0: # endif sl@0: EH_allocator(const EH_allocator<_Tp>&) _STLP_NOTHROW {} sl@0: ~EH_allocator() _STLP_NOTHROW {} sl@0: pointer address(reference __x) { return &__x; } sl@0: const_pointer address(const_reference __x) const { return &__x; } sl@0: // __n is permitted to be 0. The C++ standard says nothing about what the return value is when __n == 0. sl@0: _Tp* allocate(size_type __n, const void* = 0) const { sl@0: return __n != 0 ? __REINTERPRET_CAST(value_type*,EH_STD::__new_alloc::allocate(__n * sizeof(value_type))) : 0; sl@0: } sl@0: // __p is permitted to be a null pointer, only if n==0. sl@0: void deallocate(pointer __p, size_type __n) const { sl@0: _STLP_ASSERT( (__p == 0) == (__n == 0) ) sl@0: if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, __n * sizeof(value_type)); sl@0: } sl@0: // backwards compatibility sl@0: void deallocate(pointer __p) const { if (__p != 0) EH_STD::__new_alloc::deallocate((void*)__p, sizeof(value_type)); } sl@0: size_type max_size() const _STLP_NOTHROW { return size_t(-1) / sizeof(value_type); } sl@0: void construct(pointer __p, const _Tp& __val) const { stlport::construct(__p, __val); } sl@0: void destroy(pointer __p) const { stlport::destroy(__p); } sl@0: }; sl@0: sl@0: template inline bool _STLP_CALL operator==(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return true; } sl@0: template inline bool _STLP_CALL operator!=(const EH_allocator<_T1>&, const EH_allocator<_T1>&) { return false; } sl@0: sl@0: _STLP_BEGIN_NAMESPACE sl@0: // If custom allocators are being used without member template classes support : sl@0: // user (on purpose) is forced to define rebind/get operations !!! sl@0: template sl@0: inline EH_allocator<_Tp2>& _STLP_CALL sl@0: __stl_alloc_rebind(EH_allocator<_Tp1>& __a, const _Tp2*) { return (EH_allocator<_Tp2>&)(__a); } sl@0: template sl@0: inline EH_allocator<_Tp2> _STLP_CALL sl@0: __stl_alloc_create(const EH_allocator<_Tp1>&, const _Tp2*) { return EH_allocator<_Tp2>(); } sl@0: _STLP_END_NAMESPACE sl@0: sl@0: # define eh_allocator(T) ::EH_allocator sl@0: sl@0: # define EH_BIT_VECTOR_IMPLEMENTED sl@0: sl@0: # if defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) && !defined(_STLP_NO_BOOL) sl@0: # define EH_BIT_VECTOR EH_STD::vector sl@0: # else sl@0: # ifdef _STLP_NO_BOOL sl@0: # undef EH_BIT_VECTOR_IMPLEMENTED sl@0: # else sl@0: # define EH_BIT_VECTOR EH_STD::vector sl@0: # endif sl@0: # endif sl@0: sl@0: #else // !USE_SGI_STL sl@0: //========================================================================= sl@0: // Configuration for testing other non-SGI STL implementations sl@0: //========================================================================= sl@0: sl@0: // Metrowerks configuration sl@0: # ifdef __MWERKS__ sl@0: sl@0: # define EH_ASSERT assert sl@0: // Get MSL configuration header sl@0: # include sl@0: sl@0: # if __MSL__ >= 24 sl@0: sl@0: # define EH_NEW_HEADERS 1 sl@0: # if defined (_MSL_USING_NAMESPACE) sl@0: # define EH_USE_NAMESPACES 1 sl@0: # endif sl@0: # define EH_BIT_VECTOR vector sl@0: # define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0) sl@0: sl@0: # else sl@0: sl@0: # error No configuration for earlier versions of MSL sl@0: sl@0: # endif // __MSL__ >= 24 sl@0: sl@0: // Bugs fixed in CWPro3 sl@0: # if __MWERKS__ < 0x2100 sl@0: # define EH_TEMPLATE_PARAM_SUBTYPE_BUG 1 sl@0: # endif sl@0: sl@0: // Bugs in CWPro3 sl@0: # if __MWERKS__ <= 0x2110 sl@0: # define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1 sl@0: # else sl@0: # pragma warning not sure the above bug is fixed yet sl@0: # endif sl@0: sl@0: # define EH_SLIST_IMPLEMENTED 1 sl@0: //# define EH_HASHED_CONTAINERS_IMPLEMENTED 1 sl@0: sl@0: # define EH_NEW_IOSTREAMS 1 sl@0: # define EH_USE_NOTHROW 1 sl@0: # endif // Metrowerks configuration sl@0: sl@0: #if defined (__SUNPRO_CC) sl@0: # define stl_destroy __RWSTD::__destroy sl@0: # define EH_DISTANCE( a, b, result ) distance( a, b, result ) sl@0: # define EH_BIT_VECTOR EH_STD::vector sl@0: # define EH_NEW_HEADERS 1 sl@0: # define EH_USE_NAMESPACES 1 sl@0: # define EH_NEW_IOSTREAMS 1 sl@0: # define EH_ASSERT assert sl@0: # define EH_STRING_IMPLEMENTED 1 sl@0: # elif defined (__KCC) sl@0: # define stl_destroy EH_STD::destroy sl@0: # define EH_DISTANCE( a, b, result ) do { result = distance( a, b ); } while (0) sl@0: # define EH_BIT_VECTOR EH_STD::vector sl@0: # define EH_NEW_HEADERS 1 sl@0: # define EH_USE_NAMESPACES 1 sl@0: # define EH_NEW_IOSTREAMS 1 sl@0: # define EH_ASSERT assert sl@0: # define EH_CSTD sl@0: # define EH_STRING_IMPLEMENTED 1 sl@0: # define EH_MULTI_CONST_TEMPLATE_ARG_BUG 1 sl@0: # define EH_SELECT1ST_HINT select1st sl@0: # else sl@0: # define stl_destroy destroy sl@0: #endif sl@0: sl@0: // sl@0: // Compiler-independent configuration sl@0: // sl@0: # ifdef EH_USE_NAMESPACES sl@0: # ifdef STLPORT sl@0: # define EH_STD STLPORT sl@0: # else sl@0: # define EH_STD std sl@0: # endif sl@0: # ifdef STLPORT_CSTD sl@0: # define EH_STD STLPORT_CSTD sl@0: # else sl@0: # define EH_STD std sl@0: # endif sl@0: # define EH_BEGIN_NAMESPACE namespace EH_STD { sl@0: # define EH_END_NAMESPACE } sl@0: # else sl@0: # define EH_BEGIN_NAMESPACE sl@0: # define EH_END_NAMESPACE sl@0: # define EH_STD sl@0: # endif sl@0: sl@0: # ifndef EH_CSTD sl@0: # define EH_CSTD EH_STD sl@0: # endif sl@0: sl@0: #endif // !USE_SGI_STL sl@0: sl@0: sl@0: // sl@0: // Library-independent configuration. sl@0: // sl@0: #if defined( EH_MULTI_CONST_TEMPLATE_ARG_BUG) && !defined( EH_SELECT1ST_HINT ) sl@0: template sl@0: // JDJ (CW Pro1 doesn't like const when first_type is also const) sl@0: struct eh_select1st_hint : public unary_function { sl@0: const U& operator () (const Pair& x) const { return x.first; } sl@0: }; sl@0: # define EH_SELECT1ST_HINT eh_select1st_hint sl@0: #endif sl@0: sl@0: sl@0: #if EH_USE_NAMESPACES sl@0: # define EH_USE_STD using namespace EH_STD; sl@0: #else sl@0: # define EH_USE_STD sl@0: #endif sl@0: sl@0: #if defined (EH_USE_NAMESPACES) && !defined(_STLP_VENDOR_GLOBAL_CSTD) sl@0: # define USING_CSTD_NAME(name) using EH_CSTD :: name; sl@0: #else sl@0: # define USING_CSTD_NAME(name) sl@0: #endif sl@0: sl@0: #endif // INCLUDED_MOTU_Prefix