Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-26 Thread Michael Hendry


David Kastrup wrote:
 
 
 Oh, the $(if ) method can perfectly handle variables which are a book.
 It is just LilyPond that does not accept a book identifier at top
 level.  So you have to write something like
 \book { $(if includeGuitar GuitarBook) }
 and rely on an empty book not having an effect.
 
 Yes, this is a bit awkward.  If you are fine with downloading,
 compiling, and installing _source_ to a degree that you do it without
 asking twice just because of some outdated information, tracking the
 development version (including testing out patches as they come) will
 not likely be a big step for you.
 
 And anyway: it is likely that you have now LilyPond 2.15.9 plastered all
 over /usr/local already, and you might as well plaster the current
 development version over it instead of trying to remove all that so that
 it does not shadow standard precompiled versions.
 
 -- 
 David Kastrup
 
 
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 https://lists.gnu.org/mailman/listinfo/lilypond-user
 
 

I find it hard when groping in the dark with two unfamiliar languages to pin
down which of them is not doing what I want it to do, and to distinguish
what might be a fault in the implementation of the languages from a (much
more likely) fault in my code.

However, my own limited experience of writing software for others to use has
shown that the blundering path of a novice in unfamiliar territory can
reveal faults in nooks and crannies that an experienced user wouldn't stray
into!

The process of downloading, compiling and installing a source package is not
all that fearsome to me - because there is a very clear set of instructions
- unless it fails at some point, when I'm unlikely to be able to sort out
the problem.

I'm probably not even looking in the right place, but I wouldn't know how to
start tracking the development version.

I see that 2.16 is due out shortly - I can't work out whether this will
include the solution to issue 2343 (which emerged from this thread). If so,
I'm quite happy to adjust the faulty filenames by hand until it's released.

-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33393754.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-26 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 I find it hard when groping in the dark with two unfamiliar languages
 to pin down which of them is not doing what I want it to do, and to
 distinguish what might be a fault in the implementation of the
 languages from a (much more likely) fault in my code.

The error messages tend to be rather helpful for figuring that out.

 However, my own limited experience of writing software for others to
 use has shown that the blundering path of a novice in unfamiliar
 territory can reveal faults in nooks and crannies that an experienced
 user wouldn't stray into!

It's not often easy to tell which nooks and crannies are a part of the
design, which are a sideeffect, and which are a bug.  Changes that leave
the bugs indistinguishable from the rest are really hard to design, and
LilyPond is work in progress in many respects.

 The process of downloading, compiling and installing a source package
 is not all that fearsome to me - because there is a very clear set of
 instructions - unless it fails at some point, when I'm unlikely to be
 able to sort out the problem.

 I'm probably not even looking in the right place, but I wouldn't know
 how to start tracking the development version.

URL:http://lilypond.org/doc/v2.15/Documentation/contributor/working-with-source-code

 I see that 2.16 is due out shortly - I can't work out whether this will
 include the solution to issue 2343 (which emerged from this thread).

Likely, but no warranties.  2.16 has been due out shortly several times
already, including something like half a year ago.

 If so, I'm quite happy to adjust the faulty filenames by hand until
 it's released.

Sure: if this has been the only problem you ever wished to be in the
loop for, installing from master would be overkill.  It also does not
make much sense when you don't intend updating frequently.

I just wanted to point that option out since, seeing how you were
apparently comfortable installing from source, it might be of interest
to you.  And of course, other developers.  Timely feedback is always
helpful.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-25 Thread Michael Hendry


Francisco Vila wrote:
 
 2012/2/25 Michael Hendry hendry.mich...@gmail.com:
 I've compiled
 
 compiled?
 
 and installed lilypond-2.15.9 (the latest version I could
 find)
 
 2.15.30 is in http://lilypond.org/development , where did you search
 for it? Forget google for a moment and go to the official home page of
 the project. Remember: it's lilypond.org
 
 -- 
 Francisco Vila. Badajoz (Spain)
 www.paconet.org , www.csmbadajoz.com
 
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 https://lists.gnu.org/mailman/listinfo/lilypond-user
 
 

Thanks, David, Harm  Francisco. I'm grateful for your tolerance of my
blunders!

Yes, I had downloaded the source for lilypond-2.15.9 and compiled and
installed it. 

Running lilypond-2.15.30-1.linux-x86.sh would have been much quicker and
easier, but we (usually) learn from our mistakes!

Francisco's simple file now works as expected, with the D missing when
whether is ##f, but unfortunately it would seem that the $(if...) method
can't handle a variable which is a book.

GNU LilyPond 2.15.30
Processing `score.ly'
Parsing...
score.ly:39:0: error: syntax error, unexpected BOOK_IDENTIFIER

$(if includeGuitar GuitarBook )
fatal error: failed files: score.ly



-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33389772.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-25 Thread David Kastrup
Francisco Vila paconet@gmail.com writes:

 2012/2/24 Michael Hendry hendry.mich...@gmail.com:
 David Kastrup wrote:
 You can use
 includeGuitar = ##t
 includeConcert = ##f
 includeTrumpet = ##t
 includeAlto = ##f
 at the top and then do
 $(if includeGuitar GuitarBook)
 $(if includeConcert ConcertBook)
 $(if includeTrumpet TrumpetBook)
 $(if includeAlto AltoBook)

 at the bottom.

 I'm beginning to think I'm terminally dim, but I can't get this to work, and
 I can't find any reference to $(if...), (nor indeed to any kind of if ...
 then ... else) in the Lilypond manuals, despite several hours of hunting.

 The error message I get is syntax error, unexpected $undefined.

 The (if ... part is Scheme. It works in latest development version.
 Here is another working minimal example.

 whether = ##t
 musica = { d' }
 {
   c'
   $(if whether musica)
   e'
 }

Oh.  If his version is older than that, he can use

#(ly:export (if includeAlto AltoBook))

...  But it is not really fun with those old versions.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-25 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 Francisco Vila wrote:
 
 2012/2/25 Michael Hendry hendry.mich...@gmail.com:
 I've compiled
 
 compiled?
 
 and installed lilypond-2.15.9 (the latest version I could
 find)
 
 2.15.30 is in http://lilypond.org/development , where did you search
 for it? Forget google for a moment and go to the official home page of
 the project. Remember: it's lilypond.org

 Thanks, David, Harm  Francisco. I'm grateful for your tolerance of my
 blunders!

 Yes, I had downloaded the source for lilypond-2.15.9 and compiled and
 installed it. 

 Running lilypond-2.15.30-1.linux-x86.sh would have been much quicker and
 easier, but we (usually) learn from our mistakes!

 Francisco's simple file now works as expected, with the D missing when
 whether is ##f, but unfortunately it would seem that the $(if...) method
 can't handle a variable which is a book.

 GNU LilyPond 2.15.30
 Processing `score.ly'
 Parsing...
 score.ly:39:0: error: syntax error, unexpected BOOK_IDENTIFIER

 $(if includeGuitar GuitarBook )
 fatal error: failed files: score.ly

Oh, the $(if ) method can perfectly handle variables which are a book.
It is just LilyPond that does not accept a book identifier at top
level.  So you have to write something like
\book { $(if includeGuitar GuitarBook) }
and rely on an empty book not having an effect.

Yes, this is a bit awkward.  If you are fine with downloading,
compiling, and installing _source_ to a degree that you do it without
asking twice just because of some outdated information, tracking the
development version (including testing out patches as they come) will
not likely be a big step for you.

And anyway: it is likely that you have now LilyPond 2.15.9 plastered all
over /usr/local already, and you might as well plaster the current
development version over it instead of trying to remove all that so that
it does not shadow standard precompiled versions.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-25 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 I've compiled and installed lilypond-2.15.9 (the latest version I could
 find)

Too old.  Where did you look?

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread Michael Hendry


David Kastrup wrote:
 
 David Kastrup d...@gnu.org writes:
 
 
 I picked the \paper settings of the book.
 
 Updates:
   Labels: Patch-new
 
 Comment #5 on issue 2343 by d...@gnu.org: Faulty file-naming when
 outputting multiple \books
 http://code.google.com/p/lilypond/issues/detail?id=2343#c5
 
 Issue 2343: Faulty file-naming when outputting multiple \books
 
 http://codereview.appspot.com/5698050
 
 
 It is conceivable that you don't need the C++ part of the patch just to
 try it out in case you don't have the means to recompile.
 
 -- 
 David Kastrup
 
 

Thanks, David.

This is all a bit close to the bleeding edge of the technology for me! 

Is there a simple guide to the application of patches? - I'm looking for a
step-by-step Delia Smith-style recipe as opposed to a more relaxed Jamie
Oliver one, which might not be correct in every detail!

Going back to my previous problem, I'd hoped I might be able to move:

\book { \GuitarBook }
\book { \ConcertBook }
\book { \TrumpetBook }
\book { \AltoBook }

to the top of the file, so that I could comment out the unwanted \book
statements, but lilypond doesn't seem to like forward references.
-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33384194.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread Graham Percival
On Fri, Feb 24, 2012 at 02:45:43AM -0800, Michael Hendry wrote:
 
 Is there a simple guide to the application of patches? - I'm looking for a
 step-by-step Delia Smith-style recipe as opposed to a more relaxed Jamie
 Oliver one, which might not be correct in every detail!

