Lines Matching +full:left +full:- +full:right

1 // SPDX-License-Identifier: GPL-2.0
3 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
21 e->type = E_SYMBOL; in expr_alloc_symbol()
22 e->left.sym = sym; in expr_alloc_symbol()
29 e->type = type; in expr_alloc_one()
30 e->left.expr = ce; in expr_alloc_one()
37 e->type = type; in expr_alloc_two()
38 e->left.expr = e1; in expr_alloc_two()
39 e->right.expr = e2; in expr_alloc_two()
46 e->type = type; in expr_alloc_comp()
47 e->left.sym = s1; in expr_alloc_comp()
48 e->right.sym = s2; in expr_alloc_comp()
75 switch (org->type) { in expr_copy()
77 e->left = org->left; in expr_copy()
80 e->left.expr = expr_copy(org->left.expr); in expr_copy()
88 e->left.sym = org->left.sym; in expr_copy()
89 e->right.sym = org->right.sym; in expr_copy()
94 e->left.expr = expr_copy(org->left.expr); in expr_copy()
95 e->right.expr = expr_copy(org->right.expr); in expr_copy()
98 fprintf(stderr, "can't copy type %d\n", e->type); in expr_copy()
112 switch (e->type) { in expr_free()
116 expr_free(e->left.expr); in expr_free()
127 expr_free(e->left.expr); in expr_free()
128 expr_free(e->right.expr); in expr_free()
131 fprintf(stderr, "how to free type %d?\n", e->type); in expr_free()
154 if (e1->type == type) { in __expr_eliminate_eq()
155 __expr_eliminate_eq(type, &e1->left.expr, &e2); in __expr_eliminate_eq()
156 __expr_eliminate_eq(type, &e1->right.expr, &e2); in __expr_eliminate_eq()
159 if (e2->type == type) { in __expr_eliminate_eq()
160 __expr_eliminate_eq(type, &e1, &e2->left.expr); in __expr_eliminate_eq()
161 __expr_eliminate_eq(type, &e1, &e2->right.expr); in __expr_eliminate_eq()
167 if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && in __expr_eliminate_eq()
168 e1->left.sym == e2->left.sym && in __expr_eliminate_eq()
169 (e1->left.sym == &symbol_yes || e1->left.sym == &symbol_no)) in __expr_eliminate_eq()
196 * ep1: A && B -> ep1: y
197 * ep2: A && B && C -> ep2: C
199 * ep1: A || B -> ep1: n
200 * ep2: A || B || C -> ep2: C
202 * ep1: A && (B && FOO) -> ep1: FOO
203 * ep2: (BAR && B) && A -> ep2: BAR
205 * ep1: A && (B || C) -> ep1: y
206 * ep2: (C || B) && A -> ep2: y
212 * - 'e1', 'e2 || e3', and 'e4 || e5', against each other
213 * - e2 against e3
214 * - e4 against e5
225 switch (e1->type) { in expr_eliminate_eq()
228 __expr_eliminate_eq(e1->type, ep1, ep2); in expr_eliminate_eq()
232 if (e1->type != e2->type) switch (e2->type) { in expr_eliminate_eq()
235 __expr_eliminate_eq(e2->type, ep1, ep2); in expr_eliminate_eq()
263 if (e1->type != e2->type) in expr_eq()
265 switch (e1->type) { in expr_eq()
272 return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym; in expr_eq()
274 return e1->left.sym == e2->left.sym; in expr_eq()
276 return expr_eq(e1->left.expr, e2->left.expr); in expr_eq()
283 res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL && in expr_eq()
284 e1->left.sym == e2->left.sym); in expr_eq()
306 * Recursively performs the following simplifications in-place (as well as the
309 * expr && n -> n
310 * expr && y -> expr
311 * expr || n -> expr
312 * expr || y -> y
320 if (e) switch (e->type) { in expr_eliminate_yn()
322 e->left.expr = expr_eliminate_yn(e->left.expr); in expr_eliminate_yn()
323 e->right.expr = expr_eliminate_yn(e->right.expr); in expr_eliminate_yn()
324 if (e->left.expr->type == E_SYMBOL) { in expr_eliminate_yn()
325 if (e->left.expr->left.sym == &symbol_no) { in expr_eliminate_yn()
326 expr_free(e->left.expr); in expr_eliminate_yn()
327 expr_free(e->right.expr); in expr_eliminate_yn()
328 e->type = E_SYMBOL; in expr_eliminate_yn()
329 e->left.sym = &symbol_no; in expr_eliminate_yn()
330 e->right.expr = NULL; in expr_eliminate_yn()
332 } else if (e->left.expr->left.sym == &symbol_yes) { in expr_eliminate_yn()
333 free(e->left.expr); in expr_eliminate_yn()
334 tmp = e->right.expr; in expr_eliminate_yn()
335 *e = *(e->right.expr); in expr_eliminate_yn()
340 if (e->right.expr->type == E_SYMBOL) { in expr_eliminate_yn()
341 if (e->right.expr->left.sym == &symbol_no) { in expr_eliminate_yn()
342 expr_free(e->left.expr); in expr_eliminate_yn()
343 expr_free(e->right.expr); in expr_eliminate_yn()
344 e->type = E_SYMBOL; in expr_eliminate_yn()
345 e->left.sym = &symbol_no; in expr_eliminate_yn()
346 e->right.expr = NULL; in expr_eliminate_yn()
348 } else if (e->right.expr->left.sym == &symbol_yes) { in expr_eliminate_yn()
349 free(e->right.expr); in expr_eliminate_yn()
350 tmp = e->left.expr; in expr_eliminate_yn()
351 *e = *(e->left.expr); in expr_eliminate_yn()
358 e->left.expr = expr_eliminate_yn(e->left.expr); in expr_eliminate_yn()
359 e->right.expr = expr_eliminate_yn(e->right.expr); in expr_eliminate_yn()
360 if (e->left.expr->type == E_SYMBOL) { in expr_eliminate_yn()
361 if (e->left.expr->left.sym == &symbol_no) { in expr_eliminate_yn()
362 free(e->left.expr); in expr_eliminate_yn()
363 tmp = e->right.expr; in expr_eliminate_yn()
364 *e = *(e->right.expr); in expr_eliminate_yn()
367 } else if (e->left.expr->left.sym == &symbol_yes) { in expr_eliminate_yn()
368 expr_free(e->left.expr); in expr_eliminate_yn()
369 expr_free(e->right.expr); in expr_eliminate_yn()
370 e->type = E_SYMBOL; in expr_eliminate_yn()
371 e->left.sym = &symbol_yes; in expr_eliminate_yn()
372 e->right.expr = NULL; in expr_eliminate_yn()
376 if (e->right.expr->type == E_SYMBOL) { in expr_eliminate_yn()
377 if (e->right.expr->left.sym == &symbol_no) { in expr_eliminate_yn()
378 free(e->right.expr); in expr_eliminate_yn()
379 tmp = e->left.expr; in expr_eliminate_yn()
380 *e = *(e->left.expr); in expr_eliminate_yn()
383 } else if (e->right.expr->left.sym == &symbol_yes) { in expr_eliminate_yn()
384 expr_free(e->left.expr); in expr_eliminate_yn()
385 expr_free(e->right.expr); in expr_eliminate_yn()
386 e->type = E_SYMBOL; in expr_eliminate_yn()
387 e->left.sym = &symbol_yes; in expr_eliminate_yn()
388 e->right.expr = NULL; in expr_eliminate_yn()
400 * e1 || e2 -> ?
409 if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) in expr_join_or()
411 if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) in expr_join_or()
413 if (e1->type == E_NOT) { in expr_join_or()
414 tmp = e1->left.expr; in expr_join_or()
415 if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) in expr_join_or()
417 sym1 = tmp->left.sym; in expr_join_or()
419 sym1 = e1->left.sym; in expr_join_or()
420 if (e2->type == E_NOT) { in expr_join_or()
421 if (e2->left.expr->type != E_SYMBOL) in expr_join_or()
423 sym2 = e2->left.expr->left.sym; in expr_join_or()
425 sym2 = e2->left.sym; in expr_join_or()
428 if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) in expr_join_or()
430 if (sym1->type == S_TRISTATE) { in expr_join_or()
431 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
432 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || in expr_join_or()
433 (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) { in expr_join_or()
434 // (a='y') || (a='m') -> (a!='n') in expr_join_or()
437 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
438 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || in expr_join_or()
439 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) { in expr_join_or()
440 // (a='y') || (a='n') -> (a!='m') in expr_join_or()
443 if (e1->type == E_EQUAL && e2->type == E_EQUAL && in expr_join_or()
444 ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || in expr_join_or()
445 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) { in expr_join_or()
446 // (a='m') || (a='n') -> (a!='y') in expr_join_or()
450 if (sym1->type == S_BOOLEAN && sym1 == sym2) { in expr_join_or()
451 if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || in expr_join_or()
452 (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) in expr_join_or()
473 if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) in expr_join_and()
475 if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) in expr_join_and()
477 if (e1->type == E_NOT) { in expr_join_and()
478 tmp = e1->left.expr; in expr_join_and()
479 if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) in expr_join_and()
481 sym1 = tmp->left.sym; in expr_join_and()
483 sym1 = e1->left.sym; in expr_join_and()
484 if (e2->type == E_NOT) { in expr_join_and()
485 if (e2->left.expr->type != E_SYMBOL) in expr_join_and()
487 sym2 = e2->left.expr->left.sym; in expr_join_and()
489 sym2 = e2->left.sym; in expr_join_and()
492 if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) in expr_join_and()
495 if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) || in expr_join_and()
496 (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes)) in expr_join_and()
497 // (a) && (a='y') -> (a='y') in expr_join_and()
500 if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) || in expr_join_and()
501 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no)) in expr_join_and()
502 // (a) && (a!='n') -> (a) in expr_join_and()
505 if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_mod) || in expr_join_and()
506 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_mod)) in expr_join_and()
507 // (a) && (a!='m') -> (a='y') in expr_join_and()
510 if (sym1->type == S_TRISTATE) { in expr_join_and()
511 if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { in expr_join_and()
512 // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' in expr_join_and()
513 sym2 = e1->right.sym; in expr_join_and()
514 if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) in expr_join_and()
515 return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) in expr_join_and()
518 if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) { in expr_join_and()
519 // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' in expr_join_and()
520 sym2 = e2->right.sym; in expr_join_and()
521 if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) in expr_join_and()
522 return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) in expr_join_and()
525 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
526 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || in expr_join_and()
527 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) in expr_join_and()
528 // (a!='y') && (a!='n') -> (a='m') in expr_join_and()
531 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
532 ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || in expr_join_and()
533 (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) in expr_join_and()
534 // (a!='y') && (a!='m') -> (a='n') in expr_join_and()
537 if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && in expr_join_and()
538 ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || in expr_join_and()
539 (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) in expr_join_and()
540 // (a!='m') && (a!='n') -> (a='m') in expr_join_and()
543 if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) || in expr_join_and()
544 (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) || in expr_join_and()
545 (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) || in expr_join_and()
546 (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) in expr_join_and()
575 if (e1->type == type) { in expr_eliminate_dups1()
576 expr_eliminate_dups1(type, &e1->left.expr, &e2); in expr_eliminate_dups1()
577 expr_eliminate_dups1(type, &e1->right.expr, &e2); in expr_eliminate_dups1()
580 if (e2->type == type) { in expr_eliminate_dups1()
581 expr_eliminate_dups1(type, &e1, &e2->left.expr); in expr_eliminate_dups1()
582 expr_eliminate_dups1(type, &e1, &e2->right.expr); in expr_eliminate_dups1()
591 switch (e1->type) { in expr_eliminate_dups1()
593 expr_eliminate_dups1(e1->type, &e1, &e1); in expr_eliminate_dups1()
625 * Rewrites 'e' in-place to remove ("join") duplicate and other redundant
630 * A || B || A -> A || B
631 * A && B && A=y -> A=y && B
644 switch (e->type) { in expr_eliminate_dups()
646 expr_eliminate_dups1(e->type, &e, &e); in expr_eliminate_dups()
671 switch (e->type) { in expr_transform()
682 e->left.expr = expr_transform(e->left.expr); in expr_transform()
683 e->right.expr = expr_transform(e->right.expr); in expr_transform()
686 switch (e->type) { in expr_transform()
688 if (e->left.sym->type != S_BOOLEAN) in expr_transform()
690 if (e->right.sym == &symbol_no) { in expr_transform()
691 e->type = E_NOT; in expr_transform()
692 e->left.expr = expr_alloc_symbol(e->left.sym); in expr_transform()
693 e->right.sym = NULL; in expr_transform()
696 if (e->right.sym == &symbol_mod) { in expr_transform()
697 printf("boolean symbol %s tested for 'm'? test forced to 'n'\n", e->left.sym->name); in expr_transform()
698 e->type = E_SYMBOL; in expr_transform()
699 e->left.sym = &symbol_no; in expr_transform()
700 e->right.sym = NULL; in expr_transform()
703 if (e->right.sym == &symbol_yes) { in expr_transform()
704 e->type = E_SYMBOL; in expr_transform()
705 e->right.sym = NULL; in expr_transform()
710 if (e->left.sym->type != S_BOOLEAN) in expr_transform()
712 if (e->right.sym == &symbol_no) { in expr_transform()
713 e->type = E_SYMBOL; in expr_transform()
714 e->right.sym = NULL; in expr_transform()
717 if (e->right.sym == &symbol_mod) { in expr_transform()
718 printf("boolean symbol %s tested for 'm'? test forced to 'y'\n", e->left.sym->name); in expr_transform()
719 e->type = E_SYMBOL; in expr_transform()
720 e->left.sym = &symbol_yes; in expr_transform()
721 e->right.sym = NULL; in expr_transform()
724 if (e->right.sym == &symbol_yes) { in expr_transform()
725 e->type = E_NOT; in expr_transform()
726 e->left.expr = expr_alloc_symbol(e->left.sym); in expr_transform()
727 e->right.sym = NULL; in expr_transform()
732 switch (e->left.expr->type) { in expr_transform()
734 // !!a -> a in expr_transform()
735 tmp = e->left.expr->left.expr; in expr_transform()
736 free(e->left.expr); in expr_transform()
743 // !a='x' -> a!='x' in expr_transform()
744 tmp = e->left.expr; in expr_transform()
747 e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL; in expr_transform()
751 // !a<='x' -> a>'x' in expr_transform()
752 tmp = e->left.expr; in expr_transform()
755 e->type = e->type == E_LEQ ? E_GTH : E_LTH; in expr_transform()
759 // !a<'x' -> a>='x' in expr_transform()
760 tmp = e->left.expr; in expr_transform()
763 e->type = e->type == E_LTH ? E_GEQ : E_LEQ; in expr_transform()
766 // !(a || b) -> !a && !b in expr_transform()
767 tmp = e->left.expr; in expr_transform()
768 e->type = E_AND; in expr_transform()
769 e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); in expr_transform()
770 tmp->type = E_NOT; in expr_transform()
771 tmp->right.expr = NULL; in expr_transform()
775 // !(a && b) -> !a || !b in expr_transform()
776 tmp = e->left.expr; in expr_transform()
777 e->type = E_OR; in expr_transform()
778 e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); in expr_transform()
779 tmp->type = E_NOT; in expr_transform()
780 tmp->right.expr = NULL; in expr_transform()
784 if (e->left.expr->left.sym == &symbol_yes) { in expr_transform()
785 // !'y' -> 'n' in expr_transform()
786 tmp = e->left.expr; in expr_transform()
789 e->type = E_SYMBOL; in expr_transform()
790 e->left.sym = &symbol_no; in expr_transform()
793 if (e->left.expr->left.sym == &symbol_mod) { in expr_transform()
794 // !'m' -> 'm' in expr_transform()
795 tmp = e->left.expr; in expr_transform()
798 e->type = E_SYMBOL; in expr_transform()
799 e->left.sym = &symbol_mod; in expr_transform()
802 if (e->left.expr->left.sym == &symbol_no) { in expr_transform()
803 // !'n' -> 'y' in expr_transform()
804 tmp = e->left.expr; in expr_transform()
807 e->type = E_SYMBOL; in expr_transform()
808 e->left.sym = &symbol_yes; in expr_transform()
827 switch (dep->type) { in expr_contains_symbol()
830 return expr_contains_symbol(dep->left.expr, sym) || in expr_contains_symbol()
831 expr_contains_symbol(dep->right.expr, sym); in expr_contains_symbol()
833 return dep->left.sym == sym; in expr_contains_symbol()
840 return dep->left.sym == sym || in expr_contains_symbol()
841 dep->right.sym == sym; in expr_contains_symbol()
843 return expr_contains_symbol(dep->left.expr, sym); in expr_contains_symbol()
855 switch (dep->type) { in expr_depends_symbol()
857 return expr_depends_symbol(dep->left.expr, sym) || in expr_depends_symbol()
858 expr_depends_symbol(dep->right.expr, sym); in expr_depends_symbol()
860 return dep->left.sym == sym; in expr_depends_symbol()
862 if (dep->left.sym == sym) { in expr_depends_symbol()
863 if (dep->right.sym == &symbol_yes || dep->right.sym == &symbol_mod) in expr_depends_symbol()
868 if (dep->left.sym == sym) { in expr_depends_symbol()
869 if (dep->right.sym == &symbol_no) in expr_depends_symbol()
885 * A -> A!=n
886 * !A -> A=n
887 * A && B -> !(A=n || B=n)
888 * A || B -> !(A=n && B=n)
889 * A && (B || C) -> !(A=n || (B=n && C=n))
903 switch (e->type) { in expr_trans_compare()
905 e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); in expr_trans_compare()
906 e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); in expr_trans_compare()
915 e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); in expr_trans_compare()
916 e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); in expr_trans_compare()
925 return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym); in expr_trans_compare()
949 return expr_alloc_comp(type, e->left.sym, sym); in expr_trans_compare()
980 val->s = !strcmp(str, "n") ? 0 : in expr_parse_string()
982 !strcmp(str, "y") ? 2 : -1; in expr_parse_string()
985 val->s = strtoll(str, &tail, 10); in expr_parse_string()
989 val->u = strtoull(str, &tail, 16); in expr_parse_string()
993 val->s = strtoll(str, &tail, 0); in expr_parse_string()
997 return !errno && !*tail && tail > str && isxdigit(tail[-1]) in expr_parse_string()
1012 switch (e->type) { in expr_calc_value()
1014 sym_calc_value(e->left.sym); in expr_calc_value()
1015 return e->left.sym->curr.tri; in expr_calc_value()
1017 val1 = expr_calc_value(e->left.expr); in expr_calc_value()
1018 val2 = expr_calc_value(e->right.expr); in expr_calc_value()
1021 val1 = expr_calc_value(e->left.expr); in expr_calc_value()
1022 val2 = expr_calc_value(e->right.expr); in expr_calc_value()
1025 val1 = expr_calc_value(e->left.expr); in expr_calc_value()
1035 printf("expr_calc_value: %d?\n", e->type); in expr_calc_value()
1039 sym_calc_value(e->left.sym); in expr_calc_value()
1040 sym_calc_value(e->right.sym); in expr_calc_value()
1041 str1 = sym_get_string_value(e->left.sym); in expr_calc_value()
1042 str2 = sym_get_string_value(e->right.sym); in expr_calc_value()
1044 if (e->left.sym->type != S_STRING || e->right.sym->type != S_STRING) { in expr_calc_value()
1045 k1 = expr_parse_string(str1, e->left.sym->type, &lval); in expr_calc_value()
1046 k2 = expr_parse_string(str2, e->right.sym->type, &rval); in expr_calc_value()
1052 res = (lval.u > rval.u) - (lval.u < rval.u); in expr_calc_value()
1054 res = (lval.s > rval.s) - (lval.s < rval.s); in expr_calc_value()
1056 switch(e->type) { in expr_calc_value()
1070 printf("expr_calc_value: relation %d?\n", e->type); in expr_calc_value()
1103 return -1; in expr_compare_type()
1118 if (expr_compare_type(prevtoken, e->type) > 0) in expr_print()
1120 switch (e->type) { in expr_print()
1122 if (e->left.sym->name) in expr_print()
1123 fn(data, e->left.sym, e->left.sym->name); in expr_print()
1129 expr_print(e->left.expr, fn, data, E_NOT); in expr_print()
1132 if (e->left.sym->name) in expr_print()
1133 fn(data, e->left.sym, e->left.sym->name); in expr_print()
1137 fn(data, e->right.sym, e->right.sym->name); in expr_print()
1141 if (e->left.sym->name) in expr_print()
1142 fn(data, e->left.sym, e->left.sym->name); in expr_print()
1145 fn(data, NULL, e->type == E_LEQ ? "<=" : "<"); in expr_print()
1146 fn(data, e->right.sym, e->right.sym->name); in expr_print()
1150 if (e->left.sym->name) in expr_print()
1151 fn(data, e->left.sym, e->left.sym->name); in expr_print()
1154 fn(data, NULL, e->type == E_GEQ ? ">=" : ">"); in expr_print()
1155 fn(data, e->right.sym, e->right.sym->name); in expr_print()
1158 if (e->left.sym->name) in expr_print()
1159 fn(data, e->left.sym, e->left.sym->name); in expr_print()
1163 fn(data, e->right.sym, e->right.sym->name); in expr_print()
1166 expr_print(e->left.expr, fn, data, E_OR); in expr_print()
1168 expr_print(e->right.expr, fn, data, E_OR); in expr_print()
1171 expr_print(e->left.expr, fn, data, E_AND); in expr_print()
1173 expr_print(e->right.expr, fn, data, E_AND); in expr_print()
1176 fn(data, e->right.sym, e->right.sym->name); in expr_print()
1177 if (e->left.expr) { in expr_print()
1179 expr_print(e->left.expr, fn, data, E_LIST); in expr_print()
1184 fn(data, e->left.sym, e->left.sym->name); in expr_print()
1186 fn(data, e->right.sym, e->right.sym->name); in expr_print()
1192 sprintf(buf, "<unknown type %d>", e->type); in expr_print()
1197 if (expr_compare_type(prevtoken, e->type) > 0) in expr_print()
1219 if (gs->max_width) { in expr_print_gstr_helper()
1221 const char *last_cr = strrchr(gs->s, '\n'); in expr_print_gstr_helper()
1228 last_cr = gs->s; in expr_print_gstr_helper()
1230 last_line_length = strlen(gs->s) - (last_cr - gs->s); in expr_print_gstr_helper()
1232 if ((last_line_length + extra_length) > gs->max_width) in expr_print_gstr_helper()
1237 if (sym && sym->type != S_UNKNOWN) in expr_print_gstr_helper()
1255 if (e->type == E_OR) { in expr_print_revdep()
1256 expr_print_revdep(e->left.expr, fn, data, pr_type, title); in expr_print_revdep()
1257 expr_print_revdep(e->right.expr, fn, data, pr_type, title); in expr_print_revdep()
1264 fn(data, NULL, " - "); in expr_print_revdep()