From 9f369ada90200730a1bcb9c6b3d01b344b913674 Mon Sep 17 00:00:00 2001 From: Cheng Renquan Date: Sun, 12 Jul 2009 16:11:44 +0800 Subject: [PATCH] --- yaml --- r: 165559 b: refs/heads/master c: 6bd5999d1a6166ad357f2ebf5e998ce49a407f62 h: refs/heads/master i: 165557: 386c38687ad9fe1688444d7ef7ccf2398fd2fcff 165555: 2528e50557a590a54ff3e23085b33cc31d29157b 165551: 172ad6af06e08e38a8cc6984320cb438428cc5af v: v3 --- [refs] | 2 +- trunk/scripts/kconfig/lkc_proto.h | 2 + trunk/scripts/kconfig/menu.c | 79 +++++++++++++++++++++++++++++++ 3 files changed, 82 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f1adf8f24c57..f164ee50857d 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 544e433a9e2a8771b8281ac58acb5c794613e705 +refs/heads/master: 6bd5999d1a6166ad357f2ebf5e998ce49a407f62 diff --git a/trunk/scripts/kconfig/lkc_proto.h b/trunk/scripts/kconfig/lkc_proto.h index 8e69461313d1..ffeb532b2cff 100644 --- a/trunk/scripts/kconfig/lkc_proto.h +++ b/trunk/scripts/kconfig/lkc_proto.h @@ -17,6 +17,8 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); P(menu_get_parent_menu,struct menu *,(struct menu *menu)); P(menu_has_help,bool,(struct menu *menu)); P(menu_get_help,const char *,(struct menu *menu)); +P(get_symbol_str,void,(struct gstr *r, struct symbol *sym)); +P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help)); /* symbol.c */ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); diff --git a/trunk/scripts/kconfig/menu.c b/trunk/scripts/kconfig/menu.c index 07ff8d105c9d..931d782a2392 100644 --- a/trunk/scripts/kconfig/menu.c +++ b/trunk/scripts/kconfig/menu.c @@ -9,6 +9,9 @@ #define LKC_DIRECT_LINK #include "lkc.h" +static const char nohelp_text[] = N_( + "There is no help available for this kernel option.\n"); + struct menu rootmenu; static struct menu **last_entry_ptr; @@ -451,3 +454,79 @@ const char *menu_get_help(struct menu *menu) else return ""; } + +static void get_prompt_str(struct gstr *r, struct property *prop) +{ + int i, j; + struct menu *submenu[8], *menu; + + str_printf(r, _("Prompt: %s\n"), _(prop->text)); + str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, + prop->menu->lineno); + if (!expr_is_yes(prop->visible.expr)) { + str_append(r, _(" Depends on: ")); + expr_gstr_print(prop->visible.expr, r); + str_append(r, "\n"); + } + menu = prop->menu->parent; + for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) + submenu[i++] = menu; + if (i > 0) { + str_printf(r, _(" Location:\n")); + for (j = 4; --i >= 0; j += 2) { + menu = submenu[i]; + str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu))); + if (menu->sym) { + str_printf(r, " (%s [=%s])", menu->sym->name ? + menu->sym->name : _(""), + sym_get_string_value(menu->sym)); + } + str_append(r, "\n"); + } + } +} + +void get_symbol_str(struct gstr *r, struct symbol *sym) +{ + bool hit; + struct property *prop; + + if (sym && sym->name) + str_printf(r, "Symbol: %s [=%s]\n", sym->name, + sym_get_string_value(sym)); + for_all_prompts(sym, prop) + get_prompt_str(r, prop); + hit = false; + for_all_properties(sym, prop, P_SELECT) { + if (!hit) { + str_append(r, " Selects: "); + hit = true; + } else + str_printf(r, " && "); + expr_gstr_print(prop->expr, r); + } + if (hit) + str_append(r, "\n"); + if (sym->rev_dep.expr) { + str_append(r, _(" Selected by: ")); + expr_gstr_print(sym->rev_dep.expr, r); + str_append(r, "\n"); + } + str_append(r, "\n\n"); +} + +void menu_get_ext_help(struct menu *menu, struct gstr *help) +{ + struct symbol *sym = menu->sym; + + if (menu_has_help(menu)) { + if (sym->name) { + str_printf(help, "CONFIG_%s:\n\n", sym->name); + str_append(help, _(menu_get_help(menu))); + str_append(help, "\n"); + } + } else { + str_append(help, nohelp_text); + } + get_symbol_str(help, sym); +}