home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perlkt40.zip / HASH.H < prev    next >
C/C++ Source or Header  |  1996-06-13  |  1KB  |  58 lines

  1. /* $RCSfile: hash.h,v $$Revision: 4.0.1.1 $$Date: 91/06/07 12:16:04 $
  2.  *
  3.  *    Copyright (c) 1991, Larry Wall
  4.  *
  5.  *    You may distribute under the terms of either the GNU General Public
  6.  *    License or the Artistic License, as specified in the README file.
  7.  *
  8.  * $Log:    hash.h,v $
  9.  * Revision 4.0.1.1  91/06/07  12:16:04  lwall
  10.  * patch4: new copyright notice
  11.  * 
  12.  * Revision 4.0  91/03/20  01:57:53  lwall
  13.  * 4.0 baseline.
  14.  * 
  15.  */
  16.  
  17. #define FILLPCT 60        /* don't make greater than 99 */
  18.  
  19. #ifdef DOINIT
  20. char coeff[] = {
  21.         61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  22.         61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  23.         61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  24.         61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  25.         61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  26.         61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  27.         61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1,
  28.         61,59,53,47,43,41,37,31,29,23,17,13,11,7,3,1};
  29. #else
  30. extern char coeff[];
  31. #endif
  32.  
  33. typedef struct hentry HENT;
  34.  
  35. struct hentry {
  36.     HENT    *hent_next;
  37.     char    *hent_key;
  38.     STR        *hent_val;
  39.     int        hent_hash;
  40. };
  41.  
  42. struct htbl {
  43.     HENT    **tbl_array;
  44.     int        tbl_max;
  45.     int        tbl_fill;
  46.     int        tbl_riter;    /* current root of iterator */
  47.     HENT    *tbl_eiter;    /* current entry of iterator */
  48. };
  49.  
  50. STR *hfetch();
  51. bool hstore();
  52. bool hdelete();
  53. HASH *hnew();
  54. int hiterinit();
  55. HENT *hiternext();
  56. char *hiterkey();
  57. STR *hiterval();
  58.