gconfig: remove show_debug option
[safe/jmp/linux-2.6] / scripts / kconfig / zconf.y
index d9b96ba..23dfd3b 100644 (file)
@@ -14,8 +14,6 @@
 #define LKC_DIRECT_LINK
 #include "lkc.h"
 
-#include "zconf.hash.c"
-
 #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt)
 
 #define PRINTD         0x0001
@@ -29,7 +27,7 @@ static void zconf_error(const char *err, ...);
 static void zconferror(const char *err);
 static bool zconf_endtoken(struct kconf_id *id, int starttoken, int endtoken);
 
-struct symbol *symbol_hash[257];
+struct symbol *symbol_hash[SYMBOL_HASHSIZE];
 
 static struct menu *current_menu, *current_entry;
 
@@ -91,7 +89,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",
@@ -100,6 +98,11 @@ static struct menu *current_menu, *current_entry;
                menu_end_menu();
 } if_entry menu_entry choice_entry
 
+%{
+/* Include zconf.hash.c here so it can see the token constants. */
+#include "zconf.hash.c"
+%}
+
 %%
 input: stmt_list;
 
@@ -239,10 +242,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());
@@ -456,9 +459,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)
@@ -469,7 +475,7 @@ void conf_parse(const char *name)
        zconf_initscan(name);
 
        sym_init();
-       menu_init();
+       _menu_init();
        modules_sym = sym_lookup(NULL, 0);
        modules_sym->type = S_BOOLEAN;
        modules_sym->flags |= SYMBOL_AUTO;
@@ -498,7 +504,7 @@ void conf_parse(const char *name)
        sym_set_change_count(1);
 }
 
-const char *zconf_tokenname(int token)
+static const char *zconf_tokenname(int token)
 {
        switch (token) {
        case T_MENU:            return "menu";
@@ -562,7 +568,7 @@ static void zconferror(const char *err)
 #endif
 }
 
-void print_quoted_string(FILE *out, const char *str)
+static void print_quoted_string(FILE *out, const char *str)
 {
        const char *p;
        int len;
@@ -579,15 +585,15 @@ void print_quoted_string(FILE *out, const char *str)
        putc('"', out);
 }
 
-void print_symbol(FILE *out, struct menu *menu)
+static void print_symbol(FILE *out, struct menu *menu)
 {
        struct symbol *sym = menu->sym;
        struct property *prop;
 
        if (sym_is_choice(sym))
-               fprintf(out, "choice\n");
+               fprintf(out, "\nchoice\n");
        else
-               fprintf(out, "config %s\n", sym->name);
+               fprintf(out, "\nconfig %s\n", sym->name);
        switch (sym->type) {
        case S_BOOLEAN:
                fputs("  boolean\n", out);
@@ -633,6 +639,21 @@ void print_symbol(FILE *out, struct menu *menu)
                case P_CHOICE:
                        fputs("  #choice value\n", out);
                        break;
+               case P_SELECT:
+                       fputs( "  select ", out);
+                       expr_fprint(prop->expr, out);
+                       fputc('\n', out);
+                       break;
+               case P_RANGE:
+                       fputs( "  range ", out);
+                       expr_fprint(prop->expr, out);
+                       fputc('\n', out);
+                       break;
+               case P_MENU:
+                       fputs( "  menu ", out);
+                       print_quoted_string(out, prop->text);
+                       fputc('\n', out);
+                       break;
                default:
                        fprintf(out, "  unknown prop %d!\n", prop->type);
                        break;
@@ -644,7 +665,6 @@ void print_symbol(FILE *out, struct menu *menu)
                        menu->help[len] = 0;
                fprintf(out, "  help\n%s\n", menu->help);
        }
-       fputc('\n', out);
 }
 
 void zconfdump(FILE *out)
@@ -677,7 +697,6 @@ void zconfdump(FILE *out)
                                expr_fprint(prop->visible.expr, out);
                                fputc('\n', out);
                        }
-                       fputs("\n", out);
                }
 
                if (menu->list)