<!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_scal.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 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> <h1>compile_scal.cpp</h1><a href="compile__scal_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 <span class="comment">/*****************************************************************************</span> <a name="l00023"></a>00023 <span class="comment"> HISTORY</span> <a name="l00024"></a>00024 <span class="comment"> 22/01/05 : corrected bug on bool signals cached in float variables</span> <a name="l00025"></a>00025 <span class="comment">*****************************************************************************/</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="preprocessor">#include "<a class="code" href="compile__scal_8hh.html">compile_scal.hh</a>"</span> <a name="l00029"></a>00029 <span class="preprocessor">#include "<a class="code" href="timing_8hh.html">timing.hh</a>"</span> <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="preprocessor">#include "<a class="code" href="compile_8hh.html">compile.hh</a>"</span> <a name="l00032"></a>00032 <span class="preprocessor">#include "<a class="code" href="sigtype_8hh.html">sigtype.hh</a>"</span> <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="preprocessor">#include <stdio.h></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <iostream></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <sstream></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <vector></span> <a name="l00038"></a>00038 <span class="preprocessor">#include <math.h></span> <a name="l00039"></a>00039 <a name="l00040"></a>00040 <span class="preprocessor">#include "<a class="code" href="floats_8hh.html">floats.hh</a>"</span> <a name="l00041"></a>00041 <span class="preprocessor">#include "<a class="code" href="sigprint_8hh.html">sigprint.hh</a>"</span> <a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="sigtyperules_8hh.html">sigtyperules.hh</a>"</span> <a name="l00043"></a>00043 <span class="preprocessor">#include "<a class="code" href="recursivness_8hh.html">recursivness.hh</a>"</span> <a name="l00044"></a>00044 <span class="preprocessor">#include "<a class="code" href="simplify_8hh.html">simplify.hh</a>"</span> <a name="l00045"></a>00045 <span class="preprocessor">#include "<a class="code" href="privatise_8hh.html">privatise.hh</a>"</span> <a name="l00046"></a>00046 <span class="preprocessor">#include "<a class="code" href="prim2_8hh.html">prim2.hh</a>"</span> <a name="l00047"></a>00047 <span class="preprocessor">#include "<a class="code" href="xtended_8hh.html">xtended.hh</a>"</span> <a name="l00048"></a>00048 <span class="comment">//#include "contextor.hh"</span> <a name="l00049"></a>00049 <span class="preprocessor">#include "<a class="code" href="compatibility_8hh.html">compatibility.hh</a>"</span> <a name="l00050"></a>00050 <span class="preprocessor">#include "<a class="code" href="ppsig_8hh.html">ppsig.hh</a>"</span> <a name="l00051"></a>00051 <a name="l00052"></a>00052 <span class="keyword">extern</span> <span class="keywordtype">bool</span> <a class="code" href="doc__compile_8cpp.html#a5f97ede46bd9fd364fc69fd7bc04e5ae">gLessTempSwitch</a>; <a name="l00053"></a>00053 <span class="keyword">extern</span> <span class="keywordtype">bool</span> <a class="code" href="compile__scal_8cpp.html#aed8da6f8f23ca426bf3ea6564e0bd6f2">gSchedulerSwitch</a>; <a name="l00054"></a>00054 <span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="doc__compile_8cpp.html#a278e0cda879c0108aff047853ab0214c">gMaxCopyDelay</a>; <a name="l00055"></a>00055 <a name="l00056"></a><a class="code" href="compile__scal_8cpp.html#aad565b4516266c0d4e01ee7f2233fad3">00056</a> <span class="keyword">static</span> <a class="code" href="classKlass.html">Klass</a>* <a class="code" href="compile__scal_8cpp.html#aad565b4516266c0d4e01ee7f2233fad3">signal2klass</a> (<span class="keyword">const</span> <span class="keywordtype">string</span>& <a class="code" href="symbol_8hh.html#a8243134fbbd9d924ebbb3f833922e310" title="Returns the name of a symbol.">name</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> sig) <a name="l00057"></a>00057 { <a name="l00058"></a>00058 <a class="code" href="classP.html">Type</a> t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig); <span class="comment">//, NULLENV);</span> <a name="l00059"></a>00059 <span class="keywordflow">if</span> (t->nature() == <a class="code" href="sigtype_8hh.html#adc29c2ff13d900c2f185ee95427fb06ca9bb31be73c01d40428195449f62588ac">kInt</a>) { <a name="l00060"></a>00060 <a name="l00061"></a>00061 <a class="code" href="classScalarCompiler.html" title="Compile a list of FAUST signals into a scalar C++ class.">ScalarCompiler</a> C( <span class="keyword">new</span> <a class="code" href="classSigIntGenKlass.html">SigIntGenKlass</a>(name) ); <a name="l00062"></a>00062 C.<a class="code" href="classScalarCompiler.html#a3590109641b7970c68ea20d033471a41">compileSingleSignal</a>(sig); <a name="l00063"></a>00063 <span class="keywordflow">return</span> C.<a class="code" href="classCompiler.html#acbc0eb4c3a063b96a0fe2c38014ee131">getClass</a>(); <a name="l00064"></a>00064 <a name="l00065"></a>00065 } <span class="keywordflow">else</span> { <a name="l00066"></a>00066 <a name="l00067"></a>00067 <a class="code" href="classScalarCompiler.html" title="Compile a list of FAUST signals into a scalar C++ class.">ScalarCompiler</a> C( <span class="keyword">new</span> <a class="code" href="classSigFloatGenKlass.html">SigFloatGenKlass</a>(name) ); <a name="l00068"></a>00068 C.<a class="code" href="classScalarCompiler.html#a3590109641b7970c68ea20d033471a41">compileSingleSignal</a>(sig); <a name="l00069"></a>00069 <span class="keywordflow">return</span> C.<a class="code" href="classCompiler.html#acbc0eb4c3a063b96a0fe2c38014ee131">getClass</a>(); <a name="l00070"></a>00070 <a name="l00071"></a>00071 } <a name="l00072"></a>00072 } <a name="l00073"></a>00073 <a name="l00074"></a>00074 <a name="l00075"></a>00075 <span class="comment">/*****************************************************************************</span> <a name="l00076"></a>00076 <span class="comment"> getFreshID</span> <a name="l00077"></a>00077 <span class="comment">*****************************************************************************/</span> <a name="l00078"></a>00078 <a name="l00079"></a>00079 map<string, int> <a class="code" href="classScalarCompiler.html#aaeb282c0d2d1e2a3f4f35c8ead8aecdb">ScalarCompiler::fIDCounters</a>; <a name="l00080"></a>00080 <a name="l00081"></a><a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">00081</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">ScalarCompiler::getFreshID</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>& prefix) <a name="l00082"></a>00082 { <a name="l00083"></a>00083 <span class="keywordflow">if</span> (<a class="code" href="classScalarCompiler.html#aaeb282c0d2d1e2a3f4f35c8ead8aecdb">fIDCounters</a>.find(prefix) == <a class="code" href="classScalarCompiler.html#aaeb282c0d2d1e2a3f4f35c8ead8aecdb">fIDCounters</a>.end()) { <a name="l00084"></a>00084 <a class="code" href="classScalarCompiler.html#aaeb282c0d2d1e2a3f4f35c8ead8aecdb">fIDCounters</a>[prefix]=0; <a name="l00085"></a>00085 } <a name="l00086"></a>00086 <span class="keywordtype">int</span> n = <a class="code" href="classScalarCompiler.html#aaeb282c0d2d1e2a3f4f35c8ead8aecdb">fIDCounters</a>[prefix]; <a name="l00087"></a>00087 <a class="code" href="classScalarCompiler.html#aaeb282c0d2d1e2a3f4f35c8ead8aecdb">fIDCounters</a>[prefix] = n+1; <a name="l00088"></a>00088 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0$1"</span>, prefix, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(n)); <a name="l00089"></a>00089 } <a name="l00090"></a>00090 <a name="l00091"></a>00091 <a name="l00092"></a>00092 <span class="comment">/*****************************************************************************</span> <a name="l00093"></a>00093 <span class="comment"> prepare</span> <a name="l00094"></a>00094 <span class="comment">*****************************************************************************/</span> <a name="l00095"></a>00095 <a name="l00096"></a><a class="code" href="classScalarCompiler.html#a7144aea17822337a175d660cd6def014">00096</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="classScalarCompiler.html#a7144aea17822337a175d660cd6def014">ScalarCompiler::prepare</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> LS) <a name="l00097"></a>00097 { <a name="l00098"></a>00098 <a class="code" href="timing_8cpp.html#a8b3ae592fe54580b95171a2bdabb2641">startTiming</a>(<span class="stringliteral">"ScalarCompiler::prepare"</span>); <a name="l00099"></a>00099 <a class="code" href="timing_8cpp.html#a8b3ae592fe54580b95171a2bdabb2641">startTiming</a>(<span class="stringliteral">"deBruijn2Sym"</span>); <a name="l00100"></a>00100 <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> L1 = <a class="code" href="recursive-tree_8cpp.html#ab896f65486e6d80d4440721f2f89ff96">deBruijn2Sym</a>(LS); <span class="comment">// convert debruijn recursion into symbolic recursion</span> <a name="l00101"></a>00101 <a class="code" href="timing_8cpp.html#ac5c8a9d488cf5c7d786c833565e093e9">endTiming</a>(<span class="stringliteral">"deBruijn2Sym"</span>); <a name="l00102"></a>00102 <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> L2 = <a class="code" href="simplify_8cpp.html#aa58ab1a209023cba186f077cfdcc5339">simplify</a>(L1); <span class="comment">// simplify by executing every computable operation</span> <a name="l00103"></a>00103 <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> L3 = <a class="code" href="privatise_8cpp.html#a72412a8ab2da211259af2ad2bbfec902">privatise</a>(L2); <span class="comment">// Un-share tables with multiple writers</span> <a name="l00104"></a>00104 <a name="l00105"></a>00105 <a class="code" href="recursivness_8cpp.html#ad6d53633cf1982b7d7b094188c7bfe17" title="Annotate a signal with recursivness.">recursivnessAnnotation</a>(L3); <span class="comment">// Annotate L3 with recursivness information</span> <a name="l00106"></a>00106 <a class="code" href="sigtyperules_8cpp.html#a85dbc6a3f96f643e82a0b45d785ce341" title="fully annotate every subtree of term with type information">typeAnnotation</a>(L3); <span class="comment">// Annotate L3 with type information</span> <a name="l00107"></a>00107 <a class="code" href="classScalarCompiler.html#a3266c7302f512a4198aa4a047e55f80d">sharingAnalysis</a>(L3); <span class="comment">// annotate L3 with sharing count</span> <a name="l00108"></a>00108 <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#aaba1b76dc4c0f320f1639ec0f02e68e1" title="start markup of root tree with new unique key">mark</a>(L3); <span class="comment">// annotate L3 with occurences analysis</span> <a name="l00109"></a>00109 <a class="code" href="timing_8cpp.html#ac5c8a9d488cf5c7d786c833565e093e9">endTiming</a>(<span class="stringliteral">"ScalarCompiler::prepare"</span>); <a name="l00110"></a>00110 <span class="keywordflow">return</span> L3; <a name="l00111"></a>00111 } <a name="l00112"></a>00112 <a name="l00113"></a><a class="code" href="classScalarCompiler.html#a38de9ca99a78eb0e82f149bbf4e03783">00113</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="classScalarCompiler.html#a38de9ca99a78eb0e82f149bbf4e03783">ScalarCompiler::prepare2</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> L0) <a name="l00114"></a>00114 { <a name="l00115"></a>00115 <a class="code" href="timing_8cpp.html#a8b3ae592fe54580b95171a2bdabb2641">startTiming</a>(<span class="stringliteral">"ScalarCompiler::prepare2"</span>); <a name="l00116"></a>00116 <a class="code" href="recursivness_8cpp.html#ad6d53633cf1982b7d7b094188c7bfe17" title="Annotate a signal with recursivness.">recursivnessAnnotation</a>(L0); <span class="comment">// Annotate L0 with recursivness information</span> <a name="l00117"></a>00117 <a class="code" href="sigtyperules_8cpp.html#a85dbc6a3f96f643e82a0b45d785ce341" title="fully annotate every subtree of term with type information">typeAnnotation</a>(L0); <span class="comment">// Annotate L0 with type information</span> <a name="l00118"></a>00118 <a class="code" href="classScalarCompiler.html#a3266c7302f512a4198aa4a047e55f80d">sharingAnalysis</a>(L0); <span class="comment">// annotate L0 with sharing count</span> <a name="l00119"></a>00119 <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#aaba1b76dc4c0f320f1639ec0f02e68e1" title="start markup of root tree with new unique key">mark</a>(L0); <span class="comment">// annotate L0 with occurences analysis</span> <a name="l00120"></a>00120 <a class="code" href="timing_8cpp.html#ac5c8a9d488cf5c7d786c833565e093e9">endTiming</a>(<span class="stringliteral">"ScalarCompiler::prepare2"</span>); <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="keywordflow">return</span> L0; <a name="l00123"></a>00123 } <a name="l00124"></a>00124 <a name="l00125"></a>00125 <span class="comment">/*****************************************************************************</span> <a name="l00126"></a>00126 <span class="comment"> compileMultiSignal</span> <a name="l00127"></a>00127 <span class="comment">*****************************************************************************/</span> <a name="l00128"></a>00128 <a name="l00129"></a><a class="code" href="classScalarCompiler.html#a3870aba6cb3a4ba4092a6fd1f1e01bb3">00129</a> <span class="keywordtype">void</span> <a class="code" href="classScalarCompiler.html#a3870aba6cb3a4ba4092a6fd1f1e01bb3">ScalarCompiler::compileMultiSignal</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> L) <a name="l00130"></a>00130 { <a name="l00131"></a>00131 <span class="comment">//contextor recursivness(0);</span> <a name="l00132"></a>00132 L = <a class="code" href="classScalarCompiler.html#a7144aea17822337a175d660cd6def014">prepare</a>(L); <span class="comment">// optimize, share and annotate expression</span> <a name="l00133"></a>00133 <a name="l00134"></a>00134 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#ae4a8930e2604b74416905dc1830c2bb1">inputs</a>(); i++) { <a name="l00135"></a>00135 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a368fbe339be25ff39dcddd984e2c6342">addZone3</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1* input$0 = input[$0];"</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00136"></a>00136 } <a name="l00137"></a>00137 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a7050eb78afb74764622f1b6140297dd4">outputs</a>(); i++) { <a name="l00138"></a>00138 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a368fbe339be25ff39dcddd984e2c6342">addZone3</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1* output$0 = output[$0];"</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00139"></a>00139 } <a name="l00140"></a>00140 <a name="l00141"></a>00141 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; <a class="code" href="list_8hh.html#a8bdd73641276e0c0f999f504348eacc1">isList</a>(L); L = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(L), i++) { <a name="l00142"></a>00142 <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 class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(L); <a name="l00143"></a>00143 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"output$0[i] = $2$1;"</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(sig), <a class="code" href="floats_8cpp.html#a73d3935ab38244e8006fbaa2b7caf33c">xcast</a>())); <a name="l00144"></a>00144 } <a name="l00145"></a>00145 <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="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85" title="Remove fake root folder if not needed (that is if the UI is completely enclosed in...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>)); <a name="l00146"></a>00146 <a class="code" href="classCompiler.html#a83bb12b7d930bd1b574e35202f5d3da6" title="Generate user interface macros corresponding to user interface element t.">generateMacroInterfaceTree</a>(<span class="stringliteral">""</span>, <a class="code" href="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85" title="Remove fake root folder if not needed (that is if the UI is completely enclosed in...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>)); <a name="l00147"></a>00147 <span class="keywordflow">if</span> (<a class="code" href="classCompiler.html#a8a23c67dd7d72d5aa6353d29de84b711">fDescription</a>) { <a name="l00148"></a>00148 <a class="code" href="classCompiler.html#a8a23c67dd7d72d5aa6353d29de84b711">fDescription</a>-><a class="code" href="classDescription.html#a7b97643d00e0cc786355a696cac2bcba">ui</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...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>)); <a name="l00149"></a>00149 } <a name="l00150"></a>00150 } <a name="l00151"></a>00151 <a name="l00152"></a>00152 <a name="l00153"></a>00153 <span class="comment">/*****************************************************************************</span> <a name="l00154"></a>00154 <span class="comment"> compileSingleSignal</span> <a name="l00155"></a>00155 <span class="comment">*****************************************************************************/</span> <a name="l00156"></a>00156 <a name="l00157"></a><a class="code" href="classScalarCompiler.html#a3590109641b7970c68ea20d033471a41">00157</a> <span class="keywordtype">void</span> <a class="code" href="classScalarCompiler.html#a3590109641b7970c68ea20d033471a41">ScalarCompiler::compileSingleSignal</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> sig) <a name="l00158"></a>00158 { <a name="l00159"></a>00159 <span class="comment">//contextor recursivness(0);</span> <a name="l00160"></a>00160 sig = <a class="code" href="classScalarCompiler.html#a38de9ca99a78eb0e82f149bbf4e03783">prepare2</a>(sig); <span class="comment">// optimize and annotate expression</span> <a name="l00161"></a>00161 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"output[i] = $0;"</span>, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(sig))); <a name="l00162"></a>00162 <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="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85" title="Remove fake root folder if not needed (that is if the UI is completely enclosed in...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>)); <a name="l00163"></a>00163 <a class="code" href="classCompiler.html#a83bb12b7d930bd1b574e35202f5d3da6" title="Generate user interface macros corresponding to user interface element t.">generateMacroInterfaceTree</a>(<span class="stringliteral">""</span>, <a class="code" href="classCompiler.html#a4e6876486af1cf65dc633fd3b99aba85" title="Remove fake root folder if not needed (that is if the UI is completely enclosed in...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>)); <a name="l00164"></a>00164 <span class="keywordflow">if</span> (<a class="code" href="classCompiler.html#a8a23c67dd7d72d5aa6353d29de84b711">fDescription</a>) { <a name="l00165"></a>00165 <a class="code" href="classCompiler.html#a8a23c67dd7d72d5aa6353d29de84b711">fDescription</a>-><a class="code" href="classDescription.html#a7b97643d00e0cc786355a696cac2bcba">ui</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...">prepareUserInterfaceTree</a>(<a class="code" href="classCompiler.html#a2b8004ea1fd5b86ded1a093e7c5eb70d">fUIRoot</a>)); <a name="l00166"></a>00166 } <a name="l00167"></a>00167 } <a name="l00168"></a>00168 <a name="l00169"></a>00169 <a name="l00170"></a>00170 <span class="comment">/*****************************************************************************</span> <a name="l00171"></a>00171 <span class="comment"> CS : compile a signal</span> <a name="l00172"></a>00172 <span class="comment">*****************************************************************************/</span> <a name="l00173"></a>00173 <a name="l00180"></a><a class="code" href="classScalarCompiler.html#ab9526b36f9f5c40e5780c6015312eed4">00180</a> <span class="keywordtype">bool</span> <a class="code" href="classScalarCompiler.html#ab9526b36f9f5c40e5780c6015312eed4" title="Test if a signal is already compiled.">ScalarCompiler::getCompiledExpression</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> sig, <span class="keywordtype">string</span>& cexp) <a name="l00181"></a>00181 { <a name="l00182"></a>00182 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a5a9a34892a42d9fc3b55af5da5a44176">fCompileProperty</a>.get(sig, cexp); <a name="l00183"></a>00183 } <a name="l00184"></a>00184 <a name="l00191"></a><a class="code" href="classScalarCompiler.html#a47e098af6e5857d4577371e459cd6df4">00191</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a47e098af6e5857d4577371e459cd6df4" title="Set the string of a compiled expression is already compiled.">ScalarCompiler::setCompiledExpression</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& cexp) <a name="l00192"></a>00192 { <a name="l00193"></a>00193 <a class="code" href="classScalarCompiler.html#a5a9a34892a42d9fc3b55af5da5a44176">fCompileProperty</a>.set(sig, cexp); <a name="l00194"></a>00194 <span class="keywordflow">return</span> cexp; <a name="l00195"></a>00195 } <a name="l00196"></a>00196 <a name="l00202"></a><a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988">00202</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">ScalarCompiler::CS</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> sig) <a name="l00203"></a>00203 { <a name="l00204"></a>00204 <span class="comment">//contextor contextRecursivness;</span> <a name="l00205"></a>00205 <span class="keywordtype">string</span> code; <a name="l00206"></a>00206 <a name="l00207"></a>00207 <span class="keywordflow">if</span> (!<a class="code" href="classScalarCompiler.html#ab9526b36f9f5c40e5780c6015312eed4" title="Test if a signal is already compiled.">getCompiledExpression</a>(sig, code)) { <a name="l00208"></a>00208 <span class="comment">// not compiled yet</span> <a name="l00209"></a>00209 <span class="comment">/* if (getRecursivness(sig) != contextRecursivness.get()) {</span> <a name="l00210"></a>00210 <span class="comment"> contextRecursivness.set(getRecursivness(sig));</span> <a name="l00211"></a>00211 <span class="comment"> }*/</span> <a name="l00212"></a>00212 code = <a class="code" href="classScalarCompiler.html#a312d1e036e59631cfc976ad1346d93c9" title="Main code generator dispatch.">generateCode</a>(sig); <a name="l00213"></a>00213 <a class="code" href="classScalarCompiler.html#a47e098af6e5857d4577371e459cd6df4" title="Set the string of a compiled expression is already compiled.">setCompiledExpression</a>(sig, code); <a name="l00214"></a>00214 } <a name="l00215"></a>00215 <span class="keywordflow">return</span> code; <a name="l00216"></a>00216 } <a name="l00217"></a>00217 <a name="l00218"></a>00218 <span class="comment">/*****************************************************************************</span> <a name="l00219"></a>00219 <span class="comment"> generateCode : dispatch according to signal</span> <a name="l00220"></a>00220 <span class="comment">*****************************************************************************/</span> <a name="l00227"></a><a class="code" href="classScalarCompiler.html#a312d1e036e59631cfc976ad1346d93c9">00227</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a312d1e036e59631cfc976ad1346d93c9" title="Main code generator dispatch.">ScalarCompiler::generateCode</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> sig) <a name="l00228"></a>00228 { <a name="l00229"></a>00229 <span class="preprocessor">#if 0</span> <a name="l00230"></a>00230 <span class="preprocessor"></span> fprintf(stderr, <span class="stringliteral">"CALL generateCode("</span>); <a name="l00231"></a>00231 <a class="code" href="sigprint_8cpp.html#ac996689aaeee388feb18661ff38abe01">printSignal</a>(sig, stderr); <a name="l00232"></a>00232 fprintf(stderr, <span class="stringliteral">")\n"</span>); <a name="l00233"></a>00233 <span class="preprocessor">#endif</span> <a name="l00234"></a>00234 <span class="preprocessor"></span> <a name="l00235"></a>00235 <span class="keywordtype">int</span> i; <a name="l00236"></a>00236 <span class="keywordtype">double</span> r; <a name="l00237"></a>00237 <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> c, sel, x, y, z, label, id, ff, largs, type, <a class="code" href="symbol_8hh.html#a8243134fbbd9d924ebbb3f833922e310" title="Returns the name of a symbol.">name</a>, file; <a name="l00238"></a>00238 <a name="l00239"></a>00239 <span class="comment">//printf("compilation of %p : ", sig); print(sig); printf("\n");</span> <a name="l00240"></a>00240 <a name="l00241"></a>00241 <span class="keywordflow">if</span> ( <a class="code" href="symbol_8hh.html#a603fcb6c07eacf2688c2a8470637d0ff" title="Returns user data.">getUserData</a>(sig) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#ad3aa914094a53cc9451e2526c37ddfe3" title="retrieve the type annotation of sig">generateXtended</a>(sig); } <a name="l00242"></a>00242 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a75cc925deac1e031e75ae72271dd5995">isSigInt</a>(sig, &i) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a14b0b24942c22ad01e6429dba926f55d">generateNumber</a>(sig, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i)); } <a name="l00243"></a>00243 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a305497ed8593020624204f9d359743f2">isSigReal</a>(sig, &r) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a14b0b24942c22ad01e6429dba926f55d">generateNumber</a>(sig, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(r)); } <a name="l00244"></a>00244 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a38254d67a0541d98c6097fd51b22ea45">isSigInput</a>(sig, &i) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a6c2bc57c93e7b7aeef5fc6d9e0563161">generateInput</a> (sig, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i)); } <a name="l00245"></a>00245 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a1415deb58619ab50a536d7f2ce425f22">isSigOutput</a>(sig, &i, x) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#aa79b3ecf25b9022861bbda454e160a3f">generateOutput</a> (sig, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(i), <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(x));} <a name="l00246"></a>00246 <a name="l00247"></a>00247 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#af55cdefee258834b3b8f6c070d4970c9">isSigFixDelay</a>(sig, x, y) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a114a804894cbeb775c205de2410fb5a9" title="Generate code for accessing a delayed signal.">generateFixDelay</a> (sig, x, y); } <a name="l00248"></a>00248 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a18895c816779682006a84aede438af29">isSigPrefix</a>(sig, x, y) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#ab42de3c4f62f672808a9db186702fa07">generatePrefix</a> (sig, x, y); } <a name="l00249"></a>00249 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a6aca999210178e06a21136a1bd819031">isSigIota</a>(sig, x) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#ae3daa4b707e6037295c89d6d2d741fd7">generateIota</a> (sig, x); } <a name="l00250"></a>00250 <a name="l00251"></a>00251 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a8705584c3c319be54be73dc391d25634">isSigBinOp</a>(sig, &i, x, y) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a5dcc35b4aa293a13045e6e95e28fdf49">generateBinOp</a> (sig, i, x, y); } <a name="l00252"></a>00252 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a7d60b2c9da70fb0a2edff9593d38c573">isSigFFun</a>(sig, ff, largs) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a92f3d40967413418444d272a271b5d5e">generateFFun</a> (sig, ff, largs); } <a name="l00253"></a>00253 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a71788aa9ccfc0aa598243fbef2a88f68">isSigFConst</a>(sig, type, name, file) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#abb3f8901987a78d9285d724b3e19f7d3">generateFConst</a>(sig, <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(file), <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(name)); } <a name="l00254"></a>00254 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a13d7a7178d98383c309b0e4a45dfc96b">isSigFVar</a>(sig, type, name, file) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a3beb833085a4e20decf3783a78a18b05">generateFVar</a>(sig, <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(file), <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(name)); } <a name="l00255"></a>00255 <a name="l00256"></a>00256 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aa9b2ad7a65566fbc382d60e315b42740">isSigTable</a>(sig, <span class="keywordtype">id</span>, x, y) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a2c51c50e63758ec32c7c205ff4123446">generateTable</a> (sig, x, y); } <a name="l00257"></a>00257 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#ab5b22110acbd38b7d4634dc94bcc8d22">isSigWRTbl</a>(sig, <span class="keywordtype">id</span>, x, y, z) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a839b060c8ac3792bb888225352533dd8">generateWRTbl</a> (sig, x, y, z); } <a name="l00258"></a>00258 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a9d9cbd375c200fa4e666de6ffb72dbca">isSigRDTbl</a>(sig, x, y) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a37ad94c097c4d2343e71f1748129f74d">generateRDTbl</a> (sig, x, y); } <a name="l00259"></a>00259 <a name="l00260"></a>00260 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a55f14d5c4b5bc07285840f93d380b422">isSigSelect2</a>(sig, sel, x, y) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a2e070a0f894bf348049b111b094f8a3e" title="Generate a select2 code.">generateSelect2</a> (sig, sel, x, y); } <a name="l00261"></a>00261 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a33cf5ac61f2ad8244394ce1e59914bbc">isSigSelect3</a>(sig, sel, x, y, z) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a0651bbed181dd7f68c53ef94f2bafd1f" title="Generate a select3 code.">generateSelect3</a> (sig, sel, x, y, z); } <a name="l00262"></a>00262 <a name="l00263"></a>00263 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a771720237ca174a55a6823cc6623d602">isSigGen</a>(sig, x) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a1caabad696e1b182349065cb9805d768">generateSigGen</a> (sig, x); } <a name="l00264"></a>00264 <a name="l00265"></a>00265 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a9b54e9177bb3726e06700649c3e5c05d">isProj</a>(sig, &i, x) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#ac6ac92b3f9b29101dc0e09ca7d9f01e3" title="Generate code for a projection of a group of mutually recursive definitions.">generateRecProj</a> (sig, x, i); } <a name="l00266"></a>00266 <a name="l00267"></a>00267 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a3ef48f0da2ef5b8e3ee7371a1e4059ae">isSigIntCast</a>(sig, x) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a69b85f3ec1a38ec05bd21d245b98a60f">generateIntCast</a> (sig, x); } <a name="l00268"></a>00268 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a52448156d86125bbc8de23d641217de2">isSigFloatCast</a>(sig, x) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a1f836f4c9fd1ebade4892a1ce56e2d9d">generateFloatCast</a> (sig, x); } <a name="l00269"></a>00269 <a name="l00270"></a>00270 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a9cb8af593289d910a1f8ec8a9c8d880f">isSigButton</a>(sig, label) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#accff264d4e6ed46e5a2c31ca49edd196">generateButton</a> (sig, label); } <a name="l00271"></a>00271 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a48996c1ce74258d499baae3d267078bc">isSigCheckbox</a>(sig, label) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a6ae716419715b48142a2f685875d0d4e">generateCheckbox</a> (sig, label); } <a name="l00272"></a>00272 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aac990f39e6a1d50e8e1de3b6f7701cfe">isSigVSlider</a>(sig, label,c,x,y,z) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a3c022fb9c391b7da22e2bc9c75a370a4">generateVSlider</a> (sig, label, c,x,y,z); } <a name="l00273"></a>00273 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aaa72c718314a1ba2cee25a95c153e37d">isSigHSlider</a>(sig, label,c,x,y,z) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#aa840902417516d180182273d59a302ef">generateHSlider</a> (sig, label, c,x,y,z); } <a name="l00274"></a>00274 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#aa8476971aba67dfc3af7b5d11f974ef3">isSigNumEntry</a>(sig, label,c,x,y,z) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a1db9a71b00c04ac777a7f206c1359cb2">generateNumEntry</a> (sig, label, c,x,y,z); } <a name="l00275"></a>00275 <a name="l00276"></a>00276 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a667a345cf4efcba00fce5a06bc1e8299">isSigVBargraph</a>(sig, label,x,y,z) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#add2b616f1aa52f7c3e5fea14b84a341e">generateVBargraph</a> (sig, label, x, y, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(z)); } <a name="l00277"></a>00277 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#a5acf9dd03d1d0032e9486867876f1806">isSigHBargraph</a>(sig, label,x,y,z) ) { <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a88f90a11fc6bb95aff713977fd34166d">generateHBargraph</a> (sig, label, x, y, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(z)); } <a name="l00278"></a>00278 <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( <a class="code" href="signals_8cpp.html#ad717966fe25735c5cf799e04338192b4">isSigAttach</a>(sig, x, y) ) { <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(y); <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(x)); } <a name="l00279"></a>00279 <a name="l00280"></a>00280 <span class="keywordflow">else</span> { <a name="l00281"></a>00281 printf(<span class="stringliteral">"Error in compiling signal, unrecognized signal : "</span>); <a name="l00282"></a>00282 <a class="code" href="list_8cpp.html#a850f2e459a901e0c9908d3a3a54b306e">print</a>(sig); <a name="l00283"></a>00283 printf(<span class="stringliteral">"\n"</span>); <a name="l00284"></a>00284 exit(1); <a name="l00285"></a>00285 } <a name="l00286"></a>00286 <span class="keywordflow">return</span> <span class="stringliteral">"error in generate code"</span>; <a name="l00287"></a>00287 } <a name="l00288"></a>00288 <a name="l00289"></a>00289 <a name="l00290"></a>00290 <span class="comment">/*****************************************************************************</span> <a name="l00291"></a>00291 <span class="comment"> NUMBERS</span> <a name="l00292"></a>00292 <span class="comment">*****************************************************************************/</span> <a name="l00293"></a>00293 <a name="l00294"></a>00294 <a name="l00295"></a><a class="code" href="classScalarCompiler.html#a14b0b24942c22ad01e6429dba926f55d">00295</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a14b0b24942c22ad01e6429dba926f55d">ScalarCompiler::generateNumber</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp) <a name="l00296"></a>00296 { <a name="l00297"></a>00297 <span class="keywordtype">string</span> ctype, vname; <a name="l00298"></a>00298 <a class="code" href="classOccurences.html">Occurences</a>* o = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(sig); <a name="l00299"></a>00299 <a name="l00300"></a>00300 <span class="comment">// check for number occuring in delays</span> <a name="l00301"></a>00301 <span class="keywordflow">if</span> (o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()>0) { <a name="l00302"></a>00302 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig), <span class="stringliteral">"Vec"</span>, ctype, vname); <a name="l00303"></a>00303 <a class="code" href="classScalarCompiler.html#adec9012e0c7e1c27b0144e53fcdc4734" title="Generate code for the delay mecchanism.">generateDelayVec</a>(sig, exp, ctype, vname, o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()); <a name="l00304"></a>00304 } <a name="l00305"></a>00305 <span class="keywordflow">return</span> exp; <a name="l00306"></a>00306 } <a name="l00307"></a>00307 <a name="l00308"></a>00308 <span class="comment">/*****************************************************************************</span> <a name="l00309"></a>00309 <span class="comment"> FOREIGN CONSTANTS</span> <a name="l00310"></a>00310 <span class="comment">*****************************************************************************/</span> <a name="l00311"></a>00311 <a name="l00312"></a>00312 <a name="l00313"></a><a class="code" href="classScalarCompiler.html#abb3f8901987a78d9285d724b3e19f7d3">00313</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#abb3f8901987a78d9285d724b3e19f7d3">ScalarCompiler::generateFConst</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& file, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp) <a name="l00314"></a>00314 { <a name="l00315"></a>00315 <span class="keywordtype">string</span> ctype, vname; <a name="l00316"></a>00316 <a class="code" href="classOccurences.html">Occurences</a>* o = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(sig); <a name="l00317"></a>00317 <a name="l00318"></a>00318 <a class="code" href="classCompiler.html#a7682294288c38e7d56ef262052213779">addIncludeFile</a>(file); <a name="l00319"></a>00319 <a name="l00320"></a>00320 <span class="keywordflow">if</span> (o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()>0) { <a name="l00321"></a>00321 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig), <span class="stringliteral">"Vec"</span>, ctype, vname); <a name="l00322"></a>00322 <a class="code" href="classScalarCompiler.html#adec9012e0c7e1c27b0144e53fcdc4734" title="Generate code for the delay mecchanism.">generateDelayVec</a>(sig, exp, ctype, vname, o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()); <a name="l00323"></a>00323 } <a name="l00324"></a>00324 <span class="keywordflow">return</span> exp; <a name="l00325"></a>00325 } <a name="l00326"></a>00326 <a name="l00327"></a>00327 <span class="comment">/*****************************************************************************</span> <a name="l00328"></a>00328 <span class="comment"> FOREIGN VARIABLES</span> <a name="l00329"></a>00329 <span class="comment">*****************************************************************************/</span> <a name="l00330"></a>00330 <a name="l00331"></a>00331 <a name="l00332"></a><a class="code" href="classScalarCompiler.html#a3beb833085a4e20decf3783a78a18b05">00332</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a3beb833085a4e20decf3783a78a18b05">ScalarCompiler::generateFVar</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& file, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp) <a name="l00333"></a>00333 { <a name="l00334"></a>00334 <span class="keywordtype">string</span> ctype, vname; <a name="l00335"></a>00335 <a class="code" href="classOccurences.html">Occurences</a>* o = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(sig); <a name="l00336"></a>00336 <a name="l00337"></a>00337 <a class="code" href="classCompiler.html#a7682294288c38e7d56ef262052213779">addIncludeFile</a>(file); <a name="l00338"></a>00338 <a name="l00339"></a>00339 <span class="keywordflow">if</span> (o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()>0) { <a name="l00340"></a>00340 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig), <span class="stringliteral">"Vec"</span>, ctype, vname); <a name="l00341"></a>00341 <a class="code" href="classScalarCompiler.html#adec9012e0c7e1c27b0144e53fcdc4734" title="Generate code for the delay mecchanism.">generateDelayVec</a>(sig, exp, ctype, vname, o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()); <a name="l00342"></a>00342 } <a name="l00343"></a>00343 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, exp); <a name="l00344"></a>00344 } <a name="l00345"></a>00345 <a name="l00346"></a>00346 <span class="comment">/*****************************************************************************</span> <a name="l00347"></a>00347 <span class="comment"> INPUTS - OUTPUTS</span> <a name="l00348"></a>00348 <span class="comment">*****************************************************************************/</span> <a name="l00349"></a>00349 <a name="l00350"></a>00350 <a name="l00351"></a><a class="code" href="classScalarCompiler.html#a6c2bc57c93e7b7aeef5fc6d9e0563161">00351</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a6c2bc57c93e7b7aeef5fc6d9e0563161">ScalarCompiler::generateInput</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& idx) <a name="l00352"></a>00352 { <a name="l00353"></a>00353 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1input$0[i]"</span>, idx, <a class="code" href="floats_8cpp.html#ab43c58d96e339afe4b28a632ba1186b6">icast</a>())); <a name="l00354"></a>00354 } <a name="l00355"></a>00355 <a name="l00356"></a>00356 <a name="l00357"></a><a class="code" href="classScalarCompiler.html#aa79b3ecf25b9022861bbda454e160a3f">00357</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#aa79b3ecf25b9022861bbda454e160a3f">ScalarCompiler::generateOutput</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& idx, <span class="keyword">const</span> <span class="keywordtype">string</span>& arg) <a name="l00358"></a>00358 { <a name="l00359"></a>00359 <span class="keywordtype">string</span> dst = <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"output$0[i]"</span>, idx); <a name="l00360"></a>00360 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $2$1;"</span>, dst, arg, <a class="code" href="floats_8cpp.html#a73d3935ab38244e8006fbaa2b7caf33c">xcast</a>())); <a name="l00361"></a>00361 <span class="keywordflow">return</span> dst; <a name="l00362"></a>00362 } <a name="l00363"></a>00363 <a name="l00364"></a>00364 <a name="l00365"></a>00365 <span class="comment">/*****************************************************************************</span> <a name="l00366"></a>00366 <span class="comment"> BINARY OPERATION</span> <a name="l00367"></a>00367 <span class="comment">*****************************************************************************/</span> <a name="l00368"></a>00368 <a name="l00369"></a><a class="code" href="classScalarCompiler.html#a5dcc35b4aa293a13045e6e95e28fdf49">00369</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a5dcc35b4aa293a13045e6e95e28fdf49">ScalarCompiler::generateBinOp</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> sig, <span class="keywordtype">int</span> opcode, <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> arg1, <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> arg2) <a name="l00370"></a>00370 { <a name="l00371"></a>00371 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"($0 $1 $2)"</span>, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(arg1), <a class="code" href="binop_8cpp.html#a2d55d4b4acaed7188a432ffdb646395a">gBinOpTable</a>[opcode]->fName, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(arg2))); <a name="l00372"></a>00372 } <a name="l00373"></a>00373 <a name="l00374"></a>00374 <a name="l00375"></a>00375 <span class="comment">/*****************************************************************************</span> <a name="l00376"></a>00376 <span class="comment"> Primitive Operations</span> <a name="l00377"></a>00377 <span class="comment">*****************************************************************************/</span> <a name="l00378"></a>00378 <a name="l00379"></a><a class="code" href="classScalarCompiler.html#a92f3d40967413418444d272a271b5d5e">00379</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a92f3d40967413418444d272a271b5d5e">ScalarCompiler::generateFFun</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> sig, <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> ff, <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> largs) <a name="l00380"></a>00380 { <a name="l00381"></a>00381 <a class="code" href="classCompiler.html#a7682294288c38e7d56ef262052213779">addIncludeFile</a>(<a class="code" href="prim2_8cpp.html#a8638f964f03548fff574ed4601d7f4e1">ffincfile</a>(ff)); <span class="comment">//printf("inc file %s\n", ffincfile(ff));</span> <a name="l00382"></a>00382 <a class="code" href="classCompiler.html#a5a2cfd7e795a98e66b31543e2b5225b5">addLibrary</a>(<a class="code" href="prim2_8cpp.html#ab10dc4b4af50f0a082eb629526eb5a09">fflibfile</a>(ff)); <span class="comment">//printf("lib file %s\n", fflibfile(ff));</span> <a name="l00383"></a>00383 <a name="l00384"></a>00384 <span class="keywordtype">string</span> code = <a class="code" href="prim2_8cpp.html#a9293046e818b432cfa8a7d418679eff3">ffname</a>(ff); <a name="l00385"></a>00385 code += <span class="charliteral">'('</span>; <a name="l00386"></a>00386 <span class="keywordtype">string</span> sep = <span class="stringliteral">""</span>; <a name="l00387"></a>00387 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i< <a class="code" href="prim2_8cpp.html#af82147adb6d445cb8f8878f6dcedba64">ffarity</a>(ff); i++) { <a name="l00388"></a>00388 code += sep; <a name="l00389"></a>00389 code += <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(<a class="code" href="list_8cpp.html#a928095576946f64a78ea78fbb65fb8d6">nth</a>(largs, i)); <a name="l00390"></a>00390 sep = <span class="stringliteral">", "</span>; <a name="l00391"></a>00391 } <a name="l00392"></a>00392 code += <span class="charliteral">')'</span>; <a name="l00393"></a>00393 <span class="keywordflow">return</span> code; <a name="l00394"></a>00394 } <a name="l00395"></a>00395 <a name="l00396"></a>00396 <a name="l00397"></a>00397 <span class="comment">/*****************************************************************************</span> <a name="l00398"></a>00398 <span class="comment"> CACHE CODE</span> <a name="l00399"></a>00399 <span class="comment">*****************************************************************************/</span> <a name="l00400"></a>00400 <a name="l00401"></a><a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">00401</a> <span class="keywordtype">void</span> <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">ScalarCompiler::getTypedNames</a>(<a class="code" href="classP.html">Type</a> t, <span class="keyword">const</span> <span class="keywordtype">string</span>& prefix, <span class="keywordtype">string</span>& ctype, <span class="keywordtype">string</span>& vname) <a name="l00402"></a>00402 { <a name="l00403"></a>00403 <span class="keywordflow">if</span> (t->nature() == <a class="code" href="sigtype_8hh.html#adc29c2ff13d900c2f185ee95427fb06ca9bb31be73c01d40428195449f62588ac">kInt</a>) { <a name="l00404"></a>00404 ctype = <span class="stringliteral">"int"</span>; vname = <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"i$0"</span>, <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(prefix)); <a name="l00405"></a>00405 } <span class="keywordflow">else</span> { <a name="l00406"></a>00406 ctype = <a class="code" href="floats_8cpp.html#af21a266634ce24abcd265188e774ba4a">ifloat</a>(); vname = <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"f$0"</span>, <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(prefix)); <a name="l00407"></a>00407 } <a name="l00408"></a>00408 } <a name="l00409"></a>00409 <a name="l00410"></a><a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">00410</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">ScalarCompiler::generateCacheCode</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp) <a name="l00411"></a>00411 { <a name="l00412"></a>00412 <span class="keywordtype">string</span> vname, ctype, code; <a name="l00413"></a>00413 <span class="keywordtype">int</span> sharing = <a class="code" href="classScalarCompiler.html#a7bf169572df60b9383297d85f36e2506">getSharingCount</a>(sig); <a name="l00414"></a>00414 <a class="code" href="classOccurences.html">Occurences</a>* o = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(sig); <a name="l00415"></a>00415 <a name="l00416"></a>00416 <span class="comment">// check reentrance</span> <a name="l00417"></a>00417 <span class="keywordflow">if</span> (<a class="code" href="classScalarCompiler.html#ab9526b36f9f5c40e5780c6015312eed4" title="Test if a signal is already compiled.">getCompiledExpression</a>(sig, code)) { <a name="l00418"></a>00418 <span class="keywordflow">return</span> code; <a name="l00419"></a>00419 } <a name="l00420"></a>00420 <a name="l00421"></a>00421 <span class="comment">// check for expression occuring in delays</span> <a name="l00422"></a>00422 <span class="keywordflow">if</span> (o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()>0) { <a name="l00423"></a>00423 <a name="l00424"></a>00424 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig), <span class="stringliteral">"Vec"</span>, ctype, vname); <a name="l00425"></a>00425 <span class="keywordflow">if</span> (sharing>1) { <a name="l00426"></a>00426 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#adec9012e0c7e1c27b0144e53fcdc4734" title="Generate code for the delay mecchanism.">generateDelayVec</a>(sig, <a class="code" href="classScalarCompiler.html#a6774794b9cc217001586c0eb7b4ebb80">generateVariableStore</a>(sig,exp), ctype, vname, o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()); <a name="l00427"></a>00427 } <span class="keywordflow">else</span> { <a name="l00428"></a>00428 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#adec9012e0c7e1c27b0144e53fcdc4734" title="Generate code for the delay mecchanism.">generateDelayVec</a>(sig, exp, ctype, vname, o-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>()); <a name="l00429"></a>00429 } <a name="l00430"></a>00430 <a name="l00431"></a>00431 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sharing == 1) { <a name="l00432"></a>00432 <a name="l00433"></a>00433 <span class="keywordflow">return</span> exp; <a name="l00434"></a>00434 <a name="l00435"></a>00435 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (sharing > 1) { <a name="l00436"></a>00436 <a name="l00437"></a>00437 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a6774794b9cc217001586c0eb7b4ebb80">generateVariableStore</a>(sig, exp); <a name="l00438"></a>00438 <a name="l00439"></a>00439 } <span class="keywordflow">else</span> { <a name="l00440"></a>00440 cerr << <span class="stringliteral">"Error in sharing count ("</span> << sharing << <span class="stringliteral">") for "</span> << *sig << endl; <a name="l00441"></a>00441 exit(1); <a name="l00442"></a>00442 } <a name="l00443"></a>00443 <a name="l00444"></a>00444 <span class="keywordflow">return</span> <span class="stringliteral">"Error in generateCacheCode"</span>; <a name="l00445"></a>00445 } <a name="l00446"></a>00446 <a name="l00447"></a>00447 <a name="l00448"></a><a class="code" href="classScalarCompiler.html#a6774794b9cc217001586c0eb7b4ebb80">00448</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a6774794b9cc217001586c0eb7b4ebb80">ScalarCompiler::generateVariableStore</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp) <a name="l00449"></a>00449 { <a name="l00450"></a>00450 <span class="keywordtype">string</span> vname, ctype; <a name="l00451"></a>00451 <a class="code" href="classP.html">Type</a> t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig); <a name="l00452"></a>00452 <a name="l00453"></a>00453 <span class="keywordflow">switch</span> (t->variability()) { <a name="l00454"></a>00454 <a name="l00455"></a>00455 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00456"></a>00456 <a name="l00457"></a>00457 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(t, <span class="stringliteral">"Const"</span>, ctype, vname); <a name="l00458"></a>00458 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1;"</span>, ctype, vname)); <a name="l00459"></a>00459 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, vname, exp)); <a name="l00460"></a>00460 <span class="keywordflow">break</span>; <a name="l00461"></a>00461 <a name="l00462"></a>00462 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00463"></a>00463 <a name="l00464"></a>00464 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(t, <span class="stringliteral">"Slow"</span>, ctype, vname); <a name="l00465"></a>00465 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a85cbd66d7268d87442a19b4371a15272">addFirstPrivateDecl</a>(vname); <a name="l00466"></a>00466 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a28f906237d7648909e66f593ac19ec82">addZone2</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1 = $2;"</span>, ctype, vname, exp)); <a name="l00467"></a>00467 <span class="keywordflow">break</span>; <a name="l00468"></a>00468 <a name="l00469"></a>00469 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00470"></a>00470 <a name="l00471"></a>00471 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(t, <span class="stringliteral">"Temp"</span>, ctype, vname); <a name="l00472"></a>00472 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 $1 = $2;"</span>, ctype, vname, exp)); <a name="l00473"></a>00473 <span class="keywordflow">break</span>; <a name="l00474"></a>00474 } <a name="l00475"></a>00475 <span class="keywordflow">return</span> vname; <a name="l00476"></a>00476 } <a name="l00477"></a>00477 <a name="l00478"></a>00478 <a name="l00479"></a>00479 <span class="comment">/*****************************************************************************</span> <a name="l00480"></a>00480 <span class="comment"> CASTING</span> <a name="l00481"></a>00481 <span class="comment">*****************************************************************************/</span> <a name="l00482"></a>00482 <a name="l00483"></a>00483 <a name="l00484"></a><a class="code" href="classScalarCompiler.html#a69b85f3ec1a38ec05bd21d245b98a60f">00484</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a69b85f3ec1a38ec05bd21d245b98a60f">ScalarCompiler::generateIntCast</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> sig, <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> x) <a name="l00485"></a>00485 { <a name="l00486"></a>00486 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"int($0)"</span>, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(x))); <a name="l00487"></a>00487 } <a name="l00488"></a>00488 <a name="l00489"></a><a class="code" href="classScalarCompiler.html#a1f836f4c9fd1ebade4892a1ce56e2d9d">00489</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a1f836f4c9fd1ebade4892a1ce56e2d9d">ScalarCompiler::generateFloatCast</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> sig, <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> x) <a name="l00490"></a>00490 { <a name="l00491"></a>00491 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1($0)"</span>, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(x), <a class="code" href="floats_8cpp.html#af21a266634ce24abcd265188e774ba4a">ifloat</a>())); <a name="l00492"></a>00492 } <a name="l00493"></a>00493 <a name="l00494"></a>00494 <span class="comment">/*****************************************************************************</span> <a name="l00495"></a>00495 <span class="comment"> user interface elements</span> <a name="l00496"></a>00496 <span class="comment">*****************************************************************************/</span> <a name="l00497"></a>00497 <a name="l00498"></a><a class="code" href="classScalarCompiler.html#accff264d4e6ed46e5a2c31ca49edd196">00498</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#accff264d4e6ed46e5a2c31ca49edd196">ScalarCompiler::generateButton</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> sig, <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 name="l00499"></a>00499 { <a name="l00500"></a>00500 <span class="keywordtype">string</span> varname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"fbutton"</span>); <a name="l00501"></a>00501 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1 \t$0;"</span>, varname, <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00502"></a>00502 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = 0.0;"</span>, varname)); <a name="l00503"></a>00503 <a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2" title="Add a widget with a certain path to the user interface tree.">addUIWidget</a>(<a class="code" href="list_8cpp.html#a8e15f8d6fcc6cd319059c2e0544145bb">reverse</a>(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(path)), <a class="code" href="uitree_8cpp.html#a57e5e173f6563110a36543ae576322cb">uiWidget</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(path), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(varname), sig)); <a name="l00504"></a>00504 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, varname); <a name="l00505"></a>00505 } <a name="l00506"></a>00506 <a name="l00507"></a><a class="code" href="classScalarCompiler.html#a6ae716419715b48142a2f685875d0d4e">00507</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a6ae716419715b48142a2f685875d0d4e">ScalarCompiler::generateCheckbox</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> sig, <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 name="l00508"></a>00508 { <a name="l00509"></a>00509 <span class="keywordtype">string</span> varname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"fcheckbox"</span>); <a name="l00510"></a>00510 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1 \t$0;"</span>, varname, <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00511"></a>00511 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = 0.0;"</span>, varname)); <a name="l00512"></a>00512 <a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2" title="Add a widget with a certain path to the user interface tree.">addUIWidget</a>(<a class="code" href="list_8cpp.html#a8e15f8d6fcc6cd319059c2e0544145bb">reverse</a>(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(path)), <a class="code" href="uitree_8cpp.html#a57e5e173f6563110a36543ae576322cb">uiWidget</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(path), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(varname), sig)); <a name="l00513"></a>00513 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, varname); <a name="l00514"></a>00514 } <a name="l00515"></a>00515 <a name="l00516"></a>00516 <a name="l00517"></a><a class="code" href="classScalarCompiler.html#a3c022fb9c391b7da22e2bc9c75a370a4">00517</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a3c022fb9c391b7da22e2bc9c75a370a4">ScalarCompiler::generateVSlider</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> sig, <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> cur, <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="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</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="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</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> step) <a name="l00518"></a>00518 { <a name="l00519"></a>00519 <span class="keywordtype">string</span> varname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"fslider"</span>); <a name="l00520"></a>00520 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1 \t$0;"</span>, varname, <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00521"></a>00521 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, <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>(cur)))); <a name="l00522"></a>00522 <a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2" title="Add a widget with a certain path to the user interface tree.">addUIWidget</a>(<a class="code" href="list_8cpp.html#a8e15f8d6fcc6cd319059c2e0544145bb">reverse</a>(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(path)), <a class="code" href="uitree_8cpp.html#a57e5e173f6563110a36543ae576322cb">uiWidget</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(path), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(varname), sig)); <a name="l00523"></a>00523 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, varname); <a name="l00524"></a>00524 } <a name="l00525"></a>00525 <a name="l00526"></a><a class="code" href="classScalarCompiler.html#aa840902417516d180182273d59a302ef">00526</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#aa840902417516d180182273d59a302ef">ScalarCompiler::generateHSlider</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> sig, <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> cur, <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="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</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="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</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> step) <a name="l00527"></a>00527 { <a name="l00528"></a>00528 <span class="keywordtype">string</span> varname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"fslider"</span>); <a name="l00529"></a>00529 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1 \t$0;"</span>, varname, <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00530"></a>00530 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, <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>(cur)))); <a name="l00531"></a>00531 <a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2" title="Add a widget with a certain path to the user interface tree.">addUIWidget</a>(<a class="code" href="list_8cpp.html#a8e15f8d6fcc6cd319059c2e0544145bb">reverse</a>(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(path)), <a class="code" href="uitree_8cpp.html#a57e5e173f6563110a36543ae576322cb">uiWidget</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(path), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(varname), sig)); <a name="l00532"></a>00532 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, varname); <a name="l00533"></a>00533 } <a name="l00534"></a>00534 <a name="l00535"></a><a class="code" href="classScalarCompiler.html#a1db9a71b00c04ac777a7f206c1359cb2">00535</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a1db9a71b00c04ac777a7f206c1359cb2">ScalarCompiler::generateNumEntry</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> sig, <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> cur, <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="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</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="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</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> step) <a name="l00536"></a>00536 { <a name="l00537"></a>00537 <span class="keywordtype">string</span> varname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"fentry"</span>); <a name="l00538"></a>00538 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1 \t$0;"</span>, varname, <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00539"></a>00539 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, <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>(cur)))); <a name="l00540"></a>00540 <a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2" title="Add a widget with a certain path to the user interface tree.">addUIWidget</a>(<a class="code" href="list_8cpp.html#a8e15f8d6fcc6cd319059c2e0544145bb">reverse</a>(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(path)), <a class="code" href="uitree_8cpp.html#a57e5e173f6563110a36543ae576322cb">uiWidget</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(path), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(varname), sig)); <a name="l00541"></a>00541 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, varname); <a name="l00542"></a>00542 } <a name="l00543"></a>00543 <a name="l00544"></a>00544 <a name="l00545"></a><a class="code" href="classScalarCompiler.html#add2b616f1aa52f7c3e5fea14b84a341e">00545</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#add2b616f1aa52f7c3e5fea14b84a341e">ScalarCompiler::generateVBargraph</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> sig, <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> <a class="code" href="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</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="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp) <a name="l00546"></a>00546 { <a name="l00547"></a>00547 <span class="keywordtype">string</span> varname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"fbargraph"</span>); <a name="l00548"></a>00548 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1 \t$0;"</span>, varname, <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00549"></a>00549 <a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2" title="Add a widget with a certain path to the user interface tree.">addUIWidget</a>(<a class="code" href="list_8cpp.html#a8e15f8d6fcc6cd319059c2e0544145bb">reverse</a>(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(path)), <a class="code" href="uitree_8cpp.html#a57e5e173f6563110a36543ae576322cb">uiWidget</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(path), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(varname), sig)); <a name="l00550"></a>00550 <a name="l00551"></a>00551 <a class="code" href="classP.html">Type</a> t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig); <a name="l00552"></a>00552 <span class="keywordflow">switch</span> (t->variability()) { <a name="l00553"></a>00553 <a name="l00554"></a>00554 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00555"></a>00555 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, exp)); <a name="l00556"></a>00556 <span class="keywordflow">break</span>; <a name="l00557"></a>00557 <a name="l00558"></a>00558 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00559"></a>00559 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a28f906237d7648909e66f593ac19ec82">addZone2</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, exp)); <a name="l00560"></a>00560 <span class="keywordflow">break</span>; <a name="l00561"></a>00561 <a name="l00562"></a>00562 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00563"></a>00563 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, exp)); <a name="l00564"></a>00564 <span class="keywordflow">break</span>; <a name="l00565"></a>00565 } <a name="l00566"></a>00566 <a name="l00567"></a>00567 <span class="comment">//return varname;</span> <a name="l00568"></a>00568 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, varname); <a name="l00569"></a>00569 } <a name="l00570"></a>00570 <a name="l00571"></a>00571 <a name="l00572"></a><a class="code" href="classScalarCompiler.html#a88f90a11fc6bb95aff713977fd34166d">00572</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a88f90a11fc6bb95aff713977fd34166d">ScalarCompiler::generateHBargraph</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> sig, <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> <a class="code" href="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</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="interval_8hh.html#a1c45761573e6cbc97cfacac78d905016">max</a>, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp) <a name="l00573"></a>00573 { <a name="l00574"></a>00574 <span class="keywordtype">string</span> varname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"fbargraph"</span>); <a name="l00575"></a>00575 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$1 \t$0;"</span>, varname, <a class="code" href="floats_8cpp.html#a2da2ae6649f9479320f115342675b275">xfloat</a>())); <a name="l00576"></a>00576 <a class="code" href="classCompiler.html#a4532f2ccb5ae6b5bcef23029a01a86c2" title="Add a widget with a certain path to the user interface tree.">addUIWidget</a>(<a class="code" href="list_8cpp.html#a8e15f8d6fcc6cd319059c2e0544145bb">reverse</a>(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(path)), <a class="code" href="uitree_8cpp.html#a57e5e173f6563110a36543ae576322cb">uiWidget</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(path), <a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(varname), sig)); <a name="l00577"></a>00577 <a name="l00578"></a>00578 <a class="code" href="classP.html">Type</a> t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig); <a name="l00579"></a>00579 <span class="keywordflow">switch</span> (t->variability()) { <a name="l00580"></a>00580 <a name="l00581"></a>00581 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00582"></a>00582 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, exp)); <a name="l00583"></a>00583 <span class="keywordflow">break</span>; <a name="l00584"></a>00584 <a name="l00585"></a>00585 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00586"></a>00586 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a28f906237d7648909e66f593ac19ec82">addZone2</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, exp)); <a name="l00587"></a>00587 <span class="keywordflow">break</span>; <a name="l00588"></a>00588 <a name="l00589"></a>00589 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00590"></a>00590 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, varname, exp)); <a name="l00591"></a>00591 <span class="keywordflow">break</span>; <a name="l00592"></a>00592 } <a name="l00593"></a>00593 <a name="l00594"></a>00594 <span class="comment">//return varname;</span> <a name="l00595"></a>00595 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, varname); <a name="l00596"></a>00596 } <a name="l00597"></a>00597 <a name="l00598"></a>00598 <a name="l00599"></a>00599 <a name="l00600"></a>00600 <a name="l00601"></a>00601 <span class="comment">/*****************************************************************************</span> <a name="l00602"></a>00602 <span class="comment"> TABLES</span> <a name="l00603"></a>00603 <span class="comment">*****************************************************************************/</span> <a name="l00604"></a>00604 <a name="l00605"></a>00605 <a name="l00606"></a>00606 <a name="l00607"></a>00607 <span class="comment">/*----------------------------------------------------------------------------</span> <a name="l00608"></a>00608 <span class="comment"> sigGen : initial table content</span> <a name="l00609"></a>00609 <span class="comment">----------------------------------------------------------------------------*/</span> <a name="l00610"></a>00610 <a name="l00611"></a><a class="code" href="classScalarCompiler.html#a1caabad696e1b182349065cb9805d768">00611</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a1caabad696e1b182349065cb9805d768">ScalarCompiler::generateSigGen</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> sig, <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> content) <a name="l00612"></a>00612 { <a name="l00613"></a>00613 <span class="keywordtype">string</span> klassname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"SIG"</span>); <a name="l00614"></a>00614 <span class="keywordtype">string</span> signame = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"sig"</span>); <a name="l00615"></a>00615 <a name="l00616"></a>00616 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#ab632bfedd9b79c0490408512c52e50af">addSubKlass</a>(<a class="code" href="compile__scal_8cpp.html#aad565b4516266c0d4e01ee7f2233fad3">signal2klass</a>(klassname, content)); <a name="l00617"></a>00617 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 $1;"</span>, klassname, signame)); <a name="l00618"></a>00618 <a name="l00619"></a>00619 <span class="keywordflow">return</span> signame; <a name="l00620"></a>00620 } <a name="l00621"></a>00621 <a name="l00622"></a><a class="code" href="classScalarCompiler.html#a7d79795953aa1a6de561b8ebd6d2db9b">00622</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a7d79795953aa1a6de561b8ebd6d2db9b">ScalarCompiler::generateStaticSigGen</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> sig, <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> content) <a name="l00623"></a>00623 { <a name="l00624"></a>00624 <span class="keywordtype">string</span> klassname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"SIG"</span>); <a name="l00625"></a>00625 <span class="keywordtype">string</span> signame = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"sig"</span>); <a name="l00626"></a>00626 <a name="l00627"></a>00627 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#ab632bfedd9b79c0490408512c52e50af">addSubKlass</a>(<a class="code" href="compile__scal_8cpp.html#aad565b4516266c0d4e01ee7f2233fad3">signal2klass</a>(klassname, content)); <a name="l00628"></a>00628 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a3f9c554b7e80e81b97d50ff772a089b5">addStaticInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 $1;"</span>, klassname, signame)); <a name="l00629"></a>00629 <a name="l00630"></a>00630 <span class="keywordflow">return</span> signame; <a name="l00631"></a>00631 } <a name="l00632"></a>00632 <a name="l00633"></a>00633 <a name="l00634"></a>00634 <span class="comment">/*----------------------------------------------------------------------------</span> <a name="l00635"></a>00635 <span class="comment"> sigTable : table declaration</span> <a name="l00636"></a>00636 <span class="comment">----------------------------------------------------------------------------*/</span> <a name="l00637"></a>00637 <a name="l00638"></a><a class="code" href="classScalarCompiler.html#a2c51c50e63758ec32c7c205ff4123446">00638</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a2c51c50e63758ec32c7c205ff4123446">ScalarCompiler::generateTable</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> sig, <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> tsize, <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> content) <a name="l00639"></a>00639 { <a name="l00640"></a>00640 <span class="keywordtype">string</span> generator(<a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(content)); <a name="l00641"></a>00641 <span class="keywordtype">string</span> ctype, vname; <a name="l00642"></a>00642 <span class="keywordtype">int</span> size; <a name="l00643"></a>00643 <a name="l00644"></a>00644 <span class="keywordflow">if</span> (!<a class="code" href="signals_8cpp.html#a75cc925deac1e031e75ae72271dd5995">isSigInt</a>(tsize, &size)) { <a name="l00645"></a>00645 <span class="comment">//fprintf(stderr, "error in ScalarCompiler::generateTable()\n"); exit(1);</span> <a name="l00646"></a>00646 cerr << <span class="stringliteral">"error in ScalarCompiler::generateTable() : "</span> <a name="l00647"></a>00647 << *tsize <a name="l00648"></a>00648 << <span class="stringliteral">" is not an integer expression "</span> <a name="l00649"></a>00649 << endl; <a name="l00650"></a>00650 } <a name="l00651"></a>00651 <span class="comment">// definition du nom et du type de la table</span> <a name="l00652"></a>00652 <span class="comment">// A REVOIR !!!!!!!!!</span> <a name="l00653"></a>00653 <a class="code" href="classP.html">Type</a> t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(content);<span class="comment">//, tEnv);</span> <a name="l00654"></a>00654 <span class="keywordflow">if</span> (t->nature() == <a class="code" href="sigtype_8hh.html#adc29c2ff13d900c2f185ee95427fb06ca9bb31be73c01d40428195449f62588ac">kInt</a>) { <a name="l00655"></a>00655 vname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"itbl"</span>); <a name="l00656"></a>00656 ctype = <span class="stringliteral">"int"</span>; <a name="l00657"></a>00657 } <span class="keywordflow">else</span> { <a name="l00658"></a>00658 vname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"ftbl"</span>); <a name="l00659"></a>00659 ctype = <a class="code" href="floats_8cpp.html#af21a266634ce24abcd265188e774ba4a">ifloat</a>(); <a name="l00660"></a>00660 } <a name="l00661"></a>00661 <a name="l00662"></a>00662 <span class="comment">// declaration de la table</span> <a name="l00663"></a>00663 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[$2];"</span>, ctype, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(size))); <a name="l00664"></a>00664 <a name="l00665"></a>00665 <span class="comment">// initialisation du generateur de contenu</span> <a name="l00666"></a>00666 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0.init(samplingFreq);"</span>, generator)); <a name="l00667"></a>00667 <span class="comment">// remplissage de la table</span> <a name="l00668"></a>00668 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0.fill($1,$2);"</span>, generator, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(size), vname)); <a name="l00669"></a>00669 <a name="l00670"></a>00670 <span class="comment">// on retourne le nom de la table</span> <a name="l00671"></a>00671 <span class="keywordflow">return</span> vname; <a name="l00672"></a>00672 } <a name="l00673"></a>00673 <a name="l00674"></a><a class="code" href="classScalarCompiler.html#ad21be208043a8c934441c78fd2e19a48">00674</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#ad21be208043a8c934441c78fd2e19a48">ScalarCompiler::generateStaticTable</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> sig, <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> tsize, <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> content) <a name="l00675"></a>00675 { <a name="l00676"></a>00676 <span class="comment">//string generator(CS(content));</span> <a name="l00677"></a>00677 <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> g; <a name="l00678"></a>00678 <span class="keywordtype">string</span> cexp; <a name="l00679"></a>00679 <span class="keywordtype">string</span> ctype, vname; <a name="l00680"></a>00680 <span class="keywordtype">int</span> size; <a name="l00681"></a>00681 <a name="l00682"></a>00682 assert ( <a class="code" href="signals_8cpp.html#a771720237ca174a55a6823cc6623d602">isSigGen</a>(content, g) ); <a name="l00683"></a>00683 <span class="keywordflow">if</span> (!<a class="code" href="classScalarCompiler.html#ab9526b36f9f5c40e5780c6015312eed4" title="Test if a signal is already compiled.">getCompiledExpression</a>(content, cexp)) { <a name="l00684"></a>00684 cexp = <a class="code" href="classScalarCompiler.html#a47e098af6e5857d4577371e459cd6df4" title="Set the string of a compiled expression is already compiled.">setCompiledExpression</a>(content, <a class="code" href="classScalarCompiler.html#a7d79795953aa1a6de561b8ebd6d2db9b">generateStaticSigGen</a>(content, g)); <a name="l00685"></a>00685 } <a name="l00686"></a>00686 <a name="l00687"></a>00687 <span class="keywordflow">if</span> (!<a class="code" href="signals_8cpp.html#a75cc925deac1e031e75ae72271dd5995">isSigInt</a>(tsize, &size)) { <a name="l00688"></a>00688 <span class="comment">//fprintf(stderr, "error in ScalarCompiler::generateTable()\n"); exit(1);</span> <a name="l00689"></a>00689 cerr << <span class="stringliteral">"error in ScalarCompiler::generateTable() : "</span> <a name="l00690"></a>00690 << *tsize <a name="l00691"></a>00691 << <span class="stringliteral">" is not an integer expression "</span> <a name="l00692"></a>00692 << endl; <a name="l00693"></a>00693 } <a name="l00694"></a>00694 <span class="comment">// definition du nom et du type de la table</span> <a name="l00695"></a>00695 <span class="comment">// A REVOIR !!!!!!!!!</span> <a name="l00696"></a>00696 <a class="code" href="classP.html">Type</a> t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(content);<span class="comment">//, tEnv);</span> <a name="l00697"></a>00697 <span class="keywordflow">if</span> (t->nature() == <a class="code" href="sigtype_8hh.html#adc29c2ff13d900c2f185ee95427fb06ca9bb31be73c01d40428195449f62588ac">kInt</a>) { <a name="l00698"></a>00698 vname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"itbl"</span>); <a name="l00699"></a>00699 ctype = <span class="stringliteral">"int"</span>; <a name="l00700"></a>00700 } <span class="keywordflow">else</span> { <a name="l00701"></a>00701 vname = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"ftbl"</span>); <a name="l00702"></a>00702 ctype = <a class="code" href="floats_8cpp.html#af21a266634ce24abcd265188e774ba4a">ifloat</a>(); <a name="l00703"></a>00703 } <a name="l00704"></a>00704 <a name="l00705"></a>00705 <span class="comment">// declaration de la table</span> <a name="l00706"></a>00706 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"static $0 \t$1[$2];"</span>, ctype, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(size))); <a name="l00707"></a>00707 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a163f2e67d1f8b7a6e5cb93ae5f14611b">addStaticFields</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \tmydsp::$1[$2];"</span>, ctype, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(size))); <a name="l00708"></a>00708 <a name="l00709"></a>00709 <span class="comment">// initialisation du generateur de contenu</span> <a name="l00710"></a>00710 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a3f9c554b7e80e81b97d50ff772a089b5">addStaticInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0.init(samplingFreq);"</span>, cexp)); <a name="l00711"></a>00711 <span class="comment">// remplissage de la table</span> <a name="l00712"></a>00712 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a3f9c554b7e80e81b97d50ff772a089b5">addStaticInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0.fill($1,$2);"</span>, cexp, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(size), vname)); <a name="l00713"></a>00713 <a name="l00714"></a>00714 <span class="comment">// on retourne le nom de la table</span> <a name="l00715"></a>00715 <span class="keywordflow">return</span> vname; <a name="l00716"></a>00716 } <a name="l00717"></a>00717 <a name="l00718"></a>00718 <a name="l00719"></a>00719 <span class="comment">/*----------------------------------------------------------------------------</span> <a name="l00720"></a>00720 <span class="comment"> sigWRTable : table assignement</span> <a name="l00721"></a>00721 <span class="comment">----------------------------------------------------------------------------*/</span> <a name="l00722"></a>00722 <a name="l00723"></a><a class="code" href="classScalarCompiler.html#a839b060c8ac3792bb888225352533dd8">00723</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a839b060c8ac3792bb888225352533dd8">ScalarCompiler::generateWRTbl</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> sig, <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> tbl, <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> idx, <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> data) <a name="l00724"></a>00724 { <a name="l00725"></a>00725 <span class="keywordtype">string</span> tblName(<a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(tbl)); <a name="l00726"></a>00726 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[$1] = $2;"</span>, tblName, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(idx), <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(data))); <a name="l00727"></a>00727 <span class="keywordflow">return</span> tblName; <a name="l00728"></a>00728 } <a name="l00729"></a>00729 <a name="l00730"></a>00730 <a name="l00731"></a>00731 <span class="comment">/*----------------------------------------------------------------------------</span> <a name="l00732"></a>00732 <span class="comment"> sigRDTable : table access</span> <a name="l00733"></a>00733 <span class="comment">----------------------------------------------------------------------------*/</span> <a name="l00734"></a>00734 <a name="l00735"></a><a class="code" href="classScalarCompiler.html#a37ad94c097c4d2343e71f1748129f74d">00735</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a37ad94c097c4d2343e71f1748129f74d">ScalarCompiler::generateRDTbl</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> sig, <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> tbl, <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> idx) <a name="l00736"></a>00736 { <a name="l00737"></a>00737 <span class="comment">// YO le 21/04/05 : La lecture des tables n'�ait pas mise dans le cache</span> <a name="l00738"></a>00738 <span class="comment">// et donc le code �ait dupliqu�(dans tester.dsp par exemple)</span> <a name="l00739"></a>00739 <span class="comment">//return subst("$0[$1]", CS(tEnv, tbl), CS(tEnv, idx));</span> <a name="l00740"></a>00740 <a name="l00741"></a>00741 <span class="comment">//cerr << "generateRDTable " << *sig << endl;</span> <a name="l00742"></a>00742 <span class="comment">// test the special case of a read only table that can be compiled</span> <a name="l00743"></a>00743 <span class="comment">// has a static member</span> <a name="l00744"></a>00744 <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> id, size, content; <a name="l00745"></a>00745 <span class="keywordflow">if</span>( <a class="code" href="signals_8cpp.html#aa9b2ad7a65566fbc382d60e315b42740">isSigTable</a>(tbl, <span class="keywordtype">id</span>, size, content) ) { <a name="l00746"></a>00746 <span class="keywordtype">string</span> tblname; <a name="l00747"></a>00747 <span class="keywordflow">if</span> (!<a class="code" href="classScalarCompiler.html#ab9526b36f9f5c40e5780c6015312eed4" title="Test if a signal is already compiled.">getCompiledExpression</a>(tbl, tblname)) { <a name="l00748"></a>00748 tblname = <a class="code" href="classScalarCompiler.html#a47e098af6e5857d4577371e459cd6df4" title="Set the string of a compiled expression is already compiled.">setCompiledExpression</a>(tbl, <a class="code" href="classScalarCompiler.html#ad21be208043a8c934441c78fd2e19a48">generateStaticTable</a>(tbl, size, content)); <a name="l00749"></a>00749 } <a name="l00750"></a>00750 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[$1]"</span>, tblname, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(idx))); <a name="l00751"></a>00751 } <span class="keywordflow">else</span> { <a name="l00752"></a>00752 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[$1]"</span>, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(tbl), <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(idx))); <a name="l00753"></a>00753 } <a name="l00754"></a>00754 } <a name="l00755"></a>00755 <a name="l00756"></a>00756 <a name="l00757"></a>00757 <a name="l00758"></a>00758 <span class="comment">/*****************************************************************************</span> <a name="l00759"></a>00759 <span class="comment"> RECURSIONS</span> <a name="l00760"></a>00760 <span class="comment">*****************************************************************************/</span> <a name="l00761"></a>00761 <a name="l00762"></a>00762 <a name="l00766"></a><a class="code" href="classScalarCompiler.html#ac6ac92b3f9b29101dc0e09ca7d9f01e3">00766</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#ac6ac92b3f9b29101dc0e09ca7d9f01e3" title="Generate code for a projection of a group of mutually recursive definitions.">ScalarCompiler::generateRecProj</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> sig, <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> r, <span class="keywordtype">int</span> i) <a name="l00767"></a>00767 { <a name="l00768"></a>00768 <span class="keywordtype">string</span> vname; <a name="l00769"></a>00769 <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> var, le; <a name="l00770"></a>00770 <a name="l00771"></a>00771 <span class="keywordflow">if</span> ( ! <a class="code" href="classScalarCompiler.html#a12cd9487cf729b06cbece49552bc632e" title="Get the vector name property of a signal, the name of the vector used to store the...">getVectorNameProperty</a>(sig, vname)) { <a name="l00772"></a>00772 assert(<a class="code" href="recursive-tree_8cpp.html#a4cb44c6e41e21da830e748dc35f16ba5" title="is t a de Bruijn recursive tree">isRec</a>(r, var, le)); <a name="l00773"></a>00773 <a class="code" href="classScalarCompiler.html#a635ee95d9c94ec8fed0e2587fbb95eba" title="Generate code for a group of mutually recursive definitions.">generateRec</a>(r, var, le); <a name="l00774"></a>00774 assert(<a class="code" href="classScalarCompiler.html#a12cd9487cf729b06cbece49552bc632e" title="Get the vector name property of a signal, the name of the vector used to store the...">getVectorNameProperty</a>(sig, vname)); <a name="l00775"></a>00775 } <a name="l00776"></a>00776 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0]"</span>, vname); <a name="l00777"></a>00777 } <a name="l00778"></a>00778 <a name="l00779"></a>00779 <a name="l00783"></a><a class="code" href="classScalarCompiler.html#a635ee95d9c94ec8fed0e2587fbb95eba">00783</a> <span class="keywordtype">void</span> <a class="code" href="classScalarCompiler.html#a635ee95d9c94ec8fed0e2587fbb95eba" title="Generate code for a group of mutually recursive definitions.">ScalarCompiler::generateRec</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> sig, <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> var, <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> le) <a name="l00784"></a>00784 { <a name="l00785"></a>00785 <span class="keywordtype">int</span> N = <a class="code" href="list_8cpp.html#a0b58ea1a5d8649e8afb0f70c48776347">len</a>(le); <a name="l00786"></a>00786 <a name="l00787"></a>00787 vector<bool> used(N); <a name="l00788"></a>00788 vector<int> delay(N); <a name="l00789"></a>00789 vector<string> vname(N); <a name="l00790"></a>00790 vector<string> ctype(N); <a name="l00791"></a>00791 <a name="l00792"></a>00792 <span class="comment">// prepare each element of a recursive definition</span> <a name="l00793"></a>00793 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<N; i++) { <a name="l00794"></a>00794 <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> e = <a class="code" href="signals_8cpp.html#a179e69f65c0cd6f6b9e855cbd9ae5e08">sigProj</a>(i,sig); <span class="comment">// recreate each recursive definition</span> <a name="l00795"></a>00795 <span class="keywordflow">if</span> (<a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(e)) { <a name="l00796"></a>00796 <span class="comment">// this projection is used</span> <a name="l00797"></a>00797 used[i] = <span class="keyword">true</span>; <a name="l00798"></a>00798 <a class="code" href="classScalarCompiler.html#ac33a3eb7d6bb601ab957871bd860b632">getTypedNames</a>(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(e), <span class="stringliteral">"Rec"</span>, ctype[i], vname[i]); <a name="l00799"></a>00799 <a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7" title="Set the vector name property of a signal, the name of the vector used to store the...">setVectorNameProperty</a>(e, vname[i]); <a name="l00800"></a>00800 delay[i] = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(e)-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>(); <a name="l00801"></a>00801 } <span class="keywordflow">else</span> { <a name="l00802"></a>00802 <span class="comment">// this projection is not used therefore</span> <a name="l00803"></a>00803 <span class="comment">// we should not generte code for it</span> <a name="l00804"></a>00804 used[i] = <span class="keyword">false</span>; <a name="l00805"></a>00805 } <a name="l00806"></a>00806 } <a name="l00807"></a>00807 <a name="l00808"></a>00808 <span class="comment">// generate delayline for each element of a recursive definition</span> <a name="l00809"></a>00809 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<N; i++) { <a name="l00810"></a>00810 <span class="keywordflow">if</span> (used[i]) { <a name="l00811"></a>00811 <a class="code" href="classScalarCompiler.html#a0fee342e1ab991f0f75169290afe36cd" title="Generate code for the delay mecchanism without using temporary variables.">generateDelayLine</a>(ctype[i], vname[i], delay[i], <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(<a class="code" href="list_8cpp.html#a928095576946f64a78ea78fbb65fb8d6">nth</a>(le,i))); <a name="l00812"></a>00812 } <a name="l00813"></a>00813 } <a name="l00814"></a>00814 } <a name="l00815"></a>00815 <a name="l00816"></a>00816 <a name="l00817"></a>00817 <span class="comment">/*****************************************************************************</span> <a name="l00818"></a>00818 <span class="comment"> PREFIX, DELAY A PREFIX VALUE</span> <a name="l00819"></a>00819 <span class="comment">*****************************************************************************/</span> <a name="l00820"></a>00820 <a name="l00821"></a><a class="code" href="classScalarCompiler.html#ab42de3c4f62f672808a9db186702fa07">00821</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#ab42de3c4f62f672808a9db186702fa07">ScalarCompiler::generatePrefix</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> sig, <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> x, <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> e) <a name="l00822"></a>00822 { <a name="l00823"></a>00823 <a class="code" href="classP.html">Type</a> te = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig);<span class="comment">//, tEnv);</span> <a name="l00824"></a>00824 <a name="l00825"></a>00825 <span class="keywordtype">string</span> vperm = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"M"</span>); <a name="l00826"></a>00826 <span class="keywordtype">string</span> vtemp = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"T"</span>); <a name="l00827"></a>00827 <a name="l00828"></a>00828 <span class="keywordtype">string</span> type = <a class="code" href="sigtype_8cpp.html#a1add1ece6baaeac60b4e46978f5955f4">cType</a>(te); <a name="l00829"></a>00829 <a name="l00830"></a>00830 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1;"</span>, type, vperm)); <a name="l00831"></a>00831 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, vperm, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(x))); <a name="l00832"></a>00832 <a name="l00833"></a>00833 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 $1 = $2;"</span>, type, vtemp, vperm)); <a name="l00834"></a>00834 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = $1;"</span>, vperm, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(e))); <a name="l00835"></a>00835 <span class="keywordflow">return</span> vtemp; <a name="l00836"></a>00836 } <a name="l00837"></a>00837 <a name="l00838"></a>00838 <a name="l00839"></a>00839 <span class="comment">/*****************************************************************************</span> <a name="l00840"></a>00840 <span class="comment"> IOTA(n)</span> <a name="l00841"></a>00841 <span class="comment">*****************************************************************************/</span> <a name="l00842"></a><a class="code" href="compile__scal_8cpp.html#a322b15c6cf72d06559fee6dfb4c0dfae">00842</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="compile__scal_8cpp.html#a322b15c6cf72d06559fee6dfb4c0dfae">isPowerOf2</a>(<span class="keywordtype">int</span> n) <a name="l00843"></a>00843 { <a name="l00844"></a>00844 <span class="keywordflow">return</span> !(n & (n - 1)); <a name="l00845"></a>00845 } <a name="l00846"></a>00846 <a name="l00847"></a><a class="code" href="classScalarCompiler.html#ae3daa4b707e6037295c89d6d2d741fd7">00847</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#ae3daa4b707e6037295c89d6d2d741fd7">ScalarCompiler::generateIota</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> sig, <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> n) <a name="l00848"></a>00848 { <a name="l00849"></a>00849 <span class="keywordtype">int</span> size; <a name="l00850"></a>00850 <span class="keywordflow">if</span> (!<a class="code" href="signals_8cpp.html#a75cc925deac1e031e75ae72271dd5995">isSigInt</a>(n, &size)) { fprintf(stderr, <span class="stringliteral">"error in generateIota\n"</span>); exit(1); } <a name="l00851"></a>00851 <a name="l00852"></a>00852 <span class="keywordtype">string</span> vperm = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"iota"</span>); <a name="l00853"></a>00853 <a name="l00854"></a>00854 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"int \t$0;"</span>, vperm)); <a name="l00855"></a>00855 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = 0;"</span>, vperm)); <a name="l00856"></a>00856 <a name="l00857"></a>00857 <span class="keywordflow">if</span> (<a class="code" href="compile__scal_8cpp.html#a322b15c6cf72d06559fee6dfb4c0dfae">isPowerOf2</a>(size)) { <a name="l00858"></a>00858 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 = ($0+1)&$1;"</span>, vperm, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(size-1))); <a name="l00859"></a>00859 } <span class="keywordflow">else</span> { <a name="l00860"></a>00860 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"if (++$0 == $1) $0=0;"</span>, vperm, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(size))); <a name="l00861"></a>00861 } <a name="l00862"></a>00862 <span class="keywordflow">return</span> vperm; <a name="l00863"></a>00863 } <a name="l00864"></a>00864 <a name="l00865"></a>00865 <a name="l00866"></a>00866 <a name="l00867"></a>00867 <span class="comment">// a revoir en utilisant la lecture de table et en partageant la construction de la paire de valeurs</span> <a name="l00868"></a>00868 <a name="l00869"></a>00869 <a name="l00874"></a><a class="code" href="classScalarCompiler.html#a2e070a0f894bf348049b111b094f8a3e">00874</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a2e070a0f894bf348049b111b094f8a3e" title="Generate a select2 code.">ScalarCompiler::generateSelect2</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> sig, <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> sel, <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> s1, <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> s2) <a name="l00875"></a>00875 { <a name="l00876"></a>00876 <a class="code" href="classP.html">Type</a> t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig); <a name="l00877"></a>00877 <a class="code" href="classP.html">Type</a> t1 = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(s1); <a name="l00878"></a>00878 <a class="code" href="classP.html">Type</a> t2 = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(s2); <a name="l00879"></a>00879 <a class="code" href="classP.html">Type</a> w = <a class="code" href="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</a>(t1,t2); <a name="l00880"></a>00880 <a name="l00881"></a>00881 <span class="keywordtype">string</span> type = <a class="code" href="sigtype_8cpp.html#a1add1ece6baaeac60b4e46978f5955f4">cType</a>(t); <a name="l00882"></a>00882 <span class="keywordtype">string</span> var = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"S"</span>); <a name="l00883"></a>00883 <a name="l00884"></a>00884 <span class="keywordflow">switch</span> (w->variability()) <a name="l00885"></a>00885 { <a name="l00886"></a>00886 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00887"></a>00887 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[2];"</span>, type, var)); <a name="l00888"></a>00888 <span class="keywordflow">break</span>; <a name="l00889"></a>00889 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00890"></a>00890 <span class="comment">//fClass->addLocalDecl(type, subst("$0[2]", var));</span> <a name="l00891"></a>00891 <span class="comment">//fClass->addLocalVecDecl(type, var, 2);</span> <a name="l00892"></a>00892 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9cbf32b697f222569fa953a740c0eb4c">addSharedDecl</a>(var); <a name="l00893"></a>00893 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0e346099132df472ff00fc44c4a02a9a">addZone1</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[2];"</span>, type, var)); <a name="l00894"></a>00894 <span class="keywordflow">break</span>; <a name="l00895"></a>00895 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00896"></a>00896 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[2];"</span>, type, var)); <a name="l00897"></a>00897 <span class="keywordflow">break</span>; <a name="l00898"></a>00898 } <a name="l00899"></a>00899 <a name="l00900"></a>00900 <span class="keywordflow">switch</span> (t1->variability()) <a name="l00901"></a>00901 { <a name="l00902"></a>00902 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00903"></a>00903 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s1))); <a name="l00904"></a>00904 <span class="keywordflow">break</span>; <a name="l00905"></a>00905 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00906"></a>00906 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a48854a29efb08fa5f9eb0e1a23874ee5">addZone2b</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s1))); <a name="l00907"></a>00907 <span class="keywordflow">break</span>; <a name="l00908"></a>00908 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00909"></a>00909 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s1))); <a name="l00910"></a>00910 <span class="keywordflow">break</span>; <a name="l00911"></a>00911 } <a name="l00912"></a>00912 <a name="l00913"></a>00913 <span class="keywordflow">switch</span> (t2->variability()) <a name="l00914"></a>00914 { <a name="l00915"></a>00915 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00916"></a>00916 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[1] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s2))); <a name="l00917"></a>00917 <span class="keywordflow">break</span>; <a name="l00918"></a>00918 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00919"></a>00919 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a48854a29efb08fa5f9eb0e1a23874ee5">addZone2b</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[1] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s2))); <a name="l00920"></a>00920 <span class="keywordflow">break</span>; <a name="l00921"></a>00921 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00922"></a>00922 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[1] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s2))); <a name="l00923"></a>00923 <span class="keywordflow">break</span>; <a name="l00924"></a>00924 } <a name="l00925"></a>00925 <a name="l00926"></a>00926 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[$1]"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(sel))); <a name="l00927"></a>00927 } <a name="l00928"></a>00928 <a name="l00929"></a>00929 <a name="l00933"></a><a class="code" href="classScalarCompiler.html#a0651bbed181dd7f68c53ef94f2bafd1f">00933</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a0651bbed181dd7f68c53ef94f2bafd1f" title="Generate a select3 code.">ScalarCompiler::generateSelect3</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> sig, <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> sel, <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> s1, <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> s2, <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> s3) <a name="l00934"></a>00934 { <a name="l00935"></a>00935 <a class="code" href="classP.html">Type</a> t = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig); <a name="l00936"></a>00936 <a class="code" href="classP.html">Type</a> t1 = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(s1); <a name="l00937"></a>00937 <a class="code" href="classP.html">Type</a> t2 = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(s2); <a name="l00938"></a>00938 <a class="code" href="classP.html">Type</a> t3 = <a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(s3); <a name="l00939"></a>00939 <a class="code" href="classP.html">Type</a> w = <a class="code" href="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</a>(t1,<a class="code" href="interval_8hh.html#a2f8edc4561e9744ed4233b205fa7ec32">min</a>(t2,t3)); <a name="l00940"></a>00940 <a name="l00941"></a>00941 <span class="keywordtype">string</span> type = <a class="code" href="sigtype_8cpp.html#a1add1ece6baaeac60b4e46978f5955f4">cType</a>(t); <a name="l00942"></a>00942 <span class="keywordtype">string</span> var = <a class="code" href="classScalarCompiler.html#ac4c7f408808aeecc65eb069eb55e7aea">getFreshID</a>(<span class="stringliteral">"S"</span>); <a name="l00943"></a>00943 <a name="l00944"></a>00944 <span class="keywordflow">switch</span> (w->variability()) <a name="l00945"></a>00945 { <a name="l00946"></a>00946 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00947"></a>00947 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[3];"</span>, type, var)); <a name="l00948"></a>00948 <span class="keywordflow">break</span>; <a name="l00949"></a>00949 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00950"></a>00950 <span class="comment">//fClass->addLocalDecl(type, subst("$0[3]", var));</span> <a name="l00951"></a>00951 <span class="comment">//fClass->addLocalVecDecl(type, var, 3);</span> <a name="l00952"></a>00952 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9cbf32b697f222569fa953a740c0eb4c">addSharedDecl</a>(var); <a name="l00953"></a>00953 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0e346099132df472ff00fc44c4a02a9a">addZone1</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[3];"</span>, type, var)); <a name="l00954"></a>00954 <span class="keywordflow">break</span>; <a name="l00955"></a>00955 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00956"></a>00956 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[3];"</span>, type, var)); <a name="l00957"></a>00957 <span class="keywordflow">break</span>; <a name="l00958"></a>00958 } <a name="l00959"></a>00959 <a name="l00960"></a>00960 <span class="keywordflow">switch</span> (t1->variability()) <a name="l00961"></a>00961 { <a name="l00962"></a>00962 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00963"></a>00963 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s1))); <a name="l00964"></a>00964 <span class="keywordflow">break</span>; <a name="l00965"></a>00965 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00966"></a>00966 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a48854a29efb08fa5f9eb0e1a23874ee5">addZone2b</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s1))); <a name="l00967"></a>00967 <span class="keywordflow">break</span>; <a name="l00968"></a>00968 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00969"></a>00969 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s1))); <a name="l00970"></a>00970 <span class="keywordflow">break</span>; <a name="l00971"></a>00971 } <a name="l00972"></a>00972 <a name="l00973"></a>00973 <span class="keywordflow">switch</span> (t2->variability()) <a name="l00974"></a>00974 { <a name="l00975"></a>00975 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00976"></a>00976 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[1] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s2))); <a name="l00977"></a>00977 <span class="keywordflow">break</span>; <a name="l00978"></a>00978 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00979"></a>00979 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a48854a29efb08fa5f9eb0e1a23874ee5">addZone2b</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[1] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s2))); <a name="l00980"></a>00980 <span class="keywordflow">break</span>; <a name="l00981"></a>00981 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00982"></a>00982 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[1] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s2))); <a name="l00983"></a>00983 <span class="keywordflow">break</span>; <a name="l00984"></a>00984 } <a name="l00985"></a>00985 <a name="l00986"></a>00986 <span class="keywordflow">switch</span> (t3->variability()) <a name="l00987"></a>00987 { <a name="l00988"></a>00988 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a21138ad5418c2d97ac10a35fd48c0503">kKonst</a> : <a name="l00989"></a>00989 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[2] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s3))); <a name="l00990"></a>00990 <span class="keywordflow">break</span>; <a name="l00991"></a>00991 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a2efe081feb92c3bc30a7ae2dca084901">kBlock</a> : <a name="l00992"></a>00992 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a48854a29efb08fa5f9eb0e1a23874ee5">addZone2b</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[2] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s3))); <a name="l00993"></a>00993 <span class="keywordflow">break</span>; <a name="l00994"></a>00994 <span class="keywordflow">case</span> <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a> : <a name="l00995"></a>00995 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[2] = $1;"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(s3))); <a name="l00996"></a>00996 <span class="keywordflow">break</span>; <a name="l00997"></a>00997 } <a name="l00998"></a>00998 <a name="l00999"></a>00999 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[$1]"</span>, var, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(sel))); <a name="l01000"></a>01000 } <a name="l01001"></a>01001 <a name="l01002"></a>01002 <a name="l01007"></a><a class="code" href="classScalarCompiler.html#ad3aa914094a53cc9451e2526c37ddfe3">01007</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#ad3aa914094a53cc9451e2526c37ddfe3" title="retrieve the type annotation of sig">ScalarCompiler::generateXtended</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> sig) <a name="l01008"></a>01008 { <a name="l01009"></a>01009 <a class="code" href="classxtended.html">xtended</a>* p = (<a class="code" href="classxtended.html">xtended</a>*) <a class="code" href="symbol_8hh.html#a603fcb6c07eacf2688c2a8470637d0ff" title="Returns user data.">getUserData</a>(sig); <a name="l01010"></a>01010 vector<string> args; <a name="l01011"></a>01011 vector<Type> types; <a name="l01012"></a>01012 <a name="l01013"></a>01013 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i=0; i<sig-><a class="code" href="classCTree.html#a68f2be5e845407bc956a2893fe6f0d03" title="return the number of branches (subtrees) of a tree">arity</a>(); i++) { <a name="l01014"></a>01014 args.push_back(<a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(sig-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(i))); <a name="l01015"></a>01015 types.push_back(<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig-><a class="code" href="classCTree.html#a06c1513b23dc7b0d9da9c930c6dc43c5" title="return the ith branch (subtree) of a tree">branch</a>(i))); <a name="l01016"></a>01016 } <a name="l01017"></a>01017 <a name="l01018"></a>01018 <span class="keywordflow">if</span> (p-><a class="code" href="classxtended.html#adf5e69b249396b41bf4d4d2a842a279b">needCache</a>()) { <a name="l01019"></a>01019 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, p-><a class="code" href="classxtended.html#a859e32300d9ac541e961c222896ea3f9">generateCode</a>(<a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>, args, types)); <a name="l01020"></a>01020 } <span class="keywordflow">else</span> { <a name="l01021"></a>01021 <span class="keywordflow">return</span> p-><a class="code" href="classxtended.html#a859e32300d9ac541e961c222896ea3f9">generateCode</a>(<a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>, args, types); <a name="l01022"></a>01022 } <a name="l01023"></a>01023 } <a name="l01024"></a>01024 <a name="l01025"></a>01025 <a name="l01026"></a>01026 <a name="l01027"></a>01027 <span class="comment">//------------------------------------------------------------------------------------------------</span> <a name="l01028"></a>01028 <a name="l01029"></a>01029 <a name="l01030"></a>01030 <span class="comment">/*****************************************************************************</span> <a name="l01031"></a>01031 <span class="comment"> vector name property</span> <a name="l01032"></a>01032 <span class="comment">*****************************************************************************/</span> <a name="l01033"></a>01033 <a name="l01041"></a><a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7">01041</a> <span class="keywordtype">void</span> <a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7" title="Set the vector name property of a signal, the name of the vector used to store the...">ScalarCompiler::setVectorNameProperty</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& vecname) <a name="l01042"></a>01042 { <a name="l01043"></a>01043 <a class="code" href="classScalarCompiler.html#a6ce8c9b467aee733e29260c7f6f889f7">fVectorProperty</a>.set(sig, vecname); <a name="l01044"></a>01044 } <a name="l01045"></a>01045 <a name="l01046"></a>01046 <a name="l01055"></a><a class="code" href="classScalarCompiler.html#a12cd9487cf729b06cbece49552bc632e">01055</a> <span class="keywordtype">bool</span> <a class="code" href="classScalarCompiler.html#a12cd9487cf729b06cbece49552bc632e" title="Get the vector name property of a signal, the name of the vector used to store the...">ScalarCompiler::getVectorNameProperty</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> sig, <span class="keywordtype">string</span>& vecname) <a name="l01056"></a>01056 { <a name="l01057"></a>01057 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a6ce8c9b467aee733e29260c7f6f889f7">fVectorProperty</a>.get(sig, vecname); <a name="l01058"></a>01058 } <a name="l01059"></a>01059 <a name="l01060"></a>01060 <a name="l01065"></a><a class="code" href="classScalarCompiler.html#ad2a7768ff9ad2157f15a11686fe70366">01065</a> <span class="keywordtype">int</span> <a class="code" href="classScalarCompiler.html#ad2a7768ff9ad2157f15a11686fe70366" title="Compute the minimal power of 2 greater than x.">ScalarCompiler::pow2limit</a>(<span class="keywordtype">int</span> x) <a name="l01066"></a>01066 { <a name="l01067"></a>01067 <span class="keywordtype">int</span> n = 2; <a name="l01068"></a>01068 <span class="keywordflow">while</span> (n < x) { n = 2*n; } <a name="l01069"></a>01069 <span class="keywordflow">return</span> n; <a name="l01070"></a>01070 } <a name="l01071"></a>01071 <a name="l01072"></a>01072 <span class="comment">/*****************************************************************************</span> <a name="l01073"></a>01073 <span class="comment"> N-SAMPLE FIXED DELAY : sig = exp@delay</span> <a name="l01074"></a>01074 <span class="comment"></span> <a name="l01075"></a>01075 <span class="comment"> case 1-sample max delay :</span> <a name="l01076"></a>01076 <span class="comment"> Y(t-0) Y(t-1)</span> <a name="l01077"></a>01077 <span class="comment"> Temp Var gLessTempSwitch = false</span> <a name="l01078"></a>01078 <span class="comment"> V[0] V[1] gLessTempSwitch = true</span> <a name="l01079"></a>01079 <span class="comment"></span> <a name="l01080"></a>01080 <span class="comment"> case max delay < gMaxCopyDelay :</span> <a name="l01081"></a>01081 <span class="comment"> Y(t-0) Y(t-1) Y(t-2) ...</span> <a name="l01082"></a>01082 <span class="comment"> Temp V[0] V[1] ... gLessTempSwitch = false</span> <a name="l01083"></a>01083 <span class="comment"> V[0] V[1] V[2] ... gLessTempSwitch = true</span> <a name="l01084"></a>01084 <span class="comment"></span> <a name="l01085"></a>01085 <span class="comment"> case max delay >= gMaxCopyDelay :</span> <a name="l01086"></a>01086 <span class="comment"> Y(t-0) Y(t-1) Y(t-2) ...</span> <a name="l01087"></a>01087 <span class="comment"> Temp V[0] V[1] ...</span> <a name="l01088"></a>01088 <span class="comment"> V[0] V[1] V[2] ...</span> <a name="l01089"></a>01089 <span class="comment"></span> <a name="l01090"></a>01090 <span class="comment"></span> <a name="l01091"></a>01091 <span class="comment">*****************************************************************************/</span> <a name="l01092"></a>01092 <a name="l01098"></a><a class="code" href="classScalarCompiler.html#a114a804894cbeb775c205de2410fb5a9">01098</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a114a804894cbeb775c205de2410fb5a9" title="Generate code for accessing a delayed signal.">ScalarCompiler::generateFixDelay</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> sig, <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> exp, <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> delay) <a name="l01099"></a>01099 { <a name="l01100"></a>01100 <span class="keywordtype">int</span> mxd, d; <a name="l01101"></a>01101 <span class="keywordtype">string</span> vecname; <a name="l01102"></a>01102 <a name="l01103"></a>01103 <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(exp); <span class="comment">// ensure exp is compiled to have a vector name</span> <a name="l01104"></a>01104 <a name="l01105"></a>01105 mxd = <a class="code" href="classScalarCompiler.html#a01d66ece3660a3151f270d7e7a79cb77">fOccMarkup</a>.<a class="code" href="classOccMarkup.html#ade9cb60264fd5e727cfb69568cb49efa" title="occurences of subtree t within root tree">retrieve</a>(exp)-><a class="code" href="classOccurences.html#ae7a8f070a5ad9597882c9e813b801cd7" title="return the maximal delay collected">getMaxDelay</a>(); <a name="l01106"></a>01106 <a name="l01107"></a>01107 <span class="keywordflow">if</span> (! <a class="code" href="classScalarCompiler.html#a12cd9487cf729b06cbece49552bc632e" title="Get the vector name property of a signal, the name of the vector used to store the...">getVectorNameProperty</a>(exp, vecname)) { <a name="l01108"></a>01108 cerr << <span class="stringliteral">"No vector name for : "</span> << <a class="code" href="classppsig.html">ppsig</a>(exp) << endl; <a name="l01109"></a>01109 assert(0); <a name="l01110"></a>01110 } <a name="l01111"></a>01111 <a name="l01112"></a>01112 <span class="keywordflow">if</span> (mxd == 0) { <a name="l01113"></a>01113 <span class="comment">// not a real vector name but a scalar name</span> <a name="l01114"></a>01114 <span class="keywordflow">return</span> vecname; <a name="l01115"></a>01115 <a name="l01116"></a>01116 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mxd < <a class="code" href="doc__compile_8cpp.html#a278e0cda879c0108aff047853ab0214c">gMaxCopyDelay</a>) { <a name="l01117"></a>01117 <span class="keywordflow">if</span> (<a class="code" href="signals_8cpp.html#a75cc925deac1e031e75ae72271dd5995">isSigInt</a>(delay, &d)) { <a name="l01118"></a>01118 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[$1]"</span>, vecname, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(delay)); <a name="l01119"></a>01119 } <span class="keywordflow">else</span> { <a name="l01120"></a>01120 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[$1]"</span>, vecname, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(delay))); <a name="l01121"></a>01121 } <a name="l01122"></a>01122 <a name="l01123"></a>01123 } <span class="keywordflow">else</span> { <a name="l01124"></a>01124 <a name="l01125"></a>01125 <span class="comment">// long delay : we use a ring buffer of size 2^x</span> <a name="l01126"></a>01126 <span class="keywordtype">int</span> N = <a class="code" href="classScalarCompiler.html#ad2a7768ff9ad2157f15a11686fe70366" title="Compute the minimal power of 2 greater than x.">pow2limit</a>( mxd+1 ); <a name="l01127"></a>01127 <span class="keywordflow">return</span> <a class="code" href="classScalarCompiler.html#a96c58f44c4a1d1ac3bd648b542bd0afa">generateCacheCode</a>(sig, <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[(IOTA-$1)&$2]"</span>, vecname, <a class="code" href="classScalarCompiler.html#aac679ae86346a78d59a4779c9bc5d988" title="Compile a signal.">CS</a>(delay), <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N-1))); <a name="l01128"></a>01128 } <a name="l01129"></a>01129 } <a name="l01130"></a>01130 <a name="l01131"></a>01131 <a name="l01137"></a><a class="code" href="classScalarCompiler.html#adec9012e0c7e1c27b0144e53fcdc4734">01137</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#adec9012e0c7e1c27b0144e53fcdc4734" title="Generate code for the delay mecchanism.">ScalarCompiler::generateDelayVec</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp, <span class="keyword">const</span> <span class="keywordtype">string</span>& ctype, <span class="keyword">const</span> <span class="keywordtype">string</span>& vname, <span class="keywordtype">int</span> mxd) <a name="l01138"></a>01138 { <a name="l01139"></a>01139 <span class="keywordtype">string</span> s = <a class="code" href="classScalarCompiler.html#a98cf35a790700aa70ec4789245359a4b" title="Generate code for the delay mecchanism without using temporary variables.">generateDelayVecNoTemp</a>(sig, exp, ctype, vname, mxd); <a name="l01140"></a>01140 <span class="keywordflow">if</span> (<a class="code" href="sigtyperules_8cpp.html#a1f41188e4150f54b2fb2caf28a948785" title="retrieve the type annotation of sig">getSigType</a>(sig)->variability() < <a class="code" href="sigtype_8hh.html#a726ca809ffd3d67ab4b8476646f26635a415bf3edc164c8f259f328ff6dc0529a">kSamp</a>) { <a name="l01141"></a>01141 <span class="keywordflow">return</span> exp; <a name="l01142"></a>01142 } <span class="keywordflow">else</span> { <a name="l01143"></a>01143 <span class="keywordflow">return</span> s; <a name="l01144"></a>01144 } <a name="l01145"></a>01145 } <a name="l01146"></a>01146 <a name="l01151"></a><a class="code" href="classScalarCompiler.html#a98cf35a790700aa70ec4789245359a4b">01151</a> <span class="keywordtype">string</span> <a class="code" href="classScalarCompiler.html#a98cf35a790700aa70ec4789245359a4b" title="Generate code for the delay mecchanism without using temporary variables.">ScalarCompiler::generateDelayVecNoTemp</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> sig, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp, <span class="keyword">const</span> <span class="keywordtype">string</span>& ctype, <span class="keyword">const</span> <span class="keywordtype">string</span>& vname, <span class="keywordtype">int</span> mxd) <a name="l01152"></a>01152 { <a name="l01153"></a>01153 assert(mxd > 0); <a name="l01154"></a>01154 <a name="l01155"></a>01155 <span class="comment">//bool odocc = fOccMarkup.retrieve(sig)->hasOutDelayOccurences();</span> <a name="l01156"></a>01156 <a name="l01157"></a>01157 <span class="keywordflow">if</span> (mxd < <a class="code" href="doc__compile_8cpp.html#a278e0cda879c0108aff047853ab0214c">gMaxCopyDelay</a>) { <a name="l01158"></a>01158 <a name="l01159"></a>01159 <span class="comment">// short delay : we copy</span> <a name="l01160"></a>01160 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[$2];"</span>, ctype, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(mxd+1))); <a name="l01161"></a>01161 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"for (int i=0; i<$1; i++) $0[i] = 0;"</span>, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(mxd+1))); <a name="l01162"></a>01162 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0] = $1;"</span>, vname, exp)); <a name="l01163"></a>01163 <a name="l01164"></a>01164 <span class="comment">// generate post processing copy code to update delay values</span> <a name="l01165"></a>01165 <span class="keywordflow">if</span> (mxd == 1) { <a name="l01166"></a>01166 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9e4aa8af46e099cdfc0cb2775239620f">addPostCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[1] = $0[0];"</span>, vname)); <a name="l01167"></a>01167 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mxd == 2) { <a name="l01168"></a>01168 <span class="comment">//fClass->addPostCode(subst("$0[2] = $0[1];", vname));</span> <a name="l01169"></a>01169 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9e4aa8af46e099cdfc0cb2775239620f">addPostCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[2] = $0[1]; $0[1] = $0[0];"</span>, vname)); <a name="l01170"></a>01170 } <span class="keywordflow">else</span> { <a name="l01171"></a>01171 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9e4aa8af46e099cdfc0cb2775239620f">addPostCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"for (int i=$0; i>0; i--) $1[i] = $1[i-1];"</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(mxd), vname)); <a name="l01172"></a>01172 } <a name="l01173"></a>01173 <a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7" title="Set the vector name property of a signal, the name of the vector used to store the...">setVectorNameProperty</a>(sig, vname); <a name="l01174"></a>01174 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0]"</span>, vname); <a name="l01175"></a>01175 <a name="l01176"></a>01176 } <span class="keywordflow">else</span> { <a name="l01177"></a>01177 <a name="l01178"></a>01178 <span class="comment">// generate code for a long delay : we use a ring buffer of size N = 2**x > mxd</span> <a name="l01179"></a>01179 <span class="keywordtype">int</span> N = <a class="code" href="classScalarCompiler.html#ad2a7768ff9ad2157f15a11686fe70366" title="Compute the minimal power of 2 greater than x.">pow2limit</a>(mxd+1); <a name="l01180"></a>01180 <a name="l01181"></a>01181 <span class="comment">// we need a iota index</span> <a name="l01182"></a>01182 <a class="code" href="classScalarCompiler.html#a4a74bd8a23a1ce8bc21d13eeb20ba821" title="Generate code for a unique IOTA variable increased at each sample and used to index...">ensureIotaCode</a>(); <a name="l01183"></a>01183 <a name="l01184"></a>01184 <span class="comment">// declare and init</span> <a name="l01185"></a>01185 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[$2];"</span>, ctype, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N))); <a name="l01186"></a>01186 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"for (int i=0; i<$1; i++) $0[i] = 0;"</span>, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N))); <a name="l01187"></a>01187 <a name="l01188"></a>01188 <span class="comment">// execute</span> <a name="l01189"></a>01189 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[IOTA&$1] = $2;"</span>, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N-1), exp)); <a name="l01190"></a>01190 <a class="code" href="classScalarCompiler.html#a81c64ccef445fdf557fc7b3ce6a786a7" title="Set the vector name property of a signal, the name of the vector used to store the...">setVectorNameProperty</a>(sig, vname); <a name="l01191"></a>01191 <span class="keywordflow">return</span> <a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[IOTA&$1]"</span>, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N-1)); <a name="l01192"></a>01192 } <a name="l01193"></a>01193 } <a name="l01194"></a>01194 <a name="l01199"></a><a class="code" href="classScalarCompiler.html#a0fee342e1ab991f0f75169290afe36cd">01199</a> <span class="keywordtype">void</span> <a class="code" href="classScalarCompiler.html#a0fee342e1ab991f0f75169290afe36cd" title="Generate code for the delay mecchanism without using temporary variables.">ScalarCompiler::generateDelayLine</a>(<span class="keyword">const</span> <span class="keywordtype">string</span>& ctype, <span class="keyword">const</span> <span class="keywordtype">string</span>& vname, <span class="keywordtype">int</span> mxd, <span class="keyword">const</span> <span class="keywordtype">string</span>& exp) <a name="l01200"></a>01200 { <a name="l01201"></a>01201 <span class="comment">//assert(mxd > 0);</span> <a name="l01202"></a>01202 <span class="keywordflow">if</span> (mxd == 0) { <a name="l01203"></a>01203 <span class="comment">// cerr << "MXD==0 : " << vname << " := " << exp << endl;</span> <a name="l01204"></a>01204 <span class="comment">// no need for a real vector</span> <a name="l01205"></a>01205 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1 = $2;"</span>, ctype, vname, exp)); <a name="l01206"></a>01206 <a name="l01207"></a>01207 <a name="l01208"></a>01208 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mxd < <a class="code" href="doc__compile_8cpp.html#a278e0cda879c0108aff047853ab0214c">gMaxCopyDelay</a>) { <a name="l01209"></a>01209 <a name="l01210"></a>01210 <span class="comment">// short delay : we copy</span> <a name="l01211"></a>01211 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[$2];"</span>, ctype, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(mxd+1))); <a name="l01212"></a>01212 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"for (int i=0; i<$1; i++) $0[i] = 0;"</span>, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(mxd+1))); <a name="l01213"></a>01213 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[0] = $1;"</span>, vname, exp)); <a name="l01214"></a>01214 <a name="l01215"></a>01215 <span class="comment">// generate post processing copy code to update delay values</span> <a name="l01216"></a>01216 <span class="keywordflow">if</span> (mxd == 1) { <a name="l01217"></a>01217 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9e4aa8af46e099cdfc0cb2775239620f">addPostCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[1] = $0[0];"</span>, vname)); <a name="l01218"></a>01218 } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (mxd == 2) { <a name="l01219"></a>01219 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9e4aa8af46e099cdfc0cb2775239620f">addPostCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[2] = $0[1]; $0[1] = $0[0];"</span>, vname)); <a name="l01220"></a>01220 } <span class="keywordflow">else</span> { <a name="l01221"></a>01221 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9e4aa8af46e099cdfc0cb2775239620f">addPostCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"for (int i=$0; i>0; i--) $1[i] = $1[i-1];"</span>, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(mxd), vname)); <a name="l01222"></a>01222 } <a name="l01223"></a>01223 <a name="l01224"></a>01224 } <span class="keywordflow">else</span> { <a name="l01225"></a>01225 <a name="l01226"></a>01226 <span class="comment">// generate code for a long delay : we use a ring buffer of size N = 2**x > mxd</span> <a name="l01227"></a>01227 <span class="keywordtype">int</span> N = <a class="code" href="classScalarCompiler.html#ad2a7768ff9ad2157f15a11686fe70366" title="Compute the minimal power of 2 greater than x.">pow2limit</a>(mxd+1); <a name="l01228"></a>01228 <a name="l01229"></a>01229 <span class="comment">// we need a iota index</span> <a name="l01230"></a>01230 <a class="code" href="classScalarCompiler.html#a4a74bd8a23a1ce8bc21d13eeb20ba821" title="Generate code for a unique IOTA variable increased at each sample and used to index...">ensureIotaCode</a>(); <a name="l01231"></a>01231 <a name="l01232"></a>01232 <span class="comment">// declare and init</span> <a name="l01233"></a>01233 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0 \t$1[$2];"</span>, ctype, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N))); <a name="l01234"></a>01234 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"for (int i=0; i<$1; i++) $0[i] = 0;"</span>, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N))); <a name="l01235"></a>01235 <a name="l01236"></a>01236 <span class="comment">// execute</span> <a name="l01237"></a>01237 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#afb18d2c8b90b89695d866dfa4d4ff52e">addExecCode</a>(<a class="code" href="Text_8cpp.html#af50e951c134c2c98c4c75d687f8fca7a">subst</a>(<span class="stringliteral">"$0[IOTA&$1] = $2;"</span>, vname, <a class="code" href="Text_8cpp.html#a16bacb907294be37af81cdf9aff4449a">T</a>(N-1), exp)); <a name="l01238"></a>01238 } <a name="l01239"></a>01239 } <a name="l01240"></a>01240 <a name="l01245"></a><a class="code" href="classScalarCompiler.html#a4a74bd8a23a1ce8bc21d13eeb20ba821">01245</a> <span class="keywordtype">void</span> <a class="code" href="classScalarCompiler.html#a4a74bd8a23a1ce8bc21d13eeb20ba821" title="Generate code for a unique IOTA variable increased at each sample and used to index...">ScalarCompiler::ensureIotaCode</a>() <a name="l01246"></a>01246 { <a name="l01247"></a>01247 <span class="keywordflow">if</span> (!<a class="code" href="classScalarCompiler.html#af31cb95a6eca2df4a03bcb59f80d095b">fHasIota</a>) { <a name="l01248"></a>01248 <a class="code" href="classScalarCompiler.html#af31cb95a6eca2df4a03bcb59f80d095b">fHasIota</a> = <span class="keyword">true</span>; <a name="l01249"></a>01249 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#acb05aee5dfd9fbc3f14215292bb2c18e">addDeclCode</a>(<span class="stringliteral">"int \tIOTA;"</span>); <a name="l01250"></a>01250 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a0a95cda1c8e5e601dd67b80573105af3">addInitCode</a>(<span class="stringliteral">"IOTA = 0;"</span>); <a name="l01251"></a>01251 <a class="code" href="classCompiler.html#abd99a780b9c082000158f15f20439a20">fClass</a>-><a class="code" href="classKlass.html#a9e4aa8af46e099cdfc0cb2775239620f">addPostCode</a>(<span class="stringliteral">"IOTA = IOTA+1;"</span>); <a name="l01252"></a>01252 } <a name="l01253"></a>01253 } </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 <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address> </body> </html>