Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61105 - in branches/release: . boost boost/algorithm/string boost/bimap boost/config boost/detail boost/filesystem boost/fusion boost/graph boost/interprocess boost/intrusive boost/math boost/numeric/ublas boost/program_options boost/property_tree boost/regex boost/serialization boost/signals boost/signals2 boost/spirit boost/spirit/home boost/spirit/home/karma boost/spirit/home/karma/detail boost/spirit/home/karma/stream/detail boost/spirit/home/support boost/spirit/home/support/iterators boost/spirit/home/support/iterators/detail boost/system boost/tr1 boost/type_traits boost/utility boost/uuid boost/variant boost/wave boost/wave/util doc libs libs/array/doc libs/array/test libs/bimap libs/config libs/filesystem libs/fusion libs/graph_parallel libs/interprocess libs/intrusive libs/math libs/mpl/doc/refmanual libs/mpl/doc/src/refmanual libs/numeric/ublas libs/numeric/ublas/doc libs/program_options libs/property_tree libs/regex libs/regex/doc libs/serialization libs/signals libs/signals2 libs/spirit libs/spirit/classic/example libs/spirit/doc libs/spirit/example libs/spirit/phoenix libs/spirit/test libs/spirit/test/qi libs/static_assert libs/system libs/timer libs/tr1 libs/type_traits libs/utility libs/uuid libs/wave libs/wave/samples libs/wave/samples/custom_directives libs/wave/samples/custom_directives/build libs/wave/samples/emit_custom_line_directives libs/wave/samples/emit_custom_line_directives/build libs/wave/test/testwave libs/wave/test/testwave/testfiles more people status tools tools/bcp tools/build/v2 tools/inspect tools/regression tools/release tools/wave wiki
From: hartmut.kaiser_at_[hidden]
Date: 2010-04-06 11:43:55


Author: hkaiser
Date: 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
New Revision: 61105
URL: http://svn.boost.org/trac/boost/changeset/61105

Log:
Wave: merging from trunk
Added:
   branches/release/boost/spirit/home/support/iterators/ostream_iterator.hpp
      - copied unchanged from r58995, /trunk/boost/spirit/home/support/iterators/ostream_iterator.hpp
   branches/release/libs/wave/samples/custom_directives/
      - copied from r59538, /trunk/libs/wave/samples/custom_directives/
   branches/release/libs/wave/samples/custom_directives/build/ (props changed)
      - copied from r59538, /trunk/libs/wave/samples/custom_directives/build/
   branches/release/libs/wave/samples/custom_directives/build/Jamfile.v2
      - copied unchanged from r59538, /trunk/libs/wave/samples/custom_directives/build/Jamfile.v2
   branches/release/libs/wave/samples/custom_directives/custom_directives.cpp
      - copied unchanged from r59538, /trunk/libs/wave/samples/custom_directives/custom_directives.cpp
   branches/release/libs/wave/samples/custom_directives/custom_directives.hpp
      - copied, changed from r59538, /trunk/libs/wave/samples/custom_directives/custom_directives.hpp
   branches/release/libs/wave/samples/custom_directives/custom_directives.input
      - copied, changed from r59538, /trunk/libs/wave/samples/custom_directives/custom_directives.input
   branches/release/libs/wave/samples/emit_custom_line_directives/
      - copied from r60820, /trunk/libs/wave/samples/emit_custom_line_directives/
   branches/release/libs/wave/samples/emit_custom_line_directives/build/ (props changed)
      - copied from r60820, /trunk/libs/wave/samples/emit_custom_line_directives/build/
   branches/release/libs/wave/samples/emit_custom_line_directives/build/Jamfile.v2
      - copied unchanged from r60820, /trunk/libs/wave/samples/emit_custom_line_directives/build/Jamfile.v2
   branches/release/libs/wave/samples/emit_custom_line_directives/emit_custom_line_directives.cpp
      - copied unchanged from r60820, /trunk/libs/wave/samples/emit_custom_line_directives/emit_custom_line_directives.cpp
   branches/release/libs/wave/samples/emit_custom_line_directives/emit_custom_line_directives.hpp
      - copied unchanged from r60820, /trunk/libs/wave/samples/emit_custom_line_directives/emit_custom_line_directives.hpp
