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."
34 typedef struct _string {
41 string_init (string_t *string);
44 string_fini (string_t *string);
47 string_append_char (string_t *string, char c);
50 string_chop (string_t *string);
55 #define TRIE_FLAGS_IS_WORD (1<<0)
56 #define TRIE_FLAGS_SEEN (1<<1)
58 typedef struct _trie {
60 struct _trie *next[26];
64 (*trie_predicate_t) (trie_t *trie);
66 #define TRIE_CHAR_TO_INDEX(c) (tolower (c) - 'a')
67 #define TRIE_INDEX_TO_CHAR(i) (i + 'a')
73 trie_add (trie_t *trie,
74 const char *word_chunk);
77 trie_find (trie_t *trie,
78 const char *word_chunk);
81 trie_print_seen (trie_t *trie, string_t *word);
84 trie_print_unseen (trie_t *trie, string_t *word);
90 #endif /* _DICT_IMPL_H_ */