Do you know practical cases of using "include-file" in programs?
Using other system-specific means, this word can probably be used to
organize inter-process communication: when a file descriptor (e.g. a
pipe) is passed from one process to another and used as the input
source. But why do you need to load Forth code this way?
On Mon, 2 Sep 2024 20:11:25 +0000, Ruvim wrote:
Do you know practical cases of using "include-file" in programs?[..]
Do you know practical cases of using "include-file" in programs?
Using other system-specific means, this word can probably be used to >organize inter-process communication: when a file descriptor (e.g. a
pipe) is passed from one process to another and used as the input
source. But why do you need to load Forth code this way?
Ruvim <[email protected]> writes:
Do you know practical cases of using "include-file" in programs?
One way I am thinking about is to implement INCLUDED etc. Systems
deal differently with relative filenames for INCLUDED, with less
differences for OPEN-FILE. So if I want to implement a certain
handling of relative filenames for INCLUDED in order to get rid of
system differences, one way to do it is to do it for OPEN-FILE and
then perform INCLUDE-FILE.
Using other system-specific means, this word can probably be used to >>organize inter-process communication: when a file descriptor (e.g. a
pipe) is passed from one process to another and used as the input
source. But why do you need to load Forth code this way?
Heinz Schnitter implemented Open Network Forth, a distributed system,
where the parts communicated by sending Forth source code to each
other. One could implement that by having network connections
(telnet-style or ssh-style) between the parts, and the receiver could >INCLUDE-FILE the file-id that represents his end of the connection.
However, Open Network Forth was written around 1984, long before
INCLUDE-FILE was standardized. Bernd Paysan uses ideas from it in his
work, inclluding sending Forth commands between tasks, but AFAIK does
not use INCLUDE-FILE for that.
- anton
off-topic:
Your SIG. Is Novabbs injecting ads, or is this a joke that
Ruvim <[email protected]> writes:
Do you know practical cases of using "include-file" in programs?
One way I am thinking about is to implement INCLUDED etc. Systems
deal differently with relative filenames for INCLUDED, with less
differences for OPEN-FILE. So if I want to implement a certain
handling of relative filenames for INCLUDED in order to get rid of
system differences, one way to do it is to do it for OPEN-FILE and
then perform INCLUDE-FILE.
Using other system-specific means, this word can probably be used to
organize inter-process communication: when a file descriptor (e.g. a
pipe) is passed from one process to another and used as the input
source. But why do you need to load Forth code this way?
Heinz Schnitter implemented Open Network Forth, a distributed system,
where the parts communicated by sending Forth source code to each
other. One could implement that by having network connections
(telnet-style or ssh-style) between the parts, and the receiver could INCLUDE-FILE the file-id that represents his end of the connection.
However, Open Network Forth was written around 1984, long before
INCLUDE-FILE was standardized. Bernd Paysan uses ideas from it in his
work, inclluding sending Forth commands between tasks, but AFAIK does
not use INCLUDE-FILE for that.
mhx <[email protected]> wrote:
off-topic:
Your SIG. Is Novabbs injecting ads, or is this a joke that
Perhaps it's the client, which the user should have some control.
In my client if signature is configured to point to a directory,
it will pull from there a random file to get text for the
signature.
...
In other words. The use of INCLUDE-FILE in the wild has never been
seen, except for a factor of INCLUDE.
Do you know practical cases of using "include-file" in programs?
I can't imagine how this word could be used in standard programs.
Only one idea: to skip BOM (byte-order mark) before include the file contents.
Using other system-specific means, this word can probably be used to organize inter-process communication: when a file descriptor (e.g. a
pipe) is passed from one process to another and used as the input
source. But why do you need to load Forth code this way?
On 02/09/2024 21:11, Ruvim wrote:
Do you know practical cases of using "include-file" in programs?
I can't imagine how this word could be used in standard programs.
Only one idea: to skip BOM (byte-order mark) before include the file
contents.
Using other system-specific means, this word can probably be used to
organize inter-process communication: when a file descriptor (e.g. a
pipe) is passed from one process to another and used as the input
source. But why do you need to load Forth code this way?
I've used it to redefine INCLUDED
: included ( ... caddr u -- ... )
r/o open-path-file throw include-file
;
where OPEN-PATH-FILE takes a string specifying a list of alternative relative paths to Forth source files which it tries in turn to open. It
does this by creating an absolute directory path and calls OPEN-FILE. If
an open succeeds it returns the file-id to be included by INCLUDE-FILE.
If no relative path succeeds an exception is thrown.
I've used it to test a program on several different Forth systems, each
of which has its own way of handling relative directory paths but they
all work with an absolute path.
Do you know practical cases of using "include-file" in programs?
I can't imagine how this word could be used in standard programs.
...
On 3/09/2024 6:11 am, Ruvim wrote:
Do you know practical cases of using "include-file" in programs?
I can't imagine how this word could be used in standard programs.
...
Here's a question. Is there a temporal dependency on the 'fileid' passed
to INCLUDE-FILE ?
On my system 'fileid' for INCLUDE-FILE would need to represent the most recently opened file. Otherwise should a compilation error occur the wrong statistics e.g. file-name will be printed.
AFAICS ANS only guarantees the contents of a file represented by 'fileid'. The issue of filenames - if/when/how they're stored - is a detail left to the implementer. It's no problem for INCLUDED which binds opening of the file with compilation. However INCLUDE-FILE potentially separates these two.
On 2024-09-03 10:50, Anton Ertl wrote:
Ruvim <[email protected]> writes:
Do you know practical cases of using "include-file" in programs?
One way I am thinking about is to implement INCLUDED etc. Systems
deal differently with relative filenames for INCLUDED, with less
differences for OPEN-FILE. So if I want to implement a certain
handling of relative filenames for INCLUDED in order to get rid of
system differences, one way to do it is to do it for OPEN-FILE and
then perform INCLUDE-FILE.
Yes, overriding the system's file search mechanism used by "included" is
a very interesting idea!
Also, `REQUIRED` does not load a file that was loaded by `INCLUDED`. >`INCLUDE-FILE` is free of that too.
Ruvim <[email protected]> writes:
Also, `REQUIRED` does not load a file that was loaded by `INCLUDED`. >>`INCLUDE-FILE` is free of that too.
Yes, but why would anyone use REQUIRED or REQUIRE on a file that he
intends to include even if it has been INCLUDED before?
- anton--
--
M. Anton Ertl http://www.complang.tuwien.ac.at/anton/home.html >comp.lang.forth FAQs: http://www.complang.tuwien.ac.at/forth/faq/toc.html
New standard: https://forth-standard.org/
EuroForth 2024: https://euro.theforth.net
Do you know practical cases of using "include-file" in programs?
Ruvim <[email protected]> writes:
Also, `REQUIRED` does not load a file that was loaded by `INCLUDED`.
`INCLUDE-FILE` is free of that too.
Yes, but why would anyone use REQUIRED or REQUIRE on a file that he
intends to include even if it has been INCLUDED before?
On Mon, 2 Sep 2024 20:11:25 +0000, Ruvim wrote:
Do you know practical cases of using "include-file" in programs?
I remember a script for reading csv data files with INCLUDE-FILE.
The interpreter (parser) was slightly modified for this.
Hi Marcel, the Mac Cocoa interface for i4 uses INCLUDE-FILE
to deal with code pasted in the OS clipboard. BTW same for
VFX and VFX64. I needed a portable/standard word, 'et voila'.
I don't receive VFX updates anymore (I probably said something
offensive), so can't try.
On 9 Nov 2024 at 13:06:19 CET, "mhx" <mhx> wrote:
I don't receive VFX updates anymore (I probably said something
offensive), so can't try.
Now that all products are freely downloadable for non-commercial use,
all you need to do is to download the latest versions from:
https://vfxforth.com/downloads/VfxCommunity/
Stephen
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 991 |
Nodes: | 10 (0 / 10) |
Uptime: | 00:32:11 |
Calls: | 12,940 |
Files: | 186,574 |
Messages: | 3,262,554 |