@knowvah/dot-engine 2.10.0 → 2.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/gvc/context.d.ts +7 -1
- package/dist/gvc/context.d.ts.map +1 -1
- package/dist/gvc/device.d.ts +2 -3
- package/dist/gvc/device.d.ts.map +1 -1
- package/dist/gvc/emit-xdot.d.ts +11 -0
- package/dist/gvc/emit-xdot.d.ts.map +1 -0
- package/dist/gvc/init-xdot.d.ts +7 -0
- package/dist/gvc/init-xdot.d.ts.map +1 -0
- package/dist/gvc/landscape.d.ts +11 -0
- package/dist/gvc/landscape.d.ts.map +1 -0
- package/dist/gvc/layout-bb.d.ts +17 -0
- package/dist/gvc/layout-bb.d.ts.map +1 -0
- package/dist/gvc/layout-reset.d.ts +26 -0
- package/dist/gvc/layout-reset.d.ts.map +1 -0
- package/dist/gvc/usershape.d.ts +0 -2
- package/dist/gvc/usershape.d.ts.map +1 -1
- package/dist/gvc/viewport.d.ts +1 -10
- package/dist/gvc/viewport.d.ts.map +1 -1
- package/dist/index.js +1514 -768
- package/dist/index.js.map +4 -4
- package/dist/layout/circo/blocks.d.ts +2 -0
- package/dist/layout/circo/blocks.d.ts.map +1 -1
- package/dist/layout/circo/blocktree.d.ts +6 -0
- package/dist/layout/circo/blocktree.d.ts.map +1 -1
- package/dist/layout/circo/circular.d.ts +6 -0
- package/dist/layout/circo/circular.d.ts.map +1 -1
- package/dist/layout/dot/edge-route-rank.d.ts +34 -0
- package/dist/layout/dot/edge-route-rank.d.ts.map +1 -1
- package/dist/layout/dot/index.d.ts.map +1 -1
- package/dist/layout/dot/init.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat-labeled.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat-multi.d.ts.map +1 -1
- package/dist/layout/dot/splines-flat.d.ts +1 -2
- package/dist/layout/dot/splines-flat.d.ts.map +1 -1
- package/dist/layout/dot/splines.d.ts +2 -2
- package/dist/layout/dot/splines.d.ts.map +1 -1
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.d.ts +12 -0
- package/dist/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.d.ts.map +1 -0
- package/dist/layout/neato/dijkstra.d.ts +7 -0
- package/dist/layout/neato/dijkstra.d.ts.map +1 -1
- package/dist/layout/neato/splines.d.ts +7 -3
- package/dist/layout/neato/splines.d.ts.map +1 -1
- package/dist/layout/pack/ccomps.d.ts +32 -0
- package/dist/layout/pack/ccomps.d.ts.map +1 -0
- package/dist/layout/pack/index.d.ts +1 -24
- package/dist/layout/pack/index.d.ts.map +1 -1
- package/dist/layout/sfdp/init.d.ts.map +1 -1
- package/dist/render/dot/write-back.d.ts +37 -0
- package/dist/render/dot/write-back.d.ts.map +1 -0
- package/dist/render/dot.d.ts +5 -7
- package/dist/render/dot.d.ts.map +1 -1
- package/dist/render/json.d.ts +16 -21
- package/dist/render/json.d.ts.map +1 -1
- package/dist/render.js +1757 -1011
- package/dist/render.js.map +4 -4
- package/dist/util/libcxx-sort.d.ts +7 -0
- package/dist/util/libcxx-sort.d.ts.map +1 -0
- package/dist/vpsc/SweepLine.d.ts +2 -2
- package/dist/vpsc/SweepLine.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/gvc/__fixtures__/replay-native.json +422 -0
- package/src/gvc/__fixtures__/rerender/background.dot.seq-xdot-svg.1 +25 -0
- package/src/gvc/__fixtures__/rerender/background.dot.seq-xdot-svg.2 +37 -0
- package/src/gvc/__fixtures__/rerender/background.gv +1 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.xdot.1 +25 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.dot.xdot.2 +25 -0
- package/src/gvc/__fixtures__/rerender/cluster-lrvn.gv +1 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.plain.1 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.plain.2 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-dot-dot.1 +18 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-dot-dot.2 +18 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-plain-xdot.1 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-plain-xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-dot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-dot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-plain.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-plain.2 +7 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-svg.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-svg.2 +46 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-then-svg.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-then-svg.2 +47 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-xdot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.seq-xdot-xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.xdot.1 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.dot.xdot.2 +33 -0
- package/src/gvc/__fixtures__/rerender/cluster-skeleton.gv +1 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.circo.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-circo.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-fdp.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.plain.then-neato.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-dot-dot.1 +11 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-dot-dot.2 +11 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-json-json.1 +148 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-json-json.2 +162 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-plain-xdot.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-plain-xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-dot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-dot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-plain.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-svg.2 +30 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-then-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-then-svg.2 +31 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.seq-xdot-xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.dot.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.fdp.xdot.2 +21 -0
- package/src/gvc/__fixtures__/rerender/filing.gv +1 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.seq-xdot-then-svg.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.seq-xdot-then-svg.2 +31 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.neato.xdot.2 +21 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.osage.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.patchwork.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.sfdp.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.1 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.2 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.plain.nofree.3 +5 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.xdot.1 +20 -0
- package/src/gvc/__fixtures__/rerender/filing.twopi.xdot.2 +20 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.circo.xdot.2 +104 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-dot-dot.1 +75 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-dot-dot.2 +75 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-plain-xdot.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-plain-xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-dot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-dot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-plain.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-svg.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-svg.2 +127 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-then-svg.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-then-svg.2 +128 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-xdot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.seq-xdot-xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.xdot.1 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.dot.xdot.2 +119 -0
- package/src/gvc/__fixtures__/rerender/mixed.fdp.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.fdp.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.gv +8 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.neato.xdot.2 +118 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.xdot.1 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.osage.xdot.2 +117 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.xdot.1 +78 -0
- package/src/gvc/__fixtures__/rerender/mixed.patchwork.xdot.2 +79 -0
- package/src/gvc/__fixtures__/rerender/mixed.sfdp.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.sfdp.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.plain.1 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.xdot.1 +103 -0
- package/src/gvc/__fixtures__/rerender/mixed.twopi.xdot.2 +103 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.dot.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.fdp.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.gv +16 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.1 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.2 +29 -0
- package/src/gvc/__fixtures__/rerender/multi-edge.patchwork.plain.nofree.3 +29 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.gv +1 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-dot-plain.1 +34 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-dot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json-plain.1 +471 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json0-plain.1 +121 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-json0-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-xdot-plain.1 +60 -0
- package/src/gvc/__fixtures__/rerender/neato-pos.neato.seq-xdot-plain.2 +18 -0
- package/src/gvc/__fixtures__/rerender/regen.sh +81 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.gv +18 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.neato.xdot.1 +86 -0
- package/src/gvc/__fixtures__/rerender/sized-clip.neato.xdot.2 +86 -0
- package/src/gvc/context.ts +13 -1
- package/src/gvc/device.ts +6 -6
- package/src/gvc/emit-xdot.ts +208 -0
- package/src/gvc/init-xdot.ts +36 -0
- package/src/gvc/landscape.ts +36 -0
- package/src/gvc/layout-bb.ts +43 -0
- package/src/gvc/layout-reset.ts +62 -0
- package/src/gvc/usershape.ts +0 -5
- package/src/gvc/viewport.ts +1 -32
- package/src/layout/circo/__fixtures__/root/both-connected.gv +11 -0
- package/src/layout/circo/__fixtures__/root/both-connected.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/both-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.gv +18 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.xdot +97 -0
- package/src/layout/circo/__fixtures__/root/both-per-component.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.gv +11 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/graph-none-node.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-first.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-later.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.gv +17 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/graph-root-none.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.gv +7 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.xdot +46 -0
- package/src/layout/circo/__fixtures__/root/graph-root-paths.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.gv +9 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.xdot +51 -0
- package/src/layout/circo/__fixtures__/root/no-root-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/no-root.gv +16 -0
- package/src/layout/circo/__fixtures__/root/no-root.xdot +95 -0
- package/src/layout/circo/__fixtures__/root/no-root.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.gv +10 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.xdot +52 -0
- package/src/layout/circo/__fixtures__/root/node-root-connected.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.gv +10 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.xdot +52 -0
- package/src/layout/circo/__fixtures__/root/node-root-false.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.gv +17 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.xdot +96 -0
- package/src/layout/circo/__fixtures__/root/node-root-later.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.gv +11 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.xdot +53 -0
- package/src/layout/circo/__fixtures__/root/node-root-two.xdot.stderr +0 -0
- package/src/layout/circo/__fixtures__/root/regen.sh +16 -0
- package/src/layout/circo/blocks.ts +3 -0
- package/src/layout/circo/blocktree.ts +17 -3
- package/src/layout/circo/circular.ts +13 -1
- package/src/layout/dot/edge-route-rank.ts +72 -0
- package/src/layout/dot/edge-route.ts +6 -6
- package/src/layout/dot/index.ts +2 -0
- package/src/layout/dot/init.ts +17 -5
- package/src/layout/dot/splines-flat-labeled.ts +2 -1
- package/src/layout/dot/splines-flat-multi.ts +2 -1
- package/src/layout/dot/splines-flat.ts +3 -3
- package/src/layout/dot/splines.ts +9 -9
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.xdot +115 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.xdot +116 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/hier-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiter3.xdot.stderr +3 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.gv +19 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.xdot +103 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/kk-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.gv +16 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.xdot +100 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.xdot +106 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-cluster.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3-pin.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/major-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/regen.sh +16 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.gv +17 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.xdot +101 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-default.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-epsilon.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiter3.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-maxiterneg.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.gv +18 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.xdot +102 -0
- package/src/layout/neato/__fixtures__/multi-component-attrs/sgd-stresswt.xdot.stderr +0 -0
- package/src/layout/neato/__fixtures__/quad-prog-vpsc-dir1-n40.ts +14 -0
- package/src/layout/neato/dijkstra.ts +12 -3
- package/src/layout/neato/splines.ts +18 -18
- package/src/layout/pack/ccomps.ts +131 -0
- package/src/layout/pack/index.ts +1 -95
- package/src/layout/sfdp/__fixtures__/start-warning/regen.sh +16 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-5.xdot.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-random5.xdot.stderr +0 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-regular.xdot.stderr +1 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.gv +16 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.xdot +78 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self-label-scheme.xdot.stderr +2 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.gv +15 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.xdot +77 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-self.xdot.stderr +1 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.gv +14 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.xdot +76 -0
- package/src/layout/sfdp/__fixtures__/start-warning/start-unset.xdot.stderr +0 -0
- package/src/layout/sfdp/index.ts +1 -1
- package/src/layout/sfdp/init.ts +9 -1
- package/src/layout/twopi/index.ts +1 -1
- package/src/render/dot/agwrite.ts +1 -1
- package/src/render/dot/write-back.ts +137 -0
- package/src/render/dot.ts +12 -12
- package/src/render/json.ts +34 -34
- package/src/util/libcxx-sort.ts +461 -0
- package/src/vpsc/SweepLine.ts +11 -12
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# SPDX-License-Identifier: EPL-2.0
|
|
3
|
+
# Regenerates these part-9 T11 fixtures from native graphviz 16.1.0 (oracle/16.1.0), libgvc in one
|
|
4
|
+
# process: gvLayout, gvRenderData, gvFreeLayout on one graph, as twice.c does. One file per render:
|
|
5
|
+
# <case>.<engine>.<fmt>.<n> render n of 2, with gvFreeLayout between them
|
|
6
|
+
# <case>.<engine>.<fmt>.nofree.<n> render n of 3, with no gvFreeLayout
|
|
7
|
+
# <case>.<engine>.<fmt>.then-<e>.2 render 2 with engine <e>
|
|
8
|
+
# <case>.<engine>.seq-<name>.<n> render n of a twice.c seq: script, named after its formats
|
|
9
|
+
#
|
|
10
|
+
# Usage: GVBINDIR=<full plugin dir> bash regen.sh
|
|
11
|
+
set -eu
|
|
12
|
+
G=${G:-$HOME/git/graphviz}
|
|
13
|
+
B=$G/build
|
|
14
|
+
here=$(cd "$(dirname "$0")" && pwd)
|
|
15
|
+
harness=$here/../../../../plans/post-16-1-followups-9/harness/T11
|
|
16
|
+
tmp=$(mktemp -d)
|
|
17
|
+
trap 'rm -rf "$tmp"' EXIT
|
|
18
|
+
clang -O1 -o "$tmp/twice-native" "$harness/twice.c" -I"$G/lib/gvc" -I"$G/lib/cgraph" -I"$G/lib/common" \
|
|
19
|
+
-I"$G/lib/pathplan" -I"$G/lib/cdt" -I"$G/lib" -I"$B" -I"$B/lib/common" -I"$B/lib/gvc" \
|
|
20
|
+
-L"$B/lib/gvc" -L"$B/lib/cgraph" -L"$B/lib/cdt" -lgvc -lcgraph -lcdt -Wl,-rpath,"$B/lib/gvc" \
|
|
21
|
+
-Wl,-rpath,"$B/lib/cgraph" -Wl,-rpath,"$B/lib/cdt" -Wl,-rpath,"$B/lib/pathplan" -Wl,-rpath,"$B/lib/xdot"
|
|
22
|
+
cd "$here"
|
|
23
|
+
|
|
24
|
+
# split <output of twice-native print> <file prefix>: one file per "== render N" section.
|
|
25
|
+
split() {
|
|
26
|
+
awk -v p="$2" '/^== render [0-9]$/ { f = p "." $3; printf "" > f; next } { print > f }' "$1"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
run() { # <case> <engine> <fmt> <mode> <prefix>
|
|
30
|
+
"$tmp/twice-native" "$1.gv" "$2" "$3" "$4" > "$tmp/out"
|
|
31
|
+
split "$tmp/out" "$5"
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
ALL="dot neato fdp sfdp circo twopi osage patchwork"
|
|
35
|
+
for e in $ALL; do
|
|
36
|
+
run filing "$e" plain 2 "filing.$e.plain"
|
|
37
|
+
run filing "$e" xdot 2 "filing.$e.xdot"
|
|
38
|
+
run mixed "$e" plain 2 "mixed.$e.plain"
|
|
39
|
+
done
|
|
40
|
+
# Native does not repeat these; see NATIVE_REPEATS_NOT in rerender.test.ts. Render 2 of mixed.fdp varies
|
|
41
|
+
# between native runs, so it would not regenerate.
|
|
42
|
+
rm -f mixed.fdp.plain.2 mixed.sfdp.plain.2
|
|
43
|
+
for c in cluster-skeleton cluster-lrvn; do
|
|
44
|
+
run "$c" dot plain 2 "$c.dot.plain"
|
|
45
|
+
run "$c" dot xdot 2 "$c.dot.xdot"
|
|
46
|
+
done
|
|
47
|
+
for e in $ALL; do
|
|
48
|
+
run filing "$e" plain nofree "filing.$e.plain.nofree"
|
|
49
|
+
done
|
|
50
|
+
# Native does not finish a no-free multi-edge.gv under neato, sfdp, circo, twopi or osage (over 8 s).
|
|
51
|
+
for e in dot fdp patchwork; do
|
|
52
|
+
run multi-edge "$e" plain nofree "multi-edge.$e.plain.nofree"
|
|
53
|
+
done
|
|
54
|
+
for e in neato fdp circo; do
|
|
55
|
+
run filing dot plain "then:$e" "filing.dot.plain.then-$e"
|
|
56
|
+
rm -f "filing.dot.plain.then-$e.1"
|
|
57
|
+
done
|
|
58
|
+
seq() { # <case> <engine> <name> <script>
|
|
59
|
+
run "$1" "$2" unused "seq:$4" "$1.$2.seq-$3"
|
|
60
|
+
}
|
|
61
|
+
for c in filing mixed cluster-skeleton; do
|
|
62
|
+
seq "$c" dot xdot-svg l,xdot,svg,f
|
|
63
|
+
seq "$c" dot xdot-xdot l,xdot,xdot,f
|
|
64
|
+
seq "$c" dot xdot-plain l,xdot,f,l,plain,f
|
|
65
|
+
seq "$c" dot plain-xdot l,plain,f,l,xdot,f
|
|
66
|
+
seq "$c" dot xdot-then-svg l,xdot,f,l,svg,f
|
|
67
|
+
seq "$c" dot xdot-dot l,xdot,dot,f
|
|
68
|
+
seq "$c" dot dot-dot l,dot,f,l,dot,f
|
|
69
|
+
done
|
|
70
|
+
seq filing neato xdot-then-svg l,xdot,f,l,svg,f
|
|
71
|
+
seq neato-pos neato xdot-plain l,xdot,f,l,plain,f
|
|
72
|
+
seq neato-pos neato dot-plain l,dot,f,l,plain,f
|
|
73
|
+
for e in $ALL; do
|
|
74
|
+
run mixed "$e" xdot 2 "mixed.$e.xdot"
|
|
75
|
+
done
|
|
76
|
+
rm -f mixed.fdp.xdot.2 mixed.sfdp.xdot.2
|
|
77
|
+
seq background dot xdot-svg l,xdot,svg,f
|
|
78
|
+
seq neato-pos neato json-plain l,json,f,l,plain,f
|
|
79
|
+
seq neato-pos neato json0-plain l,json0,f,l,plain,f
|
|
80
|
+
seq filing dot json-json l,json,f,l,json,f
|
|
81
|
+
run sized-clip neato xdot 2 sized-clip.neato.xdot
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
size="4,4";
|
|
3
|
+
start=1;
|
|
4
|
+
edge [len=1.5];
|
|
5
|
+
run -- intr;
|
|
6
|
+
intr -- runbl;
|
|
7
|
+
runbl -- run;
|
|
8
|
+
run -- kernel;
|
|
9
|
+
kernel -- zombie;
|
|
10
|
+
kernel -- sleep;
|
|
11
|
+
kernel -- runmem;
|
|
12
|
+
sleep -- swap;
|
|
13
|
+
swap -- runswap;
|
|
14
|
+
runswap -- new;
|
|
15
|
+
runswap -- runmem;
|
|
16
|
+
new -- runmem;
|
|
17
|
+
sleep -- runmem;
|
|
18
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 340.06 511.59 340.06 511.59 0 ",
|
|
3
|
+
bb="0,0,511.59,340.06",
|
|
4
|
+
size="4,4",
|
|
5
|
+
start=1,
|
|
6
|
+
xdotversion=1.7
|
|
7
|
+
];
|
|
8
|
+
node [label="\N"];
|
|
9
|
+
edge [len=1.5];
|
|
10
|
+
run [_draw_="c 7 -#000000 e 142.17 155.78 27 18 ",
|
|
11
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 142.17 151.58 0 18.66 3 -run ",
|
|
12
|
+
height=0.5,
|
|
13
|
+
pos="142.17,155.78",
|
|
14
|
+
width=0.75];
|
|
15
|
+
intr [_draw_="c 7 -#000000 e 56.69 80.07 27 18 ",
|
|
16
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 56.69 75.87 0 19.44 4 -intr ",
|
|
17
|
+
height=0.5,
|
|
18
|
+
pos="56.691,80.07",
|
|
19
|
+
width=0.75];
|
|
20
|
+
run -- intr [_draw_="c 7 -#000000 B 4 125.69 141.18 110.55 127.77 88.24 108.01 73.12 94.62 ",
|
|
21
|
+
pos="125.69,141.18 110.55,127.77 88.243,108.01 73.122,94.623"];
|
|
22
|
+
kernel [_draw_="c 7 -#000000 e 255.71 197.32 35.16 18 ",
|
|
23
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 255.71 193.12 0 34.98 6 -kernel ",
|
|
24
|
+
height=0.5,
|
|
25
|
+
pos="255.71,197.32",
|
|
26
|
+
width=0.9768];
|
|
27
|
+
run -- kernel [_draw_="c 7 -#000000 B 4 166.25 164.59 183.96 171.07 208.1 179.9 226.84 186.75 ",
|
|
28
|
+
pos="166.25,164.59 183.96,171.07 208.1,179.9 226.84,186.75"];
|
|
29
|
+
runbl [_draw_="c 7 -#000000 e 31.42 179.68 31.42 18 ",
|
|
30
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 31.42 175.48 0 29.55 5 -runbl ",
|
|
31
|
+
height=0.5,
|
|
32
|
+
pos="31.421,179.68",
|
|
33
|
+
width=0.8728];
|
|
34
|
+
intr -- runbl [_draw_="c 7 -#000000 B 4 52.17 97.88 47.6 115.9 40.57 143.61 35.98 161.69 ",
|
|
35
|
+
pos="52.173,97.879 47.602,115.9 40.572,143.61 35.985,161.69"];
|
|
36
|
+
runbl -- run [_draw_="c 7 -#000000 B 4 61.1 173.28 78.27 169.57 99.68 164.95 116.19 161.39 ",
|
|
37
|
+
pos="61.1,173.28 78.272,169.57 99.68,164.95 116.19,161.39"];
|
|
38
|
+
zombie [_draw_="c 7 -#000000 e 236.64 322.06 39.46 18 ",
|
|
39
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 236.64 317.86 0 41.21 6 -zombie ",
|
|
40
|
+
height=0.5,
|
|
41
|
+
pos="236.64,322.06",
|
|
42
|
+
width=1.0961];
|
|
43
|
+
kernel -- zombie [_draw_="c 7 -#000000 B 4 252.89 215.72 249.27 239.44 243 280.43 239.4 303.98 ",
|
|
44
|
+
pos="252.89,215.72 249.27,239.44 243,280.43 239.4,303.98"];
|
|
45
|
+
sleep [_draw_="c 7 -#000000 e 364.15 223.48 30.88 18 ",
|
|
46
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 364.15 219.28 0 28.77 5 -sleep ",
|
|
47
|
+
height=0.5,
|
|
48
|
+
pos="364.15,223.48",
|
|
49
|
+
width=0.85774];
|
|
50
|
+
kernel -- sleep [_draw_="c 7 -#000000 B 4 287.95 205.1 302.93 208.71 320.62 212.98 335.17 216.49 ",
|
|
51
|
+
pos="287.95,205.1 302.93,208.71 320.62,212.98 335.17,216.49"];
|
|
52
|
+
runmem [_draw_="c 7 -#000000 e 344.57 116.04 43.22 18 ",
|
|
53
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 344.57 111.84 0 46.66 6 -runmem ",
|
|
54
|
+
height=0.5,
|
|
55
|
+
pos="344.57,116.04",
|
|
56
|
+
width=1.2005];
|
|
57
|
+
kernel -- runmem [_draw_="c 7 -#000000 B 4 273.26 181.26 288.64 167.2 310.9 146.84 326.44 132.63 ",
|
|
58
|
+
pos="273.26,181.26 288.64,167.2 310.9,146.84 326.44,132.63"];
|
|
59
|
+
sleep -- runmem [_draw_="c 7 -#000000 B 4 360.83 205.26 357.23 185.5 351.52 154.15 347.91 134.36 ",
|
|
60
|
+
pos="360.83,205.26 357.23,185.5 351.52,154.15 347.91,134.36"];
|
|
61
|
+
swap [_draw_="c 7 -#000000 e 480.71 213.36 30.88 18 ",
|
|
62
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 480.71 209.16 0 28.77 4 -swap ",
|
|
63
|
+
height=0.5,
|
|
64
|
+
pos="480.71,213.36",
|
|
65
|
+
width=0.85787];
|
|
66
|
+
sleep -- swap [_draw_="c 7 -#000000 B 4 395.08 220.8 412.08 219.32 433.09 217.49 450.04 216.02 ",
|
|
67
|
+
pos="395.08,220.8 412.08,219.32 433.09,217.49 450.04,216.02"];
|
|
68
|
+
runswap [_draw_="c 7 -#000000 e 463.17 101.18 43.76 18 ",
|
|
69
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 463.17 96.98 0 47.43 7 -runswap ",
|
|
70
|
+
height=0.5,
|
|
71
|
+
pos="463.17,101.18",
|
|
72
|
+
width=1.2154];
|
|
73
|
+
swap -- runswap [_draw_="c 7 -#000000 B 4 477.85 195.08 474.59 174.22 469.29 140.3 466.02 119.45 ",
|
|
74
|
+
pos="477.85,195.08 474.59,174.22 469.29,140.3 466.02,119.45"];
|
|
75
|
+
runswap -- runmem [_draw_="c 7 -#000000 B 4 421.02 106.46 409.7 107.88 397.47 109.41 386.19 110.83 ",
|
|
76
|
+
pos="421.02,106.46 409.7,107.88 397.47,109.41 386.19,110.83"];
|
|
77
|
+
new [_draw_="c 7 -#000000 e 401.8 18 27.13 18 ",
|
|
78
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 401.8 13.8 0 23.32 3 -new ",
|
|
79
|
+
height=0.5,
|
|
80
|
+
pos="401.8,18",
|
|
81
|
+
width=0.75348];
|
|
82
|
+
runswap -- new [_draw_="c 7 -#000000 B 4 450.15 83.54 439.46 69.04 424.42 48.66 413.96 34.48 ",
|
|
83
|
+
pos="450.15,83.541 439.46,69.043 424.42,48.656 413.96,34.484"];
|
|
84
|
+
new -- runmem [_draw_="c 7 -#000000 B 4 391.83 35.08 381.52 52.74 365.49 80.21 355.01 98.17 ",
|
|
85
|
+
pos="391.83,35.078 381.52,52.744 365.49,80.213 355.01,98.168"];
|
|
86
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
graph G {
|
|
2
|
+
graph [_draw_="c 9 -#fffffe00 C 7 -#ffffff P 4 0 0 0 339.88 511.46 339.88 511.46 0 ",
|
|
3
|
+
bb="0,0,511.46,339.88",
|
|
4
|
+
size="4,4",
|
|
5
|
+
start=1,
|
|
6
|
+
xdotversion=1.7
|
|
7
|
+
];
|
|
8
|
+
node [label="\N"];
|
|
9
|
+
edge [len=1.5];
|
|
10
|
+
run [_draw_="c 7 -#000000 e 142.1 155.52 27 18 ",
|
|
11
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 142.1 151.32 0 18.66 3 -run ",
|
|
12
|
+
height=0.5,
|
|
13
|
+
pos="142.1,155.52",
|
|
14
|
+
width=0.75];
|
|
15
|
+
intr [_draw_="c 7 -#000000 e 56.28 80.28 27 18 ",
|
|
16
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 56.28 76.08 0 19.44 4 -intr ",
|
|
17
|
+
height=0.5,
|
|
18
|
+
pos="56.277,80.278",
|
|
19
|
+
width=0.75];
|
|
20
|
+
run -- intr [_draw_="c 7 -#000000 B 4 125.55 141.01 110.35 127.69 87.95 108.05 72.77 94.74 ",
|
|
21
|
+
pos="125.55,141.01 110.35,127.69 87.953,108.05 72.773,94.741"];
|
|
22
|
+
kernel [_draw_="c 7 -#000000 e 255.6 197.13 35.16 18 ",
|
|
23
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 255.6 192.93 0 34.98 6 -kernel ",
|
|
24
|
+
height=0.5,
|
|
25
|
+
pos="255.6,197.13",
|
|
26
|
+
width=0.9768];
|
|
27
|
+
run -- kernel [_draw_="c 7 -#000000 B 4 166.17 164.34 183.87 170.83 208 179.68 226.74 186.55 ",
|
|
28
|
+
pos="166.17,164.34 183.87,170.83 208,179.68 226.74,186.55"];
|
|
29
|
+
runbl [_draw_="c 7 -#000000 e 31.42 180.01 31.42 18 ",
|
|
30
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 31.42 175.81 0 29.55 5 -runbl ",
|
|
31
|
+
height=0.5,
|
|
32
|
+
pos="31.421,180.01",
|
|
33
|
+
width=0.8728];
|
|
34
|
+
intr -- runbl [_draw_="c 7 -#000000 B 4 51.83 98.11 47.34 116.15 40.42 143.89 35.91 162 ",
|
|
35
|
+
pos="51.833,98.109 47.337,116.15 40.422,143.89 35.91,162"];
|
|
36
|
+
runbl -- run [_draw_="c 7 -#000000 B 4 61.08 173.45 78.24 169.65 99.63 164.91 116.13 161.26 ",
|
|
37
|
+
pos="61.08,173.45 78.24,169.65 99.633,164.91 116.13,161.26"];
|
|
38
|
+
zombie [_draw_="c 7 -#000000 e 236.5 321.88 39.46 18 ",
|
|
39
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 236.5 317.68 0 41.21 6 -zombie ",
|
|
40
|
+
height=0.5,
|
|
41
|
+
pos="236.5,321.88",
|
|
42
|
+
width=1.0961];
|
|
43
|
+
kernel -- zombie [_draw_="c 7 -#000000 B 4 252.79 215.53 249.15 239.25 242.88 280.24 239.27 303.8 ",
|
|
44
|
+
pos="252.79,215.53 249.15,239.25 242.88,280.24 239.27,303.8"];
|
|
45
|
+
sleep [_draw_="c 7 -#000000 e 364.01 223.39 30.88 18 ",
|
|
46
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 364.01 219.19 0 28.77 5 -sleep ",
|
|
47
|
+
height=0.5,
|
|
48
|
+
pos="364.01,223.39",
|
|
49
|
+
width=0.85774];
|
|
50
|
+
kernel -- sleep [_draw_="c 7 -#000000 B 4 287.84 204.93 302.82 208.56 320.49 212.84 335.04 216.37 ",
|
|
51
|
+
pos="287.84,204.93 302.82,208.56 320.49,212.84 335.04,216.37"];
|
|
52
|
+
runmem [_draw_="c 7 -#000000 e 344.54 115.92 43.22 18 ",
|
|
53
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 344.54 111.72 0 46.66 6 -runmem ",
|
|
54
|
+
height=0.5,
|
|
55
|
+
pos="344.54,115.92",
|
|
56
|
+
width=1.2005];
|
|
57
|
+
kernel -- runmem [_draw_="c 7 -#000000 B 4 273.17 181.08 288.56 167.03 310.84 146.69 326.39 132.49 ",
|
|
58
|
+
pos="273.17,181.08 288.56,167.03 310.84,146.69 326.39,132.49"];
|
|
59
|
+
sleep -- runmem [_draw_="c 7 -#000000 B 4 360.71 205.16 357.13 185.4 351.44 154.04 347.86 134.24 ",
|
|
60
|
+
pos="360.71,205.16 357.13,185.4 351.44,154.04 347.86,134.24"];
|
|
61
|
+
swap [_draw_="c 7 -#000000 e 480.58 213.49 30.88 18 ",
|
|
62
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 480.58 209.29 0 28.77 4 -swap ",
|
|
63
|
+
height=0.5,
|
|
64
|
+
pos="480.58,213.49",
|
|
65
|
+
width=0.85787];
|
|
66
|
+
sleep -- swap [_draw_="c 7 -#000000 B 4 394.94 220.76 411.94 219.32 432.95 217.53 449.9 216.09 ",
|
|
67
|
+
pos="394.94,220.76 411.94,219.32 432.95,217.53 449.9,216.09"];
|
|
68
|
+
runswap [_draw_="c 7 -#000000 e 463.17 101.29 43.76 18 ",
|
|
69
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 463.17 97.09 0 47.43 7 -runswap ",
|
|
70
|
+
height=0.5,
|
|
71
|
+
pos="463.17,101.29",
|
|
72
|
+
width=1.2154];
|
|
73
|
+
swap -- runswap [_draw_="c 7 -#000000 B 4 477.74 195.21 474.51 174.35 469.24 140.42 466.01 119.56 ",
|
|
74
|
+
pos="477.74,195.21 474.51,174.35 469.24,140.42 466.01,119.56"];
|
|
75
|
+
runswap -- runmem [_draw_="c 7 -#000000 B 4 421.01 106.49 409.69 107.89 397.46 109.4 386.16 110.79 ",
|
|
76
|
+
pos="421.01,106.49 409.69,107.89 397.46,109.4 386.16,110.79"];
|
|
77
|
+
new [_draw_="c 7 -#000000 e 401.95 18 27.13 18 ",
|
|
78
|
+
_ldraw_="F 14 11 -Times-Roman c 7 -#000000 T 401.95 13.8 0 23.32 3 -new ",
|
|
79
|
+
height=0.5,
|
|
80
|
+
pos="401.95,18",
|
|
81
|
+
width=0.75348];
|
|
82
|
+
runswap -- new [_draw_="c 7 -#000000 B 4 450.19 83.63 439.52 69.11 424.52 48.7 414.09 34.51 ",
|
|
83
|
+
pos="450.19,83.63 439.52,69.112 424.52,48.697 414.09,34.506"];
|
|
84
|
+
new -- runmem [_draw_="c 7 -#000000 B 4 391.95 35.06 381.61 52.7 365.52 80.14 355.01 98.07 ",
|
|
85
|
+
pos="391.95,35.057 381.61,52.701 365.52,80.136 355.01,98.069"];
|
|
86
|
+
}
|
package/src/gvc/context.ts
CHANGED
|
@@ -28,6 +28,9 @@ import type { ImageResolver } from './image-resolver.js';
|
|
|
28
28
|
import type { RenderJob } from './job.js'; // scaffold in T25; full class in T26
|
|
29
29
|
import { resetRenderState } from '../common/render-state.js';
|
|
30
30
|
import { RenderError, invalidArgType, invalidArgValue } from '../errors.js';
|
|
31
|
+
import { layoutWasFreed, resetLayoutRecords } from './layout-reset.js';
|
|
32
|
+
import { initXdot } from './init-xdot.js';
|
|
33
|
+
import { writeLayoutBb } from './layout-bb.js';
|
|
31
34
|
|
|
32
35
|
// ---------------------------------------------------------------------------
|
|
33
36
|
// Enums — match C definitions in lib/gvc/gvcjob.h exactly
|
|
@@ -292,6 +295,10 @@ export class GvcContext {
|
|
|
292
295
|
* (setTextMeasurer, setImageSizer, setImageResolver, the per-context
|
|
293
296
|
* measurer/sizer/resolver) are configuration and are not reset.
|
|
294
297
|
*
|
|
298
|
+
* After a freeLayout, the engine sees new records, as it does in C (part-9
|
|
299
|
+
* AD-11, see layout-reset.ts). Without one it sees the stale records, as it
|
|
300
|
+
* does in C.
|
|
301
|
+
*
|
|
295
302
|
* @throws TypeError (ERR_INVALID_ARG_TYPE / ERR_INVALID_ARG_VALUE) for a
|
|
296
303
|
* bad `g`, or an engine argument that is not registered
|
|
297
304
|
* @throws RenderError (UNKNOWN_LAYOUT) if the `layout` attribute names no
|
|
@@ -319,8 +326,11 @@ export class GvcContext {
|
|
|
319
326
|
}
|
|
320
327
|
engine = override;
|
|
321
328
|
}
|
|
329
|
+
if (layoutWasFreed(g)) resetLayoutRecords(g);
|
|
322
330
|
if (g.info) g.info.gvc = this;
|
|
331
|
+
initXdot(g); // C: graph_init, before the engine. @see lib/common/input.c:784
|
|
323
332
|
engine.layout(g);
|
|
333
|
+
writeLayoutBb(g);
|
|
324
334
|
// C: GD_cleanup(g) = gvle->cleanup — freeLayout must use the engine that
|
|
325
335
|
// actually ran, not its argument. @see lib/gvc/gvlayout.c:88
|
|
326
336
|
if (g.info) g.info.cleanup = (x: Graph): void => engine.cleanup(x);
|
|
@@ -330,7 +340,9 @@ export class GvcContext {
|
|
|
330
340
|
}
|
|
331
341
|
|
|
332
342
|
/**
|
|
333
|
-
* Release engine layout state after rendering.
|
|
343
|
+
* Release engine layout state after rendering. The records themselves stay,
|
|
344
|
+
* for getLayout, until the next layout replaces them (part-9 AD-11, see
|
|
345
|
+
* layout-reset.ts).
|
|
334
346
|
*
|
|
335
347
|
* @throws TypeError (ERR_INVALID_ARG_TYPE / ERR_INVALID_ARG_VALUE) for a
|
|
336
348
|
* bad `g`, or an engine argument that is not registered
|
package/src/gvc/device.ts
CHANGED
|
@@ -50,6 +50,7 @@ import {
|
|
|
50
50
|
import { emitRoundedBezier } from '../common/poly-shapes.js';
|
|
51
51
|
import { applyClusterObjState, clusterAttr, clusterStyle, clusterPeripheries, isStripedCluster, renderStripedClusterBox } from './device-cluster.js';
|
|
52
52
|
import { transformPoint } from './device-transform.js';
|
|
53
|
+
import { emitXdot } from './emit-xdot.js';
|
|
53
54
|
import { gvrenderSetStyle, edgeStyleResets } from './gvrender-set-style.js';
|
|
54
55
|
import { renderOneLabel, renderNodeXLabel, renderClusterLabel, reportEdgeLabelColors } from './device-labels.js';
|
|
55
56
|
export { transformPoint, applyRotation, applyScale, buildPoint } from './device-transform.js';
|
|
@@ -346,9 +347,8 @@ export function renderClusters(g: Graph, renderer: RendererPlugin, job: RenderJo
|
|
|
346
347
|
}
|
|
347
348
|
|
|
348
349
|
/**
|
|
349
|
-
* Primary render loop: beginGraph → graph-label → clusters → nodes → edges → endGraph
|
|
350
|
-
*
|
|
351
|
-
* (emit_background, GD_label, then emit_view).
|
|
350
|
+
* Primary render loop: beginGraph → graph-label → clusters → nodes → edges → endGraph,
|
|
351
|
+
* in C's emit_page order (emit_background, GD_label, then emit_view).
|
|
352
352
|
*
|
|
353
353
|
* @see lib/gvc/gvrender.c:gvrender_begin_graph
|
|
354
354
|
* @see lib/gvc/gvrender.c:gvrender_end_graph
|
|
@@ -381,9 +381,8 @@ export function renderGraph(g: Graph, job: RenderJob, renderer: RendererPlugin):
|
|
|
381
381
|
return job.output.join('');
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
/** One page (per layer): graph group, background+label (in the graph anchor
|
|
385
|
-
* clusters, nodes/edges.
|
|
386
|
-
* label, closing before emit_view (clusters/nodes) — siblings.
|
|
384
|
+
/** One page (per layer): graph group, background+label (in the graph anchor, which
|
|
385
|
+
* closes before emit_view), clusters, nodes/edges.
|
|
387
386
|
* @see lib/common/emit.c:emit_page (3651-3660) */
|
|
388
387
|
function renderPage(g: Graph, renderer: RendererPlugin, job: RenderJob, info: LayerInfo): void {
|
|
389
388
|
renderer.beginPage?.(g, job);
|
|
@@ -395,6 +394,7 @@ function renderPage(g: Graph, renderer: RendererPlugin, job: RenderJob, info: La
|
|
|
395
394
|
withColorScheme(g.attrs.get('colorscheme'), () => {
|
|
396
395
|
reportColorNames(backgroundColors(g.attrs.get('bgcolor'), renderer.type === 'svg'));
|
|
397
396
|
renderer.pageBackground?.(g, job);
|
|
397
|
+
emitXdot(g, renderer, job); // the end of emit_background
|
|
398
398
|
// emit root-graph label before clusters/nodes @see lib/common/emit.c:emit_page
|
|
399
399
|
renderGraphLabel(g, renderer, job);
|
|
400
400
|
});
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Replays the graph's own draw ops (see init-xdot.ts) over the canvas fill. This
|
|
5
|
+
* is why a second xdot render's graph `_draw_` holds the first one's.
|
|
6
|
+
*
|
|
7
|
+
* @see lib/common/emit.c:1362 emit_xdot
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { agwarningf } from '../common/agerr.js';
|
|
11
|
+
import { lateInt } from '../common/nodeinit.js';
|
|
12
|
+
import { findStopColor, parseStyleFlags, resolvePenType, resolvePenWidth, styleTokens } from '../common/style-resolve.js';
|
|
13
|
+
import type { Box, Point } from '../model/geom.js';
|
|
14
|
+
import type { Graph } from '../model/graph.js';
|
|
15
|
+
import { resolveFillColorName, resolveRenderColor } from '../render/color-resolve.js';
|
|
16
|
+
import type { XdotColor, XdotOp, XdotPoint } from '../xdot/types.js';
|
|
17
|
+
import { FillType, type RendererPlugin } from './context.js';
|
|
18
|
+
import { transformPoint } from './device-transform.js';
|
|
19
|
+
import { graphXdots } from './init-xdot.js';
|
|
20
|
+
import { gvrenderSetStyle } from './gvrender-set-style.js';
|
|
21
|
+
import type { ObjState, RenderJob } from './job.js';
|
|
22
|
+
import { initJobViewportZoom, parseDrawingSize, parseGraphPad, setupPageClip } from './viewport.js';
|
|
23
|
+
|
|
24
|
+
/** @see lib/common/const.h:48 */
|
|
25
|
+
const DEFAULT_COLOR = 'black';
|
|
26
|
+
/** @see lib/common/const.h:69 */
|
|
27
|
+
const DEFAULT_FILL = 'lightgrey';
|
|
28
|
+
|
|
29
|
+
/** C's defaultlinestyle. @see lib/gvc/gvcjob.h */
|
|
30
|
+
const DEFAULT_LINE_STYLE: readonly string[] = ['solid', 'setlinewidth(1)'];
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* job->clip for this device. `job.clip` carries the SVG default pad of 4; the
|
|
34
|
+
* xdot device's default is 0, so with no `pad` its clip is the bb, computed in
|
|
35
|
+
* C's order, rounding included.
|
|
36
|
+
* @see plugin/core/gvrender_core_dot.c:739 render_features_dot
|
|
37
|
+
* @see lib/common/emit.c:1558
|
|
38
|
+
*/
|
|
39
|
+
function deviceClip(g: Graph, renderer: RendererPlugin, job: RenderJob): Box {
|
|
40
|
+
if (renderer.type === 'svg') return job.clip;
|
|
41
|
+
const attr = g.attrs.get('pad');
|
|
42
|
+
const pad = attr ? parseGraphPad(attr) : { x: 0, y: 0 };
|
|
43
|
+
const size = parseDrawingSize(g.attrs.get('size'));
|
|
44
|
+
return setupPageClip(job.bb, size, pad, initJobViewportZoom(job.bb, size, pad));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* C's `boxf_overlap(op->bb, job->clip)`. Only xdotBB fills `op->bb`, and only
|
|
49
|
+
* neato's `-n` path calls that, so here it is still calloc's zero box: every op
|
|
50
|
+
* draws when the clip holds the origin, and none does otherwise. Rounding can
|
|
51
|
+
* put a sized drawing's clip just past the origin, and then nothing replays.
|
|
52
|
+
* @see lib/common/emit.c:1373
|
|
53
|
+
* @see lib/neatogen/neatoinit.c:560
|
|
54
|
+
*/
|
|
55
|
+
function zeroBoxInClip(clip: Box): boolean {
|
|
56
|
+
return clip.ll.x <= 0 && clip.ll.y <= 0 && clip.ur.x >= 0 && clip.ur.y >= 0;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* The state emit_background leaves on the job's object, which emit_xdot then draws with: a transparent
|
|
61
|
+
* pen and a `bgcolor` fill. A truecolor device paints nothing for `transparent`, so the state stays at C's
|
|
62
|
+
* defaults; any other device maps it to white. The port's renderers paint the box without touching
|
|
63
|
+
* `job.obj`, so this applies only when there are ops to replay, which leaves every other graph as it was.
|
|
64
|
+
*
|
|
65
|
+
* DEVIATION: after a gradient `bgcolor`, C frees `clrs[0]` while svg's fill state still points at it
|
|
66
|
+
* (gvrender_resolve_color keeps `color->u.string = name`; emit.c:1518 frees it), so native prints the freed
|
|
67
|
+
* bytes, `fill=""` in every run measured. The port keeps the colour C meant. xdot, which resolves to RGBA, agrees.
|
|
68
|
+
* @see lib/common/emit.c:1476 emit_background
|
|
69
|
+
*/
|
|
70
|
+
function applyBackgroundState(g: Graph, renderer: RendererPlugin, obj: ObjState): void {
|
|
71
|
+
const attr = g.attrs.get('bgcolor');
|
|
72
|
+
const color = attr !== undefined && attr !== '' ? attr : 'white';
|
|
73
|
+
const trueColor = renderer.type === 'svg';
|
|
74
|
+
if (trueColor && color === 'transparent') {
|
|
75
|
+
obj.penColor = resolveRenderColor(DEFAULT_COLOR);
|
|
76
|
+
obj.fillColor = resolveFillColorName(DEFAULT_FILL);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const str = color === 'transparent' ? 'white' : color;
|
|
80
|
+
obj.penColor = resolveRenderColor('transparent');
|
|
81
|
+
const stop = str.includes(':') ? findStopColor(str) : null;
|
|
82
|
+
if (stop === null) {
|
|
83
|
+
obj.fillColor = resolveFillColorName(str);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
obj.fillColor = resolveFillColorName(stop.fillColor);
|
|
87
|
+
obj.stopColor = resolveFillColorName(stop.stopColor);
|
|
88
|
+
obj.gradientAngle = lateInt(g.attrs.get('gradientangle'), 0, 0);
|
|
89
|
+
obj.gradientFrac = stop.frac;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** Sets the gradient fill state. @see lib/common/emit.c:1421-1444 */
|
|
93
|
+
function setGradientFill(obj: ObjState, color: XdotColor): void {
|
|
94
|
+
if (color.type === 'none') return;
|
|
95
|
+
const ramp = color.type === 'radial' ? color.ring : color.ling;
|
|
96
|
+
obj.fillColor = resolveFillColorName(ramp.stops[0]!.color);
|
|
97
|
+
obj.stopColor = resolveFillColorName(ramp.stops[1]!.color);
|
|
98
|
+
obj.gradientFrac = ramp.stops[1]!.frac;
|
|
99
|
+
if (color.type === 'radial') {
|
|
100
|
+
const r = color.ring;
|
|
101
|
+
// `|| 0`: a zero r0 gives acos(-inf), NaN, and C's (int) cast on arm64, the oracle, makes that 0.
|
|
102
|
+
obj.gradientAngle = r.x1 === r.x0 && r.y1 === r.y0
|
|
103
|
+
? 0
|
|
104
|
+
: Math.trunc(180 * Math.acos((r.x0 - r.x1) / r.r0) / Math.PI) || 0;
|
|
105
|
+
obj.fill = FillType.Radial;
|
|
106
|
+
} else {
|
|
107
|
+
const l = color.ling;
|
|
108
|
+
obj.gradientAngle = Math.trunc(180 * Math.atan2(l.y1 - l.y0, l.x1 - l.x0) / Math.PI);
|
|
109
|
+
obj.fill = FillType.Linear;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/** @see lib/gvc/gvrender.c:480 gvrender_set_style */
|
|
114
|
+
function setStyle(obj: ObjState, tokens: readonly string[]): void {
|
|
115
|
+
gvrenderSetStyle(tokens);
|
|
116
|
+
obj.rawStyle = [...tokens];
|
|
117
|
+
const flags = parseStyleFlags(tokens.join(','));
|
|
118
|
+
obj.pen = resolvePenType(flags);
|
|
119
|
+
obj.penWidth = resolvePenWidth(flags, undefined);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** What a drawing op passes to the renderer, in device coordinates. */
|
|
123
|
+
function devicePoints(pts: readonly XdotPoint[], job: RenderJob): Point[] {
|
|
124
|
+
return pts.map((p) => transformPoint({ x: p.x, y: p.y }, job));
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/** The drawing ops of emit_xdot; true when `op` was one. */
|
|
128
|
+
function drawOp(op: XdotOp, renderer: RendererPlugin, job: RenderJob): boolean {
|
|
129
|
+
switch (op.kind) {
|
|
130
|
+
case 'filled_ellipse':
|
|
131
|
+
case 'unfilled_ellipse': {
|
|
132
|
+
const { x, y, w, h } = op.ellipse;
|
|
133
|
+
const c = transformPoint({ x, y }, job);
|
|
134
|
+
renderer.ellipse(c, w, h, op.kind === 'filled_ellipse', job);
|
|
135
|
+
return true;
|
|
136
|
+
}
|
|
137
|
+
case 'filled_polygon':
|
|
138
|
+
case 'unfilled_polygon':
|
|
139
|
+
renderer.polygon(devicePoints(op.polygon.pts, job), op.kind === 'filled_polygon', job);
|
|
140
|
+
return true;
|
|
141
|
+
case 'filled_bezier':
|
|
142
|
+
case 'unfilled_bezier':
|
|
143
|
+
renderer.bezier(devicePoints(op.bezier.pts, job), op.kind === 'filled_bezier', job);
|
|
144
|
+
return true;
|
|
145
|
+
case 'polyline':
|
|
146
|
+
renderer.polyline(devicePoints(op.polyline.pts, job), job);
|
|
147
|
+
return true;
|
|
148
|
+
default:
|
|
149
|
+
return false;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** The state ops of emit_xdot. Fonts need no handling here, as in C. */
|
|
154
|
+
function stateOp(op: XdotOp, obj: ObjState, warned: { image: boolean }): void {
|
|
155
|
+
switch (op.kind) {
|
|
156
|
+
case 'fill_color':
|
|
157
|
+
obj.fillColor = resolveFillColorName(op.color);
|
|
158
|
+
obj.fill = FillType.Solid;
|
|
159
|
+
break;
|
|
160
|
+
case 'pen_color':
|
|
161
|
+
obj.penColor = resolveRenderColor(op.color);
|
|
162
|
+
obj.fill = FillType.Solid;
|
|
163
|
+
break;
|
|
164
|
+
case 'grad_fill_color':
|
|
165
|
+
setGradientFill(obj, op.gradColor);
|
|
166
|
+
break;
|
|
167
|
+
case 'grad_pen_color':
|
|
168
|
+
agwarningf('gradient pen colors not yet supported.');
|
|
169
|
+
break;
|
|
170
|
+
case 'style':
|
|
171
|
+
setStyle(obj, styleTokens(op.style));
|
|
172
|
+
break;
|
|
173
|
+
case 'image':
|
|
174
|
+
if (!warned.image) agwarningf('Images unsupported in "background" attribute');
|
|
175
|
+
warned.image = true;
|
|
176
|
+
break;
|
|
177
|
+
default:
|
|
178
|
+
break;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Replays the graph's draw ops, inside emit_background. A text op is skipped:
|
|
184
|
+
* only xdotBB builds its span, so C dereferences a null span here and a `_draw_`
|
|
185
|
+
* with text crashes native.
|
|
186
|
+
* @see lib/common/emit.c:1362 emit_xdot
|
|
187
|
+
*/
|
|
188
|
+
export function emitXdot(g: Graph, renderer: RendererPlugin, job: RenderJob): void {
|
|
189
|
+
const xd = graphXdots(g);
|
|
190
|
+
const obj = job.obj;
|
|
191
|
+
if (xd === undefined || obj === null) return;
|
|
192
|
+
applyBackgroundState(g, renderer, obj);
|
|
193
|
+
const inClip = zeroBoxInClip(deviceClip(g, renderer, job));
|
|
194
|
+
const warned = { image: false };
|
|
195
|
+
let styled = false;
|
|
196
|
+
for (const op of xd.ops) {
|
|
197
|
+
styled ||= op.kind === 'style';
|
|
198
|
+
if (op.kind === 'text') continue;
|
|
199
|
+
if (!inClip && isDrawing(op)) continue;
|
|
200
|
+
if (!drawOp(op, renderer, job)) stateOp(op, obj, warned);
|
|
201
|
+
}
|
|
202
|
+
if (styled) setStyle(obj, DEFAULT_LINE_STYLE);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function isDrawing(op: XdotOp): boolean {
|
|
206
|
+
return op.kind.endsWith('ellipse') || op.kind.endsWith('polygon') || op.kind.endsWith('bezier')
|
|
207
|
+
|| op.kind === 'polyline';
|
|
208
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The graph's own draw ops: `_background`, or else the `_draw_` an earlier xdot
|
|
5
|
+
* render wrote, parsed when a layout starts. emit-xdot.ts replays them.
|
|
6
|
+
*
|
|
7
|
+
* @see lib/common/emit.c:69 init_xdot
|
|
8
|
+
* @see lib/common/input.c:784
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { agerr, agwarningf } from '../common/agerr.js';
|
|
12
|
+
import type { Graph } from '../model/graph.js';
|
|
13
|
+
import { parseXDot } from '../xdot/index.js';
|
|
14
|
+
import type { Xdot } from '../xdot/types.js';
|
|
15
|
+
|
|
16
|
+
/** GD_drawing(g)->xdots: set per layout, read by the render after it. */
|
|
17
|
+
const xdotsByGraph = new WeakMap<Graph, Xdot>();
|
|
18
|
+
|
|
19
|
+
/** @see lib/common/emit.c:69 init_xdot */
|
|
20
|
+
export function initXdot(g: Graph): void {
|
|
21
|
+
xdotsByGraph.delete(g);
|
|
22
|
+
const p = g.attrs?.get('_background') || g.attrs?.get('_draw_');
|
|
23
|
+
if (!p) return;
|
|
24
|
+
const xd = parseXDot(p);
|
|
25
|
+
if (xd === null) {
|
|
26
|
+
agwarningf(`Could not parse "_background" attribute in graph ${g.name}`);
|
|
27
|
+
agerr('prev', ` "${p}"`);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
xdotsByGraph.set(g, xd);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The draw ops of the last layout of `g`. */
|
|
34
|
+
export function graphXdots(g: Graph): Xdot | undefined {
|
|
35
|
+
return xdotsByGraph.get(g);
|
|
36
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// SPDX-License-Identifier: EPL-2.0
|
|
2
|
+
|
|
3
|
+
import type { Graph } from '../model/graph.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Port of `mapbool` for the `landscape=` branch only: falsy spellings →
|
|
7
|
+
* false, truthy spellings → true, else `atoi(s) != 0`. Kept local (not imported
|
|
8
|
+
* from layout/dot) to avoid pulling the layout engine into this leaf module.
|
|
9
|
+
* @see lib/common/utils.c:mapbool
|
|
10
|
+
*/
|
|
11
|
+
function landscapeMapbool(s: string): boolean {
|
|
12
|
+
const v = s.toLowerCase();
|
|
13
|
+
if (v === '' || v === 'false' || v === 'no') return false;
|
|
14
|
+
if (v === 'true' || v === 'yes') return true;
|
|
15
|
+
return Number.parseInt(s, 10) !== 0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Port of the landscape detection in `input.c`: `rotate=90`, or
|
|
20
|
+
* `orientation` starting with `l`/`L`, or a truthy `landscape`. Each branch is
|
|
21
|
+
* mutually exclusive in the same precedence as C (rotate wins over orientation
|
|
22
|
+
* wins over landscape). Returns false when no rotation attribute is present.
|
|
23
|
+
* This flag is **emit-only** — it drives `job.rotation`, never layout (ADR-1).
|
|
24
|
+
* @see lib/common/input.c:699-704
|
|
25
|
+
*/
|
|
26
|
+
export function parseLandscape(g: Graph): boolean {
|
|
27
|
+
const rotate = g.attrs.get('rotate');
|
|
28
|
+
if (rotate !== undefined) return Number.parseInt(rotate, 10) === 90;
|
|
29
|
+
const orientation = g.attrs.get('orientation');
|
|
30
|
+
if (orientation !== undefined) {
|
|
31
|
+
return orientation[0] === 'l' || orientation[0] === 'L';
|
|
32
|
+
}
|
|
33
|
+
const landscape = g.attrs.get('landscape');
|
|
34
|
+
if (landscape !== undefined) return landscapeMapbool(landscape);
|
|
35
|
+
return false;
|
|
36
|
+
}
|