diff options
Diffstat (limited to 'scripts/kconfig')
29 files changed, 2008 insertions, 1237 deletions
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore index 6a36a76e660..624f6502e03 100644 --- a/scripts/kconfig/.gitignore +++ b/scripts/kconfig/.gitignore | |||
@@ -17,6 +17,7 @@ gconf.glade.h | |||
17 | # | 17 | # |
18 | conf | 18 | conf |
19 | mconf | 19 | mconf |
20 | nconf | ||
20 | qconf | 21 | qconf |
21 | gconf | 22 | gconf |
22 | kxgettext | 23 | kxgettext |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 75bdf5ae202..368ae306aee 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -8,7 +8,7 @@ PHONY += oldconfig xconfig gconfig menuconfig config silentoldconfig update-po-c | |||
8 | ifdef KBUILD_KCONFIG | 8 | ifdef KBUILD_KCONFIG |
9 | Kconfig := $(KBUILD_KCONFIG) | 9 | Kconfig := $(KBUILD_KCONFIG) |
10 | else | 10 | else |
11 | Kconfig := arch/$(SRCARCH)/Kconfig | 11 | Kconfig := Kconfig |
12 | endif | 12 | endif |
13 | 13 | ||
14 | xconfig: $(obj)/qconf | 14 | xconfig: $(obj)/qconf |
@@ -21,44 +21,54 @@ menuconfig: $(obj)/mconf | |||
21 | $< $(Kconfig) | 21 | $< $(Kconfig) |
22 | 22 | ||
23 | config: $(obj)/conf | 23 | config: $(obj)/conf |
24 | $< $(Kconfig) | 24 | $< --oldaskconfig $(Kconfig) |
25 | 25 | ||
26 | nconfig: $(obj)/nconf | 26 | nconfig: $(obj)/nconf |
27 | $< $(Kconfig) | 27 | $< $(Kconfig) |
28 | 28 | ||
29 | oldconfig: $(obj)/conf | 29 | oldconfig: $(obj)/conf |
30 | $< -o $(Kconfig) | 30 | $< --$@ $(Kconfig) |
31 | 31 | ||
32 | silentoldconfig: $(obj)/conf | 32 | silentoldconfig: $(obj)/conf |
33 | $(Q)mkdir -p include/generated | 33 | $(Q)mkdir -p include/generated |
34 | $< -s $(Kconfig) | 34 | $< --$@ $(Kconfig) |
35 | |||
36 | # if no path is given, then use src directory to find file | ||
37 | ifdef LSMOD | ||
38 | LSMOD_F := $(LSMOD) | ||
39 | ifeq ($(findstring /,$(LSMOD)),) | ||
40 | LSMOD_F := $(objtree)/$(LSMOD) | ||
41 | endif | ||
42 | endif | ||
35 | 43 | ||
36 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 44 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf |
37 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config | 45 | $(Q)mkdir -p include/generated |
38 | $(Q)if [ -f .config ]; then \ | 46 | $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config |
39 | cmp -s .tmp.config .config || \ | 47 | $(Q)if [ -f .config ]; then \ |
40 | (mv -f .config .config.old.1; \ | 48 | cmp -s .tmp.config .config || \ |
41 | mv -f .tmp.config .config; \ | 49 | (mv -f .config .config.old.1; \ |
42 | $(obj)/conf -s $(Kconfig); \ | 50 | mv -f .tmp.config .config; \ |
43 | mv -f .config.old.1 .config.old) \ | 51 | $(obj)/conf --silentoldconfig $(Kconfig); \ |
44 | else \ | 52 | mv -f .config.old.1 .config.old) \ |
45 | mv -f .tmp.config .config; \ | 53 | else \ |
46 | $(obj)/conf -s $(Kconfig); \ | 54 | mv -f .tmp.config .config; \ |
55 | $(obj)/conf --silentoldconfig $(Kconfig); \ | ||
47 | fi | 56 | fi |
48 | $(Q)rm -f .tmp.config | 57 | $(Q)rm -f .tmp.config |
49 | 58 | ||
50 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | 59 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf |
51 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config | 60 | $(Q)mkdir -p include/generated |
61 | $(Q)perl $< $(srctree) $(Kconfig) $(LSMOD_F) > .tmp.config | ||
52 | $(Q)sed -i s/=m/=y/ .tmp.config | 62 | $(Q)sed -i s/=m/=y/ .tmp.config |
53 | $(Q)if [ -f .config ]; then \ | 63 | $(Q)if [ -f .config ]; then \ |
54 | cmp -s .tmp.config .config || \ | 64 | cmp -s .tmp.config .config || \ |
55 | (mv -f .config .config.old.1; \ | 65 | (mv -f .config .config.old.1; \ |
56 | mv -f .tmp.config .config; \ | 66 | mv -f .tmp.config .config; \ |
57 | $(obj)/conf -s $(Kconfig); \ | 67 | $(obj)/conf --silentoldconfig $(Kconfig); \ |
58 | mv -f .config.old.1 .config.old) \ | 68 | mv -f .config.old.1 .config.old) \ |
59 | else \ | 69 | else \ |
60 | mv -f .tmp.config .config; \ | 70 | mv -f .tmp.config .config; \ |
61 | $(obj)/conf -s $(Kconfig); \ | 71 | $(obj)/conf --silentoldconfig $(Kconfig); \ |
62 | fi | 72 | fi |
63 | $(Q)rm -f .tmp.config | 73 | $(Q)rm -f .tmp.config |
64 | 74 | ||
@@ -85,30 +95,29 @@ update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h | |||
85 | $(Q)rm -f arch/um/Kconfig.arch | 95 | $(Q)rm -f arch/um/Kconfig.arch |
86 | $(Q)rm -f $(obj)/config.pot | 96 | $(Q)rm -f $(obj)/config.pot |
87 | 97 | ||
88 | PHONY += randconfig allyesconfig allnoconfig allmodconfig defconfig | 98 | PHONY += allnoconfig allyesconfig allmodconfig alldefconfig randconfig |
89 | 99 | ||
90 | randconfig: $(obj)/conf | 100 | allnoconfig allyesconfig allmodconfig alldefconfig randconfig: $(obj)/conf |
91 | $< -r $(Kconfig) | 101 | $< --$@ $(Kconfig) |
92 | 102 | ||
93 | allyesconfig: $(obj)/conf | 103 | PHONY += listnewconfig oldnoconfig savedefconfig defconfig |
94 | $< -y $(Kconfig) | ||
95 | 104 | ||
96 | allnoconfig: $(obj)/conf | 105 | listnewconfig oldnoconfig: $(obj)/conf |
97 | $< -n $(Kconfig) | 106 | $< --$@ $(Kconfig) |
98 | 107 | ||
99 | allmodconfig: $(obj)/conf | 108 | savedefconfig: $(obj)/conf |
100 | $< -m $(Kconfig) | 109 | $< --$@=defconfig $(Kconfig) |
101 | 110 | ||
102 | defconfig: $(obj)/conf | 111 | defconfig: $(obj)/conf |
103 | ifeq ($(KBUILD_DEFCONFIG),) | 112 | ifeq ($(KBUILD_DEFCONFIG),) |
104 | $< -d $(Kconfig) | 113 | $< --defconfig $(Kconfig) |
105 | else | 114 | else |
106 | @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" | 115 | @echo "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" |
107 | $(Q)$< -D arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) | 116 | $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) |
108 | endif | 117 | endif |
109 | 118 | ||
110 | %_defconfig: $(obj)/conf | 119 | %_defconfig: $(obj)/conf |
111 | $(Q)$< -D arch/$(SRCARCH)/configs/$@ $(Kconfig) | 120 | $(Q)$< --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) |
112 | 121 | ||
113 | # Help text used by make help | 122 | # Help text used by make help |
114 | help: | 123 | help: |
@@ -121,22 +130,23 @@ help: | |||
121 | @echo ' localmodconfig - Update current config disabling modules not loaded' | 130 | @echo ' localmodconfig - Update current config disabling modules not loaded' |
122 | @echo ' localyesconfig - Update current config converting local mods to core' | 131 | @echo ' localyesconfig - Update current config converting local mods to core' |
123 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' | 132 | @echo ' silentoldconfig - Same as oldconfig, but quietly, additionally update deps' |
124 | @echo ' randconfig - New config with random answer to all options' | 133 | @echo ' defconfig - New config with default from ARCH supplied defconfig' |
125 | @echo ' defconfig - New config with default answer to all options' | 134 | @echo ' savedefconfig - Save current config as ./defconfig (minimal config)' |
126 | @echo ' allmodconfig - New config selecting modules when possible' | ||
127 | @echo ' allyesconfig - New config where all options are accepted with yes' | ||
128 | @echo ' allnoconfig - New config where all options are answered with no' | 135 | @echo ' allnoconfig - New config where all options are answered with no' |
136 | @echo ' allyesconfig - New config where all options are accepted with yes' | ||
137 | @echo ' allmodconfig - New config selecting modules when possible' | ||
138 | @echo ' alldefconfig - New config with all symbols set to default' | ||
139 | @echo ' randconfig - New config with random answer to all options' | ||
140 | @echo ' listnewconfig - List new options' | ||
141 | @echo ' oldnoconfig - Same as silentoldconfig but set new symbols to n (unset)' | ||
129 | 142 | ||
130 | # lxdialog stuff | 143 | # lxdialog stuff |
131 | check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh | 144 | check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh |
132 | 145 | ||
133 | # Use recursively expanded variables so we do not call gcc unless | 146 | # Use recursively expanded variables so we do not call gcc unless |
134 | # 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) |
135 | HOST_EXTRACFLAGS = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) | 148 | HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ |
136 | HOST_LOADLIBES = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | 149 | -DLOCALE |
137 | |||
138 | HOST_EXTRACFLAGS += -DLOCALE | ||
139 | |||
140 | 150 | ||
141 | # =========================================================================== | 151 | # =========================================================================== |
142 | # Shared Makefile for the various kconfig executables: | 152 | # Shared Makefile for the various kconfig executables: |
@@ -195,7 +205,7 @@ clean-files += config.pot linux.pot | |||
195 | PHONY += $(obj)/dochecklxdialog | 205 | PHONY += $(obj)/dochecklxdialog |
196 | $(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog | 206 | $(addprefix $(obj)/,$(lxdialog)): $(obj)/dochecklxdialog |
197 | $(obj)/dochecklxdialog: | 207 | $(obj)/dochecklxdialog: |
198 | $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOST_LOADLIBES) | 208 | $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf) |
199 | 209 | ||
200 | always := dochecklxdialog | 210 | always := dochecklxdialog |
201 | 211 | ||
@@ -209,10 +219,12 @@ HOSTCFLAGS_zconf.tab.o := -I$(src) | |||
209 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl | 219 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl |
210 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK | 220 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK |
211 | 221 | ||
212 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` | 222 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl |
213 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ | 223 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ |
214 | -D LKC_DIRECT_LINK | 224 | -D LKC_DIRECT_LINK |
215 | 225 | ||
226 | HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | ||
227 | |||
216 | HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses | 228 | HOSTLOADLIBES_nconf = -lmenu -lpanel -lncurses |
217 | $(obj)/qconf.o: $(obj)/.tmp_qtcheck | 229 | $(obj)/qconf.o: $(obj)/.tmp_qtcheck |
218 | 230 | ||
@@ -223,40 +235,48 @@ $(obj)/.tmp_qtcheck: $(src)/Makefile | |||
223 | # QT needs some extra effort... | 235 | # QT needs some extra effort... |
224 | $(obj)/.tmp_qtcheck: | 236 | $(obj)/.tmp_qtcheck: |
225 | @set -e; echo " CHECK qt"; dir=""; pkg=""; \ | 237 | @set -e; echo " CHECK qt"; dir=""; pkg=""; \ |
226 | pkg-config --exists qt 2> /dev/null && pkg=qt; \ | 238 | if ! pkg-config --exists QtCore 2> /dev/null; then \ |
227 | pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ | 239 | echo "* Unable to find the QT4 tool qmake. Trying to use QT3"; \ |
228 | if [ -n "$$pkg" ]; then \ | 240 | pkg-config --exists qt 2> /dev/null && pkg=qt; \ |
229 | cflags="\$$(shell pkg-config $$pkg --cflags)"; \ | 241 | pkg-config --exists qt-mt 2> /dev/null && pkg=qt-mt; \ |
230 | libs="\$$(shell pkg-config $$pkg --libs)"; \ | 242 | if [ -n "$$pkg" ]; then \ |
231 | moc="\$$(shell pkg-config $$pkg --variable=prefix)/bin/moc"; \ | 243 | cflags="\$$(shell pkg-config $$pkg --cflags)"; \ |
232 | 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; \ | ||
233 | else \ | 275 | else \ |
234 | for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ | 276 | cflags="\$$(shell pkg-config QtCore QtGui Qt3Support --cflags)"; \ |
235 | if [ -f $$d/include/qconfig.h ]; then dir=$$d; break; fi; \ | 277 | libs="\$$(shell pkg-config QtCore QtGui Qt3Support --libs)"; \ |
236 | done; \ | 278 | binpath="\$$(shell pkg-config QtCore --variable=prefix)"; \ |
237 | if [ -z "$$dir" ]; then \ | 279 | moc="$$binpath/bin/moc"; \ |
238 | echo "*"; \ | ||
239 | echo "* Unable to find the QT3 installation. Please make sure that"; \ | ||
240 | echo "* the QT3 development package is correctly installed and"; \ | ||
241 | echo "* either install pkg-config or set the QTDIR environment"; \ | ||
242 | echo "* variable to the correct location."; \ | ||
243 | echo "*"; \ | ||
244 | false; \ | ||
245 | fi; \ | ||
246 | libpath=$$dir/lib; lib=qt; osdir=""; \ | ||
247 | $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ | ||
248 | osdir=x$$($(HOSTCXX) -print-multi-os-directory); \ | ||
249 | test -d $$libpath/$$osdir && libpath=$$libpath/$$osdir; \ | ||
250 | test -f $$libpath/libqt-mt.so && lib=qt-mt; \ | ||
251 | cflags="-I$$dir/include"; \ | ||
252 | libs="-L$$libpath -Wl,-rpath,$$libpath -l$$lib"; \ | ||
253 | moc="$$dir/bin/moc"; \ | ||
254 | fi; \ | ||
255 | if [ ! -x $$dir/bin/moc -a -x /usr/bin/moc ]; then \ | ||
256 | echo "*"; \ | ||
257 | echo "* Unable to find $$dir/bin/moc, using /usr/bin/moc instead."; \ | ||
258 | echo "*"; \ | ||
259 | moc="/usr/bin/moc"; \ | ||
260 | fi; \ | 280 | fi; \ |
261 | echo "KC_QT_CFLAGS=$$cflags" > $@; \ | 281 | echo "KC_QT_CFLAGS=$$cflags" > $@; \ |
262 | echo "KC_QT_LIBS=$$libs" >> $@; \ | 282 | echo "KC_QT_LIBS=$$libs" >> $@; \ |
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 9960d1c303f..659326c3e89 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <string.h> | 10 | #include <string.h> |
11 | #include <time.h> | 11 | #include <time.h> |
12 | #include <unistd.h> | 12 | #include <unistd.h> |
13 | #include <getopt.h> | ||
13 | #include <sys/stat.h> | 14 | #include <sys/stat.h> |
14 | #include <sys/time.h> | 15 | #include <sys/time.h> |
15 | 16 | ||
@@ -19,16 +20,21 @@ | |||
19 | static void conf(struct menu *menu); | 20 | static void conf(struct menu *menu); |
20 | static void check_conf(struct menu *menu); | 21 | static void check_conf(struct menu *menu); |
21 | 22 | ||
22 | enum { | 23 | enum input_mode { |
23 | ask_all, | 24 | oldaskconfig, |
24 | ask_new, | 25 | silentoldconfig, |
25 | ask_silent, | 26 | oldconfig, |
26 | set_default, | 27 | allnoconfig, |
27 | set_yes, | 28 | allyesconfig, |
28 | set_mod, | 29 | allmodconfig, |
29 | set_no, | 30 | alldefconfig, |
30 | set_random | 31 | randconfig, |
31 | } input_mode = ask_all; | 32 | defconfig, |
33 | savedefconfig, | ||
34 | listnewconfig, | ||
35 | oldnoconfig, | ||
36 | } input_mode = oldaskconfig; | ||
37 | |||
32 | char *defconfig_file; | 38 | char *defconfig_file; |
33 | 39 | ||
34 | static int indent = 1; | 40 | static int indent = 1; |
@@ -93,16 +99,16 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
93 | } | 99 | } |
94 | 100 | ||
95 | switch (input_mode) { | 101 | switch (input_mode) { |
96 | case ask_new: | 102 | case oldconfig: |
97 | case ask_silent: | 103 | case silentoldconfig: |
98 | if (sym_has_value(sym)) { | 104 | if (sym_has_value(sym)) { |
99 | printf("%s\n", def); | 105 | printf("%s\n", def); |
100 | return 0; | 106 | return 0; |
101 | } | 107 | } |
102 | check_stdin(); | 108 | check_stdin(); |
103 | case ask_all: | 109 | case oldaskconfig: |
104 | fflush(stdout); | 110 | fflush(stdout); |
105 | fgets(line, 128, stdin); | 111 | xfgets(line, 128, stdin); |
106 | return 1; | 112 | return 1; |
107 | default: | 113 | default: |
108 | break; | 114 | break; |
@@ -156,14 +162,12 @@ static int conf_string(struct menu *menu) | |||
156 | static int conf_sym(struct menu *menu) | 162 | static int conf_sym(struct menu *menu) |
157 | { | 163 | { |
158 | struct symbol *sym = menu->sym; | 164 | struct symbol *sym = menu->sym; |
159 | int type; | ||
160 | tristate oldval, newval; | 165 | tristate oldval, newval; |
161 | 166 | ||
162 | while (1) { | 167 | while (1) { |
163 | printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); | 168 | printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); |
164 | if (sym->name) | 169 | if (sym->name) |
165 | printf("(%s) ", sym->name); | 170 | printf("(%s) ", sym->name); |
166 | type = sym_get_type(sym); | ||
167 | putchar('['); | 171 | putchar('['); |
168 | oldval = sym_get_tristate_value(sym); | 172 | oldval = sym_get_tristate_value(sym); |
169 | switch (oldval) { | 173 | switch (oldval) { |
@@ -228,11 +232,9 @@ static int conf_choice(struct menu *menu) | |||
228 | { | 232 | { |
229 | struct symbol *sym, *def_sym; | 233 | struct symbol *sym, *def_sym; |
230 | struct menu *child; | 234 | struct menu *child; |
231 | int type; | ||
232 | bool is_new; | 235 | bool is_new; |
233 | 236 | ||
234 | sym = menu->sym; | 237 | sym = menu->sym; |
235 | type = sym_get_type(sym); | ||
236 | is_new = !sym_has_value(sym); | 238 | is_new = !sym_has_value(sym); |
237 | if (sym_is_changable(sym)) { | 239 | if (sym_is_changable(sym)) { |
238 | conf_sym(menu); | 240 | conf_sym(menu); |
@@ -294,17 +296,17 @@ static int conf_choice(struct menu *menu) | |||
294 | printf("?"); | 296 | printf("?"); |
295 | printf("]: "); | 297 | printf("]: "); |
296 | switch (input_mode) { | 298 | switch (input_mode) { |
297 | case ask_new: | 299 | case oldconfig: |
298 | case ask_silent: | 300 | case silentoldconfig: |
299 | if (!is_new) { | 301 | if (!is_new) { |
300 | cnt = def; | 302 | cnt = def; |
301 | printf("%d\n", cnt); | 303 | printf("%d\n", cnt); |
302 | break; | 304 | break; |
303 | } | 305 | } |
304 | check_stdin(); | 306 | check_stdin(); |
305 | case ask_all: | 307 | case oldaskconfig: |
306 | fflush(stdout); | 308 | fflush(stdout); |
307 | fgets(line, 128, stdin); | 309 | xfgets(line, 128, stdin); |
308 | strip(line); | 310 | strip(line); |
309 | if (line[0] == '?') { | 311 | if (line[0] == '?') { |
310 | print_help(menu); | 312 | print_help(menu); |
@@ -360,7 +362,10 @@ static void conf(struct menu *menu) | |||
360 | 362 | ||
361 | switch (prop->type) { | 363 | switch (prop->type) { |
362 | case P_MENU: | 364 | case P_MENU: |
363 | if (input_mode == ask_silent && rootEntry != menu) { | 365 | if ((input_mode == silentoldconfig || |
366 | input_mode == listnewconfig || | ||
367 | input_mode == oldnoconfig) && | ||
368 | rootEntry != menu) { | ||
364 | check_conf(menu); | 369 | check_conf(menu); |
365 | return; | 370 | return; |
366 | } | 371 | } |
@@ -418,10 +423,16 @@ static void check_conf(struct menu *menu) | |||
418 | if (sym && !sym_has_value(sym)) { | 423 | if (sym && !sym_has_value(sym)) { |
419 | if (sym_is_changable(sym) || | 424 | if (sym_is_changable(sym) || |
420 | (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { | 425 | (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { |
421 | if (!conf_cnt++) | 426 | if (input_mode == listnewconfig) { |
422 | printf(_("*\n* Restart config...\n*\n")); | 427 | if (sym->name && !sym_is_choice_value(sym)) { |
423 | rootEntry = menu_get_parent_menu(menu); | 428 | printf("%s%s\n", CONFIG_, sym->name); |
424 | conf(rootEntry); | 429 | } |
430 | } else if (input_mode != oldnoconfig) { | ||
431 | if (!conf_cnt++) | ||
432 | printf(_("*\n* Restart config...\n*\n")); | ||
433 | rootEntry = menu_get_parent_menu(menu); | ||
434 | conf(rootEntry); | ||
435 | } | ||
425 | } | 436 | } |
426 | } | 437 | } |
427 | 438 | ||
@@ -429,6 +440,22 @@ static void check_conf(struct menu *menu) | |||
429 | check_conf(child); | 440 | check_conf(child); |
430 | } | 441 | } |
431 | 442 | ||
443 | static struct option long_opts[] = { | ||
444 | {"oldaskconfig", no_argument, NULL, oldaskconfig}, | ||
445 | {"oldconfig", no_argument, NULL, oldconfig}, | ||
446 | {"silentoldconfig", no_argument, NULL, silentoldconfig}, | ||
447 | {"defconfig", optional_argument, NULL, defconfig}, | ||
448 | {"savedefconfig", required_argument, NULL, savedefconfig}, | ||
449 | {"allnoconfig", no_argument, NULL, allnoconfig}, | ||
450 | {"allyesconfig", no_argument, NULL, allyesconfig}, | ||
451 | {"allmodconfig", no_argument, NULL, allmodconfig}, | ||
452 | {"alldefconfig", no_argument, NULL, alldefconfig}, | ||
453 | {"randconfig", no_argument, NULL, randconfig}, | ||
454 | {"listnewconfig", no_argument, NULL, listnewconfig}, | ||
455 | {"oldnoconfig", no_argument, NULL, oldnoconfig}, | ||
456 | {NULL, 0, NULL, 0} | ||
457 | }; | ||
458 | |||
432 | int main(int ac, char **av) | 459 | int main(int ac, char **av) |
433 | { | 460 | { |
434 | int opt; | 461 | int opt; |
@@ -439,32 +466,17 @@ int main(int ac, char **av) | |||
439 | bindtextdomain(PACKAGE, LOCALEDIR); | 466 | bindtextdomain(PACKAGE, LOCALEDIR); |
440 | textdomain(PACKAGE); | 467 | textdomain(PACKAGE); |
441 | 468 | ||
442 | while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) { | 469 | while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) { |
470 | input_mode = (enum input_mode)opt; | ||
443 | switch (opt) { | 471 | switch (opt) { |
444 | case 'o': | 472 | case silentoldconfig: |
445 | input_mode = ask_silent; | ||
446 | break; | ||
447 | case 's': | ||
448 | input_mode = ask_silent; | ||
449 | sync_kconfig = 1; | 473 | sync_kconfig = 1; |
450 | break; | 474 | break; |
451 | case 'd': | 475 | case defconfig: |
452 | input_mode = set_default; | 476 | case savedefconfig: |
453 | break; | ||
454 | case 'D': | ||
455 | input_mode = set_default; | ||
456 | defconfig_file = optarg; | 477 | defconfig_file = optarg; |
457 | break; | 478 | break; |
458 | case 'n': | 479 | case randconfig: |
459 | input_mode = set_no; | ||
460 | break; | ||
461 | case 'm': | ||
462 | input_mode = set_mod; | ||
463 | break; | ||
464 | case 'y': | ||
465 | input_mode = set_yes; | ||
466 | break; | ||
467 | case 'r': | ||
468 | { | 480 | { |
469 | struct timeval now; | 481 | struct timeval now; |
470 | unsigned int seed; | 482 | unsigned int seed; |
@@ -477,17 +489,12 @@ int main(int ac, char **av) | |||
477 | 489 | ||
478 | seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); | 490 | seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); |
479 | srand(seed); | 491 | srand(seed); |
480 | |||
481 | input_mode = set_random; | ||
482 | break; | 492 | break; |
483 | } | 493 | } |
484 | case 'h': | 494 | case '?': |
485 | printf(_("See README for usage info\n")); | ||
486 | exit(0); | ||
487 | break; | ||
488 | default: | ||
489 | fprintf(stderr, _("See README for usage info\n")); | 495 | fprintf(stderr, _("See README for usage info\n")); |
490 | exit(1); | 496 | exit(1); |
497 | break; | ||
491 | } | 498 | } |
492 | } | 499 | } |
493 | if (ac == optind) { | 500 | if (ac == optind) { |
@@ -501,8 +508,7 @@ int main(int ac, char **av) | |||
501 | name = conf_get_configname(); | 508 | name = conf_get_configname(); |
502 | if (stat(name, &tmpstat)) { | 509 | if (stat(name, &tmpstat)) { |
503 | fprintf(stderr, _("***\n" | 510 | fprintf(stderr, _("***\n" |
504 | "*** You have not yet configured your kernel!\n" | 511 | "*** Configuration file \"%s\" not found!\n" |
505 | "*** (missing kernel config file \"%s\")\n" | ||
506 | "***\n" | 512 | "***\n" |
507 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | 513 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" |
508 | "*** \"make menuconfig\" or \"make xconfig\").\n" | 514 | "*** \"make menuconfig\" or \"make xconfig\").\n" |
@@ -512,7 +518,7 @@ int main(int ac, char **av) | |||
512 | } | 518 | } |
513 | 519 | ||
514 | switch (input_mode) { | 520 | switch (input_mode) { |
515 | case set_default: | 521 | case defconfig: |
516 | if (!defconfig_file) | 522 | if (!defconfig_file) |
517 | defconfig_file = conf_get_default_confname(); | 523 | defconfig_file = conf_get_default_confname(); |
518 | if (conf_read(defconfig_file)) { | 524 | if (conf_read(defconfig_file)) { |
@@ -522,25 +528,30 @@ int main(int ac, char **av) | |||
522 | exit(1); | 528 | exit(1); |
523 | } | 529 | } |
524 | break; | 530 | break; |
525 | case ask_silent: | 531 | case savedefconfig: |
526 | case ask_all: | 532 | case silentoldconfig: |
527 | case ask_new: | 533 | case oldaskconfig: |
534 | case oldconfig: | ||
535 | case listnewconfig: | ||
536 | case oldnoconfig: | ||
528 | conf_read(NULL); | 537 | conf_read(NULL); |
529 | break; | 538 | break; |
530 | case set_no: | 539 | case allnoconfig: |
531 | case set_mod: | 540 | case allyesconfig: |
532 | case set_yes: | 541 | case allmodconfig: |
533 | case set_random: | 542 | case alldefconfig: |
543 | case randconfig: | ||
534 | name = getenv("KCONFIG_ALLCONFIG"); | 544 | name = getenv("KCONFIG_ALLCONFIG"); |
535 | if (name && !stat(name, &tmpstat)) { | 545 | if (name && !stat(name, &tmpstat)) { |
536 | conf_read_simple(name, S_DEF_USER); | 546 | conf_read_simple(name, S_DEF_USER); |
537 | break; | 547 | break; |
538 | } | 548 | } |
539 | switch (input_mode) { | 549 | switch (input_mode) { |
540 | case set_no: name = "allno.config"; break; | 550 | case allnoconfig: name = "allno.config"; break; |
541 | case set_mod: name = "allmod.config"; break; | 551 | case allyesconfig: name = "allyes.config"; break; |
542 | case set_yes: name = "allyes.config"; break; | 552 | case allmodconfig: name = "allmod.config"; break; |
543 | case set_random: name = "allrandom.config"; break; | 553 | case alldefconfig: name = "alldef.config"; break; |
554 | case randconfig: name = "allrandom.config"; break; | ||
544 | default: break; | 555 | default: break; |
545 | } | 556 | } |
546 | if (!stat(name, &tmpstat)) | 557 | if (!stat(name, &tmpstat)) |
@@ -557,7 +568,7 @@ int main(int ac, char **av) | |||
557 | name = getenv("KCONFIG_NOSILENTUPDATE"); | 568 | name = getenv("KCONFIG_NOSILENTUPDATE"); |
558 | if (name && *name) { | 569 | if (name && *name) { |
559 | fprintf(stderr, | 570 | fprintf(stderr, |
560 | _("\n*** Kernel configuration requires explicit update.\n\n")); | 571 | _("\n*** The configuration requires explicit update.\n\n")); |
561 | return 1; | 572 | return 1; |
562 | } | 573 | } |
563 | } | 574 | } |
@@ -565,33 +576,42 @@ int main(int ac, char **av) | |||
565 | } | 576 | } |
566 | 577 | ||
567 | switch (input_mode) { | 578 | switch (input_mode) { |
568 | case set_no: | 579 | case allnoconfig: |
569 | conf_set_all_new_symbols(def_no); | 580 | conf_set_all_new_symbols(def_no); |
570 | break; | 581 | break; |
571 | case set_yes: | 582 | case allyesconfig: |
572 | conf_set_all_new_symbols(def_yes); | 583 | conf_set_all_new_symbols(def_yes); |
573 | break; | 584 | break; |
574 | case set_mod: | 585 | case allmodconfig: |
575 | conf_set_all_new_symbols(def_mod); | 586 | conf_set_all_new_symbols(def_mod); |
576 | break; | 587 | break; |
577 | case set_random: | 588 | case alldefconfig: |
589 | conf_set_all_new_symbols(def_default); | ||
590 | break; | ||
591 | case randconfig: | ||
578 | conf_set_all_new_symbols(def_random); | 592 | conf_set_all_new_symbols(def_random); |
579 | break; | 593 | break; |
580 | case set_default: | 594 | case defconfig: |
581 | conf_set_all_new_symbols(def_default); | 595 | conf_set_all_new_symbols(def_default); |
582 | break; | 596 | break; |
583 | case ask_new: | 597 | case savedefconfig: |
584 | case ask_all: | 598 | break; |
599 | case oldaskconfig: | ||
585 | rootEntry = &rootmenu; | 600 | rootEntry = &rootmenu; |
586 | conf(&rootmenu); | 601 | conf(&rootmenu); |
587 | input_mode = ask_silent; | 602 | input_mode = silentoldconfig; |
588 | /* fall through */ | 603 | /* fall through */ |
589 | case ask_silent: | 604 | case oldconfig: |
605 | case listnewconfig: | ||
606 | case oldnoconfig: | ||
607 | case silentoldconfig: | ||
590 | /* Update until a loop caused no more changes */ | 608 | /* Update until a loop caused no more changes */ |
591 | do { | 609 | do { |
592 | conf_cnt = 0; | 610 | conf_cnt = 0; |
593 | check_conf(&rootmenu); | 611 | check_conf(&rootmenu); |
594 | } while (conf_cnt); | 612 | } while (conf_cnt && |
613 | (input_mode != listnewconfig && | ||
614 | input_mode != oldnoconfig)); | ||
595 | break; | 615 | break; |
596 | } | 616 | } |
597 | 617 | ||
@@ -600,18 +620,35 @@ int main(int ac, char **av) | |||
600 | * All other commands are only used to generate a config. | 620 | * All other commands are only used to generate a config. |
601 | */ | 621 | */ |
602 | if (conf_get_changed() && conf_write(NULL)) { | 622 | if (conf_get_changed() && conf_write(NULL)) { |
603 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 623 | fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); |
604 | exit(1); | 624 | exit(1); |
605 | } | 625 | } |
606 | if (conf_write_autoconf()) { | 626 | if (conf_write_autoconf()) { |
607 | fprintf(stderr, _("\n*** Error during update of the kernel configuration.\n\n")); | 627 | fprintf(stderr, _("\n*** Error during update of the configuration.\n\n")); |
608 | return 1; | 628 | return 1; |
609 | } | 629 | } |
610 | } else { | 630 | } else if (input_mode == savedefconfig) { |
631 | if (conf_write_defconfig(defconfig_file)) { | ||
632 | fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"), | ||
633 | defconfig_file); | ||
634 | return 1; | ||
635 | } | ||
636 | } else if (input_mode != listnewconfig) { | ||
611 | if (conf_write(NULL)) { | 637 | if (conf_write(NULL)) { |
612 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 638 | fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); |
613 | exit(1); | 639 | exit(1); |
614 | } | 640 | } |
615 | } | 641 | } |
616 | return 0; | 642 | return 0; |
617 | } | 643 | } |
644 | /* | ||
645 | * Helper function to facilitate fgets() by Jean Sacren. | ||
646 | */ | ||
647 | void xfgets(str, size, in) | ||
648 | char *str; | ||
649 | int size; | ||
650 | FILE *in; | ||
651 | { | ||
652 | if (fgets(str, size, in) == NULL) | ||
653 | fprintf(stderr, "\nError in reading or end of file.\n"); | ||
654 | } | ||
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index c4dec80cfd8..61c35bf2d9c 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 @@ | |||
18 | static void conf_warning(const char *fmt, ...) | 19 | static void conf_warning(const char *fmt, ...) |
19 | __attribute__ ((format (printf, 1, 2))); | 20 | __attribute__ ((format (printf, 1, 2))); |
20 | 21 | ||
22 | static void conf_message(const char *fmt, ...) | ||
23 | __attribute__ ((format (printf, 1, 2))); | ||
24 | |||
21 | static const char *conf_filename; | 25 | static const char *conf_filename; |
22 | static int conf_lineno, conf_warnings, conf_unsaved; | 26 | static 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 | ||
41 | static 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 | |||
48 | static void (*conf_message_callback) (const char *fmt, va_list ap) = | ||
49 | conf_default_message_callback; | ||
50 | void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) | ||
51 | { | ||
52 | conf_message_callback = fn; | ||
53 | } | ||
54 | |||
55 | static 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 | |||
37 | const char *conf_get_configname(void) | 64 | const char *conf_get_configname(void) |
38 | { | 65 | { |
39 | char *name = getenv("KCONFIG_CONFIG"); | 66 | char *name = getenv("KCONFIG_CONFIG"); |
@@ -170,8 +197,11 @@ int conf_read_simple(const char *name, int def) | |||
170 | if (in) | 197 | if (in) |
171 | goto load; | 198 | goto load; |
172 | sym_add_change_count(1); | 199 | sym_add_change_count(1); |
173 | if (!sym_defconfig_list) | 200 | if (!sym_defconfig_list) { |
201 | if (modules_sym) | ||
202 | sym_calc_value(modules_sym); | ||
174 | return 1; | 203 | return 1; |
204 | } | ||
175 | 205 | ||
176 | for_all_defaults(sym_defconfig_list, prop) { | 206 | for_all_defaults(sym_defconfig_list, prop) { |
177 | if (expr_calc_value(prop->visible.expr) == no || | 207 | if (expr_calc_value(prop->visible.expr) == no || |
@@ -180,9 +210,8 @@ int conf_read_simple(const char *name, int def) | |||
180 | name = conf_expand_value(prop->expr->left.sym->name); | 210 | name = conf_expand_value(prop->expr->left.sym->name); |
181 | in = zconf_fopen(name); | 211 | in = zconf_fopen(name); |
182 | if (in) { | 212 | if (in) { |
183 | printf(_("#\n" | 213 | conf_message(_("using defaults found in %s"), |
184 | "# using defaults found in %s\n" | 214 | name); |
185 | "#\n"), name); | ||
186 | goto load; | 215 | goto load; |
187 | } | 216 | } |
188 | } | 217 | } |
@@ -217,24 +246,23 @@ load: | |||
217 | while (fgets(line, sizeof(line), in)) { | 246 | while (fgets(line, sizeof(line), in)) { |
218 | conf_lineno++; | 247 | conf_lineno++; |
219 | sym = NULL; | 248 | sym = NULL; |
220 | switch (line[0]) { | 249 | if (line[0] == '#') { |
221 | case '#': | 250 | if (memcmp(line + 2, CONFIG_, strlen(CONFIG_))) |
222 | if (memcmp(line + 2, "CONFIG_", 7)) | ||
223 | continue; | 251 | continue; |
224 | p = strchr(line + 9, ' '); | 252 | p = strchr(line + 2 + strlen(CONFIG_), ' '); |
225 | if (!p) | 253 | if (!p) |
226 | continue; | 254 | continue; |
227 | *p++ = 0; | 255 | *p++ = 0; |
228 | if (strncmp(p, "is not set", 10)) | 256 | if (strncmp(p, "is not set", 10)) |
229 | continue; | 257 | continue; |
230 | if (def == S_DEF_USER) { | 258 | if (def == S_DEF_USER) { |
231 | sym = sym_find(line + 9); | 259 | sym = sym_find(line + 2 + strlen(CONFIG_)); |
232 | if (!sym) { | 260 | if (!sym) { |
233 | sym_add_change_count(1); | 261 | sym_add_change_count(1); |
234 | break; | 262 | goto setsym; |
235 | } | 263 | } |
236 | } else { | 264 | } else { |
237 | sym = sym_lookup(line + 9, 0); | 265 | sym = sym_lookup(line + 2 + strlen(CONFIG_), 0); |
238 | if (sym->type == S_UNKNOWN) | 266 | if (sym->type == S_UNKNOWN) |
239 | sym->type = S_BOOLEAN; | 267 | sym->type = S_BOOLEAN; |
240 | } | 268 | } |
@@ -250,13 +278,8 @@ load: | |||
250 | default: | 278 | default: |
251 | ; | 279 | ; |
252 | } | 280 | } |
253 | break; | 281 | } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) { |
254 | case 'C': | 282 | p = strchr(line + strlen(CONFIG_), '='); |
255 | if (memcmp(line, "CONFIG_", 7)) { | ||
256 | conf_warning("unexpected data"); | ||
257 | continue; | ||
258 | } | ||
259 | p = strchr(line + 7, '='); | ||
260 | if (!p) | 283 | if (!p) |
261 | continue; | 284 | continue; |
262 | *p++ = 0; | 285 | *p++ = 0; |
@@ -267,13 +290,13 @@ load: | |||
267 | *p2 = 0; | 290 | *p2 = 0; |
268 | } | 291 | } |
269 | if (def == S_DEF_USER) { | 292 | if (def == S_DEF_USER) { |
270 | sym = sym_find(line + 7); | 293 | sym = sym_find(line + strlen(CONFIG_)); |
271 | if (!sym) { | 294 | if (!sym) { |
272 | sym_add_change_count(1); | 295 | sym_add_change_count(1); |
273 | break; | 296 | goto setsym; |
274 | } | 297 | } |
275 | } else { | 298 | } else { |
276 | sym = sym_lookup(line + 7, 0); | 299 | sym = sym_lookup(line + strlen(CONFIG_), 0); |
277 | if (sym->type == S_UNKNOWN) | 300 | if (sym->type == S_UNKNOWN) |
278 | sym->type = S_OTHER; | 301 | sym->type = S_OTHER; |
279 | } | 302 | } |
@@ -282,14 +305,12 @@ load: | |||
282 | } | 305 | } |
283 | if (conf_set_sym_val(sym, def, def_flags, p)) | 306 | if (conf_set_sym_val(sym, def, def_flags, p)) |
284 | continue; | 307 | continue; |
285 | break; | 308 | } else { |
286 | case '\r': | 309 | if (line[0] != '\r' && line[0] != '\n') |
287 | case '\n': | 310 | conf_warning("unexpected data"); |
288 | break; | ||
289 | default: | ||
290 | conf_warning("unexpected data"); | ||
291 | continue; | 311 | continue; |
292 | } | 312 | } |
313 | setsym: | ||
293 | if (sym && sym_is_choice_value(sym)) { | 314 | if (sym && sym_is_choice_value(sym)) { |
294 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); | 315 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); |
295 | switch (sym->def[def].tri) { | 316 | switch (sym->def[def].tri) { |
@@ -396,15 +417,149 @@ int conf_read(const char *name) | |||
396 | return 0; | 417 | return 0; |
397 | } | 418 | } |
398 | 419 | ||
420 | /* Write a S_STRING */ | ||
421 | static void conf_write_string(bool headerfile, const char *name, | ||
422 | const char *str, FILE *out) | ||
423 | { | ||
424 | int l; | ||
425 | if (headerfile) | ||
426 | fprintf(out, "#define %s%s \"", CONFIG_, name); | ||
427 | else | ||
428 | fprintf(out, "%s%s=\"", CONFIG_, name); | ||
429 | |||
430 | while (1) { | ||
431 | l = strcspn(str, "\"\\"); | ||
432 | if (l) { | ||
433 | xfwrite(str, l, 1, out); | ||
434 | str += l; | ||
435 | } | ||
436 | if (!*str) | ||
437 | break; | ||
438 | fprintf(out, "\\%c", *str++); | ||
439 | } | ||
440 | fputs("\"\n", out); | ||
441 | } | ||
442 | |||
443 | static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no) | ||
444 | { | ||
445 | const char *str; | ||
446 | |||
447 | switch (sym->type) { | ||
448 | case S_BOOLEAN: | ||
449 | case S_TRISTATE: | ||
450 | switch (sym_get_tristate_value(sym)) { | ||
451 | case no: | ||
452 | if (write_no) | ||
453 | fprintf(out, "# %s%s is not set\n", | ||
454 | CONFIG_, sym->name); | ||
455 | break; | ||
456 | case mod: | ||
457 | fprintf(out, "%s%s=m\n", CONFIG_, sym->name); | ||
458 | break; | ||
459 | case yes: | ||
460 | fprintf(out, "%s%s=y\n", CONFIG_, sym->name); | ||
461 | break; | ||
462 | } | ||
463 | break; | ||
464 | case S_STRING: | ||
465 | conf_write_string(false, sym->name, sym_get_string_value(sym), out); | ||
466 | break; | ||
467 | case S_HEX: | ||
468 | case S_INT: | ||
469 | str = sym_get_string_value(sym); | ||
470 | fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str); | ||
471 | break; | ||
472 | case S_OTHER: | ||
473 | case S_UNKNOWN: | ||
474 | break; | ||
475 | } | ||
476 | } | ||
477 | |||
478 | /* | ||
479 | * Write out a minimal config. | ||
480 | * All values that has default values are skipped as this is redundant. | ||
481 | */ | ||
482 | int conf_write_defconfig(const char *filename) | ||
483 | { | ||
484 | struct symbol *sym; | ||
485 | struct menu *menu; | ||
486 | FILE *out; | ||
487 | |||
488 | out = fopen(filename, "w"); | ||
489 | if (!out) | ||
490 | return 1; | ||
491 | |||
492 | sym_clear_all_valid(); | ||
493 | |||
494 | /* Traverse all menus to find all relevant symbols */ | ||
495 | menu = rootmenu.list; | ||
496 | |||
497 | while (menu != NULL) | ||
498 | { | ||
499 | sym = menu->sym; | ||
500 | if (sym == NULL) { | ||
501 | if (!menu_is_visible(menu)) | ||
502 | goto next_menu; | ||
503 | } else if (!sym_is_choice(sym)) { | ||
504 | sym_calc_value(sym); | ||
505 | if (!(sym->flags & SYMBOL_WRITE)) | ||
506 | goto next_menu; | ||
507 | sym->flags &= ~SYMBOL_WRITE; | ||
508 | /* If we cannot change the symbol - skip */ | ||
509 | if (!sym_is_changable(sym)) | ||
510 | goto next_menu; | ||
511 | /* If symbol equals to default value - skip */ | ||
512 | if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0) | ||
513 | goto next_menu; | ||
514 | |||
515 | /* | ||
516 | * If symbol is a choice value and equals to the | ||
517 | * default for a choice - skip. | ||
518 | * But only if value is bool and equal to "y" and | ||
519 | * choice is not "optional". | ||
520 | * (If choice is "optional" then all values can be "n") | ||
521 | */ | ||
522 | if (sym_is_choice_value(sym)) { | ||
523 | struct symbol *cs; | ||
524 | struct symbol *ds; | ||
525 | |||
526 | cs = prop_get_symbol(sym_get_choice_prop(sym)); | ||
527 | ds = sym_choice_default(cs); | ||
528 | if (!sym_is_optional(cs) && sym == ds) { | ||
529 | if ((sym->type == S_BOOLEAN) && | ||
530 | sym_get_tristate_value(sym) == yes) | ||
531 | goto next_menu; | ||
532 | } | ||
533 | } | ||
534 | conf_write_symbol(sym, out, true); | ||
535 | } | ||
536 | next_menu: | ||
537 | if (menu->list != NULL) { | ||
538 | menu = menu->list; | ||
539 | } | ||
540 | else if (menu->next != NULL) { | ||
541 | menu = menu->next; | ||
542 | } else { | ||
543 | while ((menu = menu->parent)) { | ||
544 | if (menu->next != NULL) { | ||
545 | menu = menu->next; | ||
546 | break; | ||
547 | } | ||
548 | } | ||
549 | } | ||
550 | } | ||
551 | fclose(out); | ||
552 | return 0; | ||
553 | } | ||
554 | |||
399 | int conf_write(const char *name) | 555 | int conf_write(const char *name) |
400 | { | 556 | { |
401 | FILE *out; | 557 | FILE *out; |
402 | struct symbol *sym; | 558 | struct symbol *sym; |
403 | struct menu *menu; | 559 | struct menu *menu; |
404 | const char *basename; | 560 | const char *basename; |
405 | char dirname[128], tmpname[128], newname[128]; | ||
406 | int type, l; | ||
407 | const char *str; | 561 | const char *str; |
562 | char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1]; | ||
408 | time_t now; | 563 | time_t now; |
409 | int use_timestamp = 1; | 564 | int use_timestamp = 1; |
410 | char *env; | 565 | char *env; |
@@ -443,8 +598,6 @@ int conf_write(const char *name) | |||
443 | if (!out) | 598 | if (!out) |
444 | return 1; | 599 | return 1; |
445 | 600 | ||
446 | sym = sym_lookup("KERNELVERSION", 0); | ||
447 | sym_calc_value(sym); | ||
448 | time(&now); | 601 | time(&now); |
449 | env = getenv("KCONFIG_NOTIMESTAMP"); | 602 | env = getenv("KCONFIG_NOTIMESTAMP"); |
450 | if (env && *env) | 603 | if (env && *env) |
@@ -452,10 +605,10 @@ int conf_write(const char *name) | |||
452 | 605 | ||
453 | fprintf(out, _("#\n" | 606 | fprintf(out, _("#\n" |
454 | "# Automatically generated make config: don't edit\n" | 607 | "# Automatically generated make config: don't edit\n" |
455 | "# Linux kernel version: %s\n" | 608 | "# %s\n" |
456 | "%s%s" | 609 | "%s%s" |
457 | "#\n"), | 610 | "#\n"), |
458 | sym_get_string_value(sym), | 611 | rootmenu.prompt->text, |
459 | use_timestamp ? "# " : "", | 612 | use_timestamp ? "# " : "", |
460 | use_timestamp ? ctime(&now) : ""); | 613 | use_timestamp ? ctime(&now) : ""); |
461 | 614 | ||
@@ -478,56 +631,11 @@ int conf_write(const char *name) | |||
478 | if (!(sym->flags & SYMBOL_WRITE)) | 631 | if (!(sym->flags & SYMBOL_WRITE)) |
479 | goto next; | 632 | goto next; |
480 | sym->flags &= ~SYMBOL_WRITE; | 633 | sym->flags &= ~SYMBOL_WRITE; |
481 | type = sym->type; | 634 | /* Write config symbol to file */ |
482 | if (type == S_TRISTATE) { | 635 | conf_write_symbol(sym, out, true); |
483 | sym_calc_value(modules_sym); | ||
484 | if (modules_sym->curr.tri == no) | ||
485 | type = S_BOOLEAN; | ||
486 | } | ||
487 | switch (type) { | ||
488 | case S_BOOLEAN: | ||
489 | case S_TRISTATE: | ||
490 | switch (sym_get_tristate_value(sym)) { | ||
491 | case no: | ||
492 | fprintf(out, "# CONFIG_%s is not set\n", sym->name); | ||
493 | break; | ||
494 | case mod: | ||
495 | fprintf(out, "CONFIG_%s=m\n", sym->name); | ||
496 | break; | ||
497 | case yes: | ||
498 | fprintf(out, "CONFIG_%s=y\n", sym->name); | ||
499 | break; | ||
500 | } | ||
501 | break; | ||
502 | case S_STRING: | ||
503 | str = sym_get_string_value(sym); | ||
504 | fprintf(out, "CONFIG_%s=\"", sym->name); | ||
505 | while (1) { | ||
506 | l = strcspn(str, "\"\\"); | ||
507 | if (l) { | ||
508 | fwrite(str, l, 1, out); | ||
509 | str += l; | ||
510 | } | ||
511 | if (!*str) | ||
512 | break; | ||
513 | fprintf(out, "\\%c", *str++); | ||
514 | } | ||
515 | fputs("\"\n", out); | ||
516 | break; | ||
517 | case S_HEX: | ||
518 | str = sym_get_string_value(sym); | ||
519 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | ||
520 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | ||
521 | break; | ||
522 | } | ||
523 | case S_INT: | ||
524 | str = sym_get_string_value(sym); | ||
525 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | ||
526 | break; | ||
527 | } | ||
528 | } | 636 | } |
529 | 637 | ||
530 | next: | 638 | next: |
531 | if (menu->list) { | 639 | if (menu->list) { |
532 | menu = menu->list; | 640 | menu = menu->list; |
533 | continue; | 641 | continue; |
@@ -551,9 +659,7 @@ int conf_write(const char *name) | |||
551 | return 1; | 659 | return 1; |
552 | } | 660 | } |
553 | 661 | ||
554 | printf(_("#\n" | 662 | conf_message(_("configuration written to %s"), newname); |
555 | "# configuration written to %s\n" | ||
556 | "#\n"), newname); | ||
557 | 663 | ||
558 | sym_set_change_count(0); | 664 | sym_set_change_count(0); |
559 | 665 | ||
@@ -563,7 +669,7 @@ int conf_write(const char *name) | |||
563 | static int conf_split_config(void) | 669 | static int conf_split_config(void) |
564 | { | 670 | { |
565 | const char *name; | 671 | const char *name; |
566 | char path[128]; | 672 | char path[PATH_MAX+1]; |
567 | char *s, *d, c; | 673 | char *s, *d, c; |
568 | struct symbol *sym; | 674 | struct symbol *sym; |
569 | struct stat sb; | 675 | struct stat sb; |
@@ -679,7 +785,7 @@ int conf_write_autoconf(void) | |||
679 | const char *name; | 785 | const char *name; |
680 | FILE *out, *tristate, *out_h; | 786 | FILE *out, *tristate, *out_h; |
681 | time_t now; | 787 | time_t now; |
682 | int i, l; | 788 | int i; |
683 | 789 | ||
684 | sym_clear_all_valid(); | 790 | sym_clear_all_valid(); |
685 | 791 | ||
@@ -705,30 +811,32 @@ int conf_write_autoconf(void) | |||
705 | return 1; | 811 | return 1; |
706 | } | 812 | } |
707 | 813 | ||
708 | sym = sym_lookup("KERNELVERSION", 0); | ||
709 | sym_calc_value(sym); | ||
710 | time(&now); | 814 | time(&now); |
711 | fprintf(out, "#\n" | 815 | fprintf(out, "#\n" |
712 | "# Automatically generated make config: don't edit\n" | 816 | "# Automatically generated make config: don't edit\n" |
713 | "# Linux kernel version: %s\n" | 817 | "# %s\n" |
714 | "# %s" | 818 | "# %s" |
715 | "#\n", | 819 | "#\n", |
716 | sym_get_string_value(sym), ctime(&now)); | 820 | rootmenu.prompt->text, ctime(&now)); |
717 | fprintf(tristate, "#\n" | 821 | fprintf(tristate, "#\n" |
718 | "# Automatically generated - do not edit\n" | 822 | "# Automatically generated - do not edit\n" |
719 | "\n"); | 823 | "\n"); |
720 | fprintf(out_h, "/*\n" | 824 | fprintf(out_h, "/*\n" |
721 | " * Automatically generated C config: don't edit\n" | 825 | " * Automatically generated C config: don't edit\n" |
722 | " * Linux kernel version: %s\n" | 826 | " * %s\n" |
723 | " * %s" | 827 | " * %s" |
724 | " */\n" | 828 | " */\n", |
725 | "#define AUTOCONF_INCLUDED\n", | 829 | rootmenu.prompt->text, ctime(&now)); |
726 | sym_get_string_value(sym), ctime(&now)); | ||
727 | 830 | ||
728 | for_all_symbols(i, sym) { | 831 | for_all_symbols(i, sym) { |
729 | sym_calc_value(sym); | 832 | sym_calc_value(sym); |
730 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) | 833 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) |
731 | continue; | 834 | continue; |
835 | |||
836 | /* write symbol to config file */ | ||
837 | conf_write_symbol(sym, out, false); | ||
838 | |||
839 | /* update autoconf and tristate files */ | ||
732 | switch (sym->type) { | 840 | switch (sym->type) { |
733 | case S_BOOLEAN: | 841 | case S_BOOLEAN: |
734 | case S_TRISTATE: | 842 | case S_TRISTATE: |
@@ -736,50 +844,34 @@ int conf_write_autoconf(void) | |||
736 | case no: | 844 | case no: |
737 | break; | 845 | break; |
738 | case mod: | 846 | case mod: |
739 | fprintf(out, "CONFIG_%s=m\n", sym->name); | 847 | fprintf(tristate, "%s%s=M\n", |
740 | fprintf(tristate, "CONFIG_%s=M\n", sym->name); | 848 | CONFIG_, sym->name); |
741 | fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); | 849 | fprintf(out_h, "#define %s%s_MODULE 1\n", |
850 | CONFIG_, sym->name); | ||
742 | break; | 851 | break; |
743 | case yes: | 852 | case yes: |
744 | fprintf(out, "CONFIG_%s=y\n", sym->name); | ||
745 | if (sym->type == S_TRISTATE) | 853 | if (sym->type == S_TRISTATE) |
746 | fprintf(tristate, "CONFIG_%s=Y\n", | 854 | fprintf(tristate,"%s%s=Y\n", |
747 | sym->name); | 855 | CONFIG_, sym->name); |
748 | fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); | 856 | fprintf(out_h, "#define %s%s 1\n", |
857 | CONFIG_, sym->name); | ||
749 | break; | 858 | break; |
750 | } | 859 | } |
751 | break; | 860 | break; |
752 | case S_STRING: | 861 | case S_STRING: |
753 | str = sym_get_string_value(sym); | 862 | conf_write_string(true, sym->name, sym_get_string_value(sym), out_h); |
754 | fprintf(out, "CONFIG_%s=\"", sym->name); | ||
755 | fprintf(out_h, "#define CONFIG_%s \"", sym->name); | ||
756 | while (1) { | ||
757 | l = strcspn(str, "\"\\"); | ||
758 | if (l) { | ||
759 | fwrite(str, l, 1, out); | ||
760 | fwrite(str, l, 1, out_h); | ||
761 | str += l; | ||
762 | } | ||
763 | if (!*str) | ||
764 | break; | ||
765 | fprintf(out, "\\%c", *str); | ||
766 | fprintf(out_h, "\\%c", *str); | ||
767 | str++; | ||
768 | } | ||
769 | fputs("\"\n", out); | ||
770 | fputs("\"\n", out_h); | ||
771 | break; | 863 | break; |
772 | case S_HEX: | 864 | case S_HEX: |
773 | str = sym_get_string_value(sym); | 865 | str = sym_get_string_value(sym); |
774 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | 866 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { |
775 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | 867 | fprintf(out_h, "#define %s%s 0x%s\n", |
776 | fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); | 868 | CONFIG_, sym->name, str); |
777 | break; | 869 | break; |
778 | } | 870 | } |
779 | case S_INT: | 871 | case S_INT: |
780 | str = sym_get_string_value(sym); | 872 | str = sym_get_string_value(sym); |
781 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | 873 | fprintf(out_h, "#define %s%s %s\n", |
782 | fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); | 874 | CONFIG_, sym->name, str); |
783 | break; | 875 | break; |
784 | default: | 876 | default: |
785 | break; | 877 | break; |
@@ -837,13 +929,73 @@ void conf_set_changed_callback(void (*fn)(void)) | |||
837 | conf_changed_callback = fn; | 929 | conf_changed_callback = fn; |
838 | } | 930 | } |
839 | 931 | ||
932 | static void randomize_choice_values(struct symbol *csym) | ||
933 | { | ||
934 | struct property *prop; | ||
935 | struct symbol *sym; | ||
936 | struct expr *e; | ||
937 | int cnt, def; | ||
938 | |||
939 | /* | ||
940 | * If choice is mod then we may have more items selected | ||
941 | * and if no then no-one. | ||
942 | * In both cases stop. | ||
943 | */ | ||
944 | if (csym->curr.tri != yes) | ||
945 | return; | ||
946 | |||
947 | prop = sym_get_choice_prop(csym); | ||
948 | |||
949 | /* count entries in choice block */ | ||
950 | cnt = 0; | ||
951 | expr_list_for_each_sym(prop->expr, e, sym) | ||
952 | cnt++; | ||
953 | |||
954 | /* | ||
955 | * find a random value and set it to yes, | ||
956 | * set the rest to no so we have only one set | ||
957 | */ | ||
958 | def = (rand() % cnt); | ||
959 | |||
960 | cnt = 0; | ||
961 | expr_list_for_each_sym(prop->expr, e, sym) { | ||
962 | if (def == cnt++) { | ||
963 | sym->def[S_DEF_USER].tri = yes; | ||
964 | csym->def[S_DEF_USER].val = sym; | ||
965 | } | ||
966 | else { | ||
967 | sym->def[S_DEF_USER].tri = no; | ||
968 | } | ||
969 | } | ||
970 | csym->flags |= SYMBOL_DEF_USER; | ||
971 | /* clear VALID to get value calculated */ | ||
972 | csym->flags &= ~(SYMBOL_VALID); | ||
973 | } | ||
974 | |||
975 | static void set_all_choice_values(struct symbol *csym) | ||
976 | { | ||
977 | struct property *prop; | ||
978 | struct symbol *sym; | ||
979 | struct expr *e; | ||
980 | |||
981 | prop = sym_get_choice_prop(csym); | ||
982 | |||
983 | /* | ||
984 | * Set all non-assinged choice values to no | ||
985 | */ | ||
986 | expr_list_for_each_sym(prop->expr, e, sym) { | ||
987 | if (!sym_has_value(sym)) | ||
988 | sym->def[S_DEF_USER].tri = no; | ||
989 | } | ||
990 | csym->flags |= SYMBOL_DEF_USER; | ||
991 | /* clear VALID to get value calculated */ | ||
992 | csym->flags &= ~(SYMBOL_VALID); | ||
993 | } | ||
840 | 994 | ||
841 | void conf_set_all_new_symbols(enum conf_def_mode mode) | 995 | void conf_set_all_new_symbols(enum conf_def_mode mode) |
842 | { | 996 | { |
843 | struct symbol *sym, *csym; | 997 | struct symbol *sym, *csym; |
844 | struct property *prop; | 998 | int i, cnt; |
845 | struct expr *e; | ||
846 | int i, cnt, def; | ||
847 | 999 | ||
848 | for_all_symbols(i, sym) { | 1000 | for_all_symbols(i, sym) { |
849 | if (sym_has_value(sym)) | 1001 | if (sym_has_value(sym)) |
@@ -862,7 +1014,8 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
862 | sym->def[S_DEF_USER].tri = no; | 1014 | sym->def[S_DEF_USER].tri = no; |
863 | break; | 1015 | break; |
864 | case def_random: | 1016 | case def_random: |
865 | sym->def[S_DEF_USER].tri = (tristate)(rand() % 3); | 1017 | cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2; |
1018 | sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt); | ||
866 | break; | 1019 | break; |
867 | default: | 1020 | default: |
868 | continue; | 1021 | continue; |
@@ -878,14 +1031,12 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
878 | 1031 | ||
879 | sym_clear_all_valid(); | 1032 | sym_clear_all_valid(); |
880 | 1033 | ||
881 | if (mode != def_random) | ||
882 | return; | ||
883 | /* | 1034 | /* |
884 | * We have different type of choice blocks. | 1035 | * We have different type of choice blocks. |
885 | * If curr.tri equal to mod then we can select several | 1036 | * If curr.tri equals to mod then we can select several |
886 | * choice symbols in one block. | 1037 | * choice symbols in one block. |
887 | * In this case we do nothing. | 1038 | * In this case we do nothing. |
888 | * If curr.tri equal yes then only one symbol can be | 1039 | * If curr.tri equals yes then only one symbol can be |
889 | * selected in a choice block and we set it to yes, | 1040 | * selected in a choice block and we set it to yes, |
890 | * and the rest to no. | 1041 | * and the rest to no. |
891 | */ | 1042 | */ |
@@ -894,35 +1045,9 @@ void conf_set_all_new_symbols(enum conf_def_mode mode) | |||
894 | continue; | 1045 | continue; |
895 | 1046 | ||
896 | sym_calc_value(csym); | 1047 | sym_calc_value(csym); |
897 | 1048 | if (mode == def_random) | |
898 | if (csym->curr.tri != yes) | 1049 | randomize_choice_values(csym); |
899 | continue; | 1050 | else |
900 | 1051 | set_all_choice_values(csym); | |
901 | prop = sym_get_choice_prop(csym); | ||
902 | |||
903 | /* count entries in choice block */ | ||
904 | cnt = 0; | ||
905 | expr_list_for_each_sym(prop->expr, e, sym) | ||
906 | cnt++; | ||
907 | |||
908 | /* | ||
909 | * find a random value and set it to yes, | ||
910 | * set the rest to no so we have only one set | ||
911 | */ | ||
912 | def = (rand() % cnt); | ||
913 | |||
914 | cnt = 0; | ||
915 | expr_list_for_each_sym(prop->expr, e, sym) { | ||
916 | if (def == cnt++) { | ||
917 | sym->def[S_DEF_USER].tri = yes; | ||
918 | csym->def[S_DEF_USER].val = sym; | ||
919 | } | ||
920 | else { | ||
921 | sym->def[S_DEF_USER].tri = no; | ||
922 | } | ||
923 | } | ||
924 | csym->flags |= SYMBOL_DEF_USER; | ||
925 | /* clear VALID to get value calculated */ | ||
926 | csym->flags &= ~(SYMBOL_VALID); | ||
927 | } | 1052 | } |
928 | } | 1053 | } |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index d83f2322893..001003452f6 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -64,7 +64,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2) | |||
64 | return e2 ? expr_alloc_two(E_OR, e1, e2) : e1; | 64 | return e2 ? expr_alloc_two(E_OR, e1, e2) : e1; |
65 | } | 65 | } |
66 | 66 | ||
67 | struct expr *expr_copy(struct expr *org) | 67 | struct expr *expr_copy(const struct expr *org) |
68 | { | 68 | { |
69 | struct expr *e; | 69 | struct expr *e; |
70 | 70 | ||
@@ -1013,6 +1013,48 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2) | |||
1013 | #endif | 1013 | #endif |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | static inline struct expr * | ||
1017 | expr_get_leftmost_symbol(const struct expr *e) | ||
1018 | { | ||
1019 | |||
1020 | if (e == NULL) | ||
1021 | return NULL; | ||
1022 | |||
1023 | while (e->type != E_SYMBOL) | ||
1024 | e = e->left.expr; | ||
1025 | |||
1026 | return expr_copy(e); | ||
1027 | } | ||
1028 | |||
1029 | /* | ||
1030 | * Given expression `e1' and `e2', returns the leaf of the longest | ||
1031 | * sub-expression of `e1' not containing 'e2. | ||
1032 | */ | ||
1033 | struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2) | ||
1034 | { | ||
1035 | struct expr *ret; | ||
1036 | |||
1037 | switch (e1->type) { | ||
1038 | case E_OR: | ||
1039 | return expr_alloc_and( | ||
1040 | expr_simplify_unmet_dep(e1->left.expr, e2), | ||
1041 | expr_simplify_unmet_dep(e1->right.expr, e2)); | ||
1042 | case E_AND: { | ||
1043 | struct expr *e; | ||
1044 | e = expr_alloc_and(expr_copy(e1), expr_copy(e2)); | ||
1045 | e = expr_eliminate_dups(e); | ||
1046 | ret = (!expr_eq(e, e1)) ? e1 : NULL; | ||
1047 | expr_free(e); | ||
1048 | break; | ||
1049 | } | ||
1050 | default: | ||
1051 | ret = e1; | ||
1052 | break; | ||
1053 | } | ||
1054 | |||
1055 | return expr_get_leftmost_symbol(ret); | ||
1056 | } | ||
1057 | |||
1016 | void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken) | 1058 | void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken) |
1017 | { | 1059 | { |
1018 | if (!e) { | 1060 | if (!e) { |
@@ -1087,7 +1129,7 @@ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char * | |||
1087 | 1129 | ||
1088 | static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) | 1130 | static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) |
1089 | { | 1131 | { |
1090 | fwrite(str, strlen(str), 1, data); | 1132 | xfwrite(str, strlen(str), 1, data); |
1091 | } | 1133 | } |
1092 | 1134 | ||
1093 | void expr_fprint(struct expr *e, FILE *out) | 1135 | void expr_fprint(struct expr *e, FILE *out) |
@@ -1121,7 +1163,7 @@ static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *s | |||
1121 | } | 1163 | } |
1122 | 1164 | ||
1123 | str_append(gs, str); | 1165 | str_append(gs, str); |
1124 | if (sym) | 1166 | if (sym && sym->type != S_UNKNOWN) |
1125 | str_printf(gs, " [=%s]", sym_str); | 1167 | str_printf(gs, " [=%s]", sym_str); |
1126 | } | 1168 | } |
1127 | 1169 | ||
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 891cd9ce9ba..3d238db4976 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -18,7 +18,7 @@ extern "C" { | |||
18 | struct file { | 18 | struct 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 | }; |
@@ -83,6 +83,7 @@ struct symbol { | |||
83 | tristate visible; | 83 | tristate visible; |
84 | int flags; | 84 | int flags; |
85 | struct property *prop; | 85 | struct property *prop; |
86 | struct expr_value dir_dep; | ||
86 | struct expr_value rev_dep; | 87 | struct expr_value rev_dep; |
87 | }; | 88 | }; |
88 | 89 | ||
@@ -131,6 +132,7 @@ enum prop_type { | |||
131 | P_SELECT, /* select BAR */ | 132 | P_SELECT, /* select BAR */ |
132 | P_RANGE, /* range 7..100 (for a symbol) */ | 133 | P_RANGE, /* range 7..100 (for a symbol) */ |
133 | P_ENV, /* value from environment variable */ | 134 | P_ENV, /* value from environment variable */ |
135 | P_SYMBOL, /* where a symbol is defined */ | ||
134 | }; | 136 | }; |
135 | 137 | ||
136 | struct property { | 138 | struct property { |
@@ -162,6 +164,7 @@ struct menu { | |||
162 | struct menu *list; | 164 | struct menu *list; |
163 | struct symbol *sym; | 165 | struct symbol *sym; |
164 | struct property *prompt; | 166 | struct property *prompt; |
167 | struct expr *visibility; | ||
165 | struct expr *dep; | 168 | struct expr *dep; |
166 | unsigned int flags; | 169 | unsigned int flags; |
167 | char *help; | 170 | char *help; |
@@ -189,7 +192,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e | |||
189 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); | 192 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); |
190 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); | 193 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); |
191 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); | 194 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); |
192 | struct expr *expr_copy(struct expr *org); | 195 | struct expr *expr_copy(const struct expr *org); |
193 | void expr_free(struct expr *e); | 196 | void expr_free(struct expr *e); |
194 | int expr_eq(struct expr *e1, struct expr *e2); | 197 | int expr_eq(struct expr *e1, struct expr *e2); |
195 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); | 198 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); |
@@ -204,6 +207,7 @@ struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2); | |||
204 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); | 207 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); |
205 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); | 208 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); |
206 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); | 209 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); |
210 | struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2); | ||
207 | 211 | ||
208 | void expr_fprint(struct expr *e, FILE *out); | 212 | void expr_fprint(struct expr *e, FILE *out); |
209 | struct gstr; /* forward */ | 213 | struct gstr; /* forward */ |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index bef10411837..455896164d7 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" |
@@ -1114,7 +1110,7 @@ static gchar **fill_row(struct menu *menu) | |||
1114 | 1110 | ||
1115 | row[COL_OPTION] = | 1111 | row[COL_OPTION] = |
1116 | g_strdup_printf("%s %s", _(menu_get_prompt(menu)), | 1112 | g_strdup_printf("%s %s", _(menu_get_prompt(menu)), |
1117 | sym && sym_has_value(sym) ? "(NEW)" : ""); | 1113 | sym && !sym_has_value(sym) ? "(NEW)" : ""); |
1118 | 1114 | ||
1119 | if (opt_mode == OPT_ALL && !menu_is_visible(menu)) | 1115 | if (opt_mode == OPT_ALL && !menu_is_visible(menu)) |
1120 | row[COL_COLOR] = g_strdup("DarkGray"); | 1116 | row[COL_COLOR] = g_strdup("DarkGray"); |
@@ -1343,7 +1339,8 @@ static void update_tree(struct menu *src, GtkTreeIter * dst) | |||
1343 | #endif | 1339 | #endif |
1344 | 1340 | ||
1345 | if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) || | 1341 | if ((opt_mode == OPT_NORMAL && !menu_is_visible(child1)) || |
1346 | (opt_mode == OPT_PROMPT && !menu_has_prompt(child1))) { | 1342 | (opt_mode == OPT_PROMPT && !menu_has_prompt(child1)) || |
1343 | (opt_mode == OPT_ALL && !menu_get_prompt(child1))) { | ||
1347 | 1344 | ||
1348 | /* remove node */ | 1345 | /* remove node */ |
1349 | if (gtktree_iter_find_node(dst, menu1) != NULL) { | 1346 | if (gtktree_iter_find_node(dst, menu1) != NULL) { |
@@ -1425,7 +1422,7 @@ static void display_tree(struct menu *menu) | |||
1425 | 1422 | ||
1426 | if ((opt_mode == OPT_NORMAL && menu_is_visible(child)) || | 1423 | if ((opt_mode == OPT_NORMAL && menu_is_visible(child)) || |
1427 | (opt_mode == OPT_PROMPT && menu_has_prompt(child)) || | 1424 | (opt_mode == OPT_PROMPT && menu_has_prompt(child)) || |
1428 | (opt_mode == OPT_ALL)) | 1425 | (opt_mode == OPT_ALL && menu_get_prompt(child))) |
1429 | place_node(child, fill_row(child)); | 1426 | place_node(child, fill_row(child)); |
1430 | #ifdef DEBUG | 1427 | #ifdef DEBUG |
1431 | printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); | 1428 | printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); |
@@ -1530,12 +1527,6 @@ int main(int ac, char *av[]) | |||
1530 | else | 1527 | else |
1531 | 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); |
1532 | 1529 | ||
1533 | /* Load the interface and connect signals */ | ||
1534 | init_main_window(glade_file); | ||
1535 | init_tree_model(); | ||
1536 | init_left_tree(); | ||
1537 | init_right_tree(); | ||
1538 | |||
1539 | /* Conf stuffs */ | 1530 | /* Conf stuffs */ |
1540 | if (ac > 1 && av[1][0] == '-') { | 1531 | if (ac > 1 && av[1][0] == '-') { |
1541 | switch (av[1][1]) { | 1532 | switch (av[1][1]) { |
@@ -1555,6 +1546,12 @@ int main(int ac, char *av[]) | |||
1555 | fixup_rootmenu(&rootmenu); | 1546 | fixup_rootmenu(&rootmenu); |
1556 | conf_read(NULL); | 1547 | conf_read(NULL); |
1557 | 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 | |||
1558 | switch (view_mode) { | 1555 | switch (view_mode) { |
1559 | case SINGLE_VIEW: | 1556 | case SINGLE_VIEW: |
1560 | display_tree_part(); | 1557 | display_tree_part(); |
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade index d52b0a75d82..aa483cb3275 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 dcc3fcc0cc9..e9d8e791bf0 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c | |||
@@ -63,11 +63,11 @@ next: | |||
63 | 63 | ||
64 | struct file_line { | 64 | struct 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 | ||
70 | static struct file_line *file_line__new(char *file, int lineno) | 70 | static 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 | ||
91 | static struct message *message__list; | 91 | static struct message *message__list; |
92 | 92 | ||
93 | static struct message *message__new(const char *msg, char *option, char *file, int lineno) | 93 | static 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 | ||
133 | static int message__add_file_line(struct message *self, char *file, int lineno) | 134 | static 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 | ||
148 | static int message__add(const char *msg, char *option, char *file, int lineno) | 150 | static 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 fdc7113b08d..6eb03971825 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 | ||
2425 | char *zconf_curname(void) | 2426 | const 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 ce6549cdacc..febf0c94d55 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -14,6 +14,7 @@ | |||
14 | static inline const char *gettext(const char *txt) { return txt; } | 14 | static inline const char *gettext(const char *txt) { return txt; } |
15 | static inline void textdomain(const char *domainname) {} | 15 | static inline void textdomain(const char *domainname) {} |
16 | static inline void bindtextdomain(const char *name, const char *dir) {} | 16 | static inline void bindtextdomain(const char *name, const char *dir) {} |
17 | static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; } | ||
17 | #endif | 18 | #endif |
18 | 19 | ||
19 | #ifdef __cplusplus | 20 | #ifdef __cplusplus |
@@ -31,12 +32,18 @@ extern "C" { | |||
31 | 32 | ||
32 | #define SRCTREE "srctree" | 33 | #define SRCTREE "srctree" |
33 | 34 | ||
35 | #ifndef PACKAGE | ||
34 | #define PACKAGE "linux" | 36 | #define PACKAGE "linux" |
37 | #endif | ||
38 | |||
35 | #define LOCALEDIR "/usr/share/locale" | 39 | #define LOCALEDIR "/usr/share/locale" |
36 | 40 | ||
37 | #define _(text) gettext(text) | 41 | #define _(text) gettext(text) |
38 | #define N_(text) (text) | 42 | #define N_(text) (text) |
39 | 43 | ||
44 | #ifndef CONFIG_ | ||
45 | #define CONFIG_ "CONFIG_" | ||
46 | #endif | ||
40 | 47 | ||
41 | #define TF_COMMAND 0x0001 | 48 | #define TF_COMMAND 0x0001 |
42 | #define TF_PARAM 0x0002 | 49 | #define TF_PARAM 0x0002 |
@@ -61,16 +68,21 @@ struct kconf_id { | |||
61 | enum symbol_type stype; | 68 | enum symbol_type stype; |
62 | }; | 69 | }; |
63 | 70 | ||
71 | #ifdef YYDEBUG | ||
72 | extern int zconfdebug; | ||
73 | #endif | ||
74 | |||
64 | int zconfparse(void); | 75 | int zconfparse(void); |
65 | void zconfdump(FILE *out); | 76 | void zconfdump(FILE *out); |
66 | |||
67 | extern int zconfdebug; | ||
68 | void zconf_starthelp(void); | 77 | void zconf_starthelp(void); |
69 | FILE *zconf_fopen(const char *name); | 78 | FILE *zconf_fopen(const char *name); |
70 | void zconf_initscan(const char *name); | 79 | void zconf_initscan(const char *name); |
71 | void zconf_nextfile(const char *name); | 80 | void zconf_nextfile(const char *name); |
72 | int zconf_lineno(void); | 81 | int zconf_lineno(void); |
73 | char *zconf_curname(void); | 82 | const char *zconf_curname(void); |
83 | |||
84 | /* conf.c */ | ||
85 | void xfgets(char *str, int size, FILE *in); | ||
74 | 86 | ||
75 | /* confdata.c */ | 87 | /* confdata.c */ |
76 | const char *conf_get_configname(void); | 88 | const char *conf_get_configname(void); |
@@ -80,6 +92,13 @@ void sym_set_change_count(int count); | |||
80 | void sym_add_change_count(int count); | 92 | void sym_add_change_count(int count); |
81 | void conf_set_all_new_symbols(enum conf_def_mode mode); | 93 | void conf_set_all_new_symbols(enum conf_def_mode mode); |
82 | 94 | ||
95 | /* confdata.c and expr.c */ | ||
96 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) | ||
97 | { | ||
98 | if (fwrite(str, len, count, out) < count) | ||
99 | fprintf(stderr, "\nError in writing or end of file.\n"); | ||
100 | } | ||
101 | |||
83 | /* kconfig_load.c */ | 102 | /* kconfig_load.c */ |
84 | void kconfig_load(void); | 103 | void kconfig_load(void); |
85 | 104 | ||
@@ -91,6 +110,7 @@ void menu_end_menu(void); | |||
91 | void menu_add_entry(struct symbol *sym); | 110 | void menu_add_entry(struct symbol *sym); |
92 | void menu_end_entry(void); | 111 | void menu_end_entry(void); |
93 | void menu_add_dep(struct expr *dep); | 112 | void menu_add_dep(struct expr *dep); |
113 | void menu_add_visibility(struct expr *dep); | ||
94 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); | 114 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); |
95 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); | 115 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); |
96 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); | 116 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); |
@@ -126,6 +146,8 @@ void sym_init(void); | |||
126 | void sym_clear_all_valid(void); | 146 | void sym_clear_all_valid(void); |
127 | void sym_set_all_changed(void); | 147 | void sym_set_all_changed(void); |
128 | void sym_set_changed(struct symbol *sym); | 148 | void sym_set_changed(struct symbol *sym); |
149 | struct symbol *sym_choice_default(struct symbol *sym); | ||
150 | const char *sym_get_string_default(struct symbol *sym); | ||
129 | struct symbol *sym_check_deps(struct symbol *sym); | 151 | struct symbol *sym_check_deps(struct symbol *sym); |
130 | struct property *prop_alloc(enum prop_type type, struct symbol *sym); | 152 | struct property *prop_alloc(enum prop_type type, struct symbol *sym); |
131 | struct symbol *prop_get_symbol(struct property *prop); | 153 | struct symbol *prop_get_symbol(struct property *prop); |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 7cadcad8233..17342fef38b 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -1,12 +1,15 @@ | |||
1 | #include <stdarg.h> | ||
1 | 2 | ||
2 | /* confdata.c */ | 3 | /* confdata.c */ |
3 | P(conf_parse,void,(const char *name)); | 4 | P(conf_parse,void,(const char *name)); |
4 | P(conf_read,int,(const char *name)); | 5 | P(conf_read,int,(const char *name)); |
5 | P(conf_read_simple,int,(const char *name, int)); | 6 | P(conf_read_simple,int,(const char *name, int)); |
7 | P(conf_write_defconfig,int,(const char *name)); | ||
6 | P(conf_write,int,(const char *name)); | 8 | P(conf_write,int,(const char *name)); |
7 | P(conf_write_autoconf,int,(void)); | 9 | P(conf_write_autoconf,int,(void)); |
8 | P(conf_get_changed,bool,(void)); | 10 | P(conf_get_changed,bool,(void)); |
9 | P(conf_set_changed_callback, void,(void (*fn)(void))); | 11 | P(conf_set_changed_callback, void,(void (*fn)(void))); |
12 | P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap))); | ||
10 | 13 | ||
11 | /* menu.c */ | 14 | /* menu.c */ |
12 | P(rootmenu,struct menu,); | 15 | P(rootmenu,struct menu,); |
@@ -27,6 +30,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | |||
27 | 30 | ||
28 | P(sym_lookup,struct symbol *,(const char *name, int flags)); | 31 | P(sym_lookup,struct symbol *,(const char *name, int flags)); |
29 | P(sym_find,struct symbol *,(const char *name)); | 32 | P(sym_find,struct symbol *,(const char *name)); |
33 | P(sym_expand_string_value,const char *,(const char *in)); | ||
30 | P(sym_re_search,struct symbol **,(const char *pattern)); | 34 | P(sym_re_search,struct symbol **,(const char *pattern)); |
31 | P(sym_type_name,const char *,(enum symbol_type type)); | 35 | P(sym_type_name,const char *,(enum symbol_type type)); |
32 | P(sym_calc_value,void,(struct symbol *sym)); | 36 | P(sym_calc_value,void,(struct symbol *sym)); |
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index fcef0f59d55..82cc3a85e7f 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/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c index bcc6f19c3a3..a2eb80fbc89 100644 --- a/scripts/kconfig/lxdialog/checklist.c +++ b/scripts/kconfig/lxdialog/checklist.c | |||
@@ -31,6 +31,10 @@ static int list_width, check_x, item_x; | |||
31 | static void print_item(WINDOW * win, int choice, int selected) | 31 | static void print_item(WINDOW * win, int choice, int selected) |
32 | { | 32 | { |
33 | int i; | 33 | int i; |
34 | char *list_item = malloc(list_width + 1); | ||
35 | |||
36 | strncpy(list_item, item_str(), list_width - item_x); | ||
37 | list_item[list_width - item_x] = '\0'; | ||
34 | 38 | ||
35 | /* Clear 'residue' of last item */ | 39 | /* Clear 'residue' of last item */ |
36 | wattrset(win, dlg.menubox.atr); | 40 | wattrset(win, dlg.menubox.atr); |
@@ -45,13 +49,14 @@ static void print_item(WINDOW * win, int choice, int selected) | |||
45 | wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); | 49 | wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' '); |
46 | 50 | ||
47 | wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr); | 51 | wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr); |
48 | mvwaddch(win, choice, item_x, item_str()[0]); | 52 | mvwaddch(win, choice, item_x, list_item[0]); |
49 | wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); | 53 | wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); |
50 | waddstr(win, (char *)item_str() + 1); | 54 | waddstr(win, list_item + 1); |
51 | if (selected) { | 55 | if (selected) { |
52 | wmove(win, choice, check_x + 1); | 56 | wmove(win, choice, check_x + 1); |
53 | wrefresh(win); | 57 | wrefresh(win); |
54 | } | 58 | } |
59 | free(list_item); | ||
55 | } | 60 | } |
56 | 61 | ||
57 | /* | 62 | /* |
@@ -175,6 +180,7 @@ do_resize: | |||
175 | check_x = 0; | 180 | check_x = 0; |
176 | item_foreach() | 181 | item_foreach() |
177 | check_x = MAX(check_x, strlen(item_str()) + 4); | 182 | check_x = MAX(check_x, strlen(item_str()) + 4); |
183 | check_x = MIN(check_x, list_width); | ||
178 | 184 | ||
179 | check_x = (list_width - check_x) / 2; | 185 | check_x = (list_width - check_x) / 2; |
180 | item_x = check_x + 4; | 186 | item_x = check_x + 4; |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index 2c83d3234d3..d433c7a2474 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -25,11 +25,9 @@ | |||
25 | static const char mconf_readme[] = N_( | 25 | static 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" |
@@ -74,7 +72,7 @@ static const char mconf_readme[] = N_( | |||
74 | "\n" | 72 | "\n" |
75 | " Shortcut: Press <H> or <?>.\n" | 73 | " Shortcut: Press <H> or <?>.\n" |
76 | "\n" | 74 | "\n" |
77 | "o To show hidden options, press <Z>.\n" | 75 | "o To toggle the display of hidden options, press <Z>.\n" |
78 | "\n" | 76 | "\n" |
79 | "\n" | 77 | "\n" |
80 | "Radiolists (Choice lists)\n" | 78 | "Radiolists (Choice lists)\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."), |
208 | load_config_help[] = N_( | 206 | load_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."), |
222 | save_config_help[] = N_( | 220 | save_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"), |
233 | search_help[] = N_( | 231 | search_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 | ||
273 | static int indent; | 271 | static 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) | |||
316 | again: | 310 | again: |
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 203632cc30b..5fdf10dc1d8 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 | ||
12 | static const char nohelp_text[] = N_( | 12 | static 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 | ||
15 | struct menu rootmenu; | 15 | struct menu rootmenu; |
16 | static struct menu **last_entry_ptr; | 16 | static struct menu **last_entry_ptr; |
@@ -58,6 +58,8 @@ void menu_add_entry(struct symbol *sym) | |||
58 | *last_entry_ptr = menu; | 58 | *last_entry_ptr = menu; |
59 | last_entry_ptr = &menu->next; | 59 | last_entry_ptr = &menu->next; |
60 | current_entry = menu; | 60 | current_entry = menu; |
61 | if (sym) | ||
62 | menu_add_symbol(P_SYMBOL, sym, NULL); | ||
61 | } | 63 | } |
62 | 64 | ||
63 | void menu_end_entry(void) | 65 | void menu_end_entry(void) |
@@ -136,8 +138,22 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
136 | while (isspace(*prompt)) | 138 | while (isspace(*prompt)) |
137 | prompt++; | 139 | prompt++; |
138 | } | 140 | } |
139 | if (current_entry->prompt) | 141 | if (current_entry->prompt && current_entry != &rootmenu) |
140 | prop_warn(prop, "prompt redefined"); | 142 | prop_warn(prop, "prompt redefined"); |
143 | |||
144 | /* Apply all upper menus' visibilities to actual prompts. */ | ||
145 | if(type == P_PROMPT) { | ||
146 | struct menu *menu = current_entry; | ||
147 | |||
148 | while ((menu = menu->parent) != NULL) { | ||
149 | if (!menu->visibility) | ||
150 | continue; | ||
151 | prop->visible.expr | ||
152 | = expr_alloc_and(prop->visible.expr, | ||
153 | menu->visibility); | ||
154 | } | ||
155 | } | ||
156 | |||
141 | current_entry->prompt = prop; | 157 | current_entry->prompt = prop; |
142 | } | 158 | } |
143 | prop->text = prompt; | 159 | prop->text = prompt; |
@@ -150,6 +166,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr | |||
150 | return menu_add_prop(type, prompt, NULL, dep); | 166 | return menu_add_prop(type, prompt, NULL, dep); |
151 | } | 167 | } |
152 | 168 | ||
169 | void menu_add_visibility(struct expr *expr) | ||
170 | { | ||
171 | current_entry->visibility = expr_alloc_and(current_entry->visibility, | ||
172 | expr); | ||
173 | } | ||
174 | |||
153 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) | 175 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) |
154 | { | 176 | { |
155 | menu_add_prop(type, NULL, expr, dep); | 177 | menu_add_prop(type, NULL, expr, dep); |
@@ -181,7 +203,7 @@ void menu_add_option(int token, char *arg) | |||
181 | } | 203 | } |
182 | } | 204 | } |
183 | 205 | ||
184 | static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) | 206 | static int menu_validate_number(struct symbol *sym, struct symbol *sym2) |
185 | { | 207 | { |
186 | return sym2->type == S_INT || sym2->type == S_HEX || | 208 | return sym2->type == S_INT || sym2->type == S_HEX || |
187 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); | 209 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); |
@@ -199,6 +221,15 @@ static void sym_check_prop(struct symbol *sym) | |||
199 | prop_warn(prop, | 221 | prop_warn(prop, |
200 | "default for config symbol '%s'" | 222 | "default for config symbol '%s'" |
201 | " must be a single symbol", sym->name); | 223 | " must be a single symbol", sym->name); |
224 | if (prop->expr->type != E_SYMBOL) | ||
225 | break; | ||
226 | sym2 = prop_get_symbol(prop); | ||
227 | if (sym->type == S_HEX || sym->type == S_INT) { | ||
228 | if (!menu_validate_number(sym, sym2)) | ||
229 | prop_warn(prop, | ||
230 | "'%s': number is invalid", | ||
231 | sym->name); | ||
232 | } | ||
202 | break; | 233 | break; |
203 | case P_SELECT: | 234 | case P_SELECT: |
204 | sym2 = prop_get_symbol(prop); | 235 | sym2 = prop_get_symbol(prop); |
@@ -218,8 +249,8 @@ static void sym_check_prop(struct symbol *sym) | |||
218 | if (sym->type != S_INT && sym->type != S_HEX) | 249 | if (sym->type != S_INT && sym->type != S_HEX) |
219 | prop_warn(prop, "range is only allowed " | 250 | prop_warn(prop, "range is only allowed " |
220 | "for int or hex symbols"); | 251 | "for int or hex symbols"); |
221 | if (!menu_range_valid_sym(sym, prop->expr->left.sym) || | 252 | if (!menu_validate_number(sym, prop->expr->left.sym) || |
222 | !menu_range_valid_sym(sym, prop->expr->right.sym)) | 253 | !menu_validate_number(sym, prop->expr->right.sym)) |
223 | prop_warn(prop, "range is invalid"); | 254 | prop_warn(prop, "range is invalid"); |
224 | break; | 255 | break; |
225 | default: | 256 | default: |
@@ -318,6 +349,8 @@ void menu_finalize(struct menu *parent) | |||
318 | parent->next = last_menu->next; | 349 | parent->next = last_menu->next; |
319 | last_menu->next = NULL; | 350 | last_menu->next = NULL; |
320 | } | 351 | } |
352 | |||
353 | sym->dir_dep.expr = parent->dep; | ||
321 | } | 354 | } |
322 | for (menu = parent->list; menu; menu = menu->next) { | 355 | for (menu = parent->list; menu; menu = menu->next) { |
323 | if (sym && sym_is_choice(sym) && | 356 | if (sym && sym_is_choice(sym) && |
@@ -406,6 +439,11 @@ bool menu_is_visible(struct menu *menu) | |||
406 | if (!menu->prompt) | 439 | if (!menu->prompt) |
407 | return false; | 440 | return false; |
408 | 441 | ||
442 | if (menu->visibility) { | ||
443 | if (expr_calc_value(menu->visibility) == no) | ||
444 | return no; | ||
445 | } | ||
446 | |||
409 | sym = menu->sym; | 447 | sym = menu->sym; |
410 | if (sym) { | 448 | if (sym) { |
411 | sym_calc_value(sym); | 449 | sym_calc_value(sym); |
@@ -419,9 +457,13 @@ bool menu_is_visible(struct menu *menu) | |||
419 | if (!sym || sym_get_tristate_value(menu->sym) == no) | 457 | if (!sym || sym_get_tristate_value(menu->sym) == no) |
420 | return false; | 458 | return false; |
421 | 459 | ||
422 | for (child = menu->list; child; child = child->next) | 460 | for (child = menu->list; child; child = child->next) { |
423 | if (menu_is_visible(child)) | 461 | if (menu_is_visible(child)) { |
462 | if (sym) | ||
463 | sym->flags |= SYMBOL_DEF_USER; | ||
424 | return true; | 464 | return true; |
465 | } | ||
466 | } | ||
425 | 467 | ||
426 | return false; | 468 | return false; |
427 | } | 469 | } |
@@ -501,9 +543,19 @@ void get_symbol_str(struct gstr *r, struct symbol *sym) | |||
501 | bool hit; | 543 | bool hit; |
502 | struct property *prop; | 544 | struct property *prop; |
503 | 545 | ||
504 | if (sym && sym->name) | 546 | if (sym && sym->name) { |
505 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | 547 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, |
506 | sym_get_string_value(sym)); | 548 | sym_get_string_value(sym)); |
549 | str_printf(r, "Type : %s\n", sym_type_name(sym->type)); | ||
550 | if (sym->type == S_INT || sym->type == S_HEX) { | ||
551 | prop = sym_get_range_prop(sym); | ||
552 | if (prop) { | ||
553 | str_printf(r, "Range : "); | ||
554 | expr_gstr_print(prop->expr, r); | ||
555 | str_append(r, "\n"); | ||
556 | } | ||
557 | } | ||
558 | } | ||
507 | for_all_prompts(sym, prop) | 559 | for_all_prompts(sym, prop) |
508 | get_prompt_str(r, prop); | 560 | get_prompt_str(r, prop); |
509 | hit = false; | 561 | hit = false; |
@@ -545,7 +597,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) | |||
545 | 597 | ||
546 | if (menu_has_help(menu)) { | 598 | if (menu_has_help(menu)) { |
547 | if (sym->name) { | 599 | if (sym->name) { |
548 | str_printf(help, "CONFIG_%s:\n\n", sym->name); | 600 | str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); |
549 | str_append(help, _(menu_get_help(menu))); | 601 | str_append(help, _(menu_get_help(menu))); |
550 | str_append(help, "\n"); | 602 | str_append(help, "\n"); |
551 | } | 603 | } |
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 762caf80ce3..db56377393d 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 | ||
12 | static const char nconf_readme[] = N_( | 15 | static 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"), |
150 | menu_instructions[] = N_( | 155 | menu_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"), |
161 | radiolist_instructions[] = N_( | 166 | radiolist_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."), |
180 | nohelp_text[] = N_( | 185 | nohelp_text[] = N_( |
181 | "There is no help available for this kernel option.\n"), | 186 | "There is no help available for this option.\n"), |
182 | load_config_text[] = N_( | 187 | load_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."), |
186 | load_config_help[] = N_( | 191 | load_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."), |
200 | save_config_help[] = N_( | 205 | save_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"), |
211 | search_help[] = N_( | 216 | search_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 | ||
251 | struct mitem { | 256 | struct 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; | |||
275 | static int global_exit; | 279 | static int global_exit; |
276 | /* the currently selected button */ | 280 | /* the currently selected button */ |
277 | const char *current_instructions = menu_instructions; | 281 | const 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 | ||
282 | struct { | ||
283 | int count; | ||
284 | int ptrs[MAX_MENU_ITEMS]; | ||
285 | } hotkeys[1<<(sizeof(char)*8)]; | ||
286 | 282 | ||
287 | static void conf(struct menu *menu); | 283 | static void conf(struct menu *menu); |
288 | static void conf_choice(struct menu *menu); | 284 | static void conf_choice(struct menu *menu); |
@@ -292,6 +288,7 @@ static void conf_save(void); | |||
292 | static void show_help(struct menu *menu); | 288 | static void show_help(struct menu *menu); |
293 | static int do_exit(void); | 289 | static int do_exit(void); |
294 | static void setup_windows(void); | 290 | static void setup_windows(void); |
291 | static void search_conf(void); | ||
295 | 292 | ||
296 | typedef void (*function_key_handler_t)(int *key, struct menu *menu); | 293 | typedef void (*function_key_handler_t)(int *key, struct menu *menu); |
297 | static void handle_f1(int *key, struct menu *current_item); | 294 | static void handle_f1(int *key, struct menu *current_item); |
@@ -302,6 +299,7 @@ static void handle_f5(int *key, struct menu *current_item); | |||
302 | static void handle_f6(int *key, struct menu *current_item); | 299 | static void handle_f6(int *key, struct menu *current_item); |
303 | static void handle_f7(int *key, struct menu *current_item); | 300 | static void handle_f7(int *key, struct menu *current_item); |
304 | static void handle_f8(int *key, struct menu *current_item); | 301 | static void handle_f8(int *key, struct menu *current_item); |
302 | static void handle_f9(int *key, struct menu *current_item); | ||
305 | 303 | ||
306 | struct function_keys { | 304 | struct 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 | ||
313 | static const int function_keys_num = 8; | 311 | static const int function_keys_num = 9; |
314 | struct function_keys function_keys[] = { | 312 | struct 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 */ |
448 | static void handle_f8(int *key, struct menu *current_item) | 452 | static void handle_f8(int *key, struct menu *current_item) |
449 | { | 453 | { |
454 | search_conf(); | ||
455 | return; | ||
456 | } | ||
457 | |||
458 | /* exit */ | ||
459 | static 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 */ | 496 | typedef enum {MATCH_TINKER_PATTERN_UP, MATCH_TINKER_PATTERN_DOWN, |
487 | static 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 */ | ||
506 | static 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. */ | ||
514 | static 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 | 500 | static int get_mext_match(const char *match_str, match_f flag) |
521 | * return 0 on success*/ | ||
522 | static 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 */ | ||
582 | static void item_make(struct menu *menu, char tag, const char *fmt, ...) | 528 | static 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( |
@@ -676,6 +616,8 @@ static void *item_data(void) | |||
676 | struct mitem *mcur; | 616 | struct mitem *mcur; |
677 | 617 | ||
678 | cur = current_item(curses_menu); | 618 | cur = current_item(curses_menu); |
619 | if (!cur) | ||
620 | return NULL; | ||
679 | mcur = (struct mitem *) item_userptr(cur); | 621 | mcur = (struct mitem *) item_userptr(cur); |
680 | return mcur->usrptr; | 622 | return mcur->usrptr; |
681 | 623 | ||
@@ -691,13 +633,9 @@ static char menu_backtitle[PATH_MAX+128]; | |||
691 | static const char *set_config_filename(const char *config_filename) | 633 | static const char *set_config_filename(const char *config_filename) |
692 | { | 634 | { |
693 | int size; | 635 | int size; |
694 | struct symbol *sym; | ||
695 | 636 | ||
696 | sym = sym_lookup("KERNELVERSION", 0); | ||
697 | sym_calc_value(sym); | ||
698 | size = snprintf(menu_backtitle, sizeof(menu_backtitle), | 637 | size = snprintf(menu_backtitle, sizeof(menu_backtitle), |
699 | _("%s - Linux Kernel v%s Configuration"), | 638 | "%s - %s", config_filename, rootmenu.prompt->text); |
700 | config_filename, sym_get_string_value(sym)); | ||
701 | if (size >= sizeof(menu_backtitle)) | 639 | if (size >= sizeof(menu_backtitle)) |
702 | menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; | 640 | menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; |
703 | 641 | ||
@@ -707,25 +645,6 @@ static const char *set_config_filename(const char *config_filename) | |||
707 | return menu_backtitle; | 645 | return menu_backtitle; |
708 | } | 646 | } |
709 | 647 | ||
710 | /* command = 0 is supress, 1 is restore */ | ||
711 | static void supress_stdout(int command) | ||
712 | { | ||
713 | static FILE *org_stdout; | ||
714 | static FILE *org_stderr; | ||
715 | |||
716 | if (command == 0) { | ||
717 | org_stdout = stdout; | ||
718 | org_stderr = stderr; | ||
719 | stdout = fopen("/dev/null", "a"); | ||
720 | stderr = fopen("/dev/null", "a"); | ||
721 | } else { | ||
722 | fclose(stdout); | ||
723 | fclose(stderr); | ||
724 | stdout = org_stdout; | ||
725 | stderr = org_stderr; | ||
726 | } | ||
727 | } | ||
728 | |||
729 | /* return = 0 means we are successful. | 648 | /* return = 0 means we are successful. |
730 | * -1 means go on doing what you were doing | 649 | * -1 means go on doing what you were doing |
731 | */ | 650 | */ |
@@ -737,8 +656,7 @@ static int do_exit(void) | |||
737 | return 0; | 656 | return 0; |
738 | } | 657 | } |
739 | res = btn_dialog(main_window, | 658 | res = btn_dialog(main_window, |
740 | _("Do you wish to save your " | 659 | _("Do you wish to save your new configuration?\n" |
741 | "new kernel configuration?\n" | ||
742 | "<ESC> to cancel and resume nconfig."), | 660 | "<ESC> to cancel and resume nconfig."), |
743 | 2, | 661 | 2, |
744 | " <save> ", | 662 | " <save> ", |
@@ -751,36 +669,19 @@ static int do_exit(void) | |||
751 | /* if we got here, the user really wants to exit */ | 669 | /* if we got here, the user really wants to exit */ |
752 | switch (res) { | 670 | switch (res) { |
753 | case 0: | 671 | case 0: |
754 | supress_stdout(0); | ||
755 | res = conf_write(filename); | 672 | res = conf_write(filename); |
756 | supress_stdout(1); | ||
757 | if (res) | 673 | if (res) |
758 | btn_dialog( | 674 | btn_dialog( |
759 | main_window, | 675 | main_window, |
760 | _("Error during writing of the kernel " | 676 | _("Error during writing of configuration.\n" |
761 | "configuration.\n" | 677 | "Your configuration changes were NOT saved."), |
762 | "Your kernel configuration " | ||
763 | "changes were NOT saved."), | ||
764 | 1, | 678 | 1, |
765 | "<OK>"); | 679 | "<OK>"); |
766 | else { | ||
767 | char buf[1024]; | ||
768 | snprintf(buf, 1024, | ||
769 | _("Configuration written to %s\n" | ||
770 | "End of Linux kernel configuration.\n" | ||
771 | "Execute 'make' to build the kernel or try" | ||
772 | " 'make help'."), filename); | ||
773 | btn_dialog( | ||
774 | main_window, | ||
775 | buf, | ||
776 | 1, | ||
777 | "<OK>"); | ||
778 | } | ||
779 | break; | 680 | break; |
780 | default: | 681 | default: |
781 | btn_dialog( | 682 | btn_dialog( |
782 | main_window, | 683 | main_window, |
783 | _("Your kernel configuration changes were NOT saved."), | 684 | _("Your configuration changes were NOT saved."), |
784 | 1, | 685 | 1, |
785 | "<OK>"); | 686 | "<OK>"); |
786 | break; | 687 | break; |
@@ -800,8 +701,8 @@ static void search_conf(void) | |||
800 | again: | 701 | again: |
801 | dres = dialog_inputbox(main_window, | 702 | dres = dialog_inputbox(main_window, |
802 | _("Search Configuration Parameter"), | 703 | _("Search Configuration Parameter"), |
803 | _("Enter CONFIG_ (sub)string to search for " | 704 | _("Enter " CONFIG_ " (sub)string to search for " |
804 | "(with or without \"CONFIG\")"), | 705 | "(with or without \"" CONFIG_ "\")"), |
805 | "", dialog_input_result, 99); | 706 | "", dialog_input_result, 99); |
806 | switch (dres) { | 707 | switch (dres) { |
807 | case 0: | 708 | case 0: |
@@ -814,10 +715,10 @@ again: | |||
814 | return; | 715 | return; |
815 | } | 716 | } |
816 | 717 | ||
817 | /* strip CONFIG_ if necessary */ | 718 | /* strip the prefix if necessary */ |
818 | dialog_input = dialog_input_result; | 719 | dialog_input = dialog_input_result; |
819 | if (strncasecmp(dialog_input_result, "CONFIG_", 7) == 0) | 720 | if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0) |
820 | dialog_input += 7; | 721 | dialog_input += strlen(CONFIG_); |
821 | 722 | ||
822 | sym_arr = sym_re_search(dialog_input); | 723 | sym_arr = sym_re_search(dialog_input); |
823 | res = get_relations_str(sym_arr); | 724 | res = get_relations_str(sym_arr); |
@@ -1025,23 +926,18 @@ static void reset_menu(void) | |||
1025 | static void center_item(int selected_index, int *last_top_row) | 926 | static void center_item(int selected_index, int *last_top_row) |
1026 | { | 927 | { |
1027 | int toprow; | 928 | int toprow; |
1028 | int maxy, maxx; | ||
1029 | 929 | ||
1030 | scale_menu(curses_menu, &maxy, &maxx); | ||
1031 | set_top_row(curses_menu, *last_top_row); | 930 | set_top_row(curses_menu, *last_top_row); |
1032 | toprow = top_row(curses_menu); | 931 | toprow = top_row(curses_menu); |
1033 | if (selected_index >= toprow && selected_index < toprow+maxy) { | 932 | if (selected_index < toprow || |
1034 | /* we can only move the selected item. no need to scroll */ | 933 | selected_index >= toprow+mwin_max_lines) { |
1035 | set_current_item(curses_menu, | 934 | toprow = max(selected_index-mwin_max_lines/2, 0); |
1036 | curses_menu_items[selected_index]); | 935 | if (toprow >= item_count(curses_menu)-mwin_max_lines) |
1037 | } else { | ||
1038 | toprow = max(selected_index-maxy/2, 0); | ||
1039 | if (toprow >= item_count(curses_menu)-maxy) | ||
1040 | toprow = item_count(curses_menu)-mwin_max_lines; | 936 | toprow = item_count(curses_menu)-mwin_max_lines; |
1041 | set_top_row(curses_menu, toprow); | 937 | set_top_row(curses_menu, toprow); |
1042 | set_current_item(curses_menu, | ||
1043 | curses_menu_items[selected_index]); | ||
1044 | } | 938 | } |
939 | set_current_item(curses_menu, | ||
940 | curses_menu_items[selected_index]); | ||
1045 | *last_top_row = toprow; | 941 | *last_top_row = toprow; |
1046 | post_menu(curses_menu); | 942 | post_menu(curses_menu); |
1047 | refresh_all_windows(main_window); | 943 | refresh_all_windows(main_window); |
@@ -1073,7 +969,7 @@ static void show_menu(const char *prompt, const char *instructions, | |||
1073 | /* position the menu at the middle of the screen */ | 969 | /* position the menu at the middle of the screen */ |
1074 | scale_menu(curses_menu, &maxy, &maxx); | 970 | scale_menu(curses_menu, &maxy, &maxx); |
1075 | maxx = min(maxx, mwin_max_cols-2); | 971 | maxx = min(maxx, mwin_max_cols-2); |
1076 | maxy = mwin_max_lines-2; | 972 | maxy = mwin_max_lines; |
1077 | menu_window = derwin(main_window, | 973 | menu_window = derwin(main_window, |
1078 | maxy, | 974 | maxy, |
1079 | maxx, | 975 | maxx, |
@@ -1097,10 +993,77 @@ static void show_menu(const char *prompt, const char *instructions, | |||
1097 | refresh_all_windows(main_window); | 993 | refresh_all_windows(main_window); |
1098 | } | 994 | } |
1099 | 995 | ||
996 | static 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 | } | ||
1100 | 1006 | ||
1101 | static void conf(struct menu *menu) | 1007 | struct match_state |
1102 | { | 1008 | { |
1009 | int in_search; | ||
1010 | match_f match_direction; | ||
1103 | 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 | */ | ||
1018 | static 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 | |||
1065 | static void conf(struct menu *menu) | ||
1066 | { | ||
1104 | struct menu *submenu = 0; | 1067 | struct menu *submenu = 0; |
1105 | const char *prompt = menu_get_prompt(menu); | 1068 | const char *prompt = menu_get_prompt(menu); |
1106 | struct symbol *sym; | 1069 | struct symbol *sym; |
@@ -1108,8 +1071,11 @@ static void conf(struct menu *menu) | |||
1108 | int res; | 1071 | int res; |
1109 | int current_index = 0; | 1072 | int current_index = 0; |
1110 | int last_top_row = 0; | 1073 | int last_top_row = 0; |
1111 | 1074 | struct match_state match_state = { | |
1112 | bzero(pattern, sizeof(pattern)); | 1075 | .in_search = 0, |
1076 | .match_direction = MATCH_TINKER_PATTERN_DOWN, | ||
1077 | .pattern = "", | ||
1078 | }; | ||
1113 | 1079 | ||
1114 | while (!global_exit) { | 1080 | while (!global_exit) { |
1115 | reset_menu(); | 1081 | reset_menu(); |
@@ -1122,7 +1088,22 @@ static void conf(struct menu *menu) | |||
1122 | _(menu_instructions), | 1088 | _(menu_instructions), |
1123 | current_index, &last_top_row); | 1089 | current_index, &last_top_row); |
1124 | keypad((menu_win(curses_menu)), TRUE); | 1090 | keypad((menu_win(curses_menu)), TRUE); |
1125 | 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, ¤t_index) == 0) { | ||
1102 | if (current_index != -1) | ||
1103 | center_item(current_index, | ||
1104 | &last_top_row); | ||
1105 | continue; | ||
1106 | } | ||
1126 | if (process_special_keys(&res, | 1107 | if (process_special_keys(&res, |
1127 | (struct menu *) item_data())) | 1108 | (struct menu *) item_data())) |
1128 | break; | 1109 | break; |
@@ -1153,19 +1134,13 @@ static void conf(struct menu *menu) | |||
1153 | if (res == 10 || res == 27 || | 1134 | if (res == 10 || res == 27 || |
1154 | res == 32 || res == 'n' || res == 'y' || | 1135 | res == 32 || res == 'n' || res == 'y' || |
1155 | res == KEY_LEFT || res == KEY_RIGHT || | 1136 | res == KEY_LEFT || res == KEY_RIGHT || |
1156 | res == 'm' || res == '/') | 1137 | res == 'm') |
1157 | break; | 1138 | break; |
1158 | else if (canbhot(res)) { | ||
1159 | /* check for hot keys: */ | ||
1160 | int tmp = get_next_hot(res); | ||
1161 | if (tmp != -1) | ||
1162 | center_item(tmp, &last_top_row); | ||
1163 | } | ||
1164 | refresh_all_windows(main_window); | 1139 | refresh_all_windows(main_window); |
1165 | } | 1140 | } |
1166 | 1141 | ||
1167 | refresh_all_windows(main_window); | 1142 | refresh_all_windows(main_window); |
1168 | /* if ESC or left*/ | 1143 | /* if ESC or left*/ |
1169 | if (res == 27 || (menu != &rootmenu && res == KEY_LEFT)) | 1144 | if (res == 27 || (menu != &rootmenu && res == KEY_LEFT)) |
1170 | break; | 1145 | break; |
1171 | 1146 | ||
@@ -1233,23 +1208,30 @@ static void conf(struct menu *menu) | |||
1233 | if (item_is_tag('t')) | 1208 | if (item_is_tag('t')) |
1234 | sym_set_tristate_value(sym, mod); | 1209 | sym_set_tristate_value(sym, mod); |
1235 | break; | 1210 | break; |
1236 | case '/': | ||
1237 | search_conf(); | ||
1238 | break; | ||
1239 | } | 1211 | } |
1240 | } | 1212 | } |
1241 | } | 1213 | } |
1242 | 1214 | ||
1215 | static 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 | |||
1243 | static void show_help(struct menu *menu) | 1223 | static void show_help(struct menu *menu) |
1244 | { | 1224 | { |
1245 | struct gstr help = str_new(); | 1225 | struct gstr help = str_new(); |
1246 | 1226 | ||
1247 | if (menu && menu->sym && menu_has_help(menu)) { | 1227 | if (menu && menu->sym && menu_has_help(menu)) { |
1248 | if (menu->sym->name) { | 1228 | if (menu->sym->name) { |
1249 | str_printf(&help, "CONFIG_%s:\n\n", menu->sym->name); | 1229 | str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name); |
1250 | str_append(&help, _(menu_get_help(menu))); | 1230 | str_append(&help, _(menu_get_help(menu))); |
1251 | str_append(&help, "\n"); | 1231 | str_append(&help, "\n"); |
1252 | get_symbol_str(&help, menu->sym); | 1232 | get_symbol_str(&help, menu->sym); |
1233 | } else { | ||
1234 | str_append(&help, _(menu_get_help(menu))); | ||
1253 | } | 1235 | } |
1254 | } else { | 1236 | } else { |
1255 | str_append(&help, nohelp_text); | 1237 | str_append(&help, nohelp_text); |
@@ -1266,6 +1248,11 @@ static void conf_choice(struct menu *menu) | |||
1266 | int selected_index = 0; | 1248 | int selected_index = 0; |
1267 | int last_top_row = 0; | 1249 | int last_top_row = 0; |
1268 | 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 | }; | ||
1269 | 1256 | ||
1270 | active = sym_get_choice_value(menu->sym); | 1257 | active = sym_get_choice_value(menu->sym); |
1271 | /* this is mostly duplicated from the conf() function. */ | 1258 | /* this is mostly duplicated from the conf() function. */ |
@@ -1279,9 +1266,13 @@ static void conf_choice(struct menu *menu) | |||
1279 | if (child->sym == sym_get_choice_value(menu->sym)) | 1266 | if (child->sym == sym_get_choice_value(menu->sym)) |
1280 | item_make(child, ':', "<X> %s", | 1267 | item_make(child, ':', "<X> %s", |
1281 | _(menu_get_prompt(child))); | 1268 | _(menu_get_prompt(child))); |
1282 | else | 1269 | else if (child->sym) |
1283 | item_make(child, ':', " %s", | 1270 | item_make(child, ':', " %s", |
1284 | _(menu_get_prompt(child))); | 1271 | _(menu_get_prompt(child))); |
1272 | else | ||
1273 | item_make(child, ':', "*** %s ***", | ||
1274 | _(menu_get_prompt(child))); | ||
1275 | |||
1285 | if (child->sym == active){ | 1276 | if (child->sym == active){ |
1286 | last_top_row = top_row(curses_menu); | 1277 | last_top_row = top_row(curses_menu); |
1287 | selected_index = i; | 1278 | selected_index = i; |
@@ -1292,7 +1283,22 @@ static void conf_choice(struct menu *menu) | |||
1292 | _(radiolist_instructions), | 1283 | _(radiolist_instructions), |
1293 | selected_index, | 1284 | selected_index, |
1294 | &last_top_row); | 1285 | &last_top_row); |
1295 | while (!global_exit && (res = wgetch(menu_win(curses_menu)))) { | 1286 | while (!global_exit) { |
1287 | if (match_state.in_search) { | ||
1288 | mvprintw(0, 0, "searching: %s", | ||
1289 | match_state.pattern); | ||
1290 | clrtoeol(); | ||
1291 | } | ||
1292 | refresh_all_windows(main_window); | ||
1293 | res = wgetch(menu_win(curses_menu)); | ||
1294 | if (!res) | ||
1295 | break; | ||
1296 | if (do_match(res, &match_state, &selected_index) == 0) { | ||
1297 | if (selected_index != -1) | ||
1298 | center_item(selected_index, | ||
1299 | &last_top_row); | ||
1300 | continue; | ||
1301 | } | ||
1296 | if (process_special_keys( | 1302 | if (process_special_keys( |
1297 | &res, | 1303 | &res, |
1298 | (struct menu *) item_data())) | 1304 | (struct menu *) item_data())) |
@@ -1322,13 +1328,8 @@ static void conf_choice(struct menu *menu) | |||
1322 | break; | 1328 | break; |
1323 | } | 1329 | } |
1324 | if (res == 10 || res == 27 || res == ' ' || | 1330 | if (res == 10 || res == 27 || res == ' ' || |
1325 | res == KEY_LEFT) | 1331 | res == KEY_LEFT){ |
1326 | break; | 1332 | break; |
1327 | else if (canbhot(res)) { | ||
1328 | /* check for hot keys: */ | ||
1329 | int tmp = get_next_hot(res); | ||
1330 | if (tmp != -1) | ||
1331 | center_item(tmp, &last_top_row); | ||
1332 | } | 1333 | } |
1333 | refresh_all_windows(main_window); | 1334 | refresh_all_windows(main_window); |
1334 | } | 1335 | } |
@@ -1337,7 +1338,7 @@ static void conf_choice(struct menu *menu) | |||
1337 | break; | 1338 | break; |
1338 | 1339 | ||
1339 | child = item_data(); | 1340 | child = item_data(); |
1340 | if (!child || !menu_is_visible(child)) | 1341 | if (!child || !menu_is_visible(child) || !child->sym) |
1341 | continue; | 1342 | continue; |
1342 | switch (res) { | 1343 | switch (res) { |
1343 | case ' ': | 1344 | case ' ': |
@@ -1447,16 +1448,8 @@ static void conf_save(void) | |||
1447 | case 0: | 1448 | case 0: |
1448 | if (!dialog_input_result[0]) | 1449 | if (!dialog_input_result[0]) |
1449 | return; | 1450 | return; |
1450 | supress_stdout(0); | ||
1451 | res = conf_write(dialog_input_result); | 1451 | res = conf_write(dialog_input_result); |
1452 | supress_stdout(1); | ||
1453 | if (!res) { | 1452 | if (!res) { |
1454 | char buf[1024]; | ||
1455 | sprintf(buf, "%s %s", | ||
1456 | _("configuration file saved to: "), | ||
1457 | dialog_input_result); | ||
1458 | btn_dialog(main_window, | ||
1459 | buf, 1, "<OK>"); | ||
1460 | set_config_filename(dialog_input_result); | 1453 | set_config_filename(dialog_input_result); |
1461 | return; | 1454 | return; |
1462 | } | 1455 | } |
@@ -1483,7 +1476,7 @@ void setup_windows(void) | |||
1483 | /* set up the menu and menu window */ | 1476 | /* set up the menu and menu window */ |
1484 | main_window = newwin(LINES-2, COLS-2, 2, 1); | 1477 | main_window = newwin(LINES-2, COLS-2, 2, 1); |
1485 | keypad(main_window, TRUE); | 1478 | keypad(main_window, TRUE); |
1486 | mwin_max_lines = LINES-6; | 1479 | mwin_max_lines = LINES-7; |
1487 | mwin_max_cols = COLS-6; | 1480 | mwin_max_cols = COLS-6; |
1488 | 1481 | ||
1489 | /* panels order is from bottom to top */ | 1482 | /* panels order is from bottom to top */ |
@@ -1530,9 +1523,10 @@ int main(int ac, char **av) | |||
1530 | /* set btns menu */ | 1523 | /* set btns menu */ |
1531 | curses_menu = new_menu(curses_menu_items); | 1524 | curses_menu = new_menu(curses_menu_items); |
1532 | menu_opts_off(curses_menu, O_SHOWDESC); | 1525 | menu_opts_off(curses_menu, O_SHOWDESC); |
1533 | menu_opts_off(curses_menu, O_SHOWMATCH); | 1526 | menu_opts_on(curses_menu, O_SHOWMATCH); |
1534 | menu_opts_on(curses_menu, O_ONEVALUE); | 1527 | menu_opts_on(curses_menu, O_ONEVALUE); |
1535 | menu_opts_on(curses_menu, O_NONCYCLIC); | 1528 | menu_opts_on(curses_menu, O_NONCYCLIC); |
1529 | menu_opts_on(curses_menu, O_IGNORECASE); | ||
1536 | set_menu_mark(curses_menu, " "); | 1530 | set_menu_mark(curses_menu, " "); |
1537 | set_menu_fore(curses_menu, attributes[MAIN_MENU_FORE]); | 1531 | set_menu_fore(curses_menu, attributes[MAIN_MENU_FORE]); |
1538 | set_menu_back(curses_menu, attributes[MAIN_MENU_BACK]); | 1532 | set_menu_back(curses_menu, attributes[MAIN_MENU_BACK]); |
@@ -1548,8 +1542,7 @@ int main(int ac, char **av) | |||
1548 | _(menu_no_f_instructions)); | 1542 | _(menu_no_f_instructions)); |
1549 | } | 1543 | } |
1550 | 1544 | ||
1551 | 1545 | conf_set_message_callback(conf_message_callback); | |
1552 | |||
1553 | /* do the work */ | 1546 | /* do the work */ |
1554 | while (!global_exit) { | 1547 | while (!global_exit) { |
1555 | conf(&rootmenu); | 1548 | conf(&rootmenu); |
diff --git a/scripts/kconfig/nconf.gui.c b/scripts/kconfig/nconf.gui.c index 115edb437fb..f8137b3a538 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 | } |
@@ -226,7 +226,7 @@ void fill_window(WINDOW *win, const char *text) | |||
226 | int len = get_line_length(line); | 226 | int len = get_line_length(line); |
227 | strncpy(tmp, line, min(len, x)); | 227 | strncpy(tmp, line, min(len, x)); |
228 | tmp[len] = '\0'; | 228 | tmp[len] = '\0'; |
229 | mvwprintw(win, i, 0, tmp); | 229 | mvwprintw(win, i, 0, "%s", tmp); |
230 | } | 230 | } |
231 | } | 231 | } |
232 | 232 | ||
@@ -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 fb429666600..58fbda8fc0d 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 | ||
75 | void set_colors(void); | 76 | void set_colors(void); |
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 00c51507cfc..06dd2e33581 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 @@ | |||
39 | static QApplication *configApp; | 56 | static QApplication *configApp; |
40 | static ConfigSettings *configSettings; | 57 | static ConfigSettings *configSettings; |
41 | 58 | ||
42 | QAction *ConfigMainWindow::saveAction; | 59 | Q3Action *ConfigMainWindow::saveAction; |
43 | 60 | ||
44 | static inline QString qgettext(const char* str) | 61 | static inline QString qgettext(const char* str) |
45 | { | 62 | { |
@@ -54,15 +71,14 @@ 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 | */ |
57 | QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) | 74 | Q3ValueList<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 | if (ok) { | 78 | QStringList::Iterator it; |
62 | QStringList::Iterator it; | 79 | |
63 | for (it = entryList.begin(); it != entryList.end(); ++it) | 80 | for (it = entryList.begin(); it != entryList.end(); ++it) |
64 | result.push_back((*it).toInt()); | 81 | result.push_back((*it).toInt()); |
65 | } | ||
66 | 82 | ||
67 | return result; | 83 | return result; |
68 | } | 84 | } |
@@ -70,10 +86,10 @@ QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) | |||
70 | /** | 86 | /** |
71 | * Writes a list of integer values to the application settings. | 87 | * Writes a list of integer values to the application settings. |
72 | */ | 88 | */ |
73 | bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value) | 89 | bool ConfigSettings::writeSizes(const QString& key, const Q3ValueList<int>& value) |
74 | { | 90 | { |
75 | QStringList stringList; | 91 | QStringList stringList; |
76 | QValueList<int>::ConstIterator it; | 92 | Q3ValueList<int>::ConstIterator it; |
77 | 93 | ||
78 | for (it = value.begin(); it != value.end(); ++it) | 94 | for (it = value.begin(); it != value.end(); ++it) |
79 | stringList.push_back(QString::number(*it)); | 95 | stringList.push_back(QString::number(*it)); |
@@ -81,7 +97,6 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value | |||
81 | } | 97 | } |
82 | 98 | ||
83 | 99 | ||
84 | #if QT_VERSION >= 300 | ||
85 | /* | 100 | /* |
86 | * set the new data | 101 | * set the new data |
87 | * TODO check the value | 102 | * TODO check the value |
@@ -92,7 +107,6 @@ void ConfigItem::okRename(int col) | |||
92 | sym_set_string_value(menu->sym, text(dataColIdx).latin1()); | 107 | sym_set_string_value(menu->sym, text(dataColIdx).latin1()); |
93 | listView()->updateList(this); | 108 | listView()->updateList(this); |
94 | } | 109 | } |
95 | #endif | ||
96 | 110 | ||
97 | /* | 111 | /* |
98 | * update the displayed of a menu entry | 112 | * update the displayed of a menu entry |
@@ -149,7 +163,7 @@ void ConfigItem::updateMenu(void) | |||
149 | case S_TRISTATE: | 163 | case S_TRISTATE: |
150 | char ch; | 164 | char ch; |
151 | 165 | ||
152 | if (!sym_is_changable(sym) && !list->showAll) { | 166 | if (!sym_is_changable(sym) && list->optMode == normalOpt) { |
153 | setPixmap(promptColIdx, 0); | 167 | setPixmap(promptColIdx, 0); |
154 | setText(noColIdx, QString::null); | 168 | setText(noColIdx, QString::null); |
155 | setText(modColIdx, QString::null); | 169 | setText(modColIdx, QString::null); |
@@ -196,11 +210,9 @@ void ConfigItem::updateMenu(void) | |||
196 | 210 | ||
197 | data = sym_get_string_value(sym); | 211 | data = sym_get_string_value(sym); |
198 | 212 | ||
199 | #if QT_VERSION >= 300 | ||
200 | int i = list->mapIdx(dataColIdx); | 213 | int i = list->mapIdx(dataColIdx); |
201 | if (i >= 0) | 214 | if (i >= 0) |
202 | setRenameEnabled(i, TRUE); | 215 | setRenameEnabled(i, TRUE); |
203 | #endif | ||
204 | setText(dataColIdx, data); | 216 | setText(dataColIdx, data); |
205 | if (type == S_STRING) | 217 | if (type == S_STRING) |
206 | prompt = QString("%1: %2").arg(prompt).arg(data); | 218 | prompt = QString("%1: %2").arg(prompt).arg(data); |
@@ -320,7 +332,7 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
320 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), | 332 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), |
321 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), | 333 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), |
322 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), | 334 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), |
323 | showAll(false), showName(false), showRange(false), showData(false), | 335 | showName(false), showRange(false), showData(false), optMode(normalOpt), |
324 | rootEntry(0), headerPopup(0) | 336 | rootEntry(0), headerPopup(0) |
325 | { | 337 | { |
326 | int i; | 338 | int i; |
@@ -337,10 +349,10 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
337 | 349 | ||
338 | if (name) { | 350 | if (name) { |
339 | configSettings->beginGroup(name); | 351 | configSettings->beginGroup(name); |
340 | showAll = configSettings->readBoolEntry("/showAll", false); | ||
341 | showName = configSettings->readBoolEntry("/showName", false); | 352 | showName = configSettings->readBoolEntry("/showName", false); |
342 | showRange = configSettings->readBoolEntry("/showRange", false); | 353 | showRange = configSettings->readBoolEntry("/showRange", false); |
343 | showData = configSettings->readBoolEntry("/showData", false); | 354 | showData = configSettings->readBoolEntry("/showData", false); |
355 | optMode = (enum optionMode)configSettings->readNumEntry("/optionMode", false); | ||
344 | configSettings->endGroup(); | 356 | configSettings->endGroup(); |
345 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | 357 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); |
346 | } | 358 | } |
@@ -352,6 +364,17 @@ ConfigList::ConfigList(ConfigView* p, const char *name) | |||
352 | reinit(); | 364 | reinit(); |
353 | } | 365 | } |
354 | 366 | ||
367 | bool ConfigList::menuSkip(struct menu *menu) | ||
368 | { | ||
369 | if (optMode == normalOpt && menu_is_visible(menu)) | ||
370 | return false; | ||
371 | if (optMode == promptOpt && menu_has_prompt(menu)) | ||
372 | return false; | ||
373 | if (optMode == allOpt) | ||
374 | return false; | ||
375 | return true; | ||
376 | } | ||
377 | |||
355 | void ConfigList::reinit(void) | 378 | void ConfigList::reinit(void) |
356 | { | 379 | { |
357 | removeColumn(dataColIdx); | 380 | removeColumn(dataColIdx); |
@@ -380,7 +403,7 @@ void ConfigList::saveSettings(void) | |||
380 | configSettings->writeEntry("/showName", showName); | 403 | configSettings->writeEntry("/showName", showName); |
381 | configSettings->writeEntry("/showRange", showRange); | 404 | configSettings->writeEntry("/showRange", showRange); |
382 | configSettings->writeEntry("/showData", showData); | 405 | configSettings->writeEntry("/showData", showData); |
383 | configSettings->writeEntry("/showAll", showAll); | 406 | configSettings->writeEntry("/optionMode", (int)optMode); |
384 | configSettings->endGroup(); | 407 | configSettings->endGroup(); |
385 | } | 408 | } |
386 | } | 409 | } |
@@ -422,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item) | |||
422 | if (!rootEntry) { | 445 | if (!rootEntry) { |
423 | if (mode != listMode) | 446 | if (mode != listMode) |
424 | goto update; | 447 | goto update; |
425 | QListViewItemIterator it(this); | 448 | Q3ListViewItemIterator it(this); |
426 | ConfigItem* item; | 449 | ConfigItem* item; |
427 | 450 | ||
428 | for (; it.current(); ++it) { | 451 | for (; it.current(); ++it) { |
@@ -517,11 +540,9 @@ void ConfigList::changeValue(ConfigItem* item) | |||
517 | case S_INT: | 540 | case S_INT: |
518 | case S_HEX: | 541 | case S_HEX: |
519 | case S_STRING: | 542 | case S_STRING: |
520 | #if QT_VERSION >= 300 | ||
521 | if (colMap[dataColIdx] >= 0) | 543 | if (colMap[dataColIdx] >= 0) |
522 | item->startRename(colMap[dataColIdx]); | 544 | item->startRename(colMap[dataColIdx]); |
523 | else | 545 | else |
524 | #endif | ||
525 | parent()->lineEdit->show(item); | 546 | parent()->lineEdit->show(item); |
526 | break; | 547 | break; |
527 | } | 548 | } |
@@ -553,7 +574,7 @@ void ConfigList::setParentMenu(void) | |||
553 | return; | 574 | return; |
554 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); | 575 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); |
555 | 576 | ||
556 | QListViewItemIterator it(this); | 577 | Q3ListViewItemIterator it(this); |
557 | for (; (item = (ConfigItem*)it.current()); it++) { | 578 | for (; (item = (ConfigItem*)it.current()); it++) { |
558 | if (item->menu == oldroot) { | 579 | if (item->menu == oldroot) { |
559 | setCurrentItem(item); | 580 | setCurrentItem(item); |
@@ -606,7 +627,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) | |||
606 | } | 627 | } |
607 | 628 | ||
608 | visible = menu_is_visible(child); | 629 | visible = menu_is_visible(child); |
609 | if (showAll || visible) { | 630 | if (!menuSkip(child)) { |
610 | if (!child->sym && !child->list && !child->prompt) | 631 | if (!child->sym && !child->list && !child->prompt) |
611 | continue; | 632 | continue; |
612 | if (!item || item->menu != child) | 633 | if (!item || item->menu != child) |
@@ -635,7 +656,7 @@ void ConfigList::updateMenuList(P* parent, struct menu* menu) | |||
635 | 656 | ||
636 | void ConfigList::keyPressEvent(QKeyEvent* ev) | 657 | void ConfigList::keyPressEvent(QKeyEvent* ev) |
637 | { | 658 | { |
638 | QListViewItem* i = currentItem(); | 659 | Q3ListViewItem* i = currentItem(); |
639 | ConfigItem* item; | 660 | ConfigItem* item; |
640 | struct menu *menu; | 661 | struct menu *menu; |
641 | enum prop_type type; | 662 | enum prop_type type; |
@@ -801,10 +822,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
801 | { | 822 | { |
802 | if (e->y() <= header()->geometry().bottom()) { | 823 | if (e->y() <= header()->geometry().bottom()) { |
803 | if (!headerPopup) { | 824 | if (!headerPopup) { |
804 | QAction *action; | 825 | Q3Action *action; |
805 | 826 | ||
806 | headerPopup = new QPopupMenu(this); | 827 | headerPopup = new Q3PopupMenu(this); |
807 | action = new QAction(NULL, _("Show Name"), 0, this); | 828 | action = new Q3Action(NULL, _("Show Name"), 0, this); |
808 | action->setToggleAction(TRUE); | 829 | action->setToggleAction(TRUE); |
809 | connect(action, SIGNAL(toggled(bool)), | 830 | connect(action, SIGNAL(toggled(bool)), |
810 | parent(), SLOT(setShowName(bool))); | 831 | parent(), SLOT(setShowName(bool))); |
@@ -812,7 +833,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
812 | action, SLOT(setOn(bool))); | 833 | action, SLOT(setOn(bool))); |
813 | action->setOn(showName); | 834 | action->setOn(showName); |
814 | action->addTo(headerPopup); | 835 | action->addTo(headerPopup); |
815 | action = new QAction(NULL, _("Show Range"), 0, this); | 836 | action = new Q3Action(NULL, _("Show Range"), 0, this); |
816 | action->setToggleAction(TRUE); | 837 | action->setToggleAction(TRUE); |
817 | connect(action, SIGNAL(toggled(bool)), | 838 | connect(action, SIGNAL(toggled(bool)), |
818 | parent(), SLOT(setShowRange(bool))); | 839 | parent(), SLOT(setShowRange(bool))); |
@@ -820,7 +841,7 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
820 | action, SLOT(setOn(bool))); | 841 | action, SLOT(setOn(bool))); |
821 | action->setOn(showRange); | 842 | action->setOn(showRange); |
822 | action->addTo(headerPopup); | 843 | action->addTo(headerPopup); |
823 | action = new QAction(NULL, _("Show Data"), 0, this); | 844 | action = new Q3Action(NULL, _("Show Data"), 0, this); |
824 | action->setToggleAction(TRUE); | 845 | action->setToggleAction(TRUE); |
825 | connect(action, SIGNAL(toggled(bool)), | 846 | connect(action, SIGNAL(toggled(bool)), |
826 | parent(), SLOT(setShowData(bool))); | 847 | parent(), SLOT(setShowData(bool))); |
@@ -835,7 +856,10 @@ void ConfigList::contextMenuEvent(QContextMenuEvent *e) | |||
835 | e->ignore(); | 856 | e->ignore(); |
836 | } | 857 | } |
837 | 858 | ||
838 | ConfigView* ConfigView::viewList; | 859 | ConfigView*ConfigView::viewList; |
860 | QAction *ConfigView::showNormalAction; | ||
861 | QAction *ConfigView::showAllAction; | ||
862 | QAction *ConfigView::showPromptAction; | ||
839 | 863 | ||
840 | ConfigView::ConfigView(QWidget* parent, const char *name) | 864 | ConfigView::ConfigView(QWidget* parent, const char *name) |
841 | : Parent(parent, name) | 865 | : Parent(parent, name) |
@@ -860,13 +884,16 @@ ConfigView::~ConfigView(void) | |||
860 | } | 884 | } |
861 | } | 885 | } |
862 | 886 | ||
863 | void ConfigView::setShowAll(bool b) | 887 | void ConfigView::setOptionMode(QAction *act) |
864 | { | 888 | { |
865 | if (list->showAll != b) { | 889 | if (act == showNormalAction) |
866 | list->showAll = b; | 890 | list->optMode = normalOpt; |
867 | list->updateListAll(); | 891 | else if (act == showAllAction) |
868 | emit showAllChanged(b); | 892 | list->optMode = allOpt; |
869 | } | 893 | else |
894 | list->optMode = promptOpt; | ||
895 | |||
896 | list->updateListAll(); | ||
870 | } | 897 | } |
871 | 898 | ||
872 | void ConfigView::setShowName(bool b) | 899 | void ConfigView::setShowName(bool b) |
@@ -898,7 +925,7 @@ void ConfigView::setShowData(bool b) | |||
898 | 925 | ||
899 | void ConfigList::setAllOpen(bool open) | 926 | void ConfigList::setAllOpen(bool open) |
900 | { | 927 | { |
901 | QListViewItemIterator it(this); | 928 | Q3ListViewItemIterator it(this); |
902 | 929 | ||
903 | for (; it.current(); it++) | 930 | for (; it.current(); it++) |
904 | it.current()->setOpen(open); | 931 | it.current()->setOpen(open); |
@@ -921,7 +948,7 @@ void ConfigView::updateListAll(void) | |||
921 | } | 948 | } |
922 | 949 | ||
923 | ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) | 950 | ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) |
924 | : Parent(parent, name), sym(0), menu(0) | 951 | : Parent(parent, name), sym(0), _menu(0) |
925 | { | 952 | { |
926 | if (name) { | 953 | if (name) { |
927 | configSettings->beginGroup(name); | 954 | configSettings->beginGroup(name); |
@@ -944,7 +971,7 @@ void ConfigInfoView::setShowDebug(bool b) | |||
944 | { | 971 | { |
945 | if (_showDebug != b) { | 972 | if (_showDebug != b) { |
946 | _showDebug = b; | 973 | _showDebug = b; |
947 | if (menu) | 974 | if (_menu) |
948 | menuInfo(); | 975 | menuInfo(); |
949 | else if (sym) | 976 | else if (sym) |
950 | symbolInfo(); | 977 | symbolInfo(); |
@@ -954,44 +981,16 @@ void ConfigInfoView::setShowDebug(bool b) | |||
954 | 981 | ||
955 | void ConfigInfoView::setInfo(struct menu *m) | 982 | void ConfigInfoView::setInfo(struct menu *m) |
956 | { | 983 | { |
957 | if (menu == m) | 984 | if (_menu == m) |
958 | return; | 985 | return; |
959 | menu = m; | 986 | _menu = m; |
960 | sym = NULL; | 987 | sym = NULL; |
961 | if (!menu) | 988 | if (!_menu) |
962 | clear(); | 989 | clear(); |
963 | else | 990 | else |
964 | menuInfo(); | 991 | menuInfo(); |
965 | } | 992 | } |
966 | 993 | ||
967 | void ConfigInfoView::setSource(const QString& name) | ||
968 | { | ||
969 | const char *p = name.latin1(); | ||
970 | |||
971 | menu = NULL; | ||
972 | sym = NULL; | ||
973 | |||
974 | switch (p[0]) { | ||
975 | case 'm': | ||
976 | struct menu *m; | ||
977 | |||
978 | if (sscanf(p, "m%p", &m) == 1 && menu != m) { | ||
979 | menu = m; | ||
980 | menuInfo(); | ||
981 | emit menuSelected(menu); | ||
982 | } | ||
983 | break; | ||
984 | case 's': | ||
985 | struct symbol *s; | ||
986 | |||
987 | if (sscanf(p, "s%p", &s) == 1 && sym != s) { | ||
988 | sym = s; | ||
989 | symbolInfo(); | ||
990 | } | ||
991 | break; | ||
992 | } | ||
993 | } | ||
994 | |||
995 | void ConfigInfoView::symbolInfo(void) | 994 | void ConfigInfoView::symbolInfo(void) |
996 | { | 995 | { |
997 | QString str; | 996 | QString str; |
@@ -1013,11 +1012,11 @@ void ConfigInfoView::menuInfo(void) | |||
1013 | struct symbol* sym; | 1012 | struct symbol* sym; |
1014 | QString head, debug, help; | 1013 | QString head, debug, help; |
1015 | 1014 | ||
1016 | sym = menu->sym; | 1015 | sym = _menu->sym; |
1017 | if (sym) { | 1016 | if (sym) { |
1018 | if (menu->prompt) { | 1017 | if (_menu->prompt) { |
1019 | head += "<big><b>"; | 1018 | head += "<big><b>"; |
1020 | head += print_filter(_(menu->prompt->text)); | 1019 | head += print_filter(_(_menu->prompt->text)); |
1021 | head += "</b></big>"; | 1020 | head += "</b></big>"; |
1022 | if (sym->name) { | 1021 | if (sym->name) { |
1023 | head += " ("; | 1022 | head += " ("; |
@@ -1043,23 +1042,23 @@ void ConfigInfoView::menuInfo(void) | |||
1043 | debug = debug_info(sym); | 1042 | debug = debug_info(sym); |
1044 | 1043 | ||
1045 | struct gstr help_gstr = str_new(); | 1044 | struct gstr help_gstr = str_new(); |
1046 | menu_get_ext_help(menu, &help_gstr); | 1045 | menu_get_ext_help(_menu, &help_gstr); |
1047 | help = print_filter(str_get(&help_gstr)); | 1046 | help = print_filter(str_get(&help_gstr)); |
1048 | str_free(&help_gstr); | 1047 | str_free(&help_gstr); |
1049 | } else if (menu->prompt) { | 1048 | } else if (_menu->prompt) { |
1050 | head += "<big><b>"; | 1049 | head += "<big><b>"; |
1051 | head += print_filter(_(menu->prompt->text)); | 1050 | head += print_filter(_(_menu->prompt->text)); |
1052 | head += "</b></big><br><br>"; | 1051 | head += "</b></big><br><br>"; |
1053 | if (showDebug()) { | 1052 | if (showDebug()) { |
1054 | if (menu->prompt->visible.expr) { | 1053 | if (_menu->prompt->visible.expr) { |
1055 | debug += " dep: "; | 1054 | debug += " dep: "; |
1056 | 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); |
1057 | debug += "<br><br>"; | 1056 | debug += "<br><br>"; |
1058 | } | 1057 | } |
1059 | } | 1058 | } |
1060 | } | 1059 | } |
1061 | if (showDebug()) | 1060 | if (showDebug()) |
1062 | 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); |
1063 | 1062 | ||
1064 | setText(head + debug + help); | 1063 | setText(head + debug + help); |
1065 | } | 1064 | } |
@@ -1162,10 +1161,10 @@ void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char | |||
1162 | *text += str2; | 1161 | *text += str2; |
1163 | } | 1162 | } |
1164 | 1163 | ||
1165 | QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) | 1164 | Q3PopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) |
1166 | { | 1165 | { |
1167 | QPopupMenu* popup = Parent::createPopupMenu(pos); | 1166 | Q3PopupMenu* popup = Parent::createPopupMenu(pos); |
1168 | QAction* action = new QAction(NULL, _("Show Debug Info"), 0, popup); | 1167 | Q3Action* action = new Q3Action(NULL, _("Show Debug Info"), 0, popup); |
1169 | action->setToggleAction(TRUE); | 1168 | action->setToggleAction(TRUE); |
1170 | connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); | 1169 | connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); |
1171 | connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); | 1170 | connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); |
@@ -1222,7 +1221,7 @@ ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *nam | |||
1222 | y = configSettings->readNumEntry("/window y", 0, &ok); | 1221 | y = configSettings->readNumEntry("/window y", 0, &ok); |
1223 | if (ok) | 1222 | if (ok) |
1224 | move(x, y); | 1223 | move(x, y); |
1225 | QValueList<int> sizes = configSettings->readSizes("/split", &ok); | 1224 | Q3ValueList<int> sizes = configSettings->readSizes("/split", &ok); |
1226 | if (ok) | 1225 | if (ok) |
1227 | split->setSizes(sizes); | 1226 | split->setSizes(sizes); |
1228 | configSettings->endGroup(); | 1227 | configSettings->endGroup(); |
@@ -1275,8 +1274,14 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1275 | char title[256]; | 1274 | char title[256]; |
1276 | 1275 | ||
1277 | QDesktopWidget *d = configApp->desktop(); | 1276 | QDesktopWidget *d = configApp->desktop(); |
1278 | snprintf(title, sizeof(title), _("Linux Kernel v%s Configuration"), | 1277 | snprintf(title, sizeof(title), "%s%s", |
1279 | getenv("KERNELVERSION")); | 1278 | rootmenu.prompt->text, |
1279 | #if QT_VERSION < 0x040000 | ||
1280 | " (Qt3)" | ||
1281 | #else | ||
1282 | "" | ||
1283 | #endif | ||
1284 | ); | ||
1280 | setCaption(title); | 1285 | setCaption(title); |
1281 | 1286 | ||
1282 | width = configSettings->readNumEntry("/window width", d->width() - 64); | 1287 | width = configSettings->readNumEntry("/window width", d->width() - 64); |
@@ -1309,60 +1314,79 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1309 | configList->setFocus(); | 1314 | configList->setFocus(); |
1310 | 1315 | ||
1311 | menu = menuBar(); | 1316 | menu = menuBar(); |
1312 | toolBar = new QToolBar("Tools", this); | 1317 | toolBar = new Q3ToolBar("Tools", this); |
1313 | 1318 | ||
1314 | backAction = new QAction("Back", QPixmap(xpm_back), _("Back"), 0, this); | 1319 | backAction = new Q3Action("Back", QPixmap(xpm_back), _("Back"), 0, this); |
1315 | connect(backAction, SIGNAL(activated()), SLOT(goBack())); | 1320 | connect(backAction, SIGNAL(activated()), SLOT(goBack())); |
1316 | backAction->setEnabled(FALSE); | 1321 | backAction->setEnabled(FALSE); |
1317 | 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); |
1318 | connect(quitAction, SIGNAL(activated()), SLOT(close())); | 1323 | connect(quitAction, SIGNAL(activated()), SLOT(close())); |
1319 | 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); |
1320 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); | 1325 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); |
1321 | 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); |
1322 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); | 1327 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); |
1323 | conf_set_changed_callback(conf_changed); | 1328 | conf_set_changed_callback(conf_changed); |
1324 | // Set saveAction's initial state | 1329 | // Set saveAction's initial state |
1325 | conf_changed(); | 1330 | conf_changed(); |
1326 | QAction *saveAsAction = new QAction("Save As...", _("Save &As..."), 0, this); | 1331 | Q3Action *saveAsAction = new Q3Action("Save As...", _("Save &As..."), 0, this); |
1327 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); | 1332 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); |
1328 | 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); |
1329 | connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); | 1334 | connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); |
1330 | 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); |
1331 | connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); | 1336 | connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); |
1332 | 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); |
1333 | connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); | 1338 | connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); |
1334 | 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); |
1335 | connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); | 1340 | connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); |
1336 | 1341 | ||
1337 | QAction *showNameAction = new QAction(NULL, _("Show Name"), 0, this); | 1342 | Q3Action *showNameAction = new Q3Action(NULL, _("Show Name"), 0, this); |
1338 | showNameAction->setToggleAction(TRUE); | 1343 | showNameAction->setToggleAction(TRUE); |
1339 | connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); | 1344 | connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); |
1340 | connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); | 1345 | connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); |
1341 | showNameAction->setOn(configView->showName()); | 1346 | showNameAction->setOn(configView->showName()); |
1342 | QAction *showRangeAction = new QAction(NULL, _("Show Range"), 0, this); | 1347 | Q3Action *showRangeAction = new Q3Action(NULL, _("Show Range"), 0, this); |
1343 | showRangeAction->setToggleAction(TRUE); | 1348 | showRangeAction->setToggleAction(TRUE); |
1344 | connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); | 1349 | connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); |
1345 | connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); | 1350 | connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); |
1346 | showRangeAction->setOn(configList->showRange); | 1351 | showRangeAction->setOn(configList->showRange); |
1347 | QAction *showDataAction = new QAction(NULL, _("Show Data"), 0, this); | 1352 | Q3Action *showDataAction = new Q3Action(NULL, _("Show Data"), 0, this); |
1348 | showDataAction->setToggleAction(TRUE); | 1353 | showDataAction->setToggleAction(TRUE); |
1349 | connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); | 1354 | connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); |
1350 | connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); | 1355 | connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); |
1351 | showDataAction->setOn(configList->showData); | 1356 | showDataAction->setOn(configList->showData); |
1352 | QAction *showAllAction = new QAction(NULL, _("Show All Options"), 0, this); | 1357 | |
1353 | showAllAction->setToggleAction(TRUE); | 1358 | QActionGroup *optGroup = new QActionGroup(this); |
1354 | connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); | 1359 | optGroup->setExclusive(TRUE); |
1355 | connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); | 1360 | connect(optGroup, SIGNAL(selected(QAction *)), configView, |
1356 | showAllAction->setOn(configList->showAll); | 1361 | SLOT(setOptionMode(QAction *))); |
1357 | QAction *showDebugAction = new QAction(NULL, _("Show Debug Info"), 0, this); | 1362 | connect(optGroup, SIGNAL(selected(QAction *)), menuView, |
1363 | SLOT(setOptionMode(QAction *))); | ||
1364 | |||
1365 | #if QT_VERSION >= 0x040000 | ||
1366 | configView->showNormalAction = new QAction(_("Show Normal Options"), 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 | ||
1374 | configView->showNormalAction->setToggleAction(TRUE); | ||
1375 | configView->showNormalAction->setOn(configList->optMode == normalOpt); | ||
1376 | configView->showAllAction->setToggleAction(TRUE); | ||
1377 | configView->showAllAction->setOn(configList->optMode == allOpt); | ||
1378 | configView->showPromptAction->setToggleAction(TRUE); | ||
1379 | configView->showPromptAction->setOn(configList->optMode == promptOpt); | ||
1380 | |||
1381 | Q3Action *showDebugAction = new Q3Action(NULL, _("Show Debug Info"), 0, this); | ||
1358 | showDebugAction->setToggleAction(TRUE); | 1382 | showDebugAction->setToggleAction(TRUE); |
1359 | connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); | 1383 | connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); |
1360 | connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); | 1384 | connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); |
1361 | showDebugAction->setOn(helpText->showDebug()); | 1385 | showDebugAction->setOn(helpText->showDebug()); |
1362 | 1386 | ||
1363 | QAction *showIntroAction = new QAction(NULL, _("Introduction"), 0, this); | 1387 | Q3Action *showIntroAction = new Q3Action(NULL, _("Introduction"), 0, this); |
1364 | connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); | 1388 | connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); |
1365 | QAction *showAboutAction = new QAction(NULL, _("About"), 0, this); | 1389 | Q3Action *showAboutAction = new Q3Action(NULL, _("About"), 0, this); |
1366 | connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); | 1390 | connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); |
1367 | 1391 | ||
1368 | // init tool bar | 1392 | // init tool bar |
@@ -1376,7 +1400,7 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1376 | fullViewAction->addTo(toolBar); | 1400 | fullViewAction->addTo(toolBar); |
1377 | 1401 | ||
1378 | // create config menu | 1402 | // create config menu |
1379 | QPopupMenu* config = new QPopupMenu(this); | 1403 | Q3PopupMenu* config = new Q3PopupMenu(this); |
1380 | menu->insertItem(_("&File"), config); | 1404 | menu->insertItem(_("&File"), config); |
1381 | loadAction->addTo(config); | 1405 | loadAction->addTo(config); |
1382 | saveAction->addTo(config); | 1406 | saveAction->addTo(config); |
@@ -1385,22 +1409,22 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1385 | quitAction->addTo(config); | 1409 | quitAction->addTo(config); |
1386 | 1410 | ||
1387 | // create edit menu | 1411 | // create edit menu |
1388 | QPopupMenu* editMenu = new QPopupMenu(this); | 1412 | Q3PopupMenu* editMenu = new Q3PopupMenu(this); |
1389 | menu->insertItem(_("&Edit"), editMenu); | 1413 | menu->insertItem(_("&Edit"), editMenu); |
1390 | searchAction->addTo(editMenu); | 1414 | searchAction->addTo(editMenu); |
1391 | 1415 | ||
1392 | // create options menu | 1416 | // create options menu |
1393 | QPopupMenu* optionMenu = new QPopupMenu(this); | 1417 | Q3PopupMenu* optionMenu = new Q3PopupMenu(this); |
1394 | menu->insertItem(_("&Option"), optionMenu); | 1418 | menu->insertItem(_("&Option"), optionMenu); |
1395 | showNameAction->addTo(optionMenu); | 1419 | showNameAction->addTo(optionMenu); |
1396 | showRangeAction->addTo(optionMenu); | 1420 | showRangeAction->addTo(optionMenu); |
1397 | showDataAction->addTo(optionMenu); | 1421 | showDataAction->addTo(optionMenu); |
1398 | optionMenu->insertSeparator(); | 1422 | optionMenu->insertSeparator(); |
1399 | showAllAction->addTo(optionMenu); | 1423 | optGroup->addTo(optionMenu); |
1400 | showDebugAction->addTo(optionMenu); | 1424 | optionMenu->insertSeparator(); |
1401 | 1425 | ||
1402 | // create help menu | 1426 | // create help menu |
1403 | QPopupMenu* helpMenu = new QPopupMenu(this); | 1427 | Q3PopupMenu* helpMenu = new Q3PopupMenu(this); |
1404 | menu->insertSeparator(); | 1428 | menu->insertSeparator(); |
1405 | menu->insertItem(_("&Help"), helpMenu); | 1429 | menu->insertItem(_("&Help"), helpMenu); |
1406 | showIntroAction->addTo(helpMenu); | 1430 | showIntroAction->addTo(helpMenu); |
@@ -1435,7 +1459,7 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1435 | showSplitView(); | 1459 | showSplitView(); |
1436 | 1460 | ||
1437 | // UI setup done, restore splitter positions | 1461 | // UI setup done, restore splitter positions |
1438 | QValueList<int> sizes = configSettings->readSizes("/split1", &ok); | 1462 | Q3ValueList<int> sizes = configSettings->readSizes("/split1", &ok); |
1439 | if (ok) | 1463 | if (ok) |
1440 | split1->setSizes(sizes); | 1464 | split1->setSizes(sizes); |
1441 | 1465 | ||
@@ -1446,7 +1470,7 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
1446 | 1470 | ||
1447 | void ConfigMainWindow::loadConfig(void) | 1471 | void ConfigMainWindow::loadConfig(void) |
1448 | { | 1472 | { |
1449 | QString s = QFileDialog::getOpenFileName(conf_get_configname(), NULL, this); | 1473 | QString s = Q3FileDialog::getOpenFileName(conf_get_configname(), NULL, this); |
1450 | if (s.isNull()) | 1474 | if (s.isNull()) |
1451 | return; | 1475 | return; |
1452 | if (conf_read(QFile::encodeName(s))) | 1476 | if (conf_read(QFile::encodeName(s))) |
@@ -1462,7 +1486,7 @@ void ConfigMainWindow::saveConfig(void) | |||
1462 | 1486 | ||
1463 | void ConfigMainWindow::saveConfigAs(void) | 1487 | void ConfigMainWindow::saveConfigAs(void) |
1464 | { | 1488 | { |
1465 | QString s = QFileDialog::getSaveFileName(conf_get_configname(), NULL, this); | 1489 | QString s = Q3FileDialog::getSaveFileName(conf_get_configname(), NULL, this); |
1466 | if (s.isNull()) | 1490 | if (s.isNull()) |
1467 | return; | 1491 | return; |
1468 | if (conf_write(QFile::encodeName(s))) | 1492 | if (conf_write(QFile::encodeName(s))) |
@@ -1491,7 +1515,7 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) | |||
1491 | ConfigList* list = NULL; | 1515 | ConfigList* list = NULL; |
1492 | ConfigItem* item; | 1516 | ConfigItem* item; |
1493 | 1517 | ||
1494 | if (!menu_is_visible(menu) && !configView->showAll()) | 1518 | if (configList->menuSkip(menu)) |
1495 | return; | 1519 | return; |
1496 | 1520 | ||
1497 | switch (configList->mode) { | 1521 | switch (configList->mode) { |
@@ -1631,7 +1655,7 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) | |||
1631 | 1655 | ||
1632 | void ConfigMainWindow::showIntro(void) | 1656 | void ConfigMainWindow::showIntro(void) |
1633 | { | 1657 | { |
1634 | 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" |
1635 | "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" |
1636 | "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" |
1637 | "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 b3b5657b6b3..91677d900db 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 |
10 | class QSettings { | 9 | #include <q3listview.h> |
11 | public: | 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 | ||
28 | class ConfigView; | 27 | class ConfigView; |
@@ -31,11 +30,10 @@ class ConfigItem; | |||
31 | class ConfigLineEdit; | 30 | class ConfigLineEdit; |
32 | class ConfigMainWindow; | 31 | class ConfigMainWindow; |
33 | 32 | ||
34 | |||
35 | class ConfigSettings : public QSettings { | 33 | class ConfigSettings : public QSettings { |
36 | public: | 34 | public: |
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 | ||
41 | enum colIdx { | 39 | enum colIdx { |
@@ -44,10 +42,13 @@ enum colIdx { | |||
44 | enum listMode { | 42 | enum listMode { |
45 | singleMode, menuMode, symbolMode, fullMode, listMode | 43 | singleMode, menuMode, symbolMode, fullMode, listMode |
46 | }; | 44 | }; |
45 | enum optionMode { | ||
46 | normalOpt = 0, allOpt, promptOpt | ||
47 | }; | ||
47 | 48 | ||
48 | class ConfigList : public QListView { | 49 | class ConfigList : public Q3ListView { |
49 | Q_OBJECT | 50 | Q_OBJECT |
50 | typedef class QListView Parent; | 51 | typedef class Q3ListView Parent; |
51 | public: | 52 | public: |
52 | ConfigList(ConfigView* p, const char *name = 0); | 53 | ConfigList(ConfigView* p, const char *name = 0); |
53 | void reinit(void); | 54 | void reinit(void); |
@@ -115,6 +116,8 @@ public: | |||
115 | void setAllOpen(bool open); | 116 | void setAllOpen(bool open); |
116 | void setParentMenu(void); | 117 | void setParentMenu(void); |
117 | 118 | ||
119 | bool menuSkip(struct menu *); | ||
120 | |||
118 | template <class P> | 121 | template <class P> |
119 | void updateMenuList(P*, struct menu*); | 122 | void updateMenuList(P*, struct menu*); |
120 | 123 | ||
@@ -124,22 +127,23 @@ public: | |||
124 | QPixmap choiceYesPix, choiceNoPix; | 127 | QPixmap choiceYesPix, choiceNoPix; |
125 | QPixmap menuPix, menuInvPix, menuBackPix, voidPix; | 128 | QPixmap menuPix, menuInvPix, menuBackPix, voidPix; |
126 | 129 | ||
127 | bool showAll, showName, showRange, showData; | 130 | bool showName, showRange, showData; |
128 | enum listMode mode; | 131 | enum listMode mode; |
132 | enum optionMode optMode; | ||
129 | struct menu *rootEntry; | 133 | struct menu *rootEntry; |
130 | QColorGroup disabledColorGroup; | 134 | QColorGroup disabledColorGroup; |
131 | QColorGroup inactivedColorGroup; | 135 | QColorGroup inactivedColorGroup; |
132 | QPopupMenu* headerPopup; | 136 | Q3PopupMenu* headerPopup; |
133 | 137 | ||
134 | private: | 138 | private: |
135 | int colMap[colNr]; | 139 | int colMap[colNr]; |
136 | int colRevMap[colNr]; | 140 | int colRevMap[colNr]; |
137 | }; | 141 | }; |
138 | 142 | ||
139 | class ConfigItem : public QListViewItem { | 143 | class ConfigItem : public Q3ListViewItem { |
140 | typedef class QListViewItem Parent; | 144 | typedef class Q3ListViewItem Parent; |
141 | public: | 145 | public: |
142 | ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v) | 146 | ConfigItem(Q3ListView *parent, ConfigItem *after, struct menu *m, bool v) |
143 | : Parent(parent, after), menu(m), visible(v), goParent(false) | 147 | : Parent(parent, after), menu(m), visible(v), goParent(false) |
144 | { | 148 | { |
145 | init(); | 149 | init(); |
@@ -149,16 +153,14 @@ public: | |||
149 | { | 153 | { |
150 | init(); | 154 | init(); |
151 | } | 155 | } |
152 | ConfigItem(QListView *parent, ConfigItem *after, bool v) | 156 | ConfigItem(Q3ListView *parent, ConfigItem *after, bool v) |
153 | : Parent(parent, after), menu(0), visible(v), goParent(true) | 157 | : Parent(parent, after), menu(0), visible(v), goParent(true) |
154 | { | 158 | { |
155 | init(); | 159 | init(); |
156 | } | 160 | } |
157 | ~ConfigItem(void); | 161 | ~ConfigItem(void); |
158 | void init(void); | 162 | void init(void); |
159 | #if QT_VERSION >= 300 | ||
160 | void okRename(int col); | 163 | void okRename(int col); |
161 | #endif | ||
162 | void updateMenu(void); | 164 | void updateMenu(void); |
163 | void testUpdateMenu(bool v); | 165 | void testUpdateMenu(bool v); |
164 | ConfigList* listView() const | 166 | ConfigList* listView() const |
@@ -213,26 +215,24 @@ public: | |||
213 | ConfigItem *item; | 215 | ConfigItem *item; |
214 | }; | 216 | }; |
215 | 217 | ||
216 | class ConfigView : public QVBox { | 218 | class ConfigView : public Q3VBox { |
217 | Q_OBJECT | 219 | Q_OBJECT |
218 | typedef class QVBox Parent; | 220 | typedef class Q3VBox Parent; |
219 | public: | 221 | public: |
220 | ConfigView(QWidget* parent, const char *name = 0); | 222 | ConfigView(QWidget* parent, const char *name = 0); |
221 | ~ConfigView(void); | 223 | ~ConfigView(void); |
222 | static void updateList(ConfigItem* item); | 224 | static void updateList(ConfigItem* item); |
223 | static void updateListAll(void); | 225 | static void updateListAll(void); |
224 | 226 | ||
225 | bool showAll(void) const { return list->showAll; } | ||
226 | bool showName(void) const { return list->showName; } | 227 | bool showName(void) const { return list->showName; } |
227 | bool showRange(void) const { return list->showRange; } | 228 | bool showRange(void) const { return list->showRange; } |
228 | bool showData(void) const { return list->showData; } | 229 | bool showData(void) const { return list->showData; } |
229 | public slots: | 230 | public slots: |
230 | void setShowAll(bool); | ||
231 | void setShowName(bool); | 231 | void setShowName(bool); |
232 | void setShowRange(bool); | 232 | void setShowRange(bool); |
233 | void setShowData(bool); | 233 | void setShowData(bool); |
234 | void setOptionMode(QAction *); | ||
234 | signals: | 235 | signals: |
235 | void showAllChanged(bool); | ||
236 | void showNameChanged(bool); | 236 | void showNameChanged(bool); |
237 | void showRangeChanged(bool); | 237 | void showRangeChanged(bool); |
238 | void showDataChanged(bool); | 238 | void showDataChanged(bool); |
@@ -242,11 +242,15 @@ public: | |||
242 | 242 | ||
243 | static ConfigView* viewList; | 243 | static ConfigView* viewList; |
244 | ConfigView* nextView; | 244 | ConfigView* nextView; |
245 | |||
246 | static QAction *showNormalAction; | ||
247 | static QAction *showAllAction; | ||
248 | static QAction *showPromptAction; | ||
245 | }; | 249 | }; |
246 | 250 | ||
247 | class ConfigInfoView : public QTextBrowser { | 251 | class ConfigInfoView : public Q3TextBrowser { |
248 | Q_OBJECT | 252 | Q_OBJECT |
249 | typedef class QTextBrowser Parent; | 253 | typedef class Q3TextBrowser Parent; |
250 | public: | 254 | public: |
251 | ConfigInfoView(QWidget* parent, const char *name = 0); | 255 | ConfigInfoView(QWidget* parent, const char *name = 0); |
252 | bool showDebug(void) const { return _showDebug; } | 256 | bool showDebug(void) const { return _showDebug; } |
@@ -254,7 +258,6 @@ public: | |||
254 | public slots: | 258 | public slots: |
255 | void setInfo(struct menu *menu); | 259 | void setInfo(struct menu *menu); |
256 | void saveSettings(void); | 260 | void saveSettings(void); |
257 | void setSource(const QString& name); | ||
258 | void setShowDebug(bool); | 261 | void setShowDebug(bool); |
259 | 262 | ||
260 | signals: | 263 | signals: |
@@ -267,11 +270,11 @@ protected: | |||
267 | QString debug_info(struct symbol *sym); | 270 | QString debug_info(struct symbol *sym); |
268 | static QString print_filter(const QString &str); | 271 | static QString print_filter(const QString &str); |
269 | 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); |
270 | QPopupMenu* createPopupMenu(const QPoint& pos); | 273 | Q3PopupMenu* createPopupMenu(const QPoint& pos); |
271 | void contentsContextMenuEvent(QContextMenuEvent *e); | 274 | void contentsContextMenuEvent(QContextMenuEvent *e); |
272 | 275 | ||
273 | struct symbol *sym; | 276 | struct symbol *sym; |
274 | struct menu *menu; | 277 | struct menu *_menu; |
275 | bool _showDebug; | 278 | bool _showDebug; |
276 | }; | 279 | }; |
277 | 280 | ||
@@ -295,10 +298,10 @@ protected: | |||
295 | struct symbol **result; | 298 | struct symbol **result; |
296 | }; | 299 | }; |
297 | 300 | ||
298 | class ConfigMainWindow : public QMainWindow { | 301 | class ConfigMainWindow : public Q3MainWindow { |
299 | Q_OBJECT | 302 | Q_OBJECT |
300 | 303 | ||
301 | static QAction *saveAction; | 304 | static Q3Action *saveAction; |
302 | static void conf_changed(void); | 305 | static void conf_changed(void); |
303 | public: | 306 | public: |
304 | ConfigMainWindow(void); | 307 | ConfigMainWindow(void); |
@@ -327,8 +330,8 @@ protected: | |||
327 | ConfigView *configView; | 330 | ConfigView *configView; |
328 | ConfigList *configList; | 331 | ConfigList *configList; |
329 | ConfigInfoView *helpText; | 332 | ConfigInfoView *helpText; |
330 | QToolBar *toolBar; | 333 | Q3ToolBar *toolBar; |
331 | QAction *backAction; | 334 | Q3Action *backAction; |
332 | QSplitter* split1; | 335 | QSplitter* split1; |
333 | QSplitter* split2; | 336 | QSplitter* split2; |
334 | }; | 337 | }; |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 0d800820c3c..fd81fc33d63 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl | |||
@@ -42,6 +42,8 @@ | |||
42 | # mv config_strip .config | 42 | # mv config_strip .config |
43 | # make oldconfig | 43 | # make oldconfig |
44 | # | 44 | # |
45 | use strict; | ||
46 | |||
45 | my $config = ".config"; | 47 | my $config = ".config"; |
46 | 48 | ||
47 | my $uname = `uname -r`; | 49 | my $uname = `uname -r`; |
@@ -113,14 +115,18 @@ find_config; | |||
113 | # Get the build source and top level Kconfig file (passed in) | 115 | # Get the build source and top level Kconfig file (passed in) |
114 | my $ksource = $ARGV[0]; | 116 | my $ksource = $ARGV[0]; |
115 | my $kconfig = $ARGV[1]; | 117 | my $kconfig = $ARGV[1]; |
118 | my $lsmod_file = $ARGV[2]; | ||
119 | |||
120 | my @makefiles = `find $ksource -name Makefile 2>/dev/null`; | ||
121 | chomp @makefiles; | ||
116 | 122 | ||
117 | my @makefiles = `find $ksource -name Makefile`; | ||
118 | my %depends; | 123 | my %depends; |
119 | my %selects; | 124 | my %selects; |
120 | my %prompts; | 125 | my %prompts; |
121 | my %objects; | 126 | my %objects; |
122 | my $var; | 127 | my $var; |
123 | my $cont = 0; | 128 | my $iflevel = 0; |
129 | my @ifdeps; | ||
124 | 130 | ||
125 | # prevent recursion | 131 | # prevent recursion |
126 | my %read_kconfigs; | 132 | my %read_kconfigs; |
@@ -132,19 +138,54 @@ sub read_kconfig { | |||
132 | my $config; | 138 | my $config; |
133 | my @kconfigs; | 139 | my @kconfigs; |
134 | 140 | ||
135 | open(KIN, "$ksource/$kconfig") || die "Can't open $kconfig"; | 141 | my $cont = 0; |
142 | my $line; | ||
143 | |||
144 | my $source = "$ksource/$kconfig"; | ||
145 | my $last_source = ""; | ||
146 | |||
147 | # Check for any environment variables used | ||
148 | while ($source =~ /\$(\w+)/ && $last_source ne $source) { | ||
149 | my $env = $1; | ||
150 | $last_source = $source; | ||
151 | $source =~ s/\$$env/$ENV{$env}/; | ||
152 | } | ||
153 | |||
154 | open(KIN, "$source") || die "Can't open $kconfig"; | ||
136 | while (<KIN>) { | 155 | while (<KIN>) { |
137 | chomp; | 156 | chomp; |
138 | 157 | ||
158 | # Make sure that lines ending with \ continue | ||
159 | if ($cont) { | ||
160 | $_ = $line . " " . $_; | ||
161 | } | ||
162 | |||
163 | if (s/\\$//) { | ||
164 | $cont = 1; | ||
165 | $line = $_; | ||
166 | next; | ||
167 | } | ||
168 | |||
169 | $cont = 0; | ||
170 | |||
139 | # collect any Kconfig sources | 171 | # collect any Kconfig sources |
140 | if (/^source\s*"(.*)"/) { | 172 | if (/^source\s*"(.*)"/) { |
141 | $kconfigs[$#kconfigs+1] = $1; | 173 | $kconfigs[$#kconfigs+1] = $1; |
142 | } | 174 | } |
143 | 175 | ||
144 | # configs found | 176 | # configs found |
145 | if (/^\s*config\s+(\S+)\s*$/) { | 177 | if (/^\s*(menu)?config\s+(\S+)\s*$/) { |
146 | $state = "NEW"; | 178 | $state = "NEW"; |
147 | $config = $1; | 179 | $config = $2; |
180 | |||
181 | for (my $i = 0; $i < $iflevel; $i++) { | ||
182 | if ($i) { | ||
183 | $depends{$config} .= " " . $ifdeps[$i]; | ||
184 | } else { | ||
185 | $depends{$config} = $ifdeps[$i]; | ||
186 | } | ||
187 | $state = "DEP"; | ||
188 | } | ||
148 | 189 | ||
149 | # collect the depends for the config | 190 | # collect the depends for the config |
150 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { | 191 | } elsif ($state eq "NEW" && /^\s*depends\s+on\s+(.*)$/) { |
@@ -164,7 +205,22 @@ sub read_kconfig { | |||
164 | # configs without prompts must be selected | 205 | # configs without prompts must be selected |
165 | } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { | 206 | } elsif ($state ne "NONE" && /^\s*tristate\s\S/) { |
166 | # note if the config has a prompt | 207 | # note if the config has a prompt |
167 | $prompt{$config} = 1; | 208 | $prompts{$config} = 1; |
209 | |||
210 | # Check for if statements | ||
211 | } elsif (/^if\s+(.*\S)\s*$/) { | ||
212 | my $deps = $1; | ||
213 | # remove beginning and ending non text | ||
214 | $deps =~ s/^[^a-zA-Z0-9_]*//; | ||
215 | $deps =~ s/[^a-zA-Z0-9_]*$//; | ||
216 | |||
217 | my @deps = split /[^a-zA-Z0-9_]+/, $deps; | ||
218 | |||
219 | $ifdeps[$iflevel++] = join ':', @deps; | ||
220 | |||
221 | } elsif (/^endif/) { | ||
222 | |||
223 | $iflevel-- if ($iflevel); | ||
168 | 224 | ||
169 | # stop on "help" | 225 | # stop on "help" |
170 | } elsif (/^\s*help\s*$/) { | 226 | } elsif (/^\s*help\s*$/) { |
@@ -188,7 +244,8 @@ if ($kconfig) { | |||
188 | 244 | ||
189 | # Read all Makefiles to map the configs to the objects | 245 | # Read all Makefiles to map the configs to the objects |
190 | foreach my $makefile (@makefiles) { | 246 | foreach my $makefile (@makefiles) { |
191 | chomp $makefile; | 247 | |
248 | my $cont = 0; | ||
192 | 249 | ||
193 | open(MIN,$makefile) || die "Can't open $makefile"; | 250 | open(MIN,$makefile) || die "Can't open $makefile"; |
194 | while (<MIN>) { | 251 | while (<MIN>) { |
@@ -215,7 +272,7 @@ foreach my $makefile (@makefiles) { | |||
215 | foreach my $obj (split /\s+/,$objs) { | 272 | foreach my $obj (split /\s+/,$objs) { |
216 | $obj =~ s/-/_/g; | 273 | $obj =~ s/-/_/g; |
217 | if ($obj =~ /(.*)\.o$/) { | 274 | if ($obj =~ /(.*)\.o$/) { |
218 | # Objects may bes enabled by more than one config. | 275 | # Objects may be enabled by more than one config. |
219 | # Store configs in an array. | 276 | # Store configs in an array. |
220 | my @arr; | 277 | my @arr; |
221 | 278 | ||
@@ -237,8 +294,36 @@ foreach my $makefile (@makefiles) { | |||
237 | 294 | ||
238 | my %modules; | 295 | my %modules; |
239 | 296 | ||
240 | # see what modules are loaded on this system | 297 | if (defined($lsmod_file)) { |
241 | open(LIN,"/sbin/lsmod|") || die "Cant lsmod"; | 298 | if ( ! -f $lsmod_file) { |
299 | die "$lsmod_file not found"; | ||
300 | } | ||
301 | if ( -x $lsmod_file) { | ||
302 | # the file is executable, run it | ||
303 | open(LIN, "$lsmod_file|"); | ||
304 | } else { | ||
305 | # Just read the contents | ||
306 | open(LIN, "$lsmod_file"); | ||
307 | } | ||
308 | } else { | ||
309 | |||
310 | # see what modules are loaded on this system | ||
311 | my $lsmod; | ||
312 | |||
313 | foreach my $dir ( ("/sbin", "/bin", "/usr/sbin", "/usr/bin") ) { | ||
314 | if ( -x "$dir/lsmod" ) { | ||
315 | $lsmod = "$dir/lsmod"; | ||
316 | last; | ||
317 | } | ||
318 | } | ||
319 | if (!defined($lsmod)) { | ||
320 | # try just the path | ||
321 | $lsmod = "lsmod"; | ||
322 | } | ||
323 | |||
324 | open(LIN,"$lsmod|") || die "Can not call lsmod with $lsmod"; | ||
325 | } | ||
326 | |||
242 | while (<LIN>) { | 327 | while (<LIN>) { |
243 | next if (/^Module/); # Skip the first line. | 328 | next if (/^Module/); # Skip the first line. |
244 | if (/^(\S+)/) { | 329 | if (/^(\S+)/) { |
@@ -252,7 +337,7 @@ close (LIN); | |||
252 | my %configs; | 337 | my %configs; |
253 | foreach my $module (keys(%modules)) { | 338 | foreach my $module (keys(%modules)) { |
254 | if (defined($objects{$module})) { | 339 | if (defined($objects{$module})) { |
255 | @arr = @{$objects{$module}}; | 340 | my @arr = @{$objects{$module}}; |
256 | foreach my $conf (@arr) { | 341 | foreach my $conf (@arr) { |
257 | $configs{$conf} = $module; | 342 | $configs{$conf} = $module; |
258 | } | 343 | } |
@@ -307,7 +392,7 @@ while ($repeat) { | |||
307 | parse_config_dep_select $depends{$config}; | 392 | parse_config_dep_select $depends{$config}; |
308 | } | 393 | } |
309 | 394 | ||
310 | if (defined($prompt{$config}) || !defined($selects{$config})) { | 395 | if (defined($prompts{$config}) || !defined($selects{$config})) { |
311 | next; | 396 | next; |
312 | } | 397 | } |
313 | 398 | ||
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 2e7a048e0cf..a796c95fe8a 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -205,6 +205,16 @@ static void sym_calc_visibility(struct symbol *sym) | |||
205 | } | 205 | } |
206 | if (sym_is_choice_value(sym)) | 206 | if (sym_is_choice_value(sym)) |
207 | return; | 207 | return; |
208 | /* defaulting to "yes" if no explicit "depends on" are given */ | ||
209 | tri = yes; | ||
210 | if (sym->dir_dep.expr) | ||
211 | tri = expr_calc_value(sym->dir_dep.expr); | ||
212 | if (tri == mod) | ||
213 | tri = yes; | ||
214 | if (sym->dir_dep.tri != tri) { | ||
215 | sym->dir_dep.tri = tri; | ||
216 | sym_set_changed(sym); | ||
217 | } | ||
208 | tri = no; | 218 | tri = no; |
209 | if (sym->rev_dep.expr) | 219 | if (sym->rev_dep.expr) |
210 | tri = expr_calc_value(sym->rev_dep.expr); | 220 | tri = expr_calc_value(sym->rev_dep.expr); |
@@ -216,44 +226,63 @@ static void sym_calc_visibility(struct symbol *sym) | |||
216 | } | 226 | } |
217 | } | 227 | } |
218 | 228 | ||
219 | static struct symbol *sym_calc_choice(struct symbol *sym) | 229 | /* |
230 | * Find the default symbol for a choice. | ||
231 | * First try the default values for the choice symbol | ||
232 | * Next locate the first visible choice value | ||
233 | * Return NULL if none was found | ||
234 | */ | ||
235 | struct symbol *sym_choice_default(struct symbol *sym) | ||
220 | { | 236 | { |
221 | struct symbol *def_sym; | 237 | struct symbol *def_sym; |
222 | struct property *prop; | 238 | struct property *prop; |
223 | struct expr *e; | 239 | struct expr *e; |
224 | 240 | ||
225 | /* is the user choice visible? */ | ||
226 | def_sym = sym->def[S_DEF_USER].val; | ||
227 | if (def_sym) { | ||
228 | sym_calc_visibility(def_sym); | ||
229 | if (def_sym->visible != no) | ||
230 | return def_sym; | ||
231 | } | ||
232 | |||
233 | /* any of the defaults visible? */ | 241 | /* any of the defaults visible? */ |
234 | for_all_defaults(sym, prop) { | 242 | for_all_defaults(sym, prop) { |
235 | prop->visible.tri = expr_calc_value(prop->visible.expr); | 243 | prop->visible.tri = expr_calc_value(prop->visible.expr); |
236 | if (prop->visible.tri == no) | 244 | if (prop->visible.tri == no) |
237 | continue; | 245 | continue; |
238 | def_sym = prop_get_symbol(prop); | 246 | def_sym = prop_get_symbol(prop); |
239 | sym_calc_visibility(def_sym); | ||
240 | if (def_sym->visible != no) | 247 | if (def_sym->visible != no) |
241 | return def_sym; | 248 | return def_sym; |
242 | } | 249 | } |
243 | 250 | ||
244 | /* just get the first visible value */ | 251 | /* just get the first visible value */ |
245 | prop = sym_get_choice_prop(sym); | 252 | prop = sym_get_choice_prop(sym); |
246 | expr_list_for_each_sym(prop->expr, e, def_sym) { | 253 | expr_list_for_each_sym(prop->expr, e, def_sym) |
247 | sym_calc_visibility(def_sym); | ||
248 | if (def_sym->visible != no) | 254 | if (def_sym->visible != no) |
249 | return def_sym; | 255 | return def_sym; |
250 | } | ||
251 | 256 | ||
252 | /* no choice? reset tristate value */ | 257 | /* failed to locate any defaults */ |
253 | sym->curr.tri = no; | ||
254 | return NULL; | 258 | return NULL; |
255 | } | 259 | } |
256 | 260 | ||
261 | static struct symbol *sym_calc_choice(struct symbol *sym) | ||
262 | { | ||
263 | struct symbol *def_sym; | ||
264 | struct property *prop; | ||
265 | struct expr *e; | ||
266 | |||
267 | /* first calculate all choice values' visibilities */ | ||
268 | prop = sym_get_choice_prop(sym); | ||
269 | expr_list_for_each_sym(prop->expr, e, def_sym) | ||
270 | sym_calc_visibility(def_sym); | ||
271 | |||
272 | /* is the user choice visible? */ | ||
273 | def_sym = sym->def[S_DEF_USER].val; | ||
274 | if (def_sym && def_sym->visible != no) | ||
275 | return def_sym; | ||
276 | |||
277 | def_sym = sym_choice_default(sym); | ||
278 | |||
279 | if (def_sym == NULL) | ||
280 | /* no choice? reset tristate value */ | ||
281 | sym->curr.tri = no; | ||
282 | |||
283 | return def_sym; | ||
284 | } | ||
285 | |||
257 | void sym_calc_value(struct symbol *sym) | 286 | void sym_calc_value(struct symbol *sym) |
258 | { | 287 | { |
259 | struct symbol_value newval, oldval; | 288 | struct symbol_value newval, oldval; |
@@ -321,6 +350,18 @@ void sym_calc_value(struct symbol *sym) | |||
321 | } | 350 | } |
322 | } | 351 | } |
323 | calc_newval: | 352 | calc_newval: |
353 | if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) { | ||
354 | struct expr *e; | ||
355 | e = expr_simplify_unmet_dep(sym->rev_dep.expr, | ||
356 | sym->dir_dep.expr); | ||
357 | fprintf(stderr, "warning: ("); | ||
358 | expr_fprint(e, stderr); | ||
359 | fprintf(stderr, ") selects %s which has unmet direct dependencies (", | ||
360 | sym->name); | ||
361 | expr_fprint(sym->dir_dep.expr, stderr); | ||
362 | fprintf(stderr, ")\n"); | ||
363 | expr_free(e); | ||
364 | } | ||
324 | newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); | 365 | newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); |
325 | } | 366 | } |
326 | if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) | 367 | if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) |
@@ -365,12 +406,13 @@ void sym_calc_value(struct symbol *sym) | |||
365 | 406 | ||
366 | if (sym_is_choice(sym)) { | 407 | if (sym_is_choice(sym)) { |
367 | struct symbol *choice_sym; | 408 | struct symbol *choice_sym; |
368 | int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); | ||
369 | 409 | ||
370 | prop = sym_get_choice_prop(sym); | 410 | prop = sym_get_choice_prop(sym); |
371 | expr_list_for_each_sym(prop->expr, e, choice_sym) { | 411 | expr_list_for_each_sym(prop->expr, e, choice_sym) { |
372 | choice_sym->flags |= flags; | 412 | if ((sym->flags & SYMBOL_WRITE) && |
373 | if (flags & SYMBOL_CHANGED) | 413 | choice_sym->visible != no) |
414 | choice_sym->flags |= SYMBOL_WRITE; | ||
415 | if (sym->flags & SYMBOL_CHANGED) | ||
374 | sym_set_changed(choice_sym); | 416 | sym_set_changed(choice_sym); |
375 | } | 417 | } |
376 | } | 418 | } |
@@ -623,6 +665,80 @@ bool sym_set_string_value(struct symbol *sym, const char *newval) | |||
623 | return true; | 665 | return true; |
624 | } | 666 | } |
625 | 667 | ||
668 | /* | ||
669 | * Find the default value associated to a symbol. | ||
670 | * For tristate symbol handle the modules=n case | ||
671 | * in which case "m" becomes "y". | ||
672 | * If the symbol does not have any default then fallback | ||
673 | * to the fixed default values. | ||
674 | */ | ||
675 | const char *sym_get_string_default(struct symbol *sym) | ||
676 | { | ||
677 | struct property *prop; | ||
678 | struct symbol *ds; | ||
679 | const char *str; | ||
680 | tristate val; | ||
681 | |||
682 | sym_calc_visibility(sym); | ||
683 | sym_calc_value(modules_sym); | ||
684 | val = symbol_no.curr.tri; | ||
685 | str = symbol_empty.curr.val; | ||
686 | |||
687 | /* If symbol has a default value look it up */ | ||
688 | prop = sym_get_default_prop(sym); | ||
689 | if (prop != NULL) { | ||
690 | switch (sym->type) { | ||
691 | case S_BOOLEAN: | ||
692 | case S_TRISTATE: | ||
693 | /* The visibility may limit the value from yes => mod */ | ||
694 | val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri); | ||
695 | break; | ||
696 | default: | ||
697 | /* | ||
698 | * The following fails to handle the situation | ||
699 | * where a default value is further limited by | ||
700 | * the valid range. | ||
701 | */ | ||
702 | ds = prop_get_symbol(prop); | ||
703 | if (ds != NULL) { | ||
704 | sym_calc_value(ds); | ||
705 | str = (const char *)ds->curr.val; | ||
706 | } | ||
707 | } | ||
708 | } | ||
709 | |||
710 | /* Handle select statements */ | ||
711 | val = EXPR_OR(val, sym->rev_dep.tri); | ||
712 | |||
713 | /* transpose mod to yes if modules are not enabled */ | ||
714 | if (val == mod) | ||
715 | if (!sym_is_choice_value(sym) && modules_sym->curr.tri == no) | ||
716 | val = yes; | ||
717 | |||
718 | /* transpose mod to yes if type is bool */ | ||
719 | if (sym->type == S_BOOLEAN && val == mod) | ||
720 | val = yes; | ||
721 | |||
722 | switch (sym->type) { | ||
723 | case S_BOOLEAN: | ||
724 | case S_TRISTATE: | ||
725 | switch (val) { | ||
726 | case no: return "n"; | ||
727 | case mod: return "m"; | ||
728 | case yes: return "y"; | ||
729 | } | ||
730 | case S_INT: | ||
731 | case S_HEX: | ||
732 | return str; | ||
733 | case S_STRING: | ||
734 | return str; | ||
735 | case S_OTHER: | ||
736 | case S_UNKNOWN: | ||
737 | break; | ||
738 | } | ||
739 | return ""; | ||
740 | } | ||
741 | |||
626 | const char *sym_get_string_value(struct symbol *sym) | 742 | const char *sym_get_string_value(struct symbol *sym) |
627 | { | 743 | { |
628 | tristate val; | 744 | tristate val; |
@@ -728,6 +844,55 @@ struct symbol *sym_find(const char *name) | |||
728 | return symbol; | 844 | return symbol; |
729 | } | 845 | } |
730 | 846 | ||
847 | /* | ||
848 | * Expand symbol's names embedded in the string given in argument. Symbols' | ||
849 | * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to | ||
850 | * the empty string. | ||
851 | */ | ||
852 | const char *sym_expand_string_value(const char *in) | ||
853 | { | ||
854 | const char *src; | ||
855 | char *res; | ||
856 | size_t reslen; | ||
857 | |||
858 | reslen = strlen(in) + 1; | ||
859 | res = malloc(reslen); | ||
860 | res[0] = '\0'; | ||
861 | |||
862 | while ((src = strchr(in, '$'))) { | ||
863 | char *p, name[SYMBOL_MAXLENGTH]; | ||
864 | const char *symval = ""; | ||
865 | struct symbol *sym; | ||
866 | size_t newlen; | ||
867 | |||
868 | strncat(res, in, src - in); | ||
869 | src++; | ||
870 | |||
871 | p = name; | ||
872 | while (isalnum(*src) || *src == '_') | ||
873 | *p++ = *src++; | ||
874 | *p = '\0'; | ||
875 | |||
876 | sym = sym_find(name); | ||
877 | if (sym != NULL) { | ||
878 | sym_calc_value(sym); | ||
879 | symval = sym_get_string_value(sym); | ||
880 | } | ||
881 | |||
882 | newlen = strlen(res) + strlen(symval) + strlen(src) + 1; | ||
883 | if (newlen > reslen) { | ||
884 | reslen = newlen; | ||
885 | res = realloc(res, reslen); | ||
886 | } | ||
887 | |||
888 | strcat(res, symval); | ||
889 | in = src; | ||
890 | } | ||
891 | strcat(res, in); | ||
892 | |||
893 | return res; | ||
894 | } | ||
895 | |||
731 | struct symbol **sym_re_search(const char *pattern) | 896 | struct symbol **sym_re_search(const char *pattern) |
732 | { | 897 | { |
733 | struct symbol *sym, **sym_arr = NULL; | 898 | struct symbol *sym, **sym_arr = NULL; |
@@ -765,6 +930,112 @@ struct symbol **sym_re_search(const char *pattern) | |||
765 | return sym_arr; | 930 | return sym_arr; |
766 | } | 931 | } |
767 | 932 | ||
933 | /* | ||
934 | * When we check for recursive dependencies we use a stack to save | ||
935 | * current state so we can print out relevant info to user. | ||
936 | * The entries are located on the call stack so no need to free memory. | ||
937 | * Note inser() remove() must always match to properly clear the stack. | ||
938 | */ | ||
939 | static struct dep_stack { | ||
940 | struct dep_stack *prev, *next; | ||
941 | struct symbol *sym; | ||
942 | struct property *prop; | ||
943 | struct expr *expr; | ||
944 | } *check_top; | ||
945 | |||
946 | static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym) | ||
947 | { | ||
948 | memset(stack, 0, sizeof(*stack)); | ||
949 | if (check_top) | ||
950 | check_top->next = stack; | ||
951 | stack->prev = check_top; | ||
952 | stack->sym = sym; | ||
953 | check_top = stack; | ||
954 | } | ||
955 | |||
956 | static void dep_stack_remove(void) | ||
957 | { | ||
958 | check_top = check_top->prev; | ||
959 | if (check_top) | ||
960 | check_top->next = NULL; | ||
961 | } | ||
962 | |||
963 | /* | ||
964 | * Called when we have detected a recursive dependency. | ||
965 | * check_top point to the top of the stact so we use | ||
966 | * the ->prev pointer to locate the bottom of the stack. | ||
967 | */ | ||
968 | static void sym_check_print_recursive(struct symbol *last_sym) | ||
969 | { | ||
970 | struct dep_stack *stack; | ||
971 | struct symbol *sym, *next_sym; | ||
972 | struct menu *menu = NULL; | ||
973 | struct property *prop; | ||
974 | struct dep_stack cv_stack; | ||
975 | |||
976 | if (sym_is_choice_value(last_sym)) { | ||
977 | dep_stack_insert(&cv_stack, last_sym); | ||
978 | last_sym = prop_get_symbol(sym_get_choice_prop(last_sym)); | ||
979 | } | ||
980 | |||
981 | for (stack = check_top; stack != NULL; stack = stack->prev) | ||
982 | if (stack->sym == last_sym) | ||
983 | break; | ||
984 | if (!stack) { | ||
985 | fprintf(stderr, "unexpected recursive dependency error\n"); | ||
986 | return; | ||
987 | } | ||
988 | |||
989 | for (; stack; stack = stack->next) { | ||
990 | sym = stack->sym; | ||
991 | next_sym = stack->next ? stack->next->sym : last_sym; | ||
992 | prop = stack->prop; | ||
993 | if (prop == NULL) | ||
994 | prop = stack->sym->prop; | ||
995 | |||
996 | /* for choice values find the menu entry (used below) */ | ||
997 | if (sym_is_choice(sym) || sym_is_choice_value(sym)) { | ||
998 | for (prop = sym->prop; prop; prop = prop->next) { | ||
999 | menu = prop->menu; | ||
1000 | if (prop->menu) | ||
1001 | break; | ||
1002 | } | ||
1003 | } | ||
1004 | if (stack->sym == last_sym) | ||
1005 | fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", | ||
1006 | prop->file->name, prop->lineno); | ||
1007 | if (stack->expr) { | ||
1008 | fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", | ||
1009 | prop->file->name, prop->lineno, | ||
1010 | sym->name ? sym->name : "<choice>", | ||
1011 | prop_get_type_name(prop->type), | ||
1012 | next_sym->name ? next_sym->name : "<choice>"); | ||
1013 | } else if (stack->prop) { | ||
1014 | fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n", | ||
1015 | prop->file->name, prop->lineno, | ||
1016 | sym->name ? sym->name : "<choice>", | ||
1017 | next_sym->name ? next_sym->name : "<choice>"); | ||
1018 | } else if (sym_is_choice(sym)) { | ||
1019 | fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", | ||
1020 | menu->file->name, menu->lineno, | ||
1021 | sym->name ? sym->name : "<choice>", | ||
1022 | next_sym->name ? next_sym->name : "<choice>"); | ||
1023 | } else if (sym_is_choice_value(sym)) { | ||
1024 | fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", | ||
1025 | menu->file->name, menu->lineno, | ||
1026 | sym->name ? sym->name : "<choice>", | ||
1027 | next_sym->name ? next_sym->name : "<choice>"); | ||
1028 | } else { | ||
1029 | fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", | ||
1030 | prop->file->name, prop->lineno, | ||
1031 | sym->name ? sym->name : "<choice>", | ||
1032 | next_sym->name ? next_sym->name : "<choice>"); | ||
1033 | } | ||
1034 | } | ||
1035 | |||
1036 | if (check_top == &cv_stack) | ||
1037 | dep_stack_remove(); | ||
1038 | } | ||
768 | 1039 | ||
769 | static struct symbol *sym_check_expr_deps(struct expr *e) | 1040 | static struct symbol *sym_check_expr_deps(struct expr *e) |
770 | { | 1041 | { |
@@ -801,24 +1072,33 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym) | |||
801 | { | 1072 | { |
802 | struct symbol *sym2; | 1073 | struct symbol *sym2; |
803 | struct property *prop; | 1074 | struct property *prop; |
1075 | struct dep_stack stack; | ||
1076 | |||
1077 | dep_stack_insert(&stack, sym); | ||
804 | 1078 | ||
805 | sym2 = sym_check_expr_deps(sym->rev_dep.expr); | 1079 | sym2 = sym_check_expr_deps(sym->rev_dep.expr); |
806 | if (sym2) | 1080 | if (sym2) |
807 | return sym2; | 1081 | goto out; |
808 | 1082 | ||
809 | for (prop = sym->prop; prop; prop = prop->next) { | 1083 | for (prop = sym->prop; prop; prop = prop->next) { |
810 | if (prop->type == P_CHOICE || prop->type == P_SELECT) | 1084 | if (prop->type == P_CHOICE || prop->type == P_SELECT) |
811 | continue; | 1085 | continue; |
1086 | stack.prop = prop; | ||
812 | sym2 = sym_check_expr_deps(prop->visible.expr); | 1087 | sym2 = sym_check_expr_deps(prop->visible.expr); |
813 | if (sym2) | 1088 | if (sym2) |
814 | break; | 1089 | break; |
815 | if (prop->type != P_DEFAULT || sym_is_choice(sym)) | 1090 | if (prop->type != P_DEFAULT || sym_is_choice(sym)) |
816 | continue; | 1091 | continue; |
1092 | stack.expr = prop->expr; | ||
817 | sym2 = sym_check_expr_deps(prop->expr); | 1093 | sym2 = sym_check_expr_deps(prop->expr); |
818 | if (sym2) | 1094 | if (sym2) |
819 | break; | 1095 | break; |
1096 | stack.expr = NULL; | ||
820 | } | 1097 | } |
821 | 1098 | ||
1099 | out: | ||
1100 | dep_stack_remove(); | ||
1101 | |||
822 | return sym2; | 1102 | return sym2; |
823 | } | 1103 | } |
824 | 1104 | ||
@@ -827,6 +1107,9 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice) | |||
827 | struct symbol *sym, *sym2; | 1107 | struct symbol *sym, *sym2; |
828 | struct property *prop; | 1108 | struct property *prop; |
829 | struct expr *e; | 1109 | struct expr *e; |
1110 | struct dep_stack stack; | ||
1111 | |||
1112 | dep_stack_insert(&stack, choice); | ||
830 | 1113 | ||
831 | prop = sym_get_choice_prop(choice); | 1114 | prop = sym_get_choice_prop(choice); |
832 | expr_list_for_each_sym(prop->expr, e, sym) | 1115 | expr_list_for_each_sym(prop->expr, e, sym) |
@@ -840,10 +1123,8 @@ static struct symbol *sym_check_choice_deps(struct symbol *choice) | |||
840 | 1123 | ||
841 | expr_list_for_each_sym(prop->expr, e, sym) { | 1124 | expr_list_for_each_sym(prop->expr, e, sym) { |
842 | sym2 = sym_check_sym_deps(sym); | 1125 | sym2 = sym_check_sym_deps(sym); |
843 | if (sym2) { | 1126 | if (sym2) |
844 | fprintf(stderr, " -> %s", sym->name); | ||
845 | break; | 1127 | break; |
846 | } | ||
847 | } | 1128 | } |
848 | out: | 1129 | out: |
849 | expr_list_for_each_sym(prop->expr, e, sym) | 1130 | expr_list_for_each_sym(prop->expr, e, sym) |
@@ -853,6 +1134,8 @@ out: | |||
853 | prop_get_symbol(sym_get_choice_prop(sym2)) == choice) | 1134 | prop_get_symbol(sym_get_choice_prop(sym2)) == choice) |
854 | sym2 = choice; | 1135 | sym2 = choice; |
855 | 1136 | ||
1137 | dep_stack_remove(); | ||
1138 | |||
856 | return sym2; | 1139 | return sym2; |
857 | } | 1140 | } |
858 | 1141 | ||
@@ -862,18 +1145,20 @@ struct symbol *sym_check_deps(struct symbol *sym) | |||
862 | struct property *prop; | 1145 | struct property *prop; |
863 | 1146 | ||
864 | if (sym->flags & SYMBOL_CHECK) { | 1147 | if (sym->flags & SYMBOL_CHECK) { |
865 | fprintf(stderr, "%s:%d:error: found recursive dependency: %s", | 1148 | sym_check_print_recursive(sym); |
866 | sym->prop->file->name, sym->prop->lineno, | ||
867 | sym->name ? sym->name : "<choice>"); | ||
868 | return sym; | 1149 | return sym; |
869 | } | 1150 | } |
870 | if (sym->flags & SYMBOL_CHECKED) | 1151 | if (sym->flags & SYMBOL_CHECKED) |
871 | return NULL; | 1152 | return NULL; |
872 | 1153 | ||
873 | if (sym_is_choice_value(sym)) { | 1154 | if (sym_is_choice_value(sym)) { |
1155 | struct dep_stack stack; | ||
1156 | |||
874 | /* for choice groups start the check with main choice symbol */ | 1157 | /* for choice groups start the check with main choice symbol */ |
1158 | dep_stack_insert(&stack, sym); | ||
875 | prop = sym_get_choice_prop(sym); | 1159 | prop = sym_get_choice_prop(sym); |
876 | sym2 = sym_check_deps(prop_get_symbol(prop)); | 1160 | sym2 = sym_check_deps(prop_get_symbol(prop)); |
1161 | dep_stack_remove(); | ||
877 | } else if (sym_is_choice(sym)) { | 1162 | } else if (sym_is_choice(sym)) { |
878 | sym2 = sym_check_choice_deps(sym); | 1163 | sym2 = sym_check_choice_deps(sym); |
879 | } else { | 1164 | } else { |
@@ -882,14 +1167,8 @@ struct symbol *sym_check_deps(struct symbol *sym) | |||
882 | sym->flags &= ~SYMBOL_CHECK; | 1167 | sym->flags &= ~SYMBOL_CHECK; |
883 | } | 1168 | } |
884 | 1169 | ||
885 | if (sym2) { | 1170 | if (sym2 && sym2 == sym) |
886 | fprintf(stderr, " -> %s", sym->name ? sym->name : "<choice>"); | 1171 | sym2 = NULL; |
887 | if (sym2 == sym) { | ||
888 | fprintf(stderr, "\n"); | ||
889 | zconfnerrs++; | ||
890 | sym2 = NULL; | ||
891 | } | ||
892 | } | ||
893 | 1172 | ||
894 | return sym2; | 1173 | return sym2; |
895 | } | 1174 | } |
@@ -943,6 +1222,8 @@ const char *prop_get_type_name(enum prop_type type) | |||
943 | return "select"; | 1222 | return "select"; |
944 | case P_RANGE: | 1223 | case P_RANGE: |
945 | return "range"; | 1224 | return "range"; |
1225 | case P_SYMBOL: | ||
1226 | return "symbol"; | ||
946 | case P_UNKNOWN: | 1227 | case P_UNKNOWN: |
947 | break; | 1228 | break; |
948 | } | 1229 | } |
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 81c100d953e..6330cc871a4 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -12,15 +12,18 @@ | |||
12 | struct file *file_lookup(const char *name) | 12 | struct 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; |
@@ -72,7 +75,7 @@ int file_write_dep(const char *name) | |||
72 | } | 75 | } |
73 | 76 | ||
74 | 77 | ||
75 | /* Allocate initial growable sting */ | 78 | /* Allocate initial growable string */ |
76 | struct gstr str_new(void) | 79 | struct gstr str_new(void) |
77 | { | 80 | { |
78 | struct gstr gs; | 81 | struct gstr gs; |
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf index d8bc7424962..c9e690eb754 100644 --- a/scripts/kconfig/zconf.gperf +++ b/scripts/kconfig/zconf.gperf | |||
@@ -38,6 +38,7 @@ hex, T_TYPE, TF_COMMAND, S_HEX | |||
38 | string, T_TYPE, TF_COMMAND, S_STRING | 38 | string, T_TYPE, TF_COMMAND, S_STRING |
39 | select, T_SELECT, TF_COMMAND | 39 | select, T_SELECT, TF_COMMAND |
40 | range, T_RANGE, TF_COMMAND | 40 | range, T_RANGE, TF_COMMAND |
41 | visible, T_VISIBLE, TF_COMMAND | ||
41 | option, T_OPTION, TF_COMMAND | 42 | option, T_OPTION, TF_COMMAND |
42 | on, T_ON, TF_PARAM | 43 | on, T_ON, TF_PARAM |
43 | modules, T_OPT_MODULES, TF_OPTION | 44 | modules, T_OPT_MODULES, TF_OPTION |
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index c1748faf463..4055d5de175 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped | |||
@@ -32,7 +32,7 @@ | |||
32 | struct kconf_id; | 32 | struct kconf_id; |
33 | 33 | ||
34 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | 34 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); |
35 | /* maximum key range = 47, duplicates = 0 */ | 35 | /* maximum key range = 50, duplicates = 0 */ |
36 | 36 | ||
37 | #ifdef __GNUC__ | 37 | #ifdef __GNUC__ |
38 | __inline | 38 | __inline |
@@ -46,32 +46,32 @@ kconf_id_hash (register const char *str, register unsigned int len) | |||
46 | { | 46 | { |
47 | static unsigned char asso_values[] = | 47 | static unsigned char asso_values[] = |
48 | { | 48 | { |
49 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 49 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
50 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 50 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
51 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 51 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
52 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 52 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
53 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 53 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
54 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 54 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
55 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 55 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
56 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 56 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
57 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 57 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
58 | 49, 49, 49, 49, 49, 49, 49, 49, 11, 5, | 58 | 52, 52, 52, 52, 52, 52, 52, 52, 40, 5, |
59 | 0, 0, 5, 49, 5, 20, 49, 49, 5, 20, | 59 | 0, 0, 5, 52, 0, 20, 52, 52, 10, 20, |
60 | 5, 0, 30, 49, 0, 15, 0, 10, 0, 49, | 60 | 5, 0, 35, 52, 0, 30, 0, 15, 0, 52, |
61 | 25, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 61 | 15, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
62 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 62 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
63 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 63 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
64 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 64 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
65 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 65 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
66 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 66 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
67 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 67 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
68 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 68 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
69 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 69 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
70 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 70 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
71 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 71 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
72 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 72 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
73 | 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, | 73 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, |
74 | 49, 49, 49, 49, 49, 49 | 74 | 52, 52, 52, 52, 52, 52 |
75 | }; | 75 | }; |
76 | register int hval = len; | 76 | register int hval = len; |
77 | 77 | ||
@@ -102,25 +102,26 @@ struct kconf_id_strings_t | |||
102 | char kconf_id_strings_str12[sizeof("default")]; | 102 | char kconf_id_strings_str12[sizeof("default")]; |
103 | char kconf_id_strings_str13[sizeof("def_bool")]; | 103 | char kconf_id_strings_str13[sizeof("def_bool")]; |
104 | char kconf_id_strings_str14[sizeof("help")]; | 104 | char kconf_id_strings_str14[sizeof("help")]; |
105 | char kconf_id_strings_str15[sizeof("bool")]; | ||
106 | char kconf_id_strings_str16[sizeof("config")]; | 105 | char kconf_id_strings_str16[sizeof("config")]; |
107 | char kconf_id_strings_str17[sizeof("def_tristate")]; | 106 | char kconf_id_strings_str17[sizeof("def_tristate")]; |
108 | char kconf_id_strings_str18[sizeof("boolean")]; | 107 | char kconf_id_strings_str18[sizeof("hex")]; |
109 | char kconf_id_strings_str19[sizeof("defconfig_list")]; | 108 | char kconf_id_strings_str19[sizeof("defconfig_list")]; |
110 | char kconf_id_strings_str21[sizeof("string")]; | ||
111 | char kconf_id_strings_str22[sizeof("if")]; | 109 | char kconf_id_strings_str22[sizeof("if")]; |
112 | char kconf_id_strings_str23[sizeof("int")]; | 110 | char kconf_id_strings_str23[sizeof("int")]; |
113 | char kconf_id_strings_str26[sizeof("select")]; | ||
114 | char kconf_id_strings_str27[sizeof("modules")]; | 111 | char kconf_id_strings_str27[sizeof("modules")]; |
115 | char kconf_id_strings_str28[sizeof("tristate")]; | 112 | char kconf_id_strings_str28[sizeof("tristate")]; |
116 | char kconf_id_strings_str29[sizeof("menu")]; | 113 | char kconf_id_strings_str29[sizeof("menu")]; |
117 | char kconf_id_strings_str31[sizeof("source")]; | ||
118 | char kconf_id_strings_str32[sizeof("comment")]; | 114 | char kconf_id_strings_str32[sizeof("comment")]; |
119 | char kconf_id_strings_str33[sizeof("hex")]; | ||
120 | char kconf_id_strings_str35[sizeof("menuconfig")]; | 115 | char kconf_id_strings_str35[sizeof("menuconfig")]; |
121 | char kconf_id_strings_str36[sizeof("prompt")]; | 116 | char kconf_id_strings_str36[sizeof("string")]; |
122 | char kconf_id_strings_str37[sizeof("depends")]; | 117 | char kconf_id_strings_str37[sizeof("visible")]; |
118 | char kconf_id_strings_str41[sizeof("prompt")]; | ||
119 | char kconf_id_strings_str42[sizeof("depends")]; | ||
120 | char kconf_id_strings_str44[sizeof("bool")]; | ||
121 | char kconf_id_strings_str46[sizeof("select")]; | ||
122 | char kconf_id_strings_str47[sizeof("boolean")]; | ||
123 | char kconf_id_strings_str48[sizeof("mainmenu")]; | 123 | char kconf_id_strings_str48[sizeof("mainmenu")]; |
124 | char kconf_id_strings_str51[sizeof("source")]; | ||
124 | }; | 125 | }; |
125 | static struct kconf_id_strings_t kconf_id_strings_contents = | 126 | static struct kconf_id_strings_t kconf_id_strings_contents = |
126 | { | 127 | { |
@@ -136,25 +137,26 @@ static struct kconf_id_strings_t kconf_id_strings_contents = | |||
136 | "default", | 137 | "default", |
137 | "def_bool", | 138 | "def_bool", |
138 | "help", | 139 | "help", |
139 | "bool", | ||
140 | "config", | 140 | "config", |
141 | "def_tristate", | 141 | "def_tristate", |
142 | "boolean", | 142 | "hex", |
143 | "defconfig_list", | 143 | "defconfig_list", |
144 | "string", | ||
145 | "if", | 144 | "if", |
146 | "int", | 145 | "int", |
147 | "select", | ||
148 | "modules", | 146 | "modules", |
149 | "tristate", | 147 | "tristate", |
150 | "menu", | 148 | "menu", |
151 | "source", | ||
152 | "comment", | 149 | "comment", |
153 | "hex", | ||
154 | "menuconfig", | 150 | "menuconfig", |
151 | "string", | ||
152 | "visible", | ||
155 | "prompt", | 153 | "prompt", |
156 | "depends", | 154 | "depends", |
157 | "mainmenu" | 155 | "bool", |
156 | "select", | ||
157 | "boolean", | ||
158 | "mainmenu", | ||
159 | "source" | ||
158 | }; | 160 | }; |
159 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) | 161 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) |
160 | #ifdef __GNUC__ | 162 | #ifdef __GNUC__ |
@@ -168,11 +170,11 @@ kconf_id_lookup (register const char *str, register unsigned int len) | |||
168 | { | 170 | { |
169 | enum | 171 | enum |
170 | { | 172 | { |
171 | TOTAL_KEYWORDS = 31, | 173 | TOTAL_KEYWORDS = 32, |
172 | MIN_WORD_LENGTH = 2, | 174 | MIN_WORD_LENGTH = 2, |
173 | MAX_WORD_LENGTH = 14, | 175 | MAX_WORD_LENGTH = 14, |
174 | MIN_HASH_VALUE = 2, | 176 | MIN_HASH_VALUE = 2, |
175 | MAX_HASH_VALUE = 48 | 177 | MAX_HASH_VALUE = 51 |
176 | }; | 178 | }; |
177 | 179 | ||
178 | static struct kconf_id wordlist[] = | 180 | static struct kconf_id wordlist[] = |
@@ -191,31 +193,35 @@ kconf_id_lookup (register const char *str, register unsigned int len) | |||
191 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, | 193 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, |
192 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, | 194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, |
193 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND}, | 195 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND}, |
194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str15, T_TYPE, TF_COMMAND, S_BOOLEAN}, | 196 | {-1}, |
195 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND}, | 197 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND}, |
196 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE}, | 198 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE}, |
197 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_BOOLEAN}, | 199 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX}, |
198 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION}, | 200 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION}, |
199 | {-1}, | 201 | {-1}, {-1}, |
200 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING}, | ||
201 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM}, | 202 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM}, |
202 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT}, | 203 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT}, |
203 | {-1}, {-1}, | 204 | {-1}, {-1}, {-1}, |
204 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND}, | ||
205 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, | 205 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, |
206 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE}, | 206 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE}, |
207 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, | 207 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, |
208 | {-1}, | 208 | {-1}, {-1}, |
209 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SOURCE, TF_COMMAND}, | ||
210 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, | 209 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, |
211 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_HEX}, | 210 | {-1}, {-1}, |
212 | {-1}, | ||
213 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND}, | 211 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND}, |
214 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_PROMPT, TF_COMMAND}, | 212 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_TYPE, TF_COMMAND, S_STRING}, |
215 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_DEPENDS, TF_COMMAND}, | 213 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND}, |
216 | {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, | 214 | {-1}, {-1}, {-1}, |
215 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_PROMPT, TF_COMMAND}, | ||
216 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_DEPENDS, TF_COMMAND}, | ||
217 | {-1}, | 217 | {-1}, |
218 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND} | 218 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str44, T_TYPE, TF_COMMAND, S_BOOLEAN}, |
219 | {-1}, | ||
220 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND}, | ||
221 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN}, | ||
222 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}, | ||
223 | {-1}, {-1}, | ||
224 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_SOURCE, TF_COMMAND} | ||
219 | }; | 225 | }; |
220 | 226 | ||
221 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | 227 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index d8f7236cb0a..3dbaec185cc 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 | ||
356 | char *zconf_curname(void) | 357 | const 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 32a9eefd842..4c5495ea205 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
@@ -160,18 +160,19 @@ static struct menu *current_menu, *current_entry; | |||
160 | T_DEFAULT = 275, | 160 | T_DEFAULT = 275, |
161 | T_SELECT = 276, | 161 | T_SELECT = 276, |
162 | T_RANGE = 277, | 162 | T_RANGE = 277, |
163 | T_OPTION = 278, | 163 | T_VISIBLE = 278, |
164 | T_ON = 279, | 164 | T_OPTION = 279, |
165 | T_WORD = 280, | 165 | T_ON = 280, |
166 | T_WORD_QUOTE = 281, | 166 | T_WORD = 281, |
167 | T_UNEQUAL = 282, | 167 | T_WORD_QUOTE = 282, |
168 | T_CLOSE_PAREN = 283, | 168 | T_UNEQUAL = 283, |
169 | T_OPEN_PAREN = 284, | 169 | T_CLOSE_PAREN = 284, |
170 | T_EOL = 285, | 170 | T_OPEN_PAREN = 285, |
171 | T_OR = 286, | 171 | T_EOL = 286, |
172 | T_AND = 287, | 172 | T_OR = 287, |
173 | T_EQUAL = 288, | 173 | T_AND = 288, |
174 | T_NOT = 289 | 174 | T_EQUAL = 289, |
175 | T_NOT = 290 | ||
175 | }; | 176 | }; |
176 | #endif | 177 | #endif |
177 | 178 | ||
@@ -417,22 +418,22 @@ union yyalloc | |||
417 | #endif | 418 | #endif |
418 | 419 | ||
419 | /* YYFINAL -- State number of the termination state. */ | 420 | /* YYFINAL -- State number of the termination state. */ |
420 | #define YYFINAL 3 | 421 | #define YYFINAL 11 |
421 | /* YYLAST -- Last index in YYTABLE. */ | 422 | /* YYLAST -- Last index in YYTABLE. */ |
422 | #define YYLAST 259 | 423 | #define YYLAST 290 |
423 | 424 | ||
424 | /* YYNTOKENS -- Number of terminals. */ | 425 | /* YYNTOKENS -- Number of terminals. */ |
425 | #define YYNTOKENS 35 | 426 | #define YYNTOKENS 36 |
426 | /* YYNNTS -- Number of nonterminals. */ | 427 | /* YYNNTS -- Number of nonterminals. */ |
427 | #define YYNNTS 46 | 428 | #define YYNNTS 50 |
428 | /* YYNRULES -- Number of rules. */ | 429 | /* YYNRULES -- Number of rules. */ |
429 | #define YYNRULES 110 | 430 | #define YYNRULES 118 |
430 | /* YYNRULES -- Number of states. */ | 431 | /* YYNRULES -- Number of states. */ |
431 | #define YYNSTATES 180 | 432 | #define YYNSTATES 191 |
432 | 433 | ||
433 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | 434 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
434 | #define YYUNDEFTOK 2 | 435 | #define YYUNDEFTOK 2 |
435 | #define YYMAXUTOK 289 | 436 | #define YYMAXUTOK 290 |
436 | 437 | ||
437 | #define YYTRANSLATE(YYX) \ | 438 | #define YYTRANSLATE(YYX) \ |
438 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 439 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
@@ -468,7 +469,8 @@ static const yytype_uint8 yytranslate[] = | |||
468 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | 469 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
469 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | 470 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
470 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | 471 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
471 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 | 472 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
473 | 35 | ||
472 | }; | 474 | }; |
473 | 475 | ||
474 | #if YYDEBUG | 476 | #if YYDEBUG |
@@ -476,73 +478,75 @@ static const yytype_uint8 yytranslate[] = | |||
476 | YYRHS. */ | 478 | YYRHS. */ |
477 | static const yytype_uint16 yyprhs[] = | 479 | static const yytype_uint16 yyprhs[] = |
478 | { | 480 | { |
479 | 0, 0, 3, 5, 6, 9, 12, 15, 20, 23, | 481 | 0, 0, 3, 6, 8, 11, 13, 14, 17, 20, |
480 | 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, | 482 | 23, 26, 31, 36, 40, 42, 44, 46, 48, 50, |
481 | 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, | 483 | 52, 54, 56, 58, 60, 62, 64, 66, 68, 72, |
482 | 81, 84, 85, 88, 91, 94, 97, 100, 103, 107, | 484 | 75, 79, 82, 86, 89, 90, 93, 96, 99, 102, |
483 | 112, 117, 122, 128, 132, 133, 137, 138, 141, 145, | 485 | 105, 108, 112, 117, 122, 127, 133, 137, 138, 142, |
484 | 148, 150, 154, 155, 158, 161, 164, 167, 170, 175, | 486 | 143, 146, 150, 153, 155, 159, 160, 163, 166, 169, |
485 | 179, 182, 187, 188, 191, 195, 197, 201, 202, 205, | 487 | 172, 175, 180, 184, 187, 192, 193, 196, 200, 202, |
486 | 208, 211, 215, 218, 220, 224, 225, 228, 231, 234, | 488 | 206, 207, 210, 213, 216, 220, 224, 228, 230, 234, |
487 | 238, 242, 245, 248, 251, 252, 255, 258, 261, 266, | 489 | 235, 238, 241, 244, 248, 252, 255, 258, 261, 262, |
488 | 267, 270, 272, 274, 277, 280, 283, 285, 288, 289, | 490 | 265, 268, 271, 276, 277, 280, 283, 286, 287, 290, |
489 | 292, 294, 298, 302, 306, 309, 313, 317, 319, 321, | 491 | 292, 294, 297, 300, 303, 305, 308, 309, 312, 314, |
490 | 322 | 492 | 318, 322, 326, 329, 333, 337, 339, 341, 342 |
491 | }; | 493 | }; |
492 | 494 | ||
493 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | 495 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
494 | static const yytype_int8 yyrhs[] = | 496 | static const yytype_int8 yyrhs[] = |
495 | { | 497 | { |
496 | 36, 0, -1, 37, -1, -1, 37, 39, -1, 37, | 498 | 37, 0, -1, 81, 38, -1, 38, -1, 63, 39, |
497 | 53, -1, 37, 64, -1, 37, 3, 74, 76, -1, | 499 | -1, 39, -1, -1, 39, 41, -1, 39, 55, -1, |
498 | 37, 75, -1, 37, 25, 1, 30, -1, 37, 38, | 500 | 39, 67, -1, 39, 80, -1, 39, 26, 1, 31, |
499 | 1, 30, -1, 37, 1, 30, -1, 16, -1, 18, | 501 | -1, 39, 40, 1, 31, -1, 39, 1, 31, -1, |
500 | -1, 19, -1, 21, -1, 17, -1, 22, -1, 20, | 502 | 16, -1, 18, -1, 19, -1, 21, -1, 17, -1, |
501 | -1, 30, -1, 59, -1, 68, -1, 42, -1, 44, | 503 | 22, -1, 20, -1, 23, -1, 31, -1, 61, -1, |
502 | -1, 66, -1, 25, 1, 30, -1, 1, 30, -1, | 504 | 71, -1, 44, -1, 46, -1, 69, -1, 26, 1, |
503 | 10, 25, 30, -1, 41, 45, -1, 11, 25, 30, | 505 | 31, -1, 1, 31, -1, 10, 26, 31, -1, 43, |
504 | -1, 43, 45, -1, -1, 45, 46, -1, 45, 47, | 506 | 47, -1, 11, 26, 31, -1, 45, 47, -1, -1, |
505 | -1, 45, 72, -1, 45, 70, -1, 45, 40, -1, | 507 | 47, 48, -1, 47, 49, -1, 47, 75, -1, 47, |
506 | 45, 30, -1, 19, 73, 30, -1, 18, 74, 77, | 508 | 73, -1, 47, 42, -1, 47, 31, -1, 19, 78, |
507 | 30, -1, 20, 78, 77, 30, -1, 21, 25, 77, | 509 | 31, -1, 18, 79, 82, 31, -1, 20, 83, 82, |
508 | 30, -1, 22, 79, 79, 77, 30, -1, 23, 48, | 510 | 31, -1, 21, 26, 82, 31, -1, 22, 84, 84, |
509 | 30, -1, -1, 48, 25, 49, -1, -1, 33, 74, | 511 | 82, 31, -1, 24, 50, 31, -1, -1, 50, 26, |
510 | -1, 7, 80, 30, -1, 50, 54, -1, 75, -1, | 512 | 51, -1, -1, 34, 79, -1, 7, 85, 31, -1, |
511 | 51, 56, 52, -1, -1, 54, 55, -1, 54, 72, | 513 | 52, 56, -1, 80, -1, 53, 58, 54, -1, -1, |
512 | -1, 54, 70, -1, 54, 30, -1, 54, 40, -1, | 514 | 56, 57, -1, 56, 75, -1, 56, 73, -1, 56, |
513 | 18, 74, 77, 30, -1, 19, 73, 30, -1, 17, | 515 | 31, -1, 56, 42, -1, 18, 79, 82, 31, -1, |
514 | 30, -1, 20, 25, 77, 30, -1, -1, 56, 39, | 516 | 19, 78, 31, -1, 17, 31, -1, 20, 26, 82, |
515 | -1, 14, 78, 76, -1, 75, -1, 57, 60, 58, | 517 | 31, -1, -1, 58, 41, -1, 14, 83, 81, -1, |
516 | -1, -1, 60, 39, -1, 60, 64, -1, 60, 53, | 518 | 80, -1, 59, 62, 60, -1, -1, 62, 41, -1, |
517 | -1, 4, 74, 30, -1, 61, 71, -1, 75, -1, | 519 | 62, 67, -1, 62, 55, -1, 3, 79, 81, -1, |
518 | 62, 65, 63, -1, -1, 65, 39, -1, 65, 64, | 520 | 4, 79, 31, -1, 64, 76, 74, -1, 80, -1, |
519 | -1, 65, 53, -1, 6, 74, 30, -1, 9, 74, | 521 | 65, 68, 66, -1, -1, 68, 41, -1, 68, 67, |
520 | 30, -1, 67, 71, -1, 12, 30, -1, 69, 13, | 522 | -1, 68, 55, -1, 6, 79, 31, -1, 9, 79, |
521 | -1, -1, 71, 72, -1, 71, 30, -1, 71, 40, | 523 | 31, -1, 70, 74, -1, 12, 31, -1, 72, 13, |
522 | -1, 16, 24, 78, 30, -1, -1, 74, 77, -1, | 524 | -1, -1, 74, 75, -1, 74, 31, -1, 74, 42, |
523 | 25, -1, 26, -1, 5, 30, -1, 8, 30, -1, | 525 | -1, 16, 25, 83, 31, -1, -1, 76, 77, -1, |
524 | 15, 30, -1, 30, -1, 76, 30, -1, -1, 14, | 526 | 76, 31, -1, 23, 82, -1, -1, 79, 82, -1, |
525 | 78, -1, 79, -1, 79, 33, 79, -1, 79, 27, | 527 | 26, -1, 27, -1, 5, 31, -1, 8, 31, -1, |
526 | 79, -1, 29, 78, 28, -1, 34, 78, -1, 78, | 528 | 15, 31, -1, 31, -1, 81, 31, -1, -1, 14, |
527 | 31, 78, -1, 78, 32, 78, -1, 25, -1, 26, | 529 | 83, -1, 84, -1, 84, 34, 84, -1, 84, 28, |
528 | -1, -1, 25, -1 | 530 | 84, -1, 30, 83, 29, -1, 35, 83, -1, 83, |
531 | 32, 83, -1, 83, 33, 83, -1, 26, -1, 27, | ||
532 | -1, -1, 26, -1 | ||
529 | }; | 533 | }; |
530 | 534 | ||
531 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 535 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
532 | static const yytype_uint16 yyrline[] = | 536 | static const yytype_uint16 yyrline[] = |
533 | { | 537 | { |
534 | 0, 107, 107, 109, 111, 112, 113, 114, 115, 116, | 538 | 0, 108, 108, 108, 110, 110, 112, 114, 115, 116, |
535 | 117, 121, 125, 125, 125, 125, 125, 125, 125, 129, | 539 | 117, 118, 119, 123, 127, 127, 127, 127, 127, 127, |
536 | 130, 131, 132, 133, 134, 138, 139, 145, 153, 159, | 540 | 127, 127, 131, 132, 133, 134, 135, 136, 140, 141, |
537 | 167, 177, 179, 180, 181, 182, 183, 184, 187, 195, | 541 | 147, 155, 161, 169, 179, 181, 182, 183, 184, 185, |
538 | 201, 211, 217, 223, 226, 228, 239, 240, 245, 254, | 542 | 186, 189, 197, 203, 213, 219, 225, 228, 230, 241, |
539 | 259, 267, 270, 272, 273, 274, 275, 276, 279, 285, | 543 | 242, 247, 256, 261, 269, 272, 274, 275, 276, 277, |
540 | 296, 302, 312, 314, 319, 327, 335, 338, 340, 341, | 544 | 278, 281, 287, 298, 304, 314, 316, 321, 329, 337, |
541 | 342, 347, 354, 359, 367, 370, 372, 373, 374, 377, | 545 | 340, 342, 343, 344, 349, 356, 363, 368, 376, 379, |
542 | 385, 392, 399, 405, 412, 414, 415, 416, 419, 427, | 546 | 381, 382, 383, 386, 394, 401, 408, 414, 421, 423, |
543 | 429, 434, 435, 438, 439, 440, 444, 445, 448, 449, | 547 | 424, 425, 428, 436, 438, 439, 442, 449, 451, 456, |
544 | 452, 453, 454, 455, 456, 457, 458, 461, 462, 465, | 548 | 457, 460, 461, 462, 466, 467, 470, 471, 474, 475, |
545 | 466 | 549 | 476, 477, 478, 479, 480, 483, 484, 487, 488 |
546 | }; | 550 | }; |
547 | #endif | 551 | #endif |
548 | 552 | ||
@@ -555,19 +559,19 @@ static const char *const yytname[] = | |||
555 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", | 559 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", |
556 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", | 560 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", |
557 | "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", | 561 | "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE", |
558 | "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", | 562 | "T_VISIBLE", "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", | 563 | "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", | 564 | "T_NOT", "$accept", "input", "start", "stmt_list", "option_name", |
561 | "option_error", "config_entry_start", "config_stmt", | 565 | "common_stmt", "option_error", "config_entry_start", "config_stmt", |
562 | "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", | 566 | "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", |
563 | "config_option", "symbol_option", "symbol_option_list", | 567 | "config_option", "symbol_option", "symbol_option_list", |
564 | "symbol_option_arg", "choice", "choice_entry", "choice_end", | 568 | "symbol_option_arg", "choice", "choice_entry", "choice_end", |
565 | "choice_stmt", "choice_option_list", "choice_option", "choice_block", | 569 | "choice_stmt", "choice_option_list", "choice_option", "choice_block", |
566 | "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry", | 570 | "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu", |
567 | "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment", | 571 | "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt", |
568 | "comment_stmt", "help_start", "help", "depends_list", "depends", | 572 | "comment", "comment_stmt", "help_start", "help", "depends_list", |
569 | "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol", | 573 | "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt", |
570 | "word_opt", 0 | 574 | "end", "nl", "if_expr", "expr", "symbol", "word_opt", 0 |
571 | }; | 575 | }; |
572 | #endif | 576 | #endif |
573 | 577 | ||
@@ -579,42 +583,42 @@ static const yytype_uint16 yytoknum[] = | |||
579 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | 583 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
580 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | 584 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
581 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | 585 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
582 | 285, 286, 287, 288, 289 | 586 | 285, 286, 287, 288, 289, 290 |
583 | }; | 587 | }; |
584 | # endif | 588 | # endif |
585 | 589 | ||
586 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | 590 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
587 | static const yytype_uint8 yyr1[] = | 591 | static const yytype_uint8 yyr1[] = |
588 | { | 592 | { |
589 | 0, 35, 36, 37, 37, 37, 37, 37, 37, 37, | 593 | 0, 36, 37, 37, 38, 38, 39, 39, 39, 39, |
590 | 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, | 594 | 39, 39, 39, 39, 40, 40, 40, 40, 40, 40, |
591 | 39, 39, 39, 39, 39, 40, 40, 41, 42, 43, | 595 | 40, 40, 41, 41, 41, 41, 41, 41, 42, 42, |
592 | 44, 45, 45, 45, 45, 45, 45, 45, 46, 46, | 596 | 43, 44, 45, 46, 47, 47, 47, 47, 47, 47, |
593 | 46, 46, 46, 47, 48, 48, 49, 49, 50, 51, | 597 | 47, 48, 48, 48, 48, 48, 49, 50, 50, 51, |
594 | 52, 53, 54, 54, 54, 54, 54, 54, 55, 55, | 598 | 51, 52, 53, 54, 55, 56, 56, 56, 56, 56, |
595 | 55, 55, 56, 56, 57, 58, 59, 60, 60, 60, | 599 | 56, 57, 57, 57, 57, 58, 58, 59, 60, 61, |
596 | 60, 61, 62, 63, 64, 65, 65, 65, 65, 66, | 600 | 62, 62, 62, 62, 63, 64, 65, 66, 67, 68, |
597 | 67, 68, 69, 70, 71, 71, 71, 71, 72, 73, | 601 | 68, 68, 68, 69, 70, 71, 72, 73, 74, 74, |
598 | 73, 74, 74, 75, 75, 75, 76, 76, 77, 77, | 602 | 74, 74, 75, 76, 76, 76, 77, 78, 78, 79, |
599 | 78, 78, 78, 78, 78, 78, 78, 79, 79, 80, | 603 | 79, 80, 80, 80, 81, 81, 82, 82, 83, 83, |
600 | 80 | 604 | 83, 83, 83, 83, 83, 84, 84, 85, 85 |
601 | }; | 605 | }; |
602 | 606 | ||
603 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | 607 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
604 | static const yytype_uint8 yyr2[] = | 608 | static const yytype_uint8 yyr2[] = |
605 | { | 609 | { |
606 | 0, 2, 1, 0, 2, 2, 2, 4, 2, 4, | 610 | 0, 2, 2, 1, 2, 1, 0, 2, 2, 2, |
607 | 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, | 611 | 2, 4, 4, 3, 1, 1, 1, 1, 1, 1, |
608 | 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, | 612 | 1, 1, 1, 1, 1, 1, 1, 1, 3, 2, |
609 | 2, 0, 2, 2, 2, 2, 2, 2, 3, 4, | 613 | 3, 2, 3, 2, 0, 2, 2, 2, 2, 2, |
610 | 4, 4, 5, 3, 0, 3, 0, 2, 3, 2, | 614 | 2, 3, 4, 4, 4, 5, 3, 0, 3, 0, |
611 | 1, 3, 0, 2, 2, 2, 2, 2, 4, 3, | 615 | 2, 3, 2, 1, 3, 0, 2, 2, 2, 2, |
612 | 2, 4, 0, 2, 3, 1, 3, 0, 2, 2, | 616 | 2, 4, 3, 2, 4, 0, 2, 3, 1, 3, |
613 | 2, 3, 2, 1, 3, 0, 2, 2, 2, 3, | 617 | 0, 2, 2, 2, 3, 3, 3, 1, 3, 0, |
614 | 3, 2, 2, 2, 0, 2, 2, 2, 4, 0, | 618 | 2, 2, 2, 3, 3, 2, 2, 2, 0, 2, |
615 | 2, 1, 1, 2, 2, 2, 1, 2, 0, 2, | 619 | 2, 2, 4, 0, 2, 2, 2, 0, 2, 1, |
616 | 1, 3, 3, 3, 2, 3, 3, 1, 1, 0, | 620 | 1, 2, 2, 2, 1, 2, 0, 2, 1, 3, |
617 | 1 | 621 | 3, 3, 2, 3, 3, 1, 1, 0, 1 |
618 | }; | 622 | }; |
619 | 623 | ||
620 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | 624 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
@@ -622,158 +626,172 @@ static const yytype_uint8 yyr2[] = | |||
622 | means the default is an error. */ | 626 | means the default is an error. */ |
623 | static const yytype_uint8 yydefact[] = | 627 | static const yytype_uint8 yydefact[] = |
624 | { | 628 | { |
625 | 3, 0, 0, 1, 0, 0, 0, 0, 0, 109, | 629 | 6, 0, 104, 0, 3, 0, 6, 6, 99, 100, |
626 | 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, | 630 | 0, 1, 0, 0, 0, 0, 117, 0, 0, 0, |
627 | 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, | 631 | 0, 0, 0, 14, 18, 15, 16, 20, 17, 19, |
628 | 23, 52, 62, 5, 67, 20, 84, 75, 6, 24, | 632 | 21, 0, 22, 0, 7, 34, 25, 34, 26, 55, |
629 | 84, 21, 8, 11, 91, 92, 0, 0, 93, 0, | 633 | 65, 8, 70, 23, 93, 79, 9, 27, 88, 24, |
630 | 110, 0, 94, 0, 0, 0, 107, 108, 0, 0, | 634 | 10, 0, 105, 2, 74, 13, 0, 101, 0, 118, |
631 | 0, 100, 95, 0, 0, 0, 0, 0, 0, 0, | 635 | 0, 102, 0, 0, 0, 115, 116, 0, 0, 0, |
632 | 0, 0, 0, 96, 7, 71, 79, 48, 80, 27, | 636 | 108, 103, 0, 0, 0, 0, 0, 0, 0, 88, |
633 | 29, 0, 104, 0, 0, 64, 0, 0, 9, 10, | 637 | 0, 0, 75, 83, 51, 84, 30, 32, 0, 112, |
634 | 0, 0, 0, 0, 89, 0, 0, 0, 44, 0, | 638 | 0, 0, 67, 0, 0, 11, 12, 0, 0, 0, |
635 | 37, 36, 32, 33, 0, 35, 34, 0, 0, 89, | 639 | 0, 97, 0, 0, 0, 47, 0, 40, 39, 35, |
636 | 0, 56, 57, 53, 55, 54, 63, 51, 50, 68, | 640 | 36, 0, 38, 37, 0, 0, 97, 0, 59, 60, |
637 | 70, 66, 69, 65, 86, 87, 85, 76, 78, 74, | 641 | 56, 58, 57, 66, 54, 53, 71, 73, 69, 72, |
638 | 77, 73, 97, 103, 105, 106, 102, 101, 26, 82, | 642 | 68, 106, 95, 0, 94, 80, 82, 78, 81, 77, |
639 | 0, 98, 0, 98, 98, 98, 0, 0, 0, 83, | 643 | 90, 91, 89, 111, 113, 114, 110, 109, 29, 86, |
640 | 60, 98, 0, 98, 0, 0, 0, 38, 90, 0, | 644 | 0, 106, 0, 106, 106, 106, 0, 0, 0, 87, |
641 | 0, 98, 46, 43, 25, 0, 59, 0, 88, 99, | 645 | 63, 106, 0, 106, 0, 96, 0, 0, 41, 98, |
642 | 39, 40, 41, 0, 0, 45, 58, 61, 42, 47 | 646 | 0, 0, 106, 49, 46, 28, 0, 62, 0, 107, |
647 | 92, 42, 43, 44, 0, 0, 48, 61, 64, 45, | ||
648 | 50 | ||
643 | }; | 649 | }; |
644 | 650 | ||
645 | /* YYDEFGOTO[NTERM-NUM]. */ | 651 | /* YYDEFGOTO[NTERM-NUM]. */ |
646 | static const yytype_int16 yydefgoto[] = | 652 | static const yytype_int16 yydefgoto[] = |
647 | { | 653 | { |
648 | -1, 1, 2, 25, 26, 101, 27, 28, 29, 30, | 654 | -1, 3, 4, 5, 33, 34, 108, 35, 36, 37, |
649 | 65, 102, 103, 147, 175, 31, 32, 117, 33, 67, | 655 | 38, 74, 109, 110, 157, 186, 39, 40, 124, 41, |
650 | 113, 68, 34, 121, 35, 69, 36, 37, 129, 38, | 656 | 76, 120, 77, 42, 128, 43, 78, 6, 44, 45, |
651 | 71, 39, 40, 41, 104, 105, 70, 106, 142, 143, | 657 | 137, 46, 80, 47, 48, 49, 111, 112, 81, 113, |
652 | 42, 74, 156, 60, 61, 51 | 658 | 79, 134, 152, 153, 50, 7, 165, 69, 70, 60 |
653 | }; | 659 | }; |
654 | 660 | ||
655 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 661 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
656 | STATE-NUM. */ | 662 | STATE-NUM. */ |
657 | #define YYPACT_NINF -80 | 663 | #define YYPACT_NINF -90 |
658 | static const yytype_int16 yypact[] = | 664 | static const yytype_int16 yypact[] = |
659 | { | 665 | { |
660 | -80, 2, 132, -80, -13, -1, -1, -2, -1, 9, | 666 | 4, 42, -90, 96, -90, 111, -90, 15, -90, -90, |
661 | 33, -1, 27, 40, -3, 38, -80, -80, -80, -80, | 667 | 75, -90, 82, 42, 104, 42, 110, 107, 42, 115, |
662 | -80, -80, -80, 71, -80, 77, -80, -80, -80, -80, | 668 | 125, -4, 121, -90, -90, -90, -90, -90, -90, -90, |
663 | -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, | 669 | -90, 162, -90, 163, -90, -90, -90, -90, -90, -90, |
664 | -80, -80, -80, -80, -80, -80, 57, 61, -80, 63, | 670 | -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, |
665 | -80, 76, -80, 87, 101, 133, -80, -80, -3, -3, | 671 | -90, 139, -90, -90, 138, -90, 142, -90, 143, -90, |
666 | 195, -6, -80, 136, 149, 39, 104, 65, 150, 5, | 672 | 152, -90, 164, 167, 168, -90, -90, -4, -4, 77, |
667 | 194, 5, 167, -80, 176, -80, -80, -80, -80, -80, | 673 | -18, -90, 177, 185, 33, 71, 195, 247, 236, -2, |
668 | -80, 68, -80, -3, -3, 176, 72, 72, -80, -80, | 674 | 236, 171, -90, -90, -90, -90, -90, -90, 41, -90, |
669 | 177, 187, 78, -1, -1, -3, 196, 72, -80, 222, | 675 | -4, -4, 138, 97, 97, -90, -90, 186, 187, 194, |
670 | -80, -80, -80, -80, 221, -80, -80, 205, -1, -1, | 676 | 42, 42, -4, 196, 97, -90, 219, -90, -90, -90, |
671 | 211, -80, -80, -80, -80, -80, -80, -80, -80, -80, | 677 | -90, 210, -90, -90, 204, 42, 42, 199, -90, -90, |
672 | -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, | 678 | -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, |
673 | -80, -80, -80, -80, 206, -80, -80, -80, -80, -80, | 679 | -90, 222, -90, 223, -90, -90, -90, -90, -90, -90, |
674 | -3, 223, 209, 223, 197, 223, 72, 7, 210, -80, | 680 | -90, -90, -90, -90, 215, -90, -90, -90, -90, -90, |
675 | -80, 223, 212, 223, 201, -3, 213, -80, -80, 214, | 681 | -4, 222, 228, 222, -5, 222, 97, 35, 229, -90, |
676 | 215, 223, 208, -80, -80, 216, -80, 217, -80, 113, | 682 | -90, 222, 232, 222, -4, -90, 135, 233, -90, -90, |
677 | -80, -80, -80, 218, -1, -80, -80, -80, -80, -80 | 683 | 234, 235, 222, 240, -90, -90, 237, -90, 239, -13, |
684 | -90, -90, -90, -90, 244, 42, -90, -90, -90, -90, | ||
685 | -90 | ||
678 | }; | 686 | }; |
679 | 687 | ||
680 | /* YYPGOTO[NTERM-NUM]. */ | 688 | /* YYPGOTO[NTERM-NUM]. */ |
681 | static const yytype_int16 yypgoto[] = | 689 | static const yytype_int16 yypgoto[] = |
682 | { | 690 | { |
683 | -80, -80, -80, -80, 122, -34, -80, -80, -80, -80, | 691 | -90, -90, 269, 271, -90, 23, -70, -90, -90, -90, |
684 | 220, -80, -80, -80, -80, -80, -80, -80, 59, -80, | 692 | -90, 243, -90, -90, -90, -90, -90, -90, -90, -48, |
685 | -80, -80, -80, -80, -80, -80, -80, -80, -80, 125, | 693 | -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, |
686 | -80, -80, -80, -80, -80, 183, 219, 22, 142, -5, | 694 | -90, -20, -90, -90, -90, -90, -90, 206, 205, -68, |
687 | 147, 192, 69, -54, -79, -80 | 695 | -90, -90, 169, -1, 27, -7, 118, -66, -89, -90 |
688 | }; | 696 | }; |
689 | 697 | ||
690 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 698 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
691 | positive, shift that token. If negative, reduce the rule which | 699 | positive, shift that token. If negative, reduce the rule which |
692 | number is the opposite. If zero, do what YYDEFACT says. | 700 | number is the opposite. If zero, do what YYDEFACT says. |
693 | If YYTABLE_NINF, syntax error. */ | 701 | If YYTABLE_NINF, syntax error. */ |
694 | #define YYTABLE_NINF -82 | 702 | #define YYTABLE_NINF -86 |
695 | static const yytype_int16 yytable[] = | 703 | static const yytype_int16 yytable[] = |
696 | { | 704 | { |
697 | 46, 47, 3, 49, 81, 82, 53, 136, 137, 6, | 705 | 10, 88, 89, 54, 146, 147, 119, 1, 122, 164, |
698 | 7, 8, 9, 10, 11, 12, 13, 43, 146, 14, | 706 | 93, 141, 56, 142, 58, 156, 94, 62, 1, 90, |
699 | 15, 86, 56, 57, 44, 45, 58, 87, 48, 134, | 707 | 91, 131, 65, 66, 144, 145, 67, 90, 91, 132, |
700 | 135, 59, 162, 112, 50, 24, 125, 163, 125, -28, | 708 | 127, 68, 136, -31, 97, 2, 154, -31, -31, -31, |
701 | 90, 144, -28, -28, -28, -28, -28, -28, -28, -28, | 709 | -31, -31, -31, -31, -31, 98, 52, -31, -31, 99, |
702 | -28, 91, 54, -28, -28, 92, -28, 93, 94, 95, | 710 | -31, 100, 101, 102, 103, 104, -31, 105, 129, 106, |
703 | 96, 97, 98, 52, 99, 55, 90, 161, 62, 100, | 711 | 138, 173, 92, 141, 107, 142, 174, 172, 8, 9, |
704 | -49, -49, 63, -49, -49, -49, -49, 91, 64, -49, | 712 | 143, -33, 97, 90, 91, -33, -33, -33, -33, -33, |
705 | -49, 92, 107, 108, 109, 110, 154, 73, 141, 115, | 713 | -33, -33, -33, 98, 166, -33, -33, 99, -33, 100, |
706 | 99, 75, 126, 76, 126, 111, 133, 56, 57, 83, | 714 | 101, 102, 103, 104, -33, 105, 11, 106, 179, 151, |
707 | 84, 169, 140, 151, -30, 90, 77, -30, -30, -30, | 715 | 123, 126, 107, 135, 125, 130, 2, 139, 2, 90, |
708 | -30, -30, -30, -30, -30, -30, 91, 78, -30, -30, | 716 | 91, -5, 12, 55, 161, 13, 14, 15, 16, 17, |
709 | 92, -30, 93, 94, 95, 96, 97, 98, 120, 99, | 717 | 18, 19, 20, 65, 66, 21, 22, 23, 24, 25, |
710 | 128, 79, -2, 4, 100, 5, 6, 7, 8, 9, | 718 | 26, 27, 28, 29, 30, 57, 59, 31, 61, -4, |
711 | 10, 11, 12, 13, 83, 84, 14, 15, 16, 17, | 719 | 12, 63, 32, 13, 14, 15, 16, 17, 18, 19, |
712 | 18, 19, 20, 21, 22, 7, 8, 23, 10, 11, | 720 | 20, 64, 71, 21, 22, 23, 24, 25, 26, 27, |
713 | 12, 13, 24, 80, 14, 15, 88, -81, 90, 179, | 721 | 28, 29, 30, 72, 73, 31, 180, 90, 91, 52, |
714 | -81, -81, -81, -81, -81, -81, -81, -81, -81, 89, | 722 | 32, -85, 97, 82, 83, -85, -85, -85, -85, -85, |
715 | 24, -81, -81, 92, -81, -81, -81, -81, -81, -81, | 723 | -85, -85, -85, 84, 190, -85, -85, 99, -85, -85, |
716 | 116, 119, 99, 127, 122, 90, 130, 124, -72, -72, | 724 | -85, -85, -85, -85, -85, 85, 97, 106, 86, 87, |
717 | -72, -72, -72, -72, -72, -72, 132, 138, -72, -72, | 725 | -52, -52, 140, -52, -52, -52, -52, 98, 95, -52, |
718 | 92, 155, 158, 159, 160, 118, 123, 139, 131, 99, | 726 | -52, 99, 114, 115, 116, 117, 96, 148, 149, 150, |
719 | 165, 145, 167, 148, 124, 73, 83, 84, 83, 84, | 727 | 158, 106, 155, 159, 97, 163, 118, -76, -76, -76, |
720 | 173, 168, 83, 84, 149, 150, 153, 155, 84, 157, | 728 | -76, -76, -76, -76, -76, 160, 164, -76, -76, 99, |
721 | 164, 174, 166, 170, 171, 172, 176, 177, 178, 66, | 729 | 13, 14, 15, 16, 17, 18, 19, 20, 91, 106, |
722 | 114, 152, 85, 0, 0, 0, 0, 0, 0, 72 | 730 | 21, 22, 14, 15, 140, 17, 18, 19, 20, 168, |
731 | 175, 21, 22, 177, 181, 182, 183, 32, 187, 167, | ||
732 | 188, 169, 170, 171, 185, 189, 53, 51, 32, 176, | ||
733 | 75, 178, 121, 0, 133, 162, 0, 0, 0, 0, | ||
734 | 184 | ||
723 | }; | 735 | }; |
724 | 736 | ||
725 | static const yytype_int16 yycheck[] = | 737 | static const yytype_int16 yycheck[] = |
726 | { | 738 | { |
727 | 5, 6, 0, 8, 58, 59, 11, 86, 87, 4, | 739 | 1, 67, 68, 10, 93, 94, 76, 3, 76, 14, |
728 | 5, 6, 7, 8, 9, 10, 11, 30, 97, 14, | 740 | 28, 81, 13, 81, 15, 104, 34, 18, 3, 32, |
729 | 15, 27, 25, 26, 25, 26, 29, 33, 30, 83, | 741 | 33, 23, 26, 27, 90, 91, 30, 32, 33, 31, |
730 | 84, 34, 25, 67, 25, 30, 70, 30, 72, 0, | 742 | 78, 35, 80, 0, 1, 31, 102, 4, 5, 6, |
731 | 1, 95, 3, 4, 5, 6, 7, 8, 9, 10, | 743 | 7, 8, 9, 10, 11, 12, 31, 14, 15, 16, |
732 | 11, 12, 25, 14, 15, 16, 17, 18, 19, 20, | 744 | 17, 18, 19, 20, 21, 22, 23, 24, 78, 26, |
733 | 21, 22, 23, 30, 25, 25, 1, 146, 30, 30, | 745 | 80, 26, 69, 133, 31, 133, 31, 156, 26, 27, |
734 | 5, 6, 1, 8, 9, 10, 11, 12, 1, 14, | 746 | 29, 0, 1, 32, 33, 4, 5, 6, 7, 8, |
735 | 15, 16, 17, 18, 19, 20, 140, 30, 93, 67, | 747 | 9, 10, 11, 12, 150, 14, 15, 16, 17, 18, |
736 | 25, 30, 70, 30, 72, 30, 28, 25, 26, 31, | 748 | 19, 20, 21, 22, 23, 24, 0, 26, 164, 100, |
737 | 32, 155, 24, 108, 0, 1, 30, 3, 4, 5, | 749 | 77, 78, 31, 80, 77, 78, 31, 80, 31, 32, |
738 | 6, 7, 8, 9, 10, 11, 12, 30, 14, 15, | 750 | 33, 0, 1, 31, 115, 4, 5, 6, 7, 8, |
739 | 16, 17, 18, 19, 20, 21, 22, 23, 69, 25, | 751 | 9, 10, 11, 26, 27, 14, 15, 16, 17, 18, |
740 | 71, 30, 0, 1, 30, 3, 4, 5, 6, 7, | 752 | 19, 20, 21, 22, 23, 31, 26, 26, 31, 0, |
741 | 8, 9, 10, 11, 31, 32, 14, 15, 16, 17, | 753 | 1, 26, 31, 4, 5, 6, 7, 8, 9, 10, |
742 | 18, 19, 20, 21, 22, 5, 6, 25, 8, 9, | 754 | 11, 26, 31, 14, 15, 16, 17, 18, 19, 20, |
743 | 10, 11, 30, 30, 14, 15, 30, 0, 1, 174, | 755 | 21, 22, 23, 1, 1, 26, 31, 32, 33, 31, |
744 | 3, 4, 5, 6, 7, 8, 9, 10, 11, 30, | 756 | 31, 0, 1, 31, 31, 4, 5, 6, 7, 8, |
745 | 30, 14, 15, 16, 17, 18, 19, 20, 21, 22, | 757 | 9, 10, 11, 31, 185, 14, 15, 16, 17, 18, |
746 | 68, 69, 25, 71, 69, 1, 71, 30, 4, 5, | 758 | 19, 20, 21, 22, 23, 31, 1, 26, 31, 31, |
747 | 6, 7, 8, 9, 10, 11, 30, 30, 14, 15, | 759 | 5, 6, 31, 8, 9, 10, 11, 12, 31, 14, |
748 | 16, 14, 143, 144, 145, 68, 69, 30, 71, 25, | 760 | 15, 16, 17, 18, 19, 20, 31, 31, 31, 25, |
749 | 151, 25, 153, 1, 30, 30, 31, 32, 31, 32, | 761 | 1, 26, 26, 13, 1, 26, 31, 4, 5, 6, |
750 | 161, 30, 31, 32, 13, 30, 25, 14, 32, 30, | 762 | 7, 8, 9, 10, 11, 31, 14, 14, 15, 16, |
751 | 30, 33, 30, 30, 30, 30, 30, 30, 30, 29, | 763 | 4, 5, 6, 7, 8, 9, 10, 11, 33, 26, |
752 | 67, 109, 60, -1, -1, -1, -1, -1, -1, 40 | 764 | 14, 15, 5, 6, 31, 8, 9, 10, 11, 31, |
765 | 31, 14, 15, 31, 31, 31, 31, 31, 31, 151, | ||
766 | 31, 153, 154, 155, 34, 31, 7, 6, 31, 161, | ||
767 | 37, 163, 76, -1, 79, 116, -1, -1, -1, -1, | ||
768 | 172 | ||
753 | }; | 769 | }; |
754 | 770 | ||
755 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | 771 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
756 | symbol of state STATE-NUM. */ | 772 | symbol of state STATE-NUM. */ |
757 | static const yytype_uint8 yystos[] = | 773 | static const yytype_uint8 yystos[] = |
758 | { | 774 | { |
759 | 0, 36, 37, 0, 1, 3, 4, 5, 6, 7, | 775 | 0, 3, 31, 37, 38, 39, 63, 81, 26, 27, |
760 | 8, 9, 10, 11, 14, 15, 16, 17, 18, 19, | 776 | 79, 0, 1, 4, 5, 6, 7, 8, 9, 10, |
761 | 20, 21, 22, 25, 30, 38, 39, 41, 42, 43, | 777 | 11, 14, 15, 16, 17, 18, 19, 20, 21, 22, |
762 | 44, 50, 51, 53, 57, 59, 61, 62, 64, 66, | 778 | 23, 26, 31, 40, 41, 43, 44, 45, 46, 52, |
763 | 67, 68, 75, 30, 25, 26, 74, 74, 30, 74, | 779 | 53, 55, 59, 61, 64, 65, 67, 69, 70, 71, |
764 | 25, 80, 30, 74, 25, 25, 25, 26, 29, 34, | 780 | 80, 39, 31, 38, 81, 31, 79, 31, 79, 26, |
765 | 78, 79, 30, 1, 1, 45, 45, 54, 56, 60, | 781 | 85, 31, 79, 26, 26, 26, 27, 30, 35, 83, |
766 | 71, 65, 71, 30, 76, 30, 30, 30, 30, 30, | 782 | 84, 31, 1, 1, 47, 47, 56, 58, 62, 76, |
767 | 30, 78, 78, 31, 32, 76, 27, 33, 30, 30, | 783 | 68, 74, 31, 31, 31, 31, 31, 31, 83, 83, |
768 | 1, 12, 16, 18, 19, 20, 21, 22, 23, 25, | 784 | 32, 33, 81, 28, 34, 31, 31, 1, 12, 16, |
769 | 30, 40, 46, 47, 69, 70, 72, 17, 18, 19, | 785 | 18, 19, 20, 21, 22, 24, 26, 31, 42, 48, |
770 | 20, 30, 40, 55, 70, 72, 39, 52, 75, 39, | 786 | 49, 72, 73, 75, 17, 18, 19, 20, 31, 42, |
771 | 53, 58, 64, 75, 30, 40, 72, 39, 53, 63, | 787 | 57, 73, 75, 41, 54, 80, 41, 55, 60, 67, |
772 | 64, 75, 30, 28, 78, 78, 79, 79, 30, 30, | 788 | 80, 23, 31, 74, 77, 41, 55, 66, 67, 80, |
773 | 24, 74, 73, 74, 78, 25, 79, 48, 1, 13, | 789 | 31, 42, 75, 29, 83, 83, 84, 84, 31, 31, |
774 | 30, 74, 73, 25, 78, 14, 77, 30, 77, 77, | 790 | 25, 79, 78, 79, 83, 26, 84, 50, 1, 13, |
775 | 77, 79, 25, 30, 30, 77, 30, 77, 30, 78, | 791 | 31, 79, 78, 26, 14, 82, 83, 82, 31, 82, |
776 | 30, 30, 30, 77, 33, 49, 30, 30, 30, 74 | 792 | 82, 82, 84, 26, 31, 31, 82, 31, 82, 83, |
793 | 31, 31, 31, 31, 82, 34, 51, 31, 31, 31, | ||
794 | 79 | ||
777 | }; | 795 | }; |
778 | 796 | ||
779 | #define yyerrok (yyerrstatus = 0) | 797 | #define yyerrok (yyerrstatus = 0) |
@@ -1284,7 +1302,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1284 | 1302 | ||
1285 | switch (yytype) | 1303 | switch (yytype) |
1286 | { | 1304 | { |
1287 | case 51: /* "choice_entry" */ | 1305 | case 53: /* "choice_entry" */ |
1288 | 1306 | ||
1289 | { | 1307 | { |
1290 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1308 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1294,7 +1312,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1294 | }; | 1312 | }; |
1295 | 1313 | ||
1296 | break; | 1314 | break; |
1297 | case 57: /* "if_entry" */ | 1315 | case 59: /* "if_entry" */ |
1298 | 1316 | ||
1299 | { | 1317 | { |
1300 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1318 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1304,7 +1322,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1304 | }; | 1322 | }; |
1305 | 1323 | ||
1306 | break; | 1324 | break; |
1307 | case 62: /* "menu_entry" */ | 1325 | case 65: /* "menu_entry" */ |
1308 | 1326 | ||
1309 | { | 1327 | { |
1310 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1328 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1614,39 +1632,39 @@ yyreduce: | |||
1614 | YY_REDUCE_PRINT (yyn); | 1632 | YY_REDUCE_PRINT (yyn); |
1615 | switch (yyn) | 1633 | switch (yyn) |
1616 | { | 1634 | { |
1617 | case 8: | 1635 | case 10: |
1618 | 1636 | ||
1619 | { zconf_error("unexpected end statement"); ;} | 1637 | { zconf_error("unexpected end statement"); ;} |
1620 | break; | 1638 | break; |
1621 | 1639 | ||
1622 | case 9: | 1640 | case 11: |
1623 | 1641 | ||
1624 | { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;} | 1642 | { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;} |
1625 | break; | 1643 | break; |
1626 | 1644 | ||
1627 | case 10: | 1645 | case 12: |
1628 | 1646 | ||
1629 | { | 1647 | { |
1630 | zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name); | 1648 | zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name); |
1631 | ;} | 1649 | ;} |
1632 | break; | 1650 | break; |
1633 | 1651 | ||
1634 | case 11: | 1652 | case 13: |
1635 | 1653 | ||
1636 | { zconf_error("invalid statement"); ;} | 1654 | { zconf_error("invalid statement"); ;} |
1637 | break; | 1655 | break; |
1638 | 1656 | ||
1639 | case 25: | 1657 | case 28: |
1640 | 1658 | ||
1641 | { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;} | 1659 | { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;} |
1642 | break; | 1660 | break; |
1643 | 1661 | ||
1644 | case 26: | 1662 | case 29: |
1645 | 1663 | ||
1646 | { zconf_error("invalid option"); ;} | 1664 | { zconf_error("invalid option"); ;} |
1647 | break; | 1665 | break; |
1648 | 1666 | ||
1649 | case 27: | 1667 | case 30: |
1650 | 1668 | ||
1651 | { | 1669 | { |
1652 | struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); | 1670 | struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); |
@@ -1656,7 +1674,7 @@ yyreduce: | |||
1656 | ;} | 1674 | ;} |
1657 | break; | 1675 | break; |
1658 | 1676 | ||
1659 | case 28: | 1677 | case 31: |
1660 | 1678 | ||
1661 | { | 1679 | { |
1662 | menu_end_entry(); | 1680 | menu_end_entry(); |
@@ -1664,7 +1682,7 @@ yyreduce: | |||
1664 | ;} | 1682 | ;} |
1665 | break; | 1683 | break; |
1666 | 1684 | ||
1667 | case 29: | 1685 | case 32: |
1668 | 1686 | ||
1669 | { | 1687 | { |
1670 | struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); | 1688 | struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0); |
@@ -1674,7 +1692,7 @@ yyreduce: | |||
1674 | ;} | 1692 | ;} |
1675 | break; | 1693 | break; |
1676 | 1694 | ||
1677 | case 30: | 1695 | case 33: |
1678 | 1696 | ||
1679 | { | 1697 | { |
1680 | if (current_entry->prompt) | 1698 | if (current_entry->prompt) |
@@ -1686,7 +1704,7 @@ yyreduce: | |||
1686 | ;} | 1704 | ;} |
1687 | break; | 1705 | break; |
1688 | 1706 | ||
1689 | case 38: | 1707 | case 41: |
1690 | 1708 | ||
1691 | { | 1709 | { |
1692 | menu_set_type((yyvsp[(1) - (3)].id)->stype); | 1710 | menu_set_type((yyvsp[(1) - (3)].id)->stype); |
@@ -1696,7 +1714,7 @@ yyreduce: | |||
1696 | ;} | 1714 | ;} |
1697 | break; | 1715 | break; |
1698 | 1716 | ||
1699 | case 39: | 1717 | case 42: |
1700 | 1718 | ||
1701 | { | 1719 | { |
1702 | menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); | 1720 | menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); |
@@ -1704,7 +1722,7 @@ yyreduce: | |||
1704 | ;} | 1722 | ;} |
1705 | break; | 1723 | break; |
1706 | 1724 | ||
1707 | case 40: | 1725 | case 43: |
1708 | 1726 | ||
1709 | { | 1727 | { |
1710 | menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)); | 1728 | menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)); |
@@ -1716,7 +1734,7 @@ yyreduce: | |||
1716 | ;} | 1734 | ;} |
1717 | break; | 1735 | break; |
1718 | 1736 | ||
1719 | case 41: | 1737 | case 44: |
1720 | 1738 | ||
1721 | { | 1739 | { |
1722 | menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); | 1740 | menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr)); |
@@ -1724,7 +1742,7 @@ yyreduce: | |||
1724 | ;} | 1742 | ;} |
1725 | break; | 1743 | break; |
1726 | 1744 | ||
1727 | case 42: | 1745 | case 45: |
1728 | 1746 | ||
1729 | { | 1747 | { |
1730 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr)); | 1748 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr)); |
@@ -1732,7 +1750,7 @@ yyreduce: | |||
1732 | ;} | 1750 | ;} |
1733 | break; | 1751 | break; |
1734 | 1752 | ||
1735 | case 45: | 1753 | case 48: |
1736 | 1754 | ||
1737 | { | 1755 | { |
1738 | struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); | 1756 | struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); |
@@ -1744,17 +1762,17 @@ yyreduce: | |||
1744 | ;} | 1762 | ;} |
1745 | break; | 1763 | break; |
1746 | 1764 | ||
1747 | case 46: | 1765 | case 49: |
1748 | 1766 | ||
1749 | { (yyval.string) = NULL; ;} | 1767 | { (yyval.string) = NULL; ;} |
1750 | break; | 1768 | break; |
1751 | 1769 | ||
1752 | case 47: | 1770 | case 50: |
1753 | 1771 | ||
1754 | { (yyval.string) = (yyvsp[(2) - (2)].string); ;} | 1772 | { (yyval.string) = (yyvsp[(2) - (2)].string); ;} |
1755 | break; | 1773 | break; |
1756 | 1774 | ||
1757 | case 48: | 1775 | case 51: |
1758 | 1776 | ||
1759 | { | 1777 | { |
1760 | struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE); | 1778 | struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE); |
@@ -1765,14 +1783,14 @@ yyreduce: | |||
1765 | ;} | 1783 | ;} |
1766 | break; | 1784 | break; |
1767 | 1785 | ||
1768 | case 49: | 1786 | case 52: |
1769 | 1787 | ||
1770 | { | 1788 | { |
1771 | (yyval.menu) = menu_add_menu(); | 1789 | (yyval.menu) = menu_add_menu(); |
1772 | ;} | 1790 | ;} |
1773 | break; | 1791 | break; |
1774 | 1792 | ||
1775 | case 50: | 1793 | case 53: |
1776 | 1794 | ||
1777 | { | 1795 | { |
1778 | if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) { | 1796 | if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) { |
@@ -1782,7 +1800,7 @@ yyreduce: | |||
1782 | ;} | 1800 | ;} |
1783 | break; | 1801 | break; |
1784 | 1802 | ||
1785 | case 58: | 1803 | case 61: |
1786 | 1804 | ||
1787 | { | 1805 | { |
1788 | menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); | 1806 | menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr)); |
@@ -1790,7 +1808,7 @@ yyreduce: | |||
1790 | ;} | 1808 | ;} |
1791 | break; | 1809 | break; |
1792 | 1810 | ||
1793 | case 59: | 1811 | case 62: |
1794 | 1812 | ||
1795 | { | 1813 | { |
1796 | if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) { | 1814 | if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) { |
@@ -1803,7 +1821,7 @@ yyreduce: | |||
1803 | ;} | 1821 | ;} |
1804 | break; | 1822 | break; |
1805 | 1823 | ||
1806 | case 60: | 1824 | case 63: |
1807 | 1825 | ||
1808 | { | 1826 | { |
1809 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | 1827 | current_entry->sym->flags |= SYMBOL_OPTIONAL; |
@@ -1811,7 +1829,7 @@ yyreduce: | |||
1811 | ;} | 1829 | ;} |
1812 | break; | 1830 | break; |
1813 | 1831 | ||
1814 | case 61: | 1832 | case 64: |
1815 | 1833 | ||
1816 | { | 1834 | { |
1817 | if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) { | 1835 | if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) { |
@@ -1823,7 +1841,7 @@ yyreduce: | |||
1823 | ;} | 1841 | ;} |
1824 | break; | 1842 | break; |
1825 | 1843 | ||
1826 | case 64: | 1844 | case 67: |
1827 | 1845 | ||
1828 | { | 1846 | { |
1829 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | 1847 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); |
@@ -1833,7 +1851,7 @@ yyreduce: | |||
1833 | ;} | 1851 | ;} |
1834 | break; | 1852 | break; |
1835 | 1853 | ||
1836 | case 65: | 1854 | case 68: |
1837 | 1855 | ||
1838 | { | 1856 | { |
1839 | if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) { | 1857 | if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) { |
@@ -1843,7 +1861,14 @@ yyreduce: | |||
1843 | ;} | 1861 | ;} |
1844 | break; | 1862 | break; |
1845 | 1863 | ||
1846 | case 71: | 1864 | case 74: |
1865 | |||
1866 | { | ||
1867 | menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL); | ||
1868 | ;} | ||
1869 | break; | ||
1870 | |||
1871 | case 75: | ||
1847 | 1872 | ||
1848 | { | 1873 | { |
1849 | menu_add_entry(NULL); | 1874 | menu_add_entry(NULL); |
@@ -1852,14 +1877,14 @@ yyreduce: | |||
1852 | ;} | 1877 | ;} |
1853 | break; | 1878 | break; |
1854 | 1879 | ||
1855 | case 72: | 1880 | case 76: |
1856 | 1881 | ||
1857 | { | 1882 | { |
1858 | (yyval.menu) = menu_add_menu(); | 1883 | (yyval.menu) = menu_add_menu(); |
1859 | ;} | 1884 | ;} |
1860 | break; | 1885 | break; |
1861 | 1886 | ||
1862 | case 73: | 1887 | case 77: |
1863 | 1888 | ||
1864 | { | 1889 | { |
1865 | if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) { | 1890 | if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) { |
@@ -1869,7 +1894,7 @@ yyreduce: | |||
1869 | ;} | 1894 | ;} |
1870 | break; | 1895 | break; |
1871 | 1896 | ||
1872 | case 79: | 1897 | case 83: |
1873 | 1898 | ||
1874 | { | 1899 | { |
1875 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); | 1900 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string)); |
@@ -1877,7 +1902,7 @@ yyreduce: | |||
1877 | ;} | 1902 | ;} |
1878 | break; | 1903 | break; |
1879 | 1904 | ||
1880 | case 80: | 1905 | case 84: |
1881 | 1906 | ||
1882 | { | 1907 | { |
1883 | menu_add_entry(NULL); | 1908 | menu_add_entry(NULL); |
@@ -1886,14 +1911,14 @@ yyreduce: | |||
1886 | ;} | 1911 | ;} |
1887 | break; | 1912 | break; |
1888 | 1913 | ||
1889 | case 81: | 1914 | case 85: |
1890 | 1915 | ||
1891 | { | 1916 | { |
1892 | menu_end_entry(); | 1917 | menu_end_entry(); |
1893 | ;} | 1918 | ;} |
1894 | break; | 1919 | break; |
1895 | 1920 | ||
1896 | case 82: | 1921 | case 86: |
1897 | 1922 | ||
1898 | { | 1923 | { |
1899 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | 1924 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); |
@@ -1901,14 +1926,14 @@ yyreduce: | |||
1901 | ;} | 1926 | ;} |
1902 | break; | 1927 | break; |
1903 | 1928 | ||
1904 | case 83: | 1929 | case 87: |
1905 | 1930 | ||
1906 | { | 1931 | { |
1907 | current_entry->help = (yyvsp[(2) - (2)].string); | 1932 | current_entry->help = (yyvsp[(2) - (2)].string); |
1908 | ;} | 1933 | ;} |
1909 | break; | 1934 | break; |
1910 | 1935 | ||
1911 | case 88: | 1936 | case 92: |
1912 | 1937 | ||
1913 | { | 1938 | { |
1914 | menu_add_dep((yyvsp[(3) - (4)].expr)); | 1939 | menu_add_dep((yyvsp[(3) - (4)].expr)); |
@@ -1916,84 +1941,91 @@ yyreduce: | |||
1916 | ;} | 1941 | ;} |
1917 | break; | 1942 | break; |
1918 | 1943 | ||
1919 | case 90: | 1944 | case 96: |
1945 | |||
1946 | { | ||
1947 | menu_add_visibility((yyvsp[(2) - (2)].expr)); | ||
1948 | ;} | ||
1949 | break; | ||
1950 | |||
1951 | case 98: | ||
1920 | 1952 | ||
1921 | { | 1953 | { |
1922 | menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); | 1954 | menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr)); |
1923 | ;} | 1955 | ;} |
1924 | break; | 1956 | break; |
1925 | 1957 | ||
1926 | case 93: | 1958 | case 101: |
1927 | 1959 | ||
1928 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} | 1960 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} |
1929 | break; | 1961 | break; |
1930 | 1962 | ||
1931 | case 94: | 1963 | case 102: |
1932 | 1964 | ||
1933 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} | 1965 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} |
1934 | break; | 1966 | break; |
1935 | 1967 | ||
1936 | case 95: | 1968 | case 103: |
1937 | 1969 | ||
1938 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} | 1970 | { (yyval.id) = (yyvsp[(1) - (2)].id); ;} |
1939 | break; | 1971 | break; |
1940 | 1972 | ||
1941 | case 98: | 1973 | case 106: |
1942 | 1974 | ||
1943 | { (yyval.expr) = NULL; ;} | 1975 | { (yyval.expr) = NULL; ;} |
1944 | break; | 1976 | break; |
1945 | 1977 | ||
1946 | case 99: | 1978 | case 107: |
1947 | 1979 | ||
1948 | { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} | 1980 | { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;} |
1949 | break; | 1981 | break; |
1950 | 1982 | ||
1951 | case 100: | 1983 | case 108: |
1952 | 1984 | ||
1953 | { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;} | 1985 | { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;} |
1954 | break; | 1986 | break; |
1955 | 1987 | ||
1956 | case 101: | 1988 | case 109: |
1957 | 1989 | ||
1958 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} | 1990 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} |
1959 | break; | 1991 | break; |
1960 | 1992 | ||
1961 | case 102: | 1993 | case 110: |
1962 | 1994 | ||
1963 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} | 1995 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;} |
1964 | break; | 1996 | break; |
1965 | 1997 | ||
1966 | case 103: | 1998 | case 111: |
1967 | 1999 | ||
1968 | { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} | 2000 | { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} |
1969 | break; | 2001 | break; |
1970 | 2002 | ||
1971 | case 104: | 2003 | case 112: |
1972 | 2004 | ||
1973 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;} | 2005 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;} |
1974 | break; | 2006 | break; |
1975 | 2007 | ||
1976 | case 105: | 2008 | case 113: |
1977 | 2009 | ||
1978 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} | 2010 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} |
1979 | break; | 2011 | break; |
1980 | 2012 | ||
1981 | case 106: | 2013 | case 114: |
1982 | 2014 | ||
1983 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} | 2015 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} |
1984 | break; | 2016 | break; |
1985 | 2017 | ||
1986 | case 107: | 2018 | case 115: |
1987 | 2019 | ||
1988 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;} | 2020 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;} |
1989 | break; | 2021 | break; |
1990 | 2022 | ||
1991 | case 108: | 2023 | case 116: |
1992 | 2024 | ||
1993 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;} | 2025 | { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;} |
1994 | break; | 2026 | break; |
1995 | 2027 | ||
1996 | case 109: | 2028 | case 117: |
1997 | 2029 | ||
1998 | { (yyval.string) = NULL; ;} | 2030 | { (yyval.string) = NULL; ;} |
1999 | break; | 2031 | break; |
@@ -2239,6 +2271,10 @@ void conf_parse(const char *name) | |||
2239 | prop = prop_alloc(P_DEFAULT, modules_sym); | 2271 | prop = prop_alloc(P_DEFAULT, modules_sym); |
2240 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); | 2272 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); |
2241 | } | 2273 | } |
2274 | |||
2275 | rootmenu.prompt->text = _(rootmenu.prompt->text); | ||
2276 | rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); | ||
2277 | |||
2242 | menu_finalize(&rootmenu); | 2278 | menu_finalize(&rootmenu); |
2243 | for_all_symbols(i, sym) { | 2279 | for_all_symbols(i, sym) { |
2244 | if (sym_check_deps(sym)) | 2280 | if (sym_check_deps(sym)) |
@@ -2259,6 +2295,7 @@ static const char *zconf_tokenname(int token) | |||
2259 | case T_IF: return "if"; | 2295 | case T_IF: return "if"; |
2260 | case T_ENDIF: return "endif"; | 2296 | case T_ENDIF: return "endif"; |
2261 | case T_DEPENDS: return "depends"; | 2297 | case T_DEPENDS: return "depends"; |
2298 | case T_VISIBLE: return "visible"; | ||
2262 | } | 2299 | } |
2263 | return "<token>"; | 2300 | return "<token>"; |
2264 | } | 2301 | } |
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 23dfd3baa7a..49fb4ab664c 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 30 |
40 | 40 | ||
41 | %union | 41 | %union |
42 | { | 42 | { |
@@ -68,6 +68,7 @@ static struct menu *current_menu, *current_entry; | |||
68 | %token <id>T_DEFAULT | 68 | %token <id>T_DEFAULT |
69 | %token <id>T_SELECT | 69 | %token <id>T_SELECT |
70 | %token <id>T_RANGE | 70 | %token <id>T_RANGE |
71 | %token <id>T_VISIBLE | ||
71 | %token <id>T_OPTION | 72 | %token <id>T_OPTION |
72 | %token <id>T_ON | 73 | %token <id>T_ON |
73 | %token <string> T_WORD | 74 | %token <string> T_WORD |
@@ -104,14 +105,15 @@ static struct menu *current_menu, *current_entry; | |||
104 | %} | 105 | %} |
105 | 106 | ||
106 | %% | 107 | %% |
107 | input: stmt_list; | 108 | input: nl start | start; |
109 | |||
110 | start: mainmenu_stmt stmt_list | stmt_list; | ||
108 | 111 | ||
109 | stmt_list: | 112 | stmt_list: |
110 | /* empty */ | 113 | /* empty */ |
111 | | stmt_list common_stmt | 114 | | stmt_list common_stmt |
112 | | stmt_list choice_stmt | 115 | | stmt_list choice_stmt |
113 | | stmt_list menu_stmt | 116 | | stmt_list menu_stmt |
114 | | stmt_list T_MAINMENU prompt nl | ||
115 | | stmt_list end { zconf_error("unexpected end statement"); } | 117 | | stmt_list end { zconf_error("unexpected end statement"); } |
116 | | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } | 118 | | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } |
117 | | stmt_list option_name error T_EOL | 119 | | stmt_list option_name error T_EOL |
@@ -122,7 +124,7 @@ stmt_list: | |||
122 | ; | 124 | ; |
123 | 125 | ||
124 | option_name: | 126 | option_name: |
125 | T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | 127 | T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE |
126 | ; | 128 | ; |
127 | 129 | ||
128 | common_stmt: | 130 | common_stmt: |
@@ -342,6 +344,13 @@ if_block: | |||
342 | | if_block choice_stmt | 344 | | if_block choice_stmt |
343 | ; | 345 | ; |
344 | 346 | ||
347 | /* mainmenu entry */ | ||
348 | |||
349 | mainmenu_stmt: T_MAINMENU prompt nl | ||
350 | { | ||
351 | menu_add_prompt(P_MENU, $2, NULL); | ||
352 | }; | ||
353 | |||
345 | /* menu entry */ | 354 | /* menu entry */ |
346 | 355 | ||
347 | menu: T_MENU prompt T_EOL | 356 | menu: T_MENU prompt T_EOL |
@@ -351,7 +360,7 @@ menu: T_MENU prompt T_EOL | |||
351 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | 360 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); |
352 | }; | 361 | }; |
353 | 362 | ||
354 | menu_entry: menu depends_list | 363 | menu_entry: menu visibility_list depends_list |
355 | { | 364 | { |
356 | $$ = menu_add_menu(); | 365 | $$ = menu_add_menu(); |
357 | }; | 366 | }; |
@@ -422,6 +431,19 @@ depends: T_DEPENDS T_ON expr T_EOL | |||
422 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | 431 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); |
423 | }; | 432 | }; |
424 | 433 | ||
434 | /* visibility option */ | ||
435 | |||
436 | visibility_list: | ||
437 | /* empty */ | ||
438 | | visibility_list visible | ||
439 | | visibility_list T_EOL | ||
440 | ; | ||
441 | |||
442 | visible: T_VISIBLE if_expr | ||
443 | { | ||
444 | menu_add_visibility($2); | ||
445 | }; | ||
446 | |||
425 | /* prompt statement */ | 447 | /* prompt statement */ |
426 | 448 | ||
427 | prompt_stmt_opt: | 449 | prompt_stmt_opt: |
@@ -494,6 +516,10 @@ void conf_parse(const char *name) | |||
494 | prop = prop_alloc(P_DEFAULT, modules_sym); | 516 | prop = prop_alloc(P_DEFAULT, modules_sym); |
495 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); | 517 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); |
496 | } | 518 | } |
519 | |||
520 | rootmenu.prompt->text = _(rootmenu.prompt->text); | ||
521 | rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); | ||
522 | |||
497 | menu_finalize(&rootmenu); | 523 | menu_finalize(&rootmenu); |
498 | for_all_symbols(i, sym) { | 524 | for_all_symbols(i, sym) { |
499 | if (sym_check_deps(sym)) | 525 | if (sym_check_deps(sym)) |
@@ -514,6 +540,7 @@ static const char *zconf_tokenname(int token) | |||
514 | case T_IF: return "if"; | 540 | case T_IF: return "if"; |
515 | case T_ENDIF: return "endif"; | 541 | case T_ENDIF: return "endif"; |
516 | case T_DEPENDS: return "depends"; | 542 | case T_DEPENDS: return "depends"; |
543 | case T_VISIBLE: return "visible"; | ||
517 | } | 544 | } |
518 | return "<token>"; | 545 | return "<token>"; |
519 | } | 546 | } |