Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53194 - in trunk: boost/wave boost/wave/cpplexer boost/wave/cpplexer/re2clex boost/wave/grammars boost/wave/util libs/wave libs/wave/src/cpplexer/re2clex libs/wave/test/testwave
From: hartmut.kaiser_at_[hidden]
Date: 2009-05-23 00:15:25


Author: hkaiser
Date: 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
New Revision: 53194
URL: http://svn.boost.org/trac/boost/changeset/53194

Log:
Wave: fixed race condition
Text files modified:
   trunk/boost/wave/cpp_iteration_context.hpp | 13 +-
   trunk/boost/wave/cpplexer/cpp_lex_interface.hpp | 6
   trunk/boost/wave/cpplexer/cpp_lex_interface_generator.hpp | 4
   trunk/boost/wave/cpplexer/cpp_lex_iterator.hpp | 4
   trunk/boost/wave/cpplexer/cpp_lex_token.hpp | 41 ++++---
   trunk/boost/wave/cpplexer/detect_include_guards.hpp | 12 +-
   trunk/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp | 42 ++++----
   trunk/boost/wave/cpplexer/re2clex/scanner.hpp | 2
   trunk/boost/wave/grammars/cpp_expression_grammar.hpp | 6
   trunk/boost/wave/grammars/cpp_expression_grammar_gen.hpp | 2
   trunk/boost/wave/grammars/cpp_grammar_gen.hpp | 2
   trunk/boost/wave/util/cpp_ifblock.hpp | 6
   trunk/boost/wave/util/cpp_include_paths.hpp | 6
   trunk/boost/wave/util/cpp_iterator.hpp | 208 ++++++++++++++++++++--------------------
   trunk/boost/wave/util/cpp_macromap.hpp | 81 +++++++-------
   trunk/boost/wave/util/cpp_macromap_utils.hpp | 40 +++---
   trunk/boost/wave/util/functor_input.hpp | 6
   trunk/boost/wave/util/macro_definition.hpp | 8
   trunk/boost/wave/util/symbol_table.hpp | 6
   trunk/boost/wave/util/transform_iterator.hpp | 84 ---------------
   trunk/boost/wave/util/unput_queue_iterator.hpp | 170 +++-----------------------------
   trunk/boost/wave/wave_config.hpp | 2
   trunk/boost/wave/wave_version.hpp | 2
   trunk/boost/wave/whitespace_handling.hpp | 10
   trunk/libs/wave/ChangeLog | 2
   trunk/libs/wave/src/cpplexer/re2clex/cpp_re.cpp | 20 +-
   trunk/libs/wave/test/testwave/testwave.cpp | 12 +-
   trunk/libs/wave/test/testwave/testwave_app.cpp | 22 ++--
   28 files changed, 305 insertions(+), 514 deletions(-)

Modified: trunk/boost/wave/cpp_iteration_context.hpp
==============================================================================
--- trunk/boost/wave/cpp_iteration_context.hpp (original)
+++ trunk/boost/wave/cpp_iteration_context.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -58,12 +58,11 @@
         {
         public:
             template <typename PositionT>
- static
- void init_iterators(IterContextT &iter_ctx,
+ static void init_iterators(IterContextT &iter_ctx,
                 PositionT const &act_pos, language_support language)
             {
                 typedef typename IterContextT::iterator_type iterator_type;
-
+
                 // read in the file
                 std::ifstream instream(iter_ctx.filename.c_str());
                 if (!instream.is_open()) {
@@ -72,7 +71,7 @@
                     return;
                 }
                 instream.unsetf(std::ios::skipws);
-
+
                 iter_ctx.instring.assign(
                     std::istreambuf_iterator<char>(instream.rdbuf()),
                     std::istreambuf_iterator<char>());
@@ -87,7 +86,7 @@
             std::string instring;
         };
     };
-
+
 } // namespace iteration_context_policies
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -132,9 +131,9 @@
 {
     typedef IteratorT iterator_type;
     typedef typename IteratorT::token_type::position_type position_type;
-
+
     typedef iteration_context<ContextT, IteratorT, InputPolicyT> self_type;
-
+
     iteration_context(ContextT& ctx, BOOST_WAVE_STRINGTYPE const &fname,
             position_type const &act_pos,
             boost::wave::language_support language_)

Modified: trunk/boost/wave/cpplexer/cpp_lex_interface.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/cpp_lex_interface.hpp (original)
+++ trunk/boost/wave/cpplexer/cpp_lex_interface.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -45,15 +45,15 @@
 struct lex_input_interface
 {
     typedef typename TokenT::position_type position_type;
-
+
     lex_input_interface() {}
     virtual ~lex_input_interface() {}
-
+
     virtual TokenT& get(TokenT&) = 0;
     virtual void set_position(position_type const &pos) = 0;
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
     virtual bool has_include_guards(std::string& guard_name) const = 0;
-#endif
+#endif
 };
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: trunk/boost/wave/cpplexer/cpp_lex_interface_generator.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/cpp_lex_interface_generator.hpp (original)
+++ trunk/boost/wave/cpplexer/cpp_lex_interface_generator.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -76,10 +76,10 @@
 : lex_input_interface<TokenT>
 {
     typedef typename lex_input_interface<TokenT>::position_type position_type;
-
+
     lex_input_interface_generator() {}
     ~lex_input_interface_generator() {}
-
+
 // The new_lexer function allows the opaque generation of a new lexer object.
 // It is coupled to the token type to allow to distinguish different
 // lexer/token configurations at compile time.

Modified: trunk/boost/wave/cpplexer/cpp_lex_iterator.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/cpp_lex_iterator.hpp (original)
+++ trunk/boost/wave/cpplexer/cpp_lex_iterator.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -73,13 +73,13 @@
     typedef lex_input_interface<TokenT>* shared;
 
     BOOST_WAVE_EOF_PREFIX result_type const eof;
-
+
     template <typename MultiPass>
     static result_type& get_next(MultiPass& mp, result_type& result)
     {
         return mp.shared->ftor->get(result);
     }
-
+
     // this will be called whenever the last reference to a multi_pass will
     // be released
     template <typename MultiPass>

Modified: trunk/boost/wave/cpplexer/cpp_lex_token.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/cpp_lex_token.hpp (original)
+++ trunk/boost/wave/cpplexer/cpp_lex_token.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -23,6 +23,7 @@
 
 #include <boost/throw_exception.hpp>
 #include <boost/pool/singleton_pool.hpp>
+#include <boost/detail/atomic_count.hpp>
 
 // this must occur after all of the includes and before any code appears
 #ifdef BOOST_HAS_ABI_HEADERS
@@ -42,11 +43,11 @@
 public:
     typedef StringTypeT string_type;
     typedef PositionT position_type;
-
+
     token_data()
     : id(T_EOI), refcnt(1)
     {}
-
+
     token_data(token_id id_, string_type const &value_, position_type const &pos_)
     : id(id_), value(value_), pos(pos_), refcnt(1)
     {}
@@ -54,14 +55,14 @@
     token_data(token_data const& rhs)
     : id(rhs.id), value(rhs.value), pos(rhs.pos), refcnt(1)
     {}
-
+
     ~token_data()
     {}
-
+
     std::size_t addref() { return ++refcnt; }
     std::size_t release() { return --refcnt; }
     std::size_t get_refcnt() const { return refcnt; }
-
+
 // accessors
     operator token_id() const { return id; }
     string_type const &get_value() const { return value; }
@@ -77,7 +78,7 @@
         // positions
         return (lhs.id == rhs.id && lhs.value == rhs.value) ? true : false;
     }
-
+
     void init(token_id id_, string_type const &value_, position_type const &pos_)
     {
         BOOST_ASSERT(refcnt == 1);
@@ -85,7 +86,7 @@
         value = value_;
         pos = pos_;
     }
-
+
     void init(token_data const& rhs)
     {
         BOOST_ASSERT(refcnt == 1);
@@ -93,10 +94,10 @@
         value = rhs.value;
         pos = rhs.pos;
     }
-
+
     static void *operator new(std::size_t size);
     static void operator delete(void *p, std::size_t size);
-
+
 #if defined(BOOST_SPIRIT_DEBUG)
 // debug support
     void print (std::ostream &stream) const
@@ -131,7 +132,7 @@
     token_id id; // the token id
     string_type value; // the text, which was parsed into this token
     position_type pos; // the original file position
- std::size_t refcnt;
+ boost::detail::atomic_count refcnt;
 };
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -145,7 +146,7 @@
     typedef boost::singleton_pool<
             token_data_tag, sizeof(token_data<StringTypeT, PositionT>)
> pool_type;
-
+
     void *ret = pool_type::malloc();
     if (0 == ret)
         boost::throw_exception(std::bad_alloc());
@@ -192,7 +193,7 @@
     lex_token()
     : data(0)
     {}
-
+
     lex_token(lex_token const& rhs)
     : data(rhs.data)
     {
@@ -210,7 +211,7 @@
             delete data;
         data = 0;
     }
-
+
     lex_token& operator=(lex_token const& rhs)
     {
         if (&rhs != this) {
@@ -223,13 +224,13 @@
         }
         return *this;
     }
-
+
 // accessors
     operator token_id() const { return 0 != data ? token_id(*data) : T_EOI; }
     string_type const &get_value() const { return data->get_value(); }
     position_type const &get_position() const { return data->get_position(); }
     bool is_eoi() const { return 0 == data || token_id(*data) == T_EOI; }
-
+
     void set_token_id (token_id id_) { make_unique(); data->set_token_id(id_); }
     void set_value (string_type const &value_) { make_unique(); data->set_value(value_); }
     void set_position (position_type const &pos_) { make_unique(); data->set_position(pos_); }
@@ -242,8 +243,8 @@
             return false;
         return *(lhs.data) == *(rhs.data);
     }
-
-// debug support
+
+// debug support
 #if BOOST_WAVE_DUMP_PARSE_TREE != 0
 // access functions for the tree_to_xml functionality
     static int get_token_id(lex_token const &t)
@@ -251,7 +252,7 @@
     static string_type get_token_value(lex_token const &t)
         { return t.get_value(); }
 #endif
-
+
 #if defined(BOOST_SPIRIT_DEBUG)
 // debug support
     void print (std::ostream &stream) const
