X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=dict.h;h=ccc0c0b8af961570514fd232fe1e29efde80ab71;hb=2d604d8b8a380f7f3028c234282bfdcf12f95dad;hp=d87e7659031e3497a1158a94ffde33ed948e82d8;hpb=dd4b319cdb6e2883ae76317036b57b670344160a;p=wordgame diff --git a/dict.h b/dict.h index d87e765..ccc0c0b 100644 --- a/dict.h +++ b/dict.h @@ -46,11 +46,30 @@ dict_entry_t * dict_lookup (dict_t *dict, const char *word); +typedef bool_t +(*dict_entry_predicate_t) (dict_entry_t entry); + +int +dict_count (dict_t *dict, + dict_entry_predicate_t predicate); + /* Querying a dictionary entry. The dict interface uses 1 bit. * All of the remaining bits are available for application use. */ #define DICT_ENTRY_IS_WORD(entry) ((entry) && ((*entry) & 0x01)) +/* Printing the dictionary */ +int +dict_print (dict_t *dict); + +int +dict_print_if (dict_t *dict, + dict_entry_predicate_t predicate); + +int +dict_print_by_length_if (dict_t *dict, + dict_entry_predicate_t predicate); + /* Character-by-character perusal of the dictionary */ dict_cursor_t dict_root (dict_t *dict);