rpc: implement new upcall
[safe/jmp/linux-2.6] / scripts / kconfig / zconf.y
index 9d08582..9710b82 100644 (file)
@@ -64,7 +64,6 @@ static struct menu *current_menu, *current_entry;
 %token <id>T_IF
 %token <id>T_ENDIF
 %token <id>T_DEPENDS
-%token <id>T_REQUIRES
 %token <id>T_OPTIONAL
 %token <id>T_PROMPT
 %token <id>T_TYPE
@@ -92,7 +91,7 @@ static struct menu *current_menu, *current_entry;
 %type <id> end
 %type <id> option_name
 %type <menu> if_entry menu_entry choice_entry
-%type <string> symbol_option_arg
+%type <string> symbol_option_arg word_opt
 
 %destructor {
        fprintf(stderr, "%s:%d: missing end statement for this entry\n",
@@ -240,10 +239,10 @@ symbol_option_arg:
 
 /* choice entry */
 
-choice: T_CHOICE T_EOL
+choice: T_CHOICE word_opt T_EOL
 {
-       struct symbol *sym = sym_lookup(NULL, 0);
-       sym->flags |= SYMBOL_CHOICE;
+       struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE);
+       sym->flags |= SYMBOL_AUTO;
        menu_add_entry(sym);
        menu_add_expr(P_CHOICE, NULL, NULL);
        printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno());
@@ -402,7 +401,7 @@ help_start: T_HELP T_EOL
 
 help: help_start T_HELPTEXT
 {
-       current_entry->sym->help = $2;
+       current_entry->help = $2;
 };
 
 /* depends option */
@@ -418,16 +417,6 @@ depends: T_DEPENDS T_ON expr T_EOL
 {
        menu_add_dep($3);
        printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno());
-}
-       | T_DEPENDS expr T_EOL
-{
-       menu_add_dep($2);
-       printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno());
-}
-       | T_REQUIRES expr T_EOL
-{
-       menu_add_dep($2);
-       printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno());
 };
 
 /* prompt statement */
@@ -467,9 +456,12 @@ expr:        symbol                                { $$ = expr_alloc_symbol($1); }
 ;
 
 symbol:          T_WORD        { $$ = sym_lookup($1, 0); free($1); }
-       | T_WORD_QUOTE  { $$ = sym_lookup($1, 1); free($1); }
+       | T_WORD_QUOTE  { $$ = sym_lookup($1, SYMBOL_CONST); free($1); }
 ;
 
+word_opt: /* empty */                  { $$ = NULL; }
+       | T_WORD
+
 %%
 
 void conf_parse(const char *name)
@@ -481,7 +473,9 @@ void conf_parse(const char *name)
 
        sym_init();
        menu_init();
-       modules_sym = sym_lookup("MODULES", 0);
+       modules_sym = sym_lookup(NULL, 0);
+       modules_sym->type = S_BOOLEAN;
+       modules_sym->flags |= SYMBOL_AUTO;
        rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL);
 
 #if YYDEBUG
@@ -491,12 +485,20 @@ void conf_parse(const char *name)
        zconfparse();
        if (zconfnerrs)
                exit(1);
+       if (!modules_sym->prop) {
+               struct property *prop;
+
+               prop = prop_alloc(P_DEFAULT, modules_sym);
+               prop->expr = expr_alloc_symbol(sym_lookup("MODULES", 0));
+       }
        menu_finalize(&rootmenu);
        for_all_symbols(i, sym) {
-               sym_check_deps(sym);
+               if (sym_check_deps(sym))
+                       zconfnerrs++;
         }
-
-       sym_change_count = 1;
+       if (zconfnerrs)
+               exit(1);
+       sym_set_change_count(1);
 }
 
 const char *zconf_tokenname(int token)
@@ -639,11 +641,11 @@ void print_symbol(FILE *out, struct menu *menu)
                        break;
                }
        }
-       if (sym->help) {
-               int len = strlen(sym->help);
-               while (sym->help[--len] == '\n')
-                       sym->help[len] = 0;
-               fprintf(out, "  help\n%s\n", sym->help);
+       if (menu->help) {
+               int len = strlen(menu->help);
+               while (menu->help[--len] == '\n')
+                       menu->help[len] = 0;
+               fprintf(out, "  help\n%s\n", menu->help);
        }
        fputc('\n', out);
 }