1.1 --- a/kconfig/menu.c Sat Feb 24 11:00:05 2007 +0000
1.2 +++ b/kconfig/menu.c Mon Oct 20 09:50:45 2008 +0000
1.3 @@ -15,7 +15,7 @@
1.4 struct file *file_list;
1.5 struct file *current_file;
1.6
1.7 -static void menu_warn(struct menu *menu, const char *fmt, ...)
1.8 +void menu_warn(struct menu *menu, const char *fmt, ...)
1.9 {
1.10 va_list ap;
1.11 va_start(ap, fmt);
1.12 @@ -172,6 +172,9 @@
1.13 else if (sym_defconfig_list != current_entry->sym)
1.14 zconf_error("trying to redefine defconfig symbol");
1.15 break;
1.16 + case T_OPT_ENV:
1.17 + prop_add_env(arg);
1.18 + break;
1.19 }
1.20 }
1.21
1.22 @@ -200,12 +203,9 @@
1.23 prop_warn(prop,
1.24 "config symbol '%s' uses select, but is "
1.25 "not boolean or tristate", sym->name);
1.26 - else if (sym2->type == S_UNKNOWN)
1.27 - prop_warn(prop,
1.28 - "'select' used by config symbol '%s' "
1.29 - "refer to undefined symbol '%s'",
1.30 - sym->name, sym2->name);
1.31 - else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE)
1.32 + else if (sym2->type != S_UNKNOWN &&
1.33 + sym2->type != S_BOOLEAN &&
1.34 + sym2->type != S_TRISTATE)
1.35 prop_warn(prop,
1.36 "'%s' has wrong type. 'select' only "
1.37 "accept arguments of boolean and "
1.38 @@ -235,15 +235,21 @@
1.39 sym = parent->sym;
1.40 if (parent->list) {
1.41 if (sym && sym_is_choice(sym)) {
1.42 - /* find the first choice value and find out choice type */
1.43 + if (sym->type == S_UNKNOWN) {
1.44 + /* find the first choice value to find out choice type */
1.45 + current_entry = parent;
1.46 + for (menu = parent->list; menu; menu = menu->next) {
1.47 + if (menu->sym && menu->sym->type != S_UNKNOWN) {
1.48 + menu_set_type(menu->sym->type);
1.49 + break;
1.50 + }
1.51 + }
1.52 + }
1.53 + /* set the type of the remaining choice values */
1.54 for (menu = parent->list; menu; menu = menu->next) {
1.55 - if (menu->sym) {
1.56 - current_entry = parent;
1.57 - menu_set_type(menu->sym->type);
1.58 - current_entry = menu;
1.59 + current_entry = menu;
1.60 + if (menu->sym && menu->sym->type == S_UNKNOWN)
1.61 menu_set_type(sym->type);
1.62 - break;
1.63 - }
1.64 }
1.65 parentdep = expr_alloc_symbol(sym);
1.66 } else if (parent->prompt)
1.67 @@ -311,27 +317,43 @@
1.68 }
1.69 }
1.70 for (menu = parent->list; menu; menu = menu->next) {
1.71 - if (sym && sym_is_choice(sym) && menu->sym) {
1.72 + if (sym && sym_is_choice(sym) &&
1.73 + menu->sym && !sym_is_choice_value(menu->sym)) {
1.74 + current_entry = menu;
1.75 menu->sym->flags |= SYMBOL_CHOICEVAL;
1.76 if (!menu->prompt)
1.77 menu_warn(menu, "choice value must have a prompt");
1.78 for (prop = menu->sym->prop; prop; prop = prop->next) {
1.79 - if (prop->type == P_PROMPT && prop->menu != menu) {
1.80 - prop_warn(prop, "choice values "
1.81 - "currently only support a "
1.82 - "single prompt");
1.83 - }
1.84 if (prop->type == P_DEFAULT)
1.85 prop_warn(prop, "defaults for choice "
1.86 - "values not supported");
1.87 + "values not supported");
1.88 + if (prop->menu == menu)
1.89 + continue;
1.90 + if (prop->type == P_PROMPT &&
1.91 + prop->menu->parent->sym != sym)
1.92 + prop_warn(prop, "choice value used outside its choice group");
1.93 }
1.94 - current_entry = menu;
1.95 - menu_set_type(sym->type);
1.96 + /* Non-tristate choice values of tristate choices must
1.97 + * depend on the choice being set to Y. The choice
1.98 + * values' dependencies were propagated to their
1.99 + * properties above, so the change here must be re-
1.100 + * propagated.
1.101 + */
1.102 + if (sym->type == S_TRISTATE && menu->sym->type != S_TRISTATE) {
1.103 + basedep = expr_alloc_comp(E_EQUAL, sym, &symbol_yes);
1.104 + menu->dep = expr_alloc_and(basedep, menu->dep);
1.105 + for (prop = menu->sym->prop; prop; prop = prop->next) {
1.106 + if (prop->menu != menu)
1.107 + continue;
1.108 + prop->visible.expr = expr_alloc_and(expr_copy(basedep),
1.109 + prop->visible.expr);
1.110 + }
1.111 + }
1.112 menu_add_symbol(P_CHOICE, sym, NULL);
1.113 prop = sym_get_choice_prop(sym);
1.114 for (ep = &prop->expr; *ep; ep = &(*ep)->left.expr)
1.115 ;
1.116 - *ep = expr_alloc_one(E_CHOICE, NULL);
1.117 + *ep = expr_alloc_one(E_LIST, NULL);
1.118 (*ep)->right.sym = menu->sym;
1.119 }
1.120 if (menu->list && (!menu->prompt || !menu->prompt->text)) {
1.121 @@ -394,9 +416,9 @@
1.122 const char *menu_get_prompt(struct menu *menu)
1.123 {
1.124 if (menu->prompt)
1.125 - return _(menu->prompt->text);
1.126 + return menu->prompt->text;
1.127 else if (menu->sym)
1.128 - return _(menu->sym->name);
1.129 + return menu->sym->name;
1.130 return NULL;
1.131 }
1.132
1.133 @@ -417,3 +439,15 @@
1.134 return menu;
1.135 }
1.136
1.137 +bool menu_has_help(struct menu *menu)
1.138 +{
1.139 + return menu->help != NULL;
1.140 +}
1.141 +
1.142 +const char *menu_get_help(struct menu *menu)
1.143 +{
1.144 + if (menu->help)
1.145 + return menu->help;
1.146 + else
1.147 + return "";
1.148 +}