home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dosdisas.zip / dispsrch.zip / PERFHLIB.H < prev    next >
C/C++ Source or Header  |  1993-07-26  |  1KB  |  33 lines

  1. /* Perfect hashing function library. Contains functions to generate perfect
  2.     hashing functions */
  3.  
  4.  
  5. #define TRUE 1
  6. #define FALSE 0
  7. #define bool unsigned char
  8. #define byte unsigned char
  9. #define word unsigned short
  10.  
  11. /* Prototypes */
  12. void hashParams(int NumEntry, int EntryLen, int SetSize, char SetMin,
  13.                     int NumVert);    /* Set the parameters for the hash table */
  14. void hashCleanup(void);            /* Frees memory allocated by hashParams() */
  15. void map(void);                    /* Part 1 of creating the tables */
  16. void assign(void);                /* Part 2 of creating the tables */
  17. int  hash(byte *s);                /* Hash the string to an int 0 .. NUMENTRY-1 */
  18.  
  19. word *readT1(void);                /* Returns a pointer to the T1 table */
  20. word *readT2(void);                /* Returns a pointer to the T2 table */
  21. word *readG(void);                /* Returns a pointer to the g  table */
  22.  
  23.  
  24. /* The application must provide these functions: */
  25. void getKey(int i, byte **pKeys);/* Set *keys to point to the i+1th key */
  26. void dispKey(int i);            /* Display the key */
  27.  
  28.  
  29. /* Macro reads a LH word from the image regardless of host convention */
  30. #ifndef LH
  31. #define LH(p)  ((int)((byte *)(p))[0] + ((int)((byte *)(p))[1] << 8))
  32. #endif
  33.