On Sun, Feb 19, 2012 at 02:48:05AM -0800, Michael Hendry wrote:
>
> >> #DEFINE NotYet
> >> ...
> >> #IFNDEF NotYet
> >> \book {
> >> \bookOutputName "Chez Fernand (alto)"
> >> \new Score
> >> <<
> >> \transpose f' d {\TheChords}
> >> \new Staff
> >> \repeat unfold 13 {
> >> s1 \noBreak s1 \noBreak s1 \noBreak s1 \break }
> >> \transpose f' d {\TheHead}
> >>>>
> >> \header {piece = "Alto Sax"}
> >> }
> >> #ENDIF
>
...
> Of course, I know about block comments, and
> if there were only one section I wanted to suppress during the development
> of piece that would be fine. But I have several sections I'd like to switch
> off during data entry, and I'd like to be able to switch them all on again
> with a single edit without having to remember where they are - in much the
> same way as a C programmer will scatter debugging code through a project,
> and switch it off for the final compilation.
>
> So it would be:
>
> #define debugging
>
> ... several pages of code ...
>
> #ifdef debugging
> ... print something on the screen, and await a user response ...
> #endif
>
> ... several more pages of code ...
>
> #ifdef debugging
> ... do something else that's useful in the debugging process ...
> #endif
Please forgive my exercise in total conjecture, as I have not
tested any of the concepts below, but perhaps UNIX's m4 macro
preprocessor can provide the tools you seek without requiring any
changes to LilyPond.
Since that I infer you possess knowledge of the C language's
macro capabilities, would it suit your needs to simply write your
LilyPond source code to conform with m4(1), and then use m4's
macro capabilities to do what you want? Using a wheel which
has already been invented, as it were.
I'll admit that I'm not intimately familiar with m4, so please
forgive me if you've tried this and found it unworkable.
> I envisage a series of #define statements at the head of the main .ly file
> such as:
>
> #define concert_part
> #define guitar_part
> #undef alto_part
> #define clarinet_part
>
> which would alter the output from the included "parts.ly" file.
Or, you could set/unset variables from the command line:
m4 -Dconcert_part -Dguitar_part -Ualto_part -Dclarinet_part \
parts.ly \
| lilypond
Jim
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user