summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>2000-02-24 00:12:35 +0000
committerRalf Baechle <ralf@linux-mips.org>2000-02-24 00:12:35 +0000
commit482368b1a8e45430672c58c9a42e7d2004367126 (patch)
treece2a1a567d4d62dee7c2e71a46a99cf72cf1d606 /scripts
parente4d0251c6f56ab2e191afb70f80f382793e23f74 (diff)
Merge with 2.3.47. Guys, this is buggy as shit. You've been warned.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Configure20
-rw-r--r--scripts/Menuconfig34
-rw-r--r--scripts/header.tk12
-rw-r--r--scripts/tkcond.c3
-rw-r--r--scripts/tkgen.c42
-rw-r--r--scripts/tkparse.c12
-rw-r--r--scripts/tkparse.h3
7 files changed, 104 insertions, 22 deletions
diff --git a/scripts/Configure b/scripts/Configure
index d993f6bf8..4916dc51d 100644
--- a/scripts/Configure
+++ b/scripts/Configure
@@ -311,6 +311,26 @@ function dep_bool () {
bool "$ques" "$var"
}
+function dep_mbool () {
+ ques=$1
+ var=$2
+ shift 2
+ while [ $# -gt 0 ]; do
+ case "$1" in
+ n)
+ define_bool "$var" "n"
+ return
+ ;;
+ m)
+ eval "$var=y"
+ ;;
+ esac
+ shift
+ done
+
+ bool "$ques" "$var"
+}
+
#
# define_int sets the value of a integer argument
#
diff --git a/scripts/Menuconfig b/scripts/Menuconfig
index 824d44014..d43739a67 100644
--- a/scripts/Menuconfig
+++ b/scripts/Menuconfig
@@ -258,6 +258,26 @@ function dep_bool () {
fi
}
+function dep_mbool () {
+ ques="$1"
+ var="$2"
+ dep=y
+ shift 2
+ while [ $# -gt 0 ]; do
+ if [ "$1" = y -o "$1" = m ]; then
+ shift
+ else
+ dep=n
+ shift $#
+ fi
+ done
+ if [ "$dep" = y ]; then
+ bool "$ques" "$var"
+ else
+ define_bool "$var" n
+ fi
+}
+
#
# Add a menu item which will call our local int function.
#
@@ -1083,6 +1103,20 @@ save_configuration () {
define_bool "$var" "$x"
}
+ function dep_mbool () {
+ set_x_info "$2" "n"
+ var="$2"
+ shift 2
+ while [ $# -gt 0 ]; do
+ if [ "$1" = y -o "$1" = m ]; then
+ shift
+ else
+ x=n; shift $#
+ fi
+ done
+ define_bool "$var" "$x"
+ }
+
function int () {
set_x_info "$2" "$3"
echo "$2=$x" >>$CONFIG
diff --git a/scripts/header.tk b/scripts/header.tk
index adb5e0d41..6a88f6881 100644
--- a/scripts/header.tk
+++ b/scripts/header.tk
@@ -249,17 +249,19 @@ proc sync_tristate { var dep } {
return $var
}
-proc sync_bool { var dep } {
+proc sync_bool { var dep modset } {
set var [sync_tristate $var $dep]
- if {$dep == 2} then {
- set var 0
+ if {$dep == 2 && $var == 2} then {
+ set var $modset
}
return $var
}
-proc write_tristate { file1 file2 varname variable deplist } {
+proc write_tristate { file1 file2 varname variable deplist modset } {
set variable [sync_tristate $variable [effective_dep $deplist]]
- if { $variable == 1 }\
+ if { $variable == 2 } \
+ then { set variable $modset }
+ if { $variable == 1 } \
then { puts $file1 "$varname=y"; \
puts $file2 "#define $varname 1" } \
elseif { $variable == 2 } \
diff --git a/scripts/tkcond.c b/scripts/tkcond.c
index f1a36bb25..34c923fe9 100644
--- a/scripts/tkcond.c
+++ b/scripts/tkcond.c
@@ -53,6 +53,7 @@ static void mark_variables( struct kconfig * scfg )
|| cfg->token == token_define_string
|| cfg->token == token_define_tristate
|| cfg->token == token_dep_bool
+ || cfg->token == token_dep_mbool
|| cfg->token == token_dep_tristate
|| cfg->token == token_hex
|| cfg->token == token_int
@@ -498,6 +499,7 @@ void fix_conditionals( struct kconfig * scfg )
case token_define_int:
case token_define_string:
case token_define_tristate:
+ case token_endmenu:
case token_hex:
case token_int:
case token_mainmenu_option:
@@ -516,6 +518,7 @@ void fix_conditionals( struct kconfig * scfg )
break;
case token_dep_bool:
+ case token_dep_mbool:
case token_dep_tristate:
/*
* Same as the other simple statements, plus an additional
diff --git a/scripts/tkgen.c b/scripts/tkgen.c
index 4a50a82a4..e016218d7 100644
--- a/scripts/tkgen.c
+++ b/scripts/tkgen.c
@@ -343,12 +343,16 @@ void generate_if( struct kconfig * cfg, struct condition * ocond,
*/
if ( line_num >= -1 )
{
+ int modtoyes = 0;
+
switch ( cfg->token )
{
default:
printf( " }\n" );
break;
+ case token_dep_mbool:
+ modtoyes = 1;
case token_dep_bool:
printf( "\n" );
for ( tmp = cfg->depend; tmp; tmp = tmp->next )
@@ -359,10 +363,13 @@ void generate_if( struct kconfig * cfg, struct condition * ocond,
printf( "\tset tmpvar_dep [effective_dep [list" );
for ( tmp = cfg->depend; tmp; tmp = tmp->next )
printf( " $%s", tmp->name );
- printf( "]];set %s [sync_bool $%s $tmpvar_dep];",
- vartable[cfg->nameindex].name, vartable[cfg->nameindex].name );
- printf( "if {$tmpvar_dep != 1} then {" );
- printf( "configure_entry .menu%d.config.f.x%d disabled {y};",
+ printf( "]];set %s [sync_bool $%s $tmpvar_dep %d];",
+ vartable[cfg->nameindex].name, vartable[cfg->nameindex].name,
+ modtoyes );
+ printf( "if {$tmpvar_dep != 1" );
+ if (modtoyes)
+ printf( " && $tmpvar_dep != 2" );
+ printf( "} then {configure_entry .menu%d.config.f.x%d disabled {y};",
menu_num, line_num );
printf( "} else {" );
printf( "configure_entry .menu%d.config.f.x%d normal {y};",
@@ -474,12 +481,16 @@ void generate_if( struct kconfig * cfg, struct condition * ocond,
}
else
{
+ int modtoyes = 0;
+
switch ( cfg->token )
{
default:
printf( " }\n" );
break;
+ case token_dep_mbool:
+ modtoyes = 1;
case token_dep_bool:
printf( "\n" );
for ( tmp = cfg->depend; tmp; tmp = tmp->next )
@@ -490,8 +501,9 @@ void generate_if( struct kconfig * cfg, struct condition * ocond,
printf( "\tset tmpvar_dep [effective_dep [list" );
for ( tmp = cfg->depend; tmp; tmp = tmp->next )
printf( " $%s", tmp->name );
- printf( "]];set %s [sync_bool $%s $tmpvar_dep];",
- vartable[cfg->nameindex].name, vartable[cfg->nameindex].name );
+ printf( "]];set %s [sync_bool $%s $tmpvar_dep %d];",
+ vartable[cfg->nameindex].name, vartable[cfg->nameindex].name,
+ modtoyes );
case token_bool:
if ( cfg->token == token_bool )
printf( "\n\t" );
@@ -604,6 +616,7 @@ void generate_writeconfig( struct kconfig * cfg )
{
struct condition * cond;
struct dependency * tmp;
+ int depmod = 2;
/*
* Generate global declaration for this symbol.
@@ -705,7 +718,7 @@ void generate_writeconfig( struct kconfig * cfg )
case token_bool:
case token_tristate:
- printf( "write_tristate $cfg $autocfg %s $%s [list $notmod]",
+ printf( "write_tristate $cfg $autocfg %s $%s [list $notmod] 2",
vartable[cfg->nameindex].name, vartable[cfg->nameindex].name );
if ( cfg->cond != NULL )
printf( " }" );
@@ -724,7 +737,7 @@ void generate_writeconfig( struct kconfig * cfg )
cfg1 != NULL && cfg1->token == token_choice_item;
cfg1 = cfg1->next )
{
- printf("\n\tif { $tmpvar_%d == \"%s\" } then { write_tristate $cfg $autocfg %s 1 [list $notmod] } else { write_tristate $cfg $autocfg %s 0 [list $notmod] }",
+ printf("\n\tif { $tmpvar_%d == \"%s\" } then { write_tristate $cfg $autocfg %s 1 [list $notmod] 2 } else { write_tristate $cfg $autocfg %s 0 [list $notmod] 2 }",
-(cfg->nameindex), cfg1->label,
vartable[cfg1->nameindex].name,
vartable[cfg1->nameindex].name );
@@ -751,23 +764,25 @@ void generate_writeconfig( struct kconfig * cfg )
case token_define_tristate:
if ( cfg->cond == NULL )
{
- printf( "write_tristate $cfg $autocfg %s $%s [list $notmod]\n",
+ printf( "write_tristate $cfg $autocfg %s $%s [list $notmod] 2\n",
vartable[cfg->nameindex].name, vartable[cfg->nameindex].name );
}
else
{
- printf( "write_tristate $cfg $autocfg %s $%s [list $notmod] }\n",
+ printf( "write_tristate $cfg $autocfg %s $%s [list $notmod] 2 }\n",
vartable[cfg->nameindex].name, cfg->value );
}
break;
+ case token_dep_mbool:
+ depmod = 1;
case token_dep_bool:
case token_dep_tristate:
printf( "write_tristate $cfg $autocfg %s $%s [list",
vartable[cfg->nameindex].name, vartable[cfg->nameindex].name );
for ( tmp = cfg->depend; tmp; tmp = tmp->next )
printf( " $%s", tmp->name );
- printf( "]" );
+ printf( "] %d", depmod );
if ( cfg->cond != NULL )
printf( " }" );
printf( "\n" );
@@ -887,6 +902,7 @@ static void generate_update_var( struct kconfig * scfg, int menu_num )
case token_define_string:
case token_dep_bool:
case token_dep_tristate:
+ case token_dep_mbool:
case token_int:
case token_hex:
case token_mainmenu_option:
@@ -1121,6 +1137,7 @@ void dump_tk_script( struct kconfig * scfg )
case token_choice_item:
case token_dep_bool:
case token_dep_tristate:
+ case token_dep_mbool:
case token_hex:
case token_int:
case token_string:
@@ -1222,6 +1239,7 @@ void dump_tk_script( struct kconfig * scfg )
break;
case token_dep_bool:
+ case token_dep_mbool:
cfg->menu_line = menu_line++;
printf( "\tdep_bool $w.config.f %d %d \"%s\" %s\n",
cfg->menu_number, cfg->menu_line, cfg->label,
@@ -1300,6 +1318,7 @@ void dump_tk_script( struct kconfig * scfg )
case token_choice_item:
case token_dep_bool:
case token_dep_tristate:
+ case token_dep_mbool:
case token_tristate:
if ( ! vartable[cfg->nameindex].global_written )
{
@@ -1376,6 +1395,7 @@ void dump_tk_script( struct kconfig * scfg )
case token_define_tristate:
case token_dep_bool:
case token_dep_tristate:
+ case token_dep_mbool:
case token_hex:
case token_int:
case token_string:
diff --git a/scripts/tkparse.c b/scripts/tkparse.c
index 86924a08d..bf27a3a8b 100644
--- a/scripts/tkparse.c
+++ b/scripts/tkparse.c
@@ -386,6 +386,7 @@ static void tokenize_line( const char * pnt )
match_token( token_define_string, "define_string" );
match_token( token_define_tristate, "define_tristate" );
match_token( token_dep_bool, "dep_bool" );
+ match_token( token_dep_mbool, "dep_mbool" );
match_token( token_dep_tristate, "dep_tristate" );
break;
@@ -549,6 +550,7 @@ static void tokenize_line( const char * pnt )
break;
case token_dep_bool:
+ case token_dep_mbool:
case token_dep_tristate:
pnt = get_qstring ( pnt, &cfg->label );
pnt = get_string ( pnt, &buffer );
@@ -585,7 +587,7 @@ static void tokenize_line( const char * pnt )
}
else
{
- syntax_error( "can't handle dep_bool/dep_tristate condition" );
+ syntax_error( "can't handle dep_bool/dep_mbool/dep_tristate condition" );
}
dep_ptr = &(*dep_ptr)->next;
while ( *pnt == ' ' || *pnt == '\t' )
@@ -623,12 +625,12 @@ static void tokenize_line( const char * pnt )
*cond_ptr = malloc( sizeof(struct condition) );
memset( *cond_ptr, 0, sizeof(struct condition) );
(*cond_ptr)->op = op_lparen;
- if ( token == token_dep_tristate )
- sprintf( fake_if, "[ \"$%s\" = \"y\" -o \"$%s\" = \"m\" -o \"$%s\" = \"\" ]; then",
- dep->name, dep->name, dep->name );
- else
+ if ( token == token_dep_bool )
sprintf( fake_if, "[ \"$%s\" = \"y\" -o \"$%s\" = \"\" ]; then",
dep->name, dep->name );
+ else
+ sprintf( fake_if, "[ \"$%s\" = \"y\" -o \"$%s\" = \"m\" -o \"$%s\" = \"\" ]; then",
+ dep->name, dep->name, dep->name );
(*cond_ptr)->next = tokenize_if( fake_if );
while ( *cond_ptr )
cond_ptr = &(*cond_ptr)->next;
diff --git a/scripts/tkparse.h b/scripts/tkparse.h
index ecb31b654..1ca16b185 100644
--- a/scripts/tkparse.h
+++ b/scripts/tkparse.h
@@ -19,6 +19,7 @@ enum e_token
token_define_string,
token_define_tristate,
token_dep_bool,
+ token_dep_mbool,
token_dep_tristate,
token_else,
token_endmenu,
@@ -77,7 +78,7 @@ struct condition
};
/*
- * Dependency list for dep_bool, dep_tristate
+ * Dependency list for dep_bool, dep_mbool, dep_tristate
*/
struct dependency