Re: Parsing text files with standard words
  Home FAQ Contact Sign in
comp.lang.forth only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.forth Profile…
 Up
Re: Parsing text files with standard words         


Author: The Beez'
Date: Sep 15, 2008 04:44

On Sep 14, 9:07 pm, Gerry jackson9000.fsnet.co.uk> wrote:
> FILE-SOURCE ( fileid -- ) is like INCLUDE-FILE but does not
> invoke the Forth text interpreter i.e. it saves the current
> input source specification and makes the file specified by
> fileid the new input source. Hence REFILL can be used to read
> the file from the file position existing at the time FILE-SOURCE
> is called.
>
> CLOSE-SOURCE ( -- ) simply closes the current input source and
> restores the previous one.
>
> These solve the problem as far as I am concerned but can't be
> defined in a standard way (I think). A simple example of usage
> showing how standard words such as REFILL and SOURCE could be
> used to process a file:
>
> : xyz  ( caddr u -- )
>    r/o open-file throw file-source cr
>    begin refill while source type cr repeat
>    close-source ...
Show full article (1.58Kb)
1 Comment
Re: Parsing text files with standard words         


Author: Gerry
Date: Sep 15, 2008 05:26

On 15 Sep, 12:44, "The Beez'" bigfoot.com> wrote:
> On Sep 14, 9:07 pm, Gerry jackson9000.fsnet.co.uk> wrote:
>
>
>
>> FILE-SOURCE ( fileid -- ) is like INCLUDE-FILE but does not
>> invoke the Forth text interpreter i.e. it saves the current
>> input source specification and makes the file specified by
>> fileid the new input source. Hence REFILL can be used to read
>> the file from the file position existing at the time FILE-SOURCE
>> is called.
>
>> CLOSE-SOURCE ( -- ) simply closes the current input source and
>> restores the previous one.
>
>> These solve the problem as far as I am concerned but can't be
>> defined in a standard way (I think). A simple example of usage
>> showing how standard words such as REFILL and SOURCE could be
>> used to process a file:
> ...
Show full article (1.80Kb)
no comments