Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r85338 - trunk/tools/quickbook/src
From: dnljms_at_[hidden]
Date: 2013-08-13 18:21:17


Author: danieljames
Date: 2013-08-13 18:21:17 EDT (Tue, 13 Aug 2013)
New Revision: 85338
URL: http://svn.boost.org/trac/boost/changeset/85338

Log:
Stop saving phrase and block output separately.

Text files modified:
   trunk/tools/quickbook/src/actions.cpp | 18 ++++++------------
   trunk/tools/quickbook/src/state.cpp | 16 ++++++++++++----
   trunk/tools/quickbook/src/state.hpp | 5 +++++
   trunk/tools/quickbook/src/syntax_highlight.cpp | 4 ++--
   4 files changed, 25 insertions(+), 18 deletions(-)

Modified: trunk/tools/quickbook/src/actions.cpp
==============================================================================
--- trunk/tools/quickbook/src/actions.cpp Tue Aug 13 18:09:10 2013 (r85337)
+++ trunk/tools/quickbook/src/actions.cpp 2013-08-13 18:21:17 EDT (Tue, 13 Aug 2013) (r85338)
@@ -487,8 +487,7 @@
             state.conditional = find(state.macro, macro.c_str());
 
             if (!state.conditional) {
- state.phrase.push();
- state.out.push();
+ state.push_output();
                 state.anchors.swap(anchors);
             }
         }
@@ -500,8 +499,7 @@
     {
         if (saved_conditional && !state.conditional)
         {
- state.phrase.pop();
- state.out.pop();
+ state.pop_output();
             state.anchors.swap(anchors);
         }
 
@@ -531,8 +529,7 @@
     {
         write_anchors(*this, (in_list ? phrase : out));
         assert(mark == '*' || mark == '#');
- phrase.push();
- out.push();
+ push_output();
         out << ((mark == '#') ? "<orderedlist>\n" : "<itemizedlist>\n");
     }
 
@@ -545,8 +542,7 @@
         std::string list_output;
         out.swap(list_output);
 
- out.pop();
- phrase.pop();
+ pop_output();
 
         (in_list ? phrase : out) << list_output;
     }
@@ -2092,8 +2088,7 @@
 
     bool to_value_scoped_action::start(value::tag_type t)
     {
- state.out.push();
- state.phrase.push();
+ state.push_output();
         state.anchors.swap(saved_anchors);
         tag = t;
 
@@ -2124,8 +2119,7 @@
     
     void to_value_scoped_action::cleanup()
     {
- state.phrase.pop();
- state.out.pop();
+ state.pop_output();
         state.anchors.swap(saved_anchors);
     }
 }

Modified: trunk/tools/quickbook/src/state.cpp
==============================================================================
--- trunk/tools/quickbook/src/state.cpp Tue Aug 13 18:09:10 2013 (r85337)
+++ trunk/tools/quickbook/src/state.cpp 2013-08-13 18:21:17 EDT (Tue, 13 Aug 2013) (r85338)
@@ -72,6 +72,16 @@
     quickbook_grammar& state::grammar() const {
         return *grammar_;
     }
+
+ void state::push_output() {
+ out.push();
+ phrase.push();
+ }
+
+ void state::pop_output() {
+ phrase.pop();
+ out.pop();
+ }
 
     state_save::state_save(quickbook::state& state, scope_flags scope)
         : state(state)
@@ -89,8 +99,7 @@
         if (scope & scope_macros) macro = state.macro;
         if (scope & scope_templates) state.templates.push();
         if (scope & scope_output) {
- state.out.push();
- state.phrase.push();
+ state.push_output();
         }
         state.values.builder.save();
     }
@@ -105,8 +114,7 @@
         boost::swap(state.xinclude_base, xinclude_base);
         boost::swap(state.source_mode, source_mode);
         if (scope & scope_output) {
- state.out.pop();
- state.phrase.pop();
+ state.pop_output();
         }
         if (scope & scope_templates) state.templates.pop();
         if (scope & scope_macros) state.macro = macro;

Modified: trunk/tools/quickbook/src/state.hpp
==============================================================================
--- trunk/tools/quickbook/src/state.hpp Tue Aug 13 18:09:10 2013 (r85337)
+++ trunk/tools/quickbook/src/state.hpp 2013-08-13 18:21:17 EDT (Tue, 13 Aug 2013) (r85338)
@@ -72,6 +72,8 @@
     // output state - scoped by templates and grammar
         collector out; // main output stream
         collector phrase; // phrase output stream
+
+ // values state - scoped by everything.
         value_parser values; // parsed values
 
         quickbook_grammar& grammar() const;
@@ -80,6 +82,9 @@
     // actions
     ///////////////////////////////////////////////////////////////////////////
 
+ void push_output();
+ void pop_output();
+
         void start_list(char mark);
         void end_list(char mark);
         void start_list_item();

Modified: trunk/tools/quickbook/src/syntax_highlight.cpp
==============================================================================
--- trunk/tools/quickbook/src/syntax_highlight.cpp Tue Aug 13 18:09:10 2013 (r85337)
+++ trunk/tools/quickbook/src/syntax_highlight.cpp 2013-08-13 18:21:17 EDT (Tue, 13 Aug 2013) (r85338)
@@ -168,14 +168,14 @@
     void syntax_highlight_actions::pre_escape_back(parse_iterator,
             parse_iterator)
     {
- state.phrase.push(); // save the stream
+ state.push_output(); // save the stream
     }
 
     void syntax_highlight_actions::post_escape_back(parse_iterator,
             parse_iterator)
     {
         out << state.phrase.str();
- state.phrase.pop(); // restore the stream
+ state.pop_output(); // restore the stream
     }
 
     void syntax_highlight_actions::do_macro(std::string const& v)


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