From 3b4fbaa22233e764f6b94effd1b21c494061d32c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Sun, 22 Mar 2015 22:05:56 +0100 Subject: kconfig_parser: Fix rev_dep and implement verbose level output After this fix, generated dependency should be all right. Verbose output implementation is only temporally. It needs better implementation. And command line arguments should be parsed with argp. --- programs/src/kconfig_parser/output.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'programs/src/kconfig_parser/output.c') diff --git a/programs/src/kconfig_parser/output.c b/programs/src/kconfig_parser/output.c index 942693b..149a7b6 100644 --- a/programs/src/kconfig_parser/output.c +++ b/programs/src/kconfig_parser/output.c @@ -1,18 +1,23 @@ #include "output.h" -void fprint_rules_cnf(FILE * f, unsigned id, struct cnfexpr *cnf) { +void fprint_rules_cnf(FILE * f, unsigned id, struct cnfexpr *cnf, bool nt) { unsigned i, y; switch (cnf->type) { case CT_FALSE: // Never satisfiable - fprintf(f, "-%d\n", id); + if (!nt) + fprintf(f, "-%d\n", id); break; case CT_TRUE: // Always satisfiable + if (nt) + fprintf(f, "%d\n", id); break; case CT_EXPR: for (i = 0; i < cnf->size; i++) { - fprintf(f, "-%d ", id); + if (!nt) + fprintf(f, "-"); + fprintf(f, "%d ", id); for (y = 0; y < cnf->sizes[i] - 1; y++) { fprintf(f, "%d ", cnf->exprs[i][y]); } @@ -36,10 +41,10 @@ void fprint_rules(struct symlist *sl, char *output) { if (sl->array[i].be != NULL) { el = sl->array + i; if (el->be != NULL) { - fprint_rules_cnf(f, el->id, el->be); + fprint_rules_cnf(f, el->id, el->be, false); } if (el->re_be != NULL) { - fprint_rules_cnf(f, el->id, el->be); + fprint_rules_cnf(f, el->id, el->re_be, true); } } } -- cgit v1.2.3