src/htab.h

Go to the documentation of this file.
00001 
00002 /* htab.h - Structures and declarations needed for table hashing */
00003 
00004 /* $Id: htab.h,v 1.3 2005/08/08 09:43:07 murrayma Exp $ */
00005 
00006 #include "copyright.h"
00007 #include "rbtab.h"
00008 #ifndef __HTAB_H
00009 #define __HTAB_H
00010 #if 0
00011 
00012 #include "config.h"
00013 #include "db.h"
00014 
00015 typedef struct hashentry HASHENT;
00016 struct hashentry {
00017     char *target;
00018     int *data;
00019     int checks;
00020     struct hashentry *next;
00021 };
00022 
00023 typedef struct num_hashentry NHSHENT;
00024 struct num_hashentry {
00025     int target;
00026     int *data;
00027     int checks;
00028     struct num_hashentry *next;
00029 };
00030 
00031 typedef struct hasharray HASHARR;
00032 struct hasharray {
00033     HASHENT *element[800];
00034 };
00035 
00036 typedef struct num_hasharray NHSHARR;
00037 struct num_hasharray {
00038     NHSHENT *element[800];
00039 };
00040 
00041 typedef struct hashtable HASHTAB;
00042 struct hashtable {
00043     int hashsize;
00044     int mask;
00045     int checks;
00046     int scans;
00047     int max_scan;
00048     int hits;
00049     int entries;
00050     int deletes;
00051     int nulls;
00052     HASHARR *entry;
00053     int last_hval;              /* Used for hashfirst & hashnext. */
00054     HASHENT *last_entry;        /* like last_hval */
00055 };
00056 
00057 typedef struct num_hashtable NHSHTAB;
00058 struct num_hashtable {
00059     int hashsize;
00060     int mask;
00061     int checks;
00062     int scans;
00063     int max_scan;
00064     int hits;
00065     int entries;
00066     int deletes;
00067     int nulls;
00068     NHSHARR *entry;
00069     int last_hval;
00070     NHSHENT *last_entry;
00071 };
00072 
00073 typedef struct name_table NAMETAB;
00074 struct name_table {
00075     char *name;
00076     int minlen;
00077     int perm;
00078     int flag;
00079 };
00080 
00081 extern void hashinit(HASHTAB *, int);
00082 extern void hashreset(HASHTAB *);
00083 extern int hashval(char *, int);
00084 extern int get_hashmask(int *);
00085 extern int *hashfind(char *, HASHTAB *);
00086 extern int hashadd(char *, int *, HASHTAB *);
00087 extern void hashdelete(char *, HASHTAB *);
00088 extern void hashflush(HASHTAB *, int);
00089 extern int hashrepl(char *, int *, HASHTAB *);
00090 extern void hashreplall(int *, int *, HASHTAB *);
00091 extern char *hashinfo(const char *, HASHTAB *);
00092 extern int *nhashfind(int, NHSHTAB *);
00093 extern int nhashadd(int, int *, NHSHTAB *);
00094 extern void nhashdelete(int, NHSHTAB *);
00095 extern void nhashflush(NHSHTAB *, int);
00096 extern int nhashrepl(int, int *, NHSHTAB *);
00097 extern int search_nametab(dbref, NAMETAB *, char *);
00098 extern NAMETAB *find_nametab_ent(dbref, NAMETAB *, char *);
00099 extern void display_nametab(dbref, NAMETAB *, char *, int);
00100 extern void interp_nametab(dbref, NAMETAB *, int, char *, char *, char *);
00101 extern void listset_nametab(dbref, NAMETAB *, int, char *, int);
00102 extern int *hash_nextentry(HASHTAB * htab);
00103 extern int *hash_firstentry(HASHTAB * htab);
00104 extern char *hash_firstkey(HASHTAB * htab);
00105 extern char *hash_nextkey(HASHTAB * htab);
00106 extern int *nhash_nextentry(NHSHTAB * htab);
00107 extern int *nhash_firstentry(NHSHTAB * htab);
00108 
00109 extern NAMETAB powers_nametab[];
00110 
00111 #define nhashinit(h,s) hashinit((HASHTAB *)h, s)
00112 #define nhashreset(h) hashreset((HASHTAB *)h)
00113 #define nhashinfo(t,h) hashinfo(t,(HASHTAB *)h)
00114 #endif
00115 #endif

Generated on Mon May 28 04:25:24 2007 for BattletechMUX by  doxygen 1.4.7