summaryrefslogtreecommitdiff
path: root/abi
diff options
context:
space:
mode:
Diffstat (limited to 'abi')
-rw-r--r--abi/term.zig30
1 files changed, 30 insertions, 0 deletions
diff --git a/abi/term.zig b/abi/term.zig
index a0636509..d6c48f96 100644
--- a/abi/term.zig
+++ b/abi/term.zig
@@ -368,3 +368,33 @@ pub const Ops = struct {
images: *const fn (s: *State, gpa: std.mem.Allocator, at: ImagesAt, out: *std.ArrayList(plain.Placement), frame: []plain.Cell, frame_cols: u16) void,
hasImages: *const fn (s: ?*const State) bool,
};
+
+/// `Ops` in its two groups (S1: the emulator's boundary). REPLICATED: what
+/// every side agrees on by construction, each side's emulator fed the same
+/// bytes in the tape's order: written only by a step or a load, read by a
+/// step as the terminal's digest covers it (core/term/terminal.zig
+/// `digest`), or by a draw. LOCAL: this process's own (its frontend's cell
+/// size, the pixels and images it draws, its next wake, the module's start
+/// and its allocator), never what a step's digested state is computed from.
+/// core/Term.zig's `calls` lists every call of the core's into either, by
+/// file, with its rule: a new one fails its test until it is listed.
+pub const replicated = [_][]const u8{
+ "open", "close", "revive", "digest", "parts", "snapshot", "load", "reload",
+ "media", "feed", "grid", "viewTo", "scroll", "follow", "resize", "replies",
+ "key", "mouse", "wheel", "paste", "modes", "promptMoves", "prompt", "commandOutput",
+ "endOutputHere", "scrollback", "scrollbackLen", "textRows", "viewport", "editRows", "promptCut", "page",
+ "filter", "spanColor", "hasImages",
+};
+pub const local = [_][]const u8{ "start", "stop", "gpa", "due", "cellPixels", "echoCell", "paint", "images" };
+
+comptime {
+ @setEvalBranchQuota(100_000);
+ for (@typeInfo(Ops).@"struct".field_names) |fname| {
+ var n = 0;
+ for (replicated ++ local) |name| {
+ if (std.mem.eql(u8, name, fname)) n += 1;
+ }
+ if (n != 1) @compileError("term.Ops." ++ fname ++ ": in neither group or in both (abi/term.zig `replicated`, `local`): say which, and why");
+ }
+ for (replicated ++ local) |name| if (!@hasField(Ops, name)) @compileError("term.Ops has no " ++ name);
+}