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".
This commit is contained in:
hallgren
2015-06-23 12:58:14 +00:00
parent 984c09923c
commit 22ba8d34ff
4 changed files with 35 additions and 37 deletions

View File

@@ -9,7 +9,7 @@ import qualified GF.System.Directory as D
import GF.System.Catch(catch,try)
import Data.List(nub,isPrefixOf,intercalate,partition)
import qualified Data.Map as M
import GF.Compile.ReadFiles(getOptionsFromFile,findFile,gfImports,gfoImports)
import GF.Compile.ReadFiles(getOptionsFromFile,findFile,gfImports,gfoImports,VersionTagged(..))
import GF.CompileOne(reuseGFO,useTheSource)
import GF.Infra.Option
import GF.Infra.UseIO
@@ -177,8 +177,10 @@ getPathFromFile lib_dir cmdline_opts file =
getImports opts file =
if isGFO file then gfoImports' file else gfImports opts file
where
gfoImports' file = maybe bad return =<< gfoImports file
where bad = raise $ file++": bad .gfo file"
gfoImports' file = check =<< gfoImports file
where
check (Tagged imps) = return imps
check WrongVersion = raise $ file++": .gfo file version mismatch"
relativeTo lib_dir cwd path =
if length librel<length cwdrel then librel else cwdrel