Next: Where are locals visible by name?, Previous: Gforth locals, Up: Gforth locals [Contents][Index]
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.6 “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.6 “open-brace”
Start locals definitions. The Forth-2012 standard name for this
word is {:.
} ( hmaddr u latest latestnt wid 0 xt1 ... xtn – ) gforth-0.6 “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.6 “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.6 “w-caret”
Define variable-flavoured cell local name ( -- a-addr )
D: ( compilation "name" – a-addr xt; run-time x1 x2 – ) gforth-0.6 “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.6 “d-caret”
Define variable-flavoured double local name ( -- a-addr )
C: ( compilation "name" – a-addr xt; run-time c – ) gforth-0.6 “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.6 “c-caret”
Define variable-flavoured char local name ( -- c-addr )
F: ( compilation "name" – a-addr xt; run-time r – ) gforth-0.6 “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.6 “f-caret”
Define variable-flavoured float local name ( -- f-addr )
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.
Next: Where are locals visible by name?, Previous: Gforth locals, Up: Gforth locals [Contents][Index]