#include "lclintMacros.nf"#include "basic.h"Go to the source code of this file.
Compounds | |
| struct | StringEntry |
Defines | |
| #define | NULLFACTOR 1 |
Typedefs | |
| typedef Handle | CharIndex |
Functions | |
| lsymbol | lsymbol_fromString (cstring s) |
| lsymbol | lsymbol_fromChars ( char *name) |
| cstring | lsymbol_toString (lsymbol ss) |
| char* | lsymbol_toCharsSafe (lsymbol ss) |
| char* | lsymbol_toChars (lsymbol ss) |
| void | lsymbol_initMod (void) |
| void | lsymbol_destroyMod (void) |
| void | lsymbol_printStats (void) |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 118 of file lsymbol.c. Referenced by LCLProcessInitFileInit(), LCLReserveToken(), LCLScanLine(), LCLScanLineInit(), LSLReserveToken(), abstract_init(), cstring_toSymbol(), lclctype_toSort(), lclctype_toSortDebug(), lscanLine(), lsymbol_fromString(), makeCTypesNode(), processImport(), sort_init(), sort_makeArr(), sort_makeMutable(), sort_makeObj(), sort_makePtr(), and sort_makeVec(). 00119 {
00120 lsymbol ss;
00121 long unsigned hashValue;
00122 unsigned h = 0;
00123 char *p = name;
00124
00125 while (*p != '\0')
00126 {
00127 h = (h << 1) + (unsigned) (*p++);
00128 }
00129
00130 hashValue = h & HASHMASK;
00131
00132 if (hashArray == NULL) /* evs - was MaxIndex == 0 */
00133 {
00134 /* nothing initialized */
00135 ss = AllocEntry (name, hashValue);
00136 }
00137 else
00138 {
00139 ss = hashArray[hashValue]; /* start of hash chain */
00140
00141 if (ss == lsymbol_undefined)
00142 {
00143 /* hash not initialized */
00144 ss = AllocEntry (name, hashValue);
00145 }
00146 else
00147 {
00148 /*
00149 * Traverse hash-chain. Loop terminates when
00150 * a match is found or end of chain is encountered.
00151 */
00152
00153 llassert (Entry != NULL);
00154 llassert (CharString != NULL);
00155
00156 while (strcmp (&CharString[Entry[ss].i], name) != 0)
00157 {
00158 if (lsymbol_undefined == (ss = Entry[ss].HashNext))
00159 {
00160 ss = AllocEntry (name, hashValue);
00161 break;
00162 }
00163 }
00164 }
00165 }
00166
00167 return ss;
00168 }
|
|
|
Definition at line 105 of file lsymbol.c. Referenced by ltoken_createFull(). 00106 {
00107 if (cstring_isUndefined (s))
00108 {
00109 return lsymbol_undefined;
00110 }
00111 else
00112 {
00113 return (lsymbol_fromChars (cstring_toCharsSafe (s)));
00114 }
00115 }
|
|
|
Definition at line 305 of file lsymbol.c. 00307 {
00308 int i;
00309
00310 if (hashArray != NULL)
00311 {
00312 sfree (hashArray);
00313 }
00314
00315 hashArray = (lsymbol *) dmalloc (HASHSIZE * sizeof (*hashArray));
00316
00317 for (i = 0; i < HASHSIZE; i++)
00318 {
00319 hashArray[i] = lsymbol_undefined;
00320 }
00321
00322 MaxChar = 0;
00323 MaxEntry = 0;
00324
00325 FreeChar = 0;
00326 FreeEntry = 0;
00327
00328 CharString = (char *) 0;
00329 Entry = (StringEntry *) 0;
00330 /*@-compdef@*/
00331 }
|
|
|
Definition at line 344 of file lsymbol.c. 00345 {
00346 /* only for debugging */
00347 printf ("Number of lsymbols generated = %d\n", (int) FreeEntry);
00348 }
|
|
|
Definition at line 188 of file lsymbol.c. Referenced by lsymbol_toCharsSafe(), and outputLCSFile(). 00189 {
00190 if (lsymbol_isDefined (ss))
00191 {
00192 if (ss >= FreeEntry)
00193 {
00194 llcontbug (message ("lsymbol_toChars: invalid lsymbol: %d", ss));
00195 return NULL;
00196 }
00197
00198 llassert (Entry != NULL);
00199 llassert (CharString != NULL);
00200
00201 return &CharString[Entry[ss].i];
00202 }
00203 else
00204 {
00205 return NULL;
00206 }
00207 }
|
|
|
Definition at line 176 of file lsymbol.c. Referenced by processImport(), sort_dump(), and sort_getName(). 00177 {
00178 char *ret = lsymbol_toChars (ss);
00179
00180 if (ret == NULL)
00181 {
00182 ret = mstring_create (0);
00183 }
00184
00185 return ret;
00186 }
|
|
|
Definition at line 170 of file lsymbol.c. Referenced by ltoken_unparse(), and sort_import(). 00171 {
00172 return (cstring_fromChars (lsymbol_toChars (ss)));
00173 }
|
1.2.3 written by Dimitri van Heesch,
© 1997-2000