mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-23 06:44:04 +02:00
new option -N to override file names in diagnostics (for regression testing)
This commit is contained in:
parent
b6a4a80652
commit
60de30cea0
@ -75,7 +75,7 @@ static void do_substitutions(void)
|
|||||||
static void usage(const char *name)
|
static void usage(const char *name)
|
||||||
{
|
{
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
"usage: %s file [[-type] file ...] [(-q|-Q) var=value ...] ...\n\n"
|
"usage: %s file [[-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"
|
||||||
@ -84,6 +84,8 @@ static void usage(const char *name)
|
|||||||
" -s substitutions\n"
|
" -s substitutions\n"
|
||||||
" -b KiCad eeschema BOM\n"
|
" -b KiCad eeschema BOM\n"
|
||||||
" -X symbols (BOM supplement)\n"
|
" -X symbols (BOM supplement)\n"
|
||||||
|
" other options:\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"
|
||||||
, name);
|
, name);
|
||||||
@ -99,7 +101,10 @@ int main(int argc, char **argv)
|
|||||||
dollar = unique("$");
|
dollar = unique("$");
|
||||||
for (i = 1; i != argc; i++) {
|
for (i = 1; i != argc; i++) {
|
||||||
if (*argv[i] == '-') {
|
if (*argv[i] == '-') {
|
||||||
if (!strcmp(argv[i], "-c"))
|
if (!strcmp(argv[i], "-N")) {
|
||||||
|
i++;
|
||||||
|
file_name_override = 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;
|
||||||
|
@ -22,6 +22,8 @@ extern const char *dollar; /* "$" */
|
|||||||
extern struct action hierarchy;
|
extern struct action hierarchy;
|
||||||
extern struct subst *substitutions;
|
extern struct subst *substitutions;
|
||||||
|
|
||||||
|
extern const char *file_name_override;
|
||||||
|
|
||||||
void parse_hierarchy(const char *name);
|
void parse_hierarchy(const char *name);
|
||||||
void parse_characteristics(const char *name);
|
void parse_characteristics(const char *name);
|
||||||
void parse_inventory(const char *name);
|
void parse_inventory(const char *name);
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
extern int yyparse(void);
|
extern int yyparse(void);
|
||||||
|
|
||||||
|
const char *file_name_override;
|
||||||
|
|
||||||
static int start_token;
|
static int start_token;
|
||||||
static int expose_nl; /* 0: ignore \n; 1: return TOK_NL */
|
static int expose_nl; /* 0: ignore \n; 1: return TOK_NL */
|
||||||
static int pattern; /* 0: = relops are normal; 1: relops switch to PAT */
|
static int pattern; /* 0: = relops are normal; 1: relops switch to PAT */
|
||||||
@ -56,7 +58,8 @@ static void do_parse(const char *name, int start, int nl, int pat)
|
|||||||
start_token = start;
|
start_token = start;
|
||||||
expose_nl = nl;
|
expose_nl = nl;
|
||||||
pattern = pat;
|
pattern = pat;
|
||||||
file_name = unique(name);
|
file_name = file_name_override ? file_name_override : unique(name);
|
||||||
|
file_name_override = NULL;
|
||||||
lineno = 1;
|
lineno = 1;
|
||||||
yyparse();
|
yyparse();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user