[857] | 1 | /*
|
---|
| 2 | *
|
---|
| 3 | * Copyright (c) 1998-2002
|
---|
| 4 | * John Maddock
|
---|
| 5 | *
|
---|
| 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)
|
---|
| 9 | *
|
---|
| 10 | */
|
---|
| 11 |
|
---|
| 12 | /*
|
---|
| 13 | * LOCATION: see http://www.boost.org for most recent version.
|
---|
| 14 | * FILE config.hpp
|
---|
| 15 | * VERSION see <boost/version.hpp>
|
---|
| 16 | * DESCRIPTION: regex extended config setup.
|
---|
| 17 | */
|
---|
| 18 |
|
---|
| 19 | #ifndef BOOST_REGEX_CONFIG_HPP
|
---|
| 20 | #define BOOST_REGEX_CONFIG_HPP
|
---|
| 21 | /*
|
---|
| 22 | * Borland C++ Fix/error check
|
---|
| 23 | * this has to go *before* we include any std lib headers:
|
---|
| 24 | */
|
---|
| 25 | #if defined(__BORLANDC__)
|
---|
| 26 | # include <boost/regex/config/borland.hpp>
|
---|
| 27 | #endif
|
---|
| 28 |
|
---|
| 29 | /*****************************************************************************
|
---|
| 30 | *
|
---|
| 31 | * Include all the headers we need here:
|
---|
| 32 | *
|
---|
| 33 | ****************************************************************************/
|
---|
| 34 |
|
---|
| 35 | #ifdef __cplusplus
|
---|
| 36 |
|
---|
| 37 | # ifndef BOOST_REGEX_USER_CONFIG
|
---|
| 38 | # define BOOST_REGEX_USER_CONFIG <boost/regex/user.hpp>
|
---|
| 39 | # endif
|
---|
| 40 |
|
---|
| 41 | # include BOOST_REGEX_USER_CONFIG
|
---|
| 42 |
|
---|
| 43 | # include <boost/config.hpp>
|
---|
| 44 |
|
---|
| 45 | #else
|
---|
| 46 | /*
|
---|
| 47 | * C build,
|
---|
| 48 | * don't include <boost/config.hpp> because that may
|
---|
| 49 | * do C++ specific things in future...
|
---|
| 50 | */
|
---|
| 51 | # include <stdlib.h>
|
---|
| 52 | # include <stddef.h>
|
---|
| 53 | # ifdef _MSC_VER
|
---|
| 54 | # define BOOST_MSVC _MSC_VER
|
---|
| 55 | # endif
|
---|
| 56 | #endif
|
---|
| 57 |
|
---|
| 58 | /*****************************************************************************
|
---|
| 59 | *
|
---|
| 60 | * Boilerplate regex config options:
|
---|
| 61 | *
|
---|
| 62 | ****************************************************************************/
|
---|
| 63 |
|
---|
| 64 | /* Obsolete macro, use BOOST_VERSION instead: */
|
---|
| 65 | #define BOOST_RE_VERSION 320
|
---|
| 66 |
|
---|
| 67 | /* fix: */
|
---|
| 68 | #if defined(_UNICODE) && !defined(UNICODE)
|
---|
| 69 | #define UNICODE
|
---|
| 70 | #endif
|
---|
| 71 |
|
---|
| 72 | /*
|
---|
| 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');
|
---|
| 76 | * returns *false*.
|
---|
| 77 | */
|
---|
| 78 | #ifdef __GLIBCPP__
|
---|
| 79 | # define BOOST_REGEX_BUGGY_CTYPE_FACET
|
---|
| 80 | #endif
|
---|
| 81 |
|
---|
| 82 | /*
|
---|
| 83 | * Intel C++ before 8.0 ends up with unresolved externals unless we turn off
|
---|
| 84 | * extern template support:
|
---|
| 85 | */
|
---|
| 86 | #if defined(BOOST_INTEL) && defined(__cplusplus) && (BOOST_INTEL <= 800)
|
---|
| 87 | # define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
---|
| 88 | #endif
|
---|
| 89 |
|
---|
| 90 | /*
|
---|
| 91 | * If there isn't good enough wide character support then there will
|
---|
| 92 | * be no wide character regular expressions:
|
---|
| 93 | */
|
---|
| 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
|
---|
| 97 | # endif
|
---|
| 98 | #else
|
---|
| 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> */
|
---|
| 103 | # include <wctype.h>
|
---|
| 104 | # define __STLPORT_CWCTYPE
|
---|
| 105 | # define _STLP_CWCTYPE
|
---|
| 106 | # endif
|
---|
| 107 |
|
---|
| 108 | #ifdef __cplusplus
|
---|
| 109 | # include <boost/regex/config/cwchar.hpp>
|
---|
| 110 | #endif
|
---|
| 111 |
|
---|
| 112 | #endif
|
---|
| 113 |
|
---|
| 114 | /*
|
---|
| 115 | * If Win32 support has been disabled for boost in general, then
|
---|
| 116 | * it is for regex in particular:
|
---|
| 117 | */
|
---|
| 118 | #if defined(BOOST_DISABLE_WIN32) && !defined(BOOST_REGEX_NO_W32)
|
---|
| 119 | # define BOOST_REGEX_NO_W32
|
---|
| 120 | #endif
|
---|
| 121 |
|
---|
| 122 | /* disable our own file-iterators and mapfiles if we can't
|
---|
| 123 | * support them: */
|
---|
| 124 | #if !defined(BOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(BOOST_REGEX_NO_W32))
|
---|
| 125 | # define BOOST_REGEX_NO_FILEITER
|
---|
| 126 | #endif
|
---|
| 127 |
|
---|
| 128 | /* backwards compatibitity: */
|
---|
| 129 | #if defined(BOOST_RE_NO_LIB)
|
---|
| 130 | # define BOOST_REGEX_NO_LIB
|
---|
| 131 | #endif
|
---|
| 132 |
|
---|
| 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
|
---|
| 137 | #endif
|
---|
| 138 | #if defined(__COMO__) && !defined(BOOST_REGEX_NO_W32) && !defined(_MSC_EXTENSIONS)
|
---|
| 139 | # define BOOST_REGEX_NO_W32
|
---|
| 140 | #endif
|
---|
| 141 |
|
---|
| 142 | /*****************************************************************************
|
---|
| 143 | *
|
---|
| 144 | * Wide character workarounds:
|
---|
| 145 | *
|
---|
| 146 | ****************************************************************************/
|
---|
| 147 |
|
---|
| 148 | /*
|
---|
| 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.
|
---|
| 154 | */
|
---|
| 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
|
---|
| 157 | # ifdef BOOST_MSVC
|
---|
| 158 | # pragma warning(push)
|
---|
| 159 | # pragma warning(disable : 4251 4231 4660)
|
---|
| 160 | # endif
|
---|
| 161 | # ifdef _DLL
|
---|
| 162 | # include <string>
|
---|
| 163 | extern template class __declspec(dllimport) std::basic_string<unsigned short>;
|
---|
| 164 | # endif
|
---|
| 165 | # ifdef BOOST_MSVC
|
---|
| 166 | # pragma warning(pop)
|
---|
| 167 | # endif
|
---|
| 168 | #endif
|
---|
| 169 |
|
---|
| 170 |
|
---|
| 171 | /*****************************************************************************
|
---|
| 172 | *
|
---|
| 173 | * Set up dll import/export options:
|
---|
| 174 | *
|
---|
| 175 | ****************************************************************************/
|
---|
| 176 |
|
---|
| 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
|
---|
| 181 | # else
|
---|
| 182 | # define BOOST_REGEX_DECL __declspec(dllimport)
|
---|
| 183 | # endif
|
---|
| 184 | #endif
|
---|
| 185 |
|
---|
| 186 | #ifndef BOOST_REGEX_DECL
|
---|
| 187 | # define BOOST_REGEX_DECL
|
---|
| 188 | #endif
|
---|
| 189 |
|
---|
| 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
|
---|
| 194 | # endif
|
---|
| 195 | # ifdef BOOST_REGEX_DIAG
|
---|
| 196 | # define BOOST_LIB_DIAGNOSTIC
|
---|
| 197 | # endif
|
---|
| 198 | # include <boost/config/auto_link.hpp>
|
---|
| 199 | #endif
|
---|
| 200 |
|
---|
| 201 | /*****************************************************************************
|
---|
| 202 | *
|
---|
| 203 | * Set up function call type:
|
---|
| 204 | *
|
---|
| 205 | ****************************************************************************/
|
---|
| 206 |
|
---|
| 207 | #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1200) && defined(_MSC_EXTENSIONS)
|
---|
| 208 | #if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS)
|
---|
| 209 | # define BOOST_REGEX_CALL __cdecl
|
---|
| 210 | #else
|
---|
| 211 | # define BOOST_REGEX_CALL __fastcall
|
---|
| 212 | #endif
|
---|
| 213 | # define BOOST_REGEX_CCALL __cdecl
|
---|
| 214 | #endif
|
---|
| 215 |
|
---|
| 216 | #if defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)
|
---|
| 217 | # define BOOST_REGEX_CALL __fastcall
|
---|
| 218 | # define BOOST_REGEX_CCALL __stdcall
|
---|
| 219 | #endif
|
---|
| 220 |
|
---|
| 221 | #ifndef BOOST_REGEX_CALL
|
---|
| 222 | # define BOOST_REGEX_CALL
|
---|
| 223 | #endif
|
---|
| 224 | #ifndef BOOST_REGEX_CCALL
|
---|
| 225 | #define BOOST_REGEX_CCALL
|
---|
| 226 | #endif
|
---|
| 227 |
|
---|
| 228 | /*****************************************************************************
|
---|
| 229 | *
|
---|
| 230 | * Set up localisation model:
|
---|
| 231 | *
|
---|
| 232 | ****************************************************************************/
|
---|
| 233 |
|
---|
| 234 | /* backwards compatibility: */
|
---|
| 235 | #ifdef BOOST_RE_LOCALE_C
|
---|
| 236 | # define BOOST_REGEX_USE_C_LOCALE
|
---|
| 237 | #endif
|
---|
| 238 |
|
---|
| 239 | #ifdef BOOST_RE_LOCALE_CPP
|
---|
| 240 | # define BOOST_REGEX_USE_CPP_LOCALE
|
---|
| 241 | #endif
|
---|
| 242 |
|
---|
| 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
|
---|
| 246 | #endif
|
---|
| 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
|
---|
| 250 | #endif
|
---|
| 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
|
---|
| 254 | #endif
|
---|
| 255 |
|
---|
| 256 | #ifndef BOOST_REGEX_MAX_STATE_COUNT
|
---|
| 257 | # define BOOST_REGEX_MAX_STATE_COUNT 100000000
|
---|
| 258 | #endif
|
---|
| 259 |
|
---|
| 260 |
|
---|
| 261 | /*****************************************************************************
|
---|
| 262 | *
|
---|
| 263 | * Error Handling for exception free compilers:
|
---|
| 264 | *
|
---|
| 265 | ****************************************************************************/
|
---|
| 266 |
|
---|
| 267 | #ifdef BOOST_NO_EXCEPTIONS
|
---|
| 268 | /*
|
---|
| 269 | * If there are no exceptions then we must report critical-errors
|
---|
| 270 | * the only way we know how; by terminating.
|
---|
| 271 | */
|
---|
| 272 | #include <stdexcept>
|
---|
| 273 | #include <string>
|
---|
| 274 | #include <boost/throw_exception.hpp>
|
---|
| 275 |
|
---|
| 276 | # define BOOST_REGEX_NOEH_ASSERT(x)\
|
---|
| 277 | if(0 == (x))\
|
---|
| 278 | {\
|
---|
| 279 | std::string s("Error: critical regex++ failure in: ");\
|
---|
| 280 | s.append(#x);\
|
---|
| 281 | std::runtime_error e(s);\
|
---|
| 282 | boost::throw_exception(e);\
|
---|
| 283 | }
|
---|
| 284 | #else
|
---|
| 285 | /*
|
---|
| 286 | * With exceptions then error handling is taken care of and
|
---|
| 287 | * there is no need for these checks:
|
---|
| 288 | */
|
---|
| 289 | # define BOOST_REGEX_NOEH_ASSERT(x)
|
---|
| 290 | #endif
|
---|
| 291 |
|
---|
| 292 |
|
---|
| 293 | /*****************************************************************************
|
---|
| 294 | *
|
---|
| 295 | * Stack protection under MS Windows:
|
---|
| 296 | *
|
---|
| 297 | ****************************************************************************/
|
---|
| 298 |
|
---|
| 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
|
---|
| 305 | # endif
|
---|
| 306 | #elif defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
|
---|
| 307 | # undef BOOST_REGEX_HAS_MS_STACK_GUARD
|
---|
| 308 | #endif
|
---|
| 309 |
|
---|
| 310 | #if defined(__cplusplus) && defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
|
---|
| 311 |
|
---|
| 312 | namespace boost{
|
---|
| 313 | namespace re_detail{
|
---|
| 314 |
|
---|
| 315 | BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page();
|
---|
| 316 |
|
---|
| 317 | }
|
---|
| 318 | }
|
---|
| 319 |
|
---|
| 320 | #endif
|
---|
| 321 |
|
---|
| 322 |
|
---|
| 323 | /*****************************************************************************
|
---|
| 324 | *
|
---|
| 325 | * Algorithm selection and configuration:
|
---|
| 326 | *
|
---|
| 327 | ****************************************************************************/
|
---|
| 328 |
|
---|
| 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
|
---|
| 332 | # else
|
---|
| 333 | # define BOOST_REGEX_NON_RECURSIVE
|
---|
| 334 | # endif
|
---|
| 335 | #endif
|
---|
| 336 |
|
---|
| 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"
|
---|
| 340 | # endif
|
---|
| 341 | # ifndef BOOST_REGEX_BLOCKSIZE
|
---|
| 342 | # define BOOST_REGEX_BLOCKSIZE 4096
|
---|
| 343 | # endif
|
---|
| 344 | # if BOOST_REGEX_BLOCKSIZE < 512
|
---|
| 345 | # error "BOOST_REGEX_BLOCKSIZE must be at least 512"
|
---|
| 346 | # endif
|
---|
| 347 | # ifndef BOOST_REGEX_MAX_BLOCKS
|
---|
| 348 | # define BOOST_REGEX_MAX_BLOCKS 1024
|
---|
| 349 | # endif
|
---|
| 350 | # ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
|
---|
| 351 | # undef BOOST_REGEX_HAS_MS_STACK_GUARD
|
---|
| 352 | # endif
|
---|
| 353 | # ifndef BOOST_REGEX_MAX_CACHE_BLOCKS
|
---|
| 354 | # define BOOST_REGEX_MAX_CACHE_BLOCKS 16
|
---|
| 355 | # endif
|
---|
| 356 | #endif
|
---|
| 357 |
|
---|
| 358 |
|
---|
| 359 | /*****************************************************************************
|
---|
| 360 | *
|
---|
| 361 | * helper memory allocation functions:
|
---|
| 362 | *
|
---|
| 363 | ****************************************************************************/
|
---|
| 364 |
|
---|
| 365 | #if defined(__cplusplus) && defined(BOOST_REGEX_NON_RECURSIVE)
|
---|
| 366 | namespace boost{ namespace re_detail{
|
---|
| 367 |
|
---|
| 368 | BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block();
|
---|
| 369 | BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*);
|
---|
| 370 |
|
---|
| 371 | }} /* namespaces */
|
---|
| 372 | #endif
|
---|
| 373 |
|
---|
| 374 | /*****************************************************************************
|
---|
| 375 | *
|
---|
| 376 | * Diagnostics:
|
---|
| 377 | *
|
---|
| 378 | ****************************************************************************/
|
---|
| 379 |
|
---|
| 380 | #ifdef BOOST_REGEX_CONFIG_INFO
|
---|
| 381 | BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info();
|
---|
| 382 | #endif
|
---|
| 383 |
|
---|
| 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")
|
---|
| 392 | #else
|
---|
| 393 | # pragma message ("Using Win32 locale in regex traits class")
|
---|
| 394 | #endif
|
---|
| 395 | #if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
|
---|
| 396 | # pragma message ("Dynamic linking enabled")
|
---|
| 397 | #endif
|
---|
| 398 | #if defined(BOOST_REGEX_NO_LIB) || defined(BOOST_ALL_NO_LIB)
|
---|
| 399 | # pragma message ("Auto-linking disabled")
|
---|
| 400 | #endif
|
---|
| 401 | #ifdef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
|
---|
| 402 | # pragma message ("Extern templates disabled")
|
---|
| 403 | #endif
|
---|
| 404 |
|
---|
| 405 | #endif
|
---|
| 406 |
|
---|
| 407 | #endif
|
---|
| 408 |
|
---|
| 409 |
|
---|
| 410 |
|
---|
| 411 |
|
---|