| 1 |
#include <stdarg.h> |
| 2 |
#include <stdbool.h> |
| 3 |
#include <stdint.h> |
| 4 |
#include <stdlib.h> |
| 5 |
|
| 6 |
typedef const char *Str; |
| 7 |
|
| 8 |
typedef struct { |
| 9 |
uintptr_t num_buckets; |
| 10 |
uintptr_t capacity; |
| 11 |
uint8_t *occupied; |
| 12 |
Str *keys; |
| 13 |
char *vals; |
| 14 |
} HashTable_Str__c_char__false; |
| 15 |
|
| 16 |
typedef HashTable_Str__c_char__false MySet; |
| 17 |
|
| 18 |
typedef void (*SetCallback)(Str key); |
| 19 |
|
| 20 |
typedef struct { |
| 21 |
uintptr_t num_buckets; |
| 22 |
uintptr_t capacity; |
| 23 |
uint8_t *occupied; |
| 24 |
Str *keys; |
| 25 |
uint64_t *vals; |
| 26 |
} HashTable_Str__u64__true; |
| 27 |
|
| 28 |
typedef void (*MapCallback)(Str key, uint64_t val); |
| 29 |
|
| 30 |
#ifdef __cplusplus |
| 31 |
extern "C" { |
| 32 |
#endif // __cplusplus |
| 33 |
|
| 34 |
MySet *new_set(void); |
| 35 |
|
| 36 |
void set_for_each(const MySet *set, SetCallback callback); |
| 37 |
|
| 38 |
HashTable_Str__u64__true *new_map(void); |
| 39 |
|
| 40 |
void map_for_each(const HashTable_Str__u64__true *map, MapCallback callback); |
| 41 |
|
| 42 |
#ifdef __cplusplus |
| 43 |
} // extern "C" |
| 44 |
#endif // __cplusplus |