| @node Invocation, Words, Other Books, Top |
@node Invocation, Words, Other Books, Top |
| @chapter Invocation |
@chapter Invocation |
| |
|
| You will usually just say @code{gforth}. More generally, the default GNU |
You will usually just say @code{gforth}. In many other cases the default |
| Forth image can be invoked like this |
GNU Forth image will be invoked like this: |
| |
|
| @example |
@example |
| gforth [--batch] [files] [-e forth-code] |
gforth [files] [-e forth-code] |
| @end example |
@end example |
| |
|
| The @code{--batch} option makes @code{gforth} exit after processing the |
executing the contents of the files and the Forth code in the order they |
| command line. Also, the startup message is suppressed. @file{files} are |
are given. |
| Forth source files that are executed in the order in which they |
|
| appear. The @code{-e @samp{forth-code}} or @code{--evaluate |
In general, the command line looks like this: |
| @samp{forth-code}} option evaluates the forth code; it can be freely |
|
| mixed with the files. This option takes only one argument; if you want |
@example |
| to evaluate more Forth words, you have to quote them or use several |
gforth [initialization options] [image-specific options] |
| @code{-e}s. !! option for suppressing default loading. |
@end example |
| |
|
| You can use the command line option @code{-i @samp{file}} or |
The initialization options must come before the rest of the command |
| @code{--image-file @samp{file}} to specify a different image file. Note |
line. They are: |
| that this option must be the first in the command line. The rest of the |
|
| command line is processed by the image file. |
@table @code |
| |
@item --image-file @samp{file} |
| If the @code{--image-file} option is not used, GNU Forth searches for a |
Loads the Forth image @samp{file} instead of the default |
| file named @file{gforth.fi} in the path specified by the environment |
@file{gforth.fi}. |
| variable @code{GFORTHPATH}; if this does not exist, in |
|
| @file{/usr/local/lib/gforth} and in @file{/usr/lib/gforth}. |
@item --path @samp{path} |
| |
Uses @samp{path} for searching the image file and Forth source code |
| |
files instead of the default in the environment variable |
| |
@code{GFORTHPATH} or the path specified at installation time (typically |
| |
@file{/usr/local/lib/gforth:.}). A path is given as a @code{:}-separated |
| |
list. |
| |
|
| |
@item --dictionary-size @samp{size} |
| |
@item -m @samp{size} |
| |
Allocate @samp{size} space for the Forth dictionary space instead of |
| |
using the default specified in the image (typically 256K). The |
| |
@samp{size} specification consists of an integer and a unit (e.g., |
| |
@code{4M}). The unit can be one of @code{b} (bytes), @code{e} (element |
| |
size, in this case Cells), @code{k} (kilobytes), and @code{M} |
| |
(Megabytes). If no unit is specified, @code{e} is used. |
| |
|
| |
@item --data-stack-size @samp{size} |
| |
@item -d @samp{size} |
| |
Allocate @samp{size} space for the data stack instead of using the |
| |
default specified in the image (typically 16K). |
| |
|
| |
@item --return-stack-size @samp{size} |
| |
@item -r @samp{size} |
| |
Allocate @samp{size} space for the return stack instead of using the |
| |
default specified in the image (typically 16K). |
| |
|
| |
@item --fp-stack-size @samp{size} |
| |
@item -f @samp{size} |
| |
Allocate @samp{size} space for the floating point stack instead of |
| |
using the default specified in the image (typically 16K). In this case |
| |
the unit specifier @code{e} refers to floating point numbers. |
| |
|
| |
@item --locals-stack-size @samp{size} |
| |
@item -l @samp{size} |
| |
Allocate @samp{size} space for the locals stack instead of using the |
| |
default specified in the image (typically 16K). |
| |
|
| |
@end table |
| |
|
| |
As explained above, the image-specific command-line arguments for the |
| |
default image @file{gforth.fi} consist of a sequence of filenames and |
| |
@code{-e @samp{forth-code}} options that are interpreted in the seqence |
| |
in which they are given. The @code{-e @samp{forth-code}} or |
| |
@code{--evaluate @samp{forth-code}} option evaluates the forth |
| |
code. This option takes only one argument; if you want to evaluate more |
| |
Forth words, you have to quote them or use several @code{-e}s. To exit |
| |
after processing the command line (instead of entering interactive mode) |
| |
append @code{-e bye} to the command line. |
| |
|
| |
Not yet implemented: |
| |
On startup the system first executes the system initialization file |
| |
(unless the option @code{--no-init-file} is given; note that the system |
| |
resulting from using this option may not be ANS Forth conformant). Then |
| |
the user initialization file @file{.gforth.fs} is executed, unless the |
| |
option @code{--no-rc} is given; this file is first searched in @file{.}, |
| |
then in @file{~}, then in the path given by the normal path (see below). |
| |
|
| @node Words, , Invocation, Top |
@node Words, , Invocation, Top |
| @chapter Forth Words |
@chapter Forth Words |