]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/wave/doc/compiletime_config.html
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / wave / doc / compiletime_config.html
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2 <html>
3 <head>
4 <title>Compile Time Configuration</title>
5 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
6 <link href="theme/style.css" rel="stylesheet" type="text/css">
7 </head>
8
9 <body>
10 <table width="100%" border="0" cellspacing="2" background="theme/bkd2.gif">
11 <tr>
12 <td width="21"> <h1></h1></td>
13 <td width="885"> <font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="6">Compile
14 Time Configuration</font></b></font></td>
15 <td width="96"><a href="http://www.boost.org"><img src="theme/wave.gif" width="93" height="68" align="right" border="0"></a></td>
16 </tr>
17 </table>
18 <br>
19 <table border="0">
20 <tr>
21 <td width="10"></td>
22 <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
23 <td width="30"><a href="macro_expansion_process.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td>
24 <td width="30"><a href="samples.html"><img src="theme/r_arr.gif" border="0"></a></td>
25 </tr>
26 </table>
27 <p><b><a name="compiletime_config"></a>Library compile time configuration</b></p>
28 <P dir="ltr">The C++ preprocessor iterator library may be configured at compile
29 time by specifying different preprocessor constants to include different additional
30 features. The possible preprocessor constants are described in the following
31 table. </P>
32 <table width="100%" border="0" align="center">
33 <tr>
34 <td colspan="2" class="table_title"><b>Summary of possible preprocessor constants
35 for<br>
36 library configuration</b></td>
37 </tr>
38 <tr>
39 <td width="46%" class="table_cells"><code>BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE</code></td>
40 <td width="54%" class="table_cells"> <p>Support the <span class="preprocessor">#warning</span> directive</p></td>
41 </tr>
42 <tr>
43 <td width="46%" class="table_cells"><code>BOOST_WAVE_SUPPORT_MS_EXTENSIONS</code></td>
44 <td width="54%" class="table_cells"> <p>Support several MS specific language
45 extensions (i.e. <tt>__int8</tt> et.al.)</p></td>
46 </tr>
47 <tr>
48 <td class="table_cells"><code>BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY</code></td>
49 <td class="table_cells"><p>Enable the preprocessing of the message bodies
50 of <span class="preprocessor">#error</span> and <span class="preprocessor">#warning</span>
51 directives.</p></td>
52 </tr>
53 <tr>
54 <td class="table_cells"><code>BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES</code></td>
55 <td class="table_cells"><p>If defined, then the <span class="preprocessor">#pragma</span>
56 directives are returned as a token sequence to the caller, if not defined,
57 the whole <span class="preprocessor">#pragma</span> directive is skipped. </p></td>
58 </tr>
59 <tr>
60 <td class="table_cells"><code>BOOST_WAVE_PREPROCESS_PRAGMA_BODY</code></td>
61 <td class="table_cells"><p>Enable the preprocessing of the bodies of all <span class="preprocessor">
62 #pragma</span> directives.<br>
63 Note though, that the body of an <tt>operator&nbsp;_Pragma()</tt> is always preprocessed as this is required by the C99 Standard <a href="references.html#iso_c">[2]</a>.
64 </p></td>
65 </tr>
66 <tr>
67 <td class="table_cells"><code>BOOST_WAVE_ENABLE_COMMANDLINE_MACROS</code></td>
68 <td class="table_cells"><p>Enable the functionality required to define macros
69 with the command line syntax (-DMACRO(x)=definition)</p></td>
70 </tr>
71 <tr>
72 <td class="table_cells"><code>BOOST_WAVE_STRINGTYPE</code></td>
73 <td class="table_cells"><p>The tokens generated by the <tt>Wave</tt> library
74 contain the token data and the file position, where this token was found
75 in the input stream. <br>
76 This constant may be used to redefine the data type, which is used to
77 hold the token data and the corresponding file name. If this isn't defined
78 it defaults to std::string. (The here defined data type should be compatible
79 to the std::string type)</p></td>
80 </tr>
81 <tr>
82 <td class="table_cells"><code>BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS</code></td>
83 <td class="table_cells"><p>If defined, then the preprocessor library supports
84 variadics and placemarkers. Note, to support C99 mode, this constant must
85 be defined too.</p></td>
86 </tr>
87 <tr>
88 <td class="table_cells"><code>BOOST_WAVE_SUPPORT_CPP0X</code></td>
89 <td class="table_cells"><p>If defined, then the preprocessor library supports
90 C++0x keywords and C++0x specific features, such as variadics, placemarkers, extended character and string literals. This implies the definitions of the <code>BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS</code> constant.</p></td>
91 </tr> <tr>
92 <td class="table_cells"><code>BOOST_WAVE_MAX_INCLUDE_LEVEL_DEPTH</code></td>
93 <td class="table_cells"><p>If defined, it will determine the initial maximal
94 possible include file nesting depth supported. It defaults to 1024.</p></td>
95 </tr>
96 <tr>
97 <td class="table_cells"><code>BOOST_WAVE_SUPPORT_PRAGMA_ONCE</code></td>
98 <td class="table_cells"><p>If defined, then the <code>#pragma once</code> directive is supported by <tt>Wave</tt>. This specifies that the file, in which the pragma resides, will be included
99 (opened) only once by the compiler in a build. </p></td>
100 </tr>
101 <tr>
102 <td class="table_cells"><code>BOOST_WAVE_SUPPORT_PRAGMA_MESSAGE</code></td>
103 <td class="table_cells"><p>If defined, then the <code class="preprocessor">#pragma message(&quot;&quot;)</code> directive is supported by <tt>Wave</tt>. This pragma simply generates a remark cotaining the message text. The body of the #pragma message is preprocessed whenever the <code><code>BOOST_</code>WAVE_PREPROCESS_PRAGMA_BODY</code> constant is defined as well . </p></td>
104 </tr>
105 <tr>
106 <td class="table_cells"><code>BOOST_WAVE_SUPPORT_INCLUDE_NEXT</code></td>
107 <td class="table_cells"><p>If defined, then the <code>#include_next</code> directive is supported by <tt>Wave</tt>. This is syntactically equivalent to the <code class="preprocessor">#include</code> directives, but may be used to inherit a header file (i.e. to include a file, which is named as the current file containing the <code>#include_next</code>).</p></td>
108 </tr>
109 <tr>
110 <td class="table_cells"><code>BOOST_WAVE_USE_STRICT_LEXER</code></td>
111 <td class="table_cells"><p>If this is defined to something != 0, then the C/C++ lexers recognize the
112 strict C99/C++ basic source character set. If it is not defined or defined
113 to zero, the lexers recognize the <span class="string">'$'</span> character as part of identifiers.</p></td>
114 </tr>
115 <tr>
116 <td class="table_cells"><code>BOOST_WAVE_PRAGMA_KEYWORD</code></td>
117 <td class="table_cells"><p>If this is defined to a string literal it will be used as the pragma keyword recogniyed by the library as specific Wave pragma's. This constant defaults to <span class="literal">&quot;wave&quot;</span>, i.e. the library recognizes all <span class="preprocessor">#pragma wave option [(argument)]</span> directives and dispatches the handling to the interpret_pragma() preprocessing hook function (see: <a href="class_reference_ctxpolicy.html">Preprocessing Hooks</a>). The arguments part of the pragma is optional.<br>
118 </p> </td>
119 </tr>
120 <tr>
121 <td class="table_cells"><code>BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS</code></td>
122 <td class="table_cells"><p>If defined to something not equal to zero (<span class="literal">'0'</span>) Wave will be compiled to use the depreciated preprocessing hooks. The interface of the preprocessing hooks has been changed after the Boost V1.34.x releases. This constant allows to compile applications using the older interface. </p></td>
123 </tr>
124 <tr>
125 <td class="table_cells"><code>BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS</code></td>
126 <td class="table_cells"><p>The C++ standard requires the preprocessor to use one of the following
127 types for integer literals: <code>long</code> or <code>unsigned long</code> depending on a optional
128 suffix (<span class="literal">'u'</span>, <span class="literal">'l'</span>, <span class="literal">'ul'</span>, or <span class="literal">'lu'</span>). Sometimes it is required to preprocess integer literals larger than that
129 (i.e. <code>long long</code> or <code>unsigned long long</code>). Defining this pp constant enables the recognition of long long integers
130 even if these do not have the <span class="literal">'ll'</span> suffix.</p>
131 <p>This preprocessor constant is effective only, if your target platform supports
132 long long integers (<code>BOOST_HAS_LONG_LONG</code> is defined). Please note, that this setting doesn't relate to the Wave support option
133 <code>support_option_long_long</code>, which enables the recognition of <span class="literal">'ll'</span> suffixes
134 only.
135 </p>
136 </td>
137 </tr>
138 <tr>
139 <td class="table_cells">
140 <code>BOOST_WAVE_SUPPORT_THREADING</code></td>
141 <td class="table_cells">
142 <p>This preprocessor constant allows to configer whether the Wave library will be built
143 with threading support enabled or not. This value (if defined) should be set to
144 zero ('0') if threading needs to be disabled and to a numerical value not equal
145 to zero, if threading should be enabled explicitely.
146 </p>
147 <p>
148 If this constant is not defined, the Wave library will be built using the threading
149 as picked up from the Boost build environment (see <code>BOOST_HAS_THREADS</code> in the Boost
150 configuration dosumentation).</p>
151 </td>
152 </tr>
153 </table>
154 <P dir="ltr"><b><a name="using_custom_lexer"></a>Using a different token type or lexer type in conjunction with Wave </b></P>
155 <P dir="ltr">It is possible to use the <tt>Wave</tt> library while using your own token and/or lexer types. This may be achieved by providing your lexer type as the second template parameter while instantiating the <tt>boost::wave::context&lt;&gt;</tt> object. The token type used by the library is derived from the <tt>token_type</tt> typedef to be provided by the lexer type. If you want to provide your own token type only, you may use the <tt>boost::wave::lex_iterator&lt;&gt;</tt> type contained with the library. This type needs to be parametrized with the token type to use. </P>
156 <P dir="ltr">The <tt>Wave</tt> library contains several samples illustrating these possibilities. The <tt>cpp_tokens</tt> sample shows the usage of a custom lexer and a custom token types. The lexer type used is functionally fully compatible to the <tt>re2c</tt> <a href="references.html#re2c">[3]</a> based lexer used by default. It is implemented based on the <tt>SLex</tt> <a href="references.html#slex">[5]</a> lexer example written by Dan Nuffer. The token type used therein is functionally equivalent to the default token type except for an additional <tt>operator&lt;&lt;</tt> used for dumping the information carried by the token.</P>
157 <P dir="ltr"><b><a name="compilation_models"></a>Separation and inclusion compilation
158 models</b></P>
159 <P dir="ltr">The <tt>Wave</tt> C++ preprocessor iterator library is build almost
160 completely as a header only library (except for the re2c based lexer). If you're
161 trying to include all required files at once you will mention, that the resulting
162 compilation times are very large (up to an hour - depending on your system configuration).
163 This straightforward method we'll call the inclusion compilation model. If you
164 do not pay attention to compilation times, that's the way to go, no special
165 handling is needed.</P>
166 <P dir="ltr">If you're interested in decreasing compilation times, the following
167 method is to be used. This we will call it the separation compilation model.
168 The trick is to separate the different objects such, that they are compilable
169 separately. The function, which instantiates the templated object in question
170 is factored out such, that its definition is visible to only one translation
171 unit. To simplify this further this creation function is packaged into a small
172 generator template structure.</P>
173 <P dir="ltr">There are two levels of separation implemented: the separation of
174 the compilation of the C++ lexer and the separation of the compilation of the
175 different Spirit grammars used. To use these separations you will have to define
176 two preprocessor constants while compiling the whole application and you will
177 have to explicitely instantiate some helper templates. The following tables
178 shows these constants in detail.</P>
179 <table width="90%" border="0" align="center">
180 <tr>
181 <td colspan="2" class="table_title"><b>Summary of possible compilation constants
182 required <br>
183 to enable the separation compilation model</b></td>
184 </tr>
185 <tr class="table_title">
186 <td width="25%"><b>Separate</b></td>
187 <td width="75%"><p><code><font face="Verdana, Arial, Helvetica, sans-serif">Preprocessor
188 constant</font></code></p></td>
189 </tr>
190 <tr>
191 <td width="25%" class="table_cells"><code>C++ lexer</code></td>
192 <td width="75%" class="table_cells"> <p><code><code>BOOST_</code>WAVE_SEPARATE_LEXER_INSTANTIATION</code></p></td>
193 </tr>
194 <tr>
195 <td width="25%" class="table_cells"><code>Spirit grammars</code></td>
196 <td width="75%" class="table_cells"> <p><code><code>BOOST_</code>WAVE_SEPARATE_GRAMMAR_INSTANTIATION</code></p></td>
197 </tr>
198 </table>
199 <P dir="ltr">The following table shows the explicit template instantiations required,
200 if you want to use the separation compilation model. The <tt>TokenT</tt> placeholder
201 type has to be replaced with your token type to use and the <code><tt>LexIteratorT</tt></code> placeholder type has to be replaced with your lex iterator type you've used while instantiation of the <tt>boost::wave::context&lt;&gt;</tt> object. You will achieve the best
202 results, if you place these into separate compilation units each. The <tt>IteratorT</tt>
203 placeholder should be replaced by the iterator type, which was used to instantiate
204 the <tt>boost::wave::context&lt;&gt;</tt> object.</P>
205 <table width="90%" border="0" align="center">
206 <tr>
207 <td colspan="2" class="table_title"><b>Summary of required explicit template
208 instantiations <br>
209 required when using the separation compilation model</b></td>
210 </tr>
211 <tr class="table_title">
212 <td width="25%"><b>Separate</b></td>
213 <td width="75%"><p><code><font face="Verdana, Arial, Helvetica, sans-serif">Templates
214 to explicitly instantiate</font></code></p></td>
215 </tr>
216 <tr>
217 <td width="25%" class="table_cells"><code>C++ lexer</code></td>
218 <td width="75%" class="table_cells"> <code><span class="keyword">template</span>
219 cpplexer::re2clex::new_lexer_gen&lt;<tt>IteratorT</tt>&gt;;</code></td>
220 </tr>
221 <tr>
222 <td width="25%" class="table_cells"><code>Spirit grammars</code></td>
223 <td width="75%" class="table_cells"> <p><code><span class="keyword">template</span> wave::grammars::expression_grammar_gen&lt<tt>TokenT</tt>&gt;;<br>
224 <span class="keyword"> template</span> wave::grammars::intlit_grammar_gen&lt;<tt>TokenT</tt>&gt;;<br>
225 <span class="keyword"> template</span> wave::grammars::chlit_grammar_gen&lt;<tt>TokenT</tt>&gt;;<br>
226 <span class="keyword"> template</span> wave::grammars::cpp_grammar_gen&lt;<tt>LexIteratorT</tt>&gt;;<br>
227 <span class="keyword"> template</span> wave::grammars::predefined_macros_grammar_gen&lt;<tt>LexIteratorT</tt>&gt;;<br>
228 <span class="keyword"> template</span> wave::grammars::defined_grammar_gen&lt;<tt>LexIteratorT</tt>&gt;;</code></p></td>
229 </tr>
230 </table>
231 <p>To see an example of this you can look at the <tt>Wave</tt> driver program
232 included as an acompanion sample to the C++ preprocessor iterator library. The
233 corresponding files are named obviously <span class="string">&quot;instantiate_...something.cpp&quot;</span>,
234 where the <span class="string">'...somthing'</span> is a hint, which grammars
235 are explicitely instantiated inside. By using the separation model the compilation
236 times required to build the <tt>Wave</tt> example are dropped by up to 90%.</p>
237 <table border="0">
238 <tr>
239 <td width="10"></td>
240 <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
241 <td width="30"><a href="macro_expansion_process.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td>
242 <td width="30"><a href="samples.html"><img src="theme/r_arr.gif" border="0"></a></td>
243 </tr>
244 </table>
245 <hr size="1">
246 <p class="copyright">Copyright &copy; 2003-2011 Hartmut Kaiser<br>
247 <br>
248 <font size="2">Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) </font> </p>
249 <span class="updated"></span>
250 <p class="copyright"><span class="updated">Last updated:
251 <!-- #BeginDate format:fcAm1m -->Sunday, January 9, 2011 16:16<!-- #EndDate -->
252 </span></p>
253 </body>
254 </html>