Imported Upstream version 1.7.1
[platform/upstream/edje.git] / src / bin / epp / cpphash.h
1 enum node_type;
2
3 /* different kinds of things that can appear in the value field
4    of a hash node.  Actually, this may be useless now. */
5 union hashval {
6    int                 ival;
7    char               *cpval;
8    DEFINITION         *defn;
9 };
10
11 struct hashnode {
12    struct hashnode    *next;    /* double links for easy deletion */
13    struct hashnode    *prev;
14    struct hashnode   **bucket_hdr;      /* also, a back pointer to this node's hash
15                                          * chain is kept, in case the node is the head
16                                          * of the chain and gets deleted. */
17    enum node_type      type;    /* type of special token */
18    int                 length;  /* length of token, for quick comparison */
19    char               *name;    /* the actual name */
20    union hashval       value;   /* pointer to expansion, or whatever */
21 };
22
23 typedef struct hashnode HASHNODE;
24
25 /* Some definitions for the hash table.  The hash function MUST be
26    computed as shown in hashf () below.  That is because the rescan
27    loop computes the hash value `on the fly' for most tokens,
28    in order to avoid the overhead of a lot of procedure calls to
29    the hashf () function.  Hashf () only exists for the sake of
30    politeness, for use when speed isn't so important. */
31
32 #define HASHSIZE 1403
33 #define HASHSTEP(old, c) ((old << 2) + c)
34 #define MAKE_POS(v) (v & 0x7fffffff)    /* make number positive */
35
36 extern int          hashf(const char *name, int len, int hashsize);
37 extern HASHNODE    *cpp_lookup(const char *name, int len, int hash);
38 extern void         delete_macro(HASHNODE * hp);
39 extern HASHNODE    *install(const char *name, int len, enum node_type type,
40                             int ivalue, char *value, int hash);
41 extern void         cpp_hash_cleanup(cpp_reader * pfile);