1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2024-11-25 22:55:20 +02:00

b2/: move implicit initialization of FN, F1, ... to explicit function subex_init

This commit is contained in:
Werner Almesberger 2012-06-03 02:00:56 -03:00
parent cae92bba03
commit c6e394436c
3 changed files with 16 additions and 9 deletions

View File

@ -136,6 +136,7 @@ int main(int argc, char **argv)
int i;
dollar = unique("$");
subex_init();
for (i = 1; i != argc; i++) {
if (*argv[i] != '-') {
process(argv[i]);

View File

@ -235,18 +235,22 @@ static const struct subst *recurse_sub(const struct subst *sub,
int substitute(const struct subst *sub, const struct param *in,
struct param **out)
{
int i;
char tmp[4];
enum subst_type cause = 0;
if (!fn) {
fn = unique("FN");
for (i = 0; i != FIELDS; i++) {
sprintf(tmp, "F%d", i);
f[i] = unique(tmp);
}
}
*out = NULL;
return recurse_sub(sub, in, NULL, NULL, NULL, NULL, out, &cause)
!= &jump_ignore;
}
void subex_init(void)
{
int i;
char tmp[4];
fn = unique("FN");
for (i = 0; i != FIELDS; i++) {
sprintf(tmp, "F%d", i);
f[i] = unique(tmp);
}
}

View File

@ -20,4 +20,6 @@
int substitute(const struct subst *sub, const struct param *in,
struct param **out);
void subex_init(void);
#endif /* !SUBEX_H */