diff options
-rw-r--r-- | scripts/kconfig/lkc_proto.h | 2 | ||||
-rw-r--r-- | scripts/kconfig/menu.c | 79 |
2 files changed, 81 insertions, 0 deletions
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 8e69461313d1..ffeb532b2cff 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -17,6 +17,8 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); | |||
17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | 17 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); |
18 | P(menu_has_help,bool,(struct menu *menu)); | 18 | P(menu_has_help,bool,(struct menu *menu)); |
19 | P(menu_get_help,const char *,(struct menu *menu)); | 19 | P(menu_get_help,const char *,(struct menu *menu)); |
20 | P(get_symbol_str,void,(struct gstr *r, struct symbol *sym)); | ||
21 | P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); | ||
20 | 22 | ||
21 | /* symbol.c */ | 23 | /* symbol.c */ |
22 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | 24 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 07ff8d105c9d..931d782a2392 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -9,6 +9,9 @@ | |||
9 | #define LKC_DIRECT_LINK | 9 | #define LKC_DIRECT_LINK |
10 | #include "lkc.h" | 10 | #include "lkc.h" |
11 | 11 | ||
12 | static const char nohelp_text[] = N_( | ||
13 | "There is no help available for this kernel option.\n"); | ||
14 | |||
12 | struct menu rootmenu; | 15 | struct menu rootmenu; |
13 | static struct menu **last_entry_ptr; | 16 | static struct menu **last_entry_ptr; |
14 | 17 | ||
@@ -451,3 +454,79 @@ const char *menu_get_help(struct menu *menu) | |||
451 | else | 454 | else |
452 | return ""; | 455 | return ""; |
453 | } | 456 | } |
457 | |||
458 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
459 | { | ||
460 | int i, j; | ||
461 | struct menu *submenu[8], *menu; | ||
462 | |||
463 | str_printf(r, _("Prompt: %s\n"), _(prop->text)); | ||
464 | str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, | ||
465 | prop->menu->lineno); | ||
466 | if (!expr_is_yes(prop->visible.expr)) { | ||
467 | str_append(r, _(" Depends on: ")); | ||
468 | expr_gstr_print(prop->visible.expr, r); | ||
469 | str_append(r, "\n"); | ||
470 | } | ||
471 | menu = prop->menu->parent; | ||
472 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
473 | submenu[i++] = menu; | ||
474 | if (i > 0) { | ||
475 | str_printf(r, _(" Location:\n")); | ||
476 | for (j = 4; --i >= 0; j += 2) { | ||
477 | menu = submenu[i]; | ||
478 | str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); | ||
479 | if (menu->sym) { | ||
480 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
481 | menu->sym->name : _("<choice>"), | ||
482 | sym_get_string_value(menu->sym)); | ||
483 | } | ||
484 | str_append(r, "\n"); | ||
485 | } | ||
486 | } | ||
487 | } | ||
488 | |||
489 | void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
490 | { | ||
491 | bool hit; | ||
492 | struct property *prop; | ||
493 | |||
494 | if (sym && sym->name) | ||
495 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
496 | sym_get_string_value(sym)); | ||
497 | for_all_prompts(sym, prop) | ||
498 | get_prompt_str(r, prop); | ||
499 | hit = false; | ||
500 | for_all_properties(sym, prop, P_SELECT) { | ||
501 | if (!hit) { | ||
502 | str_append(r, " Selects: "); | ||
503 | hit = true; | ||
504 | } else | ||
505 | str_printf(r, " && "); | ||
506 | expr_gstr_print(prop->expr, r); | ||
507 | } | ||
508 | if (hit) | ||
509 | str_append(r, "\n"); | ||
510 | if (sym->rev_dep.expr) { | ||
511 | str_append(r, _(" Selected by: ")); | ||
512 | expr_gstr_print(sym->rev_dep.expr, r); | ||
513 | str_append(r, "\n"); | ||
514 | } | ||
515 | str_append(r, "\n\n"); | ||
516 | } | ||
517 | |||
518 | void menu_get_ext_help(struct menu *menu, struct gstr *help) | ||
519 | { | ||
520 | struct symbol *sym = menu->sym; | ||
521 | |||
522 | if (menu_has_help(menu)) { | ||
523 | if (sym->name) { | ||
524 | str_printf(help, "CONFIG_%s:\n\n", sym->name); | ||
525 | str_append(help, _(menu_get_help(menu))); | ||
526 | str_append(help, "\n"); | ||
527 | } | ||
528 | } else { | ||
529 | str_append(help, nohelp_text); | ||
530 | } | ||
531 | get_symbol_str(help, sym); | ||
532 | } | ||