st.h


DEFINITIONS

This source file includes following functions.


   1  /* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
   2  
   3  /* @(#) st.h 5.1 89/12/14 */
   4  
   5  #ifndef ST_INCLUDED
   6  
   7  #define ST_INCLUDED
   8  
   9  typedef struct st_table st_table;
  10  
  11  struct st_hash_type {
  12      int (*compare)();
  13      int (*hash)();
  14  };
  15  
  16  struct st_table {
  17      struct st_hash_type *type;
  18      int num_bins;
  19      int num_entries;
  20      struct st_table_entry **bins;
  21  };
  22  
  23  #define st_is_member(table,key) st_lookup(table,key,(char **)0)
  24  
  25  enum st_retval {ST_CONTINUE, ST_STOP, ST_DELETE};
  26  
  27  st_table *st_init_table();
  28  st_table *st_init_table_with_size();
  29  st_table *st_init_numtable();
  30  st_table *st_init_numtable_with_size();
  31  st_table *st_init_strtable();
  32  st_table *st_init_strtable_with_size();
  33  int st_delete(), st_delete_safe();
  34  int st_insert(), st_lookup();
  35  void st_foreach(), st_add_direct(), st_free_table(), st_cleanup_safe();
  36  st_table *st_copy();
  37  
  38  #define ST_NUMCMP       ((int (*)()) 0)
  39  #define ST_NUMHASH      ((int (*)()) -2)
  40  
  41  #define st_numcmp       ST_NUMCMP
  42  #define st_numhash      ST_NUMHASH
  43  
  44  int st_strhash();
  45  
  46  #endif /* ST_INCLUDED */