summaryrefslogtreecommitdiff
path: root/anim/scenes/list.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/scenes/list.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/scenes/list.zig')
-rw-r--r--anim/scenes/list.zig30
1 files changed, 19 insertions, 11 deletions
diff --git a/anim/scenes/list.zig b/anim/scenes/list.zig
index 53df4d5..d6f1a76 100644
--- a/anim/scenes/list.zig
+++ b/anim/scenes/list.zig
@@ -15,8 +15,8 @@ const recordings = @import("recordings");
pub const background = canim.background;
pub const scene = anim.Live(frame, struct {});
-/// Each a pigment, the same on its tag in the list and in the table.
-const tracked = [_][]const u8{ "prev", "cur", "next" };
+/// The variables whose tags the nodes carry: the three the loop moves, and `head`.
+const tracked = [_][]const u8{ "prev", "cur", "next", "head" };
fn frame(s: *anim.Frame) void {
const rec = canim.open(recordings.list);
@@ -25,26 +25,34 @@ fn frame(s: *anim.Frame) void {
// From reverse's first line (the list of three is built) to its last.
var at = canim.cursor(s, rec, rec.lineMoment(18, reverse.enter));
// The nodes are the idea; a tag slides and an arrow grows after its strike.
- at.levels = .{ .cpu = false, .idea = .data, .follow = t.move, .source_rows = 5 };
+ at.levels = .{ .idea = .data, .follow = t.move, .source_rows = 10 };
const end = rec.lineMoment(27, reverse.enter);
at.journey(.line, end);
// The idea is the subject: the lens a size up, the nodes over the bytes they are.
const split = canim.layout.split.subject;
- const ctx = canim.context(s, at, .{ .split = split, .quiet = true });
- const list = canim.nodes(s, .{ .cursor = at, .stage = ctx.stage, .root = "head", .track = &tracked, .quiet = true });
+ const ctx = canim.context(s, at, .{ .split = split });
+ const list = canim.nodes(s, .{ .cursor = at, .stage = ctx.stage, .root = "head", .track = &tracked });
var says: canim.Narrator = .{};
const joins = ctx.ties(s);
- canim.establish(s, .{ ctx.clock, ctx.registers, ctx.stack, ctx.source, ctx.disasm, list, joins });
+ // The nodes come in beside their bytes, one by one: three of them.
+ ctx.establish(s, .{ ctx.clock, ctx.registers, ctx.stack, ctx.source, ctx.disasm, list, joins }, 3);
says.line(s, "A list is nodes on the heap, each holding the address of the next.\nReversing it moves no node: it rewrites every `next`.");
- // Three names are set up, then the first trip round the loop, in full.
- at.walk(s, .line, rec.lineMoment(20, rec.lineMoment(24, reverse.enter)));
+ // Three names are set up.
+ const first_trip = rec.lineMoment(21, reverse.enter);
+ at.walk(s, .line, first_trip);
+ // The loop's caption leads the loop.
says.line(s, "`next` remembers the way on, `cur->next` is turned round,\nand `prev` and `cur` each step along.");
+ const second_trip = rec.lineMoment(21, rec.lineMoment(24, first_trip));
+ at.walk(s, .line, second_trip);
// Pacing: the second trip is the same, so hurried; it keeps its rest.
- at.hurry(s, .line, rec.lineMoment(20, rec.lineMoment(24, at.moment(s))), .{});
+ says.line(s, "The second node, the same way, faster:\nits `next` turns back to the first.");
+ const third_trip = rec.lineMoment(21, rec.lineMoment(24, second_trip));
+ at.hurry(s, .line, third_trip, .{});
// The third in full again: the last `next` turns, and `cur` runs off the end.
- at.walk(s, .line, rec.lineMoment(26, at.moment(s)));
+ says.line(s, "The last node: its `next` turns too,\nand `cur` runs off the end of the list.");
+ at.walk(s, .line, rec.lineMoment(26, third_trip));
says.line(s, "`head` takes the last node: the same three nodes,\nin the same places, read the other way.");
at.walk(s, .line, end);
- s.wait(t.before_cut);
+ says.close(s);
}