Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.forth > #132093

Re: Using include-file

From Gerry Jackson <do-not-use@swldwa.uk>
Newsgroups comp.lang.forth
Subject Re: Using include-file
Date 2024-09-04 11:09 +0100
Organization A noiseless patient Spider
Message-ID <vb9bkr$3pdr2$2@dont-email.me> (permalink)
References <vb565d$2vcqf$1@dont-email.me> <vb9ap7$3pdr2$1@dont-email.me>

Show all headers | View raw


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

Back to comp.lang.forth | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Using include-file Ruvim <ruvim.pinka@gmail.com> - 2024-09-03 00:11 +0400
  Re: Using include-file mhx@iae.nl (mhx) - 2024-09-02 21:22 +0000
    Re: Using include-file mhx@iae.nl (mhx) - 2024-09-03 05:38 +0000
      Re: Using include-file rt4all@hetnet.nl (rt) - 2024-11-09 08:29 +0000
        Re: Using include-file mhx@iae.nl (mhx) - 2024-11-09 12:06 +0000
          Re: Using include-file Stephen Pelc <stephen@vfxforth.com> - 2024-11-09 18:13 +0000
            Re: Using include-file dxf <dxforth@gmail.com> - 2024-11-10 13:54 +1100
          Re: Using include-file rt4all@hetnet.nl (rt) - 2024-11-10 13:47 +0000
  Re: Using include-file anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2024-09-03 06:50 +0000
    Re: Using include-file albert@spenarnc.xs4all.nl - 2024-09-03 10:23 +0200
      Re: Using include-file mhx@iae.nl (mhx) - 2024-09-03 11:54 +0000
        Re: Using include-file sjack@dontemail.me (sjack) - 2024-09-03 15:28 +0000
          Re: Using include-file dxf <dxforth@gmail.com> - 2024-09-04 11:36 +1000
      Re: Using include-file dxf <dxforth@gmail.com> - 2024-09-04 16:44 +1000
    Re: Using include-file Ruvim <ruvim.pinka@gmail.com> - 2024-09-03 23:07 +0400
      Re: Using include-file Ruvim <ruvim.pinka@gmail.com> - 2024-10-23 22:43 +0400
        Re: Using include-file anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2024-10-24 06:32 +0000
          Re: Using include-file albert@spenarnc.xs4all.nl - 2024-10-24 11:30 +0200
          Re: Using include-file Ruvim <ruvim.pinka@gmail.com> - 2024-10-26 09:19 +0400
  Re: Using include-file Gerry Jackson <do-not-use@swldwa.uk> - 2024-09-04 10:54 +0100
    Re: Using include-file Gerry Jackson <do-not-use@swldwa.uk> - 2024-09-04 11:09 +0100
  Re: Using include-file dxf <dxforth@gmail.com> - 2024-09-04 21:13 +1000
    Re: Using include-file Ruvim <ruvim.pinka@gmail.com> - 2024-09-17 18:33 +0400
  Re: Using include-file minforth@gmx.net (minforth) - 2024-10-24 12:44 +0000
    Re: Using include-file Ruvim <ruvim.pinka@gmail.com> - 2024-10-27 21:31 +0400
      Re: Using include-file minforth@gmx.net (minforth) - 2024-10-27 22:32 +0000

csiph-web