]> git.donarmstrong.com Git - lilypond.git/blob - scm/document-functions.scm
* scm/define-markup-commands.scm (smallcaps): New markup command.
[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       )
34     '() (ly:get-all-function-documentation)))
35
36 (define (all-scheme-functions-doc)
37   (let*
38       (
39
40        (fdocs (map (lambda (x)
41                 (document-scheme-function (car x) (cadr x) (cddr x))
42                 )
43               all-scheme-functions)
44          )
45        (sfdocs (sort fdocs string<?))
46        )
47
48
49     (make <texi-node>
50       #:name "Scheme functions"
51       #:desc "Primitive functions exported by LilyPond"
52       #:text
53       (apply string-append sfdocs)
54         ) 
55   ))
56
57
58 ; (dump-node (all-scheme-functions-doc)  (current-output-port) 0 )