Properties modified:
   branches/release/ (props changed)
   branches/release/CMakeLists.txt (props changed)
   branches/release/INSTALL (props changed)
   branches/release/Jamroot (props changed)
   branches/release/LICENSE_1_0.txt (props changed)
   branches/release/boost/ (props changed)
   branches/release/boost-build.jam (props changed)
   branches/release/boost.css (props changed)
   branches/release/boost.png (props changed)
   branches/release/boost/algorithm/string/ (props changed)
   branches/release/boost/array.hpp (props changed)
   branches/release/boost/bimap/ (props changed)
   branches/release/boost/config/ (props changed)
   branches/release/boost/detail/ (props changed)
   branches/release/boost/filesystem/ (props changed)
   branches/release/boost/fusion/ (props changed)
   branches/release/boost/graph/ (props changed)
   branches/release/boost/interprocess/ (props changed)
   branches/release/boost/intrusive/ (props changed)
   branches/release/boost/math/ (props changed)
   branches/release/boost/numeric/ublas/ (props changed)
   branches/release/boost/program_options/ (props changed)
   branches/release/boost/property_tree/ (props changed)
   branches/release/boost/regex/ (props changed)
   branches/release/boost/serialization/ (props changed)
   branches/release/boost/signals/ (props changed)
   branches/release/boost/signals2/ (props changed)
   branches/release/boost/spirit/ (props changed)
   branches/release/boost/spirit/home/ (props changed)
   branches/release/boost/spirit/home/karma/ (props changed)
   branches/release/boost/spirit/home/support/attributes.hpp (props changed)
   branches/release/boost/system/ (props changed)
   branches/release/boost/tr1/ (props changed)
   branches/release/boost/type_traits/ (props changed)
   branches/release/boost/utility/ (props changed)
   branches/release/boost/utility/value_init.hpp (props changed)
   branches/release/boost/uuid/ (props changed)
   branches/release/boost/variant/ (props changed)
   branches/release/boost/version.hpp (props changed)
   branches/release/boost/wave/ (props changed)
   branches/release/bootstrap.bat (props changed)
   branches/release/bootstrap.sh (props changed)
   branches/release/doc/ (props changed)
   branches/release/index.htm (props changed)
   branches/release/index.html (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/array/doc/array.xml (props changed)
   branches/release/libs/array/test/array0.cpp (props changed)
   branches/release/libs/bimap/ (props changed)
   branches/release/libs/config/ (props changed)
   branches/release/libs/filesystem/ (props changed)
   branches/release/libs/fusion/ (props changed)
   branches/release/libs/graph_parallel/ (props changed)
   branches/release/libs/interprocess/ (props changed)
   branches/release/libs/intrusive/ (props changed)
   branches/release/libs/libraries.htm (props changed)
   branches/release/libs/maintainers.txt (props changed)
   branches/release/libs/math/ (props changed)
   branches/release/libs/mpl/doc/refmanual/broken-compiler-workarounds.html (props changed)
   branches/release/libs/mpl/doc/refmanual/categorized-index-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/cfg-no-preprocessed-headers.html (props changed)
   branches/release/libs/mpl/doc/refmanual/composition-and-argument-binding.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-concepts.html (props changed)
   branches/release/libs/mpl/doc/refmanual/data-types-miscellaneous.html (props changed)
   branches/release/libs/mpl/doc/refmanual/extensible-associative-sequence.html (props changed)
   branches/release/libs/mpl/doc/refmanual/inserter-class.html (props changed)
   branches/release/libs/mpl/doc/refmanual/tag-dispatched-metafunction.html (props changed)
   branches/release/libs/mpl/doc/refmanual/trivial-metafunctions-summary.html (props changed)
   branches/release/libs/mpl/doc/src/refmanual/Iterators-Iterator.rst (props changed)
   branches/release/libs/numeric/ublas/ (props changed)
   branches/release/libs/numeric/ublas/doc/ (props changed)
   branches/release/libs/program_options/ (props changed)
   branches/release/libs/property_tree/ (props changed)
   branches/release/libs/regex/ (props changed)
   branches/release/libs/regex/doc/ (props changed)
   branches/release/libs/serialization/ (props changed)
   branches/release/libs/signals/ (props changed)
   branches/release/libs/signals2/ (props changed)
   branches/release/libs/spirit/ (props changed)
   branches/release/libs/spirit/classic/example/ (props changed)
   branches/release/libs/spirit/doc/ (props changed)
   branches/release/libs/spirit/example/ (props changed)
   branches/release/libs/spirit/phoenix/ (props changed)
   branches/release/libs/spirit/test/ (props changed)
   branches/release/libs/spirit/test/qi/optional.cpp (props changed)
   branches/release/libs/static_assert/ (props changed)
   branches/release/libs/system/ (props changed)
   branches/release/libs/timer/ (props changed)
   branches/release/libs/tr1/ (props changed)
   branches/release/libs/type_traits/ (props changed)
   branches/release/libs/utility/ (props changed)
   branches/release/libs/utility/swap.html (props changed)
   branches/release/libs/utility/value_init.htm (props changed)
   branches/release/libs/utility/value_init_test.cpp (props changed)
   branches/release/libs/uuid/ (props changed)
   branches/release/libs/wave/ (props changed)
   branches/release/more/ (props changed)
   branches/release/people/ (props changed)
   branches/release/rst.css (props changed)
   branches/release/status/ (props changed)
   branches/release/status/Jamfile.v2 (props changed)
   branches/release/tools/ (props changed)
   branches/release/tools/bcp/ (props changed)
   branches/release/tools/build/v2/ (props changed)
   branches/release/tools/inspect/ (props changed)
   branches/release/tools/regression/ (props changed)
   branches/release/tools/release/ (props changed)
   branches/release/tools/wave/ (props changed)
   branches/release/wiki/ (props changed)
Text files modified:
   branches/release/boost/spirit/home/karma/detail/output_iterator.hpp | 2
   branches/release/boost/spirit/home/karma/stream.hpp | 2
   branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp | 2
   branches/release/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp | 2
   branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp | 2
   branches/release/boost/spirit/home/support/iterators/detail/multi_pass.hpp | 9 -
   branches/release/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp | 2
   branches/release/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp | 2
   branches/release/boost/spirit/home/support/iterators/multi_pass.hpp | 2
   branches/release/boost/spirit/home/support/iterators/multi_pass_fwd.hpp | 6 -
   branches/release/boost/wave/cpp_context.hpp | 21 +++
   branches/release/boost/wave/cpp_iteration_context.hpp | 10 +
   branches/release/boost/wave/preprocessing_hooks.hpp | 58 ++++++++++++
   branches/release/boost/wave/util/cpp_include_paths.hpp | 46 +++++++++
   branches/release/boost/wave/util/cpp_iterator.hpp | 190 ++++++++++++++++++++++++---------------
   branches/release/boost/wave/util/pattern_parser.hpp | 3
   branches/release/boost/wave/wave_version.hpp | 4
   branches/release/libs/wave/ChangeLog | 25 +++++
   branches/release/libs/wave/samples/Jamfile.v2 | 2
   branches/release/libs/wave/samples/custom_directives/custom_directives.hpp | 7 -
   branches/release/libs/wave/samples/custom_directives/custom_directives.input | 2
   branches/release/libs/wave/test/testwave/collect_hooks_information.hpp | 34 +++++++
   branches/release/libs/wave/test/testwave/testfiles/t_2_005.cpp | 3
   branches/release/libs/wave/test/testwave/testfiles/t_2_019.cpp | 6
   branches/release/libs/wave/test/testwave/testfiles/t_6_063.cpp | 2
   branches/release/libs/wave/test/testwave/testfiles/t_6_067.cpp | 2
   branches/release/libs/wave/test/testwave/testfiles/t_9_016.cpp | 2
   branches/release/libs/wave/test/testwave/testwave_app.cpp | 3
   branches/release/tools/wave/cpp.cpp | 9 +
   branches/release/tools/wave/cpp_version.hpp | 4
   branches/release/tools/wave/trace_macro_expansion.hpp | 99 ++++++++++++++++++++
   31 files changed, 429 insertions(+), 134 deletions(-)

Modified: branches/release/boost/spirit/home/karma/detail/output_iterator.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/detail/output_iterator.hpp (original)
+++ branches/release/boost/spirit/home/karma/detail/output_iterator.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -19,7 +19,7 @@
 #include <boost/mpl/if.hpp>
 
 #include <boost/spirit/home/karma/generator.hpp>
-#include <boost/spirit/home/karma/stream/ostream_iterator.hpp>
+#include <boost/spirit/home/support/iterators/ostream_iterator.hpp>
 #include <boost/spirit/home/support/unused.hpp>
 
 namespace boost { namespace spirit { namespace karma { namespace detail

Modified: branches/release/boost/spirit/home/karma/stream.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -10,7 +10,7 @@
 #pragma once
 #endif
 
-#include <boost/spirit/home/karma/stream/ostream_iterator.hpp>
+#include <boost/spirit/home/support/iterators/ostream_iterator.hpp>
 #include <boost/spirit/home/karma/stream/stream.hpp>
 
 #endif

Modified: branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp
==============================================================================
--- branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp (original)
+++ branches/release/boost/spirit/home/karma/stream/detail/format_manip.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -13,7 +13,7 @@
 #include <iterator>
 #include <string>
 #include <boost/spirit/home/karma/generate.hpp>
-#include <boost/spirit/home/karma/stream/ostream_iterator.hpp>
+#include <boost/spirit/home/support/iterators/ostream_iterator.hpp>
 #include <boost/mpl/bool.hpp>
 
 ///////////////////////////////////////////////////////////////////////////////

Modified: branches/release/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/buf_id_check_policy.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -51,7 +51,7 @@
 
             void swap(unique& x)
             {
- spirit::detail::swap(buf_id, x.buf_id);
+ boost::swap(buf_id, x.buf_id);
             }
 
             // called to verify that everything is ok.

Modified: branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/fixed_size_queue_policy.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -45,7 +45,7 @@
 
             void swap(unique& x)
             {
- spirit::detail::swap(queuePosition, x.queuePosition);
+ boost::swap(queuePosition, x.queuePosition);
             }
 
             // This is called when the iterator is dereferenced. It's a

Modified: branches/release/boost/spirit/home/support/iterators/detail/multi_pass.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/multi_pass.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/multi_pass.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -17,15 +17,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 namespace boost { namespace spirit { namespace detail
 {
- ///////////////////////////////////////////////////////////////////////////
- template <typename T>
- inline void swap(T& t1, T& t2)
- {
- using std::swap;
- using boost::spirit::swap;
- swap(t1, t2);
- }
-
 #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
     ///////////////////////////////////////////////////////////////////////////
     // Meta-function to generate a std::iterator<> base class for multi_pass.

Modified: branches/release/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/split_functor_input_policy.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -126,7 +126,7 @@
 
             void swap(unique& x)
             {
- spirit::detail::swap(ftor, x.ftor);
+ boost::swap(ftor, x.ftor);
             }
 
         public:

Modified: branches/release/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/detail/split_std_deque_policy.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -42,7 +42,7 @@
 
             void swap(unique& x)
             {
- spirit::detail::swap(queued_position, x.queued_position);
+ boost::swap(queued_position, x.queued_position);
             }
 
             // This is called when the iterator is dereferenced. It's a

Modified: branches/release/boost/spirit/home/support/iterators/multi_pass.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/multi_pass.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/multi_pass.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -99,7 +99,7 @@
 
         void swap(multi_pass& x)
         {
- spirit::detail::swap(this->member, x.member);
+ boost::swap(this->member, x.member);
             this->policies_base_type::swap(x);
         }
 

Modified: branches/release/boost/spirit/home/support/iterators/multi_pass_fwd.hpp
==============================================================================
--- branches/release/boost/spirit/home/support/iterators/multi_pass_fwd.hpp (original)
+++ branches/release/boost/spirit/home/support/iterators/multi_pass_fwd.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -11,6 +11,7 @@
 
 #include <cstddef>
 #include <boost/spirit/home/support/multi_pass_wrapper.hpp>
+#include <boost/swap.hpp>
 
 namespace boost { namespace spirit {
 
@@ -59,11 +60,6 @@
     template <typename T, typename Policies>
     void swap(multi_pass<T, Policies> &x, multi_pass<T, Policies> &y);
 
- namespace detail
- {
- template <typename T> void swap(T& t1, T& t2);
- }
-
 }} // namespace boost::spirit
 
 namespace boost { namespace spirit { namespace traits

Modified: branches/release/boost/wave/cpp_context.hpp
==============================================================================
--- branches/release/boost/wave/cpp_context.hpp (original)
+++ branches/release/boost/wave/cpp_context.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -136,6 +136,7 @@
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
       , current_filename(fname)
 #endif
+ , current_relative_filename(fname)
       , macros(*this_())
       , language(language_support(
                       support_cpp
@@ -228,16 +229,22 @@
             has_params, is_predefined, pos, parameters, definition);
     }
     template <typename StringT>
- bool remove_macro_definition(StringT const &name,
- bool even_predefined = false)
+ bool remove_macro_definition(StringT const& undefname, bool even_predefined = false)
     {
+ // strip leading and trailing whitespace
+ string_type name = undefname;
+ typename string_type::size_type pos = name.find_first_not_of(" \t");
+ if (pos != string_type::npos) {
+ typename string_type::size_type endpos = name.find_last_not_of(" \t");
+ name = name.substr(pos, endpos-pos+1);
+ }
+
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
         // ensure this gets removed from the list of include guards as well
         includes.remove_pragma_once_header(
             util::to_string<std::string>(name));
 #endif
- return macros.remove_macro(util::to_string<string_type>(name),
- macros.get_main_pos(), even_predefined);
+ return macros.remove_macro(name, macros.get_main_pos(), even_predefined);
     }
     void reset_macro_definitions()
         { macros.reset_macromap(); macros.init_predefined_macros(); }
@@ -417,6 +424,11 @@
     }
 #endif
 
+ void set_current_relative_filename(char const *real_name)
+ { current_relative_filename = real_name; }
+ std::string const &get_current_relative_filename() const
+ { return current_relative_filename; }
+
 #if BOOST_WAVE_SERIALIZATION != 0
 public:
     BOOST_STATIC_CONSTANT(unsigned int, version = 0x10);
@@ -502,6 +514,7 @@
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
     std::string current_filename; // real name of current preprocessed file
 #endif
+ std::string current_relative_filename; // real relative name of current preprocessed file
 
     boost::wave::util::if_block_stack ifblocks; // conditional compilation contexts
     boost::wave::util::include_paths includes; // lists of include directories to search

Modified: branches/release/boost/wave/cpp_iteration_context.hpp
==============================================================================
--- branches/release/boost/wave/cpp_iteration_context.hpp (original)
+++ branches/release/boost/wave/cpp_iteration_context.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -97,20 +97,22 @@
 public:
     base_iteration_context(ContextT& ctx_,
             BOOST_WAVE_STRINGTYPE const &fname, std::size_t if_block_depth = 0)
- : real_filename(fname), filename(fname), line(1), emitted_lines(1),
- if_block_depth(if_block_depth), ctx(ctx_)
+ : real_filename(fname), real_relative_filename(fname), filename(fname),
+ line(1), emitted_lines(0), if_block_depth(if_block_depth), ctx(ctx_)
     {}
     base_iteration_context(ContextT& ctx_,
             IteratorT const &first_, IteratorT const &last_,
             BOOST_WAVE_STRINGTYPE const &fname, std::size_t if_block_depth = 0)
- : first(first_), last(last_), real_filename(fname), filename(fname),
- line(1), emitted_lines(1), if_block_depth(if_block_depth), ctx(ctx_)
+ : first(first_), last(last_), real_filename(fname),
+ real_relative_filename(fname), filename(fname),
+ line(1), emitted_lines(0), if_block_depth(if_block_depth), ctx(ctx_)
     {}
 
 // the actual input stream
     IteratorT first; // actual input stream position
     IteratorT last; // end of input stream
     BOOST_WAVE_STRINGTYPE real_filename; // real name of the current file
+ BOOST_WAVE_STRINGTYPE real_relative_filename; // real relative name of the current file
     BOOST_WAVE_STRINGTYPE filename; // actual processed file
     unsigned int line; // line counter of underlying stream
     unsigned int emitted_lines; // count of emitted newlines

Modified: branches/release/boost/wave/preprocessing_hooks.hpp
==============================================================================
--- branches/release/boost/wave/preprocessing_hooks.hpp (original)
+++ branches/release/boost/wave/preprocessing_hooks.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -374,6 +374,36 @@
 
     ///////////////////////////////////////////////////////////////////////////
     //
+ // The function 'emit_line_directive' is called whenever a #line directive
+ // has to be emitted into the generated output.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'pending' may be used to push tokens back into the input
+ // stream, which are to be used instead of the default output generated
+ // for the #line directive.
+ //
+ // The parameter 'act_token' contains the actual #pragma token, which may
+ // be used for error output. The line number stored in this token can be
+ // used as the line number emitted as part of the #line directive.
+ //
+ // If the return value is 'false', a default #line directive is emitted
+ // by the library. A return value of 'true' will inhibit any further
+ // actions, the tokens contained in 'pending' will be copied verbatim
+ // to the output.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename ContextT, typename ContainerT>
+ bool
+ emit_line_directive(ContextT const& ctx, ContainerT &pending,
+ typename ContextT::token_type const& act_token)
+ {
+ return false;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
     // The function 'defined_macro' is called, whenever a macro was defined
     // successfully.
     //
@@ -477,6 +507,34 @@
 
     ///////////////////////////////////////////////////////////////////////////
     //
+ // The function 'found_unknown_directive' is called, whenever an unknown
+ // preprocessor directive was encountered.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'line' holds the tokens of the entire source line
+ // containing the unknown directive.
+ //
+ // The parameter 'pending' may be used to push tokens back into the input
+ // stream, which are to be used as the replacement text for the whole
+ // line containing the unknown directive.
+ //
+ // The return value defines, whether the given expression has been
+ // properly interpreted by the hook function or not. If this function
+ // returns 'false', the library will raise an 'ill_formed_directive'
+ // preprocess_exception. Otherwise the tokens pushed back into 'pending'
+ // are passed on to the user program.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename ContextT, typename ContainerT>
+ bool
+ found_unknown_directive(ContextT const& ctx, ContainerT const& line,
+ ContainerT& pending)
+ { return false; } // by default we never interpret unknown directives
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
     // The function 'evaluated_conditional_expression' is called, whenever a
     // conditional preprocessing expression was evaluated (the expression
     // given to a #if, #elif, #ifdef or #ifndef directive)

Modified: branches/release/boost/wave/util/cpp_include_paths.hpp
==============================================================================
--- branches/release/boost/wave/util/cpp_include_paths.hpp (original)
+++ branches/release/boost/wave/util/cpp_include_paths.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -61,7 +61,7 @@
 // compilers
 #if defined(BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS) || \
     (defined(BOOST_MSVC) && ((BOOST_MSVC < 1300) || \
- (_MSC_FULL_VER == 160020506 || _MSC_FULL_VER == 160021003))) || \
+ (_MSC_FULL_VER == 160020506 || _MSC_FULL_VER == 160021003 || _MSC_FULL_VER == 160030128))) || \
     (defined(BOOST_INTEL_CXX_VERSION) && \
         (defined(_MSC_VER) && (BOOST_INTEL_CXX_VERSION <= 700)))
 
@@ -401,6 +401,42 @@
 ///////////////////////////////////////////////////////////////////////////////
 // Set current directory from a given file name
 
+inline bool
+as_relative_to(boost::filesystem::path const& path,
+ boost::filesystem::path const& base, boost::filesystem::path& result)
+{
+ if (path.has_root_path()) {
+ if (path.root_path() == base.root_path())
+ return as_relative_to(path.relative_path(), base.relative_path(), result);
+
+ result = path; // that's our result
+ }
+ else {
+ if (base.has_root_path()) {
+ // cannot find relative path from a relative path and a rooted base
+ return false;
+ }
+ else {
+ typedef boost::filesystem::path::const_iterator path_iterator;
+ path_iterator path_it = path.begin();
+ path_iterator base_it = base.begin();
+ while (path_it != path.end() && base_it != base.end() ) {
+ if (*path_it != *base_it)
+ break;
+ ++path_it; ++base_it;
+ }
+
+ for (/**/; base_it != base.end(); ++base_it)
+ result /= "..";
+
+ for (/**/; path_it != path.end(); ++path_it)
+ result /= *path_it;
+ }
+ }
+ return true;
+}
+
+///////////////////////////////////////////////////////////////////////////////
 inline
 void include_paths::set_current_directory(char const *path_)
 {
@@ -409,12 +445,16 @@
     fs::path filepath (create_path(path_));
     fs::path filename = fs::complete(filepath, current_dir);
     if (fs::exists(filename) && fs::is_directory(filename)) {
+ current_rel_dir.clear();
+ if (!as_relative_to(filepath, current_dir, current_rel_dir))
+ current_rel_dir = filepath;
         current_dir = filename;
- current_rel_dir = filepath;
     }
     else {
+ current_rel_dir.clear();
+ if (!as_relative_to(branch_path(filepath), current_dir, current_rel_dir))
+ current_rel_dir = branch_path(filepath);
         current_dir = branch_path(filename);
- current_rel_dir = branch_path(filepath);
     }
 }
 

Modified: branches/release/boost/wave/util/cpp_iterator.hpp
==============================================================================
--- branches/release/boost/wave/util/cpp_iterator.hpp (original)
+++ branches/release/boost/wave/util/cpp_iterator.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -285,6 +285,7 @@
 #if BOOST_WAVE_SUPPORT_PRAGMA_ONCE != 0
         ctx_.set_current_filename(pos_.get_file().c_str());
 #endif
+ iter_ctx->emitted_lines = (unsigned int)(-1); // force #line directive
     }
 
 // get the next preprocessed token
@@ -418,6 +419,7 @@
         iter_ctx = ctx.pop_iteration_context();
 
         must_emit_line_directive = true;
+ iter_ctx->emitted_lines = (unsigned int)(-1); // force #line directive
         seen_newline = true;
 
     // restore current file position
@@ -433,6 +435,7 @@
         ctx.set_current_filename(real_filename.c_str());
 #endif
         ctx.set_current_directory(iter_ctx->real_filename.c_str());
+ ctx.set_current_relative_filename(iter_ctx->real_relative_filename.c_str());
 
     // ensure the integrity of the #if/#endif stack
     // report unbalanced #if/#endif now to make it possible to recover properly
@@ -735,16 +738,22 @@
 
 typename ContextT::position_type pos = act_token.get_position();
 
+// if (must_emit_line_directive &&
+// iter_ctx->emitted_lines+1 == act_pos.get_line() &&
+// iter_ctx->filename == act_pos.get_file())
+// {
+// must_emit_line_directive = false;
+// return false;
+// }
+
     if (must_emit_line_directive ||
- iter_ctx->emitted_lines != act_pos.get_line())
+ iter_ctx->emitted_lines+1 != act_pos.get_line())
     {
     // unput the current token
         pending_queue.push_front(act_token);
         pos.set_line(act_pos.get_line());
 
- if (!must_emit_line_directive &&
- iter_ctx->emitted_lines+1 == act_pos.get_line())
- {
+ if (iter_ctx->emitted_lines+2 == act_pos.get_line()) {
         // prefer to output a single newline instead of the #line directive
 // whitespace.shift_tokens(T_NEWLINE);
             act_token = result_type(T_NEWLINE, "\n", pos);
@@ -752,48 +761,52 @@
         else {
         // account for the newline emitted here
             act_pos.set_line(act_pos.get_line()-1);
- iter_ctx->emitted_lines = act_pos.get_line();
+ iter_ctx->emitted_lines = act_pos.get_line()-1;
+
+ token_sequence_type pending;
+
+ if (!ctx.get_hooks().emit_line_directive(ctx, pending, act_token))
+ {
+ unsigned int column = 6;
+
+ // the hook did not generate anything, emit default #line
+ pos.set_column(1);
+ pending.push_back(result_type(T_PP_LINE, "#line", pos));
+
+ pos.set_column(column); // account for '#line'
+ pending.push_back(result_type(T_SPACE, " ", pos));
+
+ // 21 is the max required size for a 64 bit integer represented as a
+ // string
+ char buffer[22];
+
+ using namespace std; // for some systems sprintf is in namespace std
+ sprintf (buffer, "%d", pos.get_line());
 
- // the #line directive has to be pushed back into the pending queue in
- // reverse order
+ pos.set_column(++column); // account for ' '
+ pending.push_back(result_type(T_INTLIT, buffer, pos));
+ pos.set_column(column += (unsigned int)strlen(buffer)); // account for <number>
+ pending.push_back(result_type(T_SPACE, " ", pos));
+ pos.set_column(++column); // account for ' '
 
- // unput the complete #line directive in reverse order
- 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)) + "\"";
-
- // 21 is the max required size for a 64 bit integer represented as a
- // string
- char buffer[22];
-
- using namespace std; // for some systems sprintf is in namespace std
- sprintf (buffer, "%d", pos.get_line());
-
- // adjust the generated column numbers accordingly
- // #line<space>number<space>filename<newline>
- unsigned int filenamelen = (unsigned int)file.size();
- 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
- pending_queue.push_front(result_type(T_STRINGLIT, file.c_str(), pos));
- pos.set_column(--column); // account for ' '
- pending_queue.push_front(result_type(T_SPACE, " ", pos));
- pos.set_column(column -= (unsigned int)strlen(buffer)); // account for <number>
- 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);
+ 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)) + "\"";
+
+ pending.push_back(result_type(T_STRINGLIT, file.c_str(), pos));
+ pos.set_column(column += (unsigned int)file.size()); // account for filename
+ pending.push_back(result_type(T_GENERATEDNEWLINE, "\n", pos));
+ }
+
+ // if there is some replacement text, insert it into the pending queue
+ if (!pending.empty()) {
+ pending_queue.splice(pending_queue.begin(), pending);
+ act_token = pending_queue.front();
+ pending_queue.pop_front();
+ }
         }
 
         must_emit_line_directive = false; // we are now in sync
@@ -855,30 +868,6 @@
 ///////////////////////////////////////////////////////////////////////////////
 namespace impl {
 
- template <typename ContextT, typename IteratorT>
- 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);
- if (!IS_CATEGORY(id, WhiteSpaceTokenType))
- break; // skip leading whitespace
- if (IS_CATEGORY(id, EOLTokenType))
- break; // do not enter a new line
-
- // this token get's skipped
-#if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
- ctx.get_hooks().skipped_token(*it);
-#else
- ctx.get_hooks().skipped_token(ctx.derived(), *it);
-#endif
- }
- 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,
@@ -905,14 +894,39 @@
 #endif
     }
 
- // verify that there is'nt anything significant left on the line
+ template <typename ContextT, typename IteratorT>
+ 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);
+ if (!IS_CATEGORY(id, WhiteSpaceTokenType))
+ break; // skip leading whitespace
+ if (IS_CATEGORY(id, EOLTokenType) || IS_CATEGORY(id, EOFTokenType))
+ break; // do not enter a new line
+ if (T_CPPCOMMENT == id ||
+ context_policies::util::ccomment_has_newline(*it))
+ {
+ break;
+ }
+
+ // this token gets skipped
+ call_skipped_token_hook(ctx, *it);
+ }
+ BOOST_ASSERT(it == end || id != T_UNKNOWN);
+ return it != end && IS_CATEGORY(id, PPTokenType);
+ }
+
+ // verify that there isn't anything significant left on the line
     template <typename ContextT, typename IteratorT>
     bool pp_is_last_on_line(ContextT &ctx, IteratorT &it, IteratorT const &end,
         bool call_hook = true)
     {
         using namespace boost::wave;
 
- // this token get's skipped
+ // this token gets skipped
         if (call_hook)
             call_skipped_token_hook(ctx, *it);
 
@@ -931,7 +945,7 @@
             if (!IS_CATEGORY(id, WhiteSpaceTokenType))
                 break;
 
- // this token get's skipped
+ // this token gets skipped
             if (call_hook)
                 call_skipped_token_hook(ctx, *it);
         }
