local-buffer-var:locals — compiling primitive
EXTENSIONS
LBUFFER:
( size [name] -- )( | ) ; |
; |
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