[29] | 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> |
---|
| 2 | <html> |
---|
| 3 | <head> |
---|
| 4 | <title>Boost.Regex: Configuration and setup</title> |
---|
| 5 | <meta name="generator" content="HTML Tidy, see www.w3.org"> |
---|
| 6 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
| 7 | <link rel="stylesheet" type="text/css" href="../../../boost.css"> |
---|
| 8 | </head> |
---|
| 9 | <body> |
---|
| 10 | <table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0"> |
---|
| 11 | <tr> |
---|
| 12 | <td valign="top" width="300"> |
---|
| 13 | <h3><a href="../../../index.htm"><img height="86" width="277" alt="C++ Boost" src="../../../boost.png" border="0"></a></h3> |
---|
| 14 | </td> |
---|
| 15 | <td width="353"> |
---|
| 16 | <h1 align="center">Boost.Regex</h1> |
---|
| 17 | <h2 align="center">Configuration and setup</h2> |
---|
| 18 | </td> |
---|
| 19 | <td width="50"> |
---|
| 20 | <h3><a href="index.html"><img height="45" width="43" alt="Boost.Regex Index" src="uarrow.gif" border="0"></a></h3> |
---|
| 21 | </td> |
---|
| 22 | </tr> |
---|
| 23 | </table> |
---|
| 24 | <br> |
---|
| 25 | <br> |
---|
| 26 | <hr> |
---|
| 27 | <h2>Contents</h2> |
---|
| 28 | <dl class="index"> |
---|
| 29 | <dt><a href="#compiler">Compiler setup</a> <dt><a href="#locale">Locale and traits class |
---|
| 30 | selection</a> <dt><a href="#linkage">Linkage Options</a> <dt><a href="#algorithm">Algorithm |
---|
| 31 | Selection</a> <dt><a href="#tuning">Algorithm Tuning</a></dt> |
---|
| 32 | </dl> |
---|
| 33 | <h3><a name="compiler"></a>Compiler setup.</h3> |
---|
| 34 | <p>You shouldn't need to do anything special to configure boost.regex for use with |
---|
| 35 | your compiler - the <a href="../../config/index.html">boost.config</a> subsystem |
---|
| 36 | should already take care of it, if you do have problems (or you are using a |
---|
| 37 | particularly obscure compiler or platform) then <a href="../../config/index.html">boost.config</a> has |
---|
| 38 | a <a href="../../config/config.htm#config_script">configure</a> script.</p> |
---|
| 39 | <h3><a name="locale"></a>Locale and traits class selection.</h3> |
---|
| 40 | <p>The following macros (see <a href="../../../boost/regex/user.hpp">user.hpp</a>) |
---|
| 41 | control how boost.regex interacts with the user's locale:</p> |
---|
| 42 | <table id="Table2" cellspacing="1" cellpadding="1" width="100%" border="1"> |
---|
| 43 | <tr> |
---|
| 44 | <td width="265">BOOST_REGEX_USE_C_LOCALE</td> |
---|
| 45 | <td> |
---|
| 46 | Forces boost.regex to use the global C locale in its traits class support: this |
---|
| 47 | is now deprecated in favour of the C++ locale.</td> |
---|
| 48 | </tr> |
---|
| 49 | <tr> |
---|
| 50 | <td width="265">BOOST_REGEX_USE_CPP_LOCALE</td> |
---|
| 51 | <td>Forces boost.regex to use std::locale in it's default traits class, regular |
---|
| 52 | expressions can then be imbued with an instance specific locale. |
---|
| 53 | This is the default behaviour on non-Windows platforms.</td> |
---|
| 54 | </tr> |
---|
| 55 | <tr> |
---|
| 56 | <td width="265">BOOST_REGEX_NO_W32</td> |
---|
| 57 | <td>Tells boost.regex not to use any Win32 API's even when available (implies |
---|
| 58 | BOOST_REGEX_USE_CPP_LOCALE unless BOOST_REGEX_USE_C_LOCALE is set).</td> |
---|
| 59 | </tr> |
---|
| 60 | </table> |
---|
| 61 | <br> |
---|
| 62 | <br> |
---|
| 63 | <h3><a name="linkage"></a>Linkage Options</h3> |
---|
| 64 | <table id="Table3" cellspacing="1" cellpadding="1" width="100%" border="1"> |
---|
| 65 | <tr> |
---|
| 66 | <td>BOOST_REGEX_DYN_LINK</td> |
---|
| 67 | <td>For Microsoft and Borland C++ builds, this tells boost.regex that it should |
---|
| 68 | link to the dll build of the boost.regex. By default boost.regex will |
---|
| 69 | link to its static library build, even if the dynamic C runtime library is in |
---|
| 70 | use.</td> |
---|
| 71 | </tr> |
---|
| 72 | <tr> |
---|
| 73 | <td>BOOST_REGEX_NO_LIB</td> |
---|
| 74 | <td>For Microsoft and Borland C++ builds, this tells boost.regex that it should |
---|
| 75 | not automatically select the library to link to.</td> |
---|
| 76 | </tr> |
---|
| 77 | </table> |
---|
| 78 | <br> |
---|
| 79 | <br> |
---|
| 80 | <h3><a name="algorithm"></a>Algorithm Selection</h3> |
---|
| 81 | <table id="Table4" cellspacing="1" cellpadding="1" width="100%" border="1"> |
---|
| 82 | <tr> |
---|
| 83 | <td width="253">BOOST_REGEX_RECURSIVE</td> |
---|
| 84 | <td>Tells boost.regex to use a stack-recursive matching algorithm. This is |
---|
| 85 | generally the fastest option (although there is very little in it), but can |
---|
| 86 | cause stack overflow in extreme cases, on Win32 this can be handled safely, but |
---|
| 87 | this is not the case on other platforms.</td> |
---|
| 88 | </tr> |
---|
| 89 | <tr> |
---|
| 90 | <td width="253">BOOST_REGEX_NON_RECURSIVE</td> |
---|
| 91 | <td>Tells boost.regex to use a non-stack recursive matching algorithm, this can be |
---|
| 92 | slightly slower than the alternative, but is always safe no matter how |
---|
| 93 | pathological the regular expression. This is the default on non-Win32 |
---|
| 94 | platforms.</td> |
---|
| 95 | </tr> |
---|
| 96 | </table> |
---|
| 97 | <br> |
---|
| 98 | <br> |
---|
| 99 | <h3><a name="tuning"></a>Algorithm Tuning</h3> |
---|
| 100 | <p>The following option applies only if BOOST_REGEX_RECURSIVE is set.</p> |
---|
| 101 | <table id="Table6" cellspacing="1" cellpadding="1" width="100%" border="1"> |
---|
| 102 | <tr> |
---|
| 103 | <td>BOOST_REGEX_HAS_MS_STACK_GUARD</td> |
---|
| 104 | <td>Tells boost.regex that Microsoft style __try - __except blocks are supported, |
---|
| 105 | and can be used to safely trap stack overflow.</td> |
---|
| 106 | </tr> |
---|
| 107 | </table> |
---|
| 108 | <br> |
---|
| 109 | <br> |
---|
| 110 | <p>The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.</p> |
---|
| 111 | <table id="Table5" cellspacing="1" cellpadding="1" width="100%" border="1"> |
---|
| 112 | <tr> |
---|
| 113 | <td>BOOST_REGEX_BLOCKSIZE</td> |
---|
| 114 | <td>In non-recursive mode, boost.regex uses largish blocks of memory to act as a |
---|
| 115 | stack for the state machine, the larger the block size then the fewer |
---|
| 116 | allocations that will take place. This defaults to 4096 bytes, which is |
---|
| 117 | large enough to match the vast majority of regular expressions without |
---|
| 118 | further allocations, however, you can choose smaller or larger values depending |
---|
| 119 | upon your platforms characteristics.</td> |
---|
| 120 | </tr> |
---|
| 121 | <tr> |
---|
| 122 | <td>BOOST_REGEX_MAX_BLOCKS</td> |
---|
| 123 | <td>Tells boost.regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is |
---|
| 124 | permitted to use. If this value is exceeded then boost.regex will stop |
---|
| 125 | trying to find a match and throw a std::runtime_error. Defaults to 1024, |
---|
| 126 | don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.</td> |
---|
| 127 | </tr> |
---|
| 128 | <tr> |
---|
| 129 | <td>BOOST_REGEX_MAX_CACHE_BLOCKS</td> |
---|
| 130 | <td>Tells boost.regex how many memory blocks to store in it's internal cache - |
---|
| 131 | memory blocks are taken from this cache rather than by calling ::operator |
---|
| 132 | new. Generally speeking this can be an order of magnitude faster than |
---|
| 133 | calling ::opertator new each time a memory block is required, but has the |
---|
| 134 | downside that boost.regex can end up caching a large chunk of memory (by |
---|
| 135 | default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size). If memory is |
---|
| 136 | tight then try defining this to 0 (disables all caching), or if that is too |
---|
| 137 | slow, then a value of 1 or 2, may be sufficient. On the other hand, on |
---|
| 138 | large multi-processor, multi-threaded systems, you may find that a higher value |
---|
| 139 | is in order.</td> |
---|
| 140 | </tr> |
---|
| 141 | </table> |
---|
| 142 | <br> |
---|
| 143 | <br> |
---|
| 144 | <hr> |
---|
| 145 | <p>Revised |
---|
| 146 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B, %Y" startspan --> |
---|
| 147 | 23 June 2004 |
---|
| 148 | <!--webbot bot="Timestamp" endspan i-checksum="39359" --></p> |
---|
| 149 | <p><i>© Copyright John Maddock 1998- |
---|
| 150 | <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%Y" startspan --> 2004<!--webbot bot="Timestamp" endspan i-checksum="39359" --></i></p> |
---|
| 151 | <P><I>Use, modification and distribution are subject to the Boost Software License, |
---|
| 152 | Version 1.0. (See accompanying file <A href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> |
---|
| 153 | or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</A>)</I></P> |
---|
| 154 | </body> |
---|
| 155 | </html> |
---|