Sophie

Sophie

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

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>FAUST compiler: sourcereader.hh File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.3 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>sourcereader.hh File Reference</h1><code>#include &quot;<a class="el" href="boxes_8hh_source.html">boxes.hh</a>&quot;</code><br/>
<code>#include &lt;string&gt;</code><br/>
<code>#include &lt;set&gt;</code><br/>
<code>#include &lt;vector&gt;</code><br/>
<div class="dynheader">
Include dependency graph for sourcereader.hh:</div>
<div class="dynsection">
</div>
<div class="dynheader">
This graph shows which files directly or indirectly include this file:</div>
<div class="dynsection">
</div>

<p><a href="sourcereader_8hh_source.html">Go to the source code of this file.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classSourceReader.html">SourceReader</a></td></tr>
<tr><td colspan="2"><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="sourcereader_8hh.html#ad90fd80d84dccb47005b13106ed15368">formatDefinitions</a> (<a class="el" href="classCTree.html">Tree</a> rldef)</td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Formats a list of raw definitions represented by triplets &lt;name,arglist,body&gt; into abstractions or pattern matching rules when appropriate.  <a href="#ad90fd80d84dccb47005b13106ed15368"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="sourcereader_8hh.html#ae20e569ace063f690a6649fd3583dc17">checkRulelist</a> (<a class="el" href="classCTree.html">Tree</a> lrules)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="sourcereader_8hh.html#acc24bbca610e76ca8b8da1c62c50d449">declareMetadata</a> (<a class="el" href="classCTree.html">Tree</a> key, <a class="el" href="classCTree.html">Tree</a> value)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="sourcereader_8hh.html#a7cd651735195e5651ebee01a3f6e914c">declareDoc</a> (<a class="el" href="classCTree.html">Tree</a> t)</td></tr>
</table>
<hr/><h2>Function Documentation</h2>
<a class="anchor" id="ae20e569ace063f690a6649fd3583dc17"></a><!-- doxytag: member="sourcereader.hh::checkRulelist" ref="ae20e569ace063f690a6649fd3583dc17" args="(Tree lrules)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCTree.html">Tree</a> checkRulelist </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>lrules</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="sourcereader_8cpp_source.html#l00073">73</a> of file <a class="el" href="sourcereader_8cpp_source.html">sourcereader.cpp</a>.</p>

<p>References <a class="el" href="list_8hh_source.html#l00133">hd()</a>, <a class="el" href="list_8hh_source.html#l00137">isNil()</a>, <a class="el" href="list_8cpp_source.html#l00198">len()</a>, <a class="el" href="sourcereader_8cpp_source.html#l00064">printPatternError()</a>, and <a class="el" href="list_8hh_source.html#l00134">tl()</a>.</p>

<p>Referenced by <a class="el" href="faustparser_8cpp_source.html#l01621">yyparse()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00074"></a>00074 {
<a name="l00075"></a>00075     <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> lrules = lr;
<a name="l00076"></a>00076     <span class="keywordflow">if</span> (<a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(lrules)) { cerr &lt;&lt; <span class="stringliteral">&quot;ERROR : a case expression can&#39;t be empty&quot;</span> &lt;&lt; endl; exit(1); }
<a name="l00077"></a>00077     <span class="comment">// first pattern used as a reference</span>
<a name="l00078"></a>00078     <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> lhs1 = <a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(lrules));
<a name="l00079"></a>00079     <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> rhs1 = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(lrules));
<a name="l00080"></a>00080     <span class="keywordtype">int</span> npat = <a class="code" href="list_8cpp.html#a0b58ea1a5d8649e8afb0f70c48776347">len</a>(lhs1); 
<a name="l00081"></a>00081     lrules = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(lrules);
<a name="l00082"></a>00082     <span class="keywordflow">while</span> (! <a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(lrules)) {
<a name="l00083"></a>00083         <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> lhs2 = <a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(lrules));
<a name="l00084"></a>00084         <a class="code" href="classCTree.html" title="A CTree = (Node x [CTree]) is a Node associated with a list of subtrees called branches...">Tree</a> rhs2 = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(lrules));
<a name="l00085"></a>00085         <span class="keywordflow">if</span> (npat != <a class="code" href="list_8cpp.html#a0b58ea1a5d8649e8afb0f70c48776347">len</a>(lhs2)) {
<a name="l00086"></a>00086             <a class="code" href="sourcereader_8cpp.html#aa86500dcc61306ee7f28562d4ee823d0">printPatternError</a>(lhs1,rhs1,lhs2,rhs2);
<a name="l00087"></a>00087             exit(1);
<a name="l00088"></a>00088         }
<a name="l00089"></a>00089         
<a name="l00090"></a>00090         lhs1 = lhs2;
<a name="l00091"></a>00091         rhs1 = rhs2;
<a name="l00092"></a>00092         lrules = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(lrules);
<a name="l00093"></a>00093     }   
<a name="l00094"></a>00094     <span class="keywordflow">return</span> lr;
<a name="l00095"></a>00095 }
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="a7cd651735195e5651ebee01a3f6e914c"></a><!-- doxytag: member="sourcereader.hh::declareDoc" ref="a7cd651735195e5651ebee01a3f6e914c" args="(Tree t)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void declareDoc </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>t</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="sourcereader_8cpp_source.html#l00321">321</a> of file <a class="el" href="sourcereader_8cpp_source.html">sourcereader.cpp</a>.</p>

