Update contrib.
3 * Copyright (c) 1998-2002
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13 * LOCATION: see http://www.boost.org for most recent version.
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: regex extended config setup.
19 #ifndef BOOST_REGEX_CONFIG_HPP
20 #define BOOST_REGEX_CONFIG_HPP
22 * Borland C++ Fix/error check
23 * this has to go *before* we include any std lib headers:
25 #if defined(__BORLANDC__)
26 # include <boost/regex/config/borland.hpp>
29 /*****************************************************************************
31 * Include all the headers we need here:
33 ****************************************************************************/
37 # ifndef BOOST_REGEX_USER_CONFIG
38 # define BOOST_REGEX_USER_CONFIG <boost/regex/user.hpp>
41 # include BOOST_REGEX_USER_CONFIG
43 # include <boost/config.hpp>
48 * don't include <boost/config.hpp> because that may
49 * do C++ specific things in future...
54 # define BOOST_MSVC _MSC_VER
58 /*****************************************************************************
60 * Boilerplate regex config options:
62 ****************************************************************************/
64 /* Obsolete macro, use BOOST_VERSION instead: */
65 #define BOOST_RE_VERSION 320
68 #if defined(_UNICODE) && !defined(UNICODE)
73 * Fix for gcc prior to 3.4: std::ctype<wchar_t> doesn't allow
74 * masks to be combined, for example:
75 * std::use_facet<std::ctype<wchar_t> >.is(std::ctype_base::lower|std::ctype_base::upper, L'a');
79 # define BOOST_REGEX_BUGGY_CTYPE_FACET
83 * Intel C++ before 8.0 ends up with unresolved externals unless we turn off
84 * extern template support:
86 #if defined(BOOST_INTEL) && defined(__cplusplus) && (BOOST_INTEL <= 800)
87 # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
91 * If there isn't good enough wide character support then there will
92 * be no wide character regular expressions:
94 #if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING))
95 # if !defined(BOOST_NO_WREGEX)
96 # define BOOST_NO_WREGEX
99 # if defined(__sgi) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
100 /* STLPort on IRIX is misconfigured: <cwctype> does not compile
101 * as a temporary fix include <wctype.h> instead and prevent inclusion
102 * of STLPort version of <cwctype> */
104 # define __STLPORT_CWCTYPE
105 # define _STLP_CWCTYPE
109 # include <boost/regex/config/cwchar.hpp>
115 * If Win32 support has been disabled for boost in general, then
116 * it is for regex in particular:
118 #if defined(BOOST_DISABLE_WIN32) && !defined(BOOST_REGEX_NO_W32)
119 # define BOOST_REGEX_NO_W32
122 /* disable our own file-iterators and mapfiles if we can't
124 #if !defined(BOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(BOOST_REGEX_NO_W32))
125 # define BOOST_REGEX_NO_FILEITER
128 /* backwards compatibitity: */
129 #if defined(BOOST_RE_NO_LIB)
130 # define BOOST_REGEX_NO_LIB
133 #if defined(__GNUC__) && (defined(_WIN32) || defined(__CYGWIN__))
134 /* gcc on win32 has problems if you include <windows.h>
135 (sporadically generates bad code). */
136 # define BOOST_REGEX_NO_W32
138 #if defined(__COMO__) && !defined(BOOST_REGEX_NO_W32) && !defined(_MSC_EXTENSIONS)
139 # define BOOST_REGEX_NO_W32
142 /*****************************************************************************
144 * Wide character workarounds:
146 ****************************************************************************/
149 * define BOOST_REGEX_HAS_OTHER_WCHAR_T when wchar_t is a native type, but the users
150 * code may be built with wchar_t as unsigned short: basically when we're building
151 * with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions
152 * of the non-inline functions in the library, so that users can still link to the lib,
153 * irrespective of whether their own code is built with /Zc:wchar_t.
155 #if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
156 # define BOOST_REGEX_HAS_OTHER_WCHAR_T
158 # pragma warning(push)
159 # pragma warning(disable : 4251 4231 4660)
163 extern template class __declspec(dllimport) std::basic_string<unsigned short>;
166 # pragma warning(pop)
171 /*****************************************************************************
173 * Set up dll import/export options:
175 ****************************************************************************/
177 #if defined(BOOST_HAS_DECLSPEC) && (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK)
178 # if defined(BOOST_REGEX_SOURCE)
179 # define BOOST_REGEX_DECL __declspec(dllexport)
180 # define BOOST_REGEX_BUILD_DLL
182 # define BOOST_REGEX_DECL __declspec(dllimport)
186 #ifndef BOOST_REGEX_DECL
187 # define BOOST_REGEX_DECL
190 #if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
191 # define BOOST_LIB_NAME boost_regex
192 # if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
193 # define BOOST_DYN_LINK
195 # ifdef BOOST_REGEX_DIAG
196 # define BOOST_LIB_DIAGNOSTIC
198 # include <boost/config/auto_link.hpp>
201 /*****************************************************************************
203 * Set up function call type:
205 ****************************************************************************/
207 #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1200) && defined(_MSC_EXTENSIONS)
208 #if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED)
209 # define BOOST_REGEX_CALL __cdecl
211 # define BOOST_REGEX_CALL __fastcall
213 # define BOOST_REGEX_CCALL __cdecl
216 #if defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)
217 # define BOOST_REGEX_CALL __fastcall
218 # define BOOST_REGEX_CCALL __stdcall
221 #ifndef BOOST_REGEX_CALL
222 # define BOOST_REGEX_CALL
224 #ifndef BOOST_REGEX_CCALL
225 #define BOOST_REGEX_CCALL
228 /*****************************************************************************
230 * Set up localisation model:
232 ****************************************************************************/
234 /* backwards compatibility: */
235 #ifdef BOOST_RE_LOCALE_C
236 # define BOOST_REGEX_USE_C_LOCALE
239 #ifdef BOOST_RE_LOCALE_CPP
240 # define BOOST_REGEX_USE_CPP_LOCALE
243 /* Win32 defaults to native Win32 locale: */
244 #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)
245 # define BOOST_REGEX_USE_WIN32_LOCALE
247 /* otherwise use C++ locale if supported: */
248 #if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_NO_STD_LOCALE)
249 # define BOOST_REGEX_USE_CPP_LOCALE
251 /* otherwise use C+ locale: */
252 #if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE)
253 # define BOOST_REGEX_USE_C_LOCALE
256 #ifndef BOOST_REGEX_MAX_STATE_COUNT
257 # define BOOST_REGEX_MAX_STATE_COUNT 100000000
261 /*****************************************************************************
263 * Error Handling for exception free compilers:
265 ****************************************************************************/
267 #ifdef BOOST_NO_EXCEPTIONS
269 * If there are no exceptions then we must report critical-errors
270 * the only way we know how; by terminating.
274 #include <boost/throw_exception.hpp>
276 # define BOOST_REGEX_NOEH_ASSERT(x)\
279 std::string s("Error: critical regex++ failure in: ");\
281 std::runtime_error e(s);\
282 boost::throw_exception(e);\
286 * With exceptions then error handling is taken care of and
287 * there is no need for these checks:
289 # define BOOST_REGEX_NOEH_ASSERT(x)
293 /*****************************************************************************
295 * Stack protection under MS Windows:
297 ****************************************************************************/
299 #if !defined(BOOST_REGEX_NO_W32) && !defined(BOOST_REGEX_V3)
300 # if(defined(_WIN32) || defined(_WIN64) || defined(_WINCE)) \
301 && !defined(__GNUC__) \
302 && !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)) \
303 && !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003))
304 # define BOOST_REGEX_HAS_MS_STACK_GUARD
306 #elif defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
307 # undef BOOST_REGEX_HAS_MS_STACK_GUARD
310 #if defined(__cplusplus) && defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
315 BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page();
323 /*****************************************************************************
325 * Algorithm selection and configuration:
327 ****************************************************************************/
329 #if !defined(BOOST_REGEX_RECURSIVE) && !defined(BOOST_REGEX_NON_RECURSIVE)
330 # if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG) && !(defined(BOOST_MSVC) && (BOOST_MSVC >= 1400))
331 # define BOOST_REGEX_RECURSIVE
333 # define BOOST_REGEX_NON_RECURSIVE
337 #ifdef BOOST_REGEX_NON_RECURSIVE
338 # ifdef BOOST_REGEX_RECURSIVE
339 # error "Can't set both BOOST_REGEX_RECURSIVE and BOOST_REGEX_NON_RECURSIVE"
341 # ifndef BOOST_REGEX_BLOCKSIZE
342 # define BOOST_REGEX_BLOCKSIZE 4096
344 # if BOOST_REGEX_BLOCKSIZE < 512
345 # error "BOOST_REGEX_BLOCKSIZE must be at least 512"
347 # ifndef BOOST_REGEX_MAX_BLOCKS
348 # define BOOST_REGEX_MAX_BLOCKS 1024
350 # ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
351 # undef BOOST_REGEX_HAS_MS_STACK_GUARD
353 # ifndef BOOST_REGEX_MAX_CACHE_BLOCKS
354 # define BOOST_REGEX_MAX_CACHE_BLOCKS 16
359 /*****************************************************************************
361 * helper memory allocation functions:
363 ****************************************************************************/
365 #if defined(__cplusplus) && defined(BOOST_REGEX_NON_RECURSIVE)
366 namespace boost{ namespace re_detail{
368 BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block();
369 BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*);
374 /*****************************************************************************
378 ****************************************************************************/
380 #ifdef BOOST_REGEX_CONFIG_INFO
381 BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info();
384 #if defined(BOOST_REGEX_DIAG)
385 # pragma message ("BOOST_REGEX_DECL" BOOST_STRINGIZE(=BOOST_REGEX_DECL))
386 # pragma message ("BOOST_REGEX_CALL" BOOST_STRINGIZE(=BOOST_REGEX_CALL))
387 # pragma message ("BOOST_REGEX_CCALL" BOOST_STRINGIZE(=BOOST_REGEX_CCALL))
388 #ifdef BOOST_REGEX_USE_C_LOCALE
389 # pragma message ("Using C locale in regex traits class")
390 #elif BOOST_REGEX_USE_CPP_LOCALE
391 # pragma message ("Using C++ locale in regex traits class")
393 # pragma message ("Using Win32 locale in regex traits class")
395 #if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
396 # pragma message ("Dynamic linking enabled")
398 #if defined(BOOST_REGEX_NO_LIB) || defined(BOOST_ALL_NO_LIB)
399 # pragma message ("Auto-linking disabled")
401 #ifdef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
402 # pragma message ("Extern templates disabled")