locals |
"Locals + extensions"localsThe Portable Forth Environment does implement locals in such an extended form as that additional variable names can be declared anywhere in the compiled word. Locals are names for values that live in a locals-frame on the return-stack - on entry to the procedure that locals-frame is carved from the return-stack and a frame-pointer is setup. Locals are in two forms, one is inialized by a chunk from the parameter-stack as it is with LOCALS| while the others are local variables
declared later. The latter are left unitialized on setup of the locals-frame. For unnamed returnstack locals, see words like R@ R! R'@ R'! R"@ R"! 2R@ 2R!
but here the setup and cleanup of the return-stack frame is left to the user, possibly using some words like >R R> 2>R 2R> R>DROP while the locals-ext
will take care to provide a frame-creation token and some cleanup-code for each EXIT or ;
[ANS] (LOCAL) no special info, see general notes locals loader code P4_SXco [ANS] LOCALS| no special info, see general notes locals loader code P4_SXco EXTENSIONSEXTENSIONS LVALUE no special info, see general notes locals loader code P4_SXco EXTENSIONS LBUFFER: no special info, see general notes locals loader code P4_SXco ENVIRONMENT
ENVIRONMENT LOCALS-EXT no special info, see general notes locals ordinary constant
locals ordinary constant ENVIRONMENT LOCALS-LOADED no special info, see general notes locals loader code P4_XXco |