<p>References <a class="el" href="doc_8cpp_source.html#l00108">gDocVector</a>.</p>

<p>Referenced by <a class="el" href="doc__autodoc_8cpp_source.html#l00058">declareAutoDoc()</a>, and <a class="el" href="faustparser_8cpp_source.html#l01621">yyparse()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00322"></a>00322 {
<a name="l00323"></a>00323     <span class="comment">//gLatexDocSwitch = true;</span>
<a name="l00324"></a>00324     <a class="code" href="doc_8cpp.html#a7c306e8c82617863fda51d2c1158f5ab" title="Contains &amp;lt;mdoc&amp;gt; parsed trees: DOCTXT, DOCEQN, DOCDGM.">gDocVector</a>.push_back(t);
<a name="l00325"></a>00325 }
</pre></div></p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="acc24bbca610e76ca8b8da1c62c50d449"></a><!-- doxytag: member="sourcereader.hh::declareMetadata" ref="acc24bbca610e76ca8b8da1c62c50d449" args="(Tree key, Tree value)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void declareMetadata </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>value</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="sourcereader_8cpp_source.html#l00303">303</a> of file <a class="el" href="sourcereader_8cpp_source.html">sourcereader.cpp</a>.</p>

<p>References <a class="el" href="main_8cpp_source.html#l00100">gMasterDocument</a>, <a class="el" href="main_8cpp_source.html#l00087">gMetaDataSet</a>, <a class="el" href="tree_8hh_source.html#l00173">tree()</a>, <a class="el" href="tree_8cpp_source.html#l00292">tree2str()</a>, and <a class="el" href="errormsg_8cpp_source.html#l00030">yyfilename</a>.</p>

<p>Referenced by <a class="el" href="faustparser_8cpp_source.html#l01621">yyparse()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00304"></a>00304 {
<a name="l00305"></a>00305     <span class="keywordflow">if</span> (<a class="code" href="doc_8cpp.html#a1c0fac9c77fcd7f4e21daf398e9830de">gMasterDocument</a> == <a class="code" href="errormsg_8cpp.html#a9500354f82b09216c6c22f5e11e3ea90">yyfilename</a>) {
<a name="l00306"></a>00306         <span class="comment">// inside master document, no prefix needed to declare metadata</span>
<a name="l00307"></a>00307         <a class="code" href="doc_8cpp.html#aaf647729deae314d35817ccb36f088e4">gMetaDataSet</a>[key].insert(value);
<a name="l00308"></a>00308     } <span class="keywordflow">else</span> {
<a name="l00309"></a>00309         <span class="keywordtype">string</span> fkey(<a class="code" href="errormsg_8cpp.html#a9500354f82b09216c6c22f5e11e3ea90">yyfilename</a>);
<a name="l00310"></a>00310         fkey += <span class="stringliteral">&quot;/&quot;</span>;
<a name="l00311"></a>00311         fkey += <a class="code" href="tree_8cpp.html#ac753d60778175e30a86cba647db017ad" title="if t has a node of type symbol, return its name otherwise error">tree2str</a>(key);
<a name="l00312"></a>00312         <a class="code" href="doc_8cpp.html#aaf647729deae314d35817ccb36f088e4">gMetaDataSet</a>[<a class="code" href="tree_8hh.html#a61c13e9361cfa80bbb3cd6ce60a8f595">tree</a>(fkey.c_str())].insert(value);
<a name="l00313"></a>00313     }
<a name="l00314"></a>00314 }
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
<a class="anchor" id="ad90fd80d84dccb47005b13106ed15368"></a><!-- doxytag: member="sourcereader.hh::formatDefinitions" ref="ad90fd80d84dccb47005b13106ed15368" args="(Tree rldef)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classCTree.html">Tree</a> formatDefinitions </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classCTree.html">Tree</a>&nbsp;</td>
          <td class="paramname"> <em>rldef</em></td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Formats a list of raw definitions represented by triplets &lt;name,arglist,body&gt; into abstractions or pattern matching rules when appropriate. </p>
<dl><dt><b>Parameters:</b></dt><dd>
  <table border="0" cellspacing="2" cellpadding="0">
    <tr><td valign="top"></td><td valign="top"><em>rldef</em>&nbsp;</td><td>list of raw definitions in reverse order </td></tr>
  </table>
  </dd>