There is no simple guide.  The only simple guide is wait for
2.15.31.

- Graham

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 David Kastrup wrote:
 
 David Kastrup d...@gnu.org writes:
 
 
 I picked the \paper settings of the book.
 
 Updates:
  Labels: Patch-new
 
 Comment #5 on issue 2343 by d...@gnu.org: Faulty file-naming when
 outputting multiple \books
 http://code.google.com/p/lilypond/issues/detail?id=2343#c5
 
 Issue 2343: Faulty file-naming when outputting multiple \books
 
 http://codereview.appspot.com/5698050
 
 
 It is conceivable that you don't need the C++ part of the patch just to
 try it out in case you don't have the means to recompile.

 Thanks, David.

 This is all a bit close to the bleeding edge of the technology for me! 

 Is there a simple guide to the application of patches? - I'm looking
 for a step-by-step Delia Smith-style recipe as opposed to a more
 relaxed Jamie Oliver one, which might not be correct in every detail!

It depends.  By far the easiest way to apply a patch is when you have a
checkout of the source repository.  But that makes only sense when you
compile your own versions of LilyPond: if you apply patches and then
copy the patched files manually over a precompiled version of LilyPond
elsewhere, they might not play together well.

If you compile your own versions of LilyPond (which is not really all
that difficult), you _are_ at the bleeding edge.  If you are interested
in tracking development closely and trying out things as they are
developed and give feedback: by all means do.  It is interesting, and
you will get by far the fastest results when reporting bugs and waiting
for fixes to appear, and you can give feedback without waiting for the
next version.  But it certainly also costs time.

 Going back to my previous problem, I'd hoped I might be able to move:

 \book { \GuitarBook }
 \book { \ConcertBook }
 \book { \TrumpetBook }
 \book { \AltoBook }

 to the top of the file, so that I could comment out the unwanted \book
 statements, but lilypond doesn't seem to like forward references.

You can use

includeGuitar = ##t
includeConcert = ##f
includeTrumpet = ##t
includeAlto = ##f

at the top and then do

$(if includeGuitar GuitarBook)
$(if includeConcert ConcertBook)
$(if includeTrumpet TrumpetBook)
$(if includeAlto AltoBook)

at the bottom.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 David Kastrup wrote:
 
 
 You can use
 
 includeGuitar = ##t
 includeConcert = ##f
 includeTrumpet = ##t
 includeAlto = ##f
 
 at the top and then do
 
 $(if includeGuitar GuitarBook)
 $(if includeConcert ConcertBook)
 $(if includeTrumpet TrumpetBook)
 $(if includeAlto AltoBook)
 
 at the bottom.
 
 

 I'm beginning to think I'm terminally dim, but I can't get this to work, and
 I can't find any reference to $(if...), (nor indeed to any kind of if ...
 then ... else) in the Lilypond manuals, despite several hours of hunting.

 The error message I get is syntax error, unexpected $undefined.

Uh, this _does_ assume that you have

GuitarBook = \book { ... }
ConcertBook = \book { ... }
...

