]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/display-lily.scm
update doc files.
[lilypond.git] / scm / display-lily.scm
index a19a3f7974e2bc8398a01510b549ba02e8950da3..df0d04df7d97f8204e115178e22664c702e625bf 100644 (file)
@@ -2,7 +2,7 @@
 ;;;
 ;;;
 ;;;
-;;; (c) 2005 Nicolas Sceaux  <nicolas.sceaux@free.fr>
+;;; (c) 2005--2006 Nicolas Sceaux  <nicolas.sceaux@free.fr>
 ;;;
 
 ;;; - This file defines the procedures used to define display methods for each
@@ -42,7 +42,7 @@
 `display-methods' property of the music type entry found in the
 `music-name-to-property-table' hash table. Print methods previously
 defined for that music type are lost. 
-Syntax: (define-display-method MusicType (expression)
+Syntax: (define-display-method MusicType (expression parser)
          ...body...))"
   `(let ((type-props (hashq-ref music-name-to-property-table
                                ',music-type '()))
@@ -75,15 +75,12 @@ display method will be called."
      new-method))
 
 (define* (tag->lily-string expr #:optional (post-event? #f))
-  (let ((tags (ly:music-property expr 'tags)))
-    (cond ((null? tags)
-          "")
-         ((null? (cdr tags))
-          (format #f "~a\\tag #'~a " (if post-event? "-" "") (car tags)))
-         (else
-          (format #f "~a\\tag #'(~a~{ ~a~}) " (if post-event? "-" "") (car tags) (cdr tags))))))
+  (format #f "~{~a ~}"
+         (map (lambda (tag)
+                (format #f "~a\\tag #'~a" (if post-event? "-" "") tag))
+              (ly:music-property expr 'tags))))
 
-(define-public (music->lily-string expr)
+(define-public (music->lily-string expr parser)
   "Print expr, a music expression, in LilyPond syntax"
   (if (ly:music? expr)
       (let* ((music-type (ly:music-property expr 'name))
@@ -91,7 +88,7 @@ display method will be called."
                                          music-type '())
                               'display-methods))
             (result-string (and procs (any (lambda (proc)
-                                             (proc expr))
+                                             (proc expr parser))
                                            procs))))
        (if result-string
            (format #f "~a~a" 
@@ -101,11 +98,11 @@ display method will be called."
                    music-type)))
       (format #f "%{ expecting a music expression: ~a %}" expr)))
 
-(define*-public (display-lily-music expr #:key force-duration)
+(define*-public (display-lily-music expr parser #:key force-duration)
   (parameterize ((*indent* 0)
                 (*previous-duration* (ly:make-duration 2))
                 (*force-duration* force-duration))
-    (display (music->lily-string expr))
+    (display (music->lily-string expr parser))
     (newline)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -286,8 +283,6 @@ inside body."
 (define *time-factor-denominator* (make-parameter #f))
 (define *time-factor-numerator* (make-parameter #f))
 
-(define *parser* (make-parameter #f))
-
 (define *current-context* (make-parameter 'Bottom))
 
 (define *explicit-mode* (make-parameter #t))