summaryrefslogtreecommitdiff
path: root/scripts/kconfig/expr.h
Unidiff
Diffstat (limited to 'scripts/kconfig/expr.h') (more/less context) (show whitespace changes)
-rw-r--r--scripts/kconfig/expr.h79
1 files changed, 14 insertions, 65 deletions
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h
index 896a296..cc616f1 100644
--- a/scripts/kconfig/expr.h
+++ b/scripts/kconfig/expr.h
@@ -20,6 +20,2 @@ struct file {
20 struct file *parent; 20 struct file *parent;
21#ifdef CML1
22 struct statement *stmt;
23 struct statement *last_stmt;
24#endif
25 char *name; 21 char *name;
@@ -38,3 +34,3 @@ typedef enum tristate {
38enum expr_type { 34enum expr_type {
39 E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL 35 E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL, E_RANGE
40}; 36};
@@ -47,7 +43,3 @@ union expr_data {
47struct expr { 43struct expr {
48#ifdef CML1
49 int token;
50#else
51 enum expr_type type; 44 enum expr_type type;
52#endif
53 union expr_data left, right; 45 union expr_data left, right;
@@ -55,6 +47,2 @@ struct expr {
55 47
56 #define E_TRI(ev)((ev).tri)
57 #define E_EXPR(ev)((ev).expr)
58 #define E_CALC(ev)(E_TRI(ev) = expr_calc_value(E_EXPR(ev)))
59
60 #define E_OR(dep1, dep2)(((dep1)>(dep2))?(dep1):(dep2)) 48 #define E_OR(dep1, dep2)(((dep1)>(dep2))?(dep1):(dep2))
@@ -68,8 +56,4 @@ struct expr_value {
68 56
69 #define S_VAL(sv)((sv).value)
70 #define S_TRI(sv)((sv).tri)
71 #define S_EQ(sv1, sv2)(S_VAL(sv1) == S_VAL(sv2) || !strcmp(S_VAL(sv1), S_VAL(sv2)))
72
73struct symbol_value { 57struct symbol_value {
74 void *value; 58 void *val;
75 tristate tri; 59 tristate tri;
@@ -85,8 +69,4 @@ struct symbol {
85 char *help; 69 char *help;
86#ifdef CML1
87 int type;
88#else
89 enum symbol_type type; 70 enum symbol_type type;
90#endif 71 struct symbol_value curr, user;
91 struct symbol_value curr, def;
92 tristate visible; 72 tristate visible;
@@ -95,3 +75,3 @@ struct symbol {
95 struct expr *dep, *dep2; 75 struct expr *dep, *dep2;
96 struct menu *menu; 76 struct expr_value rev_dep;
97}; 77};
@@ -100,12 +80,2 @@ struct symbol {
100 80
101#ifdef CML1
102 #define SYMBOL_UNKNOWN S_UNKNOWN
103 #define SYMBOL_BOOLEAN S_BOOLEAN
104 #define SYMBOL_TRISTATE S_TRISTATE
105 #define SYMBOL_INT S_INT
106 #define SYMBOL_HEX S_HEX
107 #define SYMBOL_STRING S_STRING
108 #define SYMBOL_OTHER S_OTHER
109#endif
110
111 #define SYMBOL_YES 0x0001 81 #define SYMBOL_YES 0x0001
@@ -124,2 +94,5 @@ struct symbol {
124 #define SYMBOL_AUTO 0x1000 94 #define SYMBOL_AUTO 0x1000
95 #define SYMBOL_CHECKED 0x2000
96 #define SYMBOL_CHECK_DONE0x4000
97 #define SYMBOL_WARNED 0x8000
125 98
@@ -130,3 +103,3 @@ struct symbol {
130enum prop_type { 103enum prop_type {
131 P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_ROOTMENU, P_DEFAULT, P_CHOICE 104 P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE
132}; 105};
@@ -136,12 +109,6 @@ struct property {
136 struct symbol *sym; 109 struct symbol *sym;
137#ifdef CML1
138 int token;
139#else
140 enum prop_type type; 110 enum prop_type type;
141#endif
142 const char *text; 111 const char *text;
143 struct symbol *def;
144 struct expr_value visible; 112 struct expr_value visible;
145 struct expr *dep; 113 struct expr *expr;
146 struct expr *dep2;
147 struct menu *menu; 114 struct menu *menu;
@@ -149,5 +116,2 @@ struct property {
149 int lineno; 116 int lineno;
150#ifdef CML1
151 struct property *next_pos;
152#endif
153}; 117};
@@ -157,5 +121,7 @@ struct property {
157 if (st->type == (tok)) 121 if (st->type == (tok))
158#define for_all_prompts(sym, st) for_all_properties(sym, st, P_PROMPT)
159#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT) 122#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
160#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE) 123#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
124#define for_all_prompts(sym, st) \
125 for (st = sym->prop; st; st = st->next) \
126 if (st->text)
161 127
@@ -176,2 +142,3 @@ struct menu {
176 #define MENU_CHANGED 0x0001 142 #define MENU_CHANGED 0x0001
143 #define MENU_ROOT 0x0002
177 144
@@ -186,9 +153,3 @@ extern struct symbol *modules_sym;
186extern int cdebug; 153extern int cdebug;
187extern int print_type;
188struct expr *expr_alloc_symbol(struct symbol *sym); 154struct expr *expr_alloc_symbol(struct symbol *sym);
189#ifdef CML1
190struct expr *expr_alloc_one(int token, struct expr *ce);
191struct expr *expr_alloc_two(int token, struct expr *e1, struct expr *e2);
192struct expr *expr_alloc_comp(int token, struct symbol *s1, struct symbol *s2);
193#else
194struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); 155struct expr *expr_alloc_one(enum expr_type type, struct expr *ce);
@@ -196,4 +157,4 @@ struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e
196struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); 157struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2);
197#endif
198struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); 158struct expr *expr_alloc_and(struct expr *e1, struct expr *e2);
159struct expr *expr_alloc_or(struct expr *e1, struct expr *e2);
199struct expr *expr_copy(struct expr *org); 160struct expr *expr_copy(struct expr *org);
@@ -217,13 +178,2 @@ void print_expr(int mask, struct expr *e, int prevtoken);
217 178
218#ifdef CML1
219static inline int expr_is_yes(struct expr *e)
220{
221 return !e || (e->token == WORD && e->left.sym == &symbol_yes);
222}
223
224static inline int expr_is_no(struct expr *e)
225{
226 return e && (e->token == WORD && e->left.sym == &symbol_no);
227}
228#else
229static inline int expr_is_yes(struct expr *e) 179static inline int expr_is_yes(struct expr *e)
@@ -238,3 +188,2 @@ static inline int expr_is_no(struct expr *e)
238#endif 188#endif
239#endif
240 189