static int walk() { B6_LIST_DEFINE(list); struct b6_dref dref[16]; struct b6_dref *iter; int i; for (i = 0; i < b6_card_of(dref); i += 1) if (&dref[i] != b6_list_add_last(&list, &dref[i])) return 0; for (i = 0, iter = b6_list_first(&list); iter != b6_list_tail(&list); iter = b6_list_walk(iter, B6_NEXT), i += 1) if (iter != &dref[i]) return 0; if (i != b6_card_of(dref)) return 0; for (i = 0, iter = b6_list_last(&list); iter != b6_list_head(&list); iter = b6_list_walk(iter, B6_PREV), i += 1) if (iter != &dref[b6_card_of(dref) - 1 - i]) return 0; if (i != b6_card_of(dref)) return 0; return 1; }
static int add_first() { B6_LIST_DEFINE(list); struct b6_dref dref[2]; int i; for (i = 0; i < b6_card_of(dref); i += 1) { if (&dref[i] != b6_list_add_first(&list, &dref[i])) return 0; if (&dref[i] != b6_list_first(&list)) return 0; if (b6_list_empty(&list)) return 0; } return 1; }
void next_menu_entry(struct menu *self) { walk_menu_entry(self, B6_NEXT, b6_list_tail(&self->entries), b6_list_first(&self->entries)); }
static int first_is_tail_when_empty() { B6_LIST_DEFINE(list); return b6_list_first(&list) == b6_list_tail(&list); }