int execrepeat(Estate state, UNUSED(int do_exec)) { Wordcode end, loop; wordcode code = state->pc[-1]; int count, htok = 0; char *tmp; int old_simple_pline = simple_pline; /* See comments in execwhile() */ simple_pline = 1; end = state->pc + WC_REPEAT_SKIP(code); lastval = 0; tmp = ecgetstr(state, EC_DUPTOK, &htok); if (htok) singsub(&tmp); count = mathevali(tmp); if (errflag) return 1; pushheap(); cmdpush(CS_REPEAT); loops++; loop = state->pc; while (count-- > 0) { state->pc = loop; execlist(state, 1, 0); freeheap(); if (breaks) { breaks--; if (breaks || !contflag) break; contflag = 0; } if (errflag) { lastval = 1; break; } if (retflag) break; } cmdpop(); popheap(); loops--; simple_pline = old_simple_pline; state->pc = end; this_noerrexit = 1; return lastval; }
int execrepeat(Estate state, UNUSED(int do_exec)) { Wordcode end, loop; wordcode code = state->pc[-1]; int count, htok = 0; char *tmp; end = state->pc + WC_REPEAT_SKIP(code); lastval = 0; tmp = ecgetstr(state, EC_DUPTOK, &htok); if (htok) singsub(&tmp); count = atoi(tmp); pushheap(); cmdpush(CS_REPEAT); loops++; loop = state->pc; while (count-- > 0) { state->pc = loop; execlist(state, 1, 0); freeheap(); if (breaks) { breaks--; if (breaks || !contflag) break; contflag = 0; } if (errflag) { lastval = 1; break; } if (retflag) break; } cmdpop(); popheap(); loops--; state->pc = end; return lastval; }