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