summaryrefslogtreecommitdiff
path: root/anim/tools
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 16:05:20 -0300
committerGabriel Schneider <[email protected]>2026-11-10 16:43:58 -0300
commit165bb6c1344b98de7bef1d3c2b72147b4a40797a (patch)
tree0e70e6222700063f604f78673f6ab3a5bfb9242d /anim/tools
parent66a2a7cf733f6abc1f79561c52d901ce67019fb1 (diff)
downloadcomputeranim-165bb6c1344b98de7bef1d3c2b72147b4a40797a.tar.gz
computeranim-165bb6c1344b98de7bef1d3c2b72147b4a40797a.zip
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 <[email protected]>
Diffstat (limited to 'anim/tools')
-rw-r--r--anim/tools/chart.py39
1 files changed, 22 insertions, 17 deletions
diff --git a/anim/tools/chart.py b/anim/tools/chart.py
index ca783dc..9dd1314 100644
--- a/anim/tools/chart.py
+++ b/anim/tools/chart.py
@@ -11,29 +11,34 @@ sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."
import motion
W = motion.W
-# theme.layout (design revision 2): the state column is the same in every scene; the program
-# column is shared by the scene's split (lens, source, disassembly). The clock is over the caption.
-def panel(rows):
- return 36 + 24 * rows
+# The stage (design/README.md, "5. The frame"; theme.layout.split): the lens band across the
+# top, the program column (source over disassembly) and the state column (registers over
+# stack). A panel of n rows is 32 + 24 n. The clock is over the caption.
+def ph(rows):
+ return 32 + 24 * rows
-def split(lens, source, disasm):
- y = 48 + (lens + 12 if lens else 0)
- out = {"lens": (64, 48, 880, lens)} if lens else {}
- out["source"] = (64, y, 880, panel(source))
- out["disasm"] = (64, y + panel(source) + 12, 880, panel(disasm))
+def split(band, source, disasm, slots, backtrace=0):
+ top = 48 + (band + 12 if band else 0)
+ out = {"band": (64, 48, 1792, band)} if band else {}
+ out["source"] = (64, top, 880, ph(source))
+ out["disasm"] = (64, top + ph(source) + 12, 880, ph(disasm))
+ out["registers"] = (976, top, 880, ph(17))
+ out["stack"] = (976, top + ph(17) + 12, 880, ph(slots))
+ if backtrace:
+ out["backtrace"] = (976, top + ph(17) + 12 + ph(slots) + 12, 880, ph(backtrace))
return out
# The clock is under the name the instrument gives to words that are not panels ("head"):
# its progress line moves with every step and must not count as a panel starting.
-state = {"head": (0, 888, W, 46), "registers": (976, 48, 880, panel(18)), "stack": (976, 528, 880, panel(8)), "backtrace": (976, 768, 880, panel(3))}
-CAPTION = (0, 934, W, 146)
-beside, subject, none = split(312, 8, 10), split(432, 5, 8), split(0, 14, 17)
+words = {"head": (0, 888, W, 46), "caption": (0, 934, W, 146)}
+none, beside, subject = split(0, 14, 17, 8, 4), split(152, 8, 17, 8), split(248, 10, 11, 4)
motion.REGIONS.update({
- "fib": {**beside, **state, "caption": CAPTION},
- "sort": {**beside, **state, "caption": CAPTION},
- "syscalls": {**beside, **state, "caption": CAPTION},
- "list": {**subject, **state, "caption": CAPTION},
- "zoom": {**none, **state, "caption": CAPTION},
+ "fib": {**subject, **words},
+ "sort": {**subject, **words},
+ "syscalls": {**subject, **words},
+ "list": {**subject, **words},
+ "zoom": {**none, **words},
+ "gallery": {**beside, **words},
})
_regions_for = motion.regions_for
motion.regions_for = lambda video, name: _regions_for(video, name or os.path.basename(video).split("-")[0].split(".")[0])