In article <
332b84e4-3e3d-426c...@googlegroups.com>,
<
make....@gmail.com> wrote:
>Hi all,
>I'm a "old" hobby programmer (windows) and i try to write a tcl-pkg (in c with poor knowlege) to use forth in tcl/tk. The goal is to generate a minimal tclkit (bundle all relevants programms, tools etc. in one execute file) --> Less is more
>
>I found several forth implementations in c wich i can use to create the package and that works fine. Most of the have system function to save an image of the memory to file to use later the last state of forth working environment.
>
>But inside forth i want to save the working environment with a new standalone execute file like as:
>
>on command prompt:
> xyz_forth.exe -f core.fth (minimal forth words in forth language)
> inside xyz_forth:
> : test 1 1 + . ;
>(and now) fsave new_forth.exe
> bye
In ciforth this is (for windows)
"
wina.exe (Now you have a minimum system)
1 LOAD (get library mechanism)
WANT SAVE-SYSTEM ( get a tool from the library)
: test 1 1 + . ; (still inside wina.exe)
"newforth.exe" SAVE-SYSTEM
BYE
"
You can also abuse the compiler mechanism, defeating error handling for
turnkey systems by just starting the interpreter (QUIT) as the turnkey
command.
-------------- newforth.frt ------
: test 1 1 + . ;
: main 'ERROR RESTORED 'OK RESTORED QUIT ;
-------------------------------------------
then
wina -c newforth.frt ( generates newforth.exe)
This has the advantage that the -c option (through carnal
trickery) avoids that the SAVE-SYSTEM stuff remains in the
executable.
>
>now on command prompt:
> new_forth.exe
> inside new_forth:
> test (--> output 2)
> bye
>
You can send the newforth.exe as a single file through e-mail
to your mother and she can do the above.
This "just works" (tm).
All tools in ciforth are made to work properly after SAVE-SYSTEM, 1]
e.g after WANT ALLOCATE and using ALLOCATE all allocated stuff
is accessable and you can go on allocating and freeing.
AMDX86 ciforth beta $RCSfile: ci86.gnr,v $ $Revision: 5.140 $
DSP@ .
8394850304 OK
1 LOAD WANT ALLOCATE
OK
100 ALLOCATE CONSTANT AAP
OK
WANT SAVE-SYSTEM
OK
"q" SAVE-SYSTEM
OK
BYE
As you see 8 gbyte is available within this Forth,
and a quarter is taken by the heap as soon as you load the
ALLOCATE mechanism.
~/PROJECT/ciforth$ ls -l q
-rwxr-xr-x 1 albert albert
2097712480 Dec 7 15:48 q
~/PROJECT/ciforth$
So the executable q is huge too.
<SNIP>
>
>thanks a lot and greetings - kmatze
>
Groetjes Albert
1] With the exception of multitasking
--
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&
c.xs4all.nl &=n
http://home.hccnet.nl/a.w.m.van.der.horst