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

macrocache.c File Reference

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

Go to the source code of this file.

Defines

#define MCEBASESIZE   8
#define DNE   -1
#define SEEK_CUR   1
#define SEEK_SET   0

Functions

macrocache macrocache_create (void)
void macrocache_free (macrocache s)
void macrocache_addEntry (macrocache s, fileloc fl, cstring def)
void macrocache_addComment (macrocache s, fileloc fl, cstring def)
cstring macrocache_unparse (macrocache m)
void macrocache_processUndefinedElements (macrocache m)
fileloc macrocache_processFileElements (macrocache m, cstring base)
void macrocache_finalize (void)


Define Documentation

#define DNE   -1
 

Definition at line 40 of file macrocache.c.

#define MCEBASESIZE   8
 

Definition at line 37 of file macrocache.c.

#define SEEK_CUR   1
 

#define SEEK_SET   0
 


Function Documentation

void macrocache_addComment ( macrocache s,
fileloc fl,
cstring def )
 

Definition at line 180 of file macrocache.c.

Referenced by context_addComment().

00181 {
00182   macrocache_addGenEntry (s, fl, def, TRUE);
00183 }

void macrocache_addEntry ( macrocache s,
fileloc fl,
cstring def )
 

Definition at line 173 of file macrocache.c.

Referenced by context_addMacroCache().

00174 {
00175   macrocache_addGenEntry (s, fl, def, FALSE);
00176 }

macrocache macrocache_create ( void )
 

Definition at line 78 of file macrocache.c.

Referenced by context_initMod().

00079 {
00080   macrocache s = (macrocache) dmalloc (sizeof (*s));
00081 
00082   s->entries = 0;
00083   s->nspace = MCEBASESIZE;
00084   s->contents = (mce *) dmalloc (sizeof (*s->contents) * MCEBASESIZE);
00085 
00086   mcDisable = FALSE;
00087 
00088   return (s);
00089 }

void macrocache_finalize ( void )
 

Definition at line 401 of file macrocache.c.

Referenced by context_processAllMacros().

00402 {
00403   if (s_macFile != NULL)
00404     {
00405       check (fclose (s_macFile) == 0);
00406       s_macFile = NULL;
00407     }
00408 }

void macrocache_free ( macrocache s )
 

Definition at line 92 of file macrocache.c.

Referenced by context_destroyMod().

00093 {
00094   int i;
00095 
00096   llassert (s_macFile == NULL);
00097 
00098   for (i = 0; i < s->entries; i++)
00099     {
00100       mce_free (s->contents[i]);
00101     }
00102 
00103   sfree (s->contents);
00104   sfree (s);
00105 }

fileloc macrocache_processFileElements ( macrocache m,
cstring base )
 

Definition at line 371 of file macrocache.c.

00372 {
00373   fileloc lastfl = fileloc_undefined;
00374   int i;
00375  
00376   mcDisable = TRUE;
00377 
00378   for (i = 0; i < m->entries; i++) 
00379     {
00380       if (m->contents[i]->defined)
00381         {
00382           ;
00383         }
00384       else 
00385         { 
00386           fileloc fl = m->contents[i]->fl;  /* should be dependent! */
00387           cstring fb = fileloc_getBase (fl);
00388 
00389           if (cstring_equal (fb, base))
00390             {
00391               lastfl = fl;
00392               macrocache_processMacro (m, i);   
00393             }
00394         }
00395     }
00396 
00397   mcDisable = FALSE;
00398   return lastfl;
00399 }

void macrocache_processUndefinedElements ( macrocache m )
 

Definition at line 324 of file macrocache.c.

Referenced by context_processAllMacros().

00325 {
00326   fileloc lastfl = fileloc_undefined;
00327   int i;
00328  
00329   mcDisable = TRUE;
00330 
00331   DPRINTF (("Processing undefined elements"));
00332 
00333   if (!context_getFlag (FLG_PARTIAL))
00334     {
00335       for (i = 0; i < m->entries; i++) 
00336         {
00337           if (m->contents[i]->defined)
00338             {
00339               ;
00340             }
00341           else 
00342             { 
00343               fileloc fl = m->contents[i]->fl; 
00344               
00345               if (fileloc_isDefined (lastfl) && fileloc_sameFile (fl, lastfl)) 
00346                 {
00347                   ;
00348                 }
00349               else
00350                 {
00351                   if (context_getFlag (FLG_SHOWSCAN))
00352                     {
00353                       if (!fileloc_isLib (fl))
00354                         {
00355                           lldiagmsg (message ("< checking macros %s >", fileloc_filename (fl)));
00356                         }
00357                     }
00358                   
00359                   lastfl = fl;
00360                   cleanupMessages ();
00361                 }
00362               
00363               macrocache_processMacro (m, i);   
00364             }
00365         }
00366     }
00367 
00368   mcDisable = FALSE;
00369 }

cstring macrocache_unparse ( macrocache m )
 

Definition at line 200 of file macrocache.c.

00201 {
00202   cstring s = cstring_undefined;
00203   int i;
00204 
00205   for (i = 0; i < m->entries; i++)
00206     {
00207       fileloc fl = m->contents[i]->fl;
00208       cstring def = m->contents[i]->def;
00209       bool defined = m->contents[i]->defined;
00210       
00211       s = message ("%q%q: %s [%s]\n", s, fileloc_unparse (fl), def, 
00212                    bool_unparse (defined));
00213     }
00214   
00215   return (s);
00216 }


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