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, ...) in menu_warn() argument
25 fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno); in menu_warn()
49 struct menu *menu; in menu_add_entry() local
51 menu = malloc(sizeof(*menu)); in menu_add_entry()
52 memset(menu, 0, sizeof(*menu)); in menu_add_entry()
53 menu->sym = sym; in menu_add_entry()
54 menu->parent = current_menu; in menu_add_entry()
55 menu->file = current_file; in menu_add_entry()
56 menu->lineno = zconf_lineno(); in menu_add_entry()
58 *last_entry_ptr = menu; in menu_add_entry()
59 last_entry_ptr = &menu->next; in menu_add_entry()
60 current_entry = menu; in menu_add_entry()
69 struct menu *menu_add_menu(void) in menu_add_menu()
131 prop->menu = current_entry; in menu_add_prop()
146 struct menu *menu = current_entry; in menu_add_prop() local
148 while ((menu = menu->parent) != NULL) { in menu_add_prop()
149 if (!menu->visibility) in menu_add_prop()
153 menu->visibility); in menu_add_prop()
262 void menu_finalize(struct menu *parent) in menu_finalize()
264 struct menu *menu, *last_menu; in menu_finalize() local
275 for (menu = parent->list; menu; menu = menu->next) { in menu_finalize()
276 if (menu->sym && menu->sym->type != S_UNKNOWN) { in menu_finalize()
277 menu_set_type(menu->sym->type); in menu_finalize()
283 for (menu = parent->list; menu; menu = menu->next) { in menu_finalize()
284 current_entry = menu; in menu_finalize()
285 if (menu->sym && menu->sym->type == S_UNKNOWN) in menu_finalize()
294 for (menu = parent->list; menu; menu = menu->next) { in menu_finalize()
295 basedep = expr_transform(menu->dep); in menu_finalize()
298 menu->dep = basedep; in menu_finalize()
299 if (menu->sym) in menu_finalize()
300 prop = menu->sym->prop; in menu_finalize()
302 prop = menu->prompt; in menu_finalize()
304 if (prop->menu != menu) in menu_finalize()
309 if (menu->sym && menu->sym->type != S_TRISTATE) in menu_finalize()
315 expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); in menu_finalize()
319 for (menu = parent->list; menu; menu = menu->next) in menu_finalize()
320 menu_finalize(menu); in menu_finalize()
326 for (menu = parent->next; menu; menu = menu->next) { in menu_finalize()
327 dep = menu->prompt ? menu->prompt->visible.expr : menu->dep; in menu_finalize()
343 menu_finalize(menu); in menu_finalize()
344 menu->parent = parent; in menu_finalize()
345 last_menu = menu; in menu_finalize()
355 for (menu = parent->list; menu; menu = menu->next) { in menu_finalize()
357 menu->sym && !sym_is_choice_value(menu->sym)) { in menu_finalize()
358 current_entry = menu; in menu_finalize()
359 menu->sym->flags |= SYMBOL_CHOICEVAL; in menu_finalize()
360 if (!menu->prompt) in menu_finalize()
361 menu_warn(menu, "choice value must have a prompt"); in menu_finalize()
362 for (prop = menu->sym->prop; prop; prop = prop->next) { in menu_finalize()
366 if (prop->menu == menu) in menu_finalize()
369 prop->menu->parent->sym != sym) in menu_finalize()
378 if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) { in menu_finalize()
380 menu->dep = expr_alloc_and(basedep, menu->dep); in menu_finalize()
381 for (prop = menu->sym->prop; prop; prop = prop->next) { in menu_finalize()
382 if (prop->menu != menu) in menu_finalize()
393 (*ep)->right.sym = menu->sym; in menu_finalize()
395 if (menu->list && (!menu->prompt || !menu->prompt->text)) { in menu_finalize()
396 for (last_menu = menu->list; ; last_menu = last_menu->next) { in menu_finalize()
401 last_menu->next = menu->next; in menu_finalize()
402 menu->next = menu->list; in menu_finalize()
403 menu->list = NULL; in menu_finalize()
426 bool menu_has_prompt(struct menu *menu) in menu_has_prompt() argument
428 if (!menu->prompt) in menu_has_prompt()
433 bool menu_is_visible(struct menu *menu) in menu_is_visible() argument
435 struct menu *child; in menu_is_visible()
439 if (!menu->prompt) in menu_is_visible()
442 if (menu->visibility) { in menu_is_visible()
443 if (expr_calc_value(menu->visibility) == no) in menu_is_visible()
447 sym = menu->sym; in menu_is_visible()
450 visible = menu->prompt->visible.tri; in menu_is_visible()
452 visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr); in menu_is_visible()
457 if (!sym || sym_get_tristate_value(menu->sym) == no) in menu_is_visible()
460 for (child = menu->list; child; child = child->next) { in menu_is_visible()
471 const char *menu_get_prompt(struct menu *menu) in menu_get_prompt() argument
473 if (menu->prompt) in menu_get_prompt()
474 return menu->prompt->text; in menu_get_prompt()
475 else if (menu->sym) in menu_get_prompt()
476 return menu->sym->name; in menu_get_prompt()
480 struct menu *menu_get_root_menu(struct menu *menu) in menu_get_root_menu() argument
485 struct menu *menu_get_parent_menu(struct menu *menu) in menu_get_parent_menu() argument
489 for (; menu != &rootmenu; menu = menu->parent) { in menu_get_parent_menu()
490 type = menu->prompt ? menu->prompt->type : 0; in menu_get_parent_menu()
494 return menu; in menu_get_parent_menu()
497 bool menu_has_help(struct menu *menu) in menu_has_help() argument
499 return menu->help != NULL; in menu_has_help()
502 const char *menu_get_help(struct menu *menu) in menu_get_help() argument
504 if (menu->help) in menu_get_help()
505 return menu->help; in menu_get_help()
513 struct menu *submenu[8], *menu; in get_prompt_str() local
516 str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, in get_prompt_str()
517 prop->menu->lineno); in get_prompt_str()
523 menu = prop->menu->parent; in get_prompt_str()
524 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) in get_prompt_str()
525 submenu[i++] = menu; in get_prompt_str()
529 menu = submenu[i]; in get_prompt_str()
530 str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); in get_prompt_str()
531 if (menu->sym) { in get_prompt_str()
532 str_printf(r, " (%s [=%s])", menu->sym->name ? in get_prompt_str()
533 menu->sym->name : _("<choice>"), in get_prompt_str()
534 sym_get_string_value(menu->sym)); in get_prompt_str()
594 void menu_get_ext_help(struct menu *menu, struct gstr *help) in menu_get_ext_help() argument
596 struct symbol *sym = menu->sym; in menu_get_ext_help()
599 if (menu_has_help(menu)) { in menu_get_ext_help()
602 help_text = menu_get_help(menu); in menu_get_ext_help()