diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-11 17:42:07 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-11 19:11:00 -0300 |
| commit | b54c6776953d3243ab5b8e676e747713827ab320 (patch) | |
| tree | d53be6cef4587b94531880af6479a1b5fa1aac39 /anim/src/root.zig | |
| parent | 3093eb55ac4a7054f51f06ea2786b5f9c9ec73f6 (diff) | |
| download | computeranim-b54c6776953d3243ab5b8e676e747713827ab320.tar.gz computeranim-b54c6776953d3243ab5b8e676e747713827ab320.zip | |
canim: the disassembly under the source everywhere; rings
From the user. In every split the disassembly stays under the source;
registers a scene never changes fold three to a row, and the stack takes
the room: nine to twenty slots where it had six. The graph's first form
is rings: a loop a ring its blocks sit on, an inner loop a smaller ring
touching its parent, a way out leaving along the tangent; layers stay
for functions without loops. Its layout comes from the code alone and it
shows nothing from after the moment: a block not reached yet is quiet
and is reached, a fold of what is not reached yet opens when the run
arrives. A pane unrolls from its strip into its whole column and rolls
back. The sqlite scene's strips move before their panes.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNCKgYCGiANnEwcEQxa
Diffstat (limited to 'anim/src/root.zig')
| -rw-r--r-- | anim/src/root.zig | 41 |
1 files changed, 27 insertions, 14 deletions
diff --git a/anim/src/root.zig b/anim/src/root.zig index 78da9dc..dca9a60 100644 --- a/anim/src/root.zig +++ b/anim/src/root.zig @@ -247,22 +247,32 @@ pub const Context = struct { /// callee's window under the call row, and a system call the /// kernel's under the `syscall` (step with `descent.step`). descent: bool = false, - /// On the map the disassembly as the function's graph (`graph.Map`), - /// two columns wide beside the source, the registers and the stack - /// in the last column. + /// On the map the function's graph as the `blocks` lens draws it + /// (`graph.Blocks`), the map's drawing over the source; the + /// disassembly beside it linear, its blocks ruled. graph: bool = false, }; /// The ties between the panes, drawn over everything added before. pub fn ties(c: Context, s: *anim.Frame) anim.Obj { - return add(s, Ties{ .cursor = c.cursor, .stage = c.stage, .quiet = c.quiet }); + const obj = add(s, Ties{ .cursor = c.cursor, .stage = c.stage, .quiet = c.quiet }); + c.unrolls(s); + return obj; + } + + /// Over everything added before: a pane's column unrolled (`map.Unroll`). + fn unrolls(c: Context, s: *anim.Frame) void { + const o = add(s, map.Unroll{ .map = c.map }); + s.play(.{o.fadeIn()}, .{ .seconds = 0 }); } /// The ties, and a link the scene plays on a beat of its own (`Beat.play`): /// register `name` framed as read, then linked to what it points at, held `hold`. pub fn tiesWith(c: Context, s: *anim.Frame, name: []const u8, hold: f32) struct { anim.Obj, *const tying.Beat } { const beat = s.new(tying.Beat{ .cursor = c.cursor, .name = name, .hold = hold, .t = s.value(-1) }); - return .{ add(s, Ties{ .cursor = c.cursor, .stage = c.stage, .quiet = c.quiet, .beat = beat }), beat }; + const obj = add(s, Ties{ .cursor = c.cursor, .stage = c.stage, .quiet = c.quiet, .beat = beat }); + c.unrolls(s); + return .{ obj, beat }; } /// A scene's opening with a lens drawn from bytes (`nodes`, `array`): @@ -285,21 +295,24 @@ pub const Context = struct { }; pub fn context(s: *anim.Frame, cursor_: Cursor, options: Context.Options) Context { - const stage = Stage.init(s, options.split); + // The registers the scene moves keep their rows, the rest fold, chosen + // once from its way; the panel is as tall as its rows, the stack has the rest. + const moves = contexts.movedBy(cursor_.rec, cursor_.by, .{ cursor_.first, cursor_.last }); + const registers_rows: f32 = @floatFromInt(contexts.registerRows(moves)); + const stage = Stage.init(s, layout.fit(options.split, registers_rows)); + stage.registers_rows = registers_rows; var at = cursor_; at.levels.crossings = options.syscalls; // The map first: while it fills the frame it is under the panels diving out of it. - const whole = s.new(map.Map{ .stage = Stage.init(s, map.split(at.rec, options.split.band.h > 0, .{ at.first, at.last }, options.graph)), .frame = stage, .t = s.value(map.diving.land + map.diving.still), .cursor = at, .graph = options.graph }); + const whole = s.new(map.Map{ .stage = Stage.init(s, map.split(at.rec, options.split.band.h, .{ at.first, at.last })), .frame = stage, .t = s.value(map.diving.land + map.diving.still), .cursor = at }); whole.obj = s.custom(whole, .{ .x = -640, .y = -360, .scale = ui.scale }); whole.addIn(s, Source{ .cursor = at, .stage = whole.stage, .descent = options.descent }, .both, .source); whole.addIn(s, Source{ .cursor = at, .stage = whole.stage, .descent = options.descent, .part = .source_more }, .both, .source); + // The graph on the map is the lens's drawing at its size, over the source. + if (options.graph) whole.add(s, graph.Blocks{ .cursor = at, .stage = whole.stage }); // The disassembly's strip is its linear column: where the map draws a - // graph or a descent, the rows round the pc are drawn for the strip alone. - if (options.graph) { - whole.linear = Stage.init(s, map.split(at.rec, options.split.band.h > 0, .{ at.first, at.last }, false)); - whole.addIn(s, graph.Map{ .cursor = at, .stage = whole.stage }, .map, .disasm); - whole.addIn(s, Disasm{ .cursor = at, .stage = whole.linear.?, .measures = false }, .strips, .disasm); - } else if (options.descent) { + // descent, the rows round the pc are drawn for the strip alone. + if (options.descent) { whole.addIn(s, Descent{ .cursor = at, .stage = whole.stage }, .map, .disasm); whole.addIn(s, Disasm{ .cursor = at, .stage = whole.stage, .measures = false }, .strips, .disasm); } else whole.addIn(s, Disasm{ .cursor = at, .stage = whole.stage }, .both, .disasm); @@ -318,7 +331,7 @@ pub fn context(s: *anim.Frame, cursor_: Cursor, options: Context.Options) Contex .quiet = options.quiet, .source = add(s, Source{ .cursor = at, .stage = stage, .descent = options.descent }), .disasm = if (options.descent) add(s, Descent{ .cursor = at, .stage = stage }) else add(s, Disasm{ .cursor = at, .stage = stage }), - .registers = add(s, Registers{ .cursor = at, .stage = stage, .syscalls = options.syscalls, .quiet = options.quiet }), + .registers = add(s, Registers{ .cursor = at, .stage = stage, .syscalls = options.syscalls, .quiet = options.quiet, .moves = moves }), .stack = add(s, Stack{ .cursor = at, .stage = stage }), .backtrace = add(s, Backtrace{ .cursor = at, .stage = stage, .lens = options.backtrace }), .clock = add(s, Clock{ .cursor = at, .map = whole }), |
