home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / fax-3.2.1 / lib / libutil / hash.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-31  |  1.9 KB  |  121 lines

  1. /*
  2.   This file is part of the NetFax system.
  3.  
  4.   (c) Copyright 1989 by David M. Siegel and Sundar Narasimhan.
  5.       All rights reserved.
  6.  
  7.     This program is free software; you can redistribute it and/or modify
  8.     it under the terms of the GNU General Public License as published by
  9.     the Free Software Foundation.
  10.  
  11.     This program is distributed in the hope that it will be useful, 
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of 
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. */
  20.  
  21. #ifndef INChashh
  22. #define INChashh 1
  23.  
  24. typedef struct _htentry {
  25.     char *ht_key;
  26.     char *ht_data;
  27.     struct _htentry *ht_next;
  28. } HTENTRY;
  29.  
  30. typedef struct _httable {
  31.     HTENTRY **ht_entries;
  32.     int ht_size;
  33.     int ht_keysize;
  34.     int ht_noe;
  35.     int ht_noc;
  36. } HTTABLE;
  37.  
  38. #define htnoe(x) x->ht_noe
  39. #define htnoc(x) x->ht_noc
  40.  
  41. /*
  42.   Prototypes:
  43. */
  44.  
  45. HTTABLE *htinit(
  46. #ifdef _PROTO
  47.     int size,
  48.     int keysize
  49. #endif
  50. );
  51.  
  52. void htfree(
  53. #ifdef _PROTO
  54.     HTTABLE *table
  55. #endif
  56. );
  57.  
  58. /*VARARGS*/
  59. int htmap();
  60.  
  61. void htstat(
  62. #ifdef _PROTO
  63.     FILE *fp,
  64.     HTTABLE *table
  65. #endif
  66. );
  67.  
  68. int hthash(
  69. #ifdef _PROTO
  70.     char *s,
  71.     HTTABLE *table
  72. #endif
  73. );
  74.  
  75. HTENTRY *htlookup(
  76. #ifdef _PROTO
  77.     char *str,
  78.     HTTABLE *table
  79. #endif
  80. );
  81.  
  82. char *htgetdata(
  83. #ifdef _PROTO
  84.     char *str,
  85.     HTTABLE *table
  86. #endif
  87. );
  88.  
  89. HTENTRY *htadd_hte(
  90. #ifdef _PROTO
  91.     char *str,
  92.     HTTABLE *table,
  93.     HTENTRY *hte,
  94.     char *data
  95. #endif
  96. );
  97.  
  98. HTENTRY *htadd(
  99. #ifdef _PROTO
  100.     char *str,
  101.     HTTABLE *table,
  102.     char *data
  103. #endif
  104. );
  105.  
  106. HTENTRY *htdelete_hte(
  107. #ifdef _PROTO
  108.     char *str,
  109.     HTTABLE *table
  110. #endif
  111. );
  112.  
  113. int htdelete(
  114. #ifdef _PROTO
  115.     char *str,
  116.     HTTABLE *table
  117. #endif
  118. );
  119.  
  120. #endif
  121.