home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.forth      Forth programmers eat a lot of Bratwurst      117,951 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 116,707 of 117,951   
   Gerry Jackson to Ruvim   
   Re: Using include-file   
   04 Sep 24 10:54:48   
   
   From: do-not-use@swldwa.uk   
      
   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.   
      
   --   
   Gerry   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca