aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordavve <davve@dtek.chalmers.se>2007-02-05 00:12:23 +0000
committerdavve <davve@dtek.chalmers.se>2007-02-05 00:12:23 +0000
commit953d1fa77925a695311670e86b2f6cf27e00454c (patch)
treec502a1a6b13d33abc11cd50c07c43169d2e8041f /src
parentb07ed2188bb5f5824d27ee821b3d6e2549618963 (diff)
Solve conflicts
Diffstat (limited to 'src')
-rw-r--r--src/Main.hs16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/Main.hs b/src/Main.hs
index db6b0775..1539316a 100644
--- a/src/Main.hs
+++ b/src/Main.hs
@@ -455,8 +455,7 @@ run flags modules extEnv = do
case [str | Flag_DumpInterface str <- flags] of
[] -> return ()
fs -> let filename = (last fs) in
- savePackageFile filename homeEnv
-
+ writePackageFile filename homeEnv
{-
instance Outputable (DocEntity Name) where
ppr (DocEntity d) = ppr d
@@ -1331,9 +1330,10 @@ packagesDocEnv packages = Map.unions (map pdDocEnv packages)
--------------------------------------------------------------------------------
packageFileMagic = 0xDA303001 :: Word32
+packageFileVersion = 0 :: Word16
-savePackageFile :: FilePath -> PackageEnv -> IO ()
-savePackageFile filename pkgEnv = do
+writePackageFile :: FilePath -> DocEnv -> IO ()
+writePackageFile filename pkgEnv = do
h <- openBinaryFile filename WriteMode
bh <- openBinIO h
@@ -1341,11 +1341,12 @@ savePackageFile filename pkgEnv = do
bh <- return $ setUserData bh ud
put_ bh packageFileMagic
+ put_ bh packageFileVersion
put_ bh (Map.toList pkgEnv)
hClose h
-loadPackageFile :: FilePath -> IO PackageEnv
-loadPackageFile filename = do
+readPackageFile :: FilePath -> IO DocEnv
+readPackageFile filename = do
h <- openBinaryFile filename ReadMode
bh <- openBinIO h
@@ -1355,6 +1356,7 @@ loadPackageFile filename = do
magic <- get bh
when (magic /= packageFileMagic) $ throwE $
"Magic number mismatch: couldn't load interface file: " ++ filename
-
+
+ (version :: Word16) <- get bh
envList <- get bh
return (Map.fromList envList)