Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68617 - in sandbox/SOC/2010/phoenix3: boost/phoenix/core libs/phoenix/doc libs/phoenix/doc/html libs/phoenix/doc/html/phoenix libs/phoenix/doc/html/phoenix/inside libs/phoenix/doc/html/phoenix/modules libs/phoenix/doc/html/phoenix/modules/core libs/phoenix/doc/html/phoenix/modules/stl libs/phoenix/doc/html/phoenix/starter_kit libs/phoenix/doc/inside libs/phoenix/doc/modules libs/phoenix/example
From: thom.heller_at_[hidden]
Date: 2011-02-03 02:06:08


Author: theller
Date: 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
New Revision: 68617
URL: http://svn.boost.org/trac/boost/changeset/68617

Log:
expression section in the docs
Added:
   sandbox/SOC/2010/phoenix3/libs/phoenix/example/define_expression.cpp (contents, props changed)
Text files modified:
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/meta_grammar.hpp | 7 +++-
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/index.html | 14 ++++----
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/basics.html | 10 +++---
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/inside/actor.html | 18 +++++-----
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/inside/expression.html | 62 ++++++++++++++++++++++++++++++++++++++-
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/arguments.html | 8 ++--
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/references.html | 4 +-
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/values.html | 2
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/function.html | 2
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/operator.html | 12 +++---
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/stl/algorithm.html | 6 +-
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/stl/container.html | 4 +-
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/organization.html | 6 +-
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit.html | 2
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/lazy_functions.html | 4 +-
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/lazy_operators.html | 2
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/values.html | 4 +-
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/inside/expression.qbk | 49 ++++++++++++++++++++++++++++++
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/modules/function.qbk | 2
   sandbox/SOC/2010/phoenix3/libs/phoenix/doc/phoenix3.qbk | 1
   20 files changed, 162 insertions(+), 57 deletions(-)

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/meta_grammar.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/meta_grammar.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/meta_grammar.hpp 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -50,14 +50,17 @@
     // construct
     struct default_actions
     {
- typedef void is_phoenix_action;
-
         template <typename Rule, typename Dummy = void>
         struct when
             : proto::_default<meta_grammar>
         {};
     };
 
+ template <typename Rule>
+ struct enable_rule
+ : proto::when<Rule, proto::external_transform>
+ {};
+
     /////////////////////////////////////////////////////////////////////////////
     // A function object we can call to evaluate our expression
     evaluator const eval = {};

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/index.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/index.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/index.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -26,7 +26,7 @@
 </h3></div></div>
 <div><p class="copyright">Copyright &#169; 2002-2005, 2010 Joel de Guzman, Dan Marsden, Thomas Heller</p></div>
 <div><div class="legalnotice">
-<a name="id679074"></a><p>
+<a name="id637431"></a><p>
         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)
       </p>
@@ -117,7 +117,7 @@
 </dl>
 </div>
 <a name="phoenix.preface"></a><h2>
-<a name="id709770"></a>
+<a name="id668128"></a>
     <a class="link" href="index.html#phoenix.preface">Preface</a>
   </h2>
 <div class="blockquote"><blockquote class="blockquote"><p>
@@ -136,7 +136,7 @@
     <span class="inlinemediaobject"><img src="images/lambda_cpp.png" alt="lambda_cpp"></span>
   </p>
 <a name="phoenix.description"></a><h3>
-<a name="id677877"></a>
+<a name="id636234"></a>
     <a class="link" href="index.html#phoenix.description">Description</a>
   </h3>
 <p>
@@ -154,7 +154,7 @@
     library is organized in highly independent modules and layers.
   </p>
 <a name="phoenix.how_to_use_this_manual"></a><h3>
-<a name="id677924"></a>
+<a name="id636282"></a>
     <a class="link" href="index.html#phoenix.how_to_use_this_manual">How to use this manual</a>
   </h3>
 <p>
@@ -176,7 +176,7 @@
     icons precede some text to indicate:
   </p>
 <div class="table">
