From 4767df468545da224698ec3e807b7adf278aad57 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 14 Dec 2006 15:27:47 +0100 Subject: [PATCH] cleanup version error messages. Fixes #133 --- ...pond-input-version.hh => lilypond-version.hh} | 0 lily/lexer.ll | 16 +++++++++++----- lily/lilypond-version.cc | 2 +- lily/parser.yy | 1 - 4 files changed, 12 insertions(+), 7 deletions(-) rename lily/include/{lilypond-input-version.hh => lilypond-version.hh} (100%) diff --git a/lily/include/lilypond-input-version.hh b/lily/include/lilypond-version.hh similarity index 100% rename from lily/include/lilypond-input-version.hh rename to lily/include/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" -- 2.39.5