diff options
| author | hallgren <hallgren@chalmers.se> | 2015-06-23 12:58:14 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2015-06-23 12:58:14 +0000 |
| commit | 22ba8d34ff00bde6aa83dc9bdcdd13de34799c08 (patch) | |
| tree | ab5299500cccec4d7fe3ea56852327e4c8e059a3 /src/runtime | |
| parent | 984c09923ce5de629f111584f741b44c5e5eddd6 (diff) | |
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".
Diffstat (limited to 'src/runtime')
| -rw-r--r-- | src/runtime/haskell/PGF/Binary.hs | 15 |
1 files changed, 9 insertions, 6 deletions
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
|
