From 22ba8d34ff00bde6aa83dc9bdcdd13de34799c08 Mon Sep 17 00:00:00 2001 From: hallgren Date: Tue, 23 Jun 2015 12:58:14 +0000 Subject: Bump version of .gfo and .pgf files, improve error messages on version mismatch Becacuse of the new special tokens added to the Symbol type, .gfo and .pgf files produced with the current version of GF can not always be used with older versions of GF and the PGF run-time system. The PGF version number was increased from (2,0) to (2,1). GF can still read version (2,0) and (1,0), so old PGF files continue to work. The GFO version was increased from "GF03" to "GF04". --- src/runtime/haskell/PGF/Binary.hs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'src/runtime/haskell') diff --git a/src/runtime/haskell/PGF/Binary.hs b/src/runtime/haskell/PGF/Binary.hs index a7f6bf881..e0e50f4be 100644 --- a/src/runtime/haskell/PGF/Binary.hs +++ b/src/runtime/haskell/PGF/Binary.hs @@ -15,7 +15,7 @@ import qualified Data.IntMap as IntMap import Control.Monad pgfMajorVersion, pgfMinorVersion :: Word16 -version@(pgfMajorVersion, pgfMinorVersion) = (2,0) +version@(pgfMajorVersion, pgfMinorVersion) = (2,1) instance Binary PGF where put pgf = do putWord16be pgfMajorVersion @@ -23,11 +23,14 @@ instance Binary PGF where put (gflags pgf) put (absname pgf, abstract pgf) put (concretes pgf) - get = do v1 <- getWord16be - v2 <- getWord16be - case (v1,v2) of - v | v==version -> getPGF' - | v==Old.version -> Old.getPGF' + get = do major<- getWord16be + minor <- getWord16be + let v = (major,minor) + if major==pgfMajorVersion && minor<=pgfMinorVersion + then getPGF' + else if v==Old.version + then Old.getPGF' + else fail $ "Unsupported PGF version "++show (major,minor) getPGF'=do gflags <- get (absname,abstract) <- get -- cgit v1.2.3