aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/kconfig/Makefile87
-rw-r--r--scripts/kconfig/conf.c15
-rw-r--r--scripts/kconfig/confdata.c126
-rw-r--r--scripts/kconfig/expr.h2
-rw-r--r--scripts/kconfig/gconf.c20
-rw-r--r--scripts/kconfig/gconf.glade1
-rw-r--r--scripts/kconfig/kxgettext.c15
-rw-r--r--scripts/kconfig/lex.zconf.c_shipped7
-rw-r--r--scripts/kconfig/lkc.h8
-rw-r--r--scripts/kconfig/lkc_proto.h3
-rw-r--r--scripts/kconfig/lxdialog/check-lxdialog.sh2
-rw-r--r--scripts/kconfig/mconf.c64
-rw-r--r--scripts/kconfig/menu.c6
-rw-r--r--scripts/kconfig/nconf.c487
-rw-r--r--scripts/kconfig/nconf.gui.c22
-rw-r--r--scripts/kconfig/nconf.h3
-rw-r--r--scripts/kconfig/qconf.cc174
-rw-r--r--scripts/kconfig/qconf.h76
-rw-r--r--scripts/kconfig/symbol.c51
-rw-r--r--scripts/kconfig/util.c7
-rw-r--r--scripts/kconfig/zconf.l7
-rw-r--r--scripts/kconfig/zconf.tab.c_shipped547
-rw-r--r--scripts/kconfig/zconf.y18
23 files changed, 932 insertions, 816 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index de934def410f..368ae306aee4 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -8,7 +8,7 @@ PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-c
8ifdef KBUILD_KCONFIG 8ifdef KBUILD_KCONFIG
9Kconfig := $(KBUILD_KCONFIG) 9Kconfig := $(KBUILD_KCONFIG)
10else 10else
11Kconfig := arch/$(SRCARCH)/Kconfig 11Kconfig := Kconfig
12endif 12endif
13 13
14xconfig: $(obj)/qconf 14xconfig: $(obj)/qconf
@@ -145,11 +145,8 @@ check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh
145 145
146# Use recursively expanded variables so we do not call gcc unless 146# Use recursively expanded variables so we do not call gcc unless
147# we really need to do so. (Do not call gcc as part of make mrproper) 147# we really need to do so. (Do not call gcc as part of make mrproper)
148HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) 148HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \
149HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) 149 -DLOCALE
150
151HOST_EXTRACFLAGS += -DLOCALE
152
153 150
154# =========================================================================== 151# ===========================================================================
155# Shared Makefile for the various kconfig executables: 152# Shared Makefile for the various kconfig executables:
@@ -208,7 +205,7 @@ clean-files += config.pot linux.pot
208PHONY += $(obj)/dochecklxdialog 205PHONY += $(obj)/dochecklxdialog
209$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog 206$(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog
210$(obj)/dochecklxdialog: 207$(obj)/dochecklxdialog:
211 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES) 208 $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf)
212 209
213always := dochecklxdialog 210always := dochecklxdialog
214 211
@@ -226,6 +223,8 @@ HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl
226HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ 223HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \
227 -D LKC_DIRECT_LINK 224 -D LKC_DIRECT_LINK
228 225
226HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC))
227
229HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses 228HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses
230$(obj)/qconf.o: $(obj)/.tmp_qtcheck 229$(obj)/qconf.o: $(obj)/.tmp_qtcheck
231 230
@@ -236,40 +235,48 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile
236# QT needs some extra effort... 235# QT needs some extra effort...
237$(obj)/.tmp_qtcheck: 236$(obj)/.tmp_qtcheck:
238 @set -e; echo " CHECK qt"; dir=""; pkg=""; \ 237 @set -e; echo " CHECK qt"; dir=""; pkg=""; \
239 pkg-config --exists qt 2> /dev/null && pkg=qt; \ 238 if ! pkg-config --exists QtCore 2> /dev/null; then \
240 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ 239 echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \
241 if [ -n "$$pkg" ]; then \ 240 pkg-config --exists qt 2> /dev/null && pkg=qt; \
242 cflags="\$$(shell pkg-config $$pkg --cflags)"; \ 241 pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \
243 libs="\$$(shell pkg-config $$pkg --libs)"; \ 242 if [ -n "$$pkg" ]; then \
244 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ 243 cflags="\$$(shell pkg-config $$pkg --cflags)"; \
245 dir="$$(pkg-config $$pkg --variable=prefix)"; \ 244 libs="\$$(shell pkg-config $$pkg --libs)"; \
245 moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \
246 dir="$$(pkg-config $$pkg --variable=prefix)"; \
247 else \
248 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \
249 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \
250 done; \
251 if [ -z "$$dir" ]; then \
252 echo "*"; \
253 echo "* Unable to find any QT installation. Please make sure that"; \
254 echo "* the QT4 or QT3 development package is correctly installed and"; \
255 echo "* either qmake can be found or install pkg-config or set"; \
256 echo "* the QTDIR environment variable to the correct location."; \
257 echo "*"; \
258 false; \
259 fi; \
260 libpath=$$dir/lib; lib=qt; osdir=""; \
261 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
262 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
263 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
264 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
265 cflags="-I$$dir/include"; \
266 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
267 moc="$$dir/bin/moc"; \
268 fi; \
269 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
270 echo "*"; \
271 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
272 echo "*"; \
273 moc="/usr/bin/moc"; \
274 fi; \
246 else \ 275 else \
247 for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ 276 cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \
248 if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ 277 libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \
249 done; \ 278 binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \
250 if [ -z "$$dir" ]; then \ 279 moc="$$binpath/bin/moc"; \
251 echo "*"; \
252 echo "* Unable to find the QT3 installation. Please make sure that"; \
253 echo "* the QT3 development package is correctly installed and"; \
254 echo "* either install pkg-config or set the QTDIR environment"; \
255 echo "* variable to the correct location."; \
256 echo "*"; \
257 false; \
258 fi; \
259 libpath=$$dir/lib; lib=qt; osdir=""; \
260 $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \
261 osdir=x$$($(HOSTCXX) -print-multi-os-directory); \
262 test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \
263 test -f $$libpath/libqt-mt.so && lib=qt-mt; \
264 cflags="-I$$dir/include"; \
265 libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \
266 moc="$$dir/bin/moc"; \
267 fi; \
268 if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \
269 echo "*"; \
270 echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \
271 echo "*"; \
272 moc="/usr/bin/moc"; \
273 fi; \ 280 fi; \
274 echo "KC_QT_CFLAGS=$$cflags" > $@; \ 281 echo "KC_QT_CFLAGS=$$cflags" > $@; \
275 echo "KC_QT_LIBS=$$libs" >> $@; \ 282 echo "KC_QT_LIBS=$$libs" >> $@; \
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 7ef429cd5cb3..5459a38be866 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -425,7 +425,7 @@ static void check_conf(struct menu *menu)
425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { 425 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
426 if (input_mode == listnewconfig) { 426 if (input_mode == listnewconfig) {
427 if (sym->name && !sym_is_choice_value(sym)) { 427 if (sym->name && !sym_is_choice_value(sym)) {
428 printf("CONFIG_%s\n", sym->name); 428 printf("%s%s\n", CONFIG_, sym->name);
429 } 429 }
430 } else if (input_mode != oldnoconfig) { 430 } else if (input_mode != oldnoconfig) {
431 if (!conf_cnt++) 431 if (!conf_cnt++)
@@ -466,7 +466,7 @@ int main(int ac, char **av)
466 bindtextdomain(PACKAGE, LOCALEDIR); 466 bindtextdomain(PACKAGE, LOCALEDIR);
467 textdomain(PACKAGE); 467 textdomain(PACKAGE);
468 468
469 while ((opt = getopt_long_only(ac, av, "", long_opts, NULL)) != -1) { 469 while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
470 input_mode = (enum input_mode)opt; 470 input_mode = (enum input_mode)opt;
471 switch (opt) { 471 switch (opt) {
472 case silentoldconfig: 472 case silentoldconfig:
@@ -508,8 +508,7 @@ int main(int ac, char **av)
508 name = conf_get_configname(); 508 name = conf_get_configname();
509 if (stat(name, &tmpstat)) { 509 if (stat(name, &tmpstat)) {
510 fprintf(stderr, _("***\n" 510 fprintf(stderr, _("***\n"
511 "*** You have not yet configured your kernel!\n" 511 "*** Configuration file \"%s\" not found!\n"
512 "*** (missing kernel config file \"%s\")\n"
513 "***\n" 512 "***\n"
514 "*** Please run some configurator (e.g. \"make oldconfig\" or\n" 513 "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
515 "*** \"make menuconfig\" or \"make xconfig\").\n" 514 "*** \"make menuconfig\" or \"make xconfig\").\n"
@@ -571,7 +570,7 @@ int main(int ac, char **av)
571 name = getenv("KCONFIG_NOSILENTUPDATE"); 570 name = getenv("KCONFIG_NOSILENTUPDATE");
572 if (name && *name) { 571 if (name && *name) {
573 fprintf(stderr, 572 fprintf(stderr,
574 _("\n*** Kernel configuration requires explicit update.\n\n")); 573 _("\n*** The configuration requires explicit update.\n\n"));
575 return 1; 574 return 1;
576 } 575 }
577 } 576 }
@@ -623,11 +622,11 @@ int main(int ac, char **av)
623 * All other commands are only used to generate a config. 622 * All other commands are only used to generate a config.
624 */ 623 */
625 if (conf_get_changed() && conf_write(NULL)) { 624 if (conf_get_changed() && conf_write(NULL)) {
626 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 625 fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
627 exit(1); 626 exit(1);
628 } 627 }
629 if (conf_write_autoconf()) { 628 if (conf_write_autoconf()) {
630 fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); 629 fprintf(stderr, _("\n*** Error during update of the configuration.\n\n"));
631 return 1; 630 return 1;
632 } 631 }
633 } else if (input_mode == savedefconfig) { 632 } else if (input_mode == savedefconfig) {
@@ -638,7 +637,7 @@ int main(int ac, char **av)
638 } 637 }
639 } else if (input_mode != listnewconfig) { 638 } else if (input_mode != listnewconfig) {
640 if (conf_write(NULL)) { 639 if (conf_write(NULL)) {
641 fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); 640 fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
642 exit(1); 641 exit(1);
643 } 642 }
644 } 643 }
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 515253fe46cf..9df80114b47b 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -5,6 +5,7 @@
5 5
6#include <sys/stat.h> 6#include <sys/stat.h>
7#include <ctype.h> 7#include <ctype.h>
8#include <errno.h>
8#include <fcntl.h> 9#include <fcntl.h>
9#include <stdio.h> 10#include <stdio.h>
10#include <stdlib.h> 11#include <stdlib.h>
@@ -18,6 +19,9 @@
18static void conf_warning(const char *fmt, ...) 19static void conf_warning(const char *fmt, ...)
19 __attribute__ ((format (printf, 1, 2))); 20 __attribute__ ((format (printf, 1, 2)));
20 21
22static void conf_message(const char *fmt, ...)
23 __attribute__ ((format (printf, 1, 2)));
24
21static const char *conf_filename; 25static const char *conf_filename;
22static int conf_lineno, conf_warnings, conf_unsaved; 26static int conf_lineno, conf_warnings, conf_unsaved;
23 27
@@ -34,6 +38,29 @@ static void conf_warning(const char *fmt, ...)
34 conf_warnings++; 38 conf_warnings++;
35} 39}
36 40
41static void conf_default_message_callback(const char *fmt, va_list ap)
42{
43 printf("#\n# ");
44 vprintf(fmt, ap);
45 printf("\n#\n");
46}
47
48static void (*conf_message_callback) (const char *fmt, va_list ap) =
49 conf_default_message_callback;
50void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))
51{
52 conf_message_callback = fn;
53}
54
55static void conf_message(const char *fmt, ...)
56{
57 va_list ap;
58
59 va_start(ap, fmt);
60 if (conf_message_callback)
61 conf_message_callback(fmt, ap);
62}
63
37const char *conf_get_configname(void) 64const char *conf_get_configname(void)
38{ 65{
39 char *name = getenv("KCONFIG_CONFIG"); 66 char *name = getenv("KCONFIG_CONFIG");
@@ -183,9 +210,8 @@ int conf_read_simple(const char *name, int def)
183 name = conf_expand_value(prop->expr->left.sym->name); 210 name = conf_expand_value(prop->expr->left.sym->name);
184 in = zconf_fopen(name); 211 in = zconf_fopen(name);
185 if (in) { 212 if (in) {
186 printf(_("#\n" 213 conf_message(_("using defaults found in %s"),
187 "# using defaults found in %s\n" 214 name);
188 "#\n"), name);
189 goto load; 215 goto load;
190 } 216 }
191 } 217 }
@@ -220,24 +246,23 @@ load:
220 while (fgets(line, sizeof(line), in)) { 246 while (fgets(line, sizeof(line), in)) {
221 conf_lineno++; 247 conf_lineno++;
222 sym = NULL; 248 sym = NULL;
223 switch (line[0]) { 249 if (line[0] == '#') {
224 case '#': 250 if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
225 if (memcmp(line + 2, "CONFIG_", 7))
226 continue; 251 continue;
227 p = strchr(line + 9, ' '); 252 p = strchr(line + 2 + strlen(CONFIG_), ' ');
228 if (!p) 253 if (!p)
229 continue; 254 continue;
230 *p++ = 0; 255 *p++ = 0;
231 if (strncmp(p, "is not set", 10)) 256 if (strncmp(p, "is not set", 10))
232 continue; 257 continue;
233 if (def == S_DEF_USER) { 258 if (def == S_DEF_USER) {
234 sym = sym_find(line + 9); 259 sym = sym_find(line + 2 + strlen(CONFIG_));
235 if (!sym) { 260 if (!sym) {
236 sym_add_change_count(1); 261 sym_add_change_count(1);
237 break; 262 goto setsym;
238 } 263 }
239 } else { 264 } else {
240 sym = sym_lookup(line + 9, 0); 265 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
241 if (sym->type == S_UNKNOWN) 266 if (sym->type == S_UNKNOWN)
242 sym->type = S_BOOLEAN; 267 sym->type = S_BOOLEAN;
243 } 268 }
@@ -253,13 +278,8 @@ load:
253 default: 278 default:
254 ; 279 ;
255 } 280 }
256 break; 281 } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
257 case 'C': 282 p = strchr(line + strlen(CONFIG_), '=');
258 if (memcmp(line, "CONFIG_", 7)) {
259 conf_warning("unexpected data");
260 continue;
261 }
262 p = strchr(line + 7, '=');
263 if (!p) 283 if (!p)
264 continue; 284 continue;
265 *p++ = 0; 285 *p++ = 0;
@@ -270,13 +290,13 @@ load:
270 *p2 = 0; 290 *p2 = 0;
271 } 291 }
272 if (def == S_DEF_USER) { 292 if (def == S_DEF_USER) {
273 sym = sym_find(line + 7); 293 sym = sym_find(line + strlen(CONFIG_));
274 if (!sym) { 294 if (!sym) {
275 sym_add_change_count(1); 295 sym_add_change_count(1);
276 break; 296 goto setsym;
277 } 297 }
278 } else { 298 } else {
279 sym = sym_lookup(line + 7, 0); 299 sym = sym_lookup(line + strlen(CONFIG_), 0);
280 if (sym->type == S_UNKNOWN) 300 if (sym->type == S_UNKNOWN)
281 sym->type = S_OTHER; 301 sym->type = S_OTHER;
282 } 302 }
@@ -285,14 +305,12 @@ load:
285 } 305 }
286 if (conf_set_sym_val(sym, def, def_flags, p)) 306 if (conf_set_sym_val(sym, def, def_flags, p))
287 continue; 307 continue;
288 break; 308 } else {
289 case '\r': 309 if (line[0] != '\r' && line[0] != '\n')
290 case '\n': 310 conf_warning("unexpected data");
291 break;
292 default:
293 conf_warning("unexpected data");
294 continue; 311 continue;
295 } 312 }
313setsym:
296 if (sym && sym_is_choice_value(sym)) { 314 if (sym && sym_is_choice_value(sym)) {
297 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); 315 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
298 switch (sym->def[def].tri) { 316 switch (sym->def[def].tri) {
@@ -405,9 +423,9 @@ static void conf_write_string(bool headerfile, const char *name,
405{ 423{
406 int l; 424 int l;
407 if (headerfile) 425 if (headerfile)
408 fprintf(out, "#define CONFIG_%s \"", name); 426 fprintf(out, "#define %s%s \"", CONFIG_, name);
409 else 427 else
410 fprintf(out, "CONFIG_%s=\"", name); 428 fprintf(out, "%s%s=\"", CONFIG_, name);
411 429
412 while (1) { 430 while (1) {
413 l = strcspn(str, "\"\\"); 431 l = strcspn(str, "\"\\");
@@ -433,13 +451,14 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
433 switch (sym_get_tristate_value(sym)) { 451 switch (sym_get_tristate_value(sym)) {
434 case no: 452 case no:
435 if (write_no) 453 if (write_no)
436 fprintf(out, "# CONFIG_%s is not set\n", sym->name); 454 fprintf(out, "# %s%s is not set\n",
455 CONFIG_, sym->name);
437 break; 456 break;
438 case mod: 457 case mod:
439 fprintf(out, "CONFIG_%s=m\n", sym->name); 458 fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
440 break; 459 break;
441 case yes: 460 case yes:
442 fprintf(out, "CONFIG_%s=y\n", sym->name); 461 fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
443 break; 462 break;
444 } 463 }
445 break; 464 break;
@@ -449,7 +468,7 @@ static void conf_write_symbol(struct symbol *sym, enum symbol_type type,
449 case S_HEX: 468 case S_HEX:
450 case S_INT: 469 case S_INT:
451 str = sym_get_string_value(sym); 470 str = sym_get_string_value(sym);
452 fprintf(out, "CONFIG_%s=%s\n", sym->name, str); 471 fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
453 break; 472 break;
454 case S_OTHER: 473 case S_OTHER:
455 case S_UNKNOWN: 474 case S_UNKNOWN:
@@ -541,7 +560,7 @@ int conf_write(const char *name)
541 struct menu *menu; 560 struct menu *menu;
542 const char *basename; 561 const char *basename;
543 const char *str; 562 const char *str;
544 char dirname[128], tmpname[128], newname[128]; 563 char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
545 enum symbol_type type; 564 enum symbol_type type;
546 time_t now; 565 time_t now;
547 int use_timestamp = 1; 566 int use_timestamp = 1;
@@ -581,8 +600,6 @@ int conf_write(const char *name)
581 if (!out) 600 if (!out)
582 return 1; 601 return 1;
583 602
584 sym = sym_lookup("KERNELVERSION", 0);
585 sym_calc_value(sym);
586 time(&now); 603 time(&now);
587 env = getenv("KCONFIG_NOTIMESTAMP"); 604 env = getenv("KCONFIG_NOTIMESTAMP");
588 if (env && *env) 605 if (env && *env)
@@ -590,10 +607,10 @@ int conf_write(const char *name)
590 607
591 fprintf(out, _("#\n" 608 fprintf(out, _("#\n"
592 "# Automatically generated make config: don't edit\n" 609 "# Automatically generated make config: don't edit\n"
593 "# Linux kernel version: %s\n" 610 "# %s\n"
594 "%s%s" 611 "%s%s"
595 "#\n"), 612 "#\n"),
596 sym_get_string_value(sym), 613 rootmenu.prompt->text,
597 use_timestamp ? "# " : "", 614 use_timestamp ? "# " : "",
598 use_timestamp ? ctime(&now) : ""); 615 use_timestamp ? ctime(&now) : "");
599 616
@@ -650,9 +667,7 @@ next:
650 return 1; 667 return 1;
651 } 668 }
652 669
653 printf(_("#\n" 670 conf_message(_("configuration written to %s"), newname);
654 "# configuration written to %s\n"
655 "#\n"), newname);
656 671
657 sym_set_change_count(0); 672 sym_set_change_count(0);
658 673
@@ -662,7 +677,7 @@ next:
662static int conf_split_config(void) 677static int conf_split_config(void)
663{ 678{
664 const char *name; 679 const char *name;
665 char path[128]; 680 char path[PATH_MAX+1];
666 char *s, *d, c; 681 char *s, *d, c;
667 struct symbol *sym; 682 struct symbol *sym;
668 struct stat sb; 683 struct stat sb;
@@ -804,25 +819,23 @@ int conf_write_autoconf(void)
804 return 1; 819 return 1;
805 } 820 }
806 821
807 sym = sym_lookup("KERNELVERSION", 0);
808 sym_calc_value(sym);
809 time(&now); 822 time(&now);
810 fprintf(out, "#\n" 823 fprintf(out, "#\n"
811 "# Automatically generated make config: don't edit\n" 824 "# Automatically generated make config: don't edit\n"
812 "# Linux kernel version: %s\n" 825 "# %s\n"
813 "# %s" 826 "# %s"
814 "#\n", 827 "#\n",
815 sym_get_string_value(sym), ctime(&now)); 828 rootmenu.prompt->text, ctime(&now));
816 fprintf(tristate, "#\n" 829 fprintf(tristate, "#\n"
817 "# Automatically generated - do not edit\n" 830 "# Automatically generated - do not edit\n"
818 "\n"); 831 "\n");
819 fprintf(out_h, "/*\n" 832 fprintf(out_h, "/*\n"
820 " * Automatically generated C config: don't edit\n" 833 " * Automatically generated C config: don't edit\n"
821 " * Linux kernel version: %s\n" 834 " * %s\n"
822 " * %s" 835 " * %s"
823 " */\n" 836 " */\n"
824 "#define AUTOCONF_INCLUDED\n", 837 "#define AUTOCONF_INCLUDED\n",
825 sym_get_string_value(sym), ctime(&now)); 838 rootmenu.prompt->text, ctime(&now));
826 839
827 for_all_symbols(i, sym) { 840 for_all_symbols(i, sym) {
828 sym_calc_value(sym); 841 sym_calc_value(sym);
@@ -840,14 +853,17 @@ int conf_write_autoconf(void)
840 case no: 853 case no:
841 break; 854 break;
842 case mod: 855 case mod:
843 fprintf(tristate, "CONFIG_%s=M\n", sym->name); 856 fprintf(tristate, "%s%s=M\n",
844 fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); 857 CONFIG_, sym->name);
858 fprintf(out_h, "#define %s%s_MODULE 1\n",
859 CONFIG_, sym->name);
845 break; 860 break;
846 case yes: 861 case yes:
847 if (sym->type == S_TRISTATE) 862 if (sym->type == S_TRISTATE)
848 fprintf(tristate, "CONFIG_%s=Y\n", 863 fprintf(tristate,"%s%s=Y\n",
849 sym->name); 864 CONFIG_, sym->name);
850 fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); 865 fprintf(out_h, "#define %s%s 1\n",
866 CONFIG_, sym->name);
851 break; 867 break;
852 } 868 }
853 break; 869 break;
@@ -857,12 +873,14 @@ int conf_write_autoconf(void)
857 case S_HEX: 873 case S_HEX:
858 str = sym_get_string_value(sym); 874 str = sym_get_string_value(sym);
859 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { 875 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
860 fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); 876 fprintf(out_h, "#define %s%s 0x%s\n",
877 CONFIG_, sym->name, str);
861 break; 878 break;
862 } 879 }
863 case S_INT: 880 case S_INT:
864 str = sym_get_string_value(sym); 881 str = sym_get_string_value(sym);
865 fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); 882 fprintf(out_h, "#define %s%s %s\n",
883 CONFIG_, sym->name, str);
866 break; 884 break;
867 default: 885 default:
868 break; 886 break;
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 170459c224a1..184eb6a0b505 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -18,7 +18,7 @@ extern "C" {
18struct file { 18struct file {
19 struct file *next; 19 struct file *next;
20 struct file *parent; 20 struct file *parent;
21 char *name; 21 const char *name;
22 int lineno; 22 int lineno;
23 int flags; 23 int flags;
24}; 24};
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index d66988265f89..455896164d72 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -133,7 +133,6 @@ void init_main_window(const gchar * glade_file)
133 GladeXML *xml; 133 GladeXML *xml;
134 GtkWidget *widget; 134 GtkWidget *widget;
135 GtkTextBuffer *txtbuf; 135 GtkTextBuffer *txtbuf;
136 char title[256];
137 GtkStyle *style; 136 GtkStyle *style;
138 137
139 xml = glade_xml_new(glade_file, "window1", NULL); 138 xml = glade_xml_new(glade_file, "window1", NULL);
@@ -210,9 +209,7 @@ void init_main_window(const gchar * glade_file)
210 /*"style", PANGO_STYLE_OBLIQUE, */ 209 /*"style", PANGO_STYLE_OBLIQUE, */
211 NULL); 210 NULL);
212 211
213 sprintf(title, _("Linux Kernel v%s Configuration"), 212 gtk_window_set_title(GTK_WINDOW(main_wnd), rootmenu.prompt->text);
214 getenv("KERNELVERSION"));
215 gtk_window_set_title(GTK_WINDOW(main_wnd), title);
216 213
217 gtk_widget_show(main_wnd); 214 gtk_widget_show(main_wnd);
218} 215}
@@ -671,8 +668,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data)
671{ 668{
672 GtkWidget *dialog; 669 GtkWidget *dialog;
673 const gchar *intro_text = _( 670 const gchar *intro_text = _(
674 "Welcome to gkc, the GTK+ graphical kernel configuration tool\n" 671 "Welcome to gkc, the GTK+ graphical configuration tool\n"
675 "for Linux.\n"
676 "For each option, a blank box indicates the feature is disabled, a\n" 672 "For each option, a blank box indicates the feature is disabled, a\n"
677 "check indicates it is enabled, and a dot indicates that it is to\n" 673 "check indicates it is enabled, and a dot indicates that it is to\n"
678 "be compiled as a module. Clicking on the box will cycle through the three states.\n" 674 "be compiled as a module. Clicking on the box will cycle through the three states.\n"
@@ -1531,12 +1527,6 @@ int main(int ac, char *av[])
1531 else 1527 else
1532 glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL); 1528 glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL);
1533 1529
1534 /* Load the interface and connect signals */
1535 init_main_window(glade_file);
1536 init_tree_model();
1537 init_left_tree();
1538 init_right_tree();
1539
1540 /* Conf stuffs */ 1530 /* Conf stuffs */
1541 if (ac > 1 && av[1][0] == '-') { 1531 if (ac > 1 && av[1][0] == '-') {
1542 switch (av[1][1]) { 1532 switch (av[1][1]) {
@@ -1556,6 +1546,12 @@ int main(int ac, char *av[])
1556 fixup_rootmenu(&rootmenu); 1546 fixup_rootmenu(&rootmenu);
1557 conf_read(NULL); 1547 conf_read(NULL);
1558 1548
1549 /* Load the interface and connect signals */
1550 init_main_window(glade_file);
1551 init_tree_model();
1552 init_left_tree();
1553 init_right_tree();
1554
1559 switch (view_mode) { 1555 switch (view_mode) {
1560 case SINGLE_VIEW: 1556 case SINGLE_VIEW:
1561 display_tree_part(); 1557 display_tree_part();
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade
index d52b0a75d824..aa483cb32755 100644
--- a/scripts/kconfig/gconf.glade
+++ b/scripts/kconfig/gconf.glade
@@ -1,5 +1,4 @@
1<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> 1<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
2<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
3 2
4<glade-interface> 3<glade-interface>
5 4
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c
index dcc3fcc0cc9a..e9d8e791bf0d 100644
--- a/scripts/kconfig/kxgettext.c
+++ b/scripts/kconfig/kxgettext.c
@@ -63,11 +63,11 @@ next:
63 63
64struct file_line { 64struct file_line {
65 struct file_line *next; 65 struct file_line *next;
66 char* file; 66 const char *file;
67 int lineno; 67 int lineno;
68}; 68};
69 69
70static struct file_line *file_line__new(char *file, int lineno) 70static struct file_line *file_line__new(const char *file, int lineno)
71{ 71{
72 struct file_line *self = malloc(sizeof(*self)); 72 struct file_line *self = malloc(sizeof(*self));
73 73
@@ -90,7 +90,8 @@ struct message {
90 90
91static struct message *message__list; 91static struct message *message__list;
92 92
93static struct message *message__new(const char *msg, char *option, char *file, int lineno) 93static struct message *message__new(const char *msg, char *option,
94 const char *file, int lineno)
94{ 95{
95 struct message *self = malloc(sizeof(*self)); 96 struct message *self = malloc(sizeof(*self));
96 97
@@ -130,7 +131,8 @@ static struct message *mesage__find(const char *msg)
130 return m; 131 return m;
131} 132}
132 133
133static int message__add_file_line(struct message *self, char *file, int lineno) 134static int message__add_file_line(struct message *self, const char *file,
135 int lineno)
134{ 136{
135 int rc = -1; 137 int rc = -1;
136 struct file_line *fl = file_line__new(file, lineno); 138 struct file_line *fl = file_line__new(file, lineno);
@@ -145,7 +147,8 @@ out:
145 return rc; 147 return rc;
146} 148}
147 149
148static int message__add(const char *msg, char *option, char *file, int lineno) 150static int message__add(const char *msg, char *option, const char *file,
151 int lineno)
149{ 152{
150 int rc = 0; 153 int rc = 0;
151 char bf[16384]; 154 char bf[16384];
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped
index fdc7113b08d1..6eb039718259 100644
--- a/scripts/kconfig/lex.zconf.c_shipped
+++ b/scripts/kconfig/lex.zconf.c_shipped
@@ -2373,9 +2373,10 @@ void zconf_nextfile(const char *name)
2373 memset(buf, 0, sizeof(*buf)); 2373 memset(buf, 0, sizeof(*buf));
2374 2374
2375 current_buf->state = YY_CURRENT_BUFFER; 2375 current_buf->state = YY_CURRENT_BUFFER;
2376 zconfin = zconf_fopen(name); 2376 zconfin = zconf_fopen(file->name);
2377 if (!zconfin) { 2377 if (!zconfin) {
2378 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); 2378 printf("%s:%d: can't open file \"%s\"\n",
2379 zconf_curname(), zconf_lineno(), file->name);
2379 exit(1); 2380 exit(1);
2380 } 2381 }
2381 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE)); 2382 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
@@ -2422,7 +2423,7 @@ int zconf_lineno(void)
2422 return current_pos.lineno; 2423 return current_pos.lineno;
2423} 2424}
2424 2425
2425char *zconf_curname(void) 2426const char *zconf_curname(void)
2426{ 2427{
2427 return current_pos.file ? current_pos.file->name : "<none>"; 2428 return current_pos.file ? current_pos.file->name : "<none>";
2428} 2429}
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index bdf71bd31412..753cdbd7b805 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -31,12 +31,18 @@ extern "C" {
31 31
32#define SRCTREE "srctree" 32#define SRCTREE "srctree"
33 33
34#ifndef PACKAGE
34#define PACKAGE "linux" 35#define PACKAGE "linux"
36#endif
37
35#define LOCALEDIR "/usr/share/locale" 38#define LOCALEDIR "/usr/share/locale"
36 39
37#define _(text) gettext(text) 40#define _(text) gettext(text)
38#define N_(text) (text) 41#define N_(text) (text)
39 42
43#ifndef CONFIG_
44#define CONFIG_ "CONFIG_"
45#endif
40 46
41#define TF_COMMAND 0x0001 47#define TF_COMMAND 0x0001
42#define TF_PARAM 0x0002 48#define TF_PARAM 0x0002
@@ -70,7 +76,7 @@ FILE *zconf_fopen(const char *name);
70void zconf_initscan(const char *name); 76void zconf_initscan(const char *name);
71void zconf_nextfile(const char *name); 77void zconf_nextfile(const char *name);
72int zconf_lineno(void); 78int zconf_lineno(void);
73char *zconf_curname(void); 79const char *zconf_curname(void);
74 80
75/* conf.c */ 81/* conf.c */
76void xfgets(char *str, int size, FILE *in); 82void xfgets(char *str, int size, FILE *in);
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index 9a948c9ce44e..17342fef38b9 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -1,3 +1,4 @@
1#include <stdarg.h>
1 2
2/* confdata.c */ 3/* confdata.c */
3P(conf_parse,void,(const char *name)); 4P(conf_parse,void,(const char *name));
@@ -8,6 +9,7 @@ P(conf_write,int,(const char *name));
8P(conf_write_autoconf,int,(void)); 9P(conf_write_autoconf,int,(void));
9P(conf_get_changed,bool,(void)); 10P(conf_get_changed,bool,(void));
10P(conf_set_changed_callback, void,(void (*fn)(void))); 11P(conf_set_changed_callback, void,(void (*fn)(void)));
12P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
11 13
12/* menu.c */ 14/* menu.c */
13P(rootmenu,struct menu,); 15P(rootmenu,struct menu,);
@@ -28,6 +30,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
28 30
29P(sym_lookup,struct symbol *,(const char *name, int flags)); 31P(sym_lookup,struct symbol *,(const char *name, int flags));
30P(sym_find,struct symbol *,(const char *name)); 32P(sym_find,struct symbol *,(const char *name));
33P(sym_expand_string_value,const char *,(const char *in));
31P(sym_re_search,struct symbol **,(const char *pattern)); 34P(sym_re_search,struct symbol **,(const char *pattern));
32P(sym_type_name,const char *,(enum symbol_type type)); 35P(sym_type_name,const char *,(enum symbol_type type));
33P(sym_calc_value,void,(struct symbol *sym)); 36P(sym_calc_value,void,(struct symbol *sym));
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh
index fcef0f59d553..82cc3a85e7f8 100644
--- a/scripts/kconfig/lxdialog/check-lxdialog.sh
+++ b/scripts/kconfig/lxdialog/check-lxdialog.sh
@@ -23,6 +23,8 @@ ccflags()
23 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' 23 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
24 elif [ -f /usr/include/ncurses/curses.h ]; then 24 elif [ -f /usr/include/ncurses/curses.h ]; then
25 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' 25 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
26 elif [ -f /usr/include/ncursesw/curses.h ]; then
27 echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
26 elif [ -f /usr/include/ncurses.h ]; then 28 elif [ -f /usr/include/ncurses.h ]; then
27 echo '-DCURSES_LOC="<ncurses.h>"' 29 echo '-DCURSES_LOC="<ncurses.h>"'
28 else 30 else
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index d2f6e056c058..d433c7a24745 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -25,11 +25,9 @@
25static const char mconf_readme[] = N_( 25static const char mconf_readme[] = N_(
26"Overview\n" 26"Overview\n"
27"--------\n" 27"--------\n"
28"Some kernel features may be built directly into the kernel.\n" 28"This interface let you select features and parameters for the build.\n"
29"Some may be made into loadable runtime modules. Some features\n" 29"Features can either be built-in, modularized, or ignored. Parameters\n"
30"may be completely removed altogether. There are also certain\n" 30"must be entered in as decimal or hexadecimal numbers or text.\n"
31"kernel parameters which are not really features, but must be\n"
32"entered in as decimal or hexadecimal numbers or possibly text.\n"
33"\n" 31"\n"
34"Menu items beginning with following braces represent features that\n" 32"Menu items beginning with following braces represent features that\n"
35" [ ] can be built in or removed\n" 33" [ ] can be built in or removed\n"
@@ -117,7 +115,7 @@ static const char mconf_readme[] = N_(
117"-----------------------------\n" 115"-----------------------------\n"
118"Menuconfig supports the use of alternate configuration files for\n" 116"Menuconfig supports the use of alternate configuration files for\n"
119"those who, for various reasons, find it necessary to switch\n" 117"those who, for various reasons, find it necessary to switch\n"
120"between different kernel configurations.\n" 118"between different configurations.\n"
121"\n" 119"\n"
122"At the end of the main menu you will find two options. One is\n" 120"At the end of the main menu you will find two options. One is\n"
123"for saving the current configuration to a file of your choosing.\n" 121"for saving the current configuration to a file of your choosing.\n"
@@ -150,9 +148,9 @@ static const char mconf_readme[] = N_(
150"\n" 148"\n"
151"Optional personality available\n" 149"Optional personality available\n"
152"------------------------------\n" 150"------------------------------\n"
153"If you prefer to have all of the kernel options listed in a single\n" 151"If you prefer to have all of the options listed in a single menu, rather\n"
154"menu, rather than the default multimenu hierarchy, run the menuconfig\n" 152"than the default multimenu hierarchy, run the menuconfig with\n"
155"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n" 153"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
156"\n" 154"\n"
157"make MENUCONFIG_MODE=single_menu menuconfig\n" 155"make MENUCONFIG_MODE=single_menu menuconfig\n"
158"\n" 156"\n"
@@ -207,12 +205,12 @@ load_config_text[] = N_(
207 "last retrieved. Leave blank to abort."), 205 "last retrieved. Leave blank to abort."),
208load_config_help[] = N_( 206load_config_help[] = N_(
209 "\n" 207 "\n"
210 "For various reasons, one may wish to keep several different kernel\n" 208 "For various reasons, one may wish to keep several different\n"
211 "configurations available on a single machine.\n" 209 "configurations available on a single machine.\n"
212 "\n" 210 "\n"
213 "If you have saved a previous configuration in a file other than the\n" 211 "If you have saved a previous configuration in a file other than the\n"
214 "kernel's default, entering the name of the file here will allow you\n" 212 "default one, entering its name here will allow you to modify that\n"
215 "to modify that configuration.\n" 213 "configuration.\n"
216 "\n" 214 "\n"
217 "If you are uncertain, then you have probably never used alternate\n" 215 "If you are uncertain, then you have probably never used alternate\n"
218 "configuration files. You should therefore leave this blank to abort.\n"), 216 "configuration files. You should therefore leave this blank to abort.\n"),
@@ -221,8 +219,8 @@ save_config_text[] = N_(
221 "as an alternate. Leave blank to abort."), 219 "as an alternate. Leave blank to abort."),
222save_config_help[] = N_( 220save_config_help[] = N_(
223 "\n" 221 "\n"
224 "For various reasons, one may wish to keep different kernel\n" 222 "For various reasons, one may wish to keep different configurations\n"
225 "configurations available on a single machine.\n" 223 "available on a single machine.\n"
226 "\n" 224 "\n"
227 "Entering a file name here will allow you to later retrieve, modify\n" 225 "Entering a file name here will allow you to later retrieve, modify\n"
228 "and use the current configuration as an alternate to whatever\n" 226 "and use the current configuration as an alternate to whatever\n"
@@ -232,7 +230,7 @@ save_config_help[] = N_(
232 "leave this blank.\n"), 230 "leave this blank.\n"),
233search_help[] = N_( 231search_help[] = N_(
234 "\n" 232 "\n"
235 "Search for CONFIG_ symbols and display their relations.\n" 233 "Search for symbols and display their relations.\n"
236 "Regular expressions are allowed.\n" 234 "Regular expressions are allowed.\n"
237 "Example: search for \"^FOO\"\n" 235 "Example: search for \"^FOO\"\n"
238 "Result:\n" 236 "Result:\n"
@@ -249,7 +247,7 @@ search_help[] = N_(
249 "Selected by: BAR\n" 247 "Selected by: BAR\n"
250 "-----------------------------------------------------------------\n" 248 "-----------------------------------------------------------------\n"
251 "o The line 'Prompt:' shows the text used in the menu structure for\n" 249 "o The line 'Prompt:' shows the text used in the menu structure for\n"
252 " this CONFIG_ symbol\n" 250 " this symbol\n"
253 "o The 'Defined at' line tell at what file / line number the symbol\n" 251 "o The 'Defined at' line tell at what file / line number the symbol\n"
254 " is defined\n" 252 " is defined\n"
255 "o The 'Depends on:' line tell what symbols needs to be defined for\n" 253 "o The 'Depends on:' line tell what symbols needs to be defined for\n"
@@ -265,9 +263,9 @@ search_help[] = N_(
265 "Only relevant lines are shown.\n" 263 "Only relevant lines are shown.\n"
266 "\n\n" 264 "\n\n"
267 "Search examples:\n" 265 "Search examples:\n"
268 "Examples: USB => find all CONFIG_ symbols containing USB\n" 266 "Examples: USB => find all symbols containing USB\n"
269 " ^USB => find all CONFIG_ symbols starting with USB\n" 267 " ^USB => find all symbols starting with USB\n"
270 " USB$ => find all CONFIG_ symbols ending with USB\n" 268 " USB$ => find all symbols ending with USB\n"
271 "\n"); 269 "\n");
272 270
273static int indent; 271static int indent;
@@ -290,13 +288,9 @@ static void set_config_filename(const char *config_filename)
290{ 288{
291 static char menu_backtitle[PATH_MAX+128]; 289 static char menu_backtitle[PATH_MAX+128];
292 int size; 290 int size;
293 struct symbol *sym;
294 291
295 sym = sym_lookup("KERNELVERSION", 0);
296 sym_calc_value(sym);
297 size = snprintf(menu_backtitle, sizeof(menu_backtitle), 292 size = snprintf(menu_backtitle, sizeof(menu_backtitle),
298 _("%s - Linux Kernel v%s Configuration"), 293 "%s - %s", config_filename, rootmenu.prompt->text);
299 config_filename, sym_get_string_value(sym));
300 if (size >= sizeof(menu_backtitle)) 294 if (size >= sizeof(menu_backtitle))
301 menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; 295 menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
302 set_dialog_backtitle(menu_backtitle); 296 set_dialog_backtitle(menu_backtitle);
@@ -316,8 +310,8 @@ static void search_conf(void)
316again: 310again:
317 dialog_clear(); 311 dialog_clear();
318 dres = dialog_inputbox(_("Search Configuration Parameter"), 312 dres = dialog_inputbox(_("Search Configuration Parameter"),
319 _("Enter CONFIG_ (sub)string to search for " 313 _("Enter " CONFIG_ " (sub)string to search for "
320 "(with or without \"CONFIG\")"), 314 "(with or without \"" CONFIG_ "\")"),
321 10, 75, ""); 315 10, 75, "");
322 switch (dres) { 316 switch (dres) {
323 case 0: 317 case 0:
@@ -329,10 +323,10 @@ again:
329 return; 323 return;
330 } 324 }
331 325
332 /* strip CONFIG_ if necessary */ 326 /* strip the prefix if necessary */
333 dialog_input = dialog_input_result; 327 dialog_input = dialog_input_result;
334 if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) 328 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
335 dialog_input += 7; 329 dialog_input += strlen(CONFIG_);
336 330
337 sym_arr = sym_re_search(dialog_input); 331 sym_arr = sym_re_search(dialog_input);
338 res = get_relations_str(sym_arr); 332 res = get_relations_str(sym_arr);
@@ -834,7 +828,7 @@ int main(int ac, char **av)
834 if (conf_get_changed()) 828 if (conf_get_changed())
835 res = dialog_yesno(NULL, 829 res = dialog_yesno(NULL,
836 _("Do you wish to save your " 830 _("Do you wish to save your "
837 "new kernel configuration?\n" 831 "new configuration?\n"
838 "<ESC><ESC> to continue."), 832 "<ESC><ESC> to continue."),
839 6, 60); 833 6, 60);
840 else 834 else
@@ -846,20 +840,20 @@ int main(int ac, char **av)
846 case 0: 840 case 0:
847 if (conf_write(filename)) { 841 if (conf_write(filename)) {
848 fprintf(stderr, _("\n\n" 842 fprintf(stderr, _("\n\n"
849 "Error during writing of the kernel configuration.\n" 843 "Error while writing of the configuration.\n"
850 "Your kernel configuration changes were NOT saved." 844 "Your configuration changes were NOT saved."
851 "\n\n")); 845 "\n\n"));
852 return 1; 846 return 1;
853 } 847 }
854 case -1: 848 case -1:
855 printf(_("\n\n" 849 printf(_("\n\n"
856 "*** End of Linux kernel configuration.\n" 850 "*** End of the configuration.\n"
857 "*** Execute 'make' to build the kernel or try 'make help'." 851 "*** Execute 'make' to start the build or try 'make help'."
858 "\n\n")); 852 "\n\n"));
859 break; 853 break;
860 default: 854 default:
861 fprintf(stderr, _("\n\n" 855 fprintf(stderr, _("\n\n"
862 "Your kernel configuration changes were NOT saved." 856 "Your configuration changes were NOT saved."
863 "\n\n")); 857 "\n\n"));
864 } 858 }
865 859
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index edda8b49619d..7e83aef42c6d 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -10,7 +10,7 @@
10#include "lkc.h" 10#include "lkc.h"
11 11
12static const char nohelp_text[] = N_( 12static const char nohelp_text[] = N_(
13 "There is no help available for this kernel option.\n"); 13 "There is no help available for this option.\n");
14 14
15struct menu rootmenu; 15struct menu rootmenu;
16static struct menu **last_entry_ptr; 16static struct menu **last_entry_ptr;
@@ -138,7 +138,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e
138 while (isspace(*prompt)) 138 while (isspace(*prompt))
139 prompt++; 139 prompt++;
140 } 140 }
141 if (current_entry->prompt) 141 if (current_entry->prompt && current_entry != &rootmenu)
142 prop_warn(prop, "prompt redefined"); 142 prop_warn(prop, "prompt redefined");
143 current_entry->prompt = prop; 143 current_entry->prompt = prop;
144 } 144 }
@@ -563,7 +563,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help)
563 563
564 if (menu_has_help(menu)) { 564 if (menu_has_help(menu)) {
565 if (sym->name) { 565 if (sym->name) {
566 str_printf(help, "CONFIG_%s:\n\n", sym->name); 566 str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
567 str_append(help, _(menu_get_help(menu))); 567 str_append(help, _(menu_get_help(menu)));
568 str_append(help, "\n"); 568 str_append(help, "\n");
569 } 569 }
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 2ba71bcd38e6..272a987f23e0 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -5,25 +5,26 @@
5 * Derived from menuconfig. 5 * Derived from menuconfig.
6 * 6 *
7 */ 7 */
8#define _GNU_SOURCE
9#include <string.h>
8#define LKC_DIRECT_LINK 10#define LKC_DIRECT_LINK
9#include "lkc.h" 11#include "lkc.h"
10#include "nconf.h" 12#include "nconf.h"
13#include <ctype.h>
11 14
12static const char nconf_readme[] = N_( 15static const char nconf_readme[] = N_(
13"Overview\n" 16"Overview\n"
14"--------\n" 17"--------\n"
15"Some kernel features may be built directly into the kernel.\n" 18"This interface let you select features and parameters for the build.\n"
16"Some may be made into loadable runtime modules. Some features\n" 19"Features can either be built-in, modularized, or ignored. Parameters\n"
17"may be completely removed altogether. There are also certain\n" 20"must be entered in as decimal or hexadecimal numbers or text.\n"
18"kernel parameters which are not really features, but must be\n"
19"entered in as decimal or hexadecimal numbers or possibly text.\n"
20"\n" 21"\n"
21"Menu items beginning with following braces represent features that\n" 22"Menu items beginning with following braces represent features that\n"
22" [ ] can be built in or removed\n" 23" [ ] can be built in or removed\n"
23" < > can be built in, modularized or removed\n" 24" < > can be built in, modularized or removed\n"
24" { } can be built in or modularized (selected by other feature)\n" 25" { } can be built in or modularized (selected by other feature)\n"
25" - - are selected by other feature,\n" 26" - - are selected by other feature,\n"
26" XXX cannot be selected. use Symbol Info to find out why,\n" 27" XXX cannot be selected. Use Symbol Info to find out why,\n"
27"while *, M or whitespace inside braces means to build in, build as\n" 28"while *, M or whitespace inside braces means to build in, build as\n"
28"a module or to exclude the feature respectively.\n" 29"a module or to exclude the feature respectively.\n"
29"\n" 30"\n"
@@ -41,9 +42,13 @@ static const char nconf_readme[] = N_(
41" pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n" 42" pressing <Enter> of <right-arrow>. Use <Esc> or <left-arrow> to go back.\n"
42" Submenus are designated by \"--->\".\n" 43" Submenus are designated by \"--->\".\n"
43"\n" 44"\n"
44" Shortcut: Press the option's highlighted letter (hotkey).\n" 45" Searching: pressing '/' triggers interactive search mode.\n"
45" Pressing a hotkey more than once will sequence\n" 46" nconfig performs a case insensitive search for the string\n"
46" through all visible items which use that hotkey.\n" 47" in the menu prompts (no regex support).\n"
48" Pressing the up/down keys highlights the previous/next\n"
49" matching item. Backspace removes one character from the\n"
50" match string. Pressing either '/' again or ESC exits\n"
51" search mode. All other keys behave normally.\n"
47"\n" 52"\n"
48" You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n" 53" You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n"
49" unseen options into view.\n" 54" unseen options into view.\n"
@@ -88,7 +93,7 @@ static const char nconf_readme[] = N_(
88"-----------------------------\n" 93"-----------------------------\n"
89"nconfig supports the use of alternate configuration files for\n" 94"nconfig supports the use of alternate configuration files for\n"
90"those who, for various reasons, find it necessary to switch\n" 95"those who, for various reasons, find it necessary to switch\n"
91"between different kernel configurations.\n" 96"between different configurations.\n"
92"\n" 97"\n"
93"At the end of the main menu you will find two options. One is\n" 98"At the end of the main menu you will find two options. One is\n"
94"for saving the current configuration to a file of your choosing.\n" 99"for saving the current configuration to a file of your choosing.\n"
@@ -121,9 +126,9 @@ static const char nconf_readme[] = N_(
121"\n" 126"\n"
122"Optional personality available\n" 127"Optional personality available\n"
123"------------------------------\n" 128"------------------------------\n"
124"If you prefer to have all of the kernel options listed in a single\n" 129"If you prefer to have all of the options listed in a single menu, rather\n"
125"menu, rather than the default multimenu hierarchy, run the nconfig\n" 130"than the default multimenu hierarchy, run the nconfig with NCONFIG_MODE\n"
126"with NCONFIG_MODE environment variable set to single_menu. Example:\n" 131"environment variable set to single_menu. Example:\n"
127"\n" 132"\n"
128"make NCONFIG_MODE=single_menu nconfig\n" 133"make NCONFIG_MODE=single_menu nconfig\n"
129"\n" 134"\n"
@@ -141,21 +146,21 @@ menu_no_f_instructions[] = N_(
141" <Enter> or <right-arrow> selects submenus --->.\n" 146" <Enter> or <right-arrow> selects submenus --->.\n"
142" Capital Letters are hotkeys.\n" 147" Capital Letters are hotkeys.\n"
143" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n" 148" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n"
144" Pressing SpaceBar toggles between the above options\n" 149" Pressing SpaceBar toggles between the above options.\n"
145" Press <Esc> or <left-arrow> to go back one menu, \n" 150" Press <Esc> or <left-arrow> to go back one menu,\n"
146" <?> or <h> for Help, </> for Search.\n" 151" <?> or <h> for Help, </> for Search.\n"
147" <1> is interchangable with <F1>, <2> with <F2>, etc.\n" 152" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n"
148" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" 153" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
149" <Esc> always leaves the current window\n"), 154" <Esc> always leaves the current window.\n"),
150menu_instructions[] = N_( 155menu_instructions[] = N_(
151" Arrow keys navigate the menu.\n" 156" Arrow keys navigate the menu.\n"
152" <Enter> or <right-arrow> selects submenus --->.\n" 157" <Enter> or <right-arrow> selects submenus --->.\n"
153" Capital Letters are hotkeys.\n" 158" Capital Letters are hotkeys.\n"
154" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n" 159" Pressing <Y> includes, <N> excludes, <M> modularizes features.\n"
155" Pressing SpaceBar toggles between the above options\n" 160" Pressing SpaceBar toggles between the above options\n"
156" Press <Esc>, <F3> or <left-arrow> to go back one menu, \n" 161" Press <Esc>, <F5> or <left-arrow> to go back one menu,\n"
157" <?>, <F1> or <h> for Help, </> for Search.\n" 162" <?>, <F1> or <h> for Help, </> for Search.\n"
158" <1> is interchangable with <F1>, <2> with <F2>, etc.\n" 163" <1> is interchangeable with <F1>, <2> with <F2>, etc.\n"
159" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n" 164" Legend: [*] built-in [ ] excluded <M> module < > module capable.\n"
160" <Esc> always leaves the current window\n"), 165" <Esc> always leaves the current window\n"),
161radiolist_instructions[] = N_( 166radiolist_instructions[] = N_(
@@ -178,19 +183,19 @@ setmod_text[] = N_(
178"has been configured as a module.\n" 183"has been configured as a module.\n"
179"As a result, this feature will be built as a module."), 184"As a result, this feature will be built as a module."),
180nohelp_text[] = N_( 185nohelp_text[] = N_(
181"There is no help available for this kernel option.\n"), 186"There is no help available for this option.\n"),
182load_config_text[] = N_( 187load_config_text[] = N_(
183"Enter the name of the configuration file you wish to load.\n" 188"Enter the name of the configuration file you wish to load.\n"
184"Accept the name shown to restore the configuration you\n" 189"Accept the name shown to restore the configuration you\n"
185"last retrieved. Leave blank to abort."), 190"last retrieved. Leave blank to abort."),
186load_config_help[] = N_( 191load_config_help[] = N_(
187"\n" 192"\n"
188"For various reasons, one may wish to keep several different kernel\n" 193"For various reasons, one may wish to keep several different\n"
189"configurations available on a single machine.\n" 194"configurations available on a single machine.\n"
190"\n" 195"\n"
191"If you have saved a previous configuration in a file other than the\n" 196"If you have saved a previous configuration in a file other than the\n"
192"kernel's default, entering the name of the file here will allow you\n" 197"default one, entering its name here will allow you to modify that\n"
193"to modify that configuration.\n" 198"configuration.\n"
194"\n" 199"\n"
195"If you are uncertain, then you have probably never used alternate\n" 200"If you are uncertain, then you have probably never used alternate\n"
196"configuration files. You should therefor leave this blank to abort.\n"), 201"configuration files. You should therefor leave this blank to abort.\n"),
@@ -199,8 +204,8 @@ save_config_text[] = N_(
199"as an alternate. Leave blank to abort."), 204"as an alternate. Leave blank to abort."),
200save_config_help[] = N_( 205save_config_help[] = N_(
201"\n" 206"\n"
202"For various reasons, one may wish to keep different kernel\n" 207"For various reasons, one may wish to keep different configurations\n"
203"configurations available on a single machine.\n" 208"available on a single machine.\n"
204"\n" 209"\n"
205"Entering a file name here will allow you to later retrieve, modify\n" 210"Entering a file name here will allow you to later retrieve, modify\n"
206"and use the current configuration as an alternate to whatever\n" 211"and use the current configuration as an alternate to whatever\n"
@@ -210,8 +215,8 @@ save_config_help[] = N_(
210"leave this blank.\n"), 215"leave this blank.\n"),
211search_help[] = N_( 216search_help[] = N_(
212"\n" 217"\n"
213"Search for CONFIG_ symbols and display their relations.\n" 218"Search for symbols and display their relations. Regular expressions\n"
214"Regular expressions are allowed.\n" 219"are allowed.\n"
215"Example: search for \"^FOO\"\n" 220"Example: search for \"^FOO\"\n"
216"Result:\n" 221"Result:\n"
217"-----------------------------------------------------------------\n" 222"-----------------------------------------------------------------\n"
@@ -227,7 +232,7 @@ search_help[] = N_(
227"Selected by: BAR\n" 232"Selected by: BAR\n"
228"-----------------------------------------------------------------\n" 233"-----------------------------------------------------------------\n"
229"o The line 'Prompt:' shows the text used in the menu structure for\n" 234"o The line 'Prompt:' shows the text used in the menu structure for\n"
230" this CONFIG_ symbol\n" 235" this symbol\n"
231"o The 'Defined at' line tell at what file / line number the symbol\n" 236"o The 'Defined at' line tell at what file / line number the symbol\n"
232" is defined\n" 237" is defined\n"
233"o The 'Depends on:' line tell what symbols needs to be defined for\n" 238"o The 'Depends on:' line tell what symbols needs to be defined for\n"
@@ -243,16 +248,15 @@ search_help[] = N_(
243"Only relevant lines are shown.\n" 248"Only relevant lines are shown.\n"
244"\n\n" 249"\n\n"
245"Search examples:\n" 250"Search examples:\n"
246"Examples: USB = > find all CONFIG_ symbols containing USB\n" 251"Examples: USB = > find all symbols containing USB\n"
247" ^USB => find all CONFIG_ symbols starting with USB\n" 252" ^USB => find all symbols starting with USB\n"
248" USB$ => find all CONFIG_ symbols ending with USB\n" 253" USB$ => find all symbols ending with USB\n"
249"\n"); 254"\n");
250 255
251struct mitem { 256struct mitem {
252 char str[256]; 257 char str[256];
253 char tag; 258 char tag;
254 void *usrptr; 259 void *usrptr;
255 int is_hot;
256 int is_visible; 260 int is_visible;
257}; 261};
258 262
@@ -275,14 +279,6 @@ static int items_num;
275static int global_exit; 279static int global_exit;
276/* the currently selected button */ 280/* the currently selected button */
277const char *current_instructions = menu_instructions; 281const char *current_instructions = menu_instructions;
278/* this array is used to implement hot keys. it is updated in item_make and
279 * resetted in clean_items. It would be better to use a hash, but lets keep it
280 * simple... */
281#define MAX_SAME_KEY MAX_MENU_ITEMS
282struct {
283 int count;
284 int ptrs[MAX_MENU_ITEMS];
285} hotkeys[1<<(sizeof(char)*8)];
286 282
287static void conf(struct menu *menu); 283static void conf(struct menu *menu);
288static void conf_choice(struct menu *menu); 284static void conf_choice(struct menu *menu);
@@ -292,6 +288,7 @@ static void conf_save(void);
292static void show_help(struct menu *menu); 288static void show_help(struct menu *menu);
293static int do_exit(void); 289static int do_exit(void);
294static void setup_windows(void); 290static void setup_windows(void);
291static void search_conf(void);
295 292
296typedef void (*function_key_handler_t)(int *key, struct menu *menu); 293typedef void (*function_key_handler_t)(int *key, struct menu *menu);
297static void handle_f1(int *key, struct menu *current_item); 294static void handle_f1(int *key, struct menu *current_item);
@@ -302,6 +299,7 @@ static void handle_f5(int *key, struct menu *current_item);
302static void handle_f6(int *key, struct menu *current_item); 299static void handle_f6(int *key, struct menu *current_item);
303static void handle_f7(int *key, struct menu *current_item); 300static void handle_f7(int *key, struct menu *current_item);
304static void handle_f8(int *key, struct menu *current_item); 301static void handle_f8(int *key, struct menu *current_item);
302static void handle_f9(int *key, struct menu *current_item);
305 303
306struct function_keys { 304struct function_keys {
307 const char *key_str; 305 const char *key_str;
@@ -310,7 +308,7 @@ struct function_keys {
310 function_key_handler_t handler; 308 function_key_handler_t handler;
311}; 309};
312 310
313static const int function_keys_num = 8; 311static const int function_keys_num = 9;
314struct function_keys function_keys[] = { 312struct function_keys function_keys[] = {
315 { 313 {
316 .key_str = "F1", 314 .key_str = "F1",
@@ -320,13 +318,13 @@ struct function_keys function_keys[] = {
320 }, 318 },
321 { 319 {
322 .key_str = "F2", 320 .key_str = "F2",
323 .func = "Symbol Info", 321 .func = "Sym Info",
324 .key = F_SYMBOL, 322 .key = F_SYMBOL,
325 .handler = handle_f2, 323 .handler = handle_f2,
326 }, 324 },
327 { 325 {
328 .key_str = "F3", 326 .key_str = "F3",
329 .func = "Instructions", 327 .func = "Insts",
330 .key = F_INSTS, 328 .key = F_INSTS,
331 .handler = handle_f3, 329 .handler = handle_f3,
332 }, 330 },
@@ -356,9 +354,15 @@ struct function_keys function_keys[] = {
356 }, 354 },
357 { 355 {
358 .key_str = "F8", 356 .key_str = "F8",
357 .func = "Sym Search",
358 .key = F_SEARCH,
359 .handler = handle_f8,
360 },
361 {
362 .key_str = "F9",
359 .func = "Exit", 363 .func = "Exit",
360 .key = F_EXIT, 364 .key = F_EXIT,
361 .handler = handle_f8, 365 .handler = handle_f9,
362 }, 366 },
363}; 367};
364 368
@@ -444,9 +448,16 @@ static void handle_f7(int *key, struct menu *current_item)
444 return; 448 return;
445} 449}
446 450
447/* exit */ 451/* search */
448static void handle_f8(int *key, struct menu *current_item) 452static void handle_f8(int *key, struct menu *current_item)
449{ 453{
454 search_conf();
455 return;
456}
457
458/* exit */
459static void handle_f9(int *key, struct menu *current_item)
460{
450 do_exit(); 461 do_exit();
451 return; 462 return;
452} 463}
@@ -479,110 +490,44 @@ static void clean_items(void)
479 free_item(curses_menu_items[i]); 490 free_item(curses_menu_items[i]);
480 bzero(curses_menu_items, sizeof(curses_menu_items)); 491 bzero(curses_menu_items, sizeof(curses_menu_items));
481 bzero(k_menu_items, sizeof(k_menu_items)); 492 bzero(k_menu_items, sizeof(k_menu_items));
482 bzero(hotkeys, sizeof(hotkeys));
483 items_num = 0; 493 items_num = 0;
484} 494}
485 495
486/* return the index of the next hot item, or -1 if no such item exists */ 496typedef enum {MATCH_TINKER_PATTERN_UP, MATCH_TINKER_PATTERN_DOWN,
487static int get_next_hot(int c) 497 FIND_NEXT_MATCH_DOWN, FIND_NEXT_MATCH_UP} match_f;
488{
489 static int hot_index;
490 static int hot_char;
491
492 if (c < 0 || c > 255 || hotkeys[c].count <= 0)
493 return -1;
494
495 if (hot_char == c) {
496 hot_index = (hot_index+1)%hotkeys[c].count;
497 return hotkeys[c].ptrs[hot_index];
498 } else {
499 hot_char = c;
500 hot_index = 0;
501 return hotkeys[c].ptrs[0];
502 }
503}
504
505/* can the char c be a hot key? no, if c is a common shortcut used elsewhere */
506static int canbhot(char c)
507{
508 c = tolower(c);
509 return isalnum(c) && c != 'y' && c != 'm' && c != 'h' &&
510 c != 'n' && c != '?';
511}
512
513/* check if str already contains a hot key. */
514static int is_hot(int index)
515{
516 return k_menu_items[index].is_hot;
517}
518 498
519/* find the first possible hot key, and mark it. 499/* return the index of the matched item, or -1 if no such item exists */
520 * index is the index of the item in the menu 500static int get_mext_match(const char *match_str, match_f flag)
521 * return 0 on success*/
522static int make_hot(char *dest, int len, const char *org, int index)
523{ 501{
524 int position = -1; 502 int match_start = item_index(current_item(curses_menu));
525 int i; 503 int index;
526 int tmp; 504
527 int c; 505 if (flag == FIND_NEXT_MATCH_DOWN)
528 int org_len = strlen(org); 506 ++match_start;
529 507 else if (flag == FIND_NEXT_MATCH_UP)
530 if (org == NULL || is_hot(index)) 508 --match_start;
531 return 1; 509
532 510 index = match_start;
533 /* make sure not to make hot keys out of markers. 511 index = (index + items_num) % items_num;
534 * find where to start looking for a hot key 512 while (true) {
535 */ 513 char *str = k_menu_items[index].str;
536 i = 0; 514 if (strcasestr(str, match_str) != 0)
537 /* skip white space */ 515 return index;
538 while (i < org_len && org[i] == ' ') 516 if (flag == FIND_NEXT_MATCH_UP ||
539 i++; 517 flag == MATCH_TINKER_PATTERN_UP)
540 if (i == org_len) 518 --index;
541 return -1; 519 else
542 /* if encountering '(' or '<' or '[', find the match and look from there 520 ++index;
543 **/ 521 index = (index + items_num) % items_num;
544 if (org[i] == '[' || org[i] == '<' || org[i] == '(') { 522 if (index == match_start)
545 i++; 523 return -1;
546 for (; i < org_len; i++)
547 if (org[i] == ']' || org[i] == '>' || org[i] == ')')
548 break;
549 }
550 if (i == org_len)
551 return -1;
552 for (; i < org_len; i++) {
553 if (canbhot(org[i]) && org[i-1] != '<' && org[i-1] != '(') {
554 position = i;
555 break;
556 }
557 } 524 }
558 if (position == -1)
559 return 1;
560
561 /* ok, char at org[position] should be a hot key to this item */
562 c = tolower(org[position]);
563 tmp = hotkeys[c].count;
564 hotkeys[c].ptrs[tmp] = index;
565 hotkeys[c].count++;
566 /*
567 snprintf(dest, len, "%.*s(%c)%s", position, org, org[position],
568 &org[position+1]);
569 */
570 /* make org[position] uppercase, and all leading letter small case */
571 strncpy(dest, org, len);
572 for (i = 0; i < position; i++)
573 dest[i] = tolower(dest[i]);
574 dest[position] = toupper(dest[position]);
575 k_menu_items[index].is_hot = 1;
576 return 0;
577} 525}
578 526
579/* Make a new item. Add a hotkey mark in the first possible letter. 527/* Make a new item. */
580 * As ncurses does not allow any attributes inside menue item, we mark the
581 * hot key as the first capitalized letter in the string */
582static void item_make(struct menu *menu, char tag, const char *fmt, ...) 528static void item_make(struct menu *menu, char tag, const char *fmt, ...)
583{ 529{
584 va_list ap; 530 va_list ap;
585 char tmp_str[256];
586 531
587 if (items_num > MAX_MENU_ITEMS-1) 532 if (items_num > MAX_MENU_ITEMS-1)
588 return; 533 return;
@@ -597,16 +542,13 @@ static void item_make(struct menu *menu, char tag, const char *fmt, ...)
597 k_menu_items[items_num].is_visible = 1; 542 k_menu_items[items_num].is_visible = 1;
598 543
599 va_start(ap, fmt); 544 va_start(ap, fmt);
600 vsnprintf(tmp_str, sizeof(tmp_str), fmt, ap); 545 vsnprintf(k_menu_items[items_num].str,
601 if (!k_menu_items[items_num].is_visible) 546 sizeof(k_menu_items[items_num].str),
602 memcpy(tmp_str, "XXX", 3); 547 fmt, ap);
603 va_end(ap); 548 va_end(ap);
604 if (make_hot( 549
605 k_menu_items[items_num].str, 550 if (!k_menu_items[items_num].is_visible)
606 sizeof(k_menu_items[items_num].str), tmp_str, items_num) != 0) 551 memcpy(k_menu_items[items_num].str, "XXX", 3);
607 strncpy(k_menu_items[items_num].str,
608 tmp_str,
609 sizeof(k_menu_items[items_num].str));
610 552
611 curses_menu_items[items_num] = new_item( 553 curses_menu_items[items_num] = new_item(
612 k_menu_items[items_num].str, 554 k_menu_items[items_num].str,
@@ -638,11 +580,9 @@ static void item_add_str(const char *fmt, ...)
638 va_end(ap); 580 va_end(ap);
639 snprintf(tmp_str, sizeof(tmp_str), "%s%s", 581 snprintf(tmp_str, sizeof(tmp_str), "%s%s",
640 k_menu_items[index].str, new_str); 582 k_menu_items[index].str, new_str);
641 if (make_hot(k_menu_items[index].str, 583 strncpy(k_menu_items[index].str,
642 sizeof(k_menu_items[index].str), tmp_str, index) != 0) 584 tmp_str,
643 strncpy(k_menu_items[index].str, 585 sizeof(k_menu_items[index].str));
644 tmp_str,
645 sizeof(k_menu_items[index].str));
646 586
647 free_item(curses_menu_items[index]); 587 free_item(curses_menu_items[index]);
648 curses_menu_items[index] = new_item( 588 curses_menu_items[index] = new_item(
@@ -693,13 +633,9 @@ static char menu_backtitle[PATH_MAX+128];
693static const char *set_config_filename(const char *config_filename) 633static const char *set_config_filename(const char *config_filename)
694{ 634{
695 int size; 635 int size;
696 struct symbol *sym;
697 636
698 sym = sym_lookup("KERNELVERSION", 0);
699 sym_calc_value(sym);
700 size = snprintf(menu_backtitle, sizeof(menu_backtitle), 637 size = snprintf(menu_backtitle, sizeof(menu_backtitle),
701 _("%s - Linux Kernel v%s Configuration"), 638 "%s - %s", config_filename, rootmenu.prompt->text);
702 config_filename, sym_get_string_value(sym));
703 if (size >= sizeof(menu_backtitle)) 639 if (size >= sizeof(menu_backtitle))
704 menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; 640 menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
705 641
@@ -709,25 +645,6 @@ static const char *set_config_filename(const char *config_filename)
709 return menu_backtitle; 645 return menu_backtitle;
710} 646}
711 647
712/* command = 0 is supress, 1 is restore */
713static void supress_stdout(int command)
714{
715 static FILE *org_stdout;
716 static FILE *org_stderr;
717
718 if (command == 0) {
719 org_stdout = stdout;
720 org_stderr = stderr;
721 stdout = fopen("/dev/null", "a");
722 stderr = fopen("/dev/null", "a");
723 } else {
724 fclose(stdout);
725 fclose(stderr);
726 stdout = org_stdout;
727 stderr = org_stderr;
728 }
729}
730
731/* return = 0 means we are successful. 648/* return = 0 means we are successful.
732 * -1 means go on doing what you were doing 649 * -1 means go on doing what you were doing
733 */ 650 */
@@ -739,8 +656,7 @@ static int do_exit(void)
739 return 0; 656 return 0;
740 } 657 }
741 res = btn_dialog(main_window, 658 res = btn_dialog(main_window,
742 _("Do you wish to save your " 659 _("Do you wish to save your new configuration?\n"
743 "new kernel configuration?\n"
744 "<ESC> to cancel and resume nconfig."), 660 "<ESC> to cancel and resume nconfig."),
745 2, 661 2,
746 " <save> ", 662 " <save> ",
@@ -753,36 +669,19 @@ static int do_exit(void)
753 /* if we got here, the user really wants to exit */ 669 /* if we got here, the user really wants to exit */
754 switch (res) { 670 switch (res) {
755 case 0: 671 case 0:
756 supress_stdout(0);
757 res = conf_write(filename); 672 res = conf_write(filename);
758 supress_stdout(1);
759 if (res) 673 if (res)
760 btn_dialog( 674 btn_dialog(
761 main_window, 675 main_window,
762 _("Error during writing of the kernel " 676 _("Error during writing of configuration.\n"
763 "configuration.\n" 677 "Your configuration changes were NOT saved."),
764 "Your kernel configuration "
765 "changes were NOT saved."),
766 1, 678 1,
767 "<OK>"); 679 "<OK>");
768 else {
769 char buf[1024];
770 snprintf(buf, 1024,
771 _("Configuration written to %s\n"
772 "End of Linux kernel configuration.\n"
773 "Execute 'make' to build the kernel or try"
774 " 'make help'."), filename);
775 btn_dialog(
776 main_window,
777 buf,
778 1,
779 "<OK>");
780 }
781 break; 680 break;
782 default: 681 default:
783 btn_dialog( 682 btn_dialog(
784 main_window, 683 main_window,
785 _("Your kernel configuration changes were NOT saved."), 684 _("Your configuration changes were NOT saved."),
786 1, 685 1,
787 "<OK>"); 686 "<OK>");
788 break; 687 break;
@@ -802,8 +701,8 @@ static void search_conf(void)
802again: 701again:
803 dres = dialog_inputbox(main_window, 702 dres = dialog_inputbox(main_window,
804 _("Search Configuration Parameter"), 703 _("Search Configuration Parameter"),
805 _("Enter CONFIG_ (sub)string to search for " 704 _("Enter " CONFIG_ " (sub)string to search for "
806 "(with or without \"CONFIG\")"), 705 "(with or without \"" CONFIG_ "\")"),
807 "", dialog_input_result, 99); 706 "", dialog_input_result, 99);
808 switch (dres) { 707 switch (dres) {
809 case 0: 708 case 0:
@@ -816,10 +715,10 @@ again:
816 return; 715 return;
817 } 716 }
818 717
819 /* strip CONFIG_ if necessary */ 718 /* strip the prefix if necessary */
820 dialog_input = dialog_input_result; 719 dialog_input = dialog_input_result;
821 if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) 720 if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
822 dialog_input += 7; 721 dialog_input += strlen(CONFIG_);
823 722
824 sym_arr = sym_re_search(dialog_input); 723 sym_arr = sym_re_search(dialog_input);
825 res = get_relations_str(sym_arr); 724 res = get_relations_str(sym_arr);
@@ -1027,23 +926,18 @@ static void reset_menu(void)
1027static void center_item(int selected_index, int *last_top_row) 926static void center_item(int selected_index, int *last_top_row)
1028{ 927{
1029 int toprow; 928 int toprow;
1030 int maxy, maxx;
1031 929
1032 scale_menu(curses_menu, &maxy, &maxx);
1033 set_top_row(curses_menu, *last_top_row); 930 set_top_row(curses_menu, *last_top_row);
1034 toprow = top_row(curses_menu); 931 toprow = top_row(curses_menu);
1035 if (selected_index >= toprow && selected_index < toprow+maxy) { 932 if (selected_index < toprow ||
1036 /* we can only move the selected item. no need to scroll */ 933 selected_index >= toprow+mwin_max_lines) {
1037 set_current_item(curses_menu, 934 toprow = max(selected_index-mwin_max_lines/2, 0);
1038 curses_menu_items[selected_index]); 935 if (toprow >= item_count(curses_menu)-mwin_max_lines)
1039 } else {
1040 toprow = max(selected_index-maxy/2, 0);
1041 if (toprow >= item_count(curses_menu)-maxy)
1042 toprow = item_count(curses_menu)-mwin_max_lines; 936 toprow = item_count(curses_menu)-mwin_max_lines;
1043 set_top_row(curses_menu, toprow); 937 set_top_row(curses_menu, toprow);
1044 set_current_item(curses_menu,
1045 curses_menu_items[selected_index]);
1046 } 938 }
939 set_current_item(curses_menu,
940 curses_menu_items[selected_index]);
1047 *last_top_row = toprow; 941 *last_top_row = toprow;
1048 post_menu(curses_menu); 942 post_menu(curses_menu);
1049 refresh_all_windows(main_window); 943 refresh_all_windows(main_window);
@@ -1075,7 +969,7 @@ static void show_menu(const char *prompt, const char *instructions,
1075 /* position the menu at the middle of the screen */ 969 /* position the menu at the middle of the screen */
1076 scale_menu(curses_menu, &maxy, &maxx); 970 scale_menu(curses_menu, &maxy, &maxx);
1077 maxx = min(maxx, mwin_max_cols-2); 971 maxx = min(maxx, mwin_max_cols-2);
1078 maxy = mwin_max_lines-2; 972 maxy = mwin_max_lines;
1079 menu_window = derwin(main_window, 973 menu_window = derwin(main_window,
1080 maxy, 974 maxy,
1081 maxx, 975 maxx,
@@ -1099,10 +993,77 @@ static void show_menu(const char *prompt, const char *instructions,
1099 refresh_all_windows(main_window); 993 refresh_all_windows(main_window);
1100} 994}
1101 995
996static void adj_match_dir(match_f *match_direction)
997{
998 if (*match_direction == FIND_NEXT_MATCH_DOWN)
999 *match_direction =
1000 MATCH_TINKER_PATTERN_DOWN;
1001 else if (*match_direction == FIND_NEXT_MATCH_UP)
1002 *match_direction =
1003 MATCH_TINKER_PATTERN_UP;
1004 /* else, do no change.. */
1005}
1102 1006
1103static void conf(struct menu *menu) 1007struct match_state
1104{ 1008{
1009 int in_search;
1010 match_f match_direction;
1105 char pattern[256]; 1011 char pattern[256];
1012};
1013
1014/* Return 0 means I have handled the key. In such a case, ans should hold the
1015 * item to center, or -1 otherwise.
1016 * Else return -1 .
1017 */
1018static int do_match(int key, struct match_state *state, int *ans)
1019{
1020 char c = (char) key;
1021 int terminate_search = 0;
1022 *ans = -1;
1023 if (key == '/' || (state->in_search && key == 27)) {
1024 move(0, 0);
1025 refresh();
1026 clrtoeol();
1027 state->in_search = 1-state->in_search;
1028 bzero(state->pattern, sizeof(state->pattern));
1029 state->match_direction = MATCH_TINKER_PATTERN_DOWN;
1030 return 0;
1031 } else if (!state->in_search)
1032 return 1;
1033
1034 if (isalnum(c) || isgraph(c) || c == ' ') {
1035 state->pattern[strlen(state->pattern)] = c;
1036 state->pattern[strlen(state->pattern)] = '\0';
1037 adj_match_dir(&state->match_direction);
1038 *ans = get_mext_match(state->pattern,
1039 state->match_direction);
1040 } else if (key == KEY_DOWN) {
1041 state->match_direction = FIND_NEXT_MATCH_DOWN;
1042 *ans = get_mext_match(state->pattern,
1043 state->match_direction);
1044 } else if (key == KEY_UP) {
1045 state->match_direction = FIND_NEXT_MATCH_UP;
1046 *ans = get_mext_match(state->pattern,
1047 state->match_direction);
1048 } else if (key == KEY_BACKSPACE || key == 127) {
1049 state->pattern[strlen(state->pattern)-1] = '\0';
1050 adj_match_dir(&state->match_direction);
1051 } else
1052 terminate_search = 1;
1053
1054 if (terminate_search) {
1055 state->in_search = 0;
1056 bzero(state->pattern, sizeof(state->pattern));
1057 move(0, 0);
1058 refresh();
1059 clrtoeol();
1060 return -1;
1061 }
1062 return 0;
1063}
1064
1065static void conf(struct menu *menu)
1066{
1106 struct menu *submenu = 0; 1067 struct menu *submenu = 0;
1107 const char *prompt = menu_get_prompt(menu); 1068 const char *prompt = menu_get_prompt(menu);
1108 struct symbol *sym; 1069 struct symbol *sym;
@@ -1110,8 +1071,11 @@ static void conf(struct menu *menu)
1110 int res; 1071 int res;
1111 int current_index = 0; 1072 int current_index = 0;
1112 int last_top_row = 0; 1073 int last_top_row = 0;
1113 1074 struct match_state match_state = {
1114 bzero(pattern, sizeof(pattern)); 1075 .in_search = 0,
1076 .match_direction = MATCH_TINKER_PATTERN_DOWN,
1077 .pattern = "",
1078 };
1115 1079
1116 while (!global_exit) { 1080 while (!global_exit) {
1117 reset_menu(); 1081 reset_menu();
@@ -1124,7 +1088,22 @@ static void conf(struct menu *menu)
1124 _(menu_instructions), 1088 _(menu_instructions),
1125 current_index, &last_top_row); 1089 current_index, &last_top_row);
1126 keypad((menu_win(curses_menu)), TRUE); 1090 keypad((menu_win(curses_menu)), TRUE);
1127 while (!global_exit && (res = wgetch(menu_win(curses_menu)))) { 1091 while (!global_exit) {
1092 if (match_state.in_search) {
1093 mvprintw(0, 0,
1094 "searching: %s", match_state.pattern);
1095 clrtoeol();
1096 }
1097 refresh_all_windows(main_window);
1098 res = wgetch(menu_win(curses_menu));
1099 if (!res)
1100 break;
1101 if (do_match(res, &match_state, &current_index) == 0) {
1102 if (current_index != -1)
1103 center_item(current_index,
1104 &last_top_row);
1105 continue;
1106 }
1128 if (process_special_keys(&res, 1107 if (process_special_keys(&res,
1129 (struct menu *) item_data())) 1108 (struct menu *) item_data()))
1130 break; 1109 break;
@@ -1155,19 +1134,13 @@ static void conf(struct menu *menu)
1155 if (res == 10 || res == 27 || 1134 if (res == 10 || res == 27 ||
1156 res == 32 || res == 'n' || res == 'y' || 1135 res == 32 || res == 'n' || res == 'y' ||
1157 res == KEY_LEFT || res == KEY_RIGHT || 1136 res == KEY_LEFT || res == KEY_RIGHT ||
1158 res == 'm' || res == '/') 1137 res == 'm')
1159 break; 1138 break;
1160 else if (canbhot(res)) {
1161 /* check for hot keys: */
1162 int tmp = get_next_hot(res);
1163 if (tmp != -1)
1164 center_item(tmp, &last_top_row);
1165 }
1166 refresh_all_windows(main_window); 1139 refresh_all_windows(main_window);
1167 } 1140 }
1168 1141
1169 refresh_all_windows(main_window); 1142 refresh_all_windows(main_window);
1170 /* if ESC or left*/ 1143 /* if ESC or left*/
1171 if (res == 27 || (menu != &rootmenu && res == KEY_LEFT)) 1144 if (res == 27 || (menu != &rootmenu && res == KEY_LEFT))
1172 break; 1145 break;
1173 1146
@@ -1235,23 +1208,30 @@ static void conf(struct menu *menu)
1235 if (item_is_tag('t')) 1208 if (item_is_tag('t'))
1236 sym_set_tristate_value(sym, mod); 1209 sym_set_tristate_value(sym, mod);
1237 break; 1210 break;
1238 case '/':
1239 search_conf();
1240 break;
1241 } 1211 }
1242 } 1212 }
1243} 1213}
1244 1214
1215static void conf_message_callback(const char *fmt, va_list ap)
1216{
1217 char buf[1024];
1218
1219 vsnprintf(buf, sizeof(buf), fmt, ap);
1220 btn_dialog(main_window, buf, 1, "<OK>");
1221}
1222
1245static void show_help(struct menu *menu) 1223static void show_help(struct menu *menu)
1246{ 1224{
1247 struct gstr help = str_new(); 1225 struct gstr help = str_new();
1248 1226
1249 if (menu && menu->sym && menu_has_help(menu)) { 1227 if (menu && menu->sym && menu_has_help(menu)) {
1250 if (menu->sym->name) { 1228 if (menu->sym->name) {
1251 str_printf(&help, "CONFIG_%s:\n\n", menu->sym->name); 1229 str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name);
1252 str_append(&help, _(menu_get_help(menu))); 1230 str_append(&help, _(menu_get_help(menu)));
1253 str_append(&help, "\n"); 1231 str_append(&help, "\n");
1254 get_symbol_str(&help, menu->sym); 1232 get_symbol_str(&help, menu->sym);
1233 } else {
1234 str_append(&help, _(menu_get_help(menu)));
1255 } 1235 }
1256 } else { 1236 } else {
1257 str_append(&help, nohelp_text); 1237 str_append(&help, nohelp_text);
@@ -1268,6 +1248,11 @@ static void conf_choice(struct menu *menu)
1268 int selected_index = 0; 1248 int selected_index = 0;
1269 int last_top_row = 0; 1249 int last_top_row = 0;
1270 int res, i = 0; 1250 int res, i = 0;
1251 struct match_state match_state = {
1252 .in_search = 0,
1253 .match_direction = MATCH_TINKER_PATTERN_DOWN,
1254 .pattern = "",
1255 };
1271 1256
1272 active = sym_get_choice_value(menu->sym); 1257 active = sym_get_choice_value(menu->sym);
1273 /* this is mostly duplicated from the conf() function. */ 1258 /* this is mostly duplicated from the conf() function. */
@@ -1294,7 +1279,22 @@ static void conf_choice(struct menu *menu)
1294 _(radiolist_instructions), 1279 _(radiolist_instructions),
1295 selected_index, 1280 selected_index,
1296 &last_top_row); 1281 &last_top_row);
1297 while (!global_exit && (res = wgetch(menu_win(curses_menu)))) { 1282 while (!global_exit) {
1283 if (match_state.in_search) {
1284 mvprintw(0, 0, "searching: %s",
1285 match_state.pattern);
1286 clrtoeol();
1287 }
1288 refresh_all_windows(main_window);
1289 res = wgetch(menu_win(curses_menu));
1290 if (!res)
1291 break;
1292 if (do_match(res, &match_state, &selected_index) == 0) {
1293 if (selected_index != -1)
1294 center_item(selected_index,
1295 &last_top_row);
1296 continue;
1297 }
1298 if (process_special_keys( 1298 if (process_special_keys(
1299 &res, 1299 &res,
1300 (struct menu *) item_data())) 1300 (struct menu *) item_data()))
@@ -1324,13 +1324,8 @@ static void conf_choice(struct menu *menu)
1324 break; 1324 break;
1325 } 1325 }
1326 if (res == 10 || res == 27 || res == ' ' || 1326 if (res == 10 || res == 27 || res == ' ' ||
1327 res == KEY_LEFT) 1327 res == KEY_LEFT){
1328 break; 1328 break;
1329 else if (canbhot(res)) {
1330 /* check for hot keys: */
1331 int tmp = get_next_hot(res);
1332 if (tmp != -1)
1333 center_item(tmp, &last_top_row);
1334 } 1329 }
1335 refresh_all_windows(main_window); 1330 refresh_all_windows(main_window);
1336 } 1331 }
@@ -1449,16 +1444,8 @@ static void conf_save(void)
1449 case 0: 1444 case 0:
1450 if (!dialog_input_result[0]) 1445 if (!dialog_input_result[0])
1451 return; 1446 return;
1452 supress_stdout(0);
1453 res = conf_write(dialog_input_result); 1447 res = conf_write(dialog_input_result);
1454 supress_stdout(1);
1455 if (!res) { 1448 if (!res) {
1456 char buf[1024];
1457 sprintf(buf, "%s %s",
1458 _("configuration file saved to: "),
1459 dialog_input_result);
1460 btn_dialog(main_window,
1461 buf, 1, "<OK>");
1462 set_config_filename(dialog_input_result); 1449 set_config_filename(dialog_input_result);
1463 return; 1450 return;
1464 } 1451 }
@@ -1485,7 +1472,7 @@ void setup_windows(void)
1485 /* set up the menu and menu window */ 1472 /* set up the menu and menu window */
1486 main_window = newwin(LINES-2, COLS-2, 2, 1); 1473 main_window = newwin(LINES-2, COLS-2, 2, 1);
1487 keypad(main_window, TRUE); 1474 keypad(main_window, TRUE);
1488 mwin_max_lines = LINES-6; 1475 mwin_max_lines = LINES-7;
1489 mwin_max_cols = COLS-6; 1476 mwin_max_cols = COLS-6;
1490 1477
1491 /* panels order is from bottom to top */ 1478 /* panels order is from bottom to top */
@@ -1532,9 +1519,10 @@ int main(int ac, char **av)
1532 /* set btns menu */ 1519 /* set btns menu */
1533 curses_menu = new_menu(curses_menu_items); 1520 curses_menu = new_menu(curses_menu_items);
1534 menu_opts_off(curses_menu, O_SHOWDESC); 1521 menu_opts_off(curses_menu, O_SHOWDESC);
1535 menu_opts_off(curses_menu, O_SHOWMATCH); 1522 menu_opts_on(curses_menu, O_SHOWMATCH);
1536 menu_opts_on(curses_menu, O_ONEVALUE); 1523 menu_opts_on(curses_menu, O_ONEVALUE);
1537 menu_opts_on(curses_menu, O_NONCYCLIC); 1524 menu_opts_on(curses_menu, O_NONCYCLIC);
1525 menu_opts_on(curses_menu, O_IGNORECASE);
1538 set_menu_mark(curses_menu, " "); 1526 set_menu_mark(curses_menu, " ");
1539 set_menu_fore(curses_menu, attributes[MAIN_MENU_FORE]); 1527 set_menu_fore(curses_menu, attributes[MAIN_MENU_FORE]);
1540 set_menu_back(curses_menu, attributes[MAIN_MENU_BACK]); 1528 set_menu_back(curses_menu, attributes[MAIN_MENU_BACK]);
@@ -1550,8 +1538,7 @@ int main(int ac, char **av)
1550 _(menu_no_f_instructions)); 1538 _(menu_no_f_instructions));
1551 } 1539 }
1552 1540
1553 1541 conf_set_message_callback(conf_message_callback);
1554
1555 /* do the work */ 1542 /* do the work */
1556 while (!global_exit) { 1543 while (!global_exit) {
1557 conf(&rootmenu); 1544 conf(&rootmenu);
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c
index a9d9344e1365..f8137b3a5382 100644
--- a/scripts/kconfig/nconf.gui.c
+++ b/scripts/kconfig/nconf.gui.c
@@ -137,7 +137,7 @@ void set_colors()
137 if (has_colors()) { 137 if (has_colors()) {
138 normal_color_theme(); 138 normal_color_theme();
139 } else { 139 } else {
140 /* give deafults */ 140 /* give defaults */
141 no_colors_theme(); 141 no_colors_theme();
142 } 142 }
143} 143}
@@ -167,7 +167,7 @@ void print_in_middle(WINDOW *win,
167 length = strlen(string); 167 length = strlen(string);
168 temp = (width - length) / 2; 168 temp = (width - length) / 2;
169 x = startx + (int)temp; 169 x = startx + (int)temp;
170 wattrset(win, color); 170 (void) wattrset(win, color);
171 mvwprintw(win, y, x, "%s", string); 171 mvwprintw(win, y, x, "%s", string);
172 refresh(); 172 refresh();
173} 173}
@@ -297,11 +297,11 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...)
297 set_menu_fore(menu, attributes[DIALOG_MENU_FORE]); 297 set_menu_fore(menu, attributes[DIALOG_MENU_FORE]);
298 set_menu_back(menu, attributes[DIALOG_MENU_BACK]); 298 set_menu_back(menu, attributes[DIALOG_MENU_BACK]);
299 299
300 wattrset(win, attributes[DIALOG_BOX]); 300 (void) wattrset(win, attributes[DIALOG_BOX]);
301 box(win, 0, 0); 301 box(win, 0, 0);
302 302
303 /* print message */ 303 /* print message */
304 wattrset(msg_win, attributes[DIALOG_TEXT]); 304 (void) wattrset(msg_win, attributes[DIALOG_TEXT]);
305 fill_window(msg_win, msg); 305 fill_window(msg_win, msg);
306 306
307 set_menu_win(menu, win); 307 set_menu_win(menu, win);
@@ -392,16 +392,16 @@ int dialog_inputbox(WINDOW *main_window,
392 form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2); 392 form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2);
393 keypad(form_win, TRUE); 393 keypad(form_win, TRUE);
394 394
395 wattrset(form_win, attributes[INPUT_FIELD]); 395 (void) wattrset(form_win, attributes[INPUT_FIELD]);
396 396
397 wattrset(win, attributes[INPUT_BOX]); 397 (void) wattrset(win, attributes[INPUT_BOX]);
398 box(win, 0, 0); 398 box(win, 0, 0);
399 wattrset(win, attributes[INPUT_HEADING]); 399 (void) wattrset(win, attributes[INPUT_HEADING]);
400 if (title) 400 if (title)
401 mvwprintw(win, 0, 3, "%s", title); 401 mvwprintw(win, 0, 3, "%s", title);
402 402
403 /* print message */ 403 /* print message */
404 wattrset(prompt_win, attributes[INPUT_TEXT]); 404 (void) wattrset(prompt_win, attributes[INPUT_TEXT]);
405 fill_window(prompt_win, prompt); 405 fill_window(prompt_win, prompt);
406 406
407 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " "); 407 mvwprintw(form_win, 0, 0, "%*s", prompt_width, " ");
@@ -531,7 +531,7 @@ void show_scroll_win(WINDOW *main_window,
531 531
532 /* create the pad */ 532 /* create the pad */
533 pad = newpad(total_lines+10, total_cols+10); 533 pad = newpad(total_lines+10, total_cols+10);
534 wattrset(pad, attributes[SCROLLWIN_TEXT]); 534 (void) wattrset(pad, attributes[SCROLLWIN_TEXT]);
535 fill_window(pad, text); 535 fill_window(pad, text);
536 536
537 win_lines = min(total_lines+4, LINES-2); 537 win_lines = min(total_lines+4, LINES-2);
@@ -546,9 +546,9 @@ void show_scroll_win(WINDOW *main_window,
546 win = newwin(win_lines, win_cols, y, x); 546 win = newwin(win_lines, win_cols, y, x);
547 keypad(win, TRUE); 547 keypad(win, TRUE);
548 /* show the help in the help window, and show the help panel */ 548 /* show the help in the help window, and show the help panel */
549 wattrset(win, attributes[SCROLLWIN_BOX]); 549 (void) wattrset(win, attributes[SCROLLWIN_BOX]);
550 box(win, 0, 0); 550 box(win, 0, 0);
551 wattrset(win, attributes[SCROLLWIN_HEADING]); 551 (void) wattrset(win, attributes[SCROLLWIN_HEADING]);
552 mvwprintw(win, 0, 3, " %s ", title); 552 mvwprintw(win, 0, 3, " %s ", title);
553 panel = new_panel(win); 553 panel = new_panel(win);
554 554
diff --git a/scripts/kconfig/nconf.h b/scripts/kconfig/nconf.h
index fb4296666004..58fbda8fc0dc 100644
--- a/scripts/kconfig/nconf.h
+++ b/scripts/kconfig/nconf.h
@@ -69,7 +69,8 @@ typedef enum {
69 F_BACK = 5, 69 F_BACK = 5,
70 F_SAVE = 6, 70 F_SAVE = 6,
71 F_LOAD = 7, 71 F_LOAD = 7,
72 F_EXIT = 8 72 F_SEARCH = 8,
73 F_EXIT = 9,
73} function_key; 74} function_key;
74 75
75void set_colors(void); 76void set_colors(void);
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index 820df2d1217b..06dd2e33581d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -3,25 +3,42 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#include <qapplication.h> 6#include <qglobal.h>
7
8#if QT_VERSION < 0x040000
7#include <qmainwindow.h> 9#include <qmainwindow.h>
10#include <qvbox.h>
11#include <qvaluelist.h>
12#include <qtextbrowser.h>
13#include <qaction.h>
14#include <qheader.h>
15#include <qfiledialog.h>
16#include <qdragobject.h>
17#include <qpopupmenu.h>
18#else
19#include <q3mainwindow.h>
20#include <q3vbox.h>
21#include <q3valuelist.h>
22#include <q3textbrowser.h>
23#include <q3action.h>
24#include <q3header.h>
25#include <q3filedialog.h>
26#include <q3dragobject.h>
27#include <q3popupmenu.h>
28#endif
29
30#include <qapplication.h>
8#include <qdesktopwidget.h> 31#include <qdesktopwidget.h>
9#include <qtoolbar.h> 32#include <qtoolbar.h>
10#include <qlayout.h> 33#include <qlayout.h>
11#include <qvbox.h>
12#include <qsplitter.h> 34#include <qsplitter.h>
13#include <qlistview.h>
14#include <qtextbrowser.h>
15#include <qlineedit.h> 35#include <qlineedit.h>
16#include <qlabel.h> 36#include <qlabel.h>
17#include <qpushbutton.h> 37#include <qpushbutton.h>
18#include <qmenubar.h> 38#include <qmenubar.h>
19#include <qmessagebox.h> 39#include <qmessagebox.h>
20#include <qaction.h>
21#include <qheader.h>
22#include <qfiledialog.h>
23#include <qdragobject.h>
24#include <qregexp.h> 40#include <qregexp.h>
41#include <qevent.h>
25 42
26#include <stdlib.h> 43#include <stdlib.h>
27 44
@@ -39,7 +56,7 @@
39static QApplication *configApp; 56static QApplication *configApp;
40static ConfigSettings *configSettings; 57static ConfigSettings *configSettings;
41 58
42QAction *ConfigMainWindow::saveAction; 59Q3Action *ConfigMainWindow::saveAction;
43 60
44static inline QString qgettext(const char* str) 61static inline QString qgettext(const char* str)
45{ 62{
@@ -54,9 +71,9 @@ static inline QString qgettext(const QString& str)
54/** 71/**
55 * Reads a list of integer values from the application settings. 72 * Reads a list of integer values from the application settings.
56 */ 73 */
57QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) 74Q3ValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
58{ 75{
59 QValueList<int> result; 76 Q3ValueList<int> result;
60 QStringList entryList = readListEntry(key, ok); 77 QStringList entryList = readListEntry(key, ok);
61 QStringList::Iterator it; 78 QStringList::Iterator it;
62 79
@@ -69,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok)
69/** 86/**
70 * Writes a list of integer values to the application settings. 87 * Writes a list of integer values to the application settings.
71 */ 88 */
72bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value) 89bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value)
73{ 90{
74 QStringList stringList; 91 QStringList stringList;
75 QValueList<int>::ConstIterator it; 92 Q3ValueList<int>::ConstIterator it;
76 93
77 for (it = value.begin(); it != value.end(); ++it) 94 for (it = value.begin(); it != value.end(); ++it)
78 stringList.push_back(QString::number(*it)); 95 stringList.push_back(QString::number(*it));
@@ -80,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value
80} 97}
81 98
82 99
83#if QT_VERSION >= 300
84/* 100/*
85 * set the new data 101 * set the new data
86 * TODO check the value 102 * TODO check the value
@@ -91,7 +107,6 @@ void ConfigItem::okRename(int col)
91 sym_set_string_value(menu->sym, text(dataColIdx).latin1()); 107 sym_set_string_value(menu->sym, text(dataColIdx).latin1());
92 listView()->updateList(this); 108 listView()->updateList(this);
93} 109}
94#endif
95 110
96/* 111/*
97 * update the displayed of a menu entry 112 * update the displayed of a menu entry
@@ -195,11 +210,9 @@ void ConfigItem::updateMenu(void)
195 210
196 data = sym_get_string_value(sym); 211 data = sym_get_string_value(sym);
197 212
198#if QT_VERSION >= 300
199 int i = list->mapIdx(dataColIdx); 213 int i = list->mapIdx(dataColIdx);
200 if (i >= 0) 214 if (i >= 0)
201 setRenameEnabled(i, TRUE); 215 setRenameEnabled(i, TRUE);
202#endif
203 setText(dataColIdx, data); 216 setText(dataColIdx, data);
204 if (type == S_STRING) 217 if (type == S_STRING)
205 prompt = QString("%1: %2").arg(prompt).arg(data); 218 prompt = QString("%1: %2").arg(prompt).arg(data);
@@ -432,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item)
432 if (!rootEntry) { 445 if (!rootEntry) {
433 if (mode != listMode) 446 if (mode != listMode)
434 goto update; 447 goto update;
435 QListViewItemIterator it(this); 448 Q3ListViewItemIterator it(this);
436 ConfigItem* item; 449 ConfigItem* item;
437 450
438 for (; it.current(); ++it) { 451 for (; it.current(); ++it) {
@@ -527,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item)
527 case S_INT: 540 case S_INT:
528 case S_HEX: 541 case S_HEX:
529 case S_STRING: 542 case S_STRING:
530#if QT_VERSION >= 300
531 if (colMap[dataColIdx] >= 0) 543 if (colMap[dataColIdx] >= 0)
532 item->startRename(colMap[dataColIdx]); 544 item->startRename(colMap[dataColIdx]);
533 else 545 else
534#endif
535 parent()->lineEdit->show(item); 546 parent()->lineEdit->show(item);
536 break; 547 break;
537 } 548 }
@@ -563,7 +574,7 @@ void ConfigList::setParentMenu(void)
563 return; 574 return;
564 setRootMenu(menu_get_parent_menu(rootEntry->parent)); 575 setRootMenu(menu_get_parent_menu(rootEntry->parent));
565 576
566 QListViewItemIterator it(this); 577 Q3ListViewItemIterator it(this);
567 for (; (item = (ConfigItem*)it.current()); it++) { 578 for (; (item = (ConfigItem*)it.current()); it++) {
568 if (item->menu == oldroot) { 579 if (item->menu == oldroot) {
569 setCurrentItem(item); 580 setCurrentItem(item);
@@ -645,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu)
645 656
646void ConfigList::keyPressEvent(QKeyEvent* ev) 657void ConfigList::keyPressEvent(QKeyEvent* ev)
647{ 658{
648 QListViewItem* i = currentItem(); 659 Q3ListViewItem* i = currentItem();
649 ConfigItem* item; 660 ConfigItem* item;
650 struct menu *menu; 661 struct menu *menu;
651 enum prop_type type; 662 enum prop_type type;
@@ -811,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
811{ 822{
812 if (e->y() <= header()->geometry().bottom()) { 823 if (e->y() <= header()->geometry().bottom()) {
813 if (!headerPopup) { 824 if (!headerPopup) {
814 QAction *action; 825 Q3Action *action;
815 826
816 headerPopup = new QPopupMenu(this); 827 headerPopup = new Q3PopupMenu(this);
817 action = new QAction(NULL, _("Show Name"), 0, this); 828 action = new Q3Action(NULL, _("Show Name"), 0, this);
818 action->setToggleAction(TRUE); 829 action->setToggleAction(TRUE);
819 connect(action, SIGNAL(toggled(bool)), 830 connect(action, SIGNAL(toggled(bool)),
820 parent(), SLOT(setShowName(bool))); 831 parent(), SLOT(setShowName(bool)));
@@ -822,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
822 action, SLOT(setOn(bool))); 833 action, SLOT(setOn(bool)));
823 action->setOn(showName); 834 action->setOn(showName);
824 action->addTo(headerPopup); 835 action->addTo(headerPopup);
825 action = new QAction(NULL, _("Show Range"), 0, this); 836 action = new Q3Action(NULL, _("Show Range"), 0, this);
826 action->setToggleAction(TRUE); 837 action->setToggleAction(TRUE);
827 connect(action, SIGNAL(toggled(bool)), 838 connect(action, SIGNAL(toggled(bool)),
828 parent(), SLOT(setShowRange(bool))); 839 parent(), SLOT(setShowRange(bool)));
@@ -830,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e)
830 action, SLOT(setOn(bool))); 841 action, SLOT(setOn(bool)));
831 action->setOn(showRange); 842 action->setOn(showRange);
832 action->addTo(headerPopup); 843 action->addTo(headerPopup);
833 action = new QAction(NULL, _("Show Data"), 0, this); 844 action = new Q3Action(NULL, _("Show Data"), 0, this);
834 action->setToggleAction(TRUE); 845 action->setToggleAction(TRUE);
835 connect(action, SIGNAL(toggled(bool)), 846 connect(action, SIGNAL(toggled(bool)),
836 parent(), SLOT(setShowData(bool))); 847 parent(), SLOT(setShowData(bool)));
@@ -914,7 +925,7 @@ void ConfigView::setShowData(bool b)
914 925
915void ConfigList::setAllOpen(bool open) 926void ConfigList::setAllOpen(bool open)
916{ 927{
917 QListViewItemIterator it(this); 928 Q3ListViewItemIterator it(this);
918 929
919 for (; it.current(); it++) 930 for (; it.current(); it++)
920 it.current()->setOpen(open); 931 it.current()->setOpen(open);
@@ -937,7 +948,7 @@ void ConfigView::updateListAll(void)
937} 948}
938 949
939ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) 950ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name)
940 : Parent(parent, name), sym(0), menu(0) 951 : Parent(parent, name), sym(0), _menu(0)
941{ 952{
942 if (name) { 953 if (name) {
943 configSettings->beginGroup(name); 954 configSettings->beginGroup(name);
@@ -960,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b)
960{ 971{
961 if (_showDebug != b) { 972 if (_showDebug != b) {
962 _showDebug = b; 973 _showDebug = b;
963 if (menu) 974 if (_menu)
964 menuInfo(); 975 menuInfo();
965 else if (sym) 976 else if (sym)
966 symbolInfo(); 977 symbolInfo();
@@ -970,11 +981,11 @@ void ConfigInfoView::setShowDebug(bool b)
970 981
971void ConfigInfoView::setInfo(struct menu *m) 982void ConfigInfoView::setInfo(struct menu *m)
972{ 983{
973 if (menu == m) 984 if (_menu == m)
974 return; 985 return;
975 menu = m; 986 _menu = m;
976 sym = NULL; 987 sym = NULL;
977 if (!menu) 988 if (!_menu)
978 clear(); 989 clear();
979 else 990 else
980 menuInfo(); 991 menuInfo();
@@ -1001,11 +1012,11 @@ void ConfigInfoView::menuInfo(void)
1001 struct symbol* sym; 1012 struct symbol* sym;
1002 QString head, debug, help; 1013 QString head, debug, help;
1003 1014
1004 sym = menu->sym; 1015 sym = _menu->sym;
1005 if (sym) { 1016 if (sym) {
1006 if (menu->prompt) { 1017 if (_menu->prompt) {
1007 head += "<big><b>"; 1018 head += "<big><b>";
1008 head += print_filter(_(menu->prompt->text)); 1019 head += print_filter(_(_menu->prompt->text));
1009 head += "</b></big>"; 1020 head += "</b></big>";
1010 if (sym->name) { 1021 if (sym->name) {
1011 head += " ("; 1022 head += " (";
@@ -1031,23 +1042,23 @@ void ConfigInfoView::menuInfo(void)
1031 debug = debug_info(sym); 1042 debug = debug_info(sym);
1032 1043
1033 struct gstr help_gstr = str_new(); 1044 struct gstr help_gstr = str_new();
1034 menu_get_ext_help(menu, &help_gstr); 1045 menu_get_ext_help(_menu, &help_gstr);
1035 help = print_filter(str_get(&help_gstr)); 1046 help = print_filter(str_get(&help_gstr));
1036 str_free(&help_gstr); 1047 str_free(&help_gstr);
1037 } else if (menu->prompt) { 1048 } else if (_menu->prompt) {
1038 head += "<big><b>"; 1049 head += "<big><b>";
1039 head += print_filter(_(menu->prompt->text)); 1050 head += print_filter(_(_menu->prompt->text));
1040 head += "</b></big><br><br>"; 1051 head += "</b></big><br><br>";
1041 if (showDebug()) { 1052 if (showDebug()) {
1042 if (menu->prompt->visible.expr) { 1053 if (_menu->prompt->visible.expr) {
1043 debug += "&nbsp;&nbsp;dep: "; 1054 debug += "&nbsp;&nbsp;dep: ";
1044 expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); 1055 expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE);
1045 debug += "<br><br>"; 1056 debug += "<br><br>";
1046 } 1057 }
1047 } 1058 }
1048 } 1059 }
1049 if (showDebug()) 1060 if (showDebug())
1050 debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); 1061 debug += QString().sprintf("defined at %s:%d<br><br>", _menu->file->name, _menu->lineno);
1051 1062
1052 setText(head + debug + help); 1063 setText(head + debug + help);
1053} 1064}
@@ -1150,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char
1150 *text += str2; 1161 *text += str2;
1151} 1162}
1152 1163
1153QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) 1164Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos)
1154{ 1165{
1155 QPopupMenu* popup = Parent::createPopupMenu(pos); 1166 Q3PopupMenu* popup = Parent::createPopupMenu(pos);
1156 QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup); 1167 Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup);
1157 action->setToggleAction(TRUE); 1168 action->setToggleAction(TRUE);
1158 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); 1169 connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool)));
1159 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); 1170 connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool)));
@@ -1210,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam
1210 y = configSettings->readNumEntry("/window y", 0, &ok); 1221 y = configSettings->readNumEntry("/window y", 0, &ok);
1211 if (ok) 1222 if (ok)
1212 move(x, y); 1223 move(x, y);
1213 QValueList<int> sizes = configSettings->readSizes("/split", &ok); 1224 Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok);
1214 if (ok) 1225 if (ok)
1215 split->setSizes(sizes); 1226 split->setSizes(sizes);
1216 configSettings->endGroup(); 1227 configSettings->endGroup();
@@ -1263,8 +1274,14 @@ ConfigMainWindow::ConfigMainWindow(void)
1263 char title[256]; 1274 char title[256];
1264 1275
1265 QDesktopWidget *d = configApp->desktop(); 1276 QDesktopWidget *d = configApp->desktop();
1266 snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), 1277 snprintf(title, sizeof(title), "%s%s",
1267 getenv("KERNELVERSION")); 1278 rootmenu.prompt->text,
1279#if QT_VERSION < 0x040000
1280 " (Qt3)"
1281#else
1282 ""
1283#endif
1284 );
1268 setCaption(title); 1285 setCaption(title);
1269 1286
1270 width = configSettings->readNumEntry("/window width", d->width() - 64); 1287 width = configSettings->readNumEntry("/window width", d->width() - 64);
@@ -1297,42 +1314,42 @@ ConfigMainWindow::ConfigMainWindow(void)
1297 configList->setFocus(); 1314 configList->setFocus();
1298 1315
1299 menu = menuBar(); 1316 menu = menuBar();
1300 toolBar = new QToolBar("Tools", this); 1317 toolBar = new Q3ToolBar("Tools", this);
1301 1318
1302 backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); 1319 backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this);
1303 connect(backAction, SIGNAL(activated()), SLOT(goBack())); 1320 connect(backAction, SIGNAL(activated()), SLOT(goBack()));
1304 backAction->setEnabled(FALSE); 1321 backAction->setEnabled(FALSE);
1305 QAction *quitAction = new QAction("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this); 1322 Q3Action *quitAction = new Q3Action("Quit", _("&Quit"), Qt::CTRL + Qt::Key_Q, this);
1306 connect(quitAction, SIGNAL(activated()), SLOT(close())); 1323 connect(quitAction, SIGNAL(activated()), SLOT(close()));
1307 QAction *loadAction = new QAction("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this); 1324 Q3Action *loadAction = new Q3Action("Load", QPixmap(xpm_load), _("&Load"), Qt::CTRL + Qt::Key_L, this);
1308 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); 1325 connect(loadAction, SIGNAL(activated()), SLOT(loadConfig()));
1309 saveAction = new QAction("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this); 1326 saveAction = new Q3Action("Save", QPixmap(xpm_save), _("&Save"), Qt::CTRL + Qt::Key_S, this);
1310 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); 1327 connect(saveAction, SIGNAL(activated()), SLOT(saveConfig()));
1311 conf_set_changed_callback(conf_changed); 1328 conf_set_changed_callback(conf_changed);
1312 // Set saveAction's initial state 1329 // Set saveAction's initial state
1313 conf_changed(); 1330 conf_changed();
1314 QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); 1331 Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this);
1315 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); 1332 connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs()));
1316 QAction *searchAction = new QAction("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this); 1333 Q3Action *searchAction = new Q3Action("Find", _("&Find"), Qt::CTRL + Qt::Key_F, this);
1317 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); 1334 connect(searchAction, SIGNAL(activated()), SLOT(searchConfig()));
1318 QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this); 1335 Q3Action *singleViewAction = new Q3Action("Single View", QPixmap(xpm_single_view), _("Single View"), 0, this);
1319 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); 1336 connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView()));
1320 QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this); 1337 Q3Action *splitViewAction = new Q3Action("Split View", QPixmap(xpm_split_view), _("Split View"), 0, this);
1321 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); 1338 connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView()));
1322 QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this); 1339 Q3Action *fullViewAction = new Q3Action("Full View", QPixmap(xpm_tree_view), _("Full View"), 0, this);
1323 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); 1340 connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView()));
1324 1341
1325 QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this); 1342 Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this);
1326 showNameAction->setToggleAction(TRUE); 1343 showNameAction->setToggleAction(TRUE);
1327 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); 1344 connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool)));
1328 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); 1345 connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool)));
1329 showNameAction->setOn(configView->showName()); 1346 showNameAction->setOn(configView->showName());
1330 QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this); 1347 Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this);
1331 showRangeAction->setToggleAction(TRUE); 1348 showRangeAction->setToggleAction(TRUE);
1332 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); 1349 connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool)));
1333 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); 1350 connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool)));
1334 showRangeAction->setOn(configList->showRange); 1351 showRangeAction->setOn(configList->showRange);
1335 QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this); 1352 Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this);
1336 showDataAction->setToggleAction(TRUE); 1353 showDataAction->setToggleAction(TRUE);
1337 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); 1354 connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool)));
1338 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); 1355 connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool)));
@@ -1345,9 +1362,15 @@ ConfigMainWindow::ConfigMainWindow(void)
1345 connect(optGroup, SIGNAL(selected(QAction *)), menuView, 1362 connect(optGroup, SIGNAL(selected(QAction *)), menuView,
1346 SLOT(setOptionMode(QAction *))); 1363 SLOT(setOptionMode(QAction *)));
1347 1364
1348 configView->showNormalAction = new QAction(NULL, _("Show Normal Options"), 0, optGroup); 1365#if QT_VERSION >= 0x040000
1349 configView->showAllAction = new QAction(NULL, _("Show All Options"), 0, optGroup); 1366 configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup);
1350 configView->showPromptAction = new QAction(NULL, _("Show Prompt Options"), 0, optGroup); 1367 configView->showAllAction = new QAction(_("Show All Options"), optGroup);
1368 configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup);
1369#else
1370 configView->showNormalAction = new QAction(_("Show Normal Options"), 0, optGroup);
1371 configView->showAllAction = new QAction(_("Show All Options"), 0, optGroup);
1372 configView->showPromptAction = new QAction(_("Show Prompt Options"), 0, optGroup);
1373#endif
1351 configView->showNormalAction->setToggleAction(TRUE); 1374 configView->showNormalAction->setToggleAction(TRUE);
1352 configView->showNormalAction->setOn(configList->optMode == normalOpt); 1375 configView->showNormalAction->setOn(configList->optMode == normalOpt);
1353 configView->showAllAction->setToggleAction(TRUE); 1376 configView->showAllAction->setToggleAction(TRUE);
@@ -1355,15 +1378,15 @@ ConfigMainWindow::ConfigMainWindow(void)
1355 configView->showPromptAction->setToggleAction(TRUE); 1378 configView->showPromptAction->setToggleAction(TRUE);
1356 configView->showPromptAction->setOn(configList->optMode == promptOpt); 1379 configView->showPromptAction->setOn(configList->optMode == promptOpt);
1357 1380
1358 QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); 1381 Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this);
1359 showDebugAction->setToggleAction(TRUE); 1382 showDebugAction->setToggleAction(TRUE);
1360 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); 1383 connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool)));
1361 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); 1384 connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool)));
1362 showDebugAction->setOn(helpText->showDebug()); 1385 showDebugAction->setOn(helpText->showDebug());
1363 1386
1364 QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this); 1387 Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this);
1365 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); 1388 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
1366 QAction *showAboutAction = new QAction(NULL, _("About"), 0, this); 1389 Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this);
1367 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); 1390 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
1368 1391
1369 // init tool bar 1392 // init tool bar
@@ -1377,7 +1400,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1377 fullViewAction->addTo(toolBar); 1400 fullViewAction->addTo(toolBar);
1378 1401
1379 // create config menu 1402 // create config menu
1380 QPopupMenu* config = new QPopupMenu(this); 1403 Q3PopupMenu* config = new Q3PopupMenu(this);
1381 menu->insertItem(_("&File"), config); 1404 menu->insertItem(_("&File"), config);
1382 loadAction->addTo(config); 1405 loadAction->addTo(config);
1383 saveAction->addTo(config); 1406 saveAction->addTo(config);
@@ -1386,12 +1409,12 @@ ConfigMainWindow::ConfigMainWindow(void)
1386 quitAction->addTo(config); 1409 quitAction->addTo(config);
1387 1410
1388 // create edit menu 1411 // create edit menu
1389 QPopupMenu* editMenu = new QPopupMenu(this); 1412 Q3PopupMenu* editMenu = new Q3PopupMenu(this);
1390 menu->insertItem(_("&Edit"), editMenu); 1413 menu->insertItem(_("&Edit"), editMenu);
1391 searchAction->addTo(editMenu); 1414 searchAction->addTo(editMenu);
1392 1415
1393 // create options menu 1416 // create options menu
1394 QPopupMenu* optionMenu = new QPopupMenu(this); 1417 Q3PopupMenu* optionMenu = new Q3PopupMenu(this);
1395 menu->insertItem(_("&Option"), optionMenu); 1418 menu->insertItem(_("&Option"), optionMenu);
1396 showNameAction->addTo(optionMenu); 1419 showNameAction->addTo(optionMenu);
1397 showRangeAction->addTo(optionMenu); 1420 showRangeAction->addTo(optionMenu);
@@ -1399,10 +1422,9 @@ ConfigMainWindow::ConfigMainWindow(void)
1399 optionMenu->insertSeparator(); 1422 optionMenu->insertSeparator();
1400 optGroup->addTo(optionMenu); 1423 optGroup->addTo(optionMenu);
1401 optionMenu->insertSeparator(); 1424 optionMenu->insertSeparator();
1402 showDebugAction->addTo(optionMenu);
1403 1425
1404 // create help menu 1426 // create help menu
1405 QPopupMenu* helpMenu = new QPopupMenu(this); 1427 Q3PopupMenu* helpMenu = new Q3PopupMenu(this);
1406 menu->insertSeparator(); 1428 menu->insertSeparator();
1407 menu->insertItem(_("&Help"), helpMenu); 1429 menu->insertItem(_("&Help"), helpMenu);
1408 showIntroAction->addTo(helpMenu); 1430 showIntroAction->addTo(helpMenu);
@@ -1437,7 +1459,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1437 showSplitView(); 1459 showSplitView();
1438 1460
1439 // UI setup done, restore splitter positions 1461 // UI setup done, restore splitter positions
1440 QValueList<int> sizes = configSettings->readSizes("/split1", &ok); 1462 Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok);
1441 if (ok) 1463 if (ok)
1442 split1->setSizes(sizes); 1464 split1->setSizes(sizes);
1443 1465
@@ -1448,7 +1470,7 @@ ConfigMainWindow::ConfigMainWindow(void)
1448 1470
1449void ConfigMainWindow::loadConfig(void) 1471void ConfigMainWindow::loadConfig(void)
1450{ 1472{
1451 QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); 1473 QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this);
1452 if (s.isNull()) 1474 if (s.isNull())
1453 return; 1475 return;
1454 if (conf_read(QFile::encodeName(s))) 1476 if (conf_read(QFile::encodeName(s)))
@@ -1464,7 +1486,7 @@ void ConfigMainWindow::saveConfig(void)
1464 1486
1465void ConfigMainWindow::saveConfigAs(void) 1487void ConfigMainWindow::saveConfigAs(void)
1466{ 1488{
1467 QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); 1489 QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this);
1468 if (s.isNull()) 1490 if (s.isNull())
1469 return; 1491 return;
1470 if (conf_write(QFile::encodeName(s))) 1492 if (conf_write(QFile::encodeName(s)))
@@ -1633,7 +1655,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e)
1633 1655
1634void ConfigMainWindow::showIntro(void) 1656void ConfigMainWindow::showIntro(void)
1635{ 1657{
1636 static const QString str = _("Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" 1658 static const QString str = _("Welcome to the qconf graphical configuration tool.\n\n"
1637 "For each option, a blank box indicates the feature is disabled, a check\n" 1659 "For each option, a blank box indicates the feature is disabled, a check\n"
1638 "indicates it is enabled, and a dot indicates that it is to be compiled\n" 1660 "indicates it is enabled, and a dot indicates that it is to be compiled\n"
1639 "as a module. Clicking on the box will cycle through the three states.\n\n" 1661 "as a module. Clicking on the box will cycle through the three states.\n\n"
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index 636a74b23bf9..91677d900dbd 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -3,26 +3,25 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 */ 4 */
5 5
6#if QT_VERSION < 0x040000
6#include <qlistview.h> 7#include <qlistview.h>
7#if QT_VERSION >= 300
8#include <qsettings.h>
9#else 8#else
10class QSettings { 9#include <q3listview.h>
11public: 10#endif
12 void beginGroup(const QString& group) { } 11#include <qsettings.h>
13 void endGroup(void) { } 12
14 bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const 13#if QT_VERSION < 0x040000
15 { if (ok) *ok = FALSE; return def; } 14#define Q3ValueList QValueList
16 int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const 15#define Q3PopupMenu QPopupMenu
17 { if (ok) *ok = FALSE; return def; } 16#define Q3ListView QListView
18 QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const 17#define Q3ListViewItem QListViewItem
19 { if (ok) *ok = FALSE; return def; } 18#define Q3VBox QVBox
20 QStringList readListEntry(const QString& key, bool* ok = 0) const 19#define Q3TextBrowser QTextBrowser
21 { if (ok) *ok = FALSE; return QStringList(); } 20#define Q3MainWindow QMainWindow
22 template <class t> 21#define Q3Action QAction
23 bool writeEntry(const QString& key, t value) 22#define Q3ToolBar QToolBar
24 { return TRUE; } 23#define Q3ListViewItemIterator QListViewItemIterator
25}; 24#define Q3FileDialog QFileDialog
26#endif 25#endif
27 26
28class ConfigView; 27class ConfigView;
@@ -31,11 +30,10 @@ class ConfigItem;
31class ConfigLineEdit; 30class ConfigLineEdit;
32class ConfigMainWindow; 31class ConfigMainWindow;
33 32
34
35class ConfigSettings : public QSettings { 33class ConfigSettings : public QSettings {
36public: 34public:
37 QValueList<int> readSizes(const QString& key, bool *ok); 35 Q3ValueList<int> readSizes(const QString& key, bool *ok);
38 bool writeSizes(const QString& key, const QValueList<int>& value); 36 bool writeSizes(const QString& key, const Q3ValueList<int>& value);
39}; 37};
40 38
41enum colIdx { 39enum colIdx {
@@ -48,9 +46,9 @@ enum optionMode {
48 normalOpt = 0, allOpt, promptOpt 46 normalOpt = 0, allOpt, promptOpt
49}; 47};
50 48
51class ConfigList : public QListView { 49class ConfigList : public Q3ListView {
52 Q_OBJECT 50 Q_OBJECT
53 typedef class QListView Parent; 51 typedef class Q3ListView Parent;
54public: 52public:
55 ConfigList(ConfigView* p, const char *name = 0); 53 ConfigList(ConfigView* p, const char *name = 0);
56 void reinit(void); 54 void reinit(void);
@@ -135,17 +133,17 @@ public:
135 struct menu *rootEntry; 133 struct menu *rootEntry;
136 QColorGroup disabledColorGroup; 134 QColorGroup disabledColorGroup;
137 QColorGroup inactivedColorGroup; 135 QColorGroup inactivedColorGroup;
138 QPopupMenu* headerPopup; 136 Q3PopupMenu* headerPopup;
139 137
140private: 138private:
141 int colMap[colNr]; 139 int colMap[colNr];
142 int colRevMap[colNr]; 140 int colRevMap[colNr];
143}; 141};
144 142
145class ConfigItem : public QListViewItem { 143class ConfigItem : public Q3ListViewItem {
146 typedef class QListViewItem Parent; 144 typedef class Q3ListViewItem Parent;
147public: 145public:
148 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v) 146 ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v)
149 : Parent(parent, after), menu(m), visible(v), goParent(false) 147 : Parent(parent, after), menu(m), visible(v), goParent(false)
150 { 148 {
151 init(); 149 init();
@@ -155,16 +153,14 @@ public:
155 { 153 {
156 init(); 154 init();
157 } 155 }
158 ConfigItem(QListView *parent, ConfigItem *after, bool v) 156 ConfigItem(Q3ListView *parent, ConfigItem *after, bool v)
159 : Parent(parent, after), menu(0), visible(v), goParent(true) 157 : Parent(parent, after), menu(0), visible(v), goParent(true)
160 { 158 {
161 init(); 159 init();
162 } 160 }
163 ~ConfigItem(void); 161 ~ConfigItem(void);
164 void init(void); 162 void init(void);
165#if QT_VERSION >= 300
166 void okRename(int col); 163 void okRename(int col);
167#endif
168 void updateMenu(void); 164 void updateMenu(void);
169 void testUpdateMenu(bool v); 165 void testUpdateMenu(bool v);
170 ConfigList* listView() const 166 ConfigList* listView() const
@@ -219,9 +215,9 @@ public:
219 ConfigItem *item; 215 ConfigItem *item;
220}; 216};
221 217
222class ConfigView : public QVBox { 218class ConfigView : public Q3VBox {
223 Q_OBJECT 219 Q_OBJECT
224 typedef class QVBox Parent; 220 typedef class Q3VBox Parent;
225public: 221public:
226 ConfigView(QWidget* parent, const char *name = 0); 222 ConfigView(QWidget* parent, const char *name = 0);
227 ~ConfigView(void); 223 ~ConfigView(void);
@@ -252,9 +248,9 @@ public:
252 static QAction *showPromptAction; 248 static QAction *showPromptAction;
253}; 249};
254 250
255class ConfigInfoView : public QTextBrowser { 251class ConfigInfoView : public Q3TextBrowser {
256 Q_OBJECT 252 Q_OBJECT
257 typedef class QTextBrowser Parent; 253 typedef class Q3TextBrowser Parent;
258public: 254public:
259 ConfigInfoView(QWidget* parent, const char *name = 0); 255 ConfigInfoView(QWidget* parent, const char *name = 0);
260 bool showDebug(void) const { return _showDebug; } 256 bool showDebug(void) const { return _showDebug; }
@@ -274,11 +270,11 @@ protected:
274 QString debug_info(struct symbol *sym); 270 QString debug_info(struct symbol *sym);
275 static QString print_filter(const QString &str); 271 static QString print_filter(const QString &str);
276 static void expr_print_help(void *data, struct symbol *sym, const char *str); 272 static void expr_print_help(void *data, struct symbol *sym, const char *str);
277 QPopupMenu* createPopupMenu(const QPoint& pos); 273 Q3PopupMenu* createPopupMenu(const QPoint& pos);
278 void contentsContextMenuEvent(QContextMenuEvent *e); 274 void contentsContextMenuEvent(QContextMenuEvent *e);
279 275
280 struct symbol *sym; 276 struct symbol *sym;
281 struct menu *menu; 277 struct menu *_menu;
282 bool _showDebug; 278 bool _showDebug;
283}; 279};
284 280
@@ -302,10 +298,10 @@ protected:
302 struct symbol **result; 298 struct symbol **result;
303}; 299};
304 300
305class ConfigMainWindow : public QMainWindow { 301class ConfigMainWindow : public Q3MainWindow {
306 Q_OBJECT 302 Q_OBJECT
307 303
308 static QAction *saveAction; 304 static Q3Action *saveAction;
309 static void conf_changed(void); 305 static void conf_changed(void);
310public: 306public:
311 ConfigMainWindow(void); 307 ConfigMainWindow(void);
@@ -334,8 +330,8 @@ protected:
334 ConfigView *configView; 330 ConfigView *configView;
335 ConfigList *configList; 331 ConfigList *configList;
336 ConfigInfoView *helpText; 332 ConfigInfoView *helpText;
337 QToolBar *toolBar; 333 Q3ToolBar *toolBar;
338 QAction *backAction; 334 Q3Action *backAction;
339 QSplitter* split1; 335 QSplitter* split1;
340 QSplitter* split2; 336 QSplitter* split2;
341}; 337};
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 1f8b305449db..c0efe102d655 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -350,7 +350,6 @@ void sym_calc_value(struct symbol *sym)
350 } 350 }
351 } 351 }
352 calc_newval: 352 calc_newval:
353#if 0
354 if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) { 353 if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
355 fprintf(stderr, "warning: ("); 354 fprintf(stderr, "warning: (");
356 expr_fprint(sym->rev_dep.expr, stderr); 355 expr_fprint(sym->rev_dep.expr, stderr);
@@ -359,7 +358,6 @@ void sym_calc_value(struct symbol *sym)
359 expr_fprint(sym->dir_dep.expr, stderr); 358 expr_fprint(sym->dir_dep.expr, stderr);
360 fprintf(stderr, ")\n"); 359 fprintf(stderr, ")\n");
361 } 360 }
362#endif
363 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); 361 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
364 } 362 }
365 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) 363 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
@@ -842,6 +840,55 @@ struct symbol *sym_find(const char *name)
842 return symbol; 840 return symbol;
843} 841}
844 842
843/*
844 * Expand symbol's names embedded in the string given in argument. Symbols'
845 * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
846 * the empty string.
847 */
848const char *sym_expand_string_value(const char *in)
849{
850 const char *src;
851 char *res;
852 size_t reslen;
853
854 reslen = strlen(in) + 1;
855 res = malloc(reslen);
856 res[0] = '\0';
857
858 while ((src = strchr(in, '$'))) {
859 char *p, name[SYMBOL_MAXLENGTH];
860 const char *symval = "";
861 struct symbol *sym;
862 size_t newlen;
863
864 strncat(res, in, src - in);
865 src++;
866
867 p = name;
868 while (isalnum(*src) || *src == '_')
869 *p++ = *src++;
870 *p = '\0';
871
872 sym = sym_find(name);
873 if (sym != NULL) {
874 sym_calc_value(sym);
875 symval = sym_get_string_value(sym);
876 }
877
878 newlen = strlen(res) + strlen(symval) + strlen(src);
879 if (newlen > reslen) {
880 reslen = newlen;
881 res = realloc(res, reslen);
882 }
883
884 strcat(res, symval);
885 in = src;
886 }
887 strcat(res, in);
888
889 return res;
890}
891
845struct symbol **sym_re_search(const char *pattern) 892struct symbol **sym_re_search(const char *pattern)
846{ 893{
847 struct symbol *sym, **sym_arr = NULL; 894 struct symbol *sym, **sym_arr = NULL;
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c
index 78b5c04e736b..6330cc871a47 100644
--- a/scripts/kconfig/util.c
+++ b/scripts/kconfig/util.c
@@ -12,15 +12,18 @@
12struct file *file_lookup(const char *name) 12struct file *file_lookup(const char *name)
13{ 13{
14 struct file *file; 14 struct file *file;
15 const char *file_name = sym_expand_string_value(name);
15 16
16 for (file = file_list; file; file = file->next) { 17 for (file = file_list; file; file = file->next) {
17 if (!strcmp(name, file->name)) 18 if (!strcmp(name, file->name)) {
19 free((void *)file_name);
18 return file; 20 return file;
21 }
19 } 22 }
20 23
21 file = malloc(sizeof(*file)); 24 file = malloc(sizeof(*file));
22 memset(file, 0, sizeof(*file)); 25 memset(file, 0, sizeof(*file));
23 file->name = strdup(name); 26 file->name = file_name;
24 file->next = file_list; 27 file->next = file_list;
25 file_list = file; 28 file_list = file;
26 return file; 29 return file;
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index d8f7236cb0a3..3dbaec185cc4 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -304,9 +304,10 @@ void zconf_nextfile(const char *name)
304 memset(buf, 0, sizeof(*buf)); 304 memset(buf, 0, sizeof(*buf));
305 305
306 current_buf->state = YY_CURRENT_BUFFER; 306 current_buf->state = YY_CURRENT_BUFFER;
307 yyin = zconf_fopen(name); 307 yyin = zconf_fopen(file->name);
308 if (!yyin) { 308 if (!yyin) {
309 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); 309 printf("%s:%d: can't open file \"%s\"\n",
310 zconf_curname(), zconf_lineno(), file->name);
310 exit(1); 311 exit(1);
311 } 312 }
312 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); 313 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
@@ -353,7 +354,7 @@ int zconf_lineno(void)
353 return current_pos.lineno; 354 return current_pos.lineno;
354} 355}
355 356
356char *zconf_curname(void) 357const char *zconf_curname(void)
357{ 358{
358 return current_pos.file ? current_pos.file->name : "<none>"; 359 return current_pos.file ? current_pos.file->name : "<none>";
359} 360}
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped
index 32a9eefd842c..699d4b265186 100644
--- a/scripts/kconfig/zconf.tab.c_shipped
+++ b/scripts/kconfig/zconf.tab.c_shipped
@@ -417,18 +417,18 @@ union yyalloc
417#endif 417#endif
418 418
419/* YYFINAL -- State number of the termination state. */ 419/* YYFINAL -- State number of the termination state. */
420#define YYFINAL 3 420#define YYFINAL 11
421/* YYLAST -- Last index in YYTABLE. */ 421/* YYLAST -- Last index in YYTABLE. */
422#define YYLAST 259 422#define YYLAST 277
423 423
424/* YYNTOKENS -- Number of terminals. */ 424/* YYNTOKENS -- Number of terminals. */
425#define YYNTOKENS 35 425#define YYNTOKENS 35
426/* YYNNTS -- Number of nonterminals. */ 426/* YYNNTS -- Number of nonterminals. */
427#define YYNNTS 46 427#define YYNNTS 48
428/* YYNRULES -- Number of rules. */ 428/* YYNRULES -- Number of rules. */
429#define YYNRULES 110 429#define YYNRULES 113
430/* YYNRULES -- Number of states. */ 430/* YYNRULES -- Number of states. */
431#define YYNSTATES 180 431#define YYNSTATES 185
432 432
433/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ 433/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
434#define YYUNDEFTOK 2 434#define YYUNDEFTOK 2
@@ -476,73 +476,74 @@ static const yytype_uint8 yytranslate[] =
476 YYRHS. */ 476 YYRHS. */
477static const yytype_uint16 yyprhs[] = 477static const yytype_uint16 yyprhs[] =
478{ 478{
479 0, 0, 3, 5, 6, 9, 12, 15, 20, 23, 479 0, 0, 3, 6, 8, 11, 13, 14, 17, 20,
480 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, 480 23, 26, 31, 36, 40, 42, 44, 46, 48, 50,
481 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, 481 52, 54, 56, 58, 60, 62, 64, 66, 70, 73,
482 81, 84, 85, 88, 91, 94, 97, 100, 103, 107, 482 77, 80, 84, 87, 88, 91, 94, 97, 100, 103,
483 112, 117, 122, 128, 132, 133, 137, 138, 141, 145, 483 106, 110, 115, 120, 125, 131, 135, 136, 140, 141,
484 148, 150, 154, 155, 158, 161, 164, 167, 170, 175, 484 144, 148, 151, 153, 157, 158, 161, 164, 167, 170,
485 179, 182, 187, 188, 191, 195, 197, 201, 202, 205, 485 173, 178, 182, 185, 190, 191, 194, 198, 200, 204,
486 208, 211, 215, 218, 220, 224, 225, 228, 231, 234, 486 205, 208, 211, 214, 218, 222, 225, 227, 231, 232,
487 238, 242, 245, 248, 251, 252, 255, 258, 261, 266, 487 235, 238, 241, 245, 249, 252, 255, 258, 259, 262,
488 267, 270, 272, 274, 277, 280, 283, 285, 288, 289, 488 265, 268, 273, 274, 277, 279, 281, 284, 287, 290,
489 292, 294, 298, 302, 306, 309, 313, 317, 319, 321, 489 292, 295, 296, 299, 301, 305, 309, 313, 316, 320,
490 322 490 324, 326, 328, 329
491}; 491};
492 492
493/* YYRHS -- A `-1'-separated list of the rules' RHS. */ 493/* YYRHS -- A `-1'-separated list of the rules' RHS. */
494static const yytype_int8 yyrhs[] = 494static const yytype_int8 yyrhs[] =
495{ 495{
496 36, 0, -1, 37, -1, -1, 37, 39, -1, 37, 496 36, 0, -1, 78, 37, -1, 37, -1, 62, 38,
497 53, -1, 37, 64, -1, 37, 3, 74, 76, -1, 497 -1, 38, -1, -1, 38, 40, -1, 38, 54, -1,
498 37, 75, -1, 37, 25, 1, 30, -1, 37, 38, 498 38, 66, -1, 38, 77, -1, 38, 25, 1, 30,
499 1, 30, -1, 37, 1, 30, -1, 16, -1, 18, 499 -1, 38, 39, 1, 30, -1, 38, 1, 30, -1,
500 -1, 19, -1, 21, -1, 17, -1, 22, -1, 20, 500 16, -1, 18, -1, 19, -1, 21, -1, 17, -1,
501 -1, 30, -1, 59, -1, 68, -1, 42, -1, 44, 501 22, -1, 20, -1, 30, -1, 60, -1, 70, -1,
502 -1, 66, -1, 25, 1, 30, -1, 1, 30, -1, 502 43, -1, 45, -1, 68, -1, 25, 1, 30, -1,
503 10, 25, 30, -1, 41, 45, -1, 11, 25, 30, 503 1, 30, -1, 10, 25, 30, -1, 42, 46, -1,
504 -1, 43, 45, -1, -1, 45, 46, -1, 45, 47, 504 11, 25, 30, -1, 44, 46, -1, -1, 46, 47,
505 -1, 45, 72, -1, 45, 70, -1, 45, 40, -1, 505 -1, 46, 48, -1, 46, 74, -1, 46, 72, -1,
506 45, 30, -1, 19, 73, 30, -1, 18, 74, 77, 506 46, 41, -1, 46, 30, -1, 19, 75, 30, -1,
507 30, -1, 20, 78, 77, 30, -1, 21, 25, 77, 507 18, 76, 79, 30, -1, 20, 80, 79, 30, -1,
508 30, -1, 22, 79, 79, 77, 30, -1, 23, 48, 508 21, 25, 79, 30, -1, 22, 81, 81, 79, 30,
509 30, -1, -1, 48, 25, 49, -1, -1, 33, 74, 509 -1, 23, 49, 30, -1, -1, 49, 25, 50, -1,
510 -1, 7, 80, 30, -1, 50, 54, -1, 75, -1, 510 -1, 33, 76, -1, 7, 82, 30, -1, 51, 55,
511 51, 56, 52, -1, -1, 54, 55, -1, 54, 72, 511 -1, 77, -1, 52, 57, 53, -1, -1, 55, 56,
512 -1, 54, 70, -1, 54, 30, -1, 54, 40, -1, 512 -1, 55, 74, -1, 55, 72, -1, 55, 30, -1,
513 18, 74, 77, 30, -1, 19, 73, 30, -1, 17, 513 55, 41, -1, 18, 76, 79, 30, -1, 19, 75,
514 30, -1, 20, 25, 77, 30, -1, -1, 56, 39, 514 30, -1, 17, 30, -1, 20, 25, 79, 30, -1,
515 -1, 14, 78, 76, -1, 75, -1, 57, 60, 58, 515 -1, 57, 40, -1, 14, 80, 78, -1, 77, -1,
516 -1, -1, 60, 39, -1, 60, 64, -1, 60, 53, 516 58, 61, 59, -1, -1, 61, 40, -1, 61, 66,
517 -1, 4, 74, 30, -1, 61, 71, -1, 75, -1, 517 -1, 61, 54, -1, 3, 76, 78, -1, 4, 76,
518 62, 65, 63, -1, -1, 65, 39, -1, 65, 64, 518 30, -1, 63, 73, -1, 77, -1, 64, 67, 65,
519 -1, 65, 53, -1, 6, 74, 30, -1, 9, 74, 519 -1, -1, 67, 40, -1, 67, 66, -1, 67, 54,
520 30, -1, 67, 71, -1, 12, 30, -1, 69, 13, 520 -1, 6, 76, 30, -1, 9, 76, 30, -1, 69,
521 -1, -1, 71, 72, -1, 71, 30, -1, 71, 40, 521 73, -1, 12, 30, -1, 71, 13, -1, -1, 73,
522 -1, 16, 24, 78, 30, -1, -1, 74, 77, -1, 522 74, -1, 73, 30, -1, 73, 41, -1, 16, 24,
523 25, -1, 26, -1, 5, 30, -1, 8, 30, -1, 523 80, 30, -1, -1, 76, 79, -1, 25, -1, 26,
524 15, 30, -1, 30, -1, 76, 30, -1, -1, 14, 524 -1, 5, 30, -1, 8, 30, -1, 15, 30, -1,
525 78, -1, 79, -1, 79, 33, 79, -1, 79, 27, 525 30, -1, 78, 30, -1, -1, 14, 80, -1, 81,
526 79, -1, 29, 78, 28, -1, 34, 78, -1, 78, 526 -1, 81, 33, 81, -1, 81, 27, 81, -1, 29,
527 31, 78, -1, 78, 32, 78, -1, 25, -1, 26, 527 80, 28, -1, 34, 80, -1, 80, 31, 80, -1,
528 -1, -1, 25, -1 528 80, 32, 80, -1, 25, -1, 26, -1, -1, 25,
529 -1
529}; 530};
530 531
531/* YYRLINE[YYN] -- source line where rule number YYN was defined. */ 532/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
532static const yytype_uint16 yyrline[] = 533static const yytype_uint16 yyrline[] =
533{ 534{
534 0, 107, 107, 109, 111, 112, 113, 114, 115, 116, 535 0, 107, 107, 107, 109, 109, 111, 113, 114, 115,
535 117, 121, 125, 125, 125, 125, 125, 125, 125, 129, 536 116, 117, 118, 122, 126, 126, 126, 126, 126, 126,
536 130, 131, 132, 133, 134, 138, 139, 145, 153, 159, 537 126, 130, 131, 132, 133, 134, 135, 139, 140, 146,
537 167, 177, 179, 180, 181, 182, 183, 184, 187, 195, 538 154, 160, 168, 178, 180, 181, 182, 183, 184, 185,
538 201, 211, 217, 223, 226, 228, 239, 240, 245, 254, 539 188, 196, 202, 212, 218, 224, 227, 229, 240, 241,
539 259, 267, 270, 272, 273, 274, 275, 276, 279, 285, 540 246, 255, 260, 268, 271, 273, 274, 275, 276, 277,
540 296, 302, 312, 314, 319, 327, 335, 338, 340, 341, 541 280, 286, 297, 303, 313, 315, 320, 328, 336, 339,
541 342, 347, 354, 359, 367, 370, 372, 373, 374, 377, 542 341, 342, 343, 348, 355, 362, 367, 375, 378, 380,
542 385, 392, 399, 405, 412, 414, 415, 416, 419, 427, 543 381, 382, 385, 393, 400, 407, 413, 420, 422, 423,
543 429, 434, 435, 438, 439, 440, 444, 445, 448, 449, 544 424, 427, 435, 437, 442, 443, 446, 447, 448, 452,
544 452, 453, 454, 455, 456, 457, 458, 461, 462, 465, 545 453, 456, 457, 460, 461, 462, 463, 464, 465, 466,
545 466 546 469, 470, 473, 474
546}; 547};
547#endif 548#endif
548 549
@@ -557,17 +558,17 @@ static const char *const yytname[] =
557 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", 558 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE",
558 "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", 559 "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
559 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", 560 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
560 "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt", 561 "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
561 "option_error", "config_entry_start", "config_stmt", 562 "common_stmt", "option_error", "config_entry_start", "config_stmt",
562 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", 563 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
563 "config_option", "symbol_option", "symbol_option_list", 564 "config_option", "symbol_option", "symbol_option_list",
564 "symbol_option_arg", "choice", "choice_entry", "choice_end", 565 "symbol_option_arg", "choice", "choice_entry", "choice_end",
565 "choice_stmt", "choice_option_list", "choice_option", "choice_block", 566 "choice_stmt", "choice_option_list", "choice_option", "choice_block",
566 "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry", 567 "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu",
567 "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment", 568 "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
568 "comment_stmt", "help_start", "help", "depends_list", "depends", 569 "comment", "comment_stmt", "help_start", "help", "depends_list",
569 "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol", 570 "depends", "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr",
570 "word_opt", 0 571 "symbol", "word_opt", 0
571}; 572};
572#endif 573#endif
573 574
@@ -586,35 +587,35 @@ static const yytype_uint16 yytoknum[] =
586/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ 587/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
587static const yytype_uint8 yyr1[] = 588static const yytype_uint8 yyr1[] =
588{ 589{
589 0, 35, 36, 37, 37, 37, 37, 37, 37, 37, 590 0, 35, 36, 36, 37, 37, 38, 38, 38, 38,
590 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, 591 38, 38, 38, 38, 39, 39, 39, 39, 39, 39,
591 39, 39, 39, 39, 39, 40, 40, 41, 42, 43, 592 39, 40, 40, 40, 40, 40, 40, 41, 41, 42,
592 44, 45, 45, 45, 45, 45, 45, 45, 46, 46, 593 43, 44, 45, 46, 46, 46, 46, 46, 46, 46,
593 46, 46, 46, 47, 48, 48, 49, 49, 50, 51, 594 47, 47, 47, 47, 47, 48, 49, 49, 50, 50,
594 52, 53, 54, 54, 54, 54, 54, 54, 55, 55, 595 51, 52, 53, 54, 55, 55, 55, 55, 55, 55,
595 55, 55, 56, 56, 57, 58, 59, 60, 60, 60, 596 56, 56, 56, 56, 57, 57, 58, 59, 60, 61,
596 60, 61, 62, 63, 64, 65, 65, 65, 65, 66, 597 61, 61, 61, 62, 63, 64, 65, 66, 67, 67,
597 67, 68, 69, 70, 71, 71, 71, 71, 72, 73, 598 67, 67, 68, 69, 70, 71, 72, 73, 73, 73,
598 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, 599 73, 74, 75, 75, 76, 76, 77, 77, 77, 78,
599 78, 78, 78, 78, 78, 78, 78, 79, 79, 80, 600 78, 79, 79, 80, 80, 80, 80, 80, 80, 80,
600 80 601 81, 81, 82, 82
601}; 602};
602 603
603/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ 604/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
604static const yytype_uint8 yyr2[] = 605static const yytype_uint8 yyr2[] =
605{ 606{
606 0, 2, 1, 0, 2, 2, 2, 4, 2, 4, 607 0, 2, 2, 1, 2, 1, 0, 2, 2, 2,
607 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, 608 2, 4, 4, 3, 1, 1, 1, 1, 1, 1,
608 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, 609 1, 1, 1, 1, 1, 1, 1, 3, 2, 3,
609 2, 0, 2, 2, 2, 2, 2, 2, 3, 4, 610 2, 3, 2, 0, 2, 2, 2, 2, 2, 2,
610 4, 4, 5, 3, 0, 3, 0, 2, 3, 2, 611 3, 4, 4, 4, 5, 3, 0, 3, 0, 2,
611 1, 3, 0, 2, 2, 2, 2, 2, 4, 3, 612 3, 2, 1, 3, 0, 2, 2, 2, 2, 2,
612 2, 4, 0, 2, 3, 1, 3, 0, 2, 2, 613 4, 3, 2, 4, 0, 2, 3, 1, 3, 0,
613 2, 3, 2, 1, 3, 0, 2, 2, 2, 3, 614 2, 2, 2, 3, 3, 2, 1, 3, 0, 2,
614 3, 2, 2, 2, 0, 2, 2, 2, 4, 0, 615 2, 2, 3, 3, 2, 2, 2, 0, 2, 2,
615 2, 1, 1, 2, 2, 2, 1, 2, 0, 2, 616 2, 4, 0, 2, 1, 1, 2, 2, 2, 1,
616 1, 3, 3, 3, 2, 3, 3, 1, 1, 0, 617 2, 0, 2, 1, 3, 3, 3, 2, 3, 3,
617 1 618 1, 1, 0, 1
618}; 619};
619 620
620/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state 621/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -622,158 +623,165 @@ static const yytype_uint8 yyr2[] =
622 means the default is an error. */ 623 means the default is an error. */
623static const yytype_uint8 yydefact[] = 624static const yytype_uint8 yydefact[] =
624{ 625{
625 3, 0, 0, 1, 0, 0, 0, 0, 0, 109, 626 6, 0, 99, 0, 3, 0, 6, 6, 94, 95,
626 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, 627 0, 1, 0, 0, 0, 0, 112, 0, 0, 0,
627 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, 628 0, 0, 0, 14, 18, 15, 16, 20, 17, 19,
628 23, 52, 62, 5, 67, 20, 84, 75, 6, 24, 629 0, 21, 0, 7, 33, 24, 33, 25, 54, 64,
629 84, 21, 8, 11, 91, 92, 0, 0, 93, 0, 630 8, 69, 22, 87, 78, 9, 26, 87, 23, 10,
630 110, 0, 94, 0, 0, 0, 107, 108, 0, 0, 631 0, 100, 2, 73, 13, 0, 96, 0, 113, 0,
631 0, 100, 95, 0, 0, 0, 0, 0, 0, 0, 632 97, 0, 0, 0, 110, 111, 0, 0, 0, 103,
632 0, 0, 0, 96, 7, 71, 79, 48, 80, 27, 633 98, 0, 0, 0, 0, 0, 0, 0, 0, 0,
633 29, 0, 104, 0, 0, 64, 0, 0, 9, 10, 634 0, 74, 82, 50, 83, 29, 31, 0, 107, 0,
634 0, 0, 0, 0, 89, 0, 0, 0, 44, 0, 635 0, 66, 0, 0, 11, 12, 0, 0, 0, 0,
635 37, 36, 32, 33, 0, 35, 34, 0, 0, 89, 636 92, 0, 0, 0, 46, 0, 39, 38, 34, 35,
636 0, 56, 57, 53, 55, 54, 63, 51, 50, 68, 637 0, 37, 36, 0, 0, 92, 0, 58, 59, 55,
637 70, 66, 69, 65, 86, 87, 85, 76, 78, 74, 638 57, 56, 65, 53, 52, 70, 72, 68, 71, 67,
638 77, 73, 97, 103, 105, 106, 102, 101, 26, 82, 639 89, 90, 88, 79, 81, 77, 80, 76, 106, 108,
639 0, 98, 0, 98, 98, 98, 0, 0, 0, 83, 640 109, 105, 104, 28, 85, 0, 101, 0, 101, 101,
640 60, 98, 0, 98, 0, 0, 0, 38, 90, 0, 641 101, 0, 0, 0, 86, 62, 101, 0, 101, 0,
641 0, 98, 46, 43, 25, 0, 59, 0, 88, 99, 642 0, 0, 40, 93, 0, 0, 101, 48, 45, 27,
642 39, 40, 41, 0, 0, 45, 58, 61, 42, 47 643 0, 61, 0, 91, 102, 41, 42, 43, 0, 0,
644 47, 60, 63, 44, 49
643}; 645};
644 646
645/* YYDEFGOTO[NTERM-NUM]. */ 647/* YYDEFGOTO[NTERM-NUM]. */
646static const yytype_int16 yydefgoto[] = 648static const yytype_int16 yydefgoto[] =
647{ 649{
648 -1, 1, 2, 25, 26, 101, 27, 28, 29, 30, 650 -1, 3, 4, 5, 32, 33, 107, 34, 35, 36,
649 65, 102, 103, 147, 175, 31, 32, 117, 33, 67, 651 37, 73, 108, 109, 152, 180, 38, 39, 123, 40,
650 113, 68, 34, 121, 35, 69, 36, 37, 129, 38, 652 75, 119, 76, 41, 127, 42, 77, 6, 43, 44,
651 71, 39, 40, 41, 104, 105, 70, 106, 142, 143, 653 135, 45, 79, 46, 47, 48, 110, 111, 78, 112,
652 42, 74, 156, 60, 61, 51 654 147, 148, 49, 7, 161, 68, 69, 59
653}; 655};
654 656
655/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing 657/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
656 STATE-NUM. */ 658 STATE-NUM. */
657#define YYPACT_NINF -80 659#define YYPACT_NINF -89
658static const yytype_int16 yypact[] = 660static const yytype_int16 yypact[] =
659{ 661{
660 -80, 2, 132, -80, -13, -1, -1, -2, -1, 9, 662 3, 4, -89, 20, -89, 100, -89, 7, -89, -89,
661 33, -1, 27, 40, -3, 38, -80, -80, -80, -80, 663 -8, -89, 17, 4, 28, 4, 37, 36, 4, 68,
662 -80, -80, -80, 71, -80, 77, -80, -80, -80, -80, 664 87, -18, 69, -89, -89, -89, -89, -89, -89, -89,
663 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 665 128, -89, 138, -89, -89, -89, -89, -89, -89, -89,
664 -80, -80, -80, -80, -80, -80, 57, 61, -80, 63, 666 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89,
665 -80, 76, -80, 87, 101, 133, -80, -80, -3, -3, 667 127, -89, -89, 110, -89, 126, -89, 136, -89, 137,
666 195, -6, -80, 136, 149, 39, 104, 65, 150, 5, 668 -89, 147, 150, 152, -89, -89, -18, -18, 171, -14,
667 194, 5, 167, -80, 176, -80, -80, -80, -80, -80, 669 -89, 153, 157, 34, 67, 180, 233, 220, 207, 220,
668 -80, 68, -80, -3, -3, 176, 72, 72, -80, -80, 670 154, -89, -89, -89, -89, -89, -89, 0, -89, -18,
669 177, 187, 78, -1, -1, -3, 196, 72, -80, 222, 671 -18, 110, 44, 44, -89, -89, 163, 174, 182, 4,
670 -80, -80, -80, -80, 221, -80, -80, 205, -1, -1, 672 4, -18, 194, 44, -89, 219, -89, -89, -89, -89,
671 211, -80, -80, -80, -80, -80, -80, -80, -80, -80, 673 223, -89, -89, 203, 4, 4, 215, -89, -89, -89,
672 -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, 674 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89,
673 -80, -80, -80, -80, 206, -80, -80, -80, -80, -80, 675 -89, -89, -89, -89, -89, -89, -89, -89, -89, 213,
674 -3, 223, 209, 223, 197, 223, 72, 7, 210, -80, 676 -89, -89, -89, -89, -89, -18, 232, 227, 232, -5,
675 -80, 223, 212, 223, 201, -3, 213, -80, -80, 214, 677 232, 44, 35, 234, -89, -89, 232, 235, 232, 224,
676 215, 223, 208, -80, -80, 216, -80, 217, -80, 113, 678 -18, 236, -89, -89, 237, 238, 232, 216, -89, -89,
677 -80, -80, -80, 218, -1, -80, -80, -80, -80, -80 679 240, -89, 241, -89, 71, -89, -89, -89, 242, 4,
680 -89, -89, -89, -89, -89
678}; 681};
679 682
680/* YYPGOTO[NTERM-NUM]. */ 683/* YYPGOTO[NTERM-NUM]. */
681static const yytype_int16 yypgoto[] = 684static const yytype_int16 yypgoto[] =
682{ 685{
683 -80, -80, -80, -80, 122, -34, -80, -80, -80, -80, 686 -89, -89, 255, 267, -89, 47, -57, -89, -89, -89,
684 220, -80, -80, -80, -80, -80, -80, -80, 59, -80, 687 -89, 239, -89, -89, -89, -89, -89, -89, -89, 130,
685 -80, -80, -80, -80, -80, -80, -80, -80, -80, 125, 688 -89, -89, -89, -89, -89, -89, -89, -89, -89, -89,
686 -80, -80, -80, -80, -80, 183, 219, 22, 142, -5, 689 -89, 181, -89, -89, -89, -89, -89, 199, 229, 16,
687 147, 192, 69, -54, -79, -80 690 162, -1, 74, -7, 103, -65, -88, -89
688}; 691};
689 692
690/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If 693/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
691 positive, shift that token. If negative, reduce the rule which 694 positive, shift that token. If negative, reduce the rule which
692 number is the opposite. If zero, do what YYDEFACT says. 695 number is the opposite. If zero, do what YYDEFACT says.
693 If YYTABLE_NINF, syntax error. */ 696 If YYTABLE_NINF, syntax error. */
694#define YYTABLE_NINF -82 697#define YYTABLE_NINF -85
695static const yytype_int16 yytable[] = 698static const yytype_int16 yytable[] =
696{ 699{
697 46, 47, 3, 49, 81, 82, 53, 136, 137, 6, 700 10, 87, 88, 53, 141, 142, 1, 64, 65, 160,
698 7, 8, 9, 10, 11, 12, 13, 43, 146, 14, 701 1, 66, 55, 92, 57, 151, 67, 61, 118, 93,
699 15, 86, 56, 57, 44, 45, 58, 87, 48, 134, 702 11, 131, 2, 131, 139, 140, 89, 90, 138, 8,
700 135, 59, 162, 112, 50, 24, 125, 163, 125, -28, 703 9, 89, 90, 2, -30, 96, 149, 51, -30, -30,
701 90, 144, -28, -28, -28, -28, -28, -28, -28, -28, 704 -30, -30, -30, -30, -30, -30, 97, 54, -30, -30,
702 -28, 91, 54, -28, -28, 92, -28, 93, 94, 95, 705 98, -30, 99, 100, 101, 102, 103, 104, 56, 105,
703 96, 97, 98, 52, 99, 55, 90, 161, 62, 100, 706 167, 91, 58, 166, 106, 168, 60, -32, 96, 64,
704 -49, -49, 63, -49, -49, -49, -49, 91, 64, -49, 707 65, -32, -32, -32, -32, -32, -32, -32, -32, 97,
705 -49, 92, 107, 108, 109, 110, 154, 73, 141, 115, 708 159, -32, -32, 98, -32, 99, 100, 101, 102, 103,
706 99, 75, 126, 76, 126, 111, 133, 56, 57, 83, 709 104, 121, 105, 62, 132, 174, 132, 106, 146, 70,
707 84, 169, 140, 151, -30, 90, 77, -30, -30, -30, 710 -5, 12, 89, 90, 13, 14, 15, 16, 17, 18,
708 -30, -30, -30, -30, -30, -30, 91, 78, -30, -30, 711 19, 20, 63, 156, 21, 22, 23, 24, 25, 26,
709 92, -30, 93, 94, 95, 96, 97, 98, 120, 99, 712 27, 28, 29, 122, 125, 30, 133, -4, 12, 71,
710 128, 79, -2, 4, 100, 5, 6, 7, 8, 9, 713 31, 13, 14, 15, 16, 17, 18, 19, 20, 72,
711 10, 11, 12, 13, 83, 84, 14, 15, 16, 17, 714 51, 21, 22, 23, 24, 25, 26, 27, 28, 29,
712 18, 19, 20, 21, 22, 7, 8, 23, 10, 11, 715 124, 129, 30, 137, -84, 96, 81, 31, -84, -84,
713 12, 13, 24, 80, 14, 15, 88, -81, 90, 179, 716 -84, -84, -84, -84, -84, -84, 82, 83, -84, -84,
714 -81, -81, -81, -81, -81, -81, -81, -81, -81, 89, 717 98, -84, -84, -84, -84, -84, -84, 84, 184, 105,
715 24, -81, -81, 92, -81, -81, -81, -81, -81, -81, 718 85, 96, 86, 94, 130, -51, -51, 95, -51, -51,
716 116, 119, 99, 127, 122, 90, 130, 124, -72, -72, 719 -51, -51, 97, 143, -51, -51, 98, 113, 114, 115,
717 -72, -72, -72, -72, -72, -72, 132, 138, -72, -72, 720 116, 2, 89, 90, 144, 105, 145, 126, 96, 134,
718 92, 155, 158, 159, 160, 118, 123, 139, 131, 99, 721 117, -75, -75, -75, -75, -75, -75, -75, -75, 150,
719 165, 145, 167, 148, 124, 73, 83, 84, 83, 84, 722 153, -75, -75, 98, 13, 14, 15, 16, 17, 18,
720 173, 168, 83, 84, 149, 150, 153, 155, 84, 157, 723 19, 20, 105, 155, 21, 22, 154, 130, 14, 15,
721 164, 174, 166, 170, 171, 172, 176, 177, 178, 66, 724 158, 17, 18, 19, 20, 90, 160, 21, 22, 179,
722 114, 152, 85, 0, 0, 0, 0, 0, 0, 72 725 31, 163, 164, 165, 173, 89, 90, 162, 128, 170,
726 136, 172, 52, 31, 169, 171, 175, 176, 177, 178,
727 181, 182, 183, 50, 120, 74, 80, 157
723}; 728};
724 729
725static const yytype_int16 yycheck[] = 730static const yytype_uint8 yycheck[] =
726{ 731{
727 5, 6, 0, 8, 58, 59, 11, 86, 87, 4, 732 1, 66, 67, 10, 92, 93, 3, 25, 26, 14,
728 5, 6, 7, 8, 9, 10, 11, 30, 97, 14, 733 3, 29, 13, 27, 15, 103, 34, 18, 75, 33,
729 15, 27, 25, 26, 25, 26, 29, 33, 30, 83, 734 0, 78, 30, 80, 89, 90, 31, 32, 28, 25,
730 84, 34, 25, 67, 25, 30, 70, 30, 72, 0, 735 26, 31, 32, 30, 0, 1, 101, 30, 4, 5,
731 1, 95, 3, 4, 5, 6, 7, 8, 9, 10,
732 11, 12, 25, 14, 15, 16, 17, 18, 19, 20,
733 21, 22, 23, 30, 25, 25, 1, 146, 30, 30,
734 5, 6, 1, 8, 9, 10, 11, 12, 1, 14,
735 15, 16, 17, 18, 19, 20, 140, 30, 93, 67,
736 25, 30, 70, 30, 72, 30, 28, 25, 26, 31,
737 32, 155, 24, 108, 0, 1, 30, 3, 4, 5,
738 6, 7, 8, 9, 10, 11, 12, 30, 14, 15, 736 6, 7, 8, 9, 10, 11, 12, 30, 14, 15,
739 16, 17, 18, 19, 20, 21, 22, 23, 69, 25, 737 16, 17, 18, 19, 20, 21, 22, 23, 30, 25,
740 71, 30, 0, 1, 30, 3, 4, 5, 6, 7, 738 25, 68, 25, 151, 30, 30, 30, 0, 1, 25,
741 8, 9, 10, 11, 31, 32, 14, 15, 16, 17, 739 26, 4, 5, 6, 7, 8, 9, 10, 11, 12,
742 18, 19, 20, 21, 22, 5, 6, 25, 8, 9, 740 145, 14, 15, 16, 17, 18, 19, 20, 21, 22,
743 10, 11, 30, 30, 14, 15, 30, 0, 1, 174, 741 23, 75, 25, 25, 78, 160, 80, 30, 99, 30,
744 3, 4, 5, 6, 7, 8, 9, 10, 11, 30, 742 0, 1, 31, 32, 4, 5, 6, 7, 8, 9,
743 10, 11, 25, 114, 14, 15, 16, 17, 18, 19,
744 20, 21, 22, 76, 77, 25, 79, 0, 1, 1,
745 30, 4, 5, 6, 7, 8, 9, 10, 11, 1,
745 30, 14, 15, 16, 17, 18, 19, 20, 21, 22, 746 30, 14, 15, 16, 17, 18, 19, 20, 21, 22,
746 68, 69, 25, 71, 69, 1, 71, 30, 4, 5, 747 76, 77, 25, 79, 0, 1, 30, 30, 4, 5,
747 6, 7, 8, 9, 10, 11, 30, 30, 14, 15, 748 6, 7, 8, 9, 10, 11, 30, 30, 14, 15,
748 16, 14, 143, 144, 145, 68, 69, 30, 71, 25, 749 16, 17, 18, 19, 20, 21, 22, 30, 179, 25,
749 151, 25, 153, 1, 30, 30, 31, 32, 31, 32, 750 30, 1, 30, 30, 30, 5, 6, 30, 8, 9,
750 161, 30, 31, 32, 13, 30, 25, 14, 32, 30, 751 10, 11, 12, 30, 14, 15, 16, 17, 18, 19,
751 30, 33, 30, 30, 30, 30, 30, 30, 30, 29, 752 20, 30, 31, 32, 30, 25, 24, 77, 1, 79,
752 67, 109, 60, -1, -1, -1, -1, -1, -1, 40 753 30, 4, 5, 6, 7, 8, 9, 10, 11, 25,
754 1, 14, 15, 16, 4, 5, 6, 7, 8, 9,
755 10, 11, 25, 30, 14, 15, 13, 30, 5, 6,
756 25, 8, 9, 10, 11, 32, 14, 14, 15, 33,
757 30, 148, 149, 150, 30, 31, 32, 30, 77, 156,
758 79, 158, 7, 30, 30, 30, 30, 30, 30, 166,
759 30, 30, 30, 6, 75, 36, 47, 115
753}; 760};
754 761
755/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing 762/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
756 symbol of state STATE-NUM. */ 763 symbol of state STATE-NUM. */
757static const yytype_uint8 yystos[] = 764static const yytype_uint8 yystos[] =
758{ 765{
759 0, 36, 37, 0, 1, 3, 4, 5, 6, 7, 766 0, 3, 30, 36, 37, 38, 62, 78, 25, 26,
760 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, 767 76, 0, 1, 4, 5, 6, 7, 8, 9, 10,
761 20, 21, 22, 25, 30, 38, 39, 41, 42, 43, 768 11, 14, 15, 16, 17, 18, 19, 20, 21, 22,
762 44, 50, 51, 53, 57, 59, 61, 62, 64, 66, 769 25, 30, 39, 40, 42, 43, 44, 45, 51, 52,
763 67, 68, 75, 30, 25, 26, 74, 74, 30, 74, 770 54, 58, 60, 63, 64, 66, 68, 69, 70, 77,
764 25, 80, 30, 74, 25, 25, 25, 26, 29, 34, 771 38, 30, 37, 78, 30, 76, 30, 76, 25, 82,
765 78, 79, 30, 1, 1, 45, 45, 54, 56, 60, 772 30, 76, 25, 25, 25, 26, 29, 34, 80, 81,
766 71, 65, 71, 30, 76, 30, 30, 30, 30, 30, 773 30, 1, 1, 46, 46, 55, 57, 61, 73, 67,
767 30, 78, 78, 31, 32, 76, 27, 33, 30, 30, 774 73, 30, 30, 30, 30, 30, 30, 80, 80, 31,
768 1, 12, 16, 18, 19, 20, 21, 22, 23, 25, 775 32, 78, 27, 33, 30, 30, 1, 12, 16, 18,
769 30, 40, 46, 47, 69, 70, 72, 17, 18, 19, 776 19, 20, 21, 22, 23, 25, 30, 41, 47, 48,
770 20, 30, 40, 55, 70, 72, 39, 52, 75, 39, 777 71, 72, 74, 17, 18, 19, 20, 30, 41, 56,
771 53, 58, 64, 75, 30, 40, 72, 39, 53, 63, 778 72, 74, 40, 53, 77, 40, 54, 59, 66, 77,
772 64, 75, 30, 28, 78, 78, 79, 79, 30, 30, 779 30, 41, 74, 40, 54, 65, 66, 77, 28, 80,
773 24, 74, 73, 74, 78, 25, 79, 48, 1, 13, 780 80, 81, 81, 30, 30, 24, 76, 75, 76, 80,
774 30, 74, 73, 25, 78, 14, 77, 30, 77, 77, 781 25, 81, 49, 1, 13, 30, 76, 75, 25, 80,
775 77, 79, 25, 30, 30, 77, 30, 77, 30, 78, 782 14, 79, 30, 79, 79, 79, 81, 25, 30, 30,
776 30, 30, 30, 77, 33, 49, 30, 30, 30, 74 783 79, 30, 79, 30, 80, 30, 30, 30, 79, 33,
784 50, 30, 30, 30, 76
777}; 785};
778 786
779#define yyerrok (yyerrstatus = 0) 787#define yyerrok (yyerrstatus = 0)
@@ -1284,7 +1292,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1284 1292
1285 switch (yytype) 1293 switch (yytype)
1286 { 1294 {
1287 case 51: /* "choice_entry" */ 1295 case 52: /* "choice_entry" */
1288 1296
1289 { 1297 {
1290 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1298 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1294,7 +1302,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1294}; 1302};
1295 1303
1296 break; 1304 break;
1297 case 57: /* "if_entry" */ 1305 case 58: /* "if_entry" */
1298 1306
1299 { 1307 {
1300 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1308 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1304,7 +1312,7 @@ yydestruct (yymsg, yytype, yyvaluep)
1304}; 1312};
1305 1313
1306 break; 1314 break;
1307 case 62: /* "menu_entry" */ 1315 case 64: /* "menu_entry" */
1308 1316
1309 { 1317 {
1310 fprintf(stderr, "%s:%d: missing end statement for this entry\n", 1318 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -1614,39 +1622,39 @@ yyreduce:
1614 YY_REDUCE_PRINT (yyn); 1622 YY_REDUCE_PRINT (yyn);
1615 switch (yyn) 1623 switch (yyn)
1616 { 1624 {
1617 case 8: 1625 case 10:
1618 1626
1619 { zconf_error("unexpected end statement"); ;} 1627 { zconf_error("unexpected end statement"); ;}
1620 break; 1628 break;
1621 1629
1622 case 9: 1630 case 11:
1623 1631
1624 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;} 1632 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;}
1625 break; 1633 break;
1626 1634
1627 case 10: 1635 case 12:
1628 1636
1629 { 1637 {
1630 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name); 1638 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
1631;} 1639;}
1632 break; 1640 break;
1633 1641
1634 case 11: 1642 case 13:
1635 1643
1636 { zconf_error("invalid statement"); ;} 1644 { zconf_error("invalid statement"); ;}
1637 break; 1645 break;
1638 1646
1639 case 25: 1647 case 27:
1640 1648
1641 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;} 1649 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;}
1642 break; 1650 break;
1643 1651
1644 case 26: 1652 case 28:
1645 1653
1646 { zconf_error("invalid option"); ;} 1654 { zconf_error("invalid option"); ;}
1647 break; 1655 break;
1648 1656
1649 case 27: 1657 case 29:
1650 1658
1651 { 1659 {
1652 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1660 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
@@ -1656,7 +1664,7 @@ yyreduce:
1656;} 1664;}
1657 break; 1665 break;
1658 1666
1659 case 28: 1667 case 30:
1660 1668
1661 { 1669 {
1662 menu_end_entry(); 1670 menu_end_entry();
@@ -1664,7 +1672,7 @@ yyreduce:
1664;} 1672;}
1665 break; 1673 break;
1666 1674
1667 case 29: 1675 case 31:
1668 1676
1669 { 1677 {
1670 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); 1678 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
@@ -1674,7 +1682,7 @@ yyreduce:
1674;} 1682;}
1675 break; 1683 break;
1676 1684
1677 case 30: 1685 case 32:
1678 1686
1679 { 1687 {
1680 if (current_entry->prompt) 1688 if (current_entry->prompt)
@@ -1686,7 +1694,7 @@ yyreduce:
1686;} 1694;}
1687 break; 1695 break;
1688 1696
1689 case 38: 1697 case 40:
1690 1698
1691 { 1699 {
1692 menu_set_type((yyvsp[(1) - (3)].id)->stype); 1700 menu_set_type((yyvsp[(1) - (3)].id)->stype);
@@ -1696,7 +1704,7 @@ yyreduce:
1696;} 1704;}
1697 break; 1705 break;
1698 1706
1699 case 39: 1707 case 41:
1700 1708
1701 { 1709 {
1702 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1710 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
@@ -1704,7 +1712,7 @@ yyreduce:
1704;} 1712;}
1705 break; 1713 break;
1706 1714
1707 case 40: 1715 case 42:
1708 1716
1709 { 1717 {
1710 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)); 1718 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr));
@@ -1716,7 +1724,7 @@ yyreduce:
1716;} 1724;}
1717 break; 1725 break;
1718 1726
1719 case 41: 1727 case 43:
1720 1728
1721 { 1729 {
1722 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); 1730 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
@@ -1724,7 +1732,7 @@ yyreduce:
1724;} 1732;}
1725 break; 1733 break;
1726 1734
1727 case 42: 1735 case 44:
1728 1736
1729 { 1737 {
1730 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr)); 1738 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
@@ -1732,7 +1740,7 @@ yyreduce:
1732;} 1740;}
1733 break; 1741 break;
1734 1742
1735 case 45: 1743 case 47:
1736 1744
1737 { 1745 {
1738 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); 1746 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
@@ -1744,17 +1752,17 @@ yyreduce:
1744;} 1752;}
1745 break; 1753 break;
1746 1754
1747 case 46: 1755 case 48:
1748 1756
1749 { (yyval.string) = NULL; ;} 1757 { (yyval.string) = NULL; ;}
1750 break; 1758 break;
1751 1759
1752 case 47: 1760 case 49:
1753 1761
1754 { (yyval.string) = (yyvsp[(2) - (2)].string); ;} 1762 { (yyval.string) = (yyvsp[(2) - (2)].string); ;}
1755 break; 1763 break;
1756 1764
1757 case 48: 1765 case 50:
1758 1766
1759 { 1767 {
1760 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE); 1768 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE);
@@ -1765,14 +1773,14 @@ yyreduce:
1765;} 1773;}
1766 break; 1774 break;
1767 1775
1768 case 49: 1776 case 51:
1769 1777
1770 { 1778 {
1771 (yyval.menu) = menu_add_menu(); 1779 (yyval.menu) = menu_add_menu();
1772;} 1780;}
1773 break; 1781 break;
1774 1782
1775 case 50: 1783 case 52:
1776 1784
1777 { 1785 {
1778 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) { 1786 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) {
@@ -1782,7 +1790,7 @@ yyreduce:
1782;} 1790;}
1783 break; 1791 break;
1784 1792
1785 case 58: 1793 case 60:
1786 1794
1787 { 1795 {
1788 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); 1796 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
@@ -1790,7 +1798,7 @@ yyreduce:
1790;} 1798;}
1791 break; 1799 break;
1792 1800
1793 case 59: 1801 case 61:
1794 1802
1795 { 1803 {
1796 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) { 1804 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) {
@@ -1803,7 +1811,7 @@ yyreduce:
1803;} 1811;}
1804 break; 1812 break;
1805 1813
1806 case 60: 1814 case 62:
1807 1815
1808 { 1816 {
1809 current_entry->sym->flags |= SYMBOL_OPTIONAL; 1817 current_entry->sym->flags |= SYMBOL_OPTIONAL;
@@ -1811,7 +1819,7 @@ yyreduce:
1811;} 1819;}
1812 break; 1820 break;
1813 1821
1814 case 61: 1822 case 63:
1815 1823
1816 { 1824 {
1817 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) { 1825 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) {
@@ -1823,7 +1831,7 @@ yyreduce:
1823;} 1831;}
1824 break; 1832 break;
1825 1833
1826 case 64: 1834 case 66:
1827 1835
1828 { 1836 {
1829 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); 1837 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
@@ -1833,7 +1841,7 @@ yyreduce:
1833;} 1841;}
1834 break; 1842 break;
1835 1843
1836 case 65: 1844 case 67:
1837 1845
1838 { 1846 {
1839 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) { 1847 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) {
@@ -1843,7 +1851,14 @@ yyreduce:
1843;} 1851;}
1844 break; 1852 break;
1845 1853
1846 case 71: 1854 case 73:
1855
1856 {
1857 menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
1858;}
1859 break;
1860
1861 case 74:
1847 1862
1848 { 1863 {
1849 menu_add_entry(NULL); 1864 menu_add_entry(NULL);
@@ -1852,14 +1867,14 @@ yyreduce:
1852;} 1867;}
1853 break; 1868 break;
1854 1869
1855 case 72: 1870 case 75:
1856 1871
1857 { 1872 {
1858 (yyval.menu) = menu_add_menu(); 1873 (yyval.menu) = menu_add_menu();
1859;} 1874;}
1860 break; 1875 break;
1861 1876
1862 case 73: 1877 case 76:
1863 1878
1864 { 1879 {
1865 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) { 1880 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) {
@@ -1869,7 +1884,7 @@ yyreduce:
1869;} 1884;}
1870 break; 1885 break;
1871 1886
1872 case 79: 1887 case 82:
1873 1888
1874 { 1889 {
1875 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); 1890 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
@@ -1877,7 +1892,7 @@ yyreduce:
1877;} 1892;}
1878 break; 1893 break;
1879 1894
1880 case 80: 1895 case 83:
1881 1896
1882 { 1897 {
1883 menu_add_entry(NULL); 1898 menu_add_entry(NULL);
@@ -1886,14 +1901,14 @@ yyreduce:
1886;} 1901;}
1887 break; 1902 break;
1888 1903
1889 case 81: 1904 case 84:
1890 1905
1891 { 1906 {
1892 menu_end_entry(); 1907 menu_end_entry();
1893;} 1908;}
1894 break; 1909 break;
1895 1910
1896 case 82: 1911 case 85:
1897 1912
1898 { 1913 {
1899 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); 1914 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
@@ -1901,14 +1916,14 @@ yyreduce:
1901;} 1916;}
1902 break; 1917 break;
1903 1918
1904 case 83: 1919 case 86:
1905 1920
1906 { 1921 {
1907 current_entry->help = (yyvsp[(2) - (2)].string); 1922 current_entry->help = (yyvsp[(2) - (2)].string);
1908;} 1923;}
1909 break; 1924 break;
1910 1925
1911 case 88: 1926 case 91:
1912 1927
1913 { 1928 {
1914 menu_add_dep((yyvsp[(3) - (4)].expr)); 1929 menu_add_dep((yyvsp[(3) - (4)].expr));
@@ -1916,84 +1931,84 @@ yyreduce:
1916;} 1931;}
1917 break; 1932 break;
1918 1933
1919 case 90: 1934 case 93:
1920 1935
1921 { 1936 {
1922 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); 1937 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
1923;} 1938;}
1924 break; 1939 break;
1925 1940
1926 case 93: 1941 case 96:
1927 1942
1928 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1943 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1929 break; 1944 break;
1930 1945
1931 case 94: 1946 case 97:
1932 1947
1933 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1948 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1934 break; 1949 break;
1935 1950
1936 case 95: 1951 case 98:
1937 1952
1938 { (yyval.id) = (yyvsp[(1) - (2)].id); ;} 1953 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
1939 break; 1954 break;
1940 1955
1941 case 98: 1956 case 101:
1942 1957
1943 { (yyval.expr) = NULL; ;} 1958 { (yyval.expr) = NULL; ;}
1944 break; 1959 break;
1945 1960
1946 case 99: 1961 case 102:
1947 1962
1948 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} 1963 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
1949 break; 1964 break;
1950 1965
1951 case 100: 1966 case 103:
1952 1967
1953 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;} 1968 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;}
1954 break; 1969 break;
1955 1970
1956 case 101: 1971 case 104:
1957 1972
1958 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 1973 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
1959 break; 1974 break;
1960 1975
1961 case 102: 1976 case 105:
1962 1977
1963 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} 1978 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
1964 break; 1979 break;
1965 1980
1966 case 103: 1981 case 106:
1967 1982
1968 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} 1983 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
1969 break; 1984 break;
1970 1985
1971 case 104: 1986 case 107:
1972 1987
1973 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;} 1988 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;}
1974 break; 1989 break;
1975 1990
1976 case 105: 1991 case 108:
1977 1992
1978 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 1993 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
1979 break; 1994 break;
1980 1995
1981 case 106: 1996 case 109:
1982 1997
1983 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} 1998 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
1984 break; 1999 break;
1985 2000
1986 case 107: 2001 case 110:
1987 2002
1988 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;} 2003 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;}
1989 break; 2004 break;
1990 2005
1991 case 108: 2006 case 111:
1992 2007
1993 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;} 2008 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;}
1994 break; 2009 break;
1995 2010
1996 case 109: 2011 case 112:
1997 2012
1998 { (yyval.string) = NULL; ;} 2013 { (yyval.string) = NULL; ;}
1999 break; 2014 break;
@@ -2239,6 +2254,10 @@ void conf_parse(const char *name)
2239 prop = prop_alloc(P_DEFAULT, modules_sym); 2254 prop = prop_alloc(P_DEFAULT, modules_sym);
2240 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); 2255 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
2241 } 2256 }
2257
2258 rootmenu.prompt->text = _(rootmenu.prompt->text);
2259 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
2260
2242 menu_finalize(&rootmenu); 2261 menu_finalize(&rootmenu);
2243 for_all_symbols(i, sym) { 2262 for_all_symbols(i, sym) {
2244 if (sym_check_deps(sym)) 2263 if (sym_check_deps(sym))
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index 23dfd3baa7a1..2abd3c7ff15d 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -36,7 +36,7 @@ static struct menu *current_menu, *current_entry;
36#define YYERROR_VERBOSE 36#define YYERROR_VERBOSE
37#endif 37#endif
38%} 38%}
39%expect 26 39%expect 28
40 40
41%union 41%union
42{ 42{
@@ -104,14 +104,15 @@ static struct menu *current_menu, *current_entry;
104%} 104%}
105 105
106%% 106%%
107input: stmt_list; 107input: nl start | start;
108
109start: mainmenu_stmt stmt_list | stmt_list;
108 110
109stmt_list: 111stmt_list:
110 /* empty */ 112 /* empty */
111 | stmt_list common_stmt 113 | stmt_list common_stmt
112 | stmt_list choice_stmt 114 | stmt_list choice_stmt
113 | stmt_list menu_stmt 115 | stmt_list menu_stmt
114 | stmt_list T_MAINMENU prompt nl
115 | stmt_list end { zconf_error("unexpected end statement"); } 116 | stmt_list end { zconf_error("unexpected end statement"); }
116 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } 117 | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
117 | stmt_list option_name error T_EOL 118 | stmt_list option_name error T_EOL
@@ -342,6 +343,13 @@ if_block:
342 | if_block choice_stmt 343 | if_block choice_stmt
343; 344;
344 345
346/* mainmenu entry */
347
348mainmenu_stmt: T_MAINMENU prompt nl
349{
350 menu_add_prompt(P_MENU, $2, NULL);
351};
352
345/* menu entry */ 353/* menu entry */
346 354
347menu: T_MENU prompt T_EOL 355menu: T_MENU prompt T_EOL
@@ -494,6 +502,10 @@ void conf_parse(const char *name)
494 prop = prop_alloc(P_DEFAULT, modules_sym); 502 prop = prop_alloc(P_DEFAULT, modules_sym);
495 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); 503 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
496 } 504 }
505
506 rootmenu.prompt->text = _(rootmenu.prompt->text);
507 rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
508
497 menu_finalize(&rootmenu); 509 menu_finalize(&rootmenu);
498 for_all_symbols(i, sym) { 510 for_all_symbols(i, sym) {
499 if (sym_check_deps(sym)) 511 if (sym_check_deps(sym))