@@ -1255,7 +1269,28 @@
             }
             else if (ctx.get_if_block_status()) {
             // report invalid pp directive
- on_illformed((*it).get_value());
+ 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));
+
+ token_sequence_type faulty_line;
+
+ for (/**/; iter_ctx->first != it; ++iter_ctx->first)
+ faulty_line.push_back(*iter_ctx->first);
+
+ token_sequence_type pending;
+ if (ctx.get_hooks().found_unknown_directive(ctx, faulty_line, pending))
+ {
+ // if there is some replacement text, insert it into the pending queue
+ if (!pending.empty())
+ pending_queue.splice(pending_queue.begin(), pending);
+ return true;
+ }
+
+ // default behavior is to throw an exception
+ on_illformed(str);
             }
         }
 
@@ -1536,8 +1571,8 @@
 
     // preprocess the opened file
     boost::shared_ptr<base_iteration_context_type> new_iter_ctx (
- new iteration_context_type(ctx, native_path_str.c_str(),
- act_pos, boost::wave::enable_prefer_pp_numbers(ctx.get_language())));
+ new iteration_context_type(ctx, native_path_str.c_str(), act_pos,
+ boost::wave::enable_prefer_pp_numbers(ctx.get_language())));
 
     // call the include policy trace function
 #if BOOST_WAVE_USE_DEPRECIATED_PREPROCESSING_HOOKS != 0
