You can add your own initialization to the startup sequence through the deferred word
'cold-- gforth ``tick-cold''
'cold is invoked just before the image-specific command line
processing (by default, loading files and evaluating (
A sequence for adding your initialization usually looks like this:
:noname Defers 'cold \ do other initialization stuff (e.g., rehashing wordlists) ... \ your stuff ; IS 'cold
You can make a turnkey image by letting
'cold execute a word
(your turnkey application) that never returns; instead, it exits Gforth
You can access the (image-specific) command-line arguments through the
arg provides conventient
argc-- addr gforth ``argc''
contains the number of command-line arguments (including the command name)
argv-- addr gforth ``argv''
contains a pointer to a vector of pointers to the command-line arguments (including the command-name). Each argument is represented as a C-style string.
argn -- addr count gforth ``arg''
returns the string for the nth command-line argument.
'cold exits normally, Gforth processes the command-line
arguments as files to be loaded and strings to be evaluated. Therefore,
'cold should remove the arguments it has used in this case.
Go to the first, previous, next, last section, table of contents.