summaryrefslogtreecommitdiff
path: root/anim/src/rows.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 18:06:30 -0300
committerGabriel Schneider <[email protected]>2026-11-10 19:01:23 -0300
commite63b0624f57472d40af32a006c32cc47d403b822 (patch)
treeb7295da62acd96bc7aba425720eed95605526693 /anim/src/rows.zig
parent318e16181a28725e218121363555580725d6d0d4 (diff)
downloadcomputeranim-e63b0624f57472d40af32a006c32cc47d403b822.tar.gz
computeranim-e63b0624f57472d40af32a006c32cc47d403b822.zip
canim: what the review found; the band as two panels; list and sort by instruction
The first videos were reviewed frame by frame and the catalogue changed with them. A lens is a drawing over the program column and its view over the state column, so the stack keeps six slots, its window on the whole frame. Operands are whole. list and sort are recorded by instruction from main (record --from), so their registers strike, links reach nodes and cells, rows that ran are marked and jumps are drawn. A call's node is a projection of its return address; pins travel and keep their side; a mark covers the bytes that changed, at the element's width; a syscall's result is stored after the kernel returns it and every panel is of one moment; fast passes are veiled; the clock stands still during a step; captions get their reading time and a scene's first step comes by four seconds. Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'anim/src/rows.zig')
-rw-r--r--anim/src/rows.zig44
1 files changed, 34 insertions, 10 deletions
diff --git a/anim/src/rows.zig b/anim/src/rows.zig
index 063301a..4d8a42b 100644
--- a/anim/src/rows.zig
+++ b/anim/src/rows.zig
@@ -138,10 +138,10 @@ pub fn chain(u: ui.Ui, x: f32, y: f32, moment: Recording.Moment, value: u64, roo
} else {
// A code address's name.
const name = ui.symbol(u, link.text);
- const fits: usize = @intFromFloat(@max((room - at - 10) / adv, 0));
- if (fits >= 3) {
- v.text(.mono, size, at + 10, base, name[0..@min(name.len, fits)], t.primary);
- at += 10 + @as(f32, @floatFromInt(@min(name.len, fits))) * adv;
+ if (room - at - 10 >= 3 * adv) {
+ const cut = fitted(u, name, room - at - 10);
+ v.text(.mono, size, at + 10, base, cut, t.primary);
+ at += 10 + u.width(.mono, size, cut);
}
}
break;
@@ -214,6 +214,17 @@ pub fn slot(u: ui.Ui, y: f32, w: f32, moment: Recording.Moment, addr: u64, pins:
return chain(u, at, y, moment, held, w - s.room, lead);
}
+/// `slot` `free`: a word above rsp the stack has not reached, shown while
+/// the window is held for the camera: its address at 60%, its word
+/// faint, no chain, no pin.
+pub fn free(u: ui.Ui, y: f32, moment: Recording.Moment, addr: u64, lead: usize) void {
+ const s = theme.metric.slot;
+ const base = baseline(y);
+ const end = u.address(s.chain, base, addr, .{ .ink = ui.mix(theme.color.region.stack, theme.color.page, theme.metric.context.lead_alpha), .lead = lead });
+ const word = (Recording.word(moment, addr, 8) catch null) orelse return u.unknown(.{ .x = end + m.arrow_w, .y = y, .w = 24, .h = row_h });
+ u.text(.mono, size, end + m.arrow_w, base, u.print("{x}", .{word}), t.faint);
+}
+
/// `call` `span`: one frame of the call chain on the stack, a bracket 14
/// in from the panel's right edge `w` down the slots `y0 .. y1` that are
/// the frame, and the function's name left of it (Go Medium 18). `newest`
@@ -227,14 +238,27 @@ pub fn span(u: ui.Ui, w: f32, y0: f32, y1: f32, name: []const u8, newest: bool,
u.text(.sans_medium, micro, x - 14 - u.width(.sans_medium, micro, name), mid, name, if (newest) t.bright else t.dim);
}
-/// `call` `row`: `#n` (a gold plaque on the newest), the name and offset
-/// in primary at 60, file and line in dim at 276.
-pub fn callRow(u: ui.Ui, y: f32, w: f32, n: usize, name: []const u8, where: []const u8, newest: bool) void {
+/// `call` `row`: `#n` at 12 (a gold plaque 40 wide on the newest), the
+/// name and offset in primary at 60, the arguments at 384 (`n=4`,
+/// primary), file and line ranged right, dim. A name cut only where the
+/// arguments begin, saying so.
+pub fn callRow(u: ui.Ui, y: f32, w: f32, n: usize, name: []const u8, args: []const u8, where: []const u8, newest: bool) void {
const gold = theme.mark(.current);
- if (newest) u.current(.{ .x = theme.stroke.rule, .y = y, .w = w - 2 * theme.stroke.rule, .h = row_h }, 44, 0);
+ if (newest) u.current(.{ .x = theme.stroke.rule, .y = y, .w = w - 2 * theme.stroke.rule, .h = row_h }, 40, 0);
u.text(if (newest) .mono_bold else .mono, size, m.side, baseline(y), u.print("#{d}", .{n}), if (newest) gold.on_solid else t.faint);
- u.text(.mono, size, 60, baseline(y), name[0..@min(name.len, 17)], t.primary);
- u.text(.mono, size, 276, baseline(y), where, t.dim);
+ const where_x = w - m.side - u.width(.mono, size, where);
+ const args_x: f32 = 384;
+ const shown = fitted(u, name, (if (args.len > 0) args_x else where_x) - 60 - adv);
+ u.text(.mono, size, 60, baseline(y), shown, t.primary);
+ u.text(.mono, size, @max(args_x, 60 + u.width(.mono, size, shown) + adv), baseline(y), args, t.primary);
+ u.text(.mono, size, where_x, baseline(y), where, t.dim);
+}
+
+/// `text` in `width` units of mono 20: whole, or cut at its far end with `…`.
+pub fn fitted(u: ui.Ui, text: []const u8, width: f32) []const u8 {
+ const chars: usize = @intFromFloat(@max(width / adv, 1));
+ if (text.len <= chars) return text;
+ return u.print("{s}\u{2026}", .{text[0 .. chars - 1]});
}
/// `line`: a line of source, its number ranged right in three characters