;;;; backend-documentation-lib.scm -- Functions for backend documentation
;;;;
;;;; source file of the GNU LilyPond music typesetter
-;;;;
-;;;; (c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;;
+;;;; (c) 2000--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
;;;; Jan Nieuwenhuizen <janneke@gnu.org>
(define (interface-doc-string interface grob-description)
(if (pair? uprops)
(string-append
- "\n\n@unnumberedsubsubsec User settable properties:\n"
- (description-list->texi user-propdocs))
+ "\n\n@subsubheading User settable properties:\n"
+ (description-list->texi user-propdocs #t))
"")
(if (pair? iprops)
(string-append
- "\n\n@unnumberedsubsubsec Internal properties: \n"
- (description-list->texi internal-propdocs))
+ "\n\n@subsubheading Internal properties:\n"
+ (description-list->texi internal-propdocs #t))
""))))
(define iface->grob-table (make-vector 61 '()))
;; First level Interface description
(define (interface-doc interface)
- (let ((name (symbol->string (car interface))))
+ (let* ((name (symbol->string (car interface)))
+ (interface-list (human-listify
+ (map ref-ify
+ (sort
+ (map symbol->string
+ (hashq-ref iface->grob-table
+ (car interface)
+ '()))
+ string<?)))))
(make <texi-node>
#:name name
#:text (string-append
(interface-doc-string (cdr interface) '())
"\n\n"
- "This grob interface is used in the following graphical objects: "
-
- (human-listify
- (map ref-ify
- (sort
- (map symbol->string
- (hashq-ref iface->grob-table (car interface) '()))
- string<?)))))))
+ "This grob interface "
+ (if (equal? interface-list "none")
+ "is not used in any graphical object"
+ (string-append
+ "is used in the following graphical object(s): "
+ interface-list))
+ "."))))
(define (grob-alist->texi alist)
(let* ((uprops (filter (lambda (x) (not (object-property x 'backend-internal)))
(description-list->texi
(map (lambda (y) (property->texi 'backend y alist))
- uprops))))
+ uprops)
+ #t)))
(define (grob-doc description)
"Given a property alist DESCRIPTION, make a documentation
(ifacedoc (map (lambda (iface)
(if (pair? iface)
(ref-ify (symbol->string (car iface)))
- (error (format "Error making doc of ~s" name))))
+ (ly:error (_ "pair expected in doc ~s") name)))
(reverse ifaces)))
(engravers (filter
- (lambda (x) (engraver-makes-grob? name x)) all-engravers-list))
+ (lambda (x) (engraver-makes-grob? name x))
+ all-engravers-list))
(namestr (symbol->string name))
- (engraver-names (map symbol->string (map ly:translator-name engravers))))
+ (engraver-names (map symbol->string
+ (map ly:translator-name engravers)))
+ (engraver-list (human-listify
+ (map ref-ify
+ (map engraver-name engraver-names)))))
(make <texi-node>
#:name namestr
#:text
(string-append
- namestr " objects are created by: "
- (human-listify (map ref-ify
- (map engraver-name engraver-names)))
- "\n\nStandard settings: \n\n"
+ namestr " objects "
+ (if (equal? engraver-list "none")
+ "are not created by any engraver"
+ (string-append
+ "are created by: "
+ engraver-list))
+ "."
+
+ "\n\nStandard settings:\n\n"
(grob-alist->texi description)
- "\n\nThis object supports the following interfaces: \n"
- (human-listify ifacedoc)))))
+ "\n\nThis object supports the following interface(s):\n"
+ (human-listify ifacedoc)
+ "."))))
(define (all-grobs-doc)
(make <texi-node>
#:name "All layout objects"
- #:desc "Description and defaults for all Grobs"
+ #:desc "Description and defaults for all graphical objects (grobs)."
#:children
(map (lambda (x) (grob-doc (cdr x))) all-grob-descriptions)))
;;;;;;;;;; check for dangling backend properties.
(define (mark-interface-properties entry)
- (map (lambda (x) (set-object-property! x 'iface-marked #t)) (caddr (cdr entry))))
+ (map (lambda (x) (set-object-property! x 'iface-marked #t))
+ (caddr (cdr entry))))
(map mark-interface-properties interface-description-alist)
(define (check-dangling-properties prop)
(if (not (object-property prop 'iface-marked))
- (error "\ndefine-grob-properties.scm: Can't find interface for property:" prop)))
+ (ly:error (string-append "define-grob-properties.scm: "
+ (_ "cannot find interface for property: ~S")) prop)))
(map check-dangling-properties all-backend-properties)
;;;;;;;;;;;;;;;;
(define (lookup-interface name)
- (let* ((entry (hashq-ref (ly:all-grob-interfaces) name '())))
- (if (equal? entry #f)
- (error "Unknown interface" name))
- entry))
+ (let* ((entry (hashq-ref (ly:all-grob-interfaces) name #f)))
+ (if entry
+ entry
+ (ly:error (_ "unknown Grob interface: ~S") name))))
(define (all-interfaces-doc)
(make <texi-node>
#:name "Graphical Object Interfaces"
- #:desc "Building blocks of graphical objects"
+ #:desc "Building blocks of graphical objects."
#:children
(map interface-doc interface-description-alist)))
(let* ((ps (sort (map symbol->string lst) string<?))
(descs (map (lambda (prop)
(property->texi 'backend (string->symbol prop) '())) ps))
- (texi (description-list->texi descs)))
+ (texi (description-list->texi descs #f)))
texi))
;;(dump-node (grob-doc (cdadr all-grob-descriptions)) (current-output-port) 0 )
(define (backend-doc-node)
(make <texi-node>
#:name "Backend"
- #:desc "Reference for the layout engine"
+ #:desc "Reference for the layout engine."
#:children
(list
(all-grobs-doc)
(all-interfaces-doc)
(make <texi-node>
#:name "User backend properties"
- #:desc "All tunable properties in a big list"
+ #:desc "All tunable properties in a big list."
#:text (backend-properties-doc-string all-user-grob-properties))
(make <texi-node>
#:name "Internal backend properties"
- #:desc "All internal layout properties in a big list"
+ #:desc "All internal layout properties in a big list."
#:text (backend-properties-doc-string all-internal-grob-properties)))))