Lines Matching defs:menu

17 struct menu rootmenu;
18 static struct menu **last_entry_ptr;
20 void menu_warn(struct menu *menu, const char *fmt, ...)
24 fprintf(stderr, "%s:%d:warning: ", menu->filename, menu->lineno);
48 struct menu *menu;
50 menu = xmalloc(sizeof(*menu));
51 memset(menu, 0, sizeof(*menu));
52 menu->sym = sym;
53 menu->parent = current_menu;
54 menu->filename = cur_filename;
55 menu->lineno = cur_lineno;
57 *last_entry_ptr = menu;
58 last_entry_ptr = &menu->next;
59 current_entry = menu;
62 list_add_tail(&menu->link, &sym->menus);
66 struct menu *menu_add_menu(void)
139 prop->menu = current_entry;
172 struct menu *menu = current_entry;
174 while ((menu = menu->parent) != NULL) {
177 if (!menu->visibility)
180 * Do not add a reference to the menu's visibility
186 dup_expr = expr_copy(menu->visibility);
285 static void _menu_finalize(struct menu *parent, bool inside_choice)
287 struct menu *menu, *last_menu;
295 * This menu node has children. We (recursively) process them
308 for (menu = parent->list; menu; menu = menu->next) {
309 if (menu->sym && menu->sym->type != S_UNKNOWN) {
310 menu_set_type(menu->sym->type);
324 /* Menu node for 'menu', 'if' */
328 /* For each child menu node... */
329 for (menu = parent->list; menu; menu = menu->next) {
331 * Propagate parent dependencies to the child menu
334 basedep = rewrite_m(menu->dep);
338 menu->dep = basedep;
340 if (menu->sym)
345 prop = menu->sym->prop;
348 * For non-symbol menu nodes, we just need to
351 prop = menu->prompt;
355 if (prop->menu != menu)
382 if (menu->sym && menu->sym->type != S_TRISTATE)
393 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
397 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
409 for (menu = parent->list; menu; menu = menu->next)
410 _menu_finalize(menu, is_choice);
415 * all depend on sym, then the following menu structure is
440 for (menu = parent->next; menu; menu = menu->next) {
441 dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
455 * Note that 'R' might be from an enclosing menu or if,
471 _menu_finalize(menu, false);
472 menu->parent = parent;
473 last_menu = menu;
484 for (menu = parent->list; menu; menu = menu->next) {
486 menu->sym && !sym_is_choice_value(menu->sym)) {
487 current_entry = menu;
488 menu->sym->flags |= SYMBOL_CHOICEVAL;
489 if (!menu->prompt)
490 menu_warn(menu, "choice value must have a prompt");
491 for (prop = menu->sym->prop; prop; prop = prop->next) {
495 if (prop->menu == menu)
498 prop->menu->parent->sym != sym)
507 if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
509 menu->dep = expr_alloc_and(basedep, menu->dep);
510 for (prop = menu->sym->prop; prop; prop = prop->next) {
511 if (prop->menu != menu)
522 (*ep)->right.sym = menu->sym;
553 if (menu->list && (!menu->prompt || !menu->prompt->text)) {
554 for (last_menu = menu->list; ; last_menu = last_menu->next) {
559 last_menu->next = menu->next;
560 menu->next = menu->list;
561 menu->list = NULL;
595 bool menu_has_prompt(struct menu *menu)
597 if (!menu->prompt)
603 * Determine if a menu is empty.
604 * A menu is considered empty if it contains no or only
607 bool menu_is_empty(struct menu *menu)
609 struct menu *child;
611 for (child = menu->list; child; child = child->next) {
618 bool menu_is_visible(struct menu *menu)
620 struct menu *child;
624 if (!menu->prompt)
627 if (menu->visibility) {
628 if (expr_calc_value(menu->visibility) == no)
632 sym = menu->sym;
635 visible = menu->prompt->visible.tri;
637 visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr);
642 if (!sym || sym_get_tristate_value(menu->sym) == no)
645 for (child = menu->list; child; child = child->next) {
656 const char *menu_get_prompt(struct menu *menu)
658 if (menu->prompt)
659 return menu->prompt->text;
660 else if (menu->sym)
661 return menu->sym->name;
665 struct menu *menu_get_parent_menu(struct menu *menu)
669 for (; menu != &rootmenu; menu = menu->parent) {
670 type = menu->prompt ? menu->prompt->type : 0;
674 return menu;
677 static void get_def_str(struct gstr *r, struct menu *menu)
680 menu->filename, menu->lineno);
701 struct menu *submenu[8], *menu, *location = NULL;
706 get_dep_str(r, prop->menu->dep, " Depends on: ");
715 if (!expr_eq(prop->menu->dep, prop->visible.expr))
718 menu = prop->menu;
719 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
720 submenu[i++] = menu;
721 if (location == NULL && menu_is_visible(menu))
722 location = menu;
735 menu = submenu[i];
736 if (jump && menu == location) {
746 str_printf(r, "%*c-> %s", indent, ' ', menu_get_prompt(menu));
747 if (menu->sym) {
748 str_printf(r, " (%s [=%s])", menu->sym->name ?
749 menu->sym->name : "<choice>",
750 sym_get_string_value(menu->sym));
781 struct menu *menu;
798 list_for_each_entry(menu, &sym->menus, link) {
799 if (menu->prompt) {
800 get_def_str(r, menu);
801 get_prompt_str(r, menu->prompt, head);
805 list_for_each_entry(menu, &sym->menus, link) {
806 if (!menu->prompt) {
807 get_def_str(r, menu);
808 get_dep_str(r, menu->dep, " Depends on: ");
843 void menu_get_ext_help(struct menu *menu, struct gstr *help)
845 struct symbol *sym = menu->sym;
848 if (menu->help) {
851 help_text = menu->help;