From fffd30e6ea060b2abebb7ba9cdf881da00ca4cb9 Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sun, 17 Sep 2017 04:23:40 +0200 Subject: Add 'imply' support This is like a 'select' that only changes the default value of a symbol, not limiting what values the user can set it to (with one exception: A symbol implied to 'y' can't be set to 'm'). Symbol.get_implied_symbols() was added, corresponding to Symbol.get_selected_symbols(), and Symbol.__str__() was extended to print implied symbols and weak reverse dependencies. Weak reverse dependencies are the 'imply' version of 'select's reverse dependencies. --- tests/Kbounds | 33 ++++++++++++++++++++++++++++++++ tests/Kchain | 49 ++++++++++++++++++++++++++++-------------------- tests/Kdep | 18 ++++++++++++++++++ tests/Klocation_included | 2 ++ tests/Kref | 2 ++ tests/Ktext | 6 ++++++ 6 files changed, 90 insertions(+), 20 deletions(-) (limited to 'tests') diff --git a/tests/Kbounds b/tests/Kbounds index 9b10a3e..52e61c9 100644 --- a/tests/Kbounds +++ b/tests/Kbounds @@ -39,6 +39,39 @@ config M_SELECTED_TRISTATE config M_SELECTED_M_VISIBLE_TRISTATE tristate "m-selected m-visible tristate" if m +config N_IMPLIER + def_tristate n + imply N_IMPLIED_BOOL + imply N_IMPLIED_TRISTATE + +config M_IMPLIER + def_tristate m + imply M_IMPLIED_BOOL + imply M_IMPLIED_TRISTATE + +config Y_IMPLIER + def_tristate y + imply Y_IMPLIED_BOOL + imply Y_IMPLIED_TRISTATE + +config N_IMPLIED_BOOL + bool "n-implied bool" + +config N_IMPLIED_TRISTATE + tristate "n-implied tristate" + +config M_IMPLIED_BOOL + bool "m-implied bool" + +config M_IMPLIED_TRISTATE + tristate "m-implied tristate" + +config Y_IMPLIED_BOOL + bool "y-implied bool" + +config Y_IMPLIED_TRISTATE + tristate "y-implied tristate" + config STRING string "string" diff --git a/tests/Kchain b/tests/Kchain index 316bb04..dc57ee5 100644 --- a/tests/Kchain +++ b/tests/Kchain @@ -65,50 +65,59 @@ config CHAIN_SELECT_RELAY config CHAIN_16 bool "chain 16" + imply CHAIN_17 -if CHAIN_16 = 0 config CHAIN_17 - tristate "chain 17" + bool "chain 17" + +config CHAIN_IMPLY_RELAY + bool "chain imply relay" + default y + imply CHAIN_18 if CHAIN_17 + +if CHAIN_18 = 0 +config CHAIN_19 + tristate "chain 19" endif menu "chain menu" - depends on CHAIN_17 -config CHAIN_18 - bool "chain 18" + depends on CHAIN_19 +config CHAIN_20 + bool "chain 20" endmenu menu "chain menu visible if" - visible if CHAIN_18 -config CHAIN_19 - bool "chain 19" + visible if CHAIN_20 +config CHAIN_21 + bool "chain 21" endmenu choice CHAIN_CHOICE_1 - tristate "chain choice 1" if CHAIN_19 -config CHAIN_20 - tristate "chain 20" + tristate "chain choice 1" if CHAIN_21 +config CHAIN_22 + tristate "chain 22" config DUMMY_1 tristate "dummy 1" endchoice choice CHAIN_CHOICE_2 tristate "chain choice 2" - depends on CHAIN_20 + depends on CHAIN_22 config DUMMY_2 tristate "dummy 2" -config CHAIN_21 - tristate "chain 18" +config CHAIN_23 + tristate "chain 23" endchoice choice CHAIN_CHOICE_3 tristate "chain choice 3" - default DUMMY_3 if CHAIN_21 -config CHAIN_22 - tristate "chain 22" + default DUMMY_3 if CHAIN_23 +config CHAIN_24 + tristate "chain 24" config DUMMY_3 tristate "dummy 3" endchoice -config CHAIN_23 - string "chain 19" - depends on CHAIN_22 +config CHAIN_25 + string "chain 25" + depends on CHAIN_24 diff --git a/tests/Kdep b/tests/Kdep index 9f23f94..87defaa 100644 --- a/tests/Kdep +++ b/tests/Kdep @@ -1,5 +1,11 @@ config D bool "D" + select D29 + imply D30 + +config DUMMY + select D31 if D + imply D32 if D # The symbols below depend on D in different ways @@ -122,6 +128,18 @@ config D27 config D28 bool "D28" if n || ((n != D) || n) +config D29 + tristate "D29" + +config D30 + tristate "D30" + +config D31 + tristate "D31" + +config D32 + tristate "D32" + # # Choices # diff --git a/tests/Klocation_included b/tests/Klocation_included index 1164e58..674116a 100644 --- a/tests/Klocation_included +++ b/tests/Klocation_included @@ -11,6 +11,8 @@ config S bool select A if NOT_DEFINED = y select E if A + imply A + imply E if A endmenu choice bool "C" diff --git a/tests/Kref b/tests/Kref index a398c1a..a60561e 100644 --- a/tests/Kref +++ b/tests/Kref @@ -18,6 +18,8 @@ config MANY_REF depends on H select I if J = K || L != M select N if (A || !(B && (C = O))) + imply P if Q = R || S != T + imply U if (A || !(B && (C = V))) endif diff --git a/tests/Ktext b/tests/Ktext index dd9fd82..c645bde 100644 --- a/tests/Ktext +++ b/tests/Ktext @@ -7,6 +7,8 @@ config ADVANCED tristate "advanced prompt 1" if y || (BASIC && BASIC) select SELECTED_1 if BASIC && DUMMY select SELECTED_2 if !(DUMMY || BASIC) + imply IMPLIED_1 if BASIC || DUMMY + imply IMPLIED_2 if !(DUMMY && BASIC) default y if BASIC && !BASIC default n if BASIC = DUMMY @@ -21,6 +23,10 @@ config SELECTING_1 select ADVANCED if BASIC config SELECTING_2 select ADVANCED if !BASIC +config IMPLYING_1 + imply ADVANCED if DUMMY +config IMPLYING_2 + imply ADVANCED if !DUMMY config INT int -- cgit v1.2.3