From 840ae02999aec3010c5faeeeeef14e6b839d6621 Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Mon, 17 Jan 2005 18:28:54 +0000 Subject: [PATCH] Preparation of the Boost review... [SVN r2445] --- ChangeLog | 20 +- build/Jamfile | 2 +- build/Jamfile.v2 | 2 +- doc/acknowledgements.html | 4 +- doc/class_reference_context.html | 4 +- doc/class_reference_contextpolicy.html | 4 +- doc/class_reference_fileposition.html | 4 +- doc/class_reference_inputpolicy.html | 4 +- doc/class_reference_lexer.html | 4 +- doc/class_reference_tokentype.html | 4 +- doc/compiletime_config.html | 4 +- doc/introduction.html | 4 +- doc/macro_expansion_process.html | 4 +- doc/predefined_macros.html | 4 +- doc/preface.html | 4 +- doc/quickstart.html | 4 +- doc/references.html | 4 +- doc/samples.html | 4 +- doc/supported_pragmas.html | 4 +- doc/token_ids.html | 4 +- doc/tracing_facility.html | 3 +- doc/wave_driver.html | 4 +- include/boost/wave.hpp | 2 +- include/boost/wave/cpp_context.hpp | 5 +- include/boost/wave/cpp_exceptions.hpp | 2 +- include/boost/wave/cpp_iteration_context.hpp | 2 +- .../boost/wave/cpplexer/cpp_lex_interface.hpp | 2 +- .../boost/wave/cpplexer/cpp_lex_iterator.hpp | 2 +- include/boost/wave/cpplexer/cpp_lex_token.hpp | 2 +- .../wave/cpplexer/cpplexer_exceptions.hpp | 2 +- include/boost/wave/cpplexer/re2clex/aq.hpp | 2 +- .../boost/wave/cpplexer/re2clex/cpp.re.hpp | 2 +- .../wave/cpplexer/re2clex/cpp_re2c_lexer.hpp | 2 +- .../boost/wave/cpplexer/re2clex/scanner.hpp | 2 +- include/boost/wave/cpplexer/token_cache.hpp | 2 +- .../wave/cpplexer/validate_universal_char.hpp | 2 +- .../boost/wave/grammars/cpp_chlit_grammar.hpp | 2 +- .../wave/grammars/cpp_defined_grammar.hpp | 2 +- .../wave/grammars/cpp_defined_grammar_gen.hpp | 6 +- .../wave/grammars/cpp_expression_grammar.hpp | 2 +- .../grammars/cpp_expression_grammar_gen.hpp | 2 +- .../wave/grammars/cpp_expression_value.hpp | 49 +- include/boost/wave/grammars/cpp_grammar.hpp | 2 +- .../boost/wave/grammars/cpp_grammar_gen.hpp | 2 +- .../wave/grammars/cpp_intlit_grammar.hpp | 2 +- .../wave/grammars/cpp_literal_grammar_gen.hpp | 2 +- .../wave/grammars/cpp_predef_macros_gen.hpp | 2 +- .../grammars/cpp_predef_macros_grammar.hpp | 2 +- include/boost/wave/language_support.hpp | 2 +- include/boost/wave/preprocessing_hooks.hpp | 2 +- include/boost/wave/token_ids.hpp | 2 +- include/boost/wave/util/cpp_ifblock.hpp | 2 +- .../boost/wave/util/cpp_include_pathes.hpp | 2 +- include/boost/wave/util/cpp_iterator.hpp | 2 +- include/boost/wave/util/cpp_macromap.hpp | 959 +++++------------- .../boost/wave/util/cpp_macromap_predef.hpp | 249 +++++ .../boost/wave/util/cpp_macromap_utils.hpp | 497 +++++++++ include/boost/wave/util/eat_whitespace.hpp | 2 +- include/boost/wave/util/file_position.hpp | 2 +- include/boost/wave/util/functor_input.hpp | 2 +- .../wave/util/insert_whitespace_detection.hpp | 2 +- include/boost/wave/util/interpret_pragma.hpp | 2 +- include/boost/wave/util/iteration_context.hpp | 2 +- include/boost/wave/util/macro_definition.hpp | 2 +- include/boost/wave/util/macro_helpers.hpp | 2 +- include/boost/wave/util/pattern_parser.hpp | 2 +- include/boost/wave/util/symbol_table.hpp | 2 +- .../wave/util/time_conversion_helper.hpp | 2 +- .../boost/wave/util/transform_iterator.hpp | 2 +- .../boost/wave/util/unput_queue_iterator.hpp | 125 ++- include/boost/wave/wave_config.hpp | 8 +- include/boost/wave/wave_version.hpp | 6 +- index.html | 2 +- samples/cpp_tokens/build/Jamfile | 2 +- samples/cpp_tokens/build/Jamfile.v2 | 2 +- samples/cpp_tokens/cpp_tokens.cpp | 2 +- samples/cpp_tokens/cpp_tokens.hpp | 2 +- samples/cpp_tokens/cpp_tokens_config.hpp | 2 +- .../instantiate_cpp_exprgrammar.cpp | 2 +- .../cpp_tokens/instantiate_cpp_grammar.cpp | 2 +- .../instantiate_cpp_literalgrammars.cpp | 2 +- .../instantiate_defined_grammar.cpp | 2 +- samples/cpp_tokens/instantiate_slex_lexer.cpp | 2 +- samples/cpp_tokens/slex/cpp_slex_lexer.hpp | 2 +- samples/cpp_tokens/slex/lexer.hpp | 2 +- samples/cpp_tokens/slex_interface.hpp | 2 +- samples/cpp_tokens/slex_iterator.hpp | 2 +- samples/cpp_tokens/slex_token.hpp | 2 +- samples/list_includes/build/Jamfile | 2 +- samples/list_includes/build/Jamfile.v2 | 2 +- samples/list_includes/list_includes.cpp | 2 +- samples/list_includes/list_includes.hpp | 2 +- .../list_includes/list_includes_config.hpp | 2 +- .../list_includes/list_includes_version.hpp | 2 +- samples/quick_start/build/Jamfile | 2 +- samples/quick_start/build/Jamfile.v2 | 2 +- samples/quick_start/quick_start.cpp | 2 +- samples/waveidl/build/Jamfile | 2 +- samples/waveidl/build/Jamfile.v2 | 2 +- samples/waveidl/idl.cpp | 4 +- samples/waveidl/idl.hpp | 2 +- samples/waveidl/idl_config.hpp | 2 +- samples/waveidl/idl_version.hpp | 4 +- samples/waveidl/idllexer/idl.re | 2 +- samples/waveidl/idllexer/idl.re.cpp | 2 +- samples/waveidl/idllexer/idl.re.hpp | 2 +- .../waveidl/idllexer/idl_lex_interface.hpp | 2 +- samples/waveidl/idllexer/idl_lex_iterator.hpp | 2 +- samples/waveidl/idllexer/idl_re2c_lexer.hpp | 2 +- samples/waveidl/instantiate_cpp_grammar.cpp | 2 +- .../waveidl/instantiate_defined_grammar.cpp | 2 +- samples/waveidl/instantiate_predef_macros.cpp | 2 +- samples/waveidl/instantiate_re2c_lexer.cpp | 2 +- .../waveidl/instantiate_re2c_lexer_string.cpp | 2 +- src/cpplexer/re2clex/aq.cpp | 2 +- src/cpplexer/re2clex/cpp.re | 2 +- src/cpplexer/re2clex/cpp.re.cpp | 2 +- src/instantiate_cpp_exprgrammar.cpp | 2 +- src/instantiate_cpp_grammar.cpp | 2 +- src/instantiate_cpp_literalgrammars.cpp | 2 +- src/instantiate_defined_grammar.cpp | 2 +- src/instantiate_predef_macros.cpp | 2 +- src/instantiate_re2c_lexer.cpp | 2 +- src/instantiate_re2c_lexer_string.cpp | 2 +- tool/build/Jamfile | 2 +- tool/build/Jamfile.v2 | 2 +- tool/cpp.cpp | 4 +- tool/cpp.hpp | 2 +- tool/cpp_config.hpp | 2 +- tool/cpp_version.hpp | 4 +- tool/stop_watch.hpp | 2 +- tool/trace_macro_expansion.hpp | 2 +- 132 files changed, 1255 insertions(+), 958 deletions(-) create mode 100644 include/boost/wave/util/cpp_macromap_predef.hpp create mode 100644 include/boost/wave/util/cpp_macromap_utils.hpp diff --git a/ChangeLog b/ChangeLog index 380706b..f104e7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,16 +1,17 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ -Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +Copyright (c) 2001-2005 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) ------------------------------------------------------------------------------- TODO (known issues): -- Fix expansion of macros, which replacement-list terminates in a partial macro - expansion. -- Fix the re2c lexer for iterators others then string::iterator -- Enforce, that #if/#endif and #region/#endregion are balanced file wise +- Fix expansion of macros, which replacement-list terminates in a partial + macro expansion. +- Fix the re2c lexer for iterators others then string::iterator (or more + generally for iterators, which aren't random access iterators) +- Enforce, that #if/#endif are balanced file wise - Try to remove the second parameter from the pp_iterator<>::force_include function. - Fix the trigraph backslash problem in the re2c (C/C++ and IDL) scanners, if @@ -22,6 +23,15 @@ TODO (known issues): CHANGELOG +Version 1.1.11 +- Updated copyrights. +- Fixed some bugs introduced by the latest refactoring. +- Tried to fix the expansion of macros, which replacement-list terminates in a + partial macro expansion. No success so far. + +Version 1.1.10 +- Refactored some of the macro map (macro namespace) code (added comments, + splitted into separate files), - Fixed some typename errors in cpp_macromap.hpp (thanks to Vladimir Prus). - Fixed the BoostBuild V2 Jamfiles (thanks to Vladimir Prus). diff --git a/build/Jamfile b/build/Jamfile index 1fc8bb4..2a07129 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index ad2dd7d..1f9706f 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/doc/acknowledgements.html b/doc/acknowledgements.html index 60fc20a..153b52d 100644 --- a/doc/acknowledgements.html +++ b/doc/acknowledgements.html @@ -74,13 +74,13 @@ a policy based std::basic_string<> compatible string implementation.


- Last updated: - Saturday, August 21, 2004 20:01 + Monday, January 17, 2005 16:39 diff --git a/doc/class_reference_context.html b/doc/class_reference_context.html index 5843612..2edde50 100644 --- a/doc/class_reference_context.html +++ b/doc/class_reference_context.html @@ -428,12 +428,12 @@
-

 

diff --git a/doc/class_reference_contextpolicy.html b/doc/class_reference_contextpolicy.html index 02cee53..d344e82 100644 --- a/doc/class_reference_contextpolicy.html +++ b/doc/class_reference_contextpolicy.html @@ -252,12 +252,12 @@
- diff --git a/doc/class_reference_fileposition.html b/doc/class_reference_fileposition.html index bc0341e..cb919c1 100644 --- a/doc/class_reference_fileposition.html +++ b/doc/class_reference_fileposition.html @@ -108,12 +108,12 @@
- diff --git a/doc/class_reference_inputpolicy.html b/doc/class_reference_inputpolicy.html index fbe119e..39213b0 100644 --- a/doc/class_reference_inputpolicy.html +++ b/doc/class_reference_inputpolicy.html @@ -121,12 +121,12 @@
- diff --git a/doc/class_reference_lexer.html b/doc/class_reference_lexer.html index fd88f03..849b969 100644 --- a/doc/class_reference_lexer.html +++ b/doc/class_reference_lexer.html @@ -91,12 +91,12 @@
- diff --git a/doc/class_reference_tokentype.html b/doc/class_reference_tokentype.html index cbc66d4..ca2af42 100644 --- a/doc/class_reference_tokentype.html +++ b/doc/class_reference_tokentype.html @@ -165,12 +165,12 @@
- diff --git a/doc/compiletime_config.html b/doc/compiletime_config.html index 0703e77..a9c8f5a 100644 --- a/doc/compiletime_config.html +++ b/doc/compiletime_config.html @@ -192,12 +192,12 @@
- diff --git a/doc/introduction.html b/doc/introduction.html index a50fd4e..c53ba97 100644 --- a/doc/introduction.html +++ b/doc/introduction.html @@ -81,12 +81,12 @@ implemented. Additionally there is implemented a IDL lexer, which allows to use
- diff --git a/doc/macro_expansion_process.html b/doc/macro_expansion_process.html index 94b94e1..695188f 100644 --- a/doc/macro_expansion_process.html +++ b/doc/macro_expansion_process.html @@ -88,12 +88,12 @@
-

 

diff --git a/doc/predefined_macros.html b/doc/predefined_macros.html index 0e16c41..10d4b1b 100644 --- a/doc/predefined_macros.html +++ b/doc/predefined_macros.html @@ -164,12 +164,12 @@
- diff --git a/doc/preface.html b/doc/preface.html index c53c565..035e763 100644 --- a/doc/preface.html +++ b/doc/preface.html @@ -99,12 +99,12 @@ today is the preprocessor of the gcc C/C++ compiler.


- diff --git a/doc/quickstart.html b/doc/quickstart.html index 580219f..9d50643 100644 --- a/doc/quickstart.html +++ b/doc/quickstart.html @@ -110,12 +110,12 @@ Note though, that this filename is used
- diff --git a/doc/references.html b/doc/references.html index 681f93b..be8d623 100644 --- a/doc/references.html +++ b/doc/references.html @@ -89,12 +89,12 @@
- diff --git a/doc/samples.html b/doc/samples.html index 361a081..e8e710f 100644 --- a/doc/samples.html +++ b/doc/samples.html @@ -83,12 +83,12 @@ preprocessed tokens generated from a given input file. It is described in more d
-

 

diff --git a/doc/supported_pragmas.html b/doc/supported_pragmas.html index 2226bba..90336ce 100644 --- a/doc/supported_pragmas.html +++ b/doc/supported_pragmas.html @@ -115,12 +115,12 @@
-

 

