home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / misc / amicvs1-0.lha / AmiCVS / scr / hash.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-04-01  |  1.5 KB  |  78 lines

  1. /* @(#)hash.h 1.18 92/03/31     */
  2.  
  3. /*
  4.  * Copyright (c) 1992, Brian Berliner and Jeff Polk
  5.  * 
  6.  * You may distribute under the terms of the GNU General Public License as
  7.  * specified in the README file that comes with the CVS 1.3 kit.
  8.  */
  9.  
  10. /*
  11.  * The number of buckets for the hash table contained in each list.  This
  12.  * should probably be prime.
  13.  */
  14. #define HASHSIZE    151
  15.  
  16. /*
  17.  * Types of nodes
  18.  */
  19. enum ntype
  20. {
  21.     UNKNOWN, HEADER, ENTRIES, FILES, LIST, RCSNODE,
  22.     RCSVERS, DIRS, UPDATE, LOCK, NDBMNODE
  23. };
  24. typedef enum ntype Ntype;
  25.  
  26. struct node
  27. {
  28.     Ntype type;
  29.     struct node *next;
  30.     struct node *prev;
  31.     struct node *hashnext;
  32.     struct node *hashprev;
  33.     char *key;
  34.     char *data;
  35.     void (*delproc) ();
  36. };
  37. typedef struct node Node;
  38.  
  39. struct list
  40. {
  41.     Node *list;
  42.     Node *hasharray[HASHSIZE];
  43.     struct list *next;
  44. };
  45. typedef struct list List;
  46.  
  47. struct entnode
  48. {
  49.     char *version;
  50.     char *timestamp;
  51.     char *options;
  52.     char *tag;
  53.     char *date;
  54. };
  55. typedef struct entnode Entnode;
  56.  
  57. #if __STDC__
  58. List *getlist (void);
  59. Node *findnode (List * list, char *key);
  60. Node *getnode (void);
  61. int addnode (List * list, Node * p);
  62. int walklist (List * list, int (*proc) ());
  63. void dellist (List ** listp);
  64. void delnode (Node * p);
  65. void freenode (Node * p);
  66. void sortlist (List * list, int (*comp) ());
  67. #else
  68. List *getlist ();
  69. Node *findnode ();
  70. Node *getnode ();
  71. int addnode ();
  72. int walklist ();
  73. void dellist ();
  74. void delnode ();
  75. void freenode ();
  76. void sortlist ();
  77. #endif                /* __STDC__ */
  78.