diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-10 22:16:50 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-10 22:26:21 -0300 |
| commit | bbabc78dcfd00a98abb5ececae6761bccc496eb8 (patch) | |
| tree | 8a0ce667f7f3f1e5d11f567217e707ab0c78ae17 /design/mock/context.py | |
| parent | 8b5d0340c9f9b3168c67f04e57cfa03712ac992c (diff) | |
| download | computeranim-bbabc78dcfd00a98abb5ececae6761bccc496eb8.tar.gz computeranim-bbabc78dcfd00a98abb5ececae6761bccc496eb8.zip | |
design: four times the context on a 4K stage; the loupe; quieter marks
From the user, after the second videos. The stage is 3840 by 2160 at the
same type size: four columns (source, disassembly, state, stack), 69
lines, rows and slots with no lens, 43 with a lens as subject, dumps of
32 rows. Code reads at 1440p and up; the caption, the clock and a lens's
drawing are doubled, and the camera at x2 is the old frame. The stack's
rows carry their offset from rsp and a role. A loupe is the telescope as
a floating panel: the memory round what a pointer leads to, lifted over
the context, a pointer inside it opening the next. The current row is a
white wash, a strike a softened vermilion, held a turned corner; sheet 15
sets the alternatives side by side.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Diffstat (limited to 'design/mock/context.py')
| -rw-r--r-- | design/mock/context.py | 218 |
1 files changed, 152 insertions, 66 deletions
diff --git a/design/mock/context.py b/design/mock/context.py index 64603a2..303c7c1 100644 --- a/design/mock/context.py +++ b/design/mock/context.py @@ -43,6 +43,61 @@ def ph(rows): return TAG + 2 * PAD + rows * ROW +# ---- marks: the forms of `current`, `struck` and `held`. A is the first videos'; B the catalogue's now; C the +# other readings of "white, with less opacity" (mock 15 sets them side by side). +STYLE = {"current": "B", "struck": "B", "held": "B"} +WASH = mix(BRIGHT, PAGE, 0.10) # the current row: a white wash, opaque, a tenth of the way to bright +SOFT = mix(VERM, PAGE, 0.70) # a strike's paper, B + + +def band(): + """The paper across the current row.""" + return EMBER[GOLD] if STYLE["current"] == "A" else WASH + + +def current_row(g, x, y, w, plaque): + """The current mark on a row: the band across it and the plaque on its label. Returns the plaque's letters' ink.""" + g.rect(x, y, w, ROW, band()) + g.rect(x, y, plaque, ROW, BRIGHT if STYLE["current"] == "C" else GOLD) + return INK + + +def struck(g, x, y, w, h=ROW): + """A struck value's paper (x, w: the value's, 5 out each side). Returns its digits' ink.""" + st = STYLE["struck"] + if st == "A": + g.rect(x, y + 1, w, h - 2, VERM) + return INK + if st == "B": + g.rect(x, y + 1, w, h - 2, SOFT) + return BRIGHT + g.rect(x, y + 1, w, h - 2, mix(BRIGHT, PAGE, 0.18)) + g.frame(x, y + 1, w, h - 2, VERM, 2) + return BRIGHT + + +def held(g, x, y, w, h=ROW): + """Changed within three steps, at the value whose left is x (w wide) on the row at y.""" + st = STYLE["held"] + if st == "A": + g.rect(x - 9, y + 3, 4, h - 6, VERM) + elif st == "B": # a dog-ear: the corner of the value turned down + g.path(f"M{x - 4},{y + 2} h9 l-9,9 Z", fill=VERM) + else: # a bar under it, half strength + g.rect(x - 2, y + h - 4, w + 4, 2, mix(VERM, PAGE, 0.6)) + + +def held_cell(g, x, y, w, h, k=1): + """`held` on a lens's cell (k: the drawing's scale).""" + st = STYLE["held"] + if st == "A": + g.rect(x, y + h - 4 * k, w, 4 * k, VERM) + elif st == "B": + g.path(f"M{x},{y} h{12 * k} l{-12 * k},{12 * k} Z", fill=VERM) + else: + g.rect(x, y + h - 3 * k, w, 3 * k, mix(VERM, PAGE, 0.6)) + + def tag(g, x, y, w, h, title, focus=False, note=None): """A panel's frame and its one-row tag. note: a string, or runs (text, ink, underlined) for a legend.""" g.rect(x, y, w, TAG, RAISED) @@ -146,11 +201,10 @@ def chain(g, x, y, links, end, marks=None, room=None, lead=0): x = link_arrow(g, x, y) m = marks.get(i) if m == "strike": - g.rect(x - 5, y + 1, w + 10, ROW - 2, VERM) - addr(g, x, y, n, INK, BOLD) + addr(g, x, y, n, struck(g, x - 5, y, w + 10), BOLD) else: if m == "tick": - g.rect(x - 9, y + 3, 4, ROW - 6, VERM) + held(g, x, y, w) if m == "read": g.frame(x - 6, y, w + 12, ROW, READ, 2) addr(g, x, y, n, ink, lead=lead if i == 0 else 0) @@ -166,7 +220,7 @@ def chain(g, x, y, links, end, marks=None, room=None, lead=0): return where x = value_arrow(g, x, y) if links else x if marks.get("end") == "tick": # the value it holds changed within three steps - g.rect(x - 7, y + 3, 4, ROW - 6, VERM) + held(g, x + 2, y, len(str(end[1])) * A if end[0] == "int" else 3 * A) if end[0] == "int": integer(g, x, y, end[1]) else: @@ -186,11 +240,11 @@ def pin(g, x, y, names, ink): g.path(f"M{x + 9},{y + 12} l-9,-6 v12 Z", fill=ink) -def pin_up(g, cx, y, names, ink, size, link=None): +def pin_up(g, cx, y, names, ink, size, link=None, sw=3): """A register's name under what it points at: a stub with its head on the thing, the names either side. link: the points the stub is the end of, when this is the step that set the register.""" rise = size + 10 - gen.arrow(g, (link or []) + [(cx, y + rise), (cx, y + 1)], ink, 3, r=8, hl=10, hw=10) + gen.arrow(g, (link or []) + [(cx, y + rise), (cx, y + 1)], ink, sw, r=8, hl=10 + 2 * (sw - 3), hw=10 + 2 * (sw - 3)) face = BOLD by = y + 8 + size * 0.86 if names and names[0]: # names keep their side: None holds a side that was left @@ -215,37 +269,41 @@ def registers(g, y, regs, flags, marks): for i, (name, links, end) in enumerate(regs): yy = y0 + i * ROW if name == "rip": - g.rect(RX + 2, yy, CW - 4, ROW, EMBER[GOLD]) - g.rect(RX + 2, yy, 54, ROW, GOLD) - g.t(RX + 12, b(yy), name, S, INK, BOLD) + g.t(RX + 12, b(yy), name, S, current_row(g, RX + 2, yy, CW - 4, 54), BOLD) else: g.t(RX + 12, b(yy), name, S, DIM, MONO) where[name] = yy if links: chain(g, RX + 72, yy, links, end, marks.get(name), room=RX + CW - 12) else: + if marks.get(name, {}).get(0) == "strike": + s_ = ("0x%x" % end[1]) if end[1] >= 10 else str(end[1]) + g.t(RX + 72, b(yy), s_, S, struck(g, RX + 67, yy, len(s_) * A + 10), BOLD) + continue integer(g, RX + 72, yy, end[1]) if marks.get(name, {}).get(0) == "tick": - g.rect(RX + 63, yy + 3, 4, ROW - 6, VERM) + held(g, RX + 72, yy, len(str(end[1])) * A) # the flags, in rip's row: where the machine is, and the condition it is in x = RX + CW - 12 - len(flags) * 42 + 10 for name, on, changed in flags: if changed: - g.rect(x - 7, yy + 3, 4, ROW - 6, VERM) + held(g, x + 4, yy, 2 * A) if on: g.rect(x, yy + 2, 2 * A + 8, 20, RAISED) g.t(x + 4, b(yy), name, S, BRIGHT, BOLD) else: - g.t(x + 4, b(yy), name.lower(), S, mix(DIM, EMBER[GOLD], 0.8), MONO) + g.t(x + 4, b(yy), name.lower(), S, mix(DIM, band(), 0.8), MONO) x += 42 return where -def stack(g, y, rows, frames, note=None): +def stack(g, y, rows, frames, note=None, rsp=None, roles=None): """rows: (slot, pins, links, end[, marks]). frames: (name, first row, last row), newest first: the backtrace, drawn on the words that are each frame; a first row under 0 runs above the window. The window is the newest frame's. A frame's name is never cut for a chain: the chains on the rows it sits on end 12 - before it. Returns each row's y.""" + before it. rsp: the slots' offsets from it are drawn (pwndbg's column). roles: {row: (what the slot is, ink)}: + a local's name, `saved rbp`, `return`, ranged right where the chain's room ends; the chain ends 12 before it. + Returns each row's y.""" y0 = panel(g, RX, y, CW, len(rows), "stack", note=(note or "%s words from rsp" % {6: "six", 8: "eight"}[len(rows)]) + " · the frames they belong to") lead = shared([r[0] for r in rows]) @@ -264,13 +322,22 @@ def stack(g, y, rows, frames, note=None): room[r] = min(room.get(r, RX + CW - 136), nx - 12) spans.append((i, name, x, ya, yb, ny, open_top, open_)) ys = [] + roles = roles or {} + first = RX + (184 if rsp is not None else 122) for i, (slot, pins, links, end, *marks) in enumerate(rows): yy = y0 + i * ROW ys.append(yy) if pins: pin(g, RX + 10, yy, pins, STACK) - chain(g, RX + 122, yy, [(slot, STACK)] + links, end, marks[0] if marks else None, - room=room.get(i, RX + CW - 136), lead=lead) + if rsp is not None: # the offset from rsp, pwndbg's way: +18 + off = slot - rsp + g.t(RX + 172, b(yy), ("+%x" % off) if off >= 0 else ("-%x" % -off), S, FAINT, MONO, "end") + end_x = room.get(i, RX + CW - 136) + if i in roles: + text, ink = roles[i] + g.t(end_x, b(yy), text, S, ink, MONO, "end") + end_x -= len(text) * A + 12 + chain(g, first, yy, [(slot, STACK)] + links, end, marks[0] if marks else None, room=end_x, lead=lead) for i, name, x, ya, yb, ny, open_top, open_ in spans: ink = GOLD if i == 0 else RULE g.rect(x - 1, ya, 2, yb - ya, ink) @@ -319,14 +386,12 @@ def wide(total): def source(g, y, rows, lines, first, cur, trail, name, total): """Returns the y of the current line's row. Numbers as wide as the file's last: the text moves by the extra.""" w = wide(total) - y0 = panel(g, LX, y, CW, rows, name, note=f"lines {first} to {first + rows - 1} of {total}") + y0 = panel(g, LX, y, CW, rows, name, note=f"lines {first} to {min(first + rows - 1, total)} of {total}") for i in range(rows): n = first + i yy = y0 + i * ROW if n == cur: - g.rect(LX + 2, yy, CW - 4, ROW, EMBER[GOLD]) - g.rect(LX + 2, yy, 50 + w, ROW, GOLD) - g.t(LX + 46 + w, b(yy), str(n), S, INK, BOLD, "end") + g.t(LX + 46 + w, b(yy), str(n), S, current_row(g, LX + 2, yy, CW - 4, 50 + w), BOLD, "end") else: if n in trail: g.rect(LX + 2, yy + 1, 4, ROW - 2, TRAIL[min(trail.index(n), 2)]) @@ -352,16 +417,14 @@ def disasm(g, y, rows, func, cur_line, jump=None, w=0): yy = y0 + i * ROW where[a] = yy dim = st == "out" - if dim: # the function ends: a rule, and the next one's name + if dim or st == "other_first": # a function ends: a rule, and the next one's name g.rect(LX + 2, yy, CW - 4, 2, RULE) if st == "cur": - g.rect(LX + 2, yy, CW - 4, ROW, EMBER[GOLD]) - g.rect(LX + 2, yy, 24, ROW, GOLD) - g.path(f"M{LX + 20},{yy + 12} l-10,-6 v12 Z", fill=INK) + g.path(f"M{LX + 20},{yy + 12} l-10,-6 v12 Z", fill=current_row(g, LX + 2, yy, CW - 4, 24)) elif st and st.startswith("trail"): g.rect(LX + 2, yy + 1, 4, ROW - 2, TRAIL[int(st[-1])]) addr(g, LX + DX_ADDR, yy, a, mix(CODE, PAGE, 0.6) if dim else CODE, lead=0 if dim else lead) - if line != last_line and not dim: # the line this run of instructions was compiled from + if line is not None and line != last_line and not dim: # the line this run was compiled from on = line == cur_line g.t(LX + DX_LINE + 3 * A + w, b(yy), str(line), S, GOLD if on else FAINT, BOLD if on else MONO, "end") last_line = line @@ -400,30 +463,38 @@ def thread(g, ys, spans): # ---- the lens: a list, and beside it the bytes it is drawn from ------------------------- -def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=()): +def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=(), title="its bytes", x=None, + framed=(), bare=False, rows_shown=None): """`hexdump` by `fields`: the region a scene names, read by the fields it gives it, in the band's view. flist: (at, len, reads, big, mark) with reads in number | pointer | text | bytes. mem: {address: byte} of what the stop shown saw (or the kernel took); a byte not in it is unread. marks: the field marks framed as read. - Rows that hold no field are one `more` row and their count. The bytes begin 12 after the widest address.""" - tag(g, RX, y, CW, h, "its bytes") - g.t(RX + 28 + tw("its bytes", 20, "sansm") + 12, y + 18, about, 18, FAINT, "sans") + Rows that hold no field are one `more` row and their count. The bytes begin 12 after the widest address. + reads `malloc`: the allocator's size word, loose, read as a note. framed: (at, len) drawn with `attention`'s + bright frame (a loupe's target). bare: no tag (a loupe draws its own). rows_shown: the rows to show, when the + window is not every row that holds a field. Returns {row address: y}.""" + X = RX if x is None else x + if not bare: + tag(g, X, y, CW, h, title) + g.t(X + 28 + tw(title, 20, "sansm") + 12, y + 18, about, 18, FAINT, "sans") total = (length + 15) // 16 holds = lambda r: any(base + at < base + 16 * (r + 1) and base + at + n > base + 16 * r for at, n, *_ in flist) - shown = [r for r in range(total) if holds(r) or total <= (h - TAG - 2 * PAD) // ROW] + shown = rows_shown if rows_shown is not None else [r for r in range(total) if holds(r)] + ys = {} digits = max(len("%x" % (base + 16 * r)) for r in shown) shift = max(18 + digits * A + 12 - 132, 0) - bx = lambda i: RX + 132 + shift + i * 30 + (12 if i >= 8 else 0) + bx = lambda i: X + 132 + shift + i * 30 + (12 if i >= 8 else 0) lead = shared([base + 16 * r for r in shown]) if len(shown) > 1 else 0 yy, last = y + TAG + PAD, None for r in shown: if last is not None and r > last + 1: # the rows left out: one row, and how many - more(g, RX + 18 - 6, yy) - g.t(RX + 18 + 30 + 36, b(yy), "%d rows" % (r - last - 1), S, FAINT, MONO) + more(g, X + 18 - 6, yy) + g.t(X + 18 + 30 + 36, b(yy), "%d rows" % (r - last - 1), S, FAINT, MONO) yy += ROW last = r a0 = base + 16 * r - bracket(g, RX + 7, yy + 3, yy + ROW - 3, mix(region, PAGE, 0.6)) - addr(g, RX + 18, yy, a0, region, lead=lead) + ys[a0] = yy + bracket(g, X + 7, yy + 3, yy + ROW - 3, mix(region, PAGE, 0.6)) + addr(g, X + 18, yy, a0, region, lead=lead) runs, i = [], 0 while i < 16 and a0 + i < base + length: f = next((f for f in flist if base + f[0] <= a0 + i < base + f[0] + f[1]), None) @@ -433,12 +504,12 @@ def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=() n = min([base + o[0] - a0 for o in flist if a0 + i < base + o[0] < a0 + 16] + [16, base + length - a0]) - i runs.append((i, n, f)) i += n - x = RX + 640 + shift # the reading: a list, a character apart + x = X + 640 + shift # the reading: a list, a character apart for i0, n, f in runs: vals = [mem.get(a0 + k) for k in range(i0, i0 + n)] reads = f[2] if f else "loose" x0, x1 = bx(i0) - 4, bx(i0 + n - 1) + 28 - if f: + if f and reads != "malloc": g.rect(x0, yy + 1, x1 - x0, ROW - 2, RAISED) if f[4] is not None and f[4] in marks: g.frame(x0 - 3, yy - 1, x1 - x0 + 6, ROW + 2, READ, 2) @@ -448,8 +519,11 @@ def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=() order = vals[::-1] if not (f and f[3]) else vals for v in order: word = word << 8 | v - ink = {"number": VELLUM, "bytes": VELLUM, "text": LIT, "loose": DIM, - "pointer": region_of(word) if known else VELLUM}[reads] + for fa, fl in framed: # the target: framed bright, as attention + if base + fa < a0 + i0 + n and base + fa + fl > a0 + i0: + g.frame(x0 - 3, yy - 1, x1 - x0 + 6, ROW + 2, BRIGHT, 2) + ink = {"number": VELLUM, "bytes": VELLUM, "text": LIT, "loose": DIM, "malloc": DIM, + "pointer": (region_of(word) or VELLUM) if known else VELLUM}[reads] nz = [k for k, v in enumerate(vals) if v] for k, v in enumerate(vals): xx = bx(i0 + k) @@ -461,21 +535,30 @@ def fields(g, y, h, about, base, length, flist, mem, region, region_of, marks=() g.t(xx, b(yy), "%02x" % v, S, mix(ink, PAGE, 0.45) if padded else ink, MONO) if not known or reads in ("bytes", "loose"): continue + if reads == "malloc": # the allocator's own: the size word of the chunk after it + note = "malloc's: a chunk of %d" % (word & ~7) if word < 0x10000 else "malloc's: the top chunk" + g.t(x, b(yy) - 1, note, 18, FAINT, "sans") + x += tw(note, 18, "sans") + A + continue if reads == "pointer": if word == 0: s_, sink = "NULL", DIM else: - x = addr(g, link_arrow(g, x, yy), yy, word, region_of(word)) + A + x = addr(g, link_arrow(g, x, yy), yy, word, region_of(word) or VELLUM) + A continue elif reads == "number": s_, sink = str(word), VELLUM else: s_, sink = '"' + bytes(vals).split(b"\0")[0].decode("latin1") + '"', LIT - if x + len(s_) * A > RX + CW - 12: - s_ = s_[:max(int((RX + CW - 12 - x) // A) - 1, 0)] + "…" + if x + len(s_) * A > X + CW - 12: + s_ = s_[:max(int((X + CW - 12 - x) // A) - 1, 0)] + "…" g.t(x, b(yy), s_, S, sink, MONO) x += (len(s_) + 1) * A yy += ROW + if shown and shown[-1] < total - 1: # the rows after the last field: one row, and how many + more(g, X + 18 - 6, yy) + g.t(X + 18 + 30 + 36, b(yy), "%d rows" % (total - 1 - shown[-1]), S, FAINT, MONO) + return ys def kernel(g, y, h, calls, name, nr, rows, given): @@ -524,7 +607,7 @@ def dump_row(g, y, a, runs, lead, mark=None, node=False): if mark.get("read") == k: g.frame(x0 - 3, y - 1, x1 - x0 + 6, ROW + 2, READ, 2) if mark.get("tick") == k: - g.rect(x0 - 7, y + 3, 4, ROW - 6, VERM) + held(g, x0 + 4, y, x1 - x0 - 8) ink = {"value": VELLUM, "next": HEAP, "malloc": DIM, "unread": FAINT}[kind] top = max((j for j in range(n) if (v or 0) >> (8 * j) & 0xff), default=0) for j in range(n): @@ -548,26 +631,30 @@ def dump_row(g, y, a, runs, lead, mark=None, node=False): g.t(x + 3 * A + 8 + 30, b(y), "NULL", S, DIM, MONO) -def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject=False): +def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject=False, dw=None, k=1, view_rows=None): """The band: the list drawn, over the program column, and the heap bytes it is drawn from, over the state column; two panels, h and hv high, the gutter between them the ties'. nodes: (address, value, next address or 0), in the list's order. pins: {address: [registers]}. marks: {"read": address of a word, "tick": [addresses of words]}. link_from: the y of the register row the step's link comes from, and the register. - As the subject the drawing is a size up; the dump stays on the context's grid and shows more rows.""" - tag(g, LX, y, CW, h, "the list", focus=True) + As the subject the drawing is a size up; the dump stays on the context's grid and shows more rows. + On the 4K stage the drawing is dw wide and drawn k times the size (2), and the view is drawn by `fields`, whose + rows (view_rows: {row address: y}) the projection starts from.""" + dw = dw or CW + tag(g, LX, y, dw, h, "the list", focus=True) last = first + (nrows - 1) * 16 - tag(g, RX, y, CW, hv, "its bytes", - note=[("value", VELLUM, False), ("next", HEAP, False), ("malloc's", DIM, False), ("never read", FAINT, False)]) - g.t(RX + 28 + tw("its bytes", 20, "sansm") + 12, y + 18, "the heap, %x to %x" % (first, last + 15), 18, FAINT, - "sans") + rows = view_rows or {} + if view_rows is None: + tag(g, RX, y, CW, hv, "its bytes", + note=[("value", VELLUM, False), ("next", HEAP, False), ("malloc's", DIM, False), ("never read", FAINT, False)]) + g.t(RX + 28 + tw("its bytes", 20, "sansm") + 12, y + 18, "the heap, %x to %x" % (first, last + 15), 18, FAINT, + "sans") # the dump y0 = y + TAG + PAD by_addr = {a: (v, nx) for a, v, nx in nodes} lead = shared([first, last]) - rows = {} - for i in range(nrows): + for i in range(nrows if view_rows is None else 0): a, yy = first + i * 16, y0 + i * ROW rows[a] = yy if a in by_addr: @@ -584,12 +671,13 @@ def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject= dump_row(g, yy, a, [(0, 8, "unread", None), (8, 8, "malloc", 0x21)], lead) # the drawing, centred between its lanes - NW, NH, GAP, VS, LS = (124, 72, 22, 45, 25) if subject else (116, 44, 28, 25, 20) - VW = NW - 48 # the value's half; the pointer's is 48 - x0 = LX + (CW - len(nodes) * NW - (len(nodes) - 1) * GAP) / 2 + NW, NH, GAP, VS, LS = [v * k for v in ((124, 72, 22, 45, 25) if subject else (116, 44, 28, 25, 20))] + VW = NW - 48 * k # the value's half; the pointer's is 48 + tie_w = (3, 2) if k == 1 else (4, 3) # a link, a projection: on the 4K stage, 2 and 1.5 pixels at 1080p + x0 = LX + (dw - len(nodes) * NW - (len(nodes) - 1) * GAP) / 2 lane_top, lane_bot = y + TAG + 4, y + h - 8 block = LS * 1.2 + 4 + NH + LS + 10 + 8 # address, node, the pins' stub and names - ly = y + TAG + (16 if not subject else round((h - TAG - block) / 2)) # the row of addresses over the nodes + ly = y + TAG + (16 * k if not subject else round((h - TAG - block) / 2)) # the row of addresses over the nodes ny = ly + LS * 1.2 + 4 xs = {a: x0 + i * (NW + GAP) for i, (a, v, nx) in enumerate(nodes)} for a, v, nx in nodes: @@ -599,22 +687,22 @@ def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject= g.t(x + VW / 2 - 1, ny + NH / 2 + 0.36 * VS, str(v), VS, VELLUM, MONO if VS < 30 else "mono", "middle") g.rect(x + VW, ny, NW - VW, NH, WELL) if marks.get("read") == a + 8: - g.frame(x + VW - 2, ny - 2, NW - VW + 4, NH + 4, READ, 2) + g.frame(x + VW - 2 * k, ny - 2 * k, NW - VW + 4 * k, NH + 4 * k, READ, 2 * k) if a + 8 in marks.get("tick", ()): - g.rect(x + VW, ny + NH - 4, NW - VW, 4, VERM) + held_cell(g, x + VW, ny, NW - VW, NH, k) cx, cy = x + VW + (NW - VW) / 2, ny + NH / 2 if nx: - g.rect(cx - 5, cy - 5, 10, 10, HEAP) - gen.arrow(g, [(cx + 8, cy), (xs[nx] - 3, cy)], HEAP, 3, hl=12, hw=10) + g.rect(cx - 5 * k, cy - 5 * k, 10 * k, 10 * k, HEAP) + gen.arrow(g, [(cx + 8 * k, cy), (xs[nx] - 3 * k, cy)], HEAP, 3 * k, hl=12 * k, hw=10 * k) else: - g.path(f"M{x + VW + 10},{ny + NH - 8} L{x + NW - 10},{ny + 8}", DIM, 2) + g.path(f"M{x + VW + 10 * k},{ny + NH - 8 * k} L{x + NW - 10 * k},{ny + 8 * k}", DIM, 2 * k) names = pins.get(a) if names: via = None if link_from and link_from[1] in names: # the step's link ends in this pin via = [(RX + 2, link_from[0] + 12), (LANE_LINK, link_from[0] + 12), (LANE_LINK, lane_bot), (x + NW / 2, lane_bot)] - pin_up(g, x + NW / 2, ny + NH, names, HEAP, LS, via) + pin_up(g, x + NW / 2, ny + NH, names, HEAP, LS, via, sw=tie_w[0]) # the projection: the bytes a step read, and the part of the drawing that is those bytes if marks.get("read"): @@ -623,7 +711,7 @@ def lens(g, y, h, hv, nodes, pins, marks, first, nrows, link_from=None, subject= bracket(g, RX + 7, yy + 2, yy + ROW - 2, READ, 3, 6) g.path(f"M{RX + 6},{yy + 12} H{LANE_VIEW + 6} Q{LANE_VIEW},{yy + 12} {LANE_VIEW},{yy + 6} V{lane_top + 6} " f"Q{LANE_VIEW},{lane_top} {LANE_VIEW - 6},{lane_top} H{x + NW / 2 + 6} " - f"Q{x + NW / 2},{lane_top} {x + NW / 2},{lane_top + 6} V{ly - 4}", READ, 2) + f"Q{x + NW / 2},{lane_top} {x + NW / 2},{lane_top + 6} V{ly - 4}", READ, tie_w[1]) g.rect(x, ly - 5, NW, 3, READ) g.rect(x, ly - 5, 3, 8, READ) g.rect(x + NW - 3, ly - 5, 3, 8, READ) @@ -848,9 +936,7 @@ def backtrace(g, y, h, frames, x=RX, note="the calls waiting · newest on top", for i, (name, args, file, line) in enumerate(frames[:rows]): yy = y0 + i * ROW if i == 0: - g.rect(x + 2, yy, CW - 4, ROW, EMBER[GOLD]) - g.rect(x + 2, yy, 40, ROW, GOLD) - g.t(x + 12, b(yy), "#0", S, INK, BOLD) + g.t(x + 12, b(yy), "#0", S, current_row(g, x + 2, yy, CW - 4, 40), BOLD) else: g.t(x + 12, b(yy), "#%d" % i, S, FAINT, MONO) g.t(x + 60, b(yy), name, S, VELLUM, MONO) |
