Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals  

hash.h File Reference

hash is a way to map strings to data efficiently. More...

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  hashindex_t
 an index to a string(data) in a hash. More...


first-done-next hash iteration paradigm

#define hash_iter_tell(__hash__...)   hash_mark_get(__hash__)
 "tells" the current hashindex during a hash iteration. More...

#define hash_iter_done(__hash__...)   HASH_INDEX_ISBAD(hash_mark_get(__hash__))
 returns the hash iteration termination status. More...

#define hash_iter_stop(__hash__...)   hash_mark_clear(__hash__)
 stops the iteration on a hash, clearing the mark. More...


first-done-next namespace iteration paradigm

#define ns_iter_tell(__ns__...)   ns_mark_get(__ns__)
 "tells" the current hashindex during a namespace iteration. More...

#define ns_iter_done(__ns__...)   HASH_INDEX_ISBAD(ns_mark_get(__ns__))
 returns the namespace iteration termination status. More...

#define ns_iter_stop(__ns__...)   ns_mark_clear(__ns__)
 stops the iteration on a namespace, clearing the mark. More...


Defines

#define NS_GLOBAL(__hash__...)   (*(ns_key_t *)(__hash__))
 hash is a subclass of namespace. More...

#define HASH_INDEX_EQU(__i__, __j__)   ({ hashindex_t __i = __i__, __j = __j__; __i.i == __j.i && __i.j == __j.j; })
 hashindex equality. More...

#define HASH_INDEX_ISBAD(__i__...)   ((__i__).j < 0)
 hashindex validity test. More...

#define HASH_INDEX_DOBAD(__i__...)   ((__i__).j = -1)
 makes a hashindex bad. More...


Typedefs

typedef void * ns_key_t
 the key to a namespace.

typedef _hashhash_t
 a hash is actually a pointer to a _hash structure.

typedef void(* hash_freefunc_t )(hashindex_t HI, ns_key_t NS, void *DATA)
 hash data free function type. More...

typedef int(* hash_iterfunc_t )(hashindex_t HI, ns_key_t NS, void **PDATA, void *PARAM)
 hash data iteration function type. More...


Functions

ns_key_t hash_init (hash_t *HASH, hash_freefunc_t FREEFUNC)
 hash initialisation. More...

void hash_finish (hash_t HASH)
 hash finalisation. More...

ns_key_t ns_register (hash_t HASH, hash_freefunc_t FREEFUNC)
 namespace register. More...

int ns_unregister (ns_key_t NS)
 namespace unregister. More...

hash_t ns_hash (ns_key_t NS)
 namespaces to hash. More...

ns_key_t hi_ns (hashindex_t HI)
 the namespace of a hashindex. More...

void ns_hi (ns_key_t NS, hashindex_t *PHI)
 adjust a hashindex so that it is part of a namespace. More...

hashindex_t hash_putstr (ns_key_t NS, char const *STRING, int COUNT, void *DATA)
 puts a string and data into the namespace of a hash. More...

char * hash_getstr (hash_t HASH, hashindex_t HI, int *PCOUNT)
 gets a string from an hash index. More...

hashindex_t hash_getindex (hash_t HASH, char const *STRING, int COUNT)
 gets the index of a string in a hash. More...

void ** hash_getdata (hashindex_t HI)
 the data at a specified hashindex. More...

void * hash_remstr (hash_t HASH, hashindex_t HI)
 removes a string from a hash. More...

void hash_iterdata_all (hash_t HASH, hash_iterfunc_t ITERFUNC, void *PARM)
 iterate through all data, all namespaces. More...

void hash_iterdata_hi (hashindex_t HI, hash_iterfunc_t ITERFUNC, void *PARM)
 iterate through data under a certain index, all namespaces. More...

void ns_iterdata_all (ns_key_t NS, hash_iterfunc_t ITERFUNC, void *PARM)
 iterate through all data, from a certain namespace. More...

void ns_iterdata_hi (ns_key_t NS, hashindex_t HI, hash_iterfunc_t ITERFUNC, void *PARM)
 iterate through data under a certain index, from a certain namespace. More...

void hash_mark_clear (hash_t HASH)
 clears the hash mark. More...

void hash_mark_set (hash_t HASH, hashindex_t HI)
 sets the hash mark. More...

hashindex_t hash_mark_get (hash_t HASH)
 gets the hash mark. More...

void ns_mark_clear (ns_key_t NS)
 clears the namespace mark. More...

void ns_mark_set (ns_key_t NS, hashindex_t HI)
 sets the namespace mark. More...

hashindex_t ns_mark_get (ns_key_t NS)
 gets the namespace mark. More...

void hash_iter_first (hash_t HASH)
 starts a new iteration on a hash, from the first valid hashindex. More...

int hash_iter_next (hash_t HASH)
 steps an iteration to the next hashindex. More...

void hash_iter_start (hash_t HASH, hashindex_t HI)
 initiates a hash iteration starting from a hashindex. More...

void ns_iter_first (ns_key_t NS)
 starts a new iteration on a namespace, from the first valid hashindex. More...

int ns_iter_next (ns_key_t NS)
 steps an iteration to the next valid hashindex of the same namespace. More...

void ns_iter_start (ns_key_t NS, hashindex_t HI)
 initiates a namespace iteration starting from a hashindex. More...

void hash_status (hash_t HASH, FILE *FILE)
 verbosely outputs the hash status. More...


Detailed Description

hash is a way to map strings to data efficiently.

Author:
Sebastian Glita

It stores equal strings, but with different data, only once. It has the notion of namespaces, which logically divide the strings into organized collections.

You should know that:

Definition in file share/hash.h.


Generated on Thu Jan 9 19:02:44 2003 for plint by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002