From: Lukas Krickl Date: Tue, 28 Nov 2023 05:24:01 +0000 (+0100) Subject: WIP: multi-pass X-Git-Url: https://git.krickl.dev/?a=commitdiff_plain;h=da44dee632ee689da367702f5aef51356d199443;p=ulas%2F.git WIP: multi-pass --- diff --git a/include/ulas.h b/include/ulas.h index ed38f4a..dcf793f 100644 --- a/include/ulas.h +++ b/include/ulas.h @@ -208,6 +208,10 @@ extern struct ulas ulas; int ulas_icntr(void); +// init the next pass +// by resetting some values +void ulas_nextpass(void); + /** * Preproc */ diff --git a/src/ulas.c b/src/ulas.c index b764ffc..993a00a 100644 --- a/src/ulas.c +++ b/src/ulas.c @@ -41,6 +41,10 @@ void ulas_init(struct ulas_config cfg) { ulas.syms = ulas_symbuf(); } +void ulas_nextpass(void) { + ulas.scope = 0; +} + void ulas_free(void) { ulas_strfree(&ulas.tok); ulas_tokbuffree(&ulas.toks); @@ -906,6 +910,8 @@ int ulas_preproc(FILE *dst, FILE *src) { // init struct ulas_preproc pp = ulas_preprocinit(); + ulas_nextpass(); + long prevseek = 0; // preproc while ((rc = ulas_preprocnext(&pp, dst, src, buf, ULAS_LINEMAX)) > 0) {