@@ -275,13 +276,13 @@
     {
         if (1 == data->get_refcnt())
             return;
-
+
         data_type* newdata = new data_type(*data) ;
 
         data->release(); // release this reference, can't get zero
         data = newdata;
     }
-
+
     data_type* data;
 };
 

Modified: trunk/boost/wave/cpplexer/detect_include_guards.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/detect_include_guards.hpp (original)
+++ trunk/boost/wave/cpplexer/detect_include_guards.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -5,14 +5,14 @@
 
     State machine detecting include guards in an included file.
     This detects two forms of include guards:
-
+
         #ifndef INCLUDE_GUARD_MACRO
         #define INCLUDE_GUARD_MACRO
         ...
         #endif
-
+
     or
-
+
         if !defined(INCLUDE_GUARD_MACRO)
         #define INCLUDE_GUARD_MACRO
         ...
@@ -21,7 +21,7 @@
     note, that the parenthesis are optional (i.e. !defined INCLUDE_GUARD_MACRO
     will work as well). The code allows for any whitespace, newline and single
     '#' tokens before the #if/#ifndef and after the final #endif.
-
+
     Copyright (c) 2001-2009 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)
@@ -61,7 +61,7 @@
         }
         return false;
     }
-
+
 private:
     typedef Token& state_type(Token& t);
     state_type include_guards::* state;
@@ -70,7 +70,7 @@
     bool current_state;
     typename Token::string_type guard_name;
     int if_depth;
-
+
     state_type state_0, state_1, state_2, state_3, state_4, state_5;
     state_type state_1a, state_1b, state_1c, state_1d, state_1e;
 

Modified: trunk/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp (original)
+++ trunk/boost/wave/cpplexer/re2clex/cpp_re2c_lexer.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -67,7 +67,7 @@
 public:
     typedef TokenT token_type;
     typedef typename token_type::string_type string_type;
-
+
     lexer(IteratorT const &first, IteratorT const &last,
         PositionT const &pos, boost::wave::language_support language_);
     ~lexer();
@@ -87,13 +87,13 @@
         return guards.detected(guard_name);
     }
 #endif
-
+
 // error reporting from the re2c generated lexer
     static int report_error(Scanner const* s, int code, char const *, ...);
 
 private:
     static char const *tok_names[];
-
+
     Scanner scanner;
     string_type filename;
     string_type value;
@@ -102,7 +102,7 @@
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
     include_guards<token_type> guards;
 #endif
-
+
     static token_cache<string_type> const cache;
 };
 
@@ -126,7 +126,7 @@
     scanner.column = scanner.curr_column = pos.get_column();
     scanner.error_proc = report_error;
     scanner.file_name = filename.c_str();
-
+
 #if BOOST_WAVE_SUPPORT_MS_EXTENSIONS != 0
     scanner.enable_ms_extensions = true;
 #else
@@ -167,7 +167,7 @@
 
     unsigned int actline = scanner.line;
     token_id id = token_id(scan(&scanner));
-
+
     switch (static_cast<unsigned int>(id)) {
     case T_IDENTIFIER:
     // test identifier characters for validity (throws if invalid chars found)
@@ -176,7 +176,7 @@
         if (!boost::wave::need_no_character_validation(language))
             impl::validate_identifier_name(value, actline, scanner.column, filename);
         break;
-
+
     case T_STRINGLIT:
     case T_CHARLIT:
     // test literal characters for validity (throws if invalid chars found)
@@ -230,14 +230,14 @@
         value = string_type((char const *)scanner.tok,
             scanner.cur-scanner.tok);
         break;
-
+
     case T_EOF:
     // T_EOF is returned as a valid token, the next call will return T_EOI,
     // i.e. the actual end of input
         at_eof = true;
         value.clear();
         break;
-
+
     case T_OR_TRIGRAPH:
     case T_XOR_TRIGRAPH:
     case T_LEFTBRACE_TRIGRAPH:
@@ -254,7 +254,7 @@
                 scanner.cur-scanner.tok);
         }
         break;
-
+
     case T_ANY_TRIGRAPH:
         if (boost::wave::need_convert_trigraphs(language)) {
             value = impl::convert_trigraph(
@@ -265,7 +265,7 @@
                 scanner.cur-scanner.tok);
         }
         break;
-
+
     default:
         if (CATEGORY_FROM_TOKEN(id) != EXTCATEGORY_FROM_TOKEN(id) ||
             IS_CATEGORY(id, UnknownTokenType))
@@ -278,7 +278,7 @@
         }
         break;
     }
-
+
 // std::cerr << boost::wave::get_token_name(id) << ": " << value << std::endl;
 
     // the re2c lexer reports the new line number for newline tokens
@@ -300,13 +300,13 @@
     BOOST_ASSERT(0 != msg);
 
     using namespace std; // some system have vsprintf in namespace std
-
+
     char buffer[200]; // should be large enough
     va_list params;
     va_start(params, msg);
     vsprintf(buffer, msg, params);
     va_end(params);
-
+
     BOOST_WAVE_LEXER_THROW_VAR(lexing_exception, errcode, buffer, s->line,
         s->column, s->file_name);
 // BOOST_UNREACHABLE_RETURN(0);
@@ -318,29 +318,29 @@
 // lex_functor
 //
 ///////////////////////////////////////////////////////////////////////////////
-
+
 template <typename IteratorT,
     typename PositionT = boost::wave::util::file_position_type,
     typename TokenT = typename lexer<IteratorT, PositionT>::token_type>
 class lex_functor
 : public lex_input_interface_generator<TokenT>
-{
+{
 public:
     typedef TokenT token_type;
-
+
     lex_functor(IteratorT const &first, IteratorT const &last,
             PositionT const &pos, boost::wave::language_support language)
     : re2c_lexer(first, last, pos, language)
     {}
     virtual ~lex_functor() {}
-
+
 // get the next token from the input stream
     token_type& get(token_type& result) { return re2c_lexer.get(result); }
     void set_position(PositionT const &pos) { re2c_lexer.set_position(pos); }
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
     bool has_include_guards(std::string& guard_name) const
         { return re2c_lexer.has_include_guards(guard_name); }
-#endif
+#endif
 
 private:
     lexer<IteratorT, PositionT, TokenT> re2c_lexer;
@@ -351,7 +351,7 @@
 token_cache<typename lexer<IteratorT, PositionT, TokenT>::string_type> const
     lexer<IteratorT, PositionT, TokenT>::cache =
         token_cache<typename lexer<IteratorT, PositionT, TokenT>::string_type>();
-
+
 } // namespace re2clex
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -404,7 +404,7 @@
 } // namespace cpplexer
 } // namespace wave
 } // namespace boost
-
+
 // the suffix header occurs after all of the code
 #ifdef BOOST_HAS_ABI_HEADERS
 #include BOOST_ABI_SUFFIX

Modified: trunk/boost/wave/cpplexer/re2clex/scanner.hpp
==============================================================================
--- trunk/boost/wave/cpplexer/re2clex/scanner.hpp (original)
+++ trunk/boost/wave/cpplexer/re2clex/scanner.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -2,7 +2,7 @@
     Boost.Wave: A Standard compliant C++ preprocessor library
 
     http://www.boost.org/
