]> git.donarmstrong.com Git - lilypond.git/blob - scm/document-functions.scm
Add '-dcrop' option to ps and svg backends
[lilypond.git] / scm / document-functions.scm
1 ;;;; This file is part of LilyPond, the GNU music typesetter.
2 ;;;;
3 ;;;; Copyright (C) 1998--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
4 ;;;;                 Jan Nieuwenhuizen <janneke@gnu.org>
5 ;;;;
6 ;;;; LilyPond is free software: you can redistribute it and/or modify
7 ;;;; it under the terms of the GNU General Public License as published by
8 ;;;; the Free Software Foundation, either version 3 of the License, or
9 ;;;; (at your option) any later version.
10 ;;;;
11 ;;;; LilyPond is distributed in the hope that it will be useful,
12 ;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 ;;;; GNU General Public License for more details.
15 ;;;;
16 ;;;; You should have received a copy of the GNU General Public License
17 ;;;; along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18
19 (use-modules
20  (ice-9 regex))
21
22 (define (dashify-underscores str)
23   (regexp-substitute/global #f "_" str 'pre "-" 'post))
24
25 (define (format-c-header c-h)
26   (regexp-substitute/global
27    #f ","
28    (regexp-substitute/global #f "(SCM|\\)|\\() *" (dashify-underscores c-h)
29                              'pre "" 'post)
30    'pre " " 'post))
31
32 (define (document-scheme-function name c-header doc-string)
33   (string-append
34    "@defun " (symbol->string name)  " " (format-c-header c-header) "\n"
35    doc-string
36    "\n@end defun\n\n"))
37
38 (define all-scheme-functions
39   (hash-fold
40    (lambda (key val prior)
41      (cons (cons key val)  prior))
42    '() (ly:get-all-function-documentation)))
43
44 (define (all-scheme-functions-doc)
45   (let* ((fdocs (map (lambda (x)
46                        (document-scheme-function (car x) (cadr x) (cddr x)))
47                      all-scheme-functions))
48          (sfdocs (sort fdocs ly:string-ci<?)))
49     (make <texi-node>
50       #:name "Scheme functions"
51       #:desc "Primitive functions exported by LilyPond."
52       #:text
53       (string-concatenate sfdocs))))
54
55 ;; (dump-node (all-scheme-functions-doc)  (current-output-port) 0 )