diff options
| author | kartofen <kartofen.mail.0@protonmail.com> | 2025-07-08 19:14:02 +0300 |
|---|---|---|
| committer | kartofen <kartofen.mail.0@protonmail.com> | 2025-07-08 19:14:02 +0300 |
| commit | d5e78ee61086442a095f65c5c7aa35c7e49f25bb (patch) | |
| tree | 3981038900cff77a0d3b0aaf739cc22025816810 /util/dict.h | |
| parent | 0b80b2a95151cf4882d908a5fe7d97f476e4928d (diff) | |
move things around
Diffstat (limited to 'util/dict.h')
| -rw-r--r-- | util/dict.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/util/dict.h b/util/dict.h new file mode 100644 index 0000000..ecaf53a --- /dev/null +++ b/util/dict.h @@ -0,0 +1,33 @@ +#ifndef DICT_H +#define DICT_H + +struct level { + uint64_t bit_mask; + uint64_t *token_masks; +}; + +#ifndef MAPPED_CHARS +#define MAPPED_CHARS 32 +#endif + +struct dict { + // parameters for compilation + struct string_token { + char *s; + int t; + } *strings; + size_t nstrings; + uint8_t *char_to_bit; + + // result of compilation + struct level start_level; + struct level *bit_to_ptr[MAPPED_CHARS]; + size_t num_levels; +}; + +int dict_compile(struct dict *d); +void dict_free(struct dict *d); +void dict_print(struct dict *d); +int dict_check(struct dict *d, char *string); + +#endif |
