mirror of
git://projects.qi-hardware.com/eda-tools.git
synced 2024-11-22 16:31:54 +02:00
b2/: move implicit initialization of FN, F1, ... to explicit function subex_init
This commit is contained in:
parent
cae92bba03
commit
c6e394436c
@ -136,6 +136,7 @@ int main(int argc, char **argv)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
dollar = unique("$");
|
dollar = unique("$");
|
||||||
|
subex_init();
|
||||||
for (i = 1; i != argc; i++) {
|
for (i = 1; i != argc; i++) {
|
||||||
if (*argv[i] != '-') {
|
if (*argv[i] != '-') {
|
||||||
process(argv[i]);
|
process(argv[i]);
|
||||||
|
22
b2/subex.c
22
b2/subex.c
@ -235,18 +235,22 @@ static const struct subst *recurse_sub(const struct subst *sub,
|
|||||||
int substitute(const struct subst *sub, const struct param *in,
|
int substitute(const struct subst *sub, const struct param *in,
|
||||||
struct param **out)
|
struct param **out)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
char tmp[4];
|
|
||||||
enum subst_type cause = 0;
|
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;
|
*out = NULL;
|
||||||
return recurse_sub(sub, in, NULL, NULL, NULL, NULL, out, &cause)
|
return recurse_sub(sub, in, NULL, NULL, NULL, NULL, out, &cause)
|
||||||
!= &jump_ignore;
|
!= &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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -20,4 +20,6 @@
|
|||||||
int substitute(const struct subst *sub, const struct param *in,
|
int substitute(const struct subst *sub, const struct param *in,
|
||||||
struct param **out);
|
struct param **out);
|
||||||
|
|
||||||
|
void subex_init(void);
|
||||||
|
|
||||||
#endif /* !SUBEX_H */
|
#endif /* !SUBEX_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user