MCPcopy Create free account
hub / github.com/coreboot/coreboot / get_prompt_str

Function get_prompt_str

util/kconfig/menu.c:696–753  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

694}
695
696static void get_prompt_str(struct gstr *r, struct property *prop,
697 struct list_head *head)
698{
699 int i, j;
700 struct menu *submenu[8], *menu, *location = NULL;
701 struct jump_key *jump = NULL;
702
703 str_printf(r, " Prompt: %s\n", prop->text);
704
705 get_dep_str(r, prop->menu->dep, " Depends on: ");
706 /*
707 * Most prompts in Linux have visibility that exactly matches their
708 * dependencies. For these, we print only the dependencies to improve
709 * readability. However, prompts with inline "if" expressions and
710 * prompts with a parent that has a "visible if" expression have
711 * differing dependencies and visibility. In these rare cases, we
712 * print both.
713 */
714 if (!expr_eq(prop->menu->dep, prop->visible.expr))
715 get_dep_str(r, prop->visible.expr, " Visible if: ");
716
717 menu = prop->menu;
718 for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) {
719 submenu[i++] = menu;
720 if (location == NULL && menu_is_visible(menu))
721 location = menu;
722 }
723 if (head && location) {
724 jump = xmalloc(sizeof(struct jump_key));
725 jump->target = location;
726 list_add_tail(&jump->entries, head);
727 }
728
729 str_printf(r, " Location:\n");
730 for (j = 0; --i >= 0; j++) {
731 int jk = -1;
732 int indent = 2 * j + 4;
733
734 menu = submenu[i];
735 if (jump && menu == location) {
736 jump->offset = strlen(r->s);
737 jk = get_jump_key_char();
738 }
739
740 if (jk >= 0) {
741 str_printf(r, "(%c)", jk);
742 indent -= 3;
743 }
744
745 str_printf(r, "%*c-> %s", indent, ' ', menu_get_prompt(menu));
746 if (menu->sym) {
747 str_printf(r, " (%s [=%s])", menu->sym->name ?
748 menu->sym->name : "<choice>",
749 sym_get_string_value(menu->sym));
750 }
751 str_append(r, "\n");
752 }
753}

Callers 1

get_symbol_strFunction · 0.85

Calls 11

str_printfFunction · 0.85
get_dep_strFunction · 0.85
expr_eqFunction · 0.85
menu_is_visibleFunction · 0.85
list_add_tailFunction · 0.85
strlenFunction · 0.85
menu_get_promptFunction · 0.85
sym_get_string_valueFunction · 0.85
str_appendFunction · 0.85
xmallocFunction · 0.70
get_jump_key_charFunction · 0.70

Tested by

no test coverage detected