summaryrefslogtreecommitdiff
path: root/src/Addon.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Addon.zig')
-rw-r--r--src/Addon.zig18
1 files changed, 15 insertions, 3 deletions
diff --git a/src/Addon.zig b/src/Addon.zig
index 6955741d..9f94f1de 100644
--- a/src/Addon.zig
+++ b/src/Addon.zig
@@ -65,13 +65,19 @@ pub fn perform(p: *Pardes, op: Op, pane: u8, arg: []const u8) void {
};
return;
}
- var data_buf: [4096]u8 = undefined;
var words: [64]LoadedWord = undefined;
var why: Why = .{};
- const l = read(dataDir(&data_buf), arg, &words, &why);
+ const l = readLoaded(arg, &words, &why);
p.update(.{ .addon = .{ .op = op, .pane = pane, .kind = &l } });
}
+/// What a load reads off the library at `path` (held): the `addon`
+/// event's, for a caller that steps its core itself (a replica's authority).
+pub fn readLoaded(path: []const u8, words: *[64]LoadedWord, why: *Why) Loaded {
+ var data_buf: [4096]u8 = undefined;
+ return read(dataDir(&data_buf), path, words, why);
+}
+
/// The library at `path`, held (a second hold of the same bytes is the
/// first's library) and checked: what it brings, or why not.
fn read(data: []const u8, path: []const u8, words: *[64]LoadedWord, why: *Why) Loaded {
@@ -327,7 +333,13 @@ pub fn loadedOf(ops: *const Kind.Ops, path: []const u8, hash: [32]u8, words: *[6
.exts = if (h.exts == null) "" else std.mem.span(h.exts),
.words = words[0..head_words.len],
.ops = @intFromPtr(ops),
- .caps = .{ .tick = ops.tick != null, .key = ops.key != null, .mouse = ops.mouse != null, .ctl = ops.ctl != null, .jobs = ops.job_run != null, .load = ops.load != null },
+ .caps = .{
+ .tick = ops.tick != null, .key = ops.key != null, .mouse = ops.mouse != null, .ctl = ops.ctl != null, .jobs = ops.job_run != null, .load = ops.load != null,
+ // 2.1's: a library of 2.0 has no `search` to read, and Esc leaves it.
+ .search = h.abi & 0xffff >= 1 and ops.search != null,
+ .esc = h.abi & 0xffff >= 1 and ops.key != null,
+ .address = ops.address != null,
+ },
};
}