features.h revision 0e7a705cd6f755153c1f2cceb09af1e515ca9f1d
1 /* 2 * 3 * Copyright (c) 1994 4 * Hewlett-Packard Company 5 * 6 * Copyright (c) 1996,1997 7 * Silicon Graphics Computer Systems, Inc. 8 * 9 * Copyright (c) 1997 10 * Moscow Center for SPARC Technology 11 * 12 * Copyright (c) 1999 13 * Boris Fomitchev 14 * 15 * This material is provided "as is", with absolutely no warranty expressed 16 * or implied. Any use is at your own risk. 17 * 18 * Permission to use or copy this software for any purpose is hereby granted 19 * without fee, provided the above notices are retained on all copies. 20 * Permission to modify the code and to distribute modified code is granted, 21 * provided the above notices are retained, and a notice that the code was 22 * modified is included with the above copyright notice. 23 * 24 */ 25 26#ifndef _STLP_FEATURES_H 27#define _STLP_FEATURES_H 28 29/* 30 * Purpose of this file: 31 * 32 * Defines all STLport settings. 33 * This file is actually a wrapper : it includes compiler-specific 34 * settings from <config/stlcomp.h> 35 * and user-defined settings from <config/user_config.h>. 36 * See <config/stl_mycomp.h> and <config/user_config.h> for the description 37 * of those macros 38 * 39 */ 40 41/* Definition of the STLport version informations */ 42#include <stl/_stlport_version.h> 43 44/* Other macros defined by this file: 45 46 * bool, true, and false, if _STLP_NO_BOOL is defined. 47 * typename, as a null macro if it's not already a keyword. 48 * explicit, as a null macro if it's not already a keyword. 49 * namespace-related macros (_STLP_STD, _STLP_BEGIN_NAMESPACE, etc.) 50 * exception-related macros (_STLP_TRY, _STLP_UNWIND, etc.) 51 * _STLP_ASSERT, either as a test or as a null macro, depending on 52 whether or not _STLP_ASSERTIONS is defined. 53*/ 54 55/* Definition of the 2 STLport debug levels */ 56#define _STLP_STLPORT_DBG_LEVEL 1 57#define _STLP_STANDARD_DBG_LEVEL 2 58 59/* Placeholder for user to override settings. 60 * It could be also used to mask settings from 61 * different directories. 62 */ 63#include <stl/config/user_config.h> 64 65#ifdef __GNUC__ 66# define _STLP_UNUSED(x) x __attribute__((unused)) 67#else 68# define _STLP_UNUSED(x) x 69#endif /* __GNUC__ */ 70 71#if defined (_STLP_DEBUG) && !defined (_STLP_DEBUG_LEVEL) 72# define _STLP_DEBUG_LEVEL _STLP_STLPORT_DBG_LEVEL 73#endif 74 75#if defined (__BUILDING_STLPORT) 76/* For the STLport implementation we can use everything: 77 */ 78# if defined (_STLP_NO_ANACHRONISMS) 79# undef _STLP_NO_ANACHRONISMS 80# endif 81# if defined (_STLP_NO_EXTENSIONS) 82# undef _STLP_NO_EXTENSIONS 83# endif 84/* Moreover there are things that have no sens: 85 */ 86# if defined (_STLP_NO_IOSTREAMS) 87# error If you do not use iostreams you do not need to build the STLport library. 88# endif 89#endif 90 91/* ========================================================= */ 92/* This file is used for compatibility; it accepts old-style config 93 switches */ 94#include <stl/config/compat.h> 95 96/* Common configuration file for this particular installation. */ 97#include <stl/config/host.h> 98 99/* Operational Environment specific */ 100#include <stl/config/_system.h> 101 102/* ========================================================= */ 103 104/* some fixes to configuration. This also includes modifications 105 * of STLport switches depending on compiler flags, 106 * or settings applicable to a group of compilers, such as 107 * to all who use EDG front-end. 108 */ 109#include <stl/config/stl_confix.h> 110 111#if !defined (_STLP_NO_MEMBER_TEMPLATES) && !defined (_STLP_MEMBER_TEMPLATES) 112# define _STLP_MEMBER_TEMPLATES 1 113#endif 114 115#if !defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_MEMBER_TEMPLATE_CLASSES) 116# define _STLP_MEMBER_TEMPLATE_CLASSES 1 117#endif 118 119#if defined (_STLP_NO_MEMBER_TEMPLATE_CLASSES) && !defined (_STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE) 120# define _STLP_DONT_SUPPORT_REBIND_MEMBER_TEMPLATE 1 121#endif 122 123#if !defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) 124# define _STLP_CLASS_PARTIAL_SPECIALIZATION 1 125#endif 126 127#if !defined (_STLP_FUNCTION_TMPL_PARTIAL_ORDER) && !defined (_STLP_NO_FUNCTION_TMPL_PARTIAL_ORDER) 128# define _STLP_FUNCTION_TMPL_PARTIAL_ORDER 1 129#endif 130 131#if !defined (_STLP_DONT_USE_SHORT_STRING_OPTIM) && !defined (_STLP_USE_SHORT_STRING_OPTIM) 132# define _STLP_USE_SHORT_STRING_OPTIM 1 133#endif 134 135#if defined (_STLP_MEMBER_TEMPLATES) && !defined (_STLP_NO_EXTENSIONS) && \ 136 !defined (_STLP_NO_CONTAINERS_EXTENSION) && !defined (_STLP_USE_CONTAINERS_EXTENSION) 137# define _STLP_USE_CONTAINERS_EXTENSION 138#endif 139 140#if defined (_STLP_USE_CONTAINERS_EXTENSION) 141# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT> 142#else 143# define _STLP_TEMPLATE_FOR_CONT_EXT 144#endif 145 146#if defined (_STLP_USE_PTR_SPECIALIZATIONS) && \ 147 (defined (_STLP_NO_CLASS_PARTIAL_SPECIALIZATION) && defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)) 148# error Sorry but according the STLport settings your compiler can not support the pointer specialization feature. 149#endif 150 151#if defined (_STLP_WHOLE_NATIVE_STD) && defined (_STLP_NO_OWN_NAMESPACE) 152# error Sorry but asking for both STLport to be in the real std namespace and also having STLport import all native std stuff \ 153 is invalid, chose one or none. 154#endif 155 156#if defined (_STLP_VERBOSE) && !defined (_STLP_VERBOSE_MODE_SUPPORTED) 157# error Sorry but the verbose mode is not implemented for your compiler. 158#endif 159 160#if defined (_STLP_NO_IOSTREAMS) && \ 161 !defined (_STLP_USE_NEWALLOC) && !defined (_STLP_USE_MALLOC) 162# define _STLP_USE_NEWALLOC 163#endif 164 165#if !defined (_STLP_BIG_ENDIAN) && !defined (_STLP_LITTLE_ENDIAN) 166# if defined (_MIPSEB) || defined (__sparc) || defined (_AIX) || \ 167 defined (__hpux) || defined (macintosh) || defined (_MAC) 168# define _STLP_BIG_ENDIAN 1 169# elif defined (__i386) || defined (_M_IX86) || defined (_M_ARM) || \ 170 defined (__amd64__) || defined (_M_AMD64) || defined (__x86_64__) || \ 171 defined (__alpha__) || defined (_MIPSEL) 172# define _STLP_LITTLE_ENDIAN 1 173# elif defined (__ia64__) 174 /* itanium allows both settings (for instance via gcc -mbig-endian) - hence a seperate check is required */ 175# if defined (__BIG_ENDIAN__) 176# define _STLP_BIG_ENDIAN 1 177# else 178# define _STLP_LITTLE_ENDIAN 1 179# endif 180# else 181# error "can't determine endianess" 182# endif 183#endif /* _STLP_BIG_ENDIAN */ 184 185/* ========================================================== 186 * final workaround tuning based on given flags 187 * ========================================================== */ 188 189#ifndef _STLP_UINT32_T 190# define _STLP_UINT32_T unsigned long 191#endif 192#ifndef _STLP_ABORT 193# define _STLP_ABORT() abort() 194#endif 195 196#if !defined (_STLP_HAS_NO_NAMESPACES) 197# if defined _STLP_NO_NAMESPACES 198# undef _STLP_USE_NAMESPACES 199# else 200/* assume it as the default, turn it off later if NO_NAMESPACES selected */ 201# undef _STLP_USE_NAMESPACES 202# define _STLP_USE_NAMESPACES 1 203# endif 204#endif 205 206#if defined (_STLP_NO_IOSTREAMS) 207# define _STLP_USE_NO_IOSTREAMS 208#endif 209 210/* Operating system recognition (basic) */ 211#if (defined(__unix) || defined(__linux__) || defined(__QNX__) || defined(_AIX) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__Lynx__) || defined(__hpux) || defined(__sgi)) && \ 212 !defined (_STLP_UNIX) 213# define _STLP_UNIX 1 214#endif /* __unix */ 215 216#if !defined (_STLP_NO_LONG_DOUBLE) 217# define _STLP_LONGEST_FLOAT_TYPE long double 218#else 219# define _STLP_LONGEST_FLOAT_TYPE double 220#endif 221 222/* Native headers access macros */ 223#if !defined (_STLP_HAS_INCLUDE_NEXT) 224# include <stl/config/_native_headers.h> 225#endif 226 227/* shared library tune-up */ 228 229#if defined (__BUILDING_STLPORT) 230/* if we are rebuilding right now, place everything here */ 231# undef _STLP_DESIGNATED_DLL 232# define _STLP_DESIGNATED_DLL 1 233#endif 234 235/* Use own namespace always if possible and not explicitly instructed otherwise */ 236#if defined (_STLP_USE_NAMESPACES) && !defined (_STLP_BROKEN_USING_DIRECTIVE) && \ 237 !defined (_STLP_NO_OWN_NAMESPACE) 238# undef _STLP_USE_OWN_NAMESPACE 239# define _STLP_USE_OWN_NAMESPACE 1 240#else 241# undef _STLP_WHOLE_NATIVE_STD 242#endif 243 244#if !defined (_NOTHREADS) && !defined (_STLP_THREADS_DEFINED) 245 246# if defined (_PTHREADS) 247# define _STLP_PTHREADS 248# define _STLP_THREADS 249# endif 250# if defined (_UITHREADS) 251# define _STLP_UITHREADS 252# define _STLP_THREADS 253# endif 254 255# if defined (_STLP_WIN32) && !defined (_STLP_PTHREADS) 256# define _STLP_WIN32THREADS 1 257# elif ((defined (__sun) && !defined (__linux__)) || defined (_UITHREADS) ) && \ 258 !defined(_STLP_PTHREADS) 259# define _STLP_UITHREADS 260# else 261# define _STLP_PTHREADS 262# endif /* __sgi */ 263# define _STLP_THREADS_DEFINED 264#endif 265 266#if (defined (_REENTRANT) || defined (_THREAD_SAFE)) && !defined (_STLP_THREADS) 267# define _STLP_THREADS 268#endif 269 270#ifndef _STLP_STATIC_MUTEX 271# define _STLP_STATIC_MUTEX _STLP_mutex_base 272#endif 273 274#if (defined (_MFC_VER) || defined (_AFXDLL)) && !defined (_STLP_USE_MFC) 275# define _STLP_USE_MFC 1 276#endif 277 278#if defined (_STLP_THREADS) 279# define _STLP_VOLATILE volatile 280#else 281# define _STLP_VOLATILE 282#endif 283 284#if !defined (_STLP_USE_NEW_C_HEADERS) && !defined (_STLP_HAS_NO_NEW_C_HEADERS) 285# define _STLP_USE_NEW_C_HEADERS 286#endif 287/* disable new-style headers if requested */ 288#if defined (_STLP_NO_NEW_C_HEADERS) 289# undef _STLP_USE_NEW_C_HEADERS 290#endif 291 292#if defined (_STLP_BASE_TYPEDEF_BUG) 293# undef _STLP_BASE_TYPEDEF_OUTSIDE_BUG 294# define _STLP_BASE_TYPEDEF_OUTSIDE_BUG 1 295#endif 296 297#if defined (_STLP_NESTED_TYPE_PARAM_BUG) 298# define _STLP_GLOBAL_NESTED_RETURN_TYPE_PARAM_BUG 299#endif 300 301/* SUNpro 4.2 inline string literal bug */ 302#ifdef _STLP_INLINE_STRING_LITERAL_BUG 303# define _STLP_FIX_LITERAL_BUG(__x) __x = __x; 304#else 305# define _STLP_FIX_LITERAL_BUG(__x) 306#endif 307 308#if defined (_STLP_NON_TYPE_TMPL_PARAM_BUG) 309# undef _STLP_NO_DEFAULT_NON_TYPE_PARAM 310# define _STLP_NO_DEFAULT_NON_TYPE_PARAM 1 311#endif 312 313#if !defined (_STLP_STATIC_ASSERT) 314/* Some compiler support 0 size array so we use negative size array to generate 315 * a compilation time error. 316 */ 317# define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1] __attribute__((__unused__)); 318#endif 319 320/* apple mpw exception handling bug */ 321#ifndef _STLP_MPWFIX_TRY 322# define _STLP_MPWFIX_TRY 323#endif 324#ifndef _STLP_MPWFIX_CATCH 325# define _STLP_MPWFIX_CATCH 326#endif 327#ifndef _STLP_MPWFIX_CATCH_ACTION 328# define _STLP_MPWFIX_CATCH_ACTION(action) 329#endif 330 331#if !defined (_STLP_WEAK) 332# define _STLP_WEAK 333#endif 334 335/* default parameters as template types derived from arguments ( not always supported ) */ 336#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) 337# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname 338#else 339# if !defined (_STLP_DEFAULT_TYPE_PARAM) 340# define _STLP_DEFAULT_TYPE_PARAM 1 341# endif 342# define _STLP_DFL_TMPL_PARAM( classname, defval ) class classname = defval 343#endif 344 345#if defined (_STLP_LIMITED_DEFAULT_TEMPLATES) 346# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) class _Alloc 347#else 348# define _STLP_DEFAULT_PAIR_ALLOCATOR_SELECT(_Key, _Tp ) \ 349 class _Alloc = allocator< pair < _Key, _Tp > > 350#endif 351 352/* default parameters as complete types */ 353#if defined (_STLP_DEFAULT_TYPE_PARAM) 354# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname = defval 355# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name = val 356#else 357# define _STLP_DFL_TYPE_PARAM( classname, defval ) class classname 358# define _STLP_DFL_NON_TYPE_PARAM(type,name,val) type name 359#endif 360 361/* SGI compatibility */ 362 363#ifdef _STLP_NO_WCHAR_T 364# ifndef _STLP_NO_NATIVE_WIDE_STREAMS 365# define _STLP_NO_NATIVE_WIDE_STREAMS 1 366# endif 367#else 368# define _STLP_HAS_WCHAR_T 1 369#endif 370 371#if !defined (_STLP_NO_AT_MEMBER_FUNCTION) 372# define _STLP_CAN_THROW_RANGE_ERRORS 1 373#endif 374 375/* debug mode tool */ 376#if defined (_STLP_DEBUG) 377# define _STLP_NON_DBG_NAME(X) _NonDbg_##X 378#endif 379 380/* pointer specialization tool */ 381#if defined (_STLP_USE_PTR_SPECIALIZATIONS) 382# define _STLP_PTR_IMPL_NAME(X) _Impl_##X 383#endif 384 385#if defined (_STLP_USE_MSVC6_MEM_T_BUG_WORKAROUND) || \ 386 defined (_STLP_SIGNAL_RUNTIME_COMPATIBILITY) || defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) 387# define _STLP_NO_MEM_T_NAME(X) _NoMemT_##X 388#endif 389 390/* this always mean the C library is in global namespace */ 391#if defined (_STLP_HAS_NO_NEW_C_HEADERS) && !defined (_STLP_VENDOR_GLOBAL_CSTD) 392# define _STLP_VENDOR_GLOBAL_CSTD 1 393#endif 394 395/* Depending of whether compiler supports namespaces, 396 * tune the parameters for vendor-supplied libraries. 397 * This section is guarded by _STLP_HAS_NO_NAMESPACES, not by _STLP_USE_NAMESPACES, 398 * since it depends only on the native features, not on user's preference whether 399 * to use namespace for STLport or not. 400 */ 401#if !defined (_STLP_HAS_NO_NAMESPACES) 402/* Import some vendor's headers into corresponding STLport ones if they might be needed 403 * (if we wrap native iostreams and use namepace other than std::) */ 404# if defined (_STLP_WHOLE_NATIVE_STD) 405# define _STLP_IMPORT_VENDOR_STD 1 406# endif 407 408/* if using stlport:: namespace or if C library stuff is not in vendor's std::, 409 * try importing 'em. 410 * MSVC has ambiguity problem when we try to import C-style std:: stuff back into global namespace */ 411# if defined (_STLP_USE_NAMESPACES) && (defined(_STLP_USE_OWN_NAMESPACE) || defined (_STLP_VENDOR_GLOBAL_CSTD)) 412# define _STLP_IMPORT_VENDOR_CSTD 1 413# endif 414 415# if defined (_STLP_NO_USING_FOR_GLOBAL_FUNCTIONS) && !defined (_STLP_DO_IMPORT_CSTD_FUNCTIONS) 416# define _STLP_NO_CSTD_FUNCTION_IMPORTS 417# endif 418 419# define _STLP_USING_NAMESPACE(x) using namespace x ; 420 421namespace std { } 422namespace __std_alias = std; 423 424/* assume std:: namespace for C++ std library if not being told otherwise */ 425# if defined (_STLP_VENDOR_GLOBAL_STD) 426# define _STLP_VENDOR_STD 427# else 428# define _STLP_VENDOR_STD std 429# endif 430 431/* tune things that come from C library */ 432# if defined (_STLP_VENDOR_GLOBAL_CSTD) || !defined(_STLP_USE_NEW_C_HEADERS) 433/* in old-style headers, C functions go to global scope. */ 434# define _STLP_VENDOR_CSTD 435# define _STLP_USING_VENDOR_CSTD 436# else 437# define _STLP_VENDOR_CSTD _STLP_VENDOR_STD 438# define _STLP_USING_VENDOR_CSTD _STLP_USING_NAMESPACE(_STLP_VENDOR_CSTD) 439# endif /* _STLP_VENDOR_CSTD */ 440/* exception, typeinfo, new - always come from the vendor */ 441# if !defined (_STLP_VENDOR_EXCEPT_STD) 442# if defined (_STLP_VENDOR_GLOBAL_EXCEPT_STD) 443# define _STLP_VENDOR_EXCEPT_STD 444# else 445# define _STLP_VENDOR_EXCEPT_STD _STLP_VENDOR_STD 446# endif 447# endif 448# define _STLP_OLD_IO_NAMESPACE 449# if !defined (_STLP_VENDOR_MB_NAMESPACE) 450# define _STLP_VENDOR_MB_NAMESPACE _STLP_VENDOR_CSTD 451# endif 452#else 453/* compiler has no namespace support */ 454# define _STLP_VENDOR_STD 455# define _STLP_VENDOR_CSTD 456# define _STLP_USING_NAMESPACE(x) 457# define _STLP_USING_VENDOR_CSTD 458# define _STLP_VENDOR_EXCEPT_STD 459#endif 460 461#if defined (_STLP_USE_NAMESPACES) 462 463# if defined (_STLP_USE_OWN_NAMESPACE) 464# if !defined (_STLP_STD_NAME) 465# if !defined (_STLP_DEBUG) 466# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) 467# ifndef _STLP_THREADS 468# define _STLP_STD_NAME stlpmtx_std 469# else 470# define _STLP_STD_NAME stlp_std 471# endif 472# else 473# ifndef _STLP_THREADS 474# define _STLP_STD_NAME stlpxmtx_std 475# else 476# define _STLP_STD_NAME stlpx_std 477# endif 478# endif 479# else 480/* 481 * The STLport debug mode is binary incompatible with the other modes, 482 * lets make it clear on the STLport namespace to generate link errors rather 483 * than runtime ones. 484 */ 485# if !defined (_STLP_USING_CROSS_NATIVE_RUNTIME_LIB) 486# ifndef _STLP_THREADS 487# define _STLP_STD_NAME stlpdmtx_std 488# else 489# define _STLP_STD_NAME stlpd_std 490# endif 491# else 492# ifndef _STLP_THREADS 493# define _STLP_STD_NAME stlpdxmtx_std 494# else 495# define _STLP_STD_NAME stlpdx_std 496# endif 497# endif 498# endif 499# endif 500namespace _STLP_STD_NAME { } 501# else 502# define _STLP_STD_NAME std 503# endif /* _STLP_USE_OWN_NAMESPACE */ 504 505# define _STLP_BEGIN_NAMESPACE namespace _STLP_STD_NAME { 506# define _STLP_BEGIN_TR1_NAMESPACE namespace tr1 { 507# define _STLP_END_NAMESPACE } 508 509/* decide whether or not we use separate namespace for rel ops */ 510# if defined (_STLP_NO_RELOPS_NAMESPACE) 511# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops {} 512# define _STLP_END_RELOPS_NAMESPACE } 513# else 514/* Use std::rel_ops namespace */ 515# define _STLP_BEGIN_RELOPS_NAMESPACE _STLP_BEGIN_NAMESPACE namespace rel_ops { 516# define _STLP_END_RELOPS_NAMESPACE } } 517# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE 518# endif /* Use std::rel_ops namespace */ 519 520# define _STLP_STD ::_STLP_STD_NAME 521# if !defined (_STLP_TR1) 522# define _STLP_TR1 _STLP_STD::tr1:: 523# endif 524 525# if !defined (_STLP_DONT_USE_PRIV_NAMESPACE) 526# define _STLP_PRIV_NAME priv 527# define _STLP_PRIV _STLP_STD::_STLP_PRIV_NAME:: 528# define _STLP_MOVE_TO_PRIV_NAMESPACE namespace _STLP_PRIV_NAME { 529# define _STLP_MOVE_TO_STD_NAMESPACE } 530# else 531# if !defined (_STLP_PRIV) 532# define _STLP_PRIV _STLP_STD:: 533# endif 534# define _STLP_MOVE_TO_PRIV_NAMESPACE 535# define _STLP_MOVE_TO_STD_NAMESPACE 536# endif 537 538/* Official STLport namespace when std is not redefined. 539 * Here we don't use a macro because we do not need it and because 540 * stlport is used as file name by boost and folder name under beos: 541 */ 542namespace stlport = _STLP_STD_NAME; 543 544/* Backward compatibility: 545 */ 546namespace _STL = _STLP_STD_NAME; 547#undef __STLPORT_NAMESPACE 548#define __STLPORT_NAMESPACE _STLP_STD_NAME 549 550#else /* _STLP_USE_NAMESPACES */ 551/* STLport is being put into global namespace */ 552# define _STLP_STD 553# define _STLP_PRIV 554# define _STLP_TR1 555# define _STLP_BEGIN_NAMESPACE 556# define _STLP_BEGIN_TR1_NAMESPACE 557# define _STLP_END_NAMESPACE 558# define _STLP_MOVE_TO_PRIV_NAMESPACE 559# define _STLP_MOVE_TO_STD_NAMESPACE 560 561/* boris : it was found out that _STLP_USE_SEPARATE_RELOPS_NAMESPACE 562 causes less problems than having relational operator templates in global namespace 563 Please define _STLP_NO_RELOPS_NAMESPACE in config/user_config.h if your code rely on them. */ 564# if !defined (_STLP_NO_RELOPS_NAMESPACE) 565# define _STLP_USE_SEPARATE_RELOPS_NAMESPACE 566# endif 567# define _STLP_BEGIN_RELOPS_NAMESPACE 568# define _STLP_END_RELOPS_NAMESPACE 569# undef _STLP_USE_OWN_NAMESPACE 570#endif /* _STLP_USE_NAMESPACES */ 571 572#define STLPORT_CSTD _STLP_VENDOR_CSTD 573#define STLPORT _STLP_STD_NAME 574 575#if defined(_STLP_BOGUS_TEMPLATE_TYPE_MATCHING_BUG) 576# define _STLP_SIMPLE_TYPE(T) _stl_trivial_proxy<T> 577#else 578# define _STLP_SIMPLE_TYPE(T) T 579#endif 580 581#ifndef _STLP_RAND48 582# define _STLP_NO_DRAND48 583#endif 584 585/* advanced keywords usage */ 586#define __C_CAST(__x, __y) ((__x)(__y)) 587#ifndef _STLP_NO_NEW_STYLE_CASTS 588# define __CONST_CAST(__x,__y) const_cast<__x>(__y) 589# define __STATIC_CAST(__x,__y) static_cast<__x>(__y) 590# define __REINTERPRET_CAST(__x,__y) reinterpret_cast<__x>(__y) 591#else 592# define __STATIC_CAST(__x,__y) __C_CAST(__x, __y) 593# define __CONST_CAST(__x,__y) __C_CAST(__x, __y) 594# define __REINTERPRET_CAST(__x,__y) __C_CAST(__x, __y) 595#endif 596 597#if defined (_STLP_NEED_TYPENAME) && ! defined (typename) 598# define typename 599#endif 600 601#if defined (_STLP_NEED_TYPENAME) || defined (_STLP_NO_TYPENAME_ON_RETURN_TYPE ) 602# define _STLP_TYPENAME_ON_RETURN_TYPE 603#else 604# define _STLP_TYPENAME_ON_RETURN_TYPE typename 605#endif 606 607#ifdef _STLP_NO_TYPENAME_IN_TEMPLATE_HEADER 608# define _STLP_HEADER_TYPENAME 609#else 610# define _STLP_HEADER_TYPENAME typename 611#endif 612 613#ifdef _STLP_NO_TYPENAME_BEFORE_NAMESPACE 614# define _STLP_TYPENAME 615#else 616# define _STLP_TYPENAME typename 617#endif 618 619#ifndef _STLP_NO_MEMBER_TEMPLATE_KEYWORD 620# define _STLP_TEMPLATE template 621#else 622# define _STLP_TEMPLATE 623#endif 624 625#if defined (_STLP_USE_CONTAINERS_EXTENSION) 626# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) 627# define _STLP_TEMPLATE_FOR_CONT_EXT template <class _KT> 628#else 629# define _STLP_KEY_TYPE_FOR_CONT_EXT(type) typedef type _KT; 630# define _STLP_TEMPLATE_FOR_CONT_EXT 631#endif 632 633#if defined (_STLP_NEED_EXPLICIT) && !defined (explicit) 634# define explicit 635#endif 636 637#if !defined (_STLP_NEED_MUTABLE) 638# define _STLP_MUTABLE(type, x) x 639#else 640# define _STLP_MUTABLE(type, x) __CONST_CAST(type*, this)->x 641# define mutable 642#endif 643 644#if defined (_STLP_NO_SIGNED_BUILTINS) 645/* old HP-UX doesn't understand "signed" keyword */ 646# define signed 647#endif 648 649#if defined (_STLP_LOOP_INLINE_PROBLEMS) 650# define _STLP_INLINE_LOOP 651#else 652# define _STLP_INLINE_LOOP inline 653#endif 654 655#ifndef _STLP_NO_PARTIAL_SPECIALIZATION_SYNTAX 656# define _STLP_TEMPLATE_NULL template<> 657#else 658# define _STLP_TEMPLATE_NULL 659#endif 660 661#ifdef _STLP_FUNCTION_TMPL_PARTIAL_ORDER 662# define _STLP_OPERATOR_TEMPLATE 663#else 664# define _STLP_OPERATOR_TEMPLATE _STLP_TEMPLATE_NULL 665#endif 666 667#ifndef _STLP_CLASS_PARTIAL_SPECIALIZATION 668/* unless we have other compiler problem, try simulating partial spec here */ 669# if !defined (_STLP_DONT_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS) 670# define _STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS 671# endif 672/* For your own iterators, please use inheritance from iterator<> instead of these obsolete queries. */ 673# if (defined (_STLP_NESTED_TYPE_PARAM_BUG) || !defined (_STLP_SIMULATE_PARTIAL_SPEC_FOR_TYPE_TRAITS)) 674# if ! defined ( _STLP_USE_OLD_HP_ITERATOR_QUERIES ) 675# define _STLP_USE_OLD_HP_ITERATOR_QUERIES 676# endif 677# elif defined ( _STLP_NO_ANACHRONISMS ) 678# undef _STLP_USE_OLD_HP_ITERATOR_QUERIES 679# endif 680#endif 681 682#ifndef _STLP_NO_EXPLICIT_FUNCTION_TMPL_ARGS 683# define _STLP_NULL_TMPL_ARGS <> 684# else 685# define _STLP_NULL_TMPL_ARGS 686#endif 687 688#if !defined (_STLP_ALLOCATOR_TYPE_DFL) 689# if defined (_STLP_DONT_SUP_DFLT_PARAM) 690# define _STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS 691# endif 692# if defined (_STLP_NEEDS_EXTRA_TEMPLATE_CONSTRUCTORS) 693# define _STLP_ALLOCATOR_TYPE_DFL 694# else 695# define _STLP_ALLOCATOR_TYPE_DFL = allocator_type() 696# endif 697#endif 698 699/* When the compiler do not correctly initialized the basic types value in default parameters we prefer 700 * to avoid them to be able to correct this bug. 701 */ 702#if defined (_STLP_DEF_CONST_DEF_PARAM_BUG) 703# define _STLP_DONT_SUP_DFLT_PARAM 1 704#endif 705 706#if defined (__SGI_STL_NO_ARROW_OPERATOR) && ! defined (_STLP_NO_ARROW_OPERATOR) 707# define _STLP_NO_ARROW_OPERATOR 708#endif 709 710#if !defined (_STLP_CLASS_PARTIAL_SPECIALIZATION) 711# if !(defined (_STLP_NO_ARROW_OPERATOR)) && \ 712 !defined (_STLP_NO_MSVC50_COMPATIBILITY) && !defined (_STLP_MSVC50_COMPATIBILITY) 713/* this one is needed for proper reverse_iterator<> operator ->() handling */ 714# define _STLP_MSVC50_COMPATIBILITY 1 715# endif 716#endif 717 718#if defined ( _STLP_CLASS_PARTIAL_SPECIALIZATION ) 719# if (defined(__IBMCPP__) && (500 <= __IBMCPP__) && (__IBMCPP__ < 600) ) 720# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ 721 typedef typename _STLP_STD :: reverse_iterator<const_iterator> const_reverse_iterator; \ 722 typedef typename _STLP_STD :: reverse_iterator<iterator> reverse_iterator 723# elif (defined (__sgi) && ! defined (__GNUC__)) || defined (__SUNPRO_CC) || defined (__xlC__) 724# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ 725 typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<const_iterator> const_reverse_iterator; \ 726 typedef _STLP_STD:: _STLP_TEMPLATE reverse_iterator<iterator> reverse_iterator 727# else 728# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ 729 typedef _STLP_STD::reverse_iterator<const_iterator> const_reverse_iterator; \ 730 typedef _STLP_STD::reverse_iterator<iterator> reverse_iterator 731# endif 732#else /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ 733# if defined (_STLP_MSVC50_COMPATIBILITY) 734# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ 735 typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \ 736 const_pointer, difference_type> const_reverse_iterator; \ 737 typedef _STLP_STD::__reverse_iterator<iterator, value_type, reference, pointer, difference_type> \ 738 reverse_iterator 739# else 740# define _STLP_DECLARE_REVERSE_ITERATORS(__reverse_iterator) \ 741 typedef _STLP_STD::__reverse_iterator<const_iterator, value_type, const_reference, \ 742 difference_type> const_reverse_iterator; \ 743 typedef _STLP_STD::__reverse_iterator<iterator, value_type, \ 744 reference, difference_type> \ 745 reverse_iterator 746# endif 747#endif /* _STLP_CLASS_PARTIAL_SPECIALIZATION */ 748 749#define _STLP_DECLARE_BIDIRECTIONAL_REVERSE_ITERATORS \ 750 _STLP_DECLARE_REVERSE_ITERATORS(reverse_bidirectional_iterator) 751#define _STLP_DECLARE_RANDOM_ACCESS_REVERSE_ITERATORS \ 752 _STLP_DECLARE_REVERSE_ITERATORS(reverse_iterator) 753 754#define __IMPORT_CONTAINER_TYPEDEFS(_Super) \ 755 typedef typename _Super::value_type value_type; \ 756 typedef typename _Super::size_type size_type; \ 757 typedef typename _Super::difference_type difference_type; \ 758 typedef typename _Super::reference reference; \ 759 typedef typename _Super::const_reference const_reference; \ 760 typedef typename _Super::pointer pointer; \ 761 typedef typename _Super::const_pointer const_pointer; \ 762 typedef typename _Super::allocator_type allocator_type; 763 764 765#define __IMPORT_ITERATORS(_Super) \ 766 typedef typename _Super::iterator iterator; \ 767 typedef typename _Super::const_iterator const_iterator; 768 769#define __IMPORT_REVERSE_ITERATORS(_Super) \ 770 typedef typename _Super::const_reverse_iterator const_reverse_iterator; \ 771 typedef typename _Super::reverse_iterator reverse_iterator; 772 773#define __IMPORT_SUPER_COPY_ASSIGNMENT(__derived_name, _Self, _SUPER) \ 774 __derived_name(const _Super& __x) : _SUPER(__x) {} \ 775 _Self& operator=(const _Super& __x) { \ 776 *(_Super*)this = __x; \ 777 return *this; \ 778 } \ 779 __derived_name(const _Self& __x) : _SUPER(__x) {} \ 780 _Self& operator=(const _Self& __x) { \ 781 *(_Super*)this = __x; \ 782 return *this; \ 783 } 784 785#define __IMPORT_WITH_ITERATORS(_Super) \ 786 __IMPORT_CONTAINER_TYPEDEFS(_Super) __IMPORT_ITERATORS(_Super) 787 788#define __IMPORT_WITH_REVERSE_ITERATORS(_Super) \ 789 __IMPORT_WITH_ITERATORS(_Super) __IMPORT_REVERSE_ITERATORS(_Super) 790 791#if defined (_STLP_TRIVIAL_CONSTRUCTOR_BUG) 792# define __TRIVIAL_CONSTRUCTOR(__type) __type() {} 793#else 794# define __TRIVIAL_CONSTRUCTOR(__type) 795#endif 796 797#if defined (_STLP_TRIVIAL_DESTRUCTOR_BUG) 798# define __TRIVIAL_DESTRUCTOR(__type) ~__type() {} 799#else 800# define __TRIVIAL_DESTRUCTOR(__type) 801#endif 802 803#define __TRIVIAL_STUFF(__type) \ 804 __TRIVIAL_CONSTRUCTOR(__type) __TRIVIAL_DESTRUCTOR(__type) 805 806#if defined (_STLP_STATIC_CONST_INIT_BUG) 807# define _STLP_STATIC_CONSTANT(__type, __assignment) enum { __assignment } 808#else 809# define _STLP_STATIC_CONSTANT(__type, __assignment) static const __type __assignment 810#endif 811 812#if defined (_STLP_HAS_NO_EXCEPTIONS) 813# define _STLP_NO_EXCEPTIONS 814#endif 815 816#if !defined (_STLP_DONT_USE_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_USE_EXCEPTIONS) 817# define _STLP_USE_EXCEPTIONS 818#endif 819 820#if defined (_STLP_USE_EXCEPTIONS) 821# define _STLP_TRY try 822# define _STLP_CATCH_ALL catch(...) 823# ifndef _STLP_THROW 824# define _STLP_THROW(x) throw x 825# endif 826# define _STLP_RETHROW throw 827 828# define _STLP_UNWIND(action) catch(...) { action; throw; } 829 830# ifdef _STLP_THROW_RETURN_BUG 831# define _STLP_RET_AFTER_THROW(data) return data; 832# else 833# define _STLP_RET_AFTER_THROW(data) 834# endif 835 836# if !defined (_STLP_THROWS) 837# define _STLP_THROWS(x) throw(x) 838# endif 839# if !defined (_STLP_NOTHROW) 840# define _STLP_NOTHROW throw() 841# endif 842#else 843# define _STLP_TRY 844# define _STLP_CATCH_ALL if (false) 845# ifndef _STLP_THROW 846# define _STLP_THROW(x) 847# endif 848# define _STLP_RETHROW {} 849# define _STLP_UNWIND(action) 850# define _STLP_THROWS(x) 851# define _STLP_NOTHROW 852# define _STLP_RET_AFTER_THROW(data) 853#endif 854 855/* 856 * Here we check _STLP_NO_EXCEPTIONS which means that the compiler has no 857 * exception support but not the _STLP_USE_EXCEPTIONS which simply means 858 * that the user do not want to use them. 859 */ 860#if !defined (_STLP_NO_EXCEPTIONS) && !defined (_STLP_NO_EXCEPTION_SPEC) 861# define _STLP_THROWS_INHERENTLY(x) throw x 862# define _STLP_NOTHROW_INHERENTLY throw() 863#else 864# define _STLP_THROWS_INHERENTLY(x) 865# define _STLP_NOTHROW_INHERENTLY 866#endif 867 868/* STLport function not returning are functions that throw so we translate 869 * the noreturn functions in throwing functions taking also into account 870 * exception support activation. 871 */ 872#if defined (_STLP_NORETURN_FUNCTION) && !defined (_STLP_NO_EXCEPTIONS) && \ 873 !defined (_STLP_FUNCTION_THROWS) 874# define _STLP_FUNCTION_THROWS _STLP_NORETURN_FUNCTION 875#else 876# define _STLP_FUNCTION_THROWS 877#endif 878 879#if defined(_STLP_NO_BOOL) 880# if (defined (__IBMCPP__) && (__IBMCPP__ < 400)) && ! defined (_AIX) 881# include <isynonym.hpp> 882# if defined (__OS400__) 883typedef int bool; 884# elif !( defined (__xlC__) || defined (_AIX)) 885typedef Boolean bool; 886# endif 887# else 888# if defined(_STLP_YVALS_H) 889# include <yvals.h> 890# else 891# if defined (_STLP_DONT_USE_BOOL_TYPEDEF) 892# define bool int 893# else 894typedef int bool; 895# endif 896# define true 1 897# define false 0 898# endif 899# endif /* __IBMCPP__ */ 900#else 901# define _STLP_BOOL_KEYWORD 1 902#endif /* _STLP_NO_BOOL */ 903 904/* uninitialized value filler */ 905#ifndef _STLP_SHRED_BYTE 906/* This value is designed to cause problems if an error occurs */ 907# define _STLP_SHRED_BYTE 0xA3 908#endif /* _STLP_SHRED_BYTE */ 909 910/* shared library tune-up */ 911#ifndef _STLP_IMPORT_DECLSPEC 912# define _STLP_IMPORT_DECLSPEC 913#endif 914 915/* a keyword used to instantiate export template */ 916#ifndef _STLP_EXPORT_TEMPLATE_KEYWORD 917# define _STLP_EXPORT_TEMPLATE_KEYWORD 918#endif 919#ifndef _STLP_IMPORT_TEMPLATE_KEYWORD 920# define _STLP_IMPORT_TEMPLATE_KEYWORD 921#endif 922 923#if !defined (_STLP_NO_CONST_IN_PAIR) 924# define _STLP_CONST const 925#else 926# define _STLP_CONST 927#endif 928 929#ifdef _STLP_USE_NO_IOSTREAMS 930/* 931 * If we do not use iostreams we do not use the export/import 932 * techniques to avoid build of the STLport library. 933 */ 934# undef _STLP_USE_DECLSPEC 935/* We also undef USE_DYNAMIC_LIB macro as this macro add some code 936 * to use the dynamic (shared) STLport library for some platform/compiler 937 * configuration leading to problem when not linking to the STLport lib. 938 */ 939# undef _STLP_USE_DYNAMIC_LIB 940#endif 941 942#if defined (_STLP_DLLEXPORT_NEEDS_PREDECLARATION) && defined (_STLP_USE_DECLSPEC) 943# if ! defined (_STLP_USE_TEMPLATE_EXPORT) 944/* this setting turns on "extern template" extension use */ 945# define _STLP_USE_TEMPLATE_EXPORT 946# endif 947# if defined (_STLP_DESIGNATED_DLL) && ! defined (_STLP_NO_FORCE_INSTANTIATE) 948# define _STLP_NO_FORCE_INSTANTIATE 949# endif 950#endif 951 952#if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */ 953# define _STLP_EXPORT _STLP_EXPORT_TEMPLATE_KEYWORD 954#else 955# define _STLP_EXPORT _STLP_IMPORT_TEMPLATE_KEYWORD 956#endif 957 958#ifndef _STLP_EXPORT_TEMPLATE 959# define _STLP_EXPORT_TEMPLATE _STLP_EXPORT template 960#endif 961 962#if defined (_STLP_USE_DECLSPEC) /* using export/import technique */ 963 964# ifndef _STLP_EXPORT_DECLSPEC 965# define _STLP_EXPORT_DECLSPEC 966# endif 967# ifndef _STLP_IMPORT_DECLSPEC 968# define _STLP_IMPORT_DECLSPEC 969# endif 970# ifndef _STLP_CLASS_EXPORT_DECLSPEC 971# define _STLP_CLASS_EXPORT_DECLSPEC 972# endif 973# ifndef _STLP_CLASS_IMPORT_DECLSPEC 974# define _STLP_CLASS_IMPORT_DECLSPEC 975# endif 976# if defined (_STLP_DESIGNATED_DLL) /* This is a lib which will contain STLport exports */ 977# define _STLP_DECLSPEC _STLP_EXPORT_DECLSPEC 978# define _STLP_CLASS_DECLSPEC _STLP_CLASS_EXPORT_DECLSPEC 979# else 980# define _STLP_DECLSPEC _STLP_IMPORT_DECLSPEC /* Other modules, importing STLport exports */ 981# define _STLP_CLASS_DECLSPEC _STLP_CLASS_IMPORT_DECLSPEC 982# endif 983 984#else /* Not using DLL export/import specifications */ 985 986# define _STLP_DECLSPEC 987# define _STLP_CLASS_DECLSPEC 988 989#endif 990 991#define _STLP_EXPORT_TEMPLATE_CLASS _STLP_EXPORT template class _STLP_CLASS_DECLSPEC 992 993#if defined (_STLP_NEED_ADDITIONAL_STATIC_DECLSPEC) 994# define _STLP_STATIC_DECLSPEC _STLP_DECLSPEC 995#else 996# define _STLP_STATIC_DECLSPEC 997#endif 998 999#if !defined (_STLP_CALL) 1000# define _STLP_CALL 1001#endif 1002 1003#ifndef _STLP_USE_NO_IOSTREAMS 1004 1005# if defined (__DECCXX) && ! defined (__USE_STD_IOSTREAM) 1006# define __USE_STD_IOSTREAM 1007# endif 1008 1009/* We only need to expose details of streams implementation 1010 if we use non-standard i/o or are building STLport*/ 1011# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) || !defined(_STLP_NO_CUSTOM_IO) 1012# define _STLP_EXPOSE_STREAM_IMPLEMENTATION 1 1013# endif 1014 1015/* We only need to expose details of global implementation if we are building STLport 1016 or have not instantiated everything in the lib */ 1017# if defined (__BUILDING_STLPORT) || defined (_STLP_NO_FORCE_INSTANTIATE) 1018# undef _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1019# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1 1020# endif 1021 1022#else /* _STLP_USE_NO_IOSTREAMS */ 1023/* when we are not using SGI iostreams, we must expose globals, but not streams implementation */ 1024# define _STLP_EXPOSE_GLOBALS_IMPLEMENTATION 1025#endif /* _STLP_USE_NO_IOSTREAMS */ 1026 1027#ifdef _STLP_PARTIAL_SPEC_NEEDS_TEMPLATE_ARGS 1028# define _STLP_PSPEC2(t1,t2) < t1,t2 > 1029# define _STLP_PSPEC3(t1,t2,t3) < t1,t2,t3 > 1030#else 1031# define _STLP_PSPEC2(t1,t2) /* nothing */ 1032# define _STLP_PSPEC3(t1,t2,t3) /* nothing */ 1033#endif 1034 1035/* Activation of the partial template workaround: 1036 */ 1037#if !defined(_STLP_DONT_USE_PARTIAL_SPEC_WRKD) &&\ 1038 (!defined(_STLP_CLASS_PARTIAL_SPECIALIZATION) || !defined(_STLP_FUNCTION_TMPL_PARTIAL_ORDER)) 1039# define _STLP_USE_PARTIAL_SPEC_WORKAROUND 1040#endif 1041 1042#ifdef _STLP_USE_SEPARATE_RELOPS_NAMESPACE 1043# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) \ 1044_TMPL inline bool _STLP_CALL operator!=(const _TP& __x, const _TP& __y) {return !(__x == __y);}\ 1045_TMPL inline bool _STLP_CALL operator>(const _TP& __x, const _TP& __y) {return __y < __x;}\ 1046_TMPL inline bool _STLP_CALL operator<=(const _TP& __x, const _TP& __y) { return !(__y < __x);}\ 1047_TMPL inline bool _STLP_CALL operator>=(const _TP& __x, const _TP& __y) { return !(__x < __y);} 1048#else 1049# define _STLP_RELOPS_OPERATORS(_TMPL, _TP) 1050#endif 1051 1052#if defined ( _STLP_USE_ABBREVS ) 1053# include <stl/_abbrevs.h> 1054#endif 1055 1056/* Some really useful macro */ 1057#define _STLP_ARRAY_SIZE(A) sizeof(A) / sizeof(A[0]) 1058#define _STLP_ARRAY_AND_SIZE(A) A, sizeof(A) / sizeof(A[0]) 1059 1060#if !defined (_STLP_MARK_PARAMETER_AS_UNUSED) 1061# define _STLP_MARK_PARAMETER_AS_UNUSED(X) (void*)X; 1062#endif 1063 1064#if defined (_STLP_CHECK_RUNTIME_COMPATIBILITY) 1065# if defined (_STLP_USE_NO_IOSTREAMS) 1066# undef _STLP_CHECK_RUNTIME_COMPATIBILITY 1067# else 1068/* The extern "C" simply makes the symbol simpler. */ 1069#if defined (__cplusplus) 1070extern "C" 1071#endif 1072void _STLP_DECLSPEC _STLP_CALL _STLP_CHECK_RUNTIME_COMPATIBILITY(); 1073# endif 1074#endif 1075 1076/* some cleanup */ 1077#undef _STLP_DONT_USE_BOOL_TYPEDEF 1078#undef _STLP_YVALS_H 1079#undef _STLP_LOOP_INLINE_PROBLEMS 1080#undef _STLP_NEED_EXPLICIT 1081#undef _STLP_NEED_TYPENAME 1082#undef _STLP_NO_NEW_STYLE_CASTS 1083#undef __AUTO_CONFIGURED 1084 1085#endif /* _STLP_FEATURES_H */ 1086