1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-23 02:50:38 +02:00

b2/db.c: new function parts_dump to dump the whole parts database

This commit is contained in:
Werner Almesberger 2012-06-02 05:48:22 -03:00
parent be1277eb99
commit 22412764d9
2 changed files with 21 additions and 0 deletions

20
b2/db.c
View File

@ -168,6 +168,9 @@ void part_add_stock(struct part *part, struct stock *s)
} }
/* ----- Dumping ----------------------------------------------------------- */
static void dump_stock(FILE *file, const struct stock *s) static void dump_stock(FILE *file, const struct stock *s)
{ {
const struct price *p; const struct price *p;
@ -199,6 +202,23 @@ void part_dump(FILE *file, const struct part *part)
} }
static gboolean dump_prm_traverse(gpointer key, gpointer value, gpointer data)
{
struct part *p = key;
FILE *file = data;
(void) value;
part_dump(file, p);
return FALSE;
}
void parts_dump(FILE *file)
{
g_tree_foreach(tree, dump_prm_traverse, (void *) file);
}
/* ----- Currencies -------------------------------------------------------- */ /* ----- Currencies -------------------------------------------------------- */

View File

@ -98,6 +98,7 @@ void part_alias(struct part *a, struct part *b);
void part_finalize(struct part *part, const struct action *act); void part_finalize(struct part *part, const struct action *act);
void part_add_stock(struct part *part, struct stock *s); void part_add_stock(struct part *part, struct stock *s);
void part_dump(FILE *file, const struct part *part); void part_dump(FILE *file, const struct part *part);
void parts_dump(FILE *file);
const struct currency *currency_lookup(const char *name); const struct currency *currency_lookup(const char *name);
double currency_convert(const struct currency *from, const struct currency *to, double currency_convert(const struct currency *from, const struct currency *to,