diff --git a/doc/token_ids.html b/doc/token_ids.html index 1d3e7b1..16f12e3 100644 --- a/doc/token_ids.html +++ b/doc/token_ids.html @@ -961,12 +961,12 @@
- diff --git a/doc/tracing_facility.html b/doc/tracing_facility.html index fbdda99..c8dd18c 100644 --- a/doc/tracing_facility.html +++ b/doc/tracing_facility.html @@ -148,7 +148,7 @@
- @@ -159,3 +159,4 @@ +Monday, January 17, 2005 16:39 \ No newline at end of file diff --git a/doc/wave_driver.html b/doc/wave_driver.html index 1a78220..5cc56ab 100644 --- a/doc/wave_driver.html +++ b/doc/wave_driver.html @@ -190,12 +190,12 @@
- diff --git a/include/boost/wave.hpp b/include/boost/wave.hpp index 0931e9f..80510cc 100644 --- a/include/boost/wave.hpp +++ b/include/boost/wave.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpp_context.hpp b/include/boost/wave/cpp_context.hpp index cb67ff4..b9cc20a 100644 --- a/include/boost/wave/cpp_context.hpp +++ b/include/boost/wave/cpp_context.hpp @@ -4,7 +4,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -232,9 +232,8 @@ protected: void expand_whole_tokensequence(IteratorT2 &first, IteratorT2 const &last, token_sequence_type &expanded, bool expand_undefined = true) { - bool seen_qualified_name = false; macros.expand_whole_tokensequence(expanded, first, last, - expand_undefined, &seen_qualified_name); + expand_undefined); // remove any contained placeholder boost::wave::util::impl::remove_placeholders(expanded); diff --git a/include/boost/wave/cpp_exceptions.hpp b/include/boost/wave/cpp_exceptions.hpp index 509a38d..0aa4c9a 100644 --- a/include/boost/wave/cpp_exceptions.hpp +++ b/include/boost/wave/cpp_exceptions.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpp_iteration_context.hpp b/include/boost/wave/cpp_iteration_context.hpp index 3e3b763..c851923 100644 --- a/include/boost/wave/cpp_iteration_context.hpp +++ b/include/boost/wave/cpp_iteration_context.hpp @@ -4,7 +4,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/cpp_lex_interface.hpp b/include/boost/wave/cpplexer/cpp_lex_interface.hpp index 6bae13e..3e110f0 100644 --- a/include/boost/wave/cpplexer/cpp_lex_interface.hpp +++ b/include/boost/wave/cpplexer/cpp_lex_interface.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/cpp_lex_iterator.hpp b/include/boost/wave/cpplexer/cpp_lex_iterator.hpp index 7b45608..2941c5f 100644 --- a/include/boost/wave/cpplexer/cpp_lex_iterator.hpp +++ b/include/boost/wave/cpplexer/cpp_lex_iterator.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/cpp_lex_token.hpp b/include/boost/wave/cpplexer/cpp_lex_token.hpp index 104f7c5..5ef4d22 100644 --- a/include/boost/wave/cpplexer/cpp_lex_token.hpp +++ b/include/boost/wave/cpplexer/cpp_lex_token.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/cpplexer_exceptions.hpp b/include/boost/wave/cpplexer/cpplexer_exceptions.hpp index b9ccc28..3a5969d 100644 --- a/include/boost/wave/cpplexer/cpplexer_exceptions.hpp +++ b/include/boost/wave/cpplexer/cpplexer_exceptions.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/re2clex/aq.hpp b/include/boost/wave/cpplexer/re2clex/aq.hpp index cd093f7..2d73e0d 100644 --- a/include/boost/wave/cpplexer/re2clex/aq.hpp +++ b/include/boost/wave/cpplexer/re2clex/aq.hpp @@ -4,7 +4,7 @@ http://spirit.sourceforge.net/ Copyright (c) 2001 Daniel C. Nuffer. - Copyright (c) 2001-2004 Hartmut Kaiser. + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/re2clex/cpp.re.hpp b/include/boost/wave/cpplexer/re2clex/cpp.re.hpp index d1396d6..426d423 100644 --- a/include/boost/wave/cpplexer/re2clex/cpp.re.hpp +++ b/include/boost/wave/cpplexer/re2clex/cpp.re.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp b/include/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp index b7b917d..aa3be21 100644 --- a/include/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp +++ b/include/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/re2clex/scanner.hpp b/include/boost/wave/cpplexer/re2clex/scanner.hpp index f65fbe6..46b4bf5 100644 --- a/include/boost/wave/cpplexer/re2clex/scanner.hpp +++ b/include/boost/wave/cpplexer/re2clex/scanner.hpp @@ -4,7 +4,7 @@ http://spirit.sourceforge.net/ Copyright (c) 2001 Daniel C. Nuffer. - Copyright (c) 2001-2004 Hartmut Kaiser. + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/token_cache.hpp b/include/boost/wave/cpplexer/token_cache.hpp index b28c5b3..4239878 100644 --- a/include/boost/wave/cpplexer/token_cache.hpp +++ b/include/boost/wave/cpplexer/token_cache.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/cpplexer/validate_universal_char.hpp b/include/boost/wave/cpplexer/validate_universal_char.hpp index 5b1d3c3..ad9c907 100644 --- a/include/boost/wave/cpplexer/validate_universal_char.hpp +++ b/include/boost/wave/cpplexer/validate_universal_char.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_chlit_grammar.hpp b/include/boost/wave/grammars/cpp_chlit_grammar.hpp index e2290dc..fd304ae 100644 --- a/include/boost/wave/grammars/cpp_chlit_grammar.hpp +++ b/include/boost/wave/grammars/cpp_chlit_grammar.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_defined_grammar.hpp b/include/boost/wave/grammars/cpp_defined_grammar.hpp index 0148d57..9c407f8 100644 --- a/include/boost/wave/grammars/cpp_defined_grammar.hpp +++ b/include/boost/wave/grammars/cpp_defined_grammar.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_defined_grammar_gen.hpp b/include/boost/wave/grammars/cpp_defined_grammar_gen.hpp index c23b828..8af3474 100644 --- a/include/boost/wave/grammars/cpp_defined_grammar_gen.hpp +++ b/include/boost/wave/grammars/cpp_defined_grammar_gen.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -32,8 +32,8 @@ struct defined_grammar_gen // The parse_operator_define function is instantiated manually twice to // simplify the explicit specialization of this template. This way the user -// has only to specify one template parameter (the token type) to correctly -// formulate the required explicit specialization. +// has only to specify one template parameter (the lexer iterator type) to +// correctly formulate the required explicit specialization. // This results in no code overhead, because otherwise the function would be // generated by the compiler twice anyway. diff --git a/include/boost/wave/grammars/cpp_expression_grammar.hpp b/include/boost/wave/grammars/cpp_expression_grammar.hpp index c49f101..0fb2d61 100644 --- a/include/boost/wave/grammars/cpp_expression_grammar.hpp +++ b/include/boost/wave/grammars/cpp_expression_grammar.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_expression_grammar_gen.hpp b/include/boost/wave/grammars/cpp_expression_grammar_gen.hpp index 6101aff..866a6f5 100644 --- a/include/boost/wave/grammars/cpp_expression_grammar_gen.hpp +++ b/include/boost/wave/grammars/cpp_expression_grammar_gen.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_expression_value.hpp b/include/boost/wave/grammars/cpp_expression_value.hpp index 65319b7..cc97cf8 100644 --- a/include/boost/wave/grammars/cpp_expression_value.hpp +++ b/include/boost/wave/grammars/cpp_expression_value.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -31,9 +31,6 @@ namespace closures { // /////////////////////////////////////////////////////////////////////////////// class closure_value { - - typedef unsigned long ulong_t; - public: enum value_type { @@ -54,7 +51,7 @@ public: explicit closure_value(long i, bool valid_ = true) : type(is_int), valid(valid_) { value.i = i; } - explicit closure_value(ulong_t ui, bool valid_ = true) + explicit closure_value(unsigned long ui, bool valid_ = true) : type(is_uint), valid(valid_) { value.ui = ui; } explicit closure_value(bool b, bool valid_ = true) @@ -92,7 +89,7 @@ public: } return value.i; } - operator ulong_t() const + operator unsigned long() const { switch (type) { case is_uint: return value.ui; @@ -121,7 +118,7 @@ public: break; case is_uint: - value.ui = ulong_t(rhs); + value.ui = unsigned long(rhs); type = is_uint; break; @@ -154,7 +151,7 @@ public: valid = true; return *this; } - closure_value &operator= (ulong_t rhs) + closure_value &operator= (unsigned long rhs) { type = is_uint; value.ui = rhs; @@ -181,7 +178,7 @@ public: } break; - case is_uint: value.ui += ulong_t(rhs); break; + case is_uint: value.ui += unsigned long(rhs); break; case is_bool: value.i = value.b + bool(rhs); type = is_int; @@ -200,7 +197,7 @@ public: } break; - case is_uint: value.ui -= ulong_t(rhs); break; + case is_uint: value.ui -= unsigned long(rhs); break; case is_bool: value.i = value.b - bool(rhs); type = is_int; @@ -219,7 +216,7 @@ public: } break; - case is_uint: value.ui *= ulong_t(rhs); break; + case is_uint: value.ui *= unsigned long(rhs); break; case is_bool: switch (rhs.type) { case is_int: @@ -266,8 +263,8 @@ public: break; case is_uint: - if (valid && ulong_t(rhs) != 0) - value.ui /= ulong_t(rhs); + if (valid && unsigned long(rhs) != 0) + value.ui /= unsigned long(rhs); else valid = false; // division by zero break; @@ -304,7 +301,7 @@ public: case is_bool: return closure_value(!bool(rhs), rhs.valid); case is_uint: break; } - return closure_value(-(int)ulong_t(rhs), rhs.valid); + return closure_value(-(int)unsigned long(rhs), rhs.valid); } friend closure_value operator! (closure_value const &rhs) @@ -314,7 +311,7 @@ public: case is_bool: return closure_value(!bool(rhs), rhs.valid); case is_uint: break; } - return closure_value(!ulong_t(rhs), rhs.valid); + return closure_value(!unsigned long(rhs), rhs.valid); } // comparison @@ -331,7 +328,7 @@ public: } break; - case is_uint: cmp = lhs.value.ui == ulong_t(rhs); break; + case is_uint: cmp = lhs.value.ui == unsigned long(rhs); break; case is_bool: cmp = lhs.value.b == bool(rhs); break; } return closure_value(cmp, lhs.valid && rhs.valid); @@ -354,7 +351,7 @@ public: } break; - case is_uint: cmp = lhs.value.ui > ulong_t(rhs); break; + case is_uint: cmp = lhs.value.ui > unsigned long(rhs); break; case is_bool: cmp = lhs.value.b > bool(rhs); break; } return closure_value(cmp, lhs.valid && rhs.valid); @@ -372,7 +369,7 @@ public: } break; - case is_uint: cmp = lhs.value.ui < ulong_t(rhs); break; + case is_uint: cmp = lhs.value.ui < unsigned long(rhs); break; case is_bool: cmp = bool(lhs) < bool(rhs); break; } return closure_value(cmp, lhs.valid && rhs.valid); @@ -410,7 +407,7 @@ public: case is_uint: { - unsigned long shift_by = ulong_t(rhs); + unsigned long shift_by = unsigned long(rhs); if (shift_by > 64) shift_by = 64; @@ -440,7 +437,7 @@ public: case is_uint: { - unsigned long shift_by = ulong_t(rhs); + unsigned long shift_by = unsigned long(rhs); if (shift_by > 64) shift_by = 64; @@ -475,7 +472,7 @@ public: case is_uint: { - unsigned long shift_by = ulong_t(rhs); + unsigned long shift_by = unsigned long(rhs); if (shift_by > 64) shift_by = 64; @@ -505,7 +502,7 @@ public: case is_uint: { - unsigned long shift_by = ulong_t(rhs); + unsigned long shift_by = unsigned long(rhs); if (shift_by > 64) shift_by = 64; @@ -543,13 +540,13 @@ public: case is_bool: value.b = bool(cond) ? value.b : bool(val2); break; case is_int: value.i = bool(cond) ? value.i : long(val2); break; case is_uint: - value.ui = bool(cond) ? value.ui : ulong_t(val2); + value.ui = bool(cond) ? value.ui : unsigned long(val2); type = is_uint; // changing type! break; } break; - case is_uint: value.ui = bool(cond) ? value.ui : ulong_t(val2); break; + case is_uint: value.ui = bool(cond) ? value.ui : unsigned long(val2); break; case is_bool: value.b = bool(cond) ? value.b : bool(val2); break; } valid = bool(cond) ? valid : val2.valid; @@ -562,7 +559,7 @@ public: { switch (val.type) { case is_int: o << "int(" << long(val) << ")"; break; - case is_uint: o << "unsigned int(" << ulong_t(val) << ")"; break; + case is_uint: o << "unsigned int(" << unsigned long(val) << ")"; break; case is_bool: o << "bool(" << bool(val) << ")"; break; } return o; @@ -573,7 +570,7 @@ private: value_type type; union { long i; - ulong_t ui; + unsigned long ui; bool b; } value; bool valid; diff --git a/include/boost/wave/grammars/cpp_grammar.hpp b/include/boost/wave/grammars/cpp_grammar.hpp index 34ba21e..9d3cc22 100644 --- a/include/boost/wave/grammars/cpp_grammar.hpp +++ b/include/boost/wave/grammars/cpp_grammar.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_grammar_gen.hpp b/include/boost/wave/grammars/cpp_grammar_gen.hpp index 7166f14..ad3f509 100644 --- a/include/boost/wave/grammars/cpp_grammar_gen.hpp +++ b/include/boost/wave/grammars/cpp_grammar_gen.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_intlit_grammar.hpp b/include/boost/wave/grammars/cpp_intlit_grammar.hpp index 4e16799..3ea29e4 100644 --- a/include/boost/wave/grammars/cpp_intlit_grammar.hpp +++ b/include/boost/wave/grammars/cpp_intlit_grammar.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_literal_grammar_gen.hpp b/include/boost/wave/grammars/cpp_literal_grammar_gen.hpp index dd82097..a0c78d9 100644 --- a/include/boost/wave/grammars/cpp_literal_grammar_gen.hpp +++ b/include/boost/wave/grammars/cpp_literal_grammar_gen.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_predef_macros_gen.hpp b/include/boost/wave/grammars/cpp_predef_macros_gen.hpp index 04ae8d6..ed14f88 100644 --- a/include/boost/wave/grammars/cpp_predef_macros_gen.hpp +++ b/include/boost/wave/grammars/cpp_predef_macros_gen.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/grammars/cpp_predef_macros_grammar.hpp b/include/boost/wave/grammars/cpp_predef_macros_grammar.hpp index 2eb7386..2d837c2 100644 --- a/include/boost/wave/grammars/cpp_predef_macros_grammar.hpp +++ b/include/boost/wave/grammars/cpp_predef_macros_grammar.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/language_support.hpp b/include/boost/wave/language_support.hpp index 2d256ad..cb3e35e 100644 --- a/include/boost/wave/language_support.hpp +++ b/include/boost/wave/language_support.hpp @@ -4,7 +4,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/preprocessing_hooks.hpp b/include/boost/wave/preprocessing_hooks.hpp index a0cdc63..7e69657 100644 --- a/include/boost/wave/preprocessing_hooks.hpp +++ b/include/boost/wave/preprocessing_hooks.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/token_ids.hpp b/include/boost/wave/token_ids.hpp index f6b0ed4..39bf5a8 100644 --- a/include/boost/wave/token_ids.hpp +++ b/include/boost/wave/token_ids.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/cpp_ifblock.hpp b/include/boost/wave/util/cpp_ifblock.hpp index dfbc15a..3c4ccb3 100644 --- a/include/boost/wave/util/cpp_ifblock.hpp +++ b/include/boost/wave/util/cpp_ifblock.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/cpp_include_pathes.hpp b/include/boost/wave/util/cpp_include_pathes.hpp index 27bd93d..3cfe4c0 100644 --- a/include/boost/wave/util/cpp_include_pathes.hpp +++ b/include/boost/wave/util/cpp_include_pathes.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/cpp_iterator.hpp b/include/boost/wave/util/cpp_iterator.hpp index f127ba6..a862e6a 100644 --- a/include/boost/wave/util/cpp_iterator.hpp +++ b/include/boost/wave/util/cpp_iterator.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/cpp_macromap.hpp b/include/boost/wave/util/cpp_macromap.hpp index a564c85..6c8c5e1 100644 --- a/include/boost/wave/util/cpp_macromap.hpp +++ b/include/boost/wave/util/cpp_macromap.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -33,6 +33,8 @@ #include #include #include +#include +#include #include #include @@ -44,62 +46,6 @@ namespace boost { namespace wave { namespace util { -namespace on_exit { - - // on destruction pop the first element of the list given as the argument - template - struct pop_front { - - pop_front(ContainerT &list_) : list(list_) {} - ~pop_front() { list.pop_front(); } - - ContainerT &list; - }; - - // append a given list to the list given as argument - // on destruction pop the first element of the list given as argument - template - struct splice_pop_front { - - splice_pop_front(ContainerT &list_, ContainerT &queue) - : list(list_) - { - list.splice(list.end(), queue); - } - ~splice_pop_front() { list.pop_front(); } - - ContainerT &list; - }; - - // on destruction reset a referenced value to its initial state - template - struct reset { - - reset(TypeT &target_value_, TypeT new_value) - : target_value(target_value_), old_value(target_value_) - { - target_value_ = new_value; - } - ~reset() { target_value = old_value; } - - TypeT &target_value; - TypeT old_value; - }; - - // on destruction assign the given iterator back - template - struct assign { - - assign(IteratorT &it_, UnputIteratorT const &uit_) - : it(it_), uit(uit_) {} - ~assign() { it = uit.base(); } - - IteratorT ⁢ - UnputIteratorT const &uit; - }; - -} // namespace on_exit - /////////////////////////////////////////////////////////////////////////////// // // macromap @@ -116,16 +62,15 @@ class macromap { typedef typename token_type::string_type string_type; typedef typename token_type::position_type position_type; -// type of a token sequence typedef typename ContextT::token_sequence_type definition_container_type; + typedef std::vector parameter_container_type; typedef macro_definition macro_definition_type; - - typedef symbol_table defined_macros_type; - typedef typename defined_macros_type::value_type::second_type macro_ref_type; - - typedef std::vector parameter_container_type; + typedef symbol_table + defined_macros_type; + typedef typename defined_macros_type::value_type::second_type + macro_ref_type; public: macromap(ContextT &ctx_) @@ -136,247 +81,141 @@ public: } ~macromap() {} +// Add a new macro to the given macro scope bool add_macro(token_type const &name, bool has_parameters, parameter_container_type ¶meters, definition_container_type &definition, bool is_predefined = false, defined_macros_type *scope = 0); + +// Tests, whether the given macro name is defined in the given macro scope bool is_defined(string_type const &name, typename defined_macros_type::iterator &it, defined_macros_type *scope = 0) const; template bool is_defined(IteratorT const &begin, IteratorT const &end); + +// Remove a macro name from the given macro scope bool remove_macro(string_type const &name, bool even_predefined = false); template - token_type const &expand_tokensequence(IteratorT &first, IteratorT const &last, - ContainerT &pending, ContainerT &expanded, bool expand_undefined); + token_type const &expand_tokensequence(IteratorT &first, + IteratorT const &last, ContainerT &pending, ContainerT &expanded, + bool expand_operator_defined); +// Expand all macros inside the given token sequence template void expand_whole_tokensequence(ContainerT &expanded, - IteratorT const &first, IteratorT const &last, bool expand_undefined, - bool *seen_qualified_name = 0); + IteratorT &first, IteratorT const &last, + bool expand_operator_defined); +// Init the predefined macros (add them to the given scope) void init_predefined_macros(defined_macros_type *scope = 0, bool at_global_scope = true); void predefine_macro(defined_macros_type *scope, string_type const &name, token_type const &t); + +// Init the internal macro symbol namespace void reset_macromap(); position_type &get_main_pos() { return main_pos; } protected: +// Helper functions for expanding all macros in token sequences template token_type const &expand_tokensequence_worker(ContainerT &pending, unput_queue_iterator &first, unput_queue_iterator const &last, - bool expand_undefined, bool *seen_qualified_name = 0); + bool expand_operator_defined); + +// Expand all macros in the given replacement list and continue argument +// collection from the given input stream template - token_type const &expand_tokensequence_worker_classical(ContainerT &pending, - unput_queue_iterator &first, - unput_queue_iterator const &last, - bool expand_undefined); - + void expand_replacementlist_tokensequence( + ContainerT &expanded, ContainerT &replacement_list, + IteratorT &first, IteratorT const &last, + bool expand_operator_defined); + +// Collect all arguments supplied to a macro invocation template typename std::vector::size_type collect_arguments ( token_type const curr_token, std::vector &arguments, IteratorT &next, IteratorT const &end, SizeT const ¶meter_count); +// Expand a single macro name template bool expand_macro(ContainerT &pending, token_type const &name, typename defined_macros_type::iterator it, - IteratorT &first, IteratorT const &last, bool expand_undefined, - defined_macros_type *scope = 0, ContainerT *queue_symbol = 0, - bool *seen_qualified_name = 0); + IteratorT &first, IteratorT const &last, bool expand_operator_defined, + defined_macros_type *scope = 0, ContainerT *queue_symbol = 0); +// Expand a predefined macro (__LINE__, __FILE__ and __INCLUDE_LEVEL__) template bool expand_predefined_macro(token_type const &curr_token, ContainerT &expanded); +// Expand a single macro argument template void expand_argument (typename std::vector::size_type arg, std::vector &arguments, - std::vector &expanded_args, bool expand_undefined, + std::vector &expanded_args, bool expand_operator_defined, std::vector &has_expanded_args); +// Expand the replacement list (replaces parameters with arguments) template void expand_replacement_list( macro_definition_type const ¯odefinition, std::vector &arguments, - bool expand_undefined, ContainerT &expanded); + bool expand_operator_defined, ContainerT &expanded); - template +// Rescans the replacement list for macro expansion + template void rescan_replacement_list(token_type const &curr_token, macro_definition_type ¯odef, ContainerT &replacement_list, - ContainerT &expanded, bool expand_undefined, bool *seen_qualified_name); + ContainerT &expanded, bool expand_operator_defined, + IteratorT &nfirst, IteratorT const &nlast); +// Resolves the operator defined() and replces the token with "0" or "1" template token_type const &resolve_defined(IteratorT &first, IteratorT const &last, ContainerT &expanded); + +// Resolve operator _Pragma or the #pragma directive template bool resolve_operator_pragma(IteratorT &first, IteratorT const &last, ContainerT &expanded); +// Handle the concatenation operator '##' template void concat_tokensequence(ContainerT &expanded); template - bool is_invalid_concat(string_type new_value, + bool is_valid_concat(string_type new_value, position_type const &pos, ContainerT &rescanned); - static bool - definition_equals(definition_container_type const &definition, - definition_container_type const &new_definition); - static bool - parameters_equal(parameter_container_type const ¶meters, - parameter_container_type const &new_definition); - - static bool - token_equals(token_type const &left, token_type const &right); - private: defined_macros_type *current_macros; // current symbol table boost::shared_ptr defined_macros; // global symbol table - token_type act_token; // current token - position_type main_pos; // last token position in the pp_iterator - ContextT &ctx; // context object associated with the macromap + token_type act_token; // current token + position_type main_pos; // last token position in the pp_iterator + ContextT &ctx; // context object associated with the macromap long macro_uid; }; +/////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////////////// // // add_macro(): adds a new macro to the macromap // /////////////////////////////////////////////////////////////////////////////// -namespace { - - // Test is a given identifier resolves to a predefined name - template - inline bool - is_special_macroname (StringT const &name) - { - if (name.size() < 7) - return false; - - if ("defined" == name) - return true; - - if ('_' == name[0] && '_' == name[1]) { - StringT str = name.substr(2); - - if (str == "cplusplus" || str == "STDC__" || - str == "TIME__" || str == "DATE__" || - str == "LINE__" || str == "FILE__" || - str == "INCLUDE_LEVEL__") - { - return true; - } - } - return false; - } -} - -template -inline bool -macromap::token_equals(token_type const &left, token_type const &right) -{ - using namespace boost::wave; - -#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 - if (T_PARAMETERBASE == token_id(left) || - T_EXTPARAMETERBASE == token_id(left)) -#else - if (T_PARAMETERBASE == token_id(left)) -#endif - { - // if the existing token is of type T_PARAMETERBASE, then the right token - // must be of type T_IDENTIFIER or a keyword - return (T_IDENTIFIER == token_id(right) || - IS_CATEGORY(right, KeywordTokenType)) && - left.get_value() == right.get_value(); - } - - // if the left token has whitespace, the value is irrelevant - return token_id(left) == token_id(right) && ( - IS_CATEGORY(left, WhiteSpaceTokenType) || - left.get_value() == right.get_value() - ); -} - -template -inline bool -macromap::definition_equals(definition_container_type const &definition, - definition_container_type const &new_definition) -{ - typedef typename definition_container_type::const_iterator - const_iterator_type; - -const_iterator_type first1 = definition.begin(); -const_iterator_type last1 = definition.end(); -const_iterator_type first2 = new_definition.begin(); -const_iterator_type last2 = new_definition.end(); - - while (first1 != last1 && token_equals(*first1, *first2)) { - // skip whitespace, if both sequences have a whitespace next - token_id id1 = impl::next_token::peek(first1, last1, false); - token_id id2 = impl::next_token::peek(first2, last2, false); - - if (IS_CATEGORY(id1, WhiteSpaceTokenType) && - IS_CATEGORY(id2, WhiteSpaceTokenType)) - { - // all consecutive whitespace tokens count as one whitespace - // adjust first1 and first2 accordingly - impl::skip_whitespace(first1, last1); - impl::skip_whitespace(first2, last2); - } - else if (!IS_CATEGORY(id1, WhiteSpaceTokenType) && - !IS_CATEGORY(id2, WhiteSpaceTokenType)) - { - ++first1; - ++first2; - } - else { - // the sequences differ - break; - } - } - return (first1 == last1 && first2 == last2) ? true : false; -} - -template -inline bool -macromap::parameters_equal(parameter_container_type const ¶meters, - parameter_container_type const &new_parameters) -{ - if (parameters.size() != new_parameters.size()) - return false; // different parameter count - - typedef typename parameter_container_type::const_iterator const_iterator_type; - -const_iterator_type first1 = parameters.begin(); -const_iterator_type last1 = parameters.end(); -const_iterator_type first2 = new_parameters.begin(); - - while (first1 != last1) { - // parameters are different, if the corresponding tokens are different - if (token_id(*first1) != token_id(*first2) || - (*first1).get_value() != (*first2).get_value()) - { - break; - } - ++first1; - ++first2; - } - return (first1 == last1) ? true : false; -} - template inline bool macromap::add_macro(token_type const &name, bool has_parameters, parameter_container_type ¶meters, definition_container_type &definition, bool is_predefined, defined_macros_type *scope) { - if (!is_predefined && is_special_macroname (name.get_value())) { + if (!is_predefined && impl::is_special_macroname (name.get_value())) { // exclude special macro names BOOST_WAVE_THROW(preprocess_exception, illegal_redefinition, name.get_value(), main_pos); @@ -389,8 +228,8 @@ typename defined_macros_type::iterator it = current_scope->find(name.get_value() if (it != current_scope->end()) { // redefinition, should not be different if ((*it).second->is_functionlike != has_parameters || - !parameters_equal((*it).second->macroparameters, parameters) || - !definition_equals((*it).second->macrodefinition, definition)) + !impl::parameters_equal((*it).second->macroparameters, parameters) || + !impl::definition_equals((*it).second->macrodefinition, definition)) { BOOST_WAVE_THROW(preprocess_exception, macro_redefinition, name.get_value(), main_pos); @@ -476,7 +315,6 @@ inline bool macromap::is_defined(IteratorT const &begin, IteratorT const &end) { - using namespace cpplexer; { // in normal mode the name under inspection should consist of an identifier // only @@ -484,7 +322,7 @@ macromap::is_defined(IteratorT const &begin, !IS_CATEGORY(*begin, KeywordTokenType)) { BOOST_WAVE_THROW(preprocess_exception, invalid_macroname, - get_full_name(begin, end), main_pos); + impl::get_full_name(begin, end), main_pos); } IteratorT it = begin; @@ -495,7 +333,7 @@ macromap::is_defined(IteratorT const &begin, if (++it != end) { // there should be only one token as the inspected name BOOST_WAVE_THROW(preprocess_exception, invalid_macroname, - get_full_name(begin, end), main_pos); + impl::get_full_name(begin, end), main_pos); } return cit != current_macros -> end(); } @@ -516,7 +354,7 @@ macromap::remove_macro(string_type const &name, if (it != current_macros->end()) { if ((*it).second->is_predefined) { - if (!even_predefined || is_special_macroname(name)) { + if (!even_predefined || impl::is_special_macroname(name)) { BOOST_WAVE_THROW(preprocess_exception, bad_undefine_statement, name, main_pos); } @@ -527,7 +365,7 @@ macromap::remove_macro(string_type const &name, ctx.undefined_macro(name); return true; } - else if (is_special_macroname(name)) { + else if (impl::is_special_macroname(name)) { BOOST_WAVE_THROW(preprocess_exception, bad_undefine_statement, name, main_pos); } @@ -542,26 +380,28 @@ macromap::remove_macro(string_type const &name, // range into corresponding unput_iterator's and calls the main workhorse // of the macro expansion engine (the function expand_tokensequence_worker) // +// This is the top level macro expansion function called from the +// preprocessing iterator component only. +// /////////////////////////////////////////////////////////////////////////////// template template inline typename ContextT::token_type const & macromap::expand_tokensequence(IteratorT &first, IteratorT const &last, ContainerT &pending, ContainerT &expanded, - bool expand_undefined) + bool expand_operator_defined) { - typedef impl::gen_unput_queue_iterator gen_t; - typedef typename gen_t::return_t iterator_type; + typedef impl::gen_unput_queue_iterator + gen_type; + typedef typename gen_type::return_type iterator_type; - ContainerT eof_queue; - iterator_type first_it = gen_t::generate(expanded, first); - iterator_type last_it = gen_t::generate(eof_queue, last); + iterator_type first_it = gen_type::generate(expanded, first); + iterator_type last_it = gen_type::generate(last); -bool seen_qualified_name = false; on_exit::assign on_exit(first, first_it); return expand_tokensequence_worker(pending, first_it, last_it, - expand_undefined, &seen_qualified_name); + expand_operator_defined); } /////////////////////////////////////////////////////////////////////////////// @@ -576,92 +416,6 @@ on_exit::assign on_exit(first, first_it); // The iterator 'first' is adjusted accordingly. // /////////////////////////////////////////////////////////////////////////////// - -namespace { - - // strip leading and trailing whitespace - template - inline void - trim_replacement_list (ContainerT &replacement_list) - { - using namespace boost::wave; - - // strip leading whitespace - if (replacement_list.size() > 0) { - typename ContainerT::iterator end = replacement_list.end(); - typename ContainerT::iterator it = replacement_list.begin(); - - while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) { - if (T_PLACEHOLDER != token_id(*it)) { - typename ContainerT::iterator next = it; - ++next; - replacement_list.erase(it); - it = next; - } - else { - ++it; - } - } - } - - // strip trailing whitespace - if (replacement_list.size() > 0) { - typename ContainerT::reverse_iterator rend = replacement_list.rend(); - typename ContainerT::reverse_iterator rit = replacement_list.rbegin(); - - while (rit != rend && IS_CATEGORY(*rit, WhiteSpaceTokenType)) - ++rit; - - typename ContainerT::iterator end = replacement_list.end(); - typename ContainerT::iterator it = rit.base(); - - while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) { - if (T_PLACEHOLDER != token_id(*it)) { - typename ContainerT::iterator next = it; - ++next; - replacement_list.erase(it); - it = next; - } - else { - ++it; - } - } - } - } -} // namespace - -namespace impl { - - // remove all placeholder tokens from the given token sequence - template - inline void - remove_placeholders (ContainerT &replacement_list) - { - using namespace boost::wave; - - // strip leading whitespace - if (replacement_list.size() > 0) { - typename ContainerT::iterator end = replacement_list.end(); - typename ContainerT::iterator it = replacement_list.begin(); - - while (it != end) { - if (T_PLACEHOLDER == token_id(*it)) { - typename ContainerT::iterator next = it; - ++next; - replacement_list.erase(it); - it = next; - } - else { - ++it; - } - } - - // remove all 'new' leading and trailing whitespace - trim_replacement_list(replacement_list); - } - } -} - template template inline typename ContextT::token_type const & @@ -669,7 +423,7 @@ macromap::expand_tokensequence_worker( ContainerT &pending, unput_queue_iterator &first, unput_queue_iterator const &last, - bool expand_undefined, bool *seen_qualified_name) + bool expand_operator_defined) { // if there exist pending tokens (tokens, which are already preprocessed), then // return the next one from there @@ -678,24 +432,12 @@ macromap::expand_tokensequence_worker( return act_token = pending.front(); } - return expand_tokensequence_worker_classical(pending, first, last, - expand_undefined); -} -template -template -inline typename ContextT::token_type const & -macromap::expand_tokensequence_worker_classical( - ContainerT &pending, - unput_queue_iterator &first, - unput_queue_iterator const &last, - bool expand_undefined) -{ +// analyze the next element of the given sequence, if it is an +// T_IDENTIFIER token, try to replace this as a macro etc. using namespace boost::wave; typedef unput_queue_iterator iterator_type; -// analyze the next element of the given sequence, if it is an -// T_IDENTIFIER token, try to replace this as a macro etc. if (first != last) { token_id id = token_id(*first); @@ -711,7 +453,7 @@ macromap::expand_tokensequence_worker_classical( if (T_IDENTIFIER == id || IS_CATEGORY(id, KeywordTokenType)) { // try to replace this identifier as a macro - if (expand_undefined && (*first).get_value() == "defined") { + if (expand_operator_defined && (*first).get_value() == "defined") { // resolve operator defined() return resolve_defined(first, last, pending); } @@ -743,7 +485,7 @@ macromap::expand_tokensequence_worker_classical( // the current token contains an identifier, which is currently // defined as a macro if (expand_macro(pending, name_token, it, first, last, - expand_undefined)) + expand_operator_defined)) { // the tokens returned by expand_macro should be rescanned // beginning at the last token of the returned replacement list @@ -771,9 +513,9 @@ macromap::expand_tokensequence_worker_classical( // return the next preprocessed token return expand_tokensequence_worker(pending, first, last, - expand_undefined); + expand_operator_defined); } -// else if (expand_undefined) { +// else if (expand_operator_defined) { // // in preprocessing conditionals undefined identifiers and keywords // // are to be replaced with '0' (see. C++ standard 16.1.4, [cpp.cond]) // return act_token = @@ -785,7 +527,7 @@ macromap::expand_tokensequence_worker_classical( return act_token; } } - else if (expand_undefined && IS_CATEGORY(*first, BoolLiteralTokenType)) { + else if (expand_operator_defined && IS_CATEGORY(*first, BoolLiteralTokenType)) { // expanding a constant expression inside #if/#elif, special handling // of 'true' and 'false' @@ -810,62 +552,6 @@ macromap::expand_tokensequence_worker_classical( // return the number of successfully detected non-empty arguments // /////////////////////////////////////////////////////////////////////////////// - -namespace { - - template - inline void - trim_argument_left (ContainerT &argument) - { - using namespace boost::wave; - - // strip leading whitespace (should be only one token) - if (argument.size() > 0 && - IS_CATEGORY(argument.front(), WhiteSpaceTokenType)) - { - argument.pop_front(); - } - } - - template - inline void - trim_argument_right (ContainerT &argument) - { - using namespace boost::wave; - - // strip trailing whitespace (should be only one token) - if (argument.size() > 0 && - IS_CATEGORY(argument.back(), WhiteSpaceTokenType)) - { - argument.pop_back(); - } - } - - template - inline void - trim_argument (ContainerT &argument) - { - trim_argument_left(argument); - trim_argument_right(argument); - } - - template - inline bool - is_whitespace_only (ContainerT const &argument) - { - using namespace cpplexer; - - typename ContainerT::const_iterator end = argument.end(); - for (typename ContainerT::const_iterator it = argument.begin(); - it != end; ++it) - { - if (!IS_CATEGORY(*it, WhiteSpaceTokenType)) - return false; - } - return true; - } -} - template template inline typename std::vector::size_type @@ -874,7 +560,9 @@ macromap::collect_arguments (token_type const curr_token, SizeT const ¶meter_count) { using namespace boost::wave; - + +//on_exit::reset on_exit_next(next.get_allow_continuation(), true); + arguments.push_back(ContainerT()); // collect the actual arguments @@ -911,8 +599,8 @@ token_type startof_argument_list = *next; // found closing parenthesis // trim_argument(argument); if (parameter_count > 0) { - if (0 == argument->size() || - is_whitespace_only(*argument)) + if (argument->empty() || + impl::is_whitespace_only(*argument)) { #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 if (boost::wave::need_variadics(ctx.get_language())) { @@ -936,8 +624,8 @@ token_type startof_argument_list = *next; if (1 == nested_parenthesis_level) { // next parameter // trim_argument(argument); - if (0 == argument->size() || - is_whitespace_only(*argument)) + if (argument->empty() || + impl::is_whitespace_only(*argument)) { #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 if (boost::wave::need_variadics(ctx.get_language())) { @@ -995,31 +683,6 @@ token_type startof_argument_list = *next; return count_arguments; } -/////////////////////////////////////////////////////////////////////////////// -namespace { - - using namespace boost::wave; - - template - bool skip_to_token(IteratorT &it, IteratorT const &end, token_id id) - { - using namespace boost::wave; - if (token_id(*it) == id) - return true; - if (++it == end) - return false; - while (IS_CATEGORY(*it, WhiteSpaceTokenType) || - T_NEWLINE == token_id(*it)) - { - if (++it == end) - return false; - } - BOOST_ASSERT(token_id(*it) == id); - return true; - } - -} - /////////////////////////////////////////////////////////////////////////////// // // expand_whole_tokensequence @@ -1031,22 +694,23 @@ template template inline void macromap::expand_whole_tokensequence(ContainerT &expanded, - IteratorT const &first, IteratorT const &last, bool expand_undefined, - bool *seen_qualified_name) + IteratorT &first, IteratorT const &last, + bool expand_operator_defined) { - typedef impl::gen_unput_queue_iterator gen_t; - typedef typename gen_t::return_t iterator_type; + typedef impl::gen_unput_queue_iterator + gen_type; + typedef typename gen_type::return_type iterator_type; - ContainerT unput_queue; - iterator_type first_it = gen_t::generate(unput_queue, first); - ContainerT eof_queue; - iterator_type last_it = gen_t::generate(eof_queue, last); +iterator_type first_it = gen_type::generate(first); +iterator_type last_it = gen_type::generate(last); - bool was_whitespace = false; - ContainerT pending_queue; +on_exit::assign on_exit(first, first_it); +bool was_whitespace = false; +ContainerT pending_queue; + while (!pending_queue.empty() || first_it != last_it) { token_type t = expand_tokensequence_worker(pending_queue, first_it, - last_it, expand_undefined, seen_qualified_name); + last_it, expand_operator_defined); bool is_whitespace = IS_CATEGORY(t, WhiteSpaceTokenType) && T_PLACEHOLDER != token_id(t); @@ -1061,7 +725,52 @@ macromap::expand_whole_tokensequence(ContainerT &expanded, } // should have returned all expanded tokens - BOOST_ASSERT(unput_queue.empty() && pending_queue.empty()); + BOOST_ASSERT(pending_queue.empty()/* && unput_queue.empty()*/); +} + +/////////////////////////////////////////////////////////////////////////////// +// +// expand_replacementlist_tokensequence +// +// fully expands a given replacement list and continues argument +// collection from the given input stream if necessary +// +template +template +inline void +macromap::expand_replacementlist_tokensequence(ContainerT &expanded, + ContainerT &replacement_list, IteratorT &first, IteratorT const &last, + bool expand_operator_defined) +{ + typedef impl::gen_unput_queue_iterator + gen_type; + typedef typename gen_type::return_type iterator_type; + +iterator_type last_it = gen_type::generate(last, false); +iterator_type first_it = gen_type::generate(replacement_list, first, false); + +on_exit::assign on_exit(first, first_it); +bool was_whitespace = false; +ContainerT pending_queue; + + while (!pending_queue.empty() || !first_it.get_unput_queue().empty()) { + token_type t = expand_tokensequence_worker(pending_queue, first_it, + last_it, expand_operator_defined); + bool is_whitespace = IS_CATEGORY(t, WhiteSpaceTokenType) && + T_PLACEHOLDER != token_id(t); + + if (!was_whitespace || !is_whitespace) { + if (is_whitespace && T_SPACE != token_id(t)) { + t.set_token_id(T_SPACE); + t.set_value(" "); + } + expanded.push_back(t); + } + was_whitespace = is_whitespace; + } + +// should have returned all expanded tokens + BOOST_ASSERT(pending_queue.empty()); } /////////////////////////////////////////////////////////////////////////////// @@ -1071,21 +780,18 @@ macromap::expand_whole_tokensequence(ContainerT &expanded, // fully expands the given argument of a macro call // /////////////////////////////////////////////////////////////////////////////// - template template inline void macromap::expand_argument ( typename std::vector::size_type arg, std::vector &arguments, std::vector &expanded_args, - bool expand_undefined, std::vector &has_expanded_args) + bool expand_operator_defined, std::vector &has_expanded_args) { if (!has_expanded_args[arg]) { // expand the argument only once - bool seen_qualified_name = false; - expand_whole_tokensequence(expanded_args[arg], arguments[arg].begin(), - arguments[arg].end(), expand_undefined, &seen_qualified_name); + arguments[arg].end(), expand_operator_defined); impl::remove_placeholders(expanded_args[arg]); has_expanded_args[arg] = true; } @@ -1100,13 +806,12 @@ macromap::expand_argument ( // handles the '#' [cpp.stringize] and the '##' [cpp.concat] operator // /////////////////////////////////////////////////////////////////////////////// - template template inline void macromap::expand_replacement_list( macro_definition_type const ¯odef, - std::vector &arguments, bool expand_undefined, + std::vector &arguments, bool expand_operator_defined, ContainerT &expanded) { using namespace boost::wave; @@ -1134,7 +839,6 @@ bool adjacent_stringize = false; else if (T_POUND == base_id) { // stringize operator adjacent_stringize = true; -// seen_concat = true; } else { if (adjacent_stringize || adjacent_concat || @@ -1178,7 +882,7 @@ bool adjacent_stringize = false; arg < expanded_args.size(); ++arg) { expand_argument(arg, arguments, expanded_args, - expand_undefined, has_expanded_args); + expand_operator_defined, has_expanded_args); } impl::replace_ellipsis(expanded_args, i, expanded, pos); } @@ -1187,7 +891,7 @@ bool adjacent_stringize = false; { // ensure argument i to be expanded expand_argument(i, arguments, expanded_args, - expand_undefined, has_expanded_args); + expand_operator_defined, has_expanded_args); // replace argument ContainerT const &arg = expanded_args[i]; @@ -1206,15 +910,15 @@ bool adjacent_stringize = false; #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 if (is_ellipsis && boost::wave::need_variadics(ctx.get_language())) { - trim_argument_left(arguments[i]); - trim_argument_right(arguments.back()); + impl::trim_argument_left(arguments[i]); + impl::trim_argument_right(arguments.back()); expanded.push_back(token_type(T_STRINGLIT, impl::as_stringlit(arguments, i, pos), pos)); } else #endif { - trim_argument(arguments[i]); + impl::trim_argument(arguments[i]); expanded.push_back(token_type(T_STRINGLIT, impl::as_stringlit(arguments[i], pos), pos)); } @@ -1226,8 +930,8 @@ bool adjacent_stringize = false; if (is_ellipsis) { position_type const &pos = (*cit).get_position(); - trim_argument_left(arguments[i]); - trim_argument_right(arguments.back()); + impl::trim_argument_left(arguments[i]); + impl::trim_argument_right(arguments.back()); BOOST_ASSERT(boost::wave::need_variadics(ctx.get_language())); impl::replace_ellipsis(arguments, i, expanded, pos); } @@ -1236,7 +940,7 @@ bool adjacent_stringize = false; { ContainerT &arg = arguments[i]; - trim_argument(arg); + impl::trim_argument(arg); std::copy(arg.begin(), arg.end(), std::inserter(expanded, expanded.end())); } @@ -1259,15 +963,22 @@ bool adjacent_stringize = false; concat_tokensequence(expanded); } +/////////////////////////////////////////////////////////////////////////////// +// +// rescan_replacement_list +// +// As the name implies, this function is used to rescan the replacement list +// after the first macro substitution phase. +// +/////////////////////////////////////////////////////////////////////////////// template -template +template inline void macromap::rescan_replacement_list(token_type const &curr_token, macro_definition_type ¯o_def, ContainerT &replacement_list, - ContainerT &expanded, bool expand_undefined, bool *seen_qualified_name) + ContainerT &expanded, bool expand_operator_defined, + IteratorT &nfirst, IteratorT const &nlast) { - using namespace boost::wave; - if (!replacement_list.empty()) { #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 // remove the placemarkers @@ -1276,6 +987,7 @@ macromap::rescan_replacement_list(token_type const &curr_token, typename ContainerT::iterator it = replacement_list.begin(); while (it != end) { + using namespace boost::wave; if (T_PLACEMARKER == token_id(*it)) { typename ContainerT::iterator placemarker = it; @@ -1293,45 +1005,22 @@ macromap::rescan_replacement_list(token_type const &curr_token, // expansion isn't available as an expandable macro on_exit::reset on_exit(macro_def.is_available_for_replacement, false); - expand_whole_tokensequence(expanded, replacement_list.begin(), - replacement_list.end(), expand_undefined, seen_qualified_name); - +// expand_replacementlist_tokensequence(expanded, replacement_list, +// nfirst, nlast, expand_operator_defined); + expand_whole_tokensequence(expanded, replacement_list.begin(), + replacement_list.end(), expand_operator_defined); + // trim replacement list, leave placeholder tokens untouched - trim_replacement_list(expanded); + impl::trim_replacement_list(expanded); } if (expanded.empty()) { // the resulting replacement list should contain at least a placeholder // token - BOOST_ASSERT(expanded.empty()); expanded.push_back(token_type(T_PLACEHOLDER, "_", curr_token.get_position())); } } -namespace impl { - - // The following predicate is used in conjunction with the remove_copy_if - // algorithm to allow the detection of an eventually copied operator ##. - // No removal is performed in any case. - class find_concat_operator - { - public: - find_concat_operator(bool &found_) : found_concat(found_) {} - - template - bool operator()(TokenT const &tok) - { - using namespace cpplexer; - if (T_POUND_POUND == BASE_TOKEN(token_id(tok))) - found_concat = true; - return false; - } - - private: - bool &found_concat; - }; -} - /////////////////////////////////////////////////////////////////////////////// // // expand_macro(): expands a defined macro @@ -1347,8 +1036,8 @@ inline bool macromap::expand_macro(ContainerT &expanded, token_type const &curr_token, typename defined_macros_type::iterator it, IteratorT &first, IteratorT const &last, - bool expand_undefined, defined_macros_type *scope, - ContainerT *queue_symbol, bool *seen_qualified_name) + bool expand_operator_defined, defined_macros_type *scope, + ContainerT *queue_symbol) { using namespace boost::wave; @@ -1401,7 +1090,7 @@ ContainerT replacement_list; if (T_LEFTPAREN == impl::next_token::peek(first, last)) { // called as a function-like macro - skip_to_token(first, last, T_LEFTPAREN); + impl::skip_to_token(first, last, T_LEFTPAREN); if (macro_def.is_functionlike) { // defined as a function-like macro @@ -1440,7 +1129,7 @@ ContainerT replacement_list; macro_def.macrodefinition, curr_token, arguments); // expand the replacement list of this macro - expand_replacement_list(macro_def, arguments, expand_undefined, + expand_replacement_list(macro_def, arguments, expand_operator_defined, replacement_list); } else { @@ -1502,13 +1191,20 @@ ContainerT expanded_list; ctx.get_trace_policy().expanded_macro(replacement_list); rescan_replacement_list(curr_token, macro_def, replacement_list, - expanded_list, expand_undefined, seen_qualified_name); + expanded_list, expand_operator_defined, first, last); ctx.get_trace_policy().rescanned_macro(expanded_list); expanded.splice(expanded.end(), expanded_list); return true; // rescan is required } +/////////////////////////////////////////////////////////////////////////////// +// +// If the token under inspection points to a certain predefined macro it will +// be expanded, otherwise false is returned. +// (only __FILE__, __LINE__ and __INCLUDE_LEVEL__ macros are expaned here) +// +/////////////////////////////////////////////////////////////////////////////// template template inline bool @@ -1613,13 +1309,18 @@ macromap::resolve_operator_pragma(IteratorT &first, // isolate the parameter of the operator _Pragma token_type pragma_token = *first; - skip_to_token(first, last, T_LEFTPAREN); + if (!impl::skip_to_token(first, last, T_LEFTPAREN)) { + // misformed operator _Pragma + BOOST_WAVE_THROW(preprocess_exception, ill_formed_expression, + "operator _Pragma()", pragma_token.get_position()); + } + std::vector arguments; typename std::vector::size_type count_args = collect_arguments (pragma_token, arguments, first, last, 1); // verify the parameter count - if (0 == pragma_token.get_position().get_file().size()) + if (pragma_token.get_position().get_file().empty()) pragma_token.set_position(act_token.get_position()); if (1 > count_args || 1 > arguments.size()) { @@ -1635,9 +1336,8 @@ macromap::resolve_operator_pragma(IteratorT &first, // preprocess the pragma token body ContainerT expanded; - bool seen_qualified_name = false; expand_whole_tokensequence(expanded, arguments[0].begin(), - arguments[0].end(), false, &seen_qualified_name); + arguments[0].end(), false); // unescape the parameter of the operator _Pragma typedef typename token_type::string_type string_type; @@ -1701,14 +1401,21 @@ macromap::resolve_operator_pragma(IteratorT &first, return false; } -// Test if the result of a concat operator is well formed. +/////////////////////////////////////////////////////////////////////////////// +// +// Test, whether the result of a concat operator is well formed or not. +// +// This is done by re-scanning (re-tokenising) the resulting token sequence, +// which should give back exactly one token. +// +/////////////////////////////////////////////////////////////////////////////// template template inline bool -macromap::is_invalid_concat(string_type new_value, +macromap::is_valid_concat(string_type new_value, position_type const &pos, ContainerT &rescanned) { -// retokenize the newly generated string +// retokenise the newly generated string typedef typename ContextT::lexer_type lexer_type; std::string value_to_test(new_value.c_str()); @@ -1720,15 +1427,21 @@ macromap::is_invalid_concat(string_type new_value, #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 if (boost::wave::need_variadics(ctx.get_language())) - return false; // in variadics mode token pasting is well defined + return true; // in variadics mode token pasting is well defined #endif // test if the newly generated token sequence contains more than 1 token // the second one is the T_EOF token BOOST_ASSERT(T_EOF == token_id(rescanned.back())); - return rescanned.size() != 2; + return 2 == rescanned.size(); } +/////////////////////////////////////////////////////////////////////////////// +// +// Handle all occurences of the concatenation operator '##' inside the given +// token sequence. +// +/////////////////////////////////////////////////////////////////////////////// template template inline void @@ -1797,6 +1510,8 @@ macromap::concat_tokensequence(ContainerT &expanded) // eventually to combine the current token with the next tokens // if these are of type T_IDENTIFIER or T_INTLIT following without any // interventing whitespace. + // Please note though, that this hack unfortunately doesn't fix all + // problems related with pp-numbers as specified by the Standard. iterator_type save = next; if (IS_CATEGORY(*prev, IdentifierTokenType) && @@ -1812,7 +1527,7 @@ macromap::concat_tokensequence(ContainerT &expanded) } // analyze the validity of the concatenation result - if (is_invalid_concat(concat_result, (*prev).get_position(), + if (!is_valid_concat(concat_result, (*prev).get_position(), rescanned) && !IS_CATEGORY(*prev, WhiteSpaceTokenType) && !IS_CATEGORY(*next, WhiteSpaceTokenType)) @@ -1870,243 +1585,11 @@ macromap::concat_tokensequence(ContainerT &expanded) } } -namespace { - - /////////////////////////////////////////////////////////////////////////// - // - // get the full name of a given macro name or scope name (concatenate the - // string representations of the single tokens). - // - template - inline std::string - get_full_name(IteratorT const &begin, IteratorT const &end) - { - std::string full_name; - for (IteratorT err_it = begin; err_it != end; ++err_it) - full_name += (*err_it).get_value().c_str(); - - return full_name; - } - -} // namespace impl - /////////////////////////////////////////////////////////////////////////////// // -// init_predefined_macros(): init the predefined macros +// predefined_macro(): predefine a single macro // /////////////////////////////////////////////////////////////////////////////// - -namespace predefined_macros { - -// list of static predefined macros - struct static_macros { - char const *name; - boost::wave::token_id token_id; - char const *value; - }; - -// C++ mode - inline static_macros const & - static_data_cpp(std::size_t i) - { - static static_macros data[] = { - { "__STDC__", T_INTLIT, "1" }, - { "__cplusplus", T_INTLIT, "199711L" }, - { 0, T_EOF, 0 } - }; - BOOST_ASSERT(i < sizeof(data)/sizeof(data[0])); - return data[i]; - } - -#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 -// C99 mode - inline static_macros const & - static_data_c99(std::size_t i) - { - static static_macros data[] = { - { "__STDC__", T_INTLIT, "1" }, - { "__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 - -// list of dynamic predefined macros - typedef char const * (* get_dynamic_value)(bool); - -// __DATE__ - inline - char const *get_date(bool reset) - { - static std::string datestr; - static const char *const monthnames[] = { - "Jan", "Feb", "Mar", "Apr", "May", "Jun", - "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" - }; - - if (reset) { - datestr.erase(); - } - else { - // for some systems sprintf, time_t etc. is in namespace std - using namespace std; - - time_t tt = time(0); - struct tm *tb = 0; - - if (tt != (time_t)-1) { - char buffer[sizeof("\"Oct 11 1347\"")+1]; - - tb = localtime (&tt); - sprintf (buffer, "\"%s %2d %4d\"", - monthnames[tb->tm_mon], tb->tm_mday, tb->tm_year + 1900); - datestr = buffer; - } - else { - datestr = "\"??? ?? ????\""; - } - } - return datestr.c_str(); - } - -// __TIME__ - inline - char const *get_time(bool reset) - { - static std::string timestr; - - if (reset) { - timestr.erase(); - } - else { - // for some systems sprintf, time_t etc. is in namespace std - using namespace std; - - time_t tt = time(0); - struct tm *tb = 0; - - if (tt != (time_t)-1) { - char buffer[sizeof("\"12:34:56\"")+1]; - - tb = localtime (&tt); - sprintf (buffer, "\"%02d:%02d:%02d\"", tb->tm_hour, - tb->tm_min, tb->tm_sec); - timestr = buffer; - } - else { - timestr = "\"??:??:??\""; - } - } - return timestr.c_str(); - } - -// __SPIRIT_PP__/__WAVE__ - inline - char const *get_version(bool /*reset*/) - { - static std::string versionstr; - char buffer[sizeof("0x0000")+1]; - - using namespace std; // for some systems sprintf is in namespace std - sprintf(buffer, "0x%02d%1d%1d", BOOST_WAVE_VERSION_MAJOR, - BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR); - versionstr = buffer; - return versionstr.c_str(); - } - -// __SPIRIT_PP_VERSION__/__WAVE_VERSION__ - boost::wave::util::time_conversion_helper const - compilation_time(__DATE__ " " __TIME__); - - inline - char const *get_fullversion(bool /*reset*/) - { - static std::string versionstr; - char buffer[sizeof("0x00000000")+1]; - - // for some systems sprintf, time_t etc. is in namespace std - using namespace std; - - // calculate the number of days since Dec 13 2001 - // (the day the Wave project was started) - tm first_day; - - using namespace std; // for some systems memset is in namespace std - memset (&first_day, 0, sizeof(tm)); - first_day.tm_mon = 11; // Dec - first_day.tm_mday = 13; // 13 - first_day.tm_year = 101; // 2001 - - long seconds = long(difftime(compilation_time.get_time(), - mktime(&first_day))); - - sprintf(buffer, "0x%02d%1d%1d%04ld", BOOST_WAVE_VERSION_MAJOR, - BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR, - seconds/(3600*24)); - versionstr = buffer; - return versionstr.c_str(); - } - -// __SPIRIT_PP_VERSION_STR__/__WAVE_VERSION_STR__ - inline - char const *get_versionstr(bool /*reset*/) - { - static std::string versionstr; - char buffer[sizeof("\"00.00.00.0000\"")+1]; - - // for some systems sprintf, time_t etc. is in namespace std - using namespace std; - - // calculate the number of days since Dec 13 2001 - // (the day the Wave project was started) - tm first_day; - - using namespace std; // for some systems memset is in namespace std - memset (&first_day, 0, sizeof(tm)); - first_day.tm_mon = 11; // Dec - first_day.tm_mday = 13; // 13 - first_day.tm_year = 101; // 2001 - - long seconds = long(difftime(compilation_time.get_time(), - mktime(&first_day))); - - sprintf(buffer, "\"%d.%d.%d.%ld\"", BOOST_WAVE_VERSION_MAJOR, - BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR, - seconds/(3600*24)); - versionstr = buffer; - return versionstr.c_str(); - } - - struct dynamic_macros { - char const *name; - boost::wave::token_id token_id; - get_dynamic_value generator; - }; - - inline dynamic_macros const & - dynamic_data(std::size_t i) - { - static dynamic_macros data[] = { - { "__DATE__", T_STRINGLIT, get_date }, - { "__TIME__", T_STRINGLIT, get_time }, - { "__SPIRIT_PP__", T_INTLIT, get_version }, - { "__SPIRIT_PP_VERSION__", T_INTLIT, get_fullversion }, - { "__SPIRIT_PP_VERSION_STR__", T_STRINGLIT, get_versionstr }, - { "__WAVE__", T_INTLIT, get_version }, - { "__WAVE_VERSION__", T_INTLIT, get_fullversion }, - { "__WAVE_VERSION_STR__", T_STRINGLIT, get_versionstr }, - { 0, T_EOF, 0 } - }; - BOOST_ASSERT(i < sizeof(data)/sizeof(data[0])); - return data[i]; - } - -} // namespace predefined_macros - template inline void macromap::predefine_macro(defined_macros_type *scope, @@ -2120,6 +1603,11 @@ std::vector param; false, param, macrodefinition, true, scope); } +/////////////////////////////////////////////////////////////////////////////// +// +// init_predefined_macros(): init the predefined macros +// +/////////////////////////////////////////////////////////////////////////////// template inline void macromap::init_predefined_macros(defined_macros_type *scope, @@ -2169,6 +1657,11 @@ position_type pos; } } +/////////////////////////////////////////////////////////////////////////////// +// +// reset_macro_map(): initialise the internal macro symbol namespace +// +/////////////////////////////////////////////////////////////////////////////// template inline void macromap::reset_macromap() diff --git a/include/boost/wave/util/cpp_macromap_predef.hpp b/include/boost/wave/util/cpp_macromap_predef.hpp new file mode 100644 index 0000000..38cfe31 --- /dev/null +++ b/include/boost/wave/util/cpp_macromap_predef.hpp @@ -0,0 +1,249 @@ +/*============================================================================= + Wave: A Standard compliant C++ preprocessor library + + Definition of the predefined macros + + http://spirit.sourceforge.net/ + + Copyright (c) 2001-2005 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) +=============================================================================*/ + +#if !defined(CPP_MACROMAP_PREDEF_HPP_HK041119) +#define CPP_MACROMAP_PREDEF_HPP_HK041119 + +#include + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// This file contains the definition of several token sequence analyse +// and transformation utility functions needed during macro handling. +// +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { +namespace wave { +namespace util { + +namespace predefined_macros { + +// list of static predefined macros + struct static_macros { + char const *name; + boost::wave::token_id token_id; + char const *value; + }; + +// C++ mode + inline static_macros const & + static_data_cpp(std::size_t i) + { + static static_macros data[] = { + { "__STDC__", T_INTLIT, "1" }, + { "__cplusplus", T_INTLIT, "199711L" }, + { 0, T_EOF, 0 } + }; + BOOST_ASSERT(i < sizeof(data)/sizeof(data[0])); + return data[i]; + } + +#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 +// C99 mode + inline static_macros const & + static_data_c99(std::size_t i) + { + static static_macros data[] = { + { "__STDC__", T_INTLIT, "1" }, + { "__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 + +// list of dynamic predefined macros + typedef char const * (* get_dynamic_value)(bool); + +// __DATE__ + inline + char const *get_date(bool reset) + { + static std::string datestr; + static const char *const monthnames[] = { + "Jan", "Feb", "Mar", "Apr", "May", "Jun", + "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" + }; + + if (reset) { + datestr.erase(); + } + else { + // for some systems sprintf, time_t etc. is in namespace std + using namespace std; + + time_t tt = time(0); + struct tm *tb = 0; + + if (tt != (time_t)-1) { + char buffer[sizeof("\"Oct 11 1347\"")+1]; + + tb = localtime (&tt); + sprintf (buffer, "\"%s %2d %4d\"", + monthnames[tb->tm_mon], tb->tm_mday, tb->tm_year + 1900); + datestr = buffer; + } + else { + datestr = "\"??? ?? ????\""; + } + } + return datestr.c_str(); + } + +// __TIME__ + inline + char const *get_time(bool reset) + { + static std::string timestr; + + if (reset) { + timestr.erase(); + } + else { + // for some systems sprintf, time_t etc. is in namespace std + using namespace std; + + time_t tt = time(0); + struct tm *tb = 0; + + if (tt != (time_t)-1) { + char buffer[sizeof("\"12:34:56\"")+1]; + + tb = localtime (&tt); + sprintf (buffer, "\"%02d:%02d:%02d\"", tb->tm_hour, + tb->tm_min, tb->tm_sec); + timestr = buffer; + } + else { + timestr = "\"??:??:??\""; + } + } + return timestr.c_str(); + } + +// __SPIRIT_PP__/__WAVE__ + inline + char const *get_version(bool /*reset*/) + { + static std::string versionstr; + char buffer[sizeof("0x0000")+1]; + + using namespace std; // for some systems sprintf is in namespace std + sprintf(buffer, "0x%02d%1d%1d", BOOST_WAVE_VERSION_MAJOR, + BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR); + versionstr = buffer; + return versionstr.c_str(); + } + +// __SPIRIT_PP_VERSION__/__WAVE_VERSION__ + boost::wave::util::time_conversion_helper const + compilation_time(__DATE__ " " __TIME__); + + inline + char const *get_fullversion(bool /*reset*/) + { + static std::string versionstr; + char buffer[sizeof("0x00000000")+1]; + + // for some systems sprintf, time_t etc. is in namespace std + using namespace std; + + // calculate the number of days since Dec 13 2001 + // (the day the Wave project was started) + tm first_day; + + using namespace std; // for some systems memset is in namespace std + memset (&first_day, 0, sizeof(tm)); + first_day.tm_mon = 11; // Dec + first_day.tm_mday = 13; // 13 + first_day.tm_year = 101; // 2001 + + long seconds = long(difftime(compilation_time.get_time(), + mktime(&first_day))); + + sprintf(buffer, "0x%02d%1d%1d%04ld", BOOST_WAVE_VERSION_MAJOR, + BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR, + seconds/(3600*24)); + versionstr = buffer; + return versionstr.c_str(); + } + +// __SPIRIT_PP_VERSION_STR__/__WAVE_VERSION_STR__ + inline + char const *get_versionstr(bool /*reset*/) + { + static std::string versionstr; + char buffer[sizeof("\"00.00.00.0000\"")+1]; + + // for some systems sprintf, time_t etc. is in namespace std + using namespace std; + + // calculate the number of days since Dec 13 2001 + // (the day the Wave project was started) + tm first_day; + + using namespace std; // for some systems memset is in namespace std + memset (&first_day, 0, sizeof(tm)); + first_day.tm_mon = 11; // Dec + first_day.tm_mday = 13; // 13 + first_day.tm_year = 101; // 2001 + + long seconds = long(difftime(compilation_time.get_time(), + mktime(&first_day))); + + sprintf(buffer, "\"%d.%d.%d.%ld\"", BOOST_WAVE_VERSION_MAJOR, + BOOST_WAVE_VERSION_MINOR, BOOST_WAVE_VERSION_SUBMINOR, + seconds/(3600*24)); + versionstr = buffer; + return versionstr.c_str(); + } + + struct dynamic_macros { + char const *name; + boost::wave::token_id token_id; + get_dynamic_value generator; + }; + + inline dynamic_macros const & + dynamic_data(std::size_t i) + { + static dynamic_macros data[] = { + { "__DATE__", T_STRINGLIT, get_date }, + { "__TIME__", T_STRINGLIT, get_time }, + { "__SPIRIT_PP__", T_INTLIT, get_version }, + { "__SPIRIT_PP_VERSION__", T_INTLIT, get_fullversion }, + { "__SPIRIT_PP_VERSION_STR__", T_STRINGLIT, get_versionstr }, + { "__WAVE__", T_INTLIT, get_version }, + { "__WAVE_VERSION__", T_INTLIT, get_fullversion }, + { "__WAVE_VERSION_STR__", T_STRINGLIT, get_versionstr }, + { 0, T_EOF, 0 } + }; + BOOST_ASSERT(i < sizeof(data)/sizeof(data[0])); + return data[i]; + } + +} // namespace predefined_macros + +/////////////////////////////////////////////////////////////////////////////// +} // namespace util +} // namespace wave +} // namespace boost + +#endif // !defined(CPP_MACROMAP_PREDEF_HPP_HK041119) diff --git a/include/boost/wave/util/cpp_macromap_utils.hpp b/include/boost/wave/util/cpp_macromap_utils.hpp new file mode 100644 index 0000000..5a452af --- /dev/null +++ b/include/boost/wave/util/cpp_macromap_utils.hpp @@ -0,0 +1,497 @@ +/*============================================================================= + Wave: A Standard compliant C++ preprocessor library + + Token sequence analysis and transformation helper functions + + http://spirit.sourceforge.net/ + + Copyright (c) 2001-2005 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) +=============================================================================*/ + +#if !defined(CPP_MACROMAP_UTIL_HPP_HK041119) +#define CPP_MACROMAP_UTIL_HPP_HK041119 + +#include + +#include +#include + +/////////////////////////////////////////////////////////////////////////////// +// +// This file contains the definition of several token sequence analyse +// and transformation utility functions needed during macro handling. +// +/////////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +namespace boost { +namespace wave { +namespace util { + +/////////////////////////////////////////////////////////////////////////////// +namespace on_exit { + + /////////////////////////////////////////////////////////////////////////// + // + // On destruction pop the first element of the list given as the argument + // + /////////////////////////////////////////////////////////////////////////// + template + class pop_front { + public: + pop_front(ContainerT &list_) : list(list_) {} + ~pop_front() { list.pop_front(); } + + private: + ContainerT &list; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // Append a given list to the list given as argument + // On destruction pop the first element of the list given as argument + // + /////////////////////////////////////////////////////////////////////////// + template + class splice_pop_front { + public: + splice_pop_front(ContainerT &list_, ContainerT &queue) + : list(list_) + { + list.splice(list.end(), queue); + } + ~splice_pop_front() { list.pop_front(); } + + private: + ContainerT &list; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // On destruction reset a referenced value to its initial state + // + /////////////////////////////////////////////////////////////////////////// + template + class reset { + public: + reset(TypeT &target_value_, TypeT new_value) + : target_value(target_value_), old_value(target_value_) + { + target_value_ = new_value; + } + ~reset() { target_value = old_value; } + + private: + TypeT &target_value; + TypeT old_value; + }; + + /////////////////////////////////////////////////////////////////////////// + // + // On destruction assign the given iterator back + // + /////////////////////////////////////////////////////////////////////////// + template + class assign { + public: + assign(IteratorT &it_, UnputIteratorT const &uit_) + : it(it_), uit(uit_) {} + ~assign() { it = uit.base(); } + + private: + IteratorT ⁢ + UnputIteratorT const &uit; + }; + + template + class assign { + public: + assign(IteratorT &it_, IteratorT const &uit_) + : it(it_), uit(uit_) {} + ~assign() { it = uit; } + + private: + IteratorT ⁢ + IteratorT const &uit; + }; + +/////////////////////////////////////////////////////////////////////////////// +} // namespace on_exit + +/////////////////////////////////////////////////////////////////////////////// +namespace impl { + +/////////////////////////////////////////////////////////////////////////////// +// +// Test, whether a given identifier resolves to a predefined name +// +/////////////////////////////////////////////////////////////////////////////// +template +inline bool +is_special_macroname (StringT const &name) +{ + if (name.size() < 7) + return false; + + if ("defined" == name) + return true; + + if ('_' == name[0] && '_' == name[1]) { + StringT str = name.substr(2); + + if (str == "cplusplus" || str == "STDC__" || + str == "TIME__" || str == "DATE__" || + str == "LINE__" || str == "FILE__" || + str == "INCLUDE_LEVEL__") + { + return true; + } + } + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Test, whether two tokens are to be considered equal (different sequences +// of whitespace are considered to be equal) +// +/////////////////////////////////////////////////////////////////////////////// +template +inline bool +token_equals(TokenT const &left, TokenT const &right) +{ + using namespace boost::wave; + +#if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0 + if (T_PARAMETERBASE == token_id(left) || + T_EXTPARAMETERBASE == token_id(left)) +#else + if (T_PARAMETERBASE == token_id(left)) +#endif + { + // if the existing token is of type T_PARAMETERBASE, then the right token + // must be of type T_IDENTIFIER or a keyword + return (T_IDENTIFIER == token_id(right) || + IS_CATEGORY(right, KeywordTokenType)) && + left.get_value() == right.get_value(); + } + + // if the left token has whitespace, the value is irrelevant + return token_id(left) == token_id(right) && ( + IS_CATEGORY(left, WhiteSpaceTokenType) || + left.get_value() == right.get_value() + ); +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Tests, whether two macro definitions are equal +// +/////////////////////////////////////////////////////////////////////////////// +template +inline bool +definition_equals(ContainerT const &definition, + ContainerT const &new_definition) +{ + typedef typename ContainerT::const_iterator const_iterator_type; + +const_iterator_type first1 = definition.begin(); +const_iterator_type last1 = definition.end(); +const_iterator_type first2 = new_definition.begin(); +const_iterator_type last2 = new_definition.end(); + + while (first1 != last1 && token_equals(*first1, *first2)) { + // skip whitespace, if both sequences have a whitespace next + token_id id1 = next_token::peek(first1, last1, false); + token_id id2 = next_token::peek(first2, last2, false); + + if (IS_CATEGORY(id1, WhiteSpaceTokenType) && + IS_CATEGORY(id2, WhiteSpaceTokenType)) + { + // all consecutive whitespace tokens count as one whitespace + // adjust first1 and first2 accordingly + skip_whitespace(first1, last1); + skip_whitespace(first2, last2); + } + else if (!IS_CATEGORY(id1, WhiteSpaceTokenType) && + !IS_CATEGORY(id2, WhiteSpaceTokenType)) + { + ++first1; + ++first2; + } + else { + // the sequences differ + break; + } + } + return (first1 == last1 && first2 == last2) ? true : false; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Tests, whether two given sets of macro parameters are equal +// +/////////////////////////////////////////////////////////////////////////////// +template +inline bool +parameters_equal(ContainerT const ¶meters, ContainerT const &new_parameters) +{ + if (parameters.size() != new_parameters.size()) + return false; // different parameter count + + typedef typename ContainerT::const_iterator const_iterator_type; + +const_iterator_type first1 = parameters.begin(); +const_iterator_type last1 = parameters.end(); +const_iterator_type first2 = new_parameters.begin(); + + while (first1 != last1) { + // parameters are different, if the corresponding tokens are different + using namespace boost::wave; + if (token_id(*first1) != token_id(*first2) || + (*first1).get_value() != (*first2).get_value()) + { + break; + } + ++first1; + ++first2; + } + return (first1 == last1) ? true : false; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Strip leading and trailing whitespace from the given token sequence +// +/////////////////////////////////////////////////////////////////////////////// +template +inline void +trim_replacement_list (ContainerT &replacement_list) +{ + using namespace boost::wave; + +// strip leading whitespace + if (replacement_list.size() > 0) { + typename ContainerT::iterator end = replacement_list.end(); + typename ContainerT::iterator it = replacement_list.begin(); + + while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) { + if (T_PLACEHOLDER != token_id(*it)) { + typename ContainerT::iterator next = it; + ++next; + replacement_list.erase(it); + it = next; + } + else { + ++it; + } + } + } + +// strip trailing whitespace + if (replacement_list.size() > 0) { + typename ContainerT::reverse_iterator rend = replacement_list.rend(); + typename ContainerT::reverse_iterator rit = replacement_list.rbegin(); + + while (rit != rend && IS_CATEGORY(*rit, WhiteSpaceTokenType)) + ++rit; + + typename ContainerT::iterator end = replacement_list.end(); + typename ContainerT::iterator it = rit.base(); + + while (it != end && IS_CATEGORY(*it, WhiteSpaceTokenType)) { + if (T_PLACEHOLDER != token_id(*it)) { + typename ContainerT::iterator next = it; + ++next; + replacement_list.erase(it); + it = next; + } + else { + ++it; + } + } + } +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Remove all placeholder tokens from the given token sequence +// +/////////////////////////////////////////////////////////////////////////////// +template +inline void +remove_placeholders (ContainerT &replacement_list) +{ + using namespace boost::wave; + +// strip leading whitespace + if (replacement_list.size() > 0) { + typename ContainerT::iterator end = replacement_list.end(); + typename ContainerT::iterator it = replacement_list.begin(); + + while (it != end) { + if (T_PLACEHOLDER == token_id(*it)) { + typename ContainerT::iterator next = it; + ++next; + replacement_list.erase(it); + it = next; + } + else { + ++it; + } + } + + // remove all 'new' leading and trailing whitespace + trim_replacement_list(replacement_list); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Remove all whitespace tokens on the left side of the given token sequence +// +/////////////////////////////////////////////////////////////////////////////// +template +inline void +trim_argument_left (ContainerT &argument) +{ + using namespace boost::wave; + +// strip leading whitespace (should be only one token) + if (argument.size() > 0 && + IS_CATEGORY(argument.front(), WhiteSpaceTokenType)) + { + argument.pop_front(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Remove all whitespace tokens on the right side of the given token sequence +// +/////////////////////////////////////////////////////////////////////////////// +template +inline void +trim_argument_right (ContainerT &argument) +{ + using namespace boost::wave; + +// strip trailing whitespace (should be only one token) + if (argument.size() > 0 && + IS_CATEGORY(argument.back(), WhiteSpaceTokenType)) + { + argument.pop_back(); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Remove all whitespace tokens on the keft and right sides of the given token +// sequence +// +/////////////////////////////////////////////////////////////////////////////// +template +inline void +trim_argument (ContainerT &argument) +{ + trim_argument_left(argument); + trim_argument_right(argument); +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Tests, whether the given token sequence consists out of whitespace only +// +/////////////////////////////////////////////////////////////////////////////// +template +inline bool +is_whitespace_only (ContainerT const &argument) +{ + using namespace cpplexer; + + typename ContainerT::const_iterator end = argument.end(); + for (typename ContainerT::const_iterator it = argument.begin(); + it != end; ++it) + { + if (!IS_CATEGORY(*it, WhiteSpaceTokenType)) + return false; + } + return true; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Skip forward to a given token +// +/////////////////////////////////////////////////////////////////////////////// +template +inline bool +skip_to_token(IteratorT &it, IteratorT const &end, token_id id) +{ + using namespace boost::wave; + if (token_id(*it) == id) + return true; + if (++it == end) + return false; + + while (IS_CATEGORY(*it, WhiteSpaceTokenType) || + T_NEWLINE == token_id(*it)) + { + if (++it == end) + return false; + } + return token_id(*it) == id; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// Get the full name of a given macro name (concatenate the string +// representations of the single tokens). +// +/////////////////////////////////////////////////////////////////////////////// +template +inline std::string +get_full_name(IteratorT const &begin, IteratorT const &end) +{ + std::string full_name; + for (IteratorT err_it = begin; err_it != end; ++err_it) + full_name += (*err_it).get_value().c_str(); + + return full_name; +} + +/////////////////////////////////////////////////////////////////////////////// +// +// The following predicate is used in conjunction with the remove_copy_if +// algorithm to allow the detection of an eventually copied operator ##. +// No removal is performed in any case. +// +/////////////////////////////////////////////////////////////////////////////// +class find_concat_operator { +public: + find_concat_operator(bool &found_) : found_concat(found_) {} + + template + bool operator()(TokenT const &tok) + { + using namespace boost::wave; + if (T_POUND_POUND == BASE_TOKEN(token_id(tok))) + found_concat = true; + return false; + } + +private: + bool &found_concat; +}; + +/////////////////////////////////////////////////////////////////////////////// +} // namespace impl + +/////////////////////////////////////////////////////////////////////////////// +} // namespace util +} // namespace wave +} // namespace boost + +#endif // !defined(CPP_MACROMAP_UTIL_HPP_HK041119) diff --git a/include/boost/wave/util/eat_whitespace.hpp b/include/boost/wave/util/eat_whitespace.hpp index 412d7a2..6407ef3 100644 --- a/include/boost/wave/util/eat_whitespace.hpp +++ b/include/boost/wave/util/eat_whitespace.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ Copyright (c) 2003 Paul Mensonides - Copyright (c) 2001-2004 Hartmut Kaiser. + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/file_position.hpp b/include/boost/wave/util/file_position.hpp index d98656c..5094cb2 100644 --- a/include/boost/wave/util/file_position.hpp +++ b/include/boost/wave/util/file_position.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/functor_input.hpp b/include/boost/wave/util/functor_input.hpp index 9ea671f..3c2b85c 100644 --- a/include/boost/wave/util/functor_input.hpp +++ b/include/boost/wave/util/functor_input.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/insert_whitespace_detection.hpp b/include/boost/wave/util/insert_whitespace_detection.hpp index 00e0082..cf2a2e6 100644 --- a/include/boost/wave/util/insert_whitespace_detection.hpp +++ b/include/boost/wave/util/insert_whitespace_detection.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/interpret_pragma.hpp b/include/boost/wave/util/interpret_pragma.hpp index 64d3288..8906539 100644 --- a/include/boost/wave/util/interpret_pragma.hpp +++ b/include/boost/wave/util/interpret_pragma.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/iteration_context.hpp b/include/boost/wave/util/iteration_context.hpp index 6bb7bea..b2365e1 100644 --- a/include/boost/wave/util/iteration_context.hpp +++ b/include/boost/wave/util/iteration_context.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/macro_definition.hpp b/include/boost/wave/util/macro_definition.hpp index dece793..3736ad9 100644 --- a/include/boost/wave/util/macro_definition.hpp +++ b/include/boost/wave/util/macro_definition.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/macro_helpers.hpp b/include/boost/wave/util/macro_helpers.hpp index 43e488f..e98badf 100644 --- a/include/boost/wave/util/macro_helpers.hpp +++ b/include/boost/wave/util/macro_helpers.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/pattern_parser.hpp b/include/boost/wave/util/pattern_parser.hpp index f785536..e7c5204 100644 --- a/include/boost/wave/util/pattern_parser.hpp +++ b/include/boost/wave/util/pattern_parser.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/symbol_table.hpp b/include/boost/wave/util/symbol_table.hpp index af0880a..2830efa 100644 --- a/include/boost/wave/util/symbol_table.hpp +++ b/include/boost/wave/util/symbol_table.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/time_conversion_helper.hpp b/include/boost/wave/util/time_conversion_helper.hpp index e8ae9e3..d3f1898 100644 --- a/include/boost/wave/util/time_conversion_helper.hpp +++ b/include/boost/wave/util/time_conversion_helper.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/transform_iterator.hpp b/include/boost/wave/util/transform_iterator.hpp index b77c3c5..cbc47c0 100644 --- a/include/boost/wave/util/transform_iterator.hpp +++ b/include/boost/wave/util/transform_iterator.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/include/boost/wave/util/unput_queue_iterator.hpp b/include/boost/wave/util/unput_queue_iterator.hpp index 94e8b34..cc105f2 100644 --- a/include/boost/wave/util/unput_queue_iterator.hpp +++ b/include/boost/wave/util/unput_queue_iterator.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -13,6 +13,8 @@ #define UNPUT_QUEUE_ITERATOR_HPP_76DA23D0_4893_4AD5_ABCC_6CED7CFB89BC_INCLUDED #include + +#include #include #include @@ -71,7 +73,7 @@ public: equal(const IteratorAdaptorT1 &x, const IteratorAdaptorT2 &y) const { // two iterators are equal, if both begin() iterators of the queue objects - // are equal and the base iterators too + // are equal and the base iterators are equal as well return (x.policies().unput_queue.begin() == y.policies().unput_queue.begin() || (0 == x.policies().queuesize() && 0 == y.policies().queuesize())) && @@ -82,6 +84,7 @@ public: { return unput_queue.size(); } ContainerT &get_unput_queue() { return unput_queue; } + ContainerT const &get_unput_queue() const { return unput_queue; } private: ContainerT &unput_queue; @@ -108,19 +111,25 @@ class unput_queue_iterator IteratorT, unput_queue_policies, TokenT, TokenT const &, TokenT const * > - base_t; - typedef unput_queue_policies policies_t; + base_type; + typedef unput_queue_policies policies_type; public: - typedef ContainerT container_t; + typedef ContainerT container_type; typedef IteratorT iterator_type; unput_queue_iterator(IteratorT const &it, ContainerT &queue) - : base_t(it, policies_t(queue)) + : base_type(it, policies_type(queue)) {} - ContainerT &get_unput_queue() { return policies().get_unput_queue(); } - IteratorT &get_base_iterator() { return base(); } + ContainerT &get_unput_queue() + { return policies().get_unput_queue(); } + ContainerT const &get_unput_queue() const + { return policies().get_unput_queue(); } + IteratorT &get_base_iterator() + { return base(); } + IteratorT const &get_base_iterator() const + { return base(); } }; #else // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200 @@ -132,7 +141,7 @@ public: // The unput_queue_iterator templates encapsulates an unput_queue together // with the direct input to be read after the unput queue is emptied // -// This version is for the new iterator_adaptors (should be released with +// This version is for the new iterator_adaptors (was released with // Boost V1.31.0) // /////////////////////////////////////////////////////////////////////////////// @@ -145,46 +154,50 @@ class unput_queue_iterator typedef boost::iterator_adaptor< unput_queue_iterator, IteratorT, TokenT const, std::forward_iterator_tag> - base_t; + base_type; public: - typedef ContainerT container_t; + typedef ContainerT container_type; typedef IteratorT iterator_type; - + unput_queue_iterator(IteratorT const &it, ContainerT &queue) - : base_t(it), unput_queue(queue) + : base_type(it), unput_queue(queue) {} - ContainerT &get_unput_queue() { return unput_queue; } - ContainerT const &get_unput_queue() const { return unput_queue; } - IteratorT &get_base_iterator() { return base_t::base_reference(); } - IteratorT const &get_base_iterator() const { return base_t::base_reference(); } + ContainerT &get_unput_queue() + { return unput_queue; } + ContainerT const &get_unput_queue() const + { return unput_queue; } + IteratorT &get_base_iterator() + { return base_type::base_reference(); } + IteratorT const &get_base_iterator() const + { return base_type::base_reference(); } unput_queue_iterator &operator= (unput_queue_iterator const &rhs) { if (this != &rhs) { unput_queue = rhs.unput_queue; - base_t::operator=(rhs); + base_type::operator=(rhs); } return *this; } - typename base_t::reference dereference() const + typename base_type::reference dereference() const { - if (unput_queue.size() > 0) + if (!unput_queue.empty()) return unput_queue.front(); - return *base_t::base_reference(); + return *base_type::base_reference(); } void increment() { - if (unput_queue.size() > 0) { + if (!unput_queue.empty()) { // there exist pending tokens in the unput queue unput_queue.pop_front(); } else { // the unput_queue is empty, so advance the base iterator - ++base_t::base_reference(); + ++base_type::base_reference(); } } @@ -196,12 +209,12 @@ public: boost::iterator_adaptor const &x) const { - // two iterators are equal, if both begin() iterators of the queue objects - // are equal and the base iterators too + // two iterators are equal, if both begin() iterators of the queue + // objects are equal and the base iterators are equal as well OtherDerivedT const &rhs = static_cast(x); return - (unput_queue.begin() == rhs.get_unput_queue().begin() || - (0 == unput_queue.size() && 0 == rhs.get_unput_queue().size())) && + (get_unput_queue().begin() == rhs.get_unput_queue().begin() || + get_unput_queue().empty() && rhs.get_unput_queue().empty()) && get_base_iterator() == rhs.get_base_iterator(); } @@ -215,26 +228,57 @@ namespace impl { /////////////////////////////////////////////////////////////////////////// template - struct gen_unput_queue_iterator { - - typedef unput_queue_iterator return_t; + struct gen_unput_queue_iterator + { + typedef ContainerT container_type; + typedef IteratorT iterator_type; + typedef unput_queue_iterator + return_type; + + static container_type last; - static return_t - generate(ContainerT &queue, IteratorT const &it) + static return_type + generate(iterator_type const &it) { - return return_t(it, queue); + return return_type(it, last); + } + + static return_type + generate(ContainerT &queue, iterator_type const &it) + { + return return_type(it, queue); } }; + template + typename gen_unput_queue_iterator:: + container_type + gen_unput_queue_iterator::last = + typename gen_unput_queue_iterator:: + container_type(); + + /////////////////////////////////////////////////////////////////////////// template struct gen_unput_queue_iterator< unput_queue_iterator, TokenT, ContainerT> { - typedef unput_queue_iterator return_t; + typedef ContainerT container_type; + typedef unput_queue_iterator + iterator_type; + typedef unput_queue_iterator + return_type; - static return_t - generate(ContainerT &queue, return_t const &it) + static container_type last; + + static return_type + generate(iterator_type &it) + { + return return_t(it.base(), last); + } + + static return_type + generate(ContainerT &queue, iterator_type &it) { return return_t(it.base(), queue); } @@ -258,7 +302,8 @@ namespace impl { struct assign_iterator< unput_queue_iterator > { - typedef unput_queue_iterator iterator_type; + typedef unput_queue_iterator + iterator_type; static void do_ (iterator_type &dest, iterator_type const &src) @@ -311,12 +356,12 @@ namespace impl { { using namespace boost::wave; - typename iterator_type::container_t &queue = it.get_unput_queue(); + typename iterator_type::container_type &queue = it.get_unput_queue(); // first try to find it in the unput_queue if (0 != queue.size()) { - typename iterator_type::container_t::iterator cit = queue.begin(); - typename iterator_type::container_t::iterator cend = queue.end(); + typename iterator_type::container_type::iterator cit = queue.begin(); + typename iterator_type::container_type::iterator cend = queue.end(); if (skip_whitespace) { for (++cit; cit != cend; ++cit) { diff --git a/include/boost/wave/wave_config.hpp b/include/boost/wave/wave_config.hpp index 6878c22..47c4225 100644 --- a/include/boost/wave/wave_config.hpp +++ b/include/boost/wave/wave_config.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -256,6 +256,12 @@ !defined(BOOST_WAVE_NO_LIB) #define BOOST_LIB_NAME boost_wave + +// tell the auto-link code to select a dll when required: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_WAVE_DYN_LINK) +#define BOOST_DYN_LINK +#endif + #include #endif // auto-linking disabled diff --git a/include/boost/wave/wave_version.hpp b/include/boost/wave/wave_version.hpp index 006f128..3e349cd 100644 --- a/include/boost/wave/wave_version.hpp +++ b/include/boost/wave/wave_version.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -16,11 +16,11 @@ // BOOST_WAVE_VERSION & 0x0000FF is the sub-minor version // BOOST_WAVE_VERSION & 0x00FF00 is the minor version // BOOST_WAVE_VERSION & 0xFF0000 is the major version -#define BOOST_WAVE_VERSION 0x010109 +#define BOOST_WAVE_VERSION 0x010111 // The following defines contain the same information as above #define BOOST_WAVE_VERSION_MAJOR 1 #define BOOST_WAVE_VERSION_MINOR 1 -#define BOOST_WAVE_VERSION_SUBMINOR 9 +#define BOOST_WAVE_VERSION_SUBMINOR 11 #endif // !defined(WAVE_VERSION_H_9D79ABDB_AC54_4C0A_89B1_F70A2DCFE21E_INCLUDED) diff --git a/index.html b/index.html index 44f9f17..49e08e7 100644 --- a/index.html +++ b/index.html @@ -95,7 +95,7 @@

