]> git.donarmstrong.com Git - lilypond.git/commitdiff
cleanup version error messages. Fixes #133
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 14 Dec 2006 14:27:47 +0000 (15:27 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 14 Dec 2006 14:27:47 +0000 (15:27 +0100)
lily/include/lilypond-input-version.hh [deleted file]
lily/include/lilypond-version.hh [new file with mode: 0644]
lily/lexer.ll
lily/lilypond-version.cc
lily/parser.yy

diff --git a/lily/include/lilypond-input-version.hh b/lily/include/lilypond-input-version.hh
deleted file mode 100644 (file)
index 12c4782..0000000
+++ /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 <janneke@gnu.org>
-*/
-
-#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 (file)
index 0000000..12c4782
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+  lilypond-version.hh -- declare LilyPond_version
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1998--2006 Jan Nieuwenhuizen <janneke@gnu.org>
+*/
+
+#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
index 8bf851eea4b5e3a63cb2b240bfb9682674ff9ccf..9cb2cac0c667baae3b1f24a893ab34acaaf3032b 100644 (file)
@@ -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;
 }
        
index c9c055922576d1ce345b7ac34c8c169861686bb6..21ca2e5212cadbed5bab65db906ab2b9f284cd61 100644 (file)
@@ -8,7 +8,7 @@
 
 #include <ctype.h>
 
-#include "lilypond-input-version.hh"
+#include "lilypond-version.hh"
 #include "string-convert.hh"
 #include "misc.hh"
 
index a075649481aafbdf6eba2f3bbc09d8d2e515bc64..64d6103d44d51dff51dd7900ed4100c4551802c5 100644 (file)
@@ -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"