]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/document-backend.scm
Merge branch 'lilypond/translation' of ssh://git.sv.gnu.org/srv/git/lilypond into...
[lilypond.git] / scm / document-backend.scm
index 18762aeba9cae1027fd6e65f8a79f20033942a04..41c2aab60c9fc03831f14c5a3694b72138ba2b75 100644 (file)
@@ -1,14 +1,36 @@
-;;;; backend-documentation-lib.scm -- Functions for backend documentation
+;;;; document-backend.scm -- Functions for backend documentation
 ;;;;
 ;;;; source file of the GNU LilyPond music typesetter
 ;;;;
 ;;;; (c) 2000--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
 ;;;; Jan Nieuwenhuizen <janneke@gnu.org>
 
+(define (sort-grob-properties x)
+  ;; force 'meta to the end of each prop-list
+  (let ((meta (assoc 'meta x)))
+    (append (sort (assoc-remove! x 'meta) ly:alist-ci<?)
+            (list meta))))
+
+;; properly sort all grobs, properties, and interfaces
+;; within the all-grob-descriptions alist
+(map
+  (lambda (x)
+    (let* ((props      (assoc-ref all-grob-descriptions (car x)))
+           (meta       (assoc-ref props 'meta))
+           (interfaces (assoc-ref meta 'interfaces)))
+      (set! all-grob-descriptions
+        (sort (assoc-set! all-grob-descriptions (car x)
+               (sort-grob-properties
+                (assoc-set! props 'meta
+                 (assoc-set! meta 'interfaces
+                  (sort interfaces ly:symbol-ci<?)))))
+              ly:alist-ci<?))))
+  all-grob-descriptions)
+
 (define (interface-doc-string interface grob-description)
   (let* ((name (car interface))
         (desc (cadr interface))
-        (props (sort (caddr interface) ly:symbol-ci<?))
+        (props (caddr interface))
         (docfunc (lambda (pr)
                    (property->texi
                     'backend pr grob-description)))
@@ -93,11 +115,14 @@ node."
         (name (cdr (assoc 'name meta)))
         ;;       (bla (display name))
         (ifaces (map lookup-interface (cdr (assoc 'interfaces meta))))
-        (ifacedoc (map (lambda (iface)
-                         (if (pair? iface)
-                             (ref-ify (symbol->string (car iface)))
-                             (ly:error (_ "pair expected in doc ~s") name)))
-                       (reverse ifaces)))
+        (ifacedoc (map ref-ify
+                       (sort
+                        (map (lambda (iface)
+                               (if (pair? iface)
+                                   (symbol->string (car iface))
+                                   (ly:error (_ "pair expected in doc ~s") name)))
+                             ifaces)
+                        ly:string-ci<?)))
         (engravers (filter
                     (lambda (x) (engraver-makes-grob? name x))
                     all-engravers-list))
@@ -139,7 +164,8 @@ node."
      (cons (cons key val)  prior))
    '() (ly:all-grob-interfaces)))
 
-(set! interface-description-alist (sort interface-description-alist ly:alist-ci<?))
+(set! interface-description-alist
+  (sort interface-description-alist ly:alist-ci<?))
 
 ;;;;;;;;;; check for dangling backend properties.
 (define (mark-interface-properties entry)