((section 2 "Outdated egg!" (p "This is an egg for CHICKEN 4, the unsupported old release.  You're almost certainly looking for " (int-link "/eggref/5/graphviz" "the CHICKEN 5 version of this egg") ", if it exists.") (p "If it does not exist, there may be equivalent functionality provided by another egg; have a look at the " (link "https://wiki.call-cc.org/chicken-projects/egg-index-5.html" "egg index") ". Otherwise, please consider porting this egg to the current version of CHICKEN.")) (section 2 "graphviz" (p "Some Graphviz abstractions") (toc) (section 3 (tt "default-width") (def (sig (parameter "default-width → 1600" (id default-width))) (p "Default width for graphs") (highlight scheme "(define default-width (make-parameter 1600))"))) (section 3 (tt "default-height") (def (sig (parameter "default-height → 900" (id default-height))) (p "Default width for graphs") (highlight scheme "(define default-height (make-parameter 900))"))) (section 3 (tt "default-font-size") (def (sig (parameter "default-font-size → 48.0" (id default-font-size))) (p "Default font-size for graphs") (highlight scheme "(define default-font-size (make-parameter 48.0))"))) (section 3 (tt "default-node-attributes") (def (sig (parameter "default-node-attributes → (quote ())" (id default-node-attributes))) (p "Default node attributes") (highlight scheme "(define default-node-attributes (make-parameter '()))")) (section 4 "Examples" (p "Creating default node attributes") (pre "(default-node-attributes '((font . monospace)))"))) (section 3 (tt "default-edge-attributes") (def (sig (parameter "default-edge-attributes → (quote ())" (id default-edge-attributes))) (p "Default edge attributes") (highlight scheme "(define default-edge-attributes (make-parameter '()))")) (section 4 "Examples" (p "Creating default edge attributes") (pre "(default-edge-attributes '((dir . none)))"))) (section 3 (tt "default-graph-attributes") (def (sig (parameter "default-graph-attributes → (quote ())" (id default-graph-attributes))) (p "Default graph attributes") (highlight scheme "(define default-graph-attributes (make-parameter '()))")) (section 4 "Examples" (p "Creating default graph attributes") (pre "(default-graph-attributes '((splines . true)))"))) (section 3 (tt "write-graph-preamble") (def (sig (procedure "(write-graph-preamble) → unspecified" (id write-graph-preamble)) (procedure "(write-graph-preamble graph-attributes) → unspecified" (id write-graph-preamble)) (procedure "(write-graph-preamble graph-attributes width height font-size) → unspecified" (id write-graph-preamble))) (p "Write a graph preamble.") (dl (dt (tt "graph-attributes")) (dd "Attributes of the graph") (dt (tt "width")) (dd "Width in pixels") (dt (tt "height")) (dd "Height in pixels") (dt (tt "font-size")) (dd "Font-size in pt")) (highlight scheme "(define write-graph-preamble\n  (case-lambda\n    (() (write-graph-preamble '()))\n    ((graph-attributes)\n     (write-graph-preamble\n       graph-attributes\n       (default-width)\n       (default-height)\n       (default-font-size)))\n    ((graph-attributes width height font-size)\n     (display \"digraph G {\")\n     (unless\n       (null? graph-attributes)\n       (format #t \"graph [~a];\" (attributes->string graph-attributes)))\n     (unless\n       (null? (default-graph-attributes))\n       (format\n         #t\n         \"graph [~a];\"\n         (attributes->string (default-graph-attributes))))\n     (unless\n       (null? (default-node-attributes))\n       (format #t \"node [~a];\" (attributes->string (default-node-attributes))))\n     (unless\n       (null? (default-edge-attributes))\n       (format #t \"edge [~a];\" (attributes->string (default-edge-attributes))))\n     (if (and width height)\n       (begin\n         (format #t \"graph [fontsize=~a, ratio=fill];\" font-size)\n         (let ((width-in-inches (px->in width))\n               (height-in-inches (px->in height)))\n           (format\n             #t\n             \"graph [viewport=\\\"~a,~a\\\", size=\\\"~a,~a!\\\"];\"\n             (in->dot width-in-inches)\n             (in->dot height-in-inches)\n             width-in-inches\n             height-in-inches)))))))")) (section 4 "Examples" (p "A trivial graph") (pre "(write-graph-preamble '((splines . true)))\n(write-node a '((label . \"Big bang\")))\n(write-node b '((label . \"Today\")))\n(write-edge a b '((label . \"Entropy gradient\")))\n(write-graph-postamble)"))) (section 3 (tt "write-graph-postamble") (def (sig (procedure "(write-graph-postamble) → unspecified" (id write-graph-postamble))) (p "Write the graph postamble.") (highlight scheme "(define (write-graph-postamble) (display \"}\"))"))) (section 3 (tt "pos") (def (sig (procedure "(pos x y) → unspecified" (id pos))) (p "For placing nodes at specific positions in a unit graph using the " (tt "pos")) (pre "attribute, apply a linear scaling.") (dl (dt (tt "x")) (dd "The x position") (dt (tt "y")) (dd "The y position")) (highlight scheme "(define (pos x y) (format \"~a,~a\" (* x (linear-scale)) (* y (linear-scale))))"))) (section 3 (tt "write-node") (def (sig (procedure "(write-node label) → unspecified" (id write-node)) (procedure "(write-node label attributes) → unspecified" (id write-node))) (p "Write a node") (dl (dt (tt "label")) (dd "The node's label") (dt (tt "attributes")) (dd "Attributes of the node")) (highlight scheme "(define write-node\n  (case-lambda\n    ((label) (write-node label '()))\n    ((label attributes)\n     (format #t \"~a [~a];\" label (attributes->string attributes)))))"))) (section 3 (tt "write-edge") (def (sig (procedure "(write-edge whence whither) → unspecified" (id write-edge)) (procedure "(write-edge whence whither attributes) → unspecified" (id write-edge))) (p "Write an edge") (dl (dt (tt "whence")) (dd "The label whence") (dt (tt "whither")) (dd "The lable whither") (dt (tt "attributes")) (dd "Attributes of the edge")) (highlight scheme "(define write-edge\n  (case-lambda\n    ((whence whither) (write-edge whence whither '()))\n    ((whence whither attributes)\n     (format\n       #t\n       \"~a -> ~a [~a];\"\n       whence\n       whither\n       (attributes->string attributes)))))"))) (section 3 "About this egg" (section 4 "Author" (p (int-link "/users/klutometis" "Peter Danenberg"))) (section 4 "Repository" (p (link "https://github.com/klutometis/graphviz"))) (section 4 "License" (p "BSD")) (section 4 "Dependencies" (ul (li (int-link "hahn")) (li (int-link "matchable")) (li (int-link "setup-helper")))) (section 4 "Versions" (dl (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.2" "0.2")) (dd "Add dependencies.") (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.3" "0.3")) (dd "Get rid of 0.1.") (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.4" "0.4")) (dd "Abstract out attributes.") (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.5" "0.5")) (dd "Add test-exit.") (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.6" "0.6")) (dd "Add attributes to edge.") (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.7" "0.7")) (dd "Sparser defaults") (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.8" "0.8")) (dd "Write-graph-preamble, &c.") (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.8.1" "0.8.1")) (dd "Use hahn.") (dt (link "https://github.com/klutometis/graphviz/releases/tag/0.8.2" "0.8.2")) (dd "Version should be a string."))) (section 4 "Colophon" (p "Documented by " (int-link "/egg/hahn" "hahn") ".")))))