PFE 0.33.71

Homepage
SourceForge
Download
Documentation
-Overview
-The PFE Manual
old manual / (book)
-ChangeLog
-Authors
-License (LGPL)
-Wordsets / (book)
-Functions .. (book)
-Dp of ANS Forth
-The 4thTutor
-Forthprimer.pdf
- Old Wordsets
- Old Words List
Forth Links
* Forth Repository
* Taygeta Compilation
* TinyBoot FirmWare
* FiCL, Free Forth
* Research Vienna
* Research Bournemouth
* zForth WebRing
Other Links
* Tektronix/MPT
* Forth Org. (FIG)
* Forth Inc.
* MPE Ltd. Forths
* SF Win32Forth
* PD Win32Forth
* Neil Bawd

generated
(C) Guido U. Draheim
guidod@gmx.de

## Locals

> + extensions

`(LOCAL)``` => `"[ANS] FORTH"`

  (no description)

  primitive code = [p4_paren_local]

`LOCALS|``( xN ... x2 x1 [name1 .. nameN <|>] -- )``` => `"[ANS] FORTH"`

  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`

  compiling word = [p4_locals_bar]

`LVALUE``( value [name] -- )``` => `"EXTENSIONS"`

  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`.

        : LVALUE
          STATE @ IF
            VALUE
          ELSE
            BL WORD COUNT DUP (LOCAL) (TO)
          THEN
        ; IMMEDIATE

  compiling word = [p4_local_value]

`LBUFFER:``( size [name] -- )``` => `"EXTENSIONS"`

  declares a single local `VALUE` using `(LOCAL)` - which will hold the address of an area like `BUFFER:` but carved from the return-stack (as in C with alloca). This local buffer will be automatically given up at the end of the word. The return-stack-pointer will be increased only at the time of this function (and the address assigned to the `LVALUE`) so that the provided size gets determined at runtime. Note that in some configurations the forth-return-stack area is quite small - for large string operations you should consider to use a `POCKET-PAD` in pfe.

        : LBUFFER:
          STATE @ IF
            BUFFER:
          ELSE
            :NONAME ( size -- rp* ) R> RP@ - DUP RP! SWAP >R ;NONAME
            COMPILE, POSTPONE LVALUE
          THEN
        ; IMMEDIATE

  compiling word = [p4_local_buffer_var]