Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

If you're not careful, you're going to catch something.


devel / comp.lang.forth / SAVE-SYSTEM scripting and compilation to an executable

SubjectAuthor
o SAVE-SYSTEM scripting and compilation to an executablenone

1
SAVE-SYSTEM scripting and compilation to an executable

<nnd$44f3add4$70d76a64@4eeb5e3c821c2785>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=24749&group=comp.lang.forth#24749

  copy link   Newsgroups: comp.lang.forth
Newsgroups: comp.lang.forth
Subject: SAVE-SYSTEM scripting and compilation to an executable
X-Newsreader: trn 4.0-test77 (Sep 1, 2010)
From: albert@cherry (none)
Originator: albert@cherry.(none) (albert)
Message-ID: <nnd$44f3add4$70d76a64@4eeb5e3c821c2785>
Organization: KPN B.V.
Date: Sat, 30 Sep 2023 14:37:22 +0200
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.ams4!peer.am4.highwinds-media.com!news.highwinds-media.com!feed.abavia.com!abe004.abavia.com!abp001.abavia.com!news.kpn.nl!not-for-mail
Lines: 68
Injection-Date: Sat, 30 Sep 2023 14:37:22 +0200
Injection-Info: news.kpn.nl; mail-complaints-to="abuse@kpn.com"
X-Received-Bytes: 2694
 by: none - Sat, 30 Sep 2023 12:37 UTC

As is well known you can run scripts by lina/wina/ciforth

This is a script:

------------ 8< ----- hello.sh ------------------
#!./lina -s
"hello world" CR
------------ 8< -----------------------
chmod +x hello.sh
`` hello.sh '' invokes this script.

------------ 8< ----- withfp.sh --------------
#!./lina -s
WANT -fpwa- SAVE-SYSTEM
"lina+fp" SAVE-SYSTEM
------------ 8< ------------------------------
chmod +x withfp.sh

This generates a `` lina+fp '' with all the floating point facilities
available. We use -fpwa- instead of -fp-. The assembler that is needed
is loaded in a temporary buffer and discarded before the SAVE-SYSTEM.

lina+fp is a full blown Forth that interprets all options:

------------ 8< ----- sqrt.sh --------------
#!./lina+fp -s
1 ARG[] EVALUATE FSQRT FS. CR
------------ 8< ----- sqrt.sh --------------
chmod +x sqrt.sh

~/PROJECT/ciforths: sqrt.sh 2.0E0
SCRIPT-NAME : ISN'T UNIQUE
BY-WHO : ISN'T UNIQUE
MY-ERROR : ISN'T UNIQUE
1.414213562373095048E0

You see that the script-facility is loaded again.
If the UNIQUE message bothers you, you can add:

------------ 8< ----- withfp.sh --------------
#!./lina -s
WANT -fpwa- SAVE-SYSTEM
'SCRIPT-NAME HIDDEN
'BY-WHO HIDDEN
'MY-ERROR HIDDEN
"lina+fp" SAVE-SYSTEM
------------ 8< ------------------------------
chmod +x withfp.sh

The -c option generates elf executables as usual:
------------ 8< --- sqrt.frt -----------------
: main 1 ARG[] EVALUATE FSQRT FS. CR ;
------------ 8< ------------------------------

~/PROJECT/ciforths: lina+fp -c sqrt.frt
~/PROJECT/ciforths: sqrt 2.0E
1.414213562373095048E0

You probably don't trade your favorite forth for ciforth, but
maybe you feel inspired.

Groetjes Albert
--
Don't praise the day before the evening. One swallow doesn't make spring.
You must not say "hey" before you have crossed the bridge. Don't sell the
hide of the bear until you shot it. Better one bird in the hand than ten in
the air. First gain is a cat spinning. - the Wise from Antrim -

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor