]> andersk Git - splint.git/blame - src/Headers/cpphash.h
Fixed some splintme errors from the previous code change.
[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;
abd7f895 11 /*@null@*/ /*@owned@*/ char *cpval;
885824d3 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 */
abd7f895 29 size_t length; /* length of token, for quick comparison */
885824d3 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);
abd7f895 50extern /*@null@*/ /*@exposed@*/ hashNode cpphash_lookupExpand (char *, int, int,
51 bool p_forceExpand);
885824d3 52
abd7f895 53extern int cpphash_hashCode (const char *p_name, size_t p_len, int p_hashsize) /*@*/ ;
885824d3 54extern void cppReader_saveHashtab (void);
55extern void cppReader_restoreHashtab (void);
885824d3 56
cd7d9b17 57extern /*@exposed@*/ hashNode
abd7f895 58cpphash_installMacro (char *p_name, size_t p_len,
3e3ec469 59 /*@only@*/ struct definition *p_defn, int p_hash);
885824d3 60
61# else
62# error "Multiple include"
63# endif
This page took 0.076148 seconds and 5 git commands to generate.