<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>FAUST compiler: eval.hh File Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.6.3 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs"> <ul> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> </div> <div class="contents"> <h1>eval.hh File Reference</h1> <p>Interface of the block diagram evaluator. <a href="#_details">More...</a></p> <code>#include "<a class="el" href="boxes_8hh_source.html">boxes.hh</a>"</code><br/> <code>#include "<a class="el" href="sourcereader_8hh_source.html">sourcereader.hh</a>"</code><br/> <div class="dynheader"> Include dependency graph for eval.hh:</div> <div class="dynsection"> </div> <div class="dynheader"> This graph shows which files directly or indirectly include this file:</div> <div class="dynsection"> </div> <p><a href="eval_8hh_source.html">Go to the source code of this file.</a></p> <table border="0" cellpadding="0" cellspacing="0"> <tr><td colspan="2"><h2>Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="eval_8hh.html#a11fbac16c4eda5f687d7aa92551039c9">evalprocess</a> (<a class="el" href="classCTree.html">Tree</a> eqlist)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Eval the definition of 'process'. <a href="#a11fbac16c4eda5f687d7aa92551039c9"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="eval_8hh.html#a4d1e61c6742d24447d08bddbbe341c1f">evaldocexpr</a> (<a class="el" href="classCTree.html">Tree</a> docexpr, <a class="el" href="classCTree.html">Tree</a> eqlist)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="eval_8hh.html#adf6ba37a28536372e3be65128c79e615">searchIdDef</a> (<a class="el" href="classCTree.html">Tree</a> id, <a class="el" href="classCTree.html">Tree</a> &def, <a class="el" href="classCTree.html">Tree</a> lenv)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Search the environment for the definition of a symbol ID and return it. <a href="#adf6ba37a28536372e3be65128c79e615"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="eval_8hh.html#ad057f174a67a40fd689fc379a5a21c2d">pushValueDef</a> (<a class="el" href="classCTree.html">Tree</a> id, <a class="el" href="classCTree.html">Tree</a> def, <a class="el" href="classCTree.html">Tree</a> lenv)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Push a new layer and add a single definition. <a href="#ad057f174a67a40fd689fc379a5a21c2d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="eval_8hh.html#af924c3151bebd01af733bb0a1e39237c">simplifyPattern</a> (<a class="el" href="classCTree.html">Tree</a> pattern)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Simplify a block-diagram pattern by computing its numerical sub-expressions. <a href="#af924c3151bebd01af733bb0a1e39237c"></a><br/></td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Interface of the block diagram evaluator. </p> <p>A strict lambda-calculus evaluator for block diagram expressions. </p> <p>Definition in file <a class="el" href="eval_8hh_source.html">eval.hh</a>.</p> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a4d1e61c6742d24447d08bddbbe341c1f"></a><!-- doxytag: member="eval.hh::evaldocexpr" ref="a4d1e61c6742d24447d08bddbbe341c1f" args="(Tree docexpr, Tree eqlist)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> evaldocexpr </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>docexpr</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>eqlist</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="eval_8cpp_source.html#l00110">110</a> of file <a class="el" href="eval_8cpp_source.html">eval.cpp</a>.</p> <p>References <a class="el" href="eval_8cpp_source.html#l00131">a2sb()</a>, <a class="el" href="eval_8cpp_source.html#l00279">eval()</a>, <a class="el" href="list_8cpp_source.html#l00116">nil</a>, and <a class="el" href="eval_8cpp_source.html#l01204">pushMultiClosureDefs()</a>.</p> <p>Referenced by <a class="el" href="doc_8cpp_source.html#l00557">mapEvalDocEqn()</a>, and <a class="el" href="doc_8cpp_source.html#l00829">printDocDgm()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00111"></a>00111 { <a name="l00112"></a>00112 <span class="keywordflow">return</span> <a class="code" href="eval_8cpp.html#ab218db6f96ba6409f52548e525897685">a2sb</a>(<a class="code" href="eval_8cpp.html#aaf2a81f44d9e4e6dc257b394f00f28df">eval</a>(docexpr, <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>, <a class="code" href="eval_8cpp.html#a7665d6a948607fc0b8437099625c429a" title="Push a new layer with multiple definitions creating the appropriate closures.">pushMultiClosureDefs</a>(eqlist, <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>, <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>))); <a name="l00113"></a>00113 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a11fbac16c4eda5f687d7aa92551039c9"></a><!-- doxytag: member="eval.hh::evalprocess" ref="a11fbac16c4eda5f687d7aa92551039c9" args="(Tree eqlist)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> evalprocess </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>eqlist</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Eval the definition of 'process'. </p> <p>Eval the definition of 'process' in the environment passed as argument </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>eqlist</em> </td><td>the global environment (a list of definitions) </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the 'process' block diagram in normal form that is</dd></dl> <p>Eval the definition of 'process'.</p> <p>Strict evaluation of a block diagram expression by applying beta reduction. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>eqlist</em> </td><td>a list of faust defintions forming the the global environment </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the process block diagram in normal form </dd></dl> <p>Definition at line <a class="el" href="eval_8cpp_source.html#l00102">102</a> of file <a class="el" href="eval_8cpp_source.html">eval.cpp</a>.</p> <p>References <a class="el" href="eval_8cpp_source.html#l00131">a2sb()</a>, <a class="el" href="boxes_8cpp_source.html#l00056">boxIdent()</a>, <a class="el" href="eval_8cpp_source.html#l00279">eval()</a>, <a class="el" href="list_8cpp_source.html#l00116">nil</a>, and <a class="el" href="eval_8cpp_source.html#l01204">pushMultiClosureDefs()</a>.</p> <p>Referenced by <a class="el" href="main_8cpp_source.html#l00475">main()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00103"></a>00103 { <a name="l00104"></a>00104 <span class="keywordflow">return</span> <a class="code" href="eval_8cpp.html#ab218db6f96ba6409f52548e525897685">a2sb</a>(<a class="code" href="eval_8cpp.html#aaf2a81f44d9e4e6dc257b394f00f28df">eval</a>(<a class="code" href="boxes_8cpp.html#ab32253e24dd40d91b770b381da0d35b1">boxIdent</a>(<span class="stringliteral">"process"</span>), <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>, <a class="code" href="eval_8cpp.html#a7665d6a948607fc0b8437099625c429a" title="Push a new layer with multiple definitions creating the appropriate closures.">pushMultiClosureDefs</a>(eqlist, <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>, <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>))); <a name="l00105"></a>00105 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> <p><div class="dynheader"> Here is the caller graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="ad057f174a67a40fd689fc379a5a21c2d"></a><!-- doxytag: member="eval.hh::pushValueDef" ref="ad057f174a67a40fd689fc379a5a21c2d" args="(Tree id, Tree def, Tree lenv)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> pushValueDef </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>def</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>lenv</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Push a new layer and add a single definition. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>the symbol id to be defined </td></tr> <tr><td valign="top"></td><td valign="top"><em>def</em> </td><td>the definition to be binded to the symbol id </td></tr> <tr><td valign="top"></td><td valign="top"><em>lenv</em> </td><td>the environment where to push the layer and add the definition </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the new environment </dd></dl> <p>Definition at line <a class="el" href="eval_8cpp_source.html#l01189">1189</a> of file <a class="el" href="eval_8cpp_source.html">eval.cpp</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l01190"></a>01190 { <a name="l01191"></a>01191 <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> lenv2 = <a class="code" href="eval_8cpp.html#a4c12b1741c548fc686dca046095fbc6f" title="Push a new (unique) empty layer (where multiple definitions can be stored) on top...">pushNewLayer</a>(lenv); <a name="l01192"></a>01192 <a class="code" href="eval_8cpp.html#a7f5f4731ffc9c2c137ae52c11df0ab94" title="Add a definition (as a property) to the current top level layer.">addLayerDef</a>(<span class="keywordtype">id</span>, def, lenv2); <a name="l01193"></a>01193 <span class="keywordflow">return</span> lenv2; <a name="l01194"></a>01194 } </pre></div></p> </div> </div> <a class="anchor" id="adf6ba37a28536372e3be65128c79e615"></a><!-- doxytag: member="eval.hh::searchIdDef" ref="adf6ba37a28536372e3be65128c79e615" args="(Tree id, Tree &def, Tree lenv)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool searchIdDef </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>id</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> & </td> <td class="paramname"> <em>def</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>lenv</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Search the environment for the definition of a symbol ID and return it. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>id</em> </td><td>the symbol ID to search </td></tr> <tr><td valign="top"></td><td valign="top"><em>def</em> </td><td>where to store the definition if any </td></tr> <tr><td valign="top"></td><td valign="top"><em>lenv</em> </td><td>the environment </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true if a definition was found </dd></dl> <p>Definition at line <a class="el" href="eval_8cpp_source.html#l01229">1229</a> of file <a class="el" href="eval_8cpp_source.html">eval.cpp</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l01230"></a>01230 { <a name="l01231"></a>01231 <span class="comment">// search the environment until a definition is found</span> <a name="l01232"></a>01232 <span class="comment">// or nil (the empty environment) is reached</span> <a name="l01233"></a>01233 <span class="keywordflow">while</span> (!<a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(lenv) && !<a class="code" href="list_8cpp.html#a665745948013d012bb123e9577c094bd">getProperty</a>(lenv, <span class="keywordtype">id</span>, def)) { <a name="l01234"></a>01234 lenv = lenv-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(0); <a name="l01235"></a>01235 } <a name="l01236"></a>01236 <span class="keywordflow">return</span> !<a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(lenv); <a name="l01237"></a>01237 } </pre></div></p> </div> </div> <a class="anchor" id="af924c3151bebd01af733bb0a1e39237c"></a><!-- doxytag: member="eval.hh::simplifyPattern" ref="af924c3151bebd01af733bb0a1e39237c" args="(Tree pattern)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> simplifyPattern </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>value</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Simplify a block-diagram pattern by computing its numerical sub-expressions. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>pattern</em> </td><td>an evaluated block-diagram </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>a simplified pattern </dd></dl> <p>Definition at line <a class="el" href="eval_8cpp_source.html#l00605">605</a> of file <a class="el" href="eval_8cpp_source.html">eval.cpp</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00606"></a>00606 { <a name="l00607"></a>00607 <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> <a class="code" href="classnum.html">num</a>; <a name="l00608"></a>00608 <span class="keywordflow">if</span> (!<a class="code" href="eval_8cpp.html#ac91fbe8e83a3c6b44c1e699521f8d960">getNumericProperty</a>(value,num)) { <a name="l00609"></a>00609 <span class="keywordflow">if</span> (!<a class="code" href="eval_8cpp.html#a0f9b3d2672c752d8d3e87904f22e1ebd">isBoxNumeric</a>(value,num)) { <a name="l00610"></a>00610 num = value; <a name="l00611"></a>00611 } <a name="l00612"></a>00612 <a class="code" href="eval_8cpp.html#a5f7473c40d765c93ecad984cb9338334">setNumericProperty</a>(value,num); <a name="l00613"></a>00613 } <a name="l00614"></a>00614 <span class="keywordflow">return</span> num; <a name="l00615"></a>00615 } </pre></div></p> </div> </div> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:06 2010 for FAUST compiler by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>