www.delorie.com/gnu/docs/gforth/gforth_251.html   search  
 
Buy GNU books!


Gforth Manual

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

13.8 Modifying the Startup Sequence

You can add your own initialization to the startup sequence through the deferred word 'cold. 'cold is invoked just before the image-specific command line processing (i.e., loading files and evaluating (-e) strings) starts.

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 via bye or throw.

You can access the (image-specific) command-line arguments through the variables argc and argv. arg provides convenient access to argv.

If '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.

doc-'cold doc-argc doc-argv doc-arg


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003