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 latest latestnt wid 0 ) local-ext “open-brace-colon”
Start locals definitions.
--
( hmaddr u latest latestnt wid 0 ... – ) gforth-0.2 “dash-dash”
During locals definitions 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.
|
( – ) gforth-1.0 “bar”
Locals defined behind |
are not initialized from the
stack; so the run-time of words like W:
changes to
( -- )
.
:}
( hmaddr u latest latestnt wid 0 xt1 ... xtn – ) gforth-1.0 “colon-close-brace”
Ends locals definitions.
{
( – hmaddr u latest latestnt wid 0 ) gforth-0.2 “open-brace”
Start locals definitions. The Forth-2012 standard name for this
word is {:
.
}
( hmaddr u latest latestnt 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 )
WA:
( compilation "name" – a-addr xt; run-time x – ) gforth-1.0 “w-a-colon”
Define varue-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 )
DA:
( compilation "name" – a-addr xt; run-time x1 x2 – ) gforth-1.0 “w-a-colon”
Define varue-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 )
CA:
( compilation "name" – a-addr xt; run-time c – ) gforth-1.0 “c-a-colon”
Define varue-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 )
FA:
( compilation "name" – a-addr xt; run-time f – ) gforth-1.0 “f-a-colon”
Define varue-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 )
za:
( compilation "name" – a-addr xt; run-time z – ) gforth-1.0 “z-a-colon”
Define varue-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 ( ... -- ... )
XTA:
( compilation "name" – a-addr xt; run-time ... – ... ) gforth-1.0 “x-t-a-colon”
Define a defer-flavoured local name on which addr
can be used.
Note that |
, --
, :}
and }
are not
normally in the search order (they are in the vocabulary
locals-types
), and they are not necessarily words in all Forth
systems; therefore they are documented as Gforth words.