Show
Ignore:
Timestamp:
07/16/07 13:06:39 (1 year ago)
Author:
tg
Message:

implement "select !FOO", everything including cosmetics from me,
except rev_dep_inv+deselected stuff, which is from nbd@openwrt –
thanks

selected symbols are now shown as “-+-” (on) or “_ _” (off)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freewrt/tools/config

    • Property svn:ignore changed from
      conf
      info.mk
      lex.zconf.c
      lkc_defs.h
      mconf
      tags
      zconf.tab.c
      zconf.tab.h
      to
      conf
      info.mk
      lex.backup
      lex.zconf.c
      lkc_defs.h
      mconf
      tags
      zconf.output
      zconf.tab.c
      zconf.tab.h
  • trunk/freewrt/tools/config/Makefile

    r3092 r3223  
    6969# By default we use the _shipped versions, uncomment the 
    7070# following line if you are modifying the flex/bison src. 
    71 #LKC_GENPARSER:=      1 
     71LKC_GENPARSER:=       1 
    7272 
    7373ifdef LKC_GENPARSER 
     
    7878lex.%.c: %.l 
    7979        flex -P$(notdir $*) -o$@ $< 
     80 
     81lex.zconf.o: lex.zconf.c $(SHARED_DEPS) 
     82        $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ 
     83 
     84zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(SHARED_DEPS) 
     85        $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ 
     86 
    8087else 
    8188 
  • trunk/freewrt/tools/config/expr.h

    r1 r3223  
    7575        struct expr *dep, *dep2; 
    7676        struct expr_value rev_dep; 
     77        struct expr_value rev_dep_inv; 
    7778}; 
    7879 
     
    102103 
    103104enum prop_type { 
    104         P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_RANGE 
     105        P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, P_SELECT, P_SELECTNOT, P_RANGE 
    105106}; 
    106107 
  • trunk/freewrt/tools/config/mconf.c

    r2532 r3223  
    327327                                        cprint_name("[%c]", val == no ? ' ' : '*'); 
    328328                                else 
    329                                         cprint_name("---"); 
     329                                        cprint_name(val == no ? "_ _" : "-+-"); 
    330330                                break; 
    331331                        case S_TRISTATE: 
     
    339339                                        cprint_name("<%c>", ch); 
    340340                                else 
    341                                         cprint_name("---"); 
     341                                        cprint_name(val == no ? "_ _" : "-+-"); 
    342342                                break; 
    343343                        default: 
  • trunk/freewrt/tools/config/menu.c

    r1 r3223  
    167167                        break; 
    168168                case P_SELECT: 
     169                case P_SELECTNOT: 
    169170                        sym2 = prop_get_symbol(prop); 
    170171                        if (sym->type != S_BOOLEAN && sym->type != S_TRISTATE) 
     
    244245                                        struct symbol *es = prop_get_symbol(prop); 
    245246                                        es->rev_dep.expr = expr_alloc_or(es->rev_dep.expr, 
     247                                                        expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); 
     248                                } else if (prop->type == P_SELECTNOT) { 
     249                                        struct symbol *es = prop_get_symbol(prop); 
     250                                        es->rev_dep_inv.expr = expr_alloc_or(es->rev_dep_inv.expr, 
    246251                                                        expr_alloc_and(expr_alloc_symbol(menu->sym), expr_copy(dep))); 
    247252                                } 
  • trunk/freewrt/tools/config/symbol.c

    r2629 r3223  
    55 
    66#include <ctype.h> 
     7#include <stdbool.h> 
    78#include <stdlib.h> 
    89#include <string.h> 
     
    140141        struct property *prop; 
    141142        tristate tri; 
     143        bool deselected = false; 
    142144 
    143145        /* any prompt visible? */ 
     
    149151        if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) 
    150152                tri = yes; 
     153        if (sym->rev_dep_inv.expr && (expr_calc_value(sym->rev_dep_inv.expr) == yes)) { 
     154                tri = no; 
     155                deselected = true; 
     156        } 
    151157        if (sym->visible != tri) { 
    152158                sym->visible = tri; 
    153159                sym_set_changed(sym); 
    154160        } 
    155         if (sym_is_choice_value(sym)
     161        if (sym_is_choice_value(sym) || deselected
    156162                return; 
    157163        tri = no; 
     
    249255                        prop = sym_get_choice_prop(sym); 
    250256                        newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; 
     257                } else if (sym->rev_dep_inv.expr && (expr_calc_value(sym->rev_dep_inv.expr) == yes)) { 
     258                        newval.tri = no; 
    251259                } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { 
    252260                        sym->flags |= SYMBOL_WRITE; 
     
    702710 
    703711        for (prop = sym->prop; prop; prop = prop->next) { 
    704                 if (prop->type == P_CHOICE || prop->type == P_SELECT
     712                if (prop->type == P_CHOICE || prop->type == P_SELECT || prop->type == P_SELECTNOT
    705713                        continue; 
    706714                sym2 = sym_check_expr_deps(prop->visible.expr); 
     
    764772                return "choice"; 
    765773        case P_SELECT: 
     774        case P_SELECTNOT: 
    766775                return "select"; 
    767776        case P_RANGE: 
  • trunk/freewrt/tools/config/zconf.y

    r444 r3223  
    220220}; 
    221221 
     222config_option: T_SELECT T_NOT T_WORD if_expr T_EOL 
     223{ 
     224        menu_add_symbol(P_SELECTNOT, sym_lookup($3, 0), $4); 
     225        printd(DEBUG_PARSE, "%s:%d:selectnot\n", zconf_curname(), zconf_lineno()); 
     226}; 
     227 
    222228config_option: T_RANGE symbol symbol if_expr T_EOL 
    223229{