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;7*?t=uy@X}1GWr!+0qqp_Cn176t4(dQ* http://bernd-paysan.de/
