#include <tcl.h> Tcl_InitHashTable(tablePtr, keyType) Tcl_DeleteHashTable(tablePtr) Tcl_HashEntry * Tcl_CreateHashEntry(tablePtr, key, newPtr) Tcl_DeleteHashEntry(entryPtr) Tcl_HashEntry * Tcl_FindHashEntry(tablePtr, key) ClientData Tcl_GetHashValue(entryPtr) Tcl_SetHashValue(entryPtr, value) char * Tcl_GetHashKey(tablePtr, entryPtr) Tcl_HashEntry * Tcl_FirstHashEntry(tablePtr, searchPtr) Tcl_HashEntry * Tcl_NextHashEntry(searchPtr) char * Tcl_HashStats(tablePtr)
The value of a hash table entry can be anything that fits in the same space as a ``char *'' pointer. Values for hash table entries are managed entirely by clients, not by the hash module itself. Typically each entry's value is a pointer to a data structure managed by client code.
Hash tables grow gracefully as the number of entries increases, so that there are always less than three entries per hash bucket, on average. This allows for fast lookups regardless of the number of entries in a table.
Tcl_InitHashTable initializes a structure that describes a new hash table. The space for the structure is provided by the caller, not by the hash module. The value of keyType indicates what kinds of keys will be used for all entries in the table. KeyType must have one of the following values:
Copyright © 1989-1994 The Regents of the University of California.
Copyright © 1994-1997 Sun Microsystems, Inc.