summaryrefslogtreecommitdiff
path: root/src/Addon.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Addon.zig')
-rw-r--r--src/Addon.zig13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/Addon.zig b/src/Addon.zig
index 4a387afa..6955741d 100644
--- a/src/Addon.zig
+++ b/src/Addon.zig
@@ -294,7 +294,7 @@ pub const Loaded = struct {
name: []const u8 = "",
version: u32 = 0,
abi: u32 = 0,
- /// The library file's BLAKE3; zero for a kind compiled in.
+ /// The library file's BLAKE3; zero for one never read.
hash: [32]u8 = @splat(0),
caps: Kind.Caps = .{},
path: []const u8 = "",
@@ -372,7 +372,7 @@ pub fn take(r: *Kind.Registry, l: Loaded, except: []const u8) ?[]const u8 {
r.n += 1;
return e.why.slice();
}
- e.why.set(if (e.compiledIn()) "static" else "loaded");
+ e.why.set("loaded");
r.ops[r.n] = if (tape.replaying()) null else @ptrFromInt(l.ops);
for (l.words) |w| {
r.words[r.nwords] = .{ .kind = r.n, .arg = w.arg, .opens = w.opens };
@@ -462,7 +462,7 @@ pub fn run(p: *Pardes, id: usize, arg: ?[]const u8) void {
if (a.len == 0) {
var w: std.Io.Writer = .fixed(&said);
w.writeAll("addons:") catch {};
- for (p.kinds.kinds[0..p.kinds.n]) |*e| if (!e.refused) w.print(" {s} {d}{s}", .{ e.nameOf(), e.version, if (e.compiledIn()) " (compiled in)" else "" }) catch {};
+ for (p.kinds.kinds[0..p.kinds.n]) |*e| if (!e.refused) w.print(" {s} {d}", .{ e.nameOf(), e.version }) catch {};
return p.setMessage(id, w.buffered());
}
const takes = "Addon takes load <path>, unload <name> or reload <name>";
@@ -478,7 +478,6 @@ pub fn run(p: *Pardes, id: usize, arg: ?[]const u8) void {
}
const k = p.kinds.byName(rest) orelse return p.reportFailure(id, std.fmt.bufPrint(&said, "Addon {t}: no addon brought kind {s}", .{ op, rest }) catch takes);
const e = &p.kinds.kinds[k];
- if (e.compiledIn()) return p.reportFailure(id, std.fmt.bufPrint(&said, "Addon {t}: {s} is compiled in", .{ op, rest }) catch takes);
if (op == .reload) return p.emit(.{ .addon = .{ .op = .reload, .pane = @intCast(id), .arg = .from(e.path.slice()) } });
const n = openPanes(p, rest);
if (n > 0) return p.reportFailure(id, std.fmt.bufPrint(&said, "Addon unload: {d} {s} pane{s} open", .{ n, rest, if (n == 1) " is" else "s are" }) catch takes);
@@ -551,7 +550,7 @@ pub fn reopenWaiting(p: *Pardes, name: []const u8) usize {
/// generation (a job the old one asked for is dropped as it answers).
fn swap(p: *Pardes, l: Loaded, why: *Why) bool {
const k = for (p.kinds.kinds[0..p.kinds.n], 0..) |*e, i| {
- if (!e.refused and !e.compiledIn() and std.mem.eql(u8, e.path.slice(), l.path)) break @as(u8, @intCast(i));
+ if (!e.refused and std.mem.eql(u8, e.path.slice(), l.path)) break @as(u8, @intCast(i));
} else return fail(why, "no addon was loaded from it", .{});
const name = p.kinds.kinds[k].nameOf();
if (l.why.len > 0) return fail(why, "{s}", .{l.why});
@@ -612,12 +611,12 @@ fn fail(why: *Why, comptime fmt: []const u8, args: anytype) bool {
}
/// /addons: `<kind> <version> <abi> <panes open> <path> <blake3>
-/// static|loaded|refused: why` a line (`-` for no path, no hash).
+/// loaded|refused: why` a line (`-` for no path, no hash).
pub fn list(p: *const Pardes, out: *std.ArrayList(u8), gpa: std.mem.Allocator) !void {
for (p.kinds.kinds[0..p.kinds.n]) |*e| {
const name = if (e.nameOf().len > 0) e.nameOf() else std.fs.path.basename(e.path.slice());
try out.print(gpa, "{s} {d} {d}.{d} {d} {s} ", .{ name, e.version, e.abi >> 16, e.abi & 0xffff, if (e.refused) 0 else openPanes(p, name), if (e.path.len > 0) e.path.slice() else "-" });
- if (e.compiledIn()) try out.append(gpa, '-') else try out.print(gpa, "{x}", .{e.hash});
+ if (std.mem.allEqual(u8, &e.hash, 0)) try out.append(gpa, '-') else try out.print(gpa, "{x}", .{e.hash});
try out.print(gpa, " {s}\n", .{e.why.slice()});
}
}