Nп/п : 89 из 100
 От   : none) (albert                       2:5075/128        30 сен 23 14:37:22
 К    : All                                                   30 сен 23 15:41:04
 Тема : SAVE-SYSTEM scripting and compilation to an executable
----------------------------------------------------------------------------------
                                                                                 
@MSGID:
09fc925d
@REPLYADDR none) (albert
@REPLYTO 2:5075/128 none) (albert
@CHRS: CP866 2
@RFC: 1 0
@RFC-Message-ID:

@TZUTC: 0200
@TID: FIDOGATE-5.12-ge4e8b94
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 -
--- trn 4.0-test77 (Sep 1, 2010)
 * Origin: KPN B.V. (2:5075/128)
SEEN-BY: 5001/100 5005/49 5015/255 5019/40 5020/715
848 1042 4441 12000
SEEN-BY: 5030/49 1081 5058/104 5075/128
@PATH: 5075/128 5020/1042 4441



   GoldED+ VK   │                                                 │   09:55:30    
                                                                                
В этой области больше нет сообщений.

Остаться здесь
Перейти к списку сообщений
Перейти к списку эх