@@ -1549,9 +1584,11 @@
 #endif
 
     // store current file position
+ iter_ctx->real_relative_filename = ctx.get_current_relative_filename().c_str();
         iter_ctx->filename = act_pos.get_file();
         iter_ctx->line = act_pos.get_line();
         iter_ctx->if_block_depth = ctx.get_if_block_depth();
+ iter_ctx->emitted_lines = (unsigned int)(-1); // force #line directive
 
     // push the old iteration context onto the stack and continue with the new
         ctx.push_iteration_context(act_pos, iter_ctx);
@@ -1566,6 +1603,9 @@
         ctx.set_current_filename(real_filename.c_str());
 #endif
 
+ ctx.set_current_relative_filename(dir_path.c_str());
+ iter_ctx->real_relative_filename = dir_path.c_str();
+
         act_pos.set_line(iter_ctx->line);
         act_pos.set_column(0);
     }
@@ -2399,7 +2439,7 @@
     token_sequence_type pending;
     if (interpret_pragma(expanded, pending)) {
     // if there is some replacement text, insert it into the pending queue
- if (pending.size() > 0)
+ if (!pending.empty())
             pending_queue.splice(pending_queue.begin(), pending);
         return true; // this #pragma was successfully recognized
     }

Modified: branches/release/boost/wave/util/pattern_parser.hpp
==============================================================================
--- branches/release/boost/wave/util/pattern_parser.hpp (original)
+++ branches/release/boost/wave/util/pattern_parser.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -37,7 +37,8 @@
     {
         pattern_and(CharT pattern_, unsigned long pattern_mask_ = 0UL)
         : pattern(pattern_),
- pattern_mask((0UL != pattern_mask_) ? pattern_mask_ : pattern_)
+ pattern_mask((0UL != pattern_mask_) ?
+ pattern_mask_ : (unsigned long)pattern_)
         {}
 
         template <typename T>

Modified: branches/release/boost/wave/wave_version.hpp
==============================================================================
--- branches/release/boost/wave/wave_version.hpp (original)
+++ branches/release/boost/wave/wave_version.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -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 0x020004
+#define BOOST_WAVE_VERSION 0x020005
 
 // The following defines contain the same information as above
 #define BOOST_WAVE_VERSION_MAJOR 2
 #define BOOST_WAVE_VERSION_MINOR 0
-#define BOOST_WAVE_VERSION_SUBMINOR 4
+#define BOOST_WAVE_VERSION_SUBMINOR 5
 
 #endif // !defined(WAVE_VERSION_H_9D79ABDB_AC54_4C0A_89B1_F70A2DCFE21E_INCLUDED)

Modified: branches/release/libs/wave/ChangeLog
==============================================================================
--- branches/release/libs/wave/ChangeLog (original)
+++ branches/release/libs/wave/ChangeLog 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -20,6 +20,29 @@
 
 CHANGELOG
 
+Boost V1.43.0
+- V2.0.5
+- Fixed line number counting for lines containing nothing but whitespace
+ followed by a C++ comment if the next line is a pp directive.
+- Fixed emitting of a #line directive after returned from an include file.
+- A couple of fixes allowing to properly report the current line number in
+ #line directives for different whitespace preserve modes (see --preserve/-p).
+- Added new preprocessing hook: emit_line_directive, allowing to customize the
+ format of the generated #line directive.
+- Changed --line/-l command line option of the wave driver application to
+ accept 0, 1, and 2 as options. The option values 0 and 1 behave as before
+ (disable/enable the generation of #line directives), while the option value 2
+ will generate the #line directive using the relative filename (instead of the
+ absolute filename emitted from option 1). The default option is value 1.
+- Added new example: emit_custom_line_directives, demonstrating the use of the
+ new preprocessing hook.
+- Added new preprocessing hook: found_unknown_directive, which is being invoked
+ whenever an unknown preprocessor directive (i.e. '#' followed by some
+ identifier) is detected. IT allows to interprete the directive and to provide
+ some replacement text.
+- Added new example: custom_directives demonstrating the usage of the new
+ preprocessing hook.
+
 Boost V1.42.0
 - V2.0.4
 - Fixed Wave for latest changes in multi_pass iterator.
@@ -39,7 +62,7 @@
   (default is cout).
 - Fixed compilation problems caused by recent changes to the multi_pass iterator
   from Spirit V2.1.
-- Added a new preprocessing hooks detected_pragma_once() and
+- Added the new preprocessing hooks detected_pragma_once() and
   detected_include_guard() which are getting called whenever either a #pragma
   once has been detected or if the include guard heuristics detected an
   include guard for a particular include file.

Modified: branches/release/libs/wave/samples/Jamfile.v2
==============================================================================
--- branches/release/libs/wave/samples/Jamfile.v2 (original)
+++ branches/release/libs/wave/samples/Jamfile.v2 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -17,3 +17,5 @@
 build-project real_positions/build ;
 build-project token_statistics/build ;
 build-project preprocess_pragma_output/build ;
+build-project custom_directives/build ;
+build-project emit_custom_line_directives/build ;

Copied: branches/release/libs/wave/samples/custom_directives/custom_directives.hpp (from r59538, /trunk/libs/wave/samples/custom_directives/custom_directives.hpp)
==============================================================================
--- /trunk/libs/wave/samples/custom_directives/custom_directives.hpp (original)
+++ branches/release/libs/wave/samples/custom_directives/custom_directives.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -44,11 +44,8 @@
     // The parameter 'ctx' is a reference to the context object used for
     // instantiating the preprocessing iterators by the user.
     //
- // The parameter 'directive' is a reference to the token holding the
- // preprocessing directive.
- //
- // The parameter 'line' holds the entire source line containing the
- // unknown directive.
+ // The parameter 'line' holds the tokens of the entire source line
+ // containing the unknown directive.
     //
     // The parameter 'pending' may be used to push tokens back into the input
     // stream, which are to be used as the replacement text for the whole

Copied: branches/release/libs/wave/samples/custom_directives/custom_directives.input (from r59538, /trunk/libs/wave/samples/custom_directives/custom_directives.input)
==============================================================================
--- /trunk/libs/wave/samples/custom_directives/custom_directives.input (original)
+++ branches/release/libs/wave/samples/custom_directives/custom_directives.input 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -2,7 +2,7 @@
 // in GLSL - OpenGL Shader Language).
 
 #version 150 core
-#extension all : require
+#extension all : require // trailing comment
 
 // the following directive is not supported, so it will trigger an exception
 #not_supported_directive

Modified: branches/release/libs/wave/test/testwave/collect_hooks_information.hpp
==============================================================================
--- branches/release/libs/wave/test/testwave/collect_hooks_information.hpp (original)
+++ branches/release/libs/wave/test/testwave/collect_hooks_information.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -754,6 +754,40 @@
     }
 #endif
 
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'found_unknown_directive' is called, whenever an unknown
+ // preprocessor directive was encountered.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'line' holds the tokens of the entire source line
+ // containing the unknown directive.
+ //
+ // The parameter 'pending' may be used to push tokens back into the input
+ // stream, which are to be used as the replacement text for the whole
+ // line containing the unknown directive.
+ //
+ // The return value defines, whether the given expression has been
+ // properly interpreted by the hook function or not. If this function
+ // returns 'false', the library will raise an 'ill_formed_directive'
+ // preprocess_exception. Otherwise the tokens pushed back into 'pending'
+ // are passed on to the user program.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename ContextT, typename ContainerT>
+ bool
+ found_unknown_directive(ContextT const& ctx, ContainerT const& line,
+ ContainerT& pending)
+ {
+ BOOST_WAVETEST_OSSTREAM strm;
+ strm << "21: " << repr((*line.begin()).get_position()) << ": "
+ << boost::wave::util::impl::as_string(line) << std::endl;
+ hooks_trace += BOOST_WAVETEST_GETSTRING(strm);
+ return false;
+ }
+
 private:
     std::string& hooks_trace;
 };

