]> andersk Git - splint.git/blame - src/Headers/cpphash.h
Fixed state clauses. Added obvious loop exec checking.
[splint.git] / src / Headers / cpphash.h
CommitLineData
885824d3 1# ifndef CPPHASH_H
2# define CPPHASH_H
3
4/*@constant int CPP_HASHSIZE@*/
5# define CPP_HASHSIZE 1403
6
7/* different kinds of things that can appear in the value field
8 of a hash node. Actually, this may be useless now. */
cd7d9b17 9typedef union u_hashvalue {
885824d3 10 int ival;
11 /*@owned@*/ char *cpval;
12 /*@owned@*/ DEFINITION *defn;
cd7d9b17 13} hashValue;
885824d3 14
cd7d9b17 15struct s_hashNode {
885824d3 16 /* double links for easy deletion */
cd7d9b17 17 /*@only@*/ /*@null@*/ hashNode next;
18 /*@dependent@*/ /*@null@*/ hashNode prev;
885824d3 19
20 /*
21 ** Also, a back pointer to this node's hash
22 ** chain is kept, in case the node is the head
23 ** of the chain and gets deleted.
24 */
25
cd7d9b17 26 /*@null@*/ /*@dependent@*/ hashNode *bucket_hdr;
885824d3 27
28 enum node_type type; /* type of special token */
29 int length; /* length of token, for quick comparison */
30 cstring name; /* the actual name */
cd7d9b17 31 hashValue value; /* pointer to expansion, or whatever */
32} ;
885824d3 33
34/* Some definitions for the hash table. The hash function MUST be
35 computed as shown in hashf () below. That is because the rescan
36 loop computes the hash value `on the fly' for most tokens,
37 in order to avoid the overhead of a lot of procedure calls to
38 the hashf () function. Hashf () only exists for the sake of
39 politeness, for use when speed isn't so important. */
40
cd7d9b17 41extern void cppReader_deleteMacro (/*@exposed@*/ hashNode p_hp)
ccf0a4a8 42 /*@modifies internalState, p_hp@*/;
885824d3 43
3e3ec469 44extern /*@exposed@*/ hashNode cpphash_install (char *, int,
885824d3 45 enum node_type, int,
46 /*@only@*/ /*@null@*/ char *, int);
47
48extern void cppReader_hashCleanup (void);
3e3ec469 49extern /*@null@*/ /*@exposed@*/ hashNode cpphash_lookup (char *, int, int);
50extern /*@null@*/ /*@exposed@*/ hashNode cpphash_lookupExpand (char *, int, int, bool p_forceExpand);
885824d3 51
3e3ec469 52extern int cpphash_hashCode (const char *p_name, int p_len, int p_hashsize) /*@*/ ;
885824d3 53extern void cppReader_saveHashtab (void);
54extern void cppReader_restoreHashtab (void);
885824d3 55
cd7d9b17 56extern /*@exposed@*/ hashNode
3e3ec469 57cpphash_installMacro (char *p_name, int p_len,
58 /*@only@*/ struct definition *p_defn, int p_hash);
885824d3 59
60# else
61# error "Multiple include"
62# endif
This page took 0.059535 seconds and 5 git commands to generate.