Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members  

termNodeList.c File Reference

#include "lclintMacros.nf"
#include "llbasic.h"

Go to the source code of this file.

Functions

termNodeList termNodeList_new ()
void termNodeList_addh (termNodeList s, termNode el)
termNodeList termNodeList_push (termNodeList s, termNode el)
void termNodeList_addl (termNodeList s, termNode el)
void termNodeList_reset (termNodeList s)
void termNodeList_finish (termNodeList s)
void termNodeList_advance (termNodeList s)
termNode termNodeList_head (termNodeList s)
termNodeList termNodeList_copy (termNodeList s)
termNode termNodeList_current (termNodeList s)
termNode termNodeList_getN (termNodeList s, int n)
cstring termNodeList_unparse (termNodeList s)
cstring termNodeList_unparseTail (termNodeList s)
cstring termNodeList_unparseToCurrent (termNodeList s)
cstring termNodeList_unparseSecondToCurrent (termNodeList s)
void termNodeList_free (termNodeList s)


Function Documentation

void termNodeList_addh ( termNodeList s,
termNode el )
 

Definition at line 71 of file termNodeList.c.

Referenced by makeIfTermNode(), makeInfixTermNode(), makeMapTermNode(), makePostfixTermNode2(), makePrefixTermNode(), makeSelectTermNode(), pushInfixOpPartNode(), termNodeList_copy(), termNodeList_push(), updateMatchedNode(), and updateSqBracketedNode().

00072 {
00073   llassert (termNodeListGROWHI > 0);
00074 
00075   if (s->nspacehigh <= 0)
00076     termNodeList_grow (s);
00077 
00078   s->nspacehigh--;
00079   s->elements[s->nelements] = el;
00080   s->nelements++;
00081 }

void termNodeList_addl ( termNodeList s,
termNode el )
 

Definition at line 91 of file termNodeList.c.

Referenced by CollapseInfixTermNode(), updateMatchedNode(), and updateSqBracketedNode().

00092 {
00093   llassert (termNodeListGROWLOW > 0);
00094 
00095   if (s->nspacelow <= 0)
00096     termNodeList_grow (s);
00097 
00098   s->nspacelow--;
00099   s->elements--;
00100   s->elements[0] = el;
00101   s->current++;
00102   s->nelements++;
00103 }

void termNodeList_advance ( termNodeList s )
 

Definition at line 118 of file termNodeList.c.

00119 {
00120   s->current++;
00121   llassert (s->current < s->nelements);
00122 }

termNodeList termNodeList_copy ( termNodeList s )
 

Definition at line 132 of file termNodeList.c.

00133 {
00134   termNodeList r = termNodeList_new ();
00135 
00136   termNodeList_elements (s, x)
00137   {
00138     termNodeList_addh (r, termNode_copySafe (x));
00139   } end_termNodeList_elements;
00140 
00141   return r;
00142 }

termNode termNodeList_current ( termNodeList s )
 

Definition at line 145 of file termNodeList.c.

Referenced by pushInfixOpPartNode().

00146 {
00147   llassert (!(s->current >= s->nelements));
00148   return (s->elements[s->current]);
00149 }

void termNodeList_finish ( termNodeList s )
 

Definition at line 112 of file termNodeList.c.

00113 {
00114   s->current = s->nelements - 1;
00115 }

void termNodeList_free ( termNodeList s )
 

Definition at line 250 of file termNodeList.c.

Referenced by makeQuantifiedTermNode().

00251 {
00252   int i;
00253   for (i = 0; i < s->nelements; i++)
00254     {
00255       termNode_free (s->elements[i]); 
00256     }
00257 
00258   sfree (s->elementsroot);
00259   sfree (s);
00260 }

termNode termNodeList_getN ( termNodeList s,
int n )
 

Definition at line 152 of file termNodeList.c.

00153 {
00154   llassert (n >= 0 && n < s->nelements);
00155 
00156   return (s->elements[n]);
00157 }

termNode termNodeList_head ( termNodeList s )
 

Definition at line 125 of file termNodeList.c.

