Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61088 - in branches/quickbook-1.5-spirit2: . doc test
From: daniel_james_at_[hidden]
Date: 2010-04-05 18:18:31


Author: danieljames
Date: 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
New Revision: 61088
URL: http://svn.boost.org/trac/boost/changeset/61088

Log:
Merge from trunk.
Properties modified:
   branches/quickbook-1.5-spirit2/ (props changed)
Text files modified:
   branches/quickbook-1.5-spirit2/block_grammar.cpp | 19 ++++++++++++++++++
   branches/quickbook-1.5-spirit2/doc/Jamfile.v2 | 10 +++++++++
   branches/quickbook-1.5-spirit2/grammar.cpp | 1
   branches/quickbook-1.5-spirit2/grammar.hpp | 1
   branches/quickbook-1.5-spirit2/grammar_impl.hpp | 1
   branches/quickbook-1.5-spirit2/index.html | 5 ++++
   branches/quickbook-1.5-spirit2/phrase_grammar.cpp | 8 +++---
   branches/quickbook-1.5-spirit2/quickbook.cpp | 42 ++++++++++++++++++++++++++++++++++-----
   branches/quickbook-1.5-spirit2/quickbook.hpp | 1
   branches/quickbook-1.5-spirit2/test/callouts.cpp | 5 ++++
   10 files changed, 83 insertions(+), 10 deletions(-)

Modified: branches/quickbook-1.5-spirit2/block_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/block_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/block_grammar.cpp 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -145,5 +145,24 @@
             "variablelist", "import", "template", "warning", "caution",
             "important", "note", "tip", ":"
             ;
+
+ // Parse command line macro definition. This is more here out of
+ // convenience than anything.
+
+ qi::rule<iterator, quickbook::def_macro>& command_line_macro_parse = store_.create();
+
+ command_line_macro = command_line_macro_parse [actions.process];
+
+ command_line_macro_parse =
+ space
+ >> macro_identifier
+ >> space
+ >> ( '='
+ >> space
+ >> simple_phrase
+ >> space
+ )
+ | qi::attr("")
+ ;
     }
 }

Modified: branches/quickbook-1.5-spirit2/doc/Jamfile.v2
==============================================================================
--- branches/quickbook-1.5-spirit2/doc/Jamfile.v2 (original)
+++ branches/quickbook-1.5-spirit2/doc/Jamfile.v2 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -1,3 +1,13 @@
+#==============================================================================
+# Copyright (c) 2002 2004 2006 Joel de Guzman
+# Copyright (c) 2004 Eric Niebler
+# http://spirit.sourceforge.net/
+#
+# Use, modification and distribution is subject to 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)
+#==============================================================================
+
 project boost/quickbook/doc ;
 
 import boostbook : boostbook ;

