Change Details
b2/boom.c |
136 | 136 | int i; |
137 | 137 | |
138 | 138 | dollar = unique("$"); |
| 139 | subst_init(); |
139 | 140 | subex_init(); |
140 | 141 | for (i = 1; i != argc; i++) { |
141 | 142 | if (*argv[i] != '-') { |
b2/subex.c |
29 | 29 | #define FIELDS 10 /* fields in KiCad schematics */ |
30 | 30 | |
31 | 31 | |
32 | | static const char *fn = NULL, *f[FIELDS]; |
| 32 | static const char *f[FIELDS]; |
33 | 33 | |
34 | 34 | /* Jump targets that can never be reached. */ |
35 | 35 | static struct subst jump_end; |
... | ... | |
248 | 248 | int i; |
249 | 249 | char tmp[4]; |
250 | 250 | |
251 | | fn = unique("FN"); |
252 | 251 | for (i = 0; i != FIELDS; i++) { |
253 | 252 | sprintf(tmp, "F%d", i); |
254 | 253 | f[i] = unique(tmp); |
b2/subst.c |
25 | 25 | #include "subst.h" |
26 | 26 | |
27 | 27 | |
| 28 | const char *fn; |
| 29 | |
| 30 | |
28 | 31 | /* ----- Rule set construction --------------------------------------------- */ |
29 | 32 | |
30 | 33 | |
... | ... | |
297 | 300 | while (sub) { |
298 | 301 | switch (sub->type) { |
299 | 302 | case st_match: |
300 | | if (sub->u.match.src == var) |
| 303 | if (sub->u.match.src == var && var != fn) |
301 | 304 | return 1; |
302 | 305 | break; |
303 | 306 | case st_assign: |
... | ... | |
459 | 462 | { |
460 | 463 | recurse_dump(file, sub, 0); |
461 | 464 | } |
| 465 | |
| 466 | |
| 467 | void subst_init(void) |
| 468 | { |
| 469 | fn = unique("FN"); |
| 470 | } |
b2/subst.h |
73 | 73 | #define MULT_CHARS "GMkmunpf" |
74 | 74 | |
75 | 75 | |
| 76 | extern const char *fn; |
| 77 | |
| 78 | |
76 | 79 | struct subst *subst_match(const char *src, const char *re); |
77 | 80 | struct subst *subst_assign(const char *dst, enum relop op, const char *pat); |
78 | 81 | struct subst *subst_end(void); |
... | ... | |
84 | 87 | |
85 | 88 | void subst_dump(FILE *file, const struct subst *sub); |
86 | 89 | |
| 90 | void subst_init(void); |
| 91 | |
87 | 92 | #endif /* !SUBST_H */ |
Download the corresponding diff file