|
LOCALS-EXT Locals + extensions
The Portable Forth Environment does implement locals
in such an extended form as that additional variable
names can be declared anywhere in the compiled word.
(LOCAL) ( strptr strcnt -- )
- smart-word ansi 13.6.1.0086
this word is used to create compiling words that can
declare LOCALS| - it shall not be used directly
to declare a local, the pfe provides LVALUE for
that a purpose beyond LOCALS|
reference: p4_paren_local in ../src/locals.c:0157, export CS (LOCAL)
LOCALS| name1 name2 ... nameN | ( xN ... x2 x1 -- )
- smart-word ansi 13.6.2.1795
create local identifiers to be used in the current definition.
At runtime, each identifier will be assigned a value from
the parameter stack.
The identifiers may be treated as if being a VALUE , it does
also implement the ansi TO extensions for locals. Note that
the identifiers are only valid inside the currently compiled
word, the SEE decompiled word will show them as
<A> <B> ... <N> a.s.o.
see also LVALUE
reference: p4_locals_bar in ../src/locals.c:0177, export CS LOCALS|
LVALUE name ( value -- )
- smart-word
declares a single local VALUE using (LOCAL) - a
sequence of LVALUE declarations can replace a
LOCALS| argument, ie. LOCALS| a b c |
is the same as LVALUE a LVALUE b LVALUE c .
This should also clarify the runtime stack behaviour of
LOCALS| where the stack parameters seem to be
assigned in reverse order as opposed to their textual
identifier declarations.
compare with VALUE and the pfe's convenience word
VAR .
reference: p4_local_value in ../src/locals.c:0205, export CS LVALUE
|