1.1 --- a/kconfig/mconf.c Fri Oct 17 12:47:53 2008 +0000
1.2 +++ b/kconfig/mconf.c Sun May 08 14:14:40 2011 +0200
1.3 @@ -25,11 +25,9 @@
1.4 static const char mconf_readme[] = N_(
1.5 "Overview\n"
1.6 "--------\n"
1.7 -"Some kernel features may be built directly into the kernel.\n"
1.8 -"Some may be made into loadable runtime modules. Some features\n"
1.9 -"may be completely removed altogether. There are also certain\n"
1.10 -"kernel parameters which are not really features, but must be\n"
1.11 -"entered in as decimal or hexadecimal numbers or possibly text.\n"
1.12 +"This interface let you select features and parameters for the build.\n"
1.13 +"Features can either be built-in, modularized, or ignored. Parameters\n"
1.14 +"must be entered in as decimal or hexadecimal numbers or text.\n"
1.15 "\n"
1.16 "Menu items beginning with following braces represent features that\n"
1.17 " [ ] can be built in or removed\n"
1.18 @@ -67,13 +65,15 @@
1.19 " there is a delayed response which you may find annoying.\n"
1.20 "\n"
1.21 " Also, the <TAB> and cursor keys will cycle between <Select>,\n"
1.22 -" <Exit> and <Help>\n"
1.23 +" <Exit> and <Help>.\n"
1.24 "\n"
1.25 "o To get help with an item, use the cursor keys to highlight <Help>\n"
1.26 -" and Press <ENTER>.\n"
1.27 +" and press <ENTER>.\n"
1.28 "\n"
1.29 " Shortcut: Press <H> or <?>.\n"
1.30 "\n"
1.31 +"o To toggle the display of hidden options, press <Z>.\n"
1.32 +"\n"
1.33 "\n"
1.34 "Radiolists (Choice lists)\n"
1.35 "-----------\n"
1.36 @@ -115,7 +115,7 @@
1.37 "-----------------------------\n"
1.38 "Menuconfig supports the use of alternate configuration files for\n"
1.39 "those who, for various reasons, find it necessary to switch\n"
1.40 -"between different kernel configurations.\n"
1.41 +"between different configurations.\n"
1.42 "\n"
1.43 "At the end of the main menu you will find two options. One is\n"
1.44 "for saving the current configuration to a file of your choosing.\n"
1.45 @@ -148,9 +148,9 @@
1.46 "\n"
1.47 "Optional personality available\n"
1.48 "------------------------------\n"
1.49 -"If you prefer to have all of the kernel options listed in a single\n"
1.50 -"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
1.51 -"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
1.52 +"If you prefer to have all of the options listed in a single menu, rather\n"
1.53 +"than the default multimenu hierarchy, run the menuconfig with\n"
1.54 +"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
1.55 "\n"
1.56 "make MENUCONFIG_MODE=single_menu menuconfig\n"
1.57 "\n"
1.58 @@ -199,30 +199,28 @@
1.59 setmod_text[] = N_(
1.60 "This feature depends on another which has been configured as a module.\n"
1.61 "As a result, this feature will be built as a module."),
1.62 -nohelp_text[] = N_(
1.63 - "There is no help available for this kernel option.\n"),
1.64 load_config_text[] = N_(
1.65 "Enter the name of the configuration file you wish to load. "
1.66 "Accept the name shown to restore the configuration you "
1.67 "last retrieved. Leave blank to abort."),
1.68 load_config_help[] = N_(
1.69 "\n"
1.70 - "For various reasons, one may wish to keep several different kernel\n"
1.71 + "For various reasons, one may wish to keep several different\n"
1.72 "configurations available on a single machine.\n"
1.73 "\n"
1.74 "If you have saved a previous configuration in a file other than the\n"
1.75 - "kernel's default, entering the name of the file here will allow you\n"
1.76 - "to modify that configuration.\n"
1.77 + "default one, entering its name here will allow you to modify that\n"
1.78 + "configuration.\n"
1.79 "\n"
1.80 "If you are uncertain, then you have probably never used alternate\n"
1.81 - "configuration files. You should therefor leave this blank to abort.\n"),
1.82 + "configuration files. You should therefore leave this blank to abort.\n"),
1.83 save_config_text[] = N_(
1.84 "Enter a filename to which this configuration should be saved "
1.85 "as an alternate. Leave blank to abort."),
1.86 save_config_help[] = N_(
1.87 "\n"
1.88 - "For various reasons, one may wish to keep different kernel\n"
1.89 - "configurations available on a single machine.\n"
1.90 + "For various reasons, one may wish to keep different configurations\n"
1.91 + "available on a single machine.\n"
1.92 "\n"
1.93 "Entering a file name here will allow you to later retrieve, modify\n"
1.94 "and use the current configuration as an alternate to whatever\n"
1.95 @@ -232,7 +230,7 @@
1.96 "leave this blank.\n"),
1.97 search_help[] = N_(
1.98 "\n"
1.99 - "Search for CT_ symbols and display their relations.\n"
1.100 + "Search for symbols and display their relations.\n"
1.101 "Regular expressions are allowed.\n"
1.102 "Example: search for \"^FOO\"\n"
1.103 "Result:\n"
1.104 @@ -249,7 +247,7 @@
1.105 "Selected by: BAR\n"
1.106 "-----------------------------------------------------------------\n"
1.107 "o The line 'Prompt:' shows the text used in the menu structure for\n"
1.108 - " this CT_ symbol\n"
1.109 + " this symbol\n"
1.110 "o The 'Defined at' line tell at what file / line number the symbol\n"
1.111 " is defined\n"
1.112 "o The 'Depends on:' line tell what symbols needs to be defined for\n"
1.113 @@ -265,15 +263,16 @@
1.114 "Only relevant lines are shown.\n"
1.115 "\n\n"
1.116 "Search examples:\n"
1.117 - "Examples: USB => find all CT_ symbols containing USB\n"
1.118 - " ^USB => find all CT_ symbols starting with USB\n"
1.119 - " USB$ => find all CT_ symbols ending with USB\n"
1.120 + "Examples: USB => find all symbols containing USB\n"
1.121 + " ^USB => find all symbols starting with USB\n"
1.122 + " USB$ => find all symbols ending with USB\n"
1.123 "\n");
1.124
1.125 static int indent;
1.126 static struct menu *current_menu;
1.127 static int child_count;
1.128 static int single_menu_mode;
1.129 +static int show_all_options;
1.130
1.131 static void conf(struct menu *menu);
1.132 static void conf_choice(struct menu *menu);
1.133 @@ -284,91 +283,14 @@
1.134 static void show_helptext(const char *title, const char *text);
1.135 static void show_help(struct menu *menu);
1.136
1.137 -static void get_prompt_str(struct gstr *r, struct property *prop)
1.138 -{
1.139 - int i, j;
1.140 - struct menu *submenu[8], *menu;
1.141 -
1.142 - str_printf(r, _("Prompt: %s\n"), _(prop->text));
1.143 - str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
1.144 - prop->menu->lineno);
1.145 - if (!expr_is_yes(prop->visible.expr)) {
1.146 - str_append(r, _(" Depends on: "));
1.147 - expr_gstr_print(prop->visible.expr, r);
1.148 - str_append(r, "\n");
1.149 - }
1.150 - menu = prop->menu->parent;
1.151 - for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
1.152 - submenu[i++] = menu;
1.153 - if (i > 0) {
1.154 - str_printf(r, _(" Location:\n"));
1.155 - for (j = 4; --i >= 0; j += 2) {
1.156 - menu = submenu[i];
1.157 - str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
1.158 - if (menu->sym) {
1.159 - str_printf(r, " (%s [=%s])", menu->sym->name ?
1.160 - menu->sym->name : _("<choice>"),
1.161 - sym_get_string_value(menu->sym));
1.162 - }
1.163 - str_append(r, "\n");
1.164 - }
1.165 - }
1.166 -}
1.167 -
1.168 -static void get_symbol_str(struct gstr *r, struct symbol *sym)
1.169 -{
1.170 - bool hit;
1.171 - struct property *prop;
1.172 -
1.173 - if (sym && sym->name)
1.174 - str_printf(r, "Symbol: %s [=%s]\n", sym->name,
1.175 - sym_get_string_value(sym));
1.176 - for_all_prompts(sym, prop)
1.177 - get_prompt_str(r, prop);
1.178 - hit = false;
1.179 - for_all_properties(sym, prop, P_SELECT) {
1.180 - if (!hit) {
1.181 - str_append(r, " Selects: ");
1.182 - hit = true;
1.183 - } else
1.184 - str_printf(r, " && ");
1.185 - expr_gstr_print(prop->expr, r);
1.186 - }
1.187 - if (hit)
1.188 - str_append(r, "\n");
1.189 - if (sym->rev_dep.expr) {
1.190 - str_append(r, _(" Selected by: "));
1.191 - expr_gstr_print(sym->rev_dep.expr, r);
1.192 - str_append(r, "\n");
1.193 - }
1.194 - str_append(r, "\n\n");
1.195 -}
1.196 -
1.197 -static struct gstr get_relations_str(struct symbol **sym_arr)
1.198 -{
1.199 - struct symbol *sym;
1.200 - struct gstr res = str_new();
1.201 - int i;
1.202 -
1.203 - for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
1.204 - get_symbol_str(&res, sym);
1.205 - if (!i)
1.206 - str_append(&res, _("No matches found.\n"));
1.207 - return res;
1.208 -}
1.209 -
1.210 static char filename[PATH_MAX+1];
1.211 static void set_config_filename(const char *config_filename)
1.212 {
1.213 static char menu_backtitle[PATH_MAX+128];
1.214 int size;
1.215 - struct symbol *sym;
1.216
1.217 - sym = sym_lookup("PROJECTVERSION", 0);
1.218 - sym_calc_value(sym);
1.219 size = snprintf(menu_backtitle, sizeof(menu_backtitle),
1.220 - _(PACKAGE " v%s Configuration - %s"),
1.221 - sym_get_string_value(sym), config_filename);
1.222 + "%s - %s", config_filename, rootmenu.prompt->text);
1.223 if (size >= sizeof(menu_backtitle))
1.224 menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
1.225 set_dialog_backtitle(menu_backtitle);
1.226 @@ -388,8 +310,8 @@
1.227 again:
1.228 dialog_clear();
1.229 dres = dialog_inputbox(_("Search Configuration Parameter"),
1.230 - _("Enter CT_ (sub)string to search for "
1.231 - "(with or without \"CT\")"),
1.232 + _("Enter " CONFIG_ " (sub)string to search for "
1.233 + "(with or without \"" CONFIG_ "\")"),
1.234 10, 75, "");
1.235 switch (dres) {
1.236 case 0:
1.237 @@ -401,10 +323,10 @@
1.238 return;
1.239 }
1.240
1.241 - /* strip CT_ if necessary */
1.242 + /* strip the prefix if necessary */
1.243 dialog_input = dialog_input_result;
1.244 - if (strncasecmp(dialog_input_result, "CT_", 3) == 0)
1.245 - dialog_input += 7;
1.246 + if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
1.247 + dialog_input += strlen(CONFIG_);
1.248
1.249 sym_arr = sym_re_search(dialog_input);
1.250 res = get_relations_str(sym_arr);
1.251 @@ -421,8 +343,16 @@
1.252 int type, tmp, doint = 2;
1.253 tristate val;
1.254 char ch;
1.255 + bool visible;
1.256
1.257 - if (!menu_is_visible(menu))
1.258 + /*
1.259 + * note: menu_is_visible() has side effect that it will
1.260 + * recalc the value of the symbol.
1.261 + */
1.262 + visible = menu_is_visible(menu);
1.263 + if (show_all_options && !menu_has_prompt(menu))
1.264 + return;
1.265 + else if (!show_all_options && !visible)
1.266 return;
1.267
1.268 sym = menu->sym;
1.269 @@ -681,6 +611,9 @@
1.270 case 7:
1.271 search_conf();
1.272 break;
1.273 + case 8:
1.274 + show_all_options = !show_all_options;
1.275 + break;
1.276 }
1.277 }
1.278 }
1.279 @@ -699,19 +632,10 @@
1.280 static void show_help(struct menu *menu)
1.281 {
1.282 struct gstr help = str_new();
1.283 - struct symbol *sym = menu->sym;
1.284
1.285 - if (menu_has_help(menu))
1.286 - {
1.287 - if (sym->name) {
1.288 - str_printf(&help, "CT_%s:\n\n", sym->name);
1.289 - str_append(&help, _(menu_get_help(menu)));
1.290 - str_append(&help, "\n");
1.291 - }
1.292 - } else {
1.293 - str_append(&help, nohelp_text);
1.294 - }
1.295 - get_symbol_str(&help, sym);
1.296 + help.max_width = getmaxx(stdscr) - 10;
1.297 + menu_get_ext_help(menu, &help);
1.298 +
1.299 show_helptext(_(menu_get_prompt(menu)), str_get(&help));
1.300 str_free(&help);
1.301 }
1.302 @@ -732,7 +656,12 @@
1.303 for (child = menu->list; child; child = child->next) {
1.304 if (!menu_is_visible(child))
1.305 continue;
1.306 - item_make("%s", _(menu_get_prompt(child)));
1.307 + if (child->sym)
1.308 + item_make("%s", _(menu_get_prompt(child)));
1.309 + else {
1.310 + item_make("*** %s ***", _(menu_get_prompt(child)));
1.311 + item_set_tag(':');
1.312 + }
1.313 item_set_data(child);
1.314 if (child->sym == active)
1.315 item_set_selected(1);
1.316 @@ -748,6 +677,9 @@
1.317 case 0:
1.318 if (selected) {
1.319 child = item_data();
1.320 + if (!child->sym)
1.321 + break;
1.322 +
1.323 sym_set_tristate_value(child->sym, yes);
1.324 }
1.325 return;
1.326 @@ -880,6 +812,8 @@
1.327 single_menu_mode = 1;
1.328 }
1.329
1.330 + initscr();
1.331 +
1.332 getyx(stdscr, saved_y, saved_x);
1.333 if (init_dialog(NULL)) {
1.334 fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
1.335 @@ -894,7 +828,7 @@
1.336 if (conf_get_changed())
1.337 res = dialog_yesno(NULL,
1.338 _("Do you wish to save your "
1.339 - "new " PACKAGE " configuration?\n"
1.340 + "new configuration?\n"
1.341 "<ESC><ESC> to continue."),
1.342 6, 60);
1.343 else
1.344 @@ -906,15 +840,21 @@
1.345 case 0:
1.346 if (conf_write(filename)) {
1.347 fprintf(stderr, _("\n\n"
1.348 - "Error during writing of " PACKAGE " configuration.\n"
1.349 - "Your " PACKAGE " configuration changes were NOT saved."
1.350 + "Error while writing of the configuration.\n"
1.351 + "Your configuration changes were NOT saved."
1.352 "\n\n"));
1.353 return 1;
1.354 }
1.355 case -1:
1.356 + printf(_("\n\n"
1.357 + "*** End of the configuration.\n"
1.358 + "*** Execute 'make' to start the build or try 'make help'."
1.359 + "\n\n"));
1.360 break;
1.361 default:
1.362 - fprintf(stderr, _("Your configuration changes were NOT saved.\n"));
1.363 + fprintf(stderr, _("\n\n"
1.364 + "Your configuration changes were NOT saved."
1.365 + "\n\n"));
1.366 }
1.367
1.368 return 0;