1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-12-23 08:02:04 +02:00

b2/: connect stock to provider

This commit is contained in:
Werner Almesberger 2012-05-01 15:21:32 -03:00
parent 5d7f4fc662
commit 702343cabc
3 changed files with 6 additions and 2 deletions

View File

@ -172,8 +172,9 @@ static void dump_stock(FILE *file, const struct stock *s)
{
const struct price *p;
fprintf(file, " %s %d %d %s %g",
s->cat, s->avail, s->package, s->curr->name, s->add);
fprintf(file, " %s %s %d %d %s %g",
s->provider->name, s->cat, s->avail, s->package, s->curr->name,
s->add);
for (p = s->price; p; p = p->next)
fprintf(file, " %d %g", p->qty, p->value);
fprintf(file, "\n");

View File

@ -73,6 +73,7 @@ struct provider {
*/
struct stock {
const struct provider *provider;
const char *cat; /* category */
int avail; /* items in stock */
int package; /* "natural" quantity (reel, tray, bag, etc.) */

View File

@ -428,6 +428,7 @@ inventory_item:
WORD WORD stock TOK_NL
{
$$ = part_add($1, $2);
$3->provider = provider_add($1);
part_add_stock($$, $3);
}
;
@ -436,6 +437,7 @@ stock:
WORD int int WORD float prices
{
$$ = alloc_type(struct stock);
$$->provider = NULL;
$$->cat = $1;
$$->avail = $2;
$$->package = $3;