From: nsceaux <nsceaux>
Date: Fri, 22 Jul 2005 18:28:35 +0000 (+0000)
Subject: * scm/display-lily.scm: new file. Define a `display-lily-music'
X-Git-Tag: release/2.6.4~17^2~196
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=c4bb183fa77de3a80676a18fd39e22adaaa68420;p=lilypond.git

* scm/display-lily.scm: new file. Define a `display-lily-music'
function, that displays the music expression given as an argument,
using LilyPond notation.

* scm/define-music-display-methods.scm: new file. Implementation
of display methods for each music type.

* ly/music-functions-init.ly (displayLilyMusic): new function for
displaying music with LilyPond notation.

* scm/markup.scm: remove obsolete debugging code (for printing
markups with LilyPond notation).

* scm/define-music-types.scm (music-name-to-property-table):
* scm/clef.scm (supported-clefs): export, in order to be accessible
from the (scm display-lily) module.
---

diff --git a/ChangeLog b/ChangeLog
index 175d24b267..c13e26b40e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2005-07-22  Nicolas Sceaux  <nicolas.sceaux@free.fr>
+
+	* scm/display-lily.scm: new file. Define a `display-lily-music'
+	function, that displays the music expression given as an argument,
+	using LilyPond notation.
+
+	* scm/define-music-display-methods.scm: new file. Implementation
+	of display methods for each music type.
+
+	* ly/music-functions-init.ly (displayLilyMusic): new function for
+	displaying music with LilyPond notation.
+
+	* input/regression/display-lily-tests.ly: new regression test file
+	for `display-lily-music'.
+
+	* scm/markup.scm: remove obsolete debugging code (for printing
+	markups with LilyPond notation).
+
+	* scm/define-music-types.scm (music-name-to-property-table):
+	* scm/clef.scm (supported-clefs): export, in order to be accessible
+	from the (scm display-lily) module.
+
 2005-07-22  Jan Nieuwenhuizen  <janneke@gnu.org>
 
 	* Documentation/topdocs/NEWS.tely (Top): Typo.
diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index 2d2b9f112d..262d9e72b6 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -47,6 +47,14 @@ displayMusic =
 #(def-music-function (parser location music) (ly:music?)
 		 (display-scheme-music music)
 		 music)
+
+#(use-modules (scm display-lily))
+displayLilyMusic =
+#(def-music-function (parser location music) (ly:music?)
+   (display-lily-init parser)
+   (display-lily-music music)
+   music)
+
 applyoutput =
 #(def-music-function (parser location proc) (procedure?)
                 (make-music 'ApplyOutputEvent 
diff --git a/scm/clef.scm b/scm/clef.scm
index 68fa718db0..aeb34db579 100644
--- a/scm/clef.scm
+++ b/scm/clef.scm
@@ -9,7 +9,7 @@
 ;;
 ;; -- the name clefOctavation is misleading. The value 7 is 1 octave,
 ;; not 7 Octaves.
-(define supported-clefs
+(define-public supported-clefs
   '(("treble" . ("clefs.G" -2 0))
     ("violin" . ("clefs.G" -2 0))
     ("G" . ("clefs.G" -2 0))
diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm
index d98cd7b9ad..8fa7798a19 100644
--- a/scm/define-music-types.scm
+++ b/scm/define-music-types.scm
@@ -701,7 +701,7 @@ Syntax: @code{\\\\}")
 (set! music-descriptions
       (sort music-descriptions alist<?))
 
-(define music-name-to-property-table (make-vector 59 '()))
+(define-public music-name-to-property-table (make-vector 59 '()))
 
 ;; init hash table,
 ;; transport description to an object property.
diff --git a/scm/markup.scm b/scm/markup.scm
index af0d36dc6e..dc56901666 100644
--- a/scm/markup.scm
+++ b/scm/markup.scm
@@ -220,43 +220,6 @@ Use `markup*' in a \\notes block."
          (values (cons 'list (compile-all-markup-args (car expr))) (cdr expr)))
         (else (values (car expr) (cdr expr)))))
 
-;;;;;;;;;;;;;;;
-;;; Debugging utilities: print markup expressions in a friendly fashion
-
-(use-modules (ice-9 format))
-(define (markup->string markup-expr)
-  "Return a string describing, in LilyPond syntax, the given markup expression."
-  (define (proc->command proc)
-    (let ((cmd-markup (symbol->string (procedure-name proc))))
-      (substring cmd-markup 0 (- (string-length cmd-markup)
-                                 (string-length "-markup")))))
-  (define (arg->string arg)
-    (cond ((and (pair? arg) (pair? (car arg))) ;; markup list
-           (format #f "~{ ~a~}" (map markup->string arg)))
-          ((pair? arg)                         ;; markup
-           (markup->string arg))
-          ((string? arg)                       ;; scheme string argument
-           (format #f "#\"~a\"" arg))
-          (else                                ;; other scheme arg
-           (format #f "#~a" arg))))
-  (let ((cmd (car markup-expr))
-        (args (cdr markup-expr)))
-    (cond ((eqv? cmd simple-markup) ;; a simple string
-           (format #f "\"~a\"" (car args)))
-          ((eqv? cmd line-markup)   ;; { ... }
-           (format #f "{~a}" (arg->string (car args))))
-          ((eqv? cmd center-align-markup) ;; \center < ... >
-           (format #f "\\center-align <~a>" (arg->string (car args))))
-          ((eqv? cmd column-markup) ;; \column < ... >
-           (format #f "\\column <~a>" (arg->string (car args))))
-          (else                ;; \command ...
-           (format #f "\\~a~{ ~a~} " (proc->command cmd) (map arg->string args))))))
-
-(define-public (display-markup markup-expr)
-  "Print a LilyPond-syntax equivalent for the given markup expression."
-  (display "\\markup ")
-  (display (markup->string markup-expr)))
-
 ;;;;;;;;;;;;;;;
 ;;; Utilities for storing and accessing markup commands signature
 ;;; and keyword.