<!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/cnode.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 Page</span></a></li> <li><a href="pages.html"><span>Related 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/cnode.h</h1><a href="cnode_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"> * cnode.hpp</span> <a name="l00025"></a>00025 <span class="comment"> * - abstract class for declaration </span> <a name="l00026"></a>00026 <span class="comment"> *</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 CNODE_HPP</span> <a name="l00032"></a>00032 <span class="preprocessor"></span><span class="preprocessor">#define CNODE_HPP</span> <a name="l00033"></a>00033 <span class="preprocessor"></span> <a name="l00034"></a>00034 <span class="preprocessor">#include <stdio.h></span> <a name="l00035"></a>00035 <span class="preprocessor">#include <math.h></span> <a name="l00036"></a>00036 <span class="preprocessor">#include <list></span> <a name="l00037"></a>00037 <span class="preprocessor">#include <set></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="csymbol_8h.html">csymbol.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 <span class="preprocessor">#include "<a class="code" href="cvector_8h.html">cvector.h</a>"</span> <a name="l00042"></a>00042 <span class="preprocessor">#include "<a class="code" href="cobstack_8h.html">cobstack.h</a>"</span> <a name="l00043"></a>00043 <span class="preprocessor">#include "<a class="code" href="cattr_8h.html">cattr.h</a>"</span> <a name="l00044"></a>00044 <a name="l00045"></a>00045 <span class="keyword">class </span><a class="code" href="classCGenvar.html" title="Declaration object for genvars.">CGenvar</a>; <a name="l00046"></a>00046 <span class="keyword">class </span><a class="code" href="classCReal.html" title="Declaration object for real variables.">CReal</a>; <a name="l00047"></a>00047 <span class="keyword">class </span><a class="code" href="classCParam.html" title="Declaration object for parameters.">CParam</a>; <a name="l00048"></a>00048 <span class="keyword">class </span><a class="code" href="classCFref.html" title="Forward reference declaration.">CFref</a>; <a name="l00049"></a>00049 <span class="keyword">class </span><a class="code" href="classCReg.html" title="Declaration object for registers.">CReg</a>; <a name="l00050"></a>00050 <span class="keyword">class </span><a class="code" href="classCNet.html" title="Declaration object for net types:eWIREeTRIeWANDeTRIANDeWOReTRIOReTRI1eTRI0eTRIREGeSUPPLY0eSUPPLY1...">CNet</a>; <a name="l00051"></a>00051 <span class="keyword">class </span><a class="code" href="classCPort.html" title="Declaration object for module/function/task ports.">CPort</a>; <a name="l00052"></a>00052 <span class="keyword">class </span><a class="code" href="classCPortDir.html" title="Declaration object for input/output/inout statements.">CPortDir</a>; <a name="l00053"></a>00053 <span class="keyword">class </span><a class="code" href="classCInstance.html" title="Declaration object for module and gate instances.">CInstance</a>; <a name="l00054"></a>00054 <span class="keyword">class </span><a class="code" href="classCFunction.html" title="Declaration object for functions and tasks.">CFunction</a>; <a name="l00055"></a>00055 <span class="keyword">class </span><a class="code" href="classCModule.html">CModule</a>; <a name="l00056"></a>00056 <span class="keyword">class </span><a class="code" href="classCGate.html" title="Gate declaration object.">CGate</a>; <a name="l00057"></a>00057 <span class="keyword">class </span><a class="code" href="classCEvent.html" title="Event declaration.">CEvent</a>; <a name="l00058"></a>00058 <span class="keyword">class </span><a class="code" href="classCAttr.html" title="Declaration object for holding lists of verilog attributes and their corresponding...">CAttr</a>; <a name="l00059"></a>00059 <span class="keyword">class </span><a class="code" href="classCBlock.html" title="Declaration class for block constructs.">CBlock</a>; <a name="l00060"></a>00060 <span class="keyword">class </span><a class="code" href="classCSpecify.html" title="Declaration object for specify blocks.">CSpecify</a>; <a name="l00061"></a><a class="code" href="cnode_8h.html#f00e3e29d8be8504da4d630b6f2be86a">00061</a> <span class="keyword">class </span><a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>; <a name="l00062"></a>00062 <span class="keyword">typedef</span> <a class="code" href="classCBlock.html" title="Declaration class for block constructs.">CBlock</a> <a class="code" href="classCBlock.html" title="Declaration class for block constructs.">CScope</a>; <a name="l00063"></a>00063 <span class="keyword">inline</span> <span class="keywordtype">char</span>* <a class="code" href="group__utilities.html#gdba73693074d75c740c6a68704ba71f0" title="Convert double to char string allocating storage on given heap.">d2s</a>( <span class="keywordtype">double</span> d, <a class="code" href="classCObstack.html" title="Bulk object allocation object.">CObstack</a>* stack ); <a name="l00064"></a>00064 <a name="l00068"></a><a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc867574">00068</a> <span class="keyword">enum</span> <a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc867574" title="Edge values.">Edge_t</a> { <a name="l00069"></a><a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc86757411cec235bca7f49bfde6478ff2ce43be">00069</a> <a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc86757411cec235bca7f49bfde6478ff2ce43be">eEDGE01</a> = 0x1, <a name="l00070"></a><a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc867574c6f1b183dab2904948a94fb7c1876d8e">00070</a> <a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc867574c6f1b183dab2904948a94fb7c1876d8e">eEDGE10</a> = 0x2, <a name="l00071"></a><a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc867574ffe52512f641a5ab61ca4bc8947a55ba">00071</a> <a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc867574ffe52512f641a5ab61ca4bc8947a55ba">eEDGE0x</a> = 0x4, <a name="l00072"></a><a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc867574746e9baf584cc13dc91137a4e88f4173">00072</a> <a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc867574746e9baf584cc13dc91137a4e88f4173">eEDGEx1</a> = 0x8, <a name="l00073"></a><a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc86757494a247905278b6b78c0fcd9fd3ed52e2">00073</a> <a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc86757494a247905278b6b78c0fcd9fd3ed52e2">eEDGE1x</a> = 0x10, <a name="l00074"></a><a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc86757475340b8b90e65f226d84c532b4b9649d">00074</a> <a class="code" href="cnode_8h.html#037f9a3f242886ffc22581c9fc86757475340b8b90e65f226d84c532b4b9649d">eEDGEx0</a> = 0x20, <a name="l00075"></a>00075 }; <a name="l00076"></a>00076 <a name="l00080"></a><a class="code" href="cnode_8h.html#68d700a24f988399e796bd9ec0fab5ef">00080</a> <span class="keyword">enum</span> <a class="code" href="cnode_8h.html#68d700a24f988399e796bd9ec0fab5ef" title="Timing mode values.">DelayMode_t</a> { <a name="l00081"></a><a class="code" href="cnode_8h.html#68d700a24f988399e796bd9ec0fab5ef1c832c79ae7e49e1c9d32acce2ce76c6">00081</a> <a class="code" href="cnode_8h.html#68d700a24f988399e796bd9ec0fab5ef1c832c79ae7e49e1c9d32acce2ce76c6">eMIN_DELAY</a>, <a name="l00082"></a><a class="code" href="cnode_8h.html#68d700a24f988399e796bd9ec0fab5ef3c815f52576155b31cec0d30c4776f56">00082</a> <a class="code" href="cnode_8h.html#68d700a24f988399e796bd9ec0fab5ef3c815f52576155b31cec0d30c4776f56">eTYP_DELAY</a>, <a name="l00083"></a><a class="code" href="cnode_8h.html#68d700a24f988399e796bd9ec0fab5efc0be462041a0c7f6c42bc2552ec205d6">00083</a> <a class="code" href="cnode_8h.html#68d700a24f988399e796bd9ec0fab5efc0be462041a0c7f6c42bc2552ec205d6">eMAX_DELAY</a> <a name="l00084"></a>00084 }; <a name="l00085"></a>00085 <a name="l00089"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df">00089</a> <span class="keyword">enum</span> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df" title="Strength values.">Strength_t</a> { <a name="l00090"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df169517daa4b36262557270e8fd3cf567">00090</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df169517daa4b36262557270e8fd3cf567">eUNDEFINED</a> = 0, <a name="l00091"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfd1295bcca347173d80a5de593840ae3d">00091</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfd1295bcca347173d80a5de593840ae3d">eSUPPLY</a>, <a name="l00092"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df68cf08252eae423158342789d1b620ee">00092</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df68cf08252eae423158342789d1b620ee">eSTRONG</a>, <a name="l00093"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfdc0751c8ce7974ba97943e90546557fb">00093</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfdc0751c8ce7974ba97943e90546557fb">ePULL</a>, <a name="l00094"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df14ba7145fced374d4d661d6daaac3c6b">00094</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df14ba7145fced374d4d661d6daaac3c6b">eLARGE</a>, <a name="l00095"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfdae153c26a024bb6465932f4a76558c7">00095</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfdae153c26a024bb6465932f4a76558c7">eWEAK</a>, <a name="l00096"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df01a09ec5fd04a6fed50115c75bb0b5eb">00096</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df01a09ec5fd04a6fed50115c75bb0b5eb">eMEDIUM</a>, <a name="l00097"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfb5acd1e2fdc4d0b05f6e89e78d20255e">00097</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfb5acd1e2fdc4d0b05f6e89e78d20255e">eSMALL</a>, <a name="l00098"></a><a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfeccdd69eb663aa50d506548c4321c08b">00098</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3dfeccdd69eb663aa50d506548c4321c08b">eHIGHZ</a>, <a name="l00099"></a>00099 }; <a name="l00100"></a>00100 <a name="l00104"></a><a class="code" href="structStrengthPair__t.html">00104</a> <span class="keyword">struct </span><a class="code" href="structStrengthPair__t.html" title="Pair of strengths.">StrengthPair_t</a> { <a name="l00105"></a><a class="code" href="structStrengthPair__t.html#f5b8b2d309422e7ee3b6ec6a0297d4e9">00105</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df" title="Strength values.">Strength_t</a> <a class="code" href="structStrengthPair__t.html#f5b8b2d309422e7ee3b6ec6a0297d4e9">s0</a>; <a name="l00106"></a><a class="code" href="structStrengthPair__t.html#82f76d349dbd509ac3aa8d184f66be05">00106</a> <a class="code" href="cnode_8h.html#f77d11dbb72efad5ff27814d1c69f3df" title="Strength values.">Strength_t</a> <a class="code" href="structStrengthPair__t.html#82f76d349dbd509ac3aa8d184f66be05">s1</a>; <a name="l00107"></a>00107 }; <a name="l00108"></a>00108 <a name="l00109"></a><a class="code" href="cnode_8h.html#1510511cfac8002e12ebd8c9108db06e">00109</a> <span class="preprocessor">#define DEFINE_ENUM</span> <a name="l00110"></a>00110 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="cnode__def_8h.html" title="Definitions for parse tree nodes.">cnode_def.h</a>"</span> <a name="l00111"></a>00111 <span class="preprocessor">#undef DEFINE_ENUM</span> <a name="l00112"></a>00112 <span class="preprocessor"></span> <a name="l00113"></a>00113 <a name="l00120"></a>00120 <span class="keyword">template</span><<span class="keyword">class</span> T> <a name="l00121"></a><a class="code" href="classCNode__sp.html">00121</a> <span class="keyword">class </span><a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp</a> { <a name="l00122"></a>00122 T* ptr; <a name="l00123"></a>00123 <span class="keyword">public</span>: <a name="l00124"></a><a class="code" href="classCNode__sp.html#c75c97cc7e47bc4e0aa1c7152bea3403">00124</a> <a class="code" href="classCNode__sp.html#c75c97cc7e47bc4e0aa1c7152bea3403" title="Pointer to untyped argument.">CNode_sp</a>( <span class="keywordtype">void</span>** np ) { ptr = (T*)np; } <a name="l00125"></a><a class="code" href="classCNode__sp.html#042c1b01b2d7c7d53533bbb40f4a92c8">00125</a> T <a class="code" href="classCNode__sp.html#042c1b01b2d7c7d53533bbb40f4a92c8">operator=</a>( T n ) { *ptr = n; <span class="keywordflow">return</span> n; } <a name="l00126"></a><a class="code" href="classCNode__sp.html#f418aed1a1a9dd854b4c894fb272807d">00126</a> T <a class="code" href="classCNode__sp.html#f418aed1a1a9dd854b4c894fb272807d">operator-></a>() { <span class="keywordflow">return</span> *ptr; } <a name="l00127"></a><a class="code" href="classCNode__sp.html#80802b9a8d123a3c09f2df8be3a67b04">00127</a> <a class="code" href="classCNode__sp.html#80802b9a8d123a3c09f2df8be3a67b04">operator T</a>() { <span class="keywordflow">return</span> *ptr; } <a name="l00128"></a><a class="code" href="classCNode__sp.html#aec329d1e7f3447660ab719ed95c828f">00128</a> <span class="keywordtype">int</span> <a class="code" href="classCNode__sp.html#aec329d1e7f3447660ab719ed95c828f">operator==</a>( T v ) { <span class="keywordflow">return</span> *ptr == v; } <a name="l00129"></a><a class="code" href="classCNode__sp.html#a555d73edb9b63581fb95b7525362f8f">00129</a> <span class="keywordtype">int</span> <a class="code" href="classCNode__sp.html#a555d73edb9b63581fb95b7525362f8f">operator!=</a>( T v ) { <span class="keywordflow">return</span> *ptr != v; } <a name="l00130"></a><a class="code" href="classCNode__sp.html#7202dc878a44eb8e5a97624c22cfd38c">00130</a> <span class="keywordtype">int</span> <a class="code" href="classCNode__sp.html#aec329d1e7f3447660ab719ed95c828f">operator==</a>( <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a> p ) { <span class="keywordflow">return</span> *ptr == *p.<a class="code" href="classCNode__sp.html#c46930e5bcc398a2de78f064bc8d15d9">ptr</a>; } <a name="l00131"></a><a class="code" href="classCNode__sp.html#24dc662e535eb8c65d3d00c45f3eacd3">00131</a> <span class="keywordtype">int</span> <a class="code" href="classCNode__sp.html#a555d73edb9b63581fb95b7525362f8f">operator!=</a>( <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a> p ) { <span class="keywordflow">return</span> *ptr != *p.<a class="code" href="classCNode__sp.html#c46930e5bcc398a2de78f064bc8d15d9">ptr</a>; } <a name="l00132"></a>00132 }; <a name="l00133"></a>00133 <a name="l00138"></a><a class="code" href="structCNode__pr.html">00138</a> <span class="keyword">struct </span><a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> { <a name="l00139"></a><a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">00139</a> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a>; <a name="l00140"></a><a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">00140</a> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a>; <a name="l00141"></a>00141 <span class="keyword">public</span>: <a name="l00142"></a><a class="code" href="structCNode__pr.html#3f12971a5e0ce893a527d97b172b2d1d">00142</a> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="structCNode__pr.html#3f12971a5e0ce893a527d97b172b2d1d">operator=</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n ) { <a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a> = n; <a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a> = n; <span class="keywordflow">return</span> n; } <a name="l00143"></a><a class="code" href="structCNode__pr.html#9cdde4bbe9b0d2ca98bb82681269efe4">00143</a> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="structCNode__pr.html#9cdde4bbe9b0d2ca98bb82681269efe4">operator-></a>() { <span class="keywordflow">return</span> <a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a>; } <a name="l00144"></a><a class="code" href="structCNode__pr.html#87475acbde4ae457a0a1768996641621">00144</a> <a class="code" href="structCNode__pr.html#87475acbde4ae457a0a1768996641621">operator CNode*</a>() { <span class="keywordflow">return</span> <a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a>; } <a name="l00145"></a><a class="code" href="structCNode__pr.html#6353696402c2036d9dbd05f398b70f39">00145</a> <span class="keywordtype">int</span> <a class="code" href="structCNode__pr.html#6353696402c2036d9dbd05f398b70f39">operator==</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* v ) { <span class="keywordflow">return</span> <a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a> == v; } <a name="l00146"></a><a class="code" href="structCNode__pr.html#1312491c07f0acee5d98b6fff451be7d">00146</a> <span class="keywordtype">int</span> <a class="code" href="structCNode__pr.html#1312491c07f0acee5d98b6fff451be7d">operator!=</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* v ) { <span class="keywordflow">return</span> <a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a> != v; } <a name="l00147"></a><a class="code" href="structCNode__pr.html#30115d2b70e8d7ca4393975bae81ec2b">00147</a> <span class="keywordtype">int</span> <a class="code" href="structCNode__pr.html#6353696402c2036d9dbd05f398b70f39">operator==</a>( <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> p ) { <span class="keywordflow">return</span> <a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a> == p.<a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a>; } <a name="l00148"></a><a class="code" href="structCNode__pr.html#de732d8f4aee1a79d5402daf6f646abe">00148</a> <span class="keywordtype">int</span> <a class="code" href="structCNode__pr.html#1312491c07f0acee5d98b6fff451be7d">operator!=</a>( <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> p ) { <span class="keywordflow">return</span> <a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a> != p.<a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a>; } <a name="l00149"></a>00149 <span class="keyword">friend</span> <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> <a class="code" href="structCNode__pr.html#db74632900e9a0cd5f75d7879980bf23">cLINK</a>( <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> pr1, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n2 ); <a name="l00150"></a>00150 }; <a name="l00151"></a>00151 <a name="l00172"></a><a class="code" href="classCNode.html">00172</a> <span class="keyword">class </span><a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a> : <span class="keyword">public</span> <a class="code" href="classCObject.html" title="Base class for vrq objects.">CObject</a> <a name="l00173"></a>00173 { <a name="l00174"></a>00174 <span class="keyword">private</span>: <a name="l00175"></a>00175 <span class="keyword">static</span> list<CObstack*> stackList; <a name="l00176"></a>00176 <span class="keyword">static</span> <a class="code" href="classCObstack.html" title="Bulk object allocation object.">CObstack</a> evalHeap; <a name="l00177"></a>00177 <span class="keyword">static</span> <a class="code" href="glue_8h.html#0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> evalCount; <a name="l00178"></a>00178 <span class="keyword">static</span> <a class="code" href="classCObstack.html" title="Bulk object allocation object.">CObstack</a>* stack; <a name="l00179"></a>00179 <span class="keyword">static</span> map<CNode*,int> labelCache; <a name="l00180"></a>00180 <span class="keyword">static</span> <span class="keywordtype">int</span> labelCacheEnabled; <a name="l00181"></a>00181 <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513" title="Parse tree opcodes.">NodeOp_t</a> op; <a name="l00182"></a>00182 <span class="keywordtype">void</span>* left; <a name="l00183"></a>00183 <span class="keywordtype">void</span>* right; <a name="l00184"></a>00184 <a class="code" href="structCoord__t.html" title="Structure to hold file coordinates.">Coord_t</a> loc; <a name="l00185"></a>00185 <a class="code" href="structCoord__t.html" title="Structure to hold file coordinates.">Coord_t</a> *locp; <a name="l00186"></a>00186 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* attributes; <a name="l00187"></a>00187 <span class="comment">/*</span> <a name="l00188"></a>00188 <span class="comment"> * These decorations are temporary and used</span> <a name="l00189"></a>00189 <span class="comment"> * by the expression evaluation routines</span> <a name="l00190"></a>00190 <span class="comment"> */</span> <a name="l00191"></a>00191 <a class="code" href="cdecl_8h.html#ff499c00c9873bf3fcf1c46bf2652790" title="Expression node type.">NodeType_t</a> type; <a name="l00192"></a>00192 <a class="code" href="glue_8h.html#0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> width; <a name="l00193"></a>00193 <span class="keywordtype">int</span> fixedWidth; <a name="l00194"></a>00194 <span class="keyword">private</span>: <a name="l00195"></a>00195 <span class="keywordtype">int</span> LabelBits( <span class="keywordtype">int</span> supressErrorMessages = FALSE ); <a name="l00196"></a>00196 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* FixBits( <a class="code" href="glue_8h.html#0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> newWidth, <a class="code" href="cdecl_8h.html#ff499c00c9873bf3fcf1c46bf2652790" title="Expression node type.">NodeType_t</a> newType ); <a name="l00197"></a>00197 <span class="keywordtype">void</span> _EvalVector( <a class="code" href="classCVector.html" title="Bit vector class for implementing 4 state verilog signed and unsigned arithmetic...">CVector</a>& v ); <a name="l00198"></a>00198 <span class="keywordtype">double</span> _EvalReal( <span class="keywordtype">void</span> ); <a name="l00199"></a>00199 <span class="keywordtype">void</span> FixedWidth( <span class="keywordtype">int</span> v ) { fixedWidth = v; } <a name="l00200"></a>00200 <span class="keywordtype">int</span> FixedWidth() { <span class="keywordflow">return</span> fixedWidth; } <a name="l00201"></a>00201 <span class="keywordtype">int</span> ConditionalWiden(); <a name="l00202"></a>00202 <span class="keywordtype">int</span> WidthFixed(); <a name="l00203"></a>00203 <span class="keywordtype">unsigned</span> NodeMask(); <a name="l00204"></a>00204 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* GetNLeft( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> (<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*)left; } <a name="l00205"></a>00205 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* GetNRight( <span class="keywordtype">void</span> ) { <span class="keywordflow">return</span> (<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*)right; } <a name="l00206"></a>00206 <span class="keyword">static</span> <span class="keywordtype">void</span> _LabelBits( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n, <span class="keywordtype">void</span>* arg ); <a name="l00207"></a>00207 <span class="keyword">public</span>: <a name="l00212"></a><a class="code" href="classCNode.html#c6e8859a1a0ff907ce428f1d416a3e50">00212</a> <span class="keyword">static</span> <a class="code" href="classCObstack.html" title="Bulk object allocation object.">CObstack</a>* <a class="code" href="classCNode.html#c6e8859a1a0ff907ce428f1d416a3e50" title="Gets pointer to current heap allocator.">CurrentHeap</a>() { <span class="keywordflow">return</span> stack; } <a name="l00222"></a><a class="code" href="classCNode.html#ceb010903a1eed3faf9b624efe39b59f">00222</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCNode.html#ceb010903a1eed3faf9b624efe39b59f" title="Use evaluation stack.">UseEvalStack</a>( <span class="keywordtype">void</span> ) { <a name="l00223"></a>00223 stackList.push_front( stack ); <a name="l00224"></a>00224 evalCount++; <a name="l00225"></a>00225 stack = &evalHeap; <a name="l00226"></a>00226 } <a name="l00231"></a><a class="code" href="classCNode.html#3cc9d5a6aa558b8329cb74aaca59ee16">00231</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCNode.html#3cc9d5a6aa558b8329cb74aaca59ee16" title="Set heap to a specific heap.">SetBuildStack</a>( <a class="code" href="classCObstack.html" title="Bulk object allocation object.">CObstack</a>* aStack ) { <a name="l00232"></a>00232 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( evalCount == 0 ); <a name="l00233"></a>00233 stackList.push_front( stack ); <a name="l00234"></a>00234 stack = aStack; <a name="l00235"></a>00235 } <a name="l00239"></a><a class="code" href="classCNode.html#8e136fbeb5667916489f13eb25857150">00239</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCNode.html#8e136fbeb5667916489f13eb25857150" title="Restore previous heap.">ResetBuildStack</a>( <span class="keywordtype">void</span> ) { <a name="l00240"></a>00240 <span class="keywordflow">if</span>( stack == &evalHeap ) { <a name="l00241"></a>00241 evalCount--; <a name="l00242"></a>00242 <span class="keywordflow">if</span>( evalCount == 0 ) { <a name="l00243"></a>00243 evalHeap.<a class="code" href="classCObstack.html#7763a15e24a5bd82bc0fd382a1addb06" title="Free all storage including and after object.">Free</a>( NULL ); <a name="l00244"></a>00244 } <a name="l00245"></a>00245 } <a name="l00246"></a>00246 <span class="keywordflow">if</span>( stackList.empty() ) { <a name="l00247"></a>00247 stack = NULL; <a name="l00248"></a>00248 } <span class="keywordflow">else</span> { <a name="l00249"></a>00249 stack = *stackList.begin(); <a name="l00250"></a>00250 stackList.pop_front(); <a name="l00251"></a>00251 } <a name="l00252"></a>00252 } <a name="l00262"></a><a class="code" href="classCNode.html#00647caded505eb712d2087d552e9c95">00262</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCNode.html#00647caded505eb712d2087d552e9c95" title="Enable cache of labeled nodes to be tracked.">EnableLabelCache</a>() <a name="l00263"></a>00263 { <a name="l00264"></a>00264 labelCacheEnabled = 1; <a name="l00265"></a>00265 } <a name="l00270"></a><a class="code" href="classCNode.html#7821d44f84eb78f006d3019d5e9c6bcd">00270</a> <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classCNode.html#7821d44f84eb78f006d3019d5e9c6bcd" title="Disable caching of label info (width and type) and clear all accumulated data.">DisableAndClearLabelCache</a>() <a name="l00271"></a>00271 { <a name="l00272"></a>00272 labelCacheEnabled = 0; <a name="l00273"></a>00273 labelCache.erase( labelCache.begin(), labelCache.end() ); <a name="l00274"></a>00274 } <a name="l00282"></a>00282 <a class="code" href="classCNode.html#d959ad79c878000832b757937e71a63f" title="Constructor for parse node.">CNode</a>( <a class="code" href="structCoord__t.html" title="Structure to hold file coordinates.">Coord_t</a>* aLoc, <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513" title="Parse tree opcodes.">NodeOp_t</a> aOp ); <a name="l00287"></a><a class="code" href="classCNode.html#4822c9360f069b308f6ed62debb28151">00287</a> <a class="code" href="structCoord__t.html" title="Structure to hold file coordinates.">Coord_t</a>* <a class="code" href="classCNode.html#4822c9360f069b308f6ed62debb28151" title="Get node&#39;s file coordinates.">GetCoord</a>() { <span class="keywordflow">return</span> locp; } <a name="l00292"></a><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce">00292</a> <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513" title="Parse tree opcodes.">NodeOp_t</a> <a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() { <span class="keywordflow">return</span> op; } <a name="l00299"></a><a class="code" href="classCNode.html#16b5c099d1ac314ca36121a760f81c88">00299</a> <span class="keywordtype">void</span> <a class="code" href="classCNode.html#16b5c099d1ac314ca36121a760f81c88" title="Set node&#39;s operation type.">SetOp</a>( <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513" title="Parse tree opcodes.">NodeOp_t</a> aOp ) { <a name="l00300"></a>00300 <span class="keywordtype">int</span> oldCount = <a class="code" href="classCNode.html#8112f4008e9237d8cbd78429446c68bb" title="Get the number of operands for the node.">ArgCount</a>(); <a name="l00301"></a>00301 op = aOp; <a name="l00302"></a>00302 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( oldCount == <a class="code" href="classCNode.html#8112f4008e9237d8cbd78429446c68bb" title="Get the number of operands for the node.">ArgCount</a>() ); <a name="l00303"></a>00303 } <a name="l00309"></a>00309 <span class="keywordtype">unsigned</span> <a class="code" href="classCNode.html#a033841783882d505e2be1a38ed1a32c" title="Calculate hash of tree.">Hash</a>(); <a name="l00315"></a>00315 <span class="keyword">template</span><<span class="keyword">class</span> T> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a> <a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a>( <span class="keywordtype">int</span> index ); <a name="l00320"></a>00320 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#8112f4008e9237d8cbd78429446c68bb" title="Get the number of operands for the node.">ArgCount</a>( <span class="keywordtype">void</span> ); <a name="l00326"></a>00326 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="classCNode.html#9578d068d7edc31c080b863f395da8f9" title="Replicate tree.">Clone</a>( <span class="keywordtype">void</span> ); <a name="l00331"></a>00331 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#9de9394f1024fcdd68f7ed82609c347e" title="Get the precedence of the operator represented by the node.">Precedence</a>(); <a name="l00338"></a>00338 <span class="keywordtype">void</span> <a class="code" href="classCNode.html#474cb6a7eeff6e6182359381c1f5753a" title="Walk tree invoking callback on each node after children have been visited.">PostVisit1</a>( <span class="keywordtype">void</span> (*callback)(<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*,<span class="keywordtype">void</span>*), <span class="keywordtype">void</span>* data ); <a name="l00347"></a>00347 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="classCNode.html#8102e5c082af2eac691d36c1551163ba" title="Walk tree invoking callback on each node after children have been visited.">PostSubVisit1</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* (*callback)(<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*,<span class="keywordtype">void</span>*), <a name="l00348"></a>00348 <span class="keywordtype">void</span>* data ); <a name="l00356"></a>00356 <span class="keywordtype">void</span> <a class="code" href="classCNode.html#99e57d389a0c4042f2b38eb8d2b7f164" title="Walk tree invoking callback on each node before children have been visited.">PreVisit1</a>( <span class="keywordtype">int</span> (*callback)(<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*,<span class="keywordtype">void</span>*), <span class="keywordtype">void</span>* data ); <a name="l00365"></a>00365 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="classCNode.html#6039d6147c95a66016bd68f782431a5a" title="Create simplified expression tree with given width and type.">Simplify</a>( <a class="code" href="glue_8h.html#0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> newWidth, <a class="code" href="cdecl_8h.html#ff499c00c9873bf3fcf1c46bf2652790" title="Expression node type.">NodeType_t</a> newType ); <a name="l00375"></a>00375 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#3f3afd2955807122314575a0e4e150ca" title="Checks expression tree to see if expression can result in an X or Z.">IsNonX</a>( <span class="keywordtype">int</span> integerIsNonX = 0, <span class="keywordtype">char</span>* exclude = NULL ); <a name="l00381"></a>00381 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#502e4db2e95f5a117c38f87bb5215de5" title="Checks expression tree to see if it is constant.">IsConstant</a>(); <a name="l00391"></a>00391 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#d279202102b4f81c9d25ad8727ecc7d9" title="Checks to see if expression tree can be evaluated.">IsEvaluateable</a>(); <a name="l00397"></a>00397 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#7ca286cfec44b3a6d9f38bfc1cb780a6" title="Checks to see if expression tree is volatile.">IsVolatile</a>( <span class="keywordtype">void</span> ); <a name="l00402"></a>00402 <a class="code" href="glue_8h.html#0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> <a class="code" href="classCNode.html#4b83e73f220c7487b38a3fba0a1f12f2" title="Evaluates expression tree and returns value as a 32 bit integer.">EvalINT32</a>(); <a name="l00409"></a>00409 <span class="keywordtype">void</span> <a class="code" href="classCNode.html#5503573dc2dabfcb88815576831a4a55" title="Evaluates expression tree evaluated in unconstrainted context.">EvalVector</a>( <a class="code" href="classCVector.html" title="Bit vector class for implementing 4 state verilog signed and unsigned arithmetic...">CVector</a>& v ); <a name="l00418"></a>00418 <span class="keywordtype">void</span> <a class="code" href="classCNode.html#5503573dc2dabfcb88815576831a4a55" title="Evaluates expression tree evaluated in unconstrainted context.">EvalVector</a>( <a class="code" href="classCVector.html" title="Bit vector class for implementing 4 state verilog signed and unsigned arithmetic...">CVector</a>& v, <a class="code" href="glue_8h.html#0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> newWidth, <a class="code" href="cdecl_8h.html#ff499c00c9873bf3fcf1c46bf2652790" title="Expression node type.">NodeType_t</a> newType ); <a name="l00424"></a>00424 <span class="keywordtype">double</span> <a class="code" href="classCNode.html#4b059e1817976d9f53bec0898d1d4b3b" title="Evaluates expression tree evaluated in a real context.">EvalReal</a>( <span class="keywordtype">void</span> ); <a name="l00429"></a>00429 <span class="keywordtype">void</span> <a class="code" href="classCNode.html#0b468e037caf218454a6a210b98697d2" title="Print a compact representation of the parse tree.">Dump</a>( FILE* f ); <a name="l00435"></a>00435 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#cc4d0c6b5cea6949754e4ebfcfd14bca" title="Evaluates if expression width is constant.">IsWidthConstant</a>( <span class="keywordtype">void</span> ); <a name="l00441"></a>00441 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#4c58242c86884ca9ba9a7244a9a0970c" title="Evaluates if expression width is volatile.">IsWidthVolatile</a>( <span class="keywordtype">void</span> ); <a name="l00451"></a>00451 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#b7a798650fb20d393f357b300b60737e" title="Evaluates if expression width can be evaluated.">IsWidthEvaluateable</a>( <span class="keywordtype">void</span> ); <a name="l00456"></a>00456 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="classCNode.html#585740fe83d1616022d9003318fdbf82" title="Create expression representing width of expression.">GetWidthExp</a>( <span class="keywordtype">void</span> ); <a name="l00462"></a><a class="code" href="classCNode.html#cc0ddc36117388a91352e39e449f6f0e">00462</a> <a class="code" href="glue_8h.html#0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> <a class="code" href="classCNode.html#cc0ddc36117388a91352e39e449f6f0e" title="Evaluate width of expression.">GetWidth</a>( <span class="keywordtype">void</span> ) { LabelBits(TRUE); <span class="keywordflow">return</span> width; } <a name="l00467"></a><a class="code" href="classCNode.html#bc3c773a01f308a86a2e3b6134c31c61">00467</a> <span class="keywordtype">int</span> <a class="code" href="classCNode.html#bc3c773a01f308a86a2e3b6134c31c61" title="Determine if expression is a 1 bit signed or unsigned value.">IsScalar</a>( <span class="keywordtype">void</span> ) { LabelBits(TRUE); <span class="keywordflow">return</span> width==1; } <a name="l00472"></a><a class="code" href="classCNode.html#11d5eea07e5095ff6bf5b4f3fee2aea0">00472</a> <span class="keywordtype">int</span> <a class="code" href="classCNode.html#11d5eea07e5095ff6bf5b4f3fee2aea0" title="Determine if expression is a multi-bit signed or unsigned value.">IsVector</a>( <span class="keywordtype">void</span> ) { LabelBits(TRUE); <span class="keywordflow">return</span> width>1; } <a name="l00477"></a><a class="code" href="classCNode.html#24ad7d7060bfa89e16c1b5ea751dcc2a">00477</a> <span class="keywordtype">int</span> <a class="code" href="classCNode.html#24ad7d7060bfa89e16c1b5ea751dcc2a" title="Determine if expression is real.">IsReal</a>( <span class="keywordtype">void</span> ) { LabelBits(TRUE); <span class="keywordflow">return</span> type==<a class="code" href="cdecl_8h.html#ff499c00c9873bf3fcf1c46bf2652790568d83290d150b55a7c08ec3e01a4b80" title="real - have width 0">eR</a>; } <a name="l00482"></a><a class="code" href="classCNode.html#d70eb3f37a5aa3c4459765bff21a6c8e">00482</a> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="classCNode.html#d70eb3f37a5aa3c4459765bff21a6c8e" title="Get attributes attached to operation.">GetAttributes</a>() { <span class="keywordflow">return</span> attributes; } <a name="l00487"></a><a class="code" href="classCNode.html#913e3feeeb243fc89f7fe30ba9ef1bad">00487</a> <span class="keywordtype">void</span> <a class="code" href="classCNode.html#913e3feeeb243fc89f7fe30ba9ef1bad" title="Attach attributes to operation.">SetAttributes</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* attr ) { attributes = attr; } <a name="l00494"></a>00494 <span class="keywordtype">int</span> <a class="code" href="classCNode.html#4abdb43ba614816ad004dc38c63c1049" title="Determine if node has the given attribute.">HasAttribute</a>( <span class="keywordtype">char</span>* name, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n=NULL, <span class="keywordtype">int</span> init = 1 ); <a name="l00499"></a><a class="code" href="classCNode.html#04082f01000bc79c004e063d77841755">00499</a> <a class="code" href="cdecl_8h.html#ff499c00c9873bf3fcf1c46bf2652790" title="Expression node type.">NodeType_t</a> <a class="code" href="classCNode.html#04082f01000bc79c004e063d77841755" title="Get node expression type.">GetNodeType</a>( <span class="keywordtype">void</span> ) { LabelBits(TRUE); <span class="keywordflow">return</span> type; } <a name="l00500"></a>00500 }; <a name="l00501"></a>00501 <a name="l00502"></a>00502 <a name="l00503"></a>00503 <span class="comment">/************************************************</span> <a name="l00504"></a>00504 <span class="comment"> Arg<CNode*> </span> <a name="l00505"></a>00505 <span class="comment"> - returns CNode smart pointer to arg by index</span> <a name="l00506"></a>00506 <span class="comment"> ***********************************************/</span> <a name="l00507"></a>00507 <a name="l00508"></a><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135">00508</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a> <a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">CNode::Arg</a>(<span class="keywordtype">int</span> index) <a name="l00509"></a>00509 { <a name="l00510"></a>00510 <span class="keywordflow">switch</span>( <a class="code" href="classCNode.html#8112f4008e9237d8cbd78429446c68bb" title="Get the number of operands for the node.">ArgCount</a>() ) { <a name="l00511"></a>00511 <span class="keywordflow">case</span> 1: <a name="l00512"></a>00512 <span class="keywordflow">switch</span>( index ) { <a name="l00513"></a>00513 <span class="keywordflow">case</span> 0: <a name="l00514"></a>00514 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&left); <a name="l00515"></a>00515 <span class="keywordflow">default</span>: <a name="l00516"></a>00516 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00517"></a>00517 <span class="keywordflow">return</span> NULL; <a name="l00518"></a>00518 } <a name="l00519"></a>00519 <span class="keywordflow">case</span> 2: <a name="l00520"></a>00520 <span class="keywordflow">switch</span>( index ) { <a name="l00521"></a>00521 <span class="keywordflow">case</span> 0: <a name="l00522"></a>00522 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&left); <a name="l00523"></a>00523 <span class="keywordflow">case</span> 1: <a name="l00524"></a>00524 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&right); <a name="l00525"></a>00525 <span class="keywordflow">default</span>: <a name="l00526"></a>00526 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00527"></a>00527 <span class="keywordflow">return</span> NULL; <a name="l00528"></a>00528 } <a name="l00529"></a>00529 <span class="keywordflow">case</span> 3: <a name="l00530"></a>00530 <span class="keywordflow">switch</span>( index ) { <a name="l00531"></a>00531 <span class="keywordflow">case</span> 0: <a name="l00532"></a>00532 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00533"></a>00533 <span class="keywordflow">case</span> 1: <a name="l00534"></a>00534 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00535"></a>00535 <span class="keywordflow">case</span> 2: <a name="l00536"></a>00536 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&right); <a name="l00537"></a>00537 <span class="keywordflow">default</span>: <a name="l00538"></a>00538 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00539"></a>00539 <span class="keywordflow">return</span> NULL; <a name="l00540"></a>00540 } <a name="l00541"></a>00541 <span class="keywordflow">case</span> 4: <a name="l00542"></a>00542 <span class="keywordflow">switch</span>( index ) { <a name="l00543"></a>00543 <span class="keywordflow">case</span> 0: <a name="l00544"></a>00544 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00545"></a>00545 <span class="keywordflow">case</span> 1: <a name="l00546"></a>00546 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00547"></a>00547 <span class="keywordflow">case</span> 2: <a name="l00548"></a>00548 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00549"></a>00549 <span class="keywordflow">case</span> 3: <a name="l00550"></a>00550 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00551"></a>00551 <span class="keywordflow">default</span>: <a name="l00552"></a>00552 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00553"></a>00553 <span class="keywordflow">return</span> NULL; <a name="l00554"></a>00554 } <a name="l00555"></a>00555 <span class="keywordflow">case</span> 5: <a name="l00556"></a>00556 <span class="keywordflow">switch</span>( index ) { <a name="l00557"></a>00557 <span class="keywordflow">case</span> 0: <a name="l00558"></a>00558 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00559"></a>00559 <span class="keywordflow">case</span> 1: <a name="l00560"></a>00560 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00561"></a>00561 <span class="keywordflow">case</span> 2: <a name="l00562"></a>00562 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00563"></a>00563 <span class="keywordflow">case</span> 3: <a name="l00564"></a>00564 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00565"></a>00565 <span class="keywordflow">case</span> 4: <a name="l00566"></a>00566 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00567"></a>00567 <span class="keywordflow">default</span>: <a name="l00568"></a>00568 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00569"></a>00569 <span class="keywordflow">return</span> NULL; <a name="l00570"></a>00570 } <a name="l00571"></a>00571 <span class="keywordflow">case</span> 6: <a name="l00572"></a>00572 <span class="keywordflow">switch</span>( index ) { <a name="l00573"></a>00573 <span class="keywordflow">case</span> 0: <a name="l00574"></a>00574 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00575"></a>00575 <span class="keywordflow">case</span> 1: <a name="l00576"></a>00576 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00577"></a>00577 <span class="keywordflow">case</span> 2: <a name="l00578"></a>00578 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#eb6f4594faacc0ff51e7f0dc2b5ae0df">GetNRight</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00579"></a>00579 <span class="keywordflow">case</span> 3: <a name="l00580"></a>00580 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#eb6f4594faacc0ff51e7f0dc2b5ae0df">GetNRight</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00581"></a>00581 <span class="keywordflow">case</span> 4: <a name="l00582"></a>00582 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00583"></a>00583 <span class="keywordflow">case</span> 5: <a name="l00584"></a>00584 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00585"></a>00585 <span class="keywordflow">default</span>: <a name="l00586"></a>00586 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00587"></a>00587 <span class="keywordflow">return</span> NULL; <a name="l00588"></a>00588 } <a name="l00589"></a>00589 <span class="keywordflow">case</span> 7: <a name="l00590"></a>00590 <span class="keywordflow">switch</span>( index ) { <a name="l00591"></a>00591 <span class="keywordflow">case</span> 0: <a name="l00592"></a>00592 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00593"></a>00593 <span class="keywordflow">case</span> 1: <a name="l00594"></a>00594 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00595"></a>00595 <span class="keywordflow">case</span> 2: <a name="l00596"></a>00596 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#eb6f4594faacc0ff51e7f0dc2b5ae0df">GetNRight</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00597"></a>00597 <span class="keywordflow">case</span> 3: <a name="l00598"></a>00598 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#eb6f4594faacc0ff51e7f0dc2b5ae0df">GetNRight</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00599"></a>00599 <span class="keywordflow">case</span> 4: <a name="l00600"></a>00600 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00601"></a>00601 <span class="keywordflow">case</span> 5: <a name="l00602"></a>00602 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00603"></a>00603 <span class="keywordflow">case</span> 6: <a name="l00604"></a>00604 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00605"></a>00605 <span class="keywordflow">default</span>: <a name="l00606"></a>00606 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00607"></a>00607 <span class="keywordflow">return</span> NULL; <a name="l00608"></a>00608 } <a name="l00609"></a>00609 <span class="keywordflow">case</span> 8: <a name="l00610"></a>00610 <span class="keywordflow">switch</span>( index ) { <a name="l00611"></a>00611 <span class="keywordflow">case</span> 0: <a name="l00612"></a>00612 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00613"></a>00613 <span class="keywordflow">case</span> 1: <a name="l00614"></a>00614 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00615"></a>00615 <span class="keywordflow">case</span> 2: <a name="l00616"></a>00616 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#eb6f4594faacc0ff51e7f0dc2b5ae0df">GetNRight</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00617"></a>00617 <span class="keywordflow">case</span> 3: <a name="l00618"></a>00618 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNLeft()-><a class="code" href="classCNode.html#eb6f4594faacc0ff51e7f0dc2b5ae0df">GetNRight</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00619"></a>00619 <span class="keywordflow">case</span> 4: <a name="l00620"></a>00620 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00621"></a>00621 <span class="keywordflow">case</span> 5: <a name="l00622"></a>00622 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#b4476ce85b2c6e4964626f05e2b2bd35">GetNLeft</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00623"></a>00623 <span class="keywordflow">case</span> 6: <a name="l00624"></a>00624 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#eb6f4594faacc0ff51e7f0dc2b5ae0df">GetNRight</a>()-><a class="code" href="classCNode.html#e47cee10dd0f85bd7a4c87f631af8a0f" title="left child">left</a>); <a name="l00625"></a>00625 <span class="keywordflow">case</span> 7: <a name="l00626"></a>00626 <span class="keywordflow">return</span> <a class="code" href="classCNode__sp.html" title="Smart pointer for CNode class Creates safe references to CNode arguments Supports...">CNode_sp<T></a>(&GetNRight()-><a class="code" href="classCNode.html#eb6f4594faacc0ff51e7f0dc2b5ae0df">GetNRight</a>()-><a class="code" href="classCNode.html#149b0dfb3a12a246c7fdc8a70b8f708f" title="right child">right</a>); <a name="l00627"></a>00627 <span class="keywordflow">default</span>: <a name="l00628"></a>00628 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00629"></a>00629 <span class="keywordflow">return</span> NULL; <a name="l00630"></a>00630 } <a name="l00631"></a>00631 <a name="l00632"></a>00632 <span class="keywordflow">default</span>: <a name="l00633"></a>00633 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( FALSE ); <a name="l00634"></a>00634 } <a name="l00635"></a>00635 } <a name="l00636"></a>00636 <span class="keywordtype">int</span> <a class="code" href="cnode_8h.html#1a1d6f964063fc8f09e489e9c5565b93">Equivalent</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* a, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* b ); <a name="l00637"></a>00637 <span class="comment">/******************************************************</span> <a name="l00638"></a>00638 <span class="comment"> real operation routines</span> <a name="l00639"></a>00639 <span class="comment"> ******************************************************/</span> <a name="l00640"></a>00640 <a name="l00641"></a><a class="code" href="cnode_8h.html#a36924ee5bc5b3102a9e0fefb9c910af">00641</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="cnode_8h.html#a36924ee5bc5b3102a9e0fefb9c910af">Add</a>( <span class="keywordtype">double</span>* r, <span class="keywordtype">double</span>* a, <span class="keywordtype">double</span>* b ) <a name="l00642"></a>00642 { <a name="l00643"></a>00643 *r = *a + *b; <a name="l00644"></a>00644 } <a name="l00645"></a>00645 <a name="l00646"></a><a class="code" href="cnode_8h.html#8b9b0f83482201fd71ae7d0a03277d0e">00646</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="cnode_8h.html#8b9b0f83482201fd71ae7d0a03277d0e">Sub</a>( <span class="keywordtype">double</span>* r, <span class="keywordtype">double</span>* a, <span class="keywordtype">double</span>* b ) <a name="l00647"></a>00647 { <a name="l00648"></a>00648 *r = *a - *b; <a name="l00649"></a>00649 } <a name="l00650"></a>00650 <a name="l00651"></a><a class="code" href="cnode_8h.html#775bed8a29aa227cd06e2444500621f7">00651</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="cnode_8h.html#775bed8a29aa227cd06e2444500621f7">Mul</a>( <span class="keywordtype">double</span>* r, <span class="keywordtype">double</span>* a, <span class="keywordtype">double</span>* b ) <a name="l00652"></a>00652 { <a name="l00653"></a>00653 *r = *a * *b; <a name="l00654"></a>00654 } <a name="l00655"></a>00655 <a name="l00656"></a><a class="code" href="cnode_8h.html#c7b57eaafd8f2e8712dd89fe61674c3b">00656</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="cnode_8h.html#c7b57eaafd8f2e8712dd89fe61674c3b">Div</a>( <span class="keywordtype">double</span>* r, <span class="keywordtype">double</span>* a, <span class="keywordtype">double</span>* b ) <a name="l00657"></a>00657 { <a name="l00658"></a>00658 *r = *a / *b; <a name="l00659"></a>00659 } <a name="l00660"></a>00660 <a name="l00661"></a><a class="code" href="cnode_8h.html#8f34adc7b597143cb6cf8aed59dcd337">00661</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="cnode_8h.html#8f34adc7b597143cb6cf8aed59dcd337">Neg</a>( <span class="keywordtype">double</span>* r, <span class="keywordtype">double</span>* a ) <a name="l00662"></a>00662 { <a name="l00663"></a>00663 *r = - *a; <a name="l00664"></a>00664 } <a name="l00665"></a>00665 <a name="l00666"></a><a class="code" href="cnode_8h.html#8244e2d6ac60db51a301f972620c8e98">00666</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="cnode_8h.html#8244e2d6ac60db51a301f972620c8e98">Pow</a>( <span class="keywordtype">double</span>* r, <span class="keywordtype">double</span>* a, <span class="keywordtype">double</span>* b ) <a name="l00667"></a>00667 { <a name="l00668"></a>00668 *r = pow(*a,*b); <a name="l00669"></a>00669 } <a name="l00670"></a>00670 <a name="l00671"></a>00671 <a name="l00672"></a>00672 <span class="comment">/*****************************************************</span> <a name="l00673"></a>00673 <span class="comment"> * Create stubs for illegal operations</span> <a name="l00674"></a>00674 <span class="comment"> ****************************************************/</span> <a name="l00675"></a><a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">00675</a> <span class="preprocessor">#define ILLEGAL_OP2(op) \</span> <a name="l00676"></a>00676 <span class="preprocessor">inline void op( double*, double*, double* )\</span> <a name="l00677"></a>00677 <span class="preprocessor">{ fatal( NULL, #op " is illegal for reals" ); }</span> <a name="l00678"></a>00678 <span class="preprocessor"></span> <a name="l00679"></a><a class="code" href="cnode_8h.html#b49c2d7ae711390d9d5381595e49c90c">00679</a> <span class="preprocessor">#define ILLEGAL_OP1(op) \</span> <a name="l00680"></a>00680 <span class="preprocessor">inline void op( double*, double* )\</span> <a name="l00681"></a>00681 <span class="preprocessor">{ fatal( NULL, #op " is illegal for reals" ); }</span> <a name="l00682"></a>00682 <span class="preprocessor"></span> <a name="l00683"></a>00683 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Rsh); <a name="l00684"></a>00684 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Lsh); <a name="l00685"></a>00685 <a name="l00686"></a>00686 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Rep); <a name="l00687"></a>00687 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Mod); <a name="l00688"></a>00688 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(And); <a name="l00689"></a>00689 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Xor); <a name="l00690"></a>00690 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Xnor); <a name="l00691"></a>00691 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Or); <a name="l00692"></a>00692 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Lor); <a name="l00693"></a>00693 <a class="code" href="cnode_8h.html#dd35fbfef226c08c0daf1824de3a8270">ILLEGAL_OP2</a>(Land); <a name="l00694"></a>00694 <a class="code" href="cnode_8h.html#b49c2d7ae711390d9d5381595e49c90c">ILLEGAL_OP1</a>(Com); <a name="l00695"></a>00695 <a class="code" href="cnode_8h.html#b49c2d7ae711390d9d5381595e49c90c">ILLEGAL_OP1</a>(Rand); <a name="l00696"></a>00696 <a class="code" href="cnode_8h.html#b49c2d7ae711390d9d5381595e49c90c">ILLEGAL_OP1</a>(Rnand); <a name="l00697"></a>00697 <a class="code" href="cnode_8h.html#b49c2d7ae711390d9d5381595e49c90c">ILLEGAL_OP1</a>(Ror); <a name="l00698"></a>00698 <a class="code" href="cnode_8h.html#b49c2d7ae711390d9d5381595e49c90c">ILLEGAL_OP1</a>(Rnor); <a name="l00699"></a>00699 <a class="code" href="cnode_8h.html#b49c2d7ae711390d9d5381595e49c90c">ILLEGAL_OP1</a>(Rxor); <a name="l00700"></a>00700 <a class="code" href="cnode_8h.html#b49c2d7ae711390d9d5381595e49c90c">ILLEGAL_OP1</a>(Rxnor); <a name="l00701"></a>00701 <a name="l00702"></a><a class="code" href="cnode_8h.html#a840818e146b5990b2d35d2bcb049ae0">00702</a> <span class="preprocessor">#define DEFINE_CONSTRUCTOR</span> <a name="l00703"></a>00703 <span class="preprocessor"></span><span class="preprocessor">#include "<a class="code" href="cnode__def_8h.html" title="Definitions for parse tree nodes.">cnode_def.h</a>"</span> <a name="l00704"></a>00704 <span class="preprocessor">#undef DEFINE_CONSTRUCTOR</span> <a name="l00705"></a>00705 <span class="preprocessor"></span> <a name="l00706"></a>00706 <span class="comment">/****************************************************</span> <a name="l00707"></a>00707 <span class="comment"> Node building helper routines</span> <a name="l00708"></a>00708 <span class="comment">*****************************************************/</span> <a name="l00709"></a>00709 <a name="l00716"></a><a class="code" href="group__node__constructors.html#g068de0b6574048fa5e98714af5bc5bb9">00716</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__constructors.html#g068de0b6574048fa5e98714af5bc5bb9" title="Short cut for creating VCONSTANT node with a given vector value.">cVECTOR</a>( <a class="code" href="classCVector.html" title="Bit vector class for implementing 4 state verilog signed and unsigned arithmetic...">CVector</a>& vec ) <a name="l00717"></a>00717 { <a name="l00718"></a>00718 <a class="code" href="classCVector.html" title="Bit vector class for implementing 4 state verilog signed and unsigned arithmetic...">CVector</a>* v = <a class="code" href="classCVector.html#381ec54a1446d581e81b3c4b65347915" title="Create vector allocating all storage from given heap.">CVector::AllocFromHeap</a>( <a class="code" href="classCNode.html#c6e8859a1a0ff907ce428f1d416a3e50" title="Gets pointer to current heap allocator.">CNode::CurrentHeap</a>(), vec.<a class="code" href="classCVector.html#ad5dd1c7f2d819694e4e59101f68b3b4" title="Get vector bit width.">GetWidth</a>() ); <a name="l00719"></a>00719 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n; <a name="l00720"></a>00720 *v = vec; <a name="l00721"></a>00721 v-><a class="code" href="classCVector.html#949419bc0ed97b6dec80742c9f0addd1" title="Set preferred base for printing value.">SetPreferredBase</a>( vec.<a class="code" href="classCVector.html#ea371ed98ce8941208c0704ecc1c1179" title="Get preferred base for printing value.">GetPreferredBase</a>() ); <a name="l00722"></a>00722 n = <span class="keyword">new</span>(<a class="code" href="classCNode.html#c6e8859a1a0ff907ce428f1d416a3e50" title="Gets pointer to current heap allocator.">CNode::CurrentHeap</a>()) <a class="code" href="classCNode.html#d959ad79c878000832b757937e71a63f" title="Constructor for parse node.">CNode</a>( NULL, <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e840851383b96207e0c46251df7e03aa4f636215" title="Vector constant.">eVCONSTANT</a> ); <a name="l00723"></a>00723 n->Arg<<a class="code" href="classCVector.html" title="Bit vector class for implementing 4 state verilog signed and unsigned arithmetic...">CVector</a>*>(0) = v; <a name="l00724"></a>00724 <span class="keywordflow">return</span> n; <a name="l00725"></a>00725 } <a name="l00726"></a>00726 <a name="l00733"></a><a class="code" href="group__node__constructors.html#g63fd75b2bd53df304201c6eb0bccc10c">00733</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__constructors.html#g63fd75b2bd53df304201c6eb0bccc10c" title="Short cut for creating VCONSTANT node with a given integer value.">cINT32</a>( <a class="code" href="glue_8h.html#0cb58e7e6f0bad369840a52e54a56ae0" title="Short cut for signed 32 bit integer.">INT32</a> i ) <a name="l00734"></a>00734 { <a name="l00735"></a>00735 <a class="code" href="classCVector.html" title="Bit vector class for implementing 4 state verilog signed and unsigned arithmetic...">CVector</a>* v = <a class="code" href="classCVector.html#381ec54a1446d581e81b3c4b65347915" title="Create vector allocating all storage from given heap.">CVector::AllocFromHeap</a>( <a class="code" href="classCNode.html#c6e8859a1a0ff907ce428f1d416a3e50" title="Gets pointer to current heap allocator.">CNode::CurrentHeap</a>(), 32 ); <a name="l00736"></a>00736 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n; <a name="l00737"></a>00737 *v = i; <a name="l00738"></a>00738 v-><a class="code" href="classCVector.html#a8cb2798f2245ab831b41907aaae4fa6" title="Get sized attribute.">Sized</a>(FALSE); <a name="l00739"></a>00739 v-><a class="code" href="classCVector.html#b06adf2ea848fd8b026059bccf469d74" title="Get signed attribute.">Signed</a>(TRUE); <a name="l00740"></a>00740 v-><a class="code" href="classCVector.html#19c69a84aebf15902cacff286ea2d591" title="Get based attribute.">Based</a>(FALSE); <a name="l00741"></a>00741 n = <span class="keyword">new</span>(<a class="code" href="classCNode.html#c6e8859a1a0ff907ce428f1d416a3e50" title="Gets pointer to current heap allocator.">CNode::CurrentHeap</a>()) <a class="code" href="classCNode.html#d959ad79c878000832b757937e71a63f" title="Constructor for parse node.">CNode</a>( NULL, <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e840851383b96207e0c46251df7e03aa4f636215" title="Vector constant.">eVCONSTANT</a> ); <a name="l00742"></a>00742 n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCVector.html" title="Bit vector class for implementing 4 state verilog signed and unsigned arithmetic...">CVector</a>*>(0) = v; <a name="l00743"></a>00743 <span class="keywordflow">return</span> n; <a name="l00744"></a>00744 } <a name="l00745"></a>00745 <a name="l00752"></a><a class="code" href="group__node__constructors.html#gf433cf9ad1e89edf474954736a9538e1">00752</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__constructors.html#gf433cf9ad1e89edf474954736a9538e1" title="Short cut for creating RCONSTANT node with a given double value.">cREAL</a>( <span class="keywordtype">double</span> number ) <a name="l00753"></a>00753 { <a name="l00754"></a>00754 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* node = <span class="keyword">new</span>(<a class="code" href="classCNode.html#c6e8859a1a0ff907ce428f1d416a3e50" title="Gets pointer to current heap allocator.">CNode::CurrentHeap</a>()) <a class="code" href="classCNode.html#d959ad79c878000832b757937e71a63f" title="Constructor for parse node.">CNode</a>( NULL, <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e840851361a92007fde65202b2ff406abf2a179f" title="Real constant.">eRCONSTANT</a> ); <a name="l00755"></a>00755 node-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<span class="keywordtype">char</span>*>(0) = <a class="code" href="group__utilities.html#gdba73693074d75c740c6a68704ba71f0" title="Convert double to char string allocating storage on given heap.">d2s</a>(number,<a class="code" href="classCNode.html#c6e8859a1a0ff907ce428f1d416a3e50" title="Gets pointer to current heap allocator.">CNode::CurrentHeap</a>()); <a name="l00756"></a>00756 <span class="keywordflow">return</span> node; <a name="l00757"></a>00757 } <a name="l00758"></a>00758 <a name="l00766"></a><a class="code" href="group__node__constructors.html#g655654ba7add955e54e68a4930a58217">00766</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__constructors.html#g655654ba7add955e54e68a4930a58217" title="Link together two nodes with an ELIST operator.">cELINK</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n1, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n2 ) <a name="l00767"></a>00767 { <a name="l00768"></a>00768 <span class="keywordflow">if</span>( n1 == NULL ) { <a name="l00769"></a>00769 <span class="keywordflow">return</span> n2; <a name="l00770"></a>00770 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>( n2 == NULL ) { <a name="l00771"></a>00771 <span class="keywordflow">return</span> n1; <a name="l00772"></a>00772 } <a name="l00773"></a>00773 <span class="keywordflow">return</span> <a class="code" href="group__node__constructors.html#ge03f6ff900765ba554767056740172bd" title="Node construction shortcut for ELIST Expression list.">cELIST</a>( n1, n2 ); <a name="l00774"></a>00774 } <a name="l00775"></a>00775 <a name="l00783"></a><a class="code" href="group__node__constructors.html#g0222b6091fb2fa22cabf39a623a37009">00783</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__constructors.html#g0222b6091fb2fa22cabf39a623a37009" title="Short cut for creating an subtree that calculates the absolute value of an expression...">cABS</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* a ) <a name="l00784"></a>00784 { <a name="l00785"></a>00785 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* a1 = a-><a class="code" href="classCNode.html#9578d068d7edc31c080b863f395da8f9" title="Replicate tree.">Clone</a>(); <a name="l00786"></a>00786 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* a2 = a-><a class="code" href="classCNode.html#9578d068d7edc31c080b863f395da8f9" title="Replicate tree.">Clone</a>(); <a name="l00787"></a>00787 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="vrq_8png.html#b47cadadd8fee029ccdf639a31c0c2d0">c</a> = <a class="code" href="group__node__constructors.html#g49efee3e8c5758f3aa3fd42b032331ab" title="Node construction shortcut for GE greater than or equal.">cGE</a>(a,<a class="code" href="group__node__constructors.html#g63fd75b2bd53df304201c6eb0bccc10c" title="Short cut for creating VCONSTANT node with a given integer value.">cINT32</a>(0)); <a name="l00788"></a>00788 <span class="keywordflow">return</span> <a class="code" href="group__node__constructors.html#g815dc804468daf726f31eca348338a2e" title="Node construction shortcut for HOOK condition expression operator.">cHOOK</a>( c, a1, <a class="code" href="group__node__constructors.html#gcf1c129f71fa0de70daabab7e888cbc0" title="Node construction shortcut for NEG negation.">cNEG</a>( a2) ); <a name="l00789"></a>00789 } <a name="l00790"></a>00790 <a name="l00799"></a><a class="code" href="group__node__constructors.html#gc79c10da1936efee9a2cf3183643e2e1">00799</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__constructors.html#gc79c10da1936efee9a2cf3183643e2e1" title="Short cut for creating an subtree that calculates the absolute difference between...">cABSDIFF</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* a, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* b ) <a name="l00800"></a>00800 { <a name="l00801"></a>00801 <span class="keywordflow">return</span> <a class="code" href="group__node__constructors.html#g0222b6091fb2fa22cabf39a623a37009" title="Short cut for creating an subtree that calculates the absolute value of an expression...">cABS</a>( <a class="code" href="group__node__constructors.html#g3c6e4399f0a4f022db88fe341cc33fc9" title="Node construction shortcut for SUB Subtract.">cSUB</a>( a, b ) ); <a name="l00802"></a>00802 } <a name="l00803"></a>00803 <a name="l00812"></a><a class="code" href="group__node__constructors.html#g42eb3c612a8dc800c6845467136df71e">00812</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__constructors.html#g42eb3c612a8dc800c6845467136df71e" title="Short cut for linking together to nodes with a LIST operator.">cLINK</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n1, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n2 ) <a name="l00813"></a>00813 { <a name="l00814"></a>00814 <span class="keywordflow">if</span>( n1 == NULL ) { <a name="l00815"></a>00815 <span class="keywordflow">return</span> n2; <a name="l00816"></a>00816 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>( n2 == NULL ) { <a name="l00817"></a>00817 <span class="keywordflow">return</span> n1; <a name="l00818"></a>00818 } <a name="l00819"></a>00819 <span class="keywordflow">return</span> <a class="code" href="group__node__constructors.html#g94e490d9462642092011edac4980c10f" title="Node construction shortcut for LIST list of nodes.">cLIST</a>( n1, n2 ); <a name="l00820"></a>00820 } <a name="l00821"></a>00821 <a name="l00830"></a><a class="code" href="group__node__constructors.html#g0cfb34e4ac661ea504cc232d173bd599">00830</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__constructors.html#g0cfb34e4ac661ea504cc232d173bd599" title="Short cut for creating a expression tree that calculates the maximum of two expressions...">cMAX</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n1, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n2 ) <a name="l00831"></a>00831 { <a name="l00832"></a>00832 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* cond = <a class="code" href="group__node__constructors.html#g0cdd9390a0891629bc09c4a636631273" title="Node construction shortcut for LT less than.">cLT</a>(n2-><a class="code" href="classCNode.html#9578d068d7edc31c080b863f395da8f9" title="Replicate tree.">Clone</a>(),n1-><a class="code" href="classCNode.html#9578d068d7edc31c080b863f395da8f9" title="Replicate tree.">Clone</a>()); <a name="l00833"></a>00833 <span class="keywordflow">return</span> <a class="code" href="group__node__constructors.html#g815dc804468daf726f31eca348338a2e" title="Node construction shortcut for HOOK condition expression operator.">cHOOK</a>(cond,n1,n2); <a name="l00834"></a>00834 } <a name="l00835"></a>00835 <a name="l00836"></a>00836 <a name="l00837"></a>00837 <span class="comment">/****************************************************</span> <a name="l00838"></a>00838 <span class="comment"> utility routines</span> <a name="l00839"></a>00839 <span class="comment">*****************************************************/</span> <a name="l00840"></a>00840 <a name="l00853"></a><a class="code" href="group__node__utilities.html#g517bc4387bbf7828bb6b88ba32cf7e21">00853</a> <span class="keyword">template</span><<span class="keyword">class</span> T> <span class="keywordtype">void</span> <a class="code" href="group__node__utilities.html#g517bc4387bbf7828bb6b88ba32cf7e21" title="Walks a list of nodes and collects the specified augments of a given node type.">ArgList2Vector</a>(<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n, <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513" title="Parse tree opcodes.">NodeOp_t</a> op, <a name="l00854"></a>00854 <span class="keywordtype">int</span> argNumber, vector<T>& v) <a name="l00855"></a>00855 { <a name="l00856"></a>00856 <span class="keywordflow">if</span>( !n ) { <a name="l00857"></a>00857 <span class="keywordflow">return</span>; <a name="l00858"></a>00858 } <a name="l00859"></a>00859 <span class="keywordflow">switch</span>( n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() ) { <a name="l00860"></a>00860 <span class="keywordflow">case</span> <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513db35311cecef5fbb085c97b07e486405" title="list of nodes">eLIST</a>: <a name="l00861"></a>00861 ArgList2Vector<T>(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0),op,argNumber,v); <a name="l00862"></a>00862 ArgList2Vector<T>(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1),op,argNumber,v); <a name="l00863"></a>00863 <span class="keywordflow">break</span>; <a name="l00864"></a>00864 <span class="keywordflow">default</span>: <a name="l00865"></a>00865 <span class="keywordflow">if</span>( n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() == op ) { <a name="l00866"></a>00866 v.push_back(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><T>(argNumber)); <a name="l00867"></a>00867 } <a name="l00868"></a>00868 <span class="keywordflow">break</span>; <a name="l00869"></a>00869 } <a name="l00870"></a>00870 } <a name="l00871"></a>00871 <a name="l00880"></a><a class="code" href="group__node__utilities.html#g2469137ed5c74149d8c1d472ce03a55c">00880</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="group__node__utilities.html#g2469137ed5c74149d8c1d472ce03a55c" title="Walks an expression list of nodes and collects the subtrees that don&#39;t match...">EList2VectorExclude</a>(<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n, <span class="keyword">const</span> set<NodeOp_t>& excludeOps, vector<CNode*>& v) <a name="l00881"></a>00881 { <a name="l00882"></a>00882 <span class="keywordflow">if</span>( !n ) { <a name="l00883"></a>00883 <span class="keywordflow">return</span>; <a name="l00884"></a>00884 } <a name="l00885"></a>00885 <span class="keywordflow">switch</span>( n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() ) { <a name="l00886"></a>00886 <span class="keywordflow">case</span> <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513883177933c5c1426df37f362a6dc8626" title="Expression list.">eELIST</a>: <a name="l00887"></a>00887 <a class="code" href="group__node__utilities.html#g2469137ed5c74149d8c1d472ce03a55c" title="Walks an expression list of nodes and collects the subtrees that don&#39;t match...">EList2VectorExclude</a>(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0),excludeOps,v); <a name="l00888"></a>00888 <a class="code" href="group__node__utilities.html#g2469137ed5c74149d8c1d472ce03a55c" title="Walks an expression list of nodes and collects the subtrees that don&#39;t match...">EList2VectorExclude</a>(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1),excludeOps,v); <a name="l00889"></a>00889 <span class="keywordflow">break</span>; <a name="l00890"></a>00890 <span class="keywordflow">default</span>: <a name="l00891"></a>00891 <span class="keywordflow">if</span>( excludeOps.find(n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>()) == excludeOps.end() ) { <a name="l00892"></a>00892 v.push_back(n); <a name="l00893"></a>00893 } <a name="l00894"></a>00894 <span class="keywordflow">break</span>; <a name="l00895"></a>00895 } <a name="l00896"></a>00896 } <a name="l00897"></a>00897 <a name="l00904"></a><a class="code" href="group__node__utilities.html#gfd02d15cb7d8eb0151d1c841589264cd">00904</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="group__node__utilities.html#gfd02d15cb7d8eb0151d1c841589264cd" title="Converts a vector array of CNode* into a linked ELIST of the elements.">Vector2EList</a>(vector<CNode*>& v) <a name="l00905"></a>00905 { <a name="l00906"></a>00906 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* result = NULL; <a name="l00907"></a>00907 vector<CNode*>::reverse_iterator ptr; <a name="l00908"></a>00908 <span class="keywordflow">for</span>( ptr = v.rbegin(); ptr != v.rend(); ++ptr ) { <a name="l00909"></a>00909 <span class="keywordflow">if</span>( result ) { <a name="l00910"></a>00910 result = <a class="code" href="group__node__constructors.html#ge03f6ff900765ba554767056740172bd" title="Node construction shortcut for ELIST Expression list.">cELIST</a>(*ptr, result); <a name="l00911"></a>00911 } <span class="keywordflow">else</span> { <a name="l00912"></a>00912 result = *ptr; <a name="l00913"></a>00913 } <a name="l00914"></a>00914 } <a name="l00915"></a>00915 <span class="keywordflow">return</span> result; <a name="l00916"></a>00916 } <a name="l00917"></a>00917 <a name="l00926"></a><a class="code" href="group__node__utilities.html#gc5892f78ece46bc33ede58a5ac2a9fef">00926</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__node__utilities.html#gc5892f78ece46bc33ede58a5ac2a9fef" title="Walks a list/elist of nodes and counts the number of node with the specified operation...">ListCount</a>(<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n, <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513" title="Parse tree opcodes.">NodeOp_t</a> op) <a name="l00927"></a>00927 { <a name="l00928"></a>00928 <span class="keywordtype">int</span> result = 0; <a name="l00929"></a>00929 <span class="keywordflow">if</span>( !n ) { <a name="l00930"></a>00930 <span class="keywordflow">return</span> result; <a name="l00931"></a>00931 } <a name="l00932"></a>00932 <span class="keywordflow">switch</span>( n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() ) { <a name="l00933"></a>00933 <span class="keywordflow">case</span> <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513db35311cecef5fbb085c97b07e486405" title="list of nodes">eLIST</a>: <a name="l00934"></a>00934 <span class="keywordflow">case</span> <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513883177933c5c1426df37f362a6dc8626" title="Expression list.">eELIST</a>: <a name="l00935"></a>00935 result += <a class="code" href="group__node__utilities.html#gc5892f78ece46bc33ede58a5ac2a9fef" title="Walks a list/elist of nodes and counts the number of node with the specified operation...">ListCount</a>(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0),op); <a name="l00936"></a>00936 result += <a class="code" href="group__node__utilities.html#gc5892f78ece46bc33ede58a5ac2a9fef" title="Walks a list/elist of nodes and counts the number of node with the specified operation...">ListCount</a>(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1),op); <a name="l00937"></a>00937 <span class="keywordflow">break</span>; <a name="l00938"></a>00938 <span class="keywordflow">default</span>: <a name="l00939"></a>00939 <span class="keywordflow">if</span>( n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() == op ) { <a name="l00940"></a>00940 result = 1; <a name="l00941"></a>00941 } <a name="l00942"></a>00942 <span class="keywordflow">break</span>; <a name="l00943"></a>00943 } <a name="l00944"></a>00944 <span class="keywordflow">return</span> result; <a name="l00945"></a>00945 } <a name="l00946"></a>00946 <a name="l00953"></a><a class="code" href="group__node__utilities.html#gd8af5bcbb7ce221e466cf2040e20b425">00953</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__node__utilities.html#gc5892f78ece46bc33ede58a5ac2a9fef" title="Walks a list/elist of nodes and counts the number of node with the specified operation...">ListCount</a>(<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n) <a name="l00954"></a>00954 { <a name="l00955"></a>00955 <span class="keywordtype">int</span> result = 0; <a name="l00956"></a>00956 <span class="keywordflow">if</span>( !n ) { <a name="l00957"></a>00957 <span class="keywordflow">return</span> result; <a name="l00958"></a>00958 } <a name="l00959"></a>00959 <span class="keywordflow">switch</span>( n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() ) { <a name="l00960"></a>00960 <span class="keywordflow">case</span> <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513db35311cecef5fbb085c97b07e486405" title="list of nodes">eLIST</a>: <a name="l00961"></a>00961 <span class="keywordflow">case</span> <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513883177933c5c1426df37f362a6dc8626" title="Expression list.">eELIST</a>: <a name="l00962"></a>00962 result += <a class="code" href="group__node__utilities.html#gc5892f78ece46bc33ede58a5ac2a9fef" title="Walks a list/elist of nodes and counts the number of node with the specified operation...">ListCount</a>(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0)); <a name="l00963"></a>00963 result += <a class="code" href="group__node__utilities.html#gc5892f78ece46bc33ede58a5ac2a9fef" title="Walks a list/elist of nodes and counts the number of node with the specified operation...">ListCount</a>(n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1)); <a name="l00964"></a>00964 <span class="keywordflow">break</span>; <a name="l00965"></a>00965 <span class="keywordflow">default</span>: <a name="l00966"></a>00966 result = 1; <a name="l00967"></a>00967 <span class="keywordflow">break</span>; <a name="l00968"></a>00968 } <a name="l00969"></a>00969 <span class="keywordflow">return</span> result; <a name="l00970"></a>00970 } <a name="l00971"></a>00971 <a name="l00982"></a><a class="code" href="group__utilities.html#g7b78ea35c9ff6a9aba4f580e038a7ba9">00982</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="group__utilities.html#g7b78ea35c9ff6a9aba4f580e038a7ba9" title="Convert char string to double.">s2d</a>( <span class="keywordtype">char</span>* s ) { <a name="l00983"></a>00983 <span class="keywordflow">return</span> atof(s); <a name="l00984"></a>00984 } <a name="l00985"></a>00985 <a name="l00994"></a><a class="code" href="group__utilities.html#gdba73693074d75c740c6a68704ba71f0">00994</a> <span class="keyword">inline</span> <span class="keywordtype">char</span>* <a class="code" href="group__utilities.html#gdba73693074d75c740c6a68704ba71f0" title="Convert double to char string allocating storage on given heap.">d2s</a>( <span class="keywordtype">double</span> d, <a class="code" href="classCObstack.html" title="Bulk object allocation object.">CObstack</a>* heap ) { <a name="l00995"></a>00995 <span class="keywordtype">char</span> buffer[256]; <a name="l00996"></a>00996 <span class="comment">// note this isn't quite correct as it will turn</span> <a name="l00997"></a>00997 <span class="comment">// reals into ints, ie 2.0 => 2</span> <a name="l00998"></a>00998 snprintf( buffer, <span class="keyword">sizeof</span>(buffer), <span class="stringliteral">"%g"</span>, d ); <a name="l00999"></a>00999 <span class="keywordtype">char</span>* s = (<span class="keywordtype">char</span>*)heap-><a class="code" href="classCObstack.html#5a34d5a2800a901ed15366c11bf269ef" title="Allocate block of storage with given size.">Alloc</a>(strlen(buffer)+1); <a name="l01000"></a>01000 strcpy( s, buffer ); <a name="l01001"></a>01001 <span class="keywordflow">return</span> s; <a name="l01002"></a>01002 } <a name="l01003"></a>01003 <a name="l01004"></a>01004 <span class="comment">/*********************************************</span> <a name="l01005"></a>01005 <span class="comment"> * Adjust nodes structure to be efficient for</span> <a name="l01006"></a>01006 <span class="comment"> * tail recursion</span> <a name="l01007"></a>01007 <span class="comment"> *********************************************/</span> <a name="l01008"></a><a class="code" href="cnode_8h.html#015458588cc4b079241ae9fc381c6836">01008</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="cnode_8h.html#015458588cc4b079241ae9fc381c6836">RebalanceRight</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n ) { <a name="l01009"></a>01009 <span class="keywordflow">if</span>( n == NULL ) { <a name="l01010"></a>01010 <span class="keywordflow">return</span> n; <a name="l01011"></a>01011 } <a name="l01012"></a>01012 <span class="keywordflow">if</span>( n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() != <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513db35311cecef5fbb085c97b07e486405" title="list of nodes">eLIST</a> ) { <a name="l01013"></a>01013 <span class="keywordflow">return</span> n; <a name="l01014"></a>01014 } <a name="l01015"></a>01015 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* result = n; <a name="l01016"></a>01016 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* parent = NULL; <a name="l01017"></a>01017 <span class="keywordflow">while</span>( 1 ) { <a name="l01018"></a>01018 <span class="keywordflow">while</span>( n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0) && n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0)-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() == <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513db35311cecef5fbb085c97b07e486405" title="list of nodes">eLIST</a> ) { <a name="l01019"></a>01019 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* l = n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0); <a name="l01020"></a>01020 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* ll = l-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0); <a name="l01021"></a>01021 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* lr = l-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1); <a name="l01022"></a>01022 l-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1) = n; <a name="l01023"></a>01023 n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0) = lr; <a name="l01024"></a>01024 n = l; <a name="l01025"></a>01025 <span class="keywordflow">if</span>( parent ) { <a name="l01026"></a>01026 parent-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1) = n; <a name="l01027"></a>01027 } <span class="keywordflow">else</span> { <a name="l01028"></a>01028 result = n; <a name="l01029"></a>01029 } <a name="l01030"></a>01030 } <a name="l01031"></a>01031 <span class="keywordflow">if</span>( n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1) && n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1)-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() == <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513db35311cecef5fbb085c97b07e486405" title="list of nodes">eLIST</a> ) { <a name="l01032"></a>01032 parent = n; <a name="l01033"></a>01033 n = n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1); <a name="l01034"></a>01034 } <span class="keywordflow">else</span> { <a name="l01035"></a>01035 <span class="keywordflow">break</span>; <a name="l01036"></a>01036 } <a name="l01037"></a>01037 } <a name="l01038"></a>01038 <span class="keywordflow">return</span> result; <a name="l01039"></a>01039 } <a name="l01040"></a>01040 <span class="comment">/*********************************************</span> <a name="l01041"></a>01041 <span class="comment"> * Analyse tree struct.</span> <a name="l01042"></a>01042 <span class="comment"> * - depth is worst case stack depth right side</span> <a name="l01043"></a>01043 <span class="comment"> * optimization.</span> <a name="l01044"></a>01044 <span class="comment"> * count is number nodes.</span> <a name="l01045"></a>01045 <span class="comment"> *********************************************/</span> <a name="l01046"></a><a class="code" href="cnode_8h.html#6b9b2b5948abab3433ca0b1a205d56f5">01046</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> <a class="code" href="cnode_8h.html#6b9b2b5948abab3433ca0b1a205d56f5">MeasureDepth</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n, <span class="keywordtype">int</span>* count, <span class="keywordtype">int</span>* depth ) <a name="l01047"></a>01047 { <a name="l01048"></a>01048 *count = 0; <a name="l01049"></a>01049 *depth = 0; <a name="l01050"></a>01050 <span class="keywordflow">if</span>( !n ) { <a name="l01051"></a>01051 <span class="keywordflow">return</span>; <a name="l01052"></a>01052 } <a name="l01053"></a>01053 <span class="keywordflow">if</span>( n-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() == <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513db35311cecef5fbb085c97b07e486405" title="list of nodes">eLIST</a> ) { <a name="l01054"></a>01054 <span class="keywordtype">int</span> count0 = 0; <a name="l01055"></a>01055 <span class="keywordtype">int</span> depth0 = 0; <a name="l01056"></a>01056 <span class="keywordtype">int</span> count1 = 0; <a name="l01057"></a>01057 <span class="keywordtype">int</span> depth1 = 0; <a name="l01058"></a>01058 <span class="keywordflow">if</span>( n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0) ) { <a name="l01059"></a>01059 <a class="code" href="cnode_8h.html#6b9b2b5948abab3433ca0b1a205d56f5">MeasureDepth</a>( n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(0), &count0, &depth0 ); <a name="l01060"></a>01060 depth0++; <a name="l01061"></a>01061 } <a name="l01062"></a>01062 <span class="keywordflow">if</span>( n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1) ) { <a name="l01063"></a>01063 <a class="code" href="cnode_8h.html#6b9b2b5948abab3433ca0b1a205d56f5">MeasureDepth</a>( n-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1), &count1, &depth1 ); <a name="l01064"></a>01064 } <a name="l01065"></a>01065 *count = count0+count1; <a name="l01066"></a>01066 *depth = depth0 > depth1 ? depth0 : depth1; <a name="l01067"></a>01067 } <a name="l01068"></a>01068 (*count)++; <a name="l01069"></a>01069 } <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"> * Helper routine for parser to build trees that </span> <a name="l01074"></a>01074 <span class="comment"> * are effient for tail recursion.</span> <a name="l01075"></a>01075 <span class="comment"> *************************************************/</span> <a name="l01076"></a><a class="code" href="cnode_8h.html#db74632900e9a0cd5f75d7879980bf23">01076</a> <span class="keyword">inline</span> <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> <a class="code" href="group__node__constructors.html#g42eb3c612a8dc800c6845467136df71e" title="Short cut for linking together to nodes with a LIST operator.">cLINK</a>( <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> pr1, <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* n2 ) <a name="l01077"></a>01077 { <a name="l01078"></a>01078 <span class="keywordflow">if</span>( !n2 ) { <a name="l01079"></a>01079 <span class="keywordflow">return</span> pr1; <a name="l01080"></a>01080 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>( !pr1.<a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a> ) { <a name="l01081"></a>01081 <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> pr; <a name="l01082"></a>01082 pr.<a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a> = n2; <a name="l01083"></a>01083 pr.<a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a> = n2; <a name="l01084"></a>01084 <span class="keywordflow">return</span> pr; <a name="l01085"></a>01085 } <span class="keywordflow">else</span> <span class="keywordflow">if</span>( pr1.<a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a>-><a class="code" href="classCNode.html#ea4bcc23b1bba68d0a243e729b9da0ce" title="Return node&#39;s operation type.">GetOp</a>() != <a class="code" href="cnode__def_8h.html#21e7e2c6d95679cd908f0b20e8408513db35311cecef5fbb085c97b07e486405" title="list of nodes">eLIST</a> ) { <a name="l01086"></a>01086 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* t = <a class="code" href="group__node__constructors.html#g42eb3c612a8dc800c6845467136df71e" title="Short cut for linking together to nodes with a LIST operator.">cLINK</a>( pr1.<a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a>, n2 ); <a name="l01087"></a>01087 <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> pr; <a name="l01088"></a>01088 pr.<a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a> = t; <a name="l01089"></a>01089 pr.<a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a> = t; <a name="l01090"></a>01090 <span class="keywordflow">return</span> pr; <a name="l01091"></a>01091 } <span class="keywordflow">else</span> { <a name="l01092"></a>01092 pr1.<a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a>-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1) = <a class="code" href="group__node__constructors.html#g42eb3c612a8dc800c6845467136df71e" title="Short cut for linking together to nodes with a LIST operator.">cLINK</a>(pr1.<a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a>-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1),n2); <a name="l01093"></a>01093 <a class="code" href="structCNode__pr.html" title="Helper class for building tail recursive binary CNode trees Used by parser.">CNode_pr</a> pr; <a name="l01094"></a>01094 pr.head = pr1.<a class="code" href="structCNode__pr.html#24e945a3e47e1a03082dd887a27337fb">head</a>; <a name="l01095"></a>01095 pr.tail = pr1.<a class="code" href="structCNode__pr.html#f6fdb26ae3611d876f530aff13510739">tail</a>-><a class="code" href="classCNode.html#380e5e5cec5d65afc871ea9c64c27135" title="Get a node&#39;s operand.">Arg</a><<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*>(1); <a name="l01096"></a>01096 <span class="keywordflow">return</span> pr; <a name="l01097"></a>01097 } <a name="l01098"></a>01098 } <a name="l01099"></a>01099 <a name="l01100"></a>01100 <span class="comment">/*****************************************************</span> <a name="l01101"></a>01101 <span class="comment"> * Support routines for cnode_def.h constructs</span> <a name="l01102"></a>01102 <span class="comment"> *****************************************************/</span> <a name="l01103"></a><a class="code" href="cnode_8h.html#b20dd10cb144790ff21b0a4c37320e1d">01103</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="cnode_8h.html#b20dd10cb144790ff21b0a4c37320e1d">cMAX_N</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* first, ... ) <a name="l01104"></a>01104 { <a name="l01105"></a>01105 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* result = first; <a name="l01106"></a>01106 va_list ap; <a name="l01107"></a>01107 va_start( ap, first ); <a name="l01108"></a>01108 <span class="keywordflow">while</span>( 1 ) { <a name="l01109"></a>01109 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* arg = va_arg(ap,<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*); <a name="l01110"></a>01110 <span class="keywordflow">if</span>( !arg ) { <a name="l01111"></a>01111 <span class="keywordflow">break</span>; <a name="l01112"></a>01112 } <a name="l01113"></a>01113 result = <a class="code" href="group__node__constructors.html#g0cfb34e4ac661ea504cc232d173bd599" title="Short cut for creating a expression tree that calculates the maximum of two expressions...">cMAX</a>( result, arg ); <a name="l01114"></a>01114 } <a name="l01115"></a>01115 va_end( ap ); <a name="l01116"></a>01116 <span class="keywordflow">return</span> result; <a name="l01117"></a>01117 } <a name="l01118"></a>01118 <a name="l01119"></a><a class="code" href="cnode_8h.html#f8563bd4b20a258e543dd29e080eba58">01119</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="cnode_8h.html#f8563bd4b20a258e543dd29e080eba58">cADD_N</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* first, ... ) <a name="l01120"></a>01120 { <a name="l01121"></a>01121 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* result = first; <a name="l01122"></a>01122 va_list ap; <a name="l01123"></a>01123 va_start( ap, first ); <a name="l01124"></a>01124 <span class="keywordflow">while</span>( 1 ) { <a name="l01125"></a>01125 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* arg = va_arg(ap,<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*); <a name="l01126"></a>01126 <span class="keywordflow">if</span>( !arg ) { <a name="l01127"></a>01127 <span class="keywordflow">break</span>; <a name="l01128"></a>01128 } <a name="l01129"></a>01129 result = <a class="code" href="cnode_8h.html#24ffa6a25b42d0cb01a1e15a48bc8cb5">cADD</a>( result, arg ); <a name="l01130"></a>01130 } <a name="l01131"></a>01131 va_end( ap ); <a name="l01132"></a>01132 <span class="keywordflow">return</span> result; <a name="l01133"></a>01133 } <a name="l01134"></a>01134 <a name="l01135"></a><a class="code" href="cnode_8h.html#ac81c3004628e99ed2e9774275130d6f">01135</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="cnode_8h.html#ac81c3004628e99ed2e9774275130d6f">cMUL_N</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* first, ... ) <a name="l01136"></a>01136 { <a name="l01137"></a>01137 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* result = first; <a name="l01138"></a>01138 va_list ap; <a name="l01139"></a>01139 va_start( ap, first ); <a name="l01140"></a>01140 <span class="keywordflow">while</span>( 1 ) { <a name="l01141"></a>01141 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* arg = va_arg(ap,<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*); <a name="l01142"></a>01142 <span class="keywordflow">if</span>( !arg ) { <a name="l01143"></a>01143 <span class="keywordflow">break</span>; <a name="l01144"></a>01144 } <a name="l01145"></a>01145 result = <a class="code" href="cnode_8h.html#52608f49a43743ea6697031d17776072">cMUL</a>( result, arg ); <a name="l01146"></a>01146 } <a name="l01147"></a>01147 va_end( ap ); <a name="l01148"></a>01148 <span class="keywordflow">return</span> result; <a name="l01149"></a>01149 } <a name="l01150"></a>01150 <a name="l01151"></a><a class="code" href="cnode_8h.html#022d6fc246552e0b1112b9c6c4bae76b">01151</a> <span class="keyword">inline</span> <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* <a class="code" href="cnode_8h.html#022d6fc246552e0b1112b9c6c4bae76b">cABSDIFFPLUS1_N</a>( <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* first, ... ) <a name="l01152"></a>01152 { <a name="l01153"></a>01153 va_list ap; <a name="l01154"></a>01154 va_start( ap, first ); <a name="l01155"></a>01155 <a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>* second = va_arg(ap,<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*); <a name="l01156"></a>01156 <span class="comment">/*</span> <a name="l01157"></a>01157 <span class="comment"> * only make sense for 2 args</span> <a name="l01158"></a>01158 <span class="comment"> */</span> <a name="l01159"></a>01159 <a class="code" href="group__utilities.html#g6dbd4cb0f492800d40e2cad42a0ea250" title="Add invariant checks to code.">MASSERT</a>( va_arg(ap,<a class="code" href="classCNode.html" title="Primary data structure representing parse tree nodes.">CNode</a>*) == NULL ); <a name="l01160"></a>01160 va_end( ap ); <a name="l01161"></a>01161 <span class="keywordflow">return</span> <a class="code" href="cnode_8h.html#24ffa6a25b42d0cb01a1e15a48bc8cb5">cADD</a>(<a class="code" href="group__node__constructors.html#gc79c10da1936efee9a2cf3183643e2e1" title="Short cut for creating an subtree that calculates the absolute difference between...">cABSDIFF</a>(first,second),<a class="code" href="group__node__constructors.html#g63fd75b2bd53df304201c6eb0bccc10c" title="Short cut for creating VCONSTANT node with a given integer value.">cINT32</a>(1)); <a name="l01162"></a>01162 } <a name="l01163"></a>01163 <a name="l01164"></a><a class="code" href="cnode_8h.html#51c10c30e5ecd54bd93c86a1a438c27b">01164</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__node__constructors.html#g0cfb34e4ac661ea504cc232d173bd599" title="Short cut for creating a expression tree that calculates the maximum of two expressions...">cMAX</a>( <span class="keywordtype">int</span> a1, <span class="keywordtype">int</span> a2 ) <a name="l01165"></a>01165 { <a name="l01166"></a>01166 <span class="keywordflow">return</span> a1 < a2 ? a2 : a1; <a name="l01167"></a>01167 } <a name="l01168"></a>01168 <a name="l01169"></a><a class="code" href="cnode_8h.html#0f89c3507d86c15d102ab2771fa47879">01169</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="group__node__constructors.html#g0cfb34e4ac661ea504cc232d173bd599" title="Short cut for creating a expression tree that calculates the maximum of two expressions...">cMAX</a>( <span class="keywordtype">int</span> a1, <span class="keywordtype">int</span> a2, <span class="keywordtype">int</span> a3 ) <a name="l01170"></a>01170 { <a name="l01171"></a>01171 <span class="keywordflow">return</span> <a class="code" href="group__node__constructors.html#g0cfb34e4ac661ea504cc232d173bd599" title="Short cut for creating a expression tree that calculates the maximum of two expressions...">cMAX</a>(a1,<a class="code" href="group__node__constructors.html#g0cfb34e4ac661ea504cc232d173bd599" title="Short cut for creating a expression tree that calculates the maximum of two expressions...">cMAX</a>(a2,a3)); <a name="l01172"></a>01172 } <a name="l01173"></a>01173 <a name="l01174"></a><a class="code" href="cnode_8h.html#24ffa6a25b42d0cb01a1e15a48bc8cb5">01174</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="cnode_8h.html#24ffa6a25b42d0cb01a1e15a48bc8cb5">cADD</a>( <span class="keywordtype">int</span> a1, <span class="keywordtype">int</span> a2 ) <a name="l01175"></a>01175 { <a name="l01176"></a>01176 <span class="keywordflow">return</span> a1 + a2; <a name="l01177"></a>01177 } <a name="l01178"></a>01178 <a name="l01179"></a><a class="code" href="cnode_8h.html#52608f49a43743ea6697031d17776072">01179</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="cnode_8h.html#52608f49a43743ea6697031d17776072">cMUL</a>( <span class="keywordtype">int</span> a1, <span class="keywordtype">int</span> a2 ) <a name="l01180"></a>01180 { <a name="l01181"></a>01181 <span class="keywordflow">return</span> a1 * a2; <a name="l01182"></a>01182 } <a name="l01183"></a>01183 <a name="l01184"></a><a class="code" href="cnode_8h.html#7937b5fd1c7690e93b3f704c1bf25cde">01184</a> <span class="keyword">inline</span> <span class="keywordtype">int</span> <a class="code" href="cnode_8h.html#7937b5fd1c7690e93b3f704c1bf25cde">cABSDIFFPLUS1</a>( <span class="keywordtype">int</span> a1, <span class="keywordtype">int</span> a2 ) <a name="l01185"></a>01185 { <a name="l01186"></a>01186 <span class="keywordtype">int</span> diff = a1-a2; <a name="l01187"></a>01187 <span class="keywordflow">return</span> (diff < 0 ? -diff : diff)+1; <a name="l01188"></a>01188 } <a name="l01189"></a>01189 <a name="l01190"></a>01190 <a name="l01191"></a>01191 <span class="preprocessor">#endif // CNODE_HPP</span> <a name="l01192"></a>01192 <span class="preprocessor"></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 <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>