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

exprNodeList.c File Reference

#include "lclintMacros.nf"
#include "basic.h"

Go to the source code of this file.

Functions

exprNodeList exprNodeList_new ()
void exprNodeList_addh (exprNodeList s, exprNode el)
void exprNodeList_reset (exprNodeList s)
void exprNodeList_advance (exprNodeList s)
exprNode exprNodeList_head (exprNodeList s)
exprNode exprNodeList_current (exprNodeList s)
exprNode exprNodeList_getN (exprNodeList s, int n)
exprNodeList exprNodeList_singleton ( exprNode e)
exprNodeList exprNodeList_push ( exprNodeList args, exprNode e)
exprNode exprNodeList_nth (exprNodeList args, int n)
cstring exprNodeList_unparse (exprNodeList s)
void exprNodeList_free (exprNodeList s)
void exprNodeList_freeShallow ( exprNodeList s)


Function Documentation

void exprNodeList_addh ( exprNodeList s,
exprNode el )
 

Definition at line 83 of file exprNodeList.c.

Referenced by exprNodeList_push().

00084 {
00085   llassert (exprNodeListBASESIZE > 0);
00086 
00087   if (s->nspace <= 0)
00088     exprNodeList_grow (s);
00089   
00090   s->nspace--;
00091   s->elements[s->nelements] = el;
00092   s->nelements++;
00093 }

void exprNodeList_advance ( exprNodeList s )
 

Definition at line 100 of file exprNodeList.c.

00101 {
00102   s->current++;
00103   llassert (s->current <= s->nelements);
00104 }

exprNode exprNodeList_current ( exprNodeList s )
 

Definition at line 112 of file exprNodeList.c.

00113 {
00114   llassert (s->current >= 0 && s->current < s->nelements);
00115   return (s->elements[s->current]);
00116 }

void exprNodeList_free ( exprNodeList s )
 

Definition at line 176 of file exprNodeList.c.

Referenced by exprNode_functionCall().

00177 {
00178   int i;
00179 
00180   for (i = 0; i < s->nelements; i++)
00181     {
00182       exprNode_free (s->elements[i]); 
00183     }
00184   
00185   sfree (s->elements); 
00186   sfree (s);
00187 }

void exprNodeList_freeShallow ( exprNodeList s )
 

Definition at line 190 of file exprNodeList.c.

00191 {
00192   int i;
00193 
00194   for (i = 0; i < s->nelements; i++)
00195     {
00196       exprNode_freeShallow (s->elements[i]); 
00197     }
00198   
00199   sfree (s->elements); 
00200   sfree (s);
00201 }

exprNode exprNodeList_getN ( exprNodeList s,
int n )
 

Definition at line 118 of file exprNodeList.c.

00119 {
00120   llassert (n >= 0 && n < s->nelements);
00121   return (s->elements[n]);
00122 }

exprNode exprNodeList_head ( exprNodeList s )
 

Definition at line 106 of file exprNodeList.c.

00107 {
00108   llassert (s->nelements > 0);
00109   return (s->elements[0]);
00110 }

exprNodeList exprNodeList_new ( )
 

Definition at line 36 of file exprNodeList.c.

00037 {
00038   exprNodeList s = (exprNodeList) dmalloc (sizeof (*s));
00039   
00040   s->nelements = 0;
00041   s->nspace = exprNodeListBASESIZE; 
00042   s->elements = (exprNode *)
00043     dmalloc (sizeof (*s->elements) * exprNodeListBASESIZE);
00044   s->current = 0;
00045 
00046     return (s);
00047 }

exprNode exprNodeList_nth ( exprNodeList args,
int n )
 

Definition at line 144 of file exprNodeList.c.

Referenced by sRef_fixBaseParam(), and uentry_returnedRef().

00145 {
00146   if (n >= exprNodeList_size (args) || n < 0)
00147     {
00148       llcontbug (message ("exprNodeList_nth: out of range: %q arg %d\n", 
00149                           exprNodeList_unparse (args), n));
00150       return exprNode_undefined;
00151     }
00152 
00153   return args->elements[n]; 
00154 }

exprNodeList exprNodeList_push ( exprNodeList args,
exprNode e )
 

Definition at line 137 of file exprNodeList.c.

00138 {
00139   exprNodeList_addh (args, e);
00140   return (args);
00141 }

void exprNodeList_reset ( exprNodeList s )
 

Definition at line 95 of file exprNodeList.c.

00096 {
00097   s->current = 0;
00098 }

exprNodeList exprNodeList_singleton ( exprNode e )
 

Definition at line 124 of file exprNodeList.c.

00125 {
00126   exprNodeList s = (exprNodeList) dmalloc (sizeof (*s));
00127   
00128   s->nelements = 1;
00129   s->nspace = exprNodeListBASESIZE - 1; 
00130   s->elements = (exprNode *) dmalloc (sizeof (*s->elements) * exprNodeListBASESIZE);
00131   s->elements[0] = e;
00132   s->current = 0;
00133 
00134   return (s);
00135 }

cstring exprNodeList_unparse ( exprNodeList s )
 

Definition at line 157 of file exprNodeList.c.

00158 {
00159    int i;
00160    cstring st = cstring_undefined;
00161 
00162       for (i = 0; i < s->nelements; i++)
00163      {
00164        if (i == 0)
00165          {
00166            st = cstring_copy (exprNode_unparse (s->elements[i]));
00167          }
00168        else
00169          st = message ("%q, %s", st, exprNode_unparse (s->elements[i]));
00170      }
00171    
00172    return st;
00173 }


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