13.6.2.1795 LOCALS| locals-bar LOCAL EXT
Interpretation:
Interpretation semantics for this word are undefined.
Compilation:
( "<spaces>name1" "<spaces>name2" ... "<spaces>namen" " | " -- )
Create up to eight local identifiers by repeatedly skipping leading spaces, parsing name, and executing 13.6.1.0086 (LOCAL). The list of locals to be defined is terminated by | . Append the run-time semantics given below to the current definition.
Run-time:
( xn ... x2 x1 -- )
Initialize up to eight local identifiers as described in 13.6.1.0086 (LOCAL), each of which takes as its initial value the top stack item, removing it from the stack. Identifier name1 is initialized with x1, identifier name2 with x2, etc. When invoked, each local will return its value. The value of a local may be changed using 6.2.2295 TO.
Note:
This word is obsolescent and is included as a concession to
existing implementations.
Implementation:
: LOCALS| ( "name...name |" -- )
BEGIN
BL WORD COUNT OVER C@
[CHAR] | - OVER 1 - OR WHILE
(LOCAL)
REPEAT 2DROP 0 0 (LOCAL)
; IMMEDIATE
BEGIN
BL WORD COUNT OVER C@
[CHAR] | - OVER 1 - OR WHILE
(LOCAL)
REPEAT 2DROP 0 0 (LOCAL)
; IMMEDIATE