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 (define (interface-doc-string interface grob-description)
11 ((name (car interface))
12 (desc (cadr interface))
13 (props (sort (caddr interface) symbol<?))
16 'backend pr grob-description)))
17 (iprops (filter (lambda (x) (object-property x 'backend-internal) ) props))
18 (uprops (filter (lambda (x) (not (object-property x 'backend-internal)) ) props))
19 (user-propdocs (map docfunc uprops))
20 (internal-propdocs (map docfunc iprops)))
27 "\n\n@unnumberedsubsubsec User settable properties:\n"
28 (description-list->texi user-propdocs))
33 "\n\n@unnumberedsubsubsec Internal properties: \n"
34 (description-list->texi internal-propdocs)
41 (define iface->grob-table (make-vector 61 '()))
42 ;; extract ifaces, and put grob into the hash table.
47 (metah (assoc 'meta (cdr x)))
49 (ifaces (cdr (assoc 'interfaces meta)))
54 iface->grob-table iface
56 (hashq-ref iface->grob-table iface '())
60 all-grob-descriptions)
62 ;; First level Interface description
63 (define (interface-doc interface)
64 (let ((name (symbol->string (car interface))))
68 (interface-doc-string (cdr interface) '())
70 "This grob interface is used in the following graphical objects: "
75 (hashq-ref iface->grob-table (car interface) '() )))))
79 (define (grob-alist->texi alist)
81 ((uprops (filter (lambda (x) (not (object-property x 'backend-internal)))
84 (description-list->texi
85 (map (lambda (y) (property->texi 'backend y alist))
90 (define (grob-doc description)
91 "Given a property alist DESCRIPTION, make a documentation
96 (metah (assoc 'meta description))
98 (name (cdr (assoc 'name meta)))
99 (ifaces (map lookup-interface (cdr (assoc 'interfaces meta))))
100 (ifacedoc (map (lambda (iface)
101 (ref-ify (symbol->string (car iface)))
105 (lambda (x) (engraver-makes-grob? name x)) all-engravers-list))
106 (namestr (symbol->string name))
107 (engraver-names (map symbol->string (map ly:translator-name engravers)))
114 namestr " grobs are created by: "
115 (human-listify (map ref-ify
116 (map engraver-name engraver-names)))
117 "\n\nStandard settings: \n\n"
118 (grob-alist->texi description)
119 "\n\nThis object supports the following interfaces: \n"
120 (human-listify ifacedoc)
124 (define (all-grobs-doc)
126 #:name "All layout objects"
127 #:desc "Description and defaults for all Grobs"
129 (map (lambda (x) (grob-doc (cdr x))) all-grob-descriptions)))
131 (define interface-description-alist
133 (lambda (key val prior)
134 (cons (cons key val) prior)
136 '() (ly:all-grob-interfaces)))
138 (set! interface-description-alist (sort interface-description-alist alist<?))
141 ;;;;;;;;;; check for dangling backend properties.
142 (define (mark-interface-properties entry)
143 (map (lambda (x) (set-object-property! x 'iface-marked #t)) (caddr (cdr entry)))
146 (map mark-interface-properties interface-description-alist)
148 (define (check-dangling-properties prop)
149 (if (not (object-property prop 'iface-marked))
150 (error "\ndefine-grob-properties.scm: Can't find interface for property:" prop)))
152 (map check-dangling-properties all-backend-properties)
156 (define (lookup-interface name)
158 (entry (hashq-ref (ly:all-grob-interfaces) name '() ))
161 (if (equal? entry #f)
162 (error "Unknown interface" name))
167 (define (all-interfaces-doc)
169 #:name "Graphical Object Interfaces"
170 #:desc "Building blocks of graphical objects"
172 (map interface-doc interface-description-alist)
175 (define (backend-properties-doc-string lst)
178 (ps (sort (map symbol->string lst) string<?))
179 (descs (map (lambda (prop)
180 (property->texi 'backend (string->symbol prop) '()))
182 (texi (description-list->texi descs))
187 ;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )
188 (define (backend-doc-node)
191 #:desc "Reference for the layout engine"
197 #:name "User backend properties"
198 #:desc "All tunable properties in a big list"
199 #:text (backend-properties-doc-string all-user-grob-properties))
201 #:name "Internal backend properties"
202 #:desc "All internal layout properties in a big list"
203 #:text (backend-properties-doc-string all-internal-grob-properties))