"Pre-master-45 hangs forever on a circuit that works on older versions."
That was an infinite loop when parsing a line with just "*#",
introduced by commit fb63573b6b.  Also add some comments.
This commit is contained in:
Giles Atkinson 2025-01-14 11:14:20 +00:00
parent 0f3e45fb08
commit 8d28b17ef8
1 changed files with 13 additions and 11 deletions

View File

@ -738,7 +738,11 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
} /* end if (comfile) */ } /* end if (comfile) */
else { /* must be regular deck . . . . */ else { /* must be regular deck . . . . */
/* loop through deck and handle control cards */ /* Loop through deck and handle control cards.
* Pointer ld refers to the last card processed that has not
* been deleted.
*/
for (dd = deck->nextcard; dd; dd = ld->nextcard) { for (dd = deck->nextcard; dd; dd = ld->nextcard) {
/* Ignore comment lines, but not lines begining with '*#', /* Ignore comment lines, but not lines begining with '*#',
but remove them, if they are in a .control ... .endc section */ but remove them, if they are in a .control ... .endc section */
@ -781,19 +785,17 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
/* Special control lines outside of .control section? */ /* Special control lines outside of .control section? */
if (prefix("*#", s)) { if (prefix("*#", s))
s = skip_ws(s + 2); s = skip_ws(s + 2);
if (!*s)
continue;
}
/* assemble all commands starting with pre_ after stripping
* pre_, to be executed before circuit parsing */
if (ciprefix("pre_", s)) { if (ciprefix("pre_", s)) {
/* Assemble all commands starting with pre_ after stripping
* pre_, to be executed before circuit parsing.
*/
s = s + 4; s = s + 4;
pre_controls = wl_cons(copy(s), pre_controls); pre_controls = wl_cons(copy(s), pre_controls);
} else { } else if (*s) {
/* Assemble all other commands to be executed /* Assemble all other commands to be executed
* after circuit parsing */ * after circuit parsing */
@ -832,10 +834,10 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
ld->nextcard = dd->nextcard; ld->nextcard = dd->nextcard;
line_free(dd, FALSE); line_free(dd, FALSE);
} else { } else {
ld = dd; ld = dd; // Keep this card
} }
} else { } else {
ld = dd; ld = dd; // ... and this.
} }
} }
} /* end for (dd = deck->nextcard . . . . */ } /* end for (dd = deck->nextcard . . . . */