1 ;;; backend-documentation-lib.scm -- Functions for backend documentation
3 ;;; source file of the GNU LilyPond music typesetter
5 ;;; (c) 2000--2001 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
14 (define (backend-property->texi sym)
15 (let* ((name (symbol->string sym))
16 (type (object-property sym 'backend-type?))
17 (typename (type-name type))
18 (desc (object-property sym 'backend-doc)))
20 (cons (string-append "@code{" name "} "
24 ; index gets too messy
25 ; "@vindex " name "\n"
31 (define (document-grob-property sym grob-description )
32 (let* ((handle (assoc sym grob-description))
33 (defval (if (eq? handle #f)
35 (scm->texi (cdr handle))))
36 (propdoc (backend-property->texi sym)))
38 (cons (car propdoc) (string-append (cdr propdoc)
42 (define (document-interface where interface grob-description)
43 (let* ((level (if (eq? where 'grob) 3 2))
44 (name (car interface))
45 (desc (cadr interface))
46 (props (caddr interface))
48 (document-grob-property
49 x grob-description )))
50 (docs (map docfunc props)))
54 (string-append (interface-name (symbol->string name)))
55 (eq? where 'grob)) ;gur.
57 (description-list->texi docs))))
59 ;; First level Interface description
60 (define (document-separate-interface interface)
61 (let ((name (symbol->string (car interface))))
64 (node (interface-name name))
65 (document-interface 'self interface '()))))
67 ;; First level grob description
68 (define (document-grob iname description)
70 (let* ((metah (assoc 'meta description))
72 (meta (if (pair? metah)
74 '((properties . ()) (name . "huh?"))
77 (name (cdr (assoc 'name meta)))
78 (ifaces (cdr (assoc 'interface-descriptions meta)))
79 (ifacedoc (map (lambda (x)
80 (document-interface 'grob x description))
84 (node (grob-name name))
85 (texi-section 2 (grob-name name) #f)
88 (let* ((grob (string->symbol name))
92 (let ((engraver (car x))
94 (if (member grob objs)
97 engraver-description-alist))))
99 name " grobs are created by: "
100 (human-listify (map ref-ify
102 (map symbol->string engravers))))))
104 (apply string-append ifacedoc))))
107 (define (document-all-grobs name)
108 (let* ((doc (apply string-append
110 (document-grob (symbol->string (car x)) (cdr x)))
111 all-grob-descriptions)))
112 (names (map symbol->string (map car all-grob-descriptions))))
115 (texi-node-menu name (map (lambda (x) (cons (grob-name x) ""))
119 ;; ugh, this works standalone, but not anymore with lily
120 (if (not (defined? 'standalone))
123 (debug-enable 'backtrace)
125 (load "standalone.scm")
127 (define (number-pair? x)
128 (and (pair? x) (number? (car x)) (number? (cdr x))))
130 (define (ly-grob? x) #f)
131 (define (ly-input-location? x) #f)
133 (define (moment? x) #f)
136 (use-modules (ice-9 string-fun))
140 (display "(define (list-interface-names) '")
141 (write (ugh-standalone-list-interface-names))
146 (define interface-description-alist
147 (map (lambda (x) (cons (string->symbol x) (eval-string x)))
150 (set! interface-description-alist (sort interface-description-alist alist<?))
152 (define (document-all-interfaces name)
154 (texi-node-menu name (map (lambda (x)
155 (cons (interface-name (symbol->string x)) ""))
156 (map cadr interface-description-alist)))
158 (map document-separate-interface
159 (map cdr interface-description-alist)))))
161 (define (document-all-backend-properties name)
164 (ps (sort (map symbol->string all-backend-properties) string<?))
165 (descs (map (lambda (prop)
166 (backend-property->texi (string->symbol prop)))
168 (texi (description-list->texi descs))
173 (texi-section 1 name #f)