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

typeIdSet.c File Reference

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

Go to the source code of this file.

Defines

#define TISTABLEBASESIZE   LARGEBASESIZE

Typedefs

typedef usymIdSet o_usymIdSet

Functions

void typeIdSet_initMod (void)
void typeIdSet_destroyMod (void)
void typeIdSet_dumpTable (FILE *fout)
void typeIdSet_loadTable (FILE *fin)
typeIdSet typeIdSet_emptySet (void)
bool typeIdSet_member (typeIdSet t, typeId el)
bool typeIdSet_isEmpty (typeIdSet t)
typeIdSet typeIdSet_single (typeId t)
typeIdSet typeIdSet_singleOpt (typeId t)
typeIdSet typeIdSet_insert (typeIdSet t, typeId el)
typeIdSet typeIdSet_removeFresh (typeIdSet t, typeId el)
cstring typeIdSet_unparse (typeIdSet t)
int typeIdSet_compare (typeIdSet t1, typeIdSet t2)
typeIdSet typeIdSet_subtract (typeIdSet s, typeIdSet t)
cstring typeIdSet_dump (typeIdSet t)
typeIdSet typeIdSet_undump (char **s)
typeIdSet typeIdSet_union (typeIdSet t1, typeIdSet t2)


Define Documentation

#define TISTABLEBASESIZE   LARGEBASESIZE
 

Definition at line 32 of file typeIdSet.c.


Typedef Documentation

typedef usymIdSet o_usymIdSet
 

Definition at line 36 of file typeIdSet.c.


Function Documentation

int typeIdSet_compare ( typeIdSet t1,
typeIdSet t2 )
 

Definition at line 250 of file typeIdSet.c.

Referenced by uentry_compare().

00251 {
00252   return (int_compare (t1, t2));
00253 }

void typeIdSet_destroyMod ( void )
 

Definition at line 54 of file typeIdSet.c.

Referenced by llexit().

00056 {
00057   int i;
00058 
00059   for (i = 0; i < tistableentries; i++)
00060     {
00061       usymIdSet_free (tistable[i]);
00062     }
00063 
00064   sfree (tistable);
00065   tistableentries = 0;
00066 }

cstring typeIdSet_dump ( typeIdSet t )
 

Definition at line 268 of file typeIdSet.c.

Referenced by context_dumpModuleAccess().

00269 {
00270   return (message ("%d", t));
00271 }

void typeIdSet_dumpTable ( FILE * fout )
 

Definition at line 68 of file typeIdSet.c.

Referenced by dumpState().

00069 {
00070   int i;
00071 
00072   /*
00073   ** Don't dump 0th entry
00074   */
00075 
00076   for (i = 1; i < tistableentries; i++)
00077     {
00078       cstring s = usymIdSet_dump (tistable[i]);
00079 
00080       fprintf (fout, "%s\n", cstring_toCharsSafe (s));
00081       cstring_free (s);
00082     }
00083 }

typeIdSet typeIdSet_emptySet ( void )
 

Definition at line 184 of file typeIdSet.c.

Referenced by context_enterLCLfile(), context_exitFile(), context_exitLCLfile(), context_initMod(), and uentry_makeFunction().

00185 {
00186   if (tistableentries == 0)
00187     {
00188       int val = tistable_addEntry (usymIdSet_new ());
00189 
00190       llassert (val == 0);
00191     }
00192 
00193   llassert (usymIdSet_isUndefined (tistable[0]));
00194   return 0;
00195 }

void typeIdSet_initMod ( void )
 

Definition at line 41 of file typeIdSet.c.

Referenced by main().

00044 {
00045   llassert (tistableentries == 0 && tistablefree == 0);
00046 
00047   tistablefree = TISTABLEBASESIZE;
00048   tistable = (usymIdSet *) dmalloc (sizeof (tistable) * tistablefree);
00049   tistable[0] = usymIdSet_undefined;
00050   tistableentries = 1;
00051   tistablefree--;
00052 }

typeIdSet typeIdSet_insert ( typeIdSet t,
typeId el )
 

Definition at line 226 of file typeIdSet.c.

Referenced by context_addFileAccessType(), context_removeFileAccessType(), and uentry_addAccessType().

