1 ;;; backend-documentation-lib.scm -- Functions for backend documentation
3 ;;; source file of the GNU LilyPond music typesetter
5 ;;; (c) 2000--2004 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)
33 ((name (car interface))
34 (desc (cadr interface))
35 (props (sort (caddr interface) symbol<?))
38 'backend pr grob-description)))
39 (iprops (filter (lambda (x) (object-property x 'backend-internal) ) props))
40 (uprops (filter (lambda (x) (not (object-property x 'backend-internal)) ) props))
41 (user-propdocs (map docfunc uprops))
42 (internal-propdocs (map docfunc iprops)))
46 "\n\n@unnumberedsubsubsec User settable properties:\n"
47 (description-list->texi user-propdocs)
49 "\n\n@unnumberedsubsubsec Internal properties: \n"
50 (description-list->texi internal-propdocs)
55 (define iface->grob-table (make-vector 61 '()))
56 ;; extract ifaces, and put grob into the hash table.
61 (metah (assoc 'meta (cdr x)))
63 (ifaces (cdr (assoc 'interfaces meta)))
68 iface->grob-table iface
70 (hashq-ref iface->grob-table iface '())
74 all-grob-descriptions)
76 ;; First level Interface description
77 (define (interface-doc interface)
78 (let ((name (symbol->string (car interface))))
82 (interface-doc-string (cdr interface) '())
84 "This grob interface is used in the following graphical objects: "
89 (hashq-ref iface->grob-table (car interface) '() )))))
93 (define (grob-alist->texi alist)
95 ((uprops (filter (lambda (x) (not (object-property x 'backend-internal)))
98 (description-list->texi
99 (map (lambda (y) (property->texi 'backend y alist))
104 (define (grob-doc description)
105 "Given a property alist DESCRIPTION, make a documentation
110 (metah (assoc 'meta description))
112 (name (cdr (assoc 'name meta)))
113 (ifaces (map lookup-interface (cdr (assoc 'interfaces meta))))
114 (ifacedoc (map (lambda (iface)
115 (ref-ify (symbol->string (car iface)))
119 (lambda (x) (engraver-makes-grob? name x)) all-engravers-list))
120 (namestr (symbol->string name))
121 (engraver-names (map symbol->string (map ly:translator-name engravers)))
128 namestr " grobs are created by: "
129 (human-listify (map ref-ify
130 (map engraver-name engraver-names)))
131 "\n\nStandard settings: \n\n"
132 (grob-alist->texi description)
133 "\n\nThis object supports the following interfaces: \n"
134 (human-listify ifacedoc)
138 (define (all-grobs-doc)
140 #:name "All layout objects"
141 #:desc "Description and defaults for all Grobs"
143 (map (lambda (x) (grob-doc (cdr x))) all-grob-descriptions)))
145 (define interface-description-alist
147 (lambda (key val prior)
148 (cons (cons key val) prior)
150 '() (ly:all-grob-interfaces)))
152 (set! interface-description-alist (sort interface-description-alist alist<?))
155 ;;;;;;;;;; check for dangling backend properties.
156 (define (mark-interface-properties entry)
157 (map (lambda (x) (set-object-property! x 'iface-marked #t)) (caddr (cdr entry)))
160 (map mark-interface-properties interface-description-alist)
162 (define (check-dangling-properties prop)
163 (if (not (object-property prop 'iface-marked))
164 (error "\ndefine-grob-properties.scm: Can't find interface for property:" prop)))
166 (map check-dangling-properties all-backend-properties)
170 (define (lookup-interface name)
172 (entry (hashq-ref (ly:all-grob-interfaces) name '() ))
175 (if (equal? entry #f)
176 (error "Unknown interface" name))
181 (define (all-interfaces-doc)
183 #:name "Graphical Object Interfaces"
184 #:desc "Building blocks of graphical objects"
186 (map interface-doc interface-description-alist)
189 (define (backend-properties-doc-string lst)
192 (ps (sort (map symbol->string lst) string<?))
193 (descs (map (lambda (prop)
194 (property->texi 'backend (string->symbol prop) '()))
196 (texi (description-list->texi descs))
201 ;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )
202 (define (backend-doc-node)
205 #:desc "Reference for the layout engine"
211 #:name "User backend properties"
212 #:desc "All tunable properties in a big list"
213 #:text (backend-properties-doc-string all-internal-grob-properties))
215 #:name "Internal backend properties"
216 #:desc "All internal layout properties in a big list"
217 #:text (backend-properties-doc-string all-user-grob-properties))