cns21xx: build uImage for the NS-K330
[openwrt.git] / scripts / config / symbol.c
index 23246ca..49bb254 100644 (file)
@@ -56,7 +56,6 @@ void sym_init(void)
 
        sym = sym_lookup("ARCH", 0);
        sym->type = S_STRING;
 
        sym = sym_lookup("ARCH", 0);
        sym->type = S_STRING;
-       sym->flags |= SYMBOL_AUTO;
        p = getenv("ARCH");
        if (p)
                sym_add_default(sym, p);
        p = getenv("ARCH");
        if (p)
                sym_add_default(sym, p);
@@ -197,6 +196,7 @@ static void sym_calc_visibility(struct symbol *sym)
 {
        struct property *prop;
        tristate tri;
 {
        struct property *prop;
        tristate tri;
+       int deselected = 0;
 
        /* any prompt visible? */
        tri = no;
 
        /* any prompt visible? */
        tri = no;
@@ -206,15 +206,15 @@ static void sym_calc_visibility(struct symbol *sym)
        }
        if (tri == mod && (sym->type != S_TRISTATE))
                tri = yes;
        }
        if (tri == mod && (sym->type != S_TRISTATE))
                tri = yes;
-       if (sym->rev_dep_inv.expr) {
-               if (expr_calc_value(sym->rev_dep_inv.expr) == yes)
-                       tri = no;
+       if (sym->rev_dep_inv.expr && (expr_calc_value(sym->rev_dep_inv.expr) == yes)) {
+               tri = no;
+               deselected = 1;
        }
        if (sym->visible != tri) {
                sym->visible = tri;
                sym_set_changed(sym);
        }
        }
        if (sym->visible != tri) {
                sym->visible = tri;
                sym_set_changed(sym);
        }
-       if (sym_is_choice_value(sym))
+       if (sym_is_choice_value(sym) || deselected)
                return;
        tri = no;
        if (sym->rev_dep.expr)
                return;
        tri = no;
        if (sym->rev_dep.expr)
@@ -266,6 +266,26 @@ static struct symbol *sym_calc_choice(struct symbol *sym)
        return NULL;
 }
 
        return NULL;
 }
 
+void sym_set_changed(struct symbol *sym)
+{
+       struct property *prop;
+
+       sym->flags |= SYMBOL_CHANGED;
+       for (prop = sym->prop; prop; prop = prop->next) {
+               if (prop->menu)
+                       prop->menu->flags |= MENU_CHANGED;
+       }
+}
+
+void sym_set_all_changed(void)
+{
+       struct symbol *sym;
+       int i;
+
+       for_all_symbols(i, sym)
+               sym_set_changed(sym);
+}
+
 void sym_calc_value(struct symbol *sym)
 {
        struct symbol_value newval, oldval;
 void sym_calc_value(struct symbol *sym)
 {
        struct symbol_value newval, oldval;
@@ -310,6 +330,8 @@ void sym_calc_value(struct symbol *sym)
                if (sym_is_choice_value(sym) && sym->visible == yes) {
                        prop = sym_get_choice_prop(sym);
                        newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
                if (sym_is_choice_value(sym) && sym->visible == yes) {
                        prop = sym_get_choice_prop(sym);
                        newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no;
+               } else if (sym->rev_dep_inv.expr && (expr_calc_value(sym->rev_dep_inv.expr) == yes)) {
+                       newval.tri = no;
                } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
                        sym->flags |= SYMBOL_WRITE;
                        if (sym_has_value(sym))
                } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) {
                        sym->flags |= SYMBOL_WRITE;
                        if (sym_has_value(sym))
@@ -359,11 +381,14 @@ void sym_calc_value(struct symbol *sym)
                sym->curr.val = sym_calc_choice(sym);
        sym_validate_range(sym);
 
                sym->curr.val = sym_calc_choice(sym);
        sym_validate_range(sym);
 
-       if (memcmp(&oldval, &sym->curr, sizeof(oldval)))
+       if (memcmp(&oldval, &sym->curr, sizeof(oldval))) {
+               sym->flags &= ~SYMBOL_VALID;
                sym_set_changed(sym);
                sym_set_changed(sym);
-
-       if (modules_sym == sym)
-               modules_val = modules_sym->curr.tri;
+               if (modules_sym == sym) {
+                       sym_set_all_changed();
+                       modules_val = modules_sym->curr.tri;
+               }
+       }
 
        if (sym_is_choice(sym)) {
                int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
 
        if (sym_is_choice(sym)) {
                int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE);
@@ -374,6 +399,9 @@ void sym_calc_value(struct symbol *sym)
                                sym_set_changed(e->right.sym);
                }
        }
                                sym_set_changed(e->right.sym);
                }
        }
+
+       if (sym->flags & SYMBOL_AUTO)
+               sym->flags &= ~SYMBOL_WRITE;
 }
 
 void sym_clear_all_valid(void)
 }
 
 void sym_clear_all_valid(void)
@@ -388,26 +416,6 @@ void sym_clear_all_valid(void)
                sym_calc_value(modules_sym);
 }
 
                sym_calc_value(modules_sym);
 }
 
-void sym_set_changed(struct symbol *sym)
-{
-       struct property *prop;
-
-       sym->flags |= SYMBOL_CHANGED;
-       for (prop = sym->prop; prop; prop = prop->next) {
-               if (prop->menu)
-                       prop->menu->flags |= MENU_CHANGED;
-       }
-}
-
-void sym_set_all_changed(void)
-{
-       struct symbol *sym;
-       int i;
-
-       for_all_symbols(i, sym)
-               sym_set_changed(sym);
-}
-
 bool sym_tristate_within_range(struct symbol *sym, tristate val)
 {
        int type = sym_get_type(sym);
 bool sym_tristate_within_range(struct symbol *sym, tristate val)
 {
        int type = sym_get_type(sym);
@@ -459,8 +467,6 @@ bool sym_set_tristate_value(struct symbol *sym, tristate val)
        sym->user.tri = val;
        if (oldval != val) {
                sym_clear_all_valid();
        sym->user.tri = val;
        if (oldval != val) {
                sym_clear_all_valid();
-               if (sym == modules_sym)
-                       sym_set_all_changed();
        }
 
        return true;
        }
 
        return true;
@@ -753,6 +759,7 @@ struct symbol **sym_re_search(const char *pattern)
                                return NULL;
                        }
                }
                                return NULL;
                        }
                }
+               sym_calc_value(sym);
                sym_arr[cnt++] = sym;
        }
        if (sym_arr)
                sym_arr[cnt++] = sym;
        }
        if (sym_arr)
This page took 0.0279 seconds and 4 git commands to generate.