• Home
  • Raw
  • Download

Lines Matching refs:sym

38 void sym_add_default(struct symbol *sym, const char *def)  in sym_add_default()  argument
40 struct property *prop = prop_alloc(P_DEFAULT, sym); in sym_add_default()
47 struct symbol *sym; in sym_init() local
58 sym = sym_lookup("ARCH", 0); in sym_init()
59 sym->type = S_STRING; in sym_init()
60 sym->flags |= SYMBOL_AUTO; in sym_init()
63 sym_add_default(sym, p); in sym_init()
65 sym = sym_lookup("KERNELVERSION", 0); in sym_init()
66 sym->type = S_STRING; in sym_init()
67 sym->flags |= SYMBOL_AUTO; in sym_init()
70 sym_add_default(sym, p); in sym_init()
72 sym = sym_lookup("UNAME_RELEASE", 0); in sym_init()
73 sym->type = S_STRING; in sym_init()
74 sym->flags |= SYMBOL_AUTO; in sym_init()
75 sym_add_default(sym, uts.release); in sym_init()
78 enum symbol_type sym_get_type(struct symbol *sym) in sym_get_type() argument
80 enum symbol_type type = sym->type; in sym_get_type()
83 if (sym_is_choice_value(sym) && sym->visible == yes) in sym_get_type()
112 struct property *sym_get_choice_prop(struct symbol *sym) in sym_get_choice_prop() argument
116 for_all_choices(sym, prop) in sym_get_choice_prop()
121 struct property *sym_get_default_prop(struct symbol *sym) in sym_get_default_prop() argument
125 for_all_defaults(sym, prop) { in sym_get_default_prop()
133 struct property *sym_get_range_prop(struct symbol *sym) in sym_get_range_prop() argument
137 for_all_properties(sym, prop, P_RANGE) { in sym_get_range_prop()
145 static int sym_get_range_val(struct symbol *sym, int base) in sym_get_range_val() argument
147 sym_calc_value(sym); in sym_get_range_val()
148 switch (sym->type) { in sym_get_range_val()
158 return strtol(sym->curr.val, NULL, base); in sym_get_range_val()
161 static void sym_validate_range(struct symbol *sym) in sym_validate_range() argument
167 switch (sym->type) { in sym_validate_range()
177 prop = sym_get_range_prop(sym); in sym_validate_range()
180 val = strtol(sym->curr.val, NULL, base); in sym_validate_range()
181 val2 = sym_get_range_val(prop->expr->left.sym, base); in sym_validate_range()
183 val2 = sym_get_range_val(prop->expr->right.sym, base); in sym_validate_range()
187 if (sym->type == S_INT) in sym_validate_range()
191 sym->curr.val = strdup(str); in sym_validate_range()
194 static void sym_calc_visibility(struct symbol *sym) in sym_calc_visibility() argument
201 for_all_prompts(sym, prop) { in sym_calc_visibility()
205 if (tri == mod && (sym->type != S_TRISTATE || modules_val == no)) in sym_calc_visibility()
207 if (sym->visible != tri) { in sym_calc_visibility()
208 sym->visible = tri; in sym_calc_visibility()
209 sym_set_changed(sym); in sym_calc_visibility()
211 if (sym_is_choice_value(sym)) in sym_calc_visibility()
214 if (sym->rev_dep.expr) in sym_calc_visibility()
215 tri = expr_calc_value(sym->rev_dep.expr); in sym_calc_visibility()
216 if (tri == mod && sym_get_type(sym) == S_BOOLEAN) in sym_calc_visibility()
218 if (sym->rev_dep.tri != tri) { in sym_calc_visibility()
219 sym->rev_dep.tri = tri; in sym_calc_visibility()
220 sym_set_changed(sym); in sym_calc_visibility()
224 static struct symbol *sym_calc_choice(struct symbol *sym) in sym_calc_choice() argument
231 def_sym = sym->def[S_DEF_USER].val; in sym_calc_choice()
239 for_all_defaults(sym, prop) { in sym_calc_choice()
250 prop = sym_get_choice_prop(sym); in sym_calc_choice()
252 def_sym = e->right.sym; in sym_calc_choice()
259 sym->curr.tri = no; in sym_calc_choice()
263 void sym_calc_value(struct symbol *sym) in sym_calc_value() argument
269 if (!sym) in sym_calc_value()
272 if (sym->flags & SYMBOL_VALID) in sym_calc_value()
274 sym->flags |= SYMBOL_VALID; in sym_calc_value()
276 oldval = sym->curr; in sym_calc_value()
278 switch (sym->type) { in sym_calc_value()
289 sym->curr.val = sym->name; in sym_calc_value()
290 sym->curr.tri = no; in sym_calc_value()
293 if (!sym_is_choice_value(sym)) in sym_calc_value()
294 sym->flags &= ~SYMBOL_WRITE; in sym_calc_value()
296 sym_calc_visibility(sym); in sym_calc_value()
299 sym->curr = newval; in sym_calc_value()
301 switch (sym_get_type(sym)) { in sym_calc_value()
304 if (sym_is_choice_value(sym) && sym->visible == yes) { in sym_calc_value()
305 prop = sym_get_choice_prop(sym); in sym_calc_value()
306 newval.tri = (prop_get_symbol(prop)->curr.val == sym) ? yes : no; in sym_calc_value()
307 } else if (E_OR(sym->visible, sym->rev_dep.tri) != no) { in sym_calc_value()
308 sym->flags |= SYMBOL_WRITE; in sym_calc_value()
309 if (sym_has_value(sym)) in sym_calc_value()
310 newval.tri = sym->def[S_DEF_USER].tri; in sym_calc_value()
311 else if (!sym_is_choice(sym)) { in sym_calc_value()
312 prop = sym_get_default_prop(sym); in sym_calc_value()
316 newval.tri = E_OR(E_AND(newval.tri, sym->visible), sym->rev_dep.tri); in sym_calc_value()
317 } else if (!sym_is_choice(sym)) { in sym_calc_value()
318 prop = sym_get_default_prop(sym); in sym_calc_value()
320 sym->flags |= SYMBOL_WRITE; in sym_calc_value()
324 if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) in sym_calc_value()
330 if (sym->visible != no) { in sym_calc_value()
331 sym->flags |= SYMBOL_WRITE; in sym_calc_value()
332 if (sym_has_value(sym)) { in sym_calc_value()
333 newval.val = sym->def[S_DEF_USER].val; in sym_calc_value()
337 prop = sym_get_default_prop(sym); in sym_calc_value()
341 sym->flags |= SYMBOL_WRITE; in sym_calc_value()
351 sym->curr = newval; in sym_calc_value()
352 if (sym_is_choice(sym) && newval.tri == yes) in sym_calc_value()
353 sym->curr.val = sym_calc_choice(sym); in sym_calc_value()
354 sym_validate_range(sym); in sym_calc_value()
356 if (memcmp(&oldval, &sym->curr, sizeof(oldval))) { in sym_calc_value()
357 sym_set_changed(sym); in sym_calc_value()
358 if (modules_sym == sym) { in sym_calc_value()
364 if (sym_is_choice(sym)) { in sym_calc_value()
365 int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); in sym_calc_value()
366 prop = sym_get_choice_prop(sym); in sym_calc_value()
368 e->right.sym->flags |= flags; in sym_calc_value()
370 sym_set_changed(e->right.sym); in sym_calc_value()
377 struct symbol *sym; in sym_clear_all_valid() local
380 for_all_symbols(i, sym) in sym_clear_all_valid()
381 sym->flags &= ~SYMBOL_VALID; in sym_clear_all_valid()
387 void sym_set_changed(struct symbol *sym) in sym_set_changed() argument
391 sym->flags |= SYMBOL_CHANGED; in sym_set_changed()
392 for (prop = sym->prop; prop; prop = prop->next) { in sym_set_changed()
400 struct symbol *sym; in sym_set_all_changed() local
403 for_all_symbols(i, sym) in sym_set_all_changed()
404 sym_set_changed(sym); in sym_set_all_changed()
407 bool sym_tristate_within_range(struct symbol *sym, tristate val) in sym_tristate_within_range() argument
409 int type = sym_get_type(sym); in sym_tristate_within_range()
411 if (sym->visible == no) in sym_tristate_within_range()
419 if (sym->visible <= sym->rev_dep.tri) in sym_tristate_within_range()
421 if (sym_is_choice_value(sym) && sym->visible == yes) in sym_tristate_within_range()
423 return val >= sym->rev_dep.tri && val <= sym->visible; in sym_tristate_within_range()
426 bool sym_set_tristate_value(struct symbol *sym, tristate val) in sym_set_tristate_value() argument
428 tristate oldval = sym_get_tristate_value(sym); in sym_set_tristate_value()
430 if (oldval != val && !sym_tristate_within_range(sym, val)) in sym_set_tristate_value()
433 if (!(sym->flags & SYMBOL_DEF_USER)) { in sym_set_tristate_value()
434 sym->flags |= SYMBOL_DEF_USER; in sym_set_tristate_value()
435 sym_set_changed(sym); in sym_set_tristate_value()
441 if (sym_is_choice_value(sym) && val == yes) { in sym_set_tristate_value()
442 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); in sym_set_tristate_value()
446 cs->def[S_DEF_USER].val = sym; in sym_set_tristate_value()
450 if (e->right.sym->visible != no) in sym_set_tristate_value()
451 e->right.sym->flags |= SYMBOL_DEF_USER; in sym_set_tristate_value()
455 sym->def[S_DEF_USER].tri = val; in sym_set_tristate_value()
462 tristate sym_toggle_tristate_value(struct symbol *sym) in sym_toggle_tristate_value() argument
466 oldval = newval = sym_get_tristate_value(sym); in sym_toggle_tristate_value()
479 if (sym_set_tristate_value(sym, newval)) in sym_toggle_tristate_value()
485 bool sym_string_valid(struct symbol *sym, const char *str) in sym_string_valid() argument
489 switch (sym->type) { in sym_string_valid()
528 bool sym_string_within_range(struct symbol *sym, const char *str) in sym_string_within_range() argument
533 switch (sym->type) { in sym_string_within_range()
535 return sym_string_valid(sym, str); in sym_string_within_range()
537 if (!sym_string_valid(sym, str)) in sym_string_within_range()
539 prop = sym_get_range_prop(sym); in sym_string_within_range()
543 return val >= sym_get_range_val(prop->expr->left.sym, 10) && in sym_string_within_range()
544 val <= sym_get_range_val(prop->expr->right.sym, 10); in sym_string_within_range()
546 if (!sym_string_valid(sym, str)) in sym_string_within_range()
548 prop = sym_get_range_prop(sym); in sym_string_within_range()
552 return val >= sym_get_range_val(prop->expr->left.sym, 16) && in sym_string_within_range()
553 val <= sym_get_range_val(prop->expr->right.sym, 16); in sym_string_within_range()
558 return sym_tristate_within_range(sym, yes); in sym_string_within_range()
560 return sym_tristate_within_range(sym, mod); in sym_string_within_range()
562 return sym_tristate_within_range(sym, no); in sym_string_within_range()
570 bool sym_set_string_value(struct symbol *sym, const char *newval) in sym_set_string_value() argument
576 switch (sym->type) { in sym_set_string_value()
581 return sym_set_tristate_value(sym, yes); in sym_set_string_value()
583 return sym_set_tristate_value(sym, mod); in sym_set_string_value()
585 return sym_set_tristate_value(sym, no); in sym_set_string_value()
592 if (!sym_string_within_range(sym, newval)) in sym_set_string_value()
595 if (!(sym->flags & SYMBOL_DEF_USER)) { in sym_set_string_value()
596 sym->flags |= SYMBOL_DEF_USER; in sym_set_string_value()
597 sym_set_changed(sym); in sym_set_string_value()
600 oldval = sym->def[S_DEF_USER].val; in sym_set_string_value()
602 if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { in sym_set_string_value()
604 sym->def[S_DEF_USER].val = val = malloc(size); in sym_set_string_value()
608 sym->def[S_DEF_USER].val = val = malloc(size); in sym_set_string_value()
619 const char *sym_get_string_value(struct symbol *sym) in sym_get_string_value() argument
623 switch (sym->type) { in sym_get_string_value()
626 val = sym_get_tristate_value(sym); in sym_get_string_value()
639 return (const char *)sym->curr.val; in sym_get_string_value()
642 bool sym_is_changable(struct symbol *sym) in sym_is_changable() argument
644 return sym->visible > sym->rev_dep.tri; in sym_is_changable()
723 struct symbol *sym, **sym_arr = NULL; in sym_re_search() local
734 for_all_symbols(i, sym) { in sym_re_search()
735 if (sym->flags & SYMBOL_CONST || !sym->name) in sym_re_search()
737 if (regexec(&re, sym->name, 0, NULL, 0)) in sym_re_search()
748 sym_arr[cnt++] = sym; in sym_re_search()
758 struct symbol *sym_check_deps(struct symbol *sym);
762 struct symbol *sym; in sym_check_expr_deps() local
769 sym = sym_check_expr_deps(e->left.expr); in sym_check_expr_deps()
770 if (sym) in sym_check_expr_deps()
771 return sym; in sym_check_expr_deps()
777 sym = sym_check_deps(e->left.sym); in sym_check_expr_deps()
778 if (sym) in sym_check_expr_deps()
779 return sym; in sym_check_expr_deps()
780 return sym_check_deps(e->right.sym); in sym_check_expr_deps()
782 return sym_check_deps(e->left.sym); in sym_check_expr_deps()
790 struct symbol *sym_check_deps(struct symbol *sym) in sym_check_deps() argument
795 if (sym->flags & SYMBOL_CHECK) { in sym_check_deps()
796 printf("Warning! Found recursive dependency: %s", sym->name); in sym_check_deps()
797 return sym; in sym_check_deps()
799 if (sym->flags & SYMBOL_CHECKED) in sym_check_deps()
802 sym->flags |= (SYMBOL_CHECK | SYMBOL_CHECKED); in sym_check_deps()
803 sym2 = sym_check_expr_deps(sym->rev_dep.expr); in sym_check_deps()
807 for (prop = sym->prop; prop; prop = prop->next) { in sym_check_deps()
813 if (prop->type != P_DEFAULT || sym_is_choice(sym)) in sym_check_deps()
821 printf(" %s", sym->name); in sym_check_deps()
822 if (sym2 == sym) { in sym_check_deps()
827 sym->flags &= ~SYMBOL_CHECK; in sym_check_deps()
831 struct property *prop_alloc(enum prop_type type, struct symbol *sym) in prop_alloc() argument
839 prop->sym = sym; in prop_alloc()
844 if (sym) { in prop_alloc()
845 for (propp = &sym->prop; *propp; propp = &(*propp)->next) in prop_alloc()
857 return prop->expr->left.sym; in prop_get_symbol()