b2/boom.c |
17 | 17 | #include "util.h" |
18 | 18 | #include "lang.h" |
19 | 19 | #include "param.h" |
| 20 | #include "chr.h" |
20 | 21 | #include "subex.h" |
21 | 22 | #include "db.h" |
22 | 23 | |
23 | 24 | |
24 | 25 | static struct param *vars = NULL, **last_var = &vars; |
25 | 26 | static int select_parts = 0; |
| 27 | static int verbose = 0; |
26 | 28 | |
27 | 29 | |
28 | 30 | static void add_var(const char *arg) |
... | ... | |
72 | 74 | } |
73 | 75 | |
74 | 76 | |
| 77 | static void dump_hierarchy(struct action act) |
| 78 | { |
| 79 | fields_dump(stderr, act.fields); |
| 80 | if (act.fields) |
| 81 | fprintf(stderr, "\n"); |
| 82 | rules_dump(stderr, act.rules); |
| 83 | } |
| 84 | |
| 85 | |
75 | 86 | static void usage(const char *name) |
76 | 87 | { |
77 | 88 | fprintf(stderr, |
78 | | "usage: %s file [[-N name] [-type] file ...] [(-q|-Q) var=value ...] ...\n\n" |
| 89 | "usage: %s file [-v] [[-N name] [-type] file ...] [(-q|-Q) var=value ...] ...\n\n" |
79 | 90 | " file types:\n" |
80 | 91 | " -c characteristics\n" |
81 | 92 | " -i inventory\n" |
... | ... | |
85 | 96 | " -b KiCad eeschema BOM\n" |
86 | 97 | " -X symbols (BOM supplement)\n" |
87 | 98 | " other options:\n" |
| 99 | " -v ... increase verbosity level\n" |
88 | 100 | " -N name for the next file, override the name in diagnostics\n" |
89 | 101 | " -q var=value ... run substitutions with the specified inputs\n" |
90 | 102 | " -Q var=value ... run substitutions and then do parametric search\n" |
... | ... | |
104 | 116 | if (!strcmp(argv[i], "-N")) { |
105 | 117 | i++; |
106 | 118 | file_name_override = argv[i]; |
107 | | } else if (!strcmp(argv[i], "-c")) |
| 119 | } else if (!strcmp(argv[i], "-v")) |
| 120 | verbose++; |
| 121 | else if (!strcmp(argv[i], "-c")) |
108 | 122 | process = parse_characteristics; |
109 | 123 | else if (!strcmp(argv[i], "-i")) |
110 | 124 | process = parse_inventory; |
... | ... | |
127 | 141 | usage(*argv); |
128 | 142 | } else { |
129 | 143 | process(argv[i]); |
| 144 | if (verbose && process == parse_hierarchy) |
| 145 | dump_hierarchy(hierarchy); |
130 | 146 | } |
131 | 147 | } |
132 | 148 | if (vars) |