Commit bbc115e9 authored by Roman Zippel's avatar Roman Zippel Committed by Linus Torvalds

[PATCH] add menuconfig support

This adds the support for the menuconfig keyword, which allows to define
a config symbol and a submenu with a single step, e.g. instead of

	menu "SCSI device support"

	config SCSI
		tristate "SCSI device support"

this is now enough:

	menuconfig SCSI
		tristate "SCSI device support"
parent 8f5aa8ef
......@@ -155,9 +155,11 @@ struct property {
#define for_all_properties(sym, st, tok) \
for (st = sym->prop; st; st = st->next) \
if (st->type == (tok))
#define for_all_prompts(sym, st) for_all_properties(sym, st, P_PROMPT)
#define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT)
#define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE)
#define for_all_prompts(sym, st) \
for (st = sym->prop; st; st = st->next) \
if (st->text)
struct menu {
struct menu *next;
......
This diff is collapsed.
......@@ -160,6 +160,9 @@ void sym_calc_value(struct symbol *sym)
struct symbol *def_sym;
struct expr *e;
if (!sym)
return;
if (sym->flags & SYMBOL_VALID)
return;
......
......@@ -96,6 +96,7 @@ n [A-Za-z0-9_]
"endchoice" BEGIN(PARAM); return T_ENDCHOICE;
"comment" BEGIN(PARAM); return T_COMMENT;
"config" BEGIN(PARAM); return T_CONFIG;
"menuconfig" BEGIN(PARAM); return T_MENUCONFIG;
"help" BEGIN(PARAM); return T_HELP;
"if" BEGIN(PARAM); return T_IF;
"endif" BEGIN(PARAM); return T_ENDIF;
......@@ -141,6 +142,7 @@ n [A-Za-z0-9_]
zconflval.string = text;
return T_WORD;
}
#.* /* comment */
\\\n current_file->lineno++;
.
<<EOF>> {
......@@ -208,7 +210,7 @@ n [A-Za-z0-9_]
}
}
\n/[^ \t\n] {
[ \t]*\n/[^ \t\n] {
current_file->lineno++;
zconf_endhelp();
return T_HELPTEXT;
......
This diff is collapsed.
......@@ -27,7 +27,7 @@ struct symbol *symbol_hash[257];
#define YYERROR_VERBOSE
%}
%expect 36
%expect 40
%union
{
......@@ -46,6 +46,7 @@ struct symbol *symbol_hash[257];
%token T_ENDCHOICE
%token T_COMMENT
%token T_CONFIG
%token T_MENUCONFIG
%token T_HELP
%token <string> T_HELPTEXT
%token T_IF
......@@ -104,12 +105,13 @@ common_block:
if_stmt
| comment_stmt
| config_stmt
| menuconfig_stmt
| source_stmt
| nl_or_eof
;
/* config entry */
/* config/menuconfig entry */
config_entry_start: T_CONFIG T_WORD
{
......@@ -125,6 +127,24 @@ config_stmt: config_entry_start T_EOL config_option_list
printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
};
menuconfig_entry_start: T_MENUCONFIG T_WORD
{
struct symbol *sym = sym_lookup($2, 0);
sym->flags |= SYMBOL_OPTIONAL;
menu_add_entry(sym);
printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2);
};
menuconfig_stmt: menuconfig_entry_start T_EOL config_option_list
{
if (current_entry->prompt)
current_entry->prompt->type = P_MENU;
else
zconfprint("warning: menuconfig statement without prompt");
menu_end_entry();
printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno());
};
config_option_list:
/* empty */
| config_option_list config_option T_EOL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment