From ca9e2ec1ff53a8d2076b7036b5ca15ef8d49f24b Mon Sep 17 00:00:00 2001 From: Meisam Bahadori Date: Sun, 16 Aug 2026 12:05:21 +0200 Subject: [PATCH] pa-162 --- src/frontend/inp.c | 11 +++++++++++ 1 file changed, 11 insertions(+) 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;