diff options
Diffstat (limited to 'src/Effect.zig')
| -rw-r--r-- | src/Effect.zig | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/Effect.zig b/src/Effect.zig index 3ec87ff1..5fc5f970 100644 --- a/src/Effect.zig +++ b/src/Effect.zig @@ -76,7 +76,10 @@ pub const Effect = union(enum) { /// An addon loaded, let go, or let go and loaded again (Addon.zig): /// `arg` its path, or for unload its kind's name. Answered by an /// `addon` event. - addon: struct { op: @import("Kind.zig").AddonOp, pane: u8, arg: Buf(effect_path_cap) }, + addon: struct { op: @import("Addon.zig").Op, pane: u8, arg: Buf(effect_path_cap) }, + /// A kind's job for the host's workers (host_io.Job), answered by a + /// `job` event. + job: struct { pane: u8, serial: u32, token: u32 }, quit, pub fn Buf(comptime n: usize) type { @@ -235,8 +238,11 @@ pub fn perform(p: *Pardes, e: Effect) void { f(p.host.ctx) else p.reportError(d.pane, "detach", error.NotAttached), - // dlopen is the same on every host, so none has a method of its own. - .addon => |a| @import("Addon.zig").perform(p, a.op, a.pane, a.arg.slice()), + // dlopen is the same on every host, so none has a method of its + // own; a replica's core holds no library (what it brought comes in + // the event this taped). + .addon => |a| if (!tape.replaying()) @import("Addon.zig").perform(p, a.op, a.pane, a.arg.slice()), + .job => |j| if (v.job) |f| f(p.host.ctx, j.pane, j.serial, j.token) else if (!tape.replaying()) host_io.KindJob.runHere(p, j.pane, j.serial, j.token), // the loop's own condition; a host tears down after its own loop .quit => p.quit = true, } @@ -609,7 +615,7 @@ test "Save reaches every tagline with text behind it and no other" { // An image's bytes on disk already are what they are: nothing of the // pane's own is unwritten, so the word is absent and inert. const img_id = p.freeSlot().?; - const img = try pardes.Kind.open(p, img_id, &panes.Image.kind, "/tmp/pardes-tag.ppm", ""); + const img = try pardes.Kind.open(p, img_id, pardes.Kind.image, "/tmp/pardes-tag.ppm", ""); try std.testing.expectEqualStrings(" Term Collapse Del", tagline.curTail(img)); try std.testing.expect(p.executeBuiltinLine(img_id, "Save")); try std.testing.expect(img.prompt != .save); |
