/* 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  */
struct symbol* sym_choice_default(struct symbol *sym)
/* 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  */
struct symbol* sym_choice_default(struct symbol *sym)
{
	struct symbol *def_sym;
	struct property *prop;
	struct expr *e;
	for_all_defaults(sym, prop) {
		prop->visible.tri = expr_calc_value(prop->visible.expr);
		if (prop->visible.tri == no)
			continue;
		def_sym = prop_get_symbol(prop);
		if (def_sym->visible != no)
			return def_sym;
	}
	prop = sym_get_choice_prop(sym);
	expr_list_for_each_sym(prop->expr, e, def_sym)
		if (def_sym->visible != no)
			return def_sym;
	return NULL;
}