- diff --git a/samples/cpp_tokens/build/Jamfile b/samples/cpp_tokens/build/Jamfile index d1c5c5d..de8d72c 100644 --- a/samples/cpp_tokens/build/Jamfile +++ b/samples/cpp_tokens/build/Jamfile @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/samples/cpp_tokens/build/Jamfile.v2 b/samples/cpp_tokens/build/Jamfile.v2 index da1bdcc..58c4974 100644 --- a/samples/cpp_tokens/build/Jamfile.v2 +++ b/samples/cpp_tokens/build/Jamfile.v2 @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/samples/cpp_tokens/cpp_tokens.cpp b/samples/cpp_tokens/cpp_tokens.cpp index b107f19..3e0b479 100644 --- a/samples/cpp_tokens/cpp_tokens.cpp +++ b/samples/cpp_tokens/cpp_tokens.cpp @@ -8,7 +8,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/cpp_tokens.hpp b/samples/cpp_tokens/cpp_tokens.hpp index a05096e..c32d5f4 100644 --- a/samples/cpp_tokens/cpp_tokens.hpp +++ b/samples/cpp_tokens/cpp_tokens.hpp @@ -8,7 +8,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/cpp_tokens_config.hpp b/samples/cpp_tokens/cpp_tokens_config.hpp index 034d3c8..bab406b 100644 --- a/samples/cpp_tokens/cpp_tokens_config.hpp +++ b/samples/cpp_tokens/cpp_tokens_config.hpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/instantiate_cpp_exprgrammar.cpp b/samples/cpp_tokens/instantiate_cpp_exprgrammar.cpp index d453660..b426ff8 100644 --- a/samples/cpp_tokens/instantiate_cpp_exprgrammar.cpp +++ b/samples/cpp_tokens/instantiate_cpp_exprgrammar.cpp @@ -7,7 +7,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/instantiate_cpp_grammar.cpp b/samples/cpp_tokens/instantiate_cpp_grammar.cpp index ea10017..261536a 100644 --- a/samples/cpp_tokens/instantiate_cpp_grammar.cpp +++ b/samples/cpp_tokens/instantiate_cpp_grammar.cpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/instantiate_cpp_literalgrammars.cpp b/samples/cpp_tokens/instantiate_cpp_literalgrammars.cpp index 383f89e..8e82d50 100644 --- a/samples/cpp_tokens/instantiate_cpp_literalgrammars.cpp +++ b/samples/cpp_tokens/instantiate_cpp_literalgrammars.cpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/instantiate_defined_grammar.cpp b/samples/cpp_tokens/instantiate_defined_grammar.cpp index ce738e9..a305205 100644 --- a/samples/cpp_tokens/instantiate_defined_grammar.cpp +++ b/samples/cpp_tokens/instantiate_defined_grammar.cpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/instantiate_slex_lexer.cpp b/samples/cpp_tokens/instantiate_slex_lexer.cpp index ec864fc..c5c7dc9 100644 --- a/samples/cpp_tokens/instantiate_slex_lexer.cpp +++ b/samples/cpp_tokens/instantiate_slex_lexer.cpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/slex/cpp_slex_lexer.hpp b/samples/cpp_tokens/slex/cpp_slex_lexer.hpp index 91ec889..0d4ade1 100644 --- a/samples/cpp_tokens/slex/cpp_slex_lexer.hpp +++ b/samples/cpp_tokens/slex/cpp_slex_lexer.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/slex/lexer.hpp b/samples/cpp_tokens/slex/lexer.hpp index ff98cce..7ceacbd 100644 --- a/samples/cpp_tokens/slex/lexer.hpp +++ b/samples/cpp_tokens/slex/lexer.hpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ Copyright (c) 2001, Daniel C. Nuffer. - Copyright (c) 2001-2004 Hartmut Kaiser. + Copyright (c) 2001-2005 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) diff --git a/samples/cpp_tokens/slex_interface.hpp b/samples/cpp_tokens/slex_interface.hpp index 8991dfe..6e34a6b 100644 --- a/samples/cpp_tokens/slex_interface.hpp +++ b/samples/cpp_tokens/slex_interface.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/slex_iterator.hpp b/samples/cpp_tokens/slex_iterator.hpp index a3df1bb..7b2673c 100644 --- a/samples/cpp_tokens/slex_iterator.hpp +++ b/samples/cpp_tokens/slex_iterator.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/cpp_tokens/slex_token.hpp b/samples/cpp_tokens/slex_token.hpp index ade03b5..84ca6a3 100644 --- a/samples/cpp_tokens/slex_token.hpp +++ b/samples/cpp_tokens/slex_token.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/list_includes/build/Jamfile b/samples/list_includes/build/Jamfile index 2d5263d..a7f6381 100644 --- a/samples/list_includes/build/Jamfile +++ b/samples/list_includes/build/Jamfile @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/samples/list_includes/build/Jamfile.v2 b/samples/list_includes/build/Jamfile.v2 index a2dc35e..d411dd9 100644 --- a/samples/list_includes/build/Jamfile.v2 +++ b/samples/list_includes/build/Jamfile.v2 @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/samples/list_includes/list_includes.cpp b/samples/list_includes/list_includes.cpp index 8b8fc0c..97d6f8b 100644 --- a/samples/list_includes/list_includes.cpp +++ b/samples/list_includes/list_includes.cpp @@ -11,7 +11,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/list_includes/list_includes.hpp b/samples/list_includes/list_includes.hpp index e93f634..4eaa087 100644 --- a/samples/list_includes/list_includes.hpp +++ b/samples/list_includes/list_includes.hpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/list_includes/list_includes_config.hpp b/samples/list_includes/list_includes_config.hpp index 9d05cf0..f47bbb6 100644 --- a/samples/list_includes/list_includes_config.hpp +++ b/samples/list_includes/list_includes_config.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/list_includes/list_includes_version.hpp b/samples/list_includes/list_includes_version.hpp index a7830ea..2fae85f 100644 --- a/samples/list_includes/list_includes_version.hpp +++ b/samples/list_includes/list_includes_version.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/quick_start/build/Jamfile b/samples/quick_start/build/Jamfile index 02813fc..0907034 100644 --- a/samples/quick_start/build/Jamfile +++ b/samples/quick_start/build/Jamfile @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/samples/quick_start/build/Jamfile.v2 b/samples/quick_start/build/Jamfile.v2 index 6f62e64..02eee52 100644 --- a/samples/quick_start/build/Jamfile.v2 +++ b/samples/quick_start/build/Jamfile.v2 @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/samples/quick_start/quick_start.cpp b/samples/quick_start/quick_start.cpp index f5cafae..a509f49 100644 --- a/samples/quick_start/quick_start.cpp +++ b/samples/quick_start/quick_start.cpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/build/Jamfile b/samples/waveidl/build/Jamfile index 2811fb3..91fc21a 100644 --- a/samples/waveidl/build/Jamfile +++ b/samples/waveidl/build/Jamfile @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/samples/waveidl/build/Jamfile.v2 b/samples/waveidl/build/Jamfile.v2 index d353431..b5e0bec 100644 --- a/samples/waveidl/build/Jamfile.v2 +++ b/samples/waveidl/build/Jamfile.v2 @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/samples/waveidl/idl.cpp b/samples/waveidl/idl.cpp index 1f09a44..ce4ba6a 100644 --- a/samples/waveidl/idl.cpp +++ b/samples/waveidl/idl.cpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -96,7 +96,7 @@ int print_copyright() "Based on: Wave, A Standard conformant C++ preprocessor library", "It is hosted by http://spirit.sourceforge.net/.", "", - "Copyright (c) 2001-2004 Hartmut Kaiser, Distributed under the Boost", + "Copyright (c) 2001-2005 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 diff --git a/samples/waveidl/idl.hpp b/samples/waveidl/idl.hpp index 788579d..0d88435 100644 --- a/samples/waveidl/idl.hpp +++ b/samples/waveidl/idl.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/idl_config.hpp b/samples/waveidl/idl_config.hpp index 560c376..03c0207 100644 --- a/samples/waveidl/idl_config.hpp +++ b/samples/waveidl/idl_config.hpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/idl_version.hpp b/samples/waveidl/idl_version.hpp index 41eef6b..b4fbd10 100644 --- a/samples/waveidl/idl_version.hpp +++ b/samples/waveidl/idl_version.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -18,6 +18,6 @@ #define IDL_VERSION_MAJOR BOOST_WAVE_VERSION_MAJOR #define IDL_VERSION_MINOR BOOST_WAVE_VERSION_MINOR #define IDL_VERSION_SUBMINOR BOOST_WAVE_VERSION_SUBMINOR -#define IDL_VERSION_DATE 20040520L +#define IDL_VERSION_DATE 20050117L #endif // !defined(IDL_VERSION_HPP_780C1190_3107_440B_B303_B687A449749B_INCLUDED) diff --git a/samples/waveidl/idllexer/idl.re b/samples/waveidl/idllexer/idl.re index abebb06..b15b56a 100644 --- a/samples/waveidl/idllexer/idl.re +++ b/samples/waveidl/idllexer/idl.re @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/idllexer/idl.re.cpp b/samples/waveidl/idllexer/idl.re.cpp index 134d3d3..787d605 100644 --- a/samples/waveidl/idllexer/idl.re.cpp +++ b/samples/waveidl/idllexer/idl.re.cpp @@ -7,7 +7,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/idllexer/idl.re.hpp b/samples/waveidl/idllexer/idl.re.hpp index d436b44..a90f724 100644 --- a/samples/waveidl/idllexer/idl.re.hpp +++ b/samples/waveidl/idllexer/idl.re.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/idllexer/idl_lex_interface.hpp b/samples/waveidl/idllexer/idl_lex_interface.hpp index 9b10bdb..596d7a9 100644 --- a/samples/waveidl/idllexer/idl_lex_interface.hpp +++ b/samples/waveidl/idllexer/idl_lex_interface.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/idllexer/idl_lex_iterator.hpp b/samples/waveidl/idllexer/idl_lex_iterator.hpp index 5734aa6..9354c9b 100644 --- a/samples/waveidl/idllexer/idl_lex_iterator.hpp +++ b/samples/waveidl/idllexer/idl_lex_iterator.hpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/idllexer/idl_re2c_lexer.hpp b/samples/waveidl/idllexer/idl_re2c_lexer.hpp index 338d452..1311764 100644 --- a/samples/waveidl/idllexer/idl_re2c_lexer.hpp +++ b/samples/waveidl/idllexer/idl_re2c_lexer.hpp @@ -5,7 +5,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/instantiate_cpp_grammar.cpp b/samples/waveidl/instantiate_cpp_grammar.cpp index ae21898..3e338a3 100644 --- a/samples/waveidl/instantiate_cpp_grammar.cpp +++ b/samples/waveidl/instantiate_cpp_grammar.cpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/instantiate_defined_grammar.cpp b/samples/waveidl/instantiate_defined_grammar.cpp index 438bd37..b30170f 100644 --- a/samples/waveidl/instantiate_defined_grammar.cpp +++ b/samples/waveidl/instantiate_defined_grammar.cpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/instantiate_predef_macros.cpp b/samples/waveidl/instantiate_predef_macros.cpp index fac743a..345a752 100644 --- a/samples/waveidl/instantiate_predef_macros.cpp +++ b/samples/waveidl/instantiate_predef_macros.cpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/instantiate_re2c_lexer.cpp b/samples/waveidl/instantiate_re2c_lexer.cpp index 5f3e53f..343fba4 100644 --- a/samples/waveidl/instantiate_re2c_lexer.cpp +++ b/samples/waveidl/instantiate_re2c_lexer.cpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/samples/waveidl/instantiate_re2c_lexer_string.cpp b/samples/waveidl/instantiate_re2c_lexer_string.cpp index 7610ddf..4d70315 100644 --- a/samples/waveidl/instantiate_re2c_lexer_string.cpp +++ b/samples/waveidl/instantiate_re2c_lexer_string.cpp @@ -6,7 +6,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/src/cpplexer/re2clex/aq.cpp b/src/cpplexer/re2clex/aq.cpp index de19916..58c36ba 100644 --- a/src/cpplexer/re2clex/aq.cpp +++ b/src/cpplexer/re2clex/aq.cpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ Copyright (c) 2001 Daniel C. Nuffer. - Copyright (c) 2001-2004 Hartmut Kaiser. + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/src/cpplexer/re2clex/cpp.re b/src/cpplexer/re2clex/cpp.re index 3274d6a..70233c8 100644 --- a/src/cpplexer/re2clex/cpp.re +++ b/src/cpplexer/re2clex/cpp.re @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library Copyright (c) 2001 Daniel C. Nuffer - Copyright (c) 2001-2004 Hartmut Kaiser. + Copyright (c) 2001-2005 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) diff --git a/src/cpplexer/re2clex/cpp.re.cpp b/src/cpplexer/re2clex/cpp.re.cpp index d26a86d..f8722dc 100644 --- a/src/cpplexer/re2clex/cpp.re.cpp +++ b/src/cpplexer/re2clex/cpp.re.cpp @@ -4,7 +4,7 @@ Wave: A Standard compliant C++ preprocessor library Copyright (c) 2001 Daniel C. Nuffer - Copyright (c) 2001-2004 Hartmut Kaiser. + Copyright (c) 2001-2005 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) diff --git a/src/instantiate_cpp_exprgrammar.cpp b/src/instantiate_cpp_exprgrammar.cpp index 97020ea..2d7d490 100644 --- a/src/instantiate_cpp_exprgrammar.cpp +++ b/src/instantiate_cpp_exprgrammar.cpp @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/src/instantiate_cpp_grammar.cpp b/src/instantiate_cpp_grammar.cpp index 62f9cb2..d7a3a15 100644 --- a/src/instantiate_cpp_grammar.cpp +++ b/src/instantiate_cpp_grammar.cpp @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/src/instantiate_cpp_literalgrammars.cpp b/src/instantiate_cpp_literalgrammars.cpp index 7478f7f..2e7fa43 100644 --- a/src/instantiate_cpp_literalgrammars.cpp +++ b/src/instantiate_cpp_literalgrammars.cpp @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/src/instantiate_defined_grammar.cpp b/src/instantiate_defined_grammar.cpp index a966307..71a4b85 100644 --- a/src/instantiate_defined_grammar.cpp +++ b/src/instantiate_defined_grammar.cpp @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/src/instantiate_predef_macros.cpp b/src/instantiate_predef_macros.cpp index c0ebcfa..dab8fbb 100644 --- a/src/instantiate_predef_macros.cpp +++ b/src/instantiate_predef_macros.cpp @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/src/instantiate_re2c_lexer.cpp b/src/instantiate_re2c_lexer.cpp index 3ebce10..aaef94e 100644 --- a/src/instantiate_re2c_lexer.cpp +++ b/src/instantiate_re2c_lexer.cpp @@ -4,7 +4,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/src/instantiate_re2c_lexer_string.cpp b/src/instantiate_re2c_lexer_string.cpp index 9de4f8e..5c47ce6 100644 --- a/src/instantiate_re2c_lexer_string.cpp +++ b/src/instantiate_re2c_lexer_string.cpp @@ -4,7 +4,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/tool/build/Jamfile b/tool/build/Jamfile index 0269a68..c128ce5 100644 --- a/tool/build/Jamfile +++ b/tool/build/Jamfile @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/tool/build/Jamfile.v2 b/tool/build/Jamfile.v2 index 2b55322..100d038 100644 --- a/tool/build/Jamfile.v2 +++ b/tool/build/Jamfile.v2 @@ -4,7 +4,7 @@ # # http://spirit.sourceforge.net/ # -# Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost +# Copyright (c) 2001-2005 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) diff --git a/tool/cpp.cpp b/tool/cpp.cpp index 8c013de..4c83d86 100644 --- a/tool/cpp.cpp +++ b/tool/cpp.cpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -97,7 +97,7 @@ int print_copyright() "Wave: A Standard conformant C++ preprocessor", "It is hosted by http://spirit.sourceforge.net/.", "", - "Copyright (c) 2001-2004 Hartmut Kaiser, Distributed under the Boost", + "Copyright (c) 2001-2005 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 diff --git a/tool/cpp.hpp b/tool/cpp.hpp index 066bc88..1f6a992 100644 --- a/tool/cpp.hpp +++ b/tool/cpp.hpp @@ -3,7 +3,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/tool/cpp_config.hpp b/tool/cpp_config.hpp index e4c94b5..2729362 100644 --- a/tool/cpp_config.hpp +++ b/tool/cpp_config.hpp @@ -4,7 +4,7 @@ http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/tool/cpp_version.hpp b/tool/cpp_version.hpp index 7f6e873..80de036 100644 --- a/tool/cpp_version.hpp +++ b/tool/cpp_version.hpp @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ @@ -15,6 +15,6 @@ #define CPP_VERSION_MAJOR BOOST_WAVE_VERSION_MAJOR #define CPP_VERSION_MINOR BOOST_WAVE_VERSION_MINOR #define CPP_VERSION_SUBMINOR BOOST_WAVE_VERSION_SUBMINOR -#define CPP_VERSION_DATE 20040911L +#define CPP_VERSION_DATE 20050117L #endif // !defined(CPP_VERSION_HPP_CE4FE67F_63F9_468D_8364_C855F89D3C5D_INCLUDED) diff --git a/tool/stop_watch.hpp b/tool/stop_watch.hpp index 774b40f..955a6dd 100644 --- a/tool/stop_watch.hpp +++ b/tool/stop_watch.hpp @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/ diff --git a/tool/trace_macro_expansion.hpp b/tool/trace_macro_expansion.hpp index e5391a3..ea92f1a 100644 --- a/tool/trace_macro_expansion.hpp +++ b/tool/trace_macro_expansion.hpp @@ -2,7 +2,7 @@ Wave: A Standard compliant C++ preprocessor library http://spirit.sourceforge.net/ - Copyright (c) 2001-2004 Hartmut Kaiser. Distributed under the Boost + Copyright (c) 2001-2005 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) =============================================================================*/