Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > updates > by-pkgid > ffa1e6f5ad04360808fe8840fe3ba036 > files > 76

vrq-devel-1.0.88-1.fc14.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<title>vrq: /net/fileserver/nas/home/mdh/vrq/src/cfref.h Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
  <table border="0" cellspacing="0" cellpadding="0" width="100%">
   <tr>
    <td width="180"><a href="index.html"><img src="vrq.png" width="150" height="100" border="0" alt="vrq"></a></td>
    <td background="top_bg.png" align="right" width="100%">
      <img src="glyth.png" width="500" height="100" border="0" alt="">
    </td>
   </tr>
   <tr>
    <td background="#FFFFFF" align="right" width="50" height="4"></td>
   </tr>
  </table>
</head><body>
<!-- Generated by Doxygen 1.5.5 -->
<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="modules.html"><span>Modules</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>
<h1>/net/fileserver/nas/home/mdh/vrq/src/cfref.h</h1><a href="cfref_8h.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"> * Copyright (C) 1997-2007, Mark Hummel</span>
<a name="l00003"></a>00003 <span class="comment"> * This file is part of Vrq.</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * Vrq is free software; you can redistribute it and/or</span>
<a name="l00006"></a>00006 <span class="comment"> * modify it under the terms of the GNU General Public</span>
<a name="l00007"></a>00007 <span class="comment"> * License as published by the Free Software Foundation; either</span>
<a name="l00008"></a>00008 <span class="comment"> * version 2 of the License, or (at your option) any later version.</span>
<a name="l00009"></a>00009 <span class="comment"> *</span>
<a name="l00010"></a>00010 <span class="comment"> * Vrq is distributed in the hope that it will be useful,</span>
<a name="l00011"></a>00011 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00012"></a>00012 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU</span>
<a name="l00013"></a>00013 <span class="comment"> * General Public License for more details.</span>
<a name="l00014"></a>00014 <span class="comment"> *</span>
<a name="l00015"></a>00015 <span class="comment"> * You should have received a copy of the GNU General Public</span>
<a name="l00016"></a>00016 <span class="comment"> * License along with this library; if not, write to the Free Software</span>
<a name="l00017"></a>00017 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, </span>
<a name="l00018"></a>00018 <span class="comment"> * Boston, MA  02110-1301  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 <span class="comment">/******************************************************************************</span>
<a name="l00022"></a>00022 <span class="comment"> *</span>
<a name="l00023"></a>00023 <span class="comment"> *</span>
<a name="l00024"></a>00024 <span class="comment"> *         cfref.hpp</span>
<a name="l00025"></a>00025 <span class="comment"> *              - class definition of forward reference </span>
<a name="l00026"></a>00026 <span class="comment"> *                definition nodes</span>
<a name="l00027"></a>00027 <span class="comment"> *</span>
<a name="l00028"></a>00028 <span class="comment"> ******************************************************************************</span>
<a name="l00029"></a>00029 <span class="comment"> */</span>
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="preprocessor">#ifndef CFREF_HPP</span>
<a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define CFREF_HPP</span>
<a name="l00033"></a>00033 <span class="preprocessor"></span>
<a name="l00034"></a>00034 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00035"></a>00035 <span class="preprocessor">#include &lt;set&gt;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &lt;list&gt;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include "<a class="code" href="glue_8h.html">glue.h</a>"</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include "<a class="code" href="cnode_8h.html">cnode.h</a>"</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include "<a class="code" href="cdecl_8h.html">cdecl.h</a>"</span>
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 
<a name="l00043"></a>00043 <span class="keyword">class </span><a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>;
<a name="l00044"></a>00044 
<a name="l00051"></a><a class="code" href="classCFref.html">00051</a> <span class="keyword">class </span><a class="code" href="classCFref.html" title="Forward reference declaration.">CFref</a> : <span class="keyword">public</span> <a class="code" href="classCDecl.html" title="Base class for describing declaration objects.">CDecl</a>
<a name="l00052"></a>00052 {
<a name="l00053"></a>00053 <span class="keyword">private</span>:
<a name="l00054"></a>00054         <a class="code" href="classCDecl.html" title="Base class for describing declaration objects.">CDecl</a>*      decl;             
<a name="l00055"></a>00055         <a class="code" href="cdecl_8h.html#2079c5562904beb3c6648c13117153a0" title="Declaration types.">Decl_t</a>      direction;        
<a name="l00056"></a>00056         <span class="keywordtype">int</span>         constrained;      
<a name="l00057"></a>00057         set&lt;Decl_t&gt; typeConstraints;  
<a name="l00058"></a>00058         <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*      msb;              
<a name="l00059"></a>00059         <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*      lsb;              
<a name="l00060"></a>00060         <span class="keywordtype">int</span>         lval;             
<a name="l00061"></a>00061 
<a name="l00062"></a>00062         <span class="keywordtype">int</span>         isArray;          
<a name="l00063"></a>00063         <span class="keywordtype">int</span>         lsbVolatile;      
<a name="l00064"></a>00064         <span class="keywordtype">int</span>         msbVolatile;      
<a name="l00065"></a>00065         <span class="keywordtype">int</span>         lsbConstant;      
<a name="l00066"></a>00066         <span class="keywordtype">int</span>         msbConstant;      
<a name="l00067"></a>00067         <span class="keywordtype">int</span>         isInconsistant;   
<a name="l00068"></a>00068 
<a name="l00069"></a>00069         <span class="keywordtype">int</span>         currentDirection; 
<a name="l00070"></a>00070 
<a name="l00071"></a>00071         <span class="keywordtype">int</span>         refCount;         
<a name="l00072"></a>00072 <span class="keyword">public</span>:
<a name="l00078"></a>00078         <a class="code" href="classCFref.html#b1717c71fa161d2a9f33846651e274fe" title="Create a forward reference.">CFref</a>( <a class="code" href="classCSymbol.html" title="Holder for character strings.">CSymbol</a>* symbol, <a class="code" href="structCoord__t.html" title="Structure to hold file coordinates.">Coord_t</a>* aLoc );
<a name="l00083"></a>00083         <span class="keywordtype">void</span> <a class="code" href="classCFref.html#334567cdaa476c2f94fd6be81ace6495" title="Set forward declaration&amp;#39;s actual declaration.">SetDecl</a>( <a class="code" href="classCDecl.html" title="Base class for describing declaration objects.">CDecl</a>* aDecl );
<a name="l00088"></a>00088         <a class="code" href="classCDecl.html" title="Base class for describing declaration objects.">CDecl</a>* <a class="code" href="classCFref.html#750fbb10834851d2945e1d76840c1906" title="Get forward reference&amp;#39;s actual declaration.">GetDecl</a>( <span class="keywordtype">void</span> );
<a name="l00094"></a>00094         <span class="keywordtype">void</span>    <a class="code" href="classCFref.html#22835da38d41e7e38cbd74b573538ee4" title="Set range info for declaration.">SetRangeInfo</a>( <span class="keywordtype">int</span> isArray, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* range );
<a name="l00099"></a>00099         <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*  <a class="code" href="classCFref.html#1c8968945fc45fee2e6995ae3f05621a" title="Get msb of vector range.">GetMsb</a>( <span class="keywordtype">void</span> );
<a name="l00104"></a>00104         <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*  <a class="code" href="classCFref.html#caaea868bc33b35aade7e2528bb84af0" title="Get lsb of vector range.">GetLsb</a>( <span class="keywordtype">void</span> );
<a name="l00109"></a>00109         <span class="keyword">virtual</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="classCFref.html#134a47825719a0175ce11ef0d65b220d" title="Get expression for declaration&amp;#39;s range (msb/lsb).">GetRange</a>();
<a name="l00114"></a><a class="code" href="classCFref.html#9c996cda0d9e5921d74dd2fd35b9129a">00114</a>         <a class="code" href="cdecl_8h.html#2079c5562904beb3c6648c13117153a0" title="Declaration types.">Decl_t</a> <a class="code" href="classCFref.html#9c996cda0d9e5921d74dd2fd35b9129a" title="Get direction of declaration.">Direction</a>() { <span class="keywordflow">return</span> direction; }
<a name="l00119"></a><a class="code" href="classCFref.html#4f2d28d61f8c17ce145b63a5c7314e78">00119</a>         <span class="keywordtype">void</span>  <a class="code" href="classCFref.html#9c996cda0d9e5921d74dd2fd35b9129a" title="Get direction of declaration.">Direction</a>( <a class="code" href="cdecl_8h.html#2079c5562904beb3c6648c13117153a0" title="Declaration types.">Decl_t</a> d ) { direction = d; }
<a name="l00124"></a><a class="code" href="classCFref.html#c9213bc88315ad6ae7a7b537e7da1bd0">00124</a>         <span class="keywordtype">void</span>    <a class="code" href="classCFref.html#7476be9d38887a113f0c81189e466b8c" title="Get lval flag.">Lval</a>( <span class="keywordtype">int</span> aLval ) { lval = aLval; }
<a name="l00129"></a><a class="code" href="classCFref.html#7476be9d38887a113f0c81189e466b8c">00129</a>         <span class="keywordtype">int</span>     <a class="code" href="classCFref.html#7476be9d38887a113f0c81189e466b8c" title="Get lval flag.">Lval</a>() { <span class="keywordflow">return</span> lval; }
<a name="l00134"></a><a class="code" href="classCFref.html#a89f087c18e51e18dc8cb66749d3233b">00134</a>         <span class="keywordtype">void</span>    <a class="code" href="classCFref.html#2e90a6cfc997bd3217d1133bd0881b6c" title="Get array flag.">IsArray</a>( <span class="keywordtype">int</span> v ) { isArray = v; }
<a name="l00139"></a><a class="code" href="classCFref.html#2e90a6cfc997bd3217d1133bd0881b6c">00139</a>         <span class="keywordtype">int</span>     <a class="code" href="classCFref.html#2e90a6cfc997bd3217d1133bd0881b6c" title="Get array flag.">IsArray</a>() { <span class="keywordflow">return</span> isArray; }
<a name="l00144"></a>00144         <span class="keywordtype">int</span>     <a class="code" href="classCFref.html#7677b4b9fbbbbc28b7e344c9a6b8e19a" title="Determine if range can be inferred.">IndicesRangeValid</a>();
<a name="l00150"></a><a class="code" href="classCFref.html#8b46f7dff604f229360492841ae4dccd">00150</a>         <span class="keywordtype">void</span>   <a class="code" href="classCFref.html#8b46f7dff604f229360492841ae4dccd" title="Add a constraint on valid types for this declaration.">ConstrainTypes</a>( list&lt;Decl_t&gt;&amp; aTypes ) {
<a name="l00151"></a>00151             list&lt;Decl_t&gt; types(aTypes);
<a name="l00152"></a>00152             
<a name="l00153"></a>00153             list&lt;Decl_t&gt;::iterator ptr;
<a name="l00154"></a>00154             <span class="keywordflow">for</span>( ptr = aTypes.begin(); ptr != aTypes.end(); ++ptr ) {
<a name="l00155"></a>00155                 <a class="code" href="classCDecl.html#be5ac882f4cbc497a37e0f4f52b6b0ec" title="Get a list of members of the given declaration class/type.">CDecl::GetMembers</a>( *ptr, types );
<a name="l00156"></a>00156             }
<a name="l00157"></a>00157             <span class="keywordflow">if</span>( typeConstraints.size() == 0 ) {
<a name="l00158"></a>00158                 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( !constrained );
<a name="l00159"></a>00159                 set_union( types.begin(), types.end(),
<a name="l00160"></a>00160                             typeConstraints.begin(), typeConstraints.end(),
<a name="l00161"></a>00161                             inserter( typeConstraints, 
<a name="l00162"></a>00162                                       typeConstraints.begin() ) );
<a name="l00163"></a>00163             } <span class="keywordflow">else</span> {
<a name="l00164"></a>00164                 set_intersection( types.begin(), types.end(),
<a name="l00165"></a>00165                             typeConstraints.begin(), typeConstraints.end(),
<a name="l00166"></a>00166                             inserter( typeConstraints, 
<a name="l00167"></a>00167                                       typeConstraints.begin() ) );
<a name="l00168"></a>00168             }
<a name="l00169"></a>00169             constrained = TRUE;
<a name="l00170"></a>00170         } 
<a name="l00176"></a><a class="code" href="classCFref.html#7ad3519d63756731949b1ff907acaebb">00176</a>         <span class="keywordtype">int</span>    <a class="code" href="classCFref.html#7ad3519d63756731949b1ff907acaebb" title="Test if a give declaration type is valid for this reference.">IsTypeValid</a>( <a class="code" href="cdecl_8h.html#2079c5562904beb3c6648c13117153a0" title="Declaration types.">Decl_t</a> t ) {
<a name="l00177"></a>00177                 <span class="keywordflow">if</span>( !constrained ) {
<a name="l00178"></a>00178                         <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( typeConstraints.size() == 0 );
<a name="l00179"></a>00179                         <span class="keywordflow">return</span> TRUE;
<a name="l00180"></a>00180                 }
<a name="l00181"></a>00181                 list&lt;Decl_t&gt; searchList;
<a name="l00182"></a>00182                 <a class="code" href="classCDecl.html#be5ac882f4cbc497a37e0f4f52b6b0ec" title="Get a list of members of the given declaration class/type.">CDecl::GetMembers</a>( t, searchList );
<a name="l00183"></a>00183                 list&lt;Decl_t&gt;::iterator ptr;
<a name="l00184"></a>00184                 <span class="keywordflow">if</span>( typeConstraints.count( t ) != 0 ) {
<a name="l00185"></a>00185                     <span class="keywordflow">return</span> TRUE;
<a name="l00186"></a>00186                 }
<a name="l00187"></a>00187                 <span class="keywordflow">for</span>( ptr = searchList.begin(); 
<a name="l00188"></a>00188                                         ptr != searchList.end(); ++ptr ) {
<a name="l00189"></a>00189                     <span class="keywordflow">if</span>( typeConstraints.count( *ptr ) != 0 ) {
<a name="l00190"></a>00190                         <span class="keywordflow">return</span> TRUE;
<a name="l00191"></a>00191                     }
<a name="l00192"></a>00192                 }
<a name="l00193"></a>00193                 <span class="keywordflow">return</span> FALSE;   
<a name="l00194"></a>00194         }
<a name="l00199"></a>00199         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classCFref.html#e42560b26c97d4db9b0201076f653f49" title="Dump declaration info to file descriptor.">Dump</a>( FILE* f );
<a name="l00200"></a>00200 <span class="keyword">private</span>:
<a name="l00204"></a>00204         <span class="keywordtype">void</span> SetRange( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* ) { <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); }
<a name="l00205"></a>00205 };
<a name="l00206"></a>00206 
<a name="l00207"></a>00207 <span class="preprocessor">#endif // CFREF_HPP</span>
</pre></div></div>
<hr size="1"><address style="text-align: right;"><small>Generated on Wed Oct 21 18:05:33 2009 for vrq by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.5 </small></address>
</body>
</html>