00227 {
00228   usymIdSet u = tistable_fetch (t);
00229 
00230   if (usymIdSet_member (u, el))
00231     {
00232       return t;
00233     }
00234   else
00235     {
00236       return (tistable_addEntry (usymIdSet_add (u, el)));
00237     }
00238 }

bool typeIdSet_isEmpty ( typeIdSet t )
 

Definition at line 204 of file typeIdSet.c.

Referenced by typeIdSet_subtract(), and uentry_hasAccessType().

00205 {
00206   return (t == 0);
00207 }

void typeIdSet_loadTable ( FILE * fin )
 

Definition at line 102 of file typeIdSet.c.

Referenced by BUFLEN().

00103 {
00104   char *s = mstring_create (MAX_DUMP_LINE_LENGTH);  
00105   char *os = s;
00106 
00107   llassert (tistableentries == 1);
00108 
00109   s = fgets (s, MAX_DUMP_LINE_LENGTH, fin);
00110 
00111   while (s != NULL && *s != ';')
00112     {
00113       usymIdSet u = usymIdSet_undump (&s);
00114       
00115       llassert (*s == '\0' || *s == '\n');
00116       
00117       tistable_addDirectEntry (u);
00118       s = fgets (os, MAX_DUMP_LINE_LENGTH, fin);
00119     }
00120 }

bool typeIdSet_member ( typeIdSet t,
typeId el )
 

Definition at line 197 of file typeIdSet.c.

Referenced by context_couldHaveAccess(), context_hasAccess(), and context_hasFileAccess().

00198 {
00199   usymIdSet u = tistable_fetch (t);
00200 
00201   return usymIdSet_member (u, el);
00202 }

typeIdSet typeIdSet_removeFresh ( typeIdSet t,
typeId el )
 

Definition at line 240 of file typeIdSet.c.

Referenced by context_removeFileAccessType().

00241 {
00242   return (tistable_addEntry (usymIdSet_removeFresh (tistable_fetch (t), el)));
00243 }

typeIdSet typeIdSet_single ( typeId t )
 

Definition at line 209 of file typeIdSet.c.

Referenced by context_addBoolAccess(), and uentry_makeFunction().

00210 {
00211   return (tistable_addEntry (usymIdSet_single (t)));
00212 }

typeIdSet typeIdSet_singleOpt ( typeId t )
 

Definition at line 214 of file typeIdSet.c.

00215 {
00216   if (typeId_isValid (t))
00217     {
00218       return (tistable_addEntry (usymIdSet_single (t)));
00219     }
00220   else
00221     {
00222       return typeIdSet_empty;
00223     }
00224 }

typeIdSet typeIdSet_subtract ( typeIdSet s,
typeIdSet t )
 

Definition at line 255 of file typeIdSet.c.

Referenced by context_enterConstantMacro(), context_enterFunction(), and context_enterIterDef().

00256 {
00257   if (typeIdSet_isEmpty (t))
00258     {
00259       return s;
00260     }
00261   else
00262     {
00263       return (tistable_addEntry (usymIdSet_subtract (tistable_fetch (s),
00264                                                      tistable_fetch (t))));
00265     }
00266 }

typeIdSet typeIdSet_undump ( char ** s )
 

Definition at line 273 of file typeIdSet.c.

Referenced by context_loadModuleAccess(), and uentry_undump().

00274 {
00275   int i;
00276 
00277   
00278   i = getInt (s);
00279 
00280   llassert (i >= 0 && i < tistableentries);
00281   return (typeIdSet) i;
00282 }

typeIdSet typeIdSet_union ( typeIdSet t1,
typeIdSet t2 )
 

Definition at line 284 of file typeIdSet.c.

00285 {
00286   if (t1 == typeIdSet_undefined)
00287     {
00288       return t2;
00289     }
00290   else if (t2 == typeIdSet_undefined)
00291     {
00292       return t1;
00293     }
00294   else
00295     {
00296       return (tistable_addEntry (usymIdSet_newUnion (tistable_fetch (t1),
00297                                                      tistable_fetch (t2))));
00298     }
00299 }

cstring typeIdSet_unparse ( typeIdSet t )
 

Definition at line 245 of file typeIdSet.c.

Referenced by context_addFileAccessType(), context_enterFunction(), context_unparse(), and context_unparseAccess().

00246 {
00247   return (usymIdSet_unparse (tistable_fetch (t)));
00248 }


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