X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scm%2Fdocument-identifiers.scm;h=e17f7d308c086100ecdc2fc7979b6402d6604aa4;hb=59ee8eafd377bd11a4b0bf104db9aafc96b56d27;hp=67e282bd862cd594beb8c26680ac25d0697021a2;hpb=3f43309ace290fc86c4fafb4e2841028d04e2c4e;p=lilypond.git diff --git a/scm/document-identifiers.scm b/scm/document-identifiers.scm index 67e282bd86..e17f7d308c 100644 --- a/scm/document-identifiers.scm +++ b/scm/document-identifiers.scm @@ -1,11 +1,19 @@ -;; -;; document-identifiers.scm -- implement documentation -;; of identifiers from .ly file. -;; -;; source file of the GNU LilyPond music typesetter -;; -;; (c) 2006 Han-Wen Nienhuys -;; +;;;; This file is part of LilyPond, the GNU music typesetter. +;;;; +;;;; Copyright (C) 2006--2012 Han-Wen Nienhuys +;;;; +;;;; LilyPond is free software: you can redistribute it and/or modify +;;;; it under the terms of the GNU General Public License as published by +;;;; the Free Software Foundation, either version 3 of the License, or +;;;; (at your option) any later version. +;;;; +;;;; LilyPond is distributed in the hope that it will be useful, +;;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;;; GNU General Public License for more details. +;;;; +;;;; You should have received a copy of the GNU General Public License +;;;; along with LilyPond. If not, see . (use-modules (ice-9 format)) @@ -15,26 +23,32 @@ (music-func (cdr music-func-pair)) (func (ly:music-function-extract music-func)) (arg-names - (map symbol->string - (cddr (cadr (procedure-source func))))) + (map symbol->string + (cddr (cadr (procedure-source func))))) (doc (procedure-documentation func)) - (sign (object-property func 'music-function-signature)) - (type-names (map type-name sign)) - + (sign (ly:music-function-signature music-func)) + (type-names (map (lambda (pred) + (if (pair? pred) + (format #f "[~a]" (type-name (car pred))) + (format #f "(~a)" (type-name pred)))) + sign)) (signature-str - (string-join - (map (lambda (x) (format "@var{~a} (~a)" - (car x) - (cadr x))) - (zip arg-names type-names))))) - (format - "@item @code{~a}~a~a -@findex ~a + (string-join + (map (lambda (arg type) (format #f "@var{~a} ~a" arg type)) + arg-names (cdr type-names))))) + (format #f + "@item @code{~a} ~a ~a~a +@funindex ~a ~a " - name-sym (if (equal? "" signature-str) "" " - ") signature-str - name-sym - (if doc doc "(undocumented; fixme)")))) + name-sym (car type-names) + (if (equal? "" signature-str) "" " - ") signature-str + name-sym + (if doc + doc + (begin + (ly:warning "music function `~a' not documented." name-sym) + "(undocumented; fixme)"))))) (define (document-object obj-pair) @@ -44,25 +58,18 @@ (else #f))) - -(define (identifierstring (car a)) - (symbol->string (car b)))) - - (define-public (identifiers-doc-string) - (format - "@table @asis + (format #f + "@table @asis ~a @end table " - (string-join - (filter - identity - (map - document-object - (sort - (ly:module->alist (current-module)) - identifieralist (current-module)) + identifier