diff options
author | Eric Andersen <andersen@codepoet.org> | 2004-07-15 06:01:05 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2004-07-15 06:01:05 +0000 |
commit | 837f058fb307e0bcf7b9ad4f02a44ea3047f427e (patch) | |
tree | bde5459d496b1afc91b7d4a261b66252a47ca414 | |
parent | 449f2bca967dc4682a52487fe4a53f13c3623002 (diff) | |
download | busybox-w32-837f058fb307e0bcf7b9ad4f02a44ea3047f427e.tar.gz busybox-w32-837f058fb307e0bcf7b9ad4f02a44ea3047f427e.tar.bz2 busybox-w32-837f058fb307e0bcf7b9ad4f02a44ea3047f427e.zip |
Peter Kjellerstedt at axis.com writes:
Hello,
the attached patch should bring extra/config in line
with the Linux 2.6.7 sources.
The following are the commit messages for the respective
files from the Linux bk-repository:
checklist.c:
* fix menuconfig choice item help display
confdata.c:
* config: choice fix
* kconfig: don't rename target dir when saving config
expr.c, expr.h:
* config: disable debug prints
mconf.c:
* fix menuconfig choice item help display
menu.c:
* Kconfig: use select statements
symbol.c:
* config: choice fix
* Avoid bogus warning about recursive dependencies
* c99 struct initialiser conversions
textbox.c:
* janitor: don't init statics to 0
util.c:
* fix lxdialog behaviour
//Peter
-rw-r--r-- | scripts/config/checklist.c | 17 | ||||
-rw-r--r-- | scripts/config/confdata.c | 12 | ||||
-rw-r--r-- | scripts/config/expr.c | 50 | ||||
-rw-r--r-- | scripts/config/expr.h | 1 | ||||
-rw-r--r-- | scripts/config/mconf.c | 19 | ||||
-rw-r--r-- | scripts/config/menu.c | 126 | ||||
-rw-r--r-- | scripts/config/symbol.c | 52 | ||||
-rw-r--r-- | scripts/config/textbox.c | 4 | ||||
-rw-r--r-- | scripts/config/util.c | 2 |
9 files changed, 174 insertions, 109 deletions
diff --git a/scripts/config/checklist.c b/scripts/config/checklist.c index 9744d798d..4dbd16616 100644 --- a/scripts/config/checklist.c +++ b/scripts/config/checklist.c | |||
@@ -138,10 +138,12 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
138 | 138 | ||
139 | /* Initializes status */ | 139 | /* Initializes status */ |
140 | for (i = 0; i < item_no; i++) { | 140 | for (i = 0; i < item_no; i++) { |
141 | status[i] = items[i]->selected; | 141 | status[i] = (items[i]->selected == 1); /* ON */ |
142 | if (!choice && status[i]) | 142 | if ((!choice && status[i]) || items[i]->selected == 2) /* SELECTED */ |
143 | choice = i; | 143 | choice = i + 1; |
144 | } | 144 | } |
145 | if (choice) | ||
146 | choice--; | ||
145 | 147 | ||
146 | max_choice = MIN (list_height, item_no); | 148 | max_choice = MIN (list_height, item_no); |
147 | 149 | ||
@@ -303,6 +305,9 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
303 | case 'H': | 305 | case 'H': |
304 | case 'h': | 306 | case 'h': |
305 | case '?': | 307 | case '?': |
308 | for (i = 0; i < item_no; i++) | ||
309 | items[i]->selected = 0; | ||
310 | items[scroll + choice]->selected = 1; | ||
306 | delwin (dialog); | 311 | delwin (dialog); |
307 | free (status); | 312 | free (status); |
308 | return 1; | 313 | return 1; |
@@ -341,7 +346,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
341 | for (i = 0; i < item_no; i++) { | 346 | for (i = 0; i < item_no; i++) { |
342 | items[i]->selected = status[i]; | 347 | items[i]->selected = status[i]; |
343 | } | 348 | } |
344 | } | 349 | } else { |
350 | for (i = 0; i < item_no; i++) | ||
351 | items[i]->selected = 0; | ||
352 | items[scroll + choice]->selected = 1; | ||
353 | } | ||
345 | delwin (dialog); | 354 | delwin (dialog); |
346 | free (status); | 355 | free (status); |
347 | return button; | 356 | return button; |
diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c index c46aea81d..fd3a345e2 100644 --- a/scripts/config/confdata.c +++ b/scripts/config/confdata.c | |||
@@ -225,6 +225,8 @@ int conf_read(const char *name) | |||
225 | } | 225 | } |
226 | fclose(in); | 226 | fclose(in); |
227 | 227 | ||
228 | if (modules_sym) | ||
229 | sym_calc_value(modules_sym); | ||
228 | for_all_symbols(i, sym) { | 230 | for_all_symbols(i, sym) { |
229 | sym_calc_value(sym); | 231 | sym_calc_value(sym); |
230 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { | 232 | if (sym_has_value(sym) && !sym_is_choice_value(sym)) { |
@@ -265,8 +267,14 @@ int conf_write(const char *name) | |||
265 | 267 | ||
266 | dirname[0] = 0; | 268 | dirname[0] = 0; |
267 | if (name && name[0]) { | 269 | if (name && name[0]) { |
268 | char *slash = strrchr(name, '/'); | 270 | struct stat st; |
269 | if (slash) { | 271 | char *slash; |
272 | |||
273 | if (!stat(name, &st) && S_ISDIR(st.st_mode)) { | ||
274 | strcpy(dirname, name); | ||
275 | strcat(dirname, "/"); | ||
276 | basename = conf_def_filename; | ||
277 | } else if ((slash = strrchr(name, '/'))) { | ||
270 | int size = slash - name + 1; | 278 | int size = slash - name + 1; |
271 | memcpy(dirname, name, size); | 279 | memcpy(dirname, name, size); |
272 | dirname[size] = 0; | 280 | dirname[size] = 0; |
diff --git a/scripts/config/expr.c b/scripts/config/expr.c index 3f15ae859..10f45232b 100644 --- a/scripts/config/expr.c +++ b/scripts/config/expr.c | |||
@@ -10,6 +10,8 @@ | |||
10 | #define LKC_DIRECT_LINK | 10 | #define LKC_DIRECT_LINK |
11 | #include "lkc.h" | 11 | #include "lkc.h" |
12 | 12 | ||
13 | #define DEBUG_EXPR 0 | ||
14 | |||
13 | struct expr *expr_alloc_symbol(struct symbol *sym) | 15 | struct expr *expr_alloc_symbol(struct symbol *sym) |
14 | { | 16 | { |
15 | struct expr *e = malloc(sizeof(*e)); | 17 | struct expr *e = malloc(sizeof(*e)); |
@@ -220,10 +222,12 @@ int expr_eq(struct expr *e1, struct expr *e2) | |||
220 | /* panic */; | 222 | /* panic */; |
221 | } | 223 | } |
222 | 224 | ||
223 | print_expr(0, e1, 0); | 225 | if (DEBUG_EXPR) { |
224 | printf(" = "); | 226 | expr_fprint(e1, stdout); |
225 | print_expr(0, e2, 0); | 227 | printf(" = "); |
226 | printf(" ?\n"); | 228 | expr_fprint(e2, stdout); |
229 | printf(" ?\n"); | ||
230 | } | ||
227 | 231 | ||
228 | return 0; | 232 | return 0; |
229 | } | 233 | } |
@@ -397,11 +401,13 @@ struct expr *expr_join_or(struct expr *e1, struct expr *e2) | |||
397 | return expr_alloc_symbol(&symbol_yes); | 401 | return expr_alloc_symbol(&symbol_yes); |
398 | } | 402 | } |
399 | 403 | ||
400 | printf("optimize "); | 404 | if (DEBUG_EXPR) { |
401 | print_expr(0, e1, 0); | 405 | printf("optimize ("); |
402 | printf(" || "); | 406 | expr_fprint(e1, stdout); |
403 | print_expr(0, e2, 0); | 407 | printf(") || ("); |
404 | printf(" ?\n"); | 408 | expr_fprint(e2, stdout); |
409 | printf(")?\n"); | ||
410 | } | ||
405 | return NULL; | 411 | return NULL; |
406 | } | 412 | } |
407 | 413 | ||
@@ -444,6 +450,11 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2) | |||
444 | // (a) && (a!='n') -> (a) | 450 | // (a) && (a!='n') -> (a) |
445 | return expr_alloc_symbol(sym1); | 451 | return expr_alloc_symbol(sym1); |
446 | 452 | ||
453 | if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || | ||
454 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) | ||
455 | // (a) && (a!='m') -> (a='y') | ||
456 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
457 | |||
447 | if (sym1->type == S_TRISTATE) { | 458 | if (sym1->type == S_TRISTATE) { |
448 | if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { | 459 | if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { |
449 | // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' | 460 | // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' |
@@ -483,11 +494,14 @@ struct expr *expr_join_and(struct expr *e1, struct expr *e2) | |||
483 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) | 494 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) |
484 | return NULL; | 495 | return NULL; |
485 | } | 496 | } |
486 | printf("optimize "); | 497 | |
487 | print_expr(0, e1, 0); | 498 | if (DEBUG_EXPR) { |
488 | printf(" && "); | 499 | printf("optimize ("); |
489 | print_expr(0, e2, 0); | 500 | expr_fprint(e1, stdout); |
490 | printf(" ?\n"); | 501 | printf(") && ("); |
502 | expr_fprint(e2, stdout); | ||
503 | printf(")?\n"); | ||
504 | } | ||
491 | return NULL; | 505 | return NULL; |
492 | } | 506 | } |
493 | 507 | ||
@@ -1073,11 +1087,3 @@ void expr_fprint(struct expr *e, FILE *out) | |||
1073 | { | 1087 | { |
1074 | expr_print(e, expr_print_file_helper, out, E_NONE); | 1088 | expr_print(e, expr_print_file_helper, out, E_NONE); |
1075 | } | 1089 | } |
1076 | |||
1077 | void print_expr(int mask, struct expr *e, int prevtoken) | ||
1078 | { | ||
1079 | if (!(cdebug & mask)) | ||
1080 | return; | ||
1081 | expr_fprint(e, stdout); | ||
1082 | } | ||
1083 | |||
diff --git a/scripts/config/expr.h b/scripts/config/expr.h index cc616f1f8..cac51f6a8 100644 --- a/scripts/config/expr.h +++ b/scripts/config/expr.h | |||
@@ -174,7 +174,6 @@ void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, s | |||
174 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); | 174 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); |
175 | 175 | ||
176 | void expr_fprint(struct expr *e, FILE *out); | 176 | void expr_fprint(struct expr *e, FILE *out); |
177 | void print_expr(int mask, struct expr *e, int prevtoken); | ||
178 | 177 | ||
179 | static inline int expr_is_yes(struct expr *e) | 178 | static inline int expr_is_yes(struct expr *e) |
180 | { | 179 | { |
diff --git a/scripts/config/mconf.c b/scripts/config/mconf.c index fe4562b17..0ac3a8d07 100644 --- a/scripts/config/mconf.c +++ b/scripts/config/mconf.c | |||
@@ -515,9 +515,9 @@ static void conf_choice(struct menu *menu) | |||
515 | struct menu *child; | 515 | struct menu *child; |
516 | struct symbol *active; | 516 | struct symbol *active; |
517 | 517 | ||
518 | active = sym_get_choice_value(menu->sym); | ||
518 | while (1) { | 519 | while (1) { |
519 | current_menu = menu; | 520 | current_menu = menu; |
520 | active = sym_get_choice_value(menu->sym); | ||
521 | cdone(); cinit(); | 521 | cdone(); cinit(); |
522 | for (child = menu->list; child; child = child->next) { | 522 | for (child = menu->list; child; child = child->next) { |
523 | if (!menu_is_visible(child)) | 523 | if (!menu_is_visible(child)) |
@@ -525,19 +525,28 @@ static void conf_choice(struct menu *menu) | |||
525 | cmake(); | 525 | cmake(); |
526 | cprint_tag("%p", child); | 526 | cprint_tag("%p", child); |
527 | cprint_name("%s", menu_get_prompt(child)); | 527 | cprint_name("%s", menu_get_prompt(child)); |
528 | items[item_no - 1]->selected = (child->sym == active); | 528 | if (child->sym == sym_get_choice_value(menu->sym)) |
529 | items[item_no - 1]->selected = 1; /* ON */ | ||
530 | else if (child->sym == active) | ||
531 | items[item_no - 1]->selected = 2; /* SELECTED */ | ||
532 | else | ||
533 | items[item_no - 1]->selected = 0; /* OFF */ | ||
529 | } | 534 | } |
530 | 535 | ||
531 | switch (dialog_checklist(prompt ? prompt : "Main Menu", | 536 | switch (dialog_checklist(prompt ? prompt : "Main Menu", |
532 | radiolist_instructions, 15, 70, 6, | 537 | radiolist_instructions, 15, 70, 6, |
533 | item_no, items, FLAG_RADIO)) { | 538 | item_no, items, FLAG_RADIO)) { |
534 | case 0: | 539 | case 0: |
535 | if (sscanf(first_sel_item(item_no, items)->tag, "%p", &menu) != 1) | 540 | if (sscanf(first_sel_item(item_no, items)->tag, "%p", &child) != 1) |
536 | break; | 541 | break; |
537 | sym_set_tristate_value(menu->sym, yes); | 542 | sym_set_tristate_value(child->sym, yes); |
538 | return; | 543 | return; |
539 | case 1: | 544 | case 1: |
540 | show_help(menu); | 545 | if (sscanf(first_sel_item(item_no, items)->tag, "%p", &child) == 1) { |
546 | show_help(child); | ||
547 | active = child->sym; | ||
548 | } else | ||
549 | show_help(menu); | ||
541 | break; | 550 | break; |
542 | case 255: | 551 | case 255: |
543 | return; | 552 | return; |
diff --git a/scripts/config/menu.c b/scripts/config/menu.c index 9b8d389e6..6425296fc 100644 --- a/scripts/config/menu.c +++ b/scripts/config/menu.c | |||
@@ -16,6 +16,26 @@ static struct menu **last_entry_ptr; | |||
16 | struct file *file_list; | 16 | struct file *file_list; |
17 | struct file *current_file; | 17 | struct file *current_file; |
18 | 18 | ||
19 | static void menu_warn(struct menu *menu, const char *fmt, ...) | ||
20 | { | ||
21 | va_list ap; | ||
22 | va_start(ap, fmt); | ||
23 | fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno); | ||
24 | vfprintf(stderr, fmt, ap); | ||
25 | fprintf(stderr, "\n"); | ||
26 | va_end(ap); | ||
27 | } | ||
28 | |||
29 | static void prop_warn(struct property *prop, const char *fmt, ...) | ||
30 | { | ||
31 | va_list ap; | ||
32 | va_start(ap, fmt); | ||
33 | fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno); | ||
34 | vfprintf(stderr, fmt, ap); | ||
35 | fprintf(stderr, "\n"); | ||
36 | va_end(ap); | ||
37 | } | ||
38 | |||
19 | void menu_init(void) | 39 | void menu_init(void) |
20 | { | 40 | { |
21 | current_entry = current_menu = &rootmenu; | 41 | current_entry = current_menu = &rootmenu; |
@@ -94,9 +114,9 @@ void menu_set_type(int type) | |||
94 | sym->type = type; | 114 | sym->type = type; |
95 | return; | 115 | return; |
96 | } | 116 | } |
97 | fprintf(stderr, "%s:%d:warning: type of '%s' redefined from '%s' to '%s'\n", | 117 | menu_warn(current_entry, "type of '%s' redefined from '%s' to '%s'\n", |
98 | current_entry->file->name, current_entry->lineno, | 118 | sym->name ? sym->name : "<choice>", |
99 | sym->name ? sym->name : "<choice>", sym_type_name(sym->type), sym_type_name(type)); | 119 | sym_type_name(sym->type), sym_type_name(type)); |
100 | } | 120 | } |
101 | 121 | ||
102 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) | 122 | struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) |
@@ -110,8 +130,7 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e | |||
110 | 130 | ||
111 | if (prompt) { | 131 | if (prompt) { |
112 | if (current_entry->prompt) | 132 | if (current_entry->prompt) |
113 | fprintf(stderr, "%s:%d: prompt redefined\n", | 133 | menu_warn(current_entry, "prompt redefined\n"); |
114 | current_entry->file->name, current_entry->lineno); | ||
115 | current_entry->prompt = prop; | 134 | current_entry->prompt = prop; |
116 | } | 135 | } |
117 | 136 | ||
@@ -133,6 +152,50 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) | |||
133 | menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); | 152 | menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); |
134 | } | 153 | } |
135 | 154 | ||
155 | void sym_check_prop(struct symbol *sym) | ||
156 | { | ||
157 | struct property *prop; | ||
158 | struct symbol *sym2; | ||
159 | for (prop = sym->prop; prop; prop = prop->next) { | ||
160 | switch (prop->type) { | ||
161 | case P_DEFAULT: | ||
162 | if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) && | ||
163 | prop->expr->type != E_SYMBOL) | ||
164 | prop_warn(prop, | ||
165 | "default for config symbol '%'" | ||
166 | " must be a single symbol", sym->name); | ||
167 | break; | ||
168 | case P_SELECT: | ||
169 | sym2 = prop_get_symbol(prop); | ||
170 | if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE) | ||
171 | prop_warn(prop, | ||
172 | "config symbol '%s' uses select, but is " | ||
173 | "not boolean or tristate", sym->name); | ||
174 | else if (sym2->type == S_UNKNOWN) | ||
175 | prop_warn(prop, | ||
176 | "'select' used by config symbol '%s' " | ||
177 | "refer to undefined symbol '%s'", | ||
178 | sym->name, sym2->name); | ||
179 | else if (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE) | ||
180 | prop_warn(prop, | ||
181 | "'%s' has wrong type. 'select' only " | ||
182 | "accept arguments of boolean and " | ||
183 | "tristate type", sym2->name); | ||
184 | break; | ||
185 | case P_RANGE: | ||
186 | if (sym->type != S_INT && sym->type != S_HEX) | ||
187 | prop_warn(prop, "range is only allowed " | ||
188 | "for int or hex symbols"); | ||
189 | if (!sym_string_valid(sym, prop->expr->left.sym->name) || | ||
190 | !sym_string_valid(sym, prop->expr->right.sym->name)) | ||
191 | prop_warn(prop, "range is invalid"); | ||
192 | break; | ||
193 | default: | ||
194 | ; | ||
195 | } | ||
196 | } | ||
197 | } | ||
198 | |||
136 | void menu_finalize(struct menu *parent) | 199 | void menu_finalize(struct menu *parent) |
137 | { | 200 | { |
138 | struct menu *menu, *last_menu; | 201 | struct menu *menu, *last_menu; |
@@ -222,17 +285,16 @@ void menu_finalize(struct menu *parent) | |||
222 | if (sym && sym_is_choice(sym) && menu->sym) { | 285 | if (sym && sym_is_choice(sym) && menu->sym) { |
223 | menu->sym->flags |= SYMBOL_CHOICEVAL; | 286 | menu->sym->flags |= SYMBOL_CHOICEVAL; |
224 | if (!menu->prompt) | 287 | if (!menu->prompt) |
225 | fprintf(stderr, "%s:%d:warning: choice value must have a prompt\n", | 288 | menu_warn(menu, "choice value must have a prompt"); |
226 | menu->file->name, menu->lineno); | ||
227 | for (prop = menu->sym->prop; prop; prop = prop->next) { | 289 | for (prop = menu->sym->prop; prop; prop = prop->next) { |
228 | if (prop->type == P_PROMPT && prop->menu != menu) { | 290 | if (prop->type == P_PROMPT && prop->menu != menu) { |
229 | fprintf(stderr, "%s:%d:warning: choice values currently only support a single prompt\n", | 291 | prop_warn(prop, "choice values " |
230 | prop->file->name, prop->lineno); | 292 | "currently only support a " |
231 | 293 | "single prompt"); | |
232 | } | 294 | } |
233 | if (prop->type == P_DEFAULT) | 295 | if (prop->type == P_DEFAULT) |
234 | fprintf(stderr, "%s:%d:warning: defaults for choice values not supported\n", | 296 | prop_warn(prop, "defaults for choice " |
235 | prop->file->name, prop->lineno); | 297 | "values not supported"); |
236 | } | 298 | } |
237 | current_entry = menu; | 299 | current_entry = menu; |
238 | menu_set_type(sym->type); | 300 | menu_set_type(sym->type); |
@@ -256,43 +318,15 @@ void menu_finalize(struct menu *parent) | |||
256 | } | 318 | } |
257 | 319 | ||
258 | if (sym && !(sym->flags & SYMBOL_WARNED)) { | 320 | if (sym && !(sym->flags & SYMBOL_WARNED)) { |
259 | struct symbol *sym2; | ||
260 | if (sym->type == S_UNKNOWN) | 321 | if (sym->type == S_UNKNOWN) |
261 | fprintf(stderr, "%s:%d:warning: config symbol defined without type\n", | 322 | menu_warn(parent, "config symbol defined " |
262 | parent->file->name, parent->lineno); | 323 | "without type\n"); |
263 | 324 | ||
264 | if (sym_is_choice(sym) && !parent->prompt) | 325 | if (sym_is_choice(sym) && !parent->prompt) |
265 | fprintf(stderr, "%s:%d:warning: choice must have a prompt\n", | 326 | menu_warn(parent, "choice must have a prompt\n"); |
266 | parent->file->name, parent->lineno); | 327 | |
267 | 328 | /* Check properties connected to this symbol */ | |
268 | for (prop = sym->prop; prop; prop = prop->next) { | 329 | sym_check_prop(sym); |
269 | switch (prop->type) { | ||
270 | case P_DEFAULT: | ||
271 | if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) && | ||
272 | prop->expr->type != E_SYMBOL) | ||
273 | fprintf(stderr, "%s:%d:warning: default must be a single symbol\n", | ||
274 | prop->file->name, prop->lineno); | ||
275 | break; | ||
276 | case P_SELECT: | ||
277 | sym2 = prop_get_symbol(prop); | ||
278 | if ((sym->type != S_BOOLEAN && sym->type != S_TRISTATE) || | ||
279 | (sym2->type != S_BOOLEAN && sym2->type != S_TRISTATE)) | ||
280 | fprintf(stderr, "%s:%d:warning: enable is only allowed with boolean and tristate symbols\n", | ||
281 | prop->file->name, prop->lineno); | ||
282 | break; | ||
283 | case P_RANGE: | ||
284 | if (sym->type != S_INT && sym->type != S_HEX) | ||
285 | fprintf(stderr, "%s:%d:warning: range is only allowed for int or hex symbols\n", | ||
286 | prop->file->name, prop->lineno); | ||
287 | if (!sym_string_valid(sym, prop->expr->left.sym->name) || | ||
288 | !sym_string_valid(sym, prop->expr->right.sym->name)) | ||
289 | fprintf(stderr, "%s:%d:warning: range is invalid\n", | ||
290 | prop->file->name, prop->lineno); | ||
291 | break; | ||
292 | default: | ||
293 | ; | ||
294 | } | ||
295 | } | ||
296 | sym->flags |= SYMBOL_WARNED; | 330 | sym->flags |= SYMBOL_WARNED; |
297 | } | 331 | } |
298 | 332 | ||
diff --git a/scripts/config/symbol.c b/scripts/config/symbol.c index 29d8d3e0b..a9fae9c13 100644 --- a/scripts/config/symbol.c +++ b/scripts/config/symbol.c | |||
@@ -12,25 +12,26 @@ | |||
12 | #include "lkc.h" | 12 | #include "lkc.h" |
13 | 13 | ||
14 | struct symbol symbol_yes = { | 14 | struct symbol symbol_yes = { |
15 | name: "y", | 15 | .name = "y", |
16 | curr: { "y", yes }, | 16 | .curr = { "y", yes }, |
17 | flags: SYMBOL_YES|SYMBOL_VALID, | 17 | .flags = SYMBOL_YES|SYMBOL_VALID, |
18 | }, symbol_mod = { | 18 | }, symbol_mod = { |
19 | name: "m", | 19 | .name = "m", |
20 | curr: { "m", mod }, | 20 | .curr = { "m", mod }, |
21 | flags: SYMBOL_MOD|SYMBOL_VALID, | 21 | .flags = SYMBOL_MOD|SYMBOL_VALID, |
22 | }, symbol_no = { | 22 | }, symbol_no = { |
23 | name: "n", | 23 | .name = "n", |
24 | curr: { "n", no }, | 24 | .curr = { "n", no }, |
25 | flags: SYMBOL_NO|SYMBOL_VALID, | 25 | .flags = SYMBOL_NO|SYMBOL_VALID, |
26 | }, symbol_empty = { | 26 | }, symbol_empty = { |
27 | name: "", | 27 | .name = "", |
28 | curr: { "", no }, | 28 | .curr = { "", no }, |
29 | flags: SYMBOL_VALID, | 29 | .flags = SYMBOL_VALID, |
30 | }; | 30 | }; |
31 | 31 | ||
32 | int sym_change_count; | 32 | int sym_change_count; |
33 | struct symbol *modules_sym; | 33 | struct symbol *modules_sym; |
34 | tristate modules_val; | ||
34 | 35 | ||
35 | void sym_add_default(struct symbol *sym, const char *def) | 36 | void sym_add_default(struct symbol *sym, const char *def) |
36 | { | 37 | { |
@@ -72,11 +73,8 @@ enum symbol_type sym_get_type(struct symbol *sym) | |||
72 | if (type == S_TRISTATE) { | 73 | if (type == S_TRISTATE) { |
73 | if (sym_is_choice_value(sym) && sym->visible == yes) | 74 | if (sym_is_choice_value(sym) && sym->visible == yes) |
74 | type = S_BOOLEAN; | 75 | type = S_BOOLEAN; |
75 | else { | 76 | else if (modules_val == no) |
76 | sym_calc_value(modules_sym); | 77 | type = S_BOOLEAN; |
77 | if (modules_sym->curr.tri == no) | ||
78 | type = S_BOOLEAN; | ||
79 | } | ||
80 | } | 78 | } |
81 | return type; | 79 | return type; |
82 | } | 80 | } |
@@ -146,6 +144,8 @@ static void sym_calc_visibility(struct symbol *sym) | |||
146 | prop->visible.tri = expr_calc_value(prop->visible.expr); | 144 | prop->visible.tri = expr_calc_value(prop->visible.expr); |
147 | tri = E_OR(tri, prop->visible.tri); | 145 | tri = E_OR(tri, prop->visible.tri); |
148 | } | 146 | } |
147 | if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) | ||
148 | tri = yes; | ||
149 | if (sym->visible != tri) { | 149 | if (sym->visible != tri) { |
150 | sym->visible = tri; | 150 | sym->visible = tri; |
151 | sym_set_changed(sym); | 151 | sym_set_changed(sym); |
@@ -155,6 +155,8 @@ static void sym_calc_visibility(struct symbol *sym) | |||
155 | tri = no; | 155 | tri = no; |
156 | if (sym->rev_dep.expr) | 156 | if (sym->rev_dep.expr) |
157 | tri = expr_calc_value(sym->rev_dep.expr); | 157 | tri = expr_calc_value(sym->rev_dep.expr); |
158 | if (tri == mod && sym_get_type(sym) == S_BOOLEAN) | ||
159 | tri = yes; | ||
158 | if (sym->rev_dep.tri != tri) { | 160 | if (sym->rev_dep.tri != tri) { |
159 | sym->rev_dep.tri = tri; | 161 | sym->rev_dep.tri = tri; |
160 | sym_set_changed(sym); | 162 | sym_set_changed(sym); |
@@ -261,14 +263,8 @@ void sym_calc_value(struct symbol *sym) | |||
261 | newval.tri = expr_calc_value(prop->expr); | 263 | newval.tri = expr_calc_value(prop->expr); |
262 | } | 264 | } |
263 | } | 265 | } |
264 | if (sym_get_type(sym) == S_BOOLEAN) { | 266 | if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) |
265 | if (newval.tri == mod) | 267 | newval.tri = yes; |
266 | newval.tri = yes; | ||
267 | if (sym->visible == mod) | ||
268 | sym->visible = yes; | ||
269 | if (sym->rev_dep.tri == mod) | ||
270 | sym->rev_dep.tri = yes; | ||
271 | } | ||
272 | break; | 268 | break; |
273 | case S_STRING: | 269 | case S_STRING: |
274 | case S_HEX: | 270 | case S_HEX: |
@@ -300,6 +296,8 @@ void sym_calc_value(struct symbol *sym) | |||
300 | 296 | ||
301 | if (memcmp(&oldval, &sym->curr, sizeof(oldval))) | 297 | if (memcmp(&oldval, &sym->curr, sizeof(oldval))) |
302 | sym_set_changed(sym); | 298 | sym_set_changed(sym); |
299 | if (modules_sym == sym) | ||
300 | modules_val = modules_sym->curr.tri; | ||
303 | 301 | ||
304 | if (sym_is_choice(sym)) { | 302 | if (sym_is_choice(sym)) { |
305 | int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); | 303 | int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); |
@@ -320,6 +318,8 @@ void sym_clear_all_valid(void) | |||
320 | for_all_symbols(i, sym) | 318 | for_all_symbols(i, sym) |
321 | sym->flags &= ~SYMBOL_VALID; | 319 | sym->flags &= ~SYMBOL_VALID; |
322 | sym_change_count++; | 320 | sym_change_count++; |
321 | if (modules_sym) | ||
322 | sym_calc_value(modules_sym); | ||
323 | } | 323 | } |
324 | 324 | ||
325 | void sym_set_changed(struct symbol *sym) | 325 | void sym_set_changed(struct symbol *sym) |
@@ -699,7 +699,7 @@ struct symbol *sym_check_deps(struct symbol *sym) | |||
699 | goto out; | 699 | goto out; |
700 | 700 | ||
701 | for (prop = sym->prop; prop; prop = prop->next) { | 701 | for (prop = sym->prop; prop; prop = prop->next) { |
702 | if (prop->type == P_CHOICE) | 702 | if (prop->type == P_CHOICE || prop->type == P_SELECT) |
703 | continue; | 703 | continue; |
704 | sym2 = sym_check_expr_deps(prop->visible.expr); | 704 | sym2 = sym_check_expr_deps(prop->visible.expr); |
705 | if (sym2) | 705 | if (sym2) |
diff --git a/scripts/config/textbox.c b/scripts/config/textbox.c index 8fe907718..a5a460b5c 100644 --- a/scripts/config/textbox.c +++ b/scripts/config/textbox.c | |||
@@ -27,8 +27,8 @@ static void print_line (WINDOW * win, int row, int width); | |||
27 | static char *get_line (void); | 27 | static char *get_line (void); |
28 | static void print_position (WINDOW * win, int height, int width); | 28 | static void print_position (WINDOW * win, int height, int width); |
29 | 29 | ||
30 | static int hscroll = 0, fd, file_size, bytes_read; | 30 | static int hscroll, fd, file_size, bytes_read; |
31 | static int begin_reached = 1, end_reached = 0, page_length; | 31 | static int begin_reached = 1, end_reached, page_length; |
32 | static char *buf, *page; | 32 | static char *buf, *page; |
33 | 33 | ||
34 | /* | 34 | /* |
diff --git a/scripts/config/util.c b/scripts/config/util.c index 104ff0e4c..0a2f82757 100644 --- a/scripts/config/util.c +++ b/scripts/config/util.c | |||
@@ -348,7 +348,7 @@ first_alpha(const char *string, const char *exempt) | |||
348 | c = tolower(string[i]); | 348 | c = tolower(string[i]); |
349 | 349 | ||
350 | if (strchr("<[(", c)) ++in_paren; | 350 | if (strchr("<[(", c)) ++in_paren; |
351 | if (strchr(">])", c)) --in_paren; | 351 | if (strchr(">])", c) && in_paren > 0) --in_paren; |
352 | 352 | ||
353 | if ((! in_paren) && isalpha(c) && | 353 | if ((! in_paren) && isalpha(c) && |
354 | strchr(exempt, c) == 0) | 354 | strchr(exempt, c) == 0) |