1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 09:15:31 +02:00

new option -v to control verbosity level; move hierarchy dump from parser to boom.c

This commit is contained in:
Werner Almesberger 2012-05-30 12:58:29 -03:00
parent c24da0284e
commit 59d21e65fa
4 changed files with 20 additions and 8 deletions

View File

@ -91,7 +91,7 @@ spotless: clean
# ----- Experiments -----------------------------------------------------------
try:
$(VALGRIND) ./boom HIERARCHY -c CHAR -x CURR -p PROVIDER -i INV \
$(VALGRIND) ./boom -v HIERARCHY -c CHAR -x CURR -p PROVIDER -i INV \
-s SUBST
# ----- Tests -----------------------------------------------------------------

View File

@ -17,12 +17,14 @@
#include "util.h"
#include "lang.h"
#include "param.h"
#include "chr.h"
#include "subex.h"
#include "db.h"
static struct param *vars = NULL, **last_var = &vars;
static int select_parts = 0;
static int verbose = 0;
static void add_var(const char *arg)
@ -72,10 +74,19 @@ static void do_substitutions(void)
}
static void dump_hierarchy(struct action act)
{
fields_dump(stderr, act.fields);
if (act.fields)
fprintf(stderr, "\n");
rules_dump(stderr, act.rules);
}
static void usage(const char *name)
{
fprintf(stderr,
"usage: %s file [[-N name] [-type] file ...] [(-q|-Q) var=value ...] ...\n\n"
"usage: %s file [-v] [[-N name] [-type] file ...] [(-q|-Q) var=value ...] ...\n\n"
" file types:\n"
" -c characteristics\n"
" -i inventory\n"
@ -85,6 +96,7 @@ static void usage(const char *name)
" -b KiCad eeschema BOM\n"
" -X symbols (BOM supplement)\n"
" other options:\n"
" -v ... increase verbosity level\n"
" -N name for the next file, override the name in diagnostics\n"
" -q var=value ... run substitutions with the specified inputs\n"
" -Q var=value ... run substitutions and then do parametric search\n"
@ -104,7 +116,9 @@ int main(int argc, char **argv)
if (!strcmp(argv[i], "-N")) {
i++;
file_name_override = argv[i];
} else if (!strcmp(argv[i], "-c"))
} else if (!strcmp(argv[i], "-v"))
verbose++;
else if (!strcmp(argv[i], "-c"))
process = parse_characteristics;
else if (!strcmp(argv[i], "-i"))
process = parse_inventory;
@ -127,6 +141,8 @@ int main(int argc, char **argv)
usage(*argv);
} else {
process(argv[i]);
if (verbose && process == parse_hierarchy)
dump_hierarchy(hierarchy);
}
}
if (vars)

View File

@ -156,10 +156,6 @@ hierarchy:
| action
{
$$ = $1;
fields_dump(stderr, $1.fields);
if ($1.fields)
fprintf(stderr, "\n");
rules_dump(stderr, $1.rules);
}
;

View File

@ -20,7 +20,7 @@ run_boom()
args="$args -$n <(sed -n '1,/^!-$n/d;/^!-/q;p' _in)"
fi
done
eval $VALGRIND ../boom "$args" "$@"
eval $VALGRIND ../boom -v "$args" "$@"
}