Hi Urs,

On 09/01/14 11:01, Urs Liska wrote:
> Is there already a clean way to let LilyPond/Scheme code be executed
> depending on the version number of the currently executed LilyPond?
> 
> If not, would it be useful/acceptable to include something like
> https://github.com/openlilylib/snippets/blob/master/general-tools/lilypond-version-predicates/definitions.ily
> 
> 
> into LilyPond?
> 
> That makes possible to write something like
> 
> (if (lilypond-greater-than? '(2 16 0)) ... )
> 
Compare with scheme variable lilypond-version:

ian@nanny-ogg ~/src/lilypond (master)$ lilypond ly/scheme-sandbox.ly
GNU LilyPond 2.18.0
Processing `ly/scheme-sandbox.ly'
Parsing...
guile> (lilypond-version)
"2.18.0"
guile> (quit)

Success: compilation successfully completed
ian@nanny-ogg ~/src/lilypond (master)$
You could probably write some stuff to parse out the major-version and
minor-version fields e.g.
guile> (define ly-major-version (substring (lilypond-version) 0 1))

guile> ly-major-version
"2"
guile> (define ly-minor-version (substring (lilypond-version) 2 4))
guile> ly-minor-version
"18"
guile> (define ly-update-version (substring (lilypond-version) 5
(string-length (lilypond-version))))
guile> ly-update-version
"0"
guile> (quit 0)

Success: compilation successfully completed
ian@nanny-ogg ~/src/lilypond (master)$

... and play with those.

HTH
Cheers,

Ian



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to