[Oberon] LOOP conversion
Joerg
joerg.straube at iaeth.ch
Mon Jan 4 12:02:47 CET 2021
Chris
Just for your info: my TextFrames.Menu it looks like this
IF Display.Width < 1024 THEN
ASSERT(LEN(commands) <= 256); (* verify "commands" fits into "short" *)
(* code below assumes 0X before LEN(commands) *)
d := 0; mb := 0; mbSet := FALSE; s := 1; ch := commands[0];
WHILE ch # 0X DO
WHILE (ch # 0X) & ~letter(ch) DO short[d] := ch; INC(d); ch := commands[s]; INC(s) END;
m := mb; sb := s;
WHILE letterDigit(ch) DO
IF ch = commands[m] THEN INC(m) END; short[d] := ch; INC(d); ch := commands[s]; INC(s)
END;
IF ch = "." THEN
IF mbSet & (m-mb = s-sb) THEN DEC(d, m-mb) ELSE mb := sb-1; mbSet := TRUE END;
REPEAT short[d] := ch; INC(d); ch := commands[s]; INC(s) UNTIL ~letterDigit(ch)
END
END;
short[d] := 0X;
END
Jörg
More information about the Oberon
mailing list