[PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

classic Classic list List threaded Threaded
14 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Ian Hulin
init.ly - Add new parser variables book-output-suffix and book-filename initialized as #f and empty queue/stack structure.

music-functions-init.ly adds three new functions
  • \bookOutputSuffix - to set the output suffix for the \book block
  • \bookOutputName - to set output filename for the current \book block
  • \bookOuptutNameRevert - to restore the the output filename to the value prior to that of the last \bookOuputName call.
\bookOutputName and \bookOuptutNameRevert use the book-filename as a stack structure.  I have used this so we can we could eventually allow users to do stuff like the following (controlling the names used to open the midi files is not part of the current patch).
\book {
    \bookOutputName "My-Homeland"
    \score {
       \bookOutputName "Vysehrad"
          music-declarations ...
          \midi{
          % midi file gets written to Vysehrad.mid(i)
          }
          \layout{
          }
       \bookOutputNameRevert
    }
    \score {
        \bookOuputName "Vltava"
        ...
        \midi {
        % midi file is written to Vltava.mid(i)
        }
    }
.
.


lily-library.scm has changes to the filename generating code in print-book-with to pick up the current values of the new parser variables if set before using the current output-suffix or result of a call to ly:parser-output-name.
The routine to get the name now uses as combination of the current output name and output suffix value to at as a key for the internal a-list of filenames being written to during a compilation.

lily-guile.hh, lily-guile.cc and parser.yy have code that I would like to use to re-initialize book-output-suffix and book-filename to initial values on encountering the end of a \book block, but  I've hit a dead-end currently in this  as the code I tried to use in parser.yy negates the effect of calling the new functions altogether.  If anyone with more experience of how bison works has any better ideas as to how do this I'd be interested in hearing them.

Thanks in advance for any feedback.

Cheers,

Ian Hulin



From c99522fea1e518f33b24307b7b64f5780bb34add Mon Sep 17 00:00:00 2001
From: ian <[hidden email]>
Date: Fri, 23 Oct 2009 02:06:24 +0100
Subject: [PATCH] Tracker 836:
  Add facility to change output file-name for a \book block or to set a
  suffix to prevent multiple files over-writing each other during a
  compilation.
  This change allows user to to this via functions rather than having to do so
  so by manipulating semi-documented parser variables.

---
 input/regression/backend-svg.ly |    4 +-
 lily/include/lily-guile.hh      |    2 +
 lily/lily-guile.cc              |   11 ++++++++
 lily/parser.yy                  |    7 +++++
 ly/init.ly                      |    3 ++
 ly/music-functions-init.ly      |   52 +++++++++++++++++++++++++++------------
 scm/lily-library.scm            |   52 ++++++++++++++++++++++++++++----------
 7 files changed, 99 insertions(+), 32 deletions(-)

diff --git a/input/regression/backend-svg.ly b/input/regression/backend-svg.ly
index 69116f1..b8b6ffd 100644
--- a/input/regression/backend-svg.ly
+++ b/input/regression/backend-svg.ly
@@ -1,6 +1,6 @@
 %{
 #(ly:set-option 'backend 'svg)
-#(set! output-count 1)
+#(define output-suffix "1")
 
 
 \include "typography-demo.ly"
@@ -26,7 +26,7 @@
    (format #f "FONTCONFIG_FILE=~a/fonts/fonts.conf" (ly:effective-prefix))
    (ly:start-environment)))
 
-#(set! output-count 0)
+#(define output-suffix #f)
 #(set-default-paper-size "a5")
 
 \book {
diff --git a/lily/include/lily-guile.hh b/lily/include/lily-guile.hh
index 859131a..ec1b0b0 100644
--- a/lily/include/lily-guile.hh
+++ b/lily/include/lily-guile.hh
@@ -117,6 +117,8 @@ inline SCM ly_append4 (SCM x1, SCM x2, SCM x3, SCM x4)
   return scm_append (scm_listify (x1, x2, x3, x4, SCM_UNDEFINED));
 }
 
+SCM ly_scm_make_q ();
+
 /*
   display and print newline.
 */
diff --git a/lily/lily-guile.cc b/lily/lily-guile.cc
index d81eec8..f3054b9 100644
--- a/lily/lily-guile.cc
+++ b/lily/lily-guile.cc
@@ -187,6 +187,17 @@ to_boolean (SCM s)
 }
 
 /*
+ QUEUES - for compatibility with (ice-9 q)
+ 1. ly_scm_make_q - initialize a queue
+*/
+
+SCM
+ly_scm_make_q ()
+{  
+    return scm_cons ( SCM_EOL, SCM_BOOL_F);
+}
+
+/*
   DIRECTIONS
  */
 Direction
diff --git a/lily/parser.yy b/lily/parser.yy
index 813452e..12a3e6b 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -656,6 +656,13 @@ book_block:
  $$ = $3;
  pop_paper (PARSER);
  PARSER->lexer_->set_identifier (ly_symbol2scm ("$current-book"), SCM_BOOL_F);
+/* TODO
+*        It would be nice to scope book-output-suffix and book-filename to the current
+*        book block, but using this cancels
+*        _all_ changes made by calling the functions in the \book block.
+*        PARSER->lexer_->set_identifier (ly_symbol2scm ("book-output-suffix"), SCM_BOOL_F);
+* PARSER->lexer_->set_identifier (ly_symbol2scm ("book-filename"), ly_scm_make_q () );
+*/
  }
  ;
 
diff --git a/ly/init.ly b/ly/init.ly
index 5418b80..bc24247 100644
--- a/ly/init.ly
+++ b/ly/init.ly
@@ -7,6 +7,7 @@
 \version "2.12.0"
 
 \include "declarations-init.ly"
+#(use-modules (ice-9 q))
 
 #(ly:set-option 'old-relative #f)
 #(define toplevel-scores (list))
@@ -18,6 +19,8 @@
 #(define expect-error #f)
 #(define output-empty-score-list #f)
 #(define output-suffix #f)
+#(define book-filename (make-q) )
+#(define book-output-suffix #f)
 #(use-modules (scm clip-region))
 \maininput
 %% there is a problem at the end of the input file
diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index a8a2ece..797a7d9 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -9,7 +9,8 @@
 
 %% need SRFI-1 for filter; optargs for lambda*
 #(use-modules (srfi srfi-1)
-      (ice-9 optargs))
+              (ice-9 optargs)
+              (ice-9 q))
 
 %% TODO: using define-music-function in a .scm causes crash.
 
@@ -179,8 +180,27 @@ breathe =
       'origin location
       'elements (list (make-music 'BreathingEvent))))
 
+bookOutputName =
+#(define-music-function (parser location newfilename) (string?)
+    (_i "Direct output for the current book block to @var{newfilename}")
+        (q-push! book-filename newfilename)
+        (make-music 'SequentialMusic 'void #t))
 
-
+bookOutputNameRevert =
+#(define-music-function (parser location) ()
+    (_i "Restore output name for current book block to its value prior to the
+ last @code{\\bookOutputName} call" )
+    (q-pop! book-filename)
+    (if (q-empty? book-filename)
+        (q-push book-filename (ly:parser-output-name parser) ))
+        (make-music 'SequentialMusic 'void #t))
+        
+bookOutputSuffix =
+#(define-music-function (parser location newsuffix) (string?)
+    (_i "Set the output filename suffix for the current book block to
+ @var{newsuffix}")
+        (set! book-output-suffix newsuffix)
+        (make-music 'SequentialMusic 'void #t))
 clef =
 #(define-music-function (parser location type) (string?)
   (_i "Set the current clef to @var{type}.")
@@ -323,7 +343,7 @@ killCues =
    (music-map
     (lambda (mus)
       (if (and (string? (ly:music-property mus 'quoted-music-name))
-              (string=? (ly:music-property mus 'quoted-context-id "") "cue"))
+       (string=? (ly:music-property mus 'quoted-context-id "") "cue"))
   (ly:music-property mus 'element)
   mus)) music))
 
@@ -449,8 +469,8 @@ or @code{\"GrobName\"}")
 %% because music identifiers are not allowed at top-level.
 pageBreak =
 #(define-music-function (location parser) ()
-   (_i "Force a page break. May be used at toplevel (i.e. between scores or
- markups), or inside a score.")
+   (_i "Force a page break. May be used at toplevel (ie between scores or
+markups), or inside a score.")
    (make-music 'EventChord
        'page-marker #t
        'line-break-permission 'force
@@ -584,16 +604,17 @@ parenthesize =
 
 partcombine =
 #(define-music-function (parser location part1 part2) (ly:music? ly:music?)
-(_i "Take the music in @var{part1} and @var{part2} and typeset so that they share a staff.")
-    (make-part-combine-music parser
+(_i "Take the music in @var{part1} and @var{part2} and typeset so that they
+ share a staff.")
+ (make-part-combine-music parser
  (list part1 part2)))
 
 pitchedTrill =
 #(define-music-function
-(_i "Print a trill with @var{main-note} as the main note of the trill and
-print @var{secondary-note} as stemless note head in parentheses")
    (parser location main-note secondary-note)
    (ly:music? ly:music?)
+(_i "Print a trill with @var{main-note} as the main note of the trill and
+ print @var{secondary-note} as stemless note head in parentheses.")
    (let*
        ((get-notes (lambda (ev-chord)
      (filter
@@ -625,12 +646,12 @@ print @var{secondary-note} as stemless note head in parentheses")
 
 quoteDuring =
 #(define-music-function
-(_i "Indicate a section of music to be quoted.  @var{what} indicates the name
-of the quoted voice, as specified in a @code{\\addQuote} command.  
-@var{main-music} is used to indicate the length of music to be quoted;
-usually contains spacers or multi-measure rests.")
   (parser location what main-music)
   (string? ly:music?)
+  (_i "Indicate a section of the music to be quoted.  @var{what} indicates the name
+ of the quoted voice, as specified in a @code{\\addQuote} command.
+ @var{main-music} is used to indicate the length of the music to be quoted; it
+ usually contains spacers or multi-measure rests.")
   (make-music 'QuoteMusic
       'element main-music
       'quoted-music-name what
@@ -810,11 +831,10 @@ tweak =
 
 unfoldRepeats =
 #(define-music-function (parser location music) (ly:music?)
-   (_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or
+(_i "Force any @code{\\repeat volta}, @code{\\repeat tremolo} or
  @code{\\repeat percent} commands in @var{music} to be interpreted
  as @code{\\repeat unfold}.")
-   (unfold-repeats music))
-
+  (unfold-repeats music))
 
 
 withMusicProperty =
diff --git a/scm/lily-library.scm b/scm/lily-library.scm
index 827fb24..06289bc 100644
--- a/scm/lily-library.scm
+++ b/scm/lily-library.scm
@@ -7,7 +7,8 @@
 ;;;; Han-Wen Nienhuys <[hidden email]>
 
 ; for take, drop, take-while, list-index, and find-tail:
-(use-modules (srfi srfi-1))
+(use-modules (srfi srfi-1)
+    (ice-9 q))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; constants.
@@ -134,16 +135,39 @@
 
   (ly:make-score music))
 
-
-(define (get-outfile-name parser base)
-  (let* ((output-suffix (ly:parser-lookup parser 'output-suffix))
- (counter-alist (ly:parser-lookup parser 'counter-alist))
- (output-count (assoc-get output-suffix counter-alist 0))
- (result base))
+;; return any suffix value for output filename allowing for settings by
+;; calls to \bookOutputName
+(define (get-current-filename parser)
+        (let* (
+                (book-filename (ly:parser-lookup parser 'book-filename)))
+            (if (q-empty? book-filename)
+            (ly:parser-output-name parser)
+            (q-front book-filename))))
+
+;; return any suffix value for output filename allowing for settings by
+;; calls to \bookOutputSuffix
+(define (get-current-suffix parser)
+   (let* (
+            (book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))
+    (if (string? book-output-suffix)
+        (ly:parser-lookup parser 'book-output-suffix)
+        (ly:parser-lookup parser 'output-suffix))))
+(define-public current-outfile-name #f)
+(define (get-outfile-name parser)
+    ;; user can now override the base file name, so we have to use
+    ;; the file-name concatenated with any potential output-suffix value
+    ;; as the key to out internal a-list
+  (let* (
+      (base-name (get-current-filename parser))
+      (output-suffix (get-current-suffix parser))
+      (alist-key (format "~a~a" base-name output-suffix))
+      (counter-alist (ly:parser-lookup parser 'counter-alist))      
+      (output-count (assoc-get alist-key counter-alist 0))
+      (result base-name))
     ;; Allow all ASCII alphanumerics, including accents
     (if (string? output-suffix)
  (set! result (format "~a-~a"
-     base (string-regexp-substitute
+      result (string-regexp-substitute
     "[^-[:alnum:]]" "_" output-suffix))))
 
     ;; assoc-get call will always have returned a number
@@ -152,15 +176,15 @@
 
     (ly:parser-define!
       parser 'counter-alist
-      (assoc-set! counter-alist output-suffix (1+ output-count)))
+      (assoc-set! counter-alist alist-key (1+ output-count)))
+    (set! current-outfile-name result)
     result))
 
 (define (print-book-with parser book process-procedure)
-  (let* ((paper (ly:parser-lookup parser '$defaultpaper))
- (layout (ly:parser-lookup parser '$defaultlayout))
- (count (ly:parser-lookup parser 'output-count))
- (base (ly:parser-output-name parser))
- (outfile-name (get-outfile-name parser base)))
+  (let* (
+        (paper (ly:parser-lookup parser '$defaultpaper))
+        (layout (ly:parser-lookup parser '$defaultlayout))
+        (outfile-name (get-outfile-name parser)))
 
     (process-procedure book paper layout outfile-name)))
 
--
1.6.0.4

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Carl Sorensen



On 10/23/09 5:52 PM, "Ian Hulin" <[hidden email]> wrote:

> init.ly - Add new parser variables book-output-suffix and book-filename
> initialized as #f and empty queue/stack structure.
>
> music-functions-init.ly adds three new functions
> * \bookOutputSuffix - to set the output suffix for the \book block
> * \bookOutputName - to set output filename for the current \book block
> * \bookOuptutNameRevert - to restore the the output filename to the value
> prior to that of the last \bookOuputName call.

I think these functions should be named

\setBookOutputSuffix
\setBookOutputName
\revertBookOutputName


> \bookOutputName and \bookOuptutNameRevert use the book-filename as a stack
> structure.  I have used this so we can we could eventually allow users to do
> stuff like the following (controlling the names used to open the midi files is
> not part of the current patch).
> \book {
>     \bookOutputName "My-Homeland"
>     \score {
>        \bookOutputName "Vysehrad"
>           music-declarations ...
>           \midi{
>           % midi file gets written to Vysehrad.mid(i)
>           }
>           \layout{
>           }
>        \bookOutputNameRevert
>     }
>     \score {
>         \bookOuputName "Vltava"
>         ...
>         \midi {
>         % midi file is written to Vltava.mid(i)
>         }
>     }
> .
> .
> . 

This code doesn't demonstrate the need for \bookOutputNameRevert; the same
thing would happen if the \bookOutputNameRevert were omitted, as far as I
can tell.

>
> lily-library.scm has changes to the filename generating code in
> print-book-with to pick up the current values of the new parser variables if
> set before using the current output-suffix or result of a call to
> ly:parser-output-name.
> The routine to get the name now uses as combination of the current output name
> and output suffix value to at as a key for the internal a-list of filenames
> being written to during a compilation.
>
> lily-guile.hh, lily-guile.cc and parser.yy have code that I would like to use
> to re-initialize book-output-suffix and book-filename to initial values on
> encountering the end of a \book block, but  I've hit a dead-end currently in
> this  as the code I tried to use in parser.yy negates the effect of calling
> the new functions altogether.  If anyone with more experience of how bison
> works has any better ideas as to how do this I'd be interested in hearing
> them.

It would seem to me (this is a relatively poorly informed opinion) that
setting them to the initial values at the *start* of a book block would be a
more sane way to do it that to reset them at the end of a book block.  Or is
there something I'm missing?

HTH,

Carl


---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Ian Hulin
Carl Sorensen wrote:

>
>
> On 10/23/09 5:52 PM, "Ian Hulin" <[hidden email]> wrote:
>
>> init.ly - Add new parser variables book-output-suffix and book-filename
>> initialized as #f and empty queue/stack structure.
>>
>> music-functions-init.ly adds three new functions
>> * \bookOutputSuffix - to set the output suffix for the \book block
>> * \bookOutputName - to set output filename for the current \book block
>> * \bookOuptutNameRevert - to restore the the output filename to the value
>> prior to that of the last \bookOuputName call.
>
> I think these functions should be named
>
> \setBookOutputSuffix
> \setBookOutputName
> \revertBookOutputName

You're probably right.  It's just that in music-functions-init the
source likes to group all the functions alphabetically, and this was a
way of getting all the related things together.

It's a shame we haven't got a way of declaring generic functions with
the parser so you could code  \bookCommand \OutputSuffix "mysuffix".
Well, I suppose we have if you imitate what \markup does in the parser
but I'm not going to go there...

So I'll go with your suggestions.

>
>
>> \bookOutputName and \bookOuptutNameRevert use the book-filename as a stack
>> structure.  I have used this so we can we could eventually allow users to do
>> stuff like the following (controlling the names used to open the midi files is
>> not part of the current patch).
>> \book {
>>     \bookOutputName "My-Homeland"
>>     \score {
>>        \bookOutputName "Vysehrad"
>>           music-declarations ...
>>           \midi{
>>           % midi file gets written to Vysehrad.mid(i)
>>           }
>>           \layout{
>>           }
>>        \bookOutputNameRevert
>>     }
>>     \score {
>>         \bookOuputName "Vltava"
>>         ...
>>         \midi {
>>         % midi file is written to Vltava.mid(i)
>>         }
>>     }
>> .
>> .
>> .  
>
> This code doesn't demonstrate the need for \bookOutputNameRevert; the same
> thing would happen if the \bookOutputNameRevert were omitted, as far as I
> can tell.
>

Consider this in one file Smetana.ly:

;;  Music for Má Vlast
\book {
        \bookOutputName "My-Homeland"
        \score {
                \bookOutputName "Vyšehrad"
                ...
        }
        \score {
                \bookOutputName "Vltava"
                ...
        }
        %%   three more \score blocks setting the output name
        \score {
                \bookOutputName "Blanik"
                ...
        }
}

;; Music for "Bartered Bride Overure"
\book {
        % No \bookOutputName here
        % Until scoping for \book blocks is sorted out,
        % this block will get output to Blanik.pdf and Blanik.midi.
        \score {
        ...
        }
}



>> lily-library.scm has changes to the filename generating code in
>> print-book-with to pick up the current values of the new parser variables if
>> set before using the current output-suffix or result of a call to
>> ly:parser-output-name.
>> The routine to get the name now uses as combination of the current output name
>> and output suffix value to at as a key for the internal a-list of filenames
>> being written to during a compilation.
>>
>> lily-guile.hh, lily-guile.cc and parser.yy have code that I would like to use
>> to re-initialize book-output-suffix and book-filename to initial values on
>> encountering the end of a \book block, but  I've hit a dead-end currently in
>> this  as the code I tried to use in parser.yy negates the effect of calling
>> the new functions altogether.  If anyone with more experience of how bison
>> works has any better ideas as to how do this I'd be interested in hearing
>> them.
>
> It would seem to me (this is a relatively poorly informed opinion) that
> setting them to the initial values at the *start* of a book block would be a
> more sane way to do it that to reset them at the end of a book block.  Or is
> there something I'm missing?

D'oh, I was getting blown away by having to learn Bison and work out
what was doing what, with which, to what, when, and by whom. . .

I'll try it out.

>
> HTH,
>
Thank, you, yes it does,

Cheers,
Ian

---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Graham Percival
In reply to this post by Carl Sorensen
On Mon, Oct 26, 2009 at 12:11:55PM -0600, Carl Sorensen wrote:

>
> On 10/23/09 5:52 PM, "Ian Hulin" <[hidden email]> wrote:
>
> > music-functions-init.ly adds three new functions
> > * \bookOutputSuffix - to set the output suffix for the \book block
> > * \bookOutputName - to set output filename for the current \book block
> > * \bookOuptutNameRevert - to restore the the output filename to the value
> > prior to that of the last \bookOuputName call.
>
> I think these functions should be named
>
> \setBookOutputSuffix
> \setBookOutputName
> \revertBookOutputName

Nooooo!  Having \set vs. \setBlahBlah is a nightmare for newbies.
Sorry, my brain is fried at the moment, so I have no alternative
suggestions.

Cheers,
- Graham

---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Carl Sorensen



On 10/26/09 3:09 PM, "Graham Percival" <[hidden email]> wrote:

> On Mon, Oct 26, 2009 at 12:11:55PM -0600, Carl Sorensen wrote:
>>
>> On 10/23/09 5:52 PM, "Ian Hulin" <[hidden email]> wrote:
>>
>>> music-functions-init.ly adds three new functions
>>> * \bookOutputSuffix - to set the output suffix for the \book block
>>> * \bookOutputName - to set output filename for the current \book block
>>> * \bookOuptutNameRevert - to restore the the output filename to the value
>>> prior to that of the last \bookOuputName call.
>>
>> I think these functions should be named
>>
>> \setBookOutputSuffix
>> \setBookOutputName
>> \revertBookOutputName
>
> Nooooo!  Having \set vs. \setBlahBlah is a nightmare for newbies.
> Sorry, my brain is fried at the moment, so I have no alternative
> suggestions.

You're right, of course.

The problem is that Ian wants to really have a revert option (and we can't
use revert either, because of confusion with \revert).

How about

\useBookOuptutSuffix
\useBookOutputName
\usePreviousBookOutputName

or

\bookOutputSuffix
\bookOutputName
\bookOutputNameUsePrevious  (I hate the english of this, but it sorts where
it belongs and it captures the intent).

Carl


---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Graham Percival
On Mon, Oct 26, 2009 at 03:53:55PM -0600, Carl Sorensen wrote:

>
> On 10/26/09 3:09 PM, "Graham Percival" <[hidden email]> wrote:
>
> > Nooooo!  Having \set vs. \setBlahBlah is a nightmare for newbies.
> > Sorry, my brain is fried at the moment, so I have no alternative
> > suggestions.
>
> The problem is that Ian wants to really have a revert option (and we can't
> use revert either, because of confusion with \revert).
>
> \bookOutputSuffix
> \bookOutputName
> \bookOutputNameUsePrevious  (I hate the english of this, but it sorts where
> it belongs and it captures the intent).

I like these.  And it fits with some proposals for GLISS, which
will start when GUB or the new website is finished.

Cheers,
- Graham

---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Carl Sorensen
In reply to this post by Ian Hulin



On 10/26/09 1:47 PM, "Ian Hulin" <[hidden email]> wrote:

> Carl Sorensen wrote:
>>
>>
>> On 10/23/09 5:52 PM, "Ian Hulin" <[hidden email]> wrote:
>>

>>
>>> \bookOutputName and \bookOuptutNameRevert use the book-filename as a stack
>>> structure.  I have used this so we can we could eventually allow users to do
>>> stuff like the following (controlling the names used to open the midi files
>>> is
>>> not part of the current patch).
>>> \book {
>>>     \bookOutputName "My-Homeland"
>>>     \score {
>>>        \bookOutputName "Vysehrad"
>>>           music-declarations ...
>>>           \midi{
>>>           % midi file gets written to Vysehrad.mid(i)
>>>           }
>>>           \layout{
>>>           }
>>>        \bookOutputNameRevert
>>>     }
>>>     \score {
>>>         \bookOuputName "Vltava"
>>>         ...
>>>         \midi {
>>>         % midi file is written to Vltava.mid(i)
>>>         }
>>>     }
>>> .
>>> .
>>> .
>>
>> This code doesn't demonstrate the need for \bookOutputNameRevert; the same
>> thing would happen if the \bookOutputNameRevert were omitted, as far as I
>> can tell.
>>
>
> Consider this in one file Smetana.ly:
>
> ;;  Music for Má Vlast
> \book {
>         \bookOutputName "My-Homeland"
>         \score {
>                 \bookOutputName "Vyšehrad"
>                 ...
>         }
>         \score {
>                 \bookOutputName "Vltava"
>                 ...
>         }
>         %%   three more \score blocks setting the output name
>         \score {
>                 \bookOutputName "Blanik"
>                 ...
>         }
> }
>
> ;; Music for "Bartered Bride Overure"
> \book {
>         % No \bookOutputName here
>         % Until scoping for \book blocks is sorted out,
>         % this block will get output to Blanik.pdf and Blanik.midi.
>         \score {
>         ...
>         }
> }      
>

Yes, I understand the issues with (the lack of) scoping of bookOutputNames.

But where in this example would you put \bookOutputNameRevert (or
\bookOutputNameUsePrevious)?

If you put it after the the last score in My-Homeland,  then I guess it
would go to the default values again.

It seems to me the problem could easily be resolved here by just giving a
bookOutputName to Bartered Bride Overture (and if one is using
bookOutputName in some of the books, it seems reasonable to use it for all
of the books).  It also seems that one could just set it to "" in order to
use the default, and there wouldn't be a need for a separate revert.

Also, following on with the discussion we had on the earlier message, if
every \book block initializes the bookOutputName to the default value, that
implements a scoping rule, IIUC.

HTH,

Carl


---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Ian Hulin
In reply to this post by Graham Percival
Graham Percival wrote:
On Mon, Oct 26, 2009 at 03:53:55PM -0600, Carl Sorensen wrote:
  
On 10/26/09 3:09 PM, "Graham Percival" [hidden email] wrote:

    
Nooooo!  Having \set vs. \setBlahBlah is a nightmare for newbies.
Sorry, my brain is fried at the moment, so I have no alternative
suggestions.
      
The problem is that Ian wants to really have a revert option (and we can't
use revert either, because of confusion with \revert).

\bookOutputSuffix
\bookOutputName
\bookOutputNameUsePrevious  (I hate the english of this, but it sorts where
it belongs and it captures the intent).
    

I like these.  And it fits with some proposals for GLISS, which
will start when GUB or the new website is finished.

Cheers,
- Graham

  

I've now sorted the scoping out in the parser so subsequent \book blocks are no longer affected by prior \bookOutputName and \bookOutputSuffix calls.

This gets rid of the need for \bookOutputNameUsePrevious so I've ditched it.

That means that book-filename can be a string and not a queue/stack structure.  That's a shame because I reckoned the (ice-9 q) stuff was rather cool.

I've now found out at long last where and how the filename gets set for \midi blocks.  It has a satisfactory mechanism for adding a version count internally if needed; it's already getting the name generated from within print-book-with.  So I no longer need to bother about files getting opened at \score level.

I've attached the patch and some test files I've been using.

Cheers,
Ian





From 9468630bfe1202baafe94fa49dfab851fab8c73d Mon Sep 17 00:00:00 2001
From: Ian Hulin <[hidden email]>
Date: Tue, 27 Oct 2009 15:50:26 +0000
Subject: [PATCH] Tracker 836: Add facility to change output file-name for a \book block
 or to set a suffix to prevent multiple files over-writing each other during a
 compilation.
 This change allows user to to this via functions rather than having to do
 so by manipulating semi-documented parser variables.

---
 lily/parser.yy             |    2 ++
 ly/init.ly                 |    2 ++
 ly/music-functions-init.ly |   16 +++++++++++++++-
 scm/lily-library.scm       |   37 +++++++++++++++++++++++++++++++------
 4 files changed, 50 insertions(+), 7 deletions(-)

diff --git a/lily/parser.yy b/lily/parser.yy
index 813452e..fbdcaa3 100644
--- a/lily/parser.yy
+++ b/lily/parser.yy
@@ -672,6 +672,8 @@ book_body:
  push_paper (PARSER, $$->paper_);
  $$->header_ = PARSER->lexer_->lookup_identifier ("$defaultheader");
  PARSER->lexer_->set_identifier (ly_symbol2scm ("$current-book"), $$->self_scm ());
+        PARSER->lexer_->set_identifier (ly_symbol2scm ("book-output-suffix"), SCM_BOOL_F);
+        PARSER->lexer_->set_identifier (ly_symbol2scm ("book-filename"), SCM_BOOL_F);
  }
  | BOOK_IDENTIFIER {
  $$ = unsmob_book ($1);
diff --git a/ly/init.ly b/ly/init.ly
index 9304810..7bd9cf2 100644
--- a/ly/init.ly
+++ b/ly/init.ly
@@ -20,6 +20,8 @@
 #(define expect-error #f)
 #(define output-empty-score-list #f)
 #(define output-suffix #f)
+#(define book-filename #f)
+#(define book-output-suffix #f)
 #(use-modules (scm clip-region))
 \maininput
 %% there is a problem at the end of the input file
diff --git a/ly/music-functions-init.ly b/ly/music-functions-init.ly
index 4283157..eedee10 100644
--- a/ly/music-functions-init.ly
+++ b/ly/music-functions-init.ly
@@ -171,7 +171,21 @@ bendAfter =
   (make-music 'BendAfterEvent
    'delta-step delta))
 
-%% why a function?
+
+bookOutputName =
+#(define-music-function (parser location newfilename) (string?)
+    (_i "Direct output for the current book block to @var{newfilename}")
+        (set! book-filename newfilename)
+        (make-music 'SequentialMusic 'void #t))
+
+bookOutputSuffix =
+#(define-music-function (parser location newsuffix) (string?)
+    (_i "Set the output filename suffix for the current book block to
+@var{newsuffix}")
+        (set! book-output-suffix newsuffix)
+        (make-music 'SequentialMusic 'void #t))
+
+        %% why a function?
 breathe =
 #(define-music-function (parser location) ()
   (_i "Insert a breath mark.")
diff --git a/scm/lily-library.scm b/scm/lily-library.scm
index 827fb24..da57f12 100644
--- a/scm/lily-library.scm
+++ b/scm/lily-library.scm
@@ -134,12 +134,37 @@
 
   (ly:make-score music))
 
-
-(define (get-outfile-name parser base)
-  (let* ((output-suffix (ly:parser-lookup parser 'output-suffix))
- (counter-alist (ly:parser-lookup parser 'counter-alist))
- (output-count (assoc-get output-suffix counter-alist 0))
- (result base))
+;; return any suffix value for output filename allowing for settings by
+;; calls to \bookOutputName
+(define (get-current-filename parser)
+        (let* (
+                (book-filename (ly:parser-lookup parser 'book-filename)))
+            (if (not book-filename)
+            (ly:parser-output-name parser)
+            (ly:parser-lookup parser 'book-filename))))
+
+;; return any suffix value for output filename allowing for settings by
+;; calls to \bookOutputSuffix
+(define (get-current-suffix parser)
+   (let* (
+            (book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))
+    (if (string? book-output-suffix)
+        (ly:parser-lookup parser 'book-output-suffix)
+        (ly:parser-lookup parser 'output-suffix))))
+
+(define-public current-outfile-name #f)  ; for use by regression tests
+
+(define (get-outfile-name parser)
+    ;; user can now override the base file name, so we have to use
+    ;; the file-name concatenated with any potential output-suffix value
+    ;; as the key to out internal a-list
+  (let* (
+      (base-name (get-current-filename parser))
+      (output-suffix (get-current-suffix parser))
+      (alist-key (format "~a~a" base-name output-suffix))
+      (counter-alist (ly:parser-lookup parser 'counter-alist))      
+      (output-count (assoc-get alist-key counter-alist 0))
+      (result base-name))
     ;; Allow all ASCII alphanumerics, including accents
     (if (string? output-suffix)
  (set! result (format "~a-~a"
--
1.6.0.4


%{
%   This file should produce three backend files using the default namses:
%   1.  Exsultate.pdf, .midi for the first \book
%   2.  Exsultate-1.pdf, .midi for the second \book
%   3.  Exsultate-2.pdf, .midi for the third \book
%}

\include "english.ly"
\version "2.13.4"
\header {
  title = "Exsultate, Jubilate"
  subtitle = "Motet"
  subsubtitle = "K. 165"
  instrument = "Soprano Solo and Orchestra"
  composer = "W. A. Mozart"
  opus = "KV 165"
}

movonesettings = {
 \key f \major
 \time 4/4
 \tempo "Allegro" 4=128
   
 }
oboesmovoneMusic = \relative c' {
    r8 <a' c>8 <a c>8 <a c>8 <a c>4 r4 |
  }
hornsmovoneMusic = \relative c' {
  \key c \major r8 <c c'>8 <c c'>8 <c c'>8 <c c'>4 r4 |
}
VlnonemovoneMusic = \relative c' {
  <a' f'>4 c4~ c8 d16 e f g a f |
}
VlntwomovoneMusic = \relative c' {
 a'16 bflat c bflat a bflat c bflat a4 r4 |
}
VlamovoneMusic = \relative c' {
 \clef alto c16 bf a bf c bf a bf c4 r4 |
}
SopranomovoneMusic = \relative c' {
  R1 |
}
BCmovoneMusic = \relative c {
  \clef bass f8 f f f f f f f |
}

\book {
    \paper {
     }
    \bookpart {
    \header {
        subtitle = "I. Allegro"
    }

    \score {

        \new StaffGroup {
            <<
                \new Staff = oboesmovone \with {instrumentName = "2 Oboi"
                                                midiInstrument = "oboe"}
                    {
                        \movonesettings \oboesmovoneMusic
                    }
                 \new Staff = hornsmovone \with {instrumentName = "2 Corni in F"
                                                 midiInstrument = "french horn"}
                     {
                        \transposition f \time 4/4 \tempo "Allegro" \hornsmovoneMusic
                     }
                 \new GrandStaff  
                    <<
                        \new Staff = Vlnonemovone \with {instrumentName = "Violino I"
                                                         midiInstrument = "violin"}
                            {
                              \movonesettings \VlnonemovoneMusic
                            }
                        \new Staff = Vlntwomovone \with {instrumentName = "Violino II"
                                                         midiInstrument = "violin"}
                           {
                               \movonesettings \VlntwomovoneMusic
                           }
                   >>
                   \new Staff = Vlamovone \with {instrumentName = "Viola"
                                      midiInstrument = "viola"}
                     {
                       \movonesettings \VlamovoneMusic
                     }
                   \new Staff = Sopranomovone \with {instrumentName = "Soprano"
                                                     midiInstrument = "voice oohs"}
                     {
                         \movonesettings \SopranomovoneMusic
                     }
                   \new Staff = BCmovone \with { instrumentName = "Basso ed Organo"
                                    midiInstrument = "contrabass"}
                     {
                        \movonesettings \BCmovoneMusic
                     }
             >>
            }
            \midi {
            }
            \layout{
              }
        }
    }
}

movtwosettings = {
 \key a \major
 \time 3/4
 \tempo "Andante" 4=72
 }
oboesmovtwoMusic = \relative c' {
  \partial 8 r8
  |R2.   |
}
hornsmovtwoMusic = \relative c' {
  \partial 8 r8 |
  R2.   |
}
VlnonemovtwoMusic = \relative c'' {
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
VlntwomovtwoMusic = \relative c'' {
  \partial 8 a8 |
  cs4. b16( a) gs8 a |
}
VlamovtwoMusic = \relative c' {
  \clef alto
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
SopranomovtwoMusic = \relative c'' {
 \partial 8 r8
  |R2.   |
}
BCmovtwoMusic = \relative c {
  \clef bass
  \partial 8 r8
  r4 a'4 a, |
}

\book{
    \paper {
    }
    \bookpart{
        \header {
            subtitle = "II. Andante"
        }
        \score {
            \new StaffGroup {
                <<
                \new Staff = oboesmovtwo \with {instrumentName = "2 Oboi"
                                       midiInstrument = "oboe"}
                 {
                  \movtwosettings \oboesmovtwoMusic
                 }
                 \new Staff = hornsmovtwo \with {instrumentName = "2 Corni in F"
                                                 midiInstrument = "french horn"}
                 {
                    \transposition f \time 4/4 \key e \major \tempo "Allegro" \hornsmovtwoMusic
                 }
                 \new GrandStaff  <<
                    \new Staff = Vlnonemovtwo \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlnonemovtwoMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlntwomovtwoMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movtwosettings \VlamovtwoMusic
                 }
                 \new Staff = Sopranomovtwo \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movtwosettings \SopranomovtwoMusic
                  }
                  \new Staff = BCmovtwo \with { instrumentName = "Basso ed Organo"
                                                midiInstrument = "contrabass"}
                  {
                    \movtwosettings \BCmovtwoMusic
                  }
              >>
            }
            \midi {
                }
            \layout{
              }
        }
    }
}

movthreesettings = {
 \key f \major
 \time 2/4
 \tempo "Vivace" 4=132
 }
 
oboesmovthreeMusic = \relative c'' {
  <c'(a>4. <d) bf>8 |
  <d( bf>8 <c) a>8 <bf-. g-.> <a-. f-.> |
  <a f>4 <a f>4 |
  <a( fs>4 <bf) g >8 r8 |
 
}
hornsmovthreeMusic = \relative c' {
  <c' c>4 r4   |
  R2 |
  <c e>4 <c e>  |
  g2            |
}
VlnonemovthreeMusic = \relative c'' {
   c4.(\f d8        |
   d8( c) bf-. a-.  |
   a4 a             |
   a4( bf8) r8      |
}
VlntwomovthreeMusic = \relative c'' {
   a4.(\f bf8 )      |
   bf8( a) g-. f-.   |
   f4 f4             |
   fs4( g8) r8       |
}
VlamovthreeMusic = \relative c' {
    \clef alto
    f4\f r4         |
    R2              |
    c4 c4           |
    c2              |
}
SopranomovthreeMusic = \relative c'' {
    R2              |
    R2              |
    R2              |
    R2              |
}
BCmovthreeMusic = \relative c {
    \clef bass
    f4\f r4         |
    R2              |
    f4 f4           |
    e2              |
}

\book {
    \paper {
    }
    \bookpart {
        \score {
            \new StaffGroup <<
            \new Staff = oboesmovthree \with {instrumentName = "2 Oboi"
                                              midiInstrument = "oboe"}
            {
                \movthreesettings \oboesmovthreeMusic
            }
            \new Staff = hornsmovthree \with {instrumentName = "2 Corni in F"
                                                 midiInstrument = "french horn"}
            {
                \transposition f \time 2/4 \key c \major \tempo "Vivace" 4=132
                \hornsmovthreeMusic
            }
            \new GrandStaff <<
                \new Staff = Vlonemovthree \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlnonemovthreeMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlntwomovthreeMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movthreesettings \VlamovthreeMusic
                 }
                 \new Staff = Sopranomovthree \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movthreesettings \SopranomovthreeMusic
                  }
                  \new Staff = BCmovthree \with { instrumentName = "Basso ed Organo"
                                                midiInstrument = "contrabass"}
                  {
                    \movthreesettings \BCmovthreeMusic
                  }
                   
            >>
            \midi {
                }
            \layout{
              }

        }
    }
}

%{
%   This file should produce three backend files using book-output-suffix:
%   1.  Exsultate-Bsuffix-Allegro.pdf, .midi for the first \book
%   2.  Exsultate-Bsuffix-Andante.pdf, .midi for the second \book
%   3.  Exsultate-Bsuffix-Alleluia.pdf, .midi for the third \book
%}
\include "english.ly"
\version "2.13.4"
\header {
  title = "Exsultate, Jubilate"
  subtitle = "Motet"
  subsubtitle = "K. 165"
  instrument = "Soprano Solo and Orchestra"
  composer = "W. A. Mozart"
  opus = "KV 165"
}

movonesettings = {
 \key f \major
 \time 4/4
 \tempo "Allegro" 4=128
   
 }
oboesmovoneMusic = \relative c' {
    r8 <a' c>8 <a c>8 <a c>8 <a c>4 r4 |
  }
hornsmovoneMusic = \relative c' {
  \key c \major r8 <c c'>8 <c c'>8 <c c'>8 <c c'>4 r4 |
}
VlnonemovoneMusic = \relative c' {
  <a' f'>4 c4~ c8 d16 e f g a f |
}
VlntwomovoneMusic = \relative c' {
 a'16 bflat c bflat a bflat c bflat a4 r4 |
}
VlamovoneMusic = \relative c' {
 \clef alto c16 bf a bf c bf a bf c4 r4 |
}
SopranomovoneMusic = \relative c' {
  R1 |
}
BCmovoneMusic = \relative c {
  \clef bass f8 f f f f f f f |
}

\book {
    \paper {
     }
    \bookOutputSuffix "Allegro"
    \bookpart {
    \header {
        subtitle = "I. Allegro"
    }

    \score {

        \new StaffGroup {
            <<
                \new Staff = oboesmovone \with {instrumentName = "2 Oboi"
                                                midiInstrument = "oboe"}
                    {
                        \movonesettings \oboesmovoneMusic
                    }
                 \new Staff = hornsmovone \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
                     {
                        \transposition f \time 4/4 \tempo "Allegro" \hornsmovoneMusic
                     }
                 \new GrandStaff  
                    <<
                        \new Staff = Vlnonemovone \with {instrumentName = "Violino I"
                                                         midiInstrument = "violin"}
                            {
                              \movonesettings \VlnonemovoneMusic
                            }
                        \new Staff = Vlntwomovone \with {instrumentName = "Violino II"
                                                         midiInstrument = "violin"}
                           {
                               \movonesettings \VlntwomovoneMusic
                           }
                   >>
                   \new Staff = Vlamovone \with {instrumentName = "Viola"
                                      midiInstrument = "viola"}
                     {
                       \movonesettings \VlamovoneMusic
                     }
                   \new Staff = Sopranomovone \with {instrumentName = "Soprano"
                                                     midiInstrument = "voice oohs"}
                     {
                         \movonesettings \SopranomovoneMusic
                     }
                   \new Staff = BCmovone \with { instrumentName = "Basso ed Organo"
                                    midiInstrument = "contrabass"}
                     {
                        \movonesettings \BCmovoneMusic
                     }
             >>
            }
            \midi {
              }
            \layout{
              }
        }

    }
}

movtwosettings = {
 \key a \major
 \time 3/4
 \tempo "Andante" 4=72
 }
oboesmovtwoMusic = \relative c' {
  \partial 8 r8
  |R2.   |
}
hornsmovtwoMusic = \relative c' {
  \partial 8 r8 |
  R2.   |
}
VlnonemovtwoMusic = \relative c'' {
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
VlntwomovtwoMusic = \relative c'' {
  \partial 8 a8 |
  cs4. b16( a) gs8 a |
}
VlamovtwoMusic = \relative c' {
  \clef alto
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
SopranomovtwoMusic = \relative c'' {
 \partial 8 r8
  |R2.   |
}
BCmovtwoMusic = \relative c {
  \clef bass
  \partial 8 r8
  r4 a'4 a, |
}

\book{
    \paper {
     }
    \bookOutputSuffix "Andante"
    \bookpart{
        \header {
            subtitle = "II. Andante"
        }
        \score {
            \new StaffGroup {
                <<
                \new Staff = oboesmovtwo \with {instrumentName = "2 Oboi"
                                       midiInstrument = "oboe"}
                 {
                  \movtwosettings \oboesmovtwoMusic
                 }
                 \new Staff = hornsmovtwo \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
                 {
                    \transposition f \time 4/4 \key e \major \tempo "Allegro" \hornsmovtwoMusic
                 }
                 \new GrandStaff  <<
                    \new Staff = Vlnonemovtwo \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlnonemovtwoMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlntwomovtwoMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movtwosettings \VlamovtwoMusic
                 }
                 \new Staff = Sopranomovtwo \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movtwosettings \SopranomovtwoMusic
                  }
                  \new Staff = BCmovtwo \with { instrumentName = "Basso ed Organo"
                                                midiInstrument = "contrabass"}
                  {
                    \movtwosettings \BCmovtwoMusic
                  }
              >>
            }
            \midi {
              }
            \layout{
              }

        }
    }
}

movthreesettings = {
 \key f \major
 \time 2/4
 \tempo "Vivace" 4=132
 }
 
oboesmovthreeMusic = \relative c'' {
  <c'(a>4. <d) bf>8 |
  <d( bf>8 <c) a>8 <bf-. g-.> <a-. f-.> |
  <a f>4 <a f>4 |
  <a( fs>4 <bf) g >8 r8 |
 
}
hornsmovthreeMusic = \relative c' {
  <c' c>4 r4    |
  R2 |
  <c e>4 <c e>  |
  g2            |
}
VlnonemovthreeMusic = \relative c'' {
   c4.(\f d8        |
   d8( c) bf-. a-.  |
   a4 a             |
   a4( bf8) r8      |
}
VlntwomovthreeMusic = \relative c'' {
   a4.(\f bf8 )      |
   bf8( a) g-. f-.   |
   f4 f4             |
   fs4( g8) r8       |
}
VlamovthreeMusic = \relative c' {
    \clef alto
    f4\f r4         |
    R2              |
    c4 c4           |
    c2              |
}
SopranomovthreeMusic = \relative c'' {
    R2              |
    R2              |
    R2              |
    R2              |
}
BCmovthreeMusic = \relative c {
    \clef bass
    f4\f r4         |
    R2              |
    f4 f4           |
    e2              |
}

\book {
    \paper {
     }
    \bookOutputSuffix "Alleluia"
    \bookpart {
        \header {
            subtitle = "III. Vivace - Alleluia"
        }
        \score {
            \new StaffGroup <<
            \new Staff = oboesmovthree \with {instrumentName = "2 Oboi"
                                              midiInstrument = "oboe"}
            {
                \movthreesettings \oboesmovthreeMusic
            }
            \new Staff = hornsmovthree \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
            {
                \transposition f \time 2/4 \key c \major \tempo "Vivace" 4=132
                \hornsmovthreeMusic
            }
            \new GrandStaff <<
                \new Staff = Vlonemovthree \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlnonemovthreeMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlntwomovthreeMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movthreesettings \VlamovthreeMusic
                 }
                 \new Staff = Sopranomovthree \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movthreesettings \SopranomovthreeMusic
                  }
                  \new Staff = BCmovthree \with {
                      instrumentName = \markup{ \column {"Basso ed" "Organo"}}
                                                midiInstrument = "contrabass"}
                  {
                    \movthreesettings \BCmovthreeMusic
                  }
                   
            >>
            \midi {
              }
            \layout{
              }
        }
    }
}

%{
%   This file should produce three backend files using book-filename:
%   1.  KV165-Allegro.pdf, .midi for the first \book
%   2.  KV165-Andante.pdf, .midi for the second \book
%   3.  KV165-Alleluia.pdf, .midi for the third \book
%}
\include "english.ly"
\version "2.13.4"
\header {
  title = "Exsultate, Jubilate"
  subtitle = "Motet"
  subsubtitle = "K. 165"
  instrument = "Soprano Solo and Orchestra"
  composer = "W. A. Mozart"
  opus = "KV 165"
}
\paper {
 }
\midi {
  }
\layout{
  }
movonesettings = {
 \key f \major
 \time 4/4
 \tempo "Allegro" 4=128
   
 }
oboesmovoneMusic = \relative c' {
    r8 <a' c>8 <a c>8 <a c>8 <a c>4 r4 |
  }
hornsmovoneMusic = \relative c' {
  \key c \major r8 <c c'>8 <c c'>8 <c c'>8 <c c'>4 r4 |
}
VlnonemovoneMusic = \relative c' {
  <a' f'>4 c4~ c8 d16 e f g a f |
}
VlntwomovoneMusic = \relative c' {
 a'16 bflat c bflat a bflat c bflat a4 r4 |
}
VlamovoneMusic = \relative c' {
 \clef alto c16 bf a bf c bf a bf c4 r4 |
}
SopranomovoneMusic = \relative c' {
  R1 |
}
BCmovoneMusic = \relative c {
  \clef bass f8 f f f f f f f |
}
\book {
    \paper {
    ragged-last-bottom = ##t
    }
    \bookpart {
    \bookOutputName "KV165-Allegro"
    \header {
        subtitle = "I. Allegro"
    }
    \score {

        \new StaffGroup {
            <<
                \new Staff = oboesmovone \with {instrumentName = "2 Oboi"
                                                midiInstrument = "oboe"}
                    {
                        \movonesettings \oboesmovoneMusic
                    }
                 \new Staff = hornsmovone \with {instrumentName = "2 Corni in F"
                                                 midiInstrument = "french horn"}
                     {
                        \transposition f \time 4/4 \tempo "Allegro" \hornsmovoneMusic
                     }
                 \new GrandStaff  
                    <<
                        \new Staff = Vlnonemovone \with {instrumentName = "Violino I"
                                                         midiInstrument = "violin"}
                            {
                              \movonesettings \VlnonemovoneMusic
                            }
                        \new Staff = Vlntwomovone \with {instrumentName = "Violino II"
                                                         midiInstrument = "violin"}
                           {
                               \movonesettings \VlntwomovoneMusic
                           }
                   >>
                   \new Staff = Vlamovone \with {instrumentName = "Viola"
                                      midiInstrument = "viola"}
                     {
                       \movonesettings \VlamovoneMusic
                     }
                   \new Staff = Sopranomovone \with {instrumentName = "Soprano"
                                                     midiInstrument = "voice oohs"}
                     {
                         \movonesettings \SopranomovoneMusic
                     }
                   \new Staff = BCmovone \with { instrumentName = "Basso ed Organo"
                                    midiInstrument = "contrabass"}
                     {
                        \movonesettings \BCmovoneMusic
                     }
             >>
            }
        \midi {
        }
        \layout{
        }

    }

    }
}

movtwosettings = {
 \key a \major
 \time 3/4
 \tempo "Andante" 4=72
 }
oboesmovtwoMusic = \relative c' {
  \partial 8 r8
  |R2.   |
}
hornsmovtwoMusic = \relative c' {
  \partial 8 r8 |
  R2.   |
}
VlnonemovtwoMusic = \relative c'' {
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
VlntwomovtwoMusic = \relative c'' {
  \partial 8 a8 |
  cs4. b16( a) gs8 a |
}
VlamovtwoMusic = \relative c' {
  \clef alto
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
SopranomovtwoMusic = \relative c'' {
 \partial 8 r8
  |R2.   |
}
BCmovtwoMusic = \relative c {
  \clef bass
  \partial 8 r8
  r4 a'4 a, |
}

\book{
    \bookOutputName "KV165-Andante"
    \bookpart{
        \header {
            subtitle = "II. Andante"
        }
        \score {
            \new StaffGroup {
                <<
                \new Staff = oboesmovtwo \with {instrumentName = "2 Oboi"
                                       midiInstrument = "oboe"}
                 {
                  \movtwosettings \oboesmovtwoMusic
                 }
                 \new Staff = hornsmovtwo \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
                 {
                    \transposition f \time 4/4 \key e \major \tempo "Allegro" \hornsmovtwoMusic
                 }
                 \new GrandStaff  <<
                    \new Staff = Vlnonemovtwo \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlnonemovtwoMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlntwomovtwoMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movtwosettings \VlamovtwoMusic
                 }
                 \new Staff = Sopranomovtwo \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movtwosettings \SopranomovtwoMusic
                  }
                  \new Staff = BCmovtwo \with {
                      instrumentName = \markup {\column {"Basso ed" "Organo"}}
                      midiInstrument = "contrabass"}

                  {
                     \movtwosettings \BCmovtwoMusic
                  }
              >>
            }
        \midi {
        }
        \layout{
        }
        }
    }
}

movthreesettings = {
 \key f \major
 \time 2/4
 \tempo "Vivace" 4=132
 }
 
oboesmovthreeMusic = \relative c'' {
  <c'a>4.(\f <d bf>8) |
  <d bf>8( <c a>8) <bf-. g> <a-. f> |
  <a f>4 <a f>4 |
  <a fs>4( <bf g >8) r8 |
 
}
hornsmovthreeMusic = \relative c' {
  <c' c,>4\f r4   |
  R2 |
  <c e,>4 <c e,>  |
  g2            |
}
VlnonemovthreeMusic = \relative c'' {
   c4.(\f d8)       |
   d8( c) bf-. a-.  |
   a4 a             |
   a4( bf8) r8      |
}
VlntwomovthreeMusic = \relative c'' {
   a4.(\f bf8 )      |
   bf8( a) g-. f-.   |
   f4 f4             |
   fs4( g8) r8       |
}
VlamovthreeMusic = \relative c' {
    \clef alto
    f4\f r4         |
    R2              |
    c4 c4           |
    c2              |
}
SopranomovthreeMusic = \relative c'' {
    R2              |
    R2              |
    R2              |
    R2              |
}
BCmovthreeMusic = \relative c {
    \clef bass
    f4\f r4         |
    R2              |
    f4 f4           |
    e2              |
}

\book {
    \bookOutputName "KV165-Alleluia"
    \bookpart {
        \header {
            subtitle = "III. Vivace - Alleluia"
        }
        \score {
            \new StaffGroup <<
            \new Staff = oboesmovthree \with {instrumentName = "2 Oboi"
                                              midiInstrument = "oboe"}
            {
                \movthreesettings \oboesmovthreeMusic
            }
            \new Staff = hornsmovthree \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
            {
                \transposition f \time 2/4 \key c \major \tempo "Vivace" 4=132
                \hornsmovthreeMusic
            }
            \new GrandStaff <<
                \new Staff = Vlonemovthree \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlnonemovthreeMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlntwomovthreeMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movthreesettings \VlamovthreeMusic
                 }
                 \new Staff = Sopranomovthree \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movthreesettings \SopranomovthreeMusic
                  }
                  \new Staff = BCmovthree \with { instrumentName = "Basso ed Organo"
                     instrumentName = \markup {\column {"Basso ed" "Organo"}}
                                                midiInstrument = "contrabass"}
                  {
                     \movthreesettings \BCmovthreeMusic
                  }
                   
            >>
        \midi {
        }
        \layout{
        }
        }

 
    }
}

%{
%   This file should produce three backend files using book-filename:
%   1.  KV165-Allegro.pdf, .midi for the first \book
%   2.  KV165-Andante.pdf, .midi for the second \book
%   3.  KV165-Alleluia.pdf, .midi for the third \book
%   4.  An Additional KV165-Alleluia-1.midi
%}
\include "english.ly"
\version "2.13.4"
\header {
  title = "Exsultate, Jubilate"
  subtitle = "Motet"
  subsubtitle = "K. 165"
  instrument = "Soprano Solo and Orchestra"
  composer = "W. A. Mozart"
  opus = "KV 165"
}
\paper {
 }
\midi {
  }
\layout{
  }
movonesettings = {
 \key f \major
 \time 4/4
 \tempo "Allegro" 4=128
   
 }
oboesmovoneMusic = \relative c' {
    r8 <a' c>8 <a c>8 <a c>8 <a c>4 r4 |
  }
hornsmovoneMusic = \relative c' {
  \key c \major r8 <c c'>8 <c c'>8 <c c'>8 <c c'>4 r4 |
}
VlnonemovoneMusic = \relative c' {
  <a' f'>4 c4~ c8 d16 e f g a f |
}
VlntwomovoneMusic = \relative c' {
 a'16 bflat c bflat a bflat c bflat a4 r4 |
}
VlamovoneMusic = \relative c' {
 \clef alto c16 bf a bf c bf a bf c4 r4 |
}
SopranomovoneMusic = \relative c' {
  R1 |
}
BCmovoneMusic = \relative c {
  \clef bass f8 f f f f f f f |
}
\book {
    \paper {
    ragged-last-bottom = ##t
    }
    \bookpart {
    \bookOutputName "KV165-Allegro"
    \header {
        subtitle = "I. Allegro"
    }
    \score {

        \new StaffGroup {
            <<
                \new Staff = oboesmovone \with {instrumentName = "2 Oboi"
                                                midiInstrument = "oboe"}
                    {
                        \movonesettings \oboesmovoneMusic
                    }
                 \new Staff = hornsmovone \with {instrumentName = "2 Corni in F"
                                                 midiInstrument = "french horn"}
                     {
                        \transposition f \time 4/4 \tempo "Allegro" \hornsmovoneMusic
                     }
                 \new GrandStaff  
                    <<
                        \new Staff = Vlnonemovone \with {instrumentName = "Violino I"
                                                         midiInstrument = "violin"}
                            {
                              \movonesettings \VlnonemovoneMusic
                            }
                        \new Staff = Vlntwomovone \with {instrumentName = "Violino II"
                                                         midiInstrument = "violin"}
                           {
                               \movonesettings \VlntwomovoneMusic
                           }
                   >>
                   \new Staff = Vlamovone \with {instrumentName = "Viola"
                                      midiInstrument = "viola"}
                     {
                       \movonesettings \VlamovoneMusic
                     }
                   \new Staff = Sopranomovone \with {instrumentName = "Soprano"
                                                     midiInstrument = "voice oohs"}
                     {
                         \movonesettings \SopranomovoneMusic
                     }
                   \new Staff = BCmovone \with { instrumentName = "Basso ed Organo"
                                    midiInstrument = "contrabass"}
                     {
                        \movonesettings \BCmovoneMusic
                     }
             >>
            }
        \midi {
        }
        \layout{
        }

    }

    }
}

movtwosettings = {
 \key a \major
 \time 3/4
 \tempo "Andante" 4=72
 }
oboesmovtwoMusic = \relative c' {
  \partial 8 r8
  |R2.   |
}
hornsmovtwoMusic = \relative c' {
  \partial 8 r8 |
  R2.   |
}
VlnonemovtwoMusic = \relative c'' {
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
VlntwomovtwoMusic = \relative c'' {
  \partial 8 a8 |
  cs4. b16( a) gs8 a |
}
VlamovtwoMusic = \relative c' {
  \clef alto
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
SopranomovtwoMusic = \relative c'' {
 \partial 8 r8
  |R2.   |
}
BCmovtwoMusic = \relative c {
  \clef bass
  \partial 8 r8
  r4 a'4 a, |
}

\book{
    \bookOutputName "KV165-Andante"
    \bookpart{
        \header {
            subtitle = "II. Andante"
        }
        \score {
            \new StaffGroup {
                <<
                \new Staff = oboesmovtwo \with {instrumentName = "2 Oboi"
                                       midiInstrument = "oboe"}
                 {
                  \movtwosettings \oboesmovtwoMusic
                 }
                 \new Staff = hornsmovtwo \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
                 {
                    \transposition f \time 4/4 \key e \major \tempo "Allegro" \hornsmovtwoMusic
                 }
                 \new GrandStaff  <<
                    \new Staff = Vlnonemovtwo \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlnonemovtwoMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlntwomovtwoMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movtwosettings \VlamovtwoMusic
                 }
                 \new Staff = Sopranomovtwo \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movtwosettings \SopranomovtwoMusic
                  }
                  \new Staff = BCmovtwo \with {
                      instrumentName = \markup {\column {"Basso ed" "Organo"}}
                      midiInstrument = "contrabass"}

                  {
                     \movtwosettings \BCmovtwoMusic
                  }
              >>
            }
        \midi {
        }
        \layout{
        }
        }
    }
}

movthreesettings = {
 \key f \major
 \time 2/4
 \tempo "Vivace" 4=132
 }
 
oboesmovthreeMusic = \relative c'' {
  <c'a>4.(\f <d bf>8) |
  <d bf>8( <c a>8) <bf-. g> <a-. f> |
  <a f>4 <a f>4 |
  <a fs>4( <bf g >8) r8 |
 
}
hornsmovthreeMusic = \relative c' {
  <c' c,>4\f r4   |
  R2 |
  <c e,>4 <c e,>  |
  g2            |
}
VlnonemovthreeMusic = \relative c'' {
   c4.(\f d8)       |
   d8( c) bf-. a-.  |
   a4 a             |
   a4( bf8) r8      |
}
VlntwomovthreeMusic = \relative c'' {
   a4.(\f bf8 )      |
   bf8( a) g-. f-.   |
   f4 f4             |
   fs4( g8) r8       |
}
VlamovthreeMusic = \relative c' {
    \clef alto
    f4\f r4         |
    R2              |
    c4 c4           |
    c2              |
}
SopranomovthreeMusic = \relative c'' {
    R2              |
    R2              |
    R2              |
    R2              |
}
BCmovthreeMusic = \relative c {
    \clef bass
    f4\f r4         |
    R2              |
    f4 f4           |
    e2              |
}

\book {
    \bookOutputName "KV165-Alleluia"
    \bookpart {
        \header {
            subtitle = "III. Vivace - Alleluia"
        }
        \score {
            \new StaffGroup <<
            \new Staff = oboesmovthree \with {instrumentName = "2 Oboi"
                                              midiInstrument = "oboe"}
            {
                \movthreesettings \oboesmovthreeMusic
            }
            \new Staff = hornsmovthree \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
            {
                \transposition f \time 2/4 \key c \major \tempo "Vivace" 4=132
                \hornsmovthreeMusic
            }
            \new GrandStaff <<
                \new Staff = Vlonemovthree \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlnonemovthreeMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlntwomovthreeMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movthreesettings \VlamovthreeMusic
                 }
                 \new Staff = Sopranomovthree \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movthreesettings \SopranomovthreeMusic
                  }
                  \new Staff = BCmovthree \with { instrumentName = "Basso ed Organo"
                     instrumentName = \markup {\column {"Basso ed" "Organo"}}
                                                midiInstrument = "contrabass"}
                  {
                     \movthreesettings \BCmovthreeMusic
                  }
                   
            >>
        \midi {
        }
        \layout{
        }
        }

        \score { %second \score block
            \new Staff = TestStaff
            {
                \relative c' {c1 \bar "|."}
            }
            \midi {
            }
            \layout{
            }

        }
    }
}

%{
%   This file should produce three backend files using output-suffix:
%   1.  Exsultate-Osuffix-Allegro.pdf, .midi for the first \book
%   2.  Exsultate-Osuffix-Allegro-1.pdf, .midi for the second \book
%   3.  Exsultate-Osuffix-Alleluia.pdf, .midi for the third \book
%}
\include "english.ly"
\version "2.13.4"
\header {
  title = "Exsultate, Jubilate"
  subtitle = "Motet"
  subsubtitle = "K. 165"
  instrument = "Soprano Solo and Orchestra"
  composer = "W. A. Mozart"
  opus = "KV 165"
}

movonesettings = {
 \key f \major
 \time 4/4
 \tempo "Allegro" 4=128
   
 }
oboesmovoneMusic = \relative c' {
    r8 <a' c>8 <a c>8 <a c>8 <a c>4 r4 |
  }
hornsmovoneMusic = \relative c' {
  \key c \major r8 <c c'>8 <c c'>8 <c c'>8 <c c'>4 r4 |
}
VlnonemovoneMusic = \relative c' {
  <a' f'>4 c4~ c8 d16 e f g a f |
}
VlntwomovoneMusic = \relative c' {
 a'16 bflat c bflat a bflat c bflat a4 r4 |
}
VlamovoneMusic = \relative c' {
 \clef alto c16 bf a bf c bf a bf c4 r4 |
}
SopranomovoneMusic = \relative c' {
  R1 |
}
BCmovoneMusic = \relative c {
  \clef bass f8 f f f f f f f |
}
"output-suffix" = "Allegro"
\book {
    \paper {
     }
    \bookpart {
    \header {
        subtitle = "I. Allegro"
    }

    \score {

        \new StaffGroup {
            <<
                \new Staff = oboesmovone \with {instrumentName = "2 Oboi"
                                                midiInstrument = "oboe"}
                    {
                        \movonesettings \oboesmovoneMusic
                    }
                 \new Staff = hornsmovone \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
                     {
                        \transposition f \time 4/4 \tempo "Allegro" \hornsmovoneMusic
                     }
                 \new GrandStaff  
                    <<
                        \new Staff = Vlnonemovone \with {instrumentName = "Violino I"
                                                         midiInstrument = "violin"}
                            {
                              \movonesettings \VlnonemovoneMusic
                            }
                        \new Staff = Vlntwomovone \with {instrumentName = "Violino II"
                                                         midiInstrument = "violin"}
                           {
                               \movonesettings \VlntwomovoneMusic
                           }
                   >>
                   \new Staff = Vlamovone \with {instrumentName = "Viola"
                                      midiInstrument = "viola"}
                     {
                       \movonesettings \VlamovoneMusic
                     }
                   \new Staff = Sopranomovone \with {instrumentName = "Soprano"
                                                     midiInstrument = "voice oohs"}
                     {
                         \movonesettings \SopranomovoneMusic
                     }
                   \new Staff = BCmovone \with { instrumentName = "Basso ed Organo"
                                    midiInstrument = "contrabass"}
                     {
                        \movonesettings \BCmovoneMusic
                     }
             >>
            }
            \midi {
              }
            \layout{
              }
         }

    }
}

movtwosettings = {
 \key a \major
 \time 3/4
 \tempo "Andante" 4=72
 }
oboesmovtwoMusic = \relative c' {
  \partial 8 r8
  |R2.   |
}
hornsmovtwoMusic = \relative c' {
  \partial 8 r8 |
  R2.   |
}
VlnonemovtwoMusic = \relative c'' {
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
VlntwomovtwoMusic = \relative c'' {
  \partial 8 a8 |
  cs4. b16( a) gs8 a |
}
VlamovtwoMusic = \relative c' {
  \clef alto
  \partial 8 a8 |
  e'4. d16( cs) b8 cs |
}
SopranomovtwoMusic = \relative c'' {
 \partial 8 r8
  |R2.   |
}
BCmovtwoMusic = \relative c {
  \clef bass
  \partial 8 r8
  r4 a'4 a, |
}

\book{
    \paper {
    }
    \bookpart{
        \header {
            subtitle = "II. Andante"
        }
        \score {
            \new StaffGroup {
                <<
                \new Staff = oboesmovtwo \with {instrumentName = "2 Oboi"
                                       midiInstrument = "oboe"}
                 {
                  \movtwosettings \oboesmovtwoMusic
                 }
                 \new Staff = hornsmovtwo \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
                 {
                    \transposition f \time 4/4 \key e \major \tempo "Allegro" \hornsmovtwoMusic
                 }
                 \new GrandStaff  <<
                    \new Staff = Vlnonemovtwo \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlnonemovtwoMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movtwosettings \VlntwomovtwoMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movtwosettings \VlamovtwoMusic
                 }
                 \new Staff = Sopranomovtwo \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movtwosettings \SopranomovtwoMusic
                  }
                  \new Staff = BCmovtwo \with { instrumentName = "Basso ed Organo"
                                                midiInstrument = "contrabass"}
                  {
                    \movtwosettings \BCmovtwoMusic
                  }
              >>
            }
            \midi {
              }
            \layout{
              }
         }
    }
}

movthreesettings = {
 \key f \major
 \time 2/4
 \tempo "Vivace" 4=132
 }
 
oboesmovthreeMusic = \relative c'' {
  <c'(a>4. <d) bf>8 |
  <d( bf>8 <c) a>8 <bf-. g-.> <a-. f-.> |
  <a f>4 <a f>4 |
  <a( fs>4 <bf) g >8 r8 |
 
}
hornsmovthreeMusic = \relative c' {
  <c' c>4 r4    |
  R2 |
  <c e>4 <c e>  |
  g2            |
}
VlnonemovthreeMusic = \relative c'' {
   c4.(\f d8        |
   d8( c) bf-. a-.  |
   a4 a             |
   a4( bf8) r8      |
}
VlntwomovthreeMusic = \relative c'' {
   a4.(\f bf8 )      |
   bf8( a) g-. f-.   |
   f4 f4             |
   fs4( g8) r8       |
}
VlamovthreeMusic = \relative c' {
    \clef alto
    f4\f r4         |
    R2              |
    c4 c4           |
    c2              |
}
SopranomovthreeMusic = \relative c'' {
    R2              |
    R2              |
    R2              |
    R2              |
}
BCmovthreeMusic = \relative c {
    \clef bass
    f4\f r4         |
    R2              |
    f4 f4           |
    e2              |
}
"output-suffix"=  "Alleluia"
\book {
    \paper {
    }
    \bookpart {
        \header {
            subtitle = "III. Vivace - Alleluia"
        }
        \score {
            \new StaffGroup <<
            \new Staff = oboesmovthree \with {instrumentName = "2 Oboi"
                                              midiInstrument = "oboe"}
            {
                \movthreesettings \oboesmovthreeMusic
            }
            \new Staff = hornsmovthree \with {
                     instrumentName = \markup { \column {"2 Corni" "in F"}}
                     midiInstrument = "french horn"}
            {
                \transposition f \time 2/4 \key c \major \tempo "Vivace" 4=132
                \hornsmovthreeMusic
            }
            \new GrandStaff <<
                \new Staff = Vlonemovthree \with {instrumentName = "Violino I"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlnonemovthreeMusic
                    }
                    \new Staff = Vlntwomovtwo \with {instrumentName = "Violino II"
                                                      midiInstrument = "violin"}
                    {
                      \movthreesettings \VlntwomovthreeMusic
                    }
                   
                  >>
                 \new Staff = Vlamovtwo \with {instrumentName = "Viola"
                                                  midiInstrument = "viola"}
                 {
                   \movthreesettings \VlamovthreeMusic
                 }
                 \new Staff = Sopranomovthree \with {instrumentName = "Soprano"
                                                   midiInstrument = "voice oohs"}
                  {
                    \movthreesettings \SopranomovthreeMusic
                  }
                  \new Staff = BCmovthree \with {
                      instrumentName = \markup{ \column {"Basso ed" "Organo"}}
                                                midiInstrument = "contrabass"}
                  {
                    \movthreesettings \BCmovthreeMusic
                  }
                   
            >>
            \midi {
              }
            \layout{
              }
         }
    }
}
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Carl Sorensen



On 10/27/09 10:08 AM, "Ian Hulin" <[hidden email]> wrote:

>
> I've now sorted the scoping out in the parser so subsequent \book blocks are
> no longer affected by prior \bookOutputName and \bookOutputSuffix calls.

Yes, I think this is the right way to do it.  And it's so simple once you
got it figured out right.  Good job!

>
> This gets rid of the need for \bookOutputNameUsePrevious so I've ditched it.
>
> That means that book-filename can be a string and not a queue/stack
> structure.  That's a shame because I reckoned the (ice-9 q) stuff was rather
> cool.
>
> I've now found out at long last where and how the filename gets set for \midi
> blocks.  It has a satisfactory mechanism for adding a version count internally
> if needed; it's already getting the name generated from within
> print-book-with.  So I no longer need to bother about files getting opened at
> \score level.

Good.


>
> I've attached the patch and some test files I've been using.
>

The patch looks good to me.  Neil?

Thanks,

Carl


---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Neil Puttock
2009/10/27 Carl Sorensen <[hidden email]>:

> The patch looks good to me.  Neil?

Not bad, Ian, but you need to keep an eye on trailing spaces and indentation.

+        PARSER->lexer_->set_identifier (ly_symbol2scm
("book-output-suffix"), SCM_BOOL_F);
+        PARSER->lexer_->set_identifier (ly_symbol2scm
("book-filename"), SCM_BOOL_F);

indentation

+bookOutputName =
+#(define-music-function (parser location newfilename) (string?)
+    (_i "Direct output for the current book block to @var{newfilename}")
+        (set! book-filename newfilename)
+        (make-music 'SequentialMusic 'void #t))
+
+bookOutputSuffix =
+#(define-music-function (parser location newsuffix) (string?)
+    (_i "Set the output filename suffix for the current book block to
+@var{newsuffix}")
+        (set! book-output-suffix newsuffix)
+        (make-music 'SequentialMusic 'void #t))
+
+        %% why a function?

indentation

+        (make-music 'SequentialMusic 'void #t))

You could add a `make-void-music' function for this as it's used in
quite a few places.

+;; return any suffix value for output filename allowing for settings by
+;; calls to \bookOutputName

I'd document this inside the function as a string (ditto for
get-current-suffix).

+(define (get-current-filename parser)
+        (let* (
+                (book-filename (ly:parser-lookup parser 'book-filename)))
+            (if (not book-filename)
+            (ly:parser-output-name parser)
+            (ly:parser-lookup parser 'book-filename))))

indentation

+(define (get-current-filename parser)
+        (let* (
+                (book-filename (ly:parser-lookup parser 'book-filename)))

(let (book-filename (ly:parser-lookup parser 'book-filename)))

+            (ly:parser-lookup parser 'book-filename))))

book-filename)))

+(define (get-current-suffix parser)
+   (let* (
+            (book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))
+    (if (string? book-output-suffix)
+        (ly:parser-lookup parser 'book-output-suffix)
+        (ly:parser-lookup parser 'output-suffix))))

indentation

+   (let* (
+            (book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))

(let (book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))

+        (ly:parser-lookup parser 'book-output-suffix)

book-output-suffix

+(define-public current-outfile-name #f)  ; for use by regression tests

I don't understand this; have you added it for use later?

+(define (get-outfile-name parser)
+    ;; user can now override the base file name, so we have to use
+    ;; the file-name concatenated with any potential output-suffix value
+    ;; as the key to out internal a-list
+  (let* (
+      (base-name (get-current-filename parser))
+      (output-suffix (get-current-suffix parser))
+      (alist-key (format "~a~a" base-name output-suffix))
+      (counter-alist (ly:parser-lookup parser 'counter-alist))
+      (output-count (assoc-get alist-key counter-alist 0))
+      (result base-name))

indentation

+  (let* (
+      (base-name (get-current-filename parser))

(let* ((base-name (get-current-filename parser))

The patch doesn't work due to the following gremlins:

                             base (string-regexp-substitute

base-name (string-regexp-substitute

         (outfile-name (get-outfile-name parser base)))

(outfile-name (get-outfile-name parser)))

BTW, have you installed git-cl yet?  It would be much easier to review
your patches using Rietveld.

Regards,
Neil

---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Carl Sorensen



On 10/27/09 7:05 PM, "Neil Puttock" <[hidden email]> wrote:

> 2009/10/27 Carl Sorensen <[hidden email]>:
>
>> The patch looks good to me.  Neil?
>
> Not bad, Ian, but you need to keep an eye on trailing spaces and indentation.

To try to save you time, I'm going to explain the indentation issues.

>
> +        PARSER->lexer_->set_identifier (ly_symbol2scm
> ("book-output-suffix"), SCM_BOOL_F);

> +        PARSER->lexer_->set_identifier (ly_symbol2scm
> ("book-filename"), SCM_BOOL_F);
>
> indentation

These lines are indented one column relative to the previous line.

>
> +bookOutputName =
> +#(define-music-function (parser location newfilename) (string?)
> +    (_i "Direct output for the current book block to @var{newfilename}")
> +        (set! book-filename newfilename)
> +        (make-music 'SequentialMusic 'void #t))
> +
> +bookOutputSuffix =
> +#(define-music-function (parser location newsuffix) (string?)
> +    (_i "Set the output filename suffix for the current book block to
> +@var{newsuffix}")
> +        (set! book-output-suffix newsuffix)
> +        (make-music 'SequentialMusic 'void #t))
> +

(set! and (make-music should not be indented relative to the docstring.
Also, the docstring is probably indented too far.

> +        %% why a function?
>
> indentation
>
> +        (make-music 'SequentialMusic 'void #t))
>
> You could add a `make-void-music' function for this as it's used in
> quite a few places.

If you choose to do this, there should also be a convert-ly rule added to
make this substitution in the docs, regtests, input files, and snippets.

>
> +;; return any suffix value for output filename allowing for settings by
> +;; calls to \bookOutputName
>
> I'd document this inside the function as a string (ditto for
> get-current-suffix).
>
> +(define (get-current-filename parser)
> +        (let* (
> +                (book-filename (ly:parser-lookup parser 'book-filename)))
> +            (if (not book-filename)
> +            (ly:parser-output-name parser)
> +            (ly:parser-lookup parser 'book-filename))))
>
> indentation

(let* should be aligned with the "d" or the "e" in "define"

(if should be aligned with the "l" or the "e" in let

(book-filename should not begin on a new line

(ly:parser-output and (ly:parser-lookup should be aligned with (not

>
> +(define (get-current-filename parser)
> +        (let* (
> +                (book-filename (ly:parser-lookup parser 'book-filename)))
>
> (let (book-filename (ly:parser-lookup parser 'book-filename)))

Only use let* if you have multiple variable declarations in the let, and if
later declarations need to use the result of an earlier declaration.
Otherwise use let.  And keep the first declaration on the same line as the
let.

>
> +            (ly:parser-lookup parser 'book-filename))))
>
> book-filename)))

You already had the result of (ly:parser-lookup parser 'book-filename),
so there's no need to do the call again.

>
> +(define (get-current-suffix parser)
> +   (let* (
> +            (book-output-suffix (ly:parser-lookup parser
> 'book-output-suffix)))
> +    (if (string? book-output-suffix)
> +        (ly:parser-lookup parser 'book-output-suffix)
> +        (ly:parser-lookup parser 'output-suffix))))
>
> indentation
>
> +   (let* (
> +            (book-output-suffix (ly:parser-lookup parser
> 'book-output-suffix)))
>
> (let (book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))
>
> +        (ly:parser-lookup parser 'book-output-suffix)
>
> book-output-suffix
>
> +(define-public current-outfile-name #f)  ; for use by regression tests
>
> I don't understand this; have you added it for use later?
>
> +(define (get-outfile-name parser)
> +    ;; user can now override the base file name, so we have to use
> +    ;; the file-name concatenated with any potential output-suffix value
> +    ;; as the key to out internal a-list
> +  (let* (
> +      (base-name (get-current-filename parser))
> +      (output-suffix (get-current-suffix parser))
> +      (alist-key (format "~a~a" base-name output-suffix))
> +      (counter-alist (ly:parser-lookup parser 'counter-alist))
> +      (output-count (assoc-get alist-key counter-alist 0))
> +      (result base-name))
>
> indentation

first declaration on the same line as the let*, all others indented to
match.

In Scheme we *never* end a line with an open parenthesis.

A good discussion of Scheme indenting is found at

<http://community.schemewiki.org/?scheme-style>

>
> +  (let* (
> +      (base-name (get-current-filename parser))
>
> (let* ((base-name (get-current-filename parser))
>
> The patch doesn't work due to the following gremlins:
>
>                              base (string-regexp-substitute
>
> base-name (string-regexp-substitute
>
>          (outfile-name (get-outfile-name parser base)))
>
> (outfile-name (get-outfile-name parser)))
>
> BTW, have you installed git-cl yet?  It would be much easier to review
> your patches using Rietveld.

Now that you're up and going with patches, it would be helpful to have you
use Rietveld.  Instructions for using git-cl are in the Contributors Guide,
section 8.7.9 (under Adding or modifying features).

HTH,

Carl


---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Ian Hulin
Carl,
Thanks for the pointers - I'm just going through the list to update the patch, so I'll look through all your feedback later. 
Just one remark on this point:

Carl Sorensen wrote:
  
+            (ly:parser-lookup parser 'book-filename))))

book-filename)))
    

You already had the result of (ly:parser-lookup parser 'book-filename),
so there's no need to do the call again.

  
Yes I do - Scheme yells at me with an 'invalid type' message if I try to re-use the local variable here.  The code that looks vile works, the code that looks right doesn't.

Cheers,
Ian
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Ian Hulin
In reply to this post by Carl Sorensen
Carl Sorensen wrote:

>
>
> On 10/27/09 7:05 PM, "Neil Puttock" <[hidden email]> wrote:
>
>> 2009/10/27 Carl Sorensen <[hidden email]>:
>>
>>> The patch looks good to me.  Neil?
>> Not bad, Ian, but you need to keep an eye on trailing spaces and indentation.
>
> To try to save you time, I'm going to explain the indentation issues.
>
>> +        PARSER->lexer_->set_identifier (ly_symbol2scm
>> ("book-output-suffix"), SCM_BOOL_F);
>
>> +        PARSER->lexer_->set_identifier (ly_symbol2scm
>> ("book-filename"), SCM_BOOL_F);
>>
>> indentation
>
> These lines are indented one column relative to the previous line.

Sorted.  Needed to set stuff indents and tabs properly in JEdit.

>
>> +bookOutputName =
>> +#(define-music-function (parser location newfilename) (string?)
>> +    (_i "Direct output for the current book block to @var{newfilename}")
>> +        (set! book-filename newfilename)
>> +        (make-music 'SequentialMusic 'void #t))
>> +
>> +bookOutputSuffix =
>> +#(define-music-function (parser location newsuffix) (string?)
>> +    (_i "Set the output filename suffix for the current book block to
>> +@var{newsuffix}")
>> +        (set! book-output-suffix newsuffix)
>> +        (make-music 'SequentialMusic 'void #t))
>> +
>
> (set! and (make-music should not be indented relative to the docstring.
> Also, the docstring is probably indented too far.
>
>> +        %% why a function?
>>
>> indentation
>>

Sorted, same cause as above.

>> +        (make-music 'SequentialMusic 'void #t))
>>
>> You could add a `make-void-music' function for this as it's used in
>> quite a few places.
>
> If you choose to do this, there should also be a convert-ly rule added to
> make this substitution in the docs, regtests, input files, and snippets.
>

I'm trying to keep the scope of this change to what I need to sort out
the filenames and suffixes.  The only change I made was to
addInstrumentName once I'd tested the function with bookOutputName and
bookOutputSuffix so I could beat git into submission to recognize a
changed file.

>> +;; return any suffix value for output filename allowing for settings by
>> +;; calls to \bookOutputName
>>
>> I'd document this inside the function as a string (ditto for
>> get-current-suffix).
>>

Done

>> +(define (get-current-filename parser)
>> +        (let* (
>> +                (book-filename (ly:parser-lookup parser 'book-filename)))
>> +            (if (not book-filename)
>> +            (ly:parser-output-name parser)
>> +            (ly:parser-lookup parser 'book-filename))))
>>
>> indentation
>
> (let* should be aligned with the "d" or the "e" in "define"
>
> (if should be aligned with the "l" or the "e" in let
>
> (book-filename should not begin on a new line
>
> (ly:parser-output and (ly:parser-lookup should be aligned with (not
>
>> +(define (get-current-filename parser)
>> +        (let* (
>> +                (book-filename (ly:parser-lookup parser 'book-filename)))
>>
>> (let (book-filename (ly:parser-lookup parser 'book-filename)))
>
> Only use let* if you have multiple variable declarations in the let, and if
> later declarations need to use the result of an earlier declaration.
> Otherwise use let.  And keep the first declaration on the same line as the
> let.
>
>> +            (ly:parser-lookup parser 'book-filename))))
>>
>> book-filename)))
>
> You already had the result of (ly:parser-lookup parser 'book-filename),
> so there's no need to do the call again.
>

>> +(define (get-current-suffix parser)
>> +   (let* (
>> +            (book-output-suffix (ly:parser-lookup parser
>> 'book-output-suffix)))
>> +    (if (string? book-output-suffix)
>> +        (ly:parser-lookup parser 'book-output-suffix)
>> +        (ly:parser-lookup parser 'output-suffix))))
>>
>> indentation
>>
>> +   (let* (
>> +            (book-output-suffix (ly:parser-lookup parser
>> 'book-output-suffix)))
>>
>> (let (book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))
>>
>> +        (ly:parser-lookup parser 'book-output-suffix)
>>
>> book-output-suffix
>>

Done for both functions.  Thanks for pointing out about the brackets, Carl.

>> +(define-public current-outfile-name #f)  ; for use by regression tests
>>
>> I don't understand this; have you added it for use later?
>>
Yes, I'm working on a regtest for this and T714.  I want to be able to
test the output from print-book-with without having to generate backend
files.

>> +(define (get-outfile-name parser)
>> +    ;; user can now override the base file name, so we have to use
>> +    ;; the file-name concatenated with any potential output-suffix value
>> +    ;; as the key to out internal a-list
>> +  (let* (
>> +      (base-name (get-current-filename parser))
>> +      (output-suffix (get-current-suffix parser))
>> +      (alist-key (format "~a~a" base-name output-suffix))
>> +      (counter-alist (ly:parser-lookup parser 'counter-alist))
>> +      (output-count (assoc-get alist-key counter-alist 0))
>> +      (result base-name))
>>
>> indentation
>
> first declaration on the same line as the let*, all others indented to
> match.
>
> In Scheme we *never* end a line with an open parenthesis.
>
> A good discussion of Scheme indenting is found at
>
> <http://community.schemewiki.org/?scheme-style>
>
>> +  (let* (
>> +      (base-name (get-current-filename parser))
>>
>> (let* ((base-name (get-current-filename parser))
>>
>> The patch doesn't work due to the following gremlins:
>>
>>                              base (string-regexp-substitute
>>
>> base-name (string-regexp-substitute
>>
>>          (outfile-name (get-outfile-name parser base)))
>>
>> (outfile-name (get-outfile-name parser)))
>>
Sorted as follows:

   (let* ( (base-name (get-current-filename parser))
           (output-suffix (get-current-suffix parser))
           (alist-key (format "~a~a" base-name output-suffix))
           (counter-alist (ly:parser-lookup parser 'counter-alist))
           (output-count (assoc-get alist-key counter-alist 0))
           (result base-name))
      ;; Allow all ASCII alphanumerics, including accents
     (if (string? output-suffix)
         (set! result (format "~a-~a"
             result (string-regexp-substitute
                     "[^-[:alnum:]]" "_" output-suffix))))
     ;; assoc-get call will always have returned a number
     (if (> output-count 0)
       (set! result (format #f "~a-~a" result output-count)))

>> BTW, have you installed git-cl yet?  It would be much easier to review
>> your patches using Rietveld.
>
> Now that you're up and going with patches, it would be helpful to have you
> use Rietveld.  Instructions for using git-cl are in the Contributors Guide,
> section 8.7.9 (under Adding or modifying features).
>
Sorry for all the false starts, I've now managed to get a clean patch
containing only my changed files onto rietveld as Issue 143055.

Thanks for your patience and help on this one.

Cheers,

Ian

---

----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH]: Tracker 836 - Allow output filename and output-suffix to be specified for a \book block

Carl Sorensen



On 10/29/09 8:01 AM, "Ian Hulin" <[hidden email]> wrote:

> Carl Sorensen wrote:
>>
>>
>> On 10/27/09 7:05 PM, "Neil Puttock" <[hidden email]> wrote:
>>
>>> 2009/10/27 Carl Sorensen <[hidden email]>:
>>>
>>>> The patch looks good to me.  Neil?
>>> Not bad, Ian, but you need to keep an eye on trailing spaces and
>>> indentation.
>>
>> To try to save you time, I'm going to explain the indentation issues.
>>
>>> +        PARSER->lexer_->set_identifier (ly_symbol2scm
>>> ("book-output-suffix"), SCM_BOOL_F);
>>
>>> +        PARSER->lexer_->set_identifier (ly_symbol2scm
>>> ("book-filename"), SCM_BOOL_F);
>>>
>>> indentation
>>
>> These lines are indented one column relative to the previous line.
>
> Sorted.  Needed to set stuff indents and tabs properly in JEdit.
>

Does Jedit handle Scheme properly?  One of the issues is that it's different
from .ly files.


>
>>> +        (make-music 'SequentialMusic 'void #t))
>>>
>>> You could add a `make-void-music' function for this as it's used in
>>> quite a few places.
>>
>> If you choose to do this, there should also be a convert-ly rule added to
>> make this substitution in the docs, regtests, input files, and snippets.
>>
>
> I'm trying to keep the scope of this change to what I need to sort out
> the filenames and suffixes.  The only change I made was to
> addInstrumentName once I'd tested the function with bookOutputName and
> bookOutputSuffix so I could beat git into submission to recognize a
> changed file.
>

Since Neil said "could", I assume you don't need to to get the patch
accepted.

But a follow-on patch would probably be appreciated.

>>
>>> (let (book-output-suffix (ly:parser-lookup parser 'book-output-suffix)))
>>>
>>> +        (ly:parser-lookup parser 'book-output-suffix)
>>>
>>> book-output-suffix
>>>
>
> Done for both functions.  Thanks for pointing out about the brackets, Carl.
>

You're welcome.  Scheme can be very confusing at times, can't it.
 

> Sorted as follows:
>
>    (let* ( (base-name (get-current-filename parser))
>            (output-suffix (get-current-suffix parser))
>            (alist-key (format "~a~a" base-name output-suffix))
>            (counter-alist (ly:parser-lookup parser 'counter-alist))
>            (output-count (assoc-get alist-key counter-alist 0))
>            (result base-name))
>       ;; Allow all ASCII alphanumerics, including accents
>      (if (string? output-suffix)
>          (set! result (format "~a-~a"
>              result (string-regexp-substitute
>                      "[^-[:alnum:]]" "_" output-suffix))))
>      ;; assoc-get call will always have returned a number
>      (if (> output-count 0)
>        (set! result (format #f "~a-~a" result output-count)))
>

I still see some formatting issues:

   (let* ((base-name (get-current-filename parser))
          ^ eliminated space between parentheses -- not used in Scheme
          (output-suffix (get-current-suffix parser))
          (alist-key (format "~a~a" base-name output-suffix))
          (counter-alist (ly:parser-lookup parser 'counter-alist))
          (output-count (assoc-get alist-key counter-alist 0))
          (result base-name))
      ;; Allow all ASCII alphanumerics, including accents
     (if (string? output-suffix)
         (set! result
               (format "~a-~a"
                       result
                       (string-regexp-substitute
                         "[^-[:alnum:]]"
                         "_"
                         output-suffix))))
               ^  (format is aligned with result, since it's at the same
                    logical level.
                       ^  result and (string... are aligned with "~a-~a"
                          since they're at the same logical level
                         ^ the args to string-regexp-substitute are all
                           indented equally relative to the opening paren
                           of the list.

     ;; assoc-get call will always have returned a number
     (if (> output-count 0)
         (set! result (format #f "~a-~a" result output-count)))
         ^ The resultant expresssion is aligned with the conditional
           expression. (Which is another way of saying the list elements are
           aligned.)

>>> BTW, have you installed git-cl yet?  It would be much easier to review
>>> your patches using Rietveld.
>>
>> Now that you're up and going with patches, it would be helpful to have you
>> use Rietveld.  Instructions for using git-cl are in the Contributors Guide,
>> section 8.7.9 (under Adding or modifying features).
>>
> Sorry for all the false starts, I've now managed to get a clean patch
> containing only my changed files onto rietveld as Issue 143055.

No need to apologize.  This can be a difficult system to get up to speed on.
You're doing really well.  Thanks for your patience and willingness to
learn.

>
> Thanks for your patience and help on this one.

You're *very* welcome.  It's great to have new people joining in on LilyPond
development.

Carl


---

----
Join the Frogs!

Loading...