Modified: branches/release/libs/wave/test/testwave/testfiles/t_2_005.cpp
==============================================================================
--- branches/release/libs/wave/test/testwave/testfiles/t_2_005.cpp (original)
+++ branches/release/libs/wave/test/testwave/testfiles/t_2_005.cpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -10,7 +10,8 @@
 // test the error reporting for unknown directives
 
 //R
-//E t_2_005.cpp(14): error: ill formed preprocessor directive: this_is_a_unknown_pp_directive
+//E t_2_005.cpp(14): error: ill formed preprocessor directive: #this_is_a_unknown_pp_directive with some parameter
 #this_is_a_unknown_pp_directive with some parameter
 
+//H 21: t_2_005.cpp(14): #this_is_a_unknown_pp_directive with some parameter
 //H 18: boost::wave::preprocess_exception

Modified: branches/release/libs/wave/test/testwave/testfiles/t_2_019.cpp
==============================================================================
--- branches/release/libs/wave/test/testwave/testfiles/t_2_019.cpp (original)
+++ branches/release/libs/wave/test/testwave/testfiles/t_2_019.cpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -28,13 +28,13 @@
 
 //H 10: t_2_019.cpp(13): #include "t_2_019_001.hpp"
 //H 04: "t_2_019_001.hpp"
