home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Source / GNU / gcc / cpphash.h < prev    next >
C/C++ Source or Header  |  1995-12-29  |  1KB  |  39 lines

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