From: Han-Wen Nienhuys Date: Thu, 14 Dec 2006 14:27:47 +0000 (+0100) Subject: cleanup version error messages. Fixes #133 X-Git-Tag: release/2.11.3-1~22^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4767df468545da224698ec3e807b7adf278aad57;p=lilypond.git cleanup version error messages. Fixes #133 --- diff --git a/lily/include/lilypond-input-version.hh b/lily/include/lilypond-input-version.hh deleted file mode 100644 index 12c4782205..0000000000 --- a/lily/include/lilypond-input-version.hh +++ /dev/null @@ -1,30 +0,0 @@ -/* - lilypond-version.hh -- declare LilyPond_version - - source file of the GNU LilyPond music typesetter - - (c) 1998--2006 Jan Nieuwenhuizen -*/ - -#ifndef LILYPOND_VERSION_HH -#define LILYPOND_VERSION_HH - -#include "std-string.hh" - -struct Lilypond_version -{ - Lilypond_version (int major, int minor, int patch); - Lilypond_version (string str); - - string to_string () const; - operator int () const; - - int major_; - int minor_; - int patch_; - string extra_patch_string_; -}; - -extern Lilypond_version oldest_version; - -#endif // LILYPOND_VERSION_HH diff --git a/lily/include/lilypond-version.hh b/lily/include/lilypond-version.hh new file mode 100644 index 0000000000..12c4782205 --- /dev/null +++ b/lily/include/lilypond-version.hh @@ -0,0 +1,30 @@ +/* + lilypond-version.hh -- declare LilyPond_version + + source file of the GNU LilyPond music typesetter + + (c) 1998--2006 Jan Nieuwenhuizen +*/ + +#ifndef LILYPOND_VERSION_HH +#define LILYPOND_VERSION_HH + +#include "std-string.hh" + +struct Lilypond_version +{ + Lilypond_version (int major, int minor, int patch); + Lilypond_version (string str); + + string to_string () const; + operator int () const; + + int major_; + int minor_; + int patch_; + string extra_patch_string_; +}; + +extern Lilypond_version oldest_version; + +#endif // LILYPOND_VERSION_HH diff --git a/lily/lexer.ll b/lily/lexer.ll index 8bf851eea4..9cb2cac0c6 100644 --- a/lily/lexer.ll +++ b/lily/lexer.ll @@ -41,7 +41,7 @@ using namespace std; #include "interval.hh" #include "lily-guile.hh" #include "lily-lexer.hh" -#include "lilypond-input-version.hh" +#include "lilypond-version.hh" #include "main.hh" #include "music.hh" #include "music-function.hh" @@ -875,12 +875,18 @@ is_valid_version (string s) { Lilypond_version current ( MAJOR_VERSION "." MINOR_VERSION "." PATCH_LEVEL ); Lilypond_version ver (s); - if (! ((ver >= oldest_version) && (ver <= current))) + if (int (ver) < oldest_version) { - non_fatal_error (_f ("Incorrect lilypond version: %s (%s, %s)", ver.to_string (), oldest_version.to_string (), current.to_string ())); - non_fatal_error (_ ("Consider updating the input with the convert-ly script")); + non_fatal_error (_f ("file too old: %s (oldest supported: %s)", ver.to_string (), oldest_version.to_string ())); + non_fatal_error (_ ("consider updating the input with the convert-ly script")); return false; - } + } + + if (ver > current) + { + non_fatal_error (_f ("program too old: %s (file requires: %s)", current.to_string (), ver.to_string ())); + return false; + } return true; } diff --git a/lily/lilypond-version.cc b/lily/lilypond-version.cc index c9c0559225..21ca2e5212 100644 --- a/lily/lilypond-version.cc +++ b/lily/lilypond-version.cc @@ -8,7 +8,7 @@ #include -#include "lilypond-input-version.hh" +#include "lilypond-version.hh" #include "string-convert.hh" #include "misc.hh" diff --git a/lily/parser.yy b/lily/parser.yy index a075649481..64d6103d44 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -80,7 +80,6 @@ using namespace std; #include "lily-guile.hh" #include "lily-lexer.hh" #include "lily-parser.hh" -#include "lilypond-input-version.hh" #include "main.hh" #include "misc.hh" #include "music.hh"