home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftptest.leeds.ac.uk
/
2015.02.ftptest.leeds.ac.uk.tar
/
ftptest.leeds.ac.uk
/
bionet
/
CAE-GROUP
/
SCL-WIN3x
/
SCL.EXE
/
SCL_HASH.H
< prev
next >
Wrap
C/C++ Source or Header
|
1994-08-06
|
3KB
|
120 lines
#ifndef SCL_HASH_H
#define SCL_HASH_H
/*
* NIST Utils Class Library
* clutils/scl_hash.h
* February, 1994
* David Sauder
* K. C. Morris
* Development of this software was funded by the United States Government,
* and is not subject to copyright.
*/
/* $Id: scl_hash.h,v 2.0.1.1 1994/04/05 16:44:11 sauderd Exp $ */
/************************************************************************
** Hash_Table: Hash_Table
** Description:
**
** Largely based on code written by ejp@ausmelb.oz
**
** Constants:
** HASH_TABLE_NULL - the null Hash_Table
**
************************************************************************/
/*
* This work was supported by the United States Government, and is
* not subject to copyright.
*
* $Log: scl_hash.h,v $
* Revision 2.0.1.1 1994/04/05 16:44:11 sauderd
* Changed the date from 1993 to 1994
*
* Revision 2.0.1.0 1994/02/04 21:32:20 sauderd
* Setting the first branch
*
* Revision 2.0 1994/02/04 21:32:18 sauderd
* STEP Class Library Release 2.0
*
* Revision 1.3 1994/09/30 20:58:22 sauderd
* Administrative stuff for the release. Added the name of the file, library,
* the date, contact people, and $id $ for RCS. Did general cleaning, etc.
*
* Revision 1.2 1992/12/15 14:07:52 kc
* made parameters to HASHfind and HASHinsert const
*
* Revision 1.1 1992/10/07 18:37:20 kc
* Initial revision
*
* Revision 1.1 1992/10/06 22:06:30 kc
* Initial revision
*
* Revision 1.1 1992/09/29 15:44:19 libes
* Initial revision
*
* Revision 1.1 1992/08/19 18:49:59 libes
* Initial revision
*
* Revision 1.2 1992/05/31 08:36:48 libes
* multiple files
*
*/
typedef enum { HASH_FIND, HASH_INSERT, HASH_DELETE } Action;
struct Element {
char *key;
void *data;
struct Element *next;
struct Symbol *symbol;/* for debugging hash conflicts */
char type; /* user-supplied type */
};
struct Hash_Table {
short p; /* Next bucket to be split */
short maxp; /* upper bound on p during expansion */
long KeyCount; /* current # keys */
short SegmentCount; /* current # segments */
short MinLoadFactor;
short MaxLoadFactor;
#define DIRECTORY_SIZE 256
#define DIRECTORY_SIZE_SHIFT 8 /* log2(DIRECTORY_SIZE) */
struct Element **Directory[DIRECTORY_SIZE];
};
typedef struct {
int i; /* segment index (i think) */
int j; /* key index in segment (ditto) */
struct Element *p; /* usually the next element to be returned */
struct Hash_Table *table;
char type;
struct Element *e; /* originally thought of as a place for */
/* the caller of HASHlist to temporarily stash the return value */
/* to allow the caller (i.e., DICTdo) to be macroized, but now */
/* conveniently used by HASHlist, which both stores the ultimate */
/* value here as well as returns it via the return value of HASHlist */
} HashEntry;
#ifdef __cplusplus
extern "C" {
#endif
struct Hash_Table *HASHcreate(unsigned);
void *HASHfind(struct Hash_Table *, char *);
void HASHinsert(struct Hash_Table *, char *,void *);
void HASHdestroy(struct Hash_Table *);
struct Element *HASHsearch(struct Hash_Table *,struct Element *, Action);
void HASHlistinit(struct Hash_Table *,HashEntry *);
void HASHlistinit_by_type(struct Hash_Table *,HashEntry *,char);
struct Element *HASHlist(HashEntry *);
#ifdef __cplusplus
}
#endif
#endif /* SCL_HASH_H */