+
+ return count;
+}
+
+int
+dict_for_each_of_length (dict_t *dict,
+ dict_action_t action,
+ void *closure,
+ int min_length,
+ int max_length)
+{
+ return dict_for_each_of_length_if (dict,
+ action, closure,
+ min_length, max_length,
+ NULL);
+}
+
+int
+dict_for_each_if (dict_t *dict,
+ dict_action_t action,
+ void *closure,
+ dict_entry_predicate_t predicate)
+
+{
+ return dict_for_each_of_length_if (dict,
+ action, closure,
+ 0, 0,
+ predicate);
+}
+
+int
+dict_for_each (dict_t *dict,
+ dict_action_t action,
+ void *closure)
+{
+ return dict_for_each_if (dict, action, closure, NULL);
+}
+
+static void
+dict_action_print (void *closure, char *word, dict_entry_t *entry)
+{
+ int *first = closure;
+
+ if (*first)
+ *first = 0;
+ else
+ printf(" ");
+
+ printf ("%s", word);
+}
+
+int
+dict_print_of_length_if (dict_t *dict,
+ int min_length,
+ int max_length,
+ dict_entry_predicate_t predicate)
+{
+ int first = TRUE;
+
+ return dict_for_each_of_length_if (dict,
+ dict_action_print, &first,
+ min_length, max_length,
+ predicate);
+}
+
+int
+dict_print_by_length_if (dict_t *dict,
+ dict_entry_predicate_t predicate)
+{
+ int length, total, words, count = 0;
+
+ total = dict_count_if (dict, predicate);
+
+ length = 1;
+ do {
+ words = dict_print_of_length_if (dict, length, length, predicate);
+ if (words) {
+ count += words;
+ printf ("\n");
+ }
+ length++;
+ } while (count < total);
+
+ return count;
+}
+
+int
+dict_print_of_length (dict_t *dict,
+ int min_length,
+ int max_length)
+{
+ return dict_print_of_length_if (dict, min_length, max_length, NULL);
+}
+
+int
+dict_print_if (dict_t *dict,
+ dict_entry_predicate_t predicate)
+{
+ return dict_print_of_length_if (dict, 0, 0, predicate);
+}
+
+int
+dict_print (dict_t *dict)
+{
+ return dict_print_if (dict, NULL);