X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=ly%2Fgraphviz-init.ly;h=96f45ded93ccc3f784eeaea6e1ebe8a61764f2b1;hb=97a0169312a260933246ab224e4f8b0969871dd5;hp=d8735e8f0e640e58ed31b79e39ce9a58cb2539f4;hpb=45116ddc67c3ce0f5c7f3c29f33e2bba50badecb;p=lilypond.git diff --git a/ly/graphviz-init.ly b/ly/graphviz-init.ly index d8735e8f0e..96f45ded93 100644 --- a/ly/graphviz-init.ly +++ b/ly/graphviz-init.ly @@ -1,7 +1,9 @@ -\version "2.16.0" +\version "2.19.22" #(use-modules (scm graphviz)) +#(use-modules (ice-9 regex)) + #(define last-grob-action '()) #(define sym-blacklist '()) @@ -22,14 +24,7 @@ #(define (whitelist-grob sym) (set! grob-whitelist (cons sym grob-whitelist))) -#(define graph (make-empty-graph (ly:parser-output-name parser))) - -#(define (grob-name g) - (let* ((meta (ly:grob-property g 'meta)) - (name-pair (assq 'name meta))) - (if (pair? name-pair) - (cdr name-pair) - #f))) +#(define graph (make-empty-graph (ly:parser-output-name))) % an event is relevant if % (it is on some whitelist or all whitelists are empty) @@ -42,11 +37,11 @@ (or (= 0 (length file-line-whitelist) (length sym-whitelist) (length grob-whitelist)) (memq prop sym-whitelist) - (memq (grob-name grob) grob-whitelist) + (memq (grob::name grob) grob-whitelist) (member file-line file-line-whitelist)) (and (not (memq prop sym-blacklist)) - (not (memq (grob-name grob) grob-blacklist)) + (not (memq (grob::name grob) grob-blacklist)) (not (member file-line file-line-blacklist)))))) #(define (grob-event-node grob label cluster) @@ -62,18 +57,22 @@ #(define (grob-mod grob file line func prop val) (let* ((val-str (truncate-value val)) - (label (format #f "~a\\n~a:~a\\n~a <- ~a" (grob-name grob) file line prop val-str))) + (label (format #f "~a\\n~a:~a\\n~a <- ~a" (grob::name grob) file line prop val-str)) + ;; to keep escaped "\"" we need to transform it to "\\\"" + ;; otherwise the final pdf-creation will break + (escaped-label + (regexp-substitute/global #f "\"" label 'pre "\\\"" 'post))) (if (relevant? grob file line prop) - (grob-event-node grob label file)))) + (grob-event-node grob escaped-label file)))) #(define (grob-cache grob prop callback value) (let* ((val-str (truncate-value value)) - (label (format #f "caching ~a.~a\\n~a -> ~a" (grob-name grob) prop callback value))) + (label (format #f "caching ~a.~a\\n~a -> ~a" (grob::name grob) prop callback value))) (if (relevant? grob #f #f prop) (grob-event-node grob label #f)))) #(define (grob-create grob file line func) - (let ((label (format #f "~a\\n~a:~a" (grob-name grob) file line))) + (let ((label (format #f "~a\\n~a:~a" (grob::name grob) file line))) (grob-event-node grob label file))) #(ly:set-grob-modification-callback grob-mod)