gforth
[Top][All Lists]
Advanced

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

Re: [gforth] stuff.fs possible bug in \\\ word


From: Bernd Paysan
Subject: Re: [gforth] stuff.fs possible bug in \\\ word
Date: Sat, 30 Jan 2016 00:44:39 +0100
User-agent: KMail/4.14.10 (Linux/4.4.0-2-default; KDE/4.14.16; x86_64; ; )

Am Freitag, 29. Januar 2016, 16:26:12 schrieb Philip Smith:
> Looking through source file stuff.fs and found this gem! I have version
> 0.7.9_20160113 !
> 
> \ \\\ - skip to end of file
> 
> : \\\ ( -- ) \ gforth
> 
>     \G skip remaining source file
>     source-id dup 0> IF
> 
> >r r@ file-size throw r> reposition-file throw
> 
> BEGIN  refill 0= UNTIL  postpone \  THEN ; immediate
> 
> But when i tested it i do not get the skip to end of file that i thought i
> should get!
> I think the intent here was to see if source-id is a file handle and if so
> 
> do the skipping so i tried this change:
> : \\\ ( -- ) \ gforth
> 
>     \G skip remaining source file
>     source-id dup 0<> IF            \  **** basically changed 0> to 0<>
> 
> >r r@ file-size throw r> reposition-file throw
> 
> BEGIN  refill 0= UNTIL  postpone \  THEN ; immediate
> 
> The \\\ word now skips to the end of the file so is this a bug and the
> solution is 0<> not 0>  or am i wrong!

Source ID -1 is for evaluate, 0 for terminal input and everything else is a 
file.  So it should be

dup 1+ 2 u>= IF

-- 
Bernd Paysan
"If you want it done right, you have to do it yourself"
net2o ID: kQusJzA;address@hidden(dQ*
http://bernd-paysan.de/



reply via email to

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