00126 {
00127   llassert (s->nelements > 0);
00128   return (s->elements[0]);
00129 }

termNodeList termNodeList_new ( )
 

Definition at line 35 of file termNodeList.c.

Referenced by makeIfTermNode(), makeInfixTermNode(), makeLiteralTermNode(), makeMapTermNode(), makePostfixTermNode2(), makePrefixTermNode(), makeQuantifiedTermNode(), makeSelectTermNode(), makeSimpleTermNode(), makeSizeofTermNode(), makeUnchangedTermNode1(), makeUnchangedTermNode2(), pushInfixOpPartNode(), and termNodeList_copy().

00036 {
00037   termNodeList s = (termNodeList) dmalloc (sizeof (*s));
00038   
00039   s->nelements = 0;
00040   s->nspacelow = termNodeListGROWLOW;
00041   s->nspacehigh = termNodeListGROWHI;
00042   s->elementsroot = (termNode *) dmalloc (sizeof (*s->elements) * (s->nspacelow + s->nspacehigh));
00043   s->elements = s->elementsroot + termNodeListGROWLOW;
00044   s->current = 0;
00045 
00046   return (s);
00047 }

termNodeList termNodeList_push ( termNodeList s,
termNode el )
 

Definition at line 84 of file termNodeList.c.

00085 {
00086   termNodeList_addh (s, el);
00087   return s;
00088 }

void termNodeList_reset ( termNodeList s )
 

Definition at line 106 of file termNodeList.c.

Referenced by pushInfixOpPartNode().

00107 {
00108   s->current = 0;
00109 }

cstring termNodeList_unparse ( termNodeList s )
 

Definition at line 160 of file termNodeList.c.

Referenced by stmtNode_unparse(), and termNode_unparse().

00161 {
00162   bool first = TRUE;
00163   cstring st = cstring_undefined;
00164 
00165   termNodeList_elements (s, current)
00166   {
00167     if (first)
00168       {
00169         st = termNode_unparse (current);
00170         first = FALSE;
00171       }
00172     else
00173       st = message ("%q, %q", st, termNode_unparse (current));
00174   } end_termNodeList_elements;
00175 
00176   return st;
00177 }

cstring termNodeList_unparseSecondToCurrent ( termNodeList s )
 

Definition at line 227 of file termNodeList.c.

00228 {
00229   int i;
00230   cstring st = cstring_undefined;
00231 
00232   for (i = 1; i < s->current; i++)
00233     {
00234       termNode current = s->elements[i];
00235 
00236       if (i == 1)
00237         {
00238           st = termNode_unparse (current);
00239         }
00240       else
00241         {
00242           st = message ("%q, %q", st, termNode_unparse (current));
00243         }
00244     }
00245 
00246   return st;
00247 }

cstring termNodeList_unparseTail ( termNodeList s )
 

Definition at line 180 of file termNodeList.c.

00181 {
00182   bool head = TRUE;
00183   bool first = TRUE;
00184   cstring st = cstring_undefined;
00185 
00186   termNodeList_elements (s, current)
00187   {
00188     if (head)
00189       {
00190         head = FALSE;
00191       }
00192     else
00193       {
00194         if (first)
00195           {
00196             st = termNode_unparse (current);
00197             first = FALSE;
00198           }
00199         else
00200           st = message ("%q, %q", st, termNode_unparse (current));
00201       }
00202   } end_termNodeList_elements;
00203 
00204   return st;
00205 }

cstring termNodeList_unparseToCurrent ( termNodeList s )
 

Definition at line 208 of file termNodeList.c.

00209 {
00210   int i;
00211   cstring st = cstring_undefined;
00212 
00213   for (i = 0; i < s->current; i++)
00214     {
00215       termNode current = s->elements[i];
00216 
00217       if (i == 0)
00218         st = termNode_unparse (current);
00219       else
00220         st = message ("%q, %q", st, termNode_unparse (current));
00221     }
00222 
00223   return st;
00224 }


Generated at Fri Nov 3 18:58:14 2000 for LCLint by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000