Lines Matching refs:menu

15 struct menu rootmenu;
16 static struct menu **last_entry_ptr;
21 void menu_warn(struct menu *menu, const char *fmt, ...)
25 fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno);
49 struct menu *menu;
51 menu = xmalloc(sizeof(*menu));
52 memset(menu, 0, sizeof(*menu));
53 menu->sym = sym;
54 menu->parent = current_menu;
55 menu->file = current_file;
56 menu->lineno = zconf_lineno();
58 *last_entry_ptr = menu;
59 last_entry_ptr = &menu->next;
60 current_entry = menu;
65 struct menu *menu_add_menu(void)
138 prop->menu = current_entry;
171 struct menu *menu = current_entry;
173 while ((menu = menu->parent) != NULL) {
176 if (!menu->visibility)
179 * Do not add a reference to the menu's visibility
185 dup_expr = expr_copy(menu->visibility);
306 void menu_finalize(struct menu *parent)
308 struct menu *menu, *last_menu;
316 * This menu node has children. We (recursively) process them
324 for (menu = parent->list; menu; menu = menu->next) {
325 if (menu->sym && menu->sym->type != S_UNKNOWN) {
326 menu_set_type(menu->sym->type);
332 for (menu = parent->list; menu; menu = menu->next) {
333 current_entry = menu;
334 if (menu->sym && menu->sym->type == S_UNKNOWN)
346 /* Menu node for 'menu', 'if' */
350 /* For each child menu node... */
351 for (menu = parent->list; menu; menu = menu->next) {
353 * Propagate parent dependencies to the child menu
356 basedep = rewrite_m(menu->dep);
360 menu->dep = basedep;
362 if (menu->sym)
367 prop = menu->sym->prop;
370 * For non-symbol menu nodes, we just need to
373 prop = menu->prompt;
377 if (prop->menu != menu)
404 if (menu->sym && menu->sym->type != S_TRISTATE)
415 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
419 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
431 for (menu = parent->list; menu; menu = menu->next)
432 menu_finalize(menu);
437 * all depend on sym, then the following menu structure is
462 for (menu = parent->next; menu; menu = menu->next) {
463 dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
477 * Note that 'R' might be from an enclosing menu or if,
493 menu_finalize(menu);
494 menu->parent = parent;
495 last_menu = menu;
506 for (menu = parent->list; menu; menu = menu->next) {
508 menu->sym && !sym_is_choice_value(menu->sym)) {
509 current_entry = menu;
510 menu->sym->flags |= SYMBOL_CHOICEVAL;
511 if (!menu->prompt)
512 menu_warn(menu, "choice value must have a prompt");
513 for (prop = menu->sym->prop; prop; prop = prop->next) {
517 if (prop->menu == menu)
520 prop->menu->parent->sym != sym)
529 if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
531 menu->dep = expr_alloc_and(basedep, menu->dep);
532 for (prop = menu->sym->prop; prop; prop = prop->next) {
533 if (prop->menu != menu)
544 (*ep)->right.sym = menu->sym;
575 if (menu->list && (!menu->prompt || !menu->prompt->text)) {
576 for (last_menu = menu->list; ; last_menu = last_menu->next) {
581 last_menu->next = menu->next;
582 menu->next = menu->list;
583 menu->list = NULL;
615 bool menu_has_prompt(struct menu *menu)
617 if (!menu->prompt)
623 * Determine if a menu is empty.
624 * A menu is considered empty if it contains no or only
627 bool menu_is_empty(struct menu *menu)
629 struct menu *child;
631 for (child = menu->list; child; child = child->next) {
638 bool menu_is_visible(struct menu *menu)
640 struct menu *child;
644 if (!menu->prompt)
647 if (menu->visibility) {
648 if (expr_calc_value(menu->visibility) == no)
652 sym = menu->sym;
655 visible = menu->prompt->visible.tri;
657 visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr);
662 if (!sym || sym_get_tristate_value(menu->sym) == no)
665 for (child = menu->list; child; child = child->next) {
676 const char *menu_get_prompt(struct menu *menu)
678 if (menu->prompt)
679 return menu->prompt->text;
680 else if (menu->sym)
681 return menu->sym->name;
685 struct menu *menu_get_root_menu(struct menu *menu)
690 struct menu *menu_get_parent_menu(struct menu *menu)
694 for (; menu != &rootmenu; menu = menu->parent) {
695 type = menu->prompt ? menu->prompt->type : 0;
699 return menu;
702 bool menu_has_help(struct menu *menu)
704 return menu->help != NULL;
707 const char *menu_get_help(struct menu *menu)
709 if (menu->help)
710 return menu->help;
715 static void get_def_str(struct gstr *r, struct menu *menu)
718 menu->file->name, menu->lineno);
734 struct menu *submenu[8], *menu, *location = NULL;
739 get_dep_str(r, prop->menu->dep, " Depends on: ");
748 if (!expr_eq(prop->menu->dep, prop->visible.expr))
751 menu = prop->menu->parent;
752 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
753 bool accessible = menu_is_visible(menu);
755 submenu[i++] = menu;
757 location = menu;
762 if (menu_is_visible(prop->menu)) {
769 jump->target = prop->menu;
785 menu = submenu[i];
786 if (jump && menu == location)
789 menu_get_prompt(menu));
790 if (menu->sym) {
791 str_printf(r, " (%s [=%s])", menu->sym->name ?
792 menu->sym->name : "<choice>",
793 sym_get_string_value(menu->sym));
842 if (prop->menu->prompt) {
843 get_def_str(r, prop->menu);
844 get_prompt_str(r, prop->menu->prompt, head);
849 if (!prop->menu->prompt) {
850 get_def_str(r, prop->menu);
851 get_dep_str(r, prop->menu->dep, " Depends on: ");
886 void menu_get_ext_help(struct menu *menu, struct gstr *help)
888 struct symbol *sym = menu->sym;
891 if (menu_has_help(menu)) {
894 help_text = menu_get_help(menu);