in the middle.  $ starts a Scheme expression, so you would need to look
up if in the Guile manual instead.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread Francisco Vila
2012/2/24 Francisco Vila paconet@gmail.com:
 The (if ... part is Scheme. It works in latest development version.

Sorry, this is not clearly told.

The $( ... way of calling embedded Scheme did not work in 2.14 but it
does in recently _released_ development versions.


-- 
Francisco Vila. Badajoz (Spain)
www.paconet.org , www.csmbadajoz.com

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread Francisco Vila
2012/2/24 Michael Hendry hendry.mich...@gmail.com:
 David Kastrup wrote:
 You can use
 includeGuitar = ##t
 includeConcert = ##f
 includeTrumpet = ##t
 includeAlto = ##f
 at the top and then do
 $(if includeGuitar GuitarBook)
 $(if includeConcert ConcertBook)
 $(if includeTrumpet TrumpetBook)
 $(if includeAlto AltoBook)

 at the bottom.

 I'm beginning to think I'm terminally dim, but I can't get this to work, and
 I can't find any reference to $(if...), (nor indeed to any kind of if ...
 then ... else) in the Lilypond manuals, despite several hours of hunting.

 The error message I get is syntax error, unexpected $undefined.

The (if ... part is Scheme. It works in latest development version.
Here is another working minimal example.

whether = ##t
musica = { d' }
{
  c'
  $(if whether musica)
  e'
}

%%%END

-- 
Francisco Vila. Badajoz (Spain)
www.paconet.org , www.csmbadajoz.com

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread Michael Hendry



Francisco Vila wrote:
 
 2012/2/24 Michael Hendry hendry.mich...@gmail.com:
 David Kastrup wrote:
 You can use
 includeGuitar = ##t
 includeConcert = ##f
 includeTrumpet = ##t
 includeAlto = ##f
 at the top and then do
 $(if includeGuitar GuitarBook)
 $(if includeConcert ConcertBook)
 $(if includeTrumpet TrumpetBook)
 $(if includeAlto AltoBook)

 at the bottom.

 I'm beginning to think I'm terminally dim, but I can't get this to work,
 and
 I can't find any reference to $(if...), (nor indeed to any kind of if
 ...
 then ... else) in the Lilypond manuals, despite several hours of
 hunting.

 The error message I get is syntax error, unexpected $undefined.
 
 The (if ... part is Scheme. It works in latest development version.
 Here is another working minimal example.
 
 whether = ##t
 musica = { d' }
 {
   c'
   $(if whether musica)
   e'
 }
 
 %%%END
 
 -- 
 Francisco Vila. Badajoz (Spain)
 www.paconet.org , www.csmbadajoz.com
 
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 https://lists.gnu.org/mailman/listinfo/lilypond-user
 
 
Thanks Francisco and David.

I've compiled and installed lilypond-2.15.9 (the latest version I could
find) but still get the same error message with my file, and with the
minimal example above, with a report:

[terminal output]
GNU LilyPond 2.15.9
Processing `test.ly'
Parsing...
test.ly:5:2: error: syntax error, unexpected $undefined
  
  $(if whether musica)
test.ly:3:0: error: errors found, ignoring music expression

{
test.ly:0: warning: no \version statement found, please add

\version 2.15.9

for future compatibility
fatal error: failed files: test.ly
[/terminal output]

I must say, I had understood that it was necessary to precede Scheme
statements with a hash character, but now that I read further I see that a
dollar-sign is also used to inform Lilypond that a Scheme statement is
coming.
-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33388543.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread Francisco Vila
2012/2/25 Michael Hendry hendry.mich...@gmail.com:
 I've compiled

compiled?

 and installed lilypond-2.15.9 (the latest version I could
 find)

2.15.30 is in http://lilypond.org/development , where did you search
for it? Forget google for a moment and go to the official home page of
the project. Remember: it's lilypond.org

-- 
Francisco Vila. Badajoz (Spain)
www.paconet.org , www.csmbadajoz.com

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-24 Thread Thomas Morley
Hi Michael,

 I've compiled and installed lilypond-2.15.9 (the latest version I could
 find) but still get the same error message with my file,

IIRC it was implemented later than 2.15.9

The latest devel-version: http://lilypond.org/website/development.html

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-23 Thread David Kastrup
David Kastrup d...@gnu.org writes:

 Michael Hendry hendry.mich...@gmail.com writes:

 If I compile: 

 \book { \GuitarBook }
 \book { \ConcertBook }
 \book { \TrumpetBook }
 \book { \AltoBook }

 I get the correct information in the output files, but the filenames are...

 TestTag (alto).pdf
 TestTag (alto)-1.pdf
 TestTag (alto)-2.pdf
 TestTag (alto)-3.pdf

 ...although the definition of GuitarBook includes '\bookOutputName TestTag
 (gtr)', and so on for the other parts.

 \bookOutputName sets a global variable.  Do you think the variable
 should be part of the \layout or something like that?

I picked the \paper settings of the book.

Updates:
Labels: Patch-new

Comment #5 on issue 2343 by d...@gnu.org: Faulty file-naming when
outputting multiple \books
http://code.google.com/p/lilypond/issues/detail?id=2343#c5

Issue 2343: Faulty file-naming when outputting multiple \books

http://codereview.appspot.com/5698050


It is conceivable that you don't need the C++ part of the patch just to
try it out in case you don't have the means to recompile.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-22 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 If I compile: 

 \book { \GuitarBook }
 \book { \ConcertBook }
 \book { \TrumpetBook }
 \book { \AltoBook }

 I get the correct information in the output files, but the filenames are...

 TestTag (alto).pdf
 TestTag (alto)-1.pdf
 TestTag (alto)-2.pdf
 TestTag (alto)-3.pdf

 ...although the definition of GuitarBook includes '\bookOutputName TestTag
 (gtr)', and so on for the other parts.

\bookOutputName sets a global variable.  Do you think the variable
should be part of the \layout or something like that?  It is not all
that obvious to me what is sitting where, so I can't deal timely with
that because of other work.  You might want to file bug report for this
so that it does not get lost.  And you might want to thing about how
this should best play together with bookparts and midi, basically making
a wishlist of different scenarios and the output files you would expect
in each case.  That makes it more likely that someone will tackle it
sooner, or that problems in the design are shaken out in the discussion
before somebody invests unnecessary work.

 It looks as though \bookOutputName is treated as a global variable,
 even though it's defined inside a \book {}

It is not as much defined as called.  Look at its definition in
ly/music-function-init.ly.

 which is itself defined within a variable's assignment statement.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread Urs Liska
I don't know if that's a too complex solution, but you could try the 
following:

- write the individual parts of your source in individual files
- write two alternative intermediate files:
  - one that \includes all the parts (like production.ily)
  - one that \includes only the parts you want to be used (like 
notYet.ily)
- in your final lilypond file \include these two files but comment out 
one of them.


HTH
Urs

Am 18.02.2012 00:30, schrieb Michael Hendry:
When I've finished a jazz chart, I'll want to produce separate parts 
for several transposing instruments, but while I'm working on the 
entry of the melody and chords in concert pitch I only need to produce 
one .pdf file. Obviously, I can comment out the sections I don't want 
during data entry work, and remove the comments once the work is 
complete, but it would be handy to be able to use a C-like construct 
like this: *#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 * to suppress unwanted output for the Alto sax part (and those 
for the other transposing instruments), and comment out the #DEFINE 
NotYet when I'm happy with the data entry.


View this message in context: Is there an equivalent of #define ... 
#ifndef ... #endif in lilypond? 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33346188.html
Sent from the Gnu - Lilypond - User mailing list archive 
http://old.nabble.com/Gnu---Lilypond---User-f1722.html at Nabble.com.



___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread Michael Hendry



lilypond-7 wrote:
 
 
 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
 
 

Thanks, Helge and Jim.

I was forgetting that when a C program is compiled, the pre-processor is
deployed first of all, and that #define etc. are pre-processor directives.

This approach would make my files much less portable to other Lilypond
users, so although I think it I could make it work, the gain wouldn't be
worth the pain!

So I'll have to do what I want to do within the resources provided by
Lilypond itself.

I've been experimenting with \tag, but it doesn't seem to be possible to use
it in the \book {} context.

Many years of amateur programming have taught me the value of modular code,
which can be debugged thoroughly then left untouched - brought in wherever
it is needed using \include (or equivalent) statements. Copying-and-pasting
this sort of code into every program that might need it runs the risk of
inadvertently changing it, and also means having to keep track of every
instance of it so that bugs can be fixed or enhancements introduced, instead
of just changing the master copy.

I expect to use Lilypond mainly with jazz charts, which have a predictable
format and lend themselves to modular construction - I'll keep at it!


-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33355609.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread Christ van Willegen
Hi,

On Sat, Feb 18, 2012 at 00:30, Michael Hendry hendry.mich...@gmail.com wrote:
 When I've finished a jazz chart, I'll want to produce separate parts for
 several transposing instruments, but while I'm working on the entry of the
 melody and chords in concert pitch I only need to produce one .pdf file.

Can the bits and pieces that I found in this[1] thread help you out here?

Christ van Willegen

[1] http://lists.gnu.org/archive/html/lilypond-user/2010-02/msg00412.html
-- 
09 F9 11 02 9D 74 E3 5B D8 41 56 C5 63 56 88 C0

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 I've been experimenting with \tag, but it doesn't seem to be possible
 to use it in the \book {} context.

Care to show your experiments?

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread Michael Hendry


David Kastrup wrote:
 
 Michael Hendry hendry.mich...@gmail.com writes:
 
 I've been experimenting with \tag, but it doesn't seem to be possible
 to use it in the \book {} context.
 
 Care to show your experiments?
 
 -- 
 David Kastrup
 
 

OK - here's a stripped-down version of a 32-bar standard:
code
\version 2.14.0
% TestTag
% Michael Hendry
% 20th Feb 2012

\header {
title = TestTag
composer = Michael Hendry
enteredby=MDH
}

\paper {
paper-width = 21.0\cm
paper-height = 29.7\cm
top-margin = 0.0\cm
bottom-margin = 0.0\cm
left-margin = 1.0\cm
right-margin = 1.0\cm
ragged-last = ##f
}

TheHead =  \relative c' {
\clef treble \key d \minor \numericTimeSignature \time 4/4
\set Score.markFormatter = #format-mark-box-letters
  { s1*32 }
}
TheChords =  \chords {
d1:m9|
s1*31|
 }

% The score definition
% Create four separate books, each consisting of a lead sheet in a
different key
% (for Guitar, Concert, Bb and Eb instruments respectively).

\book {
\bookOutputName TestTag (gtr)
\new Score

\transpose f' f' {\TheChords}
\new Staff
\repeat unfold 8 {
s1 \noBreak s1 \noBreak s1 \noBreak s1 \break }
\transpose f' f' {\TheHead}

\header {piece = Guitar}
} 

\tag #'ConcertBook {
\book {
\bookOutputName TestTag (concert)
\new Score

\transpose f' f {\TheChords}
\new Staff
\repeat unfold 8 {
s1 \noBreak s1 \noBreak s1 \noBreak s1 \break }
\transpose f' f {\TheHead}

\header {piece = Concert Pitch}
}
}

\book { 
\bookOutputName TestTag (tpt)
\new Score

\transpose f' g {\TheChords}
\new Staff
\repeat unfold 8 {
s1 \noBreak s1 \noBreak s1 \noBreak s1 \break }
\transpose f' g {\TheHead}

\header {piece = Trumpet}
}
\book {
\bookOutputName TestTag (alto)
\new Score

\transpose f' d {\TheChords}
\new Staff
\repeat unfold 8 {
s1 \noBreak s1 \noBreak s1 \noBreak s1 \break }
\transpose f' d {\TheHead}

\header {piece = Alto Sax}
}
/code

I thought I'd be able to tag the whole of the section that produces the
Concert Pitch version of the piece, so that I could suppress its production
using \removeWithTag #'ConcertBook, but Lilypond says:

...
Layout output to `TestTag (gtr).ps'...
Converting to `./TestTag (gtr).pdf'...
score.ly:50:0: error: syntax error, unexpected \book

\book {
score.ly:60:8: error: syntax error, unexpected \header

\header {piece = Concert Pitch}
score.ly:49:0: error: errors found, ignoring music expression

\tag #'ConcertBook {
Interpreting music... [8]
...


-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33356488.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 David Kastrup wrote:
 
 Michael Hendry hendry.mich...@gmail.com writes:
 
 I've been experimenting with \tag, but it doesn't seem to be possible
 to use it in the \book {} context.
 
 Care to show your experiments?
 
 -- 
 David Kastrup
 
 

 OK - here's a stripped-down version of a 32-bar standard:



 \tag #'ConcertBook {
 \book {
   \bookOutputName TestTag (concert)

Ok, tags work with music, not with books.  Here is what I would suggest:

ConcertBook =
\book {
  ...
}

and then you can at a later point of time say

\ConcertBook

and can comment that line out or not.  Assigning #f to ConcertBook when
a command line option is set is a bit trickier, but still reasonably
easy.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread Michael Hendry



David Kastrup wrote:
 
 Michael Hendry hendry.mich...@gmail.com writes:
 
 David Kastrup wrote:
 
 Michael Hendry hendry.mich...@gmail.com writes:
 
 I've been experimenting with \tag, but it doesn't seem to be possible
 to use it in the \book {} context.
 
 Care to show your experiments?
 
 -- 
 David Kastrup
 
 

 OK - here's a stripped-down version of a 32-bar standard:
 
 
 
 \tag #'ConcertBook {
 \book {
  \bookOutputName TestTag (concert)
 
 Ok, tags work with music, not with books.  Here is what I would suggest:
 
 ConcertBook =
 \book {
   ...
 }
 
 and then you can at a later point of time say
 
 \ConcertBook
 
 and can comment that line out or not.  Assigning #f to ConcertBook when
 a command line option is set is a bit trickier, but still reasonably
 easy.
 
 -- 
 David Kastrup
 
 
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 https://lists.gnu.org/mailman/listinfo/lilypond-user
 
 
That sounds good, but when I tried it I got...

michael@Linley6:~/indigo/workspace/TestTag$ lilypond score.ly
GNU LilyPond 2.14.2
Processing `score.ly'
Parsing...
score.ly:92:0: error: syntax error, unexpected BOOK_IDENTIFIER

\ConcertBook
error: failed files: score.ly
michael@Linley6:~/indigo/workspace/TestTag$ 


-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33357093.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 Ok, tags work with music, not with books.  Here is what I would suggest:
 
 ConcertBook =
 \book {
   ...
 }
 
 and then you can at a later point of time say
 
 \ConcertBook
 
 and can comment that line out or not.  Assigning #f to ConcertBook when
 a command line option is set is a bit trickier, but still reasonably
 easy.
 
 That sounds good, but when I tried it I got...

 michael@Linley6:~/indigo/workspace/TestTag$ lilypond score.ly
 GNU LilyPond 2.14.2
 Processing `score.ly'
 Parsing...
 score.ly:92:0: error: syntax error, unexpected BOOK_IDENTIFIER

 \ConcertBook

Pffft.  Taking a look at the LilyPond grammar (it is also in an appendix
in the notation manual), it turns out that you have to write

\book { \ConcertBook }

here.  Turns out that a book identifier can be used in both \bookpart
and \book.  That's a bit more for outcommenting and it becomes harder to
use this conditionally.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread David Kastrup
David Kastrup d...@gnu.org writes:

 Pffft.  Taking a look at the LilyPond grammar (it is also in an appendix
 in the notation manual), it turns out that you have to write

 \book { \ConcertBook }

 here.  Turns out that a book identifier can be used in both \bookpart
 and \book.  That's a bit more for outcommenting and it becomes harder to
 use this conditionally.

But you can use several separate \score identifiers in a book.

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-20 Thread Michael Hendry



David Kastrup wrote:
 
 Michael Hendry hendry.mich...@gmail.com writes:
 
 Ok, tags work with music, not with books.  Here is what I would suggest:
 
 ConcertBook =
 \book {
   ...
 }
 
 and then you can at a later point of time say
 
 \ConcertBook
 
 and can comment that line out or not.  Assigning #f to ConcertBook when
 a command line option is set is a bit trickier, but still reasonably
 easy.
 
 That sounds good, but when I tried it I got...

 michael@Linley6:~/indigo/workspace/TestTag$ lilypond score.ly
 GNU LilyPond 2.14.2
 Processing `score.ly'
 Parsing...
 score.ly:92:0: error: syntax error, unexpected BOOK_IDENTIFIER

 \ConcertBook
 
 Pffft.  Taking a look at the LilyPond grammar (it is also in an appendix
 in the notation manual), it turns out that you have to write
 
 \book { \ConcertBook }
 
 here.  Turns out that a book identifier can be used in both \bookpart
 and \book.  That's a bit more for outcommenting and it becomes harder to
 use this conditionally.
 
 -- 
 David Kastrup
 
 
 

It's an odd way of doing things, effectively having to enclose a \book with
a \book. Not only that, but it doesn't work correctly in terms of naming the
output files.

If I compile: 

\book { \GuitarBook }
\book { \ConcertBook }
\book { \TrumpetBook }
\book { \AltoBook }

I get the correct information in the output files, but the filenames are...

TestTag (alto).pdf
TestTag (alto)-1.pdf
TestTag (alto)-2.pdf
TestTag (alto)-3.pdf

...although the definition of GuitarBook includes '\bookOutputName TestTag
(gtr)', and so on for the other parts.

If I switch the order around...

\book { \AltoBook }
\book { \GuitarBook }
\book { \ConcertBook }
\book { \TrumpetBook }

The names all include (alto), as before, but the contents are

TestTag (alto).pdf  - Alto Part
TestTag (alto)-1.pdf   - Guitar Part
TestTag (alto)-2.pdf   - Concert Part
TestTag (alto)-3.pdf   - Trumpet Part

It looks as though \bookOutputName is treated as a global variable, even
though it's defined inside a \book {} which is itself defined within a
variable's assignment statement.

-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33357401.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread Michael Hendry

When I've finished a jazz chart, I'll want to produce separate parts for
several transposing instruments, but while I'm working on the entry of the
melody and chords in concert pitch I only need to produce one .pdf file.

Obviously, I can comment out the sections I don't want during data entry
work, and remove the comments once the work is complete, but it would be
handy to be able to use a C-like construct like this:


#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

to suppress unwanted output for the Alto sax part (and those for the other
transposing instruments), and comment out the #DEFINE NotYet when I'm happy
with the data entry.


-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33346188.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread Helge Kruse

Am 18.02.2012 00:30, schrieb Michael Hendry:


Obviously, I can comment out the sections I don't want during data entry
work, and remove the comments once the work is complete, but it would be
handy to be able to use a C-like construct like this:


#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
What about block comment? I can't see why editing the file to change 
#DEFINE is preferred to editing the file to change the block comment.


%{
\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}
 }
%}

Helge

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread David Kastrup
Michael Hendry hendry.mich...@gmail.com writes:

 When I've finished a jazz chart, I'll want to produce separate parts
 for several transposing instruments, but while I'm working on the
 entry of the melody and chords in concert pitch I only need to produce
 one .pdf file. Obviously, I can comment out the sections I don't want
 during data entry work, and remove the comments once the work is
 complete, but it would be handy to be able to use a C-like construct
 like this: #DEFINE NotYet ... #IFNDEF NotYet \book { \bookOutputName
 Chez Fernand (alto) \new Score  \header {piece = Alto Sax} }
 #ENDIF to suppress unwanted output for the Alto sax part (and those
 for the other transposing instruments), and comment out the #DEFINE
 NotYet when I'm happy with the data entry. 

