X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdocument-backend.scm;h=71ba5a274fa616c3bbf111fab909af2f0eab4657;hb=2f84bbe9a6dc6ca2d9a49eae0bf094744e47f11d;hp=2a23e49afa7ce40a1edb9dc39beca88aa46a8085;hpb=eb2d142eadbda419637d62e2ef5877b203dc5534;p=lilypond.git diff --git a/scm/document-backend.scm b/scm/document-backend.scm index 2a23e49afa..71ba5a274f 100644 --- a/scm/document-backend.scm +++ b/scm/document-backend.scm @@ -1,14 +1,47 @@ -;;;; backend-documentation-lib.scm -- Functions for backend documentation +;;;; This file is part of LilyPond, the GNU music typesetter. ;;;; -;;;; source file of the GNU LilyPond music typesetter -;;;; -;;;; (c) 2000--2006 Han-Wen Nienhuys +;;;; Copyright (C) 2000--2012 Han-Wen Nienhuys ;;;; Jan Nieuwenhuizen +;;;; +;;;; 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 (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-citexi 'backend pr grob-description))) @@ -25,23 +58,22 @@ (if (pair? uprops) (string-append - "\n\n@unnumberedsubsubsec User settable properties:\n" - (description-list->texi user-propdocs)) + "\n\n@subsubheading User settable properties:\n" + (description-list->texi user-propdocs #t)) "") (if (pair? iprops) (string-append - "\n\n@unnumberedsubsubsec Internal properties:\n" - (description-list->texi internal-propdocs)) + "\n\n@subsubheading Internal properties:\n" + (description-list->texi internal-propdocs #t)) "")))) -(define iface->grob-table (make-vector 61 '())) +(define iface->grob-table (make-hash-table 61)) ;; extract ifaces, and put grob into the hash table. (map (lambda (x) - (let* ((metah (assoc 'meta (cdr x))) - (meta (cdr metah)) - (ifaces (cdr (assoc 'interfaces meta)))) + (let* ((meta (assoc-get 'meta (cdr x))) + (ifaces (assoc-get 'interfaces meta))) (map (lambda (iface) (hashq-set! @@ -53,20 +85,27 @@ ;; First level Interface description (define (interface-doc interface) - (let ((name (symbol->string (car interface)))) + (let* ((name (symbol->string (car interface))) + (interface-list (human-listify + (map ref-ify + (sort + (map symbol->string + (hashq-ref iface->grob-table + (car interface) + '())) + ly:string-ci #:name name #:text (string-append (interface-doc-string (cdr interface) '()) "\n\n" - "This grob interface is used in the following graphical objects: " - - (human-listify - (map ref-ify - (sort - (map symbol->string - (hashq-ref iface->grob-table (car interface) '())) - stringtexi alist) (let* ((uprops (filter (lambda (x) (not (object-property x 'backend-internal))) @@ -74,38 +113,52 @@ (description-list->texi (map (lambda (y) (property->texi 'backend y alist)) - uprops)))) + uprops) + #t))) (define (grob-doc description) "Given a property alist DESCRIPTION, make a documentation node." - (let* ((metah (assoc 'meta description)) - (meta (cdr metah)) - (name (cdr (assoc 'name meta))) + (let* ((meta (assoc-get 'meta description)) + (name (assoc-get '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))) + (ifaces (map lookup-interface (assoc-get 'interfaces meta))) + (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-cistring name)) - (engraver-names (map symbol->string (map ly:translator-name engravers)))) + (engraver-names (map symbol->string + (map ly:translator-name engravers))) + (engraver-list (human-listify + (map ref-ify + (map engraver-name engraver-names))))) (make #:name namestr #:text (string-append - namestr " objects are created by: " - (human-listify (map ref-ify - (map engraver-name engraver-names))) - "\n\nStandard settings: \n\n" + namestr " objects " + (if (equal? engraver-list "none") + "are not created by any engraver" + (string-append + "are created by: " + engraver-list)) + "." + + "\n\nStandard settings:\n\n" (grob-alist->texi description) - "\n\nThis object supports the following interfaces: \n" - (human-listify ifacedoc))))) + "\n\nThis object supports the following interface(s):\n" + (human-listify ifacedoc) + ".")))) (define (all-grobs-doc) (make @@ -120,7 +173,8 @@ node." (cons (cons key val) prior)) '() (ly:all-grob-interfaces))) -(set! interface-description-alist (sort interface-description-alist aliststring lst) stringstring lst) ly:string-citexi 'backend (string->symbol prop) '())) ps)) - (texi (description-list->texi descs))) + (texi (description-list->texi descs #f))) texi)) ;;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )