Skip to main content

FUNC_OFLAGS

Static FUNC_OFLAGS 

Source
pub static FUNC_OFLAGS: AtomicU32
Expand description

Port of int doshfunc(Shfunc shfunc, LinkList doshargs, int noreturnval) from Src/exec.c:5823-6158.

C body’s scope-management sequence ported here. The C source’s body-execution call (runshfunc(prog, wrappers, name) at c:6042) is replaced by body_runner — zshrs runs function bodies through fusevm bytecode rather than zsh’s wordcode walker (per PORT.md “zshrs replaces zsh’s tree-walking interpreter” rule), so the callback hands the live executor back to the caller (typically the fusevm bridge) for the actual body run. Every line of scope save/restore around the body call mirrors C exactly.

RUST-ONLY ADAPTATION: the extra body_runner parameter is not in C. C calls runshfunc(prog, wrappers, name) directly at c:6042; zshrs delegates to a closure because the body-execution pipeline (fusevm) differs from C’s (wordcode). The closure fully replaces the runshfunc call and returns the body’s exit status (which doshfunc reads as lastval for the noreturnval path). Port of the module-global oflags in Src/exec.c (set at c:5970 via funcsave->oflags = oflags;). Holds the attribute flags of the function CURRENTLY executing, so a nested call can tell whether its caller carried PM_TAGGED_LOCAL — that is what makes functions -T non-recursive. zshrs-original storage shape (atomic rather than a plain global); the save/restore discipline matches C’s funcsave. Bug #1058.