Sophie

Sophie

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

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.7.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul class="tablist">
      <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>
  <div class="tabs2">
    <ul class="tablist">
      <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 class="header">
  <div class="headertitle">
<h1>/net/fileserver/nas/home/mdh/vrq/src/cfref.h</h1>  </div>
</div>
<div class="contents">
<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 &quot;<a class="code" href="glue_8h.html">glue.h</a>&quot;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &quot;<a class="code" href="cnode_8h.html">cnode.h</a>&quot;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &quot;<a class="code" href="cdecl_8h.html">cdecl.h</a>&quot;</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#a2079c5562904beb3c6648c13117153a0" 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#ab1717c71fa161d2a9f33846651e274fe" 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="l00084"></a><a class="code" href="classCFref.html#adf04fc24f49a30d3bc9f7f4cbfaae743">00084</a>         <span class="keyword">virtual</span> <a class="code" href="classCDecl.html" title="Base class for describing declaration objects.">CDecl</a>* <a class="code" href="classCFref.html#adf04fc24f49a30d3bc9f7f4cbfaae743" title="Create a clone of this declaration.">Clone</a>( <a class="code" href="classCObstack.html" title="Bulk object allocation object.">CObstack</a>* heap ) { MASSERT(FALSE); }
<a name="l00089"></a>00089         <span class="keywordtype">void</span> <a class="code" href="classCFref.html#a334567cdaa476c2f94fd6be81ace6495" 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="l00094"></a>00094         <a class="code" href="classCDecl.html" title="Base class for describing declaration objects.">CDecl</a>* <a class="code" href="classCFref.html#a750fbb10834851d2945e1d76840c1906" title="Get forward reference&amp;#39;s actual declaration.">GetDecl</a>( <span class="keywordtype">void</span> );
<a name="l00100"></a>00100         <span class="keywordtype">void</span>    <a class="code" href="classCFref.html#a22835da38d41e7e38cbd74b573538ee4" 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="l00105"></a>00105         <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*  <a class="code" href="classCFref.html#a1c8968945fc45fee2e6995ae3f05621a" title="Get msb of vector range.">GetMsb</a>( <span class="keywordtype">void</span> );
<a name="l00110"></a>00110         <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*  <a class="code" href="classCFref.html#acaaea868bc33b35aade7e2528bb84af0" title="Get lsb of vector range.">GetLsb</a>( <span class="keywordtype">void</span> );
<a name="l00114"></a><a class="code" href="classCFref.html#af77e3cdcd1fa93897a9bdd69a2f50874">00114</a>         <span class="keywordtype">void</span> <a class="code" href="classCFref.html#af77e3cdcd1fa93897a9bdd69a2f50874" title="Disable width inferencing.">DisableWidthInferencing</a>() { isInconsistant = TRUE; } 
<a name="l00120"></a>00120          <span class="keyword">virtual</span> <span class="keywordtype">int</span>  <a class="code" href="classCFref.html#a05113068dffd7ec73231fdbdb2ca4f34" title="Determine if packed width of declaration is constant, ie dependent upon only constants and parameters...">IsWidthConstant</a>( <span class="keywordtype">void</span> );
<a name="l00126"></a>00126          <span class="keyword">virtual</span> <span class="keywordtype">int</span>  <a class="code" href="classCFref.html#ac7a4efe063766f4afdcf0f76fb446f9b" title="Determine if packed width of declaration is volatile, ie depend upon parameters or variables...">IsWidthVolatile</a>( <span class="keywordtype">void</span> );
<a name="l00131"></a>00131         <span class="keyword">virtual</span> <span class="keywordtype">int</span>  <a class="code" href="classCFref.html#a69e765f6dd740de738df00c36aebf14c" title="Determine if packed width of declaration can be evaluated.">IsWidthEvaluateable</a>( <span class="keywordtype">void</span> );
<a name="l00136"></a>00136         <span class="keyword">virtual</span> <a class="code" href="glue_8h.html#a0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> <a class="code" href="classCFref.html#a6a0540f0324d13488bfde6f6961d0a6d" title="Evaluate packed width of declaration.">GetWidth</a>( <span class="keywordtype">void</span> );
<a name="l00141"></a>00141         <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#a134a47825719a0175ce11ef0d65b220d" title="Get expression for declaration&amp;#39;s range (msb/lsb).">GetRange</a>();
<a name="l00146"></a><a class="code" href="classCFref.html#a9c996cda0d9e5921d74dd2fd35b9129a">00146</a>         <a class="code" href="cdecl_8h.html#a2079c5562904beb3c6648c13117153a0" title="Declaration types.">Decl_t</a> <a class="code" href="classCFref.html#a9c996cda0d9e5921d74dd2fd35b9129a" title="Get direction of declaration.">Direction</a>() { <span class="keywordflow">return</span> direction; }
<a name="l00151"></a><a class="code" href="classCFref.html#a4f2d28d61f8c17ce145b63a5c7314e78">00151</a>         <span class="keywordtype">void</span>  <a class="code" href="classCFref.html#a4f2d28d61f8c17ce145b63a5c7314e78" title="Set direction of declaration.">Direction</a>( <a class="code" href="cdecl_8h.html#a2079c5562904beb3c6648c13117153a0" title="Declaration types.">Decl_t</a> d ) { direction = d; }
<a name="l00156"></a><a class="code" href="classCFref.html#ac9213bc88315ad6ae7a7b537e7da1bd0">00156</a>         <span class="keywordtype">void</span>    <a class="code" href="classCFref.html#ac9213bc88315ad6ae7a7b537e7da1bd0" title="Set lval flag.">Lval</a>( <span class="keywordtype">int</span> aLval ) { lval = aLval; }
<a name="l00161"></a><a class="code" href="classCFref.html#a7476be9d38887a113f0c81189e466b8c">00161</a>         <span class="keywordtype">int</span>     <a class="code" href="classCFref.html#a7476be9d38887a113f0c81189e466b8c" title="Get lval flag.">Lval</a>() { <span class="keywordflow">return</span> lval; }
<a name="l00166"></a><a class="code" href="classCFref.html#aa89f087c18e51e18dc8cb66749d3233b">00166</a>         <span class="keywordtype">void</span>    <a class="code" href="classCFref.html#aa89f087c18e51e18dc8cb66749d3233b" title="Set array flag.">IsArray</a>( <span class="keywordtype">int</span> v ) { isArray = v; }
<a name="l00171"></a><a class="code" href="classCFref.html#a2e90a6cfc997bd3217d1133bd0881b6c">00171</a>         <span class="keywordtype">int</span>     <a class="code" href="classCFref.html#a2e90a6cfc997bd3217d1133bd0881b6c" title="Get array flag.">IsArray</a>() { <span class="keywordflow">return</span> isArray; }
<a name="l00176"></a>00176         <span class="keywordtype">int</span>     <a class="code" href="classCFref.html#a7677b4b9fbbbbc28b7e344c9a6b8e19a" title="Determine if range can be inferred.">IndicesRangeValid</a>();
<a name="l00182"></a><a class="code" href="classCFref.html#ad6acebb1ccb01ee0ff422d8dfc6fea6b">00182</a>         <span class="keywordtype">void</span>   <a class="code" href="classCFref.html#ad6acebb1ccb01ee0ff422d8dfc6fea6b" title="Add a constraint on valid types for this declaration.">ConstrainTypes</a>( <span class="keyword">const</span> list&lt;Decl_t&gt;&amp; aTypes ) {
<a name="l00183"></a>00183             list&lt;Decl_t&gt; types(aTypes);
<a name="l00184"></a>00184             
<a name="l00185"></a>00185             list&lt;Decl_t&gt;::const_iterator ptr;
<a name="l00186"></a>00186             <span class="keywordflow">for</span>( ptr = aTypes.begin(); ptr != aTypes.end(); ++ptr ) {
<a name="l00187"></a>00187                 <a class="code" href="classCDecl.html#abe5ac882f4cbc497a37e0f4f52b6b0ec" title="Get a list of members of the given declaration class/type.">CDecl::GetMembers</a>( *ptr, types );
<a name="l00188"></a>00188             }
<a name="l00189"></a>00189             <span class="keywordflow">if</span>( typeConstraints.size() == 0 ) {
<a name="l00190"></a>00190                 MASSERT( !constrained );
<a name="l00191"></a>00191                 set_union( types.begin(), types.end(),
<a name="l00192"></a>00192                             typeConstraints.begin(), typeConstraints.end(),
<a name="l00193"></a>00193                             inserter( typeConstraints, 
<a name="l00194"></a>00194                                       typeConstraints.begin() ) );
<a name="l00195"></a>00195             } <span class="keywordflow">else</span> {
<a name="l00196"></a>00196                 set_intersection( types.begin(), types.end(),
<a name="l00197"></a>00197                             typeConstraints.begin(), typeConstraints.end(),
<a name="l00198"></a>00198                             inserter( typeConstraints, 
<a name="l00199"></a>00199                                       typeConstraints.begin() ) );
<a name="l00200"></a>00200             }
<a name="l00201"></a>00201             constrained = TRUE;
<a name="l00202"></a>00202         } 
<a name="l00208"></a><a class="code" href="classCFref.html#a7ad3519d63756731949b1ff907acaebb">00208</a>         <span class="keywordtype">int</span>    <a class="code" href="classCFref.html#a7ad3519d63756731949b1ff907acaebb" title="Test if a give declaration type is valid for this reference.">IsTypeValid</a>( <a class="code" href="cdecl_8h.html#a2079c5562904beb3c6648c13117153a0" title="Declaration types.">Decl_t</a> t ) {
<a name="l00209"></a>00209                 <span class="keywordflow">if</span>( !constrained ) {
<a name="l00210"></a>00210                         MASSERT( typeConstraints.size() == 0 );
<a name="l00211"></a>00211                         <span class="keywordflow">return</span> TRUE;
<a name="l00212"></a>00212                 }
<a name="l00213"></a>00213                 list&lt;Decl_t&gt; searchList;
<a name="l00214"></a>00214                 <a class="code" href="classCDecl.html#abe5ac882f4cbc497a37e0f4f52b6b0ec" title="Get a list of members of the given declaration class/type.">CDecl::GetMembers</a>( t, searchList );
<a name="l00215"></a>00215                 list&lt;Decl_t&gt;::iterator ptr;
<a name="l00216"></a>00216                 <span class="keywordflow">if</span>( typeConstraints.count( t ) != 0 ) {
<a name="l00217"></a>00217                     <span class="keywordflow">return</span> TRUE;
<a name="l00218"></a>00218                 }
<a name="l00219"></a>00219                 <span class="keywordflow">for</span>( ptr = searchList.begin(); 
<a name="l00220"></a>00220                                         ptr != searchList.end(); ++ptr ) {
<a name="l00221"></a>00221                     <span class="keywordflow">if</span>( typeConstraints.count( *ptr ) != 0 ) {
<a name="l00222"></a>00222                         <span class="keywordflow">return</span> TRUE;
<a name="l00223"></a>00223                     }
<a name="l00224"></a>00224                 }
<a name="l00225"></a>00225                 <span class="keywordflow">return</span> FALSE;   
<a name="l00226"></a>00226         }
<a name="l00231"></a>00231         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classCFref.html#ae42560b26c97d4db9b0201076f653f49" title="Dump declaration info to file descriptor.">Dump</a>( FILE* f );
<a name="l00232"></a>00232 <span class="keyword">private</span>:
<a name="l00236"></a>00236         <span class="keywordtype">void</span> SetRange( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* ) { MASSERT( FALSE ); }
<a name="l00237"></a>00237         <a class="code" href="classCFref.html#ab1717c71fa161d2a9f33846651e274fe" title="Create a forward reference.">CFref</a>( <span class="keyword">const</span> <a class="code" href="classCFref.html" title="Forward reference declaration.">CFref</a>&amp; );
<a name="l00238"></a>00238 };
<a name="l00239"></a>00239 
<a name="l00240"></a>00240 <span class="preprocessor">#endif // CFREF_HPP</span>
</pre></div></div>
</div>
<hr class="footer"/><address class="footer"><small>Generated by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address>
</body>
</html>