1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-25 22:55:20 +02:00

b2/: dump part records (for debugging only)

This commit is contained in:
Werner Almesberger 2012-04-28 23:26:22 -03:00
parent edcc61a6f4
commit 6c49fdd789
3 changed files with 23 additions and 0 deletions

18
b2/db.c
View File

@ -11,6 +11,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <glib.h>
#include "util.h"
@ -154,3 +155,20 @@ void part_finalize(struct part *part, const struct field *field)
param = next;
}
}
void part_dump(FILE *file, const struct part *part)
{
const struct param *p;
fprintf(file, "%s %s\n", part->domain, part->name);
if (part->param) {
fprintf(file, " ");
for (p = part->param; p; p = p->next) {
fprintf(file, " %s=", p->u.field->name);
dump(file, p->u.field->fmt, &p->value);
}
fprintf(file, "\n");
}
if (part->stock);
}

View File

@ -13,6 +13,9 @@
#ifndef DB_H
#define DB_H
#include <stdio.h>
struct exchange {
const struct currency *dst;
double factor;
@ -63,5 +66,6 @@ struct part *part_lookup(const char *domain, const char *name);
struct part *part_add(const char *domain, const char *name);
void part_alias(struct part *a, struct part *b);
void part_finalize(struct part *part, const struct field *field);
void part_dump(FILE *file, const struct part *part);
#endif /* !DB_H */

View File

@ -353,6 +353,7 @@ characteristics:
| part characteristics
{
part_finalize($1, hierarchy);
part_dump(stderr, $1);
}
;