-<a name="id677959"></a><p class="title"><b>Table&#160;1.1.&#160;Icons</b></p>
+<a name="id636316"></a><p class="title"><b>Table&#160;1.1.&#160;Icons</b></p>
 <div class="table-contents"><table class="table" summary="Icons">
 <colgroup>
 <col>
@@ -265,12 +265,12 @@
   </p>
 </div>
 <a name="phoenix._emphasis_role__bold___emphasis____to_my_dear_daughter__phoenix__emphasis___emphasis_"></a><h3>
-<a name="id718727"></a>
+<a name="id677085"></a>
     <a class="link" href="index.html#phoenix._emphasis_role__bold___emphasis____to_my_dear_daughter__phoenix__emphasis___emphasis_"><span class="bold"><strong><span class="emphasis"><em>...To my dear daughter, Phoenix</em></span></strong></span></a>
   </h3>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: February 02, 2011 at 10:55:25 GMT</small></p></td>
+<td align="left"><p><small>Last revised: February 03, 2011 at 07:04:48 GMT</small></p></td>
 <td align="right"><div class="copyright-footer"></div></td>
 </tr></table>
 <hr>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/basics.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/basics.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/basics.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -42,7 +42,7 @@
       </p></td></tr>
 </table></div>
 <a name="phoenix.basics.partial_function_application"></a><h4>
-<a name="id722113"></a>
+<a name="id680471"></a>
       <a class="link" href="basics.html#phoenix.basics.partial_function_application">Partial Function
       Application</a>
     </h4>
@@ -94,7 +94,7 @@
       black boxes anymore.
     </p>
 <a name="phoenix.basics.stl_and_higher_order_functions"></a><h4>
-<a name="id722329"></a>
+<a name="id680686"></a>
       <a class="link" href="basics.html#phoenix.basics.stl_and_higher_order_functions">STL and higher
       order functions</a>
     </h4>
@@ -126,7 +126,7 @@
       </p></td></tr>
 </table></div>
 <a name="phoenix.basics.lazy_evaluation"></a><h4>
-<a name="id722540"></a>
+<a name="id680897"></a>
       <a class="link" href="basics.html#phoenix.basics.lazy_evaluation">Lazy Evaluation</a>
     </h4>
 <p>
@@ -181,7 +181,7 @@
 </span><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special">&lt;&lt;</span> <span class="special">(</span><span class="identifier">arg1</span> <span class="special">%</span> <span class="number">2</span> <span class="special">==</span> <span class="number">1</span><span class="special">)(</span><span class="identifier">y</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// prints 0 or false
 </span></pre>
 <a name="phoenix.basics.forwarding_function_problem"></a><h4>
-<a name="id723082"></a>
+<a name="id681440"></a>
       <a class="link" href="basics.html#phoenix.basics.forwarding_function_problem">Forwarding Function
       Problem</a>
     </h4>
@@ -222,7 +222,7 @@
       </p></td></tr>
 </table></div>
 <a name="phoenix.basics.polymorphic_functions"></a><h4>
-<a name="id723220"></a>
+<a name="id681578"></a>
       <a class="link" href="basics.html#phoenix.basics.polymorphic_functions">Polymorphic Functions</a>
     </h4>
 <p>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/inside/actor.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/inside/actor.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/inside/actor.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -20,7 +20,7 @@
 <a name="phoenix.inside.actor"></a><a class="link" href="actor.html" title="Actors in Detail">Actors in Detail</a>
 </h3></div></div></div>
 <a name="phoenix.inside.actor.actor"></a><h5>
-<a name="id752849"></a>
+<a name="id711206"></a>
         <a class="link" href="actor.html#phoenix.inside.actor.actor">Actor</a>
       </h5>
 <p>
@@ -70,7 +70,7 @@
 </span><span class="special">};</span>
 </pre>
 <div class="table">
-<a name="id753366"></a><p class="title"><b>Table&#160;1.9.&#160;Actor Concept Requirements</b></p>
+<a name="id711724"></a><p class="title"><b>Table&#160;1.9.&#160;Actor Concept Requirements</b></p>
 <div class="table-contents"><table class="table" summary="Actor Concept Requirements">
 <colgroup>
 <col>
