2 * Copyright © 2006 Carl Worth
4 * This program is free software; you can redistribute it and\/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA."
22 #include "dict-impl.h"
24 /* Only looks opaque. Perfectly stack-allocatable */
25 typedef trie_t dict_t;
26 typedef trie_t *dict_cursor_t;
27 typedef uint32_t dict_entry_t;
29 /* Initialization and cleanup */
31 dict_init (dict_t *dict);
34 dict_fini (dict_t *dict);
36 /* Adding new words */
38 dict_add_word (dict_t *dict,
41 dict_add_words_from_file (dict_t *dict,
42 const char *filename);
44 /* Looking up an entry in the dictionary */
46 dict_lookup (dict_t *dict,
49 /* Querying a dictionary entry. The dict interface uses 1 bit.
50 * All of the remaining bits are available for application use.
52 #define DICT_ENTRY_IS_WORD(entry) ((entry) && ((*entry) & 0x01))
54 /* Character-by-character perusal of the dictionary */
56 dict_root (dict_t *dict);
59 dict_cursor_next (dict_cursor_t cursor,
63 dict_cursor_resolve (dict_cursor_t cursor);
65 #define DICT_CURSOR_NIL NULL