]> git.lyx.org Git - lyx.git/blob - boost/boost/regex/config.hpp
Also display the info about BibTeX databases in the TeX info panel.
[lyx.git] / boost / boost / regex / config.hpp
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  * Visual C++ doesn't support external templates with C++ extensions turned off:
91  */
92 #if defined(_MSC_VER) && !defined(_MSC_EXTENSIONS)
93 #  define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
94 #endif
95 /*
96  * Shared regex lib will crash without this, frankly it looks a lot like a gcc bug:
97  */
98 #if defined(__MINGW32__)
99 #  define BOOST_REGEX_NO_EXTERNAL_TEMPLATES
100 #endif
101
102 /*
103  * If there isn't good enough wide character support then there will
104  * be no wide character regular expressions:
105  */
106 #if (defined(BOOST_NO_CWCHAR) || defined(BOOST_NO_CWCTYPE) || defined(BOOST_NO_STD_WSTRING))
107 #  if !defined(BOOST_NO_WREGEX)
108 #     define BOOST_NO_WREGEX
109 #  endif
110 #else
111 #  if defined(__sgi) && (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
112       /* STLPort on IRIX is misconfigured: <cwctype> does not compile
113        * as a temporary fix include <wctype.h> instead and prevent inclusion
114        * of STLPort version of <cwctype> */
115 #     include <wctype.h>
116 #     define __STLPORT_CWCTYPE
117 #     define _STLP_CWCTYPE
118 #  endif
119
120 #ifdef __cplusplus
121 #  include <boost/regex/config/cwchar.hpp>
122 #endif
123
124 #endif
125
126 /*
127  * If Win32 support has been disabled for boost in general, then
128  * it is for regex in particular:
129  */
130 #if defined(BOOST_DISABLE_WIN32) && !defined(BOOST_REGEX_NO_W32)
131 #  define BOOST_REGEX_NO_W32
132 #endif
133
134 /* disable our own file-iterators and mapfiles if we can't
135  * support them: */
136 #if !defined(BOOST_HAS_DIRENT_H) && !(defined(_WIN32) && !defined(BOOST_REGEX_NO_W32))
137 #  define BOOST_REGEX_NO_FILEITER
138 #endif
139
140 /* backwards compatibitity: */
141 #if defined(BOOST_RE_NO_LIB)
142 #  define BOOST_REGEX_NO_LIB
143 #endif
144
145 #if defined(__GNUC__) && (defined(_WIN32) || defined(__CYGWIN__))
146 /* gcc on win32 has problems if you include <windows.h>
147    (sporadically generates bad code). */
148 #  define BOOST_REGEX_NO_W32
149 #endif
150 #if defined(__COMO__) && !defined(BOOST_REGEX_NO_W32) && !defined(_MSC_EXTENSIONS)
151 #  define BOOST_REGEX_NO_W32
152 #endif
153
154 /*****************************************************************************
155  *
156  *  Wide character workarounds:
157  *
158  ****************************************************************************/
159
160 /*
161  * define BOOST_REGEX_HAS_OTHER_WCHAR_T when wchar_t is a native type, but the users
162  * code may be built with wchar_t as unsigned short: basically when we're building
163  * with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions
164  * of the non-inline functions in the library, so that users can still link to the lib,
165  * irrespective of whether their own code is built with /Zc:wchar_t.
166  * Note that this does NOT WORK with VC10 when the C++ locale is in effect as
167  * the locale's <unsigned short> facets simply do not compile in that case.
168  */
169 #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))
170 #  define BOOST_REGEX_HAS_OTHER_WCHAR_T
171 #  ifdef BOOST_MSVC
172 #     pragma warning(push)
173 #     pragma warning(disable : 4251 4231 4660)
174 #  endif
175 #  if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
176 #     include <string>
177       extern template class __declspec(dllimport) std::basic_string<unsigned short>;
178 #  endif
179 #  ifdef BOOST_MSVC
180 #     pragma warning(pop)
181 #  endif
182 #endif
183
184
185 /*****************************************************************************
186  *
187  *  Set up dll import/export options:
188  *
189  ****************************************************************************/
190
191 #ifndef BOOST_SYMBOL_EXPORT
192 #  define BOOST_SYMBOL_EXPORT
193 #  define BOOST_SYMBOL_IMPORT
194 #endif
195
196 #if (defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)) && !defined(BOOST_REGEX_STATIC_LINK)
197 #  if defined(BOOST_REGEX_SOURCE)
198 #     define BOOST_REGEX_DECL BOOST_SYMBOL_EXPORT
199 #     define BOOST_REGEX_BUILD_DLL
200 #  else
201 #     define BOOST_REGEX_DECL BOOST_SYMBOL_IMPORT
202 #  endif
203 #else
204 #  define BOOST_REGEX_DECL
205 #endif
206
207 #if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus)
208 #  define BOOST_LIB_NAME boost_regex
209 #  if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
210 #     define BOOST_DYN_LINK
211 #  endif
212 #  ifdef BOOST_REGEX_DIAG
213 #     define BOOST_LIB_DIAGNOSTIC
214 #  endif
215 #  include <boost/config/auto_link.hpp>
216 #endif
217
218 /*****************************************************************************
219  *
220  *  Set up function call type:
221  *
222  ****************************************************************************/
223
224 #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1200) && defined(_MSC_EXTENSIONS)
225 #if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED)
226 #  define BOOST_REGEX_CALL __cdecl
227 #else
228 #  define BOOST_REGEX_CALL __fastcall
229 #endif
230 #  define BOOST_REGEX_CCALL __cdecl
231 #endif
232
233 #if defined(__BORLANDC__) && !defined(BOOST_DISABLE_WIN32)
234 #  define BOOST_REGEX_CALL __fastcall
235 #  define BOOST_REGEX_CCALL __stdcall
236 #endif
237
238 #ifndef BOOST_REGEX_CALL
239 #  define BOOST_REGEX_CALL
240 #endif
241 #ifndef BOOST_REGEX_CCALL
242 #define BOOST_REGEX_CCALL
243 #endif
244
245 /*****************************************************************************
246  *
247  *  Set up localisation model:
248  *
249  ****************************************************************************/
250
251 /* backwards compatibility: */
252 #ifdef BOOST_RE_LOCALE_C
253 #  define BOOST_REGEX_USE_C_LOCALE
254 #endif
255
256 #ifdef BOOST_RE_LOCALE_CPP
257 #  define BOOST_REGEX_USE_CPP_LOCALE
258 #endif
259
260 #if defined(__CYGWIN__)
261 #  define BOOST_REGEX_USE_C_LOCALE
262 #endif
263
264 /* Win32 defaults to native Win32 locale: */
265 #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)
266 #  define BOOST_REGEX_USE_WIN32_LOCALE
267 #endif
268 /* otherwise use C++ locale if supported: */
269 #if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE) && !defined(BOOST_NO_STD_LOCALE)
270 #  define BOOST_REGEX_USE_CPP_LOCALE
271 #endif
272 /* otherwise use C+ locale: */
273 #if !defined(BOOST_REGEX_USE_WIN32_LOCALE) && !defined(BOOST_REGEX_USE_C_LOCALE) && !defined(BOOST_REGEX_USE_CPP_LOCALE)
274 #  define BOOST_REGEX_USE_C_LOCALE
275 #endif
276
277 #ifndef BOOST_REGEX_MAX_STATE_COUNT
278 #  define BOOST_REGEX_MAX_STATE_COUNT 100000000
279 #endif
280
281
282 /*****************************************************************************
283  *
284  *  Error Handling for exception free compilers:
285  *
286  ****************************************************************************/
287
288 #ifdef BOOST_NO_EXCEPTIONS
289 /*
290  * If there are no exceptions then we must report critical-errors
291  * the only way we know how; by terminating.
292  */
293 #include <stdexcept>
294 #include <string>
295 #include <boost/throw_exception.hpp>
296
297 #  define BOOST_REGEX_NOEH_ASSERT(x)\
298 if(0 == (x))\
299 {\
300    std::string s("Error: critical regex++ failure in: ");\
301    s.append(#x);\
302    std::runtime_error e(s);\
303    boost::throw_exception(e);\
304 }
305 #else
306 /*
307  * With exceptions then error handling is taken care of and
308  * there is no need for these checks:
309  */
310 #  define BOOST_REGEX_NOEH_ASSERT(x)
311 #endif
312
313
314 /*****************************************************************************
315  *
316  *  Stack protection under MS Windows:
317  *
318  ****************************************************************************/
319
320 #if !defined(BOOST_REGEX_NO_W32) && !defined(BOOST_REGEX_V3)
321 #  if(defined(_WIN32) || defined(_WIN64) || defined(_WINCE)) \
322         && !defined(__GNUC__) \
323         && !(defined(__BORLANDC__) && (__BORLANDC__ >= 0x600)) \
324         && !(defined(__MWERKS__) && (__MWERKS__ <= 0x3003))
325 #     define BOOST_REGEX_HAS_MS_STACK_GUARD
326 #  endif
327 #elif defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
328 #  undef BOOST_REGEX_HAS_MS_STACK_GUARD
329 #endif
330
331 #if defined(__cplusplus) && defined(BOOST_REGEX_HAS_MS_STACK_GUARD)
332
333 namespace boost{
334 namespace re_detail{
335
336 BOOST_REGEX_DECL void BOOST_REGEX_CALL reset_stack_guard_page();
337
338 }
339 }
340
341 #endif
342
343
344 /*****************************************************************************
345  *
346  *  Algorithm selection and configuration:
347  *
348  ****************************************************************************/
349
350 #if !defined(BOOST_REGEX_RECURSIVE) && !defined(BOOST_REGEX_NON_RECURSIVE)
351 #  if defined(BOOST_REGEX_HAS_MS_STACK_GUARD) && !defined(_STLP_DEBUG) && !defined(__STL_DEBUG) && !(defined(BOOST_MSVC) && (BOOST_MSVC >= 1400))
352 #     define BOOST_REGEX_RECURSIVE
353 #  else
354 #     define BOOST_REGEX_NON_RECURSIVE
355 #  endif
356 #endif
357
358 #ifdef BOOST_REGEX_NON_RECURSIVE
359 #  ifdef BOOST_REGEX_RECURSIVE
360 #     error "Can't set both BOOST_REGEX_RECURSIVE and BOOST_REGEX_NON_RECURSIVE"
361 #  endif
362 #  ifndef BOOST_REGEX_BLOCKSIZE
363 #     define BOOST_REGEX_BLOCKSIZE 4096
364 #  endif
365 #  if BOOST_REGEX_BLOCKSIZE < 512
366 #     error "BOOST_REGEX_BLOCKSIZE must be at least 512"
367 #  endif
368 #  ifndef BOOST_REGEX_MAX_BLOCKS
369 #     define BOOST_REGEX_MAX_BLOCKS 1024
370 #  endif
371 #  ifdef BOOST_REGEX_HAS_MS_STACK_GUARD
372 #     undef BOOST_REGEX_HAS_MS_STACK_GUARD
373 #  endif
374 #  ifndef BOOST_REGEX_MAX_CACHE_BLOCKS
375 #     define BOOST_REGEX_MAX_CACHE_BLOCKS 16
376 #  endif
377 #endif
378
379
380 /*****************************************************************************
381  *
382  *  helper memory allocation functions:
383  *
384  ****************************************************************************/
385
386 #if defined(__cplusplus) && defined(BOOST_REGEX_NON_RECURSIVE)
387 namespace boost{ namespace re_detail{
388
389 BOOST_REGEX_DECL void* BOOST_REGEX_CALL get_mem_block();
390 BOOST_REGEX_DECL void BOOST_REGEX_CALL put_mem_block(void*);
391
392 }} /* namespaces */
393 #endif
394
395 /*****************************************************************************
396  *
397  *  Diagnostics:
398  *
399  ****************************************************************************/
400
401 #ifdef BOOST_REGEX_CONFIG_INFO
402 BOOST_REGEX_DECL void BOOST_REGEX_CALL print_regex_library_info();
403 #endif
404
405 #if defined(BOOST_REGEX_DIAG)
406 #  pragma message ("BOOST_REGEX_DECL" BOOST_STRINGIZE(=BOOST_REGEX_DECL))
407 #  pragma message ("BOOST_REGEX_CALL" BOOST_STRINGIZE(=BOOST_REGEX_CALL))
408 #  pragma message ("BOOST_REGEX_CCALL" BOOST_STRINGIZE(=BOOST_REGEX_CCALL))
409 #ifdef BOOST_REGEX_USE_C_LOCALE
410 #  pragma message ("Using C locale in regex traits class")
411 #elif BOOST_REGEX_USE_CPP_LOCALE
412 #  pragma message ("Using C++ locale in regex traits class")
413 #else
414 #  pragma message ("Using Win32 locale in regex traits class")
415 #endif
416 #if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK)
417 #  pragma message ("Dynamic linking enabled")
418 #endif
419 #if defined(BOOST_REGEX_NO_LIB) || defined(BOOST_ALL_NO_LIB)
420 #  pragma message ("Auto-linking disabled")
421 #endif
422 #ifdef BOOST_REGEX_NO_EXTERNAL_TEMPLATES
423 #  pragma message ("Extern templates disabled")
424 #endif
425
426 #endif
427
428 #endif
429
430
431
432