1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
---|
2 | <html> |
---|
3 | <head> |
---|
4 | <title>The Context Policy</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">The |
---|
14 | Context Policy</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="class_reference_inptpolcy.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> |
---|
24 | <td width="30"><a href="class_reference_lexer.html"><img src="theme/r_arr.gif" border="0"></a></td> |
---|
25 | </tr> |
---|
26 | </table> |
---|
27 | <blockquote> |
---|
28 | <p><a href="class_reference_ctxpolicy.html#introduction">Introduction</a><br> |
---|
29 | <a href="class_reference_ctxpolicy.html#header_synopsis">Header 'wave/preprocessing_hooks.hpp' |
---|
30 | synopsis</a><br> |
---|
31 | <a href="class_reference_ctxpolicy.html#member_functions">Member functions</a></p> |
---|
32 | </blockquote> |
---|
33 | <h2><b><a name="introduction"></a>Introduction</b></h2> |
---|
34 | <p>The context policy is used to provide callback hooks, which are called from inside the library into the user code, whenever</p> |
---|
35 | <ul> |
---|
36 | <li>a preprocessor directive has been recognized, </li> |
---|
37 | <li>a token is about to be returned from the preprocessor, </li> |
---|
38 | <li>a macro get's defined or undefined, </li> |
---|
39 | <li>a macro has been expanded or rescanned,</li> |
---|
40 | <li>an include file has been opened or left, </li> |
---|
41 | <li>a conditional expression was evaluated,</li> |
---|
42 | <li>a token has to be skipped because it is contained in a non-evaluated conditional block, </li> |
---|
43 | <li> a pragma of the form <tt>'wave option[(value)]'</tt> has been recognised. </li> |
---|
44 | </ul> |
---|
45 | <p>This policy type is used as a template parameter to the <a href="class_reference_context.html"><tt>boost::wave::context<></tt></a> |
---|
46 | object, where the default policy provides empty hook functions only.</p> |
---|
47 | <h2><a name="header_synopsis"></a>Header <a href="http://cvs.sourceforge.net/viewcvs.py/boost/boost/boost/wave/preprocessing_hooks.hpp?view=markup">wave/preprocessing_hooks.hpp</a> |
---|
48 | synopsis</h2> |
---|
49 | <pre> |
---|
50 | <span class="keyword">namespace</span> boost { |
---|
51 | <span class="keyword">namespace</span> wave { |
---|
52 | <span class="keyword">namespace</span> context_policies { |
---|
53 | |
---|
54 | <span class="keyword">struct</span> default_preprocessing_hooks { |
---|
55 | |
---|
56 | <span class="comment">// general hook functions</span> |
---|
57 | <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT> |
---|
58 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#found_directive">found_directive</a>(TokenT <span class="keyword">const </span>&directive);<br> |
---|
59 | <span class="comment">// test, whether a given token may be skipped</span><br> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT> |
---|
60 | <span class="keyword">bool</span> <a href="class_reference_ctxpolicy.html#may_skip_whitespace">may_skip_whitespace</a> (ContextT <span class="keyword">const</span>& ctx, |
---|
61 | TokenT &token, <span class="keyword">bool</span> &skipped_newline);<br> |
---|
62 | </span><span class="comment">// Conditional compilation</span><span class="keyword"> |
---|
63 | template</span> <<span class="keyword">typename</span> ContainerT><br> <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#evaluated_conditional_expression">evaluated_conditional_expression</a>(ContainerT <span class="keyword">const</span>& expression, <br> <span class="keyword">bool</span> expression_value);<br> |
---|
64 | <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT> |
---|
65 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#skipped_token">skipped_token</a>(TokenT <span class="keyword">const</span></span>& token);<br> |
---|
66 | <span class="comment">// macro expansion tracing</span><span class="keyword"> |
---|
67 | template</span> <<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT> |
---|
68 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#expanding_function_like_macro">expanding_function_like_macro</a>(TokenT <span class="keyword">const</span> &macrodef, |
---|
69 | <span class="keyword">std::vector</span><TokenT> <span class="keyword">const</span> &formal_args, |
---|
70 | ContainerT <span class="keyword">const</span> &definition, TokenT <span class="keyword">const</span> &macrocall, |
---|
71 | <span class="keyword">std::vector</span><ContainerT> <span class="keyword">const</span> &arguments); |
---|
72 | |
---|
73 | <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT> |
---|
74 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#expanding_object_like_macro">expanding_object_like_macro</a>(TokenT <span class="keyword">const</span> &macro, |
---|
75 | ContainerT <span class="keyword">const</span> &definition, TokenT <span class="keyword">const</span> &macrocall); |
---|
76 | |
---|
77 | <span class="keyword">template</span> <<span class="keyword">typename</span> ContainerT> |
---|
78 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#expanded_macro">expanded_macro</a>(ContainerT <span class="keyword">const</span> &result); |
---|
79 | |
---|
80 | <span class="keyword">template</span> <<span class="keyword">typename</span> ContainerT> |
---|
81 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#expanded_macro">rescanned_macro</a>(ContainerT <span class="keyword">const</span> &result); |
---|
82 | |
---|
83 | <span class="comment">// include file tracing functions</span> |
---|
84 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#opened_include_file">found_include_directive</a>(std::string <span class="keyword">const</span> &filename, |
---|
85 | <span class="keyword">bool</span> include_next); |
---|
86 | |
---|
87 | <span class="keyword">void </span><a href="class_reference_ctxpolicy.html#opened_include_file">opened_include_file</a>(std::string <span class="keyword">const</span> &relname, |
---|
88 | std::string const& absname, |
---|
89 | std::size_t include_depth, <span class="keyword">bool</span> is_system_include); |
---|
90 | |
---|
91 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#returning_from_include_file">returning_from_include_file</a>(); |
---|
92 | |
---|
93 | <span class="comment">// interpretation of #pragma's of the form </span> |
---|
94 | <span class="comment">// 'wave option[(value)]'</span> |
---|
95 | <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT> |
---|
96 | bool <a href="class_reference_ctxpolicy.html#interpret_pragma">interpret_pragma</a>(ContextT <span class="keyword">const</span> &ctx, ContainerT &pending, |
---|
97 | <span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &option, |
---|
98 | ContainerT <span class="keyword">const</span> &values, |
---|
99 | <span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &pragma_token); |
---|
100 | |
---|
101 | <span class="comment">// macro definition hooks</span> |
---|
102 | <span class="keyword">template</span> < |
---|
103 | <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ParametersT, <span class="keyword">typename</span> DefinitionT |
---|
104 | > |
---|
105 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#defined_macro">defined_macro</a>(TokenT <span class="keyword">const</span> &name, <span class="keyword">bool</span> is_functionlike, |
---|
106 | ParametersT <span class="keyword">const</span> &parameters, DefinitionT <span class="keyword">const</span> &definition, |
---|
107 | <span class="keyword">bool</span> is_predefined); |
---|
108 | |
---|
109 | <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT> |
---|
110 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#undefined_macro">undefined_macro</a>(TokenT<span class="keyword">const</span> &name); |
---|
111 | }; |
---|
112 | |
---|
113 | }}} <span class="comment">// namespace boost::wave::context_policies</span></pre> |
---|
114 | <h2><a name="member_functions"></a>Member functions</h2> |
---|
115 | <h3>General hook functions </h3> |
---|
116 | <p><a name="found_directive"></a><strong>found_directive</strong></p> |
---|
117 | <pre> <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT> |
---|
118 | <span class="keyword">void</span> found_directive(TokenT <span class="keyword">const </span>&directive); |
---|
119 | </pre> |
---|
120 | <blockquote> |
---|
121 | <p>The function <tt>found_directive</tt> is called, whenever the preprocessor has detected one of the preprocessing directives (<span class="preprocessor">#define</span>, <span class="preprocessor">#undef</span>, <span class="preprocessor">#if</span>, <span class="preprocessor">#idef</span>, <span class="preprocessor">#ifndef</span>, <span class="preprocessor">#elif</span>, <span class="preprocessor">#endif</span>, <span class="preprocessor">#error</span>, <span class="preprocessor">#include</span>, <span class="preprocessor">#pragma</span> or <span class="preprocessor">#warning</span>) .</p> |
---|
122 | <p>The parameter <tt>directive</tt> refers to the token containing the detected preprocessing directive. </p> |
---|
123 | </blockquote> |
---|
124 | <p><a name="may_skip_whitespace" id="may_skip"></a><strong>may_skipwhitespace</strong></p> |
---|
125 | <pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT> |
---|
126 | <span class="keyword">bool</span> may_skip_whitespace(ContextT <span class="keyword">const</span>& ctx, TokenT &token, <span class="keyword">bool</span>& skipped_newline); |
---|
127 | </pre> |
---|
128 | <blockquote> |
---|
129 | <p>The function <tt>may_skipwhitespace</tt> will be called by the library, whenever a token is about to be returned to the calling application. </p> |
---|
130 | <p>The <tt>ctx</tt> parameter provides a reference to the <tt>context_type</tt> used during instantiation of the preprocessing iterators by the user. Note, this parameter was added after the Boost V1.34.0 release. </p> |
---|
131 | <p>The <tt>token</tt> parameter holds a reference to the current token. The policy is free to change this token if needed.</p> |
---|
132 | <p>The <tt>skipped_newline</tt> parameter holds a reference to a boolean value which should be set to true by the policy function whenever a newline is going to be skipped. </p> |
---|
133 | <p>If the return value is <tt>true</tt>, the given token is skipped and the preprocessing continues to the next token. If the return value is <tt>false</tt>, the given token is returned to the calling application. Caution has to be used, because by returning <span class="keyword">true</span> the policy function is able to force skipping even significant tokens not only whitespace. </p> |
---|
134 | </blockquote> |
---|
135 | <h3>Conditional compilation hook functions </h3> |
---|
136 | <p><a name="evaluated_conditional_expression"></a><strong>evaluated_conditional_expression</strong></p> |
---|
137 | <pre><span class="keyword"> template</span> <<span class="keyword">typename</span> ContainerT><br><span class="keyword"> void</span> evaluated_conditional_expression(ContainerT <span class="keyword">const</span>& expression, <br><span class="keyword"> bool</span> expression_value); |
---|
138 | </pre> |
---|
139 | <blockquote> |
---|
140 | <p>The function <tt>evaluated_conditional_expression</tt> is called, whenever the preprocessor has encountered a <span class="preprocessor">#if</span>, <span class="preprocessor">#elif</span>, <span class="preprocessor">#ifdef</span> or <span class="preprocessor">#ifndef</span> directive. This hook gets passed the non-expanded conditional expression (as it was given in the analysed source file) and the result of the evaluation of this expression in the current preprocessing context.</p> |
---|
141 | <p>The parameter <tt>expression</tt> holds the non-expanded token sequence |
---|
142 | comprising the evaluated expression.</p> |
---|
143 | <p>The parameter <tt>expression_value</tt> contains the result of the evaluation of |
---|
144 | the expression in the current preprocessing context. </p> |
---|
145 | </blockquote> |
---|
146 | <p><a name="skipped_token"></a><strong>skipped_token</strong></p> |
---|
147 | <pre> <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT> |
---|
148 | <span class="keyword">void</span> skipped_token(TokenT <span class="keyword">const</span>& token); |
---|
149 | </pre> |
---|
150 | <blockquote> |
---|
151 | <p>The function <tt>skipped_token</tt> is called, whenever a token is about to be skipped due to a false preprocessor condition (code fragments to be |
---|
152 | skipped inside the not evaluated conditional <span class="preprocessor">#if</span>/<span class="preprocessor">#else</span>/<span class="preprocessor">#endif</span> branches).</p> |
---|
153 | <p>The parameter <tt>token</tt> refers to the token to be skipped.</p> |
---|
154 | </blockquote> |
---|
155 | <h3>Macro expansion tracking functions</h3> |
---|
156 | <p><a name="expanding_function_like_macro"></a><b>expanding_function_like_macro</b></p> |
---|
157 | <pre><span class="keyword"> template</span> <<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT> |
---|
158 | <span class="keyword">void</span> expanding_function_like_macro(TokenT <span class="keyword">const</span> &macrodef, |
---|
159 | <span class="keyword">std::vector</span><TokenT> <span class="keyword">const</span> &formal_args, |
---|
160 | ContainerT <span class="keyword">const</span> &definition, TokenT <span class="keyword">const</span> &macrocall, |
---|
161 | <span class="keyword">std::vector</span><ContainerT> <span class="keyword">const</span> &arguments);</pre> |
---|
162 | <blockquote> |
---|
163 | <p>The function <tt>expanding_function_like_macro</tt> is called, whenever a |
---|
164 | function-like macro is to be expanded, i.e. <i>before</i> the actual expansion |
---|
165 | starts.</p> |
---|
166 | <p>The <tt>macroname</tt> parameter marks the position where the macro to expand |
---|
167 | is defined. It contains the token which identifies the macro name used inside |
---|
168 | the corresponding macro definition.</p> |
---|
169 | <p>The <tt>formal_args</tt> parameter holds the formal arguments used during |
---|
170 | the definition of the macro. </p> |
---|
171 | <p>The <tt>definition</tt> parameter holds the macro definition for the macro |
---|
172 | to trace. This is a standard STL container which holds the token sequence |
---|
173 | identified during the macro definition as the macro replacement list.</p> |
---|
174 | <p>The <tt>macrocall</tt> parameter marks the position where this macro is invoked. |
---|
175 | It contains the token, which identifies the macro call inside the preprocessed |
---|
176 | input stream. </p> |
---|
177 | <p>The <tt>arguments</tt> parameter holds the macro arguments used during the |
---|
178 | invocation of the macro. This is a vector of standard STL containers which |
---|
179 | contain the token sequences identified at the position of the macro call as |
---|
180 | the arguments to be used during the macro expansion. </p> |
---|
181 | </blockquote> |
---|
182 | <p><a name="expanding_object_like_macro"></a><b>expanding_object_like_macro</b></p> |
---|
183 | <pre> <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT> |
---|
184 | <span class="keyword">void</span> expanding_object_like_macro(TokenT <span class="keyword">const</span> &macro, |
---|
185 | ContainerT <span class="keyword">const</span> &definition, TokenT <span class="keyword">const</span> &macrocall); |
---|
186 | </pre> |
---|
187 | <blockquote> |
---|
188 | <p>The function <tt>expanding_object_like_macro</tt> is called, whenever a object-like |
---|
189 | macro is to be expanded, i.e. <i>before</i> the actual expansion starts.</p> |
---|
190 | <p>The <tt>macroname</tt> parameter marks the position where the macro to expand |
---|
191 | is defined. It contains the token which identifies the macro name used inside |
---|
192 | the corresponding macro definition.</p> |
---|
193 | <p> The <tt>definition</tt> parameter holds the macro definition for the macro |
---|
194 | to trace. This is a standard STL container which holds the token sequence |
---|
195 | identified during the macro definition as the macro replacement list.</p> |
---|
196 | <p>The <tt>macrocall</tt> parameter marks the position where this macro is invoked. |
---|
197 | It contains the token which identifies the macro call inside the preprocessed |
---|
198 | input stream. </p> |
---|
199 | </blockquote> |
---|
200 | <p><a name="expanded_macro"></a><b>expanded_macro</b></p> |
---|
201 | <pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContainerT> |
---|
202 | <span class="keyword">void</span> expanded_macro(ContainerT <span class="keyword">const</span> &result); |
---|
203 | </pre> |
---|
204 | <blockquote> |
---|
205 | <p>The function <tt>expanded_macro</tt> is called whenever the expansion of |
---|
206 | a macro is finished, the replacement list is completely scanned and the identified |
---|
207 | macros herein are replaced by its corresponding expansion results, but <i>before</i> |
---|
208 | the rescanning process starts.</p> |
---|
209 | <p>The parameter <tt>result</tt> contains the the result of the macro expansion |
---|
210 | so far. This is a standard STL container containing the generated token sequence.</p> |
---|
211 | </blockquote> |
---|
212 | <p><a name="rescanned_macro"></a><b>rescanned_macro</b></p> |
---|
213 | <pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContainerT> |
---|
214 | <span class="keyword">void</span> rescanned_macro(ContainerT <span class="keyword">const</span> &result); |
---|
215 | </pre> |
---|
216 | <blockquote> |
---|
217 | <p>The function <tt>rescanned_macro</tt> is called whenever the rescanning |
---|
218 | of a macro is finished, i.e. the macro expansion is complete.</p> |
---|
219 | <p>The parameter <tt>result</tt> contains the the result of the whole macro |
---|
220 | expansion. This is a standard STL container containing the generated token |
---|
221 | sequence.</p> |
---|
222 | </blockquote> |
---|
223 | <h3>Include file tracing functions</h3> |
---|
224 | <p><a name="opened_include_file" id="found_include_directive"></a><strong>found_include_directive</strong></p> |
---|
225 | <pre> <span class="keyword">void</span> found_include_directive(std::string <span class="keyword">const</span> &filename, |
---|
226 | <span class="keyword">bool</span> include_next); |
---|
227 | </pre> |
---|
228 | <blockquote> |
---|
229 | <p>The function <tt>found_include_directive</tt> is called whenever whenever a #include directive was located..</p> |
---|
230 | <p>The parameter <tt>filename</tt> contains the (expanded) file name found after |
---|
231 | the <span class="preprocessor">#include</span> directive. This has the format <tt><file></tt>, <tt>"file"</tt> or |
---|
232 | <tt>file</tt>. |
---|
233 | The formats <tt><file></tt> or <tt>"file"</tt> are used for <span class="preprocessor">#include</span> directives found |
---|
234 | in the preprocessed token stream, the format <tt>file</tt> is used for files |
---|
235 | specified through the --force_include command line argument.</p> |
---|
236 | <p>The parameter <tt>include_next</tt> is set to true if the found directive was |
---|
237 | a <span class="preprocessor">#include_next</span> directive and the <tt>BOOST_WAVE_SUPPORT_INCLUDE_NEXT</tt> preprocessing constant was defined to something != 0.<br> |
---|
238 | </p> |
---|
239 | </blockquote> |
---|
240 | <p><a name="opened_include_file" id="opened_include_file"></a><strong>opened_include_file</strong></p> |
---|
241 | <pre> <span class="keyword">void</span> opened_include_file(std::string <span class="keyword">const</span> &rel_filename, |
---|
242 | std::string <span class="keyword">const</span> &abs_filename, |
---|
243 | std::size_t include_depth, <span class="keyword">bool</span> is_system_include); |
---|
244 | </pre> |
---|
245 | <blockquote> |
---|
246 | <p>The function <tt>opened_include_file</tt> is called whenever a file referred |
---|
247 | by an <span class="preprocessor">#include</span> directive was successfully located and opened.</p> |
---|
248 | <p>The parameter <tt>rel_filename</tt> contains the (normalised) probably relative file system path of the opened file. The concrete format of this file name depends on the format of the include search path given to the library beforehand.</p> |
---|
249 | <p>The parameter <tt>abs_filename</tt> contains the (normalised) full file system path of the |
---|
250 | opened file.</p> |
---|
251 | <p>The <tt>include_depth</tt> parameter contains the current include file depth. |
---|
252 | </p> |
---|
253 | <p>The <tt>is_system_include</tt> parameter denotes, if the given file was found |
---|
254 | as a result of a <tt>#include <...></tt> directive.</p> |
---|
255 | </blockquote> |
---|
256 | <p><a name="returning_from_include_file" id="returning_from_include_file"></a><strong>returning_from_include_file</strong></p> |
---|
257 | <pre> <span class="keyword">void</span> returning_from_include_file(); |
---|
258 | </pre> |
---|
259 | <blockquote> |
---|
260 | <p>The function <tt>returning_from_include_file</tt> is called whenever an |
---|
261 | included file is about to be closed after it's processing is complete.</p> |
---|
262 | </blockquote> |
---|
263 | <h3>Interpretation of #pragma's</h3> |
---|
264 | <p><strong><a name="interpret_pragma"></a>interpret_pragma</strong></p> |
---|
265 | <pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT> |
---|
266 | bool <a href="class_reference_ctxpolicy.html#interpret_pragma">interpret_pragma</a>(ContextT <span class="keyword">const</span> &ctx, ContainerT &pending, |
---|
267 | <span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &option, |
---|
268 | ContainerT <span class="keyword">const</span> &values, |
---|
269 | <span class="keyword">typename</span> ContextT::token_type<span class="keyword"> const</span> &pragma_token); |
---|
270 | </pre> |
---|
271 | <blockquote> |
---|
272 | <p>The function <tt>interpret_pragma</tt> is called whenever an unrecognized |
---|
273 | <tt>#pragma wave ...</tt> or operator <tt>_Pragma("wave ...")</tt> |
---|
274 | is found in the input stream.</p> |
---|
275 | <p>The <tt>ctx</tt> parameter provides a reference to the <tt>context_type</tt> used during instantiation of the preprocessing iterators by the user. </p> |
---|
276 | <p>The <tt>pending</tt> parameter may be used to push tokens back into the input |
---|
277 | stream which are to be used as the replacement text for the whole <tt>#pragma wave()</tt> |
---|
278 | directive. If this sequence is left empty, no replacement takes place, i.e. |
---|
279 | the interpreted directive is removed from the generated token stream.</p> |
---|
280 | <p>The <tt>option</tt> parameter contains the name of the interpreted pragma.</p> |
---|
281 | <p>The <tt>values</tt> parameter holds the value of the parameter provided to |
---|
282 | the pragma operator.</p> |
---|
283 | <p>The <tt>pragma_token</tt> parameter contains the actual #pragma token which |
---|
284 | may be used for extraction of the location information for some error output.</p> |
---|
285 | <p>If the return value is 'false', the whole #pragma directive is interpreted |
---|
286 | as unknown and a corresponding error message is issued. A return value of |
---|
287 | 'true' signs a successful interpretation of the given #pragma.<br> |
---|
288 | </p> |
---|
289 | </blockquote> |
---|
290 | <h3>Macro definition </h3> |
---|
291 | <p><strong><a name="defined_macro" id="defined_macro"></a>defined_macro</strong></p> |
---|
292 | <pre> <span class="keyword">template</span> < |
---|
293 | <span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ParametersT, <span class="keyword">typename</span> DefinitionT |
---|
294 | > |
---|
295 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#defined_macro">defined_macro</a>(TokenT <span class="keyword">const</span> &name, <span class="keyword">bool</span> is_functionlike, |
---|
296 | ParametersT <span class="keyword">const</span> &parameters, DefinitionT <span class="keyword">const</span> &definition, |
---|
297 | <span class="keyword">bool</span> is_predefined); |
---|
298 | </pre> |
---|
299 | <blockquote> <p>The function <tt>defined_macro</tt> is called whenever a macro was defined successfully.</p> |
---|
300 | <p>The parameter <tt>name</tt> is a reference to the token holding the macro name.</p> |
---|
301 | <p>The parameter <tt>is_functionlike</tt> is set to true whenever the newly |
---|
302 | defined macro is defined as a function like macro.</p> |
---|
303 | <p>The parameter <tt>parameters</tt> holds the parameter tokens for the macro |
---|
304 | definition. If the macro has no parameters or if it is a object like |
---|
305 | macro, then this container is empty.</p> |
---|
306 | <p>The parameter <tt>definition</tt> contains the token sequence given as the |
---|
307 | replacement sequence (definition part) of the newly defined macro.</p> |
---|
308 | <p>The parameter <tt>is_predefined</tt> is set to true for all macros predefined |
---|
309 | during the initialisation pahase of the library.<br> |
---|
310 | </p> |
---|
311 | </blockquote> |
---|
312 | <p><strong><a name="undefined_macro" id="undefined_macro"></a>undefined_macro</strong></p> |
---|
313 | <pre> <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT> |
---|
314 | <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#undefined_macro">undefined_macro</a>(TokenT<span class="keyword">const</span> &name); |
---|
315 | </pre> |
---|
316 | <blockquote> |
---|
317 | <p>The function <tt>undefined_macro</tt> is called whenever a macro definition |
---|
318 | was removed successfully.</p> |
---|
319 | <p>The parameter <tt>name</tt> holds the token of the macro which definition was removed.<br> |
---|
320 | </p> |
---|
321 | </blockquote> |
---|
322 | <table border="0"> |
---|
323 | <tr> |
---|
324 | <td width="10"></td> |
---|
325 | <td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td> |
---|
326 | <td width="30"><a href="class_reference_inptpolcy.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td> |
---|
327 | <td width="30"><a href="class_reference_lexer.html"><img src="theme/r_arr.gif" border="0"></a></td> |
---|
328 | </tr> |
---|
329 | </table> |
---|
330 | <hr size="1"> |
---|
331 | <p class="copyright">Copyright © 2003-2007 Hartmut Kaiser<br> |
---|
332 | <br> |
---|
333 | <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> |
---|
334 | <p class="copyright"><span class="updated">Last updated: |
---|
335 | <!-- #BeginDate format:fcAm1m -->Sunday, February 26, 2006 14:19<!-- #EndDate --> |
---|
336 | </span></p> |
---|
337 | </body> |
---|
338 | </html> |
---|