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

structNames.c File Reference

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

Go to the source code of this file.

Defines

#define MARKCHAR_STRUCT   '@'
#define MARKCHAR_UNION   '$'
#define MARKCHAR_ENUM   '&'
#define MARKCHAR_PARAM   '%'

Functions

cstring fixTagName (cstring s)
cstring makeParam (cstring s)
cstring fixParamName (cstring s)
cstring makeStruct (cstring s)
cstring makeUnion (cstring s)
cstring makeEnum (cstring s)
void setTagNo (unsigned int n)
bool isFakeTag (cstring s)
cstring fakeTag ()


Define Documentation

#define MARKCHAR_ENUM   '&'
 

Definition at line 41 of file structNames.c.

#define MARKCHAR_PARAM   '%'
 

Definition at line 44 of file structNames.c.

#define MARKCHAR_STRUCT   '@'
 

Definition at line 35 of file structNames.c.

#define MARKCHAR_UNION   '$'
 

Definition at line 38 of file structNames.c.


Function Documentation

cstring fakeTag ( )
 

Definition at line 144 of file structNames.c.

Referenced by ctype_createUnnamedStruct(), and ctype_createUnnamedUnion().

00145 {
00146   tagno++;
00147 
00148   return (message ("!%u", tagno));
00149 }

cstring fixParamName ( cstring s )
 

Definition at line 93 of file structNames.c.

00094 {
00095   if (cstring_length(s) < 1)
00096     {
00097       return cstring_undefined;
00098     }
00099 
00100   if (cstring_firstChar (s) != MARKCHAR_PARAM)
00101     {
00102       llbug (message ("fixParamName (no #): %s", s));
00103     }
00104 
00105   return (cstring_suffix (s, 1));
00106 }

cstring fixTagName ( cstring s )
 

Definition at line 46 of file structNames.c.

Referenced by uentry_getName().

00047 {
00048   if (isFakeTag (s))
00049     {
00050       switch (cstring_firstChar (s))
00051         {
00052         case MARKCHAR_STRUCT: return (cstring_makeLiteral ("struct"));
00053         case MARKCHAR_UNION:  return (cstring_makeLiteral ("union"));
00054         case MARKCHAR_ENUM:   return (cstring_makeLiteral ("enum"));
00055         default:         return (message ("<bad tag name: %s>", s));
00056           /* BADDEFAULT; */
00057         }
00058     }
00059   else
00060     {
00061       if (cstring_isDefined (s)) {
00062         switch (cstring_firstChar (s))
00063           {
00064           case MARKCHAR_STRUCT:
00065             return (message ("struct %s", cstring_suffix (s, 1)));
00066           case MARKCHAR_UNION: 
00067             return (message ("union %s", cstring_suffix (s, 1)));
00068           case MARKCHAR_ENUM:   
00069             return (message ("enum %s", cstring_suffix (s, 1)));
00070             BADDEFAULT;
00071           }
00072       } else {
00073         return (cstring_makeLiteral ("<missing tag name>"));
00074       }
00075     }
00076 }

bool isFakeTag ( cstring s )
 

Definition at line 136 of file structNames.c.

Referenced by fixTagName(), and usymtab_enumEnumNameListType().

00137 {
00138   int length = cstring_length (s);
00139 
00140   return ((length >= 1 && cstring_firstChar (s) == '!')
00141           || (length >= 2 && cstring_getChar (s, 2) == '!'));
00142 }

cstring makeEnum ( cstring s )
 

Definition at line 123 of file structNames.c.

Referenced by uentry_makeEnumTag(), uentry_makeEnumTagLoc(), usymtab_existsEnumTag(), and usymtab_lookupEnumTag().

00124 {
00125   return (cstring_prependChar (MARKCHAR_ENUM, s));
00126 }

cstring makeParam ( cstring s )
 

Definition at line 78 of file structNames.c.

Referenced by fixModifiesId(), fixSpecClausesId(), processNamedDecl(), sRef_isMacroParamRef(), and uentry_setParam().

00079 {
00080   if (cstring_length(s) > 0 && cstring_firstChar (s) == MARKCHAR_PARAM)
00081     {
00082       llbug (message ("makeParam: %s\n", s));
00083     }
00084 
00085   if (cstring_isUndefined (s))
00086     {
00087       return cstring_undefined;
00088     }
00089 
00090   return (cstring_prependChar (MARKCHAR_PARAM, s));  
00091 }

cstring makeStruct ( cstring s )
 

Definition at line 108 of file structNames.c.

Referenced by uentry_makeStructTag(), uentry_makeStructTagLoc(), usymtab_existsStructTag(), and usymtab_lookupStructTag().

00109 {
00110   if (cstring_firstChar (s) == '@')
00111     {
00112       llbug (message ("makeStruct: %s\n", s));
00113     }
00114 
00115   return (cstring_prependChar (MARKCHAR_STRUCT, s));
00116 }

cstring makeUnion ( cstring s )
 

Definition at line 118 of file structNames.c.

Referenced by uentry_makeUnionTag(), uentry_makeUnionTagLoc(), usymtab_existsUnionTag(), and usymtab_lookupUnionTag().

00119 {
00120   return (cstring_prependChar (MARKCHAR_UNION, s));
00121 }

void setTagNo ( unsigned int n )
 

Definition at line 130 of file structNames.c.

00131 {
00132   if (n > tagno)
00133     tagno = n;
00134 }


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