@@ -136,7 +136,7 @@
 </table></div>
 </div>
 <br class="table-break"><a name="phoenix.inside.actor.function_call_operators"></a><h5>
-<a name="id753668"></a>
+<a name="id712025"></a>
         <a class="link" href="actor.html#phoenix.inside.actor.function_call_operators">Function Call
         Operators</a>
       </h5>
@@ -169,7 +169,7 @@
 </td></tr>
 </table></div>
 <a name="phoenix.inside.actor.context"></a><h5>
-<a name="id753774"></a>
+<a name="id712132"></a>
         <a class="link" href="actor.html#phoenix.inside.actor.context">Context</a>
       </h5>
 <p>
@@ -180,7 +180,7 @@
         all information necessary to evaluate the given expression.
       </p>
 <div class="table">
-<a name="id753819"></a><p class="title"><b>Table&#160;1.10.&#160;Context Concept Requirements</b></p>
+<a name="id712176"></a><p class="title"><b>Table&#160;1.10.&#160;Context Concept Requirements</b></p>
 <div class="table-contents"><table class="table" summary="Context Concept Requirements">
 <colgroup>
 <col>
@@ -278,7 +278,7 @@
 </table></div>
 </div>
 <br class="table-break"><a name="phoenix.inside.actor.environment"></a><h5>
-<a name="id754186"></a>
+<a name="id712543"></a>
         <a class="link" href="actor.html#phoenix.inside.actor.environment">Environment</a>
       </h5>
 <p>
@@ -297,7 +297,7 @@
         such as local variables, etc.
       </p>
 <a name="phoenix.inside.actor.actions"></a><h5>
-<a name="id754252"></a>
+<a name="id712609"></a>
         <a class="link" href="actor.html#phoenix.inside.actor.actions">Actions</a>
       </h5>
 <p>
@@ -335,7 +335,7 @@
         custom actions to the evaluation process, see the next sections.
       </p>
 <a name="phoenix.inside.actor.evaluation"></a><h5>
-<a name="id754527"></a>
+<a name="id712885"></a>
         <a class="link" href="actor.html#phoenix.inside.actor.evaluation">Evaluation</a>
       </h5>
 <pre class="programlisting"><span class="keyword">struct</span> <span class="identifier">evaluator</span>
@@ -366,7 +366,7 @@
 <span class="special">}</span>
 </pre>
 <a name="phoenix.inside.actor.result_of__actor"></a><h5>
-<a name="id755032"></a>
+<a name="id713389"></a>
         <a class="link" href="actor.html#phoenix.inside.actor.result_of__actor">result_of::actor</a>
       </h5>
 <p>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/inside/expression.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/inside/expression.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/inside/expression.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -135,7 +135,7 @@
 </tbody>
 </table></div>
 <a name="phoenix.inside.expression.meta_grammar"></a><h5>
-<a name="id756398"></a>
+<a name="id714755"></a>
         <a class="link" href="expression.html#phoenix.inside.expression.meta_grammar">meta_grammar</a>
       </h5>
 <p>
@@ -162,9 +162,65 @@
         matches nothing. With every <a class="link" href="../modules.html" title="Modules">Module</a>
         you include this grammar gets extended by various expressions.
       </p>
