]> rtime.felk.cvut.cz Git - l4.git/blobdiff - l4/tool/kconfig/scripts/kconfig/menu.c
update
[l4.git] / l4 / tool / kconfig / scripts / kconfig / menu.c
index 059a2465c5744ffed6d3cff25e2d8135a16c0399..edda8b49619d9e66ff70e16dd8ef68caf4a86bc6 100644 (file)
@@ -38,7 +38,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...)
        va_end(ap);
 }
 
-void menu_init(void)
+void _menu_init(void)
 {
        current_entry = current_menu = &rootmenu;
        last_entry_ptr = &rootmenu.list;
@@ -58,6 +58,8 @@ void menu_add_entry(struct symbol *sym)
        *last_entry_ptr = menu;
        last_entry_ptr = &menu->next;
        current_entry = menu;
+       if (sym)
+               menu_add_symbol(P_SYMBOL, sym, NULL);
 }
 
 void menu_end_entry(void)
@@ -197,7 +199,7 @@ static void sym_check_prop(struct symbol *sym)
                        if ((sym->type == S_STRING || sym->type == S_INT || sym->type == S_HEX) &&
                            prop->expr->type != E_SYMBOL)
                                prop_warn(prop,
-                                   "default for config symbol '%'"
+                                   "default for config symbol '%s'"
                                    " must be a single symbol", sym->name);
                        break;
                case P_SELECT:
@@ -318,6 +320,8 @@ void menu_finalize(struct menu *parent)
                        parent->next = last_menu->next;
                        last_menu->next = NULL;
                }
+
+               sym->dir_dep.expr = parent->dep;
        }
        for (menu = parent->list; menu; menu = menu->next) {
                if (sym && sym_is_choice(sym) &&
@@ -390,6 +394,13 @@ void menu_finalize(struct menu *parent)
        }
 }
 
+bool menu_has_prompt(struct menu *menu)
+{
+       if (!menu->prompt)
+               return false;
+       return true;
+}
+
 bool menu_is_visible(struct menu *menu)
 {
        struct menu *child;
@@ -398,6 +409,7 @@ bool menu_is_visible(struct menu *menu)
 
        if (!menu->prompt)
                return false;
+
        sym = menu->sym;
        if (sym) {
                sym_calc_value(sym);
@@ -407,12 +419,18 @@ bool menu_is_visible(struct menu *menu)
 
        if (visible != no)
                return true;
+
        if (!sym || sym_get_tristate_value(menu->sym) == no)
                return false;
 
-       for (child = menu->list; child; child = child->next)
-               if (menu_is_visible(child))
+       for (child = menu->list; child; child = child->next) {
+               if (menu_is_visible(child)) {
+                       if (sym)
+                               sym->flags |= SYMBOL_DEF_USER;
                        return true;
+               }
+       }
+
        return false;
 }
 
@@ -491,9 +509,19 @@ void get_symbol_str(struct gstr *r, struct symbol *sym)
        bool hit;
        struct property *prop;
 
-       if (sym && sym->name)
+       if (sym && sym->name) {
                str_printf(r, "Symbol: %s [=%s]\n", sym->name,
                           sym_get_string_value(sym));
+               str_printf(r, "Type  : %s\n", sym_type_name(sym->type));
+               if (sym->type == S_INT || sym->type == S_HEX) {
+                       prop = sym_get_range_prop(sym);
+                       if (prop) {
+                               str_printf(r, "Range : ");
+                               expr_gstr_print(prop->expr, r);
+                               str_append(r, "\n");
+                       }
+               }
+       }
        for_all_prompts(sym, prop)
                get_prompt_str(r, prop);
        hit = false;
@@ -515,6 +543,20 @@ void get_symbol_str(struct gstr *r, struct symbol *sym)
        str_append(r, "\n\n");
 }
 
+struct gstr get_relations_str(struct symbol **sym_arr)
+{
+       struct symbol *sym;
+       struct gstr res = str_new();
+       int i;
+
+       for (i = 0; sym_arr && (sym = sym_arr[i]); i++)
+               get_symbol_str(&res, sym);
+       if (!i)
+               str_append(&res, _("No matches found.\n"));
+       return res;
+}
+
+
 void menu_get_ext_help(struct menu *menu, struct gstr *help)
 {
        struct symbol *sym = menu->sym;