Skip to content

Commit

Permalink
kconfig: implement the `mainmenu' directive
Browse files Browse the repository at this point in the history
If specified, the directive must be placed at the top of the Kconfig file.

We need to change the grammar to make the mainmenu directive set the
`rootmenu' prompt. This reflect how menu_add_prompt() works internally, ie.
set the prompt of the `current_entry', pointing originally to `rootmenu'.

Signed-off-by: Arnaud Lacombe <lacombar@gmail.com>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Michal Marek <mmarek@suse.cz>
  • Loading branch information
Arnaud Lacombe committed Sep 19, 2010
1 parent ef21160 commit 8ea13e2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Documentation/kbuild/kconfig-language.txt
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ mainmenu:
"mainmenu" <prompt>

This sets the config program's title bar if the config program chooses
to use it.
to use it. It should be placed at the top of the configuration, before any
other statement.


Kconfig hints
Expand Down
14 changes: 11 additions & 3 deletions scripts/kconfig/zconf.y
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ static struct menu *current_menu, *current_entry;
#define YYERROR_VERBOSE
#endif
%}
%expect 26
%expect 28

%union
{
Expand Down Expand Up @@ -104,14 +104,15 @@ static struct menu *current_menu, *current_entry;
%}

%%
input: stmt_list;
input: nl start | start;

start: mainmenu_stmt stmt_list | stmt_list;

stmt_list:
/* empty */
| stmt_list common_stmt
| stmt_list choice_stmt
| stmt_list menu_stmt
| stmt_list T_MAINMENU prompt nl
| stmt_list end { zconf_error("unexpected end statement"); }
| stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); }
| stmt_list option_name error T_EOL
Expand Down Expand Up @@ -342,6 +343,13 @@ if_block:
| if_block choice_stmt
;

/* mainmenu entry */

mainmenu_stmt: T_MAINMENU prompt nl
{
menu_add_prompt(P_MENU, $2, NULL);
};

/* menu entry */

menu: T_MENU prompt T_EOL
Expand Down

0 comments on commit 8ea13e2

Please sign in to comment.