+<a name="phoenix.inside.expression.example"></a><h5>
+<a name="id714986"></a>
+ <a class="link" href="expression.html#phoenix.inside.expression.example">Example</a>
+ </h5>
+<p>
+ Define an expression:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Lhs</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Rhs</span><span class="special">&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">add</span>
+ <span class="special">:</span> <span class="identifier">expr</span><span class="special">&lt;</span><span class="identifier">proto</span><span class="special">::</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">plus</span><span class="special">,</span> <span class="identifier">Lhs</span><span class="special">,</span> <span class="identifier">Rhs</span><span class="special">&gt;</span>
+<span class="special">{};</span>
+</pre>
+<p>
+ And add it to the grammar:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;&gt;</span>
+<span class="keyword">struct</span> <span class="identifier">meta_grammar</span><span class="special">::</span><span class="identifier">case_</span><span class="special">&lt;</span><span class="identifier">proto</span><span class="special">::</span><span class="identifier">tag</span><span class="special">::</span><span class="identifier">plus</span><span class="special">&gt;</span>
+ <span class="special">:</span> <span class="identifier">enable_rule</span><span class="special">&lt;</span>
+ <span class="identifier">add</span><span class="special">&lt;</span>
+ <span class="identifier">meta_grammar</span>
+ <span class="special">,</span> <span class="identifier">meta_grammar</span>
+ <span class="special">&gt;</span>
+ <span class="special">&gt;</span>
+<span class="special">{};</span>
+</pre>
+<p>
+ Define a generator function to make the life of our potential users easier:
+ </p>
+<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">typename</span> <span class="identifier">Lhs</span><span class="special">,</span> <span class="keyword">typename</span> <span class="identifier">Rhs</span><span class="special">&gt;</span>
+<span class="keyword">typename</span> <span class="identifier">add</span><span class="special">&lt;</span><span class="identifier">Lhs</span><span class="special">,</span> <span class="identifier">Rhs</span><span class="special">&gt;::</span><span class="identifier">type</span>
+<span class="identifier">add</span><span class="special">(</span><span class="identifier">Lhs</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">lhs</span><span class="special">,</span> <span class="identifier">Rhs</span> <span class="keyword">const</span> <span class="special">&amp;</span> <span class="identifier">rhs</span><span class="special">)</span>
+<span class="special">{</span>
+ <span class="keyword">return</span> <span class="identifier">add</span><span class="special">&lt;</span><span class="identifier">Lhs</span><span class="special">,</span> <span class="identifier">Rhs</span><span class="special">&gt;::</span><span class="identifier">make</span><span class="special">(</span><span class="identifier">lhs</span><span class="special">,</span> <span class="identifier">rhs</span><span class="special">);</span>
+<span class="special">}</span>
+</pre>
+<p>
+ Look of it really works:
+ </p>
+<pre class="programlisting"><span class="identifier">add</span><span class="special">(</span><span class="number">6</span><span class="special">,</span> <span class="number">5</span><span class="special">)();</span>
+</pre>
+<p>
+ returns 11!
+ </p>
+<pre class="programlisting"><span class="identifier">proto</span><span class="special">::</span><span class="identifier">display_expr</span><span class="special">(</span><span class="identifier">add</span><span class="special">(</span><span class="number">5</span><span class="special">,</span> <span class="number">6</span><span class="special">));</span>
+</pre>
+<p>
+ prints:
+ </p>
+<pre class="programlisting"><span class="identifier">plus</span><span class="special">(</span>
+ <span class="identifier">terminal</span><span class="special">(</span><span class="number">6</span><span class="special">)</span>
+ <span class="special">,</span> <span class="identifier">terminal</span><span class="special">(</span><span class="number">5</span><span class="special">)</span>
+<span class="special">)</span>
+</pre>
+<p>
+ See define_expression.cpp
+ for the full example.
+ </p>
 <p>
- See <a class="link" href="adding_expressions.html" title="Adding Expressions">Adding Expressions</a>
- for more details.
+ <span class="emphasis"><em>Pretty simple ...</em></span>
       </p>
 </div>
 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/arguments.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/arguments.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/arguments.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -31,7 +31,7 @@
           an imaginary data-bin where a function argument will be placed.
         </p>
 <a name="phoenix.modules.core.arguments.predefined_arguments"></a><h6>
-<a name="id726166"></a>
+<a name="id684524"></a>
           <a class="link" href="arguments.html#phoenix.modules.core.arguments.predefined_arguments">Predefined
           Arguments</a>
         </h6>
@@ -75,7 +75,7 @@
           </p></td></tr>
 </table></div>
 <a name="phoenix.modules.core.arguments.user_defined_arguments"></a><h6>
-<a name="id726692"></a>
+<a name="id685049"></a>
           <a class="link" href="arguments.html#phoenix.modules.core.arguments.user_defined_arguments">User
           Defined Arguments</a>
         </h6>
@@ -97,7 +97,7 @@
 <pre class="programlisting"><span class="identifier">add</span><span class="special">(</span><span class="identifier">arg1</span><span class="special">,</span> <span class="number">6</span><span class="special">)</span>
 </pre>
 <a name="phoenix.modules.core.arguments.evaluating_an_argument"></a><h6>
-<a name="id726843"></a>
+<a name="id685200"></a>
           <a class="link" href="arguments.html#phoenix.modules.core.arguments.evaluating_an_argument">Evaluating
           an Argument</a>
         </h6>
@@ -124,7 +124,7 @@
 <span class="identifier">Hello</span> <span class="identifier">World</span>
 </pre>
 <a name="phoenix.modules.core.arguments.extra_arguments"></a><h6>
-<a name="id727140"></a>
+<a name="id685498"></a>
           <a class="link" href="arguments.html#phoenix.modules.core.arguments.extra_arguments">Extra Arguments</a>
         </h6>
 <p>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/references.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/references.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/references.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -59,7 +59,7 @@
 <pre class="programlisting"><span class="identifier">add_assign</span><span class="special">(</span><span class="identifier">ref</span><span class="special">(</span><span class="identifier">i</span><span class="special">),</span> <span class="number">2</span><span class="special">)</span>
 </pre>
 <a name="phoenix.modules.core.references.evaluating_a_reference"></a><h6>
-<a name="id725764"></a>
+<a name="id684121"></a>
           <a class="link" href="references.html#phoenix.modules.core.references.evaluating_a_reference">Evaluating
           a Reference</a>
         </h6>
@@ -75,7 +75,7 @@
           prints out "3 Hello World"
         </p>
 <a name="phoenix.modules.core.references.constant_references"></a><h6>
-<a name="id725900"></a>
+<a name="id684258"></a>
           <a class="link" href="references.html#phoenix.modules.core.references.constant_references">Constant
           References</a>
         </h6>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/values.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/values.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/core/values.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -47,7 +47,7 @@
           but, as we'll see later on, there are situations where this is unavoidable.
         </p>
 <a name="phoenix.modules.core.values.evaluating_a_value"></a><h3>
-<a name="id725282"></a>
+<a name="id683640"></a>
           <a class="link" href="values.html#phoenix.modules.core.values.evaluating_a_value">Evaluating
           a Value</a>
         </h3>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/function.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/function.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/function.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -75,7 +75,7 @@
 <span class="special">};</span>
 </pre>
 <p>
- (See factorial.cpp)
+ (See factorial.cpp)
       </p>
 <p>
         Having implemented the <code class="computeroutput"><span class="identifier">factorial_impl</span></code>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/operator.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/operator.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/operator.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -134,18 +134,18 @@
 </span><span class="identifier">val</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">&lt;&lt;</span> <span class="number">3</span><span class="special">;</span> <span class="comment">// Lazily evaluated
 </span></pre>
 <a name="phoenix.modules.operator.supported_operators"></a><h5>
-<a name="id729577"></a>
+<a name="id687935"></a>
         <a class="link" href="operator.html#phoenix.modules.operator.supported_operators">Supported operators</a>
       </h5>
 <a name="phoenix.modules.operator.unary_operators"></a><h5>
-<a name="id729596"></a>
+<a name="id687954"></a>
         <a class="link" href="operator.html#phoenix.modules.operator.unary_operators">Unary operators</a>
       </h5>
 <pre class="programlisting"><span class="identifier">prefix</span><span class="special">:</span> <span class="special">~,</span> <span class="special">!,</span> <span class="special">-,</span> <span class="special">+,</span> <span class="special">++,</span> <span class="special">--,</span> <span class="special">&amp;</span> <span class="special">(</span><span class="identifier">reference</span><span class="special">),</span> <span class="special">*</span> <span class="special">(</span><span class="identifier">dereference</span><span class="special">)</span>
 <span class="identifier">postfix</span><span class="special">:</span> <span class="special">++,</span> <span class="special">--</span>
 </pre>
 <a name="phoenix.modules.operator.binary_operators"></a><h5>