-//H 05: $B(t_2_019_001.hpp) ($B(t_2_019_001.hpp))
+//H 05: t_2_019_001.hpp ($B(t_2_019_001.hpp))
 //H 10: t_2_019_001.hpp(10): #pragma
 //H 20: t_2_019_001.hpp(10): #pragma: $B(t_2_019_001.hpp)
 //H 06:
 //H 10: t_2_019.cpp(14): #include "t_2_019_002.hpp"
 //H 04: "t_2_019_002.hpp"
-//H 05: $B(t_2_019_002.hpp) ($B(t_2_019_002.hpp))
+//H 05: t_2_019_002.hpp ($B(t_2_019_002.hpp))
 //H 10: t_2_019_002.hpp(12): #if
 //H 11: t_2_019_002.hpp(12): #if !defined(T_2_019_002): 1
 //H 10: t_2_019_002.hpp(14): #define
@@ -44,7 +44,7 @@
 //H 19: $B(t_2_019_002.hpp): T_2_019_002
 //H 10: t_2_019.cpp(15): #include "t_2_019_003.hpp"
 //H 04: "t_2_019_003.hpp"
-//H 05: $B(t_2_019_003.hpp) ($B(t_2_019_003.hpp))
+//H 05: t_2_019_003.hpp ($B(t_2_019_003.hpp))
 //H 10: t_2_019_003.hpp(12): #ifndef
 //H 11: t_2_019_003.hpp(12): #ifndef T_2_019_003: 0
 //H 10: t_2_019_003.hpp(14): #define

