]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/parser-clef.scm
Use correct lilypond version for regtests...
[lilypond.git] / scm / parser-clef.scm
index ede242b4aa9cb29056bb61198b960745563ee75b..8275929d554e2124e8f91b4c14e7330b94b7df56 100644 (file)
@@ -1,8 +1,8 @@
-;;;; clef.scm -- Clef settings
+;;;; parser-clef.scm -- Clef settings
 ;;;;
 ;;;; source file of the GNU LilyPond music typesetter
 ;;;;
-;;;; (c) 2004--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+;;;; (c) 2004--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
 
 ;; (name . (glyph clef-position octavation))
          (set! oct
                (* (if (equal? (match:substring match 2) "^") -1 1)
                   (- (string->number (match:substring match 3)) 1)))))
-    (set! e (assoc clef-name supported-clefs))
-    (if (pair? e)
+    (set! e (assoc-get clef-name supported-clefs))
+    (if e
        (let* ((musics (map make-prop-set
-                           `(((symbol . clefGlyph) (value . ,(cadr e)))
+                           `(((symbol . clefGlyph) (value . ,(car e)))
                              ((symbol . middleCClefPosition)
                               (value . ,(+ oct
-                                           (caddr e)
-                                           (cdr (assoc (cadr e) c0-pitch-alist)))))
-                             ((symbol . clefPosition) (value . ,(caddr e)))
+                                           (cadr e)
+                                           (assoc-get (car e) c0-pitch-alist))))
+                             ((symbol . clefPosition) (value . ,(cadr e)))
                              ((symbol . clefOctavation) (value . ,(- oct))))))
               (recalc-mid-C (make-music 'ApplyContext))
               (seq (make-music 'SequentialMusic
                       (sort (map car supported-clefs) string<?)))
          (make-music 'Music)))))
 
+;; a function to add new clefs at runtime
+(define-public (add-new-clef clef-name clef-glyph clef-position octavation c0-position)
+  "Append the entries for a clef symbol to supported clefs and c0-pitch-alist"
+  (set! supported-clefs
+        (acons clef-name (list clef-glyph clef-position octavation) supported-clefs))
+  (set! c0-pitch-alist
+        (acons clef-glyph c0-position c0-pitch-alist)))