1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-06-25 09:25:28 +03:00

b2/: new option -dCHARS to dump specific db; replaces use of -v

This commit is contained in:
Werner Almesberger 2012-06-02 05:24:50 -03:00
parent b723c8841a
commit 3ebac688bd
5 changed files with 64 additions and 40 deletions

View File

@ -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)
{
fprintf(stderr,
@ -97,6 +113,7 @@ static void usage(const char *name)
" -X symbols (BOM supplement)\n"
" other options:\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"
" -q var=value ... run substitutions with the specified inputs\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")) {
i++;
file_name_override = argv[i];
} else if (!strcmp(argv[i], "-v"))
} else if (!strcmp(argv[i], "-v")) {
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;
else if (!strcmp(argv[i], "-i"))
} else if (!strcmp(argv[i], "-i")) {
process = parse_inventory;
else if (!strcmp(argv[i], "-x"))
} else if (!strcmp(argv[i], "-x")) {
process = parse_currencies;
else if (!strcmp(argv[i], "-p"))
} else if (!strcmp(argv[i], "-p")) {
process = parse_providers;
else if (!strcmp(argv[i], "-s"))
} else if (!strcmp(argv[i], "-s")) {
process = parse_substitutions;
else if (!strcmp(argv[i], "-b"))
} else if (!strcmp(argv[i], "-b")) {
process = parse_kicad_bom;
else if (!strcmp(argv[i], "-X"))
} else if (!strcmp(argv[i], "-X")) {
process = parse_symbols;
else if (!strcmp(argv[i], "-q"))
} else if (!strcmp(argv[i], "-q")) {
process = add_var;
else if (!strcmp(argv[i], "-Q")) {
} else if (!strcmp(argv[i], "-Q")) {
process = add_var;
select_parts = 1;
} else
usage(*argv);
} else {
process(argv[i]);
if (verbose && process == parse_hierarchy)
dump_hierarchy(hierarchy);
}
}
if (vars)

View File

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

View File

@ -9,7 +9,7 @@
###############################################################################
tst "hierarchy: name field" <<EOF
tst "hierarchy: name field" -dh <<EOF
{ X=* };
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;
{ X=<abc> };
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 };
EOF
@ -51,7 +51,7 @@ EOF
#------------------------------------------------------------------------------
tst "hierarchy: absolute value field (without unit)" <<EOF
tst "hierarchy: absolute value field (without unit)" -dh <<EOF
{ X=## };
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 };
EOF

View File

@ -3,7 +3,7 @@
###############################################################################
tst "hierarchy: == 1 followed by == 2" <<EOF
tst "hierarchy: == 1 followed by == 2" -dh <<EOF
N=## {
1: { X=* };
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=## {
2: { X=* };
2: { Y=* };
@ -36,7 +36,7 @@ EOF
#------------------------------------------------------------------------------
tst "hierarchy: < 2 followed by < 3" <<EOF
tst "hierarchy: < 2 followed by < 3" -dh <<EOF
N=## {
<2: { X=* };
<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=## {
<3: { X=* };
<2: { Y=* };
@ -69,7 +69,7 @@ EOF
#------------------------------------------------------------------------------
tst "hierarchy: < 2 followed by <= 2" <<EOF
tst "hierarchy: < 2 followed by <= 2" -dh <<EOF
N=## {
<2: { X=* };
<=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=## {
<=2: { X=* };
<2: { Y=* };
@ -102,7 +102,7 @@ EOF
#------------------------------------------------------------------------------
tst "hierarchy: < 3 followed by > 1" <<EOF
tst "hierarchy: < 3 followed by > 1" -dh <<EOF
N=## {
<3: { X=* };
>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=## {
<3: { X=* };
>2: { Y=* };

View File

@ -9,7 +9,7 @@
###############################################################################
tst "hierarchy: name rule" <<EOF
tst "hierarchy: name rule" -dh <<EOF
Animal=* {
Cat: { X=* };
Dog: { Y=* };
@ -25,7 +25,7 @@ EOF
#------------------------------------------------------------------------------
tst "hierarchy: name set rule" <<EOF
tst "hierarchy: name set rule" -dh <<EOF
<predation> = mouse<cat<dog;
p = <predation> {
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;
p = <predation> {
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;
N=#R {
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;
N=## {
2: { X=* };
@ -143,7 +143,7 @@ EOF
#------------------------------------------------------------------------------
tst "hierarchy: relative value rule (percent)" <<EOF
tst "hierarchy: relative value rule (percent)" -dh <<EOF
{ V=#R }
TOL=%V {
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 }
TOL=%V {
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=## }
TOL=%V {
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 }
TOL=%V {
+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 }
TOL=%V {
-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 }
TOL=%V {
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 }
TOL=%V {
+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 }
TOL=%V {
-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 }
TOL=%V {
0/10R: { X=* };