In order to be able to work smoothly with existing files, an Oberon system that accepts NL to terminate lines should continue to accept CR in source texts but should emit NL when producing new line termination characters.
To adjust OberonV5, the following files require the following changes:
- ORS.Mod (already in latest Project Oberon version, older versions were more restrictive)
- in
PROCEDURE HexString
useWHILE ~R.eot & (ch <= " ") DO Texts.Read(R, ch) END ;
- in
- Graphics.Mod
- in
PROCEDURE CopyCaption
useTexts.Write(TW, 0AX); Texts.OpenReader(R, T, src(Caption).pos);
- in
PROCEDURE ReadCaption
useBEGIN obj(Caption).pos := T.len + 1; Texts.Write(TW, 0AX);
- in
- GraphicFrames.Mod
- in
PROCEDURE CaptionCopy
useBEGIN Texts.Write(W, 0AX);
- in
PROCEDURE NewCaption
useBEGIN Texts.Write(W, 0AX);
- in
- Texts.Mod
- in
CONST
section useTAB = 9X; CR = 0DX; NL = 0AX; maxD = 9;
- in
PROCEDURE Scan
useWHILE ~S.eot & (ch <= " ") DO
- in
PROCEDURE Scan
useIF (ch = NL) OR (ch = CR) THEN INC(S.line) END ;
- in
PROCEDURE WriteLn
useBEGIN Write(W, NL)
- in
- TextFrames.Mod
- in
CONST
section useBS = 8X; TAB = 9X; CR = 0DX; NL = 0AX; DEL = 7FX;
- in
PROCEDURE DisplayLine
useWHILE (nextCh # NL) & (nextCh # CR) & (R.fnt # NIL) DO
- in
PROCEDURE Validate
useREPEAT Texts.Read(R, nextCh); INC(pos) UNTIL R.eot OR (nextCh = NL) OR (nextCh = CR)
- in
PROCEDURE Write
useELSIF (20X <= ch) & (ch <= DEL) OR (ch = NL) OR (ch = CR) OR (ch = TAB) THEN
- in
- System.Mod
- in
PROCEDURE Directory
useIF (ch = "^") OR (ch = 0DX) OR (ch = 0AX) THEN
- in
If the source texts (.Mod files) being introduced to an un-converted OberonV5 system already use newlines instead of carriage-returns and ORS is from an older, more restrictive version then ORS in the un-converted system must be modified first (and be unloaded so the new ORS module may be loaded) before compiling the rest of the source files, or the compiler will emit an error when attemptig to compile HexStrings in the source files.
Aside from ORS the above files do not have to be compiled in any particular order.
Since all of the above files are in the Outer Core of OberonV5 a new Inner Core does not have to be compiled or installed. A newline-friendly system can be produced merely by modifying and compiling the above modules and then restarting the system.
The above modifications do not account for the CR LF combination which more appropriately would be treated as a single line break rather than two as results with the above changes.