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: "
76 (hashq-ref iface->grob-table (car interface) '() ))
83 (define (grob-alist->texi alist)
85 ((uprops (filter (lambda (x) (not (object-property x 'backend-internal)))
88 (description-list->texi
89 (map (lambda (y) (property->texi 'backend y alist))
94 (define (grob-doc description)
95 "Given a property alist DESCRIPTION, make a documentation
99 ((metah (assoc 'meta description))
101 (name (cdr (assoc 'name meta)))
102 (ifaces (map lookup-interface (cdr (assoc 'interfaces meta))))
103 (ifacedoc (map (lambda (iface)
104 (ref-ify (symbol->string (car iface)))
108 (lambda (x) (engraver-makes-grob? name x)) all-engravers-list))
109 (namestr (symbol->string name))
110 (engraver-names (map symbol->string (map ly:translator-name engravers))))
116 namestr " objects are created by: "
117 (human-listify (map ref-ify
118 (map engraver-name engraver-names)))
119 "\n\nStandard settings: \n\n"
120 (grob-alist->texi description)
121 "\n\nThis object supports the following interfaces: \n"
122 (human-listify ifacedoc)
126 (define (all-grobs-doc)
128 #:name "All layout objects"
129 #:desc "Description and defaults for all Grobs"
131 (map (lambda (x) (grob-doc (cdr x))) all-grob-descriptions)))
133 (define interface-description-alist
135 (lambda (key val prior)
136 (cons (cons key val) prior)
138 '() (ly:all-grob-interfaces)))
140 (set! interface-description-alist (sort interface-description-alist alist<?))
143 ;;;;;;;;;; check for dangling backend properties.
144 (define (mark-interface-properties entry)
145 (map (lambda (x) (set-object-property! x 'iface-marked #t)) (caddr (cdr entry)))
148 (map mark-interface-properties interface-description-alist)
150 (define (check-dangling-properties prop)
151 (if (not (object-property prop 'iface-marked))
152 (error "\ndefine-grob-properties.scm: Can't find interface for property:" prop)))
154 (map check-dangling-properties all-backend-properties)
158 (define (lookup-interface name)
160 (entry (hashq-ref (ly:all-grob-interfaces) name '() ))
163 (if (equal? entry #f)
164 (error "Unknown interface" name))
169 (define (all-interfaces-doc)
171 #:name "Graphical Object Interfaces"
172 #:desc "Building blocks of graphical objects"
174 (map interface-doc interface-description-alist)
177 (define (backend-properties-doc-string lst)
180 (ps (sort (map symbol->string lst) string<?))
181 (descs (map (lambda (prop)
182 (property->texi 'backend (string->symbol prop) '()))
184 (texi (description-list->texi descs))
189 ;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )
190 (define (backend-doc-node)
193 #:desc "Reference for the layout engine"
199 #:name "User backend properties"
200 #:desc "All tunable properties in a big list"
201 #:text (backend-properties-doc-string all-user-grob-properties))
203 #:name "Internal backend properties"
204 #:desc "All internal layout properties in a big list"
205 #:text (backend-properties-doc-string all-internal-grob-properties))