1.1 --- a/kconfig/check-gettext.sh Tue May 10 23:56:11 2011 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,14 +0,0 @@
1.4 -#!/bin/sh
1.5 -# Needed for systems without gettext
1.6 -$* -xc -o /dev/null - > /dev/null 2>&1 << EOF
1.7 -#include <libintl.h>
1.8 -int main()
1.9 -{
1.10 - gettext("");
1.11 - return 0;
1.12 -}
1.13 -EOF
1.14 -if [ ! "$?" -eq "0" ]; then
1.15 - echo -DKBUILD_NO_NLS;
1.16 -fi
1.17 -
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/kconfig/check.sh Sun May 08 14:14:40 2011 +0200
2.3 @@ -0,0 +1,14 @@
2.4 +#!/bin/sh
2.5 +# Needed for systems without gettext
2.6 +$* -xc -o /dev/null - > /dev/null 2>&1 << EOF
2.7 +#include <libintl.h>
2.8 +int main()
2.9 +{
2.10 + gettext("");
2.11 + return 0;
2.12 +}
2.13 +EOF
2.14 +if [ ! "$?" -eq "0" ]; then
2.15 + echo -DKBUILD_NO_NLS;
2.16 +fi
2.17 +
3.1 --- a/kconfig/conf.c Tue May 10 23:56:11 2011 +0200
3.2 +++ b/kconfig/conf.c Sun May 08 14:14:40 2011 +0200
3.3 @@ -10,7 +10,9 @@
3.4 #include <string.h>
3.5 #include <time.h>
3.6 #include <unistd.h>
3.7 +#include <getopt.h>
3.8 #include <sys/stat.h>
3.9 +#include <sys/time.h>
3.10
3.11 #define LKC_DIRECT_LINK
3.12 #include "lkc.h"
3.13 @@ -18,16 +20,21 @@
3.14 static void conf(struct menu *menu);
3.15 static void check_conf(struct menu *menu);
3.16
3.17 -enum {
3.18 - ask_all,
3.19 - ask_new,
3.20 - ask_silent,
3.21 - set_default,
3.22 - set_yes,
3.23 - set_mod,
3.24 - set_no,
3.25 - set_random
3.26 -} input_mode = ask_all;
3.27 +enum input_mode {
3.28 + oldaskconfig,
3.29 + silentoldconfig,
3.30 + oldconfig,
3.31 + allnoconfig,
3.32 + allyesconfig,
3.33 + allmodconfig,
3.34 + alldefconfig,
3.35 + randconfig,
3.36 + defconfig,
3.37 + savedefconfig,
3.38 + listnewconfig,
3.39 + oldnoconfig,
3.40 +} input_mode = oldaskconfig;
3.41 +
3.42 char *defconfig_file;
3.43
3.44 static int indent = 1;
3.45 @@ -37,14 +44,14 @@
3.46 static char line[128];
3.47 static struct menu *rootEntry;
3.48
3.49 -static char nohelp_text[] = N_("Sorry, no help available for this option yet.\n");
3.50 +static void print_help(struct menu *menu)
3.51 +{
3.52 + struct gstr help = str_new();
3.53
3.54 -static const char *get_help(struct menu *menu)
3.55 -{
3.56 - if (menu_has_help(menu))
3.57 - return _(menu_get_help(menu));
3.58 - else
3.59 - return nohelp_text;
3.60 + menu_get_ext_help(menu, &help);
3.61 +
3.62 + printf("\n%s\n", str_get(&help));
3.63 + str_free(&help);
3.64 }
3.65
3.66 static void strip(char *str)
3.67 @@ -92,16 +99,16 @@
3.68 }
3.69
3.70 switch (input_mode) {
3.71 - case ask_new:
3.72 - case ask_silent:
3.73 + case oldconfig:
3.74 + case silentoldconfig:
3.75 if (sym_has_value(sym)) {
3.76 printf("%s\n", def);
3.77 return 0;
3.78 }
3.79 check_stdin();
3.80 - case ask_all:
3.81 + case oldaskconfig:
3.82 fflush(stdout);
3.83 - fgets(line, 128, stdin);
3.84 + xfgets(line, 128, stdin);
3.85 return 1;
3.86 default:
3.87 break;
3.88 @@ -120,7 +127,7 @@
3.89 return 1;
3.90 }
3.91
3.92 -int conf_string(struct menu *menu)
3.93 +static int conf_string(struct menu *menu)
3.94 {
3.95 struct symbol *sym = menu->sym;
3.96 const char *def;
3.97 @@ -139,7 +146,7 @@
3.98 case '?':
3.99 /* print help */
3.100 if (line[1] == '\n') {
3.101 - printf("\n%s\n", get_help(menu));
3.102 + print_help(menu);
3.103 def = NULL;
3.104 break;
3.105 }
3.106 @@ -155,14 +162,12 @@
3.107 static int conf_sym(struct menu *menu)
3.108 {
3.109 struct symbol *sym = menu->sym;
3.110 - int type;
3.111 tristate oldval, newval;
3.112
3.113 while (1) {
3.114 printf("%*s%s ", indent - 1, "", _(menu->prompt->text));
3.115 if (sym->name)
3.116 printf("(%s) ", sym->name);
3.117 - type = sym_get_type(sym);
3.118 putchar('[');
3.119 oldval = sym_get_tristate_value(sym);
3.120 switch (oldval) {
3.121 @@ -219,7 +224,7 @@
3.122 if (sym_set_tristate_value(sym, newval))
3.123 return 0;
3.124 help:
3.125 - printf("\n%s\n", get_help(menu));
3.126 + print_help(menu);
3.127 }
3.128 }
3.129
3.130 @@ -227,11 +232,9 @@
3.131 {
3.132 struct symbol *sym, *def_sym;
3.133 struct menu *child;
3.134 - int type;
3.135 bool is_new;
3.136
3.137 sym = menu->sym;
3.138 - type = sym_get_type(sym);
3.139 is_new = !sym_has_value(sym);
3.140 if (sym_is_changable(sym)) {
3.141 conf_sym(menu);
3.142 @@ -293,20 +296,20 @@
3.143 printf("?");
3.144 printf("]: ");
3.145 switch (input_mode) {
3.146 - case ask_new:
3.147 - case ask_silent:
3.148 + case oldconfig:
3.149 + case silentoldconfig:
3.150 if (!is_new) {
3.151 cnt = def;
3.152 printf("%d\n", cnt);
3.153 break;
3.154 }
3.155 check_stdin();
3.156 - case ask_all:
3.157 + case oldaskconfig:
3.158 fflush(stdout);
3.159 - fgets(line, 128, stdin);
3.160 + xfgets(line, 128, stdin);
3.161 strip(line);
3.162 if (line[0] == '?') {
3.163 - printf("\n%s\n", get_help(menu));
3.164 + print_help(menu);
3.165 continue;
3.166 }
3.167 if (!line[0])
3.168 @@ -329,8 +332,8 @@
3.169 }
3.170 if (!child)
3.171 continue;
3.172 - if (line[strlen(line) - 1] == '?') {
3.173 - printf("\n%s\n", get_help(child));
3.174 + if (line[0] && line[strlen(line) - 1] == '?') {
3.175 + print_help(child);
3.176 continue;
3.177 }
3.178 sym_set_choice_value(sym, child->sym);
3.179 @@ -359,7 +362,10 @@
3.180
3.181 switch (prop->type) {
3.182 case P_MENU:
3.183 - if (input_mode == ask_silent && rootEntry != menu) {
3.184 + if ((input_mode == silentoldconfig ||
3.185 + input_mode == listnewconfig ||
3.186 + input_mode == oldnoconfig) &&
3.187 + rootEntry != menu) {
3.188 check_conf(menu);
3.189 return;
3.190 }
3.191 @@ -417,10 +423,16 @@
3.192 if (sym && !sym_has_value(sym)) {
3.193 if (sym_is_changable(sym) ||
3.194 (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) {
3.195 - if (!conf_cnt++)
3.196 - printf(_("*\n* Restart config...\n*\n"));
3.197 - rootEntry = menu_get_parent_menu(menu);
3.198 - conf(rootEntry);
3.199 + if (input_mode == listnewconfig) {
3.200 + if (sym->name && !sym_is_choice_value(sym)) {
3.201 + printf("%s%s\n", CONFIG_, sym->name);
3.202 + }
3.203 + } else if (input_mode != oldnoconfig) {
3.204 + if (!conf_cnt++)
3.205 + printf(_("*\n* Restart config...\n*\n"));
3.206 + rootEntry = menu_get_parent_menu(menu);
3.207 + conf(rootEntry);
3.208 + }
3.209 }
3.210 }
3.211
3.212 @@ -428,6 +440,22 @@
3.213 check_conf(child);
3.214 }
3.215
3.216 +static struct option long_opts[] = {
3.217 + {"oldaskconfig", no_argument, NULL, oldaskconfig},
3.218 + {"oldconfig", no_argument, NULL, oldconfig},
3.219 + {"silentoldconfig", no_argument, NULL, silentoldconfig},
3.220 + {"defconfig", optional_argument, NULL, defconfig},
3.221 + {"savedefconfig", required_argument, NULL, savedefconfig},
3.222 + {"allnoconfig", no_argument, NULL, allnoconfig},
3.223 + {"allyesconfig", no_argument, NULL, allyesconfig},
3.224 + {"allmodconfig", no_argument, NULL, allmodconfig},
3.225 + {"alldefconfig", no_argument, NULL, alldefconfig},
3.226 + {"randconfig", no_argument, NULL, randconfig},
3.227 + {"listnewconfig", no_argument, NULL, listnewconfig},
3.228 + {"oldnoconfig", no_argument, NULL, oldnoconfig},
3.229 + {NULL, 0, NULL, 0}
3.230 +};
3.231 +
3.232 int main(int ac, char **av)
3.233 {
3.234 int opt;
3.235 @@ -438,42 +466,35 @@
3.236 bindtextdomain(PACKAGE, LOCALEDIR);
3.237 textdomain(PACKAGE);
3.238
3.239 - while ((opt = getopt(ac, av, "osdD:nmyrh")) != -1) {
3.240 + while ((opt = getopt_long(ac, av, "", long_opts, NULL)) != -1) {
3.241 + input_mode = (enum input_mode)opt;
3.242 switch (opt) {
3.243 - case 'o':
3.244 - input_mode = ask_silent;
3.245 - break;
3.246 - case 's':
3.247 - input_mode = ask_silent;
3.248 + case silentoldconfig:
3.249 sync_kconfig = 1;
3.250 break;
3.251 - case 'd':
3.252 - input_mode = set_default;
3.253 - break;
3.254 - case 'D':
3.255 - input_mode = set_default;
3.256 + case defconfig:
3.257 + case savedefconfig:
3.258 defconfig_file = optarg;
3.259 break;
3.260 - case 'n':
3.261 - input_mode = set_no;
3.262 + case randconfig:
3.263 + {
3.264 + struct timeval now;
3.265 + unsigned int seed;
3.266 +
3.267 + /*
3.268 + * Use microseconds derived seed,
3.269 + * compensate for systems where it may be zero
3.270 + */
3.271 + gettimeofday(&now, NULL);
3.272 +
3.273 + seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1));
3.274 + srand(seed);
3.275 break;
3.276 - case 'm':
3.277 - input_mode = set_mod;
3.278 - break;
3.279 - case 'y':
3.280 - input_mode = set_yes;
3.281 - break;
3.282 - case 'r':
3.283 - input_mode = set_random;
3.284 - srand(time(NULL));
3.285 - break;
3.286 - case 'h':
3.287 - printf(_("See README for usage info\n"));
3.288 - exit(0);
3.289 - break;
3.290 - default:
3.291 + }
3.292 + case '?':
3.293 fprintf(stderr, _("See README for usage info\n"));
3.294 exit(1);
3.295 + break;
3.296 }
3.297 }
3.298 if (ac == optind) {
3.299 @@ -484,16 +505,20 @@
3.300 conf_parse(name);
3.301 //zconfdump(stdout);
3.302 if (sync_kconfig) {
3.303 - if (stat(".config", &tmpstat)) {
3.304 + name = conf_get_configname();
3.305 + if (stat(name, &tmpstat)) {
3.306 fprintf(stderr, _("***\n"
3.307 - "*** Please run some configurator (e.g. \"make menuconfig\").\n"
3.308 - "***\n"));
3.309 + "*** Configuration file \"%s\" not found!\n"
3.310 + "***\n"
3.311 + "*** Please run some configurator (e.g. \"make oldconfig\" or\n"
3.312 + "*** \"make menuconfig\" or \"make xconfig\").\n"
3.313 + "***\n"), name);
3.314 exit(1);
3.315 }
3.316 }
3.317
3.318 switch (input_mode) {
3.319 - case set_default:
3.320 + case defconfig:
3.321 if (!defconfig_file)
3.322 defconfig_file = conf_get_default_confname();
3.323 if (conf_read(defconfig_file)) {
3.324 @@ -503,25 +528,30 @@
3.325 exit(1);
3.326 }
3.327 break;
3.328 - case ask_silent:
3.329 - case ask_all:
3.330 - case ask_new:
3.331 + case savedefconfig:
3.332 + case silentoldconfig:
3.333 + case oldaskconfig:
3.334 + case oldconfig:
3.335 + case listnewconfig:
3.336 + case oldnoconfig:
3.337 conf_read(NULL);
3.338 break;
3.339 - case set_no:
3.340 - case set_mod:
3.341 - case set_yes:
3.342 - case set_random:
3.343 + case allnoconfig:
3.344 + case allyesconfig:
3.345 + case allmodconfig:
3.346 + case alldefconfig:
3.347 + case randconfig:
3.348 name = getenv("KCONFIG_ALLCONFIG");
3.349 if (name && !stat(name, &tmpstat)) {
3.350 conf_read_simple(name, S_DEF_USER);
3.351 break;
3.352 }
3.353 switch (input_mode) {
3.354 - case set_no: name = "allno.config"; break;
3.355 - case set_mod: name = "allmod.config"; break;
3.356 - case set_yes: name = "allyes.config"; break;
3.357 - case set_random: name = "allrandom.config"; break;
3.358 + case allnoconfig: name = "allno.config"; break;
3.359 + case allyesconfig: name = "allyes.config"; break;
3.360 + case allmodconfig: name = "allmod.config"; break;
3.361 + case alldefconfig: name = "alldef.config"; break;
3.362 + case randconfig: name = "allrandom.config"; break;
3.363 default: break;
3.364 }
3.365 if (!stat(name, &tmpstat))
3.366 @@ -538,7 +568,7 @@
3.367 name = getenv("KCONFIG_NOSILENTUPDATE");
3.368 if (name && *name) {
3.369 fprintf(stderr,
3.370 - _("\n*** Configuration requires explicit update.\n\n"));
3.371 + _("\n*** The configuration requires explicit update.\n\n"));
3.372 return 1;
3.373 }
3.374 }
3.375 @@ -546,33 +576,42 @@
3.376 }
3.377
3.378 switch (input_mode) {
3.379 - case set_no:
3.380 + case allnoconfig:
3.381 conf_set_all_new_symbols(def_no);
3.382 break;
3.383 - case set_yes:
3.384 + case allyesconfig:
3.385 conf_set_all_new_symbols(def_yes);
3.386 break;
3.387 - case set_mod:
3.388 + case allmodconfig:
3.389 conf_set_all_new_symbols(def_mod);
3.390 break;
3.391 - case set_random:
3.392 + case alldefconfig:
3.393 + conf_set_all_new_symbols(def_default);
3.394 + break;
3.395 + case randconfig:
3.396 conf_set_all_new_symbols(def_random);
3.397 break;
3.398 - case set_default:
3.399 + case defconfig:
3.400 conf_set_all_new_symbols(def_default);
3.401 break;
3.402 - case ask_new:
3.403 - case ask_all:
3.404 + case savedefconfig:
3.405 + break;
3.406 + case oldaskconfig:
3.407 rootEntry = &rootmenu;
3.408 conf(&rootmenu);
3.409 - input_mode = ask_silent;
3.410 + input_mode = silentoldconfig;
3.411 /* fall through */
3.412 - case ask_silent:
3.413 + case oldconfig:
3.414 + case listnewconfig:
3.415 + case oldnoconfig:
3.416 + case silentoldconfig:
3.417 /* Update until a loop caused no more changes */
3.418 do {
3.419 conf_cnt = 0;
3.420 check_conf(&rootmenu);
3.421 - } while (conf_cnt);
3.422 + } while (conf_cnt &&
3.423 + (input_mode != listnewconfig &&
3.424 + input_mode != oldnoconfig));
3.425 break;
3.426 }
3.427
3.428 @@ -584,7 +623,14 @@
3.429 fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
3.430 exit(1);
3.431 }
3.432 - } else {
3.433 + /* In crosstool-NG, we do not use the autoconf stuff */
3.434 + } else if (input_mode == savedefconfig) {
3.435 + if (conf_write_defconfig(defconfig_file)) {
3.436 + fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"),
3.437 + defconfig_file);
3.438 + return 1;
3.439 + }
3.440 + } else if (input_mode != listnewconfig) {
3.441 if (conf_write(NULL)) {
3.442 fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
3.443 exit(1);
3.444 @@ -592,3 +638,14 @@
3.445 }
3.446 return 0;
3.447 }
3.448 +/*
3.449 + * Helper function to facilitate fgets() by Jean Sacren.
3.450 + */
3.451 +void xfgets(str, size, in)
3.452 + char *str;
3.453 + int size;
3.454 + FILE *in;
3.455 +{
3.456 + if (fgets(str, size, in) == NULL)
3.457 + fprintf(stderr, "\nError in reading or end of file.\n");
3.458 +}
4.1 --- a/kconfig/confdata.c Tue May 10 23:56:11 2011 +0200
4.2 +++ b/kconfig/confdata.c Sun May 08 14:14:40 2011 +0200
4.3 @@ -5,6 +5,7 @@
4.4
4.5 #include <sys/stat.h>
4.6 #include <ctype.h>
4.7 +#include <errno.h>
4.8 #include <fcntl.h>
4.9 #include <stdio.h>
4.10 #include <stdlib.h>
4.11 @@ -18,6 +19,9 @@
4.12 static void conf_warning(const char *fmt, ...)
4.13 __attribute__ ((format (printf, 1, 2)));
4.14
4.15 +static void conf_message(const char *fmt, ...)
4.16 + __attribute__ ((format (printf, 1, 2)));
4.17 +
4.18 static const char *conf_filename;
4.19 static int conf_lineno, conf_warnings, conf_unsaved;
4.20
4.21 @@ -34,6 +38,29 @@
4.22 conf_warnings++;
4.23 }
4.24
4.25 +static void conf_default_message_callback(const char *fmt, va_list ap)
4.26 +{
4.27 + printf("#\n# ");
4.28 + vprintf(fmt, ap);
4.29 + printf("\n#\n");
4.30 +}
4.31 +
4.32 +static void (*conf_message_callback) (const char *fmt, va_list ap) =
4.33 + conf_default_message_callback;
4.34 +void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap))
4.35 +{
4.36 + conf_message_callback = fn;
4.37 +}
4.38 +
4.39 +static void conf_message(const char *fmt, ...)
4.40 +{
4.41 + va_list ap;
4.42 +
4.43 + va_start(ap, fmt);
4.44 + if (conf_message_callback)
4.45 + conf_message_callback(fmt, ap);
4.46 +}
4.47 +
4.48 const char *conf_get_configname(void)
4.49 {
4.50 char *name = getenv("KCONFIG_CONFIG");
4.51 @@ -41,6 +68,13 @@
4.52 return name ? name : ".config";
4.53 }
4.54
4.55 +const char *conf_get_autoconfig_name(void)
4.56 +{
4.57 + char *name = getenv("KCONFIG_AUTOCONFIG");
4.58 +
4.59 + return name ? name : "include/config/auto.conf";
4.60 +}
4.61 +
4.62 static char *conf_expand_value(const char *in)
4.63 {
4.64 struct symbol *sym;
4.65 @@ -163,8 +197,11 @@
4.66 if (in)
4.67 goto load;
4.68 sym_add_change_count(1);
4.69 - if (!sym_defconfig_list)
4.70 + if (!sym_defconfig_list) {
4.71 + if (modules_sym)
4.72 + sym_calc_value(modules_sym);
4.73 return 1;
4.74 + }
4.75
4.76 for_all_defaults(sym_defconfig_list, prop) {
4.77 if (expr_calc_value(prop->visible.expr) == no ||
4.78 @@ -173,9 +210,8 @@
4.79 name = conf_expand_value(prop->expr->left.sym->name);
4.80 in = zconf_fopen(name);
4.81 if (in) {
4.82 - printf(_("#\n"
4.83 - "# using defaults found in %s\n"
4.84 - "#\n"), name);
4.85 + conf_message(_("using defaults found in %s"),
4.86 + name);
4.87 goto load;
4.88 }
4.89 }
4.90 @@ -210,24 +246,23 @@
4.91 while (fgets(line, sizeof(line), in)) {
4.92 conf_lineno++;
4.93 sym = NULL;
4.94 - switch (line[0]) {
4.95 - case '#':
4.96 - if (memcmp(line + 2, "CT_", 3))
4.97 + if (line[0] == '#') {
4.98 + if (memcmp(line + 2, CONFIG_, strlen(CONFIG_)))
4.99 continue;
4.100 - p = strchr(line + 5, ' ');
4.101 + p = strchr(line + 2 + strlen(CONFIG_), ' ');
4.102 if (!p)
4.103 continue;
4.104 *p++ = 0;
4.105 if (strncmp(p, "is not set", 10))
4.106 continue;
4.107 if (def == S_DEF_USER) {
4.108 - sym = sym_find(line + 5);
4.109 + sym = sym_find(line + 2 + strlen(CONFIG_));
4.110 if (!sym) {
4.111 sym_add_change_count(1);
4.112 - break;
4.113 + goto setsym;
4.114 }
4.115 } else {
4.116 - sym = sym_lookup(line + 5, 0);
4.117 + sym = sym_lookup(line + 2 + strlen(CONFIG_), 0);
4.118 if (sym->type == S_UNKNOWN)
4.119 sym->type = S_BOOLEAN;
4.120 }
4.121 @@ -243,13 +278,8 @@
4.122 default:
4.123 ;
4.124 }
4.125 - break;
4.126 - case 'C':
4.127 - if (memcmp(line, "CT_", 3)) {
4.128 - conf_warning("unexpected data");
4.129 - continue;
4.130 - }
4.131 - p = strchr(line + 3, '=');
4.132 + } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) {
4.133 + p = strchr(line + strlen(CONFIG_), '=');
4.134 if (!p)
4.135 continue;
4.136 *p++ = 0;
4.137 @@ -260,13 +290,13 @@
4.138 *p2 = 0;
4.139 }
4.140 if (def == S_DEF_USER) {
4.141 - sym = sym_find(line + 3);
4.142 + sym = sym_find(line + strlen(CONFIG_));
4.143 if (!sym) {
4.144 sym_add_change_count(1);
4.145 - break;
4.146 + goto setsym;
4.147 }
4.148 } else {
4.149 - sym = sym_lookup(line + 3, 0);
4.150 + sym = sym_lookup(line + strlen(CONFIG_), 0);
4.151 if (sym->type == S_UNKNOWN)
4.152 sym->type = S_OTHER;
4.153 }
4.154 @@ -275,14 +305,12 @@
4.155 }
4.156 if (conf_set_sym_val(sym, def, def_flags, p))
4.157 continue;
4.158 - break;
4.159 - case '\r':
4.160 - case '\n':
4.161 - break;
4.162 - default:
4.163 - conf_warning("unexpected data");
4.164 + } else {
4.165 + if (line[0] != '\r' && line[0] != '\n')
4.166 + conf_warning("unexpected data");
4.167 continue;
4.168 }
4.169 +setsym:
4.170 if (sym && sym_is_choice_value(sym)) {
4.171 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym));
4.172 switch (sym->def[def].tri) {
4.173 @@ -389,15 +417,149 @@
4.174 return 0;
4.175 }
4.176
4.177 +/* Write a S_STRING */
4.178 +static void conf_write_string(bool headerfile, const char *name,
4.179 + const char *str, FILE *out)
4.180 +{
4.181 + int l;
4.182 + if (headerfile)
4.183 + fprintf(out, "#define %s%s \"", CONFIG_, name);
4.184 + else
4.185 + fprintf(out, "%s%s=\"", CONFIG_, name);
4.186 +
4.187 + while (1) {
4.188 + l = strcspn(str, "\"\\");
4.189 + if (l) {
4.190 + xfwrite(str, l, 1, out);
4.191 + str += l;
4.192 + }
4.193 + if (!*str)
4.194 + break;
4.195 + fprintf(out, "\\%c", *str++);
4.196 + }
4.197 + fputs("\"\n", out);
4.198 +}
4.199 +
4.200 +static void conf_write_symbol(struct symbol *sym, FILE *out, bool write_no)
4.201 +{
4.202 + const char *str;
4.203 +
4.204 + switch (sym->type) {
4.205 + case S_BOOLEAN:
4.206 + case S_TRISTATE:
4.207 + switch (sym_get_tristate_value(sym)) {
4.208 + case no:
4.209 + if (write_no)
4.210 + fprintf(out, "# %s%s is not set\n",
4.211 + CONFIG_, sym->name);
4.212 + break;
4.213 + case mod:
4.214 + fprintf(out, "%s%s=m\n", CONFIG_, sym->name);
4.215 + break;
4.216 + case yes:
4.217 + fprintf(out, "%s%s=y\n", CONFIG_, sym->name);
4.218 + break;
4.219 + }
4.220 + break;
4.221 + case S_STRING:
4.222 + conf_write_string(false, sym->name, sym_get_string_value(sym), out);
4.223 + break;
4.224 + case S_HEX:
4.225 + case S_INT:
4.226 + str = sym_get_string_value(sym);
4.227 + fprintf(out, "%s%s=%s\n", CONFIG_, sym->name, str);
4.228 + break;
4.229 + case S_OTHER:
4.230 + case S_UNKNOWN:
4.231 + break;
4.232 + }
4.233 +}
4.234 +
4.235 +/*
4.236 + * Write out a minimal config.
4.237 + * All values that has default values are skipped as this is redundant.
4.238 + */
4.239 +int conf_write_defconfig(const char *filename)
4.240 +{
4.241 + struct symbol *sym;
4.242 + struct menu *menu;
4.243 + FILE *out;
4.244 +
4.245 + out = fopen(filename, "w");
4.246 + if (!out)
4.247 + return 1;
4.248 +
4.249 + sym_clear_all_valid();
4.250 +
4.251 + /* Traverse all menus to find all relevant symbols */
4.252 + menu = rootmenu.list;
4.253 +
4.254 + while (menu != NULL)
4.255 + {
4.256 + sym = menu->sym;
4.257 + if (sym == NULL) {
4.258 + if (!menu_is_visible(menu))
4.259 + goto next_menu;
4.260 + } else if (!sym_is_choice(sym)) {
4.261 + sym_calc_value(sym);
4.262 + if (!(sym->flags & SYMBOL_WRITE))
4.263 + goto next_menu;
4.264 + sym->flags &= ~SYMBOL_WRITE;
4.265 + /* If we cannot change the symbol - skip */
4.266 + if (!sym_is_changable(sym))
4.267 + goto next_menu;
4.268 + /* If symbol equals to default value - skip */
4.269 + if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0)
4.270 + goto next_menu;
4.271 +
4.272 + /*
4.273 + * If symbol is a choice value and equals to the
4.274 + * default for a choice - skip.
4.275 + * But only if value is bool and equal to "y" and
4.276 + * choice is not "optional".
4.277 + * (If choice is "optional" then all values can be "n")
4.278 + */
4.279 + if (sym_is_choice_value(sym)) {
4.280 + struct symbol *cs;
4.281 + struct symbol *ds;
4.282 +
4.283 + cs = prop_get_symbol(sym_get_choice_prop(sym));
4.284 + ds = sym_choice_default(cs);
4.285 + if (!sym_is_optional(cs) && sym == ds) {
4.286 + if ((sym->type == S_BOOLEAN) &&
4.287 + sym_get_tristate_value(sym) == yes)
4.288 + goto next_menu;
4.289 + }
4.290 + }
4.291 + conf_write_symbol(sym, out, true);
4.292 + }
4.293 +next_menu:
4.294 + if (menu->list != NULL) {
4.295 + menu = menu->list;
4.296 + }
4.297 + else if (menu->next != NULL) {
4.298 + menu = menu->next;
4.299 + } else {
4.300 + while ((menu = menu->parent)) {
4.301 + if (menu->next != NULL) {
4.302 + menu = menu->next;
4.303 + break;
4.304 + }
4.305 + }
4.306 + }
4.307 + }
4.308 + fclose(out);
4.309 + return 0;
4.310 +}
4.311 +
4.312 int conf_write(const char *name)
4.313 {
4.314 FILE *out;
4.315 struct symbol *sym;
4.316 struct menu *menu;
4.317 const char *basename;
4.318 - char dirname[128], tmpname[128], newname[128];
4.319 - int type, l;
4.320 const char *str;
4.321 + char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1];
4.322 time_t now;
4.323 int use_timestamp = 1;
4.324 char *env;
4.325 @@ -436,8 +598,6 @@
4.326 if (!out)
4.327 return 1;
4.328
4.329 - sym = sym_lookup("PROJECTVERSION", 0);
4.330 - sym_calc_value(sym);
4.331 time(&now);
4.332 env = getenv("KCONFIG_NOTIMESTAMP");
4.333 if (env && *env)
4.334 @@ -445,10 +605,10 @@
4.335
4.336 fprintf(out, _("#\n"
4.337 "# Automatically generated make config: don't edit\n"
4.338 - "# " PACKAGE " version: %s\n"
4.339 + "# %s\n"
4.340 "%s%s"
4.341 "#\n"),
4.342 - sym_get_string_value(sym),
4.343 + rootmenu.prompt->text,
4.344 use_timestamp ? "# " : "",
4.345 use_timestamp ? ctime(&now) : "");
4.346
4.347 @@ -471,56 +631,11 @@
4.348 if (!(sym->flags & SYMBOL_WRITE))
4.349 goto next;
4.350 sym->flags &= ~SYMBOL_WRITE;
4.351 - type = sym->type;
4.352 - if (type == S_TRISTATE) {
4.353 - sym_calc_value(modules_sym);
4.354 - if (modules_sym->curr.tri == no)
4.355 - type = S_BOOLEAN;
4.356 - }
4.357 - switch (type) {
4.358 - case S_BOOLEAN:
4.359 - case S_TRISTATE:
4.360 - switch (sym_get_tristate_value(sym)) {
4.361 - case no:
4.362 - fprintf(out, "# CT_%s is not set\n", sym->name);
4.363 - break;
4.364 - case mod:
4.365 - fprintf(out, "CT_%s=m\n", sym->name);
4.366 - break;
4.367 - case yes:
4.368 - fprintf(out, "CT_%s=y\n", sym->name);
4.369 - break;
4.370 - }
4.371 - break;
4.372 - case S_STRING:
4.373 - str = sym_get_string_value(sym);
4.374 - fprintf(out, "CT_%s=\"", sym->name);
4.375 - while (1) {
4.376 - l = strcspn(str, "\"\\");
4.377 - if (l) {
4.378 - fwrite(str, l, 1, out);
4.379 - str += l;
4.380 - }
4.381 - if (!*str)
4.382 - break;
4.383 - fprintf(out, "\\%c", *str++);
4.384 - }
4.385 - fputs("\"\n", out);
4.386 - break;
4.387 - case S_HEX:
4.388 - str = sym_get_string_value(sym);
4.389 - if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
4.390 - fprintf(out, "CT_%s=%s\n", sym->name, str);
4.391 - break;
4.392 - }
4.393 - case S_INT:
4.394 - str = sym_get_string_value(sym);
4.395 - fprintf(out, "CT_%s=%s\n", sym->name, str);
4.396 - break;
4.397 - }
4.398 + /* Write config symbol to file */
4.399 + conf_write_symbol(sym, out, true);
4.400 }
4.401
4.402 - next:
4.403 +next:
4.404 if (menu->list) {
4.405 menu = menu->list;
4.406 continue;
4.407 @@ -544,22 +659,23 @@
4.408 return 1;
4.409 }
4.410
4.411 + conf_message(_("configuration written to %s"), newname);
4.412 +
4.413 sym_set_change_count(0);
4.414
4.415 return 0;
4.416 }
4.417
4.418 -int conf_split_config(void)
4.419 +static int conf_split_config(void)
4.420 {
4.421 - char *name, path[128];
4.422 + const char *name;
4.423 + char path[PATH_MAX+1];
4.424 char *s, *d, c;
4.425 struct symbol *sym;
4.426 struct stat sb;
4.427 int res, i, fd;
4.428
4.429 - name = getenv("KCONFIG_AUTOCONFIG");
4.430 - if (!name)
4.431 - name = "include/config/auto.conf";
4.432 + name = conf_get_autoconfig_name();
4.433 conf_read_simple(name, S_DEF_AUTO);
4.434
4.435 if (chdir("include/config"))
4.436 @@ -666,10 +782,9 @@
4.437 {
4.438 struct symbol *sym;
4.439 const char *str;
4.440 - char *name;
4.441 - FILE *out, *out_h;
4.442 - time_t now;
4.443 - int i, l;
4.444 + const char *name;
4.445 + FILE *out, *tristate, *out_h;
4.446 + int i;
4.447
4.448 sym_clear_all_valid();
4.449
4.450 @@ -682,33 +797,42 @@
4.451 if (!out)
4.452 return 1;
4.453
4.454 - out_h = fopen(".tmpconfig.h", "w");
4.455 - if (!out_h) {
4.456 + tristate = fopen(".tmpconfig_tristate", "w");
4.457 + if (!tristate) {
4.458 fclose(out);
4.459 return 1;
4.460 }
4.461
4.462 - sym = sym_lookup("PROJECTVERSION", 0);
4.463 - sym_calc_value(sym);
4.464 - time(&now);
4.465 + out_h = fopen(".tmpconfig.h", "w");
4.466 + if (!out_h) {
4.467 + fclose(out);
4.468 + fclose(tristate);
4.469 + return 1;
4.470 + }
4.471 +
4.472 fprintf(out, "#\n"
4.473 "# Automatically generated make config: don't edit\n"
4.474 - "# " PACKAGE " version: %s\n"
4.475 - "# %s"
4.476 + "# %s\n"
4.477 "#\n",
4.478 - sym_get_string_value(sym), ctime(&now));
4.479 + rootmenu.prompt->text);
4.480 + fprintf(tristate, "#\n"
4.481 + "# Automatically generated - do not edit\n"
4.482 + "\n");
4.483 fprintf(out_h, "/*\n"
4.484 " * Automatically generated C config: don't edit\n"
4.485 - " * " PACKAGE " version: %s\n"
4.486 - " * %s"
4.487 - " */\n"
4.488 - "#define AUTOCONF_INCLUDED\n",
4.489 - sym_get_string_value(sym), ctime(&now));
4.490 + " * %s\n"
4.491 + " */\n",
4.492 + rootmenu.prompt->text);
4.493
4.494 for_all_symbols(i, sym) {
4.495 sym_calc_value(sym);
4.496 if (!(sym->flags & SYMBOL_WRITE) || !sym->name)
4.497 continue;
4.498 +
4.499 + /* write symbol to config file */
4.500 + conf_write_symbol(sym, out, false);
4.501 +
4.502 + /* update autoconf and tristate files */
4.503 switch (sym->type) {
4.504 case S_BOOLEAN:
4.505 case S_TRISTATE:
4.506 @@ -716,62 +840,54 @@
4.507 case no:
4.508 break;
4.509 case mod:
4.510 - fprintf(out, "CT_%s=m\n", sym->name);
4.511 - fprintf(out_h, "#define CT_%s_MODULE 1\n", sym->name);
4.512 + fprintf(tristate, "%s%s=M\n",
4.513 + CONFIG_, sym->name);
4.514 + fprintf(out_h, "#define %s%s_MODULE 1\n",
4.515 + CONFIG_, sym->name);
4.516 break;
4.517 case yes:
4.518 - fprintf(out, "CT_%s=y\n", sym->name);
4.519 - fprintf(out_h, "#define CT_%s 1\n", sym->name);
4.520 + if (sym->type == S_TRISTATE)
4.521 + fprintf(tristate,"%s%s=Y\n",
4.522 + CONFIG_, sym->name);
4.523 + fprintf(out_h, "#define %s%s 1\n",
4.524 + CONFIG_, sym->name);
4.525 break;
4.526 }
4.527 break;
4.528 case S_STRING:
4.529 - str = sym_get_string_value(sym);
4.530 - fprintf(out, "CT_%s=\"", sym->name);
4.531 - fprintf(out_h, "#define CT_%s \"", sym->name);
4.532 - while (1) {
4.533 - l = strcspn(str, "\"\\");
4.534 - if (l) {
4.535 - fwrite(str, l, 1, out);
4.536 - fwrite(str, l, 1, out_h);
4.537 - str += l;
4.538 - }
4.539 - if (!*str)
4.540 - break;
4.541 - fprintf(out, "\\%c", *str);
4.542 - fprintf(out_h, "\\%c", *str);
4.543 - str++;
4.544 - }
4.545 - fputs("\"\n", out);
4.546 - fputs("\"\n", out_h);
4.547 + conf_write_string(true, sym->name, sym_get_string_value(sym), out_h);
4.548 break;
4.549 case S_HEX:
4.550 str = sym_get_string_value(sym);
4.551 if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) {
4.552 - fprintf(out, "CT_%s=%s\n", sym->name, str);
4.553 - fprintf(out_h, "#define CT_%s 0x%s\n", sym->name, str);
4.554 + fprintf(out_h, "#define %s%s 0x%s\n",
4.555 + CONFIG_, sym->name, str);
4.556 break;
4.557 }
4.558 case S_INT:
4.559 str = sym_get_string_value(sym);
4.560 - fprintf(out, "CT_%s=%s\n", sym->name, str);
4.561 - fprintf(out_h, "#define CT_%s %s\n", sym->name, str);
4.562 + fprintf(out_h, "#define %s%s %s\n",
4.563 + CONFIG_, sym->name, str);
4.564 break;
4.565 default:
4.566 break;
4.567 }
4.568 }
4.569 fclose(out);
4.570 + fclose(tristate);
4.571 fclose(out_h);
4.572
4.573 name = getenv("KCONFIG_AUTOHEADER");
4.574 if (!name)
4.575 - name = "include/linux/autoconf.h";
4.576 + name = "include/generated/autoconf.h";
4.577 if (rename(".tmpconfig.h", name))
4.578 return 1;
4.579 - name = getenv("KCONFIG_AUTOCONFIG");
4.580 + name = getenv("KCONFIG_TRISTATE");
4.581 if (!name)
4.582 - name = "include/config/auto.conf";
4.583 + name = "include/config/tristate.conf";
4.584 + if (rename(".tmpconfig_tristate", name))
4.585 + return 1;
4.586 + name = conf_get_autoconfig_name();
4.587 /*
4.588 * This must be the last step, kbuild has a dependency on auto.conf
4.589 * and this marks the successful completion of the previous steps.
4.590 @@ -809,13 +925,73 @@
4.591 conf_changed_callback = fn;
4.592 }
4.593
4.594 +static void randomize_choice_values(struct symbol *csym)
4.595 +{
4.596 + struct property *prop;
4.597 + struct symbol *sym;
4.598 + struct expr *e;
4.599 + int cnt, def;
4.600 +
4.601 + /*
4.602 + * If choice is mod then we may have more items selected
4.603 + * and if no then no-one.
4.604 + * In both cases stop.
4.605 + */
4.606 + if (csym->curr.tri != yes)
4.607 + return;
4.608 +
4.609 + prop = sym_get_choice_prop(csym);
4.610 +
4.611 + /* count entries in choice block */
4.612 + cnt = 0;
4.613 + expr_list_for_each_sym(prop->expr, e, sym)
4.614 + cnt++;
4.615 +
4.616 + /*
4.617 + * find a random value and set it to yes,
4.618 + * set the rest to no so we have only one set
4.619 + */
4.620 + def = (rand() % cnt);
4.621 +
4.622 + cnt = 0;
4.623 + expr_list_for_each_sym(prop->expr, e, sym) {
4.624 + if (def == cnt++) {
4.625 + sym->def[S_DEF_USER].tri = yes;
4.626 + csym->def[S_DEF_USER].val = sym;
4.627 + }
4.628 + else {
4.629 + sym->def[S_DEF_USER].tri = no;
4.630 + }
4.631 + }
4.632 + csym->flags |= SYMBOL_DEF_USER;
4.633 + /* clear VALID to get value calculated */
4.634 + csym->flags &= ~(SYMBOL_VALID);
4.635 +}
4.636 +
4.637 +static void set_all_choice_values(struct symbol *csym)
4.638 +{
4.639 + struct property *prop;
4.640 + struct symbol *sym;
4.641 + struct expr *e;
4.642 +
4.643 + prop = sym_get_choice_prop(csym);
4.644 +
4.645 + /*
4.646 + * Set all non-assinged choice values to no
4.647 + */
4.648 + expr_list_for_each_sym(prop->expr, e, sym) {
4.649 + if (!sym_has_value(sym))
4.650 + sym->def[S_DEF_USER].tri = no;
4.651 + }
4.652 + csym->flags |= SYMBOL_DEF_USER;
4.653 + /* clear VALID to get value calculated */
4.654 + csym->flags &= ~(SYMBOL_VALID);
4.655 +}
4.656
4.657 void conf_set_all_new_symbols(enum conf_def_mode mode)
4.658 {
4.659 struct symbol *sym, *csym;
4.660 - struct property *prop;
4.661 - struct expr *e;
4.662 - int i, cnt, def;
4.663 + int i, cnt;
4.664
4.665 for_all_symbols(i, sym) {
4.666 if (sym_has_value(sym))
4.667 @@ -834,12 +1010,13 @@
4.668 sym->def[S_DEF_USER].tri = no;
4.669 break;
4.670 case def_random:
4.671 - sym->def[S_DEF_USER].tri = (tristate)(rand() % 3);
4.672 + cnt = sym_get_type(sym) == S_TRISTATE ? 3 : 2;
4.673 + sym->def[S_DEF_USER].tri = (tristate)(rand() % cnt);
4.674 break;
4.675 default:
4.676 continue;
4.677 }
4.678 - if (!sym_is_choice(sym) || mode != def_random)
4.679 + if (!(sym_is_choice(sym) && mode == def_random))
4.680 sym->flags |= SYMBOL_DEF_USER;
4.681 break;
4.682 default:
4.683 @@ -850,30 +1027,23 @@
4.684
4.685 sym_clear_all_valid();
4.686
4.687 - if (mode != def_random)
4.688 - return;
4.689 -
4.690 + /*
4.691 + * We have different type of choice blocks.
4.692 + * If curr.tri equals to mod then we can select several
4.693 + * choice symbols in one block.
4.694 + * In this case we do nothing.
4.695 + * If curr.tri equals yes then only one symbol can be
4.696 + * selected in a choice block and we set it to yes,
4.697 + * and the rest to no.
4.698 + */
4.699 for_all_symbols(i, csym) {
4.700 if (sym_has_value(csym) || !sym_is_choice(csym))
4.701 continue;
4.702
4.703 sym_calc_value(csym);
4.704 - prop = sym_get_choice_prop(csym);
4.705 - def = -1;
4.706 - while (1) {
4.707 - cnt = 0;
4.708 - expr_list_for_each_sym(prop->expr, e, sym) {
4.709 - if (sym->visible == no)
4.710 - continue;
4.711 - if (def == cnt++) {
4.712 - csym->def[S_DEF_USER].val = sym;
4.713 - break;
4.714 - }
4.715 - }
4.716 - if (def >= 0 || cnt < 2)
4.717 - break;
4.718 - def = (rand() % cnt) + 1;
4.719 - }
4.720 - csym->flags |= SYMBOL_DEF_USER;
4.721 + if (mode == def_random)
4.722 + randomize_choice_values(csym);
4.723 + else
4.724 + set_all_choice_values(csym);
4.725 }
4.726 }
5.1 --- a/kconfig/expr.c Tue May 10 23:56:11 2011 +0200
5.2 +++ b/kconfig/expr.c Sun May 08 14:14:40 2011 +0200
5.3 @@ -64,7 +64,7 @@
5.4 return e2 ? expr_alloc_two(E_OR, e1, e2) : e1;
5.5 }
5.6
5.7 -struct expr *expr_copy(struct expr *org)
5.8 +struct expr *expr_copy(const struct expr *org)
5.9 {
5.10 struct expr *e;
5.11
5.12 @@ -348,7 +348,7 @@
5.13 /*
5.14 * e1 || e2 -> ?
5.15 */
5.16 -struct expr *expr_join_or(struct expr *e1, struct expr *e2)
5.17 +static struct expr *expr_join_or(struct expr *e1, struct expr *e2)
5.18 {
5.19 struct expr *tmp;
5.20 struct symbol *sym1, *sym2;
5.21 @@ -412,7 +412,7 @@
5.22 return NULL;
5.23 }
5.24
5.25 -struct expr *expr_join_and(struct expr *e1, struct expr *e2)
5.26 +static struct expr *expr_join_and(struct expr *e1, struct expr *e2)
5.27 {
5.28 struct expr *tmp;
5.29 struct symbol *sym1, *sym2;
5.30 @@ -1013,6 +1013,48 @@
5.31 #endif
5.32 }
5.33
5.34 +static inline struct expr *
5.35 +expr_get_leftmost_symbol(const struct expr *e)
5.36 +{
5.37 +
5.38 + if (e == NULL)
5.39 + return NULL;
5.40 +
5.41 + while (e->type != E_SYMBOL)
5.42 + e = e->left.expr;
5.43 +
5.44 + return expr_copy(e);
5.45 +}
5.46 +
5.47 +/*
5.48 + * Given expression `e1' and `e2', returns the leaf of the longest
5.49 + * sub-expression of `e1' not containing 'e2.
5.50 + */
5.51 +struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2)
5.52 +{
5.53 + struct expr *ret;
5.54 +
5.55 + switch (e1->type) {
5.56 + case E_OR:
5.57 + return expr_alloc_and(
5.58 + expr_simplify_unmet_dep(e1->left.expr, e2),
5.59 + expr_simplify_unmet_dep(e1->right.expr, e2));
5.60 + case E_AND: {
5.61 + struct expr *e;
5.62 + e = expr_alloc_and(expr_copy(e1), expr_copy(e2));
5.63 + e = expr_eliminate_dups(e);
5.64 + ret = (!expr_eq(e, e1)) ? e1 : NULL;
5.65 + expr_free(e);
5.66 + break;
5.67 + }
5.68 + default:
5.69 + ret = e1;
5.70 + break;
5.71 + }
5.72 +
5.73 + return expr_get_leftmost_symbol(ret);
5.74 +}
5.75 +
5.76 void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken)
5.77 {
5.78 if (!e) {
5.79 @@ -1087,7 +1129,7 @@
5.80
5.81 static void expr_print_file_helper(void *data, struct symbol *sym, const char *str)
5.82 {
5.83 - fwrite(str, strlen(str), 1, data);
5.84 + xfwrite(str, strlen(str), 1, data);
5.85 }
5.86
5.87 void expr_fprint(struct expr *e, FILE *out)
5.88 @@ -1097,7 +1139,32 @@
5.89
5.90 static void expr_print_gstr_helper(void *data, struct symbol *sym, const char *str)
5.91 {
5.92 - str_append((struct gstr*)data, str);
5.93 + struct gstr *gs = (struct gstr*)data;
5.94 + const char *sym_str = NULL;
5.95 +
5.96 + if (sym)
5.97 + sym_str = sym_get_string_value(sym);
5.98 +
5.99 + if (gs->max_width) {
5.100 + unsigned extra_length = strlen(str);
5.101 + const char *last_cr = strrchr(gs->s, '\n');
5.102 + unsigned last_line_length;
5.103 +
5.104 + if (sym_str)
5.105 + extra_length += 4 + strlen(sym_str);
5.106 +
5.107 + if (!last_cr)
5.108 + last_cr = gs->s;
5.109 +
5.110 + last_line_length = strlen(gs->s) - (last_cr - gs->s);
5.111 +
5.112 + if ((last_line_length + extra_length) > gs->max_width)
5.113 + str_append(gs, "\\\n");
5.114 + }
5.115 +
5.116 + str_append(gs, str);
5.117 + if (sym && sym->type != S_UNKNOWN)
5.118 + str_printf(gs, " [=%s]", sym_str);
5.119 }
5.120
5.121 void expr_gstr_print(struct expr *e, struct gstr *gs)
6.1 --- a/kconfig/expr.h Tue May 10 23:56:11 2011 +0200
6.2 +++ b/kconfig/expr.h Sun May 08 14:14:40 2011 +0200
6.3 @@ -18,14 +18,10 @@
6.4 struct file {
6.5 struct file *next;
6.6 struct file *parent;
6.7 - char *name;
6.8 + const char *name;
6.9 int lineno;
6.10 - int flags;
6.11 };
6.12
6.13 -#define FILE_BUSY 0x0001
6.14 -#define FILE_SCANNED 0x0002
6.15 -
6.16 typedef enum tristate {
6.17 no, mod, yes
6.18 } tristate;
6.19 @@ -83,10 +79,11 @@
6.20 tristate visible;
6.21 int flags;
6.22 struct property *prop;
6.23 + struct expr_value dir_dep;
6.24 struct expr_value rev_dep;
6.25 };
6.26
6.27 -#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)
6.28 +#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER)
6.29
6.30 #define SYMBOL_CONST 0x0001 /* symbol is const */
6.31 #define SYMBOL_CHECK 0x0008 /* used during dependency checking */
6.32 @@ -108,8 +105,7 @@
6.33 #define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */
6.34
6.35 #define SYMBOL_MAXLENGTH 256
6.36 -#define SYMBOL_HASHSIZE 257
6.37 -#define SYMBOL_HASHMASK 0xff
6.38 +#define SYMBOL_HASHSIZE 9973
6.39
6.40 /* A property represent the config options that can be associated
6.41 * with a config "symbol".
6.42 @@ -132,6 +128,7 @@
6.43 P_SELECT, /* select BAR */
6.44 P_RANGE, /* range 7..100 (for a symbol) */
6.45 P_ENV, /* value from environment variable */
6.46 + P_SYMBOL, /* where a symbol is defined */
6.47 };
6.48
6.49 struct property {
6.50 @@ -163,6 +160,7 @@
6.51 struct menu *list;
6.52 struct symbol *sym;
6.53 struct property *prompt;
6.54 + struct expr *visibility;
6.55 struct expr *dep;
6.56 unsigned int flags;
6.57 char *help;
6.58 @@ -190,7 +188,7 @@
6.59 struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
6.60 struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
6.61 struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
6.62 -struct expr *expr_copy(struct expr *org);
6.63 +struct expr *expr_copy(const struct expr *org);
6.64 void expr_free(struct expr *e);
6.65 int expr_eq(struct expr *e1, struct expr *e2);
6.66 void expr_eliminate_eq(struct expr **ep1, struct expr **ep2);
6.67 @@ -205,6 +203,7 @@
6.68 struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2);
6.69 void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2);
6.70 struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym);
6.71 +struct expr *expr_simplify_unmet_dep(struct expr *e1, struct expr *e2);
6.72
6.73 void expr_fprint(struct expr *e, FILE *out);
6.74 struct gstr; /* forward */
7.1 --- a/kconfig/kconfig.mk Tue May 10 23:56:11 2011 +0200
7.2 +++ b/kconfig/kconfig.mk Sun May 08 14:14:40 2011 +0200
7.3 @@ -22,7 +22,7 @@
7.4
7.5 oldconfig: $(obj)/conf .config
7.6 @$(ECHO) " CONF $(KCONFIG_TOP)"
7.7 - $(SILENT)$< -s $(KCONFIG_TOP)
7.8 + $(SILENT)$< --silent$@ $(KCONFIG_TOP)
7.9
7.10 # Always be silent, the stdout an be >.config
7.11 extractconfig:
7.12 @@ -61,11 +61,11 @@
7.13 HOST_LD ?= gcc
7.14
7.15 # Helpers
7.16 -check_gettext = $(CT_LIB_DIR)/kconfig/check-gettext.sh
7.17 +check_gettext = $(CT_LIB_DIR)/kconfig/check.sh
7.18 check_lxdialog = $(CT_LIB_DIR)/kconfig/lxdialog/check-lxdialog.sh
7.19
7.20 # Build flags
7.21 -CFLAGS =
7.22 +CFLAGS = -DCONFIG_=\"CT_\" -DPACKAGE=\"crosstool-NG\"
7.23 LDFLAGS =
7.24
7.25 # Compiler flags to use gettext
8.1 --- a/kconfig/lex.zconf.c Tue May 10 23:56:11 2011 +0200
8.2 +++ b/kconfig/lex.zconf.c Sun May 08 14:14:40 2011 +0200
8.3 @@ -160,7 +160,15 @@
8.4
8.5 /* Size of default input buffer. */
8.6 #ifndef YY_BUF_SIZE
8.7 +#ifdef __ia64__
8.8 +/* On IA-64, the buffer size is 16k, not 8k.
8.9 + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
8.10 + * Ditto for the __ia64__ case accordingly.
8.11 + */
8.12 +#define YY_BUF_SIZE 32768
8.13 +#else
8.14 #define YY_BUF_SIZE 16384
8.15 +#endif /* __ia64__ */
8.16 #endif
8.17
8.18 /* The state buf must be large enough to hold one state per character in the main buffer.
8.19 @@ -802,7 +810,7 @@
8.20 static void zconf_endhelp(void);
8.21 static void zconf_endfile(void);
8.22
8.23 -void new_string(void)
8.24 +static void new_string(void)
8.25 {
8.26 text = malloc(START_STRSIZE);
8.27 text_asize = START_STRSIZE;
8.28 @@ -810,7 +818,7 @@
8.29 *text = 0;
8.30 }
8.31
8.32 -void append_string(const char *str, int size)
8.33 +static void append_string(const char *str, int size)
8.34 {
8.35 int new_size = text_size + size + 1;
8.36 if (new_size > text_asize) {
8.37 @@ -824,7 +832,7 @@
8.38 text[text_size] = 0;
8.39 }
8.40
8.41 -void alloc_string(const char *str, int size)
8.42 +static void alloc_string(const char *str, int size)
8.43 {
8.44 text = malloc(size + 1);
8.45 memcpy(text, str, size);
8.46 @@ -914,7 +922,12 @@
8.47
8.48 /* Amount of stuff to slurp up with each read. */
8.49 #ifndef YY_READ_BUF_SIZE
8.50 +#ifdef __ia64__
8.51 +/* On IA-64, the buffer size is 16k, not 8k */
8.52 +#define YY_READ_BUF_SIZE 16384
8.53 +#else
8.54 #define YY_READ_BUF_SIZE 8192
8.55 +#endif /* __ia64__ */
8.56 #endif
8.57
8.58 /* Copy whatever the last rule matched to the standard output. */
8.59 @@ -922,7 +935,7 @@
8.60 /* This used to be an fputs(), but since the string might contain NUL's,
8.61 * we now use fwrite().
8.62 */
8.63 -#define ECHO fwrite( zconftext, zconfleng, 1, zconfout )
8.64 +#define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0)
8.65 #endif
8.66
8.67 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
8.68 @@ -2060,8 +2073,8 @@
8.69
8.70 /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
8.71 * scan from a @e copy of @a bytes.
8.72 - * @param bytes the byte buffer to scan
8.73 - * @param len the number of bytes in the buffer pointed to by @a bytes.
8.74 + * @param yybytes the byte buffer to scan
8.75 + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
8.76 *
8.77 * @return the newly allocated buffer state object.
8.78 */
8.79 @@ -2350,37 +2363,45 @@
8.80
8.81 current_file = file_lookup(name);
8.82 current_file->lineno = 1;
8.83 - current_file->flags = FILE_BUSY;
8.84 }
8.85
8.86 void zconf_nextfile(const char *name)
8.87 {
8.88 + struct file *iter;
8.89 struct file *file = file_lookup(name);
8.90 struct buffer *buf = malloc(sizeof(*buf));
8.91 memset(buf, 0, sizeof(*buf));
8.92
8.93 current_buf->state = YY_CURRENT_BUFFER;
8.94 - zconfin = zconf_fopen(name);
8.95 + zconfin = zconf_fopen(file->name);
8.96 if (!zconfin) {
8.97 - printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
8.98 + printf("%s:%d: can't open file \"%s\"\n",
8.99 + zconf_curname(), zconf_lineno(), file->name);
8.100 exit(1);
8.101 }
8.102 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
8.103 buf->parent = current_buf;
8.104 current_buf = buf;
8.105
8.106 - if (file->flags & FILE_BUSY) {
8.107 - printf("%s:%d: do not source '%s' from itself\n",
8.108 - zconf_curname(), zconf_lineno(), name);
8.109 - exit(1);
8.110 + for (iter = current_file->parent; iter; iter = iter->parent ) {
8.111 + if (!strcmp(current_file->name,iter->name) ) {
8.112 + printf("%s:%d: recursive inclusion detected. "
8.113 + "Inclusion path:\n current file : '%s'\n",
8.114 + zconf_curname(), zconf_lineno(),
8.115 + zconf_curname());
8.116 + iter = current_file->parent;
8.117 + while (iter && \
8.118 + strcmp(iter->name,current_file->name)) {
8.119 + printf(" included from: '%s:%d'\n",
8.120 + iter->name, iter->lineno-1);
8.121 + iter = iter->parent;
8.122 + }
8.123 + if (iter)
8.124 + printf(" included from: '%s:%d'\n",
8.125 + iter->name, iter->lineno+1);
8.126 + exit(1);
8.127 + }
8.128 }
8.129 - if (file->flags & FILE_SCANNED) {
8.130 - printf("%s:%d: file '%s' is already sourced from '%s'\n",
8.131 - zconf_curname(), zconf_lineno(), name,
8.132 - file->parent->name);
8.133 - exit(1);
8.134 - }
8.135 - file->flags |= FILE_BUSY;
8.136 file->lineno = 1;
8.137 file->parent = current_file;
8.138 current_file = file;
8.139 @@ -2390,8 +2411,6 @@
8.140 {
8.141 struct buffer *parent;
8.142
8.143 - current_file->flags |= FILE_SCANNED;
8.144 - current_file->flags &= ~FILE_BUSY;
8.145 current_file = current_file->parent;
8.146
8.147 parent = current_buf->parent;
8.148 @@ -2409,7 +2428,7 @@
8.149 return current_pos.lineno;
8.150 }
8.151
8.152 -char *zconf_curname(void)
8.153 +const char *zconf_curname(void)
8.154 {
8.155 return current_pos.file ? current_pos.file->name : "<none>";
8.156 }
9.1 --- a/kconfig/lkc.h Tue May 10 23:56:11 2011 +0200
9.2 +++ b/kconfig/lkc.h Sun May 08 14:14:40 2011 +0200
9.3 @@ -14,6 +14,7 @@
9.4 static inline const char *gettext(const char *txt) { return txt; }
9.5 static inline void textdomain(const char *domainname) {}
9.6 static inline void bindtextdomain(const char *name, const char *dir) {}
9.7 +static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; }
9.8 #endif
9.9
9.10 #ifdef __cplusplus
9.11 @@ -31,12 +32,18 @@
9.12
9.13 #define SRCTREE "srctree"
9.14
9.15 -#define PACKAGE "crosstool-NG"
9.16 +#ifndef PACKAGE
9.17 +#define PACKAGE "linux"
9.18 +#endif
9.19 +
9.20 #define LOCALEDIR "/usr/share/locale"
9.21
9.22 #define _(text) gettext(text)
9.23 #define N_(text) (text)
9.24
9.25 +#ifndef CONFIG_
9.26 +#define CONFIG_ "CONFIG_"
9.27 +#endif
9.28
9.29 #define TF_COMMAND 0x0001
9.30 #define TF_PARAM 0x0002
9.31 @@ -61,35 +68,49 @@
9.32 enum symbol_type stype;
9.33 };
9.34
9.35 +#ifdef YYDEBUG
9.36 +extern int zconfdebug;
9.37 +#endif
9.38 +
9.39 int zconfparse(void);
9.40 void zconfdump(FILE *out);
9.41 -
9.42 -extern int zconfdebug;
9.43 void zconf_starthelp(void);
9.44 FILE *zconf_fopen(const char *name);
9.45 void zconf_initscan(const char *name);
9.46 void zconf_nextfile(const char *name);
9.47 int zconf_lineno(void);
9.48 -char *zconf_curname(void);
9.49 +const char *zconf_curname(void);
9.50 +
9.51 +/* conf.c */
9.52 +void xfgets(char *str, int size, FILE *in);
9.53
9.54 /* confdata.c */
9.55 const char *conf_get_configname(void);
9.56 +const char *conf_get_autoconfig_name(void);
9.57 char *conf_get_default_confname(void);
9.58 void sym_set_change_count(int count);
9.59 void sym_add_change_count(int count);
9.60 void conf_set_all_new_symbols(enum conf_def_mode mode);
9.61
9.62 +/* confdata.c and expr.c */
9.63 +static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out)
9.64 +{
9.65 + if (fwrite(str, len, count, out) < count)
9.66 + fprintf(stderr, "\nError in writing or end of file.\n");
9.67 +}
9.68 +
9.69 /* kconfig_load.c */
9.70 void kconfig_load(void);
9.71
9.72 /* menu.c */
9.73 -void menu_init(void);
9.74 +void _menu_init(void);
9.75 void menu_warn(struct menu *menu, const char *fmt, ...);
9.76 struct menu *menu_add_menu(void);
9.77 void menu_end_menu(void);
9.78 void menu_add_entry(struct symbol *sym);
9.79 void menu_end_entry(void);
9.80 void menu_add_dep(struct expr *dep);
9.81 +void menu_add_visibility(struct expr *dep);
9.82 struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep);
9.83 struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep);
9.84 void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep);
9.85 @@ -105,6 +126,11 @@
9.86 struct gstr {
9.87 size_t len;
9.88 char *s;
9.89 + /*
9.90 + * when max_width is not zero long lines in string s (if any) get
9.91 + * wrapped not to exceed the max_width value
9.92 + */
9.93 + int max_width;
9.94 };
9.95 struct gstr str_new(void);
9.96 struct gstr str_assign(const char *s);
9.97 @@ -120,6 +146,8 @@
9.98 void sym_clear_all_valid(void);
9.99 void sym_set_all_changed(void);
9.100 void sym_set_changed(struct symbol *sym);
9.101 +struct symbol *sym_choice_default(struct symbol *sym);
9.102 +const char *sym_get_string_default(struct symbol *sym);
9.103 struct symbol *sym_check_deps(struct symbol *sym);
9.104 struct property *prop_alloc(enum prop_type type, struct symbol *sym);
9.105 struct symbol *prop_get_symbol(struct property *prop);
10.1 --- a/kconfig/lkc_proto.h Tue May 10 23:56:11 2011 +0200
10.2 +++ b/kconfig/lkc_proto.h Sun May 08 14:14:40 2011 +0200
10.3 @@ -1,28 +1,36 @@
10.4 +#include <stdarg.h>
10.5
10.6 /* confdata.c */
10.7 P(conf_parse,void,(const char *name));
10.8 P(conf_read,int,(const char *name));
10.9 P(conf_read_simple,int,(const char *name, int));
10.10 +P(conf_write_defconfig,int,(const char *name));
10.11 P(conf_write,int,(const char *name));
10.12 P(conf_write_autoconf,int,(void));
10.13 P(conf_get_changed,bool,(void));
10.14 P(conf_set_changed_callback, void,(void (*fn)(void)));
10.15 +P(conf_set_message_callback, void,(void (*fn)(const char *fmt, va_list ap)));
10.16
10.17 /* menu.c */
10.18 P(rootmenu,struct menu,);
10.19
10.20 -P(menu_is_visible,bool,(struct menu *menu));
10.21 +P(menu_is_visible, bool, (struct menu *menu));
10.22 +P(menu_has_prompt, bool, (struct menu *menu));
10.23 P(menu_get_prompt,const char *,(struct menu *menu));
10.24 P(menu_get_root_menu,struct menu *,(struct menu *menu));
10.25 P(menu_get_parent_menu,struct menu *,(struct menu *menu));
10.26 P(menu_has_help,bool,(struct menu *menu));
10.27 P(menu_get_help,const char *,(struct menu *menu));
10.28 +P(get_symbol_str, void, (struct gstr *r, struct symbol *sym));
10.29 +P(get_relations_str, struct gstr, (struct symbol **sym_arr));
10.30 +P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));
10.31
10.32 /* symbol.c */
10.33 P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]);
10.34
10.35 P(sym_lookup,struct symbol *,(const char *name, int flags));
10.36 P(sym_find,struct symbol *,(const char *name));
10.37 +P(sym_expand_string_value,const char *,(const char *in));
10.38 P(sym_re_search,struct symbol **,(const char *pattern));
10.39 P(sym_type_name,const char *,(enum symbol_type type));
10.40 P(sym_calc_value,void,(struct symbol *sym));
11.1 --- a/kconfig/lxdialog/check-lxdialog.sh Tue May 10 23:56:11 2011 +0200
11.2 +++ b/kconfig/lxdialog/check-lxdialog.sh Sun May 08 14:14:40 2011 +0200
11.3 @@ -23,6 +23,8 @@
11.4 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>"'
11.5 elif [ -f /usr/include/ncurses/curses.h ]; then
11.6 echo '-I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>"'
11.7 + elif [ -f /usr/include/ncursesw/curses.h ]; then
11.8 + echo '-I/usr/include/ncursesw -DCURSES_LOC="<ncursesw/curses.h>"'
11.9 elif [ -f /usr/include/ncurses.h ]; then
11.10 echo '-DCURSES_LOC="<ncurses.h>"'
11.11 else
12.1 --- a/kconfig/lxdialog/checklist.c Tue May 10 23:56:11 2011 +0200
12.2 +++ b/kconfig/lxdialog/checklist.c Sun May 08 14:14:40 2011 +0200
12.3 @@ -31,6 +31,10 @@
12.4 static void print_item(WINDOW * win, int choice, int selected)
12.5 {
12.6 int i;
12.7 + char *list_item = malloc(list_width + 1);
12.8 +
12.9 + strncpy(list_item, item_str(), list_width - item_x);
12.10 + list_item[list_width - item_x] = '\0';
12.11
12.12 /* Clear 'residue' of last item */
12.13 wattrset(win, dlg.menubox.atr);
12.14 @@ -41,16 +45,18 @@
12.15 wmove(win, choice, check_x);
12.16 wattrset(win, selected ? dlg.check_selected.atr
12.17 : dlg.check.atr);
12.18 - wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
12.19 + if (!item_is_tag(':'))
12.20 + wprintw(win, "(%c)", item_is_tag('X') ? 'X' : ' ');
12.21
12.22 wattrset(win, selected ? dlg.tag_selected.atr : dlg.tag.atr);
12.23 - mvwaddch(win, choice, item_x, item_str()[0]);
12.24 + mvwaddch(win, choice, item_x, list_item[0]);
12.25 wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr);
12.26 - waddstr(win, (char *)item_str() + 1);
12.27 + waddstr(win, list_item + 1);
12.28 if (selected) {
12.29 wmove(win, choice, check_x + 1);
12.30 wrefresh(win);
12.31 }
12.32 + free(list_item);
12.33 }
12.34
12.35 /*
12.36 @@ -174,6 +180,7 @@
12.37 check_x = 0;
12.38 item_foreach()
12.39 check_x = MAX(check_x, strlen(item_str()) + 4);
12.40 + check_x = MIN(check_x, list_width);
12.41
12.42 check_x = (list_width - check_x) / 2;
12.43 item_x = check_x + 4;
13.1 --- a/kconfig/lxdialog/inputbox.c Tue May 10 23:56:11 2011 +0200
13.2 +++ b/kconfig/lxdialog/inputbox.c Sun May 08 14:14:40 2011 +0200
13.3 @@ -180,7 +180,7 @@
13.4 case KEY_LEFT:
13.5 switch (button) {
13.6 case -1:
13.7 - button = 1; /* Indicates "Cancel" button is selected */
13.8 + button = 1; /* Indicates "Help" button is selected */
13.9 print_buttons(dialog, height, width, 1);
13.10 break;
13.11 case 0:
13.12 @@ -204,7 +204,7 @@
13.13 print_buttons(dialog, height, width, 0);
13.14 break;
13.15 case 0:
13.16 - button = 1; /* Indicates "Cancel" button is selected */
13.17 + button = 1; /* Indicates "Help" button is selected */
13.18 print_buttons(dialog, height, width, 1);
13.19 break;
13.20 case 1:
14.1 --- a/kconfig/lxdialog/menubox.c Tue May 10 23:56:11 2011 +0200
14.2 +++ b/kconfig/lxdialog/menubox.c Sun May 08 14:14:40 2011 +0200
14.3 @@ -383,6 +383,10 @@
14.4 case 'n':
14.5 case 'm':
14.6 case '/':
14.7 + case 'h':
14.8 + case '?':
14.9 + case 'z':
14.10 + case '\n':
14.11 /* save scroll info */
14.12 *s_scroll = scroll;
14.13 delwin(menu);
14.14 @@ -390,8 +394,10 @@
14.15 item_set(scroll + choice);
14.16 item_set_selected(1);
14.17 switch (key) {
14.18 + case 'h':
14.19 + case '?':
14.20 + return 2;
14.21 case 's':
14.22 - return 3;
14.23 case 'y':
14.24 return 3;
14.25 case 'n':
14.26 @@ -402,18 +408,12 @@
14.27 return 6;
14.28 case '/':
14.29 return 7;
14.30 + case 'z':
14.31 + return 8;
14.32 + case '\n':
14.33 + return button;
14.34 }
14.35 return 0;
14.36 - case 'h':
14.37 - case '?':
14.38 - button = 2;
14.39 - case '\n':
14.40 - *s_scroll = scroll;
14.41 - delwin(menu);
14.42 - delwin(dialog);
14.43 - item_set(scroll + choice);
14.44 - item_set_selected(1);
14.45 - return button;
14.46 case 'e':
14.47 case 'x':
14.48 key = KEY_ESC;
15.1 --- a/kconfig/lxdialog/util.c Tue May 10 23:56:11 2011 +0200
15.2 +++ b/kconfig/lxdialog/util.c Sun May 08 14:14:40 2011 +0200
15.3 @@ -19,6 +19,8 @@
15.4 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
15.5 */
15.6
15.7 +#include <stdarg.h>
15.8 +
15.9 #include "dialog.h"
15.10
15.11 struct dialog_info dlg;
16.1 --- a/kconfig/mconf.c Tue May 10 23:56:11 2011 +0200
16.2 +++ b/kconfig/mconf.c Sun May 08 14:14:40 2011 +0200
16.3 @@ -25,11 +25,9 @@
16.4 static const char mconf_readme[] = N_(
16.5 "Overview\n"
16.6 "--------\n"
16.7 -"Some kernel features may be built directly into the kernel.\n"
16.8 -"Some may be made into loadable runtime modules. Some features\n"
16.9 -"may be completely removed altogether. There are also certain\n"
16.10 -"kernel parameters which are not really features, but must be\n"
16.11 -"entered in as decimal or hexadecimal numbers or possibly text.\n"
16.12 +"This interface let you select features and parameters for the build.\n"
16.13 +"Features can either be built-in, modularized, or ignored. Parameters\n"
16.14 +"must be entered in as decimal or hexadecimal numbers or text.\n"
16.15 "\n"
16.16 "Menu items beginning with following braces represent features that\n"
16.17 " [ ] can be built in or removed\n"
16.18 @@ -67,13 +65,15 @@
16.19 " there is a delayed response which you may find annoying.\n"
16.20 "\n"
16.21 " Also, the <TAB> and cursor keys will cycle between <Select>,\n"
16.22 -" <Exit> and <Help>\n"
16.23 +" <Exit> and <Help>.\n"
16.24 "\n"
16.25 "o To get help with an item, use the cursor keys to highlight <Help>\n"
16.26 -" and Press <ENTER>.\n"
16.27 +" and press <ENTER>.\n"
16.28 "\n"
16.29 " Shortcut: Press <H> or <?>.\n"
16.30 "\n"
16.31 +"o To toggle the display of hidden options, press <Z>.\n"
16.32 +"\n"
16.33 "\n"
16.34 "Radiolists (Choice lists)\n"
16.35 "-----------\n"
16.36 @@ -115,7 +115,7 @@
16.37 "-----------------------------\n"
16.38 "Menuconfig supports the use of alternate configuration files for\n"
16.39 "those who, for various reasons, find it necessary to switch\n"
16.40 -"between different kernel configurations.\n"
16.41 +"between different configurations.\n"
16.42 "\n"
16.43 "At the end of the main menu you will find two options. One is\n"
16.44 "for saving the current configuration to a file of your choosing.\n"
16.45 @@ -148,9 +148,9 @@
16.46 "\n"
16.47 "Optional personality available\n"
16.48 "------------------------------\n"
16.49 -"If you prefer to have all of the kernel options listed in a single\n"
16.50 -"menu, rather than the default multimenu hierarchy, run the menuconfig\n"
16.51 -"with MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
16.52 +"If you prefer to have all of the options listed in a single menu, rather\n"
16.53 +"than the default multimenu hierarchy, run the menuconfig with\n"
16.54 +"MENUCONFIG_MODE environment variable set to single_menu. Example:\n"
16.55 "\n"
16.56 "make MENUCONFIG_MODE=single_menu menuconfig\n"
16.57 "\n"
16.58 @@ -199,30 +199,28 @@
16.59 setmod_text[] = N_(
16.60 "This feature depends on another which has been configured as a module.\n"
16.61 "As a result, this feature will be built as a module."),
16.62 -nohelp_text[] = N_(
16.63 - "There is no help available for this kernel option.\n"),
16.64 load_config_text[] = N_(
16.65 "Enter the name of the configuration file you wish to load. "
16.66 "Accept the name shown to restore the configuration you "
16.67 "last retrieved. Leave blank to abort."),
16.68 load_config_help[] = N_(
16.69 "\n"
16.70 - "For various reasons, one may wish to keep several different kernel\n"
16.71 + "For various reasons, one may wish to keep several different\n"
16.72 "configurations available on a single machine.\n"
16.73 "\n"
16.74 "If you have saved a previous configuration in a file other than the\n"
16.75 - "kernel's default, entering the name of the file here will allow you\n"
16.76 - "to modify that configuration.\n"
16.77 + "default one, entering its name here will allow you to modify that\n"
16.78 + "configuration.\n"
16.79 "\n"
16.80 "If you are uncertain, then you have probably never used alternate\n"
16.81 - "configuration files. You should therefor leave this blank to abort.\n"),
16.82 + "configuration files. You should therefore leave this blank to abort.\n"),
16.83 save_config_text[] = N_(
16.84 "Enter a filename to which this configuration should be saved "
16.85 "as an alternate. Leave blank to abort."),
16.86 save_config_help[] = N_(
16.87 "\n"
16.88 - "For various reasons, one may wish to keep different kernel\n"
16.89 - "configurations available on a single machine.\n"
16.90 + "For various reasons, one may wish to keep different configurations\n"
16.91 + "available on a single machine.\n"
16.92 "\n"
16.93 "Entering a file name here will allow you to later retrieve, modify\n"
16.94 "and use the current configuration as an alternate to whatever\n"
16.95 @@ -232,7 +230,7 @@
16.96 "leave this blank.\n"),
16.97 search_help[] = N_(
16.98 "\n"
16.99 - "Search for CT_ symbols and display their relations.\n"
16.100 + "Search for symbols and display their relations.\n"
16.101 "Regular expressions are allowed.\n"
16.102 "Example: search for \"^FOO\"\n"
16.103 "Result:\n"
16.104 @@ -249,7 +247,7 @@
16.105 "Selected by: BAR\n"
16.106 "-----------------------------------------------------------------\n"
16.107 "o The line 'Prompt:' shows the text used in the menu structure for\n"
16.108 - " this CT_ symbol\n"
16.109 + " this symbol\n"
16.110 "o The 'Defined at' line tell at what file / line number the symbol\n"
16.111 " is defined\n"
16.112 "o The 'Depends on:' line tell what symbols needs to be defined for\n"
16.113 @@ -265,15 +263,16 @@
16.114 "Only relevant lines are shown.\n"
16.115 "\n\n"
16.116 "Search examples:\n"
16.117 - "Examples: USB => find all CT_ symbols containing USB\n"
16.118 - " ^USB => find all CT_ symbols starting with USB\n"
16.119 - " USB$ => find all CT_ symbols ending with USB\n"
16.120 + "Examples: USB => find all symbols containing USB\n"
16.121 + " ^USB => find all symbols starting with USB\n"
16.122 + " USB$ => find all symbols ending with USB\n"
16.123 "\n");
16.124
16.125 static int indent;
16.126 static struct menu *current_menu;
16.127 static int child_count;
16.128 static int single_menu_mode;
16.129 +static int show_all_options;
16.130
16.131 static void conf(struct menu *menu);
16.132 static void conf_choice(struct menu *menu);
16.133 @@ -284,91 +283,14 @@
16.134 static void show_helptext(const char *title, const char *text);
16.135 static void show_help(struct menu *menu);
16.136
16.137 -static void get_prompt_str(struct gstr *r, struct property *prop)
16.138 -{
16.139 - int i, j;
16.140 - struct menu *submenu[8], *menu;
16.141 -
16.142 - str_printf(r, _("Prompt: %s\n"), _(prop->text));
16.143 - str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
16.144 - prop->menu->lineno);
16.145 - if (!expr_is_yes(prop->visible.expr)) {
16.146 - str_append(r, _(" Depends on: "));
16.147 - expr_gstr_print(prop->visible.expr, r);
16.148 - str_append(r, "\n");
16.149 - }
16.150 - menu = prop->menu->parent;
16.151 - for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
16.152 - submenu[i++] = menu;
16.153 - if (i > 0) {
16.154 - str_printf(r, _(" Location:\n"));
16.155 - for (j = 4; --i >= 0; j += 2) {
16.156 - menu = submenu[i];
16.157 - str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
16.158 - if (menu->sym) {
16.159 - str_printf(r, " (%s [=%s])", menu->sym->name ?
16.160 - menu->sym->name : _("<choice>"),
16.161 - sym_get_string_value(menu->sym));
16.162 - }
16.163 - str_append(r, "\n");
16.164 - }
16.165 - }
16.166 -}
16.167 -
16.168 -static void get_symbol_str(struct gstr *r, struct symbol *sym)
16.169 -{
16.170 - bool hit;
16.171 - struct property *prop;
16.172 -
16.173 - if (sym && sym->name)
16.174 - str_printf(r, "Symbol: %s [=%s]\n", sym->name,
16.175 - sym_get_string_value(sym));
16.176 - for_all_prompts(sym, prop)
16.177 - get_prompt_str(r, prop);
16.178 - hit = false;
16.179 - for_all_properties(sym, prop, P_SELECT) {
16.180 - if (!hit) {
16.181 - str_append(r, " Selects: ");
16.182 - hit = true;
16.183 - } else
16.184 - str_printf(r, " && ");
16.185 - expr_gstr_print(prop->expr, r);
16.186 - }
16.187 - if (hit)
16.188 - str_append(r, "\n");
16.189 - if (sym->rev_dep.expr) {
16.190 - str_append(r, _(" Selected by: "));
16.191 - expr_gstr_print(sym->rev_dep.expr, r);
16.192 - str_append(r, "\n");
16.193 - }
16.194 - str_append(r, "\n\n");
16.195 -}
16.196 -
16.197 -static struct gstr get_relations_str(struct symbol **sym_arr)
16.198 -{
16.199 - struct symbol *sym;
16.200 - struct gstr res = str_new();
16.201 - int i;
16.202 -
16.203 - for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
16.204 - get_symbol_str(&res, sym);
16.205 - if (!i)
16.206 - str_append(&res, _("No matches found.\n"));
16.207 - return res;
16.208 -}
16.209 -
16.210 static char filename[PATH_MAX+1];
16.211 static void set_config_filename(const char *config_filename)
16.212 {
16.213 static char menu_backtitle[PATH_MAX+128];
16.214 int size;
16.215 - struct symbol *sym;
16.216
16.217 - sym = sym_lookup("PROJECTVERSION", 0);
16.218 - sym_calc_value(sym);
16.219 size = snprintf(menu_backtitle, sizeof(menu_backtitle),
16.220 - _(PACKAGE " v%s Configuration - %s"),
16.221 - sym_get_string_value(sym), config_filename);
16.222 + "%s - %s", config_filename, rootmenu.prompt->text);
16.223 if (size >= sizeof(menu_backtitle))
16.224 menu_backtitle[sizeof(menu_backtitle)-1] = '\0';
16.225 set_dialog_backtitle(menu_backtitle);
16.226 @@ -388,8 +310,8 @@
16.227 again:
16.228 dialog_clear();
16.229 dres = dialog_inputbox(_("Search Configuration Parameter"),
16.230 - _("Enter CT_ (sub)string to search for "
16.231 - "(with or without \"CT\")"),
16.232 + _("Enter " CONFIG_ " (sub)string to search for "
16.233 + "(with or without \"" CONFIG_ "\")"),
16.234 10, 75, "");
16.235 switch (dres) {
16.236 case 0:
16.237 @@ -401,10 +323,10 @@
16.238 return;
16.239 }
16.240
16.241 - /* strip CT_ if necessary */
16.242 + /* strip the prefix if necessary */
16.243 dialog_input = dialog_input_result;
16.244 - if (strncasecmp(dialog_input_result, "CT_", 3) == 0)
16.245 - dialog_input += 7;
16.246 + if (strncasecmp(dialog_input_result, CONFIG_, strlen(CONFIG_)) == 0)
16.247 + dialog_input += strlen(CONFIG_);
16.248
16.249 sym_arr = sym_re_search(dialog_input);
16.250 res = get_relations_str(sym_arr);
16.251 @@ -421,8 +343,16 @@
16.252 int type, tmp, doint = 2;
16.253 tristate val;
16.254 char ch;
16.255 + bool visible;
16.256
16.257 - if (!menu_is_visible(menu))
16.258 + /*
16.259 + * note: menu_is_visible() has side effect that it will
16.260 + * recalc the value of the symbol.
16.261 + */
16.262 + visible = menu_is_visible(menu);
16.263 + if (show_all_options && !menu_has_prompt(menu))
16.264 + return;
16.265 + else if (!show_all_options && !visible)
16.266 return;
16.267
16.268 sym = menu->sym;
16.269 @@ -681,6 +611,9 @@
16.270 case 7:
16.271 search_conf();
16.272 break;
16.273 + case 8:
16.274 + show_all_options = !show_all_options;
16.275 + break;
16.276 }
16.277 }
16.278 }
16.279 @@ -699,19 +632,10 @@
16.280 static void show_help(struct menu *menu)
16.281 {
16.282 struct gstr help = str_new();
16.283 - struct symbol *sym = menu->sym;
16.284
16.285 - if (menu_has_help(menu))
16.286 - {
16.287 - if (sym->name) {
16.288 - str_printf(&help, "CT_%s:\n\n", sym->name);
16.289 - str_append(&help, _(menu_get_help(menu)));
16.290 - str_append(&help, "\n");
16.291 - }
16.292 - } else {
16.293 - str_append(&help, nohelp_text);
16.294 - }
16.295 - get_symbol_str(&help, sym);
16.296 + help.max_width = getmaxx(stdscr) - 10;
16.297 + menu_get_ext_help(menu, &help);
16.298 +
16.299 show_helptext(_(menu_get_prompt(menu)), str_get(&help));
16.300 str_free(&help);
16.301 }
16.302 @@ -732,7 +656,12 @@
16.303 for (child = menu->list; child; child = child->next) {
16.304 if (!menu_is_visible(child))
16.305 continue;
16.306 - item_make("%s", _(menu_get_prompt(child)));
16.307 + if (child->sym)
16.308 + item_make("%s", _(menu_get_prompt(child)));
16.309 + else {
16.310 + item_make("*** %s ***", _(menu_get_prompt(child)));
16.311 + item_set_tag(':');
16.312 + }
16.313 item_set_data(child);
16.314 if (child->sym == active)
16.315 item_set_selected(1);
16.316 @@ -748,6 +677,9 @@
16.317 case 0:
16.318 if (selected) {
16.319 child = item_data();
16.320 + if (!child->sym)
16.321 + break;
16.322 +
16.323 sym_set_tristate_value(child->sym, yes);
16.324 }
16.325 return;
16.326 @@ -880,6 +812,8 @@
16.327 single_menu_mode = 1;
16.328 }
16.329
16.330 + initscr();
16.331 +
16.332 getyx(stdscr, saved_y, saved_x);
16.333 if (init_dialog(NULL)) {
16.334 fprintf(stderr, N_("Your display is too small to run Menuconfig!\n"));
16.335 @@ -894,7 +828,7 @@
16.336 if (conf_get_changed())
16.337 res = dialog_yesno(NULL,
16.338 _("Do you wish to save your "
16.339 - "new " PACKAGE " configuration?\n"
16.340 + "new configuration?\n"
16.341 "<ESC><ESC> to continue."),
16.342 6, 60);
16.343 else
16.344 @@ -906,15 +840,21 @@
16.345 case 0:
16.346 if (conf_write(filename)) {
16.347 fprintf(stderr, _("\n\n"
16.348 - "Error during writing of " PACKAGE " configuration.\n"
16.349 - "Your " PACKAGE " configuration changes were NOT saved."
16.350 + "Error while writing of the configuration.\n"
16.351 + "Your configuration changes were NOT saved."
16.352 "\n\n"));
16.353 return 1;
16.354 }
16.355 case -1:
16.356 + printf(_("\n\n"
16.357 + "*** End of the configuration.\n"
16.358 + "*** Execute 'make' to start the build or try 'make help'."
16.359 + "\n\n"));
16.360 break;
16.361 default:
16.362 - fprintf(stderr, _("Your configuration changes were NOT saved.\n"));
16.363 + fprintf(stderr, _("\n\n"
16.364 + "Your configuration changes were NOT saved."
16.365 + "\n\n"));
16.366 }
16.367
16.368 return 0;
17.1 --- a/kconfig/menu.c Tue May 10 23:56:11 2011 +0200
17.2 +++ b/kconfig/menu.c Sun May 08 14:14:40 2011 +0200
17.3 @@ -9,6 +9,9 @@
17.4 #define LKC_DIRECT_LINK
17.5 #include "lkc.h"
17.6
17.7 +static const char nohelp_text[] = N_(
17.8 + "There is no help available for this option.\n");
17.9 +
17.10 struct menu rootmenu;
17.11 static struct menu **last_entry_ptr;
17.12
17.13 @@ -35,7 +38,7 @@
17.14 va_end(ap);
17.15 }
17.16
17.17 -void menu_init(void)
17.18 +void _menu_init(void)
17.19 {
17.20 current_entry = current_menu = &rootmenu;
17.21 last_entry_ptr = &rootmenu.list;
17.22 @@ -55,6 +58,8 @@
17.23 *last_entry_ptr = menu;
17.24 last_entry_ptr = &menu->next;
17.25 current_entry = menu;
17.26 + if (sym)
17.27 + menu_add_symbol(P_SYMBOL, sym, NULL);
17.28 }
17.29
17.30 void menu_end_entry(void)
17.31 @@ -74,7 +79,7 @@
17.32 current_menu = current_menu->parent;
17.33 }
17.34
17.35 -struct expr *menu_check_dep(struct expr *e)
17.36 +static struct expr *menu_check_dep(struct expr *e)
17.37 {
17.38 if (!e)
17.39 return e;
17.40 @@ -128,19 +133,27 @@
17.41 prop->visible.expr = menu_check_dep(dep);
17.42
17.43 if (prompt) {
17.44 - /* For crostool-NG, a leading pipe followed with spaces
17.45 - * means that pipe shall be removed, and the spaces should
17.46 - * not be trimmed.
17.47 - */
17.48 - if (*prompt == '|')
17.49 - prompt++;
17.50 - else if (isspace(*prompt)) {
17.51 - /* Silently trim leading spaces */
17.52 + if (isspace(*prompt)) {
17.53 + prop_warn(prop, "leading whitespace ignored");
17.54 while (isspace(*prompt))
17.55 prompt++;
17.56 }
17.57 - if (current_entry->prompt)
17.58 + if (current_entry->prompt && current_entry != &rootmenu)
17.59 prop_warn(prop, "prompt redefined");
17.60 +
17.61 + /* Apply all upper menus' visibilities to actual prompts. */
17.62 + if(type == P_PROMPT) {
17.63 + struct menu *menu = current_entry;
17.64 +
17.65 + while ((menu = menu->parent) != NULL) {
17.66 + if (!menu->visibility)
17.67 + continue;
17.68 + prop->visible.expr
17.69 + = expr_alloc_and(prop->visible.expr,
17.70 + menu->visibility);
17.71 + }
17.72 + }
17.73 +
17.74 current_entry->prompt = prop;
17.75 }
17.76 prop->text = prompt;
17.77 @@ -153,6 +166,12 @@
17.78 return menu_add_prop(type, prompt, NULL, dep);
17.79 }
17.80
17.81 +void menu_add_visibility(struct expr *expr)
17.82 +{
17.83 + current_entry->visibility = expr_alloc_and(current_entry->visibility,
17.84 + expr);
17.85 +}
17.86 +
17.87 void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep)
17.88 {
17.89 menu_add_prop(type, NULL, expr, dep);
17.90 @@ -184,13 +203,13 @@
17.91 }
17.92 }
17.93
17.94 -static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2)
17.95 +static int menu_validate_number(struct symbol *sym, struct symbol *sym2)
17.96 {
17.97 return sym2->type == S_INT || sym2->type == S_HEX ||
17.98 (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name));
17.99 }
17.100
17.101 -void sym_check_prop(struct symbol *sym)
17.102 +static void sym_check_prop(struct symbol *sym)
17.103 {
17.104 struct property *prop;
17.105 struct symbol *sym2;
17.106 @@ -200,8 +219,17 @@
17.107 if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) &&
17.108 prop->expr->type != E_SYMBOL)
17.109 prop_warn(prop,
17.110 - "default for config symbol '%'"
17.111 + "default for config symbol '%s'"
17.112 " must be a single symbol", sym->name);
17.113 + if (prop->expr->type != E_SYMBOL)
17.114 + break;
17.115 + sym2 = prop_get_symbol(prop);
17.116 + if (sym->type == S_HEX || sym->type == S_INT) {
17.117 + if (!menu_validate_number(sym, sym2))
17.118 + prop_warn(prop,
17.119 + "'%s': number is invalid",
17.120 + sym->name);
17.121 + }
17.122 break;
17.123 case P_SELECT:
17.124 sym2 = prop_get_symbol(prop);
17.125 @@ -221,8 +249,8 @@
17.126 if (sym->type != S_INT && sym->type != S_HEX)
17.127 prop_warn(prop, "range is only allowed "
17.128 "for int or hex symbols");
17.129 - if (!menu_range_valid_sym(sym, prop->expr->left.sym) ||
17.130 - !menu_range_valid_sym(sym, prop->expr->right.sym))
17.131 + if (!menu_validate_number(sym, prop->expr->left.sym) ||
17.132 + !menu_validate_number(sym, prop->expr->right.sym))
17.133 prop_warn(prop, "range is invalid");
17.134 break;
17.135 default:
17.136 @@ -321,6 +349,8 @@
17.137 parent->next = last_menu->next;
17.138 last_menu->next = NULL;
17.139 }
17.140 +
17.141 + sym->dir_dep.expr = parent->dep;
17.142 }
17.143 for (menu = parent->list; menu; menu = menu->next) {
17.144 if (sym && sym_is_choice(sym) &&
17.145 @@ -393,6 +423,13 @@
17.146 }
17.147 }
17.148
17.149 +bool menu_has_prompt(struct menu *menu)
17.150 +{
17.151 + if (!menu->prompt)
17.152 + return false;
17.153 + return true;
17.154 +}
17.155 +
17.156 bool menu_is_visible(struct menu *menu)
17.157 {
17.158 struct menu *child;
17.159 @@ -401,6 +438,12 @@
17.160
17.161 if (!menu->prompt)
17.162 return false;
17.163 +
17.164 + if (menu->visibility) {
17.165 + if (expr_calc_value(menu->visibility) == no)
17.166 + return no;
17.167 + }
17.168 +
17.169 sym = menu->sym;
17.170 if (sym) {
17.171 sym_calc_value(sym);
17.172 @@ -410,12 +453,18 @@
17.173
17.174 if (visible != no)
17.175 return true;
17.176 +
17.177 if (!sym || sym_get_tristate_value(menu->sym) == no)
17.178 return false;
17.179
17.180 - for (child = menu->list; child; child = child->next)
17.181 - if (menu_is_visible(child))
17.182 + for (child = menu->list; child; child = child->next) {
17.183 + if (menu_is_visible(child)) {
17.184 + if (sym)
17.185 + sym->flags |= SYMBOL_DEF_USER;
17.186 return true;
17.187 + }
17.188 + }
17.189 +
17.190 return false;
17.191 }
17.192
17.193 @@ -457,3 +506,104 @@
17.194 else
17.195 return "";
17.196 }
17.197 +
17.198 +static void get_prompt_str(struct gstr *r, struct property *prop)
17.199 +{
17.200 + int i, j;
17.201 + struct menu *submenu[8], *menu;
17.202 +
17.203 + str_printf(r, _("Prompt: %s\n"), _(prop->text));
17.204 + str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name,
17.205 + prop->menu->lineno);
17.206 + if (!expr_is_yes(prop->visible.expr)) {
17.207 + str_append(r, _(" Depends on: "));
17.208 + expr_gstr_print(prop->visible.expr, r);
17.209 + str_append(r, "\n");
17.210 + }
17.211 + menu = prop->menu->parent;
17.212 + for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent)
17.213 + submenu[i++] = menu;
17.214 + if (i > 0) {
17.215 + str_printf(r, _(" Location:\n"));
17.216 + for (j = 4; --i >= 0; j += 2) {
17.217 + menu = submenu[i];
17.218 + str_printf(r, "%*c-> %s", j, ' ', _(menu_get_prompt(menu)));
17.219 + if (menu->sym) {
17.220 + str_printf(r, " (%s [=%s])", menu->sym->name ?
17.221 + menu->sym->name : _("<choice>"),
17.222 + sym_get_string_value(menu->sym));
17.223 + }
17.224 + str_append(r, "\n");
17.225 + }
17.226 + }
17.227 +}
17.228 +
17.229 +void get_symbol_str(struct gstr *r, struct symbol *sym)
17.230 +{
17.231 + bool hit;
17.232 + struct property *prop;
17.233 +
17.234 + if (sym && sym->name) {
17.235 + str_printf(r, "Symbol: %s [=%s]\n", sym->name,
17.236 + sym_get_string_value(sym));
17.237 + str_printf(r, "Type : %s\n", sym_type_name(sym->type));
17.238 + if (sym->type == S_INT || sym->type == S_HEX) {
17.239 + prop = sym_get_range_prop(sym);
17.240 + if (prop) {
17.241 + str_printf(r, "Range : ");
17.242 + expr_gstr_print(prop->expr, r);
17.243 + str_append(r, "\n");
17.244 + }
17.245 + }
17.246 + }
17.247 + for_all_prompts(sym, prop)
17.248 + get_prompt_str(r, prop);
17.249 + hit = false;
17.250 + for_all_properties(sym, prop, P_SELECT) {
17.251 + if (!hit) {
17.252 + str_append(r, " Selects: ");
17.253 + hit = true;
17.254 + } else
17.255 + str_printf(r, " && ");
17.256 + expr_gstr_print(prop->expr, r);
17.257 + }
17.258 + if (hit)
17.259 + str_append(r, "\n");
17.260 + if (sym->rev_dep.expr) {
17.261 + str_append(r, _(" Selected by: "));
17.262 + expr_gstr_print(sym->rev_dep.expr, r);
17.263 + str_append(r, "\n");
17.264 + }
17.265 + str_append(r, "\n\n");
17.266 +}
17.267 +
17.268 +struct gstr get_relations_str(struct symbol **sym_arr)
17.269 +{
17.270 + struct symbol *sym;
17.271 + struct gstr res = str_new();
17.272 + int i;
17.273 +
17.274 + for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
17.275 + get_symbol_str(&res, sym);
17.276 + if (!i)
17.277 + str_append(&res, _("No matches found.\n"));
17.278 + return res;
17.279 +}
17.280 +
17.281 +
17.282 +void menu_get_ext_help(struct menu *menu, struct gstr *help)
17.283 +{
17.284 + struct symbol *sym = menu->sym;
17.285 +
17.286 + if (menu_has_help(menu)) {
17.287 + if (sym->name) {
17.288 + str_printf(help, "%s%s:\n\n", CONFIG_, sym->name);
17.289 + str_append(help, _(menu_get_help(menu)));
17.290 + str_append(help, "\n");
17.291 + }
17.292 + } else {
17.293 + str_append(help, nohelp_text);
17.294 + }
17.295 + if (sym)
17.296 + get_symbol_str(help, sym);
17.297 +}
18.1 --- a/kconfig/symbol.c Tue May 10 23:56:11 2011 +0200
18.2 +++ b/kconfig/symbol.c Sun May 08 14:14:40 2011 +0200
18.3 @@ -36,7 +36,7 @@
18.4
18.5 struct expr *sym_env_list;
18.6
18.7 -void sym_add_default(struct symbol *sym, const char *def)
18.8 +static void sym_add_default(struct symbol *sym, const char *def)
18.9 {
18.10 struct property *prop = prop_alloc(P_DEFAULT, sym);
18.11
18.12 @@ -48,7 +48,6 @@
18.13 struct symbol *sym;
18.14 struct utsname uts;
18.15 static bool inited = false;
18.16 - char* p;
18.17
18.18 if (inited)
18.19 return;
18.20 @@ -60,13 +59,6 @@
18.21 sym->type = S_STRING;
18.22 sym->flags |= SYMBOL_AUTO;
18.23 sym_add_default(sym, uts.release);
18.24 -
18.25 - sym = sym_lookup("PROJECTVERSION", 0);
18.26 - sym->type = S_STRING;
18.27 - sym->flags |= SYMBOL_AUTO;
18.28 - p = getenv("PROJECTVERSION");
18.29 - if (p)
18.30 - sym_add_default(sym, p);
18.31 }
18.32
18.33 enum symbol_type sym_get_type(struct symbol *sym)
18.34 @@ -133,7 +125,7 @@
18.35 return NULL;
18.36 }
18.37
18.38 -struct property *sym_get_range_prop(struct symbol *sym)
18.39 +static struct property *sym_get_range_prop(struct symbol *sym)
18.40 {
18.41 struct property *prop;
18.42
18.43 @@ -213,6 +205,16 @@
18.44 }
18.45 if (sym_is_choice_value(sym))
18.46 return;
18.47 + /* defaulting to "yes" if no explicit "depends on" are given */
18.48 + tri = yes;
18.49 + if (sym->dir_dep.expr)
18.50 + tri = expr_calc_value(sym->dir_dep.expr);
18.51 + if (tri == mod)
18.52 + tri = yes;
18.53 + if (sym->dir_dep.tri != tri) {
18.54 + sym->dir_dep.tri = tri;
18.55 + sym_set_changed(sym);
18.56 + }
18.57 tri = no;
18.58 if (sym->rev_dep.expr)
18.59 tri = expr_calc_value(sym->rev_dep.expr);
18.60 @@ -224,44 +226,63 @@
18.61 }
18.62 }
18.63
18.64 -static struct symbol *sym_calc_choice(struct symbol *sym)
18.65 +/*
18.66 + * Find the default symbol for a choice.
18.67 + * First try the default values for the choice symbol
18.68 + * Next locate the first visible choice value
18.69 + * Return NULL if none was found
18.70 + */
18.71 +struct symbol *sym_choice_default(struct symbol *sym)
18.72 {
18.73 struct symbol *def_sym;
18.74 struct property *prop;
18.75 struct expr *e;
18.76
18.77 - /* is the user choice visible? */
18.78 - def_sym = sym->def[S_DEF_USER].val;
18.79 - if (def_sym) {
18.80 - sym_calc_visibility(def_sym);
18.81 - if (def_sym->visible != no)
18.82 - return def_sym;
18.83 - }
18.84 -
18.85 /* any of the defaults visible? */
18.86 for_all_defaults(sym, prop) {
18.87 prop->visible.tri = expr_calc_value(prop->visible.expr);
18.88 if (prop->visible.tri == no)
18.89 continue;
18.90 def_sym = prop_get_symbol(prop);
18.91 - sym_calc_visibility(def_sym);
18.92 if (def_sym->visible != no)
18.93 return def_sym;
18.94 }
18.95
18.96 /* just get the first visible value */
18.97 prop = sym_get_choice_prop(sym);
18.98 - expr_list_for_each_sym(prop->expr, e, def_sym) {
18.99 - sym_calc_visibility(def_sym);
18.100 + expr_list_for_each_sym(prop->expr, e, def_sym)
18.101 if (def_sym->visible != no)
18.102 return def_sym;
18.103 - }
18.104
18.105 - /* no choice? reset tristate value */
18.106 - sym->curr.tri = no;
18.107 + /* failed to locate any defaults */
18.108 return NULL;
18.109 }
18.110
18.111 +static struct symbol *sym_calc_choice(struct symbol *sym)
18.112 +{
18.113 + struct symbol *def_sym;
18.114 + struct property *prop;
18.115 + struct expr *e;
18.116 +
18.117 + /* first calculate all choice values' visibilities */
18.118 + prop = sym_get_choice_prop(sym);
18.119 + expr_list_for_each_sym(prop->expr, e, def_sym)
18.120 + sym_calc_visibility(def_sym);
18.121 +
18.122 + /* is the user choice visible? */
18.123 + def_sym = sym->def[S_DEF_USER].val;
18.124 + if (def_sym && def_sym->visible != no)
18.125 + return def_sym;
18.126 +
18.127 + def_sym = sym_choice_default(sym);
18.128 +
18.129 + if (def_sym == NULL)
18.130 + /* no choice? reset tristate value */
18.131 + sym->curr.tri = no;
18.132 +
18.133 + return def_sym;
18.134 +}
18.135 +
18.136 void sym_calc_value(struct symbol *sym)
18.137 {
18.138 struct symbol_value newval, oldval;
18.139 @@ -329,6 +350,18 @@
18.140 }
18.141 }
18.142 calc_newval:
18.143 + if (sym->dir_dep.tri == no && sym->rev_dep.tri != no) {
18.144 + struct expr *e;
18.145 + e = expr_simplify_unmet_dep(sym->rev_dep.expr,
18.146 + sym->dir_dep.expr);
18.147 + fprintf(stderr, "warning: (");
18.148 + expr_fprint(e, stderr);
18.149 + fprintf(stderr, ") selects %s which has unmet direct dependencies (",
18.150 + sym->name);
18.151 + expr_fprint(sym->dir_dep.expr, stderr);
18.152 + fprintf(stderr, ")\n");
18.153 + expr_free(e);
18.154 + }
18.155 newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri);
18.156 }
18.157 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN)
18.158 @@ -373,12 +406,13 @@
18.159
18.160 if (sym_is_choice(sym)) {
18.161 struct symbol *choice_sym;
18.162 - int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
18.163
18.164 prop = sym_get_choice_prop(sym);
18.165 expr_list_for_each_sym(prop->expr, e, choice_sym) {
18.166 - choice_sym->flags |= flags;
18.167 - if (flags & SYMBOL_CHANGED)
18.168 + if ((sym->flags & SYMBOL_WRITE) &&
18.169 + choice_sym->visible != no)
18.170 + choice_sym->flags |= SYMBOL_WRITE;
18.171 + if (sym->flags & SYMBOL_CHANGED)
18.172 sym_set_changed(choice_sym);
18.173 }
18.174 }
18.175 @@ -631,6 +665,80 @@
18.176 return true;
18.177 }
18.178
18.179 +/*
18.180 + * Find the default value associated to a symbol.
18.181 + * For tristate symbol handle the modules=n case
18.182 + * in which case "m" becomes "y".
18.183 + * If the symbol does not have any default then fallback
18.184 + * to the fixed default values.
18.185 + */
18.186 +const char *sym_get_string_default(struct symbol *sym)
18.187 +{
18.188 + struct property *prop;
18.189 + struct symbol *ds;
18.190 + const char *str;
18.191 + tristate val;
18.192 +
18.193 + sym_calc_visibility(sym);
18.194 + sym_calc_value(modules_sym);
18.195 + val = symbol_no.curr.tri;
18.196 + str = symbol_empty.curr.val;
18.197 +
18.198 + /* If symbol has a default value look it up */
18.199 + prop = sym_get_default_prop(sym);
18.200 + if (prop != NULL) {
18.201 + switch (sym->type) {
18.202 + case S_BOOLEAN:
18.203 + case S_TRISTATE:
18.204 + /* The visibility may limit the value from yes => mod */
18.205 + val = EXPR_AND(expr_calc_value(prop->expr), prop->visible.tri);
18.206 + break;
18.207 + default:
18.208 + /*
18.209 + * The following fails to handle the situation
18.210 + * where a default value is further limited by
18.211 + * the valid range.
18.212 + */
18.213 + ds = prop_get_symbol(prop);
18.214 + if (ds != NULL) {
18.215 + sym_calc_value(ds);
18.216 + str = (const char *)ds->curr.val;
18.217 + }
18.218 + }
18.219 + }
18.220 +
18.221 + /* Handle select statements */
18.222 + val = EXPR_OR(val, sym->rev_dep.tri);
18.223 +
18.224 + /* transpose mod to yes if modules are not enabled */
18.225 + if (val == mod)
18.226 + if (!sym_is_choice_value(sym) && modules_sym->curr.tri == no)
18.227 + val = yes;
18.228 +
18.229 + /* transpose mod to yes if type is bool */
18.230 + if (sym->type == S_BOOLEAN && val == mod)
18.231 + val = yes;
18.232 +
18.233 + switch (sym->type) {
18.234 + case S_BOOLEAN:
18.235 + case S_TRISTATE:
18.236 + switch (val) {
18.237 + case no: return "n";
18.238 + case mod: return "m";
18.239 + case yes: return "y";
18.240 + }
18.241 + case S_INT:
18.242 + case S_HEX:
18.243 + return str;
18.244 + case S_STRING:
18.245 + return str;
18.246 + case S_OTHER:
18.247 + case S_UNKNOWN:
18.248 + break;
18.249 + }
18.250 + return "";
18.251 +}
18.252 +
18.253 const char *sym_get_string_value(struct symbol *sym)
18.254 {
18.255 tristate val;
18.256 @@ -659,12 +767,20 @@
18.257 return sym->visible > sym->rev_dep.tri;
18.258 }
18.259
18.260 +static unsigned strhash(const char *s)
18.261 +{
18.262 + /* fnv32 hash */
18.263 + unsigned hash = 2166136261U;
18.264 + for (; *s; s++)
18.265 + hash = (hash ^ *s) * 0x01000193;
18.266 + return hash;
18.267 +}
18.268 +
18.269 struct symbol *sym_lookup(const char *name, int flags)
18.270 {
18.271 struct symbol *symbol;
18.272 - const char *ptr;
18.273 char *new_name;
18.274 - int hash = 0;
18.275 + int hash;
18.276
18.277 if (name) {
18.278 if (name[0] && !name[1]) {
18.279 @@ -674,12 +790,11 @@
18.280 case 'n': return &symbol_no;
18.281 }
18.282 }
18.283 - for (ptr = name; *ptr; ptr++)
18.284 - hash += *ptr;
18.285 - hash &= 0xff;
18.286 + hash = strhash(name) % SYMBOL_HASHSIZE;
18.287
18.288 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
18.289 - if (!strcmp(symbol->name, name) &&
18.290 + if (symbol->name &&
18.291 + !strcmp(symbol->name, name) &&
18.292 (flags ? symbol->flags & flags
18.293 : !(symbol->flags & (SYMBOL_CONST|SYMBOL_CHOICE))))
18.294 return symbol;
18.295 @@ -687,7 +802,7 @@
18.296 new_name = strdup(name);
18.297 } else {
18.298 new_name = NULL;
18.299 - hash = 256;
18.300 + hash = 0;
18.301 }
18.302
18.303 symbol = malloc(sizeof(*symbol));
18.304 @@ -705,7 +820,6 @@
18.305 struct symbol *sym_find(const char *name)
18.306 {
18.307 struct symbol *symbol = NULL;
18.308 - const char *ptr;
18.309 int hash = 0;
18.310
18.311 if (!name)
18.312 @@ -718,12 +832,11 @@
18.313 case 'n': return &symbol_no;
18.314 }
18.315 }
18.316 - for (ptr = name; *ptr; ptr++)
18.317 - hash += *ptr;
18.318 - hash &= 0xff;
18.319 + hash = strhash(name) % SYMBOL_HASHSIZE;
18.320
18.321 for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) {
18.322 - if (!strcmp(symbol->name, name) &&
18.323 + if (symbol->name &&
18.324 + !strcmp(symbol->name, name) &&
18.325 !(symbol->flags & SYMBOL_CONST))
18.326 break;
18.327 }
18.328 @@ -731,6 +844,55 @@
18.329 return symbol;
18.330 }
18.331
18.332 +/*
18.333 + * Expand symbol's names embedded in the string given in argument. Symbols'
18.334 + * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to
18.335 + * the empty string.
18.336 + */
18.337 +const char *sym_expand_string_value(const char *in)
18.338 +{
18.339 + const char *src;
18.340 + char *res;
18.341 + size_t reslen;
18.342 +
18.343 + reslen = strlen(in) + 1;
18.344 + res = malloc(reslen);
18.345 + res[0] = '\0';
18.346 +
18.347 + while ((src = strchr(in, '$'))) {
18.348 + char *p, name[SYMBOL_MAXLENGTH];
18.349 + const char *symval = "";
18.350 + struct symbol *sym;
18.351 + size_t newlen;
18.352 +
18.353 + strncat(res, in, src - in);
18.354 + src++;
18.355 +
18.356 + p = name;
18.357 + while (isalnum(*src) || *src == '_')
18.358 + *p++ = *src++;
18.359 + *p = '\0';
18.360 +
18.361 + sym = sym_find(name);
18.362 + if (sym != NULL) {
18.363 + sym_calc_value(sym);
18.364 + symval = sym_get_string_value(sym);
18.365 + }
18.366 +
18.367 + newlen = strlen(res) + strlen(symval) + strlen(src) + 1;
18.368 + if (newlen > reslen) {
18.369 + reslen = newlen;
18.370 + res = realloc(res, reslen);
18.371 + }
18.372 +
18.373 + strcat(res, symval);
18.374 + in = src;
18.375 + }
18.376 + strcat(res, in);
18.377 +
18.378 + return res;
18.379 +}
18.380 +
18.381 struct symbol **sym_re_search(const char *pattern)
18.382 {
18.383 struct symbol *sym, **sym_arr = NULL;
18.384 @@ -758,6 +920,7 @@
18.385 return NULL;
18.386 }
18.387 }
18.388 + sym_calc_value(sym);
18.389 sym_arr[cnt++] = sym;
18.390 }
18.391 if (sym_arr)
18.392 @@ -767,6 +930,112 @@
18.393 return sym_arr;
18.394 }
18.395
18.396 +/*
18.397 + * When we check for recursive dependencies we use a stack to save
18.398 + * current state so we can print out relevant info to user.
18.399 + * The entries are located on the call stack so no need to free memory.
18.400 + * Note inser() remove() must always match to properly clear the stack.
18.401 + */
18.402 +static struct dep_stack {
18.403 + struct dep_stack *prev, *next;
18.404 + struct symbol *sym;
18.405 + struct property *prop;
18.406 + struct expr *expr;
18.407 +} *check_top;
18.408 +
18.409 +static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym)
18.410 +{
18.411 + memset(stack, 0, sizeof(*stack));
18.412 + if (check_top)
18.413 + check_top->next = stack;
18.414 + stack->prev = check_top;
18.415 + stack->sym = sym;
18.416 + check_top = stack;
18.417 +}
18.418 +
18.419 +static void dep_stack_remove(void)
18.420 +{
18.421 + check_top = check_top->prev;
18.422 + if (check_top)
18.423 + check_top->next = NULL;
18.424 +}
18.425 +
18.426 +/*
18.427 + * Called when we have detected a recursive dependency.
18.428 + * check_top point to the top of the stact so we use
18.429 + * the ->prev pointer to locate the bottom of the stack.
18.430 + */
18.431 +static void sym_check_print_recursive(struct symbol *last_sym)
18.432 +{
18.433 + struct dep_stack *stack;
18.434 + struct symbol *sym, *next_sym;
18.435 + struct menu *menu = NULL;
18.436 + struct property *prop;
18.437 + struct dep_stack cv_stack;
18.438 +
18.439 + if (sym_is_choice_value(last_sym)) {
18.440 + dep_stack_insert(&cv_stack, last_sym);
18.441 + last_sym = prop_get_symbol(sym_get_choice_prop(last_sym));
18.442 + }
18.443 +
18.444 + for (stack = check_top; stack != NULL; stack = stack->prev)
18.445 + if (stack->sym == last_sym)
18.446 + break;
18.447 + if (!stack) {
18.448 + fprintf(stderr, "unexpected recursive dependency error\n");
18.449 + return;
18.450 + }
18.451 +
18.452 + for (; stack; stack = stack->next) {
18.453 + sym = stack->sym;
18.454 + next_sym = stack->next ? stack->next->sym : last_sym;
18.455 + prop = stack->prop;
18.456 + if (prop == NULL)
18.457 + prop = stack->sym->prop;
18.458 +
18.459 + /* for choice values find the menu entry (used below) */
18.460 + if (sym_is_choice(sym) || sym_is_choice_value(sym)) {
18.461 + for (prop = sym->prop; prop; prop = prop->next) {
18.462 + menu = prop->menu;
18.463 + if (prop->menu)
18.464 + break;
18.465 + }
18.466 + }
18.467 + if (stack->sym == last_sym)
18.468 + fprintf(stderr, "%s:%d:error: recursive dependency detected!\n",
18.469 + prop->file->name, prop->lineno);
18.470 + if (stack->expr) {
18.471 + fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n",
18.472 + prop->file->name, prop->lineno,
18.473 + sym->name ? sym->name : "<choice>",
18.474 + prop_get_type_name(prop->type),
18.475 + next_sym->name ? next_sym->name : "<choice>");
18.476 + } else if (stack->prop) {
18.477 + fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n",
18.478 + prop->file->name, prop->lineno,
18.479 + sym->name ? sym->name : "<choice>",
18.480 + next_sym->name ? next_sym->name : "<choice>");
18.481 + } else if (sym_is_choice(sym)) {
18.482 + fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n",
18.483 + menu->file->name, menu->lineno,
18.484 + sym->name ? sym->name : "<choice>",
18.485 + next_sym->name ? next_sym->name : "<choice>");
18.486 + } else if (sym_is_choice_value(sym)) {
18.487 + fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n",
18.488 + menu->file->name, menu->lineno,
18.489 + sym->name ? sym->name : "<choice>",
18.490 + next_sym->name ? next_sym->name : "<choice>");
18.491 + } else {
18.492 + fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n",
18.493 + prop->file->name, prop->lineno,
18.494 + sym->name ? sym->name : "<choice>",
18.495 + next_sym->name ? next_sym->name : "<choice>");
18.496 + }
18.497 + }
18.498 +
18.499 + if (check_top == &cv_stack)
18.500 + dep_stack_remove();
18.501 +}
18.502
18.503 static struct symbol *sym_check_expr_deps(struct expr *e)
18.504 {
18.505 @@ -803,24 +1072,33 @@
18.506 {
18.507 struct symbol *sym2;
18.508 struct property *prop;
18.509 + struct dep_stack stack;
18.510 +
18.511 + dep_stack_insert(&stack, sym);
18.512
18.513 sym2 = sym_check_expr_deps(sym->rev_dep.expr);
18.514 if (sym2)
18.515 - return sym2;
18.516 + goto out;
18.517
18.518 for (prop = sym->prop; prop; prop = prop->next) {
18.519 if (prop->type == P_CHOICE || prop->type == P_SELECT)
18.520 continue;
18.521 + stack.prop = prop;
18.522 sym2 = sym_check_expr_deps(prop->visible.expr);
18.523 if (sym2)
18.524 break;
18.525 if (prop->type != P_DEFAULT || sym_is_choice(sym))
18.526 continue;
18.527 + stack.expr = prop->expr;
18.528 sym2 = sym_check_expr_deps(prop->expr);
18.529 if (sym2)
18.530 break;
18.531 + stack.expr = NULL;
18.532 }
18.533
18.534 +out:
18.535 + dep_stack_remove();
18.536 +
18.537 return sym2;
18.538 }
18.539
18.540 @@ -829,6 +1107,9 @@
18.541 struct symbol *sym, *sym2;
18.542 struct property *prop;
18.543 struct expr *e;
18.544 + struct dep_stack stack;
18.545 +
18.546 + dep_stack_insert(&stack, choice);
18.547
18.548 prop = sym_get_choice_prop(choice);
18.549 expr_list_for_each_sym(prop->expr, e, sym)
18.550 @@ -842,10 +1123,8 @@
18.551
18.552 expr_list_for_each_sym(prop->expr, e, sym) {
18.553 sym2 = sym_check_sym_deps(sym);
18.554 - if (sym2) {
18.555 - fprintf(stderr, " -> %s", sym->name);
18.556 + if (sym2)
18.557 break;
18.558 - }
18.559 }
18.560 out:
18.561 expr_list_for_each_sym(prop->expr, e, sym)
18.562 @@ -855,6 +1134,8 @@
18.563 prop_get_symbol(sym_get_choice_prop(sym2)) == choice)
18.564 sym2 = choice;
18.565
18.566 + dep_stack_remove();
18.567 +
18.568 return sym2;
18.569 }
18.570
18.571 @@ -864,18 +1145,20 @@
18.572 struct property *prop;
18.573
18.574 if (sym->flags & SYMBOL_CHECK) {
18.575 - fprintf(stderr, "%s:%d:error: found recursive dependency: %s",
18.576 - sym->prop->file->name, sym->prop->lineno,
18.577 - sym->name ? sym->name : "<choice>");
18.578 + sym_check_print_recursive(sym);
18.579 return sym;
18.580 }
18.581 if (sym->flags & SYMBOL_CHECKED)
18.582 return NULL;
18.583
18.584 if (sym_is_choice_value(sym)) {
18.585 + struct dep_stack stack;
18.586 +
18.587 /* for choice groups start the check with main choice symbol */
18.588 + dep_stack_insert(&stack, sym);
18.589 prop = sym_get_choice_prop(sym);
18.590 sym2 = sym_check_deps(prop_get_symbol(prop));
18.591 + dep_stack_remove();
18.592 } else if (sym_is_choice(sym)) {
18.593 sym2 = sym_check_choice_deps(sym);
18.594 } else {
18.595 @@ -884,14 +1167,8 @@
18.596 sym->flags &= ~SYMBOL_CHECK;
18.597 }
18.598
18.599 - if (sym2) {
18.600 - fprintf(stderr, " -> %s", sym->name ? sym->name : "<choice>");
18.601 - if (sym2 == sym) {
18.602 - fprintf(stderr, "\n");
18.603 - zconfnerrs++;
18.604 - sym2 = NULL;
18.605 - }
18.606 - }
18.607 + if (sym2 && sym2 == sym)
18.608 + sym2 = NULL;
18.609
18.610 return sym2;
18.611 }
18.612 @@ -945,13 +1222,15 @@
18.613 return "select";
18.614 case P_RANGE:
18.615 return "range";
18.616 + case P_SYMBOL:
18.617 + return "symbol";
18.618 case P_UNKNOWN:
18.619 break;
18.620 }
18.621 return "unknown";
18.622 }
18.623
18.624 -void prop_add_env(const char *env)
18.625 +static void prop_add_env(const char *env)
18.626 {
18.627 struct symbol *sym, *sym2;
18.628 struct property *prop;
18.629 @@ -976,4 +1255,6 @@
18.630 p = getenv(env);
18.631 if (p)
18.632 sym_add_default(sym, p);
18.633 + else
18.634 + menu_warn(current_entry, "environment variable %s undefined", env);
18.635 }
19.1 --- a/kconfig/util.c Tue May 10 23:56:11 2011 +0200
19.2 +++ b/kconfig/util.c Sun May 08 14:14:40 2011 +0200
19.3 @@ -12,15 +12,18 @@
19.4 struct file *file_lookup(const char *name)
19.5 {
19.6 struct file *file;
19.7 + const char *file_name = sym_expand_string_value(name);
19.8
19.9 for (file = file_list; file; file = file->next) {
19.10 - if (!strcmp(name, file->name))
19.11 + if (!strcmp(name, file->name)) {
19.12 + free((void *)file_name);
19.13 return file;
19.14 + }
19.15 }
19.16
19.17 file = malloc(sizeof(*file));
19.18 memset(file, 0, sizeof(*file));
19.19 - file->name = strdup(name);
19.20 + file->name = file_name;
19.21 file->next = file_list;
19.22 file_list = file;
19.23 return file;
19.24 @@ -46,8 +49,8 @@
19.25 else
19.26 fprintf(out, "\t%s\n", file->name);
19.27 }
19.28 - fprintf(out, "\ninclude/config/auto.conf: \\\n"
19.29 - "\t$(deps_config)\n\n");
19.30 + fprintf(out, "\n%s: \\\n"
19.31 + "\t$(deps_config)\n\n", conf_get_autoconfig_name());
19.32
19.33 expr_list_for_each_sym(sym_env_list, e, sym) {
19.34 struct property *prop;
19.35 @@ -61,7 +64,7 @@
19.36 if (!value)
19.37 value = "";
19.38 fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value);
19.39 - fprintf(out, "include/config/auto.conf: FORCE\n");
19.40 + fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name());
19.41 fprintf(out, "endif\n");
19.42 }
19.43
19.44 @@ -72,12 +75,13 @@
19.45 }
19.46
19.47
19.48 -/* Allocate initial growable sting */
19.49 +/* Allocate initial growable string */
19.50 struct gstr str_new(void)
19.51 {
19.52 struct gstr gs;
19.53 gs.s = malloc(sizeof(char) * 64);
19.54 gs.len = 64;
19.55 + gs.max_width = 0;
19.56 strcpy(gs.s, "\0");
19.57 return gs;
19.58 }
19.59 @@ -88,6 +92,7 @@
19.60 struct gstr gs;
19.61 gs.s = strdup(s);
19.62 gs.len = strlen(s) + 1;
19.63 + gs.max_width = 0;
19.64 return gs;
19.65 }
19.66
20.1 --- a/kconfig/zconf.hash.c Tue May 10 23:56:11 2011 +0200
20.2 +++ b/kconfig/zconf.hash.c Sun May 08 14:14:40 2011 +0200
20.3 @@ -30,7 +30,9 @@
20.4 #endif
20.5
20.6 struct kconf_id;
20.7 -/* maximum key range = 47, duplicates = 0 */
20.8 +
20.9 +static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len);
20.10 +/* maximum key range = 50, duplicates = 0 */
20.11
20.12 #ifdef __GNUC__
20.13 __inline
20.14 @@ -44,32 +46,32 @@
20.15 {
20.16 static unsigned char asso_values[] =
20.17 {
20.18 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.19 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.20 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.21 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.22 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.23 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.24 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.25 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.26 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.27 - 49, 49, 49, 49, 49, 49, 49, 49, 11, 5,
20.28 - 0, 0, 5, 49, 5, 20, 49, 49, 5, 20,
20.29 - 5, 0, 30, 49, 0, 15, 0, 10, 0, 49,
20.30 - 25, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.31 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.32 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.33 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.34 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.35 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.36 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.37 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.38 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.39 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.40 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.41 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.42 - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
20.43 - 49, 49, 49, 49, 49, 49
20.44 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.45 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.46 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.47 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.48 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.49 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.50 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.51 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.52 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.53 + 52, 52, 52, 52, 52, 52, 52, 52, 40, 5,
20.54 + 0, 0, 5, 52, 0, 20, 52, 52, 10, 20,
20.55 + 5, 0, 35, 52, 0, 30, 0, 15, 0, 52,
20.56 + 15, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.57 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.58 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.59 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.60 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.61 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.62 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.63 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.64 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.65 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.66 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.67 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.68 + 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
20.69 + 52, 52, 52, 52, 52, 52
20.70 };
20.71 register int hval = len;
20.72
20.73 @@ -100,25 +102,26 @@
20.74 char kconf_id_strings_str12[sizeof("default")];
20.75 char kconf_id_strings_str13[sizeof("def_bool")];
20.76 char kconf_id_strings_str14[sizeof("help")];
20.77 - char kconf_id_strings_str15[sizeof("bool")];
20.78 char kconf_id_strings_str16[sizeof("config")];
20.79 char kconf_id_strings_str17[sizeof("def_tristate")];
20.80 - char kconf_id_strings_str18[sizeof("boolean")];
20.81 + char kconf_id_strings_str18[sizeof("hex")];
20.82 char kconf_id_strings_str19[sizeof("defconfig_list")];
20.83 - char kconf_id_strings_str21[sizeof("string")];
20.84 char kconf_id_strings_str22[sizeof("if")];
20.85 char kconf_id_strings_str23[sizeof("int")];
20.86 - char kconf_id_strings_str26[sizeof("select")];
20.87 char kconf_id_strings_str27[sizeof("modules")];
20.88 char kconf_id_strings_str28[sizeof("tristate")];
20.89 char kconf_id_strings_str29[sizeof("menu")];
20.90 - char kconf_id_strings_str31[sizeof("source")];
20.91 char kconf_id_strings_str32[sizeof("comment")];
20.92 - char kconf_id_strings_str33[sizeof("hex")];
20.93 char kconf_id_strings_str35[sizeof("menuconfig")];
20.94 - char kconf_id_strings_str36[sizeof("prompt")];
20.95 - char kconf_id_strings_str37[sizeof("depends")];
20.96 + char kconf_id_strings_str36[sizeof("string")];
20.97 + char kconf_id_strings_str37[sizeof("visible")];
20.98 + char kconf_id_strings_str41[sizeof("prompt")];
20.99 + char kconf_id_strings_str42[sizeof("depends")];
20.100 + char kconf_id_strings_str44[sizeof("bool")];
20.101 + char kconf_id_strings_str46[sizeof("select")];
20.102 + char kconf_id_strings_str47[sizeof("boolean")];
20.103 char kconf_id_strings_str48[sizeof("mainmenu")];
20.104 + char kconf_id_strings_str51[sizeof("source")];
20.105 };
20.106 static struct kconf_id_strings_t kconf_id_strings_contents =
20.107 {
20.108 @@ -134,25 +137,26 @@
20.109 "default",
20.110 "def_bool",
20.111 "help",
20.112 - "bool",
20.113 "config",
20.114 "def_tristate",
20.115 - "boolean",
20.116 + "hex",
20.117 "defconfig_list",
20.118 - "string",
20.119 "if",
20.120 "int",
20.121 - "select",
20.122 "modules",
20.123 "tristate",
20.124 "menu",
20.125 - "source",
20.126 "comment",
20.127 - "hex",
20.128 "menuconfig",
20.129 + "string",
20.130 + "visible",
20.131 "prompt",
20.132 "depends",
20.133 - "mainmenu"
20.134 + "bool",
20.135 + "select",
20.136 + "boolean",
20.137 + "mainmenu",
20.138 + "source"
20.139 };
20.140 #define kconf_id_strings ((const char *) &kconf_id_strings_contents)
20.141 #ifdef __GNUC__
20.142 @@ -166,11 +170,11 @@
20.143 {
20.144 enum
20.145 {
20.146 - TOTAL_KEYWORDS = 31,
20.147 + TOTAL_KEYWORDS = 32,
20.148 MIN_WORD_LENGTH = 2,
20.149 MAX_WORD_LENGTH = 14,
20.150 MIN_HASH_VALUE = 2,
20.151 - MAX_HASH_VALUE = 48
20.152 + MAX_HASH_VALUE = 51
20.153 };
20.154
20.155 static struct kconf_id wordlist[] =
20.156 @@ -189,31 +193,35 @@
20.157 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str12, T_DEFAULT, TF_COMMAND, S_UNKNOWN},
20.158 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str13, T_DEFAULT, TF_COMMAND, S_BOOLEAN},
20.159 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str14, T_HELP, TF_COMMAND},
20.160 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str15, T_TYPE, TF_COMMAND, S_BOOLEAN},
20.161 + {-1},
20.162 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str16, T_CONFIG, TF_COMMAND},
20.163 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str17, T_DEFAULT, TF_COMMAND, S_TRISTATE},
20.164 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_BOOLEAN},
20.165 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str18, T_TYPE, TF_COMMAND, S_HEX},
20.166 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str19, T_OPT_DEFCONFIG_LIST,TF_OPTION},
20.167 - {-1},
20.168 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str21, T_TYPE, TF_COMMAND, S_STRING},
20.169 + {-1}, {-1},
20.170 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str22, T_IF, TF_COMMAND|TF_PARAM},
20.171 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str23, T_TYPE, TF_COMMAND, S_INT},
20.172 - {-1}, {-1},
20.173 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str26, T_SELECT, TF_COMMAND},
20.174 + {-1}, {-1}, {-1},
20.175 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str27, T_OPT_MODULES, TF_OPTION},
20.176 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str28, T_TYPE, TF_COMMAND, S_TRISTATE},
20.177 {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str29, T_MENU, TF_COMMAND},
20.178 + {-1}, {-1},
20.179 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
20.180 + {-1}, {-1},
20.181 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
20.182 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_TYPE, TF_COMMAND, S_STRING},
20.183 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_VISIBLE, TF_COMMAND},
20.184 + {-1}, {-1}, {-1},
20.185 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str41, T_PROMPT, TF_COMMAND},
20.186 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str42, T_DEPENDS, TF_COMMAND},
20.187 {-1},
20.188 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str31, T_SOURCE, TF_COMMAND},
20.189 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str32, T_COMMENT, TF_COMMAND},
20.190 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str33, T_TYPE, TF_COMMAND, S_HEX},
20.191 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str44, T_TYPE, TF_COMMAND, S_BOOLEAN},
20.192 {-1},
20.193 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str35, T_MENUCONFIG, TF_COMMAND},
20.194 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str36, T_PROMPT, TF_COMMAND},
20.195 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str37, T_DEPENDS, TF_COMMAND},
20.196 - {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1}, {-1},
20.197 - {-1},
20.198 - {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND}
20.199 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str46, T_SELECT, TF_COMMAND},
20.200 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str47, T_TYPE, TF_COMMAND, S_BOOLEAN},
20.201 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str48, T_MAINMENU, TF_COMMAND},
20.202 + {-1}, {-1},
20.203 + {(int)(long)&((struct kconf_id_strings_t *)0)->kconf_id_strings_str51, T_SOURCE, TF_COMMAND}
20.204 };
20.205
20.206 if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
21.1 --- a/kconfig/zconf.tab.c Tue May 10 23:56:11 2011 +0200
21.2 +++ b/kconfig/zconf.tab.c Sun May 08 14:14:40 2011 +0200
21.3 @@ -1,24 +1,23 @@
21.4 -/* A Bison parser, made by GNU Bison 2.3. */
21.5 +
21.6 +/* A Bison parser, made by GNU Bison 2.4.1. */
21.7
21.8 /* Skeleton implementation for Bison's Yacc-like parsers in C
21.9 -
21.10 - Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
21.11 +
21.12 + Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
21.13 Free Software Foundation, Inc.
21.14 -
21.15 - This program is free software; you can redistribute it and/or modify
21.16 +
21.17 + This program is free software: you can redistribute it and/or modify
21.18 it under the terms of the GNU General Public License as published by
21.19 - the Free Software Foundation; either version 2, or (at your option)
21.20 - any later version.
21.21 -
21.22 + the Free Software Foundation, either version 3 of the License, or
21.23 + (at your option) any later version.
21.24 +
21.25 This program is distributed in the hope that it will be useful,
21.26 but WITHOUT ANY WARRANTY; without even the implied warranty of
21.27 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21.28 GNU General Public License for more details.
21.29 -
21.30 +
21.31 You should have received a copy of the GNU General Public License
21.32 - along with this program; if not, write to the Free Software
21.33 - Foundation, Inc., 51 Franklin Street, Fifth Floor,
21.34 - Boston, MA 02110-1301, USA. */
21.35 + along with this program. If not, see <http://www.gnu.org/licenses/>. */
21.36
21.37 /* As a special exception, you may create a larger work that contains
21.38 part or all of the Bison parser skeleton and distribute that work
21.39 @@ -29,7 +28,7 @@
21.40 special exception, which will cause the skeleton and the resulting
21.41 Bison output files to be licensed under the GNU General Public
21.42 License without this special exception.
21.43 -
21.44 +
21.45 This special exception was added by the Free Software Foundation in
21.46 version 2.2 of Bison. */
21.47
21.48 @@ -47,7 +46,7 @@
21.49 #define YYBISON 1
21.50
21.51 /* Bison version. */
21.52 -#define YYBISON_VERSION "2.3"
21.53 +#define YYBISON_VERSION "2.4.1"
21.54
21.55 /* Skeleton name. */
21.56 #define YYSKELETON_NAME "yacc.c"
21.57 @@ -55,17 +54,84 @@
21.58 /* Pure parsers. */
21.59 #define YYPURE 0
21.60
21.61 +/* Push parsers. */
21.62 +#define YYPUSH 0
21.63 +
21.64 +/* Pull parsers. */
21.65 +#define YYPULL 1
21.66 +
21.67 /* Using locations. */
21.68 #define YYLSP_NEEDED 0
21.69
21.70 /* Substitute the variable and function names. */
21.71 -#define yyparse zconfparse
21.72 -#define yylex zconflex
21.73 -#define yyerror zconferror
21.74 -#define yylval zconflval
21.75 -#define yychar zconfchar
21.76 -#define yydebug zconfdebug
21.77 -#define yynerrs zconfnerrs
21.78 +#define yyparse zconfparse
21.79 +#define yylex zconflex
21.80 +#define yyerror zconferror
21.81 +#define yylval zconflval
21.82 +#define yychar zconfchar
21.83 +#define yydebug zconfdebug
21.84 +#define yynerrs zconfnerrs
21.85 +
21.86 +
21.87 +/* Copy the first part of user declarations. */
21.88 +
21.89 +
21.90 +/*
21.91 + * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
21.92 + * Released under the terms of the GNU GPL v2.0.
21.93 + */
21.94 +
21.95 +#include <ctype.h>
21.96 +#include <stdarg.h>
21.97 +#include <stdio.h>
21.98 +#include <stdlib.h>
21.99 +#include <string.h>
21.100 +#include <stdbool.h>
21.101 +
21.102 +#define LKC_DIRECT_LINK
21.103 +#include "lkc.h"
21.104 +
21.105 +#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
21.106 +
21.107 +#define PRINTD 0x0001
21.108 +#define DEBUG_PARSE 0x0002
21.109 +
21.110 +int cdebug = PRINTD;
21.111 +
21.112 +extern int zconflex(void);
21.113 +static void zconfprint(const char *err, ...);
21.114 +static void zconf_error(const char *err, ...);
21.115 +static void zconferror(const char *err);
21.116 +static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
21.117 +
21.118 +struct symbol *symbol_hash[SYMBOL_HASHSIZE];
21.119 +
21.120 +static struct menu *current_menu, *current_entry;
21.121 +
21.122 +#define YYDEBUG 0
21.123 +#if YYDEBUG
21.124 +#define YYERROR_VERBOSE
21.125 +#endif
21.126 +
21.127 +
21.128 +
21.129 +/* Enabling traces. */
21.130 +#ifndef YYDEBUG
21.131 +# define YYDEBUG 0
21.132 +#endif
21.133 +
21.134 +/* Enabling verbose error messages. */
21.135 +#ifdef YYERROR_VERBOSE
21.136 +# undef YYERROR_VERBOSE
21.137 +# define YYERROR_VERBOSE 1
21.138 +#else
21.139 +# define YYERROR_VERBOSE 0
21.140 +#endif
21.141 +
21.142 +/* Enabling the token table. */
21.143 +#ifndef YYTOKEN_TABLE
21.144 +# define YYTOKEN_TABLE 0
21.145 +#endif
21.146
21.147
21.148 /* Tokens. */
21.149 @@ -94,143 +160,51 @@
21.150 T_DEFAULT = 275,
21.151 T_SELECT = 276,
21.152 T_RANGE = 277,
21.153 - T_OPTION = 278,
21.154 - T_ON = 279,
21.155 - T_WORD = 280,
21.156 - T_WORD_QUOTE = 281,
21.157 - T_UNEQUAL = 282,
21.158 - T_CLOSE_PAREN = 283,
21.159 - T_OPEN_PAREN = 284,
21.160 - T_EOL = 285,
21.161 - T_OR = 286,
21.162 - T_AND = 287,
21.163 - T_EQUAL = 288,
21.164 - T_NOT = 289
21.165 + T_VISIBLE = 278,
21.166 + T_OPTION = 279,
21.167 + T_ON = 280,
21.168 + T_WORD = 281,
21.169 + T_WORD_QUOTE = 282,
21.170 + T_UNEQUAL = 283,
21.171 + T_CLOSE_PAREN = 284,
21.172 + T_OPEN_PAREN = 285,
21.173 + T_EOL = 286,
21.174 + T_OR = 287,
21.175 + T_AND = 288,
21.176 + T_EQUAL = 289,
21.177 + T_NOT = 290
21.178 };
21.179 #endif
21.180 -/* Tokens. */
21.181 -#define T_MAINMENU 258
21.182 -#define T_MENU 259
21.183 -#define T_ENDMENU 260
21.184 -#define T_SOURCE 261
21.185 -#define T_CHOICE 262
21.186 -#define T_ENDCHOICE 263
21.187 -#define T_COMMENT 264
21.188 -#define T_CONFIG 265
21.189 -#define T_MENUCONFIG 266
21.190 -#define T_HELP 267
21.191 -#define T_HELPTEXT 268
21.192 -#define T_IF 269
21.193 -#define T_ENDIF 270
21.194 -#define T_DEPENDS 271
21.195 -#define T_OPTIONAL 272
21.196 -#define T_PROMPT 273
21.197 -#define T_TYPE 274
21.198 -#define T_DEFAULT 275
21.199 -#define T_SELECT 276
21.200 -#define T_RANGE 277
21.201 -#define T_OPTION 278
21.202 -#define T_ON 279
21.203 -#define T_WORD 280
21.204 -#define T_WORD_QUOTE 281
21.205 -#define T_UNEQUAL 282
21.206 -#define T_CLOSE_PAREN 283
21.207 -#define T_OPEN_PAREN 284
21.208 -#define T_EOL 285
21.209 -#define T_OR 286
21.210 -#define T_AND 287
21.211 -#define T_EQUAL 288
21.212 -#define T_NOT 289
21.213
21.214
21.215
21.216 -
21.217 -/* Copy the first part of user declarations. */
21.218 -
21.219 -
21.220 -/*
21.221 - * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
21.222 - * Released under the terms of the GNU GPL v2.0.
21.223 - */
21.224 -
21.225 -#include <ctype.h>
21.226 -#include <stdarg.h>
21.227 -#include <stdio.h>
21.228 -#include <stdlib.h>
21.229 -#include <string.h>
21.230 -#include <stdbool.h>
21.231 -
21.232 -#define LKC_DIRECT_LINK
21.233 -#include "lkc.h"
21.234 -
21.235 -#include "zconf.hash.c"
21.236 -
21.237 -#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
21.238 -
21.239 -#define PRINTD 0x0001
21.240 -#define DEBUG_PARSE 0x0002
21.241 -
21.242 -int cdebug = PRINTD;
21.243 -
21.244 -extern int zconflex(void);
21.245 -static void zconfprint(const char *err, ...);
21.246 -static void zconf_error(const char *err, ...);
21.247 -static void zconferror(const char *err);
21.248 -static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
21.249 -
21.250 -struct symbol *symbol_hash[257];
21.251 -
21.252 -static struct menu *current_menu, *current_entry;
21.253 -
21.254 -#define YYDEBUG 0
21.255 -#if YYDEBUG
21.256 -#define YYERROR_VERBOSE
21.257 -#endif
21.258 -
21.259 -
21.260 -/* Enabling traces. */
21.261 -#ifndef YYDEBUG
21.262 -# define YYDEBUG 0
21.263 -#endif
21.264 -
21.265 -/* Enabling verbose error messages. */
21.266 -#ifdef YYERROR_VERBOSE
21.267 -# undef YYERROR_VERBOSE
21.268 -# define YYERROR_VERBOSE 1
21.269 -#else
21.270 -# define YYERROR_VERBOSE 0
21.271 -#endif
21.272 -
21.273 -/* Enabling the token table. */
21.274 -#ifndef YYTOKEN_TABLE
21.275 -# define YYTOKEN_TABLE 0
21.276 -#endif
21.277 -
21.278 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
21.279 typedef union YYSTYPE
21.280 +{
21.281
21.282 -{
21.283 +
21.284 char *string;
21.285 struct file *file;
21.286 struct symbol *symbol;
21.287 struct expr *expr;
21.288 struct menu *menu;
21.289 struct kconf_id *id;
21.290 -}
21.291 -/* Line 187 of yacc.c. */
21.292
21.293 - YYSTYPE;
21.294 +
21.295 +
21.296 +} YYSTYPE;
21.297 +# define YYSTYPE_IS_TRIVIAL 1
21.298 # define yystype YYSTYPE /* obsolescent; will be withdrawn */
21.299 # define YYSTYPE_IS_DECLARED 1
21.300 -# define YYSTYPE_IS_TRIVIAL 1
21.301 #endif
21.302
21.303
21.304 -
21.305 /* Copy the second part of user declarations. */
21.306
21.307
21.308 -/* Line 216 of yacc.c. */
21.309 +/* Include zconf.hash.c here so it can see the token constants. */
21.310 +#include "zconf.hash.c"
21.311 +
21.312
21.313
21.314 #ifdef short
21.315 @@ -306,14 +280,14 @@
21.316 #if (defined __STDC__ || defined __C99__FUNC__ \
21.317 || defined __cplusplus || defined _MSC_VER)
21.318 static int
21.319 -YYID (int i)
21.320 +YYID (int yyi)
21.321 #else
21.322 static int
21.323 -YYID (i)
21.324 - int i;
21.325 +YYID (yyi)
21.326 + int yyi;
21.327 #endif
21.328 {
21.329 - return i;
21.330 + return yyi;
21.331 }
21.332 #endif
21.333
21.334 @@ -394,9 +368,9 @@
21.335 /* A type that is properly aligned for any stack member. */
21.336 union yyalloc
21.337 {
21.338 - yytype_int16 yyss;
21.339 - YYSTYPE yyvs;
21.340 - };
21.341 + yytype_int16 yyss_alloc;
21.342 + YYSTYPE yyvs_alloc;
21.343 +};
21.344
21.345 /* The size of the maximum gap between one aligned stack and the next. */
21.346 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
21.347 @@ -430,12 +404,12 @@
21.348 elements in the stack, and YYPTR gives the new location of the
21.349 stack. Advance YYPTR to a properly aligned location for the next
21.350 stack. */
21.351 -# define YYSTACK_RELOCATE(Stack) \
21.352 +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
21.353 do \
21.354 { \
21.355 YYSIZE_T yynewbytes; \
21.356 - YYCOPY (&yyptr->Stack, Stack, yysize); \
21.357 - Stack = &yyptr->Stack; \
21.358 + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
21.359 + Stack = &yyptr->Stack_alloc; \
21.360 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
21.361 yyptr += yynewbytes / sizeof (*yyptr); \
21.362 } \
21.363 @@ -444,22 +418,22 @@
21.364 #endif
21.365
21.366 /* YYFINAL -- State number of the termination state. */
21.367 -#define YYFINAL 3
21.368 +#define YYFINAL 11
21.369 /* YYLAST -- Last index in YYTABLE. */
21.370 -#define YYLAST 259
21.371 +#define YYLAST 290
21.372
21.373 /* YYNTOKENS -- Number of terminals. */
21.374 -#define YYNTOKENS 35
21.375 +#define YYNTOKENS 36
21.376 /* YYNNTS -- Number of nonterminals. */
21.377 -#define YYNNTS 46
21.378 +#define YYNNTS 50
21.379 /* YYNRULES -- Number of rules. */
21.380 -#define YYNRULES 110
21.381 +#define YYNRULES 118
21.382 /* YYNRULES -- Number of states. */
21.383 -#define YYNSTATES 180
21.384 +#define YYNSTATES 191
21.385
21.386 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
21.387 #define YYUNDEFTOK 2
21.388 -#define YYMAXUTOK 289
21.389 +#define YYMAXUTOK 290
21.390
21.391 #define YYTRANSLATE(YYX) \
21.392 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
21.393 @@ -495,7 +469,8 @@
21.394 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
21.395 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
21.396 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
21.397 - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34
21.398 + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
21.399 + 35
21.400 };
21.401
21.402 #if YYDEBUG
21.403 @@ -503,73 +478,75 @@
21.404 YYRHS. */
21.405 static const yytype_uint16 yyprhs[] =
21.406 {
21.407 - 0, 0, 3, 5, 6, 9, 12, 15, 20, 23,
21.408 - 28, 33, 37, 39, 41, 43, 45, 47, 49, 51,
21.409 - 53, 55, 57, 59, 61, 63, 67, 70, 74, 77,
21.410 - 81, 84, 85, 88, 91, 94, 97, 100, 103, 107,
21.411 - 112, 117, 122, 128, 132, 133, 137, 138, 141, 145,
21.412 - 148, 150, 154, 155, 158, 161, 164, 167, 170, 175,
21.413 - 179, 182, 187, 188, 191, 195, 197, 201, 202, 205,
21.414 - 208, 211, 215, 218, 220, 224, 225, 228, 231, 234,
21.415 - 238, 242, 245, 248, 251, 252, 255, 258, 261, 266,
21.416 - 267, 270, 272, 274, 277, 280, 283, 285, 288, 289,
21.417 - 292, 294, 298, 302, 306, 309, 313, 317, 319, 321,
21.418 - 322
21.419 + 0, 0, 3, 6, 8, 11, 13, 14, 17, 20,
21.420 + 23, 26, 31, 36, 40, 42, 44, 46, 48, 50,
21.421 + 52, 54, 56, 58, 60, 62, 64, 66, 68, 72,
21.422 + 75, 79, 82, 86, 89, 90, 93, 96, 99, 102,
21.423 + 105, 108, 112, 117, 122, 127, 133, 137, 138, 142,
21.424 + 143, 146, 150, 153, 155, 159, 160, 163, 166, 169,
21.425 + 172, 175, 180, 184, 187, 192, 193, 196, 200, 202,
21.426 + 206, 207, 210, 213, 216, 220, 224, 228, 230, 234,
21.427 + 235, 238, 241, 244, 248, 252, 255, 258, 261, 262,
21.428 + 265, 268, 271, 276, 277, 280, 283, 286, 287, 290,
21.429 + 292, 294, 297, 300, 303, 305, 308, 309, 312, 314,
21.430 + 318, 322, 326, 329, 333, 337, 339, 341, 342
21.431 };
21.432
21.433 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
21.434 static const yytype_int8 yyrhs[] =
21.435 {
21.436 - 36, 0, -1, 37, -1, -1, 37, 39, -1, 37,
21.437 - 53, -1, 37, 64, -1, 37, 3, 74, 76, -1,
21.438 - 37, 75, -1, 37, 25, 1, 30, -1, 37, 38,
21.439 - 1, 30, -1, 37, 1, 30, -1, 16, -1, 18,
21.440 - -1, 19, -1, 21, -1, 17, -1, 22, -1, 20,
21.441 - -1, 30, -1, 59, -1, 68, -1, 42, -1, 44,
21.442 - -1, 66, -1, 25, 1, 30, -1, 1, 30, -1,
21.443 - 10, 25, 30, -1, 41, 45, -1, 11, 25, 30,
21.444 - -1, 43, 45, -1, -1, 45, 46, -1, 45, 47,
21.445 - -1, 45, 72, -1, 45, 70, -1, 45, 40, -1,
21.446 - 45, 30, -1, 19, 73, 30, -1, 18, 74, 77,
21.447 - 30, -1, 20, 78, 77, 30, -1, 21, 25, 77,
21.448 - 30, -1, 22, 79, 79, 77, 30, -1, 23, 48,
21.449 - 30, -1, -1, 48, 25, 49, -1, -1, 33, 74,
21.450 - -1, 7, 80, 30, -1, 50, 54, -1, 75, -1,
21.451 - 51, 56, 52, -1, -1, 54, 55, -1, 54, 72,
21.452 - -1, 54, 70, -1, 54, 30, -1, 54, 40, -1,
21.453 - 18, 74, 77, 30, -1, 19, 73, 30, -1, 17,
21.454 - 30, -1, 20, 25, 77, 30, -1, -1, 56, 39,
21.455 - -1, 14, 78, 76, -1, 75, -1, 57, 60, 58,
21.456 - -1, -1, 60, 39, -1, 60, 64, -1, 60, 53,
21.457 - -1, 4, 74, 30, -1, 61, 71, -1, 75, -1,
21.458 - 62, 65, 63, -1, -1, 65, 39, -1, 65, 64,
21.459 - -1, 65, 53, -1, 6, 74, 30, -1, 9, 74,
21.460 - 30, -1, 67, 71, -1, 12, 30, -1, 69, 13,
21.461 - -1, -1, 71, 72, -1, 71, 30, -1, 71, 40,
21.462 - -1, 16, 24, 78, 30, -1, -1, 74, 77, -1,
21.463 - 25, -1, 26, -1, 5, 30, -1, 8, 30, -1,
21.464 - 15, 30, -1, 30, -1, 76, 30, -1, -1, 14,
21.465 - 78, -1, 79, -1, 79, 33, 79, -1, 79, 27,
21.466 - 79, -1, 29, 78, 28, -1, 34, 78, -1, 78,
21.467 - 31, 78, -1, 78, 32, 78, -1, 25, -1, 26,
21.468 - -1, -1, 25, -1
21.469 + 37, 0, -1, 81, 38, -1, 38, -1, 63, 39,
21.470 + -1, 39, -1, -1, 39, 41, -1, 39, 55, -1,
21.471 + 39, 67, -1, 39, 80, -1, 39, 26, 1, 31,
21.472 + -1, 39, 40, 1, 31, -1, 39, 1, 31, -1,
21.473 + 16, -1, 18, -1, 19, -1, 21, -1, 17, -1,
21.474 + 22, -1, 20, -1, 23, -1, 31, -1, 61, -1,
21.475 + 71, -1, 44, -1, 46, -1, 69, -1, 26, 1,
21.476 + 31, -1, 1, 31, -1, 10, 26, 31, -1, 43,
21.477 + 47, -1, 11, 26, 31, -1, 45, 47, -1, -1,
21.478 + 47, 48, -1, 47, 49, -1, 47, 75, -1, 47,
21.479 + 73, -1, 47, 42, -1, 47, 31, -1, 19, 78,
21.480 + 31, -1, 18, 79, 82, 31, -1, 20, 83, 82,
21.481 + 31, -1, 21, 26, 82, 31, -1, 22, 84, 84,
21.482 + 82, 31, -1, 24, 50, 31, -1, -1, 50, 26,
21.483 + 51, -1, -1, 34, 79, -1, 7, 85, 31, -1,
21.484 + 52, 56, -1, 80, -1, 53, 58, 54, -1, -1,
21.485 + 56, 57, -1, 56, 75, -1, 56, 73, -1, 56,
21.486 + 31, -1, 56, 42, -1, 18, 79, 82, 31, -1,
21.487 + 19, 78, 31, -1, 17, 31, -1, 20, 26, 82,
21.488 + 31, -1, -1, 58, 41, -1, 14, 83, 81, -1,
21.489 + 80, -1, 59, 62, 60, -1, -1, 62, 41, -1,
21.490 + 62, 67, -1, 62, 55, -1, 3, 79, 81, -1,
21.491 + 4, 79, 31, -1, 64, 76, 74, -1, 80, -1,
21.492 + 65, 68, 66, -1, -1, 68, 41, -1, 68, 67,
21.493 + -1, 68, 55, -1, 6, 79, 31, -1, 9, 79,
21.494 + 31, -1, 70, 74, -1, 12, 31, -1, 72, 13,
21.495 + -1, -1, 74, 75, -1, 74, 31, -1, 74, 42,
21.496 + -1, 16, 25, 83, 31, -1, -1, 76, 77, -1,
21.497 + 76, 31, -1, 23, 82, -1, -1, 79, 82, -1,
21.498 + 26, -1, 27, -1, 5, 31, -1, 8, 31, -1,
21.499 + 15, 31, -1, 31, -1, 81, 31, -1, -1, 14,
21.500 + 83, -1, 84, -1, 84, 34, 84, -1, 84, 28,
21.501 + 84, -1, 30, 83, 29, -1, 35, 83, -1, 83,
21.502 + 32, 83, -1, 83, 33, 83, -1, 26, -1, 27,
21.503 + -1, -1, 26, -1
21.504 };
21.505
21.506 /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
21.507 static const yytype_uint16 yyrline[] =
21.508 {
21.509 - 0, 104, 104, 106, 108, 109, 110, 111, 112, 113,
21.510 - 114, 118, 122, 122, 122, 122, 122, 122, 122, 126,
21.511 - 127, 128, 129, 130, 131, 135, 136, 142, 150, 156,
21.512 - 164, 174, 176, 177, 178, 179, 180, 181, 184, 192,
21.513 - 198, 208, 214, 220, 223, 225, 236, 237, 242, 251,
21.514 - 256, 264, 267, 269, 270, 271, 272, 273, 276, 282,
21.515 - 293, 299, 309, 311, 316, 324, 332, 335, 337, 338,
21.516 - 339, 344, 351, 356, 364, 367, 369, 370, 371, 374,
21.517 - 382, 389, 396, 402, 409, 411, 412, 413, 416, 424,
21.518 - 426, 431, 432, 435, 436, 437, 441, 442, 445, 446,
21.519 - 449, 450, 451, 452, 453, 454, 455, 458, 459, 462,
21.520 - 463
21.521 + 0, 108, 108, 108, 110, 110, 112, 114, 115, 116,
21.522 + 117, 118, 119, 123, 127, 127, 127, 127, 127, 127,
21.523 + 127, 127, 131, 132, 133, 134, 135, 136, 140, 141,
21.524 + 147, 155, 161, 169, 179, 181, 182, 183, 184, 185,
21.525 + 186, 189, 197, 203, 213, 219, 225, 228, 230, 241,
21.526 + 242, 247, 256, 261, 269, 272, 274, 275, 276, 277,
21.527 + 278, 281, 287, 298, 304, 314, 316, 321, 329, 337,
21.528 + 340, 342, 343, 344, 349, 356, 363, 368, 376, 379,
21.529 + 381, 382, 383, 386, 394, 401, 408, 414, 421, 423,
21.530 + 424, 425, 428, 436, 438, 439, 442, 449, 451, 456,
21.531 + 457, 460, 461, 462, 466, 467, 470, 471, 474, 475,
21.532 + 476, 477, 478, 479, 480, 483, 484, 487, 488
21.533 };
21.534 #endif
21.535
21.536 @@ -582,19 +559,19 @@
21.537 "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG",
21.538 "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS",
21.539 "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_RANGE",
21.540 - "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
21.541 + "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", "T_UNEQUAL",
21.542 "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL",
21.543 - "T_NOT", "$accept", "input", "stmt_list", "option_name", "common_stmt",
21.544 - "option_error", "config_entry_start", "config_stmt",
21.545 + "T_NOT", "$accept", "input", "start", "stmt_list", "option_name",
21.546 + "common_stmt", "option_error", "config_entry_start", "config_stmt",
21.547 "menuconfig_entry_start", "menuconfig_stmt", "config_option_list",
21.548 "config_option", "symbol_option", "symbol_option_list",
21.549 "symbol_option_arg", "choice", "choice_entry", "choice_end",
21.550 "choice_stmt", "choice_option_list", "choice_option", "choice_block",
21.551 - "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry",
21.552 - "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment",
21.553 - "comment_stmt", "help_start", "help", "depends_list", "depends",
21.554 - "prompt_stmt_opt", "prompt", "end", "nl", "if_expr", "expr", "symbol",
21.555 - "word_opt", 0
21.556 + "if_entry", "if_end", "if_stmt", "if_block", "mainmenu_stmt", "menu",
21.557 + "menu_entry", "menu_end", "menu_stmt", "menu_block", "source_stmt",
21.558 + "comment", "comment_stmt", "help_start", "help", "depends_list",
21.559 + "depends", "visibility_list", "visible", "prompt_stmt_opt", "prompt",
21.560 + "end", "nl", "if_expr", "expr", "symbol", "word_opt", 0
21.561 };
21.562 #endif
21.563
21.564 @@ -606,42 +583,42 @@
21.565 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
21.566 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
21.567 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
21.568 - 285, 286, 287, 288, 289
21.569 + 285, 286, 287, 288, 289, 290
21.570 };
21.571 # endif
21.572
21.573 /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
21.574 static const yytype_uint8 yyr1[] =
21.575 {
21.576 - 0, 35, 36, 37, 37, 37, 37, 37, 37, 37,
21.577 - 37, 37, 38, 38, 38, 38, 38, 38, 38, 39,
21.578 - 39, 39, 39, 39, 39, 40, 40, 41, 42, 43,
21.579 - 44, 45, 45, 45, 45, 45, 45, 45, 46, 46,
21.580 - 46, 46, 46, 47, 48, 48, 49, 49, 50, 51,
21.581 - 52, 53, 54, 54, 54, 54, 54, 54, 55, 55,
21.582 - 55, 55, 56, 56, 57, 58, 59, 60, 60, 60,
21.583 - 60, 61, 62, 63, 64, 65, 65, 65, 65, 66,
21.584 - 67, 68, 69, 70, 71, 71, 71, 71, 72, 73,
21.585 - 73, 74, 74, 75, 75, 75, 76, 76, 77, 77,
21.586 - 78, 78, 78, 78, 78, 78, 78, 79, 79, 80,
21.587 - 80
21.588 + 0, 36, 37, 37, 38, 38, 39, 39, 39, 39,
21.589 + 39, 39, 39, 39, 40, 40, 40, 40, 40, 40,
21.590 + 40, 40, 41, 41, 41, 41, 41, 41, 42, 42,
21.591 + 43, 44, 45, 46, 47, 47, 47, 47, 47, 47,
21.592 + 47, 48, 48, 48, 48, 48, 49, 50, 50, 51,
21.593 + 51, 52, 53, 54, 55, 56, 56, 56, 56, 56,
21.594 + 56, 57, 57, 57, 57, 58, 58, 59, 60, 61,
21.595 + 62, 62, 62, 62, 63, 64, 65, 66, 67, 68,
21.596 + 68, 68, 68, 69, 70, 71, 72, 73, 74, 74,
21.597 + 74, 74, 75, 76, 76, 76, 77, 78, 78, 79,
21.598 + 79, 80, 80, 80, 81, 81, 82, 82, 83, 83,
21.599 + 83, 83, 83, 83, 83, 84, 84, 85, 85
21.600 };
21.601
21.602 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
21.603 static const yytype_uint8 yyr2[] =
21.604 {
21.605 - 0, 2, 1, 0, 2, 2, 2, 4, 2, 4,
21.606 - 4, 3, 1, 1, 1, 1, 1, 1, 1, 1,
21.607 - 1, 1, 1, 1, 1, 3, 2, 3, 2, 3,
21.608 - 2, 0, 2, 2, 2, 2, 2, 2, 3, 4,
21.609 - 4, 4, 5, 3, 0, 3, 0, 2, 3, 2,
21.610 - 1, 3, 0, 2, 2, 2, 2, 2, 4, 3,
21.611 - 2, 4, 0, 2, 3, 1, 3, 0, 2, 2,
21.612 - 2, 3, 2, 1, 3, 0, 2, 2, 2, 3,
21.613 - 3, 2, 2, 2, 0, 2, 2, 2, 4, 0,
21.614 - 2, 1, 1, 2, 2, 2, 1, 2, 0, 2,
21.615 - 1, 3, 3, 3, 2, 3, 3, 1, 1, 0,
21.616 - 1
21.617 + 0, 2, 2, 1, 2, 1, 0, 2, 2, 2,
21.618 + 2, 4, 4, 3, 1, 1, 1, 1, 1, 1,
21.619 + 1, 1, 1, 1, 1, 1, 1, 1, 3, 2,
21.620 + 3, 2, 3, 2, 0, 2, 2, 2, 2, 2,
21.621 + 2, 3, 4, 4, 4, 5, 3, 0, 3, 0,
21.622 + 2, 3, 2, 1, 3, 0, 2, 2, 2, 2,
21.623 + 2, 4, 3, 2, 4, 0, 2, 3, 1, 3,
21.624 + 0, 2, 2, 2, 3, 3, 3, 1, 3, 0,
21.625 + 2, 2, 2, 3, 3, 2, 2, 2, 0, 2,
21.626 + 2, 2, 4, 0, 2, 2, 2, 0, 2, 1,
21.627 + 1, 2, 2, 2, 1, 2, 0, 2, 1, 3,
21.628 + 3, 3, 2, 3, 3, 1, 1, 0, 1
21.629 };
21.630
21.631 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
21.632 @@ -649,158 +626,172 @@
21.633 means the default is an error. */
21.634 static const yytype_uint8 yydefact[] =
21.635 {
21.636 - 3, 0, 0, 1, 0, 0, 0, 0, 0, 109,
21.637 - 0, 0, 0, 0, 0, 0, 12, 16, 13, 14,
21.638 - 18, 15, 17, 0, 19, 0, 4, 31, 22, 31,
21.639 - 23, 52, 62, 5, 67, 20, 84, 75, 6, 24,
21.640 - 84, 21, 8, 11, 91, 92, 0, 0, 93, 0,
21.641 - 110, 0, 94, 0, 0, 0, 107, 108, 0, 0,
21.642 - 0, 100, 95, 0, 0, 0, 0, 0, 0, 0,
21.643 - 0, 0, 0, 96, 7, 71, 79, 48, 80, 27,
21.644 - 29, 0, 104, 0, 0, 64, 0, 0, 9, 10,
21.645 - 0, 0, 0, 0, 89, 0, 0, 0, 44, 0,
21.646 - 37, 36, 32, 33, 0, 35, 34, 0, 0, 89,
21.647 - 0, 56, 57, 53, 55, 54, 63, 51, 50, 68,
21.648 - 70, 66, 69, 65, 86, 87, 85, 76, 78, 74,
21.649 - 77, 73, 97, 103, 105, 106, 102, 101, 26, 82,
21.650 - 0, 98, 0, 98, 98, 98, 0, 0, 0, 83,
21.651 - 60, 98, 0, 98, 0, 0, 0, 38, 90, 0,
21.652 - 0, 98, 46, 43, 25, 0, 59, 0, 88, 99,
21.653 - 39, 40, 41, 0, 0, 45, 58, 61, 42, 47
21.654 + 6, 0, 104, 0, 3, 0, 6, 6, 99, 100,
21.655 + 0, 1, 0, 0, 0, 0, 117, 0, 0, 0,
21.656 + 0, 0, 0, 14, 18, 15, 16, 20, 17, 19,
21.657 + 21, 0, 22, 0, 7, 34, 25, 34, 26, 55,
21.658 + 65, 8, 70, 23, 93, 79, 9, 27, 88, 24,
21.659 + 10, 0, 105, 2, 74, 13, 0, 101, 0, 118,
21.660 + 0, 102, 0, 0, 0, 115, 116, 0, 0, 0,
21.661 + 108, 103, 0, 0, 0, 0, 0, 0, 0, 88,
21.662 + 0, 0, 75, 83, 51, 84, 30, 32, 0, 112,
21.663 + 0, 0, 67, 0, 0, 11, 12, 0, 0, 0,
21.664 + 0, 97, 0, 0, 0, 47, 0, 40, 39, 35,
21.665 + 36, 0, 38, 37, 0, 0, 97, 0, 59, 60,
21.666 + 56, 58, 57, 66, 54, 53, 71, 73, 69, 72,
21.667 + 68, 106, 95, 0, 94, 80, 82, 78, 81, 77,
21.668 + 90, 91, 89, 111, 113, 114, 110, 109, 29, 86,
21.669 + 0, 106, 0, 106, 106, 106, 0, 0, 0, 87,
21.670 + 63, 106, 0, 106, 0, 96, 0, 0, 41, 98,
21.671 + 0, 0, 106, 49, 46, 28, 0, 62, 0, 107,
21.672 + 92, 42, 43, 44, 0, 0, 48, 61, 64, 45,
21.673 + 50
21.674 };
21.675
21.676 /* YYDEFGOTO[NTERM-NUM]. */
21.677 static const yytype_int16 yydefgoto[] =
21.678 {
21.679 - -1, 1, 2, 25, 26, 101, 27, 28, 29, 30,
21.680 - 65, 102, 103, 147, 175, 31, 32, 117, 33, 67,
21.681 - 113, 68, 34, 121, 35, 69, 36, 37, 129, 38,
21.682 - 71, 39, 40, 41, 104, 105, 70, 106, 142, 143,
21.683 - 42, 74, 156, 60, 61, 51
21.684 + -1, 3, 4, 5, 33, 34, 108, 35, 36, 37,
21.685 + 38, 74, 109, 110, 157, 186, 39, 40, 124, 41,
21.686 + 76, 120, 77, 42, 128, 43, 78, 6, 44, 45,
21.687 + 137, 46, 80, 47, 48, 49, 111, 112, 81, 113,
21.688 + 79, 134, 152, 153, 50, 7, 165, 69, 70, 60
21.689 };
21.690
21.691 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
21.692 STATE-NUM. */
21.693 -#define YYPACT_NINF -80
21.694 +#define YYPACT_NINF -90
21.695 static const yytype_int16 yypact[] =
21.696 {
21.697 - -80, 2, 132, -80, -13, -1, -1, -2, -1, 9,
21.698 - 33, -1, 27, 40, -3, 38, -80, -80, -80, -80,
21.699 - -80, -80, -80, 71, -80, 77, -80, -80, -80, -80,
21.700 - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
21.701 - -80, -80, -80, -80, -80, -80, 57, 61, -80, 63,
21.702 - -80, 76, -80, 87, 101, 133, -80, -80, -3, -3,
21.703 - 195, -6, -80, 136, 149, 39, 104, 65, 150, 5,
21.704 - 194, 5, 167, -80, 176, -80, -80, -80, -80, -80,
21.705 - -80, 68, -80, -3, -3, 176, 72, 72, -80, -80,
21.706 - 177, 187, 78, -1, -1, -3, 196, 72, -80, 222,
21.707 - -80, -80, -80, -80, 221, -80, -80, 205, -1, -1,
21.708 - 211, -80, -80, -80, -80, -80, -80, -80, -80, -80,
21.709 - -80, -80, -80, -80, -80, -80, -80, -80, -80, -80,
21.710 - -80, -80, -80, -80, 206, -80, -80, -80, -80, -80,
21.711 - -3, 223, 209, 223, 197, 223, 72, 7, 210, -80,
21.712 - -80, 223, 212, 223, 201, -3, 213, -80, -80, 214,
21.713 - 215, 223, 208, -80, -80, 216, -80, 217, -80, 113,
21.714 - -80, -80, -80, 218, -1, -80, -80, -80, -80, -80
21.715 + 4, 42, -90, 96, -90, 111, -90, 15, -90, -90,
21.716 + 75, -90, 82, 42, 104, 42, 110, 107, 42, 115,
21.717 + 125, -4, 121, -90, -90, -90, -90, -90, -90, -90,
21.718 + -90, 162, -90, 163, -90, -90, -90, -90, -90, -90,
21.719 + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
21.720 + -90, 139, -90, -90, 138, -90, 142, -90, 143, -90,
21.721 + 152, -90, 164, 167, 168, -90, -90, -4, -4, 77,
21.722 + -18, -90, 177, 185, 33, 71, 195, 247, 236, -2,
21.723 + 236, 171, -90, -90, -90, -90, -90, -90, 41, -90,
21.724 + -4, -4, 138, 97, 97, -90, -90, 186, 187, 194,
21.725 + 42, 42, -4, 196, 97, -90, 219, -90, -90, -90,
21.726 + -90, 210, -90, -90, 204, 42, 42, 199, -90, -90,
21.727 + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
21.728 + -90, 222, -90, 223, -90, -90, -90, -90, -90, -90,
21.729 + -90, -90, -90, -90, 215, -90, -90, -90, -90, -90,
21.730 + -4, 222, 228, 222, -5, 222, 97, 35, 229, -90,
21.731 + -90, 222, 232, 222, -4, -90, 135, 233, -90, -90,
21.732 + 234, 235, 222, 240, -90, -90, 237, -90, 239, -13,
21.733 + -90, -90, -90, -90, 244, 42, -90, -90, -90, -90,
21.734 + -90
21.735 };
21.736
21.737 /* YYPGOTO[NTERM-NUM]. */
21.738 static const yytype_int16 yypgoto[] =
21.739 {
21.740 - -80, -80, -80, -80, 122, -34, -80, -80, -80, -80,
21.741 - 220, -80, -80, -80, -80, -80, -80, -80, 59, -80,
21.742 - -80, -80, -80, -80, -80, -80, -80, -80, -80, 125,
21.743 - -80, -80, -80, -80, -80, 183, 219, 22, 142, -5,
21.744 - 147, 192, 69, -54, -79, -80
21.745 + -90, -90, 269, 271, -90, 23, -70, -90, -90, -90,
21.746 + -90, 243, -90, -90, -90, -90, -90, -90, -90, -48,
21.747 + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90,
21.748 + -90, -20, -90, -90, -90, -90, -90, 206, 205, -68,
21.749 + -90, -90, 169, -1, 27, -7, 118, -66, -89, -90
21.750 };
21.751
21.752 /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
21.753 positive, shift that token. If negative, reduce the rule which
21.754 number is the opposite. If zero, do what YYDEFACT says.
21.755 If YYTABLE_NINF, syntax error. */
21.756 -#define YYTABLE_NINF -82
21.757 +#define YYTABLE_NINF -86
21.758 static const yytype_int16 yytable[] =
21.759 {
21.760 - 46, 47, 3, 49, 81, 82, 53, 136, 137, 6,
21.761 - 7, 8, 9, 10, 11, 12, 13, 43, 146, 14,
21.762 - 15, 86, 56, 57, 44, 45, 58, 87, 48, 134,
21.763 - 135, 59, 162, 112, 50, 24, 125, 163, 125, -28,
21.764 - 90, 144, -28, -28, -28, -28, -28, -28, -28, -28,
21.765 - -28, 91, 54, -28, -28, 92, -28, 93, 94, 95,
21.766 - 96, 97, 98, 52, 99, 55, 90, 161, 62, 100,
21.767 - -49, -49, 63, -49, -49, -49, -49, 91, 64, -49,
21.768 - -49, 92, 107, 108, 109, 110, 154, 73, 141, 115,
21.769 - 99, 75, 126, 76, 126, 111, 133, 56, 57, 83,
21.770 - 84, 169, 140, 151, -30, 90, 77, -30, -30, -30,
21.771 - -30, -30, -30, -30, -30, -30, 91, 78, -30, -30,
21.772 - 92, -30, 93, 94, 95, 96, 97, 98, 120, 99,
21.773 - 128, 79, -2, 4, 100, 5, 6, 7, 8, 9,
21.774 - 10, 11, 12, 13, 83, 84, 14, 15, 16, 17,
21.775 - 18, 19, 20, 21, 22, 7, 8, 23, 10, 11,
21.776 - 12, 13, 24, 80, 14, 15, 88, -81, 90, 179,
21.777 - -81, -81, -81, -81, -81, -81, -81, -81, -81, 89,
21.778 - 24, -81, -81, 92, -81, -81, -81, -81, -81, -81,
21.779 - 116, 119, 99, 127, 122, 90, 130, 124, -72, -72,
21.780 - -72, -72, -72, -72, -72, -72, 132, 138, -72, -72,
21.781 - 92, 155, 158, 159, 160, 118, 123, 139, 131, 99,
21.782 - 165, 145, 167, 148, 124, 73, 83, 84, 83, 84,
21.783 - 173, 168, 83, 84, 149, 150, 153, 155, 84, 157,
21.784 - 164, 174, 166, 170, 171, 172, 176, 177, 178, 66,
21.785 - 114, 152, 85, 0, 0, 0, 0, 0, 0, 72
21.786 + 10, 88, 89, 54, 146, 147, 119, 1, 122, 164,
21.787 + 93, 141, 56, 142, 58, 156, 94, 62, 1, 90,
21.788 + 91, 131, 65, 66, 144, 145, 67, 90, 91, 132,
21.789 + 127, 68, 136, -31, 97, 2, 154, -31, -31, -31,
21.790 + -31, -31, -31, -31, -31, 98, 52, -31, -31, 99,
21.791 + -31, 100, 101, 102, 103, 104, -31, 105, 129, 106,
21.792 + 138, 173, 92, 141, 107, 142, 174, 172, 8, 9,
21.793 + 143, -33, 97, 90, 91, -33, -33, -33, -33, -33,
21.794 + -33, -33, -33, 98, 166, -33, -33, 99, -33, 100,
21.795 + 101, 102, 103, 104, -33, 105, 11, 106, 179, 151,
21.796 + 123, 126, 107, 135, 125, 130, 2, 139, 2, 90,
21.797 + 91, -5, 12, 55, 161, 13, 14, 15, 16, 17,
21.798 + 18, 19, 20, 65, 66, 21, 22, 23, 24, 25,
21.799 + 26, 27, 28, 29, 30, 57, 59, 31, 61, -4,
21.800 + 12, 63, 32, 13, 14, 15, 16, 17, 18, 19,
21.801 + 20, 64, 71, 21, 22, 23, 24, 25, 26, 27,
21.802 + 28, 29, 30, 72, 73, 31, 180, 90, 91, 52,
21.803 + 32, -85, 97, 82, 83, -85, -85, -85, -85, -85,
21.804 + -85, -85, -85, 84, 190, -85, -85, 99, -85, -85,
21.805 + -85, -85, -85, -85, -85, 85, 97, 106, 86, 87,
21.806 + -52, -52, 140, -52, -52, -52, -52, 98, 95, -52,
21.807 + -52, 99, 114, 115, 116, 117, 96, 148, 149, 150,
21.808 + 158, 106, 155, 159, 97, 163, 118, -76, -76, -76,
21.809 + -76, -76, -76, -76, -76, 160, 164, -76, -76, 99,
21.810 + 13, 14, 15, 16, 17, 18, 19, 20, 91, 106,
21.811 + 21, 22, 14, 15, 140, 17, 18, 19, 20, 168,
21.812 + 175, 21, 22, 177, 181, 182, 183, 32, 187, 167,
21.813 + 188, 169, 170, 171, 185, 189, 53, 51, 32, 176,
21.814 + 75, 178, 121, 0, 133, 162, 0, 0, 0, 0,
21.815 + 184
21.816 };
21.817
21.818 static const yytype_int16 yycheck[] =
21.819 {
21.820 - 5, 6, 0, 8, 58, 59, 11, 86, 87, 4,
21.821 - 5, 6, 7, 8, 9, 10, 11, 30, 97, 14,
21.822 - 15, 27, 25, 26, 25, 26, 29, 33, 30, 83,
21.823 - 84, 34, 25, 67, 25, 30, 70, 30, 72, 0,
21.824 - 1, 95, 3, 4, 5, 6, 7, 8, 9, 10,
21.825 - 11, 12, 25, 14, 15, 16, 17, 18, 19, 20,
21.826 - 21, 22, 23, 30, 25, 25, 1, 146, 30, 30,
21.827 - 5, 6, 1, 8, 9, 10, 11, 12, 1, 14,
21.828 - 15, 16, 17, 18, 19, 20, 140, 30, 93, 67,
21.829 - 25, 30, 70, 30, 72, 30, 28, 25, 26, 31,
21.830 - 32, 155, 24, 108, 0, 1, 30, 3, 4, 5,
21.831 - 6, 7, 8, 9, 10, 11, 12, 30, 14, 15,
21.832 - 16, 17, 18, 19, 20, 21, 22, 23, 69, 25,
21.833 - 71, 30, 0, 1, 30, 3, 4, 5, 6, 7,
21.834 - 8, 9, 10, 11, 31, 32, 14, 15, 16, 17,
21.835 - 18, 19, 20, 21, 22, 5, 6, 25, 8, 9,
21.836 - 10, 11, 30, 30, 14, 15, 30, 0, 1, 174,
21.837 - 3, 4, 5, 6, 7, 8, 9, 10, 11, 30,
21.838 - 30, 14, 15, 16, 17, 18, 19, 20, 21, 22,
21.839 - 68, 69, 25, 71, 69, 1, 71, 30, 4, 5,
21.840 - 6, 7, 8, 9, 10, 11, 30, 30, 14, 15,
21.841 - 16, 14, 143, 144, 145, 68, 69, 30, 71, 25,
21.842 - 151, 25, 153, 1, 30, 30, 31, 32, 31, 32,
21.843 - 161, 30, 31, 32, 13, 30, 25, 14, 32, 30,
21.844 - 30, 33, 30, 30, 30, 30, 30, 30, 30, 29,
21.845 - 67, 109, 60, -1, -1, -1, -1, -1, -1, 40
21.846 + 1, 67, 68, 10, 93, 94, 76, 3, 76, 14,
21.847 + 28, 81, 13, 81, 15, 104, 34, 18, 3, 32,
21.848 + 33, 23, 26, 27, 90, 91, 30, 32, 33, 31,
21.849 + 78, 35, 80, 0, 1, 31, 102, 4, 5, 6,
21.850 + 7, 8, 9, 10, 11, 12, 31, 14, 15, 16,
21.851 + 17, 18, 19, 20, 21, 22, 23, 24, 78, 26,
21.852 + 80, 26, 69, 133, 31, 133, 31, 156, 26, 27,
21.853 + 29, 0, 1, 32, 33, 4, 5, 6, 7, 8,
21.854 + 9, 10, 11, 12, 150, 14, 15, 16, 17, 18,
21.855 + 19, 20, 21, 22, 23, 24, 0, 26, 164, 100,
21.856 + 77, 78, 31, 80, 77, 78, 31, 80, 31, 32,
21.857 + 33, 0, 1, 31, 115, 4, 5, 6, 7, 8,
21.858 + 9, 10, 11, 26, 27, 14, 15, 16, 17, 18,
21.859 + 19, 20, 21, 22, 23, 31, 26, 26, 31, 0,
21.860 + 1, 26, 31, 4, 5, 6, 7, 8, 9, 10,
21.861 + 11, 26, 31, 14, 15, 16, 17, 18, 19, 20,
21.862 + 21, 22, 23, 1, 1, 26, 31, 32, 33, 31,
21.863 + 31, 0, 1, 31, 31, 4, 5, 6, 7, 8,
21.864 + 9, 10, 11, 31, 185, 14, 15, 16, 17, 18,
21.865 + 19, 20, 21, 22, 23, 31, 1, 26, 31, 31,
21.866 + 5, 6, 31, 8, 9, 10, 11, 12, 31, 14,
21.867 + 15, 16, 17, 18, 19, 20, 31, 31, 31, 25,
21.868 + 1, 26, 26, 13, 1, 26, 31, 4, 5, 6,
21.869 + 7, 8, 9, 10, 11, 31, 14, 14, 15, 16,
21.870 + 4, 5, 6, 7, 8, 9, 10, 11, 33, 26,
21.871 + 14, 15, 5, 6, 31, 8, 9, 10, 11, 31,
21.872 + 31, 14, 15, 31, 31, 31, 31, 31, 31, 151,
21.873 + 31, 153, 154, 155, 34, 31, 7, 6, 31, 161,
21.874 + 37, 163, 76, -1, 79, 116, -1, -1, -1, -1,
21.875 + 172
21.876 };
21.877
21.878 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
21.879 symbol of state STATE-NUM. */
21.880 static const yytype_uint8 yystos[] =
21.881 {
21.882 - 0, 36, 37, 0, 1, 3, 4, 5, 6, 7,
21.883 - 8, 9, 10, 11, 14, 15, 16, 17, 18, 19,
21.884 - 20, 21, 22, 25, 30, 38, 39, 41, 42, 43,
21.885 - 44, 50, 51, 53, 57, 59, 61, 62, 64, 66,
21.886 - 67, 68, 75, 30, 25, 26, 74, 74, 30, 74,
21.887 - 25, 80, 30, 74, 25, 25, 25, 26, 29, 34,
21.888 - 78, 79, 30, 1, 1, 45, 45, 54, 56, 60,
21.889 - 71, 65, 71, 30, 76, 30, 30, 30, 30, 30,
21.890 - 30, 78, 78, 31, 32, 76, 27, 33, 30, 30,
21.891 - 1, 12, 16, 18, 19, 20, 21, 22, 23, 25,
21.892 - 30, 40, 46, 47, 69, 70, 72, 17, 18, 19,
21.893 - 20, 30, 40, 55, 70, 72, 39, 52, 75, 39,
21.894 - 53, 58, 64, 75, 30, 40, 72, 39, 53, 63,
21.895 - 64, 75, 30, 28, 78, 78, 79, 79, 30, 30,
21.896 - 24, 74, 73, 74, 78, 25, 79, 48, 1, 13,
21.897 - 30, 74, 73, 25, 78, 14, 77, 30, 77, 77,
21.898 - 77, 79, 25, 30, 30, 77, 30, 77, 30, 78,
21.899 - 30, 30, 30, 77, 33, 49, 30, 30, 30, 74
21.900 + 0, 3, 31, 37, 38, 39, 63, 81, 26, 27,
21.901 + 79, 0, 1, 4, 5, 6, 7, 8, 9, 10,
21.902 + 11, 14, 15, 16, 17, 18, 19, 20, 21, 22,
21.903 + 23, 26, 31, 40, 41, 43, 44, 45, 46, 52,
21.904 + 53, 55, 59, 61, 64, 65, 67, 69, 70, 71,
21.905 + 80, 39, 31, 38, 81, 31, 79, 31, 79, 26,
21.906 + 85, 31, 79, 26, 26, 26, 27, 30, 35, 83,
21.907 + 84, 31, 1, 1, 47, 47, 56, 58, 62, 76,
21.908 + 68, 74, 31, 31, 31, 31, 31, 31, 83, 83,
21.909 + 32, 33, 81, 28, 34, 31, 31, 1, 12, 16,
21.910 + 18, 19, 20, 21, 22, 24, 26, 31, 42, 48,
21.911 + 49, 72, 73, 75, 17, 18, 19, 20, 31, 42,
21.912 + 57, 73, 75, 41, 54, 80, 41, 55, 60, 67,
21.913 + 80, 23, 31, 74, 77, 41, 55, 66, 67, 80,
21.914 + 31, 42, 75, 29, 83, 83, 84, 84, 31, 31,
21.915 + 25, 79, 78, 79, 83, 26, 84, 50, 1, 13,
21.916 + 31, 79, 78, 26, 14, 82, 83, 82, 31, 82,
21.917 + 82, 82, 84, 26, 31, 31, 82, 31, 82, 83,
21.918 + 31, 31, 31, 31, 82, 34, 51, 31, 31, 31,
21.919 + 79
21.920 };
21.921
21.922 #define yyerrok (yyerrstatus = 0)
21.923 @@ -985,17 +976,20 @@
21.924 #if (defined __STDC__ || defined __C99__FUNC__ \
21.925 || defined __cplusplus || defined _MSC_VER)
21.926 static void
21.927 -yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
21.928 +yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
21.929 #else
21.930 static void
21.931 -yy_stack_print (bottom, top)
21.932 - yytype_int16 *bottom;
21.933 - yytype_int16 *top;
21.934 +yy_stack_print (yybottom, yytop)
21.935 + yytype_int16 *yybottom;
21.936 + yytype_int16 *yytop;
21.937 #endif
21.938 {
21.939 YYFPRINTF (stderr, "Stack now");
21.940 - for (; bottom <= top; ++bottom)
21.941 - YYFPRINTF (stderr, " %d", *bottom);
21.942 + for (; yybottom <= yytop; yybottom++)
21.943 + {
21.944 + int yybot = *yybottom;
21.945 + YYFPRINTF (stderr, " %d", yybot);
21.946 + }
21.947 YYFPRINTF (stderr, "\n");
21.948 }
21.949
21.950 @@ -1029,11 +1023,11 @@
21.951 /* The symbols being reduced. */
21.952 for (yyi = 0; yyi < yynrhs; yyi++)
21.953 {
21.954 - fprintf (stderr, " $%d = ", yyi + 1);
21.955 + YYFPRINTF (stderr, " $%d = ", yyi + 1);
21.956 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
21.957 &(yyvsp[(yyi + 1) - (yynrhs)])
21.958 );
21.959 - fprintf (stderr, "\n");
21.960 + YYFPRINTF (stderr, "\n");
21.961 }
21.962 }
21.963
21.964 @@ -1308,7 +1302,7 @@
21.965
21.966 switch (yytype)
21.967 {
21.968 - case 51: /* "choice_entry" */
21.969 + case 53: /* "choice_entry" */
21.970
21.971 {
21.972 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
21.973 @@ -1318,7 +1312,7 @@
21.974 };
21.975
21.976 break;
21.977 - case 57: /* "if_entry" */
21.978 + case 59: /* "if_entry" */
21.979
21.980 {
21.981 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
21.982 @@ -1328,7 +1322,7 @@
21.983 };
21.984
21.985 break;
21.986 - case 62: /* "menu_entry" */
21.987 + case 65: /* "menu_entry" */
21.988
21.989 {
21.990 fprintf(stderr, "%s:%d: missing end statement for this entry\n",
21.991 @@ -1343,10 +1337,8 @@
21.992 break;
21.993 }
21.994 }
21.995 -
21.996
21.997 /* Prevent warnings from -Wmissing-prototypes. */
21.998 -
21.999 #ifdef YYPARSE_PARAM
21.1000 #if defined __STDC__ || defined __cplusplus
21.1001 int yyparse (void *YYPARSE_PARAM);
21.1002 @@ -1362,11 +1354,10 @@
21.1003 #endif /* ! YYPARSE_PARAM */
21.1004
21.1005
21.1006 -
21.1007 -/* The look-ahead symbol. */
21.1008 +/* The lookahead symbol. */
21.1009 int yychar;
21.1010
21.1011 -/* The semantic value of the look-ahead symbol. */
21.1012 +/* The semantic value of the lookahead symbol. */
21.1013 YYSTYPE yylval;
21.1014
21.1015 /* Number of syntax errors so far. */
21.1016 @@ -1374,9 +1365,9 @@
21.1017
21.1018
21.1019
21.1020 -/*----------.
21.1021 -| yyparse. |
21.1022 -`----------*/
21.1023 +/*-------------------------.
21.1024 +| yyparse or yypush_parse. |
21.1025 +`-------------------------*/
21.1026
21.1027 #ifdef YYPARSE_PARAM
21.1028 #if (defined __STDC__ || defined __C99__FUNC__ \
21.1029 @@ -1400,14 +1391,39 @@
21.1030 #endif
21.1031 #endif
21.1032 {
21.1033 -
21.1034 - int yystate;
21.1035 +
21.1036 +
21.1037 + int yystate;
21.1038 + /* Number of tokens to shift before error messages enabled. */
21.1039 + int yyerrstatus;
21.1040 +
21.1041 + /* The stacks and their tools:
21.1042 + `yyss': related to states.
21.1043 + `yyvs': related to semantic values.
21.1044 +
21.1045 + Refer to the stacks thru separate pointers, to allow yyoverflow
21.1046 + to reallocate them elsewhere. */
21.1047 +
21.1048 + /* The state stack. */
21.1049 + yytype_int16 yyssa[YYINITDEPTH];
21.1050 + yytype_int16 *yyss;
21.1051 + yytype_int16 *yyssp;
21.1052 +
21.1053 + /* The semantic value stack. */
21.1054 + YYSTYPE yyvsa[YYINITDEPTH];
21.1055 + YYSTYPE *yyvs;
21.1056 + YYSTYPE *yyvsp;
21.1057 +
21.1058 + YYSIZE_T yystacksize;
21.1059 +
21.1060 int yyn;
21.1061 int yyresult;
21.1062 - /* Number of tokens to shift before error messages enabled. */
21.1063 - int yyerrstatus;
21.1064 - /* Look-ahead token as an internal (translated) token number. */
21.1065 - int yytoken = 0;
21.1066 + /* Lookahead token as an internal (translated) token number. */
21.1067 + int yytoken;
21.1068 + /* The variables used to return semantic value and location from the
21.1069 + action routines. */
21.1070 + YYSTYPE yyval;
21.1071 +
21.1072 #if YYERROR_VERBOSE
21.1073 /* Buffer for error messages, and its allocated size. */
21.1074 char yymsgbuf[128];
21.1075 @@ -1415,51 +1431,28 @@
21.1076 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
21.1077 #endif
21.1078
21.1079 - /* Three stacks and their tools:
21.1080 - `yyss': related to states,
21.1081 - `yyvs': related to semantic values,
21.1082 - `yyls': related to locations.
21.1083 -
21.1084 - Refer to the stacks thru separate pointers, to allow yyoverflow
21.1085 - to reallocate them elsewhere. */
21.1086 -
21.1087 - /* The state stack. */
21.1088 - yytype_int16 yyssa[YYINITDEPTH];
21.1089 - yytype_int16 *yyss = yyssa;
21.1090 - yytype_int16 *yyssp;
21.1091 -
21.1092 - /* The semantic value stack. */
21.1093 - YYSTYPE yyvsa[YYINITDEPTH];
21.1094 - YYSTYPE *yyvs = yyvsa;
21.1095 - YYSTYPE *yyvsp;
21.1096 -
21.1097 -
21.1098 -
21.1099 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
21.1100
21.1101 - YYSIZE_T yystacksize = YYINITDEPTH;
21.1102 -
21.1103 - /* The variables used to return semantic value and location from the
21.1104 - action routines. */
21.1105 - YYSTYPE yyval;
21.1106 -
21.1107 -
21.1108 /* The number of symbols on the RHS of the reduced rule.
21.1109 Keep to zero when no symbol should be popped. */
21.1110 int yylen = 0;
21.1111
21.1112 + yytoken = 0;
21.1113 + yyss = yyssa;
21.1114 + yyvs = yyvsa;
21.1115 + yystacksize = YYINITDEPTH;
21.1116 +
21.1117 YYDPRINTF ((stderr, "Starting parse\n"));
21.1118
21.1119 yystate = 0;
21.1120 yyerrstatus = 0;
21.1121 yynerrs = 0;
21.1122 - yychar = YYEMPTY; /* Cause a token to be read. */
21.1123 + yychar = YYEMPTY; /* Cause a token to be read. */
21.1124
21.1125 /* Initialize stack pointers.
21.1126 Waste one element of value and location stack
21.1127 so that they stay on the same level as the state stack.
21.1128 The wasted elements are never initialized. */
21.1129 -
21.1130 yyssp = yyss;
21.1131 yyvsp = yyvs;
21.1132
21.1133 @@ -1489,7 +1482,6 @@
21.1134 YYSTYPE *yyvs1 = yyvs;
21.1135 yytype_int16 *yyss1 = yyss;
21.1136
21.1137 -
21.1138 /* Each stack pointer address is followed by the size of the
21.1139 data in use in that stack, in bytes. This used to be a
21.1140 conditional around just the two extra args, but that might
21.1141 @@ -1497,7 +1489,6 @@
21.1142 yyoverflow (YY_("memory exhausted"),
21.1143 &yyss1, yysize * sizeof (*yyssp),
21.1144 &yyvs1, yysize * sizeof (*yyvsp),
21.1145 -
21.1146 &yystacksize);
21.1147
21.1148 yyss = yyss1;
21.1149 @@ -1520,9 +1511,8 @@
21.1150 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
21.1151 if (! yyptr)
21.1152 goto yyexhaustedlab;
21.1153 - YYSTACK_RELOCATE (yyss);
21.1154 - YYSTACK_RELOCATE (yyvs);
21.1155 -
21.1156 + YYSTACK_RELOCATE (yyss_alloc, yyss);
21.1157 + YYSTACK_RELOCATE (yyvs_alloc, yyvs);
21.1158 # undef YYSTACK_RELOCATE
21.1159 if (yyss1 != yyssa)
21.1160 YYSTACK_FREE (yyss1);
21.1161 @@ -1533,7 +1523,6 @@
21.1162 yyssp = yyss + yysize - 1;
21.1163 yyvsp = yyvs + yysize - 1;
21.1164
21.1165 -
21.1166 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
21.1167 (unsigned long int) yystacksize));
21.1168
21.1169 @@ -1543,6 +1532,9 @@
21.1170
21.1171 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
21.1172
21.1173 + if (yystate == YYFINAL)
21.1174 + YYACCEPT;
21.1175 +
21.1176 goto yybackup;
21.1177
21.1178 /*-----------.
21.1179 @@ -1551,16 +1543,16 @@
21.1180 yybackup:
21.1181
21.1182 /* Do appropriate processing given the current state. Read a
21.1183 - look-ahead token if we need one and don't already have one. */
21.1184 + lookahead token if we need one and don't already have one. */
21.1185
21.1186 - /* First try to decide what to do without reference to look-ahead token. */
21.1187 + /* First try to decide what to do without reference to lookahead token. */
21.1188 yyn = yypact[yystate];
21.1189 if (yyn == YYPACT_NINF)
21.1190 goto yydefault;
21.1191
21.1192 - /* Not known => get a look-ahead token if don't already have one. */
21.1193 + /* Not known => get a lookahead token if don't already have one. */
21.1194
21.1195 - /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
21.1196 + /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
21.1197 if (yychar == YYEMPTY)
21.1198 {
21.1199 YYDPRINTF ((stderr, "Reading a token: "));
21.1200 @@ -1592,20 +1584,16 @@
21.1201 goto yyreduce;
21.1202 }
21.1203
21.1204 - if (yyn == YYFINAL)
21.1205 - YYACCEPT;
21.1206 -
21.1207 /* Count tokens shifted since error; after three, turn off error
21.1208 status. */
21.1209 if (yyerrstatus)
21.1210 yyerrstatus--;
21.1211
21.1212 - /* Shift the look-ahead token. */
21.1213 + /* Shift the lookahead token. */
21.1214 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
21.1215
21.1216 - /* Discard the shifted token unless it is eof. */
21.1217 - if (yychar != YYEOF)
21.1218 - yychar = YYEMPTY;
21.1219 + /* Discard the shifted token. */
21.1220 + yychar = YYEMPTY;
21.1221
21.1222 yystate = yyn;
21.1223 *++yyvsp = yylval;
21.1224 @@ -1644,39 +1632,39 @@
21.1225 YY_REDUCE_PRINT (yyn);
21.1226 switch (yyn)
21.1227 {
21.1228 - case 8:
21.1229 + case 10:
21.1230
21.1231 { zconf_error("unexpected end statement"); ;}
21.1232 break;
21.1233
21.1234 - case 9:
21.1235 + case 11:
21.1236
21.1237 { zconf_error("unknown statement \"%s\"", (yyvsp[(2) - (4)].string)); ;}
21.1238 break;
21.1239
21.1240 - case 10:
21.1241 + case 12:
21.1242
21.1243 {
21.1244 zconf_error("unexpected option \"%s\"", kconf_id_strings + (yyvsp[(2) - (4)].id)->name);
21.1245 ;}
21.1246 break;
21.1247
21.1248 - case 11:
21.1249 + case 13:
21.1250
21.1251 { zconf_error("invalid statement"); ;}
21.1252 break;
21.1253
21.1254 - case 25:
21.1255 + case 28:
21.1256
21.1257 { zconf_error("unknown option \"%s\"", (yyvsp[(1) - (3)].string)); ;}
21.1258 break;
21.1259
21.1260 - case 26:
21.1261 + case 29:
21.1262
21.1263 { zconf_error("invalid option"); ;}
21.1264 break;
21.1265
21.1266 - case 27:
21.1267 + case 30:
21.1268
21.1269 {
21.1270 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
21.1271 @@ -1686,7 +1674,7 @@
21.1272 ;}
21.1273 break;
21.1274
21.1275 - case 28:
21.1276 + case 31:
21.1277
21.1278 {
21.1279 menu_end_entry();
21.1280 @@ -1694,7 +1682,7 @@
21.1281 ;}
21.1282 break;
21.1283
21.1284 - case 29:
21.1285 + case 32:
21.1286
21.1287 {
21.1288 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), 0);
21.1289 @@ -1704,7 +1692,7 @@
21.1290 ;}
21.1291 break;
21.1292
21.1293 - case 30:
21.1294 + case 33:
21.1295
21.1296 {
21.1297 if (current_entry->prompt)
21.1298 @@ -1716,7 +1704,7 @@
21.1299 ;}
21.1300 break;
21.1301
21.1302 - case 38:
21.1303 + case 41:
21.1304
21.1305 {
21.1306 menu_set_type((yyvsp[(1) - (3)].id)->stype);
21.1307 @@ -1726,7 +1714,7 @@
21.1308 ;}
21.1309 break;
21.1310
21.1311 - case 39:
21.1312 + case 42:
21.1313
21.1314 {
21.1315 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
21.1316 @@ -1734,7 +1722,7 @@
21.1317 ;}
21.1318 break;
21.1319
21.1320 - case 40:
21.1321 + case 43:
21.1322
21.1323 {
21.1324 menu_add_expr(P_DEFAULT, (yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr));
21.1325 @@ -1746,7 +1734,7 @@
21.1326 ;}
21.1327 break;
21.1328
21.1329 - case 41:
21.1330 + case 44:
21.1331
21.1332 {
21.1333 menu_add_symbol(P_SELECT, sym_lookup((yyvsp[(2) - (4)].string), 0), (yyvsp[(3) - (4)].expr));
21.1334 @@ -1754,7 +1742,7 @@
21.1335 ;}
21.1336 break;
21.1337
21.1338 - case 42:
21.1339 + case 45:
21.1340
21.1341 {
21.1342 menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[(2) - (5)].symbol), (yyvsp[(3) - (5)].symbol)), (yyvsp[(4) - (5)].expr));
21.1343 @@ -1762,7 +1750,7 @@
21.1344 ;}
21.1345 break;
21.1346
21.1347 - case 45:
21.1348 + case 48:
21.1349
21.1350 {
21.1351 struct kconf_id *id = kconf_id_lookup((yyvsp[(2) - (3)].string), strlen((yyvsp[(2) - (3)].string)));
21.1352 @@ -1774,17 +1762,17 @@
21.1353 ;}
21.1354 break;
21.1355
21.1356 - case 46:
21.1357 + case 49:
21.1358
21.1359 { (yyval.string) = NULL; ;}
21.1360 break;
21.1361
21.1362 - case 47:
21.1363 + case 50:
21.1364
21.1365 { (yyval.string) = (yyvsp[(2) - (2)].string); ;}
21.1366 break;
21.1367
21.1368 - case 48:
21.1369 + case 51:
21.1370
21.1371 {
21.1372 struct symbol *sym = sym_lookup((yyvsp[(2) - (3)].string), SYMBOL_CHOICE);
21.1373 @@ -1795,14 +1783,14 @@
21.1374 ;}
21.1375 break;
21.1376
21.1377 - case 49:
21.1378 + case 52:
21.1379
21.1380 {
21.1381 (yyval.menu) = menu_add_menu();
21.1382 ;}
21.1383 break;
21.1384
21.1385 - case 50:
21.1386 + case 53:
21.1387
21.1388 {
21.1389 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_CHOICE, T_ENDCHOICE)) {
21.1390 @@ -1812,7 +1800,7 @@
21.1391 ;}
21.1392 break;
21.1393
21.1394 - case 58:
21.1395 + case 61:
21.1396
21.1397 {
21.1398 menu_add_prompt(P_PROMPT, (yyvsp[(2) - (4)].string), (yyvsp[(3) - (4)].expr));
21.1399 @@ -1820,7 +1808,7 @@
21.1400 ;}
21.1401 break;
21.1402
21.1403 - case 59:
21.1404 + case 62:
21.1405
21.1406 {
21.1407 if ((yyvsp[(1) - (3)].id)->stype == S_BOOLEAN || (yyvsp[(1) - (3)].id)->stype == S_TRISTATE) {
21.1408 @@ -1833,7 +1821,7 @@
21.1409 ;}
21.1410 break;
21.1411
21.1412 - case 60:
21.1413 + case 63:
21.1414
21.1415 {
21.1416 current_entry->sym->flags |= SYMBOL_OPTIONAL;
21.1417 @@ -1841,7 +1829,7 @@
21.1418 ;}
21.1419 break;
21.1420
21.1421 - case 61:
21.1422 + case 64:
21.1423
21.1424 {
21.1425 if ((yyvsp[(1) - (4)].id)->stype == S_UNKNOWN) {
21.1426 @@ -1853,7 +1841,7 @@
21.1427 ;}
21.1428 break;
21.1429
21.1430 - case 64:
21.1431 + case 67:
21.1432
21.1433 {
21.1434 printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno());
21.1435 @@ -1863,7 +1851,7 @@
21.1436 ;}
21.1437 break;
21.1438
21.1439 - case 65:
21.1440 + case 68:
21.1441
21.1442 {
21.1443 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_IF, T_ENDIF)) {
21.1444 @@ -1873,7 +1861,14 @@
21.1445 ;}
21.1446 break;
21.1447
21.1448 - case 71:
21.1449 + case 74:
21.1450 +
21.1451 + {
21.1452 + menu_add_prompt(P_MENU, (yyvsp[(2) - (3)].string), NULL);
21.1453 +;}
21.1454 + break;
21.1455 +
21.1456 + case 75:
21.1457
21.1458 {
21.1459 menu_add_entry(NULL);
21.1460 @@ -1882,14 +1877,14 @@
21.1461 ;}
21.1462 break;
21.1463
21.1464 - case 72:
21.1465 + case 76:
21.1466
21.1467 {
21.1468 (yyval.menu) = menu_add_menu();
21.1469 ;}
21.1470 break;
21.1471
21.1472 - case 73:
21.1473 + case 77:
21.1474
21.1475 {
21.1476 if (zconf_endtoken((yyvsp[(1) - (1)].id), T_MENU, T_ENDMENU)) {
21.1477 @@ -1899,7 +1894,7 @@
21.1478 ;}
21.1479 break;
21.1480
21.1481 - case 79:
21.1482 + case 83:
21.1483
21.1484 {
21.1485 printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[(2) - (3)].string));
21.1486 @@ -1907,7 +1902,7 @@
21.1487 ;}
21.1488 break;
21.1489
21.1490 - case 80:
21.1491 + case 84:
21.1492
21.1493 {
21.1494 menu_add_entry(NULL);
21.1495 @@ -1916,14 +1911,14 @@
21.1496 ;}
21.1497 break;
21.1498
21.1499 - case 81:
21.1500 + case 85:
21.1501
21.1502 {
21.1503 menu_end_entry();
21.1504 ;}
21.1505 break;
21.1506
21.1507 - case 82:
21.1508 + case 86:
21.1509
21.1510 {
21.1511 printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno());
21.1512 @@ -1931,14 +1926,14 @@
21.1513 ;}
21.1514 break;
21.1515
21.1516 - case 83:
21.1517 + case 87:
21.1518
21.1519 {
21.1520 current_entry->help = (yyvsp[(2) - (2)].string);
21.1521 ;}
21.1522 break;
21.1523
21.1524 - case 88:
21.1525 + case 92:
21.1526
21.1527 {
21.1528 menu_add_dep((yyvsp[(3) - (4)].expr));
21.1529 @@ -1946,90 +1941,96 @@
21.1530 ;}
21.1531 break;
21.1532
21.1533 - case 90:
21.1534 + case 96:
21.1535 +
21.1536 + {
21.1537 + menu_add_visibility((yyvsp[(2) - (2)].expr));
21.1538 +;}
21.1539 + break;
21.1540 +
21.1541 + case 98:
21.1542
21.1543 {
21.1544 menu_add_prompt(P_PROMPT, (yyvsp[(1) - (2)].string), (yyvsp[(2) - (2)].expr));
21.1545 ;}
21.1546 break;
21.1547
21.1548 - case 93:
21.1549 + case 101:
21.1550
21.1551 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
21.1552 break;
21.1553
21.1554 - case 94:
21.1555 + case 102:
21.1556
21.1557 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
21.1558 break;
21.1559
21.1560 - case 95:
21.1561 + case 103:
21.1562
21.1563 { (yyval.id) = (yyvsp[(1) - (2)].id); ;}
21.1564 break;
21.1565
21.1566 - case 98:
21.1567 + case 106:
21.1568
21.1569 { (yyval.expr) = NULL; ;}
21.1570 break;
21.1571
21.1572 - case 99:
21.1573 + case 107:
21.1574
21.1575 { (yyval.expr) = (yyvsp[(2) - (2)].expr); ;}
21.1576 break;
21.1577
21.1578 - case 100:
21.1579 + case 108:
21.1580
21.1581 { (yyval.expr) = expr_alloc_symbol((yyvsp[(1) - (1)].symbol)); ;}
21.1582 break;
21.1583
21.1584 - case 101:
21.1585 + case 109:
21.1586
21.1587 { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
21.1588 break;
21.1589
21.1590 - case 102:
21.1591 + case 110:
21.1592
21.1593 { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[(1) - (3)].symbol), (yyvsp[(3) - (3)].symbol)); ;}
21.1594 break;
21.1595
21.1596 - case 103:
21.1597 + case 111:
21.1598
21.1599 { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;}
21.1600 break;
21.1601
21.1602 - case 104:
21.1603 + case 112:
21.1604
21.1605 { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[(2) - (2)].expr)); ;}
21.1606 break;
21.1607
21.1608 - case 105:
21.1609 + case 113:
21.1610
21.1611 { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
21.1612 break;
21.1613
21.1614 - case 106:
21.1615 + case 114:
21.1616
21.1617 { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;}
21.1618 break;
21.1619
21.1620 - case 107:
21.1621 + case 115:
21.1622
21.1623 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), 0); free((yyvsp[(1) - (1)].string)); ;}
21.1624 break;
21.1625
21.1626 - case 108:
21.1627 + case 116:
21.1628
21.1629 { (yyval.symbol) = sym_lookup((yyvsp[(1) - (1)].string), SYMBOL_CONST); free((yyvsp[(1) - (1)].string)); ;}
21.1630 break;
21.1631
21.1632 - case 109:
21.1633 + case 117:
21.1634
21.1635 { (yyval.string) = NULL; ;}
21.1636 break;
21.1637
21.1638
21.1639 -/* Line 1267 of yacc.c. */
21.1640
21.1641 default: break;
21.1642 }
21.1643 @@ -2041,7 +2042,6 @@
21.1644
21.1645 *++yyvsp = yyval;
21.1646
21.1647 -
21.1648 /* Now `shift' the result of the reduction. Determine what state
21.1649 that goes to, based on the state we popped back to and the rule
21.1650 number reduced by. */
21.1651 @@ -2106,7 +2106,7 @@
21.1652
21.1653 if (yyerrstatus == 3)
21.1654 {
21.1655 - /* If just tried and failed to reuse look-ahead token after an
21.1656 + /* If just tried and failed to reuse lookahead token after an
21.1657 error, discard it. */
21.1658
21.1659 if (yychar <= YYEOF)
21.1660 @@ -2123,7 +2123,7 @@
21.1661 }
21.1662 }
21.1663
21.1664 - /* Else will try to reuse look-ahead token after shifting the error
21.1665 + /* Else will try to reuse lookahead token after shifting the error
21.1666 token. */
21.1667 goto yyerrlab1;
21.1668
21.1669 @@ -2180,9 +2180,6 @@
21.1670 YY_STACK_PRINT (yyss, yyssp);
21.1671 }
21.1672
21.1673 - if (yyn == YYFINAL)
21.1674 - YYACCEPT;
21.1675 -
21.1676 *++yyvsp = yylval;
21.1677
21.1678
21.1679 @@ -2207,7 +2204,7 @@
21.1680 yyresult = 1;
21.1681 goto yyreturn;
21.1682
21.1683 -#ifndef yyoverflow
21.1684 +#if !defined(yyoverflow) || YYERROR_VERBOSE
21.1685 /*-------------------------------------------------.
21.1686 | yyexhaustedlab -- memory exhaustion comes here. |
21.1687 `-------------------------------------------------*/
21.1688 @@ -2218,7 +2215,7 @@
21.1689 #endif
21.1690
21.1691 yyreturn:
21.1692 - if (yychar != YYEOF && yychar != YYEMPTY)
21.1693 + if (yychar != YYEMPTY)
21.1694 yydestruct ("Cleanup: discarding lookahead",
21.1695 yytoken, &yylval);
21.1696 /* Do not reclaim the symbols of the rule which action triggered
21.1697 @@ -2255,11 +2252,11 @@
21.1698 zconf_initscan(name);
21.1699
21.1700 sym_init();
21.1701 - menu_init();
21.1702 + _menu_init();
21.1703 modules_sym = sym_lookup(NULL, 0);
21.1704 modules_sym->type = S_BOOLEAN;
21.1705 modules_sym->flags |= SYMBOL_AUTO;
21.1706 - rootmenu.prompt = menu_add_prompt(P_MENU, PACKAGE, NULL);
21.1707 + rootmenu.prompt = menu_add_prompt(P_MENU, PACKAGE " Configuration", NULL);
21.1708
21.1709 #if YYDEBUG
21.1710 if (getenv("ZCONF_DEBUG"))
21.1711 @@ -2274,6 +2271,10 @@
21.1712 prop = prop_alloc(P_DEFAULT, modules_sym);
21.1713 prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
21.1714 }
21.1715 +
21.1716 + rootmenu.prompt->text = _(rootmenu.prompt->text);
21.1717 + rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text);
21.1718 +
21.1719 menu_finalize(&rootmenu);
21.1720 for_all_symbols(i, sym) {
21.1721 if (sym_check_deps(sym))
21.1722 @@ -2284,7 +2285,7 @@
21.1723 sym_set_change_count(1);
21.1724 }
21.1725
21.1726 -const char *zconf_tokenname(int token)
21.1727 +static const char *zconf_tokenname(int token)
21.1728 {
21.1729 switch (token) {
21.1730 case T_MENU: return "menu";
21.1731 @@ -2294,6 +2295,7 @@
21.1732 case T_IF: return "if";
21.1733 case T_ENDIF: return "endif";
21.1734 case T_DEPENDS: return "depends";
21.1735 + case T_VISIBLE: return "visible";
21.1736 }
21.1737 return "<token>";
21.1738 }
21.1739 @@ -2348,7 +2350,7 @@
21.1740 #endif
21.1741 }
21.1742
21.1743 -void print_quoted_string(FILE *out, const char *str)
21.1744 +static void print_quoted_string(FILE *out, const char *str)
21.1745 {
21.1746 const char *p;
21.1747 int len;
21.1748 @@ -2365,15 +2367,15 @@
21.1749 putc('"', out);
21.1750 }
21.1751
21.1752 -void print_symbol(FILE *out, struct menu *menu)
21.1753 +static void print_symbol(FILE *out, struct menu *menu)
21.1754 {
21.1755 struct symbol *sym = menu->sym;
21.1756 struct property *prop;
21.1757
21.1758 if (sym_is_choice(sym))
21.1759 - fprintf(out, "choice\n");
21.1760 + fprintf(out, "\nchoice\n");
21.1761 else
21.1762 - fprintf(out, "config %s\n", sym->name);
21.1763 + fprintf(out, "\nconfig %s\n", sym->name);
21.1764 switch (sym->type) {
21.1765 case S_BOOLEAN:
21.1766 fputs(" boolean\n", out);
21.1767 @@ -2419,6 +2421,21 @@
21.1768 case P_CHOICE:
21.1769 fputs(" #choice value\n", out);
21.1770 break;
21.1771 + case P_SELECT:
21.1772 + fputs( " select ", out);
21.1773 + expr_fprint(prop->expr, out);
21.1774 + fputc('\n', out);
21.1775 + break;
21.1776 + case P_RANGE:
21.1777 + fputs( " range ", out);
21.1778 + expr_fprint(prop->expr, out);
21.1779 + fputc('\n', out);
21.1780 + break;
21.1781 + case P_MENU:
21.1782 + fputs( " menu ", out);
21.1783 + print_quoted_string(out, prop->text);
21.1784 + fputc('\n', out);
21.1785 + break;
21.1786 default:
21.1787 fprintf(out, " unknown prop %d!\n", prop->type);
21.1788 break;
21.1789 @@ -2430,7 +2447,6 @@
21.1790 menu->help[len] = 0;
21.1791 fprintf(out, " help\n%s\n", menu->help);
21.1792 }
21.1793 - fputc('\n', out);
21.1794 }
21.1795
21.1796 void zconfdump(FILE *out)
21.1797 @@ -2463,7 +2479,6 @@
21.1798 expr_fprint(prop->visible.expr, out);
21.1799 fputc('\n', out);
21.1800 }
21.1801 - fputs("\n", out);
21.1802 }
21.1803
21.1804 if (menu->list)