2 * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3 * See the copyright notice in the ACK home directory, in the file "Copyright".
5 /* $Id: idf.str,v 3.9 1994/06/24 12:04:03 ceriel Exp $ */
6 /* IDENTIFIER DESCRIPTOR */
10 /* Since the % operation in the calculation of the hash function
11 turns out to be expensive, it is replaced by the cheaper XOR (^).
12 Each character of the identifier is xored with an 8-bit mask which
13 depends on the position of the character; the sum of these results
14 is the hash value. The random masks are obtained from a
15 congruence generator in idf.c.
18 #define HASHSIZE 256 /* must be a power of 2 */
19 #define HASH_X 0253 /* Knuth's X */
20 #define HASH_A 77 /* Knuth's a */
21 #define HASH_C 153 /* Knuth's c */
23 extern char hmask[]; /* the random masks */
24 #define HASHMASK (HASHSIZE-1) /* since it is a power of 2 */
25 #define STARTHASH() (0)
26 #define ENHASH(hs,ch,ps) (hs + (ch ^ hmask[ps]))
27 #define STOPHASH(hs) (hs & HASHMASK)
33 struct macro *id_macro;
34 int id_resmac; /* if nonzero: keyword of macroproc. */
36 int id_reserved; /* non-zero for reserved words */
37 char *id_file; /* file containing the occurrence */
38 unsigned int id_line; /* line number of the occurrence */
39 struct def *id_def; /* variables, typedefs, enum-constants */
40 struct sdef *id_sdef; /* selector tags */
41 struct tag *id_struct; /* struct and union tags */
42 struct tag *id_enum; /* enum tags */
43 int id_special; /* special action needed at occurrence */
46 /* ALLOCDEF "idf" 50 */
48 extern struct idf *str2idf(), *idf_hashed();
51 extern struct idf *gen_idf();