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

ctypeList.c File Reference

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

Go to the source code of this file.

Functions

ctypeList ctypeList_new ()
void ctypeList_addh (ctypeList s, ctype el)
cstring ctypeList_unparse (ctypeList ct)
void ctypeList_free ( ctypeList s)


Function Documentation

void ctypeList_addh ( ctypeList s,
ctype el )
 

Definition at line 70 of file ctypeList.c.

00071 {
00072   llassert (ctypeList_isDefined (s));
00073   llassert (ctypeListBASESIZE > 0);
00074 
00075   if (s->nspace <= 0) ctypeList_grow (s);
00076   
00077   s->nspace--;
00078   s->elements[s->nelements] = el;
00079   s->nelements++;
00080 }

void ctypeList_free ( ctypeList s )
 

Definition at line 111 of file ctypeList.c.

00112 {
00113   if (ctypeList_isDefined (s))
00114     {
00115       int i;
00116       for (i = 0; i < s->nelements; i++)
00117         {
00118           /*      ctype_free (s->elements[i]); */
00119         }
00120       
00121       sfree (s->elements); /* not quite!!! */
00122       sfree (s);
00123     }
00124 }

ctypeList ctypeList_new ( )
 

Definition at line 36 of file ctypeList.c.

00037 {
00038   ctypeList s = (ctypeList) dmalloc (sizeof (*s));
00039   
00040   s->nelements = 0;
00041   s->nspace = ctypeListBASESIZE; 
00042   s->elements = (ctype *) dmalloc (sizeof (*s->elements) * ctypeListBASESIZE);
00043 
00044   return (s);
00045 }

cstring ctypeList_unparse ( ctypeList ct )
 

Definition at line 83 of file ctypeList.c.

00084 {
00085   cstring s = cstring_undefined;
00086   int i;
00087   bool first = TRUE;
00088 
00089   if (ctypeList_isUndefined (ct) || ctypeList_size (ct) == 0)
00090     {
00091       return (cstring_makeLiteral ("void"));
00092     }
00093 
00094   for (i = 0; i < ct->nelements; i++)
00095     {
00096       if (first)
00097         {
00098           s = cstring_copy (ctype_unparse (ct->elements[i]));
00099           first = FALSE;
00100         }
00101       else
00102         {
00103           s = message ("%q, %s", s, ctype_unparse (ct->elements[i]));
00104         }
00105     }
00106 
00107   return s;
00108 }


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