| 300 | } |
| 301 | |
| 302 | void sym_calc_value(struct symbol *sym) |
| 303 | { |
| 304 | struct symbol_value newval, oldval; |
| 305 | struct property *prop; |
| 306 | struct expr *e; |
| 307 | |
| 308 | if (!sym) |
| 309 | return; |
| 310 | |
| 311 | if (sym->flags & SYMBOL_VALID) |
| 312 | return; |
| 313 | |
| 314 | if (sym_is_choice_value(sym) && |
| 315 | sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) { |
| 316 | sym->flags &= ~SYMBOL_NEED_SET_CHOICE_VALUES; |
| 317 | prop = sym_get_choice_prop(sym); |
| 318 | sym_calc_value(prop_get_symbol(prop)); |
| 319 | } |
| 320 | |
| 321 | sym->flags |= SYMBOL_VALID; |
| 322 | |
| 323 | oldval = sym->curr; |
| 324 | |
| 325 | switch (sym->type) { |
| 326 | case S_INT: |
| 327 | case S_HEX: |
| 328 | case S_STRING: |
| 329 | newval = symbol_empty.curr; |
| 330 | break; |
| 331 | case S_BOOLEAN: |
| 332 | case S_TRISTATE: |
| 333 | newval = symbol_no.curr; |
| 334 | break; |
| 335 | default: |
| 336 | sym->curr.val = sym->name; |
| 337 | sym->curr.tri = no; |
| 338 | return; |
| 339 | } |
| 340 | sym->flags &= ~SYMBOL_WRITE; |
| 341 | |
| 342 | sym_calc_visibility(sym); |
| 343 | |
| 344 | if (sym->visible != no) |
| 345 | sym->flags |= SYMBOL_WRITE; |
| 346 | |
| 347 | /* set default if recursively called */ |
| 348 | sym->curr = newval; |
| 349 | |
| 350 | switch (sym_get_type(sym)) { |
| 351 | case S_BOOLEAN: |
| 352 | case S_TRISTATE: |
| 353 | if (sym_is_choice_value(sym) && sym->visible == yes) { |
| 354 | prop = sym_get_choice_prop(sym); |
| 355 | newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; |
| 356 | } else { |
| 357 | if (sym->visible != no) { |
| 358 | /* if the symbol is visible use the user value |
| 359 | * if available, otherwise try the default value |
no test coverage detected