mirror of
https://github.com/boostorg/wave.git
synced 2026-01-19 04:42:16 +00:00
Remove long-deprecated hooks API
Removal in 1.76 was noted in the docs and warned about since 1.74.
This commit is contained in:
@@ -1,342 +0,0 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||
<html>
|
||||
<head>
|
||||
<title>The Context Policy</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<link href="theme/style.css" rel="stylesheet" type="text/css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table width="100%" border="0" cellspacing="2" background="theme/bkd2.gif">
|
||||
<tr>
|
||||
<td width="21"> <h1></h1></td>
|
||||
<td width="885"> <font face="Verdana, Arial, Helvetica, sans-serif"><b><font size="6">The
|
||||
Context Policy (depreciated interface) </font></b></font></td>
|
||||
<td width="96"><a href="http://www.boost.org"><img src="theme/wave.gif" width="93" height="68" align="right" border="0"></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td width="10"></td>
|
||||
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
|
||||
<td width="30"><a href="class_reference_inptpolcy.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td>
|
||||
<td width="30"><a href="class_reference_lexer.html"><img src="theme/r_arr.gif" border="0"></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<blockquote>
|
||||
<p><a href="class_reference_ctxpolicy.html#introduction">Introduction</a><br>
|
||||
<a href="class_reference_ctxpolicy.html#header_synopsis">Header 'wave/preprocessing_hooks.hpp'
|
||||
synopsis</a><br>
|
||||
<a href="class_reference_ctxpolicy.html#member_functions">Member functions</a></p>
|
||||
</blockquote>
|
||||
<h2><b><a name="introduction"></a>Introduction</b></h2>
|
||||
<p>Please note that the following description relates to a depreciated interface as it was used by default up to Boost V1.34.x. For the new interface please refer to <a href="class_reference_ctxpolicy.html">The Context Policy</a>. You can still force to use this older interface by defining the <tt>BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS</tt> preprocessing constant as outlined in the <a href="compiletime_config.html">Compile
|
||||
Time Configuration</a> section. By default the new interface is used starting Boost V1.35.0, while the older one is used by default otherwise. The old interface will be removed entirely with Boost 1.76.</p>
|
||||
<p>The context policy is used to provide callback hooks, which are called from inside the library into the user code, whenever</p>
|
||||
<ul>
|
||||
<li>a preprocessor directive has been recognized, </li>
|
||||
<li>a token is about to be returned from the preprocessor, </li>
|
||||
<li>a macro get's defined or undefined, </li>
|
||||
<li>a macro has been expanded or rescanned,</li>
|
||||
<li>an include file has been opened or left, </li>
|
||||
<li>a conditional expression was evaluated,</li>
|
||||
<li>a token has to be skipped because it is contained in a non-evaluated conditional block, </li>
|
||||
<li> a pragma of the form <tt>'wave option[(value)]'</tt> has been recognised. </li>
|
||||
</ul>
|
||||
<p>This policy type is used as a template parameter to the <a href="class_reference_context.html"><tt>boost::wave::context<></tt></a>
|
||||
object, where the default policy provides empty hook functions only.</p>
|
||||
<h2><a name="header_synopsis"></a>Header <a href="http://svn.boost.org/trac/boost/browser/trunk/boost/wave/preprocessing_hooks.hpp">wave/preprocessing_hooks.hpp</a>
|
||||
synopsis</h2>
|
||||
<pre>
|
||||
<span class="keyword">namespace</span> boost {
|
||||
<span class="keyword">namespace</span> wave {
|
||||
<span class="keyword">namespace</span> context_policies {
|
||||
|
||||
<span class="keyword">struct</span> default_preprocessing_hooks {
|
||||
|
||||
<span class="comment">// general hook functions</span>
|
||||
<span class="keyword">template</span> <<span class="keyword">typename</span> TokenT>
|
||||
<span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#found_directive">found_directive</a>(TokenT <span class="keyword">const </span>&directive);<br>
|
||||
<span class="comment">// test, whether a given token may be skipped</span><br> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT>
|
||||
<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,
|
||||
TokenT &token, <span class="keyword">bool</span> &skipped_newline);<br>
|
||||
</span><span class="comment">// Conditional compilation</span><span class="keyword">
|
||||
template</span> <<span class="keyword">typename</span> ContainerT><br> <span class="keyword">bool</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>
|
||||
<span class="keyword">template</span> <<span class="keyword">typename</span> TokenT>
|
||||
<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>
|
||||
<span class="comment">// macro expansion tracing</span><span class="keyword">
|
||||
template</span> <<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT>
|
||||
<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,
|
||||
<span class="keyword">std::vector</span><TokenT> <span class="keyword">const</span> &formal_args,
|
||||
ContainerT <span class="keyword">const</span> &definition, TokenT <span class="keyword">const</span> &macrocall,
|
||||
<span class="keyword">std::vector</span><ContainerT> <span class="keyword">const</span> &arguments);
|
||||
|
||||
<span class="keyword">template</span> <<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT>
|
||||
<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,
|
||||
ContainerT <span class="keyword">const</span> &definition, TokenT <span class="keyword">const</span> &macrocall);
|
||||
|
||||
<span class="keyword">template</span> <<span class="keyword">typename</span> ContainerT>
|
||||
<span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#expanded_macro">expanded_macro</a>(ContainerT <span class="keyword">const</span> &result);
|
||||
|
||||
<span class="keyword">template</span> <<span class="keyword">typename</span> ContainerT>
|
||||
<span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#expanded_macro">rescanned_macro</a>(ContainerT <span class="keyword">const</span> &result);
|
||||
|
||||
<span class="comment">// include file tracing functions</span>
|
||||
<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,
|
||||
<span class="keyword">bool</span> include_next);
|
||||
|
||||
<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,
|
||||
std::string const& absname,
|
||||
std::size_t include_depth, <span class="keyword">bool</span> is_system_include);
|
||||
|
||||
<span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#returning_from_include_file">returning_from_include_file</a>();
|
||||
|
||||
<span class="comment">// interpretation of #pragmas of the form </span>
|
||||
<span class="comment">// 'wave option[(value)]'</span>
|
||||
<span class="keyword">template</span> <<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT>
|
||||
bool <a href="class_reference_ctxpolicy.html#interpret_pragma">interpret_pragma</a>(ContextT <span class="keyword">const</span> &ctx, ContainerT &pending,
|
||||
<span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &option,
|
||||
ContainerT <span class="keyword">const</span> &values,
|
||||
<span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &pragma_token);
|
||||
|
||||
<span class="comment">// macro definition hooks</span>
|
||||
<span class="keyword">template</span> <
|
||||
<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ParametersT, <span class="keyword">typename</span> DefinitionT
|
||||
>
|
||||
<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,
|
||||
ParametersT <span class="keyword">const</span> &parameters, DefinitionT <span class="keyword">const</span> &definition,
|
||||
<span class="keyword">bool</span> is_predefined);
|
||||
|
||||
<span class="keyword">template</span> <<span class="keyword">typename</span> TokenT>
|
||||
<span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#undefined_macro">undefined_macro</a>(TokenT<span class="keyword">const</span> &name);
|
||||
};
|
||||
|
||||
}}} <span class="comment">// namespace boost::wave::context_policies</span></pre>
|
||||
<h2><a name="member_functions"></a>Member functions</h2>
|
||||
<h3>General hook functions </h3>
|
||||
<p><a name="found_directive"></a><strong>found_directive</strong></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT>
|
||||
<span class="keyword">void</span> found_directive(TokenT <span class="keyword">const </span>&directive);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<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>
|
||||
<p>The parameter <tt>directive</tt> refers to the token containing the detected preprocessing directive. </p>
|
||||
</blockquote>
|
||||
<p><a name="may_skip_whitespace" id="may_skip"></a><strong>may_skipwhitespace</strong></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> TokenT>
|
||||
<span class="keyword">bool</span> may_skip_whitespace(ContextT <span class="keyword">const</span>& ctx, TokenT &token, <span class="keyword">bool</span>& skipped_newline);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<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>
|
||||
<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 for the Wave V1.2.4 release. </p>
|
||||
<p>The <tt>token</tt> parameter holds a reference to the current token. The policy is free to change this token if needed.</p>
|
||||
<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>
|
||||
<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>
|
||||
</blockquote>
|
||||
<h3>Conditional compilation hook functions </h3>
|
||||
<p><a name="evaluated_conditional_expression"></a><strong>evaluated_conditional_expression</strong></p>
|
||||
<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, <span class="keyword">bool</span> expression_value);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<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>
|
||||
<p>The parameter <tt>expression</tt> holds the non-expanded token sequence
|
||||
comprising the evaluated expression.</p>
|
||||
<p>The parameter <tt>expression_value</tt> contains the result of the evaluation of
|
||||
the expression in the current preprocessing context.<br>
|
||||
</p>
|
||||
</blockquote>
|
||||
<p><a name="skipped_token"></a><strong>skipped_token</strong></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT>
|
||||
<span class="keyword">void</span> skipped_token(TokenT <span class="keyword">const</span>& token);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<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
|
||||
skipped inside the not evaluated conditional <span class="preprocessor">#if</span>/<span class="preprocessor">#else</span>/<span class="preprocessor">#endif</span> branches).</p>
|
||||
<p>The parameter <tt>token</tt> refers to the token to be skipped.</p>
|
||||
</blockquote>
|
||||
<h3>Macro expansion tracking functions</h3>
|
||||
<p><a name="expanding_function_like_macro"></a><b>expanding_function_like_macro</b></p>
|
||||
<pre><span class="keyword"> template</span> <<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT>
|
||||
<span class="keyword">void</span> expanding_function_like_macro(TokenT <span class="keyword">const</span> &macrodef,
|
||||
<span class="keyword">std::vector</span><TokenT> <span class="keyword">const</span> &formal_args,
|
||||
ContainerT <span class="keyword">const</span> &definition, TokenT <span class="keyword">const</span> &macrocall,
|
||||
<span class="keyword">std::vector</span><ContainerT> <span class="keyword">const</span> &arguments);</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>expanding_function_like_macro</tt> is called, whenever a
|
||||
function-like macro is to be expanded, i.e. <i>before</i> the actual expansion
|
||||
starts.</p>
|
||||
<p>The <tt>macroname</tt> parameter marks the position where the macro to expand
|
||||
is defined. It contains the token which identifies the macro name used inside
|
||||
the corresponding macro definition.</p>
|
||||
<p>The <tt>formal_args</tt> parameter holds the formal arguments used during
|
||||
the definition of the macro. </p>
|
||||
<p>The <tt>definition</tt> parameter holds the macro definition for the macro
|
||||
to trace. This is a standard STL container which holds the token sequence
|
||||
identified during the macro definition as the macro replacement list.</p>
|
||||
<p>The <tt>macrocall</tt> parameter marks the position where this macro is invoked.
|
||||
It contains the token, which identifies the macro call inside the preprocessed
|
||||
input stream. </p>
|
||||
<p>The <tt>arguments</tt> parameter holds the macro arguments used during the
|
||||
invocation of the macro. This is a vector of standard STL containers which
|
||||
contain the token sequences identified at the position of the macro call as
|
||||
the arguments to be used during the macro expansion. </p>
|
||||
</blockquote>
|
||||
<p><a name="expanding_object_like_macro"></a><b>expanding_object_like_macro</b></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ContainerT>
|
||||
<span class="keyword">void</span> expanding_object_like_macro(TokenT <span class="keyword">const</span> &macro,
|
||||
ContainerT <span class="keyword">const</span> &definition, TokenT <span class="keyword">const</span> &macrocall);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>expanding_object_like_macro</tt> is called, whenever a object-like
|
||||
macro is to be expanded, i.e. <i>before</i> the actual expansion starts.</p>
|
||||
<p>The <tt>macroname</tt> parameter marks the position where the macro to expand
|
||||
is defined. It contains the token which identifies the macro name used inside
|
||||
the corresponding macro definition.</p>
|
||||
<p> The <tt>definition</tt> parameter holds the macro definition for the macro
|
||||
to trace. This is a standard STL container which holds the token sequence
|
||||
identified during the macro definition as the macro replacement list.</p>
|
||||
<p>The <tt>macrocall</tt> parameter marks the position where this macro is invoked.
|
||||
It contains the token which identifies the macro call inside the preprocessed
|
||||
input stream. </p>
|
||||
</blockquote>
|
||||
<p><a name="expanded_macro"></a><b>expanded_macro</b></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContainerT>
|
||||
<span class="keyword">void</span> expanded_macro(ContainerT <span class="keyword">const</span> &result);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>expanded_macro</tt> is called whenever the expansion of
|
||||
a macro is finished, the replacement list is completely scanned and the identified
|
||||
macros herein are replaced by its corresponding expansion results, but <i>before</i>
|
||||
the rescanning process starts.</p>
|
||||
<p>The parameter <tt>result</tt> contains the the result of the macro expansion
|
||||
so far. This is a standard STL container containing the generated token sequence.</p>
|
||||
</blockquote>
|
||||
<p><a name="rescanned_macro"></a><b>rescanned_macro</b></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContainerT>
|
||||
<span class="keyword">void</span> rescanned_macro(ContainerT <span class="keyword">const</span> &result);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>rescanned_macro</tt> is called whenever the rescanning
|
||||
of a macro is finished, i.e. the macro expansion is complete.</p>
|
||||
<p>The parameter <tt>result</tt> contains the the result of the whole macro
|
||||
expansion. This is a standard STL container containing the generated token
|
||||
sequence.</p>
|
||||
</blockquote>
|
||||
<h3>Include file tracing functions</h3>
|
||||
<p><a name="opened_include_file" id="found_include_directive"></a><strong>found_include_directive</strong></p>
|
||||
<pre> <span class="keyword">void</span> found_include_directive(std::string <span class="keyword">const</span> &filename,
|
||||
<span class="keyword">bool</span> include_next);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>found_include_directive</tt> is called whenever whenever a #include directive was located..</p>
|
||||
<p>The parameter <tt>filename</tt> contains the (expanded) file name found after
|
||||
the <span class="preprocessor">#include</span> directive. This has the format <tt><file></tt>, <tt>"file"</tt> or
|
||||
<tt>file</tt>.
|
||||
The formats <tt><file></tt> or <tt>"file"</tt> are used for <span class="preprocessor">#include</span> directives found
|
||||
in the preprocessed token stream, the format <tt>file</tt> is used for files
|
||||
specified through the --force_include command line argument.</p>
|
||||
<p>The parameter <tt>include_next</tt> is set to true if the found directive was
|
||||
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>
|
||||
</p>
|
||||
</blockquote>
|
||||
<p><a name="opened_include_file" id="opened_include_file"></a><strong>opened_include_file</strong></p>
|
||||
<pre> <span class="keyword">void</span> opened_include_file(std::string <span class="keyword">const</span> &rel_filename,
|
||||
std::string <span class="keyword">const</span> &abs_filename,
|
||||
std::size_t include_depth, <span class="keyword">bool</span> is_system_include);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>opened_include_file</tt> is called whenever a file referred
|
||||
by an <span class="preprocessor">#include</span> directive was successfully located and opened.</p>
|
||||
<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>
|
||||
<p>The parameter <tt>abs_filename</tt> contains the (normalised) full file system path of the
|
||||
opened file.</p>
|
||||
<p>The <tt>include_depth</tt> parameter contains the current include file depth.
|
||||
</p>
|
||||
<p>The <tt>is_system_include</tt> parameter denotes, if the given file was found
|
||||
as a result of a <tt>#include <...></tt> directive.</p>
|
||||
</blockquote>
|
||||
<p><a name="returning_from_include_file" id="returning_from_include_file"></a><strong>returning_from_include_file</strong></p>
|
||||
<pre> <span class="keyword">void</span> returning_from_include_file();
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>returning_from_include_file</tt> is called whenever an
|
||||
included file is about to be closed after it's processing is complete.</p>
|
||||
</blockquote>
|
||||
<h3>Interpretation of #pragmas</h3>
|
||||
<p><strong><a name="interpret_pragma"></a>interpret_pragma</strong></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT>
|
||||
bool <a href="class_reference_ctxpolicy.html#interpret_pragma">interpret_pragma</a>(ContextT <span class="keyword">const</span> &ctx, ContainerT &pending,
|
||||
<span class="keyword">typename</span> ContextT::token_type <span class="keyword">const</span> &option,
|
||||
ContainerT <span class="keyword">const</span> &values,
|
||||
<span class="keyword">typename</span> ContextT::token_type<span class="keyword"> const</span> &pragma_token);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>interpret_pragma</tt> is called whenever an unrecognized
|
||||
<tt>#pragma wave ...</tt> or operator <tt>_Pragma("wave ...")</tt>
|
||||
is found in the input stream.</p>
|
||||
<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>
|
||||
<p>The <tt>pending</tt> parameter may be used to push tokens back into the input
|
||||
stream which are to be used as the replacement text for the whole <tt>#pragma wave()</tt>
|
||||
directive. If this sequence is left empty, no replacement takes place, i.e.
|
||||
the interpreted directive is removed from the generated token stream.</p>
|
||||
<p>The <tt>option</tt> parameter contains the name of the interpreted pragma.</p>
|
||||
<p>The <tt>values</tt> parameter holds the value of the parameter provided to
|
||||
the pragma operator.</p>
|
||||
<p>The <tt>pragma_token</tt> parameter contains the actual #pragma token which
|
||||
may be used for extraction of the location information for some error output.</p>
|
||||
<p>If the return value is 'false', the whole #pragma directive is interpreted
|
||||
as unknown and a corresponding error message is issued. A return value of
|
||||
'true' signs a successful interpretation of the given #pragma.<br>
|
||||
</p>
|
||||
</blockquote>
|
||||
<h3>Macro definition </h3>
|
||||
<p><strong><a name="defined_macro" id="defined_macro"></a>defined_macro</strong></p>
|
||||
<pre> <span class="keyword">template</span> <
|
||||
<span class="keyword">typename</span> TokenT, <span class="keyword">typename</span> ParametersT, <span class="keyword">typename</span> DefinitionT
|
||||
>
|
||||
<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,
|
||||
ParametersT <span class="keyword">const</span> &parameters, DefinitionT <span class="keyword">const</span> &definition,
|
||||
<span class="keyword">bool</span> is_predefined);
|
||||
</pre>
|
||||
<blockquote> <p>The function <tt>defined_macro</tt> is called whenever a macro was defined successfully.</p>
|
||||
<p>The parameter <tt>name</tt> is a reference to the token holding the macro name.</p>
|
||||
<p>The parameter <tt>is_functionlike</tt> is set to true whenever the newly
|
||||
defined macro is defined as a function like macro.</p>
|
||||
<p>The parameter <tt>parameters</tt> holds the parameter tokens for the macro
|
||||
definition. If the macro has no parameters or if it is a object like
|
||||
macro, then this container is empty.</p>
|
||||
<p>The parameter <tt>definition</tt> contains the token sequence given as the
|
||||
replacement sequence (definition part) of the newly defined macro.</p>
|
||||
<p>The parameter <tt>is_predefined</tt> is set to true for all macros predefined
|
||||
during the initialisation pahase of the library.<br>
|
||||
</p>
|
||||
</blockquote>
|
||||
<p><strong><a name="undefined_macro" id="undefined_macro"></a>undefined_macro</strong></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> TokenT>
|
||||
<span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#undefined_macro">undefined_macro</a>(TokenT<span class="keyword">const</span> &name);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>undefined_macro</tt> is called whenever a macro definition
|
||||
was removed successfully.</p>
|
||||
<p>The parameter <tt>name</tt> holds the token of the macro which definition was removed.<br>
|
||||
</p>
|
||||
</blockquote>
|
||||
<table border="0">
|
||||
<tr>
|
||||
<td width="10"></td>
|
||||
<td width="30"><a href="../index.html"><img src="theme/u_arr.gif" border="0"></a></td>
|
||||
<td width="30"><a href="class_reference_inptpolcy.html"><img src="theme/l_arr.gif" width="20" height="19" border="0"></a></td>
|
||||
<td width="30"><a href="class_reference_lexer.html"><img src="theme/r_arr.gif" border="0"></a></td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2011 Hartmut Kaiser<br>
|
||||
<br>
|
||||
<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>
|
||||
<p class="copyright"><span class="updated">Last updated:
|
||||
<!-- #BeginDate format:fcAm1m -->Tuesday, May 23, 2006 12:52<!-- #EndDate -->
|
||||
</span></p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -39,10 +39,6 @@
|
||||
<a href="class_reference_ctxpolicy.html#member_functions">Member functions</a></p>
|
||||
</blockquote>
|
||||
<h2><b><a name="introduction"></a>Introduction</b></h2>
|
||||
<p>Please note that the following description relates to the new
|
||||
preprocessing hooks interface used by default starting with the Boost
|
||||
V1.35.0 release. If you are interested in the older interface please
|
||||
look <a href="class_ref_ctxpolicy_depr.html">here</a>. </p>
|
||||
<p>The context policy is used to provide callback hooks, which are called from inside the library into the user code, whenever</p>
|
||||
<ul>
|
||||
<li>a preprocessor directive has been recognized (or <b>not</b> recognized), </li>
|
||||
@@ -107,8 +103,7 @@
|
||||
</pre>
|
||||
<blockquote>
|
||||
<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>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>directive</tt> refers to the token containing the detected preprocessing directive. </p>
|
||||
<p>If the return value is <tt>true</tt>, the directive will be
|
||||
skipped altogether, i.e. no preprocessing is done. The overall
|
||||
@@ -160,8 +155,7 @@
|
||||
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>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The <tt>token</tt> parameter holds a reference to the evaluated directive token. </p>
|
||||
<p>The parameter <tt>expression</tt> holds the non-expanded token sequence
|
||||
comprising the evaluated expression.</p>
|
||||
@@ -169,7 +163,7 @@
|
||||
the expression in the current preprocessing context. </p>
|
||||
<p>The return value defines, whether the given expression has to be
|
||||
evaluated again, allowing to decide which of the conditional branches
|
||||
should be expanded. You need to return '<span class="keyword">true</span>' from this hook function to force the expression to be re-evaluated. Note, this was changed from a '<span class="keyword">void</span>' for the Boost V1.35.0 release. <br>
|
||||
should be expanded. You need to return '<span class="keyword">true</span>' from this hook function to force the expression to be re-evaluated. <br>
|
||||
</p>
|
||||
</blockquote>
|
||||
<p><a name="skipped_token"></a><strong>skipped_token</strong></p>
|
||||
@@ -178,8 +172,7 @@
|
||||
<blockquote>
|
||||
<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
|
||||
skipped inside the not evaluated conditional <span class="preprocessor">#if</span>/<span class="preprocessor">#else</span>/<span class="preprocessor">#endif</span> branches).</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>token</tt> refers to the token to be skipped.</p>
|
||||
</blockquote>
|
||||
<p><a name="generated_token"></a><strong>generated_token</strong></p>
|
||||
@@ -187,8 +180,7 @@
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>generated_token</tt> is called, whenever a token is about to be returned from the library.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>token</tt> refers to the token about to be
|
||||
returned from the library. This function may alter the token, but in
|
||||
this case it must be implemented with a non-const reference for the
|
||||
@@ -202,8 +194,7 @@
|
||||
<p>The function <tt>expanding_function_like_macro</tt> is called, whenever a
|
||||
function-like macro is to be expanded, i.e. <i>before</i> the actual expansion
|
||||
starts.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The <tt>macroname</tt> parameter marks the position where the macro to expand
|
||||
is defined. It contains the token which identifies the macro name used inside
|
||||
the corresponding macro definition.</p>
|
||||
@@ -235,8 +226,7 @@
|
||||
<blockquote>
|
||||
<p>The function <tt>expanding_object_like_macro</tt> is called, whenever a object-like
|
||||
macro is to be expanded, i.e. <i>before</i> the actual expansion starts.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The <tt>macroname</tt> parameter marks the position where the macro to expand
|
||||
is defined. It contains the token which identifies the macro name used inside
|
||||
the corresponding macro definition.</p>
|
||||
@@ -256,8 +246,7 @@
|
||||
<p>The function <tt>expanded_macro</tt> is called whenever the expansion of
|
||||
a macro is finished, the replacement list is completely scanned and the identified
|
||||
macros herein are replaced by its corresponding expansion results, but <i>before</i> the rescanning process starts.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>result</tt> contains the the result of the macro expansion
|
||||
so far. This is a standard STL container containing the generated token sequence.</p>
|
||||
</blockquote>
|
||||
@@ -267,8 +256,7 @@
|
||||
<blockquote>
|
||||
<p>The function <tt>rescanned_macro</tt> is called whenever the rescanning
|
||||
of a macro is finished, i.e. the macro expansion is complete.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>result</tt> contains the the result of the whole macro
|
||||
expansion. This is a standard STL container containing the generated token
|
||||
sequence.</p>
|
||||
@@ -279,8 +267,7 @@
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>found_include_directive</tt> is called whenever whenever a #include directive was located..</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>filename</tt> contains the (expanded) file name found after
|
||||
the <span class="preprocessor">#include</span> directive. This has the format <tt><file></tt>, <tt>"file"</tt> or <tt>file</tt>.
|
||||
The formats <tt><file></tt> or <tt>"file"</tt> are used for <span class="preprocessor">#include</span> directives found
|
||||
@@ -341,8 +328,7 @@ non-zero). In this case it points to unique full name of the current
|
||||
<blockquote>
|
||||
<p>The function <tt>opened_include_file</tt> is called whenever a file referred
|
||||
by an <span class="preprocessor">#include</span> directive was successfully located and opened.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<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
|
||||
@@ -358,8 +344,7 @@ non-zero). In this case it points to unique full name of the current
|
||||
<blockquote>
|
||||
<p>The function <tt>returning_from_include_file</tt> is called whenever an
|
||||
included file is about to be closed after it's processing is complete.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
</blockquote>
|
||||
<p><a name="detected_include_guard" id="detected_include_guard"></a><strong>detected_include_guard</strong></p>
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT><br> <span class="keyword">void</span> detected_include_guard(ContextT <span class="keyword">const</span>& ctx,
|
||||
@@ -425,8 +410,7 @@ non-zero). In this case it points to unique full name of the current
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>defined_macro</tt> is called whenever a macro was defined successfully.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>name</tt> is a reference to the token holding the macro name.</p>
|
||||
<p>The parameter <tt>is_functionlike</tt> is set to true whenever the newly
|
||||
defined macro is defined as a function like macro.</p>
|
||||
@@ -445,8 +429,7 @@ non-zero). In this case it points to unique full name of the current
|
||||
<blockquote>
|
||||
<p>The function <tt>undefined_macro</tt> is called whenever a macro definition
|
||||
was removed successfully.</p>
|
||||
<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 for the Boost V1.35.0 release. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>name</tt> holds the token of the macro which definition was removed.<br>
|
||||
</p>
|
||||
</blockquote>
|
||||
@@ -455,8 +438,7 @@ non-zero). In this case it points to unique full name of the current
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>found_warning_directive </tt> is called whenever a <span class="preprocessor">#warning </span>directive
|
||||
has been encountered. Note, this function was added for the Boost
|
||||
V1.35.0 release. This function will be called only if the <tt>BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE</tt> compile time constant was defined to something not equal to zero (see the <a href="compiletime_config.html">Compile Time Configuration</a> for more information). </p>
|
||||
has been encountered. This function will be called only if the <tt>BOOST_WAVE_SUPPORT_WARNING_DIRECTIVE</tt> compile time constant was defined to something not equal to zero (see the <a href="compiletime_config.html">Compile Time Configuration</a> for more information). </p>
|
||||
<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>
|
||||
<p>The parameter <tt>message</tt> references the argument token sequence of the encountered <span class="preprocessor">#warning</span> directive.</p>
|
||||
<p>If the return value is <tt>false</tt>, the library throws a preprocessor
|
||||
@@ -466,7 +448,7 @@ non-zero). In this case it points to unique full name of the current
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT><br> <span class="keyword">bool</span> <a href="class_reference_ctxpolicy.html#found_error_directive">found_error_directive</a>(ContextT <span class="keyword">const</span>& ctx, <br> ContainerT <span class="keyword">const</span> &message);<br>
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>found_error_directive </tt> is called whenever a <span class="preprocessor">#error </span>directive has been encountered. Note, this function was added for the Boost V1.35.0 release. </p>
|
||||
<p>The function <tt>found_error_directive </tt> is called whenever a <span class="preprocessor">#error </span>directive has been encountered. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>message</tt> references the argument token sequence of the encountered <span class="preprocessor">#error</span> directive.</p>
|
||||
<p>If the return value is <tt>false</tt>, the library throws a preprocessor
|
||||
@@ -476,7 +458,7 @@ non-zero). In this case it points to unique full name of the current
|
||||
<pre> <span class="keyword">template</span> <<span class="keyword">typename</span> ContextT, <span class="keyword">typename</span> ContainerT><br> <span class="keyword">void</span> <a href="class_reference_ctxpolicy.html#found_error_directive"><strong>found_line_directive</strong></a>(ContextT <span class="keyword">const</span>& ctx, <br> ContainerT <span class="keyword">const</span> &arguments, <span class="keyword">unsigned int</span> line,<br> std::string <span class="keyword">const</span>& filename);
|
||||
</pre>
|
||||
<blockquote>
|
||||
<p>The function <tt>found_line_directive </tt> is called whenever a <span class="preprocessor">#line </span>directive has been encountered. Note, this function was added for the Boost V1.35.0 release. </p>
|
||||
<p>The function <tt>found_line_directive </tt> is called whenever a <span class="preprocessor">#line </span>directive has been encountered. </p>
|
||||
<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>
|
||||
<p>The parameter <tt>arguments</tt> references the argument token sequence of the encountered <span class="preprocessor">#line</span> directive.</p>
|
||||
<p>The parameter <tt>line</tt> contains the recognized line number from the <span class="preprocessor">#line</span> directive.</p>
|
||||
|
||||
@@ -127,10 +127,6 @@
|
||||
<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 pragmas. This constant defaults to <span class="literal">"wave"</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>
|
||||
</p> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_cells"><code>BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS</code></td>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_cells"><code>BOOST_WAVE_SUPPORT_LONGLONG_INTEGER_LITERALS</code></td>
|
||||
<td class="table_cells"><p>The C++ standard requires the preprocessor to use one of the following
|
||||
|
||||
@@ -66,16 +66,6 @@ struct default_preprocessing_hooks
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename TokenT, typename ContainerT>
|
||||
void expanding_function_like_macro(
|
||||
TokenT const& macrodef, std::vector<TokenT> const& formal_args,
|
||||
ContainerT const& definition,
|
||||
TokenT const& macrocall, std::vector<ContainerT> const& arguments)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename TokenT, typename ContainerT, typename IteratorT>
|
||||
bool
|
||||
expanding_function_like_macro(ContextT const& ctx,
|
||||
@@ -84,7 +74,6 @@ struct default_preprocessing_hooks
|
||||
TokenT const& macrocall, std::vector<ContainerT> const& arguments,
|
||||
IteratorT const& seqstart, IteratorT const& seqend)
|
||||
{ return false; } // default is to normally expand the macro
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -106,20 +95,11 @@ struct default_preprocessing_hooks
|
||||
// expanded (return false) or will be copied to the output (return true).
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename TokenT, typename ContainerT>
|
||||
void expanding_object_like_macro(TokenT const& macro,
|
||||
ContainerT const& definition, TokenT const& macrocall)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename TokenT, typename ContainerT>
|
||||
bool
|
||||
expanding_object_like_macro(ContextT const& ctx, TokenT const& macro,
|
||||
ContainerT const& definition, TokenT const& macrocall)
|
||||
{ return false; } // default is to normally expand the macro
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -133,17 +113,9 @@ struct default_preprocessing_hooks
|
||||
// result of the macro expansion.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename ContainerT>
|
||||
void expanded_macro(ContainerT const& result)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename ContainerT>
|
||||
void expanded_macro(ContextT const& ctx, ContainerT const& result)
|
||||
{}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -157,17 +129,9 @@ struct default_preprocessing_hooks
|
||||
// result of the rescanning.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename ContainerT>
|
||||
void rescanned_macro(ContainerT const& result)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename ContainerT>
|
||||
void rescanned_macro(ContextT const& ctx, ContainerT const& result)
|
||||
{}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -249,13 +213,6 @@ struct default_preprocessing_hooks
|
||||
// (return false) or will be skipped (return true).
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
void
|
||||
found_include_directive(std::string const& filename, bool include_next)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT>
|
||||
bool
|
||||
found_include_directive(ContextT const& ctx, std::string const& filename,
|
||||
@@ -263,7 +220,6 @@ struct default_preprocessing_hooks
|
||||
{
|
||||
return false; // ok to include this file
|
||||
}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -284,20 +240,11 @@ struct default_preprocessing_hooks
|
||||
// found as a result of a #include <...> directive.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
void
|
||||
opened_include_file(std::string const& relname, std::string const& absname,
|
||||
std::size_t include_depth, bool is_system_include)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT>
|
||||
void
|
||||
opened_include_file(ContextT const& ctx, std::string const& relname,
|
||||
std::string const& absname, bool is_system_include)
|
||||
{}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -308,18 +255,10 @@ struct default_preprocessing_hooks
|
||||
// instantiating the preprocessing iterators by the user.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
void
|
||||
returning_from_include_file()
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT>
|
||||
void
|
||||
returning_from_include_file(ContextT const& ctx)
|
||||
{}
|
||||
#endif
|
||||
|
||||
#if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -486,16 +425,6 @@ struct default_preprocessing_hooks
|
||||
// during the initialization phase of the library.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename TokenT, typename ParametersT, typename DefinitionT>
|
||||
void
|
||||
defined_macro(TokenT const& macro_name, bool is_functionlike,
|
||||
ParametersT const& parameters, DefinitionT const& definition,
|
||||
bool is_predefined)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <
|
||||
typename ContextT, typename TokenT, typename ParametersT,
|
||||
typename DefinitionT
|
||||
@@ -505,7 +434,6 @@ struct default_preprocessing_hooks
|
||||
bool is_functionlike, ParametersT const& parameters,
|
||||
DefinitionT const& definition, bool is_predefined)
|
||||
{}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -519,19 +447,10 @@ struct default_preprocessing_hooks
|
||||
// removed.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename TokenT>
|
||||
void
|
||||
undefined_macro(TokenT const& macro_name)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename TokenT>
|
||||
void
|
||||
undefined_macro(ContextT const& ctx, TokenT const& macro_name)
|
||||
{}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -551,19 +470,10 @@ struct default_preprocessing_hooks
|
||||
// output by a single newline.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename TokenT>
|
||||
void
|
||||
found_directive(TokenT const& directive)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename TokenT>
|
||||
bool
|
||||
found_directive(ContextT const& ctx, TokenT const& directive)
|
||||
{ return false; } // by default we never skip any directives
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -617,22 +527,12 @@ struct default_preprocessing_hooks
|
||||
// to force the expression to be re-evaluated.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename ContainerT>
|
||||
void
|
||||
evaluated_conditional_expression(ContainerT const& expression,
|
||||
bool expression_value)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename TokenT, typename ContainerT>
|
||||
bool
|
||||
evaluated_conditional_expression(ContextT const& ctx,
|
||||
TokenT const& directive, ContainerT const& expression,
|
||||
bool expression_value)
|
||||
{ return false; } // ok to continue, do not re-evaluate expression
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -646,19 +546,10 @@ struct default_preprocessing_hooks
|
||||
// The parameter 'token' refers to the token to be skipped.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename TokenT>
|
||||
void
|
||||
skipped_token(TokenT const& token)
|
||||
{}
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename TokenT>
|
||||
void
|
||||
skipped_token(ContextT const& ctx, TokenT const& token)
|
||||
{}
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
|
||||
@@ -398,11 +398,7 @@ pp_iterator_functor<ContextT>::returned_from_include()
|
||||
{
|
||||
if (iter_ctx->first == iter_ctx->last && ctx.get_iteration_depth() > 0) {
|
||||
// call the include policy trace function
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().returning_from_include_file();
|
||||
#else
|
||||
ctx.get_hooks().returning_from_include_file(ctx.derived());
|
||||
#endif
|
||||
|
||||
// restore the previous iteration context after finishing the preprocessing
|
||||
// of the included file
|
||||
@@ -900,12 +896,8 @@ namespace impl {
|
||||
bool call_found_directive_hook(ContextT& ctx,
|
||||
typename ContextT::token_type const& found_directive)
|
||||
{
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().found_directive(found_directive);
|
||||
#else
|
||||
if (ctx.get_hooks().found_directive(ctx.derived(), found_directive))
|
||||
return true; // skip this directive and return newline only
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -914,11 +906,7 @@ namespace impl {
|
||||
// void call_skipped_token_hook(ContextT& ctx,
|
||||
// typename ContextT::token_type const& skipped)
|
||||
// {
|
||||
// #if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// ctx.get_hooks().skipped_token(skipped);
|
||||
// #else
|
||||
// ctx.get_hooks().skipped_token(ctx.derived(), skipped);
|
||||
// #endif
|
||||
// }
|
||||
|
||||
template <typename ContextT, typename IteratorT>
|
||||
@@ -1603,12 +1591,8 @@ pp_iterator_functor<ContextT>::on_include_helper(char const* f, char const* s,
|
||||
#endif
|
||||
|
||||
// call the 'found_include_directive' hook function
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().found_include_directive(f, include_next);
|
||||
#else
|
||||
if (ctx.get_hooks().found_include_directive(ctx.derived(), f, include_next))
|
||||
return true; // client returned false: skip file to include
|
||||
#endif
|
||||
|
||||
file_path = util::impl::unescape_lit(file_path);
|
||||
std::string native_path_str;
|
||||
@@ -1637,13 +1621,8 @@ pp_iterator_functor<ContextT>::on_include_helper(char const* f, char const* s,
|
||||
base_iteration_context_type::user_header));
|
||||
|
||||
// call the include policy trace function
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().opened_include_file(dir_path, file_path,
|
||||
ctx.get_iteration_depth(), is_system);
|
||||
#else
|
||||
ctx.get_hooks().opened_include_file(ctx.derived(), dir_path, file_path,
|
||||
is_system);
|
||||
#endif
|
||||
|
||||
// store current file position
|
||||
iter_ctx->real_relative_filename = ctx.get_current_relative_filename().c_str();
|
||||
@@ -1897,15 +1876,10 @@ pp_iterator_functor<ContextT>::on_ifdef(
|
||||
|
||||
directive.insert(directive.end(), *it);
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
is_defined = ctx.is_defined_macro((*it).get_value()); // toexpand.begin(), toexpand.end());
|
||||
ctx.get_hooks().evaluated_conditional_expression(directive, is_defined);
|
||||
#else
|
||||
do {
|
||||
is_defined = ctx.is_defined_macro((*it).get_value()); // toexpand.begin(), toexpand.end());
|
||||
} while (ctx.get_hooks().evaluated_conditional_expression(ctx.derived(),
|
||||
found_directive, directive, is_defined));
|
||||
#endif
|
||||
ctx.enter_if_block(is_defined);
|
||||
}
|
||||
|
||||
@@ -1933,15 +1907,10 @@ pp_iterator_functor<ContextT>::on_ifndef(
|
||||
|
||||
directive.insert(directive.end(), *it);
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
is_defined = ctx.is_defined_macro((*it).get_value()); // toexpand.begin(), toexpand.end());
|
||||
ctx.get_hooks().evaluated_conditional_expression(directive, is_defined);
|
||||
#else
|
||||
do {
|
||||
is_defined = ctx.is_defined_macro((*it).get_value()); // toexpand.begin(), toexpand.end());
|
||||
} while (ctx.get_hooks().evaluated_conditional_expression(ctx.derived(),
|
||||
found_directive, directive, is_defined));
|
||||
#endif
|
||||
ctx.enter_if_block(!is_defined);
|
||||
}
|
||||
|
||||
@@ -2055,14 +2024,9 @@ pp_iterator_functor<ContextT>::on_if(
|
||||
break;
|
||||
}
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().evaluated_conditional_expression(toexpand, if_status);
|
||||
} while (false);
|
||||
#else
|
||||
} while (ctx.get_hooks().evaluated_conditional_expression(ctx.derived(),
|
||||
found_directive, toexpand, if_status)
|
||||
&& status == grammars::error_noerror);
|
||||
#endif
|
||||
|
||||
ctx.enter_if_block(if_status);
|
||||
if (grammars::error_noerror != status) {
|
||||
@@ -2157,14 +2121,9 @@ pp_iterator_functor<ContextT>::on_elif(
|
||||
ctx.get_hooks().throw_exception(ctx.derived(), e);
|
||||
}
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().evaluated_conditional_expression(toexpand, if_status);
|
||||
} while (false);
|
||||
#else
|
||||
} while (ctx.get_hooks().evaluated_conditional_expression(ctx.derived(),
|
||||
found_directive, toexpand, if_status)
|
||||
&& status == grammars::error_noerror);
|
||||
#endif
|
||||
|
||||
if (!ctx.enter_elif_block(if_status)) {
|
||||
// #elif without matching #if
|
||||
|
||||
@@ -180,19 +180,11 @@ protected:
|
||||
boost::optional<position_type> expanding_pos);
|
||||
|
||||
// Collect all arguments supplied to a macro invocation
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
template <typename IteratorT, typename ContainerT, typename SizeT>
|
||||
typename std::vector<ContainerT>::size_type collect_arguments (
|
||||
token_type const curr_token, std::vector<ContainerT> &arguments,
|
||||
IteratorT &next, IteratorT const &end, SizeT const ¶meter_count,
|
||||
bool& seen_newline);
|
||||
#else
|
||||
template <typename IteratorT, typename ContainerT, typename SizeT>
|
||||
typename std::vector<ContainerT>::size_type collect_arguments (
|
||||
token_type const curr_token, std::vector<ContainerT> &arguments,
|
||||
IteratorT &next, IteratorT &endparen, IteratorT const &end,
|
||||
SizeT const ¶meter_count, bool& seen_newline);
|
||||
#endif
|
||||
|
||||
// Expand a single macro name
|
||||
template <typename IteratorT, typename ContainerT>
|
||||
@@ -472,15 +464,9 @@ macromap<ContextT>::add_macro(token_type const &name, bool has_parameters,
|
||||
std::swap((*p.first).second->macrodefinition, definition);
|
||||
|
||||
// call the context supplied preprocessing hook
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().defined_macro(name, has_parameters,
|
||||
(*p.first).second->macroparameters,
|
||||
(*p.first).second->macrodefinition, is_predefined);
|
||||
#else
|
||||
ctx.get_hooks().defined_macro(ctx.derived(), name, has_parameters,
|
||||
(*p.first).second->macroparameters,
|
||||
(*p.first).second->macrodefinition, is_predefined);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -658,11 +644,7 @@ macromap<ContextT>::remove_macro(string_type const &name,
|
||||
// call the context supplied preprocessing hook function
|
||||
token_type tok(T_IDENTIFIER, name, pos);
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().undefined_macro(tok);
|
||||
#else
|
||||
ctx.get_hooks().undefined_macro(ctx.derived(), tok);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else if (impl::is_special_macroname(ctx, name)) {
|
||||
@@ -871,21 +853,12 @@ macromap<ContextT>::expand_tokensequence_worker(
|
||||
// return the number of successfully detected non-empty arguments
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
template <typename ContextT>
|
||||
template <typename IteratorT, typename ContainerT, typename SizeT>
|
||||
inline typename std::vector<ContainerT>::size_type
|
||||
macromap<ContextT>::collect_arguments (token_type const curr_token,
|
||||
std::vector<ContainerT> &arguments, IteratorT &next,
|
||||
IteratorT const &end, SizeT const ¶meter_count, bool& seen_newline)
|
||||
#else
|
||||
template <typename ContextT>
|
||||
template <typename IteratorT, typename ContainerT, typename SizeT>
|
||||
inline typename std::vector<ContainerT>::size_type
|
||||
macromap<ContextT>::collect_arguments (token_type const curr_token,
|
||||
std::vector<ContainerT> &arguments, IteratorT &next, IteratorT &endparen,
|
||||
IteratorT const &end, SizeT const ¶meter_count, bool& seen_newline)
|
||||
#endif
|
||||
{
|
||||
using namespace boost::wave;
|
||||
|
||||
@@ -926,9 +899,7 @@ macromap<ContextT>::collect_arguments (token_type const curr_token,
|
||||
else {
|
||||
// found closing parenthesis
|
||||
// trim_sequence(argument);
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
|
||||
endparen = next;
|
||||
#endif
|
||||
if (parameter_count > 0) {
|
||||
if (argument->empty() ||
|
||||
impl::is_whitespace_only(*argument))
|
||||
@@ -1235,17 +1206,11 @@ macromap<ContextT>::expand_replacement_list(
|
||||
// __VA_OPT__ treats its arguments as an undifferentiated stream of tokens
|
||||
// for our purposes we can consider it as a single argument
|
||||
typename std::vector<ContainerT> va_opt_args(1, ContainerT(arg_start, cit));
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().expanding_function_like_macro(
|
||||
macroname, macroparameters, macrodefinitions,
|
||||
*cstart, va_opt_args);
|
||||
#else
|
||||
suppress_expand = ctx.get_hooks().expanding_function_like_macro(
|
||||
ctx.derived(),
|
||||
macroname, macroparameters, macrodefinition,
|
||||
*cstart, va_opt_args,
|
||||
cstart, cit);
|
||||
#endif
|
||||
|
||||
if (suppress_expand) {
|
||||
// leave the whole expression in place
|
||||
@@ -1267,11 +1232,7 @@ macromap<ContextT>::expand_replacement_list(
|
||||
va_expanded);
|
||||
}
|
||||
// run final hooks
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().expanded_macro(va_expanded);
|
||||
#else
|
||||
ctx.get_hooks().expanded_macro(ctx.derived(), va_expanded);
|
||||
#endif
|
||||
|
||||
// updated overall expansion with va_opt results
|
||||
expanded.splice(expanded.end(), va_expanded);
|
||||
@@ -1512,25 +1473,17 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
|
||||
// called as a function-like macro
|
||||
impl::skip_to_token(ctx, first, last, T_LEFTPAREN, seen_newline);
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
|
||||
IteratorT seqstart = first;
|
||||
IteratorT seqend = first;
|
||||
#endif
|
||||
|
||||
if (macro_def.is_functionlike) {
|
||||
// defined as a function-like macro
|
||||
|
||||
// collect the arguments
|
||||
std::vector<ContainerT> arguments;
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
typename std::vector<ContainerT>::size_type count_args =
|
||||
collect_arguments(curr_token, arguments, first, last,
|
||||
macro_def.macroparameters.size(), seen_newline);
|
||||
#else
|
||||
typename std::vector<ContainerT>::size_type count_args =
|
||||
collect_arguments(curr_token, arguments, first, seqend, last,
|
||||
macro_def.macroparameters.size(), seen_newline);
|
||||
#endif
|
||||
|
||||
std::size_t parm_count_required = macro_def.macroparameters.size();
|
||||
#if BOOST_WAVE_SUPPORT_CPP2A
|
||||
@@ -1580,11 +1533,6 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
|
||||
}
|
||||
|
||||
// inject tracing support
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().expanding_function_like_macro(
|
||||
macro_def.macroname, macro_def.macroparameters,
|
||||
macro_def.macrodefinition, curr_token, arguments);
|
||||
#else
|
||||
if (ctx.get_hooks().expanding_function_like_macro(ctx.derived(),
|
||||
macro_def.macroname, macro_def.macroparameters,
|
||||
macro_def.macrodefinition, curr_token, arguments,
|
||||
@@ -1600,7 +1548,6 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
|
||||
first = ++seqstart;
|
||||
return false; // no further preprocessing required
|
||||
}
|
||||
#endif
|
||||
|
||||
// expand the replacement list of this macro
|
||||
expand_replacement_list(macro_def.macrodefinition.begin(),
|
||||
@@ -1615,10 +1562,6 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
|
||||
}
|
||||
else {
|
||||
// defined as an object-like macro
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().expanding_object_like_macro(
|
||||
macro_def.macroname, macro_def.macrodefinition, curr_token);
|
||||
#else
|
||||
if (ctx.get_hooks().expanding_object_like_macro(ctx.derived(),
|
||||
macro_def.macroname, macro_def.macrodefinition, curr_token))
|
||||
{
|
||||
@@ -1626,7 +1569,6 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
|
||||
expanded.push_back(curr_token);
|
||||
return false; // no further preprocessing required
|
||||
}
|
||||
#endif
|
||||
|
||||
bool found = false;
|
||||
impl::find_concat_operator concat_tag(found);
|
||||
@@ -1657,10 +1599,6 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
|
||||
}
|
||||
else {
|
||||
// defined as an object-like macro (expand it)
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().expanding_object_like_macro(
|
||||
macro_def.macroname, macro_def.macrodefinition, curr_token);
|
||||
#else
|
||||
if (ctx.get_hooks().expanding_object_like_macro(ctx.derived(),
|
||||
macro_def.macroname, macro_def.macrodefinition, curr_token))
|
||||
{
|
||||
@@ -1669,7 +1607,6 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
|
||||
++first; // skip macro name
|
||||
return false; // no further preprocessing required
|
||||
}
|
||||
#endif
|
||||
|
||||
bool found = false;
|
||||
impl::find_concat_operator concat_tag(found);
|
||||
@@ -1690,22 +1627,14 @@ macromap<ContextT>::expand_macro(ContainerT &expanded,
|
||||
// rescan the replacement list
|
||||
ContainerT expanded_list;
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().expanded_macro(replacement_list);
|
||||
#else
|
||||
ctx.get_hooks().expanded_macro(ctx.derived(), replacement_list);
|
||||
#endif
|
||||
|
||||
rescan_replacement_list(
|
||||
curr_token, macro_def, replacement_list,
|
||||
expanded_list, expand_operator_defined,
|
||||
expand_operator_has_include, first, last);
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().rescanned_macro(expanded_list);
|
||||
#else
|
||||
ctx.get_hooks().rescanned_macro(ctx.derived(), expanded_list);
|
||||
#endif
|
||||
|
||||
if (!expanding_pos)
|
||||
// set the expanding position for rescan
|
||||
@@ -1741,10 +1670,6 @@ macromap<ContextT>::expand_predefined_macro(token_type const &curr_token,
|
||||
// construct a fake token for the macro's definition point
|
||||
token_type deftoken(T_IDENTIFIER, value, position_type("<built-in>"));
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().expanding_object_like_macro(
|
||||
deftoken, Container(), curr_token);
|
||||
#else
|
||||
if (ctx.get_hooks().expanding_object_like_macro(ctx.derived(),
|
||||
deftoken, ContainerT(), curr_token))
|
||||
{
|
||||
@@ -1752,7 +1677,6 @@ macromap<ContextT>::expand_predefined_macro(token_type const &curr_token,
|
||||
expanded.push_back(curr_token);
|
||||
return false; // no further preprocessing required
|
||||
}
|
||||
#endif
|
||||
|
||||
token_type replacement;
|
||||
|
||||
@@ -1788,19 +1712,11 @@ macromap<ContextT>::expand_predefined_macro(token_type const &curr_token,
|
||||
ContainerT replacement_list;
|
||||
replacement_list.push_back(replacement);
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().expanded_macro(replacement_list);
|
||||
#else
|
||||
ctx.get_hooks().expanded_macro(ctx.derived(), replacement_list);
|
||||
#endif
|
||||
|
||||
expanded.push_back(replacement);
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().rescanned_macro(expanded);
|
||||
#else
|
||||
ctx.get_hooks().rescanned_macro(ctx.derived(), expanded);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
|
||||
@@ -1941,15 +1857,10 @@ macromap<ContextT>::resolve_operator_pragma(IteratorT &first,
|
||||
}
|
||||
|
||||
std::vector<ContainerT> arguments;
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
typename std::vector<ContainerT>::size_type count_args =
|
||||
collect_arguments (pragma_token, arguments, first, last, 1, seen_newline);
|
||||
#else
|
||||
IteratorT endparen = first;
|
||||
typename std::vector<ContainerT>::size_type count_args =
|
||||
collect_arguments (pragma_token, arguments, first, endparen, last, 1,
|
||||
seen_newline);
|
||||
#endif
|
||||
|
||||
// verify the parameter count
|
||||
if (pragma_token.get_position().get_file().empty())
|
||||
|
||||
@@ -464,11 +464,7 @@ template <typename ContextT>
|
||||
void call_skipped_token_hook(ContextT& ctx,
|
||||
typename ContextT::token_type const& skipped)
|
||||
{
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
ctx.get_hooks().skipped_token(skipped);
|
||||
#else
|
||||
ctx.get_hooks().skipped_token(ctx.derived(), skipped);
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -536,20 +536,11 @@ BOOST_PRAGMA_MESSAGE("C++03 support is deprecated in Boost.Wave 1.74 and will be
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// The preprocessing hook signatures changed after the Boost V1.34.0 release
|
||||
//
|
||||
// To use the preprocessing hook signatures as released with Boost V1.34.0
|
||||
// you need to define the BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS
|
||||
// constant to something not equal zero.
|
||||
// The old hook signatures are no longer available as of Boost 1.76.
|
||||
//
|
||||
// To force using the new interface define this constant to zero.
|
||||
//
|
||||
#if !defined(BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS)
|
||||
#if BOOST_VERSION < 103500 // before Boost V1.35.0
|
||||
#define BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS 1
|
||||
#else
|
||||
#define BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS 0
|
||||
#endif
|
||||
#elif BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
BOOST_PRAGMA_MESSAGE("The old preprocessing hooks were deprecated in Boost 1.35 and will be removed in 1.76. See https://www.boost.org/doc/libs/1_74_0/libs/wave/doc/class_ref_ctxpolicy_depr.html for details")
|
||||
#if defined(BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS) && \
|
||||
BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
#error "The old preprocessing hooks were deprecated in Boost 1.35 and removed in 1.76."
|
||||
#endif
|
||||
|
||||
#endif // !defined(BOOST_WAVE_CONFIG_HPP_F143F90A_A63F_4B27_AC41_9CA4F14F538D_INCLUDED)
|
||||
|
||||
@@ -50,15 +50,9 @@ public:
|
||||
// preprocessing directive.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
template <typename TokenT>
|
||||
void
|
||||
found_directive(TokenT const& directive)
|
||||
#else
|
||||
template <typename ContextT, typename TokenT>
|
||||
bool
|
||||
found_directive(ContextT const& ctx, TokenT const& directive)
|
||||
#endif
|
||||
{
|
||||
// print the commented conditional directives
|
||||
using namespace boost::wave;
|
||||
@@ -82,9 +76,7 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -108,18 +100,11 @@ public:
|
||||
// to force the expression to be re-evaluated.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
template <typename ContainerT>
|
||||
bool
|
||||
evaluated_conditional_expression(
|
||||
ContainerT const& expression, bool expression_value)
|
||||
#else
|
||||
template <typename ContextT, typename TokenT, typename ContainerT>
|
||||
bool
|
||||
evaluated_conditional_expression(ContextT const &ctx,
|
||||
TokenT const& directive, ContainerT const& expression,
|
||||
bool expression_value)
|
||||
#endif
|
||||
{
|
||||
// print the conditional expressions
|
||||
std::cout << boost::wave::util::impl::as_string(expression) << std::endl;
|
||||
@@ -139,15 +124,9 @@ public:
|
||||
// The parameter 'token' refers to the token to be skipped.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
template <typename TokenT>
|
||||
void
|
||||
skipped_token(TokenT const& token)
|
||||
#else
|
||||
template <typename ContextT, typename TokenT>
|
||||
void
|
||||
skipped_token(ContextT const& ctx, TokenT const& token)
|
||||
#endif
|
||||
{
|
||||
// prepend a comment at the beginning of all skipped lines
|
||||
using namespace boost::wave;
|
||||
|
||||
@@ -111,16 +111,10 @@ struct trace_include_files
|
||||
: files(files_), include_depth(0)
|
||||
{}
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
void
|
||||
opened_include_file(string const &relname, string const &filename,
|
||||
std::size_t /*include_depth*/, bool is_system_include)
|
||||
#else
|
||||
template <typename ContextT>
|
||||
void
|
||||
opened_include_file(ContextT const& ctx, std::string const& relname,
|
||||
std::string const& filename, bool is_system_include)
|
||||
#endif
|
||||
{
|
||||
set<string>::iterator it = files.find(filename);
|
||||
if (it == files.end()) {
|
||||
@@ -134,12 +128,8 @@ struct trace_include_files
|
||||
++include_depth;
|
||||
}
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
void returning_from_include_file()
|
||||
#else
|
||||
template <typename ContextT>
|
||||
void returning_from_include_file(ContextT const& ctx)
|
||||
#endif
|
||||
{
|
||||
--include_depth;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,6 @@
|
||||
|
||||
// include Wave
|
||||
|
||||
// always use new hooks
|
||||
#define BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS 0
|
||||
|
||||
#include <boost/wave.hpp>
|
||||
|
||||
// include the lexer related stuff
|
||||
|
||||
@@ -1069,7 +1069,6 @@ do_actual_work (std::string file_name, std::istream &instream,
|
||||
}
|
||||
}
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
|
||||
// suppress expansion of specified macros
|
||||
if (vm.count("noexpand")) {
|
||||
vector<std::string> const &noexpandmacros =
|
||||
@@ -1081,7 +1080,6 @@ do_actual_work (std::string file_name, std::istream &instream,
|
||||
ctx.get_hooks().add_noexpandmacro(*cit);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// maximal include nesting depth
|
||||
if (vm.count("nesting")) {
|
||||
@@ -1355,10 +1353,8 @@ main (int argc, char *argv[])
|
||||
"specify a macro to predefine (as macro[=[value]])")
|
||||
("undefine,U", po::value<std::vector<std::string> >()->composing(),
|
||||
"specify a macro to undefine")
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
|
||||
("noexpand,N", po::value<std::vector<std::string> >()->composing(),
|
||||
"specify a macro name, which should not be expanded")
|
||||
#endif
|
||||
("nesting,n", po::value<int>(),
|
||||
"specify a new maximal include nesting depth")
|
||||
("warning,W", po::value<std::vector<std::string> >()->composing(),
|
||||
|
||||
@@ -229,20 +229,6 @@ public:
|
||||
// without any further processing.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename ContainerT>
|
||||
void expanding_function_like_macro(
|
||||
TokenT const ¯odef, std::vector<TokenT> const &formal_args,
|
||||
ContainerT const &definition,
|
||||
TokenT const ¯ocall, std::vector<ContainerT> const &arguments)
|
||||
{
|
||||
if (enabled_macro_counting())
|
||||
count_invocation(macrodef.get_value().c_str());
|
||||
|
||||
if (!enabled_macro_tracing())
|
||||
return;
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename ContainerT, typename IteratorT>
|
||||
bool
|
||||
@@ -264,7 +250,6 @@ public:
|
||||
|
||||
if (!enabled_macro_tracing())
|
||||
return false;
|
||||
#endif
|
||||
if (0 == get_level()) {
|
||||
// output header line
|
||||
BOOST_WAVE_OSSTREAM stream;
|
||||
@@ -337,9 +322,7 @@ public:
|
||||
}
|
||||
open_trace_body();
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -359,18 +342,6 @@ public:
|
||||
// The parameter 'macrocall' marks the position, where this macro invoked.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename ContainerT>
|
||||
void expanding_object_like_macro(TokenT const ¯odef,
|
||||
ContainerT const &definition, TokenT const ¯ocall)
|
||||
{
|
||||
if (enabled_macro_counting())
|
||||
count_invocation(macrodef.get_value().c_str());
|
||||
|
||||
if (!enabled_macro_tracing())
|
||||
return;
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename ContainerT>
|
||||
bool
|
||||
@@ -390,7 +361,6 @@ public:
|
||||
|
||||
if (!enabled_macro_tracing())
|
||||
return false;
|
||||
#endif
|
||||
if (0 == get_level()) {
|
||||
// output header line
|
||||
BOOST_WAVE_OSSTREAM stream;
|
||||
@@ -413,9 +383,7 @@ public:
|
||||
}
|
||||
open_trace_body();
|
||||
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS == 0
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
@@ -430,15 +398,9 @@ public:
|
||||
// result of the macro expansion.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename ContainerT>
|
||||
void expanded_macro(ContainerT const &result)
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename ContainerT>
|
||||
void expanded_macro(ContextT const& ctx,ContainerT const &result)
|
||||
#endif
|
||||
{
|
||||
if (!enabled_macro_tracing()) return;
|
||||
|
||||
@@ -461,15 +423,9 @@ public:
|
||||
// result of the rescanning.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
template <typename ContainerT>
|
||||
void rescanned_macro(ContainerT const &result)
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT, typename ContainerT>
|
||||
void rescanned_macro(ContextT const& ctx,ContainerT const &result)
|
||||
#endif
|
||||
{
|
||||
if (!enabled_macro_tracing() || get_level() == 0)
|
||||
return;
|
||||
@@ -662,13 +618,6 @@ public:
|
||||
// found as a result of a #include <...> directive.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
|
||||
// old signature
|
||||
void
|
||||
opened_include_file(std::string const &relname, std::string const &absname,
|
||||
std::size_t include_depth, bool is_system_include)
|
||||
{
|
||||
#else
|
||||
// new signature
|
||||
template <typename ContextT>
|
||||
void
|
||||
@@ -676,7 +625,6 @@ public:
|
||||
std::string const &absname, bool is_system_include)
|
||||
{
|
||||
std::size_t include_depth = ctx.get_iteration_depth();
|
||||
#endif
|
||||
if (enabled_include_tracing()) {
|
||||
// print indented filename
|
||||
for (std::size_t i = 0; i < include_depth; ++i)
|
||||
|
||||
Reference in New Issue
Block a user