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