summaryrefslogtreecommitdiff
path: root/anim/src/nodes.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-12 04:45:57 -0300
committerGabriel Schneider <[email protected]>2026-11-12 07:03:05 -0300
commit4907e35bc45d12102d0e09380994814fc2e0a369 (patch)
tree7cfd90224653d73b63fbadaf2881fa0e6ba92860 /anim/src/nodes.zig
parentebdebe04a76f0302aeb24c1ac08fa9217b1a8257 (diff)
downloadcomputeranim-4907e35bc45d12102d0e09380994814fc2e0a369.tar.gz
computeranim-4907e35bc45d12102d0e09380994814fc2e0a369.zip
canim: the introduction, from the review
The introduction records the plain build (clang -O0, no instrumentation), so reverse's frame is the compiler's own push, mov and sub. The stack chapter says its convention once and keeps four free words over rsp so a push moves the pin and nothing else; reverse's rows stand under main's and are stepped, each touching its word, the call before the push, the aim drawn head first to the row it returns to. The close-up frames the bytes and the stack together with their 128 bytes marked. Nothing is named before it is shown; offsets are written in hex as the operands are; the dump folds into its tag; the map is announced before it is shown. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/nodes.zig')
-rw-r--r--anim/src/nodes.zig14
1 files changed, 11 insertions, 3 deletions
diff --git a/anim/src/nodes.zig b/anim/src/nodes.zig
index 5218d7f..bc2ef86 100644
--- a/anim/src/nodes.zig
+++ b/anim/src/nodes.zig
@@ -40,6 +40,9 @@ pub const Nodes = struct {
/// No registers in the pins: an instrumented program's registers say nothing of it.
quiet: bool = false,
focus: bool = true,
+ /// A pin's names past the second by name where they fit before the next
+ /// node, not a count (the introduction's: what its caption names).
+ named: bool = false,
pub fn draw(g: *const Nodes, f: *sk.Frame, placed: anim.Placed) void {
const box = g.stage.box(placed, .band);
@@ -175,13 +178,18 @@ pub const Nodes = struct {
const new = for (before) |was| {
if (was.addr == o.addr) break false;
} else true;
+ // Its pin's names run right as far as the next node (or the band's edge).
+ var room = box.w - m.pad - 8;
+ for (places) |q| if (q.x > place.x) {
+ room = @min(room, q.x - 8);
+ };
// What begins fades in; it does not pop.
- if (show > 0) g.node(u.faded(show * (if (new) now.moving(.idea, 0, time.quick) else 1)).moved(0, below), now, o, place, label, value_size);
+ if (show > 0) g.node(u.faded(show * (if (new) now.moving(.idea, 0, time.quick) else 1)).moved(0, below), now, o, place, label, value_size, room);
}
g.tags(u, now, things, places, label);
}
- fn node(g: *const Nodes, u: ui.Ui, now: cursors.Now, o: objects.Object, r: Rect, label: f32, value_size: f32) void {
+ fn node(g: *const Nodes, u: ui.Ui, now: cursors.Now, o: objects.Object, r: Rect, label: f32, value_size: f32, room: f32) void {
const moment = now.shown(.idea);
const heap = theme.color.region.heap;
const pw = theme.metric.node.pointer_w;
@@ -235,7 +243,7 @@ pub const Nodes = struct {
ties.anchor(u, .{ .node_pin = o.addr }, .{ .x = cx - 1, .y = r.y + r.h, .w = 2, .h = label + 10 });
if (names.names.len > 0 and names.shows > 0) {
u.faded(names.shows).pinUnderInked(cx, r.y + r.h, &.{}, &.{}, heap, label);
- u.faded(names.shows * names.text).pinNames(cx, r.y + r.h, names.names, names.inks, label);
+ u.faded(names.shows * names.text).pinNames(cx, r.y + r.h, names.names, names.inks, label, if (g.named) room else 0);
}
}