-<a name="id729727"></a>
+<a name="id688085"></a>
         <a class="link" href="operator.html#phoenix.modules.operator.binary_operators">Binary operators</a>
       </h5>
 <pre class="programlisting"><span class="special">=,</span> <span class="special">[],</span> <span class="special">+=,</span> <span class="special">-=,</span> <span class="special">*=,</span> <span class="special">/=,</span> <span class="special">%=,</span> <span class="special">&amp;=,</span> <span class="special">|=,</span> <span class="special">^=,</span> <span class="special">&lt;&lt;=,</span> <span class="special">&gt;&gt;=</span>
@@ -154,7 +154,7 @@
 <span class="special">&amp;&amp;,</span> <span class="special">||,</span> <span class="special">-&gt;*</span>
 </pre>
 <a name="phoenix.modules.operator.ternary_operator"></a><h5>
-<a name="id729929"></a>
+<a name="id688286"></a>
         <a class="link" href="operator.html#phoenix.modules.operator.ternary_operator">Ternary operator</a>
       </h5>
 <pre class="programlisting"><span class="identifier">if_else</span><span class="special">(</span><span class="identifier">c</span><span class="special">,</span> <span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">)</span>
@@ -167,7 +167,7 @@
         albeit in a lazy manner.
       </p>
 <a name="phoenix.modules.operator.member_pointer_operator"></a><h5>
-<a name="id730030"></a>
+<a name="id688387"></a>
         <a class="link" href="operator.html#phoenix.modules.operator.member_pointer_operator">Member pointer
         operator</a>
       </h5>
@@ -208,7 +208,7 @@
 <span class="special">(</span><span class="identifier">arg1</span><span class="special">-&gt;*&amp;</span><span class="identifier">A</span><span class="special">::</span><span class="identifier">func</span><span class="special">)(</span><span class="identifier">arg2</span><span class="special">)(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">i</span><span class="special">);</span> <span class="comment">// returns a-&gt;func(i)
 </span></pre>
 <a name="phoenix.modules.operator.include_files"></a><h5>
-<a name="id730410"></a>
+<a name="id688767"></a>
         <a class="link" href="operator.html#phoenix.modules.operator.include_files">Include Files</a>
       </h5>
 <div class="informaltable"><table class="table">

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/stl/algorithm.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/stl/algorithm.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/stl/algorithm.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -73,7 +73,7 @@
         </p>
 </div>
 <div class="table">
-<a name="id744301"></a><p class="title"><b>Table&#160;1.6.&#160;Iteration Algorithms</b></p>
+<a name="id702658"></a><p class="title"><b>Table&#160;1.6.&#160;Iteration Algorithms</b></p>
 <div class="table-contents"><table class="table" summary="Iteration Algorithms">
 <colgroup>
 <col>
@@ -128,7 +128,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id744579"></a><p class="title"><b>Table&#160;1.7.&#160;Querying Algorithms</b></p>
+<a name="id702936"></a><p class="title"><b>Table&#160;1.7.&#160;Querying Algorithms</b></p>
 <div class="table-contents"><table class="table" summary="Querying Algorithms">
 <colgroup>
 <col>
@@ -441,7 +441,7 @@
 </table></div>
 </div>
 <br class="table-break"><div class="table">
-<a name="id747051"></a><p class="title"><b>Table&#160;1.8.&#160;Transformation Algorithms</b></p>
+<a name="id705408"></a><p class="title"><b>Table&#160;1.8.&#160;Transformation Algorithms</b></p>
 <div class="table-contents"><table class="table" summary="Transformation Algorithms">
 <colgroup>
 <col>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/stl/container.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/stl/container.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/modules/stl/container.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -137,7 +137,7 @@
           does not use the member "dot" syntax.
         </p>
 <div class="table">
-<a name="id741250"></a><p class="title"><b>Table&#160;1.4.&#160;Sample usage</b></p>
+<a name="id699607"></a><p class="title"><b>Table&#160;1.4.&#160;Sample usage</b></p>
 <div class="table-contents"><table class="table" summary="Sample usage">
 <colgroup>
 <col>
@@ -215,7 +215,7 @@
         </p>
 </div>
 <div class="table">
-<a name="id741589"></a><p class="title"><b>Table&#160;1.5.&#160;Lazy STL Container Functions</b></p>
+<a name="id699946"></a><p class="title"><b>Table&#160;1.5.&#160;Lazy STL Container Functions</b></p>
 <div class="table-contents"><table class="table" summary="Lazy STL Container Functions">
 <colgroup>
 <col>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/organization.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/organization.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/organization.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -52,7 +52,7 @@
       files. There are no object files to link against.
     </p>
 <a name="phoenix.organization.core"></a><h3>
-<a name="id723612"></a>
+<a name="id681970"></a>
       <a class="link" href="organization.html#phoenix.organization.core">Core</a>
     </h3>
 <p>
@@ -72,7 +72,7 @@
       can again be another expression.
     </p>
 <div class="table">
-<a name="id723651"></a><p class="title"><b>Table&#160;1.2.&#160;Modules</b></p>
+<a name="id682008"></a><p class="title"><b>Table&#160;1.2.&#160;Modules</b></p>
 <div class="table-contents"><table class="table" summary="Modules">
 <colgroup>
 <col>
@@ -200,7 +200,7 @@
       core module is defined in <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">phoenix</span><span class="special">/</span><span class="identifier">core</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>.
     </p>
 <div class="table">
-<a name="id723939"></a><p class="title"><b>Table&#160;1.3.&#160;Includes</b></p>
+<a name="id682296"></a><p class="title"><b>Table&#160;1.3.&#160;Includes</b></p>
 <div class="table-contents"><table class="table" summary="Includes">
 <colgroup>
 <col>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -52,7 +52,7 @@
       into high gear quickly.
     </p>
 <a name="phoenix.starter_kit.functors_everywhere"></a><h4>
-<a name="id718832"></a>
+<a name="id677189"></a>
       <a class="link" href="starter_kit.html#phoenix.starter_kit.functors_everywhere">Functors everywhere</a>
     </h4>
 <p>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/lazy_functions.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/lazy_functions.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/lazy_functions.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -45,7 +45,7 @@
 <span class="identifier">function</span><span class="special">&lt;</span><span class="identifier">is_odd_impl</span><span class="special">&gt;</span> <span class="identifier">is_odd</span><span class="special">;</span>
 </pre>
 <a name="phoenix.starter_kit.lazy_functions.things_to_note_"></a><h5>
-<a name="id721633"></a>
+<a name="id679990"></a>
         <a class="link" href="lazy_functions.html#phoenix.starter_kit.lazy_functions.things_to_note_">Things
         to note:</a>
       </h5>
@@ -75,7 +75,7 @@
         (See function.cpp)
       </p>
 <a name="phoenix.starter_kit.lazy_functions.predefined_lazy_functions"></a><h5>
-<a name="id721810"></a>
+<a name="id680168"></a>
         <a class="link" href="lazy_functions.html#phoenix.starter_kit.lazy_functions.predefined_lazy_functions">Predefined
         Lazy Functions</a>
       </h5>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/lazy_operators.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/lazy_operators.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/lazy_operators.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -69,7 +69,7 @@
       </p>
 </div>
 <a name="phoenix.starter_kit.lazy_operators.first_practical_example"></a><h5>
-<a name="id720559"></a>
+<a name="id678917"></a>
         <a class="link" href="lazy_operators.html#phoenix.starter_kit.lazy_operators.first_practical_example">First
         Practical Example</a>
       </h5>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/values.html
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/values.html (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/html/phoenix/starter_kit/values.html 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -32,7 +32,7 @@
         World"</span></code>.
       </p>
 <a name="phoenix.starter_kit.values.lazy_evaluation"></a><h5>
-<a name="id718996"></a>
+<a name="id677353"></a>
         <a class="link" href="values.html#phoenix.starter_kit.values.lazy_evaluation">Lazy Evaluation</a>
       </h5>
 <p>
@@ -64,7 +64,7 @@
         anything and defers the evaluation for later.
       </p>
 <a name="phoenix.starter_kit.values.callbacks"></a><h5>
-<a name="id719221"></a>
+<a name="id677578"></a>
         <a class="link" href="values.html#phoenix.starter_kit.values.callbacks">Callbacks</a>
       </h5>
 <p>

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/inside/expression.qbk
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/inside/expression.qbk (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/inside/expression.qbk 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -70,6 +70,53 @@
 As you can see, by default the `meta_grammar` matches nothing. With every [link phoenix.modules Module]
 you include this grammar gets extended by various expressions.
 
-See [link phoenix.inside.adding_expressions Adding Expressions] for more details.
+[heading Example]
+
+Define an expression:
+
+ template <typename Lhs, typename Rhs>
+ struct add
+ : expr<proto::tag::plus, Lhs, Rhs>
+ {};
+
+And add it to the grammar:
+
+ template <>
+ struct meta_grammar::case_<proto::tag::plus>
+ : enable_rule<
+ add<
+ meta_grammar
+ , meta_grammar
+ >
+ >
+ {};
+
+Define a generator function to make the life of our potential users easier:
+
+ template <typename Lhs, typename Rhs>
+ typename add<Lhs, Rhs>::type
+ add(Lhs const & lhs, Rhs const & rhs)
+ {
+ return add<Lhs, Rhs>::make(lhs, rhs);
+ }
+
+Look of it really works:
+
+ add(6, 5)();
+
+returns 11!
+
+ proto::display_expr(add(5, 6));
+
+prints:
+
+ plus(
+ terminal(6)
+ , terminal(5)
+ )
+
+See [@../../example/define_expression.cpp define_expression.cpp] for the full example.
+
+/Pretty simple .../
 
 [endsect]

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/modules/function.qbk
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/modules/function.qbk (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/modules/function.qbk 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -57,7 +57,7 @@
         }
     };
 
-(See [@../../example/users_manual/factorial.cpp factorial.cpp])
+(See [@../../example/factorial.cpp factorial.cpp])
 
 [/note The type of Arg is either a const-reference or non-const-reference
 (depending on whether your argument to the actor evaluation is a const-ref or

Modified: sandbox/SOC/2010/phoenix3/libs/phoenix/doc/phoenix3.qbk
==============================================================================
--- sandbox/SOC/2010/phoenix3/libs/phoenix/doc/phoenix3.qbk (original)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/doc/phoenix3.qbk 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -67,4 +67,3 @@
 [/include wrap_up.qbk]
 [/include acknowledgment.qbk]
 [/include references.qbk]
-

Added: sandbox/SOC/2010/phoenix3/libs/phoenix/example/define_expression.cpp
==============================================================================
--- (empty file)
+++ sandbox/SOC/2010/phoenix3/libs/phoenix/example/define_expression.cpp 2011-02-03 02:05:59 EST (Thu, 03 Feb 2011)
@@ -0,0 +1,60 @@
+/*==============================================================================
+ Copyright (c) 2005-2010 Joel de Guzman
+ Copyright (c) 2011 Thomas Heller
+
+ 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)
+==============================================================================*/
+
+#include <boost/phoenix/core.hpp>
+
+namespace phoenix = boost::phoenix;
+namespace proto = boost::proto;
+
+
+// define the expression
+namespace expression
+{
+ template <typename Lhs, typename Rhs>
+ struct add
+ : phoenix::expr<proto::tag::plus, Lhs, Rhs>
+ {};
+}
+
+// extend the grammar, to recognice the expression
+namespace boost { namespace phoenix {
+
+ template <>
+ struct meta_grammar::case_<proto::tag::plus>
+ : enable_rule<
+ ::expression::add<
+ meta_grammar
+ , meta_grammar
+ >
+ >
+ {};
+
+}}
+
+// build a generator
+template <typename Lhs, typename Rhs>
+typename expression::add<Lhs, Rhs>::type
+add(Lhs const & lhs, Rhs const & rhs)
+{
+ return expression::add<Lhs, Rhs>::make(lhs, rhs);
+}
+
+#include <boost/proto/proto.hpp>
+#include <iostream>
+
+int main()
+{
+
+ add(6, 5);
+
+ proto::display_expr(add(6, 5));
+
+ std::cout << add(5, 6)() << "\n";
+}
+
+


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