X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fgraphviz.scm;h=247d30c4a7fc1bba8ede9e56965ed57de2532f6c;hb=d8d7985d6027b374744a7c88250b856c4ef7e619;hp=5144977644d7536de0656ffb6898a3df8968a595;hpb=a9d9433bc7b95cb2d4b3d96eefce7a8437c0d44e;p=lilypond.git diff --git a/scm/graphviz.scm b/scm/graphviz.scm index 5144977644..247d30c4a7 100644 --- a/scm/graphviz.scm +++ b/scm/graphviz.scm @@ -1,8 +1,19 @@ -;;;; graphviz.scm -- utilities for creating graphviz output +;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; source file of the GNU LilyPond music typesetter +;;;; Copyright (C) 2007--2012 Joe Neeman ;;;; -;;;; (c) 2007--2009 Joe Neeman +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. +;;;; +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . (define-module (scm graphviz) @@ -26,18 +37,18 @@ (define (add-cluster graph node-id cluster-name) (let* ((cs (clusters graph)) - (cluster (assq cluster-name cs)) + (cluster (assoc cluster-name cs)) (already-in-cluster (if cluster (cdr cluster) '()))) - (set-clusters! graph (assq-set! cs + (set-clusters! graph (assoc-set! cs cluster-name (cons node-id already-in-cluster))))) (define (add-node graph label . cluster-name) (let* ((ns (nodes graph)) (id (length ns))) - (set-nodes! graph (assq-set! ns id label)) + (set-nodes! graph (assv-set! ns id label)) (if (and (not (null? cluster-name)) (string? (car cluster-name))) (add-cluster graph id (car cluster-name))) @@ -50,18 +61,17 @@ (let ((ns (nodes graph)) (es (edges graph)) (cs (clusters graph))) - (ly:message (format (_ "Writing graph `~a'...") (port-filename out))) + (ly:message (format #f (_ "Writing graph `~a'...") (port-filename out))) (display "digraph G {\nrankdir=\"LR\"\nnode [shape=rectangle]\n" out) - (map (lambda (n) (display (format "~a [label=\"~a\"]\n" (car n) (cdr n)) out)) - ns) - (map (lambda (e) (display (format "~a -> ~a\n" (car e) (cdr e)) out)) - es) - (map (lambda (c) - (display (format "subgraph cluster_~a {\nlabel= \"~a\"\ncolor=blue\n" - (string-filter (car c) char-alphabetic?) - (car c)) - out) - (map (lambda (n) (display (format "~a\n" n) out)) (cdr c)) - (display "}\n" out)) - cs) + (for-each (lambda (n) (format out "~a [label=\"~a\"]\n" (car n) (cdr n))) + ns) + (for-each (lambda (e) (format out "~a -> ~a\n" (car e) (cdr e))) + es) + (for-each (lambda (c) + (format out "subgraph cluster_~a {\nlabel= \"~a\"\ncolor=blue\n" + (string-filter (car c) char-alphabetic?) + (car c)) + (for-each (lambda (n) (format out "~a\n" n)) (cdr c)) + (display "}\n" out)) + cs) (display "}" out)))