hash.h revision 34f9b3eef6fdadbda0a846aa4d68691ac40eace5
/* : : generated by proto : : */
/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2009 AT&T Intellectual Property *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
/*
* Glenn Fowler
* AT&T Research
*
* hash table library interface definitions
*
* NOTE: new code should use the more general <cdt.h>
*/
#ifndef _HASH_H
#if !defined(__PROTO__)
#include <prototyped.h>
#endif
#if !defined(__LINKAGE__)
#define __LINKAGE__ /* 2004-08-11 transition */
#endif
#define _HASH_H
#define HASH_LOOKUP 0 /* default op */
#define HASH_alloc 1
#define HASH_clear 2
#define HASH_compare 3
#define HASH_free 4
#define HASH_hash 5
#define HASH_meanchain 6
#define HASH_name 7
#define HASH_namesize 8
#define HASH_set 9
#define HASH_size 10
#define HASH_table 11
#define HASH_va_list 12
#define HASH_bucketsize 13
#define HASH_region 14
#include <hashpart.h>
#define hashgetbucket(s) ((Hash_bucket_t*)((s)-((sizeof(Hash_bucket_t)+sizeof(char*)-1)/sizeof(char*))*sizeof(char*)))
/*
* DEPRECATED renames for compatibility
*/
#define Hashbin_t Hash_bucket_t
#define HASHBUCKET Hash_bucket_t
#define Hashhdr_t Hash_header_t
#define HASHHEADER Hash_header_t
#define Hashpos_t Hash_position_t
#define HASHPOSITION Hash_position_t
#define Hashtab_t Hash_table_t
#define HASHTABLE Hash_table_t
#define vhashalloc hashvalloc
/*
* the #define's avoid union tags
*/
typedef struct Hash_bucket Hash_bucket_t;
typedef struct Hash_root Hash_root_t;
typedef struct Hash_table Hash_table_t;
#define HASH_HEADER /* common bucket header */ \
unsigned int hash; /* hash flags and value */ \
char* name /* key name */
#define HASH_DEFAULT /* HASH_VALUE bucket elements */ \
char* value /* key value */
typedef struct /* bucket header */
{
struct Hash_bucket /* prototype bucket */
{
};
typedef struct /* hash scan bucket position */
{
#ifdef _HASH_POSITION_PRIVATE_
#endif
typedef struct /* last lookup cache */
{
#ifdef _HASH_LAST_PRIVATE_
#endif
} Hash_last_t;
struct Hash_root /* root hash table information */
{
int accesses; /* number of accesses */
int collisions; /* number of collisions */
int flags; /* flags: see HASH_[A-Z]* */
#ifdef _HASH_ROOT_PRIVATE_
#endif
};
struct Hash_table /* hash table information */
{
int size; /* table size */
int buckets; /* active bucket count */
char* name; /* table name */
short flags; /* flags: see HASH_[A-Z]* */
#ifdef _HASH_TABLE_PRIVATE_
#endif
};
#if _BLD_ast && defined(__EXPORT__)
#endif
extern __MANGLE__ int hashwalk __PROTO__((Hash_table_t*, int, int (*)(const char*, char*, __V_*), __V_*));
#define __MANGLE__ __LINKAGE__
#endif