From 165bb6c1344b98de7bef1d3c2b72147b4a40797a Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 10 Nov 2026 16:05:20 -0300 Subject: canim: the renderer speaks the design language The blocks, their states and the tokens carry the catalogue's names: atoms in ui, chain/reg/slot in rows, insn with its line column, jump lane and annotations (read, write, taken or not, a call with its arguments, a return, a syscall) in disasm, bytes and hexdump with field paper and the reading column, the three splits and relayout in stage, the ties (thread, link and pin, projection, echo). A lens is a band over the whole context, its drawing left and its bytes right. Frames' spans on the stack, each instruction's line and a callee's parameter count come from the tracer. A gallery scene draws every block; the test compares six of its pages with pictures kept in test/gallery, drawn from a recording kept there too. The scenes are ported; the motion checks report no pop and no metronome in any of them. Co-Authored-By: Claude Fable 5.2 --- anim/src/words.zig | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'anim/src/words.zig') diff --git a/anim/src/words.zig b/anim/src/words.zig index ff9c5c1..5601156 100644 --- a/anim/src/words.zig +++ b/anim/src/words.zig @@ -36,7 +36,8 @@ pub const Clock = struct { u.fill(.{ .x = stage.x, .y = c.clock_y - 2, .w = stage.w * now.place, .h = 4 }, theme.mark(.current).solid); const size = theme.size.mono.context; const base = c.clock_y + 28; - const count = u.print("moment {d} of {d}", .{ now.stops[0] -| now.way[0], now.way[1] -| now.way[0] }); + // The count is where the current mark is: it changes as the mark moves on. + const count = u.print("moment {d} of {d}", .{ now.marked() -| now.way[0], now.way[1] -| now.way[0] }); const count_x = stage.x + stage.w - u.width(.mono, size, count); u.text(.mono, size, count_x, base, count, t.faint); // Secondary action: the pace, said quietly. It only fades. @@ -133,9 +134,9 @@ pub const Veil = struct { /// it means: the same in every picture. pub const Legend = struct { box: Rect, - entries: []const Entry = &.{ .current, .written, .changed, .read, .pointer, .allocated, .freed, .unknown, .kernel }, + entries: []const Entry = &.{ .current, .written, .changed, .read, .link, .allocated, .freed, .unknown, .kernel }, - pub const Entry = enum { current, written, changed, read, pointer, allocated, freed, unknown, kernel }; + pub const Entry = enum { current, written, changed, read, link, allocated, freed, unknown, kernel }; pub fn draw(l: *const Legend, f: *sk.Frame, at: anim.Placed) void { const u: ui.Ui = .{ .f = f, .at = at }; @@ -152,7 +153,7 @@ pub const Legend = struct { .written => .{ "written", "by this step" }, .changed => .{ "changed", "a moment ago" }, .read => .{ "read", "by this step" }, - .pointer => .{ "pointer", "holds an address" }, + .link => .{ "link", "now points at that" }, .allocated => .{ "allocated", "handed out" }, .freed => .{ "freed", "handed back" }, .unknown => .{ "not seen", "never observed" }, @@ -174,18 +175,14 @@ pub const Legend = struct { u.label(.mono_bold, size, r, .center, "rip", theme.mark(.current).on_solid); }, .written, .changed => for ([_]Rect{ half, other }, [_][]const u8{ "2a", "00" }) |cell, digits| { - const ink = u.written(cell, if (entry == .written) .{ .level = 1, .solid = 1 } else .ember, null); + const ink = u.cellWritten(cell, if (entry == .written) .{ .level = 1, .solid = 1 } else .ember, theme.color.raised); u.label(ink.face, size, cell, .center, digits, ink.ink); }, .read => for ([_]Rect{ half, other }, [_][]const u8{ "2a", "00" }) |cell, digits| { - u.readMark(cell, 1); + u.cellRead(cell, 1); u.label(.mono, size, cell, .center, digits, t.primary); }, - .pointer => { - u.fill(half, theme.color.raised); - u.frame(half, theme.mark(.pointer).solid, theme.stroke.arrow); - u.arrow(&.{ .{ r.x + 46, r.y + 23 }, .{ r.x + r.w, r.y + 23 } }, theme.mark(.pointer).solid, .{}); - }, + .link => u.route(&.{ .{ r.x, r.y + 23 }, .{ r.x + r.w, r.y + 23 } }, theme.color.region.heap, .{ .width = theme.stroke.tie.link, .head = .{ 10, 10 } }), .allocated => { u.fill(r, theme.mark(.allocated).ember); u.frame(r, theme.mark(.allocated).solid, theme.stroke.line); -- cgit v1.3