Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > aaf33964de706a538481c929c1da6a44 > files > 2967

faust-doc-0.9.10-5mdv2010.1.x86_64.rpm

<!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: compile.cpp Source File</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&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;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&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>compile.cpp</h1><a href="compile_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/************************************************************************</span>
<a name="l00002"></a>00002 <span class="comment"> ************************************************************************</span>
<a name="l00003"></a>00003 <span class="comment">    FAUST compiler</span>
<a name="l00004"></a>00004 <span class="comment">    Copyright (C) 2003-2004 GRAME, Centre National de Creation Musicale</span>
<a name="l00005"></a>00005 <span class="comment">    ---------------------------------------------------------------------</span>
<a name="l00006"></a>00006 <span class="comment">    This program is free software; you can redistribute it and/or modify</span>
<a name="l00007"></a>00007 <span class="comment">    it under the terms of the GNU General Public License as published by</span>
<a name="l00008"></a>00008 <span class="comment">    the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00009"></a>00009 <span class="comment">    (at your option) any later version.</span>
<a name="l00010"></a>00010 <span class="comment"></span>
<a name="l00011"></a>00011 <span class="comment">    This program is distributed in the hope that it will be useful,</span>
<a name="l00012"></a>00012 <span class="comment">    but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00013"></a>00013 <span class="comment">    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00014"></a>00014 <span class="comment">    GNU General Public License for more details.</span>
<a name="l00015"></a>00015 <span class="comment"></span>
<a name="l00016"></a>00016 <span class="comment">    You should have received a copy of the GNU General Public License</span>
<a name="l00017"></a>00017 <span class="comment">    along with this program; if not, write to the Free Software</span>
<a name="l00018"></a>00018 <span class="comment">    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</span>
<a name="l00019"></a>00019 <span class="comment"> ************************************************************************</span>
<a name="l00020"></a>00020 <span class="comment"> ************************************************************************/</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 
<a name="l00024"></a>00024 <span class="comment">/*****************************************************************************</span>
<a name="l00025"></a>00025 <span class="comment">******************************************************************************</span>
<a name="l00026"></a>00026 <span class="comment">                            FAUST SIGNAL COMPILER</span>
<a name="l00027"></a>00027 <span class="comment">                        Y. Orlarey, (c) Grame 2002</span>
<a name="l00028"></a>00028 <span class="comment">------------------------------------------------------------------------------</span>
<a name="l00029"></a>00029 <span class="comment">Compile a list of FAUST signals into a C++ class .</span>
<a name="l00030"></a>00030 <span class="comment"></span>
<a name="l00031"></a>00031 <span class="comment"> History :</span>
<a name="l00032"></a>00032 <span class="comment"> ---------</span>
<a name="l00033"></a>00033 <span class="comment">    2002-02-08 : First version</span>
<a name="l00034"></a>00034 <span class="comment"></span>
<a name="l00035"></a>00035 <span class="comment">******************************************************************************</span>
<a name="l00036"></a>00036 <span class="comment">*****************************************************************************/</span>
<a name="l00037"></a>00037 
<a name="l00038"></a>00038 
<a name="l00039"></a>00039 
<a name="l00040"></a>00040 <span class="preprocessor">#include &quot;<a class="code" href="timing_8hh.html">timing.hh</a>&quot;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#include &quot;<a class="code" href="compile_8hh.html">compile.hh</a>&quot;</span>
<a name="l00042"></a>00042 <span class="preprocessor">#include &quot;<a class="code" href="floats_8hh.html">floats.hh</a>&quot;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &quot;<a class="code" href="sigtype_8hh.html">sigtype.hh</a>&quot;</span>
<a name="l00044"></a>00044 
<a name="l00045"></a>00045 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00046"></a>00046 <span class="comment">//#include &lt;iostream&gt;</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="preprocessor">#include &quot;<a class="code" href="sigprint_8hh.html">sigprint.hh</a>&quot;</span>
<a name="l00049"></a>00049 <span class="preprocessor">#include &quot;<a class="code" href="ppsig_8hh.html">ppsig.hh</a>&quot;</span>
<a name="l00050"></a>00050 
<a name="l00051"></a>00051 <span class="preprocessor">#include &quot;<a class="code" href="sigtyperules_8hh.html">sigtyperules.hh</a>&quot;</span>
<a name="l00052"></a>00052 <span class="preprocessor">#include &quot;<a class="code" href="simplify_8hh.html">simplify.hh</a>&quot;</span>
<a name="l00053"></a>00053 <span class="preprocessor">#include &quot;<a class="code" href="privatise_8hh.html">privatise.hh</a>&quot;</span>
<a name="l00054"></a>00054 <span class="comment">//#include &quot;factorize.hh&quot;</span>
<a name="l00055"></a>00055 
<a name="l00056"></a>00056 <span class="comment">//#include &quot;grouper.hh&quot;</span>
<a name="l00057"></a>00057 <span class="comment">//#include &quot;sigvisitor.hh&quot;</span>
<a name="l00058"></a>00058 
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 <span class="comment">/*****************************************************************************</span>
<a name="l00063"></a>00063 <span class="comment">******************************************************************************</span>
<a name="l00064"></a>00064 <span class="comment"></span>
<a name="l00065"></a>00065 <span class="comment">                                    API</span>
<a name="l00066"></a>00066 <span class="comment"></span>
<a name="l00067"></a>00067 <span class="comment">******************************************************************************</span>
<a name="l00068"></a>00068 <span class="comment">*****************************************************************************/</span>
<a name="l00069"></a>00069 
<a name="l00070"></a>00070 <span class="keyword">extern</span> <span class="keywordtype">int</span>      <a class="code" href="doc_8cpp.html#a4741733b16ad8f554a8b5c0ca5045d14">gDetailsSwitch</a>;
<a name="l00071"></a>00071 <span class="keyword">extern</span> <span class="keywordtype">string</span>   <a class="code" href="compile_8cpp.html#ac8a7f14cf003853871e19ebab4cfaaf3">gMasterName</a>;
<a name="l00072"></a>00072 
<a name="l00073"></a>00073 
<a name="l00074"></a>00074 
<a name="l00075"></a>00075 
<a name="l00076"></a>00076 <span class="comment">/*****************************************************************************</span>
<a name="l00077"></a>00077 <span class="comment">******************************************************************************</span>
<a name="l00078"></a>00078 <span class="comment"></span>
<a name="l00079"></a>00079 <span class="comment">                          GENERAL COMPILER METHODS</span>
<a name="l00080"></a>00080 <span class="comment"></span>
<a name="l00081"></a>00081 <span class="comment">******************************************************************************</span>
<a name="l00082"></a>00082 <span class="comment">*****************************************************************************/</span>
<a name="l00083"></a>00083 
<a name="l00084"></a>00084 
<a name="l00085"></a>00085 
<a name="l00086"></a>00086 
<a name="l00087"></a>00087 
<a name="l00088"></a>00088 
<a name="l00089"></a>00089 
<a name="l00090"></a>00090 <span class="comment">/*****************************************************************************</span>
<a name="l00091"></a>00091 <span class="comment">                               constructor</span>
<a name="l00092"></a>00092 <span class="comment">*****************************************************************************/</span>
<a name="l00093"></a>00093 
<a name="l00094"></a><a class="code" href="classCompiler.html#a3ec4b139d880a9dd56656f072ba04687">00094</a> <a class="code" href="classCompiler.html#a3ec4b139d880a9dd56656f072ba04687">Compiler::Compiler</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; <a class="code" href="symbol_8hh.html#a8243134fbbd9d924ebbb3f833922e310" title="Returns the name of a symbol.">name</a>, <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; super, <span class="keywordtype">int</span> numInputs, <span class="keywordtype">int</span> numOutputs, <span class="keywordtype">bool</span> vec)
<a name="l00095"></a>00095         : fClass(new <a class="code" href="classKlass.html">Klass</a>(name, super, numInputs, numOutputs, vec)),
<a name="l00096"></a>00096           fNeedToDeleteClass(true), 
<a name="l00097"></a>00097           fUIRoot(<a class="code" href="uitree_8cpp.html#a47f382e8177f7b9d6b9a315d9e033823">uiFolder</a>(<a class="code" href="list_8hh.html#ae1ed153946fcfc025009c6d9c9c40bee">cons</a>(<a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(0), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0&quot;</span>, <a class="code" href="compile_8cpp.html#ac8a7f14cf003853871e19ebab4cfaaf3">gMasterName</a>))))),
<a name="l00098"></a>00098           fDescription(0)
<a name="l00099"></a>00099 {}
<a name="l00100"></a>00100 
<a name="l00101"></a><a class="code" href="classCompiler.html#a824976df0ad98e86df380bf3713ef37f">00101</a> <a class="code" href="classCompiler.html#a3ec4b139d880a9dd56656f072ba04687">Compiler::Compiler</a>(<a class="code" href="classKlass.html">Klass</a>* k)
<a name="l00102"></a>00102         : fClass(k),
<a name="l00103"></a>00103           fNeedToDeleteClass(false), 
<a name="l00104"></a>00104           fUIRoot(<a class="code" href="uitree_8cpp.html#a47f382e8177f7b9d6b9a315d9e033823">uiFolder</a>(<a class="code" href="list_8hh.html#ae1ed153946fcfc025009c6d9c9c40bee">cons</a>(<a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(0), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;$0&quot;</span>, <a class="code" href="compile_8cpp.html#ac8a7f14cf003853871e19ebab4cfaaf3">gMasterName</a>))))),
<a name="l00105"></a>00105           fDescription(0)
<a name="l00106"></a>00106 {}
<a name="l00107"></a>00107 
<a name="l00108"></a>00108 
<a name="l00109"></a><a class="code" href="classCompiler.html#ac06e6b6aa74c6da15efa3f0416df53b2">00109</a> <a class="code" href="classCompiler.html#ac06e6b6aa74c6da15efa3f0416df53b2">Compiler::~Compiler</a>()
<a name="l00110"></a>00110 { 
<a name="l00111"></a>00111     <span class="keywordflow">if</span> (<a class="code" href="classCompiler.html#a2a8d69c98d96b9015d861617a6faadcc">fNeedToDeleteClass</a>) <span class="keyword">delete</span> <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>;
<a name="l00112"></a>00112 }
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 
<a name="l00115"></a>00115 
<a name="l00116"></a>00116 <span class="comment">/*****************************************************************************</span>
<a name="l00117"></a>00117 <span class="comment">                            user interface elements</span>
<a name="l00118"></a>00118 <span class="comment">*****************************************************************************/</span>
<a name="l00119"></a>00119 
<a name="l00123"></a><a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2">00123</a> <span class="keywordtype">void</span> <a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2" title="Add a widget with a certain path to the user interface tree.">Compiler::addUIWidget</a>(<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> path, <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> widget)
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125     <a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a> = <a class="code" href="uitree_8cpp.html#ad53d2cd2df3266b315182623682b5111">putSubFolder</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>, path, widget);
<a name="l00126"></a>00126 }
<a name="l00127"></a>00127 
<a name="l00128"></a>00128 
<a name="l00133"></a><a class="code" href="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85">00133</a> <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="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85" title="Remove fake root folder if not needed (that is if the UI is completely enclosed in...">Compiler::prepareUserInterfaceTree</a>(<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> t)
<a name="l00134"></a>00134 {
<a name="l00135"></a>00135     <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> root, elems;
<a name="l00136"></a>00136     <span class="keywordflow">if</span> (<a class="code" href="uitree_8cpp.html#a56c557491c86ba3875400908b273669d">isUiFolder</a>(t, root, elems) &amp;&amp; <a class="code" href="list_8hh.html#a8bdd73641276e0c0f999f504348eacc1">isList</a>(elems) &amp;&amp; <a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(elems)) ) {
<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> folder = <a class="code" href="list_8hh.html#a098460d0916242eebda50610e2a86e39">right</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(elems));
<a name="l00138"></a>00138         <span class="keywordflow">return</span> (<a class="code" href="uitree_8cpp.html#a56c557491c86ba3875400908b273669d">isUiFolder</a>(folder)) ? folder : t;
<a name="l00139"></a>00139     }
<a name="l00140"></a>00140     <span class="keywordflow">return</span> t;
<a name="l00141"></a>00141 }
<a name="l00142"></a>00142 
<a name="l00143"></a>00143 <span class="comment">//================================= some string processing utilities =================================</span>
<a name="l00144"></a>00144 
<a name="l00148"></a><a class="code" href="compile_8cpp.html#ae01701676fb3301fa2a53fccac7d87f9">00148</a> <span class="keyword">static</span> <span class="keywordtype">string</span> <a class="code" href="compile_8cpp.html#ae01701676fb3301fa2a53fccac7d87f9" title="Removes enclosing whitespaces : &amp;#39; toto &amp;#39; -&amp;gt; &amp;#39;toto&amp;#39;.">wdel</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; s)
<a name="l00149"></a>00149 {
<a name="l00150"></a>00150     <span class="keywordtype">size_t</span> i = 0;
<a name="l00151"></a>00151     <span class="keywordtype">size_t</span> j = s.size();
<a name="l00152"></a>00152     <span class="keywordflow">while</span> (i&lt;j &amp;&amp; s[i]==<span class="charliteral">&#39; &#39;</span>) i++;
<a name="l00153"></a>00153     <span class="keywordflow">while</span> (j&gt;i &amp;&amp; s[j-1] == <span class="charliteral">&#39; &#39;</span>) j--;
<a name="l00154"></a>00154     <span class="keywordflow">return</span> s.substr(i,j-i);
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 
<a name="l00157"></a>00157 
<a name="l00158"></a>00158 
<a name="l00163"></a><a class="code" href="compile_8cpp.html#a96e69d2d939df869ffe8081b135df075">00163</a> <span class="keyword">static</span> <span class="keywordtype">string</span> <a class="code" href="compile_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; s)
<a name="l00164"></a>00164 {
<a name="l00165"></a>00165     <span class="keywordtype">size_t</span> i = s.find_first_not_of(<span class="stringliteral">&quot; \t&quot;</span>);
<a name="l00166"></a>00166     <span class="keywordtype">size_t</span> j = s.find_last_not_of(<span class="stringliteral">&quot; \t&quot;</span>);
<a name="l00167"></a>00167 
<a name="l00168"></a>00168     <span class="keywordflow">if</span> ( (i != string::npos) &amp; (j != string::npos) ) {
<a name="l00169"></a>00169         <span class="keywordflow">return</span> s.substr(i, 1+j-i);
<a name="l00170"></a>00170     } <span class="keywordflow">else</span> {
<a name="l00171"></a>00171         <span class="keywordflow">return</span> <span class="stringliteral">&quot;&quot;</span>;
<a name="l00172"></a>00172     }
<a name="l00173"></a>00173 }
<a name="l00174"></a>00174 
<a name="l00178"></a><a class="code" href="compile_8cpp.html#af40d9db717982956ede067d6eeab6105">00178</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="compile_8cpp.html#af40d9db717982956ede067d6eeab6105" title="Extracts metdata from a label : &amp;#39;vol [unit: dB]&amp;#39; -&amp;gt; &amp;#39;vol&amp;#39; + metadata...">extractMetadata</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; fulllabel, <span class="keywordtype">string</span>&amp; label, map&lt;<span class="keywordtype">string</span>, set&lt;string&gt; &gt;&amp; metadata)
<a name="l00179"></a>00179 {
<a name="l00180"></a>00180     <span class="keyword">enum</span> {kLabel, kEscape1, kEscape2, kEscape3, kKey, kValue};
<a name="l00181"></a>00181     <span class="keywordtype">int</span> state = kLabel; <span class="keywordtype">int</span> deep = 0;
<a name="l00182"></a>00182     <span class="keywordtype">string</span> key, value;
<a name="l00183"></a>00183 
<a name="l00184"></a>00184     <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i=0; i &lt; fulllabel.size(); i++) {
<a name="l00185"></a>00185         <span class="keywordtype">char</span> c = fulllabel[i];
<a name="l00186"></a>00186         <span class="keywordflow">switch</span> (state) {
<a name="l00187"></a>00187             <span class="keywordflow">case</span> kLabel :
<a name="l00188"></a>00188                 assert (deep == 0);
<a name="l00189"></a>00189                 <span class="keywordflow">switch</span> (c) {
<a name="l00190"></a>00190                     <span class="keywordflow">case</span> <span class="charliteral">&#39;\\&#39;</span> : state = kEscape1; <span class="keywordflow">break</span>;
<a name="l00191"></a>00191                     <span class="keywordflow">case</span> <span class="charliteral">&#39;[&#39;</span> : state = kKey; deep++; <span class="keywordflow">break</span>;
<a name="l00192"></a>00192                     <span class="keywordflow">default</span> : label += c;
<a name="l00193"></a>00193                 }
<a name="l00194"></a>00194                 <span class="keywordflow">break</span>;
<a name="l00195"></a>00195 
<a name="l00196"></a>00196             <span class="keywordflow">case</span> kEscape1 :
<a name="l00197"></a>00197                 label += c;
<a name="l00198"></a>00198                 state = kLabel;
<a name="l00199"></a>00199                 <span class="keywordflow">break</span>;
<a name="l00200"></a>00200 
<a name="l00201"></a>00201             <span class="keywordflow">case</span> kEscape2 :
<a name="l00202"></a>00202                 key += c;
<a name="l00203"></a>00203                 state = kKey;
<a name="l00204"></a>00204                 <span class="keywordflow">break</span>;
<a name="l00205"></a>00205 
<a name="l00206"></a>00206             <span class="keywordflow">case</span> kEscape3 :
<a name="l00207"></a>00207                 value += c;
<a name="l00208"></a>00208                 state = kValue;
<a name="l00209"></a>00209                 <span class="keywordflow">break</span>;
<a name="l00210"></a>00210 
<a name="l00211"></a>00211             <span class="keywordflow">case</span> kKey :
<a name="l00212"></a>00212                 assert (deep &gt; 0);
<a name="l00213"></a>00213                 <span class="keywordflow">switch</span> (c) {
<a name="l00214"></a>00214                     <span class="keywordflow">case</span> <span class="charliteral">&#39;\\&#39;</span> :  state = kEscape2;
<a name="l00215"></a>00215                                 <span class="keywordflow">break</span>;
<a name="l00216"></a>00216 
<a name="l00217"></a>00217                     <span class="keywordflow">case</span> <span class="charliteral">&#39;[&#39;</span> :  deep++;
<a name="l00218"></a>00218                                 key += c;
<a name="l00219"></a>00219                                 <span class="keywordflow">break</span>;
<a name="l00220"></a>00220 
<a name="l00221"></a>00221                     <span class="keywordflow">case</span> <span class="charliteral">&#39;:&#39;</span> :  <span class="keywordflow">if</span> (deep == 1) {
<a name="l00222"></a>00222                                     state = kValue;
<a name="l00223"></a>00223                                 } <span class="keywordflow">else</span> {
<a name="l00224"></a>00224                                     key += c;
<a name="l00225"></a>00225                                 }
<a name="l00226"></a>00226                                 <span class="keywordflow">break</span>;
<a name="l00227"></a>00227                     <span class="keywordflow">case</span> <span class="charliteral">&#39;]&#39;</span> :  deep--;
<a name="l00228"></a>00228                                 <span class="keywordflow">if</span> (deep &lt; 1) {
<a name="l00229"></a>00229                                     metadata[<a class="code" href="compile_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(key)].insert(<span class="stringliteral">&quot;&quot;</span>);
<a name="l00230"></a>00230                                     state = kLabel;
<a name="l00231"></a>00231                                     key=<span class="stringliteral">&quot;&quot;</span>;
<a name="l00232"></a>00232                                     value=<span class="stringliteral">&quot;&quot;</span>;
<a name="l00233"></a>00233                                 } <span class="keywordflow">else</span> {
<a name="l00234"></a>00234                                     key += c;
<a name="l00235"></a>00235                                 }
<a name="l00236"></a>00236                                 <span class="keywordflow">break</span>;
<a name="l00237"></a>00237                     <span class="keywordflow">default</span> :   key += c;
<a name="l00238"></a>00238                 }
<a name="l00239"></a>00239                 <span class="keywordflow">break</span>;
<a name="l00240"></a>00240 
<a name="l00241"></a>00241             <span class="keywordflow">case</span> kValue :
<a name="l00242"></a>00242                 assert (deep &gt; 0);
<a name="l00243"></a>00243                 <span class="keywordflow">switch</span> (c) {
<a name="l00244"></a>00244                     <span class="keywordflow">case</span> <span class="charliteral">&#39;\\&#39;</span> : state = kEscape3;
<a name="l00245"></a>00245                                 <span class="keywordflow">break</span>;
<a name="l00246"></a>00246 
<a name="l00247"></a>00247                     <span class="keywordflow">case</span> <span class="charliteral">&#39;[&#39;</span> :  deep++;
<a name="l00248"></a>00248                                 value += c;
<a name="l00249"></a>00249                                 <span class="keywordflow">break</span>;
<a name="l00250"></a>00250 
<a name="l00251"></a>00251                     <span class="keywordflow">case</span> <span class="charliteral">&#39;]&#39;</span> :  deep--;
<a name="l00252"></a>00252                                 <span class="keywordflow">if</span> (deep &lt; 1) {
<a name="l00253"></a>00253                                     metadata[<a class="code" href="compile_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(key)].insert(<a class="code" href="compile_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(value));
<a name="l00254"></a>00254                                     state = kLabel;
<a name="l00255"></a>00255                                     key=<span class="stringliteral">&quot;&quot;</span>;
<a name="l00256"></a>00256                                     value=<span class="stringliteral">&quot;&quot;</span>;
<a name="l00257"></a>00257                                 } <span class="keywordflow">else</span> {
<a name="l00258"></a>00258                                     value += c;
<a name="l00259"></a>00259                                 }
<a name="l00260"></a>00260                                 <span class="keywordflow">break</span>;
<a name="l00261"></a>00261                     <span class="keywordflow">default</span> :   value += c;
<a name="l00262"></a>00262                 }
<a name="l00263"></a>00263                 <span class="keywordflow">break</span>;
<a name="l00264"></a>00264 
<a name="l00265"></a>00265             <span class="keywordflow">default</span> :
<a name="l00266"></a>00266                 cerr &lt;&lt; <span class="stringliteral">&quot;ERROR unrecognized state &quot;</span> &lt;&lt; state &lt;&lt; endl;
<a name="l00267"></a>00267         }
<a name="l00268"></a>00268     }
<a name="l00269"></a>00269     label = <a class="code" href="compile_8cpp.html#a96e69d2d939df869ffe8081b135df075" title="rmWhiteSpaces(): Remove the leading and trailing white spaces of a string (but not...">rmWhiteSpaces</a>(label);
<a name="l00270"></a>00270 }
<a name="l00271"></a>00271 
<a name="l00272"></a>00272 
<a name="l00273"></a>00273 <span class="comment">//================================= BUILD USER INTERFACE METHOD =================================</span>
<a name="l00274"></a>00274 
<a name="l00279"></a><a class="code" href="classCompiler.html#ae994f402a26a38796eab173a1028804e">00279</a> <span class="keywordtype">void</span> <a class="code" href="classCompiler.html#ae994f402a26a38796eab173a1028804e" title="Generate buildUserInterface C++ lines of code corresponding to user interface element...">Compiler::generateUserInterfaceTree</a>(<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> t)
<a name="l00280"></a>00280 {
<a name="l00281"></a>00281     <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>    label, elements, varname, sig;
<a name="l00282"></a>00282 
<a name="l00283"></a>00283     <span class="keywordflow">if</span> (<a class="code" href="uitree_8cpp.html#a56c557491c86ba3875400908b273669d">isUiFolder</a>(t, label, elements)) {
<a name="l00284"></a>00284         <span class="keyword">const</span> <span class="keywordtype">int</span>       orient = <a class="code" href="tree_8cpp.html#a523bce65e2a281fe678f2362496061cf" title="if t has a node of type int, return it otherwise error">tree2int</a>(<a class="code" href="list_8hh.html#a626356b3c8f3e0130d0e043a1dd8547c">left</a>(label));
<a name="l00285"></a>00285         <span class="keyword">const</span> <span class="keywordtype">char</span> *    str = <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(<a class="code" href="list_8hh.html#a098460d0916242eebda50610e2a86e39">right</a>(label));
<a name="l00286"></a>00286         <span class="keyword">const</span> <span class="keywordtype">char</span> *    model;
<a name="l00287"></a>00287 
<a name="l00288"></a>00288         <span class="keywordflow">switch</span> (orient) {
<a name="l00289"></a>00289             <span class="keywordflow">case</span> 0 : model = <span class="stringliteral">&quot;interface-&gt;openVerticalBox(\&quot;$0\&quot;);&quot;</span>; <span class="keywordflow">break</span>;
<a name="l00290"></a>00290             <span class="keywordflow">case</span> 1 : model = <span class="stringliteral">&quot;interface-&gt;openHorizontalBox(\&quot;$0\&quot;);&quot;</span>; <span class="keywordflow">break</span>;
<a name="l00291"></a>00291             <span class="keywordflow">case</span> 2 : model = <span class="stringliteral">&quot;interface-&gt;openTabBox(\&quot;$0\&quot;);&quot;</span>; <span class="keywordflow">break</span>;
<a name="l00292"></a>00292             <span class="keywordflow">default</span> :
<a name="l00293"></a>00293                     fprintf(stderr, <span class="stringliteral">&quot;error in user interface generation 1\n&quot;</span>);
<a name="l00294"></a>00294                 exit(1);
<a name="l00295"></a>00295         }
<a name="l00296"></a>00296         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(model, str));
<a name="l00297"></a>00297         <a class="code" href="classCompiler.html#a990c992c382168071403c21f31c117ee" title="Iterate generateUserInterfaceTree on a list of user interface elements.">generateUserInterfaceElements</a>(elements);
<a name="l00298"></a>00298         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<span class="stringliteral">&quot;interface-&gt;closeBox();&quot;</span>);
<a name="l00299"></a>00299 
<a name="l00300"></a>00300     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="uitree_8cpp.html#abfe657a3e623626aeecd89b4415c3dc5">isUiWidget</a>(t, label, varname, sig)) {
<a name="l00301"></a>00301 
<a name="l00302"></a>00302         <a class="code" href="classCompiler.html#a04e71115fb646ad756b60a3169267863" title="Generate buildUserInterface C++ lines of code corresponding to user interface widget...">generateWidgetCode</a>(label, varname, sig);
<a name="l00303"></a>00303 
<a name="l00304"></a>00304     } <span class="keywordflow">else</span> {
<a name="l00305"></a>00305 
<a name="l00306"></a>00306         fprintf(stderr, <span class="stringliteral">&quot;error in user interface generation 2\n&quot;</span>);
<a name="l00307"></a>00307         exit(1);
<a name="l00308"></a>00308 
<a name="l00309"></a>00309     }
<a name="l00310"></a>00310 }
<a name="l00311"></a>00311 
<a name="l00315"></a><a class="code" href="classCompiler.html#a990c992c382168071403c21f31c117ee">00315</a> <span class="keywordtype">void</span> <a class="code" href="classCompiler.html#a990c992c382168071403c21f31c117ee" title="Iterate generateUserInterfaceTree on a list of user interface elements.">Compiler::generateUserInterfaceElements</a>(<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> elements)
<a name="l00316"></a>00316 {
<a name="l00317"></a>00317     <span class="keywordflow">while</span> (!<a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(elements)) {
<a name="l00318"></a>00318         <a class="code" href="classCompiler.html#ae994f402a26a38796eab173a1028804e" title="Generate buildUserInterface C++ lines of code corresponding to user interface element...">generateUserInterfaceTree</a>(<a class="code" href="list_8hh.html#a098460d0916242eebda50610e2a86e39">right</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(elements)));
<a name="l00319"></a>00319         elements = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(elements);
<a name="l00320"></a>00320     }
<a name="l00321"></a>00321 }
<a name="l00322"></a>00322 
<a name="l00327"></a><a class="code" href="classCompiler.html#a04e71115fb646ad756b60a3169267863">00327</a> <span class="keywordtype">void</span> <a class="code" href="classCompiler.html#a04e71115fb646ad756b60a3169267863" title="Generate buildUserInterface C++ lines of code corresponding to user interface widget...">Compiler::generateWidgetCode</a>(<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> fulllabel, <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> varname, <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> sig)
<a name="l00328"></a>00328 {
<a name="l00329"></a>00329     <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> path, c, x, y, z;
<a name="l00330"></a>00330     <span class="keywordtype">string</span> label;
<a name="l00331"></a>00331     map&lt;string, set&lt;string&gt; &gt;   metadata;
<a name="l00332"></a>00332 
<a name="l00333"></a>00333     <a class="code" href="compile_8cpp.html#af40d9db717982956ede067d6eeab6105" title="Extracts metdata from a label : &amp;#39;vol [unit: dB]&amp;#39; -&amp;gt; &amp;#39;vol&amp;#39; + metadata...">extractMetadata</a>(<a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(fulllabel), label, metadata);
<a name="l00334"></a>00334 
<a name="l00335"></a>00335     <span class="comment">// add metadata if any</span>
<a name="l00336"></a>00336     <span class="keywordflow">for</span> (map&lt;<span class="keywordtype">string</span>, set&lt;string&gt; &gt;::iterator i = metadata.begin(); i != metadata.end(); i++) {
<a name="l00337"></a>00337         <span class="keyword">const</span> <span class="keywordtype">string</span>&amp; key = i-&gt;first;
<a name="l00338"></a>00338         <span class="keyword">const</span> set&lt;string&gt;&amp; values = i-&gt;second;
<a name="l00339"></a>00339         <span class="keywordflow">for</span> (set&lt;string&gt;::iterator j = values.begin(); j != values.end(); j++) {
<a name="l00340"></a>00340             <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;interface-&gt;declare(&amp;$0, \&quot;$1\&quot;, \&quot;$2\&quot;);&quot;</span>, <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname), <a class="code" href="compile_8cpp.html#ae01701676fb3301fa2a53fccac7d87f9" title="Removes enclosing whitespaces : &amp;#39; toto &amp;#39; -&amp;gt; &amp;#39;toto&amp;#39;.">wdel</a>(key) ,<a class="code" href="compile_8cpp.html#ae01701676fb3301fa2a53fccac7d87f9" title="Removes enclosing whitespaces : &amp;#39; toto &amp;#39; -&amp;gt; &amp;#39;toto&amp;#39;.">wdel</a>(*j)));
<a name="l00341"></a>00341         }
<a name="l00342"></a>00342     }
<a name="l00343"></a>00343 
<a name="l00344"></a>00344     <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a9cb8af593289d910a1f8ec8a9c8d880f">isSigButton</a>(sig, path) )                   {
<a name="l00345"></a>00345         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a0ef0ecb4122ff38337b37b4238c13346">incUIActiveCount</a>();
<a name="l00346"></a>00346         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;interface-&gt;addButton(\&quot;$0\&quot;, &amp;$1);&quot;</span>, label, <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname)));
<a name="l00347"></a>00347 
<a name="l00348"></a>00348     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a48996c1ce74258d499baae3d267078bc">isSigCheckbox</a>(sig, path) )          {
<a name="l00349"></a>00349         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a0ef0ecb4122ff38337b37b4238c13346">incUIActiveCount</a>();
<a name="l00350"></a>00350         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;interface-&gt;addCheckButton(\&quot;$0\&quot;, &amp;$1);&quot;</span>, label, <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname)));
<a name="l00351"></a>00351 
<a name="l00352"></a>00352     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aac990f39e6a1d50e8e1de3b6f7701cfe">isSigVSlider</a>(sig, path,c,x,y,z) )   {
<a name="l00353"></a>00353         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a0ef0ecb4122ff38337b37b4238c13346">incUIActiveCount</a>();
<a name="l00354"></a>00354         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;interface-&gt;addVerticalSlider(\&quot;$0\&quot;, &amp;$1, $2, $3, $4, $5);&quot;</span>,
<a name="l00355"></a>00355                 label,
<a name="l00356"></a>00356                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00357"></a>00357                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(c)),
<a name="l00358"></a>00358                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00359"></a>00359                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y)),
<a name="l00360"></a>00360                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(z))));
<a name="l00361"></a>00361 
<a name="l00362"></a>00362     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aaa72c718314a1ba2cee25a95c153e37d">isSigHSlider</a>(sig, path,c,x,y,z) )   {
<a name="l00363"></a>00363         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a0ef0ecb4122ff38337b37b4238c13346">incUIActiveCount</a>();
<a name="l00364"></a>00364         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;interface-&gt;addHorizontalSlider(\&quot;$0\&quot;, &amp;$1, $2, $3, $4, $5);&quot;</span>,
<a name="l00365"></a>00365                 label,
<a name="l00366"></a>00366                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00367"></a>00367                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(c)),
<a name="l00368"></a>00368                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00369"></a>00369                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y)),
<a name="l00370"></a>00370                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(z))));
<a name="l00371"></a>00371 
<a name="l00372"></a>00372     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aa8476971aba67dfc3af7b5d11f974ef3">isSigNumEntry</a>(sig, path,c,x,y,z) )  {
<a name="l00373"></a>00373         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a0ef0ecb4122ff38337b37b4238c13346">incUIActiveCount</a>();
<a name="l00374"></a>00374         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;interface-&gt;addNumEntry(\&quot;$0\&quot;, &amp;$1, $2, $3, $4, $5);&quot;</span>,
<a name="l00375"></a>00375                 label,
<a name="l00376"></a>00376                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00377"></a>00377                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(c)),
<a name="l00378"></a>00378                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00379"></a>00379                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y)),
<a name="l00380"></a>00380                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(z))));
<a name="l00381"></a>00381 
<a name="l00382"></a>00382     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a667a345cf4efcba00fce5a06bc1e8299">isSigVBargraph</a>(sig, path,x,y,z) )   {
<a name="l00383"></a>00383         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#acf8af34f07cac9b20bd3bb17e2e8c1f9">incUIPassiveCount</a>();
<a name="l00384"></a>00384         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;interface-&gt;addVerticalBargraph(\&quot;$0\&quot;, &amp;$1, $2, $3);&quot;</span>,
<a name="l00385"></a>00385                 label,
<a name="l00386"></a>00386                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00387"></a>00387                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00388"></a>00388                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y))));
<a name="l00389"></a>00389 
<a name="l00390"></a>00390     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a5acf9dd03d1d0032e9486867876f1806">isSigHBargraph</a>(sig, path,x,y,z) )   {
<a name="l00391"></a>00391         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#acf8af34f07cac9b20bd3bb17e2e8c1f9">incUIPassiveCount</a>();
<a name="l00392"></a>00392         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#a4ab1f4a7350e8aacbe405359a10ae6eb">addUICode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;interface-&gt;addHorizontalBargraph(\&quot;$0\&quot;, &amp;$1, $2, $3);&quot;</span>,
<a name="l00393"></a>00393                 label,
<a name="l00394"></a>00394                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00395"></a>00395                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00396"></a>00396                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y))));
<a name="l00397"></a>00397 
<a name="l00398"></a>00398     } <span class="keywordflow">else</span> {
<a name="l00399"></a>00399         fprintf(stderr, <span class="stringliteral">&quot;Error in generating widget code\n&quot;</span>);
<a name="l00400"></a>00400         exit(1);
<a name="l00401"></a>00401     }
<a name="l00402"></a>00402 }
<a name="l00403"></a>00403 
<a name="l00404"></a>00404 <span class="comment">//==================================== USER INTERFACE MACROS ==================================</span>
<a name="l00405"></a>00405 
<a name="l00410"></a><a class="code" href="classCompiler.html#a83bb12b7d930bd1b574e35202f5d3da6">00410</a> <span class="keywordtype">void</span> <a class="code" href="classCompiler.html#a83bb12b7d930bd1b574e35202f5d3da6" title="Generate user interface macros corresponding to user interface element t.">Compiler::generateMacroInterfaceTree</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; pathname, <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> t)
<a name="l00411"></a>00411 {
<a name="l00412"></a>00412     <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>    label, elements, varname, sig;
<a name="l00413"></a>00413 
<a name="l00414"></a>00414     <span class="keywordflow">if</span> (<a class="code" href="uitree_8cpp.html#a56c557491c86ba3875400908b273669d">isUiFolder</a>(t, label, elements)) {
<a name="l00415"></a>00415         <span class="keywordtype">string</span> pathname2 = pathname;
<a name="l00416"></a>00416         <span class="comment">//string str = unquote(tree2str(right(label)));</span>
<a name="l00417"></a>00417         <span class="keywordtype">string</span> str = <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(<a class="code" href="list_8hh.html#a098460d0916242eebda50610e2a86e39">right</a>(label));
<a name="l00418"></a>00418         <span class="keywordflow">if</span> (str.length()&gt;0) pathname2 += str + <span class="stringliteral">&quot;/&quot;</span>;
<a name="l00419"></a>00419         <a class="code" href="classCompiler.html#a4904be552402fc21847bd5026cc23a62" title="Iterate generateMacroInterfaceTree on a list of user interface elements.">generateMacroInterfaceElements</a>(pathname2, elements);
<a name="l00420"></a>00420 
<a name="l00421"></a>00421     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (<a class="code" href="uitree_8cpp.html#abfe657a3e623626aeecd89b4415c3dc5">isUiWidget</a>(t, label, varname, sig)) {
<a name="l00422"></a>00422 
<a name="l00423"></a>00423         <a class="code" href="classCompiler.html#abafd4cec7ee4807031766e86f889e5d5" title="Generate user interface macros corresponding to a user interface widget.">generateWidgetMacro</a>(pathname, label, varname, sig);
<a name="l00424"></a>00424 
<a name="l00425"></a>00425     } <span class="keywordflow">else</span> {
<a name="l00426"></a>00426 
<a name="l00427"></a>00427         fprintf(stderr, <span class="stringliteral">&quot;error in user interface macro generation 2\n&quot;</span>);
<a name="l00428"></a>00428         exit(1);
<a name="l00429"></a>00429 
<a name="l00430"></a>00430     }
<a name="l00431"></a>00431 }
<a name="l00432"></a>00432 
<a name="l00433"></a>00433 
<a name="l00437"></a><a class="code" href="classCompiler.html#a4904be552402fc21847bd5026cc23a62">00437</a> <span class="keywordtype">void</span> <a class="code" href="classCompiler.html#a4904be552402fc21847bd5026cc23a62" title="Iterate generateMacroInterfaceTree on a list of user interface elements.">Compiler::generateMacroInterfaceElements</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; pathname, <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> elements)
<a name="l00438"></a>00438 {
<a name="l00439"></a>00439     <span class="keywordflow">while</span> (!<a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(elements)) {
<a name="l00440"></a>00440         <a class="code" href="classCompiler.html#a83bb12b7d930bd1b574e35202f5d3da6" title="Generate user interface macros corresponding to user interface element t.">generateMacroInterfaceTree</a>(pathname, <a class="code" href="list_8hh.html#a098460d0916242eebda50610e2a86e39">right</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(elements)));
<a name="l00441"></a>00441         elements = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(elements);
<a name="l00442"></a>00442     }
<a name="l00443"></a>00443 }
<a name="l00444"></a>00444 
<a name="l00445"></a>00445 
<a name="l00450"></a><a class="code" href="classCompiler.html#abafd4cec7ee4807031766e86f889e5d5">00450</a> <span class="keywordtype">void</span> <a class="code" href="classCompiler.html#abafd4cec7ee4807031766e86f889e5d5" title="Generate user interface macros corresponding to a user interface widget.">Compiler::generateWidgetMacro</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>&amp; pathname, <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> fulllabel, <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> varname, <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> sig)
<a name="l00451"></a>00451 {
<a name="l00452"></a>00452     <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> path, c, x, y, z;
<a name="l00453"></a>00453     <span class="keywordtype">string</span> label;
<a name="l00454"></a>00454     map&lt;string, set&lt;string&gt; &gt;   metadata;
<a name="l00455"></a>00455 
<a name="l00456"></a>00456     <a class="code" href="compile_8cpp.html#af40d9db717982956ede067d6eeab6105" title="Extracts metdata from a label : &amp;#39;vol [unit: dB]&amp;#39; -&amp;gt; &amp;#39;vol&amp;#39; + metadata...">extractMetadata</a>(<a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(fulllabel), label, metadata);
<a name="l00457"></a>00457 
<a name="l00458"></a>00458     <span class="comment">//string pathlabel = pathname+unquote(label);</span>
<a name="l00459"></a>00459     <span class="keywordtype">string</span> pathlabel = pathname+label;
<a name="l00460"></a>00460 
<a name="l00461"></a>00461 
<a name="l00462"></a>00462     <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a9cb8af593289d910a1f8ec8a9c8d880f">isSigButton</a>(sig, path) )                   {
<a name="l00463"></a>00463         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#aecbcf0553366bd13201f92a9a1b94ecd">addUIMacro</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;FAUST_ADDBUTTON(\&quot;$0\&quot;, $1);&quot;</span>, pathlabel, <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname)));
<a name="l00464"></a>00464 
<a name="l00465"></a>00465     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a48996c1ce74258d499baae3d267078bc">isSigCheckbox</a>(sig, path) )          {
<a name="l00466"></a>00466         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#aecbcf0553366bd13201f92a9a1b94ecd">addUIMacro</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;FAUST_ADDCHECKBOX(\&quot;$0\&quot;, $1);&quot;</span>, pathlabel, <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname)));
<a name="l00467"></a>00467 
<a name="l00468"></a>00468     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aac990f39e6a1d50e8e1de3b6f7701cfe">isSigVSlider</a>(sig, path,c,x,y,z) )   {
<a name="l00469"></a>00469         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#aecbcf0553366bd13201f92a9a1b94ecd">addUIMacro</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;FAUST_ADDVERTICALSLIDER(\&quot;$0\&quot;, $1, $2, $3, $4, $5);&quot;</span>,
<a name="l00470"></a>00470                 pathlabel,
<a name="l00471"></a>00471                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00472"></a>00472                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(c)),
<a name="l00473"></a>00473                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00474"></a>00474                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y)),
<a name="l00475"></a>00475                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(z))));
<a name="l00476"></a>00476 
<a name="l00477"></a>00477     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aaa72c718314a1ba2cee25a95c153e37d">isSigHSlider</a>(sig, path,c,x,y,z) )   {
<a name="l00478"></a>00478         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#aecbcf0553366bd13201f92a9a1b94ecd">addUIMacro</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;FAUST_ADDHORIZONTALSLIDER(\&quot;$0\&quot;, $1, $2, $3, $4, $5);&quot;</span>,
<a name="l00479"></a>00479                 pathlabel,
<a name="l00480"></a>00480                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00481"></a>00481                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(c)),
<a name="l00482"></a>00482                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00483"></a>00483                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y)),
<a name="l00484"></a>00484                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(z))));
<a name="l00485"></a>00485 
<a name="l00486"></a>00486     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aa8476971aba67dfc3af7b5d11f974ef3">isSigNumEntry</a>(sig, path,c,x,y,z) )  {
<a name="l00487"></a>00487         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#aecbcf0553366bd13201f92a9a1b94ecd">addUIMacro</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;FAUST_ADDNUMENTRY(\&quot;$0\&quot;, $1, $2, $3, $4, $5);&quot;</span>,
<a name="l00488"></a>00488                 pathlabel,
<a name="l00489"></a>00489                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00490"></a>00490                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(c)),
<a name="l00491"></a>00491                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00492"></a>00492                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y)),
<a name="l00493"></a>00493                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(z))));
<a name="l00494"></a>00494 
<a name="l00495"></a>00495     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a667a345cf4efcba00fce5a06bc1e8299">isSigVBargraph</a>(sig, path,x,y,z) )   {
<a name="l00496"></a>00496         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#aecbcf0553366bd13201f92a9a1b94ecd">addUIMacro</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;FAUST_ADDVERTICALBARGRAPH(\&quot;$0\&quot;, $1, $2, $3);&quot;</span>,
<a name="l00497"></a>00497                 pathlabel,
<a name="l00498"></a>00498                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00499"></a>00499                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00500"></a>00500                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y))));
<a name="l00501"></a>00501 
<a name="l00502"></a>00502     } <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a5acf9dd03d1d0032e9486867876f1806">isSigHBargraph</a>(sig, path,x,y,z) )   {
<a name="l00503"></a>00503         <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-&gt;<a class="code" href="classKlass.html#aecbcf0553366bd13201f92a9a1b94ecd">addUIMacro</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">&quot;FAUST_ADDHORIZONTALBARGRAPH(\&quot;$0\&quot;, $1, $2, $3);&quot;</span>,
<a name="l00504"></a>00504                 pathlabel,
<a name="l00505"></a>00505                 <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(varname),
<a name="l00506"></a>00506                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(x)),
<a name="l00507"></a>00507                 <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(<a class="code" href="tree_8cpp.html#ad01262fc04f661b162d36b786419a849" title="if t has a node of type float, return it otherwise error">tree2float</a>(y))));
<a name="l00508"></a>00508 
<a name="l00509"></a>00509     } <span class="keywordflow">else</span> {
<a name="l00510"></a>00510         fprintf(stderr, <span class="stringliteral">&quot;Error in generating widget code\n&quot;</span>);
<a name="l00511"></a>00511         exit(1);
<a name="l00512"></a>00512     }
<a name="l00513"></a>00513 }
</pre></div></div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Wed Apr 28 23:59:58 2010 for FAUST compiler by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>