release commit
[lilypond.git] / scm / document-functions.scm
blob19b619b365f7c8bb6e4abad078263a2268b56817
1 (use-modules
2  (ice-9 regex)
3  )
5 (define (dashify-underscores str)
6    (regexp-substitute/global #f "_" str 'pre "-" 'post))
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))
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    )
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)))
29 (define (all-scheme-functions-doc)
30   (let*
31       (
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        )
42     (make <texi-node>
43       #:name "Scheme functions"
44       #:desc "Primitive functions exported by LilyPond"
45       #:text
46       (apply string-append sfdocs)
47         ) 
48   ))
51 ; (dump-node (all-scheme-functions-doc)  (current-output-port) 0 )