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/zconf.y | |
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/zconf.y')
-rw-r--r-- | scripts/config/zconf.y | 232 |
1 files changed, 134 insertions, 98 deletions
diff --git a/scripts/config/zconf.y b/scripts/config/zconf.y index 301d7a896..459b69011 100644 --- a/scripts/config/zconf.y +++ b/scripts/config/zconf.y | |||
@@ -27,7 +27,7 @@ struct symbol *symbol_hash[257]; | |||
27 | 27 | ||
28 | #define YYERROR_VERBOSE | 28 | #define YYERROR_VERBOSE |
29 | %} | 29 | %} |
30 | %expect 36 | 30 | %expect 40 |
31 | 31 | ||
32 | %union | 32 | %union |
33 | { | 33 | { |
@@ -46,6 +46,7 @@ struct symbol *symbol_hash[257]; | |||
46 | %token T_ENDCHOICE | 46 | %token T_ENDCHOICE |
47 | %token T_COMMENT | 47 | %token T_COMMENT |
48 | %token T_CONFIG | 48 | %token T_CONFIG |
49 | %token T_MENUCONFIG | ||
49 | %token T_HELP | 50 | %token T_HELP |
50 | %token <string> T_HELPTEXT | 51 | %token <string> T_HELPTEXT |
51 | %token T_IF | 52 | %token T_IF |
@@ -56,17 +57,22 @@ struct symbol *symbol_hash[257]; | |||
56 | %token T_PROMPT | 57 | %token T_PROMPT |
57 | %token T_DEFAULT | 58 | %token T_DEFAULT |
58 | %token T_TRISTATE | 59 | %token T_TRISTATE |
60 | %token T_DEF_TRISTATE | ||
59 | %token T_BOOLEAN | 61 | %token T_BOOLEAN |
62 | %token T_DEF_BOOLEAN | ||
63 | %token T_STRING | ||
60 | %token T_INT | 64 | %token T_INT |
61 | %token T_HEX | 65 | %token T_HEX |
62 | %token <string> T_WORD | 66 | %token <string> T_WORD |
63 | %token <string> T_STRING | 67 | %token <string> T_WORD_QUOTE |
64 | %token T_UNEQUAL | 68 | %token T_UNEQUAL |
65 | %token T_EOF | 69 | %token T_EOF |
66 | %token T_EOL | 70 | %token T_EOL |
67 | %token T_CLOSE_PAREN | 71 | %token T_CLOSE_PAREN |
68 | %token T_OPEN_PAREN | 72 | %token T_OPEN_PAREN |
69 | %token T_ON | 73 | %token T_ON |
74 | %token T_SELECT | ||
75 | %token T_RANGE | ||
70 | 76 | ||
71 | %left T_OR | 77 | %left T_OR |
72 | %left T_AND | 78 | %left T_AND |
@@ -103,14 +109,15 @@ common_block: | |||
103 | if_stmt | 109 | if_stmt |
104 | | comment_stmt | 110 | | comment_stmt |
105 | | config_stmt | 111 | | config_stmt |
112 | | menuconfig_stmt | ||
106 | | source_stmt | 113 | | source_stmt |
107 | | nl_or_eof | 114 | | nl_or_eof |
108 | ; | 115 | ; |
109 | 116 | ||
110 | 117 | ||
111 | /* config entry */ | 118 | /* config/menuconfig entry */ |
112 | 119 | ||
113 | config_entry_start: T_CONFIG T_WORD | 120 | config_entry_start: T_CONFIG T_WORD T_EOL |
114 | { | 121 | { |
115 | struct symbol *sym = sym_lookup($2, 0); | 122 | struct symbol *sym = sym_lookup($2, 0); |
116 | sym->flags |= SYMBOL_OPTIONAL; | 123 | sym->flags |= SYMBOL_OPTIONAL; |
@@ -118,74 +125,118 @@ config_entry_start: T_CONFIG T_WORD | |||
118 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2); | 125 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2); |
119 | }; | 126 | }; |
120 | 127 | ||
121 | config_stmt: config_entry_start T_EOL config_option_list | 128 | config_stmt: config_entry_start config_option_list |
122 | { | 129 | { |
123 | menu_end_entry(); | 130 | menu_end_entry(); |
124 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | 131 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); |
125 | }; | 132 | }; |
126 | 133 | ||
134 | menuconfig_entry_start: T_MENUCONFIG T_WORD T_EOL | ||
135 | { | ||
136 | struct symbol *sym = sym_lookup($2, 0); | ||
137 | sym->flags |= SYMBOL_OPTIONAL; | ||
138 | menu_add_entry(sym); | ||
139 | printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2); | ||
140 | }; | ||
141 | |||
142 | menuconfig_stmt: menuconfig_entry_start config_option_list | ||
143 | { | ||
144 | if (current_entry->prompt) | ||
145 | current_entry->prompt->type = P_MENU; | ||
146 | else | ||
147 | zconfprint("warning: menuconfig statement without prompt"); | ||
148 | menu_end_entry(); | ||
149 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
150 | }; | ||
151 | |||
127 | config_option_list: | 152 | config_option_list: |
128 | /* empty */ | 153 | /* empty */ |
129 | | config_option_list config_option T_EOL | 154 | | config_option_list config_option |
130 | | config_option_list depends T_EOL | 155 | | config_option_list depends |
131 | | config_option_list help | 156 | | config_option_list help |
132 | | config_option_list T_EOL | 157 | | config_option_list T_EOL |
133 | { }; | 158 | ; |
134 | 159 | ||
135 | config_option: T_TRISTATE prompt_stmt_opt | 160 | config_option: T_TRISTATE prompt_stmt_opt T_EOL |
136 | { | 161 | { |
137 | menu_set_type(S_TRISTATE); | 162 | menu_set_type(S_TRISTATE); |
138 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | 163 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); |
139 | }; | 164 | }; |
140 | 165 | ||
141 | config_option: T_BOOLEAN prompt_stmt_opt | 166 | config_option: T_DEF_TRISTATE expr if_expr T_EOL |
167 | { | ||
168 | menu_add_expr(P_DEFAULT, $2, $3); | ||
169 | menu_set_type(S_TRISTATE); | ||
170 | printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); | ||
171 | }; | ||
172 | |||
173 | config_option: T_BOOLEAN prompt_stmt_opt T_EOL | ||
142 | { | 174 | { |
143 | menu_set_type(S_BOOLEAN); | 175 | menu_set_type(S_BOOLEAN); |
144 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | 176 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); |
145 | }; | 177 | }; |
146 | 178 | ||
147 | config_option: T_INT prompt_stmt_opt | 179 | config_option: T_DEF_BOOLEAN expr if_expr T_EOL |
180 | { | ||
181 | menu_add_expr(P_DEFAULT, $2, $3); | ||
182 | menu_set_type(S_BOOLEAN); | ||
183 | printd(DEBUG_PARSE, "%s:%d:def_boolean\n", zconf_curname(), zconf_lineno()); | ||
184 | }; | ||
185 | |||
186 | config_option: T_INT prompt_stmt_opt T_EOL | ||
148 | { | 187 | { |
149 | menu_set_type(S_INT); | 188 | menu_set_type(S_INT); |
150 | printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); | 189 | printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); |
151 | }; | 190 | }; |
152 | 191 | ||
153 | config_option: T_HEX prompt_stmt_opt | 192 | config_option: T_HEX prompt_stmt_opt T_EOL |
154 | { | 193 | { |
155 | menu_set_type(S_HEX); | 194 | menu_set_type(S_HEX); |
156 | printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); | 195 | printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); |
157 | }; | 196 | }; |
158 | 197 | ||
159 | config_option: T_STRING prompt_stmt_opt | 198 | config_option: T_STRING prompt_stmt_opt T_EOL |
160 | { | 199 | { |
161 | menu_set_type(S_STRING); | 200 | menu_set_type(S_STRING); |
162 | printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); | 201 | printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); |
163 | }; | 202 | }; |
164 | 203 | ||
165 | config_option: T_PROMPT prompt if_expr | 204 | config_option: T_PROMPT prompt if_expr T_EOL |
166 | { | 205 | { |
167 | menu_add_prop(P_PROMPT, $2, NULL, $3); | 206 | menu_add_prompt(P_PROMPT, $2, $3); |
168 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | 207 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); |
169 | }; | 208 | }; |
170 | 209 | ||
171 | config_option: T_DEFAULT symbol if_expr | 210 | config_option: T_DEFAULT expr if_expr T_EOL |
172 | { | 211 | { |
173 | menu_add_prop(P_DEFAULT, NULL, $2, $3); | 212 | menu_add_expr(P_DEFAULT, $2, $3); |
174 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | 213 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); |
175 | }; | 214 | }; |
176 | 215 | ||
216 | config_option: T_SELECT T_WORD if_expr T_EOL | ||
217 | { | ||
218 | menu_add_symbol(P_SELECT, sym_lookup($2, 0), $3); | ||
219 | printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); | ||
220 | }; | ||
221 | |||
222 | config_option: T_RANGE symbol symbol if_expr T_EOL | ||
223 | { | ||
224 | menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4); | ||
225 | printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); | ||
226 | }; | ||
227 | |||
177 | /* choice entry */ | 228 | /* choice entry */ |
178 | 229 | ||
179 | choice: T_CHOICE | 230 | choice: T_CHOICE T_EOL |
180 | { | 231 | { |
181 | struct symbol *sym = sym_lookup(NULL, 0); | 232 | struct symbol *sym = sym_lookup(NULL, 0); |
182 | sym->flags |= SYMBOL_CHOICE; | 233 | sym->flags |= SYMBOL_CHOICE; |
183 | menu_add_entry(sym); | 234 | menu_add_entry(sym); |
184 | menu_add_prop(P_CHOICE, NULL, NULL, NULL); | 235 | menu_add_expr(P_CHOICE, NULL, NULL); |
185 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | 236 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); |
186 | }; | 237 | }; |
187 | 238 | ||
188 | choice_entry: choice T_EOL choice_option_list | 239 | choice_entry: choice choice_option_list |
189 | { | 240 | { |
190 | menu_end_entry(); | 241 | menu_end_entry(); |
191 | menu_add_menu(); | 242 | menu_add_menu(); |
@@ -200,7 +251,7 @@ choice_end: end | |||
200 | }; | 251 | }; |
201 | 252 | ||
202 | choice_stmt: | 253 | choice_stmt: |
203 | choice_entry choice_block choice_end T_EOL | 254 | choice_entry choice_block choice_end |
204 | | choice_entry choice_block | 255 | | choice_entry choice_block |
205 | { | 256 | { |
206 | printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); | 257 | printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); |
@@ -209,28 +260,39 @@ choice_stmt: | |||
209 | 260 | ||
210 | choice_option_list: | 261 | choice_option_list: |
211 | /* empty */ | 262 | /* empty */ |
212 | | choice_option_list choice_option T_EOL | 263 | | choice_option_list choice_option |
213 | | choice_option_list depends T_EOL | 264 | | choice_option_list depends |
214 | | choice_option_list help | 265 | | choice_option_list help |
215 | | choice_option_list T_EOL | 266 | | choice_option_list T_EOL |
216 | ; | 267 | ; |
217 | 268 | ||
218 | choice_option: T_PROMPT prompt if_expr | 269 | choice_option: T_PROMPT prompt if_expr T_EOL |
219 | { | 270 | { |
220 | menu_add_prop(P_PROMPT, $2, NULL, $3); | 271 | menu_add_prompt(P_PROMPT, $2, $3); |
221 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | 272 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); |
222 | }; | 273 | }; |
223 | 274 | ||
224 | choice_option: T_OPTIONAL | 275 | choice_option: T_TRISTATE prompt_stmt_opt T_EOL |
276 | { | ||
277 | menu_set_type(S_TRISTATE); | ||
278 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
279 | }; | ||
280 | |||
281 | choice_option: T_BOOLEAN prompt_stmt_opt T_EOL | ||
282 | { | ||
283 | menu_set_type(S_BOOLEAN); | ||
284 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | ||
285 | }; | ||
286 | |||
287 | choice_option: T_OPTIONAL T_EOL | ||
225 | { | 288 | { |
226 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | 289 | current_entry->sym->flags |= SYMBOL_OPTIONAL; |
227 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); | 290 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); |
228 | }; | 291 | }; |
229 | 292 | ||
230 | choice_option: T_DEFAULT symbol | 293 | choice_option: T_DEFAULT T_WORD if_expr T_EOL |
231 | { | 294 | { |
232 | menu_add_prop(P_DEFAULT, NULL, $2, NULL); | 295 | menu_add_symbol(P_DEFAULT, sym_lookup($2, 0), $3); |
233 | //current_choice->prop->def = $2; | ||
234 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | 296 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); |
235 | }; | 297 | }; |
236 | 298 | ||
@@ -241,11 +303,10 @@ choice_block: | |||
241 | 303 | ||
242 | /* if entry */ | 304 | /* if entry */ |
243 | 305 | ||
244 | if: T_IF expr | 306 | if: T_IF expr T_EOL |
245 | { | 307 | { |
246 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | 308 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); |
247 | menu_add_entry(NULL); | 309 | menu_add_entry(NULL); |
248 | //current_entry->prompt = menu_add_prop(T_IF, NULL, NULL, $2); | ||
249 | menu_add_dep($2); | 310 | menu_add_dep($2); |
250 | menu_end_entry(); | 311 | menu_end_entry(); |
251 | menu_add_menu(); | 312 | menu_add_menu(); |
@@ -260,8 +321,8 @@ if_end: end | |||
260 | }; | 321 | }; |
261 | 322 | ||
262 | if_stmt: | 323 | if_stmt: |
263 | if T_EOL if_block if_end T_EOL | 324 | if if_block if_end |
264 | | if T_EOL if_block | 325 | | if if_block |
265 | { | 326 | { |
266 | printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); | 327 | printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); |
267 | zconfnerrs++; | 328 | zconfnerrs++; |
@@ -276,14 +337,14 @@ if_block: | |||
276 | 337 | ||
277 | /* menu entry */ | 338 | /* menu entry */ |
278 | 339 | ||
279 | menu: T_MENU prompt | 340 | menu: T_MENU prompt T_EOL |
280 | { | 341 | { |
281 | menu_add_entry(NULL); | 342 | menu_add_entry(NULL); |
282 | menu_add_prop(P_MENU, $2, NULL, NULL); | 343 | menu_add_prop(P_MENU, $2, NULL, NULL); |
283 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | 344 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); |
284 | }; | 345 | }; |
285 | 346 | ||
286 | menu_entry: menu T_EOL depends_list | 347 | menu_entry: menu depends_list |
287 | { | 348 | { |
288 | menu_end_entry(); | 349 | menu_end_entry(); |
289 | menu_add_menu(); | 350 | menu_add_menu(); |
@@ -298,7 +359,7 @@ menu_end: end | |||
298 | }; | 359 | }; |
299 | 360 | ||
300 | menu_stmt: | 361 | menu_stmt: |
301 | menu_entry menu_block menu_end T_EOL | 362 | menu_entry menu_block menu_end |
302 | | menu_entry menu_block | 363 | | menu_entry menu_block |
303 | { | 364 | { |
304 | printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); | 365 | printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); |
@@ -313,27 +374,27 @@ menu_block: | |||
313 | | menu_block error T_EOL { zconfprint("invalid menu option"); yyerrok; } | 374 | | menu_block error T_EOL { zconfprint("invalid menu option"); yyerrok; } |
314 | ; | 375 | ; |
315 | 376 | ||
316 | source: T_SOURCE prompt | 377 | source: T_SOURCE prompt T_EOL |
317 | { | 378 | { |
318 | $$ = $2; | 379 | $$ = $2; |
319 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); | 380 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); |
320 | }; | 381 | }; |
321 | 382 | ||
322 | source_stmt: source T_EOL | 383 | source_stmt: source |
323 | { | 384 | { |
324 | zconf_nextfile($1); | 385 | zconf_nextfile($1); |
325 | }; | 386 | }; |
326 | 387 | ||
327 | /* comment entry */ | 388 | /* comment entry */ |
328 | 389 | ||
329 | comment: T_COMMENT prompt | 390 | comment: T_COMMENT prompt T_EOL |
330 | { | 391 | { |
331 | menu_add_entry(NULL); | 392 | menu_add_entry(NULL); |
332 | menu_add_prop(P_COMMENT, $2, NULL, NULL); | 393 | menu_add_prop(P_COMMENT, $2, NULL, NULL); |
333 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); | 394 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); |
334 | }; | 395 | }; |
335 | 396 | ||
336 | comment_stmt: comment T_EOL depends_list | 397 | comment_stmt: comment depends_list |
337 | { | 398 | { |
338 | menu_end_entry(); | 399 | menu_end_entry(); |
339 | }; | 400 | }; |
@@ -354,21 +415,21 @@ help: help_start T_HELPTEXT | |||
354 | /* depends option */ | 415 | /* depends option */ |
355 | 416 | ||
356 | depends_list: /* empty */ | 417 | depends_list: /* empty */ |
357 | | depends_list depends T_EOL | 418 | | depends_list depends |
358 | | depends_list T_EOL | 419 | | depends_list T_EOL |
359 | { }; | 420 | ; |
360 | 421 | ||
361 | depends: T_DEPENDS T_ON expr | 422 | depends: T_DEPENDS T_ON expr T_EOL |
362 | { | 423 | { |
363 | menu_add_dep($3); | 424 | menu_add_dep($3); |
364 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | 425 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); |
365 | } | 426 | } |
366 | | T_DEPENDS expr | 427 | | T_DEPENDS expr T_EOL |
367 | { | 428 | { |
368 | menu_add_dep($2); | 429 | menu_add_dep($2); |
369 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); | 430 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); |
370 | } | 431 | } |
371 | | T_REQUIRES expr | 432 | | T_REQUIRES expr T_EOL |
372 | { | 433 | { |
373 | menu_add_dep($2); | 434 | menu_add_dep($2); |
374 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); | 435 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); |
@@ -378,22 +439,18 @@ depends: T_DEPENDS T_ON expr | |||
378 | 439 | ||
379 | prompt_stmt_opt: | 440 | prompt_stmt_opt: |
380 | /* empty */ | 441 | /* empty */ |
381 | | prompt | 442 | | prompt if_expr |
382 | { | ||
383 | menu_add_prop(P_PROMPT, $1, NULL, NULL); | ||
384 | } | ||
385 | | prompt T_IF expr | ||
386 | { | 443 | { |
387 | menu_add_prop(P_PROMPT, $1, NULL, $3); | 444 | menu_add_prop(P_PROMPT, $1, NULL, $2); |
388 | }; | 445 | }; |
389 | 446 | ||
390 | prompt: T_WORD | 447 | prompt: T_WORD |
391 | | T_STRING | 448 | | T_WORD_QUOTE |
392 | ; | 449 | ; |
393 | 450 | ||
394 | end: T_ENDMENU { $$ = T_ENDMENU; } | 451 | end: T_ENDMENU nl_or_eof { $$ = T_ENDMENU; } |
395 | | T_ENDCHOICE { $$ = T_ENDCHOICE; } | 452 | | T_ENDCHOICE nl_or_eof { $$ = T_ENDCHOICE; } |
396 | | T_ENDIF { $$ = T_ENDIF; } | 453 | | T_ENDIF nl_or_eof { $$ = T_ENDIF; } |
397 | ; | 454 | ; |
398 | 455 | ||
399 | nl_or_eof: | 456 | nl_or_eof: |
@@ -413,26 +470,34 @@ expr: symbol { $$ = expr_alloc_symbol($1); } | |||
413 | ; | 470 | ; |
414 | 471 | ||
415 | symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); } | 472 | symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); } |
416 | | T_STRING { $$ = sym_lookup($1, 1); free($1); } | 473 | | T_WORD_QUOTE { $$ = sym_lookup($1, 1); free($1); } |
417 | ; | 474 | ; |
418 | 475 | ||
419 | %% | 476 | %% |
420 | 477 | ||
421 | void conf_parse(const char *name) | 478 | void conf_parse(const char *name) |
422 | { | 479 | { |
480 | struct symbol *sym; | ||
481 | int i; | ||
482 | |||
423 | zconf_initscan(name); | 483 | zconf_initscan(name); |
424 | 484 | ||
425 | sym_init(); | 485 | sym_init(); |
426 | menu_init(); | 486 | menu_init(); |
427 | rootmenu.prompt = menu_add_prop(P_MENU, "BusyBox Configuration", NULL, NULL); | 487 | modules_sym = sym_lookup("MODULES", 0); |
488 | rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); | ||
428 | 489 | ||
429 | //zconfdebug = 1; | 490 | //zconfdebug = 1; |
430 | zconfparse(); | 491 | zconfparse(); |
431 | if (zconfnerrs) | 492 | if (zconfnerrs) |
432 | exit(1); | 493 | exit(1); |
433 | menu_finalize(&rootmenu); | 494 | menu_finalize(&rootmenu); |
434 | 495 | for_all_symbols(i, sym) { | |
435 | modules_sym = sym_lookup("MODULES", 0); | 496 | if (!(sym->flags & SYMBOL_CHECKED) && sym_check_deps(sym)) |
497 | printf("\n"); | ||
498 | else | ||
499 | sym->flags |= SYMBOL_CHECK_DONE; | ||
500 | } | ||
436 | 501 | ||
437 | sym_change_count = 1; | 502 | sym_change_count = 1; |
438 | } | 503 | } |
@@ -448,7 +513,7 @@ const char *zconf_tokenname(int token) | |||
448 | case T_ENDIF: return "endif"; | 513 | case T_ENDIF: return "endif"; |
449 | } | 514 | } |
450 | return "<token>"; | 515 | return "<token>"; |
451 | } | 516 | } |
452 | 517 | ||
453 | static bool zconf_endtoken(int token, int starttoken, int endtoken) | 518 | static bool zconf_endtoken(int token, int starttoken, int endtoken) |
454 | { | 519 | { |
@@ -470,7 +535,7 @@ static void zconfprint(const char *err, ...) | |||
470 | { | 535 | { |
471 | va_list ap; | 536 | va_list ap; |
472 | 537 | ||
473 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | 538 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno() + 1); |
474 | va_start(ap, err); | 539 | va_start(ap, err); |
475 | vfprintf(stderr, err, ap); | 540 | vfprintf(stderr, err, ap); |
476 | va_end(ap); | 541 | va_end(ap); |
@@ -479,7 +544,7 @@ static void zconfprint(const char *err, ...) | |||
479 | 544 | ||
480 | static void zconferror(const char *err) | 545 | static void zconferror(const char *err) |
481 | { | 546 | { |
482 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno(), err); | 547 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); |
483 | } | 548 | } |
484 | 549 | ||
485 | void print_quoted_string(FILE *out, const char *str) | 550 | void print_quoted_string(FILE *out, const char *str) |
@@ -504,8 +569,6 @@ void print_symbol(FILE *out, struct menu *menu) | |||
504 | struct symbol *sym = menu->sym; | 569 | struct symbol *sym = menu->sym; |
505 | struct property *prop; | 570 | struct property *prop; |
506 | 571 | ||
507 | //sym->flags |= SYMBOL_PRINTED; | ||
508 | |||
509 | if (sym_is_choice(sym)) | 572 | if (sym_is_choice(sym)) |
510 | fprintf(out, "choice\n"); | 573 | fprintf(out, "choice\n"); |
511 | else | 574 | else |
@@ -530,13 +593,6 @@ void print_symbol(FILE *out, struct menu *menu) | |||
530 | fputs(" ???\n", out); | 593 | fputs(" ???\n", out); |
531 | break; | 594 | break; |
532 | } | 595 | } |
533 | #if 0 | ||
534 | if (!expr_is_yes(sym->dep)) { | ||
535 | fputs(" depends ", out); | ||
536 | expr_fprint(sym->dep, out); | ||
537 | fputc('\n', out); | ||
538 | } | ||
539 | #endif | ||
540 | for (prop = sym->prop; prop; prop = prop->next) { | 596 | for (prop = sym->prop; prop; prop = prop->next) { |
541 | if (prop->menu != menu) | 597 | if (prop->menu != menu) |
542 | continue; | 598 | continue; |
@@ -544,25 +600,18 @@ void print_symbol(FILE *out, struct menu *menu) | |||
544 | case P_PROMPT: | 600 | case P_PROMPT: |
545 | fputs(" prompt ", out); | 601 | fputs(" prompt ", out); |
546 | print_quoted_string(out, prop->text); | 602 | print_quoted_string(out, prop->text); |
547 | if (prop->def) { | 603 | if (!expr_is_yes(prop->visible.expr)) { |
548 | fputc(' ', out); | ||
549 | if (prop->def->flags & SYMBOL_CONST) | ||
550 | print_quoted_string(out, prop->def->name); | ||
551 | else | ||
552 | fputs(prop->def->name, out); | ||
553 | } | ||
554 | if (!expr_is_yes(E_EXPR(prop->visible))) { | ||
555 | fputs(" if ", out); | 604 | fputs(" if ", out); |
556 | expr_fprint(E_EXPR(prop->visible), out); | 605 | expr_fprint(prop->visible.expr, out); |
557 | } | 606 | } |
558 | fputc('\n', out); | 607 | fputc('\n', out); |
559 | break; | 608 | break; |
560 | case P_DEFAULT: | 609 | case P_DEFAULT: |
561 | fputs( " default ", out); | 610 | fputs( " default ", out); |
562 | print_quoted_string(out, prop->def->name); | 611 | expr_fprint(prop->expr, out); |
563 | if (!expr_is_yes(E_EXPR(prop->visible))) { | 612 | if (!expr_is_yes(prop->visible.expr)) { |
564 | fputs(" if ", out); | 613 | fputs(" if ", out); |
565 | expr_fprint(E_EXPR(prop->visible), out); | 614 | expr_fprint(prop->visible.expr, out); |
566 | } | 615 | } |
567 | fputc('\n', out); | 616 | fputc('\n', out); |
568 | break; | 617 | break; |
@@ -585,7 +634,6 @@ void print_symbol(FILE *out, struct menu *menu) | |||
585 | 634 | ||
586 | void zconfdump(FILE *out) | 635 | void zconfdump(FILE *out) |
587 | { | 636 | { |
588 | //struct file *file; | ||
589 | struct property *prop; | 637 | struct property *prop; |
590 | struct symbol *sym; | 638 | struct symbol *sym; |
591 | struct menu *menu; | 639 | struct menu *menu; |
@@ -596,11 +644,6 @@ void zconfdump(FILE *out) | |||
596 | print_symbol(out, menu); | 644 | print_symbol(out, menu); |
597 | else if ((prop = menu->prompt)) { | 645 | else if ((prop = menu->prompt)) { |
598 | switch (prop->type) { | 646 | switch (prop->type) { |
599 | //case T_MAINMENU: | ||
600 | // fputs("\nmainmenu ", out); | ||
601 | // print_quoted_string(out, prop->text); | ||
602 | // fputs("\n", out); | ||
603 | // break; | ||
604 | case P_COMMENT: | 647 | case P_COMMENT: |
605 | fputs("\ncomment ", out); | 648 | fputs("\ncomment ", out); |
606 | print_quoted_string(out, prop->text); | 649 | print_quoted_string(out, prop->text); |
@@ -611,19 +654,12 @@ void zconfdump(FILE *out) | |||
611 | print_quoted_string(out, prop->text); | 654 | print_quoted_string(out, prop->text); |
612 | fputs("\n", out); | 655 | fputs("\n", out); |
613 | break; | 656 | break; |
614 | //case T_SOURCE: | ||
615 | // fputs("\nsource ", out); | ||
616 | // print_quoted_string(out, prop->text); | ||
617 | // fputs("\n", out); | ||
618 | // break; | ||
619 | //case T_IF: | ||
620 | // fputs("\nif\n", out); | ||
621 | default: | 657 | default: |
622 | ; | 658 | ; |
623 | } | 659 | } |
624 | if (!expr_is_yes(E_EXPR(prop->visible))) { | 660 | if (!expr_is_yes(prop->visible.expr)) { |
625 | fputs(" depends ", out); | 661 | fputs(" depends ", out); |
626 | expr_fprint(E_EXPR(prop->visible), out); | 662 | expr_fprint(prop->visible.expr, out); |
627 | fputc('\n', out); | 663 | fputc('\n', out); |
628 | } | 664 | } |
629 | fputs("\n", out); | 665 | fputs("\n", out); |