This section documents the words used for defining locals. Note that
the run-times for the words (like W:
) that define a local are
performed from the rightmost defined local to the leftmost defined
local, such that the rightmost local gets the top of stack.
{:
( – hmaddr u wid 0 ) local-ext “open-brace-colon”
Start locals definitions.
--
( hmaddr u wid 0 ... – ) locals-ext “dash-dash”
During a locals definitions with {:
everything from
--
to :}
is ignored. This is typically used
when you want to make a locals definition serve double duty as
a stack effect description.
|
( – ) locals-ext “bar”
Locals defined behind |
are not initialized from the
stack; so the run-time stack effect of the locals definitions
after |
is ( -- )
.
:}
( hmaddr u wid 0 xt1 ... xtn – ) gforth-1.0 “colon-close-brace”
Ends locals definitions.
{
( – hmaddr u wid 0 ) gforth-0.2 “open-brace”
Start locals definitions. The Forth-2012 standard name for this
word is {:
.
}
( hmaddr u wid 0 xt1 ... xtn – ) gforth-0.2 “close-brace”
Ends locals definitions. The Forth-2012 standard name for this
word is :}
.
W:
( compilation "name" – a-addr xt; run-time x – ) gforth-0.2 “w-colon”
Define value-flavoured cell local name ( -- x1 )
W^
( compilation "name" – a-addr xt; run-time x – ) gforth-0.2 “w-caret”
Define variable-flavoured cell local name ( -- a-addr )
D:
( compilation "name" – a-addr xt; run-time x1 x2 – ) gforth-0.2 “d-colon”
Define value-flavoured double local name ( -- x3 x4 )
D^
( compilation "name" – a-addr xt; run-time x1 x2 – ) gforth-0.2 “d-caret”
Define variable-flavoured double local name ( -- a-addr )
C:
( compilation "name" – a-addr xt; run-time c – ) gforth-0.2 “c-colon”
Define value-flavoured char local name ( -- c1 )
C^
( compilation "name" – a-addr xt; run-time c – ) gforth-0.2 “c-caret”
Define variable-flavoured char local name ( -- c-addr )
F:
( compilation "name" – a-addr xt; run-time r – ) gforth-0.2 “f-colon”
Define value-flavoured float local name ( -- r1 )
F^
( compilation "name" – a-addr xt; run-time r – ) gforth-0.2 “f-caret”
Define variable-flavoured float local name ( -- f-addr )
z:
( compilation "name" – a-addr xt; run-time z – ) gforth-1.0 “w-colon”
Define value-flavoured complex local name ( -- z1 )
XT:
( compilation "name" – a-addr xt; run-time xt1 – ) gforth-1.0 “x-t-colon”
Define defer-flavoured cell local name ( ... -- ... )
Note that |
, --
and :}
are not normally in the
search order (they are in the vocabulary locals-types
), and on
some Forth systems they may not even be words (and the standard
documents them under {:
, not as separate word). }
is
also in locals-types
.