From 3457b52d3008d3dbf5e38d252690e5fcf3e13107 Mon Sep 17 00:00:00 2001 From: Nicolas Sceaux Date: Fri, 22 Jul 2005 18:28:35 +0000 Subject: [PATCH] * 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. --- ChangeLog | 22 ++++++++++++++++++++++ ly/music-functions-init.ly | 8 ++++++++ scm/clef.scm | 2 +- scm/define-music-types.scm | 2 +- scm/markup.scm | 37 ------------------------------------- 5 files changed, 32 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 175d24b267..c13e26b40e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2005-07-22 Nicolas Sceaux + + * 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 * 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 aliststring 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. -- 2.39.5