home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,927 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 117,494 of 117,927   
   minforth to All   
   Re: READ-LINE when u1=0   
   26 Jul 25 09:43:26   
   
   From: minforth@gmx.net   
      
   Am 26.07.2025 um 08:29 schrieb Anton Ertl:   
   > dxf  writes:   
   >> If the result differs but with no harmful effect then what would   
   >> you call that?   
   >   
   > If the the behaviour of an implementation differs from what is   
   > specified, I call that a bug.   
   >   
   >> 0 value fid   
   >>   
   >> : print cr rot 2 .r ."  ->" swap 2 .r 3 .r ;   
   >>   
   >> : test   
   >> s" foo.txt" r/w create-file throw to fid   
   >> s" foobar" fid write-file throw   
   >> fid close-file drop   
   >>   
   >> s" foo.txt" r/o open-file throw to fid   
   >> page   
   >> 0  pad over fid read-line throw print   
   >> 10 pad over fid read-line throw print   
   >> 0  pad over fid read-line throw print   
   >> 1  pad over fid read-line throw print   
   >> fid close-file drop cr   
   >> ;   
   >>   
   >> test   
   >>   
   >> \\   
   >>   
   >> SwiftForth   
   >> 0 -> 0 -1   
   >> 10 -> 6 -1   
   >> 0 -> 0  0   
   >> 1 -> 0  0   
   >>   
   >> VFX   
   >> 0 -> 0 -1   
   >> 10 -> 6 -1   
   >> 0 -> 0 -1   
   >> 1 -> 0  0   
   >>   
   >> Gforth   
   >> 0 -> 0 -1   
   >> 10 -> 6 -1   
   >> 0 -> 0 -1   
   >> 1 -> 0  0   
   >>   
   >> NTF   
   >> 0 -> 0 -1   
   >> 10 -> 6 -1   
   >> 0 -> 0 -1   
   >> 1 -> 0  0   
   >>   
   >> Win32Forth   
   >> 0 -> 0 -1   
   >> 10 -> 6 -1   
   >> 0 -> 0  0   
   >> 1 -> 0  0   
   >   
   > The specification requires:   
   >   
   > |If the operation succeeded, flag is true and ior is zero.   
   > [...]   
   > |If the operation is initiated when the value returned by FILE-POSITION   
   > |is equal to the value returned by FILE-SIZE for the file identified by   
   > |fileid, flag is false, ior is zero, and u2 is zero.   
   >   
   > In the case of u1=0, both conditions can be true, and the   
   > specification is contradictory.  VFX, Gforth, and NTF apparently give   
   > priority to the first statement, SwiftForth and Win32Forth to the   
   > second.   
   >   
   > The specification should not be contradictory.  It should specify for   
   > this case whether flag should be true or false, or, if no consensus is   
   > reached, it should explicitly state that both results are acceptable.   
      
   Simply specify to perform the EOF check before reading.   
   if EOF true, exit.   
   Afterwards, u2=0 indicates an empty line.   
   Contradiction solved.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca