Use stylesheet transformations to output HTML, for example

This commit is contained in:
David Baer
2015-08-11 15:33:08 -04:00
parent cfc0ba7e9a
commit 10927bee25
19 changed files with 725 additions and 92 deletions

36
src/hash.h Normal file
View File

@@ -0,0 +1,36 @@
#ifndef _HASH_H
#define _HASH_H
#include "queue.h"
#define HASH_ENTRIES 1024
uint32_t HASH_KEY(char *);
#define DEFINE_HASH(T, N) \
typedef struct { \
char* key; \
T data; \
} N##Entry; \
DEFINE_QUEUE(N##Entry, N##CollisionQueue) \
typedef N##CollisionQueue N[HASH_ENTRIES]; \
const N##Entry* N##Find(N tbl, const char* key) { \
uint32_t track = HASH_KEY(key); \
FOREACH_QUEUE(N##CollisionQueue, tbl[track], iter) { \
if (strcmp(key, iter->data.key) == 0) { \
return &iter->data; \
} \
} \
return NULL; \
}
#define INIT_HASH(T, H) { \
int i; \
for (i = 0; i < HASH_ENTRIES; i++) { \
(H)[i].length = 0; \
(H)[i].tail = (H)[i].head = NULL; \
} \
}
#endif /* !def _HASH_H */