From: Cheng Renquan <crq@kernel.org>
To: linux-kbuild@vger.kernel.org, Sam Ravnborg <sam@ravnborg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, crquan@gmail.com
Subject: [PATCH 2/6] add menu_get_ext_help function to display more information
Date: Sun, 12 Jul 2009 16:11:44 +0800 [thread overview]
Message-ID: <1247386308-19628-3-git-send-email-crq@kernel.org> (raw)
In-Reply-To: <1247386308-19628-2-git-send-email-crq@kernel.org>
From: Cheng Renquan <crquan@gmail.com>
The three functions are moved from mconf.c, then they can be shared in
all menuconfig & gconfig & xconfig & config.
+void menu_get_ext_help(struct menu *menu, struct gstr *help)
+static void get_prompt_str(struct gstr *r, struct property *prop)
+void get_symbol_str(struct gstr *r, struct symbol *sym)
Signed-off-by: Cheng Renquan <crquan@gmail.com>
---
scripts/kconfig/lkc_proto.h | 2 +
| 79 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 0 deletions(-)
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 8e69461..ffeb532 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));
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]);
--git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 07ff8d1..931d782 100644
--- a/scripts/kconfig/menu.c
+++ b/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 : _("<choice>"),
+ 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);
+}
--
1.6.3.3
next prev parent reply other threads:[~2009-07-12 8:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-12 8:11 [PATCH 0/6] kbuild configuration system improvements Cheng Renquan
2009-07-12 8:11 ` [PATCH 1/6] add symbol value to help find the real depend Cheng Renquan
2009-07-12 8:11 ` Cheng Renquan [this message]
2009-07-12 8:11 ` [PATCH 3/6] menuconfig improvements Cheng Renquan
2009-07-12 8:11 ` [PATCH 4/6] make use of menu_get_ext_help in gconfig Cheng Renquan
2009-07-12 8:11 ` [PATCH 5/6] make use of menu_get_ext_help in qconfig Cheng Renquan
2009-07-12 8:11 ` [PATCH 6/6] make use of menu_get_ext_help in "make config" Cheng Renquan
2009-07-12 10:00 ` [PATCH 1/6] add symbol value to help find the real depend Mikael Pettersson
2009-07-12 17:14 ` Cheng Renquan
2009-07-18 7:21 ` [PATCH 0/6] kbuild configuration system improvements Sam Ravnborg
2009-07-18 10:47 ` Cheng Renquan
2009-07-22 20:43 ` Randy Dunlap
2009-07-22 21:48 ` Sam Ravnborg
2009-07-23 0:12 ` Randy Dunlap
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1247386308-19628-3-git-send-email-crq@kernel.org \
--to=crq@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=crquan@gmail.com \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sam@ravnborg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox