#ifndef ID_INDEX_H #define ID_INDEX_H #define HASH_SMALL 8 #define HASH_MEDIUM 32 #define HASH_LARGE 64 #define HASH_HUGE 128 #define HASH_DEFAULT HASH_MEDIUM struct IdIndex { char *ids; int max_ids; int hash_size; struct IdIndexEntry **hash_index; }; struct IdIndex *initIdIndex(struct IdIndex *index, int hash_size, int max_ids); int freeIdIndex(struct IdIndex *index); int addIdIndex(struct IdIndex *index, const char *string, int id); int remIdIndex(struct IdIndex *index, const char *string); int remIdIndexById(struct IdIndex *index, int id); int getIdIndex(struct IdIndex *index, const char *string); int checkIdIndexMemory(struct IdIndex *index, int id); int resizeIdIndex(struct IdIndex *index, int max_ids); int findOpenIdIndex(struct IdIndex *index); struct IdIndexEntry { char *name; int id; struct IdIndexEntry *next; }; struct IdIndexEntry *newIdIndexEntry(const char *string, int id); int freeIdIndexEntry(struct IdIndexEntry *entry); int getStringHash(int hash_size, const char *string); #endif