Modified: branches/quickbook-1.5-spirit2/grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/grammar.cpp 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -15,6 +15,7 @@
 {
     quickbook_grammar::quickbook_grammar(quickbook::actions& a)
         : impl_(new impl(a))
+ , command_line_macro(impl_->command_line_macro, "command_line_macro")
         , phrase(impl_->common, "phrase")
         , simple_phrase(impl_->simple_phrase, "simple_phrase")
         , block(impl_->block_start, "block")

Modified: branches/quickbook-1.5-spirit2/grammar.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/grammar.hpp (original)
+++ branches/quickbook-1.5-spirit2/grammar.hpp 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -28,6 +28,7 @@
         boost::scoped_ptr<impl> impl_;
 
     public:
+ qi::grammar<iterator> command_line_macro;
         qi::grammar<iterator> phrase;
         qi::grammar<iterator> simple_phrase;
         qi::grammar<iterator> block;

Modified: branches/quickbook-1.5-spirit2/grammar_impl.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/grammar_impl.hpp (original)
+++ branches/quickbook-1.5-spirit2/grammar_impl.hpp 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -36,6 +36,7 @@
         // block
         qi::rule<iterator> block_start;
         qi::rule<iterator> block_markup;
+ qi::rule<iterator> command_line_macro;
 
         // doc_info
         qi::rule<iterator, quickbook::doc_info()> doc_info_details;

Modified: branches/quickbook-1.5-spirit2/index.html
==============================================================================
--- branches/quickbook-1.5-spirit2/index.html (original)
+++ branches/quickbook-1.5-spirit2/index.html 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -6,5 +6,10 @@
   <body>
     Automatic redirection failed, click this
     <a href="../../doc/html/quickbook.html">link</a>
+ <p>Copyright&nbsp;Eric Niebler 2005</p>
+ <p>Distributed under the Boost Software License, Version 1.0. (See accompanying file
+ LICENSE_1_0.txt or copy at
+ www.boost.org/LICENSE_1_0.txt).
+ </p>
   </body>
 </html>

Modified: branches/quickbook-1.5-spirit2/phrase_grammar.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/phrase_grammar.cpp (original)
+++ branches/quickbook-1.5-spirit2/phrase_grammar.cpp 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -175,14 +175,14 @@
 
         escape_unicode16 =
                 "\\u"
- >> qi::raw[qi::repeat(4)[qi::xdigit]]
- >> qi::attr(nothing())
+ > qi::raw[qi::repeat(4)[qi::xdigit]]
+ > qi::attr(nothing())
             ;
 
         escape_unicode32 =
                 "\\U"
- >> qi::raw[qi::repeat(8)[qi::xdigit]]
- >> qi::attr(nothing())
+ > qi::raw[qi::repeat(8)[qi::xdigit]]
+ > qi::attr(nothing())
             ;
 
         phrase_end =

Modified: branches/quickbook-1.5-spirit2/quickbook.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/quickbook.cpp (original)
+++ branches/quickbook-1.5-spirit2/quickbook.cpp 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -41,6 +41,27 @@
     bool debug_mode; // for quickbook developers only
     bool ms_errors = false; // output errors/warnings as if for VS
     std::vector<std::string> include_path;
+ std::vector<std::string> preset_defines;
+
+ ///////////////////////////////////////////////////////////////////////////
+ //
+ // Parse the macros passed as command line parameters
+ //
+ ///////////////////////////////////////////////////////////////////////////
+
+ static void set_macros(quickbook_grammar& g)
+ {
+ for(std::vector<std::string>::const_iterator
+ it = preset_defines.begin(),
+ end = preset_defines.end();
+ it != end; ++it)
+ {
+ iterator first(it->begin(), it->end(), "command line parameter");
+ iterator last(it->end(), it->end());
+
+ parse(first, last, g.command_line_macro);
+ }
+ }
 
     ///////////////////////////////////////////////////////////////////////////
     //
@@ -68,6 +89,7 @@
         doc_info info;
         actions actor(state_);
         quickbook_grammar g(actor);
+ set_macros(g);
         bool success = parse(first, last, g.doc_info, info);
 
         if (success || ignore_docinfo)
@@ -98,12 +120,6 @@
             ++state_.error_count;
         }
         
- if(state_.error_count)
- {
- detail::outerr(filein_)
- << "Error count: " << actor.state_.error_count << ".\n";
- }
-
         return state_.error_count ? 1 : 0;
     }
 
@@ -116,6 +132,13 @@
             detail::outwarn(filein_)
                 << "Warning missing [endsect] detected at end of file."
                 << std::endl;
+
+ if(state.error_count)
+ {
+ detail::outerr(filein_)
+ << "Error count: " << state.error_count << ".\n";
+ }
+
         return r;
     }
 
@@ -194,6 +217,7 @@
             ("debug", "debug mode (for developers)")
             ("ms-errors", "use Microsoft Visual Studio style error & warn message format")
             ("include-path,I", value< std::vector<quickbook::detail::input_path> >(), "include path")
+ ("define,D", value< std::vector<std::string> >(), "define macro")
             ("boostbook", "generate boostbook (default)")
             ("html", "generate html")
         ;
@@ -269,6 +293,12 @@
                 = std::vector<std::string>(paths.begin(), paths.end());
         }
 
+ if (vm.count("define"))
+ {
+ quickbook::preset_defines
+ = vm["define"].as<std::vector<std::string> >();
+ }
+
         if (vm.count("input-file"))
         {
             std::string filein

Modified: branches/quickbook-1.5-spirit2/quickbook.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/quickbook.hpp (original)
+++ branches/quickbook-1.5-spirit2/quickbook.hpp 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -23,6 +23,7 @@
     extern tm* current_gm_time; // the current UTC time
     extern bool debug_mode;
     extern std::vector<std::string> include_path;
+ extern std::vector<std::string> preset_defines;
 
     // forward declarations
     int parse(char const* filein_, state&, bool ignore_docinfo = false);

Modified: branches/quickbook-1.5-spirit2/test/callouts.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/test/callouts.cpp (original)
+++ branches/quickbook-1.5-spirit2/test/callouts.cpp 2010-04-05 18:18:30 EDT (Mon, 05 Apr 2010)
@@ -1,3 +1,8 @@
+
+// Copyright 2009 Daniel James.
+// Distributed under the Boost Software License, Version 1.0. (See accompanying
+// file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt)
+
 //[ example1
 
 /*`


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