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)))
24 "\n\n@unnumberedsubsubsec User settable properties:\n"
25 (description-list->texi user-propdocs)
27 "\n\n@unnumberedsubsubsec Internal properties: \n"
28 (description-list->texi internal-propdocs)
33 (define iface->grob-table (make-vector 61 '()))
34 ;; extract ifaces, and put grob into the hash table.
39 (metah (assoc 'meta (cdr x)))
41 (ifaces (cdr (assoc 'interfaces meta)))
46 iface->grob-table iface
48 (hashq-ref iface->grob-table iface '())
52 all-grob-descriptions)
54 ;; First level Interface description
55 (define (interface-doc interface)
56 (let ((name (symbol->string (car interface))))
60 (interface-doc-string (cdr interface) '())
62 "This grob interface is used in the following graphical objects: "
67 (hashq-ref iface->grob-table (car interface) '() )))))
71 (define (grob-alist->texi alist)
73 ((uprops (filter (lambda (x) (not (object-property x 'backend-internal)))
76 (description-list->texi
77 (map (lambda (y) (property->texi 'backend y alist))
82 (define (grob-doc description)
83 "Given a property alist DESCRIPTION, make a documentation
88 (metah (assoc 'meta description))
90 (name (cdr (assoc 'name meta)))
91 (ifaces (map lookup-interface (cdr (assoc 'interfaces meta))))
92 (ifacedoc (map (lambda (iface)
93 (ref-ify (symbol->string (car iface)))
97 (lambda (x) (engraver-makes-grob? name x)) all-engravers-list))
98 (namestr (symbol->string name))
99 (engraver-names (map symbol->string (map ly:translator-name engravers)))
106 namestr " grobs are created by: "
107 (human-listify (map ref-ify
108 (map engraver-name engraver-names)))
109 "\n\nStandard settings: \n\n"
110 (grob-alist->texi description)
111 "\n\nThis object supports the following interfaces: \n"
112 (human-listify ifacedoc)
116 (define (all-grobs-doc)
118 #:name "All layout objects"
119 #:desc "Description and defaults for all Grobs"
121 (map (lambda (x) (grob-doc (cdr x))) all-grob-descriptions)))
123 (define interface-description-alist
125 (lambda (key val prior)
126 (cons (cons key val) prior)
128 '() (ly:all-grob-interfaces)))
130 (set! interface-description-alist (sort interface-description-alist alist<?))
133 ;;;;;;;;;; check for dangling backend properties.
134 (define (mark-interface-properties entry)
135 (map (lambda (x) (set-object-property! x 'iface-marked #t)) (caddr (cdr entry)))
138 (map mark-interface-properties interface-description-alist)
140 (define (check-dangling-properties prop)
141 (if (not (object-property prop 'iface-marked))
142 (error "\ndefine-grob-properties.scm: Can't find interface for property:" prop)))
144 (map check-dangling-properties all-backend-properties)
148 (define (lookup-interface name)
150 (entry (hashq-ref (ly:all-grob-interfaces) name '() ))
153 (if (equal? entry #f)
154 (error "Unknown interface" name))
159 (define (all-interfaces-doc)
161 #:name "Graphical Object Interfaces"
162 #:desc "Building blocks of graphical objects"
164 (map interface-doc interface-description-alist)
167 (define (backend-properties-doc-string lst)
170 (ps (sort (map symbol->string lst) string<?))
171 (descs (map (lambda (prop)
172 (property->texi 'backend (string->symbol prop) '()))
174 (texi (description-list->texi descs))
179 ;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )
180 (define (backend-doc-node)
183 #:desc "Reference for the layout engine"
189 #:name "User backend properties"
190 #:desc "All tunable properties in a big list"
191 #:text (backend-properties-doc-string all-user-grob-properties))
193 #:name "Internal backend properties"
194 #:desc "All internal layout properties in a big list"
195 #:text (backend-properties-doc-string all-internal-grob-properties))