diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-22 10:48:07 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-22 11:11:46 -0300 |
| commit | 159fc78fc8d350f0f40f7f2fcf344377034c8f2f (patch) | |
| tree | 8e86bbc10db85b9e7aa83af05c32dc1467292b36 /abi | |
| parent | 6d075524729cc81fb157a587bef5481d6c36cb0b (diff) | |
| download | pardes-159fc78fc8d350f0f40f7f2fcf344377034c8f2f.tar.gz pardes-159fc78fc8d350f0f40f7f2fcf344377034c8f2f.zip | |
term: the emulator's boundary written down and enforced (S1 on the one road, item 2 of pardes-term-join-8): abi/term.zig names `Ops` in two groups, `replicated` (what every side agrees on by construction, each emulator fed the same bytes in the tape's order, written only by a step or a load, read by a step as the digest covers it, or by a draw) and `local` (start, stop, gpa, due, cellPixels, echoCell, paint, images: this process's own), every entry in exactly one (a comptime check: a new entry fails to compile until it says which); the terminal's digest (core/term/terminal.zig `digest`) now covers what a step reads of it: its cols and rows, every mode bit (the alternate screen, the mouse's, focus reports, bracketed paste; `modes`), the mouse's event and format, and the OSC 133 cycle (`marksOf`, `prompt`'s), beside the view, the cursor, the reply buffer, whether it holds an image and the active area's text; NOT the history's text (its row count only: a step's read of it, a 9P read, a Save, a selection over a shell, is listed as not covered); the two tables of round 6 and pardes-image-loop are a test (core/Term.zig `calls`: every call of the core's into a terminal, by entry, file and count, with its rule: a WRITE outside the rollback copy and why no unit kept to replay makes it or how the copy puts it back, a READ by a step and whether the digest covers it, a LOCAL use and why no step's state reads it, PURE for the pager's; a new call fails until it is listed); the counted list, not a type, enforces that the digested paths call the replicated group (by type the digested code would need a handle of its own: every one of the 13 files that read `grid` and more, past the 200 lines the brief allows); core/root.zig's reasons that said a client's emulator is written by deltas, and that a terminal is in no digest, say what is true now; core-test 912/1069 (157 skipped: +1, the `calls` test), shell-test 1111/1114, term-test 15/15, pane-test 181/182, kitty-test 45/45, the soak's small run and `--echo` rc 0 (diverged 0, unequal 0)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'abi')
| -rw-r--r-- | abi/term.zig | 30 |
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); +} |
