mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-14 16:31:38 +00:00
ffc2a08589
Added version+time+date to segfault lots. try to use vbo+vao as needed. added a manifest file in order to disable uac emulation and its virtual store lies. particles now support a sort of namespace. eg: an effect called "cfg.effect" will load up the 'cfg' particle config and use its 'effect' effect (but not replace any explicit effects). You can still create particle effects called 'cfg.effect' with no issue. Added support for fsarchive plugins. Added a sys_register_file_associations command. .bsp not yet handled, but demo playback should work fine. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4324 fc73d0e0-1445-4013-8a0c-d673dee63da5
43 lines
1.8 KiB
C
43 lines
1.8 KiB
C
//=============================
|
|
//David's hash tables
|
|
//string based.
|
|
|
|
#ifndef HASH_H__
|
|
#define HASH_H__
|
|
|
|
#define Hash_BytesForBuckets(b) (sizeof(bucket_t*)*(b))
|
|
|
|
#define STRCMP(s1,s2) (((*s1)!=(*s2)) || strcmp(s1+1,s2+1)) //saves about 2-6 out of 120 - expansion of idea from fastqcc
|
|
typedef struct bucket_s {
|
|
void *data;
|
|
union {
|
|
const char *string;
|
|
unsigned int value;
|
|
} key;
|
|
struct bucket_s *next;
|
|
} bucket_t;
|
|
typedef struct hashtable_s {
|
|
unsigned int numbuckets;
|
|
bucket_t **bucket;
|
|
} hashtable_t;
|
|
|
|
void Hash_InitTable(hashtable_t *table, unsigned int numbucks, void *mem); //mem must be 0 filled. (memset(mem, 0, size))
|
|
void *Hash_Enumerate(hashtable_t *table, void (*callback) (void *ctx, void *data), void *ctx);
|
|
unsigned int Hash_Key(const char *name, unsigned int modulus);
|
|
void *Hash_GetIdx(hashtable_t *table, unsigned int idx);
|
|
void *Hash_Get(hashtable_t *table, const char *name);
|
|
void *Hash_GetInsensative(hashtable_t *table, const char *name);
|
|
void *Hash_GetInsensativeBucket(hashtable_t *table, const char *name);
|
|
void *Hash_GetKey(hashtable_t *table, unsigned int key);
|
|
void *Hash_GetNext(hashtable_t *table, const char *name, void *old);
|
|
void *Hash_GetNextInsensative(hashtable_t *table, const char *name, void *old);
|
|
void *Hash_GetNextKey(hashtable_t *table, unsigned int key, void *old);
|
|
void *Hash_Add(hashtable_t *table, const char *name, void *data, bucket_t *buck);
|
|
void *Hash_AddInsensative(hashtable_t *table, const char *name, void *data, bucket_t *buck);
|
|
void Hash_Remove(hashtable_t *table, const char *name);
|
|
void Hash_RemoveData(hashtable_t *table, const char *name, void *data);
|
|
void Hash_RemoveBucket(hashtable_t *table, const char *name, bucket_t *data);
|
|
void Hash_RemoveKey(hashtable_t *table, unsigned int key);
|
|
void *Hash_AddKey(hashtable_t *table, unsigned int key, void *data, bucket_t *buck);
|
|
|
|
#endif
|