+dict_entry_t *
+dict_lookup (dict_t *dict,
+ const char *word)
+{
+ trie_t *trie;
+
+ trie = trie_find (dict, word);
+ if (trie == NULL)
+ return NULL;
+ else
+ return &trie->flags;
+}
+
+/* Yes, this function is rather silly. I have it here in the hope that
+ * it could be used for some better type-checking, (if only C had such
+ * a thing). */
+dict_cursor_t
+dict_root (dict_t *dict)
+{
+ return dict;
+}
+
+dict_cursor_t
+dict_cursor_next (dict_cursor_t cursor,
+ char next)
+{
+ trie_t *trie = cursor;
+
+ if (trie == NULL)
+ return DICT_CURSOR_NIL;
+
+ return trie->next[TRIE_CHAR_TO_INDEX (next)];
+}
+
+dict_entry_t *
+dict_cursor_resolve (dict_cursor_t cursor)
+{
+ trie_t *trie;
+
+ if (cursor == DICT_CURSOR_NIL)
+ return NULL;
+
+ trie = cursor;
+ return &trie->flags;
+}
+
+/* XXX: This static function pointer is really nasty and definitely
+ * un-thread safe. What I really want it a lambda so I can construct a
+ * composite predicate on the fly. Oh well... */
+static dict_entry_predicate_t dict_entry_predicate = NULL;
+
+static bool_t
+dict_predicate (trie_t *trie)
+{
+ dict_entry_t *entry;
+
+ entry = dict_cursor_resolve (trie);
+ if (! DICT_ENTRY_IS_WORD (entry))
+ return FALSE;
+
+ if (dict_entry_predicate)
+ return (dict_entry_predicate) (*entry);
+
+ return TRUE;
+}
+
+int
+dict_count (dict_t *dict,
+ dict_entry_predicate_t predicate)
+{
+ dict_entry_predicate = predicate;
+ return trie_count (dict, dict_predicate);
+}
+
+int