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 /scripts/config/expr.c | |
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
Diffstat (limited to 'scripts/config/expr.c')
-rw-r--r-- | scripts/config/expr.c | 50 |
1 files changed, 28 insertions, 22 deletions
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 | |||