From: Sam Ravnborg <sam@ravnborg.org>
To: Roman Zippel <zippel@linux-m68k.org>
Cc: Sam Ravnborg <sam@ravnborg.org>, Adrian Bunk <bunk@fs.tum.de>,
linux-kernel@vger.kernel.org
Subject: menuconfig displays dependencies [Was: select FW_LOADER -> depends HOTPLUG]
Date: Sat, 14 Aug 2004 09:49:53 +0200 [thread overview]
Message-ID: <20040814074953.GA20123@mars.ravnborg.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0408120027330.20634@scrub.home>
On Thu, Aug 12, 2004 at 01:05:47AM +0200, Roman Zippel wrote:
> > It would be nice in menuconfig to see what config symbol
> > that has dependencies and/or side effects.
>
> xconfig has something like this, if you enable 'Debug Info', although it
> rather dumps the internal representation.
> Adding something like this to menuconfig, would mean hacking lxdialog,
> which is rather at the bottom of the list of things I want to do. :)
Did a quick hack on this.
When choosing help on "HCI BlueFRITZ! USB driver" menuconfig now displays:
-------------------------------------------------
Depends on (select to enable this option):
BT & USB
Selects (will be enabled by this option):
FW_LOADER
CONFIG_BT_HCIBFUSB
Bluetooth HCI BlueFRITZ! USB driver.
....
-------------------------------------------------
To simplify things I just malloc'ed 'enough' memory for the help screen.
Just a quick hack, but something to play with - and no lxdialog hacking :-)
Sam
===== scripts/kconfig/expr.c 1.5 vs edited =====
--- 1.5/scripts/kconfig/expr.c 2004-03-19 07:04:54 +01:00
+++ edited/scripts/kconfig/expr.c 2004-08-14 09:20:04 +02:00
@@ -1087,3 +1087,42 @@
{
expr_print(e, expr_print_file_helper, out, E_NONE);
}
+
+void expr_get_dep_txt(struct expr *e, char *t)
+{
+ if (!e)
+ return;
+
+ switch (e->type) {
+ case E_SYMBOL:
+ strcat(t, e->left.sym->name);
+ break;
+ case E_AND:
+ expr_get_dep_txt(e->left.expr, t);
+ strcat(t, " & ");
+ expr_get_dep_txt(e->right.expr, t);
+ break;
+ case E_OR:
+ expr_get_dep_txt(e->left.expr, t);
+ strcat(t, " | ");
+ expr_get_dep_txt(e->right.expr, t);
+ break;
+ case E_NOT:
+ strcat(t, " !");
+ expr_get_dep_txt(e->left.expr, t);
+ break;
+ case E_EQUAL:
+ expr_get_dep_txt(e->left.expr, t);
+ strcat(t, " == ");
+ expr_get_dep_txt(e->right.expr, t);
+ break;
+ case E_UNEQUAL:
+ expr_get_dep_txt(e->left.expr, t);
+ strcat(t, " != ");
+ expr_get_dep_txt(e->right.expr, t);
+ break;
+ default:
+ printf("expr_calc_value: %d?\n", e->type);
+ break;
+ }
+}
===== scripts/kconfig/expr.h 1.11 vs edited =====
--- 1.11/scripts/kconfig/expr.h 2004-03-19 07:04:54 +01:00
+++ edited/scripts/kconfig/expr.h 2004-08-14 09:18:15 +02:00
@@ -174,6 +174,7 @@
struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
void expr_fprint(struct expr *e, FILE *out);
+void expr_get_dep_txt(struct expr *e, char *t);
static inline int expr_is_yes(struct expr *e)
{
===== scripts/kconfig/lkc_proto.h 1.3 vs edited =====
--- 1.3/scripts/kconfig/lkc_proto.h 2003-05-28 22:46:41 +02:00
+++ edited/scripts/kconfig/lkc_proto.h 2004-08-14 09:01:55 +02:00
@@ -9,6 +9,8 @@
P(menu_is_visible,bool,(struct menu *menu));
P(menu_get_prompt,const char *,(struct menu *menu));
+P(menu_get_dep_txt,void,(struct menu *menu, char *t));
+P(menu_get_select_txt,void,(struct menu *menu, char *t));
P(menu_get_root_menu,struct menu *,(struct menu *menu));
P(menu_get_parent_menu,struct menu *,(struct menu *menu));
===== scripts/kconfig/mconf.c 1.12 vs edited =====
--- 1.12/scripts/kconfig/mconf.c 2004-07-14 17:47:52 +02:00
+++ edited/scripts/kconfig/mconf.c 2004-08-14 09:23:13 +02:00
@@ -572,19 +572,29 @@
static void show_help(struct menu *menu)
{
const char *help;
- char *helptext;
+ char *helptext = malloc(20000); /* Enough.. */
struct symbol *sym = menu->sym;
+ *helptext = '\0';
+ strcat(helptext, "Depends on (select to enable this option):\n");
+ menu_get_dep_txt(menu, helptext);
+ strcat(helptext, "\nSelects (will be enabled by this option):\n");
+ menu_get_select_txt(menu, helptext);
+
help = sym->help;
if (!help)
help = nohelp_text;
if (sym->name) {
- helptext = malloc(strlen(sym->name) + strlen(help) + 16);
- sprintf(helptext, "CONFIG_%s:\n\n%s", sym->name, help);
- show_helptext(menu_get_prompt(menu), helptext);
- free(helptext);
- } else
- show_helptext(menu_get_prompt(menu), help);
+ strcat(helptext, "\n\nCONFIG_");
+ strcat(helptext, sym->name);
+ strcat(helptext, "\n\n");
+ strcat(helptext, help);
+ } else {
+ strcat(helptext, "\n\n");
+ strcat(helptext, help);
+ }
+ show_helptext(menu_get_prompt(menu), helptext);
+ free(helptext);
}
static void show_readme(void)
===== scripts/kconfig/menu.c 1.12 vs edited =====
--- 1.12/scripts/kconfig/menu.c 2004-02-04 06:31:11 +01:00
+++ edited/scripts/kconfig/menu.c 2004-08-14 09:37:28 +02:00
@@ -372,6 +372,26 @@
return NULL;
}
+void menu_get_dep_txt(struct menu *menu, char *t)
+{
+ if (menu->dep)
+ expr_get_dep_txt(menu->dep, t);
+ if (menu->sym && menu->sym->dep)
+ expr_get_dep_txt(menu->sym->dep, t);
+}
+
+void menu_get_select_txt(struct menu *menu, char *t)
+{
+ if (menu->sym)
+ {
+ struct property *prop;
+ for_all_properties(menu->sym, prop, P_SELECT)
+ {
+ expr_get_dep_txt(prop->expr, t);
+ }
+ }
+}
+
struct menu *menu_get_root_menu(struct menu *menu)
{
return &rootmenu;
next prev parent reply other threads:[~2004-08-14 7:47 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-09 19:56 [2.6 patch] select FW_LOADER -> depends HOTPLUG Adrian Bunk
2004-08-09 20:08 ` Adrian Bunk
2004-08-09 20:26 ` Marcelo Tosatti
2004-08-09 22:05 ` Adrian Bunk
2004-08-09 20:38 ` Sam Ravnborg
2004-08-10 0:24 ` Roman Zippel
2004-08-10 8:44 ` Adrian Bunk
2004-08-10 21:16 ` Sam Ravnborg
2004-08-11 11:15 ` Marcelo Tosatti
2004-08-11 21:25 ` Randy.Dunlap
2004-08-11 23:05 ` Roman Zippel
2004-08-12 19:18 ` Adrian Bunk
2004-08-15 17:06 ` Roman Zippel
2004-08-14 7:49 ` Sam Ravnborg [this message]
2004-08-14 18:12 ` menuconfig displays dependencies [Was: select FW_LOADER -> depends HOTPLUG] Randy.Dunlap
2004-08-14 21:05 ` Adrian Bunk
2004-08-14 22:37 ` Sam Ravnborg
2004-08-15 20:21 ` Adrian Bunk
2004-08-15 20:32 ` Sam Ravnborg
2004-08-15 20:45 ` Adrian Bunk
2004-08-15 17:35 ` Roman Zippel
2004-08-15 17:40 ` Adrian Bunk
2004-08-15 22:47 ` Roman Zippel
2004-08-16 19:57 ` Adrian Bunk
2004-08-16 20:07 ` Russell King
2004-08-16 20:22 ` Adrian Bunk
2004-08-16 20:39 ` Roman Zippel
2004-08-15 17:28 ` Roman Zippel
2004-08-15 17:58 ` Sam Ravnborg
2004-08-15 22:49 ` Roman Zippel
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=20040814074953.GA20123@mars.ravnborg.org \
--to=sam@ravnborg.org \
--cc=bunk@fs.tum.de \
--cc=linux-kernel@vger.kernel.org \
--cc=zippel@linux-m68k.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
Powered by JetHome