mirror of
https://github.com/boostorg/wave.git
synced 2026-01-19 04:42:16 +00:00
Wave: updated copyrights, added C++0x mode to docs, added predefined macros for C++0x mode
[SVN r67894]
This commit is contained in:
@@ -29,6 +29,8 @@ Boost V1.46.0
|
||||
the default from now on).
|
||||
- Added support for extended character and string literals, added test case
|
||||
(which required to add C++0x support to the test application).
|
||||
- Added proper predefined macros fro --c++0x mode. __cplusplus is currently
|
||||
defined to 201101L, but this will change when the Standard is finalized.
|
||||
- Fixed a problem with object like macros, which when being adjacent to a
|
||||
parenthesis, caused the parenthesis to disappear when the macro expansion
|
||||
was suppressed by the expanding_object_like_macro() hook function.
|
||||
|
||||
@@ -83,7 +83,7 @@ a policy based std::basic_string<> compatible string implementation.</p>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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)
|
||||
|
||||
@@ -332,7 +332,7 @@ Time Configuration</a> section. By default the new interface is used starting Bo
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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:
|
||||
|
||||
@@ -468,8 +468,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010
|
||||
Hartmut Kaiser<br>
|
||||
<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
|
||||
|
||||
@@ -422,7 +422,7 @@
|
||||
</tbody>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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:
|
||||
|
||||
@@ -121,7 +121,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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:
|
||||
|
||||
@@ -165,7 +165,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -84,7 +84,11 @@
|
||||
variadics and placemarkers. Note, to support C99 mode, this constant must
|
||||
be defined too.</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td class="table_cells"><code>BOOST_WAVE_SUPPORT_CPP0X</code></td>
|
||||
<td class="table_cells"><p>If defined, then the preprocessor library supports
|
||||
C++0x keywords and C++0x specific features, such as variadics, placemarkers, extended character and string literals. This implies the definitions of the <code>BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS</code> constant.</p></td>
|
||||
</tr> <tr>
|
||||
<td class="table_cells"><code>BOOST_WAVE_MAX_INCLUDE_LEVEL_DEPTH</code></td>
|
||||
<td class="table_cells"><p>If defined, it will determine the initial maximal
|
||||
possible include file nesting depth supported. It defaults to 1024.</p></td>
|
||||
@@ -239,12 +243,12 @@ even if these do not have the <span class="literal">'ll'</span> suffix.</p>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
<p class="copyright"><span class="updated">Last updated:
|
||||
<!-- #BeginDate format:fcAm1m -->Tuesday, July 29, 2008 20:38<!-- #EndDate -->
|
||||
<!-- #BeginDate format:fcAm1m -->Sunday, January 9, 2011 16:16<!-- #EndDate -->
|
||||
</span></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -82,7 +82,7 @@ preprocessing, but allows to use Wave for all of the IDL derivatives. </P>
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -121,19 +121,19 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_cells"><code>__STDC_VERSION__</code></td>
|
||||
<td class="table_cells"><p>199901L (a decimal constant), this is defined in C99 mode only</p></td>
|
||||
<td class="table_cells"><p>199901L (a decimal constant), this is defined in C99 and C++0x modes only</p></td>
|
||||
<td class="table_cells"><p>yes</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_cells"><code>__STDC_HOSTED__</code></td>
|
||||
<td class="table_cells"><p>0L (a decimal constant), this is defined in C99 mode only</p></td>
|
||||
<td class="table_cells"><p>0L (a decimal constant), this is defined in C99 and C++0x modes only</p></td>
|
||||
<td class="table_cells"><p>yes</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table_cells"><code>__WAVE_HAS_VARIADICS__</code></td>
|
||||
<td class="table_cells"><p>1 (a decimal constant), this is defined in C++
|
||||
mode only if variadics and placemarkers are enabled, and it is defined
|
||||
in the C99 mode</p></td>
|
||||
in the C99 and C++0x modes</p></td>
|
||||
<td class="table_cells"><p>no</p></td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -167,12 +167,12 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
<p class="copyright"><span class="updated">Last updated:
|
||||
<!-- #BeginDate format:fcAm1m -->Monday, March 13, 2006 13:47<!-- #EndDate -->
|
||||
<!-- #BeginDate format:fcAm1m -->Sunday, January 9, 2011 16:12<!-- #EndDate -->
|
||||
</span></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -166,7 +166,7 @@ not even compilable with EDG based preprocessors (i.e. Comeau or Intel). </p>
|
||||
</table>
|
||||
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<p class="copyright">Copyright © 2003-2011 Hartmut Kaiser<br>
|
||||
|
||||
<br>
|
||||
|
||||
@@ -176,7 +176,7 @@ http://www.boost.org/LICENSE_1_0.txt) </font> </p>
|
||||
|
||||
<span class="updated"></span>
|
||||
<p class="copyright"><span class="updated">Last updated:
|
||||
<!-- #BeginDate format:fcAm1m -->Sunday, December 2, 2007 19:03<!-- #EndDate -->
|
||||
<!-- #BeginDate format:fcAm1m -->Sunday, January 9, 2011 16:17<!-- #EndDate -->
|
||||
</span></p>
|
||||
|
||||
</body>
|
||||
|
||||
@@ -110,7 +110,7 @@ Note though, that this filename is used
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -103,7 +103,7 @@ preprocessed tokens generated from a given input file. It is described in more d
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -129,7 +129,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -965,7 +965,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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:
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
--long_long: enable long long support if C++ mode
|
||||
--variadics: enable variadics and placemarkers in C++ mode
|
||||
--c99: enable C99 mode (implies variadics and placemarkers)
|
||||
--c++0x enable C++0x mode (implies --variadics and --long_long)
|
||||
-l [ --listincludes ] arg: list included file to a file [arg] or to stdout [-]
|
||||
-m [ --macronames ] arg: list names of all defined macros to a file [arg] or
|
||||
to stdout [-]
|
||||
@@ -63,8 +64,9 @@
|
||||
stdout [-]
|
||||
-p [ --preserve ] arg (=0): preserve whitespace
|
||||
0: no whitespace is preserved (default),
|
||||
1: comments are preserved,
|
||||
2: all whitespace is preserved
|
||||
1: begin of line whitespace is preserved,
|
||||
2: comments and begin of line whitespace is preserved,
|
||||
3: all whitespace is preserved
|
||||
-L [ --line ] arg (=1): control the generation of #line directives
|
||||
0: no #line directives are generated
|
||||
1: #line directives will be emitted (default)
|
||||
@@ -182,7 +184,7 @@
|
||||
</blockquote>
|
||||
<p dir="ltr">--c99</p>
|
||||
<blockquote>
|
||||
<p dir="ltr">Enable the C99 mode. This mode enables certain C99 specific features
|
||||
<p dir="ltr">Enable the C99 mode. This mode enables certain C99 specific features, such
|
||||
as variadics (macros with variable parameter lists), placemarkers (empty macro
|
||||
arguments) and <tt>operator _Pragma</tt> support and disables some C++
|
||||
specific token types as for instance <tt>'::'</tt>, <tt>'->*'</tt> and <tt>'->.'</tt>.
|
||||
@@ -190,6 +192,14 @@
|
||||
about predefined macros you may look <a href="predefined_macros.html">here</a>.
|
||||
</p>
|
||||
</blockquote>
|
||||
<p dir="ltr">--c++0x</p>
|
||||
<blockquote>
|
||||
<p dir="ltr">Enable the C++0x mode. This mode enables C++0x specific keywords and features, such
|
||||
as variadics (macros with variable parameter lists), placemarkers (empty macro
|
||||
arguments) and <tt>operator _Pragma</tt> support.
|
||||
Several predefined macros are different for this mode, for more information
|
||||
about predefined macros you may look <a href="predefined_macros.html">here</a>. </p>
|
||||
</blockquote>
|
||||
<p dir="ltr">-l [--listincludes] path</p>
|
||||
<blockquote>
|
||||
<p dir="ltr">Enable the output of the names of all opened include files. The path specifies the filename to use for the output of the generated include log. If the filename given equals to <tt>'-'</tt> (without the quotes), the include log is put into the standard output stream (stdout).</p>
|
||||
@@ -204,7 +214,7 @@
|
||||
</blockquote>
|
||||
<p dir="ltr">-p [--preserve] arg </p>
|
||||
<blockquote>
|
||||
<p dir="ltr">Preserve the whitespace from the input stream not located inside of macro definitions. The argument defines the amount of whitespace to be preserved. A value of '0' (zero) skips all whitespace, a value of '1' preserves all the comments and a value of '2' will preserve all whitespace in the output.</p>
|
||||
<p dir="ltr">Preserve the whitespace from the input stream not located inside of macro definitions. The argument defines the amount of whitespace to be preserved. A value of '0' (zero) skips all whitespace, a value of '1' preserves begin of line whitespace only, a value of '2' preserves all the comments andd all begin of line whitespace, and a value of '3' will preserve all whitespace in the output.</p>
|
||||
<p dir="ltr">The comments located inside macro definitions are skipped even if this option is specified with an argument not '0' (zero) . If this option is not specified on the command line only essential whitespace is preserved (equivalent to '0' as the argument value). </p>
|
||||
</blockquote>
|
||||
<p dir="ltr">-L [--line]</p>
|
||||
@@ -283,12 +293,12 @@ is now disabled by default because it may cause a potential security threat. The
|
||||
</tr>
|
||||
</table>
|
||||
<hr size="1">
|
||||
<p class="copyright">Copyright © 2003-2010 Hartmut Kaiser<br>
|
||||
<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>
|
||||
<span class="updated"></span>
|
||||
<p class="copyright"><span class="updated">Last updated:
|
||||
<!-- #BeginDate format:fcAm1m -->Thursday, September 17, 2009 12:40<!-- #EndDate -->
|
||||
<!-- #BeginDate format:fcAm1m -->Sunday, January 9, 2011 16:12<!-- #EndDate -->
|
||||
</span></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1844,20 +1844,33 @@ position_type pos("<built-in>");
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// define C++ specifics
|
||||
for (int i = 0; 0 != predef.static_data_cpp(i).name; ++i) {
|
||||
predefined_macros::static_macros const& m = predef.static_data_cpp(i);
|
||||
predefine_macro(current_scope, m.name,
|
||||
token_type(m.token_id, m.value, pos));
|
||||
#if BOOST_WAVE_SUPPORT_CPP0X != 0
|
||||
if (boost::wave::need_cpp0x(ctx.get_language())) {
|
||||
// define C++0x specifics
|
||||
for (int i = 0; 0 != predef.static_data_cpp0x(i).name; ++i) {
|
||||
predefined_macros::static_macros const& m = predef.static_data_cpp0x(i);
|
||||
predefine_macro(current_scope, m.name,
|
||||
token_type(m.token_id, m.value, pos));
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
// define C++ specifics
|
||||
for (int i = 0; 0 != predef.static_data_cpp(i).name; ++i) {
|
||||
predefined_macros::static_macros const& m = predef.static_data_cpp(i);
|
||||
predefine_macro(current_scope, m.name,
|
||||
token_type(m.token_id, m.value, pos));
|
||||
}
|
||||
|
||||
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
||||
// define __WAVE_HAS_VARIADICS__, if appropriate
|
||||
if (boost::wave::need_variadics(ctx.get_language())) {
|
||||
predefine_macro(current_scope, "__WAVE_HAS_VARIADICS__",
|
||||
token_type(T_INTLIT, "1", pos));
|
||||
}
|
||||
// define __WAVE_HAS_VARIADICS__, if appropriate
|
||||
if (boost::wave::need_variadics(ctx.get_language())) {
|
||||
predefine_macro(current_scope, "__WAVE_HAS_VARIADICS__",
|
||||
token_type(T_INTLIT, "1", pos));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
// predefine the __BASE_FILE__ macro which contains the main file name
|
||||
|
||||
@@ -75,9 +75,9 @@ namespace util {
|
||||
"Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
|
||||
};
|
||||
|
||||
|
||||
// for some systems sprintf, time_t etc. is in namespace std
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
|
||||
time_t tt = time(0);
|
||||
struct tm *tb = 0;
|
||||
@@ -98,7 +98,7 @@ namespace util {
|
||||
void reset_timestr()
|
||||
{
|
||||
// for some systems sprintf, time_t etc. is in namespace std
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
|
||||
time_t tt = time(0);
|
||||
struct tm *tb = 0;
|
||||
@@ -119,9 +119,9 @@ namespace util {
|
||||
void reset_version()
|
||||
{
|
||||
char buffer[sizeof("0x00000000")+1];
|
||||
|
||||
|
||||
// for some systems sprintf, time_t etc. is in namespace std
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
|
||||
// calculate the number of days since Dec 13 2001
|
||||
// (the day the Wave project was started)
|
||||
@@ -140,13 +140,13 @@ namespace util {
|
||||
seconds/(3600*24));
|
||||
version_ = buffer;
|
||||
}
|
||||
|
||||
|
||||
void reset_versionstr()
|
||||
{
|
||||
char buffer[sizeof("\"00.00.00.0000 \"")+sizeof(BOOST_PLATFORM)+sizeof(BOOST_COMPILER)+4];
|
||||
|
||||
// for some systems sprintf, time_t etc. is in namespace std
|
||||
using namespace std;
|
||||
using namespace std;
|
||||
|
||||
// calculate the number of days since Dec 13 2001
|
||||
// (the day the Wave project was started)
|
||||
@@ -164,11 +164,11 @@ namespace util {
|
||||
seconds/(3600*24), BOOST_PLATFORM, BOOST_COMPILER);
|
||||
versionstr_ = buffer;
|
||||
}
|
||||
|
||||
|
||||
// dynamic predefined macros
|
||||
string_type get_date() const { return datestr_; } // __DATE__
|
||||
string_type get_time() const { return timestr_; } // __TIME__
|
||||
|
||||
|
||||
// __SPIRIT_PP__/__WAVE__
|
||||
string_type get_version() const
|
||||
{
|
||||
@@ -179,7 +179,7 @@ namespace util {
|
||||
BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
// __WAVE_CONFIG__
|
||||
string_type get_config() const
|
||||
{
|
||||
@@ -189,7 +189,7 @@ namespace util {
|
||||
sprintf(buffer, "0x%08x", BOOST_WAVE_CONFIG);
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
predefined_macros()
|
||||
: compilation_time_(__DATE__ " " __TIME__)
|
||||
@@ -198,19 +198,19 @@ namespace util {
|
||||
reset_version();
|
||||
reset_versionstr();
|
||||
}
|
||||
|
||||
|
||||
void reset()
|
||||
{
|
||||
reset_datestr();
|
||||
reset_timestr();
|
||||
}
|
||||
|
||||
|
||||
// __SPIRIT_PP_VERSION__/__WAVE_VERSION__
|
||||
string_type get_fullversion() const { return version_; }
|
||||
|
||||
|
||||
// __SPIRIT_PP_VERSION_STR__/__WAVE_VERSION_STR__
|
||||
string_type get_versionstr() const { return versionstr_; }
|
||||
|
||||
|
||||
// C++ mode
|
||||
static_macros const& static_data_cpp(std::size_t i) const
|
||||
{
|
||||
@@ -222,7 +222,24 @@ namespace util {
|
||||
BOOST_ASSERT(i < sizeof(data)/sizeof(data[0]));
|
||||
return data[i];
|
||||
}
|
||||
|
||||
|
||||
#if BOOST_WAVE_SUPPORT_CPP0X != 0
|
||||
// C++0x mode
|
||||
static_macros const& static_data_cpp0x(std::size_t i) const
|
||||
{
|
||||
static static_macros data[] = {
|
||||
{ "__STDC__", T_INTLIT, "1" },
|
||||
{ "__cplusplus", T_INTLIT, "201101L" },
|
||||
{ "__STDC_VERSION__", T_INTLIT, "199901L" },
|
||||
{ "__STDC_HOSTED__", T_INTLIT, "0" },
|
||||
{ "__WAVE_HAS_VARIADICS__", T_INTLIT, "1" },
|
||||
{ 0, T_EOF, 0 }
|
||||
};
|
||||
BOOST_ASSERT(i < sizeof(data)/sizeof(data[0]));
|
||||
return data[i];
|
||||
}
|
||||
#endif
|
||||
|
||||
#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
|
||||
// C99 mode
|
||||
static_macros const& static_data_c99(std::size_t i) const
|
||||
@@ -256,7 +273,6 @@ namespace util {
|
||||
BOOST_ASSERT(i < sizeof(data)/sizeof(data[0]));
|
||||
return data[i];
|
||||
}
|
||||
|
||||
}; // predefined_macros
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace fs = boost::filesystem;
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// testwave version definitions
|
||||
#define TESTWAVE_VERSION_MAJOR 0
|
||||
#define TESTWAVE_VERSION_MINOR 5
|
||||
#define TESTWAVE_VERSION_MINOR 6
|
||||
#define TESTWAVE_VERSION_SUBMINOR 0
|
||||
|
||||
namespace {
|
||||
|
||||
33
tool/cpp.cpp
33
tool/cpp.cpp
@@ -3,7 +3,7 @@
|
||||
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser. 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)
|
||||
=============================================================================*/
|
||||
@@ -138,7 +138,7 @@ int print_copyright()
|
||||
"Wave: A Standard conformant C++ preprocessor based on the Boost.Wave library",
|
||||
"http://www.boost.org/",
|
||||
"",
|
||||
"Copyright (c) 2001-2010 Hartmut Kaiser, Distributed under the Boost",
|
||||
"Copyright (c) 2001-2011 Hartmut Kaiser, 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)",
|
||||
0
|
||||
@@ -752,22 +752,31 @@ int error_count = 0;
|
||||
// enable preserving comments mode
|
||||
bool preserve_comments = false;
|
||||
bool preserve_whitespace = false;
|
||||
bool preserve_bol_whitespace = false;
|
||||
|
||||
if (vm.count("preserve")) {
|
||||
int preserve = vm["preserve"].as<int>();
|
||||
|
||||
switch(preserve) {
|
||||
case 0: break;
|
||||
case 2:
|
||||
case 0: break; // preserve no whitespace
|
||||
case 3: // preserve all whitespace
|
||||
preserve_whitespace = true;
|
||||
/* fall through */
|
||||
case 1:
|
||||
preserve_comments = true;
|
||||
preserve_bol_whitespace = true;
|
||||
break;
|
||||
|
||||
case 2: // preserve comments and BOL whitespace only
|
||||
preserve_comments = true;
|
||||
preserve_bol_whitespace = true;
|
||||
break;
|
||||
|
||||
case 1: // preserve BOL whitespace only
|
||||
preserve_bol_whitespace = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
cerr << "wave: bogus preserve whitespace option value: "
|
||||
<< preserve << ", should be 0, 1, or 2" << endl;
|
||||
<< preserve << ", should be 0, 1, 2, or 3" << endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@@ -785,8 +794,9 @@ int error_count = 0;
|
||||
bool allow_output = true; // will be manipulated from inside the hooks object
|
||||
std::string default_outfile; // will be used from inside the hooks object
|
||||
trace_macro_expansion<token_type> hooks(preserve_whitespace,
|
||||
output, traceout, includelistout, listguardsout, enable_trace,
|
||||
enable_system_command, allow_output, default_outfile);
|
||||
preserve_bol_whitespace, output, traceout, includelistout,
|
||||
listguardsout, enable_trace, enable_system_command, allow_output,
|
||||
default_outfile);
|
||||
|
||||
// enable macro invocation count, if appropriate
|
||||
if (vm.count("macrocounts"))
|
||||
@@ -1254,8 +1264,9 @@ main (int argc, char *argv[])
|
||||
("preserve,p", po::value<int>()->default_value(0),
|
||||
"preserve whitespace\n"
|
||||
"0: no whitespace is preserved (default),\n"
|
||||
"1: comments are preserved,\n"
|
||||
"2: all whitespace is preserved")
|
||||
"1: begin of line whitespace is preserved,\n"
|
||||
"2: comments and begin of line whitespace is preserved,\n"
|
||||
"3: all whitespace is preserved")
|
||||
("line,L", po::value<int>()->default_value(1),
|
||||
"control the generation of #line directives\n"
|
||||
"0: no #line directives are generated,\n"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser. 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)
|
||||
=============================================================================*/
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser. 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)
|
||||
=============================================================================*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser. 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)
|
||||
=============================================================================*/
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
#define CPP_VERSION_FULL_STR BOOST_PP_STRINGIZE(CPP_VERSION_FULL)
|
||||
|
||||
#define CPP_VERSION_DATE 20100324L
|
||||
#define CPP_VERSION_DATE_STR "20100324"
|
||||
#define CPP_VERSION_DATE 20110109L
|
||||
#define CPP_VERSION_DATE_STR "20110109"
|
||||
|
||||
#endif // !defined(CPP_VERSION_HPP_CE4FE67F_63F9_468D_8364_C855F89D3C5D_INCLUDED)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser. 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)
|
||||
=============================================================================*/
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Boost.Wave: A Standard compliant C++ preprocessor library
|
||||
http://www.boost.org/
|
||||
|
||||
Copyright (c) 2001-2010 Hartmut Kaiser. Distributed under the Boost
|
||||
Copyright (c) 2001-2011 Hartmut Kaiser. 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)
|
||||
=============================================================================*/
|
||||
@@ -145,7 +145,8 @@ class trace_macro_expansion
|
||||
typedef boost::wave::context_policies::eat_whitespace<TokenT> base_type;
|
||||
|
||||
public:
|
||||
trace_macro_expansion(bool preserve_whitespace_,
|
||||
trace_macro_expansion(
|
||||
bool preserve_whitespace_, bool preserve_bol_whitespace_,
|
||||
std::ofstream &output_, std::ostream &tracestrm_,
|
||||
std::ostream &includestrm_, std::ostream &guardstrm_,
|
||||
trace_flags flags_, bool enable_system_command_,
|
||||
@@ -155,6 +156,7 @@ public:
|
||||
level(0), flags(flags_), logging_flags(trace_nothing),
|
||||
enable_system_command(enable_system_command_),
|
||||
preserve_whitespace(preserve_whitespace_),
|
||||
preserve_bol_whitespace(preserve_bol_whitespace_),
|
||||
generate_output(generate_output_),
|
||||
default_outfile(default_outfile_),
|
||||
emit_relative_filenames(false)
|
||||
@@ -741,7 +743,9 @@ public:
|
||||
bool may_skip_whitespace(ContextT const &ctx, TokenT &token,
|
||||
bool &skipped_newline)
|
||||
{
|
||||
return this->base_type::may_skip_whitespace(ctx, token, skipped_newline) ?
|
||||
return this->base_type::may_skip_whitespace(
|
||||
ctx, token, need_preserve_comments(ctx.get_language()),
|
||||
preserve_bol_whitespace, skipped_newline) ?
|
||||
!preserve_whitespace : false;
|
||||
}
|
||||
|
||||
@@ -781,7 +785,7 @@ protected:
|
||||
using namespace boost::wave;
|
||||
if (e.get_errorcode() != preprocess_exception::ill_formed_directive)
|
||||
return false;
|
||||
|
||||
|
||||
// the error string is formatted as 'severity: error: directive'
|
||||
std::string error(e.description());
|
||||
std::string::size_type p = error.find_last_of(":");
|
||||
@@ -841,24 +845,44 @@ protected:
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// interpret the pragma wave option(preserve: [0|1|2|push|pop]) directive
|
||||
// interpret the pragma wave option(preserve: [0|1|2|3|push|pop]) directive
|
||||
template <typename ContextT>
|
||||
static bool
|
||||
interpret_pragma_option_preserve_set(int mode, bool &preserve_whitespace,
|
||||
ContextT &ctx)
|
||||
bool& preserve_bol_whitespace, ContextT &ctx)
|
||||
{
|
||||
switch(mode) {
|
||||
case 0:
|
||||
// preserve no whitespace
|
||||
case 0:
|
||||
preserve_whitespace = false;
|
||||
preserve_bol_whitespace = false;
|
||||
ctx.set_language(
|
||||
enable_preserve_comments(ctx.get_language(), false),
|
||||
false);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
preserve_whitespace = true;
|
||||
/* fall through */
|
||||
// preserve BOL whitespace only
|
||||
case 1:
|
||||
preserve_whitespace = false;
|
||||
preserve_bol_whitespace = true;
|
||||
ctx.set_language(
|
||||
enable_preserve_comments(ctx.get_language(), false),
|
||||
false);
|
||||
break;
|
||||
|
||||
// preserve comments and BOL whitespace only
|
||||
case 2:
|
||||
preserve_whitespace = false;
|
||||
preserve_bol_whitespace = true;
|
||||
ctx.set_language(
|
||||
enable_preserve_comments(ctx.get_language()),
|
||||
false);
|
||||
break;
|
||||
|
||||
// preserve all whitespace
|
||||
case 3:
|
||||
preserve_whitespace = true;
|
||||
preserve_bol_whitespace = true;
|
||||
ctx.set_language(
|
||||
enable_preserve_comments(ctx.get_language()),
|
||||
false);
|
||||
@@ -885,15 +909,18 @@ protected:
|
||||
if (T_IDENTIFIER == id) {
|
||||
if ((*it).get_value() == "push") {
|
||||
// push current preserve option onto the internal option stack
|
||||
if (preserve_whitespace) {
|
||||
if (need_preserve_comments(ctx.get_language()))
|
||||
preserve_options.push(2);
|
||||
if (need_preserve_comments(ctx.get_language())) {
|
||||
if (preserve_whitespace)
|
||||
preserve_options.push(3);
|
||||
else
|
||||
preserve_options.push(1);
|
||||
preserve_options.push(2);
|
||||
}
|
||||
else if (preserve_bol_whitespace) {
|
||||
preserve_options.push(1);
|
||||
}
|
||||
else {
|
||||
preserve_options.push(0);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else if ((*it).get_value() == "pop") {
|
||||
@@ -903,10 +930,11 @@ protected:
|
||||
pragma_mismatched_push_pop, "preserve",
|
||||
act_token.get_position());
|
||||
}
|
||||
|
||||
|
||||
// pop output preserve from the internal option stack
|
||||
bool result = interpret_pragma_option_preserve_set(
|
||||
preserve_options.top(), preserve_whitespace, ctx);
|
||||
preserve_options.top(), preserve_whitespace,
|
||||
preserve_bol_whitespace, ctx);
|
||||
preserve_options.pop();
|
||||
return result;
|
||||
}
|
||||
@@ -918,10 +946,11 @@ protected:
|
||||
|
||||
using namespace std; // some platforms have atoi in namespace std
|
||||
return interpret_pragma_option_preserve_set(
|
||||
atoi((*it).get_value().c_str()), preserve_whitespace, ctx);
|
||||
atoi((*it).get_value().c_str()), preserve_whitespace,
|
||||
preserve_bol_whitespace, ctx);
|
||||
}
|
||||
|
||||
// interpret the pragma wave option(line: [0|1|push|pop]) directive
|
||||
// interpret the pragma wave option(line: [0|1|2|push|pop]) directive
|
||||
template <typename ContextT, typename IteratorT>
|
||||
bool
|
||||
interpret_pragma_option_line(ContextT &ctx, IteratorT &it,
|
||||
@@ -970,7 +999,7 @@ protected:
|
||||
|
||||
using namespace std; // some platforms have atoi in namespace std
|
||||
int emit_lines = atoi((*it).get_value().c_str());
|
||||
if (0 == emit_lines || 1 == emit_lines) {
|
||||
if (0 == emit_lines || 1 == emit_lines || 2 == emit_lines) {
|
||||
// set the new emit #line directive mode
|
||||
ctx.set_language(
|
||||
enable_emit_line_directives(ctx.get_language(), emit_lines),
|
||||
@@ -1133,12 +1162,12 @@ protected:
|
||||
|
||||
token_type const &value = *it;
|
||||
if (value.get_value() == "preserve") {
|
||||
// #pragma wave option(preserve: [0|1|2|push|pop])
|
||||
// #pragma wave option(preserve: [0|1|2|3|push|pop])
|
||||
valid_option = interpret_pragma_option_preserve(ctx, it, end,
|
||||
act_token);
|
||||
}
|
||||
else if (value.get_value() == "line") {
|
||||
// #pragma wave option(line: [0|1|push|pop])
|
||||
// #pragma wave option(line: [0|1|2|push|pop])
|
||||
valid_option = interpret_pragma_option_line(ctx, it, end,
|
||||
act_token);
|
||||
}
|
||||
@@ -1336,6 +1365,7 @@ private:
|
||||
trace_flags logging_flags; // enabled by a #pragma
|
||||
bool enable_system_command; // enable #pragma wave system() command
|
||||
bool preserve_whitespace; // enable whitespace preservation
|
||||
bool preserve_bol_whitespace; // enable begin of line whitespace preservation
|
||||
bool& generate_output; // allow generated tokens to be streamed to output
|
||||
std::string const& default_outfile; // name of the output file given on command line
|
||||
boost::filesystem::path current_outfile; // name of the current output file
|
||||
|
||||
Reference in New Issue
Block a user