Deutsch   English   Français   Italiano  
<acb9c2da96f73f53b88ecc583e95cf55@www.novabbs.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder9.news.weretis.net!i2pn.org!i2pn2.org!.POSTED!not-for-mail
From: mhx@iae.nl (mhx)
Newsgroups: comp.lang.forth
Subject: Re: Using include-file
Date: Mon, 2 Sep 2024 21:22:14 +0000
Organization: novaBBS
Message-ID: <acb9c2da96f73f53b88ecc583e95cf55@www.novabbs.com>
References: <vb565d$2vcqf$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org;
	logging-data="638858"; mail-complaints-to="usenet@i2pn2.org";
	posting-account="t0bSWFIQDvYvkkhDiPIIv6byulC6WbSEwXWMJpxc4k0";
User-Agent: Rocksolid Light
X-Rslight-Site: $2y$10$1Xacm1Qa/6bM8EaBP2N.B.0bM6W.ZDfFdzE8Z7kqOzEMaeo6l29cy
X-Rslight-Posting-User: 59549e76d0c3560fb37b97f0b9407a8c14054f24
X-Spam-Checker-Version: SpamAssassin 4.0.0
Bytes: 3207
Lines: 46

On Mon, 2 Sep 2024 20:11:25 +0000, Ruvim wrote:

> 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?

My SPICE simulator INCLUDE's pre-processed netlists.
A pre-processor takes (again, INCLUDE's) the industrial-standard
netlist and rewrites it to Forth.
One can also write the netlist directly using Forth, but not
every engineer is able or willing to do that.

Debugging is easy: the original netlist runs on standard SPICE
programs and its results can be compared directly to iSPICE's
output when it uses the pre-processed netlist.

The principle works for other applications too. Here some
examples from my dfwforth/include directory:

FORTH> grep "INCLUDE" /mnt/d/dfwforth/include/*.frt
/assemble.frt:319:               =ASM-NAME COUNT  INCLUDED
/backtrac.frt:132:       ['] INCLUDE-FILE OF
/dialogs.frt:116:        R> COUNT INCLUDED
/eplot.frt:777:          SWAP @ ?DUP IF COUNT INCLUDED ( header) ENDIF
/eplot.frt:796:          SWAP @ ?DUP IF COUNT INCLUDED ( header) ENDIF
/eplot.frt:819:          SWAP @ ?DUP IF COUNT INCLUDED ( header) ENDIF
/eplot.frt:838:          SWAP @+ SWAP >S  ?DUP IF COUNT INCLUDED ( head
/eplot.frt:882:          :headname @ ?DUP IF COUNT INCLUDED
/eplot.frt:895:          :dataname @ COUNT INCLUDED ;
/graphbench.frt:261:#63 #check [IF]      INCLUDE gtk3/benchmarks.frt [T
/iwords1.frt:4:CR .( FORTH.LOG : edit out garbage first, then INCLUDE i
/lprof.frt:357:\ Instead of INCLUDE name , IN name , S" name" INCLUDED
/lprof.frt:367:            S" !!!!!!!!.$$$" INCLUDED
/lprofile.frt:198:\ Instead of INCLUDE name , IN name , S" name" INCLUD
/lprofile.frt:207:               S" !!!!!!!!.$$$" INCLUDED ;
/playwav.frt:17:[IF]     INCLUDE pwavlinu.frt
/playwav.frt:21:[IF]     INCLUDE pwavlinu.frt
/playwav.frt:25:[IF]     INCLUDE pwavewin.frt
/runsteady.frt:620:             inpbuf #11 cnt MIN S" *| INCLUDE " COMP
/syssim.frt:772: EVAL" ANEW __syssim__" S" spf_model.frt" INCLUDED ;
/syssim.frt:812: CR ." SPF-INCLUDE   -- load spf_model.frt control/simu

-marcel