summaryrefslogtreecommitdiffstats
path: root/scripts/kconfig/mconf.c
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2010-11-01 19:16:47 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2010-11-17 12:30:41 +0100
commit7330db86ea8037c56f9804f8a74174de6d7108da (patch)
treedc4a9dbc6c2a623afeb04c8e9d3b3d595b8facfd /scripts/kconfig/mconf.c
parent29e4c19f755534e39408e66033003b8ec539f4d1 (diff)
downloadptxdist-7330db86ea8037c56f9804f8a74174de6d7108da.tar.gz
ptxdist-7330db86ea8037c56f9804f8a74174de6d7108da.tar.xz
kconfig: update with kconfig from linux-2.6.37-rc2
The kconfig upstream now has a configurable conig symbol prefix and there are no more references to the kernel in the help texts. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts/kconfig/mconf.c')
-rw-r--r--scripts/kconfig/mconf.c177
1 files changed, 59 insertions, 118 deletions
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index a888ebdca..616802028 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -25,8 +25,9 @@
static const char mconf_readme[] = N_(
"Overview\n"
"--------\n"
-"Some parameters are not really features, but must be\n"
-"entered in as decimal or hexadecimal numbers or possibly text.\n"
+"This interface let you select features and parameters for the build.\n"
+"Features can either be built-in, modularized, or ignored. Parameters\n"
+"must be entered in as decimal or hexadecimal numbers or text.\n"
"\n"
"Menu items beginning with following braces represent features that\n"
" [ ] can be built in or removed\n"
@@ -64,13 +65,15 @@ static const char mconf_readme[] = N_(
" there is a delayed response which you may find annoying.\n"
"\n"
" Also, the <TAB> and cursor keys will cycle between <Select>,\n"
-" <Exit> and <Help>\n"
+" <Exit> and <Help>.\n"
"\n"
"o To get help with an item, use the cursor keys to highlight <Help>\n"
-" and Press <ENTER>.\n"
+" and press <ENTER>.\n"
"\n"
" Shortcut: Press <H> or <?>.\n"
"\n"
+"o To toggle the display of hidden options, press <Z>.\n"
+"\n"
"\n"
"Radiolists (Choice lists)\n"
"-----------\n"
@@ -145,9 +148,9 @@ static const char mconf_readme[] = N_(
"\n"
"Optional personality available\n"
"------------------------------\n"
-"If you prefer to have all of the options listed in a single\n"
-"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
-"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
+"If you prefer to have all of the options listed in a single menu, rather\n"
+"than the default multimenu hierarchy, run the menuconfig with\n"
+"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
"\n"
"make MENUCONFIG_MODE=single_menu menuconfig\n"
"\n"
@@ -196,8 +199,6 @@ inputbox_instructions_string[] = N_(
setmod_text[] = N_(
"This feature depends on another which has been configured as a module.\n"
"As a result, this feature will be built as a module."),
-nohelp_text[] = N_(
- "There is no help available for this option.\n"),
load_config_text[] = N_(
"Enter the name of the configuration file you wish to load. "
"Accept the name shown to restore the configuration you "
@@ -208,18 +209,18 @@ load_config_help[] = N_(
"configurations available on a single machine.\n"
"\n"
"If you have saved a previous configuration in a file other than the\n"
- "default, entering the name of the file here will allow you\n"
- "to modify that configuration.\n"
+ "default one, entering its name here will allow you to modify that\n"
+ "configuration.\n"
"\n"
"If you are uncertain, then you have probably never used alternate\n"
- "configuration files. You should therefor leave this blank to abort.\n"),
+ "configuration files. You should therefore leave this blank to abort.\n"),
save_config_text[] = N_(
"Enter a filename to which this configuration should be saved "
"as an alternate. Leave blank to abort."),
save_config_help[] = N_(
"\n"
- "For various reasons, one may wish to keep different\n"
- "configurations available on a single machine.\n"
+ "For various reasons, one may wish to keep different configurations\n"
+ "available on a single machine.\n"
"\n"
"Entering a file name here will allow you to later retrieve, modify\n"
"and use the current configuration as an alternate to whatever\n"
@@ -229,7 +230,7 @@ save_config_help[] = N_(
"leave this blank.\n"),
search_help[] = N_(
"\n"
- "Search for " CFGSYM " symbols and display their relations.\n"
+ "Search for symbols and display their relations.\n"
"Regular expressions are allowed.\n"
"Example: search for \"^FOO\"\n"
"Result:\n"
@@ -246,7 +247,7 @@ search_help[] = N_(
"Selected by: BAR\n"
"-----------------------------------------------------------------\n"
"o The line 'Prompt:' shows the text used in the menu structure for\n"
- " this " CFGSYM " symbol\n"
+ " this symbol\n"
"o The 'Defined at' line tell at what file / line number the symbol\n"
" is defined\n"
"o The 'Depends on:' line tell what symbols needs to be defined for\n"
@@ -262,15 +263,16 @@ search_help[] = N_(
"Only relevant lines are shown.\n"
"\n\n"
"Search examples:\n"
- "Examples: USB => find all " CFGSYM " symbols containing USB\n"
- " ^USB => find all " CFGSYM " symbols starting with USB\n"
- " USB$ => find all " CFGSYM " symbols ending with USB\n"
+ "Examples: USB => find all symbols containing USB\n"
+ " ^USB => find all symbols starting with USB\n"
+ " USB$ => find all symbols ending with USB\n"
"\n");
static int indent;
static struct menu *current_menu;
static int child_count;
static int single_menu_mode;
+static int show_all_options;
static void conf(struct menu *menu);
static void conf_choice(struct menu *menu);
@@ -281,87 +283,14 @@ static void show_textbox(const char *title, const char *text, int r, int c);
static void show_helptext(const char *title, const char *text);
static void show_help(struct menu *menu);
-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");
- }
- }
-}
-
-static 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");
-}
-
-static struct gstr get_relations_str(struct symbol **sym_arr)
-{
- struct symbol *sym;
- struct gstr res = str_new();
- int i;
-
- for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
- get_symbol_str(&res, sym);
- if (!i)
- str_append(&res, _("No matches found.\n"));
- return res;
-}
-
static char filename[PATH_MAX+1];
static void set_config_filename(const char *config_filename)
{
static char menu_backtitle[PATH_MAX+128];
int size;
- size = sprintf(menu_backtitle, "%s v%s Configuration",
- getenv("PROJECT"), getenv("FULLVERSION"));
+ size = snprintf(menu_backtitle, sizeof(menu_backtitle),
+ "%s - %s", config_filename, rootmenu.prompt->text);
if (size >= sizeof(menu_backtitle))
menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
set_dialog_backtitle(menu_backtitle);
@@ -381,8 +310,8 @@ static void search_conf(void)
again:
dialog_clear();
dres = dialog_inputbox(_("Search Configuration Parameter"),
- _("Enter " CFGSYM " (sub)string to search for "
- "(with or without \"" CFGSYM "\")"),
+ _("Enter " CONFIG_ " (sub)string to search for "
+ "(with or without \"" CONFIG_ "\")"),
10, 75, "");
switch (dres) {
case 0:
@@ -394,10 +323,10 @@ again:
return;
}
- /* strip CFGSYM if necessary */
+ /* strip the prefix if necessary */
dialog_input = dialog_input_result;
- if (strncasecmp(dialog_input_result, CFGSYM, CFGSYMLEN) == 0)
- dialog_input += CFGSYMLEN;
+ if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
+ dialog_input += strlen(CONFIG_);
sym_arr = sym_re_search(dialog_input);
res = get_relations_str(sym_arr);
@@ -414,8 +343,16 @@ static void build_conf(struct menu *menu)
int type, tmp, doint = 2;
tristate val;
char ch;
-
- if (!menu_is_visible(menu))
+ bool visible;
+
+ /*
+ * note: menu_is_visible() has side effect that it will
+ * recalc the value of the symbol.
+ */
+ visible = menu_is_visible(menu);
+ if (show_all_options && !menu_has_prompt(menu))
+ return;
+ else if (!show_all_options && !visible)
return;
sym = menu->sym;
@@ -666,6 +603,9 @@ static void conf(struct menu *menu)
case 7:
search_conf();
break;
+ case 8:
+ show_all_options = !show_all_options;
+ break;
}
}
}
@@ -684,19 +624,10 @@ static void show_helptext(const char *title, const char *text)
static void show_help(struct menu *menu)
{
struct gstr help = str_new();
- struct symbol *sym = menu->sym;
-
- if (menu_has_help(menu))
- {
- if (sym->name) {
- str_printf(&help, CFGSYM "%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);
+
+ help.max_width = getmaxx(stdscr) - 10;
+ menu_get_ext_help(menu, &help);
+
show_helptext(_(menu_get_prompt(menu)), str_get(&help));
str_free(&help);
}
@@ -717,7 +648,12 @@ static void conf_choice(struct menu *menu)
for (child = menu->list; child; child = child->next) {
if (!menu_is_visible(child))
continue;
- item_make("%s", _(menu_get_prompt(child)));
+ if (child->sym)
+ item_make("%s", _(menu_get_prompt(child)));
+ else {
+ item_make("*** %s ***", _(menu_get_prompt(child)));
+ item_set_tag(':');
+ }
item_set_data(child);
if (child->sym == active)
item_set_selected(1);
@@ -733,6 +669,9 @@ static void conf_choice(struct menu *menu)
case 0:
if (selected) {
child = item_data();
+ if (!child->sym)
+ break;
+
sym_set_tristate_value(child->sym, yes);
}
return;
@@ -865,6 +804,8 @@ int main(int ac, char **av)
single_menu_mode = 1;
}
+ initscr();
+
getyx(stdscr, saved_y, saved_x);
if (init_dialog(NULL)) {
fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
@@ -891,15 +832,15 @@ int main(int ac, char **av)
case 0:
if (conf_write(filename)) {
fprintf(stderr, _("\n\n"
- "Error during writing of the configuration.\n"
+ "Error while writing of the configuration.\n"
"Your configuration changes were NOT saved."
"\n\n"));
return 1;
}
case -1:
printf(_("\n\n"
- "*** End of project configuration.\n"
- "*** Execute 'ptxdist go' to build the project or try 'ptxdist help'."
+ "*** End of the configuration.\n"
+ "*** Execute 'make' to start the build or try 'make help'."
"\n\n"));
break;
default: