]> git.donarmstrong.com Git - lilypond.git/blob - scm/document-functions.scm
*** empty log message ***
[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 (define (dashify-underscores str)
12    (regexp-substitute/global #f "_" str 'pre "-" 'post))
13
14 (define (format-c-header c-h)
15   (regexp-substitute/global
16    #f "," 
17    (regexp-substitute/global #f "(SCM|\\)|\\() *" (dashify-underscores c-h)
18                              'pre "" 'post)
19    'pre " " 'post))
20
21 (define (document-scheme-function name c-header doc-string)
22   (string-append
23    "@defun " (symbol->string name)  " " (format-c-header c-header) "\n"
24    doc-string
25    "\n@end defun\n\n"))
26
27 (define all-scheme-functions
28    (hash-fold
29     (lambda (key val prior)
30       (cons (cons key val)  prior))
31     '() (ly:get-all-function-documentation)))
32
33 (define (all-scheme-functions-doc)
34   (let*
35       ((fdocs (map (lambda (x)
36                 (document-scheme-function (car x) (cadr x) (cddr x))
37                 )
38               all-scheme-functions)
39          )
40        (sfdocs (sort fdocs string<?))) 
41     (make <texi-node>
42       #:name "Scheme functions"
43       #:desc "Primitive functions exported by LilyPond"
44       #:text
45       (apply string-append sfdocs)) 
46   ))
47
48
49 ; (dump-node (all-scheme-functions-doc)  (current-output-port) 0 )