Skip to content

Commit

Permalink
WRspice: fixed shell expansion in .param lines not being done.
Browse files Browse the repository at this point in the history
  • Loading branch information
wrcad committed Jul 16, 2022
1 parent 5746c74 commit 16c1885
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions wrspice/src/fte/source.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1009,21 +1009,6 @@ IFsimulator::SpDeck(sLine *deck, const char *filename, wordlist *execs,
ExecCmds(execs);
ExecsPop();

// This is subtle. Suppose that there are lines like "param
// p1 = $val" and that the execs contain "set val = 10". At
// this point, we need to update the parameters, before we do
// the parameter expand in subcircuit expansion, otherwise
// we get unexpanded shell variables in the netlist.

for (sLine *dd = deck->next(); dd; dd = dd->next()) {
if (lstring::cimatch(PARAM_KW, dd->line())) {
if (strchr(dd->line(), '$')) {
dd->var_subst();
ptab = sParamTab::extract_params(ptab, dd->line());
}
}
}

// Still in list? may have been destroyed.
sPlot *px = OP.plotList();
for ( ; px; px = px->next_plot()) {
Expand All @@ -1033,6 +1018,20 @@ IFsimulator::SpDeck(sLine *deck, const char *filename, wordlist *execs,
if (!px)
pl_ex = 0;
}

// We need to shell expand the parameter definitions before we do
// the parameter expand in subcircuit expansion, otherwise we can
// get unexpanded shell variables in the netlist.

for (sLine *dd = deck->next(); dd; dd = dd->next()) {
if (lstring::cimatch(PARAM_KW, dd->line())) {
if (strchr(dd->line(), '$')) {
dd->var_subst();
ptab = sParamTab::extract_params(ptab, dd->line());
}
}
}

#ifdef TIME_DEBUG
double tend = OP.seconds();
printf("init 2: %g\n", tend - tstart);
Expand Down

0 comments on commit 16c1885

Please sign in to comment.