gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gm2] TextIO.ReadRestLine includes EOL char in string result


From: SiTex Graphics
Subject: Re: [Gm2] TextIO.ReadRestLine includes EOL char in string result
Date: Tue, 3 Nov 2009 17:26:52 -0500

Hi Gaius,

The fix for ReadRestLine appears to have broken something in TextIO.
The call to SkipLine in the following test code now generates an
exception.  The code worked fine in earlier builds.  You'll need to
create a small test.txt file to test.

-Scott


MODULE loadtext;

IMPORT STextIO, SeqFile, TextIO, ChanConsts, IOConsts, IOChan, SWholeIO;

PROCEDURE PrintText(filename : ARRAY OF CHAR);
VAR
  f : IOChan.ChanId;
  res : ChanConsts.OpenResults;
  buf : ARRAY [0..999] OF CHAR;
  line,i : CARDINAL;
BEGIN
  SeqFile.OpenRead(f,filename,SeqFile.read,res);
  IF (res=ChanConsts.opened) THEN
    line:=1;
    LOOP
      buf[0]:=CHR(0);
      TextIO.ReadRestLine(f,buf);
      IF IOChan.ReadResult(f)=IOConsts.endOfInput THEN EXIT; END;
      i:=LENGTH(buf);
      IF (i>0) AND (buf[i-1]=CHR(10)) THEN STextIO.WriteString("EOL"); END;
      SWholeIO.WriteCard(line,1); STextIO.WriteString(" "); INC(line);

      STextIO.WriteString(buf); STextIO.WriteLn;
      TextIO.SkipLine(f);
      IF IOChan.ReadResult(f)=IOConsts.endOfInput THEN EXIT; END;
    END;
    SeqFile.Close(f);
  END;
END PrintText;

BEGIN
  PrintText("test.txt");
END loadtext.


On Mon, Nov 2, 2009 at 2:59 PM, SiTex Graphics <address@hidden> wrote:
> On Sun, Nov 1, 2009 at 1:57 PM, Gaius Mulley <address@hidden> wrote:
>> now fixed in the latest cvs:
>
> Confirmed.  Thank you for the quick fix!
>
> -Scott
>
>
>>   * gm2/gm2-compiler/M2GCCDeclare.mod:  IsTypeQ check to
>>     see that we are not trying to declare a PartialUnbounded
>>     symbol.  (IncludePartialUnbounded) New procedure.
>>     PrintVerboseFromList call IncludePartialUnbounded if
>>     necessary and check for GnuAsm symbols.
>>   * gm2/gm2-compiler/SymbolTable.mod:  MakePointer, MakeSet,
>>     MakeProcType must also call ForeachOAFamily.  GetScope
>>     to call InternalError if trying to get the scope of
>>     a PartialUnbounded symbol.
>>   * fixes a bug reported by Scott Iverson
>>     (http://lists.gnu.org/archive/html/gm2/2009-10/msg00048.html).
>>
>> many thanks for the report and testcode,
>>
>> regards,
>> Gaius
>>
>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]