Lines Matching +full:tri +full:- +full:default
1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
22 * menu_next - return the next menu entry with depth-first traversal
24 * @root: root of the sub-tree to traverse. If NULL is given, the traveral
30 if (menu->list) in menu_next()
31 return menu->list; in menu_next()
33 while (menu != root && !menu->next) in menu_next()
34 menu = menu->parent; in menu_next()
39 return menu->next; in menu_next()
46 fprintf(stderr, "%s:%d:warning: ", menu->filename, menu->lineno); in menu_warn()
56 fprintf(stderr, "%s:%d:warning: ", prop->filename, prop->lineno); in prop_warn()
74 menu->sym = sym; in menu_add_entry()
75 menu->parent = current_menu; in menu_add_entry()
76 menu->filename = cur_filename; in menu_add_entry()
77 menu->lineno = cur_lineno; in menu_add_entry()
80 last_entry_ptr = &menu->next; in menu_add_entry()
83 list_add_tail(&menu->link, &sym->menus); in menu_add_entry()
88 last_entry_ptr = ¤t_entry->list; in menu_add_menu()
95 last_entry_ptr = ¤t_menu->next; in menu_end_menu()
96 current_menu = current_menu->parent; in menu_end_menu()
108 switch (e->type) { in rewrite_m()
110 e = expr_alloc_one(E_NOT, rewrite_m(e->left.expr)); in rewrite_m()
114 e = expr_alloc_two(e->type, in rewrite_m()
115 rewrite_m(e->left.expr), in rewrite_m()
116 rewrite_m(e->right.expr)); in rewrite_m()
120 if (e->left.sym == &symbol_mod) in rewrite_m()
123 default: in rewrite_m()
131 current_entry->dep = expr_alloc_and(current_entry->dep, dep); in menu_add_dep()
136 struct symbol *sym = current_entry->sym; in menu_set_type()
138 if (sym->type == type) in menu_set_type()
140 if (sym->type == S_UNKNOWN) { in menu_set_type()
141 sym->type = type; in menu_set_type()
146 sym->name ? sym->name : "<choice>", in menu_set_type()
147 sym_type_name(sym->type), sym_type_name(type)); in menu_set_type()
157 prop->type = type; in menu_add_prop()
158 prop->filename = cur_filename; in menu_add_prop()
159 prop->lineno = cur_lineno; in menu_add_prop()
160 prop->menu = current_entry; in menu_add_prop()
161 prop->expr = expr; in menu_add_prop()
162 prop->visible.expr = dep; in menu_add_prop()
165 if (current_entry->sym) { in menu_add_prop()
168 for (propp = ¤t_entry->sym->prop; in menu_add_prop()
170 propp = &(*propp)->next) in menu_add_prop()
188 if (current_entry->prompt) in menu_add_prompt()
195 while ((menu = menu->parent) != NULL) { in menu_add_prompt()
197 if (!menu->visibility) in menu_add_prompt()
199 prop->visible.expr = expr_alloc_and(prop->visible.expr, in menu_add_prompt()
200 menu->visibility); in menu_add_prompt()
204 current_entry->prompt = prop; in menu_add_prompt()
205 prop->text = prompt; in menu_add_prompt()
212 current_entry->visibility = expr_alloc_and(current_entry->visibility, in menu_add_visibility()
228 return sym2->type == S_INT || sym2->type == S_HEX || in menu_validate_number()
229 (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); in menu_validate_number()
238 for (prop = sym->prop; prop; prop = prop->next) { in sym_check_prop()
239 switch (prop->type) { in sym_check_prop()
241 if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) && in sym_check_prop()
242 prop->expr->type != E_SYMBOL) in sym_check_prop()
244 "default for config symbol '%s'" in sym_check_prop()
245 " must be a single symbol", sym->name); in sym_check_prop()
246 if (prop->expr->type != E_SYMBOL) in sym_check_prop()
249 if (sym->type == S_HEX || sym->type == S_INT) { in sym_check_prop()
253 sym->name); in sym_check_prop()
258 if (!choice || choice->sym != sym) in sym_check_prop()
260 "choice default symbol '%s' is not contained in the choice", in sym_check_prop()
261 sym2->name); in sym_check_prop()
266 use = prop->type == P_SELECT ? "select" : "imply"; in sym_check_prop()
268 if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE) in sym_check_prop()
271 "not bool or tristate", sym->name, use); in sym_check_prop()
272 else if (sym2->type != S_UNKNOWN && in sym_check_prop()
273 sym2->type != S_BOOLEAN && in sym_check_prop()
274 sym2->type != S_TRISTATE) in sym_check_prop()
278 "tristate type", sym2->name, use); in sym_check_prop()
281 if (sym->type != S_INT && sym->type != S_HEX) in sym_check_prop()
284 if (!menu_validate_number(sym, prop->expr->left.sym) || in sym_check_prop()
285 !menu_validate_number(sym, prop->expr->right.sym)) in sym_check_prop()
288 default: in sym_check_prop()
301 sym = parent->sym; in _menu_finalize()
302 if (parent->list) { in _menu_finalize()
309 for (menu = parent->list; menu; menu = menu->next) { in _menu_finalize()
314 basedep = rewrite_m(menu->dep); in _menu_finalize()
316 basedep = expr_alloc_and(parent->dep, basedep); in _menu_finalize()
318 menu->dep = basedep; in _menu_finalize()
320 if (menu->sym) in _menu_finalize()
325 prop = menu->sym->prop; in _menu_finalize()
328 * For non-symbol menu nodes, we just need to in _menu_finalize()
331 prop = menu->prompt; in _menu_finalize()
334 for (; prop; prop = prop->next) { in _menu_finalize()
335 if (prop->menu != menu) in _menu_finalize()
340 * and so isn't location-specific, in _menu_finalize()
358 dep = rewrite_m(prop->visible.expr); in _menu_finalize()
362 prop->visible.expr = dep; in _menu_finalize()
368 if (prop->type == P_SELECT) { in _menu_finalize()
370 es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr, in _menu_finalize()
371 expr_alloc_and(expr_alloc_symbol(menu->sym), dep)); in _menu_finalize()
372 } else if (prop->type == P_IMPLY) { in _menu_finalize()
374 es->implied.expr = expr_alloc_or(es->implied.expr, in _menu_finalize()
375 expr_alloc_and(expr_alloc_symbol(menu->sym), dep)); in _menu_finalize()
384 for (menu = parent->list; menu; menu = menu->next) in _menu_finalize()
394 * +-A in _menu_finalize()
395 * +-B in _menu_finalize()
396 * +-C in _menu_finalize()
403 * +-A in _menu_finalize()
404 * | +-B in _menu_finalize()
405 * +-C in _menu_finalize()
409 basedep = parent->prompt ? parent->prompt->visible.expr : NULL; in _menu_finalize()
415 for (menu = parent->next; menu; menu = menu->next) { in _menu_finalize()
416 dep = menu->prompt ? menu->prompt->visible.expr : menu->dep; in _menu_finalize()
444 menu->parent = parent; in _menu_finalize()
448 parent->list = parent->next; in _menu_finalize()
449 parent->next = last_menu->next; in _menu_finalize()
450 last_menu->next = NULL; in _menu_finalize()
453 sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep); in _menu_finalize()
455 for (menu = parent->list; menu; menu = menu->next) { in _menu_finalize()
472 * +-B in _menu_finalize()
473 * +-C in _menu_finalize()
484 if (menu->list && (!menu->prompt || !menu->prompt->text)) { in _menu_finalize()
485 for (last_menu = menu->list; ; last_menu = last_menu->next) { in _menu_finalize()
486 last_menu->parent = parent; in _menu_finalize()
487 if (!last_menu->next) in _menu_finalize()
490 last_menu->next = menu->next; in _menu_finalize()
491 menu->next = menu->list; in _menu_finalize()
492 menu->list = NULL; in _menu_finalize()
496 if (sym && !(sym->flags & SYMBOL_WARNED)) { in _menu_finalize()
497 if (sym->type == S_UNKNOWN) in _menu_finalize()
502 sym->flags |= SYMBOL_WARNED; in _menu_finalize()
513 if (!menu->prompt) in menu_has_prompt()
527 for (child = menu->list; child; child = child->next) { in menu_is_empty()
540 if (!menu->prompt) in menu_is_visible()
543 if (menu->visibility) { in menu_is_visible()
544 if (expr_calc_value(menu->visibility) == no) in menu_is_visible()
548 sym = menu->sym; in menu_is_visible()
551 visible = menu->prompt->visible.tri; in menu_is_visible()
553 visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr); in menu_is_visible()
558 if (!sym || sym_get_tristate_value(menu->sym) == no) in menu_is_visible()
561 for (child = menu->list; child; child = child->next) in menu_is_visible()
570 if (menu->prompt) in menu_get_prompt()
571 return menu->prompt->text; in menu_get_prompt()
572 else if (menu->sym) in menu_get_prompt()
573 return menu->sym->name; in menu_get_prompt()
581 for (; menu != &rootmenu; menu = menu->parent) { in menu_get_parent_menu()
582 type = menu->prompt ? menu->prompt->type : 0; in menu_get_parent_menu()
592 menu->filename, menu->lineno); in get_def_str()
607 return -1; in get_jump_key_char()
617 str_printf(r, " Prompt: %s\n", prop->text); in get_prompt_str()
619 get_dep_str(r, prop->menu->dep, " Depends on: "); in get_prompt_str()
628 if (!expr_eq(prop->menu->dep, prop->visible.expr)) in get_prompt_str()
629 get_dep_str(r, prop->visible.expr, " Visible if: "); in get_prompt_str()
631 menu = prop->menu; in get_prompt_str()
632 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { in get_prompt_str()
639 jump->target = location; in get_prompt_str()
640 list_add_tail(&jump->entries, head); in get_prompt_str()
644 for (j = 0; --i >= 0; j++) { in get_prompt_str()
645 int jk = -1; in get_prompt_str()
650 jump->offset = strlen(r->s); in get_prompt_str()
656 indent -= 3; in get_prompt_str()
659 str_printf(r, "%*c-> %s", indent, ' ', menu_get_prompt(menu)); in get_prompt_str()
660 if (menu->sym) { in get_prompt_str()
661 str_printf(r, " (%s [=%s])", menu->sym->name ? in get_prompt_str()
662 menu->sym->name : "<choice>", in get_prompt_str()
663 sym_get_string_value(menu->sym)); in get_prompt_str()
681 expr_gstr_print(prop->expr, r); in get_symbol_props_str()
696 if (sym && sym->name) { in get_symbol_str()
697 str_printf(r, "Symbol: %s [=%s]\n", sym->name, in get_symbol_str()
699 str_printf(r, "Type : %s\n", sym_type_name(sym->type)); in get_symbol_str()
700 if (sym->type == S_INT || sym->type == S_HEX) { in get_symbol_str()
704 expr_gstr_print(prop->expr, r); in get_symbol_str()
711 list_for_each_entry(menu, &sym->menus, link) { in get_symbol_str()
712 if (menu->prompt) { in get_symbol_str()
714 get_prompt_str(r, menu->prompt, head); in get_symbol_str()
718 list_for_each_entry(menu, &sym->menus, link) { in get_symbol_str()
719 if (!menu->prompt) { in get_symbol_str()
721 get_dep_str(r, menu->dep, " Depends on: "); in get_symbol_str()
726 if (sym->rev_dep.expr) { in get_symbol_str()
727 expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, "Selected by [y]:\n"); in get_symbol_str()
728 expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, "Selected by [m]:\n"); in get_symbol_str()
729 expr_gstr_print_revdep(sym->rev_dep.expr, r, no, "Selected by [n]:\n"); in get_symbol_str()
733 if (sym->implied.expr) { in get_symbol_str()
734 expr_gstr_print_revdep(sym->implied.expr, r, yes, "Implied by [y]:\n"); in get_symbol_str()
735 expr_gstr_print_revdep(sym->implied.expr, r, mod, "Implied by [m]:\n"); in get_symbol_str()
736 expr_gstr_print_revdep(sym->implied.expr, r, no, "Implied by [n]:\n"); in get_symbol_str()
758 struct symbol *sym = menu->sym; in menu_get_ext_help()
761 if (menu->help) { in menu_get_ext_help()
762 if (sym->name) in menu_get_ext_help()
763 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); in menu_get_ext_help()
764 help_text = menu->help; in menu_get_ext_help()