diff options
Diffstat (limited to 'scripts/kconfig/expr.h')
-rw-r--r-- | scripts/kconfig/expr.h | 82 |
1 files changed, 54 insertions, 28 deletions
diff --git a/scripts/kconfig/expr.h b/scripts/kconfig/expr.h index 9d4cba1c001d..6408fefae083 100644 --- a/scripts/kconfig/expr.h +++ b/scripts/kconfig/expr.h | |||
@@ -65,9 +65,13 @@ enum symbol_type { | |||
65 | S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER | 65 | S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /* enum values are used as index to symbol.def[] */ | ||
68 | enum { | 69 | enum { |
69 | S_DEF_USER, /* main user value */ | 70 | S_DEF_USER, /* main user value */ |
70 | S_DEF_AUTO, | 71 | S_DEF_AUTO, /* values read from auto.conf */ |
72 | S_DEF_DEF3, /* Reserved for UI usage */ | ||
73 | S_DEF_DEF4, /* Reserved for UI usage */ | ||
74 | S_DEF_COUNT | ||
71 | }; | 75 | }; |
72 | 76 | ||
73 | struct symbol { | 77 | struct symbol { |
@@ -75,7 +79,7 @@ struct symbol { | |||
75 | char *name; | 79 | char *name; |
76 | enum symbol_type type; | 80 | enum symbol_type type; |
77 | struct symbol_value curr; | 81 | struct symbol_value curr; |
78 | struct symbol_value def[4]; | 82 | struct symbol_value def[S_DEF_COUNT]; |
79 | tristate visible; | 83 | tristate visible; |
80 | int flags; | 84 | int flags; |
81 | struct property *prop; | 85 | struct property *prop; |
@@ -84,42 +88,64 @@ struct symbol { | |||
84 | 88 | ||
85 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) | 89 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) |
86 | 90 | ||
87 | #define SYMBOL_CONST 0x0001 | 91 | #define SYMBOL_CONST 0x0001 /* symbol is const */ |
88 | #define SYMBOL_CHECK 0x0008 | 92 | #define SYMBOL_CHECK 0x0008 /* used during dependency checking */ |
89 | #define SYMBOL_CHOICE 0x0010 | 93 | #define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */ |
90 | #define SYMBOL_CHOICEVAL 0x0020 | 94 | #define SYMBOL_CHOICEVAL 0x0020 /* used as a value in a choice block */ |
91 | #define SYMBOL_VALID 0x0080 | 95 | #define SYMBOL_VALID 0x0080 /* set when symbol.curr is calculated */ |
92 | #define SYMBOL_OPTIONAL 0x0100 | 96 | #define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ |
93 | #define SYMBOL_WRITE 0x0200 | 97 | #define SYMBOL_WRITE 0x0200 /* ? */ |
94 | #define SYMBOL_CHANGED 0x0400 | 98 | #define SYMBOL_CHANGED 0x0400 /* ? */ |
95 | #define SYMBOL_AUTO 0x1000 | 99 | #define SYMBOL_AUTO 0x1000 /* value from environment variable */ |
96 | #define SYMBOL_CHECKED 0x2000 | 100 | #define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ |
97 | #define SYMBOL_WARNED 0x8000 | 101 | #define SYMBOL_WARNED 0x8000 /* warning has been issued */ |
98 | #define SYMBOL_DEF 0x10000 | 102 | |
99 | #define SYMBOL_DEF_USER 0x10000 | 103 | /* Set when symbol.def[] is used */ |
100 | #define SYMBOL_DEF_AUTO 0x20000 | 104 | #define SYMBOL_DEF 0x10000 /* First bit of SYMBOL_DEF */ |
101 | #define SYMBOL_DEF3 0x40000 | 105 | #define SYMBOL_DEF_USER 0x10000 /* symbol.def[S_DEF_USER] is valid */ |
102 | #define SYMBOL_DEF4 0x80000 | 106 | #define SYMBOL_DEF_AUTO 0x20000 /* symbol.def[S_DEF_AUTO] is valid */ |
107 | #define SYMBOL_DEF3 0x40000 /* symbol.def[S_DEF_3] is valid */ | ||
108 | #define SYMBOL_DEF4 0x80000 /* symbol.def[S_DEF_4] is valid */ | ||
103 | 109 | ||
104 | #define SYMBOL_MAXLENGTH 256 | 110 | #define SYMBOL_MAXLENGTH 256 |
105 | #define SYMBOL_HASHSIZE 257 | 111 | #define SYMBOL_HASHSIZE 257 |
106 | #define SYMBOL_HASHMASK 0xff | 112 | #define SYMBOL_HASHMASK 0xff |
107 | 113 | ||
114 | /* A property represent the config options that can be associated | ||
115 | * with a config "symbol". | ||
116 | * Sample: | ||
117 | * config FOO | ||
118 | * default y | ||
119 | * prompt "foo prompt" | ||
120 | * select BAR | ||
121 | * config BAZ | ||
122 | * int "BAZ Value" | ||
123 | * range 1..255 | ||
124 | */ | ||
108 | enum prop_type { | 125 | enum prop_type { |
109 | P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_DEFAULT, P_CHOICE, | 126 | P_UNKNOWN, |
110 | P_SELECT, P_RANGE, P_ENV | 127 | P_PROMPT, /* prompt "foo prompt" or "BAZ Value" */ |
128 | P_COMMENT, /* text associated with a comment */ | ||
129 | P_MENU, /* prompt associated with a menuconfig option */ | ||
130 | P_DEFAULT, /* default y */ | ||
131 | P_CHOICE, /* choice value */ | ||
132 | P_SELECT, /* select BAR */ | ||
133 | P_RANGE, /* range 7..100 (for a symbol) */ | ||
134 | P_ENV, /* value from environment variable */ | ||
111 | }; | 135 | }; |
112 | 136 | ||
113 | struct property { | 137 | struct property { |
114 | struct property *next; | 138 | struct property *next; /* next property - null if last */ |
115 | struct symbol *sym; | 139 | struct symbol *sym; /* the symbol for which the property is associated */ |
116 | enum prop_type type; | 140 | enum prop_type type; /* type of property */ |
117 | const char *text; | 141 | const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */ |
118 | struct expr_value visible; | 142 | struct expr_value visible; |
119 | struct expr *expr; | 143 | struct expr *expr; /* the optional conditional part of the property */ |
120 | struct menu *menu; | 144 | struct menu *menu; /* the menu the property are associated with |
121 | struct file *file; | 145 | * valid for: P_SELECT, P_RANGE, P_CHOICE, |
122 | int lineno; | 146 | * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */ |
147 | struct file *file; /* what file was this property defined */ | ||
148 | int lineno; /* what lineno was this property defined */ | ||
123 | }; | 149 | }; |
124 | 150 | ||
125 | #define for_all_properties(sym, st, tok) \ | 151 | #define for_all_properties(sym, st, tok) \ |