1 ;;; backend-documentation-lib.scm -- Functions for backend documentation
3 ;;; source file of the GNU LilyPond music typesetter
5 ;;; (c) 2000--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
6 ;;; Jan Nieuwenhuizen <janneke@gnu.org>
9 ;;; This file generates documentation for the backend of lilypond.
11 ;; alist of property descriptions
22 * preset properties + explanation
26 * properties available.
31 (define (interface-doc-string interface grob-description)
34 (name (car interface))
35 (desc (cadr interface))
36 (props (sort (caddr interface) symbol<?))
39 pr 'backend grob-description )))
40 (propdocs (map docfunc props))
46 (description-list->texi propdocs))
51 (define iface->grob-table (make-vector 61 '()))
52 ;; extract ifaces, and put grob into the hash table.
57 (metah (assoc 'meta (cdr x)))
59 (ifaces (cdr (assoc 'interfaces meta)))
64 iface->grob-table iface
66 (hashq-ref iface->grob-table iface '())
70 all-grob-descriptions)
72 ;; First level Interface description
73 (define (interface-doc interface)
74 (let ((name (symbol->string (car interface))))
78 (interface-doc-string (cdr interface) #f)
80 "This grob interface is used in the following graphical objects: "
85 (hashq-ref iface->grob-table (car interface) '() )))))
89 (define (grob-doc description)
90 "Given a property alist DESCRIPTION, make a documentation
95 (metah (assoc 'meta description))
98 (name (cdr (assoc 'name meta)))
99 (ifaces (map lookup-interface (cdr (assoc 'interfaces meta))))
100 (ifacedoc (map (lambda (iface)
107 (ref-ify (symbol->string (car iface)))
110 (interface-doc-string iface description)))
112 (engravers (filter-list
113 (lambda (x) (engraver-makes-grob? name x)) all-engravers-list))
114 (namestr (symbol->string name))
115 (engraver-names (map ly:translator-name engravers))
122 namestr " grobs are created by: "
123 (human-listify (map ref-ify
124 (map engraver-name engraver-names)))
125 (apply string-append ifacedoc)
129 (define (all-grobs-doc)
131 #:name "All Graphical objects"
132 #:desc "Description and defaults for all Grobs"
134 (map (lambda (x) (grob-doc (cdr x))) all-grob-descriptions)))
136 (define interface-description-alist
138 (lambda (key val prior)
139 (cons (cons key val) prior)
141 '() (ly:all-grob-interfaces)))
143 (set! interface-description-alist (sort interface-description-alist alist<?))
146 ;;;;;;;;;; check for dangling backend properties.
147 (define (mark-interface-properties entry)
148 (map (lambda (x) (set-object-property! x 'iface-marked #t)) (caddr (cdr entry)))
151 (map mark-interface-properties interface-description-alist)
153 (define (check-dangling-properties prop)
154 (if (not (object-property prop 'iface-marked))
155 (error "\nDangling property: " prop))
158 (map check-dangling-properties all-backend-properties)
162 (define (lookup-interface name)
164 (entry (hashq-ref (ly:all-grob-interfaces) name #f))
167 (if (equal? entry #f)
168 (error "Unknown interface" name))
173 (define (all-interfaces-doc)
175 #:name "Graphical Object Interfaces"
176 #:desc "Building blocks of graphical objects"
178 (map interface-doc interface-description-alist)
181 (define (all-backend-properties-doc)
184 (ps (sort (map symbol->string all-backend-properties) string<?))
185 (descs (map (lambda (prop)
186 (document-property (string->symbol prop) 'backend #f))
188 (texi (description-list->texi descs))
191 #:name "backend properties"
192 #:desc "all the properties in use as grob properties"
196 ;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )
197 (define (backend-doc-node)
200 #:desc "Reference for the layout engine"
205 (all-backend-properties-doc)