Skip to main content

getfpfunc

Function getfpfunc 

Source
pub fn getfpfunc(
    name: &str,
    dir_path_out: &mut Option<String>,
    spec_path: Option<&[String]>,
    test_only: i32,
    dump_out: &mut Option<(eprog, i32)>,
) -> Option<String>
Expand description

Port of getfpfunc(char *s, int *ksh, char **fdir, char **alt_path, int test_only) from Src/exec.c:6219. Walks $fpath (or the supplied spec_path slice) for a file named name and writes the resolved directory through *dir_path_out (matching the C char **dir_path). Returns Some(file_path) on success, None when not found.

Per dir, the compiled-dump lookup runs FIRST (c:6238 try_dump_file(*pp, s, buf, ksh, test_only)) — a directory digest <dir>.zwc or per-function <dir>/<name>.zwc wins over the plain file when newer (mtime logic inside try_dump_file, c:parse.c:3762-3784). On a dump hit the loaded program + ksh mode (C’s *ksh out-param) are written through dump_out and the nominal <dir>/<name> path is returned; the caller must check dump_out before reading the returned path as a plain file.