1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-16 18:51:53 +02:00

b2/: make top-level hierarchy item an action, not just a rule

This allows the definition of optional global fields. For now, we (ab)use
this for FP (footprint).
This commit is contained in:
Werner Almesberger 2012-04-28 23:30:50 -03:00
parent 6c49fdd789
commit 1394c6b61c
4 changed files with 12 additions and 9 deletions

View File

@ -5,8 +5,9 @@
<comp> = R<C<L<D; // order doesn't really matter <comp> = R<C<L<D; // order doesn't really matter
<diode> = D<SCH<Z<TVS; // D < SCH may make sense, the rest doesn't <diode> = D<SCH<Z<TVS; // D < SCH may make sense, the rest doesn't
{ FP=* }
T=<comp> { T=<comp> {
R: { R=#R TOL=%R FP=* }; R: { R=#R TOL=%R };
C: { C=#F TOL=%C V=#V }; C: { C=#F TOL=%C V=#V };
L: { L=#H TOL=%L I=#A }; L: { L=#H TOL=%L I=#A };
D: { C=#F } D: { C=#F }
@ -15,4 +16,4 @@ T=<comp> {
Z: { V=#V I=#A }; Z: { V=#V I=#A };
*: { Vf=#V Vr=#V I=#A }; *: { Vf=#V Vr=#V I=#A };
}; };
} };

View File

@ -140,14 +140,15 @@ static void convert_params(struct param **params,
} }
void part_finalize(struct part *part, const struct field *field) void part_finalize(struct part *part, const struct action *act)
{ {
struct param *param = part->param; struct param *param = part->param;
struct param **res = &part->param; struct param **res = &part->param;
struct param *next; struct param *next;
part->param = NULL; part->param = NULL;
convert_params(&param, field, &res); convert_params(&param, act->fields, &res);
convert_params(&param, act->rules, &res);
while (param) { while (param) {
yywarnf("extra parameter: %s", param->u.name); yywarnf("extra parameter: %s", param->u.name);
next = param->next; next = param->next;

View File

@ -65,7 +65,7 @@ struct part {
struct part *part_lookup(const char *domain, const char *name); struct part *part_lookup(const char *domain, const char *name);
struct part *part_add(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_alias(struct part *a, struct part *b);
void part_finalize(struct part *part, const struct field *field); void part_finalize(struct part *part, const struct action *act);
void part_dump(FILE *file, const struct part *part); void part_dump(FILE *file, const struct part *part);
#endif /* !DB_H */ #endif /* !DB_H */

View File

@ -23,7 +23,7 @@
#include "y.tab.h" #include "y.tab.h"
static const struct field *hierarchy; static struct action hierarchy;
static struct field_stack { static struct field_stack {
const struct field *field; const struct field *field;
@ -101,10 +101,11 @@ all:
hierarchy: hierarchy:
nameset hierarchy nameset hierarchy
| rule | action
{ {
hierarchy = $1; hierarchy = $1;
field_dump(stderr, $1); field_dump(stderr, $1.fields);
field_dump(stderr, $1.rules);
} }
; ;
@ -352,7 +353,7 @@ characteristics:
| TOK_NL | TOK_NL
| part characteristics | part characteristics
{ {
part_finalize($1, hierarchy); part_finalize($1, &hierarchy);
part_dump(stderr, $1); part_dump(stderr, $1);
} }
; ;