Newlines and Carriage-Returns
If anyone is curious it can be found at: https://github.com/io-core/technotes/blob/master/technote001.md
Texts.Mod in PROCEDURE Scan use WHILE (ch = " ") OR (ch = TAB) OR (ch = NL) OR (ch = CR) DO in PROCEDURE Scan use IF (ch = NL) OR (ch = CR) THEN INC(S.line) END ;
For procedure Texts.Scan it is actually slightly better to use the following code for the WHILE loop instead: WHILE ~S.eot & (ch <= " ") DO Reason: This code will *not* hang the system if an EOT is encountered in the file before any of the characters in the WHILE condition.. for example with a file which consists *just* of an EOT. This “bug” was already fixed at one point at www.projectoberon.com, but now the old version is back.
Thanks Andreas, that is better and I have updated the technote. It is strange that the file on Project Oberon lost the change. I see that it is there in an older archive on my hard drive. On Sat, Jan 5, 2019 at 12:52 PM Andreas Pirklbauer < andreas_pirklbauer@yahoo.com> wrote:
If anyone is curious it can be found at: https://github.com/io-core/technotes/blob/master/technote001.md
Texts.Mod in PROCEDURE Scan use WHILE (ch = " ") OR (ch = TAB) OR (ch = NL) OR (ch = CR) DO in PROCEDURE Scan use IF (ch = NL) OR (ch = CR) THEN INC(S.line) END ;
For procedure Texts.Scan it is actually slightly better to use the following code for the WHILE loop instead:
WHILE ~S.eot & (ch <= " ") DO
Reason: This code will *not* hang the system if an EOT is encountered in the file before any of the characters in the WHILE condition.. for example with a file which consists *just* of an EOT.
This “bug” was already fixed at one point at www.projectoberon.com, but now the old version is back. -- Oberon@lists.inf.ethz.ch mailing list for ETH Oberon and related systems https://lists.inf.ethz.ch/mailman/listinfo/oberon
participants (2)
-
Andreas Pirklbauer -
Charles Perkins