1 #ifndef _LIBSAPLING_TYPED_TRIE_H_
2 #define _LIBSAPLING_TYPED_TRIE_H_
13 #define IMPLEMENT_TYPED_TRIE(SYM, TYPE, FPF) \
15 IMPLEMENT_TYPED_ADAPTERS(SYM, TYPE, trie) \
18 void SYM##__access(enum qt qt, node_t *ref, const char *key, void *info, \
19 SYM##__predicate_t predicate, SYM##__apply_t apply) \
21 struct SYM##__adapt a = { 0, NULL, info, predicate, apply }; \
22 trie__access(qt, ref, key, &a, SYM##__predicate_adapter, \
23 SYM##__apply_adapter); \
27 void SYM##__insert(node_t *ref, const char *key, TYPE val) \
29 TYPE *data = malloc(sizeof(TYPE)); \
31 trie__insert(ref, key, data); \
35 void SYM##__delete(node_t *ref, const char *key) \
37 trie__delete(ref, key); \
41 void SYM##__print(FILE *stream, node_t *ref) \
43 trie__print(stream, ref, FPF); \
47 void SYM##__dump_dot(FILE *stream, node_t *ref) \
49 lexer__dump_dot(stream, ref, FPF); \
53 int SYM##__length(const node_t *ref) \
55 return trie__length(ref); \
60 void SYM##__found_key(node_t *ref, const struct info_stack *info) \
62 int *found = info->user; \
68 int SYM##__in(node_t *ref, const char *key) \
71 trie__access(E_QT, ref, key, &in, predicate_1, SYM##__found_key); \
Lexer implementation hello.
Implementation of typed adapters for predicate and apply functions.