]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/bar-line.scm
Doc-es: update some versions in snippets.
[lilypond.git] / scm / bar-line.scm
index 809a08ca4888d3d63878ebdf85a0b0cbb41b54a6..03c6f808156f88816b7fa6da999670b4b2891316 100644 (file)
@@ -88,10 +88,10 @@ Pad the string with @code{annotation-char}s to the length of the
     (if (pair? line-pos)
         (begin
           (set! iv (cons (car line-pos) (car line-pos)))
-          (map (lambda (x)
-                 (set! iv (cons (min (car iv) x)
-                                (max (cdr iv) x))))
-               (cdr line-pos)))
+          (for-each (lambda (x)
+                      (set! iv (cons (min (car iv) x)
+                                     (max (cdr iv) x))))
+                    (cdr line-pos)))
 
         (let ((line-count (ly:grob-property grob 'line-count 0)))
 
@@ -135,14 +135,14 @@ mandatory to the procedures stored in @code{bar-glyph-print-procedures}."
 
 (define (string->string-list str)
   "Convert a string into a list of strings with length 1.
-@code{"aBc"} will be converted to @code{("a" "B" "c")}.
-An empty string will be converted to a list containing @code{""}."
-(if (and (string? str)
-         (not (zero? (string-length str))))
-    (map (lambda (s)
-           (string s))
-         (string->list str))
-    (list "")))
+@code{\"aBc\"} will be converted to @code{(\"a\" \"B\" \"c\")}.
+An empty string will be converted to a list containing @code{\"\"}."
+  (if (and (string? str)
+           (not (zero? (string-length str))))
+      (map (lambda (s)
+             (string s))
+           (string->list str))
+      (list "")))
 
 (define (strip-string-annotation str)
   "Strip annotations starting with and including the
@@ -179,41 +179,41 @@ annotation char from string @var{str}."
          (last-pos (1- (length sorted-elts)))
          (idx 0))
 
-    (map (lambda (g)
-           (ly:grob-set-property!
-            g
-            'has-span-bar
-            (cons (if (eq? idx last-pos)
-                      #f
-                      grob)
-                  (if (zero? idx)
-                      #f
-                      grob)))
-           (set! idx (1+ idx)))
-         sorted-elts)))
+    (for-each (lambda (g)
+                (ly:grob-set-property!
+                 g
+                 'has-span-bar
+                 (cons (if (eq? idx last-pos)
+                           #f
+                           grob)
+                       (if (zero? idx)
+                           #f
+                           grob)))
+                (set! idx (1+ idx)))
+              sorted-elts)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Line break decisions.
 
 (define-public (define-bar-line bar-glyph eol-glyph bol-glyph span-glyph)
-  "Define a bar glyph @var{bar-glyph} and its substitute at the end of a line
-(@var{eol-glyph}), at the beginning of a new line (@var{bol-glyph})
+  "Define a bar glyph @var{bar-glyph} and its substitute at the end of
+a line (@var{eol-glyph}), at the beginning of a new line (@var{bol-glyph})
 and as a span bar (@var{span-glyph}) respectively."
   ;; the last argument may not include annotations
   (check-for-annotation span-glyph)
   ;; only the last argument may call for replacements
   (for-each (lambda (s)
-                    (check-for-replacement s))
+              (check-for-replacement s))
             (list bar-glyph eol-glyph bol-glyph))
   ;; the bar-glyph-alist has entries like
   ;; (bar-glyph . ( eol-glyph . bol-glyph))
   (set! bar-glyph-alist
-    (acons bar-glyph (cons eol-glyph bol-glyph) bar-glyph-alist))
+        (acons bar-glyph (cons eol-glyph bol-glyph) bar-glyph-alist))
 
   ;; the span-bar-glyph-alist has entries like
   ;; (bar-glyph . span-glyph)
   (set! span-bar-glyph-alist
-    (acons bar-glyph span-glyph span-bar-glyph-alist)))
+        (acons bar-glyph span-glyph span-bar-glyph-alist)))
 
 (define-session bar-glyph-alist '())
 
@@ -400,21 +400,21 @@ is not used within the routine."
               (half-thick (/ line-thickness 2.0))
               (stencil empty-stencil))
 
