diff options
| author | hallgren <hallgren@chalmers.se> | 2013-12-17 13:27:37 +0000 |
|---|---|---|
| committer | hallgren <hallgren@chalmers.se> | 2013-12-17 13:27:37 +0000 |
| commit | e0481e3b8a8b6de306cff4c0645c6d19ae443e9a (patch) | |
| tree | 856507459c7afe19a355477cd96009939fc32eb9 /src/runtime/haskell/PGF/Binary.hs | |
| parent | 2b16962835af120a332c5e54c3465a0d02e9b668 (diff) | |
Add backward compatibility for reading old PGF files
Some backwards incompatible changes were made to the PGF file format after
the release of GF 3.5. This patch adds a module for reading PGF files in the
old format.
This means that old PGF files on the grammaticalframework.org server will
continue to work after we install the latest version of GF.
Diffstat (limited to 'src/runtime/haskell/PGF/Binary.hs')
| -rw-r--r-- | src/runtime/haskell/PGF/Binary.hs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/runtime/haskell/PGF/Binary.hs b/src/runtime/haskell/PGF/Binary.hs index e2403809e..4d4c53102 100644 --- a/src/runtime/haskell/PGF/Binary.hs +++ b/src/runtime/haskell/PGF/Binary.hs @@ -1,8 +1,9 @@ -module PGF.Binary where
+module PGF.Binary(putSplitAbs) where
import PGF.CId
import PGF.Data
import PGF.Optimize
+import qualified PGF.OldBinary as Old
import Data.Binary
import Data.Binary.Put
import Data.Binary.Get
@@ -14,7 +15,7 @@ import qualified Data.IntMap as IntMap import Control.Monad
pgfMajorVersion, pgfMinorVersion :: Word16
-(pgfMajorVersion, pgfMinorVersion) = (2,0)
+version@(pgfMajorVersion, pgfMinorVersion) = (2,0)
instance Binary PGF where
put pgf = do putWord16be pgfMajorVersion
@@ -24,7 +25,11 @@ instance Binary PGF where put (concretes pgf)
get = do v1 <- getWord16be
v2 <- getWord16be
- gflags <- get
+ case (v1,v2) of
+ v | v==version -> getPGF'
+ | v==Old.version -> Old.getPGF'
+
+getPGF'=do gflags <- get
(absname,abstract) <- get
concretes <- get
return $ updateProductionIndices $
|
