symbol.c (c0e150acde52e4661675539bf5323309270f2e83) | symbol.c (0c1822e6991a10da6dc391f0a2e2cf5fb2e31238) |
---|---|
1/* 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Released under the terms of the GNU GPL v2.0. 4 */ 5 6#include <ctype.h> 7#include <stdlib.h> 8#include <string.h> --- 213 unchanged lines hidden (view full) --- 222 223static struct symbol *sym_calc_choice(struct symbol *sym) 224{ 225 struct symbol *def_sym; 226 struct property *prop; 227 struct expr *e; 228 229 /* is the user choice visible? */ | 1/* 2 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> 3 * Released under the terms of the GNU GPL v2.0. 4 */ 5 6#include <ctype.h> 7#include <stdlib.h> 8#include <string.h> --- 213 unchanged lines hidden (view full) --- 222 223static struct symbol *sym_calc_choice(struct symbol *sym) 224{ 225 struct symbol *def_sym; 226 struct property *prop; 227 struct expr *e; 228 229 /* is the user choice visible? */ |
230 def_sym = sym->user.val; | 230 def_sym = sym->def[S_DEF_USER].val; |
231 if (def_sym) { 232 sym_calc_visibility(def_sym); 233 if (def_sym->visible != no) 234 return def_sym; 235 } 236 237 /* any of the defaults visible? */ 238 for_all_defaults(sym, prop) { --- 62 unchanged lines hidden (view full) --- 301 case S_BOOLEAN: 302 case S_TRISTATE: 303 if (sym_is_choice_value(sym) && sym->visible == yes) { 304 prop = sym_get_choice_prop(sym); 305 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; 306 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { 307 sym->flags |= SYMBOL_WRITE; 308 if (sym_has_value(sym)) | 231 if (def_sym) { 232 sym_calc_visibility(def_sym); 233 if (def_sym->visible != no) 234 return def_sym; 235 } 236 237 /* any of the defaults visible? */ 238 for_all_defaults(sym, prop) { --- 62 unchanged lines hidden (view full) --- 301 case S_BOOLEAN: 302 case S_TRISTATE: 303 if (sym_is_choice_value(sym) && sym->visible == yes) { 304 prop = sym_get_choice_prop(sym); 305 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; 306 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { 307 sym->flags |= SYMBOL_WRITE; 308 if (sym_has_value(sym)) |
309 newval.tri = sym->user.tri; | 309 newval.tri = sym->def[S_DEF_USER].tri; |
310 else if (!sym_is_choice(sym)) { 311 prop = sym_get_default_prop(sym); 312 if (prop) 313 newval.tri = expr_calc_value(prop->expr); 314 } 315 newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri); 316 } else if (!sym_is_choice(sym)) { 317 prop = sym_get_default_prop(sym); --- 6 unchanged lines hidden (view full) --- 324 newval.tri = yes; 325 break; 326 case S_STRING: 327 case S_HEX: 328 case S_INT: 329 if (sym->visible != no) { 330 sym->flags |= SYMBOL_WRITE; 331 if (sym_has_value(sym)) { | 310 else if (!sym_is_choice(sym)) { 311 prop = sym_get_default_prop(sym); 312 if (prop) 313 newval.tri = expr_calc_value(prop->expr); 314 } 315 newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri); 316 } else if (!sym_is_choice(sym)) { 317 prop = sym_get_default_prop(sym); --- 6 unchanged lines hidden (view full) --- 324 newval.tri = yes; 325 break; 326 case S_STRING: 327 case S_HEX: 328 case S_INT: 329 if (sym->visible != no) { 330 sym->flags |= SYMBOL_WRITE; 331 if (sym_has_value(sym)) { |
332 newval.val = sym->user.val; | 332 newval.val = sym->def[S_DEF_USER].val; |
333 break; 334 } 335 } 336 prop = sym_get_default_prop(sym); 337 if (prop) { 338 struct symbol *ds = prop_get_symbol(prop); 339 if (ds) { 340 sym->flags |= SYMBOL_WRITE; --- 93 unchanged lines hidden (view full) --- 434 * setting a choice value also resets the new flag of the choice 435 * symbol and all other choice values. 436 */ 437 if (sym_is_choice_value(sym) && val == yes) { 438 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); 439 struct property *prop; 440 struct expr *e; 441 | 333 break; 334 } 335 } 336 prop = sym_get_default_prop(sym); 337 if (prop) { 338 struct symbol *ds = prop_get_symbol(prop); 339 if (ds) { 340 sym->flags |= SYMBOL_WRITE; --- 93 unchanged lines hidden (view full) --- 434 * setting a choice value also resets the new flag of the choice 435 * symbol and all other choice values. 436 */ 437 if (sym_is_choice_value(sym) && val == yes) { 438 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); 439 struct property *prop; 440 struct expr *e; 441 |
442 cs->user.val = sym; | 442 cs->def[S_DEF_USER].val = sym; |
443 cs->flags &= ~SYMBOL_NEW; 444 prop = sym_get_choice_prop(cs); 445 for (e = prop->expr; e; e = e->left.expr) { 446 if (e->right.sym->visible != no) 447 e->right.sym->flags &= ~SYMBOL_NEW; 448 } 449 } 450 | 443 cs->flags &= ~SYMBOL_NEW; 444 prop = sym_get_choice_prop(cs); 445 for (e = prop->expr; e; e = e->left.expr) { 446 if (e->right.sym->visible != no) 447 e->right.sym->flags &= ~SYMBOL_NEW; 448 } 449 } 450 |
451 sym->user.tri = val; | 451 sym->def[S_DEF_USER].tri = val; |
452 if (oldval != val) { 453 sym_clear_all_valid(); 454 if (sym == modules_sym) 455 sym_set_all_changed(); 456 } 457 458 return true; 459} --- 131 unchanged lines hidden (view full) --- 591 if (!sym_string_within_range(sym, newval)) 592 return false; 593 594 if (sym->flags & SYMBOL_NEW) { 595 sym->flags &= ~SYMBOL_NEW; 596 sym_set_changed(sym); 597 } 598 | 452 if (oldval != val) { 453 sym_clear_all_valid(); 454 if (sym == modules_sym) 455 sym_set_all_changed(); 456 } 457 458 return true; 459} --- 131 unchanged lines hidden (view full) --- 591 if (!sym_string_within_range(sym, newval)) 592 return false; 593 594 if (sym->flags & SYMBOL_NEW) { 595 sym->flags &= ~SYMBOL_NEW; 596 sym_set_changed(sym); 597 } 598 |
599 oldval = sym->user.val; | 599 oldval = sym->def[S_DEF_USER].val; |
600 size = strlen(newval) + 1; 601 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { 602 size += 2; | 600 size = strlen(newval) + 1; 601 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { 602 size += 2; |
603 sym->user.val = val = malloc(size); | 603 sym->def[S_DEF_USER].val = val = malloc(size); |
604 *val++ = '0'; 605 *val++ = 'x'; 606 } else if (!oldval || strcmp(oldval, newval)) | 604 *val++ = '0'; 605 *val++ = 'x'; 606 } else if (!oldval || strcmp(oldval, newval)) |
607 sym->user.val = val = malloc(size); | 607 sym->def[S_DEF_USER].val = val = malloc(size); |
608 else 609 return true; 610 611 strcpy(val, newval); 612 free((void *)oldval); 613 sym_clear_all_valid(); 614 615 return true; --- 267 unchanged lines hidden --- | 608 else 609 return true; 610 611 strcpy(val, newval); 612 free((void *)oldval); 613 sym_clear_all_valid(); 614 615 return true; --- 267 unchanged lines hidden --- |