Skip to main content

execautofn

Function execautofn 

Source
pub fn execautofn(state: &mut estate, _do_exec: i32) -> i32
Expand description

Port of static int execautofn(Estate state, UNUSED(int do_exec)) from Src/exec.c:5635-5644. The autoload-aware dispatch entry for WC_AUTOFN: fault the function body in via loadautofn, then hand off to execautofn_basic to actually run it.

C body:

static int
execautofn(Estate state, UNUSED(int do_exec))
{
    Shfunc shf;
    if (!(shf = loadautofn(state->prog->shf, 1, 0, 0)))
        return 1;
    state->prog->shf = shf;
    return execautofn_basic(state, 0);
}

Rust port: loadautofn mutates the shfunc in place via a raw pointer and returns 0/1 (success/failure), so the explicit state->prog->shf = shf assignment in C is implicit here.