From 9a1f3ff8fbff9dd418242eefa7aa69dfd38609c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 4 May 2015 22:47:00 +0200 Subject: Add some configuration options and clean write_conf --- scripts/loop.py | 20 +++++++++++++++++--- scripts/write_config/solution.c | 11 ++++------- scripts/write_config/write.c | 6 +++++- 3 files changed, 26 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/loop.py b/scripts/loop.py index c5111bf..21aabe8 100755 --- a/scripts/loop.py +++ b/scripts/loop.py @@ -11,7 +11,7 @@ import initialize import solution import kernel import boot -from exceptions import MissingFile +import exceptions def step(): phs = phase_get() @@ -47,11 +47,19 @@ def step(): phase_set(7) elif phs == 7: phase_message(7) - kernel.config() + try: + kernel.config() + except exceptions.ConfigurationError: + if not conf.ignore_misconfig: + print("Configuration mismatch. Exiting.") + sys.exit(-2) phase_set(8) elif phs == 8: phase_message(8) - phase_set(9) + if conf.only_config: + phase_set(2) + else: + phase_set(9) elif phs == 9: phase_message(9) kernel.make() @@ -124,6 +132,12 @@ class mainThread(Thread): def run(self): if conf.step_by_step: step() + elif conf.single_loop: + while not phase_get() == 2: + step() + step() + while not phase_get() == 2: + step() else: while not self.term: step() diff --git a/scripts/write_config/solution.c b/scripts/write_config/solution.c index a8d9fc7..f575864 100644 --- a/scripts/write_config/solution.c +++ b/scripts/write_config/solution.c @@ -1,5 +1,6 @@ #include "solution.h" +extern int exit_status; void solution_check(struct symlist *sl, FILE * f) { int c; // skip first line @@ -28,20 +29,16 @@ void solution_check(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); if (neg == (sym_get_tristate_value(sl->array[id - 1].sym) == no ? true : false)) - //printf("Ok\n"); { - } else + } else { 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: %s\n", sl->array[id - 1].sym->name); + exit_status++; + } } else { if (w_pos >= w_size) { w_size *= 2; diff --git a/scripts/write_config/write.c b/scripts/write_config/write.c index 86895b6..29fcd60 100644 --- a/scripts/write_config/write.c +++ b/scripts/write_config/write.c @@ -11,7 +11,10 @@ int verbose_level; char *file, *folder; +int exit_status; + int main(int argc, char **argv) { + exit_status = 0; verbose_level = 1; int i; for (i = 1; i < argc; i++) { @@ -47,6 +50,7 @@ int main(int argc, char **argv) { textdomain(PACKAGE); conf_parse(file); + struct symbol *sym; //conf_read(def_config_file); conf_read(".config"); @@ -68,5 +72,5 @@ int main(int argc, char **argv) { conf_write(".config"); - return 0; + return exit_status; } -- cgit v1.2.3