diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 971696e95..310b71b48 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -775,6 +775,17 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) commands = FALSE; else fprintf(cp_err, "Warning: misplaced .endc card\n"); + } else if (!commands && ciprefix(".hb", dd->line) && + (dd->line[3] == '\0' || isspace_c(dd->line[3]))) { + /* Enhancement-162: a top-level `.hb ...` card is run after the + * circuit is parsed as an `hb ...` command (Enhancement-134 + * harmonic balance), mirroring the `.sweep` handling above -- drop + * the leading '.' and add it to the post-parse control list. The + * boundary check keeps `.hb` from swallowing any future `.hb*` + * card. */ + controls = wl_cons(copy(skip_ws(dd->line) + 1), controls); + ld->nextcard = dd->nextcard; + line_free(dd, FALSE); } else if (commands || prefix("*#", dd->line)) { s = dd->line;