mirror of
https://github.com/vishapoberon/compiler.git
synced 2026-04-06 04:02:25 +00:00
Record curpos on every inR.Read. Add more debug to catch OpenBSD read failure.
This commit is contained in:
parent
c7e88f4634
commit
cf2da3000f
8 changed files with 47 additions and 32 deletions
|
|
@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len)
|
||||||
|
|
||||||
void OPM_Get (CHAR *ch)
|
void OPM_Get (CHAR *ch)
|
||||||
{
|
{
|
||||||
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
|
||||||
if (*ch == 0x0d) {
|
|
||||||
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
||||||
} else {
|
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
||||||
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)) {
|
if ((*ch < 0x09 && !OPM_inR.eot)) {
|
||||||
*ch = ' ';
|
*ch = ' ';
|
||||||
|
|
|
||||||
|
|
@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len)
|
||||||
|
|
||||||
void OPM_Get (CHAR *ch)
|
void OPM_Get (CHAR *ch)
|
||||||
{
|
{
|
||||||
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
|
||||||
if (*ch == 0x0d) {
|
|
||||||
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
||||||
} else {
|
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
||||||
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)) {
|
if ((*ch < 0x09 && !OPM_inR.eot)) {
|
||||||
*ch = ' ';
|
*ch = ' ';
|
||||||
|
|
|
||||||
|
|
@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len)
|
||||||
|
|
||||||
void OPM_Get (CHAR *ch)
|
void OPM_Get (CHAR *ch)
|
||||||
{
|
{
|
||||||
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
|
||||||
if (*ch == 0x0d) {
|
|
||||||
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
||||||
} else {
|
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
||||||
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)) {
|
if ((*ch < 0x09 && !OPM_inR.eot)) {
|
||||||
*ch = ' ';
|
*ch = ' ';
|
||||||
|
|
|
||||||
|
|
@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len)
|
||||||
|
|
||||||
void OPM_Get (CHAR *ch)
|
void OPM_Get (CHAR *ch)
|
||||||
{
|
{
|
||||||
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
|
||||||
if (*ch == 0x0d) {
|
|
||||||
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
||||||
} else {
|
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
||||||
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)) {
|
if ((*ch < 0x09 && !OPM_inR.eot)) {
|
||||||
*ch = ' ';
|
*ch = ' ';
|
||||||
|
|
|
||||||
|
|
@ -484,11 +484,13 @@ void OPM_Init (BOOLEAN *done, CHAR *mname, ADDRESS mname__len)
|
||||||
|
|
||||||
void OPM_Get (CHAR *ch)
|
void OPM_Get (CHAR *ch)
|
||||||
{
|
{
|
||||||
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
|
||||||
if (*ch == 0x0d) {
|
|
||||||
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
OPM_curpos = Texts_Pos(&OPM_inR, Texts_Reader__typ);
|
||||||
} else {
|
Texts_Read(&OPM_inR, Texts_Reader__typ, &*ch);
|
||||||
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)) {
|
if ((*ch < 0x09 && !OPM_inR.eot)) {
|
||||||
*ch = ' ';
|
*ch = ' ';
|
||||||
|
|
|
||||||
|
|
@ -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 *)
|
PROCEDURE Get*(VAR ch: CHAR); (* read next character from source text, 0X if eof *)
|
||||||
BEGIN
|
BEGIN
|
||||||
|
curpos := Texts.Pos(inR);
|
||||||
Texts.Read(inR, ch);
|
Texts.Read(inR, ch);
|
||||||
IF ch = 0DX THEN
|
|
||||||
curpos := Texts.Pos(inR); (* supports CR LF mapping *)
|
(* OpenBSD intermittent file read error debugging. *)
|
||||||
ELSE
|
IF (curpos = 0) & inR.eot THEN
|
||||||
INC(curpos)
|
LogWLn; LogWStr("DEBUG: OPM.Get returned inR.eot at curpos = 0, ch = ");
|
||||||
END ;
|
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
|
IF (ch < 09X) & ~inR.eot THEN ch := " " END
|
||||||
END Get;
|
END Get;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,14 @@ IntSyntax.mod compiling IntSyntax.
|
||||||
|
|
||||||
14: i := l; (* Bad, INTEGER shorter than LONGINT *)
|
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 *)
|
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 *)
|
16: i := l; (* Bad, SHORTINT shorter than INTEGER *)
|
||||||
^
|
^
|
||||||
pos 446 err 113 incompatible assignment
|
pos 445 err 113 incompatible assignment
|
||||||
|
|
||||||
Module compilation failed.
|
Module compilation failed.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue