version 1.37, 1996/09/30 13:16:09
|
version 1.40, 1996/11/11 16:59:16
|
Line 86 personal machines. This manual correspon
|
Line 86 personal machines. This manual correspon
|
* Other Books:: Things you might want to read |
* Other Books:: Things you might want to read |
* Invocation:: Starting Gforth |
* Invocation:: Starting Gforth |
* Words:: Forth words available in Gforth |
* Words:: Forth words available in Gforth |
|
* Tools:: Programming tools |
* ANS conformance:: Implementation-defined options etc. |
* ANS conformance:: Implementation-defined options etc. |
* Model:: The abstract machine of Gforth |
* Model:: The abstract machine of Gforth |
* Integrating Gforth:: Forth as scripting language for applications. |
* Integrating Gforth:: Forth as scripting language for applications. |
Line 600 Loads the Forth image @var{file} instead
|
Line 601 Loads the Forth image @var{file} instead
|
|
|
@item --path @var{path} |
@item --path @var{path} |
@item -p @var{path} |
@item -p @var{path} |
Uses @var{path} for searching the image file and Forth source code |
Uses @var{path} for searching the image file and Forth source code files |
files instead of the default in the environment variable |
instead of the default in the environment variable @code{GFORTHPATH} or |
@code{GFORTHPATH} or the path specified at installation time (typically |
the path specified at installation time (e.g., |
@file{/usr/local/lib/gforth:.}). A path is given as a @code{:}-separated |
@file{/usr/local/share/gforth/0.2.0:.}). A path is given as a list of |
list. |
directories, separated by @samp{:} (on Unix) or @samp{;} (on other OSs). |
|
|
@item --dictionary-size @var{size} |
@item --dictionary-size @var{size} |
@item -m @var{size} |
@item -m @var{size} |
Line 662 the user initialization file @file{.gfor
|
Line 663 the user initialization file @file{.gfor
|
option @code{--no-rc} is given; this file is first searched in @file{.}, |
option @code{--no-rc} is given; this file is first searched in @file{.}, |
then in @file{~}, then in the normal path (see above). |
then in @file{~}, then in the normal path (see above). |
|
|
@node Words, ANS conformance, Invocation, Top |
@node Words, Tools, Invocation, Top |
@chapter Forth Words |
@chapter Forth Words |
|
|
@menu |
@menu |
Line 2414 by the represented compilation semantics
|
Line 2415 by the represented compilation semantics
|
doc-[comp'] |
doc-[comp'] |
doc-comp' |
doc-comp' |
|
|
|
You can compile the compilation semantics with @code{postpone,}. I.e., |
|
@code{COMP' @var{word} POSTPONE,} is equivalent to @code{POSTPONE |
|
@var{word}}. |
|
|
|
doc-postpone, |
|
|
At present, the @var{w} part of a compilation token is an execution |
At present, the @var{w} part of a compilation token is an execution |
token, and the @var{xt} part represents either @code{execute} or |
token, and the @var{xt} part represents either @code{execute} or |
@code{compile,}. However, don't rely on that kowledge, unless necessary; |
@code{compile,}. However, don't rely on that kowledge, unless necessary; |
Line 2546 probably more appropriate than an assert
|
Line 2553 probably more appropriate than an assert
|
Gforth provides some words for defining primitives (words written in |
Gforth provides some words for defining primitives (words written in |
machine code), and for defining the the machine-code equivalent of |
machine code), and for defining the the machine-code equivalent of |
@code{DOES>}-based defining words. However, the machine-independent |
@code{DOES>}-based defining words. However, the machine-independent |
nature of Gforth poses a few problems: First of all. Gforth runs on |
nature of Gforth poses a few problems: First of all, Gforth runs on |
several architectures, so it can provide no standard assembler. What's |
several architectures, so it can provide no standard assembler. What's |
worse is that the register allocation not only depends on the processor, |
worse is that the register allocation not only depends on the processor, |
but also on the @code{gcc} version and options used. |
but also on the @code{gcc} version and options used. |
Line 2642 with @code{>DOES-CODE}. If the word was
|
Line 2649 with @code{>DOES-CODE}. If the word was
|
returned is different from 0 and identifies the @code{DOES>} used by the |
returned is different from 0 and identifies the @code{DOES>} used by the |
defining word. |
defining word. |
|
|
@node ANS conformance, Model, Words, Top |
@node Tools, ANS conformance, Words, Top |
|
@chapter Tools |
|
|
|
@menu |
|
* ANS Report:: Report the words used, sorted by wordset |
|
@end menu |
|
|
|
See also @ref{Emacs and Gforth}. |
|
|
|
@node ANS Report, , Tools, Tools |
|
@section @file{ans-report.fs}: Report the words used, sorted by wordset |
|
|
|
If you want to label a Forth program as ANS Forth Program, you must |
|
document which wordsets the program uses; for extension wordsets, it is |
|
helpful to list the words the program requires from these wordsets |
|
(because Forth systems are allowed to provide only some words of them). |
|
|
|
The @file{ans-report.fs} tool makes it easy for you to determine which |
|
words from which wordset and which non-ANS words your application |
|
uses. You simply have to include @file{ans-report.fs} before loading the |
|
program you want to check. After loading your program, you can get the |
|
report with @code{print-ans-report}. A typical use is to run this as |
|
batch job like this: |
|
@example |
|
gforth ans-report.fs myprog.fs -e "print-ans-report bye" |
|
@end example |
|
|
|
The output looks like this (for @file{compat/control.fs}): |
|
@example |
|
The program uses the following words |
|
from CORE : |
|
: POSTPONE THEN ; immediate ?dup IF 0= |
|
from BLOCK-EXT : |
|
\ |
|
from FILE : |
|
( |
|
@end example |
|
|
|
@subsection Caveats |
|
|
|
Note that @file{ans-report.fs} just checks which words are used, not whether |
|
they are used in an ANS Forth conforming way! |
|
|
|
Some words are defined in several wordsets in the |
|
standard. @file{ans-report.fs} reports them for only one of the |
|
wordsets, and not necessarily the one you expect. It depends on usage |
|
which wordset is the right one to specify. E.g., if you only use the |
|
compilation semantics of @code{S"}, it is a Core word; if you also use |
|
its interpretation semantics, it is a File word. |
|
|
|
|
|
@node ANS conformance, Model, Tools, Top |
@chapter ANS conformance |
@chapter ANS conformance |
|
|
To the best of our knowledge, Gforth is an |
To the best of our knowledge, Gforth is an |
Line 4207 relative Win32- NT eforth
|
Line 4265 relative Win32- NT eforth
|
time Gforth Forth Forth eforth +opt PFE Forth TILE |
time Gforth Forth Forth eforth +opt PFE Forth TILE |
sieve 1.00 1.39 1.14 1.39 0.85 1.58 3.18 8.58 |
sieve 1.00 1.39 1.14 1.39 0.85 1.58 3.18 8.58 |
bubble 1.00 1.31 1.41 1.48 0.88 1.50 3.88 |
bubble 1.00 1.31 1.41 1.48 0.88 1.50 3.88 |
matmul 1.00 1.47 1.35 1.46 1.16 1.58 4.09 |
matmul 1.00 1.47 1.35 1.46 0.74 1.58 4.09 |
fib 1.00 1.52 1.34 1.22 1.13 1.74 2.99 4.30 |
fib 1.00 1.52 1.34 1.22 0.86 1.74 2.99 4.30 |
@end example |
@end example |
|
|
You may find the good performance of Gforth compared with the systems |
You may find the good performance of Gforth compared with the systems |
Line 4281 with their continuous feedback. Lennart
|
Line 4339 with their continuous feedback. Lennart
|
@file{glosgen.fs}, while Stuart Ramsden has been working on automatic |
@file{glosgen.fs}, while Stuart Ramsden has been working on automatic |
support for calling C libraries. Helpful comments also came from Paul |
support for calling C libraries. Helpful comments also came from Paul |
Kleinrubatscher, Christian Pirker, Dirk Zoller, Marcel Hendrix, John |
Kleinrubatscher, Christian Pirker, Dirk Zoller, Marcel Hendrix, John |
Wavrik, Stott Bolton and Marc de Groot. |
Wavrik, Barrie Stott and Marc de Groot. |
|
|
Gforth also owes a lot to the authors of the tools we used (GCC, CVS, |
Gforth also owes a lot to the authors of the tools we used (GCC, CVS, |
and autoconf, among others), and to the creators of the Internet: Gforth |
and autoconf, among others), and to the creators of the Internet: Gforth |