mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-30 07:31:13 +00:00
4974c57c2c
A few changes. Half-Life support is finally getting committed. Some unnecessary filesystem code changes. And there's code for nsapi - meaning we can embed FTE in a browser (firefox and opera on windows work). A couple of CSQC changes, trying to move towards a final EXT_CSQC_1. Revised ruleset format finally implemented. Doesn't compile with msvc6 due to issues with libjpeg not being a clean library. Presumably its fine in vs2005. Your mileage may vary. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3148 fc73d0e0-1445-4013-8a0c-d673dee63da5
38 lines
1.3 KiB
C
38 lines
1.3 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;
|
|
int value;
|
|
} key;
|
|
struct bucket_s *next;
|
|
} bucket_t;
|
|
typedef struct hashtable_s {
|
|
int numbuckets;
|
|
bucket_t **bucket;
|
|
} hashtable_t;
|
|
|
|
void Hash_InitTable(hashtable_t *table, int numbucks, void *mem); //mem must be 0 filled. (memset(mem, 0, size))
|
|
int Hash_Key(const char *name, int modulus);
|
|
void *Hash_Get(hashtable_t *table, const char *name);
|
|
void *Hash_GetInsensative(hashtable_t *table, const char *name);
|
|
void *Hash_GetKey(hashtable_t *table, int key);
|
|
void *Hash_GetNext(hashtable_t *table, char *name, void *old);
|
|
void *Hash_GetNextInsensative(hashtable_t *table, char *name, void *old);
|
|
void *Hash_Add(hashtable_t *table, char *name, void *data, bucket_t *buck);
|
|
void *Hash_AddInsensative(hashtable_t *table, char *name, void *data, bucket_t *buck);
|
|
void Hash_Remove(hashtable_t *table, char *name);
|
|
void Hash_RemoveData(hashtable_t *table, char *name, void *data);
|
|
void Hash_RemoveKey(hashtable_t *table, int key);
|
|
void *Hash_AddKey(hashtable_t *table, int key, void *data, bucket_t *buck);
|
|
|
|
#endif
|