diff options
-rw-r--r-- | scripts/write_config/solution.c | 13 | ||||
-rw-r--r-- | scripts/write_config/write.c | 99 |
2 files changed, 53 insertions, 59 deletions
diff --git a/scripts/write_config/solution.c b/scripts/write_config/solution.c index fd3d2cf..03e3f53 100644 --- a/scripts/write_config/solution.c +++ b/scripts/write_config/solution.c @@ -26,17 +26,18 @@ void solution_set(struct symlist *sl, FILE * f) { continue; if (sl->array[id - 1].sym == NULL) continue; - tristate val = sym_get_tristate_value(sl->array[id - 1].sym); - sym_set_tristate_value(sl->array[id - 1].sym, neg ? no : yes); - sym_calc_value(sl->array[id - 1].sym); + //tristate val = sym_get_tristate_value(sl->array[id - 1].sym); + //sym_set_tristate_value(sl->array[id - 1].sym, neg ? no : yes); + //sym_calc_value(sl->array[id - 1].sym); if (neg == (sym_get_tristate_value(sl->array[id - 1].sym) == no ? true : false)) printf("Ok\n"); else - printf("Problem %s\n", sl->array[id - 1].sym->name); - if (sym_get_tristate_value(sl->array[id - 1].sym) != val) - printf("Change\n"); + printf("Problem %s=%d/%d\n", sl->array[id - 1].sym->name, + !neg, sym_get_tristate_value(sl->array[id - 1].sym)); + //if (sym_get_tristate_value(sl->array[id - 1].sym) != val) + //printf("Change\n"); } else { if (w_pos >= w_size) { w_size *= 2; diff --git a/scripts/write_config/write.c b/scripts/write_config/write.c index 9ba95ab..d9d10b5 100644 --- a/scripts/write_config/write.c +++ b/scripts/write_config/write.c @@ -12,66 +12,59 @@ int verbose_level; char *file, *folder; int main(int argc, char **argv) { + verbose_level = 1; + int i; + for (i = 1; i < argc; i++) { + if (!strcmp(argv[i], "-v")) + verbose_level++; + else if (file == NULL) + file = argv[i]; + else if (folder == NULL) + folder = argv[i]; + else { + Eprintf("Unknown parameter: %s\n", argv[i]); + exit(1); + } + } + + if (file == NULL) { + Eprintf("No Kconfig input file specified\n"); + exit(2); + } + if (folder == NULL) { + Eprintf("No output folder specified\n"); + exit(3); + } + + char *rules_file, *symbol_map_file, *def_config_file, *solution_file; + asprintf(&rules_file, "%s/%s", folder, DEFAULT_RULES_FILE); + asprintf(&symbol_map_file, "%s/%s", folder, DEFAULT_SYMBOL_MAP_FILE); + asprintf(&def_config_file, "%s/%s", folder, DEFAULT_DEF_CONFIG_FILE); + asprintf(&solution_file, "%s/%s", folder, DEFAULT_SOLUTION_FILE); + setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); - conf_parse("Kconfig"); + conf_parse(file); + //conf_read(def_config_file); conf_read(".config"); - //conf_write(".config"); - /* verbose_level = 1; - int i; - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-v")) - verbose_level++; - else if (file == NULL) - file = argv[i]; - else if (folder == NULL) - folder = argv[i]; - else { - Eprintf("Unknown parameter: %s\n", argv[i]); - exit(1); - } - } - - if (file == NULL) { - Eprintf("No Kconfig input file specified\n"); - exit(2); - } - if (folder == NULL) { - Eprintf("No output folder specified\n"); - exit(3); - } - - char *rules_file, *symbol_map_file, *def_config_file, *solution_file; - asprintf(&rules_file, "%s/%s", folder, DEFAULT_RULES_FILE); - asprintf(&symbol_map_file, "%s/%s", folder, DEFAULT_SYMBOL_MAP_FILE); - asprintf(&def_config_file, "%s/%s", folder, DEFAULT_DEF_CONFIG_FILE); - asprintf(&solution_file, "%s/%s", folder, DEFAULT_SOLUTION_FILE); - - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - - conf_parse(file); - conf_read(def_config_file); - FILE *f = fopen(symbol_map_file, "r"); - if (f == NULL) { - Eprintf("Can't open file: %s\n", symbol_map_file); - exit(1); - } - struct symlist *sl = symlist_read(f); - fclose(f); + FILE *f = fopen(symbol_map_file, "r"); + if (f == NULL) { + Eprintf("Can't open file: %s\n", symbol_map_file); + exit(1); + } + struct symlist *sl = symlist_read(f); + fclose(f); - f = fopen(solution_file, "r"); - if (f == NULL) { - Eprintf("Can't open file: %s\n", solution_file); - exit(2); - } - solution_set(sl, f); - fclose(f); - */ + f = fopen(solution_file, "r"); + if (f == NULL) { + Eprintf("Can't open file: %s\n", solution_file); + exit(2); + } + solution_set(sl, f); + fclose(f); return 0; } |