</dl>
<dl class="return"><dt><b>Returns:</b></dt><dd>the list of formatted definitions </dd></dl>

<p>Definition at line <a class="el" href="sourcereader_8cpp_source.html#l00146">146</a> of file <a class="el" href="sourcereader_8cpp_source.html">sourcereader.cpp</a>.</p>

<p>References <a class="el" href="list_8hh_source.html#l00124">cons()</a>, <a class="el" href="list_8hh_source.html#l00133">hd()</a>, <a class="el" href="boxes_8cpp_source.html#l00261">isImportFile()</a>, <a class="el" href="list_8hh_source.html#l00137">isNil()</a>, <a class="el" href="sourcereader_8cpp_source.html#l00104">makeDefinition()</a>, <a class="el" href="list_8cpp_source.html#l00116">nil</a>, and <a class="el" href="list_8hh_source.html#l00134">tl()</a>.</p>

<p>Referenced by <a class="el" href="faustparser_8cpp_source.html#l01621">yyparse()</a>.</p>

<p><div class="fragment"><pre class="fragment"><a name="l00147"></a>00147 {
<a name="l00148"></a>00148     map&lt;Tree,list&lt;Tree&gt; &gt; dic;
<a name="l00149"></a>00149     map&lt;Tree,list&lt;Tree&gt; &gt;::iterator p;
<a name="l00150"></a>00150     <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> ldef2 = <a class="code" href="list_8cpp.html#a538b704dd07794b7237108f1917c471e">nil</a>;
<a name="l00151"></a>00151     <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> file;
<a name="l00152"></a>00152     
<a name="l00153"></a>00153     <span class="comment">//cout &lt;&lt; &quot;Format definitions &quot; &lt;&lt; *rldef &lt;&lt; endl;</span>
<a name="l00154"></a>00154     <span class="comment">// collects the definitions in a dictionnary</span>
<a name="l00155"></a>00155     <span class="keywordflow">while</span> (!<a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(rldef)) {
<a name="l00156"></a>00156         <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> def = <a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(rldef);       
<a name="l00157"></a>00157         rldef = <a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(rldef);
<a name="l00158"></a>00158         <span class="keywordflow">if</span> (<a class="code" href="boxes_8cpp.html#a669c5f5ddf58b6f22e1497e24577469b">isImportFile</a>(def, file)) {
<a name="l00159"></a>00159             ldef2 = <a class="code" href="list_8hh.html#ae1ed153946fcfc025009c6d9c9c40bee">cons</a>(def,ldef2);
<a name="l00160"></a>00160         } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (!<a class="code" href="list_8hh.html#a2569c3a07bbbfa55e0afde62de62aeec">isNil</a>(def)) { 
<a name="l00161"></a>00161             <span class="comment">//cout &lt;&lt; &quot; def : &quot; &lt;&lt; *def &lt;&lt; endl; </span>
<a name="l00162"></a>00162             dic[<a class="code" href="list_8hh.html#a067ad6f83087b420a1c44e48e56be389">hd</a>(def)].push_front(<a class="code" href="list_8hh.html#a4075748f5c7156306ec898795313a2e0">tl</a>(def)); 
<a name="l00163"></a>00163         }
<a name="l00164"></a>00164     }
<a name="l00165"></a>00165     
<a name="l00166"></a>00166     <span class="comment">// produce the definitions</span>
<a name="l00167"></a>00167     
<a name="l00168"></a>00168     <span class="keywordflow">for</span> (p=dic.begin(); p!=dic.end(); p++) {
<a name="l00169"></a>00169         ldef2 = <a class="code" href="list_8hh.html#ae1ed153946fcfc025009c6d9c9c40bee">cons</a> (<a class="code" href="list_8hh.html#ae1ed153946fcfc025009c6d9c9c40bee">cons</a>(p-&gt;first, <a class="code" href="sourcereader_8cpp.html#a8a0607da8b9f5fd6028238cce62c4434" title="Transforms a list of variants (arglist.body) into an abstraction or a boxCase.">makeDefinition</a>(p-&gt;second)), ldef2);
<a name="l00170"></a>00170     }
<a name="l00171"></a>00171     
<a name="l00172"></a>00172     <span class="comment">//cout &lt;&lt; &quot;list of definitions : &quot; &lt;&lt; *ldef2 &lt;&lt; endl;</span>
<a name="l00173"></a>00173     <span class="keywordflow">return</span> ldef2;
<a name="l00174"></a>00174         
<a name="l00175"></a>00175 }
</pre></div></p>

<p><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dynsection">
</div>
</p>

<p><div class="dynheader">
Here is the caller graph for this function:</div>
<div class="dynsection">
</div>
</p>

</div>
</div>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Apr 29 00:00:15 2010 for FAUST compiler by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>