* Find the default symbol for a choice. * First try the default values for the choice symbol * Next locate the first visible choice value * Return NULL if none was found */
| 242 | * Return NULL if none was found |
| 243 | */ |
| 244 | struct symbol *sym_choice_default(struct symbol *sym) |
| 245 | { |
| 246 | struct symbol *def_sym; |
| 247 | struct property *prop; |
| 248 | struct expr *e; |
| 249 | |
| 250 | /* any of the defaults visible? */ |
| 251 | for_all_defaults(sym, prop) { |
| 252 | prop->visible.tri = expr_calc_value(prop->visible.expr); |
| 253 | if (prop->visible.tri == no) |
| 254 | continue; |
| 255 | def_sym = prop_get_symbol(prop); |
| 256 | if (def_sym->visible != no) |
| 257 | return def_sym; |
| 258 | } |
| 259 | |
| 260 | /* just get the first visible value */ |
| 261 | prop = sym_get_choice_prop(sym); |
| 262 | expr_list_for_each_sym(prop->expr, e, def_sym) |
| 263 | if (def_sym->visible != no) |
| 264 | return def_sym; |
| 265 | |
| 266 | /* failed to locate any defaults */ |
| 267 | return NULL; |
| 268 | } |
| 269 | |
| 270 | static struct symbol *sym_calc_choice(struct symbol *sym) |
| 271 | { |
no test coverage detected