summaryrefslogtreecommitdiff
path: root/src/Kind.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/Kind.zig')
-rw-r--r--src/Kind.zig30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/Kind.zig b/src/Kind.zig
index 2f40c8ea..619a9c53 100644
--- a/src/Kind.zig
+++ b/src/Kind.zig
@@ -131,10 +131,10 @@ pub const Registry = struct {
pub const Slot = struct {
pub const replica = .{
// The kind's own and the authority's (its code and memory, its
- // jobs' inputs, its file's hash, a placeholder's record, the place
- // its kind says), and what a frame makes (the thumb, the pointer,
- // whether one was drawn: a view's, never a step's).
- .local = .{ "ops", "st", "gpa", "arena", "opened", "reloads", "jobs", "tokens", "record", "where_text", "thumb_at", "thumb_span", "pointer", "painted", "over", "shadow", "used" },
+ // jobs' inputs, its file's hash, a placeholder's record), and what
+ // a frame makes (the thumb, the pointer, whether one was drawn: a
+ // view's, never a step's).
+ .local = .{ "ops", "st", "gpa", "arena", "opened", "reloads", "jobs", "tokens", "record", "thumb_at", "thumb_span", "pointer", "painted", "over", "shadow", "used" },
};
/// Its kind's code here; null in a placeholder (`live` false: its kind
/// not in the registry, its record kept for the day it comes) or a
@@ -166,8 +166,10 @@ pub const Slot = struct {
/// Its jobs' inputs, until the host takes them (Effect.job).
jobs: [4]?Job = @splat(null),
tokens: u32 = 0,
- /// A placeholder's: the kind's record and its `where`, kept whole.
+ /// A placeholder's: the kind's record, kept whole.
record: ?[]u8 = null,
+ /// Its `where` as its kind's last call left it (the call's outcome, on
+ /// the tape): the place a step reads (a jump, Recent) on every core.
where_text: Buf(32) = .{},
/// What the kind said refusing its open (or a load), or `<path> is not here`.
refused: Buf(160) = .{},
@@ -791,15 +793,6 @@ pub fn dumpCall(slot: *Slot, f: anytype, buf: []u8) u32 {
return f(slot.st, buf.ptr, @intCast(buf.len));
}
-/// `where`, as the authority's kind says it (on the tape): what a step
-/// keeps of it (a jump, Recent) a replica keeps alike.
-pub fn placeOf(slot: *Slot, buf: *[32]u8) []const u8 {
- const w = tape.value(.addon, where, .{ slot, buf });
- // A Shadow's place is the authority's last (`where` says it after).
- if (slot.ops == null) slot.where_text.set(w);
- return w;
-}
-
/// Where in it the pane is, as a text its `address` takes back.
pub fn where(slot: *Slot, buf: *[32]u8) []const u8 {
const ops = slot.ops orelse return slot.where_text.slice();
@@ -865,6 +858,9 @@ pub const Outcome = struct {
rows: []const u8 = "",
/// A tick's: the start of its tag (pa_tick.prefix).
prefix: []const u8 = "",
+ /// Its `where` after the call (a key, a view, a job's answer may move
+ /// it); null for a refused call.
+ where: ?[]const u8 = null,
/// The jobs it asked for (their tokens, 0 past the last): every core
/// emits them, so a replica's effects are the authority's; and those
/// it cancelled, every core drops.
@@ -913,7 +909,11 @@ const Call = struct {
current = prev;
if (checked) overBudget(cl);
if (cl.quiet) return .{};
- const o = tape.value(.addon, same, .{Outcome{ .ret = cl.ret, .text = cl.refused.slice(), .said = cl.said.slice(), .err = cl.err, .look = cl.look.slice(), .pane_name = cl.pane_name.slice(), .pane_text = cl.pane_text, .exec = cl.exec.slice(), .selected = cl.selected, .rows = cl.rows, .prefix = cl.prefix, .jobs = cl.jobs, .cancels = cl.cancels }});
+ var place: [32]u8 = undefined;
+ // A refused open closed its state: no `where` to ask.
+ const at: ?[]const u8 = if (cl.refused.len == 0) where(cl.slot, &place) else null;
+ const o = tape.value(.addon, same, .{Outcome{ .ret = cl.ret, .text = cl.refused.slice(), .said = cl.said.slice(), .err = cl.err, .look = cl.look.slice(), .pane_name = cl.pane_name.slice(), .pane_text = cl.pane_text, .exec = cl.exec.slice(), .selected = cl.selected, .rows = cl.rows, .prefix = cl.prefix, .where = at, .jobs = cl.jobs, .cancels = cl.cancels }});
+ if (o.where) |w| cl.slot.where_text.set(w);
if (cl.p) |p| if (p.panes[cl.id]) |pane| for (o.jobs) |token| if (token != 0) p.emit(.{ .job = .{ .pane = @intCast(cl.id), .serial = pane.serial, .token = token } });
for (o.cancels) |token| if (token != 0) {
for (&cl.slot.jobs) |*j| if (j.*) |job| if (job.token == token) {