<!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: colorize.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>colorize.cpp File Reference</h1> <p>Uses colors to analyze dependencies among sub expressions. <a href="#_details">More...</a></p> <code>#include "<a class="el" href="colorize_8cpp_source.html">colorize.h</a>"</code><br/> <code>#include <set></code><br/> <code>#include <algorithm></code><br/> <code>#include "<a class="el" href="tlib_8hh_source.html">tlib.hh</a>"</code><br/> <code>#include "<a class="el" href="signals_8hh_source.html">signals.hh</a>"</code><br/> <div class="dynheader"> Include dependency graph for colorize.cpp:</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="colorize_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 int </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#a4bd3d0035fd38bae8aa83898889bb22f">allocateColor</a> (<a class="el" href="classCTree.html">Tree</a> exp)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">allocate a new unique color for exp <a href="#a4bd3d0035fd38bae8aa83898889bb22f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#a8fceb2afc402ca2359e5de3d056de73d">colorize</a> (<a class="el" href="classCTree.html">Tree</a> exp, int color)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">add color information to exp and all its subtrees <a href="#a8fceb2afc402ca2359e5de3d056de73d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#a8d5048eda3154390aea0838aec62dc89">uncolorize</a> (<a class="el" href="classCTree.html">Tree</a> exp)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">remove color information <a href="#a8d5048eda3154390aea0838aec62dc89"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#a30dd1b2444e94cd3d6231eb8f7f112b5">listMultiColoredExp</a> (<a class="el" href="classCTree.html">Tree</a> exp, set< <a class="el" href="classCTree.html">Tree</a> > &lst)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">list multicolored subexpressions of exp <a href="#a30dd1b2444e94cd3d6231eb8f7f112b5"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#a0f8ff1d12378dd049340876374a0356f">splitDependance</a> (const set< <a class="el" href="classCTree.html">Tree</a> > &exps, set< <a class="el" href="classCTree.html">Tree</a> > &post, set< <a class="el" href="classCTree.html">Tree</a> > &pre)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">Analyze a set of expressions to discover its dependencies that is subexpressions common to at least two of these expressions. <a href="#a0f8ff1d12378dd049340876374a0356f"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#a8cd7e641a8f14e8195a61f82096fd610">addColor</a> (<a class="el" href="classCTree.html">Tree</a> exp, int color)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">a color to the colors of exp <a href="#a8cd7e641a8f14e8195a61f82096fd610"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static bool </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#ae5b5116d7c057d1abfaeed6b7f186c03">hasColor</a> (<a class="el" href="classCTree.html">Tree</a> exp, int color)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">true if exp is already colored with color <a href="#ae5b5116d7c057d1abfaeed6b7f186c03"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static int </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#ab54ffb1c6ba10aa111050d08e9bc2cd4">colorsCount</a> (<a class="el" href="classCTree.html">Tree</a> exp)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">returns the number of colors of exp <a href="#ab54ffb1c6ba10aa111050d08e9bc2cd4"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#a5aea1efcff76eacf3c026e3adb7331ae">clearColors</a> (<a class="el" href="classCTree.html">Tree</a> exp)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">remove the color property of exp <a href="#a5aea1efcff76eacf3c026e3adb7331ae"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#aade532065d8d5a93ff9f3b19d0008f2d">setColorProperty</a> (<a class="el" href="classCTree.html">Tree</a> sig, set< int > *colorset)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">set the color-set property of sig <a href="#aade532065d8d5a93ff9f3b19d0008f2d"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top">set< int > * </td><td class="memItemRight" valign="bottom"><a class="el" href="colorize_8cpp.html#a08f52f77166b2ebccb74fce43908ba45">getColorProperty</a> (<a class="el" href="classCTree.html">Tree</a> sig)</td></tr> <tr><td class="mdescLeft"> </td><td class="mdescRight">retrieve the color-set property of sig <a href="#a08f52f77166b2ebccb74fce43908ba45"></a><br/></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="colorize_8cpp.html#a0bf6d3ed426f7267aaa1f0b93f4bfc09">COLORPROPERTY</a> = tree(symbol("ColorProperty"))</td></tr> </table> <hr/><a name="_details"></a><h2>Detailed Description</h2> <p>Uses colors to analyze dependencies among sub expressions. </p> <p>Definition in file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <hr/><h2>Function Documentation</h2> <a class="anchor" id="a8cd7e641a8f14e8195a61f82096fd610"></a><!-- doxytag: member="colorize.cpp::addColor" ref="a8cd7e641a8f14e8195a61f82096fd610" args="(Tree exp, int color)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void addColor </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>exp</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>color</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>a color to the colors of exp </p> <p>Add a color to the colorset of exp.</p> <p>Create an empty coloset if needed. </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>sig</em> </td><td>the signal we want to color </td></tr> <tr><td valign="top"></td><td valign="top"><em>color</em> </td><td>the color used </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00154">154</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="colorize_8cpp_source.html#l00135">getColorProperty()</a>, and <a class="el" href="colorize_8cpp_source.html#l00125">setColorProperty()</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00073">colorize()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00155"></a>00155 { <a name="l00156"></a>00156 set<int>* cset = <a class="code" href="colorize_8cpp.html#a08f52f77166b2ebccb74fce43908ba45" title="retrieve the color-set property of sig">getColorProperty</a>(exp); <a name="l00157"></a>00157 <span class="keywordflow">if</span> (cset == 0) { <a name="l00158"></a>00158 cset = <span class="keyword">new</span> set<int>(); <a name="l00159"></a>00159 <a class="code" href="colorize_8cpp.html#aade532065d8d5a93ff9f3b19d0008f2d" title="set the color-set property of sig">setColorProperty</a>(exp, cset); <a name="l00160"></a>00160 } <a name="l00161"></a>00161 cset->insert(color); <a name="l00162"></a>00162 } </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="a4bd3d0035fd38bae8aa83898889bb22f"></a><!-- doxytag: member="colorize.cpp::allocateColor" ref="a4bd3d0035fd38bae8aa83898889bb22f" args="(Tree exp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">int allocateColor </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>exp</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>allocate a new unique color for exp </p> <p>Allocate a unique color (an integer) for an expression.</p> <p>by converting its address into an integer </p> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00059">59</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00028">splitDependance()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00060"></a>00060 { <a name="l00061"></a>00061 <span class="comment">// return int(exp); </span> <a name="l00062"></a>00062 <span class="keyword">static</span> map<Tree,int> colorMap; <a name="l00063"></a>00063 <span class="keyword">static</span> <span class="keywordtype">int</span> nextFreeColor = 1; <a name="l00064"></a>00064 <span class="keywordtype">int</span>& color = colorMap[exp]; <a name="l00065"></a>00065 <span class="keywordflow">if</span> (!color) <a name="l00066"></a>00066 color = nextFreeColor++; <a name="l00067"></a>00067 <span class="keywordflow">return</span> color; <a name="l00068"></a>00068 } </pre></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="a5aea1efcff76eacf3c026e3adb7331ae"></a><!-- doxytag: member="colorize.cpp::clearColors" ref="a5aea1efcff76eacf3c026e3adb7331ae" args="(Tree exp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static void clearColors </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>exp</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>remove the color property of exp </p> <p>Count the number of colors of exp.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>exp</em> </td><td>the expression we want to count the colors </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the number of elements in the color set or 0 </dd></dl> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00203">203</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="colorize_8cpp_source.html#l00135">getColorProperty()</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00086">uncolorize()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00204"></a>00204 { <a name="l00205"></a>00205 set<int>* cset = <a class="code" href="colorize_8cpp.html#a08f52f77166b2ebccb74fce43908ba45" title="retrieve the color-set property of sig">getColorProperty</a>(exp); <a name="l00206"></a>00206 <span class="keywordflow">if</span> (cset != 0) { <a name="l00207"></a>00207 cset->clear(); <a name="l00208"></a>00208 } <a name="l00209"></a>00209 } </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="a8fceb2afc402ca2359e5de3d056de73d"></a><!-- doxytag: member="colorize.cpp::colorize" ref="a8fceb2afc402ca2359e5de3d056de73d" args="(Tree exp, int color)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void colorize </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>exp</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>color</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>add color information to exp and all its subtrees </p> <p>Add a color to all the expression tree. </p> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00073">73</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="colorize_8cpp_source.html#l00154">addColor()</a>, <a class="el" href="subsignals_8cpp_source.html#l00010">getSubSignals()</a>, and <a class="el" href="colorize_8cpp_source.html#l00171">hasColor()</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00028">splitDependance()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00074"></a>00074 { <a name="l00075"></a>00075 <span class="keywordflow">if</span> (! <a class="code" href="colorize_8cpp.html#ae5b5116d7c057d1abfaeed6b7f186c03" title="true if exp is already colored with color">hasColor</a>(exp, color)) { <a name="l00076"></a>00076 <a class="code" href="colorize_8cpp.html#a8cd7e641a8f14e8195a61f82096fd610" title="a color to the colors of exp">addColor</a>(exp, color); <a name="l00077"></a>00077 vector<Tree> v; <a name="l00078"></a>00078 <span class="keywordtype">int</span> n = <a class="code" href="signals_8hh.html#ae5dd2bb17d8df90f5561bb8084b3f10f" title="Extract the sub signals of a signal expression, that is not necesseraly all the subtrees...">getSubSignals</a>(exp, v, <span class="keyword">false</span>); <a name="l00079"></a>00079 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<n; i++) <a class="code" href="colorize_8cpp.html#a8fceb2afc402ca2359e5de3d056de73d" title="add color information to exp and all its subtrees">colorize</a>(v[i], color); <a name="l00080"></a>00080 } <a name="l00081"></a>00081 } </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="ab54ffb1c6ba10aa111050d08e9bc2cd4"></a><!-- doxytag: member="colorize.cpp::colorsCount" ref="ab54ffb1c6ba10aa111050d08e9bc2cd4" args="(Tree exp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">static int colorsCount </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>exp</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>returns the number of colors of exp </p> <p>Count the number of colors of exp.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>exp</em> </td><td>the expression we want to count the colors </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>the number of elements in the color set or 0 </dd></dl> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00187">187</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="colorize_8cpp_source.html#l00135">getColorProperty()</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00099">listMultiColoredExp()</a>, and <a class="el" href="colorize_8cpp_source.html#l00086">uncolorize()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00188"></a>00188 { <a name="l00189"></a>00189 set<int>* cset = <a class="code" href="colorize_8cpp.html#a08f52f77166b2ebccb74fce43908ba45" title="retrieve the color-set property of sig">getColorProperty</a>(exp); <a name="l00190"></a>00190 <span class="keywordflow">if</span> (cset==0) { <a name="l00191"></a>00191 <span class="keywordflow">return</span> 0; <a name="l00192"></a>00192 } <span class="keywordflow">else</span> { <a name="l00193"></a>00193 <span class="keywordflow">return</span> cset->size(); <a name="l00194"></a>00194 } <a name="l00195"></a>00195 } </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="a08f52f77166b2ebccb74fce43908ba45"></a><!-- doxytag: member="colorize.cpp::getColorProperty" ref="a08f52f77166b2ebccb74fce43908ba45" args="(Tree sig)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">set<int>* getColorProperty </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>retrieve the color-set property of sig </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>sig</em> </td><td>the signal we want to know the color-set property </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00135">135</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="list_8cpp_source.html#l00423">getProperty()</a>, and <a class="el" href="tree_8cpp_source.html#l00302">tree2ptr()</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00154">addColor()</a>, <a class="el" href="colorize_8cpp_source.html#l00203">clearColors()</a>, <a class="el" href="colorize_8cpp_source.html#l00187">colorsCount()</a>, and <a class="el" href="colorize_8cpp_source.html#l00171">hasColor()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00136"></a>00136 { <a name="l00137"></a>00137 <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> tt; <a name="l00138"></a>00138 <span class="keywordflow">if</span> (!<a class="code" href="list_8cpp.html#a665745948013d012bb123e9577c094bd">getProperty</a>(sig, <a class="code" href="colorize_8cpp.html#a0bf6d3ed426f7267aaa1f0b93f4bfc09">COLORPROPERTY</a>, tt)) { <a name="l00139"></a>00139 <span class="keywordflow">return</span> 0; <a name="l00140"></a>00140 } <span class="keywordflow">else</span> { <a name="l00141"></a>00141 <span class="keywordflow">return</span> (set<int>*)<a class="code" href="tree_8cpp.html#ad1d692b2c0a86d485a3d096af07632e6" title="if t has a node of type ptr, return it otherwise error">tree2ptr</a>(tt); <a name="l00142"></a>00142 } <a name="l00143"></a>00143 } </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="ae5b5116d7c057d1abfaeed6b7f186c03"></a><!-- doxytag: member="colorize.cpp::hasColor" ref="ae5b5116d7c057d1abfaeed6b7f186c03" args="(Tree exp, int color)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">bool hasColor </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>exp</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">int </td> <td class="paramname"> <em>color</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>true if exp is already colored with color </p> <p>Test if exp as color in its colorset.</p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>sig</em> </td><td>the signal we want to test </td></tr> <tr><td valign="top"></td><td valign="top"><em>color</em> </td><td>the color to test </td></tr> </table> </dd> </dl> <dl class="return"><dt><b>Returns:</b></dt><dd>true if color is member of the colorset of sig </dd></dl> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00171">171</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="colorize_8cpp_source.html#l00135">getColorProperty()</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00073">colorize()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00172"></a>00172 { <a name="l00173"></a>00173 set<int>* cset = <a class="code" href="colorize_8cpp.html#a08f52f77166b2ebccb74fce43908ba45" title="retrieve the color-set property of sig">getColorProperty</a>(exp); <a name="l00174"></a>00174 <span class="keywordflow">if</span> (cset==0) { <a name="l00175"></a>00175 <span class="keywordflow">return</span> <span class="keyword">false</span>; <a name="l00176"></a>00176 } <span class="keywordflow">else</span> { <a name="l00177"></a>00177 <span class="keywordflow">return</span> cset->find(color) != cset->end(); <a name="l00178"></a>00178 } <a name="l00179"></a>00179 } </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="a30dd1b2444e94cd3d6231eb8f7f112b5"></a><!-- doxytag: member="colorize.cpp::listMultiColoredExp" ref="a30dd1b2444e94cd3d6231eb8f7f112b5" args="(Tree exp, set< Tree > &lst)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void listMultiColoredExp </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>exp</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">set< <a class="el" href="classCTree.html">Tree</a> > & </td> <td class="paramname"> <em>lst</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>list multicolored subexpressions of exp </p> <p>Make a set of the multicolored sub-expressions. </p> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00099">99</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="colorize_8cpp_source.html#l00187">colorsCount()</a>, and <a class="el" href="subsignals_8cpp_source.html#l00010">getSubSignals()</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00028">splitDependance()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00100"></a>00100 { <a name="l00101"></a>00101 assert(<a class="code" href="colorize_8cpp.html#ab54ffb1c6ba10aa111050d08e9bc2cd4" title="returns the number of colors of exp">colorsCount</a>(exp) > 0); <a name="l00102"></a>00102 <span class="keywordflow">if</span> (<a class="code" href="colorize_8cpp.html#ab54ffb1c6ba10aa111050d08e9bc2cd4" title="returns the number of colors of exp">colorsCount</a>(exp) > 1) { <a name="l00103"></a>00103 <span class="comment">// we have found a multicolored expression</span> <a name="l00104"></a>00104 lst.insert(exp); <a name="l00105"></a>00105 } <span class="keywordflow">else</span> { <a name="l00106"></a>00106 <span class="comment">// it is a monocolored expression</span> <a name="l00107"></a>00107 <span class="comment">// we search its subexpressions</span> <a name="l00108"></a>00108 vector<Tree> v; <a name="l00109"></a>00109 <span class="keywordtype">int</span> n = <a class="code" href="signals_8hh.html#ae5dd2bb17d8df90f5561bb8084b3f10f" title="Extract the sub signals of a signal expression, that is not necesseraly all the subtrees...">getSubSignals</a>(exp, v, <span class="keyword">false</span>); <a name="l00110"></a>00110 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<n; i++) { <a name="l00111"></a>00111 <a class="code" href="colorize_8cpp.html#a30dd1b2444e94cd3d6231eb8f7f112b5" title="list multicolored subexpressions of exp">listMultiColoredExp</a>(v[i], lst); <a name="l00112"></a>00112 } <a name="l00113"></a>00113 } <a name="l00114"></a>00114 } </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="aade532065d8d5a93ff9f3b19d0008f2d"></a><!-- doxytag: member="colorize.cpp::setColorProperty" ref="aade532065d8d5a93ff9f3b19d0008f2d" args="(Tree sig, set< int > *colorset)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void setColorProperty </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>sig</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">set< int > * </td> <td class="paramname"> <em>colorset</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>set the color-set property of sig </p> <dl><dt><b>Parameters:</b></dt><dd> <table border="0" cellspacing="2" cellpadding="0"> <tr><td valign="top"></td><td valign="top"><em>sig</em> </td><td>the signal we want to type </td></tr> <tr><td valign="top"></td><td valign="top"><em>t</em> </td><td>the type of the signal </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00125">125</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <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="colorize_8cpp_source.html#l00154">addColor()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00126"></a>00126 { <a name="l00127"></a>00127 <a class="code" href="list_8cpp.html#a5ead5a3e91af18d8f94e0974990a3c5a">setProperty</a>(sig, <a class="code" href="colorize_8cpp.html#a0bf6d3ed426f7267aaa1f0b93f4bfc09">COLORPROPERTY</a>, <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>((<span class="keywordtype">void</span>*)colorset)); <a name="l00128"></a>00128 } </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="a0f8ff1d12378dd049340876374a0356f"></a><!-- doxytag: member="colorize.cpp::splitDependance" ref="a0f8ff1d12378dd049340876374a0356f" args="(const set< Tree > &exps, set< Tree > &post, set< Tree > &pre)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void splitDependance </td> <td>(</td> <td class="paramtype">const set< <a class="el" href="classCTree.html">Tree</a> > & </td> <td class="paramname"> <em>exps</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">set< <a class="el" href="classCTree.html">Tree</a> > & </td> <td class="paramname"> <em>post</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">set< <a class="el" href="classCTree.html">Tree</a> > & </td> <td class="paramname"> <em>pre</em></td><td> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Analyze a set of expressions to discover its dependencies that is subexpressions common to at least two of these 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>exps</em> </td><td>set of expressions to analyze </td></tr> <tr><td valign="top"></td><td valign="top"><em>post</em> </td><td>resulting set of post expressions </td></tr> <tr><td valign="top"></td><td valign="top"><em>pre</em> </td><td>resulting set of pre expressions </td></tr> </table> </dd> </dl> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00028">28</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="colorize_8cpp_source.html#l00059">allocateColor()</a>, <a class="el" href="colorize_8cpp_source.html#l00073">colorize()</a>, <a class="el" href="colorize_8cpp_source.html#l00099">listMultiColoredExp()</a>, and <a class="el" href="colorize_8cpp_source.html#l00086">uncolorize()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00029"></a>00029 { <a name="l00030"></a>00030 set<Tree>::const_iterator e; <a name="l00031"></a>00031 <span class="keywordflow">for</span> (e= exps.begin(); e != exps.end(); e++) { <a name="l00032"></a>00032 <a class="code" href="colorize_8cpp.html#a8fceb2afc402ca2359e5de3d056de73d" title="add color information to exp and all its subtrees">colorize</a>(*e, <a class="code" href="colorize_8cpp.html#a4bd3d0035fd38bae8aa83898889bb22f" title="allocate a new unique color for exp">allocateColor</a>(*e)); <a name="l00033"></a>00033 } <a name="l00034"></a>00034 <a name="l00035"></a>00035 pre.clear(); <a name="l00036"></a>00036 <span class="keywordflow">for</span> (e = exps.begin(); e != exps.end(); e++) { <a name="l00037"></a>00037 <a class="code" href="colorize_8cpp.html#a30dd1b2444e94cd3d6231eb8f7f112b5" title="list multicolored subexpressions of exp">listMultiColoredExp</a>(*e, pre); <a name="l00038"></a>00038 } <a name="l00039"></a>00039 <a name="l00040"></a>00040 post.clear(); <a name="l00041"></a>00041 set_difference(exps.begin(), exps.end(), pre.begin(), pre.end(), inserter(post, post.begin())); <a name="l00042"></a>00042 <a name="l00043"></a>00043 <span class="keywordflow">for</span> (e = exps.begin(); e != exps.end(); e++) { <a name="l00044"></a>00044 <a class="code" href="colorize_8cpp.html#a8d5048eda3154390aea0838aec62dc89" title="remove color information">uncolorize</a>(*e); <a name="l00045"></a>00045 } <a name="l00046"></a>00046 } </pre></div></p> <p><div class="dynheader"> Here is the call graph for this function:</div> <div class="dynsection"> </div> </p> </div> </div> <a class="anchor" id="a8d5048eda3154390aea0838aec62dc89"></a><!-- doxytag: member="colorize.cpp::uncolorize" ref="a8d5048eda3154390aea0838aec62dc89" args="(Tree exp)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void uncolorize </td> <td>(</td> <td class="paramtype"><a class="el" href="classCTree.html">Tree</a> </td> <td class="paramname"> <em>exp</em></td> <td> ) </td> <td><code> [static]</code></td> </tr> </table> </div> <div class="memdoc"> <p>remove color information </p> <p>Remove the colors of an expression tree. </p> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00086">86</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> <p>References <a class="el" href="colorize_8cpp_source.html#l00203">clearColors()</a>, <a class="el" href="colorize_8cpp_source.html#l00187">colorsCount()</a>, and <a class="el" href="subsignals_8cpp_source.html#l00010">getSubSignals()</a>.</p> <p>Referenced by <a class="el" href="colorize_8cpp_source.html#l00028">splitDependance()</a>.</p> <p><div class="fragment"><pre class="fragment"><a name="l00087"></a>00087 { <a name="l00088"></a>00088 <span class="keywordflow">if</span> (<a class="code" href="colorize_8cpp.html#ab54ffb1c6ba10aa111050d08e9bc2cd4" title="returns the number of colors of exp">colorsCount</a>(exp) > 0) { <a name="l00089"></a>00089 <a class="code" href="colorize_8cpp.html#a5aea1efcff76eacf3c026e3adb7331ae" title="remove the color property of exp">clearColors</a>(exp); <a name="l00090"></a>00090 vector<Tree> v; <a name="l00091"></a>00091 <span class="keywordtype">int</span> n = <a class="code" href="signals_8hh.html#ae5dd2bb17d8df90f5561bb8084b3f10f" title="Extract the sub signals of a signal expression, that is not necesseraly all the subtrees...">getSubSignals</a>(exp, v, <span class="keyword">false</span>); <a name="l00092"></a>00092 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<n; i++) <a class="code" href="colorize_8cpp.html#a8d5048eda3154390aea0838aec62dc89" title="remove color information">uncolorize</a>(v[i]); <a name="l00093"></a>00093 } <a name="l00094"></a>00094 } </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="a0bf6d3ed426f7267aaa1f0b93f4bfc09"></a><!-- doxytag: member="colorize.cpp::COLORPROPERTY" ref="a0bf6d3ed426f7267aaa1f0b93f4bfc09" 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="colorize_8cpp.html#a0bf6d3ed426f7267aaa1f0b93f4bfc09">COLORPROPERTY</a> = tree(symbol("ColorProperty"))</td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="colorize_8cpp_source.html#l00118">118</a> of file <a class="el" href="colorize_8cpp_source.html">colorize.cpp</a>.</p> </div> </div> </div> <hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:03 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>