Perhaps I'm tired, but this code doesn't work as I expect it to. Can someone look it over for a sanity check? I am running on the May 22, 2002 Bluebottle system: ETH Oberon / Aos 22.5.2002 Oberon Portable Compiler / nw, rc, nm, tk, prk Oberon Parser (Active & X Extensions) / prk The problem exists when the ":" character is passed to the routine. It passes through the IF statement. When the source is changed so that the "#" character is in the 5th call to the procedure, the command runs to completion, and the system state becomes the one shown at the end of the listing. MODULE AlmBug; VAR t : ARRAY 8 OF CHAR; ix : LONGINT; PROCEDURE ReadToken (ch : CHAR; VAR token: ARRAY OF CHAR); VAR trash : CHAR; BEGIN IF (("A"<=ch) & (ch<="Z")) OR (("a"<=ch) & (ch<="z")) OR (("0"<=ch) & ("9"<=ch)) THEN trash := "A"; ASSERT ((("A"<=ch) & (ch<="Z")) OR (("a"<=ch) & (ch<="z")) OR (("0"<=ch) & ("9"<=ch))); trash := "B"; ASSERT ((ch#":") & (ch#"$")); t [ix] := ch; INC (ix) END; END ReadToken; PROCEDURE Doit*; BEGIN ix := 0; ReadToken ("A", t); ReadToken ("b", t); ReadToken ("$", t); ReadToken ("C", t); ReadToken (":", t); ReadToken ("D", t) END Doit; END AlmBug.Doit Compiler.Compile @ System.Free AlmBug ~ System.State AlmBug ~ AlmBug SB = 02B39F58H @SELF = 02B39DB0H SELF = 02B39DB0H ix = 4 t = "AbCD" Aubrey McIntosh <mcintosh@vima.austin.tx.us> Assistant Professor of Chemistry University of Minnesota, Morris 600 E. 4th St. Morris, MN 56267-2134
Aubrey, "9"<=ch should be ch<="9" -Doug mcintosh@vima.austin.tx.us wrote:
Perhaps I'm tired, but this code doesn't work as I expect it to. Can someone look it over for a sanity check? I am running on the May 22, 2002 Bluebottle system: ETH Oberon / Aos 22.5.2002 Oberon Portable Compiler / nw, rc, nm, tk, prk Oberon Parser (Active & X Extensions) / prk
The problem exists when the ":" character is passed to the routine. It passes through the IF statement. When the source is changed so that the "#" character is in the 5th call to the procedure, the command runs to completion, and the system state becomes the one shown at the end of the listing.
MODULE AlmBug; VAR t : ARRAY 8 OF CHAR; ix : LONGINT;
PROCEDURE ReadToken (ch : CHAR; VAR token: ARRAY OF CHAR); VAR trash : CHAR; BEGIN IF (("A"<=ch) & (ch<="Z")) OR (("a"<=ch) & (ch<="z")) OR (("0"<=ch) & ("9"<=ch)) THEN trash := "A"; ASSERT ((("A"<=ch) & (ch<="Z")) OR (("a"<=ch) & (ch<="z")) OR (("0"<=ch) & ("9"<=ch))); trash := "B"; ASSERT ((ch#":") & (ch#"$")); t [ix] := ch; INC (ix) END; END ReadToken;
PROCEDURE Doit*; BEGIN ix := 0; ReadToken ("A", t); ReadToken ("b", t); ReadToken ("$", t); ReadToken ("C", t); ReadToken (":", t); ReadToken ("D", t) END Doit;
END AlmBug.Doit
Compiler.Compile @ System.Free AlmBug ~ System.State AlmBug ~
AlmBug SB = 02B39F58H @SELF = 02B39DB0H SELF = 02B39DB0H ix = 4 t = "AbCD"
Aubrey McIntosh <mcintosh@vima.austin.tx.us> Assistant Professor of Chemistry University of Minnesota, Morris 600 E. 4th St. Morris, MN 56267-2134
-- Oberon@inf.ethz.ch mailing list for ETH Oberon and related systems http://www.lists.inf.ethz.ch/mailman/listinfo/oberon
participants (2)
-
Douglas G. Danforth -
mcintosh@vima.austin.tx.us