mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 10:48:25 +02:00
b2/: add BOM dumping; dump processed BOM entries
This commit is contained in:
parent
ec04163f44
commit
66aea07f23
27
b2/bom.c
27
b2/bom.c
@ -11,6 +11,7 @@
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
@ -24,6 +25,9 @@
|
||||
#include "bom.h"
|
||||
|
||||
|
||||
#define INDENT 4
|
||||
|
||||
|
||||
struct bom *bom = NULL;
|
||||
int n_bom = 0;
|
||||
|
||||
@ -149,3 +153,26 @@ int bom_subst(struct bom *b, const struct subst *sub)
|
||||
n_bom--;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
void bom_dump(FILE *file, const struct bom *b)
|
||||
{
|
||||
const char **f;
|
||||
const struct param *var;
|
||||
|
||||
fprintf(file, "%s (%s)\n", b->ref, b->sym ? b->sym : "?");
|
||||
fprintf(file, "%*s", INDENT, "");
|
||||
for (f = b->fields; f != b->fields+b->n_fields; f++)
|
||||
fprintf(file, "%s%s", f == b->fields ? "" : " ",
|
||||
**f ? *f : "-");
|
||||
fprintf(file, "\n");
|
||||
if (!b->vars)
|
||||
return;
|
||||
fprintf(file, "%*s", INDENT, "");
|
||||
for (var = b->vars; var; var = var->next) {
|
||||
fprintf(file, "%s%s", var == b->vars ? "" : " ", var->u.name);
|
||||
dump_relop(file, var->op);
|
||||
fprintf(file, "%s", var->value.u.s);
|
||||
}
|
||||
fprintf(file, "\n");
|
||||
}
|
||||
|
3
b2/bom.h
3
b2/bom.h
@ -13,6 +13,8 @@
|
||||
#ifndef BOM_H
|
||||
#define BOM_H
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "param.h"
|
||||
#include "subst.h"
|
||||
|
||||
@ -32,5 +34,6 @@ extern int n_bom;
|
||||
struct bom *bom_parse_line(const char *s);
|
||||
void bom_set_sym(const char *ref, const char *sym);
|
||||
int bom_subst(struct bom *b, const struct subst *sub);
|
||||
void bom_dump(FILE *file, const struct bom *b);
|
||||
|
||||
#endif /* !BOM_H */
|
||||
|
Loading…
Reference in New Issue
Block a user