aboutsummaryrefslogtreecommitdiff
path: root/scripts/parse_kconfig/doutput.c
blob: ac7927f61f111b67e5228eb28466813915e7757c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#include "doutput.h"

void doutput_expr(struct expr *expr) {
#ifdef DEBUG
    if (verbose_level < 3)
        return;
    switch (expr->type) {
    case E_OR:
        printf("  OR\n");
        doutput_expr(expr->left.expr);
        doutput_expr(expr->right.expr);
        break;
    case E_AND:
        printf("  AND\n");
        doutput_expr(expr->left.expr);
        doutput_expr(expr->right.expr);
        break;
    case E_NOT:
        printf("  NOT\n");
        doutput_expr(expr->left.expr);
        break;
    case E_EQUAL:
        printf("  = ");
        printf("%s ", expr->left.sym->name);
        if (!strcmp("y", expr->right.sym->name))
            printf("YES\n");
        else if (!strcmp("n", expr->right.sym->name))
            printf("NO\n");
        else if (!strcmp("m", expr->right.sym->name))
            printf("MODULE\n");
        else
            printf("%s\n", expr->left.sym->name);
        break;
    case E_UNEQUAL:
        printf("  != ");
        printf("%s ", expr->left.sym->name);
        if (!strcmp("y", expr->right.sym->name))
            printf("YES\n");
        else if (!strcmp("n", expr->right.sym->name))
            printf("NO\n");
        else
            printf("OTHER %s\n", expr->right.sym->name);
        break;
    case E_LIST:
        printf("  list\n");
        break;
    case E_SYMBOL:
        printf("  symbol");
        if (expr->left.sym->name != NULL)
            printf(": %s", expr->left.sym->name);
        printf("\n");
        break;
    case E_RANGE:
        printf("  range\n");
        break;
    case E_NONE:
        printf("  none\n");
        break;
    default:
        printf("  ERROR\n");
        break;
    }
#endif /* DEBUG */
}