Uh, you know about block comments?  %{ ... %} ?

You can also just say
saxoPart = { ... }

and then either use or not use \saxoPart.  And then there are tags as
well (look them up in the manual).

-- 
David Kastrup


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread Michael Hendry



Helge Kruse-2 wrote:
 
 Am 18.02.2012 00:30, schrieb Michael Hendry:

 Obviously, I can comment out the sections I don't want during data entry
 work, and remove the comments once the work is complete, but it would be
 handy to be able to use a C-like construct like this:


 #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
 What about block comment? I can't see why editing the file to change 
 #DEFINE is preferred to editing the file to change the block comment.
 
 %{
 \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}
   }
 %}
 
 Helge
 
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 https://lists.gnu.org/mailman/listinfo/lilypond-user
 
 


Thanks for your comment, Helge. 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

... and so on ...

Of course, for lilypond I'd be using the process in reverse - leaving out
known-to-function bits of code while concentrating on other bits - and it's
good practice not to keep commenting out and commenting in - there's always
the risk of accidentally removing a crucial character, or getting the
bracketing wrong.

I know I'll be accused of laziness, but I'd like to be able to concentrate
on the music, and be able to develop reliable blocks of supporting code I
can incorporate in any piece - in this instance I'd have to use a variable
in place of Chez Fernand to make the code more portable, it could then be
brought in using \include wherever I wanted it.

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.

