Files
boost_regex/doc/configuration.html

156 lines
8.2 KiB
HTML
Raw Normal View History

2003-05-17 11:45:48 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Boost.Regex: Configuration and setup</title>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../../boost.css">
</head>
<body>
<table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
<tr>
<td valign="top" width="300">
<h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../boost.png" border="0"></a></h3>
</td>
<td width="353">
<h1 align="center">Boost.Regex</h1>
<h2 align="center">Configuration and setup</h2>
</td>
<td width="50">
<h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3>
</td>
</tr>
</table>
<br>
<br>
<hr>
<h2>Contents</h2>
<dl class="index">
<dt><a href="#compiler">Compiler setup</a> <dt><a href="#locale">Locale and traits class
selection</a> <dt><a href="#linkage">Linkage Options</a> <dt><a href="#algorithm">Algorithm
Selection</a> <dt><a href="#tuning">Algorithm Tuning</a></dt>
</dl>
<h3><a name="compiler"></a>Compiler setup.</h3>
<p>You shouldn't need to do anything special to configure boost.regex for use with
your compiler - the <a href="../../config/index.html">boost.config</a> subsystem
should already take care of it, if you do have problems (or you are using a
particularly obscure compiler or platform) then <a href="../../config/index.html">boost.config</a>&nbsp;has
a&nbsp;<a href="../../config/config.htm#config_script">configure</a> script.</p>
<h3><a name="locale"></a>Locale and traits class selection.</h3>
<p>The following macros (see <a href="../../../boost/regex/user.hpp">user.hpp</a>)
control how boost.regex interacts with the user's locale:</p>
<table id="Table2" cellspacing="1" cellpadding="1" width="100%" border="1">
<tr>
<td width="265">BOOST_REGEX_USE_C_LOCALE</td>
<td>
Forces boost.regex to use the global C locale in its traits class support: this
is now deprecated in favour of the C++ locale.</td>
</tr>
<tr>
<td width="265">BOOST_REGEX_USE_CPP_LOCALE</td>
<td>Forces boost.regex to use std::locale in it's default traits class, regular
expressions can then be imbued with an instance&nbsp;specific locale.&nbsp;
This is the default behaviour on non-Windows platforms.</td>
</tr>
<tr>
<td width="265">BOOST_REGEX_NO_W32</td>
<td>Tells boost.regex not to use any Win32 API's even when available (implies
BOOST_REGEX_USE_CPP_LOCALE unless BOOST_REGEX_USE_C_LOCALE is set).</td>
</tr>
</table>
<br>
<br>
<h3><a name="linkage"></a>Linkage Options</h3>
<table id="Table3" cellspacing="1" cellpadding="1" width="100%" border="1">
<tr>
<td>BOOST_REGEX_DYN_LINK</td>
<td>For Microsoft and Borland C++ builds, this tells boost.regex that it should
link to the dll build of the boost.regex.&nbsp; By default boost.regex will
link to its static library build, even if the dynamic C runtime library is in
use.</td>
</tr>
<tr>
<td>BOOST_REGEX_NO_LIB</td>
<td>For Microsoft and Borland C++ builds, this tells boost.regex that it should
not automatically select the library to link to.</td>
</tr>
</table>
<br>
<br>
<h3><a name="algorithm"></a>Algorithm Selection</h3>
<table id="Table4" cellspacing="1" cellpadding="1" width="100%" border="1">
<tr>
<td width="253">BOOST_REGEX_RECURSIVE</td>
<td>Tells boost.regex to use a stack-recursive matching algorithm.&nbsp; This is
generally the fastest option (although there is very little in it), but can
cause stack overflow in extreme cases, on Win32 this can be handled safely, but
this is not the case on other platforms.</td>
</tr>
<tr>
<td width="253">BOOST_REGEX_NON_RECURSIVE</td>
<td>Tells boost.regex to use a non-stack recursive matching algorithm, this can be
slightly slower than the alternative, but is always safe no matter how
pathological the regular expression.&nbsp; This is the default on non-Win32
platforms.</td>
</tr>
</table>
<br>
<br>
<h3><a name="tuning"></a>Algorithm Tuning</h3>
<p>The following option applies only if BOOST_REGEX_RECURSIVE is set.</p>
<table id="Table6" cellspacing="1" cellpadding="1" width="100%" border="1">
<tr>
<td>BOOST_REGEX_HAS_MS_STACK_GUARD</td>
<td>Tells boost.regex that Microsoft style __try - __except blocks are supported,
and can be used to safely trap stack overflow.</td>
</tr>
</table>
<br>
<br>
<p>The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.</p>
<table id="Table5" cellspacing="1" cellpadding="1" width="100%" border="1">
<tr>
<td>BOOST_REGEX_BLOCKSIZE</td>
<td>In non-recursive mode, boost.regex uses largish blocks of memory to act as a
stack for the state machine, the larger the block size then the fewer
allocations that will take place.&nbsp; This defaults to 4096 bytes, which is
large enough to match the vast majority of regular expressions&nbsp;without
further allocations, however, you can choose smaller or larger values depending
upon your platforms characteristics.</td>
</tr>
<tr>
<td>BOOST_REGEX_MAX_BLOCKS</td>
<td>Tells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is
permitted to use.&nbsp; If this value is exceeded then boost.regex will stop
trying to find a match and throw a std::runtime_error.&nbsp; Defaults to 1024,
don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.</td>
</tr>
<tr>
<td>BOOST_REGEX_MAX_CACHE_BLOCKS</td>
<td>Tells boost.regex how many memory blocks to store in it's internal cache -
memory blocks are taken from this cache rather than by calling ::operator
new.&nbsp; Generally speeking this can be an order of magnitude faster than
calling ::opertator new each time a memory block is required, but has the
downside that boost.regex can end up caching a large chunk of memory (by
default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size).&nbsp; If memory is
tight then try defining this to 0 (disables all caching), or if that is too
slow, then a value of 1 or 2, may be sufficient.&nbsp; On the other hand, on
large multi-processor, multi-threaded systems, you may find that a higher value
is in order.</td>
</tr>
</table>
<br>
<br>
<hr>
<p>Revised&nbsp;
2003-10-24 10:51:38 +00:00
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan -->
23 June 2004&nbsp;
2003-10-24 10:51:38 +00:00
<!--webbot bot="Timestamp" endspan i-checksum="39359" --></p>
<p><i><EFBFBD> Copyright John Maddock&nbsp;1998-
<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p>
2003-10-24 10:51:38 +00:00
<P><I>Use, modification and distribution are subject to the Boost Software License,
Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A>
or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P>
</body>
2003-05-17 11:45:48 +00:00
</html>