You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

hash.h 1.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* $Header: hash.h,v 1.0 87/12/18 13:05:20 root Exp $
  2. *
  3. * $Log: hash.h,v $
  4. * Revision 1.0 87/12/18 13:05:20 root
  5. * Initial revision
  6. *
  7. */
  8. #define FILLPCT 60 /* don't make greater than 99 */
  9. #ifdef DOINIT
  10. char coeff[] = {
  11. 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  12. 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  13. 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  14. 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  15. 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  16. 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  17. 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  18. 61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1};
  19. #else
  20. extern char coeff[];
  21. #endif
  22. typedef struct hentry HENT;
  23. struct hentry {
  24. HENT *hent_next;
  25. char *hent_key;
  26. STR *hent_val;
  27. int hent_hash;
  28. };
  29. struct htbl {
  30. HENT **tbl_array;
  31. int tbl_max;
  32. int tbl_fill;
  33. int tbl_riter; /* current root of iterator */
  34. HENT *tbl_eiter; /* current entry of iterator */
  35. };
  36. STR *hfetch();
  37. bool hstore();
  38. bool hdelete();
  39. HASH *hnew();
  40. int hiterinit();
  41. HENT *hiternext();
  42. char *hiterkey();
  43. STR *hiterval();