mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2025-01-03 22:50:15 +02:00
b2/: new option -dCHARS to dump specific db; replaces use of -v
This commit is contained in:
parent
b723c8841a
commit
3ebac688bd
48
b2/boom.c
48
b2/boom.c
@ -83,6 +83,22 @@ static void dump_hierarchy(struct action act)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void dump(const char *s)
|
||||||
|
{
|
||||||
|
while (*s) {
|
||||||
|
switch (*s) {
|
||||||
|
case 'h':
|
||||||
|
dump_hierarchy(hierarchy);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "no database '%c'\n", *s);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
s++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static void usage(const char *name)
|
static void usage(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
@ -97,6 +113,7 @@ static void usage(const char *name)
|
|||||||
" -X symbols (BOM supplement)\n"
|
" -X symbols (BOM supplement)\n"
|
||||||
" other options:\n"
|
" other options:\n"
|
||||||
" -v ... increase verbosity level\n"
|
" -v ... increase verbosity level\n"
|
||||||
|
" -dCHARS dump the specified database (h, c, i, ...)\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"
|
||||||
@ -116,33 +133,40 @@ 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], "-v"))
|
} else if (!strcmp(argv[i], "-v")) {
|
||||||
verbose++;
|
verbose++;
|
||||||
else if (!strcmp(argv[i], "-c"))
|
} else if (!strncmp(argv[i], "-d", 2)) {
|
||||||
|
if (argv[i][2]) {
|
||||||
|
dump(argv[i]+2);
|
||||||
|
} else {
|
||||||
|
i++;
|
||||||
|
if (!argv[i])
|
||||||
|
usage(*argv);
|
||||||
|
dump(argv[i]);
|
||||||
|
}
|
||||||
|
} 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;
|
||||||
else if (!strcmp(argv[i], "-x"))
|
} else if (!strcmp(argv[i], "-x")) {
|
||||||
process = parse_currencies;
|
process = parse_currencies;
|
||||||
else if (!strcmp(argv[i], "-p"))
|
} else if (!strcmp(argv[i], "-p")) {
|
||||||
process = parse_providers;
|
process = parse_providers;
|
||||||
else if (!strcmp(argv[i], "-s"))
|
} else if (!strcmp(argv[i], "-s")) {
|
||||||
process = parse_substitutions;
|
process = parse_substitutions;
|
||||||
else if (!strcmp(argv[i], "-b"))
|
} else if (!strcmp(argv[i], "-b")) {
|
||||||
process = parse_kicad_bom;
|
process = parse_kicad_bom;
|
||||||
else if (!strcmp(argv[i], "-X"))
|
} else if (!strcmp(argv[i], "-X")) {
|
||||||
process = parse_symbols;
|
process = parse_symbols;
|
||||||
else if (!strcmp(argv[i], "-q"))
|
} else if (!strcmp(argv[i], "-q")) {
|
||||||
process = add_var;
|
process = add_var;
|
||||||
else if (!strcmp(argv[i], "-Q")) {
|
} else if (!strcmp(argv[i], "-Q")) {
|
||||||
process = add_var;
|
process = add_var;
|
||||||
select_parts = 1;
|
select_parts = 1;
|
||||||
} else
|
} else
|
||||||
usage(*argv);
|
usage(*argv);
|
||||||
} else {
|
} else {
|
||||||
process(argv[i]);
|
process(argv[i]);
|
||||||
if (verbose && process == parse_hierarchy)
|
|
||||||
dump_hierarchy(hierarchy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (vars)
|
if (vars)
|
||||||
|
@ -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 -v "$args" "$@"
|
eval $VALGRIND ../boom "$args" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
tst "hierarchy: name field" <<EOF
|
tst "hierarchy: name field" -dh <<EOF
|
||||||
{ X=* };
|
{ X=* };
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -19,7 +19,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: name set field (correct name)" <<EOF
|
tst "hierarchy: name set field (correct name)" -dh <<EOF
|
||||||
<abc> = A<B<C;
|
<abc> = A<B<C;
|
||||||
{ X=<abc> };
|
{ X=<abc> };
|
||||||
EOF
|
EOF
|
||||||
@ -41,7 +41,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: absolute value field (with unit)" <<EOF
|
tst "hierarchy: absolute value field (with unit)" -dh <<EOF
|
||||||
{ X=#foo };
|
{ X=#foo };
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: absolute value field (without unit)" <<EOF
|
tst "hierarchy: absolute value field (without unit)" -dh <<EOF
|
||||||
{ X=## };
|
{ X=## };
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
@ -71,7 +71,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value field (correct name)" <<EOF
|
tst "hierarchy: relative value field (correct name)" -dh <<EOF
|
||||||
{ X=#foo Y=%X };
|
{ X=#foo Y=%X };
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
tst "hierarchy: == 1 followed by == 2" <<EOF
|
tst "hierarchy: == 1 followed by == 2" -dh <<EOF
|
||||||
N=## {
|
N=## {
|
||||||
1: { X=* };
|
1: { X=* };
|
||||||
2: { Y=* };
|
2: { Y=* };
|
||||||
@ -19,7 +19,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: == 2 followed by unreachable == 2" <<EOF
|
tst "hierarchy: == 2 followed by unreachable == 2" -dh <<EOF
|
||||||
N=## {
|
N=## {
|
||||||
2: { X=* };
|
2: { X=* };
|
||||||
2: { Y=* };
|
2: { Y=* };
|
||||||
@ -36,7 +36,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: < 2 followed by < 3" <<EOF
|
tst "hierarchy: < 2 followed by < 3" -dh <<EOF
|
||||||
N=## {
|
N=## {
|
||||||
<2: { X=* };
|
<2: { X=* };
|
||||||
<3: { Y=* };
|
<3: { Y=* };
|
||||||
@ -52,7 +52,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: < 3 followed by unreachable < 2" <<EOF
|
tst "hierarchy: < 3 followed by unreachable < 2" -dh <<EOF
|
||||||
N=## {
|
N=## {
|
||||||
<3: { X=* };
|
<3: { X=* };
|
||||||
<2: { Y=* };
|
<2: { Y=* };
|
||||||
@ -69,7 +69,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: < 2 followed by <= 2" <<EOF
|
tst "hierarchy: < 2 followed by <= 2" -dh <<EOF
|
||||||
N=## {
|
N=## {
|
||||||
<2: { X=* };
|
<2: { X=* };
|
||||||
<=2: { Y=* };
|
<=2: { Y=* };
|
||||||
@ -85,7 +85,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: <= 2 followed by unreachable < 2" <<EOF
|
tst "hierarchy: <= 2 followed by unreachable < 2" -dh <<EOF
|
||||||
N=## {
|
N=## {
|
||||||
<=2: { X=* };
|
<=2: { X=* };
|
||||||
<2: { Y=* };
|
<2: { Y=* };
|
||||||
@ -102,7 +102,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: < 3 followed by > 1" <<EOF
|
tst "hierarchy: < 3 followed by > 1" -dh <<EOF
|
||||||
N=## {
|
N=## {
|
||||||
<3: { X=* };
|
<3: { X=* };
|
||||||
>1: { Y=* };
|
>1: { Y=* };
|
||||||
@ -118,7 +118,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: < 3 followed by predictable but reachable > 2" <<EOF
|
tst "hierarchy: < 3 followed by predictable but reachable > 2" -dh <<EOF
|
||||||
N=## {
|
N=## {
|
||||||
<3: { X=* };
|
<3: { X=* };
|
||||||
>2: { Y=* };
|
>2: { Y=* };
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
tst "hierarchy: name rule" <<EOF
|
tst "hierarchy: name rule" -dh <<EOF
|
||||||
Animal=* {
|
Animal=* {
|
||||||
Cat: { X=* };
|
Cat: { X=* };
|
||||||
Dog: { Y=* };
|
Dog: { Y=* };
|
||||||
@ -25,7 +25,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: name set rule" <<EOF
|
tst "hierarchy: name set rule" -dh <<EOF
|
||||||
<predation> = mouse<cat<dog;
|
<predation> = mouse<cat<dog;
|
||||||
p = <predation> {
|
p = <predation> {
|
||||||
mouse: { X=* };
|
mouse: { X=* };
|
||||||
@ -59,7 +59,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: name set rule (duplicate entry)" <<EOF
|
tst "hierarchy: name set rule (duplicate entry)" -dh <<EOF
|
||||||
<predation> = mouse<cat<dog;
|
<predation> = mouse<cat<dog;
|
||||||
p = <predation> {
|
p = <predation> {
|
||||||
mouse: { X=* };
|
mouse: { X=* };
|
||||||
@ -79,7 +79,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: absolute value rule (with unit)" <<EOF
|
tst "hierarchy: absolute value rule (with unit)" -dh <<EOF
|
||||||
<predation> = mouse<cat<dog;
|
<predation> = mouse<cat<dog;
|
||||||
N=#R {
|
N=#R {
|
||||||
10R: { X=* };
|
10R: { X=* };
|
||||||
@ -98,7 +98,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: absolute value rule (without unit)" <<EOF
|
tst "hierarchy: absolute value rule (without unit)" -dh <<EOF
|
||||||
<predation> = mouse<cat<dog;
|
<predation> = mouse<cat<dog;
|
||||||
N=## {
|
N=## {
|
||||||
2: { X=* };
|
2: { X=* };
|
||||||
@ -143,7 +143,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (percent)" <<EOF
|
tst "hierarchy: relative value rule (percent)" -dh <<EOF
|
||||||
{ V=#R }
|
{ V=#R }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
1%: { X=* };
|
1%: { X=* };
|
||||||
@ -161,7 +161,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (absolute, with unit)" <<EOF
|
tst "hierarchy: relative value rule (absolute, with unit)" -dh <<EOF
|
||||||
{ V=#R }
|
{ V=#R }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
1R: { X=* };
|
1R: { X=* };
|
||||||
@ -179,7 +179,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (absolute, without unit)" <<EOF
|
tst "hierarchy: relative value rule (absolute, without unit)" -dh <<EOF
|
||||||
{ V=## }
|
{ V=## }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
1: { X=* };
|
1: { X=* };
|
||||||
@ -197,7 +197,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (plus/minus percent)" <<EOF
|
tst "hierarchy: relative value rule (plus/minus percent)" -dh <<EOF
|
||||||
{ V=#R }
|
{ V=#R }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
+10/-20%: { X=* };
|
+10/-20%: { X=* };
|
||||||
@ -213,7 +213,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (minus/plus percent)" <<EOF
|
tst "hierarchy: relative value rule (minus/plus percent)" -dh <<EOF
|
||||||
{ V=#R }
|
{ V=#R }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
-10/+20%: { X=* };
|
-10/+20%: { X=* };
|
||||||
@ -229,7 +229,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (implicit minus/plus percent)" <<EOF
|
tst "hierarchy: relative value rule (implicit minus/plus percent)" -dh <<EOF
|
||||||
{ V=#R }
|
{ V=#R }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
10/20%: { X=* };
|
10/20%: { X=* };
|
||||||
@ -245,7 +245,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (plus/minus absolute)" <<EOF
|
tst "hierarchy: relative value rule (plus/minus absolute)" -dh <<EOF
|
||||||
{ V=#R }
|
{ V=#R }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
+10/-20R: { X=* };
|
+10/-20R: { X=* };
|
||||||
@ -261,7 +261,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (minus/plus absolute)" <<EOF
|
tst "hierarchy: relative value rule (minus/plus absolute)" -dh <<EOF
|
||||||
{ V=#R }
|
{ V=#R }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
-5/+10R: { X=* };
|
-5/+10R: { X=* };
|
||||||
@ -277,7 +277,7 @@ EOF
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
tst "hierarchy: relative value rule (implicit minus/plus absolute)" <<EOF
|
tst "hierarchy: relative value rule (implicit minus/plus absolute)" -dh <<EOF
|
||||||
{ V=#R }
|
{ V=#R }
|
||||||
TOL=%V {
|
TOL=%V {
|
||||||
0/10R: { X=* };
|
0/10R: { X=* };
|
||||||
|
Loading…
Reference in New Issue
Block a user