commit 61c182cc7d59978c87a332fa39ca859e2433eed3
parent ff1b08a0458ae3dc950482e3a6c22a8693794089
Author: Alexander Burger <abu@software-lab.de>
Date: Tue, 2 Oct 2012 09:16:10 +0200
Increment 'for' counter before the condition
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/flow.c b/src/flow.c
@@ -1,4 +1,4 @@
-/* 07jun12abu
+/* 02oct12abu
* (c) Software Lab. Alexander Burger
*/
@@ -1287,12 +1287,14 @@ any doFor(any x) {
y = cdr(y), cond = car(y), y = cdr(y);
Push(c1,Nil);
body = x = cdr(x);
- while (!isNil(a = EVAL(cond))) {
- val(At) = a;
+ for (;;) {
if (f.cnt == 2) {
val(f.bnd[1].sym) = bigCopy(val(f.bnd[1].sym));
digAdd(val(f.bnd[1].sym), 2);
}
+ if (isNil(a = EVAL(cond)))
+ break;
+ val(At) = a;
do {
if (!isNum(data(c1) = car(x))) {
if (isSym(data(c1)))
diff --git a/src64/flow.l b/src64/flow.l
@@ -1,4 +1,4 @@
-# 30sep12abu
+# 02oct12abu
# (c) Software Lab. Alexander Burger
(code 'redefMsgEC)
@@ -2366,6 +2366,7 @@
link
push (Y CDR) # <S> (any2 . prg)
do
+ add ((L V)) (hex "10") # Increment 'sym2'
ld E ((S)) # Evaluate condition
eval
cmp E Nil # NIL?
@@ -2374,7 +2375,6 @@
break T
end
ld (At) E
- add ((L V)) (hex "10") # Increment 'sym2'
ld Y X # Loop body
call loopY_FE
while nz