<!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: simplify.cpp 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>simplify.cpp File Reference</h1><code>#include <stdio.h></code><br/> <code>#include <assert.h></code><br/> <code>#include "<a class="el" href="signals_8hh_source.html">signals.hh</a>"</code><br/> <code>#include "<a class="el" href="sigtype_8hh_source.html">sigtype.hh</a>"</code><br/> <code>#include "<a class="el" href="sigtyperules_8hh_source.html">sigtyperules.hh</a>"</code><br/> <code>#include "<a class="el" href="sigorderrules_8hh_source.html">sigorderrules.hh</a>"</code><br/> <code>#include "<a class="el" href="sigprint_8hh_source.html">sigprint.hh</a>"</code><br/> <code>#include "<a class="el" href="simplify_8hh_source.html">simplify.hh</a>"</code><br/> <code>#include "<a class="el" href="num_8hh_source.html">num.hh</a>"</code><br/> <code>#include "<a class="el" href="xtended_8hh_source.html">xtended.hh</a>"</code><br/> <code>#include <map></code><br/> <code>#include "<a class="el" href="normalize_8hh_source.html">normalize.hh</a>"</code><br/> <div class="dynheader"> Include dependency graph for simplify.cpp:</div> <div class="dynsection"> </div> <p><a href="simplify_8cpp_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">static <a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="simplify_8cpp.html#a7b22c54137b97107c3b85e47673b31fb">simplification</a> (<a class="el" href="classCTree.html">Tree</a> sig)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a> (<a class="el" href="classCTree.html">Tree</a> key, <a class="el" href="list_8hh.html#af77d25f8b1016f673088d066636124f0">tfun</a> f, <a class="el" href="classCTree.html">Tree</a> t)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="simplify_8cpp.html#a35da54b35dd0185d20bc701858e7ee78">traced_simplification</a> (<a class="el" href="classCTree.html">Tree</a> sig)</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="simplify_8cpp.html#aa58ab1a209023cba186f077cfdcc5339">simplify</a> (<a class="el" href="classCTree.html">Tree</a> sig)</td></tr> <tr><td class="memItemLeft" align="right" valign="top">static <a class="el" href="classCTree.html">Tree</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="simplify_8cpp.html#af76e31bf9418c0058e1e53fe1f28fd37">docTableConverter</a> (<a class="el" href="classCTree.html">Tree</a> sig)</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="simplify_8cpp.html#a6a3298b9c61dc3351c7460dab1c9bbde">docTableConvertion</a> (<a class="el" href="classCTree.html">Tree</a> sig)</td></tr> <tr><td colspan="2"><h2>Variables</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="simplify_8cpp.html#a1f636fd69986781f5d26ec775109daa4">SIMPLIFIED</a> = tree(symbol("sigSimplifiedProp"))</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="simplify_8cpp.html#a8c1271398d8698aad1778fd8482fdd99">DOCTABLES</a> = tree(symbol("DocTablesProp"))</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Converts regular tables into doc tables in order to facilitate the mathematical documentation generation. <a href="#a8c1271398d8698aad1778fd8482fdd99"></a><br/></td></tr> </table> <hr/><h2>Function Documentation</h2> <a class="anchor" id="af76e31bf9418c0058e1e53fe1f28fd37"></a><!-- doxytag: member="simplify.cpp::docTableConverter" ref="af76e31bf9418c0058e1e53fe1f28fd37" args="(Tree sig)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="classCTree.html">Tree</a> docTableConverter </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>sig</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="simplify_8cpp_source.html#l00218">218</a> of file <a class="el" href="simplify_8cpp_source.html">simplify.cpp</a>.</p> <p>References <a class="el" href="signals_8cpp_source.html#l00091">isSigGen()</a>, <a class="el" href="signals_8cpp_source.html#l00077">isSigRDTbl()</a>, <a class="el" href="signals_8cpp_source.html#l00085">isSigTable()</a>, <a class="el" href="signals_8cpp_source.html#l00081">isSigWRTbl()</a>, <a class="el" href="signals_8cpp_source.html#l00106">sigDocAccessTbl()</a>, <a class="el" href="signals_8cpp_source.html#l00098">sigDocConstantTbl()</a>, and <a class="el" href="signals_8cpp_source.html#l00102">sigDocWriteTbl()</a>.</p> <p>Referenced by <a class="el" href="simplify_8cpp_source.html#l00210">docTableConvertion()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00219"></a>00219 { <a name="l00220"></a>00220 <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> tbl, tbl2, id, id2, size, igen, isig, ridx, widx, wsig; <a name="l00221"></a>00221 <a name="l00222"></a>00222 <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a9d9cbd375c200fa4e666de6ffb72dbca">isSigRDTbl</a>(sig, tbl, ridx)) { <a name="l00223"></a>00223 <span class="comment">// we are in a table to convert</span> <a name="l00224"></a>00224 <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#aa9b2ad7a65566fbc382d60e315b42740">isSigTable</a>(tbl, <span class="keywordtype">id</span>, size, igen)) { <a name="l00225"></a>00225 <span class="comment">// it's a read only table</span> <a name="l00226"></a>00226 assert(<a class="code" href="signals_8cpp.html#a771720237ca174a55a6823cc6623d602">isSigGen</a>(igen, isig)); <a name="l00227"></a>00227 <span class="keywordflow">return</span> <a class="code" href="signals_8cpp.html#abd470373166f165e8f30f3fd97e05221">sigDocAccessTbl</a>(<a class="code" href="signals_8cpp.html#a36c185c79cf8b98f470efba0af2efc69">sigDocConstantTbl</a>(size,isig),ridx); <a name="l00228"></a>00228 } <span class="keywordflow">else</span> { <a name="l00229"></a>00229 <span class="comment">// it's a read write table</span> <a name="l00230"></a>00230 assert(<a class="code" href="signals_8cpp.html#ab5b22110acbd38b7d4634dc94bcc8d22">isSigWRTbl</a>(tbl,<span class="keywordtype">id</span>,tbl2,widx,wsig)); <a name="l00231"></a>00231 assert(<a class="code" href="signals_8cpp.html#aa9b2ad7a65566fbc382d60e315b42740">isSigTable</a>(tbl2, id2, size, igen)); <a name="l00232"></a>00232 assert(<a class="code" href="signals_8cpp.html#a771720237ca174a55a6823cc6623d602">isSigGen</a>(igen, isig)); <a name="l00233"></a>00233 <a name="l00234"></a>00234 <span class="keywordflow">return</span> <a class="code" href="signals_8cpp.html#abd470373166f165e8f30f3fd97e05221">sigDocAccessTbl</a>(<a class="code" href="signals_8cpp.html#a800922251924a88b4cda1a07422af14c">sigDocWriteTbl</a>(size,isig,widx,wsig),ridx); <a name="l00235"></a>00235 } <a name="l00236"></a>00236 <a name="l00237"></a>00237 } <span class="keywordflow">else</span> { <a name="l00238"></a>00238 <span class="comment">// nothing to convert</span> <a name="l00239"></a>00239 <span class="keywordflow">return</span> sig; <a name="l00240"></a>00240 } <a name="l00241"></a>00241 } </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="a6a3298b9c61dc3351c7460dab1c9bbde"></a><!-- doxytag: member="simplify.cpp::docTableConvertion" ref="a6a3298b9c61dc3351c7460dab1c9bbde" args="(Tree sig)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> docTableConvertion </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>sig</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="simplify_8cpp_source.html#l00210">210</a> of file <a class="el" href="simplify_8cpp_source.html">simplify.cpp</a>.</p> <p>References <a class="el" href="simplify_8cpp_source.html#l00218">docTableConverter()</a>, and <a class="el" href="simplify_8cpp_source.html#l00154">sigMap()</a>.</p> <p>Referenced by <a class="el" href="doc_8cpp_source.html#l00645">mapPrepareEqSig()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00211"></a>00211 { <a name="l00212"></a>00212 <span class="keywordflow">return</span> <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(<a class="code" href="simplify_8cpp.html#a8c1271398d8698aad1778fd8482fdd99" title="Converts regular tables into doc tables in order to facilitate the mathematical documentation...">DOCTABLES</a>, <a class="code" href="simplify_8cpp.html#af76e31bf9418c0058e1e53fe1f28fd37">docTableConverter</a>, sig); <a name="l00213"></a>00213 } </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="ace56a3d5066db13e82962b20d9db195e"></a><!-- doxytag: member="simplify.cpp::sigMap" ref="ace56a3d5066db13e82962b20d9db195e" args="(Tree key, tfun f, Tree t)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="classCTree.html">Tree</a> sigMap </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>key</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype"><a class="el" href="list_8hh.html#af77d25f8b1016f673088d066636124f0">tfun</a> </td> <td class="paramname"> <em>f</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>t</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="simplify_8cpp_source.html#l00154">154</a> of file <a class="el" href="simplify_8cpp_source.html">simplify.cpp</a>.</p> <p>References <a class="el" href="tree_8hh_source.html#l00142">CTree::arity()</a>, <a class="el" href="tree_8hh_source.html#l00143">CTree::branch()</a>, <a class="el" href="list_8cpp_source.html#l00423">getProperty()</a>, <a class="el" href="list_8hh_source.html#l00137">isNil()</a>, <a class="el" href="recursive-tree_8cpp_source.html#l00059">isRec()</a>, <a class="el" href="list_8cpp_source.html#l00116">nil</a>, <a class="el" href="tree_8hh_source.html#l00141">CTree::node()</a>, <a class="el" href="recursive-tree_8cpp_source.html#l00054">rec()</a>, <a class="el" href="list_8cpp_source.html#l00418">setProperty()</a>, and <a class="el" href="tree_8hh_source.html#l00173">tree()</a>.</p> <p>Referenced by <a class="el" href="simplify_8cpp_source.html#l00210">docTableConvertion()</a>, and <a class="el" href="simplify_8cpp_source.html#l00072">simplify()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00155"></a>00155 { <a name="l00156"></a>00156 <span class="comment">//printf("start sigMap\n");</span> <a name="l00157"></a>00157 <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> p,id,body; <a name="l00158"></a>00158 <a name="l00159"></a>00159 <span class="keywordflow">if</span> (<a class="code" href="list_8cpp.html#a665745948013d012bb123e9577c094bd">getProperty</a>(t, key, p)) { <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keywordflow">return</span> (<a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(p)) ? t : p; <span class="comment">// truc pour eviter les boucles</span> <a name="l00162"></a>00162 <a name="l00163"></a>00163 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="recursive-tree_8cpp.html#a4cb44c6e41e21da830e748dc35f16ba5" title="is t a de Bruijn recursive tree">isRec</a>(t, <span class="keywordtype">id</span>, body)) { <a name="l00164"></a>00164 <a name="l00165"></a>00165 <a class="code" href="list_8cpp.html#a5ead5a3e91af18d8f94e0974990a3c5a">setProperty</a>(t, key, <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>); <span class="comment">// avoid infinite loop</span> <a name="l00166"></a>00166 <span class="keywordflow">return</span> <a class="code" href="recursive-tree_8cpp.html#aa598f21268aa7198407d2eb6929d09ab" title="create a de Bruijn recursive tree">rec</a>(<span class="keywordtype">id</span>, <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key, f, body)); <a name="l00167"></a>00167 <a name="l00168"></a>00168 } <span class="keywordflow">else</span> { <a name="l00169"></a>00169 <a name="l00170"></a>00170 <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> r1=<a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>; <a name="l00171"></a>00171 <span class="keywordflow">switch</span> (t-><a class="code" href="classCTree.html#a68f2be5e845407bc956a2893fe6f0d03" title="return the number of branches (subtrees) of a tree">arity</a>()) { <a name="l00172"></a>00172 <a name="l00173"></a>00173 <span class="keywordflow">case</span> 0 : <a name="l00174"></a>00174 r1 = t; <a name="l00175"></a>00175 <span class="keywordflow">break</span>; <a name="l00176"></a>00176 <span class="keywordflow">case</span> 1 : <a name="l00177"></a>00177 r1 = <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(t-><a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>(), <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(0))); <a name="l00178"></a>00178 <span class="keywordflow">break</span>; <a name="l00179"></a>00179 <span class="keywordflow">case</span> 2 : <a name="l00180"></a>00180 r1 = <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(t-><a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>(), <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(0)), <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(1))); <a name="l00181"></a>00181 <span class="keywordflow">break</span>; <a name="l00182"></a>00182 <span class="keywordflow">case</span> 3 : <a name="l00183"></a>00183 r1 = <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(t-><a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>(), <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(0)), <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(1)), <a name="l00184"></a>00184 <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(2))); <a name="l00185"></a>00185 <span class="keywordflow">break</span>; <a name="l00186"></a>00186 <span class="keywordflow">case</span> 4 : <a name="l00187"></a>00187 r1 = <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(t-><a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>(), <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(0)), <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(1)), <a name="l00188"></a>00188 <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(2)), <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(key,f,t-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(3))); <a name="l00189"></a>00189 <span class="keywordflow">break</span>; <a name="l00190"></a>00190 } <a name="l00191"></a>00191 <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> r2 = f(r1); <a name="l00192"></a>00192 <span class="keywordflow">if</span> (r2 == t) { <a name="l00193"></a>00193 <a class="code" href="list_8cpp.html#a5ead5a3e91af18d8f94e0974990a3c5a">setProperty</a>(t, key, <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>); <a name="l00194"></a>00194 } <span class="keywordflow">else</span> { <a name="l00195"></a>00195 <a class="code" href="list_8cpp.html#a5ead5a3e91af18d8f94e0974990a3c5a">setProperty</a>(t, key, r2); <a name="l00196"></a>00196 } <a name="l00197"></a>00197 <span class="keywordflow">return</span> r2; <a name="l00198"></a>00198 } <a name="l00199"></a>00199 } </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="a7b22c54137b97107c3b85e47673b31fb"></a><!-- doxytag: member="simplify.cpp::simplification" ref="a7b22c54137b97107c3b85e47673b31fb" args="(Tree sig)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="classCTree.html">Tree</a> simplification </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>sig</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="simplify_8cpp_source.html#l00080">80</a> of file <a class="el" href="simplify_8cpp_source.html">simplify.cpp</a>.</p> <p>References <a class="el" href="tree_8hh_source.html#l00142">CTree::arity()</a>, <a class="el" href="tree_8hh_source.html#l00143">CTree::branch()</a>, <a class="el" href="binop_8hh_source.html#l00045">BinOp::compute()</a>, <a class="el" href="classxtended.html#a0a088a599b3cdd9bcd1854446f145af8">xtended::computeSigOutput()</a>, <a class="el" href="binop_8cpp_source.html#l00028">gBinOpTable</a>, <a class="el" href="symbol_8hh_source.html#l00100">getUserData()</a>, <a class="el" href="node_8hh_source.html#l00137">isDouble()</a>, <a class="el" href="node_8hh_source.html#l00120">isInt()</a>, <a class="el" href="binop_8hh_source.html#l00048">BinOp::isLeftNeutral()</a>, <a class="el" href="signals_8hh_source.html#l00184">isNum()</a>, <a class="el" href="binop_8hh_source.html#l00047">BinOp::isRightNeutral()</a>, <a class="el" href="signals_8cpp_source.html#l00126">isSigBinOp()</a>, <a class="el" href="signals_8cpp_source.html#l00058">isSigDelay1()</a>, <a class="el" href="signals_8cpp_source.html#l00062">isSigFixDelay()</a>, <a class="el" href="signals_8cpp_source.html#l00187">isSigFloatCast()</a>, <a class="el" href="signals_8cpp_source.html#l00184">isSigIntCast()</a>, <a class="el" href="tree_8hh_source.html#l00141">CTree::node()</a>, <a class="el" href="normalize_8cpp_source.html#l00032">normalizeAddTerm()</a>, <a class="el" href="normalize_8cpp_source.html#l00059">normalizeDelay1Term()</a>, <a class="el" href="normalize_8cpp_source.html#l00081">normalizeFixedDelayTerm()</a>, and <a class="el" href="tree_8hh_source.html#l00173">tree()</a>.</p> <p>Referenced by <a class="el" href="simplify_8cpp_source.html#l00046">traced_simplification()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00081"></a>00081 { <a name="l00082"></a>00082 assert(sig); <a name="l00083"></a>00083 <span class="keywordtype">int</span> opnum; <a name="l00084"></a>00084 <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> t1, t2; <a name="l00085"></a>00085 <a name="l00086"></a>00086 <a class="code" href="classxtended.html">xtended</a>* xt = (<a class="code" href="classxtended.html">xtended</a>*) <a class="code" href="symbol_8hh.html#a603fcb6c07eacf2688c2a8470637d0ff" title="Returns user data.">getUserData</a>(sig); <a name="l00087"></a>00087 <span class="comment">// primitive elements</span> <a name="l00088"></a>00088 <span class="keywordflow">if</span> (xt) <a name="l00089"></a>00089 { <a name="l00090"></a>00090 <span class="comment">//return 3;</span> <a name="l00091"></a>00091 vector<Tree> args; <a name="l00092"></a>00092 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<sig-><a class="code" href="classCTree.html#a68f2be5e845407bc956a2893fe6f0d03" title="return the number of branches (subtrees) of a tree">arity</a>(); i++) { args.push_back( sig-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(i) ); } <a name="l00093"></a>00093 <span class="keywordflow">return</span> xt-><a class="code" href="classxtended.html#a0a088a599b3cdd9bcd1854446f145af8">computeSigOutput</a>(args); <a name="l00094"></a>00094 <a name="l00095"></a>00095 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a8705584c3c319be54be73dc391d25634">isSigBinOp</a>(sig, &opnum, t1, t2)) { <a name="l00096"></a>00096 <a name="l00097"></a>00097 <a class="code" href="structBinOp.html">BinOp</a>* op = <a class="code" href="binop_8cpp.html#a2d55d4b4acaed7188a432ffdb646395a">gBinOpTable</a>[opnum]; <a name="l00098"></a>00098 <a name="l00099"></a>00099 <a class="code" href="classNode.html" title="Class Node = (type x (int + double + Sym + void*)).">Node</a> n1 = t1-><a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>(); <a name="l00100"></a>00100 <a class="code" href="classNode.html" title="Class Node = (type x (int + double + Sym + void*)).">Node</a> n2 = t2-><a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>(); <a name="l00101"></a>00101 <a name="l00102"></a>00102 <span class="keywordflow">if</span> (<a class="code" href="signals_8hh.html#acd2773c99643a2dcc1c5409991c211e9">isNum</a>(n1) && <a class="code" href="signals_8hh.html#acd2773c99643a2dcc1c5409991c211e9">isNum</a>(n2)) <span class="keywordflow">return</span> <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(op-><a class="code" href="structBinOp.html#aa2a29825af89ac6dd8e08cac1261e5b8">compute</a>(n1,n2)); <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op-><a class="code" href="structBinOp.html#ac568fcce2d8708501528703bae2d91b2">isLeftNeutral</a>(n1)) <span class="keywordflow">return</span> t2; <a name="l00105"></a>00105 <a name="l00106"></a>00106 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (op-><a class="code" href="structBinOp.html#a16d591d0d171f8b5cf8aef9f1324e95d">isRightNeutral</a>(n2)) <span class="keywordflow">return</span> t1; <a name="l00107"></a>00107 <a name="l00108"></a>00108 <span class="keywordflow">else</span> <span class="keywordflow">return</span> <a class="code" href="normalize_8cpp.html#a84f5cc6ddcbd1db7e6f442b3bdf71363" title="Compute the Add-Normal form of a term t.">normalizeAddTerm</a>(sig); <a name="l00109"></a>00109 <a name="l00110"></a>00110 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a0899d7e2a69a467b0dcf62242397367f">isSigDelay1</a>(sig, t1)) { <a name="l00111"></a>00111 <a name="l00112"></a>00112 <span class="keywordflow">return</span> <a class="code" href="normalize_8cpp.html#abe85547196d79f5d315c81af052f8b2e" title="Compute the normal form of a 1-sample delay term s&#39;.">normalizeDelay1Term</a> (t1); <a name="l00113"></a>00113 <a name="l00114"></a>00114 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#af55cdefee258834b3b8f6c070d4970c9">isSigFixDelay</a>(sig, t1, t2)) { <a name="l00115"></a>00115 <a name="l00116"></a>00116 <span class="keywordflow">return</span> <a class="code" href="normalize_8cpp.html#a6ab3c9ebcc665f2c194600f7e9077a34" title="Compute the normal form of a fixed delay term (s).">normalizeFixedDelayTerm</a> (t1, t2); <a name="l00117"></a>00117 <a name="l00118"></a>00118 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a3ef48f0da2ef5b8e3ee7371a1e4059ae">isSigIntCast</a>(sig, t1)) { <a name="l00119"></a>00119 <a name="l00120"></a>00120 <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> tx; <a name="l00121"></a>00121 <span class="keywordtype">int</span> i; <a name="l00122"></a>00122 <span class="keywordtype">double</span> x; <a name="l00123"></a>00123 <a class="code" href="classNode.html" title="Class Node = (type x (int + double + Sym + void*)).">Node</a> n1 = t1-><a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>(); <a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="keywordflow">if</span> (<a class="code" href="node_8hh.html#a8c9b968ac68f6cac1c361002da8afe99">isInt</a>(n1, &i)) <span class="keywordflow">return</span> t1; <a name="l00126"></a>00126 <span class="keywordflow">if</span> (<a class="code" href="node_8hh.html#aab6c20fb5dce797e97ac8ec8591258af">isDouble</a>(n1, &x)) <span class="keywordflow">return</span> <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(<span class="keywordtype">int</span>(x)); <a name="l00127"></a>00127 <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a3ef48f0da2ef5b8e3ee7371a1e4059ae">isSigIntCast</a>(t1, tx)) <span class="keywordflow">return</span> t1; <a name="l00128"></a>00128 <a name="l00129"></a>00129 <span class="keywordflow">return</span> sig; <a name="l00130"></a>00130 <a name="l00131"></a>00131 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a52448156d86125bbc8de23d641217de2">isSigFloatCast</a>(sig, t1)) { <a name="l00132"></a>00132 <a name="l00133"></a>00133 <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> tx; <a name="l00134"></a>00134 <span class="keywordtype">int</span> i; <a name="l00135"></a>00135 <span class="keywordtype">double</span> x; <a name="l00136"></a>00136 <a class="code" href="classNode.html" title="Class Node = (type x (int + double + Sym + void*)).">Node</a> n1 = t1-><a class="code" href="classCTree.html#a8de786fec095c8304b9ffa7c1c316237" title="return the content of the tree">node</a>(); <a name="l00137"></a>00137 <a name="l00138"></a>00138 <span class="keywordflow">if</span> (<a class="code" href="node_8hh.html#a8c9b968ac68f6cac1c361002da8afe99">isInt</a>(n1, &i)) <span class="keywordflow">return</span> <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(<span class="keywordtype">double</span>(i)); <a name="l00139"></a>00139 <span class="keywordflow">if</span> (<a class="code" href="node_8hh.html#aab6c20fb5dce797e97ac8ec8591258af">isDouble</a>(n1, &x)) <span class="keywordflow">return</span> t1; <a name="l00140"></a>00140 <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a52448156d86125bbc8de23d641217de2">isSigFloatCast</a>(t1, tx)) <span class="keywordflow">return</span> t1; <a name="l00141"></a>00141 <a name="l00142"></a>00142 <span class="keywordflow">return</span> sig; <a name="l00143"></a>00143 <a name="l00144"></a>00144 } <span class="keywordflow">else</span> { <a name="l00145"></a>00145 <a name="l00146"></a>00146 <span class="keywordflow">return</span> sig; <a name="l00147"></a>00147 } <a name="l00148"></a>00148 } </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="aa58ab1a209023cba186f077cfdcc5339"></a><!-- doxytag: member="simplify.cpp::simplify" ref="aa58ab1a209023cba186f077cfdcc5339" args="(Tree sig)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> simplify </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>sig</em></td> <td> ) </td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="simplify_8cpp_source.html#l00072">72</a> of file <a class="el" href="simplify_8cpp_source.html">simplify.cpp</a>.</p> <p>References <a class="el" href="simplify_8cpp_source.html#l00154">sigMap()</a>, and <a class="el" href="simplify_8cpp_source.html#l00046">traced_simplification()</a>.</p> <p>Referenced by <a class="el" href="eval_8cpp_source.html#l00677">eval2double()</a>, <a class="el" href="eval_8cpp_source.html#l00706">eval2int()</a>, <a class="el" href="eval_8cpp_source.html#l00618">isBoxNumeric()</a>, <a class="el" href="doc_8cpp_source.html#l00645">mapPrepareEqSig()</a>, <a class="el" href="normalize_8cpp_source.html#l00081">normalizeFixedDelayTerm()</a>, <a class="el" href="compile__scal_8cpp_source.html#l00096">ScalarCompiler::prepare()</a>, and <a class="el" href="eval_8cpp_source.html#l00569">replaceBoxNumeric()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00073"></a>00073 { <a name="l00074"></a>00074 <span class="keywordflow">return</span> <a class="code" href="simplify_8cpp.html#ace56a3d5066db13e82962b20d9db195e">sigMap</a>(<a class="code" href="simplify_8cpp.html#a1f636fd69986781f5d26ec775109daa4">SIMPLIFIED</a>, <a class="code" href="simplify_8cpp.html#a35da54b35dd0185d20bc701858e7ee78">traced_simplification</a>, sig); <a name="l00075"></a>00075 } </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="a35da54b35dd0185d20bc701858e7ee78"></a><!-- doxytag: member="simplify.cpp::traced_simplification" ref="a35da54b35dd0185d20bc701858e7ee78" args="(Tree sig)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static <a class="el" href="classCTree.html">Tree</a> traced_simplification </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>sig</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="simplify_8cpp_source.html#l00046">46</a> of file <a class="el" href="simplify_8cpp_source.html">simplify.cpp</a>.</p> <p>References <a class="el" href="simplify_8cpp_source.html#l00080">simplification()</a>, and <a class="el" href="tree_8cpp_source.html#l00087">TABBER</a>.</p> <p>Referenced by <a class="el" href="simplify_8cpp_source.html#l00072">simplify()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00047"></a>00047 { <a name="l00048"></a>00048 assert(sig); <a name="l00049"></a>00049 <span class="preprocessor">#ifdef TRACE</span> <a name="l00050"></a>00050 <span class="preprocessor"></span> cerr << ++<a class="code" href="tree_8cpp.html#a559d741ee88818bb48d7ea8caf7419c1">TABBER</a> << <span class="stringliteral">"Start simplification of : "</span> << *sig << endl; <a name="l00051"></a>00051 <span class="comment">/*</span> <a name="l00052"></a>00052 <span class="comment"> fprintf(stderr, "\nStart simplification of : ");</span> <a name="l00053"></a>00053 <span class="comment"> printSignal(sig, stderr);</span> <a name="l00054"></a>00054 <span class="comment"> fprintf(stderr, "\n");</span> <a name="l00055"></a>00055 <span class="comment"> */</span> <a name="l00056"></a>00056 <span class="preprocessor">#endif</span> <a name="l00057"></a>00057 <span class="preprocessor"></span> <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> r = <a class="code" href="simplify_8cpp.html#a7b22c54137b97107c3b85e47673b31fb">simplification</a>(sig); <a name="l00058"></a>00058 assert(r!=0); <a name="l00059"></a>00059 <span class="preprocessor">#ifdef TRACE</span> <a name="l00060"></a>00060 <span class="preprocessor"></span> cerr << --<a class="code" href="tree_8cpp.html#a559d741ee88818bb48d7ea8caf7419c1">TABBER</a> << <span class="stringliteral">"Simplification of : "</span> << *sig << <span class="stringliteral">" Returns : "</span> << *r << endl; <a name="l00061"></a>00061 <span class="comment">/*</span> <a name="l00062"></a>00062 <span class="comment"> fprintf(stderr, "Simplification of : ");</span> <a name="l00063"></a>00063 <span class="comment"> printSignal(sig, stderr);</span> <a name="l00064"></a>00064 <span class="comment"> fprintf(stderr, " -> ");</span> <a name="l00065"></a>00065 <span class="comment"> printSignal(r, stderr);</span> <a name="l00066"></a>00066 <span class="comment"> fprintf(stderr, "\n");</span> <a name="l00067"></a>00067 <span class="comment"> */</span> <a name="l00068"></a>00068 <span class="preprocessor">#endif</span> <a name="l00069"></a>00069 <span class="preprocessor"></span> <span class="keywordflow">return</span> r; <a name="l00070"></a>00070 } </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> <hr/><h2>Variable Documentation</h2> <a class="anchor" id="a8c1271398d8698aad1778fd8482fdd99"></a><!-- doxytag: member="simplify.cpp::DOCTABLES" ref="a8c1271398d8698aad1778fd8482fdd99" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> <a class="el" href="simplify_8cpp.html#a8c1271398d8698aad1778fd8482fdd99">DOCTABLES</a> = tree(symbol("DocTablesProp"))</td> </tr> </table> </div> <div class="memdoc"> <p>Converts regular tables into doc tables in order to facilitate the mathematical documentation generation. </p> <p>Definition at line <a class="el" href="simplify_8cpp_source.html#l00206">206</a> of file <a class="el" href="simplify_8cpp_source.html">simplify.cpp</a>.</p> </div> </div> <a class="anchor" id="a1f636fd69986781f5d26ec775109daa4"></a><!-- doxytag: member="simplify.cpp::SIMPLIFIED" ref="a1f636fd69986781f5d26ec775109daa4" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="el" href="classCTree.html">Tree</a> <a class="el" href="simplify_8cpp.html#a1f636fd69986781f5d26ec775109daa4">SIMPLIFIED</a> = tree(symbol("sigSimplifiedProp"))</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="simplify_8cpp_source.html#l00041">41</a> of file <a class="el" href="simplify_8cpp_source.html">simplify.cpp</a>.</p> </div> </div> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:15 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>