1 ;;; backend-documentation-lib.scm -- Functions for backend documentation
3 ;;; source file of the GNU LilyPond music typesetter
5 ;;; (c) 2000--2003 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 pr 'backend grob-description)))
39 (propdocs (map docfunc props)))
43 (description-list->texi propdocs))
47 (define iface->grob-table (make-vector 61 '()))
48 ;; extract ifaces, and put grob into the hash table.
53 (metah (assoc 'meta (cdr x)))
55 (ifaces (cdr (assoc 'interfaces meta)))
60 iface->grob-table iface
62 (hashq-ref iface->grob-table iface '())
66 all-grob-descriptions)
68 ;; First level Interface description
69 (define (interface-doc interface)
70 (let ((name (symbol->string (car interface))))
74 (interface-doc-string (cdr interface) #f)
76 "This grob interface is used in the following graphical objects: "
81 (hashq-ref iface->grob-table (car interface) '() )))))
85 (define (grob-doc description)
86 "Given a property alist DESCRIPTION, make a documentation
91 (metah (assoc 'meta description))
94 (name (cdr (assoc 'name meta)))
95 (ifaces (map lookup-interface (cdr (assoc 'interfaces meta))))
96 (ifacedoc (map (lambda (iface)
100 (ref-ify (symbol->string (car iface)))
103 (interface-doc-string iface description)))
106 (lambda (x) (engraver-makes-grob? name x)) all-engravers-list))
107 (namestr (symbol->string name))
108 (engraver-names (map symbol->string (map ly:translator-name engravers)))
115 namestr " grobs are created by: "
116 (human-listify (map ref-ify
117 (map engraver-name engraver-names)))
118 (apply string-append ifacedoc)
122 (define (all-grobs-doc)
124 #:name "All layout objects"
125 #:desc "Description and defaults for all Grobs"
127 (map (lambda (x) (grob-doc (cdr x))) all-grob-descriptions)))
129 (define interface-description-alist
131 (lambda (key val prior)
132 (cons (cons key val) prior)
134 '() (ly:all-grob-interfaces)))
136 (set! interface-description-alist (sort interface-description-alist alist<?))
139 ;;;;;;;;;; check for dangling backend properties.
140 (define (mark-interface-properties entry)
141 (map (lambda (x) (set-object-property! x 'iface-marked #t)) (caddr (cdr entry)))
144 (map mark-interface-properties interface-description-alist)
146 (define (check-dangling-properties prop)
147 (if (not (object-property prop 'iface-marked))
148 (error "\ngrob-property-description.scm: Can't find interface for property:" prop)))
150 (map check-dangling-properties all-backend-properties)
154 (define (lookup-interface name)
156 (entry (hashq-ref (ly:all-grob-interfaces) name #f))
159 (if (equal? entry #f)
160 (error "Unknown interface" name))
165 (define (all-interfaces-doc)
167 #:name "Graphical Object Interfaces"
168 #:desc "Building blocks of graphical objects"
170 (map interface-doc interface-description-alist)
173 (define (all-backend-properties-doc)
176 (ps (sort (map symbol->string all-backend-properties) string<?))
177 (descs (map (lambda (prop)
178 (document-property (string->symbol prop) 'backend #f))
180 (texi (description-list->texi descs))
183 #:name "All backend properties"
184 #:desc "All grob properties in a big list"
188 ;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )
189 (define (backend-doc-node)
192 #:desc "Reference for the layout engine"
197 (all-backend-properties-doc)