Chris@16: /* Chris@16: * Chris@16: * Copyright (c) 1998-2002 Chris@16: * John Maddock Chris@16: * Chris@16: * Use, modification and distribution are subject to the Chris@16: * Boost Software License, Version 1.0. (See accompanying file Chris@16: * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) Chris@16: * Chris@16: */ Chris@16: Chris@16: /* Chris@16: * LOCATION: see http://www.boost.org for most recent version. Chris@16: * FILE config.hpp Chris@16: * VERSION see Chris@16: * DESCRIPTION: regex extended config setup. Chris@16: */ Chris@16: Chris@16: #ifndef BOOST_REGEX_CONFIG_HPP Chris@16: #define BOOST_REGEX_CONFIG_HPP Chris@16: /* Chris@16: * Borland C++ Fix/error check Chris@16: * this has to go *before* we include any std lib headers: Chris@16: */ Chris@16: #if defined(__BORLANDC__) Chris@16: # include Chris@16: #endif Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Include all the headers we need here: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: #ifdef __cplusplus Chris@16: Chris@16: # ifndef BOOST_REGEX_USER_CONFIG Chris@16: # define BOOST_REGEX_USER_CONFIG Chris@16: # endif Chris@16: Chris@16: # include BOOST_REGEX_USER_CONFIG Chris@16: Chris@16: # include Chris@16: Chris@16: #else Chris@16: /* Chris@16: * C build, Chris@16: * don't include because that may Chris@16: * do C++ specific things in future... Chris@16: */ Chris@16: # include Chris@16: # include Chris@16: # ifdef _MSC_VER Chris@16: # define BOOST_MSVC _MSC_VER Chris@16: # endif Chris@16: #endif Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Boilerplate regex config options: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: /* Obsolete macro, use BOOST_VERSION instead: */ Chris@16: #define BOOST_RE_VERSION 320 Chris@16: Chris@16: /* fix: */ Chris@16: #if defined(_UNICODE) && !defined(UNICODE) Chris@16: #define UNICODE Chris@16: #endif Chris@16: Chris@16: /* Chris@16: * Fix for gcc prior to 3.4: std::ctype doesn't allow Chris@16: * masks to be combined, for example: Chris@16: * std::use_facet >.is(std::ctype_base::lower|std::ctype_base::upper, L'a'); Chris@16: * returns *false*. Chris@16: */ Chris@16: #ifdef __GLIBCPP__ Chris@16: # define BOOST_REGEX_BUGGY_CTYPE_FACET Chris@16: #endif Chris@16: Chris@16: /* Chris@16: * Intel C++ before 8.0 ends up with unresolved externals unless we turn off Chris@16: * extern template support: Chris@16: */ Chris@16: #if defined(BOOST_INTEL) && defined(__cplusplus) && (BOOST_INTEL <= 800) Chris@16: # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES Chris@16: #endif Chris@16: /* Chris@16: * Visual C++ doesn't support external templates with C++ extensions turned off: Chris@16: */ Chris@16: #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS) Chris@16: # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES Chris@16: #endif Chris@16: /* Chris@16: * Shared regex lib will crash without this, frankly it looks a lot like a gcc bug: Chris@16: */ Chris@16: #if defined(__MINGW32__) Chris@16: # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES Chris@16: #endif Chris@16: Chris@16: /* Chris@16: * If there isn't good enough wide character support then there will Chris@16: * be no wide character regular expressions: Chris@16: */ Chris@16: #if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING)) Chris@16: # if !defined(BOOST_NO_WREGEX) Chris@16: # define BOOST_NO_WREGEX Chris@16: # endif Chris@16: #else Chris@16: # if defined(__sgi) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) Chris@16: /* STLPort on IRIX is misconfigured: does not compile Chris@16: * as a temporary fix include instead and prevent inclusion Chris@16: * of STLPort version of */ Chris@16: # include Chris@16: # define __STLPORT_CWCTYPE Chris@16: # define _STLP_CWCTYPE Chris@16: # endif Chris@16: Chris@16: #ifdef __cplusplus Chris@16: # include Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: /* Chris@16: * If Win32 support has been disabled for boost in general, then Chris@16: * it is for regex in particular: Chris@16: */ Chris@16: #if defined(BOOST_DISABLE_WIN32) && !defined(BOOST_REGEX_NO_W32) Chris@16: # define BOOST_REGEX_NO_W32 Chris@16: #endif Chris@16: Chris@16: /* disable our own file-iterators and mapfiles if we can't Chris@16: * support them: */ Chris@16: #if !defined(BOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(BOOST_REGEX_NO_W32)) Chris@16: # define BOOST_REGEX_NO_FILEITER Chris@16: #endif Chris@16: Chris@16: /* backwards compatibitity: */ Chris@16: #if defined(BOOST_RE_NO_LIB) Chris@16: # define BOOST_REGEX_NO_LIB Chris@16: #endif Chris@16: Chris@16: #if defined(__GNUC__) && (defined(_WIN32) || defined(__CYGWIN__)) Chris@16: /* gcc on win32 has problems if you include Chris@16: (sporadically generates bad code). */ Chris@16: # define BOOST_REGEX_NO_W32 Chris@16: #endif Chris@16: #if defined(__COMO__) && !defined(BOOST_REGEX_NO_W32) && !defined(_MSC_EXTENSIONS) Chris@16: # define BOOST_REGEX_NO_W32 Chris@16: #endif Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Wide character workarounds: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: /* Chris@16: * define BOOST_REGEX_HAS_OTHER_WCHAR_T when wchar_t is a native type, but the users Chris@16: * code may be built with wchar_t as unsigned short: basically when we're building Chris@16: * with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions Chris@16: * of the non-inline functions in the library, so that users can still link to the lib, Chris@16: * irrespective of whether their own code is built with /Zc:wchar_t. Chris@16: * Note that this does NOT WORK with VC10 when the C++ locale is in effect as Chris@16: * the locale's facets simply do not compile in that case. Chris@16: */ Chris@16: #if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && !defined(BOOST_RWSTD_VER) && ((_MSC_VER < 1600) || !defined(BOOST_REGEX_USE_CPP_LOCALE)) Chris@16: # define BOOST_REGEX_HAS_OTHER_WCHAR_T Chris@16: # ifdef BOOST_MSVC Chris@16: # pragma warning(push) Chris@16: # pragma warning(disable : 4251 4231) Chris@16: # if BOOST_MSVC < 1600 Chris@16: # pragma warning(disable : 4660) Chris@16: # endif Chris@16: # endif Chris@16: # if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600) Chris@16: # include Chris@16: extern template class __declspec(dllimport) std::basic_string; Chris@16: # endif Chris@16: # ifdef BOOST_MSVC Chris@16: # pragma warning(pop) Chris@16: # endif Chris@16: #endif Chris@16: Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Set up dll import/export options: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: #ifndef BOOST_SYMBOL_EXPORT Chris@16: # define BOOST_SYMBOL_EXPORT Chris@16: # define BOOST_SYMBOL_IMPORT Chris@16: #endif Chris@16: Chris@16: #if (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK) Chris@16: # if defined(BOOST_REGEX_SOURCE) Chris@16: # define BOOST_REGEX_DECL BOOST_SYMBOL_EXPORT Chris@16: # define BOOST_REGEX_BUILD_DLL Chris@16: # else Chris@16: # define BOOST_REGEX_DECL BOOST_SYMBOL_IMPORT Chris@16: # endif Chris@16: #else Chris@16: # define BOOST_REGEX_DECL Chris@16: #endif Chris@16: Chris@16: #if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus) Chris@16: # define BOOST_LIB_NAME boost_regex Chris@16: # if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK) Chris@16: # define BOOST_DYN_LINK Chris@16: # endif Chris@16: # ifdef BOOST_REGEX_DIAG Chris@16: # define BOOST_LIB_DIAGNOSTIC Chris@16: # endif Chris@16: # include Chris@16: #endif Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Set up function call type: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@101: #if defined(BOOST_MSVC) && defined(_MSC_EXTENSIONS) Chris@16: #if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED) || defined(BOOST_REGEX_NO_FASTCALL) Chris@16: # define BOOST_REGEX_CALL __cdecl Chris@16: #else Chris@16: # define BOOST_REGEX_CALL __fastcall Chris@16: #endif Chris@16: # define BOOST_REGEX_CCALL __cdecl Chris@16: #endif Chris@16: Chris@16: #if defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32) Chris@16: # define BOOST_REGEX_CALL __fastcall Chris@16: # define BOOST_REGEX_CCALL __stdcall Chris@16: #endif Chris@16: Chris@16: #ifndef BOOST_REGEX_CALL Chris@16: # define BOOST_REGEX_CALL Chris@16: #endif Chris@16: #ifndef BOOST_REGEX_CCALL Chris@16: #define BOOST_REGEX_CCALL Chris@16: #endif Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Set up localisation model: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: /* backwards compatibility: */ Chris@16: #ifdef BOOST_RE_LOCALE_C Chris@16: # define BOOST_REGEX_USE_C_LOCALE Chris@16: #endif Chris@16: Chris@16: #ifdef BOOST_RE_LOCALE_CPP Chris@16: # define BOOST_REGEX_USE_CPP_LOCALE Chris@16: #endif Chris@16: Chris@16: #if defined(__CYGWIN__) Chris@16: # define BOOST_REGEX_USE_C_LOCALE Chris@16: #endif Chris@16: Chris@16: /* Win32 defaults to native Win32 locale: */ Chris@16: #if defined(_WIN32) && !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_REGEX_NO_W32) Chris@16: # define BOOST_REGEX_USE_WIN32_LOCALE Chris@16: #endif Chris@16: /* otherwise use C++ locale if supported: */ Chris@16: #if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_NO_STD_LOCALE) Chris@16: # define BOOST_REGEX_USE_CPP_LOCALE Chris@16: #endif Chris@16: /* otherwise use C+ locale: */ Chris@16: #if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) Chris@16: # define BOOST_REGEX_USE_C_LOCALE Chris@16: #endif Chris@16: Chris@16: #ifndef BOOST_REGEX_MAX_STATE_COUNT Chris@16: # define BOOST_REGEX_MAX_STATE_COUNT 100000000 Chris@16: #endif Chris@16: Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Error Handling for exception free compilers: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: #ifdef BOOST_NO_EXCEPTIONS Chris@16: /* Chris@16: * If there are no exceptions then we must report critical-errors Chris@16: * the only way we know how; by terminating. Chris@16: */ Chris@16: #include Chris@16: #include Chris@16: #include Chris@16: Chris@16: # define BOOST_REGEX_NOEH_ASSERT(x)\ Chris@16: if(0 == (x))\ Chris@16: {\ Chris@16: std::string s("Error: critical regex++ failure in: ");\ Chris@16: s.append(#x);\ Chris@16: std::runtime_error e(s);\ Chris@16: boost::throw_exception(e);\ Chris@16: } Chris@16: #else Chris@16: /* Chris@16: * With exceptions then error handling is taken care of and Chris@16: * there is no need for these checks: Chris@16: */ Chris@16: # define BOOST_REGEX_NOEH_ASSERT(x) Chris@16: #endif Chris@16: Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Stack protection under MS Windows: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: #if !defined(BOOST_REGEX_NO_W32) && !defined(BOOST_REGEX_V3) Chris@16: # if(defined(_WIN32) || defined(_WIN64) || defined(_WINCE)) \ Chris@16: && !defined(__GNUC__) \ Chris@16: && !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)) \ Chris@16: && !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003)) Chris@16: # define BOOST_REGEX_HAS_MS_STACK_GUARD Chris@16: # endif Chris@16: #elif defined(BOOST_REGEX_HAS_MS_STACK_GUARD) Chris@16: # undef BOOST_REGEX_HAS_MS_STACK_GUARD Chris@16: #endif Chris@16: Chris@16: #if defined(__cplusplus) && defined(BOOST_REGEX_HAS_MS_STACK_GUARD) Chris@16: Chris@16: namespace boost{ Chris@16: namespace re_detail{ Chris@16: Chris@16: BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page(); Chris@16: Chris@16: } Chris@16: } Chris@16: Chris@16: #endif Chris@16: Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Algorithm selection and configuration: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: #if !defined(BOOST_REGEX_RECURSIVE) && !defined(BOOST_REGEX_NON_RECURSIVE) Chris@16: # if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG) && !(defined(BOOST_MSVC) && (BOOST_MSVC >= 1400)) Chris@16: # define BOOST_REGEX_RECURSIVE Chris@16: # else Chris@16: # define BOOST_REGEX_NON_RECURSIVE Chris@16: # endif Chris@16: #endif Chris@16: Chris@16: #ifdef BOOST_REGEX_NON_RECURSIVE Chris@16: # ifdef BOOST_REGEX_RECURSIVE Chris@16: # error "Can't set both BOOST_REGEX_RECURSIVE and BOOST_REGEX_NON_RECURSIVE" Chris@16: # endif Chris@16: # ifndef BOOST_REGEX_BLOCKSIZE Chris@16: # define BOOST_REGEX_BLOCKSIZE 4096 Chris@16: # endif Chris@16: # if BOOST_REGEX_BLOCKSIZE < 512 Chris@16: # error "BOOST_REGEX_BLOCKSIZE must be at least 512" Chris@16: # endif Chris@16: # ifndef BOOST_REGEX_MAX_BLOCKS Chris@16: # define BOOST_REGEX_MAX_BLOCKS 1024 Chris@16: # endif Chris@16: # ifdef BOOST_REGEX_HAS_MS_STACK_GUARD Chris@16: # undef BOOST_REGEX_HAS_MS_STACK_GUARD Chris@16: # endif Chris@16: # ifndef BOOST_REGEX_MAX_CACHE_BLOCKS Chris@16: # define BOOST_REGEX_MAX_CACHE_BLOCKS 16 Chris@16: # endif Chris@16: #endif Chris@16: Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * helper memory allocation functions: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: #if defined(__cplusplus) && defined(BOOST_REGEX_NON_RECURSIVE) Chris@16: namespace boost{ namespace re_detail{ Chris@16: Chris@16: BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block(); Chris@16: BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*); Chris@16: Chris@16: }} /* namespaces */ Chris@16: #endif Chris@16: Chris@16: /***************************************************************************** Chris@16: * Chris@16: * Diagnostics: Chris@16: * Chris@16: ****************************************************************************/ Chris@16: Chris@16: #ifdef BOOST_REGEX_CONFIG_INFO Chris@16: BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info(); Chris@16: #endif Chris@16: Chris@16: #if defined(BOOST_REGEX_DIAG) Chris@16: # pragma message ("BOOST_REGEX_DECL" BOOST_STRINGIZE(=BOOST_REGEX_DECL)) Chris@16: # pragma message ("BOOST_REGEX_CALL" BOOST_STRINGIZE(=BOOST_REGEX_CALL)) Chris@16: # pragma message ("BOOST_REGEX_CCALL" BOOST_STRINGIZE(=BOOST_REGEX_CCALL)) Chris@16: #ifdef BOOST_REGEX_USE_C_LOCALE Chris@16: # pragma message ("Using C locale in regex traits class") Chris@16: #elif BOOST_REGEX_USE_CPP_LOCALE Chris@16: # pragma message ("Using C++ locale in regex traits class") Chris@16: #else Chris@16: # pragma message ("Using Win32 locale in regex traits class") Chris@16: #endif Chris@16: #if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK) Chris@16: # pragma message ("Dynamic linking enabled") Chris@16: #endif Chris@16: #if defined(BOOST_REGEX_NO_LIB) || defined(BOOST_ALL_NO_LIB) Chris@16: # pragma message ("Auto-linking disabled") Chris@16: #endif Chris@16: #ifdef BOOST_REGEX_NO_EXTERNAL_TEMPLATES Chris@16: # pragma message ("Extern templates disabled") Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: #endif Chris@16: Chris@16: Chris@16: Chris@16: