Output a newline (of the favourite kind of the host OS). Note
that due to the way the Forth command line interpreter inserts
newlines, the preferred way to use cr is at the start
of a piece of text; e.g., cr ." hello, world".
Display one space.
Display u spaces.
Addr contains a number that tries to give the position of
the cursor within the current line on the user output device: It
resets to 0 on cr, increases by the number of characters by
type and emit, and decreases on backspaces.
Unfortunately, it does not take into account tabs, multi-byte
characters, or the existence of Unicode characters with width 0 and
2, so it only works for simple cases.
Like .", but translates C-like \-escape-sequences (see
S\").
Compilation: Parse a string ccc delimited by a " (double quote). At run-time, display the string. Interpretation semantics for this word are undefined in standard Forth. Gforth’s interpretation semantics are to display the string.
Compilation and interpretation semantics: Parse a string ccc
delimited by a ) (right parenthesis). Display the
string. This is often used to display progress information during
compilation; see examples below.
If you don’t want to worry about whether to use .( hello) or
." hello", you can write "hello" type, which gives you
what you usually want (but is less portable to other Forth systems).
As an example, consider the following program:
.( text-1) \ prints "text-1" : my-word ." text-2" .( text-3) \ prints "text-3" "text-4" type ; my-word \ prints "text-2text-4" ." text-5" \ prints "text-5" "text-6" type \ prints "text-6"
If you want to understand why this code behaves this way, the explanations for this concrete example are:
text-1 and text-3 are displayed because
.( is an immediate word; it behaves in the same way whether it
is used inside or outside a colon definition (see Interpretation and Compilation Semantics).
text-2 is not displayed during the definition of
my-word, because the text interpreter performs the compilation
semantics for .". Later the interpretation semantics of
my-word are performed, and they perform the run-time semantics
of .".
text-4 is not displayed during the definition of
my-word, because "text-4" (see rec-string,
translate-string) performs the compiling run-time for the
string, which compiles the interpreting run-time (see Defining recognizers) into my-word, and type compiles the
interpretation/execution semantics of type into my-word.
Later the interpretation semantics of my-word are performed,
and they perform the compiled interpreting run-time and interpretation
semantics.
text-5 is displayed because of Gforth’s added interpretation
semantics for .".
text-6 is displayed because "text-6" type is
interpreted.