For a while, some of us have been wanting to generate the
valid music-function type-predicates automatically. I tried
something but got stuck almost immediately. I don't know if
this is the right approach, but by adding these two scheme
definitions just after the (set! type-p-name-alist ...)
block in scm/lily.scm, a texinfo string is stored in the
scheme variable "typecheck-doc-table".
For the scheme code below, I added a space after any
double-quote that is immediately followed by an at-sign (to
sidestep the annnoying addr...@hidden archive mangling).
Though in the attached patch, I didn't add these spaces.
Also, the columns in the table are reversed for now, since
type-p-name-alist is sorted by predicate (not by the
description docstring). I'll either need to modify the
(make-doc-typecheck-row ...) procedure so that the columns
are switched, or reword the doc sentences leading up to the
table (neither is a big problem).
The question is, is this the right approach? Is there a way
for the texinfo doc files to access the typecheck-doc-table
string so that that the table appears as if it were inline
texinfo?
Thanks.
- Mark
* * * * * * * * * * *
(define (make-doc-typecheck-row entry)
(string-append
;; remove the space between " and @...
" @item @code{"
(symbol->string (procedure-name (car entry)))
"} @tab "
(cdr entry)
"\n"))
(define typecheck-doc-table
(string-append
;; remove the spaces between " and @...
" @multitable @columnfractions .33 .66\n"
" @headitem Type predicate @tab Description\n"
(apply string-append
(map make-doc-typecheck-row type-p-name-alist))
" @end multitable\n"))
From df77a1380c4abcb910987cce4e0bace9a042cd76 Mon Sep 17 00:00:00 2001
From: Mark Polesky <[email protected]>
Date: Tue, 20 Apr 2010 23:52:36 -0700
Subject: [PATCH] lily.scm: Generate typecheck-doc-table texinfo string.
---
scm/lily.scm | 20 ++++++++++++++++++--
1 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/scm/lily.scm b/scm/lily.scm
index 8cfebbd..93c6909 100644
--- a/scm/lily.scm
+++ b/scm/lily.scm
@@ -49,8 +49,8 @@
"Render at higher resolution (using given factor)
and scale down result to prevent jaggies in
PNG images.")
- (aux-files #t
-"Create .tex, .texi, .count files in the
+ (aux-files #t
+"Create .tex, .texi, .count files in the
EPS backend.")
(backend ps
"Select backend. Possible values: 'eps, 'null,
@@ -455,6 +455,22 @@ LilyPond safe mode. The syntax is the same as `define*-public'."
(,symbol? . "symbol")
(,vector? . "vector")))
+(define (make-doc-typecheck-row entry)
+ (string-append
+ "@item @code{"
+ (symbol->string (procedure-name (car entry)))
+ "} @tab "
+ (cdr entry)
+ "\n"))
+
+(define typecheck-doc-table
+ (string-append
+ "@multitable @columnfractions .33 .66\n"
+ "@headitem Type predicate @tab Description\n"
+ (apply string-append
+ (map make-doc-typecheck-row type-p-name-alist))
+ "@end multitable\n"))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; timing
--
1.6.3.3
_______________________________________________
lilypond-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-devel