]> git.donarmstrong.com Git - lilypond.git/blob - scm/document-functions.scm
(conv): \apply -> \applymusic
[lilypond.git] / scm / document-functions.scm
1 ;;;; document-funcions.scm -- part of generated backend documentation
2 ;;;;
3 ;;;;  source file of the GNU LilyPond music typesetter
4 ;;;; 
5 ;;;; (c)  1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
6 ;;;;                 Jan Nieuwenhuizen <janneke@gnu.org>
7
8 (use-modules
9  (ice-9 regex)
10  )
11
12 (define (dashify-underscores str)
13    (regexp-substitute/global #f "_" str 'pre "-" 'post))
14
15 (define (format-c-header c-h)
16   (regexp-substitute/global
17    #f "," 
18    (regexp-substitute/global #f "(SCM|\\)|\\() *" (dashify-underscores c-h)
19                              'pre "" 'post)
20    'pre " " 'post))
21
22 (define (document-scheme-function name c-header doc-string)
23   (string-append
24    "@defun " (symbol->string name)  " " (format-c-header c-header) "\n"
25    doc-string
26    "\n@end defun\n\n")
27    )
28
29 (define all-scheme-functions
30    (hash-fold
31     (lambda (key val prior)
32       (cons (cons key val)  prior))
33     '() (ly:get-all-function-documentation)))
34
35 (define (all-scheme-functions-doc)
36   (let*
37       ((fdocs (map (lambda (x)
38                 (document-scheme-function (car x) (cadr x) (cddr x))
39                 )
40               all-scheme-functions)
41          )
42        (sfdocs (sort fdocs string<?))
43        
44        )
45
46     (make <texi-node>
47       #:name "Scheme functions"
48       #:desc "Primitive functions exported by LilyPond"
49       #:text
50       (apply string-append sfdocs)) 
51   ))
52
53
54 ; (dump-node (all-scheme-functions-doc)  (current-output-port) 0 )