/* Definitions for TinyMUCK hash tables */

/* Possible data types that may be stored in a hash table */
union u_hash_data {
  int ival;                     /* Store compiler tokens here */
  dbref dbval;                  /* Player hashing will want this */
  int (*func) ();               /* Function call */
  void *pval;                   /* Can't hurt, we might need it someday */
};

/* The actual hash entry for each item */
struct t_hash_entry {
  struct t_hash_entry *next;    /* Pointer for conflict resolution */
  const char *name;             /* The name of the item */
  union u_hash_data dat;        /* Data value for item */
};

typedef union u_hash_data hash_data;
typedef struct t_hash_entry hash_entry;
typedef hash_entry *hash_tab;

#define PLAYER_HASH_SIZE   (1 << 8)     /* Table for player lookups */

extern hash_data *find_hash (const char *s, hash_tab * table, unsigned size);
extern hash_entry *add_hash (const char *name, hash_data data,
  hash_tab * table, unsigned size);
extern int free_hash (const char *name, hash_tab * table, unsigned size);
extern void kill_hash (hash_tab * table, unsigned size);