]> andersk Git - splint.git/blob - src/Headers/cpphash.h
*** empty log message ***
[splint.git] / src / Headers / cpphash.h
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. */
9 typedef union u_hashvalue {
10   int ival;
11   /*@owned@*/ char *cpval;
12   /*@owned@*/ DEFINITION *defn;
13 } hashValue;
14
15 struct s_hashNode {
16   /* double links for easy deletion */
17   /*@only@*/ /*@null@*/ hashNode next;
18   /*@dependent@*/ /*@null@*/ hashNode prev;
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
26   /*@null@*/ /*@dependent@*/ hashNode *bucket_hdr;
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 */
31   hashValue value;              /* pointer to expansion, or whatever */
32 } ;
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
41 extern void cppReader_deleteMacro (/*@exposed@*/ hashNode p_hp) 
42      /*@modifies internalState, *p_hp@*/;
43
44 extern /*@exposed@*/ hashNode cppReader_install (char *, int, 
45                                                   enum node_type, int, 
46                                                   /*@only@*/ /*@null@*/ char *, int);
47
48 extern void cppReader_hashCleanup (void);
49 extern /*@null@*/ /*@exposed@*/ hashNode cppReader_lookup (char *, int, int); 
50 extern /*@null@*/ /*@exposed@*/ hashNode cppReader_lookupExpand (char *, int, int); 
51
52 extern void cppReader_saveHashtab (void);
53 extern void cppReader_restoreHashtab (void);
54 extern int hashf (const char *p_name, int p_len, int p_hashsize);
55
56 extern /*@exposed@*/ hashNode 
57 cppReader_installMacro (char *p_name, int p_len, 
58                         /*@only@*/ struct definition *p_defn, int p_hash);
59
60 # else
61 # error "Multiple include"
62 # endif
This page took 0.298054 seconds and 5 git commands to generate.