/* This module allows hashing of arbitrary data. Such data must be pointers or integers, and client is responsible for allocating/deallocating this data. A deallocation call-back is provided.
The objective C class HashTable is prefered when dealing with (key, values) associations because it is easier to use in that situation.
As well-behaved scalable data structures, hash tables double in size when they start becoming full, thus guaranteeing both average constant time access and linear size. */
/* Iteration over all elements of a table consists in setting up an iteration state and then to progress untiE( l entries have been visited. An example of use for counting elements in a table is:
unsigned count = 0;
MyData *data;
NXHashState state = NXInitHashState(table);
while (NXNextHashState(table, &state, &data)) {
count++;
}
*/
typedef struct {int i; int j;} NXHashState;
/* callers should not rely on actual contents of the struct */
/* Unique strings allows C users to enjoy the benefits of Lisp's atoms:
A unique string is a string that is allocated once for all (never de-allocated) and that has only one representant (thus allowing comparison with == instead of strcmp). A unique string should never be modified (and in fact some memory protection is done to ensure that). In order to more explicitly insist on the fact that the string has been uniqued, a synonym of (const char *) has been added, NXAtom. */
typedef const char *NXAtom;
extern NXAtom NXUniqueString(const char *buffer);
/* assumes that buffer is \0 terminated, and returns
a previously created string or a new string that is a copy of buffer.
If NULL is passed returns NULL.
Returned string should never be modified. To ensure this invariant,
allocations are made in a special read only zone. */
extern NXAtom NXUniqueStringWithLength(const char *buffer, int length);
/* assumes that buffer is a non NULL buffer of at least
length characters. Returns a previously created string or
a new string that is a copy of buffer.
If buffer contains \0, string will be truncated.
As for NXUniqueString, returned string should never be modified. */