diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 14:05:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-06-26 14:05:15 -0400 |
commit | 2a2ed2db353d949c06b6ef8b6913f65b39111eab (patch) | |
tree | d835c3dd101da91089c3bdf51c8632e84be37232 /scripts | |
parent | 972d19e837833b93466c6f6a8ef2a7d653000aa3 (diff) | |
parent | 070b98bfda3d27269519067c1c67eaef695f3e0c (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild: (40 commits)
kbuild: trivial fixes in Makefile
kbuild: adding symbols in Kconfig and defconfig to TAGS
kbuild: replace abort() with exit(1)
kbuild: support for %.symtypes files
kbuild: fix silentoldconfig recursion
kbuild: add option for stripping modules while installing them
kbuild: kill some false positives from modpost
kbuild: export-symbol usage report generator
kbuild: fix make -rR breakage
kbuild: append -dirty for updated but uncommited changes
kbuild: append git revision for all untagged commits
kbuild: fix module.symvers parsing in modpost
kbuild: ignore make's built-in rules & variables
kbuild: bugfix with initramfs
kbuild: modpost build fix
kbuild: check license compatibility when building modules
kbuild: export-type enhancement to modpost.c
kbuild: add dependency on kernel.release to the package targets
kbuild: `make kernelrelease' speedup
kconfig: KCONFIG_OVERWRITECONFIG
...
Diffstat (limited to 'scripts')
35 files changed, 2452 insertions, 1420 deletions
diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include index b0d067be7390..ac5f275b0283 100644 --- a/scripts/Kbuild.include +++ b/scripts/Kbuild.include | |||
@@ -13,6 +13,11 @@ space := $(empty) $(empty) | |||
13 | depfile = $(subst $(comma),_,$(@D)/.$(@F).d) | 13 | depfile = $(subst $(comma),_,$(@D)/.$(@F).d) |
14 | 14 | ||
15 | ### | 15 | ### |
16 | # basetarget equals the filename of the target with no extension. | ||
17 | # So 'foo/bar.o' becomes 'bar' | ||
18 | basetarget = $(basename $(notdir $@)) | ||
19 | |||
20 | ### | ||
16 | # Escape single quote for use in echo statements | 21 | # Escape single quote for use in echo statements |
17 | escsq = $(subst $(squote),'\$(squote)',$1) | 22 | escsq = $(subst $(squote),'\$(squote)',$1) |
18 | 23 | ||
diff --git a/scripts/Makefile.build b/scripts/Makefile.build index e48e60da3040..3cb445cc7432 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build | |||
@@ -8,7 +8,7 @@ PHONY := __build | |||
8 | __build: | 8 | __build: |
9 | 9 | ||
10 | # Read .config if it exist, otherwise ignore | 10 | # Read .config if it exist, otherwise ignore |
11 | -include .config | 11 | -include include/config/auto.conf |
12 | 12 | ||
13 | include scripts/Kbuild.include | 13 | include scripts/Kbuild.include |
14 | 14 | ||
@@ -117,7 +117,7 @@ $(real-objs-m:.o=.lst): quiet_modtag := [M] | |||
117 | $(obj-m) : quiet_modtag := [M] | 117 | $(obj-m) : quiet_modtag := [M] |
118 | 118 | ||
119 | # Default for not multi-part modules | 119 | # Default for not multi-part modules |
120 | modname = $(*F) | 120 | modname = $(basetarget) |
121 | 121 | ||
122 | $(multi-objs-m) : modname = $(modname-multi) | 122 | $(multi-objs-m) : modname = $(modname-multi) |
123 | $(multi-objs-m:.o=.i) : modname = $(modname-multi) | 123 | $(multi-objs-m:.o=.i) : modname = $(modname-multi) |
@@ -140,6 +140,15 @@ cmd_cc_i_c = $(CPP) $(c_flags) -o $@ $< | |||
140 | %.i: %.c FORCE | 140 | %.i: %.c FORCE |
141 | $(call if_changed_dep,cc_i_c) | 141 | $(call if_changed_dep,cc_i_c) |
142 | 142 | ||
143 | quiet_cmd_cc_symtypes_c = SYM $(quiet_modtag) $@ | ||
144 | cmd_cc_symtypes_c = \ | ||
145 | $(CPP) -D__GENKSYMS__ $(c_flags) $< \ | ||
146 | | $(GENKSYMS) -T $@ >/dev/null; \ | ||
147 | test -s $@ || rm -f $@ | ||
148 | |||
149 | %.symtypes : %.c FORCE | ||
150 | $(call if_changed_dep,cc_symtypes_c) | ||
151 | |||
143 | # C (.c) files | 152 | # C (.c) files |
144 | # The C file is compiled and updated dependency information is generated. | 153 | # The C file is compiled and updated dependency information is generated. |
145 | # (See cmd_cc_o_c + relevant part of rule_cc_o_c) | 154 | # (See cmd_cc_o_c + relevant part of rule_cc_o_c) |
@@ -166,7 +175,8 @@ cmd_cc_o_c = $(CC) $(c_flags) -c -o $(@D)/.tmp_$(@F) $< | |||
166 | cmd_modversions = \ | 175 | cmd_modversions = \ |
167 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ | 176 | if $(OBJDUMP) -h $(@D)/.tmp_$(@F) | grep -q __ksymtab; then \ |
168 | $(CPP) -D__GENKSYMS__ $(c_flags) $< \ | 177 | $(CPP) -D__GENKSYMS__ $(c_flags) $< \ |
169 | | $(GENKSYMS) -a $(ARCH) \ | 178 | | $(GENKSYMS) $(if $(KBUILD_SYMTYPES), \ |
179 | -T $(@D)/$(@F:.o=.symtypes)) -a $(ARCH) \ | ||
170 | > $(@D)/.tmp_$(@F:.o=.ver); \ | 180 | > $(@D)/.tmp_$(@F:.o=.ver); \ |
171 | \ | 181 | \ |
172 | $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ | 182 | $(LD) $(LDFLAGS) -r -o $@ $(@D)/.tmp_$(@F) \ |
diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 2d519704b8fd..18ecd4d5df7f 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host | |||
@@ -33,8 +33,8 @@ | |||
33 | __hostprogs := $(sort $(hostprogs-y)$(hostprogs-m)) | 33 | __hostprogs := $(sort $(hostprogs-y)$(hostprogs-m)) |
34 | 34 | ||
35 | # hostprogs-y := tools/build may have been specified. Retreive directory | 35 | # hostprogs-y := tools/build may have been specified. Retreive directory |
36 | obj-dirs += $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) | 36 | host-objdirs := $(foreach f,$(__hostprogs), $(if $(dir $(f)),$(dir $(f)))) |
37 | obj-dirs := $(strip $(sort $(filter-out ./,$(obj-dirs)))) | 37 | host-objdirs := $(strip $(sort $(filter-out ./,$(host-objdirs)))) |
38 | 38 | ||
39 | 39 | ||
40 | # C code | 40 | # C code |
@@ -73,13 +73,17 @@ host-cxxmulti := $(addprefix $(obj)/,$(host-cxxmulti)) | |||
73 | host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) | 73 | host-cxxobjs := $(addprefix $(obj)/,$(host-cxxobjs)) |
74 | host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) | 74 | host-cshlib := $(addprefix $(obj)/,$(host-cshlib)) |
75 | host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) | 75 | host-cshobjs := $(addprefix $(obj)/,$(host-cshobjs)) |
76 | obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) | 76 | host-objdirs := $(addprefix $(obj)/,$(host-objdirs)) |
77 | |||
78 | obj-dirs += $(host-objdirs) | ||
77 | 79 | ||
78 | ##### | 80 | ##### |
79 | # Handle options to gcc. Support building with separate output directory | 81 | # Handle options to gcc. Support building with separate output directory |
80 | 82 | ||
81 | _hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS_$(*F).o) | 83 | _hostc_flags = $(HOSTCFLAGS) $(HOST_EXTRACFLAGS) \ |
82 | _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) $(HOSTCXXFLAGS_$(*F).o) | 84 | $(HOSTCFLAGS_$(basetarget).o) |
85 | _hostcxx_flags = $(HOSTCXXFLAGS) $(HOST_EXTRACXXFLAGS) \ | ||
86 | $(HOSTCXXFLAGS_$(basetarget).o) | ||
83 | 87 | ||
84 | ifeq ($(KBUILD_SRC),) | 88 | ifeq ($(KBUILD_SRC),) |
85 | __hostc_flags = $(_hostc_flags) | 89 | __hostc_flags = $(_hostc_flags) |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 2cb4935e85d1..fc498fee68ed 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
@@ -82,12 +82,12 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) | |||
82 | # than one module. In that case KBUILD_MODNAME will be set to foo_bar, | 82 | # than one module. In that case KBUILD_MODNAME will be set to foo_bar, |
83 | # where foo and bar are the name of the modules. | 83 | # where foo and bar are the name of the modules. |
84 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) | 84 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) |
85 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(*F)))" | 85 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(basetarget)))" |
86 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | 86 | modname_flags = $(if $(filter 1,$(words $(modname))),\ |
87 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | 87 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") |
88 | 88 | ||
89 | _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) | 89 | _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(basetarget).o) |
90 | _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) | 90 | _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(basetarget).o) |
91 | _cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) | 91 | _cpp_flags = $(CPPFLAGS) $(EXTRA_CPPFLAGS) $(CPPFLAGS_$(@F)) |
92 | 92 | ||
93 | # If building the kernel in a separate objtree expand all occurrences | 93 | # If building the kernel in a separate objtree expand all occurrences |
diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index 2686dd5dce8c..f0ff248f5e6f 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst | |||
@@ -17,7 +17,7 @@ __modinst: $(modules) | |||
17 | @: | 17 | @: |
18 | 18 | ||
19 | quiet_cmd_modules_install = INSTALL $@ | 19 | quiet_cmd_modules_install = INSTALL $@ |
20 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) | 20 | cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) |
21 | 21 | ||
22 | # Modules built outside the kernel source tree go into extra by default | 22 | # Modules built outside the kernel source tree go into extra by default |
23 | INSTALL_MOD_DIR ?= extra | 23 | INSTALL_MOD_DIR ?= extra |
diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 0e056cffffdb..e83613e0e827 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost | |||
@@ -35,7 +35,7 @@ | |||
35 | PHONY := _modpost | 35 | PHONY := _modpost |
36 | _modpost: __modpost | 36 | _modpost: __modpost |
37 | 37 | ||
38 | include .config | 38 | include include/config/auto.conf |
39 | include scripts/Kbuild.include | 39 | include scripts/Kbuild.include |
40 | include scripts/Makefile.lib | 40 | include scripts/Makefile.lib |
41 | 41 | ||
@@ -72,7 +72,7 @@ $(modules:.ko=.mod.c): __modpost ; | |||
72 | # Step 5), compile all *.mod.c files | 72 | # Step 5), compile all *.mod.c files |
73 | 73 | ||
74 | # modname is set to make c_flags define KBUILD_MODNAME | 74 | # modname is set to make c_flags define KBUILD_MODNAME |
75 | modname = $(*F) | 75 | modname = $(basetarget) |
76 | 76 | ||
77 | quiet_cmd_cc_o_c = CC $@ | 77 | quiet_cmd_cc_o_c = CC $@ |
78 | cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \ | 78 | cmd_cc_o_c = $(CC) $(c_flags) $(CFLAGS_MODULE) \ |
diff --git a/scripts/basic/Makefile b/scripts/basic/Makefile index f22e94c3a2d1..2f60070f9733 100644 --- a/scripts/basic/Makefile +++ b/scripts/basic/Makefile | |||
@@ -1,17 +1,15 @@ | |||
1 | ### | 1 | ### |
2 | # Makefile.basic list the most basic programs used during the build process. | 2 | # Makefile.basic list the most basic programs used during the build process. |
3 | # The programs listed herein is what is needed to do the basic stuff, | 3 | # The programs listed herein is what is needed to do the basic stuff, |
4 | # such as splitting .config and fix dependency file. | 4 | # such as fix dependency file. |
5 | # This initial step is needed to avoid files to be recompiled | 5 | # This initial step is needed to avoid files to be recompiled |
6 | # when kernel configuration changes (which is what happens when | 6 | # when kernel configuration changes (which is what happens when |
7 | # .config is included by main Makefile. | 7 | # .config is included by main Makefile. |
8 | # --------------------------------------------------------------------------- | 8 | # --------------------------------------------------------------------------- |
9 | # fixdep: Used to generate dependency information during build process | 9 | # fixdep: Used to generate dependency information during build process |
10 | # split-include: Divide all config symbols up in a number of files in | ||
11 | # include/config/... | ||
12 | # docproc: Used in Documentation/docbook | 10 | # docproc: Used in Documentation/docbook |
13 | 11 | ||
14 | hostprogs-y := fixdep split-include docproc | 12 | hostprogs-y := fixdep docproc |
15 | always := $(hostprogs-y) | 13 | always := $(hostprogs-y) |
16 | 14 | ||
17 | # fixdep is needed to compile other host programs | 15 | # fixdep is needed to compile other host programs |
diff --git a/scripts/basic/split-include.c b/scripts/basic/split-include.c deleted file mode 100644 index 459c45276cb1..000000000000 --- a/scripts/basic/split-include.c +++ /dev/null | |||
@@ -1,226 +0,0 @@ | |||
1 | /* | ||
2 | * split-include.c | ||
3 | * | ||
4 | * Copyright abandoned, Michael Chastain, <mailto:mec@shout.net>. | ||
5 | * This is a C version of syncdep.pl by Werner Almesberger. | ||
6 | * | ||
7 | * This program takes autoconf.h as input and outputs a directory full | ||
8 | * of one-line include files, merging onto the old values. | ||
9 | * | ||
10 | * Think of the configuration options as key-value pairs. Then there | ||
11 | * are five cases: | ||
12 | * | ||
13 | * key old value new value action | ||
14 | * | ||
15 | * KEY-1 VALUE-1 VALUE-1 leave file alone | ||
16 | * KEY-2 VALUE-2A VALUE-2B write VALUE-2B into file | ||
17 | * KEY-3 - VALUE-3 write VALUE-3 into file | ||
18 | * KEY-4 VALUE-4 - write an empty file | ||
19 | * KEY-5 (empty) - leave old empty file alone | ||
20 | */ | ||
21 | |||
22 | #include <sys/stat.h> | ||
23 | #include <sys/types.h> | ||
24 | |||
25 | #include <ctype.h> | ||
26 | #include <errno.h> | ||
27 | #include <fcntl.h> | ||
28 | #include <stdio.h> | ||
29 | #include <stdlib.h> | ||
30 | #include <string.h> | ||
31 | #include <unistd.h> | ||
32 | |||
33 | #define ERROR_EXIT(strExit) \ | ||
34 | { \ | ||
35 | const int errnoSave = errno; \ | ||
36 | fprintf(stderr, "%s: ", str_my_name); \ | ||
37 | errno = errnoSave; \ | ||
38 | perror((strExit)); \ | ||
39 | exit(1); \ | ||
40 | } | ||
41 | |||
42 | |||
43 | |||
44 | int main(int argc, const char * argv []) | ||
45 | { | ||
46 | const char * str_my_name; | ||
47 | const char * str_file_autoconf; | ||
48 | const char * str_dir_config; | ||
49 | |||
50 | FILE * fp_config; | ||
51 | FILE * fp_target; | ||
52 | FILE * fp_find; | ||
53 | |||
54 | int buffer_size; | ||
55 | |||
56 | char * line; | ||
57 | char * old_line; | ||
58 | char * list_target; | ||
59 | char * ptarget; | ||
60 | |||
61 | struct stat stat_buf; | ||
62 | |||
63 | /* Check arg count. */ | ||
64 | if (argc != 3) | ||
65 | { | ||
66 | fprintf(stderr, "%s: wrong number of arguments.\n", argv[0]); | ||
67 | exit(1); | ||
68 | } | ||
69 | |||
70 | str_my_name = argv[0]; | ||
71 | str_file_autoconf = argv[1]; | ||
72 | str_dir_config = argv[2]; | ||
73 | |||
74 | /* Find a buffer size. */ | ||
75 | if (stat(str_file_autoconf, &stat_buf) != 0) | ||
76 | ERROR_EXIT(str_file_autoconf); | ||
77 | buffer_size = 2 * stat_buf.st_size + 4096; | ||
78 | |||
79 | /* Allocate buffers. */ | ||
80 | if ( (line = malloc(buffer_size)) == NULL | ||
81 | || (old_line = malloc(buffer_size)) == NULL | ||
82 | || (list_target = malloc(buffer_size)) == NULL ) | ||
83 | ERROR_EXIT(str_file_autoconf); | ||
84 | |||
85 | /* Open autoconfig file. */ | ||
86 | if ((fp_config = fopen(str_file_autoconf, "r")) == NULL) | ||
87 | ERROR_EXIT(str_file_autoconf); | ||
88 | |||
89 | /* Make output directory if needed. */ | ||
90 | if (stat(str_dir_config, &stat_buf) != 0) | ||
91 | { | ||
92 | if (mkdir(str_dir_config, 0755) != 0) | ||
93 | ERROR_EXIT(str_dir_config); | ||
94 | } | ||
95 | |||
96 | /* Change to output directory. */ | ||
97 | if (chdir(str_dir_config) != 0) | ||
98 | ERROR_EXIT(str_dir_config); | ||
99 | |||
100 | /* Put initial separator into target list. */ | ||
101 | ptarget = list_target; | ||
102 | *ptarget++ = '\n'; | ||
103 | |||
104 | /* Read config lines. */ | ||
105 | while (fgets(line, buffer_size, fp_config)) | ||
106 | { | ||
107 | const char * str_config; | ||
108 | int is_same; | ||
109 | int itarget; | ||
110 | |||
111 | if (line[0] != '#') | ||
112 | continue; | ||
113 | if ((str_config = strstr(line, "CONFIG_")) == NULL) | ||
114 | continue; | ||
115 | |||
116 | /* Make the output file name. */ | ||
117 | str_config += sizeof("CONFIG_") - 1; | ||
118 | for (itarget = 0; !isspace(str_config[itarget]); itarget++) | ||
119 | { | ||
120 | int c = (unsigned char) str_config[itarget]; | ||
121 | if (isupper(c)) c = tolower(c); | ||
122 | if (c == '_') c = '/'; | ||
123 | ptarget[itarget] = c; | ||
124 | } | ||
125 | ptarget[itarget++] = '.'; | ||
126 | ptarget[itarget++] = 'h'; | ||
127 | ptarget[itarget++] = '\0'; | ||
128 | |||
129 | /* Check for existing file. */ | ||
130 | is_same = 0; | ||
131 | if ((fp_target = fopen(ptarget, "r")) != NULL) | ||
132 | { | ||
133 | fgets(old_line, buffer_size, fp_target); | ||
134 | if (fclose(fp_target) != 0) | ||
135 | ERROR_EXIT(ptarget); | ||
136 | if (!strcmp(line, old_line)) | ||
137 | is_same = 1; | ||
138 | } | ||
139 | |||
140 | if (!is_same) | ||
141 | { | ||
142 | /* Auto-create directories. */ | ||
143 | int islash; | ||
144 | for (islash = 0; islash < itarget; islash++) | ||
145 | { | ||
146 | if (ptarget[islash] == '/') | ||
147 | { | ||
148 | ptarget[islash] = '\0'; | ||
149 | if (stat(ptarget, &stat_buf) != 0 | ||
150 | && mkdir(ptarget, 0755) != 0) | ||
151 | ERROR_EXIT( ptarget ); | ||
152 | ptarget[islash] = '/'; | ||
153 | } | ||
154 | } | ||
155 | |||
156 | /* Write the file. */ | ||
157 | if ((fp_target = fopen(ptarget, "w" )) == NULL) | ||
158 | ERROR_EXIT(ptarget); | ||
159 | fputs(line, fp_target); | ||
160 | if (ferror(fp_target) || fclose(fp_target) != 0) | ||
161 | ERROR_EXIT(ptarget); | ||
162 | } | ||
163 | |||
164 | /* Update target list */ | ||
165 | ptarget += itarget; | ||
166 | *(ptarget-1) = '\n'; | ||
167 | } | ||
168 | |||
169 | /* | ||
170 | * Close autoconfig file. | ||
171 | * Terminate the target list. | ||
172 | */ | ||
173 | if (fclose(fp_config) != 0) | ||
174 | ERROR_EXIT(str_file_autoconf); | ||
175 | *ptarget = '\0'; | ||
176 | |||
177 | /* | ||
178 | * Fix up existing files which have no new value. | ||
179 | * This is Case 4 and Case 5. | ||
180 | * | ||
181 | * I re-read the tree and filter it against list_target. | ||
182 | * This is crude. But it avoids data copies. Also, list_target | ||
183 | * is compact and contiguous, so it easily fits into cache. | ||
184 | * | ||
185 | * Notice that list_target contains strings separated by \n, | ||
186 | * with a \n before the first string and after the last. | ||
187 | * fgets gives the incoming names a terminating \n. | ||
188 | * So by having an initial \n, strstr will find exact matches. | ||
189 | */ | ||
190 | |||
191 | fp_find = popen("find * -type f -name \"*.h\" -print", "r"); | ||
192 | if (fp_find == 0) | ||
193 | ERROR_EXIT( "find" ); | ||
194 | |||
195 | line[0] = '\n'; | ||
196 | while (fgets(line+1, buffer_size, fp_find)) | ||
197 | { | ||
198 | if (strstr(list_target, line) == NULL) | ||
199 | { | ||
200 | /* | ||
201 | * This is an old file with no CONFIG_* flag in autoconf.h. | ||
202 | */ | ||
203 | |||
204 | /* First strip the \n. */ | ||
205 | line[strlen(line)-1] = '\0'; | ||
206 | |||
207 | /* Grab size. */ | ||
208 | if (stat(line+1, &stat_buf) != 0) | ||
209 | ERROR_EXIT(line); | ||
210 | |||
211 | /* If file is not empty, make it empty and give it a fresh date. */ | ||
212 | if (stat_buf.st_size != 0) | ||
213 | { | ||
214 | if ((fp_target = fopen(line+1, "w")) == NULL) | ||
215 | ERROR_EXIT(line); | ||
216 | if (fclose(fp_target) != 0) | ||
217 | ERROR_EXIT(line); | ||
218 | } | ||
219 | } | ||
220 | } | ||
221 | |||
222 | if (pclose(fp_find) != 0) | ||
223 | ERROR_EXIT("find"); | ||
224 | |||
225 | return 0; | ||
226 | } | ||
diff --git a/scripts/export_report.pl b/scripts/export_report.pl new file mode 100644 index 000000000000..9ed00d9bb0a7 --- /dev/null +++ b/scripts/export_report.pl | |||
@@ -0,0 +1,169 @@ | |||
1 | #!/usr/bin/perl -w | ||
2 | # | ||
3 | # (C) Copyright IBM Corporation 2006. | ||
4 | # Released under GPL v2. | ||
5 | # Author : Ram Pai (linuxram@us.ibm.com) | ||
6 | # | ||
7 | # Usage: export_report.pl -k Module.symvers [-o report_file ] -f *.mod.c | ||
8 | # | ||
9 | |||
10 | use Getopt::Std; | ||
11 | use strict; | ||
12 | |||
13 | sub numerically { | ||
14 | my $no1 = (split /\s+/, $a)[1]; | ||
15 | my $no2 = (split /\s+/, $b)[1]; | ||
16 | return $no1 <=> $no2; | ||
17 | } | ||
18 | |||
19 | sub alphabetically { | ||
20 | my ($module1, $value1) = @{$a}; | ||
21 | my ($module2, $value2) = @{$b}; | ||
22 | return $value1 <=> $value2 || $module2 cmp $module1; | ||
23 | } | ||
24 | |||
25 | sub print_depends_on { | ||
26 | my ($href) = @_; | ||
27 | print "\n"; | ||
28 | while (my ($mod, $list) = each %$href) { | ||
29 | print "\t$mod:\n"; | ||
30 | foreach my $sym (sort numerically @{$list}) { | ||
31 | my ($symbol, $no) = split /\s+/, $sym; | ||
32 | printf("\t\t%-25s\t%-25d\n", $symbol, $no); | ||
33 | } | ||
34 | print "\n"; | ||
35 | } | ||
36 | print "\n"; | ||
37 | print "~"x80 , "\n"; | ||
38 | } | ||
39 | |||
40 | sub usage { | ||
41 | print "Usage: @_ -h -k Module.symvers [ -o outputfile ] \n", | ||
42 | "\t-f: treat all the non-option argument as .mod.c files. ", | ||
43 | "Recommend using this as the last option\n", | ||
44 | "\t-h: print detailed help\n", | ||
45 | "\t-k: the path to Module.symvers file. By default uses ", | ||
46 | "the file from the current directory\n", | ||
47 | "\t-o outputfile: output the report to outputfile\n"; | ||
48 | exit 0; | ||
49 | } | ||
50 | |||
51 | sub collectcfiles { | ||
52 | my @file = `cat .tmp_versions/*.mod | grep '.*\.ko\$'`; | ||
53 | @file = grep {s/\.ko/.mod.c/} @file; | ||
54 | chomp @file; | ||
55 | return @file; | ||
56 | } | ||
57 | |||
58 | my (%SYMBOL, %MODULE, %opt, @allcfiles); | ||
59 | |||
60 | if (not getopts('hk:o:f',\%opt) or defined $opt{'h'}) { | ||
61 | usage($0); | ||
62 | } | ||
63 | |||
64 | if (defined $opt{'f'}) { | ||
65 | @allcfiles = @ARGV; | ||
66 | } else { | ||
67 | @allcfiles = collectcfiles(); | ||
68 | } | ||
69 | |||
70 | if (not defined $opt{'k'}) { | ||
71 | $opt{'k'} = "Module.symvers"; | ||
72 | } | ||
73 | |||
74 | unless (open(MODULE_SYMVERS, $opt{'k'})) { | ||
75 | die "Sorry, cannot open $opt{'k'}: $!\n"; | ||
76 | } | ||
77 | |||
78 | if (defined $opt{'o'}) { | ||
79 | unless (open(OUTPUT_HANDLE, ">$opt{'o'}")) { | ||
80 | die "Sorry, cannot open $opt{'o'} $!\n"; | ||
81 | } | ||
82 | select OUTPUT_HANDLE; | ||
83 | } | ||
84 | # | ||
85 | # collect all the symbols and their attributes from the | ||
86 | # Module.symvers file | ||
87 | # | ||
88 | while ( <MODULE_SYMVERS> ) { | ||
89 | chomp; | ||
90 | my (undef, $symbol, $module, $gpl) = split; | ||
91 | $SYMBOL { $symbol } = [ $module , "0" , $symbol, $gpl]; | ||
92 | } | ||
93 | close(MODULE_SYMVERS); | ||
94 | |||
95 | # | ||
96 | # collect the usage count of each symbol. | ||
97 | # | ||
98 | foreach my $thismod (@allcfiles) { | ||
99 | unless (open(MODULE_MODULE, $thismod)) { | ||
100 | print "Sorry, cannot open $thismod: $!\n"; | ||
101 | next; | ||
102 | } | ||
103 | my $state=0; | ||
104 | while ( <MODULE_MODULE> ) { | ||
105 | chomp; | ||
106 | if ($state eq 0) { | ||
107 | $state = 1 if ($_ =~ /static const struct modversion_info/); | ||
108 | next; | ||
109 | } | ||
110 | if ($state eq 1) { | ||
111 | $state = 2 if ($_ =~ /__attribute__\(\(section\("__versions"\)\)\)/); | ||
112 | next; | ||
113 | } | ||
114 | if ($state eq 2) { | ||
115 | if ( $_ !~ /0x[0-9a-f]{7,8},/ ) { | ||
116 | next; | ||
117 | } | ||
118 | my $sym = (split /([,"])/,)[4]; | ||
119 | my ($module, $value, $symbol, $gpl) = @{$SYMBOL{$sym}}; | ||
120 | $SYMBOL{ $sym } = [ $module, $value+1, $symbol, $gpl]; | ||
121 | push(@{$MODULE{$thismod}} , $sym); | ||
122 | } | ||
123 | } | ||
124 | if ($state ne 2) { | ||
125 | print "WARNING:$thismod is not built with CONFIG_MODVERSION enabled\n"; | ||
126 | } | ||
127 | close(MODULE_MODULE); | ||
128 | } | ||
129 | |||
130 | print "\tThis file reports the exported symbols usage patterns by in-tree\n", | ||
131 | "\t\t\t\tmodules\n"; | ||
132 | printf("%s\n\n\n","x"x80); | ||
133 | printf("\t\t\t\tINDEX\n\n\n"); | ||
134 | printf("SECTION 1: Usage counts of all exported symbols\n"); | ||
135 | printf("SECTION 2: List of modules and the exported symbols they use\n"); | ||
136 | printf("%s\n\n\n","x"x80); | ||
137 | printf("SECTION 1:\tThe exported symbols and their usage count\n\n"); | ||
138 | printf("%-25s\t%-25s\t%-5s\t%-25s\n", "Symbol", "Module", "Usage count", | ||
139 | "export type"); | ||
140 | |||
141 | # | ||
142 | # print the list of unused exported symbols | ||
143 | # | ||
144 | foreach my $list (sort alphabetically values(%SYMBOL)) { | ||
145 | my ($module, $value, $symbol, $gpl) = @{$list}; | ||
146 | printf("%-25s\t%-25s\t%-10s\t", $symbol, $module, $value); | ||
147 | if (defined $gpl) { | ||
148 | printf("%-25s\n",$gpl); | ||
149 | } else { | ||
150 | printf("\n"); | ||
151 | } | ||
152 | } | ||
153 | printf("%s\n\n\n","x"x80); | ||
154 | |||
155 | printf("SECTION 2:\n\tThis section reports export-symbol-usage of in-kernel | ||
156 | modules. Each module lists the modules, and the symbols from that module that | ||
157 | it uses. Each listed symbol reports the number of modules using it\n"); | ||
158 | |||
159 | print "~"x80 , "\n"; | ||
160 | while (my ($thismod, $list) = each %MODULE) { | ||
161 | my %depends; | ||
162 | $thismod =~ s/\.mod\.c/.ko/; | ||
163 | print "\t\t\t$thismod\n"; | ||
164 | foreach my $symbol (@{$list}) { | ||
165 | my ($module, $value, undef, $gpl) = @{$SYMBOL{$symbol}}; | ||
166 | push (@{$depends{"$module"}}, "$symbol $value"); | ||
167 | } | ||
168 | print_depends_on(\%depends); | ||
169 | } | ||
diff --git a/scripts/genksyms/genksyms.c b/scripts/genksyms/genksyms.c index 5b0344e20d61..b0381823e404 100644 --- a/scripts/genksyms/genksyms.c +++ b/scripts/genksyms/genksyms.c | |||
@@ -42,7 +42,7 @@ static FILE *debugfile; | |||
42 | int cur_line = 1; | 42 | int cur_line = 1; |
43 | char *cur_filename; | 43 | char *cur_filename; |
44 | 44 | ||
45 | static int flag_debug, flag_dump_defs, flag_warnings; | 45 | static int flag_debug, flag_dump_defs, flag_dump_types, flag_warnings; |
46 | static const char *arch = ""; | 46 | static const char *arch = ""; |
47 | static const char *mod_prefix = ""; | 47 | static const char *mod_prefix = ""; |
48 | 48 | ||
@@ -50,6 +50,7 @@ static int errors; | |||
50 | static int nsyms; | 50 | static int nsyms; |
51 | 51 | ||
52 | static struct symbol *expansion_trail; | 52 | static struct symbol *expansion_trail; |
53 | static struct symbol *visited_symbols; | ||
53 | 54 | ||
54 | static const char *const symbol_type_name[] = { | 55 | static const char *const symbol_type_name[] = { |
55 | "normal", "typedef", "enum", "struct", "union" | 56 | "normal", "typedef", "enum", "struct", "union" |
@@ -176,6 +177,7 @@ struct symbol *add_symbol(const char *name, enum symbol_type type, | |||
176 | sym->type = type; | 177 | sym->type = type; |
177 | sym->defn = defn; | 178 | sym->defn = defn; |
178 | sym->expansion_trail = NULL; | 179 | sym->expansion_trail = NULL; |
180 | sym->visited = NULL; | ||
179 | sym->is_extern = is_extern; | 181 | sym->is_extern = is_extern; |
180 | 182 | ||
181 | sym->hash_next = symtab[h]; | 183 | sym->hash_next = symtab[h]; |
@@ -236,26 +238,11 @@ static int equal_list(struct string_list *a, struct string_list *b) | |||
236 | 238 | ||
237 | static void print_node(FILE * f, struct string_list *list) | 239 | static void print_node(FILE * f, struct string_list *list) |
238 | { | 240 | { |
239 | switch (list->tag) { | 241 | if (list->tag != SYM_NORMAL) { |
240 | case SYM_STRUCT: | 242 | putc(symbol_type_name[list->tag][0], f); |
241 | putc('s', f); | ||
242 | goto printit; | ||
243 | case SYM_UNION: | ||
244 | putc('u', f); | ||
245 | goto printit; | ||
246 | case SYM_ENUM: | ||
247 | putc('e', f); | ||
248 | goto printit; | ||
249 | case SYM_TYPEDEF: | ||
250 | putc('t', f); | ||
251 | goto printit; | ||
252 | |||
253 | printit: | ||
254 | putc('#', f); | 243 | putc('#', f); |
255 | case SYM_NORMAL: | ||
256 | fputs(list->string, f); | ||
257 | break; | ||
258 | } | 244 | } |
245 | fputs(list->string, f); | ||
259 | } | 246 | } |
260 | 247 | ||
261 | static void print_list(FILE * f, struct string_list *list) | 248 | static void print_list(FILE * f, struct string_list *list) |
@@ -287,9 +274,9 @@ static void print_list(FILE * f, struct string_list *list) | |||
287 | } | 274 | } |
288 | } | 275 | } |
289 | 276 | ||
290 | static unsigned long expand_and_crc_list(struct string_list *list, | 277 | static unsigned long expand_and_crc_sym(struct symbol *sym, unsigned long crc) |
291 | unsigned long crc) | ||
292 | { | 278 | { |
279 | struct string_list *list = sym->defn; | ||
293 | struct string_list **e, **b; | 280 | struct string_list **e, **b; |
294 | struct string_list *tmp, **tmp2; | 281 | struct string_list *tmp, **tmp2; |
295 | int elem = 1; | 282 | int elem = 1; |
@@ -332,7 +319,7 @@ static unsigned long expand_and_crc_list(struct string_list *list, | |||
332 | } else { | 319 | } else { |
333 | subsym->expansion_trail = expansion_trail; | 320 | subsym->expansion_trail = expansion_trail; |
334 | expansion_trail = subsym; | 321 | expansion_trail = subsym; |
335 | crc = expand_and_crc_list(subsym->defn, crc); | 322 | crc = expand_and_crc_sym(subsym, crc); |
336 | } | 323 | } |
337 | break; | 324 | break; |
338 | 325 | ||
@@ -382,12 +369,22 @@ static unsigned long expand_and_crc_list(struct string_list *list, | |||
382 | } else { | 369 | } else { |
383 | subsym->expansion_trail = expansion_trail; | 370 | subsym->expansion_trail = expansion_trail; |
384 | expansion_trail = subsym; | 371 | expansion_trail = subsym; |
385 | crc = expand_and_crc_list(subsym->defn, crc); | 372 | crc = expand_and_crc_sym(subsym, crc); |
386 | } | 373 | } |
387 | break; | 374 | break; |
388 | } | 375 | } |
389 | } | 376 | } |
390 | 377 | ||
378 | { | ||
379 | static struct symbol **end = &visited_symbols; | ||
380 | |||
381 | if (!sym->visited) { | ||
382 | *end = sym; | ||
383 | end = &sym->visited; | ||
384 | sym->visited = (struct symbol *)-1L; | ||
385 | } | ||
386 | } | ||
387 | |||
391 | return crc; | 388 | return crc; |
392 | } | 389 | } |
393 | 390 | ||
@@ -406,7 +403,7 @@ void export_symbol(const char *name) | |||
406 | 403 | ||
407 | expansion_trail = (struct symbol *)-1L; | 404 | expansion_trail = (struct symbol *)-1L; |
408 | 405 | ||
409 | crc = expand_and_crc_list(sym->defn, 0xffffffff) ^ 0xffffffff; | 406 | crc = expand_and_crc_sym(sym, 0xffffffff) ^ 0xffffffff; |
410 | 407 | ||
411 | sym = expansion_trail; | 408 | sym = expansion_trail; |
412 | while (sym != (struct symbol *)-1L) { | 409 | while (sym != (struct symbol *)-1L) { |
@@ -464,6 +461,7 @@ static void genksyms_usage(void) | |||
464 | 461 | ||
465 | int main(int argc, char **argv) | 462 | int main(int argc, char **argv) |
466 | { | 463 | { |
464 | FILE *dumpfile = NULL; | ||
467 | int o; | 465 | int o; |
468 | 466 | ||
469 | #ifdef __GNU_LIBRARY__ | 467 | #ifdef __GNU_LIBRARY__ |
@@ -473,15 +471,16 @@ int main(int argc, char **argv) | |||
473 | {"warnings", 0, 0, 'w'}, | 471 | {"warnings", 0, 0, 'w'}, |
474 | {"quiet", 0, 0, 'q'}, | 472 | {"quiet", 0, 0, 'q'}, |
475 | {"dump", 0, 0, 'D'}, | 473 | {"dump", 0, 0, 'D'}, |
474 | {"dump-types", 1, 0, 'T'}, | ||
476 | {"version", 0, 0, 'V'}, | 475 | {"version", 0, 0, 'V'}, |
477 | {"help", 0, 0, 'h'}, | 476 | {"help", 0, 0, 'h'}, |
478 | {0, 0, 0, 0} | 477 | {0, 0, 0, 0} |
479 | }; | 478 | }; |
480 | 479 | ||
481 | while ((o = getopt_long(argc, argv, "a:dwqVDk:p:", | 480 | while ((o = getopt_long(argc, argv, "a:dwqVDT:k:p:", |
482 | &long_opts[0], NULL)) != EOF) | 481 | &long_opts[0], NULL)) != EOF) |
483 | #else /* __GNU_LIBRARY__ */ | 482 | #else /* __GNU_LIBRARY__ */ |
484 | while ((o = getopt(argc, argv, "a:dwqVDk:p:")) != EOF) | 483 | while ((o = getopt(argc, argv, "a:dwqVDT:k:p:")) != EOF) |
485 | #endif /* __GNU_LIBRARY__ */ | 484 | #endif /* __GNU_LIBRARY__ */ |
486 | switch (o) { | 485 | switch (o) { |
487 | case 'a': | 486 | case 'a': |
@@ -502,6 +501,14 @@ int main(int argc, char **argv) | |||
502 | case 'D': | 501 | case 'D': |
503 | flag_dump_defs = 1; | 502 | flag_dump_defs = 1; |
504 | break; | 503 | break; |
504 | case 'T': | ||
505 | flag_dump_types = 1; | ||
506 | dumpfile = fopen(optarg, "w"); | ||
507 | if (!dumpfile) { | ||
508 | perror(optarg); | ||
509 | return 1; | ||
510 | } | ||
511 | break; | ||
505 | case 'h': | 512 | case 'h': |
506 | genksyms_usage(); | 513 | genksyms_usage(); |
507 | return 0; | 514 | return 0; |
@@ -524,6 +531,24 @@ int main(int argc, char **argv) | |||
524 | 531 | ||
525 | yyparse(); | 532 | yyparse(); |
526 | 533 | ||
534 | if (flag_dump_types && visited_symbols) { | ||
535 | while (visited_symbols != (struct symbol *)-1L) { | ||
536 | struct symbol *sym = visited_symbols; | ||
537 | |||
538 | if (sym->type != SYM_NORMAL) { | ||
539 | putc(symbol_type_name[sym->type][0], dumpfile); | ||
540 | putc('#', dumpfile); | ||
541 | } | ||
542 | fputs(sym->name, dumpfile); | ||
543 | putc(' ', dumpfile); | ||
544 | print_list(dumpfile, sym->defn); | ||
545 | putc('\n', dumpfile); | ||
546 | |||
547 | visited_symbols = sym->visited; | ||
548 | sym->visited = NULL; | ||
549 | } | ||
550 | } | ||
551 | |||
527 | if (flag_debug) { | 552 | if (flag_debug) { |
528 | fprintf(debugfile, "Hash table occupancy %d/%d = %g\n", | 553 | fprintf(debugfile, "Hash table occupancy %d/%d = %g\n", |
529 | nsyms, HASH_BUCKETS, | 554 | nsyms, HASH_BUCKETS, |
diff --git a/scripts/genksyms/genksyms.h b/scripts/genksyms/genksyms.h index ab6f34f38735..2668287aa498 100644 --- a/scripts/genksyms/genksyms.h +++ b/scripts/genksyms/genksyms.h | |||
@@ -41,6 +41,7 @@ struct symbol { | |||
41 | enum symbol_type type; | 41 | enum symbol_type type; |
42 | struct string_list *defn; | 42 | struct string_list *defn; |
43 | struct symbol *expansion_trail; | 43 | struct symbol *expansion_trail; |
44 | struct symbol *visited; | ||
44 | int is_extern; | 45 | int is_extern; |
45 | }; | 46 | }; |
46 | 47 | ||
diff --git a/scripts/genksyms/lex.c_shipped b/scripts/genksyms/lex.c_shipped index 1218053ee960..37ba98241b96 100644 --- a/scripts/genksyms/lex.c_shipped +++ b/scripts/genksyms/lex.c_shipped | |||
@@ -2023,7 +2023,7 @@ repeat: | |||
2023 | break; | 2023 | break; |
2024 | 2024 | ||
2025 | default: | 2025 | default: |
2026 | abort(); | 2026 | exit(1); |
2027 | } | 2027 | } |
2028 | fini: | 2028 | fini: |
2029 | 2029 | ||
diff --git a/scripts/genksyms/lex.l b/scripts/genksyms/lex.l index fe0dfeedf0ff..5e544a06678b 100644 --- a/scripts/genksyms/lex.l +++ b/scripts/genksyms/lex.l | |||
@@ -392,7 +392,7 @@ repeat: | |||
392 | break; | 392 | break; |
393 | 393 | ||
394 | default: | 394 | default: |
395 | abort(); | 395 | exit(1); |
396 | } | 396 | } |
397 | fini: | 397 | fini: |
398 | 398 | ||
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 8012d1076876..4dcb8867b5f4 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -539,6 +539,7 @@ int main(int ac, char **av) | |||
539 | name = av[i]; | 539 | name = av[i]; |
540 | if (!name) { | 540 | if (!name) { |
541 | printf(_("%s: Kconfig file missing\n"), av[0]); | 541 | printf(_("%s: Kconfig file missing\n"), av[0]); |
542 | exit(1); | ||
542 | } | 543 | } |
543 | conf_parse(name); | 544 | conf_parse(name); |
544 | //zconfdump(stdout); | 545 | //zconfdump(stdout); |
@@ -573,7 +574,7 @@ int main(int ac, char **av) | |||
573 | case set_random: | 574 | case set_random: |
574 | name = getenv("KCONFIG_ALLCONFIG"); | 575 | name = getenv("KCONFIG_ALLCONFIG"); |
575 | if (name && !stat(name, &tmpstat)) { | 576 | if (name && !stat(name, &tmpstat)) { |
576 | conf_read_simple(name); | 577 | conf_read_simple(name, S_DEF_USER); |
577 | break; | 578 | break; |
578 | } | 579 | } |
579 | switch (input_mode) { | 580 | switch (input_mode) { |
@@ -584,9 +585,9 @@ int main(int ac, char **av) | |||
584 | default: break; | 585 | default: break; |
585 | } | 586 | } |
586 | if (!stat(name, &tmpstat)) | 587 | if (!stat(name, &tmpstat)) |
587 | conf_read_simple(name); | 588 | conf_read_simple(name, S_DEF_USER); |
588 | else if (!stat("all.config", &tmpstat)) | 589 | else if (!stat("all.config", &tmpstat)) |
589 | conf_read_simple("all.config"); | 590 | conf_read_simple("all.config", S_DEF_USER); |
590 | break; | 591 | break; |
591 | default: | 592 | default: |
592 | break; | 593 | break; |
@@ -599,7 +600,15 @@ int main(int ac, char **av) | |||
599 | input_mode = ask_silent; | 600 | input_mode = ask_silent; |
600 | valid_stdin = 1; | 601 | valid_stdin = 1; |
601 | } | 602 | } |
602 | } | 603 | } else if (sym_change_count) { |
604 | name = getenv("KCONFIG_NOSILENTUPDATE"); | ||
605 | if (name && *name) { | ||
606 | fprintf(stderr, _("\n*** Kernel configuration requires explicit update.\n\n")); | ||
607 | return 1; | ||
608 | } | ||
609 | } else | ||
610 | goto skip_check; | ||
611 | |||
603 | do { | 612 | do { |
604 | conf_cnt = 0; | 613 | conf_cnt = 0; |
605 | check_conf(&rootmenu); | 614 | check_conf(&rootmenu); |
@@ -608,5 +617,11 @@ int main(int ac, char **av) | |||
608 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | 617 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); |
609 | return 1; | 618 | return 1; |
610 | } | 619 | } |
620 | skip_check: | ||
621 | if (input_mode == ask_silent && conf_write_autoconf()) { | ||
622 | fprintf(stderr, _("\n*** Error during writing of the kernel configuration.\n\n")); | ||
623 | return 1; | ||
624 | } | ||
625 | |||
611 | return 0; | 626 | return 0; |
612 | } | 627 | } |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 1b5df589f3ae..2ee48c377b66 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 <fcntl.h> | ||
8 | #include <stdio.h> | 9 | #include <stdio.h> |
9 | #include <stdlib.h> | 10 | #include <stdlib.h> |
10 | #include <string.h> | 11 | #include <string.h> |
@@ -20,19 +21,8 @@ static void conf_warning(const char *fmt, ...) | |||
20 | static const char *conf_filename; | 21 | static const char *conf_filename; |
21 | static int conf_lineno, conf_warnings, conf_unsaved; | 22 | static int conf_lineno, conf_warnings, conf_unsaved; |
22 | 23 | ||
23 | const char conf_def_filename[] = ".config"; | ||
24 | |||
25 | const char conf_defname[] = "arch/$ARCH/defconfig"; | 24 | const char conf_defname[] = "arch/$ARCH/defconfig"; |
26 | 25 | ||
27 | const char *conf_confnames[] = { | ||
28 | ".config", | ||
29 | "/lib/modules/$UNAME_RELEASE/.config", | ||
30 | "/etc/kernel-config", | ||
31 | "/boot/config-$UNAME_RELEASE", | ||
32 | conf_defname, | ||
33 | NULL, | ||
34 | }; | ||
35 | |||
36 | static void conf_warning(const char *fmt, ...) | 26 | static void conf_warning(const char *fmt, ...) |
37 | { | 27 | { |
38 | va_list ap; | 28 | va_list ap; |
@@ -44,6 +34,13 @@ static void conf_warning(const char *fmt, ...) | |||
44 | conf_warnings++; | 34 | conf_warnings++; |
45 | } | 35 | } |
46 | 36 | ||
37 | const char *conf_get_configname(void) | ||
38 | { | ||
39 | char *name = getenv("KCONFIG_CONFIG"); | ||
40 | |||
41 | return name ? name : ".config"; | ||
42 | } | ||
43 | |||
47 | static char *conf_expand_value(const char *in) | 44 | static char *conf_expand_value(const char *in) |
48 | { | 45 | { |
49 | struct symbol *sym; | 46 | struct symbol *sym; |
@@ -86,51 +83,65 @@ char *conf_get_default_confname(void) | |||
86 | return name; | 83 | return name; |
87 | } | 84 | } |
88 | 85 | ||
89 | int conf_read_simple(const char *name) | 86 | int conf_read_simple(const char *name, int def) |
90 | { | 87 | { |
91 | FILE *in = NULL; | 88 | FILE *in = NULL; |
92 | char line[1024]; | 89 | char line[1024]; |
93 | char *p, *p2; | 90 | char *p, *p2; |
94 | struct symbol *sym; | 91 | struct symbol *sym; |
95 | int i; | 92 | int i, def_flags; |
96 | 93 | ||
97 | if (name) { | 94 | if (name) { |
98 | in = zconf_fopen(name); | 95 | in = zconf_fopen(name); |
99 | } else { | 96 | } else { |
100 | const char **names = conf_confnames; | 97 | struct property *prop; |
101 | while ((name = *names++)) { | 98 | |
102 | name = conf_expand_value(name); | 99 | name = conf_get_configname(); |
100 | in = zconf_fopen(name); | ||
101 | if (in) | ||
102 | goto load; | ||
103 | sym_change_count++; | ||
104 | if (!sym_defconfig_list) | ||
105 | return 1; | ||
106 | |||
107 | for_all_defaults(sym_defconfig_list, prop) { | ||
108 | if (expr_calc_value(prop->visible.expr) == no || | ||
109 | prop->expr->type != E_SYMBOL) | ||
110 | continue; | ||
111 | name = conf_expand_value(prop->expr->left.sym->name); | ||
103 | in = zconf_fopen(name); | 112 | in = zconf_fopen(name); |
104 | if (in) { | 113 | if (in) { |
105 | printf(_("#\n" | 114 | printf(_("#\n" |
106 | "# using defaults found in %s\n" | 115 | "# using defaults found in %s\n" |
107 | "#\n"), name); | 116 | "#\n"), name); |
108 | break; | 117 | goto load; |
109 | } | 118 | } |
110 | } | 119 | } |
111 | } | 120 | } |
112 | if (!in) | 121 | if (!in) |
113 | return 1; | 122 | return 1; |
114 | 123 | ||
124 | load: | ||
115 | conf_filename = name; | 125 | conf_filename = name; |
116 | conf_lineno = 0; | 126 | conf_lineno = 0; |
117 | conf_warnings = 0; | 127 | conf_warnings = 0; |
118 | conf_unsaved = 0; | 128 | conf_unsaved = 0; |
119 | 129 | ||
130 | def_flags = SYMBOL_DEF << def; | ||
120 | for_all_symbols(i, sym) { | 131 | for_all_symbols(i, sym) { |
121 | sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED; | 132 | sym->flags |= SYMBOL_CHANGED; |
133 | sym->flags &= ~(def_flags|SYMBOL_VALID); | ||
122 | if (sym_is_choice(sym)) | 134 | if (sym_is_choice(sym)) |
123 | sym->flags &= ~SYMBOL_NEW; | 135 | sym->flags |= def_flags; |
124 | sym->flags &= ~SYMBOL_VALID; | ||
125 | switch (sym->type) { | 136 | switch (sym->type) { |
126 | case S_INT: | 137 | case S_INT: |
127 | case S_HEX: | 138 | case S_HEX: |
128 | case S_STRING: | 139 | case S_STRING: |
129 | if (sym->user.val) | 140 | if (sym->def[def].val) |
130 | free(sym->user.val); | 141 | free(sym->def[def].val); |
131 | default: | 142 | default: |
132 | sym->user.val = NULL; | 143 | sym->def[def].val = NULL; |
133 | sym->user.tri = no; | 144 | sym->def[def].tri = no; |
134 | } | 145 | } |
135 | } | 146 | } |
136 | 147 | ||
@@ -147,19 +158,26 @@ int conf_read_simple(const char *name) | |||
147 | *p++ = 0; | 158 | *p++ = 0; |
148 | if (strncmp(p, "is not set", 10)) | 159 | if (strncmp(p, "is not set", 10)) |
149 | continue; | 160 | continue; |
150 | sym = sym_find(line + 9); | 161 | if (def == S_DEF_USER) { |
151 | if (!sym) { | 162 | sym = sym_find(line + 9); |
152 | conf_warning("trying to assign nonexistent symbol %s", line + 9); | 163 | if (!sym) { |
153 | break; | 164 | conf_warning("trying to assign nonexistent symbol %s", line + 9); |
154 | } else if (!(sym->flags & SYMBOL_NEW)) { | 165 | break; |
166 | } | ||
167 | } else { | ||
168 | sym = sym_lookup(line + 9, 0); | ||
169 | if (sym->type == S_UNKNOWN) | ||
170 | sym->type = S_BOOLEAN; | ||
171 | } | ||
172 | if (sym->flags & def_flags) { | ||
155 | conf_warning("trying to reassign symbol %s", sym->name); | 173 | conf_warning("trying to reassign symbol %s", sym->name); |
156 | break; | 174 | break; |
157 | } | 175 | } |
158 | switch (sym->type) { | 176 | switch (sym->type) { |
159 | case S_BOOLEAN: | 177 | case S_BOOLEAN: |
160 | case S_TRISTATE: | 178 | case S_TRISTATE: |
161 | sym->user.tri = no; | 179 | sym->def[def].tri = no; |
162 | sym->flags &= ~SYMBOL_NEW; | 180 | sym->flags |= def_flags; |
163 | break; | 181 | break; |
164 | default: | 182 | default: |
165 | ; | 183 | ; |
@@ -177,34 +195,48 @@ int conf_read_simple(const char *name) | |||
177 | p2 = strchr(p, '\n'); | 195 | p2 = strchr(p, '\n'); |
178 | if (p2) | 196 | if (p2) |
179 | *p2 = 0; | 197 | *p2 = 0; |
180 | sym = sym_find(line + 7); | 198 | if (def == S_DEF_USER) { |
181 | if (!sym) { | 199 | sym = sym_find(line + 7); |
182 | conf_warning("trying to assign nonexistent symbol %s", line + 7); | 200 | if (!sym) { |
183 | break; | 201 | conf_warning("trying to assign nonexistent symbol %s", line + 7); |
184 | } else if (!(sym->flags & SYMBOL_NEW)) { | 202 | break; |
203 | } | ||
204 | } else { | ||
205 | sym = sym_lookup(line + 7, 0); | ||
206 | if (sym->type == S_UNKNOWN) | ||
207 | sym->type = S_OTHER; | ||
208 | } | ||
209 | if (sym->flags & def_flags) { | ||
185 | conf_warning("trying to reassign symbol %s", sym->name); | 210 | conf_warning("trying to reassign symbol %s", sym->name); |
186 | break; | 211 | break; |
187 | } | 212 | } |
188 | switch (sym->type) { | 213 | switch (sym->type) { |
189 | case S_TRISTATE: | 214 | case S_TRISTATE: |
190 | if (p[0] == 'm') { | 215 | if (p[0] == 'm') { |
191 | sym->user.tri = mod; | 216 | sym->def[def].tri = mod; |
192 | sym->flags &= ~SYMBOL_NEW; | 217 | sym->flags |= def_flags; |
193 | break; | 218 | break; |
194 | } | 219 | } |
195 | case S_BOOLEAN: | 220 | case S_BOOLEAN: |
196 | if (p[0] == 'y') { | 221 | if (p[0] == 'y') { |
197 | sym->user.tri = yes; | 222 | sym->def[def].tri = yes; |
198 | sym->flags &= ~SYMBOL_NEW; | 223 | sym->flags |= def_flags; |
199 | break; | 224 | break; |
200 | } | 225 | } |
201 | if (p[0] == 'n') { | 226 | if (p[0] == 'n') { |
202 | sym->user.tri = no; | 227 | sym->def[def].tri = no; |
203 | sym->flags &= ~SYMBOL_NEW; | 228 | sym->flags |= def_flags; |
204 | break; | 229 | break; |
205 | } | 230 | } |
206 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | 231 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); |
207 | break; | 232 | break; |
233 | case S_OTHER: | ||
234 | if (*p != '"') { | ||
235 | for (p2 = p; *p2 && !isspace(*p2); p2++) | ||
236 | ; | ||
237 | sym->type = S_STRING; | ||
238 | goto done; | ||
239 | } | ||
208 | case S_STRING: | 240 | case S_STRING: |
209 | if (*p++ != '"') | 241 | if (*p++ != '"') |
210 | break; | 242 | break; |
@@ -221,9 +253,10 @@ int conf_read_simple(const char *name) | |||
221 | } | 253 | } |
222 | case S_INT: | 254 | case S_INT: |
223 | case S_HEX: | 255 | case S_HEX: |
256 | done: | ||
224 | if (sym_string_valid(sym, p)) { | 257 | if (sym_string_valid(sym, p)) { |
225 | sym->user.val = strdup(p); | 258 | sym->def[def].val = strdup(p); |
226 | sym->flags &= ~SYMBOL_NEW; | 259 | sym->flags |= def_flags; |
227 | } else { | 260 | } else { |
228 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | 261 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); |
229 | continue; | 262 | continue; |
@@ -241,24 +274,24 @@ int conf_read_simple(const char *name) | |||
241 | } | 274 | } |
242 | if (sym && sym_is_choice_value(sym)) { | 275 | if (sym && sym_is_choice_value(sym)) { |
243 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); | 276 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); |
244 | switch (sym->user.tri) { | 277 | switch (sym->def[def].tri) { |
245 | case no: | 278 | case no: |
246 | break; | 279 | break; |
247 | case mod: | 280 | case mod: |
248 | if (cs->user.tri == yes) { | 281 | if (cs->def[def].tri == yes) { |
249 | conf_warning("%s creates inconsistent choice state", sym->name); | 282 | conf_warning("%s creates inconsistent choice state", sym->name); |
250 | cs->flags |= SYMBOL_NEW; | 283 | cs->flags &= ~def_flags; |
251 | } | 284 | } |
252 | break; | 285 | break; |
253 | case yes: | 286 | case yes: |
254 | if (cs->user.tri != no) { | 287 | if (cs->def[def].tri != no) { |
255 | conf_warning("%s creates inconsistent choice state", sym->name); | 288 | conf_warning("%s creates inconsistent choice state", sym->name); |
256 | cs->flags |= SYMBOL_NEW; | 289 | cs->flags &= ~def_flags; |
257 | } else | 290 | } else |
258 | cs->user.val = sym; | 291 | cs->def[def].val = sym; |
259 | break; | 292 | break; |
260 | } | 293 | } |
261 | cs->user.tri = E_OR(cs->user.tri, sym->user.tri); | 294 | cs->def[def].tri = E_OR(cs->def[def].tri, sym->def[def].tri); |
262 | } | 295 | } |
263 | } | 296 | } |
264 | fclose(in); | 297 | fclose(in); |
@@ -273,9 +306,11 @@ int conf_read(const char *name) | |||
273 | struct symbol *sym; | 306 | struct symbol *sym; |
274 | struct property *prop; | 307 | struct property *prop; |
275 | struct expr *e; | 308 | struct expr *e; |
276 | int i; | 309 | int i, flags; |
310 | |||
311 | sym_change_count = 0; | ||
277 | 312 | ||
278 | if (conf_read_simple(name)) | 313 | if (conf_read_simple(name, S_DEF_USER)) |
279 | return 1; | 314 | return 1; |
280 | 315 | ||
281 | for_all_symbols(i, sym) { | 316 | for_all_symbols(i, sym) { |
@@ -287,12 +322,12 @@ int conf_read(const char *name) | |||
287 | switch (sym->type) { | 322 | switch (sym->type) { |
288 | case S_BOOLEAN: | 323 | case S_BOOLEAN: |
289 | case S_TRISTATE: | 324 | case S_TRISTATE: |
290 | if (sym->user.tri != sym_get_tristate_value(sym)) | 325 | if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) |
291 | break; | 326 | break; |
292 | if (!sym_is_choice(sym)) | 327 | if (!sym_is_choice(sym)) |
293 | goto sym_ok; | 328 | goto sym_ok; |
294 | default: | 329 | default: |
295 | if (!strcmp(sym->curr.val, sym->user.val)) | 330 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) |
296 | goto sym_ok; | 331 | goto sym_ok; |
297 | break; | 332 | break; |
298 | } | 333 | } |
@@ -304,15 +339,13 @@ int conf_read(const char *name) | |||
304 | sym_ok: | 339 | sym_ok: |
305 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { | 340 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { |
306 | if (sym->visible == no) | 341 | if (sym->visible == no) |
307 | sym->flags |= SYMBOL_NEW; | 342 | sym->flags &= ~SYMBOL_DEF_USER; |
308 | switch (sym->type) { | 343 | switch (sym->type) { |
309 | case S_STRING: | 344 | case S_STRING: |
310 | case S_INT: | 345 | case S_INT: |
311 | case S_HEX: | 346 | case S_HEX: |
312 | if (!sym_string_within_range(sym, sym->user.val)) { | 347 | if (!sym_string_within_range(sym, sym->def[S_DEF_USER].val)) |
313 | sym->flags |= SYMBOL_NEW; | 348 | sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER); |
314 | sym->flags &= ~SYMBOL_VALID; | ||
315 | } | ||
316 | default: | 349 | default: |
317 | break; | 350 | break; |
318 | } | 351 | } |
@@ -320,19 +353,21 @@ int conf_read(const char *name) | |||
320 | if (!sym_is_choice(sym)) | 353 | if (!sym_is_choice(sym)) |
321 | continue; | 354 | continue; |
322 | prop = sym_get_choice_prop(sym); | 355 | prop = sym_get_choice_prop(sym); |
356 | flags = sym->flags; | ||
323 | for (e = prop->expr; e; e = e->left.expr) | 357 | for (e = prop->expr; e; e = e->left.expr) |
324 | if (e->right.sym->visible != no) | 358 | if (e->right.sym->visible != no) |
325 | sym->flags |= e->right.sym->flags & SYMBOL_NEW; | 359 | flags &= e->right.sym->flags; |
360 | sym->flags |= flags & SYMBOL_DEF_USER; | ||
326 | } | 361 | } |
327 | 362 | ||
328 | sym_change_count = conf_warnings || conf_unsaved; | 363 | sym_change_count += conf_warnings || conf_unsaved; |
329 | 364 | ||
330 | return 0; | 365 | return 0; |
331 | } | 366 | } |
332 | 367 | ||
333 | int conf_write(const char *name) | 368 | int conf_write(const char *name) |
334 | { | 369 | { |
335 | FILE *out, *out_h; | 370 | FILE *out; |
336 | struct symbol *sym; | 371 | struct symbol *sym; |
337 | struct menu *menu; | 372 | struct menu *menu; |
338 | const char *basename; | 373 | const char *basename; |
@@ -351,7 +386,7 @@ int conf_write(const char *name) | |||
351 | if (!stat(name, &st) && S_ISDIR(st.st_mode)) { | 386 | if (!stat(name, &st) && S_ISDIR(st.st_mode)) { |
352 | strcpy(dirname, name); | 387 | strcpy(dirname, name); |
353 | strcat(dirname, "/"); | 388 | strcat(dirname, "/"); |
354 | basename = conf_def_filename; | 389 | basename = conf_get_configname(); |
355 | } else if ((slash = strrchr(name, '/'))) { | 390 | } else if ((slash = strrchr(name, '/'))) { |
356 | int size = slash - name + 1; | 391 | int size = slash - name + 1; |
357 | memcpy(dirname, name, size); | 392 | memcpy(dirname, name, size); |
@@ -359,23 +394,24 @@ int conf_write(const char *name) | |||
359 | if (slash[1]) | 394 | if (slash[1]) |
360 | basename = slash + 1; | 395 | basename = slash + 1; |
361 | else | 396 | else |
362 | basename = conf_def_filename; | 397 | basename = conf_get_configname(); |
363 | } else | 398 | } else |
364 | basename = name; | 399 | basename = name; |
365 | } else | 400 | } else |
366 | basename = conf_def_filename; | 401 | basename = conf_get_configname(); |
367 | 402 | ||
368 | sprintf(newname, "%s.tmpconfig.%d", dirname, (int)getpid()); | 403 | sprintf(newname, "%s%s", dirname, basename); |
369 | out = fopen(newname, "w"); | 404 | env = getenv("KCONFIG_OVERWRITECONFIG"); |
405 | if (!env || !*env) { | ||
406 | sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid()); | ||
407 | out = fopen(tmpname, "w"); | ||
408 | } else { | ||
409 | *tmpname = 0; | ||
410 | out = fopen(newname, "w"); | ||
411 | } | ||
370 | if (!out) | 412 | if (!out) |
371 | return 1; | 413 | return 1; |
372 | out_h = NULL; | 414 | |
373 | if (!name) { | ||
374 | out_h = fopen(".tmpconfig.h", "w"); | ||
375 | if (!out_h) | ||
376 | return 1; | ||
377 | file_write_dep(NULL); | ||
378 | } | ||
379 | sym = sym_lookup("KERNELVERSION", 0); | 415 | sym = sym_lookup("KERNELVERSION", 0); |
380 | sym_calc_value(sym); | 416 | sym_calc_value(sym); |
381 | time(&now); | 417 | time(&now); |
@@ -391,16 +427,6 @@ int conf_write(const char *name) | |||
391 | sym_get_string_value(sym), | 427 | sym_get_string_value(sym), |
392 | use_timestamp ? "# " : "", | 428 | use_timestamp ? "# " : "", |
393 | use_timestamp ? ctime(&now) : ""); | 429 | use_timestamp ? ctime(&now) : ""); |
394 | if (out_h) | ||
395 | fprintf(out_h, "/*\n" | ||
396 | " * Automatically generated C config: don't edit\n" | ||
397 | " * Linux kernel version: %s\n" | ||
398 | "%s%s" | ||
399 | " */\n" | ||
400 | "#define AUTOCONF_INCLUDED\n", | ||
401 | sym_get_string_value(sym), | ||
402 | use_timestamp ? " * " : "", | ||
403 | use_timestamp ? ctime(&now) : ""); | ||
404 | 430 | ||
405 | if (!sym_change_count) | 431 | if (!sym_change_count) |
406 | sym_clear_all_valid(); | 432 | sym_clear_all_valid(); |
@@ -416,11 +442,6 @@ int conf_write(const char *name) | |||
416 | "#\n" | 442 | "#\n" |
417 | "# %s\n" | 443 | "# %s\n" |
418 | "#\n", str); | 444 | "#\n", str); |
419 | if (out_h) | ||
420 | fprintf(out_h, "\n" | ||
421 | "/*\n" | ||
422 | " * %s\n" | ||
423 | " */\n", str); | ||
424 | } else if (!(sym->flags & SYMBOL_CHOICE)) { | 445 | } else if (!(sym->flags & SYMBOL_CHOICE)) { |
425 | sym_calc_value(sym); | 446 | sym_calc_value(sym); |
426 | if (!(sym->flags & SYMBOL_WRITE)) | 447 | if (!(sym->flags & SYMBOL_WRITE)) |
@@ -438,59 +459,39 @@ int conf_write(const char *name) | |||
438 | switch (sym_get_tristate_value(sym)) { | 459 | switch (sym_get_tristate_value(sym)) { |
439 | case no: | 460 | case no: |
440 | fprintf(out, "# CONFIG_%s is not set\n", sym->name); | 461 | fprintf(out, "# CONFIG_%s is not set\n", sym->name); |
441 | if (out_h) | ||
442 | fprintf(out_h, "#undef CONFIG_%s\n", sym->name); | ||
443 | break; | 462 | break; |
444 | case mod: | 463 | case mod: |
445 | fprintf(out, "CONFIG_%s=m\n", sym->name); | 464 | fprintf(out, "CONFIG_%s=m\n", sym->name); |
446 | if (out_h) | ||
447 | fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); | ||
448 | break; | 465 | break; |
449 | case yes: | 466 | case yes: |
450 | fprintf(out, "CONFIG_%s=y\n", sym->name); | 467 | fprintf(out, "CONFIG_%s=y\n", sym->name); |
451 | if (out_h) | ||
452 | fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); | ||
453 | break; | 468 | break; |
454 | } | 469 | } |
455 | break; | 470 | break; |
456 | case S_STRING: | 471 | case S_STRING: |
457 | // fix me | ||
458 | str = sym_get_string_value(sym); | 472 | str = sym_get_string_value(sym); |
459 | fprintf(out, "CONFIG_%s=\"", sym->name); | 473 | fprintf(out, "CONFIG_%s=\"", sym->name); |
460 | if (out_h) | 474 | while (1) { |
461 | fprintf(out_h, "#define CONFIG_%s \"", sym->name); | ||
462 | do { | ||
463 | l = strcspn(str, "\"\\"); | 475 | l = strcspn(str, "\"\\"); |
464 | if (l) { | 476 | if (l) { |
465 | fwrite(str, l, 1, out); | 477 | fwrite(str, l, 1, out); |
466 | if (out_h) | 478 | str += l; |
467 | fwrite(str, l, 1, out_h); | ||
468 | } | ||
469 | str += l; | ||
470 | while (*str == '\\' || *str == '"') { | ||
471 | fprintf(out, "\\%c", *str); | ||
472 | if (out_h) | ||
473 | fprintf(out_h, "\\%c", *str); | ||
474 | str++; | ||
475 | } | 479 | } |
476 | } while (*str); | 480 | if (!*str) |
481 | break; | ||
482 | fprintf(out, "\\%c", *str++); | ||
483 | } | ||
477 | fputs("\"\n", out); | 484 | fputs("\"\n", out); |
478 | if (out_h) | ||
479 | fputs("\"\n", out_h); | ||
480 | break; | 485 | break; |
481 | case S_HEX: | 486 | case S_HEX: |
482 | str = sym_get_string_value(sym); | 487 | str = sym_get_string_value(sym); |
483 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | 488 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { |
484 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | 489 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); |
485 | if (out_h) | ||
486 | fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); | ||
487 | break; | 490 | break; |
488 | } | 491 | } |
489 | case S_INT: | 492 | case S_INT: |
490 | str = sym_get_string_value(sym); | 493 | str = sym_get_string_value(sym); |
491 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | 494 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); |
492 | if (out_h) | ||
493 | fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); | ||
494 | break; | 495 | break; |
495 | } | 496 | } |
496 | } | 497 | } |
@@ -510,21 +511,253 @@ int conf_write(const char *name) | |||
510 | } | 511 | } |
511 | } | 512 | } |
512 | fclose(out); | 513 | fclose(out); |
513 | if (out_h) { | 514 | |
514 | fclose(out_h); | 515 | if (*tmpname) { |
515 | rename(".tmpconfig.h", "include/linux/autoconf.h"); | 516 | strcat(dirname, name ? name : conf_get_configname()); |
517 | strcat(dirname, ".old"); | ||
518 | rename(newname, dirname); | ||
519 | if (rename(tmpname, newname)) | ||
520 | return 1; | ||
516 | } | 521 | } |
517 | if (!name || basename != conf_def_filename) { | 522 | |
518 | if (!name) | 523 | printf(_("#\n" |
519 | name = conf_def_filename; | 524 | "# configuration written to %s\n" |
520 | sprintf(tmpname, "%s.old", name); | 525 | "#\n"), newname); |
521 | rename(name, tmpname); | 526 | |
527 | sym_change_count = 0; | ||
528 | |||
529 | return 0; | ||
530 | } | ||
531 | |||
532 | int conf_split_config(void) | ||
533 | { | ||
534 | char *name, path[128]; | ||
535 | char *s, *d, c; | ||
536 | struct symbol *sym; | ||
537 | struct stat sb; | ||
538 | int res, i, fd; | ||
539 | |||
540 | name = getenv("KCONFIG_AUTOCONFIG"); | ||
541 | if (!name) | ||
542 | name = "include/config/auto.conf"; | ||
543 | conf_read_simple(name, S_DEF_AUTO); | ||
544 | |||
545 | if (chdir("include/config")) | ||
546 | return 1; | ||
547 | |||
548 | res = 0; | ||
549 | for_all_symbols(i, sym) { | ||
550 | sym_calc_value(sym); | ||
551 | if ((sym->flags & SYMBOL_AUTO) || !sym->name) | ||
552 | continue; | ||
553 | if (sym->flags & SYMBOL_WRITE) { | ||
554 | if (sym->flags & SYMBOL_DEF_AUTO) { | ||
555 | /* | ||
556 | * symbol has old and new value, | ||
557 | * so compare them... | ||
558 | */ | ||
559 | switch (sym->type) { | ||
560 | case S_BOOLEAN: | ||
561 | case S_TRISTATE: | ||
562 | if (sym_get_tristate_value(sym) == | ||
563 | sym->def[S_DEF_AUTO].tri) | ||
564 | continue; | ||
565 | break; | ||
566 | case S_STRING: | ||
567 | case S_HEX: | ||
568 | case S_INT: | ||
569 | if (!strcmp(sym_get_string_value(sym), | ||
570 | sym->def[S_DEF_AUTO].val)) | ||
571 | continue; | ||
572 | break; | ||
573 | default: | ||
574 | break; | ||
575 | } | ||
576 | } else { | ||
577 | /* | ||
578 | * If there is no old value, only 'no' (unset) | ||
579 | * is allowed as new value. | ||
580 | */ | ||
581 | switch (sym->type) { | ||
582 | case S_BOOLEAN: | ||
583 | case S_TRISTATE: | ||
584 | if (sym_get_tristate_value(sym) == no) | ||
585 | continue; | ||
586 | break; | ||
587 | default: | ||
588 | break; | ||
589 | } | ||
590 | } | ||
591 | } else if (!(sym->flags & SYMBOL_DEF_AUTO)) | ||
592 | /* There is neither an old nor a new value. */ | ||
593 | continue; | ||
594 | /* else | ||
595 | * There is an old value, but no new value ('no' (unset) | ||
596 | * isn't saved in auto.conf, so the old value is always | ||
597 | * different from 'no'). | ||
598 | */ | ||
599 | |||
600 | /* Replace all '_' and append ".h" */ | ||
601 | s = sym->name; | ||
602 | d = path; | ||
603 | while ((c = *s++)) { | ||
604 | c = tolower(c); | ||
605 | *d++ = (c == '_') ? '/' : c; | ||
606 | } | ||
607 | strcpy(d, ".h"); | ||
608 | |||
609 | /* Assume directory path already exists. */ | ||
610 | fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); | ||
611 | if (fd == -1) { | ||
612 | if (errno != ENOENT) { | ||
613 | res = 1; | ||
614 | break; | ||
615 | } | ||
616 | /* | ||
617 | * Create directory components, | ||
618 | * unless they exist already. | ||
619 | */ | ||
620 | d = path; | ||
621 | while ((d = strchr(d, '/'))) { | ||
622 | *d = 0; | ||
623 | if (stat(path, &sb) && mkdir(path, 0755)) { | ||
624 | res = 1; | ||
625 | goto out; | ||
626 | } | ||
627 | *d++ = '/'; | ||
628 | } | ||
629 | /* Try it again. */ | ||
630 | fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); | ||
631 | if (fd == -1) { | ||
632 | res = 1; | ||
633 | break; | ||
634 | } | ||
635 | } | ||
636 | close(fd); | ||
522 | } | 637 | } |
523 | sprintf(tmpname, "%s%s", dirname, basename); | 638 | out: |
524 | if (rename(newname, tmpname)) | 639 | if (chdir("../..")) |
525 | return 1; | 640 | return 1; |
526 | 641 | ||
527 | sym_change_count = 0; | 642 | return res; |
643 | } | ||
644 | |||
645 | int conf_write_autoconf(void) | ||
646 | { | ||
647 | struct symbol *sym; | ||
648 | const char *str; | ||
649 | char *name; | ||
650 | FILE *out, *out_h; | ||
651 | time_t now; | ||
652 | int i, l; | ||
653 | |||
654 | sym_clear_all_valid(); | ||
655 | |||
656 | file_write_dep("include/config/auto.conf.cmd"); | ||
657 | |||
658 | if (conf_split_config()) | ||
659 | return 1; | ||
660 | |||
661 | out = fopen(".tmpconfig", "w"); | ||
662 | if (!out) | ||
663 | return 1; | ||
664 | |||
665 | out_h = fopen(".tmpconfig.h", "w"); | ||
666 | if (!out_h) { | ||
667 | fclose(out); | ||
668 | return 1; | ||
669 | } | ||
670 | |||
671 | sym = sym_lookup("KERNELVERSION", 0); | ||
672 | sym_calc_value(sym); | ||
673 | time(&now); | ||
674 | fprintf(out, "#\n" | ||
675 | "# Automatically generated make config: don't edit\n" | ||
676 | "# Linux kernel version: %s\n" | ||
677 | "# %s" | ||
678 | "#\n", | ||
679 | sym_get_string_value(sym), ctime(&now)); | ||
680 | fprintf(out_h, "/*\n" | ||
681 | " * Automatically generated C config: don't edit\n" | ||
682 | " * Linux kernel version: %s\n" | ||
683 | " * %s" | ||
684 | " */\n" | ||
685 | "#define AUTOCONF_INCLUDED\n", | ||
686 | sym_get_string_value(sym), ctime(&now)); | ||
687 | |||
688 | for_all_symbols(i, sym) { | ||
689 | sym_calc_value(sym); | ||
690 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) | ||
691 | continue; | ||
692 | switch (sym->type) { | ||
693 | case S_BOOLEAN: | ||
694 | case S_TRISTATE: | ||
695 | switch (sym_get_tristate_value(sym)) { | ||
696 | case no: | ||
697 | break; | ||
698 | case mod: | ||
699 | fprintf(out, "CONFIG_%s=m\n", sym->name); | ||
700 | fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); | ||
701 | break; | ||
702 | case yes: | ||
703 | fprintf(out, "CONFIG_%s=y\n", sym->name); | ||
704 | fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); | ||
705 | break; | ||
706 | } | ||
707 | break; | ||
708 | case S_STRING: | ||
709 | str = sym_get_string_value(sym); | ||
710 | fprintf(out, "CONFIG_%s=\"", sym->name); | ||
711 | fprintf(out_h, "#define CONFIG_%s \"", sym->name); | ||
712 | while (1) { | ||
713 | l = strcspn(str, "\"\\"); | ||
714 | if (l) { | ||
715 | fwrite(str, l, 1, out); | ||
716 | fwrite(str, l, 1, out_h); | ||
717 | str += l; | ||
718 | } | ||
719 | if (!*str) | ||
720 | break; | ||
721 | fprintf(out, "\\%c", *str); | ||
722 | fprintf(out_h, "\\%c", *str); | ||
723 | str++; | ||
724 | } | ||
725 | fputs("\"\n", out); | ||
726 | fputs("\"\n", out_h); | ||
727 | break; | ||
728 | case S_HEX: | ||
729 | str = sym_get_string_value(sym); | ||
730 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | ||
731 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | ||
732 | fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); | ||
733 | break; | ||
734 | } | ||
735 | case S_INT: | ||
736 | str = sym_get_string_value(sym); | ||
737 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | ||
738 | fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); | ||
739 | break; | ||
740 | default: | ||
741 | break; | ||
742 | } | ||
743 | } | ||
744 | fclose(out); | ||
745 | fclose(out_h); | ||
746 | |||
747 | name = getenv("KCONFIG_AUTOHEADER"); | ||
748 | if (!name) | ||
749 | name = "include/linux/autoconf.h"; | ||
750 | if (rename(".tmpconfig.h", name)) | ||
751 | return 1; | ||
752 | name = getenv("KCONFIG_AUTOCONFIG"); | ||
753 | if (!name) | ||
754 | name = "include/config/auto.conf"; | ||
755 | /* | ||
756 | * This must be the last step, kbuild has a dependency on auto.conf | ||
757 | * and this marks the successful completion of the previous steps. | ||
758 | */ | ||
759 | if (rename(".tmpconfig", name)) | ||
760 | return 1; | ||
528 | 761 | ||
529 | return 0; | 762 | return 0; |
530 | } | 763 | } |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 30e4f9d69c2f..6f98dbfe70cf 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -145,7 +145,8 @@ static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct e | |||
145 | return; | 145 | return; |
146 | } | 146 | } |
147 | if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && | 147 | if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && |
148 | e1->left.sym == e2->left.sym && (e1->left.sym->flags & (SYMBOL_YES|SYMBOL_NO))) | 148 | e1->left.sym == e2->left.sym && |
149 | (e1->left.sym == &symbol_yes || e1->left.sym == &symbol_no)) | ||
149 | return; | 150 | return; |
150 | if (!expr_eq(e1, e2)) | 151 | if (!expr_eq(e1, e2)) |
151 | return; | 152 | return; |
@@ -1012,73 +1013,73 @@ int expr_compare_type(enum expr_type t1, enum expr_type t2) | |||
1012 | #endif | 1013 | #endif |
1013 | } | 1014 | } |
1014 | 1015 | ||
1015 | void expr_print(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken) | 1016 | void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken) |
1016 | { | 1017 | { |
1017 | if (!e) { | 1018 | if (!e) { |
1018 | fn(data, "y"); | 1019 | fn(data, NULL, "y"); |
1019 | return; | 1020 | return; |
1020 | } | 1021 | } |
1021 | 1022 | ||
1022 | if (expr_compare_type(prevtoken, e->type) > 0) | 1023 | if (expr_compare_type(prevtoken, e->type) > 0) |
1023 | fn(data, "("); | 1024 | fn(data, NULL, "("); |
1024 | switch (e->type) { | 1025 | switch (e->type) { |
1025 | case E_SYMBOL: | 1026 | case E_SYMBOL: |
1026 | if (e->left.sym->name) | 1027 | if (e->left.sym->name) |
1027 | fn(data, e->left.sym->name); | 1028 | fn(data, e->left.sym, e->left.sym->name); |
1028 | else | 1029 | else |
1029 | fn(data, "<choice>"); | 1030 | fn(data, NULL, "<choice>"); |
1030 | break; | 1031 | break; |
1031 | case E_NOT: | 1032 | case E_NOT: |
1032 | fn(data, "!"); | 1033 | fn(data, NULL, "!"); |
1033 | expr_print(e->left.expr, fn, data, E_NOT); | 1034 | expr_print(e->left.expr, fn, data, E_NOT); |
1034 | break; | 1035 | break; |
1035 | case E_EQUAL: | 1036 | case E_EQUAL: |
1036 | fn(data, e->left.sym->name); | 1037 | fn(data, e->left.sym, e->left.sym->name); |
1037 | fn(data, "="); | 1038 | fn(data, NULL, "="); |
1038 | fn(data, e->right.sym->name); | 1039 | fn(data, e->right.sym, e->right.sym->name); |
1039 | break; | 1040 | break; |
1040 | case E_UNEQUAL: | 1041 | case E_UNEQUAL: |
1041 | fn(data, e->left.sym->name); | 1042 | fn(data, e->left.sym, e->left.sym->name); |
1042 | fn(data, "!="); | 1043 | fn(data, NULL, "!="); |
1043 | fn(data, e->right.sym->name); | 1044 | fn(data, e->right.sym, e->right.sym->name); |
1044 | break; | 1045 | break; |
1045 | case E_OR: | 1046 | case E_OR: |
1046 | expr_print(e->left.expr, fn, data, E_OR); | 1047 | expr_print(e->left.expr, fn, data, E_OR); |
1047 | fn(data, " || "); | 1048 | fn(data, NULL, " || "); |
1048 | expr_print(e->right.expr, fn, data, E_OR); | 1049 | expr_print(e->right.expr, fn, data, E_OR); |
1049 | break; | 1050 | break; |
1050 | case E_AND: | 1051 | case E_AND: |
1051 | expr_print(e->left.expr, fn, data, E_AND); | 1052 | expr_print(e->left.expr, fn, data, E_AND); |
1052 | fn(data, " && "); | 1053 | fn(data, NULL, " && "); |
1053 | expr_print(e->right.expr, fn, data, E_AND); | 1054 | expr_print(e->right.expr, fn, data, E_AND); |
1054 | break; | 1055 | break; |
1055 | case E_CHOICE: | 1056 | case E_CHOICE: |
1056 | fn(data, e->right.sym->name); | 1057 | fn(data, e->right.sym, e->right.sym->name); |
1057 | if (e->left.expr) { | 1058 | if (e->left.expr) { |
1058 | fn(data, " ^ "); | 1059 | fn(data, NULL, " ^ "); |
1059 | expr_print(e->left.expr, fn, data, E_CHOICE); | 1060 | expr_print(e->left.expr, fn, data, E_CHOICE); |
1060 | } | 1061 | } |
1061 | break; | 1062 | break; |
1062 | case E_RANGE: | 1063 | case E_RANGE: |
1063 | fn(data, "["); | 1064 | fn(data, NULL, "["); |
1064 | fn(data, e->left.sym->name); | 1065 | fn(data, e->left.sym, e->left.sym->name); |
1065 | fn(data, " "); | 1066 | fn(data, NULL, " "); |
1066 | fn(data, e->right.sym->name); | 1067 | fn(data, e->right.sym, e->right.sym->name); |
1067 | fn(data, "]"); | 1068 | fn(data, NULL, "]"); |
1068 | break; | 1069 | break; |
1069 | default: | 1070 | default: |
1070 | { | 1071 | { |
1071 | char buf[32]; | 1072 | char buf[32]; |
1072 | sprintf(buf, "<unknown type %d>", e->type); | 1073 | sprintf(buf, "<unknown type %d>", e->type); |
1073 | fn(data, buf); | 1074 | fn(data, NULL, buf); |
1074 | break; | 1075 | break; |
1075 | } | 1076 | } |
1076 | } | 1077 | } |
1077 | if (expr_compare_type(prevtoken, e->type) > 0) | 1078 | if (expr_compare_type(prevtoken, e->type) > 0) |
1078 | fn(data, ")"); | 1079 | fn(data, NULL, ")"); |
1079 | } | 1080 | } |
1080 | 1081 | ||
1081 | static void expr_print_file_helper(void *data, const char *str) | 1082 | static void expr_print_file_helper(void *data, struct symbol *sym, const char *str) |
1082 | { | 1083 | { |
1083 | fwrite(str, strlen(str), 1, data); | 1084 | fwrite(str, strlen(str), 1, data); |
1084 | } | 1085 | } |
@@ -1088,7 +1089,7 @@ void expr_fprint(struct expr *e, FILE *out) | |||
1088 | expr_print(e, expr_print_file_helper, out, E_NONE); | 1089 | expr_print(e, expr_print_file_helper, out, E_NONE); |
1089 | } | 1090 | } |
1090 | 1091 | ||
1091 | static void expr_print_gstr_helper(void *data, const char *str) | 1092 | static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str) |
1092 | { | 1093 | { |
1093 | str_append((struct gstr*)data, str); | 1094 | str_append((struct gstr*)data, str); |
1094 | } | 1095 | } |
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 1b36ef18c48d..6084525f604b 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -63,12 +63,18 @@ enum symbol_type { | |||
63 | S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER | 63 | S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER |
64 | }; | 64 | }; |
65 | 65 | ||
66 | enum { | ||
67 | S_DEF_USER, /* main user value */ | ||
68 | S_DEF_AUTO, | ||
69 | }; | ||
70 | |||
66 | struct symbol { | 71 | struct symbol { |
67 | struct symbol *next; | 72 | struct symbol *next; |
68 | char *name; | 73 | char *name; |
69 | char *help; | 74 | char *help; |
70 | enum symbol_type type; | 75 | enum symbol_type type; |
71 | struct symbol_value curr, user; | 76 | struct symbol_value curr; |
77 | struct symbol_value def[4]; | ||
72 | tristate visible; | 78 | tristate visible; |
73 | int flags; | 79 | int flags; |
74 | struct property *prop; | 80 | struct property *prop; |
@@ -78,10 +84,7 @@ struct symbol { | |||
78 | 84 | ||
79 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) | 85 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) |
80 | 86 | ||
81 | #define SYMBOL_YES 0x0001 | 87 | #define SYMBOL_CONST 0x0001 |
82 | #define SYMBOL_MOD 0x0002 | ||
83 | #define SYMBOL_NO 0x0004 | ||
84 | #define SYMBOL_CONST 0x0007 | ||
85 | #define SYMBOL_CHECK 0x0008 | 88 | #define SYMBOL_CHECK 0x0008 |
86 | #define SYMBOL_CHOICE 0x0010 | 89 | #define SYMBOL_CHOICE 0x0010 |
87 | #define SYMBOL_CHOICEVAL 0x0020 | 90 | #define SYMBOL_CHOICEVAL 0x0020 |
@@ -90,10 +93,14 @@ struct symbol { | |||
90 | #define SYMBOL_OPTIONAL 0x0100 | 93 | #define SYMBOL_OPTIONAL 0x0100 |
91 | #define SYMBOL_WRITE 0x0200 | 94 | #define SYMBOL_WRITE 0x0200 |
92 | #define SYMBOL_CHANGED 0x0400 | 95 | #define SYMBOL_CHANGED 0x0400 |
93 | #define SYMBOL_NEW 0x0800 | ||
94 | #define SYMBOL_AUTO 0x1000 | 96 | #define SYMBOL_AUTO 0x1000 |
95 | #define SYMBOL_CHECKED 0x2000 | 97 | #define SYMBOL_CHECKED 0x2000 |
96 | #define SYMBOL_WARNED 0x8000 | 98 | #define SYMBOL_WARNED 0x8000 |
99 | #define SYMBOL_DEF 0x10000 | ||
100 | #define SYMBOL_DEF_USER 0x10000 | ||
101 | #define SYMBOL_DEF_AUTO 0x20000 | ||
102 | #define SYMBOL_DEF3 0x40000 | ||
103 | #define SYMBOL_DEF4 0x80000 | ||
97 | 104 | ||
98 | #define SYMBOL_MAXLENGTH 256 | 105 | #define SYMBOL_MAXLENGTH 256 |
99 | #define SYMBOL_HASHSIZE 257 | 106 | #define SYMBOL_HASHSIZE 257 |
@@ -149,6 +156,7 @@ struct file *lookup_file(const char *name); | |||
149 | 156 | ||
150 | extern struct symbol symbol_yes, symbol_no, symbol_mod; | 157 | extern struct symbol symbol_yes, symbol_no, symbol_mod; |
151 | extern struct symbol *modules_sym; | 158 | extern struct symbol *modules_sym; |
159 | extern struct symbol *sym_defconfig_list; | ||
152 | extern int cdebug; | 160 | extern int cdebug; |
153 | struct expr *expr_alloc_symbol(struct symbol *sym); | 161 | struct expr *expr_alloc_symbol(struct symbol *sym); |
154 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); | 162 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index 665bd5300a19..7b0d3a93d5c0 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -114,12 +114,6 @@ const char *dbg_print_flags(int val) | |||
114 | 114 | ||
115 | bzero(buf, 256); | 115 | bzero(buf, 256); |
116 | 116 | ||
117 | if (val & SYMBOL_YES) | ||
118 | strcat(buf, "yes/"); | ||
119 | if (val & SYMBOL_MOD) | ||
120 | strcat(buf, "mod/"); | ||
121 | if (val & SYMBOL_NO) | ||
122 | strcat(buf, "no/"); | ||
123 | if (val & SYMBOL_CONST) | 117 | if (val & SYMBOL_CONST) |
124 | strcat(buf, "const/"); | 118 | strcat(buf, "const/"); |
125 | if (val & SYMBOL_CHECK) | 119 | if (val & SYMBOL_CHECK) |
@@ -138,8 +132,6 @@ const char *dbg_print_flags(int val) | |||
138 | strcat(buf, "write/"); | 132 | strcat(buf, "write/"); |
139 | if (val & SYMBOL_CHANGED) | 133 | if (val & SYMBOL_CHANGED) |
140 | strcat(buf, "changed/"); | 134 | strcat(buf, "changed/"); |
141 | if (val & SYMBOL_NEW) | ||
142 | strcat(buf, "new/"); | ||
143 | if (val & SYMBOL_AUTO) | 135 | if (val & SYMBOL_AUTO) |
144 | strcat(buf, "auto/"); | 136 | strcat(buf, "auto/"); |
145 | 137 | ||
@@ -1192,9 +1184,7 @@ static gchar **fill_row(struct menu *menu) | |||
1192 | 1184 | ||
1193 | row[COL_OPTION] = | 1185 | row[COL_OPTION] = |
1194 | g_strdup_printf("%s %s", menu_get_prompt(menu), | 1186 | g_strdup_printf("%s %s", menu_get_prompt(menu), |
1195 | sym ? (sym-> | 1187 | sym && sym_has_value(sym) ? "(NEW)" : ""); |
1196 | flags & SYMBOL_NEW ? "(NEW)" : "") : | ||
1197 | ""); | ||
1198 | 1188 | ||
1199 | if (show_all && !menu_is_visible(menu)) | 1189 | if (show_all && !menu_is_visible(menu)) |
1200 | row[COL_COLOR] = g_strdup("DarkGray"); | 1190 | row[COL_COLOR] = g_strdup("DarkGray"); |
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index 24e3c8cbb7ac..800f8c71c407 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped | |||
@@ -8,7 +8,7 @@ | |||
8 | #define FLEX_SCANNER | 8 | #define FLEX_SCANNER |
9 | #define YY_FLEX_MAJOR_VERSION 2 | 9 | #define YY_FLEX_MAJOR_VERSION 2 |
10 | #define YY_FLEX_MINOR_VERSION 5 | 10 | #define YY_FLEX_MINOR_VERSION 5 |
11 | #define YY_FLEX_SUBMINOR_VERSION 31 | 11 | #define YY_FLEX_SUBMINOR_VERSION 33 |
12 | #if YY_FLEX_SUBMINOR_VERSION > 0 | 12 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
13 | #define FLEX_BETA | 13 | #define FLEX_BETA |
14 | #endif | 14 | #endif |
@@ -30,7 +30,15 @@ | |||
30 | 30 | ||
31 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | 31 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ |
32 | 32 | ||
33 | #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | 33 | #if __STDC_VERSION__ >= 199901L |
34 | |||
35 | /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, | ||
36 | * if you want the limit (max/min) macros for int types. | ||
37 | */ | ||
38 | #ifndef __STDC_LIMIT_MACROS | ||
39 | #define __STDC_LIMIT_MACROS 1 | ||
40 | #endif | ||
41 | |||
34 | #include <inttypes.h> | 42 | #include <inttypes.h> |
35 | typedef int8_t flex_int8_t; | 43 | typedef int8_t flex_int8_t; |
36 | typedef uint8_t flex_uint8_t; | 44 | typedef uint8_t flex_uint8_t; |
@@ -134,6 +142,10 @@ typedef unsigned int flex_uint32_t; | |||
134 | #define YY_BUF_SIZE 16384 | 142 | #define YY_BUF_SIZE 16384 |
135 | #endif | 143 | #endif |
136 | 144 | ||
145 | /* The state buf must be large enough to hold one state per character in the main buffer. | ||
146 | */ | ||
147 | #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) | ||
148 | |||
137 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | 149 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE |
138 | #define YY_TYPEDEF_YY_BUFFER_STATE | 150 | #define YY_TYPEDEF_YY_BUFFER_STATE |
139 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | 151 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
@@ -267,7 +279,7 @@ int zconfleng; | |||
267 | 279 | ||
268 | /* Points to current character in buffer. */ | 280 | /* Points to current character in buffer. */ |
269 | static char *yy_c_buf_p = (char *) 0; | 281 | static char *yy_c_buf_p = (char *) 0; |
270 | static int yy_init = 1; /* whether we need to initialize */ | 282 | static int yy_init = 0; /* whether we need to initialize */ |
271 | static int yy_start = 0; /* start state number */ | 283 | static int yy_start = 0; /* start state number */ |
272 | 284 | ||
273 | /* Flag which is used to allow zconfwrap()'s to do buffer switches | 285 | /* Flag which is used to allow zconfwrap()'s to do buffer switches |
@@ -820,6 +832,8 @@ void alloc_string(const char *str, int size) | |||
820 | #define YY_EXTRA_TYPE void * | 832 | #define YY_EXTRA_TYPE void * |
821 | #endif | 833 | #endif |
822 | 834 | ||
835 | static int yy_init_globals (void ); | ||
836 | |||
823 | /* Macros after this point can all be overridden by user definitions in | 837 | /* Macros after this point can all be overridden by user definitions in |
824 | * section 1. | 838 | * section 1. |
825 | */ | 839 | */ |
@@ -942,9 +956,9 @@ YY_DECL | |||
942 | int str = 0; | 956 | int str = 0; |
943 | int ts, i; | 957 | int ts, i; |
944 | 958 | ||
945 | if ( (yy_init) ) | 959 | if ( !(yy_init) ) |
946 | { | 960 | { |
947 | (yy_init) = 0; | 961 | (yy_init) = 1; |
948 | 962 | ||
949 | #ifdef YY_USER_INIT | 963 | #ifdef YY_USER_INIT |
950 | YY_USER_INIT; | 964 | YY_USER_INIT; |
@@ -1452,7 +1466,7 @@ static int yy_get_next_buffer (void) | |||
1452 | 1466 | ||
1453 | else | 1467 | else |
1454 | { | 1468 | { |
1455 | size_t num_to_read = | 1469 | int num_to_read = |
1456 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | 1470 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; |
1457 | 1471 | ||
1458 | while ( num_to_read <= 0 ) | 1472 | while ( num_to_read <= 0 ) |
@@ -1969,16 +1983,16 @@ YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) | |||
1969 | 1983 | ||
1970 | /** Setup the input buffer state to scan a string. The next call to zconflex() will | 1984 | /** Setup the input buffer state to scan a string. The next call to zconflex() will |
1971 | * scan from a @e copy of @a str. | 1985 | * scan from a @e copy of @a str. |
1972 | * @param yy_str a NUL-terminated string to scan | 1986 | * @param yystr a NUL-terminated string to scan |
1973 | * | 1987 | * |
1974 | * @return the newly allocated buffer state object. | 1988 | * @return the newly allocated buffer state object. |
1975 | * @note If you want to scan bytes that may contain NUL values, then use | 1989 | * @note If you want to scan bytes that may contain NUL values, then use |
1976 | * zconf_scan_bytes() instead. | 1990 | * zconf_scan_bytes() instead. |
1977 | */ | 1991 | */ |
1978 | YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str ) | 1992 | YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr ) |
1979 | { | 1993 | { |
1980 | 1994 | ||
1981 | return zconf_scan_bytes(yy_str,strlen(yy_str) ); | 1995 | return zconf_scan_bytes(yystr,strlen(yystr) ); |
1982 | } | 1996 | } |
1983 | 1997 | ||
1984 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will | 1998 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will |
@@ -1988,7 +2002,7 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str ) | |||
1988 | * | 2002 | * |
1989 | * @return the newly allocated buffer state object. | 2003 | * @return the newly allocated buffer state object. |
1990 | */ | 2004 | */ |
1991 | YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len ) | 2005 | YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len ) |
1992 | { | 2006 | { |
1993 | YY_BUFFER_STATE b; | 2007 | YY_BUFFER_STATE b; |
1994 | char *buf; | 2008 | char *buf; |
@@ -1996,15 +2010,15 @@ YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len ) | |||
1996 | int i; | 2010 | int i; |
1997 | 2011 | ||
1998 | /* Get memory for full buffer, including space for trailing EOB's. */ | 2012 | /* Get memory for full buffer, including space for trailing EOB's. */ |
1999 | n = len + 2; | 2013 | n = _yybytes_len + 2; |
2000 | buf = (char *) zconfalloc(n ); | 2014 | buf = (char *) zconfalloc(n ); |
2001 | if ( ! buf ) | 2015 | if ( ! buf ) |
2002 | YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" ); | 2016 | YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" ); |
2003 | 2017 | ||
2004 | for ( i = 0; i < len; ++i ) | 2018 | for ( i = 0; i < _yybytes_len; ++i ) |
2005 | buf[i] = bytes[i]; | 2019 | buf[i] = yybytes[i]; |
2006 | 2020 | ||
2007 | buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; | 2021 | buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; |
2008 | 2022 | ||
2009 | b = zconf_scan_buffer(buf,n ); | 2023 | b = zconf_scan_buffer(buf,n ); |
2010 | if ( ! b ) | 2024 | if ( ! b ) |
@@ -2125,6 +2139,34 @@ void zconfset_debug (int bdebug ) | |||
2125 | zconf_flex_debug = bdebug ; | 2139 | zconf_flex_debug = bdebug ; |
2126 | } | 2140 | } |
2127 | 2141 | ||
2142 | static int yy_init_globals (void) | ||
2143 | { | ||
2144 | /* Initialization is the same as for the non-reentrant scanner. | ||
2145 | * This function is called from zconflex_destroy(), so don't allocate here. | ||
2146 | */ | ||
2147 | |||
2148 | (yy_buffer_stack) = 0; | ||
2149 | (yy_buffer_stack_top) = 0; | ||
2150 | (yy_buffer_stack_max) = 0; | ||
2151 | (yy_c_buf_p) = (char *) 0; | ||
2152 | (yy_init) = 0; | ||
2153 | (yy_start) = 0; | ||
2154 | |||
2155 | /* Defined in main.c */ | ||
2156 | #ifdef YY_STDINIT | ||
2157 | zconfin = stdin; | ||
2158 | zconfout = stdout; | ||
2159 | #else | ||
2160 | zconfin = (FILE *) 0; | ||
2161 | zconfout = (FILE *) 0; | ||
2162 | #endif | ||
2163 | |||
2164 | /* For future reference: Set errno on error, since we are called by | ||
2165 | * zconflex_init() | ||
2166 | */ | ||
2167 | return 0; | ||
2168 | } | ||
2169 | |||
2128 | /* zconflex_destroy is for both reentrant and non-reentrant scanners. */ | 2170 | /* zconflex_destroy is for both reentrant and non-reentrant scanners. */ |
2129 | int zconflex_destroy (void) | 2171 | int zconflex_destroy (void) |
2130 | { | 2172 | { |
@@ -2140,6 +2182,10 @@ int zconflex_destroy (void) | |||
2140 | zconffree((yy_buffer_stack) ); | 2182 | zconffree((yy_buffer_stack) ); |
2141 | (yy_buffer_stack) = NULL; | 2183 | (yy_buffer_stack) = NULL; |
2142 | 2184 | ||
2185 | /* Reset the globals. This is important in a non-reentrant scanner so the next time | ||
2186 | * zconflex() is called, initialization will occur. */ | ||
2187 | yy_init_globals( ); | ||
2188 | |||
2143 | return 0; | 2189 | return 0; |
2144 | } | 2190 | } |
2145 | 2191 | ||
@@ -2151,7 +2197,7 @@ int zconflex_destroy (void) | |||
2151 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | 2197 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) |
2152 | { | 2198 | { |
2153 | register int i; | 2199 | register int i; |
2154 | for ( i = 0; i < n; ++i ) | 2200 | for ( i = 0; i < n; ++i ) |
2155 | s1[i] = s2[i]; | 2201 | s1[i] = s2[i]; |
2156 | } | 2202 | } |
2157 | #endif | 2203 | #endif |
@@ -2160,7 +2206,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | |||
2160 | static int yy_flex_strlen (yyconst char * s ) | 2206 | static int yy_flex_strlen (yyconst char * s ) |
2161 | { | 2207 | { |
2162 | register int n; | 2208 | register int n; |
2163 | for ( n = 0; s[n]; ++n ) | 2209 | for ( n = 0; s[n]; ++n ) |
2164 | ; | 2210 | ; |
2165 | 2211 | ||
2166 | return n; | 2212 | return n; |
@@ -2191,19 +2237,6 @@ void zconffree (void * ptr ) | |||
2191 | 2237 | ||
2192 | #define YYTABLES_NAME "yytables" | 2238 | #define YYTABLES_NAME "yytables" |
2193 | 2239 | ||
2194 | #undef YY_NEW_FILE | ||
2195 | #undef YY_FLUSH_BUFFER | ||
2196 | #undef yy_set_bol | ||
2197 | #undef yy_new_buffer | ||
2198 | #undef yy_set_interactive | ||
2199 | #undef yytext_ptr | ||
2200 | #undef YY_DO_BEFORE_ACTION | ||
2201 | |||
2202 | #ifdef YY_DECL_IS_OURS | ||
2203 | #undef YY_DECL_IS_OURS | ||
2204 | #undef YY_DECL | ||
2205 | #endif | ||
2206 | |||
2207 | void zconf_starthelp(void) | 2240 | void zconf_starthelp(void) |
2208 | { | 2241 | { |
2209 | new_string(); | 2242 | new_string(); |
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 527f60c99c50..2628023a1fe1 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -40,6 +40,10 @@ extern "C" { | |||
40 | 40 | ||
41 | #define TF_COMMAND 0x0001 | 41 | #define TF_COMMAND 0x0001 |
42 | #define TF_PARAM 0x0002 | 42 | #define TF_PARAM 0x0002 |
43 | #define TF_OPTION 0x0004 | ||
44 | |||
45 | #define T_OPT_MODULES 1 | ||
46 | #define T_OPT_DEFCONFIG_LIST 2 | ||
43 | 47 | ||
44 | struct kconf_id { | 48 | struct kconf_id { |
45 | int name; | 49 | int name; |
@@ -60,8 +64,6 @@ int zconf_lineno(void); | |||
60 | char *zconf_curname(void); | 64 | char *zconf_curname(void); |
61 | 65 | ||
62 | /* confdata.c */ | 66 | /* confdata.c */ |
63 | extern const char conf_def_filename[]; | ||
64 | |||
65 | char *conf_get_default_confname(void); | 67 | char *conf_get_default_confname(void); |
66 | 68 | ||
67 | /* kconfig_load.c */ | 69 | /* kconfig_load.c */ |
@@ -78,6 +80,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
78 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); | 80 | struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); |
79 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); | 81 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); |
80 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); | 82 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); |
83 | void menu_add_option(int token, char *arg); | ||
81 | void menu_finalize(struct menu *parent); | 84 | void menu_finalize(struct menu *parent); |
82 | void menu_set_type(int type); | 85 | void menu_set_type(int type); |
83 | 86 | ||
@@ -99,6 +102,7 @@ const char *str_get(struct gstr *gs); | |||
99 | /* symbol.c */ | 102 | /* symbol.c */ |
100 | void sym_init(void); | 103 | void sym_init(void); |
101 | void sym_clear_all_valid(void); | 104 | void sym_clear_all_valid(void); |
105 | void sym_set_all_changed(void); | ||
102 | void sym_set_changed(struct symbol *sym); | 106 | void sym_set_changed(struct symbol *sym); |
103 | struct symbol *sym_check_deps(struct symbol *sym); | 107 | struct symbol *sym_check_deps(struct symbol *sym); |
104 | struct property *prop_alloc(enum prop_type type, struct symbol *sym); | 108 | struct property *prop_alloc(enum prop_type type, struct symbol *sym); |
@@ -137,7 +141,7 @@ static inline bool sym_is_optional(struct symbol *sym) | |||
137 | 141 | ||
138 | static inline bool sym_has_value(struct symbol *sym) | 142 | static inline bool sym_has_value(struct symbol *sym) |
139 | { | 143 | { |
140 | return sym->flags & SYMBOL_NEW ? false : true; | 144 | return sym->flags & SYMBOL_DEF_USER ? true : false; |
141 | } | 145 | } |
142 | 146 | ||
143 | #ifdef __cplusplus | 147 | #ifdef __cplusplus |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index b6a389c5fcbd..a263746cfa7d 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -2,8 +2,9 @@ | |||
2 | /* confdata.c */ | 2 | /* confdata.c */ |
3 | P(conf_parse,void,(const char *name)); | 3 | P(conf_parse,void,(const char *name)); |
4 | P(conf_read,int,(const char *name)); | 4 | P(conf_read,int,(const char *name)); |
5 | P(conf_read_simple,int,(const char *name)); | 5 | P(conf_read_simple,int,(const char *name, int)); |
6 | P(conf_write,int,(const char *name)); | 6 | P(conf_write,int,(const char *name)); |
7 | P(conf_write_autoconf,int,(void)); | ||
7 | 8 | ||
8 | /* menu.c */ | 9 | /* menu.c */ |
9 | P(rootmenu,struct menu,); | 10 | P(rootmenu,struct menu,); |
@@ -38,4 +39,4 @@ P(prop_get_type_name,const char *,(enum prop_type type)); | |||
38 | 39 | ||
39 | /* expr.c */ | 40 | /* expr.c */ |
40 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); | 41 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); |
41 | P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken)); | 42 | P(expr_print,void,(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)); |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 0fce20cb7f3c..c86c27f2c761 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -114,7 +114,7 @@ void menu_set_type(int type) | |||
114 | sym->type = type; | 114 | sym->type = type; |
115 | return; | 115 | return; |
116 | } | 116 | } |
117 | menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n", | 117 | menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'", |
118 | sym->name ? sym->name : "<choice>", | 118 | sym->name ? sym->name : "<choice>", |
119 | sym_type_name(sym->type), sym_type_name(type)); | 119 | sym_type_name(sym->type), sym_type_name(type)); |
120 | } | 120 | } |
@@ -124,15 +124,20 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
124 | struct property *prop = prop_alloc(type, current_entry->sym); | 124 | struct property *prop = prop_alloc(type, current_entry->sym); |
125 | 125 | ||
126 | prop->menu = current_entry; | 126 | prop->menu = current_entry; |
127 | prop->text = prompt; | ||
128 | prop->expr = expr; | 127 | prop->expr = expr; |
129 | prop->visible.expr = menu_check_dep(dep); | 128 | prop->visible.expr = menu_check_dep(dep); |
130 | 129 | ||
131 | if (prompt) { | 130 | if (prompt) { |
131 | if (isspace(*prompt)) { | ||
132 | prop_warn(prop, "leading whitespace ignored"); | ||
133 | while (isspace(*prompt)) | ||
134 | prompt++; | ||
135 | } | ||
132 | if (current_entry->prompt) | 136 | if (current_entry->prompt) |
133 | menu_warn(current_entry, "prompt redefined\n"); | 137 | prop_warn(prop, "prompt redefined"); |
134 | current_entry->prompt = prop; | 138 | current_entry->prompt = prop; |
135 | } | 139 | } |
140 | prop->text = prompt; | ||
136 | 141 | ||
137 | return prop; | 142 | return prop; |
138 | } | 143 | } |
@@ -152,6 +157,24 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) | |||
152 | menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); | 157 | menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); |
153 | } | 158 | } |
154 | 159 | ||
160 | void menu_add_option(int token, char *arg) | ||
161 | { | ||
162 | struct property *prop; | ||
163 | |||
164 | switch (token) { | ||
165 | case T_OPT_MODULES: | ||
166 | prop = prop_alloc(P_DEFAULT, modules_sym); | ||
167 | prop->expr = expr_alloc_symbol(current_entry->sym); | ||
168 | break; | ||
169 | case T_OPT_DEFCONFIG_LIST: | ||
170 | if (!sym_defconfig_list) | ||
171 | sym_defconfig_list = current_entry->sym; | ||
172 | else if (sym_defconfig_list != current_entry->sym) | ||
173 | zconf_error("trying to redefine defconfig symbol"); | ||
174 | break; | ||
175 | } | ||
176 | } | ||
177 | |||
155 | static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) | 178 | static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) |
156 | { | 179 | { |
157 | return sym2->type == S_INT || sym2->type == S_HEX || | 180 | return sym2->type == S_INT || sym2->type == S_HEX || |
@@ -325,11 +348,10 @@ void menu_finalize(struct menu *parent) | |||
325 | 348 | ||
326 | if (sym && !(sym->flags & SYMBOL_WARNED)) { | 349 | if (sym && !(sym->flags & SYMBOL_WARNED)) { |
327 | if (sym->type == S_UNKNOWN) | 350 | if (sym->type == S_UNKNOWN) |
328 | menu_warn(parent, "config symbol defined " | 351 | menu_warn(parent, "config symbol defined without type"); |
329 | "without type\n"); | ||
330 | 352 | ||
331 | if (sym_is_choice(sym) && !parent->prompt) | 353 | if (sym_is_choice(sym) && !parent->prompt) |
332 | menu_warn(parent, "choice must have a prompt\n"); | 354 | menu_warn(parent, "choice must have a prompt"); |
333 | 355 | ||
334 | /* Check properties connected to this symbol */ | 356 | /* Check properties connected to this symbol */ |
335 | sym_check_prop(sym); | 357 | sym_check_prop(sym); |
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index 4590cd31623f..393f3749f330 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -6,16 +6,20 @@ | |||
6 | #include <qapplication.h> | 6 | #include <qapplication.h> |
7 | #include <qmainwindow.h> | 7 | #include <qmainwindow.h> |
8 | #include <qtoolbar.h> | 8 | #include <qtoolbar.h> |
9 | #include <qlayout.h> | ||
9 | #include <qvbox.h> | 10 | #include <qvbox.h> |
10 | #include <qsplitter.h> | 11 | #include <qsplitter.h> |
11 | #include <qlistview.h> | 12 | #include <qlistview.h> |
12 | #include <qtextview.h> | 13 | #include <qtextbrowser.h> |
13 | #include <qlineedit.h> | 14 | #include <qlineedit.h> |
15 | #include <qlabel.h> | ||
16 | #include <qpushbutton.h> | ||
14 | #include <qmenubar.h> | 17 | #include <qmenubar.h> |
15 | #include <qmessagebox.h> | 18 | #include <qmessagebox.h> |
16 | #include <qaction.h> | 19 | #include <qaction.h> |
17 | #include <qheader.h> | 20 | #include <qheader.h> |
18 | #include <qfiledialog.h> | 21 | #include <qfiledialog.h> |
22 | #include <qdragobject.h> | ||
19 | #include <qregexp.h> | 23 | #include <qregexp.h> |
20 | 24 | ||
21 | #include <stdlib.h> | 25 | #include <stdlib.h> |
@@ -32,32 +36,16 @@ | |||
32 | #endif | 36 | #endif |
33 | 37 | ||
34 | static QApplication *configApp; | 38 | static QApplication *configApp; |
39 | static ConfigSettings *configSettings; | ||
35 | 40 | ||
36 | static inline QString qgettext(const char* str) | 41 | static inline QString qgettext(const char* str) |
37 | { | 42 | { |
38 | return QString::fromLocal8Bit(gettext(str)); | 43 | return QString::fromLocal8Bit(gettext(str)); |
39 | } | 44 | } |
40 | 45 | ||
41 | static inline QString qgettext(const QString& str) | 46 | static inline QString qgettext(const QString& str) |
42 | { | 47 | { |
43 | return QString::fromLocal8Bit(gettext(str.latin1())); | 48 | return QString::fromLocal8Bit(gettext(str.latin1())); |
44 | } | ||
45 | |||
46 | ConfigSettings::ConfigSettings() | ||
47 | : showAll(false), showName(false), showRange(false), showData(false) | ||
48 | { | ||
49 | } | ||
50 | |||
51 | #if QT_VERSION >= 300 | ||
52 | /** | ||
53 | * Reads the list column settings from the application settings. | ||
54 | */ | ||
55 | void ConfigSettings::readListSettings() | ||
56 | { | ||
57 | showAll = readBoolEntry("/kconfig/qconf/showAll", false); | ||
58 | showName = readBoolEntry("/kconfig/qconf/showName", false); | ||
59 | showRange = readBoolEntry("/kconfig/qconf/showRange", false); | ||
60 | showData = readBoolEntry("/kconfig/qconf/showData", false); | ||
61 | } | 49 | } |
62 | 50 | ||
63 | /** | 51 | /** |
@@ -88,76 +76,7 @@ bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value | |||
88 | stringList.push_back(QString::number(*it)); | 76 | stringList.push_back(QString::number(*it)); |
89 | return writeEntry(key, stringList); | 77 | return writeEntry(key, stringList); |
90 | } | 78 | } |
91 | #endif | ||
92 | |||
93 | |||
94 | /* | ||
95 | * update all the children of a menu entry | ||
96 | * removes/adds the entries from the parent widget as necessary | ||
97 | * | ||
98 | * parent: either the menu list widget or a menu entry widget | ||
99 | * menu: entry to be updated | ||
100 | */ | ||
101 | template <class P> | ||
102 | void ConfigList::updateMenuList(P* parent, struct menu* menu) | ||
103 | { | ||
104 | struct menu* child; | ||
105 | ConfigItem* item; | ||
106 | ConfigItem* last; | ||
107 | bool visible; | ||
108 | enum prop_type type; | ||
109 | 79 | ||
110 | if (!menu) { | ||
111 | while ((item = parent->firstChild())) | ||
112 | delete item; | ||
113 | return; | ||
114 | } | ||
115 | |||
116 | last = parent->firstChild(); | ||
117 | if (last && !last->goParent) | ||
118 | last = 0; | ||
119 | for (child = menu->list; child; child = child->next) { | ||
120 | item = last ? last->nextSibling() : parent->firstChild(); | ||
121 | type = child->prompt ? child->prompt->type : P_UNKNOWN; | ||
122 | |||
123 | switch (mode) { | ||
124 | case menuMode: | ||
125 | if (!(child->flags & MENU_ROOT)) | ||
126 | goto hide; | ||
127 | break; | ||
128 | case symbolMode: | ||
129 | if (child->flags & MENU_ROOT) | ||
130 | goto hide; | ||
131 | break; | ||
132 | default: | ||
133 | break; | ||
134 | } | ||
135 | |||
136 | visible = menu_is_visible(child); | ||
137 | if (showAll || visible) { | ||
138 | if (!item || item->menu != child) | ||
139 | item = new ConfigItem(parent, last, child, visible); | ||
140 | else | ||
141 | item->testUpdateMenu(visible); | ||
142 | |||
143 | if (mode == fullMode || mode == menuMode || type != P_MENU) | ||
144 | updateMenuList(item, child); | ||
145 | else | ||
146 | updateMenuList(item, 0); | ||
147 | last = item; | ||
148 | continue; | ||
149 | } | ||
150 | hide: | ||
151 | if (item && item->menu == child) { | ||
152 | last = parent->firstChild(); | ||
153 | if (last == item) | ||
154 | last = 0; | ||
155 | else while (last->nextSibling() != item) | ||
156 | last = last->nextSibling(); | ||
157 | delete item; | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | 80 | ||
162 | #if QT_VERSION >= 300 | 81 | #if QT_VERSION >= 300 |
163 | /* | 82 | /* |
@@ -355,6 +274,12 @@ ConfigItem::~ConfigItem(void) | |||
355 | } | 274 | } |
356 | } | 275 | } |
357 | 276 | ||
277 | ConfigLineEdit::ConfigLineEdit(ConfigView* parent) | ||
278 | : Parent(parent) | ||
279 | { | ||
280 | connect(this, SIGNAL(lostFocus()), SLOT(hide())); | ||
281 | } | ||
282 | |||
358 | void ConfigLineEdit::show(ConfigItem* i) | 283 | void ConfigLineEdit::show(ConfigItem* i) |
359 | { | 284 | { |
360 | item = i; | 285 | item = i; |
@@ -385,14 +310,14 @@ void ConfigLineEdit::keyPressEvent(QKeyEvent* e) | |||
385 | hide(); | 310 | hide(); |
386 | } | 311 | } |
387 | 312 | ||
388 | ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv, ConfigSettings* configSettings) | 313 | ConfigList::ConfigList(ConfigView* p, const char *name) |
389 | : Parent(p), cview(cv), | 314 | : Parent(p, name), |
390 | updateAll(false), | 315 | updateAll(false), |
391 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), | 316 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), |
392 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), | 317 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), |
393 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), | 318 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), |
394 | showAll(false), showName(false), showRange(false), showData(false), | 319 | showAll(false), showName(false), showRange(false), showData(false), |
395 | rootEntry(0) | 320 | rootEntry(0), headerPopup(0) |
396 | { | 321 | { |
397 | int i; | 322 | int i; |
398 | 323 | ||
@@ -406,11 +331,14 @@ ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv, ConfigSettings* conf | |||
406 | connect(this, SIGNAL(selectionChanged(void)), | 331 | connect(this, SIGNAL(selectionChanged(void)), |
407 | SLOT(updateSelection(void))); | 332 | SLOT(updateSelection(void))); |
408 | 333 | ||
409 | if (configSettings) { | 334 | if (name) { |
410 | showAll = configSettings->showAll; | 335 | configSettings->beginGroup(name); |
411 | showName = configSettings->showName; | 336 | showAll = configSettings->readBoolEntry("/showAll", false); |
412 | showRange = configSettings->showRange; | 337 | showName = configSettings->readBoolEntry("/showName", false); |
413 | showData = configSettings->showData; | 338 | showRange = configSettings->readBoolEntry("/showRange", false); |
339 | showData = configSettings->readBoolEntry("/showData", false); | ||
340 | configSettings->endGroup(); | ||
341 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | ||
414 | } | 342 | } |
415 | 343 | ||
416 | for (i = 0; i < colNr; i++) | 344 | for (i = 0; i < colNr; i++) |
@@ -441,6 +369,30 @@ void ConfigList::reinit(void) | |||
441 | updateListAll(); | 369 | updateListAll(); |
442 | } | 370 | } |
443 | 371 | ||
372 | void ConfigList::saveSettings(void) | ||
373 | { | ||
374 | if (name()) { | ||
375 | configSettings->beginGroup(name()); | ||
376 | configSettings->writeEntry("/showName", showName); | ||
377 | configSettings->writeEntry("/showRange", showRange); | ||
378 | configSettings->writeEntry("/showData", showData); | ||
379 | configSettings->writeEntry("/showAll", showAll); | ||
380 | configSettings->endGroup(); | ||
381 | } | ||
382 | } | ||
383 | |||
384 | ConfigItem* ConfigList::findConfigItem(struct menu *menu) | ||
385 | { | ||
386 | ConfigItem* item = (ConfigItem*)menu->data; | ||
387 | |||
388 | for (; item; item = item->nextItem) { | ||
389 | if (this == item->listView()) | ||
390 | break; | ||
391 | } | ||
392 | |||
393 | return item; | ||
394 | } | ||
395 | |||
444 | void ConfigList::updateSelection(void) | 396 | void ConfigList::updateSelection(void) |
445 | { | 397 | { |
446 | struct menu *menu; | 398 | struct menu *menu; |
@@ -450,9 +402,8 @@ void ConfigList::updateSelection(void) | |||
450 | if (!item) | 402 | if (!item) |
451 | return; | 403 | return; |
452 | 404 | ||
453 | cview->setHelp(item); | ||
454 | |||
455 | menu = item->menu; | 405 | menu = item->menu; |
406 | emit menuChanged(menu); | ||
456 | if (!menu) | 407 | if (!menu) |
457 | return; | 408 | return; |
458 | type = menu->prompt ? menu->prompt->type : P_UNKNOWN; | 409 | type = menu->prompt ? menu->prompt->type : P_UNKNOWN; |
@@ -464,8 +415,20 @@ void ConfigList::updateList(ConfigItem* item) | |||
464 | { | 415 | { |
465 | ConfigItem* last = 0; | 416 | ConfigItem* last = 0; |
466 | 417 | ||
467 | if (!rootEntry) | 418 | if (!rootEntry) { |
468 | goto update; | 419 | if (mode != listMode) |
420 | goto update; | ||
421 | QListViewItemIterator it(this); | ||
422 | ConfigItem* item; | ||
423 | |||
424 | for (; it.current(); ++it) { | ||
425 | item = (ConfigItem*)it.current(); | ||
426 | if (!item->menu) | ||
427 | continue; | ||
428 | item->testUpdateMenu(menu_is_visible(item->menu)); | ||
429 | } | ||
430 | return; | ||
431 | } | ||
469 | 432 | ||
470 | if (rootEntry != &rootmenu && (mode == singleMode || | 433 | if (rootEntry != &rootmenu && (mode == singleMode || |
471 | (mode == symbolMode && rootEntry->parent != &rootmenu))) { | 434 | (mode == symbolMode && rootEntry->parent != &rootmenu))) { |
@@ -491,14 +454,6 @@ update: | |||
491 | triggerUpdate(); | 454 | triggerUpdate(); |
492 | } | 455 | } |
493 | 456 | ||
494 | void ConfigList::setAllOpen(bool open) | ||
495 | { | ||
496 | QListViewItemIterator it(this); | ||
497 | |||
498 | for (; it.current(); it++) | ||
499 | it.current()->setOpen(open); | ||
500 | } | ||
501 | |||
502 | void ConfigList::setValue(ConfigItem* item, tristate val) | 457 | void ConfigList::setValue(ConfigItem* item, tristate val) |
503 | { | 458 | { |
504 | struct symbol* sym; | 459 | struct symbol* sym; |
@@ -581,6 +536,7 @@ void ConfigList::setRootMenu(struct menu *menu) | |||
581 | rootEntry = menu; | 536 | rootEntry = menu; |
582 | updateListAll(); | 537 | updateListAll(); |
583 | setSelected(currentItem(), hasFocus()); | 538 | setSelected(currentItem(), hasFocus()); |
539 | ensureItemVisible(currentItem()); | ||
584 | } | 540 | } |
585 | 541 | ||
586 | void ConfigList::setParentMenu(void) | 542 | void ConfigList::setParentMenu(void) |
@@ -603,6 +559,74 @@ void ConfigList::setParentMenu(void) | |||
603 | } | 559 | } |
604 | } | 560 | } |
605 | 561 | ||
562 | /* | ||
563 | * update all the children of a menu entry | ||
564 | * removes/adds the entries from the parent widget as necessary | ||
565 | * | ||
566 | * parent: either the menu list widget or a menu entry widget | ||
567 | * menu: entry to be updated | ||
568 | */ | ||
569 | template <class P> | ||
570 | void ConfigList::updateMenuList(P* parent, struct menu* menu) | ||
571 | { | ||
572 | struct menu* child; | ||
573 | ConfigItem* item; | ||
574 | ConfigItem* last; | ||
575 | bool visible; | ||
576 | enum prop_type type; | ||
577 | |||
578 | if (!menu) { | ||
579 | while ((item = parent->firstChild())) | ||
580 | delete item; | ||
581 | return; | ||
582 | } | ||
583 | |||
584 | last = parent->firstChild(); | ||
585 | if (last && !last->goParent) | ||
586 | last = 0; | ||
587 | for (child = menu->list; child; child = child->next) { | ||
588 | item = last ? last->nextSibling() : parent->firstChild(); | ||
589 | type = child->prompt ? child->prompt->type : P_UNKNOWN; | ||
590 | |||
591 | switch (mode) { | ||
592 | case menuMode: | ||
593 | if (!(child->flags & MENU_ROOT)) | ||
594 | goto hide; | ||
595 | break; | ||
596 | case symbolMode: | ||
597 | if (child->flags & MENU_ROOT) | ||
598 | goto hide; | ||
599 | break; | ||
600 | default: | ||
601 | break; | ||
602 | } | ||
603 | |||
604 | visible = menu_is_visible(child); | ||
605 | if (showAll || visible) { | ||
606 | if (!item || item->menu != child) | ||
607 | item = new ConfigItem(parent, last, child, visible); | ||
608 | else | ||
609 | item->testUpdateMenu(visible); | ||
610 | |||
611 | if (mode == fullMode || mode == menuMode || type != P_MENU) | ||
612 | updateMenuList(item, child); | ||
613 | else | ||
614 | updateMenuList(item, 0); | ||
615 | last = item; | ||
616 | continue; | ||
617 | } | ||
618 | hide: | ||
619 | if (item && item->menu == child) { | ||
620 | last = parent->firstChild(); | ||
621 | if (last == item) | ||
622 | last = 0; | ||
623 | else while (last->nextSibling() != item) | ||
624 | last = last->nextSibling(); | ||
625 | delete item; | ||
626 | } | ||
627 | } | ||
628 | } | ||
629 | |||
606 | void ConfigList::keyPressEvent(QKeyEvent* ev) | 630 | void ConfigList::keyPressEvent(QKeyEvent* ev) |
607 | { | 631 | { |
608 | QListViewItem* i = currentItem(); | 632 | QListViewItem* i = currentItem(); |
@@ -610,7 +634,7 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) | |||
610 | struct menu *menu; | 634 | struct menu *menu; |
611 | enum prop_type type; | 635 | enum prop_type type; |
612 | 636 | ||
613 | if (ev->key() == Key_Escape && mode != fullMode) { | 637 | if (ev->key() == Key_Escape && mode != fullMode && mode != listMode) { |
614 | emit parentSelected(); | 638 | emit parentSelected(); |
615 | ev->accept(); | 639 | ev->accept(); |
616 | return; | 640 | return; |
@@ -755,23 +779,62 @@ skip: | |||
755 | 779 | ||
756 | void ConfigList::focusInEvent(QFocusEvent *e) | 780 | void ConfigList::focusInEvent(QFocusEvent *e) |
757 | { | 781 | { |
782 | struct menu *menu = NULL; | ||
783 | |||
758 | Parent::focusInEvent(e); | 784 | Parent::focusInEvent(e); |
759 | 785 | ||
760 | QListViewItem* item = currentItem(); | 786 | ConfigItem* item = (ConfigItem *)currentItem(); |
761 | if (!item) | 787 | if (item) { |
762 | return; | 788 | setSelected(item, TRUE); |
789 | menu = item->menu; | ||
790 | } | ||
791 | emit gotFocus(menu); | ||
792 | } | ||
763 | 793 | ||
764 | setSelected(item, TRUE); | 794 | void ConfigList::contextMenuEvent(QContextMenuEvent *e) |
765 | emit gotFocus(); | 795 | { |
796 | if (e->y() <= header()->geometry().bottom()) { | ||
797 | if (!headerPopup) { | ||
798 | QAction *action; | ||
799 | |||
800 | headerPopup = new QPopupMenu(this); | ||
801 | action = new QAction("Show Name", 0, this); | ||
802 | action->setToggleAction(TRUE); | ||
803 | connect(action, SIGNAL(toggled(bool)), | ||
804 | parent(), SLOT(setShowName(bool))); | ||
805 | connect(parent(), SIGNAL(showNameChanged(bool)), | ||
806 | action, SLOT(setOn(bool))); | ||
807 | action->setOn(showName); | ||
808 | action->addTo(headerPopup); | ||
809 | action = new QAction("Show Range", 0, this); | ||
810 | action->setToggleAction(TRUE); | ||
811 | connect(action, SIGNAL(toggled(bool)), | ||
812 | parent(), SLOT(setShowRange(bool))); | ||
813 | connect(parent(), SIGNAL(showRangeChanged(bool)), | ||
814 | action, SLOT(setOn(bool))); | ||
815 | action->setOn(showRange); | ||
816 | action->addTo(headerPopup); | ||
817 | action = new QAction("Show Data", 0, this); | ||
818 | action->setToggleAction(TRUE); | ||
819 | connect(action, SIGNAL(toggled(bool)), | ||
820 | parent(), SLOT(setShowData(bool))); | ||
821 | connect(parent(), SIGNAL(showDataChanged(bool)), | ||
822 | action, SLOT(setOn(bool))); | ||
823 | action->setOn(showData); | ||
824 | action->addTo(headerPopup); | ||
825 | } | ||
826 | headerPopup->exec(e->globalPos()); | ||
827 | e->accept(); | ||
828 | } else | ||
829 | e->ignore(); | ||
766 | } | 830 | } |
767 | 831 | ||
768 | ConfigView* ConfigView::viewList; | 832 | ConfigView* ConfigView::viewList; |
769 | 833 | ||
770 | ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview, | 834 | ConfigView::ConfigView(QWidget* parent, const char *name) |
771 | ConfigSettings *configSettings) | 835 | : Parent(parent, name) |
772 | : Parent(parent) | ||
773 | { | 836 | { |
774 | list = new ConfigList(this, cview, configSettings); | 837 | list = new ConfigList(this, name); |
775 | lineEdit = new ConfigLineEdit(this); | 838 | lineEdit = new ConfigLineEdit(this); |
776 | lineEdit->hide(); | 839 | lineEdit->hide(); |
777 | 840 | ||
@@ -791,6 +854,50 @@ ConfigView::~ConfigView(void) | |||
791 | } | 854 | } |
792 | } | 855 | } |
793 | 856 | ||
857 | void ConfigView::setShowAll(bool b) | ||
858 | { | ||
859 | if (list->showAll != b) { | ||
860 | list->showAll = b; | ||
861 | list->updateListAll(); | ||
862 | emit showAllChanged(b); | ||
863 | } | ||
864 | } | ||
865 | |||
866 | void ConfigView::setShowName(bool b) | ||
867 | { | ||
868 | if (list->showName != b) { | ||
869 | list->showName = b; | ||
870 | list->reinit(); | ||
871 | emit showNameChanged(b); | ||
872 | } | ||
873 | } | ||
874 | |||
875 | void ConfigView::setShowRange(bool b) | ||
876 | { | ||
877 | if (list->showRange != b) { | ||
878 | list->showRange = b; | ||
879 | list->reinit(); | ||
880 | emit showRangeChanged(b); | ||
881 | } | ||
882 | } | ||
883 | |||
884 | void ConfigView::setShowData(bool b) | ||
885 | { | ||
886 | if (list->showData != b) { | ||
887 | list->showData = b; | ||
888 | list->reinit(); | ||
889 | emit showDataChanged(b); | ||
890 | } | ||
891 | } | ||
892 | |||
893 | void ConfigList::setAllOpen(bool open) | ||
894 | { | ||
895 | QListViewItemIterator it(this); | ||
896 | |||
897 | for (; it.current(); it++) | ||
898 | it.current()->setOpen(open); | ||
899 | } | ||
900 | |||
794 | void ConfigView::updateList(ConfigItem* item) | 901 | void ConfigView::updateList(ConfigItem* item) |
795 | { | 902 | { |
796 | ConfigView* v; | 903 | ConfigView* v; |
@@ -807,6 +914,347 @@ void ConfigView::updateListAll(void) | |||
807 | v->list->updateListAll(); | 914 | v->list->updateListAll(); |
808 | } | 915 | } |
809 | 916 | ||
917 | ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) | ||
918 | : Parent(parent, name), menu(0) | ||
919 | { | ||
920 | if (name) { | ||
921 | configSettings->beginGroup(name); | ||
922 | _showDebug = configSettings->readBoolEntry("/showDebug", false); | ||
923 | configSettings->endGroup(); | ||
924 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | ||
925 | } | ||
926 | } | ||
927 | |||
928 | void ConfigInfoView::saveSettings(void) | ||
929 | { | ||
930 | if (name()) { | ||
931 | configSettings->beginGroup(name()); | ||
932 | configSettings->writeEntry("/showDebug", showDebug()); | ||
933 | configSettings->endGroup(); | ||
934 | } | ||
935 | } | ||
936 | |||
937 | void ConfigInfoView::setShowDebug(bool b) | ||
938 | { | ||
939 | if (_showDebug != b) { | ||
940 | _showDebug = b; | ||
941 | if (menu) | ||
942 | menuInfo(); | ||
943 | else if (sym) | ||
944 | symbolInfo(); | ||
945 | emit showDebugChanged(b); | ||
946 | } | ||
947 | } | ||
948 | |||
949 | void ConfigInfoView::setInfo(struct menu *m) | ||
950 | { | ||
951 | if (menu == m) | ||
952 | return; | ||
953 | menu = m; | ||
954 | if (!menu) | ||
955 | clear(); | ||
956 | else | ||
957 | menuInfo(); | ||
958 | } | ||
959 | |||
960 | void ConfigInfoView::setSource(const QString& name) | ||
961 | { | ||
962 | const char *p = name.latin1(); | ||
963 | |||
964 | menu = NULL; | ||
965 | sym = NULL; | ||
966 | |||
967 | switch (p[0]) { | ||
968 | case 'm': | ||
969 | struct menu *m; | ||
970 | |||
971 | if (sscanf(p, "m%p", &m) == 1 && menu != m) { | ||
972 | menu = m; | ||
973 | menuInfo(); | ||
974 | emit menuSelected(menu); | ||
975 | } | ||
976 | break; | ||
977 | case 's': | ||
978 | struct symbol *s; | ||
979 | |||
980 | if (sscanf(p, "s%p", &s) == 1 && sym != s) { | ||
981 | sym = s; | ||
982 | symbolInfo(); | ||
983 | } | ||
984 | break; | ||
985 | } | ||
986 | } | ||
987 | |||
988 | void ConfigInfoView::symbolInfo(void) | ||
989 | { | ||
990 | QString str; | ||
991 | |||
992 | str += "<big>Symbol: <b>"; | ||
993 | str += print_filter(sym->name); | ||
994 | str += "</b></big><br><br>value: "; | ||
995 | str += print_filter(sym_get_string_value(sym)); | ||
996 | str += "<br>visibility: "; | ||
997 | str += sym->visible == yes ? "y" : sym->visible == mod ? "m" : "n"; | ||
998 | str += "<br>"; | ||
999 | str += debug_info(sym); | ||
1000 | |||
1001 | setText(str); | ||
1002 | } | ||
1003 | |||
1004 | void ConfigInfoView::menuInfo(void) | ||
1005 | { | ||
1006 | struct symbol* sym; | ||
1007 | QString head, debug, help; | ||
1008 | |||
1009 | sym = menu->sym; | ||
1010 | if (sym) { | ||
1011 | if (menu->prompt) { | ||
1012 | head += "<big><b>"; | ||
1013 | head += print_filter(_(menu->prompt->text)); | ||
1014 | head += "</b></big>"; | ||
1015 | if (sym->name) { | ||
1016 | head += " ("; | ||
1017 | if (showDebug()) | ||
1018 | head += QString().sprintf("<a href=\"s%p\">", sym); | ||
1019 | head += print_filter(sym->name); | ||
1020 | if (showDebug()) | ||
1021 | head += "</a>"; | ||
1022 | head += ")"; | ||
1023 | } | ||
1024 | } else if (sym->name) { | ||
1025 | head += "<big><b>"; | ||
1026 | if (showDebug()) | ||
1027 | head += QString().sprintf("<a href=\"s%p\">", sym); | ||
1028 | head += print_filter(sym->name); | ||
1029 | if (showDebug()) | ||
1030 | head += "</a>"; | ||
1031 | head += "</b></big>"; | ||
1032 | } | ||
1033 | head += "<br><br>"; | ||
1034 | |||
1035 | if (showDebug()) | ||
1036 | debug = debug_info(sym); | ||
1037 | |||
1038 | help = print_filter(_(sym->help)); | ||
1039 | } else if (menu->prompt) { | ||
1040 | head += "<big><b>"; | ||
1041 | head += print_filter(_(menu->prompt->text)); | ||
1042 | head += "</b></big><br><br>"; | ||
1043 | if (showDebug()) { | ||
1044 | if (menu->prompt->visible.expr) { | ||
1045 | debug += " dep: "; | ||
1046 | expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); | ||
1047 | debug += "<br><br>"; | ||
1048 | } | ||
1049 | } | ||
1050 | } | ||
1051 | if (showDebug()) | ||
1052 | debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); | ||
1053 | |||
1054 | setText(head + debug + help); | ||
1055 | } | ||
1056 | |||
1057 | QString ConfigInfoView::debug_info(struct symbol *sym) | ||
1058 | { | ||
1059 | QString debug; | ||
1060 | |||
1061 | debug += "type: "; | ||
1062 | debug += print_filter(sym_type_name(sym->type)); | ||
1063 | if (sym_is_choice(sym)) | ||
1064 | debug += " (choice)"; | ||
1065 | debug += "<br>"; | ||
1066 | if (sym->rev_dep.expr) { | ||
1067 | debug += "reverse dep: "; | ||
1068 | expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE); | ||
1069 | debug += "<br>"; | ||
1070 | } | ||
1071 | for (struct property *prop = sym->prop; prop; prop = prop->next) { | ||
1072 | switch (prop->type) { | ||
1073 | case P_PROMPT: | ||
1074 | case P_MENU: | ||
1075 | debug += QString().sprintf("prompt: <a href=\"m%p\">", prop->menu); | ||
1076 | debug += print_filter(_(prop->text)); | ||
1077 | debug += "</a><br>"; | ||
1078 | break; | ||
1079 | case P_DEFAULT: | ||
1080 | debug += "default: "; | ||
1081 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1082 | debug += "<br>"; | ||
1083 | break; | ||
1084 | case P_CHOICE: | ||
1085 | if (sym_is_choice(sym)) { | ||
1086 | debug += "choice: "; | ||
1087 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1088 | debug += "<br>"; | ||
1089 | } | ||
1090 | break; | ||
1091 | case P_SELECT: | ||
1092 | debug += "select: "; | ||
1093 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1094 | debug += "<br>"; | ||
1095 | break; | ||
1096 | case P_RANGE: | ||
1097 | debug += "range: "; | ||
1098 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1099 | debug += "<br>"; | ||
1100 | break; | ||
1101 | default: | ||
1102 | debug += "unknown property: "; | ||
1103 | debug += prop_get_type_name(prop->type); | ||
1104 | debug += "<br>"; | ||
1105 | } | ||
1106 | if (prop->visible.expr) { | ||
1107 | debug += " dep: "; | ||
1108 | expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE); | ||
1109 | debug += "<br>"; | ||
1110 | } | ||
1111 | } | ||
1112 | debug += "<br>"; | ||
1113 | |||
1114 | return debug; | ||
1115 | } | ||
1116 | |||
1117 | QString ConfigInfoView::print_filter(const QString &str) | ||
1118 | { | ||
1119 | QRegExp re("[<>&\"\\n]"); | ||
1120 | QString res = str; | ||
1121 | for (int i = 0; (i = res.find(re, i)) >= 0;) { | ||
1122 | switch (res[i].latin1()) { | ||
1123 | case '<': | ||
1124 | res.replace(i, 1, "<"); | ||
1125 | i += 4; | ||
1126 | break; | ||
1127 | case '>': | ||
1128 | res.replace(i, 1, ">"); | ||
1129 | i += 4; | ||
1130 | break; | ||
1131 | case '&': | ||
1132 | res.replace(i, 1, "&"); | ||
1133 | i += 5; | ||
1134 | break; | ||
1135 | case '"': | ||
1136 | res.replace(i, 1, """); | ||
1137 | i += 6; | ||
1138 | break; | ||
1139 | case '\n': | ||
1140 | res.replace(i, 1, "<br>"); | ||
1141 | i += 4; | ||
1142 | break; | ||
1143 | } | ||
1144 | } | ||
1145 | return res; | ||
1146 | } | ||
1147 | |||
1148 | void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *str) | ||
1149 | { | ||
1150 | QString* text = reinterpret_cast<QString*>(data); | ||
1151 | QString str2 = print_filter(str); | ||
1152 | |||
1153 | if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) { | ||
1154 | *text += QString().sprintf("<a href=\"s%p\">", sym); | ||
1155 | *text += str2; | ||
1156 | *text += "</a>"; | ||
1157 | } else | ||
1158 | *text += str2; | ||
1159 | } | ||
1160 | |||
1161 | QPopupMenu* ConfigInfoView::createPopupMenu(const QPoint& pos) | ||
1162 | { | ||
1163 | QPopupMenu* popup = Parent::createPopupMenu(pos); | ||
1164 | QAction* action = new QAction("Show Debug Info", 0, popup); | ||
1165 | action->setToggleAction(TRUE); | ||
1166 | connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); | ||
1167 | connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); | ||
1168 | action->setOn(showDebug()); | ||
1169 | popup->insertSeparator(); | ||
1170 | action->addTo(popup); | ||
1171 | return popup; | ||
1172 | } | ||
1173 | |||
1174 | void ConfigInfoView::contentsContextMenuEvent(QContextMenuEvent *e) | ||
1175 | { | ||
1176 | Parent::contentsContextMenuEvent(e); | ||
1177 | } | ||
1178 | |||
1179 | ConfigSearchWindow::ConfigSearchWindow(QWidget* parent, const char *name) | ||
1180 | : Parent(parent, name), result(NULL) | ||
1181 | { | ||
1182 | setCaption("Search Config"); | ||
1183 | |||
1184 | QVBoxLayout* layout1 = new QVBoxLayout(this, 11, 6); | ||
1185 | QHBoxLayout* layout2 = new QHBoxLayout(0, 0, 6); | ||
1186 | layout2->addWidget(new QLabel("Find:", this)); | ||
1187 | editField = new QLineEdit(this); | ||
1188 | connect(editField, SIGNAL(returnPressed()), SLOT(search())); | ||
1189 | layout2->addWidget(editField); | ||
1190 | searchButton = new QPushButton("Search", this); | ||
1191 | searchButton->setAutoDefault(FALSE); | ||
1192 | connect(searchButton, SIGNAL(clicked()), SLOT(search())); | ||
1193 | layout2->addWidget(searchButton); | ||
1194 | layout1->addLayout(layout2); | ||
1195 | |||
1196 | split = new QSplitter(this); | ||
1197 | split->setOrientation(QSplitter::Vertical); | ||
1198 | list = new ConfigView(split, name); | ||
1199 | list->list->mode = listMode; | ||
1200 | info = new ConfigInfoView(split, name); | ||
1201 | connect(list->list, SIGNAL(menuChanged(struct menu *)), | ||
1202 | info, SLOT(setInfo(struct menu *))); | ||
1203 | layout1->addWidget(split); | ||
1204 | |||
1205 | if (name) { | ||
1206 | int x, y, width, height; | ||
1207 | bool ok; | ||
1208 | |||
1209 | configSettings->beginGroup(name); | ||
1210 | width = configSettings->readNumEntry("/window width", parent->width() / 2); | ||
1211 | height = configSettings->readNumEntry("/window height", parent->height() / 2); | ||
1212 | resize(width, height); | ||
1213 | x = configSettings->readNumEntry("/window x", 0, &ok); | ||
1214 | if (ok) | ||
1215 | y = configSettings->readNumEntry("/window y", 0, &ok); | ||
1216 | if (ok) | ||
1217 | move(x, y); | ||
1218 | QValueList<int> sizes = configSettings->readSizes("/split", &ok); | ||
1219 | if (ok) | ||
1220 | split->setSizes(sizes); | ||
1221 | configSettings->endGroup(); | ||
1222 | connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); | ||
1223 | } | ||
1224 | } | ||
1225 | |||
1226 | void ConfigSearchWindow::saveSettings(void) | ||
1227 | { | ||
1228 | if (name()) { | ||
1229 | configSettings->beginGroup(name()); | ||
1230 | configSettings->writeEntry("/window x", pos().x()); | ||
1231 | configSettings->writeEntry("/window y", pos().y()); | ||
1232 | configSettings->writeEntry("/window width", size().width()); | ||
1233 | configSettings->writeEntry("/window height", size().height()); | ||
1234 | configSettings->writeSizes("/split", split->sizes()); | ||
1235 | configSettings->endGroup(); | ||
1236 | } | ||
1237 | } | ||
1238 | |||
1239 | void ConfigSearchWindow::search(void) | ||
1240 | { | ||
1241 | struct symbol **p; | ||
1242 | struct property *prop; | ||
1243 | ConfigItem *lastItem = NULL; | ||
1244 | |||
1245 | free(result); | ||
1246 | list->list->clear(); | ||
1247 | |||
1248 | result = sym_re_search(editField->text().latin1()); | ||
1249 | if (!result) | ||
1250 | return; | ||
1251 | for (p = result; *p; p++) { | ||
1252 | for_all_prompts((*p), prop) | ||
1253 | lastItem = new ConfigItem(list->list, lastItem, prop->menu, | ||
1254 | menu_is_visible(prop->menu)); | ||
1255 | } | ||
1256 | } | ||
1257 | |||
810 | /* | 1258 | /* |
811 | * Construct the complete config widget | 1259 | * Construct the complete config widget |
812 | */ | 1260 | */ |
@@ -818,42 +1266,30 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
818 | 1266 | ||
819 | QWidget *d = configApp->desktop(); | 1267 | QWidget *d = configApp->desktop(); |
820 | 1268 | ||
821 | ConfigSettings* configSettings = new ConfigSettings(); | 1269 | width = configSettings->readNumEntry("/window width", d->width() - 64); |
822 | #if QT_VERSION >= 300 | 1270 | height = configSettings->readNumEntry("/window height", d->height() - 64); |
823 | width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64); | ||
824 | height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64); | ||
825 | resize(width, height); | 1271 | resize(width, height); |
826 | x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok); | 1272 | x = configSettings->readNumEntry("/window x", 0, &ok); |
827 | if (ok) | 1273 | if (ok) |
828 | y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok); | 1274 | y = configSettings->readNumEntry("/window y", 0, &ok); |
829 | if (ok) | 1275 | if (ok) |
830 | move(x, y); | 1276 | move(x, y); |
831 | showDebug = configSettings->readBoolEntry("/kconfig/qconf/showDebug", false); | ||
832 | |||
833 | // read list settings into configSettings, will be used later for ConfigList setup | ||
834 | configSettings->readListSettings(); | ||
835 | #else | ||
836 | width = d->width() - 64; | ||
837 | height = d->height() - 64; | ||
838 | resize(width, height); | ||
839 | showDebug = false; | ||
840 | #endif | ||
841 | 1277 | ||
842 | split1 = new QSplitter(this); | 1278 | split1 = new QSplitter(this); |
843 | split1->setOrientation(QSplitter::Horizontal); | 1279 | split1->setOrientation(QSplitter::Horizontal); |
844 | setCentralWidget(split1); | 1280 | setCentralWidget(split1); |
845 | 1281 | ||
846 | menuView = new ConfigView(split1, this, configSettings); | 1282 | menuView = new ConfigView(split1, "menu"); |
847 | menuList = menuView->list; | 1283 | menuList = menuView->list; |
848 | 1284 | ||
849 | split2 = new QSplitter(split1); | 1285 | split2 = new QSplitter(split1); |
850 | split2->setOrientation(QSplitter::Vertical); | 1286 | split2->setOrientation(QSplitter::Vertical); |
851 | 1287 | ||
852 | // create config tree | 1288 | // create config tree |
853 | configView = new ConfigView(split2, this, configSettings); | 1289 | configView = new ConfigView(split2, "config"); |
854 | configList = configView->list; | 1290 | configList = configView->list; |
855 | 1291 | ||
856 | helpText = new QTextView(split2); | 1292 | helpText = new ConfigInfoView(split2, "help"); |
857 | helpText->setTextFormat(Qt::RichText); | 1293 | helpText->setTextFormat(Qt::RichText); |
858 | 1294 | ||
859 | setTabOrder(configList, helpText); | 1295 | setTabOrder(configList, helpText); |
@@ -873,6 +1309,8 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
873 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); | 1309 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); |
874 | QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); | 1310 | QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); |
875 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); | 1311 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); |
1312 | QAction *searchAction = new QAction("Search", "&Search", CTRL+Key_F, this); | ||
1313 | connect(searchAction, SIGNAL(activated()), SLOT(searchConfig())); | ||
876 | QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); | 1314 | QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); |
877 | connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); | 1315 | connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); |
878 | QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this); | 1316 | QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this); |
@@ -882,24 +1320,29 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
882 | 1320 | ||
883 | QAction *showNameAction = new QAction(NULL, "Show Name", 0, this); | 1321 | QAction *showNameAction = new QAction(NULL, "Show Name", 0, this); |
884 | showNameAction->setToggleAction(TRUE); | 1322 | showNameAction->setToggleAction(TRUE); |
885 | showNameAction->setOn(configList->showName); | 1323 | connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); |
886 | connect(showNameAction, SIGNAL(toggled(bool)), SLOT(setShowName(bool))); | 1324 | connect(configView, SIGNAL(showNameChanged(bool)), showNameAction, SLOT(setOn(bool))); |
1325 | showNameAction->setOn(configView->showName()); | ||
887 | QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this); | 1326 | QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this); |
888 | showRangeAction->setToggleAction(TRUE); | 1327 | showRangeAction->setToggleAction(TRUE); |
1328 | connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); | ||
1329 | connect(configView, SIGNAL(showRangeChanged(bool)), showRangeAction, SLOT(setOn(bool))); | ||
889 | showRangeAction->setOn(configList->showRange); | 1330 | showRangeAction->setOn(configList->showRange); |
890 | connect(showRangeAction, SIGNAL(toggled(bool)), SLOT(setShowRange(bool))); | ||
891 | QAction *showDataAction = new QAction(NULL, "Show Data", 0, this); | 1331 | QAction *showDataAction = new QAction(NULL, "Show Data", 0, this); |
892 | showDataAction->setToggleAction(TRUE); | 1332 | showDataAction->setToggleAction(TRUE); |
1333 | connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); | ||
1334 | connect(configView, SIGNAL(showDataChanged(bool)), showDataAction, SLOT(setOn(bool))); | ||
893 | showDataAction->setOn(configList->showData); | 1335 | showDataAction->setOn(configList->showData); |
894 | connect(showDataAction, SIGNAL(toggled(bool)), SLOT(setShowData(bool))); | ||
895 | QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this); | 1336 | QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this); |
896 | showAllAction->setToggleAction(TRUE); | 1337 | showAllAction->setToggleAction(TRUE); |
1338 | connect(showAllAction, SIGNAL(toggled(bool)), configView, SLOT(setShowAll(bool))); | ||
1339 | connect(showAllAction, SIGNAL(toggled(bool)), menuView, SLOT(setShowAll(bool))); | ||
897 | showAllAction->setOn(configList->showAll); | 1340 | showAllAction->setOn(configList->showAll); |
898 | connect(showAllAction, SIGNAL(toggled(bool)), SLOT(setShowAll(bool))); | ||
899 | QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); | 1341 | QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); |
900 | showDebugAction->setToggleAction(TRUE); | 1342 | showDebugAction->setToggleAction(TRUE); |
901 | showDebugAction->setOn(showDebug); | 1343 | connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); |
902 | connect(showDebugAction, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); | 1344 | connect(helpText, SIGNAL(showDebugChanged(bool)), showDebugAction, SLOT(setOn(bool))); |
1345 | showDebugAction->setOn(helpText->showDebug()); | ||
903 | 1346 | ||
904 | QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); | 1347 | QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); |
905 | connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); | 1348 | connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); |
@@ -923,6 +1366,8 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
923 | saveAction->addTo(config); | 1366 | saveAction->addTo(config); |
924 | saveAsAction->addTo(config); | 1367 | saveAsAction->addTo(config); |
925 | config->insertSeparator(); | 1368 | config->insertSeparator(); |
1369 | searchAction->addTo(config); | ||
1370 | config->insertSeparator(); | ||
926 | quitAction->addTo(config); | 1371 | quitAction->addTo(config); |
927 | 1372 | ||
928 | // create options menu | 1373 | // create options menu |
@@ -942,20 +1387,27 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
942 | showIntroAction->addTo(helpMenu); | 1387 | showIntroAction->addTo(helpMenu); |
943 | showAboutAction->addTo(helpMenu); | 1388 | showAboutAction->addTo(helpMenu); |
944 | 1389 | ||
1390 | connect(configList, SIGNAL(menuChanged(struct menu *)), | ||
1391 | helpText, SLOT(setInfo(struct menu *))); | ||
945 | connect(configList, SIGNAL(menuSelected(struct menu *)), | 1392 | connect(configList, SIGNAL(menuSelected(struct menu *)), |
946 | SLOT(changeMenu(struct menu *))); | 1393 | SLOT(changeMenu(struct menu *))); |
947 | connect(configList, SIGNAL(parentSelected()), | 1394 | connect(configList, SIGNAL(parentSelected()), |
948 | SLOT(goBack())); | 1395 | SLOT(goBack())); |
1396 | connect(menuList, SIGNAL(menuChanged(struct menu *)), | ||
1397 | helpText, SLOT(setInfo(struct menu *))); | ||
949 | connect(menuList, SIGNAL(menuSelected(struct menu *)), | 1398 | connect(menuList, SIGNAL(menuSelected(struct menu *)), |
950 | SLOT(changeMenu(struct menu *))); | 1399 | SLOT(changeMenu(struct menu *))); |
951 | 1400 | ||
952 | connect(configList, SIGNAL(gotFocus(void)), | 1401 | connect(configList, SIGNAL(gotFocus(struct menu *)), |
953 | SLOT(listFocusChanged(void))); | 1402 | helpText, SLOT(setInfo(struct menu *))); |
954 | connect(menuList, SIGNAL(gotFocus(void)), | 1403 | connect(menuList, SIGNAL(gotFocus(struct menu *)), |
1404 | helpText, SLOT(setInfo(struct menu *))); | ||
1405 | connect(menuList, SIGNAL(gotFocus(struct menu *)), | ||
955 | SLOT(listFocusChanged(void))); | 1406 | SLOT(listFocusChanged(void))); |
1407 | connect(helpText, SIGNAL(menuSelected(struct menu *)), | ||
1408 | SLOT(setMenuLink(struct menu *))); | ||
956 | 1409 | ||
957 | #if QT_VERSION >= 300 | 1410 | QString listMode = configSettings->readEntry("/listMode", "symbol"); |
958 | QString listMode = configSettings->readEntry("/kconfig/qconf/listMode", "symbol"); | ||
959 | if (listMode == "single") | 1411 | if (listMode == "single") |
960 | showSingleView(); | 1412 | showSingleView(); |
961 | else if (listMode == "full") | 1413 | else if (listMode == "full") |
@@ -964,162 +1416,13 @@ ConfigMainWindow::ConfigMainWindow(void) | |||
964 | showSplitView(); | 1416 | showSplitView(); |
965 | 1417 | ||
966 | // UI setup done, restore splitter positions | 1418 | // UI setup done, restore splitter positions |
967 | QValueList<int> sizes = configSettings->readSizes("/kconfig/qconf/split1", &ok); | 1419 | QValueList<int> sizes = configSettings->readSizes("/split1", &ok); |
968 | if (ok) | 1420 | if (ok) |
969 | split1->setSizes(sizes); | 1421 | split1->setSizes(sizes); |
970 | 1422 | ||
971 | sizes = configSettings->readSizes("/kconfig/qconf/split2", &ok); | 1423 | sizes = configSettings->readSizes("/split2", &ok); |
972 | if (ok) | 1424 | if (ok) |
973 | split2->setSizes(sizes); | 1425 | split2->setSizes(sizes); |
974 | #else | ||
975 | showSplitView(); | ||
976 | #endif | ||
977 | delete configSettings; | ||
978 | } | ||
979 | |||
980 | static QString print_filter(const QString &str) | ||
981 | { | ||
982 | QRegExp re("[<>&\"\\n]"); | ||
983 | QString res = str; | ||
984 | for (int i = 0; (i = res.find(re, i)) >= 0;) { | ||
985 | switch (res[i].latin1()) { | ||
986 | case '<': | ||
987 | res.replace(i, 1, "<"); | ||
988 | i += 4; | ||
989 | break; | ||
990 | case '>': | ||
991 | res.replace(i, 1, ">"); | ||
992 | i += 4; | ||
993 | break; | ||
994 | case '&': | ||
995 | res.replace(i, 1, "&"); | ||
996 | i += 5; | ||
997 | break; | ||
998 | case '"': | ||
999 | res.replace(i, 1, """); | ||
1000 | i += 6; | ||
1001 | break; | ||
1002 | case '\n': | ||
1003 | res.replace(i, 1, "<br>"); | ||
1004 | i += 4; | ||
1005 | break; | ||
1006 | } | ||
1007 | } | ||
1008 | return res; | ||
1009 | } | ||
1010 | |||
1011 | static void expr_print_help(void *data, const char *str) | ||
1012 | { | ||
1013 | reinterpret_cast<QString*>(data)->append(print_filter(str)); | ||
1014 | } | ||
1015 | |||
1016 | /* | ||
1017 | * display a new help entry as soon as a new menu entry is selected | ||
1018 | */ | ||
1019 | void ConfigMainWindow::setHelp(QListViewItem* item) | ||
1020 | { | ||
1021 | struct symbol* sym; | ||
1022 | struct menu* menu = 0; | ||
1023 | |||
1024 | configList->parent()->lineEdit->hide(); | ||
1025 | if (item) | ||
1026 | menu = ((ConfigItem*)item)->menu; | ||
1027 | if (!menu) { | ||
1028 | helpText->setText(QString::null); | ||
1029 | return; | ||
1030 | } | ||
1031 | |||
1032 | QString head, debug, help; | ||
1033 | menu = ((ConfigItem*)item)->menu; | ||
1034 | sym = menu->sym; | ||
1035 | if (sym) { | ||
1036 | if (menu->prompt) { | ||
1037 | head += "<big><b>"; | ||
1038 | head += print_filter(_(menu->prompt->text)); | ||
1039 | head += "</b></big>"; | ||
1040 | if (sym->name) { | ||
1041 | head += " ("; | ||
1042 | head += print_filter(_(sym->name)); | ||
1043 | head += ")"; | ||
1044 | } | ||
1045 | } else if (sym->name) { | ||
1046 | head += "<big><b>"; | ||
1047 | head += print_filter(_(sym->name)); | ||
1048 | head += "</b></big>"; | ||
1049 | } | ||
1050 | head += "<br><br>"; | ||
1051 | |||
1052 | if (showDebug) { | ||
1053 | debug += "type: "; | ||
1054 | debug += print_filter(sym_type_name(sym->type)); | ||
1055 | if (sym_is_choice(sym)) | ||
1056 | debug += " (choice)"; | ||
1057 | debug += "<br>"; | ||
1058 | if (sym->rev_dep.expr) { | ||
1059 | debug += "reverse dep: "; | ||
1060 | expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE); | ||
1061 | debug += "<br>"; | ||
1062 | } | ||
1063 | for (struct property *prop = sym->prop; prop; prop = prop->next) { | ||
1064 | switch (prop->type) { | ||
1065 | case P_PROMPT: | ||
1066 | case P_MENU: | ||
1067 | debug += "prompt: "; | ||
1068 | debug += print_filter(_(prop->text)); | ||
1069 | debug += "<br>"; | ||
1070 | break; | ||
1071 | case P_DEFAULT: | ||
1072 | debug += "default: "; | ||
1073 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1074 | debug += "<br>"; | ||
1075 | break; | ||
1076 | case P_CHOICE: | ||
1077 | if (sym_is_choice(sym)) { | ||
1078 | debug += "choice: "; | ||
1079 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1080 | debug += "<br>"; | ||
1081 | } | ||
1082 | break; | ||
1083 | case P_SELECT: | ||
1084 | debug += "select: "; | ||
1085 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1086 | debug += "<br>"; | ||
1087 | break; | ||
1088 | case P_RANGE: | ||
1089 | debug += "range: "; | ||
1090 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
1091 | debug += "<br>"; | ||
1092 | break; | ||
1093 | default: | ||
1094 | debug += "unknown property: "; | ||
1095 | debug += prop_get_type_name(prop->type); | ||
1096 | debug += "<br>"; | ||
1097 | } | ||
1098 | if (prop->visible.expr) { | ||
1099 | debug += " dep: "; | ||
1100 | expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE); | ||
1101 | debug += "<br>"; | ||
1102 | } | ||
1103 | } | ||
1104 | debug += "<br>"; | ||
1105 | } | ||
1106 | |||
1107 | help = print_filter(_(sym->help)); | ||
1108 | } else if (menu->prompt) { | ||
1109 | head += "<big><b>"; | ||
1110 | head += print_filter(_(menu->prompt->text)); | ||
1111 | head += "</b></big><br><br>"; | ||
1112 | if (showDebug) { | ||
1113 | if (menu->prompt->visible.expr) { | ||
1114 | debug += " dep: "; | ||
1115 | expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); | ||
1116 | debug += "<br><br>"; | ||
1117 | } | ||
1118 | } | ||
1119 | } | ||
1120 | if (showDebug) | ||
1121 | debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); | ||
1122 | helpText->setText(head + debug + help); | ||
1123 | } | 1426 | } |
1124 | 1427 | ||
1125 | void ConfigMainWindow::loadConfig(void) | 1428 | void ConfigMainWindow::loadConfig(void) |
@@ -1147,21 +1450,73 @@ void ConfigMainWindow::saveConfigAs(void) | |||
1147 | QMessageBox::information(this, "qconf", "Unable to save configuration!"); | 1450 | QMessageBox::information(this, "qconf", "Unable to save configuration!"); |
1148 | } | 1451 | } |
1149 | 1452 | ||
1453 | void ConfigMainWindow::searchConfig(void) | ||
1454 | { | ||
1455 | if (!searchWindow) | ||
1456 | searchWindow = new ConfigSearchWindow(this, "search"); | ||
1457 | searchWindow->show(); | ||
1458 | } | ||
1459 | |||
1150 | void ConfigMainWindow::changeMenu(struct menu *menu) | 1460 | void ConfigMainWindow::changeMenu(struct menu *menu) |
1151 | { | 1461 | { |
1152 | configList->setRootMenu(menu); | 1462 | configList->setRootMenu(menu); |
1153 | backAction->setEnabled(TRUE); | 1463 | backAction->setEnabled(TRUE); |
1154 | } | 1464 | } |
1155 | 1465 | ||
1156 | void ConfigMainWindow::listFocusChanged(void) | 1466 | void ConfigMainWindow::setMenuLink(struct menu *menu) |
1157 | { | 1467 | { |
1158 | if (menuList->hasFocus()) { | 1468 | struct menu *parent; |
1159 | if (menuList->mode == menuMode) | 1469 | ConfigList* list = NULL; |
1470 | ConfigItem* item; | ||
1471 | |||
1472 | if (!menu_is_visible(menu) && !configView->showAll()) | ||
1473 | return; | ||
1474 | |||
1475 | switch (configList->mode) { | ||
1476 | case singleMode: | ||
1477 | list = configList; | ||
1478 | parent = menu_get_parent_menu(menu); | ||
1479 | if (!parent) | ||
1480 | return; | ||
1481 | list->setRootMenu(parent); | ||
1482 | break; | ||
1483 | case symbolMode: | ||
1484 | if (menu->flags & MENU_ROOT) { | ||
1485 | configList->setRootMenu(menu); | ||
1160 | configList->clearSelection(); | 1486 | configList->clearSelection(); |
1161 | setHelp(menuList->selectedItem()); | 1487 | list = menuList; |
1162 | } else if (configList->hasFocus()) { | 1488 | } else { |
1163 | setHelp(configList->selectedItem()); | 1489 | list = configList; |
1490 | parent = menu_get_parent_menu(menu->parent); | ||
1491 | if (!parent) | ||
1492 | return; | ||
1493 | item = menuList->findConfigItem(parent); | ||
1494 | if (item) { | ||
1495 | menuList->setSelected(item, TRUE); | ||
1496 | menuList->ensureItemVisible(item); | ||
1497 | } | ||
1498 | list->setRootMenu(parent); | ||
1499 | } | ||
1500 | break; | ||
1501 | case fullMode: | ||
1502 | list = configList; | ||
1503 | break; | ||
1164 | } | 1504 | } |
1505 | |||
1506 | if (list) { | ||
1507 | item = list->findConfigItem(menu); | ||
1508 | if (item) { | ||
1509 | list->setSelected(item, TRUE); | ||
1510 | list->ensureItemVisible(item); | ||
1511 | list->setFocus(); | ||
1512 | } | ||
1513 | } | ||
1514 | } | ||
1515 | |||
1516 | void ConfigMainWindow::listFocusChanged(void) | ||
1517 | { | ||
1518 | if (menuList->mode == menuMode) | ||
1519 | configList->clearSelection(); | ||
1165 | } | 1520 | } |
1166 | 1521 | ||
1167 | void ConfigMainWindow::goBack(void) | 1522 | void ConfigMainWindow::goBack(void) |
@@ -1223,53 +1578,6 @@ void ConfigMainWindow::showFullView(void) | |||
1223 | configList->setFocus(); | 1578 | configList->setFocus(); |
1224 | } | 1579 | } |
1225 | 1580 | ||
1226 | void ConfigMainWindow::setShowAll(bool b) | ||
1227 | { | ||
1228 | if (configList->showAll == b) | ||
1229 | return; | ||
1230 | configList->showAll = b; | ||
1231 | configList->updateListAll(); | ||
1232 | menuList->showAll = b; | ||
1233 | menuList->updateListAll(); | ||
1234 | } | ||
1235 | |||
1236 | void ConfigMainWindow::setShowDebug(bool b) | ||
1237 | { | ||
1238 | if (showDebug == b) | ||
1239 | return; | ||
1240 | showDebug = b; | ||
1241 | } | ||
1242 | |||
1243 | void ConfigMainWindow::setShowName(bool b) | ||
1244 | { | ||
1245 | if (configList->showName == b) | ||
1246 | return; | ||
1247 | configList->showName = b; | ||
1248 | configList->reinit(); | ||
1249 | menuList->showName = b; | ||
1250 | menuList->reinit(); | ||
1251 | } | ||
1252 | |||
1253 | void ConfigMainWindow::setShowRange(bool b) | ||
1254 | { | ||
1255 | if (configList->showRange == b) | ||
1256 | return; | ||
1257 | configList->showRange = b; | ||
1258 | configList->reinit(); | ||
1259 | menuList->showRange = b; | ||
1260 | menuList->reinit(); | ||
1261 | } | ||
1262 | |||
1263 | void ConfigMainWindow::setShowData(bool b) | ||
1264 | { | ||
1265 | if (configList->showData == b) | ||
1266 | return; | ||
1267 | configList->showData = b; | ||
1268 | configList->reinit(); | ||
1269 | menuList->showData = b; | ||
1270 | menuList->reinit(); | ||
1271 | } | ||
1272 | |||
1273 | /* | 1581 | /* |
1274 | * ask for saving configuration before quitting | 1582 | * ask for saving configuration before quitting |
1275 | * TODO ask only when something changed | 1583 | * TODO ask only when something changed |
@@ -1324,17 +1632,10 @@ void ConfigMainWindow::showAbout(void) | |||
1324 | 1632 | ||
1325 | void ConfigMainWindow::saveSettings(void) | 1633 | void ConfigMainWindow::saveSettings(void) |
1326 | { | 1634 | { |
1327 | #if QT_VERSION >= 300 | 1635 | configSettings->writeEntry("/window x", pos().x()); |
1328 | ConfigSettings *configSettings = new ConfigSettings; | 1636 | configSettings->writeEntry("/window y", pos().y()); |
1329 | configSettings->writeEntry("/kconfig/qconf/window x", pos().x()); | 1637 | configSettings->writeEntry("/window width", size().width()); |
1330 | configSettings->writeEntry("/kconfig/qconf/window y", pos().y()); | 1638 | configSettings->writeEntry("/window height", size().height()); |
1331 | configSettings->writeEntry("/kconfig/qconf/window width", size().width()); | ||
1332 | configSettings->writeEntry("/kconfig/qconf/window height", size().height()); | ||
1333 | configSettings->writeEntry("/kconfig/qconf/showName", configList->showName); | ||
1334 | configSettings->writeEntry("/kconfig/qconf/showRange", configList->showRange); | ||
1335 | configSettings->writeEntry("/kconfig/qconf/showData", configList->showData); | ||
1336 | configSettings->writeEntry("/kconfig/qconf/showAll", configList->showAll); | ||
1337 | configSettings->writeEntry("/kconfig/qconf/showDebug", showDebug); | ||
1338 | 1639 | ||
1339 | QString entry; | 1640 | QString entry; |
1340 | switch(configList->mode) { | 1641 | switch(configList->mode) { |
@@ -1350,13 +1651,10 @@ void ConfigMainWindow::saveSettings(void) | |||
1350 | entry = "full"; | 1651 | entry = "full"; |
1351 | break; | 1652 | break; |
1352 | } | 1653 | } |
1353 | configSettings->writeEntry("/kconfig/qconf/listMode", entry); | 1654 | configSettings->writeEntry("/listMode", entry); |
1354 | 1655 | ||
1355 | configSettings->writeSizes("/kconfig/qconf/split1", split1->sizes()); | 1656 | configSettings->writeSizes("/split1", split1->sizes()); |
1356 | configSettings->writeSizes("/kconfig/qconf/split2", split2->sizes()); | 1657 | configSettings->writeSizes("/split2", split2->sizes()); |
1357 | |||
1358 | delete configSettings; | ||
1359 | #endif | ||
1360 | } | 1658 | } |
1361 | 1659 | ||
1362 | void fixup_rootmenu(struct menu *menu) | 1660 | void fixup_rootmenu(struct menu *menu) |
@@ -1414,13 +1712,19 @@ int main(int ac, char** av) | |||
1414 | conf_read(NULL); | 1712 | conf_read(NULL); |
1415 | //zconfdump(stdout); | 1713 | //zconfdump(stdout); |
1416 | 1714 | ||
1715 | configSettings = new ConfigSettings(); | ||
1716 | configSettings->beginGroup("/kconfig/qconf"); | ||
1417 | v = new ConfigMainWindow(); | 1717 | v = new ConfigMainWindow(); |
1418 | 1718 | ||
1419 | //zconfdump(stdout); | 1719 | //zconfdump(stdout); |
1420 | v->show(); | 1720 | configApp->setMainWidget(v); |
1421 | configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); | 1721 | configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); |
1422 | configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); | 1722 | configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); |
1723 | v->show(); | ||
1423 | configApp->exec(); | 1724 | configApp->exec(); |
1424 | 1725 | ||
1726 | configSettings->endGroup(); | ||
1727 | delete configSettings; | ||
1728 | |||
1425 | return 0; | 1729 | return 0; |
1426 | } | 1730 | } |
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index e52f3e90bf0c..6a9e3b14c227 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -7,9 +7,25 @@ | |||
7 | #if QT_VERSION >= 300 | 7 | #if QT_VERSION >= 300 |
8 | #include <qsettings.h> | 8 | #include <qsettings.h> |
9 | #else | 9 | #else |
10 | class QSettings { }; | 10 | class QSettings { |
11 | public: | ||
12 | void beginGroup(const QString& group) { } | ||
13 | void endGroup(void) { } | ||
14 | bool readBoolEntry(const QString& key, bool def = FALSE, bool* ok = 0) const | ||
15 | { if (ok) *ok = FALSE; return def; } | ||
16 | int readNumEntry(const QString& key, int def = 0, bool* ok = 0) const | ||
17 | { if (ok) *ok = FALSE; return def; } | ||
18 | QString readEntry(const QString& key, const QString& def = QString::null, bool* ok = 0) const | ||
19 | { if (ok) *ok = FALSE; return def; } | ||
20 | QStringList readListEntry(const QString& key, bool* ok = 0) const | ||
21 | { if (ok) *ok = FALSE; return QStringList(); } | ||
22 | template <class t> | ||
23 | bool writeEntry(const QString& key, t value) | ||
24 | { return TRUE; } | ||
25 | }; | ||
11 | #endif | 26 | #endif |
12 | 27 | ||
28 | class ConfigView; | ||
13 | class ConfigList; | 29 | class ConfigList; |
14 | class ConfigItem; | 30 | class ConfigItem; |
15 | class ConfigLineEdit; | 31 | class ConfigLineEdit; |
@@ -18,64 +34,38 @@ class ConfigMainWindow; | |||
18 | 34 | ||
19 | class ConfigSettings : public QSettings { | 35 | class ConfigSettings : public QSettings { |
20 | public: | 36 | public: |
21 | ConfigSettings(); | ||
22 | |||
23 | #if QT_VERSION >= 300 | ||
24 | void readListSettings(); | ||
25 | QValueList<int> readSizes(const QString& key, bool *ok); | 37 | QValueList<int> readSizes(const QString& key, bool *ok); |
26 | bool writeSizes(const QString& key, const QValueList<int>& value); | 38 | bool writeSizes(const QString& key, const QValueList<int>& value); |
27 | #endif | ||
28 | |||
29 | bool showAll; | ||
30 | bool showName; | ||
31 | bool showRange; | ||
32 | bool showData; | ||
33 | }; | ||
34 | |||
35 | class ConfigView : public QVBox { | ||
36 | Q_OBJECT | ||
37 | typedef class QVBox Parent; | ||
38 | public: | ||
39 | ConfigView(QWidget* parent, ConfigMainWindow* cview, ConfigSettings* configSettings); | ||
40 | ~ConfigView(void); | ||
41 | static void updateList(ConfigItem* item); | ||
42 | static void updateListAll(void); | ||
43 | |||
44 | public: | ||
45 | ConfigList* list; | ||
46 | ConfigLineEdit* lineEdit; | ||
47 | |||
48 | static ConfigView* viewList; | ||
49 | ConfigView* nextView; | ||
50 | }; | 39 | }; |
51 | 40 | ||
52 | enum colIdx { | 41 | enum colIdx { |
53 | promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr | 42 | promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr |
54 | }; | 43 | }; |
55 | enum listMode { | 44 | enum listMode { |
56 | singleMode, menuMode, symbolMode, fullMode | 45 | singleMode, menuMode, symbolMode, fullMode, listMode |
57 | }; | 46 | }; |
58 | 47 | ||
59 | class ConfigList : public QListView { | 48 | class ConfigList : public QListView { |
60 | Q_OBJECT | 49 | Q_OBJECT |
61 | typedef class QListView Parent; | 50 | typedef class QListView Parent; |
62 | public: | 51 | public: |
63 | ConfigList(ConfigView* p, ConfigMainWindow* cview, ConfigSettings *configSettings); | 52 | ConfigList(ConfigView* p, const char *name = 0); |
64 | void reinit(void); | 53 | void reinit(void); |
65 | ConfigView* parent(void) const | 54 | ConfigView* parent(void) const |
66 | { | 55 | { |
67 | return (ConfigView*)Parent::parent(); | 56 | return (ConfigView*)Parent::parent(); |
68 | } | 57 | } |
58 | ConfigItem* findConfigItem(struct menu *); | ||
69 | 59 | ||
70 | protected: | 60 | protected: |
71 | ConfigMainWindow* cview; | ||
72 | |||
73 | void keyPressEvent(QKeyEvent *e); | 61 | void keyPressEvent(QKeyEvent *e); |
74 | void contentsMousePressEvent(QMouseEvent *e); | 62 | void contentsMousePressEvent(QMouseEvent *e); |
75 | void contentsMouseReleaseEvent(QMouseEvent *e); | 63 | void contentsMouseReleaseEvent(QMouseEvent *e); |
76 | void contentsMouseMoveEvent(QMouseEvent *e); | 64 | void contentsMouseMoveEvent(QMouseEvent *e); |
77 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | 65 | void contentsMouseDoubleClickEvent(QMouseEvent *e); |
78 | void focusInEvent(QFocusEvent *e); | 66 | void focusInEvent(QFocusEvent *e); |
67 | void contextMenuEvent(QContextMenuEvent *e); | ||
68 | |||
79 | public slots: | 69 | public slots: |
80 | void setRootMenu(struct menu *menu); | 70 | void setRootMenu(struct menu *menu); |
81 | 71 | ||
@@ -83,10 +73,12 @@ public slots: | |||
83 | void setValue(ConfigItem* item, tristate val); | 73 | void setValue(ConfigItem* item, tristate val); |
84 | void changeValue(ConfigItem* item); | 74 | void changeValue(ConfigItem* item); |
85 | void updateSelection(void); | 75 | void updateSelection(void); |
76 | void saveSettings(void); | ||
86 | signals: | 77 | signals: |
78 | void menuChanged(struct menu *menu); | ||
87 | void menuSelected(struct menu *menu); | 79 | void menuSelected(struct menu *menu); |
88 | void parentSelected(void); | 80 | void parentSelected(void); |
89 | void gotFocus(void); | 81 | void gotFocus(struct menu *); |
90 | 82 | ||
91 | public: | 83 | public: |
92 | void updateListAll(void) | 84 | void updateListAll(void) |
@@ -137,6 +129,7 @@ public: | |||
137 | struct menu *rootEntry; | 129 | struct menu *rootEntry; |
138 | QColorGroup disabledColorGroup; | 130 | QColorGroup disabledColorGroup; |
139 | QColorGroup inactivedColorGroup; | 131 | QColorGroup inactivedColorGroup; |
132 | QPopupMenu* headerPopup; | ||
140 | 133 | ||
141 | private: | 134 | private: |
142 | int colMap[colNr]; | 135 | int colMap[colNr]; |
@@ -208,9 +201,7 @@ class ConfigLineEdit : public QLineEdit { | |||
208 | Q_OBJECT | 201 | Q_OBJECT |
209 | typedef class QLineEdit Parent; | 202 | typedef class QLineEdit Parent; |
210 | public: | 203 | public: |
211 | ConfigLineEdit(ConfigView* parent) | 204 | ConfigLineEdit(ConfigView* parent); |
212 | : Parent(parent) | ||
213 | { } | ||
214 | ConfigView* parent(void) const | 205 | ConfigView* parent(void) const |
215 | { | 206 | { |
216 | return (ConfigView*)Parent::parent(); | 207 | return (ConfigView*)Parent::parent(); |
@@ -222,26 +213,104 @@ public: | |||
222 | ConfigItem *item; | 213 | ConfigItem *item; |
223 | }; | 214 | }; |
224 | 215 | ||
216 | class ConfigView : public QVBox { | ||
217 | Q_OBJECT | ||
218 | typedef class QVBox Parent; | ||
219 | public: | ||
220 | ConfigView(QWidget* parent, const char *name = 0); | ||
221 | ~ConfigView(void); | ||
222 | static void updateList(ConfigItem* item); | ||
223 | static void updateListAll(void); | ||
224 | |||
225 | bool showAll(void) const { return list->showAll; } | ||
226 | bool showName(void) const { return list->showName; } | ||
227 | bool showRange(void) const { return list->showRange; } | ||
228 | bool showData(void) const { return list->showData; } | ||
229 | public slots: | ||
230 | void setShowAll(bool); | ||
231 | void setShowName(bool); | ||
232 | void setShowRange(bool); | ||
233 | void setShowData(bool); | ||
234 | signals: | ||
235 | void showAllChanged(bool); | ||
236 | void showNameChanged(bool); | ||
237 | void showRangeChanged(bool); | ||
238 | void showDataChanged(bool); | ||
239 | public: | ||
240 | ConfigList* list; | ||
241 | ConfigLineEdit* lineEdit; | ||
242 | |||
243 | static ConfigView* viewList; | ||
244 | ConfigView* nextView; | ||
245 | }; | ||
246 | |||
247 | class ConfigInfoView : public QTextBrowser { | ||
248 | Q_OBJECT | ||
249 | typedef class QTextBrowser Parent; | ||
250 | public: | ||
251 | ConfigInfoView(QWidget* parent, const char *name = 0); | ||
252 | bool showDebug(void) const { return _showDebug; } | ||
253 | |||
254 | public slots: | ||
255 | void setInfo(struct menu *menu); | ||
256 | void saveSettings(void); | ||
257 | void setSource(const QString& name); | ||
258 | void setShowDebug(bool); | ||
259 | |||
260 | signals: | ||
261 | void showDebugChanged(bool); | ||
262 | void menuSelected(struct menu *); | ||
263 | |||
264 | protected: | ||
265 | void symbolInfo(void); | ||
266 | void menuInfo(void); | ||
267 | QString debug_info(struct symbol *sym); | ||
268 | static QString print_filter(const QString &str); | ||
269 | static void expr_print_help(void *data, struct symbol *sym, const char *str); | ||
270 | QPopupMenu* createPopupMenu(const QPoint& pos); | ||
271 | void contentsContextMenuEvent(QContextMenuEvent *e); | ||
272 | |||
273 | struct symbol *sym; | ||
274 | struct menu *menu; | ||
275 | bool _showDebug; | ||
276 | }; | ||
277 | |||
278 | class ConfigSearchWindow : public QDialog { | ||
279 | Q_OBJECT | ||
280 | typedef class QDialog Parent; | ||
281 | public: | ||
282 | ConfigSearchWindow(QWidget* parent, const char *name = 0); | ||
283 | |||
284 | public slots: | ||
285 | void saveSettings(void); | ||
286 | void search(void); | ||
287 | |||
288 | protected: | ||
289 | QLineEdit* editField; | ||
290 | QPushButton* searchButton; | ||
291 | QSplitter* split; | ||
292 | ConfigView* list; | ||
293 | ConfigInfoView* info; | ||
294 | |||
295 | struct symbol **result; | ||
296 | }; | ||
297 | |||
225 | class ConfigMainWindow : public QMainWindow { | 298 | class ConfigMainWindow : public QMainWindow { |
226 | Q_OBJECT | 299 | Q_OBJECT |
227 | public: | 300 | public: |
228 | ConfigMainWindow(void); | 301 | ConfigMainWindow(void); |
229 | public slots: | 302 | public slots: |
230 | void setHelp(QListViewItem* item); | ||
231 | void changeMenu(struct menu *); | 303 | void changeMenu(struct menu *); |
304 | void setMenuLink(struct menu *); | ||
232 | void listFocusChanged(void); | 305 | void listFocusChanged(void); |
233 | void goBack(void); | 306 | void goBack(void); |
234 | void loadConfig(void); | 307 | void loadConfig(void); |
235 | void saveConfig(void); | 308 | void saveConfig(void); |
236 | void saveConfigAs(void); | 309 | void saveConfigAs(void); |
310 | void searchConfig(void); | ||
237 | void showSingleView(void); | 311 | void showSingleView(void); |
238 | void showSplitView(void); | 312 | void showSplitView(void); |
239 | void showFullView(void); | 313 | void showFullView(void); |
240 | void setShowAll(bool); | ||
241 | void setShowDebug(bool); | ||
242 | void setShowRange(bool); | ||
243 | void setShowName(bool); | ||
244 | void setShowData(bool); | ||
245 | void showIntro(void); | 314 | void showIntro(void); |
246 | void showAbout(void); | 315 | void showAbout(void); |
247 | void saveSettings(void); | 316 | void saveSettings(void); |
@@ -249,15 +318,14 @@ public slots: | |||
249 | protected: | 318 | protected: |
250 | void closeEvent(QCloseEvent *e); | 319 | void closeEvent(QCloseEvent *e); |
251 | 320 | ||
321 | ConfigSearchWindow *searchWindow; | ||
252 | ConfigView *menuView; | 322 | ConfigView *menuView; |
253 | ConfigList *menuList; | 323 | ConfigList *menuList; |
254 | ConfigView *configView; | 324 | ConfigView *configView; |
255 | ConfigList *configList; | 325 | ConfigList *configList; |
256 | QTextView *helpText; | 326 | ConfigInfoView *helpText; |
257 | QToolBar *toolBar; | 327 | QToolBar *toolBar; |
258 | QAction *backAction; | 328 | QAction *backAction; |
259 | QSplitter* split1; | 329 | QSplitter* split1; |
260 | QSplitter* split2; | 330 | QSplitter* split2; |
261 | |||
262 | bool showDebug; | ||
263 | }; | 331 | }; |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index 3d7877afccd5..ee225ced2ce4 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -15,15 +15,15 @@ | |||
15 | struct symbol symbol_yes = { | 15 | struct symbol symbol_yes = { |
16 | .name = "y", | 16 | .name = "y", |
17 | .curr = { "y", yes }, | 17 | .curr = { "y", yes }, |
18 | .flags = SYMBOL_YES|SYMBOL_VALID, | 18 | .flags = SYMBOL_CONST|SYMBOL_VALID, |
19 | }, symbol_mod = { | 19 | }, symbol_mod = { |
20 | .name = "m", | 20 | .name = "m", |
21 | .curr = { "m", mod }, | 21 | .curr = { "m", mod }, |
22 | .flags = SYMBOL_MOD|SYMBOL_VALID, | 22 | .flags = SYMBOL_CONST|SYMBOL_VALID, |
23 | }, symbol_no = { | 23 | }, symbol_no = { |
24 | .name = "n", | 24 | .name = "n", |
25 | .curr = { "n", no }, | 25 | .curr = { "n", no }, |
26 | .flags = SYMBOL_NO|SYMBOL_VALID, | 26 | .flags = SYMBOL_CONST|SYMBOL_VALID, |
27 | }, symbol_empty = { | 27 | }, symbol_empty = { |
28 | .name = "", | 28 | .name = "", |
29 | .curr = { "", no }, | 29 | .curr = { "", no }, |
@@ -31,6 +31,7 @@ struct symbol symbol_yes = { | |||
31 | }; | 31 | }; |
32 | 32 | ||
33 | int sym_change_count; | 33 | int sym_change_count; |
34 | struct symbol *sym_defconfig_list; | ||
34 | struct symbol *modules_sym; | 35 | struct symbol *modules_sym; |
35 | tristate modules_val; | 36 | tristate modules_val; |
36 | 37 | ||
@@ -227,7 +228,7 @@ static struct symbol *sym_calc_choice(struct symbol *sym) | |||
227 | struct expr *e; | 228 | struct expr *e; |
228 | 229 | ||
229 | /* is the user choice visible? */ | 230 | /* is the user choice visible? */ |
230 | def_sym = sym->user.val; | 231 | def_sym = sym->def[S_DEF_USER].val; |
231 | if (def_sym) { | 232 | if (def_sym) { |
232 | sym_calc_visibility(def_sym); | 233 | sym_calc_visibility(def_sym); |
233 | if (def_sym->visible != no) | 234 | if (def_sym->visible != no) |
@@ -306,7 +307,7 @@ void sym_calc_value(struct symbol *sym) | |||
306 | } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { | 307 | } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { |
307 | sym->flags |= SYMBOL_WRITE; | 308 | sym->flags |= SYMBOL_WRITE; |
308 | if (sym_has_value(sym)) | 309 | if (sym_has_value(sym)) |
309 | newval.tri = sym->user.tri; | 310 | newval.tri = sym->def[S_DEF_USER].tri; |
310 | else if (!sym_is_choice(sym)) { | 311 | else if (!sym_is_choice(sym)) { |
311 | prop = sym_get_default_prop(sym); | 312 | prop = sym_get_default_prop(sym); |
312 | if (prop) | 313 | if (prop) |
@@ -329,7 +330,7 @@ void sym_calc_value(struct symbol *sym) | |||
329 | if (sym->visible != no) { | 330 | if (sym->visible != no) { |
330 | sym->flags |= SYMBOL_WRITE; | 331 | sym->flags |= SYMBOL_WRITE; |
331 | if (sym_has_value(sym)) { | 332 | if (sym_has_value(sym)) { |
332 | newval.val = sym->user.val; | 333 | newval.val = sym->def[S_DEF_USER].val; |
333 | break; | 334 | break; |
334 | } | 335 | } |
335 | } | 336 | } |
@@ -352,10 +353,13 @@ void sym_calc_value(struct symbol *sym) | |||
352 | sym->curr.val = sym_calc_choice(sym); | 353 | sym->curr.val = sym_calc_choice(sym); |
353 | sym_validate_range(sym); | 354 | sym_validate_range(sym); |
354 | 355 | ||
355 | if (memcmp(&oldval, &sym->curr, sizeof(oldval))) | 356 | if (memcmp(&oldval, &sym->curr, sizeof(oldval))) { |
356 | sym_set_changed(sym); | 357 | sym_set_changed(sym); |
357 | if (modules_sym == sym) | 358 | if (modules_sym == sym) { |
358 | modules_val = modules_sym->curr.tri; | 359 | sym_set_all_changed(); |
360 | modules_val = modules_sym->curr.tri; | ||
361 | } | ||
362 | } | ||
359 | 363 | ||
360 | if (sym_is_choice(sym)) { | 364 | if (sym_is_choice(sym)) { |
361 | int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); | 365 | int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); |
@@ -426,8 +430,8 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val) | |||
426 | if (oldval != val && !sym_tristate_within_range(sym, val)) | 430 | if (oldval != val && !sym_tristate_within_range(sym, val)) |
427 | return false; | 431 | return false; |
428 | 432 | ||
429 | if (sym->flags & SYMBOL_NEW) { | 433 | if (!(sym->flags & SYMBOL_DEF_USER)) { |
430 | sym->flags &= ~SYMBOL_NEW; | 434 | sym->flags |= SYMBOL_DEF_USER; |
431 | sym_set_changed(sym); | 435 | sym_set_changed(sym); |
432 | } | 436 | } |
433 | /* | 437 | /* |
@@ -439,21 +443,18 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val) | |||
439 | struct property *prop; | 443 | struct property *prop; |
440 | struct expr *e; | 444 | struct expr *e; |
441 | 445 | ||
442 | cs->user.val = sym; | 446 | cs->def[S_DEF_USER].val = sym; |
443 | cs->flags &= ~SYMBOL_NEW; | 447 | cs->flags |= SYMBOL_DEF_USER; |
444 | prop = sym_get_choice_prop(cs); | 448 | prop = sym_get_choice_prop(cs); |
445 | for (e = prop->expr; e; e = e->left.expr) { | 449 | for (e = prop->expr; e; e = e->left.expr) { |
446 | if (e->right.sym->visible != no) | 450 | if (e->right.sym->visible != no) |
447 | e->right.sym->flags &= ~SYMBOL_NEW; | 451 | e->right.sym->flags |= SYMBOL_DEF_USER; |
448 | } | 452 | } |
449 | } | 453 | } |
450 | 454 | ||
451 | sym->user.tri = val; | 455 | sym->def[S_DEF_USER].tri = val; |
452 | if (oldval != val) { | 456 | if (oldval != val) |
453 | sym_clear_all_valid(); | 457 | sym_clear_all_valid(); |
454 | if (sym == modules_sym) | ||
455 | sym_set_all_changed(); | ||
456 | } | ||
457 | 458 | ||
458 | return true; | 459 | return true; |
459 | } | 460 | } |
@@ -591,20 +592,20 @@ bool sym_set_string_value(struct symbol *sym, const char *newval) | |||
591 | if (!sym_string_within_range(sym, newval)) | 592 | if (!sym_string_within_range(sym, newval)) |
592 | return false; | 593 | return false; |
593 | 594 | ||
594 | if (sym->flags & SYMBOL_NEW) { | 595 | if (!(sym->flags & SYMBOL_DEF_USER)) { |
595 | sym->flags &= ~SYMBOL_NEW; | 596 | sym->flags |= SYMBOL_DEF_USER; |
596 | sym_set_changed(sym); | 597 | sym_set_changed(sym); |
597 | } | 598 | } |
598 | 599 | ||
599 | oldval = sym->user.val; | 600 | oldval = sym->def[S_DEF_USER].val; |
600 | size = strlen(newval) + 1; | 601 | size = strlen(newval) + 1; |
601 | if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { | 602 | if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { |
602 | size += 2; | 603 | size += 2; |
603 | sym->user.val = val = malloc(size); | 604 | sym->def[S_DEF_USER].val = val = malloc(size); |
604 | *val++ = '0'; | 605 | *val++ = '0'; |
605 | *val++ = 'x'; | 606 | *val++ = 'x'; |
606 | } else if (!oldval || strcmp(oldval, newval)) | 607 | } else if (!oldval || strcmp(oldval, newval)) |
607 | sym->user.val = val = malloc(size); | 608 | sym->def[S_DEF_USER].val = val = malloc(size); |
608 | else | 609 | else |
609 | return true; | 610 | return true; |
610 | 611 | ||
@@ -679,7 +680,6 @@ struct symbol *sym_lookup(const char *name, int isconst) | |||
679 | memset(symbol, 0, sizeof(*symbol)); | 680 | memset(symbol, 0, sizeof(*symbol)); |
680 | symbol->name = new_name; | 681 | symbol->name = new_name; |
681 | symbol->type = S_UNKNOWN; | 682 | symbol->type = S_UNKNOWN; |
682 | symbol->flags = SYMBOL_NEW; | ||
683 | if (isconst) | 683 | if (isconst) |
684 | symbol->flags |= SYMBOL_CONST; | 684 | symbol->flags |= SYMBOL_CONST; |
685 | 685 | ||
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 656d2c87d661..e3f28b9d59f4 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -44,7 +44,9 @@ int file_write_dep(const char *name) | |||
44 | else | 44 | else |
45 | fprintf(out, "\t%s\n", file->name); | 45 | fprintf(out, "\t%s\n", file->name); |
46 | } | 46 | } |
47 | fprintf(out, "\n.config include/linux/autoconf.h: $(deps_config)\n\n$(deps_config):\n"); | 47 | fprintf(out, "\ninclude/config/auto.conf: \\\n" |
48 | "\t$(deps_config)\n\n" | ||
49 | "$(deps_config): ;\n"); | ||
48 | fclose(out); | 50 | fclose(out); |
49 | rename("..config.tmp", name); | 51 | rename("..config.tmp", name); |
50 | return 0; | 52 | return 0; |
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf index b03220600b3a..9b44c80dd899 100644 --- a/scripts/kconfig/zconf.gperf +++ b/scripts/kconfig/zconf.gperf | |||
@@ -39,5 +39,8 @@ string, T_TYPE, TF_COMMAND, S_STRING | |||
39 | select, T_SELECT, TF_COMMAND | 39 | select, T_SELECT, TF_COMMAND |
40 | enable, T_SELECT, TF_COMMAND | 40 | enable, T_SELECT, TF_COMMAND |
41 | range, T_RANGE, TF_COMMAND | 41 | range, T_RANGE, TF_COMMAND |
42 | option, T_OPTION, TF_COMMAND | ||
42 | on, T_ON, TF_PARAM | 43 | on, T_ON, TF_PARAM |
44 | modules, T_OPT_MODULES, TF_OPTION | ||
45 | defconfig_list, T_OPT_DEFCONFIG_LIST,TF_OPTION | ||
43 | %% | 46 | %% |
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index 345f0fc07ca3..47c8b5babf34 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped | |||
@@ -53,10 +53,10 @@ kconf_id_hash (register const char *str, register unsigned int len) | |||
53 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | 53 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, |
54 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | 54 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, |
55 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | 55 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, |
56 | 47, 47, 47, 47, 47, 47, 47, 25, 10, 15, | 56 | 47, 47, 47, 47, 47, 47, 47, 25, 30, 15, |
57 | 0, 0, 5, 47, 0, 0, 47, 47, 0, 10, | 57 | 0, 15, 0, 47, 5, 15, 47, 47, 30, 20, |
58 | 0, 20, 20, 20, 5, 0, 0, 20, 47, 47, | 58 | 5, 0, 25, 15, 0, 0, 10, 35, 47, 47, |
59 | 20, 47, 47, 47, 47, 47, 47, 47, 47, 47, | 59 | 5, 47, 47, 47, 47, 47, 47, 47, 47, 47, |
60 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | 60 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, |
61 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | 61 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, |
62 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, | 62 | 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, |
@@ -88,69 +88,75 @@ kconf_id_hash (register const char *str, register unsigned int len) | |||
88 | 88 | ||
89 | struct kconf_id_strings_t | 89 | struct kconf_id_strings_t |
90 | { | 90 | { |
91 | char kconf_id_strings_str2[sizeof("if")]; | 91 | char kconf_id_strings_str2[sizeof("on")]; |
92 | char kconf_id_strings_str3[sizeof("int")]; | 92 | char kconf_id_strings_str6[sizeof("string")]; |
93 | char kconf_id_strings_str4[sizeof("help")]; | 93 | char kconf_id_strings_str7[sizeof("default")]; |
94 | char kconf_id_strings_str5[sizeof("endif")]; | 94 | char kconf_id_strings_str8[sizeof("def_bool")]; |
95 | char kconf_id_strings_str6[sizeof("select")]; | ||
96 | char kconf_id_strings_str7[sizeof("endmenu")]; | ||
97 | char kconf_id_strings_str8[sizeof("tristate")]; | ||
98 | char kconf_id_strings_str9[sizeof("endchoice")]; | ||
99 | char kconf_id_strings_str10[sizeof("range")]; | 95 | char kconf_id_strings_str10[sizeof("range")]; |
100 | char kconf_id_strings_str11[sizeof("string")]; | 96 | char kconf_id_strings_str11[sizeof("def_boolean")]; |
101 | char kconf_id_strings_str12[sizeof("default")]; | 97 | char kconf_id_strings_str12[sizeof("def_tristate")]; |
102 | char kconf_id_strings_str13[sizeof("def_bool")]; | 98 | char kconf_id_strings_str13[sizeof("hex")]; |
103 | char kconf_id_strings_str14[sizeof("menu")]; | 99 | char kconf_id_strings_str14[sizeof("defconfig_list")]; |
104 | char kconf_id_strings_str16[sizeof("def_boolean")]; | 100 | char kconf_id_strings_str16[sizeof("option")]; |
105 | char kconf_id_strings_str17[sizeof("def_tristate")]; | 101 | char kconf_id_strings_str17[sizeof("if")]; |
106 | char kconf_id_strings_str18[sizeof("mainmenu")]; | 102 | char kconf_id_strings_str18[sizeof("optional")]; |
107 | char kconf_id_strings_str20[sizeof("menuconfig")]; | 103 | char kconf_id_strings_str20[sizeof("endif")]; |
108 | char kconf_id_strings_str21[sizeof("config")]; | 104 | char kconf_id_strings_str21[sizeof("choice")]; |
109 | char kconf_id_strings_str22[sizeof("on")]; | 105 | char kconf_id_strings_str22[sizeof("endmenu")]; |
110 | char kconf_id_strings_str23[sizeof("hex")]; | 106 | char kconf_id_strings_str23[sizeof("requires")]; |
111 | char kconf_id_strings_str26[sizeof("source")]; | 107 | char kconf_id_strings_str24[sizeof("endchoice")]; |
112 | char kconf_id_strings_str27[sizeof("depends")]; | 108 | char kconf_id_strings_str26[sizeof("config")]; |
113 | char kconf_id_strings_str28[sizeof("optional")]; | 109 | char kconf_id_strings_str27[sizeof("modules")]; |
114 | char kconf_id_strings_str31[sizeof("enable")]; | 110 | char kconf_id_strings_str28[sizeof("int")]; |
115 | char kconf_id_strings_str32[sizeof("comment")]; | 111 | char kconf_id_strings_str29[sizeof("menu")]; |
116 | char kconf_id_strings_str33[sizeof("requires")]; | 112 | char kconf_id_strings_str31[sizeof("prompt")]; |
113 | char kconf_id_strings_str32[sizeof("depends")]; | ||
114 | char kconf_id_strings_str33[sizeof("tristate")]; | ||
117 | char kconf_id_strings_str34[sizeof("bool")]; | 115 | char kconf_id_strings_str34[sizeof("bool")]; |
116 | char kconf_id_strings_str35[sizeof("menuconfig")]; | ||
117 | char kconf_id_strings_str36[sizeof("select")]; | ||
118 | char kconf_id_strings_str37[sizeof("boolean")]; | 118 | char kconf_id_strings_str37[sizeof("boolean")]; |
119 | char kconf_id_strings_str41[sizeof("choice")]; | 119 | char kconf_id_strings_str39[sizeof("help")]; |
120 | char kconf_id_strings_str46[sizeof("prompt")]; | 120 | char kconf_id_strings_str41[sizeof("source")]; |
121 | char kconf_id_strings_str42[sizeof("comment")]; | ||
122 | char kconf_id_strings_str43[sizeof("mainmenu")]; | ||
123 | char kconf_id_strings_str46[sizeof("enable")]; | ||
121 | }; | 124 | }; |
122 | static struct kconf_id_strings_t kconf_id_strings_contents = | 125 | static struct kconf_id_strings_t kconf_id_strings_contents = |
123 | { | 126 | { |
124 | "if", | 127 | "on", |
125 | "int", | ||
126 | "help", | ||
127 | "endif", | ||
128 | "select", | ||
129 | "endmenu", | ||
130 | "tristate", | ||
131 | "endchoice", | ||
132 | "range", | ||
133 | "string", | 128 | "string", |
134 | "default", | 129 | "default", |
135 | "def_bool", | 130 | "def_bool", |
136 | "menu", | 131 | "range", |
137 | "def_boolean", | 132 | "def_boolean", |
138 | "def_tristate", | 133 | "def_tristate", |
139 | "mainmenu", | ||
140 | "menuconfig", | ||
141 | "config", | ||
142 | "on", | ||
143 | "hex", | 134 | "hex", |
144 | "source", | 135 | "defconfig_list", |
145 | "depends", | 136 | "option", |
137 | "if", | ||
146 | "optional", | 138 | "optional", |
147 | "enable", | 139 | "endif", |
148 | "comment", | 140 | "choice", |
141 | "endmenu", | ||
149 | "requires", | 142 | "requires", |
143 | "endchoice", | ||
144 | "config", | ||
145 | "modules", | ||
146 | "int", | ||
147 | "menu", | ||
148 | "prompt", | ||
149 | "depends", | ||
150 | "tristate", | ||
150 | "bool", | 151 | "bool", |
152 | "menuconfig", | ||
153 | "select", | ||
151 | "boolean", | 154 | "boolean", |
152 | "choice", | 155 | "help", |
153 | "prompt" | 156 | "source", |
157 | "comment", | ||
158 | "mainmenu", | ||
159 | "enable" | ||
154 | }; | 160 | }; |
155 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) | 161 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) |
156 | #ifdef __GNUC__ | 162 | #ifdef __GNUC__ |
@@ -161,9 +167,9 @@ kconf_id_lookup (register const char *str, register unsigned int len) | |||
161 | { | 167 | { |
162 | enum | 168 | enum |
163 | { | 169 | { |
164 | TOTAL_KEYWORDS = 30, | 170 | TOTAL_KEYWORDS = 33, |
165 | MIN_WORD_LENGTH = 2, | 171 | MIN_WORD_LENGTH = 2, |
166 | MAX_WORD_LENGTH = 12, | 172 | MAX_WORD_LENGTH = 14, |
167 | MIN_HASH_VALUE = 2, | 173 | MIN_HASH_VALUE = 2, |
168 | MAX_HASH_VALUE = 46 | 174 | MAX_HASH_VALUE = 46 |
169 | }; | 175 | }; |
@@ -171,43 +177,48 @@ kconf_id_lookup (register const char *str, register unsigned int len) | |||
171 | static struct kconf_id wordlist[] = | 177 | static struct kconf_id wordlist[] = |
172 | { | 178 | { |
173 | {-1}, {-1}, | 179 | {-1}, {-1}, |
174 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_IF, TF_COMMAND|TF_PARAM}, | 180 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM}, |
175 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_TYPE, TF_COMMAND, S_INT}, | 181 | {-1}, {-1}, {-1}, |
176 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str4, T_HELP, TF_COMMAND}, | 182 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_TYPE, TF_COMMAND, S_STRING}, |
177 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, | 183 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, |
178 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_SELECT, TF_COMMAND}, | 184 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, |
179 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND}, | 185 | {-1}, |
180 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TYPE, TF_COMMAND, S_TRISTATE}, | ||
181 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, | ||
182 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND}, | 186 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND}, |
183 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_TYPE, TF_COMMAND, S_STRING}, | 187 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, |
184 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, | 188 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_TRISTATE}, |
185 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, | 189 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_TYPE, TF_COMMAND, S_HEX}, |
186 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_MENU, TF_COMMAND}, | 190 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_OPT_DEFCONFIG_LIST,TF_OPTION}, |
187 | {-1}, | 191 | {-1}, |
188 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, | 192 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_OPTION, TF_COMMAND}, |
189 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE}, | 193 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_IF, TF_COMMAND|TF_PARAM}, |
190 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_MAINMENU, TF_COMMAND}, | 194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPTIONAL, TF_COMMAND}, |
191 | {-1}, | 195 | {-1}, |
192 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20, T_MENUCONFIG, TF_COMMAND}, | 196 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str20, T_ENDIF, TF_COMMAND}, |
193 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_CONFIG, TF_COMMAND}, | 197 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_CHOICE, TF_COMMAND}, |
194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ON, TF_PARAM}, | 198 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ENDMENU, TF_COMMAND}, |
195 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_HEX}, | 199 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_REQUIRES, TF_COMMAND}, |
196 | {-1}, {-1}, | 200 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str24, T_ENDCHOICE, TF_COMMAND}, |
197 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SOURCE, TF_COMMAND}, | 201 | {-1}, |
198 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_DEPENDS, TF_COMMAND}, | 202 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_CONFIG, TF_COMMAND}, |
199 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_OPTIONAL, TF_COMMAND}, | 203 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, |
200 | {-1}, {-1}, | 204 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_INT}, |
201 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND}, | 205 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, |
202 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, | 206 | {-1}, |
203 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_REQUIRES, TF_COMMAND}, | 207 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_PROMPT, TF_COMMAND}, |
208 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_DEPENDS, TF_COMMAND}, | ||
209 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_TRISTATE}, | ||
204 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34, T_TYPE, TF_COMMAND, S_BOOLEAN}, | 210 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str34, T_TYPE, TF_COMMAND, S_BOOLEAN}, |
205 | {-1}, {-1}, | 211 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND}, |
212 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_SELECT, TF_COMMAND}, | ||
206 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_TYPE, TF_COMMAND, S_BOOLEAN}, | 213 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_TYPE, TF_COMMAND, S_BOOLEAN}, |
207 | {-1}, {-1}, {-1}, | 214 | {-1}, |
208 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_CHOICE, TF_COMMAND}, | 215 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39, T_HELP, TF_COMMAND}, |
209 | {-1}, {-1}, {-1}, {-1}, | 216 | {-1}, |
210 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_PROMPT, TF_COMMAND} | 217 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SOURCE, TF_COMMAND}, |
218 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_COMMENT, TF_COMMAND}, | ||
219 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43, T_MAINMENU, TF_COMMAND}, | ||
220 | {-1}, {-1}, | ||
221 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND} | ||
211 | }; | 222 | }; |
212 | 223 | ||
213 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | 224 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index ea7755da82f5..2fb0a4fc61d0 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
@@ -1,7 +1,7 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.0. */ | 1 | /* A Bison parser, made by GNU Bison 2.1. */ |
2 | 2 | ||
3 | /* Skeleton parser for Yacc-like parsing with Bison, | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. |
5 | 5 | ||
6 | This program is free software; you can redistribute it and/or modify | 6 | This program is free software; you can redistribute it and/or modify |
7 | it under the terms of the GNU General Public License as published by | 7 | it under the terms of the GNU General Public License as published by |
@@ -15,8 +15,8 @@ | |||
15 | 15 | ||
16 | You should have received a copy of the GNU General Public License | 16 | You should have received a copy of the GNU General Public License |
17 | along with this program; if not, write to the Free Software | 17 | along with this program; if not, write to the Free Software |
18 | Foundation, Inc., 59 Temple Place - Suite 330, | 18 | Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 | Boston, MA 02111-1307, USA. */ | 19 | Boston, MA 02110-1301, USA. */ |
20 | 20 | ||
21 | /* As a special exception, when this file is copied by Bison into a | 21 | /* As a special exception, when this file is copied by Bison into a |
22 | Bison output file, you may use that output file without restriction. | 22 | Bison output file, you may use that output file without restriction. |
@@ -36,6 +36,9 @@ | |||
36 | /* Identify Bison output. */ | 36 | /* Identify Bison output. */ |
37 | #define YYBISON 1 | 37 | #define YYBISON 1 |
38 | 38 | ||
39 | /* Bison version. */ | ||
40 | #define YYBISON_VERSION "2.1" | ||
41 | |||
39 | /* Skeleton name. */ | 42 | /* Skeleton name. */ |
40 | #define YYSKELETON_NAME "yacc.c" | 43 | #define YYSKELETON_NAME "yacc.c" |
41 | 44 | ||
@@ -82,19 +85,21 @@ | |||
82 | T_DEFAULT = 276, | 85 | T_DEFAULT = 276, |
83 | T_SELECT = 277, | 86 | T_SELECT = 277, |
84 | T_RANGE = 278, | 87 | T_RANGE = 278, |
85 | T_ON = 279, | 88 | T_OPTION = 279, |
86 | T_WORD = 280, | 89 | T_ON = 280, |
87 | T_WORD_QUOTE = 281, | 90 | T_WORD = 281, |
88 | T_UNEQUAL = 282, | 91 | T_WORD_QUOTE = 282, |
89 | T_CLOSE_PAREN = 283, | 92 | T_UNEQUAL = 283, |
90 | T_OPEN_PAREN = 284, | 93 | T_CLOSE_PAREN = 284, |
91 | T_EOL = 285, | 94 | T_OPEN_PAREN = 285, |
92 | T_OR = 286, | 95 | T_EOL = 286, |
93 | T_AND = 287, | 96 | T_OR = 287, |
94 | T_EQUAL = 288, | 97 | T_AND = 288, |
95 | T_NOT = 289 | 98 | T_EQUAL = 289, |
99 | T_NOT = 290 | ||
96 | }; | 100 | }; |
97 | #endif | 101 | #endif |
102 | /* Tokens. */ | ||
98 | #define T_MAINMENU 258 | 103 | #define T_MAINMENU 258 |
99 | #define T_MENU 259 | 104 | #define T_MENU 259 |
100 | #define T_ENDMENU 260 | 105 | #define T_ENDMENU 260 |
@@ -116,17 +121,18 @@ | |||
116 | #define T_DEFAULT 276 | 121 | #define T_DEFAULT 276 |
117 | #define T_SELECT 277 | 122 | #define T_SELECT 277 |
118 | #define T_RANGE 278 | 123 | #define T_RANGE 278 |
119 | #define T_ON 279 | 124 | #define T_OPTION 279 |
120 | #define T_WORD 280 | 125 | #define T_ON 280 |
121 | #define T_WORD_QUOTE 281 | 126 | #define T_WORD 281 |
122 | #define T_UNEQUAL 282 | 127 | #define T_WORD_QUOTE 282 |
123 | #define T_CLOSE_PAREN 283 | 128 | #define T_UNEQUAL 283 |
124 | #define T_OPEN_PAREN 284 | 129 | #define T_CLOSE_PAREN 284 |
125 | #define T_EOL 285 | 130 | #define T_OPEN_PAREN 285 |
126 | #define T_OR 286 | 131 | #define T_EOL 286 |
127 | #define T_AND 287 | 132 | #define T_OR 287 |
128 | #define T_EQUAL 288 | 133 | #define T_AND 288 |
129 | #define T_NOT 289 | 134 | #define T_EQUAL 289 |
135 | #define T_NOT 290 | ||
130 | 136 | ||
131 | 137 | ||
132 | 138 | ||
@@ -187,6 +193,11 @@ static struct menu *current_menu, *current_entry; | |||
187 | # define YYERROR_VERBOSE 0 | 193 | # define YYERROR_VERBOSE 0 |
188 | #endif | 194 | #endif |
189 | 195 | ||
196 | /* Enabling the token table. */ | ||
197 | #ifndef YYTOKEN_TABLE | ||
198 | # define YYTOKEN_TABLE 0 | ||
199 | #endif | ||
200 | |||
190 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) | 201 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) |
191 | 202 | ||
192 | typedef union YYSTYPE { | 203 | typedef union YYSTYPE { |
@@ -197,7 +208,7 @@ typedef union YYSTYPE { | |||
197 | struct menu *menu; | 208 | struct menu *menu; |
198 | struct kconf_id *id; | 209 | struct kconf_id *id; |
199 | } YYSTYPE; | 210 | } YYSTYPE; |
200 | /* Line 190 of yacc.c. */ | 211 | /* Line 196 of yacc.c. */ |
201 | 212 | ||
202 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 213 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
203 | # define YYSTYPE_IS_DECLARED 1 | 214 | # define YYSTYPE_IS_DECLARED 1 |
@@ -209,17 +220,36 @@ typedef union YYSTYPE { | |||
209 | /* Copy the second part of user declarations. */ | 220 | /* Copy the second part of user declarations. */ |
210 | 221 | ||
211 | 222 | ||
212 | /* Line 213 of yacc.c. */ | 223 | /* Line 219 of yacc.c. */ |
213 | 224 | ||
214 | 225 | ||
215 | #if ! defined (yyoverflow) || YYERROR_VERBOSE | 226 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
227 | # define YYSIZE_T __SIZE_TYPE__ | ||
228 | #endif | ||
229 | #if ! defined (YYSIZE_T) && defined (size_t) | ||
230 | # define YYSIZE_T size_t | ||
231 | #endif | ||
232 | #if ! defined (YYSIZE_T) && (defined (__STDC__) || defined (__cplusplus)) | ||
233 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | ||
234 | # define YYSIZE_T size_t | ||
235 | #endif | ||
236 | #if ! defined (YYSIZE_T) | ||
237 | # define YYSIZE_T unsigned int | ||
238 | #endif | ||
216 | 239 | ||
217 | # ifndef YYFREE | 240 | #ifndef YY_ |
218 | # define YYFREE free | 241 | # if YYENABLE_NLS |
242 | # if ENABLE_NLS | ||
243 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | ||
244 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | ||
245 | # endif | ||
219 | # endif | 246 | # endif |
220 | # ifndef YYMALLOC | 247 | # ifndef YY_ |
221 | # define YYMALLOC malloc | 248 | # define YY_(msgid) msgid |
222 | # endif | 249 | # endif |
250 | #endif | ||
251 | |||
252 | #if ! defined (yyoverflow) || YYERROR_VERBOSE | ||
223 | 253 | ||
224 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | 254 | /* The parser invokes alloca or malloc; define the necessary symbols. */ |
225 | 255 | ||
@@ -229,6 +259,10 @@ typedef union YYSTYPE { | |||
229 | # define YYSTACK_ALLOC __builtin_alloca | 259 | # define YYSTACK_ALLOC __builtin_alloca |
230 | # else | 260 | # else |
231 | # define YYSTACK_ALLOC alloca | 261 | # define YYSTACK_ALLOC alloca |
262 | # if defined (__STDC__) || defined (__cplusplus) | ||
263 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
264 | # define YYINCLUDED_STDLIB_H | ||
265 | # endif | ||
232 | # endif | 266 | # endif |
233 | # endif | 267 | # endif |
234 | # endif | 268 | # endif |
@@ -236,13 +270,39 @@ typedef union YYSTYPE { | |||
236 | # ifdef YYSTACK_ALLOC | 270 | # ifdef YYSTACK_ALLOC |
237 | /* Pacify GCC's `empty if-body' warning. */ | 271 | /* Pacify GCC's `empty if-body' warning. */ |
238 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | 272 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) |
239 | # else | 273 | # ifndef YYSTACK_ALLOC_MAXIMUM |
240 | # if defined (__STDC__) || defined (__cplusplus) | 274 | /* The OS might guarantee only one guard page at the bottom of the stack, |
241 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | 275 | and a page size can be as small as 4096 bytes. So we cannot safely |
242 | # define YYSIZE_T size_t | 276 | invoke alloca (N) if N exceeds 4096. Use a slightly smaller number |
277 | to allow for a few compiler-allocated temporary stack slots. */ | ||
278 | # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2005 */ | ||
243 | # endif | 279 | # endif |
280 | # else | ||
244 | # define YYSTACK_ALLOC YYMALLOC | 281 | # define YYSTACK_ALLOC YYMALLOC |
245 | # define YYSTACK_FREE YYFREE | 282 | # define YYSTACK_FREE YYFREE |
283 | # ifndef YYSTACK_ALLOC_MAXIMUM | ||
284 | # define YYSTACK_ALLOC_MAXIMUM ((YYSIZE_T) -1) | ||
285 | # endif | ||
286 | # ifdef __cplusplus | ||
287 | extern "C" { | ||
288 | # endif | ||
289 | # ifndef YYMALLOC | ||
290 | # define YYMALLOC malloc | ||
291 | # if (! defined (malloc) && ! defined (YYINCLUDED_STDLIB_H) \ | ||
292 | && (defined (__STDC__) || defined (__cplusplus))) | ||
293 | void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ | ||
294 | # endif | ||
295 | # endif | ||
296 | # ifndef YYFREE | ||
297 | # define YYFREE free | ||
298 | # if (! defined (free) && ! defined (YYINCLUDED_STDLIB_H) \ | ||
299 | && (defined (__STDC__) || defined (__cplusplus))) | ||
300 | void free (void *); /* INFRINGES ON USER NAME SPACE */ | ||
301 | # endif | ||
302 | # endif | ||
303 | # ifdef __cplusplus | ||
304 | } | ||
305 | # endif | ||
246 | # endif | 306 | # endif |
247 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ | 307 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ |
248 | 308 | ||
@@ -277,7 +337,7 @@ union yyalloc | |||
277 | # define YYCOPY(To, From, Count) \ | 337 | # define YYCOPY(To, From, Count) \ |
278 | do \ | 338 | do \ |
279 | { \ | 339 | { \ |
280 | register YYSIZE_T yyi; \ | 340 | YYSIZE_T yyi; \ |
281 | for (yyi = 0; yyi < (Count); yyi++) \ | 341 | for (yyi = 0; yyi < (Count); yyi++) \ |
282 | (To)[yyi] = (From)[yyi]; \ | 342 | (To)[yyi] = (From)[yyi]; \ |
283 | } \ | 343 | } \ |
@@ -312,22 +372,22 @@ union yyalloc | |||
312 | /* YYFINAL -- State number of the termination state. */ | 372 | /* YYFINAL -- State number of the termination state. */ |
313 | #define YYFINAL 3 | 373 | #define YYFINAL 3 |
314 | /* YYLAST -- Last index in YYTABLE. */ | 374 | /* YYLAST -- Last index in YYTABLE. */ |
315 | #define YYLAST 264 | 375 | #define YYLAST 275 |
316 | 376 | ||
317 | /* YYNTOKENS -- Number of terminals. */ | 377 | /* YYNTOKENS -- Number of terminals. */ |
318 | #define YYNTOKENS 35 | 378 | #define YYNTOKENS 36 |
319 | /* YYNNTS -- Number of nonterminals. */ | 379 | /* YYNNTS -- Number of nonterminals. */ |
320 | #define YYNNTS 42 | 380 | #define YYNNTS 45 |
321 | /* YYNRULES -- Number of rules. */ | 381 | /* YYNRULES -- Number of rules. */ |
322 | #define YYNRULES 104 | 382 | #define YYNRULES 110 |
323 | /* YYNRULES -- Number of states. */ | 383 | /* YYNRULES -- Number of states. */ |
324 | #define YYNSTATES 175 | 384 | #define YYNSTATES 183 |
325 | 385 | ||
326 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | 386 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ |
327 | #define YYUNDEFTOK 2 | 387 | #define YYUNDEFTOK 2 |
328 | #define YYMAXUTOK 289 | 388 | #define YYMAXUTOK 290 |
329 | 389 | ||
330 | #define YYTRANSLATE(YYX) \ | 390 | #define YYTRANSLATE(YYX) \ |
331 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | 391 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) |
332 | 392 | ||
333 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | 393 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ |
@@ -361,7 +421,8 @@ static const unsigned char yytranslate[] = | |||
361 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | 421 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, |
362 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | 422 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, |
363 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | 423 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, |
364 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34 | 424 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, |
425 | 35 | ||
365 | }; | 426 | }; |
366 | 427 | ||
367 | #if YYDEBUG | 428 | #if YYDEBUG |
@@ -372,72 +433,75 @@ static const unsigned short int yyprhs[] = | |||
372 | 0, 0, 3, 5, 6, 9, 12, 15, 20, 23, | 433 | 0, 0, 3, 5, 6, 9, 12, 15, 20, 23, |
373 | 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, | 434 | 28, 33, 37, 39, 41, 43, 45, 47, 49, 51, |
374 | 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, | 435 | 53, 55, 57, 59, 61, 63, 67, 70, 74, 77, |
375 | 81, 84, 85, 88, 91, 94, 97, 100, 104, 109, | 436 | 81, 84, 85, 88, 91, 94, 97, 100, 103, 107, |
376 | 114, 119, 125, 128, 131, 133, 137, 138, 141, 144, | 437 | 112, 117, 122, 128, 132, 133, 137, 138, 141, 144, |
377 | 147, 150, 153, 158, 162, 165, 170, 171, 174, 178, | 438 | 147, 149, 153, 154, 157, 160, 163, 166, 169, 174, |
378 | 180, 184, 185, 188, 191, 194, 198, 201, 203, 207, | 439 | 178, 181, 186, 187, 190, 194, 196, 200, 201, 204, |
379 | 208, 211, 214, 217, 221, 225, 228, 231, 234, 235, | 440 | 207, 210, 214, 217, 219, 223, 224, 227, 230, 233, |
380 | 238, 241, 244, 249, 253, 257, 258, 261, 263, 265, | 441 | 237, 241, 244, 247, 250, 251, 254, 257, 260, 265, |
381 | 268, 271, 274, 276, 279, 280, 283, 285, 289, 293, | 442 | 269, 273, 274, 277, 279, 281, 284, 287, 290, 292, |
382 | 297, 300, 304, 308, 310 | 443 | 295, 296, 299, 301, 305, 309, 313, 316, 320, 324, |
444 | 326 | ||
383 | }; | 445 | }; |
384 | 446 | ||
385 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | 447 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
386 | static const yysigned_char yyrhs[] = | 448 | static const yysigned_char yyrhs[] = |
387 | { | 449 | { |
388 | 36, 0, -1, 37, -1, -1, 37, 39, -1, 37, | 450 | 37, 0, -1, 38, -1, -1, 38, 40, -1, 38, |
389 | 50, -1, 37, 61, -1, 37, 3, 71, 73, -1, | 451 | 54, -1, 38, 65, -1, 38, 3, 75, 77, -1, |
390 | 37, 72, -1, 37, 25, 1, 30, -1, 37, 38, | 452 | 38, 76, -1, 38, 26, 1, 31, -1, 38, 39, |
391 | 1, 30, -1, 37, 1, 30, -1, 16, -1, 19, | 453 | 1, 31, -1, 38, 1, 31, -1, 16, -1, 19, |
392 | -1, 20, -1, 22, -1, 18, -1, 23, -1, 21, | 454 | -1, 20, -1, 22, -1, 18, -1, 23, -1, 21, |
393 | -1, 30, -1, 56, -1, 65, -1, 42, -1, 44, | 455 | -1, 31, -1, 60, -1, 69, -1, 43, -1, 45, |
394 | -1, 63, -1, 25, 1, 30, -1, 1, 30, -1, | 456 | -1, 67, -1, 26, 1, 31, -1, 1, 31, -1, |
395 | 10, 25, 30, -1, 41, 45, -1, 11, 25, 30, | 457 | 10, 26, 31, -1, 42, 46, -1, 11, 26, 31, |
396 | -1, 43, 45, -1, -1, 45, 46, -1, 45, 69, | 458 | -1, 44, 46, -1, -1, 46, 47, -1, 46, 48, |
397 | -1, 45, 67, -1, 45, 40, -1, 45, 30, -1, | 459 | -1, 46, 73, -1, 46, 71, -1, 46, 41, -1, |
398 | 20, 70, 30, -1, 19, 71, 74, 30, -1, 21, | 460 | 46, 31, -1, 20, 74, 31, -1, 19, 75, 78, |
399 | 75, 74, 30, -1, 22, 25, 74, 30, -1, 23, | 461 | 31, -1, 21, 79, 78, 31, -1, 22, 26, 78, |
400 | 76, 76, 74, 30, -1, 7, 30, -1, 47, 51, | 462 | 31, -1, 23, 80, 80, 78, 31, -1, 24, 49, |
401 | -1, 72, -1, 48, 53, 49, -1, -1, 51, 52, | 463 | 31, -1, -1, 49, 26, 50, -1, -1, 34, 75, |
402 | -1, 51, 69, -1, 51, 67, -1, 51, 30, -1, | 464 | -1, 7, 31, -1, 51, 55, -1, 76, -1, 52, |
403 | 51, 40, -1, 19, 71, 74, 30, -1, 20, 70, | 465 | 57, 53, -1, -1, 55, 56, -1, 55, 73, -1, |
404 | 30, -1, 18, 30, -1, 21, 25, 74, 30, -1, | 466 | 55, 71, -1, 55, 31, -1, 55, 41, -1, 19, |
405 | -1, 53, 39, -1, 14, 75, 73, -1, 72, -1, | 467 | 75, 78, 31, -1, 20, 74, 31, -1, 18, 31, |
406 | 54, 57, 55, -1, -1, 57, 39, -1, 57, 61, | 468 | -1, 21, 26, 78, 31, -1, -1, 57, 40, -1, |
407 | -1, 57, 50, -1, 4, 71, 30, -1, 58, 68, | 469 | 14, 79, 77, -1, 76, -1, 58, 61, 59, -1, |
408 | -1, 72, -1, 59, 62, 60, -1, -1, 62, 39, | 470 | -1, 61, 40, -1, 61, 65, -1, 61, 54, -1, |
409 | -1, 62, 61, -1, 62, 50, -1, 6, 71, 30, | 471 | 4, 75, 31, -1, 62, 72, -1, 76, -1, 63, |
410 | -1, 9, 71, 30, -1, 64, 68, -1, 12, 30, | 472 | 66, 64, -1, -1, 66, 40, -1, 66, 65, -1, |
411 | -1, 66, 13, -1, -1, 68, 69, -1, 68, 30, | 473 | 66, 54, -1, 6, 75, 31, -1, 9, 75, 31, |
412 | -1, 68, 40, -1, 16, 24, 75, 30, -1, 16, | 474 | -1, 68, 72, -1, 12, 31, -1, 70, 13, -1, |
413 | 75, 30, -1, 17, 75, 30, -1, -1, 71, 74, | 475 | -1, 72, 73, -1, 72, 31, -1, 72, 41, -1, |
414 | -1, 25, -1, 26, -1, 5, 30, -1, 8, 30, | 476 | 16, 25, 79, 31, -1, 16, 79, 31, -1, 17, |
415 | -1, 15, 30, -1, 30, -1, 73, 30, -1, -1, | 477 | 79, 31, -1, -1, 75, 78, -1, 26, -1, 27, |
416 | 14, 75, -1, 76, -1, 76, 33, 76, -1, 76, | 478 | -1, 5, 31, -1, 8, 31, -1, 15, 31, -1, |
417 | 27, 76, -1, 29, 75, 28, -1, 34, 75, -1, | 479 | 31, -1, 77, 31, -1, -1, 14, 79, -1, 80, |
418 | 75, 31, 75, -1, 75, 32, 75, -1, 25, -1, | 480 | -1, 80, 34, 80, -1, 80, 28, 80, -1, 30, |
419 | 26, -1 | 481 | 79, 29, -1, 35, 79, -1, 79, 32, 79, -1, |
482 | 79, 33, 79, -1, 26, -1, 27, -1 | ||
420 | }; | 483 | }; |
421 | 484 | ||
422 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 485 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
423 | static const unsigned short int yyrline[] = | 486 | static const unsigned short int yyrline[] = |
424 | { | 487 | { |
425 | 0, 103, 103, 105, 107, 108, 109, 110, 111, 112, | 488 | 0, 105, 105, 107, 109, 110, 111, 112, 113, 114, |
426 | 113, 117, 121, 121, 121, 121, 121, 121, 121, 125, | 489 | 115, 119, 123, 123, 123, 123, 123, 123, 123, 127, |
427 | 126, 127, 128, 129, 130, 134, 135, 141, 149, 155, | 490 | 128, 129, 130, 131, 132, 136, 137, 143, 151, 157, |
428 | 163, 173, 175, 176, 177, 178, 179, 182, 190, 196, | 491 | 165, 175, 177, 178, 179, 180, 181, 182, 185, 193, |
429 | 206, 212, 220, 229, 234, 242, 245, 247, 248, 249, | 492 | 199, 209, 215, 221, 224, 226, 237, 238, 243, 252, |
430 | 250, 251, 254, 260, 271, 277, 287, 289, 294, 302, | 493 | 257, 265, 268, 270, 271, 272, 273, 274, 277, 283, |
431 | 310, 313, 315, 316, 317, 322, 329, 334, 342, 345, | 494 | 294, 300, 310, 312, 317, 325, 333, 336, 338, 339, |
432 | 347, 348, 349, 352, 360, 367, 374, 380, 387, 389, | 495 | 340, 345, 352, 357, 365, 368, 370, 371, 372, 375, |
433 | 390, 391, 394, 399, 404, 412, 414, 419, 420, 423, | 496 | 383, 390, 397, 403, 410, 412, 413, 414, 417, 422, |
434 | 424, 425, 429, 430, 433, 434, 437, 438, 439, 440, | 497 | 427, 435, 437, 442, 443, 446, 447, 448, 452, 453, |
435 | 441, 442, 443, 446, 447 | 498 | 456, 457, 460, 461, 462, 463, 464, 465, 466, 469, |
499 | 470 | ||
436 | }; | 500 | }; |
437 | #endif | 501 | #endif |
438 | 502 | ||
439 | #if YYDEBUG || YYERROR_VERBOSE | 503 | #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE |
440 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | 504 | /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
441 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | 505 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
442 | static const char *const yytname[] = | 506 | static const char *const yytname[] = |
443 | { | 507 | { |
@@ -445,17 +509,18 @@ static const char *const yytname[] = | |||
445 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", | 509 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", |
446 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", | 510 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", |
447 | "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", | 511 | "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", |
448 | "T_SELECT", "T_RANGE", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", | 512 | "T_SELECT", "T_RANGE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", |
449 | "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", | 513 | "T_UNEQUAL", "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", |
450 | "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt", | 514 | "T_EQUAL", "T_NOT", "$accept", "input", "stmt_list", "option_name", |
451 | "option_error", "config_entry_start", "config_stmt", | 515 | "common_stmt", "option_error", "config_entry_start", "config_stmt", |
452 | "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", | 516 | "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", |
453 | "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", | 517 | "config_option", "symbol_option", "symbol_option_list", |
454 | "choice_option_list", "choice_option", "choice_block", "if_entry", | 518 | "symbol_option_arg", "choice", "choice_entry", "choice_end", |
455 | "if_end", "if_stmt", "if_block", "menu", "menu_entry", "menu_end", | 519 | "choice_stmt", "choice_option_list", "choice_option", "choice_block", |
456 | "menu_stmt", "menu_block", "source_stmt", "comment", "comment_stmt", | 520 | "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry", |
457 | "help_start", "help", "depends_list", "depends", "prompt_stmt_opt", | 521 | "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment", |
458 | "prompt", "end", "nl", "if_expr", "expr", "symbol", 0 | 522 | "comment_stmt", "help_start", "help", "depends_list", "depends", |
523 | "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol", 0 | ||
459 | }; | 524 | }; |
460 | #endif | 525 | #endif |
461 | 526 | ||
@@ -467,24 +532,25 @@ static const unsigned short int yytoknum[] = | |||
467 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | 532 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
468 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | 533 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, |
469 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | 534 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, |
470 | 285, 286, 287, 288, 289 | 535 | 285, 286, 287, 288, 289, 290 |
471 | }; | 536 | }; |
472 | # endif | 537 | # endif |
473 | 538 | ||
474 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | 539 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ |
475 | static const unsigned char yyr1[] = | 540 | static const unsigned char yyr1[] = |
476 | { | 541 | { |
477 | 0, 35, 36, 37, 37, 37, 37, 37, 37, 37, | 542 | 0, 36, 37, 38, 38, 38, 38, 38, 38, 38, |
478 | 37, 37, 38, 38, 38, 38, 38, 38, 38, 39, | 543 | 38, 38, 39, 39, 39, 39, 39, 39, 39, 40, |
479 | 39, 39, 39, 39, 39, 40, 40, 41, 42, 43, | 544 | 40, 40, 40, 40, 40, 41, 41, 42, 43, 44, |
480 | 44, 45, 45, 45, 45, 45, 45, 46, 46, 46, | 545 | 45, 46, 46, 46, 46, 46, 46, 46, 47, 47, |
481 | 46, 46, 47, 48, 49, 50, 51, 51, 51, 51, | 546 | 47, 47, 47, 48, 49, 49, 50, 50, 51, 52, |
482 | 51, 51, 52, 52, 52, 52, 53, 53, 54, 55, | 547 | 53, 54, 55, 55, 55, 55, 55, 55, 56, 56, |
483 | 56, 57, 57, 57, 57, 58, 59, 60, 61, 62, | 548 | 56, 56, 57, 57, 58, 59, 60, 61, 61, 61, |
484 | 62, 62, 62, 63, 64, 65, 66, 67, 68, 68, | 549 | 61, 62, 63, 64, 65, 66, 66, 66, 66, 67, |
485 | 68, 68, 69, 69, 69, 70, 70, 71, 71, 72, | 550 | 68, 69, 70, 71, 72, 72, 72, 72, 73, 73, |
486 | 72, 72, 73, 73, 74, 74, 75, 75, 75, 75, | 551 | 73, 74, 74, 75, 75, 76, 76, 76, 77, 77, |
487 | 75, 75, 75, 76, 76 | 552 | 78, 78, 79, 79, 79, 79, 79, 79, 79, 80, |
553 | 80 | ||
488 | }; | 554 | }; |
489 | 555 | ||
490 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | 556 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
@@ -493,14 +559,15 @@ static const unsigned char yyr2[] = | |||
493 | 0, 2, 1, 0, 2, 2, 2, 4, 2, 4, | 559 | 0, 2, 1, 0, 2, 2, 2, 4, 2, 4, |
494 | 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, | 560 | 4, 3, 1, 1, 1, 1, 1, 1, 1, 1, |
495 | 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, | 561 | 1, 1, 1, 1, 1, 3, 2, 3, 2, 3, |
496 | 2, 0, 2, 2, 2, 2, 2, 3, 4, 4, | 562 | 2, 0, 2, 2, 2, 2, 2, 2, 3, 4, |
497 | 4, 5, 2, 2, 1, 3, 0, 2, 2, 2, | 563 | 4, 4, 5, 3, 0, 3, 0, 2, 2, 2, |
498 | 2, 2, 4, 3, 2, 4, 0, 2, 3, 1, | 564 | 1, 3, 0, 2, 2, 2, 2, 2, 4, 3, |
499 | 3, 0, 2, 2, 2, 3, 2, 1, 3, 0, | 565 | 2, 4, 0, 2, 3, 1, 3, 0, 2, 2, |
500 | 2, 2, 2, 3, 3, 2, 2, 2, 0, 2, | 566 | 2, 3, 2, 1, 3, 0, 2, 2, 2, 3, |
501 | 2, 2, 4, 3, 3, 0, 2, 1, 1, 2, | 567 | 3, 2, 2, 2, 0, 2, 2, 2, 4, 3, |
502 | 2, 2, 1, 2, 0, 2, 1, 3, 3, 3, | 568 | 3, 0, 2, 1, 1, 2, 2, 2, 1, 2, |
503 | 2, 3, 3, 1, 1 | 569 | 0, 2, 1, 3, 3, 3, 2, 3, 3, 1, |
570 | 1 | ||
504 | }; | 571 | }; |
505 | 572 | ||
506 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | 573 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
@@ -511,175 +578,164 @@ static const unsigned char yydefact[] = | |||
511 | 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, | 578 | 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, |
512 | 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, | 579 | 0, 0, 0, 0, 0, 0, 12, 16, 13, 14, |
513 | 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, | 580 | 18, 15, 17, 0, 19, 0, 4, 31, 22, 31, |
514 | 23, 46, 56, 5, 61, 20, 78, 69, 6, 24, | 581 | 23, 52, 62, 5, 67, 20, 84, 75, 6, 24, |
515 | 78, 21, 8, 11, 87, 88, 0, 0, 89, 0, | 582 | 84, 21, 8, 11, 93, 94, 0, 0, 95, 0, |
516 | 42, 90, 0, 0, 0, 103, 104, 0, 0, 0, | 583 | 48, 96, 0, 0, 0, 109, 110, 0, 0, 0, |
517 | 96, 91, 0, 0, 0, 0, 0, 0, 0, 0, | 584 | 102, 97, 0, 0, 0, 0, 0, 0, 0, 0, |
518 | 0, 0, 92, 7, 65, 73, 74, 27, 29, 0, | 585 | 0, 0, 98, 7, 71, 79, 80, 27, 29, 0, |
519 | 100, 0, 0, 58, 0, 0, 9, 10, 0, 0, | 586 | 106, 0, 0, 64, 0, 0, 9, 10, 0, 0, |
520 | 0, 0, 0, 85, 0, 0, 0, 0, 36, 35, | 587 | 0, 0, 0, 91, 0, 0, 0, 44, 0, 37, |
521 | 32, 0, 34, 33, 0, 0, 85, 0, 50, 51, | 588 | 36, 32, 33, 0, 35, 34, 0, 0, 91, 0, |
522 | 47, 49, 48, 57, 45, 44, 62, 64, 60, 63, | 589 | 56, 57, 53, 55, 54, 63, 51, 50, 68, 70, |
523 | 59, 80, 81, 79, 70, 72, 68, 71, 67, 93, | 590 | 66, 69, 65, 86, 87, 85, 76, 78, 74, 77, |
524 | 99, 101, 102, 98, 97, 26, 76, 0, 0, 0, | 591 | 73, 99, 105, 107, 108, 104, 103, 26, 82, 0, |
525 | 94, 0, 94, 94, 94, 0, 0, 77, 54, 94, | 592 | 0, 0, 100, 0, 100, 100, 100, 0, 0, 0, |
526 | 0, 94, 0, 83, 84, 0, 0, 37, 86, 0, | 593 | 83, 60, 100, 0, 100, 0, 89, 90, 0, 0, |
527 | 0, 94, 25, 0, 53, 0, 82, 95, 38, 39, | 594 | 38, 92, 0, 0, 100, 46, 43, 25, 0, 59, |
528 | 40, 0, 52, 55, 41 | 595 | 0, 88, 101, 39, 40, 41, 0, 0, 45, 58, |
596 | 61, 42, 47 | ||
529 | }; | 597 | }; |
530 | 598 | ||
531 | /* YYDEFGOTO[NTERM-NUM]. */ | 599 | /* YYDEFGOTO[NTERM-NUM]. */ |
532 | static const short int yydefgoto[] = | 600 | static const short int yydefgoto[] = |
533 | { | 601 | { |
534 | -1, 1, 2, 25, 26, 99, 27, 28, 29, 30, | 602 | -1, 1, 2, 25, 26, 100, 27, 28, 29, 30, |
535 | 64, 100, 31, 32, 114, 33, 66, 110, 67, 34, | 603 | 64, 101, 102, 148, 178, 31, 32, 116, 33, 66, |
536 | 118, 35, 68, 36, 37, 126, 38, 70, 39, 40, | 604 | 112, 67, 34, 120, 35, 68, 36, 37, 128, 38, |
537 | 41, 101, 102, 69, 103, 141, 142, 42, 73, 156, | 605 | 70, 39, 40, 41, 103, 104, 69, 105, 143, 144, |
538 | 59, 60 | 606 | 42, 73, 159, 59, 60 |
539 | }; | 607 | }; |
540 | 608 | ||
541 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | 609 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
542 | STATE-NUM. */ | 610 | STATE-NUM. */ |
543 | #define YYPACT_NINF -78 | 611 | #define YYPACT_NINF -135 |
544 | static const short int yypact[] = | 612 | static const short int yypact[] = |
545 | { | 613 | { |
546 | -78, 2, 159, -78, -21, 0, 0, -12, 0, 1, | 614 | -135, 2, 170, -135, -14, 56, 56, -8, 56, 24, |
547 | 4, 0, 27, 38, 60, 58, -78, -78, -78, -78, | 615 | 67, 56, 7, 14, 62, 97, -135, -135, -135, -135, |
548 | -78, -78, -78, 100, -78, 104, -78, -78, -78, -78, | 616 | -135, -135, -135, 156, -135, 166, -135, -135, -135, -135, |
549 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | 617 | -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, |
550 | -78, -78, -78, -78, -78, -78, 86, 113, -78, 114, | 618 | -135, -135, -135, -135, -135, -135, 138, 151, -135, 152, |
551 | -78, -78, 125, 127, 128, -78, -78, 60, 60, 210, | 619 | -135, -135, 163, 167, 176, -135, -135, 62, 62, 185, |
552 | 65, -78, 141, 142, 39, 103, 182, 200, 6, 66, | 620 | -19, -135, 188, 190, 42, 103, 194, 85, 70, 222, |
553 | 6, 131, -78, 146, -78, -78, -78, -78, -78, 196, | 621 | 70, 132, -135, 191, -135, -135, -135, -135, -135, 127, |
554 | -78, 60, 60, 146, 40, 40, -78, -78, 155, 156, | 622 | -135, 62, 62, 191, 104, 104, -135, -135, 193, 203, |
555 | -2, 60, 0, 0, 60, 105, 40, 194, -78, -78, | 623 | 9, 62, 56, 56, 62, 161, 104, -135, 196, -135, |
556 | -78, 206, -78, -78, 183, 0, 0, 195, -78, -78, | 624 | -135, -135, -135, 233, -135, -135, 204, 56, 56, 221, |
557 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | 625 | -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, |
558 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | 626 | -135, -135, -135, -135, -135, -135, -135, -135, -135, -135, |
559 | -78, 197, -78, -78, -78, -78, -78, 60, 213, 216, | 627 | -135, -135, -135, 219, -135, -135, -135, -135, -135, 62, |
560 | 212, 203, 212, 190, 212, 40, 208, -78, -78, 212, | 628 | 209, 212, 240, 224, 240, -1, 240, 104, 41, 225, |
561 | 222, 212, 219, -78, -78, 60, 223, -78, -78, 224, | 629 | -135, -135, 240, 226, 240, 218, -135, -135, 62, 227, |
562 | 225, 212, -78, 226, -78, 227, -78, 47, -78, -78, | 630 | -135, -135, 228, 229, 240, 230, -135, -135, 231, -135, |
563 | -78, 228, -78, -78, -78 | 631 | 232, -135, 112, -135, -135, -135, 234, 56, -135, -135, |
632 | -135, -135, -135 | ||
564 | }; | 633 | }; |
565 | 634 | ||
566 | /* YYPGOTO[NTERM-NUM]. */ | 635 | /* YYPGOTO[NTERM-NUM]. */ |
567 | static const short int yypgoto[] = | 636 | static const short int yypgoto[] = |
568 | { | 637 | { |
569 | -78, -78, -78, -78, 164, -36, -78, -78, -78, -78, | 638 | -135, -135, -135, -135, 94, -45, -135, -135, -135, -135, |
570 | 230, -78, -78, -78, -78, 29, -78, -78, -78, -78, | 639 | 237, -135, -135, -135, -135, -135, -135, -135, -54, -135, |
571 | -78, -78, -78, -78, -78, -78, 59, -78, -78, -78, | 640 | -135, -135, -135, -135, -135, -135, -135, -135, -135, 1, |
572 | -78, -78, 198, 220, 24, 157, -5, 169, 202, 74, | 641 | -135, -135, -135, -135, -135, 195, 235, -44, 159, -5, |
573 | -53, -77 | 642 | 98, 210, -134, -53, -77 |
574 | }; | 643 | }; |
575 | 644 | ||
576 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | 645 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
577 | positive, shift that token. If negative, reduce the rule which | 646 | positive, shift that token. If negative, reduce the rule which |
578 | number is the opposite. If zero, do what YYDEFACT says. | 647 | number is the opposite. If zero, do what YYDEFACT says. |
579 | If YYTABLE_NINF, syntax error. */ | 648 | If YYTABLE_NINF, syntax error. */ |
580 | #define YYTABLE_NINF -76 | 649 | #define YYTABLE_NINF -82 |
581 | static const short int yytable[] = | 650 | static const short int yytable[] = |
582 | { | 651 | { |
583 | 46, 47, 3, 49, 79, 80, 52, 133, 134, 43, | 652 | 46, 47, 3, 49, 79, 80, 52, 135, 136, 84, |
584 | 6, 7, 8, 9, 10, 11, 12, 13, 48, 145, | 653 | 161, 162, 163, 158, 119, 85, 127, 43, 168, 147, |
585 | 14, 15, 137, 55, 56, 44, 45, 57, 131, 132, | 654 | 170, 111, 114, 48, 124, 125, 124, 125, 133, 134, |
586 | 109, 50, 58, 122, 51, 122, 24, 138, 139, -28, | 655 | 176, 81, 82, 53, 139, 55, 56, 140, 141, 57, |
587 | 88, 143, -28, -28, -28, -28, -28, -28, -28, -28, | 656 | 54, 145, -28, 88, 58, -28, -28, -28, -28, -28, |
588 | -28, 89, 53, -28, -28, 90, 91, -28, 92, 93, | 657 | -28, -28, -28, -28, 89, 50, -28, -28, 90, 91, |
589 | 94, 95, 96, 54, 97, 55, 56, 88, 161, 98, | 658 | -28, 92, 93, 94, 95, 96, 97, 165, 98, 121, |
590 | -66, -66, -66, -66, -66, -66, -66, -66, 81, 82, | 659 | 164, 129, 166, 99, 6, 7, 8, 9, 10, 11, |
591 | -66, -66, 90, 91, 152, 55, 56, 140, 61, 57, | 660 | 12, 13, 44, 45, 14, 15, 155, 142, 55, 56, |
592 | 112, 97, 84, 123, 58, 123, 121, 117, 85, 125, | 661 | 7, 8, 57, 10, 11, 12, 13, 58, 51, 14, |
593 | 149, 62, 167, -30, 88, 63, -30, -30, -30, -30, | 662 | 15, 24, 152, -30, 88, 172, -30, -30, -30, -30, |
594 | -30, -30, -30, -30, -30, 89, 72, -30, -30, 90, | 663 | -30, -30, -30, -30, -30, 89, 24, -30, -30, 90, |
595 | 91, -30, 92, 93, 94, 95, 96, 119, 97, 127, | 664 | 91, -30, 92, 93, 94, 95, 96, 97, 61, 98, |
596 | 144, -75, 88, 98, -75, -75, -75, -75, -75, -75, | 665 | 55, 56, -81, 88, 99, -81, -81, -81, -81, -81, |
597 | -75, -75, -75, 74, 75, -75, -75, 90, 91, -75, | 666 | -81, -81, -81, -81, 81, 82, -81, -81, 90, 91, |
598 | -75, -75, -75, -75, -75, 76, 97, 77, 78, -2, | 667 | -81, -81, -81, -81, -81, -81, 132, 62, 98, 81, |
599 | 4, 121, 5, 6, 7, 8, 9, 10, 11, 12, | 668 | 82, 115, 118, 123, 126, 117, 122, 63, 130, 72, |
600 | 13, 86, 87, 14, 15, 16, 129, 17, 18, 19, | 669 | -2, 4, 182, 5, 6, 7, 8, 9, 10, 11, |
601 | 20, 21, 22, 88, 23, 135, 136, -43, -43, 24, | 670 | 12, 13, 74, 75, 14, 15, 16, 146, 17, 18, |
602 | -43, -43, -43, -43, 89, 146, -43, -43, 90, 91, | 671 | 19, 20, 21, 22, 76, 88, 23, 149, 77, -49, |
603 | 104, 105, 106, 107, 155, 7, 8, 97, 10, 11, | 672 | -49, 24, -49, -49, -49, -49, 89, 78, -49, -49, |
604 | 12, 13, 108, 148, 14, 15, 158, 159, 160, 147, | 673 | 90, 91, 106, 107, 108, 109, 72, 81, 82, 86, |
605 | 151, 81, 82, 163, 130, 165, 155, 81, 82, 82, | 674 | 98, 87, 131, 88, 137, 110, -72, -72, -72, -72, |
606 | 24, 113, 116, 157, 124, 171, 115, 120, 162, 128, | 675 | -72, -72, -72, -72, 138, 151, -72, -72, 90, 91, |
607 | 72, 81, 82, 153, 81, 82, 154, 81, 82, 166, | 676 | 156, 81, 82, 157, 81, 82, 150, 154, 98, 171, |
608 | 81, 82, 164, 168, 169, 170, 172, 173, 174, 65, | 677 | 81, 82, 82, 123, 158, 160, 167, 169, 173, 174, |
609 | 71, 83, 0, 150, 111 | 678 | 175, 113, 179, 180, 177, 181, 65, 153, 0, 83, |
679 | 0, 0, 0, 0, 0, 71 | ||
610 | }; | 680 | }; |
611 | 681 | ||
612 | static const short int yycheck[] = | 682 | static const short int yycheck[] = |
613 | { | 683 | { |
614 | 5, 6, 0, 8, 57, 58, 11, 84, 85, 30, | 684 | 5, 6, 0, 8, 57, 58, 11, 84, 85, 28, |
615 | 4, 5, 6, 7, 8, 9, 10, 11, 30, 96, | 685 | 144, 145, 146, 14, 68, 34, 70, 31, 152, 96, |
616 | 14, 15, 24, 25, 26, 25, 26, 29, 81, 82, | 686 | 154, 66, 66, 31, 69, 69, 71, 71, 81, 82, |
617 | 66, 30, 34, 69, 30, 71, 30, 90, 91, 0, | 687 | 164, 32, 33, 26, 25, 26, 27, 90, 91, 30, |
618 | 1, 94, 3, 4, 5, 6, 7, 8, 9, 10, | 688 | 26, 94, 0, 1, 35, 3, 4, 5, 6, 7, |
619 | 11, 12, 25, 14, 15, 16, 17, 18, 19, 20, | 689 | 8, 9, 10, 11, 12, 31, 14, 15, 16, 17, |
620 | 21, 22, 23, 25, 25, 25, 26, 1, 145, 30, | 690 | 18, 19, 20, 21, 22, 23, 24, 26, 26, 68, |
621 | 4, 5, 6, 7, 8, 9, 10, 11, 31, 32, | 691 | 147, 70, 31, 31, 4, 5, 6, 7, 8, 9, |
622 | 14, 15, 16, 17, 137, 25, 26, 92, 30, 29, | 692 | 10, 11, 26, 27, 14, 15, 139, 92, 26, 27, |
623 | 66, 25, 27, 69, 34, 71, 30, 68, 33, 70, | 693 | 5, 6, 30, 8, 9, 10, 11, 35, 31, 14, |
624 | 105, 1, 155, 0, 1, 1, 3, 4, 5, 6, | 694 | 15, 31, 107, 0, 1, 158, 3, 4, 5, 6, |
625 | 7, 8, 9, 10, 11, 12, 30, 14, 15, 16, | 695 | 7, 8, 9, 10, 11, 12, 31, 14, 15, 16, |
626 | 17, 18, 19, 20, 21, 22, 23, 68, 25, 70, | 696 | 17, 18, 19, 20, 21, 22, 23, 24, 31, 26, |
627 | 25, 0, 1, 30, 3, 4, 5, 6, 7, 8, | 697 | 26, 27, 0, 1, 31, 3, 4, 5, 6, 7, |
628 | 9, 10, 11, 30, 30, 14, 15, 16, 17, 18, | 698 | 8, 9, 10, 11, 32, 33, 14, 15, 16, 17, |
629 | 19, 20, 21, 22, 23, 30, 25, 30, 30, 0, | 699 | 18, 19, 20, 21, 22, 23, 29, 1, 26, 32, |
630 | 1, 30, 3, 4, 5, 6, 7, 8, 9, 10, | 700 | 33, 67, 68, 31, 70, 67, 68, 1, 70, 31, |
631 | 11, 30, 30, 14, 15, 16, 30, 18, 19, 20, | 701 | 0, 1, 177, 3, 4, 5, 6, 7, 8, 9, |
632 | 21, 22, 23, 1, 25, 30, 30, 5, 6, 30, | 702 | 10, 11, 31, 31, 14, 15, 16, 26, 18, 19, |
633 | 8, 9, 10, 11, 12, 1, 14, 15, 16, 17, | 703 | 20, 21, 22, 23, 31, 1, 26, 1, 31, 5, |
634 | 18, 19, 20, 21, 14, 5, 6, 25, 8, 9, | 704 | 6, 31, 8, 9, 10, 11, 12, 31, 14, 15, |
635 | 10, 11, 30, 30, 14, 15, 142, 143, 144, 13, | 705 | 16, 17, 18, 19, 20, 21, 31, 32, 33, 31, |
636 | 25, 31, 32, 149, 28, 151, 14, 31, 32, 32, | 706 | 26, 31, 31, 1, 31, 31, 4, 5, 6, 7, |
637 | 30, 67, 68, 30, 70, 161, 67, 68, 30, 70, | 707 | 8, 9, 10, 11, 31, 31, 14, 15, 16, 17, |
638 | 30, 31, 32, 30, 31, 32, 30, 31, 32, 30, | 708 | 31, 32, 33, 31, 32, 33, 13, 26, 26, 31, |
639 | 31, 32, 30, 30, 30, 30, 30, 30, 30, 29, | 709 | 32, 33, 33, 31, 14, 31, 31, 31, 31, 31, |
640 | 40, 59, -1, 106, 66 | 710 | 31, 66, 31, 31, 34, 31, 29, 108, -1, 59, |
711 | -1, -1, -1, -1, -1, 40 | ||
641 | }; | 712 | }; |
642 | 713 | ||
643 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | 714 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
644 | symbol of state STATE-NUM. */ | 715 | symbol of state STATE-NUM. */ |
645 | static const unsigned char yystos[] = | 716 | static const unsigned char yystos[] = |
646 | { | 717 | { |
647 | 0, 36, 37, 0, 1, 3, 4, 5, 6, 7, | 718 | 0, 37, 38, 0, 1, 3, 4, 5, 6, 7, |
648 | 8, 9, 10, 11, 14, 15, 16, 18, 19, 20, | 719 | 8, 9, 10, 11, 14, 15, 16, 18, 19, 20, |
649 | 21, 22, 23, 25, 30, 38, 39, 41, 42, 43, | 720 | 21, 22, 23, 26, 31, 39, 40, 42, 43, 44, |
650 | 44, 47, 48, 50, 54, 56, 58, 59, 61, 63, | 721 | 45, 51, 52, 54, 58, 60, 62, 63, 65, 67, |
651 | 64, 65, 72, 30, 25, 26, 71, 71, 30, 71, | 722 | 68, 69, 76, 31, 26, 27, 75, 75, 31, 75, |
652 | 30, 30, 71, 25, 25, 25, 26, 29, 34, 75, | 723 | 31, 31, 75, 26, 26, 26, 27, 30, 35, 79, |
653 | 76, 30, 1, 1, 45, 45, 51, 53, 57, 68, | 724 | 80, 31, 1, 1, 46, 46, 55, 57, 61, 72, |
654 | 62, 68, 30, 73, 30, 30, 30, 30, 30, 75, | 725 | 66, 72, 31, 77, 31, 31, 31, 31, 31, 79, |
655 | 75, 31, 32, 73, 27, 33, 30, 30, 1, 12, | 726 | 79, 32, 33, 77, 28, 34, 31, 31, 1, 12, |
656 | 16, 17, 19, 20, 21, 22, 23, 25, 30, 40, | 727 | 16, 17, 19, 20, 21, 22, 23, 24, 26, 31, |
657 | 46, 66, 67, 69, 18, 19, 20, 21, 30, 40, | 728 | 41, 47, 48, 70, 71, 73, 18, 19, 20, 21, |
658 | 52, 67, 69, 39, 49, 72, 39, 50, 55, 61, | 729 | 31, 41, 56, 71, 73, 40, 53, 76, 40, 54, |
659 | 72, 30, 40, 69, 39, 50, 60, 61, 72, 30, | 730 | 59, 65, 76, 31, 41, 73, 40, 54, 64, 65, |
660 | 28, 75, 75, 76, 76, 30, 30, 24, 75, 75, | 731 | 76, 31, 29, 79, 79, 80, 80, 31, 31, 25, |
661 | 71, 70, 71, 75, 25, 76, 1, 13, 30, 71, | 732 | 79, 79, 75, 74, 75, 79, 26, 80, 49, 1, |
662 | 70, 25, 75, 30, 30, 14, 74, 30, 74, 74, | 733 | 13, 31, 75, 74, 26, 79, 31, 31, 14, 78, |
663 | 74, 76, 30, 74, 30, 74, 30, 75, 30, 30, | 734 | 31, 78, 78, 78, 80, 26, 31, 31, 78, 31, |
664 | 30, 74, 30, 30, 30 | 735 | 78, 31, 79, 31, 31, 31, 78, 34, 50, 31, |
736 | 31, 31, 75 | ||
665 | }; | 737 | }; |
666 | 738 | ||
667 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | ||
668 | # define YYSIZE_T __SIZE_TYPE__ | ||
669 | #endif | ||
670 | #if ! defined (YYSIZE_T) && defined (size_t) | ||
671 | # define YYSIZE_T size_t | ||
672 | #endif | ||
673 | #if ! defined (YYSIZE_T) | ||
674 | # if defined (__STDC__) || defined (__cplusplus) | ||
675 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | ||
676 | # define YYSIZE_T size_t | ||
677 | # endif | ||
678 | #endif | ||
679 | #if ! defined (YYSIZE_T) | ||
680 | # define YYSIZE_T unsigned int | ||
681 | #endif | ||
682 | |||
683 | #define yyerrok (yyerrstatus = 0) | 739 | #define yyerrok (yyerrstatus = 0) |
684 | #define yyclearin (yychar = YYEMPTY) | 740 | #define yyclearin (yychar = YYEMPTY) |
685 | #define YYEMPTY (-2) | 741 | #define YYEMPTY (-2) |
@@ -709,8 +765,8 @@ do \ | |||
709 | goto yybackup; \ | 765 | goto yybackup; \ |
710 | } \ | 766 | } \ |
711 | else \ | 767 | else \ |
712 | { \ | 768 | { \ |
713 | yyerror ("syntax error: cannot back up");\ | 769 | yyerror (YY_("syntax error: cannot back up")); \ |
714 | YYERROR; \ | 770 | YYERROR; \ |
715 | } \ | 771 | } \ |
716 | while (0) | 772 | while (0) |
@@ -789,7 +845,7 @@ do { \ | |||
789 | if (yydebug) \ | 845 | if (yydebug) \ |
790 | { \ | 846 | { \ |
791 | YYFPRINTF (stderr, "%s ", Title); \ | 847 | YYFPRINTF (stderr, "%s ", Title); \ |
792 | yysymprint (stderr, \ | 848 | yysymprint (stderr, \ |
793 | Type, Value); \ | 849 | Type, Value); \ |
794 | YYFPRINTF (stderr, "\n"); \ | 850 | YYFPRINTF (stderr, "\n"); \ |
795 | } \ | 851 | } \ |
@@ -837,13 +893,13 @@ yy_reduce_print (yyrule) | |||
837 | #endif | 893 | #endif |
838 | { | 894 | { |
839 | int yyi; | 895 | int yyi; |
840 | unsigned int yylno = yyrline[yyrule]; | 896 | unsigned long int yylno = yyrline[yyrule]; |
841 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", | 897 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu), ", |
842 | yyrule - 1, yylno); | 898 | yyrule - 1, yylno); |
843 | /* Print the symbols being reduced, and their result. */ | 899 | /* Print the symbols being reduced, and their result. */ |
844 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) | 900 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) |
845 | YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); | 901 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); |
846 | YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); | 902 | YYFPRINTF (stderr, "-> %s\n", yytname[yyr1[yyrule]]); |
847 | } | 903 | } |
848 | 904 | ||
849 | # define YY_REDUCE_PRINT(Rule) \ | 905 | # define YY_REDUCE_PRINT(Rule) \ |
@@ -872,7 +928,7 @@ int yydebug; | |||
872 | if the built-in stack extension method is used). | 928 | if the built-in stack extension method is used). |
873 | 929 | ||
874 | Do not make this value too large; the results are undefined if | 930 | Do not make this value too large; the results are undefined if |
875 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | 931 | YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) |
876 | evaluated with infinite-precision integer arithmetic. */ | 932 | evaluated with infinite-precision integer arithmetic. */ |
877 | 933 | ||
878 | #ifndef YYMAXDEPTH | 934 | #ifndef YYMAXDEPTH |
@@ -896,7 +952,7 @@ yystrlen (yystr) | |||
896 | const char *yystr; | 952 | const char *yystr; |
897 | # endif | 953 | # endif |
898 | { | 954 | { |
899 | register const char *yys = yystr; | 955 | const char *yys = yystr; |
900 | 956 | ||
901 | while (*yys++ != '\0') | 957 | while (*yys++ != '\0') |
902 | continue; | 958 | continue; |
@@ -921,8 +977,8 @@ yystpcpy (yydest, yysrc) | |||
921 | const char *yysrc; | 977 | const char *yysrc; |
922 | # endif | 978 | # endif |
923 | { | 979 | { |
924 | register char *yyd = yydest; | 980 | char *yyd = yydest; |
925 | register const char *yys = yysrc; | 981 | const char *yys = yysrc; |
926 | 982 | ||
927 | while ((*yyd++ = *yys++) != '\0') | 983 | while ((*yyd++ = *yys++) != '\0') |
928 | continue; | 984 | continue; |
@@ -932,7 +988,55 @@ yystpcpy (yydest, yysrc) | |||
932 | # endif | 988 | # endif |
933 | # endif | 989 | # endif |
934 | 990 | ||
935 | #endif /* !YYERROR_VERBOSE */ | 991 | # ifndef yytnamerr |
992 | /* Copy to YYRES the contents of YYSTR after stripping away unnecessary | ||
993 | quotes and backslashes, so that it's suitable for yyerror. The | ||
994 | heuristic is that double-quoting is unnecessary unless the string | ||
995 | contains an apostrophe, a comma, or backslash (other than | ||
996 | backslash-backslash). YYSTR is taken from yytname. If YYRES is | ||
997 | null, do not copy; instead, return the length of what the result | ||
998 | would have been. */ | ||
999 | static YYSIZE_T | ||
1000 | yytnamerr (char *yyres, const char *yystr) | ||
1001 | { | ||
1002 | if (*yystr == '"') | ||
1003 | { | ||
1004 | size_t yyn = 0; | ||
1005 | char const *yyp = yystr; | ||
1006 | |||
1007 | for (;;) | ||
1008 | switch (*++yyp) | ||
1009 | { | ||
1010 | case '\'': | ||
1011 | case ',': | ||
1012 | goto do_not_strip_quotes; | ||
1013 | |||
1014 | case '\\': | ||
1015 | if (*++yyp != '\\') | ||
1016 | goto do_not_strip_quotes; | ||
1017 | /* Fall through. */ | ||
1018 | default: | ||
1019 | if (yyres) | ||
1020 | yyres[yyn] = *yyp; | ||
1021 | yyn++; | ||
1022 | break; | ||
1023 | |||
1024 | case '"': | ||
1025 | if (yyres) | ||
1026 | yyres[yyn] = '\0'; | ||
1027 | return yyn; | ||
1028 | } | ||
1029 | do_not_strip_quotes: ; | ||
1030 | } | ||
1031 | |||
1032 | if (! yyres) | ||
1033 | return yystrlen (yystr); | ||
1034 | |||
1035 | return yystpcpy (yyres, yystr) - yyres; | ||
1036 | } | ||
1037 | # endif | ||
1038 | |||
1039 | #endif /* YYERROR_VERBOSE */ | ||
936 | 1040 | ||
937 | 1041 | ||
938 | 1042 | ||
@@ -998,7 +1102,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
998 | 1102 | ||
999 | switch (yytype) | 1103 | switch (yytype) |
1000 | { | 1104 | { |
1001 | case 48: /* choice_entry */ | 1105 | case 52: /* "choice_entry" */ |
1002 | 1106 | ||
1003 | { | 1107 | { |
1004 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1108 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1008,7 +1112,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1008 | }; | 1112 | }; |
1009 | 1113 | ||
1010 | break; | 1114 | break; |
1011 | case 54: /* if_entry */ | 1115 | case 58: /* "if_entry" */ |
1012 | 1116 | ||
1013 | { | 1117 | { |
1014 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1118 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1018,7 +1122,7 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1018 | }; | 1122 | }; |
1019 | 1123 | ||
1020 | break; | 1124 | break; |
1021 | case 59: /* menu_entry */ | 1125 | case 63: /* "menu_entry" */ |
1022 | 1126 | ||
1023 | { | 1127 | { |
1024 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 1128 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -1082,13 +1186,13 @@ yyparse (void) | |||
1082 | #else | 1186 | #else |
1083 | int | 1187 | int |
1084 | yyparse () | 1188 | yyparse () |
1085 | 1189 | ; | |
1086 | #endif | 1190 | #endif |
1087 | #endif | 1191 | #endif |
1088 | { | 1192 | { |
1089 | 1193 | ||
1090 | register int yystate; | 1194 | int yystate; |
1091 | register int yyn; | 1195 | int yyn; |
1092 | int yyresult; | 1196 | int yyresult; |
1093 | /* Number of tokens to shift before error messages enabled. */ | 1197 | /* Number of tokens to shift before error messages enabled. */ |
1094 | int yyerrstatus; | 1198 | int yyerrstatus; |
@@ -1106,12 +1210,12 @@ yyparse () | |||
1106 | /* The state stack. */ | 1210 | /* The state stack. */ |
1107 | short int yyssa[YYINITDEPTH]; | 1211 | short int yyssa[YYINITDEPTH]; |
1108 | short int *yyss = yyssa; | 1212 | short int *yyss = yyssa; |
1109 | register short int *yyssp; | 1213 | short int *yyssp; |
1110 | 1214 | ||
1111 | /* The semantic value stack. */ | 1215 | /* The semantic value stack. */ |
1112 | YYSTYPE yyvsa[YYINITDEPTH]; | 1216 | YYSTYPE yyvsa[YYINITDEPTH]; |
1113 | YYSTYPE *yyvs = yyvsa; | 1217 | YYSTYPE *yyvs = yyvsa; |
1114 | register YYSTYPE *yyvsp; | 1218 | YYSTYPE *yyvsp; |
1115 | 1219 | ||
1116 | 1220 | ||
1117 | 1221 | ||
@@ -1143,9 +1247,6 @@ yyparse () | |||
1143 | yyssp = yyss; | 1247 | yyssp = yyss; |
1144 | yyvsp = yyvs; | 1248 | yyvsp = yyvs; |
1145 | 1249 | ||
1146 | |||
1147 | yyvsp[0] = yylval; | ||
1148 | |||
1149 | goto yysetstate; | 1250 | goto yysetstate; |
1150 | 1251 | ||
1151 | /*------------------------------------------------------------. | 1252 | /*------------------------------------------------------------. |
@@ -1178,7 +1279,7 @@ yyparse () | |||
1178 | data in use in that stack, in bytes. This used to be a | 1279 | data in use in that stack, in bytes. This used to be a |
1179 | conditional around just the two extra args, but that might | 1280 | conditional around just the two extra args, but that might |
1180 | be undefined if yyoverflow is a macro. */ | 1281 | be undefined if yyoverflow is a macro. */ |
1181 | yyoverflow ("parser stack overflow", | 1282 | yyoverflow (YY_("memory exhausted"), |
1182 | &yyss1, yysize * sizeof (*yyssp), | 1283 | &yyss1, yysize * sizeof (*yyssp), |
1183 | &yyvs1, yysize * sizeof (*yyvsp), | 1284 | &yyvs1, yysize * sizeof (*yyvsp), |
1184 | 1285 | ||
@@ -1189,11 +1290,11 @@ yyparse () | |||
1189 | } | 1290 | } |
1190 | #else /* no yyoverflow */ | 1291 | #else /* no yyoverflow */ |
1191 | # ifndef YYSTACK_RELOCATE | 1292 | # ifndef YYSTACK_RELOCATE |
1192 | goto yyoverflowlab; | 1293 | goto yyexhaustedlab; |
1193 | # else | 1294 | # else |
1194 | /* Extend the stack our own way. */ | 1295 | /* Extend the stack our own way. */ |
1195 | if (YYMAXDEPTH <= yystacksize) | 1296 | if (YYMAXDEPTH <= yystacksize) |
1196 | goto yyoverflowlab; | 1297 | goto yyexhaustedlab; |
1197 | yystacksize *= 2; | 1298 | yystacksize *= 2; |
1198 | if (YYMAXDEPTH < yystacksize) | 1299 | if (YYMAXDEPTH < yystacksize) |
1199 | yystacksize = YYMAXDEPTH; | 1300 | yystacksize = YYMAXDEPTH; |
@@ -1203,7 +1304,7 @@ yyparse () | |||
1203 | union yyalloc *yyptr = | 1304 | union yyalloc *yyptr = |
1204 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | 1305 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1205 | if (! yyptr) | 1306 | if (! yyptr) |
1206 | goto yyoverflowlab; | 1307 | goto yyexhaustedlab; |
1207 | YYSTACK_RELOCATE (yyss); | 1308 | YYSTACK_RELOCATE (yyss); |
1208 | YYSTACK_RELOCATE (yyvs); | 1309 | YYSTACK_RELOCATE (yyvs); |
1209 | 1310 | ||
@@ -1403,7 +1504,7 @@ yyreduce: | |||
1403 | ;} | 1504 | ;} |
1404 | break; | 1505 | break; |
1405 | 1506 | ||
1406 | case 37: | 1507 | case 38: |
1407 | 1508 | ||
1408 | { | 1509 | { |
1409 | menu_set_type((yyvsp[-2].id)->stype); | 1510 | menu_set_type((yyvsp[-2].id)->stype); |
@@ -1413,7 +1514,7 @@ yyreduce: | |||
1413 | ;} | 1514 | ;} |
1414 | break; | 1515 | break; |
1415 | 1516 | ||
1416 | case 38: | 1517 | case 39: |
1417 | 1518 | ||
1418 | { | 1519 | { |
1419 | menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); | 1520 | menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); |
@@ -1421,7 +1522,7 @@ yyreduce: | |||
1421 | ;} | 1522 | ;} |
1422 | break; | 1523 | break; |
1423 | 1524 | ||
1424 | case 39: | 1525 | case 40: |
1425 | 1526 | ||
1426 | { | 1527 | { |
1427 | menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); | 1528 | menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); |
@@ -1433,7 +1534,7 @@ yyreduce: | |||
1433 | ;} | 1534 | ;} |
1434 | break; | 1535 | break; |
1435 | 1536 | ||
1436 | case 40: | 1537 | case 41: |
1437 | 1538 | ||
1438 | { | 1539 | { |
1439 | menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); | 1540 | menu_add_symbol(P_SELECT, sym_lookup((yyvsp[-2].string), 0), (yyvsp[-1].expr)); |
@@ -1441,7 +1542,7 @@ yyreduce: | |||
1441 | ;} | 1542 | ;} |
1442 | break; | 1543 | break; |
1443 | 1544 | ||
1444 | case 41: | 1545 | case 42: |
1445 | 1546 | ||
1446 | { | 1547 | { |
1447 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); | 1548 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); |
@@ -1449,7 +1550,29 @@ yyreduce: | |||
1449 | ;} | 1550 | ;} |
1450 | break; | 1551 | break; |
1451 | 1552 | ||
1452 | case 42: | 1553 | case 45: |
1554 | |||
1555 | { | ||
1556 | struct kconf_id *id = kconf_id_lookup((yyvsp[-1].string), strlen((yyvsp[-1].string))); | ||
1557 | if (id && id->flags & TF_OPTION) | ||
1558 | menu_add_option(id->token, (yyvsp[0].string)); | ||
1559 | else | ||
1560 | zconfprint("warning: ignoring unknown option %s", (yyvsp[-1].string)); | ||
1561 | free((yyvsp[-1].string)); | ||
1562 | ;} | ||
1563 | break; | ||
1564 | |||
1565 | case 46: | ||
1566 | |||
1567 | { (yyval.string) = NULL; ;} | ||
1568 | break; | ||
1569 | |||
1570 | case 47: | ||
1571 | |||
1572 | { (yyval.string) = (yyvsp[0].string); ;} | ||
1573 | break; | ||
1574 | |||
1575 | case 48: | ||
1453 | 1576 | ||
1454 | { | 1577 | { |
1455 | struct symbol *sym = sym_lookup(NULL, 0); | 1578 | struct symbol *sym = sym_lookup(NULL, 0); |
@@ -1460,14 +1583,14 @@ yyreduce: | |||
1460 | ;} | 1583 | ;} |
1461 | break; | 1584 | break; |
1462 | 1585 | ||
1463 | case 43: | 1586 | case 49: |
1464 | 1587 | ||
1465 | { | 1588 | { |
1466 | (yyval.menu) = menu_add_menu(); | 1589 | (yyval.menu) = menu_add_menu(); |
1467 | ;} | 1590 | ;} |
1468 | break; | 1591 | break; |
1469 | 1592 | ||
1470 | case 44: | 1593 | case 50: |
1471 | 1594 | ||
1472 | { | 1595 | { |
1473 | if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) { | 1596 | if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) { |
@@ -1477,7 +1600,7 @@ yyreduce: | |||
1477 | ;} | 1600 | ;} |
1478 | break; | 1601 | break; |
1479 | 1602 | ||
1480 | case 52: | 1603 | case 58: |
1481 | 1604 | ||
1482 | { | 1605 | { |
1483 | menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); | 1606 | menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); |
@@ -1485,7 +1608,7 @@ yyreduce: | |||
1485 | ;} | 1608 | ;} |
1486 | break; | 1609 | break; |
1487 | 1610 | ||
1488 | case 53: | 1611 | case 59: |
1489 | 1612 | ||
1490 | { | 1613 | { |
1491 | if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) { | 1614 | if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) { |
@@ -1498,7 +1621,7 @@ yyreduce: | |||
1498 | ;} | 1621 | ;} |
1499 | break; | 1622 | break; |
1500 | 1623 | ||
1501 | case 54: | 1624 | case 60: |
1502 | 1625 | ||
1503 | { | 1626 | { |
1504 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | 1627 | current_entry->sym->flags |= SYMBOL_OPTIONAL; |
@@ -1506,7 +1629,7 @@ yyreduce: | |||
1506 | ;} | 1629 | ;} |
1507 | break; | 1630 | break; |
1508 | 1631 | ||
1509 | case 55: | 1632 | case 61: |
1510 | 1633 | ||
1511 | { | 1634 | { |
1512 | if ((yyvsp[-3].id)->stype == S_UNKNOWN) { | 1635 | if ((yyvsp[-3].id)->stype == S_UNKNOWN) { |
@@ -1518,7 +1641,7 @@ yyreduce: | |||
1518 | ;} | 1641 | ;} |
1519 | break; | 1642 | break; |
1520 | 1643 | ||
1521 | case 58: | 1644 | case 64: |
1522 | 1645 | ||
1523 | { | 1646 | { |
1524 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | 1647 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); |
@@ -1528,7 +1651,7 @@ yyreduce: | |||
1528 | ;} | 1651 | ;} |
1529 | break; | 1652 | break; |
1530 | 1653 | ||
1531 | case 59: | 1654 | case 65: |
1532 | 1655 | ||
1533 | { | 1656 | { |
1534 | if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) { | 1657 | if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) { |
@@ -1538,7 +1661,7 @@ yyreduce: | |||
1538 | ;} | 1661 | ;} |
1539 | break; | 1662 | break; |
1540 | 1663 | ||
1541 | case 65: | 1664 | case 71: |
1542 | 1665 | ||
1543 | { | 1666 | { |
1544 | menu_add_entry(NULL); | 1667 | menu_add_entry(NULL); |
@@ -1547,14 +1670,14 @@ yyreduce: | |||
1547 | ;} | 1670 | ;} |
1548 | break; | 1671 | break; |
1549 | 1672 | ||
1550 | case 66: | 1673 | case 72: |
1551 | 1674 | ||
1552 | { | 1675 | { |
1553 | (yyval.menu) = menu_add_menu(); | 1676 | (yyval.menu) = menu_add_menu(); |
1554 | ;} | 1677 | ;} |
1555 | break; | 1678 | break; |
1556 | 1679 | ||
1557 | case 67: | 1680 | case 73: |
1558 | 1681 | ||
1559 | { | 1682 | { |
1560 | if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) { | 1683 | if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) { |
@@ -1564,7 +1687,7 @@ yyreduce: | |||
1564 | ;} | 1687 | ;} |
1565 | break; | 1688 | break; |
1566 | 1689 | ||
1567 | case 73: | 1690 | case 79: |
1568 | 1691 | ||
1569 | { | 1692 | { |
1570 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); | 1693 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); |
@@ -1572,7 +1695,7 @@ yyreduce: | |||
1572 | ;} | 1695 | ;} |
1573 | break; | 1696 | break; |
1574 | 1697 | ||
1575 | case 74: | 1698 | case 80: |
1576 | 1699 | ||
1577 | { | 1700 | { |
1578 | menu_add_entry(NULL); | 1701 | menu_add_entry(NULL); |
@@ -1581,14 +1704,14 @@ yyreduce: | |||
1581 | ;} | 1704 | ;} |
1582 | break; | 1705 | break; |
1583 | 1706 | ||
1584 | case 75: | 1707 | case 81: |
1585 | 1708 | ||
1586 | { | 1709 | { |
1587 | menu_end_entry(); | 1710 | menu_end_entry(); |
1588 | ;} | 1711 | ;} |
1589 | break; | 1712 | break; |
1590 | 1713 | ||
1591 | case 76: | 1714 | case 82: |
1592 | 1715 | ||
1593 | { | 1716 | { |
1594 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | 1717 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); |
@@ -1596,14 +1719,14 @@ yyreduce: | |||
1596 | ;} | 1719 | ;} |
1597 | break; | 1720 | break; |
1598 | 1721 | ||
1599 | case 77: | 1722 | case 83: |
1600 | 1723 | ||
1601 | { | 1724 | { |
1602 | current_entry->sym->help = (yyvsp[0].string); | 1725 | current_entry->sym->help = (yyvsp[0].string); |
1603 | ;} | 1726 | ;} |
1604 | break; | 1727 | break; |
1605 | 1728 | ||
1606 | case 82: | 1729 | case 88: |
1607 | 1730 | ||
1608 | { | 1731 | { |
1609 | menu_add_dep((yyvsp[-1].expr)); | 1732 | menu_add_dep((yyvsp[-1].expr)); |
@@ -1611,7 +1734,7 @@ yyreduce: | |||
1611 | ;} | 1734 | ;} |
1612 | break; | 1735 | break; |
1613 | 1736 | ||
1614 | case 83: | 1737 | case 89: |
1615 | 1738 | ||
1616 | { | 1739 | { |
1617 | menu_add_dep((yyvsp[-1].expr)); | 1740 | menu_add_dep((yyvsp[-1].expr)); |
@@ -1619,7 +1742,7 @@ yyreduce: | |||
1619 | ;} | 1742 | ;} |
1620 | break; | 1743 | break; |
1621 | 1744 | ||
1622 | case 84: | 1745 | case 90: |
1623 | 1746 | ||
1624 | { | 1747 | { |
1625 | menu_add_dep((yyvsp[-1].expr)); | 1748 | menu_add_dep((yyvsp[-1].expr)); |
@@ -1627,87 +1750,88 @@ yyreduce: | |||
1627 | ;} | 1750 | ;} |
1628 | break; | 1751 | break; |
1629 | 1752 | ||
1630 | case 86: | 1753 | case 92: |
1631 | 1754 | ||
1632 | { | 1755 | { |
1633 | menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); | 1756 | menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); |
1634 | ;} | 1757 | ;} |
1635 | break; | 1758 | break; |
1636 | 1759 | ||
1637 | case 89: | 1760 | case 95: |
1638 | 1761 | ||
1639 | { (yyval.id) = (yyvsp[-1].id); ;} | 1762 | { (yyval.id) = (yyvsp[-1].id); ;} |
1640 | break; | 1763 | break; |
1641 | 1764 | ||
1642 | case 90: | 1765 | case 96: |
1643 | 1766 | ||
1644 | { (yyval.id) = (yyvsp[-1].id); ;} | 1767 | { (yyval.id) = (yyvsp[-1].id); ;} |
1645 | break; | 1768 | break; |
1646 | 1769 | ||
1647 | case 91: | 1770 | case 97: |
1648 | 1771 | ||
1649 | { (yyval.id) = (yyvsp[-1].id); ;} | 1772 | { (yyval.id) = (yyvsp[-1].id); ;} |
1650 | break; | 1773 | break; |
1651 | 1774 | ||
1652 | case 94: | 1775 | case 100: |
1653 | 1776 | ||
1654 | { (yyval.expr) = NULL; ;} | 1777 | { (yyval.expr) = NULL; ;} |
1655 | break; | 1778 | break; |
1656 | 1779 | ||
1657 | case 95: | 1780 | case 101: |
1658 | 1781 | ||
1659 | { (yyval.expr) = (yyvsp[0].expr); ;} | 1782 | { (yyval.expr) = (yyvsp[0].expr); ;} |
1660 | break; | 1783 | break; |
1661 | 1784 | ||
1662 | case 96: | 1785 | case 102: |
1663 | 1786 | ||
1664 | { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;} | 1787 | { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); ;} |
1665 | break; | 1788 | break; |
1666 | 1789 | ||
1667 | case 97: | 1790 | case 103: |
1668 | 1791 | ||
1669 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} | 1792 | { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} |
1670 | break; | 1793 | break; |
1671 | 1794 | ||
1672 | case 98: | 1795 | case 104: |
1673 | 1796 | ||
1674 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} | 1797 | { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); ;} |
1675 | break; | 1798 | break; |
1676 | 1799 | ||
1677 | case 99: | 1800 | case 105: |
1678 | 1801 | ||
1679 | { (yyval.expr) = (yyvsp[-1].expr); ;} | 1802 | { (yyval.expr) = (yyvsp[-1].expr); ;} |
1680 | break; | 1803 | break; |
1681 | 1804 | ||
1682 | case 100: | 1805 | case 106: |
1683 | 1806 | ||
1684 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;} | 1807 | { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); ;} |
1685 | break; | 1808 | break; |
1686 | 1809 | ||
1687 | case 101: | 1810 | case 107: |
1688 | 1811 | ||
1689 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} | 1812 | { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} |
1690 | break; | 1813 | break; |
1691 | 1814 | ||
1692 | case 102: | 1815 | case 108: |
1693 | 1816 | ||
1694 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} | 1817 | { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); ;} |
1695 | break; | 1818 | break; |
1696 | 1819 | ||
1697 | case 103: | 1820 | case 109: |
1698 | 1821 | ||
1699 | { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;} | 1822 | { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); ;} |
1700 | break; | 1823 | break; |
1701 | 1824 | ||
1702 | case 104: | 1825 | case 110: |
1703 | 1826 | ||
1704 | { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;} | 1827 | { (yyval.symbol) = sym_lookup((yyvsp[0].string), 1); free((yyvsp[0].string)); ;} |
1705 | break; | 1828 | break; |
1706 | 1829 | ||
1707 | 1830 | ||
1831 | default: break; | ||
1708 | } | 1832 | } |
1709 | 1833 | ||
1710 | /* Line 1037 of yacc.c. */ | 1834 | /* Line 1126 of yacc.c. */ |
1711 | 1835 | ||
1712 | 1836 | ||
1713 | yyvsp -= yylen; | 1837 | yyvsp -= yylen; |
@@ -1747,12 +1871,36 @@ yyerrlab: | |||
1747 | 1871 | ||
1748 | if (YYPACT_NINF < yyn && yyn < YYLAST) | 1872 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
1749 | { | 1873 | { |
1750 | YYSIZE_T yysize = 0; | ||
1751 | int yytype = YYTRANSLATE (yychar); | 1874 | int yytype = YYTRANSLATE (yychar); |
1752 | const char* yyprefix; | 1875 | YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); |
1753 | char *yymsg; | 1876 | YYSIZE_T yysize = yysize0; |
1877 | YYSIZE_T yysize1; | ||
1878 | int yysize_overflow = 0; | ||
1879 | char *yymsg = 0; | ||
1880 | # define YYERROR_VERBOSE_ARGS_MAXIMUM 5 | ||
1881 | char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; | ||
1754 | int yyx; | 1882 | int yyx; |
1755 | 1883 | ||
1884 | #if 0 | ||
1885 | /* This is so xgettext sees the translatable formats that are | ||
1886 | constructed on the fly. */ | ||
1887 | YY_("syntax error, unexpected %s"); | ||
1888 | YY_("syntax error, unexpected %s, expecting %s"); | ||
1889 | YY_("syntax error, unexpected %s, expecting %s or %s"); | ||
1890 | YY_("syntax error, unexpected %s, expecting %s or %s or %s"); | ||
1891 | YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); | ||
1892 | #endif | ||
1893 | char *yyfmt; | ||
1894 | char const *yyf; | ||
1895 | static char const yyunexpected[] = "syntax error, unexpected %s"; | ||
1896 | static char const yyexpecting[] = ", expecting %s"; | ||
1897 | static char const yyor[] = " or %s"; | ||
1898 | char yyformat[sizeof yyunexpected | ||
1899 | + sizeof yyexpecting - 1 | ||
1900 | + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) | ||
1901 | * (sizeof yyor - 1))]; | ||
1902 | char const *yyprefix = yyexpecting; | ||
1903 | |||
1756 | /* Start YYX at -YYN if negative to avoid negative indexes in | 1904 | /* Start YYX at -YYN if negative to avoid negative indexes in |
1757 | YYCHECK. */ | 1905 | YYCHECK. */ |
1758 | int yyxbegin = yyn < 0 ? -yyn : 0; | 1906 | int yyxbegin = yyn < 0 ? -yyn : 0; |
@@ -1760,48 +1908,68 @@ yyerrlab: | |||
1760 | /* Stay within bounds of both yycheck and yytname. */ | 1908 | /* Stay within bounds of both yycheck and yytname. */ |
1761 | int yychecklim = YYLAST - yyn; | 1909 | int yychecklim = YYLAST - yyn; |
1762 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | 1910 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; |
1763 | int yycount = 0; | 1911 | int yycount = 1; |
1912 | |||
1913 | yyarg[0] = yytname[yytype]; | ||
1914 | yyfmt = yystpcpy (yyformat, yyunexpected); | ||
1764 | 1915 | ||
1765 | yyprefix = ", expecting "; | ||
1766 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | 1916 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
1767 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | 1917 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
1768 | { | 1918 | { |
1769 | yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); | 1919 | if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) |
1770 | yycount += 1; | ||
1771 | if (yycount == 5) | ||
1772 | { | 1920 | { |
1773 | yysize = 0; | 1921 | yycount = 1; |
1922 | yysize = yysize0; | ||
1923 | yyformat[sizeof yyunexpected - 1] = '\0'; | ||
1774 | break; | 1924 | break; |
1775 | } | 1925 | } |
1926 | yyarg[yycount++] = yytname[yyx]; | ||
1927 | yysize1 = yysize + yytnamerr (0, yytname[yyx]); | ||
1928 | yysize_overflow |= yysize1 < yysize; | ||
1929 | yysize = yysize1; | ||
1930 | yyfmt = yystpcpy (yyfmt, yyprefix); | ||
1931 | yyprefix = yyor; | ||
1776 | } | 1932 | } |
1777 | yysize += (sizeof ("syntax error, unexpected ") | ||
1778 | + yystrlen (yytname[yytype])); | ||
1779 | yymsg = (char *) YYSTACK_ALLOC (yysize); | ||
1780 | if (yymsg != 0) | ||
1781 | { | ||
1782 | char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); | ||
1783 | yyp = yystpcpy (yyp, yytname[yytype]); | ||
1784 | 1933 | ||
1785 | if (yycount < 5) | 1934 | yyf = YY_(yyformat); |
1935 | yysize1 = yysize + yystrlen (yyf); | ||
1936 | yysize_overflow |= yysize1 < yysize; | ||
1937 | yysize = yysize1; | ||
1938 | |||
1939 | if (!yysize_overflow && yysize <= YYSTACK_ALLOC_MAXIMUM) | ||
1940 | yymsg = (char *) YYSTACK_ALLOC (yysize); | ||
1941 | if (yymsg) | ||
1942 | { | ||
1943 | /* Avoid sprintf, as that infringes on the user's name space. | ||
1944 | Don't have undefined behavior even if the translation | ||
1945 | produced a string with the wrong number of "%s"s. */ | ||
1946 | char *yyp = yymsg; | ||
1947 | int yyi = 0; | ||
1948 | while ((*yyp = *yyf)) | ||
1786 | { | 1949 | { |
1787 | yyprefix = ", expecting "; | 1950 | if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) |
1788 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | 1951 | { |
1789 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | 1952 | yyp += yytnamerr (yyp, yyarg[yyi++]); |
1790 | { | 1953 | yyf += 2; |
1791 | yyp = yystpcpy (yyp, yyprefix); | 1954 | } |
1792 | yyp = yystpcpy (yyp, yytname[yyx]); | 1955 | else |
1793 | yyprefix = " or "; | 1956 | { |
1794 | } | 1957 | yyp++; |
1958 | yyf++; | ||
1959 | } | ||
1795 | } | 1960 | } |
1796 | yyerror (yymsg); | 1961 | yyerror (yymsg); |
1797 | YYSTACK_FREE (yymsg); | 1962 | YYSTACK_FREE (yymsg); |
1798 | } | 1963 | } |
1799 | else | 1964 | else |
1800 | yyerror ("syntax error; also virtual memory exhausted"); | 1965 | { |
1966 | yyerror (YY_("syntax error")); | ||
1967 | goto yyexhaustedlab; | ||
1968 | } | ||
1801 | } | 1969 | } |
1802 | else | 1970 | else |
1803 | #endif /* YYERROR_VERBOSE */ | 1971 | #endif /* YYERROR_VERBOSE */ |
1804 | yyerror ("syntax error"); | 1972 | yyerror (YY_("syntax error")); |
1805 | } | 1973 | } |
1806 | 1974 | ||
1807 | 1975 | ||
@@ -1813,18 +1981,9 @@ yyerrlab: | |||
1813 | 1981 | ||
1814 | if (yychar <= YYEOF) | 1982 | if (yychar <= YYEOF) |
1815 | { | 1983 | { |
1816 | /* If at end of input, pop the error token, | 1984 | /* Return failure if at end of input. */ |
1817 | then the rest of the stack, then return failure. */ | ||
1818 | if (yychar == YYEOF) | 1985 | if (yychar == YYEOF) |
1819 | for (;;) | 1986 | YYABORT; |
1820 | { | ||
1821 | |||
1822 | YYPOPSTACK; | ||
1823 | if (yyssp == yyss) | ||
1824 | YYABORT; | ||
1825 | yydestruct ("Error: popping", | ||
1826 | yystos[*yyssp], yyvsp); | ||
1827 | } | ||
1828 | } | 1987 | } |
1829 | else | 1988 | else |
1830 | { | 1989 | { |
@@ -1843,12 +2002,11 @@ yyerrlab: | |||
1843 | `---------------------------------------------------*/ | 2002 | `---------------------------------------------------*/ |
1844 | yyerrorlab: | 2003 | yyerrorlab: |
1845 | 2004 | ||
1846 | #ifdef __GNUC__ | 2005 | /* Pacify compilers like GCC when the user code never invokes |
1847 | /* Pacify GCC when the user code never invokes YYERROR and the label | 2006 | YYERROR and the label yyerrorlab therefore never appears in user |
1848 | yyerrorlab therefore never appears in user code. */ | 2007 | code. */ |
1849 | if (0) | 2008 | if (0) |
1850 | goto yyerrorlab; | 2009 | goto yyerrorlab; |
1851 | #endif | ||
1852 | 2010 | ||
1853 | yyvsp -= yylen; | 2011 | yyvsp -= yylen; |
1854 | yyssp -= yylen; | 2012 | yyssp -= yylen; |
@@ -1911,23 +2069,29 @@ yyacceptlab: | |||
1911 | | yyabortlab -- YYABORT comes here. | | 2069 | | yyabortlab -- YYABORT comes here. | |
1912 | `-----------------------------------*/ | 2070 | `-----------------------------------*/ |
1913 | yyabortlab: | 2071 | yyabortlab: |
1914 | yydestruct ("Error: discarding lookahead", | ||
1915 | yytoken, &yylval); | ||
1916 | yychar = YYEMPTY; | ||
1917 | yyresult = 1; | 2072 | yyresult = 1; |
1918 | goto yyreturn; | 2073 | goto yyreturn; |
1919 | 2074 | ||
1920 | #ifndef yyoverflow | 2075 | #ifndef yyoverflow |
1921 | /*----------------------------------------------. | 2076 | /*-------------------------------------------------. |
1922 | | yyoverflowlab -- parser overflow comes here. | | 2077 | | yyexhaustedlab -- memory exhaustion comes here. | |
1923 | `----------------------------------------------*/ | 2078 | `-------------------------------------------------*/ |
1924 | yyoverflowlab: | 2079 | yyexhaustedlab: |
1925 | yyerror ("parser stack overflow"); | 2080 | yyerror (YY_("memory exhausted")); |
1926 | yyresult = 2; | 2081 | yyresult = 2; |
1927 | /* Fall through. */ | 2082 | /* Fall through. */ |
1928 | #endif | 2083 | #endif |
1929 | 2084 | ||
1930 | yyreturn: | 2085 | yyreturn: |
2086 | if (yychar != YYEOF && yychar != YYEMPTY) | ||
2087 | yydestruct ("Cleanup: discarding lookahead", | ||
2088 | yytoken, &yylval); | ||
2089 | while (yyssp != yyss) | ||
2090 | { | ||
2091 | yydestruct ("Cleanup: popping", | ||
2092 | yystos[*yyssp], yyvsp); | ||
2093 | YYPOPSTACK; | ||
2094 | } | ||
1931 | #ifndef yyoverflow | 2095 | #ifndef yyoverflow |
1932 | if (yyss != yyssa) | 2096 | if (yyss != yyssa) |
1933 | YYSTACK_FREE (yyss); | 2097 | YYSTACK_FREE (yyss); |
@@ -1948,7 +2112,9 @@ void conf_parse(const char *name) | |||
1948 | 2112 | ||
1949 | sym_init(); | 2113 | sym_init(); |
1950 | menu_init(); | 2114 | menu_init(); |
1951 | modules_sym = sym_lookup("MODULES", 0); | 2115 | modules_sym = sym_lookup(NULL, 0); |
2116 | modules_sym->type = S_BOOLEAN; | ||
2117 | modules_sym->flags |= SYMBOL_AUTO; | ||
1952 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); | 2118 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); |
1953 | 2119 | ||
1954 | #if YYDEBUG | 2120 | #if YYDEBUG |
@@ -1958,6 +2124,12 @@ void conf_parse(const char *name) | |||
1958 | zconfparse(); | 2124 | zconfparse(); |
1959 | if (zconfnerrs) | 2125 | if (zconfnerrs) |
1960 | exit(1); | 2126 | exit(1); |
2127 | if (!modules_sym->prop) { | ||
2128 | struct property *prop; | ||
2129 | |||
2130 | prop = prop_alloc(P_DEFAULT, modules_sym); | ||
2131 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); | ||
2132 | } | ||
1961 | menu_finalize(&rootmenu); | 2133 | menu_finalize(&rootmenu); |
1962 | for_all_symbols(i, sym) { | 2134 | for_all_symbols(i, sym) { |
1963 | sym_check_deps(sym); | 2135 | sym_check_deps(sym); |
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 1f61fba6aa28..ab44feb3c600 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -71,6 +71,7 @@ static struct menu *current_menu, *current_entry; | |||
71 | %token <id>T_DEFAULT | 71 | %token <id>T_DEFAULT |
72 | %token <id>T_SELECT | 72 | %token <id>T_SELECT |
73 | %token <id>T_RANGE | 73 | %token <id>T_RANGE |
74 | %token <id>T_OPTION | ||
74 | %token <id>T_ON | 75 | %token <id>T_ON |
75 | %token <string> T_WORD | 76 | %token <string> T_WORD |
76 | %token <string> T_WORD_QUOTE | 77 | %token <string> T_WORD_QUOTE |
@@ -91,6 +92,7 @@ static struct menu *current_menu, *current_entry; | |||
91 | %type <id> end | 92 | %type <id> end |
92 | %type <id> option_name | 93 | %type <id> option_name |
93 | %type <menu> if_entry menu_entry choice_entry | 94 | %type <menu> if_entry menu_entry choice_entry |
95 | %type <string> symbol_option_arg | ||
94 | 96 | ||
95 | %destructor { | 97 | %destructor { |
96 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", | 98 | fprintf(stderr, "%s:%d: missing end statement for this entry\n", |
@@ -173,6 +175,7 @@ menuconfig_stmt: menuconfig_entry_start config_option_list | |||
173 | config_option_list: | 175 | config_option_list: |
174 | /* empty */ | 176 | /* empty */ |
175 | | config_option_list config_option | 177 | | config_option_list config_option |
178 | | config_option_list symbol_option | ||
176 | | config_option_list depends | 179 | | config_option_list depends |
177 | | config_option_list help | 180 | | config_option_list help |
178 | | config_option_list option_error | 181 | | config_option_list option_error |
@@ -215,6 +218,26 @@ config_option: T_RANGE symbol symbol if_expr T_EOL | |||
215 | printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); | 218 | printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); |
216 | }; | 219 | }; |
217 | 220 | ||
221 | symbol_option: T_OPTION symbol_option_list T_EOL | ||
222 | ; | ||
223 | |||
224 | symbol_option_list: | ||
225 | /* empty */ | ||
226 | | symbol_option_list T_WORD symbol_option_arg | ||
227 | { | ||
228 | struct kconf_id *id = kconf_id_lookup($2, strlen($2)); | ||
229 | if (id && id->flags & TF_OPTION) | ||
230 | menu_add_option(id->token, $3); | ||
231 | else | ||
232 | zconfprint("warning: ignoring unknown option %s", $2); | ||
233 | free($2); | ||
234 | }; | ||
235 | |||
236 | symbol_option_arg: | ||
237 | /* empty */ { $$ = NULL; } | ||
238 | | T_EQUAL prompt { $$ = $2; } | ||
239 | ; | ||
240 | |||
218 | /* choice entry */ | 241 | /* choice entry */ |
219 | 242 | ||
220 | choice: T_CHOICE T_EOL | 243 | choice: T_CHOICE T_EOL |
@@ -458,7 +481,9 @@ void conf_parse(const char *name) | |||
458 | 481 | ||
459 | sym_init(); | 482 | sym_init(); |
460 | menu_init(); | 483 | menu_init(); |
461 | modules_sym = sym_lookup("MODULES", 0); | 484 | modules_sym = sym_lookup(NULL, 0); |
485 | modules_sym->type = S_BOOLEAN; | ||
486 | modules_sym->flags |= SYMBOL_AUTO; | ||
462 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); | 487 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); |
463 | 488 | ||
464 | #if YYDEBUG | 489 | #if YYDEBUG |
@@ -468,6 +493,12 @@ void conf_parse(const char *name) | |||
468 | zconfparse(); | 493 | zconfparse(); |
469 | if (zconfnerrs) | 494 | if (zconfnerrs) |
470 | exit(1); | 495 | exit(1); |
496 | if (!modules_sym->prop) { | ||
497 | struct property *prop; | ||
498 | |||
499 | prop = prop_alloc(P_DEFAULT, modules_sym); | ||
500 | prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0)); | ||
501 | } | ||
471 | menu_finalize(&rootmenu); | 502 | menu_finalize(&rootmenu); |
472 | for_all_symbols(i, sym) { | 503 | for_all_symbols(i, sym) { |
473 | sym_check_deps(sym); | 504 | sym_check_deps(sym); |
diff --git a/scripts/mod/mk_elfconfig.c b/scripts/mod/mk_elfconfig.c index 3c92c83733f4..725d61c0fb43 100644 --- a/scripts/mod/mk_elfconfig.c +++ b/scripts/mod/mk_elfconfig.c | |||
@@ -28,7 +28,7 @@ main(int argc, char **argv) | |||
28 | printf("#define KERNEL_ELFCLASS ELFCLASS64\n"); | 28 | printf("#define KERNEL_ELFCLASS ELFCLASS64\n"); |
29 | break; | 29 | break; |
30 | default: | 30 | default: |
31 | abort(); | 31 | exit(1); |
32 | } | 32 | } |
33 | switch (ei[EI_DATA]) { | 33 | switch (ei[EI_DATA]) { |
34 | case ELFDATA2LSB: | 34 | case ELFDATA2LSB: |
@@ -38,7 +38,7 @@ main(int argc, char **argv) | |||
38 | printf("#define KERNEL_ELFDATA ELFDATA2MSB\n"); | 38 | printf("#define KERNEL_ELFDATA ELFDATA2MSB\n"); |
39 | break; | 39 | break; |
40 | default: | 40 | default: |
41 | abort(); | 41 | exit(1); |
42 | } | 42 | } |
43 | 43 | ||
44 | if (sizeof(unsigned long) == 4) { | 44 | if (sizeof(unsigned long) == 4) { |
@@ -53,7 +53,7 @@ main(int argc, char **argv) | |||
53 | else if (memcmp(endian_test.c, "\x02\x01", 2) == 0) | 53 | else if (memcmp(endian_test.c, "\x02\x01", 2) == 0) |
54 | printf("#define HOST_ELFDATA ELFDATA2LSB\n"); | 54 | printf("#define HOST_ELFDATA ELFDATA2LSB\n"); |
55 | else | 55 | else |
56 | abort(); | 56 | exit(1); |
57 | 57 | ||
58 | if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0)) | 58 | if ((strcmp(argv[1], "v850") == 0) || (strcmp(argv[1], "h8300") == 0)) |
59 | printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); | 59 | printf("#define MODULE_SYMBOL_PREFIX \"_\"\n"); |
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index d0f86ed43f7a..0dd16177642d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
@@ -13,6 +13,7 @@ | |||
13 | 13 | ||
14 | #include <ctype.h> | 14 | #include <ctype.h> |
15 | #include "modpost.h" | 15 | #include "modpost.h" |
16 | #include "../../include/linux/license.h" | ||
16 | 17 | ||
17 | /* Are we using CONFIG_MODVERSIONS? */ | 18 | /* Are we using CONFIG_MODVERSIONS? */ |
18 | int modversions = 0; | 19 | int modversions = 0; |
@@ -22,6 +23,8 @@ int have_vmlinux = 0; | |||
22 | static int all_versions = 0; | 23 | static int all_versions = 0; |
23 | /* If we are modposting external module set to 1 */ | 24 | /* If we are modposting external module set to 1 */ |
24 | static int external_module = 0; | 25 | static int external_module = 0; |
26 | /* How a symbol is exported */ | ||
27 | enum export {export_plain, export_gpl, export_gpl_future, export_unknown}; | ||
25 | 28 | ||
26 | void fatal(const char *fmt, ...) | 29 | void fatal(const char *fmt, ...) |
27 | { | 30 | { |
@@ -97,6 +100,7 @@ static struct module *new_module(char *modname) | |||
97 | 100 | ||
98 | /* add to list */ | 101 | /* add to list */ |
99 | mod->name = p; | 102 | mod->name = p; |
103 | mod->gpl_compatible = -1; | ||
100 | mod->next = modules; | 104 | mod->next = modules; |
101 | modules = mod; | 105 | modules = mod; |
102 | 106 | ||
@@ -118,6 +122,7 @@ struct symbol { | |||
118 | unsigned int kernel:1; /* 1 if symbol is from kernel | 122 | unsigned int kernel:1; /* 1 if symbol is from kernel |
119 | * (only for external modules) **/ | 123 | * (only for external modules) **/ |
120 | unsigned int preloaded:1; /* 1 if symbol from Module.symvers */ | 124 | unsigned int preloaded:1; /* 1 if symbol from Module.symvers */ |
125 | enum export export; /* Type of export */ | ||
121 | char name[0]; | 126 | char name[0]; |
122 | }; | 127 | }; |
123 | 128 | ||
@@ -153,7 +158,8 @@ static struct symbol *alloc_symbol(const char *name, unsigned int weak, | |||
153 | } | 158 | } |
154 | 159 | ||
155 | /* For the hash of exported symbols */ | 160 | /* For the hash of exported symbols */ |
156 | static struct symbol *new_symbol(const char *name, struct module *module) | 161 | static struct symbol *new_symbol(const char *name, struct module *module, |
162 | enum export export) | ||
157 | { | 163 | { |
158 | unsigned int hash; | 164 | unsigned int hash; |
159 | struct symbol *new; | 165 | struct symbol *new; |
@@ -161,6 +167,7 @@ static struct symbol *new_symbol(const char *name, struct module *module) | |||
161 | hash = tdb_hash(name) % SYMBOL_HASH_SIZE; | 167 | hash = tdb_hash(name) % SYMBOL_HASH_SIZE; |
162 | new = symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); | 168 | new = symbolhash[hash] = alloc_symbol(name, 0, symbolhash[hash]); |
163 | new->module = module; | 169 | new->module = module; |
170 | new->export = export; | ||
164 | return new; | 171 | return new; |
165 | } | 172 | } |
166 | 173 | ||
@@ -179,16 +186,55 @@ static struct symbol *find_symbol(const char *name) | |||
179 | return NULL; | 186 | return NULL; |
180 | } | 187 | } |
181 | 188 | ||
189 | static struct { | ||
190 | const char *str; | ||
191 | enum export export; | ||
192 | } export_list[] = { | ||
193 | { .str = "EXPORT_SYMBOL", .export = export_plain }, | ||
194 | { .str = "EXPORT_SYMBOL_GPL", .export = export_gpl }, | ||
195 | { .str = "EXPORT_SYMBOL_GPL_FUTURE", .export = export_gpl_future }, | ||
196 | { .str = "(unknown)", .export = export_unknown }, | ||
197 | }; | ||
198 | |||
199 | |||
200 | static const char *export_str(enum export ex) | ||
201 | { | ||
202 | return export_list[ex].str; | ||
203 | } | ||
204 | |||
205 | static enum export export_no(const char * s) | ||
206 | { | ||
207 | int i; | ||
208 | for (i = 0; export_list[i].export != export_unknown; i++) { | ||
209 | if (strcmp(export_list[i].str, s) == 0) | ||
210 | return export_list[i].export; | ||
211 | } | ||
212 | return export_unknown; | ||
213 | } | ||
214 | |||
215 | static enum export export_from_sec(struct elf_info *elf, Elf_Section sec) | ||
216 | { | ||
217 | if (sec == elf->export_sec) | ||
218 | return export_plain; | ||
219 | else if (sec == elf->export_gpl_sec) | ||
220 | return export_gpl; | ||
221 | else if (sec == elf->export_gpl_future_sec) | ||
222 | return export_gpl_future; | ||
223 | else | ||
224 | return export_unknown; | ||
225 | } | ||
226 | |||
182 | /** | 227 | /** |
183 | * Add an exported symbol - it may have already been added without a | 228 | * Add an exported symbol - it may have already been added without a |
184 | * CRC, in this case just update the CRC | 229 | * CRC, in this case just update the CRC |
185 | **/ | 230 | **/ |
186 | static struct symbol *sym_add_exported(const char *name, struct module *mod) | 231 | static struct symbol *sym_add_exported(const char *name, struct module *mod, |
232 | enum export export) | ||
187 | { | 233 | { |
188 | struct symbol *s = find_symbol(name); | 234 | struct symbol *s = find_symbol(name); |
189 | 235 | ||
190 | if (!s) { | 236 | if (!s) { |
191 | s = new_symbol(name, mod); | 237 | s = new_symbol(name, mod, export); |
192 | } else { | 238 | } else { |
193 | if (!s->preloaded) { | 239 | if (!s->preloaded) { |
194 | warn("%s: '%s' exported twice. Previous export " | 240 | warn("%s: '%s' exported twice. Previous export " |
@@ -200,16 +246,17 @@ static struct symbol *sym_add_exported(const char *name, struct module *mod) | |||
200 | s->preloaded = 0; | 246 | s->preloaded = 0; |
201 | s->vmlinux = is_vmlinux(mod->name); | 247 | s->vmlinux = is_vmlinux(mod->name); |
202 | s->kernel = 0; | 248 | s->kernel = 0; |
249 | s->export = export; | ||
203 | return s; | 250 | return s; |
204 | } | 251 | } |
205 | 252 | ||
206 | static void sym_update_crc(const char *name, struct module *mod, | 253 | static void sym_update_crc(const char *name, struct module *mod, |
207 | unsigned int crc) | 254 | unsigned int crc, enum export export) |
208 | { | 255 | { |
209 | struct symbol *s = find_symbol(name); | 256 | struct symbol *s = find_symbol(name); |
210 | 257 | ||
211 | if (!s) | 258 | if (!s) |
212 | s = new_symbol(name, mod); | 259 | s = new_symbol(name, mod, export); |
213 | s->crc = crc; | 260 | s->crc = crc; |
214 | s->crc_valid = 1; | 261 | s->crc_valid = 1; |
215 | } | 262 | } |
@@ -283,7 +330,7 @@ static void parse_elf(struct elf_info *info, const char *filename) | |||
283 | hdr = grab_file(filename, &info->size); | 330 | hdr = grab_file(filename, &info->size); |
284 | if (!hdr) { | 331 | if (!hdr) { |
285 | perror(filename); | 332 | perror(filename); |
286 | abort(); | 333 | exit(1); |
287 | } | 334 | } |
288 | info->hdr = hdr; | 335 | info->hdr = hdr; |
289 | if (info->size < sizeof(*hdr)) | 336 | if (info->size < sizeof(*hdr)) |
@@ -309,13 +356,21 @@ static void parse_elf(struct elf_info *info, const char *filename) | |||
309 | for (i = 1; i < hdr->e_shnum; i++) { | 356 | for (i = 1; i < hdr->e_shnum; i++) { |
310 | const char *secstrings | 357 | const char *secstrings |
311 | = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; | 358 | = (void *)hdr + sechdrs[hdr->e_shstrndx].sh_offset; |
359 | const char *secname; | ||
312 | 360 | ||
313 | if (sechdrs[i].sh_offset > info->size) | 361 | if (sechdrs[i].sh_offset > info->size) |
314 | goto truncated; | 362 | goto truncated; |
315 | if (strcmp(secstrings+sechdrs[i].sh_name, ".modinfo") == 0) { | 363 | secname = secstrings + sechdrs[i].sh_name; |
364 | if (strcmp(secname, ".modinfo") == 0) { | ||
316 | info->modinfo = (void *)hdr + sechdrs[i].sh_offset; | 365 | info->modinfo = (void *)hdr + sechdrs[i].sh_offset; |
317 | info->modinfo_len = sechdrs[i].sh_size; | 366 | info->modinfo_len = sechdrs[i].sh_size; |
318 | } | 367 | } else if (strcmp(secname, "__ksymtab") == 0) |
368 | info->export_sec = i; | ||
369 | else if (strcmp(secname, "__ksymtab_gpl") == 0) | ||
370 | info->export_gpl_sec = i; | ||
371 | else if (strcmp(secname, "__ksymtab_gpl_future") == 0) | ||
372 | info->export_gpl_future_sec = i; | ||
373 | |||
319 | if (sechdrs[i].sh_type != SHT_SYMTAB) | 374 | if (sechdrs[i].sh_type != SHT_SYMTAB) |
320 | continue; | 375 | continue; |
321 | 376 | ||
@@ -353,6 +408,7 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
353 | Elf_Sym *sym, const char *symname) | 408 | Elf_Sym *sym, const char *symname) |
354 | { | 409 | { |
355 | unsigned int crc; | 410 | unsigned int crc; |
411 | enum export export = export_from_sec(info, sym->st_shndx); | ||
356 | 412 | ||
357 | switch (sym->st_shndx) { | 413 | switch (sym->st_shndx) { |
358 | case SHN_COMMON: | 414 | case SHN_COMMON: |
@@ -362,7 +418,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
362 | /* CRC'd symbol */ | 418 | /* CRC'd symbol */ |
363 | if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { | 419 | if (memcmp(symname, CRC_PFX, strlen(CRC_PFX)) == 0) { |
364 | crc = (unsigned int) sym->st_value; | 420 | crc = (unsigned int) sym->st_value; |
365 | sym_update_crc(symname + strlen(CRC_PFX), mod, crc); | 421 | sym_update_crc(symname + strlen(CRC_PFX), mod, crc, |
422 | export); | ||
366 | } | 423 | } |
367 | break; | 424 | break; |
368 | case SHN_UNDEF: | 425 | case SHN_UNDEF: |
@@ -406,7 +463,8 @@ static void handle_modversions(struct module *mod, struct elf_info *info, | |||
406 | default: | 463 | default: |
407 | /* All exported symbols */ | 464 | /* All exported symbols */ |
408 | if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) { | 465 | if (memcmp(symname, KSYMTAB_PFX, strlen(KSYMTAB_PFX)) == 0) { |
409 | sym_add_exported(symname + strlen(KSYMTAB_PFX), mod); | 466 | sym_add_exported(symname + strlen(KSYMTAB_PFX), mod, |
467 | export); | ||
410 | } | 468 | } |
411 | if (strcmp(symname, MODULE_SYMBOL_PREFIX "init_module") == 0) | 469 | if (strcmp(symname, MODULE_SYMBOL_PREFIX "init_module") == 0) |
412 | mod->has_init = 1; | 470 | mod->has_init = 1; |
@@ -437,13 +495,18 @@ static char *next_string(char *string, unsigned long *secsize) | |||
437 | return string; | 495 | return string; |
438 | } | 496 | } |
439 | 497 | ||
440 | static char *get_modinfo(void *modinfo, unsigned long modinfo_len, | 498 | static char *get_next_modinfo(void *modinfo, unsigned long modinfo_len, |
441 | const char *tag) | 499 | const char *tag, char *info) |
442 | { | 500 | { |
443 | char *p; | 501 | char *p; |
444 | unsigned int taglen = strlen(tag); | 502 | unsigned int taglen = strlen(tag); |
445 | unsigned long size = modinfo_len; | 503 | unsigned long size = modinfo_len; |
446 | 504 | ||
505 | if (info) { | ||
506 | size -= info - (char *)modinfo; | ||
507 | modinfo = next_string(info, &size); | ||
508 | } | ||
509 | |||
447 | for (p = modinfo; p; p = next_string(p, &size)) { | 510 | for (p = modinfo; p; p = next_string(p, &size)) { |
448 | if (strncmp(p, tag, taglen) == 0 && p[taglen] == '=') | 511 | if (strncmp(p, tag, taglen) == 0 && p[taglen] == '=') |
449 | return p + taglen + 1; | 512 | return p + taglen + 1; |
@@ -451,6 +514,13 @@ static char *get_modinfo(void *modinfo, unsigned long modinfo_len, | |||
451 | return NULL; | 514 | return NULL; |
452 | } | 515 | } |
453 | 516 | ||
517 | static char *get_modinfo(void *modinfo, unsigned long modinfo_len, | ||
518 | const char *tag) | ||
519 | |||
520 | { | ||
521 | return get_next_modinfo(modinfo, modinfo_len, tag, NULL); | ||
522 | } | ||
523 | |||
454 | /** | 524 | /** |
455 | * Test if string s ends in string sub | 525 | * Test if string s ends in string sub |
456 | * return 0 if match | 526 | * return 0 if match |
@@ -821,6 +891,10 @@ static int init_section_ref_ok(const char *name) | |||
821 | ".pci_fixup_final", | 891 | ".pci_fixup_final", |
822 | ".pdr", | 892 | ".pdr", |
823 | "__param", | 893 | "__param", |
894 | "__ex_table", | ||
895 | ".fixup", | ||
896 | ".smp_locks", | ||
897 | ".plt", /* seen on ARCH=um build on x86_64. Harmless */ | ||
824 | NULL | 898 | NULL |
825 | }; | 899 | }; |
826 | /* Start of section names */ | 900 | /* Start of section names */ |
@@ -846,6 +920,8 @@ static int init_section_ref_ok(const char *name) | |||
846 | for (s = namelist3; *s; s++) | 920 | for (s = namelist3; *s; s++) |
847 | if (strstr(name, *s) != NULL) | 921 | if (strstr(name, *s) != NULL) |
848 | return 1; | 922 | return 1; |
923 | if (strrcmp(name, ".init") == 0) | ||
924 | return 1; | ||
849 | return 0; | 925 | return 0; |
850 | } | 926 | } |
851 | 927 | ||
@@ -892,6 +968,10 @@ static int exit_section_ref_ok(const char *name) | |||
892 | ".exitcall.exit", | 968 | ".exitcall.exit", |
893 | ".eh_frame", | 969 | ".eh_frame", |
894 | ".stab", | 970 | ".stab", |
971 | "__ex_table", | ||
972 | ".fixup", | ||
973 | ".smp_locks", | ||
974 | ".plt", /* seen on ARCH=um build on x86_64. Harmless */ | ||
895 | NULL | 975 | NULL |
896 | }; | 976 | }; |
897 | /* Start of section names */ | 977 | /* Start of section names */ |
@@ -921,6 +1001,7 @@ static void read_symbols(char *modname) | |||
921 | { | 1001 | { |
922 | const char *symname; | 1002 | const char *symname; |
923 | char *version; | 1003 | char *version; |
1004 | char *license; | ||
924 | struct module *mod; | 1005 | struct module *mod; |
925 | struct elf_info info = { }; | 1006 | struct elf_info info = { }; |
926 | Elf_Sym *sym; | 1007 | Elf_Sym *sym; |
@@ -936,6 +1017,18 @@ static void read_symbols(char *modname) | |||
936 | mod->skip = 1; | 1017 | mod->skip = 1; |
937 | } | 1018 | } |
938 | 1019 | ||
1020 | license = get_modinfo(info.modinfo, info.modinfo_len, "license"); | ||
1021 | while (license) { | ||
1022 | if (license_is_gpl_compatible(license)) | ||
1023 | mod->gpl_compatible = 1; | ||
1024 | else { | ||
1025 | mod->gpl_compatible = 0; | ||
1026 | break; | ||
1027 | } | ||
1028 | license = get_next_modinfo(info.modinfo, info.modinfo_len, | ||
1029 | "license", license); | ||
1030 | } | ||
1031 | |||
939 | for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { | 1032 | for (sym = info.symtab_start; sym < info.symtab_stop; sym++) { |
940 | symname = info.strtab + sym->st_name; | 1033 | symname = info.strtab + sym->st_name; |
941 | 1034 | ||
@@ -992,6 +1085,41 @@ void buf_write(struct buffer *buf, const char *s, int len) | |||
992 | buf->pos += len; | 1085 | buf->pos += len; |
993 | } | 1086 | } |
994 | 1087 | ||
1088 | void check_license(struct module *mod) | ||
1089 | { | ||
1090 | struct symbol *s, *exp; | ||
1091 | |||
1092 | for (s = mod->unres; s; s = s->next) { | ||
1093 | const char *basename; | ||
1094 | if (mod->gpl_compatible == 1) { | ||
1095 | /* GPL-compatible modules may use all symbols */ | ||
1096 | continue; | ||
1097 | } | ||
1098 | exp = find_symbol(s->name); | ||
1099 | if (!exp || exp->module == mod) | ||
1100 | continue; | ||
1101 | basename = strrchr(mod->name, '/'); | ||
1102 | if (basename) | ||
1103 | basename++; | ||
1104 | switch (exp->export) { | ||
1105 | case export_gpl: | ||
1106 | fatal("modpost: GPL-incompatible module %s " | ||
1107 | "uses GPL-only symbol '%s'\n", | ||
1108 | basename ? basename : mod->name, | ||
1109 | exp->name); | ||
1110 | break; | ||
1111 | case export_gpl_future: | ||
1112 | warn("modpost: GPL-incompatible module %s " | ||
1113 | "uses future GPL-only symbol '%s'\n", | ||
1114 | basename ? basename : mod->name, | ||
1115 | exp->name); | ||
1116 | break; | ||
1117 | case export_plain: /* ignore */ break; | ||
1118 | case export_unknown: /* ignore */ break; | ||
1119 | } | ||
1120 | } | ||
1121 | } | ||
1122 | |||
995 | /** | 1123 | /** |
996 | * Header for the generated file | 1124 | * Header for the generated file |
997 | **/ | 1125 | **/ |
@@ -1142,6 +1270,9 @@ static void write_if_changed(struct buffer *b, const char *fname) | |||
1142 | fclose(file); | 1270 | fclose(file); |
1143 | } | 1271 | } |
1144 | 1272 | ||
1273 | /* parse Module.symvers file. line format: | ||
1274 | * 0x12345678<tab>symbol<tab>module[<tab>export] | ||
1275 | **/ | ||
1145 | static void read_dump(const char *fname, unsigned int kernel) | 1276 | static void read_dump(const char *fname, unsigned int kernel) |
1146 | { | 1277 | { |
1147 | unsigned long size, pos = 0; | 1278 | unsigned long size, pos = 0; |
@@ -1153,7 +1284,7 @@ static void read_dump(const char *fname, unsigned int kernel) | |||
1153 | return; | 1284 | return; |
1154 | 1285 | ||
1155 | while ((line = get_next_line(&pos, file, size))) { | 1286 | while ((line = get_next_line(&pos, file, size))) { |
1156 | char *symname, *modname, *d; | 1287 | char *symname, *modname, *d, *export; |
1157 | unsigned int crc; | 1288 | unsigned int crc; |
1158 | struct module *mod; | 1289 | struct module *mod; |
1159 | struct symbol *s; | 1290 | struct symbol *s; |
@@ -1164,8 +1295,9 @@ static void read_dump(const char *fname, unsigned int kernel) | |||
1164 | if (!(modname = strchr(symname, '\t'))) | 1295 | if (!(modname = strchr(symname, '\t'))) |
1165 | goto fail; | 1296 | goto fail; |
1166 | *modname++ = '\0'; | 1297 | *modname++ = '\0'; |
1167 | if (strchr(modname, '\t')) | 1298 | if ((export = strchr(modname, '\t')) != NULL) |
1168 | goto fail; | 1299 | *export++ = '\0'; |
1300 | |||
1169 | crc = strtoul(line, &d, 16); | 1301 | crc = strtoul(line, &d, 16); |
1170 | if (*symname == '\0' || *modname == '\0' || *d != '\0') | 1302 | if (*symname == '\0' || *modname == '\0' || *d != '\0') |
1171 | goto fail; | 1303 | goto fail; |
@@ -1177,10 +1309,10 @@ static void read_dump(const char *fname, unsigned int kernel) | |||
1177 | mod = new_module(NOFAIL(strdup(modname))); | 1309 | mod = new_module(NOFAIL(strdup(modname))); |
1178 | mod->skip = 1; | 1310 | mod->skip = 1; |
1179 | } | 1311 | } |
1180 | s = sym_add_exported(symname, mod); | 1312 | s = sym_add_exported(symname, mod, export_no(export)); |
1181 | s->kernel = kernel; | 1313 | s->kernel = kernel; |
1182 | s->preloaded = 1; | 1314 | s->preloaded = 1; |
1183 | sym_update_crc(symname, mod, crc); | 1315 | sym_update_crc(symname, mod, crc, export_no(export)); |
1184 | } | 1316 | } |
1185 | return; | 1317 | return; |
1186 | fail: | 1318 | fail: |
@@ -1210,9 +1342,10 @@ static void write_dump(const char *fname) | |||
1210 | symbol = symbolhash[n]; | 1342 | symbol = symbolhash[n]; |
1211 | while (symbol) { | 1343 | while (symbol) { |
1212 | if (dump_sym(symbol)) | 1344 | if (dump_sym(symbol)) |
1213 | buf_printf(&buf, "0x%08x\t%s\t%s\n", | 1345 | buf_printf(&buf, "0x%08x\t%s\t%s\t%s\n", |
1214 | symbol->crc, symbol->name, | 1346 | symbol->crc, symbol->name, |
1215 | symbol->module->name); | 1347 | symbol->module->name, |
1348 | export_str(symbol->export)); | ||
1216 | symbol = symbol->next; | 1349 | symbol = symbol->next; |
1217 | } | 1350 | } |
1218 | } | 1351 | } |
@@ -1263,6 +1396,12 @@ int main(int argc, char **argv) | |||
1263 | for (mod = modules; mod; mod = mod->next) { | 1396 | for (mod = modules; mod; mod = mod->next) { |
1264 | if (mod->skip) | 1397 | if (mod->skip) |
1265 | continue; | 1398 | continue; |
1399 | check_license(mod); | ||
1400 | } | ||
1401 | |||
1402 | for (mod = modules; mod; mod = mod->next) { | ||
1403 | if (mod->skip) | ||
1404 | continue; | ||
1266 | 1405 | ||
1267 | buf.pos = 0; | 1406 | buf.pos = 0; |
1268 | 1407 | ||
diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 861d866fcd83..2b00c6062844 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h | |||
@@ -100,6 +100,7 @@ buf_write(struct buffer *buf, const char *s, int len); | |||
100 | struct module { | 100 | struct module { |
101 | struct module *next; | 101 | struct module *next; |
102 | const char *name; | 102 | const char *name; |
103 | int gpl_compatible; | ||
103 | struct symbol *unres; | 104 | struct symbol *unres; |
104 | int seen; | 105 | int seen; |
105 | int skip; | 106 | int skip; |
@@ -115,6 +116,9 @@ struct elf_info { | |||
115 | Elf_Shdr *sechdrs; | 116 | Elf_Shdr *sechdrs; |
116 | Elf_Sym *symtab_start; | 117 | Elf_Sym *symtab_start; |
117 | Elf_Sym *symtab_stop; | 118 | Elf_Sym *symtab_stop; |
119 | Elf_Section export_sec; | ||
120 | Elf_Section export_gpl_sec; | ||
121 | Elf_Section export_gpl_future_sec; | ||
118 | const char *strtab; | 122 | const char *strtab; |
119 | char *modinfo; | 123 | char *modinfo; |
120 | unsigned int modinfo_len; | 124 | unsigned int modinfo_len; |
diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 0b1038737548..df892841b118 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec | |||
@@ -73,8 +73,13 @@ echo "%ifarch ia64" | |||
73 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" | 73 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" |
74 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" | 74 | echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" |
75 | echo "%else" | 75 | echo "%else" |
76 | echo "%ifarch ppc64" | ||
77 | echo "cp vmlinux arch/powerpc/boot" | ||
78 | echo "cp arch/powerpc/boot/"'$KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | ||
79 | echo "%else" | ||
76 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" | 80 | echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" |
77 | echo "%endif" | 81 | echo "%endif" |
82 | echo "%endif" | ||
78 | 83 | ||
79 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" | 84 | echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" |
80 | 85 | ||
diff --git a/scripts/setlocalversion b/scripts/setlocalversion index 9a23825218f2..82e4993f0a73 100644 --- a/scripts/setlocalversion +++ b/scripts/setlocalversion | |||
@@ -11,12 +11,12 @@ cd "${1:-.}" || usage | |||
11 | # Check for git and a git repo. | 11 | # Check for git and a git repo. |
12 | if head=`git rev-parse --verify HEAD 2>/dev/null`; then | 12 | if head=`git rev-parse --verify HEAD 2>/dev/null`; then |
13 | # Do we have an untagged version? | 13 | # Do we have an untagged version? |
14 | if [ "`git name-rev --tags HEAD`" = "HEAD undefined" ]; then | 14 | if git name-rev --tags HEAD | grep -E '^HEAD[[:space:]]+(.*~[0-9]*|undefined)$' > /dev/null; then |
15 | printf '%s%s' -g `echo "$head" | cut -c1-8` | 15 | printf '%s%s' -g `echo "$head" | cut -c1-8` |
16 | fi | 16 | fi |
17 | 17 | ||
18 | # Are there uncommitted changes? | 18 | # Are there uncommitted changes? |
19 | if git diff-files | read dummy; then | 19 | if git diff-index HEAD | read dummy; then |
20 | printf '%s' -dirty | 20 | printf '%s' -dirty |
21 | fi | 21 | fi |
22 | fi | 22 | fi |