-          (map (lambda (i)
-                 (let ((top-y (min (* (+ i dash-size) half-space)
-                                   (+ (* (1- line-count) half-space)
-                                      half-thick)))
-                       (bot-y (max (* (- i dash-size) half-space)
-                                   (- 0 (* (1- line-count) half-space)
-                                      half-thick))))
-
-                   (set! stencil
-                         (ly:stencil-add
-                          stencil
-                          (ly:round-filled-box (cons 0 thickness)
-                                               (cons bot-y top-y)
-                                               blot)))))
-               (iota line-count (1- line-count) (- 2)))
+          (for-each (lambda (i)
+                      (let ((top-y (min (* (+ i dash-size) half-space)
+                                        (+ (* (1- line-count) half-space)
+                                           half-thick)))
+                            (bot-y (max (* (- i dash-size) half-space)
+                                        (- 0 (* (1- line-count) half-space)
+                                           half-thick))))
+
+                        (set! stencil
+                              (ly:stencil-add
+                               stencil
+                               (ly:round-filled-box (cons 0 thickness)
+                                                    (cons bot-y top-y)
+                                                    blot)))))
+                    (iota line-count (1- line-count) (- 2)))
           stencil)
         (let* ((dashes (/ height staff-space))
                (total-dash-size (/ height dashes))
@@ -801,7 +801,7 @@ no elements."
 ;; the size of the staff lines is evaluated as 0, which results in a
 ;; solid span bar line with faulty y coordinate.
 ;;
-;; This routine was originally by Juergen Reuter, but it was on the
+;; This routine was originally by Juergen Reuter, but it was on the
 ;; bulky side. Rewritten by Han-Wen. Ported from c++ to Scheme by Marc Hohl.
 (define-public (ly:span-bar::print grob)
   "The print routine for span bars."
@@ -823,26 +823,26 @@ no elements."
           ;; we compute the extents of each system and store them
           ;; in a list; dito for the 'allow-span-bar property.
           ;; model-bar takes the bar grob, if given.
-          (map (lambda (bar)
-                 (let ((ext (bar-line::bar-y-extent bar refp))
-                       (staff-symbol (ly:grob-object bar 'staff-symbol)))
-
-                   (if (ly:grob? staff-symbol)
-                       (let ((refp-extent (ly:grob-extent staff-symbol refp Y)))
-
-                         (set! ext (interval-union ext refp-extent))
-
-                         (if (> (interval-length ext) 0)
-                             (begin
-                               (set! extents (append extents (list ext)))
-                               (set! model-bar bar)
-                               (set! make-span-bars
-                                     (append make-span-bars
-                                             (list (ly:grob-property
-                                                    bar
-                                                    'allow-span-bar
-                                                    #t))))))))))
-               elts)
+          (for-each (lambda (bar)
+                      (let ((ext (bar-line::bar-y-extent bar refp))
+                            (staff-symbol (ly:grob-object bar 'staff-symbol)))
+
+                        (if (ly:grob? staff-symbol)
+                            (let ((refp-extent (ly:grob-extent staff-symbol refp Y)))
+
+                              (set! ext (interval-union ext refp-extent))
+
+                              (if (> (interval-length ext) 0)
+                                  (begin
+                                    (set! extents (append extents (list ext)))
+                                    (set! model-bar bar)
+                                    (set! make-span-bars
+                                          (append make-span-bars
+                                                  (list (ly:grob-property
+                                                         bar
+                                                         'allow-span-bar
+                                                         #t))))))))))
+                    elts)
           ;; if there is no bar grob, we use the callback argument
           (if (not model-bar)
               (set! model-bar grob))