1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2025-04-21 12:27:27 +03:00

b2/: add "print VAR" command in substitutions (for debugging/tracing)

This commit is contained in:
Werner Almesberger
2012-06-03 13:15:31 -03:00
parent 3f4a06843a
commit ee0a2a41fa
5 changed files with 132 additions and 2 deletions

View File

@@ -248,6 +248,16 @@ struct subst *subst_assign(const char *dst, enum relop op, const char *pat)
}
struct subst *subst_print(const char *var)
{
struct subst *sub;
sub = alloc_subst(st_print);
sub->u.print = var;
return sub;
}
struct subst *subst_end(void)
{
return alloc_subst(st_end);
@@ -376,6 +386,8 @@ static void recurse_fin(struct subst *sub, const struct parent *parent)
yyerror("$ without match");
check_chunks(sub->u.assign.pat, parent, prev);
break;
case st_print:
break;
case st_end:
break;
case st_ignore:
@@ -446,6 +458,9 @@ static void recurse_dump(FILE *file, const struct subst *sub, int level)
dump_chunks(file, sub->u.assign.pat);
fprintf(file, "\n");
break;
case st_print:
fprintf(file, "print %s\n", sub->u.print);
break;
case st_end:
fprintf(file, "end\n");
break;