6.26.1.1 Locals definitions words

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 state 0  ) local-ext “open-brace-colon”

Start locals definitions.

-- ( hmaddr u wid 0 ... –  ) local-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.

| ( ) local-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 state 0 xt1 ... xtn –  ) gforth-0.2 “close-brace”

Ends locals definitions. The Forth-2012 standard name for this word is :}.

locals| ( ... "name ..." –  ) local-ext “locals-bar”

Don’t use ‘locals| this read can't you|’! Use {: you can read this :} instead.! A portable and free {: implementation can be found in compat/xlocals.fs.

W: ( compilation "name" – a-addr xt; run-time x –  ) gforth-0.2 “w-colon”

Define local name with the initial value x.
name execution: ( – x1 ) push the current value of name.
to name run-time: ( x2 – ) change the value of name to x2.
+to name run-time: ( n|u – ) increment the value of name by n|u.

W^ ( compilation "name" – a-addr xt; run-time x –  ) gforth-0.2 “w-caret”

Define local name, reserve a cell at a-addr, and store x there.
name execution: ( – a-addr ).

D: ( compilation "name" – a-addr xt; run-time x1 x2 –  ) gforth-0.2 “d-colon”

Define local name with the initial value x1 x2.
name execution: ( – x3 x4 ) push the current value of name.
to name run-time: ( x5 x6 – ) change the value of name to x5 x6.
+to name run-time: ( d|ud – ) increment the value of name by d|ud.

D^ ( compilation "name" – a-addr xt; run-time x1 x2 –  ) gforth-0.2 “d-caret”

Define local name, reserve two cells at a-addr, and store x1 x2 there.
name execution: ( – a-addr ).

C: ( compilation "name" – a-addr xt; run-time c –  ) gforth-0.2 “c-colon”

Define local name with the initial value c.
name execution: ( – c1 ) push the current value of name.
to name run-time: ( c2 – ) change the value of name to c2.
+to name run-time: ( n|u – ) increment the value of name by n|u.

C^ ( compilation "name" – a-addr xt; run-time c –  ) gforth-0.2 “c-caret”

Define local name, reserve a cell at c-addr, and store c there.
name execution: ( – c-addr ).

F: ( compilation "name" – a-addr xt; run-time r –  ) gforth-0.2 “f-colon”

Define local name with the initial value r.
name execution: ( – r1 ) push the current value of name.
to name run-time: ( r2 – ) change the value of name to r2.
+to name run-time: ( r3 – ) increment the value of name by r3.

F^ ( compilation "name" – a-addr xt; run-time r –  ) gforth-0.2 “f-caret”

Define local name, reserve a float at f-addr, and store r there.
name execution: ( – f-addr ).

Z: ( compilation "name" – a-addr xt; run-time r1 r2 –  ) gforth-1.0 “z-colon”

Define local name with the initial value r1 r2.
name execution: ( – r3 r4 ) push the current value of name.
to name run-time: ( r5 r6 – ) change the value of name to r5 r6.
+to name run-time: ( r7 r8 – ) increment the value of name by r7+r8i.

Z^ ( compilation "name" – a-addr xt; run-time r1 r2 –  ) gforth-1.0 “z-caret”

Define local name, reserve two floats at f-addr, and store r1 r2 there.
name execution: ( – f-addr ).

XT: ( compilation "name" – a-addr xt; run-time xt1 –  ) gforth-1.0 “x-t-colon”

Define local name; set name to execute xt1.
name execution: execute the xt that name has most recently been set to execute.
Is name run-time: ( xt2 – ) set name to execute xt2.
Action-of name run-time: ( – xt3 ) xt3 is the xt that name has most recently been set to execute.

Apart from {: and {, none of these words are normally in the search order (they are in the vocabulary locals-types); on other Forth systems, they may not even be words (the standard documents |, -- and :} under {:, not as separate word, and the other words are non-standard).