Re: Using include-file

Liste des GroupesRevenir à cl forth 
Sujet : Re: Using include-file
De : do-not-use (at) *nospam* swldwa.uk (Gerry Jackson)
Groupes : comp.lang.forth
Date : 04. Sep 2024, 11:09:32
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vb9bkr$3pdr2$2@dont-email.me>
References : 1 2
User-Agent : Mozilla Thunderbird
On 04/09/2024 10:54, Gerry Jackson wrote:
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.
 
I've just seen that Anton has suggested this as a possible use of OPEN-FILE
--
Gerry

Date Sujet#  Auteur
2 Sep 24 * Using include-file26Ruvim
2 Sep 24 +* Re: Using include-file7mhx
3 Sep 24 i`* Re: Using include-file6mhx
9 Nov 24 i `* Re: Using include-file5rt
9 Nov 24 i  `* Re: Using include-file4mhx
9 Nov 24 i   +* Re: Using include-file2Stephen Pelc
10 Nov 24 i   i`- Re: Using include-file1dxf
10 Nov 24 i   `- Re: Using include-file1rt
3 Sep 24 +* Re: Using include-file11Anton Ertl
3 Sep 24 i+* Re: Using include-file5albert
3 Sep 24 ii+* Re: Using include-file3mhx
3 Sep 24 iii`* Re: Using include-file2sjack
4 Sep 24 iii `- Re: Using include-file1dxf
4 Sep 24 ii`- Re: Using include-file1dxf
3 Sep 24 i`* Re: Using include-file5Ruvim
23 Oct 24 i `* Re: Using include-file4Ruvim
24 Oct 24 i  `* Re: Using include-file3Anton Ertl
24 Oct 24 i   +- Re: Using include-file1albert
26 Oct 24 i   `- Re: Using include-file1Ruvim
4 Sep 24 +* Re: Using include-file2Gerry Jackson
4 Sep 24 i`- Re: Using include-file1Gerry Jackson
4 Sep 24 +* Re: Using include-file2dxf
17 Sep 24 i`- Re: Using include-file1Ruvim
24 Oct 24 `* Re: Using include-file3minforth
27 Oct 24  `* Re: Using include-file2Ruvim
27 Oct 24   `- Re: Using include-file1minforth

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal