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