All of lore.kernel.org
 help / color / mirror / Atom feed
From: Robin Holt <holt@sgi.com>
To: linux-kbuild@vger.kernel.org
Cc: holt@sgi.com
Subject: [Patch] menuconfig: Display current values with symbols.
Date: Wed, 9 Sep 2009 13:25:18 -0500	[thread overview]
Message-ID: <20090909182518.GB9913@sgi.com> (raw)


While investigating why a CONFIG_ symbol was not displayed, I was
frustrated with finding each of the dependent symbol's values.  This patch
adds a display of the symbol's value along side the symbol's name.

Signed-off-by: Robin Holt <holt@sgi.com>

---

One additional suggestion would be an easy way to navigate from the
search screen to the spot in the menus where that CONFIG_ value is set.
I could not figure out a clear and convenient method for that.  Some of
the menus are fairly long and since they are not sorted, can result in
some frustration while searching for the individual setting.


Index: xpmem_numatools_kernel/scripts/kconfig/expr.c
===================================================================
--- xpmem_numatools_kernel.orig/scripts/kconfig/expr.c	2009-09-08 13:30:57.000000000 -0500
+++ xpmem_numatools_kernel/scripts/kconfig/expr.c	2009-09-09 11:53:07.000000000 -0500
@@ -1013,6 +1013,19 @@ int expr_compare_type(enum expr_type t1,
 #endif
 }
 
+void expr_print_symbol(void (*fn)(void *, struct symbol *, const char *), void *data, struct symbol *sym)
+{
+	char sym_value_str[5];
+
+	if (sym->name) {
+		fn(data, sym, sym->name);
+		if (snprintf(sym_value_str, 5, "[=%s]", sym_get_string_value(sym)) < 5)
+			fn(data, sym, sym_value_str);
+	} else {
+		fn(data, NULL, "<choice>");
+	}
+}
+
 void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
 {
 	if (!e) {
@@ -1024,28 +1037,19 @@ void expr_print(struct expr *e, void (*f
 		fn(data, NULL, "(");
 	switch (e->type) {
 	case E_SYMBOL:
-		if (e->left.sym->name)
-			fn(data, e->left.sym, e->left.sym->name);
-		else
-			fn(data, NULL, "<choice>");
+		expr_print_symbol(fn, data, e->left.sym);
 		break;
 	case E_NOT:
 		fn(data, NULL, "!");
 		expr_print(e->left.expr, fn, data, E_NOT);
 		break;
 	case E_EQUAL:
-		if (e->left.sym->name)
-			fn(data, e->left.sym, e->left.sym->name);
-		else
-			fn(data, NULL, "<choice>");
+		expr_print_symbol(fn, data, e->left.sym);
 		fn(data, NULL, "=");
 		fn(data, e->right.sym, e->right.sym->name);
 		break;
 	case E_UNEQUAL:
-		if (e->left.sym->name)
-			fn(data, e->left.sym, e->left.sym->name);
-		else
-			fn(data, NULL, "<choice>");
+		expr_print_symbol(fn, data, e->left.sym);
 		fn(data, NULL, "!=");
 		fn(data, e->right.sym, e->right.sym->name);
 		break;

             reply	other threads:[~2009-09-09 18:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-09 18:25 Robin Holt [this message]
2009-11-25 10:22 ` [Patch] menuconfig: Display current values with symbols Michal Marek

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=20090909182518.GB9913@sgi.com \
    --to=holt@sgi.com \
    --cc=linux-kbuild@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.