Lines Matching refs:menu

16 struct menu rootmenu;
17 static struct menu **last_entry_ptr;
22 void menu_warn(struct menu *menu, const char *fmt, ...)
26 fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno);
50 struct menu *menu;
52 menu = xmalloc(sizeof(*menu));
53 memset(menu, 0, sizeof(*menu));
54 menu->sym = sym;
55 menu->parent = current_menu;
56 menu->file = current_file;
57 menu->lineno = zconf_lineno();
59 *last_entry_ptr = menu;
60 last_entry_ptr = &menu->next;
61 current_entry = menu;
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 void menu_finalize(struct menu *parent)
287 struct menu *menu, *last_menu;
295 * This menu node has children. We (recursively) process them
303 for (menu = parent->list; menu; menu = menu->next) {
304 if (menu->sym && menu->sym->type != S_UNKNOWN) {
305 menu_set_type(menu->sym->type);
311 for (menu = parent->list; menu; menu = menu->next) {
312 current_entry = menu;
313 if (menu->sym && menu->sym->type == S_UNKNOWN)
325 /* Menu node for 'menu', 'if' */
329 /* For each child menu node... */
330 for (menu = parent->list; menu; menu = menu->next) {
332 * Propagate parent dependencies to the child menu
335 basedep = rewrite_m(menu->dep);
339 menu->dep = basedep;
341 if (menu->sym)
346 prop = menu->sym->prop;
349 * For non-symbol menu nodes, we just need to
352 prop = menu->prompt;
356 if (prop->menu != menu)
383 if (menu->sym && menu->sym->type != S_TRISTATE)
394 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
398 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep)));
410 for (menu = parent->list; menu; menu = menu->next)
411 menu_finalize(menu);
416 * all depend on sym, then the following menu structure is
441 for (menu = parent->next; menu; menu = menu->next) {
442 dep = menu->prompt ? menu->prompt->visible.expr : menu->dep;
456 * Note that 'R' might be from an enclosing menu or if,
472 menu_finalize(menu);
473 menu->parent = parent;
474 last_menu = menu;
485 for (menu = parent->list; menu; menu = menu->next) {
487 menu->sym && !sym_is_choice_value(menu->sym)) {
488 current_entry = menu;
489 menu->sym->flags |= SYMBOL_CHOICEVAL;
490 if (!menu->prompt)
491 menu_warn(menu, "choice value must have a prompt");
492 for (prop = menu->sym->prop; prop; prop = prop->next) {
496 if (prop->menu == menu)
499 prop->menu->parent->sym != sym)
508 if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
510 menu->dep = expr_alloc_and(basedep, menu->dep);
511 for (prop = menu->sym->prop; prop; prop = prop->next) {
512 if (prop->menu != menu)
523 (*ep)->right.sym = menu->sym;
554 if (menu->list && (!menu->prompt || !menu->prompt->text)) {
555 for (last_menu = menu->list; ; last_menu = last_menu->next) {
560 last_menu->next = menu->next;
561 menu->next = menu->list;
562 menu->list = NULL;
594 bool menu_has_prompt(struct menu *menu)
596 if (!menu->prompt)
602 * Determine if a menu is empty.
603 * A menu is considered empty if it contains no or only
606 bool menu_is_empty(struct menu *menu)
608 struct menu *child;
610 for (child = menu->list; child; child = child->next) {
617 bool menu_is_visible(struct menu *menu)
619 struct menu *child;
623 if (!menu->prompt)
626 if (menu->visibility) {
627 if (expr_calc_value(menu->visibility) == no)
631 sym = menu->sym;
634 visible = menu->prompt->visible.tri;
636 visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr);
641 if (!sym || sym_get_tristate_value(menu->sym) == no)
644 for (child = menu->list; child; child = child->next) {
655 const char *menu_get_prompt(struct menu *menu)
657 if (menu->prompt)
658 return menu->prompt->text;
659 else if (menu->sym)
660 return menu->sym->name;
664 struct menu *menu_get_parent_menu(struct menu *menu)
668 for (; menu != &rootmenu; menu = menu->parent) {
669 type = menu->prompt ? menu->prompt->type : 0;
673 return menu;
676 bool menu_has_help(struct menu *menu)
678 return menu->help != NULL;
681 const char *menu_get_help(struct menu *menu)
683 if (menu->help)
684 return menu->help;
689 static void get_def_str(struct gstr *r, struct menu *menu)
692 menu->file->name, menu->lineno);
713 struct menu *submenu[8], *menu, *location = NULL;
718 get_dep_str(r, prop->menu->dep, " Depends on: ");
727 if (!expr_eq(prop->menu->dep, prop->visible.expr))
730 menu = prop->menu;
731 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
732 submenu[i++] = menu;
733 if (location == NULL && menu_is_visible(menu))
734 location = menu;
747 menu = submenu[i];
748 if (jump && menu == location) {
758 str_printf(r, "%*c-> %s", indent, ' ', menu_get_prompt(menu));
759 if (menu->sym) {
760 str_printf(r, " (%s [=%s])", menu->sym->name ?
761 menu->sym->name : "<choice>",
762 sym_get_string_value(menu->sym));
810 if (prop->menu->prompt) {
811 get_def_str(r, prop->menu);
812 get_prompt_str(r, prop->menu->prompt, head);
817 if (!prop->menu->prompt) {
818 get_def_str(r, prop->menu);
819 get_dep_str(r, prop->menu->dep, " Depends on: ");
854 void menu_get_ext_help(struct menu *menu, struct gstr *help)
856 struct symbol *sym = menu->sym;
859 if (menu_has_help(menu)) {
862 help_text = menu_get_help(menu);