]> andersk Git - splint.git/blob - src/Headers/cpphash.h
Fixed line numbering when multi-line macro parameters are used.
[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   /*@null@*/ /*@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   size_t 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 cpphash_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 cpphash_lookup (char *, int, int); 
50 extern /*@null@*/ /*@exposed@*/ hashNode cpphash_lookupExpand (char *, int, int,
51                                                                bool p_forceExpand); 
52
53 extern int cpphash_hashCode (const char *p_name, size_t p_len, int p_hashsize) /*@*/ ;
54 extern void cppReader_saveHashtab (void);
55 extern void cppReader_restoreHashtab (void);
56
57 extern /*@exposed@*/ hashNode 
58 cpphash_installMacro (char *p_name, size_t p_len, 
59                       /*@only@*/ struct definition *p_defn, int p_hash);
60
61 # else
62 # error "Multiple include"
63 # endif
This page took 0.051672 seconds and 5 git commands to generate.