diff options
author | Eric Andersen <andersen@codepoet.org> | 2003-08-05 02:18:25 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2003-08-05 02:18:25 +0000 |
commit | 72d8e444f0e9e002b16328e73464ef9015979048 (patch) | |
tree | d1d99e668617e95836a1f767257e1263963feaa5 /scripts/config/expr.h | |
parent | 461c279ac176a28dec40d1e40ebaffe4f0ac688d (diff) | |
download | busybox-w32-72d8e444f0e9e002b16328e73464ef9015979048.tar.gz busybox-w32-72d8e444f0e9e002b16328e73464ef9015979048.tar.bz2 busybox-w32-72d8e444f0e9e002b16328e73464ef9015979048.zip |
Merge/rework config system per the latest from linux-2.6.0-test2.
Fix the config bugs revealed by the updated config system.
-Erik
Diffstat (limited to 'scripts/config/expr.h')
-rw-r--r-- | scripts/config/expr.h | 82 |
1 files changed, 17 insertions, 65 deletions
diff --git a/scripts/config/expr.h b/scripts/config/expr.h index e96d03b5a..cc616f1f8 100644 --- a/scripts/config/expr.h +++ b/scripts/config/expr.h | |||
@@ -18,10 +18,6 @@ extern "C" { | |||
18 | struct file { | 18 | struct file { |
19 | struct file *next; | 19 | struct file *next; |
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; |
26 | int lineno; | 22 | int lineno; |
27 | int flags; | 23 | int flags; |
@@ -36,7 +32,7 @@ typedef enum tristate { | |||
36 | } tristate; | 32 | } tristate; |
37 | 33 | ||
38 | enum expr_type { | 34 | enum 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 | }; |
41 | 37 | ||
42 | union expr_data { | 38 | union expr_data { |
@@ -45,18 +41,10 @@ union expr_data { | |||
45 | }; | 41 | }; |
46 | 42 | ||
47 | struct expr { | 43 | struct 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; |
54 | }; | 46 | }; |
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)) |
61 | #define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) | 49 | #define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) |
62 | #define E_NOT(dep) (2-(dep)) | 50 | #define E_NOT(dep) (2-(dep)) |
@@ -66,12 +54,8 @@ struct expr_value { | |||
66 | tristate tri; | 54 | tristate tri; |
67 | }; | 55 | }; |
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 | |||
73 | struct symbol_value { | 57 | struct symbol_value { |
74 | void *value; | 58 | void *val; |
75 | tristate tri; | 59 | tristate tri; |
76 | }; | 60 | }; |
77 | 61 | ||
@@ -83,31 +67,17 @@ struct symbol { | |||
83 | struct symbol *next; | 67 | struct symbol *next; |
84 | char *name; | 68 | char *name; |
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; |
93 | int flags; | 73 | int flags; |
94 | struct property *prop; | 74 | struct property *prop; |
95 | struct expr *dep, *dep2; | 75 | struct expr *dep, *dep2; |
96 | struct menu *menu; | 76 | struct expr_value rev_dep; |
97 | }; | 77 | }; |
98 | 78 | ||
99 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) | 79 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) |
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 |
112 | #define SYMBOL_MOD 0x0002 | 82 | #define SYMBOL_MOD 0x0002 |
113 | #define SYMBOL_NO 0x0004 | 83 | #define SYMBOL_NO 0x0004 |
@@ -122,42 +92,38 @@ struct symbol { | |||
122 | #define SYMBOL_CHANGED 0x0400 | 92 | #define SYMBOL_CHANGED 0x0400 |
123 | #define SYMBOL_NEW 0x0800 | 93 | #define SYMBOL_NEW 0x0800 |
124 | #define SYMBOL_AUTO 0x1000 | 94 | #define SYMBOL_AUTO 0x1000 |
95 | #define SYMBOL_CHECKED 0x2000 | ||
96 | #define SYMBOL_CHECK_DONE 0x4000 | ||
97 | #define SYMBOL_WARNED 0x8000 | ||
125 | 98 | ||
126 | #define SYMBOL_MAXLENGTH 256 | 99 | #define SYMBOL_MAXLENGTH 256 |
127 | #define SYMBOL_HASHSIZE 257 | 100 | #define SYMBOL_HASHSIZE 257 |
128 | #define SYMBOL_HASHMASK 0xff | 101 | #define SYMBOL_HASHMASK 0xff |
129 | 102 | ||
130 | enum prop_type { | 103 | enum 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 | }; |
133 | 106 | ||
134 | struct property { | 107 | struct property { |
135 | struct property *next; | 108 | struct property *next; |
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; |
148 | struct file *file; | 115 | struct file *file; |
149 | int lineno; | 116 | int lineno; |
150 | #ifdef CML1 | ||
151 | struct property *next_pos; | ||
152 | #endif | ||
153 | }; | 117 | }; |
154 | 118 | ||
155 | #define for_all_properties(sym, st, tok) \ | 119 | #define for_all_properties(sym, st, tok) \ |
156 | for (st = sym->prop; st; st = st->next) \ | 120 | for (st = sym->prop; st; st = st->next) \ |
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 | ||
162 | struct menu { | 128 | struct menu { |
163 | struct menu *next; | 129 | struct menu *next; |
@@ -166,12 +132,16 @@ struct menu { | |||
166 | struct symbol *sym; | 132 | struct symbol *sym; |
167 | struct property *prompt; | 133 | struct property *prompt; |
168 | struct expr *dep; | 134 | struct expr *dep; |
135 | unsigned int flags; | ||
169 | //char *help; | 136 | //char *help; |
170 | struct file *file; | 137 | struct file *file; |
171 | int lineno; | 138 | int lineno; |
172 | void *data; | 139 | void *data; |
173 | }; | 140 | }; |
174 | 141 | ||
142 | #define MENU_CHANGED 0x0001 | ||
143 | #define MENU_ROOT 0x0002 | ||
144 | |||
175 | #ifndef SWIG | 145 | #ifndef SWIG |
176 | 146 | ||
177 | extern struct file *file_list; | 147 | extern struct file *file_list; |
@@ -181,18 +151,12 @@ struct file *lookup_file(const char *name); | |||
181 | extern struct symbol symbol_yes, symbol_no, symbol_mod; | 151 | extern struct symbol symbol_yes, symbol_no, symbol_mod; |
182 | extern struct symbol *modules_sym; | 152 | extern struct symbol *modules_sym; |
183 | extern int cdebug; | 153 | extern int cdebug; |
184 | extern int print_type; | ||
185 | struct expr *expr_alloc_symbol(struct symbol *sym); | 154 | struct expr *expr_alloc_symbol(struct symbol *sym); |
186 | #ifdef CML1 | ||
187 | struct expr *expr_alloc_one(int token, struct expr *ce); | ||
188 | struct expr *expr_alloc_two(int token, struct expr *e1, struct expr *e2); | ||
189 | struct expr *expr_alloc_comp(int token, struct symbol *s1, struct symbol *s2); | ||
190 | #else | ||
191 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); | 155 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); |
192 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2); | 156 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2); |
193 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); | 157 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); |
194 | #endif | ||
195 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); | 158 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); |
159 | struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); | ||
196 | struct expr *expr_copy(struct expr *org); | 160 | struct expr *expr_copy(struct expr *org); |
197 | void expr_free(struct expr *e); | 161 | void expr_free(struct expr *e); |
198 | int expr_eq(struct expr *e1, struct expr *e2); | 162 | int expr_eq(struct expr *e1, struct expr *e2); |
@@ -212,17 +176,6 @@ struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symb | |||
212 | void expr_fprint(struct expr *e, FILE *out); | 176 | void expr_fprint(struct expr *e, FILE *out); |
213 | void print_expr(int mask, struct expr *e, int prevtoken); | 177 | void print_expr(int mask, struct expr *e, int prevtoken); |
214 | 178 | ||
215 | #ifdef CML1 | ||
216 | static inline int expr_is_yes(struct expr *e) | ||
217 | { | ||
218 | return !e || (e->token == WORD && e->left.sym == &symbol_yes); | ||
219 | } | ||
220 | |||
221 | static inline int expr_is_no(struct expr *e) | ||
222 | { | ||
223 | return e && (e->token == WORD && e->left.sym == &symbol_no); | ||
224 | } | ||
225 | #else | ||
226 | static inline int expr_is_yes(struct expr *e) | 179 | static inline int expr_is_yes(struct expr *e) |
227 | { | 180 | { |
228 | return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); | 181 | return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); |
@@ -233,7 +186,6 @@ static inline int expr_is_no(struct expr *e) | |||
233 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); | 186 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); |
234 | } | 187 | } |
235 | #endif | 188 | #endif |
236 | #endif | ||
237 | 189 | ||
238 | #ifdef __cplusplus | 190 | #ifdef __cplusplus |
239 | } | 191 | } |