mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-26 20:51:33 +02:00
new option -v to control verbosity level; move hierarchy dump from parser to boom.c
This commit is contained in:
parent
c24da0284e
commit
59d21e65fa
@ -91,7 +91,7 @@ spotless: clean
|
|||||||
# ----- Experiments -----------------------------------------------------------
|
# ----- Experiments -----------------------------------------------------------
|
||||||
|
|
||||||
try:
|
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
|
-s SUBST
|
||||||
|
|
||||||
# ----- Tests -----------------------------------------------------------------
|
# ----- Tests -----------------------------------------------------------------
|
||||||
|
20
b2/boom.c
20
b2/boom.c
@ -17,12 +17,14 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "lang.h"
|
#include "lang.h"
|
||||||
#include "param.h"
|
#include "param.h"
|
||||||
|
#include "chr.h"
|
||||||
#include "subex.h"
|
#include "subex.h"
|
||||||
#include "db.h"
|
#include "db.h"
|
||||||
|
|
||||||
|
|
||||||
static struct param *vars = NULL, **last_var = &vars;
|
static struct param *vars = NULL, **last_var = &vars;
|
||||||
static int select_parts = 0;
|
static int select_parts = 0;
|
||||||
|
static int verbose = 0;
|
||||||
|
|
||||||
|
|
||||||
static void add_var(const char *arg)
|
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)
|
static void usage(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
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"
|
" file types:\n"
|
||||||
" -c characteristics\n"
|
" -c characteristics\n"
|
||||||
" -i inventory\n"
|
" -i inventory\n"
|
||||||
@ -85,6 +96,7 @@ static void usage(const char *name)
|
|||||||
" -b KiCad eeschema BOM\n"
|
" -b KiCad eeschema BOM\n"
|
||||||
" -X symbols (BOM supplement)\n"
|
" -X symbols (BOM supplement)\n"
|
||||||
" other options:\n"
|
" other options:\n"
|
||||||
|
" -v ... increase verbosity level\n"
|
||||||
" -N name for the next file, override the name in diagnostics\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 with the specified inputs\n"
|
||||||
" -Q var=value ... run substitutions and then do parametric search\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")) {
|
if (!strcmp(argv[i], "-N")) {
|
||||||
i++;
|
i++;
|
||||||
file_name_override = argv[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;
|
process = parse_characteristics;
|
||||||
else if (!strcmp(argv[i], "-i"))
|
else if (!strcmp(argv[i], "-i"))
|
||||||
process = parse_inventory;
|
process = parse_inventory;
|
||||||
@ -127,6 +141,8 @@ int main(int argc, char **argv)
|
|||||||
usage(*argv);
|
usage(*argv);
|
||||||
} else {
|
} else {
|
||||||
process(argv[i]);
|
process(argv[i]);
|
||||||
|
if (verbose && process == parse_hierarchy)
|
||||||
|
dump_hierarchy(hierarchy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vars)
|
if (vars)
|
||||||
|
@ -156,10 +156,6 @@ hierarchy:
|
|||||||
| action
|
| action
|
||||||
{
|
{
|
||||||
$$ = $1;
|
$$ = $1;
|
||||||
fields_dump(stderr, $1.fields);
|
|
||||||
if ($1.fields)
|
|
||||||
fprintf(stderr, "\n");
|
|
||||||
rules_dump(stderr, $1.rules);
|
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ run_boom()
|
|||||||
args="$args -$n <(sed -n '1,/^!-$n/d;/^!-/q;p' _in)"
|
args="$args -$n <(sed -n '1,/^!-$n/d;/^!-/q;p' _in)"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
eval $VALGRIND ../boom "$args" "$@"
|
eval $VALGRIND ../boom -v "$args" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user