diff options
| author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
| commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
| tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /scripts/kconfig | |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'scripts/kconfig')
| -rw-r--r-- | scripts/kconfig/Makefile | 208 | ||||
| -rw-r--r-- | scripts/kconfig/conf.c | 583 | ||||
| -rw-r--r-- | scripts/kconfig/confdata.c | 460 | ||||
| -rw-r--r-- | scripts/kconfig/expr.c | 1099 | ||||
| -rw-r--r-- | scripts/kconfig/expr.h | 195 | ||||
| -rw-r--r-- | scripts/kconfig/gconf.c | 1639 | ||||
| -rw-r--r-- | scripts/kconfig/gconf.glade | 543 | ||||
| -rw-r--r-- | scripts/kconfig/images.c | 326 | ||||
| -rw-r--r-- | scripts/kconfig/kconfig_load.c | 35 | ||||
| -rw-r--r-- | scripts/kconfig/lex.zconf.c_shipped | 3688 | ||||
| -rw-r--r-- | scripts/kconfig/lkc.h | 123 | ||||
| -rw-r--r-- | scripts/kconfig/lkc_proto.h | 40 | ||||
| -rw-r--r-- | scripts/kconfig/mconf.c | 1090 | ||||
| -rw-r--r-- | scripts/kconfig/menu.c | 390 | ||||
| -rw-r--r-- | scripts/kconfig/qconf.cc | 1407 | ||||
| -rw-r--r-- | scripts/kconfig/qconf.h | 263 | ||||
| -rw-r--r-- | scripts/kconfig/symbol.c | 816 | ||||
| -rw-r--r-- | scripts/kconfig/util.c | 109 | ||||
| -rw-r--r-- | scripts/kconfig/zconf.l | 366 | ||||
| -rw-r--r-- | scripts/kconfig/zconf.tab.c_shipped | 2130 | ||||
| -rw-r--r-- | scripts/kconfig/zconf.tab.h_shipped | 125 | ||||
| -rw-r--r-- | scripts/kconfig/zconf.y | 690 |
22 files changed, 16325 insertions, 0 deletions
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile new file mode 100644 index 000000000000..5a5ddc40f36c --- /dev/null +++ b/scripts/kconfig/Makefile | |||
| @@ -0,0 +1,208 @@ | |||
| 1 | # =========================================================================== | ||
| 2 | # Kernel configuration targets | ||
| 3 | # These targets are used from top-level makefile | ||
| 4 | |||
| 5 | .PHONY: oldconfig xconfig gconfig menuconfig config silentoldconfig | ||
| 6 | |||
| 7 | xconfig: $(obj)/qconf | ||
| 8 | $< arch/$(ARCH)/Kconfig | ||
| 9 | |||
| 10 | gconfig: $(obj)/gconf | ||
| 11 | $< arch/$(ARCH)/Kconfig | ||
| 12 | |||
| 13 | menuconfig: $(obj)/mconf | ||
| 14 | $(Q)$(MAKE) $(build)=scripts/lxdialog | ||
| 15 | $< arch/$(ARCH)/Kconfig | ||
| 16 | |||
| 17 | config: $(obj)/conf | ||
| 18 | $< arch/$(ARCH)/Kconfig | ||
| 19 | |||
| 20 | oldconfig: $(obj)/conf | ||
| 21 | $< -o arch/$(ARCH)/Kconfig | ||
| 22 | |||
| 23 | silentoldconfig: $(obj)/conf | ||
| 24 | $< -s arch/$(ARCH)/Kconfig | ||
| 25 | |||
| 26 | .PHONY: randconfig allyesconfig allnoconfig allmodconfig defconfig | ||
| 27 | |||
| 28 | randconfig: $(obj)/conf | ||
| 29 | $< -r arch/$(ARCH)/Kconfig | ||
| 30 | |||
| 31 | allyesconfig: $(obj)/conf | ||
| 32 | $< -y arch/$(ARCH)/Kconfig | ||
| 33 | |||
| 34 | allnoconfig: $(obj)/conf | ||
| 35 | $< -n arch/$(ARCH)/Kconfig | ||
| 36 | |||
| 37 | allmodconfig: $(obj)/conf | ||
| 38 | $< -m arch/$(ARCH)/Kconfig | ||
| 39 | |||
| 40 | defconfig: $(obj)/conf | ||
| 41 | ifeq ($(KBUILD_DEFCONFIG),) | ||
| 42 | $< -d arch/$(ARCH)/Kconfig | ||
| 43 | else | ||
| 44 | @echo *** Default configuration is based on '$(KBUILD_DEFCONFIG)' | ||
| 45 | $(Q)$< -D arch/$(ARCH)/configs/$(KBUILD_DEFCONFIG) arch/$(ARCH)/Kconfig | ||
| 46 | endif | ||
| 47 | |||
| 48 | %_defconfig: $(obj)/conf | ||
| 49 | $(Q)$< -D arch/$(ARCH)/configs/$@ arch/$(ARCH)/Kconfig | ||
| 50 | |||
| 51 | # Help text used by make help | ||
| 52 | help: | ||
| 53 | @echo ' config - Update current config utilising a line-oriented program' | ||
| 54 | @echo ' menuconfig - Update current config utilising a menu based program' | ||
| 55 | @echo ' xconfig - Update current config utilising a QT based front-end' | ||
| 56 | @echo ' gconfig - Update current config utilising a GTK based front-end' | ||
| 57 | @echo ' oldconfig - Update current config utilising a provided .config as base' | ||
| 58 | @echo ' randconfig - New config with random answer to all options' | ||
| 59 | @echo ' defconfig - New config with default answer to all options' | ||
| 60 | @echo ' allmodconfig - New config selecting modules when possible' | ||
| 61 | @echo ' allyesconfig - New config where all options are accepted with yes' | ||
| 62 | @echo ' allnoconfig - New minimal config' | ||
| 63 | |||
| 64 | # =========================================================================== | ||
| 65 | # Shared Makefile for the various kconfig executables: | ||
| 66 | # conf: Used for defconfig, oldconfig and related targets | ||
| 67 | # mconf: Used for the mconfig target. | ||
| 68 | # Utilizes the lxdialog package | ||
| 69 | # qconf: Used for the xconfig target | ||
| 70 | # Based on QT which needs to be installed to compile it | ||
| 71 | # gconf: Used for the gconfig target | ||
| 72 | # Based on GTK which needs to be installed to compile it | ||
| 73 | # object files used by all kconfig flavours | ||
| 74 | |||
| 75 | hostprogs-y := conf mconf qconf gconf | ||
| 76 | conf-objs := conf.o zconf.tab.o | ||
| 77 | mconf-objs := mconf.o zconf.tab.o | ||
| 78 | |||
| 79 | ifeq ($(MAKECMDGOALS),xconfig) | ||
| 80 | qconf-target := 1 | ||
| 81 | endif | ||
| 82 | ifeq ($(MAKECMDGOALS),gconfig) | ||
| 83 | gconf-target := 1 | ||
| 84 | endif | ||
| 85 | |||
| 86 | |||
| 87 | ifeq ($(qconf-target),1) | ||
| 88 | qconf-cxxobjs := qconf.o | ||
| 89 | qconf-objs := kconfig_load.o zconf.tab.o | ||
| 90 | endif | ||
| 91 | |||
| 92 | ifeq ($(gconf-target),1) | ||
| 93 | gconf-objs := gconf.o kconfig_load.o zconf.tab.o | ||
| 94 | endif | ||
| 95 | |||
| 96 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ | ||
| 97 | .tmp_gtkcheck zconf.tab.c zconf.tab.h lex.zconf.c | ||
| 98 | |||
| 99 | # generated files seem to need this to find local include files | ||
| 100 | HOSTCFLAGS_lex.zconf.o := -I$(src) | ||
| 101 | HOSTCFLAGS_zconf.tab.o := -I$(src) | ||
| 102 | |||
| 103 | HOSTLOADLIBES_qconf = -L$(QTLIBPATH) -Wl,-rpath,$(QTLIBPATH) -l$(QTLIB) -ldl | ||
| 104 | HOSTCXXFLAGS_qconf.o = -I$(QTDIR)/include -D LKC_DIRECT_LINK | ||
| 105 | |||
| 106 | HOSTLOADLIBES_gconf = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --libs` | ||
| 107 | HOSTCFLAGS_gconf.o = `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --cflags` \ | ||
| 108 | -D LKC_DIRECT_LINK | ||
| 109 | |||
| 110 | $(obj)/conf.o $(obj)/mconf.o $(obj)/qconf.o $(obj)/gconf.o: $(obj)/zconf.tab.h | ||
| 111 | |||
| 112 | $(obj)/zconf.tab.h: $(src)/zconf.tab.h_shipped | ||
| 113 | $(obj)/zconf.tab.c: $(src)/zconf.tab.c_shipped | ||
| 114 | $(obj)/lex.zconf.c: $(src)/lex.zconf.c_shipped | ||
| 115 | |||
| 116 | $(obj)/qconf.o: $(obj)/.tmp_qtcheck | ||
| 117 | |||
| 118 | ifeq ($(qconf-target),1) | ||
| 119 | MOC = $(QTDIR)/bin/moc | ||
| 120 | QTLIBPATH = $(QTDIR)/lib | ||
| 121 | -include $(obj)/.tmp_qtcheck | ||
| 122 | |||
| 123 | # QT needs some extra effort... | ||
| 124 | $(obj)/.tmp_qtcheck: | ||
| 125 | @set -e; for d in $$QTDIR /usr/share/qt* /usr/lib/qt*; do \ | ||
| 126 | if [ -f $$d/include/qconfig.h ]; then DIR=$$d; break; fi; \ | ||
| 127 | done; \ | ||
| 128 | if [ -z "$$DIR" ]; then \ | ||
| 129 | echo "*"; \ | ||
| 130 | echo "* Unable to find the QT installation. Please make sure that the"; \ | ||
| 131 | echo "* QT development package is correctly installed and the QTDIR"; \ | ||
| 132 | echo "* environment variable is set to the correct location."; \ | ||
| 133 | echo "*"; \ | ||
| 134 | false; \ | ||
| 135 | fi; \ | ||
| 136 | LIBPATH=$$DIR/lib; LIB=qt; \ | ||
| 137 | $(HOSTCXX) -print-multi-os-directory > /dev/null 2>&1 && \ | ||
| 138 | LIBPATH=$$DIR/lib/$$($(HOSTCXX) -print-multi-os-directory); \ | ||
| 139 | if [ -f $$LIBPATH/libqt-mt.so ]; then LIB=qt-mt; fi; \ | ||
| 140 | echo "QTDIR=$$DIR" > $@; echo "QTLIBPATH=$$LIBPATH" >> $@; \ | ||
| 141 | echo "QTLIB=$$LIB" >> $@; \ | ||
| 142 | if [ ! -x $$DIR/bin/moc -a -x /usr/bin/moc ]; then \ | ||
| 143 | echo "*"; \ | ||
| 144 | echo "* Unable to find $$DIR/bin/moc, using /usr/bin/moc instead."; \ | ||
| 145 | echo "*"; \ | ||
| 146 | echo "MOC=/usr/bin/moc" >> $@; \ | ||
| 147 | fi | ||
| 148 | endif | ||
| 149 | |||
| 150 | $(obj)/gconf.o: $(obj)/.tmp_gtkcheck | ||
| 151 | |||
| 152 | ifeq ($(gconf-target),1) | ||
| 153 | -include $(obj)/.tmp_gtkcheck | ||
| 154 | |||
| 155 | # GTK needs some extra effort, too... | ||
| 156 | $(obj)/.tmp_gtkcheck: | ||
| 157 | @if `pkg-config gtk+-2.0 gmodule-2.0 libglade-2.0 --exists`; then \ | ||
| 158 | if `pkg-config gtk+-2.0 --atleast-version=2.0.0`; then \ | ||
| 159 | touch $@; \ | ||
| 160 | else \ | ||
| 161 | echo "*"; \ | ||
| 162 | echo "* GTK+ is present but version >= 2.0.0 is required."; \ | ||
| 163 | echo "*"; \ | ||
| 164 | false; \ | ||
| 165 | fi \ | ||
| 166 | else \ | ||
| 167 | echo "*"; \ | ||
| 168 | echo "* Unable to find the GTK+ installation. Please make sure that"; \ | ||
| 169 | echo "* the GTK+ 2.0 development package is correctly installed..."; \ | ||
| 170 | echo "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ | ||
| 171 | echo "*"; \ | ||
| 172 | false; \ | ||
| 173 | fi | ||
| 174 | endif | ||
| 175 | |||
| 176 | $(obj)/zconf.tab.o: $(obj)/lex.zconf.c | ||
| 177 | |||
| 178 | $(obj)/kconfig_load.o: $(obj)/lkc_defs.h | ||
| 179 | |||
| 180 | $(obj)/qconf.o: $(obj)/qconf.moc $(obj)/lkc_defs.h | ||
| 181 | |||
| 182 | $(obj)/gconf.o: $(obj)/lkc_defs.h | ||
| 183 | |||
| 184 | $(obj)/%.moc: $(src)/%.h | ||
| 185 | $(MOC) -i $< -o $@ | ||
| 186 | |||
| 187 | $(obj)/lkc_defs.h: $(src)/lkc_proto.h | ||
| 188 | sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' | ||
| 189 | |||
| 190 | |||
| 191 | ### | ||
| 192 | # The following requires flex/bison | ||
| 193 | # By default we use the _shipped versions, uncomment the following line if | ||
| 194 | # you are modifying the flex/bison src. | ||
| 195 | # LKC_GENPARSER := 1 | ||
| 196 | |||
| 197 | ifdef LKC_GENPARSER | ||
| 198 | |||
| 199 | $(obj)/zconf.tab.c: $(obj)/zconf.y | ||
| 200 | $(obj)/zconf.tab.h: $(obj)/zconf.tab.c | ||
| 201 | |||
| 202 | %.tab.c: %.y | ||
| 203 | bison -t -d -v -b $* -p $(notdir $*) $< | ||
| 204 | |||
| 205 | lex.%.c: %.l | ||
| 206 | flex -P$(notdir $*) -o$@ $< | ||
| 207 | |||
| 208 | endif | ||
diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c new file mode 100644 index 000000000000..a494d1aeb9f9 --- /dev/null +++ b/scripts/kconfig/conf.c | |||
| @@ -0,0 +1,583 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <ctype.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <string.h> | ||
| 9 | #include <unistd.h> | ||
| 10 | #include <time.h> | ||
| 11 | #include <sys/stat.h> | ||
| 12 | |||
| 13 | #define LKC_DIRECT_LINK | ||
| 14 | #include "lkc.h" | ||
| 15 | |||
| 16 | static void conf(struct menu *menu); | ||
| 17 | static void check_conf(struct menu *menu); | ||
| 18 | |||
| 19 | enum { | ||
| 20 | ask_all, | ||
| 21 | ask_new, | ||
| 22 | ask_silent, | ||
| 23 | set_default, | ||
| 24 | set_yes, | ||
| 25 | set_mod, | ||
| 26 | set_no, | ||
| 27 | set_random | ||
| 28 | } input_mode = ask_all; | ||
| 29 | char *defconfig_file; | ||
| 30 | |||
| 31 | static int indent = 1; | ||
| 32 | static int valid_stdin = 1; | ||
| 33 | static int conf_cnt; | ||
| 34 | static signed char line[128]; | ||
| 35 | static struct menu *rootEntry; | ||
| 36 | |||
| 37 | static char nohelp_text[] = "Sorry, no help available for this option yet.\n"; | ||
| 38 | |||
| 39 | static void strip(signed char *str) | ||
| 40 | { | ||
| 41 | signed char *p = str; | ||
| 42 | int l; | ||
| 43 | |||
| 44 | while ((isspace(*p))) | ||
| 45 | p++; | ||
| 46 | l = strlen(p); | ||
| 47 | if (p != str) | ||
| 48 | memmove(str, p, l + 1); | ||
| 49 | if (!l) | ||
| 50 | return; | ||
| 51 | p = str + l - 1; | ||
| 52 | while ((isspace(*p))) | ||
| 53 | *p-- = 0; | ||
| 54 | } | ||
| 55 | |||
| 56 | static void check_stdin(void) | ||
| 57 | { | ||
| 58 | if (!valid_stdin && input_mode == ask_silent) { | ||
| 59 | printf("aborted!\n\n"); | ||
| 60 | printf("Console input/output is redirected. "); | ||
| 61 | printf("Run 'make oldconfig' to update configuration.\n\n"); | ||
| 62 | exit(1); | ||
| 63 | } | ||
| 64 | } | ||
| 65 | |||
| 66 | static void conf_askvalue(struct symbol *sym, const char *def) | ||
| 67 | { | ||
| 68 | enum symbol_type type = sym_get_type(sym); | ||
| 69 | tristate val; | ||
| 70 | |||
| 71 | if (!sym_has_value(sym)) | ||
| 72 | printf("(NEW) "); | ||
| 73 | |||
| 74 | line[0] = '\n'; | ||
| 75 | line[1] = 0; | ||
| 76 | |||
| 77 | if (!sym_is_changable(sym)) { | ||
| 78 | printf("%s\n", def); | ||
| 79 | line[0] = '\n'; | ||
| 80 | line[1] = 0; | ||
| 81 | return; | ||
| 82 | } | ||
| 83 | |||
| 84 | switch (input_mode) { | ||
| 85 | case ask_new: | ||
| 86 | case ask_silent: | ||
| 87 | if (sym_has_value(sym)) { | ||
| 88 | printf("%s\n", def); | ||
| 89 | return; | ||
| 90 | } | ||
| 91 | check_stdin(); | ||
| 92 | case ask_all: | ||
| 93 | fflush(stdout); | ||
| 94 | fgets(line, 128, stdin); | ||
| 95 | return; | ||
| 96 | case set_default: | ||
| 97 | printf("%s\n", def); | ||
| 98 | return; | ||
| 99 | default: | ||
| 100 | break; | ||
| 101 | } | ||
| 102 | |||
| 103 | switch (type) { | ||
| 104 | case S_INT: | ||
| 105 | case S_HEX: | ||
| 106 | case S_STRING: | ||
| 107 | printf("%s\n", def); | ||
| 108 | return; | ||
| 109 | default: | ||
| 110 | ; | ||
| 111 | } | ||
| 112 | switch (input_mode) { | ||
| 113 | case set_yes: | ||
| 114 | if (sym_tristate_within_range(sym, yes)) { | ||
| 115 | line[0] = 'y'; | ||
| 116 | line[1] = '\n'; | ||
| 117 | line[2] = 0; | ||
| 118 | break; | ||
| 119 | } | ||
| 120 | case set_mod: | ||
| 121 | if (type == S_TRISTATE) { | ||
| 122 | if (sym_tristate_within_range(sym, mod)) { | ||
| 123 | line[0] = 'm'; | ||
| 124 | line[1] = '\n'; | ||
| 125 | line[2] = 0; | ||
| 126 | break; | ||
| 127 | } | ||
| 128 | } else { | ||
| 129 | if (sym_tristate_within_range(sym, yes)) { | ||
| 130 | line[0] = 'y'; | ||
| 131 | line[1] = '\n'; | ||
| 132 | line[2] = 0; | ||
| 133 | break; | ||
| 134 | } | ||
| 135 | } | ||
| 136 | case set_no: | ||
| 137 | if (sym_tristate_within_range(sym, no)) { | ||
| 138 | line[0] = 'n'; | ||
| 139 | line[1] = '\n'; | ||
| 140 | line[2] = 0; | ||
| 141 | break; | ||
| 142 | } | ||
| 143 | case set_random: | ||
| 144 | do { | ||
| 145 | val = (tristate)(random() % 3); | ||
| 146 | } while (!sym_tristate_within_range(sym, val)); | ||
| 147 | switch (val) { | ||
| 148 | case no: line[0] = 'n'; break; | ||
| 149 | case mod: line[0] = 'm'; break; | ||
| 150 | case yes: line[0] = 'y'; break; | ||
| 151 | } | ||
| 152 | line[1] = '\n'; | ||
| 153 | line[2] = 0; | ||
| 154 | break; | ||
| 155 | default: | ||
| 156 | break; | ||
| 157 | } | ||
| 158 | printf("%s", line); | ||
| 159 | } | ||
| 160 | |||
| 161 | int conf_string(struct menu *menu) | ||
| 162 | { | ||
| 163 | struct symbol *sym = menu->sym; | ||
| 164 | const char *def, *help; | ||
| 165 | |||
| 166 | while (1) { | ||
| 167 | printf("%*s%s ", indent - 1, "", menu->prompt->text); | ||
| 168 | printf("(%s) ", sym->name); | ||
| 169 | def = sym_get_string_value(sym); | ||
| 170 | if (sym_get_string_value(sym)) | ||
| 171 | printf("[%s] ", def); | ||
| 172 | conf_askvalue(sym, def); | ||
| 173 | switch (line[0]) { | ||
| 174 | case '\n': | ||
| 175 | break; | ||
| 176 | case '?': | ||
| 177 | /* print help */ | ||
| 178 | if (line[1] == '\n') { | ||
| 179 | help = nohelp_text; | ||
| 180 | if (menu->sym->help) | ||
| 181 | help = menu->sym->help; | ||
| 182 | printf("\n%s\n", menu->sym->help); | ||
| 183 | def = NULL; | ||
| 184 | break; | ||
| 185 | } | ||
| 186 | default: | ||
| 187 | line[strlen(line)-1] = 0; | ||
| 188 | def = line; | ||
| 189 | } | ||
| 190 | if (def && sym_set_string_value(sym, def)) | ||
| 191 | return 0; | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | static int conf_sym(struct menu *menu) | ||
| 196 | { | ||
| 197 | struct symbol *sym = menu->sym; | ||
| 198 | int type; | ||
| 199 | tristate oldval, newval; | ||
| 200 | const char *help; | ||
| 201 | |||
| 202 | while (1) { | ||
| 203 | printf("%*s%s ", indent - 1, "", menu->prompt->text); | ||
| 204 | if (sym->name) | ||
| 205 | printf("(%s) ", sym->name); | ||
| 206 | type = sym_get_type(sym); | ||
| 207 | putchar('['); | ||
| 208 | oldval = sym_get_tristate_value(sym); | ||
| 209 | switch (oldval) { | ||
| 210 | case no: | ||
| 211 | putchar('N'); | ||
| 212 | break; | ||
| 213 | case mod: | ||
| 214 | putchar('M'); | ||
| 215 | break; | ||
| 216 | case yes: | ||
| 217 | putchar('Y'); | ||
| 218 | break; | ||
| 219 | } | ||
| 220 | if (oldval != no && sym_tristate_within_range(sym, no)) | ||
| 221 | printf("/n"); | ||
| 222 | if (oldval != mod && sym_tristate_within_range(sym, mod)) | ||
| 223 | printf("/m"); | ||
| 224 | if (oldval != yes && sym_tristate_within_range(sym, yes)) | ||
| 225 | printf("/y"); | ||
| 226 | if (sym->help) | ||
| 227 | printf("/?"); | ||
| 228 | printf("] "); | ||
| 229 | conf_askvalue(sym, sym_get_string_value(sym)); | ||
| 230 | strip(line); | ||
| 231 | |||
| 232 | switch (line[0]) { | ||
| 233 | case 'n': | ||
| 234 | case 'N': | ||
| 235 | newval = no; | ||
| 236 | if (!line[1] || !strcmp(&line[1], "o")) | ||
| 237 | break; | ||
| 238 | continue; | ||
| 239 | case 'm': | ||
| 240 | case 'M': | ||
| 241 | newval = mod; | ||
| 242 | if (!line[1]) | ||
| 243 | break; | ||
| 244 | continue; | ||
| 245 | case 'y': | ||
| 246 | case 'Y': | ||
| 247 | newval = yes; | ||
| 248 | if (!line[1] || !strcmp(&line[1], "es")) | ||
| 249 | break; | ||
| 250 | continue; | ||
| 251 | case 0: | ||
| 252 | newval = oldval; | ||
| 253 | break; | ||
| 254 | case '?': | ||
| 255 | goto help; | ||
| 256 | default: | ||
| 257 | continue; | ||
| 258 | } | ||
| 259 | if (sym_set_tristate_value(sym, newval)) | ||
| 260 | return 0; | ||
| 261 | help: | ||
| 262 | help = nohelp_text; | ||
| 263 | if (sym->help) | ||
| 264 | help = sym->help; | ||
| 265 | printf("\n%s\n", help); | ||
| 266 | } | ||
| 267 | } | ||
| 268 | |||
| 269 | static int conf_choice(struct menu *menu) | ||
| 270 | { | ||
| 271 | struct symbol *sym, *def_sym; | ||
| 272 | struct menu *child; | ||
| 273 | int type; | ||
| 274 | bool is_new; | ||
| 275 | |||
| 276 | sym = menu->sym; | ||
| 277 | type = sym_get_type(sym); | ||
| 278 | is_new = !sym_has_value(sym); | ||
| 279 | if (sym_is_changable(sym)) { | ||
| 280 | conf_sym(menu); | ||
| 281 | sym_calc_value(sym); | ||
| 282 | switch (sym_get_tristate_value(sym)) { | ||
| 283 | case no: | ||
| 284 | return 1; | ||
| 285 | case mod: | ||
| 286 | return 0; | ||
| 287 | case yes: | ||
| 288 | break; | ||
| 289 | } | ||
| 290 | } else { | ||
| 291 | switch (sym_get_tristate_value(sym)) { | ||
| 292 | case no: | ||
| 293 | return 1; | ||
| 294 | case mod: | ||
| 295 | printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); | ||
| 296 | return 0; | ||
| 297 | case yes: | ||
| 298 | break; | ||
| 299 | } | ||
| 300 | } | ||
| 301 | |||
| 302 | while (1) { | ||
| 303 | int cnt, def; | ||
| 304 | |||
| 305 | printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); | ||
| 306 | def_sym = sym_get_choice_value(sym); | ||
| 307 | cnt = def = 0; | ||
| 308 | line[0] = '0'; | ||
| 309 | line[1] = 0; | ||
| 310 | for (child = menu->list; child; child = child->next) { | ||
| 311 | if (!menu_is_visible(child)) | ||
| 312 | continue; | ||
| 313 | if (!child->sym) { | ||
| 314 | printf("%*c %s\n", indent, '*', menu_get_prompt(child)); | ||
| 315 | continue; | ||
| 316 | } | ||
| 317 | cnt++; | ||
| 318 | if (child->sym == def_sym) { | ||
| 319 | def = cnt; | ||
| 320 | printf("%*c", indent, '>'); | ||
| 321 | } else | ||
| 322 | printf("%*c", indent, ' '); | ||
| 323 | printf(" %d. %s", cnt, menu_get_prompt(child)); | ||
| 324 | if (child->sym->name) | ||
| 325 | printf(" (%s)", child->sym->name); | ||
| 326 | if (!sym_has_value(child->sym)) | ||
| 327 | printf(" (NEW)"); | ||
| 328 | printf("\n"); | ||
| 329 | } | ||
| 330 | printf("%*schoice", indent - 1, ""); | ||
| 331 | if (cnt == 1) { | ||
| 332 | printf("[1]: 1\n"); | ||
| 333 | goto conf_childs; | ||
| 334 | } | ||
| 335 | printf("[1-%d", cnt); | ||
| 336 | if (sym->help) | ||
| 337 | printf("?"); | ||
| 338 | printf("]: "); | ||
| 339 | switch (input_mode) { | ||
| 340 | case ask_new: | ||
| 341 | case ask_silent: | ||
| 342 | if (!is_new) { | ||
| 343 | cnt = def; | ||
| 344 | printf("%d\n", cnt); | ||
| 345 | break; | ||
| 346 | } | ||
| 347 | check_stdin(); | ||
| 348 | case ask_all: | ||
| 349 | fflush(stdout); | ||
| 350 | fgets(line, 128, stdin); | ||
| 351 | strip(line); | ||
| 352 | if (line[0] == '?') { | ||
| 353 | printf("\n%s\n", menu->sym->help ? | ||
| 354 | menu->sym->help : nohelp_text); | ||
| 355 | continue; | ||
| 356 | } | ||
| 357 | if (!line[0]) | ||
| 358 | cnt = def; | ||
| 359 | else if (isdigit(line[0])) | ||
| 360 | cnt = atoi(line); | ||
| 361 | else | ||
| 362 | continue; | ||
| 363 | break; | ||
| 364 | case set_random: | ||
| 365 | def = (random() % cnt) + 1; | ||
| 366 | case set_default: | ||
| 367 | case set_yes: | ||
| 368 | case set_mod: | ||
| 369 | case set_no: | ||
| 370 | cnt = def; | ||
| 371 | printf("%d\n", cnt); | ||
| 372 | break; | ||
| 373 | } | ||
| 374 | |||
| 375 | conf_childs: | ||
| 376 | for (child = menu->list; child; child = child->next) { | ||
| 377 | if (!child->sym || !menu_is_visible(child)) | ||
| 378 | continue; | ||
| 379 | if (!--cnt) | ||
| 380 | break; | ||
| 381 | } | ||
| 382 | if (!child) | ||
| 383 | continue; | ||
| 384 | if (line[strlen(line) - 1] == '?') { | ||
| 385 | printf("\n%s\n", child->sym->help ? | ||
| 386 | child->sym->help : nohelp_text); | ||
| 387 | continue; | ||
| 388 | } | ||
| 389 | sym_set_choice_value(sym, child->sym); | ||
| 390 | if (child->list) { | ||
| 391 | indent += 2; | ||
| 392 | conf(child->list); | ||
| 393 | indent -= 2; | ||
| 394 | } | ||
| 395 | return 1; | ||
| 396 | } | ||
| 397 | } | ||
| 398 | |||
| 399 | static void conf(struct menu *menu) | ||
| 400 | { | ||
| 401 | struct symbol *sym; | ||
| 402 | struct property *prop; | ||
| 403 | struct menu *child; | ||
| 404 | |||
| 405 | if (!menu_is_visible(menu)) | ||
| 406 | return; | ||
| 407 | |||
| 408 | sym = menu->sym; | ||
| 409 | prop = menu->prompt; | ||
| 410 | if (prop) { | ||
| 411 | const char *prompt; | ||
| 412 | |||
| 413 | switch (prop->type) { | ||
| 414 | case P_MENU: | ||
| 415 | if (input_mode == ask_silent && rootEntry != menu) { | ||
| 416 | check_conf(menu); | ||
| 417 | return; | ||
| 418 | } | ||
| 419 | case P_COMMENT: | ||
| 420 | prompt = menu_get_prompt(menu); | ||
| 421 | if (prompt) | ||
| 422 | printf("%*c\n%*c %s\n%*c\n", | ||
| 423 | indent, '*', | ||
| 424 | indent, '*', prompt, | ||
| 425 | indent, '*'); | ||
| 426 | default: | ||
| 427 | ; | ||
| 428 | } | ||
| 429 | } | ||
| 430 | |||
| 431 | if (!sym) | ||
| 432 | goto conf_childs; | ||
| 433 | |||
| 434 | if (sym_is_choice(sym)) { | ||
| 435 | conf_choice(menu); | ||
| 436 | if (sym->curr.tri != mod) | ||
| 437 | return; | ||
| 438 | goto conf_childs; | ||
| 439 | } | ||
| 440 | |||
| 441 | switch (sym->type) { | ||
| 442 | case S_INT: | ||
| 443 | case S_HEX: | ||
| 444 | case S_STRING: | ||
| 445 | conf_string(menu); | ||
| 446 | break; | ||
| 447 | default: | ||
| 448 | conf_sym(menu); | ||
| 449 | break; | ||
| 450 | } | ||
| 451 | |||
| 452 | conf_childs: | ||
| 453 | if (sym) | ||
| 454 | indent += 2; | ||
| 455 | for (child = menu->list; child; child = child->next) | ||
| 456 | conf(child); | ||
| 457 | if (sym) | ||
| 458 | indent -= 2; | ||
| 459 | } | ||
| 460 | |||
| 461 | static void check_conf(struct menu *menu) | ||
| 462 | { | ||
| 463 | struct symbol *sym; | ||
| 464 | struct menu *child; | ||
| 465 | |||
| 466 | if (!menu_is_visible(menu)) | ||
| 467 | return; | ||
| 468 | |||
| 469 | sym = menu->sym; | ||
| 470 | if (sym) { | ||
| 471 | if (sym_is_changable(sym) && !sym_has_value(sym)) { | ||
| 472 | if (!conf_cnt++) | ||
| 473 | printf("*\n* Restart config...\n*\n"); | ||
| 474 | rootEntry = menu_get_parent_menu(menu); | ||
| 475 | conf(rootEntry); | ||
| 476 | } | ||
| 477 | if (sym_is_choice(sym) && sym_get_tristate_value(sym) != mod) | ||
| 478 | return; | ||
| 479 | } | ||
| 480 | |||
| 481 | for (child = menu->list; child; child = child->next) | ||
| 482 | check_conf(child); | ||
| 483 | } | ||
| 484 | |||
| 485 | int main(int ac, char **av) | ||
| 486 | { | ||
| 487 | int i = 1; | ||
| 488 | const char *name; | ||
| 489 | struct stat tmpstat; | ||
| 490 | |||
| 491 | if (ac > i && av[i][0] == '-') { | ||
| 492 | switch (av[i++][1]) { | ||
| 493 | case 'o': | ||
| 494 | input_mode = ask_new; | ||
| 495 | break; | ||
| 496 | case 's': | ||
| 497 | input_mode = ask_silent; | ||
| 498 | valid_stdin = isatty(0) && isatty(1) && isatty(2); | ||
| 499 | break; | ||
| 500 | case 'd': | ||
| 501 | input_mode = set_default; | ||
| 502 | break; | ||
| 503 | case 'D': | ||
| 504 | input_mode = set_default; | ||
| 505 | defconfig_file = av[i++]; | ||
| 506 | if (!defconfig_file) { | ||
| 507 | printf("%s: No default config file specified\n", | ||
| 508 | av[0]); | ||
| 509 | exit(1); | ||
| 510 | } | ||
| 511 | break; | ||
| 512 | case 'n': | ||
| 513 | input_mode = set_no; | ||
| 514 | break; | ||
| 515 | case 'm': | ||
| 516 | input_mode = set_mod; | ||
| 517 | break; | ||
| 518 | case 'y': | ||
| 519 | input_mode = set_yes; | ||
| 520 | break; | ||
| 521 | case 'r': | ||
| 522 | input_mode = set_random; | ||
| 523 | srandom(time(NULL)); | ||
| 524 | break; | ||
| 525 | case 'h': | ||
| 526 | case '?': | ||
| 527 | printf("%s [-o|-s] config\n", av[0]); | ||
| 528 | exit(0); | ||
| 529 | } | ||
| 530 | } | ||
| 531 | name = av[i]; | ||
| 532 | if (!name) { | ||
| 533 | printf("%s: Kconfig file missing\n", av[0]); | ||
| 534 | } | ||
| 535 | conf_parse(name); | ||
| 536 | //zconfdump(stdout); | ||
| 537 | switch (input_mode) { | ||
| 538 | case set_default: | ||
| 539 | if (!defconfig_file) | ||
| 540 | defconfig_file = conf_get_default_confname(); | ||
| 541 | if (conf_read(defconfig_file)) { | ||
| 542 | printf("***\n" | ||
| 543 | "*** Can't find default configuration \"%s\"!\n" | ||
| 544 | "***\n", defconfig_file); | ||
| 545 | exit(1); | ||
| 546 | } | ||
| 547 | break; | ||
| 548 | case ask_silent: | ||
| 549 | if (stat(".config", &tmpstat)) { | ||
| 550 | printf("***\n" | ||
| 551 | "*** You have not yet configured your kernel!\n" | ||
| 552 | "***\n" | ||
| 553 | "*** Please run some configurator (e.g. \"make oldconfig\" or\n" | ||
| 554 | "*** \"make menuconfig\" or \"make xconfig\").\n" | ||
| 555 | "***\n"); | ||
| 556 | exit(1); | ||
| 557 | } | ||
| 558 | case ask_all: | ||
| 559 | case ask_new: | ||
| 560 | conf_read(NULL); | ||
| 561 | break; | ||
| 562 | default: | ||
| 563 | break; | ||
| 564 | } | ||
| 565 | |||
| 566 | if (input_mode != ask_silent) { | ||
| 567 | rootEntry = &rootmenu; | ||
| 568 | conf(&rootmenu); | ||
| 569 | if (input_mode == ask_all) { | ||
| 570 | input_mode = ask_silent; | ||
| 571 | valid_stdin = 1; | ||
| 572 | } | ||
| 573 | } | ||
| 574 | do { | ||
| 575 | conf_cnt = 0; | ||
| 576 | check_conf(&rootmenu); | ||
| 577 | } while (conf_cnt); | ||
| 578 | if (conf_write(NULL)) { | ||
| 579 | fprintf(stderr, "\n*** Error during writing of the kernel configuration.\n\n"); | ||
| 580 | return 1; | ||
| 581 | } | ||
| 582 | return 0; | ||
| 583 | } | ||
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c new file mode 100644 index 000000000000..1e82ae390a69 --- /dev/null +++ b/scripts/kconfig/confdata.c | |||
| @@ -0,0 +1,460 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <sys/stat.h> | ||
| 7 | #include <ctype.h> | ||
| 8 | #include <stdio.h> | ||
| 9 | #include <stdlib.h> | ||
| 10 | #include <string.h> | ||
| 11 | #include <time.h> | ||
| 12 | #include <unistd.h> | ||
| 13 | |||
| 14 | #define LKC_DIRECT_LINK | ||
| 15 | #include "lkc.h" | ||
| 16 | |||
| 17 | const char conf_def_filename[] = ".config"; | ||
| 18 | |||
| 19 | const char conf_defname[] = "arch/$ARCH/defconfig"; | ||
| 20 | |||
| 21 | const char *conf_confnames[] = { | ||
| 22 | ".config", | ||
| 23 | "/lib/modules/$UNAME_RELEASE/.config", | ||
| 24 | "/etc/kernel-config", | ||
| 25 | "/boot/config-$UNAME_RELEASE", | ||
| 26 | conf_defname, | ||
| 27 | NULL, | ||
| 28 | }; | ||
| 29 | |||
| 30 | static char *conf_expand_value(const signed char *in) | ||
| 31 | { | ||
| 32 | struct symbol *sym; | ||
| 33 | const signed char *src; | ||
| 34 | static char res_value[SYMBOL_MAXLENGTH]; | ||
| 35 | char *dst, name[SYMBOL_MAXLENGTH]; | ||
| 36 | |||
| 37 | res_value[0] = 0; | ||
| 38 | dst = name; | ||
| 39 | while ((src = strchr(in, '$'))) { | ||
| 40 | strncat(res_value, in, src - in); | ||
| 41 | src++; | ||
| 42 | dst = name; | ||
| 43 | while (isalnum(*src) || *src == '_') | ||
| 44 | *dst++ = *src++; | ||
| 45 | *dst = 0; | ||
| 46 | sym = sym_lookup(name, 0); | ||
| 47 | sym_calc_value(sym); | ||
| 48 | strcat(res_value, sym_get_string_value(sym)); | ||
| 49 | in = src; | ||
| 50 | } | ||
| 51 | strcat(res_value, in); | ||
| 52 | |||
| 53 | return res_value; | ||
| 54 | } | ||
| 55 | |||
| 56 | char *conf_get_default_confname(void) | ||
| 57 | { | ||
| 58 | struct stat buf; | ||
| 59 | static char fullname[PATH_MAX+1]; | ||
| 60 | char *env, *name; | ||
| 61 | |||
| 62 | name = conf_expand_value(conf_defname); | ||
| 63 | env = getenv(SRCTREE); | ||
| 64 | if (env) { | ||
| 65 | sprintf(fullname, "%s/%s", env, name); | ||
| 66 | if (!stat(fullname, &buf)) | ||
| 67 | return fullname; | ||
| 68 | } | ||
| 69 | return name; | ||
| 70 | } | ||
| 71 | |||
| 72 | int conf_read(const char *name) | ||
| 73 | { | ||
| 74 | FILE *in = NULL; | ||
| 75 | char line[1024]; | ||
| 76 | char *p, *p2; | ||
| 77 | int lineno = 0; | ||
| 78 | struct symbol *sym; | ||
| 79 | struct property *prop; | ||
| 80 | struct expr *e; | ||
| 81 | int i; | ||
| 82 | |||
| 83 | if (name) { | ||
| 84 | in = zconf_fopen(name); | ||
| 85 | } else { | ||
| 86 | const char **names = conf_confnames; | ||
| 87 | while ((name = *names++)) { | ||
| 88 | name = conf_expand_value(name); | ||
| 89 | in = zconf_fopen(name); | ||
| 90 | if (in) { | ||
| 91 | printf("#\n" | ||
| 92 | "# using defaults found in %s\n" | ||
| 93 | "#\n", name); | ||
| 94 | break; | ||
| 95 | } | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | if (!in) | ||
| 100 | return 1; | ||
| 101 | |||
| 102 | for_all_symbols(i, sym) { | ||
| 103 | sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED; | ||
| 104 | sym->flags &= ~SYMBOL_VALID; | ||
| 105 | switch (sym->type) { | ||
| 106 | case S_INT: | ||
| 107 | case S_HEX: | ||
| 108 | case S_STRING: | ||
| 109 | if (sym->user.val) | ||
| 110 | free(sym->user.val); | ||
| 111 | default: | ||
| 112 | sym->user.val = NULL; | ||
| 113 | sym->user.tri = no; | ||
| 114 | } | ||
| 115 | } | ||
| 116 | |||
| 117 | while (fgets(line, sizeof(line), in)) { | ||
| 118 | lineno++; | ||
| 119 | sym = NULL; | ||
| 120 | switch (line[0]) { | ||
| 121 | case '#': | ||
| 122 | if (memcmp(line + 2, "CONFIG_", 7)) | ||
| 123 | continue; | ||
| 124 | p = strchr(line + 9, ' '); | ||
| 125 | if (!p) | ||
| 126 | continue; | ||
| 127 | *p++ = 0; | ||
| 128 | if (strncmp(p, "is not set", 10)) | ||
| 129 | continue; | ||
| 130 | sym = sym_find(line + 9); | ||
| 131 | if (!sym) { | ||
| 132 | fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 9); | ||
| 133 | break; | ||
| 134 | } | ||
| 135 | switch (sym->type) { | ||
| 136 | case S_BOOLEAN: | ||
| 137 | case S_TRISTATE: | ||
| 138 | sym->user.tri = no; | ||
| 139 | sym->flags &= ~SYMBOL_NEW; | ||
| 140 | break; | ||
| 141 | default: | ||
| 142 | ; | ||
| 143 | } | ||
| 144 | break; | ||
| 145 | case 'C': | ||
| 146 | if (memcmp(line, "CONFIG_", 7)) | ||
| 147 | continue; | ||
| 148 | p = strchr(line + 7, '='); | ||
| 149 | if (!p) | ||
| 150 | continue; | ||
| 151 | *p++ = 0; | ||
| 152 | p2 = strchr(p, '\n'); | ||
| 153 | if (p2) | ||
| 154 | *p2 = 0; | ||
| 155 | sym = sym_find(line + 7); | ||
| 156 | if (!sym) { | ||
| 157 | fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line + 7); | ||
| 158 | break; | ||
| 159 | } | ||
| 160 | switch (sym->type) { | ||
| 161 | case S_TRISTATE: | ||
| 162 | if (p[0] == 'm') { | ||
| 163 | sym->user.tri = mod; | ||
| 164 | sym->flags &= ~SYMBOL_NEW; | ||
| 165 | break; | ||
| 166 | } | ||
| 167 | case S_BOOLEAN: | ||
| 168 | if (p[0] == 'y') { | ||
| 169 | sym->user.tri = yes; | ||
| 170 | sym->flags &= ~SYMBOL_NEW; | ||
| 171 | break; | ||
| 172 | } | ||
| 173 | if (p[0] == 'n') { | ||
| 174 | sym->user.tri = no; | ||
| 175 | sym->flags &= ~SYMBOL_NEW; | ||
| 176 | break; | ||
| 177 | } | ||
| 178 | break; | ||
| 179 | case S_STRING: | ||
| 180 | if (*p++ != '"') | ||
| 181 | break; | ||
| 182 | for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { | ||
| 183 | if (*p2 == '"') { | ||
| 184 | *p2 = 0; | ||
| 185 | break; | ||
| 186 | } | ||
| 187 | memmove(p2, p2 + 1, strlen(p2)); | ||
| 188 | } | ||
| 189 | if (!p2) { | ||
| 190 | fprintf(stderr, "%s:%d: invalid string found\n", name, lineno); | ||
| 191 | exit(1); | ||
| 192 | } | ||
| 193 | case S_INT: | ||
| 194 | case S_HEX: | ||
| 195 | if (sym_string_valid(sym, p)) { | ||
| 196 | sym->user.val = strdup(p); | ||
| 197 | sym->flags &= ~SYMBOL_NEW; | ||
| 198 | } else { | ||
| 199 | fprintf(stderr, "%s:%d: symbol value '%s' invalid for %s\n", name, lineno, p, sym->name); | ||
| 200 | exit(1); | ||
| 201 | } | ||
| 202 | break; | ||
| 203 | default: | ||
| 204 | ; | ||
| 205 | } | ||
| 206 | break; | ||
| 207 | case '\n': | ||
| 208 | break; | ||
| 209 | default: | ||
| 210 | continue; | ||
| 211 | } | ||
| 212 | if (sym && sym_is_choice_value(sym)) { | ||
| 213 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); | ||
| 214 | switch (sym->user.tri) { | ||
| 215 | case no: | ||
| 216 | break; | ||
| 217 | case mod: | ||
| 218 | if (cs->user.tri == yes) | ||
| 219 | /* warn? */; | ||
| 220 | break; | ||
| 221 | case yes: | ||
| 222 | if (cs->user.tri != no) | ||
| 223 | /* warn? */; | ||
| 224 | cs->user.val = sym; | ||
| 225 | break; | ||
| 226 | } | ||
| 227 | cs->user.tri = E_OR(cs->user.tri, sym->user.tri); | ||
| 228 | cs->flags &= ~SYMBOL_NEW; | ||
| 229 | } | ||
| 230 | } | ||
| 231 | fclose(in); | ||
| 232 | |||
| 233 | if (modules_sym) | ||
| 234 | sym_calc_value(modules_sym); | ||
| 235 | for_all_symbols(i, sym) { | ||
| 236 | sym_calc_value(sym); | ||
| 237 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { | ||
| 238 | if (sym->visible == no) | ||
| 239 | sym->flags |= SYMBOL_NEW; | ||
| 240 | switch (sym->type) { | ||
| 241 | case S_STRING: | ||
| 242 | case S_INT: | ||
| 243 | case S_HEX: | ||
| 244 | if (!sym_string_within_range(sym, sym->user.val)) | ||
| 245 | sym->flags |= SYMBOL_NEW; | ||
| 246 | default: | ||
| 247 | break; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | if (!sym_is_choice(sym)) | ||
| 251 | continue; | ||
| 252 | prop = sym_get_choice_prop(sym); | ||
| 253 | for (e = prop->expr; e; e = e->left.expr) | ||
| 254 | if (e->right.sym->visible != no) | ||
| 255 | sym->flags |= e->right.sym->flags & SYMBOL_NEW; | ||
| 256 | } | ||
| 257 | |||
| 258 | sym_change_count = 1; | ||
| 259 | |||
| 260 | return 0; | ||
| 261 | } | ||
| 262 | |||
| 263 | int conf_write(const char *name) | ||
| 264 | { | ||
| 265 | FILE *out, *out_h; | ||
| 266 | struct symbol *sym; | ||
| 267 | struct menu *menu; | ||
| 268 | const char *basename; | ||
| 269 | char dirname[128], tmpname[128], newname[128]; | ||
| 270 | int type, l; | ||
| 271 | const char *str; | ||
| 272 | time_t now; | ||
| 273 | int use_timestamp = 1; | ||
| 274 | char *env; | ||
| 275 | |||
| 276 | dirname[0] = 0; | ||
| 277 | if (name && name[0]) { | ||
| 278 | struct stat st; | ||
| 279 | char *slash; | ||
| 280 | |||
| 281 | if (!stat(name, &st) && S_ISDIR(st.st_mode)) { | ||
| 282 | strcpy(dirname, name); | ||
| 283 | strcat(dirname, "/"); | ||
| 284 | basename = conf_def_filename; | ||
| 285 | } else if ((slash = strrchr(name, '/'))) { | ||
| 286 | int size = slash - name + 1; | ||
| 287 | memcpy(dirname, name, size); | ||
| 288 | dirname[size] = 0; | ||
| 289 | if (slash[1]) | ||
| 290 | basename = slash + 1; | ||
| 291 | else | ||
| 292 | basename = conf_def_filename; | ||
| 293 | } else | ||
| 294 | basename = name; | ||
| 295 | } else | ||
| 296 | basename = conf_def_filename; | ||
| 297 | |||
| 298 | sprintf(newname, "%s.tmpconfig.%d", dirname, (int)getpid()); | ||
| 299 | out = fopen(newname, "w"); | ||
| 300 | if (!out) | ||
| 301 | return 1; | ||
| 302 | out_h = NULL; | ||
| 303 | if (!name) { | ||
| 304 | out_h = fopen(".tmpconfig.h", "w"); | ||
| 305 | if (!out_h) | ||
| 306 | return 1; | ||
| 307 | } | ||
| 308 | sym = sym_lookup("KERNELRELEASE", 0); | ||
| 309 | sym_calc_value(sym); | ||
| 310 | time(&now); | ||
| 311 | env = getenv("KCONFIG_NOTIMESTAMP"); | ||
| 312 | if (env && *env) | ||
| 313 | use_timestamp = 0; | ||
| 314 | |||
| 315 | fprintf(out, "#\n" | ||
| 316 | "# Automatically generated make config: don't edit\n" | ||
| 317 | "# Linux kernel version: %s\n" | ||
| 318 | "%s%s" | ||
| 319 | "#\n", | ||
| 320 | sym_get_string_value(sym), | ||
| 321 | use_timestamp ? "# " : "", | ||
| 322 | use_timestamp ? ctime(&now) : ""); | ||
| 323 | if (out_h) | ||
| 324 | fprintf(out_h, "/*\n" | ||
| 325 | " * Automatically generated C config: don't edit\n" | ||
| 326 | " * Linux kernel version: %s\n" | ||
| 327 | "%s%s" | ||
| 328 | " */\n" | ||
| 329 | "#define AUTOCONF_INCLUDED\n", | ||
| 330 | sym_get_string_value(sym), | ||
| 331 | use_timestamp ? " * " : "", | ||
| 332 | use_timestamp ? ctime(&now) : ""); | ||
| 333 | |||
| 334 | if (!sym_change_count) | ||
| 335 | sym_clear_all_valid(); | ||
| 336 | |||
| 337 | menu = rootmenu.list; | ||
| 338 | while (menu) { | ||
| 339 | sym = menu->sym; | ||
| 340 | if (!sym) { | ||
| 341 | if (!menu_is_visible(menu)) | ||
| 342 | goto next; | ||
| 343 | str = menu_get_prompt(menu); | ||
| 344 | fprintf(out, "\n" | ||
| 345 | "#\n" | ||
| 346 | "# %s\n" | ||
| 347 | "#\n", str); | ||
| 348 | if (out_h) | ||
| 349 | fprintf(out_h, "\n" | ||
| 350 | "/*\n" | ||
| 351 | " * %s\n" | ||
| 352 | " */\n", str); | ||
| 353 | } else if (!(sym->flags & SYMBOL_CHOICE)) { | ||
| 354 | sym_calc_value(sym); | ||
| 355 | if (!(sym->flags & SYMBOL_WRITE)) | ||
| 356 | goto next; | ||
| 357 | sym->flags &= ~SYMBOL_WRITE; | ||
| 358 | type = sym->type; | ||
| 359 | if (type == S_TRISTATE) { | ||
| 360 | sym_calc_value(modules_sym); | ||
| 361 | if (modules_sym->curr.tri == no) | ||
| 362 | type = S_BOOLEAN; | ||
| 363 | } | ||
| 364 | switch (type) { | ||
| 365 | case S_BOOLEAN: | ||
| 366 | case S_TRISTATE: | ||
| 367 | switch (sym_get_tristate_value(sym)) { | ||
| 368 | case no: | ||
| 369 | fprintf(out, "# CONFIG_%s is not set\n", sym->name); | ||
| 370 | if (out_h) | ||
| 371 | fprintf(out_h, "#undef CONFIG_%s\n", sym->name); | ||
| 372 | break; | ||
| 373 | case mod: | ||
| 374 | fprintf(out, "CONFIG_%s=m\n", sym->name); | ||
| 375 | if (out_h) | ||
| 376 | fprintf(out_h, "#define CONFIG_%s_MODULE 1\n", sym->name); | ||
| 377 | break; | ||
| 378 | case yes: | ||
| 379 | fprintf(out, "CONFIG_%s=y\n", sym->name); | ||
| 380 | if (out_h) | ||
| 381 | fprintf(out_h, "#define CONFIG_%s 1\n", sym->name); | ||
| 382 | break; | ||
| 383 | } | ||
| 384 | break; | ||
| 385 | case S_STRING: | ||
| 386 | // fix me | ||
| 387 | str = sym_get_string_value(sym); | ||
| 388 | fprintf(out, "CONFIG_%s=\"", sym->name); | ||
| 389 | if (out_h) | ||
| 390 | fprintf(out_h, "#define CONFIG_%s \"", sym->name); | ||
| 391 | do { | ||
| 392 | l = strcspn(str, "\"\\"); | ||
| 393 | if (l) { | ||
| 394 | fwrite(str, l, 1, out); | ||
| 395 | if (out_h) | ||
| 396 | fwrite(str, l, 1, out_h); | ||
| 397 | } | ||
| 398 | str += l; | ||
| 399 | while (*str == '\\' || *str == '"') { | ||
| 400 | fprintf(out, "\\%c", *str); | ||
| 401 | if (out_h) | ||
| 402 | fprintf(out_h, "\\%c", *str); | ||
| 403 | str++; | ||
| 404 | } | ||
| 405 | } while (*str); | ||
| 406 | fputs("\"\n", out); | ||
| 407 | if (out_h) | ||
| 408 | fputs("\"\n", out_h); | ||
| 409 | break; | ||
| 410 | case S_HEX: | ||
| 411 | str = sym_get_string_value(sym); | ||
| 412 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | ||
| 413 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | ||
| 414 | if (out_h) | ||
| 415 | fprintf(out_h, "#define CONFIG_%s 0x%s\n", sym->name, str); | ||
| 416 | break; | ||
| 417 | } | ||
| 418 | case S_INT: | ||
| 419 | str = sym_get_string_value(sym); | ||
| 420 | fprintf(out, "CONFIG_%s=%s\n", sym->name, str); | ||
| 421 | if (out_h) | ||
| 422 | fprintf(out_h, "#define CONFIG_%s %s\n", sym->name, str); | ||
| 423 | break; | ||
| 424 | } | ||
| 425 | } | ||
| 426 | |||
| 427 | next: | ||
| 428 | if (menu->list) { | ||
| 429 | menu = menu->list; | ||
| 430 | continue; | ||
| 431 | } | ||
| 432 | if (menu->next) | ||
| 433 | menu = menu->next; | ||
| 434 | else while ((menu = menu->parent)) { | ||
| 435 | if (menu->next) { | ||
| 436 | menu = menu->next; | ||
| 437 | break; | ||
| 438 | } | ||
| 439 | } | ||
| 440 | } | ||
| 441 | fclose(out); | ||
| 442 | if (out_h) { | ||
| 443 | fclose(out_h); | ||
| 444 | rename(".tmpconfig.h", "include/linux/autoconf.h"); | ||
| 445 | file_write_dep(NULL); | ||
| 446 | } | ||
| 447 | if (!name || basename != conf_def_filename) { | ||
| 448 | if (!name) | ||
| 449 | name = conf_def_filename; | ||
| 450 | sprintf(tmpname, "%s.old", name); | ||
| 451 | rename(name, tmpname); | ||
| 452 | } | ||
| 453 | sprintf(tmpname, "%s%s", dirname, basename); | ||
| 454 | if (rename(newname, tmpname)) | ||
| 455 | return 1; | ||
| 456 | |||
| 457 | sym_change_count = 0; | ||
| 458 | |||
| 459 | return 0; | ||
| 460 | } | ||
diff --git a/scripts/kconfig/expr.c b/scripts/kconfig/expr.c new file mode 100644 index 000000000000..30e4f9d69c2f --- /dev/null +++ b/scripts/kconfig/expr.c | |||
| @@ -0,0 +1,1099 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <stdio.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <string.h> | ||
| 9 | |||
| 10 | #define LKC_DIRECT_LINK | ||
| 11 | #include "lkc.h" | ||
| 12 | |||
| 13 | #define DEBUG_EXPR 0 | ||
| 14 | |||
| 15 | struct expr *expr_alloc_symbol(struct symbol *sym) | ||
| 16 | { | ||
| 17 | struct expr *e = malloc(sizeof(*e)); | ||
| 18 | memset(e, 0, sizeof(*e)); | ||
| 19 | e->type = E_SYMBOL; | ||
| 20 | e->left.sym = sym; | ||
| 21 | return e; | ||
| 22 | } | ||
| 23 | |||
| 24 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | ||
| 25 | { | ||
| 26 | struct expr *e = malloc(sizeof(*e)); | ||
| 27 | memset(e, 0, sizeof(*e)); | ||
| 28 | e->type = type; | ||
| 29 | e->left.expr = ce; | ||
| 30 | return e; | ||
| 31 | } | ||
| 32 | |||
| 33 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) | ||
| 34 | { | ||
| 35 | struct expr *e = malloc(sizeof(*e)); | ||
| 36 | memset(e, 0, sizeof(*e)); | ||
| 37 | e->type = type; | ||
| 38 | e->left.expr = e1; | ||
| 39 | e->right.expr = e2; | ||
| 40 | return e; | ||
| 41 | } | ||
| 42 | |||
| 43 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) | ||
| 44 | { | ||
| 45 | struct expr *e = malloc(sizeof(*e)); | ||
| 46 | memset(e, 0, sizeof(*e)); | ||
| 47 | e->type = type; | ||
| 48 | e->left.sym = s1; | ||
| 49 | e->right.sym = s2; | ||
| 50 | return e; | ||
| 51 | } | ||
| 52 | |||
| 53 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2) | ||
| 54 | { | ||
| 55 | if (!e1) | ||
| 56 | return e2; | ||
| 57 | return e2 ? expr_alloc_two(E_AND, e1, e2) : e1; | ||
| 58 | } | ||
| 59 | |||
| 60 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2) | ||
| 61 | { | ||
| 62 | if (!e1) | ||
| 63 | return e2; | ||
| 64 | return e2 ? expr_alloc_two(E_OR, e1, e2) : e1; | ||
| 65 | } | ||
| 66 | |||
| 67 | struct expr *expr_copy(struct expr *org) | ||
| 68 | { | ||
| 69 | struct expr *e; | ||
| 70 | |||
| 71 | if (!org) | ||
| 72 | return NULL; | ||
| 73 | |||
| 74 | e = malloc(sizeof(*org)); | ||
| 75 | memcpy(e, org, sizeof(*org)); | ||
| 76 | switch (org->type) { | ||
| 77 | case E_SYMBOL: | ||
| 78 | e->left = org->left; | ||
| 79 | break; | ||
| 80 | case E_NOT: | ||
| 81 | e->left.expr = expr_copy(org->left.expr); | ||
| 82 | break; | ||
| 83 | case E_EQUAL: | ||
| 84 | case E_UNEQUAL: | ||
| 85 | e->left.sym = org->left.sym; | ||
| 86 | e->right.sym = org->right.sym; | ||
| 87 | break; | ||
| 88 | case E_AND: | ||
| 89 | case E_OR: | ||
| 90 | case E_CHOICE: | ||
| 91 | e->left.expr = expr_copy(org->left.expr); | ||
| 92 | e->right.expr = expr_copy(org->right.expr); | ||
| 93 | break; | ||
| 94 | default: | ||
| 95 | printf("can't copy type %d\n", e->type); | ||
| 96 | free(e); | ||
| 97 | e = NULL; | ||
| 98 | break; | ||
| 99 | } | ||
| 100 | |||
| 101 | return e; | ||
| 102 | } | ||
| 103 | |||
| 104 | void expr_free(struct expr *e) | ||
| 105 | { | ||
| 106 | if (!e) | ||
| 107 | return; | ||
| 108 | |||
| 109 | switch (e->type) { | ||
| 110 | case E_SYMBOL: | ||
| 111 | break; | ||
| 112 | case E_NOT: | ||
| 113 | expr_free(e->left.expr); | ||
| 114 | return; | ||
| 115 | case E_EQUAL: | ||
| 116 | case E_UNEQUAL: | ||
| 117 | break; | ||
| 118 | case E_OR: | ||
| 119 | case E_AND: | ||
| 120 | expr_free(e->left.expr); | ||
| 121 | expr_free(e->right.expr); | ||
| 122 | break; | ||
| 123 | default: | ||
| 124 | printf("how to free type %d?\n", e->type); | ||
| 125 | break; | ||
| 126 | } | ||
| 127 | free(e); | ||
| 128 | } | ||
| 129 | |||
| 130 | static int trans_count; | ||
| 131 | |||
| 132 | #define e1 (*ep1) | ||
| 133 | #define e2 (*ep2) | ||
| 134 | |||
| 135 | static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
| 136 | { | ||
| 137 | if (e1->type == type) { | ||
| 138 | __expr_eliminate_eq(type, &e1->left.expr, &e2); | ||
| 139 | __expr_eliminate_eq(type, &e1->right.expr, &e2); | ||
| 140 | return; | ||
| 141 | } | ||
| 142 | if (e2->type == type) { | ||
| 143 | __expr_eliminate_eq(type, &e1, &e2->left.expr); | ||
| 144 | __expr_eliminate_eq(type, &e1, &e2->right.expr); | ||
| 145 | return; | ||
| 146 | } | ||
| 147 | if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && | ||
| 148 | e1->left.sym == e2->left.sym && (e1->left.sym->flags & (SYMBOL_YES|SYMBOL_NO))) | ||
| 149 | return; | ||
| 150 | if (!expr_eq(e1, e2)) | ||
| 151 | return; | ||
| 152 | trans_count++; | ||
| 153 | expr_free(e1); expr_free(e2); | ||
| 154 | switch (type) { | ||
| 155 | case E_OR: | ||
| 156 | e1 = expr_alloc_symbol(&symbol_no); | ||
| 157 | e2 = expr_alloc_symbol(&symbol_no); | ||
| 158 | break; | ||
| 159 | case E_AND: | ||
| 160 | e1 = expr_alloc_symbol(&symbol_yes); | ||
| 161 | e2 = expr_alloc_symbol(&symbol_yes); | ||
| 162 | break; | ||
| 163 | default: | ||
| 164 | ; | ||
| 165 | } | ||
| 166 | } | ||
| 167 | |||
| 168 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) | ||
| 169 | { | ||
| 170 | if (!e1 || !e2) | ||
| 171 | return; | ||
| 172 | switch (e1->type) { | ||
| 173 | case E_OR: | ||
| 174 | case E_AND: | ||
| 175 | __expr_eliminate_eq(e1->type, ep1, ep2); | ||
| 176 | default: | ||
| 177 | ; | ||
| 178 | } | ||
| 179 | if (e1->type != e2->type) switch (e2->type) { | ||
| 180 | case E_OR: | ||
| 181 | case E_AND: | ||
| 182 | __expr_eliminate_eq(e2->type, ep1, ep2); | ||
| 183 | default: | ||
| 184 | ; | ||
| 185 | } | ||
| 186 | e1 = expr_eliminate_yn(e1); | ||
| 187 | e2 = expr_eliminate_yn(e2); | ||
| 188 | } | ||
| 189 | |||
| 190 | #undef e1 | ||
| 191 | #undef e2 | ||
| 192 | |||
| 193 | int expr_eq(struct expr *e1, struct expr *e2) | ||
| 194 | { | ||
| 195 | int res, old_count; | ||
| 196 | |||
| 197 | if (e1->type != e2->type) | ||
| 198 | return 0; | ||
| 199 | switch (e1->type) { | ||
| 200 | case E_EQUAL: | ||
| 201 | case E_UNEQUAL: | ||
| 202 | return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym; | ||
| 203 | case E_SYMBOL: | ||
| 204 | return e1->left.sym == e2->left.sym; | ||
| 205 | case E_NOT: | ||
| 206 | return expr_eq(e1->left.expr, e2->left.expr); | ||
| 207 | case E_AND: | ||
| 208 | case E_OR: | ||
| 209 | e1 = expr_copy(e1); | ||
| 210 | e2 = expr_copy(e2); | ||
| 211 | old_count = trans_count; | ||
| 212 | expr_eliminate_eq(&e1, &e2); | ||
| 213 | res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL && | ||
| 214 | e1->left.sym == e2->left.sym); | ||
| 215 | expr_free(e1); | ||
| 216 | expr_free(e2); | ||
| 217 | trans_count = old_count; | ||
| 218 | return res; | ||
| 219 | case E_CHOICE: | ||
| 220 | case E_RANGE: | ||
| 221 | case E_NONE: | ||
| 222 | /* panic */; | ||
| 223 | } | ||
| 224 | |||
| 225 | if (DEBUG_EXPR) { | ||
| 226 | expr_fprint(e1, stdout); | ||
| 227 | printf(" = "); | ||
| 228 | expr_fprint(e2, stdout); | ||
| 229 | printf(" ?\n"); | ||
| 230 | } | ||
| 231 | |||
| 232 | return 0; | ||
| 233 | } | ||
| 234 | |||
| 235 | struct expr *expr_eliminate_yn(struct expr *e) | ||
| 236 | { | ||
| 237 | struct expr *tmp; | ||
| 238 | |||
| 239 | if (e) switch (e->type) { | ||
| 240 | case E_AND: | ||
| 241 | e->left.expr = expr_eliminate_yn(e->left.expr); | ||
| 242 | e->right.expr = expr_eliminate_yn(e->right.expr); | ||
| 243 | if (e->left.expr->type == E_SYMBOL) { | ||
| 244 | if (e->left.expr->left.sym == &symbol_no) { | ||
| 245 | expr_free(e->left.expr); | ||
| 246 | expr_free(e->right.expr); | ||
| 247 | e->type = E_SYMBOL; | ||
| 248 | e->left.sym = &symbol_no; | ||
| 249 | e->right.expr = NULL; | ||
| 250 | return e; | ||
| 251 | } else if (e->left.expr->left.sym == &symbol_yes) { | ||
| 252 | free(e->left.expr); | ||
| 253 | tmp = e->right.expr; | ||
| 254 | *e = *(e->right.expr); | ||
| 255 | free(tmp); | ||
| 256 | return e; | ||
| 257 | } | ||
| 258 | } | ||
| 259 | if (e->right.expr->type == E_SYMBOL) { | ||
| 260 | if (e->right.expr->left.sym == &symbol_no) { | ||
| 261 | expr_free(e->left.expr); | ||
| 262 | expr_free(e->right.expr); | ||
| 263 | e->type = E_SYMBOL; | ||
| 264 | e->left.sym = &symbol_no; | ||
| 265 | e->right.expr = NULL; | ||
| 266 | return e; | ||
| 267 | } else if (e->right.expr->left.sym == &symbol_yes) { | ||
| 268 | free(e->right.expr); | ||
| 269 | tmp = e->left.expr; | ||
| 270 | *e = *(e->left.expr); | ||
| 271 | free(tmp); | ||
| 272 | return e; | ||
| 273 | } | ||
| 274 | } | ||
| 275 | break; | ||
| 276 | case E_OR: | ||
| 277 | e->left.expr = expr_eliminate_yn(e->left.expr); | ||
| 278 | e->right.expr = expr_eliminate_yn(e->right.expr); | ||
| 279 | if (e->left.expr->type == E_SYMBOL) { | ||
| 280 | if (e->left.expr->left.sym == &symbol_no) { | ||
| 281 | free(e->left.expr); | ||
| 282 | tmp = e->right.expr; | ||
| 283 | *e = *(e->right.expr); | ||
| 284 | free(tmp); | ||
| 285 | return e; | ||
| 286 | } else if (e->left.expr->left.sym == &symbol_yes) { | ||
| 287 | expr_free(e->left.expr); | ||
| 288 | expr_free(e->right.expr); | ||
| 289 | e->type = E_SYMBOL; | ||
| 290 | e->left.sym = &symbol_yes; | ||
| 291 | e->right.expr = NULL; | ||
| 292 | return e; | ||
| 293 | } | ||
| 294 | } | ||
| 295 | if (e->right.expr->type == E_SYMBOL) { | ||
| 296 | if (e->right.expr->left.sym == &symbol_no) { | ||
| 297 | free(e->right.expr); | ||
| 298 | tmp = e->left.expr; | ||
| 299 | *e = *(e->left.expr); | ||
| 300 | free(tmp); | ||
| 301 | return e; | ||
| 302 | } else if (e->right.expr->left.sym == &symbol_yes) { | ||
| 303 | expr_free(e->left.expr); | ||
| 304 | expr_free(e->right.expr); | ||
| 305 | e->type = E_SYMBOL; | ||
| 306 | e->left.sym = &symbol_yes; | ||
| 307 | e->right.expr = NULL; | ||
| 308 | return e; | ||
| 309 | } | ||
| 310 | } | ||
| 311 | break; | ||
| 312 | default: | ||
| 313 | ; | ||
| 314 | } | ||
| 315 | return e; | ||
| 316 | } | ||
| 317 | |||
| 318 | /* | ||
| 319 | * bool FOO!=n => FOO | ||
| 320 | */ | ||
| 321 | struct expr *expr_trans_bool(struct expr *e) | ||
| 322 | { | ||
| 323 | if (!e) | ||
| 324 | return NULL; | ||
| 325 | switch (e->type) { | ||
| 326 | case E_AND: | ||
| 327 | case E_OR: | ||
| 328 | case E_NOT: | ||
| 329 | e->left.expr = expr_trans_bool(e->left.expr); | ||
| 330 | e->right.expr = expr_trans_bool(e->right.expr); | ||
| 331 | break; | ||
| 332 | case E_UNEQUAL: | ||
| 333 | // FOO!=n -> FOO | ||
| 334 | if (e->left.sym->type == S_TRISTATE) { | ||
| 335 | if (e->right.sym == &symbol_no) { | ||
| 336 | e->type = E_SYMBOL; | ||
| 337 | e->right.sym = NULL; | ||
| 338 | } | ||
| 339 | } | ||
| 340 | break; | ||
| 341 | default: | ||
| 342 | ; | ||
| 343 | } | ||
| 344 | return e; | ||
| 345 | } | ||
| 346 | |||
| 347 | /* | ||
| 348 | * e1 || e2 -> ? | ||
| 349 | */ | ||
| 350 | struct expr *expr_join_or(struct expr *e1, struct expr *e2) | ||
| 351 | { | ||
| 352 | struct expr *tmp; | ||
| 353 | struct symbol *sym1, *sym2; | ||
| 354 | |||
| 355 | if (expr_eq(e1, e2)) | ||
| 356 | return expr_copy(e1); | ||
| 357 | if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) | ||
| 358 | return NULL; | ||
| 359 | if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) | ||
| 360 | return NULL; | ||
| 361 | if (e1->type == E_NOT) { | ||
| 362 | tmp = e1->left.expr; | ||
| 363 | if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) | ||
| 364 | return NULL; | ||
| 365 | sym1 = tmp->left.sym; | ||
| 366 | } else | ||
| 367 | sym1 = e1->left.sym; | ||
| 368 | if (e2->type == E_NOT) { | ||
| 369 | if (e2->left.expr->type != E_SYMBOL) | ||
| 370 | return NULL; | ||
| 371 | sym2 = e2->left.expr->left.sym; | ||
| 372 | } else | ||
| 373 | sym2 = e2->left.sym; | ||
| 374 | if (sym1 != sym2) | ||
| 375 | return NULL; | ||
| 376 | if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) | ||
| 377 | return NULL; | ||
| 378 | if (sym1->type == S_TRISTATE) { | ||
| 379 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
| 380 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || | ||
| 381 | (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) { | ||
| 382 | // (a='y') || (a='m') -> (a!='n') | ||
| 383 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_no); | ||
| 384 | } | ||
| 385 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
| 386 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || | ||
| 387 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) { | ||
| 388 | // (a='y') || (a='n') -> (a!='m') | ||
| 389 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_mod); | ||
| 390 | } | ||
| 391 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
| 392 | ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || | ||
| 393 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) { | ||
| 394 | // (a='m') || (a='n') -> (a!='y') | ||
| 395 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes); | ||
| 396 | } | ||
| 397 | } | ||
| 398 | if (sym1->type == S_BOOLEAN && sym1 == sym2) { | ||
| 399 | if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || | ||
| 400 | (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) | ||
| 401 | return expr_alloc_symbol(&symbol_yes); | ||
| 402 | } | ||
| 403 | |||
| 404 | if (DEBUG_EXPR) { | ||
| 405 | printf("optimize ("); | ||
| 406 | expr_fprint(e1, stdout); | ||
| 407 | printf(") || ("); | ||
| 408 | expr_fprint(e2, stdout); | ||
| 409 | printf(")?\n"); | ||
| 410 | } | ||
| 411 | return NULL; | ||
| 412 | } | ||
| 413 | |||
| 414 | struct expr *expr_join_and(struct expr *e1, struct expr *e2) | ||
| 415 | { | ||
| 416 | struct expr *tmp; | ||
| 417 | struct symbol *sym1, *sym2; | ||
| 418 | |||
| 419 | if (expr_eq(e1, e2)) | ||
| 420 | return expr_copy(e1); | ||
| 421 | if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) | ||
| 422 | return NULL; | ||
| 423 | if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) | ||
| 424 | return NULL; | ||
| 425 | if (e1->type == E_NOT) { | ||
| 426 | tmp = e1->left.expr; | ||
| 427 | if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) | ||
| 428 | return NULL; | ||
| 429 | sym1 = tmp->left.sym; | ||
| 430 | } else | ||
| 431 | sym1 = e1->left.sym; | ||
| 432 | if (e2->type == E_NOT) { | ||
| 433 | if (e2->left.expr->type != E_SYMBOL) | ||
| 434 | return NULL; | ||
| 435 | sym2 = e2->left.expr->left.sym; | ||
| 436 | } else | ||
| 437 | sym2 = e2->left.sym; | ||
| 438 | if (sym1 != sym2) | ||
| 439 | return NULL; | ||
| 440 | if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) | ||
| 441 | return NULL; | ||
| 442 | |||
| 443 | if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) || | ||
| 444 | (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes)) | ||
| 445 | // (a) && (a='y') -> (a='y') | ||
| 446 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
| 447 | |||
| 448 | if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) || | ||
| 449 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no)) | ||
| 450 | // (a) && (a!='n') -> (a) | ||
| 451 | return expr_alloc_symbol(sym1); | ||
| 452 | |||
| 453 | if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || | ||
| 454 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) | ||
| 455 | // (a) && (a!='m') -> (a='y') | ||
| 456 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
| 457 | |||
| 458 | if (sym1->type == S_TRISTATE) { | ||
| 459 | if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { | ||
| 460 | // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' | ||
| 461 | sym2 = e1->right.sym; | ||
| 462 | if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) | ||
| 463 | return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) | ||
| 464 | : expr_alloc_symbol(&symbol_no); | ||
| 465 | } | ||
| 466 | if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) { | ||
| 467 | // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' | ||
| 468 | sym2 = e2->right.sym; | ||
| 469 | if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) | ||
| 470 | return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) | ||
| 471 | : expr_alloc_symbol(&symbol_no); | ||
| 472 | } | ||
| 473 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
| 474 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || | ||
| 475 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) | ||
| 476 | // (a!='y') && (a!='n') -> (a='m') | ||
| 477 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_mod); | ||
| 478 | |||
| 479 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
| 480 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || | ||
| 481 | (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) | ||
| 482 | // (a!='y') && (a!='m') -> (a='n') | ||
| 483 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_no); | ||
| 484 | |||
| 485 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
| 486 | ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || | ||
| 487 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) | ||
| 488 | // (a!='m') && (a!='n') -> (a='m') | ||
| 489 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
| 490 | |||
| 491 | if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) || | ||
| 492 | (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) || | ||
| 493 | (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) || | ||
| 494 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) | ||
| 495 | return NULL; | ||
| 496 | } | ||
| 497 | |||
| 498 | if (DEBUG_EXPR) { | ||
| 499 | printf("optimize ("); | ||
| 500 | expr_fprint(e1, stdout); | ||
| 501 | printf(") && ("); | ||
| 502 | expr_fprint(e2, stdout); | ||
| 503 | printf(")?\n"); | ||
| 504 | } | ||
| 505 | return NULL; | ||
| 506 | } | ||
| 507 | |||
| 508 | static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
| 509 | { | ||
| 510 | #define e1 (*ep1) | ||
| 511 | #define e2 (*ep2) | ||
| 512 | struct expr *tmp; | ||
| 513 | |||
| 514 | if (e1->type == type) { | ||
| 515 | expr_eliminate_dups1(type, &e1->left.expr, &e2); | ||
| 516 | expr_eliminate_dups1(type, &e1->right.expr, &e2); | ||
| 517 | return; | ||
| 518 | } | ||
| 519 | if (e2->type == type) { | ||
| 520 | expr_eliminate_dups1(type, &e1, &e2->left.expr); | ||
| 521 | expr_eliminate_dups1(type, &e1, &e2->right.expr); | ||
| 522 | return; | ||
| 523 | } | ||
| 524 | if (e1 == e2) | ||
| 525 | return; | ||
| 526 | |||
| 527 | switch (e1->type) { | ||
| 528 | case E_OR: case E_AND: | ||
| 529 | expr_eliminate_dups1(e1->type, &e1, &e1); | ||
| 530 | default: | ||
| 531 | ; | ||
| 532 | } | ||
| 533 | |||
| 534 | switch (type) { | ||
| 535 | case E_OR: | ||
| 536 | tmp = expr_join_or(e1, e2); | ||
| 537 | if (tmp) { | ||
| 538 | expr_free(e1); expr_free(e2); | ||
| 539 | e1 = expr_alloc_symbol(&symbol_no); | ||
| 540 | e2 = tmp; | ||
| 541 | trans_count++; | ||
| 542 | } | ||
| 543 | break; | ||
| 544 | case E_AND: | ||
| 545 | tmp = expr_join_and(e1, e2); | ||
| 546 | if (tmp) { | ||
| 547 | expr_free(e1); expr_free(e2); | ||
| 548 | e1 = expr_alloc_symbol(&symbol_yes); | ||
| 549 | e2 = tmp; | ||
| 550 | trans_count++; | ||
| 551 | } | ||
| 552 | break; | ||
| 553 | default: | ||
| 554 | ; | ||
| 555 | } | ||
| 556 | #undef e1 | ||
| 557 | #undef e2 | ||
| 558 | } | ||
| 559 | |||
| 560 | static void expr_eliminate_dups2(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
| 561 | { | ||
| 562 | #define e1 (*ep1) | ||
| 563 | #define e2 (*ep2) | ||
| 564 | struct expr *tmp, *tmp1, *tmp2; | ||
| 565 | |||
| 566 | if (e1->type == type) { | ||
| 567 | expr_eliminate_dups2(type, &e1->left.expr, &e2); | ||
| 568 | expr_eliminate_dups2(type, &e1->right.expr, &e2); | ||
| 569 | return; | ||
| 570 | } | ||
| 571 | if (e2->type == type) { | ||
| 572 | expr_eliminate_dups2(type, &e1, &e2->left.expr); | ||
| 573 | expr_eliminate_dups2(type, &e1, &e2->right.expr); | ||
| 574 | } | ||
| 575 | if (e1 == e2) | ||
| 576 | return; | ||
| 577 | |||
| 578 | switch (e1->type) { | ||
| 579 | case E_OR: | ||
| 580 | expr_eliminate_dups2(e1->type, &e1, &e1); | ||
| 581 | // (FOO || BAR) && (!FOO && !BAR) -> n | ||
| 582 | tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); | ||
| 583 | tmp2 = expr_copy(e2); | ||
| 584 | tmp = expr_extract_eq_and(&tmp1, &tmp2); | ||
| 585 | if (expr_is_yes(tmp1)) { | ||
| 586 | expr_free(e1); | ||
| 587 | e1 = expr_alloc_symbol(&symbol_no); | ||
| 588 | trans_count++; | ||
| 589 | } | ||
| 590 | expr_free(tmp2); | ||
| 591 | expr_free(tmp1); | ||
| 592 | expr_free(tmp); | ||
| 593 | break; | ||
| 594 | case E_AND: | ||
| 595 | expr_eliminate_dups2(e1->type, &e1, &e1); | ||
| 596 | // (FOO && BAR) || (!FOO || !BAR) -> y | ||
| 597 | tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); | ||
| 598 | tmp2 = expr_copy(e2); | ||
| 599 | tmp = expr_extract_eq_or(&tmp1, &tmp2); | ||
| 600 | if (expr_is_no(tmp1)) { | ||
| 601 | expr_free(e1); | ||
| 602 | e1 = expr_alloc_symbol(&symbol_yes); | ||
| 603 | trans_count++; | ||
| 604 | } | ||
| 605 | expr_free(tmp2); | ||
| 606 | expr_free(tmp1); | ||
| 607 | expr_free(tmp); | ||
| 608 | break; | ||
| 609 | default: | ||
| 610 | ; | ||
| 611 | } | ||
| 612 | #undef e1 | ||
| 613 | #undef e2 | ||
| 614 | } | ||
| 615 | |||
| 616 | struct expr *expr_eliminate_dups(struct expr *e) | ||
| 617 | { | ||
| 618 | int oldcount; | ||
| 619 | if (!e) | ||
| 620 | return e; | ||
| 621 | |||
| 622 | oldcount = trans_count; | ||
| 623 | while (1) { | ||
| 624 | trans_count = 0; | ||
| 625 | switch (e->type) { | ||
| 626 | case E_OR: case E_AND: | ||
| 627 | expr_eliminate_dups1(e->type, &e, &e); | ||
| 628 | expr_eliminate_dups2(e->type, &e, &e); | ||
| 629 | default: | ||
| 630 | ; | ||
| 631 | } | ||
| 632 | if (!trans_count) | ||
| 633 | break; | ||
| 634 | e = expr_eliminate_yn(e); | ||
| 635 | } | ||
| 636 | trans_count = oldcount; | ||
| 637 | return e; | ||
| 638 | } | ||
| 639 | |||
| 640 | struct expr *expr_transform(struct expr *e) | ||
| 641 | { | ||
| 642 | struct expr *tmp; | ||
| 643 | |||
| 644 | if (!e) | ||
| 645 | return NULL; | ||
| 646 | switch (e->type) { | ||
| 647 | case E_EQUAL: | ||
| 648 | case E_UNEQUAL: | ||
| 649 | case E_SYMBOL: | ||
| 650 | case E_CHOICE: | ||
| 651 | break; | ||
| 652 | default: | ||
| 653 | e->left.expr = expr_transform(e->left.expr); | ||
| 654 | e->right.expr = expr_transform(e->right.expr); | ||
| 655 | } | ||
| 656 | |||
| 657 | switch (e->type) { | ||
| 658 | case E_EQUAL: | ||
| 659 | if (e->left.sym->type != S_BOOLEAN) | ||
| 660 | break; | ||
| 661 | if (e->right.sym == &symbol_no) { | ||
| 662 | e->type = E_NOT; | ||
| 663 | e->left.expr = expr_alloc_symbol(e->left.sym); | ||
| 664 | e->right.sym = NULL; | ||
| 665 | break; | ||
| 666 | } | ||
| 667 | if (e->right.sym == &symbol_mod) { | ||
| 668 | printf("boolean symbol %s tested for 'm'? test forced to 'n'\n", e->left.sym->name); | ||
| 669 | e->type = E_SYMBOL; | ||
| 670 | e->left.sym = &symbol_no; | ||
| 671 | e->right.sym = NULL; | ||
| 672 | break; | ||
| 673 | } | ||
| 674 | if (e->right.sym == &symbol_yes) { | ||
| 675 | e->type = E_SYMBOL; | ||
| 676 | e->right.sym = NULL; | ||
| 677 | break; | ||
| 678 | } | ||
| 679 | break; | ||
| 680 | case E_UNEQUAL: | ||
| 681 | if (e->left.sym->type != S_BOOLEAN) | ||
| 682 | break; | ||
| 683 | if (e->right.sym == &symbol_no) { | ||
| 684 | e->type = E_SYMBOL; | ||
| 685 | e->right.sym = NULL; | ||
| 686 | break; | ||
| 687 | } | ||
| 688 | if (e->right.sym == &symbol_mod) { | ||
| 689 | printf("boolean symbol %s tested for 'm'? test forced to 'y'\n", e->left.sym->name); | ||
| 690 | e->type = E_SYMBOL; | ||
| 691 | e->left.sym = &symbol_yes; | ||
| 692 | e->right.sym = NULL; | ||
| 693 | break; | ||
| 694 | } | ||
| 695 | if (e->right.sym == &symbol_yes) { | ||
| 696 | e->type = E_NOT; | ||
| 697 | e->left.expr = expr_alloc_symbol(e->left.sym); | ||
| 698 | e->right.sym = NULL; | ||
| 699 | break; | ||
| 700 | } | ||
| 701 | break; | ||
| 702 | case E_NOT: | ||
| 703 | switch (e->left.expr->type) { | ||
| 704 | case E_NOT: | ||
| 705 | // !!a -> a | ||
| 706 | tmp = e->left.expr->left.expr; | ||
| 707 | free(e->left.expr); | ||
| 708 | free(e); | ||
| 709 | e = tmp; | ||
| 710 | e = expr_transform(e); | ||
| 711 | break; | ||
| 712 | case E_EQUAL: | ||
| 713 | case E_UNEQUAL: | ||
| 714 | // !a='x' -> a!='x' | ||
| 715 | tmp = e->left.expr; | ||
| 716 | free(e); | ||
| 717 | e = tmp; | ||
| 718 | e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL; | ||
| 719 | break; | ||
| 720 | case E_OR: | ||
| 721 | // !(a || b) -> !a && !b | ||
| 722 | tmp = e->left.expr; | ||
| 723 | e->type = E_AND; | ||
| 724 | e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); | ||
| 725 | tmp->type = E_NOT; | ||
| 726 | tmp->right.expr = NULL; | ||
| 727 | e = expr_transform(e); | ||
| 728 | break; | ||
| 729 | case E_AND: | ||
| 730 | // !(a && b) -> !a || !b | ||
| 731 | tmp = e->left.expr; | ||
| 732 | e->type = E_OR; | ||
| 733 | e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); | ||
| 734 | tmp->type = E_NOT; | ||
| 735 | tmp->right.expr = NULL; | ||
| 736 | e = expr_transform(e); | ||
| 737 | break; | ||
| 738 | case E_SYMBOL: | ||
| 739 | if (e->left.expr->left.sym == &symbol_yes) { | ||
| 740 | // !'y' -> 'n' | ||
| 741 | tmp = e->left.expr; | ||
| 742 | free(e); | ||
| 743 | e = tmp; | ||
| 744 | e->type = E_SYMBOL; | ||
| 745 | e->left.sym = &symbol_no; | ||
| 746 | break; | ||
| 747 | } | ||
| 748 | if (e->left.expr->left.sym == &symbol_mod) { | ||
| 749 | // !'m' -> 'm' | ||
| 750 | tmp = e->left.expr; | ||
| 751 | free(e); | ||
| 752 | e = tmp; | ||
| 753 | e->type = E_SYMBOL; | ||
| 754 | e->left.sym = &symbol_mod; | ||
| 755 | break; | ||
| 756 | } | ||
| 757 | if (e->left.expr->left.sym == &symbol_no) { | ||
| 758 | // !'n' -> 'y' | ||
| 759 | tmp = e->left.expr; | ||
| 760 | free(e); | ||
| 761 | e = tmp; | ||
| 762 | e->type = E_SYMBOL; | ||
| 763 | e->left.sym = &symbol_yes; | ||
| 764 | break; | ||
| 765 | } | ||
| 766 | break; | ||
| 767 | default: | ||
| 768 | ; | ||
| 769 | } | ||
| 770 | break; | ||
| 771 | default: | ||
| 772 | ; | ||
| 773 | } | ||
| 774 | return e; | ||
| 775 | } | ||
| 776 | |||
| 777 | int expr_contains_symbol(struct expr *dep, struct symbol *sym) | ||
| 778 | { | ||
| 779 | if (!dep) | ||
| 780 | return 0; | ||
| 781 | |||
| 782 | switch (dep->type) { | ||
| 783 | case E_AND: | ||
| 784 | case E_OR: | ||
| 785 | return expr_contains_symbol(dep->left.expr, sym) || | ||
| 786 | expr_contains_symbol(dep->right.expr, sym); | ||
| 787 | case E_SYMBOL: | ||
| 788 | return dep->left.sym == sym; | ||
| 789 | case E_EQUAL: | ||
| 790 | case E_UNEQUAL: | ||
| 791 | return dep->left.sym == sym || | ||
| 792 | dep->right.sym == sym; | ||
| 793 | case E_NOT: | ||
| 794 | return expr_contains_symbol(dep->left.expr, sym); | ||
| 795 | default: | ||
| 796 | ; | ||
| 797 | } | ||
| 798 | return 0; | ||
| 799 | } | ||
| 800 | |||
| 801 | bool expr_depends_symbol(struct expr *dep, struct symbol *sym) | ||
| 802 | { | ||
| 803 | if (!dep) | ||
| 804 | return false; | ||
| 805 | |||
| 806 | switch (dep->type) { | ||
| 807 | case E_AND: | ||
| 808 | return expr_depends_symbol(dep->left.expr, sym) || | ||
| 809 | expr_depends_symbol(dep->right.expr, sym); | ||
| 810 | case E_SYMBOL: | ||
| 811 | return dep->left.sym == sym; | ||
| 812 | case E_EQUAL: | ||
| 813 | if (dep->left.sym == sym) { | ||
| 814 | if (dep->right.sym == &symbol_yes || dep->right.sym == &symbol_mod) | ||
| 815 | return true; | ||
| 816 | } | ||
| 817 | break; | ||
| 818 | case E_UNEQUAL: | ||
| 819 | if (dep->left.sym == sym) { | ||
| 820 | if (dep->right.sym == &symbol_no) | ||
| 821 | return true; | ||
| 822 | } | ||
| 823 | break; | ||
| 824 | default: | ||
| 825 | ; | ||
| 826 | } | ||
| 827 | return false; | ||
| 828 | } | ||
| 829 | |||
| 830 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) | ||
| 831 | { | ||
| 832 | struct expr *tmp = NULL; | ||
| 833 | expr_extract_eq(E_AND, &tmp, ep1, ep2); | ||
| 834 | if (tmp) { | ||
| 835 | *ep1 = expr_eliminate_yn(*ep1); | ||
| 836 | *ep2 = expr_eliminate_yn(*ep2); | ||
| 837 | } | ||
| 838 | return tmp; | ||
| 839 | } | ||
| 840 | |||
| 841 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2) | ||
| 842 | { | ||
| 843 | struct expr *tmp = NULL; | ||
| 844 | expr_extract_eq(E_OR, &tmp, ep1, ep2); | ||
| 845 | if (tmp) { | ||
| 846 | *ep1 = expr_eliminate_yn(*ep1); | ||
| 847 | *ep2 = expr_eliminate_yn(*ep2); | ||
| 848 | } | ||
| 849 | return tmp; | ||
| 850 | } | ||
| 851 | |||
| 852 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2) | ||
| 853 | { | ||
| 854 | #define e1 (*ep1) | ||
| 855 | #define e2 (*ep2) | ||
| 856 | if (e1->type == type) { | ||
| 857 | expr_extract_eq(type, ep, &e1->left.expr, &e2); | ||
| 858 | expr_extract_eq(type, ep, &e1->right.expr, &e2); | ||
| 859 | return; | ||
| 860 | } | ||
| 861 | if (e2->type == type) { | ||
| 862 | expr_extract_eq(type, ep, ep1, &e2->left.expr); | ||
| 863 | expr_extract_eq(type, ep, ep1, &e2->right.expr); | ||
| 864 | return; | ||
| 865 | } | ||
| 866 | if (expr_eq(e1, e2)) { | ||
| 867 | *ep = *ep ? expr_alloc_two(type, *ep, e1) : e1; | ||
| 868 | expr_free(e2); | ||
| 869 | if (type == E_AND) { | ||
| 870 | e1 = expr_alloc_symbol(&symbol_yes); | ||
| 871 | e2 = expr_alloc_symbol(&symbol_yes); | ||
| 872 | } else if (type == E_OR) { | ||
| 873 | e1 = expr_alloc_symbol(&symbol_no); | ||
| 874 | e2 = expr_alloc_symbol(&symbol_no); | ||
| 875 | } | ||
| 876 | } | ||
| 877 | #undef e1 | ||
| 878 | #undef e2 | ||
| 879 | } | ||
| 880 | |||
| 881 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym) | ||
| 882 | { | ||
| 883 | struct expr *e1, *e2; | ||
| 884 | |||
| 885 | if (!e) { | ||
| 886 | e = expr_alloc_symbol(sym); | ||
| 887 | if (type == E_UNEQUAL) | ||
| 888 | e = expr_alloc_one(E_NOT, e); | ||
| 889 | return e; | ||
| 890 | } | ||
| 891 | switch (e->type) { | ||
| 892 | case E_AND: | ||
| 893 | e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); | ||
| 894 | e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); | ||
| 895 | if (sym == &symbol_yes) | ||
| 896 | e = expr_alloc_two(E_AND, e1, e2); | ||
| 897 | if (sym == &symbol_no) | ||
| 898 | e = expr_alloc_two(E_OR, e1, e2); | ||
| 899 | if (type == E_UNEQUAL) | ||
| 900 | e = expr_alloc_one(E_NOT, e); | ||
| 901 | return e; | ||
| 902 | case E_OR: | ||
| 903 | e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); | ||
| 904 | e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); | ||
| 905 | if (sym == &symbol_yes) | ||
| 906 | e = expr_alloc_two(E_OR, e1, e2); | ||
| 907 | if (sym == &symbol_no) | ||
| 908 | e = expr_alloc_two(E_AND, e1, e2); | ||
| 909 | if (type == E_UNEQUAL) | ||
| 910 | e = expr_alloc_one(E_NOT, e); | ||
| 911 | return e; | ||
| 912 | case E_NOT: | ||
| 913 | return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym); | ||
| 914 | case E_UNEQUAL: | ||
| 915 | case E_EQUAL: | ||
| 916 | if (type == E_EQUAL) { | ||
| 917 | if (sym == &symbol_yes) | ||
| 918 | return expr_copy(e); | ||
| 919 | if (sym == &symbol_mod) | ||
| 920 | return expr_alloc_symbol(&symbol_no); | ||
| 921 | if (sym == &symbol_no) | ||
| 922 | return expr_alloc_one(E_NOT, expr_copy(e)); | ||
| 923 | } else { | ||
| 924 | if (sym == &symbol_yes) | ||
| 925 | return expr_alloc_one(E_NOT, expr_copy(e)); | ||
| 926 | if (sym == &symbol_mod) | ||
| 927 | return expr_alloc_symbol(&symbol_yes); | ||
| 928 | if (sym == &symbol_no) | ||
| 929 | return expr_copy(e); | ||
| 930 | } | ||
| 931 | break; | ||
| 932 | case E_SYMBOL: | ||
| 933 | return expr_alloc_comp(type, e->left.sym, sym); | ||
| 934 | case E_CHOICE: | ||
| 935 | case E_RANGE: | ||
| 936 | case E_NONE: | ||
| 937 | /* panic */; | ||
| 938 | } | ||
| 939 | return NULL; | ||
| 940 | } | ||
| 941 | |||
| 942 | tristate expr_calc_value(struct expr *e) | ||
| 943 | { | ||
| 944 | tristate val1, val2; | ||
| 945 | const char *str1, *str2; | ||
| 946 | |||
| 947 | if (!e) | ||
| 948 | return yes; | ||
| 949 | |||
| 950 | switch (e->type) { | ||
| 951 | case E_SYMBOL: | ||
| 952 | sym_calc_value(e->left.sym); | ||
| 953 | return e->left.sym->curr.tri; | ||
| 954 | case E_AND: | ||
| 955 | val1 = expr_calc_value(e->left.expr); | ||
| 956 | val2 = expr_calc_value(e->right.expr); | ||
| 957 | return E_AND(val1, val2); | ||
| 958 | case E_OR: | ||
| 959 | val1 = expr_calc_value(e->left.expr); | ||
| 960 | val2 = expr_calc_value(e->right.expr); | ||
| 961 | return E_OR(val1, val2); | ||
| 962 | case E_NOT: | ||
| 963 | val1 = expr_calc_value(e->left.expr); | ||
| 964 | return E_NOT(val1); | ||
| 965 | case E_EQUAL: | ||
| 966 | sym_calc_value(e->left.sym); | ||
| 967 | sym_calc_value(e->right.sym); | ||
| 968 | str1 = sym_get_string_value(e->left.sym); | ||
| 969 | str2 = sym_get_string_value(e->right.sym); | ||
| 970 | return !strcmp(str1, str2) ? yes : no; | ||
| 971 | case E_UNEQUAL: | ||
| 972 | sym_calc_value(e->left.sym); | ||
| 973 | sym_calc_value(e->right.sym); | ||
| 974 | str1 = sym_get_string_value(e->left.sym); | ||
| 975 | str2 = sym_get_string_value(e->right.sym); | ||
| 976 | return !strcmp(str1, str2) ? no : yes; | ||
| 977 | default: | ||
| 978 | printf("expr_calc_value: %d?\n", e->type); | ||
| 979 | return no; | ||
| 980 | } | ||
| 981 | } | ||
| 982 | |||
| 983 | int expr_compare_type(enum expr_type t1, enum expr_type t2) | ||
| 984 | { | ||
| 985 | #if 0 | ||
| 986 | return 1; | ||
| 987 | #else | ||
| 988 | if (t1 == t2) | ||
| 989 | return 0; | ||
| 990 | switch (t1) { | ||
| 991 | case E_EQUAL: | ||
| 992 | case E_UNEQUAL: | ||
| 993 | if (t2 == E_NOT) | ||
| 994 | return 1; | ||
| 995 | case E_NOT: | ||
| 996 | if (t2 == E_AND) | ||
| 997 | return 1; | ||
| 998 | case E_AND: | ||
| 999 | if (t2 == E_OR) | ||
| 1000 | return 1; | ||
| 1001 | case E_OR: | ||
| 1002 | if (t2 == E_CHOICE) | ||
| 1003 | return 1; | ||
| 1004 | case E_CHOICE: | ||
| 1005 | if (t2 == 0) | ||
| 1006 | return 1; | ||
| 1007 | default: | ||
| 1008 | return -1; | ||
| 1009 | } | ||
| 1010 | printf("[%dgt%d?]", t1, t2); | ||
| 1011 | return 0; | ||
| 1012 | #endif | ||
| 1013 | } | ||
| 1014 | |||
| 1015 | void expr_print(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken) | ||
| 1016 | { | ||
| 1017 | if (!e) { | ||
| 1018 | fn(data, "y"); | ||
| 1019 | return; | ||
| 1020 | } | ||
| 1021 | |||
| 1022 | if (expr_compare_type(prevtoken, e->type) > 0) | ||
| 1023 | fn(data, "("); | ||
| 1024 | switch (e->type) { | ||
| 1025 | case E_SYMBOL: | ||
| 1026 | if (e->left.sym->name) | ||
| 1027 | fn(data, e->left.sym->name); | ||
| 1028 | else | ||
| 1029 | fn(data, "<choice>"); | ||
| 1030 | break; | ||
| 1031 | case E_NOT: | ||
| 1032 | fn(data, "!"); | ||
| 1033 | expr_print(e->left.expr, fn, data, E_NOT); | ||
| 1034 | break; | ||
| 1035 | case E_EQUAL: | ||
| 1036 | fn(data, e->left.sym->name); | ||
| 1037 | fn(data, "="); | ||
| 1038 | fn(data, e->right.sym->name); | ||
| 1039 | break; | ||
| 1040 | case E_UNEQUAL: | ||
| 1041 | fn(data, e->left.sym->name); | ||
| 1042 | fn(data, "!="); | ||
| 1043 | fn(data, e->right.sym->name); | ||
| 1044 | break; | ||
| 1045 | case E_OR: | ||
| 1046 | expr_print(e->left.expr, fn, data, E_OR); | ||
| 1047 | fn(data, " || "); | ||
| 1048 | expr_print(e->right.expr, fn, data, E_OR); | ||
| 1049 | break; | ||
| 1050 | case E_AND: | ||
| 1051 | expr_print(e->left.expr, fn, data, E_AND); | ||
| 1052 | fn(data, " && "); | ||
| 1053 | expr_print(e->right.expr, fn, data, E_AND); | ||
| 1054 | break; | ||
| 1055 | case E_CHOICE: | ||
| 1056 | fn(data, e->right.sym->name); | ||
| 1057 | if (e->left.expr) { | ||
| 1058 | fn(data, " ^ "); | ||
| 1059 | expr_print(e->left.expr, fn, data, E_CHOICE); | ||
| 1060 | } | ||
| 1061 | break; | ||
| 1062 | case E_RANGE: | ||
| 1063 | fn(data, "["); | ||
| 1064 | fn(data, e->left.sym->name); | ||
| 1065 | fn(data, " "); | ||
| 1066 | fn(data, e->right.sym->name); | ||
| 1067 | fn(data, "]"); | ||
| 1068 | break; | ||
| 1069 | default: | ||
| 1070 | { | ||
| 1071 | char buf[32]; | ||
| 1072 | sprintf(buf, "<unknown type %d>", e->type); | ||
| 1073 | fn(data, buf); | ||
| 1074 | break; | ||
| 1075 | } | ||
| 1076 | } | ||
| 1077 | if (expr_compare_type(prevtoken, e->type) > 0) | ||
| 1078 | fn(data, ")"); | ||
| 1079 | } | ||
| 1080 | |||
| 1081 | static void expr_print_file_helper(void *data, const char *str) | ||
| 1082 | { | ||
| 1083 | fwrite(str, strlen(str), 1, data); | ||
| 1084 | } | ||
| 1085 | |||
| 1086 | void expr_fprint(struct expr *e, FILE *out) | ||
| 1087 | { | ||
| 1088 | expr_print(e, expr_print_file_helper, out, E_NONE); | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | static void expr_print_gstr_helper(void *data, const char *str) | ||
| 1092 | { | ||
| 1093 | str_append((struct gstr*)data, str); | ||
| 1094 | } | ||
| 1095 | |||
| 1096 | void expr_gstr_print(struct expr *e, struct gstr *gs) | ||
| 1097 | { | ||
| 1098 | expr_print(e, expr_print_gstr_helper, gs, E_NONE); | ||
| 1099 | } | ||
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h new file mode 100644 index 000000000000..7d39ff43e6e1 --- /dev/null +++ b/scripts/kconfig/expr.h | |||
| @@ -0,0 +1,195 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef EXPR_H | ||
| 7 | #define EXPR_H | ||
| 8 | |||
| 9 | #ifdef __cplusplus | ||
| 10 | extern "C" { | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #include <stdio.h> | ||
| 14 | #ifndef __cplusplus | ||
| 15 | #include <stdbool.h> | ||
| 16 | #endif | ||
| 17 | |||
| 18 | struct file { | ||
| 19 | struct file *next; | ||
| 20 | struct file *parent; | ||
| 21 | char *name; | ||
| 22 | int lineno; | ||
| 23 | int flags; | ||
| 24 | }; | ||
| 25 | |||
| 26 | #define FILE_BUSY 0x0001 | ||
| 27 | #define FILE_SCANNED 0x0002 | ||
| 28 | #define FILE_PRINTED 0x0004 | ||
| 29 | |||
| 30 | typedef enum tristate { | ||
| 31 | no, mod, yes | ||
| 32 | } tristate; | ||
| 33 | |||
| 34 | enum expr_type { | ||
| 35 | E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE | ||
| 36 | }; | ||
| 37 | |||
| 38 | union expr_data { | ||
| 39 | struct expr *expr; | ||
| 40 | struct symbol *sym; | ||
| 41 | }; | ||
| 42 | |||
| 43 | struct expr { | ||
| 44 | enum expr_type type; | ||
| 45 | union expr_data left, right; | ||
| 46 | }; | ||
| 47 | |||
| 48 | #define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2)) | ||
| 49 | #define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) | ||
| 50 | #define E_NOT(dep) (2-(dep)) | ||
| 51 | |||
| 52 | struct expr_value { | ||
| 53 | struct expr *expr; | ||
| 54 | tristate tri; | ||
| 55 | }; | ||
| 56 | |||
| 57 | struct symbol_value { | ||
| 58 | void *val; | ||
| 59 | tristate tri; | ||
| 60 | }; | ||
| 61 | |||
| 62 | enum symbol_type { | ||
| 63 | S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER | ||
| 64 | }; | ||
| 65 | |||
| 66 | struct symbol { | ||
| 67 | struct symbol *next; | ||
| 68 | char *name; | ||
| 69 | char *help; | ||
| 70 | enum symbol_type type; | ||
| 71 | struct symbol_value curr, user; | ||
| 72 | tristate visible; | ||
| 73 | int flags; | ||
| 74 | struct property *prop; | ||
| 75 | struct expr *dep, *dep2; | ||
| 76 | struct expr_value rev_dep; | ||
| 77 | }; | ||
| 78 | |||
| 79 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) | ||
| 80 | |||
| 81 | #define SYMBOL_YES 0x0001 | ||
| 82 | #define SYMBOL_MOD 0x0002 | ||
| 83 | #define SYMBOL_NO 0x0004 | ||
| 84 | #define SYMBOL_CONST 0x0007 | ||
| 85 | #define SYMBOL_CHECK 0x0008 | ||
| 86 | #define SYMBOL_CHOICE 0x0010 | ||
| 87 | #define SYMBOL_CHOICEVAL 0x0020 | ||
| 88 | #define SYMBOL_PRINTED 0x0040 | ||
| 89 | #define SYMBOL_VALID 0x0080 | ||
| 90 | #define SYMBOL_OPTIONAL 0x0100 | ||
| 91 | #define SYMBOL_WRITE 0x0200 | ||
| 92 | #define SYMBOL_CHANGED 0x0400 | ||
| 93 | #define SYMBOL_NEW 0x0800 | ||
| 94 | #define SYMBOL_AUTO 0x1000 | ||
| 95 | #define SYMBOL_CHECKED 0x2000 | ||
| 96 | #define SYMBOL_CHECK_DONE 0x4000 | ||
| 97 | #define SYMBOL_WARNED 0x8000 | ||
| 98 | |||
| 99 | #define SYMBOL_MAXLENGTH 256 | ||
| 100 | #define SYMBOL_HASHSIZE 257 | ||
| 101 | #define SYMBOL_HASHMASK 0xff | ||
| 102 | |||
| 103 | enum prop_type { | ||
| 104 | P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE | ||
| 105 | }; | ||
| 106 | |||
| 107 | struct property { | ||
| 108 | struct property *next; | ||
| 109 | struct symbol *sym; | ||
| 110 | enum prop_type type; | ||
| 111 | const char *text; | ||
| 112 | struct expr_value visible; | ||
| 113 | struct expr *expr; | ||
| 114 | struct menu *menu; | ||
| 115 | struct file *file; | ||
| 116 | int lineno; | ||
| 117 | }; | ||
| 118 | |||
| 119 | #define for_all_properties(sym, st, tok) \ | ||
| 120 | for (st = sym->prop; st; st = st->next) \ | ||
| 121 | if (st->type == (tok)) | ||
| 122 | #define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT) | ||
| 123 | #define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE) | ||
| 124 | #define for_all_prompts(sym, st) \ | ||
| 125 | for (st = sym->prop; st; st = st->next) \ | ||
| 126 | if (st->text) | ||
| 127 | |||
| 128 | struct menu { | ||
| 129 | struct menu *next; | ||
| 130 | struct menu *parent; | ||
| 131 | struct menu *list; | ||
| 132 | struct symbol *sym; | ||
| 133 | struct property *prompt; | ||
| 134 | struct expr *dep; | ||
| 135 | unsigned int flags; | ||
| 136 | //char *help; | ||
| 137 | struct file *file; | ||
| 138 | int lineno; | ||
| 139 | void *data; | ||
| 140 | }; | ||
| 141 | |||
| 142 | #define MENU_CHANGED 0x0001 | ||
| 143 | #define MENU_ROOT 0x0002 | ||
| 144 | |||
| 145 | #ifndef SWIG | ||
| 146 | |||
| 147 | extern struct file *file_list; | ||
| 148 | extern struct file *current_file; | ||
| 149 | struct file *lookup_file(const char *name); | ||
| 150 | |||
| 151 | extern struct symbol symbol_yes, symbol_no, symbol_mod; | ||
| 152 | extern struct symbol *modules_sym; | ||
| 153 | extern int cdebug; | ||
| 154 | struct expr *expr_alloc_symbol(struct symbol *sym); | ||
| 155 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); | ||
| 156 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2); | ||
| 157 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); | ||
| 158 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); | ||
| 159 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); | ||
| 160 | struct expr *expr_copy(struct expr *org); | ||
| 161 | void expr_free(struct expr *e); | ||
| 162 | int expr_eq(struct expr *e1, struct expr *e2); | ||
| 163 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); | ||
| 164 | tristate expr_calc_value(struct expr *e); | ||
| 165 | struct expr *expr_eliminate_yn(struct expr *e); | ||
| 166 | struct expr *expr_trans_bool(struct expr *e); | ||
| 167 | struct expr *expr_eliminate_dups(struct expr *e); | ||
| 168 | struct expr *expr_transform(struct expr *e); | ||
| 169 | int expr_contains_symbol(struct expr *dep, struct symbol *sym); | ||
| 170 | bool expr_depends_symbol(struct expr *dep, struct symbol *sym); | ||
| 171 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2); | ||
| 172 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); | ||
| 173 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); | ||
| 174 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); | ||
| 175 | |||
| 176 | void expr_fprint(struct expr *e, FILE *out); | ||
| 177 | struct gstr; /* forward */ | ||
| 178 | void expr_gstr_print(struct expr *e, struct gstr *gs); | ||
| 179 | |||
| 180 | static inline int expr_is_yes(struct expr *e) | ||
| 181 | { | ||
| 182 | return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); | ||
| 183 | } | ||
| 184 | |||
| 185 | static inline int expr_is_no(struct expr *e) | ||
| 186 | { | ||
| 187 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); | ||
| 188 | } | ||
| 189 | #endif | ||
| 190 | |||
| 191 | #ifdef __cplusplus | ||
| 192 | } | ||
| 193 | #endif | ||
| 194 | |||
| 195 | #endif /* EXPR_H */ | ||
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c new file mode 100644 index 000000000000..6fdbe6e3ce0d --- /dev/null +++ b/scripts/kconfig/gconf.c | |||
| @@ -0,0 +1,1639 @@ | |||
| 1 | /* Hey EMACS -*- linux-c -*- */ | ||
| 2 | /* | ||
| 3 | * | ||
| 4 | * Copyright (C) 2002-2003 Romain Lievin <roms@tilp.info> | ||
| 5 | * Released under the terms of the GNU GPL v2.0. | ||
| 6 | * | ||
| 7 | */ | ||
| 8 | |||
| 9 | #ifdef HAVE_CONFIG_H | ||
| 10 | # include <config.h> | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #include "lkc.h" | ||
| 14 | #include "images.c" | ||
| 15 | |||
| 16 | #include <glade/glade.h> | ||
| 17 | #include <gtk/gtk.h> | ||
| 18 | #include <glib.h> | ||
| 19 | #include <gdk/gdkkeysyms.h> | ||
| 20 | |||
| 21 | #include <stdio.h> | ||
| 22 | #include <string.h> | ||
| 23 | #include <unistd.h> | ||
| 24 | #include <time.h> | ||
| 25 | #include <stdlib.h> | ||
| 26 | |||
| 27 | //#define DEBUG | ||
| 28 | |||
| 29 | enum { | ||
| 30 | SINGLE_VIEW, SPLIT_VIEW, FULL_VIEW | ||
| 31 | }; | ||
| 32 | |||
| 33 | static gint view_mode = FULL_VIEW; | ||
| 34 | static gboolean show_name = TRUE; | ||
| 35 | static gboolean show_range = TRUE; | ||
| 36 | static gboolean show_value = TRUE; | ||
| 37 | static gboolean show_all = FALSE; | ||
| 38 | static gboolean show_debug = FALSE; | ||
| 39 | static gboolean resizeable = FALSE; | ||
| 40 | |||
| 41 | static gboolean config_changed = FALSE; | ||
| 42 | |||
| 43 | static char nohelp_text[] = | ||
| 44 | "Sorry, no help available for this option yet.\n"; | ||
| 45 | |||
| 46 | GtkWidget *main_wnd = NULL; | ||
| 47 | GtkWidget *tree1_w = NULL; // left frame | ||
| 48 | GtkWidget *tree2_w = NULL; // right frame | ||
| 49 | GtkWidget *text_w = NULL; | ||
| 50 | GtkWidget *hpaned = NULL; | ||
| 51 | GtkWidget *vpaned = NULL; | ||
| 52 | GtkWidget *back_btn = NULL; | ||
| 53 | |||
| 54 | GtkTextTag *tag1, *tag2; | ||
| 55 | GdkColor color; | ||
| 56 | |||
| 57 | GtkTreeStore *tree1, *tree2, *tree; | ||
| 58 | GtkTreeModel *model1, *model2; | ||
| 59 | static GtkTreeIter *parents[256]; | ||
| 60 | static gint indent; | ||
| 61 | |||
| 62 | static struct menu *current; // current node for SINGLE view | ||
| 63 | static struct menu *browsed; // browsed node for SPLIT view | ||
| 64 | |||
| 65 | enum { | ||
| 66 | COL_OPTION, COL_NAME, COL_NO, COL_MOD, COL_YES, COL_VALUE, | ||
| 67 | COL_MENU, COL_COLOR, COL_EDIT, COL_PIXBUF, | ||
| 68 | COL_PIXVIS, COL_BTNVIS, COL_BTNACT, COL_BTNINC, COL_BTNRAD, | ||
| 69 | COL_NUMBER | ||
| 70 | }; | ||
| 71 | |||
| 72 | static void display_list(void); | ||
| 73 | static void display_tree(struct menu *menu); | ||
| 74 | static void display_tree_part(void); | ||
| 75 | static void update_tree(struct menu *src, GtkTreeIter * dst); | ||
| 76 | static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row); | ||
| 77 | static gchar **fill_row(struct menu *menu); | ||
| 78 | |||
| 79 | |||
| 80 | /* Helping/Debugging Functions */ | ||
| 81 | |||
| 82 | |||
| 83 | const char *dbg_print_stype(int val) | ||
| 84 | { | ||
| 85 | static char buf[256]; | ||
| 86 | |||
| 87 | bzero(buf, 256); | ||
| 88 | |||
| 89 | if (val == S_UNKNOWN) | ||
| 90 | strcpy(buf, "unknown"); | ||
| 91 | if (val == S_BOOLEAN) | ||
| 92 | strcpy(buf, "boolean"); | ||
| 93 | if (val == S_TRISTATE) | ||
| 94 | strcpy(buf, "tristate"); | ||
| 95 | if (val == S_INT) | ||
| 96 | strcpy(buf, "int"); | ||
| 97 | if (val == S_HEX) | ||
| 98 | strcpy(buf, "hex"); | ||
| 99 | if (val == S_STRING) | ||
| 100 | strcpy(buf, "string"); | ||
| 101 | if (val == S_OTHER) | ||
| 102 | strcpy(buf, "other"); | ||
| 103 | |||
| 104 | #ifdef DEBUG | ||
| 105 | printf("%s", buf); | ||
| 106 | #endif | ||
| 107 | |||
| 108 | return buf; | ||
| 109 | } | ||
| 110 | |||
| 111 | const char *dbg_print_flags(int val) | ||
| 112 | { | ||
| 113 | static char buf[256]; | ||
| 114 | |||
| 115 | bzero(buf, 256); | ||
| 116 | |||
| 117 | if (val & SYMBOL_YES) | ||
| 118 | strcat(buf, "yes/"); | ||
| 119 | if (val & SYMBOL_MOD) | ||
| 120 | strcat(buf, "mod/"); | ||
| 121 | if (val & SYMBOL_NO) | ||
| 122 | strcat(buf, "no/"); | ||
| 123 | if (val & SYMBOL_CONST) | ||
| 124 | strcat(buf, "const/"); | ||
| 125 | if (val & SYMBOL_CHECK) | ||
| 126 | strcat(buf, "check/"); | ||
| 127 | if (val & SYMBOL_CHOICE) | ||
| 128 | strcat(buf, "choice/"); | ||
| 129 | if (val & SYMBOL_CHOICEVAL) | ||
| 130 | strcat(buf, "choiceval/"); | ||
| 131 | if (val & SYMBOL_PRINTED) | ||
| 132 | strcat(buf, "printed/"); | ||
| 133 | if (val & SYMBOL_VALID) | ||
| 134 | strcat(buf, "valid/"); | ||
| 135 | if (val & SYMBOL_OPTIONAL) | ||
| 136 | strcat(buf, "optional/"); | ||
| 137 | if (val & SYMBOL_WRITE) | ||
| 138 | strcat(buf, "write/"); | ||
| 139 | if (val & SYMBOL_CHANGED) | ||
| 140 | strcat(buf, "changed/"); | ||
| 141 | if (val & SYMBOL_NEW) | ||
| 142 | strcat(buf, "new/"); | ||
| 143 | if (val & SYMBOL_AUTO) | ||
| 144 | strcat(buf, "auto/"); | ||
| 145 | |||
| 146 | buf[strlen(buf) - 1] = '\0'; | ||
| 147 | #ifdef DEBUG | ||
| 148 | printf("%s", buf); | ||
| 149 | #endif | ||
| 150 | |||
| 151 | return buf; | ||
| 152 | } | ||
| 153 | |||
| 154 | const char *dbg_print_ptype(int val) | ||
| 155 | { | ||
| 156 | static char buf[256]; | ||
| 157 | |||
| 158 | bzero(buf, 256); | ||
| 159 | |||
| 160 | if (val == P_UNKNOWN) | ||
| 161 | strcpy(buf, "unknown"); | ||
| 162 | if (val == P_PROMPT) | ||
| 163 | strcpy(buf, "prompt"); | ||
| 164 | if (val == P_COMMENT) | ||
| 165 | strcpy(buf, "comment"); | ||
| 166 | if (val == P_MENU) | ||
| 167 | strcpy(buf, "menu"); | ||
| 168 | if (val == P_DEFAULT) | ||
| 169 | strcpy(buf, "default"); | ||
| 170 | if (val == P_CHOICE) | ||
| 171 | strcpy(buf, "choice"); | ||
| 172 | |||
| 173 | #ifdef DEBUG | ||
| 174 | printf("%s", buf); | ||
| 175 | #endif | ||
| 176 | |||
| 177 | return buf; | ||
| 178 | } | ||
| 179 | |||
| 180 | |||
| 181 | /* Main Window Initialization */ | ||
| 182 | |||
| 183 | |||
| 184 | void init_main_window(const gchar * glade_file) | ||
| 185 | { | ||
| 186 | GladeXML *xml; | ||
| 187 | GtkWidget *widget; | ||
| 188 | GtkTextBuffer *txtbuf; | ||
| 189 | char title[256]; | ||
| 190 | GdkPixmap *pixmap; | ||
| 191 | GdkBitmap *mask; | ||
| 192 | GtkStyle *style; | ||
| 193 | |||
| 194 | xml = glade_xml_new(glade_file, "window1", NULL); | ||
| 195 | if (!xml) | ||
| 196 | g_error("GUI loading failed !\n"); | ||
| 197 | glade_xml_signal_autoconnect(xml); | ||
| 198 | |||
| 199 | main_wnd = glade_xml_get_widget(xml, "window1"); | ||
| 200 | hpaned = glade_xml_get_widget(xml, "hpaned1"); | ||
| 201 | vpaned = glade_xml_get_widget(xml, "vpaned1"); | ||
| 202 | tree1_w = glade_xml_get_widget(xml, "treeview1"); | ||
| 203 | tree2_w = glade_xml_get_widget(xml, "treeview2"); | ||
| 204 | text_w = glade_xml_get_widget(xml, "textview3"); | ||
| 205 | |||
| 206 | back_btn = glade_xml_get_widget(xml, "button1"); | ||
| 207 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
| 208 | |||
| 209 | widget = glade_xml_get_widget(xml, "show_name1"); | ||
| 210 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
| 211 | show_name); | ||
| 212 | |||
| 213 | widget = glade_xml_get_widget(xml, "show_range1"); | ||
| 214 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
| 215 | show_range); | ||
| 216 | |||
| 217 | widget = glade_xml_get_widget(xml, "show_data1"); | ||
| 218 | gtk_check_menu_item_set_active((GtkCheckMenuItem *) widget, | ||
| 219 | show_value); | ||
| 220 | |||
| 221 | style = gtk_widget_get_style(main_wnd); | ||
| 222 | widget = glade_xml_get_widget(xml, "toolbar1"); | ||
| 223 | |||
| 224 | pixmap = gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask, | ||
| 225 | &style->bg[GTK_STATE_NORMAL], | ||
| 226 | (gchar **) xpm_single_view); | ||
| 227 | gtk_image_set_from_pixmap(GTK_IMAGE | ||
| 228 | (((GtkToolbarChild | ||
| 229 | *) (g_list_nth(GTK_TOOLBAR(widget)-> | ||
| 230 | children, | ||
| 231 | 5)->data))->icon), | ||
| 232 | pixmap, mask); | ||
| 233 | pixmap = | ||
| 234 | gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask, | ||
| 235 | &style->bg[GTK_STATE_NORMAL], | ||
| 236 | (gchar **) xpm_split_view); | ||
| 237 | gtk_image_set_from_pixmap(GTK_IMAGE | ||
| 238 | (((GtkToolbarChild | ||
| 239 | *) (g_list_nth(GTK_TOOLBAR(widget)-> | ||
| 240 | children, | ||
| 241 | 6)->data))->icon), | ||
| 242 | pixmap, mask); | ||
| 243 | pixmap = | ||
| 244 | gdk_pixmap_create_from_xpm_d(main_wnd->window, &mask, | ||
| 245 | &style->bg[GTK_STATE_NORMAL], | ||
| 246 | (gchar **) xpm_tree_view); | ||
| 247 | gtk_image_set_from_pixmap(GTK_IMAGE | ||
| 248 | (((GtkToolbarChild | ||
| 249 | *) (g_list_nth(GTK_TOOLBAR(widget)-> | ||
| 250 | children, | ||
| 251 | 7)->data))->icon), | ||
| 252 | pixmap, mask); | ||
| 253 | |||
| 254 | switch (view_mode) { | ||
| 255 | case SINGLE_VIEW: | ||
| 256 | widget = glade_xml_get_widget(xml, "button4"); | ||
| 257 | g_signal_emit_by_name(widget, "clicked"); | ||
| 258 | break; | ||
| 259 | case SPLIT_VIEW: | ||
| 260 | widget = glade_xml_get_widget(xml, "button5"); | ||
| 261 | g_signal_emit_by_name(widget, "clicked"); | ||
| 262 | break; | ||
| 263 | case FULL_VIEW: | ||
| 264 | widget = glade_xml_get_widget(xml, "button6"); | ||
| 265 | g_signal_emit_by_name(widget, "clicked"); | ||
| 266 | break; | ||
| 267 | } | ||
| 268 | |||
| 269 | txtbuf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | ||
| 270 | tag1 = gtk_text_buffer_create_tag(txtbuf, "mytag1", | ||
| 271 | "foreground", "red", | ||
| 272 | "weight", PANGO_WEIGHT_BOLD, | ||
| 273 | NULL); | ||
| 274 | tag2 = gtk_text_buffer_create_tag(txtbuf, "mytag2", | ||
| 275 | /*"style", PANGO_STYLE_OBLIQUE, */ | ||
| 276 | NULL); | ||
| 277 | |||
| 278 | sprintf(title, "Linux Kernel v%s Configuration", | ||
| 279 | getenv("KERNELRELEASE")); | ||
| 280 | gtk_window_set_title(GTK_WINDOW(main_wnd), title); | ||
| 281 | |||
| 282 | gtk_widget_show(main_wnd); | ||
| 283 | } | ||
| 284 | |||
| 285 | void init_tree_model(void) | ||
| 286 | { | ||
| 287 | gint i; | ||
| 288 | |||
| 289 | tree = tree2 = gtk_tree_store_new(COL_NUMBER, | ||
| 290 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 291 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 292 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 293 | G_TYPE_POINTER, GDK_TYPE_COLOR, | ||
| 294 | G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, | ||
| 295 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 296 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 297 | G_TYPE_BOOLEAN); | ||
| 298 | model2 = GTK_TREE_MODEL(tree2); | ||
| 299 | |||
| 300 | for (parents[0] = NULL, i = 1; i < 256; i++) | ||
| 301 | parents[i] = (GtkTreeIter *) g_malloc(sizeof(GtkTreeIter)); | ||
| 302 | |||
| 303 | tree1 = gtk_tree_store_new(COL_NUMBER, | ||
| 304 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 305 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 306 | G_TYPE_STRING, G_TYPE_STRING, | ||
| 307 | G_TYPE_POINTER, GDK_TYPE_COLOR, | ||
| 308 | G_TYPE_BOOLEAN, GDK_TYPE_PIXBUF, | ||
| 309 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 310 | G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, | ||
| 311 | G_TYPE_BOOLEAN); | ||
| 312 | model1 = GTK_TREE_MODEL(tree1); | ||
| 313 | } | ||
| 314 | |||
| 315 | void init_left_tree(void) | ||
| 316 | { | ||
| 317 | GtkTreeView *view = GTK_TREE_VIEW(tree1_w); | ||
| 318 | GtkCellRenderer *renderer; | ||
| 319 | GtkTreeSelection *sel; | ||
| 320 | GtkTreeViewColumn *column; | ||
| 321 | |||
| 322 | gtk_tree_view_set_model(view, model1); | ||
| 323 | gtk_tree_view_set_headers_visible(view, TRUE); | ||
| 324 | gtk_tree_view_set_rules_hint(view, FALSE); | ||
| 325 | |||
| 326 | column = gtk_tree_view_column_new(); | ||
| 327 | gtk_tree_view_append_column(view, column); | ||
| 328 | gtk_tree_view_column_set_title(column, "Options"); | ||
| 329 | |||
| 330 | renderer = gtk_cell_renderer_toggle_new(); | ||
| 331 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 332 | renderer, FALSE); | ||
| 333 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 334 | renderer, | ||
| 335 | "active", COL_BTNACT, | ||
| 336 | "inconsistent", COL_BTNINC, | ||
| 337 | "visible", COL_BTNVIS, | ||
| 338 | "radio", COL_BTNRAD, NULL); | ||
| 339 | renderer = gtk_cell_renderer_text_new(); | ||
| 340 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 341 | renderer, FALSE); | ||
| 342 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 343 | renderer, | ||
| 344 | "text", COL_OPTION, | ||
| 345 | "foreground-gdk", | ||
| 346 | COL_COLOR, NULL); | ||
| 347 | |||
| 348 | sel = gtk_tree_view_get_selection(view); | ||
| 349 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | ||
| 350 | gtk_widget_realize(tree1_w); | ||
| 351 | } | ||
| 352 | |||
| 353 | static void renderer_edited(GtkCellRendererText * cell, | ||
| 354 | const gchar * path_string, | ||
| 355 | const gchar * new_text, gpointer user_data); | ||
| 356 | static void renderer_toggled(GtkCellRendererToggle * cellrenderertoggle, | ||
| 357 | gchar * arg1, gpointer user_data); | ||
| 358 | |||
| 359 | void init_right_tree(void) | ||
| 360 | { | ||
| 361 | GtkTreeView *view = GTK_TREE_VIEW(tree2_w); | ||
| 362 | GtkCellRenderer *renderer; | ||
| 363 | GtkTreeSelection *sel; | ||
| 364 | GtkTreeViewColumn *column; | ||
| 365 | gint i; | ||
| 366 | |||
| 367 | gtk_tree_view_set_model(view, model2); | ||
| 368 | gtk_tree_view_set_headers_visible(view, TRUE); | ||
| 369 | gtk_tree_view_set_rules_hint(view, FALSE); | ||
| 370 | |||
| 371 | column = gtk_tree_view_column_new(); | ||
| 372 | gtk_tree_view_append_column(view, column); | ||
| 373 | gtk_tree_view_column_set_title(column, "Options"); | ||
| 374 | |||
| 375 | renderer = gtk_cell_renderer_pixbuf_new(); | ||
| 376 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 377 | renderer, FALSE); | ||
| 378 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 379 | renderer, | ||
| 380 | "pixbuf", COL_PIXBUF, | ||
| 381 | "visible", COL_PIXVIS, NULL); | ||
| 382 | renderer = gtk_cell_renderer_toggle_new(); | ||
| 383 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 384 | renderer, FALSE); | ||
| 385 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 386 | renderer, | ||
| 387 | "active", COL_BTNACT, | ||
| 388 | "inconsistent", COL_BTNINC, | ||
| 389 | "visible", COL_BTNVIS, | ||
| 390 | "radio", COL_BTNRAD, NULL); | ||
| 391 | /*g_signal_connect(G_OBJECT(renderer), "toggled", | ||
| 392 | G_CALLBACK(renderer_toggled), NULL); */ | ||
| 393 | renderer = gtk_cell_renderer_text_new(); | ||
| 394 | gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), | ||
| 395 | renderer, FALSE); | ||
| 396 | gtk_tree_view_column_set_attributes(GTK_TREE_VIEW_COLUMN(column), | ||
| 397 | renderer, | ||
| 398 | "text", COL_OPTION, | ||
| 399 | "foreground-gdk", | ||
| 400 | COL_COLOR, NULL); | ||
| 401 | |||
| 402 | renderer = gtk_cell_renderer_text_new(); | ||
| 403 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 404 | "Name", renderer, | ||
| 405 | "text", COL_NAME, | ||
| 406 | "foreground-gdk", | ||
| 407 | COL_COLOR, NULL); | ||
| 408 | renderer = gtk_cell_renderer_text_new(); | ||
| 409 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 410 | "N", renderer, | ||
| 411 | "text", COL_NO, | ||
| 412 | "foreground-gdk", | ||
| 413 | COL_COLOR, NULL); | ||
| 414 | renderer = gtk_cell_renderer_text_new(); | ||
| 415 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 416 | "M", renderer, | ||
| 417 | "text", COL_MOD, | ||
| 418 | "foreground-gdk", | ||
| 419 | COL_COLOR, NULL); | ||
| 420 | renderer = gtk_cell_renderer_text_new(); | ||
| 421 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 422 | "Y", renderer, | ||
| 423 | "text", COL_YES, | ||
| 424 | "foreground-gdk", | ||
| 425 | COL_COLOR, NULL); | ||
| 426 | renderer = gtk_cell_renderer_text_new(); | ||
| 427 | gtk_tree_view_insert_column_with_attributes(view, -1, | ||
| 428 | "Value", renderer, | ||
| 429 | "text", COL_VALUE, | ||
| 430 | "editable", | ||
| 431 | COL_EDIT, | ||
| 432 | "foreground-gdk", | ||
| 433 | COL_COLOR, NULL); | ||
| 434 | g_signal_connect(G_OBJECT(renderer), "edited", | ||
| 435 | G_CALLBACK(renderer_edited), NULL); | ||
| 436 | |||
| 437 | column = gtk_tree_view_get_column(view, COL_NAME); | ||
| 438 | gtk_tree_view_column_set_visible(column, show_name); | ||
| 439 | column = gtk_tree_view_get_column(view, COL_NO); | ||
| 440 | gtk_tree_view_column_set_visible(column, show_range); | ||
| 441 | column = gtk_tree_view_get_column(view, COL_MOD); | ||
| 442 | gtk_tree_view_column_set_visible(column, show_range); | ||
| 443 | column = gtk_tree_view_get_column(view, COL_YES); | ||
| 444 | gtk_tree_view_column_set_visible(column, show_range); | ||
| 445 | column = gtk_tree_view_get_column(view, COL_VALUE); | ||
| 446 | gtk_tree_view_column_set_visible(column, show_value); | ||
| 447 | |||
| 448 | if (resizeable) { | ||
| 449 | for (i = 0; i < COL_VALUE; i++) { | ||
| 450 | column = gtk_tree_view_get_column(view, i); | ||
| 451 | gtk_tree_view_column_set_resizable(column, TRUE); | ||
| 452 | } | ||
| 453 | } | ||
| 454 | |||
| 455 | sel = gtk_tree_view_get_selection(view); | ||
| 456 | gtk_tree_selection_set_mode(sel, GTK_SELECTION_SINGLE); | ||
| 457 | } | ||
| 458 | |||
| 459 | |||
| 460 | /* Utility Functions */ | ||
| 461 | |||
| 462 | |||
| 463 | static void text_insert_help(struct menu *menu) | ||
| 464 | { | ||
| 465 | GtkTextBuffer *buffer; | ||
| 466 | GtkTextIter start, end; | ||
| 467 | const char *prompt = menu_get_prompt(menu); | ||
| 468 | gchar *name; | ||
| 469 | const char *help = nohelp_text; | ||
| 470 | |||
| 471 | if (!menu->sym) | ||
| 472 | help = ""; | ||
| 473 | else if (menu->sym->help) | ||
| 474 | help = menu->sym->help; | ||
| 475 | |||
| 476 | if (menu->sym && menu->sym->name) | ||
| 477 | name = g_strdup_printf(menu->sym->name); | ||
| 478 | else | ||
| 479 | name = g_strdup(""); | ||
| 480 | |||
| 481 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | ||
| 482 | gtk_text_buffer_get_bounds(buffer, &start, &end); | ||
| 483 | gtk_text_buffer_delete(buffer, &start, &end); | ||
| 484 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); | ||
| 485 | |||
| 486 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
| 487 | gtk_text_buffer_insert_with_tags(buffer, &end, prompt, -1, tag1, | ||
| 488 | NULL); | ||
| 489 | gtk_text_buffer_insert_at_cursor(buffer, " ", 1); | ||
| 490 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
| 491 | gtk_text_buffer_insert_with_tags(buffer, &end, name, -1, tag1, | ||
| 492 | NULL); | ||
| 493 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | ||
| 494 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
| 495 | gtk_text_buffer_insert_with_tags(buffer, &end, help, -1, tag2, | ||
| 496 | NULL); | ||
| 497 | } | ||
| 498 | |||
| 499 | |||
| 500 | static void text_insert_msg(const char *title, const char *message) | ||
| 501 | { | ||
| 502 | GtkTextBuffer *buffer; | ||
| 503 | GtkTextIter start, end; | ||
| 504 | const char *msg = message; | ||
| 505 | |||
| 506 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text_w)); | ||
| 507 | gtk_text_buffer_get_bounds(buffer, &start, &end); | ||
| 508 | gtk_text_buffer_delete(buffer, &start, &end); | ||
| 509 | gtk_text_view_set_left_margin(GTK_TEXT_VIEW(text_w), 15); | ||
| 510 | |||
| 511 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
| 512 | gtk_text_buffer_insert_with_tags(buffer, &end, title, -1, tag1, | ||
| 513 | NULL); | ||
| 514 | gtk_text_buffer_insert_at_cursor(buffer, "\n\n", 2); | ||
| 515 | gtk_text_buffer_get_end_iter(buffer, &end); | ||
| 516 | gtk_text_buffer_insert_with_tags(buffer, &end, msg, -1, tag2, | ||
| 517 | NULL); | ||
| 518 | } | ||
| 519 | |||
| 520 | |||
| 521 | /* Main Windows Callbacks */ | ||
| 522 | |||
| 523 | void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data); | ||
| 524 | gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, | ||
| 525 | gpointer user_data) | ||
| 526 | { | ||
| 527 | GtkWidget *dialog, *label; | ||
| 528 | gint result; | ||
| 529 | |||
| 530 | if (config_changed == FALSE) | ||
| 531 | return FALSE; | ||
| 532 | |||
| 533 | dialog = gtk_dialog_new_with_buttons("Warning !", | ||
| 534 | GTK_WINDOW(main_wnd), | ||
| 535 | (GtkDialogFlags) | ||
| 536 | (GTK_DIALOG_MODAL | | ||
| 537 | GTK_DIALOG_DESTROY_WITH_PARENT), | ||
| 538 | GTK_STOCK_OK, | ||
| 539 | GTK_RESPONSE_YES, | ||
| 540 | GTK_STOCK_NO, | ||
| 541 | GTK_RESPONSE_NO, | ||
| 542 | GTK_STOCK_CANCEL, | ||
| 543 | GTK_RESPONSE_CANCEL, NULL); | ||
| 544 | gtk_dialog_set_default_response(GTK_DIALOG(dialog), | ||
| 545 | GTK_RESPONSE_CANCEL); | ||
| 546 | |||
| 547 | label = gtk_label_new("\nSave configuration ?\n"); | ||
| 548 | gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); | ||
| 549 | gtk_widget_show(label); | ||
| 550 | |||
| 551 | result = gtk_dialog_run(GTK_DIALOG(dialog)); | ||
| 552 | switch (result) { | ||
| 553 | case GTK_RESPONSE_YES: | ||
| 554 | on_save1_activate(NULL, NULL); | ||
| 555 | return FALSE; | ||
| 556 | case GTK_RESPONSE_NO: | ||
| 557 | return FALSE; | ||
| 558 | case GTK_RESPONSE_CANCEL: | ||
| 559 | case GTK_RESPONSE_DELETE_EVENT: | ||
| 560 | default: | ||
| 561 | gtk_widget_destroy(dialog); | ||
| 562 | return TRUE; | ||
| 563 | } | ||
| 564 | |||
| 565 | return FALSE; | ||
| 566 | } | ||
| 567 | |||
| 568 | |||
| 569 | void on_window1_destroy(GtkObject * object, gpointer user_data) | ||
| 570 | { | ||
| 571 | gtk_main_quit(); | ||
| 572 | } | ||
| 573 | |||
| 574 | |||
| 575 | void | ||
| 576 | on_window1_size_request(GtkWidget * widget, | ||
| 577 | GtkRequisition * requisition, gpointer user_data) | ||
| 578 | { | ||
| 579 | static gint old_h; | ||
| 580 | gint w, h; | ||
| 581 | |||
| 582 | if (widget->window == NULL) | ||
| 583 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); | ||
| 584 | else | ||
| 585 | gdk_window_get_size(widget->window, &w, &h); | ||
| 586 | |||
| 587 | if (h == old_h) | ||
| 588 | return; | ||
| 589 | old_h = h; | ||
| 590 | |||
| 591 | gtk_paned_set_position(GTK_PANED(vpaned), 2 * h / 3); | ||
| 592 | } | ||
| 593 | |||
| 594 | |||
| 595 | /* Menu & Toolbar Callbacks */ | ||
| 596 | |||
| 597 | |||
| 598 | static void | ||
| 599 | load_filename(GtkFileSelection * file_selector, gpointer user_data) | ||
| 600 | { | ||
| 601 | const gchar *fn; | ||
| 602 | |||
| 603 | fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION | ||
| 604 | (user_data)); | ||
| 605 | |||
| 606 | if (conf_read(fn)) | ||
| 607 | text_insert_msg("Error", "Unable to load configuration !"); | ||
| 608 | else | ||
| 609 | display_tree(&rootmenu); | ||
| 610 | } | ||
| 611 | |||
| 612 | void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 613 | { | ||
| 614 | GtkWidget *fs; | ||
| 615 | |||
| 616 | fs = gtk_file_selection_new("Load file..."); | ||
| 617 | g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), | ||
| 618 | "clicked", | ||
| 619 | G_CALLBACK(load_filename), (gpointer) fs); | ||
| 620 | g_signal_connect_swapped(GTK_OBJECT | ||
| 621 | (GTK_FILE_SELECTION(fs)->ok_button), | ||
| 622 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
| 623 | (gpointer) fs); | ||
| 624 | g_signal_connect_swapped(GTK_OBJECT | ||
| 625 | (GTK_FILE_SELECTION(fs)->cancel_button), | ||
| 626 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
| 627 | (gpointer) fs); | ||
| 628 | gtk_widget_show(fs); | ||
| 629 | } | ||
| 630 | |||
| 631 | |||
| 632 | void on_save1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 633 | { | ||
| 634 | if (conf_write(NULL)) | ||
| 635 | text_insert_msg("Error", "Unable to save configuration !"); | ||
| 636 | |||
| 637 | config_changed = FALSE; | ||
| 638 | } | ||
| 639 | |||
| 640 | |||
| 641 | static void | ||
| 642 | store_filename(GtkFileSelection * file_selector, gpointer user_data) | ||
| 643 | { | ||
| 644 | const gchar *fn; | ||
| 645 | |||
| 646 | fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION | ||
| 647 | (user_data)); | ||
| 648 | |||
| 649 | if (conf_write(fn)) | ||
| 650 | text_insert_msg("Error", "Unable to save configuration !"); | ||
| 651 | |||
| 652 | gtk_widget_destroy(GTK_WIDGET(user_data)); | ||
| 653 | } | ||
| 654 | |||
| 655 | void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 656 | { | ||
| 657 | GtkWidget *fs; | ||
| 658 | |||
| 659 | fs = gtk_file_selection_new("Save file as..."); | ||
| 660 | g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), | ||
| 661 | "clicked", | ||
| 662 | G_CALLBACK(store_filename), (gpointer) fs); | ||
| 663 | g_signal_connect_swapped(GTK_OBJECT | ||
| 664 | (GTK_FILE_SELECTION(fs)->ok_button), | ||
| 665 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
| 666 | (gpointer) fs); | ||
| 667 | g_signal_connect_swapped(GTK_OBJECT | ||
| 668 | (GTK_FILE_SELECTION(fs)->cancel_button), | ||
| 669 | "clicked", G_CALLBACK(gtk_widget_destroy), | ||
| 670 | (gpointer) fs); | ||
| 671 | gtk_widget_show(fs); | ||
| 672 | } | ||
| 673 | |||
| 674 | |||
| 675 | void on_quit1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 676 | { | ||
| 677 | if (!on_window1_delete_event(NULL, NULL, NULL)) | ||
| 678 | gtk_widget_destroy(GTK_WIDGET(main_wnd)); | ||
| 679 | } | ||
| 680 | |||
| 681 | |||
| 682 | void on_show_name1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 683 | { | ||
| 684 | GtkTreeViewColumn *col; | ||
| 685 | |||
| 686 | show_name = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
| 687 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NAME); | ||
| 688 | if (col) | ||
| 689 | gtk_tree_view_column_set_visible(col, show_name); | ||
| 690 | } | ||
| 691 | |||
| 692 | |||
| 693 | void on_show_range1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 694 | { | ||
| 695 | GtkTreeViewColumn *col; | ||
| 696 | |||
| 697 | show_range = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
| 698 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_NO); | ||
| 699 | if (col) | ||
| 700 | gtk_tree_view_column_set_visible(col, show_range); | ||
| 701 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_MOD); | ||
| 702 | if (col) | ||
| 703 | gtk_tree_view_column_set_visible(col, show_range); | ||
| 704 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_YES); | ||
| 705 | if (col) | ||
| 706 | gtk_tree_view_column_set_visible(col, show_range); | ||
| 707 | |||
| 708 | } | ||
| 709 | |||
| 710 | |||
| 711 | void on_show_data1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 712 | { | ||
| 713 | GtkTreeViewColumn *col; | ||
| 714 | |||
| 715 | show_value = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
| 716 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), COL_VALUE); | ||
| 717 | if (col) | ||
| 718 | gtk_tree_view_column_set_visible(col, show_value); | ||
| 719 | } | ||
| 720 | |||
| 721 | |||
| 722 | void | ||
| 723 | on_show_all_options1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 724 | { | ||
| 725 | show_all = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
| 726 | |||
| 727 | gtk_tree_store_clear(tree2); | ||
| 728 | display_tree(&rootmenu); // instead of update_tree to speed-up | ||
| 729 | } | ||
| 730 | |||
| 731 | |||
| 732 | void | ||
| 733 | on_show_debug_info1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 734 | { | ||
| 735 | show_debug = GTK_CHECK_MENU_ITEM(menuitem)->active; | ||
| 736 | update_tree(&rootmenu, NULL); | ||
| 737 | } | ||
| 738 | |||
| 739 | |||
| 740 | void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 741 | { | ||
| 742 | GtkWidget *dialog; | ||
| 743 | const gchar *intro_text = | ||
| 744 | "Welcome to gkc, the GTK+ graphical kernel configuration tool\n" | ||
| 745 | "for Linux.\n" | ||
| 746 | "For each option, a blank box indicates the feature is disabled, a\n" | ||
| 747 | "check indicates it is enabled, and a dot indicates that it is to\n" | ||
| 748 | "be compiled as a module. Clicking on the box will cycle through the three states.\n" | ||
| 749 | "\n" | ||
| 750 | "If you do not see an option (e.g., a device driver) that you\n" | ||
| 751 | "believe should be present, try turning on Show All Options\n" | ||
| 752 | "under the Options menu.\n" | ||
| 753 | "Although there is no cross reference yet to help you figure out\n" | ||
| 754 | "what other options must be enabled to support the option you\n" | ||
| 755 | "are interested in, you can still view the help of a grayed-out\n" | ||
| 756 | "option.\n" | ||
| 757 | "\n" | ||
| 758 | "Toggling Show Debug Info under the Options menu will show \n" | ||
| 759 | "the dependencies, which you can then match by examining other options."; | ||
| 760 | |||
| 761 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), | ||
| 762 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
| 763 | GTK_MESSAGE_INFO, | ||
| 764 | GTK_BUTTONS_CLOSE, intro_text); | ||
| 765 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | ||
| 766 | G_CALLBACK(gtk_widget_destroy), | ||
| 767 | GTK_OBJECT(dialog)); | ||
| 768 | gtk_widget_show_all(dialog); | ||
| 769 | } | ||
| 770 | |||
| 771 | |||
| 772 | void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 773 | { | ||
| 774 | GtkWidget *dialog; | ||
| 775 | const gchar *about_text = | ||
| 776 | "gkc is copyright (c) 2002 Romain Lievin <roms@lpg.ticalc.org>.\n" | ||
| 777 | "Based on the source code from Roman Zippel.\n"; | ||
| 778 | |||
| 779 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), | ||
| 780 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
| 781 | GTK_MESSAGE_INFO, | ||
| 782 | GTK_BUTTONS_CLOSE, about_text); | ||
| 783 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | ||
| 784 | G_CALLBACK(gtk_widget_destroy), | ||
| 785 | GTK_OBJECT(dialog)); | ||
| 786 | gtk_widget_show_all(dialog); | ||
| 787 | } | ||
| 788 | |||
| 789 | |||
| 790 | void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data) | ||
| 791 | { | ||
| 792 | GtkWidget *dialog; | ||
| 793 | const gchar *license_text = | ||
| 794 | "gkc is released under the terms of the GNU GPL v2.\n" | ||
| 795 | "For more information, please see the source code or\n" | ||
| 796 | "visit http://www.fsf.org/licenses/licenses.html\n"; | ||
| 797 | |||
| 798 | dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), | ||
| 799 | GTK_DIALOG_DESTROY_WITH_PARENT, | ||
| 800 | GTK_MESSAGE_INFO, | ||
| 801 | GTK_BUTTONS_CLOSE, license_text); | ||
| 802 | g_signal_connect_swapped(GTK_OBJECT(dialog), "response", | ||
| 803 | G_CALLBACK(gtk_widget_destroy), | ||
| 804 | GTK_OBJECT(dialog)); | ||
| 805 | gtk_widget_show_all(dialog); | ||
| 806 | } | ||
| 807 | |||
| 808 | |||
| 809 | void on_back_pressed(GtkButton * button, gpointer user_data) | ||
| 810 | { | ||
| 811 | enum prop_type ptype; | ||
| 812 | |||
| 813 | current = current->parent; | ||
| 814 | ptype = current->prompt ? current->prompt->type : P_UNKNOWN; | ||
| 815 | if (ptype != P_MENU) | ||
| 816 | current = current->parent; | ||
| 817 | display_tree_part(); | ||
| 818 | |||
| 819 | if (current == &rootmenu) | ||
| 820 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
| 821 | } | ||
| 822 | |||
| 823 | |||
| 824 | void on_load_pressed(GtkButton * button, gpointer user_data) | ||
| 825 | { | ||
| 826 | on_load1_activate(NULL, user_data); | ||
| 827 | } | ||
| 828 | |||
| 829 | |||
| 830 | void on_save_pressed(GtkButton * button, gpointer user_data) | ||
| 831 | { | ||
| 832 | on_save1_activate(NULL, user_data); | ||
| 833 | } | ||
| 834 | |||
| 835 | |||
| 836 | void on_single_clicked(GtkButton * button, gpointer user_data) | ||
| 837 | { | ||
| 838 | view_mode = SINGLE_VIEW; | ||
| 839 | gtk_paned_set_position(GTK_PANED(hpaned), 0); | ||
| 840 | gtk_widget_hide(tree1_w); | ||
| 841 | current = &rootmenu; | ||
| 842 | display_tree_part(); | ||
| 843 | } | ||
| 844 | |||
| 845 | |||
| 846 | void on_split_clicked(GtkButton * button, gpointer user_data) | ||
| 847 | { | ||
| 848 | gint w, h; | ||
| 849 | view_mode = SPLIT_VIEW; | ||
| 850 | gtk_widget_show(tree1_w); | ||
| 851 | gtk_window_get_default_size(GTK_WINDOW(main_wnd), &w, &h); | ||
| 852 | gtk_paned_set_position(GTK_PANED(hpaned), w / 2); | ||
| 853 | if (tree2) | ||
| 854 | gtk_tree_store_clear(tree2); | ||
| 855 | display_list(); | ||
| 856 | } | ||
| 857 | |||
| 858 | |||
| 859 | void on_full_clicked(GtkButton * button, gpointer user_data) | ||
| 860 | { | ||
| 861 | view_mode = FULL_VIEW; | ||
| 862 | gtk_paned_set_position(GTK_PANED(hpaned), 0); | ||
| 863 | gtk_widget_hide(tree1_w); | ||
| 864 | if (tree2) | ||
| 865 | gtk_tree_store_clear(tree2); | ||
| 866 | display_tree(&rootmenu); | ||
| 867 | gtk_widget_set_sensitive(back_btn, FALSE); | ||
| 868 | } | ||
| 869 | |||
| 870 | |||
| 871 | void on_collapse_pressed(GtkButton * button, gpointer user_data) | ||
| 872 | { | ||
| 873 | gtk_tree_view_collapse_all(GTK_TREE_VIEW(tree2_w)); | ||
| 874 | } | ||
| 875 | |||
| 876 | |||
| 877 | void on_expand_pressed(GtkButton * button, gpointer user_data) | ||
| 878 | { | ||
| 879 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | ||
| 880 | } | ||
| 881 | |||
| 882 | |||
| 883 | /* CTree Callbacks */ | ||
| 884 | |||
| 885 | /* Change hex/int/string value in the cell */ | ||
| 886 | static void renderer_edited(GtkCellRendererText * cell, | ||
| 887 | const gchar * path_string, | ||
| 888 | const gchar * new_text, gpointer user_data) | ||
| 889 | { | ||
| 890 | GtkTreePath *path = gtk_tree_path_new_from_string(path_string); | ||
| 891 | GtkTreeIter iter; | ||
| 892 | const char *old_def, *new_def; | ||
| 893 | struct menu *menu; | ||
| 894 | struct symbol *sym; | ||
| 895 | |||
| 896 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | ||
| 897 | return; | ||
| 898 | |||
| 899 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
| 900 | sym = menu->sym; | ||
| 901 | |||
| 902 | gtk_tree_model_get(model2, &iter, COL_VALUE, &old_def, -1); | ||
| 903 | new_def = new_text; | ||
| 904 | |||
| 905 | sym_set_string_value(sym, new_def); | ||
| 906 | |||
| 907 | config_changed = TRUE; | ||
| 908 | update_tree(&rootmenu, NULL); | ||
| 909 | |||
| 910 | gtk_tree_path_free(path); | ||
| 911 | } | ||
| 912 | |||
| 913 | /* Change the value of a symbol and update the tree */ | ||
| 914 | static void change_sym_value(struct menu *menu, gint col) | ||
| 915 | { | ||
| 916 | struct symbol *sym = menu->sym; | ||
| 917 | tristate oldval, newval; | ||
| 918 | |||
| 919 | if (!sym) | ||
| 920 | return; | ||
| 921 | |||
| 922 | if (col == COL_NO) | ||
| 923 | newval = no; | ||
| 924 | else if (col == COL_MOD) | ||
| 925 | newval = mod; | ||
| 926 | else if (col == COL_YES) | ||
| 927 | newval = yes; | ||
| 928 | else | ||
| 929 | return; | ||
| 930 | |||
| 931 | switch (sym_get_type(sym)) { | ||
| 932 | case S_BOOLEAN: | ||
| 933 | case S_TRISTATE: | ||
| 934 | oldval = sym_get_tristate_value(sym); | ||
| 935 | if (!sym_tristate_within_range(sym, newval)) | ||
| 936 | newval = yes; | ||
| 937 | sym_set_tristate_value(sym, newval); | ||
| 938 | config_changed = TRUE; | ||
| 939 | if (view_mode == FULL_VIEW) | ||
| 940 | update_tree(&rootmenu, NULL); | ||
| 941 | else if (view_mode == SPLIT_VIEW) { | ||
| 942 | update_tree(browsed, NULL); | ||
| 943 | display_list(); | ||
| 944 | } | ||
| 945 | else if (view_mode == SINGLE_VIEW) | ||
| 946 | display_tree_part(); //fixme: keep exp/coll | ||
| 947 | break; | ||
| 948 | case S_INT: | ||
| 949 | case S_HEX: | ||
| 950 | case S_STRING: | ||
| 951 | default: | ||
| 952 | break; | ||
| 953 | } | ||
| 954 | } | ||
| 955 | |||
| 956 | static void toggle_sym_value(struct menu *menu) | ||
| 957 | { | ||
| 958 | if (!menu->sym) | ||
| 959 | return; | ||
| 960 | |||
| 961 | sym_toggle_tristate_value(menu->sym); | ||
| 962 | if (view_mode == FULL_VIEW) | ||
| 963 | update_tree(&rootmenu, NULL); | ||
| 964 | else if (view_mode == SPLIT_VIEW) { | ||
| 965 | update_tree(browsed, NULL); | ||
| 966 | display_list(); | ||
| 967 | } | ||
| 968 | else if (view_mode == SINGLE_VIEW) | ||
| 969 | display_tree_part(); //fixme: keep exp/coll | ||
| 970 | } | ||
| 971 | |||
| 972 | static void renderer_toggled(GtkCellRendererToggle * cell, | ||
| 973 | gchar * path_string, gpointer user_data) | ||
| 974 | { | ||
| 975 | GtkTreePath *path, *sel_path = NULL; | ||
| 976 | GtkTreeIter iter, sel_iter; | ||
| 977 | GtkTreeSelection *sel; | ||
| 978 | struct menu *menu; | ||
| 979 | |||
| 980 | path = gtk_tree_path_new_from_string(path_string); | ||
| 981 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | ||
| 982 | return; | ||
| 983 | |||
| 984 | sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(tree2_w)); | ||
| 985 | if (gtk_tree_selection_get_selected(sel, NULL, &sel_iter)) | ||
| 986 | sel_path = gtk_tree_model_get_path(model2, &sel_iter); | ||
| 987 | if (!sel_path) | ||
| 988 | goto out1; | ||
| 989 | if (gtk_tree_path_compare(path, sel_path)) | ||
| 990 | goto out2; | ||
| 991 | |||
| 992 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
| 993 | toggle_sym_value(menu); | ||
| 994 | |||
| 995 | out2: | ||
| 996 | gtk_tree_path_free(sel_path); | ||
| 997 | out1: | ||
| 998 | gtk_tree_path_free(path); | ||
| 999 | } | ||
| 1000 | |||
| 1001 | static gint column2index(GtkTreeViewColumn * column) | ||
| 1002 | { | ||
| 1003 | gint i; | ||
| 1004 | |||
| 1005 | for (i = 0; i < COL_NUMBER; i++) { | ||
| 1006 | GtkTreeViewColumn *col; | ||
| 1007 | |||
| 1008 | col = gtk_tree_view_get_column(GTK_TREE_VIEW(tree2_w), i); | ||
| 1009 | if (col == column) | ||
| 1010 | return i; | ||
| 1011 | } | ||
| 1012 | |||
| 1013 | return -1; | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | |||
| 1017 | /* User click: update choice (full) or goes down (single) */ | ||
| 1018 | gboolean | ||
| 1019 | on_treeview2_button_press_event(GtkWidget * widget, | ||
| 1020 | GdkEventButton * event, gpointer user_data) | ||
| 1021 | { | ||
| 1022 | GtkTreeView *view = GTK_TREE_VIEW(widget); | ||
| 1023 | GtkTreePath *path; | ||
| 1024 | GtkTreeViewColumn *column; | ||
| 1025 | GtkTreeIter iter; | ||
| 1026 | struct menu *menu; | ||
| 1027 | gint col; | ||
| 1028 | |||
| 1029 | #if GTK_CHECK_VERSION(2,1,4) // bug in ctree with earlier version of GTK | ||
| 1030 | gint tx = (gint) event->x; | ||
| 1031 | gint ty = (gint) event->y; | ||
| 1032 | gint cx, cy; | ||
| 1033 | |||
| 1034 | gtk_tree_view_get_path_at_pos(view, tx, ty, &path, &column, &cx, | ||
| 1035 | &cy); | ||
| 1036 | #else | ||
| 1037 | gtk_tree_view_get_cursor(view, &path, &column); | ||
| 1038 | #endif | ||
| 1039 | if (path == NULL) | ||
| 1040 | return FALSE; | ||
| 1041 | |||
| 1042 | if (!gtk_tree_model_get_iter(model2, &iter, path)) | ||
| 1043 | return FALSE; | ||
| 1044 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
| 1045 | |||
| 1046 | col = column2index(column); | ||
| 1047 | if (event->type == GDK_2BUTTON_PRESS) { | ||
| 1048 | enum prop_type ptype; | ||
| 1049 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
| 1050 | |||
| 1051 | if (ptype == P_MENU && view_mode != FULL_VIEW && col == COL_OPTION) { | ||
| 1052 | // goes down into menu | ||
| 1053 | current = menu; | ||
| 1054 | display_tree_part(); | ||
| 1055 | gtk_widget_set_sensitive(back_btn, TRUE); | ||
| 1056 | } else if ((col == COL_OPTION)) { | ||
| 1057 | toggle_sym_value(menu); | ||
| 1058 | gtk_tree_view_expand_row(view, path, TRUE); | ||
| 1059 | } | ||
| 1060 | } else { | ||
| 1061 | if (col == COL_VALUE) { | ||
| 1062 | toggle_sym_value(menu); | ||
| 1063 | gtk_tree_view_expand_row(view, path, TRUE); | ||
| 1064 | } else if (col == COL_NO || col == COL_MOD | ||
| 1065 | || col == COL_YES) { | ||
| 1066 | change_sym_value(menu, col); | ||
| 1067 | gtk_tree_view_expand_row(view, path, TRUE); | ||
| 1068 | } | ||
| 1069 | } | ||
| 1070 | |||
| 1071 | return FALSE; | ||
| 1072 | } | ||
| 1073 | |||
| 1074 | /* Key pressed: update choice */ | ||
| 1075 | gboolean | ||
| 1076 | on_treeview2_key_press_event(GtkWidget * widget, | ||
| 1077 | GdkEventKey * event, gpointer user_data) | ||
| 1078 | { | ||
| 1079 | GtkTreeView *view = GTK_TREE_VIEW(widget); | ||
| 1080 | GtkTreePath *path; | ||
| 1081 | GtkTreeViewColumn *column; | ||
| 1082 | GtkTreeIter iter; | ||
| 1083 | struct menu *menu; | ||
| 1084 | gint col; | ||
| 1085 | |||
| 1086 | gtk_tree_view_get_cursor(view, &path, &column); | ||
| 1087 | if (path == NULL) | ||
| 1088 | return FALSE; | ||
| 1089 | |||
| 1090 | if (event->keyval == GDK_space) { | ||
| 1091 | if (gtk_tree_view_row_expanded(view, path)) | ||
| 1092 | gtk_tree_view_collapse_row(view, path); | ||
| 1093 | else | ||
| 1094 | gtk_tree_view_expand_row(view, path, FALSE); | ||
| 1095 | return TRUE; | ||
| 1096 | } | ||
| 1097 | if (event->keyval == GDK_KP_Enter) { | ||
| 1098 | } | ||
| 1099 | if (widget == tree1_w) | ||
| 1100 | return FALSE; | ||
| 1101 | |||
| 1102 | gtk_tree_model_get_iter(model2, &iter, path); | ||
| 1103 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
| 1104 | |||
| 1105 | if (!strcasecmp(event->string, "n")) | ||
| 1106 | col = COL_NO; | ||
| 1107 | else if (!strcasecmp(event->string, "m")) | ||
| 1108 | col = COL_MOD; | ||
| 1109 | else if (!strcasecmp(event->string, "y")) | ||
| 1110 | col = COL_YES; | ||
| 1111 | else | ||
| 1112 | col = -1; | ||
| 1113 | change_sym_value(menu, col); | ||
| 1114 | |||
| 1115 | return FALSE; | ||
| 1116 | } | ||
| 1117 | |||
| 1118 | |||
| 1119 | /* Row selection changed: update help */ | ||
| 1120 | void | ||
| 1121 | on_treeview2_cursor_changed(GtkTreeView * treeview, gpointer user_data) | ||
| 1122 | { | ||
| 1123 | GtkTreeSelection *selection; | ||
| 1124 | GtkTreeIter iter; | ||
| 1125 | struct menu *menu; | ||
| 1126 | |||
| 1127 | selection = gtk_tree_view_get_selection(treeview); | ||
| 1128 | if (gtk_tree_selection_get_selected(selection, &model2, &iter)) { | ||
| 1129 | gtk_tree_model_get(model2, &iter, COL_MENU, &menu, -1); | ||
| 1130 | text_insert_help(menu); | ||
| 1131 | } | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | |||
| 1135 | /* User click: display sub-tree in the right frame. */ | ||
| 1136 | gboolean | ||
| 1137 | on_treeview1_button_press_event(GtkWidget * widget, | ||
| 1138 | GdkEventButton * event, gpointer user_data) | ||
| 1139 | { | ||
| 1140 | GtkTreeView *view = GTK_TREE_VIEW(widget); | ||
| 1141 | GtkTreePath *path; | ||
| 1142 | GtkTreeViewColumn *column; | ||
| 1143 | GtkTreeIter iter; | ||
| 1144 | struct menu *menu; | ||
| 1145 | |||
| 1146 | gint tx = (gint) event->x; | ||
| 1147 | gint ty = (gint) event->y; | ||
| 1148 | gint cx, cy; | ||
| 1149 | |||
| 1150 | gtk_tree_view_get_path_at_pos(view, tx, ty, &path, &column, &cx, | ||
| 1151 | &cy); | ||
| 1152 | if (path == NULL) | ||
| 1153 | return FALSE; | ||
| 1154 | |||
| 1155 | gtk_tree_model_get_iter(model1, &iter, path); | ||
| 1156 | gtk_tree_model_get(model1, &iter, COL_MENU, &menu, -1); | ||
| 1157 | |||
| 1158 | if (event->type == GDK_2BUTTON_PRESS) { | ||
| 1159 | toggle_sym_value(menu); | ||
| 1160 | current = menu; | ||
| 1161 | display_tree_part(); | ||
| 1162 | } else { | ||
| 1163 | browsed = menu; | ||
| 1164 | display_tree_part(); | ||
| 1165 | } | ||
| 1166 | |||
| 1167 | gtk_widget_realize(tree2_w); | ||
| 1168 | gtk_tree_view_set_cursor(view, path, NULL, FALSE); | ||
| 1169 | gtk_widget_grab_focus(tree2_w); | ||
| 1170 | |||
| 1171 | return FALSE; | ||
| 1172 | } | ||
| 1173 | |||
| 1174 | |||
| 1175 | /* Fill a row of strings */ | ||
| 1176 | static gchar **fill_row(struct menu *menu) | ||
| 1177 | { | ||
| 1178 | static gchar *row[COL_NUMBER]; | ||
| 1179 | struct symbol *sym = menu->sym; | ||
| 1180 | const char *def; | ||
| 1181 | int stype; | ||
| 1182 | tristate val; | ||
| 1183 | enum prop_type ptype; | ||
| 1184 | int i; | ||
| 1185 | |||
| 1186 | for (i = COL_OPTION; i <= COL_COLOR; i++) | ||
| 1187 | g_free(row[i]); | ||
| 1188 | bzero(row, sizeof(row)); | ||
| 1189 | |||
| 1190 | row[COL_OPTION] = | ||
| 1191 | g_strdup_printf("%s %s", menu_get_prompt(menu), | ||
| 1192 | sym ? (sym-> | ||
| 1193 | flags & SYMBOL_NEW ? "(NEW)" : "") : | ||
| 1194 | ""); | ||
| 1195 | |||
| 1196 | if (show_all && !menu_is_visible(menu)) | ||
| 1197 | row[COL_COLOR] = g_strdup("DarkGray"); | ||
| 1198 | else | ||
| 1199 | row[COL_COLOR] = g_strdup("Black"); | ||
| 1200 | |||
| 1201 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
| 1202 | switch (ptype) { | ||
| 1203 | case P_MENU: | ||
| 1204 | row[COL_PIXBUF] = (gchar *) xpm_menu; | ||
| 1205 | if (view_mode == SINGLE_VIEW) | ||
| 1206 | row[COL_PIXVIS] = GINT_TO_POINTER(TRUE); | ||
| 1207 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
| 1208 | break; | ||
| 1209 | case P_COMMENT: | ||
| 1210 | row[COL_PIXBUF] = (gchar *) xpm_void; | ||
| 1211 | row[COL_PIXVIS] = GINT_TO_POINTER(FALSE); | ||
| 1212 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
| 1213 | break; | ||
| 1214 | default: | ||
| 1215 | row[COL_PIXBUF] = (gchar *) xpm_void; | ||
| 1216 | row[COL_PIXVIS] = GINT_TO_POINTER(FALSE); | ||
| 1217 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); | ||
| 1218 | break; | ||
| 1219 | } | ||
| 1220 | |||
| 1221 | if (!sym) | ||
| 1222 | return row; | ||
| 1223 | row[COL_NAME] = g_strdup(sym->name); | ||
| 1224 | |||
| 1225 | sym_calc_value(sym); | ||
| 1226 | sym->flags &= ~SYMBOL_CHANGED; | ||
| 1227 | |||
| 1228 | if (sym_is_choice(sym)) { // parse childs for getting final value | ||
| 1229 | struct menu *child; | ||
| 1230 | struct symbol *def_sym = sym_get_choice_value(sym); | ||
| 1231 | struct menu *def_menu = NULL; | ||
| 1232 | |||
| 1233 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
| 1234 | |||
| 1235 | for (child = menu->list; child; child = child->next) { | ||
| 1236 | if (menu_is_visible(child) | ||
| 1237 | && child->sym == def_sym) | ||
| 1238 | def_menu = child; | ||
| 1239 | } | ||
| 1240 | |||
| 1241 | if (def_menu) | ||
| 1242 | row[COL_VALUE] = | ||
| 1243 | g_strdup(menu_get_prompt(def_menu)); | ||
| 1244 | } | ||
| 1245 | if(sym->flags & SYMBOL_CHOICEVAL) | ||
| 1246 | row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); | ||
| 1247 | |||
| 1248 | stype = sym_get_type(sym); | ||
| 1249 | switch (stype) { | ||
| 1250 | case S_BOOLEAN: | ||
| 1251 | if(GPOINTER_TO_INT(row[COL_PIXVIS]) == FALSE) | ||
| 1252 | row[COL_BTNVIS] = GINT_TO_POINTER(TRUE); | ||
| 1253 | if (sym_is_choice(sym)) | ||
| 1254 | break; | ||
| 1255 | case S_TRISTATE: | ||
| 1256 | val = sym_get_tristate_value(sym); | ||
| 1257 | switch (val) { | ||
| 1258 | case no: | ||
| 1259 | row[COL_NO] = g_strdup("N"); | ||
| 1260 | row[COL_VALUE] = g_strdup("N"); | ||
| 1261 | row[COL_BTNACT] = GINT_TO_POINTER(FALSE); | ||
| 1262 | row[COL_BTNINC] = GINT_TO_POINTER(FALSE); | ||
| 1263 | break; | ||
| 1264 | case mod: | ||
| 1265 | row[COL_MOD] = g_strdup("M"); | ||
| 1266 | row[COL_VALUE] = g_strdup("M"); | ||
| 1267 | row[COL_BTNINC] = GINT_TO_POINTER(TRUE); | ||
| 1268 | break; | ||
| 1269 | case yes: | ||
| 1270 | row[COL_YES] = g_strdup("Y"); | ||
| 1271 | row[COL_VALUE] = g_strdup("Y"); | ||
| 1272 | row[COL_BTNACT] = GINT_TO_POINTER(TRUE); | ||
| 1273 | row[COL_BTNINC] = GINT_TO_POINTER(FALSE); | ||
| 1274 | break; | ||
| 1275 | } | ||
| 1276 | |||
| 1277 | if (val != no && sym_tristate_within_range(sym, no)) | ||
| 1278 | row[COL_NO] = g_strdup("_"); | ||
| 1279 | if (val != mod && sym_tristate_within_range(sym, mod)) | ||
| 1280 | row[COL_MOD] = g_strdup("_"); | ||
| 1281 | if (val != yes && sym_tristate_within_range(sym, yes)) | ||
| 1282 | row[COL_YES] = g_strdup("_"); | ||
| 1283 | break; | ||
| 1284 | case S_INT: | ||
| 1285 | case S_HEX: | ||
| 1286 | case S_STRING: | ||
| 1287 | def = sym_get_string_value(sym); | ||
| 1288 | row[COL_VALUE] = g_strdup(def); | ||
| 1289 | row[COL_EDIT] = GINT_TO_POINTER(TRUE); | ||
| 1290 | row[COL_BTNVIS] = GINT_TO_POINTER(FALSE); | ||
| 1291 | break; | ||
| 1292 | } | ||
| 1293 | |||
| 1294 | return row; | ||
| 1295 | } | ||
| 1296 | |||
| 1297 | |||
| 1298 | /* Set the node content with a row of strings */ | ||
| 1299 | static void set_node(GtkTreeIter * node, struct menu *menu, gchar ** row) | ||
| 1300 | { | ||
| 1301 | GdkColor color; | ||
| 1302 | gboolean success; | ||
| 1303 | GdkPixbuf *pix; | ||
| 1304 | |||
| 1305 | pix = gdk_pixbuf_new_from_xpm_data((const char **) | ||
| 1306 | row[COL_PIXBUF]); | ||
| 1307 | |||
| 1308 | gdk_color_parse(row[COL_COLOR], &color); | ||
| 1309 | gdk_colormap_alloc_colors(gdk_colormap_get_system(), &color, 1, | ||
| 1310 | FALSE, FALSE, &success); | ||
| 1311 | |||
| 1312 | gtk_tree_store_set(tree, node, | ||
| 1313 | COL_OPTION, row[COL_OPTION], | ||
| 1314 | COL_NAME, row[COL_NAME], | ||
| 1315 | COL_NO, row[COL_NO], | ||
| 1316 | COL_MOD, row[COL_MOD], | ||
| 1317 | COL_YES, row[COL_YES], | ||
| 1318 | COL_VALUE, row[COL_VALUE], | ||
| 1319 | COL_MENU, (gpointer) menu, | ||
| 1320 | COL_COLOR, &color, | ||
| 1321 | COL_EDIT, GPOINTER_TO_INT(row[COL_EDIT]), | ||
| 1322 | COL_PIXBUF, pix, | ||
| 1323 | COL_PIXVIS, GPOINTER_TO_INT(row[COL_PIXVIS]), | ||
| 1324 | COL_BTNVIS, GPOINTER_TO_INT(row[COL_BTNVIS]), | ||
| 1325 | COL_BTNACT, GPOINTER_TO_INT(row[COL_BTNACT]), | ||
| 1326 | COL_BTNINC, GPOINTER_TO_INT(row[COL_BTNINC]), | ||
| 1327 | COL_BTNRAD, GPOINTER_TO_INT(row[COL_BTNRAD]), | ||
| 1328 | -1); | ||
| 1329 | |||
| 1330 | g_object_unref(pix); | ||
| 1331 | } | ||
| 1332 | |||
| 1333 | |||
| 1334 | /* Add a node to the tree */ | ||
| 1335 | static void place_node(struct menu *menu, char **row) | ||
| 1336 | { | ||
| 1337 | GtkTreeIter *parent = parents[indent - 1]; | ||
| 1338 | GtkTreeIter *node = parents[indent]; | ||
| 1339 | |||
| 1340 | gtk_tree_store_append(tree, node, parent); | ||
| 1341 | set_node(node, menu, row); | ||
| 1342 | } | ||
| 1343 | |||
| 1344 | |||
| 1345 | /* Find a node in the GTK+ tree */ | ||
| 1346 | static GtkTreeIter found; | ||
| 1347 | |||
| 1348 | /* | ||
| 1349 | * Find a menu in the GtkTree starting at parent. | ||
| 1350 | */ | ||
| 1351 | GtkTreeIter *gtktree_iter_find_node(GtkTreeIter * parent, | ||
| 1352 | struct menu *tofind) | ||
| 1353 | { | ||
| 1354 | GtkTreeIter iter; | ||
| 1355 | GtkTreeIter *child = &iter; | ||
| 1356 | gboolean valid; | ||
| 1357 | GtkTreeIter *ret; | ||
| 1358 | |||
| 1359 | valid = gtk_tree_model_iter_children(model2, child, parent); | ||
| 1360 | while (valid) { | ||
| 1361 | struct menu *menu; | ||
| 1362 | |||
| 1363 | gtk_tree_model_get(model2, child, 6, &menu, -1); | ||
| 1364 | |||
| 1365 | if (menu == tofind) { | ||
| 1366 | memcpy(&found, child, sizeof(GtkTreeIter)); | ||
| 1367 | return &found; | ||
| 1368 | } | ||
| 1369 | |||
| 1370 | ret = gtktree_iter_find_node(child, tofind); | ||
| 1371 | if (ret) | ||
| 1372 | return ret; | ||
| 1373 | |||
| 1374 | valid = gtk_tree_model_iter_next(model2, child); | ||
| 1375 | } | ||
| 1376 | |||
| 1377 | return NULL; | ||
| 1378 | } | ||
| 1379 | |||
| 1380 | |||
| 1381 | /* | ||
| 1382 | * Update the tree by adding/removing entries | ||
| 1383 | * Does not change other nodes | ||
| 1384 | */ | ||
| 1385 | static void update_tree(struct menu *src, GtkTreeIter * dst) | ||
| 1386 | { | ||
| 1387 | struct menu *child1; | ||
| 1388 | GtkTreeIter iter, tmp; | ||
| 1389 | GtkTreeIter *child2 = &iter; | ||
| 1390 | gboolean valid; | ||
| 1391 | GtkTreeIter *sibling; | ||
| 1392 | struct symbol *sym; | ||
| 1393 | struct property *prop; | ||
| 1394 | struct menu *menu1, *menu2; | ||
| 1395 | |||
| 1396 | if (src == &rootmenu) | ||
| 1397 | indent = 1; | ||
| 1398 | |||
| 1399 | valid = gtk_tree_model_iter_children(model2, child2, dst); | ||
| 1400 | for (child1 = src->list; child1; child1 = child1->next) { | ||
| 1401 | |||
| 1402 | prop = child1->prompt; | ||
| 1403 | sym = child1->sym; | ||
| 1404 | |||
| 1405 | reparse: | ||
| 1406 | menu1 = child1; | ||
| 1407 | if (valid) | ||
| 1408 | gtk_tree_model_get(model2, child2, COL_MENU, | ||
| 1409 | &menu2, -1); | ||
| 1410 | else | ||
| 1411 | menu2 = NULL; // force adding of a first child | ||
| 1412 | |||
| 1413 | #ifdef DEBUG | ||
| 1414 | printf("%*c%s | %s\n", indent, ' ', | ||
| 1415 | menu1 ? menu_get_prompt(menu1) : "nil", | ||
| 1416 | menu2 ? menu_get_prompt(menu2) : "nil"); | ||
| 1417 | #endif | ||
| 1418 | |||
| 1419 | if (!menu_is_visible(child1) && !show_all) { // remove node | ||
| 1420 | if (gtktree_iter_find_node(dst, menu1) != NULL) { | ||
| 1421 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); | ||
| 1422 | valid = gtk_tree_model_iter_next(model2, | ||
| 1423 | child2); | ||
| 1424 | gtk_tree_store_remove(tree2, &tmp); | ||
| 1425 | if (!valid) | ||
| 1426 | return; // next parent | ||
| 1427 | else | ||
| 1428 | goto reparse; // next child | ||
| 1429 | } else | ||
| 1430 | continue; | ||
| 1431 | } | ||
| 1432 | |||
| 1433 | if (menu1 != menu2) { | ||
| 1434 | if (gtktree_iter_find_node(dst, menu1) == NULL) { // add node | ||
| 1435 | if (!valid && !menu2) | ||
| 1436 | sibling = NULL; | ||
| 1437 | else | ||
| 1438 | sibling = child2; | ||
| 1439 | gtk_tree_store_insert_before(tree2, | ||
| 1440 | child2, | ||
| 1441 | dst, sibling); | ||
| 1442 | set_node(child2, menu1, fill_row(menu1)); | ||
| 1443 | if (menu2 == NULL) | ||
| 1444 | valid = TRUE; | ||
| 1445 | } else { // remove node | ||
| 1446 | memcpy(&tmp, child2, sizeof(GtkTreeIter)); | ||
| 1447 | valid = gtk_tree_model_iter_next(model2, | ||
| 1448 | child2); | ||
| 1449 | gtk_tree_store_remove(tree2, &tmp); | ||
| 1450 | if (!valid) | ||
| 1451 | return; // next parent | ||
| 1452 | else | ||
| 1453 | goto reparse; // next child | ||
| 1454 | } | ||
| 1455 | } else if (sym && (sym->flags & SYMBOL_CHANGED)) { | ||
| 1456 | set_node(child2, menu1, fill_row(menu1)); | ||
| 1457 | } | ||
| 1458 | |||
| 1459 | indent++; | ||
| 1460 | update_tree(child1, child2); | ||
| 1461 | indent--; | ||
| 1462 | |||
| 1463 | valid = gtk_tree_model_iter_next(model2, child2); | ||
| 1464 | } | ||
| 1465 | } | ||
| 1466 | |||
| 1467 | |||
| 1468 | /* Display the whole tree (single/split/full view) */ | ||
| 1469 | static void display_tree(struct menu *menu) | ||
| 1470 | { | ||
| 1471 | struct symbol *sym; | ||
| 1472 | struct property *prop; | ||
| 1473 | struct menu *child; | ||
| 1474 | enum prop_type ptype; | ||
| 1475 | |||
| 1476 | if (menu == &rootmenu) { | ||
| 1477 | indent = 1; | ||
| 1478 | current = &rootmenu; | ||
| 1479 | } | ||
| 1480 | |||
| 1481 | for (child = menu->list; child; child = child->next) { | ||
| 1482 | prop = child->prompt; | ||
| 1483 | sym = child->sym; | ||
| 1484 | ptype = prop ? prop->type : P_UNKNOWN; | ||
| 1485 | |||
| 1486 | if (sym) | ||
| 1487 | sym->flags &= ~SYMBOL_CHANGED; | ||
| 1488 | |||
| 1489 | if ((view_mode == SPLIT_VIEW) && !(child->flags & MENU_ROOT) && | ||
| 1490 | (tree == tree1)) | ||
| 1491 | continue; | ||
| 1492 | |||
| 1493 | if ((view_mode == SPLIT_VIEW) && (child->flags & MENU_ROOT) && | ||
| 1494 | (tree == tree2)) | ||
| 1495 | continue; | ||
| 1496 | |||
| 1497 | if (menu_is_visible(child) || show_all) | ||
| 1498 | place_node(child, fill_row(child)); | ||
| 1499 | #ifdef DEBUG | ||
| 1500 | printf("%*c%s: ", indent, ' ', menu_get_prompt(child)); | ||
| 1501 | printf("%s", child->flags & MENU_ROOT ? "rootmenu | " : ""); | ||
| 1502 | dbg_print_ptype(ptype); | ||
| 1503 | printf(" | "); | ||
| 1504 | if (sym) { | ||
| 1505 | dbg_print_stype(sym->type); | ||
| 1506 | printf(" | "); | ||
| 1507 | dbg_print_flags(sym->flags); | ||
| 1508 | printf("\n"); | ||
| 1509 | } else | ||
| 1510 | printf("\n"); | ||
| 1511 | #endif | ||
| 1512 | if ((view_mode != FULL_VIEW) && (ptype == P_MENU) | ||
| 1513 | && (tree == tree2)) | ||
| 1514 | continue; | ||
| 1515 | /* | ||
| 1516 | if (((menu != &rootmenu) && !(menu->flags & MENU_ROOT)) || | ||
| 1517 | (view_mode == FULL_VIEW) | ||
| 1518 | || (view_mode == SPLIT_VIEW))*/ | ||
| 1519 | if (((view_mode == SINGLE_VIEW) && (menu->flags & MENU_ROOT)) | ||
| 1520 | || (view_mode == FULL_VIEW) || (view_mode == SPLIT_VIEW)) { | ||
| 1521 | indent++; | ||
| 1522 | display_tree(child); | ||
| 1523 | indent--; | ||
| 1524 | } | ||
| 1525 | } | ||
| 1526 | } | ||
| 1527 | |||
| 1528 | /* Display a part of the tree starting at current node (single/split view) */ | ||
| 1529 | static void display_tree_part(void) | ||
| 1530 | { | ||
| 1531 | if (tree2) | ||
| 1532 | gtk_tree_store_clear(tree2); | ||
| 1533 | if(view_mode == SINGLE_VIEW) | ||
| 1534 | display_tree(current); | ||
| 1535 | else if(view_mode == SPLIT_VIEW) | ||
| 1536 | display_tree(browsed); | ||
| 1537 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree2_w)); | ||
| 1538 | } | ||
| 1539 | |||
| 1540 | /* Display the list in the left frame (split view) */ | ||
| 1541 | static void display_list(void) | ||
| 1542 | { | ||
| 1543 | if (tree1) | ||
| 1544 | gtk_tree_store_clear(tree1); | ||
| 1545 | |||
| 1546 | tree = tree1; | ||
| 1547 | display_tree(&rootmenu); | ||
| 1548 | gtk_tree_view_expand_all(GTK_TREE_VIEW(tree1_w)); | ||
| 1549 | tree = tree2; | ||
| 1550 | } | ||
| 1551 | |||
| 1552 | void fixup_rootmenu(struct menu *menu) | ||
| 1553 | { | ||
| 1554 | struct menu *child; | ||
| 1555 | static int menu_cnt = 0; | ||
| 1556 | |||
| 1557 | menu->flags |= MENU_ROOT; | ||
| 1558 | for (child = menu->list; child; child = child->next) { | ||
| 1559 | if (child->prompt && child->prompt->type == P_MENU) { | ||
| 1560 | menu_cnt++; | ||
| 1561 | fixup_rootmenu(child); | ||
| 1562 | menu_cnt--; | ||
| 1563 | } else if (!menu_cnt) | ||
| 1564 | fixup_rootmenu(child); | ||
| 1565 | } | ||
| 1566 | } | ||
| 1567 | |||
| 1568 | |||
| 1569 | /* Main */ | ||
| 1570 | |||
| 1571 | |||
| 1572 | int main(int ac, char *av[]) | ||
| 1573 | { | ||
| 1574 | const char *name; | ||
| 1575 | char *env; | ||
| 1576 | gchar *glade_file; | ||
| 1577 | |||
| 1578 | #ifndef LKC_DIRECT_LINK | ||
| 1579 | kconfig_load(); | ||
| 1580 | #endif | ||
| 1581 | |||
| 1582 | /* GTK stuffs */ | ||
| 1583 | gtk_set_locale(); | ||
| 1584 | gtk_init(&ac, &av); | ||
| 1585 | glade_init(); | ||
| 1586 | |||
| 1587 | //add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); | ||
| 1588 | //add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps"); | ||
| 1589 | |||
| 1590 | /* Determine GUI path */ | ||
| 1591 | env = getenv(SRCTREE); | ||
| 1592 | if (env) | ||
| 1593 | glade_file = g_strconcat(env, "/scripts/kconfig/gconf.glade", NULL); | ||
| 1594 | else if (av[0][0] == '/') | ||
| 1595 | glade_file = g_strconcat(av[0], ".glade", NULL); | ||
| 1596 | else | ||
| 1597 | glade_file = g_strconcat(g_get_current_dir(), "/", av[0], ".glade", NULL); | ||
| 1598 | |||
| 1599 | /* Load the interface and connect signals */ | ||
| 1600 | init_main_window(glade_file); | ||
| 1601 | init_tree_model(); | ||
| 1602 | init_left_tree(); | ||
| 1603 | init_right_tree(); | ||
| 1604 | |||
| 1605 | /* Conf stuffs */ | ||
| 1606 | if (ac > 1 && av[1][0] == '-') { | ||
| 1607 | switch (av[1][1]) { | ||
| 1608 | case 'a': | ||
| 1609 | //showAll = 1; | ||
| 1610 | break; | ||
| 1611 | case 'h': | ||
| 1612 | case '?': | ||
| 1613 | printf("%s <config>\n", av[0]); | ||
| 1614 | exit(0); | ||
| 1615 | } | ||
| 1616 | name = av[2]; | ||
| 1617 | } else | ||
| 1618 | name = av[1]; | ||
| 1619 | |||
| 1620 | conf_parse(name); | ||
| 1621 | fixup_rootmenu(&rootmenu); | ||
| 1622 | conf_read(NULL); | ||
| 1623 | |||
| 1624 | switch (view_mode) { | ||
| 1625 | case SINGLE_VIEW: | ||
| 1626 | display_tree_part(); | ||
| 1627 | break; | ||
| 1628 | case SPLIT_VIEW: | ||
| 1629 | display_list(); | ||
| 1630 | break; | ||
| 1631 | case FULL_VIEW: | ||
| 1632 | display_tree(&rootmenu); | ||
| 1633 | break; | ||
| 1634 | } | ||
| 1635 | |||
| 1636 | gtk_main(); | ||
| 1637 | |||
| 1638 | return 0; | ||
| 1639 | } | ||
diff --git a/scripts/kconfig/gconf.glade b/scripts/kconfig/gconf.glade new file mode 100644 index 000000000000..1e1736d81ee9 --- /dev/null +++ b/scripts/kconfig/gconf.glade | |||
| @@ -0,0 +1,543 @@ | |||
| 1 | <?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> | ||
| 2 | <!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> | ||
| 3 | |||
| 4 | <glade-interface> | ||
| 5 | |||
| 6 | <widget class="GtkWindow" id="window1"> | ||
| 7 | <property name="visible">True</property> | ||
| 8 | <property name="title" translatable="yes">Gtk Kernel Configurator</property> | ||
| 9 | <property name="type">GTK_WINDOW_TOPLEVEL</property> | ||
| 10 | <property name="window_position">GTK_WIN_POS_NONE</property> | ||
| 11 | <property name="modal">False</property> | ||
| 12 | <property name="default_width">640</property> | ||
| 13 | <property name="default_height">480</property> | ||
| 14 | <property name="resizable">True</property> | ||
| 15 | <property name="destroy_with_parent">False</property> | ||
| 16 | <signal name="destroy" handler="on_window1_destroy" object="window1"/> | ||
| 17 | <signal name="size_request" handler="on_window1_size_request" object="vpaned1" last_modification_time="Fri, 11 Jan 2002 16:17:11 GMT"/> | ||
| 18 | <signal name="delete_event" handler="on_window1_delete_event" object="window1" last_modification_time="Sun, 09 Mar 2003 19:42:46 GMT"/> | ||
| 19 | |||
| 20 | <child> | ||
| 21 | <widget class="GtkVBox" id="vbox1"> | ||
| 22 | <property name="visible">True</property> | ||
| 23 | <property name="homogeneous">False</property> | ||
| 24 | <property name="spacing">0</property> | ||
| 25 | |||
| 26 | <child> | ||
| 27 | <widget class="GtkMenuBar" id="menubar1"> | ||
| 28 | <property name="visible">True</property> | ||
| 29 | |||
| 30 | <child> | ||
| 31 | <widget class="GtkMenuItem" id="file1"> | ||
| 32 | <property name="visible">True</property> | ||
| 33 | <property name="label" translatable="yes">_File</property> | ||
| 34 | <property name="use_underline">True</property> | ||
| 35 | |||
| 36 | <child> | ||
| 37 | <widget class="GtkMenu" id="file1_menu"> | ||
| 38 | |||
| 39 | <child> | ||
| 40 | <widget class="GtkImageMenuItem" id="load1"> | ||
| 41 | <property name="visible">True</property> | ||
| 42 | <property name="tooltip" translatable="yes">Load a config file</property> | ||
| 43 | <property name="label" translatable="yes">_Load</property> | ||
| 44 | <property name="use_underline">True</property> | ||
| 45 | <signal name="activate" handler="on_load1_activate"/> | ||
| 46 | <accelerator key="L" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
| 47 | |||
| 48 | <child internal-child="image"> | ||
| 49 | <widget class="GtkImage" id="image27"> | ||
| 50 | <property name="visible">True</property> | ||
| 51 | <property name="stock">gtk-open</property> | ||
| 52 | <property name="icon_size">1</property> | ||
| 53 | <property name="xalign">0.5</property> | ||
| 54 | <property name="yalign">0.5</property> | ||
| 55 | <property name="xpad">0</property> | ||
| 56 | <property name="ypad">0</property> | ||
| 57 | </widget> | ||
| 58 | </child> | ||
| 59 | </widget> | ||
| 60 | </child> | ||
| 61 | |||
| 62 | <child> | ||
| 63 | <widget class="GtkImageMenuItem" id="save1"> | ||
| 64 | <property name="visible">True</property> | ||
| 65 | <property name="tooltip" translatable="yes">Save the config in .config</property> | ||
| 66 | <property name="label" translatable="yes">_Save</property> | ||
| 67 | <property name="use_underline">True</property> | ||
| 68 | <signal name="activate" handler="on_save1_activate"/> | ||
| 69 | <accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
| 70 | |||
| 71 | <child internal-child="image"> | ||
| 72 | <widget class="GtkImage" id="image28"> | ||
| 73 | <property name="visible">True</property> | ||
| 74 | <property name="stock">gtk-save</property> | ||
| 75 | <property name="icon_size">1</property> | ||
| 76 | <property name="xalign">0.5</property> | ||
| 77 | <property name="yalign">0.5</property> | ||
| 78 | <property name="xpad">0</property> | ||
| 79 | <property name="ypad">0</property> | ||
| 80 | </widget> | ||
| 81 | </child> | ||
| 82 | </widget> | ||
| 83 | </child> | ||
| 84 | |||
| 85 | <child> | ||
| 86 | <widget class="GtkImageMenuItem" id="save_as1"> | ||
| 87 | <property name="visible">True</property> | ||
| 88 | <property name="tooltip" translatable="yes">Save the config in a file</property> | ||
| 89 | <property name="label" translatable="yes">Save _as</property> | ||
| 90 | <property name="use_underline">True</property> | ||
| 91 | <signal name="activate" handler="on_save_as1_activate"/> | ||
| 92 | |||
| 93 | <child internal-child="image"> | ||
| 94 | <widget class="GtkImage" id="image29"> | ||
| 95 | <property name="visible">True</property> | ||
| 96 | <property name="stock">gtk-save-as</property> | ||
| 97 | <property name="icon_size">1</property> | ||
| 98 | <property name="xalign">0.5</property> | ||
| 99 | <property name="yalign">0.5</property> | ||
| 100 | <property name="xpad">0</property> | ||
| 101 | <property name="ypad">0</property> | ||
| 102 | </widget> | ||
| 103 | </child> | ||
| 104 | </widget> | ||
| 105 | </child> | ||
| 106 | |||
| 107 | <child> | ||
| 108 | <widget class="GtkMenuItem" id="separator1"> | ||
| 109 | <property name="visible">True</property> | ||
| 110 | </widget> | ||
| 111 | </child> | ||
| 112 | |||
| 113 | <child> | ||
| 114 | <widget class="GtkImageMenuItem" id="quit1"> | ||
| 115 | <property name="visible">True</property> | ||
| 116 | <property name="label" translatable="yes">_Quit</property> | ||
| 117 | <property name="use_underline">True</property> | ||
| 118 | <signal name="activate" handler="on_quit1_activate"/> | ||
| 119 | <accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
| 120 | |||
| 121 | <child internal-child="image"> | ||
| 122 | <widget class="GtkImage" id="image30"> | ||
| 123 | <property name="visible">True</property> | ||
| 124 | <property name="stock">gtk-quit</property> | ||
| 125 | <property name="icon_size">1</property> | ||
| 126 | <property name="xalign">0.5</property> | ||
| 127 | <property name="yalign">0.5</property> | ||
| 128 | <property name="xpad">0</property> | ||
| 129 | <property name="ypad">0</property> | ||
| 130 | </widget> | ||
| 131 | </child> | ||
| 132 | </widget> | ||
| 133 | </child> | ||
| 134 | </widget> | ||
| 135 | </child> | ||
| 136 | </widget> | ||
| 137 | </child> | ||
| 138 | |||
| 139 | <child> | ||
| 140 | <widget class="GtkMenuItem" id="options1"> | ||
| 141 | <property name="visible">True</property> | ||
| 142 | <property name="label" translatable="yes">_Options</property> | ||
| 143 | <property name="use_underline">True</property> | ||
| 144 | |||
| 145 | <child> | ||
| 146 | <widget class="GtkMenu" id="options1_menu"> | ||
| 147 | |||
| 148 | <child> | ||
| 149 | <widget class="GtkCheckMenuItem" id="show_name1"> | ||
| 150 | <property name="visible">True</property> | ||
| 151 | <property name="tooltip" translatable="yes">Show name</property> | ||
| 152 | <property name="label" translatable="yes">Show _name</property> | ||
| 153 | <property name="use_underline">True</property> | ||
| 154 | <property name="active">False</property> | ||
| 155 | <signal name="activate" handler="on_show_name1_activate"/> | ||
| 156 | </widget> | ||
| 157 | </child> | ||
| 158 | |||
| 159 | <child> | ||
| 160 | <widget class="GtkCheckMenuItem" id="show_range1"> | ||
| 161 | <property name="visible">True</property> | ||
| 162 | <property name="tooltip" translatable="yes">Show range (Y/M/N)</property> | ||
| 163 | <property name="label" translatable="yes">Show _range</property> | ||
| 164 | <property name="use_underline">True</property> | ||
| 165 | <property name="active">False</property> | ||
| 166 | <signal name="activate" handler="on_show_range1_activate"/> | ||
| 167 | </widget> | ||
| 168 | </child> | ||
| 169 | |||
| 170 | <child> | ||
| 171 | <widget class="GtkCheckMenuItem" id="show_data1"> | ||
| 172 | <property name="visible">True</property> | ||
| 173 | <property name="tooltip" translatable="yes">Show value of the option</property> | ||
| 174 | <property name="label" translatable="yes">Show _data</property> | ||
| 175 | <property name="use_underline">True</property> | ||
| 176 | <property name="active">False</property> | ||
| 177 | <signal name="activate" handler="on_show_data1_activate"/> | ||
| 178 | </widget> | ||
| 179 | </child> | ||
| 180 | |||
| 181 | <child> | ||
| 182 | <widget class="GtkMenuItem" id="separator2"> | ||
| 183 | <property name="visible">True</property> | ||
| 184 | </widget> | ||
| 185 | </child> | ||
| 186 | |||
| 187 | <child> | ||
| 188 | <widget class="GtkCheckMenuItem" id="show_all_options1"> | ||
| 189 | <property name="visible">True</property> | ||
| 190 | <property name="tooltip" translatable="yes">Show all options</property> | ||
| 191 | <property name="label" translatable="yes">Show all _options</property> | ||
| 192 | <property name="use_underline">True</property> | ||
| 193 | <property name="active">False</property> | ||
| 194 | <signal name="activate" handler="on_show_all_options1_activate"/> | ||
| 195 | </widget> | ||
| 196 | </child> | ||
| 197 | |||
| 198 | <child> | ||
| 199 | <widget class="GtkCheckMenuItem" id="show_debug_info1"> | ||
| 200 | <property name="visible">True</property> | ||
| 201 | <property name="tooltip" translatable="yes">Show masked options</property> | ||
| 202 | <property name="label" translatable="yes">Show _debug info</property> | ||
| 203 | <property name="use_underline">True</property> | ||
| 204 | <property name="active">False</property> | ||
| 205 | <signal name="activate" handler="on_show_debug_info1_activate"/> | ||
| 206 | </widget> | ||
| 207 | </child> | ||
| 208 | </widget> | ||
| 209 | </child> | ||
| 210 | </widget> | ||
| 211 | </child> | ||
| 212 | |||
| 213 | <child> | ||
| 214 | <widget class="GtkMenuItem" id="help1"> | ||
| 215 | <property name="visible">True</property> | ||
| 216 | <property name="label" translatable="yes">_Help</property> | ||
| 217 | <property name="use_underline">True</property> | ||
| 218 | |||
| 219 | <child> | ||
| 220 | <widget class="GtkMenu" id="help1_menu"> | ||
| 221 | |||
| 222 | <child> | ||
| 223 | <widget class="GtkImageMenuItem" id="introduction1"> | ||
| 224 | <property name="visible">True</property> | ||
| 225 | <property name="label" translatable="yes">_Introduction</property> | ||
| 226 | <property name="use_underline">True</property> | ||
| 227 | <signal name="activate" handler="on_introduction1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | ||
| 228 | <accelerator key="I" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
| 229 | |||
| 230 | <child internal-child="image"> | ||
| 231 | <widget class="GtkImage" id="image31"> | ||
| 232 | <property name="visible">True</property> | ||
| 233 | <property name="stock">gtk-dialog-question</property> | ||
| 234 | <property name="icon_size">1</property> | ||
| 235 | <property name="xalign">0.5</property> | ||
| 236 | <property name="yalign">0.5</property> | ||
| 237 | <property name="xpad">0</property> | ||
| 238 | <property name="ypad">0</property> | ||
| 239 | </widget> | ||
| 240 | </child> | ||
| 241 | </widget> | ||
| 242 | </child> | ||
| 243 | |||
| 244 | <child> | ||
| 245 | <widget class="GtkImageMenuItem" id="about1"> | ||
| 246 | <property name="visible">True</property> | ||
| 247 | <property name="label" translatable="yes">_About</property> | ||
| 248 | <property name="use_underline">True</property> | ||
| 249 | <signal name="activate" handler="on_about1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | ||
| 250 | <accelerator key="A" modifiers="GDK_CONTROL_MASK" signal="activate"/> | ||
| 251 | |||
| 252 | <child internal-child="image"> | ||
| 253 | <widget class="GtkImage" id="image32"> | ||
| 254 | <property name="visible">True</property> | ||
| 255 | <property name="stock">gtk-properties</property> | ||
| 256 | <property name="icon_size">1</property> | ||
| 257 | <property name="xalign">0.5</property> | ||
| 258 | <property name="yalign">0.5</property> | ||
| 259 | <property name="xpad">0</property> | ||
| 260 | <property name="ypad">0</property> | ||
| 261 | </widget> | ||
| 262 | </child> | ||
| 263 | </widget> | ||
| 264 | </child> | ||
| 265 | |||
| 266 | <child> | ||
| 267 | <widget class="GtkImageMenuItem" id="license1"> | ||
| 268 | <property name="visible">True</property> | ||
| 269 | <property name="label" translatable="yes">_License</property> | ||
| 270 | <property name="use_underline">True</property> | ||
| 271 | <signal name="activate" handler="on_license1_activate" last_modification_time="Fri, 15 Nov 2002 20:26:30 GMT"/> | ||
| 272 | |||
| 273 | <child internal-child="image"> | ||
| 274 | <widget class="GtkImage" id="image33"> | ||
| 275 | <property name="visible">True</property> | ||
| 276 | <property name="stock">gtk-justify-fill</property> | ||
| 277 | <property name="icon_size">1</property> | ||
| 278 | <property name="xalign">0.5</property> | ||
| 279 | <property name="yalign">0.5</property> | ||
| 280 | <property name="xpad">0</property> | ||
| 281 | <property name="ypad">0</property> | ||
| 282 | </widget> | ||
| 283 | </child> | ||
| 284 | </widget> | ||
| 285 | </child> | ||
| 286 | </widget> | ||
| 287 | </child> | ||
| 288 | </widget> | ||
| 289 | </child> | ||
| 290 | </widget> | ||
| 291 | <packing> | ||
| 292 | <property name="padding">0</property> | ||
| 293 | <property name="expand">False</property> | ||
| 294 | <property name="fill">False</property> | ||
| 295 | </packing> | ||
| 296 | </child> | ||
| 297 | |||
| 298 | <child> | ||
| 299 | <widget class="GtkHandleBox" id="handlebox1"> | ||
| 300 | <property name="visible">True</property> | ||
| 301 | <property name="shadow_type">GTK_SHADOW_OUT</property> | ||
| 302 | <property name="handle_position">GTK_POS_LEFT</property> | ||
| 303 | <property name="snap_edge">GTK_POS_TOP</property> | ||
| 304 | |||
| 305 | <child> | ||
| 306 | <widget class="GtkToolbar" id="toolbar1"> | ||
| 307 | <property name="visible">True</property> | ||
| 308 | <property name="orientation">GTK_ORIENTATION_HORIZONTAL</property> | ||
| 309 | <property name="toolbar_style">GTK_TOOLBAR_BOTH</property> | ||
| 310 | <property name="tooltips">True</property> | ||
| 311 | |||
| 312 | <child> | ||
| 313 | <widget class="button" id="button1"> | ||
| 314 | <property name="visible">True</property> | ||
| 315 | <property name="tooltip" translatable="yes">Goes up of one level (single view)</property> | ||
| 316 | <property name="label" translatable="yes">Back</property> | ||
| 317 | <property name="use_underline">True</property> | ||
| 318 | <property name="stock_pixmap">gtk-undo</property> | ||
| 319 | <signal name="pressed" handler="on_back_pressed"/> | ||
| 320 | </widget> | ||
| 321 | </child> | ||
| 322 | |||
| 323 | <child> | ||
| 324 | <widget class="GtkVSeparator" id="vseparator1"> | ||
| 325 | <property name="visible">True</property> | ||
| 326 | </widget> | ||
| 327 | </child> | ||
| 328 | |||
| 329 | <child> | ||
| 330 | <widget class="button" id="button2"> | ||
| 331 | <property name="visible">True</property> | ||
| 332 | <property name="tooltip" translatable="yes">Load a config file</property> | ||
| 333 | <property name="label" translatable="yes">Load</property> | ||
| 334 | <property name="use_underline">True</property> | ||
| 335 | <property name="stock_pixmap">gtk-open</property> | ||
| 336 | <signal name="pressed" handler="on_load_pressed"/> | ||
| 337 | </widget> | ||
| 338 | </child> | ||
| 339 | |||
| 340 | <child> | ||
| 341 | <widget class="button" id="button3"> | ||
| 342 | <property name="visible">True</property> | ||
| 343 | <property name="tooltip" translatable="yes">Save a config file</property> | ||
| 344 | <property name="label" translatable="yes">Save</property> | ||
| 345 | <property name="use_underline">True</property> | ||
| 346 | <property name="stock_pixmap">gtk-save</property> | ||
| 347 | <signal name="pressed" handler="on_save_pressed"/> | ||
| 348 | </widget> | ||
| 349 | </child> | ||
| 350 | |||
| 351 | <child> | ||
| 352 | <widget class="GtkVSeparator" id="vseparator2"> | ||
| 353 | <property name="visible">True</property> | ||
| 354 | </widget> | ||
| 355 | </child> | ||
| 356 | |||
| 357 | <child> | ||
| 358 | <widget class="button" id="button4"> | ||
| 359 | <property name="visible">True</property> | ||
| 360 | <property name="tooltip" translatable="yes">Single view</property> | ||
| 361 | <property name="label" translatable="yes">Single</property> | ||
| 362 | <property name="use_underline">True</property> | ||
| 363 | <property name="stock_pixmap">gtk-missing-image</property> | ||
| 364 | <signal name="clicked" handler="on_single_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:39 GMT"/> | ||
| 365 | </widget> | ||
| 366 | </child> | ||
| 367 | |||
| 368 | <child> | ||
| 369 | <widget class="button" id="button5"> | ||
| 370 | <property name="visible">True</property> | ||
| 371 | <property name="tooltip" translatable="yes">Split view</property> | ||
| 372 | <property name="label" translatable="yes">Split</property> | ||
| 373 | <property name="use_underline">True</property> | ||
| 374 | <property name="stock_pixmap">gtk-missing-image</property> | ||
| 375 | <signal name="clicked" handler="on_split_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:45 GMT"/> | ||
| 376 | </widget> | ||
| 377 | </child> | ||
| 378 | |||
| 379 | <child> | ||
| 380 | <widget class="button" id="button6"> | ||
| 381 | <property name="visible">True</property> | ||
| 382 | <property name="tooltip" translatable="yes">Full view</property> | ||
| 383 | <property name="label" translatable="yes">Full</property> | ||
| 384 | <property name="use_underline">True</property> | ||
| 385 | <property name="stock_pixmap">gtk-missing-image</property> | ||
| 386 | <signal name="clicked" handler="on_full_clicked" last_modification_time="Sun, 12 Jan 2003 14:28:50 GMT"/> | ||
| 387 | </widget> | ||
| 388 | </child> | ||
| 389 | |||
| 390 | <child> | ||
| 391 | <widget class="GtkVSeparator" id="vseparator3"> | ||
| 392 | <property name="visible">True</property> | ||
| 393 | </widget> | ||
| 394 | </child> | ||
| 395 | |||
| 396 | <child> | ||
| 397 | <widget class="button" id="button7"> | ||
| 398 | <property name="visible">True</property> | ||
| 399 | <property name="tooltip" translatable="yes">Collapse the whole tree in the right frame</property> | ||
| 400 | <property name="label" translatable="yes">Collapse</property> | ||
| 401 | <property name="use_underline">True</property> | ||
| 402 | <signal name="pressed" handler="on_collapse_pressed"/> | ||
| 403 | </widget> | ||
| 404 | </child> | ||
| 405 | |||
| 406 | <child> | ||
| 407 | <widget class="button" id="button8"> | ||
| 408 | <property name="visible">True</property> | ||
| 409 | <property name="tooltip" translatable="yes">Expand the whole tree in the right frame</property> | ||
| 410 | <property name="label" translatable="yes">Expand</property> | ||
| 411 | <property name="use_underline">True</property> | ||
| 412 | <signal name="pressed" handler="on_expand_pressed"/> | ||
| 413 | </widget> | ||
| 414 | </child> | ||
| 415 | </widget> | ||
| 416 | </child> | ||
| 417 | </widget> | ||
| 418 | <packing> | ||
| 419 | <property name="padding">0</property> | ||
| 420 | <property name="expand">False</property> | ||
| 421 | <property name="fill">False</property> | ||
| 422 | </packing> | ||
| 423 | </child> | ||
| 424 | |||
| 425 | <child> | ||
| 426 | <widget class="GtkHPaned" id="hpaned1"> | ||
| 427 | <property name="width_request">1</property> | ||
| 428 | <property name="visible">True</property> | ||
| 429 | <property name="can_focus">True</property> | ||
| 430 | <property name="position">0</property> | ||
| 431 | |||
| 432 | <child> | ||
| 433 | <widget class="GtkScrolledWindow" id="scrolledwindow1"> | ||
| 434 | <property name="visible">True</property> | ||
| 435 | <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> | ||
| 436 | <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> | ||
| 437 | <property name="shadow_type">GTK_SHADOW_IN</property> | ||
| 438 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | ||
| 439 | |||
| 440 | <child> | ||
| 441 | <widget class="GtkTreeView" id="treeview1"> | ||
| 442 | <property name="visible">True</property> | ||
| 443 | <property name="can_focus">True</property> | ||
| 444 | <property name="headers_visible">True</property> | ||
| 445 | <property name="rules_hint">False</property> | ||
| 446 | <property name="reorderable">False</property> | ||
| 447 | <property name="enable_search">True</property> | ||
| 448 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:58:22 GMT"/> | ||
| 449 | <signal name="button_press_event" handler="on_treeview1_button_press_event" last_modification_time="Sun, 12 Jan 2003 16:03:52 GMT"/> | ||
| 450 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 16:11:44 GMT"/> | ||
| 451 | </widget> | ||
| 452 | </child> | ||
| 453 | </widget> | ||
| 454 | <packing> | ||
| 455 | <property name="shrink">True</property> | ||
| 456 | <property name="resize">False</property> | ||
| 457 | </packing> | ||
| 458 | </child> | ||
| 459 | |||
| 460 | <child> | ||
| 461 | <widget class="GtkVPaned" id="vpaned1"> | ||
| 462 | <property name="visible">True</property> | ||
| 463 | <property name="can_focus">True</property> | ||
| 464 | <property name="position">0</property> | ||
| 465 | |||
| 466 | <child> | ||
| 467 | <widget class="GtkScrolledWindow" id="scrolledwindow2"> | ||
| 468 | <property name="visible">True</property> | ||
| 469 | <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> | ||
| 470 | <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> | ||
| 471 | <property name="shadow_type">GTK_SHADOW_IN</property> | ||
| 472 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | ||
| 473 | |||
| 474 | <child> | ||
| 475 | <widget class="GtkTreeView" id="treeview2"> | ||
| 476 | <property name="visible">True</property> | ||
| 477 | <property name="can_focus">True</property> | ||
| 478 | <property name="has_focus">True</property> | ||
| 479 | <property name="headers_visible">True</property> | ||
| 480 | <property name="rules_hint">False</property> | ||
| 481 | <property name="reorderable">False</property> | ||
| 482 | <property name="enable_search">True</property> | ||
| 483 | <signal name="cursor_changed" handler="on_treeview2_cursor_changed" last_modification_time="Sun, 12 Jan 2003 15:57:55 GMT"/> | ||
| 484 | <signal name="button_press_event" handler="on_treeview2_button_press_event" last_modification_time="Sun, 12 Jan 2003 15:57:58 GMT"/> | ||
| 485 | <signal name="key_press_event" handler="on_treeview2_key_press_event" last_modification_time="Sun, 12 Jan 2003 15:58:01 GMT"/> | ||
| 486 | </widget> | ||
| 487 | </child> | ||
| 488 | </widget> | ||
| 489 | <packing> | ||
| 490 | <property name="shrink">True</property> | ||
| 491 | <property name="resize">False</property> | ||
| 492 | </packing> | ||
| 493 | </child> | ||
| 494 | |||
| 495 | <child> | ||
| 496 | <widget class="GtkScrolledWindow" id="scrolledwindow3"> | ||
| 497 | <property name="visible">True</property> | ||
| 498 | <property name="hscrollbar_policy">GTK_POLICY_NEVER</property> | ||
| 499 | <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> | ||
| 500 | <property name="shadow_type">GTK_SHADOW_IN</property> | ||
| 501 | <property name="window_placement">GTK_CORNER_TOP_LEFT</property> | ||
| 502 | |||
| 503 | <child> | ||
| 504 | <widget class="GtkTextView" id="textview3"> | ||
| 505 | <property name="visible">True</property> | ||
| 506 | <property name="can_focus">True</property> | ||
| 507 | <property name="editable">False</property> | ||
| 508 | <property name="justification">GTK_JUSTIFY_LEFT</property> | ||
| 509 | <property name="wrap_mode">GTK_WRAP_WORD</property> | ||
| 510 | <property name="cursor_visible">True</property> | ||
| 511 | <property name="pixels_above_lines">0</property> | ||
| 512 | <property name="pixels_below_lines">0</property> | ||
| 513 | <property name="pixels_inside_wrap">0</property> | ||
| 514 | <property name="left_margin">0</property> | ||
| 515 | <property name="right_margin">0</property> | ||
| 516 | <property name="indent">0</property> | ||
| 517 | <property name="text" translatable="yes">Sorry, no help available for this option yet.</property> | ||
| 518 | </widget> | ||
| 519 | </child> | ||
| 520 | </widget> | ||
| 521 | <packing> | ||
| 522 | <property name="shrink">True</property> | ||
| 523 | <property name="resize">True</property> | ||
| 524 | </packing> | ||
| 525 | </child> | ||
| 526 | </widget> | ||
| 527 | <packing> | ||
| 528 | <property name="shrink">True</property> | ||
| 529 | <property name="resize">True</property> | ||
| 530 | </packing> | ||
| 531 | </child> | ||
| 532 | </widget> | ||
| 533 | <packing> | ||
| 534 | <property name="padding">0</property> | ||
| 535 | <property name="expand">True</property> | ||
| 536 | <property name="fill">True</property> | ||
| 537 | </packing> | ||
| 538 | </child> | ||
| 539 | </widget> | ||
| 540 | </child> | ||
| 541 | </widget> | ||
| 542 | |||
| 543 | </glade-interface> | ||
diff --git a/scripts/kconfig/images.c b/scripts/kconfig/images.c new file mode 100644 index 000000000000..d4f84bd4a96b --- /dev/null +++ b/scripts/kconfig/images.c | |||
| @@ -0,0 +1,326 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | static const char *xpm_load[] = { | ||
| 7 | "22 22 5 1", | ||
| 8 | ". c None", | ||
| 9 | "# c #000000", | ||
| 10 | "c c #838100", | ||
| 11 | "a c #ffff00", | ||
| 12 | "b c #ffffff", | ||
| 13 | "......................", | ||
| 14 | "......................", | ||
| 15 | "......................", | ||
| 16 | "............####....#.", | ||
| 17 | "...........#....##.##.", | ||
| 18 | "..................###.", | ||
| 19 | ".................####.", | ||
| 20 | ".####...........#####.", | ||
| 21 | "#abab##########.......", | ||
| 22 | "#babababababab#.......", | ||
| 23 | "#ababababababa#.......", | ||
| 24 | "#babababababab#.......", | ||
| 25 | "#ababab###############", | ||
| 26 | "#babab##cccccccccccc##", | ||
| 27 | "#abab##cccccccccccc##.", | ||
| 28 | "#bab##cccccccccccc##..", | ||
| 29 | "#ab##cccccccccccc##...", | ||
| 30 | "#b##cccccccccccc##....", | ||
| 31 | "###cccccccccccc##.....", | ||
| 32 | "##cccccccccccc##......", | ||
| 33 | "###############.......", | ||
| 34 | "......................"}; | ||
| 35 | |||
| 36 | static const char *xpm_save[] = { | ||
| 37 | "22 22 5 1", | ||
| 38 | ". c None", | ||
| 39 | "# c #000000", | ||
| 40 | "a c #838100", | ||
| 41 | "b c #c5c2c5", | ||
| 42 | "c c #cdb6d5", | ||
| 43 | "......................", | ||
| 44 | ".####################.", | ||
| 45 | ".#aa#bbbbbbbbbbbb#bb#.", | ||
| 46 | ".#aa#bbbbbbbbbbbb#bb#.", | ||
| 47 | ".#aa#bbbbbbbbbcbb####.", | ||
| 48 | ".#aa#bbbccbbbbbbb#aa#.", | ||
| 49 | ".#aa#bbbccbbbbbbb#aa#.", | ||
| 50 | ".#aa#bbbbbbbbbbbb#aa#.", | ||
| 51 | ".#aa#bbbbbbbbbbbb#aa#.", | ||
| 52 | ".#aa#bbbbbbbbbbbb#aa#.", | ||
| 53 | ".#aa#bbbbbbbbbbbb#aa#.", | ||
| 54 | ".#aaa############aaa#.", | ||
| 55 | ".#aaaaaaaaaaaaaaaaaa#.", | ||
| 56 | ".#aaaaaaaaaaaaaaaaaa#.", | ||
| 57 | ".#aaa#############aa#.", | ||
| 58 | ".#aaa#########bbb#aa#.", | ||
| 59 | ".#aaa#########bbb#aa#.", | ||
| 60 | ".#aaa#########bbb#aa#.", | ||
| 61 | ".#aaa#########bbb#aa#.", | ||
| 62 | ".#aaa#########bbb#aa#.", | ||
| 63 | "..##################..", | ||
| 64 | "......................"}; | ||
| 65 | |||
| 66 | static const char *xpm_back[] = { | ||
| 67 | "22 22 3 1", | ||
| 68 | ". c None", | ||
| 69 | "# c #000083", | ||
| 70 | "a c #838183", | ||
| 71 | "......................", | ||
| 72 | "......................", | ||
| 73 | "......................", | ||
| 74 | "......................", | ||
| 75 | "......................", | ||
| 76 | "...........######a....", | ||
| 77 | "..#......##########...", | ||
| 78 | "..##...####......##a..", | ||
| 79 | "..###.###.........##..", | ||
| 80 | "..######..........##..", | ||
| 81 | "..#####...........##..", | ||
| 82 | "..######..........##..", | ||
| 83 | "..#######.........##..", | ||
| 84 | "..########.......##a..", | ||
| 85 | "...............a###...", | ||
| 86 | "...............###....", | ||
| 87 | "......................", | ||
| 88 | "......................", | ||
| 89 | "......................", | ||
| 90 | "......................", | ||
| 91 | "......................", | ||
| 92 | "......................"}; | ||
| 93 | |||
| 94 | static const char *xpm_tree_view[] = { | ||
| 95 | "22 22 2 1", | ||
| 96 | ". c None", | ||
| 97 | "# c #000000", | ||
| 98 | "......................", | ||
| 99 | "......................", | ||
| 100 | "......#...............", | ||
| 101 | "......#...............", | ||
| 102 | "......#...............", | ||
| 103 | "......#...............", | ||
| 104 | "......#...............", | ||
| 105 | "......########........", | ||
| 106 | "......#...............", | ||
| 107 | "......#...............", | ||
| 108 | "......#...............", | ||
| 109 | "......#...............", | ||
| 110 | "......#...............", | ||
| 111 | "......########........", | ||
| 112 | "......#...............", | ||
| 113 | "......#...............", | ||
| 114 | "......#...............", | ||
| 115 | "......#...............", | ||
| 116 | "......#...............", | ||
| 117 | "......########........", | ||
| 118 | "......................", | ||
| 119 | "......................"}; | ||
| 120 | |||
| 121 | static const char *xpm_single_view[] = { | ||
| 122 | "22 22 2 1", | ||
| 123 | ". c None", | ||
| 124 | "# c #000000", | ||
| 125 | "......................", | ||
| 126 | "......................", | ||
| 127 | "..........#...........", | ||
| 128 | "..........#...........", | ||
| 129 | "..........#...........", | ||
| 130 | "..........#...........", | ||
| 131 | "..........#...........", | ||
| 132 | "..........#...........", | ||
| 133 | "..........#...........", | ||
| 134 | "..........#...........", | ||
| 135 | "..........#...........", | ||
| 136 | "..........#...........", | ||
| 137 | "..........#...........", | ||
| 138 | "..........#...........", | ||
| 139 | "..........#...........", | ||
| 140 | "..........#...........", | ||
| 141 | "..........#...........", | ||
| 142 | "..........#...........", | ||
| 143 | "..........#...........", | ||
| 144 | "..........#...........", | ||
| 145 | "......................", | ||
| 146 | "......................"}; | ||
| 147 | |||
| 148 | static const char *xpm_split_view[] = { | ||
| 149 | "22 22 2 1", | ||
| 150 | ". c None", | ||
| 151 | "# c #000000", | ||
| 152 | "......................", | ||
| 153 | "......................", | ||
| 154 | "......#......#........", | ||
| 155 | "......#......#........", | ||
| 156 | "......#......#........", | ||
| 157 | "......#......#........", | ||
| 158 | "......#......#........", | ||
| 159 | "......#......#........", | ||
| 160 | "......#......#........", | ||
| 161 | "......#......#........", | ||
| 162 | "......#......#........", | ||
| 163 | "......#......#........", | ||
| 164 | "......#......#........", | ||
| 165 | "......#......#........", | ||
| 166 | "......#......#........", | ||
| 167 | "......#......#........", | ||
| 168 | "......#......#........", | ||
| 169 | "......#......#........", | ||
| 170 | "......#......#........", | ||
| 171 | "......#......#........", | ||
| 172 | "......................", | ||
| 173 | "......................"}; | ||
| 174 | |||
| 175 | static const char *xpm_symbol_no[] = { | ||
| 176 | "12 12 2 1", | ||
| 177 | " c white", | ||
| 178 | ". c black", | ||
| 179 | " ", | ||
| 180 | " .......... ", | ||
| 181 | " . . ", | ||
| 182 | " . . ", | ||
| 183 | " . . ", | ||
| 184 | " . . ", | ||
| 185 | " . . ", | ||
| 186 | " . . ", | ||
| 187 | " . . ", | ||
| 188 | " . . ", | ||
| 189 | " .......... ", | ||
| 190 | " "}; | ||
| 191 | |||
| 192 | static const char *xpm_symbol_mod[] = { | ||
| 193 | "12 12 2 1", | ||
| 194 | " c white", | ||
| 195 | ". c black", | ||
| 196 | " ", | ||
| 197 | " .......... ", | ||
| 198 | " . . ", | ||
| 199 | " . . ", | ||
| 200 | " . .. . ", | ||
| 201 | " . .... . ", | ||
| 202 | " . .... . ", | ||
| 203 | " . .. . ", | ||
| 204 | " . . ", | ||
| 205 | " . . ", | ||
| 206 | " .......... ", | ||
| 207 | " "}; | ||
| 208 | |||
| 209 | static const char *xpm_symbol_yes[] = { | ||
| 210 | "12 12 2 1", | ||
| 211 | " c white", | ||
| 212 | ". c black", | ||
| 213 | " ", | ||
| 214 | " .......... ", | ||
| 215 | " . . ", | ||
| 216 | " . . ", | ||
| 217 | " . . . ", | ||
| 218 | " . .. . ", | ||
| 219 | " . . .. . ", | ||
| 220 | " . .... . ", | ||
| 221 | " . .. . ", | ||
| 222 | " . . ", | ||
| 223 | " .......... ", | ||
| 224 | " "}; | ||
| 225 | |||
| 226 | static const char *xpm_choice_no[] = { | ||
| 227 | "12 12 2 1", | ||
| 228 | " c white", | ||
| 229 | ". c black", | ||
| 230 | " ", | ||
| 231 | " .... ", | ||
| 232 | " .. .. ", | ||
| 233 | " . . ", | ||
| 234 | " . . ", | ||
| 235 | " . . ", | ||
| 236 | " . . ", | ||
| 237 | " . . ", | ||
| 238 | " . . ", | ||
| 239 | " .. .. ", | ||
| 240 | " .... ", | ||
| 241 | " "}; | ||
| 242 | |||
| 243 | static const char *xpm_choice_yes[] = { | ||
| 244 | "12 12 2 1", | ||
| 245 | " c white", | ||
| 246 | ". c black", | ||
| 247 | " ", | ||
| 248 | " .... ", | ||
| 249 | " .. .. ", | ||
| 250 | " . . ", | ||
| 251 | " . .. . ", | ||
| 252 | " . .... . ", | ||
| 253 | " . .... . ", | ||
| 254 | " . .. . ", | ||
| 255 | " . . ", | ||
| 256 | " .. .. ", | ||
| 257 | " .... ", | ||
| 258 | " "}; | ||
| 259 | |||
| 260 | static const char *xpm_menu[] = { | ||
| 261 | "12 12 2 1", | ||
| 262 | " c white", | ||
| 263 | ". c black", | ||
| 264 | " ", | ||
| 265 | " .......... ", | ||
| 266 | " . . ", | ||
| 267 | " . .. . ", | ||
| 268 | " . .... . ", | ||
| 269 | " . ...... . ", | ||
| 270 | " . ...... . ", | ||
| 271 | " . .... . ", | ||
| 272 | " . .. . ", | ||
| 273 | " . . ", | ||
| 274 | " .......... ", | ||
| 275 | " "}; | ||
| 276 | |||
| 277 | static const char *xpm_menu_inv[] = { | ||
| 278 | "12 12 2 1", | ||
| 279 | " c white", | ||
| 280 | ". c black", | ||
| 281 | " ", | ||
| 282 | " .......... ", | ||
| 283 | " .......... ", | ||
| 284 | " .. ...... ", | ||
| 285 | " .. .... ", | ||
| 286 | " .. .. ", | ||
| 287 | " .. .. ", | ||
| 288 | " .. .... ", | ||
| 289 | " .. ...... ", | ||
| 290 | " .......... ", | ||
| 291 | " .......... ", | ||
| 292 | " "}; | ||
| 293 | |||
| 294 | static const char *xpm_menuback[] = { | ||
| 295 | "12 12 2 1", | ||
| 296 | " c white", | ||
| 297 | ". c black", | ||
| 298 | " ", | ||
| 299 | " .......... ", | ||
| 300 | " . . ", | ||
| 301 | " . .. . ", | ||
| 302 | " . .... . ", | ||
| 303 | " . ...... . ", | ||
| 304 | " . ...... . ", | ||
| 305 | " . .... . ", | ||
| 306 | " . .. . ", | ||
| 307 | " . . ", | ||
| 308 | " .......... ", | ||
| 309 | " "}; | ||
| 310 | |||
| 311 | static const char *xpm_void[] = { | ||
| 312 | "12 12 2 1", | ||
| 313 | " c white", | ||
| 314 | ". c black", | ||
| 315 | " ", | ||
| 316 | " ", | ||
| 317 | " ", | ||
| 318 | " ", | ||
| 319 | " ", | ||
| 320 | " ", | ||
| 321 | " ", | ||
| 322 | " ", | ||
| 323 | " ", | ||
| 324 | " ", | ||
| 325 | " ", | ||
| 326 | " "}; | ||
diff --git a/scripts/kconfig/kconfig_load.c b/scripts/kconfig/kconfig_load.c new file mode 100644 index 000000000000..dbdcaad82325 --- /dev/null +++ b/scripts/kconfig/kconfig_load.c | |||
| @@ -0,0 +1,35 @@ | |||
| 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/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped new file mode 100644 index 000000000000..22dda11f758b --- /dev/null +++ b/scripts/kconfig/lex.zconf.c_shipped | |||
| @@ -0,0 +1,3688 @@ | |||
| 1 | |||
| 2 | #line 3 "lex.zconf.c" | ||
| 3 | |||
| 4 | #define YY_INT_ALIGNED short int | ||
| 5 | |||
| 6 | /* A lexical scanner generated by flex */ | ||
| 7 | |||
| 8 | #define FLEX_SCANNER | ||
| 9 | #define YY_FLEX_MAJOR_VERSION 2 | ||
| 10 | #define YY_FLEX_MINOR_VERSION 5 | ||
| 11 | #define YY_FLEX_SUBMINOR_VERSION 31 | ||
| 12 | #if YY_FLEX_SUBMINOR_VERSION > 0 | ||
| 13 | #define FLEX_BETA | ||
| 14 | #endif | ||
| 15 | |||
| 16 | /* First, we deal with platform-specific or compiler-specific issues. */ | ||
| 17 | |||
| 18 | /* begin standard C headers. */ | ||
| 19 | #include <stdio.h> | ||
| 20 | #include <string.h> | ||
| 21 | #include <errno.h> | ||
| 22 | #include <stdlib.h> | ||
| 23 | |||
| 24 | /* end standard C headers. */ | ||
| 25 | |||
| 26 | /* flex integer type definitions */ | ||
| 27 | |||
| 28 | #ifndef FLEXINT_H | ||
| 29 | #define FLEXINT_H | ||
| 30 | |||
| 31 | /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ | ||
| 32 | |||
| 33 | #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L | ||
| 34 | #include <inttypes.h> | ||
| 35 | typedef int8_t flex_int8_t; | ||
| 36 | typedef uint8_t flex_uint8_t; | ||
| 37 | typedef int16_t flex_int16_t; | ||
| 38 | typedef uint16_t flex_uint16_t; | ||
| 39 | typedef int32_t flex_int32_t; | ||
| 40 | typedef uint32_t flex_uint32_t; | ||
| 41 | #else | ||
| 42 | typedef signed char flex_int8_t; | ||
| 43 | typedef short int flex_int16_t; | ||
| 44 | typedef int flex_int32_t; | ||
| 45 | typedef unsigned char flex_uint8_t; | ||
| 46 | typedef unsigned short int flex_uint16_t; | ||
| 47 | typedef unsigned int flex_uint32_t; | ||
| 48 | #endif /* ! C99 */ | ||
| 49 | |||
| 50 | /* Limits of integral types. */ | ||
| 51 | #ifndef INT8_MIN | ||
| 52 | #define INT8_MIN (-128) | ||
| 53 | #endif | ||
| 54 | #ifndef INT16_MIN | ||
| 55 | #define INT16_MIN (-32767-1) | ||
| 56 | #endif | ||
| 57 | #ifndef INT32_MIN | ||
| 58 | #define INT32_MIN (-2147483647-1) | ||
| 59 | #endif | ||
| 60 | #ifndef INT8_MAX | ||
| 61 | #define INT8_MAX (127) | ||
| 62 | #endif | ||
| 63 | #ifndef INT16_MAX | ||
| 64 | #define INT16_MAX (32767) | ||
| 65 | #endif | ||
| 66 | #ifndef INT32_MAX | ||
| 67 | #define INT32_MAX (2147483647) | ||
| 68 | #endif | ||
| 69 | #ifndef UINT8_MAX | ||
| 70 | #define UINT8_MAX (255U) | ||
| 71 | #endif | ||
| 72 | #ifndef UINT16_MAX | ||
| 73 | #define UINT16_MAX (65535U) | ||
| 74 | #endif | ||
| 75 | #ifndef UINT32_MAX | ||
| 76 | #define UINT32_MAX (4294967295U) | ||
| 77 | #endif | ||
| 78 | |||
| 79 | #endif /* ! FLEXINT_H */ | ||
| 80 | |||
| 81 | #ifdef __cplusplus | ||
| 82 | |||
| 83 | /* The "const" storage-class-modifier is valid. */ | ||
| 84 | #define YY_USE_CONST | ||
| 85 | |||
| 86 | #else /* ! __cplusplus */ | ||
| 87 | |||
| 88 | #if __STDC__ | ||
| 89 | |||
| 90 | #define YY_USE_CONST | ||
| 91 | |||
| 92 | #endif /* __STDC__ */ | ||
| 93 | #endif /* ! __cplusplus */ | ||
| 94 | |||
| 95 | #ifdef YY_USE_CONST | ||
| 96 | #define yyconst const | ||
| 97 | #else | ||
| 98 | #define yyconst | ||
| 99 | #endif | ||
| 100 | |||
| 101 | /* Returned upon end-of-file. */ | ||
| 102 | #define YY_NULL 0 | ||
| 103 | |||
| 104 | /* Promotes a possibly negative, possibly signed char to an unsigned | ||
| 105 | * integer for use as an array index. If the signed char is negative, | ||
| 106 | * we want to instead treat it as an 8-bit unsigned char, hence the | ||
| 107 | * double cast. | ||
| 108 | */ | ||
| 109 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | ||
| 110 | |||
| 111 | /* Enter a start condition. This macro really ought to take a parameter, | ||
| 112 | * but we do it the disgusting crufty way forced on us by the ()-less | ||
| 113 | * definition of BEGIN. | ||
| 114 | */ | ||
| 115 | #define BEGIN (yy_start) = 1 + 2 * | ||
| 116 | |||
| 117 | /* Translate the current start state into a value that can be later handed | ||
| 118 | * to BEGIN to return to the state. The YYSTATE alias is for lex | ||
| 119 | * compatibility. | ||
| 120 | */ | ||
| 121 | #define YY_START (((yy_start) - 1) / 2) | ||
| 122 | #define YYSTATE YY_START | ||
| 123 | |||
| 124 | /* Action number for EOF rule of a given start state. */ | ||
| 125 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | ||
| 126 | |||
| 127 | /* Special action meaning "start processing a new file". */ | ||
| 128 | #define YY_NEW_FILE zconfrestart(zconfin ) | ||
| 129 | |||
| 130 | #define YY_END_OF_BUFFER_CHAR 0 | ||
| 131 | |||
| 132 | /* Size of default input buffer. */ | ||
| 133 | #ifndef YY_BUF_SIZE | ||
| 134 | #define YY_BUF_SIZE 16384 | ||
| 135 | #endif | ||
| 136 | |||
| 137 | #ifndef YY_TYPEDEF_YY_BUFFER_STATE | ||
| 138 | #define YY_TYPEDEF_YY_BUFFER_STATE | ||
| 139 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
| 140 | #endif | ||
| 141 | |||
| 142 | extern int zconfleng; | ||
| 143 | |||
| 144 | extern FILE *zconfin, *zconfout; | ||
| 145 | |||
| 146 | #define EOB_ACT_CONTINUE_SCAN 0 | ||
| 147 | #define EOB_ACT_END_OF_FILE 1 | ||
| 148 | #define EOB_ACT_LAST_MATCH 2 | ||
| 149 | |||
| 150 | #define YY_LESS_LINENO(n) | ||
| 151 | |||
| 152 | /* Return all but the first "n" matched characters back to the input stream. */ | ||
| 153 | #define yyless(n) \ | ||
| 154 | do \ | ||
| 155 | { \ | ||
| 156 | /* Undo effects of setting up zconftext. */ \ | ||
| 157 | int yyless_macro_arg = (n); \ | ||
| 158 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
| 159 | *yy_cp = (yy_hold_char); \ | ||
| 160 | YY_RESTORE_YY_MORE_OFFSET \ | ||
| 161 | (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ | ||
| 162 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ \ | ||
| 163 | } \ | ||
| 164 | while ( 0 ) | ||
| 165 | |||
| 166 | #define unput(c) yyunput( c, (yytext_ptr) ) | ||
| 167 | |||
| 168 | /* The following is because we cannot portably get our hands on size_t | ||
| 169 | * (without autoconf's help, which isn't available because we want | ||
| 170 | * flex-generated scanners to compile on their own). | ||
| 171 | */ | ||
| 172 | |||
| 173 | #ifndef YY_TYPEDEF_YY_SIZE_T | ||
| 174 | #define YY_TYPEDEF_YY_SIZE_T | ||
| 175 | typedef unsigned int yy_size_t; | ||
| 176 | #endif | ||
| 177 | |||
| 178 | #ifndef YY_STRUCT_YY_BUFFER_STATE | ||
| 179 | #define YY_STRUCT_YY_BUFFER_STATE | ||
| 180 | struct yy_buffer_state | ||
| 181 | { | ||
| 182 | FILE *yy_input_file; | ||
| 183 | |||
| 184 | char *yy_ch_buf; /* input buffer */ | ||
| 185 | char *yy_buf_pos; /* current position in input buffer */ | ||
| 186 | |||
| 187 | /* Size of input buffer in bytes, not including room for EOB | ||
| 188 | * characters. | ||
| 189 | */ | ||
| 190 | yy_size_t yy_buf_size; | ||
| 191 | |||
| 192 | /* Number of characters read into yy_ch_buf, not including EOB | ||
| 193 | * characters. | ||
| 194 | */ | ||
| 195 | int yy_n_chars; | ||
| 196 | |||
| 197 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
| 198 | * and can realloc() it to grow it, and should free() it to | ||
| 199 | * delete it. | ||
| 200 | */ | ||
| 201 | int yy_is_our_buffer; | ||
| 202 | |||
| 203 | /* Whether this is an "interactive" input source; if so, and | ||
| 204 | * if we're using stdio for input, then we want to use getc() | ||
| 205 | * instead of fread(), to make sure we stop fetching input after | ||
| 206 | * each newline. | ||
| 207 | */ | ||
| 208 | int yy_is_interactive; | ||
| 209 | |||
| 210 | /* Whether we're considered to be at the beginning of a line. | ||
| 211 | * If so, '^' rules will be active on the next match, otherwise | ||
| 212 | * not. | ||
| 213 | */ | ||
| 214 | int yy_at_bol; | ||
| 215 | |||
| 216 | int yy_bs_lineno; /**< The line count. */ | ||
| 217 | int yy_bs_column; /**< The column count. */ | ||
| 218 | |||
| 219 | /* Whether to try to fill the input buffer when we reach the | ||
| 220 | * end of it. | ||
| 221 | */ | ||
| 222 | int yy_fill_buffer; | ||
| 223 | |||
| 224 | int yy_buffer_status; | ||
| 225 | |||
| 226 | #define YY_BUFFER_NEW 0 | ||
| 227 | #define YY_BUFFER_NORMAL 1 | ||
| 228 | /* When an EOF's been seen but there's still some text to process | ||
| 229 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | ||
| 230 | * shouldn't try reading from the input source any more. We might | ||
| 231 | * still have a bunch of tokens to match, though, because of | ||
| 232 | * possible backing-up. | ||
| 233 | * | ||
| 234 | * When we actually see the EOF, we change the status to "new" | ||
| 235 | * (via zconfrestart()), so that the user can continue scanning by | ||
| 236 | * just pointing zconfin at a new input file. | ||
| 237 | */ | ||
| 238 | #define YY_BUFFER_EOF_PENDING 2 | ||
| 239 | |||
| 240 | }; | ||
| 241 | #endif /* !YY_STRUCT_YY_BUFFER_STATE */ | ||
| 242 | |||
| 243 | /* Stack of input buffers. */ | ||
| 244 | static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ | ||
| 245 | static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ | ||
| 246 | static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ | ||
| 247 | |||
| 248 | /* We provide macros for accessing buffer states in case in the | ||
| 249 | * future we want to put the buffer states in a more general | ||
| 250 | * "scanner state". | ||
| 251 | * | ||
| 252 | * Returns the top of the stack, or NULL. | ||
| 253 | */ | ||
| 254 | #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ | ||
| 255 | ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ | ||
| 256 | : NULL) | ||
| 257 | |||
| 258 | /* Same as previous macro, but useful when we know that the buffer stack is not | ||
| 259 | * NULL or when we need an lvalue. For internal use only. | ||
| 260 | */ | ||
| 261 | #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] | ||
| 262 | |||
| 263 | /* yy_hold_char holds the character lost when zconftext is formed. */ | ||
| 264 | static char yy_hold_char; | ||
| 265 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | ||
| 266 | int zconfleng; | ||
| 267 | |||
| 268 | /* Points to current character in buffer. */ | ||
| 269 | static char *yy_c_buf_p = (char *) 0; | ||
| 270 | static int yy_init = 1; /* whether we need to initialize */ | ||
| 271 | static int yy_start = 0; /* start state number */ | ||
| 272 | |||
| 273 | /* Flag which is used to allow zconfwrap()'s to do buffer switches | ||
| 274 | * instead of setting up a fresh zconfin. A bit of a hack ... | ||
| 275 | */ | ||
| 276 | static int yy_did_buffer_switch_on_eof; | ||
| 277 | |||
| 278 | void zconfrestart (FILE *input_file ); | ||
| 279 | void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer ); | ||
| 280 | YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size ); | ||
| 281 | void zconf_delete_buffer (YY_BUFFER_STATE b ); | ||
| 282 | void zconf_flush_buffer (YY_BUFFER_STATE b ); | ||
| 283 | void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer ); | ||
| 284 | void zconfpop_buffer_state (void ); | ||
| 285 | |||
| 286 | static void zconfensure_buffer_stack (void ); | ||
| 287 | static void zconf_load_buffer_state (void ); | ||
| 288 | static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file ); | ||
| 289 | |||
| 290 | #define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER ) | ||
| 291 | |||
| 292 | YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size ); | ||
| 293 | YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str ); | ||
| 294 | YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len ); | ||
| 295 | |||
| 296 | void *zconfalloc (yy_size_t ); | ||
| 297 | void *zconfrealloc (void *,yy_size_t ); | ||
| 298 | void zconffree (void * ); | ||
| 299 | |||
| 300 | #define yy_new_buffer zconf_create_buffer | ||
| 301 | |||
| 302 | #define yy_set_interactive(is_interactive) \ | ||
| 303 | { \ | ||
| 304 | if ( ! YY_CURRENT_BUFFER ){ \ | ||
| 305 | zconfensure_buffer_stack (); \ | ||
| 306 | YY_CURRENT_BUFFER_LVALUE = \ | ||
| 307 | zconf_create_buffer(zconfin,YY_BUF_SIZE ); \ | ||
| 308 | } \ | ||
| 309 | YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ | ||
| 310 | } | ||
| 311 | |||
| 312 | #define yy_set_bol(at_bol) \ | ||
| 313 | { \ | ||
| 314 | if ( ! YY_CURRENT_BUFFER ){\ | ||
| 315 | zconfensure_buffer_stack (); \ | ||
| 316 | YY_CURRENT_BUFFER_LVALUE = \ | ||
| 317 | zconf_create_buffer(zconfin,YY_BUF_SIZE ); \ | ||
| 318 | } \ | ||
| 319 | YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ | ||
| 320 | } | ||
| 321 | |||
| 322 | #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) | ||
| 323 | |||
| 324 | /* Begin user sect3 */ | ||
| 325 | |||
| 326 | #define zconfwrap(n) 1 | ||
| 327 | #define YY_SKIP_YYWRAP | ||
| 328 | |||
| 329 | typedef unsigned char YY_CHAR; | ||
| 330 | |||
| 331 | FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0; | ||
| 332 | |||
| 333 | typedef int yy_state_type; | ||
| 334 | |||
| 335 | extern int zconflineno; | ||
| 336 | |||
| 337 | int zconflineno = 1; | ||
| 338 | |||
| 339 | extern char *zconftext; | ||
| 340 | #define yytext_ptr zconftext | ||
| 341 | static yyconst flex_int16_t yy_nxt[][38] = | ||
| 342 | { | ||
| 343 | { | ||
| 344 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 345 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 346 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 347 | 0, 0, 0, 0, 0, 0, 0, 0 | ||
| 348 | }, | ||
| 349 | |||
| 350 | { | ||
| 351 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, | ||
| 352 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
| 353 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
| 354 | 12, 12, 12, 12, 12, 12, 12, 12 | ||
| 355 | }, | ||
| 356 | |||
| 357 | { | ||
| 358 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, | ||
| 359 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
| 360 | |||
| 361 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
| 362 | 12, 12, 12, 12, 12, 12, 12, 12 | ||
| 363 | }, | ||
| 364 | |||
| 365 | { | ||
| 366 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, | ||
| 367 | 16, 16, 16, 18, 16, 16, 18, 18, 19, 20, | ||
| 368 | 21, 22, 18, 18, 23, 24, 18, 25, 18, 26, | ||
| 369 | 27, 18, 28, 29, 30, 18, 18, 16 | ||
| 370 | }, | ||
| 371 | |||
| 372 | { | ||
| 373 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, | ||
| 374 | 16, 16, 16, 18, 16, 16, 18, 18, 19, 20, | ||
| 375 | 21, 22, 18, 18, 23, 24, 18, 25, 18, 26, | ||
| 376 | 27, 18, 28, 29, 30, 18, 18, 16 | ||
| 377 | |||
| 378 | }, | ||
| 379 | |||
| 380 | { | ||
| 381 | 11, 31, 32, 33, 31, 31, 31, 31, 31, 31, | ||
| 382 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | ||
| 383 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | ||
| 384 | 31, 31, 31, 31, 31, 31, 31, 31 | ||
| 385 | }, | ||
| 386 | |||
| 387 | { | ||
| 388 | 11, 31, 32, 33, 31, 31, 31, 31, 31, 31, | ||
| 389 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | ||
| 390 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | ||
| 391 | 31, 31, 31, 31, 31, 31, 31, 31 | ||
| 392 | }, | ||
| 393 | |||
| 394 | { | ||
| 395 | 11, 34, 34, 35, 34, 36, 34, 34, 36, 34, | ||
| 396 | 34, 34, 34, 34, 34, 37, 34, 34, 34, 34, | ||
| 397 | |||
| 398 | 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, | ||
| 399 | 34, 34, 34, 34, 34, 34, 34, 34 | ||
| 400 | }, | ||
| 401 | |||
| 402 | { | ||
| 403 | 11, 34, 34, 35, 34, 36, 34, 34, 36, 34, | ||
| 404 | 34, 34, 34, 34, 34, 37, 34, 34, 34, 34, | ||
| 405 | 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, | ||
| 406 | 34, 34, 34, 34, 34, 34, 34, 34 | ||
| 407 | }, | ||
| 408 | |||
| 409 | { | ||
| 410 | 11, 38, 38, 39, 40, 41, 42, 43, 41, 44, | ||
| 411 | 45, 46, 47, 47, 48, 49, 47, 47, 47, 47, | ||
| 412 | 47, 47, 47, 47, 47, 50, 47, 47, 47, 51, | ||
| 413 | 47, 47, 47, 47, 47, 47, 47, 52 | ||
| 414 | |||
| 415 | }, | ||
| 416 | |||
| 417 | { | ||
| 418 | 11, 38, 38, 39, 40, 41, 42, 43, 41, 44, | ||
| 419 | 45, 46, 47, 47, 48, 49, 47, 47, 47, 47, | ||
| 420 | 47, 47, 47, 47, 47, 50, 47, 47, 47, 51, | ||
| 421 | 47, 47, 47, 47, 47, 47, 47, 52 | ||
| 422 | }, | ||
| 423 | |||
| 424 | { | ||
| 425 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, | ||
| 426 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, | ||
| 427 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, | ||
| 428 | -11, -11, -11, -11, -11, -11, -11, -11 | ||
| 429 | }, | ||
| 430 | |||
| 431 | { | ||
| 432 | 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, | ||
| 433 | -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, | ||
| 434 | |||
| 435 | -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, | ||
| 436 | -12, -12, -12, -12, -12, -12, -12, -12 | ||
| 437 | }, | ||
| 438 | |||
| 439 | { | ||
| 440 | 11, -13, 53, 54, -13, -13, 55, -13, -13, -13, | ||
| 441 | -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, | ||
| 442 | -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, | ||
| 443 | -13, -13, -13, -13, -13, -13, -13, -13 | ||
| 444 | }, | ||
| 445 | |||
| 446 | { | ||
| 447 | 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, | ||
| 448 | -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, | ||
| 449 | -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, | ||
| 450 | -14, -14, -14, -14, -14, -14, -14, -14 | ||
| 451 | |||
| 452 | }, | ||
| 453 | |||
| 454 | { | ||
| 455 | 11, 56, 56, 57, 56, 56, 56, 56, 56, 56, | ||
| 456 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 457 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 458 | 56, 56, 56, 56, 56, 56, 56, 56 | ||
| 459 | }, | ||
| 460 | |||
| 461 | { | ||
| 462 | 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, | ||
| 463 | -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, | ||
| 464 | -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, | ||
| 465 | -16, -16, -16, -16, -16, -16, -16, -16 | ||
| 466 | }, | ||
| 467 | |||
| 468 | { | ||
| 469 | 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, | ||
| 470 | -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, | ||
| 471 | |||
| 472 | -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, | ||
| 473 | -17, -17, -17, -17, -17, -17, -17, -17 | ||
| 474 | }, | ||
| 475 | |||
| 476 | { | ||
| 477 | 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, | ||
| 478 | -18, -18, -18, 58, -18, -18, 58, 58, 58, 58, | ||
| 479 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 480 | 58, 58, 58, 58, 58, 58, 58, -18 | ||
| 481 | }, | ||
| 482 | |||
| 483 | { | ||
| 484 | 11, -19, -19, -19, -19, -19, -19, -19, -19, -19, | ||
| 485 | -19, -19, -19, 58, -19, -19, 58, 58, 58, 58, | ||
| 486 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 59, | ||
| 487 | 58, 58, 58, 58, 58, 58, 58, -19 | ||
| 488 | |||
| 489 | }, | ||
| 490 | |||
| 491 | { | ||
| 492 | 11, -20, -20, -20, -20, -20, -20, -20, -20, -20, | ||
| 493 | -20, -20, -20, 58, -20, -20, 58, 58, 58, 58, | ||
| 494 | 58, 58, 58, 58, 60, 58, 58, 58, 58, 61, | ||
| 495 | 58, 58, 58, 58, 58, 58, 58, -20 | ||
| 496 | }, | ||
| 497 | |||
| 498 | { | ||
| 499 | 11, -21, -21, -21, -21, -21, -21, -21, -21, -21, | ||
| 500 | -21, -21, -21, 58, -21, -21, 58, 58, 58, 58, | ||
| 501 | 58, 62, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 502 | 58, 58, 58, 58, 58, 58, 58, -21 | ||
| 503 | }, | ||
| 504 | |||
| 505 | { | ||
| 506 | 11, -22, -22, -22, -22, -22, -22, -22, -22, -22, | ||
| 507 | -22, -22, -22, 58, -22, -22, 58, 58, 58, 58, | ||
| 508 | |||
| 509 | 58, 58, 58, 58, 58, 58, 58, 58, 63, 58, | ||
| 510 | 58, 58, 58, 58, 58, 58, 58, -22 | ||
| 511 | }, | ||
| 512 | |||
| 513 | { | ||
| 514 | 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, | ||
| 515 | -23, -23, -23, 58, -23, -23, 58, 58, 58, 58, | ||
| 516 | 58, 64, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 517 | 58, 58, 58, 58, 58, 58, 58, -23 | ||
| 518 | }, | ||
| 519 | |||
| 520 | { | ||
| 521 | 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, | ||
| 522 | -24, -24, -24, 58, -24, -24, 58, 58, 58, 58, | ||
| 523 | 58, 58, 65, 58, 58, 58, 58, 58, 66, 58, | ||
| 524 | 58, 58, 58, 58, 58, 58, 58, -24 | ||
| 525 | |||
| 526 | }, | ||
| 527 | |||
| 528 | { | ||
| 529 | 11, -25, -25, -25, -25, -25, -25, -25, -25, -25, | ||
| 530 | -25, -25, -25, 58, -25, -25, 58, 67, 58, 58, | ||
| 531 | 58, 68, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 532 | 58, 58, 58, 58, 58, 58, 58, -25 | ||
| 533 | }, | ||
| 534 | |||
| 535 | { | ||
| 536 | 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, | ||
| 537 | -26, -26, -26, 58, -26, -26, 58, 58, 58, 58, | ||
| 538 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 539 | 69, 58, 58, 58, 58, 58, 58, -26 | ||
| 540 | }, | ||
| 541 | |||
| 542 | { | ||
| 543 | 11, -27, -27, -27, -27, -27, -27, -27, -27, -27, | ||
| 544 | -27, -27, -27, 58, -27, -27, 58, 58, 58, 58, | ||
| 545 | |||
| 546 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 547 | 58, 58, 70, 58, 58, 58, 58, -27 | ||
| 548 | }, | ||
| 549 | |||
| 550 | { | ||
| 551 | 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, | ||
| 552 | -28, -28, -28, 58, -28, -28, 58, 71, 58, 58, | ||
| 553 | 58, 72, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 554 | 58, 58, 58, 58, 58, 58, 58, -28 | ||
| 555 | }, | ||
| 556 | |||
| 557 | { | ||
| 558 | 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, | ||
| 559 | -29, -29, -29, 58, -29, -29, 58, 58, 58, 58, | ||
| 560 | 58, 73, 58, 58, 58, 58, 58, 58, 58, 74, | ||
| 561 | 58, 58, 58, 58, 75, 58, 58, -29 | ||
| 562 | |||
| 563 | }, | ||
| 564 | |||
| 565 | { | ||
| 566 | 11, -30, -30, -30, -30, -30, -30, -30, -30, -30, | ||
| 567 | -30, -30, -30, 58, -30, -30, 58, 58, 58, 58, | ||
| 568 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 569 | 58, 58, 76, 58, 58, 58, 58, -30 | ||
| 570 | }, | ||
| 571 | |||
| 572 | { | ||
| 573 | 11, 77, 77, -31, 77, 77, 77, 77, 77, 77, | ||
| 574 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
| 575 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
| 576 | 77, 77, 77, 77, 77, 77, 77, 77 | ||
| 577 | }, | ||
| 578 | |||
| 579 | { | ||
| 580 | 11, -32, 78, 79, -32, -32, -32, -32, -32, -32, | ||
| 581 | -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, | ||
| 582 | |||
| 583 | -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, | ||
| 584 | -32, -32, -32, -32, -32, -32, -32, -32 | ||
| 585 | }, | ||
| 586 | |||
| 587 | { | ||
| 588 | 11, 80, -33, -33, 80, 80, 80, 80, 80, 80, | ||
| 589 | 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, | ||
| 590 | 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, | ||
| 591 | 80, 80, 80, 80, 80, 80, 80, 80 | ||
| 592 | }, | ||
| 593 | |||
| 594 | { | ||
| 595 | 11, 81, 81, 82, 81, -34, 81, 81, -34, 81, | ||
| 596 | 81, 81, 81, 81, 81, -34, 81, 81, 81, 81, | ||
| 597 | 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, | ||
| 598 | 81, 81, 81, 81, 81, 81, 81, 81 | ||
| 599 | |||
| 600 | }, | ||
| 601 | |||
| 602 | { | ||
| 603 | 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, | ||
| 604 | -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, | ||
| 605 | -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, | ||
| 606 | -35, -35, -35, -35, -35, -35, -35, -35 | ||
| 607 | }, | ||
| 608 | |||
| 609 | { | ||
| 610 | 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, | ||
| 611 | -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, | ||
| 612 | -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, | ||
| 613 | -36, -36, -36, -36, -36, -36, -36, -36 | ||
| 614 | }, | ||
| 615 | |||
| 616 | { | ||
| 617 | 11, 83, 83, 84, 83, 83, 83, 83, 83, 83, | ||
| 618 | 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, | ||
| 619 | |||
| 620 | 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, | ||
| 621 | 83, 83, 83, 83, 83, 83, 83, 83 | ||
| 622 | }, | ||
| 623 | |||
| 624 | { | ||
| 625 | 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, | ||
| 626 | -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, | ||
| 627 | -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, | ||
| 628 | -38, -38, -38, -38, -38, -38, -38, -38 | ||
| 629 | }, | ||
| 630 | |||
| 631 | { | ||
| 632 | 11, -39, -39, -39, -39, -39, -39, -39, -39, -39, | ||
| 633 | -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, | ||
| 634 | -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, | ||
| 635 | -39, -39, -39, -39, -39, -39, -39, -39 | ||
| 636 | |||
| 637 | }, | ||
| 638 | |||
| 639 | { | ||
| 640 | 11, -40, -40, -40, -40, -40, -40, -40, -40, -40, | ||
| 641 | -40, -40, -40, -40, 85, -40, -40, -40, -40, -40, | ||
| 642 | -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, | ||
| 643 | -40, -40, -40, -40, -40, -40, -40, -40 | ||
| 644 | }, | ||
| 645 | |||
| 646 | { | ||
| 647 | 11, -41, -41, -41, -41, -41, -41, -41, -41, -41, | ||
| 648 | -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, | ||
| 649 | -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, | ||
| 650 | -41, -41, -41, -41, -41, -41, -41, -41 | ||
| 651 | }, | ||
| 652 | |||
| 653 | { | ||
| 654 | 11, 86, 86, -42, 86, 86, 86, 86, 86, 86, | ||
| 655 | 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, | ||
| 656 | |||
| 657 | 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, | ||
| 658 | 86, 86, 86, 86, 86, 86, 86, 86 | ||
| 659 | }, | ||
| 660 | |||
| 661 | { | ||
| 662 | 11, -43, -43, -43, -43, -43, -43, 87, -43, -43, | ||
| 663 | -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, | ||
| 664 | -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, | ||
| 665 | -43, -43, -43, -43, -43, -43, -43, -43 | ||
| 666 | }, | ||
| 667 | |||
| 668 | { | ||
| 669 | 11, -44, -44, -44, -44, -44, -44, -44, -44, -44, | ||
| 670 | -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, | ||
| 671 | -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, | ||
| 672 | -44, -44, -44, -44, -44, -44, -44, -44 | ||
| 673 | |||
| 674 | }, | ||
| 675 | |||
| 676 | { | ||
| 677 | 11, -45, -45, -45, -45, -45, -45, -45, -45, -45, | ||
| 678 | -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, | ||
| 679 | -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, | ||
| 680 | -45, -45, -45, -45, -45, -45, -45, -45 | ||
| 681 | }, | ||
| 682 | |||
| 683 | { | ||
| 684 | 11, -46, -46, -46, -46, -46, -46, -46, -46, -46, | ||
| 685 | -46, 88, 89, 89, -46, -46, 89, 89, 89, 89, | ||
| 686 | 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, | ||
| 687 | 89, 89, 89, 89, 89, 89, 89, -46 | ||
| 688 | }, | ||
| 689 | |||
| 690 | { | ||
| 691 | 11, -47, -47, -47, -47, -47, -47, -47, -47, -47, | ||
| 692 | -47, 89, 89, 89, -47, -47, 89, 89, 89, 89, | ||
| 693 | |||
| 694 | 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, | ||
| 695 | 89, 89, 89, 89, 89, 89, 89, -47 | ||
| 696 | }, | ||
| 697 | |||
| 698 | { | ||
| 699 | 11, -48, -48, -48, -48, -48, -48, -48, -48, -48, | ||
| 700 | -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, | ||
| 701 | -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, | ||
| 702 | -48, -48, -48, -48, -48, -48, -48, -48 | ||
| 703 | }, | ||
| 704 | |||
| 705 | { | ||
| 706 | 11, -49, -49, 90, -49, -49, -49, -49, -49, -49, | ||
| 707 | -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, | ||
| 708 | -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, | ||
| 709 | -49, -49, -49, -49, -49, -49, -49, -49 | ||
| 710 | |||
| 711 | }, | ||
| 712 | |||
| 713 | { | ||
| 714 | 11, -50, -50, -50, -50, -50, -50, -50, -50, -50, | ||
| 715 | -50, 89, 89, 89, -50, -50, 89, 89, 89, 89, | ||
| 716 | 89, 89, 91, 89, 89, 89, 89, 89, 89, 89, | ||
| 717 | 89, 89, 89, 89, 89, 89, 89, -50 | ||
| 718 | }, | ||
| 719 | |||
| 720 | { | ||
| 721 | 11, -51, -51, -51, -51, -51, -51, -51, -51, -51, | ||
| 722 | -51, 89, 89, 89, -51, -51, 89, 89, 89, 89, | ||
| 723 | 89, 89, 89, 89, 89, 89, 89, 89, 92, 89, | ||
| 724 | 89, 89, 89, 89, 89, 89, 89, -51 | ||
| 725 | }, | ||
| 726 | |||
| 727 | { | ||
| 728 | 11, -52, -52, -52, -52, -52, -52, -52, -52, -52, | ||
| 729 | -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, | ||
| 730 | |||
| 731 | -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, | ||
| 732 | -52, -52, -52, -52, -52, -52, -52, 93 | ||
| 733 | }, | ||
| 734 | |||
| 735 | { | ||
| 736 | 11, -53, 53, 54, -53, -53, 55, -53, -53, -53, | ||
| 737 | -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, | ||
| 738 | -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, | ||
| 739 | -53, -53, -53, -53, -53, -53, -53, -53 | ||
| 740 | }, | ||
| 741 | |||
| 742 | { | ||
| 743 | 11, -54, -54, -54, -54, -54, -54, -54, -54, -54, | ||
| 744 | -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, | ||
| 745 | -54, -54, -54, -54, -54, -54, -54, -54, -54, -54, | ||
| 746 | -54, -54, -54, -54, -54, -54, -54, -54 | ||
| 747 | |||
| 748 | }, | ||
| 749 | |||
| 750 | { | ||
| 751 | 11, 56, 56, 57, 56, 56, 56, 56, 56, 56, | ||
| 752 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 753 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 754 | 56, 56, 56, 56, 56, 56, 56, 56 | ||
| 755 | }, | ||
| 756 | |||
| 757 | { | ||
| 758 | 11, 56, 56, 57, 56, 56, 56, 56, 56, 56, | ||
| 759 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 760 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 761 | 56, 56, 56, 56, 56, 56, 56, 56 | ||
| 762 | }, | ||
| 763 | |||
| 764 | { | ||
| 765 | 11, -57, -57, -57, -57, -57, -57, -57, -57, -57, | ||
| 766 | -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, | ||
| 767 | |||
| 768 | -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, | ||
| 769 | -57, -57, -57, -57, -57, -57, -57, -57 | ||
| 770 | }, | ||
| 771 | |||
| 772 | { | ||
| 773 | 11, -58, -58, -58, -58, -58, -58, -58, -58, -58, | ||
| 774 | -58, -58, -58, 58, -58, -58, 58, 58, 58, 58, | ||
| 775 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 776 | 58, 58, 58, 58, 58, 58, 58, -58 | ||
| 777 | }, | ||
| 778 | |||
| 779 | { | ||
| 780 | 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, | ||
| 781 | -59, -59, -59, 58, -59, -59, 58, 58, 58, 58, | ||
| 782 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 94, | ||
| 783 | 58, 58, 58, 58, 58, 58, 58, -59 | ||
| 784 | |||
| 785 | }, | ||
| 786 | |||
| 787 | { | ||
| 788 | 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, | ||
| 789 | -60, -60, -60, 58, -60, -60, 58, 58, 58, 58, | ||
| 790 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 95, | ||
| 791 | 58, 58, 58, 58, 58, 58, 58, -60 | ||
| 792 | }, | ||
| 793 | |||
| 794 | { | ||
| 795 | 11, -61, -61, -61, -61, -61, -61, -61, -61, -61, | ||
| 796 | -61, -61, -61, 58, -61, -61, 58, 58, 58, 58, | ||
| 797 | 58, 58, 58, 58, 58, 58, 58, 96, 97, 58, | ||
| 798 | 58, 58, 58, 58, 58, 58, 58, -61 | ||
| 799 | }, | ||
| 800 | |||
| 801 | { | ||
| 802 | 11, -62, -62, -62, -62, -62, -62, -62, -62, -62, | ||
| 803 | -62, -62, -62, 58, -62, -62, 58, 58, 58, 58, | ||
| 804 | |||
| 805 | 58, 58, 98, 58, 58, 58, 58, 58, 58, 58, | ||
| 806 | 99, 58, 58, 58, 58, 58, 58, -62 | ||
| 807 | }, | ||
| 808 | |||
| 809 | { | ||
| 810 | 11, -63, -63, -63, -63, -63, -63, -63, -63, -63, | ||
| 811 | -63, -63, -63, 58, -63, -63, 58, 100, 58, 58, | ||
| 812 | 101, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 813 | 58, 58, 58, 58, 58, 58, 58, -63 | ||
| 814 | }, | ||
| 815 | |||
| 816 | { | ||
| 817 | 11, -64, -64, -64, -64, -64, -64, -64, -64, -64, | ||
| 818 | -64, -64, -64, 58, -64, -64, 58, 58, 58, 58, | ||
| 819 | 58, 58, 58, 58, 58, 58, 102, 58, 58, 58, | ||
| 820 | 58, 58, 58, 58, 58, 58, 103, -64 | ||
| 821 | |||
| 822 | }, | ||
| 823 | |||
| 824 | { | ||
| 825 | 11, -65, -65, -65, -65, -65, -65, -65, -65, -65, | ||
| 826 | -65, -65, -65, 58, -65, -65, 58, 58, 58, 58, | ||
| 827 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 828 | 58, 58, 58, 58, 58, 58, 58, -65 | ||
| 829 | }, | ||
| 830 | |||
| 831 | { | ||
| 832 | 11, -66, -66, -66, -66, -66, -66, -66, -66, -66, | ||
| 833 | -66, -66, -66, 58, -66, -66, 58, 58, 58, 58, | ||
| 834 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 835 | 58, 58, 58, 58, 104, 58, 58, -66 | ||
| 836 | }, | ||
| 837 | |||
| 838 | { | ||
| 839 | 11, -67, -67, -67, -67, -67, -67, -67, -67, -67, | ||
| 840 | -67, -67, -67, 58, -67, -67, 58, 58, 58, 58, | ||
| 841 | |||
| 842 | 58, 58, 58, 58, 58, 105, 58, 58, 58, 58, | ||
| 843 | 58, 58, 58, 58, 58, 58, 58, -67 | ||
| 844 | }, | ||
| 845 | |||
| 846 | { | ||
| 847 | 11, -68, -68, -68, -68, -68, -68, -68, -68, -68, | ||
| 848 | -68, -68, -68, 58, -68, -68, 58, 58, 58, 58, | ||
| 849 | 58, 58, 58, 58, 58, 58, 58, 58, 106, 58, | ||
| 850 | 58, 58, 58, 58, 58, 58, 58, -68 | ||
| 851 | }, | ||
| 852 | |||
| 853 | { | ||
| 854 | 11, -69, -69, -69, -69, -69, -69, -69, -69, -69, | ||
| 855 | -69, -69, -69, 58, -69, -69, 58, 58, 58, 58, | ||
| 856 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 857 | 58, 58, 58, 58, 107, 58, 58, -69 | ||
| 858 | |||
| 859 | }, | ||
| 860 | |||
| 861 | { | ||
| 862 | 11, -70, -70, -70, -70, -70, -70, -70, -70, -70, | ||
| 863 | -70, -70, -70, 58, -70, -70, 58, 58, 58, 58, | ||
| 864 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 108, | ||
| 865 | 58, 58, 58, 58, 58, 58, 58, -70 | ||
| 866 | }, | ||
| 867 | |||
| 868 | { | ||
| 869 | 11, -71, -71, -71, -71, -71, -71, -71, -71, -71, | ||
| 870 | -71, -71, -71, 58, -71, -71, 58, 58, 58, 58, | ||
| 871 | 58, 58, 58, 58, 58, 58, 58, 58, 109, 58, | ||
| 872 | 58, 58, 58, 58, 58, 58, 58, -71 | ||
| 873 | }, | ||
| 874 | |||
| 875 | { | ||
| 876 | 11, -72, -72, -72, -72, -72, -72, -72, -72, -72, | ||
| 877 | -72, -72, -72, 58, -72, -72, 58, 58, 58, 58, | ||
| 878 | |||
| 879 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 880 | 58, 110, 58, 58, 58, 58, 58, -72 | ||
| 881 | }, | ||
| 882 | |||
| 883 | { | ||
| 884 | 11, -73, -73, -73, -73, -73, -73, -73, -73, -73, | ||
| 885 | -73, -73, -73, 58, -73, -73, 58, 58, 58, 58, | ||
| 886 | 58, 58, 58, 58, 58, 58, 111, 58, 58, 58, | ||
| 887 | 58, 58, 58, 58, 58, 58, 58, -73 | ||
| 888 | }, | ||
| 889 | |||
| 890 | { | ||
| 891 | 11, -74, -74, -74, -74, -74, -74, -74, -74, -74, | ||
| 892 | -74, -74, -74, 58, -74, -74, 58, 58, 58, 58, | ||
| 893 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 894 | 58, 58, 58, 58, 58, 112, 58, -74 | ||
| 895 | |||
| 896 | }, | ||
| 897 | |||
| 898 | { | ||
| 899 | 11, -75, -75, -75, -75, -75, -75, -75, -75, -75, | ||
| 900 | -75, -75, -75, 58, -75, -75, 58, 58, 58, 58, | ||
| 901 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 902 | 58, 58, 113, 58, 58, 58, 58, -75 | ||
| 903 | }, | ||
| 904 | |||
| 905 | { | ||
| 906 | 11, -76, -76, -76, -76, -76, -76, -76, -76, -76, | ||
| 907 | -76, -76, -76, 58, -76, -76, 58, 58, 58, 58, | ||
| 908 | 58, 58, 58, 58, 58, 114, 58, 58, 58, 58, | ||
| 909 | 58, 58, 58, 58, 58, 58, 58, -76 | ||
| 910 | }, | ||
| 911 | |||
| 912 | { | ||
| 913 | 11, 77, 77, -77, 77, 77, 77, 77, 77, 77, | ||
| 914 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
| 915 | |||
| 916 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
| 917 | 77, 77, 77, 77, 77, 77, 77, 77 | ||
| 918 | }, | ||
| 919 | |||
| 920 | { | ||
| 921 | 11, -78, 78, 79, -78, -78, -78, -78, -78, -78, | ||
| 922 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | ||
| 923 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | ||
| 924 | -78, -78, -78, -78, -78, -78, -78, -78 | ||
| 925 | }, | ||
| 926 | |||
| 927 | { | ||
| 928 | 11, 80, -79, -79, 80, 80, 80, 80, 80, 80, | ||
| 929 | 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, | ||
| 930 | 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, | ||
| 931 | 80, 80, 80, 80, 80, 80, 80, 80 | ||
| 932 | |||
| 933 | }, | ||
| 934 | |||
| 935 | { | ||
| 936 | 11, -80, -80, -80, -80, -80, -80, -80, -80, -80, | ||
| 937 | -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, | ||
| 938 | -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, | ||
| 939 | -80, -80, -80, -80, -80, -80, -80, -80 | ||
| 940 | }, | ||
| 941 | |||
| 942 | { | ||
| 943 | 11, 81, 81, 82, 81, -81, 81, 81, -81, 81, | ||
| 944 | 81, 81, 81, 81, 81, -81, 81, 81, 81, 81, | ||
| 945 | 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, | ||
| 946 | 81, 81, 81, 81, 81, 81, 81, 81 | ||
| 947 | }, | ||
| 948 | |||
| 949 | { | ||
| 950 | 11, -82, -82, -82, -82, -82, -82, -82, -82, -82, | ||
| 951 | -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, | ||
| 952 | |||
| 953 | -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, | ||
| 954 | -82, -82, -82, -82, -82, -82, -82, -82 | ||
| 955 | }, | ||
| 956 | |||
| 957 | { | ||
| 958 | 11, -83, -83, 84, -83, -83, -83, -83, -83, -83, | ||
| 959 | -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, | ||
| 960 | -83, -83, -83, -83, -83, -83, -83, -83, -83, -83, | ||
| 961 | -83, -83, -83, -83, -83, -83, -83, -83 | ||
| 962 | }, | ||
| 963 | |||
| 964 | { | ||
| 965 | 11, -84, -84, -84, -84, -84, -84, -84, -84, -84, | ||
| 966 | -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, | ||
| 967 | -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, | ||
| 968 | -84, -84, -84, -84, -84, -84, -84, -84 | ||
| 969 | |||
| 970 | }, | ||
| 971 | |||
| 972 | { | ||
| 973 | 11, -85, -85, -85, -85, -85, -85, -85, -85, -85, | ||
| 974 | -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, | ||
| 975 | -85, -85, -85, -85, -85, -85, -85, -85, -85, -85, | ||
| 976 | -85, -85, -85, -85, -85, -85, -85, -85 | ||
| 977 | }, | ||
| 978 | |||
| 979 | { | ||
| 980 | 11, 86, 86, -86, 86, 86, 86, 86, 86, 86, | ||
| 981 | 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, | ||
| 982 | 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, | ||
| 983 | 86, 86, 86, 86, 86, 86, 86, 86 | ||
| 984 | }, | ||
| 985 | |||
| 986 | { | ||
| 987 | 11, -87, -87, -87, -87, -87, -87, -87, -87, -87, | ||
| 988 | -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, | ||
| 989 | |||
| 990 | -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, | ||
| 991 | -87, -87, -87, -87, -87, -87, -87, -87 | ||
| 992 | }, | ||
| 993 | |||
| 994 | { | ||
| 995 | 11, -88, -88, -88, -88, -88, -88, -88, -88, -88, | ||
| 996 | -88, 115, 89, 89, -88, -88, 89, 89, 89, 89, | ||
| 997 | 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, | ||
| 998 | 89, 89, 89, 89, 89, 89, 89, -88 | ||
| 999 | }, | ||
| 1000 | |||
| 1001 | { | ||
| 1002 | 11, -89, -89, -89, -89, -89, -89, -89, -89, -89, | ||
| 1003 | -89, 89, 89, 89, -89, -89, 89, 89, 89, 89, | ||
| 1004 | 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, | ||
| 1005 | 89, 89, 89, 89, 89, 89, 89, -89 | ||
| 1006 | |||
| 1007 | }, | ||
| 1008 | |||
| 1009 | { | ||
| 1010 | 11, -90, -90, -90, -90, -90, -90, -90, -90, -90, | ||
| 1011 | -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, | ||
| 1012 | -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, | ||
| 1013 | -90, -90, -90, -90, -90, -90, -90, -90 | ||
| 1014 | }, | ||
| 1015 | |||
| 1016 | { | ||
| 1017 | 11, -91, -91, -91, -91, -91, -91, -91, -91, -91, | ||
| 1018 | -91, 89, 89, 89, -91, -91, 89, 89, 89, 89, | ||
| 1019 | 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, | ||
| 1020 | 89, 89, 89, 89, 89, 89, 89, -91 | ||
| 1021 | }, | ||
| 1022 | |||
| 1023 | { | ||
| 1024 | 11, -92, -92, -92, -92, -92, -92, -92, -92, -92, | ||
| 1025 | -92, 89, 89, 89, -92, -92, 89, 89, 89, 89, | ||
| 1026 | |||
| 1027 | 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, | ||
| 1028 | 89, 89, 89, 89, 89, 89, 89, -92 | ||
| 1029 | }, | ||
| 1030 | |||
| 1031 | { | ||
| 1032 | 11, -93, -93, -93, -93, -93, -93, -93, -93, -93, | ||
| 1033 | -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, | ||
| 1034 | -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, | ||
| 1035 | -93, -93, -93, -93, -93, -93, -93, -93 | ||
| 1036 | }, | ||
| 1037 | |||
| 1038 | { | ||
| 1039 | 11, -94, -94, -94, -94, -94, -94, -94, -94, -94, | ||
| 1040 | -94, -94, -94, 58, -94, -94, 58, 58, 58, 58, | ||
| 1041 | 58, 58, 58, 58, 58, 58, 116, 58, 58, 58, | ||
| 1042 | 58, 58, 58, 58, 58, 58, 58, -94 | ||
| 1043 | |||
| 1044 | }, | ||
| 1045 | |||
| 1046 | { | ||
| 1047 | 11, -95, -95, -95, -95, -95, -95, -95, -95, -95, | ||
| 1048 | -95, -95, -95, 58, -95, -95, 58, 58, 58, 58, | ||
| 1049 | 58, 58, 58, 58, 58, 117, 58, 58, 58, 58, | ||
| 1050 | 58, 58, 58, 58, 58, 58, 58, -95 | ||
| 1051 | }, | ||
| 1052 | |||
| 1053 | { | ||
| 1054 | 11, -96, -96, -96, -96, -96, -96, -96, -96, -96, | ||
| 1055 | -96, -96, -96, 58, -96, -96, 58, 58, 58, 58, | ||
| 1056 | 58, 58, 58, 58, 58, 58, 58, 118, 58, 58, | ||
| 1057 | 58, 58, 58, 58, 58, 58, 58, -96 | ||
| 1058 | }, | ||
| 1059 | |||
| 1060 | { | ||
| 1061 | 11, -97, -97, -97, -97, -97, -97, -97, -97, -97, | ||
| 1062 | -97, -97, -97, 58, -97, -97, 58, 58, 58, 58, | ||
| 1063 | |||
| 1064 | 58, 58, 119, 58, 58, 58, 58, 58, 58, 58, | ||
| 1065 | 58, 58, 58, 58, 58, 58, 58, -97 | ||
| 1066 | }, | ||
| 1067 | |||
| 1068 | { | ||
| 1069 | 11, -98, -98, -98, -98, -98, -98, -98, -98, -98, | ||
| 1070 | -98, -98, -98, 58, -98, -98, 120, 121, 58, 58, | ||
| 1071 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1072 | 58, 58, 58, 58, 58, 58, 58, -98 | ||
| 1073 | }, | ||
| 1074 | |||
| 1075 | { | ||
| 1076 | 11, -99, -99, -99, -99, -99, -99, -99, -99, -99, | ||
| 1077 | -99, -99, -99, 58, -99, -99, 58, 58, 58, 58, | ||
| 1078 | 58, 122, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1079 | 58, 58, 58, 58, 58, 58, 58, -99 | ||
| 1080 | |||
| 1081 | }, | ||
| 1082 | |||
| 1083 | { | ||
| 1084 | 11, -100, -100, -100, -100, -100, -100, -100, -100, -100, | ||
| 1085 | -100, -100, -100, 58, -100, -100, 58, 58, 123, 58, | ||
| 1086 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1087 | 58, 58, 58, 58, 58, 58, 58, -100 | ||
| 1088 | }, | ||
| 1089 | |||
| 1090 | { | ||
| 1091 | 11, -101, -101, -101, -101, -101, -101, -101, -101, -101, | ||
| 1092 | -101, -101, -101, 58, -101, -101, 58, 58, 58, 124, | ||
| 1093 | 58, 58, 58, 58, 58, 125, 58, 126, 58, 58, | ||
| 1094 | 58, 58, 58, 58, 58, 58, 58, -101 | ||
| 1095 | }, | ||
| 1096 | |||
| 1097 | { | ||
| 1098 | 11, -102, -102, -102, -102, -102, -102, -102, -102, -102, | ||
| 1099 | -102, -102, -102, 58, -102, -102, 58, 58, 58, 58, | ||
| 1100 | |||
| 1101 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1102 | 127, 58, 58, 58, 58, 58, 58, -102 | ||
| 1103 | }, | ||
| 1104 | |||
| 1105 | { | ||
| 1106 | 11, -103, -103, -103, -103, -103, -103, -103, -103, -103, | ||
| 1107 | -103, -103, -103, 58, -103, -103, 58, 58, 58, 58, | ||
| 1108 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1109 | 58, 58, 58, 58, 58, 58, 58, -103 | ||
| 1110 | }, | ||
| 1111 | |||
| 1112 | { | ||
| 1113 | 11, -104, -104, -104, -104, -104, -104, -104, -104, -104, | ||
| 1114 | -104, -104, -104, 58, -104, -104, 58, 58, 58, 58, | ||
| 1115 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1116 | 58, 58, 58, 58, 58, 58, 58, -104 | ||
| 1117 | |||
| 1118 | }, | ||
| 1119 | |||
| 1120 | { | ||
| 1121 | 11, -105, -105, -105, -105, -105, -105, -105, -105, -105, | ||
| 1122 | -105, -105, -105, 58, -105, -105, 58, 58, 58, 58, | ||
| 1123 | 58, 58, 58, 58, 58, 58, 58, 58, 128, 58, | ||
| 1124 | 58, 58, 58, 58, 58, 58, 58, -105 | ||
| 1125 | }, | ||
| 1126 | |||
| 1127 | { | ||
| 1128 | 11, -106, -106, -106, -106, -106, -106, -106, -106, -106, | ||
| 1129 | -106, -106, -106, 58, -106, -106, 58, 58, 58, 58, | ||
| 1130 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1131 | 58, 58, 58, 58, 58, 129, 58, -106 | ||
| 1132 | }, | ||
| 1133 | |||
| 1134 | { | ||
| 1135 | 11, -107, -107, -107, -107, -107, -107, -107, -107, -107, | ||
| 1136 | -107, -107, -107, 58, -107, -107, 58, 58, 58, 58, | ||
| 1137 | |||
| 1138 | 58, 58, 58, 58, 58, 130, 58, 58, 58, 58, | ||
| 1139 | 58, 58, 58, 58, 58, 58, 58, -107 | ||
| 1140 | }, | ||
| 1141 | |||
| 1142 | { | ||
| 1143 | 11, -108, -108, -108, -108, -108, -108, -108, -108, -108, | ||
| 1144 | -108, -108, -108, 58, -108, -108, 58, 58, 58, 58, | ||
| 1145 | 58, 58, 58, 58, 58, 58, 58, 131, 58, 58, | ||
| 1146 | 58, 58, 58, 58, 58, 58, 58, -108 | ||
| 1147 | }, | ||
| 1148 | |||
| 1149 | { | ||
| 1150 | 11, -109, -109, -109, -109, -109, -109, -109, -109, -109, | ||
| 1151 | -109, -109, -109, 58, -109, -109, 58, 58, 58, 58, | ||
| 1152 | 58, 58, 58, 132, 58, 58, 58, 58, 58, 58, | ||
| 1153 | 58, 58, 58, 58, 58, 58, 58, -109 | ||
| 1154 | |||
| 1155 | }, | ||
| 1156 | |||
| 1157 | { | ||
| 1158 | 11, -110, -110, -110, -110, -110, -110, -110, -110, -110, | ||
| 1159 | -110, -110, -110, 58, -110, -110, 58, 58, 58, 58, | ||
| 1160 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1161 | 58, 58, 58, 58, 58, 133, 58, -110 | ||
| 1162 | }, | ||
| 1163 | |||
| 1164 | { | ||
| 1165 | 11, -111, -111, -111, -111, -111, -111, -111, -111, -111, | ||
| 1166 | -111, -111, -111, 58, -111, -111, 58, 58, 58, 58, | ||
| 1167 | 58, 134, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1168 | 58, 58, 58, 58, 58, 58, 58, -111 | ||
| 1169 | }, | ||
| 1170 | |||
| 1171 | { | ||
| 1172 | 11, -112, -112, -112, -112, -112, -112, -112, -112, -112, | ||
| 1173 | -112, -112, -112, 58, -112, -112, 58, 58, 58, 58, | ||
| 1174 | |||
| 1175 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1176 | 58, 58, 135, 58, 58, 58, 58, -112 | ||
| 1177 | }, | ||
| 1178 | |||
| 1179 | { | ||
| 1180 | 11, -113, -113, -113, -113, -113, -113, -113, -113, -113, | ||
| 1181 | -113, -113, -113, 58, -113, -113, 58, 58, 58, 58, | ||
| 1182 | 58, 58, 58, 58, 58, 136, 58, 58, 58, 58, | ||
| 1183 | 58, 58, 58, 58, 58, 58, 58, -113 | ||
| 1184 | }, | ||
| 1185 | |||
| 1186 | { | ||
| 1187 | 11, -114, -114, -114, -114, -114, -114, -114, -114, -114, | ||
| 1188 | -114, -114, -114, 58, -114, -114, 58, 58, 58, 58, | ||
| 1189 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1190 | 58, 58, 58, 137, 58, 58, 58, -114 | ||
| 1191 | |||
| 1192 | }, | ||
| 1193 | |||
| 1194 | { | ||
| 1195 | 11, -115, -115, -115, -115, -115, -115, -115, -115, -115, | ||
| 1196 | -115, 89, 89, 89, -115, -115, 89, 89, 89, 89, | ||
| 1197 | 89, 89, 89, 89, 89, 89, 89, 89, 89, 89, | ||
| 1198 | 89, 89, 89, 89, 89, 89, 89, -115 | ||
| 1199 | }, | ||
| 1200 | |||
| 1201 | { | ||
| 1202 | 11, -116, -116, -116, -116, -116, -116, -116, -116, -116, | ||
| 1203 | -116, -116, -116, 58, -116, -116, 58, 58, 58, 58, | ||
| 1204 | 58, 138, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1205 | 58, 58, 58, 58, 58, 58, 58, -116 | ||
| 1206 | }, | ||
| 1207 | |||
| 1208 | { | ||
| 1209 | 11, -117, -117, -117, -117, -117, -117, -117, -117, -117, | ||
| 1210 | -117, -117, -117, 58, -117, -117, 58, 58, 58, 139, | ||
| 1211 | |||
| 1212 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1213 | 58, 58, 58, 58, 58, 58, 58, -117 | ||
| 1214 | }, | ||
| 1215 | |||
| 1216 | { | ||
| 1217 | 11, -118, -118, -118, -118, -118, -118, -118, -118, -118, | ||
| 1218 | -118, -118, -118, 58, -118, -118, 58, 58, 58, 58, | ||
| 1219 | 58, 140, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1220 | 58, 58, 58, 58, 58, 58, 58, -118 | ||
| 1221 | }, | ||
| 1222 | |||
| 1223 | { | ||
| 1224 | 11, -119, -119, -119, -119, -119, -119, -119, -119, -119, | ||
| 1225 | -119, -119, -119, 58, -119, -119, 58, 58, 58, 58, | ||
| 1226 | 58, 58, 58, 58, 58, 141, 58, 58, 58, 58, | ||
| 1227 | 58, 58, 58, 58, 58, 58, 58, -119 | ||
| 1228 | |||
| 1229 | }, | ||
| 1230 | |||
| 1231 | { | ||
| 1232 | 11, -120, -120, -120, -120, -120, -120, -120, -120, -120, | ||
| 1233 | -120, -120, -120, 58, -120, -120, 58, 58, 142, 58, | ||
| 1234 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1235 | 58, 58, 58, 58, 143, 58, 58, -120 | ||
| 1236 | }, | ||
| 1237 | |||
| 1238 | { | ||
| 1239 | 11, -121, -121, -121, -121, -121, -121, -121, -121, -121, | ||
| 1240 | -121, -121, -121, 58, -121, -121, 58, 58, 58, 58, | ||
| 1241 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1242 | 58, 58, 58, 58, 58, 144, 58, -121 | ||
| 1243 | }, | ||
| 1244 | |||
| 1245 | { | ||
| 1246 | 11, -122, -122, -122, -122, -122, -122, -122, -122, -122, | ||
| 1247 | -122, -122, -122, 58, -122, -122, 58, 58, 58, 58, | ||
| 1248 | |||
| 1249 | 58, 58, 58, 58, 58, 58, 58, 58, 145, 58, | ||
| 1250 | 58, 58, 58, 58, 58, 58, 58, -122 | ||
| 1251 | }, | ||
| 1252 | |||
| 1253 | { | ||
| 1254 | 11, -123, -123, -123, -123, -123, -123, -123, -123, -123, | ||
| 1255 | -123, -123, -123, 58, -123, -123, 58, 58, 58, 58, | ||
| 1256 | 58, 58, 58, 58, 58, 58, 146, 58, 58, 58, | ||
| 1257 | 58, 58, 58, 58, 58, 58, 58, -123 | ||
| 1258 | }, | ||
| 1259 | |||
| 1260 | { | ||
| 1261 | 11, -124, -124, -124, -124, -124, -124, -124, -124, -124, | ||
| 1262 | -124, -124, -124, 58, -124, -124, 58, 58, 58, 58, | ||
| 1263 | 58, 58, 58, 58, 147, 58, 58, 58, 58, 58, | ||
| 1264 | 58, 58, 58, 58, 58, 58, 58, -124 | ||
| 1265 | |||
| 1266 | }, | ||
| 1267 | |||
| 1268 | { | ||
| 1269 | 11, -125, -125, -125, -125, -125, -125, -125, -125, -125, | ||
| 1270 | -125, -125, -125, 58, -125, -125, 58, 58, 58, 58, | ||
| 1271 | 58, 58, 148, 58, 58, 58, 58, 58, 58, 58, | ||
| 1272 | 58, 58, 58, 58, 58, 58, 58, -125 | ||
| 1273 | }, | ||
| 1274 | |||
| 1275 | { | ||
| 1276 | 11, -126, -126, -126, -126, -126, -126, -126, -126, -126, | ||
| 1277 | -126, -126, -126, 58, -126, -126, 58, 58, 58, 58, | ||
| 1278 | 58, 149, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1279 | 58, 58, 58, 58, 58, 58, 58, -126 | ||
| 1280 | }, | ||
| 1281 | |||
| 1282 | { | ||
| 1283 | 11, -127, -127, -127, -127, -127, -127, -127, -127, -127, | ||
| 1284 | -127, -127, -127, 58, -127, -127, 58, 58, 58, 58, | ||
| 1285 | |||
| 1286 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1287 | 58, 58, 58, 58, 58, 58, 58, -127 | ||
| 1288 | }, | ||
| 1289 | |||
| 1290 | { | ||
| 1291 | 11, -128, -128, -128, -128, -128, -128, -128, -128, -128, | ||
| 1292 | -128, -128, -128, 58, -128, -128, 58, 58, 58, 58, | ||
| 1293 | 58, 58, 58, 58, 58, 58, 58, 150, 58, 58, | ||
| 1294 | 58, 58, 58, 58, 58, 58, 58, -128 | ||
| 1295 | }, | ||
| 1296 | |||
| 1297 | { | ||
| 1298 | 11, -129, -129, -129, -129, -129, -129, -129, -129, -129, | ||
| 1299 | -129, -129, -129, 58, -129, -129, 58, 58, 58, 151, | ||
| 1300 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1301 | 58, 58, 58, 58, 58, 58, 58, -129 | ||
| 1302 | |||
| 1303 | }, | ||
| 1304 | |||
| 1305 | { | ||
| 1306 | 11, -130, -130, -130, -130, -130, -130, -130, -130, -130, | ||
| 1307 | -130, -130, -130, 58, -130, -130, 58, 58, 58, 58, | ||
| 1308 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 152, | ||
| 1309 | 58, 58, 58, 58, 58, 58, 58, -130 | ||
| 1310 | }, | ||
| 1311 | |||
| 1312 | { | ||
| 1313 | 11, -131, -131, -131, -131, -131, -131, -131, -131, -131, | ||
| 1314 | -131, -131, -131, 58, -131, -131, 58, 58, 58, 58, | ||
| 1315 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1316 | 153, 58, 58, 58, 58, 58, 58, -131 | ||
| 1317 | }, | ||
| 1318 | |||
| 1319 | { | ||
| 1320 | 11, -132, -132, -132, -132, -132, -132, -132, -132, -132, | ||
| 1321 | -132, -132, -132, 58, -132, -132, 58, 58, 58, 58, | ||
| 1322 | |||
| 1323 | 58, 154, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1324 | 58, 58, 58, 58, 58, 58, 58, -132 | ||
| 1325 | }, | ||
| 1326 | |||
| 1327 | { | ||
| 1328 | 11, -133, -133, -133, -133, -133, -133, -133, -133, -133, | ||
| 1329 | -133, -133, -133, 58, -133, -133, 58, 58, 58, 58, | ||
| 1330 | 58, 58, 58, 58, 58, 155, 58, 58, 58, 58, | ||
| 1331 | 58, 58, 58, 58, 58, 58, 58, -133 | ||
| 1332 | }, | ||
| 1333 | |||
| 1334 | { | ||
| 1335 | 11, -134, -134, -134, -134, -134, -134, -134, -134, -134, | ||
| 1336 | -134, -134, -134, 58, -134, -134, 58, 58, 58, 156, | ||
| 1337 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1338 | 58, 58, 58, 58, 58, 58, 58, -134 | ||
| 1339 | |||
| 1340 | }, | ||
| 1341 | |||
| 1342 | { | ||
| 1343 | 11, -135, -135, -135, -135, -135, -135, -135, -135, -135, | ||
| 1344 | -135, -135, -135, 58, -135, -135, 58, 58, 58, 157, | ||
| 1345 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1346 | 58, 58, 58, 58, 58, 58, 58, -135 | ||
| 1347 | }, | ||
| 1348 | |||
| 1349 | { | ||
| 1350 | 11, -136, -136, -136, -136, -136, -136, -136, -136, -136, | ||
| 1351 | -136, -136, -136, 58, -136, -136, 58, 58, 58, 58, | ||
| 1352 | 58, 58, 58, 58, 58, 58, 58, 58, 158, 58, | ||
| 1353 | 58, 58, 58, 58, 58, 58, 58, -136 | ||
| 1354 | }, | ||
| 1355 | |||
| 1356 | { | ||
| 1357 | 11, -137, -137, -137, -137, -137, -137, -137, -137, -137, | ||
| 1358 | -137, -137, -137, 58, -137, -137, 58, 58, 58, 58, | ||
| 1359 | |||
| 1360 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1361 | 58, 58, 58, 58, 159, 58, 58, -137 | ||
| 1362 | }, | ||
| 1363 | |||
| 1364 | { | ||
| 1365 | 11, -138, -138, -138, -138, -138, -138, -138, -138, -138, | ||
| 1366 | -138, -138, -138, 58, -138, -138, 58, 160, 58, 58, | ||
| 1367 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1368 | 58, 58, 58, 58, 58, 58, 58, -138 | ||
| 1369 | }, | ||
| 1370 | |||
| 1371 | { | ||
| 1372 | 11, -139, -139, -139, -139, -139, -139, -139, -139, -139, | ||
| 1373 | -139, -139, -139, 58, -139, -139, 58, 58, 58, 58, | ||
| 1374 | 58, 161, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1375 | 58, 58, 58, 58, 58, 58, 58, -139 | ||
| 1376 | |||
| 1377 | }, | ||
| 1378 | |||
| 1379 | { | ||
| 1380 | 11, -140, -140, -140, -140, -140, -140, -140, -140, -140, | ||
| 1381 | -140, -140, -140, 58, -140, -140, 58, 58, 58, 58, | ||
| 1382 | 58, 58, 58, 58, 58, 58, 58, 58, 162, 58, | ||
| 1383 | 58, 58, 58, 58, 58, 58, 58, -140 | ||
| 1384 | }, | ||
| 1385 | |||
| 1386 | { | ||
| 1387 | 11, -141, -141, -141, -141, -141, -141, -141, -141, -141, | ||
| 1388 | -141, -141, -141, 58, -141, -141, 58, 58, 58, 58, | ||
| 1389 | 58, 58, 58, 163, 58, 58, 58, 58, 58, 58, | ||
| 1390 | 58, 58, 58, 58, 58, 58, 58, -141 | ||
| 1391 | }, | ||
| 1392 | |||
| 1393 | { | ||
| 1394 | 11, -142, -142, -142, -142, -142, -142, -142, -142, -142, | ||
| 1395 | -142, -142, -142, 58, -142, -142, 58, 58, 58, 58, | ||
| 1396 | |||
| 1397 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 164, | ||
| 1398 | 58, 58, 58, 58, 58, 58, 58, -142 | ||
| 1399 | }, | ||
| 1400 | |||
| 1401 | { | ||
| 1402 | 11, -143, -143, -143, -143, -143, -143, -143, -143, -143, | ||
| 1403 | -143, -143, -143, 58, -143, -143, 58, 58, 58, 58, | ||
| 1404 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1405 | 58, 58, 165, 58, 58, 58, 58, -143 | ||
| 1406 | }, | ||
| 1407 | |||
| 1408 | { | ||
| 1409 | 11, -144, -144, -144, -144, -144, -144, -144, -144, -144, | ||
| 1410 | -144, -144, -144, 58, -144, -144, 58, 58, 58, 58, | ||
| 1411 | 58, 58, 58, 58, 58, 58, 166, 58, 58, 58, | ||
| 1412 | 58, 58, 58, 58, 58, 58, 58, -144 | ||
| 1413 | |||
| 1414 | }, | ||
| 1415 | |||
| 1416 | { | ||
| 1417 | 11, -145, -145, -145, -145, -145, -145, -145, -145, -145, | ||
| 1418 | -145, -145, -145, 58, -145, -145, 58, 58, 58, 58, | ||
| 1419 | 167, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1420 | 58, 58, 58, 58, 58, 58, 58, -145 | ||
| 1421 | }, | ||
| 1422 | |||
| 1423 | { | ||
| 1424 | 11, -146, -146, -146, -146, -146, -146, -146, -146, -146, | ||
| 1425 | -146, -146, -146, 58, -146, -146, 58, 58, 58, 58, | ||
| 1426 | 58, 168, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1427 | 58, 58, 58, 58, 58, 58, 58, -146 | ||
| 1428 | }, | ||
| 1429 | |||
| 1430 | { | ||
| 1431 | 11, -147, -147, -147, -147, -147, -147, -147, -147, -147, | ||
| 1432 | -147, -147, -147, 58, -147, -147, 58, 58, 58, 58, | ||
| 1433 | |||
| 1434 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 169, | ||
| 1435 | 58, 58, 58, 58, 58, 58, 58, -147 | ||
| 1436 | }, | ||
| 1437 | |||
| 1438 | { | ||
| 1439 | 11, -148, -148, -148, -148, -148, -148, -148, -148, -148, | ||
| 1440 | -148, -148, -148, 58, -148, -148, 58, 58, 58, 58, | ||
| 1441 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1442 | 58, 58, 58, 58, 58, 58, 58, -148 | ||
| 1443 | }, | ||
| 1444 | |||
| 1445 | { | ||
| 1446 | 11, -149, -149, -149, -149, -149, -149, -149, -149, -149, | ||
| 1447 | -149, -149, -149, 58, -149, -149, 58, 58, 58, 58, | ||
| 1448 | 58, 58, 58, 58, 58, 58, 58, 58, 170, 58, | ||
| 1449 | 58, 58, 58, 58, 58, 58, 58, -149 | ||
| 1450 | |||
| 1451 | }, | ||
| 1452 | |||
| 1453 | { | ||
| 1454 | 11, -150, -150, -150, -150, -150, -150, -150, -150, -150, | ||
| 1455 | -150, -150, -150, 58, -150, -150, 58, 58, 58, 58, | ||
| 1456 | 58, 171, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1457 | 58, 58, 58, 58, 58, 58, 58, -150 | ||
| 1458 | }, | ||
| 1459 | |||
| 1460 | { | ||
| 1461 | 11, -151, -151, -151, -151, -151, -151, -151, -151, -151, | ||
| 1462 | -151, -151, -151, 58, -151, -151, 58, 58, 58, 58, | ||
| 1463 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 172, | ||
| 1464 | 58, 58, 58, 58, 58, 58, 58, -151 | ||
| 1465 | }, | ||
| 1466 | |||
| 1467 | { | ||
| 1468 | 11, -152, -152, -152, -152, -152, -152, -152, -152, -152, | ||
| 1469 | -152, -152, -152, 58, -152, -152, 58, 58, 58, 58, | ||
| 1470 | |||
| 1471 | 58, 58, 58, 58, 58, 58, 58, 58, 173, 58, | ||
| 1472 | 58, 58, 58, 58, 58, 58, 58, -152 | ||
| 1473 | }, | ||
| 1474 | |||
| 1475 | { | ||
| 1476 | 11, -153, -153, -153, -153, -153, -153, -153, -153, -153, | ||
| 1477 | -153, -153, -153, 58, -153, -153, 58, 58, 58, 58, | ||
| 1478 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1479 | 58, 58, 58, 58, 174, 58, 58, -153 | ||
| 1480 | }, | ||
| 1481 | |||
| 1482 | { | ||
| 1483 | 11, -154, -154, -154, -154, -154, -154, -154, -154, -154, | ||
| 1484 | -154, -154, -154, 58, -154, -154, 58, 58, 58, 58, | ||
| 1485 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1486 | 58, 58, 58, 58, 58, 58, 58, -154 | ||
| 1487 | |||
| 1488 | }, | ||
| 1489 | |||
| 1490 | { | ||
| 1491 | 11, -155, -155, -155, -155, -155, -155, -155, -155, -155, | ||
| 1492 | -155, -155, -155, 58, -155, -155, 58, 58, 58, 58, | ||
| 1493 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1494 | 58, 58, 175, 58, 58, 58, 58, -155 | ||
| 1495 | }, | ||
| 1496 | |||
| 1497 | { | ||
| 1498 | 11, -156, -156, -156, -156, -156, -156, -156, -156, -156, | ||
| 1499 | -156, -156, -156, 58, -156, -156, 58, 58, 58, 58, | ||
| 1500 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1501 | 58, 58, 58, 58, 176, 58, 58, -156 | ||
| 1502 | }, | ||
| 1503 | |||
| 1504 | { | ||
| 1505 | 11, -157, -157, -157, -157, -157, -157, -157, -157, -157, | ||
| 1506 | -157, -157, -157, 58, -157, -157, 58, 58, 58, 58, | ||
| 1507 | |||
| 1508 | 58, 177, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1509 | 58, 58, 58, 58, 58, 58, 58, -157 | ||
| 1510 | }, | ||
| 1511 | |||
| 1512 | { | ||
| 1513 | 11, -158, -158, -158, -158, -158, -158, -158, -158, -158, | ||
| 1514 | -158, -158, -158, 58, -158, -158, 58, 58, 58, 58, | ||
| 1515 | 58, 58, 58, 178, 58, 58, 58, 58, 58, 58, | ||
| 1516 | 58, 58, 58, 58, 58, 58, 58, -158 | ||
| 1517 | }, | ||
| 1518 | |||
| 1519 | { | ||
| 1520 | 11, -159, -159, -159, -159, -159, -159, -159, -159, -159, | ||
| 1521 | -159, -159, -159, 58, -159, -159, 58, 179, 58, 58, | ||
| 1522 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1523 | 58, 58, 58, 58, 58, 58, 58, -159 | ||
| 1524 | |||
| 1525 | }, | ||
| 1526 | |||
| 1527 | { | ||
| 1528 | 11, -160, -160, -160, -160, -160, -160, -160, -160, -160, | ||
| 1529 | -160, -160, -160, 58, -160, -160, 58, 58, 58, 58, | ||
| 1530 | 58, 58, 58, 58, 58, 58, 58, 58, 180, 58, | ||
| 1531 | 58, 58, 58, 58, 58, 58, 58, -160 | ||
| 1532 | }, | ||
| 1533 | |||
| 1534 | { | ||
| 1535 | 11, -161, -161, -161, -161, -161, -161, -161, -161, -161, | ||
| 1536 | -161, -161, -161, 58, -161, -161, 58, 58, 58, 58, | ||
| 1537 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1538 | 58, 58, 58, 58, 58, 58, 58, -161 | ||
| 1539 | }, | ||
| 1540 | |||
| 1541 | { | ||
| 1542 | 11, -162, -162, -162, -162, -162, -162, -162, -162, -162, | ||
| 1543 | -162, -162, -162, 58, -162, -162, 58, 58, 58, 58, | ||
| 1544 | |||
| 1545 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1546 | 58, 58, 58, 58, 181, 58, 58, -162 | ||
| 1547 | }, | ||
| 1548 | |||
| 1549 | { | ||
| 1550 | 11, -163, -163, -163, -163, -163, -163, -163, -163, -163, | ||
| 1551 | -163, -163, -163, 58, -163, -163, 58, 58, 58, 58, | ||
| 1552 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1553 | 58, 58, 58, 58, 58, 58, 58, -163 | ||
| 1554 | }, | ||
| 1555 | |||
| 1556 | { | ||
| 1557 | 11, -164, -164, -164, -164, -164, -164, -164, -164, -164, | ||
| 1558 | -164, -164, -164, 58, -164, -164, 58, 58, 58, 58, | ||
| 1559 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 182, | ||
| 1560 | 58, 58, 58, 58, 58, 58, 58, -164 | ||
| 1561 | |||
| 1562 | }, | ||
| 1563 | |||
| 1564 | { | ||
| 1565 | 11, -165, -165, -165, -165, -165, -165, -165, -165, -165, | ||
| 1566 | -165, -165, -165, 58, -165, -165, 58, 58, 58, 58, | ||
| 1567 | 58, 58, 58, 58, 58, 183, 58, 58, 58, 58, | ||
| 1568 | 58, 58, 58, 58, 58, 58, 58, -165 | ||
| 1569 | }, | ||
| 1570 | |||
| 1571 | { | ||
| 1572 | 11, -166, -166, -166, -166, -166, -166, -166, -166, -166, | ||
| 1573 | -166, -166, -166, 58, -166, -166, 58, 58, 58, 58, | ||
| 1574 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1575 | 58, 58, 58, 58, 184, 58, 58, -166 | ||
| 1576 | }, | ||
| 1577 | |||
| 1578 | { | ||
| 1579 | 11, -167, -167, -167, -167, -167, -167, -167, -167, -167, | ||
| 1580 | -167, -167, -167, 58, -167, -167, 58, 58, 58, 58, | ||
| 1581 | |||
| 1582 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1583 | 58, 58, 58, 185, 58, 58, 58, -167 | ||
| 1584 | }, | ||
| 1585 | |||
| 1586 | { | ||
| 1587 | 11, -168, -168, -168, -168, -168, -168, -168, -168, -168, | ||
| 1588 | -168, -168, -168, 58, -168, -168, 58, 58, 58, 58, | ||
| 1589 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1590 | 58, 58, 58, 58, 58, 58, 58, -168 | ||
| 1591 | }, | ||
| 1592 | |||
| 1593 | { | ||
| 1594 | 11, -169, -169, -169, -169, -169, -169, -169, -169, -169, | ||
| 1595 | -169, -169, -169, 58, -169, -169, 58, 58, 58, 58, | ||
| 1596 | 58, 58, 58, 58, 58, 186, 58, 58, 58, 58, | ||
| 1597 | 58, 58, 58, 58, 58, 58, 58, -169 | ||
| 1598 | |||
| 1599 | }, | ||
| 1600 | |||
| 1601 | { | ||
| 1602 | 11, -170, -170, -170, -170, -170, -170, -170, -170, -170, | ||
| 1603 | -170, -170, -170, 58, -170, -170, 58, 58, 58, 58, | ||
| 1604 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1605 | 58, 58, 58, 58, 58, 187, 58, -170 | ||
| 1606 | }, | ||
| 1607 | |||
| 1608 | { | ||
| 1609 | 11, -171, -171, -171, -171, -171, -171, -171, -171, -171, | ||
| 1610 | -171, -171, -171, 58, -171, -171, 58, 58, 58, 58, | ||
| 1611 | 58, 58, 58, 58, 58, 58, 58, 58, 188, 58, | ||
| 1612 | 58, 58, 58, 58, 58, 58, 58, -171 | ||
| 1613 | }, | ||
| 1614 | |||
| 1615 | { | ||
| 1616 | 11, -172, -172, -172, -172, -172, -172, -172, -172, -172, | ||
| 1617 | -172, -172, -172, 58, -172, -172, 58, 58, 58, 58, | ||
| 1618 | |||
| 1619 | 58, 58, 58, 58, 58, 58, 58, 58, 189, 58, | ||
| 1620 | 58, 58, 58, 58, 58, 58, 58, -172 | ||
| 1621 | }, | ||
| 1622 | |||
| 1623 | { | ||
| 1624 | 11, -173, -173, -173, -173, -173, -173, -173, -173, -173, | ||
| 1625 | -173, -173, -173, 58, -173, -173, 58, 190, 58, 58, | ||
| 1626 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1627 | 58, 58, 58, 58, 58, 58, 58, -173 | ||
| 1628 | }, | ||
| 1629 | |||
| 1630 | { | ||
| 1631 | 11, -174, -174, -174, -174, -174, -174, -174, -174, -174, | ||
| 1632 | -174, -174, -174, 58, -174, -174, 58, 58, 58, 58, | ||
| 1633 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1634 | 58, 58, 58, 58, 58, 58, 58, -174 | ||
| 1635 | |||
| 1636 | }, | ||
| 1637 | |||
| 1638 | { | ||
| 1639 | 11, -175, -175, -175, -175, -175, -175, -175, -175, -175, | ||
| 1640 | -175, -175, -175, 58, -175, -175, 58, 58, 58, 58, | ||
| 1641 | 58, 191, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1642 | 58, 58, 58, 58, 58, 58, 58, -175 | ||
| 1643 | }, | ||
| 1644 | |||
| 1645 | { | ||
| 1646 | 11, -176, -176, -176, -176, -176, -176, -176, -176, -176, | ||
| 1647 | -176, -176, -176, 58, -176, -176, 58, 58, 58, 58, | ||
| 1648 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1649 | 58, 58, 58, 58, 58, 58, 58, -176 | ||
| 1650 | }, | ||
| 1651 | |||
| 1652 | { | ||
| 1653 | 11, -177, -177, -177, -177, -177, -177, -177, -177, -177, | ||
| 1654 | -177, -177, -177, 58, -177, -177, 58, 58, 58, 58, | ||
| 1655 | |||
| 1656 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1657 | 58, 58, 58, 58, 58, 58, 58, -177 | ||
| 1658 | }, | ||
| 1659 | |||
| 1660 | { | ||
| 1661 | 11, -178, -178, -178, -178, -178, -178, -178, -178, -178, | ||
| 1662 | -178, -178, -178, 58, -178, -178, 58, 58, 58, 58, | ||
| 1663 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1664 | 58, 58, 58, 58, 58, 58, 58, -178 | ||
| 1665 | }, | ||
| 1666 | |||
| 1667 | { | ||
| 1668 | 11, -179, -179, -179, -179, -179, -179, -179, -179, -179, | ||
| 1669 | -179, -179, -179, 58, -179, -179, 58, 58, 58, 58, | ||
| 1670 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1671 | 58, 58, 58, 58, 192, 58, 58, -179 | ||
| 1672 | |||
| 1673 | }, | ||
| 1674 | |||
| 1675 | { | ||
| 1676 | 11, -180, -180, -180, -180, -180, -180, -180, -180, -180, | ||
| 1677 | -180, -180, -180, 58, -180, -180, 58, 58, 58, 58, | ||
| 1678 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1679 | 58, 58, 58, 58, 58, 58, 58, -180 | ||
| 1680 | }, | ||
| 1681 | |||
| 1682 | { | ||
| 1683 | 11, -181, -181, -181, -181, -181, -181, -181, -181, -181, | ||
| 1684 | -181, -181, -181, 58, -181, -181, 58, 58, 58, 58, | ||
| 1685 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1686 | 58, 58, 58, 58, 58, 58, 58, -181 | ||
| 1687 | }, | ||
| 1688 | |||
| 1689 | { | ||
| 1690 | 11, -182, -182, -182, -182, -182, -182, -182, -182, -182, | ||
| 1691 | -182, -182, -182, 58, -182, -182, 58, 58, 58, 58, | ||
| 1692 | |||
| 1693 | 58, 58, 58, 58, 58, 58, 193, 58, 58, 58, | ||
| 1694 | 58, 58, 58, 58, 58, 58, 58, -182 | ||
| 1695 | }, | ||
| 1696 | |||
| 1697 | { | ||
| 1698 | 11, -183, -183, -183, -183, -183, -183, -183, -183, -183, | ||
| 1699 | -183, -183, -183, 58, -183, -183, 58, 58, 58, 58, | ||
| 1700 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1701 | 58, 58, 58, 194, 58, 58, 58, -183 | ||
| 1702 | }, | ||
| 1703 | |||
| 1704 | { | ||
| 1705 | 11, -184, -184, -184, -184, -184, -184, -184, -184, -184, | ||
| 1706 | -184, -184, -184, 58, -184, -184, 58, 58, 58, 58, | ||
| 1707 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1708 | 58, 58, 58, 58, 58, 58, 58, -184 | ||
| 1709 | |||
| 1710 | }, | ||
| 1711 | |||
| 1712 | { | ||
| 1713 | 11, -185, -185, -185, -185, -185, -185, -185, -185, -185, | ||
| 1714 | -185, -185, -185, 58, -185, -185, 58, 58, 58, 58, | ||
| 1715 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1716 | 58, 58, 58, 58, 58, 58, 58, -185 | ||
| 1717 | }, | ||
| 1718 | |||
| 1719 | { | ||
| 1720 | 11, -186, -186, -186, -186, -186, -186, -186, -186, -186, | ||
| 1721 | -186, -186, -186, 58, -186, -186, 58, 58, 58, 195, | ||
| 1722 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1723 | 58, 58, 58, 58, 58, 58, 58, -186 | ||
| 1724 | }, | ||
| 1725 | |||
| 1726 | { | ||
| 1727 | 11, -187, -187, -187, -187, -187, -187, -187, -187, -187, | ||
| 1728 | -187, -187, -187, 58, -187, -187, 58, 58, 58, 58, | ||
| 1729 | |||
| 1730 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1731 | 58, 58, 58, 58, 58, 58, 58, -187 | ||
| 1732 | }, | ||
| 1733 | |||
| 1734 | { | ||
| 1735 | 11, -188, -188, -188, -188, -188, -188, -188, -188, -188, | ||
| 1736 | -188, -188, -188, 58, -188, -188, 58, 58, 58, 58, | ||
| 1737 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1738 | 58, 58, 58, 58, 58, 196, 58, -188 | ||
| 1739 | }, | ||
| 1740 | |||
| 1741 | { | ||
| 1742 | 11, -189, -189, -189, -189, -189, -189, -189, -189, -189, | ||
| 1743 | -189, -189, -189, 58, -189, -189, 58, 58, 58, 58, | ||
| 1744 | 58, 58, 197, 58, 58, 58, 58, 58, 58, 58, | ||
| 1745 | 58, 58, 58, 58, 58, 58, 58, -189 | ||
| 1746 | |||
| 1747 | }, | ||
| 1748 | |||
| 1749 | { | ||
| 1750 | 11, -190, -190, -190, -190, -190, -190, -190, -190, -190, | ||
| 1751 | -190, -190, -190, 58, -190, -190, 58, 58, 58, 58, | ||
| 1752 | 58, 58, 58, 58, 58, 58, 198, 58, 58, 58, | ||
| 1753 | 58, 58, 58, 58, 58, 58, 58, -190 | ||
| 1754 | }, | ||
| 1755 | |||
| 1756 | { | ||
| 1757 | 11, -191, -191, -191, -191, -191, -191, -191, -191, -191, | ||
| 1758 | -191, -191, -191, 58, -191, -191, 58, 58, 58, 58, | ||
| 1759 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1760 | 58, 58, 58, 199, 58, 58, 58, -191 | ||
| 1761 | }, | ||
| 1762 | |||
| 1763 | { | ||
| 1764 | 11, -192, -192, -192, -192, -192, -192, -192, -192, -192, | ||
| 1765 | -192, -192, -192, 58, -192, -192, 58, 58, 58, 58, | ||
| 1766 | |||
| 1767 | 58, 200, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1768 | 58, 58, 58, 58, 58, 58, 58, -192 | ||
| 1769 | }, | ||
| 1770 | |||
| 1771 | { | ||
| 1772 | 11, -193, -193, -193, -193, -193, -193, -193, -193, -193, | ||
| 1773 | -193, -193, -193, 58, -193, -193, 58, 58, 58, 58, | ||
| 1774 | 58, 201, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1775 | 58, 58, 58, 58, 58, 58, 58, -193 | ||
| 1776 | }, | ||
| 1777 | |||
| 1778 | { | ||
| 1779 | 11, -194, -194, -194, -194, -194, -194, -194, -194, -194, | ||
| 1780 | -194, -194, -194, 58, -194, -194, 58, 58, 58, 58, | ||
| 1781 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1782 | 58, 58, 58, 58, 202, 58, 58, -194 | ||
| 1783 | |||
| 1784 | }, | ||
| 1785 | |||
| 1786 | { | ||
| 1787 | 11, -195, -195, -195, -195, -195, -195, -195, -195, -195, | ||
| 1788 | -195, -195, -195, 58, -195, -195, 58, 58, 58, 58, | ||
| 1789 | 58, 203, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1790 | 58, 58, 58, 58, 58, 58, 58, -195 | ||
| 1791 | }, | ||
| 1792 | |||
| 1793 | { | ||
| 1794 | 11, -196, -196, -196, -196, -196, -196, -196, -196, -196, | ||
| 1795 | -196, -196, -196, 58, -196, -196, 58, 58, 58, 58, | ||
| 1796 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1797 | 58, 58, 58, 58, 58, 58, 58, -196 | ||
| 1798 | }, | ||
| 1799 | |||
| 1800 | { | ||
| 1801 | 11, -197, -197, -197, -197, -197, -197, -197, -197, -197, | ||
| 1802 | -197, -197, -197, 58, -197, -197, 58, 58, 58, 58, | ||
| 1803 | |||
| 1804 | 58, 58, 58, 58, 58, 204, 58, 58, 58, 58, | ||
| 1805 | 58, 58, 58, 58, 58, 58, 58, -197 | ||
| 1806 | }, | ||
| 1807 | |||
| 1808 | { | ||
| 1809 | 11, -198, -198, -198, -198, -198, -198, -198, -198, -198, | ||
| 1810 | -198, -198, -198, 58, -198, -198, 58, 58, 58, 58, | ||
| 1811 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1812 | 58, 58, 58, 58, 58, 58, 58, -198 | ||
| 1813 | }, | ||
| 1814 | |||
| 1815 | { | ||
| 1816 | 11, -199, -199, -199, -199, -199, -199, -199, -199, -199, | ||
| 1817 | -199, -199, -199, 58, -199, -199, 58, 58, 58, 58, | ||
| 1818 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1819 | 58, 58, 58, 58, 58, 58, 58, -199 | ||
| 1820 | |||
| 1821 | }, | ||
| 1822 | |||
| 1823 | { | ||
| 1824 | 11, -200, -200, -200, -200, -200, -200, -200, -200, -200, | ||
| 1825 | -200, -200, -200, 58, -200, -200, 58, 58, 58, 58, | ||
| 1826 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1827 | 58, 58, 58, 58, 58, 58, 58, -200 | ||
| 1828 | }, | ||
| 1829 | |||
| 1830 | { | ||
| 1831 | 11, -201, -201, -201, -201, -201, -201, -201, -201, -201, | ||
| 1832 | -201, -201, -201, 58, -201, -201, 58, 205, 58, 58, | ||
| 1833 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1834 | 58, 58, 58, 58, 58, 58, 58, -201 | ||
| 1835 | }, | ||
| 1836 | |||
| 1837 | { | ||
| 1838 | 11, -202, -202, -202, -202, -202, -202, -202, -202, -202, | ||
| 1839 | -202, -202, -202, 58, -202, -202, 58, 206, 58, 58, | ||
| 1840 | |||
| 1841 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1842 | 58, 58, 58, 58, 58, 58, 58, -202 | ||
| 1843 | }, | ||
| 1844 | |||
| 1845 | { | ||
| 1846 | 11, -203, -203, -203, -203, -203, -203, -203, -203, -203, | ||
| 1847 | -203, -203, -203, 58, -203, -203, 58, 58, 58, 58, | ||
| 1848 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1849 | 58, 58, 58, 58, 58, 58, 58, -203 | ||
| 1850 | }, | ||
| 1851 | |||
| 1852 | { | ||
| 1853 | 11, -204, -204, -204, -204, -204, -204, -204, -204, -204, | ||
| 1854 | -204, -204, -204, 58, -204, -204, 58, 58, 58, 58, | ||
| 1855 | 58, 58, 58, 207, 58, 58, 58, 58, 58, 58, | ||
| 1856 | 58, 58, 58, 58, 58, 58, 58, -204 | ||
| 1857 | |||
| 1858 | }, | ||
| 1859 | |||
| 1860 | { | ||
| 1861 | 11, -205, -205, -205, -205, -205, -205, -205, -205, -205, | ||
| 1862 | -205, -205, -205, 58, -205, -205, 58, 58, 58, 58, | ||
| 1863 | 58, 58, 58, 58, 58, 58, 58, 58, 208, 58, | ||
| 1864 | 58, 58, 58, 58, 58, 58, 58, -205 | ||
| 1865 | }, | ||
| 1866 | |||
| 1867 | { | ||
| 1868 | 11, -206, -206, -206, -206, -206, -206, -206, -206, -206, | ||
| 1869 | -206, -206, -206, 58, -206, -206, 58, 58, 58, 58, | ||
| 1870 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1871 | 58, 58, 58, 58, 209, 58, 58, -206 | ||
| 1872 | }, | ||
| 1873 | |||
| 1874 | { | ||
| 1875 | 11, -207, -207, -207, -207, -207, -207, -207, -207, -207, | ||
| 1876 | -207, -207, -207, 58, -207, -207, 58, 58, 58, 58, | ||
| 1877 | |||
| 1878 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1879 | 58, 58, 58, 58, 58, 58, 58, -207 | ||
| 1880 | }, | ||
| 1881 | |||
| 1882 | { | ||
| 1883 | 11, -208, -208, -208, -208, -208, -208, -208, -208, -208, | ||
| 1884 | -208, -208, -208, 58, -208, -208, 58, 58, 58, 58, | ||
| 1885 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1886 | 58, 58, 58, 58, 58, 58, 58, -208 | ||
| 1887 | }, | ||
| 1888 | |||
| 1889 | { | ||
| 1890 | 11, -209, -209, -209, -209, -209, -209, -209, -209, -209, | ||
| 1891 | -209, -209, -209, 58, -209, -209, 58, 58, 58, 58, | ||
| 1892 | 58, 210, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1893 | 58, 58, 58, 58, 58, 58, 58, -209 | ||
| 1894 | |||
| 1895 | }, | ||
| 1896 | |||
| 1897 | { | ||
| 1898 | 11, -210, -210, -210, -210, -210, -210, -210, -210, -210, | ||
| 1899 | -210, -210, -210, 58, -210, -210, 58, 58, 58, 58, | ||
| 1900 | 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, | ||
| 1901 | 58, 58, 58, 58, 58, 58, 58, -210 | ||
| 1902 | }, | ||
| 1903 | |||
| 1904 | } ; | ||
| 1905 | |||
| 1906 | static yy_state_type yy_get_previous_state (void ); | ||
| 1907 | static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); | ||
| 1908 | static int yy_get_next_buffer (void ); | ||
| 1909 | static void yy_fatal_error (yyconst char msg[] ); | ||
| 1910 | |||
| 1911 | /* Done after the current pattern has been matched and before the | ||
| 1912 | * corresponding action - sets up zconftext. | ||
| 1913 | */ | ||
| 1914 | #define YY_DO_BEFORE_ACTION \ | ||
| 1915 | (yytext_ptr) = yy_bp; \ | ||
| 1916 | zconfleng = (size_t) (yy_cp - yy_bp); \ | ||
| 1917 | (yy_hold_char) = *yy_cp; \ | ||
| 1918 | *yy_cp = '\0'; \ | ||
| 1919 | (yy_c_buf_p) = yy_cp; | ||
| 1920 | |||
| 1921 | #define YY_NUM_RULES 64 | ||
| 1922 | #define YY_END_OF_BUFFER 65 | ||
| 1923 | /* This struct is not used in this scanner, | ||
| 1924 | but its presence is necessary. */ | ||
| 1925 | struct yy_trans_info | ||
| 1926 | { | ||
| 1927 | flex_int32_t yy_verify; | ||
| 1928 | flex_int32_t yy_nxt; | ||
| 1929 | }; | ||
| 1930 | static yyconst flex_int16_t yy_accept[211] = | ||
| 1931 | { 0, | ||
| 1932 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 1933 | 65, 5, 4, 3, 2, 36, 37, 35, 35, 35, | ||
| 1934 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | ||
| 1935 | 63, 60, 62, 55, 59, 58, 57, 53, 48, 42, | ||
| 1936 | 47, 51, 53, 40, 41, 50, 50, 43, 53, 50, | ||
| 1937 | 50, 53, 4, 3, 2, 2, 1, 35, 35, 35, | ||
| 1938 | 35, 35, 35, 35, 16, 35, 35, 35, 35, 35, | ||
| 1939 | 35, 35, 35, 35, 35, 35, 63, 60, 62, 61, | ||
| 1940 | 55, 54, 57, 56, 44, 51, 38, 50, 50, 52, | ||
| 1941 | 45, 46, 39, 35, 35, 35, 35, 35, 35, 35, | ||
| 1942 | |||
| 1943 | 35, 35, 30, 29, 35, 35, 35, 35, 35, 35, | ||
| 1944 | 35, 35, 35, 35, 49, 25, 35, 35, 35, 35, | ||
| 1945 | 35, 35, 35, 35, 35, 35, 15, 35, 7, 35, | ||
| 1946 | 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, | ||
| 1947 | 35, 35, 35, 35, 35, 35, 35, 17, 35, 35, | ||
| 1948 | 35, 35, 35, 34, 35, 35, 35, 35, 35, 35, | ||
| 1949 | 10, 35, 13, 35, 35, 35, 35, 33, 35, 35, | ||
| 1950 | 35, 35, 35, 22, 35, 32, 9, 31, 35, 26, | ||
| 1951 | 12, 35, 35, 21, 18, 35, 8, 35, 35, 35, | ||
| 1952 | 35, 35, 27, 35, 35, 6, 35, 20, 19, 23, | ||
| 1953 | |||
| 1954 | 35, 35, 11, 35, 35, 35, 14, 28, 35, 24 | ||
| 1955 | } ; | ||
| 1956 | |||
| 1957 | static yyconst flex_int32_t yy_ec[256] = | ||
| 1958 | { 0, | ||
| 1959 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | ||
| 1960 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1961 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1962 | 1, 2, 4, 5, 6, 1, 1, 7, 8, 9, | ||
| 1963 | 10, 1, 1, 1, 11, 12, 12, 13, 13, 13, | ||
| 1964 | 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, | ||
| 1965 | 14, 1, 1, 1, 13, 13, 13, 13, 13, 13, | ||
| 1966 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
| 1967 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
| 1968 | 1, 15, 1, 1, 16, 1, 17, 18, 19, 20, | ||
| 1969 | |||
| 1970 | 21, 22, 23, 24, 25, 13, 13, 26, 27, 28, | ||
| 1971 | 29, 30, 31, 32, 33, 34, 35, 13, 13, 36, | ||
| 1972 | 13, 13, 1, 37, 1, 1, 1, 1, 1, 1, | ||
| 1973 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1974 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1975 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1976 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1977 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1978 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1979 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1980 | |||
| 1981 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1982 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1983 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1984 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1985 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1986 | 1, 1, 1, 1, 1 | ||
| 1987 | } ; | ||
| 1988 | |||
| 1989 | extern int zconf_flex_debug; | ||
| 1990 | int zconf_flex_debug = 0; | ||
| 1991 | |||
| 1992 | /* The intent behind this definition is that it'll catch | ||
| 1993 | * any uses of REJECT which flex missed. | ||
| 1994 | */ | ||
| 1995 | #define REJECT reject_used_but_not_detected | ||
| 1996 | #define yymore() yymore_used_but_not_detected | ||
| 1997 | #define YY_MORE_ADJ 0 | ||
| 1998 | #define YY_RESTORE_YY_MORE_OFFSET | ||
| 1999 | char *zconftext; | ||
| 2000 | |||
| 2001 | /* | ||
| 2002 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 2003 | * Released under the terms of the GNU GPL v2.0. | ||
| 2004 | */ | ||
| 2005 | |||
| 2006 | #include <limits.h> | ||
| 2007 | #include <stdio.h> | ||
| 2008 | #include <stdlib.h> | ||
| 2009 | #include <string.h> | ||
| 2010 | #include <unistd.h> | ||
| 2011 | |||
| 2012 | #define LKC_DIRECT_LINK | ||
| 2013 | #include "lkc.h" | ||
| 2014 | |||
| 2015 | #define START_STRSIZE 16 | ||
| 2016 | |||
| 2017 | char *text; | ||
| 2018 | static char *text_ptr; | ||
| 2019 | static int text_size, text_asize; | ||
| 2020 | |||
| 2021 | struct buffer { | ||
| 2022 | struct buffer *parent; | ||
| 2023 | YY_BUFFER_STATE state; | ||
| 2024 | }; | ||
| 2025 | |||
| 2026 | struct buffer *current_buf; | ||
| 2027 | |||
| 2028 | static int last_ts, first_ts; | ||
| 2029 | |||
| 2030 | static void zconf_endhelp(void); | ||
| 2031 | static struct buffer *zconf_endfile(void); | ||
| 2032 | |||
| 2033 | void new_string(void) | ||
| 2034 | { | ||
| 2035 | text = malloc(START_STRSIZE); | ||
| 2036 | text_asize = START_STRSIZE; | ||
| 2037 | text_ptr = text; | ||
| 2038 | text_size = 0; | ||
| 2039 | *text_ptr = 0; | ||
| 2040 | } | ||
| 2041 | |||
| 2042 | void append_string(const char *str, int size) | ||
| 2043 | { | ||
| 2044 | int new_size = text_size + size + 1; | ||
| 2045 | if (new_size > text_asize) { | ||
| 2046 | text = realloc(text, new_size); | ||
| 2047 | text_asize = new_size; | ||
| 2048 | text_ptr = text + text_size; | ||
| 2049 | } | ||
| 2050 | memcpy(text_ptr, str, size); | ||
| 2051 | text_ptr += size; | ||
| 2052 | text_size += size; | ||
| 2053 | *text_ptr = 0; | ||
| 2054 | } | ||
| 2055 | |||
| 2056 | void alloc_string(const char *str, int size) | ||
| 2057 | { | ||
| 2058 | text = malloc(size + 1); | ||
| 2059 | memcpy(text, str, size); | ||
| 2060 | text[size] = 0; | ||
| 2061 | } | ||
| 2062 | |||
| 2063 | #define INITIAL 0 | ||
| 2064 | #define COMMAND 1 | ||
| 2065 | #define HELP 2 | ||
| 2066 | #define STRING 3 | ||
| 2067 | #define PARAM 4 | ||
| 2068 | |||
| 2069 | /* Special case for "unistd.h", since it is non-ANSI. We include it way | ||
| 2070 | * down here because we want the user's section 1 to have been scanned first. | ||
| 2071 | * The user has a chance to override it with an option. | ||
| 2072 | */ | ||
| 2073 | #include <unistd.h> | ||
| 2074 | |||
| 2075 | #ifndef YY_EXTRA_TYPE | ||
| 2076 | #define YY_EXTRA_TYPE void * | ||
| 2077 | #endif | ||
| 2078 | |||
| 2079 | /* Macros after this point can all be overridden by user definitions in | ||
| 2080 | * section 1. | ||
| 2081 | */ | ||
| 2082 | |||
| 2083 | #ifndef YY_SKIP_YYWRAP | ||
| 2084 | #ifdef __cplusplus | ||
| 2085 | extern "C" int zconfwrap (void ); | ||
| 2086 | #else | ||
| 2087 | extern int zconfwrap (void ); | ||
| 2088 | #endif | ||
| 2089 | #endif | ||
| 2090 | |||
| 2091 | static void yyunput (int c,char *buf_ptr ); | ||
| 2092 | |||
| 2093 | #ifndef yytext_ptr | ||
| 2094 | static void yy_flex_strncpy (char *,yyconst char *,int ); | ||
| 2095 | #endif | ||
| 2096 | |||
| 2097 | #ifdef YY_NEED_STRLEN | ||
| 2098 | static int yy_flex_strlen (yyconst char * ); | ||
| 2099 | #endif | ||
| 2100 | |||
| 2101 | #ifndef YY_NO_INPUT | ||
| 2102 | |||
| 2103 | #ifdef __cplusplus | ||
| 2104 | static int yyinput (void ); | ||
| 2105 | #else | ||
| 2106 | static int input (void ); | ||
| 2107 | #endif | ||
| 2108 | |||
| 2109 | #endif | ||
| 2110 | |||
| 2111 | /* Amount of stuff to slurp up with each read. */ | ||
| 2112 | #ifndef YY_READ_BUF_SIZE | ||
| 2113 | #define YY_READ_BUF_SIZE 8192 | ||
| 2114 | #endif | ||
| 2115 | |||
| 2116 | /* Copy whatever the last rule matched to the standard output. */ | ||
| 2117 | #ifndef ECHO | ||
| 2118 | /* This used to be an fputs(), but since the string might contain NUL's, | ||
| 2119 | * we now use fwrite(). | ||
| 2120 | */ | ||
| 2121 | #define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout ) | ||
| 2122 | #endif | ||
| 2123 | |||
| 2124 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | ||
| 2125 | * is returned in "result". | ||
| 2126 | */ | ||
| 2127 | #ifndef YY_INPUT | ||
| 2128 | #define YY_INPUT(buf,result,max_size) \ | ||
| 2129 | errno=0; \ | ||
| 2130 | while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \ | ||
| 2131 | { \ | ||
| 2132 | if( errno != EINTR) \ | ||
| 2133 | { \ | ||
| 2134 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
| 2135 | break; \ | ||
| 2136 | } \ | ||
| 2137 | errno=0; \ | ||
| 2138 | clearerr(zconfin); \ | ||
| 2139 | }\ | ||
| 2140 | \ | ||
| 2141 | |||
| 2142 | #endif | ||
| 2143 | |||
| 2144 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | ||
| 2145 | * we don't want an extra ';' after the "return" because that will cause | ||
| 2146 | * some compilers to complain about unreachable statements. | ||
| 2147 | */ | ||
| 2148 | #ifndef yyterminate | ||
| 2149 | #define yyterminate() return YY_NULL | ||
| 2150 | #endif | ||
| 2151 | |||
| 2152 | /* Number of entries by which start-condition stack grows. */ | ||
| 2153 | #ifndef YY_START_STACK_INCR | ||
| 2154 | #define YY_START_STACK_INCR 25 | ||
| 2155 | #endif | ||
| 2156 | |||
| 2157 | /* Report a fatal error. */ | ||
| 2158 | #ifndef YY_FATAL_ERROR | ||
| 2159 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | ||
| 2160 | #endif | ||
| 2161 | |||
| 2162 | /* end tables serialization structures and prototypes */ | ||
| 2163 | |||
| 2164 | /* Default declaration of generated scanner - a define so the user can | ||
| 2165 | * easily add parameters. | ||
| 2166 | */ | ||
| 2167 | #ifndef YY_DECL | ||
| 2168 | #define YY_DECL_IS_OURS 1 | ||
| 2169 | |||
| 2170 | extern int zconflex (void); | ||
| 2171 | |||
| 2172 | #define YY_DECL int zconflex (void) | ||
| 2173 | #endif /* !YY_DECL */ | ||
| 2174 | |||
| 2175 | /* Code executed at the beginning of each rule, after zconftext and zconfleng | ||
| 2176 | * have been set up. | ||
| 2177 | */ | ||
| 2178 | #ifndef YY_USER_ACTION | ||
| 2179 | #define YY_USER_ACTION | ||
| 2180 | #endif | ||
| 2181 | |||
| 2182 | /* Code executed at the end of each rule. */ | ||
| 2183 | #ifndef YY_BREAK | ||
| 2184 | #define YY_BREAK break; | ||
| 2185 | #endif | ||
| 2186 | |||
| 2187 | #define YY_RULE_SETUP \ | ||
| 2188 | YY_USER_ACTION | ||
| 2189 | |||
| 2190 | /** The main scanner function which does all the work. | ||
| 2191 | */ | ||
| 2192 | YY_DECL | ||
| 2193 | { | ||
| 2194 | register yy_state_type yy_current_state; | ||
| 2195 | register char *yy_cp, *yy_bp; | ||
| 2196 | register int yy_act; | ||
| 2197 | |||
| 2198 | int str = 0; | ||
| 2199 | int ts, i; | ||
| 2200 | |||
| 2201 | if ( (yy_init) ) | ||
| 2202 | { | ||
| 2203 | (yy_init) = 0; | ||
| 2204 | |||
| 2205 | #ifdef YY_USER_INIT | ||
| 2206 | YY_USER_INIT; | ||
| 2207 | #endif | ||
| 2208 | |||
| 2209 | if ( ! (yy_start) ) | ||
| 2210 | (yy_start) = 1; /* first start state */ | ||
| 2211 | |||
| 2212 | if ( ! zconfin ) | ||
| 2213 | zconfin = stdin; | ||
| 2214 | |||
| 2215 | if ( ! zconfout ) | ||
| 2216 | zconfout = stdout; | ||
| 2217 | |||
| 2218 | if ( ! YY_CURRENT_BUFFER ) { | ||
| 2219 | zconfensure_buffer_stack (); | ||
| 2220 | YY_CURRENT_BUFFER_LVALUE = | ||
| 2221 | zconf_create_buffer(zconfin,YY_BUF_SIZE ); | ||
| 2222 | } | ||
| 2223 | |||
| 2224 | zconf_load_buffer_state( ); | ||
| 2225 | } | ||
| 2226 | |||
| 2227 | while ( 1 ) /* loops until end-of-file is reached */ | ||
| 2228 | { | ||
| 2229 | yy_cp = (yy_c_buf_p); | ||
| 2230 | |||
| 2231 | /* Support of zconftext. */ | ||
| 2232 | *yy_cp = (yy_hold_char); | ||
| 2233 | |||
| 2234 | /* yy_bp points to the position in yy_ch_buf of the start of | ||
| 2235 | * the current run. | ||
| 2236 | */ | ||
| 2237 | yy_bp = yy_cp; | ||
| 2238 | |||
| 2239 | yy_current_state = (yy_start); | ||
| 2240 | yy_match: | ||
| 2241 | while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) | ||
| 2242 | ++yy_cp; | ||
| 2243 | |||
| 2244 | yy_current_state = -yy_current_state; | ||
| 2245 | |||
| 2246 | yy_find_action: | ||
| 2247 | yy_act = yy_accept[yy_current_state]; | ||
| 2248 | |||
| 2249 | YY_DO_BEFORE_ACTION; | ||
| 2250 | |||
| 2251 | do_action: /* This label is used only to access EOF actions. */ | ||
| 2252 | |||
| 2253 | switch ( yy_act ) | ||
| 2254 | { /* beginning of action switch */ | ||
| 2255 | case 1: | ||
| 2256 | /* rule 1 can match eol */ | ||
| 2257 | YY_RULE_SETUP | ||
| 2258 | current_file->lineno++; | ||
| 2259 | YY_BREAK | ||
| 2260 | case 2: | ||
| 2261 | YY_RULE_SETUP | ||
| 2262 | |||
| 2263 | YY_BREAK | ||
| 2264 | case 3: | ||
| 2265 | /* rule 3 can match eol */ | ||
| 2266 | YY_RULE_SETUP | ||
| 2267 | current_file->lineno++; return T_EOL; | ||
| 2268 | YY_BREAK | ||
| 2269 | case 4: | ||
| 2270 | YY_RULE_SETUP | ||
| 2271 | { | ||
| 2272 | BEGIN(COMMAND); | ||
| 2273 | } | ||
| 2274 | YY_BREAK | ||
| 2275 | case 5: | ||
| 2276 | YY_RULE_SETUP | ||
| 2277 | { | ||
| 2278 | unput(zconftext[0]); | ||
| 2279 | BEGIN(COMMAND); | ||
| 2280 | } | ||
| 2281 | YY_BREAK | ||
| 2282 | |||
| 2283 | case 6: | ||
| 2284 | YY_RULE_SETUP | ||
| 2285 | BEGIN(PARAM); return T_MAINMENU; | ||
| 2286 | YY_BREAK | ||
| 2287 | case 7: | ||
| 2288 | YY_RULE_SETUP | ||
| 2289 | BEGIN(PARAM); return T_MENU; | ||
| 2290 | YY_BREAK | ||
| 2291 | case 8: | ||
| 2292 | YY_RULE_SETUP | ||
| 2293 | BEGIN(PARAM); return T_ENDMENU; | ||
| 2294 | YY_BREAK | ||
| 2295 | case 9: | ||
| 2296 | YY_RULE_SETUP | ||
| 2297 | BEGIN(PARAM); return T_SOURCE; | ||
| 2298 | YY_BREAK | ||
| 2299 | case 10: | ||
| 2300 | YY_RULE_SETUP | ||
| 2301 | BEGIN(PARAM); return T_CHOICE; | ||
| 2302 | YY_BREAK | ||
| 2303 | case 11: | ||
| 2304 | YY_RULE_SETUP | ||
| 2305 | BEGIN(PARAM); return T_ENDCHOICE; | ||
| 2306 | YY_BREAK | ||
| 2307 | case 12: | ||
| 2308 | YY_RULE_SETUP | ||
| 2309 | BEGIN(PARAM); return T_COMMENT; | ||
| 2310 | YY_BREAK | ||
| 2311 | case 13: | ||
| 2312 | YY_RULE_SETUP | ||
| 2313 | BEGIN(PARAM); return T_CONFIG; | ||
| 2314 | YY_BREAK | ||
| 2315 | case 14: | ||
| 2316 | YY_RULE_SETUP | ||
| 2317 | BEGIN(PARAM); return T_MENUCONFIG; | ||
| 2318 | YY_BREAK | ||
| 2319 | case 15: | ||
| 2320 | YY_RULE_SETUP | ||
| 2321 | BEGIN(PARAM); return T_HELP; | ||
| 2322 | YY_BREAK | ||
| 2323 | case 16: | ||
| 2324 | YY_RULE_SETUP | ||
| 2325 | BEGIN(PARAM); return T_IF; | ||
| 2326 | YY_BREAK | ||
| 2327 | case 17: | ||
| 2328 | YY_RULE_SETUP | ||
| 2329 | BEGIN(PARAM); return T_ENDIF; | ||
| 2330 | YY_BREAK | ||
| 2331 | case 18: | ||
| 2332 | YY_RULE_SETUP | ||
| 2333 | BEGIN(PARAM); return T_DEPENDS; | ||
| 2334 | YY_BREAK | ||
| 2335 | case 19: | ||
| 2336 | YY_RULE_SETUP | ||
| 2337 | BEGIN(PARAM); return T_REQUIRES; | ||
| 2338 | YY_BREAK | ||
| 2339 | case 20: | ||
| 2340 | YY_RULE_SETUP | ||
| 2341 | BEGIN(PARAM); return T_OPTIONAL; | ||
| 2342 | YY_BREAK | ||
| 2343 | case 21: | ||
| 2344 | YY_RULE_SETUP | ||
| 2345 | BEGIN(PARAM); return T_DEFAULT; | ||
| 2346 | YY_BREAK | ||
| 2347 | case 22: | ||
| 2348 | YY_RULE_SETUP | ||
| 2349 | BEGIN(PARAM); return T_PROMPT; | ||
| 2350 | YY_BREAK | ||
| 2351 | case 23: | ||
| 2352 | YY_RULE_SETUP | ||
| 2353 | BEGIN(PARAM); return T_TRISTATE; | ||
| 2354 | YY_BREAK | ||
| 2355 | case 24: | ||
| 2356 | YY_RULE_SETUP | ||
| 2357 | BEGIN(PARAM); return T_DEF_TRISTATE; | ||
| 2358 | YY_BREAK | ||
| 2359 | case 25: | ||
| 2360 | YY_RULE_SETUP | ||
| 2361 | BEGIN(PARAM); return T_BOOLEAN; | ||
| 2362 | YY_BREAK | ||
| 2363 | case 26: | ||
| 2364 | YY_RULE_SETUP | ||
| 2365 | BEGIN(PARAM); return T_BOOLEAN; | ||
| 2366 | YY_BREAK | ||
| 2367 | case 27: | ||
| 2368 | YY_RULE_SETUP | ||
| 2369 | BEGIN(PARAM); return T_DEF_BOOLEAN; | ||
| 2370 | YY_BREAK | ||
| 2371 | case 28: | ||
| 2372 | YY_RULE_SETUP | ||
| 2373 | BEGIN(PARAM); return T_DEF_BOOLEAN; | ||
| 2374 | YY_BREAK | ||
| 2375 | case 29: | ||
| 2376 | YY_RULE_SETUP | ||
| 2377 | BEGIN(PARAM); return T_INT; | ||
| 2378 | YY_BREAK | ||
| 2379 | case 30: | ||
| 2380 | YY_RULE_SETUP | ||
| 2381 | BEGIN(PARAM); return T_HEX; | ||
| 2382 | YY_BREAK | ||
| 2383 | case 31: | ||
| 2384 | YY_RULE_SETUP | ||
| 2385 | BEGIN(PARAM); return T_STRING; | ||
| 2386 | YY_BREAK | ||
| 2387 | case 32: | ||
| 2388 | YY_RULE_SETUP | ||
| 2389 | BEGIN(PARAM); return T_SELECT; | ||
| 2390 | YY_BREAK | ||
| 2391 | case 33: | ||
| 2392 | YY_RULE_SETUP | ||
| 2393 | BEGIN(PARAM); return T_SELECT; | ||
| 2394 | YY_BREAK | ||
| 2395 | case 34: | ||
| 2396 | YY_RULE_SETUP | ||
| 2397 | BEGIN(PARAM); return T_RANGE; | ||
| 2398 | YY_BREAK | ||
| 2399 | case 35: | ||
| 2400 | YY_RULE_SETUP | ||
| 2401 | { | ||
| 2402 | alloc_string(zconftext, zconfleng); | ||
| 2403 | zconflval.string = text; | ||
| 2404 | return T_WORD; | ||
| 2405 | } | ||
| 2406 | YY_BREAK | ||
| 2407 | case 36: | ||
| 2408 | YY_RULE_SETUP | ||
| 2409 | |||
| 2410 | YY_BREAK | ||
| 2411 | case 37: | ||
| 2412 | /* rule 37 can match eol */ | ||
| 2413 | YY_RULE_SETUP | ||
| 2414 | current_file->lineno++; BEGIN(INITIAL); | ||
| 2415 | YY_BREAK | ||
| 2416 | |||
| 2417 | case 38: | ||
| 2418 | YY_RULE_SETUP | ||
| 2419 | return T_AND; | ||
| 2420 | YY_BREAK | ||
| 2421 | case 39: | ||
| 2422 | YY_RULE_SETUP | ||
| 2423 | return T_OR; | ||
| 2424 | YY_BREAK | ||
| 2425 | case 40: | ||
| 2426 | YY_RULE_SETUP | ||
| 2427 | return T_OPEN_PAREN; | ||
| 2428 | YY_BREAK | ||
| 2429 | case 41: | ||
| 2430 | YY_RULE_SETUP | ||
| 2431 | return T_CLOSE_PAREN; | ||
| 2432 | YY_BREAK | ||
| 2433 | case 42: | ||
| 2434 | YY_RULE_SETUP | ||
| 2435 | return T_NOT; | ||
| 2436 | YY_BREAK | ||
| 2437 | case 43: | ||
| 2438 | YY_RULE_SETUP | ||
| 2439 | return T_EQUAL; | ||
| 2440 | YY_BREAK | ||
| 2441 | case 44: | ||
| 2442 | YY_RULE_SETUP | ||
| 2443 | return T_UNEQUAL; | ||
| 2444 | YY_BREAK | ||
| 2445 | case 45: | ||
| 2446 | YY_RULE_SETUP | ||
| 2447 | return T_IF; | ||
| 2448 | YY_BREAK | ||
| 2449 | case 46: | ||
| 2450 | YY_RULE_SETUP | ||
| 2451 | return T_ON; | ||
| 2452 | YY_BREAK | ||
| 2453 | case 47: | ||
| 2454 | YY_RULE_SETUP | ||
| 2455 | { | ||
| 2456 | str = zconftext[0]; | ||
| 2457 | new_string(); | ||
| 2458 | BEGIN(STRING); | ||
| 2459 | } | ||
| 2460 | YY_BREAK | ||
| 2461 | case 48: | ||
| 2462 | /* rule 48 can match eol */ | ||
| 2463 | YY_RULE_SETUP | ||
| 2464 | BEGIN(INITIAL); current_file->lineno++; return T_EOL; | ||
| 2465 | YY_BREAK | ||
| 2466 | case 49: | ||
| 2467 | YY_RULE_SETUP | ||
| 2468 | /* ignore */ | ||
| 2469 | YY_BREAK | ||
| 2470 | case 50: | ||
| 2471 | YY_RULE_SETUP | ||
| 2472 | { | ||
| 2473 | alloc_string(zconftext, zconfleng); | ||
| 2474 | zconflval.string = text; | ||
| 2475 | return T_WORD; | ||
| 2476 | } | ||
| 2477 | YY_BREAK | ||
| 2478 | case 51: | ||
| 2479 | YY_RULE_SETUP | ||
| 2480 | /* comment */ | ||
| 2481 | YY_BREAK | ||
| 2482 | case 52: | ||
| 2483 | /* rule 52 can match eol */ | ||
| 2484 | YY_RULE_SETUP | ||
| 2485 | current_file->lineno++; | ||
| 2486 | YY_BREAK | ||
| 2487 | case 53: | ||
| 2488 | YY_RULE_SETUP | ||
| 2489 | |||
| 2490 | YY_BREAK | ||
| 2491 | case YY_STATE_EOF(PARAM): | ||
| 2492 | { | ||
| 2493 | BEGIN(INITIAL); | ||
| 2494 | } | ||
| 2495 | YY_BREAK | ||
| 2496 | |||
| 2497 | case 54: | ||
| 2498 | /* rule 54 can match eol */ | ||
| 2499 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | ||
| 2500 | (yy_c_buf_p) = yy_cp -= 1; | ||
| 2501 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | ||
| 2502 | YY_RULE_SETUP | ||
| 2503 | { | ||
| 2504 | append_string(zconftext, zconfleng); | ||
| 2505 | zconflval.string = text; | ||
| 2506 | return T_WORD_QUOTE; | ||
| 2507 | } | ||
| 2508 | YY_BREAK | ||
| 2509 | case 55: | ||
| 2510 | YY_RULE_SETUP | ||
| 2511 | { | ||
| 2512 | append_string(zconftext, zconfleng); | ||
| 2513 | } | ||
| 2514 | YY_BREAK | ||
| 2515 | case 56: | ||
| 2516 | /* rule 56 can match eol */ | ||
| 2517 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | ||
| 2518 | (yy_c_buf_p) = yy_cp -= 1; | ||
| 2519 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | ||
| 2520 | YY_RULE_SETUP | ||
| 2521 | { | ||
| 2522 | append_string(zconftext + 1, zconfleng - 1); | ||
| 2523 | zconflval.string = text; | ||
| 2524 | return T_WORD_QUOTE; | ||
| 2525 | } | ||
| 2526 | YY_BREAK | ||
| 2527 | case 57: | ||
| 2528 | YY_RULE_SETUP | ||
| 2529 | { | ||
| 2530 | append_string(zconftext + 1, zconfleng - 1); | ||
| 2531 | } | ||
| 2532 | YY_BREAK | ||
| 2533 | case 58: | ||
| 2534 | YY_RULE_SETUP | ||
| 2535 | { | ||
| 2536 | if (str == zconftext[0]) { | ||
| 2537 | BEGIN(PARAM); | ||
| 2538 | zconflval.string = text; | ||
| 2539 | return T_WORD_QUOTE; | ||
| 2540 | } else | ||
| 2541 | append_string(zconftext, 1); | ||
| 2542 | } | ||
| 2543 | YY_BREAK | ||
| 2544 | case 59: | ||
| 2545 | /* rule 59 can match eol */ | ||
| 2546 | YY_RULE_SETUP | ||
| 2547 | { | ||
| 2548 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); | ||
| 2549 | current_file->lineno++; | ||
| 2550 | BEGIN(INITIAL); | ||
| 2551 | return T_EOL; | ||
| 2552 | } | ||
| 2553 | YY_BREAK | ||
| 2554 | case YY_STATE_EOF(STRING): | ||
| 2555 | { | ||
| 2556 | BEGIN(INITIAL); | ||
| 2557 | } | ||
| 2558 | YY_BREAK | ||
| 2559 | |||
| 2560 | case 60: | ||
| 2561 | YY_RULE_SETUP | ||
| 2562 | { | ||
| 2563 | ts = 0; | ||
| 2564 | for (i = 0; i < zconfleng; i++) { | ||
| 2565 | if (zconftext[i] == '\t') | ||
| 2566 | ts = (ts & ~7) + 8; | ||
| 2567 | else | ||
| 2568 | ts++; | ||
| 2569 | } | ||
| 2570 | last_ts = ts; | ||
| 2571 | if (first_ts) { | ||
| 2572 | if (ts < first_ts) { | ||
| 2573 | zconf_endhelp(); | ||
| 2574 | return T_HELPTEXT; | ||
| 2575 | } | ||
| 2576 | ts -= first_ts; | ||
| 2577 | while (ts > 8) { | ||
| 2578 | append_string(" ", 8); | ||
| 2579 | ts -= 8; | ||
| 2580 | } | ||
| 2581 | append_string(" ", ts); | ||
| 2582 | } | ||
| 2583 | } | ||
| 2584 | YY_BREAK | ||
| 2585 | case 61: | ||
| 2586 | /* rule 61 can match eol */ | ||
| 2587 | *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */ | ||
| 2588 | (yy_c_buf_p) = yy_cp -= 1; | ||
| 2589 | YY_DO_BEFORE_ACTION; /* set up zconftext again */ | ||
| 2590 | YY_RULE_SETUP | ||
| 2591 | { | ||
| 2592 | current_file->lineno++; | ||
| 2593 | zconf_endhelp(); | ||
| 2594 | return T_HELPTEXT; | ||
| 2595 | } | ||
| 2596 | YY_BREAK | ||
| 2597 | case 62: | ||
| 2598 | /* rule 62 can match eol */ | ||
| 2599 | YY_RULE_SETUP | ||
| 2600 | { | ||
| 2601 | current_file->lineno++; | ||
| 2602 | append_string("\n", 1); | ||
| 2603 | } | ||
| 2604 | YY_BREAK | ||
| 2605 | case 63: | ||
| 2606 | YY_RULE_SETUP | ||
| 2607 | { | ||
| 2608 | append_string(zconftext, zconfleng); | ||
| 2609 | if (!first_ts) | ||
| 2610 | first_ts = last_ts; | ||
| 2611 | } | ||
| 2612 | YY_BREAK | ||
| 2613 | case YY_STATE_EOF(HELP): | ||
| 2614 | { | ||
| 2615 | zconf_endhelp(); | ||
| 2616 | return T_HELPTEXT; | ||
| 2617 | } | ||
| 2618 | YY_BREAK | ||
| 2619 | |||
| 2620 | case YY_STATE_EOF(INITIAL): | ||
| 2621 | case YY_STATE_EOF(COMMAND): | ||
| 2622 | { | ||
| 2623 | if (current_buf) { | ||
| 2624 | zconf_endfile(); | ||
| 2625 | return T_EOF; | ||
| 2626 | } | ||
| 2627 | fclose(zconfin); | ||
| 2628 | yyterminate(); | ||
| 2629 | } | ||
| 2630 | YY_BREAK | ||
| 2631 | case 64: | ||
| 2632 | YY_RULE_SETUP | ||
| 2633 | YY_FATAL_ERROR( "flex scanner jammed" ); | ||
| 2634 | YY_BREAK | ||
| 2635 | |||
| 2636 | case YY_END_OF_BUFFER: | ||
| 2637 | { | ||
| 2638 | /* Amount of text matched not including the EOB char. */ | ||
| 2639 | int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; | ||
| 2640 | |||
| 2641 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | ||
| 2642 | *yy_cp = (yy_hold_char); | ||
| 2643 | YY_RESTORE_YY_MORE_OFFSET | ||
| 2644 | |||
| 2645 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) | ||
| 2646 | { | ||
| 2647 | /* We're scanning a new file or input source. It's | ||
| 2648 | * possible that this happened because the user | ||
| 2649 | * just pointed zconfin at a new source and called | ||
| 2650 | * zconflex(). If so, then we have to assure | ||
| 2651 | * consistency between YY_CURRENT_BUFFER and our | ||
| 2652 | * globals. Here is the right place to do so, because | ||
| 2653 | * this is the first action (other than possibly a | ||
| 2654 | * back-up) that will match for the new input source. | ||
| 2655 | */ | ||
| 2656 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
| 2657 | YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin; | ||
| 2658 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; | ||
| 2659 | } | ||
| 2660 | |||
| 2661 | /* Note that here we test for yy_c_buf_p "<=" to the position | ||
| 2662 | * of the first EOB in the buffer, since yy_c_buf_p will | ||
| 2663 | * already have been incremented past the NUL character | ||
| 2664 | * (since all states make transitions on EOB to the | ||
| 2665 | * end-of-buffer state). Contrast this with the test | ||
| 2666 | * in input(). | ||
| 2667 | */ | ||
| 2668 | if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
| 2669 | { /* This was really a NUL. */ | ||
| 2670 | yy_state_type yy_next_state; | ||
| 2671 | |||
| 2672 | (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; | ||
| 2673 | |||
| 2674 | yy_current_state = yy_get_previous_state( ); | ||
| 2675 | |||
| 2676 | /* Okay, we're now positioned to make the NUL | ||
| 2677 | * transition. We couldn't have | ||
| 2678 | * yy_get_previous_state() go ahead and do it | ||
| 2679 | * for us because it doesn't know how to deal | ||
| 2680 | * with the possibility of jamming (and we don't | ||
| 2681 | * want to build jamming into it because then it | ||
| 2682 | * will run more slowly). | ||
| 2683 | */ | ||
| 2684 | |||
| 2685 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | ||
| 2686 | |||
| 2687 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
| 2688 | |||
| 2689 | if ( yy_next_state ) | ||
| 2690 | { | ||
| 2691 | /* Consume the NUL. */ | ||
| 2692 | yy_cp = ++(yy_c_buf_p); | ||
| 2693 | yy_current_state = yy_next_state; | ||
| 2694 | goto yy_match; | ||
| 2695 | } | ||
| 2696 | |||
| 2697 | else | ||
| 2698 | { | ||
| 2699 | yy_cp = (yy_c_buf_p); | ||
| 2700 | goto yy_find_action; | ||
| 2701 | } | ||
| 2702 | } | ||
| 2703 | |||
| 2704 | else switch ( yy_get_next_buffer( ) ) | ||
| 2705 | { | ||
| 2706 | case EOB_ACT_END_OF_FILE: | ||
| 2707 | { | ||
| 2708 | (yy_did_buffer_switch_on_eof) = 0; | ||
| 2709 | |||
| 2710 | if ( zconfwrap( ) ) | ||
| 2711 | { | ||
| 2712 | /* Note: because we've taken care in | ||
| 2713 | * yy_get_next_buffer() to have set up | ||
| 2714 | * zconftext, we can now set up | ||
| 2715 | * yy_c_buf_p so that if some total | ||
| 2716 | * hoser (like flex itself) wants to | ||
| 2717 | * call the scanner after we return the | ||
| 2718 | * YY_NULL, it'll still work - another | ||
| 2719 | * YY_NULL will get returned. | ||
| 2720 | */ | ||
| 2721 | (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; | ||
| 2722 | |||
| 2723 | yy_act = YY_STATE_EOF(YY_START); | ||
| 2724 | goto do_action; | ||
| 2725 | } | ||
| 2726 | |||
| 2727 | else | ||
| 2728 | { | ||
| 2729 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
| 2730 | YY_NEW_FILE; | ||
| 2731 | } | ||
| 2732 | break; | ||
| 2733 | } | ||
| 2734 | |||
| 2735 | case EOB_ACT_CONTINUE_SCAN: | ||
| 2736 | (yy_c_buf_p) = | ||
| 2737 | (yytext_ptr) + yy_amount_of_matched_text; | ||
| 2738 | |||
| 2739 | yy_current_state = yy_get_previous_state( ); | ||
| 2740 | |||
| 2741 | yy_cp = (yy_c_buf_p); | ||
| 2742 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
| 2743 | goto yy_match; | ||
| 2744 | |||
| 2745 | case EOB_ACT_LAST_MATCH: | ||
| 2746 | (yy_c_buf_p) = | ||
| 2747 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; | ||
| 2748 | |||
| 2749 | yy_current_state = yy_get_previous_state( ); | ||
| 2750 | |||
| 2751 | yy_cp = (yy_c_buf_p); | ||
| 2752 | yy_bp = (yytext_ptr) + YY_MORE_ADJ; | ||
| 2753 | goto yy_find_action; | ||
| 2754 | } | ||
| 2755 | break; | ||
| 2756 | } | ||
| 2757 | |||
| 2758 | default: | ||
| 2759 | YY_FATAL_ERROR( | ||
| 2760 | "fatal flex scanner internal error--no action found" ); | ||
| 2761 | } /* end of action switch */ | ||
| 2762 | } /* end of scanning one token */ | ||
| 2763 | } /* end of zconflex */ | ||
| 2764 | |||
| 2765 | /* yy_get_next_buffer - try to read in a new buffer | ||
| 2766 | * | ||
| 2767 | * Returns a code representing an action: | ||
| 2768 | * EOB_ACT_LAST_MATCH - | ||
| 2769 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | ||
| 2770 | * EOB_ACT_END_OF_FILE - end of file | ||
| 2771 | */ | ||
| 2772 | static int yy_get_next_buffer (void) | ||
| 2773 | { | ||
| 2774 | register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; | ||
| 2775 | register char *source = (yytext_ptr); | ||
| 2776 | register int number_to_move, i; | ||
| 2777 | int ret_val; | ||
| 2778 | |||
| 2779 | if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) | ||
| 2780 | YY_FATAL_ERROR( | ||
| 2781 | "fatal flex scanner internal error--end of buffer missed" ); | ||
| 2782 | |||
| 2783 | if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) | ||
| 2784 | { /* Don't try to fill the buffer, so this is an EOF. */ | ||
| 2785 | if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) | ||
| 2786 | { | ||
| 2787 | /* We matched a single character, the EOB, so | ||
| 2788 | * treat this as a final EOF. | ||
| 2789 | */ | ||
| 2790 | return EOB_ACT_END_OF_FILE; | ||
| 2791 | } | ||
| 2792 | |||
| 2793 | else | ||
| 2794 | { | ||
| 2795 | /* We matched some text prior to the EOB, first | ||
| 2796 | * process it. | ||
| 2797 | */ | ||
| 2798 | return EOB_ACT_LAST_MATCH; | ||
| 2799 | } | ||
| 2800 | } | ||
| 2801 | |||
| 2802 | /* Try to read more data. */ | ||
| 2803 | |||
| 2804 | /* First move last chars to start of buffer. */ | ||
| 2805 | number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; | ||
| 2806 | |||
| 2807 | for ( i = 0; i < number_to_move; ++i ) | ||
| 2808 | *(dest++) = *(source++); | ||
| 2809 | |||
| 2810 | if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | ||
| 2811 | /* don't do the read, it's not guaranteed to return an EOF, | ||
| 2812 | * just force an EOF | ||
| 2813 | */ | ||
| 2814 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; | ||
| 2815 | |||
| 2816 | else | ||
| 2817 | { | ||
| 2818 | size_t num_to_read = | ||
| 2819 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; | ||
| 2820 | |||
| 2821 | while ( num_to_read <= 0 ) | ||
| 2822 | { /* Not enough room in the buffer - grow it. */ | ||
| 2823 | |||
| 2824 | /* just a shorter name for the current buffer */ | ||
| 2825 | YY_BUFFER_STATE b = YY_CURRENT_BUFFER; | ||
| 2826 | |||
| 2827 | int yy_c_buf_p_offset = | ||
| 2828 | (int) ((yy_c_buf_p) - b->yy_ch_buf); | ||
| 2829 | |||
| 2830 | if ( b->yy_is_our_buffer ) | ||
| 2831 | { | ||
| 2832 | int new_size = b->yy_buf_size * 2; | ||
| 2833 | |||
| 2834 | if ( new_size <= 0 ) | ||
| 2835 | b->yy_buf_size += b->yy_buf_size / 8; | ||
| 2836 | else | ||
| 2837 | b->yy_buf_size *= 2; | ||
| 2838 | |||
| 2839 | b->yy_ch_buf = (char *) | ||
| 2840 | /* Include room in for 2 EOB chars. */ | ||
| 2841 | zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); | ||
| 2842 | } | ||
| 2843 | else | ||
| 2844 | /* Can't grow it, we don't own it. */ | ||
| 2845 | b->yy_ch_buf = 0; | ||
| 2846 | |||
| 2847 | if ( ! b->yy_ch_buf ) | ||
| 2848 | YY_FATAL_ERROR( | ||
| 2849 | "fatal error - scanner input buffer overflow" ); | ||
| 2850 | |||
| 2851 | (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; | ||
| 2852 | |||
| 2853 | num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - | ||
| 2854 | number_to_move - 1; | ||
| 2855 | |||
| 2856 | } | ||
| 2857 | |||
| 2858 | if ( num_to_read > YY_READ_BUF_SIZE ) | ||
| 2859 | num_to_read = YY_READ_BUF_SIZE; | ||
| 2860 | |||
| 2861 | /* Read in more data. */ | ||
| 2862 | YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), | ||
| 2863 | (yy_n_chars), num_to_read ); | ||
| 2864 | |||
| 2865 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
| 2866 | } | ||
| 2867 | |||
| 2868 | if ( (yy_n_chars) == 0 ) | ||
| 2869 | { | ||
| 2870 | if ( number_to_move == YY_MORE_ADJ ) | ||
| 2871 | { | ||
| 2872 | ret_val = EOB_ACT_END_OF_FILE; | ||
| 2873 | zconfrestart(zconfin ); | ||
| 2874 | } | ||
| 2875 | |||
| 2876 | else | ||
| 2877 | { | ||
| 2878 | ret_val = EOB_ACT_LAST_MATCH; | ||
| 2879 | YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = | ||
| 2880 | YY_BUFFER_EOF_PENDING; | ||
| 2881 | } | ||
| 2882 | } | ||
| 2883 | |||
| 2884 | else | ||
| 2885 | ret_val = EOB_ACT_CONTINUE_SCAN; | ||
| 2886 | |||
| 2887 | (yy_n_chars) += number_to_move; | ||
| 2888 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; | ||
| 2889 | YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; | ||
| 2890 | |||
| 2891 | (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; | ||
| 2892 | |||
| 2893 | return ret_val; | ||
| 2894 | } | ||
| 2895 | |||
| 2896 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
| 2897 | |||
| 2898 | static yy_state_type yy_get_previous_state (void) | ||
| 2899 | { | ||
| 2900 | register yy_state_type yy_current_state; | ||
| 2901 | register char *yy_cp; | ||
| 2902 | |||
| 2903 | yy_current_state = (yy_start); | ||
| 2904 | |||
| 2905 | for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) | ||
| 2906 | { | ||
| 2907 | yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; | ||
| 2908 | } | ||
| 2909 | |||
| 2910 | return yy_current_state; | ||
| 2911 | } | ||
| 2912 | |||
| 2913 | /* yy_try_NUL_trans - try to make a transition on the NUL character | ||
| 2914 | * | ||
| 2915 | * synopsis | ||
| 2916 | * next_state = yy_try_NUL_trans( current_state ); | ||
| 2917 | */ | ||
| 2918 | static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) | ||
| 2919 | { | ||
| 2920 | register int yy_is_jam; | ||
| 2921 | |||
| 2922 | yy_current_state = yy_nxt[yy_current_state][1]; | ||
| 2923 | yy_is_jam = (yy_current_state <= 0); | ||
| 2924 | |||
| 2925 | return yy_is_jam ? 0 : yy_current_state; | ||
| 2926 | } | ||
| 2927 | |||
| 2928 | static void yyunput (int c, register char * yy_bp ) | ||
| 2929 | { | ||
| 2930 | register char *yy_cp; | ||
| 2931 | |||
| 2932 | yy_cp = (yy_c_buf_p); | ||
| 2933 | |||
| 2934 | /* undo effects of setting up zconftext */ | ||
| 2935 | *yy_cp = (yy_hold_char); | ||
| 2936 | |||
| 2937 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
| 2938 | { /* need to shift things up to make room */ | ||
| 2939 | /* +2 for EOB chars. */ | ||
| 2940 | register int number_to_move = (yy_n_chars) + 2; | ||
| 2941 | register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ | ||
| 2942 | YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; | ||
| 2943 | register char *source = | ||
| 2944 | &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; | ||
| 2945 | |||
| 2946 | while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) | ||
| 2947 | *--dest = *--source; | ||
| 2948 | |||
| 2949 | yy_cp += (int) (dest - source); | ||
| 2950 | yy_bp += (int) (dest - source); | ||
| 2951 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = | ||
| 2952 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; | ||
| 2953 | |||
| 2954 | if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) | ||
| 2955 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); | ||
| 2956 | } | ||
| 2957 | |||
| 2958 | *--yy_cp = (char) c; | ||
| 2959 | |||
| 2960 | (yytext_ptr) = yy_bp; | ||
| 2961 | (yy_hold_char) = *yy_cp; | ||
| 2962 | (yy_c_buf_p) = yy_cp; | ||
| 2963 | } | ||
| 2964 | |||
| 2965 | #ifndef YY_NO_INPUT | ||
| 2966 | #ifdef __cplusplus | ||
| 2967 | static int yyinput (void) | ||
| 2968 | #else | ||
| 2969 | static int input (void) | ||
| 2970 | #endif | ||
| 2971 | |||
| 2972 | { | ||
| 2973 | int c; | ||
| 2974 | |||
| 2975 | *(yy_c_buf_p) = (yy_hold_char); | ||
| 2976 | |||
| 2977 | if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) | ||
| 2978 | { | ||
| 2979 | /* yy_c_buf_p now points to the character we want to return. | ||
| 2980 | * If this occurs *before* the EOB characters, then it's a | ||
| 2981 | * valid NUL; if not, then we've hit the end of the buffer. | ||
| 2982 | */ | ||
| 2983 | if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) | ||
| 2984 | /* This was really a NUL. */ | ||
| 2985 | *(yy_c_buf_p) = '\0'; | ||
| 2986 | |||
| 2987 | else | ||
| 2988 | { /* need more input */ | ||
| 2989 | int offset = (yy_c_buf_p) - (yytext_ptr); | ||
| 2990 | ++(yy_c_buf_p); | ||
| 2991 | |||
| 2992 | switch ( yy_get_next_buffer( ) ) | ||
| 2993 | { | ||
| 2994 | case EOB_ACT_LAST_MATCH: | ||
| 2995 | /* This happens because yy_g_n_b() | ||
| 2996 | * sees that we've accumulated a | ||
| 2997 | * token and flags that we need to | ||
| 2998 | * try matching the token before | ||
| 2999 | * proceeding. But for input(), | ||
| 3000 | * there's no matching to consider. | ||
| 3001 | * So convert the EOB_ACT_LAST_MATCH | ||
| 3002 | * to EOB_ACT_END_OF_FILE. | ||
| 3003 | */ | ||
| 3004 | |||
| 3005 | /* Reset buffer status. */ | ||
| 3006 | zconfrestart(zconfin ); | ||
| 3007 | |||
| 3008 | /*FALLTHROUGH*/ | ||
| 3009 | |||
| 3010 | case EOB_ACT_END_OF_FILE: | ||
| 3011 | { | ||
| 3012 | if ( zconfwrap( ) ) | ||
| 3013 | return EOF; | ||
| 3014 | |||
| 3015 | if ( ! (yy_did_buffer_switch_on_eof) ) | ||
| 3016 | YY_NEW_FILE; | ||
| 3017 | #ifdef __cplusplus | ||
| 3018 | return yyinput(); | ||
| 3019 | #else | ||
| 3020 | return input(); | ||
| 3021 | #endif | ||
| 3022 | } | ||
| 3023 | |||
| 3024 | case EOB_ACT_CONTINUE_SCAN: | ||
| 3025 | (yy_c_buf_p) = (yytext_ptr) + offset; | ||
| 3026 | break; | ||
| 3027 | } | ||
| 3028 | } | ||
| 3029 | } | ||
| 3030 | |||
| 3031 | c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ | ||
| 3032 | *(yy_c_buf_p) = '\0'; /* preserve zconftext */ | ||
| 3033 | (yy_hold_char) = *++(yy_c_buf_p); | ||
| 3034 | |||
| 3035 | return c; | ||
| 3036 | } | ||
| 3037 | #endif /* ifndef YY_NO_INPUT */ | ||
| 3038 | |||
| 3039 | /** Immediately switch to a different input stream. | ||
| 3040 | * @param input_file A readable stream. | ||
| 3041 | * | ||
| 3042 | * @note This function does not reset the start condition to @c INITIAL . | ||
| 3043 | */ | ||
| 3044 | void zconfrestart (FILE * input_file ) | ||
| 3045 | { | ||
| 3046 | |||
| 3047 | if ( ! YY_CURRENT_BUFFER ){ | ||
| 3048 | zconfensure_buffer_stack (); | ||
| 3049 | YY_CURRENT_BUFFER_LVALUE = | ||
| 3050 | zconf_create_buffer(zconfin,YY_BUF_SIZE ); | ||
| 3051 | } | ||
| 3052 | |||
| 3053 | zconf_init_buffer(YY_CURRENT_BUFFER,input_file ); | ||
| 3054 | zconf_load_buffer_state( ); | ||
| 3055 | } | ||
| 3056 | |||
| 3057 | /** Switch to a different input buffer. | ||
| 3058 | * @param new_buffer The new input buffer. | ||
| 3059 | * | ||
| 3060 | */ | ||
| 3061 | void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer ) | ||
| 3062 | { | ||
| 3063 | |||
| 3064 | /* TODO. We should be able to replace this entire function body | ||
| 3065 | * with | ||
| 3066 | * zconfpop_buffer_state(); | ||
| 3067 | * zconfpush_buffer_state(new_buffer); | ||
| 3068 | */ | ||
| 3069 | zconfensure_buffer_stack (); | ||
| 3070 | if ( YY_CURRENT_BUFFER == new_buffer ) | ||
| 3071 | return; | ||
| 3072 | |||
| 3073 | if ( YY_CURRENT_BUFFER ) | ||
| 3074 | { | ||
| 3075 | /* Flush out information for old buffer. */ | ||
| 3076 | *(yy_c_buf_p) = (yy_hold_char); | ||
| 3077 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
| 3078 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
| 3079 | } | ||
| 3080 | |||
| 3081 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
| 3082 | zconf_load_buffer_state( ); | ||
| 3083 | |||
| 3084 | /* We don't actually know whether we did this switch during | ||
| 3085 | * EOF (zconfwrap()) processing, but the only time this flag | ||
| 3086 | * is looked at is after zconfwrap() is called, so it's safe | ||
| 3087 | * to go ahead and always set it. | ||
| 3088 | */ | ||
| 3089 | (yy_did_buffer_switch_on_eof) = 1; | ||
| 3090 | } | ||
| 3091 | |||
| 3092 | static void zconf_load_buffer_state (void) | ||
| 3093 | { | ||
| 3094 | (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; | ||
| 3095 | (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; | ||
| 3096 | zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; | ||
| 3097 | (yy_hold_char) = *(yy_c_buf_p); | ||
| 3098 | } | ||
| 3099 | |||
| 3100 | /** Allocate and initialize an input buffer state. | ||
| 3101 | * @param file A readable stream. | ||
| 3102 | * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. | ||
| 3103 | * | ||
| 3104 | * @return the allocated buffer state. | ||
| 3105 | */ | ||
| 3106 | YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size ) | ||
| 3107 | { | ||
| 3108 | YY_BUFFER_STATE b; | ||
| 3109 | |||
| 3110 | b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) ); | ||
| 3111 | if ( ! b ) | ||
| 3112 | YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" ); | ||
| 3113 | |||
| 3114 | b->yy_buf_size = size; | ||
| 3115 | |||
| 3116 | /* yy_ch_buf has to be 2 characters longer than the size given because | ||
| 3117 | * we need to put in 2 end-of-buffer characters. | ||
| 3118 | */ | ||
| 3119 | b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 ); | ||
| 3120 | if ( ! b->yy_ch_buf ) | ||
| 3121 | YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" ); | ||
| 3122 | |||
| 3123 | b->yy_is_our_buffer = 1; | ||
| 3124 | |||
| 3125 | zconf_init_buffer(b,file ); | ||
| 3126 | |||
| 3127 | return b; | ||
| 3128 | } | ||
| 3129 | |||
| 3130 | /** Destroy the buffer. | ||
| 3131 | * @param b a buffer created with zconf_create_buffer() | ||
| 3132 | * | ||
| 3133 | */ | ||
| 3134 | void zconf_delete_buffer (YY_BUFFER_STATE b ) | ||
| 3135 | { | ||
| 3136 | |||
| 3137 | if ( ! b ) | ||
| 3138 | return; | ||
| 3139 | |||
| 3140 | if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ | ||
| 3141 | YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; | ||
| 3142 | |||
| 3143 | if ( b->yy_is_our_buffer ) | ||
| 3144 | zconffree((void *) b->yy_ch_buf ); | ||
| 3145 | |||
| 3146 | zconffree((void *) b ); | ||
| 3147 | } | ||
| 3148 | |||
| 3149 | /* Initializes or reinitializes a buffer. | ||
| 3150 | * This function is sometimes called more than once on the same buffer, | ||
| 3151 | * such as during a zconfrestart() or at EOF. | ||
| 3152 | */ | ||
| 3153 | static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file ) | ||
| 3154 | |||
| 3155 | { | ||
| 3156 | int oerrno = errno; | ||
| 3157 | |||
| 3158 | zconf_flush_buffer(b ); | ||
| 3159 | |||
| 3160 | b->yy_input_file = file; | ||
| 3161 | b->yy_fill_buffer = 1; | ||
| 3162 | |||
| 3163 | /* If b is the current buffer, then zconf_init_buffer was _probably_ | ||
| 3164 | * called from zconfrestart() or through yy_get_next_buffer. | ||
| 3165 | * In that case, we don't want to reset the lineno or column. | ||
| 3166 | */ | ||
| 3167 | if (b != YY_CURRENT_BUFFER){ | ||
| 3168 | b->yy_bs_lineno = 1; | ||
| 3169 | b->yy_bs_column = 0; | ||
| 3170 | } | ||
| 3171 | |||
| 3172 | b->yy_is_interactive = 0; | ||
| 3173 | |||
| 3174 | errno = oerrno; | ||
| 3175 | } | ||
| 3176 | |||
| 3177 | /** Discard all buffered characters. On the next scan, YY_INPUT will be called. | ||
| 3178 | * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. | ||
| 3179 | * | ||
| 3180 | */ | ||
| 3181 | void zconf_flush_buffer (YY_BUFFER_STATE b ) | ||
| 3182 | { | ||
| 3183 | if ( ! b ) | ||
| 3184 | return; | ||
| 3185 | |||
| 3186 | b->yy_n_chars = 0; | ||
| 3187 | |||
| 3188 | /* We always need two end-of-buffer characters. The first causes | ||
| 3189 | * a transition to the end-of-buffer state. The second causes | ||
| 3190 | * a jam in that state. | ||
| 3191 | */ | ||
| 3192 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | ||
| 3193 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | ||
| 3194 | |||
| 3195 | b->yy_buf_pos = &b->yy_ch_buf[0]; | ||
| 3196 | |||
| 3197 | b->yy_at_bol = 1; | ||
| 3198 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
| 3199 | |||
| 3200 | if ( b == YY_CURRENT_BUFFER ) | ||
| 3201 | zconf_load_buffer_state( ); | ||
| 3202 | } | ||
| 3203 | |||
| 3204 | /** Pushes the new state onto the stack. The new state becomes | ||
| 3205 | * the current state. This function will allocate the stack | ||
| 3206 | * if necessary. | ||
| 3207 | * @param new_buffer The new state. | ||
| 3208 | * | ||
| 3209 | */ | ||
| 3210 | void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer ) | ||
| 3211 | { | ||
| 3212 | if (new_buffer == NULL) | ||
| 3213 | return; | ||
| 3214 | |||
| 3215 | zconfensure_buffer_stack(); | ||
| 3216 | |||
| 3217 | /* This block is copied from zconf_switch_to_buffer. */ | ||
| 3218 | if ( YY_CURRENT_BUFFER ) | ||
| 3219 | { | ||
| 3220 | /* Flush out information for old buffer. */ | ||
| 3221 | *(yy_c_buf_p) = (yy_hold_char); | ||
| 3222 | YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); | ||
| 3223 | YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); | ||
| 3224 | } | ||
| 3225 | |||
| 3226 | /* Only push if top exists. Otherwise, replace top. */ | ||
| 3227 | if (YY_CURRENT_BUFFER) | ||
| 3228 | (yy_buffer_stack_top)++; | ||
| 3229 | YY_CURRENT_BUFFER_LVALUE = new_buffer; | ||
| 3230 | |||
| 3231 | /* copied from zconf_switch_to_buffer. */ | ||
| 3232 | zconf_load_buffer_state( ); | ||
| 3233 | (yy_did_buffer_switch_on_eof) = 1; | ||
| 3234 | } | ||
| 3235 | |||
| 3236 | /** Removes and deletes the top of the stack, if present. | ||
| 3237 | * The next element becomes the new top. | ||
| 3238 | * | ||
| 3239 | */ | ||
| 3240 | void zconfpop_buffer_state (void) | ||
| 3241 | { | ||
| 3242 | if (!YY_CURRENT_BUFFER) | ||
| 3243 | return; | ||
| 3244 | |||
| 3245 | zconf_delete_buffer(YY_CURRENT_BUFFER ); | ||
| 3246 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
| 3247 | if ((yy_buffer_stack_top) > 0) | ||
| 3248 | --(yy_buffer_stack_top); | ||
| 3249 | |||
| 3250 | if (YY_CURRENT_BUFFER) { | ||
| 3251 | zconf_load_buffer_state( ); | ||
| 3252 | (yy_did_buffer_switch_on_eof) = 1; | ||
| 3253 | } | ||
| 3254 | } | ||
| 3255 | |||
| 3256 | /* Allocates the stack if it does not exist. | ||
| 3257 | * Guarantees space for at least one push. | ||
| 3258 | */ | ||
| 3259 | static void zconfensure_buffer_stack (void) | ||
| 3260 | { | ||
| 3261 | int num_to_alloc; | ||
| 3262 | |||
| 3263 | if (!(yy_buffer_stack)) { | ||
| 3264 | |||
| 3265 | /* First allocation is just for 2 elements, since we don't know if this | ||
| 3266 | * scanner will even need a stack. We use 2 instead of 1 to avoid an | ||
| 3267 | * immediate realloc on the next call. | ||
| 3268 | */ | ||
| 3269 | num_to_alloc = 1; | ||
| 3270 | (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc | ||
| 3271 | (num_to_alloc * sizeof(struct yy_buffer_state*) | ||
| 3272 | ); | ||
| 3273 | |||
| 3274 | memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); | ||
| 3275 | |||
| 3276 | (yy_buffer_stack_max) = num_to_alloc; | ||
| 3277 | (yy_buffer_stack_top) = 0; | ||
| 3278 | return; | ||
| 3279 | } | ||
| 3280 | |||
| 3281 | if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ | ||
| 3282 | |||
| 3283 | /* Increase the buffer to prepare for a possible push. */ | ||
| 3284 | int grow_size = 8 /* arbitrary grow size */; | ||
| 3285 | |||
| 3286 | num_to_alloc = (yy_buffer_stack_max) + grow_size; | ||
| 3287 | (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc | ||
| 3288 | ((yy_buffer_stack), | ||
| 3289 | num_to_alloc * sizeof(struct yy_buffer_state*) | ||
| 3290 | ); | ||
| 3291 | |||
| 3292 | /* zero only the new slots.*/ | ||
| 3293 | memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); | ||
| 3294 | (yy_buffer_stack_max) = num_to_alloc; | ||
| 3295 | } | ||
| 3296 | } | ||
| 3297 | |||
| 3298 | /** Setup the input buffer state to scan directly from a user-specified character buffer. | ||
| 3299 | * @param base the character buffer | ||
| 3300 | * @param size the size in bytes of the character buffer | ||
| 3301 | * | ||
| 3302 | * @return the newly allocated buffer state object. | ||
| 3303 | */ | ||
| 3304 | YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size ) | ||
| 3305 | { | ||
| 3306 | YY_BUFFER_STATE b; | ||
| 3307 | |||
| 3308 | if ( size < 2 || | ||
| 3309 | base[size-2] != YY_END_OF_BUFFER_CHAR || | ||
| 3310 | base[size-1] != YY_END_OF_BUFFER_CHAR ) | ||
| 3311 | /* They forgot to leave room for the EOB's. */ | ||
| 3312 | return 0; | ||
| 3313 | |||
| 3314 | b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) ); | ||
| 3315 | if ( ! b ) | ||
| 3316 | YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" ); | ||
| 3317 | |||
| 3318 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | ||
| 3319 | b->yy_buf_pos = b->yy_ch_buf = base; | ||
| 3320 | b->yy_is_our_buffer = 0; | ||
| 3321 | b->yy_input_file = 0; | ||
| 3322 | b->yy_n_chars = b->yy_buf_size; | ||
| 3323 | b->yy_is_interactive = 0; | ||
| 3324 | b->yy_at_bol = 1; | ||
| 3325 | b->yy_fill_buffer = 0; | ||
| 3326 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
| 3327 | |||
| 3328 | zconf_switch_to_buffer(b ); | ||
| 3329 | |||
| 3330 | return b; | ||
| 3331 | } | ||
| 3332 | |||
| 3333 | /** Setup the input buffer state to scan a string. The next call to zconflex() will | ||
| 3334 | * scan from a @e copy of @a str. | ||
| 3335 | * @param str a NUL-terminated string to scan | ||
| 3336 | * | ||
| 3337 | * @return the newly allocated buffer state object. | ||
| 3338 | * @note If you want to scan bytes that may contain NUL values, then use | ||
| 3339 | * zconf_scan_bytes() instead. | ||
| 3340 | */ | ||
| 3341 | YY_BUFFER_STATE zconf_scan_string (yyconst char * str ) | ||
| 3342 | { | ||
| 3343 | |||
| 3344 | return zconf_scan_bytes(str,strlen(str) ); | ||
| 3345 | } | ||
| 3346 | |||
| 3347 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will | ||
| 3348 | * scan from a @e copy of @a bytes. | ||
| 3349 | * @param bytes the byte buffer to scan | ||
| 3350 | * @param len the number of bytes in the buffer pointed to by @a bytes. | ||
| 3351 | * | ||
| 3352 | * @return the newly allocated buffer state object. | ||
| 3353 | */ | ||
| 3354 | YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len ) | ||
| 3355 | { | ||
| 3356 | YY_BUFFER_STATE b; | ||
| 3357 | char *buf; | ||
| 3358 | yy_size_t n; | ||
| 3359 | int i; | ||
| 3360 | |||
| 3361 | /* Get memory for full buffer, including space for trailing EOB's. */ | ||
| 3362 | n = len + 2; | ||
| 3363 | buf = (char *) zconfalloc(n ); | ||
| 3364 | if ( ! buf ) | ||
| 3365 | YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" ); | ||
| 3366 | |||
| 3367 | for ( i = 0; i < len; ++i ) | ||
| 3368 | buf[i] = bytes[i]; | ||
| 3369 | |||
| 3370 | buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; | ||
| 3371 | |||
| 3372 | b = zconf_scan_buffer(buf,n ); | ||
| 3373 | if ( ! b ) | ||
| 3374 | YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" ); | ||
| 3375 | |||
| 3376 | /* It's okay to grow etc. this buffer, and we should throw it | ||
| 3377 | * away when we're done. | ||
| 3378 | */ | ||
| 3379 | b->yy_is_our_buffer = 1; | ||
| 3380 | |||
| 3381 | return b; | ||
| 3382 | } | ||
| 3383 | |||
| 3384 | #ifndef YY_EXIT_FAILURE | ||
| 3385 | #define YY_EXIT_FAILURE 2 | ||
| 3386 | #endif | ||
| 3387 | |||
| 3388 | static void yy_fatal_error (yyconst char* msg ) | ||
| 3389 | { | ||
| 3390 | (void) fprintf( stderr, "%s\n", msg ); | ||
| 3391 | exit( YY_EXIT_FAILURE ); | ||
| 3392 | } | ||
| 3393 | |||
| 3394 | /* Redefine yyless() so it works in section 3 code. */ | ||
| 3395 | |||
| 3396 | #undef yyless | ||
| 3397 | #define yyless(n) \ | ||
| 3398 | do \ | ||
| 3399 | { \ | ||
| 3400 | /* Undo effects of setting up zconftext. */ \ | ||
| 3401 | int yyless_macro_arg = (n); \ | ||
| 3402 | YY_LESS_LINENO(yyless_macro_arg);\ | ||
| 3403 | zconftext[zconfleng] = (yy_hold_char); \ | ||
| 3404 | (yy_c_buf_p) = zconftext + yyless_macro_arg; \ | ||
| 3405 | (yy_hold_char) = *(yy_c_buf_p); \ | ||
| 3406 | *(yy_c_buf_p) = '\0'; \ | ||
| 3407 | zconfleng = yyless_macro_arg; \ | ||
| 3408 | } \ | ||
| 3409 | while ( 0 ) | ||
| 3410 | |||
| 3411 | /* Accessor methods (get/set functions) to struct members. */ | ||
| 3412 | |||
| 3413 | /** Get the current line number. | ||
| 3414 | * | ||
| 3415 | */ | ||
| 3416 | int zconfget_lineno (void) | ||
| 3417 | { | ||
| 3418 | |||
| 3419 | return zconflineno; | ||
| 3420 | } | ||
| 3421 | |||
| 3422 | /** Get the input stream. | ||
| 3423 | * | ||
| 3424 | */ | ||
| 3425 | FILE *zconfget_in (void) | ||
| 3426 | { | ||
| 3427 | return zconfin; | ||
| 3428 | } | ||
| 3429 | |||
| 3430 | /** Get the output stream. | ||
| 3431 | * | ||
| 3432 | */ | ||
| 3433 | FILE *zconfget_out (void) | ||
| 3434 | { | ||
| 3435 | return zconfout; | ||
| 3436 | } | ||
| 3437 | |||
| 3438 | /** Get the length of the current token. | ||
| 3439 | * | ||
| 3440 | */ | ||
| 3441 | int zconfget_leng (void) | ||
| 3442 | { | ||
| 3443 | return zconfleng; | ||
| 3444 | } | ||
| 3445 | |||
| 3446 | /** Get the current token. | ||
| 3447 | * | ||
| 3448 | */ | ||
| 3449 | |||
| 3450 | char *zconfget_text (void) | ||
| 3451 | { | ||
| 3452 | return zconftext; | ||
| 3453 | } | ||
| 3454 | |||
| 3455 | /** Set the current line number. | ||
| 3456 | * @param line_number | ||
| 3457 | * | ||
| 3458 | */ | ||
| 3459 | void zconfset_lineno (int line_number ) | ||
| 3460 | { | ||
| 3461 | |||
| 3462 | zconflineno = line_number; | ||
| 3463 | } | ||
| 3464 | |||
| 3465 | /** Set the input stream. This does not discard the current | ||
| 3466 | * input buffer. | ||
| 3467 | * @param in_str A readable stream. | ||
| 3468 | * | ||
| 3469 | * @see zconf_switch_to_buffer | ||
| 3470 | */ | ||
| 3471 | void zconfset_in (FILE * in_str ) | ||
| 3472 | { | ||
| 3473 | zconfin = in_str ; | ||
| 3474 | } | ||
| 3475 | |||
| 3476 | void zconfset_out (FILE * out_str ) | ||
| 3477 | { | ||
| 3478 | zconfout = out_str ; | ||
| 3479 | } | ||
| 3480 | |||
| 3481 | int zconfget_debug (void) | ||
| 3482 | { | ||
| 3483 | return zconf_flex_debug; | ||
| 3484 | } | ||
| 3485 | |||
| 3486 | void zconfset_debug (int bdebug ) | ||
| 3487 | { | ||
| 3488 | zconf_flex_debug = bdebug ; | ||
| 3489 | } | ||
| 3490 | |||
| 3491 | /* zconflex_destroy is for both reentrant and non-reentrant scanners. */ | ||
| 3492 | int zconflex_destroy (void) | ||
| 3493 | { | ||
| 3494 | |||
| 3495 | /* Pop the buffer stack, destroying each element. */ | ||
| 3496 | while(YY_CURRENT_BUFFER){ | ||
| 3497 | zconf_delete_buffer(YY_CURRENT_BUFFER ); | ||
| 3498 | YY_CURRENT_BUFFER_LVALUE = NULL; | ||
| 3499 | zconfpop_buffer_state(); | ||
| 3500 | } | ||
| 3501 | |||
| 3502 | /* Destroy the stack itself. */ | ||
| 3503 | zconffree((yy_buffer_stack) ); | ||
| 3504 | (yy_buffer_stack) = NULL; | ||
| 3505 | |||
| 3506 | return 0; | ||
| 3507 | } | ||
| 3508 | |||
| 3509 | /* | ||
| 3510 | * Internal utility routines. | ||
| 3511 | */ | ||
| 3512 | |||
| 3513 | #ifndef yytext_ptr | ||
| 3514 | static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) | ||
| 3515 | { | ||
| 3516 | register int i; | ||
| 3517 | for ( i = 0; i < n; ++i ) | ||
| 3518 | s1[i] = s2[i]; | ||
| 3519 | } | ||
| 3520 | #endif | ||
| 3521 | |||
| 3522 | #ifdef YY_NEED_STRLEN | ||
| 3523 | static int yy_flex_strlen (yyconst char * s ) | ||
| 3524 | { | ||
| 3525 | register int n; | ||
| 3526 | for ( n = 0; s[n]; ++n ) | ||
| 3527 | ; | ||
| 3528 | |||
| 3529 | return n; | ||
| 3530 | } | ||
| 3531 | #endif | ||
| 3532 | |||
| 3533 | void *zconfalloc (yy_size_t size ) | ||
| 3534 | { | ||
| 3535 | return (void *) malloc( size ); | ||
| 3536 | } | ||
| 3537 | |||
| 3538 | void *zconfrealloc (void * ptr, yy_size_t size ) | ||
| 3539 | { | ||
| 3540 | /* The cast to (char *) in the following accommodates both | ||
| 3541 | * implementations that use char* generic pointers, and those | ||
| 3542 | * that use void* generic pointers. It works with the latter | ||
| 3543 | * because both ANSI C and C++ allow castless assignment from | ||
| 3544 | * any pointer type to void*, and deal with argument conversions | ||
| 3545 | * as though doing an assignment. | ||
| 3546 | */ | ||
| 3547 | return (void *) realloc( (char *) ptr, size ); | ||
| 3548 | } | ||
| 3549 | |||
| 3550 | void zconffree (void * ptr ) | ||
| 3551 | { | ||
| 3552 | free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */ | ||
| 3553 | } | ||
| 3554 | |||
| 3555 | #define YYTABLES_NAME "yytables" | ||
| 3556 | |||
| 3557 | #undef YY_NEW_FILE | ||
| 3558 | #undef YY_FLUSH_BUFFER | ||
| 3559 | #undef yy_set_bol | ||
| 3560 | #undef yy_new_buffer | ||
| 3561 | #undef yy_set_interactive | ||
| 3562 | #undef yytext_ptr | ||
| 3563 | #undef YY_DO_BEFORE_ACTION | ||
| 3564 | |||
| 3565 | #ifdef YY_DECL_IS_OURS | ||
| 3566 | #undef YY_DECL_IS_OURS | ||
| 3567 | #undef YY_DECL | ||
| 3568 | #endif | ||
| 3569 | |||
| 3570 | void zconf_starthelp(void) | ||
| 3571 | { | ||
| 3572 | new_string(); | ||
| 3573 | last_ts = first_ts = 0; | ||
| 3574 | BEGIN(HELP); | ||
| 3575 | } | ||
| 3576 | |||
| 3577 | static void zconf_endhelp(void) | ||
| 3578 | { | ||
| 3579 | zconflval.string = text; | ||
| 3580 | BEGIN(INITIAL); | ||
| 3581 | } | ||
| 3582 | |||
| 3583 | /* | ||
| 3584 | * Try to open specified file with following names: | ||
| 3585 | * ./name | ||
| 3586 | * $(srctree)/name | ||
| 3587 | * The latter is used when srctree is separate from objtree | ||
| 3588 | * when compiling the kernel. | ||
| 3589 | * Return NULL if file is not found. | ||
| 3590 | */ | ||
| 3591 | FILE *zconf_fopen(const char *name) | ||
| 3592 | { | ||
| 3593 | char *env, fullname[PATH_MAX+1]; | ||
| 3594 | FILE *f; | ||
| 3595 | |||
| 3596 | f = fopen(name, "r"); | ||
| 3597 | if (!f && name[0] != '/') { | ||
| 3598 | env = getenv(SRCTREE); | ||
| 3599 | if (env) { | ||
| 3600 | sprintf(fullname, "%s/%s", env, name); | ||
| 3601 | f = fopen(fullname, "r"); | ||
| 3602 | } | ||
| 3603 | } | ||
| 3604 | return f; | ||
| 3605 | } | ||
| 3606 | |||
| 3607 | void zconf_initscan(const char *name) | ||
| 3608 | { | ||
| 3609 | zconfin = zconf_fopen(name); | ||
| 3610 | if (!zconfin) { | ||
| 3611 | printf("can't find file %s\n", name); | ||
| 3612 | exit(1); | ||
| 3613 | } | ||
| 3614 | |||
| 3615 | current_buf = malloc(sizeof(*current_buf)); | ||
| 3616 | memset(current_buf, 0, sizeof(*current_buf)); | ||
| 3617 | |||
| 3618 | current_file = file_lookup(name); | ||
| 3619 | current_file->lineno = 1; | ||
| 3620 | current_file->flags = FILE_BUSY; | ||
| 3621 | } | ||
| 3622 | |||
| 3623 | void zconf_nextfile(const char *name) | ||
| 3624 | { | ||
| 3625 | struct file *file = file_lookup(name); | ||
| 3626 | struct buffer *buf = malloc(sizeof(*buf)); | ||
| 3627 | memset(buf, 0, sizeof(*buf)); | ||
| 3628 | |||
| 3629 | current_buf->state = YY_CURRENT_BUFFER; | ||
| 3630 | zconfin = zconf_fopen(name); | ||
| 3631 | if (!zconfin) { | ||
| 3632 | printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); | ||
| 3633 | exit(1); | ||
| 3634 | } | ||
| 3635 | zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE)); | ||
| 3636 | buf->parent = current_buf; | ||
| 3637 | current_buf = buf; | ||
| 3638 | |||
| 3639 | if (file->flags & FILE_BUSY) { | ||
| 3640 | printf("recursive scan (%s)?\n", name); | ||
| 3641 | exit(1); | ||
| 3642 | } | ||
| 3643 | if (file->flags & FILE_SCANNED) { | ||
| 3644 | printf("file %s already scanned?\n", name); | ||
| 3645 | exit(1); | ||
| 3646 | } | ||
| 3647 | file->flags |= FILE_BUSY; | ||
| 3648 | file->lineno = 1; | ||
| 3649 | file->parent = current_file; | ||
| 3650 | current_file = file; | ||
| 3651 | } | ||
| 3652 | |||
| 3653 | static struct buffer *zconf_endfile(void) | ||
| 3654 | { | ||
| 3655 | struct buffer *parent; | ||
| 3656 | |||
| 3657 | current_file->flags |= FILE_SCANNED; | ||
| 3658 | current_file->flags &= ~FILE_BUSY; | ||
| 3659 | current_file = current_file->parent; | ||
| 3660 | |||
| 3661 | parent = current_buf->parent; | ||
| 3662 | if (parent) { | ||
| 3663 | fclose(zconfin); | ||
| 3664 | zconf_delete_buffer(YY_CURRENT_BUFFER); | ||
| 3665 | zconf_switch_to_buffer(parent->state); | ||
| 3666 | } | ||
| 3667 | free(current_buf); | ||
| 3668 | current_buf = parent; | ||
| 3669 | |||
| 3670 | return parent; | ||
| 3671 | } | ||
| 3672 | |||
| 3673 | int zconf_lineno(void) | ||
| 3674 | { | ||
| 3675 | if (current_buf) | ||
| 3676 | return current_file->lineno - 1; | ||
| 3677 | else | ||
| 3678 | return 0; | ||
| 3679 | } | ||
| 3680 | |||
| 3681 | char *zconf_curname(void) | ||
| 3682 | { | ||
| 3683 | if (current_buf) | ||
| 3684 | return current_file->name; | ||
| 3685 | else | ||
| 3686 | return "<none>"; | ||
| 3687 | } | ||
| 3688 | |||
diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h new file mode 100644 index 000000000000..b8a67fc9d647 --- /dev/null +++ b/scripts/kconfig/lkc.h | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef LKC_H | ||
| 7 | #define LKC_H | ||
| 8 | |||
| 9 | #include "expr.h" | ||
| 10 | |||
| 11 | #ifdef __cplusplus | ||
| 12 | extern "C" { | ||
| 13 | #endif | ||
| 14 | |||
| 15 | #ifdef LKC_DIRECT_LINK | ||
| 16 | #define P(name,type,arg) extern type name arg | ||
| 17 | #else | ||
| 18 | #include "lkc_defs.h" | ||
| 19 | #define P(name,type,arg) extern type (*name ## _p) arg | ||
| 20 | #endif | ||
| 21 | #include "lkc_proto.h" | ||
| 22 | #undef P | ||
| 23 | |||
| 24 | #define SRCTREE "srctree" | ||
| 25 | |||
| 26 | int zconfparse(void); | ||
| 27 | void zconfdump(FILE *out); | ||
| 28 | |||
| 29 | extern int zconfdebug; | ||
| 30 | void zconf_starthelp(void); | ||
| 31 | FILE *zconf_fopen(const char *name); | ||
| 32 | void zconf_initscan(const char *name); | ||
| 33 | void zconf_nextfile(const char *name); | ||
| 34 | int zconf_lineno(void); | ||
| 35 | char *zconf_curname(void); | ||
| 36 | |||
| 37 | /* confdata.c */ | ||
| 38 | extern const char conf_def_filename[]; | ||
| 39 | extern char conf_filename[]; | ||
| 40 | |||
| 41 | char *conf_get_default_confname(void); | ||
| 42 | |||
| 43 | /* kconfig_load.c */ | ||
| 44 | void kconfig_load(void); | ||
| 45 | |||
| 46 | /* menu.c */ | ||
| 47 | void menu_init(void); | ||
| 48 | void menu_add_menu(void); | ||
| 49 | void menu_end_menu(void); | ||
| 50 | void menu_add_entry(struct symbol *sym); | ||
| 51 | void menu_end_entry(void); | ||
| 52 | void menu_add_dep(struct expr *dep); | ||
| 53 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); | ||
| 54 | void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); | ||
| 55 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); | ||
| 56 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); | ||
| 57 | void menu_finalize(struct menu *parent); | ||
| 58 | void menu_set_type(int type); | ||
| 59 | |||
| 60 | /* util.c */ | ||
| 61 | struct file *file_lookup(const char *name); | ||
| 62 | int file_write_dep(const char *name); | ||
| 63 | |||
| 64 | struct gstr { | ||
| 65 | size_t len; | ||
| 66 | char *s; | ||
| 67 | }; | ||
| 68 | struct gstr str_new(void); | ||
| 69 | struct gstr str_assign(const char *s); | ||
| 70 | void str_free(struct gstr *gs); | ||
| 71 | void str_append(struct gstr *gs, const char *s); | ||
| 72 | void str_printf(struct gstr *gs, const char *fmt, ...); | ||
| 73 | const char *str_get(struct gstr *gs); | ||
| 74 | |||
| 75 | /* symbol.c */ | ||
| 76 | void sym_init(void); | ||
| 77 | void sym_clear_all_valid(void); | ||
| 78 | void sym_set_changed(struct symbol *sym); | ||
| 79 | struct symbol *sym_check_deps(struct symbol *sym); | ||
| 80 | struct property *prop_alloc(enum prop_type type, struct symbol *sym); | ||
| 81 | struct symbol *prop_get_symbol(struct property *prop); | ||
| 82 | |||
| 83 | static inline tristate sym_get_tristate_value(struct symbol *sym) | ||
| 84 | { | ||
| 85 | return sym->curr.tri; | ||
| 86 | } | ||
| 87 | |||
| 88 | |||
| 89 | static inline struct symbol *sym_get_choice_value(struct symbol *sym) | ||
| 90 | { | ||
| 91 | return (struct symbol *)sym->curr.val; | ||
| 92 | } | ||
| 93 | |||
| 94 | static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval) | ||
| 95 | { | ||
| 96 | return sym_set_tristate_value(chval, yes); | ||
| 97 | } | ||
| 98 | |||
| 99 | static inline bool sym_is_choice(struct symbol *sym) | ||
| 100 | { | ||
| 101 | return sym->flags & SYMBOL_CHOICE ? true : false; | ||
| 102 | } | ||
| 103 | |||
| 104 | static inline bool sym_is_choice_value(struct symbol *sym) | ||
| 105 | { | ||
| 106 | return sym->flags & SYMBOL_CHOICEVAL ? true : false; | ||
| 107 | } | ||
| 108 | |||
| 109 | static inline bool sym_is_optional(struct symbol *sym) | ||
| 110 | { | ||
| 111 | return sym->flags & SYMBOL_OPTIONAL ? true : false; | ||
| 112 | } | ||
| 113 | |||
| 114 | static inline bool sym_has_value(struct symbol *sym) | ||
| 115 | { | ||
| 116 | return sym->flags & SYMBOL_NEW ? false : true; | ||
| 117 | } | ||
| 118 | |||
| 119 | #ifdef __cplusplus | ||
| 120 | } | ||
| 121 | #endif | ||
| 122 | |||
| 123 | #endif /* LKC_H */ | ||
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h new file mode 100644 index 000000000000..6dc6d0c48e7a --- /dev/null +++ b/scripts/kconfig/lkc_proto.h | |||
| @@ -0,0 +1,40 @@ | |||
| 1 | |||
| 2 | /* confdata.c */ | ||
| 3 | P(conf_parse,void,(const char *name)); | ||
| 4 | P(conf_read,int,(const char *name)); | ||
| 5 | P(conf_write,int,(const char *name)); | ||
| 6 | |||
| 7 | /* menu.c */ | ||
| 8 | P(rootmenu,struct menu,); | ||
| 9 | |||
| 10 | P(menu_is_visible,bool,(struct menu *menu)); | ||
| 11 | P(menu_get_prompt,const char *,(struct menu *menu)); | ||
| 12 | P(menu_get_root_menu,struct menu *,(struct menu *menu)); | ||
| 13 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | ||
| 14 | |||
| 15 | /* symbol.c */ | ||
| 16 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | ||
| 17 | P(sym_change_count,int,); | ||
| 18 | |||
| 19 | P(sym_lookup,struct symbol *,(const char *name, int isconst)); | ||
| 20 | P(sym_find,struct symbol *,(const char *name)); | ||
| 21 | P(sym_re_search,struct symbol **,(const char *pattern)); | ||
| 22 | P(sym_type_name,const char *,(enum symbol_type type)); | ||
| 23 | P(sym_calc_value,void,(struct symbol *sym)); | ||
| 24 | P(sym_get_type,enum symbol_type,(struct symbol *sym)); | ||
| 25 | P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri)); | ||
| 26 | P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri)); | ||
| 27 | P(sym_toggle_tristate_value,tristate,(struct symbol *sym)); | ||
| 28 | P(sym_string_valid,bool,(struct symbol *sym, const char *newval)); | ||
| 29 | P(sym_string_within_range,bool,(struct symbol *sym, const char *str)); | ||
| 30 | P(sym_set_string_value,bool,(struct symbol *sym, const char *newval)); | ||
| 31 | P(sym_is_changable,bool,(struct symbol *sym)); | ||
| 32 | P(sym_get_choice_prop,struct property *,(struct symbol *sym)); | ||
| 33 | P(sym_get_default_prop,struct property *,(struct symbol *sym)); | ||
| 34 | P(sym_get_string_value,const char *,(struct symbol *sym)); | ||
| 35 | |||
| 36 | P(prop_get_type_name,const char *,(enum prop_type type)); | ||
| 37 | |||
| 38 | /* expr.c */ | ||
| 39 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); | ||
| 40 | P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken)); | ||
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c new file mode 100644 index 000000000000..730d316fe7fe --- /dev/null +++ b/scripts/kconfig/mconf.c | |||
| @@ -0,0 +1,1090 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | * | ||
| 5 | * Introduced single menu mode (show all sub-menus in one large tree). | ||
| 6 | * 2002-11-06 Petr Baudis <pasky@ucw.cz> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <sys/ioctl.h> | ||
| 10 | #include <sys/wait.h> | ||
| 11 | #include <ctype.h> | ||
| 12 | #include <errno.h> | ||
| 13 | #include <fcntl.h> | ||
| 14 | #include <limits.h> | ||
| 15 | #include <signal.h> | ||
| 16 | #include <stdarg.h> | ||
| 17 | #include <stdlib.h> | ||
| 18 | #include <string.h> | ||
| 19 | #include <termios.h> | ||
| 20 | #include <unistd.h> | ||
| 21 | |||
| 22 | #define LKC_DIRECT_LINK | ||
| 23 | #include "lkc.h" | ||
| 24 | |||
| 25 | static char menu_backtitle[128]; | ||
| 26 | static const char mconf_readme[] = | ||
| 27 | "Overview\n" | ||
| 28 | "--------\n" | ||
| 29 | "Some kernel features may be built directly into the kernel.\n" | ||
| 30 | "Some may be made into loadable runtime modules. Some features\n" | ||
| 31 | "may be completely removed altogether. There are also certain\n" | ||
| 32 | "kernel parameters which are not really features, but must be\n" | ||
| 33 | "entered in as decimal or hexadecimal numbers or possibly text.\n" | ||
| 34 | "\n" | ||
| 35 | "Menu items beginning with [*], <M> or [ ] represent features\n" | ||
| 36 | "configured to be built in, modularized or removed respectively.\n" | ||
| 37 | "Pointed brackets <> represent module capable features.\n" | ||
| 38 | "\n" | ||
| 39 | "To change any of these features, highlight it with the cursor\n" | ||
| 40 | "keys and press <Y> to build it in, <M> to make it a module or\n" | ||
| 41 | "<N> to removed it. You may also press the <Space Bar> to cycle\n" | ||
| 42 | "through the available options (ie. Y->N->M->Y).\n" | ||
| 43 | "\n" | ||
| 44 | "Some additional keyboard hints:\n" | ||
| 45 | "\n" | ||
| 46 | "Menus\n" | ||
| 47 | "----------\n" | ||
| 48 | "o Use the Up/Down arrow keys (cursor keys) to highlight the item\n" | ||
| 49 | " you wish to change or submenu wish to select and press <Enter>.\n" | ||
| 50 | " Submenus are designated by \"--->\".\n" | ||
| 51 | "\n" | ||
| 52 | " Shortcut: Press the option's highlighted letter (hotkey).\n" | ||
| 53 | " Pressing a hotkey more than once will sequence\n" | ||
| 54 | " through all visible items which use that hotkey.\n" | ||
| 55 | "\n" | ||
| 56 | " You may also use the <PAGE UP> and <PAGE DOWN> keys to scroll\n" | ||
| 57 | " unseen options into view.\n" | ||
| 58 | "\n" | ||
| 59 | "o To exit a menu use the cursor keys to highlight the <Exit> button\n" | ||
| 60 | " and press <ENTER>.\n" | ||
| 61 | "\n" | ||
| 62 | " Shortcut: Press <ESC><ESC> or <E> or <X> if there is no hotkey\n" | ||
| 63 | " using those letters. You may press a single <ESC>, but\n" | ||
| 64 | " there is a delayed response which you may find annoying.\n" | ||
| 65 | "\n" | ||
| 66 | " Also, the <TAB> and cursor keys will cycle between <Select>,\n" | ||
| 67 | " <Exit> and <Help>\n" | ||
| 68 | "\n" | ||
| 69 | "o To get help with an item, use the cursor keys to highlight <Help>\n" | ||
| 70 | " and Press <ENTER>.\n" | ||
| 71 | "\n" | ||
| 72 | " Shortcut: Press <H> or <?>.\n" | ||
| 73 | "\n" | ||
| 74 | "\n" | ||
| 75 | "Radiolists (Choice lists)\n" | ||
| 76 | "-----------\n" | ||
| 77 | "o Use the cursor keys to select the option you wish to set and press\n" | ||
| 78 | " <S> or the <SPACE BAR>.\n" | ||
| 79 | "\n" | ||
| 80 | " Shortcut: Press the first letter of the option you wish to set then\n" | ||
| 81 | " press <S> or <SPACE BAR>.\n" | ||
| 82 | "\n" | ||
| 83 | "o To see available help for the item, use the cursor keys to highlight\n" | ||
| 84 | " <Help> and Press <ENTER>.\n" | ||
| 85 | "\n" | ||
| 86 | " Shortcut: Press <H> or <?>.\n" | ||
| 87 | "\n" | ||
| 88 | " Also, the <TAB> and cursor keys will cycle between <Select> and\n" | ||
| 89 | " <Help>\n" | ||
| 90 | "\n" | ||
| 91 | "\n" | ||
| 92 | "Data Entry\n" | ||
| 93 | "-----------\n" | ||
| 94 | "o Enter the requested information and press <ENTER>\n" | ||
| 95 | " If you are entering hexadecimal values, it is not necessary to\n" | ||
| 96 | " add the '0x' prefix to the entry.\n" | ||
| 97 | "\n" | ||
| 98 | "o For help, use the <TAB> or cursor keys to highlight the help option\n" | ||
| 99 | " and press <ENTER>. You can try <TAB><H> as well.\n" | ||
| 100 | "\n" | ||
| 101 | "\n" | ||
| 102 | "Text Box (Help Window)\n" | ||
| 103 | "--------\n" | ||
| 104 | "o Use the cursor keys to scroll up/down/left/right. The VI editor\n" | ||
| 105 | " keys h,j,k,l function here as do <SPACE BAR> and <B> for those\n" | ||
| 106 | " who are familiar with less and lynx.\n" | ||
| 107 | "\n" | ||
| 108 | "o Press <E>, <X>, <Enter> or <Esc><Esc> to exit.\n" | ||
| 109 | "\n" | ||
| 110 | "\n" | ||
| 111 | "Alternate Configuration Files\n" | ||
| 112 | "-----------------------------\n" | ||
| 113 | "Menuconfig supports the use of alternate configuration files for\n" | ||
| 114 | "those who, for various reasons, find it necessary to switch\n" | ||
| 115 | "between different kernel configurations.\n" | ||
| 116 | "\n" | ||
| 117 | "At the end of the main menu you will find two options. One is\n" | ||
| 118 | "for saving the current configuration to a file of your choosing.\n" | ||
| 119 | "The other option is for loading a previously saved alternate\n" | ||
| 120 | "configuration.\n" | ||
| 121 | "\n" | ||
| 122 | "Even if you don't use alternate configuration files, but you\n" | ||
| 123 | "find during a Menuconfig session that you have completely messed\n" | ||
| 124 | "up your settings, you may use the \"Load Alternate...\" option to\n" | ||
| 125 | "restore your previously saved settings from \".config\" without\n" | ||
| 126 | "restarting Menuconfig.\n" | ||
| 127 | "\n" | ||
| 128 | "Other information\n" | ||
| 129 | "-----------------\n" | ||
| 130 | "If you use Menuconfig in an XTERM window make sure you have your\n" | ||
| 131 | "$TERM variable set to point to a xterm definition which supports color.\n" | ||
| 132 | "Otherwise, Menuconfig will look rather bad. Menuconfig will not\n" | ||
| 133 | "display correctly in a RXVT window because rxvt displays only one\n" | ||
| 134 | "intensity of color, bright.\n" | ||
| 135 | "\n" | ||
| 136 | "Menuconfig will display larger menus on screens or xterms which are\n" | ||
| 137 | "set to display more than the standard 25 row by 80 column geometry.\n" | ||
| 138 | "In order for this to work, the \"stty size\" command must be able to\n" | ||
| 139 | "display the screen's current row and column geometry. I STRONGLY\n" | ||
| 140 | "RECOMMEND that you make sure you do NOT have the shell variables\n" | ||
| 141 | "LINES and COLUMNS exported into your environment. Some distributions\n" | ||
| 142 | "export those variables via /etc/profile. Some ncurses programs can\n" | ||
| 143 | "become confused when those variables (LINES & COLUMNS) don't reflect\n" | ||
| 144 | "the true screen size.\n" | ||
| 145 | "\n" | ||
| 146 | "Optional personality available\n" | ||
| 147 | "------------------------------\n" | ||
| 148 | "If you prefer to have all of the kernel options listed in a single\n" | ||
| 149 | "menu, rather than the default multimenu hierarchy, run the menuconfig\n" | ||
| 150 | "with MENUCONFIG_MODE environment variable set to single_menu. Example:\n" | ||
| 151 | "\n" | ||
| 152 | "make MENUCONFIG_MODE=single_menu menuconfig\n" | ||
| 153 | "\n" | ||
| 154 | "<Enter> will then unroll the appropriate category, or enfold it if it\n" | ||
| 155 | "is already unrolled.\n" | ||
| 156 | "\n" | ||
| 157 | "Note that this mode can eventually be a little more CPU expensive\n" | ||
| 158 | "(especially with a larger number of unrolled categories) than the\n" | ||
| 159 | "default mode.\n", | ||
| 160 | menu_instructions[] = | ||
| 161 | "Arrow keys navigate the menu. " | ||
| 162 | "<Enter> selects submenus --->. " | ||
| 163 | "Highlighted letters are hotkeys. " | ||
| 164 | "Pressing <Y> includes, <N> excludes, <M> modularizes features. " | ||
| 165 | "Press <Esc><Esc> to exit, <?> for Help, </> for Search. " | ||
| 166 | "Legend: [*] built-in [ ] excluded <M> module < > module capable", | ||
| 167 | radiolist_instructions[] = | ||
| 168 | "Use the arrow keys to navigate this window or " | ||
| 169 | "press the hotkey of the item you wish to select " | ||
| 170 | "followed by the <SPACE BAR>. " | ||
| 171 | "Press <?> for additional information about this option.", | ||
| 172 | inputbox_instructions_int[] = | ||
| 173 | "Please enter a decimal value. " | ||
| 174 | "Fractions will not be accepted. " | ||
| 175 | "Use the <TAB> key to move from the input field to the buttons below it.", | ||
| 176 | inputbox_instructions_hex[] = | ||
| 177 | "Please enter a hexadecimal value. " | ||
| 178 | "Use the <TAB> key to move from the input field to the buttons below it.", | ||
| 179 | inputbox_instructions_string[] = | ||
| 180 | "Please enter a string value. " | ||
| 181 | "Use the <TAB> key to move from the input field to the buttons below it.", | ||
| 182 | setmod_text[] = | ||
| 183 | "This feature depends on another which has been configured as a module.\n" | ||
| 184 | "As a result, this feature will be built as a module.", | ||
| 185 | nohelp_text[] = | ||
| 186 | "There is no help available for this kernel option.\n", | ||
| 187 | load_config_text[] = | ||
| 188 | "Enter the name of the configuration file you wish to load. " | ||
| 189 | "Accept the name shown to restore the configuration you " | ||
| 190 | "last retrieved. Leave blank to abort.", | ||
| 191 | load_config_help[] = | ||
| 192 | "\n" | ||
| 193 | "For various reasons, one may wish to keep several different kernel\n" | ||
| 194 | "configurations available on a single machine.\n" | ||
| 195 | "\n" | ||
| 196 | "If you have saved a previous configuration in a file other than the\n" | ||
| 197 | "kernel's default, entering the name of the file here will allow you\n" | ||
| 198 | "to modify that configuration.\n" | ||
| 199 | "\n" | ||
| 200 | "If you are uncertain, then you have probably never used alternate\n" | ||
| 201 | "configuration files. You should therefor leave this blank to abort.\n", | ||
| 202 | save_config_text[] = | ||
| 203 | "Enter a filename to which this configuration should be saved " | ||
| 204 | "as an alternate. Leave blank to abort.", | ||
| 205 | save_config_help[] = | ||
| 206 | "\n" | ||
| 207 | "For various reasons, one may wish to keep different kernel\n" | ||
| 208 | "configurations available on a single machine.\n" | ||
| 209 | "\n" | ||
| 210 | "Entering a file name here will allow you to later retrieve, modify\n" | ||
| 211 | "and use the current configuration as an alternate to whatever\n" | ||
| 212 | "configuration options you have selected at that time.\n" | ||
| 213 | "\n" | ||
| 214 | "If you are uncertain what all this means then you should probably\n" | ||
| 215 | "leave this blank.\n", | ||
| 216 | search_help[] = | ||
| 217 | "\n" | ||
| 218 | "Search for CONFIG_ symbols and display their relations.\n" | ||
| 219 | "Example: search for \"^FOO\"\n" | ||
| 220 | "Result:\n" | ||
| 221 | "-----------------------------------------------------------------\n" | ||
| 222 | "Symbol: FOO [=m]\n" | ||
| 223 | "Prompt: Foo bus is used to drive the bar HW\n" | ||
| 224 | "Defined at drivers/pci/Kconfig:47\n" | ||
| 225 | "Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" | ||
| 226 | "Location:\n" | ||
| 227 | " -> Bus options (PCI, PCMCIA, EISA, MCA, ISA)\n" | ||
| 228 | " -> PCI support (PCI [=y])\n" | ||
| 229 | " -> PCI access mode (<choice> [=y])\n" | ||
| 230 | "Selects: LIBCRC32\n" | ||
| 231 | "Selected by: BAR\n" | ||
| 232 | "-----------------------------------------------------------------\n" | ||
| 233 | "o The line 'Prompt:' shows the text used in the menu structure for\n" | ||
| 234 | " this CONFIG_ symbol\n" | ||
| 235 | "o The 'Defined at' line tell at what file / line number the symbol\n" | ||
| 236 | " is defined\n" | ||
| 237 | "o The 'Depends on:' line tell what symbols needs to be defined for\n" | ||
| 238 | " this symbol to be visible in the menu (selectable)\n" | ||
| 239 | "o The 'Location:' lines tell where in the menu structure this symbol\n" | ||
| 240 | " is located\n" | ||
| 241 | " A location followed by a [=y] indicate that this is a selectable\n" | ||
| 242 | " menu item - and current value is displayed inside brackets.\n" | ||
| 243 | "o The 'Selects:' line tell what symbol will be automatically\n" | ||
| 244 | " selected if this symbol is selected (y or m)\n" | ||
| 245 | "o The 'Selected by' line tell what symbol has selected this symbol\n" | ||
| 246 | "\n" | ||
| 247 | "Only relevant lines are shown.\n" | ||
| 248 | "\n\n" | ||
| 249 | "Search examples:\n" | ||
| 250 | "Examples: USB => find all CONFIG_ symbols containing USB\n" | ||
| 251 | " ^USB => find all CONFIG_ symbols starting with USB\n" | ||
| 252 | " USB$ => find all CONFIG_ symbols ending with USB\n" | ||
| 253 | "\n"; | ||
| 254 | |||
| 255 | static signed char buf[4096], *bufptr = buf; | ||
| 256 | static signed char input_buf[4096]; | ||
| 257 | static char filename[PATH_MAX+1] = ".config"; | ||
| 258 | static char *args[1024], **argptr = args; | ||
| 259 | static int indent; | ||
| 260 | static struct termios ios_org; | ||
| 261 | static int rows = 0, cols = 0; | ||
| 262 | static struct menu *current_menu; | ||
| 263 | static int child_count; | ||
| 264 | static int do_resize; | ||
| 265 | static int single_menu_mode; | ||
| 266 | |||
| 267 | static void conf(struct menu *menu); | ||
| 268 | static void conf_choice(struct menu *menu); | ||
| 269 | static void conf_string(struct menu *menu); | ||
| 270 | static void conf_load(void); | ||
| 271 | static void conf_save(void); | ||
| 272 | static void show_textbox(const char *title, const char *text, int r, int c); | ||
| 273 | static void show_helptext(const char *title, const char *text); | ||
| 274 | static void show_help(struct menu *menu); | ||
| 275 | static void show_file(const char *filename, const char *title, int r, int c); | ||
| 276 | |||
| 277 | static void cprint_init(void); | ||
| 278 | static int cprint1(const char *fmt, ...); | ||
| 279 | static void cprint_done(void); | ||
| 280 | static int cprint(const char *fmt, ...); | ||
| 281 | |||
| 282 | static void init_wsize(void) | ||
| 283 | { | ||
| 284 | struct winsize ws; | ||
| 285 | char *env; | ||
| 286 | |||
| 287 | if (!ioctl(STDIN_FILENO, TIOCGWINSZ, &ws)) { | ||
| 288 | rows = ws.ws_row; | ||
| 289 | cols = ws.ws_col; | ||
| 290 | } | ||
| 291 | |||
| 292 | if (!rows) { | ||
| 293 | env = getenv("LINES"); | ||
| 294 | if (env) | ||
| 295 | rows = atoi(env); | ||
| 296 | if (!rows) | ||
| 297 | rows = 24; | ||
| 298 | } | ||
| 299 | if (!cols) { | ||
| 300 | env = getenv("COLUMNS"); | ||
| 301 | if (env) | ||
| 302 | cols = atoi(env); | ||
| 303 | if (!cols) | ||
| 304 | cols = 80; | ||
| 305 | } | ||
| 306 | |||
| 307 | if (rows < 19 || cols < 80) { | ||
| 308 | fprintf(stderr, "Your display is too small to run Menuconfig!\n"); | ||
| 309 | fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); | ||
| 310 | exit(1); | ||
| 311 | } | ||
| 312 | |||
| 313 | rows -= 4; | ||
| 314 | cols -= 5; | ||
| 315 | } | ||
| 316 | |||
| 317 | static void cprint_init(void) | ||
| 318 | { | ||
| 319 | bufptr = buf; | ||
| 320 | argptr = args; | ||
| 321 | memset(args, 0, sizeof(args)); | ||
| 322 | indent = 0; | ||
| 323 | child_count = 0; | ||
| 324 | cprint("./scripts/lxdialog/lxdialog"); | ||
| 325 | cprint("--backtitle"); | ||
| 326 | cprint(menu_backtitle); | ||
| 327 | } | ||
| 328 | |||
| 329 | static int cprint1(const char *fmt, ...) | ||
| 330 | { | ||
| 331 | va_list ap; | ||
| 332 | int res; | ||
| 333 | |||
| 334 | if (!*argptr) | ||
| 335 | *argptr = bufptr; | ||
| 336 | va_start(ap, fmt); | ||
| 337 | res = vsprintf(bufptr, fmt, ap); | ||
| 338 | va_end(ap); | ||
| 339 | bufptr += res; | ||
| 340 | |||
| 341 | return res; | ||
| 342 | } | ||
| 343 | |||
| 344 | static void cprint_done(void) | ||
| 345 | { | ||
| 346 | *bufptr++ = 0; | ||
| 347 | argptr++; | ||
| 348 | } | ||
| 349 | |||
| 350 | static int cprint(const char *fmt, ...) | ||
| 351 | { | ||
| 352 | va_list ap; | ||
| 353 | int res; | ||
| 354 | |||
| 355 | *argptr++ = bufptr; | ||
| 356 | va_start(ap, fmt); | ||
| 357 | res = vsprintf(bufptr, fmt, ap); | ||
| 358 | va_end(ap); | ||
| 359 | bufptr += res; | ||
| 360 | *bufptr++ = 0; | ||
| 361 | |||
| 362 | return res; | ||
| 363 | } | ||
| 364 | |||
| 365 | static void get_prompt_str(struct gstr *r, struct property *prop) | ||
| 366 | { | ||
| 367 | int i, j; | ||
| 368 | struct menu *submenu[8], *menu; | ||
| 369 | |||
| 370 | str_printf(r, "Prompt: %s\n", prop->text); | ||
| 371 | str_printf(r, " Defined at %s:%d\n", prop->menu->file->name, | ||
| 372 | prop->menu->lineno); | ||
| 373 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 374 | str_append(r, " Depends on: "); | ||
| 375 | expr_gstr_print(prop->visible.expr, r); | ||
| 376 | str_append(r, "\n"); | ||
| 377 | } | ||
| 378 | menu = prop->menu->parent; | ||
| 379 | for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) | ||
| 380 | submenu[i++] = menu; | ||
| 381 | if (i > 0) { | ||
| 382 | str_printf(r, " Location:\n"); | ||
| 383 | for (j = 4; --i >= 0; j += 2) { | ||
| 384 | menu = submenu[i]; | ||
| 385 | str_printf(r, "%*c-> %s", j, ' ', menu_get_prompt(menu)); | ||
| 386 | if (menu->sym) { | ||
| 387 | str_printf(r, " (%s [=%s])", menu->sym->name ? | ||
| 388 | menu->sym->name : "<choice>", | ||
| 389 | sym_get_string_value(menu->sym)); | ||
| 390 | } | ||
| 391 | str_append(r, "\n"); | ||
| 392 | } | ||
| 393 | } | ||
| 394 | } | ||
| 395 | |||
| 396 | static void get_symbol_str(struct gstr *r, struct symbol *sym) | ||
| 397 | { | ||
| 398 | bool hit; | ||
| 399 | struct property *prop; | ||
| 400 | |||
| 401 | str_printf(r, "Symbol: %s [=%s]\n", sym->name, | ||
| 402 | sym_get_string_value(sym)); | ||
| 403 | for_all_prompts(sym, prop) | ||
| 404 | get_prompt_str(r, prop); | ||
| 405 | hit = false; | ||
| 406 | for_all_properties(sym, prop, P_SELECT) { | ||
| 407 | if (!hit) { | ||
| 408 | str_append(r, " Selects: "); | ||
| 409 | hit = true; | ||
| 410 | } else | ||
| 411 | str_printf(r, " && "); | ||
| 412 | expr_gstr_print(prop->expr, r); | ||
| 413 | } | ||
| 414 | if (hit) | ||
| 415 | str_append(r, "\n"); | ||
| 416 | if (sym->rev_dep.expr) { | ||
| 417 | str_append(r, " Selected by: "); | ||
| 418 | expr_gstr_print(sym->rev_dep.expr, r); | ||
| 419 | str_append(r, "\n"); | ||
| 420 | } | ||
| 421 | str_append(r, "\n\n"); | ||
| 422 | } | ||
| 423 | |||
| 424 | static struct gstr get_relations_str(struct symbol **sym_arr) | ||
| 425 | { | ||
| 426 | struct symbol *sym; | ||
| 427 | struct gstr res = str_new(); | ||
| 428 | int i; | ||
| 429 | |||
| 430 | for (i = 0; sym_arr && (sym = sym_arr[i]); i++) | ||
| 431 | get_symbol_str(&res, sym); | ||
| 432 | if (!i) | ||
| 433 | str_append(&res, "No matches found.\n"); | ||
| 434 | return res; | ||
| 435 | } | ||
| 436 | |||
| 437 | pid_t pid; | ||
| 438 | |||
| 439 | static void winch_handler(int sig) | ||
| 440 | { | ||
| 441 | if (!do_resize) { | ||
| 442 | kill(pid, SIGINT); | ||
| 443 | do_resize = 1; | ||
| 444 | } | ||
| 445 | } | ||
| 446 | |||
| 447 | static int exec_conf(void) | ||
| 448 | { | ||
| 449 | int pipefd[2], stat, size; | ||
| 450 | struct sigaction sa; | ||
| 451 | sigset_t sset, osset; | ||
| 452 | |||
| 453 | sigemptyset(&sset); | ||
| 454 | sigaddset(&sset, SIGINT); | ||
| 455 | sigprocmask(SIG_BLOCK, &sset, &osset); | ||
| 456 | |||
| 457 | signal(SIGINT, SIG_DFL); | ||
| 458 | |||
| 459 | sa.sa_handler = winch_handler; | ||
| 460 | sigemptyset(&sa.sa_mask); | ||
| 461 | sa.sa_flags = SA_RESTART; | ||
| 462 | sigaction(SIGWINCH, &sa, NULL); | ||
| 463 | |||
| 464 | *argptr++ = NULL; | ||
| 465 | |||
| 466 | pipe(pipefd); | ||
| 467 | pid = fork(); | ||
| 468 | if (pid == 0) { | ||
| 469 | sigprocmask(SIG_SETMASK, &osset, NULL); | ||
| 470 | dup2(pipefd[1], 2); | ||
| 471 | close(pipefd[0]); | ||
| 472 | close(pipefd[1]); | ||
| 473 | execv(args[0], args); | ||
| 474 | _exit(EXIT_FAILURE); | ||
| 475 | } | ||
| 476 | |||
| 477 | close(pipefd[1]); | ||
| 478 | bufptr = input_buf; | ||
| 479 | while (1) { | ||
| 480 | size = input_buf + sizeof(input_buf) - bufptr; | ||
| 481 | size = read(pipefd[0], bufptr, size); | ||
| 482 | if (size <= 0) { | ||
| 483 | if (size < 0) { | ||
| 484 | if (errno == EINTR || errno == EAGAIN) | ||
| 485 | continue; | ||
| 486 | perror("read"); | ||
| 487 | } | ||
| 488 | break; | ||
| 489 | } | ||
| 490 | bufptr += size; | ||
| 491 | } | ||
| 492 | *bufptr++ = 0; | ||
| 493 | close(pipefd[0]); | ||
| 494 | waitpid(pid, &stat, 0); | ||
| 495 | |||
| 496 | if (do_resize) { | ||
| 497 | init_wsize(); | ||
| 498 | do_resize = 0; | ||
| 499 | sigprocmask(SIG_SETMASK, &osset, NULL); | ||
| 500 | return -1; | ||
| 501 | } | ||
| 502 | if (WIFSIGNALED(stat)) { | ||
| 503 | printf("\finterrupted(%d)\n", WTERMSIG(stat)); | ||
| 504 | exit(1); | ||
| 505 | } | ||
| 506 | #if 0 | ||
| 507 | printf("\fexit state: %d\nexit data: '%s'\n", WEXITSTATUS(stat), input_buf); | ||
| 508 | sleep(1); | ||
| 509 | #endif | ||
| 510 | sigpending(&sset); | ||
| 511 | if (sigismember(&sset, SIGINT)) { | ||
| 512 | printf("\finterrupted\n"); | ||
| 513 | exit(1); | ||
| 514 | } | ||
| 515 | sigprocmask(SIG_SETMASK, &osset, NULL); | ||
| 516 | |||
| 517 | return WEXITSTATUS(stat); | ||
| 518 | } | ||
| 519 | |||
| 520 | static void search_conf(void) | ||
| 521 | { | ||
| 522 | struct symbol **sym_arr; | ||
| 523 | int stat; | ||
| 524 | struct gstr res; | ||
| 525 | |||
| 526 | again: | ||
| 527 | cprint_init(); | ||
| 528 | cprint("--title"); | ||
| 529 | cprint("Search Configuration Parameter"); | ||
| 530 | cprint("--inputbox"); | ||
| 531 | cprint("Enter Keyword"); | ||
| 532 | cprint("10"); | ||
| 533 | cprint("75"); | ||
| 534 | cprint(""); | ||
| 535 | stat = exec_conf(); | ||
| 536 | if (stat < 0) | ||
| 537 | goto again; | ||
| 538 | switch (stat) { | ||
| 539 | case 0: | ||
| 540 | break; | ||
| 541 | case 1: | ||
| 542 | show_helptext("Search Configuration", search_help); | ||
| 543 | goto again; | ||
| 544 | default: | ||
| 545 | return; | ||
| 546 | } | ||
| 547 | |||
| 548 | sym_arr = sym_re_search(input_buf); | ||
| 549 | res = get_relations_str(sym_arr); | ||
| 550 | free(sym_arr); | ||
| 551 | show_textbox("Search Results", str_get(&res), 0, 0); | ||
| 552 | str_free(&res); | ||
| 553 | } | ||
| 554 | |||
| 555 | static void build_conf(struct menu *menu) | ||
| 556 | { | ||
| 557 | struct symbol *sym; | ||
| 558 | struct property *prop; | ||
| 559 | struct menu *child; | ||
| 560 | int type, tmp, doint = 2; | ||
| 561 | tristate val; | ||
| 562 | char ch; | ||
| 563 | |||
| 564 | if (!menu_is_visible(menu)) | ||
| 565 | return; | ||
| 566 | |||
| 567 | sym = menu->sym; | ||
| 568 | prop = menu->prompt; | ||
| 569 | if (!sym) { | ||
| 570 | if (prop && menu != current_menu) { | ||
| 571 | const char *prompt = menu_get_prompt(menu); | ||
| 572 | switch (prop->type) { | ||
| 573 | case P_MENU: | ||
| 574 | child_count++; | ||
| 575 | cprint("m%p", menu); | ||
| 576 | |||
| 577 | if (single_menu_mode) { | ||
| 578 | cprint1("%s%*c%s", | ||
| 579 | menu->data ? "-->" : "++>", | ||
| 580 | indent + 1, ' ', prompt); | ||
| 581 | } else | ||
| 582 | cprint1(" %*c%s --->", indent + 1, ' ', prompt); | ||
| 583 | |||
| 584 | cprint_done(); | ||
| 585 | if (single_menu_mode && menu->data) | ||
| 586 | goto conf_childs; | ||
| 587 | return; | ||
| 588 | default: | ||
| 589 | if (prompt) { | ||
| 590 | child_count++; | ||
| 591 | cprint(":%p", menu); | ||
| 592 | cprint("---%*c%s", indent + 1, ' ', prompt); | ||
| 593 | } | ||
| 594 | } | ||
| 595 | } else | ||
| 596 | doint = 0; | ||
| 597 | goto conf_childs; | ||
| 598 | } | ||
| 599 | |||
| 600 | type = sym_get_type(sym); | ||
| 601 | if (sym_is_choice(sym)) { | ||
| 602 | struct symbol *def_sym = sym_get_choice_value(sym); | ||
| 603 | struct menu *def_menu = NULL; | ||
| 604 | |||
| 605 | child_count++; | ||
| 606 | for (child = menu->list; child; child = child->next) { | ||
| 607 | if (menu_is_visible(child) && child->sym == def_sym) | ||
| 608 | def_menu = child; | ||
| 609 | } | ||
| 610 | |||
| 611 | val = sym_get_tristate_value(sym); | ||
| 612 | if (sym_is_changable(sym)) { | ||
| 613 | cprint("t%p", menu); | ||
| 614 | switch (type) { | ||
| 615 | case S_BOOLEAN: | ||
| 616 | cprint1("[%c]", val == no ? ' ' : '*'); | ||
| 617 | break; | ||
| 618 | case S_TRISTATE: | ||
| 619 | switch (val) { | ||
| 620 | case yes: ch = '*'; break; | ||
| 621 | case mod: ch = 'M'; break; | ||
| 622 | default: ch = ' '; break; | ||
| 623 | } | ||
| 624 | cprint1("<%c>", ch); | ||
| 625 | break; | ||
| 626 | } | ||
| 627 | } else { | ||
| 628 | cprint("%c%p", def_menu ? 't' : ':', menu); | ||
| 629 | cprint1(" "); | ||
| 630 | } | ||
| 631 | |||
| 632 | cprint1("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); | ||
| 633 | if (val == yes) { | ||
| 634 | if (def_menu) { | ||
| 635 | cprint1(" (%s)", menu_get_prompt(def_menu)); | ||
| 636 | cprint1(" --->"); | ||
| 637 | cprint_done(); | ||
| 638 | if (def_menu->list) { | ||
| 639 | indent += 2; | ||
| 640 | build_conf(def_menu); | ||
| 641 | indent -= 2; | ||
| 642 | } | ||
| 643 | } else | ||
| 644 | cprint_done(); | ||
| 645 | return; | ||
| 646 | } | ||
| 647 | cprint_done(); | ||
| 648 | } else { | ||
| 649 | if (menu == current_menu) { | ||
| 650 | cprint(":%p", menu); | ||
| 651 | cprint("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); | ||
| 652 | goto conf_childs; | ||
| 653 | } | ||
| 654 | child_count++; | ||
| 655 | val = sym_get_tristate_value(sym); | ||
| 656 | if (sym_is_choice_value(sym) && val == yes) { | ||
| 657 | cprint(":%p", menu); | ||
| 658 | cprint1(" "); | ||
| 659 | } else { | ||
| 660 | switch (type) { | ||
| 661 | case S_BOOLEAN: | ||
| 662 | cprint("t%p", menu); | ||
| 663 | if (sym_is_changable(sym)) | ||
| 664 | cprint1("[%c]", val == no ? ' ' : '*'); | ||
| 665 | else | ||
| 666 | cprint1("---"); | ||
| 667 | break; | ||
| 668 | case S_TRISTATE: | ||
| 669 | cprint("t%p", menu); | ||
| 670 | switch (val) { | ||
| 671 | case yes: ch = '*'; break; | ||
| 672 | case mod: ch = 'M'; break; | ||
| 673 | default: ch = ' '; break; | ||
| 674 | } | ||
| 675 | if (sym_is_changable(sym)) | ||
| 676 | cprint1("<%c>", ch); | ||
| 677 | else | ||
| 678 | cprint1("---"); | ||
| 679 | break; | ||
| 680 | default: | ||
| 681 | cprint("s%p", menu); | ||
| 682 | tmp = cprint1("(%s)", sym_get_string_value(sym)); | ||
| 683 | tmp = indent - tmp + 4; | ||
| 684 | if (tmp < 0) | ||
| 685 | tmp = 0; | ||
| 686 | cprint1("%*c%s%s", tmp, ' ', menu_get_prompt(menu), | ||
| 687 | (sym_has_value(sym) || !sym_is_changable(sym)) ? | ||
| 688 | "" : " (NEW)"); | ||
| 689 | cprint_done(); | ||
| 690 | goto conf_childs; | ||
| 691 | } | ||
| 692 | } | ||
| 693 | cprint1("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), | ||
| 694 | (sym_has_value(sym) || !sym_is_changable(sym)) ? | ||
| 695 | "" : " (NEW)"); | ||
| 696 | if (menu->prompt->type == P_MENU) { | ||
| 697 | cprint1(" --->"); | ||
| 698 | cprint_done(); | ||
| 699 | return; | ||
| 700 | } | ||
| 701 | cprint_done(); | ||
| 702 | } | ||
| 703 | |||
| 704 | conf_childs: | ||
| 705 | indent += doint; | ||
| 706 | for (child = menu->list; child; child = child->next) | ||
| 707 | build_conf(child); | ||
| 708 | indent -= doint; | ||
| 709 | } | ||
| 710 | |||
| 711 | static void conf(struct menu *menu) | ||
| 712 | { | ||
| 713 | struct menu *submenu; | ||
| 714 | const char *prompt = menu_get_prompt(menu); | ||
| 715 | struct symbol *sym; | ||
| 716 | char active_entry[40]; | ||
| 717 | int stat, type, i; | ||
| 718 | |||
| 719 | unlink("lxdialog.scrltmp"); | ||
| 720 | active_entry[0] = 0; | ||
| 721 | while (1) { | ||
| 722 | cprint_init(); | ||
| 723 | cprint("--title"); | ||
| 724 | cprint("%s", prompt ? prompt : "Main Menu"); | ||
| 725 | cprint("--menu"); | ||
| 726 | cprint(menu_instructions); | ||
| 727 | cprint("%d", rows); | ||
| 728 | cprint("%d", cols); | ||
| 729 | cprint("%d", rows - 10); | ||
| 730 | cprint("%s", active_entry); | ||
| 731 | current_menu = menu; | ||
| 732 | build_conf(menu); | ||
| 733 | if (!child_count) | ||
| 734 | break; | ||
| 735 | if (menu == &rootmenu) { | ||
| 736 | cprint(":"); | ||
| 737 | cprint("--- "); | ||
| 738 | cprint("L"); | ||
| 739 | cprint(" Load an Alternate Configuration File"); | ||
| 740 | cprint("S"); | ||
| 741 | cprint(" Save Configuration to an Alternate File"); | ||
| 742 | } | ||
| 743 | stat = exec_conf(); | ||
| 744 | if (stat < 0) | ||
| 745 | continue; | ||
| 746 | |||
| 747 | if (stat == 1 || stat == 255) | ||
| 748 | break; | ||
| 749 | |||
| 750 | type = input_buf[0]; | ||
| 751 | if (!type) | ||
| 752 | continue; | ||
| 753 | |||
| 754 | for (i = 0; input_buf[i] && !isspace(input_buf[i]); i++) | ||
| 755 | ; | ||
| 756 | if (i >= sizeof(active_entry)) | ||
| 757 | i = sizeof(active_entry) - 1; | ||
| 758 | input_buf[i] = 0; | ||
| 759 | strcpy(active_entry, input_buf); | ||
| 760 | |||
| 761 | sym = NULL; | ||
| 762 | submenu = NULL; | ||
| 763 | if (sscanf(input_buf + 1, "%p", &submenu) == 1) | ||
| 764 | sym = submenu->sym; | ||
| 765 | |||
| 766 | switch (stat) { | ||
| 767 | case 0: | ||
| 768 | switch (type) { | ||
| 769 | case 'm': | ||
| 770 | if (single_menu_mode) | ||
| 771 | submenu->data = (void *) (long) !submenu->data; | ||
| 772 | else | ||
| 773 | conf(submenu); | ||
| 774 | break; | ||
| 775 | case 't': | ||
| 776 | if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) | ||
| 777 | conf_choice(submenu); | ||
| 778 | else if (submenu->prompt->type == P_MENU) | ||
| 779 | conf(submenu); | ||
| 780 | break; | ||
| 781 | case 's': | ||
| 782 | conf_string(submenu); | ||
| 783 | break; | ||
| 784 | case 'L': | ||
| 785 | conf_load(); | ||
| 786 | break; | ||
| 787 | case 'S': | ||
| 788 | conf_save(); | ||
| 789 | break; | ||
| 790 | } | ||
| 791 | break; | ||
| 792 | case 2: | ||
| 793 | if (sym) | ||
| 794 | show_help(submenu); | ||
| 795 | else | ||
| 796 | show_helptext("README", mconf_readme); | ||
| 797 | break; | ||
| 798 | case 3: | ||
| 799 | if (type == 't') { | ||
| 800 | if (sym_set_tristate_value(sym, yes)) | ||
| 801 | break; | ||
| 802 | if (sym_set_tristate_value(sym, mod)) | ||
| 803 | show_textbox(NULL, setmod_text, 6, 74); | ||
| 804 | } | ||
| 805 | break; | ||
| 806 | case 4: | ||
| 807 | if (type == 't') | ||
| 808 | sym_set_tristate_value(sym, no); | ||
| 809 | break; | ||
| 810 | case 5: | ||
| 811 | if (type == 't') | ||
| 812 | sym_set_tristate_value(sym, mod); | ||
| 813 | break; | ||
| 814 | case 6: | ||
| 815 | if (type == 't') | ||
| 816 | sym_toggle_tristate_value(sym); | ||
| 817 | else if (type == 'm') | ||
| 818 | conf(submenu); | ||
| 819 | break; | ||
| 820 | case 7: | ||
| 821 | search_conf(); | ||
| 822 | break; | ||
| 823 | } | ||
| 824 | } | ||
| 825 | } | ||
| 826 | |||
| 827 | static void show_textbox(const char *title, const char *text, int r, int c) | ||
| 828 | { | ||
| 829 | int fd; | ||
| 830 | |||
| 831 | fd = creat(".help.tmp", 0777); | ||
| 832 | write(fd, text, strlen(text)); | ||
| 833 | close(fd); | ||
| 834 | show_file(".help.tmp", title, r, c); | ||
| 835 | unlink(".help.tmp"); | ||
| 836 | } | ||
| 837 | |||
| 838 | static void show_helptext(const char *title, const char *text) | ||
| 839 | { | ||
| 840 | show_textbox(title, text, 0, 0); | ||
| 841 | } | ||
| 842 | |||
| 843 | static void show_help(struct menu *menu) | ||
| 844 | { | ||
| 845 | struct gstr help = str_new(); | ||
| 846 | struct symbol *sym = menu->sym; | ||
| 847 | |||
| 848 | if (sym->help) | ||
| 849 | { | ||
| 850 | if (sym->name) { | ||
| 851 | str_printf(&help, "CONFIG_%s:\n\n", sym->name); | ||
| 852 | str_append(&help, sym->help); | ||
| 853 | str_append(&help, "\n"); | ||
| 854 | } | ||
| 855 | } else { | ||
| 856 | str_append(&help, nohelp_text); | ||
| 857 | } | ||
| 858 | get_symbol_str(&help, sym); | ||
| 859 | show_helptext(menu_get_prompt(menu), str_get(&help)); | ||
| 860 | str_free(&help); | ||
| 861 | } | ||
| 862 | |||
| 863 | static void show_file(const char *filename, const char *title, int r, int c) | ||
| 864 | { | ||
| 865 | do { | ||
| 866 | cprint_init(); | ||
| 867 | if (title) { | ||
| 868 | cprint("--title"); | ||
| 869 | cprint("%s", title); | ||
| 870 | } | ||
| 871 | cprint("--textbox"); | ||
| 872 | cprint("%s", filename); | ||
| 873 | cprint("%d", r ? r : rows); | ||
| 874 | cprint("%d", c ? c : cols); | ||
| 875 | } while (exec_conf() < 0); | ||
| 876 | } | ||
| 877 | |||
| 878 | static void conf_choice(struct menu *menu) | ||
| 879 | { | ||
| 880 | const char *prompt = menu_get_prompt(menu); | ||
| 881 | struct menu *child; | ||
| 882 | struct symbol *active; | ||
| 883 | int stat; | ||
| 884 | |||
| 885 | active = sym_get_choice_value(menu->sym); | ||
| 886 | while (1) { | ||
| 887 | cprint_init(); | ||
| 888 | cprint("--title"); | ||
| 889 | cprint("%s", prompt ? prompt : "Main Menu"); | ||
| 890 | cprint("--radiolist"); | ||
| 891 | cprint(radiolist_instructions); | ||
| 892 | cprint("15"); | ||
| 893 | cprint("70"); | ||
| 894 | cprint("6"); | ||
| 895 | |||
| 896 | current_menu = menu; | ||
| 897 | for (child = menu->list; child; child = child->next) { | ||
| 898 | if (!menu_is_visible(child)) | ||
| 899 | continue; | ||
| 900 | cprint("%p", child); | ||
| 901 | cprint("%s", menu_get_prompt(child)); | ||
| 902 | if (child->sym == sym_get_choice_value(menu->sym)) | ||
| 903 | cprint("ON"); | ||
| 904 | else if (child->sym == active) | ||
| 905 | cprint("SELECTED"); | ||
| 906 | else | ||
| 907 | cprint("OFF"); | ||
| 908 | } | ||
| 909 | |||
| 910 | stat = exec_conf(); | ||
| 911 | switch (stat) { | ||
| 912 | case 0: | ||
| 913 | if (sscanf(input_buf, "%p", &child) != 1) | ||
| 914 | break; | ||
| 915 | sym_set_tristate_value(child->sym, yes); | ||
| 916 | return; | ||
| 917 | case 1: | ||
| 918 | if (sscanf(input_buf, "%p", &child) == 1) { | ||
| 919 | show_help(child); | ||
| 920 | active = child->sym; | ||
| 921 | } else | ||
| 922 | show_help(menu); | ||
| 923 | break; | ||
| 924 | case 255: | ||
| 925 | return; | ||
| 926 | } | ||
| 927 | } | ||
| 928 | } | ||
| 929 | |||
| 930 | static void conf_string(struct menu *menu) | ||
| 931 | { | ||
| 932 | const char *prompt = menu_get_prompt(menu); | ||
| 933 | int stat; | ||
| 934 | |||
| 935 | while (1) { | ||
| 936 | cprint_init(); | ||
| 937 | cprint("--title"); | ||
| 938 | cprint("%s", prompt ? prompt : "Main Menu"); | ||
| 939 | cprint("--inputbox"); | ||
| 940 | switch (sym_get_type(menu->sym)) { | ||
| 941 | case S_INT: | ||
| 942 | cprint(inputbox_instructions_int); | ||
| 943 | break; | ||
| 944 | case S_HEX: | ||
| 945 | cprint(inputbox_instructions_hex); | ||
| 946 | break; | ||
| 947 | case S_STRING: | ||
| 948 | cprint(inputbox_instructions_string); | ||
| 949 | break; | ||
| 950 | default: | ||
| 951 | /* panic? */; | ||
| 952 | } | ||
| 953 | cprint("10"); | ||
| 954 | cprint("75"); | ||
| 955 | cprint("%s", sym_get_string_value(menu->sym)); | ||
| 956 | stat = exec_conf(); | ||
| 957 | switch (stat) { | ||
| 958 | case 0: | ||
| 959 | if (sym_set_string_value(menu->sym, input_buf)) | ||
| 960 | return; | ||
| 961 | show_textbox(NULL, "You have made an invalid entry.", 5, 43); | ||
| 962 | break; | ||
| 963 | case 1: | ||
| 964 | show_help(menu); | ||
| 965 | break; | ||
| 966 | case 255: | ||
| 967 | return; | ||
| 968 | } | ||
| 969 | } | ||
| 970 | } | ||
| 971 | |||
| 972 | static void conf_load(void) | ||
| 973 | { | ||
| 974 | int stat; | ||
| 975 | |||
| 976 | while (1) { | ||
| 977 | cprint_init(); | ||
| 978 | cprint("--inputbox"); | ||
| 979 | cprint(load_config_text); | ||
| 980 | cprint("11"); | ||
| 981 | cprint("55"); | ||
| 982 | cprint("%s", filename); | ||
| 983 | stat = exec_conf(); | ||
| 984 | switch(stat) { | ||
| 985 | case 0: | ||
| 986 | if (!input_buf[0]) | ||
| 987 | return; | ||
| 988 | if (!conf_read(input_buf)) | ||
| 989 | return; | ||
| 990 | show_textbox(NULL, "File does not exist!", 5, 38); | ||
| 991 | break; | ||
| 992 | case 1: | ||
| 993 | show_helptext("Load Alternate Configuration", load_config_help); | ||
| 994 | break; | ||
| 995 | case 255: | ||
| 996 | return; | ||
| 997 | } | ||
| 998 | } | ||
| 999 | } | ||
| 1000 | |||
| 1001 | static void conf_save(void) | ||
| 1002 | { | ||
| 1003 | int stat; | ||
| 1004 | |||
| 1005 | while (1) { | ||
| 1006 | cprint_init(); | ||
| 1007 | cprint("--inputbox"); | ||
| 1008 | cprint(save_config_text); | ||
| 1009 | cprint("11"); | ||
| 1010 | cprint("55"); | ||
| 1011 | cprint("%s", filename); | ||
| 1012 | stat = exec_conf(); | ||
| 1013 | switch(stat) { | ||
| 1014 | case 0: | ||
| 1015 | if (!input_buf[0]) | ||
| 1016 | return; | ||
| 1017 | if (!conf_write(input_buf)) | ||
| 1018 | return; | ||
| 1019 | show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); | ||
| 1020 | break; | ||
| 1021 | case 1: | ||
| 1022 | show_helptext("Save Alternate Configuration", save_config_help); | ||
| 1023 | break; | ||
| 1024 | case 255: | ||
| 1025 | return; | ||
| 1026 | } | ||
| 1027 | } | ||
| 1028 | } | ||
| 1029 | |||
| 1030 | static void conf_cleanup(void) | ||
| 1031 | { | ||
| 1032 | tcsetattr(1, TCSAFLUSH, &ios_org); | ||
| 1033 | unlink(".help.tmp"); | ||
| 1034 | unlink("lxdialog.scrltmp"); | ||
| 1035 | } | ||
| 1036 | |||
| 1037 | int main(int ac, char **av) | ||
| 1038 | { | ||
| 1039 | struct symbol *sym; | ||
| 1040 | char *mode; | ||
| 1041 | int stat; | ||
| 1042 | |||
| 1043 | conf_parse(av[1]); | ||
| 1044 | conf_read(NULL); | ||
| 1045 | |||
| 1046 | sym = sym_lookup("KERNELRELEASE", 0); | ||
| 1047 | sym_calc_value(sym); | ||
| 1048 | sprintf(menu_backtitle, "Linux Kernel v%s Configuration", | ||
| 1049 | sym_get_string_value(sym)); | ||
| 1050 | |||
| 1051 | mode = getenv("MENUCONFIG_MODE"); | ||
| 1052 | if (mode) { | ||
| 1053 | if (!strcasecmp(mode, "single_menu")) | ||
| 1054 | single_menu_mode = 1; | ||
| 1055 | } | ||
| 1056 | |||
| 1057 | tcgetattr(1, &ios_org); | ||
| 1058 | atexit(conf_cleanup); | ||
| 1059 | init_wsize(); | ||
| 1060 | conf(&rootmenu); | ||
| 1061 | |||
| 1062 | do { | ||
| 1063 | cprint_init(); | ||
| 1064 | cprint("--yesno"); | ||
| 1065 | cprint("Do you wish to save your new kernel configuration?"); | ||
| 1066 | cprint("5"); | ||
| 1067 | cprint("60"); | ||
| 1068 | stat = exec_conf(); | ||
| 1069 | } while (stat < 0); | ||
| 1070 | |||
| 1071 | if (stat == 0) { | ||
| 1072 | if (conf_write(NULL)) { | ||
| 1073 | fprintf(stderr, "\n\n" | ||
| 1074 | "Error during writing of the kernel configuration.\n" | ||
| 1075 | "Your kernel configuration changes were NOT saved." | ||
| 1076 | "\n\n"); | ||
| 1077 | return 1; | ||
| 1078 | } | ||
| 1079 | printf("\n\n" | ||
| 1080 | "*** End of Linux kernel configuration.\n" | ||
| 1081 | "*** Execute 'make' to build the kernel or try 'make help'." | ||
| 1082 | "\n\n"); | ||
| 1083 | } else { | ||
| 1084 | fprintf(stderr, "\n\n" | ||
| 1085 | "Your kernel configuration changes were NOT saved." | ||
| 1086 | "\n\n"); | ||
| 1087 | } | ||
| 1088 | |||
| 1089 | return 0; | ||
| 1090 | } | ||
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c new file mode 100644 index 000000000000..0c13156f3344 --- /dev/null +++ b/scripts/kconfig/menu.c | |||
| @@ -0,0 +1,390 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <stdlib.h> | ||
| 7 | #include <string.h> | ||
| 8 | |||
| 9 | #define LKC_DIRECT_LINK | ||
| 10 | #include "lkc.h" | ||
| 11 | |||
| 12 | struct menu rootmenu; | ||
| 13 | static struct menu **last_entry_ptr; | ||
| 14 | |||
| 15 | struct file *file_list; | ||
| 16 | struct file *current_file; | ||
| 17 | |||
| 18 | static void menu_warn(struct menu *menu, const char *fmt, ...) | ||
| 19 | { | ||
| 20 | va_list ap; | ||
| 21 | va_start(ap, fmt); | ||
| 22 | fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno); | ||
| 23 | vfprintf(stderr, fmt, ap); | ||
| 24 | fprintf(stderr, "\n"); | ||
| 25 | va_end(ap); | ||
| 26 | } | ||
| 27 | |||
| 28 | static void prop_warn(struct property *prop, const char *fmt, ...) | ||
| 29 | { | ||
| 30 | va_list ap; | ||
| 31 | va_start(ap, fmt); | ||
| 32 | fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno); | ||
| 33 | vfprintf(stderr, fmt, ap); | ||
| 34 | fprintf(stderr, "\n"); | ||
| 35 | va_end(ap); | ||
| 36 | } | ||
| 37 | |||
| 38 | void menu_init(void) | ||
| 39 | { | ||
| 40 | current_entry = current_menu = &rootmenu; | ||
| 41 | last_entry_ptr = &rootmenu.list; | ||
| 42 | } | ||
| 43 | |||
| 44 | void menu_add_entry(struct symbol *sym) | ||
| 45 | { | ||
| 46 | struct menu *menu; | ||
| 47 | |||
| 48 | menu = malloc(sizeof(*menu)); | ||
| 49 | memset(menu, 0, sizeof(*menu)); | ||
| 50 | menu->sym = sym; | ||
| 51 | menu->parent = current_menu; | ||
| 52 | menu->file = current_file; | ||
| 53 | menu->lineno = zconf_lineno(); | ||
| 54 | |||
| 55 | *last_entry_ptr = menu; | ||
| 56 | last_entry_ptr = &menu->next; | ||
| 57 | current_entry = menu; | ||
| 58 | } | ||
| 59 | |||
| 60 | void menu_end_entry(void) | ||
| 61 | { | ||
| 62 | } | ||
| 63 | |||
| 64 | void menu_add_menu(void) | ||
| 65 | { | ||
| 66 | current_menu = current_entry; | ||
| 67 | last_entry_ptr = ¤t_entry->list; | ||
| 68 | } | ||
| 69 | |||
| 70 | void menu_end_menu(void) | ||
| 71 | { | ||
| 72 | last_entry_ptr = ¤t_menu->next; | ||
| 73 | current_menu = current_menu->parent; | ||
| 74 | } | ||
| 75 | |||
| 76 | struct expr *menu_check_dep(struct expr *e) | ||
| 77 | { | ||
| 78 | if (!e) | ||
| 79 | return e; | ||
| 80 | |||
| 81 | switch (e->type) { | ||
| 82 | case E_NOT: | ||
| 83 | e->left.expr = menu_check_dep(e->left.expr); | ||
| 84 | break; | ||
| 85 | case E_OR: | ||
| 86 | case E_AND: | ||
| 87 | e->left.expr = menu_check_dep(e->left.expr); | ||
| 88 | e->right.expr = menu_check_dep(e->right.expr); | ||
| 89 | break; | ||
| 90 | case E_SYMBOL: | ||
| 91 | /* change 'm' into 'm' && MODULES */ | ||
| 92 | if (e->left.sym == &symbol_mod) | ||
| 93 | return expr_alloc_and(e, expr_alloc_symbol(modules_sym)); | ||
| 94 | break; | ||
| 95 | default: | ||
| 96 | break; | ||
| 97 | } | ||
| 98 | return e; | ||
| 99 | } | ||
| 100 | |||
| 101 | void menu_add_dep(struct expr *dep) | ||
| 102 | { | ||
| 103 | current_entry->dep = expr_alloc_and(current_entry->dep, menu_check_dep(dep)); | ||
| 104 | } | ||
| 105 | |||
| 106 | void menu_set_type(int type) | ||
| 107 | { | ||
| 108 | struct symbol *sym = current_entry->sym; | ||
| 109 | |||
| 110 | if (sym->type == type) | ||
| 111 | return; | ||
| 112 | if (sym->type == S_UNKNOWN) { | ||
| 113 | sym->type = type; | ||
| 114 | return; | ||
| 115 | } | ||
| 116 | menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n", | ||
| 117 | sym->name ? sym->name : "<choice>", | ||
| 118 | sym_type_name(sym->type), sym_type_name(type)); | ||
| 119 | } | ||
| 120 | |||
| 121 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) | ||
| 122 | { | ||
| 123 | struct property *prop = prop_alloc(type, current_entry->sym); | ||
| 124 | |||
| 125 | prop->menu = current_entry; | ||
| 126 | prop->text = prompt; | ||
| 127 | prop->expr = expr; | ||
| 128 | prop->visible.expr = menu_check_dep(dep); | ||
| 129 | |||
| 130 | if (prompt) { | ||
| 131 | if (current_entry->prompt) | ||
| 132 | menu_warn(current_entry, "prompt redefined\n"); | ||
| 133 | current_entry->prompt = prop; | ||
| 134 | } | ||
| 135 | |||
| 136 | return prop; | ||
| 137 | } | ||
| 138 | |||
| 139 | void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep) | ||
| 140 | { | ||
| 141 | menu_add_prop(type, prompt, NULL, dep); | ||
| 142 | } | ||
| 143 | |||
| 144 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) | ||
| 145 | { | ||
| 146 | menu_add_prop(type, NULL, expr, dep); | ||
| 147 | } | ||
| 148 | |||
| 149 | void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) | ||
| 150 | { | ||
| 151 | menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); | ||
| 152 | } | ||
| 153 | |||
| 154 | void sym_check_prop(struct symbol *sym) | ||
| 155 | { | ||
| 156 | struct property *prop; | ||
| 157 | struct symbol *sym2; | ||
| 158 | for (prop = sym->prop; prop; prop = prop->next) { | ||
| 159 | switch (prop->type) { | ||
| 160 | case P_DEFAULT: | ||
| 161 | if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) && | ||
| 162 | prop->expr->type != E_SYMBOL) | ||
| 163 | prop_warn(prop, | ||
| 164 | "default for config symbol '%'" | ||
| 165 | " must be a single symbol", sym->name); | ||
| 166 | break; | ||
| 167 | case P_SELECT: | ||
| 168 | sym2 = prop_get_symbol(prop); | ||
| 169 | if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE) | ||
| 170 | prop_warn(prop, | ||
| 171 | "config symbol '%s' uses select, but is " | ||
| 172 | "not boolean or tristate", sym->name); | ||
| 173 | else if (sym2->type == S_UNKNOWN) | ||
| 174 | prop_warn(prop, | ||
| 175 | "'select' used by config symbol '%s' " | ||
| 176 | "refer to undefined symbol '%s'", | ||
| 177 | sym->name, sym2->name); | ||
| 178 | else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE) | ||
| 179 | prop_warn(prop, | ||
| 180 | "'%s' has wrong type. 'select' only " | ||
| 181 | "accept arguments of boolean and " | ||
| 182 | "tristate type", sym2->name); | ||
| 183 | break; | ||
| 184 | case P_RANGE: | ||
| 185 | if (sym->type != S_INT && sym->type != S_HEX) | ||
| 186 | prop_warn(prop, "range is only allowed " | ||
| 187 | "for int or hex symbols"); | ||
| 188 | if (!sym_string_valid(sym, prop->expr->left.sym->name) || | ||
| 189 | !sym_string_valid(sym, prop->expr->right.sym->name)) | ||
| 190 | prop_warn(prop, "range is invalid"); | ||
| 191 | break; | ||
| 192 | default: | ||
| 193 | ; | ||
| 194 | } | ||
| 195 | } | ||
| 196 | } | ||
| 197 | |||
| 198 | void menu_finalize(struct menu *parent) | ||
| 199 | { | ||
| 200 | struct menu *menu, *last_menu; | ||
| 201 | struct symbol *sym; | ||
| 202 | struct property *prop; | ||
| 203 | struct expr *parentdep, *basedep, *dep, *dep2, **ep; | ||
| 204 | |||
| 205 | sym = parent->sym; | ||
| 206 | if (parent->list) { | ||
| 207 | if (sym && sym_is_choice(sym)) { | ||
| 208 | /* find the first choice value and find out choice type */ | ||
| 209 | for (menu = parent->list; menu; menu = menu->next) { | ||
| 210 | if (menu->sym) { | ||
| 211 | current_entry = parent; | ||
| 212 | menu_set_type(menu->sym->type); | ||
| 213 | current_entry = menu; | ||
| 214 | menu_set_type(sym->type); | ||
| 215 | break; | ||
| 216 | } | ||
| 217 | } | ||
| 218 | parentdep = expr_alloc_symbol(sym); | ||
| 219 | } else if (parent->prompt) | ||
| 220 | parentdep = parent->prompt->visible.expr; | ||
| 221 | else | ||
| 222 | parentdep = parent->dep; | ||
| 223 | |||
| 224 | for (menu = parent->list; menu; menu = menu->next) { | ||
| 225 | basedep = expr_transform(menu->dep); | ||
| 226 | basedep = expr_alloc_and(expr_copy(parentdep), basedep); | ||
| 227 | basedep = expr_eliminate_dups(basedep); | ||
| 228 | menu->dep = basedep; | ||
| 229 | if (menu->sym) | ||
| 230 | prop = menu->sym->prop; | ||
| 231 | else | ||
| 232 | prop = menu->prompt; | ||
| 233 | for (; prop; prop = prop->next) { | ||
| 234 | if (prop->menu != menu) | ||
| 235 | continue; | ||
| 236 | dep = expr_transform(prop->visible.expr); | ||
| 237 | dep = expr_alloc_and(expr_copy(basedep), dep); | ||
| 238 | dep = expr_eliminate_dups(dep); | ||
| 239 | if (menu->sym && menu->sym->type != S_TRISTATE) | ||
| 240 | dep = expr_trans_bool(dep); | ||
| 241 | prop->visible.expr = dep; | ||
| 242 | if (prop->type == P_SELECT) { | ||
| 243 | struct symbol *es = prop_get_symbol(prop); | ||
| 244 | es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr, | ||
| 245 | expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); | ||
| 246 | } | ||
| 247 | } | ||
| 248 | } | ||
| 249 | for (menu = parent->list; menu; menu = menu->next) | ||
| 250 | menu_finalize(menu); | ||
| 251 | } else if (sym) { | ||
| 252 | basedep = parent->prompt ? parent->prompt->visible.expr : NULL; | ||
| 253 | basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no); | ||
| 254 | basedep = expr_eliminate_dups(expr_transform(basedep)); | ||
| 255 | last_menu = NULL; | ||
| 256 | for (menu = parent->next; menu; menu = menu->next) { | ||
| 257 | dep = menu->prompt ? menu->prompt->visible.expr : menu->dep; | ||
| 258 | if (!expr_contains_symbol(dep, sym)) | ||
| 259 | break; | ||
| 260 | if (expr_depends_symbol(dep, sym)) | ||
| 261 | goto next; | ||
| 262 | dep = expr_trans_compare(dep, E_UNEQUAL, &symbol_no); | ||
| 263 | dep = expr_eliminate_dups(expr_transform(dep)); | ||
| 264 | dep2 = expr_copy(basedep); | ||
| 265 | expr_eliminate_eq(&dep, &dep2); | ||
| 266 | expr_free(dep); | ||
| 267 | if (!expr_is_yes(dep2)) { | ||
| 268 | expr_free(dep2); | ||
| 269 | break; | ||
| 270 | } | ||
| 271 | expr_free(dep2); | ||
| 272 | next: | ||
| 273 | menu_finalize(menu); | ||
| 274 | menu->parent = parent; | ||
| 275 | last_menu = menu; | ||
| 276 | } | ||
| 277 | if (last_menu) { | ||
| 278 | parent->list = parent->next; | ||
| 279 | parent->next = last_menu->next; | ||
| 280 | last_menu->next = NULL; | ||
| 281 | } | ||
| 282 | } | ||
| 283 | for (menu = parent->list; menu; menu = menu->next) { | ||
| 284 | if (sym && sym_is_choice(sym) && menu->sym) { | ||
| 285 | menu->sym->flags |= SYMBOL_CHOICEVAL; | ||
| 286 | if (!menu->prompt) | ||
| 287 | menu_warn(menu, "choice value must have a prompt"); | ||
| 288 | for (prop = menu->sym->prop; prop; prop = prop->next) { | ||
| 289 | if (prop->type == P_PROMPT && prop->menu != menu) { | ||
| 290 | prop_warn(prop, "choice values " | ||
| 291 | "currently only support a " | ||
| 292 | "single prompt"); | ||
| 293 | } | ||
| 294 | if (prop->type == P_DEFAULT) | ||
| 295 | prop_warn(prop, "defaults for choice " | ||
| 296 | "values not supported"); | ||
| 297 | } | ||
| 298 | current_entry = menu; | ||
| 299 | menu_set_type(sym->type); | ||
| 300 | menu_add_symbol(P_CHOICE, sym, NULL); | ||
| 301 | prop = sym_get_choice_prop(sym); | ||
| 302 | for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr) | ||
| 303 | ; | ||
| 304 | *ep = expr_alloc_one(E_CHOICE, NULL); | ||
| 305 | (*ep)->right.sym = menu->sym; | ||
| 306 | } | ||
| 307 | if (menu->list && (!menu->prompt || !menu->prompt->text)) { | ||
| 308 | for (last_menu = menu->list; ; last_menu = last_menu->next) { | ||
| 309 | last_menu->parent = parent; | ||
| 310 | if (!last_menu->next) | ||
| 311 | break; | ||
| 312 | } | ||
| 313 | last_menu->next = menu->next; | ||
| 314 | menu->next = menu->list; | ||
| 315 | menu->list = NULL; | ||
| 316 | } | ||
| 317 | } | ||
| 318 | |||
| 319 | if (sym && !(sym->flags & SYMBOL_WARNED)) { | ||
| 320 | if (sym->type == S_UNKNOWN) | ||
| 321 | menu_warn(parent, "config symbol defined " | ||
| 322 | "without type\n"); | ||
| 323 | |||
| 324 | if (sym_is_choice(sym) && !parent->prompt) | ||
| 325 | menu_warn(parent, "choice must have a prompt\n"); | ||
| 326 | |||
| 327 | /* Check properties connected to this symbol */ | ||
| 328 | sym_check_prop(sym); | ||
| 329 | sym->flags |= SYMBOL_WARNED; | ||
| 330 | } | ||
| 331 | |||
| 332 | if (sym && !sym_is_optional(sym) && parent->prompt) { | ||
| 333 | sym->rev_dep.expr = expr_alloc_or(sym->rev_dep.expr, | ||
| 334 | expr_alloc_and(parent->prompt->visible.expr, | ||
| 335 | expr_alloc_symbol(&symbol_mod))); | ||
| 336 | } | ||
| 337 | } | ||
| 338 | |||
| 339 | bool menu_is_visible(struct menu *menu) | ||
| 340 | { | ||
| 341 | struct menu *child; | ||
| 342 | struct symbol *sym; | ||
| 343 | tristate visible; | ||
| 344 | |||
| 345 | if (!menu->prompt) | ||
| 346 | return false; | ||
| 347 | sym = menu->sym; | ||
| 348 | if (sym) { | ||
| 349 | sym_calc_value(sym); | ||
| 350 | visible = menu->prompt->visible.tri; | ||
| 351 | } else | ||
| 352 | visible = menu->prompt->visible.tri = expr_calc_value(menu->prompt->visible.expr); | ||
| 353 | |||
| 354 | if (visible != no) | ||
| 355 | return true; | ||
| 356 | if (!sym || sym_get_tristate_value(menu->sym) == no) | ||
| 357 | return false; | ||
| 358 | |||
| 359 | for (child = menu->list; child; child = child->next) | ||
| 360 | if (menu_is_visible(child)) | ||
| 361 | return true; | ||
| 362 | return false; | ||
| 363 | } | ||
| 364 | |||
| 365 | const char *menu_get_prompt(struct menu *menu) | ||
| 366 | { | ||
| 367 | if (menu->prompt) | ||
| 368 | return menu->prompt->text; | ||
| 369 | else if (menu->sym) | ||
| 370 | return menu->sym->name; | ||
| 371 | return NULL; | ||
| 372 | } | ||
| 373 | |||
| 374 | struct menu *menu_get_root_menu(struct menu *menu) | ||
| 375 | { | ||
| 376 | return &rootmenu; | ||
| 377 | } | ||
| 378 | |||
| 379 | struct menu *menu_get_parent_menu(struct menu *menu) | ||
| 380 | { | ||
| 381 | enum prop_type type; | ||
| 382 | |||
| 383 | for (; menu != &rootmenu; menu = menu->parent) { | ||
| 384 | type = menu->prompt ? menu->prompt->type : 0; | ||
| 385 | if (type == P_MENU) | ||
| 386 | break; | ||
| 387 | } | ||
| 388 | return menu; | ||
| 389 | } | ||
| 390 | |||
diff --git a/scripts/kconfig/qconf.cc b/scripts/kconfig/qconf.cc new file mode 100644 index 000000000000..0cdbf9dbbd51 --- /dev/null +++ b/scripts/kconfig/qconf.cc | |||
| @@ -0,0 +1,1407 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <qapplication.h> | ||
| 7 | #include <qmainwindow.h> | ||
| 8 | #include <qtoolbar.h> | ||
| 9 | #include <qvbox.h> | ||
| 10 | #include <qsplitter.h> | ||
| 11 | #include <qlistview.h> | ||
| 12 | #include <qtextview.h> | ||
| 13 | #include <qlineedit.h> | ||
| 14 | #include <qmenubar.h> | ||
| 15 | #include <qmessagebox.h> | ||
| 16 | #include <qaction.h> | ||
| 17 | #include <qheader.h> | ||
| 18 | #include <qfiledialog.h> | ||
| 19 | #include <qregexp.h> | ||
| 20 | |||
| 21 | #include <stdlib.h> | ||
| 22 | |||
| 23 | #include "lkc.h" | ||
| 24 | #include "qconf.h" | ||
| 25 | |||
| 26 | #include "qconf.moc" | ||
| 27 | #include "images.c" | ||
| 28 | |||
| 29 | static QApplication *configApp; | ||
| 30 | |||
| 31 | ConfigSettings::ConfigSettings() | ||
| 32 | : showAll(false), showName(false), showRange(false), showData(false) | ||
| 33 | { | ||
| 34 | } | ||
| 35 | |||
| 36 | #if QT_VERSION >= 300 | ||
| 37 | /** | ||
| 38 | * Reads the list column settings from the application settings. | ||
| 39 | */ | ||
| 40 | void ConfigSettings::readListSettings() | ||
| 41 | { | ||
| 42 | showAll = readBoolEntry("/kconfig/qconf/showAll", false); | ||
| 43 | showName = readBoolEntry("/kconfig/qconf/showName", false); | ||
| 44 | showRange = readBoolEntry("/kconfig/qconf/showRange", false); | ||
| 45 | showData = readBoolEntry("/kconfig/qconf/showData", false); | ||
| 46 | } | ||
| 47 | |||
| 48 | /** | ||
| 49 | * Reads a list of integer values from the application settings. | ||
| 50 | */ | ||
| 51 | QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok) | ||
| 52 | { | ||
| 53 | QValueList<int> result; | ||
| 54 | QStringList entryList = readListEntry(key, ok); | ||
| 55 | if (ok) { | ||
| 56 | QStringList::Iterator it; | ||
| 57 | for (it = entryList.begin(); it != entryList.end(); ++it) | ||
| 58 | result.push_back((*it).toInt()); | ||
| 59 | } | ||
| 60 | |||
| 61 | return result; | ||
| 62 | } | ||
| 63 | |||
| 64 | /** | ||
| 65 | * Writes a list of integer values to the application settings. | ||
| 66 | */ | ||
| 67 | bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value) | ||
| 68 | { | ||
| 69 | QStringList stringList; | ||
| 70 | QValueList<int>::ConstIterator it; | ||
| 71 | |||
| 72 | for (it = value.begin(); it != value.end(); ++it) | ||
| 73 | stringList.push_back(QString::number(*it)); | ||
| 74 | return writeEntry(key, stringList); | ||
| 75 | } | ||
| 76 | #endif | ||
| 77 | |||
| 78 | |||
| 79 | /* | ||
| 80 | * update all the children of a menu entry | ||
| 81 | * removes/adds the entries from the parent widget as necessary | ||
| 82 | * | ||
| 83 | * parent: either the menu list widget or a menu entry widget | ||
| 84 | * menu: entry to be updated | ||
| 85 | */ | ||
| 86 | template <class P> | ||
| 87 | void ConfigList::updateMenuList(P* parent, struct menu* menu) | ||
| 88 | { | ||
| 89 | struct menu* child; | ||
| 90 | ConfigItem* item; | ||
| 91 | ConfigItem* last; | ||
| 92 | bool visible; | ||
| 93 | enum prop_type type; | ||
| 94 | |||
| 95 | if (!menu) { | ||
| 96 | while ((item = parent->firstChild())) | ||
| 97 | delete item; | ||
| 98 | return; | ||
| 99 | } | ||
| 100 | |||
| 101 | last = parent->firstChild(); | ||
| 102 | if (last && !last->goParent) | ||
| 103 | last = 0; | ||
| 104 | for (child = menu->list; child; child = child->next) { | ||
| 105 | item = last ? last->nextSibling() : parent->firstChild(); | ||
| 106 | type = child->prompt ? child->prompt->type : P_UNKNOWN; | ||
| 107 | |||
| 108 | switch (mode) { | ||
| 109 | case menuMode: | ||
| 110 | if (!(child->flags & MENU_ROOT)) | ||
| 111 | goto hide; | ||
| 112 | break; | ||
| 113 | case symbolMode: | ||
| 114 | if (child->flags & MENU_ROOT) | ||
| 115 | goto hide; | ||
| 116 | break; | ||
| 117 | default: | ||
| 118 | break; | ||
| 119 | } | ||
| 120 | |||
| 121 | visible = menu_is_visible(child); | ||
| 122 | if (showAll || visible) { | ||
| 123 | if (!item || item->menu != child) | ||
| 124 | item = new ConfigItem(parent, last, child, visible); | ||
| 125 | else | ||
| 126 | item->testUpdateMenu(visible); | ||
| 127 | |||
| 128 | if (mode == fullMode || mode == menuMode || type != P_MENU) | ||
| 129 | updateMenuList(item, child); | ||
| 130 | else | ||
| 131 | updateMenuList(item, 0); | ||
| 132 | last = item; | ||
| 133 | continue; | ||
| 134 | } | ||
| 135 | hide: | ||
| 136 | if (item && item->menu == child) { | ||
| 137 | last = parent->firstChild(); | ||
| 138 | if (last == item) | ||
| 139 | last = 0; | ||
| 140 | else while (last->nextSibling() != item) | ||
| 141 | last = last->nextSibling(); | ||
| 142 | delete item; | ||
| 143 | } | ||
| 144 | } | ||
| 145 | } | ||
| 146 | |||
| 147 | #if QT_VERSION >= 300 | ||
| 148 | /* | ||
| 149 | * set the new data | ||
| 150 | * TODO check the value | ||
| 151 | */ | ||
| 152 | void ConfigItem::okRename(int col) | ||
| 153 | { | ||
| 154 | Parent::okRename(col); | ||
| 155 | sym_set_string_value(menu->sym, text(dataColIdx).latin1()); | ||
| 156 | } | ||
| 157 | #endif | ||
| 158 | |||
| 159 | /* | ||
| 160 | * update the displayed of a menu entry | ||
| 161 | */ | ||
| 162 | void ConfigItem::updateMenu(void) | ||
| 163 | { | ||
| 164 | ConfigList* list; | ||
| 165 | struct symbol* sym; | ||
| 166 | struct property *prop; | ||
| 167 | QString prompt; | ||
| 168 | int type; | ||
| 169 | tristate expr; | ||
| 170 | |||
| 171 | list = listView(); | ||
| 172 | if (goParent) { | ||
| 173 | setPixmap(promptColIdx, list->menuBackPix); | ||
| 174 | prompt = ".."; | ||
| 175 | goto set_prompt; | ||
| 176 | } | ||
| 177 | |||
| 178 | sym = menu->sym; | ||
| 179 | prop = menu->prompt; | ||
| 180 | prompt = menu_get_prompt(menu); | ||
| 181 | |||
| 182 | if (prop) switch (prop->type) { | ||
| 183 | case P_MENU: | ||
| 184 | if (list->mode == singleMode || list->mode == symbolMode) { | ||
| 185 | /* a menuconfig entry is displayed differently | ||
| 186 | * depending whether it's at the view root or a child. | ||
| 187 | */ | ||
| 188 | if (sym && list->rootEntry == menu) | ||
| 189 | break; | ||
| 190 | setPixmap(promptColIdx, list->menuPix); | ||
| 191 | } else { | ||
| 192 | if (sym) | ||
| 193 | break; | ||
| 194 | setPixmap(promptColIdx, 0); | ||
| 195 | } | ||
| 196 | goto set_prompt; | ||
| 197 | case P_COMMENT: | ||
| 198 | setPixmap(promptColIdx, 0); | ||
| 199 | goto set_prompt; | ||
| 200 | default: | ||
| 201 | ; | ||
| 202 | } | ||
| 203 | if (!sym) | ||
| 204 | goto set_prompt; | ||
| 205 | |||
| 206 | setText(nameColIdx, sym->name); | ||
| 207 | |||
| 208 | type = sym_get_type(sym); | ||
| 209 | switch (type) { | ||
| 210 | case S_BOOLEAN: | ||
| 211 | case S_TRISTATE: | ||
| 212 | char ch; | ||
| 213 | |||
| 214 | if (!sym_is_changable(sym) && !list->showAll) { | ||
| 215 | setPixmap(promptColIdx, 0); | ||
| 216 | setText(noColIdx, 0); | ||
| 217 | setText(modColIdx, 0); | ||
| 218 | setText(yesColIdx, 0); | ||
| 219 | break; | ||
| 220 | } | ||
| 221 | expr = sym_get_tristate_value(sym); | ||
| 222 | switch (expr) { | ||
| 223 | case yes: | ||
| 224 | if (sym_is_choice_value(sym) && type == S_BOOLEAN) | ||
| 225 | setPixmap(promptColIdx, list->choiceYesPix); | ||
| 226 | else | ||
| 227 | setPixmap(promptColIdx, list->symbolYesPix); | ||
| 228 | setText(yesColIdx, "Y"); | ||
| 229 | ch = 'Y'; | ||
| 230 | break; | ||
| 231 | case mod: | ||
| 232 | setPixmap(promptColIdx, list->symbolModPix); | ||
| 233 | setText(modColIdx, "M"); | ||
| 234 | ch = 'M'; | ||
| 235 | break; | ||
| 236 | default: | ||
| 237 | if (sym_is_choice_value(sym) && type == S_BOOLEAN) | ||
| 238 | setPixmap(promptColIdx, list->choiceNoPix); | ||
| 239 | else | ||
| 240 | setPixmap(promptColIdx, list->symbolNoPix); | ||
| 241 | setText(noColIdx, "N"); | ||
| 242 | ch = 'N'; | ||
| 243 | break; | ||
| 244 | } | ||
| 245 | if (expr != no) | ||
| 246 | setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0); | ||
| 247 | if (expr != mod) | ||
| 248 | setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0); | ||
| 249 | if (expr != yes) | ||
| 250 | setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0); | ||
| 251 | |||
| 252 | setText(dataColIdx, QChar(ch)); | ||
| 253 | break; | ||
| 254 | case S_INT: | ||
| 255 | case S_HEX: | ||
| 256 | case S_STRING: | ||
| 257 | const char* data; | ||
| 258 | |||
| 259 | data = sym_get_string_value(sym); | ||
| 260 | #if QT_VERSION >= 300 | ||
| 261 | int i = list->mapIdx(dataColIdx); | ||
| 262 | if (i >= 0) | ||
| 263 | setRenameEnabled(i, TRUE); | ||
| 264 | #endif | ||
| 265 | setText(dataColIdx, data); | ||
| 266 | if (type == S_STRING) | ||
| 267 | prompt.sprintf("%s: %s", prompt.latin1(), data); | ||
| 268 | else | ||
| 269 | prompt.sprintf("(%s) %s", data, prompt.latin1()); | ||
| 270 | break; | ||
| 271 | } | ||
| 272 | if (!sym_has_value(sym) && visible) | ||
| 273 | prompt += " (NEW)"; | ||
| 274 | set_prompt: | ||
| 275 | setText(promptColIdx, prompt); | ||
| 276 | } | ||
| 277 | |||
| 278 | void ConfigItem::testUpdateMenu(bool v) | ||
| 279 | { | ||
| 280 | ConfigItem* i; | ||
| 281 | |||
| 282 | visible = v; | ||
| 283 | if (!menu) | ||
| 284 | return; | ||
| 285 | |||
| 286 | sym_calc_value(menu->sym); | ||
| 287 | if (menu->flags & MENU_CHANGED) { | ||
| 288 | /* the menu entry changed, so update all list items */ | ||
| 289 | menu->flags &= ~MENU_CHANGED; | ||
| 290 | for (i = (ConfigItem*)menu->data; i; i = i->nextItem) | ||
| 291 | i->updateMenu(); | ||
| 292 | } else if (listView()->updateAll) | ||
| 293 | updateMenu(); | ||
| 294 | } | ||
| 295 | |||
| 296 | void ConfigItem::paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align) | ||
| 297 | { | ||
| 298 | ConfigList* list = listView(); | ||
| 299 | |||
| 300 | if (visible) { | ||
| 301 | if (isSelected() && !list->hasFocus() && list->mode == menuMode) | ||
| 302 | Parent::paintCell(p, list->inactivedColorGroup, column, width, align); | ||
| 303 | else | ||
| 304 | Parent::paintCell(p, cg, column, width, align); | ||
| 305 | } else | ||
| 306 | Parent::paintCell(p, list->disabledColorGroup, column, width, align); | ||
| 307 | } | ||
| 308 | |||
| 309 | /* | ||
| 310 | * construct a menu entry | ||
| 311 | */ | ||
| 312 | void ConfigItem::init(void) | ||
| 313 | { | ||
| 314 | if (menu) { | ||
| 315 | ConfigList* list = listView(); | ||
| 316 | nextItem = (ConfigItem*)menu->data; | ||
| 317 | menu->data = this; | ||
| 318 | |||
| 319 | if (list->mode != fullMode) | ||
| 320 | setOpen(TRUE); | ||
| 321 | sym_calc_value(menu->sym); | ||
| 322 | } | ||
| 323 | updateMenu(); | ||
| 324 | } | ||
| 325 | |||
| 326 | /* | ||
| 327 | * destruct a menu entry | ||
| 328 | */ | ||
| 329 | ConfigItem::~ConfigItem(void) | ||
| 330 | { | ||
| 331 | if (menu) { | ||
| 332 | ConfigItem** ip = (ConfigItem**)&menu->data; | ||
| 333 | for (; *ip; ip = &(*ip)->nextItem) { | ||
| 334 | if (*ip == this) { | ||
| 335 | *ip = nextItem; | ||
| 336 | break; | ||
| 337 | } | ||
| 338 | } | ||
| 339 | } | ||
| 340 | } | ||
| 341 | |||
| 342 | void ConfigLineEdit::show(ConfigItem* i) | ||
| 343 | { | ||
| 344 | item = i; | ||
| 345 | if (sym_get_string_value(item->menu->sym)) | ||
| 346 | setText(sym_get_string_value(item->menu->sym)); | ||
| 347 | else | ||
| 348 | setText(0); | ||
| 349 | Parent::show(); | ||
| 350 | setFocus(); | ||
| 351 | } | ||
| 352 | |||
| 353 | void ConfigLineEdit::keyPressEvent(QKeyEvent* e) | ||
| 354 | { | ||
| 355 | switch (e->key()) { | ||
| 356 | case Key_Escape: | ||
| 357 | break; | ||
| 358 | case Key_Return: | ||
| 359 | case Key_Enter: | ||
| 360 | sym_set_string_value(item->menu->sym, text().latin1()); | ||
| 361 | parent()->updateList(item); | ||
| 362 | break; | ||
| 363 | default: | ||
| 364 | Parent::keyPressEvent(e); | ||
| 365 | return; | ||
| 366 | } | ||
| 367 | e->accept(); | ||
| 368 | parent()->list->setFocus(); | ||
| 369 | hide(); | ||
| 370 | } | ||
| 371 | |||
| 372 | ConfigList::ConfigList(ConfigView* p, ConfigMainWindow* cv, ConfigSettings* configSettings) | ||
| 373 | : Parent(p), cview(cv), | ||
| 374 | updateAll(false), | ||
| 375 | symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), | ||
| 376 | choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), | ||
| 377 | menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), | ||
| 378 | showAll(false), showName(false), showRange(false), showData(false), | ||
| 379 | rootEntry(0) | ||
| 380 | { | ||
| 381 | int i; | ||
| 382 | |||
| 383 | setSorting(-1); | ||
| 384 | setRootIsDecorated(TRUE); | ||
| 385 | disabledColorGroup = palette().active(); | ||
| 386 | disabledColorGroup.setColor(QColorGroup::Text, palette().disabled().text()); | ||
| 387 | inactivedColorGroup = palette().active(); | ||
| 388 | inactivedColorGroup.setColor(QColorGroup::Highlight, palette().disabled().highlight()); | ||
| 389 | |||
| 390 | connect(this, SIGNAL(selectionChanged(void)), | ||
| 391 | SLOT(updateSelection(void))); | ||
| 392 | |||
| 393 | if (configSettings) { | ||
| 394 | showAll = configSettings->showAll; | ||
| 395 | showName = configSettings->showName; | ||
| 396 | showRange = configSettings->showRange; | ||
| 397 | showData = configSettings->showData; | ||
| 398 | } | ||
| 399 | |||
| 400 | for (i = 0; i < colNr; i++) | ||
| 401 | colMap[i] = colRevMap[i] = -1; | ||
| 402 | addColumn(promptColIdx, "Option"); | ||
| 403 | |||
| 404 | reinit(); | ||
| 405 | } | ||
| 406 | |||
| 407 | void ConfigList::reinit(void) | ||
| 408 | { | ||
| 409 | removeColumn(dataColIdx); | ||
| 410 | removeColumn(yesColIdx); | ||
| 411 | removeColumn(modColIdx); | ||
| 412 | removeColumn(noColIdx); | ||
| 413 | removeColumn(nameColIdx); | ||
| 414 | |||
| 415 | if (showName) | ||
| 416 | addColumn(nameColIdx, "Name"); | ||
| 417 | if (showRange) { | ||
| 418 | addColumn(noColIdx, "N"); | ||
| 419 | addColumn(modColIdx, "M"); | ||
| 420 | addColumn(yesColIdx, "Y"); | ||
| 421 | } | ||
| 422 | if (showData) | ||
| 423 | addColumn(dataColIdx, "Value"); | ||
| 424 | |||
| 425 | updateListAll(); | ||
| 426 | } | ||
| 427 | |||
| 428 | void ConfigList::updateSelection(void) | ||
| 429 | { | ||
| 430 | struct menu *menu; | ||
| 431 | enum prop_type type; | ||
| 432 | |||
| 433 | ConfigItem* item = (ConfigItem*)selectedItem(); | ||
| 434 | if (!item) | ||
| 435 | return; | ||
| 436 | |||
| 437 | cview->setHelp(item); | ||
| 438 | |||
| 439 | menu = item->menu; | ||
| 440 | if (!menu) | ||
| 441 | return; | ||
| 442 | type = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
| 443 | if (mode == menuMode && type == P_MENU) | ||
| 444 | emit menuSelected(menu); | ||
| 445 | } | ||
| 446 | |||
| 447 | void ConfigList::updateList(ConfigItem* item) | ||
| 448 | { | ||
| 449 | ConfigItem* last = 0; | ||
| 450 | |||
| 451 | if (!rootEntry) | ||
| 452 | goto update; | ||
| 453 | |||
| 454 | if (rootEntry != &rootmenu && (mode == singleMode || | ||
| 455 | (mode == symbolMode && rootEntry->parent != &rootmenu))) { | ||
| 456 | item = firstChild(); | ||
| 457 | if (!item) | ||
| 458 | item = new ConfigItem(this, 0, true); | ||
| 459 | last = item; | ||
| 460 | } | ||
| 461 | if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) && | ||
| 462 | rootEntry->sym && rootEntry->prompt) { | ||
| 463 | item = last ? last->nextSibling() : firstChild(); | ||
| 464 | if (!item) | ||
| 465 | item = new ConfigItem(this, last, rootEntry, true); | ||
| 466 | else | ||
| 467 | item->testUpdateMenu(true); | ||
| 468 | |||
| 469 | updateMenuList(item, rootEntry); | ||
| 470 | triggerUpdate(); | ||
| 471 | return; | ||
| 472 | } | ||
| 473 | update: | ||
| 474 | updateMenuList(this, rootEntry); | ||
| 475 | triggerUpdate(); | ||
| 476 | } | ||
| 477 | |||
| 478 | void ConfigList::setAllOpen(bool open) | ||
| 479 | { | ||
| 480 | QListViewItemIterator it(this); | ||
| 481 | |||
| 482 | for (; it.current(); it++) | ||
| 483 | it.current()->setOpen(open); | ||
| 484 | } | ||
| 485 | |||
| 486 | void ConfigList::setValue(ConfigItem* item, tristate val) | ||
| 487 | { | ||
| 488 | struct symbol* sym; | ||
| 489 | int type; | ||
| 490 | tristate oldval; | ||
| 491 | |||
| 492 | sym = item->menu ? item->menu->sym : 0; | ||
| 493 | if (!sym) | ||
| 494 | return; | ||
| 495 | |||
| 496 | type = sym_get_type(sym); | ||
| 497 | switch (type) { | ||
| 498 | case S_BOOLEAN: | ||
| 499 | case S_TRISTATE: | ||
| 500 | oldval = sym_get_tristate_value(sym); | ||
| 501 | |||
| 502 | if (!sym_set_tristate_value(sym, val)) | ||
| 503 | return; | ||
| 504 | if (oldval == no && item->menu->list) | ||
| 505 | item->setOpen(TRUE); | ||
| 506 | parent()->updateList(item); | ||
| 507 | break; | ||
| 508 | } | ||
| 509 | } | ||
| 510 | |||
| 511 | void ConfigList::changeValue(ConfigItem* item) | ||
| 512 | { | ||
| 513 | struct symbol* sym; | ||
| 514 | struct menu* menu; | ||
| 515 | int type, oldexpr, newexpr; | ||
| 516 | |||
| 517 | menu = item->menu; | ||
| 518 | if (!menu) | ||
| 519 | return; | ||
| 520 | sym = menu->sym; | ||
| 521 | if (!sym) { | ||
| 522 | if (item->menu->list) | ||
| 523 | item->setOpen(!item->isOpen()); | ||
| 524 | return; | ||
| 525 | } | ||
| 526 | |||
| 527 | type = sym_get_type(sym); | ||
| 528 | switch (type) { | ||
| 529 | case S_BOOLEAN: | ||
| 530 | case S_TRISTATE: | ||
| 531 | oldexpr = sym_get_tristate_value(sym); | ||
| 532 | newexpr = sym_toggle_tristate_value(sym); | ||
| 533 | if (item->menu->list) { | ||
| 534 | if (oldexpr == newexpr) | ||
| 535 | item->setOpen(!item->isOpen()); | ||
| 536 | else if (oldexpr == no) | ||
| 537 | item->setOpen(TRUE); | ||
| 538 | } | ||
| 539 | if (oldexpr != newexpr) | ||
| 540 | parent()->updateList(item); | ||
| 541 | break; | ||
| 542 | case S_INT: | ||
| 543 | case S_HEX: | ||
| 544 | case S_STRING: | ||
| 545 | #if QT_VERSION >= 300 | ||
| 546 | if (colMap[dataColIdx] >= 0) | ||
| 547 | item->startRename(colMap[dataColIdx]); | ||
| 548 | else | ||
| 549 | #endif | ||
| 550 | parent()->lineEdit->show(item); | ||
| 551 | break; | ||
| 552 | } | ||
| 553 | } | ||
| 554 | |||
| 555 | void ConfigList::setRootMenu(struct menu *menu) | ||
| 556 | { | ||
| 557 | enum prop_type type; | ||
| 558 | |||
| 559 | if (rootEntry == menu) | ||
| 560 | return; | ||
| 561 | type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
| 562 | if (type != P_MENU) | ||
| 563 | return; | ||
| 564 | updateMenuList(this, 0); | ||
| 565 | rootEntry = menu; | ||
| 566 | updateListAll(); | ||
| 567 | setSelected(currentItem(), hasFocus()); | ||
| 568 | } | ||
| 569 | |||
| 570 | void ConfigList::setParentMenu(void) | ||
| 571 | { | ||
| 572 | ConfigItem* item; | ||
| 573 | struct menu *oldroot; | ||
| 574 | |||
| 575 | oldroot = rootEntry; | ||
| 576 | if (rootEntry == &rootmenu) | ||
| 577 | return; | ||
| 578 | setRootMenu(menu_get_parent_menu(rootEntry->parent)); | ||
| 579 | |||
| 580 | QListViewItemIterator it(this); | ||
| 581 | for (; (item = (ConfigItem*)it.current()); it++) { | ||
| 582 | if (item->menu == oldroot) { | ||
| 583 | setCurrentItem(item); | ||
| 584 | ensureItemVisible(item); | ||
| 585 | break; | ||
| 586 | } | ||
| 587 | } | ||
| 588 | } | ||
| 589 | |||
| 590 | void ConfigList::keyPressEvent(QKeyEvent* ev) | ||
| 591 | { | ||
| 592 | QListViewItem* i = currentItem(); | ||
| 593 | ConfigItem* item; | ||
| 594 | struct menu *menu; | ||
| 595 | enum prop_type type; | ||
| 596 | |||
| 597 | if (ev->key() == Key_Escape && mode != fullMode) { | ||
| 598 | emit parentSelected(); | ||
| 599 | ev->accept(); | ||
| 600 | return; | ||
| 601 | } | ||
| 602 | |||
| 603 | if (!i) { | ||
| 604 | Parent::keyPressEvent(ev); | ||
| 605 | return; | ||
| 606 | } | ||
| 607 | item = (ConfigItem*)i; | ||
| 608 | |||
| 609 | switch (ev->key()) { | ||
| 610 | case Key_Return: | ||
| 611 | case Key_Enter: | ||
| 612 | if (item->goParent) { | ||
| 613 | emit parentSelected(); | ||
| 614 | break; | ||
| 615 | } | ||
| 616 | menu = item->menu; | ||
| 617 | if (!menu) | ||
| 618 | break; | ||
| 619 | type = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
| 620 | if (type == P_MENU && rootEntry != menu && | ||
| 621 | mode != fullMode && mode != menuMode) { | ||
| 622 | emit menuSelected(menu); | ||
| 623 | break; | ||
| 624 | } | ||
| 625 | case Key_Space: | ||
| 626 | changeValue(item); | ||
| 627 | break; | ||
| 628 | case Key_N: | ||
| 629 | setValue(item, no); | ||
| 630 | break; | ||
| 631 | case Key_M: | ||
| 632 | setValue(item, mod); | ||
| 633 | break; | ||
| 634 | case Key_Y: | ||
| 635 | setValue(item, yes); | ||
| 636 | break; | ||
| 637 | default: | ||
| 638 | Parent::keyPressEvent(ev); | ||
| 639 | return; | ||
| 640 | } | ||
| 641 | ev->accept(); | ||
| 642 | } | ||
| 643 | |||
| 644 | void ConfigList::contentsMousePressEvent(QMouseEvent* e) | ||
| 645 | { | ||
| 646 | //QPoint p(contentsToViewport(e->pos())); | ||
| 647 | //printf("contentsMousePressEvent: %d,%d\n", p.x(), p.y()); | ||
| 648 | Parent::contentsMousePressEvent(e); | ||
| 649 | } | ||
| 650 | |||
| 651 | void ConfigList::contentsMouseReleaseEvent(QMouseEvent* e) | ||
| 652 | { | ||
| 653 | QPoint p(contentsToViewport(e->pos())); | ||
| 654 | ConfigItem* item = (ConfigItem*)itemAt(p); | ||
| 655 | struct menu *menu; | ||
| 656 | enum prop_type ptype; | ||
| 657 | const QPixmap* pm; | ||
| 658 | int idx, x; | ||
| 659 | |||
| 660 | if (!item) | ||
| 661 | goto skip; | ||
| 662 | |||
| 663 | menu = item->menu; | ||
| 664 | x = header()->offset() + p.x(); | ||
| 665 | idx = colRevMap[header()->sectionAt(x)]; | ||
| 666 | switch (idx) { | ||
| 667 | case promptColIdx: | ||
| 668 | pm = item->pixmap(promptColIdx); | ||
| 669 | if (pm) { | ||
| 670 | int off = header()->sectionPos(0) + itemMargin() + | ||
| 671 | treeStepSize() * (item->depth() + (rootIsDecorated() ? 1 : 0)); | ||
| 672 | if (x >= off && x < off + pm->width()) { | ||
| 673 | if (item->goParent) { | ||
| 674 | emit parentSelected(); | ||
| 675 | break; | ||
| 676 | } else if (!menu) | ||
| 677 | break; | ||
| 678 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
| 679 | if (ptype == P_MENU && rootEntry != menu && | ||
| 680 | mode != fullMode && mode != menuMode) | ||
| 681 | emit menuSelected(menu); | ||
| 682 | else | ||
| 683 | changeValue(item); | ||
| 684 | } | ||
| 685 | } | ||
| 686 | break; | ||
| 687 | case noColIdx: | ||
| 688 | setValue(item, no); | ||
| 689 | break; | ||
| 690 | case modColIdx: | ||
| 691 | setValue(item, mod); | ||
| 692 | break; | ||
| 693 | case yesColIdx: | ||
| 694 | setValue(item, yes); | ||
| 695 | break; | ||
| 696 | case dataColIdx: | ||
| 697 | changeValue(item); | ||
| 698 | break; | ||
| 699 | } | ||
| 700 | |||
| 701 | skip: | ||
| 702 | //printf("contentsMouseReleaseEvent: %d,%d\n", p.x(), p.y()); | ||
| 703 | Parent::contentsMouseReleaseEvent(e); | ||
| 704 | } | ||
| 705 | |||
| 706 | void ConfigList::contentsMouseMoveEvent(QMouseEvent* e) | ||
| 707 | { | ||
| 708 | //QPoint p(contentsToViewport(e->pos())); | ||
| 709 | //printf("contentsMouseMoveEvent: %d,%d\n", p.x(), p.y()); | ||
| 710 | Parent::contentsMouseMoveEvent(e); | ||
| 711 | } | ||
| 712 | |||
| 713 | void ConfigList::contentsMouseDoubleClickEvent(QMouseEvent* e) | ||
| 714 | { | ||
| 715 | QPoint p(contentsToViewport(e->pos())); | ||
| 716 | ConfigItem* item = (ConfigItem*)itemAt(p); | ||
| 717 | struct menu *menu; | ||
| 718 | enum prop_type ptype; | ||
| 719 | |||
| 720 | if (!item) | ||
| 721 | goto skip; | ||
| 722 | if (item->goParent) { | ||
| 723 | emit parentSelected(); | ||
| 724 | goto skip; | ||
| 725 | } | ||
| 726 | menu = item->menu; | ||
| 727 | if (!menu) | ||
| 728 | goto skip; | ||
| 729 | ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; | ||
| 730 | if (ptype == P_MENU && (mode == singleMode || mode == symbolMode)) | ||
| 731 | emit menuSelected(menu); | ||
| 732 | else if (menu->sym) | ||
| 733 | changeValue(item); | ||
| 734 | |||
| 735 | skip: | ||
| 736 | //printf("contentsMouseDoubleClickEvent: %d,%d\n", p.x(), p.y()); | ||
| 737 | Parent::contentsMouseDoubleClickEvent(e); | ||
| 738 | } | ||
| 739 | |||
| 740 | void ConfigList::focusInEvent(QFocusEvent *e) | ||
| 741 | { | ||
| 742 | Parent::focusInEvent(e); | ||
| 743 | |||
| 744 | QListViewItem* item = currentItem(); | ||
| 745 | if (!item) | ||
| 746 | return; | ||
| 747 | |||
| 748 | setSelected(item, TRUE); | ||
| 749 | emit gotFocus(); | ||
| 750 | } | ||
| 751 | |||
| 752 | ConfigView* ConfigView::viewList; | ||
| 753 | |||
| 754 | ConfigView::ConfigView(QWidget* parent, ConfigMainWindow* cview, | ||
| 755 | ConfigSettings *configSettings) | ||
| 756 | : Parent(parent) | ||
| 757 | { | ||
| 758 | list = new ConfigList(this, cview, configSettings); | ||
| 759 | lineEdit = new ConfigLineEdit(this); | ||
| 760 | lineEdit->hide(); | ||
| 761 | |||
| 762 | this->nextView = viewList; | ||
| 763 | viewList = this; | ||
| 764 | } | ||
| 765 | |||
| 766 | ConfigView::~ConfigView(void) | ||
| 767 | { | ||
| 768 | ConfigView** vp; | ||
| 769 | |||
| 770 | for (vp = &viewList; *vp; vp = &(*vp)->nextView) { | ||
| 771 | if (*vp == this) { | ||
| 772 | *vp = nextView; | ||
| 773 | break; | ||
| 774 | } | ||
| 775 | } | ||
| 776 | } | ||
| 777 | |||
| 778 | void ConfigView::updateList(ConfigItem* item) | ||
| 779 | { | ||
| 780 | ConfigView* v; | ||
| 781 | |||
| 782 | for (v = viewList; v; v = v->nextView) | ||
| 783 | v->list->updateList(item); | ||
| 784 | } | ||
| 785 | |||
| 786 | void ConfigView::updateListAll(void) | ||
| 787 | { | ||
| 788 | ConfigView* v; | ||
| 789 | |||
| 790 | for (v = viewList; v; v = v->nextView) | ||
| 791 | v->list->updateListAll(); | ||
| 792 | } | ||
| 793 | |||
| 794 | /* | ||
| 795 | * Construct the complete config widget | ||
| 796 | */ | ||
| 797 | ConfigMainWindow::ConfigMainWindow(void) | ||
| 798 | { | ||
| 799 | QMenuBar* menu; | ||
| 800 | bool ok; | ||
| 801 | int x, y, width, height; | ||
| 802 | |||
| 803 | QWidget *d = configApp->desktop(); | ||
| 804 | |||
| 805 | ConfigSettings* configSettings = new ConfigSettings(); | ||
| 806 | #if QT_VERSION >= 300 | ||
| 807 | width = configSettings->readNumEntry("/kconfig/qconf/window width", d->width() - 64); | ||
| 808 | height = configSettings->readNumEntry("/kconfig/qconf/window height", d->height() - 64); | ||
| 809 | resize(width, height); | ||
| 810 | x = configSettings->readNumEntry("/kconfig/qconf/window x", 0, &ok); | ||
| 811 | if (ok) | ||
| 812 | y = configSettings->readNumEntry("/kconfig/qconf/window y", 0, &ok); | ||
| 813 | if (ok) | ||
| 814 | move(x, y); | ||
| 815 | showDebug = configSettings->readBoolEntry("/kconfig/qconf/showDebug", false); | ||
| 816 | |||
| 817 | // read list settings into configSettings, will be used later for ConfigList setup | ||
| 818 | configSettings->readListSettings(); | ||
| 819 | #else | ||
| 820 | width = d->width() - 64; | ||
| 821 | height = d->height() - 64; | ||
| 822 | resize(width, height); | ||
| 823 | showDebug = false; | ||
| 824 | #endif | ||
| 825 | |||
| 826 | split1 = new QSplitter(this); | ||
| 827 | split1->setOrientation(QSplitter::Horizontal); | ||
| 828 | setCentralWidget(split1); | ||
| 829 | |||
| 830 | menuView = new ConfigView(split1, this, configSettings); | ||
| 831 | menuList = menuView->list; | ||
| 832 | |||
| 833 | split2 = new QSplitter(split1); | ||
| 834 | split2->setOrientation(QSplitter::Vertical); | ||
| 835 | |||
| 836 | // create config tree | ||
| 837 | configView = new ConfigView(split2, this, configSettings); | ||
| 838 | configList = configView->list; | ||
| 839 | |||
| 840 | helpText = new QTextView(split2); | ||
| 841 | helpText->setTextFormat(Qt::RichText); | ||
| 842 | |||
| 843 | setTabOrder(configList, helpText); | ||
| 844 | configList->setFocus(); | ||
| 845 | |||
| 846 | menu = menuBar(); | ||
| 847 | toolBar = new QToolBar("Tools", this); | ||
| 848 | |||
| 849 | backAction = new QAction("Back", QPixmap(xpm_back), "Back", 0, this); | ||
| 850 | connect(backAction, SIGNAL(activated()), SLOT(goBack())); | ||
| 851 | backAction->setEnabled(FALSE); | ||
| 852 | QAction *quitAction = new QAction("Quit", "&Quit", CTRL+Key_Q, this); | ||
| 853 | connect(quitAction, SIGNAL(activated()), SLOT(close())); | ||
| 854 | QAction *loadAction = new QAction("Load", QPixmap(xpm_load), "&Load", CTRL+Key_L, this); | ||
| 855 | connect(loadAction, SIGNAL(activated()), SLOT(loadConfig())); | ||
| 856 | QAction *saveAction = new QAction("Save", QPixmap(xpm_save), "&Save", CTRL+Key_S, this); | ||
| 857 | connect(saveAction, SIGNAL(activated()), SLOT(saveConfig())); | ||
| 858 | QAction *saveAsAction = new QAction("Save As...", "Save &As...", 0, this); | ||
| 859 | connect(saveAsAction, SIGNAL(activated()), SLOT(saveConfigAs())); | ||
| 860 | QAction *singleViewAction = new QAction("Single View", QPixmap(xpm_single_view), "Split View", 0, this); | ||
| 861 | connect(singleViewAction, SIGNAL(activated()), SLOT(showSingleView())); | ||
| 862 | QAction *splitViewAction = new QAction("Split View", QPixmap(xpm_split_view), "Split View", 0, this); | ||
| 863 | connect(splitViewAction, SIGNAL(activated()), SLOT(showSplitView())); | ||
| 864 | QAction *fullViewAction = new QAction("Full View", QPixmap(xpm_tree_view), "Full View", 0, this); | ||
| 865 | connect(fullViewAction, SIGNAL(activated()), SLOT(showFullView())); | ||
| 866 | |||
| 867 | QAction *showNameAction = new QAction(NULL, "Show Name", 0, this); | ||
| 868 | showNameAction->setToggleAction(TRUE); | ||
| 869 | showNameAction->setOn(configList->showName); | ||
| 870 | connect(showNameAction, SIGNAL(toggled(bool)), SLOT(setShowName(bool))); | ||
| 871 | QAction *showRangeAction = new QAction(NULL, "Show Range", 0, this); | ||
| 872 | showRangeAction->setToggleAction(TRUE); | ||
| 873 | showRangeAction->setOn(configList->showRange); | ||
| 874 | connect(showRangeAction, SIGNAL(toggled(bool)), SLOT(setShowRange(bool))); | ||
| 875 | QAction *showDataAction = new QAction(NULL, "Show Data", 0, this); | ||
| 876 | showDataAction->setToggleAction(TRUE); | ||
| 877 | showDataAction->setOn(configList->showData); | ||
| 878 | connect(showDataAction, SIGNAL(toggled(bool)), SLOT(setShowData(bool))); | ||
| 879 | QAction *showAllAction = new QAction(NULL, "Show All Options", 0, this); | ||
| 880 | showAllAction->setToggleAction(TRUE); | ||
| 881 | showAllAction->setOn(configList->showAll); | ||
| 882 | connect(showAllAction, SIGNAL(toggled(bool)), SLOT(setShowAll(bool))); | ||
| 883 | QAction *showDebugAction = new QAction(NULL, "Show Debug Info", 0, this); | ||
| 884 | showDebugAction->setToggleAction(TRUE); | ||
| 885 | showDebugAction->setOn(showDebug); | ||
| 886 | connect(showDebugAction, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); | ||
| 887 | |||
| 888 | QAction *showIntroAction = new QAction(NULL, "Introduction", 0, this); | ||
| 889 | connect(showIntroAction, SIGNAL(activated()), SLOT(showIntro())); | ||
| 890 | QAction *showAboutAction = new QAction(NULL, "About", 0, this); | ||
| 891 | connect(showAboutAction, SIGNAL(activated()), SLOT(showAbout())); | ||
| 892 | |||
| 893 | // init tool bar | ||
| 894 | backAction->addTo(toolBar); | ||
| 895 | toolBar->addSeparator(); | ||
| 896 | loadAction->addTo(toolBar); | ||
| 897 | saveAction->addTo(toolBar); | ||
| 898 | toolBar->addSeparator(); | ||
| 899 | singleViewAction->addTo(toolBar); | ||
| 900 | splitViewAction->addTo(toolBar); | ||
| 901 | fullViewAction->addTo(toolBar); | ||
| 902 | |||
| 903 | // create config menu | ||
| 904 | QPopupMenu* config = new QPopupMenu(this); | ||
| 905 | menu->insertItem("&File", config); | ||
| 906 | loadAction->addTo(config); | ||
| 907 | saveAction->addTo(config); | ||
| 908 | saveAsAction->addTo(config); | ||
| 909 | config->insertSeparator(); | ||
| 910 | quitAction->addTo(config); | ||
| 911 | |||
| 912 | // create options menu | ||
| 913 | QPopupMenu* optionMenu = new QPopupMenu(this); | ||
| 914 | menu->insertItem("&Option", optionMenu); | ||
| 915 | showNameAction->addTo(optionMenu); | ||
| 916 | showRangeAction->addTo(optionMenu); | ||
| 917 | showDataAction->addTo(optionMenu); | ||
| 918 | optionMenu->insertSeparator(); | ||
| 919 | showAllAction->addTo(optionMenu); | ||
| 920 | showDebugAction->addTo(optionMenu); | ||
| 921 | |||
| 922 | // create help menu | ||
| 923 | QPopupMenu* helpMenu = new QPopupMenu(this); | ||
| 924 | menu->insertSeparator(); | ||
| 925 | menu->insertItem("&Help", helpMenu); | ||
| 926 | showIntroAction->addTo(helpMenu); | ||
| 927 | showAboutAction->addTo(helpMenu); | ||
| 928 | |||
| 929 | connect(configList, SIGNAL(menuSelected(struct menu *)), | ||
| 930 | SLOT(changeMenu(struct menu *))); | ||
| 931 | connect(configList, SIGNAL(parentSelected()), | ||
| 932 | SLOT(goBack())); | ||
| 933 | connect(menuList, SIGNAL(menuSelected(struct menu *)), | ||
| 934 | SLOT(changeMenu(struct menu *))); | ||
| 935 | |||
| 936 | connect(configList, SIGNAL(gotFocus(void)), | ||
| 937 | SLOT(listFocusChanged(void))); | ||
| 938 | connect(menuList, SIGNAL(gotFocus(void)), | ||
| 939 | SLOT(listFocusChanged(void))); | ||
| 940 | |||
| 941 | #if QT_VERSION >= 300 | ||
| 942 | QString listMode = configSettings->readEntry("/kconfig/qconf/listMode", "symbol"); | ||
| 943 | if (listMode == "single") | ||
| 944 | showSingleView(); | ||
| 945 | else if (listMode == "full") | ||
| 946 | showFullView(); | ||
| 947 | else /*if (listMode == "split")*/ | ||
| 948 | showSplitView(); | ||
| 949 | |||
| 950 | // UI setup done, restore splitter positions | ||
| 951 | QValueList<int> sizes = configSettings->readSizes("/kconfig/qconf/split1", &ok); | ||
| 952 | if (ok) | ||
| 953 | split1->setSizes(sizes); | ||
| 954 | |||
| 955 | sizes = configSettings->readSizes("/kconfig/qconf/split2", &ok); | ||
| 956 | if (ok) | ||
| 957 | split2->setSizes(sizes); | ||
| 958 | #else | ||
| 959 | showSplitView(); | ||
| 960 | #endif | ||
| 961 | delete configSettings; | ||
| 962 | } | ||
| 963 | |||
| 964 | static QString print_filter(const char *str) | ||
| 965 | { | ||
| 966 | QRegExp re("[<>&\"\\n]"); | ||
| 967 | QString res = str; | ||
| 968 | for (int i = 0; (i = res.find(re, i)) >= 0;) { | ||
| 969 | switch (res[i].latin1()) { | ||
| 970 | case '<': | ||
| 971 | res.replace(i, 1, "<"); | ||
| 972 | i += 4; | ||
| 973 | break; | ||
| 974 | case '>': | ||
| 975 | res.replace(i, 1, ">"); | ||
| 976 | i += 4; | ||
| 977 | break; | ||
| 978 | case '&': | ||
| 979 | res.replace(i, 1, "&"); | ||
| 980 | i += 5; | ||
| 981 | break; | ||
| 982 | case '"': | ||
| 983 | res.replace(i, 1, """); | ||
| 984 | i += 6; | ||
| 985 | break; | ||
| 986 | case '\n': | ||
| 987 | res.replace(i, 1, "<br>"); | ||
| 988 | i += 4; | ||
| 989 | break; | ||
| 990 | } | ||
| 991 | } | ||
| 992 | return res; | ||
| 993 | } | ||
| 994 | |||
| 995 | static void expr_print_help(void *data, const char *str) | ||
| 996 | { | ||
| 997 | ((QString*)data)->append(print_filter(str)); | ||
| 998 | } | ||
| 999 | |||
| 1000 | /* | ||
| 1001 | * display a new help entry as soon as a new menu entry is selected | ||
| 1002 | */ | ||
| 1003 | void ConfigMainWindow::setHelp(QListViewItem* item) | ||
| 1004 | { | ||
| 1005 | struct symbol* sym; | ||
| 1006 | struct menu* menu = 0; | ||
| 1007 | |||
| 1008 | configList->parent()->lineEdit->hide(); | ||
| 1009 | if (item) | ||
| 1010 | menu = ((ConfigItem*)item)->menu; | ||
| 1011 | if (!menu) { | ||
| 1012 | helpText->setText(NULL); | ||
| 1013 | return; | ||
| 1014 | } | ||
| 1015 | |||
| 1016 | QString head, debug, help; | ||
| 1017 | menu = ((ConfigItem*)item)->menu; | ||
| 1018 | sym = menu->sym; | ||
| 1019 | if (sym) { | ||
| 1020 | if (menu->prompt) { | ||
| 1021 | head += "<big><b>"; | ||
| 1022 | head += print_filter(menu->prompt->text); | ||
| 1023 | head += "</b></big>"; | ||
| 1024 | if (sym->name) { | ||
| 1025 | head += " ("; | ||
| 1026 | head += print_filter(sym->name); | ||
| 1027 | head += ")"; | ||
| 1028 | } | ||
| 1029 | } else if (sym->name) { | ||
| 1030 | head += "<big><b>"; | ||
| 1031 | head += print_filter(sym->name); | ||
| 1032 | head += "</b></big>"; | ||
| 1033 | } | ||
| 1034 | head += "<br><br>"; | ||
| 1035 | |||
| 1036 | if (showDebug) { | ||
| 1037 | debug += "type: "; | ||
| 1038 | debug += print_filter(sym_type_name(sym->type)); | ||
| 1039 | if (sym_is_choice(sym)) | ||
| 1040 | debug += " (choice)"; | ||
| 1041 | debug += "<br>"; | ||
| 1042 | if (sym->rev_dep.expr) { | ||
| 1043 | debug += "reverse dep: "; | ||
| 1044 | expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE); | ||
| 1045 | debug += "<br>"; | ||
| 1046 | } | ||
| 1047 | for (struct property *prop = sym->prop; prop; prop = prop->next) { | ||
| 1048 | switch (prop->type) { | ||
| 1049 | case P_PROMPT: | ||
| 1050 | case P_MENU: | ||
| 1051 | debug += "prompt: "; | ||
| 1052 | debug += print_filter(prop->text); | ||
| 1053 | debug += "<br>"; | ||
| 1054 | break; | ||
| 1055 | case P_DEFAULT: | ||
| 1056 | debug += "default: "; | ||
| 1057 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
| 1058 | debug += "<br>"; | ||
| 1059 | break; | ||
| 1060 | case P_CHOICE: | ||
| 1061 | if (sym_is_choice(sym)) { | ||
| 1062 | debug += "choice: "; | ||
| 1063 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
| 1064 | debug += "<br>"; | ||
| 1065 | } | ||
| 1066 | break; | ||
| 1067 | case P_SELECT: | ||
| 1068 | debug += "select: "; | ||
| 1069 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
| 1070 | debug += "<br>"; | ||
| 1071 | break; | ||
| 1072 | case P_RANGE: | ||
| 1073 | debug += "range: "; | ||
| 1074 | expr_print(prop->expr, expr_print_help, &debug, E_NONE); | ||
| 1075 | debug += "<br>"; | ||
| 1076 | break; | ||
| 1077 | default: | ||
| 1078 | debug += "unknown property: "; | ||
| 1079 | debug += prop_get_type_name(prop->type); | ||
| 1080 | debug += "<br>"; | ||
| 1081 | } | ||
| 1082 | if (prop->visible.expr) { | ||
| 1083 | debug += " dep: "; | ||
| 1084 | expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE); | ||
| 1085 | debug += "<br>"; | ||
| 1086 | } | ||
| 1087 | } | ||
| 1088 | debug += "<br>"; | ||
| 1089 | } | ||
| 1090 | |||
| 1091 | help = print_filter(sym->help); | ||
| 1092 | } else if (menu->prompt) { | ||
| 1093 | head += "<big><b>"; | ||
| 1094 | head += print_filter(menu->prompt->text); | ||
| 1095 | head += "</b></big><br><br>"; | ||
| 1096 | if (showDebug) { | ||
| 1097 | if (menu->prompt->visible.expr) { | ||
| 1098 | debug += " dep: "; | ||
| 1099 | expr_print(menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); | ||
| 1100 | debug += "<br><br>"; | ||
| 1101 | } | ||
| 1102 | } | ||
| 1103 | } | ||
| 1104 | if (showDebug) | ||
| 1105 | debug += QString().sprintf("defined at %s:%d<br><br>", menu->file->name, menu->lineno); | ||
| 1106 | helpText->setText(head + debug + help); | ||
| 1107 | } | ||
| 1108 | |||
| 1109 | void ConfigMainWindow::loadConfig(void) | ||
| 1110 | { | ||
| 1111 | QString s = QFileDialog::getOpenFileName(".config", NULL, this); | ||
| 1112 | if (s.isNull()) | ||
| 1113 | return; | ||
| 1114 | if (conf_read(s.latin1())) | ||
| 1115 | QMessageBox::information(this, "qconf", "Unable to load configuration!"); | ||
| 1116 | ConfigView::updateListAll(); | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | void ConfigMainWindow::saveConfig(void) | ||
| 1120 | { | ||
| 1121 | if (conf_write(NULL)) | ||
| 1122 | QMessageBox::information(this, "qconf", "Unable to save configuration!"); | ||
| 1123 | } | ||
| 1124 | |||
| 1125 | void ConfigMainWindow::saveConfigAs(void) | ||
| 1126 | { | ||
| 1127 | QString s = QFileDialog::getSaveFileName(".config", NULL, this); | ||
| 1128 | if (s.isNull()) | ||
| 1129 | return; | ||
| 1130 | if (conf_write(s.latin1())) | ||
| 1131 | QMessageBox::information(this, "qconf", "Unable to save configuration!"); | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | void ConfigMainWindow::changeMenu(struct menu *menu) | ||
| 1135 | { | ||
| 1136 | configList->setRootMenu(menu); | ||
| 1137 | backAction->setEnabled(TRUE); | ||
| 1138 | } | ||
| 1139 | |||
| 1140 | void ConfigMainWindow::listFocusChanged(void) | ||
| 1141 | { | ||
| 1142 | if (menuList->hasFocus()) { | ||
| 1143 | if (menuList->mode == menuMode) | ||
| 1144 | configList->clearSelection(); | ||
| 1145 | setHelp(menuList->selectedItem()); | ||
| 1146 | } else if (configList->hasFocus()) { | ||
| 1147 | setHelp(configList->selectedItem()); | ||
| 1148 | } | ||
| 1149 | } | ||
| 1150 | |||
| 1151 | void ConfigMainWindow::goBack(void) | ||
| 1152 | { | ||
| 1153 | ConfigItem* item; | ||
| 1154 | |||
| 1155 | configList->setParentMenu(); | ||
| 1156 | if (configList->rootEntry == &rootmenu) | ||
| 1157 | backAction->setEnabled(FALSE); | ||
| 1158 | item = (ConfigItem*)menuList->selectedItem(); | ||
| 1159 | while (item) { | ||
| 1160 | if (item->menu == configList->rootEntry) { | ||
| 1161 | menuList->setSelected(item, TRUE); | ||
| 1162 | break; | ||
| 1163 | } | ||
| 1164 | item = (ConfigItem*)item->parent(); | ||
| 1165 | } | ||
| 1166 | } | ||
| 1167 | |||
| 1168 | void ConfigMainWindow::showSingleView(void) | ||
| 1169 | { | ||
| 1170 | menuView->hide(); | ||
| 1171 | menuList->setRootMenu(0); | ||
| 1172 | configList->mode = singleMode; | ||
| 1173 | if (configList->rootEntry == &rootmenu) | ||
| 1174 | configList->updateListAll(); | ||
| 1175 | else | ||
| 1176 | configList->setRootMenu(&rootmenu); | ||
| 1177 | configList->setAllOpen(TRUE); | ||
| 1178 | configList->setFocus(); | ||
| 1179 | } | ||
| 1180 | |||
| 1181 | void ConfigMainWindow::showSplitView(void) | ||
| 1182 | { | ||
| 1183 | configList->mode = symbolMode; | ||
| 1184 | if (configList->rootEntry == &rootmenu) | ||
| 1185 | configList->updateListAll(); | ||
| 1186 | else | ||
| 1187 | configList->setRootMenu(&rootmenu); | ||
| 1188 | configList->setAllOpen(TRUE); | ||
| 1189 | configApp->processEvents(); | ||
| 1190 | menuList->mode = menuMode; | ||
| 1191 | menuList->setRootMenu(&rootmenu); | ||
| 1192 | menuList->setAllOpen(TRUE); | ||
| 1193 | menuView->show(); | ||
| 1194 | menuList->setFocus(); | ||
| 1195 | } | ||
| 1196 | |||
| 1197 | void ConfigMainWindow::showFullView(void) | ||
| 1198 | { | ||
| 1199 | menuView->hide(); | ||
| 1200 | menuList->setRootMenu(0); | ||
| 1201 | configList->mode = fullMode; | ||
| 1202 | if (configList->rootEntry == &rootmenu) | ||
| 1203 | configList->updateListAll(); | ||
| 1204 | else | ||
| 1205 | configList->setRootMenu(&rootmenu); | ||
| 1206 | configList->setAllOpen(FALSE); | ||
| 1207 | configList->setFocus(); | ||
| 1208 | } | ||
| 1209 | |||
| 1210 | void ConfigMainWindow::setShowAll(bool b) | ||
| 1211 | { | ||
| 1212 | if (configList->showAll == b) | ||
| 1213 | return; | ||
| 1214 | configList->showAll = b; | ||
| 1215 | configList->updateListAll(); | ||
| 1216 | menuList->showAll = b; | ||
| 1217 | menuList->updateListAll(); | ||
| 1218 | } | ||
| 1219 | |||
| 1220 | void ConfigMainWindow::setShowDebug(bool b) | ||
| 1221 | { | ||
| 1222 | if (showDebug == b) | ||
| 1223 | return; | ||
| 1224 | showDebug = b; | ||
| 1225 | } | ||
| 1226 | |||
| 1227 | void ConfigMainWindow::setShowName(bool b) | ||
| 1228 | { | ||
| 1229 | if (configList->showName == b) | ||
| 1230 | return; | ||
| 1231 | configList->showName = b; | ||
| 1232 | configList->reinit(); | ||
| 1233 | menuList->showName = b; | ||
| 1234 | menuList->reinit(); | ||
| 1235 | } | ||
| 1236 | |||
| 1237 | void ConfigMainWindow::setShowRange(bool b) | ||
| 1238 | { | ||
| 1239 | if (configList->showRange == b) | ||
| 1240 | return; | ||
| 1241 | configList->showRange = b; | ||
| 1242 | configList->reinit(); | ||
| 1243 | menuList->showRange = b; | ||
| 1244 | menuList->reinit(); | ||
| 1245 | } | ||
| 1246 | |||
| 1247 | void ConfigMainWindow::setShowData(bool b) | ||
| 1248 | { | ||
| 1249 | if (configList->showData == b) | ||
| 1250 | return; | ||
| 1251 | configList->showData = b; | ||
| 1252 | configList->reinit(); | ||
| 1253 | menuList->showData = b; | ||
| 1254 | menuList->reinit(); | ||
| 1255 | } | ||
| 1256 | |||
| 1257 | /* | ||
| 1258 | * ask for saving configuration before quitting | ||
| 1259 | * TODO ask only when something changed | ||
| 1260 | */ | ||
| 1261 | void ConfigMainWindow::closeEvent(QCloseEvent* e) | ||
| 1262 | { | ||
| 1263 | if (!sym_change_count) { | ||
| 1264 | e->accept(); | ||
| 1265 | return; | ||
| 1266 | } | ||
| 1267 | QMessageBox mb("qconf", "Save configuration?", QMessageBox::Warning, | ||
| 1268 | QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); | ||
| 1269 | mb.setButtonText(QMessageBox::Yes, "&Save Changes"); | ||
| 1270 | mb.setButtonText(QMessageBox::No, "&Discard Changes"); | ||
| 1271 | mb.setButtonText(QMessageBox::Cancel, "Cancel Exit"); | ||
| 1272 | switch (mb.exec()) { | ||
| 1273 | case QMessageBox::Yes: | ||
| 1274 | conf_write(NULL); | ||
| 1275 | case QMessageBox::No: | ||
| 1276 | e->accept(); | ||
| 1277 | break; | ||
| 1278 | case QMessageBox::Cancel: | ||
| 1279 | e->ignore(); | ||
| 1280 | break; | ||
| 1281 | } | ||
| 1282 | } | ||
| 1283 | |||
| 1284 | void ConfigMainWindow::showIntro(void) | ||
| 1285 | { | ||
| 1286 | static char str[] = "Welcome to the qconf graphical kernel configuration tool for Linux.\n\n" | ||
| 1287 | "For each option, a blank box indicates the feature is disabled, a check\n" | ||
| 1288 | "indicates it is enabled, and a dot indicates that it is to be compiled\n" | ||
| 1289 | "as a module. Clicking on the box will cycle through the three states.\n\n" | ||
| 1290 | "If you do not see an option (e.g., a device driver) that you believe\n" | ||
| 1291 | "should be present, try turning on Show All Options under the Options menu.\n" | ||
| 1292 | "Although there is no cross reference yet to help you figure out what other\n" | ||
| 1293 | "options must be enabled to support the option you are interested in, you can\n" | ||
| 1294 | "still view the help of a grayed-out option.\n\n" | ||
| 1295 | "Toggling Show Debug Info under the Options menu will show the dependencies,\n" | ||
| 1296 | "which you can then match by examining other options.\n\n"; | ||
| 1297 | |||
| 1298 | QMessageBox::information(this, "qconf", str); | ||
| 1299 | } | ||
| 1300 | |||
| 1301 | void ConfigMainWindow::showAbout(void) | ||
| 1302 | { | ||
| 1303 | static char str[] = "qconf is Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>.\n\n" | ||
| 1304 | "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"; | ||
| 1305 | |||
| 1306 | QMessageBox::information(this, "qconf", str); | ||
| 1307 | } | ||
| 1308 | |||
| 1309 | void ConfigMainWindow::saveSettings(void) | ||
| 1310 | { | ||
| 1311 | #if QT_VERSION >= 300 | ||
| 1312 | ConfigSettings *configSettings = new ConfigSettings; | ||
| 1313 | configSettings->writeEntry("/kconfig/qconf/window x", pos().x()); | ||
| 1314 | configSettings->writeEntry("/kconfig/qconf/window y", pos().y()); | ||
| 1315 | configSettings->writeEntry("/kconfig/qconf/window width", size().width()); | ||
| 1316 | configSettings->writeEntry("/kconfig/qconf/window height", size().height()); | ||
| 1317 | configSettings->writeEntry("/kconfig/qconf/showName", configList->showName); | ||
| 1318 | configSettings->writeEntry("/kconfig/qconf/showRange", configList->showRange); | ||
| 1319 | configSettings->writeEntry("/kconfig/qconf/showData", configList->showData); | ||
| 1320 | configSettings->writeEntry("/kconfig/qconf/showAll", configList->showAll); | ||
| 1321 | configSettings->writeEntry("/kconfig/qconf/showDebug", showDebug); | ||
| 1322 | |||
| 1323 | QString entry; | ||
| 1324 | switch(configList->mode) { | ||
| 1325 | case singleMode : | ||
| 1326 | entry = "single"; | ||
| 1327 | break; | ||
| 1328 | |||
| 1329 | case symbolMode : | ||
| 1330 | entry = "split"; | ||
| 1331 | break; | ||
| 1332 | |||
| 1333 | case fullMode : | ||
| 1334 | entry = "full"; | ||
| 1335 | break; | ||
| 1336 | } | ||
| 1337 | configSettings->writeEntry("/kconfig/qconf/listMode", entry); | ||
| 1338 | |||
| 1339 | configSettings->writeSizes("/kconfig/qconf/split1", split1->sizes()); | ||
| 1340 | configSettings->writeSizes("/kconfig/qconf/split2", split2->sizes()); | ||
| 1341 | |||
| 1342 | delete configSettings; | ||
| 1343 | #endif | ||
| 1344 | } | ||
| 1345 | |||
| 1346 | void fixup_rootmenu(struct menu *menu) | ||
| 1347 | { | ||
| 1348 | struct menu *child; | ||
| 1349 | static int menu_cnt = 0; | ||
| 1350 | |||
| 1351 | menu->flags |= MENU_ROOT; | ||
| 1352 | for (child = menu->list; child; child = child->next) { | ||
| 1353 | if (child->prompt && child->prompt->type == P_MENU) { | ||
| 1354 | menu_cnt++; | ||
| 1355 | fixup_rootmenu(child); | ||
| 1356 | menu_cnt--; | ||
| 1357 | } else if (!menu_cnt) | ||
| 1358 | fixup_rootmenu(child); | ||
| 1359 | } | ||
| 1360 | } | ||
| 1361 | |||
| 1362 | static const char *progname; | ||
| 1363 | |||
| 1364 | static void usage(void) | ||
| 1365 | { | ||
| 1366 | printf("%s <config>\n", progname); | ||
| 1367 | exit(0); | ||
| 1368 | } | ||
| 1369 | |||
| 1370 | int main(int ac, char** av) | ||
| 1371 | { | ||
| 1372 | ConfigMainWindow* v; | ||
| 1373 | const char *name; | ||
| 1374 | |||
| 1375 | #ifndef LKC_DIRECT_LINK | ||
| 1376 | kconfig_load(); | ||
| 1377 | #endif | ||
| 1378 | |||
| 1379 | progname = av[0]; | ||
| 1380 | configApp = new QApplication(ac, av); | ||
| 1381 | if (ac > 1 && av[1][0] == '-') { | ||
| 1382 | switch (av[1][1]) { | ||
| 1383 | case 'h': | ||
| 1384 | case '?': | ||
| 1385 | usage(); | ||
| 1386 | } | ||
| 1387 | name = av[2]; | ||
| 1388 | } else | ||
| 1389 | name = av[1]; | ||
| 1390 | if (!name) | ||
| 1391 | usage(); | ||
| 1392 | |||
| 1393 | conf_parse(name); | ||
| 1394 | fixup_rootmenu(&rootmenu); | ||
| 1395 | conf_read(NULL); | ||
| 1396 | //zconfdump(stdout); | ||
| 1397 | |||
| 1398 | v = new ConfigMainWindow(); | ||
| 1399 | |||
| 1400 | //zconfdump(stdout); | ||
| 1401 | v->show(); | ||
| 1402 | configApp->connect(configApp, SIGNAL(lastWindowClosed()), SLOT(quit())); | ||
| 1403 | configApp->connect(configApp, SIGNAL(aboutToQuit()), v, SLOT(saveSettings())); | ||
| 1404 | configApp->exec(); | ||
| 1405 | |||
| 1406 | return 0; | ||
| 1407 | } | ||
diff --git a/scripts/kconfig/qconf.h b/scripts/kconfig/qconf.h new file mode 100644 index 000000000000..7c03927d4c7c --- /dev/null +++ b/scripts/kconfig/qconf.h | |||
| @@ -0,0 +1,263 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <qlistview.h> | ||
| 7 | #if QT_VERSION >= 300 | ||
| 8 | #include <qsettings.h> | ||
| 9 | #else | ||
| 10 | class QSettings { }; | ||
| 11 | #endif | ||
| 12 | |||
| 13 | class ConfigList; | ||
| 14 | class ConfigItem; | ||
| 15 | class ConfigLineEdit; | ||
| 16 | class ConfigMainWindow; | ||
| 17 | |||
| 18 | |||
| 19 | class ConfigSettings : public QSettings { | ||
| 20 | public: | ||
| 21 | ConfigSettings(); | ||
| 22 | |||
| 23 | #if QT_VERSION >= 300 | ||
| 24 | void readListSettings(); | ||
| 25 | QValueList<int> ConfigSettings::readSizes(const QString& key, bool *ok); | ||
| 26 | bool ConfigSettings::writeSizes(const QString& key, const QValueList<int>& value); | ||
| 27 | #endif | ||
| 28 | |||
| 29 | bool showAll; | ||
| 30 | bool showName; | ||
| 31 | bool showRange; | ||
| 32 | bool showData; | ||
| 33 | }; | ||
| 34 | |||
| 35 | class ConfigView : public QVBox { | ||
| 36 | Q_OBJECT | ||
| 37 | typedef class QVBox Parent; | ||
| 38 | public: | ||
| 39 | ConfigView(QWidget* parent, ConfigMainWindow* cview, ConfigSettings* configSettings); | ||
| 40 | ~ConfigView(void); | ||
| 41 | static void updateList(ConfigItem* item); | ||
| 42 | static void updateListAll(void); | ||
| 43 | |||
| 44 | public: | ||
| 45 | ConfigList* list; | ||
| 46 | ConfigLineEdit* lineEdit; | ||
| 47 | |||
| 48 | static ConfigView* viewList; | ||
| 49 | ConfigView* nextView; | ||
| 50 | }; | ||
| 51 | |||
| 52 | enum colIdx { | ||
| 53 | promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr | ||
| 54 | }; | ||
| 55 | enum listMode { | ||
| 56 | singleMode, menuMode, symbolMode, fullMode | ||
| 57 | }; | ||
| 58 | |||
| 59 | class ConfigList : public QListView { | ||
| 60 | Q_OBJECT | ||
| 61 | typedef class QListView Parent; | ||
| 62 | public: | ||
| 63 | ConfigList(ConfigView* p, ConfigMainWindow* cview, ConfigSettings *configSettings); | ||
| 64 | void reinit(void); | ||
| 65 | ConfigView* parent(void) const | ||
| 66 | { | ||
| 67 | return (ConfigView*)Parent::parent(); | ||
| 68 | } | ||
| 69 | |||
| 70 | protected: | ||
| 71 | ConfigMainWindow* cview; | ||
| 72 | |||
| 73 | void keyPressEvent(QKeyEvent *e); | ||
| 74 | void contentsMousePressEvent(QMouseEvent *e); | ||
| 75 | void contentsMouseReleaseEvent(QMouseEvent *e); | ||
| 76 | void contentsMouseMoveEvent(QMouseEvent *e); | ||
| 77 | void contentsMouseDoubleClickEvent(QMouseEvent *e); | ||
| 78 | void focusInEvent(QFocusEvent *e); | ||
| 79 | public slots: | ||
| 80 | void setRootMenu(struct menu *menu); | ||
| 81 | |||
| 82 | void updateList(ConfigItem *item); | ||
| 83 | void setValue(ConfigItem* item, tristate val); | ||
| 84 | void changeValue(ConfigItem* item); | ||
| 85 | void updateSelection(void); | ||
| 86 | signals: | ||
| 87 | void menuSelected(struct menu *menu); | ||
| 88 | void parentSelected(void); | ||
| 89 | void gotFocus(void); | ||
| 90 | |||
| 91 | public: | ||
| 92 | void updateListAll(void) | ||
| 93 | { | ||
| 94 | updateAll = true; | ||
| 95 | updateList(NULL); | ||
| 96 | updateAll = false; | ||
| 97 | } | ||
| 98 | ConfigList* listView() | ||
| 99 | { | ||
| 100 | return this; | ||
| 101 | } | ||
| 102 | ConfigItem* firstChild() const | ||
| 103 | { | ||
| 104 | return (ConfigItem *)Parent::firstChild(); | ||
| 105 | } | ||
| 106 | int mapIdx(colIdx idx) | ||
| 107 | { | ||
| 108 | return colMap[idx]; | ||
| 109 | } | ||
| 110 | void addColumn(colIdx idx, const QString& label) | ||
| 111 | { | ||
| 112 | colMap[idx] = Parent::addColumn(label); | ||
| 113 | colRevMap[colMap[idx]] = idx; | ||
| 114 | } | ||
| 115 | void removeColumn(colIdx idx) | ||
| 116 | { | ||
| 117 | int col = colMap[idx]; | ||
| 118 | if (col >= 0) { | ||
| 119 | Parent::removeColumn(col); | ||
| 120 | colRevMap[col] = colMap[idx] = -1; | ||
| 121 | } | ||
| 122 | } | ||
| 123 | void setAllOpen(bool open); | ||
| 124 | void setParentMenu(void); | ||
| 125 | |||
| 126 | template <class P> | ||
| 127 | void ConfigList::updateMenuList(P*, struct menu*); | ||
| 128 | |||
| 129 | bool updateAll; | ||
| 130 | |||
| 131 | QPixmap symbolYesPix, symbolModPix, symbolNoPix; | ||
| 132 | QPixmap choiceYesPix, choiceNoPix; | ||
| 133 | QPixmap menuPix, menuInvPix, menuBackPix, voidPix; | ||
| 134 | |||
| 135 | bool showAll, showName, showRange, showData; | ||
| 136 | enum listMode mode; | ||
| 137 | struct menu *rootEntry; | ||
| 138 | QColorGroup disabledColorGroup; | ||
| 139 | QColorGroup inactivedColorGroup; | ||
| 140 | |||
| 141 | private: | ||
| 142 | int colMap[colNr]; | ||
| 143 | int colRevMap[colNr]; | ||
| 144 | }; | ||
| 145 | |||
| 146 | class ConfigItem : public QListViewItem { | ||
| 147 | typedef class QListViewItem Parent; | ||
| 148 | public: | ||
| 149 | ConfigItem(QListView *parent, ConfigItem *after, struct menu *m, bool v) | ||
| 150 | : Parent(parent, after), menu(m), visible(v), goParent(false) | ||
| 151 | { | ||
| 152 | init(); | ||
| 153 | } | ||
| 154 | ConfigItem(ConfigItem *parent, ConfigItem *after, struct menu *m, bool v) | ||
| 155 | : Parent(parent, after), menu(m), visible(v), goParent(false) | ||
| 156 | { | ||
| 157 | init(); | ||
| 158 | } | ||
| 159 | ConfigItem(QListView *parent, ConfigItem *after, bool v) | ||
| 160 | : Parent(parent, after), menu(0), visible(v), goParent(true) | ||
| 161 | { | ||
| 162 | init(); | ||
| 163 | } | ||
| 164 | ~ConfigItem(void); | ||
| 165 | void init(void); | ||
| 166 | #if QT_VERSION >= 300 | ||
| 167 | void okRename(int col); | ||
| 168 | #endif | ||
| 169 | void updateMenu(void); | ||
| 170 | void testUpdateMenu(bool v); | ||
| 171 | ConfigList* listView() const | ||
| 172 | { | ||
| 173 | return (ConfigList*)Parent::listView(); | ||
| 174 | } | ||
| 175 | ConfigItem* firstChild() const | ||
| 176 | { | ||
| 177 | return (ConfigItem *)Parent::firstChild(); | ||
| 178 | } | ||
| 179 | ConfigItem* nextSibling() const | ||
| 180 | { | ||
| 181 | return (ConfigItem *)Parent::nextSibling(); | ||
| 182 | } | ||
| 183 | void setText(colIdx idx, const QString& text) | ||
| 184 | { | ||
| 185 | Parent::setText(listView()->mapIdx(idx), text); | ||
| 186 | } | ||
| 187 | QString text(colIdx idx) const | ||
| 188 | { | ||
| 189 | return Parent::text(listView()->mapIdx(idx)); | ||
| 190 | } | ||
| 191 | void setPixmap(colIdx idx, const QPixmap& pm) | ||
| 192 | { | ||
| 193 | Parent::setPixmap(listView()->mapIdx(idx), pm); | ||
| 194 | } | ||
| 195 | const QPixmap* pixmap(colIdx idx) const | ||
| 196 | { | ||
| 197 | return Parent::pixmap(listView()->mapIdx(idx)); | ||
| 198 | } | ||
| 199 | void paintCell(QPainter* p, const QColorGroup& cg, int column, int width, int align); | ||
| 200 | |||
| 201 | ConfigItem* nextItem; | ||
| 202 | struct menu *menu; | ||
| 203 | bool visible; | ||
| 204 | bool goParent; | ||
| 205 | }; | ||
| 206 | |||
| 207 | class ConfigLineEdit : public QLineEdit { | ||
| 208 | Q_OBJECT | ||
| 209 | typedef class QLineEdit Parent; | ||
| 210 | public: | ||
| 211 | ConfigLineEdit(ConfigView* parent) | ||
| 212 | : Parent(parent) | ||
| 213 | { } | ||
| 214 | ConfigView* parent(void) const | ||
| 215 | { | ||
| 216 | return (ConfigView*)Parent::parent(); | ||
| 217 | } | ||
| 218 | void show(ConfigItem *i); | ||
| 219 | void keyPressEvent(QKeyEvent *e); | ||
| 220 | |||
| 221 | public: | ||
| 222 | ConfigItem *item; | ||
| 223 | }; | ||
| 224 | |||
| 225 | class ConfigMainWindow : public QMainWindow { | ||
| 226 | Q_OBJECT | ||
| 227 | public: | ||
| 228 | ConfigMainWindow(void); | ||
| 229 | public slots: | ||
| 230 | void setHelp(QListViewItem* item); | ||
| 231 | void changeMenu(struct menu *); | ||
| 232 | void listFocusChanged(void); | ||
| 233 | void goBack(void); | ||
| 234 | void loadConfig(void); | ||
| 235 | void saveConfig(void); | ||
| 236 | void saveConfigAs(void); | ||
| 237 | void showSingleView(void); | ||
| 238 | void showSplitView(void); | ||
| 239 | void showFullView(void); | ||
| 240 | void setShowAll(bool); | ||
| 241 | void setShowDebug(bool); | ||
| 242 | void setShowRange(bool); | ||
| 243 | void setShowName(bool); | ||
| 244 | void setShowData(bool); | ||
| 245 | void showIntro(void); | ||
| 246 | void showAbout(void); | ||
| 247 | void saveSettings(void); | ||
| 248 | |||
| 249 | protected: | ||
| 250 | void closeEvent(QCloseEvent *e); | ||
| 251 | |||
| 252 | ConfigView *menuView; | ||
| 253 | ConfigList *menuList; | ||
| 254 | ConfigView *configView; | ||
| 255 | ConfigList *configList; | ||
| 256 | QTextView *helpText; | ||
| 257 | QToolBar *toolBar; | ||
| 258 | QAction *backAction; | ||
| 259 | QSplitter* split1; | ||
| 260 | QSplitter* split2; | ||
| 261 | |||
| 262 | bool showDebug; | ||
| 263 | }; | ||
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c new file mode 100644 index 000000000000..affa52f5c651 --- /dev/null +++ b/scripts/kconfig/symbol.c | |||
| @@ -0,0 +1,816 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <ctype.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <string.h> | ||
| 9 | #include <regex.h> | ||
| 10 | #include <sys/utsname.h> | ||
| 11 | |||
| 12 | #define LKC_DIRECT_LINK | ||
| 13 | #include "lkc.h" | ||
| 14 | |||
| 15 | struct symbol symbol_yes = { | ||
| 16 | .name = "y", | ||
| 17 | .curr = { "y", yes }, | ||
| 18 | .flags = SYMBOL_YES|SYMBOL_VALID, | ||
| 19 | }, symbol_mod = { | ||
| 20 | .name = "m", | ||
| 21 | .curr = { "m", mod }, | ||
| 22 | .flags = SYMBOL_MOD|SYMBOL_VALID, | ||
| 23 | }, symbol_no = { | ||
| 24 | .name = "n", | ||
| 25 | .curr = { "n", no }, | ||
| 26 | .flags = SYMBOL_NO|SYMBOL_VALID, | ||
| 27 | }, symbol_empty = { | ||
| 28 | .name = "", | ||
| 29 | .curr = { "", no }, | ||
| 30 | .flags = SYMBOL_VALID, | ||
| 31 | }; | ||
| 32 | |||
| 33 | int sym_change_count; | ||
| 34 | struct symbol *modules_sym; | ||
| 35 | tristate modules_val; | ||
| 36 | |||
| 37 | void sym_add_default(struct symbol *sym, const char *def) | ||
| 38 | { | ||
| 39 | struct property *prop = prop_alloc(P_DEFAULT, sym); | ||
| 40 | |||
| 41 | prop->expr = expr_alloc_symbol(sym_lookup(def, 1)); | ||
| 42 | } | ||
| 43 | |||
| 44 | void sym_init(void) | ||
| 45 | { | ||
| 46 | struct symbol *sym; | ||
| 47 | struct utsname uts; | ||
| 48 | char *p; | ||
| 49 | static bool inited = false; | ||
| 50 | |||
| 51 | if (inited) | ||
| 52 | return; | ||
| 53 | inited = true; | ||
| 54 | |||
| 55 | uname(&uts); | ||
| 56 | |||
| 57 | sym = sym_lookup("ARCH", 0); | ||
| 58 | sym->type = S_STRING; | ||
| 59 | sym->flags |= SYMBOL_AUTO; | ||
| 60 | p = getenv("ARCH"); | ||
| 61 | if (p) | ||
| 62 | sym_add_default(sym, p); | ||
| 63 | |||
| 64 | sym = sym_lookup("KERNELRELEASE", 0); | ||
| 65 | sym->type = S_STRING; | ||
| 66 | sym->flags |= SYMBOL_AUTO; | ||
| 67 | p = getenv("KERNELRELEASE"); | ||
| 68 | if (p) | ||
| 69 | sym_add_default(sym, p); | ||
| 70 | |||
| 71 | sym = sym_lookup("UNAME_RELEASE", 0); | ||
| 72 | sym->type = S_STRING; | ||
| 73 | sym->flags |= SYMBOL_AUTO; | ||
| 74 | sym_add_default(sym, uts.release); | ||
| 75 | } | ||
| 76 | |||
| 77 | enum symbol_type sym_get_type(struct symbol *sym) | ||
| 78 | { | ||
| 79 | enum symbol_type type = sym->type; | ||
| 80 | |||
| 81 | if (type == S_TRISTATE) { | ||
| 82 | if (sym_is_choice_value(sym) && sym->visible == yes) | ||
| 83 | type = S_BOOLEAN; | ||
| 84 | else if (modules_val == no) | ||
| 85 | type = S_BOOLEAN; | ||
| 86 | } | ||
| 87 | return type; | ||
| 88 | } | ||
| 89 | |||
| 90 | const char *sym_type_name(enum symbol_type type) | ||
| 91 | { | ||
| 92 | switch (type) { | ||
| 93 | case S_BOOLEAN: | ||
| 94 | return "boolean"; | ||
| 95 | case S_TRISTATE: | ||
| 96 | return "tristate"; | ||
| 97 | case S_INT: | ||
| 98 | return "integer"; | ||
| 99 | case S_HEX: | ||
| 100 | return "hex"; | ||
| 101 | case S_STRING: | ||
| 102 | return "string"; | ||
| 103 | case S_UNKNOWN: | ||
| 104 | return "unknown"; | ||
| 105 | case S_OTHER: | ||
| 106 | break; | ||
| 107 | } | ||
| 108 | return "???"; | ||
| 109 | } | ||
| 110 | |||
| 111 | struct property *sym_get_choice_prop(struct symbol *sym) | ||
| 112 | { | ||
| 113 | struct property *prop; | ||
| 114 | |||
| 115 | for_all_choices(sym, prop) | ||
| 116 | return prop; | ||
| 117 | return NULL; | ||
| 118 | } | ||
| 119 | |||
| 120 | struct property *sym_get_default_prop(struct symbol *sym) | ||
| 121 | { | ||
| 122 | struct property *prop; | ||
| 123 | |||
| 124 | for_all_defaults(sym, prop) { | ||
| 125 | prop->visible.tri = expr_calc_value(prop->visible.expr); | ||
| 126 | if (prop->visible.tri != no) | ||
| 127 | return prop; | ||
| 128 | } | ||
| 129 | return NULL; | ||
| 130 | } | ||
| 131 | |||
| 132 | struct property *sym_get_range_prop(struct symbol *sym) | ||
| 133 | { | ||
| 134 | struct property *prop; | ||
| 135 | |||
| 136 | for_all_properties(sym, prop, P_RANGE) { | ||
| 137 | prop->visible.tri = expr_calc_value(prop->visible.expr); | ||
| 138 | if (prop->visible.tri != no) | ||
| 139 | return prop; | ||
| 140 | } | ||
| 141 | return NULL; | ||
| 142 | } | ||
| 143 | |||
| 144 | static void sym_calc_visibility(struct symbol *sym) | ||
| 145 | { | ||
| 146 | struct property *prop; | ||
| 147 | tristate tri; | ||
| 148 | |||
| 149 | /* any prompt visible? */ | ||
| 150 | tri = no; | ||
| 151 | for_all_prompts(sym, prop) { | ||
| 152 | prop->visible.tri = expr_calc_value(prop->visible.expr); | ||
| 153 | tri = E_OR(tri, prop->visible.tri); | ||
| 154 | } | ||
| 155 | if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) | ||
| 156 | tri = yes; | ||
| 157 | if (sym->visible != tri) { | ||
| 158 | sym->visible = tri; | ||
| 159 | sym_set_changed(sym); | ||
| 160 | } | ||
| 161 | if (sym_is_choice_value(sym)) | ||
| 162 | return; | ||
| 163 | tri = no; | ||
| 164 | if (sym->rev_dep.expr) | ||
| 165 | tri = expr_calc_value(sym->rev_dep.expr); | ||
| 166 | if (tri == mod && sym_get_type(sym) == S_BOOLEAN) | ||
| 167 | tri = yes; | ||
| 168 | if (sym->rev_dep.tri != tri) { | ||
| 169 | sym->rev_dep.tri = tri; | ||
| 170 | sym_set_changed(sym); | ||
| 171 | } | ||
| 172 | } | ||
| 173 | |||
| 174 | static struct symbol *sym_calc_choice(struct symbol *sym) | ||
| 175 | { | ||
| 176 | struct symbol *def_sym; | ||
| 177 | struct property *prop; | ||
| 178 | struct expr *e; | ||
| 179 | |||
| 180 | /* is the user choice visible? */ | ||
| 181 | def_sym = sym->user.val; | ||
| 182 | if (def_sym) { | ||
| 183 | sym_calc_visibility(def_sym); | ||
| 184 | if (def_sym->visible != no) | ||
| 185 | return def_sym; | ||
| 186 | } | ||
| 187 | |||
| 188 | /* any of the defaults visible? */ | ||
| 189 | for_all_defaults(sym, prop) { | ||
| 190 | prop->visible.tri = expr_calc_value(prop->visible.expr); | ||
| 191 | if (prop->visible.tri == no) | ||
| 192 | continue; | ||
| 193 | def_sym = prop_get_symbol(prop); | ||
| 194 | sym_calc_visibility(def_sym); | ||
| 195 | if (def_sym->visible != no) | ||
| 196 | return def_sym; | ||
| 197 | } | ||
| 198 | |||
| 199 | /* just get the first visible value */ | ||
| 200 | prop = sym_get_choice_prop(sym); | ||
| 201 | for (e = prop->expr; e; e = e->left.expr) { | ||
| 202 | def_sym = e->right.sym; | ||
| 203 | sym_calc_visibility(def_sym); | ||
| 204 | if (def_sym->visible != no) | ||
| 205 | return def_sym; | ||
| 206 | } | ||
| 207 | |||
| 208 | /* no choice? reset tristate value */ | ||
| 209 | sym->curr.tri = no; | ||
| 210 | return NULL; | ||
| 211 | } | ||
| 212 | |||
| 213 | void sym_calc_value(struct symbol *sym) | ||
| 214 | { | ||
| 215 | struct symbol_value newval, oldval; | ||
| 216 | struct property *prop; | ||
| 217 | struct expr *e; | ||
| 218 | |||
| 219 | if (!sym) | ||
| 220 | return; | ||
| 221 | |||
| 222 | if (sym->flags & SYMBOL_VALID) | ||
| 223 | return; | ||
| 224 | sym->flags |= SYMBOL_VALID; | ||
| 225 | |||
| 226 | oldval = sym->curr; | ||
| 227 | |||
| 228 | switch (sym->type) { | ||
| 229 | case S_INT: | ||
| 230 | case S_HEX: | ||
| 231 | case S_STRING: | ||
| 232 | newval = symbol_empty.curr; | ||
| 233 | break; | ||
| 234 | case S_BOOLEAN: | ||
| 235 | case S_TRISTATE: | ||
| 236 | newval = symbol_no.curr; | ||
| 237 | break; | ||
| 238 | default: | ||
| 239 | sym->curr.val = sym->name; | ||
| 240 | sym->curr.tri = no; | ||
| 241 | return; | ||
| 242 | } | ||
| 243 | if (!sym_is_choice_value(sym)) | ||
| 244 | sym->flags &= ~SYMBOL_WRITE; | ||
| 245 | |||
| 246 | sym_calc_visibility(sym); | ||
| 247 | |||
| 248 | /* set default if recursively called */ | ||
| 249 | sym->curr = newval; | ||
| 250 | |||
| 251 | switch (sym_get_type(sym)) { | ||
| 252 | case S_BOOLEAN: | ||
| 253 | case S_TRISTATE: | ||
| 254 | if (sym_is_choice_value(sym) && sym->visible == yes) { | ||
| 255 | prop = sym_get_choice_prop(sym); | ||
| 256 | newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; | ||
| 257 | } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { | ||
| 258 | sym->flags |= SYMBOL_WRITE; | ||
| 259 | if (sym_has_value(sym)) | ||
| 260 | newval.tri = sym->user.tri; | ||
| 261 | else if (!sym_is_choice(sym)) { | ||
| 262 | prop = sym_get_default_prop(sym); | ||
| 263 | if (prop) | ||
| 264 | newval.tri = expr_calc_value(prop->expr); | ||
| 265 | } | ||
| 266 | newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri); | ||
| 267 | } else if (!sym_is_choice(sym)) { | ||
| 268 | prop = sym_get_default_prop(sym); | ||
| 269 | if (prop) { | ||
| 270 | sym->flags |= SYMBOL_WRITE; | ||
| 271 | newval.tri = expr_calc_value(prop->expr); | ||
| 272 | } | ||
| 273 | } | ||
| 274 | if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) | ||
| 275 | newval.tri = yes; | ||
| 276 | break; | ||
| 277 | case S_STRING: | ||
| 278 | case S_HEX: | ||
| 279 | case S_INT: | ||
| 280 | if (sym->visible != no) { | ||
| 281 | sym->flags |= SYMBOL_WRITE; | ||
| 282 | if (sym_has_value(sym)) { | ||
| 283 | newval.val = sym->user.val; | ||
| 284 | break; | ||
| 285 | } | ||
| 286 | } | ||
| 287 | prop = sym_get_default_prop(sym); | ||
| 288 | if (prop) { | ||
| 289 | struct symbol *ds = prop_get_symbol(prop); | ||
| 290 | if (ds) { | ||
| 291 | sym->flags |= SYMBOL_WRITE; | ||
| 292 | sym_calc_value(ds); | ||
| 293 | newval.val = ds->curr.val; | ||
| 294 | } | ||
| 295 | } | ||
| 296 | break; | ||
| 297 | default: | ||
| 298 | ; | ||
| 299 | } | ||
| 300 | |||
| 301 | sym->curr = newval; | ||
| 302 | if (sym_is_choice(sym) && newval.tri == yes) | ||
| 303 | sym->curr.val = sym_calc_choice(sym); | ||
| 304 | |||
| 305 | if (memcmp(&oldval, &sym->curr, sizeof(oldval))) | ||
| 306 | sym_set_changed(sym); | ||
| 307 | if (modules_sym == sym) | ||
| 308 | modules_val = modules_sym->curr.tri; | ||
| 309 | |||
| 310 | if (sym_is_choice(sym)) { | ||
| 311 | int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); | ||
| 312 | prop = sym_get_choice_prop(sym); | ||
| 313 | for (e = prop->expr; e; e = e->left.expr) { | ||
| 314 | e->right.sym->flags |= flags; | ||
| 315 | if (flags & SYMBOL_CHANGED) | ||
| 316 | sym_set_changed(e->right.sym); | ||
| 317 | } | ||
| 318 | } | ||
| 319 | } | ||
| 320 | |||
| 321 | void sym_clear_all_valid(void) | ||
| 322 | { | ||
| 323 | struct symbol *sym; | ||
| 324 | int i; | ||
| 325 | |||
| 326 | for_all_symbols(i, sym) | ||
| 327 | sym->flags &= ~SYMBOL_VALID; | ||
| 328 | sym_change_count++; | ||
| 329 | if (modules_sym) | ||
| 330 | sym_calc_value(modules_sym); | ||
| 331 | } | ||
| 332 | |||
| 333 | void sym_set_changed(struct symbol *sym) | ||
| 334 | { | ||
| 335 | struct property *prop; | ||
| 336 | |||
| 337 | sym->flags |= SYMBOL_CHANGED; | ||
| 338 | for (prop = sym->prop; prop; prop = prop->next) { | ||
| 339 | if (prop->menu) | ||
| 340 | prop->menu->flags |= MENU_CHANGED; | ||
| 341 | } | ||
| 342 | } | ||
| 343 | |||
| 344 | void sym_set_all_changed(void) | ||
| 345 | { | ||
| 346 | struct symbol *sym; | ||
| 347 | int i; | ||
| 348 | |||
| 349 | for_all_symbols(i, sym) | ||
| 350 | sym_set_changed(sym); | ||
| 351 | } | ||
| 352 | |||
| 353 | bool sym_tristate_within_range(struct symbol *sym, tristate val) | ||
| 354 | { | ||
| 355 | int type = sym_get_type(sym); | ||
| 356 | |||
| 357 | if (sym->visible == no) | ||
| 358 | return false; | ||
| 359 | |||
| 360 | if (type != S_BOOLEAN && type != S_TRISTATE) | ||
| 361 | return false; | ||
| 362 | |||
| 363 | if (type == S_BOOLEAN && val == mod) | ||
| 364 | return false; | ||
| 365 | if (sym->visible <= sym->rev_dep.tri) | ||
| 366 | return false; | ||
| 367 | if (sym_is_choice_value(sym) && sym->visible == yes) | ||
| 368 | return val == yes; | ||
| 369 | return val >= sym->rev_dep.tri && val <= sym->visible; | ||
| 370 | } | ||
| 371 | |||
| 372 | bool sym_set_tristate_value(struct symbol *sym, tristate val) | ||
| 373 | { | ||
| 374 | tristate oldval = sym_get_tristate_value(sym); | ||
| 375 | |||
| 376 | if (oldval != val && !sym_tristate_within_range(sym, val)) | ||
| 377 | return false; | ||
| 378 | |||
| 379 | if (sym->flags & SYMBOL_NEW) { | ||
| 380 | sym->flags &= ~SYMBOL_NEW; | ||
| 381 | sym_set_changed(sym); | ||
| 382 | } | ||
| 383 | if (sym_is_choice_value(sym) && val == yes) { | ||
| 384 | struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); | ||
| 385 | |||
| 386 | cs->user.val = sym; | ||
| 387 | cs->flags &= ~SYMBOL_NEW; | ||
| 388 | } | ||
| 389 | |||
| 390 | sym->user.tri = val; | ||
| 391 | if (oldval != val) { | ||
| 392 | sym_clear_all_valid(); | ||
| 393 | if (sym == modules_sym) | ||
| 394 | sym_set_all_changed(); | ||
| 395 | } | ||
| 396 | |||
| 397 | return true; | ||
| 398 | } | ||
| 399 | |||
| 400 | tristate sym_toggle_tristate_value(struct symbol *sym) | ||
| 401 | { | ||
| 402 | tristate oldval, newval; | ||
| 403 | |||
| 404 | oldval = newval = sym_get_tristate_value(sym); | ||
| 405 | do { | ||
| 406 | switch (newval) { | ||
| 407 | case no: | ||
| 408 | newval = mod; | ||
| 409 | break; | ||
| 410 | case mod: | ||
| 411 | newval = yes; | ||
| 412 | break; | ||
| 413 | case yes: | ||
| 414 | newval = no; | ||
| 415 | break; | ||
| 416 | } | ||
| 417 | if (sym_set_tristate_value(sym, newval)) | ||
| 418 | break; | ||
| 419 | } while (oldval != newval); | ||
| 420 | return newval; | ||
| 421 | } | ||
| 422 | |||
| 423 | bool sym_string_valid(struct symbol *sym, const char *str) | ||
| 424 | { | ||
| 425 | signed char ch; | ||
| 426 | |||
| 427 | switch (sym->type) { | ||
| 428 | case S_STRING: | ||
| 429 | return true; | ||
| 430 | case S_INT: | ||
| 431 | ch = *str++; | ||
| 432 | if (ch == '-') | ||
| 433 | ch = *str++; | ||
| 434 | if (!isdigit(ch)) | ||
| 435 | return false; | ||
| 436 | if (ch == '0' && *str != 0) | ||
| 437 | return false; | ||
| 438 | while ((ch = *str++)) { | ||
| 439 | if (!isdigit(ch)) | ||
| 440 | return false; | ||
| 441 | } | ||
| 442 | return true; | ||
| 443 | case S_HEX: | ||
| 444 | if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) | ||
| 445 | str += 2; | ||
| 446 | ch = *str++; | ||
| 447 | do { | ||
| 448 | if (!isxdigit(ch)) | ||
| 449 | return false; | ||
| 450 | } while ((ch = *str++)); | ||
| 451 | return true; | ||
| 452 | case S_BOOLEAN: | ||
| 453 | case S_TRISTATE: | ||
| 454 | switch (str[0]) { | ||
| 455 | case 'y': case 'Y': | ||
| 456 | case 'm': case 'M': | ||
| 457 | case 'n': case 'N': | ||
| 458 | return true; | ||
| 459 | } | ||
| 460 | return false; | ||
| 461 | default: | ||
| 462 | return false; | ||
| 463 | } | ||
| 464 | } | ||
| 465 | |||
| 466 | bool sym_string_within_range(struct symbol *sym, const char *str) | ||
| 467 | { | ||
| 468 | struct property *prop; | ||
| 469 | int val; | ||
| 470 | |||
| 471 | switch (sym->type) { | ||
| 472 | case S_STRING: | ||
| 473 | return sym_string_valid(sym, str); | ||
| 474 | case S_INT: | ||
| 475 | if (!sym_string_valid(sym, str)) | ||
| 476 | return false; | ||
| 477 | prop = sym_get_range_prop(sym); | ||
| 478 | if (!prop) | ||
| 479 | return true; | ||
| 480 | val = strtol(str, NULL, 10); | ||
| 481 | return val >= strtol(prop->expr->left.sym->name, NULL, 10) && | ||
| 482 | val <= strtol(prop->expr->right.sym->name, NULL, 10); | ||
| 483 | case S_HEX: | ||
| 484 | if (!sym_string_valid(sym, str)) | ||
| 485 | return false; | ||
| 486 | prop = sym_get_range_prop(sym); | ||
| 487 | if (!prop) | ||
| 488 | return true; | ||
| 489 | val = strtol(str, NULL, 16); | ||
| 490 | return val >= strtol(prop->expr->left.sym->name, NULL, 16) && | ||
| 491 | val <= strtol(prop->expr->right.sym->name, NULL, 16); | ||
| 492 | case S_BOOLEAN: | ||
| 493 | case S_TRISTATE: | ||
| 494 | switch (str[0]) { | ||
| 495 | case 'y': case 'Y': | ||
| 496 | return sym_tristate_within_range(sym, yes); | ||
| 497 | case 'm': case 'M': | ||
| 498 | return sym_tristate_within_range(sym, mod); | ||
| 499 | case 'n': case 'N': | ||
| 500 | return sym_tristate_within_range(sym, no); | ||
| 501 | } | ||
| 502 | return false; | ||
| 503 | default: | ||
| 504 | return false; | ||
| 505 | } | ||
| 506 | } | ||
| 507 | |||
| 508 | bool sym_set_string_value(struct symbol *sym, const char *newval) | ||
| 509 | { | ||
| 510 | const char *oldval; | ||
| 511 | char *val; | ||
| 512 | int size; | ||
| 513 | |||
| 514 | switch (sym->type) { | ||
| 515 | case S_BOOLEAN: | ||
| 516 | case S_TRISTATE: | ||
| 517 | switch (newval[0]) { | ||
| 518 | case 'y': case 'Y': | ||
| 519 | return sym_set_tristate_value(sym, yes); | ||
| 520 | case 'm': case 'M': | ||
| 521 | return sym_set_tristate_value(sym, mod); | ||
| 522 | case 'n': case 'N': | ||
| 523 | return sym_set_tristate_value(sym, no); | ||
| 524 | } | ||
| 525 | return false; | ||
| 526 | default: | ||
| 527 | ; | ||
| 528 | } | ||
| 529 | |||
| 530 | if (!sym_string_within_range(sym, newval)) | ||
| 531 | return false; | ||
| 532 | |||
| 533 | if (sym->flags & SYMBOL_NEW) { | ||
| 534 | sym->flags &= ~SYMBOL_NEW; | ||
| 535 | sym_set_changed(sym); | ||
| 536 | } | ||
| 537 | |||
| 538 | oldval = sym->user.val; | ||
| 539 | size = strlen(newval) + 1; | ||
| 540 | if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { | ||
| 541 | size += 2; | ||
| 542 | sym->user.val = val = malloc(size); | ||
| 543 | *val++ = '0'; | ||
| 544 | *val++ = 'x'; | ||
| 545 | } else if (!oldval || strcmp(oldval, newval)) | ||
| 546 | sym->user.val = val = malloc(size); | ||
| 547 | else | ||
| 548 | return true; | ||
| 549 | |||
| 550 | strcpy(val, newval); | ||
| 551 | free((void *)oldval); | ||
| 552 | sym_clear_all_valid(); | ||
| 553 | |||
| 554 | return true; | ||
| 555 | } | ||
| 556 | |||
| 557 | const char *sym_get_string_value(struct symbol *sym) | ||
| 558 | { | ||
| 559 | tristate val; | ||
| 560 | |||
| 561 | switch (sym->type) { | ||
| 562 | case S_BOOLEAN: | ||
| 563 | case S_TRISTATE: | ||
| 564 | val = sym_get_tristate_value(sym); | ||
| 565 | switch (val) { | ||
| 566 | case no: | ||
| 567 | return "n"; | ||
| 568 | case mod: | ||
| 569 | return "m"; | ||
| 570 | case yes: | ||
| 571 | return "y"; | ||
| 572 | } | ||
| 573 | break; | ||
| 574 | default: | ||
| 575 | ; | ||
| 576 | } | ||
| 577 | return (const char *)sym->curr.val; | ||
| 578 | } | ||
| 579 | |||
| 580 | bool sym_is_changable(struct symbol *sym) | ||
| 581 | { | ||
| 582 | return sym->visible > sym->rev_dep.tri; | ||
| 583 | } | ||
| 584 | |||
| 585 | struct symbol *sym_lookup(const char *name, int isconst) | ||
| 586 | { | ||
| 587 | struct symbol *symbol; | ||
| 588 | const char *ptr; | ||
| 589 | char *new_name; | ||
| 590 | int hash = 0; | ||
| 591 | |||
| 592 | if (name) { | ||
| 593 | if (name[0] && !name[1]) { | ||
| 594 | switch (name[0]) { | ||
| 595 | case 'y': return &symbol_yes; | ||
| 596 | case 'm': return &symbol_mod; | ||
| 597 | case 'n': return &symbol_no; | ||
| 598 | } | ||
| 599 | } | ||
| 600 | for (ptr = name; *ptr; ptr++) | ||
| 601 | hash += *ptr; | ||
| 602 | hash &= 0xff; | ||
| 603 | |||
| 604 | for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { | ||
| 605 | if (!strcmp(symbol->name, name)) { | ||
| 606 | if ((isconst && symbol->flags & SYMBOL_CONST) || | ||
| 607 | (!isconst && !(symbol->flags & SYMBOL_CONST))) | ||
| 608 | return symbol; | ||
| 609 | } | ||
| 610 | } | ||
| 611 | new_name = strdup(name); | ||
| 612 | } else { | ||
| 613 | new_name = NULL; | ||
| 614 | hash = 256; | ||
| 615 | } | ||
| 616 | |||
| 617 | symbol = malloc(sizeof(*symbol)); | ||
| 618 | memset(symbol, 0, sizeof(*symbol)); | ||
| 619 | symbol->name = new_name; | ||
| 620 | symbol->type = S_UNKNOWN; | ||
| 621 | symbol->flags = SYMBOL_NEW; | ||
| 622 | if (isconst) | ||
| 623 | symbol->flags |= SYMBOL_CONST; | ||
| 624 | |||
| 625 | symbol->next = symbol_hash[hash]; | ||
| 626 | symbol_hash[hash] = symbol; | ||
| 627 | |||
| 628 | return symbol; | ||
| 629 | } | ||
| 630 | |||
| 631 | struct symbol *sym_find(const char *name) | ||
| 632 | { | ||
| 633 | struct symbol *symbol = NULL; | ||
| 634 | const char *ptr; | ||
| 635 | int hash = 0; | ||
| 636 | |||
| 637 | if (!name) | ||
| 638 | return NULL; | ||
| 639 | |||
| 640 | if (name[0] && !name[1]) { | ||
| 641 | switch (name[0]) { | ||
| 642 | case 'y': return &symbol_yes; | ||
| 643 | case 'm': return &symbol_mod; | ||
| 644 | case 'n': return &symbol_no; | ||
| 645 | } | ||
| 646 | } | ||
| 647 | for (ptr = name; *ptr; ptr++) | ||
| 648 | hash += *ptr; | ||
| 649 | hash &= 0xff; | ||
| 650 | |||
| 651 | for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { | ||
| 652 | if (!strcmp(symbol->name, name) && | ||
| 653 | !(symbol->flags & SYMBOL_CONST)) | ||
| 654 | break; | ||
| 655 | } | ||
| 656 | |||
| 657 | return symbol; | ||
| 658 | } | ||
| 659 | |||
| 660 | struct symbol **sym_re_search(const char *pattern) | ||
| 661 | { | ||
| 662 | struct symbol *sym, **sym_arr = NULL; | ||
| 663 | int i, cnt, size; | ||
| 664 | regex_t re; | ||
| 665 | |||
| 666 | cnt = size = 0; | ||
| 667 | /* Skip if empty */ | ||
| 668 | if (strlen(pattern) == 0) | ||
| 669 | return NULL; | ||
| 670 | if (regcomp(&re, pattern, REG_EXTENDED|REG_NOSUB|REG_ICASE)) | ||
| 671 | return NULL; | ||
| 672 | |||
| 673 | for_all_symbols(i, sym) { | ||
| 674 | if (sym->flags & SYMBOL_CONST || !sym->name) | ||
| 675 | continue; | ||
| 676 | if (regexec(&re, sym->name, 0, NULL, 0)) | ||
| 677 | continue; | ||
| 678 | if (cnt + 1 >= size) { | ||
| 679 | void *tmp = sym_arr; | ||
| 680 | size += 16; | ||
| 681 | sym_arr = realloc(sym_arr, size * sizeof(struct symbol *)); | ||
| 682 | if (!sym_arr) { | ||
| 683 | free(tmp); | ||
| 684 | return NULL; | ||
| 685 | } | ||
| 686 | } | ||
| 687 | sym_arr[cnt++] = sym; | ||
| 688 | } | ||
| 689 | if (sym_arr) | ||
| 690 | sym_arr[cnt] = NULL; | ||
| 691 | regfree(&re); | ||
| 692 | |||
| 693 | return sym_arr; | ||
| 694 | } | ||
| 695 | |||
| 696 | |||
| 697 | struct symbol *sym_check_deps(struct symbol *sym); | ||
| 698 | |||
| 699 | static struct symbol *sym_check_expr_deps(struct expr *e) | ||
| 700 | { | ||
| 701 | struct symbol *sym; | ||
| 702 | |||
| 703 | if (!e) | ||
| 704 | return NULL; | ||
| 705 | switch (e->type) { | ||
| 706 | case E_OR: | ||
| 707 | case E_AND: | ||
| 708 | sym = sym_check_expr_deps(e->left.expr); | ||
| 709 | if (sym) | ||
| 710 | return sym; | ||
| 711 | return sym_check_expr_deps(e->right.expr); | ||
| 712 | case E_NOT: | ||
| 713 | return sym_check_expr_deps(e->left.expr); | ||
| 714 | case E_EQUAL: | ||
| 715 | case E_UNEQUAL: | ||
| 716 | sym = sym_check_deps(e->left.sym); | ||
| 717 | if (sym) | ||
| 718 | return sym; | ||
| 719 | return sym_check_deps(e->right.sym); | ||
| 720 | case E_SYMBOL: | ||
| 721 | return sym_check_deps(e->left.sym); | ||
| 722 | default: | ||
| 723 | break; | ||
| 724 | } | ||
| 725 | printf("Oops! How to check %d?\n", e->type); | ||
| 726 | return NULL; | ||
| 727 | } | ||
| 728 | |||
| 729 | struct symbol *sym_check_deps(struct symbol *sym) | ||
| 730 | { | ||
| 731 | struct symbol *sym2; | ||
| 732 | struct property *prop; | ||
| 733 | |||
| 734 | if (sym->flags & SYMBOL_CHECK_DONE) | ||
| 735 | return NULL; | ||
| 736 | if (sym->flags & SYMBOL_CHECK) { | ||
| 737 | printf("Warning! Found recursive dependency: %s", sym->name); | ||
| 738 | return sym; | ||
| 739 | } | ||
| 740 | |||
| 741 | sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED); | ||
| 742 | sym2 = sym_check_expr_deps(sym->rev_dep.expr); | ||
| 743 | if (sym2) | ||
| 744 | goto out; | ||
| 745 | |||
| 746 | for (prop = sym->prop; prop; prop = prop->next) { | ||
| 747 | if (prop->type == P_CHOICE || prop->type == P_SELECT) | ||
| 748 | continue; | ||
| 749 | sym2 = sym_check_expr_deps(prop->visible.expr); | ||
| 750 | if (sym2) | ||
| 751 | goto out; | ||
| 752 | if (prop->type != P_DEFAULT || sym_is_choice(sym)) | ||
| 753 | continue; | ||
| 754 | sym2 = sym_check_expr_deps(prop->expr); | ||
| 755 | if (sym2) | ||
| 756 | goto out; | ||
| 757 | } | ||
| 758 | out: | ||
| 759 | if (sym2) | ||
| 760 | printf(" %s", sym->name); | ||
| 761 | sym->flags &= ~SYMBOL_CHECK; | ||
| 762 | return sym2; | ||
| 763 | } | ||
| 764 | |||
| 765 | struct property *prop_alloc(enum prop_type type, struct symbol *sym) | ||
| 766 | { | ||
| 767 | struct property *prop; | ||
| 768 | struct property **propp; | ||
| 769 | |||
| 770 | prop = malloc(sizeof(*prop)); | ||
| 771 | memset(prop, 0, sizeof(*prop)); | ||
| 772 | prop->type = type; | ||
| 773 | prop->sym = sym; | ||
| 774 | prop->file = current_file; | ||
| 775 | prop->lineno = zconf_lineno(); | ||
| 776 | |||
| 777 | /* append property to the prop list of symbol */ | ||
| 778 | if (sym) { | ||
| 779 | for (propp = &sym->prop; *propp; propp = &(*propp)->next) | ||
| 780 | ; | ||
| 781 | *propp = prop; | ||
| 782 | } | ||
| 783 | |||
| 784 | return prop; | ||
| 785 | } | ||
| 786 | |||
| 787 | struct symbol *prop_get_symbol(struct property *prop) | ||
| 788 | { | ||
| 789 | if (prop->expr && (prop->expr->type == E_SYMBOL || | ||
| 790 | prop->expr->type == E_CHOICE)) | ||
| 791 | return prop->expr->left.sym; | ||
| 792 | return NULL; | ||
| 793 | } | ||
| 794 | |||
| 795 | const char *prop_get_type_name(enum prop_type type) | ||
| 796 | { | ||
| 797 | switch (type) { | ||
| 798 | case P_PROMPT: | ||
| 799 | return "prompt"; | ||
| 800 | case P_COMMENT: | ||
| 801 | return "comment"; | ||
| 802 | case P_MENU: | ||
| 803 | return "menu"; | ||
| 804 | case P_DEFAULT: | ||
| 805 | return "default"; | ||
| 806 | case P_CHOICE: | ||
| 807 | return "choice"; | ||
| 808 | case P_SELECT: | ||
| 809 | return "select"; | ||
| 810 | case P_RANGE: | ||
| 811 | return "range"; | ||
| 812 | case P_UNKNOWN: | ||
| 813 | break; | ||
| 814 | } | ||
| 815 | return "unknown"; | ||
| 816 | } | ||
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c new file mode 100644 index 000000000000..1fa4c0b801b3 --- /dev/null +++ b/scripts/kconfig/util.c | |||
| @@ -0,0 +1,109 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002-2005 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Copyright (C) 2002-2005 Sam Ravnborg <sam@ravnborg.org> | ||
| 4 | * | ||
| 5 | * Released under the terms of the GNU GPL v2.0. | ||
| 6 | */ | ||
| 7 | |||
| 8 | #include <string.h> | ||
| 9 | #include "lkc.h" | ||
| 10 | |||
| 11 | /* file already present in list? If not add it */ | ||
| 12 | struct file *file_lookup(const char *name) | ||
| 13 | { | ||
| 14 | struct file *file; | ||
| 15 | |||
| 16 | for (file = file_list; file; file = file->next) { | ||
| 17 | if (!strcmp(name, file->name)) | ||
| 18 | return file; | ||
| 19 | } | ||
| 20 | |||
| 21 | file = malloc(sizeof(*file)); | ||
| 22 | memset(file, 0, sizeof(*file)); | ||
| 23 | file->name = strdup(name); | ||
| 24 | file->next = file_list; | ||
| 25 | file_list = file; | ||
| 26 | return file; | ||
| 27 | } | ||
| 28 | |||
| 29 | /* write a dependency file as used by kbuild to track dependencies */ | ||
| 30 | int file_write_dep(const char *name) | ||
| 31 | { | ||
| 32 | struct file *file; | ||
| 33 | FILE *out; | ||
| 34 | |||
| 35 | if (!name) | ||
| 36 | name = ".config.cmd"; | ||
| 37 | out = fopen("..config.tmp", "w"); | ||
| 38 | if (!out) | ||
| 39 | return 1; | ||
| 40 | fprintf(out, "deps_config := \\\n"); | ||
| 41 | for (file = file_list; file; file = file->next) { | ||
| 42 | if (file->next) | ||
| 43 | fprintf(out, "\t%s \\\n", file->name); | ||
| 44 | else | ||
| 45 | fprintf(out, "\t%s\n", file->name); | ||
| 46 | } | ||
| 47 | fprintf(out, "\n.config include/linux/autoconf.h: $(deps_config)\n\n$(deps_config):\n"); | ||
| 48 | fclose(out); | ||
| 49 | rename("..config.tmp", name); | ||
| 50 | return 0; | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | /* Allocate initial growable sting */ | ||
| 55 | struct gstr str_new(void) | ||
| 56 | { | ||
| 57 | struct gstr gs; | ||
| 58 | gs.s = malloc(sizeof(char) * 64); | ||
| 59 | gs.len = 16; | ||
| 60 | strcpy(gs.s, "\0"); | ||
| 61 | return gs; | ||
| 62 | } | ||
| 63 | |||
| 64 | /* Allocate and assign growable string */ | ||
| 65 | struct gstr str_assign(const char *s) | ||
| 66 | { | ||
| 67 | struct gstr gs; | ||
| 68 | gs.s = strdup(s); | ||
| 69 | gs.len = strlen(s) + 1; | ||
| 70 | return gs; | ||
| 71 | } | ||
| 72 | |||
| 73 | /* Free storage for growable string */ | ||
| 74 | void str_free(struct gstr *gs) | ||
| 75 | { | ||
| 76 | if (gs->s) | ||
| 77 | free(gs->s); | ||
| 78 | gs->s = NULL; | ||
| 79 | gs->len = 0; | ||
| 80 | } | ||
| 81 | |||
| 82 | /* Append to growable string */ | ||
| 83 | void str_append(struct gstr *gs, const char *s) | ||
| 84 | { | ||
| 85 | size_t l = strlen(gs->s) + strlen(s) + 1; | ||
| 86 | if (l > gs->len) { | ||
| 87 | gs->s = realloc(gs->s, l); | ||
| 88 | gs->len = l; | ||
| 89 | } | ||
| 90 | strcat(gs->s, s); | ||
| 91 | } | ||
| 92 | |||
| 93 | /* Append printf formatted string to growable string */ | ||
| 94 | void str_printf(struct gstr *gs, const char *fmt, ...) | ||
| 95 | { | ||
| 96 | va_list ap; | ||
| 97 | char s[10000]; /* big enough... */ | ||
| 98 | va_start(ap, fmt); | ||
| 99 | vsnprintf(s, sizeof(s), fmt, ap); | ||
| 100 | str_append(gs, s); | ||
| 101 | va_end(ap); | ||
| 102 | } | ||
| 103 | |||
| 104 | /* Retreive value of growable string */ | ||
| 105 | const char *str_get(struct gstr *gs) | ||
| 106 | { | ||
| 107 | return gs->s; | ||
| 108 | } | ||
| 109 | |||
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l new file mode 100644 index 000000000000..55517b2877cd --- /dev/null +++ b/scripts/kconfig/zconf.l | |||
| @@ -0,0 +1,366 @@ | |||
| 1 | %option backup nostdinit noyywrap never-interactive full ecs | ||
| 2 | %option 8bit backup nodefault perf-report perf-report | ||
| 3 | %x COMMAND HELP STRING PARAM | ||
| 4 | %{ | ||
| 5 | /* | ||
| 6 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 7 | * Released under the terms of the GNU GPL v2.0. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <limits.h> | ||
| 11 | #include <stdio.h> | ||
| 12 | #include <stdlib.h> | ||
| 13 | #include <string.h> | ||
| 14 | #include <unistd.h> | ||
| 15 | |||
| 16 | #define LKC_DIRECT_LINK | ||
| 17 | #include "lkc.h" | ||
| 18 | |||
| 19 | #define START_STRSIZE 16 | ||
| 20 | |||
| 21 | char *text; | ||
| 22 | static char *text_ptr; | ||
| 23 | static int text_size, text_asize; | ||
| 24 | |||
| 25 | struct buffer { | ||
| 26 | struct buffer *parent; | ||
| 27 | YY_BUFFER_STATE state; | ||
| 28 | }; | ||
| 29 | |||
| 30 | struct buffer *current_buf; | ||
| 31 | |||
| 32 | static int last_ts, first_ts; | ||
| 33 | |||
| 34 | static void zconf_endhelp(void); | ||
| 35 | static struct buffer *zconf_endfile(void); | ||
| 36 | |||
| 37 | void new_string(void) | ||
| 38 | { | ||
| 39 | text = malloc(START_STRSIZE); | ||
| 40 | text_asize = START_STRSIZE; | ||
| 41 | text_ptr = text; | ||
| 42 | text_size = 0; | ||
| 43 | *text_ptr = 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | void append_string(const char *str, int size) | ||
| 47 | { | ||
| 48 | int new_size = text_size + size + 1; | ||
| 49 | if (new_size > text_asize) { | ||
| 50 | text = realloc(text, new_size); | ||
| 51 | text_asize = new_size; | ||
| 52 | text_ptr = text + text_size; | ||
| 53 | } | ||
| 54 | memcpy(text_ptr, str, size); | ||
| 55 | text_ptr += size; | ||
| 56 | text_size += size; | ||
| 57 | *text_ptr = 0; | ||
| 58 | } | ||
| 59 | |||
| 60 | void alloc_string(const char *str, int size) | ||
| 61 | { | ||
| 62 | text = malloc(size + 1); | ||
| 63 | memcpy(text, str, size); | ||
| 64 | text[size] = 0; | ||
| 65 | } | ||
| 66 | %} | ||
| 67 | |||
| 68 | ws [ \n\t] | ||
| 69 | n [A-Za-z0-9_] | ||
| 70 | |||
| 71 | %% | ||
| 72 | int str = 0; | ||
| 73 | int ts, i; | ||
| 74 | |||
| 75 | [ \t]*#.*\n current_file->lineno++; | ||
| 76 | [ \t]*#.* | ||
| 77 | |||
| 78 | [ \t]*\n current_file->lineno++; return T_EOL; | ||
| 79 | |||
| 80 | [ \t]+ { | ||
| 81 | BEGIN(COMMAND); | ||
| 82 | } | ||
| 83 | |||
| 84 | . { | ||
| 85 | unput(yytext[0]); | ||
| 86 | BEGIN(COMMAND); | ||
| 87 | } | ||
| 88 | |||
| 89 | |||
| 90 | <COMMAND>{ | ||
| 91 | "mainmenu" BEGIN(PARAM); return T_MAINMENU; | ||
| 92 | "menu" BEGIN(PARAM); return T_MENU; | ||
| 93 | "endmenu" BEGIN(PARAM); return T_ENDMENU; | ||
| 94 | "source" BEGIN(PARAM); return T_SOURCE; | ||
| 95 | "choice" BEGIN(PARAM); return T_CHOICE; | ||
| 96 | "endchoice" BEGIN(PARAM); return T_ENDCHOICE; | ||
| 97 | "comment" BEGIN(PARAM); return T_COMMENT; | ||
| 98 | "config" BEGIN(PARAM); return T_CONFIG; | ||
| 99 | "menuconfig" BEGIN(PARAM); return T_MENUCONFIG; | ||
| 100 | "help" BEGIN(PARAM); return T_HELP; | ||
| 101 | "if" BEGIN(PARAM); return T_IF; | ||
| 102 | "endif" BEGIN(PARAM); return T_ENDIF; | ||
| 103 | "depends" BEGIN(PARAM); return T_DEPENDS; | ||
| 104 | "requires" BEGIN(PARAM); return T_REQUIRES; | ||
| 105 | "optional" BEGIN(PARAM); return T_OPTIONAL; | ||
| 106 | "default" BEGIN(PARAM); return T_DEFAULT; | ||
| 107 | "prompt" BEGIN(PARAM); return T_PROMPT; | ||
| 108 | "tristate" BEGIN(PARAM); return T_TRISTATE; | ||
| 109 | "def_tristate" BEGIN(PARAM); return T_DEF_TRISTATE; | ||
| 110 | "bool" BEGIN(PARAM); return T_BOOLEAN; | ||
| 111 | "boolean" BEGIN(PARAM); return T_BOOLEAN; | ||
| 112 | "def_bool" BEGIN(PARAM); return T_DEF_BOOLEAN; | ||
| 113 | "def_boolean" BEGIN(PARAM); return T_DEF_BOOLEAN; | ||
| 114 | "int" BEGIN(PARAM); return T_INT; | ||
| 115 | "hex" BEGIN(PARAM); return T_HEX; | ||
| 116 | "string" BEGIN(PARAM); return T_STRING; | ||
| 117 | "select" BEGIN(PARAM); return T_SELECT; | ||
| 118 | "enable" BEGIN(PARAM); return T_SELECT; | ||
| 119 | "range" BEGIN(PARAM); return T_RANGE; | ||
| 120 | {n}+ { | ||
| 121 | alloc_string(yytext, yyleng); | ||
| 122 | zconflval.string = text; | ||
| 123 | return T_WORD; | ||
| 124 | } | ||
| 125 | . | ||
| 126 | \n current_file->lineno++; BEGIN(INITIAL); | ||
| 127 | } | ||
| 128 | |||
| 129 | <PARAM>{ | ||
| 130 | "&&" return T_AND; | ||
| 131 | "||" return T_OR; | ||
| 132 | "(" return T_OPEN_PAREN; | ||
| 133 | ")" return T_CLOSE_PAREN; | ||
| 134 | "!" return T_NOT; | ||
| 135 | "=" return T_EQUAL; | ||
| 136 | "!=" return T_UNEQUAL; | ||
| 137 | "if" return T_IF; | ||
| 138 | "on" return T_ON; | ||
| 139 | \"|\' { | ||
| 140 | str = yytext[0]; | ||
| 141 | new_string(); | ||
| 142 | BEGIN(STRING); | ||
| 143 | } | ||
| 144 | \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; | ||
| 145 | --- /* ignore */ | ||
| 146 | ({n}|[-/.])+ { | ||
| 147 | alloc_string(yytext, yyleng); | ||
| 148 | zconflval.string = text; | ||
| 149 | return T_WORD; | ||
| 150 | } | ||
| 151 | #.* /* comment */ | ||
| 152 | \\\n current_file->lineno++; | ||
| 153 | . | ||
| 154 | <<EOF>> { | ||
| 155 | BEGIN(INITIAL); | ||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | <STRING>{ | ||
| 160 | [^'"\\\n]+/\n { | ||
| 161 | append_string(yytext, yyleng); | ||
| 162 | zconflval.string = text; | ||
| 163 | return T_WORD_QUOTE; | ||
| 164 | } | ||
| 165 | [^'"\\\n]+ { | ||
| 166 | append_string(yytext, yyleng); | ||
| 167 | } | ||
| 168 | \\.?/\n { | ||
| 169 | append_string(yytext + 1, yyleng - 1); | ||
| 170 | zconflval.string = text; | ||
| 171 | return T_WORD_QUOTE; | ||
| 172 | } | ||
| 173 | \\.? { | ||
| 174 | append_string(yytext + 1, yyleng - 1); | ||
| 175 | } | ||
| 176 | \'|\" { | ||
| 177 | if (str == yytext[0]) { | ||
| 178 | BEGIN(PARAM); | ||
| 179 | zconflval.string = text; | ||
| 180 | return T_WORD_QUOTE; | ||
| 181 | } else | ||
| 182 | append_string(yytext, 1); | ||
| 183 | } | ||
| 184 | \n { | ||
| 185 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); | ||
| 186 | current_file->lineno++; | ||
| 187 | BEGIN(INITIAL); | ||
| 188 | return T_EOL; | ||
| 189 | } | ||
| 190 | <<EOF>> { | ||
| 191 | BEGIN(INITIAL); | ||
| 192 | } | ||
| 193 | } | ||
| 194 | |||
| 195 | <HELP>{ | ||
| 196 | [ \t]+ { | ||
| 197 | ts = 0; | ||
| 198 | for (i = 0; i < yyleng; i++) { | ||
| 199 | if (yytext[i] == '\t') | ||
| 200 | ts = (ts & ~7) + 8; | ||
| 201 | else | ||
| 202 | ts++; | ||
| 203 | } | ||
| 204 | last_ts = ts; | ||
| 205 | if (first_ts) { | ||
| 206 | if (ts < first_ts) { | ||
| 207 | zconf_endhelp(); | ||
| 208 | return T_HELPTEXT; | ||
| 209 | } | ||
| 210 | ts -= first_ts; | ||
| 211 | while (ts > 8) { | ||
| 212 | append_string(" ", 8); | ||
| 213 | ts -= 8; | ||
| 214 | } | ||
| 215 | append_string(" ", ts); | ||
| 216 | } | ||
| 217 | } | ||
| 218 | [ \t]*\n/[^ \t\n] { | ||
| 219 | current_file->lineno++; | ||
| 220 | zconf_endhelp(); | ||
| 221 | return T_HELPTEXT; | ||
| 222 | } | ||
| 223 | [ \t]*\n { | ||
| 224 | current_file->lineno++; | ||
| 225 | append_string("\n", 1); | ||
| 226 | } | ||
| 227 | [^ \t\n].* { | ||
| 228 | append_string(yytext, yyleng); | ||
| 229 | if (!first_ts) | ||
| 230 | first_ts = last_ts; | ||
| 231 | } | ||
| 232 | <<EOF>> { | ||
| 233 | zconf_endhelp(); | ||
| 234 | return T_HELPTEXT; | ||
| 235 | } | ||
| 236 | } | ||
| 237 | |||
| 238 | <<EOF>> { | ||
| 239 | if (current_buf) { | ||
| 240 | zconf_endfile(); | ||
| 241 | return T_EOF; | ||
| 242 | } | ||
| 243 | fclose(yyin); | ||
| 244 | yyterminate(); | ||
| 245 | } | ||
| 246 | |||
| 247 | %% | ||
| 248 | void zconf_starthelp(void) | ||
| 249 | { | ||
| 250 | new_string(); | ||
| 251 | last_ts = first_ts = 0; | ||
| 252 | BEGIN(HELP); | ||
| 253 | } | ||
| 254 | |||
| 255 | static void zconf_endhelp(void) | ||
| 256 | { | ||
| 257 | zconflval.string = text; | ||
| 258 | BEGIN(INITIAL); | ||
| 259 | } | ||
| 260 | |||
| 261 | |||
| 262 | /* | ||
| 263 | * Try to open specified file with following names: | ||
| 264 | * ./name | ||
| 265 | * $(srctree)/name | ||
| 266 | * The latter is used when srctree is separate from objtree | ||
| 267 | * when compiling the kernel. | ||
| 268 | * Return NULL if file is not found. | ||
| 269 | */ | ||
| 270 | FILE *zconf_fopen(const char *name) | ||
| 271 | { | ||
| 272 | char *env, fullname[PATH_MAX+1]; | ||
| 273 | FILE *f; | ||
| 274 | |||
| 275 | f = fopen(name, "r"); | ||
| 276 | if (!f && name[0] != '/') { | ||
| 277 | env = getenv(SRCTREE); | ||
| 278 | if (env) { | ||
| 279 | sprintf(fullname, "%s/%s", env, name); | ||
| 280 | f = fopen(fullname, "r"); | ||
| 281 | } | ||
| 282 | } | ||
| 283 | return f; | ||
| 284 | } | ||
| 285 | |||
| 286 | void zconf_initscan(const char *name) | ||
| 287 | { | ||
| 288 | yyin = zconf_fopen(name); | ||
| 289 | if (!yyin) { | ||
| 290 | printf("can't find file %s\n", name); | ||
| 291 | exit(1); | ||
| 292 | } | ||
| 293 | |||
| 294 | current_buf = malloc(sizeof(*current_buf)); | ||
| 295 | memset(current_buf, 0, sizeof(*current_buf)); | ||
| 296 | |||
| 297 | current_file = file_lookup(name); | ||
| 298 | current_file->lineno = 1; | ||
| 299 | current_file->flags = FILE_BUSY; | ||
| 300 | } | ||
| 301 | |||
| 302 | void zconf_nextfile(const char *name) | ||
| 303 | { | ||
| 304 | struct file *file = file_lookup(name); | ||
| 305 | struct buffer *buf = malloc(sizeof(*buf)); | ||
| 306 | memset(buf, 0, sizeof(*buf)); | ||
| 307 | |||
| 308 | current_buf->state = YY_CURRENT_BUFFER; | ||
| 309 | yyin = zconf_fopen(name); | ||
| 310 | if (!yyin) { | ||
| 311 | printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); | ||
| 312 | exit(1); | ||
| 313 | } | ||
| 314 | yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); | ||
| 315 | buf->parent = current_buf; | ||
| 316 | current_buf = buf; | ||
| 317 | |||
| 318 | if (file->flags & FILE_BUSY) { | ||
| 319 | printf("recursive scan (%s)?\n", name); | ||
| 320 | exit(1); | ||
| 321 | } | ||
| 322 | if (file->flags & FILE_SCANNED) { | ||
| 323 | printf("file %s already scanned?\n", name); | ||
| 324 | exit(1); | ||
| 325 | } | ||
| 326 | file->flags |= FILE_BUSY; | ||
| 327 | file->lineno = 1; | ||
| 328 | file->parent = current_file; | ||
| 329 | current_file = file; | ||
| 330 | } | ||
| 331 | |||
| 332 | static struct buffer *zconf_endfile(void) | ||
| 333 | { | ||
| 334 | struct buffer *parent; | ||
| 335 | |||
| 336 | current_file->flags |= FILE_SCANNED; | ||
| 337 | current_file->flags &= ~FILE_BUSY; | ||
| 338 | current_file = current_file->parent; | ||
| 339 | |||
| 340 | parent = current_buf->parent; | ||
| 341 | if (parent) { | ||
| 342 | fclose(yyin); | ||
| 343 | yy_delete_buffer(YY_CURRENT_BUFFER); | ||
| 344 | yy_switch_to_buffer(parent->state); | ||
| 345 | } | ||
| 346 | free(current_buf); | ||
| 347 | current_buf = parent; | ||
| 348 | |||
| 349 | return parent; | ||
| 350 | } | ||
| 351 | |||
| 352 | int zconf_lineno(void) | ||
| 353 | { | ||
| 354 | if (current_buf) | ||
| 355 | return current_file->lineno - 1; | ||
| 356 | else | ||
| 357 | return 0; | ||
| 358 | } | ||
| 359 | |||
| 360 | char *zconf_curname(void) | ||
| 361 | { | ||
| 362 | if (current_buf) | ||
| 363 | return current_file->name; | ||
| 364 | else | ||
| 365 | return "<none>"; | ||
| 366 | } | ||
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped new file mode 100644 index 000000000000..f163d8d2d9ef --- /dev/null +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
| @@ -0,0 +1,2130 @@ | |||
| 1 | /* A Bison parser, made by GNU Bison 1.875a. */ | ||
| 2 | |||
| 3 | /* Skeleton parser for Yacc-like parsing with Bison, | ||
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program; if not, write to the Free Software | ||
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 19 | Boston, MA 02111-1307, USA. */ | ||
| 20 | |||
| 21 | /* As a special exception, when this file is copied by Bison into a | ||
| 22 | Bison output file, you may use that output file without restriction. | ||
| 23 | This special exception was added by the Free Software Foundation | ||
| 24 | in version 1.24 of Bison. */ | ||
| 25 | |||
| 26 | /* Written by Richard Stallman by simplifying the original so called | ||
| 27 | ``semantic'' parser. */ | ||
| 28 | |||
| 29 | /* All symbols defined below should begin with yy or YY, to avoid | ||
| 30 | infringing on user name space. This should be done even for local | ||
| 31 | variables, as they might otherwise be expanded by user macros. | ||
| 32 | There are some unavoidable exceptions within include files to | ||
| 33 | define necessary library symbols; they are noted "INFRINGES ON | ||
| 34 | USER NAME SPACE" below. */ | ||
| 35 | |||
| 36 | /* Identify Bison output. */ | ||
| 37 | #define YYBISON 1 | ||
| 38 | |||
| 39 | /* Skeleton name. */ | ||
| 40 | #define YYSKELETON_NAME "yacc.c" | ||
| 41 | |||
| 42 | /* Pure parsers. */ | ||
| 43 | #define YYPURE 0 | ||
| 44 | |||
| 45 | /* Using locations. */ | ||
| 46 | #define YYLSP_NEEDED 0 | ||
| 47 | |||
| 48 | /* If NAME_PREFIX is specified substitute the variables and functions | ||
| 49 | names. */ | ||
| 50 | #define yyparse zconfparse | ||
| 51 | #define yylex zconflex | ||
| 52 | #define yyerror zconferror | ||
| 53 | #define yylval zconflval | ||
| 54 | #define yychar zconfchar | ||
| 55 | #define yydebug zconfdebug | ||
| 56 | #define yynerrs zconfnerrs | ||
| 57 | |||
| 58 | |||
| 59 | /* Tokens. */ | ||
| 60 | #ifndef YYTOKENTYPE | ||
| 61 | # define YYTOKENTYPE | ||
| 62 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
| 63 | know about them. */ | ||
| 64 | enum yytokentype { | ||
| 65 | T_MAINMENU = 258, | ||
| 66 | T_MENU = 259, | ||
| 67 | T_ENDMENU = 260, | ||
| 68 | T_SOURCE = 261, | ||
| 69 | T_CHOICE = 262, | ||
| 70 | T_ENDCHOICE = 263, | ||
| 71 | T_COMMENT = 264, | ||
| 72 | T_CONFIG = 265, | ||
| 73 | T_MENUCONFIG = 266, | ||
| 74 | T_HELP = 267, | ||
| 75 | T_HELPTEXT = 268, | ||
| 76 | T_IF = 269, | ||
| 77 | T_ENDIF = 270, | ||
| 78 | T_DEPENDS = 271, | ||
| 79 | T_REQUIRES = 272, | ||
| 80 | T_OPTIONAL = 273, | ||
| 81 | T_PROMPT = 274, | ||
| 82 | T_DEFAULT = 275, | ||
| 83 | T_TRISTATE = 276, | ||
| 84 | T_DEF_TRISTATE = 277, | ||
| 85 | T_BOOLEAN = 278, | ||
| 86 | T_DEF_BOOLEAN = 279, | ||
| 87 | T_STRING = 280, | ||
| 88 | T_INT = 281, | ||
| 89 | T_HEX = 282, | ||
| 90 | T_WORD = 283, | ||
| 91 | T_WORD_QUOTE = 284, | ||
| 92 | T_UNEQUAL = 285, | ||
| 93 | T_EOF = 286, | ||
| 94 | T_EOL = 287, | ||
| 95 | T_CLOSE_PAREN = 288, | ||
| 96 | T_OPEN_PAREN = 289, | ||
| 97 | T_ON = 290, | ||
| 98 | T_SELECT = 291, | ||
| 99 | T_RANGE = 292, | ||
| 100 | T_OR = 293, | ||
| 101 | T_AND = 294, | ||
| 102 | T_EQUAL = 295, | ||
| 103 | T_NOT = 296 | ||
| 104 | }; | ||
| 105 | #endif | ||
| 106 | #define T_MAINMENU 258 | ||
| 107 | #define T_MENU 259 | ||
| 108 | #define T_ENDMENU 260 | ||
| 109 | #define T_SOURCE 261 | ||
| 110 | #define T_CHOICE 262 | ||
| 111 | #define T_ENDCHOICE 263 | ||
| 112 | #define T_COMMENT 264 | ||
| 113 | #define T_CONFIG 265 | ||
| 114 | #define T_MENUCONFIG 266 | ||
| 115 | #define T_HELP 267 | ||
| 116 | #define T_HELPTEXT 268 | ||
| 117 | #define T_IF 269 | ||
| 118 | #define T_ENDIF 270 | ||
| 119 | #define T_DEPENDS 271 | ||
| 120 | #define T_REQUIRES 272 | ||
| 121 | #define T_OPTIONAL 273 | ||
| 122 | #define T_PROMPT 274 | ||
| 123 | #define T_DEFAULT 275 | ||
| 124 | #define T_TRISTATE 276 | ||
| 125 | #define T_DEF_TRISTATE 277 | ||
| 126 | #define T_BOOLEAN 278 | ||
| 127 | #define T_DEF_BOOLEAN 279 | ||
| 128 | #define T_STRING 280 | ||
| 129 | #define T_INT 281 | ||
| 130 | #define T_HEX 282 | ||
| 131 | #define T_WORD 283 | ||
| 132 | #define T_WORD_QUOTE 284 | ||
| 133 | #define T_UNEQUAL 285 | ||
| 134 | #define T_EOF 286 | ||
| 135 | #define T_EOL 287 | ||
| 136 | #define T_CLOSE_PAREN 288 | ||
| 137 | #define T_OPEN_PAREN 289 | ||
| 138 | #define T_ON 290 | ||
| 139 | #define T_SELECT 291 | ||
| 140 | #define T_RANGE 292 | ||
| 141 | #define T_OR 293 | ||
| 142 | #define T_AND 294 | ||
| 143 | #define T_EQUAL 295 | ||
| 144 | #define T_NOT 296 | ||
| 145 | |||
| 146 | |||
| 147 | |||
| 148 | |||
| 149 | /* Copy the first part of user declarations. */ | ||
| 150 | |||
| 151 | |||
| 152 | /* | ||
| 153 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 154 | * Released under the terms of the GNU GPL v2.0. | ||
| 155 | */ | ||
| 156 | |||
| 157 | #include <ctype.h> | ||
| 158 | #include <stdarg.h> | ||
| 159 | #include <stdio.h> | ||
| 160 | #include <stdlib.h> | ||
| 161 | #include <string.h> | ||
| 162 | #include <stdbool.h> | ||
| 163 | |||
| 164 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | ||
| 165 | |||
| 166 | #define PRINTD 0x0001 | ||
| 167 | #define DEBUG_PARSE 0x0002 | ||
| 168 | |||
| 169 | int cdebug = PRINTD; | ||
| 170 | |||
| 171 | extern int zconflex(void); | ||
| 172 | static void zconfprint(const char *err, ...); | ||
| 173 | static void zconferror(const char *err); | ||
| 174 | static bool zconf_endtoken(int token, int starttoken, int endtoken); | ||
| 175 | |||
| 176 | struct symbol *symbol_hash[257]; | ||
| 177 | |||
| 178 | static struct menu *current_menu, *current_entry; | ||
| 179 | |||
| 180 | #define YYERROR_VERBOSE | ||
| 181 | |||
| 182 | |||
| 183 | /* Enabling traces. */ | ||
| 184 | #ifndef YYDEBUG | ||
| 185 | # define YYDEBUG 0 | ||
| 186 | #endif | ||
| 187 | |||
| 188 | /* Enabling verbose error messages. */ | ||
| 189 | #ifdef YYERROR_VERBOSE | ||
| 190 | # undef YYERROR_VERBOSE | ||
| 191 | # define YYERROR_VERBOSE 1 | ||
| 192 | #else | ||
| 193 | # define YYERROR_VERBOSE 0 | ||
| 194 | #endif | ||
| 195 | |||
| 196 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) | ||
| 197 | |||
| 198 | typedef union YYSTYPE { | ||
| 199 | int token; | ||
| 200 | char *string; | ||
| 201 | struct symbol *symbol; | ||
| 202 | struct expr *expr; | ||
| 203 | struct menu *menu; | ||
| 204 | } YYSTYPE; | ||
| 205 | /* Line 191 of yacc.c. */ | ||
| 206 | |||
| 207 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
| 208 | # define YYSTYPE_IS_DECLARED 1 | ||
| 209 | # define YYSTYPE_IS_TRIVIAL 1 | ||
| 210 | #endif | ||
| 211 | |||
| 212 | |||
| 213 | |||
| 214 | /* Copy the second part of user declarations. */ | ||
| 215 | |||
| 216 | |||
| 217 | #define LKC_DIRECT_LINK | ||
| 218 | #include "lkc.h" | ||
| 219 | |||
| 220 | |||
| 221 | /* Line 214 of yacc.c. */ | ||
| 222 | |||
| 223 | |||
| 224 | #if ! defined (yyoverflow) || YYERROR_VERBOSE | ||
| 225 | |||
| 226 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | ||
| 227 | |||
| 228 | # if YYSTACK_USE_ALLOCA | ||
| 229 | # define YYSTACK_ALLOC alloca | ||
| 230 | # else | ||
| 231 | # ifndef YYSTACK_USE_ALLOCA | ||
| 232 | # if defined (alloca) || defined (_ALLOCA_H) | ||
| 233 | # define YYSTACK_ALLOC alloca | ||
| 234 | # else | ||
| 235 | # ifdef __GNUC__ | ||
| 236 | # define YYSTACK_ALLOC __builtin_alloca | ||
| 237 | # endif | ||
| 238 | # endif | ||
| 239 | # endif | ||
| 240 | # endif | ||
| 241 | |||
| 242 | # ifdef YYSTACK_ALLOC | ||
| 243 | /* Pacify GCC's `empty if-body' warning. */ | ||
| 244 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | ||
| 245 | # else | ||
| 246 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 247 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 248 | # define YYSIZE_T size_t | ||
| 249 | # endif | ||
| 250 | # define YYSTACK_ALLOC malloc | ||
| 251 | # define YYSTACK_FREE free | ||
| 252 | # endif | ||
| 253 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ | ||
| 254 | |||
| 255 | |||
| 256 | #if (! defined (yyoverflow) \ | ||
| 257 | && (! defined (__cplusplus) \ | ||
| 258 | || (YYSTYPE_IS_TRIVIAL))) | ||
| 259 | |||
| 260 | /* A type that is properly aligned for any stack member. */ | ||
| 261 | union yyalloc | ||
| 262 | { | ||
| 263 | short yyss; | ||
| 264 | YYSTYPE yyvs; | ||
| 265 | }; | ||
| 266 | |||
| 267 | /* The size of the maximum gap between one aligned stack and the next. */ | ||
| 268 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | ||
| 269 | |||
| 270 | /* The size of an array large to enough to hold all stacks, each with | ||
| 271 | N elements. */ | ||
| 272 | # define YYSTACK_BYTES(N) \ | ||
| 273 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ | ||
| 274 | + YYSTACK_GAP_MAXIMUM) | ||
| 275 | |||
| 276 | /* Copy COUNT objects from FROM to TO. The source and destination do | ||
| 277 | not overlap. */ | ||
| 278 | # ifndef YYCOPY | ||
| 279 | # if 1 < __GNUC__ | ||
| 280 | # define YYCOPY(To, From, Count) \ | ||
| 281 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
| 282 | # else | ||
| 283 | # define YYCOPY(To, From, Count) \ | ||
| 284 | do \ | ||
| 285 | { \ | ||
| 286 | register YYSIZE_T yyi; \ | ||
| 287 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
| 288 | (To)[yyi] = (From)[yyi]; \ | ||
| 289 | } \ | ||
| 290 | while (0) | ||
| 291 | # endif | ||
| 292 | # endif | ||
| 293 | |||
| 294 | /* Relocate STACK from its old location to the new one. The | ||
| 295 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | ||
| 296 | elements in the stack, and YYPTR gives the new location of the | ||
| 297 | stack. Advance YYPTR to a properly aligned location for the next | ||
| 298 | stack. */ | ||
| 299 | # define YYSTACK_RELOCATE(Stack) \ | ||
| 300 | do \ | ||
| 301 | { \ | ||
| 302 | YYSIZE_T yynewbytes; \ | ||
| 303 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | ||
| 304 | Stack = &yyptr->Stack; \ | ||
| 305 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | ||
| 306 | yyptr += yynewbytes / sizeof (*yyptr); \ | ||
| 307 | } \ | ||
| 308 | while (0) | ||
| 309 | |||
| 310 | #endif | ||
| 311 | |||
| 312 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 313 | typedef signed char yysigned_char; | ||
| 314 | #else | ||
| 315 | typedef short yysigned_char; | ||
| 316 | #endif | ||
| 317 | |||
| 318 | /* YYFINAL -- State number of the termination state. */ | ||
| 319 | #define YYFINAL 2 | ||
| 320 | /* YYLAST -- Last index in YYTABLE. */ | ||
| 321 | #define YYLAST 201 | ||
| 322 | |||
| 323 | /* YYNTOKENS -- Number of terminals. */ | ||
| 324 | #define YYNTOKENS 42 | ||
| 325 | /* YYNNTS -- Number of nonterminals. */ | ||
| 326 | #define YYNNTS 41 | ||
| 327 | /* YYNRULES -- Number of rules. */ | ||
| 328 | #define YYNRULES 104 | ||
| 329 | /* YYNRULES -- Number of states. */ | ||
| 330 | #define YYNSTATES 182 | ||
| 331 | |||
| 332 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | ||
| 333 | #define YYUNDEFTOK 2 | ||
| 334 | #define YYMAXUTOK 296 | ||
| 335 | |||
| 336 | #define YYTRANSLATE(YYX) \ | ||
| 337 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | ||
| 338 | |||
| 339 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | ||
| 340 | static const unsigned char yytranslate[] = | ||
| 341 | { | ||
| 342 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 343 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 344 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 345 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 346 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 347 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 348 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 349 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 350 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 351 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 352 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 353 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 354 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 355 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 356 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 357 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 358 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 359 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 360 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 361 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 362 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 363 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 364 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 365 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 366 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 367 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | ||
| 368 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 369 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | ||
| 370 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | ||
| 371 | 35, 36, 37, 38, 39, 40, 41 | ||
| 372 | }; | ||
| 373 | |||
| 374 | #if YYDEBUG | ||
| 375 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | ||
| 376 | YYRHS. */ | ||
| 377 | static const unsigned short yyprhs[] = | ||
| 378 | { | ||
| 379 | 0, 0, 3, 4, 7, 9, 11, 13, 17, 19, | ||
| 380 | 21, 23, 26, 28, 30, 32, 34, 36, 38, 42, | ||
| 381 | 45, 49, 52, 53, 56, 59, 62, 65, 69, 74, | ||
| 382 | 78, 83, 87, 91, 95, 100, 105, 110, 116, 119, | ||
| 383 | 122, 124, 128, 131, 132, 135, 138, 141, 144, 149, | ||
| 384 | 153, 157, 160, 165, 166, 169, 173, 175, 179, 182, | ||
| 385 | 183, 186, 189, 192, 196, 199, 201, 205, 208, 209, | ||
| 386 | 212, 215, 218, 222, 226, 228, 232, 235, 238, 241, | ||
| 387 | 242, 245, 248, 253, 257, 261, 262, 265, 267, 269, | ||
| 388 | 272, 275, 278, 280, 282, 283, 286, 288, 292, 296, | ||
| 389 | 300, 303, 307, 311, 313 | ||
| 390 | }; | ||
| 391 | |||
| 392 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | ||
| 393 | static const yysigned_char yyrhs[] = | ||
| 394 | { | ||
| 395 | 43, 0, -1, -1, 43, 44, -1, 45, -1, 55, | ||
| 396 | -1, 66, -1, 3, 77, 79, -1, 5, -1, 15, | ||
| 397 | -1, 8, -1, 1, 79, -1, 61, -1, 71, -1, | ||
| 398 | 47, -1, 49, -1, 69, -1, 79, -1, 10, 28, | ||
| 399 | 32, -1, 46, 50, -1, 11, 28, 32, -1, 48, | ||
| 400 | 50, -1, -1, 50, 51, -1, 50, 75, -1, 50, | ||
| 401 | 73, -1, 50, 32, -1, 21, 76, 32, -1, 22, | ||
| 402 | 81, 80, 32, -1, 23, 76, 32, -1, 24, 81, | ||
| 403 | 80, 32, -1, 26, 76, 32, -1, 27, 76, 32, | ||
| 404 | -1, 25, 76, 32, -1, 19, 77, 80, 32, -1, | ||
| 405 | 20, 81, 80, 32, -1, 36, 28, 80, 32, -1, | ||
| 406 | 37, 82, 82, 80, 32, -1, 7, 32, -1, 52, | ||
| 407 | 56, -1, 78, -1, 53, 58, 54, -1, 53, 58, | ||
| 408 | -1, -1, 56, 57, -1, 56, 75, -1, 56, 73, | ||
| 409 | -1, 56, 32, -1, 19, 77, 80, 32, -1, 21, | ||
| 410 | 76, 32, -1, 23, 76, 32, -1, 18, 32, -1, | ||
| 411 | 20, 28, 80, 32, -1, -1, 58, 45, -1, 14, | ||
| 412 | 81, 32, -1, 78, -1, 59, 62, 60, -1, 59, | ||
| 413 | 62, -1, -1, 62, 45, -1, 62, 66, -1, 62, | ||
| 414 | 55, -1, 4, 77, 32, -1, 63, 74, -1, 78, | ||
| 415 | -1, 64, 67, 65, -1, 64, 67, -1, -1, 67, | ||
| 416 | 45, -1, 67, 66, -1, 67, 55, -1, 67, 1, | ||
| 417 | 32, -1, 6, 77, 32, -1, 68, -1, 9, 77, | ||
| 418 | 32, -1, 70, 74, -1, 12, 32, -1, 72, 13, | ||
| 419 | -1, -1, 74, 75, -1, 74, 32, -1, 16, 35, | ||
| 420 | 81, 32, -1, 16, 81, 32, -1, 17, 81, 32, | ||
| 421 | -1, -1, 77, 80, -1, 28, -1, 29, -1, 5, | ||
| 422 | 79, -1, 8, 79, -1, 15, 79, -1, 32, -1, | ||
| 423 | 31, -1, -1, 14, 81, -1, 82, -1, 82, 40, | ||
| 424 | 82, -1, 82, 30, 82, -1, 34, 81, 33, -1, | ||
| 425 | 41, 81, -1, 81, 38, 81, -1, 81, 39, 81, | ||
| 426 | -1, 28, -1, 29, -1 | ||
| 427 | }; | ||
| 428 | |||
| 429 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | ||
| 430 | static const unsigned short yyrline[] = | ||
| 431 | { | ||
| 432 | 0, 94, 94, 95, 98, 99, 100, 101, 102, 103, | ||
| 433 | 104, 105, 109, 110, 111, 112, 113, 114, 120, 128, | ||
| 434 | 134, 142, 152, 154, 155, 156, 157, 160, 166, 173, | ||
| 435 | 179, 186, 192, 198, 204, 210, 216, 222, 230, 239, | ||
| 436 | 245, 254, 255, 261, 263, 264, 265, 266, 269, 275, | ||
| 437 | 281, 287, 293, 299, 301, 306, 315, 324, 325, 331, | ||
| 438 | 333, 334, 335, 340, 347, 353, 362, 363, 369, 371, | ||
| 439 | 372, 373, 374, 377, 383, 390, 397, 404, 410, 417, | ||
| 440 | 418, 419, 422, 427, 432, 440, 442, 447, 448, 451, | ||
| 441 | 452, 453, 457, 457, 459, 460, 463, 464, 465, 466, | ||
| 442 | 467, 468, 469, 472, 473 | ||
| 443 | }; | ||
| 444 | #endif | ||
| 445 | |||
| 446 | #if YYDEBUG || YYERROR_VERBOSE | ||
| 447 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | ||
| 448 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | ||
| 449 | static const char *const yytname[] = | ||
| 450 | { | ||
| 451 | "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", | ||
| 452 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", | ||
| 453 | "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", | ||
| 454 | "T_REQUIRES", "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE", | ||
| 455 | "T_DEF_TRISTATE", "T_BOOLEAN", "T_DEF_BOOLEAN", "T_STRING", "T_INT", | ||
| 456 | "T_HEX", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL", "T_EOF", "T_EOL", | ||
| 457 | "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_SELECT", "T_RANGE", "T_OR", | ||
| 458 | "T_AND", "T_EQUAL", "T_NOT", "$accept", "input", "block", | ||
| 459 | "common_block", "config_entry_start", "config_stmt", | ||
| 460 | "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", | ||
| 461 | "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", | ||
| 462 | "choice_option_list", "choice_option", "choice_block", "if", "if_end", | ||
| 463 | "if_stmt", "if_block", "menu", "menu_entry", "menu_end", "menu_stmt", | ||
| 464 | "menu_block", "source", "source_stmt", "comment", "comment_stmt", | ||
| 465 | "help_start", "help", "depends_list", "depends", "prompt_stmt_opt", | ||
| 466 | "prompt", "end", "nl_or_eof", "if_expr", "expr", "symbol", 0 | ||
| 467 | }; | ||
| 468 | #endif | ||
| 469 | |||
| 470 | # ifdef YYPRINT | ||
| 471 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | ||
| 472 | token YYLEX-NUM. */ | ||
| 473 | static const unsigned short yytoknum[] = | ||
| 474 | { | ||
| 475 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | ||
| 476 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | ||
| 477 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | ||
| 478 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, | ||
| 479 | 295, 296 | ||
| 480 | }; | ||
| 481 | # endif | ||
| 482 | |||
| 483 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | ||
| 484 | static const unsigned char yyr1[] = | ||
| 485 | { | ||
| 486 | 0, 42, 43, 43, 44, 44, 44, 44, 44, 44, | ||
| 487 | 44, 44, 45, 45, 45, 45, 45, 45, 46, 47, | ||
| 488 | 48, 49, 50, 50, 50, 50, 50, 51, 51, 51, | ||
| 489 | 51, 51, 51, 51, 51, 51, 51, 51, 52, 53, | ||
| 490 | 54, 55, 55, 56, 56, 56, 56, 56, 57, 57, | ||
| 491 | 57, 57, 57, 58, 58, 59, 60, 61, 61, 62, | ||
| 492 | 62, 62, 62, 63, 64, 65, 66, 66, 67, 67, | ||
| 493 | 67, 67, 67, 68, 69, 70, 71, 72, 73, 74, | ||
| 494 | 74, 74, 75, 75, 75, 76, 76, 77, 77, 78, | ||
| 495 | 78, 78, 79, 79, 80, 80, 81, 81, 81, 81, | ||
| 496 | 81, 81, 81, 82, 82 | ||
| 497 | }; | ||
| 498 | |||
| 499 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | ||
| 500 | static const unsigned char yyr2[] = | ||
| 501 | { | ||
| 502 | 0, 2, 0, 2, 1, 1, 1, 3, 1, 1, | ||
| 503 | 1, 2, 1, 1, 1, 1, 1, 1, 3, 2, | ||
| 504 | 3, 2, 0, 2, 2, 2, 2, 3, 4, 3, | ||
| 505 | 4, 3, 3, 3, 4, 4, 4, 5, 2, 2, | ||
| 506 | 1, 3, 2, 0, 2, 2, 2, 2, 4, 3, | ||
| 507 | 3, 2, 4, 0, 2, 3, 1, 3, 2, 0, | ||
| 508 | 2, 2, 2, 3, 2, 1, 3, 2, 0, 2, | ||
| 509 | 2, 2, 3, 3, 1, 3, 2, 2, 2, 0, | ||
| 510 | 2, 2, 4, 3, 3, 0, 2, 1, 1, 2, | ||
| 511 | 2, 2, 1, 1, 0, 2, 1, 3, 3, 3, | ||
| 512 | 2, 3, 3, 1, 1 | ||
| 513 | }; | ||
| 514 | |||
| 515 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | ||
| 516 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | ||
| 517 | means the default is an error. */ | ||
| 518 | static const unsigned char yydefact[] = | ||
| 519 | { | ||
| 520 | 2, 0, 1, 0, 0, 0, 8, 0, 0, 10, | ||
| 521 | 0, 0, 0, 0, 9, 93, 92, 3, 4, 22, | ||
| 522 | 14, 22, 15, 43, 53, 5, 59, 12, 79, 68, | ||
| 523 | 6, 74, 16, 79, 13, 17, 11, 87, 88, 0, | ||
| 524 | 0, 0, 38, 0, 0, 0, 103, 104, 0, 0, | ||
| 525 | 0, 96, 19, 21, 39, 42, 58, 64, 0, 76, | ||
| 526 | 7, 63, 73, 75, 18, 20, 0, 100, 55, 0, | ||
| 527 | 0, 0, 0, 0, 0, 0, 0, 0, 85, 0, | ||
| 528 | 85, 0, 85, 85, 85, 26, 0, 0, 23, 0, | ||
| 529 | 25, 24, 0, 0, 0, 85, 85, 47, 44, 46, | ||
| 530 | 45, 0, 0, 0, 54, 41, 40, 60, 62, 57, | ||
| 531 | 61, 56, 81, 80, 0, 69, 71, 66, 70, 65, | ||
| 532 | 99, 101, 102, 98, 97, 77, 0, 0, 0, 94, | ||
| 533 | 94, 0, 94, 94, 0, 94, 0, 0, 0, 94, | ||
| 534 | 0, 78, 51, 94, 94, 0, 0, 89, 90, 91, | ||
| 535 | 72, 0, 83, 84, 0, 0, 0, 27, 86, 0, | ||
| 536 | 29, 0, 33, 31, 32, 0, 94, 0, 0, 49, | ||
| 537 | 50, 82, 95, 34, 35, 28, 30, 36, 0, 48, | ||
| 538 | 52, 37 | ||
| 539 | }; | ||
| 540 | |||
| 541 | /* YYDEFGOTO[NTERM-NUM]. */ | ||
| 542 | static const short yydefgoto[] = | ||
| 543 | { | ||
| 544 | -1, 1, 17, 18, 19, 20, 21, 22, 52, 88, | ||
| 545 | 23, 24, 105, 25, 54, 98, 55, 26, 109, 27, | ||
| 546 | 56, 28, 29, 117, 30, 58, 31, 32, 33, 34, | ||
| 547 | 89, 90, 57, 91, 131, 132, 106, 35, 155, 50, | ||
| 548 | 51 | ||
| 549 | }; | ||
| 550 | |||
| 551 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | ||
| 552 | STATE-NUM. */ | ||
| 553 | #define YYPACT_NINF -99 | ||
| 554 | static const short yypact[] = | ||
| 555 | { | ||
| 556 | -99, 48, -99, 38, 46, 46, -99, 46, -29, -99, | ||
| 557 | 46, -17, -3, -11, -99, -99, -99, -99, -99, -99, | ||
| 558 | -99, -99, -99, -99, -99, -99, -99, -99, -99, -99, | ||
| 559 | -99, -99, -99, -99, -99, -99, -99, -99, -99, 38, | ||
| 560 | 12, 15, -99, 18, 51, 62, -99, -99, -11, -11, | ||
| 561 | 4, -24, 138, 138, 160, 121, 110, -4, 81, -4, | ||
| 562 | -99, -99, -99, -99, -99, -99, -19, -99, -99, -11, | ||
| 563 | -11, 70, 70, 73, 32, -11, 46, -11, 46, -11, | ||
| 564 | 46, -11, 46, 46, 46, -99, 36, 70, -99, 95, | ||
| 565 | -99, -99, 96, 46, 106, 46, 46, -99, -99, -99, | ||
| 566 | -99, 38, 38, 38, -99, -99, -99, -99, -99, -99, | ||
| 567 | -99, -99, -99, -99, 112, -99, -99, -99, -99, -99, | ||
| 568 | -99, 117, -99, -99, -99, -99, -11, 33, 65, 131, | ||
| 569 | 1, 119, 131, 1, 136, 1, 153, 154, 155, 131, | ||
| 570 | 70, -99, -99, 131, 131, 156, 157, -99, -99, -99, | ||
| 571 | -99, 101, -99, -99, -11, 158, 159, -99, -99, 161, | ||
| 572 | -99, 162, -99, -99, -99, 163, 131, 164, 165, -99, | ||
| 573 | -99, -99, 99, -99, -99, -99, -99, -99, 166, -99, | ||
| 574 | -99, -99 | ||
| 575 | }; | ||
| 576 | |||
| 577 | /* YYPGOTO[NTERM-NUM]. */ | ||
| 578 | static const short yypgoto[] = | ||
| 579 | { | ||
| 580 | -99, -99, -99, 111, -99, -99, -99, -99, 178, -99, | ||
| 581 | -99, -99, -99, 91, -99, -99, -99, -99, -99, -99, | ||
| 582 | -99, -99, -99, -99, 115, -99, -99, -99, -99, -99, | ||
| 583 | -99, 146, 168, 89, 27, 0, 126, -1, -98, -48, | ||
| 584 | -63 | ||
| 585 | }; | ||
| 586 | |||
| 587 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | ||
| 588 | positive, shift that token. If negative, reduce the rule which | ||
| 589 | number is the opposite. If zero, do what YYDEFACT says. | ||
| 590 | If YYTABLE_NINF, syntax error. */ | ||
| 591 | #define YYTABLE_NINF -68 | ||
| 592 | static const short yytable[] = | ||
| 593 | { | ||
| 594 | 66, 67, 36, 42, 39, 40, 71, 41, 123, 124, | ||
| 595 | 43, 44, 74, 75, 120, 154, 72, 46, 47, 69, | ||
| 596 | 70, 121, 122, 48, 140, 45, 127, 128, 112, 130, | ||
| 597 | 49, 133, 156, 135, 158, 159, 68, 161, 60, 69, | ||
| 598 | 70, 165, 69, 70, 61, 167, 168, 62, 2, 3, | ||
| 599 | 63, 4, 5, 6, 7, 8, 9, 10, 11, 12, | ||
| 600 | 46, 47, 13, 14, 139, 152, 48, 126, 178, 15, | ||
| 601 | 16, 69, 70, 49, 37, 38, 129, 166, 151, 15, | ||
| 602 | 16, -67, 114, 64, -67, 5, 101, 7, 8, 102, | ||
| 603 | 10, 11, 12, 143, 65, 13, 103, 153, 46, 47, | ||
| 604 | 147, 148, 149, 69, 70, 125, 172, 134, 141, 136, | ||
| 605 | 137, 138, 15, 16, 5, 101, 7, 8, 102, 10, | ||
| 606 | 11, 12, 145, 146, 13, 103, 101, 7, 142, 102, | ||
| 607 | 10, 11, 12, 171, 144, 13, 103, 69, 70, 69, | ||
| 608 | 70, 15, 16, 100, 150, 154, 113, 108, 113, 116, | ||
| 609 | 73, 157, 15, 16, 74, 75, 70, 76, 77, 78, | ||
| 610 | 79, 80, 81, 82, 83, 84, 104, 107, 160, 115, | ||
| 611 | 85, 110, 73, 118, 86, 87, 74, 75, 92, 93, | ||
| 612 | 94, 95, 111, 96, 119, 162, 163, 164, 169, 170, | ||
| 613 | 173, 174, 97, 175, 176, 177, 179, 180, 181, 53, | ||
| 614 | 99, 59 | ||
| 615 | }; | ||
| 616 | |||
| 617 | static const unsigned char yycheck[] = | ||
| 618 | { | ||
| 619 | 48, 49, 3, 32, 4, 5, 30, 7, 71, 72, | ||
| 620 | 10, 28, 16, 17, 33, 14, 40, 28, 29, 38, | ||
| 621 | 39, 69, 70, 34, 87, 28, 74, 75, 32, 77, | ||
| 622 | 41, 79, 130, 81, 132, 133, 32, 135, 39, 38, | ||
| 623 | 39, 139, 38, 39, 32, 143, 144, 32, 0, 1, | ||
| 624 | 32, 3, 4, 5, 6, 7, 8, 9, 10, 11, | ||
| 625 | 28, 29, 14, 15, 28, 32, 34, 35, 166, 31, | ||
| 626 | 32, 38, 39, 41, 28, 29, 76, 140, 126, 31, | ||
| 627 | 32, 0, 1, 32, 3, 4, 5, 6, 7, 8, | ||
| 628 | 9, 10, 11, 93, 32, 14, 15, 32, 28, 29, | ||
| 629 | 101, 102, 103, 38, 39, 32, 154, 80, 13, 82, | ||
| 630 | 83, 84, 31, 32, 4, 5, 6, 7, 8, 9, | ||
| 631 | 10, 11, 95, 96, 14, 15, 5, 6, 32, 8, | ||
| 632 | 9, 10, 11, 32, 28, 14, 15, 38, 39, 38, | ||
| 633 | 39, 31, 32, 54, 32, 14, 57, 56, 59, 58, | ||
| 634 | 12, 32, 31, 32, 16, 17, 39, 19, 20, 21, | ||
| 635 | 22, 23, 24, 25, 26, 27, 55, 56, 32, 58, | ||
| 636 | 32, 56, 12, 58, 36, 37, 16, 17, 18, 19, | ||
| 637 | 20, 21, 56, 23, 58, 32, 32, 32, 32, 32, | ||
| 638 | 32, 32, 32, 32, 32, 32, 32, 32, 32, 21, | ||
| 639 | 54, 33 | ||
| 640 | }; | ||
| 641 | |||
| 642 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | ||
| 643 | symbol of state STATE-NUM. */ | ||
| 644 | static const unsigned char yystos[] = | ||
| 645 | { | ||
| 646 | 0, 43, 0, 1, 3, 4, 5, 6, 7, 8, | ||
| 647 | 9, 10, 11, 14, 15, 31, 32, 44, 45, 46, | ||
| 648 | 47, 48, 49, 52, 53, 55, 59, 61, 63, 64, | ||
| 649 | 66, 68, 69, 70, 71, 79, 79, 28, 29, 77, | ||
| 650 | 77, 77, 32, 77, 28, 28, 28, 29, 34, 41, | ||
| 651 | 81, 82, 50, 50, 56, 58, 62, 74, 67, 74, | ||
| 652 | 79, 32, 32, 32, 32, 32, 81, 81, 32, 38, | ||
| 653 | 39, 30, 40, 12, 16, 17, 19, 20, 21, 22, | ||
| 654 | 23, 24, 25, 26, 27, 32, 36, 37, 51, 72, | ||
| 655 | 73, 75, 18, 19, 20, 21, 23, 32, 57, 73, | ||
| 656 | 75, 5, 8, 15, 45, 54, 78, 45, 55, 60, | ||
| 657 | 66, 78, 32, 75, 1, 45, 55, 65, 66, 78, | ||
| 658 | 33, 81, 81, 82, 82, 32, 35, 81, 81, 77, | ||
| 659 | 81, 76, 77, 81, 76, 81, 76, 76, 76, 28, | ||
| 660 | 82, 13, 32, 77, 28, 76, 76, 79, 79, 79, | ||
| 661 | 32, 81, 32, 32, 14, 80, 80, 32, 80, 80, | ||
| 662 | 32, 80, 32, 32, 32, 80, 82, 80, 80, 32, | ||
| 663 | 32, 32, 81, 32, 32, 32, 32, 32, 80, 32, | ||
| 664 | 32, 32 | ||
| 665 | }; | ||
| 666 | |||
| 667 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | ||
| 668 | # define YYSIZE_T __SIZE_TYPE__ | ||
| 669 | #endif | ||
| 670 | #if ! defined (YYSIZE_T) && defined (size_t) | ||
| 671 | # define YYSIZE_T size_t | ||
| 672 | #endif | ||
| 673 | #if ! defined (YYSIZE_T) | ||
| 674 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 675 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 676 | # define YYSIZE_T size_t | ||
| 677 | # endif | ||
| 678 | #endif | ||
| 679 | #if ! defined (YYSIZE_T) | ||
| 680 | # define YYSIZE_T unsigned int | ||
| 681 | #endif | ||
| 682 | |||
| 683 | #define yyerrok (yyerrstatus = 0) | ||
| 684 | #define yyclearin (yychar = YYEMPTY) | ||
| 685 | #define YYEMPTY (-2) | ||
| 686 | #define YYEOF 0 | ||
| 687 | |||
| 688 | #define YYACCEPT goto yyacceptlab | ||
| 689 | #define YYABORT goto yyabortlab | ||
| 690 | #define YYERROR goto yyerrlab1 | ||
| 691 | |||
| 692 | |||
| 693 | /* Like YYERROR except do call yyerror. This remains here temporarily | ||
| 694 | to ease the transition to the new meaning of YYERROR, for GCC. | ||
| 695 | Once GCC version 2 has supplanted version 1, this can go. */ | ||
| 696 | |||
| 697 | #define YYFAIL goto yyerrlab | ||
| 698 | |||
| 699 | #define YYRECOVERING() (!!yyerrstatus) | ||
| 700 | |||
| 701 | #define YYBACKUP(Token, Value) \ | ||
| 702 | do \ | ||
| 703 | if (yychar == YYEMPTY && yylen == 1) \ | ||
| 704 | { \ | ||
| 705 | yychar = (Token); \ | ||
| 706 | yylval = (Value); \ | ||
| 707 | yytoken = YYTRANSLATE (yychar); \ | ||
| 708 | YYPOPSTACK; \ | ||
| 709 | goto yybackup; \ | ||
| 710 | } \ | ||
| 711 | else \ | ||
| 712 | { \ | ||
| 713 | yyerror ("syntax error: cannot back up");\ | ||
| 714 | YYERROR; \ | ||
| 715 | } \ | ||
| 716 | while (0) | ||
| 717 | |||
| 718 | #define YYTERROR 1 | ||
| 719 | #define YYERRCODE 256 | ||
| 720 | |||
| 721 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions | ||
| 722 | are run). */ | ||
| 723 | |||
| 724 | #ifndef YYLLOC_DEFAULT | ||
| 725 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
| 726 | Current.first_line = Rhs[1].first_line; \ | ||
| 727 | Current.first_column = Rhs[1].first_column; \ | ||
| 728 | Current.last_line = Rhs[N].last_line; \ | ||
| 729 | Current.last_column = Rhs[N].last_column; | ||
| 730 | #endif | ||
| 731 | |||
| 732 | /* YYLEX -- calling `yylex' with the right arguments. */ | ||
| 733 | |||
| 734 | #ifdef YYLEX_PARAM | ||
| 735 | # define YYLEX yylex (YYLEX_PARAM) | ||
| 736 | #else | ||
| 737 | # define YYLEX yylex () | ||
| 738 | #endif | ||
| 739 | |||
| 740 | /* Enable debugging if requested. */ | ||
| 741 | #if YYDEBUG | ||
| 742 | |||
| 743 | # ifndef YYFPRINTF | ||
| 744 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 745 | # define YYFPRINTF fprintf | ||
| 746 | # endif | ||
| 747 | |||
| 748 | # define YYDPRINTF(Args) \ | ||
| 749 | do { \ | ||
| 750 | if (yydebug) \ | ||
| 751 | YYFPRINTF Args; \ | ||
| 752 | } while (0) | ||
| 753 | |||
| 754 | # define YYDSYMPRINT(Args) \ | ||
| 755 | do { \ | ||
| 756 | if (yydebug) \ | ||
| 757 | yysymprint Args; \ | ||
| 758 | } while (0) | ||
| 759 | |||
| 760 | # define YYDSYMPRINTF(Title, Token, Value, Location) \ | ||
| 761 | do { \ | ||
| 762 | if (yydebug) \ | ||
| 763 | { \ | ||
| 764 | YYFPRINTF (stderr, "%s ", Title); \ | ||
| 765 | yysymprint (stderr, \ | ||
| 766 | Token, Value); \ | ||
| 767 | YYFPRINTF (stderr, "\n"); \ | ||
| 768 | } \ | ||
| 769 | } while (0) | ||
| 770 | |||
| 771 | /*------------------------------------------------------------------. | ||
| 772 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | ||
| 773 | | TOP (cinluded). | | ||
| 774 | `------------------------------------------------------------------*/ | ||
| 775 | |||
| 776 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 777 | static void | ||
| 778 | yy_stack_print (short *bottom, short *top) | ||
| 779 | #else | ||
| 780 | static void | ||
| 781 | yy_stack_print (bottom, top) | ||
| 782 | short *bottom; | ||
| 783 | short *top; | ||
| 784 | #endif | ||
| 785 | { | ||
| 786 | YYFPRINTF (stderr, "Stack now"); | ||
| 787 | for (/* Nothing. */; bottom <= top; ++bottom) | ||
| 788 | YYFPRINTF (stderr, " %d", *bottom); | ||
| 789 | YYFPRINTF (stderr, "\n"); | ||
| 790 | } | ||
| 791 | |||
| 792 | # define YY_STACK_PRINT(Bottom, Top) \ | ||
| 793 | do { \ | ||
| 794 | if (yydebug) \ | ||
| 795 | yy_stack_print ((Bottom), (Top)); \ | ||
| 796 | } while (0) | ||
| 797 | |||
| 798 | |||
| 799 | /*------------------------------------------------. | ||
| 800 | | Report that the YYRULE is going to be reduced. | | ||
| 801 | `------------------------------------------------*/ | ||
| 802 | |||
| 803 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 804 | static void | ||
| 805 | yy_reduce_print (int yyrule) | ||
| 806 | #else | ||
| 807 | static void | ||
| 808 | yy_reduce_print (yyrule) | ||
| 809 | int yyrule; | ||
| 810 | #endif | ||
| 811 | { | ||
| 812 | int yyi; | ||
| 813 | unsigned int yylineno = yyrline[yyrule]; | ||
| 814 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", | ||
| 815 | yyrule - 1, yylineno); | ||
| 816 | /* Print the symbols being reduced, and their result. */ | ||
| 817 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) | ||
| 818 | YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); | ||
| 819 | YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); | ||
| 820 | } | ||
| 821 | |||
| 822 | # define YY_REDUCE_PRINT(Rule) \ | ||
| 823 | do { \ | ||
| 824 | if (yydebug) \ | ||
| 825 | yy_reduce_print (Rule); \ | ||
| 826 | } while (0) | ||
| 827 | |||
| 828 | /* Nonzero means print parse trace. It is left uninitialized so that | ||
| 829 | multiple parsers can coexist. */ | ||
| 830 | int yydebug; | ||
| 831 | #else /* !YYDEBUG */ | ||
| 832 | # define YYDPRINTF(Args) | ||
| 833 | # define YYDSYMPRINT(Args) | ||
| 834 | # define YYDSYMPRINTF(Title, Token, Value, Location) | ||
| 835 | # define YY_STACK_PRINT(Bottom, Top) | ||
| 836 | # define YY_REDUCE_PRINT(Rule) | ||
| 837 | #endif /* !YYDEBUG */ | ||
| 838 | |||
| 839 | |||
| 840 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | ||
| 841 | #ifndef YYINITDEPTH | ||
| 842 | # define YYINITDEPTH 200 | ||
| 843 | #endif | ||
| 844 | |||
| 845 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | ||
| 846 | if the built-in stack extension method is used). | ||
| 847 | |||
| 848 | Do not make this value too large; the results are undefined if | ||
| 849 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | ||
| 850 | evaluated with infinite-precision integer arithmetic. */ | ||
| 851 | |||
| 852 | #if YYMAXDEPTH == 0 | ||
| 853 | # undef YYMAXDEPTH | ||
| 854 | #endif | ||
| 855 | |||
| 856 | #ifndef YYMAXDEPTH | ||
| 857 | # define YYMAXDEPTH 10000 | ||
| 858 | #endif | ||
| 859 | |||
| 860 | |||
| 861 | |||
| 862 | #if YYERROR_VERBOSE | ||
| 863 | |||
| 864 | # ifndef yystrlen | ||
| 865 | # if defined (__GLIBC__) && defined (_STRING_H) | ||
| 866 | # define yystrlen strlen | ||
| 867 | # else | ||
| 868 | /* Return the length of YYSTR. */ | ||
| 869 | static YYSIZE_T | ||
| 870 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 871 | yystrlen (const char *yystr) | ||
| 872 | # else | ||
| 873 | yystrlen (yystr) | ||
| 874 | const char *yystr; | ||
| 875 | # endif | ||
| 876 | { | ||
| 877 | register const char *yys = yystr; | ||
| 878 | |||
| 879 | while (*yys++ != '\0') | ||
| 880 | continue; | ||
| 881 | |||
| 882 | return yys - yystr - 1; | ||
| 883 | } | ||
| 884 | # endif | ||
| 885 | # endif | ||
| 886 | |||
| 887 | # ifndef yystpcpy | ||
| 888 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | ||
| 889 | # define yystpcpy stpcpy | ||
| 890 | # else | ||
| 891 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | ||
| 892 | YYDEST. */ | ||
| 893 | static char * | ||
| 894 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 895 | yystpcpy (char *yydest, const char *yysrc) | ||
| 896 | # else | ||
| 897 | yystpcpy (yydest, yysrc) | ||
| 898 | char *yydest; | ||
| 899 | const char *yysrc; | ||
| 900 | # endif | ||
| 901 | { | ||
| 902 | register char *yyd = yydest; | ||
| 903 | register const char *yys = yysrc; | ||
| 904 | |||
| 905 | while ((*yyd++ = *yys++) != '\0') | ||
| 906 | continue; | ||
| 907 | |||
| 908 | return yyd - 1; | ||
| 909 | } | ||
| 910 | # endif | ||
| 911 | # endif | ||
| 912 | |||
| 913 | #endif /* !YYERROR_VERBOSE */ | ||
| 914 | |||
| 915 | |||
| 916 | |||
| 917 | #if YYDEBUG | ||
| 918 | /*--------------------------------. | ||
| 919 | | Print this symbol on YYOUTPUT. | | ||
| 920 | `--------------------------------*/ | ||
| 921 | |||
| 922 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 923 | static void | ||
| 924 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) | ||
| 925 | #else | ||
| 926 | static void | ||
| 927 | yysymprint (yyoutput, yytype, yyvaluep) | ||
| 928 | FILE *yyoutput; | ||
| 929 | int yytype; | ||
| 930 | YYSTYPE *yyvaluep; | ||
| 931 | #endif | ||
| 932 | { | ||
| 933 | /* Pacify ``unused variable'' warnings. */ | ||
| 934 | (void) yyvaluep; | ||
| 935 | |||
| 936 | if (yytype < YYNTOKENS) | ||
| 937 | { | ||
| 938 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); | ||
| 939 | # ifdef YYPRINT | ||
| 940 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | ||
| 941 | # endif | ||
| 942 | } | ||
| 943 | else | ||
| 944 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | ||
| 945 | |||
| 946 | switch (yytype) | ||
| 947 | { | ||
| 948 | default: | ||
| 949 | break; | ||
| 950 | } | ||
| 951 | YYFPRINTF (yyoutput, ")"); | ||
| 952 | } | ||
| 953 | |||
| 954 | #endif /* ! YYDEBUG */ | ||
| 955 | /*-----------------------------------------------. | ||
| 956 | | Release the memory associated to this symbol. | | ||
| 957 | `-----------------------------------------------*/ | ||
| 958 | |||
| 959 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 960 | static void | ||
| 961 | yydestruct (int yytype, YYSTYPE *yyvaluep) | ||
| 962 | #else | ||
| 963 | static void | ||
| 964 | yydestruct (yytype, yyvaluep) | ||
| 965 | int yytype; | ||
| 966 | YYSTYPE *yyvaluep; | ||
| 967 | #endif | ||
| 968 | { | ||
| 969 | /* Pacify ``unused variable'' warnings. */ | ||
| 970 | (void) yyvaluep; | ||
| 971 | |||
| 972 | switch (yytype) | ||
| 973 | { | ||
| 974 | |||
| 975 | default: | ||
| 976 | break; | ||
| 977 | } | ||
| 978 | } | ||
| 979 | |||
| 980 | |||
| 981 | /* Prevent warnings from -Wmissing-prototypes. */ | ||
| 982 | |||
| 983 | #ifdef YYPARSE_PARAM | ||
| 984 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 985 | int yyparse (void *YYPARSE_PARAM); | ||
| 986 | # else | ||
| 987 | int yyparse (); | ||
| 988 | # endif | ||
| 989 | #else /* ! YYPARSE_PARAM */ | ||
| 990 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 991 | int yyparse (void); | ||
| 992 | #else | ||
| 993 | int yyparse (); | ||
| 994 | #endif | ||
| 995 | #endif /* ! YYPARSE_PARAM */ | ||
| 996 | |||
| 997 | |||
| 998 | |||
| 999 | /* The lookahead symbol. */ | ||
| 1000 | int yychar; | ||
| 1001 | |||
| 1002 | /* The semantic value of the lookahead symbol. */ | ||
| 1003 | YYSTYPE yylval; | ||
| 1004 | |||
| 1005 | /* Number of syntax errors so far. */ | ||
| 1006 | int yynerrs; | ||
| 1007 | |||
| 1008 | |||
| 1009 | |||
| 1010 | /*----------. | ||
| 1011 | | yyparse. | | ||
| 1012 | `----------*/ | ||
| 1013 | |||
| 1014 | #ifdef YYPARSE_PARAM | ||
| 1015 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 1016 | int yyparse (void *YYPARSE_PARAM) | ||
| 1017 | # else | ||
| 1018 | int yyparse (YYPARSE_PARAM) | ||
| 1019 | void *YYPARSE_PARAM; | ||
| 1020 | # endif | ||
| 1021 | #else /* ! YYPARSE_PARAM */ | ||
| 1022 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 1023 | int | ||
| 1024 | yyparse (void) | ||
| 1025 | #else | ||
| 1026 | int | ||
| 1027 | yyparse () | ||
| 1028 | |||
| 1029 | #endif | ||
| 1030 | #endif | ||
| 1031 | { | ||
| 1032 | |||
| 1033 | register int yystate; | ||
| 1034 | register int yyn; | ||
| 1035 | int yyresult; | ||
| 1036 | /* Number of tokens to shift before error messages enabled. */ | ||
| 1037 | int yyerrstatus; | ||
| 1038 | /* Lookahead token as an internal (translated) token number. */ | ||
| 1039 | int yytoken = 0; | ||
| 1040 | |||
| 1041 | /* Three stacks and their tools: | ||
| 1042 | `yyss': related to states, | ||
| 1043 | `yyvs': related to semantic values, | ||
| 1044 | `yyls': related to locations. | ||
| 1045 | |||
| 1046 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
| 1047 | to reallocate them elsewhere. */ | ||
| 1048 | |||
| 1049 | /* The state stack. */ | ||
| 1050 | short yyssa[YYINITDEPTH]; | ||
| 1051 | short *yyss = yyssa; | ||
| 1052 | register short *yyssp; | ||
| 1053 | |||
| 1054 | /* The semantic value stack. */ | ||
| 1055 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
| 1056 | YYSTYPE *yyvs = yyvsa; | ||
| 1057 | register YYSTYPE *yyvsp; | ||
| 1058 | |||
| 1059 | |||
| 1060 | |||
| 1061 | #define YYPOPSTACK (yyvsp--, yyssp--) | ||
| 1062 | |||
| 1063 | YYSIZE_T yystacksize = YYINITDEPTH; | ||
| 1064 | |||
| 1065 | /* The variables used to return semantic value and location from the | ||
| 1066 | action routines. */ | ||
| 1067 | YYSTYPE yyval; | ||
| 1068 | |||
| 1069 | |||
| 1070 | /* When reducing, the number of symbols on the RHS of the reduced | ||
| 1071 | rule. */ | ||
| 1072 | int yylen; | ||
| 1073 | |||
| 1074 | YYDPRINTF ((stderr, "Starting parse\n")); | ||
| 1075 | |||
| 1076 | yystate = 0; | ||
| 1077 | yyerrstatus = 0; | ||
| 1078 | yynerrs = 0; | ||
| 1079 | yychar = YYEMPTY; /* Cause a token to be read. */ | ||
| 1080 | |||
| 1081 | /* Initialize stack pointers. | ||
| 1082 | Waste one element of value and location stack | ||
| 1083 | so that they stay on the same level as the state stack. | ||
| 1084 | The wasted elements are never initialized. */ | ||
| 1085 | |||
| 1086 | yyssp = yyss; | ||
| 1087 | yyvsp = yyvs; | ||
| 1088 | |||
| 1089 | goto yysetstate; | ||
| 1090 | |||
| 1091 | /*------------------------------------------------------------. | ||
| 1092 | | yynewstate -- Push a new state, which is found in yystate. | | ||
| 1093 | `------------------------------------------------------------*/ | ||
| 1094 | yynewstate: | ||
| 1095 | /* In all cases, when you get here, the value and location stacks | ||
| 1096 | have just been pushed. so pushing a state here evens the stacks. | ||
| 1097 | */ | ||
| 1098 | yyssp++; | ||
| 1099 | |||
| 1100 | yysetstate: | ||
| 1101 | *yyssp = yystate; | ||
| 1102 | |||
| 1103 | if (yyss + yystacksize - 1 <= yyssp) | ||
| 1104 | { | ||
| 1105 | /* Get the current used size of the three stacks, in elements. */ | ||
| 1106 | YYSIZE_T yysize = yyssp - yyss + 1; | ||
| 1107 | |||
| 1108 | #ifdef yyoverflow | ||
| 1109 | { | ||
| 1110 | /* Give user a chance to reallocate the stack. Use copies of | ||
| 1111 | these so that the &'s don't force the real ones into | ||
| 1112 | memory. */ | ||
| 1113 | YYSTYPE *yyvs1 = yyvs; | ||
| 1114 | short *yyss1 = yyss; | ||
| 1115 | |||
| 1116 | |||
| 1117 | /* Each stack pointer address is followed by the size of the | ||
| 1118 | data in use in that stack, in bytes. This used to be a | ||
| 1119 | conditional around just the two extra args, but that might | ||
| 1120 | be undefined if yyoverflow is a macro. */ | ||
| 1121 | yyoverflow ("parser stack overflow", | ||
| 1122 | &yyss1, yysize * sizeof (*yyssp), | ||
| 1123 | &yyvs1, yysize * sizeof (*yyvsp), | ||
| 1124 | |||
| 1125 | &yystacksize); | ||
| 1126 | |||
| 1127 | yyss = yyss1; | ||
| 1128 | yyvs = yyvs1; | ||
| 1129 | } | ||
| 1130 | #else /* no yyoverflow */ | ||
| 1131 | # ifndef YYSTACK_RELOCATE | ||
| 1132 | goto yyoverflowlab; | ||
| 1133 | # else | ||
| 1134 | /* Extend the stack our own way. */ | ||
| 1135 | if (YYMAXDEPTH <= yystacksize) | ||
| 1136 | goto yyoverflowlab; | ||
| 1137 | yystacksize *= 2; | ||
| 1138 | if (YYMAXDEPTH < yystacksize) | ||
| 1139 | yystacksize = YYMAXDEPTH; | ||
| 1140 | |||
| 1141 | { | ||
| 1142 | short *yyss1 = yyss; | ||
| 1143 | union yyalloc *yyptr = | ||
| 1144 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | ||
| 1145 | if (! yyptr) | ||
| 1146 | goto yyoverflowlab; | ||
| 1147 | YYSTACK_RELOCATE (yyss); | ||
| 1148 | YYSTACK_RELOCATE (yyvs); | ||
| 1149 | |||
| 1150 | # undef YYSTACK_RELOCATE | ||
| 1151 | if (yyss1 != yyssa) | ||
| 1152 | YYSTACK_FREE (yyss1); | ||
| 1153 | } | ||
| 1154 | # endif | ||
| 1155 | #endif /* no yyoverflow */ | ||
| 1156 | |||
| 1157 | yyssp = yyss + yysize - 1; | ||
| 1158 | yyvsp = yyvs + yysize - 1; | ||
| 1159 | |||
| 1160 | |||
| 1161 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | ||
| 1162 | (unsigned long int) yystacksize)); | ||
| 1163 | |||
| 1164 | if (yyss + yystacksize - 1 <= yyssp) | ||
| 1165 | YYABORT; | ||
| 1166 | } | ||
| 1167 | |||
| 1168 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | ||
| 1169 | |||
| 1170 | goto yybackup; | ||
| 1171 | |||
| 1172 | /*-----------. | ||
| 1173 | | yybackup. | | ||
| 1174 | `-----------*/ | ||
| 1175 | yybackup: | ||
| 1176 | |||
| 1177 | /* Do appropriate processing given the current state. */ | ||
| 1178 | /* Read a lookahead token if we need one and don't already have one. */ | ||
| 1179 | /* yyresume: */ | ||
| 1180 | |||
| 1181 | /* First try to decide what to do without reference to lookahead token. */ | ||
| 1182 | |||
| 1183 | yyn = yypact[yystate]; | ||
| 1184 | if (yyn == YYPACT_NINF) | ||
| 1185 | goto yydefault; | ||
| 1186 | |||
| 1187 | /* Not known => get a lookahead token if don't already have one. */ | ||
| 1188 | |||
| 1189 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ | ||
| 1190 | if (yychar == YYEMPTY) | ||
| 1191 | { | ||
| 1192 | YYDPRINTF ((stderr, "Reading a token: ")); | ||
| 1193 | yychar = YYLEX; | ||
| 1194 | } | ||
| 1195 | |||
| 1196 | if (yychar <= YYEOF) | ||
| 1197 | { | ||
| 1198 | yychar = yytoken = YYEOF; | ||
| 1199 | YYDPRINTF ((stderr, "Now at end of input.\n")); | ||
| 1200 | } | ||
| 1201 | else | ||
| 1202 | { | ||
| 1203 | yytoken = YYTRANSLATE (yychar); | ||
| 1204 | YYDSYMPRINTF ("Next token is", yytoken, &yylval, &yylloc); | ||
| 1205 | } | ||
| 1206 | |||
| 1207 | /* If the proper action on seeing token YYTOKEN is to reduce or to | ||
| 1208 | detect an error, take that action. */ | ||
| 1209 | yyn += yytoken; | ||
| 1210 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | ||
| 1211 | goto yydefault; | ||
| 1212 | yyn = yytable[yyn]; | ||
| 1213 | if (yyn <= 0) | ||
| 1214 | { | ||
| 1215 | if (yyn == 0 || yyn == YYTABLE_NINF) | ||
| 1216 | goto yyerrlab; | ||
| 1217 | yyn = -yyn; | ||
| 1218 | goto yyreduce; | ||
| 1219 | } | ||
| 1220 | |||
| 1221 | if (yyn == YYFINAL) | ||
| 1222 | YYACCEPT; | ||
| 1223 | |||
| 1224 | /* Shift the lookahead token. */ | ||
| 1225 | YYDPRINTF ((stderr, "Shifting token %s, ", yytname[yytoken])); | ||
| 1226 | |||
| 1227 | /* Discard the token being shifted unless it is eof. */ | ||
| 1228 | if (yychar != YYEOF) | ||
| 1229 | yychar = YYEMPTY; | ||
| 1230 | |||
| 1231 | *++yyvsp = yylval; | ||
| 1232 | |||
| 1233 | |||
| 1234 | /* Count tokens shifted since error; after three, turn off error | ||
| 1235 | status. */ | ||
| 1236 | if (yyerrstatus) | ||
| 1237 | yyerrstatus--; | ||
| 1238 | |||
| 1239 | yystate = yyn; | ||
| 1240 | goto yynewstate; | ||
| 1241 | |||
| 1242 | |||
| 1243 | /*-----------------------------------------------------------. | ||
| 1244 | | yydefault -- do the default action for the current state. | | ||
| 1245 | `-----------------------------------------------------------*/ | ||
| 1246 | yydefault: | ||
| 1247 | yyn = yydefact[yystate]; | ||
| 1248 | if (yyn == 0) | ||
| 1249 | goto yyerrlab; | ||
| 1250 | goto yyreduce; | ||
| 1251 | |||
| 1252 | |||
| 1253 | /*-----------------------------. | ||
| 1254 | | yyreduce -- Do a reduction. | | ||
| 1255 | `-----------------------------*/ | ||
| 1256 | yyreduce: | ||
| 1257 | /* yyn is the number of a rule to reduce with. */ | ||
| 1258 | yylen = yyr2[yyn]; | ||
| 1259 | |||
| 1260 | /* If YYLEN is nonzero, implement the default value of the action: | ||
| 1261 | `$$ = $1'. | ||
| 1262 | |||
| 1263 | Otherwise, the following line sets YYVAL to garbage. | ||
| 1264 | This behavior is undocumented and Bison | ||
| 1265 | users should not rely upon it. Assigning to YYVAL | ||
| 1266 | unconditionally makes the parser a bit smaller, and it avoids a | ||
| 1267 | GCC warning that YYVAL may be used uninitialized. */ | ||
| 1268 | yyval = yyvsp[1-yylen]; | ||
| 1269 | |||
| 1270 | |||
| 1271 | YY_REDUCE_PRINT (yyn); | ||
| 1272 | switch (yyn) | ||
| 1273 | { | ||
| 1274 | case 8: | ||
| 1275 | |||
| 1276 | { zconfprint("unexpected 'endmenu' statement"); ;} | ||
| 1277 | break; | ||
| 1278 | |||
| 1279 | case 9: | ||
| 1280 | |||
| 1281 | { zconfprint("unexpected 'endif' statement"); ;} | ||
| 1282 | break; | ||
| 1283 | |||
| 1284 | case 10: | ||
| 1285 | |||
| 1286 | { zconfprint("unexpected 'endchoice' statement"); ;} | ||
| 1287 | break; | ||
| 1288 | |||
| 1289 | case 11: | ||
| 1290 | |||
| 1291 | { zconfprint("syntax error"); yyerrok; ;} | ||
| 1292 | break; | ||
| 1293 | |||
| 1294 | case 18: | ||
| 1295 | |||
| 1296 | { | ||
| 1297 | struct symbol *sym = sym_lookup(yyvsp[-1].string, 0); | ||
| 1298 | sym->flags |= SYMBOL_OPTIONAL; | ||
| 1299 | menu_add_entry(sym); | ||
| 1300 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string); | ||
| 1301 | ;} | ||
| 1302 | break; | ||
| 1303 | |||
| 1304 | case 19: | ||
| 1305 | |||
| 1306 | { | ||
| 1307 | menu_end_entry(); | ||
| 1308 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
| 1309 | ;} | ||
| 1310 | break; | ||
| 1311 | |||
| 1312 | case 20: | ||
| 1313 | |||
| 1314 | { | ||
| 1315 | struct symbol *sym = sym_lookup(yyvsp[-1].string, 0); | ||
| 1316 | sym->flags |= SYMBOL_OPTIONAL; | ||
| 1317 | menu_add_entry(sym); | ||
| 1318 | printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string); | ||
| 1319 | ;} | ||
| 1320 | break; | ||
| 1321 | |||
| 1322 | case 21: | ||
| 1323 | |||
| 1324 | { | ||
| 1325 | if (current_entry->prompt) | ||
| 1326 | current_entry->prompt->type = P_MENU; | ||
| 1327 | else | ||
| 1328 | zconfprint("warning: menuconfig statement without prompt"); | ||
| 1329 | menu_end_entry(); | ||
| 1330 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
| 1331 | ;} | ||
| 1332 | break; | ||
| 1333 | |||
| 1334 | case 27: | ||
| 1335 | |||
| 1336 | { | ||
| 1337 | menu_set_type(S_TRISTATE); | ||
| 1338 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
| 1339 | ;} | ||
| 1340 | break; | ||
| 1341 | |||
| 1342 | case 28: | ||
| 1343 | |||
| 1344 | { | ||
| 1345 | menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr); | ||
| 1346 | menu_set_type(S_TRISTATE); | ||
| 1347 | printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); | ||
| 1348 | ;} | ||
| 1349 | break; | ||
| 1350 | |||
| 1351 | case 29: | ||
| 1352 | |||
| 1353 | { | ||
| 1354 | menu_set_type(S_BOOLEAN); | ||
| 1355 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | ||
| 1356 | ;} | ||
| 1357 | break; | ||
| 1358 | |||
| 1359 | case 30: | ||
| 1360 | |||
| 1361 | { | ||
| 1362 | menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr); | ||
| 1363 | menu_set_type(S_BOOLEAN); | ||
| 1364 | printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); | ||
| 1365 | ;} | ||
| 1366 | break; | ||
| 1367 | |||
| 1368 | case 31: | ||
| 1369 | |||
| 1370 | { | ||
| 1371 | menu_set_type(S_INT); | ||
| 1372 | printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); | ||
| 1373 | ;} | ||
| 1374 | break; | ||
| 1375 | |||
| 1376 | case 32: | ||
| 1377 | |||
| 1378 | { | ||
| 1379 | menu_set_type(S_HEX); | ||
| 1380 | printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); | ||
| 1381 | ;} | ||
| 1382 | break; | ||
| 1383 | |||
| 1384 | case 33: | ||
| 1385 | |||
| 1386 | { | ||
| 1387 | menu_set_type(S_STRING); | ||
| 1388 | printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); | ||
| 1389 | ;} | ||
| 1390 | break; | ||
| 1391 | |||
| 1392 | case 34: | ||
| 1393 | |||
| 1394 | { | ||
| 1395 | menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr); | ||
| 1396 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
| 1397 | ;} | ||
| 1398 | break; | ||
| 1399 | |||
| 1400 | case 35: | ||
| 1401 | |||
| 1402 | { | ||
| 1403 | menu_add_expr(P_DEFAULT, yyvsp[-2].expr, yyvsp[-1].expr); | ||
| 1404 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | ||
| 1405 | ;} | ||
| 1406 | break; | ||
| 1407 | |||
| 1408 | case 36: | ||
| 1409 | |||
| 1410 | { | ||
| 1411 | menu_add_symbol(P_SELECT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr); | ||
| 1412 | printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); | ||
| 1413 | ;} | ||
| 1414 | break; | ||
| 1415 | |||
| 1416 | case 37: | ||
| 1417 | |||
| 1418 | { | ||
| 1419 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,yyvsp[-3].symbol, yyvsp[-2].symbol), yyvsp[-1].expr); | ||
| 1420 | printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); | ||
| 1421 | ;} | ||
| 1422 | break; | ||
| 1423 | |||
| 1424 | case 38: | ||
| 1425 | |||
| 1426 | { | ||
| 1427 | struct symbol *sym = sym_lookup(NULL, 0); | ||
| 1428 | sym->flags |= SYMBOL_CHOICE; | ||
| 1429 | menu_add_entry(sym); | ||
| 1430 | menu_add_expr(P_CHOICE, NULL, NULL); | ||
| 1431 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | ||
| 1432 | ;} | ||
| 1433 | break; | ||
| 1434 | |||
| 1435 | case 39: | ||
| 1436 | |||
| 1437 | { | ||
| 1438 | menu_end_entry(); | ||
| 1439 | menu_add_menu(); | ||
| 1440 | ;} | ||
| 1441 | break; | ||
| 1442 | |||
| 1443 | case 40: | ||
| 1444 | |||
| 1445 | { | ||
| 1446 | if (zconf_endtoken(yyvsp[0].token, T_CHOICE, T_ENDCHOICE)) { | ||
| 1447 | menu_end_menu(); | ||
| 1448 | printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); | ||
| 1449 | } | ||
| 1450 | ;} | ||
| 1451 | break; | ||
| 1452 | |||
| 1453 | case 42: | ||
| 1454 | |||
| 1455 | { | ||
| 1456 | printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 1457 | zconfnerrs++; | ||
| 1458 | ;} | ||
| 1459 | break; | ||
| 1460 | |||
| 1461 | case 48: | ||
| 1462 | |||
| 1463 | { | ||
| 1464 | menu_add_prompt(P_PROMPT, yyvsp[-2].string, yyvsp[-1].expr); | ||
| 1465 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
| 1466 | ;} | ||
| 1467 | break; | ||
| 1468 | |||
| 1469 | case 49: | ||
| 1470 | |||
| 1471 | { | ||
| 1472 | menu_set_type(S_TRISTATE); | ||
| 1473 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
| 1474 | ;} | ||
| 1475 | break; | ||
| 1476 | |||
| 1477 | case 50: | ||
| 1478 | |||
| 1479 | { | ||
| 1480 | menu_set_type(S_BOOLEAN); | ||
| 1481 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | ||
| 1482 | ;} | ||
| 1483 | break; | ||
| 1484 | |||
| 1485 | case 51: | ||
| 1486 | |||
| 1487 | { | ||
| 1488 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | ||
| 1489 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); | ||
| 1490 | ;} | ||
| 1491 | break; | ||
| 1492 | |||
| 1493 | case 52: | ||
| 1494 | |||
| 1495 | { | ||
| 1496 | menu_add_symbol(P_DEFAULT, sym_lookup(yyvsp[-2].string, 0), yyvsp[-1].expr); | ||
| 1497 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | ||
| 1498 | ;} | ||
| 1499 | break; | ||
| 1500 | |||
| 1501 | case 55: | ||
| 1502 | |||
| 1503 | { | ||
| 1504 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | ||
| 1505 | menu_add_entry(NULL); | ||
| 1506 | menu_add_dep(yyvsp[-1].expr); | ||
| 1507 | menu_end_entry(); | ||
| 1508 | menu_add_menu(); | ||
| 1509 | ;} | ||
| 1510 | break; | ||
| 1511 | |||
| 1512 | case 56: | ||
| 1513 | |||
| 1514 | { | ||
| 1515 | if (zconf_endtoken(yyvsp[0].token, T_IF, T_ENDIF)) { | ||
| 1516 | menu_end_menu(); | ||
| 1517 | printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); | ||
| 1518 | } | ||
| 1519 | ;} | ||
| 1520 | break; | ||
| 1521 | |||
| 1522 | case 58: | ||
| 1523 | |||
| 1524 | { | ||
| 1525 | printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 1526 | zconfnerrs++; | ||
| 1527 | ;} | ||
| 1528 | break; | ||
| 1529 | |||
| 1530 | case 63: | ||
| 1531 | |||
| 1532 | { | ||
| 1533 | menu_add_entry(NULL); | ||
| 1534 | menu_add_prop(P_MENU, yyvsp[-1].string, NULL, NULL); | ||
| 1535 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | ||
| 1536 | ;} | ||
| 1537 | break; | ||
| 1538 | |||
| 1539 | case 64: | ||
| 1540 | |||
| 1541 | { | ||
| 1542 | menu_end_entry(); | ||
| 1543 | menu_add_menu(); | ||
| 1544 | ;} | ||
| 1545 | break; | ||
| 1546 | |||
| 1547 | case 65: | ||
| 1548 | |||
| 1549 | { | ||
| 1550 | if (zconf_endtoken(yyvsp[0].token, T_MENU, T_ENDMENU)) { | ||
| 1551 | menu_end_menu(); | ||
| 1552 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); | ||
| 1553 | } | ||
| 1554 | ;} | ||
| 1555 | break; | ||
| 1556 | |||
| 1557 | case 67: | ||
| 1558 | |||
| 1559 | { | ||
| 1560 | printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 1561 | zconfnerrs++; | ||
| 1562 | ;} | ||
| 1563 | break; | ||
| 1564 | |||
| 1565 | case 72: | ||
| 1566 | |||
| 1567 | { zconfprint("invalid menu option"); yyerrok; ;} | ||
| 1568 | break; | ||
| 1569 | |||
| 1570 | case 73: | ||
| 1571 | |||
| 1572 | { | ||
| 1573 | yyval.string = yyvsp[-1].string; | ||
| 1574 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[-1].string); | ||
| 1575 | ;} | ||
| 1576 | break; | ||
| 1577 | |||
| 1578 | case 74: | ||
| 1579 | |||
| 1580 | { | ||
| 1581 | zconf_nextfile(yyvsp[0].string); | ||
| 1582 | ;} | ||
| 1583 | break; | ||
| 1584 | |||
| 1585 | case 75: | ||
| 1586 | |||
| 1587 | { | ||
| 1588 | menu_add_entry(NULL); | ||
| 1589 | menu_add_prop(P_COMMENT, yyvsp[-1].string, NULL, NULL); | ||
| 1590 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); | ||
| 1591 | ;} | ||
| 1592 | break; | ||
| 1593 | |||
| 1594 | case 76: | ||
| 1595 | |||
| 1596 | { | ||
| 1597 | menu_end_entry(); | ||
| 1598 | ;} | ||
| 1599 | break; | ||
| 1600 | |||
| 1601 | case 77: | ||
| 1602 | |||
| 1603 | { | ||
| 1604 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | ||
| 1605 | zconf_starthelp(); | ||
| 1606 | ;} | ||
| 1607 | break; | ||
| 1608 | |||
| 1609 | case 78: | ||
| 1610 | |||
| 1611 | { | ||
| 1612 | current_entry->sym->help = yyvsp[0].string; | ||
| 1613 | ;} | ||
| 1614 | break; | ||
| 1615 | |||
| 1616 | case 82: | ||
| 1617 | |||
| 1618 | { | ||
| 1619 | menu_add_dep(yyvsp[-1].expr); | ||
| 1620 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | ||
| 1621 | ;} | ||
| 1622 | break; | ||
| 1623 | |||
| 1624 | case 83: | ||
| 1625 | |||
| 1626 | { | ||
| 1627 | menu_add_dep(yyvsp[-1].expr); | ||
| 1628 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); | ||
| 1629 | ;} | ||
| 1630 | break; | ||
| 1631 | |||
| 1632 | case 84: | ||
| 1633 | |||
| 1634 | { | ||
| 1635 | menu_add_dep(yyvsp[-1].expr); | ||
| 1636 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); | ||
| 1637 | ;} | ||
| 1638 | break; | ||
| 1639 | |||
| 1640 | case 86: | ||
| 1641 | |||
| 1642 | { | ||
| 1643 | menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr); | ||
| 1644 | ;} | ||
| 1645 | break; | ||
| 1646 | |||
| 1647 | case 89: | ||
| 1648 | |||
| 1649 | { yyval.token = T_ENDMENU; ;} | ||
| 1650 | break; | ||
| 1651 | |||
| 1652 | case 90: | ||
| 1653 | |||
| 1654 | { yyval.token = T_ENDCHOICE; ;} | ||
| 1655 | break; | ||
| 1656 | |||
| 1657 | case 91: | ||
| 1658 | |||
| 1659 | { yyval.token = T_ENDIF; ;} | ||
| 1660 | break; | ||
| 1661 | |||
| 1662 | case 94: | ||
| 1663 | |||
| 1664 | { yyval.expr = NULL; ;} | ||
| 1665 | break; | ||
| 1666 | |||
| 1667 | case 95: | ||
| 1668 | |||
| 1669 | { yyval.expr = yyvsp[0].expr; ;} | ||
| 1670 | break; | ||
| 1671 | |||
| 1672 | case 96: | ||
| 1673 | |||
| 1674 | { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); ;} | ||
| 1675 | break; | ||
| 1676 | |||
| 1677 | case 97: | ||
| 1678 | |||
| 1679 | { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;} | ||
| 1680 | break; | ||
| 1681 | |||
| 1682 | case 98: | ||
| 1683 | |||
| 1684 | { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); ;} | ||
| 1685 | break; | ||
| 1686 | |||
| 1687 | case 99: | ||
| 1688 | |||
| 1689 | { yyval.expr = yyvsp[-1].expr; ;} | ||
| 1690 | break; | ||
| 1691 | |||
| 1692 | case 100: | ||
| 1693 | |||
| 1694 | { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); ;} | ||
| 1695 | break; | ||
| 1696 | |||
| 1697 | case 101: | ||
| 1698 | |||
| 1699 | { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); ;} | ||
| 1700 | break; | ||
| 1701 | |||
| 1702 | case 102: | ||
| 1703 | |||
| 1704 | { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); ;} | ||
| 1705 | break; | ||
| 1706 | |||
| 1707 | case 103: | ||
| 1708 | |||
| 1709 | { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); ;} | ||
| 1710 | break; | ||
| 1711 | |||
| 1712 | case 104: | ||
| 1713 | |||
| 1714 | { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); ;} | ||
| 1715 | break; | ||
| 1716 | |||
| 1717 | |||
| 1718 | } | ||
| 1719 | |||
| 1720 | /* Line 999 of yacc.c. */ | ||
| 1721 | |||
| 1722 | |||
| 1723 | yyvsp -= yylen; | ||
| 1724 | yyssp -= yylen; | ||
| 1725 | |||
| 1726 | |||
| 1727 | YY_STACK_PRINT (yyss, yyssp); | ||
| 1728 | |||
| 1729 | *++yyvsp = yyval; | ||
| 1730 | |||
| 1731 | |||
| 1732 | /* Now `shift' the result of the reduction. Determine what state | ||
| 1733 | that goes to, based on the state we popped back to and the rule | ||
| 1734 | number reduced by. */ | ||
| 1735 | |||
| 1736 | yyn = yyr1[yyn]; | ||
| 1737 | |||
| 1738 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | ||
| 1739 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | ||
| 1740 | yystate = yytable[yystate]; | ||
| 1741 | else | ||
| 1742 | yystate = yydefgoto[yyn - YYNTOKENS]; | ||
| 1743 | |||
| 1744 | goto yynewstate; | ||
| 1745 | |||
| 1746 | |||
| 1747 | /*------------------------------------. | ||
| 1748 | | yyerrlab -- here on detecting error | | ||
| 1749 | `------------------------------------*/ | ||
| 1750 | yyerrlab: | ||
| 1751 | /* If not already recovering from an error, report this error. */ | ||
| 1752 | if (!yyerrstatus) | ||
| 1753 | { | ||
| 1754 | ++yynerrs; | ||
| 1755 | #if YYERROR_VERBOSE | ||
| 1756 | yyn = yypact[yystate]; | ||
| 1757 | |||
| 1758 | if (YYPACT_NINF < yyn && yyn < YYLAST) | ||
| 1759 | { | ||
| 1760 | YYSIZE_T yysize = 0; | ||
| 1761 | int yytype = YYTRANSLATE (yychar); | ||
| 1762 | char *yymsg; | ||
| 1763 | int yyx, yycount; | ||
| 1764 | |||
| 1765 | yycount = 0; | ||
| 1766 | /* Start YYX at -YYN if negative to avoid negative indexes in | ||
| 1767 | YYCHECK. */ | ||
| 1768 | for (yyx = yyn < 0 ? -yyn : 0; | ||
| 1769 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) | ||
| 1770 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
| 1771 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; | ||
| 1772 | yysize += yystrlen ("syntax error, unexpected ") + 1; | ||
| 1773 | yysize += yystrlen (yytname[yytype]); | ||
| 1774 | yymsg = (char *) YYSTACK_ALLOC (yysize); | ||
| 1775 | if (yymsg != 0) | ||
| 1776 | { | ||
| 1777 | char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); | ||
| 1778 | yyp = yystpcpy (yyp, yytname[yytype]); | ||
| 1779 | |||
| 1780 | if (yycount < 5) | ||
| 1781 | { | ||
| 1782 | yycount = 0; | ||
| 1783 | for (yyx = yyn < 0 ? -yyn : 0; | ||
| 1784 | yyx < (int) (sizeof (yytname) / sizeof (char *)); | ||
| 1785 | yyx++) | ||
| 1786 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
| 1787 | { | ||
| 1788 | const char *yyq = ! yycount ? ", expecting " : " or "; | ||
| 1789 | yyp = yystpcpy (yyp, yyq); | ||
| 1790 | yyp = yystpcpy (yyp, yytname[yyx]); | ||
| 1791 | yycount++; | ||
| 1792 | } | ||
| 1793 | } | ||
| 1794 | yyerror (yymsg); | ||
| 1795 | YYSTACK_FREE (yymsg); | ||
| 1796 | } | ||
| 1797 | else | ||
| 1798 | yyerror ("syntax error; also virtual memory exhausted"); | ||
| 1799 | } | ||
| 1800 | else | ||
| 1801 | #endif /* YYERROR_VERBOSE */ | ||
| 1802 | yyerror ("syntax error"); | ||
| 1803 | } | ||
| 1804 | |||
| 1805 | |||
| 1806 | |||
| 1807 | if (yyerrstatus == 3) | ||
| 1808 | { | ||
| 1809 | /* If just tried and failed to reuse lookahead token after an | ||
| 1810 | error, discard it. */ | ||
| 1811 | |||
| 1812 | /* Return failure if at end of input. */ | ||
| 1813 | if (yychar == YYEOF) | ||
| 1814 | { | ||
| 1815 | /* Pop the error token. */ | ||
| 1816 | YYPOPSTACK; | ||
| 1817 | /* Pop the rest of the stack. */ | ||
| 1818 | while (yyss < yyssp) | ||
| 1819 | { | ||
| 1820 | YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); | ||
| 1821 | yydestruct (yystos[*yyssp], yyvsp); | ||
| 1822 | YYPOPSTACK; | ||
| 1823 | } | ||
| 1824 | YYABORT; | ||
| 1825 | } | ||
| 1826 | |||
| 1827 | YYDSYMPRINTF ("Error: discarding", yytoken, &yylval, &yylloc); | ||
| 1828 | yydestruct (yytoken, &yylval); | ||
| 1829 | yychar = YYEMPTY; | ||
| 1830 | |||
| 1831 | } | ||
| 1832 | |||
| 1833 | /* Else will try to reuse lookahead token after shifting the error | ||
| 1834 | token. */ | ||
| 1835 | goto yyerrlab1; | ||
| 1836 | |||
| 1837 | |||
| 1838 | /*----------------------------------------------------. | ||
| 1839 | | yyerrlab1 -- error raised explicitly by an action. | | ||
| 1840 | `----------------------------------------------------*/ | ||
| 1841 | yyerrlab1: | ||
| 1842 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | ||
| 1843 | |||
| 1844 | for (;;) | ||
| 1845 | { | ||
| 1846 | yyn = yypact[yystate]; | ||
| 1847 | if (yyn != YYPACT_NINF) | ||
| 1848 | { | ||
| 1849 | yyn += YYTERROR; | ||
| 1850 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | ||
| 1851 | { | ||
| 1852 | yyn = yytable[yyn]; | ||
| 1853 | if (0 < yyn) | ||
| 1854 | break; | ||
| 1855 | } | ||
| 1856 | } | ||
| 1857 | |||
| 1858 | /* Pop the current state because it cannot handle the error token. */ | ||
| 1859 | if (yyssp == yyss) | ||
| 1860 | YYABORT; | ||
| 1861 | |||
| 1862 | YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp, yylsp); | ||
| 1863 | yydestruct (yystos[yystate], yyvsp); | ||
| 1864 | yyvsp--; | ||
| 1865 | yystate = *--yyssp; | ||
| 1866 | |||
| 1867 | YY_STACK_PRINT (yyss, yyssp); | ||
| 1868 | } | ||
| 1869 | |||
| 1870 | if (yyn == YYFINAL) | ||
| 1871 | YYACCEPT; | ||
| 1872 | |||
| 1873 | YYDPRINTF ((stderr, "Shifting error token, ")); | ||
| 1874 | |||
| 1875 | *++yyvsp = yylval; | ||
| 1876 | |||
| 1877 | |||
| 1878 | yystate = yyn; | ||
| 1879 | goto yynewstate; | ||
| 1880 | |||
| 1881 | |||
| 1882 | /*-------------------------------------. | ||
| 1883 | | yyacceptlab -- YYACCEPT comes here. | | ||
| 1884 | `-------------------------------------*/ | ||
| 1885 | yyacceptlab: | ||
| 1886 | yyresult = 0; | ||
| 1887 | goto yyreturn; | ||
| 1888 | |||
| 1889 | /*-----------------------------------. | ||
| 1890 | | yyabortlab -- YYABORT comes here. | | ||
| 1891 | `-----------------------------------*/ | ||
| 1892 | yyabortlab: | ||
| 1893 | yyresult = 1; | ||
| 1894 | goto yyreturn; | ||
| 1895 | |||
| 1896 | #ifndef yyoverflow | ||
| 1897 | /*----------------------------------------------. | ||
| 1898 | | yyoverflowlab -- parser overflow comes here. | | ||
| 1899 | `----------------------------------------------*/ | ||
| 1900 | yyoverflowlab: | ||
| 1901 | yyerror ("parser stack overflow"); | ||
| 1902 | yyresult = 2; | ||
| 1903 | /* Fall through. */ | ||
| 1904 | #endif | ||
| 1905 | |||
| 1906 | yyreturn: | ||
| 1907 | #ifndef yyoverflow | ||
| 1908 | if (yyss != yyssa) | ||
| 1909 | YYSTACK_FREE (yyss); | ||
| 1910 | #endif | ||
| 1911 | return yyresult; | ||
| 1912 | } | ||
| 1913 | |||
| 1914 | |||
| 1915 | |||
| 1916 | |||
| 1917 | |||
| 1918 | void conf_parse(const char *name) | ||
| 1919 | { | ||
| 1920 | struct symbol *sym; | ||
| 1921 | int i; | ||
| 1922 | |||
| 1923 | zconf_initscan(name); | ||
| 1924 | |||
| 1925 | sym_init(); | ||
| 1926 | menu_init(); | ||
| 1927 | modules_sym = sym_lookup("MODULES", 0); | ||
| 1928 | rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); | ||
| 1929 | |||
| 1930 | //zconfdebug = 1; | ||
| 1931 | zconfparse(); | ||
| 1932 | if (zconfnerrs) | ||
| 1933 | exit(1); | ||
| 1934 | menu_finalize(&rootmenu); | ||
| 1935 | for_all_symbols(i, sym) { | ||
| 1936 | if (!(sym->flags & SYMBOL_CHECKED) && sym_check_deps(sym)) | ||
| 1937 | printf("\n"); | ||
| 1938 | else | ||
| 1939 | sym->flags |= SYMBOL_CHECK_DONE; | ||
| 1940 | } | ||
| 1941 | |||
| 1942 | sym_change_count = 1; | ||
| 1943 | } | ||
| 1944 | |||
| 1945 | const char *zconf_tokenname(int token) | ||
| 1946 | { | ||
| 1947 | switch (token) { | ||
| 1948 | case T_MENU: return "menu"; | ||
| 1949 | case T_ENDMENU: return "endmenu"; | ||
| 1950 | case T_CHOICE: return "choice"; | ||
| 1951 | case T_ENDCHOICE: return "endchoice"; | ||
| 1952 | case T_IF: return "if"; | ||
| 1953 | case T_ENDIF: return "endif"; | ||
| 1954 | } | ||
| 1955 | return "<token>"; | ||
| 1956 | } | ||
| 1957 | |||
| 1958 | static bool zconf_endtoken(int token, int starttoken, int endtoken) | ||
| 1959 | { | ||
| 1960 | if (token != endtoken) { | ||
| 1961 | zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); | ||
| 1962 | zconfnerrs++; | ||
| 1963 | return false; | ||
| 1964 | } | ||
| 1965 | if (current_menu->file != current_file) { | ||
| 1966 | zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); | ||
| 1967 | zconfprint("location of the '%s'", zconf_tokenname(starttoken)); | ||
| 1968 | zconfnerrs++; | ||
| 1969 | return false; | ||
| 1970 | } | ||
| 1971 | return true; | ||
| 1972 | } | ||
| 1973 | |||
| 1974 | static void zconfprint(const char *err, ...) | ||
| 1975 | { | ||
| 1976 | va_list ap; | ||
| 1977 | |||
| 1978 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1); | ||
| 1979 | va_start(ap, err); | ||
| 1980 | vfprintf(stderr, err, ap); | ||
| 1981 | va_end(ap); | ||
| 1982 | fprintf(stderr, "\n"); | ||
| 1983 | } | ||
| 1984 | |||
| 1985 | static void zconferror(const char *err) | ||
| 1986 | { | ||
| 1987 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | ||
| 1988 | } | ||
| 1989 | |||
| 1990 | void print_quoted_string(FILE *out, const char *str) | ||
| 1991 | { | ||
| 1992 | const char *p; | ||
| 1993 | int len; | ||
| 1994 | |||
| 1995 | putc('"', out); | ||
| 1996 | while ((p = strchr(str, '"'))) { | ||
| 1997 | len = p - str; | ||
| 1998 | if (len) | ||
| 1999 | fprintf(out, "%.*s", len, str); | ||
| 2000 | fputs("\\\"", out); | ||
| 2001 | str = p + 1; | ||
| 2002 | } | ||
| 2003 | fputs(str, out); | ||
| 2004 | putc('"', out); | ||
| 2005 | } | ||
| 2006 | |||
| 2007 | void print_symbol(FILE *out, struct menu *menu) | ||
| 2008 | { | ||
| 2009 | struct symbol *sym = menu->sym; | ||
| 2010 | struct property *prop; | ||
| 2011 | |||
| 2012 | if (sym_is_choice(sym)) | ||
| 2013 | fprintf(out, "choice\n"); | ||
| 2014 | else | ||
| 2015 | fprintf(out, "config %s\n", sym->name); | ||
| 2016 | switch (sym->type) { | ||
| 2017 | case S_BOOLEAN: | ||
| 2018 | fputs(" boolean\n", out); | ||
| 2019 | break; | ||
| 2020 | case S_TRISTATE: | ||
| 2021 | fputs(" tristate\n", out); | ||
| 2022 | break; | ||
| 2023 | case S_STRING: | ||
| 2024 | fputs(" string\n", out); | ||
| 2025 | break; | ||
| 2026 | case S_INT: | ||
| 2027 | fputs(" integer\n", out); | ||
| 2028 | break; | ||
| 2029 | case S_HEX: | ||
| 2030 | fputs(" hex\n", out); | ||
| 2031 | break; | ||
| 2032 | default: | ||
| 2033 | fputs(" ???\n", out); | ||
| 2034 | break; | ||
| 2035 | } | ||
| 2036 | for (prop = sym->prop; prop; prop = prop->next) { | ||
| 2037 | if (prop->menu != menu) | ||
| 2038 | continue; | ||
| 2039 | switch (prop->type) { | ||
| 2040 | case P_PROMPT: | ||
| 2041 | fputs(" prompt ", out); | ||
| 2042 | print_quoted_string(out, prop->text); | ||
| 2043 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 2044 | fputs(" if ", out); | ||
| 2045 | expr_fprint(prop->visible.expr, out); | ||
| 2046 | } | ||
| 2047 | fputc('\n', out); | ||
| 2048 | break; | ||
| 2049 | case P_DEFAULT: | ||
| 2050 | fputs( " default ", out); | ||
| 2051 | expr_fprint(prop->expr, out); | ||
| 2052 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 2053 | fputs(" if ", out); | ||
| 2054 | expr_fprint(prop->visible.expr, out); | ||
| 2055 | } | ||
| 2056 | fputc('\n', out); | ||
| 2057 | break; | ||
| 2058 | case P_CHOICE: | ||
| 2059 | fputs(" #choice value\n", out); | ||
| 2060 | break; | ||
| 2061 | default: | ||
| 2062 | fprintf(out, " unknown prop %d!\n", prop->type); | ||
| 2063 | break; | ||
| 2064 | } | ||
| 2065 | } | ||
| 2066 | if (sym->help) { | ||
| 2067 | int len = strlen(sym->help); | ||
| 2068 | while (sym->help[--len] == '\n') | ||
| 2069 | sym->help[len] = 0; | ||
| 2070 | fprintf(out, " help\n%s\n", sym->help); | ||
| 2071 | } | ||
| 2072 | fputc('\n', out); | ||
| 2073 | } | ||
| 2074 | |||
| 2075 | void zconfdump(FILE *out) | ||
| 2076 | { | ||
| 2077 | struct property *prop; | ||
| 2078 | struct symbol *sym; | ||
| 2079 | struct menu *menu; | ||
| 2080 | |||
| 2081 | menu = rootmenu.list; | ||
| 2082 | while (menu) { | ||
| 2083 | if ((sym = menu->sym)) | ||
| 2084 | print_symbol(out, menu); | ||
| 2085 | else if ((prop = menu->prompt)) { | ||
| 2086 | switch (prop->type) { | ||
| 2087 | case P_COMMENT: | ||
| 2088 | fputs("\ncomment ", out); | ||
| 2089 | print_quoted_string(out, prop->text); | ||
| 2090 | fputs("\n", out); | ||
| 2091 | break; | ||
| 2092 | case P_MENU: | ||
| 2093 | fputs("\nmenu ", out); | ||
| 2094 | print_quoted_string(out, prop->text); | ||
| 2095 | fputs("\n", out); | ||
| 2096 | break; | ||
| 2097 | default: | ||
| 2098 | ; | ||
| 2099 | } | ||
| 2100 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 2101 | fputs(" depends ", out); | ||
| 2102 | expr_fprint(prop->visible.expr, out); | ||
| 2103 | fputc('\n', out); | ||
| 2104 | } | ||
| 2105 | fputs("\n", out); | ||
| 2106 | } | ||
| 2107 | |||
| 2108 | if (menu->list) | ||
| 2109 | menu = menu->list; | ||
| 2110 | else if (menu->next) | ||
| 2111 | menu = menu->next; | ||
| 2112 | else while ((menu = menu->parent)) { | ||
| 2113 | if (menu->prompt && menu->prompt->type == P_MENU) | ||
| 2114 | fputs("\nendmenu\n", out); | ||
| 2115 | if (menu->next) { | ||
| 2116 | menu = menu->next; | ||
| 2117 | break; | ||
| 2118 | } | ||
| 2119 | } | ||
| 2120 | } | ||
| 2121 | } | ||
| 2122 | |||
| 2123 | #include "lex.zconf.c" | ||
| 2124 | #include "util.c" | ||
| 2125 | #include "confdata.c" | ||
| 2126 | #include "expr.c" | ||
| 2127 | #include "symbol.c" | ||
| 2128 | #include "menu.c" | ||
| 2129 | |||
| 2130 | |||
diff --git a/scripts/kconfig/zconf.tab.h_shipped b/scripts/kconfig/zconf.tab.h_shipped new file mode 100644 index 000000000000..3b191ef59985 --- /dev/null +++ b/scripts/kconfig/zconf.tab.h_shipped | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | /* A Bison parser, made from zconf.y, by GNU bison 1.75. */ | ||
| 2 | |||
| 3 | /* Skeleton parser for Yacc-like parsing with Bison, | ||
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program; if not, write to the Free Software | ||
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 19 | Boston, MA 02111-1307, USA. */ | ||
| 20 | |||
| 21 | /* As a special exception, when this file is copied by Bison into a | ||
| 22 | Bison output file, you may use that output file without restriction. | ||
| 23 | This special exception was added by the Free Software Foundation | ||
| 24 | in version 1.24 of Bison. */ | ||
| 25 | |||
| 26 | #ifndef BISON_ZCONF_TAB_H | ||
| 27 | # define BISON_ZCONF_TAB_H | ||
| 28 | |||
| 29 | /* Tokens. */ | ||
| 30 | #ifndef YYTOKENTYPE | ||
| 31 | # define YYTOKENTYPE | ||
| 32 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
| 33 | know about them. */ | ||
| 34 | enum yytokentype { | ||
| 35 | T_MAINMENU = 258, | ||
| 36 | T_MENU = 259, | ||
| 37 | T_ENDMENU = 260, | ||
| 38 | T_SOURCE = 261, | ||
| 39 | T_CHOICE = 262, | ||
| 40 | T_ENDCHOICE = 263, | ||
| 41 | T_COMMENT = 264, | ||
| 42 | T_CONFIG = 265, | ||
| 43 | T_HELP = 266, | ||
| 44 | T_HELPTEXT = 267, | ||
| 45 | T_IF = 268, | ||
| 46 | T_ENDIF = 269, | ||
| 47 | T_DEPENDS = 270, | ||
| 48 | T_REQUIRES = 271, | ||
| 49 | T_OPTIONAL = 272, | ||
| 50 | T_PROMPT = 273, | ||
| 51 | T_DEFAULT = 274, | ||
| 52 | T_TRISTATE = 275, | ||
| 53 | T_BOOLEAN = 276, | ||
| 54 | T_INT = 277, | ||
| 55 | T_HEX = 278, | ||
| 56 | T_WORD = 279, | ||
| 57 | T_STRING = 280, | ||
| 58 | T_UNEQUAL = 281, | ||
| 59 | T_EOF = 282, | ||
| 60 | T_EOL = 283, | ||
| 61 | T_CLOSE_PAREN = 284, | ||
| 62 | T_OPEN_PAREN = 285, | ||
| 63 | T_ON = 286, | ||
| 64 | T_OR = 287, | ||
| 65 | T_AND = 288, | ||
| 66 | T_EQUAL = 289, | ||
| 67 | T_NOT = 290 | ||
| 68 | }; | ||
| 69 | #endif | ||
| 70 | #define T_MAINMENU 258 | ||
| 71 | #define T_MENU 259 | ||
| 72 | #define T_ENDMENU 260 | ||
| 73 | #define T_SOURCE 261 | ||
| 74 | #define T_CHOICE 262 | ||
| 75 | #define T_ENDCHOICE 263 | ||
| 76 | #define T_COMMENT 264 | ||
| 77 | #define T_CONFIG 265 | ||
| 78 | #define T_HELP 266 | ||
| 79 | #define T_HELPTEXT 267 | ||
| 80 | #define T_IF 268 | ||
| 81 | #define T_ENDIF 269 | ||
| 82 | #define T_DEPENDS 270 | ||
| 83 | #define T_REQUIRES 271 | ||
| 84 | #define T_OPTIONAL 272 | ||
| 85 | #define T_PROMPT 273 | ||
| 86 | #define T_DEFAULT 274 | ||
| 87 | #define T_TRISTATE 275 | ||
| 88 | #define T_BOOLEAN 276 | ||
| 89 | #define T_INT 277 | ||
| 90 | #define T_HEX 278 | ||
| 91 | #define T_WORD 279 | ||
| 92 | #define T_STRING 280 | ||
| 93 | #define T_UNEQUAL 281 | ||
| 94 | #define T_EOF 282 | ||
| 95 | #define T_EOL 283 | ||
| 96 | #define T_CLOSE_PAREN 284 | ||
| 97 | #define T_OPEN_PAREN 285 | ||
| 98 | #define T_ON 286 | ||
| 99 | #define T_OR 287 | ||
| 100 | #define T_AND 288 | ||
| 101 | #define T_EQUAL 289 | ||
| 102 | #define T_NOT 290 | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | |||
| 107 | #ifndef YYSTYPE | ||
| 108 | #line 33 "zconf.y" | ||
| 109 | typedef union { | ||
| 110 | int token; | ||
| 111 | char *string; | ||
| 112 | struct symbol *symbol; | ||
| 113 | struct expr *expr; | ||
| 114 | struct menu *menu; | ||
| 115 | } yystype; | ||
| 116 | /* Line 1281 of /usr/share/bison/yacc.c. */ | ||
| 117 | #line 118 "zconf.tab.h" | ||
| 118 | # define YYSTYPE yystype | ||
| 119 | #endif | ||
| 120 | |||
| 121 | extern YYSTYPE zconflval; | ||
| 122 | |||
| 123 | |||
| 124 | #endif /* not BISON_ZCONF_TAB_H */ | ||
| 125 | |||
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y new file mode 100644 index 000000000000..54460f8d3696 --- /dev/null +++ b/scripts/kconfig/zconf.y | |||
| @@ -0,0 +1,690 @@ | |||
| 1 | %{ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 4 | * Released under the terms of the GNU GPL v2.0. | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include <ctype.h> | ||
| 8 | #include <stdarg.h> | ||
| 9 | #include <stdio.h> | ||
| 10 | #include <stdlib.h> | ||
| 11 | #include <string.h> | ||
| 12 | #include <stdbool.h> | ||
| 13 | |||
| 14 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | ||
| 15 | |||
| 16 | #define PRINTD 0x0001 | ||
| 17 | #define DEBUG_PARSE 0x0002 | ||
| 18 | |||
| 19 | int cdebug = PRINTD; | ||
| 20 | |||
| 21 | extern int zconflex(void); | ||
| 22 | static void zconfprint(const char *err, ...); | ||
| 23 | static void zconferror(const char *err); | ||
| 24 | static bool zconf_endtoken(int token, int starttoken, int endtoken); | ||
| 25 | |||
| 26 | struct symbol *symbol_hash[257]; | ||
| 27 | |||
| 28 | static struct menu *current_menu, *current_entry; | ||
| 29 | |||
| 30 | #define YYERROR_VERBOSE | ||
| 31 | %} | ||
| 32 | %expect 40 | ||
| 33 | |||
| 34 | %union | ||
| 35 | { | ||
| 36 | int token; | ||
| 37 | char *string; | ||
| 38 | struct symbol *symbol; | ||
| 39 | struct expr *expr; | ||
| 40 | struct menu *menu; | ||
| 41 | } | ||
| 42 | |||
| 43 | %token T_MAINMENU | ||
| 44 | %token T_MENU | ||
| 45 | %token T_ENDMENU | ||
| 46 | %token T_SOURCE | ||
| 47 | %token T_CHOICE | ||
| 48 | %token T_ENDCHOICE | ||
| 49 | %token T_COMMENT | ||
| 50 | %token T_CONFIG | ||
| 51 | %token T_MENUCONFIG | ||
| 52 | %token T_HELP | ||
| 53 | %token <string> T_HELPTEXT | ||
| 54 | %token T_IF | ||
| 55 | %token T_ENDIF | ||
| 56 | %token T_DEPENDS | ||
| 57 | %token T_REQUIRES | ||
| 58 | %token T_OPTIONAL | ||
| 59 | %token T_PROMPT | ||
| 60 | %token T_DEFAULT | ||
| 61 | %token T_TRISTATE | ||
| 62 | %token T_DEF_TRISTATE | ||
| 63 | %token T_BOOLEAN | ||
| 64 | %token T_DEF_BOOLEAN | ||
| 65 | %token T_STRING | ||
| 66 | %token T_INT | ||
| 67 | %token T_HEX | ||
| 68 | %token <string> T_WORD | ||
| 69 | %token <string> T_WORD_QUOTE | ||
| 70 | %token T_UNEQUAL | ||
| 71 | %token T_EOF | ||
| 72 | %token T_EOL | ||
| 73 | %token T_CLOSE_PAREN | ||
| 74 | %token T_OPEN_PAREN | ||
| 75 | %token T_ON | ||
| 76 | %token T_SELECT | ||
| 77 | %token T_RANGE | ||
| 78 | |||
| 79 | %left T_OR | ||
| 80 | %left T_AND | ||
| 81 | %left T_EQUAL T_UNEQUAL | ||
| 82 | %nonassoc T_NOT | ||
| 83 | |||
| 84 | %type <string> prompt | ||
| 85 | %type <string> source | ||
| 86 | %type <symbol> symbol | ||
| 87 | %type <expr> expr | ||
| 88 | %type <expr> if_expr | ||
| 89 | %type <token> end | ||
| 90 | |||
| 91 | %{ | ||
| 92 | #define LKC_DIRECT_LINK | ||
| 93 | #include "lkc.h" | ||
| 94 | %} | ||
| 95 | %% | ||
| 96 | input: /* empty */ | ||
| 97 | | input block | ||
| 98 | ; | ||
| 99 | |||
| 100 | block: common_block | ||
| 101 | | choice_stmt | ||
| 102 | | menu_stmt | ||
| 103 | | T_MAINMENU prompt nl_or_eof | ||
| 104 | | T_ENDMENU { zconfprint("unexpected 'endmenu' statement"); } | ||
| 105 | | T_ENDIF { zconfprint("unexpected 'endif' statement"); } | ||
| 106 | | T_ENDCHOICE { zconfprint("unexpected 'endchoice' statement"); } | ||
| 107 | | error nl_or_eof { zconfprint("syntax error"); yyerrok; } | ||
| 108 | ; | ||
| 109 | |||
| 110 | common_block: | ||
| 111 | if_stmt | ||
| 112 | | comment_stmt | ||
| 113 | | config_stmt | ||
| 114 | | menuconfig_stmt | ||
| 115 | | source_stmt | ||
| 116 | | nl_or_eof | ||
| 117 | ; | ||
| 118 | |||
| 119 | |||
| 120 | /* config/menuconfig entry */ | ||
| 121 | |||
| 122 | config_entry_start: T_CONFIG T_WORD T_EOL | ||
| 123 | { | ||
| 124 | struct symbol *sym = sym_lookup($2, 0); | ||
| 125 | sym->flags |= SYMBOL_OPTIONAL; | ||
| 126 | menu_add_entry(sym); | ||
| 127 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2); | ||
| 128 | }; | ||
| 129 | |||
| 130 | config_stmt: config_entry_start config_option_list | ||
| 131 | { | ||
| 132 | menu_end_entry(); | ||
| 133 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
| 134 | }; | ||
| 135 | |||
| 136 | menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL | ||
| 137 | { | ||
| 138 | struct symbol *sym = sym_lookup($2, 0); | ||
| 139 | sym->flags |= SYMBOL_OPTIONAL; | ||
| 140 | menu_add_entry(sym); | ||
| 141 | printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2); | ||
| 142 | }; | ||
| 143 | |||
| 144 | menuconfig_stmt: menuconfig_entry_start config_option_list | ||
| 145 | { | ||
| 146 | if (current_entry->prompt) | ||
| 147 | current_entry->prompt->type = P_MENU; | ||
| 148 | else | ||
| 149 | zconfprint("warning: menuconfig statement without prompt"); | ||
| 150 | menu_end_entry(); | ||
| 151 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
| 152 | }; | ||
| 153 | |||
| 154 | config_option_list: | ||
| 155 | /* empty */ | ||
| 156 | | config_option_list config_option | ||
| 157 | | config_option_list depends | ||
| 158 | | config_option_list help | ||
| 159 | | config_option_list T_EOL | ||
| 160 | ; | ||
| 161 | |||
| 162 | config_option: T_TRISTATE prompt_stmt_opt T_EOL | ||
| 163 | { | ||
| 164 | menu_set_type(S_TRISTATE); | ||
| 165 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
| 166 | }; | ||
| 167 | |||
| 168 | config_option: T_DEF_TRISTATE expr if_expr T_EOL | ||
| 169 | { | ||
| 170 | menu_add_expr(P_DEFAULT, $2, $3); | ||
| 171 | menu_set_type(S_TRISTATE); | ||
| 172 | printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); | ||
| 173 | }; | ||
| 174 | |||
| 175 | config_option: T_BOOLEAN prompt_stmt_opt T_EOL | ||
| 176 | { | ||
| 177 | menu_set_type(S_BOOLEAN); | ||
| 178 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | ||
| 179 | }; | ||
| 180 | |||
| 181 | config_option: T_DEF_BOOLEAN expr if_expr T_EOL | ||
| 182 | { | ||
| 183 | menu_add_expr(P_DEFAULT, $2, $3); | ||
| 184 | menu_set_type(S_BOOLEAN); | ||
| 185 | printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); | ||
| 186 | }; | ||
| 187 | |||
| 188 | config_option: T_INT prompt_stmt_opt T_EOL | ||
| 189 | { | ||
| 190 | menu_set_type(S_INT); | ||
| 191 | printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); | ||
| 192 | }; | ||
| 193 | |||
| 194 | config_option: T_HEX prompt_stmt_opt T_EOL | ||
| 195 | { | ||
| 196 | menu_set_type(S_HEX); | ||
| 197 | printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); | ||
| 198 | }; | ||
| 199 | |||
| 200 | config_option: T_STRING prompt_stmt_opt T_EOL | ||
| 201 | { | ||
| 202 | menu_set_type(S_STRING); | ||
| 203 | printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); | ||
| 204 | }; | ||
| 205 | |||
| 206 | config_option: T_PROMPT prompt if_expr T_EOL | ||
| 207 | { | ||
| 208 | menu_add_prompt(P_PROMPT, $2, $3); | ||
| 209 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
| 210 | }; | ||
| 211 | |||
| 212 | config_option: T_DEFAULT expr if_expr T_EOL | ||
| 213 | { | ||
| 214 | menu_add_expr(P_DEFAULT, $2, $3); | ||
| 215 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | ||
| 216 | }; | ||
| 217 | |||
| 218 | config_option: T_SELECT T_WORD if_expr T_EOL | ||
| 219 | { | ||
| 220 | menu_add_symbol(P_SELECT, sym_lookup($2, 0), $3); | ||
| 221 | printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); | ||
| 222 | }; | ||
| 223 | |||
| 224 | config_option: T_RANGE symbol symbol if_expr T_EOL | ||
| 225 | { | ||
| 226 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4); | ||
| 227 | printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); | ||
| 228 | }; | ||
| 229 | |||
| 230 | /* choice entry */ | ||
| 231 | |||
| 232 | choice: T_CHOICE T_EOL | ||
| 233 | { | ||
| 234 | struct symbol *sym = sym_lookup(NULL, 0); | ||
| 235 | sym->flags |= SYMBOL_CHOICE; | ||
| 236 | menu_add_entry(sym); | ||
| 237 | menu_add_expr(P_CHOICE, NULL, NULL); | ||
| 238 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | ||
| 239 | }; | ||
| 240 | |||
| 241 | choice_entry: choice choice_option_list | ||
| 242 | { | ||
| 243 | menu_end_entry(); | ||
| 244 | menu_add_menu(); | ||
| 245 | }; | ||
| 246 | |||
| 247 | choice_end: end | ||
| 248 | { | ||
| 249 | if (zconf_endtoken($1, T_CHOICE, T_ENDCHOICE)) { | ||
| 250 | menu_end_menu(); | ||
| 251 | printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); | ||
| 252 | } | ||
| 253 | }; | ||
| 254 | |||
| 255 | choice_stmt: | ||
| 256 | choice_entry choice_block choice_end | ||
| 257 | | choice_entry choice_block | ||
| 258 | { | ||
| 259 | printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 260 | zconfnerrs++; | ||
| 261 | }; | ||
| 262 | |||
| 263 | choice_option_list: | ||
| 264 | /* empty */ | ||
| 265 | | choice_option_list choice_option | ||
| 266 | | choice_option_list depends | ||
| 267 | | choice_option_list help | ||
| 268 | | choice_option_list T_EOL | ||
| 269 | ; | ||
| 270 | |||
| 271 | choice_option: T_PROMPT prompt if_expr T_EOL | ||
| 272 | { | ||
| 273 | menu_add_prompt(P_PROMPT, $2, $3); | ||
| 274 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
| 275 | }; | ||
| 276 | |||
| 277 | choice_option: T_TRISTATE prompt_stmt_opt T_EOL | ||
| 278 | { | ||
| 279 | menu_set_type(S_TRISTATE); | ||
| 280 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
| 281 | }; | ||
| 282 | |||
| 283 | choice_option: T_BOOLEAN prompt_stmt_opt T_EOL | ||
| 284 | { | ||
| 285 | menu_set_type(S_BOOLEAN); | ||
| 286 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | ||
| 287 | }; | ||
| 288 | |||
| 289 | choice_option: T_OPTIONAL T_EOL | ||
| 290 | { | ||
| 291 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | ||
| 292 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); | ||
| 293 | }; | ||
| 294 | |||
| 295 | choice_option: T_DEFAULT T_WORD if_expr T_EOL | ||
| 296 | { | ||
| 297 | menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3); | ||
| 298 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | ||
| 299 | }; | ||
| 300 | |||
| 301 | choice_block: | ||
| 302 | /* empty */ | ||
| 303 | | choice_block common_block | ||
| 304 | ; | ||
| 305 | |||
| 306 | /* if entry */ | ||
| 307 | |||
| 308 | if: T_IF expr T_EOL | ||
| 309 | { | ||
| 310 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | ||
| 311 | menu_add_entry(NULL); | ||
| 312 | menu_add_dep($2); | ||
| 313 | menu_end_entry(); | ||
| 314 | menu_add_menu(); | ||
| 315 | }; | ||
| 316 | |||
| 317 | if_end: end | ||
| 318 | { | ||
| 319 | if (zconf_endtoken($1, T_IF, T_ENDIF)) { | ||
| 320 | menu_end_menu(); | ||
| 321 | printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); | ||
| 322 | } | ||
| 323 | }; | ||
| 324 | |||
| 325 | if_stmt: | ||
| 326 | if if_block if_end | ||
| 327 | | if if_block | ||
| 328 | { | ||
| 329 | printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 330 | zconfnerrs++; | ||
| 331 | }; | ||
| 332 | |||
| 333 | if_block: | ||
| 334 | /* empty */ | ||
| 335 | | if_block common_block | ||
| 336 | | if_block menu_stmt | ||
| 337 | | if_block choice_stmt | ||
| 338 | ; | ||
| 339 | |||
| 340 | /* menu entry */ | ||
| 341 | |||
| 342 | menu: T_MENU prompt T_EOL | ||
| 343 | { | ||
| 344 | menu_add_entry(NULL); | ||
| 345 | menu_add_prop(P_MENU, $2, NULL, NULL); | ||
| 346 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | ||
| 347 | }; | ||
| 348 | |||
| 349 | menu_entry: menu depends_list | ||
| 350 | { | ||
| 351 | menu_end_entry(); | ||
| 352 | menu_add_menu(); | ||
| 353 | }; | ||
| 354 | |||
| 355 | menu_end: end | ||
| 356 | { | ||
| 357 | if (zconf_endtoken($1, T_MENU, T_ENDMENU)) { | ||
| 358 | menu_end_menu(); | ||
| 359 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); | ||
| 360 | } | ||
| 361 | }; | ||
| 362 | |||
| 363 | menu_stmt: | ||
| 364 | menu_entry menu_block menu_end | ||
| 365 | | menu_entry menu_block | ||
| 366 | { | ||
| 367 | printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 368 | zconfnerrs++; | ||
| 369 | }; | ||
| 370 | |||
| 371 | menu_block: | ||
| 372 | /* empty */ | ||
| 373 | | menu_block common_block | ||
| 374 | | menu_block menu_stmt | ||
| 375 | | menu_block choice_stmt | ||
| 376 | | menu_block error T_EOL { zconfprint("invalid menu option"); yyerrok; } | ||
| 377 | ; | ||
| 378 | |||
| 379 | source: T_SOURCE prompt T_EOL | ||
| 380 | { | ||
| 381 | $$ = $2; | ||
| 382 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); | ||
| 383 | }; | ||
| 384 | |||
| 385 | source_stmt: source | ||
| 386 | { | ||
| 387 | zconf_nextfile($1); | ||
| 388 | }; | ||
| 389 | |||
| 390 | /* comment entry */ | ||
| 391 | |||
| 392 | comment: T_COMMENT prompt T_EOL | ||
| 393 | { | ||
| 394 | menu_add_entry(NULL); | ||
| 395 | menu_add_prop(P_COMMENT, $2, NULL, NULL); | ||
| 396 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); | ||
| 397 | }; | ||
| 398 | |||
| 399 | comment_stmt: comment depends_list | ||
| 400 | { | ||
| 401 | menu_end_entry(); | ||
| 402 | }; | ||
| 403 | |||
| 404 | /* help option */ | ||
| 405 | |||
| 406 | help_start: T_HELP T_EOL | ||
| 407 | { | ||
| 408 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | ||
| 409 | zconf_starthelp(); | ||
| 410 | }; | ||
| 411 | |||
| 412 | help: help_start T_HELPTEXT | ||
| 413 | { | ||
| 414 | current_entry->sym->help = $2; | ||
| 415 | }; | ||
| 416 | |||
| 417 | /* depends option */ | ||
| 418 | |||
| 419 | depends_list: /* empty */ | ||
| 420 | | depends_list depends | ||
| 421 | | depends_list T_EOL | ||
| 422 | ; | ||
| 423 | |||
| 424 | depends: T_DEPENDS T_ON expr T_EOL | ||
| 425 | { | ||
| 426 | menu_add_dep($3); | ||
| 427 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | ||
| 428 | } | ||
| 429 | | T_DEPENDS expr T_EOL | ||
| 430 | { | ||
| 431 | menu_add_dep($2); | ||
| 432 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); | ||
| 433 | } | ||
| 434 | | T_REQUIRES expr T_EOL | ||
| 435 | { | ||
| 436 | menu_add_dep($2); | ||
| 437 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); | ||
| 438 | }; | ||
| 439 | |||
| 440 | /* prompt statement */ | ||
| 441 | |||
| 442 | prompt_stmt_opt: | ||
| 443 | /* empty */ | ||
| 444 | | prompt if_expr | ||
| 445 | { | ||
| 446 | menu_add_prop(P_PROMPT, $1, NULL, $2); | ||
| 447 | }; | ||
| 448 | |||
| 449 | prompt: T_WORD | ||
| 450 | | T_WORD_QUOTE | ||
| 451 | ; | ||
| 452 | |||
| 453 | end: T_ENDMENU nl_or_eof { $$ = T_ENDMENU; } | ||
| 454 | | T_ENDCHOICE nl_or_eof { $$ = T_ENDCHOICE; } | ||
| 455 | | T_ENDIF nl_or_eof { $$ = T_ENDIF; } | ||
| 456 | ; | ||
| 457 | |||
| 458 | nl_or_eof: | ||
| 459 | T_EOL | T_EOF; | ||
| 460 | |||
| 461 | if_expr: /* empty */ { $$ = NULL; } | ||
| 462 | | T_IF expr { $$ = $2; } | ||
| 463 | ; | ||
| 464 | |||
| 465 | expr: symbol { $$ = expr_alloc_symbol($1); } | ||
| 466 | | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); } | ||
| 467 | | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); } | ||
| 468 | | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; } | ||
| 469 | | T_NOT expr { $$ = expr_alloc_one(E_NOT, $2); } | ||
| 470 | | expr T_OR expr { $$ = expr_alloc_two(E_OR, $1, $3); } | ||
| 471 | | expr T_AND expr { $$ = expr_alloc_two(E_AND, $1, $3); } | ||
| 472 | ; | ||
| 473 | |||
| 474 | symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); } | ||
| 475 | | T_WORD_QUOTE { $$ = sym_lookup($1, 1); free($1); } | ||
| 476 | ; | ||
| 477 | |||
| 478 | %% | ||
| 479 | |||
| 480 | void conf_parse(const char *name) | ||
| 481 | { | ||
| 482 | struct symbol *sym; | ||
| 483 | int i; | ||
| 484 | |||
| 485 | zconf_initscan(name); | ||
| 486 | |||
| 487 | sym_init(); | ||
| 488 | menu_init(); | ||
| 489 | modules_sym = sym_lookup("MODULES", 0); | ||
| 490 | rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); | ||
| 491 | |||
| 492 | //zconfdebug = 1; | ||
| 493 | zconfparse(); | ||
| 494 | if (zconfnerrs) | ||
| 495 | exit(1); | ||
| 496 | menu_finalize(&rootmenu); | ||
| 497 | for_all_symbols(i, sym) { | ||
| 498 | if (!(sym->flags & SYMBOL_CHECKED) && sym_check_deps(sym)) | ||
| 499 | printf("\n"); | ||
| 500 | else | ||
| 501 | sym->flags |= SYMBOL_CHECK_DONE; | ||
| 502 | } | ||
| 503 | |||
| 504 | sym_change_count = 1; | ||
| 505 | } | ||
| 506 | |||
| 507 | const char *zconf_tokenname(int token) | ||
| 508 | { | ||
| 509 | switch (token) { | ||
| 510 | case T_MENU: return "menu"; | ||
| 511 | case T_ENDMENU: return "endmenu"; | ||
| 512 | case T_CHOICE: return "choice"; | ||
| 513 | case T_ENDCHOICE: return "endchoice"; | ||
| 514 | case T_IF: return "if"; | ||
| 515 | case T_ENDIF: return "endif"; | ||
| 516 | } | ||
| 517 | return "<token>"; | ||
| 518 | } | ||
| 519 | |||
| 520 | static bool zconf_endtoken(int token, int starttoken, int endtoken) | ||
| 521 | { | ||
| 522 | if (token != endtoken) { | ||
| 523 | zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); | ||
| 524 | zconfnerrs++; | ||
| 525 | return false; | ||
| 526 | } | ||
| 527 | if (current_menu->file != current_file) { | ||
| 528 | zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); | ||
| 529 | zconfprint("location of the '%s'", zconf_tokenname(starttoken)); | ||
| 530 | zconfnerrs++; | ||
| 531 | return false; | ||
| 532 | } | ||
| 533 | return true; | ||
| 534 | } | ||
| 535 | |||
| 536 | static void zconfprint(const char *err, ...) | ||
| 537 | { | ||
| 538 | va_list ap; | ||
| 539 | |||
| 540 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1); | ||
| 541 | va_start(ap, err); | ||
| 542 | vfprintf(stderr, err, ap); | ||
| 543 | va_end(ap); | ||
| 544 | fprintf(stderr, "\n"); | ||
| 545 | } | ||
| 546 | |||
| 547 | static void zconferror(const char *err) | ||
| 548 | { | ||
| 549 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); | ||
| 550 | } | ||
| 551 | |||
| 552 | void print_quoted_string(FILE *out, const char *str) | ||
| 553 | { | ||
| 554 | const char *p; | ||
| 555 | int len; | ||
| 556 | |||
| 557 | putc('"', out); | ||
| 558 | while ((p = strchr(str, '"'))) { | ||
| 559 | len = p - str; | ||
| 560 | if (len) | ||
| 561 | fprintf(out, "%.*s", len, str); | ||
| 562 | fputs("\\\"", out); | ||
| 563 | str = p + 1; | ||
| 564 | } | ||
| 565 | fputs(str, out); | ||
| 566 | putc('"', out); | ||
| 567 | } | ||
| 568 | |||
| 569 | void print_symbol(FILE *out, struct menu *menu) | ||
| 570 | { | ||
| 571 | struct symbol *sym = menu->sym; | ||
| 572 | struct property *prop; | ||
| 573 | |||
| 574 | if (sym_is_choice(sym)) | ||
| 575 | fprintf(out, "choice\n"); | ||
| 576 | else | ||
| 577 | fprintf(out, "config %s\n", sym->name); | ||
| 578 | switch (sym->type) { | ||
| 579 | case S_BOOLEAN: | ||
| 580 | fputs(" boolean\n", out); | ||
| 581 | break; | ||
| 582 | case S_TRISTATE: | ||
| 583 | fputs(" tristate\n", out); | ||
| 584 | break; | ||
| 585 | case S_STRING: | ||
| 586 | fputs(" string\n", out); | ||
| 587 | break; | ||
| 588 | case S_INT: | ||
| 589 | fputs(" integer\n", out); | ||
| 590 | break; | ||
| 591 | case S_HEX: | ||
| 592 | fputs(" hex\n", out); | ||
| 593 | break; | ||
| 594 | default: | ||
| 595 | fputs(" ???\n", out); | ||
| 596 | break; | ||
| 597 | } | ||
| 598 | for (prop = sym->prop; prop; prop = prop->next) { | ||
| 599 | if (prop->menu != menu) | ||
| 600 | continue; | ||
| 601 | switch (prop->type) { | ||
| 602 | case P_PROMPT: | ||
| 603 | fputs(" prompt ", out); | ||
| 604 | print_quoted_string(out, prop->text); | ||
| 605 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 606 | fputs(" if ", out); | ||
| 607 | expr_fprint(prop->visible.expr, out); | ||
| 608 | } | ||
| 609 | fputc('\n', out); | ||
| 610 | break; | ||
| 611 | case P_DEFAULT: | ||
| 612 | fputs( " default ", out); | ||
| 613 | expr_fprint(prop->expr, out); | ||
| 614 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 615 | fputs(" if ", out); | ||
| 616 | expr_fprint(prop->visible.expr, out); | ||
| 617 | } | ||
| 618 | fputc('\n', out); | ||
| 619 | break; | ||
| 620 | case P_CHOICE: | ||
| 621 | fputs(" #choice value\n", out); | ||
| 622 | break; | ||
| 623 | default: | ||
| 624 | fprintf(out, " unknown prop %d!\n", prop->type); | ||
| 625 | break; | ||
| 626 | } | ||
| 627 | } | ||
| 628 | if (sym->help) { | ||
| 629 | int len = strlen(sym->help); | ||
| 630 | while (sym->help[--len] == '\n') | ||
| 631 | sym->help[len] = 0; | ||
| 632 | fprintf(out, " help\n%s\n", sym->help); | ||
| 633 | } | ||
| 634 | fputc('\n', out); | ||
| 635 | } | ||
| 636 | |||
| 637 | void zconfdump(FILE *out) | ||
| 638 | { | ||
| 639 | struct property *prop; | ||
| 640 | struct symbol *sym; | ||
| 641 | struct menu *menu; | ||
| 642 | |||
| 643 | menu = rootmenu.list; | ||
| 644 | while (menu) { | ||
| 645 | if ((sym = menu->sym)) | ||
| 646 | print_symbol(out, menu); | ||
| 647 | else if ((prop = menu->prompt)) { | ||
| 648 | switch (prop->type) { | ||
| 649 | case P_COMMENT: | ||
| 650 | fputs("\ncomment ", out); | ||
| 651 | print_quoted_string(out, prop->text); | ||
| 652 | fputs("\n", out); | ||
| 653 | break; | ||
| 654 | case P_MENU: | ||
| 655 | fputs("\nmenu ", out); | ||
| 656 | print_quoted_string(out, prop->text); | ||
| 657 | fputs("\n", out); | ||
| 658 | break; | ||
| 659 | default: | ||
| 660 | ; | ||
| 661 | } | ||
| 662 | if (!expr_is_yes(prop->visible.expr)) { | ||
| 663 | fputs(" depends ", out); | ||
| 664 | expr_fprint(prop->visible.expr, out); | ||
| 665 | fputc('\n', out); | ||
| 666 | } | ||
| 667 | fputs("\n", out); | ||
| 668 | } | ||
| 669 | |||
| 670 | if (menu->list) | ||
| 671 | menu = menu->list; | ||
| 672 | else if (menu->next) | ||
| 673 | menu = menu->next; | ||
| 674 | else while ((menu = menu->parent)) { | ||
| 675 | if (menu->prompt && menu->prompt->type == P_MENU) | ||
| 676 | fputs("\nendmenu\n", out); | ||
| 677 | if (menu->next) { | ||
| 678 | menu = menu->next; | ||
| 679 | break; | ||
| 680 | } | ||
| 681 | } | ||
| 682 | } | ||
| 683 | } | ||
| 684 | |||
| 685 | #include "lex.zconf.c" | ||
| 686 | #include "util.c" | ||
| 687 | #include "confdata.c" | ||
| 688 | #include "expr.c" | ||
| 689 | #include "symbol.c" | ||
| 690 | #include "menu.c" | ||
