135 lines
6.6 KiB
XML
135 lines
6.6 KiB
XML
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 760 230" width="760" height="230"
|
|
role="img" aria-labelledby="dc-title">
|
|
<title id="dc-title">Die prozedurale Fassung: in einem einzigen main() wird IO.readln() aufgerufen, dessen Ergebnis an rot13() übergeben und dieses Ergebnis an IO.println(). Ein Thread, ein Prozess, drei direkte Aufrufe.</title>
|
|
<style><![CDATA[
|
|
/* figures/diagram.css -- shared look of every built figure.
|
|
*
|
|
* build-figures.py drops this file into the style element of every built
|
|
* svg, so a figure carries its own styling and stays self-contained.
|
|
* Classes, not per-element fills, do the work: one edit here restyles the
|
|
* whole book.
|
|
*
|
|
* Colours are the extension's tokens (_extensions/notes/theme.css) with a
|
|
* literal fallback, which covers all three ways a figure is seen:
|
|
*
|
|
* - inlined into the page by figures/flow-player.html: the tokens resolve
|
|
* against the page, so the figure follows light, night and high contrast;
|
|
* - as a plain <img> (JavaScript off): the fallback applies, and night mode
|
|
* comes from the extension's invert filter on main img[src$=".svg"];
|
|
* - in the pdf: librsvg ignores var() and uses the fallback, so print gets
|
|
* the light palette -- which is what a printed page wants.
|
|
*
|
|
* The fallbacks are this book's own light values; the tokens carry the night
|
|
* and high-contrast ones. Nothing here keys off prefers-color-scheme: the
|
|
* page's toggle decides, never the reader's system setting.
|
|
*/
|
|
|
|
svg {
|
|
font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
|
|
/* the figure sits on the page, not on a white card of its own */
|
|
background: transparent;
|
|
}
|
|
|
|
/* ---- surfaces ------------------------------------------------------- */
|
|
|
|
.box { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
|
.box-weak { fill: var(--calc-faint, #eef3f7); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
|
.box-accent { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
|
.box-warn { fill: var(--calc-faint, #f8f1e0); stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.4; }
|
|
.box-plain { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-grid, #dae0e8); stroke-width: 1.2; }
|
|
.diamond { fill: var(--calc-faint, #e5eff1); stroke: var(--calc-notecolor, #20666f); stroke-width: 1.4; }
|
|
.ellipse { fill: var(--calc-surface, #fbfcfd); stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; }
|
|
|
|
/* ---- lines ---------------------------------------------------------- */
|
|
|
|
.edge { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.3; }
|
|
.edge-strong{ fill: none; stroke: var(--calc-notecolor, #20666f); stroke-width: 1.8; }
|
|
.edge-warn { fill: none; stroke: var(--calc-accent-b, #D1541F); stroke-width: 1.6; }
|
|
.edge-dash { fill: none; stroke: var(--calc-muted, #5a6879); stroke-width: 1.2; stroke-dasharray: 5 3; }
|
|
.rule { stroke: var(--calc-grid, #dae0e8); stroke-width: 1; }
|
|
|
|
/* ---- text ----------------------------------------------------------- */
|
|
|
|
.t { fill: var(--calc-ink, #1b2430); font-size: 13px; }
|
|
.t-sm { fill: var(--calc-ink, #1b2430); font-size: 11px; }
|
|
.t-lead { fill: var(--calc-ink, #1b2430); font-size: 14px; font-weight: 600; }
|
|
.t-mut { fill: var(--calc-muted, #5a6879); font-size: 11px; }
|
|
.t-key { fill: var(--calc-ink, #1b2430); font-size: 12px; text-decoration: underline; }
|
|
.t-accent { fill: var(--calc-notecolor, #20666f); font-size: 12px; font-weight: 600; }
|
|
.t-warn { fill: var(--calc-accent-b, #D1541F); font-size: 12px; font-weight: 600; }
|
|
.t-mono { fill: var(--calc-ink, #1b2430); font-size: 11.5px;
|
|
font-family: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace; }
|
|
|
|
.mid { text-anchor: middle; }
|
|
.end { text-anchor: end; }
|
|
|
|
/* ---- interaction ====================================================
|
|
* A .node groups one box with its labels. Hovering it lifts the whole group
|
|
* a little, which is enough to follow a path through a busy diagram without
|
|
* any script. Pointer events stay off the decorative layers so the hover
|
|
* target is the shape itself.
|
|
*/
|
|
|
|
.node { transition: opacity .12s ease; }
|
|
.node:hover .box,
|
|
.node:hover .box-accent,
|
|
.node:hover .diamond { stroke-width: 2.6; }
|
|
.node:hover .t, .node:hover .t-lead { fill: var(--calc-notecolor, #20666f); }
|
|
|
|
svg:hover .node:not(:hover) { opacity: .55; }
|
|
|
|
/* a figure that marks no nodes must not dim on hover */
|
|
svg:not(:has(.node)) .node { opacity: 1; }
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.node { transition: none; }
|
|
}
|
|
|
|
/* ---- arrowheads ======================================================
|
|
* marker contents cannot inherit the referencing element's fill, so each
|
|
* arrowhead is its own class and is themed alongside the line it ends.
|
|
*/
|
|
|
|
.arrow { fill: var(--calc-muted, #5a6879); }
|
|
.arrow-strong { fill: var(--calc-notecolor, #20666f); }
|
|
.arrow-warn { fill: var(--calc-accent-b, #D1541F); }
|
|
|
|
]]></style>
|
|
|
|
<defs>
|
|
<marker id="a" viewBox="0 0 10 10" refX="9" refY="5"
|
|
markerWidth="6.5" markerHeight="6.5" orient="auto-start-reverse">
|
|
<path class="arrow" d="M0,0 L10,5 L0,10 z"/>
|
|
</marker>
|
|
</defs>
|
|
|
|
<!-- everything happens inside one main(), on one thread -->
|
|
<rect class="box-plain" x="14" y="16" width="732" height="126" rx="4"/>
|
|
<text class="t-mut" data-label="frame" x="26" y="36">ein Prozess · ein Thread · ein main()</text>
|
|
|
|
<g class="node" data-flow-node="read">
|
|
<rect class="box" x="40" y="58" width="170" height="52" rx="3"/>
|
|
<text class="t-mono mid" data-label="read" x="125" y="90">IO.readln()</text>
|
|
</g>
|
|
|
|
<path class="edge" data-flow="1" data-flow-to="rot" d="M210,84 H298" marker-end="url(#a)"/>
|
|
<text class="t-accent mid" data-label="call1" x="254" y="72">Aufruf</text>
|
|
|
|
<g class="node" data-flow-node="rot">
|
|
<rect class="box" x="300" y="58" width="170" height="52" rx="3"/>
|
|
<text class="t-mono mid" data-label="rot" x="385" y="90">rot13(text)</text>
|
|
</g>
|
|
|
|
<path class="edge" data-flow="2" data-flow-to="print" d="M470,84 H558" marker-end="url(#a)"/>
|
|
<text class="t-accent mid" data-label="call2" x="514" y="72">Aufruf</text>
|
|
|
|
<g class="node" data-flow-node="print">
|
|
<rect class="box" x="560" y="58" width="170" height="52" rx="3"/>
|
|
<text class="t-mono mid" data-label="print" x="645" y="90">IO.println(…)</text>
|
|
</g>
|
|
|
|
<!-- who knows whom -->
|
|
<text class="t-sm" data-label="knows" x="14" y="176">main() kennt alle drei: ihre Namen, Argument- und Ergebnistypen und dass sie sofort verfügbar sind.</text>
|
|
<text class="t-mut" data-label="cost" x="14" y="202">Die Verdrahtung steht im Code selbst — Schritt 1.</text>
|
|
</svg>
|