Lines Matching refs:sym
226 static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) in conf_set_sym_val() argument
230 switch (sym->type) { in conf_set_sym_val()
233 sym->def[def].tri = mod; in conf_set_sym_val()
234 sym->flags |= def_flags; in conf_set_sym_val()
240 sym->def[def].tri = yes; in conf_set_sym_val()
241 sym->flags |= def_flags; in conf_set_sym_val()
245 sym->def[def].tri = no; in conf_set_sym_val()
246 sym->flags |= def_flags; in conf_set_sym_val()
251 p, sym->name); in conf_set_sym_val()
273 if (sym_string_valid(sym, p)) { in conf_set_sym_val()
274 sym->def[def].val = xstrdup(p); in conf_set_sym_val()
275 sym->flags |= def_flags; in conf_set_sym_val()
279 p, sym->name); in conf_set_sym_val()
350 struct symbol *sym; in conf_read_simple() local
411 for_all_symbols(i, sym) { in conf_read_simple()
412 sym->flags |= SYMBOL_CHANGED; in conf_read_simple()
413 sym->flags &= ~(def_flags|SYMBOL_VALID); in conf_read_simple()
414 if (sym_is_choice(sym)) in conf_read_simple()
415 sym->flags |= def_flags; in conf_read_simple()
416 switch (sym->type) { in conf_read_simple()
420 if (sym->def[def].val) in conf_read_simple()
421 free(sym->def[def].val); in conf_read_simple()
424 sym->def[def].val = NULL; in conf_read_simple()
425 sym->def[def].tri = no; in conf_read_simple()
431 sym = NULL; in conf_read_simple()
442 sym = sym_find(line + 2 + strlen(CONFIG_)); in conf_read_simple()
443 if (!sym) { in conf_read_simple()
452 sym = sym_lookup(line + 2 + strlen(CONFIG_), 0); in conf_read_simple()
453 if (sym->type == S_UNKNOWN) in conf_read_simple()
454 sym->type = S_BOOLEAN; in conf_read_simple()
456 if (sym->flags & def_flags) { in conf_read_simple()
457 conf_warning("override: reassigning to symbol %s", sym->name); in conf_read_simple()
459 switch (sym->type) { in conf_read_simple()
462 sym->def[def].tri = no; in conf_read_simple()
463 sym->flags |= def_flags; in conf_read_simple()
480 sym = sym_find(line + strlen(CONFIG_)); in conf_read_simple()
481 if (!sym) { in conf_read_simple()
500 if (sym->flags & def_flags) { in conf_read_simple()
501 conf_warning("override: reassigning to symbol %s", sym->name); in conf_read_simple()
503 if (conf_set_sym_val(sym, def, def_flags, p)) in conf_read_simple()
513 if (sym && sym_is_choice_value(sym)) { in conf_read_simple()
514 struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); in conf_read_simple()
515 switch (sym->def[def].tri) { in conf_read_simple()
520 conf_warning("%s creates inconsistent choice state", sym->name); in conf_read_simple()
526 conf_warning("override: %s changes choice state", sym->name); in conf_read_simple()
527 cs->def[def].val = sym; in conf_read_simple()
530 cs->def[def].tri = EXPR_OR(cs->def[def].tri, sym->def[def].tri); in conf_read_simple()
544 struct symbol *sym; in conf_read() local
557 for_all_symbols(i, sym) { in conf_read()
558 sym_calc_value(sym); in conf_read()
559 if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE)) in conf_read()
561 if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { in conf_read()
563 switch (sym->type) { in conf_read()
566 if (sym->def[S_DEF_USER].tri == sym_get_tristate_value(sym)) in conf_read()
570 if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) in conf_read()
574 } else if (!sym_has_value(sym) && !(sym->flags & SYMBOL_WRITE)) in conf_read()
581 for_all_symbols(i, sym) { in conf_read()
582 if (sym_has_value(sym) && !sym_is_choice_value(sym)) { in conf_read()
588 if (sym->visible == no && !conf_unsaved) in conf_read()
589 sym->flags &= ~SYMBOL_DEF_USER; in conf_read()
590 switch (sym->type) { in conf_read()
595 if (sym_string_within_range(sym, sym->def[S_DEF_USER].val)) in conf_read()
597 sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER); in conf_read()
690 static void __print_symbol(FILE *fp, struct symbol *sym, enum output_n output_n, in __print_symbol() argument
696 if (sym->type == S_UNKNOWN) in __print_symbol()
699 val = sym_get_string_value(sym); in __print_symbol()
701 if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) && in __print_symbol()
704 fprintf(fp, "# %s%s is not set\n", CONFIG_, sym->name); in __print_symbol()
708 if (sym->type == S_STRING && escape_string) { in __print_symbol()
713 fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, val); in __print_symbol()
718 static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym) in print_symbol_for_dotconfig() argument
720 __print_symbol(fp, sym, OUTPUT_N_AS_UNSET, true); in print_symbol_for_dotconfig()
723 static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym) in print_symbol_for_autoconf() argument
725 __print_symbol(fp, sym, OUTPUT_N_NONE, false); in print_symbol_for_autoconf()
728 void print_symbol_for_listconfig(struct symbol *sym) in print_symbol_for_listconfig() argument
730 __print_symbol(stdout, sym, OUTPUT_N, true); in print_symbol_for_listconfig()
733 static void print_symbol_for_c(FILE *fp, struct symbol *sym) in print_symbol_for_c() argument
740 if (sym->type == S_UNKNOWN) in print_symbol_for_c()
743 val = sym_get_string_value(sym); in print_symbol_for_c()
745 switch (sym->type) { in print_symbol_for_c()
769 fprintf(fp, "#define %s%s%s %s%s\n", CONFIG_, sym->name, sym_suffix, in print_symbol_for_c()
775 static void print_symbol_for_rustccfg(FILE *fp, struct symbol *sym) in print_symbol_for_rustccfg() argument
783 if (sym->type == S_UNKNOWN) in print_symbol_for_rustccfg()
786 val = sym_get_string_value(sym); in print_symbol_for_rustccfg()
788 switch (sym->type) { in print_symbol_for_rustccfg()
807 fprintf(fp, "--cfg=%s%s\n", CONFIG_, sym->name); in print_symbol_for_rustccfg()
828 fprintf(fp, "--cfg=%s%s=%s\n", CONFIG_, sym->name, val); in print_symbol_for_rustccfg()
840 struct symbol *sym; in conf_write_defconfig() local
855 sym = menu->sym; in conf_write_defconfig()
856 if (sym == NULL) { in conf_write_defconfig()
859 } else if (!sym_is_choice(sym)) { in conf_write_defconfig()
860 sym_calc_value(sym); in conf_write_defconfig()
861 if (!(sym->flags & SYMBOL_WRITE)) in conf_write_defconfig()
863 sym->flags &= ~SYMBOL_WRITE; in conf_write_defconfig()
865 if (!sym_is_changeable(sym)) in conf_write_defconfig()
868 if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0) in conf_write_defconfig()
878 if (sym_is_choice_value(sym)) { in conf_write_defconfig()
882 cs = prop_get_symbol(sym_get_choice_prop(sym)); in conf_write_defconfig()
884 if (!sym_is_optional(cs) && sym == ds) { in conf_write_defconfig()
885 if ((sym->type == S_BOOLEAN) && in conf_write_defconfig()
886 sym_get_tristate_value(sym) == yes) in conf_write_defconfig()
890 print_symbol_for_dotconfig(out, sym); in conf_write_defconfig()
914 struct symbol *sym; in conf_write() local
957 sym = menu->sym; in conf_write()
958 if (!sym) { in conf_write()
967 } else if (!(sym->flags & SYMBOL_CHOICE) && in conf_write()
968 !(sym->flags & SYMBOL_WRITTEN)) { in conf_write()
969 sym_calc_value(sym); in conf_write()
970 if (!(sym->flags & SYMBOL_WRITE)) in conf_write()
976 sym->flags |= SYMBOL_WRITTEN; in conf_write()
977 print_symbol_for_dotconfig(out, sym); in conf_write()
987 if (!menu->sym && menu_is_visible(menu) && menu != &rootmenu && in conf_write()
1003 for_all_symbols(i, sym) in conf_write()
1004 sym->flags &= ~SYMBOL_WRITTEN; in conf_write()
1079 struct symbol *sym; in conf_touch_deps() local
1094 for_all_symbols(i, sym) { in conf_touch_deps()
1095 sym_calc_value(sym); in conf_touch_deps()
1096 if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name) in conf_touch_deps()
1098 if (sym->flags & SYMBOL_WRITE) { in conf_touch_deps()
1099 if (sym->flags & SYMBOL_DEF_AUTO) { in conf_touch_deps()
1104 switch (sym->type) { in conf_touch_deps()
1107 if (sym_get_tristate_value(sym) == in conf_touch_deps()
1108 sym->def[S_DEF_AUTO].tri) in conf_touch_deps()
1114 if (!strcmp(sym_get_string_value(sym), in conf_touch_deps()
1115 sym->def[S_DEF_AUTO].val)) in conf_touch_deps()
1126 switch (sym->type) { in conf_touch_deps()
1129 if (sym_get_tristate_value(sym) == no) in conf_touch_deps()
1136 } else if (!(sym->flags & SYMBOL_DEF_AUTO)) in conf_touch_deps()
1145 res = conf_touch_dep(sym->name); in conf_touch_deps()
1159 struct symbol *sym; in __conf_write_autoconf() local
1177 for_all_symbols(i, sym) in __conf_write_autoconf()
1178 if ((sym->flags & SYMBOL_WRITE) && sym->name) in __conf_write_autoconf()
1179 print_symbol(file, sym); in __conf_write_autoconf()
1198 struct symbol *sym; in conf_write_autoconf() local
1212 for_all_symbols(i, sym) in conf_write_autoconf()
1213 sym_calc_value(sym); in conf_write_autoconf()
1267 struct symbol *sym; in set_all_choice_values() local
1275 expr_list_for_each_sym(prop->expr, e, sym) { in set_all_choice_values()
1276 if (!sym_has_value(sym)) in set_all_choice_values()
1277 sym->def[S_DEF_USER].tri = no; in set_all_choice_values()