Modified: branches/release/libs/wave/test/testwave/testfiles/t_6_063.cpp
==============================================================================
--- branches/release/libs/wave/test/testwave/testfiles/t_6_063.cpp (original)
+++ branches/release/libs/wave/test/testwave/testfiles/t_6_063.cpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -24,7 +24,7 @@
 
 //H 10: t_6_063.cpp(20): #include "t_6_063.hpp"
 //H 04: "t_6_063.hpp"
-//H 05: $B(t_6_063.hpp) ($B(t_6_063.hpp))
+//H 05: t_6_063.hpp ($B(t_6_063.hpp))
 //H 18: boost::wave::preprocess_exception
 
 /*-

Modified: branches/release/libs/wave/test/testwave/testfiles/t_6_067.cpp
==============================================================================
--- branches/release/libs/wave/test/testwave/testfiles/t_6_067.cpp (original)
+++ branches/release/libs/wave/test/testwave/testfiles/t_6_067.cpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -24,7 +24,7 @@
 
 //H 10: t_6_067.cpp(20): #include "t_6_067.hpp"
 //H 04: "t_6_067.hpp"
-//H 05: $B(t_6_067.hpp) ($B(t_6_067.hpp))
+//H 05: t_6_067.hpp ($B(t_6_067.hpp))
 //H 18: boost::wave::lexing_exception
 
 /*-

Modified: branches/release/libs/wave/test/testwave/testfiles/t_9_016.cpp
==============================================================================
--- branches/release/libs/wave/test/testwave/testfiles/t_9_016.cpp (original)
+++ branches/release/libs/wave/test/testwave/testfiles/t_9_016.cpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -37,6 +37,6 @@
 //H 19: $B(t_9_016.cpp): inclusion
 //H 10: t_9_016.cpp(13): # include "t_9_016.hpp"
 //H 04: "t_9_016.hpp"
-//H 05: $B(t_9_016.hpp) ($B(t_9_016.hpp))
+//H 05: t_9_016.hpp ($B(t_9_016.hpp))
 //H 06:
 //H 10: t_9_016.cpp(14): #else

Modified: branches/release/libs/wave/test/testwave/testwave_app.cpp
==============================================================================
--- branches/release/libs/wave/test/testwave/testwave_app.cpp (original)
+++ branches/release/libs/wave/test/testwave/testwave_app.cpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -859,6 +859,7 @@
             std::cerr << "initialise_options: option: single_line" << std::endl;
         }
         ctx.set_language(boost::wave::enable_single_line(ctx.get_language()));
+ ctx.set_language(boost::wave::enable_emit_line_directives(ctx.get_language(), false));
     }
     
 // add include directories to the system include search paths
@@ -959,7 +960,7 @@
                 std::cerr << "initialise_options: option: -U" << *cit
                           << std::endl;
             }
- ctx.remove_macro_definition((*cit).c_str());
+ ctx.remove_macro_definition(*cit);
         }
     }
 

Modified: branches/release/tools/wave/cpp.cpp
==============================================================================
--- branches/release/tools/wave/cpp.cpp (original)
+++ branches/release/tools/wave/cpp.cpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -841,7 +841,7 @@
     // control the generation of #line directives
         if (vm.count("line")) {
             int lineopt = vm["line"].as<int>();
- if (0 != lineopt && 1 != lineopt) {
+ if (0 != lineopt && 1 != lineopt && 2 != lineopt) {
                 cerr << "wave: bogus value for --line command line option: "
                     << lineopt << endl;
                 return -1;
@@ -849,6 +849,9 @@
             ctx.set_language(
                 boost::wave::enable_emit_line_directives(ctx.get_language(),
                     lineopt != 0));
+
+ if (2 == lineopt)
+ ctx.get_hooks().enable_relative_names_in_line_directives(true);
         }
 
     // control whether whitespace should be inserted to disambiguate output
@@ -1223,7 +1226,9 @@
             ("line,L", po::value<int>()->default_value(1),
                 "control the generation of #line directives\n"
                             "0: no #line directives are generated,\n"
- "1: #line directives will be emitted (default)")
+ "1: #line directives will be emitted (default),\n"
+ "2: #line directives will be emitted using relative\n"
+ " filenames")
             ("disambiguate", po::value<int>()->default_value(1),
                 "control whitespace insertion to disambiguate\n"
                 "consecutive tokens\n"

Modified: branches/release/tools/wave/cpp_version.hpp
==============================================================================
--- branches/release/tools/wave/cpp_version.hpp (original)
+++ branches/release/tools/wave/cpp_version.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -19,7 +19,7 @@
 
 #define CPP_VERSION_FULL_STR BOOST_PP_STRINGIZE(CPP_VERSION_FULL)
 
-#define CPP_VERSION_DATE 20090602L
-#define CPP_VERSION_DATE_STR "20090602"
+#define CPP_VERSION_DATE 20100324L
+#define CPP_VERSION_DATE_STR "20100324"
 
 #endif // !defined(CPP_VERSION_HPP_CE4FE67F_63F9_468D_8364_C855F89D3C5D_INCLUDED)

Modified: branches/release/tools/wave/trace_macro_expansion.hpp
==============================================================================
--- branches/release/tools/wave/trace_macro_expansion.hpp (original)
+++ branches/release/tools/wave/trace_macro_expansion.hpp 2010-04-06 11:43:50 EDT (Tue, 06 Apr 2010)
@@ -154,7 +154,8 @@
         enable_system_command(enable_system_command_),
         preserve_whitespace(preserve_whitespace_),
         generate_output(generate_output_),
- default_outfile(default_outfile_)
+ default_outfile(default_outfile_),
+ emit_relative_filenames(false)
     {
         using namespace std; // some systems have time in namespace std
         time(&started_at);
@@ -172,6 +173,15 @@
         return counts;
     }
 
+ void enable_relative_names_in_line_directives(bool flag)
+ {
+ emit_relative_filenames = flag;
+ }
+ bool enable_relative_names_in_line_directives() const
+ {
+ return emit_relative_filenames;
+ }
+
     ///////////////////////////////////////////////////////////////////////////
     //
     // The function 'expanding_function_like_macro' is called whenever a
@@ -526,6 +536,79 @@
     }
 
     ///////////////////////////////////////////////////////////////////////////
+ //
+ // The function 'emit_line_directive' is called whenever a #line directive
+ // has to be emitted into the generated output.
+ //
+ // The parameter 'ctx' is a reference to the context object used for
+ // instantiating the preprocessing iterators by the user.
+ //
+ // The parameter 'pending' may be used to push tokens back into the input
+ // stream, which are to be used instead of the default output generated
+ // for the #line directive.
+ //
+ // The parameter 'act_token' contains the actual #pragma token, which may
+ // be used for error output. The line number stored in this token can be
+ // used as the line number emitted as part of the #line directive.
+ //
+ // If the return value is 'false', a default #line directive is emitted
+ // by the library. A return value of 'true' will inhibit any further
+ // actions, the tokens contained in 'pending' will be copied verbatim
+ // to the output.
+ //
+ ///////////////////////////////////////////////////////////////////////////
+ template <typename ContextT, typename ContainerT>
+ bool
+ emit_line_directive(ContextT const& ctx, ContainerT &pending,
+ typename ContextT::token_type const& act_token)
+ {
+ if (!need_emit_line_directives(ctx.get_language()) ||
+ !enable_relative_names_in_line_directives())
+ {
+ return false;
+ }
+
+ // emit a #line directive showing the relative filename instead
+ typename ContextT::position_type pos = act_token.get_position();
+ unsigned int column = 6;
+
+ typedef typename ContextT::token_type result_type;
+ using namespace boost::wave;
+
+ pos.set_column(1);
+ pending.push_back(result_type(T_PP_LINE, "#line", pos));
+
+ pos.set_column(column); // account for '#line'
+ pending.push_back(result_type(T_SPACE, " ", pos));
+
+ // 21 is the max required size for a 64 bit integer represented as a
+ // string
+ char buffer[22];
+
+ using namespace std; // for some systems sprintf is in namespace std
+ sprintf (buffer, "%d", pos.get_line());
+
+ pos.set_column(++column); // account for ' '
+ pending.push_back(result_type(T_INTLIT, buffer, pos));
+ pos.set_column(column += (unsigned int)strlen(buffer)); // account for <number>
+ pending.push_back(result_type(T_SPACE, " ", pos));
+ pos.set_column(++column); // account for ' '
+
+ std::string file("\"");
+ boost::filesystem::path filename(
+ boost::wave::util::create_path(ctx.get_current_relative_filename().c_str()));
+
+ using boost::wave::util::impl::escape_lit;
+ file += escape_lit(boost::wave::util::native_file_string(filename)) + "\"";
+
+ pending.push_back(result_type(T_STRINGLIT, file.c_str(), pos));
+ pos.set_column(column += (unsigned int)file.size()); // account for filename
+ pending.push_back(result_type(T_GENERATEDNEWLINE, "\n", pos));
+
+ return true;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
     //
     // The function 'opened_include_file' is called whenever a file referred
     // by an #include directive was successfully located and opened.
@@ -820,7 +903,7 @@
             // pop output preserve from the internal option stack
                 bool result = interpret_pragma_option_preserve_set(
                     preserve_options.top(), preserve_whitespace, ctx);
- line_options.pop();
+ preserve_options.pop();
                 return result;
             }
             return false;
@@ -850,7 +933,13 @@
         if (T_IDENTIFIER == id) {
             if ((*it).get_value() == "push") {
             // push current line option onto the internal option stack
- line_options.push(need_emit_line_directives(ctx.get_language()));
+ int mode = 0;
+ if (need_emit_line_directives(ctx.get_language())) {
+ mode = 1;
+ if (enable_relative_names_in_line_directives())
+ mode = 2;
+ }
+ line_options.push(mode);
                 return true;
             }
             else if ((*it).get_value() == "pop") {
@@ -863,8 +952,9 @@
 
             // pop output line from the internal option stack
                 ctx.set_language(
- enable_emit_line_directives(ctx.get_language(), line_options.top()),
+ enable_emit_line_directives(ctx.get_language(), 0 != line_options.top()),
                     false);
+ enable_relative_names_in_line_directives(2 == line_options.top());
                 line_options.pop();
                 return true;
             }
@@ -1255,6 +1345,7 @@
     std::stack<int> preserve_options; // preserve option stack
 
     std::map<std::string, std::size_t> counts; // macro invocation counts
+ bool emit_relative_filenames; // emit relative names in #line directives
 };
 
 #undef BOOST_WAVE_GETSTRING


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