|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r57773 - in branches/quickbook-1.5-spirit2: . detail
From: daniel_james_at_[hidden]
Date: 2009-11-18 18:10:31
Author: danieljames
Date: 2009-11-18 18:10:29 EST (Wed, 18 Nov 2009)
New Revision: 57773
URL: http://svn.boost.org/trac/boost/changeset/57773
Log:
Use phoenix bind.
Text files modified:
branches/quickbook-1.5-spirit2/code_snippet.hpp | 26 +++++++++++++++-----------
branches/quickbook-1.5-spirit2/detail/actions.cpp | 1 -
branches/quickbook-1.5-spirit2/detail/post_process.cpp | 23 +++++++++++++----------
branches/quickbook-1.5-spirit2/detail/quickbook.hpp | 38 +++++++++++++++++++-------------------
4 files changed, 47 insertions(+), 41 deletions(-)
Modified: branches/quickbook-1.5-spirit2/code_snippet.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/code_snippet.hpp (original)
+++ branches/quickbook-1.5-spirit2/code_snippet.hpp 2009-11-18 18:10:29 EST (Wed, 18 Nov 2009)
@@ -11,13 +11,17 @@
#include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_actor.hpp>
-#include <boost/bind.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_bind.hpp>
#include "./grammars.hpp"
#include "./detail/template_stack.hpp"
#include "./detail/actions.hpp"
namespace quickbook
{
+ namespace ph = boost::phoenix;
+ using namespace ph::arg_names;
+
template <typename Scanner>
python_code_snippet_grammar::definition<Scanner>::definition(
python_code_snippet_grammar const& self)
@@ -26,7 +30,7 @@
start_ =
+(
- snippet [boost::bind(&actions_type::compile, &actions, _1, _2)]
+ snippet [ph::bind(&actions_type::compile, &actions, _1, _2)]
| classic::anychar_p
)
;
@@ -45,7 +49,7 @@
code_elements =
escaped_comment
| ignore
- | (classic::anychar_p - "#]") [boost::bind(&actions_type::pass_thru, &actions, _1, _2)]
+ | (classic::anychar_p - "#]") [ph::bind(&actions_type::pass_thru, &actions, _1, _2)]
;
ignore =
@@ -63,10 +67,10 @@
escaped_comment =
*classic::space_p >> "#`"
>> ((*(classic::anychar_p - classic::eol_p))
- >> classic::eol_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ >> classic::eol_p) [ph::bind(&actions_type::escaped_comment, &actions, _1, _2)]
| *classic::space_p >> "\"\"\"`"
>> (*(classic::anychar_p - "\"\"\""))
- [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ [ph::bind(&actions_type::escaped_comment, &actions, _1, _2)]
>> "\"\"\""
;
}
@@ -79,7 +83,7 @@
start_ =
+(
- snippet [boost::bind(&actions_type::compile, &actions, _1, _2)]
+ snippet [ph::bind(&actions_type::compile, &actions, _1, _2)]
| classic::anychar_p
)
;
@@ -107,18 +111,18 @@
| line_callout
| inline_callout
| (classic::anychar_p - "//]" - "/*]*/")
- [boost::bind(&actions_type::pass_thru, &actions, _1, _2)]
+ [ph::bind(&actions_type::pass_thru, &actions, _1, _2)]
;
inline_callout =
"/*<"
- >> (*(classic::anychar_p - ">*/")) [boost::bind(&actions_type::inline_callout, &actions, _1, _2)]
+ >> (*(classic::anychar_p - ">*/")) [ph::bind(&actions_type::inline_callout, &actions, _1, _2)]
>> ">*/"
;
line_callout =
"/*<<"
- >> (*(classic::anychar_p - ">>*/")) [boost::bind(&actions_type::line_callout, &actions, _1, _2)]
+ >> (*(classic::anychar_p - ">>*/")) [ph::bind(&actions_type::line_callout, &actions, _1, _2)]
>> ">>*/"
>> *classic::space_p
;
@@ -138,10 +142,10 @@
escaped_comment =
*classic::space_p >> "//`"
>> ((*(classic::anychar_p - classic::eol_p))
- >> classic::eol_p) [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ >> classic::eol_p) [ph::bind(&actions_type::escaped_comment, &actions, _1, _2)]
| *classic::space_p >> "/*`"
>> (*(classic::anychar_p - "*/"))
- [boost::bind(&actions_type::escaped_comment, &actions, _1, _2)]
+ [ph::bind(&actions_type::escaped_comment, &actions, _1, _2)]
>> "*/"
;
}
Modified: branches/quickbook-1.5-spirit2/detail/actions.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/actions.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/actions.cpp 2009-11-18 18:10:29 EST (Wed, 18 Nov 2009)
@@ -10,7 +10,6 @@
=============================================================================*/
#include <numeric>
#include <functional>
-#include <boost/bind.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp>
Modified: branches/quickbook-1.5-spirit2/detail/post_process.cpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/post_process.cpp (original)
+++ branches/quickbook-1.5-spirit2/detail/post_process.cpp 2009-11-18 18:10:29 EST (Wed, 18 Nov 2009)
@@ -9,7 +9,8 @@
#include "./post_process.hpp"
#include "./utils.hpp"
#include <boost/spirit/include/classic_core.hpp>
-#include <boost/bind.hpp>
+#include <boost/spirit/include/phoenix_core.hpp>
+#include <boost/spirit/include/phoenix_bind.hpp>
#include <set>
#include <stack>
#include <cctype>
@@ -17,7 +18,9 @@
namespace quickbook
{
using namespace boost::spirit;
- using boost::bind;
+ namespace ph = boost::phoenix;
+ using namespace ph::arg_names;
+ using ph::bind;
typedef std::string::const_iterator iter_type;
struct printer
@@ -264,7 +267,7 @@
{
definition(tidy_grammar const& self)
{
- tag = (classic::lexeme_d[+(classic::alpha_p | '_' | ':')]) [bind(&tidy_grammar::do_tag, &self, _1, _2)];
+ tag = (classic::lexeme_d[+(classic::alpha_p | '_' | ':')]) [ph::bind(&tidy_grammar::do_tag, &self, _1, _2)];
code =
"<programlisting>"
@@ -280,14 +283,14 @@
classic::str_p("<!--quickbook-escape-prefix-->") >>
(*(classic::anychar_p - classic::str_p("<!--quickbook-escape-postfix-->")))
[
- bind(&tidy_grammar::do_escape, &self, _1, _2)
+ ph::bind(&tidy_grammar::do_escape, &self, _1, _2)
]
>> classic::lexeme_d
[
classic::str_p("<!--quickbook-escape-postfix-->") >>
(*classic::space_p)
[
- bind(&tidy_grammar::do_escape_post, &self, _1, _2)
+ ph::bind(&tidy_grammar::do_escape_post, &self, _1, _2)
]
]
;
@@ -304,11 +307,11 @@
markup =
escape
- | code [bind(&tidy_grammar::do_code, &self, _1, _2)]
- | start_end_tag [bind(&tidy_grammar::do_start_end_tag, &self, _1, _2)]
- | start_tag [bind(&tidy_grammar::do_start_tag, &self, _1, _2)]
- | end_tag [bind(&tidy_grammar::do_end_tag, &self, _1, _2)]
- | content [bind(&tidy_grammar::do_content, &self, _1, _2)]
+ | code [ph::bind(&tidy_grammar::do_code, &self, _1, _2)]
+ | start_end_tag [ph::bind(&tidy_grammar::do_start_end_tag, &self, _1, _2)]
+ | start_tag [ph::bind(&tidy_grammar::do_start_tag, &self, _1, _2)]
+ | end_tag [ph::bind(&tidy_grammar::do_end_tag, &self, _1, _2)]
+ | content [ph::bind(&tidy_grammar::do_content, &self, _1, _2)]
;
tidy = +markup;
Modified: branches/quickbook-1.5-spirit2/detail/quickbook.hpp
==============================================================================
--- branches/quickbook-1.5-spirit2/detail/quickbook.hpp (original)
+++ branches/quickbook-1.5-spirit2/detail/quickbook.hpp 2009-11-18 18:10:29 EST (Wed, 18 Nov 2009)
@@ -12,35 +12,35 @@
#if !defined(BOOST_SPIRIT_QUICKBOOK_QUICKBOOK_HPP)
#define BOOST_SPIRIT_QUICKBOOK_QUICKBOOK_HPP
+#include <boost/spirit/include/phoenix_function.hpp>
+
namespace quickbook
{
extern unsigned qbk_major_version;
extern unsigned qbk_minor_version;
extern unsigned qbk_version_n; // qbk_major_version * 100 + qbk_minor_version
- struct quickbook_range {
- template <typename Arg>
- struct result
- {
- typedef bool type;
- };
-
- quickbook_range(unsigned min_, unsigned max_)
- : min_(min_), max_(max_) {}
+ struct quickbook_since_impl {
+ template <typename Arg1>
+ struct result { typedef bool type; };
- bool operator()() const {
- return qbk_version_n >= min_ && qbk_version_n < max_;
+ bool operator()(unsigned min_) const {
+ return qbk_version_n >= min_;
}
+ };
- unsigned min_, max_;
+ struct quickbook_before_impl {
+ template <typename Arg1>
+ struct result { typedef bool type; };
+
+ bool operator()(unsigned max_) const {
+ return qbk_version_n < max_;
+ }
};
-
- inline quickbook_range qbk_since(unsigned min_) {
- return quickbook_range(min_, 999);
- }
-
- inline quickbook_range qbk_before(unsigned max_) {
- return quickbook_range(0, max_);
+
+ namespace {
+ boost::phoenix::function<quickbook_since_impl> qbk_since;
+ boost::phoenix::function<quickbook_before_impl> qbk_before;
}
}
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