diff --git a/bootstrap/unix-44/OPM.c b/bootstrap/unix-44/OPM.c index 94394339..04afccfa 100644 --- a/bootstrap/unix-44/OPM.c +++ b/bootstrap/unix-44/OPM.c @@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) void OPM_Get (CHAR *ch) { + OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch); - if (*ch == 0x0d) { - OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); - } else { - OPM_curpos += 1; + if ((OPM_curpos == 0 && OPM_inR.eot)) { + OPM_LogWLn(); + OPM_LogWStr((CHAR*)"DEBUG: OPM.Get returned inR.eot at curpos = 0, ch = ", 53); + OPM_LogWNum((INT16)*ch, 1); + OPM_LogW('.'); } if ((*ch < 0x09 && !OPM_inR.eot)) { *ch = ' '; diff --git a/bootstrap/unix-48/OPM.c b/bootstrap/unix-48/OPM.c index 94394339..04afccfa 100644 --- a/bootstrap/unix-48/OPM.c +++ b/bootstrap/unix-48/OPM.c @@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) void OPM_Get (CHAR *ch) { + OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch); - if (*ch == 0x0d) { - OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); - } else { - OPM_curpos += 1; + if ((OPM_curpos == 0 && OPM_inR.eot)) { + OPM_LogWLn(); + OPM_LogWStr((CHAR*)"DEBUG: OPM.Get returned inR.eot at curpos = 0, ch = ", 53); + OPM_LogWNum((INT16)*ch, 1); + OPM_LogW('.'); } if ((*ch < 0x09 && !OPM_inR.eot)) { *ch = ' '; diff --git a/bootstrap/unix-88/OPM.c b/bootstrap/unix-88/OPM.c index 7eb94291..a7014a53 100644 --- a/bootstrap/unix-88/OPM.c +++ b/bootstrap/unix-88/OPM.c @@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) void OPM_Get (CHAR *ch) { + OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch); - if (*ch == 0x0d) { - OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); - } else { - OPM_curpos += 1; + if ((OPM_curpos == 0 && OPM_inR.eot)) { + OPM_LogWLn(); + OPM_LogWStr((CHAR*)"DEBUG: OPM.Get returned inR.eot at curpos = 0, ch = ", 53); + OPM_LogWNum((INT16)*ch, 1); + OPM_LogW('.'); } if ((*ch < 0x09 && !OPM_inR.eot)) { *ch = ' '; diff --git a/bootstrap/windows-48/OPM.c b/bootstrap/windows-48/OPM.c index 94394339..04afccfa 100644 --- a/bootstrap/windows-48/OPM.c +++ b/bootstrap/windows-48/OPM.c @@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) void OPM_Get (CHAR *ch) { + OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch); - if (*ch == 0x0d) { - OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); - } else { - OPM_curpos += 1; + if ((OPM_curpos == 0 && OPM_inR.eot)) { + OPM_LogWLn(); + OPM_LogWStr((CHAR*)"DEBUG: OPM.Get returned inR.eot at curpos = 0, ch = ", 53); + OPM_LogWNum((INT16)*ch, 1); + OPM_LogW('.'); } if ((*ch < 0x09 && !OPM_inR.eot)) { *ch = ' '; diff --git a/bootstrap/windows-88/OPM.c b/bootstrap/windows-88/OPM.c index 7eb94291..a7014a53 100644 --- a/bootstrap/windows-88/OPM.c +++ b/bootstrap/windows-88/OPM.c @@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len) void OPM_Get (CHAR *ch) { + OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch); - if (*ch == 0x0d) { - OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ); - } else { - OPM_curpos += 1; + if ((OPM_curpos == 0 && OPM_inR.eot)) { + OPM_LogWLn(); + OPM_LogWStr((CHAR*)"DEBUG: OPM.Get returned inR.eot at curpos = 0, ch = ", 53); + OPM_LogWNum((INT16)*ch, 1); + OPM_LogW('.'); } if ((*ch < 0x09 && !OPM_inR.eot)) { *ch = ' '; diff --git a/src/compiler/OPM.Mod b/src/compiler/OPM.Mod index 2abce2c9..de100717 100644 --- a/src/compiler/OPM.Mod +++ b/src/compiler/OPM.Mod @@ -387,12 +387,17 @@ MODULE OPM; (* RC 6.3.89 / 28.6.89, J.Templ 10.7.89 / 22.7.96 *) PROCEDURE Get*(VAR ch: CHAR); (* read next character from source text, 0X if eof *) BEGIN + curpos := Texts.Pos(inR); Texts.Read(inR, ch); - IF ch = 0DX THEN - curpos := Texts.Pos(inR); (* supports CR LF mapping *) - ELSE - INC(curpos) - END ; + + (* OpenBSD intermittent file read error debugging. *) + IF (curpos = 0) & inR.eot THEN + LogWLn; LogWStr("DEBUG: OPM.Get returned inR.eot at curpos = 0, ch = "); + LogWNum(ORD(ch),1); LogW("."); + END; + (* TODO, remove curpos var, and provide fn returning Texts.Pos(inR) - 1. *) + (* Or, better still, record symbol position in OPS. *) + IF (ch < 09X) & ~inR.eot THEN ch := " " END END Get; diff --git a/src/runtime/Texts.Mod b/src/runtime/Texts.Mod index 305b225d..f20750d9 100644 --- a/src/runtime/Texts.Mod +++ b/src/runtime/Texts.Mod @@ -341,7 +341,7 @@ MODULE Texts; (** CAS/HM 23.9.93 -- interface based on Texts by JG/NW 6.12.91** IF (ch = 0AX) & u(Piece).ascii THEN ch := CR (* << LF to CR *) ELSIF (ch = CR) & u(Piece).ascii THEN (* << CR LF to CR *) pos := Files.Pos(R.rider); Files.Read(R.rider, nextch); - IF nextch = 0AX THEN INC(R.off) ELSE Files.Set(R.rider, u(Piece).file, pos) END + IF nextch = 0AX THEN INC(R.off) ELSE Files.Set(R.rider, u(Piece).file, pos) END END ELSIF u IS Elem THEN ch := ElemChar; R.elem := u(Elem) ELSE ch := 0X; R.elem := NIL; R.eot := TRUE diff --git a/src/test/confidence/intsyntax/expected b/src/test/confidence/intsyntax/expected index 1abe43f9..94e29760 100644 --- a/src/test/confidence/intsyntax/expected +++ b/src/test/confidence/intsyntax/expected @@ -1,15 +1,15 @@ IntSyntax.mod compiling IntSyntax. 14: i := l; (* Bad, INTEGER shorter than LONGINT *) - ^ - pos 341 err 113 incompatible assignment + ^ + pos 340 err 113 incompatible assignment 15: s := l; (* Bad, SHORTINT shorter than LONGINT *) - ^ - pos 393 err 113 incompatible assignment + ^ + pos 392 err 113 incompatible assignment 16: i := l; (* Bad, SHORTINT shorter than INTEGER *) - ^ - pos 446 err 113 incompatible assignment + ^ + pos 445 err 113 incompatible assignment Module compilation failed.