Gerry said:
> To handle text from different types of input sources ANS Forth
> provides various words such as SOURCE SOURCE-ID REFILL >IN PARSE
> WORD SAVE-INPUT RESTORE-INPUT and the Forth 200X PARSE-NAME. In
> addition other parsing words such as CREATE ' etc work on the
> current input source.
>
> Many applications use the File-Access word set to handle text
> files and, having opened a file, can't immediately use words
> such as REFILL on that file. This is because the words ANS Forth
> provides for opening new input sources (INCLUDE-FILE and
> INCLUDED for files, EVALUATE for strings and LOAD for blocks)
> also invoke the Forth text interpreter. An unfortunate effect
> of this is that the application loses control to the system.
The big downside to this proposal is that it is a point solution
to a general problem. When it was proposed on c.l.f. I could not
define my real objections. One of my considerations was why we
(MPE) have not been asked for such a mechanism. The reason is
that we use a different I/O model.
We use what we call Generic I/O - a device is hidden behind an
opaque type that corresponds to a file handle. I really do not
want to have to create a raft of words such as SERIAL-SOURCE
(e.g. for Telnet) and WINDOW-SOURCE (e.g. for data entry). The
general problem is that of selecting the current input and
output, whether file or any other device.
In the Generic I/O world, a task just says which device the
input is to come from and all I/O words adjust automagically. I
have hesitated to issue such a proposal because it would
inevitably break many systems and require major internal changes
to them. However, I believe that Generic I/O of some form is the
correct solution to the problem addressed here.
In addition MPE Forths use the return stack for saving the
result of SAVE-INPUT.
Stephen
--
Stephen Pelc, stephen@...
MicroProcessor Engineering Ltd - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, fax: +44 (0)23 8033 9691
web: http://www.mpeforth.com - free VFX Forth downloads