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:
parent
6c49fdd789
commit
1394c6b61c
@ -5,8 +5,9 @@
|
||||
<comp> = R<C<L<D; // order doesn't really matter
|
||||
<diode> = D<SCH<Z<TVS; // D < SCH may make sense, the rest doesn't
|
||||
|
||||
{ FP=* }
|
||||
T=<comp> {
|
||||
R: { R=#R TOL=%R FP=* };
|
||||
R: { R=#R TOL=%R };
|
||||
C: { C=#F TOL=%C V=#V };
|
||||
L: { L=#H TOL=%L I=#A };
|
||||
D: { C=#F }
|
||||
@ -15,4 +16,4 @@ T=<comp> {
|
||||
Z: { V=#V I=#A };
|
||||
*: { Vf=#V Vr=#V I=#A };
|
||||
};
|
||||
}
|
||||
};
|
||||
|
5
b2/db.c
5
b2/db.c
@ -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 **res = &part->param;
|
||||
struct param *next;
|
||||
|
||||
part->param = NULL;
|
||||
convert_params(¶m, field, &res);
|
||||
convert_params(¶m, act->fields, &res);
|
||||
convert_params(¶m, act->rules, &res);
|
||||
while (param) {
|
||||
yywarnf("extra parameter: %s", param->u.name);
|
||||
next = param->next;
|
||||
|
2
b2/db.h
2
b2/db.h
@ -65,7 +65,7 @@ struct part {
|
||||
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_finalize(struct part *part, const struct action *act);
|
||||
void part_dump(FILE *file, const struct part *part);
|
||||
|
||||
#endif /* !DB_H */
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "y.tab.h"
|
||||
|
||||
|
||||
static const struct field *hierarchy;
|
||||
static struct action hierarchy;
|
||||
|
||||
static struct field_stack {
|
||||
const struct field *field;
|
||||
@ -101,10 +101,11 @@ all:
|
||||
|
||||
hierarchy:
|
||||
nameset hierarchy
|
||||
| rule
|
||||
| action
|
||||
{
|
||||
hierarchy = $1;
|
||||
field_dump(stderr, $1);
|
||||
field_dump(stderr, $1.fields);
|
||||
field_dump(stderr, $1.rules);
|
||||
}
|
||||
;
|
||||
|
||||
@ -352,7 +353,7 @@ characteristics:
|
||||
| TOK_NL
|
||||
| part characteristics
|
||||
{
|
||||
part_finalize($1, hierarchy);
|
||||
part_finalize($1, &hierarchy);
|
||||
part_dump(stderr, $1);
|
||||
}
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user