From a3c6c5513dcfc25d952735449bf6da476d905184 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Wed, 18 Mar 2020 19:57:49 +0000 Subject: 45583/0007: WC_FUNCDEF: Add a placeholder element. --- Src/exec.c | 3 ++- Src/parse.c | 5 +++++ Src/text.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) (limited to 'Src') diff --git a/Src/exec.c b/Src/exec.c index cd014ff38..3c3fcfa3e 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -5169,6 +5169,7 @@ execfuncdef(Estate state, Eprog redir_prog) sbeg = *state->pc++; nstrs = *state->pc++; npats = *state->pc++; + (void) *state->pc++; nprg = (end - state->pc); plen = nprg * sizeof(wordcode); @@ -6138,7 +6139,7 @@ stripkshdef(Eprog prog, char *name) int sbeg = pc[2], nstrs = pc[3], nprg, npats = pc[4], plen, len, i; Patprog *pp; - pc += 5; + pc += 6; nprg = end - pc; plen = nprg * sizeof(wordcode); diff --git a/Src/parse.c b/Src/parse.c index 6ca6f33be..0111c25b6 100644 --- a/Src/parse.c +++ b/Src/parse.c @@ -173,6 +173,7 @@ struct heredocs *hdocs; * - followed by offset to first string * - followed by length of string table * - followed by number of patterns for body + * - followed by a placeholder * - followed by codes for body * - followed by strings for body * - if number of names is 0, followed by: @@ -1691,6 +1692,7 @@ par_funcdef(int *cmplx) ecadd(0); /* p + num + 2 */ ecadd(0); /* p + num + 3 */ ecadd(0); /* p + num + 4 */ + ecadd(0); /* p + num + 5 */ nocorrect = 0; incmdpos = 1; @@ -1730,6 +1732,7 @@ par_funcdef(int *cmplx) ecbuf[p + num + 2] = so - oecssub; ecbuf[p + num + 3] = ecsoffs - so; /* "length of string table" */ ecbuf[p + num + 4] = ecnpats; /* "number of patterns for body" */ + ecbuf[p + num + 5] = 0; ecbuf[p + 1] = num; /* "number of names" */ ecnpats = onp; @@ -2053,6 +2056,7 @@ par_simple(int *cmplx, int nr) ecadd(0); ecadd(0); ecadd(0); + ecadd(0); ecnfunc++; ecssub = so = ecsoffs; @@ -2108,6 +2112,7 @@ par_simple(int *cmplx, int nr) ecbuf[p + argc + 2] = so - oecssub; ecbuf[p + argc + 3] = ecsoffs - so; ecbuf[p + argc + 4] = ecnpats; + ecbuf[p + argc + 5] = 0; ecnpats = onp; ecssub = oecssub; diff --git a/Src/text.c b/Src/text.c index 69530ae79..4bf88f2e2 100644 --- a/Src/text.c +++ b/Src/text.c @@ -600,7 +600,7 @@ gettext2(Estate state) n->u._funcdef.end = end; n->u._funcdef.nargs = nargs; state->strs += *state->pc; - state->pc += 3; + state->pc += 4; } } else { state->strs = s->u._funcdef.strs; -- cgit 1.4.1