I'd previously had a look at tags in Lilypond, but couldn't see how to apply
them cleanly in this context.

-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33351266.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread Patrick Karl

 
 Message: 1
 Date: Sun, 19 Feb 2012 09:58:23 +0100
 From: Helge Kruse helge.kruse-nos...@gmx.net
 To: lilypond-user@gnu.org
 Subject: Re: Is there an equivalent of #define ... #ifndef ... #endif
   in  lilypond?
 Message-ID: 4f40b9af.5040...@gmx.net
 Content-Type: text/plain; charset=ISO-8859-1; format=flowed
 
 Am 18.02.2012 00:30, schrieb Michael Hendry:
 
 Obviously, I can comment out the sections I don't want during data entry
 work, and remove the comments once the work is complete, but it would be
 handy to be able to use a C-like construct like this:
 
 
 #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
 What about block comment? I can't see why editing the file to change 
 #DEFINE is preferred to editing the file to change the block comment.
 
 %{
 \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}
  }
 %}
 
 Helge

What would you do if the block to be commented out already contained block 
comments?


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread Saul Tobin
Have you thought about how to use tags for this?

Saul

On Friday, February 17, 2012 03:30:51 PM Michael Hendry wrote:
 Obviously, I can comment out the sections I don't want during data entry
 work, and remove the comments once the work is complete, but it would be
 handy to be able to use a C-like construct like this:
 
 
 #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
 
 to suppress unwanted output for the Alto sax part (and those for the other
 transposing instruments), and comment out the #DEFINE NotYet when I'm happy
 with the data entry.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread Michael Hendry



