diff options
Diffstat (limited to 'scripts/kconfig')
28 files changed, 657 insertions, 569 deletions
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore index 624f6502e03..be603c4fef6 100644 --- a/scripts/kconfig/.gitignore +++ b/scripts/kconfig/.gitignore | |||
@@ -2,12 +2,11 @@ | |||
2 | # Generated files | 2 | # Generated files |
3 | # | 3 | # |
4 | config* | 4 | config* |
5 | lex.*.c | 5 | *.lex.c |
6 | *.tab.c | 6 | *.tab.c |
7 | *.tab.h | 7 | *.tab.h |
8 | zconf.hash.c | 8 | zconf.hash.c |
9 | *.moc | 9 | *.moc |
10 | lkc_defs.h | ||
11 | gconf.glade.h | 10 | gconf.glade.h |
12 | *.pot | 11 | *.pot |
13 | *.mo | 12 | *.mo |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index faa9a4701b6..82d2eb285b7 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -170,8 +170,8 @@ mconf-objs := mconf.o zconf.tab.o $(lxdialog) | |||
170 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o | 170 | nconf-objs := nconf.o zconf.tab.o nconf.gui.o |
171 | kxgettext-objs := kxgettext.o zconf.tab.o | 171 | kxgettext-objs := kxgettext.o zconf.tab.o |
172 | qconf-cxxobjs := qconf.o | 172 | qconf-cxxobjs := qconf.o |
173 | qconf-objs := kconfig_load.o zconf.tab.o | 173 | qconf-objs := zconf.tab.o |
174 | gconf-objs := gconf.o kconfig_load.o zconf.tab.o | 174 | gconf-objs := gconf.o zconf.tab.o |
175 | 175 | ||
176 | hostprogs-y := conf | 176 | hostprogs-y := conf |
177 | 177 | ||
@@ -203,8 +203,8 @@ ifeq ($(gconf-target),1) | |||
203 | hostprogs-y += gconf | 203 | hostprogs-y += gconf |
204 | endif | 204 | endif |
205 | 205 | ||
206 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck .tmp_gtkcheck | 206 | clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck |
207 | clean-files += zconf.tab.c lex.zconf.c zconf.hash.c gconf.glade.h | 207 | clean-files += zconf.tab.c zconf.lex.c zconf.hash.c gconf.glade.h |
208 | clean-files += mconf qconf gconf nconf | 208 | clean-files += mconf qconf gconf nconf |
209 | clean-files += config.pot linux.pot | 209 | clean-files += config.pot linux.pot |
210 | 210 | ||
@@ -220,15 +220,18 @@ always := dochecklxdialog | |||
220 | HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) | 220 | HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) |
221 | 221 | ||
222 | # generated files seem to need this to find local include files | 222 | # generated files seem to need this to find local include files |
223 | HOSTCFLAGS_lex.zconf.o := -I$(src) | 223 | HOSTCFLAGS_zconf.lex.o := -I$(src) |
224 | HOSTCFLAGS_zconf.tab.o := -I$(src) | 224 | HOSTCFLAGS_zconf.tab.o := -I$(src) |
225 | 225 | ||
226 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -ldl | 226 | LEX_PREFIX_zconf := zconf |
227 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) -D LKC_DIRECT_LINK | 227 | YACC_PREFIX_zconf := zconf |
228 | 228 | ||
229 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -ldl | 229 | HOSTLOADLIBES_qconf = $(KC_QT_LIBS) |
230 | HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) | ||
231 | |||
232 | HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` | ||
230 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ | 233 | HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ |
231 | -D LKC_DIRECT_LINK | 234 | -Wno-missing-prototypes |
232 | 235 | ||
233 | HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) | 236 | HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) |
234 | 237 | ||
@@ -316,47 +319,15 @@ $(obj)/.tmp_gtkcheck: | |||
316 | fi | 319 | fi |
317 | endif | 320 | endif |
318 | 321 | ||
319 | $(obj)/zconf.tab.o: $(obj)/lex.zconf.c $(obj)/zconf.hash.c | 322 | $(obj)/zconf.tab.o: $(obj)/zconf.lex.c $(obj)/zconf.hash.c |
320 | |||
321 | $(obj)/kconfig_load.o: $(obj)/lkc_defs.h | ||
322 | |||
323 | $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h | ||
324 | 323 | ||
325 | $(obj)/gconf.o: $(obj)/lkc_defs.h | 324 | $(obj)/qconf.o: $(obj)/qconf.moc |
326 | 325 | ||
327 | $(obj)/%.moc: $(src)/%.h | 326 | $(obj)/%.moc: $(src)/%.h |
328 | $(KC_QT_MOC) -i $< -o $@ | 327 | $(KC_QT_MOC) -i $< -o $@ |
329 | 328 | ||
330 | $(obj)/lkc_defs.h: $(src)/lkc_proto.h | ||
331 | $(Q)sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' | ||
332 | |||
333 | # Extract gconf menu items for I18N support | 329 | # Extract gconf menu items for I18N support |
334 | $(obj)/gconf.glade.h: $(obj)/gconf.glade | 330 | $(obj)/gconf.glade.h: $(obj)/gconf.glade |
335 | $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ | 331 | $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ |
336 | $(obj)/gconf.glade | 332 | $(obj)/gconf.glade |
337 | 333 | ||
338 | ### | ||
339 | # The following requires flex/bison/gperf | ||
340 | # By default we use the _shipped versions, uncomment the following line if | ||
341 | # you are modifying the flex/bison src. | ||
342 | # LKC_GENPARSER := 1 | ||
343 | |||
344 | ifdef LKC_GENPARSER | ||
345 | |||
346 | $(obj)/zconf.tab.c: $(src)/zconf.y | ||
347 | $(obj)/lex.zconf.c: $(src)/zconf.l | ||
348 | $(obj)/zconf.hash.c: $(src)/zconf.gperf | ||
349 | |||
350 | %.tab.c: %.y | ||
351 | bison -l -b $* -p $(notdir $*) $< | ||
352 | cp $@ $@_shipped | ||
353 | |||
354 | lex.%.c: %.l | ||
355 | flex -L -P$(notdir $*) -o$@ $< | ||
356 | cp $@ $@_shipped | ||
357 | |||
358 | %.hash.c: %.gperf | ||
359 | gperf < $< > $@ | ||
360 | cp $@ $@_shipped | ||
361 | |||
362 | endif | ||
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c index 006ad817cd5..f208f900ed3 100644 --- a/scripts/kconfig/conf.c +++ b/scripts/kconfig/conf.c | |||
@@ -14,11 +14,11 @@ | |||
14 | #include <sys/stat.h> | 14 | #include <sys/stat.h> |
15 | #include <sys/time.h> | 15 | #include <sys/time.h> |
16 | 16 | ||
17 | #define LKC_DIRECT_LINK | ||
18 | #include "lkc.h" | 17 | #include "lkc.h" |
19 | 18 | ||
20 | static void conf(struct menu *menu); | 19 | static void conf(struct menu *menu); |
21 | static void check_conf(struct menu *menu); | 20 | static void check_conf(struct menu *menu); |
21 | static void xfgets(char *str, int size, FILE *in); | ||
22 | 22 | ||
23 | enum input_mode { | 23 | enum input_mode { |
24 | oldaskconfig, | 24 | oldaskconfig, |
@@ -35,8 +35,6 @@ enum input_mode { | |||
35 | oldnoconfig, | 35 | oldnoconfig, |
36 | } input_mode = oldaskconfig; | 36 | } input_mode = oldaskconfig; |
37 | 37 | ||
38 | char *defconfig_file; | ||
39 | |||
40 | static int indent = 1; | 38 | static int indent = 1; |
41 | static int valid_stdin = 1; | 39 | static int valid_stdin = 1; |
42 | static int sync_kconfig; | 40 | static int sync_kconfig; |
@@ -106,6 +104,7 @@ static int conf_askvalue(struct symbol *sym, const char *def) | |||
106 | return 0; | 104 | return 0; |
107 | } | 105 | } |
108 | check_stdin(); | 106 | check_stdin(); |
107 | /* fall through */ | ||
109 | case oldaskconfig: | 108 | case oldaskconfig: |
110 | fflush(stdout); | 109 | fflush(stdout); |
111 | xfgets(line, 128, stdin); | 110 | xfgets(line, 128, stdin); |
@@ -150,6 +149,7 @@ static int conf_string(struct menu *menu) | |||
150 | def = NULL; | 149 | def = NULL; |
151 | break; | 150 | break; |
152 | } | 151 | } |
152 | /* fall through */ | ||
153 | default: | 153 | default: |
154 | line[strlen(line)-1] = 0; | 154 | line[strlen(line)-1] = 0; |
155 | def = line; | 155 | def = line; |
@@ -304,6 +304,7 @@ static int conf_choice(struct menu *menu) | |||
304 | break; | 304 | break; |
305 | } | 305 | } |
306 | check_stdin(); | 306 | check_stdin(); |
307 | /* fall through */ | ||
307 | case oldaskconfig: | 308 | case oldaskconfig: |
308 | fflush(stdout); | 309 | fflush(stdout); |
309 | xfgets(line, 128, stdin); | 310 | xfgets(line, 128, stdin); |
@@ -369,6 +370,7 @@ static void conf(struct menu *menu) | |||
369 | check_conf(menu); | 370 | check_conf(menu); |
370 | return; | 371 | return; |
371 | } | 372 | } |
373 | /* fall through */ | ||
372 | case P_COMMENT: | 374 | case P_COMMENT: |
373 | prompt = menu_get_prompt(menu); | 375 | prompt = menu_get_prompt(menu); |
374 | if (prompt) | 376 | if (prompt) |
@@ -456,10 +458,30 @@ static struct option long_opts[] = { | |||
456 | {NULL, 0, NULL, 0} | 458 | {NULL, 0, NULL, 0} |
457 | }; | 459 | }; |
458 | 460 | ||
461 | static void conf_usage(const char *progname) | ||
462 | { | ||
463 | |||
464 | printf("Usage: %s [option] <kconfig-file>\n", progname); | ||
465 | printf("[option] is _one_ of the following:\n"); | ||
466 | printf(" --listnewconfig List new options\n"); | ||
467 | printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); | ||
468 | printf(" --oldconfig Update a configuration using a provided .config as base\n"); | ||
469 | printf(" --silentoldconfig Same as oldconfig, but quietly, additionally update deps\n"); | ||
470 | printf(" --oldnoconfig Same as silentoldconfig but set new symbols to no\n"); | ||
471 | printf(" --defconfig <file> New config with default defined in <file>\n"); | ||
472 | printf(" --savedefconfig <file> Save the minimal current configuration to <file>\n"); | ||
473 | printf(" --allnoconfig New config where all options are answered with no\n"); | ||
474 | printf(" --allyesconfig New config where all options are answered with yes\n"); | ||
475 | printf(" --allmodconfig New config where all options are answered with mod\n"); | ||
476 | printf(" --alldefconfig New config with all symbols set to default\n"); | ||
477 | printf(" --randconfig New config with random answer to all options\n"); | ||
478 | } | ||
479 | |||
459 | int main(int ac, char **av) | 480 | int main(int ac, char **av) |
460 | { | 481 | { |
482 | const char *progname = av[0]; | ||
461 | int opt; | 483 | int opt; |
462 | const char *name; | 484 | const char *name, *defconfig_file = NULL /* gcc uninit */; |
463 | struct stat tmpstat; | 485 | struct stat tmpstat; |
464 | 486 | ||
465 | setlocale(LC_ALL, ""); | 487 | setlocale(LC_ALL, ""); |
@@ -491,14 +513,24 @@ int main(int ac, char **av) | |||
491 | srand(seed); | 513 | srand(seed); |
492 | break; | 514 | break; |
493 | } | 515 | } |
516 | case oldaskconfig: | ||
517 | case oldconfig: | ||
518 | case allnoconfig: | ||
519 | case allyesconfig: | ||
520 | case allmodconfig: | ||
521 | case alldefconfig: | ||
522 | case listnewconfig: | ||
523 | case oldnoconfig: | ||
524 | break; | ||
494 | case '?': | 525 | case '?': |
495 | fprintf(stderr, _("See README for usage info\n")); | 526 | conf_usage(progname); |
496 | exit(1); | 527 | exit(1); |
497 | break; | 528 | break; |
498 | } | 529 | } |
499 | } | 530 | } |
500 | if (ac == optind) { | 531 | if (ac == optind) { |
501 | printf(_("%s: Kconfig file missing\n"), av[0]); | 532 | printf(_("%s: Kconfig file missing\n"), av[0]); |
533 | conf_usage(progname); | ||
502 | exit(1); | 534 | exit(1); |
503 | } | 535 | } |
504 | name = av[optind]; | 536 | name = av[optind]; |
@@ -641,13 +673,11 @@ int main(int ac, char **av) | |||
641 | } | 673 | } |
642 | return 0; | 674 | return 0; |
643 | } | 675 | } |
676 | |||
644 | /* | 677 | /* |
645 | * Helper function to facilitate fgets() by Jean Sacren. | 678 | * Helper function to facilitate fgets() by Jean Sacren. |
646 | */ | 679 | */ |
647 | void xfgets(str, size, in) | 680 | void xfgets(char *str, int size, FILE *in) |
648 | char *str; | ||
649 | int size; | ||
650 | FILE *in; | ||
651 | { | 681 | { |
652 | if (fgets(str, size, in) == NULL) | 682 | if (fgets(str, size, in) == NULL) |
653 | fprintf(stderr, "\nError in reading or end of file.\n"); | 683 | fprintf(stderr, "\nError in reading or end of file.\n"); |
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index 2bafd9a7c8d..59b667cae5f 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -7,13 +7,13 @@ | |||
7 | #include <ctype.h> | 7 | #include <ctype.h> |
8 | #include <errno.h> | 8 | #include <errno.h> |
9 | #include <fcntl.h> | 9 | #include <fcntl.h> |
10 | #include <stdarg.h> | ||
10 | #include <stdio.h> | 11 | #include <stdio.h> |
11 | #include <stdlib.h> | 12 | #include <stdlib.h> |
12 | #include <string.h> | 13 | #include <string.h> |
13 | #include <time.h> | 14 | #include <time.h> |
14 | #include <unistd.h> | 15 | #include <unistd.h> |
15 | 16 | ||
16 | #define LKC_DIRECT_LINK | ||
17 | #include "lkc.h" | 17 | #include "lkc.h" |
18 | 18 | ||
19 | static void conf_warning(const char *fmt, ...) | 19 | static void conf_warning(const char *fmt, ...) |
@@ -128,6 +128,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
128 | sym->flags |= def_flags; | 128 | sym->flags |= def_flags; |
129 | break; | 129 | break; |
130 | } | 130 | } |
131 | /* fall through */ | ||
131 | case S_BOOLEAN: | 132 | case S_BOOLEAN: |
132 | if (p[0] == 'y') { | 133 | if (p[0] == 'y') { |
133 | sym->def[def].tri = yes; | 134 | sym->def[def].tri = yes; |
@@ -140,7 +141,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
140 | break; | 141 | break; |
141 | } | 142 | } |
142 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); | 143 | conf_warning("symbol value '%s' invalid for %s", p, sym->name); |
143 | break; | 144 | return 1; |
144 | case S_OTHER: | 145 | case S_OTHER: |
145 | if (*p != '"') { | 146 | if (*p != '"') { |
146 | for (p2 = p; *p2 && !isspace(*p2); p2++) | 147 | for (p2 = p; *p2 && !isspace(*p2); p2++) |
@@ -148,6 +149,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
148 | sym->type = S_STRING; | 149 | sym->type = S_STRING; |
149 | goto done; | 150 | goto done; |
150 | } | 151 | } |
152 | /* fall through */ | ||
151 | case S_STRING: | 153 | case S_STRING: |
152 | if (*p++ != '"') | 154 | if (*p++ != '"') |
153 | break; | 155 | break; |
@@ -162,6 +164,7 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) | |||
162 | conf_warning("invalid string found"); | 164 | conf_warning("invalid string found"); |
163 | return 1; | 165 | return 1; |
164 | } | 166 | } |
167 | /* fall through */ | ||
165 | case S_INT: | 168 | case S_INT: |
166 | case S_HEX: | 169 | case S_HEX: |
167 | done: | 170 | done: |
@@ -237,6 +240,7 @@ load: | |||
237 | case S_STRING: | 240 | case S_STRING: |
238 | if (sym->def[def].val) | 241 | if (sym->def[def].val) |
239 | free(sym->def[def].val); | 242 | free(sym->def[def].val); |
243 | /* fall through */ | ||
240 | default: | 244 | default: |
241 | sym->def[def].val = NULL; | 245 | sym->def[def].val = NULL; |
242 | sym->def[def].tri = no; | 246 | sym->def[def].tri = no; |
@@ -363,6 +367,7 @@ int conf_read(const char *name) | |||
363 | break; | 367 | break; |
364 | if (!sym_is_choice(sym)) | 368 | if (!sym_is_choice(sym)) |
365 | goto sym_ok; | 369 | goto sym_ok; |
370 | /* fall through */ | ||
366 | default: | 371 | default: |
367 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) | 372 | if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) |
368 | goto sym_ok; | 373 | goto sym_ok; |
@@ -417,64 +422,202 @@ int conf_read(const char *name) | |||
417 | return 0; | 422 | return 0; |
418 | } | 423 | } |
419 | 424 | ||
420 | /* Write a S_STRING */ | 425 | /* |
421 | static void conf_write_string(bool headerfile, const char *name, | 426 | * Kconfig configuration printer |
422 | const char *str, FILE *out) | 427 | * |
428 | * This printer is used when generating the resulting configuration after | ||
429 | * kconfig invocation and `defconfig' files. Unset symbol might be omitted by | ||
430 | * passing a non-NULL argument to the printer. | ||
431 | * | ||
432 | */ | ||
433 | static void | ||
434 | kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
423 | { | 435 | { |
424 | int l; | 436 | |
425 | if (headerfile) | 437 | switch (sym->type) { |
426 | fprintf(out, "#define %s%s \"", CONFIG_, name); | 438 | case S_BOOLEAN: |
427 | else | 439 | case S_TRISTATE: |
428 | fprintf(out, "%s%s=\"", CONFIG_, name); | 440 | if (*value == 'n') { |
429 | 441 | bool skip_unset = (arg != NULL); | |
430 | while (1) { | 442 | |
431 | l = strcspn(str, "\"\\"); | 443 | if (!skip_unset) |
444 | fprintf(fp, "# %s%s is not set\n", | ||
445 | CONFIG_, sym->name); | ||
446 | return; | ||
447 | } | ||
448 | break; | ||
449 | default: | ||
450 | break; | ||
451 | } | ||
452 | |||
453 | fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value); | ||
454 | } | ||
455 | |||
456 | static void | ||
457 | kconfig_print_comment(FILE *fp, const char *value, void *arg) | ||
458 | { | ||
459 | const char *p = value; | ||
460 | size_t l; | ||
461 | |||
462 | for (;;) { | ||
463 | l = strcspn(p, "\n"); | ||
464 | fprintf(fp, "#"); | ||
432 | if (l) { | 465 | if (l) { |
433 | xfwrite(str, l, 1, out); | 466 | fprintf(fp, " "); |
434 | str += l; | 467 | fwrite(p, l, 1, fp); |
468 | p += l; | ||
435 | } | 469 | } |
436 | if (!*str) | 470 | fprintf(fp, "\n"); |
471 | if (*p++ == '\0') | ||
437 | break; | 472 | break; |
438 | fprintf(out, "\\%c", *str++); | ||
439 | } | 473 | } |
440 | fputs("\"\n", out); | ||
441 | } | 474 | } |
442 | 475 | ||
443 | static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no) | 476 | static struct conf_printer kconfig_printer_cb = |
477 | { | ||
478 | .print_symbol = kconfig_print_symbol, | ||
479 | .print_comment = kconfig_print_comment, | ||
480 | }; | ||
481 | |||
482 | /* | ||
483 | * Header printer | ||
484 | * | ||
485 | * This printer is used when generating the `include/generated/autoconf.h' file. | ||
486 | */ | ||
487 | static void | ||
488 | header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
444 | { | 489 | { |
445 | const char *str; | ||
446 | 490 | ||
447 | switch (sym->type) { | 491 | switch (sym->type) { |
448 | case S_BOOLEAN: | 492 | case S_BOOLEAN: |
449 | case S_TRISTATE: | 493 | case S_TRISTATE: { |
450 | switch (sym_get_tristate_value(sym)) { | 494 | const char *suffix = ""; |
451 | case no: | 495 | |
452 | if (write_no) | 496 | switch (*value) { |
453 | fprintf(out, "# %s%s is not set\n", | 497 | case 'n': |
454 | CONFIG_, sym->name); | ||
455 | break; | ||
456 | case mod: | ||
457 | fprintf(out, "%s%s=m\n", CONFIG_, sym->name); | ||
458 | break; | ||
459 | case yes: | ||
460 | fprintf(out, "%s%s=y\n", CONFIG_, sym->name); | ||
461 | break; | 498 | break; |
499 | case 'm': | ||
500 | suffix = "_MODULE"; | ||
501 | /* fall through */ | ||
502 | default: | ||
503 | fprintf(fp, "#define %s%s%s 1\n", | ||
504 | CONFIG_, sym->name, suffix); | ||
462 | } | 505 | } |
506 | /* | ||
507 | * Generate the __enabled_CONFIG_* and | ||
508 | * __enabled_CONFIG_*_MODULE macros for use by the | ||
509 | * IS_{ENABLED,BUILTIN,MODULE} macros. The _MODULE variant is | ||
510 | * generated even for booleans so that the IS_ENABLED() macro | ||
511 | * works. | ||
512 | */ | ||
513 | fprintf(fp, "#define __enabled_" CONFIG_ "%s %d\n", | ||
514 | sym->name, (*value == 'y')); | ||
515 | fprintf(fp, "#define __enabled_" CONFIG_ "%s_MODULE %d\n", | ||
516 | sym->name, (*value == 'm')); | ||
463 | break; | 517 | break; |
464 | case S_STRING: | 518 | } |
465 | conf_write_string(false, sym->name, sym_get_string_value(sym), out); | 519 | case S_HEX: { |
520 | const char *prefix = ""; | ||
521 | |||
522 | if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X')) | ||
523 | prefix = "0x"; | ||
524 | fprintf(fp, "#define %s%s %s%s\n", | ||
525 | CONFIG_, sym->name, prefix, value); | ||
466 | break; | 526 | break; |
467 | case S_HEX: | 527 | } |
528 | case S_STRING: | ||
468 | case S_INT: | 529 | case S_INT: |
469 | str = sym_get_string_value(sym); | 530 | fprintf(fp, "#define %s%s %s\n", |
470 | fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str); | 531 | CONFIG_, sym->name, value); |
532 | break; | ||
533 | default: | ||
471 | break; | 534 | break; |
535 | } | ||
536 | |||
537 | } | ||
538 | |||
539 | static void | ||
540 | header_print_comment(FILE *fp, const char *value, void *arg) | ||
541 | { | ||
542 | const char *p = value; | ||
543 | size_t l; | ||
544 | |||
545 | fprintf(fp, "/*\n"); | ||
546 | for (;;) { | ||
547 | l = strcspn(p, "\n"); | ||
548 | fprintf(fp, " *"); | ||
549 | if (l) { | ||
550 | fprintf(fp, " "); | ||
551 | fwrite(p, l, 1, fp); | ||
552 | p += l; | ||
553 | } | ||
554 | fprintf(fp, "\n"); | ||
555 | if (*p++ == '\0') | ||
556 | break; | ||
557 | } | ||
558 | fprintf(fp, " */\n"); | ||
559 | } | ||
560 | |||
561 | static struct conf_printer header_printer_cb = | ||
562 | { | ||
563 | .print_symbol = header_print_symbol, | ||
564 | .print_comment = header_print_comment, | ||
565 | }; | ||
566 | |||
567 | /* | ||
568 | * Tristate printer | ||
569 | * | ||
570 | * This printer is used when generating the `include/config/tristate.conf' file. | ||
571 | */ | ||
572 | static void | ||
573 | tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) | ||
574 | { | ||
575 | |||
576 | if (sym->type == S_TRISTATE && *value != 'n') | ||
577 | fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value)); | ||
578 | } | ||
579 | |||
580 | static struct conf_printer tristate_printer_cb = | ||
581 | { | ||
582 | .print_symbol = tristate_print_symbol, | ||
583 | .print_comment = kconfig_print_comment, | ||
584 | }; | ||
585 | |||
586 | static void conf_write_symbol(FILE *fp, struct symbol *sym, | ||
587 | struct conf_printer *printer, void *printer_arg) | ||
588 | { | ||
589 | const char *str; | ||
590 | |||
591 | switch (sym->type) { | ||
472 | case S_OTHER: | 592 | case S_OTHER: |
473 | case S_UNKNOWN: | 593 | case S_UNKNOWN: |
474 | break; | 594 | break; |
595 | case S_STRING: | ||
596 | str = sym_get_string_value(sym); | ||
597 | str = sym_escape_string_value(str); | ||
598 | printer->print_symbol(fp, sym, str, printer_arg); | ||
599 | free((void *)str); | ||
600 | break; | ||
601 | default: | ||
602 | str = sym_get_string_value(sym); | ||
603 | printer->print_symbol(fp, sym, str, printer_arg); | ||
475 | } | 604 | } |
476 | } | 605 | } |
477 | 606 | ||
607 | static void | ||
608 | conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg) | ||
609 | { | ||
610 | char buf[256]; | ||
611 | |||
612 | snprintf(buf, sizeof(buf), | ||
613 | "\n" | ||
614 | "Automatically generated file; DO NOT EDIT.\n" | ||
615 | "%s\n", | ||
616 | rootmenu.prompt->text); | ||
617 | |||
618 | printer->print_comment(fp, buf, printer_arg); | ||
619 | } | ||
620 | |||
478 | /* | 621 | /* |
479 | * Write out a minimal config. | 622 | * Write out a minimal config. |
480 | * All values that has default values are skipped as this is redundant. | 623 | * All values that has default values are skipped as this is redundant. |
@@ -531,7 +674,7 @@ int conf_write_defconfig(const char *filename) | |||
531 | goto next_menu; | 674 | goto next_menu; |
532 | } | 675 | } |
533 | } | 676 | } |
534 | conf_write_symbol(sym, out, true); | 677 | conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); |
535 | } | 678 | } |
536 | next_menu: | 679 | next_menu: |
537 | if (menu->list != NULL) { | 680 | if (menu->list != NULL) { |
@@ -596,11 +739,7 @@ int conf_write(const char *name) | |||
596 | if (!out) | 739 | if (!out) |
597 | return 1; | 740 | return 1; |
598 | 741 | ||
599 | fprintf(out, _("#\n" | 742 | conf_write_heading(out, &kconfig_printer_cb, NULL); |
600 | "# Automatically generated make config: don't edit\n" | ||
601 | "# %s\n" | ||
602 | "#\n"), | ||
603 | rootmenu.prompt->text); | ||
604 | 743 | ||
605 | if (!conf_get_changed()) | 744 | if (!conf_get_changed()) |
606 | sym_clear_all_valid(); | 745 | sym_clear_all_valid(); |
@@ -621,8 +760,8 @@ int conf_write(const char *name) | |||
621 | if (!(sym->flags & SYMBOL_WRITE)) | 760 | if (!(sym->flags & SYMBOL_WRITE)) |
622 | goto next; | 761 | goto next; |
623 | sym->flags &= ~SYMBOL_WRITE; | 762 | sym->flags &= ~SYMBOL_WRITE; |
624 | /* Write config symbol to file */ | 763 | |
625 | conf_write_symbol(sym, out, true); | 764 | conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); |
626 | } | 765 | } |
627 | 766 | ||
628 | next: | 767 | next: |
@@ -771,7 +910,6 @@ out: | |||
771 | int conf_write_autoconf(void) | 910 | int conf_write_autoconf(void) |
772 | { | 911 | { |
773 | struct symbol *sym; | 912 | struct symbol *sym; |
774 | const char *str; | ||
775 | const char *name; | 913 | const char *name; |
776 | FILE *out, *tristate, *out_h; | 914 | FILE *out, *tristate, *out_h; |
777 | int i; | 915 | int i; |
@@ -800,68 +938,23 @@ int conf_write_autoconf(void) | |||
800 | return 1; | 938 | return 1; |
801 | } | 939 | } |
802 | 940 | ||
803 | fprintf(out, "#\n" | 941 | conf_write_heading(out, &kconfig_printer_cb, NULL); |
804 | "# Automatically generated make config: don't edit\n" | 942 | |
805 | "# %s\n" | 943 | conf_write_heading(tristate, &tristate_printer_cb, NULL); |
806 | "#\n", | 944 | |
807 | rootmenu.prompt->text); | 945 | conf_write_heading(out_h, &header_printer_cb, NULL); |
808 | fprintf(tristate, "#\n" | ||
809 | "# Automatically generated - do not edit\n" | ||
810 | "\n"); | ||
811 | fprintf(out_h, "/*\n" | ||
812 | " * Automatically generated C config: don't edit\n" | ||
813 | " * %s\n" | ||
814 | " */\n", | ||
815 | rootmenu.prompt->text); | ||
816 | 946 | ||
817 | for_all_symbols(i, sym) { | 947 | for_all_symbols(i, sym) { |
818 | sym_calc_value(sym); | 948 | sym_calc_value(sym); |
819 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) | 949 | if (!(sym->flags & SYMBOL_WRITE) || !sym->name) |
820 | continue; | 950 | continue; |
821 | 951 | ||
822 | /* write symbol to config file */ | 952 | /* write symbol to auto.conf, tristate and header files */ |
823 | conf_write_symbol(sym, out, false); | 953 | conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); |
824 | 954 | ||
825 | /* update autoconf and tristate files */ | 955 | conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); |
826 | switch (sym->type) { | 956 | |
827 | case S_BOOLEAN: | 957 | conf_write_symbol(out_h, sym, &header_printer_cb, NULL); |
828 | case S_TRISTATE: | ||
829 | switch (sym_get_tristate_value(sym)) { | ||
830 | case no: | ||
831 | break; | ||
832 | case mod: | ||
833 | fprintf(tristate, "%s%s=M\n", | ||
834 | CONFIG_, sym->name); | ||
835 | fprintf(out_h, "#define %s%s_MODULE 1\n", | ||
836 | CONFIG_, sym->name); | ||
837 | break; | ||
838 | case yes: | ||
839 | if (sym->type == S_TRISTATE) | ||
840 | fprintf(tristate,"%s%s=Y\n", | ||
841 | CONFIG_, sym->name); | ||
842 | fprintf(out_h, "#define %s%s 1\n", | ||
843 | CONFIG_, sym->name); | ||
844 | break; | ||
845 | } | ||
846 | break; | ||
847 | case S_STRING: | ||
848 | conf_write_string(true, sym->name, sym_get_string_value(sym), out_h); | ||
849 | break; | ||
850 | case S_HEX: | ||
851 | str = sym_get_string_value(sym); | ||
852 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | ||
853 | fprintf(out_h, "#define %s%s 0x%s\n", | ||
854 | CONFIG_, sym->name, str); | ||
855 | break; | ||
856 | } | ||
857 | case S_INT: | ||
858 | str = sym_get_string_value(sym); | ||
859 | fprintf(out_h, "#define %s%s %s\n", | ||
860 | CONFIG_, sym->name, str); | ||
861 | break; | ||
862 | default: | ||
863 | break; | ||
864 | } | ||
865 | } | 958 | } |
866 | fclose(out); | 959 | fclose(out); |
867 | fclose(tristate); | 960 | fclose(tristate); |
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c index 001003452f6..290ce41f8ba 100644 --- a/scripts/kconfig/expr.c +++ b/scripts/kconfig/expr.c | |||
@@ -7,15 +7,13 @@ | |||
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
10 | #define LKC_DIRECT_LINK | ||
11 | #include "lkc.h" | 10 | #include "lkc.h" |
12 | 11 | ||
13 | #define DEBUG_EXPR 0 | 12 | #define DEBUG_EXPR 0 |
14 | 13 | ||
15 | struct expr *expr_alloc_symbol(struct symbol *sym) | 14 | struct expr *expr_alloc_symbol(struct symbol *sym) |
16 | { | 15 | { |
17 | struct expr *e = malloc(sizeof(*e)); | 16 | struct expr *e = calloc(1, sizeof(*e)); |
18 | memset(e, 0, sizeof(*e)); | ||
19 | e->type = E_SYMBOL; | 17 | e->type = E_SYMBOL; |
20 | e->left.sym = sym; | 18 | e->left.sym = sym; |
21 | return e; | 19 | return e; |
@@ -23,8 +21,7 @@ struct expr *expr_alloc_symbol(struct symbol *sym) | |||
23 | 21 | ||
24 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | 22 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) |
25 | { | 23 | { |
26 | struct expr *e = malloc(sizeof(*e)); | 24 | struct expr *e = calloc(1, sizeof(*e)); |
27 | memset(e, 0, sizeof(*e)); | ||
28 | e->type = type; | 25 | e->type = type; |
29 | e->left.expr = ce; | 26 | e->left.expr = ce; |
30 | return e; | 27 | return e; |
@@ -32,8 +29,7 @@ struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | |||
32 | 29 | ||
33 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) | 30 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) |
34 | { | 31 | { |
35 | struct expr *e = malloc(sizeof(*e)); | 32 | struct expr *e = calloc(1, sizeof(*e)); |
36 | memset(e, 0, sizeof(*e)); | ||
37 | e->type = type; | 33 | e->type = type; |
38 | e->left.expr = e1; | 34 | e->left.expr = e1; |
39 | e->right.expr = e2; | 35 | e->right.expr = e2; |
@@ -42,8 +38,7 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e | |||
42 | 38 | ||
43 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) | 39 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) |
44 | { | 40 | { |
45 | struct expr *e = malloc(sizeof(*e)); | 41 | struct expr *e = calloc(1, sizeof(*e)); |
46 | memset(e, 0, sizeof(*e)); | ||
47 | e->type = type; | 42 | e->type = type; |
48 | e->left.sym = s1; | 43 | e->left.sym = s1; |
49 | e->right.sym = s2; | 44 | e->right.sym = s2; |
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 16bfae2d321..80fce57080c 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -172,8 +172,6 @@ struct menu { | |||
172 | #define MENU_CHANGED 0x0001 | 172 | #define MENU_CHANGED 0x0001 |
173 | #define MENU_ROOT 0x0002 | 173 | #define MENU_ROOT 0x0002 |
174 | 174 | ||
175 | #ifndef SWIG | ||
176 | |||
177 | extern struct file *file_list; | 175 | extern struct file *file_list; |
178 | extern struct file *current_file; | 176 | extern struct file *current_file; |
179 | struct file *lookup_file(const char *name); | 177 | struct file *lookup_file(const char *name); |
@@ -218,7 +216,6 @@ static inline int expr_is_no(struct expr *e) | |||
218 | { | 216 | { |
219 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); | 217 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); |
220 | } | 218 | } |
221 | #endif | ||
222 | 219 | ||
223 | #ifdef __cplusplus | 220 | #ifdef __cplusplus |
224 | } | 221 | } |
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c index a11d5f7b9ee..9f4438027df 100644 --- a/scripts/kconfig/gconf.c +++ b/scripts/kconfig/gconf.c | |||
@@ -285,8 +285,6 @@ void init_left_tree(void) | |||
285 | static void renderer_edited(GtkCellRendererText * cell, | 285 | static void renderer_edited(GtkCellRendererText * cell, |
286 | const gchar * path_string, | 286 | const gchar * path_string, |
287 | const gchar * new_text, gpointer user_data); | 287 | const gchar * new_text, gpointer user_data); |
288 | static void renderer_toggled(GtkCellRendererToggle * cellrenderertoggle, | ||
289 | gchar * arg1, gpointer user_data); | ||
290 | 288 | ||
291 | void init_right_tree(void) | 289 | void init_right_tree(void) |
292 | { | 290 | { |
@@ -320,8 +318,6 @@ void init_right_tree(void) | |||
320 | "inconsistent", COL_BTNINC, | 318 | "inconsistent", COL_BTNINC, |
321 | "visible", COL_BTNVIS, | 319 | "visible", COL_BTNVIS, |
322 | "radio", COL_BTNRAD, NULL); | 320 | "radio", COL_BTNRAD, NULL); |
323 | /*g_signal_connect(G_OBJECT(renderer), "toggled", | ||
324 | G_CALLBACK(renderer_toggled), NULL); */ | ||
325 | renderer = gtk_cell_renderer_text_new(); | 321 | renderer = gtk_cell_renderer_text_new(); |
326 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | 322 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), |
327 | renderer, FALSE); | 323 | renderer, FALSE); |
@@ -888,35 +884,6 @@ static void toggle_sym_value(struct menu *menu) | |||
888 | display_tree_part(); //fixme: keep exp/coll | 884 | display_tree_part(); //fixme: keep exp/coll |
889 | } | 885 | } |
890 | 886 | ||
891 | static void renderer_toggled(GtkCellRendererToggle * cell, | ||
892 | gchar * path_string, gpointer user_data) | ||
893 | { | ||
894 | GtkTreePath *path, *sel_path = NULL; | ||
895 | GtkTreeIter iter, sel_iter; | ||
896 | GtkTreeSelection *sel; | ||
897 | struct menu *menu; | ||
898 | |||
899 | path = gtk_tree_path_new_from_string(path_string); | ||
900 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | ||
901 | return; | ||
902 | |||
903 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree2_w)); | ||
904 | if (gtk_tree_selection_get_selected(sel, NULL, &sel_iter)) | ||
905 | sel_path = gtk_tree_model_get_path(model2, &sel_iter); | ||
906 | if (!sel_path) | ||
907 | goto out1; | ||
908 | if (gtk_tree_path_compare(path, sel_path)) | ||
909 | goto out2; | ||
910 | |||
911 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
912 | toggle_sym_value(menu); | ||
913 | |||
914 | out2: | ||
915 | gtk_tree_path_free(sel_path); | ||
916 | out1: | ||
917 | gtk_tree_path_free(path); | ||
918 | } | ||
919 | |||
920 | static gint column2index(GtkTreeViewColumn * column) | 887 | static gint column2index(GtkTreeViewColumn * column) |
921 | { | 888 | { |
922 | gint i; | 889 | gint i; |
@@ -1172,6 +1139,7 @@ static gchar **fill_row(struct menu *menu) | |||
1172 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); | 1139 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); |
1173 | if (sym_is_choice(sym)) | 1140 | if (sym_is_choice(sym)) |
1174 | break; | 1141 | break; |
1142 | /* fall through */ | ||
1175 | case S_TRISTATE: | 1143 | case S_TRISTATE: |
1176 | val = sym_get_tristate_value(sym); | 1144 | val = sym_get_tristate_value(sym); |
1177 | switch (val) { | 1145 | switch (val) { |
@@ -1506,10 +1474,6 @@ int main(int ac, char *av[]) | |||
1506 | char *env; | 1474 | char *env; |
1507 | gchar *glade_file; | 1475 | gchar *glade_file; |
1508 | 1476 | ||
1509 | #ifndef LKC_DIRECT_LINK | ||
1510 | kconfig_load(); | ||
1511 | #endif | ||
1512 | |||
1513 | bindtextdomain(PACKAGE, LOCALEDIR); | 1477 | bindtextdomain(PACKAGE, LOCALEDIR); |
1514 | bind_textdomain_codeset(PACKAGE, "UTF-8"); | 1478 | bind_textdomain_codeset(PACKAGE, "UTF-8"); |
1515 | textdomain(PACKAGE); | 1479 | textdomain(PACKAGE); |
diff --git a/scripts/kconfig/kconfig_load.c b/scripts/kconfig/kconfig_load.c deleted file mode 100644 index dbdcaad8232..00000000000 --- a/scripts/kconfig/kconfig_load.c +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | #include <dlfcn.h> | ||
2 | #include <stdio.h> | ||
3 | #include <stdlib.h> | ||
4 | |||
5 | #include "lkc.h" | ||
6 | |||
7 | #define P(name,type,arg) type (*name ## _p) arg | ||
8 | #include "lkc_proto.h" | ||
9 | #undef P | ||
10 | |||
11 | void kconfig_load(void) | ||
12 | { | ||
13 | void *handle; | ||
14 | char *error; | ||
15 | |||
16 | handle = dlopen("./libkconfig.so", RTLD_LAZY); | ||
17 | if (!handle) { | ||
18 | handle = dlopen("./scripts/kconfig/libkconfig.so", RTLD_LAZY); | ||
19 | if (!handle) { | ||
20 | fprintf(stderr, "%s\n", dlerror()); | ||
21 | exit(1); | ||
22 | } | ||
23 | } | ||
24 | |||
25 | #define P(name,type,arg) \ | ||
26 | { \ | ||
27 | name ## _p = dlsym(handle, #name); \ | ||
28 | if ((error = dlerror())) { \ | ||
29 | fprintf(stderr, "%s\n", error); \ | ||
30 | exit(1); \ | ||
31 | } \ | ||
32 | } | ||
33 | #include "lkc_proto.h" | ||
34 | #undef P | ||
35 | } | ||
diff --git a/scripts/kconfig/kxgettext.c b/scripts/kconfig/kxgettext.c index e9d8e791bf0..2858738b22d 100644 --- a/scripts/kconfig/kxgettext.c +++ b/scripts/kconfig/kxgettext.c | |||
@@ -7,7 +7,6 @@ | |||
7 | #include <stdlib.h> | 7 | #include <stdlib.h> |
8 | #include <string.h> | 8 | #include <string.h> |
9 | 9 | ||
10 | #define LKC_DIRECT_LINK | ||
11 | #include "lkc.h" | 10 | #include "lkc.h" |
12 | 11 | ||
13 | static char *escape(const char* text, char *bf, int len) | 12 | static char *escape(const char* text, char *bf, int len) |
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index febf0c94d55..b633bdb9f3d 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h | |||
@@ -21,12 +21,7 @@ static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; | |||
21 | extern "C" { | 21 | extern "C" { |
22 | #endif | 22 | #endif |
23 | 23 | ||
24 | #ifdef LKC_DIRECT_LINK | ||
25 | #define P(name,type,arg) extern type name arg | 24 | #define P(name,type,arg) extern type name arg |
26 | #else | ||
27 | #include "lkc_defs.h" | ||
28 | #define P(name,type,arg) extern type (*name ## _p) arg | ||
29 | #endif | ||
30 | #include "lkc_proto.h" | 25 | #include "lkc_proto.h" |
31 | #undef P | 26 | #undef P |
32 | 27 | ||
@@ -68,9 +63,7 @@ struct kconf_id { | |||
68 | enum symbol_type stype; | 63 | enum symbol_type stype; |
69 | }; | 64 | }; |
70 | 65 | ||
71 | #ifdef YYDEBUG | ||
72 | extern int zconfdebug; | 66 | extern int zconfdebug; |
73 | #endif | ||
74 | 67 | ||
75 | int zconfparse(void); | 68 | int zconfparse(void); |
76 | void zconfdump(FILE *out); | 69 | void zconfdump(FILE *out); |
@@ -81,9 +74,6 @@ void zconf_nextfile(const char *name); | |||
81 | int zconf_lineno(void); | 74 | int zconf_lineno(void); |
82 | const char *zconf_curname(void); | 75 | const char *zconf_curname(void); |
83 | 76 | ||
84 | /* conf.c */ | ||
85 | void xfgets(char *str, int size, FILE *in); | ||
86 | |||
87 | /* confdata.c */ | 77 | /* confdata.c */ |
88 | const char *conf_get_configname(void); | 78 | const char *conf_get_configname(void); |
89 | const char *conf_get_autoconfig_name(void); | 79 | const char *conf_get_autoconfig_name(void); |
@@ -92,6 +82,11 @@ void sym_set_change_count(int count); | |||
92 | void sym_add_change_count(int count); | 82 | void sym_add_change_count(int count); |
93 | void conf_set_all_new_symbols(enum conf_def_mode mode); | 83 | void conf_set_all_new_symbols(enum conf_def_mode mode); |
94 | 84 | ||
85 | struct conf_printer { | ||
86 | void (*print_symbol)(FILE *, struct symbol *, const char *, void *); | ||
87 | void (*print_comment)(FILE *, const char *, void *); | ||
88 | }; | ||
89 | |||
95 | /* confdata.c and expr.c */ | 90 | /* confdata.c and expr.c */ |
96 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) | 91 | static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) |
97 | { | 92 | { |
@@ -99,9 +94,6 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) | |||
99 | fprintf(stderr, "\nError in writing or end of file.\n"); | 94 | fprintf(stderr, "\nError in writing or end of file.\n"); |
100 | } | 95 | } |
101 | 96 | ||
102 | /* kconfig_load.c */ | ||
103 | void kconfig_load(void); | ||
104 | |||
105 | /* menu.c */ | 97 | /* menu.c */ |
106 | void _menu_init(void); | 98 | void _menu_init(void); |
107 | void menu_warn(struct menu *menu, const char *fmt, ...); | 99 | void menu_warn(struct menu *menu, const char *fmt, ...); |
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h index 17342fef38b..47fe9c340f9 100644 --- a/scripts/kconfig/lkc_proto.h +++ b/scripts/kconfig/lkc_proto.h | |||
@@ -31,6 +31,7 @@ P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | |||
31 | P(sym_lookup,struct symbol *,(const char *name, int flags)); | 31 | P(sym_lookup,struct symbol *,(const char *name, int flags)); |
32 | P(sym_find,struct symbol *,(const char *name)); | 32 | P(sym_find,struct symbol *,(const char *name)); |
33 | P(sym_expand_string_value,const char *,(const char *in)); | 33 | P(sym_expand_string_value,const char *,(const char *in)); |
34 | P(sym_escape_string_value, const char *,(const char *in)); | ||
34 | P(sym_re_search,struct symbol **,(const char *pattern)); | 35 | P(sym_re_search,struct symbol **,(const char *pattern)); |
35 | P(sym_type_name,const char *,(enum symbol_type type)); | 36 | P(sym_type_name,const char *,(enum symbol_type type)); |
36 | P(sym_calc_value,void,(struct symbol *sym)); | 37 | P(sym_calc_value,void,(struct symbol *sym)); |
diff --git a/scripts/kconfig/lxdialog/check-lxdialog.sh b/scripts/kconfig/lxdialog/check-lxdialog.sh index 82cc3a85e7f..c8e8a715475 100644 --- a/scripts/kconfig/lxdialog/check-lxdialog.sh +++ b/scripts/kconfig/lxdialog/check-lxdialog.sh | |||
@@ -4,7 +4,7 @@ | |||
4 | # What library to link | 4 | # What library to link |
5 | ldflags() | 5 | ldflags() |
6 | { | 6 | { |
7 | for ext in so a dylib ; do | 7 | for ext in so a dll.a dylib ; do |
8 | for lib in ncursesw ncurses curses ; do | 8 | for lib in ncursesw ncurses curses ; do |
9 | $cc -print-file-name=lib${lib}.${ext} | grep -q / | 9 | $cc -print-file-name=lib${lib}.${ext} | grep -q / |
10 | if [ $? -eq 0 ]; then | 10 | if [ $? -eq 0 ]; then |
@@ -19,12 +19,12 @@ ldflags() | |||
19 | # Where is ncurses.h? | 19 | # Where is ncurses.h? |
20 | ccflags() | 20 | ccflags() |
21 | { | 21 | { |
22 | if [ -f /usr/include/ncurses/ncurses.h ]; then | 22 | if [ -f /usr/include/ncursesw/curses.h ]; then |
23 | echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' | ||
24 | elif [ -f /usr/include/ncurses/ncurses.h ]; then | ||
23 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' | 25 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"' |
24 | elif [ -f /usr/include/ncurses/curses.h ]; then | 26 | elif [ -f /usr/include/ncurses/curses.h ]; then |
25 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' | 27 | echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"' |
26 | elif [ -f /usr/include/ncursesw/curses.h ]; then | ||
27 | echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"' | ||
28 | elif [ -f /usr/include/ncurses.h ]; then | 28 | elif [ -f /usr/include/ncurses.h ]; then |
29 | echo '-DCURSES_LOC="<ncurses.h>"' | 29 | echo '-DCURSES_LOC="<ncurses.h>"' |
30 | else | 30 | else |
@@ -38,7 +38,7 @@ trap "rm -f $tmp" 0 1 2 3 15 | |||
38 | 38 | ||
39 | # Check if we can link to ncurses | 39 | # Check if we can link to ncurses |
40 | check() { | 40 | check() { |
41 | $cc -xc - -o $tmp 2>/dev/null <<'EOF' | 41 | $cc -x c - -o $tmp 2>/dev/null <<'EOF' |
42 | #include CURSES_LOC | 42 | #include CURSES_LOC |
43 | main() {} | 43 | main() {} |
44 | EOF | 44 | EOF |
diff --git a/scripts/kconfig/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index b5211fce0d9..ee17a5264d5 100644 --- a/scripts/kconfig/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h | |||
@@ -144,6 +144,7 @@ struct dialog_info { | |||
144 | */ | 144 | */ |
145 | extern struct dialog_info dlg; | 145 | extern struct dialog_info dlg; |
146 | extern char dialog_input_result[]; | 146 | extern char dialog_input_result[]; |
147 | extern int saved_x, saved_y; /* Needed in signal handler in mconf.c */ | ||
147 | 148 | ||
148 | /* | 149 | /* |
149 | * Function prototypes | 150 | * Function prototypes |
@@ -209,7 +210,13 @@ int first_alpha(const char *string, const char *exempt); | |||
209 | int dialog_yesno(const char *title, const char *prompt, int height, int width); | 210 | int dialog_yesno(const char *title, const char *prompt, int height, int width); |
210 | int dialog_msgbox(const char *title, const char *prompt, int height, | 211 | int dialog_msgbox(const char *title, const char *prompt, int height, |
211 | int width, int pause); | 212 | int width, int pause); |
212 | int dialog_textbox(const char *title, const char *file, int height, int width); | 213 | |
214 | |||
215 | typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void | ||
216 | *_data); | ||
217 | int dialog_textbox(const char *title, char *tbuf, int initial_height, | ||
218 | int initial_width, int *keys, int *_vscroll, int *_hscroll, | ||
219 | update_text_fn update_text, void *data); | ||
213 | int dialog_menu(const char *title, const char *prompt, | 220 | int dialog_menu(const char *title, const char *prompt, |
214 | const void *selected, int *s_scroll); | 221 | const void *selected, int *s_scroll); |
215 | int dialog_checklist(const char *title, const char *prompt, int height, | 222 | int dialog_checklist(const char *title, const char *prompt, int height, |
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c index c704712d022..a48bb93e090 100644 --- a/scripts/kconfig/lxdialog/textbox.c +++ b/scripts/kconfig/lxdialog/textbox.c | |||
@@ -22,23 +22,25 @@ | |||
22 | #include "dialog.h" | 22 | #include "dialog.h" |
23 | 23 | ||
24 | static void back_lines(int n); | 24 | static void back_lines(int n); |
25 | static void print_page(WINDOW * win, int height, int width); | 25 | static void print_page(WINDOW *win, int height, int width, update_text_fn |
26 | static void print_line(WINDOW * win, int row, int width); | 26 | update_text, void *data); |
27 | static void print_line(WINDOW *win, int row, int width); | ||
27 | static char *get_line(void); | 28 | static char *get_line(void); |
28 | static void print_position(WINDOW * win); | 29 | static void print_position(WINDOW * win); |
29 | 30 | ||
30 | static int hscroll; | 31 | static int hscroll; |
31 | static int begin_reached, end_reached, page_length; | 32 | static int begin_reached, end_reached, page_length; |
32 | static const char *buf; | 33 | static char *buf; |
33 | static const char *page; | 34 | static char *page; |
34 | 35 | ||
35 | /* | 36 | /* |
36 | * refresh window content | 37 | * refresh window content |
37 | */ | 38 | */ |
38 | static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, | 39 | static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, |
39 | int cur_y, int cur_x) | 40 | int cur_y, int cur_x, update_text_fn update_text, |
41 | void *data) | ||
40 | { | 42 | { |
41 | print_page(box, boxh, boxw); | 43 | print_page(box, boxh, boxw, update_text, data); |
42 | print_position(dialog); | 44 | print_position(dialog); |
43 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | 45 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ |
44 | wrefresh(dialog); | 46 | wrefresh(dialog); |
@@ -47,14 +49,18 @@ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, | |||
47 | 49 | ||
48 | /* | 50 | /* |
49 | * Display text from a file in a dialog box. | 51 | * Display text from a file in a dialog box. |
52 | * | ||
53 | * keys is a null-terminated array | ||
54 | * update_text() may not add or remove any '\n' or '\0' in tbuf | ||
50 | */ | 55 | */ |
51 | int dialog_textbox(const char *title, const char *tbuf, | 56 | int dialog_textbox(const char *title, char *tbuf, int initial_height, |
52 | int initial_height, int initial_width) | 57 | int initial_width, int *keys, int *_vscroll, int *_hscroll, |
58 | update_text_fn update_text, void *data) | ||
53 | { | 59 | { |
54 | int i, x, y, cur_x, cur_y, key = 0; | 60 | int i, x, y, cur_x, cur_y, key = 0; |
55 | int height, width, boxh, boxw; | 61 | int height, width, boxh, boxw; |
56 | int passed_end; | ||
57 | WINDOW *dialog, *box; | 62 | WINDOW *dialog, *box; |
63 | bool done = false; | ||
58 | 64 | ||
59 | begin_reached = 1; | 65 | begin_reached = 1; |
60 | end_reached = 0; | 66 | end_reached = 0; |
@@ -63,6 +69,15 @@ int dialog_textbox(const char *title, const char *tbuf, | |||
63 | buf = tbuf; | 69 | buf = tbuf; |
64 | page = buf; /* page is pointer to start of page to be displayed */ | 70 | page = buf; /* page is pointer to start of page to be displayed */ |
65 | 71 | ||
72 | if (_vscroll && *_vscroll) { | ||
73 | begin_reached = 0; | ||
74 | |||
75 | for (i = 0; i < *_vscroll; i++) | ||
76 | get_line(); | ||
77 | } | ||
78 | if (_hscroll) | ||
79 | hscroll = *_hscroll; | ||
80 | |||
66 | do_resize: | 81 | do_resize: |
67 | getmaxyx(stdscr, height, width); | 82 | getmaxyx(stdscr, height, width); |
68 | if (height < 8 || width < 8) | 83 | if (height < 8 || width < 8) |
@@ -120,25 +135,28 @@ do_resize: | |||
120 | 135 | ||
121 | /* Print first page of text */ | 136 | /* Print first page of text */ |
122 | attr_clear(box, boxh, boxw, dlg.dialog.atr); | 137 | attr_clear(box, boxh, boxw, dlg.dialog.atr); |
123 | refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); | 138 | refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text, |
139 | data); | ||
124 | 140 | ||
125 | while ((key != KEY_ESC) && (key != '\n')) { | 141 | while (!done) { |
126 | key = wgetch(dialog); | 142 | key = wgetch(dialog); |
127 | switch (key) { | 143 | switch (key) { |
128 | case 'E': /* Exit */ | 144 | case 'E': /* Exit */ |
129 | case 'e': | 145 | case 'e': |
130 | case 'X': | 146 | case 'X': |
131 | case 'x': | 147 | case 'x': |
132 | delwin(box); | 148 | case 'q': |
133 | delwin(dialog); | 149 | case '\n': |
134 | return 0; | 150 | done = true; |
151 | break; | ||
135 | case 'g': /* First page */ | 152 | case 'g': /* First page */ |
136 | case KEY_HOME: | 153 | case KEY_HOME: |
137 | if (!begin_reached) { | 154 | if (!begin_reached) { |
138 | begin_reached = 1; | 155 | begin_reached = 1; |
139 | page = buf; | 156 | page = buf; |
140 | refresh_text_box(dialog, box, boxh, boxw, | 157 | refresh_text_box(dialog, box, boxh, boxw, |
141 | cur_y, cur_x); | 158 | cur_y, cur_x, update_text, |
159 | data); | ||
142 | } | 160 | } |
143 | break; | 161 | break; |
144 | case 'G': /* Last page */ | 162 | case 'G': /* Last page */ |
@@ -148,78 +166,48 @@ do_resize: | |||
148 | /* point to last char in buf */ | 166 | /* point to last char in buf */ |
149 | page = buf + strlen(buf); | 167 | page = buf + strlen(buf); |
150 | back_lines(boxh); | 168 | back_lines(boxh); |
151 | refresh_text_box(dialog, box, boxh, boxw, | 169 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
152 | cur_y, cur_x); | 170 | cur_x, update_text, data); |
153 | break; | 171 | break; |
154 | case 'K': /* Previous line */ | 172 | case 'K': /* Previous line */ |
155 | case 'k': | 173 | case 'k': |
156 | case KEY_UP: | 174 | case KEY_UP: |
157 | if (!begin_reached) { | 175 | if (begin_reached) |
158 | back_lines(page_length + 1); | 176 | break; |
159 | |||
160 | /* We don't call print_page() here but use | ||
161 | * scrolling to ensure faster screen update. | ||
162 | * However, 'end_reached' and 'page_length' | ||
163 | * should still be updated, and 'page' should | ||
164 | * point to start of next page. This is done | ||
165 | * by calling get_line() in the following | ||
166 | * 'for' loop. */ | ||
167 | scrollok(box, TRUE); | ||
168 | wscrl(box, -1); /* Scroll box region down one line */ | ||
169 | scrollok(box, FALSE); | ||
170 | page_length = 0; | ||
171 | passed_end = 0; | ||
172 | for (i = 0; i < boxh; i++) { | ||
173 | if (!i) { | ||
174 | /* print first line of page */ | ||
175 | print_line(box, 0, boxw); | ||
176 | wnoutrefresh(box); | ||
177 | } else | ||
178 | /* Called to update 'end_reached' and 'page' */ | ||
179 | get_line(); | ||
180 | if (!passed_end) | ||
181 | page_length++; | ||
182 | if (end_reached && !passed_end) | ||
183 | passed_end = 1; | ||
184 | } | ||
185 | 177 | ||
186 | print_position(dialog); | 178 | back_lines(page_length + 1); |
187 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | 179 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
188 | wrefresh(dialog); | 180 | cur_x, update_text, data); |
189 | } | ||
190 | break; | 181 | break; |
191 | case 'B': /* Previous page */ | 182 | case 'B': /* Previous page */ |
192 | case 'b': | 183 | case 'b': |
184 | case 'u': | ||
193 | case KEY_PPAGE: | 185 | case KEY_PPAGE: |
194 | if (begin_reached) | 186 | if (begin_reached) |
195 | break; | 187 | break; |
196 | back_lines(page_length + boxh); | 188 | back_lines(page_length + boxh); |
197 | refresh_text_box(dialog, box, boxh, boxw, | 189 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
198 | cur_y, cur_x); | 190 | cur_x, update_text, data); |
199 | break; | 191 | break; |
200 | case 'J': /* Next line */ | 192 | case 'J': /* Next line */ |
201 | case 'j': | 193 | case 'j': |
202 | case KEY_DOWN: | 194 | case KEY_DOWN: |
203 | if (!end_reached) { | 195 | if (end_reached) |
204 | begin_reached = 0; | 196 | break; |
205 | scrollok(box, TRUE); | 197 | |
206 | scroll(box); /* Scroll box region up one line */ | 198 | back_lines(page_length - 1); |
207 | scrollok(box, FALSE); | 199 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
208 | print_line(box, boxh - 1, boxw); | 200 | cur_x, update_text, data); |
209 | wnoutrefresh(box); | ||
210 | print_position(dialog); | ||
211 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
212 | wrefresh(dialog); | ||
213 | } | ||
214 | break; | 201 | break; |
215 | case KEY_NPAGE: /* Next page */ | 202 | case KEY_NPAGE: /* Next page */ |
216 | case ' ': | 203 | case ' ': |
204 | case 'd': | ||
217 | if (end_reached) | 205 | if (end_reached) |
218 | break; | 206 | break; |
219 | 207 | ||
220 | begin_reached = 0; | 208 | begin_reached = 0; |
221 | refresh_text_box(dialog, box, boxh, boxw, | 209 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
222 | cur_y, cur_x); | 210 | cur_x, update_text, data); |
223 | break; | 211 | break; |
224 | case '0': /* Beginning of line */ | 212 | case '0': /* Beginning of line */ |
225 | case 'H': /* Scroll left */ | 213 | case 'H': /* Scroll left */ |
@@ -234,8 +222,8 @@ do_resize: | |||
234 | hscroll--; | 222 | hscroll--; |
235 | /* Reprint current page to scroll horizontally */ | 223 | /* Reprint current page to scroll horizontally */ |
236 | back_lines(page_length); | 224 | back_lines(page_length); |
237 | refresh_text_box(dialog, box, boxh, boxw, | 225 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
238 | cur_y, cur_x); | 226 | cur_x, update_text, data); |
239 | break; | 227 | break; |
240 | case 'L': /* Scroll right */ | 228 | case 'L': /* Scroll right */ |
241 | case 'l': | 229 | case 'l': |
@@ -245,11 +233,12 @@ do_resize: | |||
245 | hscroll++; | 233 | hscroll++; |
246 | /* Reprint current page to scroll horizontally */ | 234 | /* Reprint current page to scroll horizontally */ |
247 | back_lines(page_length); | 235 | back_lines(page_length); |
248 | refresh_text_box(dialog, box, boxh, boxw, | 236 | refresh_text_box(dialog, box, boxh, boxw, cur_y, |
249 | cur_y, cur_x); | 237 | cur_x, update_text, data); |
250 | break; | 238 | break; |
251 | case KEY_ESC: | 239 | case KEY_ESC: |
252 | key = on_key_esc(dialog); | 240 | if (on_key_esc(dialog) == KEY_ESC) |
241 | done = true; | ||
253 | break; | 242 | break; |
254 | case KEY_RESIZE: | 243 | case KEY_RESIZE: |
255 | back_lines(height); | 244 | back_lines(height); |
@@ -257,11 +246,31 @@ do_resize: | |||
257 | delwin(dialog); | 246 | delwin(dialog); |
258 | on_key_resize(); | 247 | on_key_resize(); |
259 | goto do_resize; | 248 | goto do_resize; |
249 | default: | ||
250 | for (i = 0; keys[i]; i++) { | ||
251 | if (key == keys[i]) { | ||
252 | done = true; | ||
253 | break; | ||
254 | } | ||
255 | } | ||
260 | } | 256 | } |
261 | } | 257 | } |
262 | delwin(box); | 258 | delwin(box); |
263 | delwin(dialog); | 259 | delwin(dialog); |
264 | return key; /* ESC pressed */ | 260 | if (_vscroll) { |
261 | const char *s; | ||
262 | |||
263 | s = buf; | ||
264 | *_vscroll = 0; | ||
265 | back_lines(page_length); | ||
266 | while (s < page && (s = strchr(s, '\n'))) { | ||
267 | (*_vscroll)++; | ||
268 | s++; | ||
269 | } | ||
270 | } | ||
271 | if (_hscroll) | ||
272 | *_hscroll = hscroll; | ||
273 | return key; | ||
265 | } | 274 | } |
266 | 275 | ||
267 | /* | 276 | /* |
@@ -298,12 +307,23 @@ static void back_lines(int n) | |||
298 | } | 307 | } |
299 | 308 | ||
300 | /* | 309 | /* |
301 | * Print a new page of text. Called by dialog_textbox(). | 310 | * Print a new page of text. |
302 | */ | 311 | */ |
303 | static void print_page(WINDOW * win, int height, int width) | 312 | static void print_page(WINDOW *win, int height, int width, update_text_fn |
313 | update_text, void *data) | ||
304 | { | 314 | { |
305 | int i, passed_end = 0; | 315 | int i, passed_end = 0; |
306 | 316 | ||
317 | if (update_text) { | ||
318 | char *end; | ||
319 | |||
320 | for (i = 0; i < height; i++) | ||
321 | get_line(); | ||
322 | end = page; | ||
323 | back_lines(height); | ||
324 | update_text(buf, page - buf, end - buf, data); | ||
325 | } | ||
326 | |||
307 | page_length = 0; | 327 | page_length = 0; |
308 | for (i = 0; i < height; i++) { | 328 | for (i = 0; i < height; i++) { |
309 | print_line(win, i, width); | 329 | print_line(win, i, width); |
@@ -316,11 +336,10 @@ static void print_page(WINDOW * win, int height, int width) | |||
316 | } | 336 | } |
317 | 337 | ||
318 | /* | 338 | /* |
319 | * Print a new line of text. Called by dialog_textbox() and print_page(). | 339 | * Print a new line of text. |
320 | */ | 340 | */ |
321 | static void print_line(WINDOW * win, int row, int width) | 341 | static void print_line(WINDOW * win, int row, int width) |
322 | { | 342 | { |
323 | int y, x; | ||
324 | char *line; | 343 | char *line; |
325 | 344 | ||
326 | line = get_line(); | 345 | line = get_line(); |
@@ -329,10 +348,10 @@ static void print_line(WINDOW * win, int row, int width) | |||
329 | waddch(win, ' '); | 348 | waddch(win, ' '); |
330 | waddnstr(win, line, MIN(strlen(line), width - 2)); | 349 | waddnstr(win, line, MIN(strlen(line), width - 2)); |
331 | 350 | ||
332 | getyx(win, y, x); | ||
333 | /* Clear 'residue' of previous line */ | 351 | /* Clear 'residue' of previous line */ |
334 | #if OLD_NCURSES | 352 | #if OLD_NCURSES |
335 | { | 353 | { |
354 | int x = getcurx(win); | ||
336 | int i; | 355 | int i; |
337 | for (i = 0; i < width - x; i++) | 356 | for (i = 0; i < width - x; i++) |
338 | waddch(win, ' '); | 357 | waddch(win, ' '); |
@@ -355,10 +374,8 @@ static char *get_line(void) | |||
355 | end_reached = 0; | 374 | end_reached = 0; |
356 | while (*page != '\n') { | 375 | while (*page != '\n') { |
357 | if (*page == '\0') { | 376 | if (*page == '\0') { |
358 | if (!end_reached) { | 377 | end_reached = 1; |
359 | end_reached = 1; | 378 | break; |
360 | break; | ||
361 | } | ||
362 | } else if (i < MAX_LEN) | 379 | } else if (i < MAX_LEN) |
363 | line[i++] = *(page++); | 380 | line[i++] = *(page++); |
364 | else { | 381 | else { |
@@ -371,7 +388,7 @@ static char *get_line(void) | |||
371 | if (i <= MAX_LEN) | 388 | if (i <= MAX_LEN) |
372 | line[i] = '\0'; | 389 | line[i] = '\0'; |
373 | if (!end_reached) | 390 | if (!end_reached) |
374 | page++; /* move pass '\n' */ | 391 | page++; /* move past '\n' */ |
375 | 392 | ||
376 | return line; | 393 | return line; |
377 | } | 394 | } |
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c index f2375ad7ebc..109d53117d2 100644 --- a/scripts/kconfig/lxdialog/util.c +++ b/scripts/kconfig/lxdialog/util.c | |||
@@ -23,6 +23,9 @@ | |||
23 | 23 | ||
24 | #include "dialog.h" | 24 | #include "dialog.h" |
25 | 25 | ||
26 | /* Needed in signal handler in mconf.c */ | ||
27 | int saved_x, saved_y; | ||
28 | |||
26 | struct dialog_info dlg; | 29 | struct dialog_info dlg; |
27 | 30 | ||
28 | static void set_mono_theme(void) | 31 | static void set_mono_theme(void) |
@@ -273,6 +276,10 @@ int init_dialog(const char *backtitle) | |||
273 | int height, width; | 276 | int height, width; |
274 | 277 | ||
275 | initscr(); /* Init curses */ | 278 | initscr(); /* Init curses */ |
279 | |||
280 | /* Get current cursor position for signal handler in mconf.c */ | ||
281 | getyx(stdscr, saved_y, saved_x); | ||
282 | |||
276 | getmaxyx(stdscr, height, width); | 283 | getmaxyx(stdscr, height, width); |
277 | if (height < 19 || width < 80) { | 284 | if (height < 19 || width < 80) { |
278 | endwin(); | 285 | endwin(); |
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index d433c7a2474..820d2b6800f 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <unistd.h> | 18 | #include <unistd.h> |
19 | #include <locale.h> | 19 | #include <locale.h> |
20 | 20 | ||
21 | #define LKC_DIRECT_LINK | ||
22 | #include "lkc.h" | 21 | #include "lkc.h" |
23 | #include "lxdialog/dialog.h" | 22 | #include "lxdialog/dialog.h" |
24 | 23 | ||
@@ -845,6 +844,7 @@ int main(int ac, char **av) | |||
845 | "\n\n")); | 844 | "\n\n")); |
846 | return 1; | 845 | return 1; |
847 | } | 846 | } |
847 | /* fall through */ | ||
848 | case -1: | 848 | case -1: |
849 | printf(_("\n\n" | 849 | printf(_("\n\n" |
850 | "*** End of the configuration.\n" | 850 | "*** End of the configuration.\n" |
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 5fdf10dc1d8..beeb92e75f8 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -3,10 +3,11 @@ | |||
3 | * Released under the terms of the GNU GPL v2.0. | 3 | * Released under the terms of the GNU GPL v2.0. |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #include <ctype.h> | ||
7 | #include <stdarg.h> | ||
6 | #include <stdlib.h> | 8 | #include <stdlib.h> |
7 | #include <string.h> | 9 | #include <string.h> |
8 | 10 | ||
9 | #define LKC_DIRECT_LINK | ||
10 | #include "lkc.h" | 11 | #include "lkc.h" |
11 | 12 | ||
12 | static const char nohelp_text[] = N_( | 13 | static const char nohelp_text[] = N_( |
@@ -350,7 +351,7 @@ void menu_finalize(struct menu *parent) | |||
350 | last_menu->next = NULL; | 351 | last_menu->next = NULL; |
351 | } | 352 | } |
352 | 353 | ||
353 | sym->dir_dep.expr = parent->dep; | 354 | sym->dir_dep.expr = expr_alloc_or(sym->dir_dep.expr, parent->dep); |
354 | } | 355 | } |
355 | for (menu = parent->list; menu; menu = menu->next) { | 356 | for (menu = parent->list; menu; menu = menu->next) { |
356 | if (sym && sym_is_choice(sym) && | 357 | if (sym && sym_is_choice(sym) && |
@@ -596,11 +597,10 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) | |||
596 | struct symbol *sym = menu->sym; | 597 | struct symbol *sym = menu->sym; |
597 | 598 | ||
598 | if (menu_has_help(menu)) { | 599 | if (menu_has_help(menu)) { |
599 | if (sym->name) { | 600 | if (sym->name) |
600 | str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); | 601 | str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); |
601 | str_append(help, _(menu_get_help(menu))); | 602 | str_append(help, _(menu_get_help(menu))); |
602 | str_append(help, "\n"); | 603 | str_append(help, "\n"); |
603 | } | ||
604 | } else { | 604 | } else { |
605 | str_append(help, nohelp_text); | 605 | str_append(help, nohelp_text); |
606 | } | 606 | } |
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c index 488dd741078..39ca1f1640e 100644 --- a/scripts/kconfig/nconf.c +++ b/scripts/kconfig/nconf.c | |||
@@ -7,7 +7,7 @@ | |||
7 | */ | 7 | */ |
8 | #define _GNU_SOURCE | 8 | #define _GNU_SOURCE |
9 | #include <string.h> | 9 | #include <string.h> |
10 | #define LKC_DIRECT_LINK | 10 | |
11 | #include "lkc.h" | 11 | #include "lkc.h" |
12 | #include "nconf.h" | 12 | #include "nconf.h" |
13 | #include <ctype.h> | 13 | #include <ctype.h> |
@@ -1067,7 +1067,6 @@ static void conf(struct menu *menu) | |||
1067 | struct menu *submenu = 0; | 1067 | struct menu *submenu = 0; |
1068 | const char *prompt = menu_get_prompt(menu); | 1068 | const char *prompt = menu_get_prompt(menu); |
1069 | struct symbol *sym; | 1069 | struct symbol *sym; |
1070 | struct menu *active_menu = NULL; | ||
1071 | int res; | 1070 | int res; |
1072 | int current_index = 0; | 1071 | int current_index = 0; |
1073 | int last_top_row = 0; | 1072 | int last_top_row = 0; |
@@ -1152,13 +1151,9 @@ static void conf(struct menu *menu) | |||
1152 | continue; | 1151 | continue; |
1153 | 1152 | ||
1154 | submenu = (struct menu *) item_data(); | 1153 | submenu = (struct menu *) item_data(); |
1155 | active_menu = (struct menu *)item_data(); | ||
1156 | if (!submenu || !menu_is_visible(submenu)) | 1154 | if (!submenu || !menu_is_visible(submenu)) |
1157 | continue; | 1155 | continue; |
1158 | if (submenu) | 1156 | sym = submenu->sym; |
1159 | sym = submenu->sym; | ||
1160 | else | ||
1161 | sym = NULL; | ||
1162 | 1157 | ||
1163 | switch (res) { | 1158 | switch (res) { |
1164 | case ' ': | 1159 | case ' ': |
@@ -1222,20 +1217,13 @@ static void conf_message_callback(const char *fmt, va_list ap) | |||
1222 | 1217 | ||
1223 | static void show_help(struct menu *menu) | 1218 | static void show_help(struct menu *menu) |
1224 | { | 1219 | { |
1225 | struct gstr help = str_new(); | 1220 | struct gstr help; |
1226 | 1221 | ||
1227 | if (menu && menu->sym && menu_has_help(menu)) { | 1222 | if (!menu) |
1228 | if (menu->sym->name) { | 1223 | return; |
1229 | str_printf(&help, "%s%s:\n\n", CONFIG_, menu->sym->name); | 1224 | |
1230 | str_append(&help, _(menu_get_help(menu))); | 1225 | help = str_new(); |
1231 | str_append(&help, "\n"); | 1226 | menu_get_ext_help(menu, &help); |
1232 | get_symbol_str(&help, menu->sym); | ||
1233 | } else { | ||
1234 | str_append(&help, _(menu_get_help(menu))); | ||
1235 | } | ||
1236 | } else { | ||
1237 | str_append(&help, nohelp_text); | ||
1238 | } | ||
1239 | show_scroll_win(main_window, _(menu_get_prompt(menu)), str_get(&help)); | 1227 | show_scroll_win(main_window, _(menu_get_prompt(menu)), str_get(&help)); |
1240 | str_free(&help); | 1228 | str_free(&help); |
1241 | } | 1229 | } |
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc index c2796b866f8..df274febb3e 100644 --- a/scripts/kconfig/qconf.cc +++ b/scripts/kconfig/qconf.cc | |||
@@ -1478,10 +1478,13 @@ void ConfigMainWindow::loadConfig(void) | |||
1478 | ConfigView::updateListAll(); | 1478 | ConfigView::updateListAll(); |
1479 | } | 1479 | } |
1480 | 1480 | ||
1481 | void ConfigMainWindow::saveConfig(void) | 1481 | bool ConfigMainWindow::saveConfig(void) |
1482 | { | 1482 | { |
1483 | if (conf_write(NULL)) | 1483 | if (conf_write(NULL)) { |
1484 | QMessageBox::information(this, "qconf", _("Unable to save configuration!")); | 1484 | QMessageBox::information(this, "qconf", _("Unable to save configuration!")); |
1485 | return false; | ||
1486 | } | ||
1487 | return true; | ||
1485 | } | 1488 | } |
1486 | 1489 | ||
1487 | void ConfigMainWindow::saveConfigAs(void) | 1490 | void ConfigMainWindow::saveConfigAs(void) |
@@ -1642,7 +1645,11 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) | |||
1642 | mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); | 1645 | mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); |
1643 | switch (mb.exec()) { | 1646 | switch (mb.exec()) { |
1644 | case QMessageBox::Yes: | 1647 | case QMessageBox::Yes: |
1645 | saveConfig(); | 1648 | if (saveConfig()) |
1649 | e->accept(); | ||
1650 | else | ||
1651 | e->ignore(); | ||
1652 | break; | ||
1646 | case QMessageBox::No: | 1653 | case QMessageBox::No: |
1647 | e->accept(); | 1654 | e->accept(); |
1648 | break; | 1655 | break; |
@@ -1745,10 +1752,6 @@ int main(int ac, char** av) | |||
1745 | bindtextdomain(PACKAGE, LOCALEDIR); | 1752 | bindtextdomain(PACKAGE, LOCALEDIR); |
1746 | textdomain(PACKAGE); | 1753 | textdomain(PACKAGE); |
1747 | 1754 | ||
1748 | #ifndef LKC_DIRECT_LINK | ||
1749 | kconfig_load(); | ||
1750 | #endif | ||
1751 | |||
1752 | progname = av[0]; | 1755 | progname = av[0]; |
1753 | configApp = new QApplication(ac, av); | 1756 | configApp = new QApplication(ac, av); |
1754 | if (ac > 1 && av[1][0] == '-') { | 1757 | if (ac > 1 && av[1][0] == '-') { |
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h index 91677d900db..3715b3e7212 100644 --- a/scripts/kconfig/qconf.h +++ b/scripts/kconfig/qconf.h | |||
@@ -311,7 +311,7 @@ public slots: | |||
311 | void listFocusChanged(void); | 311 | void listFocusChanged(void); |
312 | void goBack(void); | 312 | void goBack(void); |
313 | void loadConfig(void); | 313 | void loadConfig(void); |
314 | void saveConfig(void); | 314 | bool saveConfig(void); |
315 | void saveConfigAs(void); | 315 | void saveConfigAs(void); |
316 | void searchConfig(void); | 316 | void searchConfig(void); |
317 | void showSingleView(void); | 317 | void showSingleView(void); |
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index a796c95fe8a..071f00c3046 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <regex.h> | 9 | #include <regex.h> |
10 | #include <sys/utsname.h> | 10 | #include <sys/utsname.h> |
11 | 11 | ||
12 | #define LKC_DIRECT_LINK | ||
13 | #include "lkc.h" | 12 | #include "lkc.h" |
14 | 13 | ||
15 | struct symbol symbol_yes = { | 14 | struct symbol symbol_yes = { |
@@ -751,7 +750,8 @@ const char *sym_get_string_value(struct symbol *sym) | |||
751 | case no: | 750 | case no: |
752 | return "n"; | 751 | return "n"; |
753 | case mod: | 752 | case mod: |
754 | return "m"; | 753 | sym_calc_value(modules_sym); |
754 | return (modules_sym->curr.tri == no) ? "n" : "m"; | ||
755 | case yes: | 755 | case yes: |
756 | return "y"; | 756 | return "y"; |
757 | } | 757 | } |
@@ -893,6 +893,49 @@ const char *sym_expand_string_value(const char *in) | |||
893 | return res; | 893 | return res; |
894 | } | 894 | } |
895 | 895 | ||
896 | const char *sym_escape_string_value(const char *in) | ||
897 | { | ||
898 | const char *p; | ||
899 | size_t reslen; | ||
900 | char *res; | ||
901 | size_t l; | ||
902 | |||
903 | reslen = strlen(in) + strlen("\"\"") + 1; | ||
904 | |||
905 | p = in; | ||
906 | for (;;) { | ||
907 | l = strcspn(p, "\"\\"); | ||
908 | p += l; | ||
909 | |||
910 | if (p[0] == '\0') | ||
911 | break; | ||
912 | |||
913 | reslen++; | ||
914 | p++; | ||
915 | } | ||
916 | |||
917 | res = malloc(reslen); | ||
918 | res[0] = '\0'; | ||
919 | |||
920 | strcat(res, "\""); | ||
921 | |||
922 | p = in; | ||
923 | for (;;) { | ||
924 | l = strcspn(p, "\"\\"); | ||
925 | strncat(res, p, l); | ||
926 | p += l; | ||
927 | |||
928 | if (p[0] == '\0') | ||
929 | break; | ||
930 | |||
931 | strcat(res, "\\"); | ||
932 | strncat(res, p++, 1); | ||
933 | } | ||
934 | |||
935 | strcat(res, "\""); | ||
936 | return res; | ||
937 | } | ||
938 | |||
896 | struct symbol **sym_re_search(const char *pattern) | 939 | struct symbol **sym_re_search(const char *pattern) |
897 | { | 940 | { |
898 | struct symbol *sym, **sym_arr = NULL; | 941 | struct symbol *sym, **sym_arr = NULL; |
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 6330cc871a4..d0b8b2318e4 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
@@ -5,6 +5,8 @@ | |||
5 | * Released under the terms of the GNU GPL v2.0. | 5 | * Released under the terms of the GNU GPL v2.0. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include <stdarg.h> | ||
9 | #include <stdlib.h> | ||
8 | #include <string.h> | 10 | #include <string.h> |
9 | #include "lkc.h" | 11 | #include "lkc.h" |
10 | 12 | ||
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf index c9e690eb754..f14ab41154b 100644 --- a/scripts/kconfig/zconf.gperf +++ b/scripts/kconfig/zconf.gperf | |||
@@ -9,7 +9,7 @@ | |||
9 | 9 | ||
10 | struct kconf_id; | 10 | struct kconf_id; |
11 | 11 | ||
12 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | 12 | static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); |
13 | 13 | ||
14 | %% | 14 | %% |
15 | mainmenu, T_MAINMENU, TF_COMMAND | 15 | mainmenu, T_MAINMENU, TF_COMMAND |
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index 4055d5de175..40df0005daa 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped | |||
@@ -1,6 +1,5 @@ | |||
1 | /* ANSI-C code produced by gperf version 3.0.3 */ | 1 | /* ANSI-C code produced by gperf version 3.0.4 */ |
2 | /* Command-line: gperf */ | 2 | /* Command-line: gperf -t --output-file scripts/kconfig/zconf.hash.c_shipped -a -C -E -g -k '1,3,$' -p -t scripts/kconfig/zconf.gperf */ |
3 | /* Computed positions: -k'1,3' */ | ||
4 | 3 | ||
5 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
6 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | 5 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ |
@@ -29,10 +28,11 @@ | |||
29 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." | 28 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." |
30 | #endif | 29 | #endif |
31 | 30 | ||
31 | #line 10 "scripts/kconfig/zconf.gperf" | ||
32 | struct kconf_id; | 32 | struct kconf_id; |
33 | 33 | ||
34 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | 34 | static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); |
35 | /* maximum key range = 50, duplicates = 0 */ | 35 | /* maximum key range = 71, duplicates = 0 */ |
36 | 36 | ||
37 | #ifdef __GNUC__ | 37 | #ifdef __GNUC__ |
38 | __inline | 38 | __inline |
@@ -44,34 +44,34 @@ inline | |||
44 | static unsigned int | 44 | static unsigned int |
45 | kconf_id_hash (register const char *str, register unsigned int len) | 45 | kconf_id_hash (register const char *str, register unsigned int len) |
46 | { | 46 | { |
47 | static unsigned char asso_values[] = | 47 | static const unsigned char asso_values[] = |
48 | { | 48 | { |
49 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 49 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
50 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 50 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
51 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 51 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
52 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 52 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
53 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 53 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
54 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 54 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
55 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 55 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
56 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 56 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
57 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 57 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
58 | 52, 52, 52, 52, 52, 52, 52, 52, 40, 5, | 58 | 73, 73, 73, 73, 73, 73, 73, 73, 25, 25, |
59 | 0, 0, 5, 52, 0, 20, 52, 52, 10, 20, | 59 | 0, 0, 0, 5, 0, 0, 73, 73, 5, 0, |
60 | 5, 0, 35, 52, 0, 30, 0, 15, 0, 52, | 60 | 10, 5, 45, 73, 20, 20, 0, 15, 15, 73, |
61 | 15, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 61 | 20, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
62 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 62 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
63 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 63 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
64 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 64 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
65 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 65 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
66 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 66 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
67 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 67 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
68 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 68 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
69 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 69 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
70 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 70 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
71 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 71 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
72 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 72 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
73 | 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, | 73 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
74 | 52, 52, 52, 52, 52, 52 | 74 | 73, 73, 73, 73, 73, 73 |
75 | }; | 75 | }; |
76 | register int hval = len; | 76 | register int hval = len; |
77 | 77 | ||
@@ -85,87 +85,87 @@ kconf_id_hash (register const char *str, register unsigned int len) | |||
85 | hval += asso_values[(unsigned char)str[0]]; | 85 | hval += asso_values[(unsigned char)str[0]]; |
86 | break; | 86 | break; |
87 | } | 87 | } |
88 | return hval; | 88 | return hval + asso_values[(unsigned char)str[len - 1]]; |
89 | } | 89 | } |
90 | 90 | ||
91 | struct kconf_id_strings_t | 91 | struct kconf_id_strings_t |
92 | { | 92 | { |
93 | char kconf_id_strings_str2[sizeof("on")]; | 93 | char kconf_id_strings_str2[sizeof("if")]; |
94 | char kconf_id_strings_str3[sizeof("env")]; | 94 | char kconf_id_strings_str3[sizeof("int")]; |
95 | char kconf_id_strings_str5[sizeof("endif")]; | 95 | char kconf_id_strings_str5[sizeof("endif")]; |
96 | char kconf_id_strings_str6[sizeof("option")]; | 96 | char kconf_id_strings_str7[sizeof("default")]; |
97 | char kconf_id_strings_str7[sizeof("endmenu")]; | 97 | char kconf_id_strings_str8[sizeof("tristate")]; |
98 | char kconf_id_strings_str8[sizeof("optional")]; | ||
99 | char kconf_id_strings_str9[sizeof("endchoice")]; | 98 | char kconf_id_strings_str9[sizeof("endchoice")]; |
100 | char kconf_id_strings_str10[sizeof("range")]; | 99 | char kconf_id_strings_str12[sizeof("def_tristate")]; |
101 | char kconf_id_strings_str11[sizeof("choice")]; | ||
102 | char kconf_id_strings_str12[sizeof("default")]; | ||
103 | char kconf_id_strings_str13[sizeof("def_bool")]; | 100 | char kconf_id_strings_str13[sizeof("def_bool")]; |
104 | char kconf_id_strings_str14[sizeof("help")]; | 101 | char kconf_id_strings_str14[sizeof("defconfig_list")]; |
105 | char kconf_id_strings_str16[sizeof("config")]; | 102 | char kconf_id_strings_str17[sizeof("on")]; |
106 | char kconf_id_strings_str17[sizeof("def_tristate")]; | 103 | char kconf_id_strings_str18[sizeof("optional")]; |
107 | char kconf_id_strings_str18[sizeof("hex")]; | 104 | char kconf_id_strings_str21[sizeof("option")]; |
108 | char kconf_id_strings_str19[sizeof("defconfig_list")]; | 105 | char kconf_id_strings_str22[sizeof("endmenu")]; |
109 | char kconf_id_strings_str22[sizeof("if")]; | 106 | char kconf_id_strings_str23[sizeof("mainmenu")]; |
110 | char kconf_id_strings_str23[sizeof("int")]; | 107 | char kconf_id_strings_str25[sizeof("menuconfig")]; |
111 | char kconf_id_strings_str27[sizeof("modules")]; | 108 | char kconf_id_strings_str27[sizeof("modules")]; |
112 | char kconf_id_strings_str28[sizeof("tristate")]; | ||
113 | char kconf_id_strings_str29[sizeof("menu")]; | 109 | char kconf_id_strings_str29[sizeof("menu")]; |
110 | char kconf_id_strings_str31[sizeof("select")]; | ||
114 | char kconf_id_strings_str32[sizeof("comment")]; | 111 | char kconf_id_strings_str32[sizeof("comment")]; |
115 | char kconf_id_strings_str35[sizeof("menuconfig")]; | 112 | char kconf_id_strings_str33[sizeof("env")]; |
116 | char kconf_id_strings_str36[sizeof("string")]; | 113 | char kconf_id_strings_str35[sizeof("range")]; |
117 | char kconf_id_strings_str37[sizeof("visible")]; | 114 | char kconf_id_strings_str36[sizeof("choice")]; |
118 | char kconf_id_strings_str41[sizeof("prompt")]; | 115 | char kconf_id_strings_str39[sizeof("bool")]; |
119 | char kconf_id_strings_str42[sizeof("depends")]; | 116 | char kconf_id_strings_str41[sizeof("source")]; |
120 | char kconf_id_strings_str44[sizeof("bool")]; | 117 | char kconf_id_strings_str42[sizeof("visible")]; |
121 | char kconf_id_strings_str46[sizeof("select")]; | 118 | char kconf_id_strings_str43[sizeof("hex")]; |
119 | char kconf_id_strings_str46[sizeof("config")]; | ||
122 | char kconf_id_strings_str47[sizeof("boolean")]; | 120 | char kconf_id_strings_str47[sizeof("boolean")]; |
123 | char kconf_id_strings_str48[sizeof("mainmenu")]; | 121 | char kconf_id_strings_str51[sizeof("string")]; |
124 | char kconf_id_strings_str51[sizeof("source")]; | 122 | char kconf_id_strings_str54[sizeof("help")]; |
123 | char kconf_id_strings_str56[sizeof("prompt")]; | ||
124 | char kconf_id_strings_str72[sizeof("depends")]; | ||
125 | }; | 125 | }; |
126 | static struct kconf_id_strings_t kconf_id_strings_contents = | 126 | static const struct kconf_id_strings_t kconf_id_strings_contents = |
127 | { | 127 | { |
128 | "on", | 128 | "if", |
129 | "env", | 129 | "int", |
130 | "endif", | 130 | "endif", |
131 | "option", | ||
132 | "endmenu", | ||
133 | "optional", | ||
134 | "endchoice", | ||
135 | "range", | ||
136 | "choice", | ||
137 | "default", | 131 | "default", |
138 | "def_bool", | 132 | "tristate", |
139 | "help", | 133 | "endchoice", |
140 | "config", | ||
141 | "def_tristate", | 134 | "def_tristate", |
142 | "hex", | 135 | "def_bool", |
143 | "defconfig_list", | 136 | "defconfig_list", |
144 | "if", | 137 | "on", |
145 | "int", | 138 | "optional", |
139 | "option", | ||
140 | "endmenu", | ||
141 | "mainmenu", | ||
142 | "menuconfig", | ||
146 | "modules", | 143 | "modules", |
147 | "tristate", | ||
148 | "menu", | 144 | "menu", |
145 | "select", | ||
149 | "comment", | 146 | "comment", |
150 | "menuconfig", | 147 | "env", |
151 | "string", | 148 | "range", |
152 | "visible", | 149 | "choice", |
153 | "prompt", | ||
154 | "depends", | ||
155 | "bool", | 150 | "bool", |
156 | "select", | 151 | "source", |
152 | "visible", | ||
153 | "hex", | ||
154 | "config", | ||
157 | "boolean", | 155 | "boolean", |
158 | "mainmenu", | 156 | "string", |
159 | "source" | 157 | "help", |
158 | "prompt", | ||
159 | "depends" | ||
160 | }; | 160 | }; |
161 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) | 161 | #define kconf_id_strings ((const char *) &kconf_id_strings_contents) |
162 | #ifdef __GNUC__ | 162 | #ifdef __GNUC__ |
163 | __inline | 163 | __inline |
164 | #ifdef __GNUC_STDC_INLINE__ | 164 | #if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__ |
165 | __attribute__ ((__gnu_inline__)) | 165 | __attribute__ ((__gnu_inline__)) |
166 | #endif | 166 | #endif |
167 | #endif | 167 | #endif |
168 | struct kconf_id * | 168 | const struct kconf_id * |
169 | kconf_id_lookup (register const char *str, register unsigned int len) | 169 | kconf_id_lookup (register const char *str, register unsigned int len) |
170 | { | 170 | { |
171 | enum | 171 | enum |
@@ -174,54 +174,94 @@ kconf_id_lookup (register const char *str, register unsigned int len) | |||
174 | MIN_WORD_LENGTH = 2, | 174 | MIN_WORD_LENGTH = 2, |
175 | MAX_WORD_LENGTH = 14, | 175 | MAX_WORD_LENGTH = 14, |
176 | MIN_HASH_VALUE = 2, | 176 | MIN_HASH_VALUE = 2, |
177 | MAX_HASH_VALUE = 51 | 177 | MAX_HASH_VALUE = 72 |
178 | }; | 178 | }; |
179 | 179 | ||
180 | static struct kconf_id wordlist[] = | 180 | static const struct kconf_id wordlist[] = |
181 | { | 181 | { |
182 | {-1}, {-1}, | 182 | {-1}, {-1}, |
183 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_ON, TF_PARAM}, | 183 | #line 25 "scripts/kconfig/zconf.gperf" |
184 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_OPT_ENV, TF_OPTION}, | 184 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str2, T_IF, TF_COMMAND|TF_PARAM}, |
185 | #line 36 "scripts/kconfig/zconf.gperf" | ||
186 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str3, T_TYPE, TF_COMMAND, S_INT}, | ||
185 | {-1}, | 187 | {-1}, |
188 | #line 26 "scripts/kconfig/zconf.gperf" | ||
186 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, | 189 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str5, T_ENDIF, TF_COMMAND}, |
187 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str6, T_OPTION, TF_COMMAND}, | 190 | {-1}, |
188 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_ENDMENU, TF_COMMAND}, | 191 | #line 29 "scripts/kconfig/zconf.gperf" |
189 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_OPTIONAL, TF_COMMAND}, | 192 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str7, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, |
193 | #line 31 "scripts/kconfig/zconf.gperf" | ||
194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str8, T_TYPE, TF_COMMAND, S_TRISTATE}, | ||
195 | #line 20 "scripts/kconfig/zconf.gperf" | ||
190 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, | 196 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str9, T_ENDCHOICE, TF_COMMAND}, |
191 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str10, T_RANGE, TF_COMMAND}, | 197 | {-1}, {-1}, |
192 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str11, T_CHOICE, TF_COMMAND}, | 198 | #line 32 "scripts/kconfig/zconf.gperf" |
193 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN}, | 199 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_TRISTATE}, |
200 | #line 35 "scripts/kconfig/zconf.gperf" | ||
194 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, | 201 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN}, |
195 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND}, | 202 | #line 45 "scripts/kconfig/zconf.gperf" |
196 | {-1}, | 203 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_OPT_DEFCONFIG_LIST,TF_OPTION}, |
197 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND}, | ||
198 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE}, | ||
199 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX}, | ||
200 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION}, | ||
201 | {-1}, {-1}, | 204 | {-1}, {-1}, |
202 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM}, | 205 | #line 43 "scripts/kconfig/zconf.gperf" |
203 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT}, | 206 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_ON, TF_PARAM}, |
204 | {-1}, {-1}, {-1}, | 207 | #line 28 "scripts/kconfig/zconf.gperf" |
208 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_OPTIONAL, TF_COMMAND}, | ||
209 | {-1}, {-1}, | ||
210 | #line 42 "scripts/kconfig/zconf.gperf" | ||
211 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_OPTION, TF_COMMAND}, | ||
212 | #line 17 "scripts/kconfig/zconf.gperf" | ||
213 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_ENDMENU, TF_COMMAND}, | ||
214 | #line 15 "scripts/kconfig/zconf.gperf" | ||
215 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_MAINMENU, TF_COMMAND}, | ||
216 | {-1}, | ||
217 | #line 23 "scripts/kconfig/zconf.gperf" | ||
218 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str25, T_MENUCONFIG, TF_COMMAND}, | ||
219 | {-1}, | ||
220 | #line 44 "scripts/kconfig/zconf.gperf" | ||
205 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, | 221 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION}, |
206 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE}, | 222 | {-1}, |
223 | #line 16 "scripts/kconfig/zconf.gperf" | ||
207 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, | 224 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND}, |
208 | {-1}, {-1}, | 225 | {-1}, |
226 | #line 39 "scripts/kconfig/zconf.gperf" | ||
227 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SELECT, TF_COMMAND}, | ||
228 | #line 21 "scripts/kconfig/zconf.gperf" | ||
209 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, | 229 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND}, |
210 | {-1}, {-1}, | 230 | #line 46 "scripts/kconfig/zconf.gperf" |
211 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND}, | 231 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_OPT_ENV, TF_OPTION}, |
212 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_TYPE, TF_COMMAND, S_STRING}, | ||
213 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND}, | ||
214 | {-1}, {-1}, {-1}, | ||
215 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_PROMPT, TF_COMMAND}, | ||
216 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_DEPENDS, TF_COMMAND}, | ||
217 | {-1}, | 232 | {-1}, |
218 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str44, T_TYPE, TF_COMMAND, S_BOOLEAN}, | 233 | #line 40 "scripts/kconfig/zconf.gperf" |
234 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_RANGE, TF_COMMAND}, | ||
235 | #line 19 "scripts/kconfig/zconf.gperf" | ||
236 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_CHOICE, TF_COMMAND}, | ||
237 | {-1}, {-1}, | ||
238 | #line 33 "scripts/kconfig/zconf.gperf" | ||
239 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str39, T_TYPE, TF_COMMAND, S_BOOLEAN}, | ||
219 | {-1}, | 240 | {-1}, |
220 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND}, | 241 | #line 18 "scripts/kconfig/zconf.gperf" |
242 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_SOURCE, TF_COMMAND}, | ||
243 | #line 41 "scripts/kconfig/zconf.gperf" | ||
244 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_VISIBLE, TF_COMMAND}, | ||
245 | #line 37 "scripts/kconfig/zconf.gperf" | ||
246 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str43, T_TYPE, TF_COMMAND, S_HEX}, | ||
247 | {-1}, {-1}, | ||
248 | #line 22 "scripts/kconfig/zconf.gperf" | ||
249 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_CONFIG, TF_COMMAND}, | ||
250 | #line 34 "scripts/kconfig/zconf.gperf" | ||
221 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN}, | 251 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN}, |
222 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}, | 252 | {-1}, {-1}, {-1}, |
253 | #line 38 "scripts/kconfig/zconf.gperf" | ||
254 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_TYPE, TF_COMMAND, S_STRING}, | ||
223 | {-1}, {-1}, | 255 | {-1}, {-1}, |
224 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_SOURCE, TF_COMMAND} | 256 | #line 24 "scripts/kconfig/zconf.gperf" |
257 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str54, T_HELP, TF_COMMAND}, | ||
258 | {-1}, | ||
259 | #line 30 "scripts/kconfig/zconf.gperf" | ||
260 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str56, T_PROMPT, TF_COMMAND}, | ||
261 | {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, | ||
262 | {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, | ||
263 | #line 27 "scripts/kconfig/zconf.gperf" | ||
264 | {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str72, T_DEPENDS, TF_COMMAND} | ||
225 | }; | 265 | }; |
226 | 266 | ||
227 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | 267 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
@@ -242,4 +282,5 @@ kconf_id_lookup (register const char *str, register unsigned int len) | |||
242 | } | 282 | } |
243 | return 0; | 283 | return 0; |
244 | } | 284 | } |
285 | #line 47 "scripts/kconfig/zconf.gperf" | ||
245 | 286 | ||
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index b22f884f902..00f9d3a9cf8 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -1,5 +1,5 @@ | |||
1 | %option backup nostdinit noyywrap never-interactive full ecs | 1 | %option nostdinit noyywrap never-interactive full ecs |
2 | %option 8bit backup nodefault perf-report perf-report | 2 | %option 8bit nodefault perf-report perf-report |
3 | %option noinput | 3 | %option noinput |
4 | %x COMMAND HELP STRING PARAM | 4 | %x COMMAND HELP STRING PARAM |
5 | %{ | 5 | %{ |
@@ -14,7 +14,6 @@ | |||
14 | #include <string.h> | 14 | #include <string.h> |
15 | #include <unistd.h> | 15 | #include <unistd.h> |
16 | 16 | ||
17 | #define LKC_DIRECT_LINK | ||
18 | #include "lkc.h" | 17 | #include "lkc.h" |
19 | 18 | ||
20 | #define START_STRSIZE 16 | 19 | #define START_STRSIZE 16 |
@@ -96,7 +95,7 @@ n [A-Za-z0-9_] | |||
96 | 95 | ||
97 | <COMMAND>{ | 96 | <COMMAND>{ |
98 | {n}+ { | 97 | {n}+ { |
99 | struct kconf_id *id = kconf_id_lookup(yytext, yyleng); | 98 | const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); |
100 | BEGIN(PARAM); | 99 | BEGIN(PARAM); |
101 | current_pos.file = current_file; | 100 | current_pos.file = current_file; |
102 | current_pos.lineno = current_file->lineno; | 101 | current_pos.lineno = current_file->lineno; |
@@ -132,7 +131,7 @@ n [A-Za-z0-9_] | |||
132 | \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; | 131 | \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; |
133 | --- /* ignore */ | 132 | --- /* ignore */ |
134 | ({n}|[-/.])+ { | 133 | ({n}|[-/.])+ { |
135 | struct kconf_id *id = kconf_id_lookup(yytext, yyleng); | 134 | const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); |
136 | if (id && id->flags & TF_PARAM) { | 135 | if (id && id->flags & TF_PARAM) { |
137 | zconflval.id = id; | 136 | zconflval.id = id; |
138 | return id->token; | 137 | return id->token; |
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/zconf.lex.c_shipped index d9182916f72..c32b1a49f5a 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/zconf.lex.c_shipped | |||
@@ -1,5 +1,5 @@ | |||
1 | 1 | ||
2 | #line 3 "scripts/kconfig/lex.zconf.c" | 2 | #line 3 "scripts/kconfig/zconf.lex.c_shipped" |
3 | 3 | ||
4 | #define YY_INT_ALIGNED short int | 4 | #define YY_INT_ALIGNED short int |
5 | 5 | ||
@@ -72,6 +72,7 @@ typedef int flex_int32_t; | |||
72 | typedef unsigned char flex_uint8_t; | 72 | typedef unsigned char flex_uint8_t; |
73 | typedef unsigned short int flex_uint16_t; | 73 | typedef unsigned short int flex_uint16_t; |
74 | typedef unsigned int flex_uint32_t; | 74 | typedef unsigned int flex_uint32_t; |
75 | #endif /* ! C99 */ | ||
75 | 76 | ||
76 | /* Limits of integral types. */ | 77 | /* Limits of integral types. */ |
77 | #ifndef INT8_MIN | 78 | #ifndef INT8_MIN |
@@ -102,8 +103,6 @@ typedef unsigned int flex_uint32_t; | |||
102 | #define UINT32_MAX (4294967295U) | 103 | #define UINT32_MAX (4294967295U) |
103 | #endif | 104 | #endif |
104 | 105 | ||
105 | #endif /* ! C99 */ | ||
106 | |||
107 | #endif /* ! FLEXINT_H */ | 106 | #endif /* ! FLEXINT_H */ |
108 | 107 | ||
109 | #ifdef __cplusplus | 108 | #ifdef __cplusplus |
@@ -160,15 +159,7 @@ typedef unsigned int flex_uint32_t; | |||
160 | 159 | ||
161 | /* Size of default input buffer. */ | 160 | /* Size of default input buffer. */ |
162 | #ifndef YY_BUF_SIZE | 161 | #ifndef YY_BUF_SIZE |
163 | #ifdef __ia64__ | ||
164 | /* On IA-64, the buffer size is 16k, not 8k. | ||
165 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | ||
166 | * Ditto for the __ia64__ case accordingly. | ||
167 | */ | ||
168 | #define YY_BUF_SIZE 32768 | ||
169 | #else | ||
170 | #define YY_BUF_SIZE 16384 | 162 | #define YY_BUF_SIZE 16384 |
171 | #endif /* __ia64__ */ | ||
172 | #endif | 163 | #endif |
173 | 164 | ||
174 | /* The state buf must be large enough to hold one state per character in the main buffer. | 165 | /* The state buf must be large enough to hold one state per character in the main buffer. |
@@ -785,7 +776,6 @@ char *zconftext; | |||
785 | #include <string.h> | 776 | #include <string.h> |
786 | #include <unistd.h> | 777 | #include <unistd.h> |
787 | 778 | ||
788 | #define LKC_DIRECT_LINK | ||
789 | #include "lkc.h" | 779 | #include "lkc.h" |
790 | 780 | ||
791 | #define START_STRSIZE 16 | 781 | #define START_STRSIZE 16 |
@@ -922,12 +912,7 @@ static int input (void ); | |||
922 | 912 | ||
923 | /* Amount of stuff to slurp up with each read. */ | 913 | /* Amount of stuff to slurp up with each read. */ |
924 | #ifndef YY_READ_BUF_SIZE | 914 | #ifndef YY_READ_BUF_SIZE |
925 | #ifdef __ia64__ | ||
926 | /* On IA-64, the buffer size is 16k, not 8k */ | ||
927 | #define YY_READ_BUF_SIZE 16384 | ||
928 | #else | ||
929 | #define YY_READ_BUF_SIZE 8192 | 915 | #define YY_READ_BUF_SIZE 8192 |
930 | #endif /* __ia64__ */ | ||
931 | #endif | 916 | #endif |
932 | 917 | ||
933 | /* Copy whatever the last rule matched to the standard output. */ | 918 | /* Copy whatever the last rule matched to the standard output. */ |
@@ -1100,7 +1085,7 @@ YY_RULE_SETUP | |||
1100 | case 6: | 1085 | case 6: |
1101 | YY_RULE_SETUP | 1086 | YY_RULE_SETUP |
1102 | { | 1087 | { |
1103 | struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); | 1088 | const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); |
1104 | BEGIN(PARAM); | 1089 | BEGIN(PARAM); |
1105 | current_pos.file = current_file; | 1090 | current_pos.file = current_file; |
1106 | current_pos.lineno = current_file->lineno; | 1091 | current_pos.lineno = current_file->lineno; |
@@ -1175,7 +1160,7 @@ YY_RULE_SETUP | |||
1175 | case 19: | 1160 | case 19: |
1176 | YY_RULE_SETUP | 1161 | YY_RULE_SETUP |
1177 | { | 1162 | { |
1178 | struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); | 1163 | const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng); |
1179 | if (id && id->flags & TF_PARAM) { | 1164 | if (id && id->flags & TF_PARAM) { |
1180 | zconflval.id = id; | 1165 | zconflval.id = id; |
1181 | return id->token; | 1166 | return id->token; |
@@ -2073,8 +2058,8 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr ) | |||
2073 | 2058 | ||
2074 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will | 2059 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will |
2075 | * scan from a @e copy of @a bytes. | 2060 | * scan from a @e copy of @a bytes. |
2076 | * @param yybytes the byte buffer to scan | 2061 | * @param bytes the byte buffer to scan |
2077 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. | 2062 | * @param len the number of bytes in the buffer pointed to by @a bytes. |
2078 | * | 2063 | * |
2079 | * @return the newly allocated buffer state object. | 2064 | * @return the newly allocated buffer state object. |
2080 | */ | 2065 | */ |
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index 4c5495ea205..f636141e7bf 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
@@ -1,10 +1,9 @@ | |||
1 | 1 | /* A Bison parser, made by GNU Bison 2.4.3. */ | |
2 | /* A Bison parser, made by GNU Bison 2.4.1. */ | ||
3 | 2 | ||
4 | /* Skeleton implementation for Bison's Yacc-like parsers in C | 3 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
5 | 4 | ||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006, |
7 | Free Software Foundation, Inc. | 6 | 2009, 2010 Free Software Foundation, Inc. |
8 | 7 | ||
9 | This program is free software: you can redistribute it and/or modify | 8 | This program is free software: you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | 9 | it under the terms of the GNU General Public License as published by |
@@ -46,7 +45,7 @@ | |||
46 | #define YYBISON 1 | 45 | #define YYBISON 1 |
47 | 46 | ||
48 | /* Bison version. */ | 47 | /* Bison version. */ |
49 | #define YYBISON_VERSION "2.4.1" | 48 | #define YYBISON_VERSION "2.4.3" |
50 | 49 | ||
51 | /* Skeleton name. */ | 50 | /* Skeleton name. */ |
52 | #define YYSKELETON_NAME "yacc.c" | 51 | #define YYSKELETON_NAME "yacc.c" |
@@ -88,7 +87,6 @@ | |||
88 | #include <string.h> | 87 | #include <string.h> |
89 | #include <stdbool.h> | 88 | #include <stdbool.h> |
90 | 89 | ||
91 | #define LKC_DIRECT_LINK | ||
92 | #include "lkc.h" | 90 | #include "lkc.h" |
93 | 91 | ||
94 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | 92 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
@@ -102,22 +100,18 @@ extern int zconflex(void); | |||
102 | static void zconfprint(const char *err, ...); | 100 | static void zconfprint(const char *err, ...); |
103 | static void zconf_error(const char *err, ...); | 101 | static void zconf_error(const char *err, ...); |
104 | static void zconferror(const char *err); | 102 | static void zconferror(const char *err); |
105 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); | 103 | static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); |
106 | 104 | ||
107 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; | 105 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; |
108 | 106 | ||
109 | static struct menu *current_menu, *current_entry; | 107 | static struct menu *current_menu, *current_entry; |
110 | 108 | ||
111 | #define YYDEBUG 0 | ||
112 | #if YYDEBUG | ||
113 | #define YYERROR_VERBOSE | ||
114 | #endif | ||
115 | 109 | ||
116 | 110 | ||
117 | 111 | ||
118 | /* Enabling traces. */ | 112 | /* Enabling traces. */ |
119 | #ifndef YYDEBUG | 113 | #ifndef YYDEBUG |
120 | # define YYDEBUG 0 | 114 | # define YYDEBUG 1 |
121 | #endif | 115 | #endif |
122 | 116 | ||
123 | /* Enabling verbose error messages. */ | 117 | /* Enabling verbose error messages. */ |
@@ -188,7 +182,7 @@ typedef union YYSTYPE | |||
188 | struct symbol *symbol; | 182 | struct symbol *symbol; |
189 | struct expr *expr; | 183 | struct expr *expr; |
190 | struct menu *menu; | 184 | struct menu *menu; |
191 | struct kconf_id *id; | 185 | const struct kconf_id *id; |
192 | 186 | ||
193 | 187 | ||
194 | 188 | ||
@@ -255,7 +249,7 @@ typedef short int yytype_int16; | |||
255 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) | 249 | #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) |
256 | 250 | ||
257 | #ifndef YY_ | 251 | #ifndef YY_ |
258 | # if YYENABLE_NLS | 252 | # if defined YYENABLE_NLS && YYENABLE_NLS |
259 | # if ENABLE_NLS | 253 | # if ENABLE_NLS |
260 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ | 254 | # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ |
261 | # define YY_(msgid) dgettext ("bison-runtime", msgid) | 255 | # define YY_(msgid) dgettext ("bison-runtime", msgid) |
@@ -535,18 +529,18 @@ static const yytype_int8 yyrhs[] = | |||
535 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 529 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
536 | static const yytype_uint16 yyrline[] = | 530 | static const yytype_uint16 yyrline[] = |
537 | { | 531 | { |
538 | 0, 108, 108, 108, 110, 110, 112, 114, 115, 116, | 532 | 0, 104, 104, 104, 106, 106, 108, 110, 111, 112, |
539 | 117, 118, 119, 123, 127, 127, 127, 127, 127, 127, | 533 | 113, 114, 115, 119, 123, 123, 123, 123, 123, 123, |
540 | 127, 127, 131, 132, 133, 134, 135, 136, 140, 141, | 534 | 123, 123, 127, 128, 129, 130, 131, 132, 136, 137, |
541 | 147, 155, 161, 169, 179, 181, 182, 183, 184, 185, | 535 | 143, 151, 157, 165, 175, 177, 178, 179, 180, 181, |
542 | 186, 189, 197, 203, 213, 219, 225, 228, 230, 241, | 536 | 182, 185, 193, 199, 209, 215, 221, 224, 226, 237, |
543 | 242, 247, 256, 261, 269, 272, 274, 275, 276, 277, | 537 | 238, 243, 252, 257, 265, 268, 270, 271, 272, 273, |
544 | 278, 281, 287, 298, 304, 314, 316, 321, 329, 337, | 538 | 274, 277, 283, 294, 300, 310, 312, 317, 325, 333, |
545 | 340, 342, 343, 344, 349, 356, 363, 368, 376, 379, | 539 | 336, 338, 339, 340, 345, 352, 359, 364, 372, 375, |
546 | 381, 382, 383, 386, 394, 401, 408, 414, 421, 423, | 540 | 377, 378, 379, 382, 390, 397, 404, 410, 417, 419, |
547 | 424, 425, 428, 436, 438, 439, 442, 449, 451, 456, | 541 | 420, 421, 424, 432, 434, 435, 438, 445, 447, 452, |
548 | 457, 460, 461, 462, 466, 467, 470, 471, 474, 475, | 542 | 453, 456, 457, 458, 462, 463, 466, 467, 470, 471, |
549 | 476, 477, 478, 479, 480, 483, 484, 487, 488 | 543 | 472, 473, 474, 475, 476, 479, 480, 483, 484 |
550 | }; | 544 | }; |
551 | #endif | 545 | #endif |
552 | 546 | ||
@@ -806,9 +800,18 @@ static const yytype_uint8 yystos[] = | |||
806 | 800 | ||
807 | /* Like YYERROR except do call yyerror. This remains here temporarily | 801 | /* Like YYERROR except do call yyerror. This remains here temporarily |
808 | to ease the transition to the new meaning of YYERROR, for GCC. | 802 | to ease the transition to the new meaning of YYERROR, for GCC. |
809 | Once GCC version 2 has supplanted version 1, this can go. */ | 803 | Once GCC version 2 has supplanted version 1, this can go. However, |
804 | YYFAIL appears to be in use. Nevertheless, it is formally deprecated | ||
805 | in Bison 2.4.2's NEWS entry, where a plan to phase it out is | ||
806 | discussed. */ | ||
810 | 807 | ||
811 | #define YYFAIL goto yyerrlab | 808 | #define YYFAIL goto yyerrlab |
809 | #if defined YYFAIL | ||
810 | /* This is here to suppress warnings from the GCC cpp's | ||
811 | -Wunused-macros. Normally we don't worry about that warning, but | ||
812 | some users do, and we want to make it easy for users to remove | ||
813 | YYFAIL uses, which will produce warnings from Bison 2.5. */ | ||
814 | #endif | ||
812 | 815 | ||
813 | #define YYRECOVERING() (!!yyerrstatus) | 816 | #define YYRECOVERING() (!!yyerrstatus) |
814 | 817 | ||
@@ -865,7 +868,7 @@ while (YYID (0)) | |||
865 | we won't break user code: when these are the locations we know. */ | 868 | we won't break user code: when these are the locations we know. */ |
866 | 869 | ||
867 | #ifndef YY_LOCATION_PRINT | 870 | #ifndef YY_LOCATION_PRINT |
868 | # if YYLTYPE_IS_TRIVIAL | 871 | # if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL |
869 | # define YY_LOCATION_PRINT(File, Loc) \ | 872 | # define YY_LOCATION_PRINT(File, Loc) \ |
870 | fprintf (File, "%d.%d-%d.%d", \ | 873 | fprintf (File, "%d.%d-%d.%d", \ |
871 | (Loc).first_line, (Loc).first_column, \ | 874 | (Loc).first_line, (Loc).first_column, \ |
@@ -1753,7 +1756,7 @@ yyreduce: | |||
1753 | case 48: | 1756 | case 48: |
1754 | 1757 | ||
1755 | { | 1758 | { |
1756 | struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); | 1759 | const struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string))); |
1757 | if (id && id->flags & TF_OPTION) | 1760 | if (id && id->flags & TF_OPTION) |
1758 | menu_add_option(id->token, (yyvsp[(3) - (3)].string)); | 1761 | menu_add_option(id->token, (yyvsp[(3) - (3)].string)); |
1759 | else | 1762 | else |
@@ -2258,10 +2261,8 @@ void conf_parse(const char *name) | |||
2258 | modules_sym->flags |= SYMBOL_AUTO; | 2261 | modules_sym->flags |= SYMBOL_AUTO; |
2259 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); | 2262 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); |
2260 | 2263 | ||
2261 | #if YYDEBUG | ||
2262 | if (getenv("ZCONF_DEBUG")) | 2264 | if (getenv("ZCONF_DEBUG")) |
2263 | zconfdebug = 1; | 2265 | zconfdebug = 1; |
2264 | #endif | ||
2265 | zconfparse(); | 2266 | zconfparse(); |
2266 | if (zconfnerrs) | 2267 | if (zconfnerrs) |
2267 | exit(1); | 2268 | exit(1); |
@@ -2300,7 +2301,7 @@ static const char *zconf_tokenname(int token) | |||
2300 | return "<token>"; | 2301 | return "<token>"; |
2301 | } | 2302 | } |
2302 | 2303 | ||
2303 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) | 2304 | static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken) |
2304 | { | 2305 | { |
2305 | if (id->token != endtoken) { | 2306 | if (id->token != endtoken) { |
2306 | zconf_error("unexpected '%s' within %s block", | 2307 | zconf_error("unexpected '%s' within %s block", |
@@ -2345,9 +2346,7 @@ static void zconf_error(const char *err, ...) | |||
2345 | 2346 | ||
2346 | static void zconferror(const char *err) | 2347 | static void zconferror(const char *err) |
2347 | { | 2348 | { |
2348 | #if YYDEBUG | ||
2349 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | 2349 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); |
2350 | #endif | ||
2351 | } | 2350 | } |
2352 | 2351 | ||
2353 | static void print_quoted_string(FILE *out, const char *str) | 2352 | static void print_quoted_string(FILE *out, const char *str) |
@@ -2496,7 +2495,7 @@ void zconfdump(FILE *out) | |||
2496 | } | 2495 | } |
2497 | } | 2496 | } |
2498 | 2497 | ||
2499 | #include "lex.zconf.c" | 2498 | #include "zconf.lex.c" |
2500 | #include "util.c" | 2499 | #include "util.c" |
2501 | #include "confdata.c" | 2500 | #include "confdata.c" |
2502 | #include "expr.c" | 2501 | #include "expr.c" |
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 49fb4ab664c..864da07ba4a 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -11,7 +11,6 @@ | |||
11 | #include <string.h> | 11 | #include <string.h> |
12 | #include <stdbool.h> | 12 | #include <stdbool.h> |
13 | 13 | ||
14 | #define LKC_DIRECT_LINK | ||
15 | #include "lkc.h" | 14 | #include "lkc.h" |
16 | 15 | ||
17 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | 16 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
@@ -25,16 +24,12 @@ extern int zconflex(void); | |||
25 | static void zconfprint(const char *err, ...); | 24 | static void zconfprint(const char *err, ...); |
26 | static void zconf_error(const char *err, ...); | 25 | static void zconf_error(const char *err, ...); |
27 | static void zconferror(const char *err); | 26 | static void zconferror(const char *err); |
28 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken); | 27 | static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); |
29 | 28 | ||
30 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; | 29 | struct symbol *symbol_hash[SYMBOL_HASHSIZE]; |
31 | 30 | ||
32 | static struct menu *current_menu, *current_entry; | 31 | static struct menu *current_menu, *current_entry; |
33 | 32 | ||
34 | #define YYDEBUG 0 | ||
35 | #if YYDEBUG | ||
36 | #define YYERROR_VERBOSE | ||
37 | #endif | ||
38 | %} | 33 | %} |
39 | %expect 30 | 34 | %expect 30 |
40 | 35 | ||
@@ -45,7 +40,7 @@ static struct menu *current_menu, *current_entry; | |||
45 | struct symbol *symbol; | 40 | struct symbol *symbol; |
46 | struct expr *expr; | 41 | struct expr *expr; |
47 | struct menu *menu; | 42 | struct menu *menu; |
48 | struct kconf_id *id; | 43 | const struct kconf_id *id; |
49 | } | 44 | } |
50 | 45 | ||
51 | %token <id>T_MAINMENU | 46 | %token <id>T_MAINMENU |
@@ -229,7 +224,7 @@ symbol_option_list: | |||
229 | /* empty */ | 224 | /* empty */ |
230 | | symbol_option_list T_WORD symbol_option_arg | 225 | | symbol_option_list T_WORD symbol_option_arg |
231 | { | 226 | { |
232 | struct kconf_id *id = kconf_id_lookup($2, strlen($2)); | 227 | const struct kconf_id *id = kconf_id_lookup($2, strlen($2)); |
233 | if (id && id->flags & TF_OPTION) | 228 | if (id && id->flags & TF_OPTION) |
234 | menu_add_option(id->token, $3); | 229 | menu_add_option(id->token, $3); |
235 | else | 230 | else |
@@ -503,10 +498,8 @@ void conf_parse(const char *name) | |||
503 | modules_sym->flags |= SYMBOL_AUTO; | 498 | modules_sym->flags |= SYMBOL_AUTO; |
504 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); | 499 | rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); |
505 | 500 | ||
506 | #if YYDEBUG | ||
507 | if (getenv("ZCONF_DEBUG")) | 501 | if (getenv("ZCONF_DEBUG")) |
508 | zconfdebug = 1; | 502 | zconfdebug = 1; |
509 | #endif | ||
510 | zconfparse(); | 503 | zconfparse(); |
511 | if (zconfnerrs) | 504 | if (zconfnerrs) |
512 | exit(1); | 505 | exit(1); |
@@ -545,7 +538,7 @@ static const char *zconf_tokenname(int token) | |||
545 | return "<token>"; | 538 | return "<token>"; |
546 | } | 539 | } |
547 | 540 | ||
548 | static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken) | 541 | static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken) |
549 | { | 542 | { |
550 | if (id->token != endtoken) { | 543 | if (id->token != endtoken) { |
551 | zconf_error("unexpected '%s' within %s block", | 544 | zconf_error("unexpected '%s' within %s block", |
@@ -590,9 +583,7 @@ static void zconf_error(const char *err, ...) | |||
590 | 583 | ||
591 | static void zconferror(const char *err) | 584 | static void zconferror(const char *err) |
592 | { | 585 | { |
593 | #if YYDEBUG | ||
594 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | 586 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); |
595 | #endif | ||
596 | } | 587 | } |
597 | 588 | ||
598 | static void print_quoted_string(FILE *out, const char *str) | 589 | static void print_quoted_string(FILE *out, const char *str) |
@@ -741,7 +732,7 @@ void zconfdump(FILE *out) | |||
741 | } | 732 | } |
742 | } | 733 | } |
743 | 734 | ||
744 | #include "lex.zconf.c" | 735 | #include "zconf.lex.c" |
745 | #include "util.c" | 736 | #include "util.c" |
746 | #include "confdata.c" | 737 | #include "confdata.c" |
747 | #include "expr.c" | 738 | #include "expr.c" |