Blame


1 e2b5610c 2022-04-11 op /*
2 c00beb4f 2022-04-14 op * Copyright (c) 2022 Omar Polo <op@omarpolo.com>
3 e2b5610c 2022-04-11 op *
4 e2b5610c 2022-04-11 op * Permission to use, copy, modify, and distribute this software for any
5 e2b5610c 2022-04-11 op * purpose with or without fee is hereby granted, provided that the above
6 e2b5610c 2022-04-11 op * copyright notice and this permission notice appear in all copies.
7 e2b5610c 2022-04-11 op *
8 e2b5610c 2022-04-11 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 e2b5610c 2022-04-11 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 e2b5610c 2022-04-11 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 e2b5610c 2022-04-11 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 e2b5610c 2022-04-11 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 e2b5610c 2022-04-11 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 e2b5610c 2022-04-11 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 e2b5610c 2022-04-11 op */
16 e2b5610c 2022-04-11 op
17 e2b5610c 2022-04-11 op struct dict_entry {
18 e2b5610c 2022-04-11 op char *word;
19 e2b5610c 2022-04-11 op int *ids;
20 e2b5610c 2022-04-11 op size_t len;
21 e2b5610c 2022-04-11 op size_t cap;
22 e2b5610c 2022-04-11 op };
23 e2b5610c 2022-04-11 op
24 e2b5610c 2022-04-11 op struct dictionary {
25 e2b5610c 2022-04-11 op size_t len;
26 e2b5610c 2022-04-11 op size_t cap;
27 e2b5610c 2022-04-11 op struct dict_entry *entries;
28 e2b5610c 2022-04-11 op };
29 e2b5610c 2022-04-11 op
30 e2b5610c 2022-04-11 op int dictionary_init(struct dictionary *);
31 e2b5610c 2022-04-11 op int dictionary_add(struct dictionary *, const char *, int);
32 e2b5610c 2022-04-11 op int dictionary_add_words(struct dictionary *, char **, int);
33 e2b5610c 2022-04-11 op void dictionary_free(struct dictionary *);