summaryrefslogtreecommitdiff
path: root/scripts
authorkergoth <kergoth>2003-01-16 18:04:11 (UTC)
committer kergoth <kergoth>2003-01-16 18:04:11 (UTC)
commit3904d85eac20dfd21cf2a3245977f9946865fd92 (patch) (unidiff)
tree8d5b2217c1b54a0c439815ec02db3f5235c99daa /scripts
parent0eec393ef2dd8b43db96c86e80e307f73a771fae (diff)
downloadopie-3904d85eac20dfd21cf2a3245977f9946865fd92.zip
opie-3904d85eac20dfd21cf2a3245977f9946865fd92.tar.gz
opie-3904d85eac20dfd21cf2a3245977f9946865fd92.tar.bz2
Update LinuxKernelConf to 1.3, latest available.
Diffstat (limited to 'scripts') (more/less context) (show whitespace changes)
-rw-r--r--scripts/kconfig/Makefile110
-rw-r--r--scripts/kconfig/Makefile.kernel44
-rw-r--r--scripts/kconfig/conf.c7
-rw-r--r--scripts/kconfig/confdata.c66
-rw-r--r--scripts/kconfig/expr.h5
-rw-r--r--scripts/kconfig/kconfig.i5
-rw-r--r--scripts/kconfig/lkc.h5
-rw-r--r--scripts/kconfig/mconf.c91
-rw-r--r--scripts/kconfig/menu.c2
-rw-r--r--scripts/kconfig/qconf.cc256
-rw-r--r--scripts/kconfig/qconf.h59
-rw-r--r--scripts/kconfig/symbol.c35
-rw-r--r--scripts/kconfig/zconf.l72
-rw-r--r--scripts/kconfig/zconf.y6
14 files changed, 524 insertions, 239 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile
index 7e257be..5a0d7e5 100644
--- a/scripts/kconfig/Makefile
+++ b/scripts/kconfig/Makefile
@@ -1,5 +1,5 @@
1VERSION=1.2 1VERSION=1.3
2CC=gcc 2CC=gcc
3CXX=g++ 3CXX=g++
4CFLAGS=-O2 -Wall -g -fPIC 4CFLAGS=-O0 -Wall -g -fPIC
5CXXFLAGS=$(CFLAGS) -I$(HOSTQTDIR)/include 5CXXFLAGS=$(CFLAGS) -I$(HOSTQTDIR)/include
@@ -8,25 +8,9 @@ LXXFLAGS=$(LDFLAGS) -L$(HOSTQTDIR)/lib -Wl,-rpath,$(HOSTQTDIR)/lib
8LEX=flex 8LEX=flex
9LFLAGS=-L
9YACC=bison 10YACC=bison
10YFLAGS=-d -t #-v 11YFLAGS=-l
12#YFLAGS=-d -t -v -l
11ifndef HOSTQTDIR 13ifndef HOSTQTDIR
12ifeq ($(shell if [ -e /usr/share/qt ]; then echo foundit; fi),foundit)
13HOSTQTDIR=/usr/share/qt 14HOSTQTDIR=/usr/share/qt
14else
15ifeq ($(shell if [ -e /usr/lib/qt ]; then echo foundit; fi),foundit)
16HOSTQTDIR=/usr/lib/qt
17endif
18endif
19endif
20
21ifndef QTLIB
22ifeq ($(shell if [ -e $(HOSTQTDIR)/lib/libqt-mt.so ]; then echo foundit; fi),foundit)
23QTLIB=-lqt-mt
24else
25ifneq ($(shell if [ -e $(HOSTQTDIR)/lib/libqt.so ]; then echo foundit; fi),foundit)
26$(warning Unable to locate libqt.so!)
27endif 15endif
28QTLIB=-lqt
29endif
30endif
31
32MOC=$(wildcard $(HOSTQTDIR)/bin/moc) 16MOC=$(wildcard $(HOSTQTDIR)/bin/moc)
@@ -37,8 +21,8 @@ mconf_SRC=mconf.c $(parse_SRC)
37qconf_SRC=qconf.cc 21qconf_SRC=qconf.cc
38lkcc_SRC=cml1.y cml1.l help.l cml1.h expr1.c
39HDR=expr.h lkc.h lkc_proto.h qconf.h 22HDR=expr.h lkc.h lkc_proto.h qconf.h
40OTHER=README lkc_spec lkc_overview Makefile.kernel convert-all prepare-all.diff fixup-all.diff \ 23OTHER=README lkc-language.txt Makefile.kernel \
41 kconfig.i extconf.rb example 24 kconfig.i extconf.rb example
42INST=zconf.y zconf.l confdata.c expr.c symbol.c menu.c conf.c mconf.c qconf.cc kconfig_load.c images.c $(parse_SRC) $(HDR) 25INST=zconf.y zconf.l confdata.c expr.c symbol.c menu.c \
43INSTGEN=lex.zconf.c zconf.tab.c zconf.tab.h 26 conf.c mconf.c qconf.cc kconfig_load.c images.c $(HDR)
27INSTGEN=lex.zconf.c zconf.tab.c
44 28
@@ -52,3 +36,3 @@ endif
52 36
53SRC=$(conf_SRC) $(mconf_SRC) $(qconf_SRC) $(lkcc_SRC) 37SRC=$(conf_SRC) $(mconf_SRC) $(qconf_SRC)
54CSRC=$(filter %.c, $(SRC)) 38CSRC=$(filter %.c, $(SRC))
@@ -78,24 +62,10 @@ qconf_OBJ=$(filter %.o, \
78 $(qconf_SRC)))))) 62 $(qconf_SRC))))))
79lkcc_OBJ=$(filter %.o, \ 63OBJ=$(conf_OBJ) $(mconf_OBJ) $(qconf_OBJ)
80 $(patsubst %.c,%.o, \
81 $(patsubst %.y,%.tab.o, \
82 $(patsubst %.l,lex.%.o, \
83 $(lkcc_SRC)))))
84OBJ=$(conf_OBJ) $(mconf_OBJ) $(qconf_OBJ) $(lkcc_OBJ)
85 64
86ifeq ($(MOC),) 65ifeq ($(MOC),)
87all: lkcc conf mconf 66all: conf mconf
88else 67else
89all: lkcc conf mconf qconf libkconfig.so 68all: conf mconf qconf libkconfig.so
90endif 69endif
91 70
92lex.help.c: help.l
93lex.help.o: lex.help.c cml1.h expr.h
94lex.cml1.c: cml1.l
95lex.cml1.o: lex.cml1.c cml1.tab.h cml1.h expr.h
96cml1.tab.c: cml1.y
97cml1.tab.h: cml1.y
98cml1.tab.o: cml1.tab.c cml1.h expr.h
99expr1.o: expr1.c expr.h
100
101lkc_deps := lkc.h lkc_proto.h lkc_defs.h expr.h 71lkc_deps := lkc.h lkc_proto.h lkc_defs.h expr.h
@@ -130,9 +100,6 @@ qconf:
130else 100else
131qconf: $(qconf_OBJ) libkconfig.so 101qconf: $(qconf_OBJ)
132 $(CXX) $(LXXFLAGS) $^ $(QTLIB) -o $@ 102 $(CXX) $(LXXFLAGS) $^ -lqt -o $@
133endif 103endif
134 104
135lkcc: $(lkcc_OBJ)
136 $(CC) $(LDFLAGS) $^ -o $@
137
138libkconfig.so: $(parse_OBJ) 105libkconfig.so: $(parse_OBJ)
@@ -144,3 +111,4 @@ lkc_defs.h: lkc_proto.h
144clean: 111clean:
145 rm -f $(OBJ) lkcc conf qconf mconf *.moc lex.* *.tab.? *.output 112 rm -f $(OBJ) conf qconf mconf *.moc lex.* *.tab.? *.output
113 rm -rf .ruby .python
146 114
@@ -150,3 +118,3 @@ tgz:
150 cp -ra Makefile $(sort $(SRC) $(HDR) $(OTHER) $(INST)) tmp/lkc-$(VERSION) 118 cp -ra Makefile $(sort $(SRC) $(HDR) $(OTHER) $(INST)) tmp/lkc-$(VERSION)
151 tar -cpvz -C tmp -f lkc-$(VERSION).tar.gz lkc-$(VERSION) 119 tar -cpvz -C tmp --exclude CVS -f lkc-$(VERSION).tar.gz lkc-$(VERSION)
152 rm -rf tmp 120 rm -rf tmp
@@ -169,20 +137,11 @@ lex.%.c: %.l
169ifdef KERNELSRC 137ifdef KERNELSRC
170install: lkcc $(INSTGEN) 138install: $(INSTGEN)
171 set -x; mkdir $(KERNELSRC)/scripts/kconfig; \ 139 set -x; cp $(sort $(INST)) $(KERNELSRC)/scripts/kconfig; \
172 cp $(sort $(INST)) $(KERNELSRC)/scripts/kconfig; \
173 for f in $(INSTGEN); do cp $$f $(KERNELSRC)/scripts/kconfig/$${f}_shipped; done; \ 140 for f in $(INSTGEN); do cp $$f $(KERNELSRC)/scripts/kconfig/$${f}_shipped; done; \
174 cp Makefile.kernel $(KERNELSRC)/scripts/kconfig/Makefile; \ 141 cp Makefile.kernel $(KERNELSRC)/scripts/kconfig/Makefile
175 LKCSRC=$$PWD; export LKCSRC; \ 142
176 cd $(KERNELSRC); \ 143diff: $(INSTGEN)
177 patch -p0 -N < $$LKCSRC/prepare-all.diff; \ 144 for f in $(sort $(INST)); do diff -u $(KERNELSRC)/scripts/kconfig/$$f $$f; done; \
178 sh $$LKCSRC/convert-all; \ 145 for f in $(INSTGEN); do diff -u $(KERNELSRC)/scripts/kconfig/$${f}_shipped $$f; done; \
179 patch -p0 -N < $$LKCSRC/fixup-all.diff 146 diff -u $(KERNELSRC)/scripts/kconfig/Makefile Makefile.kernel
180
181 #cp Makefile $(KERNELSRC)/scripts/kconfig/Makefile; \
182
183uninstall:
184 patch -p0 -N -R -d $(KERNELSRC) < prepare-all.diff; \
185 cd $(KERNELSRC); \
186 find -name "Kconfig*" | xargs rm; \
187 rm -rf scripts/kconfig log.*
188else 147else
@@ -206,2 +165,17 @@ ruby: .ruby libkconfig.so .ruby/kconfig.so
206 165
207.PHONY: all tgz clean ruby 166
167PYTHON_INCLUDE=$(shell python -c "import sys; print '-I'+sys.prefix+'/include/python'+sys.version[:3]")
168
169python: .python .python/kconfig.py .python/_kconfig.so
170
171.python:
172 mkdir .python
173
174.python/kconfig_wrap.c .python/kconfig.py: kconfig.i kconfig_load.c expr.h lkc_proto.h
175 swig -python -o .python/kconfig_wrap.c kconfig.i
176
177.python/_kconfig.so: .python/kconfig_wrap.c
178 cd .python; $(CC) $(CFLAGS) -shared kconfig_wrap.c -o _kconfig.so -I.. $(PYTHON_INCLUDE)
179
180
181.PHONY: all tgz clean ruby python
diff --git a/scripts/kconfig/Makefile.kernel b/scripts/kconfig/Makefile.kernel
index beb4dcf..22724a7 100644
--- a/scripts/kconfig/Makefile.kernel
+++ b/scripts/kconfig/Makefile.kernel
@@ -25,10 +25,2 @@ include $(TOPDIR)/Rules.make
25 25
26# QT needs some extra effort...
27ifndef QTDIR
28 QTDIR := /usr/share/qt
29endif
30
31# Executable to generate the .moc file
32MOC=$(wildcard $(QTDIR)/bin/moc)
33
34# generated files seem to need this to find local include files 26# generated files seem to need this to find local include files
@@ -37,4 +29,4 @@ HOSTCFLAGS_zconf.tab.o := -I$(src)
37 29
38 HOSTLOADLIBES_qconf:= -L$(QTDIR)/lib -Wl,-rpath,$(QTDIR)/lib -lqt -ldl 30 HOSTLOADLIBES_qconf= -L$(QTDIR)/lib -Wl,-rpath,$(QTDIR)/lib -l$(QTLIB) -ldl
39 HOSTCXXFLAGS_qconf.o:= -I$(QTDIR)/include 31 HOSTCXXFLAGS_qconf.o= -I$(QTDIR)/include
40 32
@@ -44,10 +36,28 @@ $(obj)/qconf.o: $(obj)/.tmp_qtcheck
44 36
37ifeq ($(MAKECMDGOALS),$(obj)/qconf)
38MOC = $(QTDIR)/bin/moc
39-include $(obj)/.tmp_qtcheck
40
41# QT needs some extra effort...
45$(obj)/.tmp_qtcheck: 42$(obj)/.tmp_qtcheck:
46ifeq ($(MOC),) 43 @set -e; for d in $$QTDIR /usr/share/qt /usr/lib/qt3; do \
47 @echo Unable to find the QT installation. Please make sure that the 44 if [ -f $$d/include/qconfig.h ]; then DIR=$$d; break; fi; \
48 @echo QT development package is correctly installed and the QTDIR 45 done; \
49 @echo environment variable is set to the correct location. 46 if [ -z "$$DIR" ]; then \
50 @false 47 echo "*"; \
51else 48 echo "* Unable to find the QT installation. Please make sure that the"; \
52 @touch $@ 49 echo "* QT development package is correctly installed and the QTDIR"; \
50 echo "* environment variable is set to the correct location."; \
51 echo "*"; \
52 false; \
53 fi; \
54 LIB=qt; \
55 if [ -f $$DIR/lib/libqt-mt.so ]; then LIB=qt-mt; fi; \
56 echo "QTDIR=$$DIR" > $@; echo "QTLIB=$$LIB" >> $@; \
57 if [ ! -x $$DIR/bin/moc -a -x /usr/bin/moc ]; then \
58 echo "*"; \
59 echo "* Unable to find $$DIR/bin/moc, using /usr/bin/moc instead."; \
60 echo "*"; \
61 echo "MOC=/usr/bin/moc" >> $@; \
62 fi
53endif 63endif
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 74c94c2..1602d5f 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -117,2 +117,3 @@ static void conf_askvalue(struct symbol *sym, const char *def)
117 case ask_all: 117 case ask_all:
118 fflush(stdout);
118 fgets(line, 128, stdin); 119 fgets(line, 128, stdin);
@@ -344,2 +345,4 @@ static int conf_choice(struct menu *menu)
344 case ask_all: 345 case ask_all:
346 if (is_new)
347 sym->flags |= SYMBOL_NEW;
345 conf_askvalue(sym, menu_get_prompt(def_menu)); 348 conf_askvalue(sym, menu_get_prompt(def_menu));
@@ -359,3 +362,3 @@ static int conf_choice(struct menu *menu)
359 if (line[0]) { 362 if (line[0]) {
360 len = strlen(line) - 1; 363 len = strlen(line);
361 line[len] = 0; 364 line[len] = 0;
@@ -366,3 +369,3 @@ static int conf_choice(struct menu *menu)
366 continue; 369 continue;
367 if (!strncmp(line, menu_get_prompt(cmenu), len)) { 370 if (!strncasecmp(line, menu_get_prompt(cmenu), len)) {
368 def_menu = cmenu; 371 def_menu = cmenu;
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 0f5fd97..9bf7af9 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -5,4 +5,4 @@
5 5
6#include <sys/stat.h>
6#include <ctype.h> 7#include <ctype.h>
7#include <limits.h>
8#include <stdio.h> 8#include <stdio.h>
@@ -16,3 +16,2 @@
16const char conf_def_filename[] = ".config"; 16const char conf_def_filename[] = ".config";
17char conf_filename[PATH_MAX+1];
18 17
@@ -57,3 +56,14 @@ char *conf_get_default_confname(void)
57{ 56{
58 return conf_expand_value(conf_defname); 57 struct stat buf;
58 static char fullname[PATH_MAX+1];
59 char *env, *name;
60
61 name = conf_expand_value(conf_defname);
62 env = getenv(SRCTREE);
63 if (env) {
64 sprintf(fullname, "%s/%s", env, name);
65 if (!stat(fullname, &buf))
66 return fullname;
67 }
68 return name;
59} 69}
@@ -63,3 +73,3 @@ int conf_read(const char *name)
63 FILE *in = NULL; 73 FILE *in = NULL;
64 char line[128]; 74 char line[1024];
65 char *p, *p2; 75 char *p, *p2;
@@ -72,5 +82,3 @@ int conf_read(const char *name)
72 if (name) { 82 if (name) {
73 in = fopen(name, "r"); 83 in = zconf_fopen(name);
74 if (in)
75 strcpy(conf_filename, name);
76 } else { 84 } else {
@@ -79,3 +87,3 @@ int conf_read(const char *name)
79 name = conf_expand_value(name); 87 name = conf_expand_value(name);
80 in = fopen(name, "r"); 88 in = zconf_fopen(name);
81 if (in) { 89 if (in) {
@@ -93,3 +101,4 @@ int conf_read(const char *name)
93 for_all_symbols(i, sym) { 101 for_all_symbols(i, sym) {
94 sym->flags |= SYMBOL_NEW; 102 sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED;
103 sym->flags &= ~SYMBOL_VALID;
95 switch (sym->type) { 104 switch (sym->type) {
@@ -98,8 +107,7 @@ int conf_read(const char *name)
98 case S_STRING: 107 case S_STRING:
99 if (S_VAL(sym->def)) { 108 if (S_VAL(sym->def))
100 free(S_VAL(sym->def)); 109 free(S_VAL(sym->def));
101 S_VAL(sym->def) = NULL;
102 }
103 default: 110 default:
104 ; 111 S_VAL(sym->def) = NULL;
112 S_TRI(sym->def) = no;
105 } 113 }
@@ -107,3 +115,3 @@ int conf_read(const char *name)
107 115
108 while (fgets(line, 128, in)) { 116 while (fgets(line, sizeof(line), in)) {
109 lineno++; 117 lineno++;
@@ -119,3 +127,2 @@ int conf_read(const char *name)
119 continue; 127 continue;
120 //printf("%s -> n\n", line + 9);
121 sym = sym_lookup(line + 9, 0); 128 sym = sym_lookup(line + 9, 0);
@@ -141,3 +148,2 @@ int conf_read(const char *name)
141 *p2 = 0; 148 *p2 = 0;
142 //printf("%s -> %s\n", line + 7, p);
143 sym = sym_find(line + 7); 149 sym = sym_find(line + 7);
@@ -148,13 +154,20 @@ int conf_read(const char *name)
148 switch (sym->type) { 154 switch (sym->type) {
155 case S_TRISTATE:
156 if (p[0] == 'm') {
157 S_TRI(sym->def) = mod;
158 sym->flags &= ~SYMBOL_NEW;
159 break;
160 }
149 case S_BOOLEAN: 161 case S_BOOLEAN:
150 sym->def = symbol_yes.curr; 162 if (p[0] == 'y') {
163 S_TRI(sym->def) = yes;
151 sym->flags &= ~SYMBOL_NEW; 164 sym->flags &= ~SYMBOL_NEW;
152 break; 165 break;
153 case S_TRISTATE: 166 }
154 if (p[0] == 'm') 167 if (p[0] == 'n') {
155 sym->def = symbol_mod.curr; 168 S_TRI(sym->def) = no;
156 else
157 sym->def = symbol_yes.curr;
158 sym->flags &= ~SYMBOL_NEW; 169 sym->flags &= ~SYMBOL_NEW;
159 break; 170 break;
171 }
172 break;
160 case S_STRING: 173 case S_STRING:
@@ -169,2 +182,6 @@ int conf_read(const char *name)
169 } 182 }
183 if (!p2) {
184 fprintf(stderr, "%s:%d: invalid string found\n", name, lineno);
185 exit(1);
186 }
170 case S_INT: 187 case S_INT:
@@ -174,4 +191,6 @@ int conf_read(const char *name)
174 sym->flags &= ~SYMBOL_NEW; 191 sym->flags &= ~SYMBOL_NEW;
175 } else 192 } else {
176 fprintf(stderr, "%s:%d:symbol value '%s' invalid for %s\n", name, lineno, p, sym->name); 193 fprintf(stderr, "%s:%d:symbol value '%s' invalid for %s\n", name, lineno, p, sym->name);
194 exit(1);
195 }
177 break; 196 break;
@@ -354,3 +373,2 @@ int conf_write(const char *name)
354 return 1; 373 return 1;
355 strcpy(conf_filename, name);
356 374
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index fd9c32a..896a296 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -168,2 +168,3 @@ struct menu {
168 struct expr *dep; 168 struct expr *dep;
169 unsigned int flags;
169 //char *help; 170 //char *help;
@@ -171,5 +172,7 @@ struct menu {
171 int lineno; 172 int lineno;
172 //void *data; 173 void *data;
173}; 174};
174 175
176 #define MENU_CHANGED 0x0001
177
175#ifndef SWIG 178#ifndef SWIG
diff --git a/scripts/kconfig/kconfig.i b/scripts/kconfig/kconfig.i
index 699cb13..77405fc 100644
--- a/scripts/kconfig/kconfig.i
+++ b/scripts/kconfig/kconfig.i
@@ -33,2 +33,7 @@ static void expr_to_s_help(void *data, const char *str)
33 33
34#ifdef SWIGPYTHON
35%rename (Property) property;
36%rename (default) def;
37#endif
38
34%immutable; 39%immutable;
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h
index 688945b..cdd04a9 100644
--- a/scripts/kconfig/lkc.h
+++ b/scripts/kconfig/lkc.h
@@ -23,3 +23,4 @@ extern "C" {
23 23
24void symbol_end(char *help); 24#define SRCTREE "srctree"
25
25int zconfparse(void); 26int zconfparse(void);
@@ -29,2 +30,3 @@ extern int zconfdebug;
29void zconf_starthelp(void); 30void zconf_starthelp(void);
31FILE *zconf_fopen(const char *name);
30void zconf_initscan(const char *name); 32void zconf_initscan(const char *name);
@@ -63,2 +65,3 @@ void sym_init(void);
63void sym_clear_all_valid(void); 65void sym_clear_all_valid(void);
66void sym_set_changed(struct symbol *sym);
64 67
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index dec8603..eba5ff7 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -3,2 +3,5 @@
3 * Released under the terms of the GNU GPL v2.0. 3 * Released under the terms of the GNU GPL v2.0.
4 *
5 * Introduced single menu mode (show all sub-menus in one large tree).
6 * 2002-11-06 Petr Baudis <pasky@ucw.cz>
4 */ 7 */
@@ -10,2 +13,3 @@
10#include <fcntl.h> 13#include <fcntl.h>
14#include <limits.h>
11#include <signal.h> 15#include <signal.h>
@@ -14,2 +18,3 @@
14#include <string.h> 18#include <string.h>
19#include <termios.h>
15#include <unistd.h> 20#include <unistd.h>
@@ -46,3 +51,3 @@ setmod_text[] =
46nohelp_text[] = 51nohelp_text[] =
47 "There is no help available for this option.\n", 52 "There is no help available for this kernel option.\n",
48load_config_text[] = 53load_config_text[] =
@@ -53,3 +58,3 @@ load_config_help[] =
53 "\n" 58 "\n"
54 "For various reasons, one may wish to keep several different\n" 59 "For various reasons, one may wish to keep several different kernel\n"
55 "configurations available on a single machine.\n" 60 "configurations available on a single machine.\n"
@@ -57,3 +62,3 @@ load_config_help[] =
57 "If you have saved a previous configuration in a file other than the\n" 62 "If you have saved a previous configuration in a file other than the\n"
58 "default, entering the name of the file here will allow you\n" 63 "kernel's default, entering the name of the file here will allow you\n"
59 "to modify that configuration.\n" 64 "to modify that configuration.\n"
@@ -67,3 +72,3 @@ save_config_help[] =
67 "\n" 72 "\n"
68 "For various reasons, one may wish to keep different\n" 73 "For various reasons, one may wish to keep different kernel\n"
69 "configurations available on a single machine.\n" 74 "configurations available on a single machine.\n"
@@ -80,4 +85,6 @@ static char buf[4096], *bufptr = buf;
80static char input_buf[4096]; 85static char input_buf[4096];
86static char filename[PATH_MAX+1] = ".config";
81static char *args[1024], **argptr = args; 87static char *args[1024], **argptr = args;
82static int indent = 0; 88static int indent = 0;
89static struct termios ios_org;
83static int rows, cols; 90static int rows, cols;
@@ -86,2 +93,3 @@ static int child_count;
86static int do_resize; 93static int do_resize;
94static int single_menu_mode;
87 95
@@ -105,2 +113,3 @@ static void init_wsize(void)
105 struct winsize ws; 113 struct winsize ws;
114 char *env;
106 115
@@ -112,2 +121,16 @@ static void init_wsize(void)
112 cols = ws.ws_col; 121 cols = ws.ws_col;
122 if (!rows) {
123 env = getenv("LINES");
124 if (env)
125 rows = atoi(env);
126 if (!rows)
127 rows = 24;
128 }
129 if (!cols) {
130 env = getenv("COLUMNS");
131 if (env)
132 cols = atoi(env);
133 if (!cols)
134 cols = 80;
135 }
113 } 136 }
@@ -276,2 +299,8 @@ static void build_conf(struct menu *menu)
276 cprint("m%p", menu); 299 cprint("m%p", menu);
300
301 if (single_menu_mode) {
302 cprint1("%s%*c%s",
303 menu->data ? "-->" : "++>",
304 indent + 1, ' ', prompt);
305 } else {
277 if (menu->parent != &rootmenu) 306 if (menu->parent != &rootmenu)
@@ -279,3 +308,7 @@ static void build_conf(struct menu *menu)
279 cprint1("%s --->", prompt); 308 cprint1("%s --->", prompt);
309 }
310
280 cprint_done(); 311 cprint_done();
312 if (single_menu_mode && menu->data)
313 goto conf_childs;
281 return; 314 return;
@@ -394,2 +427,3 @@ static void conf(struct menu *menu)
394 427
428 unlink("lxdialog.scrltmp");
395 active_entry[0] = 0; 429 active_entry[0] = 0;
@@ -444,2 +478,5 @@ static void conf(struct menu *menu)
444 case 'm': 478 case 'm':
479 if (single_menu_mode)
480 submenu->data = (void *) !submenu->data;
481 else
445 conf(submenu); 482 conf(submenu);
@@ -486,2 +523,4 @@ static void conf(struct menu *menu)
486 sym_toggle_tristate_value(sym); 523 sym_toggle_tristate_value(sym);
524 else if (type == 'm')
525 conf(submenu);
487 break; 526 break;
@@ -520,6 +559,14 @@ static void show_help(struct menu *menu)
520 const char *help; 559 const char *help;
560 char *helptext;
561 struct symbol *sym = menu->sym;
521 562
522 help = menu->sym->help; 563 help = sym->help;
523 if (!help) 564 if (!help)
524 help = nohelp_text; 565 help = nohelp_text;
566 if (sym->name) {
567 helptext = malloc(strlen(sym->name) + strlen(help) + 16);
568 sprintf(helptext, "CONFIG_%s:\n\n%s", sym->name, help);
569 show_helptext(menu_get_prompt(menu), helptext);
570 free(helptext);
571 } else
525 show_helptext(menu_get_prompt(menu), help); 572 show_helptext(menu_get_prompt(menu), help);
@@ -633,3 +680,3 @@ static void conf_load(void)
633 cprint("55"); 680 cprint("55");
634 cprint("%s", conf_filename); 681 cprint("%s", filename);
635 stat = exec_conf(); 682 stat = exec_conf();
@@ -662,3 +709,3 @@ static void conf_save(void)
662 cprint("55"); 709 cprint("55");
663 cprint("%s", conf_filename); 710 cprint("%s", filename);
664 stat = exec_conf(); 711 stat = exec_conf();
@@ -681,5 +728,15 @@ static void conf_save(void)
681 728
729static void conf_cleanup(void)
730{
731 tcsetattr(1, TCSAFLUSH, &ios_org);
732 unlink(".help.tmp");
733 unlink("lxdialog.scrltmp");
734}
735
682int main(int ac, char **av) 736int main(int ac, char **av)
683{ 737{
738 struct symbol *sym;
739 char *mode;
684 int stat; 740 int stat;
741
685 conf_parse(av[1]); 742 conf_parse(av[1]);
@@ -687,4 +744,15 @@ int main(int ac, char **av)
687 744
688 sprintf(menu_backtitle, "Configuration"); 745 sym = sym_lookup("KERNELRELEASE", 0);
746 sym_calc_value(sym);
747 sprintf(menu_backtitle, "Linux Kernel v%s Configuration",
748 sym_get_string_value(sym));
749
750 mode = getenv("MENUCONFIG_MODE");
751 if (mode) {
752 if (!strcasecmp(mode, "single_menu"))
753 single_menu_mode = 1;
754 }
689 755
756 tcgetattr(1, &ios_org);
757 atexit(conf_cleanup);
690 init_wsize(); 758 init_wsize();
@@ -704,6 +772,7 @@ int main(int ac, char **av)
704 printf("\n\n" 772 printf("\n\n"
705 "*** End of configuration.\n" 773 "*** End of Linux kernel configuration.\n"
706 "*** Check the top-level Makefile for additional configuration.\n"); 774 "*** Check the top-level Makefile for additional configuration.\n"
775 "*** Next, you may run 'make bzImage', 'make bzdisk', or 'make install'.\n\n");
707 } else 776 } else
708 printf("\n\nYour configuration changes were NOT saved.\n\n"); 777 printf("\n\nYour kernel configuration changes were NOT saved.\n\n");
709 778
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c
index 4595110..24be0ec 100644
--- a/scripts/kconfig/menu.c
+++ b/scripts/kconfig/menu.c
@@ -292,3 +292,3 @@ int file_write_dep(const char *name)
292 if (!name) 292 if (!name)
293 name = "..config.cmd"; 293 name = ".config.cmd";
294 out = fopen("..config.tmp", "w"); 294 out = fopen("..config.tmp", "w");
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc
index feefa1c..bed541d 100644
--- a/scripts/kconfig/qconf.cc
+++ b/scripts/kconfig/qconf.cc
@@ -19,2 +19,6 @@
19#include <qregexp.h> 19#include <qregexp.h>
20#if QT_VERSION >= 300
21#include <qsettings.h>
22#endif
23
20#include <stdlib.h> 24#include <stdlib.h>
@@ -28,2 +32,5 @@
28static QApplication *configApp; 32static QApplication *configApp;
33#if QT_VERSION >= 300
34static QSettings *configSettings;
35#endif
29 36
@@ -75,5 +82,13 @@ static void updateMenuList(P* parent, struct menu* menu)
75 if (!item || item->menu != child) 82 if (!item || item->menu != child)
76 item = new ConfigItem(parent, last, child); 83 item = new ConfigItem(parent, last, child, visible);
84 else {
77 item->visible = visible; 85 item->visible = visible;
86 if (item->updateNeeded()) {
87 ConfigItem* i = (ConfigItem*)child->data;
88 for (; i; i = i->nextItem) {
89 i->updateMenu();
90 }
91 } else if (list->updateAll)
78 item->updateMenu(); 92 item->updateMenu();
93 }
79 94
@@ -122,10 +137,4 @@ void ConfigItem::updateMenu(void)
122 tristate expr; 137 tristate expr;
123 bool update;
124 138
125 list = listView(); 139 list = listView();
126 update = doInit;
127 if (update)
128 doInit = false;
129 else
130 update = list->updateAll;
131 140
@@ -133,3 +142,2 @@ void ConfigItem::updateMenu(void)
133 if (!sym) { 142 if (!sym) {
134 if (update) {
135 setText(promptColIdx, menu_get_prompt(menu)); 143 setText(promptColIdx, menu_get_prompt(menu));
@@ -141,3 +149,2 @@ void ConfigItem::updateMenu(void)
141 setPixmap(promptColIdx, 0); 149 setPixmap(promptColIdx, 0);
142 }
143 return; 150 return;
@@ -145,9 +152,3 @@ void ConfigItem::updateMenu(void)
145 152
146 sym_calc_value(sym); 153 setText(nameColIdx, sym->name);
147 if (!(sym->flags & SYMBOL_CHANGED) && !update)
148 return;
149
150 sym->flags &= ~SYMBOL_CHANGED;
151
152 setText(nameColIdx, menu->sym->name);
153 154
@@ -206,3 +207,5 @@ void ConfigItem::updateMenu(void)
206#if QT_VERSION >= 300 207#if QT_VERSION >= 300
207 setRenameEnabled(list->mapIdx(dataColIdx), TRUE); 208 int i = list->mapIdx(dataColIdx);
209 if (i >= 0)
210 setRenameEnabled(i, TRUE);
208#endif 211#endif
@@ -220,2 +223,14 @@ void ConfigItem::updateMenu(void)
220 223
224bool ConfigItem::updateNeeded(void)
225{
226 struct symbol* sym = menu->sym;
227 if (sym)
228 sym_calc_value(sym);
229 if (menu->flags & MENU_CHANGED) {
230 menu->flags &= ~MENU_CHANGED;
231 return true;
232 }
233 return false;
234}
235
221void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) 236void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align)
@@ -239,9 +254,10 @@ void ConfigItem::init(void)
239 ConfigList* list = listView(); 254 ConfigList* list = listView();
240#if QT_VERSION < 300 255 nextItem = (ConfigItem*)menu->data;
241 visible = TRUE; 256 menu->data = this;
242#endif 257
243 //menu->data = this;
244 if (list->mode != fullMode) 258 if (list->mode != fullMode)
245 setOpen(TRUE); 259 setOpen(TRUE);
246 doInit= true; 260 if (menu->sym)
261 sym_calc_value(menu->sym);
262 updateMenu();
247} 263}
@@ -253,3 +269,9 @@ ConfigItem::~ConfigItem(void)
253{ 269{
254 //menu->data = 0; 270 ConfigItem** ip = &(ConfigItem*)menu->data;
271 for (; *ip; ip = &(*ip)->nextItem) {
272 if (*ip == this) {
273 *ip = nextItem;
274 break;
275 }
276 }
255} 277}
@@ -275,3 +297,3 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
275 sym_set_string_value(item->menu->sym, text().latin1()); 297 sym_set_string_value(item->menu->sym, text().latin1());
276 emit lineChanged(item); 298 parent()->updateList(item);
277 break; 299 break;
@@ -282,2 +304,3 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
282 e->accept(); 304 e->accept();
305 parent()->list->setFocus();
283 hide(); 306 hide();
@@ -285,3 +308,3 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e)
285 308
286ConfigList::ConfigList(QWidget* p, ConfigView* cv) 309ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv)
287 : Parent(p), cview(cv), 310 : Parent(p), cview(cv),
@@ -354,2 +377,3 @@ void ConfigList::updateList(ConfigItem* item)
354 updateMenuList(this, rootEntry); 377 updateMenuList(this, rootEntry);
378 triggerUpdate();
355} 379}
@@ -384,3 +408,3 @@ void ConfigList::setValue(ConfigItem* item, tristate val)
384 item->setOpen(TRUE); 408 item->setOpen(TRUE);
385 emit symbolChanged(item); 409 parent()->updateList(item);
386 break; 410 break;
@@ -416,3 +440,3 @@ void ConfigList::changeValue(ConfigItem* item)
416 if (oldexpr != newexpr) 440 if (oldexpr != newexpr)
417 emit symbolChanged(item); 441 parent()->updateList(item);
418 break; 442 break;
@@ -426,3 +450,3 @@ void ConfigList::changeValue(ConfigItem* item)
426#endif 450#endif
427 lineEdit->show(item); 451 parent()->lineEdit->show(item);
428 break; 452 break;
@@ -518,3 +542,3 @@ void ConfigList::contentsMousePressEvent(QMouseEvent* e)
518 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); 542 //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y());
519 QListView::contentsMousePressEvent(e); 543 Parent::contentsMousePressEvent(e);
520} 544}
@@ -565,3 +589,3 @@ skip:
565 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); 589 //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y());
566 QListView::contentsMouseReleaseEvent(e); 590 Parent::contentsMouseReleaseEvent(e);
567} 591}
@@ -572,3 +596,3 @@ void ConfigList::contentsMouseMoveEvent(QMouseEvent* e)
572 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); 596 //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y());
573 QListView::contentsMouseMoveEvent(e); 597 Parent::contentsMouseMoveEvent(e);
574} 598}
@@ -589,2 +613,4 @@ void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e)
589 emit menuSelected(menu); 613 emit menuSelected(menu);
614 else if (menu->sym)
615 changeValue(item);
590 616
@@ -592,3 +618,3 @@ skip:
592 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); 618 //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y());
593 QListView::contentsMouseDoubleClickEvent(e); 619 Parent::contentsMouseDoubleClickEvent(e);
594} 620}
@@ -607,2 +633,43 @@ void ConfigList::focusInEvent(QFocusEvent *e)
607 633
634ConfigView* ConfigView::viewList;
635
636ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview)
637 : Parent(parent)
638{
639 list = new ConfigList(this, cview);
640 lineEdit = new ConfigLineEdit(this);
641 lineEdit->hide();
642
643 this->nextView = viewList;
644 viewList = this;
645}
646
647ConfigView::~ConfigView(void)
648{
649 ConfigView** vp;
650
651 for (vp = &viewList; *vp; vp = &(*vp)->nextView) {
652 if (*vp == this) {
653 *vp = nextView;
654 break;
655 }
656 }
657}
658
659void ConfigView::updateList(ConfigItem* item)
660{
661 ConfigView* v;
662
663 for (v = viewList; v; v = v->nextView)
664 v->list->updateList(item);
665}
666
667void ConfigView::updateListAll(void)
668{
669 ConfigView* v;
670
671 for (v = viewList; v; v = v->nextView)
672 v->list->updateListAll();
673}
674
608/* 675/*
@@ -610,4 +677,5 @@ void ConfigList::focusInEvent(QFocusEvent *e)
610 */ 677 */
611ConfigView::ConfigView(void) 678ConfigMainWindow::ConfigMainWindow(void)
612{ 679{
680 ConfigView* view;
613 QMenuBar* menu; 681 QMenuBar* menu;
@@ -615,2 +683,21 @@ ConfigView::ConfigView(void)
615 QSplitter* split2; 683 QSplitter* split2;
684 bool ok;
685 int x, y, width, height;
686
687 QWidget *d = configApp->desktop();
688
689#if QT_VERSION >= 300
690 width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64);
691 height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64);
692 resize(width, height);
693 x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok);
694 if (ok)
695 y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok);
696 if (ok)
697 move(x, y);
698#else
699 width = d->width() - 64;
700 height = d->height() - 64;
701 resize(width, height);
702#endif
616 703
@@ -622,3 +709,4 @@ ConfigView::ConfigView(void)
622 709
623 menuList = new ConfigList(split1, this); 710 view = new ConfigView(split1, this);
711 menuList = view->list;
624 712
@@ -628,12 +716,4 @@ ConfigView::ConfigView(void)
628 // create config tree 716 // create config tree
629 QVBox* box = new QVBox(split2); 717 view = new ConfigView(split2, this);
630 configList = new ConfigList(box, this); 718 configList = view->list;
631 configList->lineEdit = new ConfigLineEdit(box);
632 configList->lineEdit->hide();
633 configList->connect(configList, SIGNAL(symbolChanged(ConfigItem*)),
634 configList, SLOT(updateList(ConfigItem*)));
635 configList->connect(configList, SIGNAL(symbolChanged(ConfigItem*)),
636 menuList, SLOT(updateList(ConfigItem*)));
637 configList->connect(configList->lineEdit, SIGNAL(lineChanged(ConfigItem*)),
638 SLOT(updateList(ConfigItem*)));
639 719
@@ -687,2 +767,7 @@ ConfigView::ConfigView(void)
687 767
768 QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this);
769 connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro()));
770 QAction *showAboutAction = new QAction(NULL, "About", 0, this);
771 connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout()));
772
688 // init tool bar 773 // init tool bar
@@ -716,2 +801,9 @@ ConfigView::ConfigView(void)
716 801
802 // create help menu
803 QPopupMenu* helpMenu = new QPopupMenu(this);
804 menu->insertSeparator();
805 menu->insertItem("&Help", helpMenu);
806 showIntroAction->addTo(helpMenu);
807 showAboutAction->addTo(helpMenu);
808
717 connect(configList, SIGNAL(menuSelected(struct menu *)), 809 connect(configList, SIGNAL(menuSelected(struct menu *)),
@@ -771,3 +863,3 @@ static void expr_print_help(void *data, const char *str)
771 */ 863 */
772void ConfigView::setHelp(QListViewItem* item) 864void ConfigMainWindow::setHelp(QListViewItem* item)
773{ 865{
@@ -776,3 +868,3 @@ void ConfigView::setHelp(QListViewItem* item)
776 868
777 configList->lineEdit->hide(); 869 configList->parent()->lineEdit->hide();
778 if (item) { 870 if (item) {
@@ -859,3 +951,3 @@ void ConfigView::setHelp(QListViewItem* item)
859 951
860void ConfigView::loadConfig(void) 952void ConfigMainWindow::loadConfig(void)
861{ 953{
@@ -866,5 +958,6 @@ void ConfigView::loadConfig(void)
866 QMessageBox::information(this, "qconf", "Unable to load configuration!"); 958 QMessageBox::information(this, "qconf", "Unable to load configuration!");
959 ConfigView::updateListAll();
867} 960}
868 961
869void ConfigView::saveConfig(void) 962void ConfigMainWindow::saveConfig(void)
870{ 963{
@@ -874,3 +967,3 @@ void ConfigView::saveConfig(void)
874 967
875void ConfigView::saveConfigAs(void) 968void ConfigMainWindow::saveConfigAs(void)
876{ 969{
@@ -883,3 +976,3 @@ void ConfigView::saveConfigAs(void)
883 976
884void ConfigView::changeMenu(struct menu *menu) 977void ConfigMainWindow::changeMenu(struct menu *menu)
885{ 978{
@@ -889,3 +982,3 @@ void ConfigView::changeMenu(struct menu *menu)
889 982
890void ConfigView::listFocusChanged(void) 983void ConfigMainWindow::listFocusChanged(void)
891{ 984{
@@ -900,3 +993,3 @@ void ConfigView::listFocusChanged(void)
900 993
901void ConfigView::goBack(void) 994void ConfigMainWindow::goBack(void)
902{ 995{
@@ -917,3 +1010,3 @@ void ConfigView::goBack(void)
917 1010
918void ConfigView::showSingleView(void) 1011void ConfigMainWindow::showSingleView(void)
919{ 1012{
@@ -930,3 +1023,3 @@ void ConfigView::showSingleView(void)
930 1023
931void ConfigView::showSplitView(void) 1024void ConfigMainWindow::showSplitView(void)
932{ 1025{
@@ -946,3 +1039,3 @@ void ConfigView::showSplitView(void)
946 1039
947void ConfigView::showFullView(void) 1040void ConfigMainWindow::showFullView(void)
948{ 1041{
@@ -959,3 +1052,3 @@ void ConfigView::showFullView(void)
959 1052
960void ConfigView::setShowAll(bool b) 1053void ConfigMainWindow::setShowAll(bool b)
961{ 1054{
@@ -969,3 +1062,3 @@ void ConfigView::setShowAll(bool b)
969 1062
970void ConfigView::setShowDebug(bool b) 1063void ConfigMainWindow::setShowDebug(bool b)
971{ 1064{
@@ -976,3 +1069,3 @@ void ConfigView::setShowDebug(bool b)
976 1069
977void ConfigView::setShowName(bool b) 1070void ConfigMainWindow::setShowName(bool b)
978{ 1071{
@@ -984,3 +1077,3 @@ void ConfigView::setShowName(bool b)
984 1077
985void ConfigView::setShowRange(bool b) 1078void ConfigMainWindow::setShowRange(bool b)
986{ 1079{
@@ -992,3 +1085,3 @@ void ConfigView::setShowRange(bool b)
992 1085
993void ConfigView::setShowData(bool b) 1086void ConfigMainWindow::setShowData(bool b)
994{ 1087{
@@ -1004,3 +1097,3 @@ void ConfigView::setShowData(bool b)
1004 */ 1097 */
1005void ConfigView::closeEvent(QCloseEvent* e) 1098void ConfigMainWindow::closeEvent(QCloseEvent* e)
1006{ 1099{
@@ -1027,2 +1120,27 @@ void ConfigView::closeEvent(QCloseEvent* e)
1027 1120
1121void ConfigMainWindow::showIntro(void)
1122{
1123 static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n"
1124 "For each option, a blank box indicates the feature is disabled, a check\n"
1125 "indicates it is enabled, and a dot indicates that it is to be compiled\n"
1126 "as a module. Clicking on the box will cycle through the three states.\n\n"
1127 "If you do not see an option (e.g., a device driver) that you believe\n"
1128 "should be present, try turning on Show All Options under the Options menu.\n"
1129 "Although there is no cross reference yet to help you figure out what other\n"
1130 "options must be enabled to support the option you are interested in, you can\n"
1131 "still view the help of a grayed-out option.\n\n"
1132 "Toggling Show Debug Info under the Options menu will show the dependencies,\n"
1133 "which you can then match by examining other options.\n\n";
1134
1135 QMessageBox::information(this, "qconf", str);
1136}
1137
1138void ConfigMainWindow::showAbout(void)
1139{
1140 static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n"
1141 "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n";
1142
1143 QMessageBox::information(this, "qconf", str);
1144}
1145
1028void fixup_rootmenu(struct menu *menu) 1146void fixup_rootmenu(struct menu *menu)
@@ -1040,3 +1158,3 @@ int main(int ac, char** av)
1040{ 1158{
1041 ConfigView* v; 1159 ConfigMainWindow* v;
1042 const char *name; 1160 const char *name;
@@ -1048,2 +1166,5 @@ int main(int ac, char** av)
1048 configApp = new QApplication(ac, av); 1166 configApp = new QApplication(ac, av);
1167#if QT_VERSION >= 300
1168 configSettings = new QSettings;
1169#endif
1049 if (ac > 1 && av[1][0] == '-') { 1170 if (ac > 1 && av[1][0] == '-') {
@@ -1065,3 +1186,4 @@ int main(int ac, char** av)
1065 //zconfdump(stdout); 1186 //zconfdump(stdout);
1066 v = new ConfigView(); 1187
1188 v = new ConfigMainWindow();
1067 1189
@@ -1071,2 +1193,10 @@ int main(int ac, char** av)
1071 configApp->exec(); 1193 configApp->exec();
1194
1195#if QT_VERSION >= 300
1196 configSettings->writeEntry("/kconfig/qconf/window x", v->pos().x());
1197 configSettings->writeEntry("/kconfig/qconf/window y", v->pos().y());
1198 configSettings->writeEntry("/kconfig/qconf/window width", v->size().width());
1199 configSettings->writeEntry("/kconfig/qconf/window height", v->size().height());
1200 delete configSettings;
1201#endif
1072 return 0; 1202 return 0;
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h
index f8f3669..6f096b4 100644
--- a/scripts/kconfig/qconf.h
+++ b/scripts/kconfig/qconf.h
@@ -7,5 +7,23 @@
7 7
8class ConfigLineEdit; 8class ConfigList;
9class ConfigItem; 9class ConfigItem;
10class ConfigView; 10class ConfigLineEdit;
11class ConfigMainWindow;
12
13class ConfigView : public QVBox {
14 Q_OBJECT
15 typedef class QVBox Parent;
16public:
17 ConfigView(QWidget* parent, ConfigMainWindow* cview);
18 ~ConfigView(void);
19 static void updateList(ConfigItem* item);
20 static void updateListAll(void);
21
22public:
23 ConfigList* list;
24 ConfigLineEdit* lineEdit;
25
26 static ConfigView* viewList;
27 ConfigView* nextView;
28};
11 29
@@ -22,8 +40,11 @@ class ConfigList : public QListView {
22public: 40public:
23 ConfigList(QWidget* p, ConfigView* cview); 41 ConfigList(ConfigView* p, ConfigMainWindow* cview);
24 void reinit(void); 42 void reinit(void);
43 ConfigView* parent(void) const
44 {
45 return (ConfigView*)Parent::parent();
46 }
25 47
26 ConfigLineEdit* lineEdit;
27protected: 48protected:
28 ConfigView* cview; 49 ConfigMainWindow* cview;
29 50
@@ -45,3 +66,2 @@ signals:
45 void parentSelected(void); 66 void parentSelected(void);
46 void symbolChanged(ConfigItem* item);
47 void gotFocus(void); 67 void gotFocus(void);
@@ -102,4 +122,4 @@ class ConfigItem : public QListViewItem {
102public: 122public:
103 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m) 123 ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v)
104 : Parent(parent, after), menu(m) 124 : Parent(parent, after), menu(m), visible(v)
105 { 125 {
@@ -107,4 +127,4 @@ public:
107 } 127 }
108 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m) 128 ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v)
109 : Parent(parent, after), menu(m) 129 : Parent(parent, after), menu(m), visible(v)
110 { 130 {
@@ -118,2 +138,3 @@ public:
118 void updateMenu(void); 138 void updateMenu(void);
139 bool updateNeeded(void);
119 ConfigList* listView() const 140 ConfigList* listView() const
@@ -148,5 +169,5 @@ public:
148 169
170 ConfigItem* nextItem;
149 struct menu *menu; 171 struct menu *menu;
150 bool visible; 172 bool visible;
151 bool doInit;
152}; 173};
@@ -157,9 +178,11 @@ class ConfigLineEdit : public QLineEdit {
157public: 178public:
158 ConfigLineEdit(QWidget * parent) 179 ConfigLineEdit(ConfigView* parent)
159 : QLineEdit(parent) 180 : Parent(parent)
160 { } 181 { }
182 ConfigView* parent(void) const
183 {
184 return (ConfigView*)Parent::parent();
185 }
161 void show(ConfigItem *i); 186 void show(ConfigItem *i);
162 void keyPressEvent(QKeyEvent *e); 187 void keyPressEvent(QKeyEvent *e);
163signals:
164 void lineChanged(ConfigItem *item);
165 188
@@ -169,6 +192,6 @@ public:
169 192
170class ConfigView : public QMainWindow { 193class ConfigMainWindow : public QMainWindow {
171 Q_OBJECT 194 Q_OBJECT
172public: 195public:
173 ConfigView(void); 196 ConfigMainWindow(void);
174public slots: 197public slots:
@@ -189,2 +212,4 @@ public slots:
189 void setShowData(bool); 212 void setShowData(bool);
213 void showIntro(void);
214 void showAbout(void);
190 215
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c
index 59c88d2..845d8a3 100644
--- a/scripts/kconfig/symbol.c
+++ b/scripts/kconfig/symbol.c
@@ -151,3 +151,3 @@ void sym_calc_visibility(struct symbol *sym)
151 sym->visible = visible; 151 sym->visible = visible;
152 sym->flags |= SYMBOL_CHANGED; 152 sym_set_changed(sym);
153 } 153 }
@@ -206,3 +206,4 @@ void sym_calc_value(struct symbol *sym)
206 } 206 }
207 } 207 } else
208 S_TRI(newval) = S_TRI(sym->def);
208 } else 209 } else
@@ -278,3 +279,3 @@ out:
278 if (memcmp(&oldval, &newval, sizeof(newval))) 279 if (memcmp(&oldval, &newval, sizeof(newval)))
279 sym->flags |= SYMBOL_CHANGED; 280 sym_set_changed(sym);
280 sym->curr = newval; 281 sym->curr = newval;
@@ -284,4 +285,7 @@ out:
284 prop = sym_get_choice_prop(sym); 285 prop = sym_get_choice_prop(sym);
285 for (e = prop->dep; e; e = e->left.expr) 286 for (e = prop->dep; e; e = e->left.expr) {
286 e->right.sym->flags |= flags; 287 e->right.sym->flags |= flags;
288 if (flags & SYMBOL_CHANGED)
289 sym_set_changed(e->right.sym);
290 }
287 } 291 }
@@ -299,2 +303,13 @@ void sym_clear_all_valid(void)
299 303
304void sym_set_changed(struct symbol *sym)
305{
306 struct property *prop;
307
308 sym->flags |= SYMBOL_CHANGED;
309 for (prop = sym->prop; prop; prop = prop->next) {
310 if (prop->menu)
311 prop->menu->flags |= MENU_CHANGED;
312 }
313}
314
300void sym_set_all_changed(void) 315void sym_set_all_changed(void)
@@ -305,3 +320,3 @@ void sym_set_all_changed(void)
305 for_all_symbols(i, sym) 320 for_all_symbols(i, sym)
306 sym->flags |= SYMBOL_CHANGED; 321 sym_set_changed(sym);
307} 322}
@@ -342,3 +357,3 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
342 sym->flags &= ~SYMBOL_NEW; 357 sym->flags &= ~SYMBOL_NEW;
343 sym->flags |= SYMBOL_CHANGED; 358 sym_set_changed(sym);
344 } 359 }
@@ -462,3 +477,3 @@ bool sym_set_string_value(struct symbol *sym, const char *newval)
462 sym->flags &= ~SYMBOL_NEW; 477 sym->flags &= ~SYMBOL_NEW;
463 sym->flags |= SYMBOL_CHANGED; 478 sym_set_changed(sym);
464 } 479 }
@@ -527,3 +542,2 @@ struct symbol *sym_lookup(const char *name, int isconst)
527 542
528 //printf("lookup: %s -> ", name);
529 if (name) { 543 if (name) {
@@ -543,4 +557,3 @@ struct symbol *sym_lookup(const char *name, int isconst)
543 if ((isconst && symbol->flags & SYMBOL_CONST) || 557 if ((isconst && symbol->flags & SYMBOL_CONST) ||
544 (!isconst && !(symbol->flags & SYMBOL_CONST))) { 558 (!isconst && !(symbol->flags & SYMBOL_CONST)))
545 //printf("h:%p\n", symbol);
546 return symbol; 559 return symbol;
@@ -548,3 +561,2 @@ struct symbol *sym_lookup(const char *name, int isconst)
548 } 561 }
549 }
550 new_name = strdup(name); 562 new_name = strdup(name);
@@ -566,3 +578,2 @@ struct symbol *sym_lookup(const char *name, int isconst)
566 578
567 //printf("n:%p\n", symbol);
568 return symbol; 579 return symbol;
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l
index 6d81e5e..1471630 100644
--- a/scripts/kconfig/zconf.l
+++ b/scripts/kconfig/zconf.l
@@ -1,2 +1,2 @@
1%option backup nostdinit noyywrap full ecs 1%option backup nostdinit noyywrap never-interactive full ecs
2%option 8bit backup nodefault perf-report perf-report 2%option 8bit backup nodefault perf-report perf-report
@@ -9,2 +9,3 @@
9 9
10#include <limits.h>
10#include <stdio.h> 11#include <stdio.h>
@@ -16,3 +17,2 @@
16#include "lkc.h" 17#include "lkc.h"
17#include "zconf.tab.h"
18 18
@@ -85,4 +85,2 @@ n [A-Za-z0-9_]
85 unput(yytext[0]); 85 unput(yytext[0]);
86 //printf("new config: ");
87 //symbol_end(NULL);
88 BEGIN(COMMAND); 86 BEGIN(COMMAND);
@@ -145,3 +143,7 @@ n [A-Za-z0-9_]
145 } 143 }
144 \\\ncurrent_file->lineno++;
146 . 145 .
146 <<EOF>> {
147 BEGIN(INITIAL);
148 }
147} 149}
@@ -149,5 +151,18 @@ n [A-Za-z0-9_]
149<STRING>{ 151<STRING>{
150 [^'"\n\\]+{ 152 [^'"\\\n]+/\n{
153 append_string(yytext, yyleng);
154 zconflval.string = text;
155 return T_STRING;
156 }
157 [^'"\\\n]+{
151 append_string(yytext, yyleng); 158 append_string(yytext, yyleng);
152 } 159 }
160 \\.?/\n{
161 append_string(yytext + 1, yyleng - 1);
162 zconflval.string = text;
163 return T_STRING;
164 }
165 \\.?{
166 append_string(yytext + 1, yyleng - 1);
167 }
153 \'|\"{ 168 \'|\"{
@@ -156,3 +171,2 @@ n [A-Za-z0-9_]
156 zconflval.string = text; 171 zconflval.string = text;
157 //printf("s:%s\n", text);
158 return T_STRING; 172 return T_STRING;
@@ -161,12 +175,10 @@ n [A-Za-z0-9_]
161 } 175 }
162 \\[ \t]*\nappend_string(yytext+yyleng-1, 1); current_file->lineno++;
163 \\[ \t]*append_string(yytext+1, yyleng-1);
164 \\. append_string(yytext+1, 1);
165 \n{ 176 \n{
166 //printf(":%d: open string!\n", current_file->lineno+1); 177 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
167 exit(0); 178 current_file->lineno++;
179 BEGIN(INITIAL);
180 return T_EOL;
168 } 181 }
169 <<EOF>>{ 182 <<EOF>>{
170 //printf(":%d: open string!\n", current_file->lineno+1); 183 BEGIN(INITIAL);
171 exit(0);
172 } 184 }
@@ -223,2 +235,3 @@ n [A-Za-z0-9_]
223 } 235 }
236 fclose(yyin);
224 yyterminate(); 237 yyterminate();
@@ -240,5 +253,30 @@ static void zconf_endhelp(void)
240 253
254
255/*
256 * Try to open specified file with following names:
257 * ./name
258 * $(srctree)/name
259 * The latter is used when srctree is separate from objtree
260 * when compiling the kernel.
261 * Return NULL if file is not found.
262 */
263FILE *zconf_fopen(const char *name)
264{
265 char *env, fullname[PATH_MAX+1];
266 FILE *f;
267
268 f = fopen(name, "r");
269 if (!f && name[0] != '/') {
270 env = getenv(SRCTREE);
271 if (env) {
272 sprintf(fullname, "%s/%s", env, name);
273 f = fopen(fullname, "r");
274 }
275 }
276 return f;
277}
278
241void zconf_initscan(const char *name) 279void zconf_initscan(const char *name)
242{ 280{
243 yyin = fopen(name, "r"); 281 yyin = zconf_fopen(name);
244 if (!yyin) { 282 if (!yyin) {
@@ -247,3 +285,2 @@ void zconf_initscan(const char *name)
247 } 285 }
248 //fprintf(stderr, "zconf_initscan: %s\n", name);
249 286
@@ -264,3 +301,3 @@ void zconf_nextfile(const char *name)
264 current_buf->state = YY_CURRENT_BUFFER; 301 current_buf->state = YY_CURRENT_BUFFER;
265 yyin = fopen(name, "r"); 302 yyin = zconf_fopen(name);
266 if (!yyin) { 303 if (!yyin) {
@@ -273,4 +310,2 @@ void zconf_nextfile(const char *name)
273 310
274 //fprintf(stderr, "zconf_nextfile: %s\n", name);
275
276 if (file->flags & FILE_BUSY) { 311 if (file->flags & FILE_BUSY) {
@@ -299,2 +334,3 @@ static struct buffer *zconf_endfile(void)
299 if (parent) { 334 if (parent) {
335 fclose(yyin);
300 yy_delete_buffer(YY_CURRENT_BUFFER); 336 yy_delete_buffer(YY_CURRENT_BUFFER);
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y
index c3f1bd0..996b10a 100644
--- a/scripts/kconfig/zconf.y
+++ b/scripts/kconfig/zconf.y
@@ -229,6 +229,5 @@ choice_option: T_OPTIONAL
229 229
230choice_option: T_DEFAULT symbol 230choice_option: T_DEFAULT symbol if_expr
231{ 231{
232 menu_add_prop(P_DEFAULT, NULL, $2, NULL); 232 menu_add_prop(P_DEFAULT, NULL, $2, $3);
233 //current_choice->prop->def = $2;
234 printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); 233 printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno());
@@ -247,3 +246,2 @@ if: T_IF expr
247 menu_add_entry(NULL); 246 menu_add_entry(NULL);
248 //current_entry->prompt = menu_add_prop(T_IF, NULL, NULL, $2);
249 menu_add_dep($2); 247 menu_add_dep($2);