blob: a8168b67a33c5118db7afe394b78c8c2892258af [file] [log] [blame]
/*
*
* Copyright (c) 1998-2002
* John Maddock
*
* Use, modification and distribution are subject to the
* Boost Software License, Version 1.0. (See accompanying file
* LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*/
/*
* LOCATION: see http://www.boost.org for most recent version.
* FILE config.hpp
* VERSION see <ndnboost/version.hpp>
* DESCRIPTION: regex extended config setup.
*/
#ifndef NDNBOOST_REGEX_CONFIG_HPP
#define NDNBOOST_REGEX_CONFIG_HPP
/*
* Borland C++ Fix/error check
* this has to go *before* we include any std lib headers:
*/
#if defined(__BORLANDC__)
# include <ndnboost/regex/config/borland.hpp>
#endif
/*****************************************************************************
*
* Include all the headers we need here:
*
****************************************************************************/
#ifdef __cplusplus
# ifndef NDNBOOST_REGEX_USER_CONFIG
# define NDNBOOST_REGEX_USER_CONFIG <ndnboost/regex/user.hpp>
# endif
# include NDNBOOST_REGEX_USER_CONFIG
# include <ndnboost/config.hpp>
#else
/*
* C build,
* don't include <ndnboost/config.hpp> because that may
* do C++ specific things in future...
*/
# include <stdlib.h>
# include <stddef.h>
# ifdef _MSC_VER
# define NDNBOOST_MSVC _MSC_VER
# endif
#endif
/*****************************************************************************
*
* Boilerplate regex config options:
*
****************************************************************************/
/* Obsolete macro, use NDNBOOST_VERSION instead: */
#define NDNBOOST_RE_VERSION 320
/* fix: */
#if defined(_UNICODE) && !defined(UNICODE)
#define UNICODE
#endif
/*
* Fix for gcc prior to 3.4: std::ctype<wchar_t> doesn't allow
* masks to be combined, for example:
* std::use_facet<std::ctype<wchar_t> >.is(std::ctype_base::lower|std::ctype_base::upper, L'a');
* returns *false*.
*/
#ifdef __GLIBCPP__
# define NDNBOOST_REGEX_BUGGY_CTYPE_FACET
#endif
/*
* Intel C++ before 8.0 ends up with unresolved externals unless we turn off
* extern template support:
*/
#if defined(NDNBOOST_INTEL) && defined(__cplusplus) && (NDNBOOST_INTEL <= 800)
# define NDNBOOST_REGEX_NO_EXTERNAL_TEMPLATES
#endif
/*
* Visual C++ doesn't support external templates with C++ extensions turned off:
*/
#if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
# define NDNBOOST_REGEX_NO_EXTERNAL_TEMPLATES
#endif
/*
* Shared regex lib will crash without this, frankly it looks a lot like a gcc bug:
*/
#if defined(__MINGW32__)
# define NDNBOOST_REGEX_NO_EXTERNAL_TEMPLATES
#endif
/*
* If there isn't good enough wide character support then there will
* be no wide character regular expressions:
*/
#if (defined(NDNBOOST_NO_CWCHAR) || defined(NDNBOOST_NO_CWCTYPE) || defined(NDNBOOST_NO_STD_WSTRING))
# if !defined(NDNBOOST_NO_WREGEX)
# define NDNBOOST_NO_WREGEX
# endif
#else
# if defined(__sgi) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
/* STLPort on IRIX is misconfigured: <cwctype> does not compile
* as a temporary fix include <wctype.h> instead and prevent inclusion
* of STLPort version of <cwctype> */
# include <wctype.h>
# define __STLPORT_CWCTYPE
# define _STLP_CWCTYPE
# endif
#ifdef __cplusplus
# include <ndnboost/regex/config/cwchar.hpp>
#endif
#endif
/*
* If Win32 support has been disabled for boost in general, then
* it is for regex in particular:
*/
#if defined(NDNBOOST_DISABLE_WIN32) && !defined(NDNBOOST_REGEX_NO_W32)
# define NDNBOOST_REGEX_NO_W32
#endif
/* disable our own file-iterators and mapfiles if we can't
* support them: */
#if !defined(NDNBOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(NDNBOOST_REGEX_NO_W32))
# define NDNBOOST_REGEX_NO_FILEITER
#endif
/* backwards compatibitity: */
#if defined(NDNBOOST_RE_NO_LIB)
# define NDNBOOST_REGEX_NO_LIB
#endif
#if defined(__GNUC__) && (defined(_WIN32) || defined(__CYGWIN__))
/* gcc on win32 has problems if you include <windows.h>
(sporadically generates bad code). */
# define NDNBOOST_REGEX_NO_W32
#endif
#if defined(__COMO__) && !defined(NDNBOOST_REGEX_NO_W32) && !defined(_MSC_EXTENSIONS)
# define NDNBOOST_REGEX_NO_W32
#endif
/*****************************************************************************
*
* Wide character workarounds:
*
****************************************************************************/
/*
* define NDNBOOST_REGEX_HAS_OTHER_WCHAR_T when wchar_t is a native type, but the users
* code may be built with wchar_t as unsigned short: basically when we're building
* with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions
* of the non-inline functions in the library, so that users can still link to the lib,
* irrespective of whether their own code is built with /Zc:wchar_t.
* Note that this does NOT WORK with VC10 when the C++ locale is in effect as
* the locale's <unsigned short> facets simply do not compile in that case.
*/
#if defined(__cplusplus) && (defined(NDNBOOST_MSVC) || defined(__ICL)) && !defined(NDNBOOST_NO_INTRINSIC_WCHAR_T) && defined(NDNBOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && !defined(NDNBOOST_RWSTD_VER) && ((_MSC_VER < 1600) || !defined(NDNBOOST_REGEX_USE_CPP_LOCALE))
# define NDNBOOST_REGEX_HAS_OTHER_WCHAR_T
# ifdef NDNBOOST_MSVC
# pragma warning(push)
# pragma warning(disable : 4251 4231)
# if NDNBOOST_MSVC < 1600
# pragma warning(disable : 4660)
# endif
# endif
# if defined(_DLL) && defined(NDNBOOST_MSVC) && (NDNBOOST_MSVC < 1600)
# include <string>
extern template class __declspec(dllimport) std::basic_string<unsigned short>;
# endif
# ifdef NDNBOOST_MSVC
# pragma warning(pop)
# endif
#endif
/*****************************************************************************
*
* Set up dll import/export options:
*
****************************************************************************/
#ifndef NDNBOOST_SYMBOL_EXPORT
# define NDNBOOST_SYMBOL_EXPORT
# define NDNBOOST_SYMBOL_IMPORT
#endif
#if (defined(NDNBOOST_REGEX_DYN_LINK) || defined(NDNBOOST_ALL_DYN_LINK)) && !defined(NDNBOOST_REGEX_STATIC_LINK)
# if defined(NDNBOOST_REGEX_SOURCE)
# define NDNBOOST_REGEX_DECL NDNBOOST_SYMBOL_EXPORT
# define NDNBOOST_REGEX_BUILD_DLL
# else
# define NDNBOOST_REGEX_DECL NDNBOOST_SYMBOL_IMPORT
# endif
#else
# define NDNBOOST_REGEX_DECL
#endif
#if !defined(NDNBOOST_REGEX_NO_LIB) && !defined(NDNBOOST_REGEX_SOURCE) && !defined(NDNBOOST_ALL_NO_LIB) && defined(__cplusplus)
# define NDNBOOST_LIB_NAME ndnboost_regex
# if defined(NDNBOOST_REGEX_DYN_LINK) || defined(NDNBOOST_ALL_DYN_LINK)
# define NDNBOOST_DYN_LINK
# endif
# ifdef NDNBOOST_REGEX_DIAG
# define NDNBOOST_LIB_DIAGNOSTIC
# endif
# include <ndnboost/config/auto_link.hpp>
#endif
/*****************************************************************************
*
* Set up function call type:
*
****************************************************************************/
#if defined(NDNBOOST_MSVC) && (NDNBOOST_MSVC >= 1200) && defined(_MSC_EXTENSIONS)
#if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED) || defined(NDNBOOST_REGEX_NO_FASTCALL)
# define NDNBOOST_REGEX_CALL __cdecl
#else
# define NDNBOOST_REGEX_CALL __fastcall
#endif
# define NDNBOOST_REGEX_CCALL __cdecl
#endif
#if defined(__BORLANDC__) && !defined(NDNBOOST_DISABLE_WIN32)
# define NDNBOOST_REGEX_CALL __fastcall
# define NDNBOOST_REGEX_CCALL __stdcall
#endif
#ifndef NDNBOOST_REGEX_CALL
# define NDNBOOST_REGEX_CALL
#endif
#ifndef NDNBOOST_REGEX_CCALL
#define NDNBOOST_REGEX_CCALL
#endif
/*****************************************************************************
*
* Set up localisation model:
*
****************************************************************************/
/* backwards compatibility: */
#ifdef NDNBOOST_RE_LOCALE_C
# define NDNBOOST_REGEX_USE_C_LOCALE
#endif
#ifdef NDNBOOST_RE_LOCALE_CPP
# define NDNBOOST_REGEX_USE_CPP_LOCALE
#endif
#if defined(__CYGWIN__)
# define NDNBOOST_REGEX_USE_C_LOCALE
#endif
/* Win32 defaults to native Win32 locale: */
#if defined(_WIN32) && !defined(NDNBOOST_REGEX_USE_WIN32_LOCALE) && !defined(NDNBOOST_REGEX_USE_C_LOCALE) && !defined(NDNBOOST_REGEX_USE_CPP_LOCALE) && !defined(NDNBOOST_REGEX_NO_W32)
# define NDNBOOST_REGEX_USE_WIN32_LOCALE
#endif
/* otherwise use C++ locale if supported: */
#if !defined(NDNBOOST_REGEX_USE_WIN32_LOCALE) && !defined(NDNBOOST_REGEX_USE_C_LOCALE) && !defined(NDNBOOST_REGEX_USE_CPP_LOCALE) && !defined(NDNBOOST_NO_STD_LOCALE)
# define NDNBOOST_REGEX_USE_CPP_LOCALE
#endif
/* otherwise use C+ locale: */
#if !defined(NDNBOOST_REGEX_USE_WIN32_LOCALE) && !defined(NDNBOOST_REGEX_USE_C_LOCALE) && !defined(NDNBOOST_REGEX_USE_CPP_LOCALE)
# define NDNBOOST_REGEX_USE_C_LOCALE
#endif
#ifndef NDNBOOST_REGEX_MAX_STATE_COUNT
# define NDNBOOST_REGEX_MAX_STATE_COUNT 100000000
#endif
/*****************************************************************************
*
* Error Handling for exception free compilers:
*
****************************************************************************/
#ifdef NDNBOOST_NO_EXCEPTIONS
/*
* If there are no exceptions then we must report critical-errors
* the only way we know how; by terminating.
*/
#include <stdexcept>
#include <string>
#include <ndnboost/throw_exception.hpp>
# define NDNBOOST_REGEX_NOEH_ASSERT(x)\
if(0 == (x))\
{\
std::string s("Error: critical regex++ failure in: ");\
s.append(#x);\
std::runtime_error e(s);\
ndnboost::throw_exception(e);\
}
#else
/*
* With exceptions then error handling is taken care of and
* there is no need for these checks:
*/
# define NDNBOOST_REGEX_NOEH_ASSERT(x)
#endif
/*****************************************************************************
*
* Stack protection under MS Windows:
*
****************************************************************************/
#if !defined(NDNBOOST_REGEX_NO_W32) && !defined(NDNBOOST_REGEX_V3)
# if(defined(_WIN32) || defined(_WIN64) || defined(_WINCE)) \
&& !defined(__GNUC__) \
&& !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)) \
&& !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003))
# define NDNBOOST_REGEX_HAS_MS_STACK_GUARD
# endif
#elif defined(NDNBOOST_REGEX_HAS_MS_STACK_GUARD)
# undef NDNBOOST_REGEX_HAS_MS_STACK_GUARD
#endif
#if defined(__cplusplus) && defined(NDNBOOST_REGEX_HAS_MS_STACK_GUARD)
namespace ndnboost{
namespace re_detail{
NDNBOOST_REGEX_DECL void NDNBOOST_REGEX_CALL reset_stack_guard_page();
}
}
#endif
/*****************************************************************************
*
* Algorithm selection and configuration:
*
****************************************************************************/
#if !defined(NDNBOOST_REGEX_RECURSIVE) && !defined(NDNBOOST_REGEX_NON_RECURSIVE)
# if defined(NDNBOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG) && !(defined(NDNBOOST_MSVC) && (NDNBOOST_MSVC >= 1400))
# define NDNBOOST_REGEX_RECURSIVE
# else
# define NDNBOOST_REGEX_NON_RECURSIVE
# endif
#endif
#ifdef NDNBOOST_REGEX_NON_RECURSIVE
# ifdef NDNBOOST_REGEX_RECURSIVE
# error "Can't set both NDNBOOST_REGEX_RECURSIVE and NDNBOOST_REGEX_NON_RECURSIVE"
# endif
# ifndef NDNBOOST_REGEX_BLOCKSIZE
# define NDNBOOST_REGEX_BLOCKSIZE 4096
# endif
# if NDNBOOST_REGEX_BLOCKSIZE < 512
# error "NDNBOOST_REGEX_BLOCKSIZE must be at least 512"
# endif
# ifndef NDNBOOST_REGEX_MAX_BLOCKS
# define NDNBOOST_REGEX_MAX_BLOCKS 1024
# endif
# ifdef NDNBOOST_REGEX_HAS_MS_STACK_GUARD
# undef NDNBOOST_REGEX_HAS_MS_STACK_GUARD
# endif
# ifndef NDNBOOST_REGEX_MAX_CACHE_BLOCKS
# define NDNBOOST_REGEX_MAX_CACHE_BLOCKS 16
# endif
#endif
/*****************************************************************************
*
* helper memory allocation functions:
*
****************************************************************************/
#if defined(__cplusplus) && defined(NDNBOOST_REGEX_NON_RECURSIVE)
namespace ndnboost{ namespace re_detail{
NDNBOOST_REGEX_DECL void* NDNBOOST_REGEX_CALL get_mem_block();
NDNBOOST_REGEX_DECL void NDNBOOST_REGEX_CALL put_mem_block(void*);
}} /* namespaces */
#endif
/*****************************************************************************
*
* Diagnostics:
*
****************************************************************************/
#ifdef NDNBOOST_REGEX_CONFIG_INFO
NDNBOOST_REGEX_DECL void NDNBOOST_REGEX_CALL print_regex_library_info();
#endif
#if defined(NDNBOOST_REGEX_DIAG)
# pragma message ("NDNBOOST_REGEX_DECL" NDNBOOST_STRINGIZE(=NDNBOOST_REGEX_DECL))
# pragma message ("NDNBOOST_REGEX_CALL" NDNBOOST_STRINGIZE(=NDNBOOST_REGEX_CALL))
# pragma message ("NDNBOOST_REGEX_CCALL" NDNBOOST_STRINGIZE(=NDNBOOST_REGEX_CCALL))
#ifdef NDNBOOST_REGEX_USE_C_LOCALE
# pragma message ("Using C locale in regex traits class")
#elif NDNBOOST_REGEX_USE_CPP_LOCALE
# pragma message ("Using C++ locale in regex traits class")
#else
# pragma message ("Using Win32 locale in regex traits class")
#endif
#if defined(NDNBOOST_REGEX_DYN_LINK) || defined(NDNBOOST_ALL_DYN_LINK)
# pragma message ("Dynamic linking enabled")
#endif
#if defined(NDNBOOST_REGEX_NO_LIB) || defined(NDNBOOST_ALL_NO_LIB)
# pragma message ("Auto-linking disabled")
#endif
#ifdef NDNBOOST_REGEX_NO_EXTERNAL_TEMPLATES
# pragma message ("Extern templates disabled")
#endif
#endif
#endif