[Oberon] Newlines and Carriage-Returns

Andreas Pirklbauer andreas_pirklbauer at yahoo.com
Mon Jan 7 13:11:17 CET 2019


   > I'm not so sure. I recommend you check the other change that was made at the same time. i.e. in Texts.Read before drawing any conclusions:
   > 
   > Before:
   >
   >    IF R.ref.f = TrailerFile THEN R.eot := TRUE END;
   >    R.org := R.org + R.off; R.off := 0;
   >    R.ref := R.ref.next; R.org := R.org + R.off; R.off := 0; 
  >
  > After:
  >
  >      IF R.ref.f = TrailerFile THEN R.eot := TRUE END;
  >      R.ref := R.ref.next; R.org := R.org + R.off; R.off := 0;
  >

I’m not so sure. I recommend to read the above changes to Texts.Read carefully.
It only eliminates duplications of code, namely "R.org := R.org + R.off; R.off := 0”,
which appears twice (the second R.org := R.org + R.off had no effect anyway,
since R.off had already been set to 0).

The above change in Texts.Read has nothing to do with the earlier fix,
where the lines 

   WHILE ~S.eot & (ch <= " ") DO .. END

have the effect of skipping any value < “ “, in particular it also “eats" LF, while
at the same *not* depending on Files.Read setting ch := 0X to indicate eot.

It’s a kind of more gentle error recovery in case the file reaches eot before
any of the characters in the original WHILE loop:

  WHILE (ch = " ") OR (ch = TAB) OR (ch = CR) DO .. END;

PS: Everywhere else in the Oberon system, the check on S.eot or R.eot is
always used … which is why I originally suggested the “fix” originally.

-ap



More information about the Oberon mailing list