diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /scripts/kconfig/menu.c | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'scripts/kconfig/menu.c')
-rw-r--r-- | scripts/kconfig/menu.c | 46 |
1 files changed, 40 insertions, 6 deletions
diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index edda8b49619d..5fdf10dc1d8a 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c | |||
@@ -10,7 +10,7 @@ | |||
10 | #include "lkc.h" | 10 | #include "lkc.h" |
11 | 11 | ||
12 | static const char nohelp_text[] = N_( | 12 | static const char nohelp_text[] = N_( |
13 | "There is no help available for this kernel option.\n"); | 13 | "There is no help available for this option.\n"); |
14 | 14 | ||
15 | struct menu rootmenu; | 15 | struct menu rootmenu; |
16 | static struct menu **last_entry_ptr; | 16 | static struct menu **last_entry_ptr; |
@@ -138,8 +138,22 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
138 | while (isspace(*prompt)) | 138 | while (isspace(*prompt)) |
139 | prompt++; | 139 | prompt++; |
140 | } | 140 | } |
141 | if (current_entry->prompt) | 141 | if (current_entry->prompt && current_entry != &rootmenu) |
142 | prop_warn(prop, "prompt redefined"); | 142 | prop_warn(prop, "prompt redefined"); |
143 | |||
144 | /* Apply all upper menus' visibilities to actual prompts. */ | ||
145 | if(type == P_PROMPT) { | ||
146 | struct menu *menu = current_entry; | ||
147 | |||
148 | while ((menu = menu->parent) != NULL) { | ||
149 | if (!menu->visibility) | ||
150 | continue; | ||
151 | prop->visible.expr | ||
152 | = expr_alloc_and(prop->visible.expr, | ||
153 | menu->visibility); | ||
154 | } | ||
155 | } | ||
156 | |||
143 | current_entry->prompt = prop; | 157 | current_entry->prompt = prop; |
144 | } | 158 | } |
145 | prop->text = prompt; | 159 | prop->text = prompt; |
@@ -152,6 +166,12 @@ struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr | |||
152 | return menu_add_prop(type, prompt, NULL, dep); | 166 | return menu_add_prop(type, prompt, NULL, dep); |
153 | } | 167 | } |
154 | 168 | ||
169 | void menu_add_visibility(struct expr *expr) | ||
170 | { | ||
171 | current_entry->visibility = expr_alloc_and(current_entry->visibility, | ||
172 | expr); | ||
173 | } | ||
174 | |||
155 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) | 175 | void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) |
156 | { | 176 | { |
157 | menu_add_prop(type, NULL, expr, dep); | 177 | menu_add_prop(type, NULL, expr, dep); |
@@ -183,7 +203,7 @@ void menu_add_option(int token, char *arg) | |||
183 | } | 203 | } |
184 | } | 204 | } |
185 | 205 | ||
186 | static int menu_range_valid_sym(struct symbol *sym, struct symbol *sym2) | 206 | static int menu_validate_number(struct symbol *sym, struct symbol *sym2) |
187 | { | 207 | { |
188 | return sym2->type == S_INT || sym2->type == S_HEX || | 208 | return sym2->type == S_INT || sym2->type == S_HEX || |
189 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); | 209 | (sym2->type == S_UNKNOWN && sym_string_valid(sym, sym2->name)); |
@@ -201,6 +221,15 @@ static void sym_check_prop(struct symbol *sym) | |||
201 | prop_warn(prop, | 221 | prop_warn(prop, |
202 | "default for config symbol '%s'" | 222 | "default for config symbol '%s'" |
203 | " must be a single symbol", sym->name); | 223 | " must be a single symbol", sym->name); |
224 | if (prop->expr->type != E_SYMBOL) | ||
225 | break; | ||
226 | sym2 = prop_get_symbol(prop); | ||
227 | if (sym->type == S_HEX || sym->type == S_INT) { | ||
228 | if (!menu_validate_number(sym, sym2)) | ||
229 | prop_warn(prop, | ||
230 | "'%s': number is invalid", | ||
231 | sym->name); | ||
232 | } | ||
204 | break; | 233 | break; |
205 | case P_SELECT: | 234 | case P_SELECT: |
206 | sym2 = prop_get_symbol(prop); | 235 | sym2 = prop_get_symbol(prop); |
@@ -220,8 +249,8 @@ static void sym_check_prop(struct symbol *sym) | |||
220 | if (sym->type != S_INT && sym->type != S_HEX) | 249 | if (sym->type != S_INT && sym->type != S_HEX) |
221 | prop_warn(prop, "range is only allowed " | 250 | prop_warn(prop, "range is only allowed " |
222 | "for int or hex symbols"); | 251 | "for int or hex symbols"); |
223 | if (!menu_range_valid_sym(sym, prop->expr->left.sym) || | 252 | if (!menu_validate_number(sym, prop->expr->left.sym) || |
224 | !menu_range_valid_sym(sym, prop->expr->right.sym)) | 253 | !menu_validate_number(sym, prop->expr->right.sym)) |
225 | prop_warn(prop, "range is invalid"); | 254 | prop_warn(prop, "range is invalid"); |
226 | break; | 255 | break; |
227 | default: | 256 | default: |
@@ -410,6 +439,11 @@ bool menu_is_visible(struct menu *menu) | |||
410 | if (!menu->prompt) | 439 | if (!menu->prompt) |
411 | return false; | 440 | return false; |
412 | 441 | ||
442 | if (menu->visibility) { | ||
443 | if (expr_calc_value(menu->visibility) == no) | ||
444 | return no; | ||
445 | } | ||
446 | |||
413 | sym = menu->sym; | 447 | sym = menu->sym; |
414 | if (sym) { | 448 | if (sym) { |
415 | sym_calc_value(sym); | 449 | sym_calc_value(sym); |
@@ -563,7 +597,7 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) | |||
563 | 597 | ||
564 | if (menu_has_help(menu)) { | 598 | if (menu_has_help(menu)) { |
565 | if (sym->name) { | 599 | if (sym->name) { |
566 | str_printf(help, "CONFIG_%s:\n\n", sym->name); | 600 | str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); |
567 | str_append(help, _(menu_get_help(menu))); | 601 | str_append(help, _(menu_get_help(menu))); |
568 | str_append(help, "\n"); | 602 | str_append(help, "\n"); |
569 | } | 603 | } |