Shevek wrote:
 
 Have you thought about how to use tags for this?
 
 Saul
 
 On Friday, February 17, 2012 03:30:51 PM Michael Hendry wrote:
 Obviously, I can comment out the sections I don't want during data entry
 work, and remove the comments once the work is complete, but it would be
 handy to be able to use a C-like construct like this:
 
 
 #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
 
 to suppress unwanted output for the Alto sax part (and those for the
 other
 transposing instruments), and comment out the #DEFINE NotYet when I'm
 happy
 with the data entry.
 
 ___
 lilypond-user mailing list
 lilypond-user@gnu.org
 https://lists.gnu.org/mailman/listinfo/lilypond-user
 
 

Thanks, Saul.

As I said earlier, I'd had a look at tags, but didn't think I could make a
tag do the job. I'll have another look!

Michael

-- 
View this message in context: 
http://old.nabble.com/Is-there-an-equivalent-of--define-...--ifndef-...--endif-in-lilypond--tp33346188p33354054.html
Sent from the Gnu - Lilypond - User mailing list archive at Nabble.com.


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread lilypond
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
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Is there an equivalent of #define ... #ifndef ... #endif in lilypond?

2012-02-19 Thread Helge Kruse

Am 19.02.2012 11:48, schrieb Michael Hendry:

 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

 ... and so on ...


 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

Ok, if you want to use the C preprocessor syntax, you can just use the C 
preprocessor. Add a short script the passes your source file through the 
C preprocessor to a temporary file and start Lilypond with that file.


If you just don't have your C compiler at the PC you can use a 
preprocessor implementation like this: http://mcpp.sourceforge.net/



Helge

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user