-
+
     Copyright (c) 2001 Daniel C. Nuffer.
     Copyright (c) 2001-2009 Hartmut Kaiser.
     Distributed under the Boost Software License, Version 1.0. (See accompanying

Modified: trunk/boost/wave/grammars/cpp_expression_grammar.hpp
==============================================================================
--- trunk/boost/wave/grammars/cpp_expression_grammar.hpp (original)
+++ trunk/boost/wave/grammars/cpp_expression_grammar.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -798,19 +798,19 @@
     // something. If the remainder consists out of whitespace only, the
     // expression is still valid.
     iterator_type next = hit.stop;
-
+
         while (next != last) {
             switch (static_cast<unsigned int>(token_id(*next))) {
             case T_SPACE:
             case T_SPACE2:
             case T_CCOMMENT:
                 break; // ok continue
-
+
             case T_NEWLINE:
             case T_EOF:
             case T_CPPCOMMENT: // contains newline
                 return as_bool(result); // expression is valid
-
+
             default:
             // expression is illformed
                 if (if_block_status) {

Modified: trunk/boost/wave/grammars/cpp_expression_grammar_gen.hpp
==============================================================================
--- trunk/boost/wave/grammars/cpp_expression_grammar_gen.hpp (original)
+++ trunk/boost/wave/grammars/cpp_expression_grammar_gen.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -50,7 +50,7 @@
     typedef TokenT token_type;
     typedef std::list<token_type, boost::fast_pool_allocator<token_type> >
         token_sequence_type;
-
+
     static bool evaluate(
         typename token_sequence_type::const_iterator const &first,
         typename token_sequence_type::const_iterator const &last,

Modified: trunk/boost/wave/grammars/cpp_grammar_gen.hpp
==============================================================================
--- trunk/boost/wave/grammars/cpp_grammar_gen.hpp (original)
+++ trunk/boost/wave/grammars/cpp_grammar_gen.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -85,7 +85,7 @@
 // boost::spirit::nil_t,
 // boost::pool_allocator<boost::spirit::nil_t>
> node_factory_type;
-
+
 // parse the cpp_grammar and return the resulting parse tree
     static boost::spirit::classic::tree_parse_info<iterator_type, node_factory_type>
     parse_cpp_grammar (iterator_type const &first, iterator_type const &last,

Modified: trunk/boost/wave/util/cpp_ifblock.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_ifblock.hpp (original)
+++ trunk/boost/wave/util/cpp_ifblock.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -68,7 +68,7 @@
 {
 public:
     typedef std::stack<if_block>::size_type size_type;
-
+
     void enter_if_block(bool new_status)
     {
     // If enclosing block is false, then this block is also false
@@ -76,7 +76,7 @@
         this->push (value_type (new_status && enclosing_status, enclosing_status));
     }
     bool enter_elif_block(bool new_status)
- {
+ {
         if (!is_inside_ifpart())
             return false; // #elif without matching #if
 
@@ -136,7 +136,7 @@
     }
 
     size_type get_if_block_depth() const { return this->size(); }
-
+
 protected:
     bool is_inside_ifpart() const
     {

Modified: trunk/boost/wave/util/cpp_include_paths.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_include_paths.hpp (original)
+++ trunk/boost/wave/util/cpp_include_paths.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -140,7 +140,7 @@
     typedef std::list<std::pair<boost::filesystem::path, std::string> >
         include_list_type;
     typedef include_list_type::value_type include_value_type;
-
+
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
     typedef bidirectional_map<std::string, std::string>::type
         pragma_once_set_type;
@@ -350,7 +350,7 @@
     bool is_system, char const *current_file) const
 {
     namespace fs = boost::filesystem;
-
+
 // if not system include (<...>), then search current directory first
     if (!is_system) {
         if (!was_sys_include_path) { // set_sys_include_delimiter() not called
@@ -369,7 +369,7 @@
                     dirpath = create_path(current_rel_dir.string());
                     dirpath /= create_path(s);
                 }
-
+
                 dir = dirpath.string();
                 s = normalize(currpath).string(); // found in local directory
                 return true;

Modified: trunk/boost/wave/util/cpp_iterator.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_iterator.hpp (original)
+++ trunk/boost/wave/util/cpp_iterator.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -2,7 +2,7 @@
     Boost.Wave: A Standard compliant C++ preprocessor library
 
     Definition of the preprocessor iterator
-
+
     http://www.boost.org/
 
     Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
@@ -79,7 +79,7 @@
             "bad parse tree (unexpected)", act_pos);
         return false;
     }
-
+
 typename ParseNodeT::children_t const &children = name_node->children;
 
     if (0 == children.size() ||
@@ -119,19 +119,19 @@
     // copy all parameters to the supplied container
         typename ContainerT::iterator last_nonwhite = macrodefinition.end();
         const_tree_iterator end = nodes.second;
-
+
         for (const_tree_iterator cit = nodes.first; cit != end; ++cit) {
             if ((*cit).value.begin() != (*cit).value.end()) {
             typename ContainerT::iterator inserted = macrodefinition.insert(
                 macrodefinition.end(), *(*cit).value.begin());
-
+
                 if (!IS_CATEGORY(macrodefinition.back(), WhiteSpaceTokenType) &&
                     T_NEWLINE != token_id(macrodefinition.back()) &&
                     T_EOF != token_id(macrodefinition.back()))
                 {
                     last_nonwhite = inserted;
                 }
-
+
                 if (update_position) {
                     (*inserted).set_position(act_pos);
                     act_pos.set_column(
@@ -139,7 +139,7 @@
                 }
             }
         }
-
+
     // trim trailing whitespace (leading whitespace is trimmed by the grammar)
         if (last_nonwhite != macrodefinition.end()) {
             if (update_position) {
@@ -168,14 +168,14 @@
 
     using namespace boost::wave;
     using namespace std; // isspace is in std namespace for some systems
-
+
 // skip leading whitespace
 std::string::iterator begin = macrostring.begin();
 std::string::iterator end = macrostring.end();
 
     while(begin != end && isspace(*begin))
         ++begin;
-
+
 // parse the macro definition
 position_type act_pos("<command line>");
 boost::spirit::classic::tree_parse_info<lexer_type> hit =
@@ -209,7 +209,7 @@
     {
         macrodefinition.push_back(token_type(T_INTLIT, "1", act_pos));
     }
-
+
 // add the new macro to the macromap
     return ctx.add_macro_definition(macroname, has_parameters, macroparameters,
         macrodefinition, is_predefined);
@@ -286,7 +286,7 @@
         ctx_.set_current_filename(pos_.get_file().c_str());
 #endif
     }
-
+
 // get the next preprocessed token
     result_type const &operator()();
 
@@ -297,7 +297,7 @@
     friend class pp_iterator<ContextT>;
     bool on_include_helper(char const *t, char const *s, bool is_system,
         bool include_next);
-
+
 protected:
     result_type const &get_next_token();
     result_type const &pp_token();
@@ -323,7 +323,7 @@
 
     void on_define(parse_node_type const &node);
     void on_undefine(lexer_type const &it);
-
+
     void on_ifdef(result_type const& found_directive, lexer_type const &it);
 // typename parse_tree_type::const_iterator const &end);
     void on_ifndef(result_type const& found_directive, lexer_type const& it);
@@ -331,7 +331,7 @@
     void on_else();
     void on_endif();
     void on_illformed(typename result_type::string_type s);
-
+
     void on_line(typename parse_tree_type::const_iterator const &begin,
         typename parse_tree_type::const_iterator const &end);
     void on_if(result_type const& found_directive,
@@ -359,16 +359,16 @@
 private:
     ContextT &ctx; // context, this iterator is associated with
     boost::shared_ptr<base_iteration_context_type> iter_ctx;
-
+
     bool seen_newline; // needed for recognizing begin of line
     bool skipped_newline; // a newline has been skipped since last one
     bool must_emit_line_directive; // must emit a line directive
     result_type act_token; // current token
     typename result_type::position_type &act_pos; // current fileposition (references the macromap)
-
+
     token_sequence_type unput_queue; // tokens to be preprocessed again
     token_sequence_type pending_queue; // tokens already preprocessed
-
+
     // detect whether to insert additional whitespace in between two adjacent
     // tokens, which otherwise would form a different token type, if
     // re-tokenized
@@ -406,7 +406,7 @@
     // of the included file
         BOOST_WAVE_STRINGTYPE oldfile = iter_ctx->real_filename;
         position_type old_pos (act_pos);
-
+
     // if this file has include guards handle it as if it had a #pragma once
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
         if (need_include_guard_detection(ctx.get_language())) {
@@ -424,7 +424,7 @@
         act_pos.set_file(iter_ctx->filename);
         act_pos.set_line(iter_ctx->line);
         act_pos.set_column(0);
-
+
     // restore the actual current file and directory
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
         ctx.set_current_filename(iter_ctx->real_filename.c_str());
@@ -483,11 +483,11 @@
 
     // make sure the cwd has been initialized
     ctx.init_context();
-
+
     // loop over skip able whitespace until something significant is found
     bool was_seen_newline = seen_newline;
     token_id id = T_UNKNOWN;
-
+
     try { // catch lexer exceptions
         do {
         // get_next_token assigns result to act_token member
@@ -503,7 +503,7 @@
                 act_token.set_token_id(id = T_NEWLINE);
                 act_token.set_value("\n");
             }
-
+
         } while (ctx.get_hooks().may_skip_whitespace(ctx.derived(), act_token, skipped_newline));
     }
     catch (boost::wave::cpplexer::lexing_exception const& e) {
@@ -511,7 +511,7 @@
         ctx.get_hooks().throw_exception(ctx.derived(), e);
         return act_token;
     }
-
+
 // if there were skipped any newlines, we must emit a #line directive
     if ((must_emit_line_directive || (was_seen_newline && skipped_newline)) &&
         impl::consider_emitting_line_directive(ctx, id))
@@ -524,7 +524,7 @@
             id = token_id(act_token);
         }
     }
-
+
 // cleanup of certain tokens required
     seen_newline = false;
     switch (static_cast<unsigned int>(id)) {
@@ -537,7 +537,7 @@
         ++iter_ctx->emitted_lines;
         seen_newline = true;
         break;
-
+
     case T_NEWLINE:
     case T_CPPCOMMENT:
         seen_newline = true;
@@ -548,11 +548,11 @@
         iter_ctx->emitted_lines +=
             context_policies::util::ccomment_count_newlines(act_token);
         break;
-
+
     case T_PP_NUMBER: // re-tokenize the pp-number
         {
             token_sequence_type rescanned;
-
+
             std::string pp_number(
                 util::to_string<std::string>(act_token.get_value()));
 
@@ -560,10 +560,10 @@
                 pp_number.end(), act_token.get_position(),
                 ctx.get_language());
             lexer_type end = lexer_type();
-
+
             for (/**/; it != end && T_EOF != token_id(*it); ++it)
                 rescanned.push_back(*it);
-
+
             pending_queue.splice(pending_queue.begin(), rescanned);
             act_token = pending_queue.front();
             id = token_id(act_token);
@@ -600,16 +600,16 @@
 pp_iterator_functor<ContextT>::get_next_token()
 {
     using namespace boost::wave;
-
+
 // if there is something in the unput_queue, then return the next token from
 // there (all tokens in the queue are preprocessed already)
     if (!pending_queue.empty() || !unput_queue.empty())
         return pp_token(); // return next token
-
+
 // test for EOF, if there is a pending input context, pop it back and continue
 // parsing with it
 bool returned_from_include_file = returned_from_include();
-
+
 // try to generate the next token
     if (iter_ctx->first != iter_ctx->last) {
         do {
@@ -622,17 +622,17 @@
 
                 return act_token = pending_queue.front();
             }
-
+
         // adjust the current position (line and column)
         bool was_seen_newline = seen_newline || returned_from_include_file;
 
         // fetch the current token
             act_token = *iter_ctx->first;
             act_pos = act_token.get_position();
-
+
         // act accordingly on the current token
         token_id id = token_id(act_token);
-
+
             if (T_EOF == id) {
             // returned from an include file, continue with the next token
                 whitespace.shift_tokens(T_EOF);
@@ -653,7 +653,7 @@
             // (the C++ comment token includes the trailing newline)
                 seen_newline = true;
                 ++iter_ctx->first;
-
+
                 if (!ctx.get_if_block_status()) {
                 // skip this token because of the disabled #if block
                     whitespace.shift_tokens(id); // whitespace controller
@@ -714,7 +714,7 @@
     else {
         act_token = eof; // this is the last token
     }
-
+
 // whitespace.shift_tokens(T_EOF); // whitespace controller
     return act_token; // return eof token
 }
@@ -729,7 +729,7 @@
 pp_iterator_functor<ContextT>::emit_line_directive()
 {
     using namespace boost::wave;
-
+
 typename ContextT::position_type pos = act_token.get_position();
 
     if (must_emit_line_directive ||
@@ -750,7 +750,7 @@
         // account for the newline emitted here
             act_pos.set_line(act_pos.get_line()-1);
             iter_ctx->emitted_lines = act_pos.get_line();
-
+
         // the #line directive has to be pushed back into the pending queue in
         // reverse order
 
@@ -758,7 +758,7 @@
         std::string file("\"");
         boost::filesystem::path filename(
             wave::util::create_path(act_pos.get_file().c_str()));
-
+
             using wave::util::impl::escape_lit;
             file += escape_lit(wave::util::native_file_string(filename)) + "\"";
 
@@ -775,7 +775,7 @@
         unsigned int column = 7 + (unsigned int)strlen(buffer) + filenamelen;
 
             pos.set_line(pos.get_line() - 1); // adjust line number
-
+
             pos.set_column(column);
             pending_queue.push_front(result_type(T_GENERATEDNEWLINE, "\n", pos));
             pos.set_column(column -= filenamelen); // account for filename
@@ -786,13 +786,13 @@
             pending_queue.push_front(result_type(T_INTLIT, buffer, pos));
             pos.set_column(--column); // account for ' '
             pending_queue.push_front(result_type(T_SPACE, " ", pos));
-
+
         // return the #line token itself
 // whitespace.shift_tokens(T_PP_LINE);
             pos.set_column(1);
             act_token = result_type(T_PP_LINE, "#line", pos);
         }
-
+
         must_emit_line_directive = false; // we are now in sync
         return true;
     }
@@ -840,7 +840,7 @@
             ++iter_ctx->first;
         }
         id = token_id(act_token);
-
+
     } while (T_PLACEHOLDER == id);
     return act_token;
 }
@@ -856,7 +856,7 @@
     bool next_token_is_pp_directive(ContextT &ctx, IteratorT &it, IteratorT const &end)
     {
         using namespace boost::wave;
-
+
         token_id id = T_UNKNOWN;
         for (/**/; it != end; ++it) {
             id = token_id(*it);
@@ -875,7 +875,7 @@
         BOOST_ASSERT(it == end || id != T_UNKNOWN);
         return it != end && IS_CATEGORY(id, PPTokenType);
     }
-
+
     // call 'found_directive' preprocessing hook
     template <typename ContextT>
     bool call_found_directive_hook(ContextT& ctx,
@@ -908,7 +908,7 @@
         bool call_hook = true)
     {
         using namespace boost::wave;
-
+
         // this token get's skipped
         if (call_hook)
             call_skipped_token_hook(ctx, *it);
@@ -940,10 +940,10 @@
     bool skip_to_eol(ContextT &ctx, IteratorT &it, IteratorT const &end)
     {
         using namespace boost::wave;
-
+
         for (/**/; it != end; ++it) {
         token_id id = token_id(*it);
-
+
             call_skipped_token_hook(ctx, *it);
             if (T_CPPCOMMENT == id || T_NEWLINE == id ||
                 context_policies::util::ccomment_has_newline(*it))
@@ -954,7 +954,7 @@
         }
         return false;
     }
-
+
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -977,7 +977,7 @@
     impl::skip_to_eol(ctx, it, iter_ctx->last);
 
 string_type str(util::impl::as_string<string_type>(iter_ctx->first, it));
-
+
     seen_newline = true;
     iter_ctx->first = it;
     on_illformed(str);
@@ -994,29 +994,29 @@
     {
     // enable error recovery (start over with the next line)
         impl::skip_to_eol(ctx, it, iter_ctx->last);
-
+
     string_type str(util::impl::as_string<string_type>(
         iter_ctx->first, it));
 
         seen_newline = true;
         iter_ctx->first = it;
-
+
     // report an invalid directive
         on_illformed(str);
         return false;
     }
-
+
     if (it == iter_ctx->last && !need_single_line(ctx.get_language()))
     {
     // The line doesn't end with an eol but eof token.
         seen_newline = true; // allow to resume after warning
         iter_ctx->first = it;
-
+
     // Trigger a warning that the last line was not terminated with a
     // newline.
         BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
             last_line_not_terminated, "", act_pos);
-
+
         return false;
     }
     return true;
@@ -1034,7 +1034,7 @@
     // The line doesn't end with an eol but eof token.
         seen_newline = true; // allow to resume after warning
         iter_ctx->first = it;
-
+
     // Trigger a warning, that the last line was not terminated with a
     // newline.
         BOOST_WAVE_THROW_CTX(ctx, preprocess_exception,
@@ -1047,7 +1047,7 @@
     iter_ctx->first = it;
     return true;
 }
-
+
 ///////////////////////////////////////////////////////////////////////////////
 // handle_pp_directive: handle certain pp_directives
 template <typename ContextT>
@@ -1131,7 +1131,7 @@
                 return true;
             }
             break;
-
+
         case T_PP_HHEADER: // #include <...>
 #if BOOST_WAVE_SUPPORT_INCLUDE_NEXT != 0
         case T_PP_HHEADER_NEXT:
@@ -1237,7 +1237,7 @@
 pp_iterator_functor<ContextT>::pp_directive()
 {
     using namespace cpplexer;
-
+
 // test, if the next non-whitespace token is a pp directive
 lexer_type it = iter_ctx->first;
 
@@ -1255,7 +1255,7 @@
                 on_illformed((*it).get_value());
             }
         }
-
+
     // this line does not contain a pp directive, so simply return
         return false;
     }
@@ -1271,7 +1271,7 @@
         // false or if it was a #include directive we could handle directly
         return true; // the pp directive has been handled/skipped
     }
-
+
 // found a pp directive, so try to identify it, start with the pp_token
 bool found_eof = false;
 result_type found_directive;
@@ -1290,7 +1290,7 @@
     // found a valid pp directive, dispatch to the correct function to handle
     // the found pp directive
     bool result = dispatch_directive (hit, found_directive, found_eoltokens);
-
+
         if (found_eof && !need_single_line(ctx.get_language())) {
         // The line was terminated with an end of file token.
         // So trigger a warning, that the last line was not terminated with a
@@ -1304,7 +1304,7 @@
     // recognized invalid directive
         impl::skip_to_eol(ctx, it, iter_ctx->last);
         seen_newline = true;
-
+
         string_type str(boost::wave::util::impl::as_string<string_type>(
             iter_ctx->first, it));
         iter_ctx->first = it;
@@ -1327,9 +1327,9 @@
     token_sequence_type const& found_eoltokens)
 {
     using namespace cpplexer;
-
+
     typedef typename parse_tree_type::const_iterator const_child_iterator_t;
-
+
 // this iterator points to the root node of the parse tree
 const_child_iterator_t begin = hit.trees.begin();
 
@@ -1406,7 +1406,7 @@
     case T_PP_LINE: // #line
         on_line(begin_child_it, end_child_it);
         break;
-
+
     case T_PP_ERROR: // #error
         on_error(begin_child_it, end_child_it);
         break;
@@ -1482,7 +1482,7 @@
     on_include_helper(file_token.c_str(), file_path.c_str(), is_system,
         include_next);
 }
-
+
 template <typename ContextT>
 inline bool
 pp_iterator_functor<ContextT>::on_include_helper (char const *f, char const *s,
@@ -1530,7 +1530,7 @@
     // the new include file determines the actual current directory
         ctx.set_current_directory(
             wave::util::native_file_string(native_path).c_str());
-
+
     // preprocess the opened file
     boost::shared_ptr<base_iteration_context_type> new_iter_ctx (
         new iteration_context_type(ctx,
@@ -1550,13 +1550,13 @@
         iter_ctx->filename = act_pos.get_file();
         iter_ctx->line = act_pos.get_line();
         iter_ctx->if_block_depth = ctx.get_if_block_depth();
-
+
     // push the old iteration context onto the stack and continue with the new
         ctx.push_iteration_context(act_pos, iter_ctx);
         iter_ctx = new_iter_ctx;
         seen_newline = true; // fake a newline to trigger pp_directive
         must_emit_line_directive = true;
-
+
         act_pos.set_file(iter_ctx->filename); // initialize file position
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
         ctx.set_current_filename(iter_ctx->real_filename.c_str());
@@ -1582,7 +1582,7 @@
     trim_whitespace(StringT const &s)
     {
         typedef typename StringT::size_type size_type;
-
+
         size_type first = s.find_first_not_of(" \t\v\f");
         if (StringT::npos == first)
             return StringT();
@@ -1660,7 +1660,7 @@
             using namespace cpplexer;
             typedef typename std::vector<result_type>::iterator
                 parameter_iterator_t;
-
+
             bool seen_ellipses = false;
             parameter_iterator_t end = macroparameters.end();
             for (parameter_iterator_t pit = macroparameters.begin();
@@ -1684,7 +1684,7 @@
                     return;
                 }
             }
-
+
         // if there wasn't an ellipsis, then there shouldn't be a __VA_ARGS__
         // placeholder in the definition too [C99 Standard 6.10.3.5]
             if (!seen_ellipses) {
@@ -1717,7 +1717,7 @@
             using namespace cpplexer;
             typedef typename std::vector<result_type>::iterator
                 parameter_iterator_t;
-
+
             parameter_iterator_t end = macroparameters.end();
             for (parameter_iterator_t pit = macroparameters.begin();
                 pit != end; ++pit)
@@ -1732,7 +1732,7 @@
             }
         }
     }
-
+
 // add the new macro to the macromap
     ctx.add_macro_definition(macroname, has_parameters, macroparameters,
         macrodefinition);
@@ -1906,13 +1906,13 @@
 
     do {
         expanded.clear();
-
+
         typename token_sequence_type::iterator begin2 = toexpand.begin();
         ctx.expand_whole_tokensequence(begin2, toexpand.end(), expanded);
 
     // replace all remaining (== undefined) identifiers with an integer literal '0'
         replace_undefined_identifiers(expanded);
-
+
 #if BOOST_WAVE_DUMP_CONDITIONAL_EXPRESSIONS != 0
         {
             string_type outstr(boost::wave::util::impl::as_string(toexpand));
@@ -1932,7 +1932,7 @@
             ctx.get_hooks().throw_exception(ctx.derived(), e);
             break;
         }
-
+
 #if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
         ctx.get_hooks().evaluated_conditional_expression(toexpand, if_status);
     } while (false);
@@ -1948,7 +1948,7 @@
         string_type expression = util::impl::as_string(expanded);
         if (0 == expression.size())
             expression = "<empty expression>";
-
+
         if (grammars::error_division_by_zero & status) {
             BOOST_WAVE_THROW_CTX(ctx, preprocess_exception, division_by_zero,
                 expression.c_str(), act_pos);
@@ -2002,7 +2002,7 @@
         impl::skip_to_eol(ctx, begin3, found_eoltokens.end());
         return; // one of previous #if/#elif was true, so don't enter this #elif
     }
-
+
 // preprocess the given sequence into the provided list
 bool if_status = false;
 grammars::value_error status = grammars::error_noerror;
@@ -2013,7 +2013,7 @@
         
         typename token_sequence_type::iterator begin2 = toexpand.begin();
         ctx.expand_whole_tokensequence(begin2, toexpand.end(), expanded);
-
+
     // replace all remaining (== undefined) identifiers with an integer literal '0'
         replace_undefined_identifiers(expanded);
 
@@ -2035,7 +2035,7 @@
         // any errors occurred have to be dispatched to the context hooks
             ctx.get_hooks().throw_exception(ctx.derived(), e);
         }
-
+
 #if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
         ctx.get_hooks().evaluated_conditional_expression(toexpand, if_status);
     } while (false);
@@ -2044,7 +2044,7 @@
                 found_directive, toexpand, if_status)
              && status == grammars::error_noerror);
 #endif
-
+
     if (!ctx.enter_elif_block(if_status)) {
     // #elif without matching #if
         BOOST_WAVE_THROW_CTX(ctx, preprocess_exception, missing_matching_if,
@@ -2121,24 +2121,24 @@
             using namespace boost::spirit::classic;
             if (!parse((*first).get_value().c_str(), int_p).full)
                 error = preprocess_exception::bad_line_number;
-
+
         // extract file name (if it is given)
             while (++first != last && IS_CATEGORY(*first, WhiteSpaceTokenType))
                 /**/; // skip whitespace
-
+
             if (first != last) {
                 if (T_STRINGLIT != token_id(*first)) {
                     error = preprocess_exception::bad_line_filename;
                     return false;
                 }
-
+
             StringT const &file_lit = (*first).get_value();
-
+
                 if ('L' == file_lit[0]) {
                     error = preprocess_exception::bad_line_filename;
                     return false; // shouldn't be a wide character string
                 }
-
+
                 file = file_lit.substr(1, file_lit.size()-2);
 
             // test if there is other junk on this line
@@ -2170,10 +2170,10 @@
             get_token_value<result_type, parse_node_type>,
             typename parse_tree_type::const_iterator
>::type const_tree_iterator_t;
-
+
 const_tree_iterator_t first = make_ref_transform_iterator(begin, get_value);
 const_tree_iterator_t last = make_ref_transform_iterator(end, get_value);
-
+
 // try to interpret the #line body as a number followed by an optional
 // string literal
 unsigned int line = 0;
@@ -2206,14 +2206,14 @@
         ctx.get_hooks().found_line_directive(ctx.derived(), toexpand, line,
             file_name.c_str());
     }
-
+
 // the queues should be empty at this point
     BOOST_ASSERT(unput_queue.empty());
     BOOST_ASSERT(pending_queue.empty());
 
 // make sure error recovery starts on the next line
     must_emit_line_directive = true;
-
+
 // diagnose possible error in detected line directive
     if (error != preprocess_exception::no_error) {
         BOOST_WAVE_THROW_VAR_CTX(ctx, preprocess_exception, error,
@@ -2251,7 +2251,7 @@
         get_token_value<result_type, parse_node_type>,
         typename parse_tree_type::const_iterator
>::type first = make_ref_transform_iterator(begin, get_value);
-
+
 #if BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY != 0
 // preprocess the body of this #error message
 token_sequence_type toexpand;
@@ -2299,7 +2299,7 @@
         get_token_value<result_type, parse_node_type>,
         typename parse_tree_type::const_iterator
>::type first = make_ref_transform_iterator(begin, get_value);
-
+
 #if BOOST_WAVE_PREPROCESS_ERROR_MESSAGE_BODY != 0
 // preprocess the body of this #warning message
 token_sequence_type toexpand;
@@ -2338,7 +2338,7 @@
     typename parse_tree_type::const_iterator const &end)
 {
     using namespace boost::wave;
-
+
     BOOST_ASSERT(ctx.get_if_block_status());
 
 // Look at the pragma token sequence and decide, if the first token is STDC
@@ -2351,13 +2351,13 @@
             get_token_value<result_type, parse_node_type>,
             typename parse_tree_type::const_iterator
>::type const_tree_iterator_t;
-
+
 const_tree_iterator_t first = make_ref_transform_iterator(begin, get_value);
 const_tree_iterator_t last = make_ref_transform_iterator(end, get_value);
 
     expanded.push_back(result_type(T_PP_PRAGMA, "#pragma", act_token.get_position()));
     expanded.push_back(result_type(T_SPACE, " ", act_token.get_position()));
-
+
     while (++first != last && IS_CATEGORY(*first, WhiteSpaceTokenType))
         expanded.push_back(*first); // skip whitespace
 
@@ -2386,7 +2386,7 @@
         }
     }
     expanded.push_back(result_type(T_NEWLINE, "\n", act_token.get_position()));
-
+
 // the queues should be empty at this point
     BOOST_ASSERT(unput_queue.empty());
     BOOST_ASSERT(pending_queue.empty());
@@ -2399,7 +2399,7 @@
             pending_queue.splice(pending_queue.begin(), pending);
         return true; // this #pragma was successfully recognized
     }
-
+
 #if BOOST_WAVE_EMIT_PRAGMA_DIRECTIVES != 0
 // Move the resulting token sequence into the pending_queue, so it will be
 // returned to the caller.
@@ -2417,12 +2417,12 @@
     token_sequence_type const &pragma_body, token_sequence_type &result)
 {
     using namespace cpplexer;
-
+
     typename token_sequence_type::const_iterator end = pragma_body.end();
     typename token_sequence_type::const_iterator it = pragma_body.begin();
     for (++it; it != end && IS_CATEGORY(*it, WhiteSpaceTokenType); ++it)
         /**/; // skip whitespace
-
+
     if (it == end) // eof reached
         return false;
 
@@ -2458,17 +2458,17 @@
         base_type;
     typedef pp_iterator<ContextT> self_type;
     typedef boost::wave::util::functor_input functor_input_type;
-
+
 public:
     pp_iterator()
     {}
-
+
     template <typename IteratorT>
     pp_iterator(ContextT &ctx, IteratorT const &first, IteratorT const &last,
         typename ContextT::position_type const &pos)
     : base_type(input_policy_type(ctx, first, last, pos))
     {}
-
+
     bool force_include(char const *path_, bool is_last)
     {
         bool result = this->get_functor().on_include_helper(path_, path_,

Modified: trunk/boost/wave/util/cpp_macromap.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_macromap.hpp (original)
+++ trunk/boost/wave/util/cpp_macromap.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -70,10 +70,10 @@
     typedef typename ContextT::token_type token_type;
     typedef typename token_type::string_type string_type;
     typedef typename token_type::position_type position_type;
-
+
     typedef typename ContextT::token_sequence_type definition_container_type;
     typedef std::vector<token_type> parameter_container_type;
-
+
     typedef macro_definition<token_type, definition_container_type>
         macro_definition_type;
     typedef symbol_table<string_type, macro_definition_type>
@@ -100,11 +100,11 @@
     bool is_defined(string_type const &name,
         typename defined_macros_type::iterator &it,
         defined_macros_type *scope = 0) const;
-
+
 // expects a token sequence as its parameters
     template <typename IteratorT>
     bool is_defined(IteratorT const &begin, IteratorT const &end) const;
-
+
 // expects an arbitrary string as its parameter
     bool is_defined(string_type const &str) const;
 
@@ -114,11 +114,11 @@
         parameter_container_type &parameters,
         definition_container_type &definition,
         defined_macros_type *scope = 0) const;
-
+
 // Remove a macro name from the given macro scope
     bool remove_macro(string_type const &name, position_type const& pos,
         bool even_predefined = false);
-
+
     template <typename IteratorT, typename ContainerT>
     token_type const &expand_tokensequence(IteratorT &first,
         IteratorT const &last, ContainerT &pending, ContainerT &expanded,
@@ -135,7 +135,7 @@
         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();
 
@@ -144,7 +144,7 @@
 // interface for macro name introspection
     typedef typename defined_macros_type::name_iterator name_iterator;
     typedef typename defined_macros_type::const_name_iterator const_name_iterator;
-
+
     name_iterator begin()
         { return defined_macros_type::make_iterator(current_macros->begin()); }
     name_iterator end()
@@ -153,7 +153,7 @@
         { return defined_macros_type::make_iterator(current_macros->begin()); }
     const_name_iterator end() const
         { return defined_macros_type::make_iterator(current_macros->end()); }
-
+
 protected:
 // Helper functions for expanding all macros in token sequences
     template <typename IteratorT, typename ContainerT>
@@ -215,7 +215,7 @@
     template <typename IteratorT, typename ContainerT>
     token_type const &resolve_defined(IteratorT &first, IteratorT const &last,
         ContainerT &expanded);
-
+
 // Resolve operator _Pragma or the #pragma directive
     template <typename IteratorT, typename ContainerT>
     bool resolve_operator_pragma(IteratorT &first,
@@ -228,7 +228,7 @@
     template <typename ContainerT>
     bool is_valid_concat(string_type new_value,
         position_type const &pos, ContainerT &rescanned);
-
+
 #if BOOST_WAVE_SERIALIZATION != 0
 public:
     BOOST_STATIC_CONSTANT(unsigned int, version = 0x10);
@@ -303,7 +303,7 @@
             name.get_value().c_str());
         return false;
     }
-
+
 // try to define the new macro
 defined_macros_type *current_scope = scope ? scope : current_macros;
 typename defined_macros_type::iterator it = current_scope->find(name.get_value());
@@ -325,17 +325,17 @@
 // test the validity of the parameter names
     if (has_parameters) {
         std::set<typename token_type::string_type> names;
-
+
         typedef typename parameter_container_type::iterator
             parameter_iterator_type;
         typedef typename std::set<typename token_type::string_type>::iterator
             name_iterator_type;
-
+
         parameter_iterator_type end = parameters.end();
         for (parameter_iterator_type itp = parameters.begin(); itp != end; ++itp)
         {
         name_iterator_type pit = names.find((*itp).get_value());
-
+
             if (pit != names.end()) {
             // duplicate parameter name
                 BOOST_WAVE_THROW_NAME_CTX(ctx, macro_handling_exception,
@@ -346,7 +346,7 @@
             names.insert((*itp).get_value());
         }
     }
-
+
 // insert a new macro node
     std::pair<typename defined_macros_type::iterator, bool> p =
         current_scope->insert(
@@ -368,7 +368,7 @@
 // add the parameters and the definition
     std::swap((*p.first).second->macroparameters, parameters);
     std::swap((*p.first).second->macrodefinition, definition);
-
+
 // call the context supplied preprocessing hook
 #if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
     ctx.get_hooks().defined_macro(name, has_parameters,
@@ -394,7 +394,7 @@
     defined_macros_type *scope) const
 {
     if (0 == scope) scope = current_macros;
-
+
     if ((it = scope->find(name)) != scope->end())
         return true; // found in symbol table
 
@@ -465,7 +465,7 @@
     typename defined_macros_type::iterator it;
     if (!is_defined(name, it, scope))
         return false;
-
+
 macro_definition_type &macro_def = *(*it).second.get();
 
     has_parameters = macro_def.is_functionlike;
@@ -497,7 +497,7 @@
             }
         }
         current_macros->erase(it);
-
+
     // call the context supplied preprocessing hook function
     token_type tok(T_IDENTIFIER, name, pos);
 
@@ -862,13 +862,14 @@
         gen_type;
     typedef typename gen_type::return_type iterator_type;
 
-iterator_type first_it = gen_type::generate(first);
-iterator_type last_it = gen_type::generate(last);
+ ContainerT empty;
+ iterator_type first_it = gen_type::generate(empty, first);
+ iterator_type last_it = gen_type::generate(last);
+
+ on_exit::assign<IteratorT, iterator_type> on_exit(first, first_it);
+ ContainerT pending_queue;
+ bool seen_newline;
 
-on_exit::assign<IteratorT, iterator_type> on_exit(first, first_it);
-ContainerT pending_queue;
-bool seen_newline;
-
     while (!pending_queue.empty() || first_it != last_it) {
         expanded.push_back(
             expand_tokensequence_worker(pending_queue, first_it,
@@ -1624,13 +1625,13 @@
 {
 // re-tokenize the newly generated string
     typedef typename ContextT::lexer_type lexer_type;
-
+
     std::string value_to_test(new_value.c_str());
 
     boost::wave::language_support lang =
         boost::wave::enable_prefer_pp_numbers(ctx.get_language());
     lang = boost::wave::enable_single_line(lang);
-
+
     lexer_type it = lexer_type(value_to_test.begin(), value_to_test.end(), pos,
         lang);
     lexer_type end = lexer_type();
@@ -1641,7 +1642,7 @@
     if (boost::wave::need_variadics(ctx.get_language()))
         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()));
@@ -1661,14 +1662,14 @@
 {
     using namespace boost::wave;
     typedef typename ContainerT::iterator iterator_type;
-
+
     iterator_type end = expanded.end();
     iterator_type prev = end;
     for (iterator_type it = expanded.begin(); it != end; /**/)
     {
         if (T_POUND_POUND == BASE_TOKEN(token_id(*it))) {
         iterator_type next = it;
-
+
             ++next;
             if (prev == end || next == end) {
             // error, '##' should be in between two tokens
@@ -1725,7 +1726,7 @@
                 !IS_CATEGORY(*next, WhiteSpaceTokenType))
             {
             string_type error_string("\"");
-
+
                 error_string += (*prev).get_value();
                 error_string += "\" and \"";
                 error_string += (*next).get_value();
@@ -1739,13 +1740,13 @@
             if (boost::wave::need_variadics(ctx.get_language())) {
             // remove the prev, '##' and the next tokens from the sequence
                 expanded.erase(prev, ++next); // remove not needed tokens
-
+
             // some stl implementations clear() the container if we erased all
             // the elements, which orphans all iterators. we re-initialize these
             // here
                 if (expanded.empty())
                     end = next = expanded.end();
-
+
             // replace the old token (pointed to by *prev) with the re-tokenized
             // sequence
                 expanded.splice(next, rescanned);
@@ -1763,7 +1764,7 @@
                 (*prev).set_value(concat_result);
                 if (T_NONREPLACABLE_IDENTIFIER == token_id(*prev))
                     (*prev).set_token_id(T_IDENTIFIER);
-
+
             // remove the '##' and the next tokens from the sequence
             iterator_type first_to_delete = prev;
 
@@ -1774,7 +1775,7 @@
         }
 
     // save last non-whitespace token position
- if (!IS_CATEGORY(*it, WhiteSpaceTokenType))
+ if (!IS_CATEGORY(*it, WhiteSpaceTokenType))
             prev = it;
 
         ++it; // next token, please
@@ -1834,7 +1835,7 @@
             predefine_macro(current_scope, m.name,
                 token_type(m.token_id, m.value, pos));
         }
-
+
 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
     // define __WAVE_HAS_VARIADICS__, if appropriate
         if (boost::wave::need_variadics(ctx.get_language())) {
@@ -1848,7 +1849,7 @@
     namespace fs = boost::filesystem;
     if (string_type(fname) != "<Unknown>") {
     fs::path filename(create_path(fname));
-
+
         using boost::wave::util::impl::escape_lit;
         predefine_macro(current_scope, "__BASE_FILE__",
             token_type(T_STRINGLIT, string_type("\"") +
@@ -1857,13 +1858,13 @@
     }
     else if (!base_name.empty()) {
     fs::path filename(create_path(base_name.c_str()));
-
+
         using boost::wave::util::impl::escape_lit;
         predefine_macro(current_scope, "__BASE_FILE__",
             token_type(T_STRINGLIT, string_type("\"") +
                 escape_lit(native_file_string(filename)).c_str() + "\"", pos));
     }
-
+
 // now add the dynamic macros
     for (int j = 0; 0 != predef.dynamic_data(j).name; ++j) {
         predefined_macros::dynamic_macros const& m = predef.dynamic_data(j);

Modified: trunk/boost/wave/util/cpp_macromap_utils.hpp
==============================================================================
--- trunk/boost/wave/util/cpp_macromap_utils.hpp (original)
+++ trunk/boost/wave/util/cpp_macromap_utils.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -2,7 +2,7 @@
     Boost.Wave: A Standard compliant C++ preprocessor library
 
     Token sequence analysis and transformation helper functions
-
+
     http://www.boost.org/
 
     Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost
@@ -49,7 +49,7 @@
     public:
         pop_front(ContainerT &list_) : list(list_) {}
         ~pop_front() { list.pop_front(); }
-
+
     private:
         ContainerT &list;
     };
@@ -141,13 +141,13 @@
 {
     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__" ||
@@ -170,12 +170,12 @@
 token_equals(TokenT const &left, TokenT const &right)
 {
     using namespace boost::wave;
-
+
     if (IS_CATEGORY(left, ParameterTokenType)) {
     // if the existing token is of type T_PARAMETERBASE, then the right token
     // must be of type T_IDENTIFIER or a keyword
     token_id id = token_id(right);
-
+
         return (T_IDENTIFIER == id ||
                 IS_CATEGORY(id, KeywordTokenType) ||
                 IS_EXTCATEGORY(id, OperatorTokenType|AltExtTokenType) ||
@@ -201,12 +201,12 @@
     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 && first2 != last2 && token_equals(*first1, *first2))
     {
     // skip whitespace, if both sequences have a whitespace next
@@ -248,7 +248,7 @@
         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();
@@ -283,7 +283,7 @@
     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;
@@ -296,18 +296,18 @@
             }
         }
     }
-
+
 // 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;
@@ -337,7 +337,7 @@
     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;
@@ -349,7 +349,7 @@
                 ++it;
             }
         }
-
+
     // remove all 'new' leading and trailing whitespace
         trim_replacement_list(replacement_list);
     }
@@ -365,7 +365,7 @@
 trim_sequence_left (ContainerT &argument)
 {
     using namespace boost::wave;
-
+
 // strip leading whitespace (should be only one token)
     if (argument.size() > 0 &&
         IS_CATEGORY(argument.front(), WhiteSpaceTokenType))
@@ -384,7 +384,7 @@
 trim_sequence_right (ContainerT &argument)
 {
     using namespace boost::wave;
-
+
 // strip trailing whitespace (should be only one token)
     if (argument.size() > 0 &&
         IS_CATEGORY(argument.back(), WhiteSpaceTokenType))
@@ -480,7 +480,7 @@
 class find_concat_operator {
 public:
     find_concat_operator(bool &found_) : found_concat(found_) {}
-
+
     template <typename TokenT>
     bool operator()(TokenT const &tok)
     {
@@ -501,7 +501,7 @@
 struct to_string_helper
 {
     typedef Target type;
-
+
     static Target call(Src const& str)
     {
         return Target(str.c_str());

Modified: trunk/boost/wave/util/functor_input.hpp
==============================================================================
--- trunk/boost/wave/util/functor_input.hpp (original)
+++ trunk/boost/wave/util/functor_input.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -62,7 +62,7 @@
             value_type curtok;
             bool was_initialized;
         };
-
+
        // Needed by compilers not implementing the resolution to DR45. For
        // reference, see
        // http://www.open-std.org/JTC1/SC22/WG21/docs/cwg_defects.html#45.
@@ -102,7 +102,7 @@
         {
             boost::spirit::classic::impl::mp_swap(data, x.data);
         }
-
+
         void ensure_initialized() const
         {
             if (data && !data->was_initialized) {
@@ -110,7 +110,7 @@
                 data->was_initialized = true;
             }
         }
-
+
     public:
         reference get_input() const
         {

Modified: trunk/boost/wave/util/macro_definition.hpp
==============================================================================
--- trunk/boost/wave/util/macro_definition.hpp (original)
+++ trunk/boost/wave/util/macro_definition.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -48,7 +48,7 @@
 
     typedef std::vector<TokenT> parameter_container_type;
     typedef ContainerT definition_container_type;
-
+
     typedef typename parameter_container_type::const_iterator
         const_parameter_iterator_t;
     typedef typename definition_container_type::const_iterator
@@ -76,14 +76,14 @@
     void replace_parameters()
     {
         using namespace boost::wave;
-
+
         if (!replaced_parameters) {
         typename definition_container_type::iterator end = macrodefinition.end();
         typename definition_container_type::iterator it = macrodefinition.begin();
 
             for (/**/; it != end; ++it) {
             token_id id = *it;
-
+
                 if (T_IDENTIFIER == id ||
                     IS_CATEGORY(id, KeywordTokenType) ||
                     IS_EXTCATEGORY(id, OperatorTokenType|AltExtTokenType) ||
@@ -111,7 +111,7 @@
                     }
                 }
             }
-
+
 #if BOOST_WAVE_SUPPORT_VARIADICS_PLACEMARKERS != 0
         // we need to know, if the last of the formal arguments is an ellipsis
             if (macroparameters.size() > 0 &&

Modified: trunk/boost/wave/util/symbol_table.hpp
==============================================================================
--- trunk/boost/wave/util/symbol_table.hpp (original)
+++ trunk/boost/wave/util/symbol_table.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -57,11 +57,11 @@
 #endif
     typedef typename base_type::iterator iterator_type;
     typedef typename base_type::const_iterator const_iterator_type;
-
+
     symbol_table(long uid_ = 0)
     {}
-
-#if BOOST_WAVE_SERIALIZATION != 0
+
+#if BOOST_WAVE_SERIALIZATION != 0
 private:
     friend class boost::serialization::access;
     template<typename Archive>

Modified: trunk/boost/wave/util/transform_iterator.hpp
==============================================================================
--- trunk/boost/wave/util/transform_iterator.hpp (original)
+++ trunk/boost/wave/util/transform_iterator.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -13,9 +13,7 @@
 
 #include <boost/config.hpp>
 #include <boost/iterator_adaptors.hpp>
-#if BOOST_ITERATOR_ADAPTORS_VERSION >= 0x0200
 #include <boost/iterator/transform_iterator.hpp>
-#endif // BOOST_ITERATOR_ADAPTORS_VERSION >= 0x0200
 
 #include <boost/assert.hpp>
 
@@ -29,82 +27,6 @@
 namespace wave {
 namespace impl {
 
-#if BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// Transform Iterator Adaptor
-//
-// Upon deference, apply some unary function object and return the
-// result by reference.
-//
-// This class is adapted from the Boost.Iterator library, where a similar
-// class exists, which returns the next item by value
-//
-///////////////////////////////////////////////////////////////////////////////
- template <class AdaptableUnaryFunctionT>
- struct ref_transform_iterator_policies
- : public boost::default_iterator_policies
- {
- ref_transform_iterator_policies()
- {}
- ref_transform_iterator_policies(const AdaptableUnaryFunctionT &f)
- : m_f(f) {}
-
- template <class IteratorAdaptorT>
- typename IteratorAdaptorT::reference
- dereference(const IteratorAdaptorT &iter) const
- { return m_f(*iter.base()); }
-
- AdaptableUnaryFunctionT m_f;
- };
-
- template <class AdaptableUnaryFunctionT, class IteratorT>
- class ref_transform_iterator_generator
- {
- typedef typename AdaptableUnaryFunctionT::result_type value_type;
-
- public:
- typedef boost::iterator_adaptor<
- IteratorT,
- ref_transform_iterator_policies<AdaptableUnaryFunctionT>,
- value_type, value_type const &, value_type const *,
- std::input_iterator_tag>
- type;
- };
-
- template <class AdaptableUnaryFunctionT, class IteratorT>
- inline
- typename ref_transform_iterator_generator<
- AdaptableUnaryFunctionT, IteratorT>::type
- make_ref_transform_iterator(
- IteratorT base,
- const AdaptableUnaryFunctionT &f = AdaptableUnaryFunctionT())
- {
- typedef typename ref_transform_iterator_generator<
- AdaptableUnaryFunctionT, IteratorT>::type
- result_t;
- return result_t(base, f);
- }
-
- // Retrieve the token value given a parse node
- // This is used in conjunction with the ref_transform_iterator above, to
- // get the token values while iterating directly over the parse tree.
- template <typename TokenT, typename ParseTreeNodeT>
- struct get_token_value {
-
- typedef TokenT result_type;
-
- TokenT const &operator()(ParseTreeNodeT const &node) const
- {
- BOOST_ASSERT(1 == std::distance(node.value.begin(),
- node.value.end()));
- return *node.value.begin();
- }
- };
-
-#else // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
-
 ///////////////////////////////////////////////////////////////////////////////
 //
 // The new Boost.Iterator library already conatins a transform_iterator usable
@@ -116,7 +38,7 @@
     {
         typedef typename AdaptableUnaryFunctionT::result_type return_type;
         typedef typename AdaptableUnaryFunctionT::argument_type argument_type;
-
+
     public:
         typedef boost::transform_iterator<
                 return_type (*)(argument_type), IteratorT, return_type>
@@ -144,7 +66,7 @@
 
         typedef TokenT const &result_type;
         typedef ParseTreeNodeT const &argument_type;
-
+
         static result_type
         transform (argument_type node)
         {
@@ -154,8 +76,6 @@
         }
     };
 
-#endif // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
-
 ///////////////////////////////////////////////////////////////////////////////
 } // namespace impl
 } // namespace wave

Modified: trunk/boost/wave/util/unput_queue_iterator.hpp
==============================================================================
--- trunk/boost/wave/util/unput_queue_iterator.hpp (original)
+++ trunk/boost/wave/util/unput_queue_iterator.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -30,116 +30,6 @@
 namespace wave {
 namespace util {
 
-#if !defined(BOOST_ITERATOR_ADAPTORS_VERSION) || \
- BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
-
-template <typename TokenT, typename ContainerT>
-class unput_queue_policies : public boost::default_iterator_policies
-{
-public:
- unput_queue_policies(ContainerT &unput_queue_)
- : unput_queue(unput_queue_)
- {}
-
- unput_queue_policies &operator= (unput_queue_policies const &rhs)
- {
- unput_queue = rhs.unput_queue;
- return *this;
- }
-
- template <typename BaseT>
- void initialize(BaseT &)
- {}
-
- template <typename IteratorAdaptorT>
- typename IteratorAdaptorT::reference
- dereference(const IteratorAdaptorT &x) const
- {
- if (x.policies().unput_queue.size() > 0)
- return x.policies().unput_queue.front();
- return *x.base();
- }
-
- template <typename IteratorAdaptorT>
- void
- increment(IteratorAdaptorT &x)
- {
- if (x.policies().unput_queue.size() > 0) {
- // there exist pending tokens in the unput queue
- x.policies().unput_queue.pop_front();
- }
- else {
- // the unput_queue is empty, so advance the base iterator
- ++x.base();
- }
- }
-
- template <typename IteratorAdaptorT1, typename IteratorAdaptorT2>
- bool
- 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 are equal as well
- return
- (x.policies().unput_queue.begin() == y.policies().unput_queue.begin() ||
- (0 == x.policies().queuesize() && 0 == y.policies().queuesize())) &&
- x.base() == y.base();
- }
-
- typename ContainerT::size_type queuesize() const
- { return unput_queue.size(); }
-
- ContainerT &get_unput_queue() { return unput_queue; }
- ContainerT const &get_unput_queue() const { return unput_queue; }
-
-private:
- ContainerT &unput_queue;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-//
-// unput_queue_iterator
-//
-// 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 old iterator_adaptors (Boost V1.30.x)
-//
-///////////////////////////////////////////////////////////////////////////////
-template <typename IteratorT, typename TokenT, typename ContainerT>
-class unput_queue_iterator
-: public boost::iterator_adaptor<
- IteratorT, unput_queue_policies<TokenT, ContainerT>, TokenT,
- TokenT const &, TokenT const *>
-{
- typedef
- boost::iterator_adaptor<
- IteratorT, unput_queue_policies<TokenT, ContainerT>, TokenT,
- TokenT const &, TokenT const *
- >
- base_type;
- typedef unput_queue_policies<TokenT, ContainerT> policies_type;
-
-public:
- typedef ContainerT container_type;
- typedef IteratorT iterator_type;
-
- unput_queue_iterator(IteratorT const &it, ContainerT &queue)
- : base_type(it, policies_type(queue))
- {}
-
- 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
-
 ///////////////////////////////////////////////////////////////////////////////
 //
 // unput_queue_iterator
@@ -161,7 +51,7 @@
                 unput_queue_iterator<IteratorT, TokenT, ContainerT>,
                 IteratorT, TokenT const, std::forward_iterator_tag>
         base_type;
-
+
 public:
     typedef ContainerT container_type;
     typedef IteratorT iterator_type;
@@ -231,8 +121,6 @@
     ContainerT &unput_queue;
 };
 
-#endif // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
-
 namespace impl {
 
     ///////////////////////////////////////////////////////////////////////////
@@ -243,9 +131,9 @@
         typedef IteratorT iterator_type;
         typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
             return_type;
-
+
         static container_type last;
-
+
         static return_type
         generate(iterator_type const &it)
         {
@@ -258,7 +146,7 @@
             return return_type(it, queue);
         }
     };
-
+
     template <typename IteratorT, typename TokenT, typename ContainerT>
     typename gen_unput_queue_iterator<IteratorT, TokenT, ContainerT>::
           container_type
@@ -277,52 +165,32 @@
             iterator_type;
         typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
             return_type;
-
+
         static container_type last;
-
+
         static return_type
         generate(iterator_type &it)
         {
- return return_t(it.base(), last);
+ return return_type(it.base(), last);
         }
 
         static return_type
         generate(ContainerT &queue, iterator_type &it)
         {
- return return_t(it.base(), queue);
+ return return_type(it.base(), queue);
         }
     };
-
+
     ///////////////////////////////////////////////////////////////////////////
     template <typename IteratorT>
- struct assign_iterator {
-
+ struct assign_iterator
+ {
         static void
         do_ (IteratorT &dest, IteratorT const &src)
         {
             dest = src;
         }
     };
-
-#if !defined(BOOST_ITERATOR_ADAPTORS_VERSION) || \
- BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
-
- template <typename IteratorT, typename TokenT, typename ContainerT>
- struct assign_iterator<
- unput_queue_iterator<IteratorT, TokenT, ContainerT> >
- {
- typedef unput_queue_iterator<IteratorT, TokenT, ContainerT>
- iterator_type;
-
- static void
- do_ (iterator_type &dest, iterator_type const &src)
- {
- dest.base() = src.base();
- dest.policies() = src.policies();
- }
- };
-
-#endif // BOOST_ITERATOR_ADAPTORS_VERSION < 0x0200
 
     ///////////////////////////////////////////////////////////////////////////
     //
@@ -330,8 +198,8 @@
     // Note though, that the embedded unput_queues are not touched in any way!
     //
     template <typename IteratorT>
- struct next_token {
-
+ struct next_token
+ {
         static boost::wave::token_id
         peek(IteratorT it, IteratorT end, bool skip_whitespace = true)
         {
@@ -353,20 +221,20 @@
             return T_EOI;
         }
     };
-
+
     template <typename IteratorT, typename TokenT, typename ContainerT>
     struct next_token<
         unput_queue_iterator<IteratorT, TokenT, ContainerT> > {
-
+
         typedef unput_queue_iterator<IteratorT, TokenT, ContainerT> iterator_type;
-
+
         static boost::wave::token_id
         peek(iterator_type it, iterator_type end, bool skip_whitespace = true)
         {
             using namespace boost::wave;
-
+
         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_type::iterator cit = queue.begin();
@@ -387,7 +255,7 @@
                 if (cit != cend)
                     return token_id(*cit);
             }
-
+
         // second try to move on into the base iterator stream
         typename iterator_type::iterator_type base_it = it.get_base_iterator();
         typename iterator_type::iterator_type base_end = end.get_base_iterator();

Modified: trunk/boost/wave/wave_config.hpp
==============================================================================
--- trunk/boost/wave/wave_config.hpp (original)
+++ trunk/boost/wave/wave_config.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -332,7 +332,7 @@
 // Decide, whether to support long long integers in the preprocessor.
 //
 // The C++ standard requires the preprocessor to use one of the following
-// types for integer literals: long or unsigned long depending on a optional
+// types for integer literals: long or unsigned long depending on an optional
 // suffix ('u', 'l', 'ul', or 'lu')
 //
 // Sometimes it's required to preprocess integer literals bigger than that

Modified: trunk/boost/wave/wave_version.hpp
==============================================================================
--- trunk/boost/wave/wave_version.hpp (original)
+++ trunk/boost/wave/wave_version.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -2,7 +2,7 @@
     Boost.Wave: A Standard compliant C++ preprocessor library
 
     This is the current version of the Wave library
-
+
     http://www.boost.org/
 
     Copyright (c) 2001-2009 Hartmut Kaiser. Distributed under the Boost

Modified: trunk/boost/wave/whitespace_handling.hpp
==============================================================================
--- trunk/boost/wave/whitespace_handling.hpp (original)
+++ trunk/boost/wave/whitespace_handling.hpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -73,7 +73,7 @@
 {
 public:
     eat_whitespace();
-
+
     template <typename ContextT>
     bool may_skip_whitespace(ContextT const& ctx, TokenT &token,
         bool &skipped_newline);
@@ -83,7 +83,7 @@
     {
         return !preserve_comments && T_CPPCOMMENT == id;
     }
-
+
 private:
     typedef bool state_t(TokenT &token, bool &skipped_newline);
     state_t eat_whitespace::* state;
@@ -172,7 +172,7 @@
 eat_whitespace<TokenT>::newline_2nd(TokenT &token, bool &skipped_newline)
 {
     using namespace boost::wave;
-
+
     token_id id = token_id(token);
     if (T_SPACE == id || T_SPACE2 == id)
         return true;
@@ -198,14 +198,14 @@
 eat_whitespace<TokenT>::whitespace(TokenT &token, bool &skipped_newline)
 {
     using namespace boost::wave;
-
+
     token_id id = token_id(token);
     if (T_SPACE != id && T_SPACE2 != id &&
         T_CCOMMENT != id && T_CPPCOMMENT != id)
     {
         return general(token, skipped_newline);
     }
-
+
     if (T_CCOMMENT == id) {
         if (util::ccomment_has_newline(token))
             skipped_newline = true;

Modified: trunk/libs/wave/ChangeLog
==============================================================================
--- trunk/libs/wave/ChangeLog (original)
+++ trunk/libs/wave/ChangeLog 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -30,6 +30,8 @@
 - Finally fixed all remaining examples. Everything seems to work fine now.
 - Specifying a custom token type now works as expected. The new lexer interface
   introduced in V2.0 broke this part.
+- Fixed a long standing race condition inhibiting to use Wave in multi threaded
+ environments.
 
 Boost V1.39.0
 - V2.0.1

Modified: trunk/libs/wave/src/cpplexer/re2clex/cpp_re.cpp
==============================================================================
--- trunk/libs/wave/src/cpplexer/re2clex/cpp_re.cpp (original)
+++ trunk/libs/wave/src/cpplexer/re2clex/cpp_re.cpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -162,7 +162,7 @@
 {
     std::size_t diff, offset;
     int skipped = 0;
-
+
     /* figure out how many backslash-newlines skipped over unknowingly. */
     diff = cursor - s->bot;
     offset = get_first_eol_offset(s);
@@ -219,7 +219,7 @@
                 }
                 else
                     printf("Out of memory!\n");
-
+
                 /* get the scanner to stop */
                 *cursor = 0;
                 return cursor;
@@ -346,7 +346,7 @@
                 aq_enqueue(s->eol_offsets, cnt + (s->lim - s->bot));
             }
         }
-
+
         s->lim += cnt;
         if (s->eof) /* eof needs adjusting if we erased backslash-newlines */
         {
@@ -364,37 +364,37 @@
     uchar_wrapper (uchar *base_cursor, unsigned int column = 1)
     : base_cursor(base_cursor), column(column)
     {}
-
+
     uchar_wrapper& operator++()
     {
         ++base_cursor;
         ++column;
         return *this;
     }
-
+
     uchar_wrapper& operator--()
     {
         --base_cursor;
         --column;
         return *this;
     }
-
+
     uchar operator* () const
     {
         return *base_cursor;
     }
-
+
     operator uchar *() const
     {
         return base_cursor;
     }
-
+
     friend std::ptrdiff_t
     operator- (uchar_wrapper const& lhs, uchar_wrapper const& rhs)
     {
         return lhs.base_cursor - rhs.base_cursor;
     }
-
+
     uchar *base_cursor;
     unsigned int column;
 };
@@ -403,7 +403,7 @@
 boost::wave::token_id scan(Scanner *s)
 {
     BOOST_ASSERT(0 != s->error_proc); // error handler must be given
-
+
     uchar_wrapper cursor (s->tok = s->cur, s->column = s->curr_column);
     uchar_wrapper marker (s->ptr);
     uchar_wrapper limit (s->lim);

Modified: trunk/libs/wave/test/testwave/testwave.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave.cpp (original)
+++ trunk/libs/wave/test/testwave/testwave.cpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -167,12 +167,12 @@
                 if (cvm.count("input")) {
                     std::vector<std::string> const &infiles =
                         cvm["input"].as<std::vector<std::string> >();
-
+
                     if (9 == app.get_debuglevel()) {
                         std::cerr << "found " << (unsigned)infiles.size()
                                   << " entries" << std::endl;
                     }
-
+
                     std::vector<std::string>::const_iterator iend = infiles.end();
                     for (std::vector<std::string>::const_iterator iit = infiles.begin();
                          iit != iend; ++iit)
@@ -184,14 +184,14 @@
                         fs::path filepath =
                             boost::wave::util::branch_path(cfgpath) /
                                 boost::wave::util::create_path(*iit);
-
+
                         if (9 == app.get_debuglevel()) {
                             std::cerr << std::string(79, '-') << std::endl;
                             std::cerr << "executing test: "
                                       << boost::wave::util::native_file_string(filepath)
                                       << std::endl;
                         }
-
+
                     // execute this unit test case
                         if (!app.test_a_file(
                               boost::wave::util::native_file_string(filepath)))
@@ -209,7 +209,7 @@
                                       << std::endl;
                         }
                         ++input_count;
-
+
                         if (9 == app.get_debuglevel()) {
                             std::cerr << std::string(79, '-') << std::endl;
                         }
@@ -244,7 +244,7 @@
                           << boost::wave::util::native_file_string(filepath)
                           << std::endl;
             }
-
+
             if (!app.test_a_file(boost::wave::util::native_file_string(filepath)))
             {
                 if (9 == app.get_debuglevel()) {

Modified: trunk/libs/wave/test/testwave/testwave_app.cpp
==============================================================================
--- trunk/libs/wave/test/testwave/testwave_app.cpp (original)
+++ trunk/libs/wave/test/testwave/testwave_app.cpp 2009-05-23 00:15:22 EDT (Sat, 23 May 2009)
@@ -53,8 +53,8 @@
         std::string &result)
     {
         typedef typename Iterator::value_type token_type;
-
- token_type tok = *it++;
+
+ token_type tok = *it++;
         result = result + tok.get_value().c_str();
         return (it == end) ? false : true;
     }
@@ -64,7 +64,7 @@
     String const& handle_quoted_filepath(String &name)
     {
         using boost::wave::util::impl::unescape_lit;
-
+
         String unesc_name = unescape_lit(name.substr(1, name.size()-2));
         fs::path p (boost::wave::util::create_path(unesc_name.c_str()));
 
@@ -79,7 +79,7 @@
     {
         typedef typename Iterator::value_type token_type;
         typedef typename token_type::string_type string_type;
-
+
         if (!handle_next_token(it, end, result) || // #line
             !handle_next_token(it, end, result) || // whitespace
             !handle_next_token(it, end, result) || // number
@@ -87,7 +87,7 @@
         {
             return false;
         }
-
+
         using boost::wave::util::impl::unescape_lit;
         
         token_type filename = *it;
@@ -133,11 +133,11 @@
     std::string const& result, std::string& expected)
 {
     using boost::wave::util::impl::escape_lit;
-
+
     std::string full_result;
     std::string::size_type pos = 0;
     std::string::size_type pos1 = expected.find_first_of("$");
-
+
     if (pos1 != std::string::npos) {
         do {
             switch(expected[pos1+1]) {
@@ -168,7 +168,7 @@
                     }
                 }
                 break;
-
+
             case 'F': // insert base file name
                 full_result = full_result +
                     expected.substr(pos, pos1-pos) + escape_lit(filename);
@@ -183,7 +183,7 @@
                             boost::wave::util::create_path(filename),
                             boost::wave::util::current_path())
                         );
-
+
                     if ('(' == expected[pos1+2]) {
                     // the $P(basename) syntax is used
                         std::size_t p = expected.find_first_of(")", pos1+1);
@@ -224,7 +224,7 @@
                     }
                 }
                 break;
-
+
             case 'V': // insert Boost version
                 full_result = full_result +
                     expected.substr(pos, pos1-pos) + BOOST_LIB_VERSION;
@@ -244,7 +244,7 @@
     else {
         full_result = expected;
     }
-
+
     expected = full_result;
     return full_result == result;
 }


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk