projects
/
ghc-hetmet.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[project @ 2002-12-12 13:21:46 by ross]
[ghc-hetmet.git]
/
ghc
/
compiler
/
utils
/
Binary.hs
diff --git
a/ghc/compiler/utils/Binary.hs
b/ghc/compiler/utils/Binary.hs
index
b67baeb
..
2414067
100644
(file)
--- a/
ghc/compiler/utils/Binary.hs
+++ b/
ghc/compiler/utils/Binary.hs
@@
-48,6
+48,7
@@
module Binary
) where
) where
+#include "HsVersions.h"
#include "MachDeps.h"
import {-# SOURCE #-} Module
#include "MachDeps.h"
import {-# SOURCE #-} Module
@@
-58,10
+59,10
@@
import UniqFM
import FastMutInt
#if __GLASGOW_HASKELL__ < 503
import FastMutInt
#if __GLASGOW_HASKELL__ < 503
-import IOExts
-import Bits
-import Int
-import Word
+import DATA_IOREF
+import DATA_BITS
+import DATA_INT
+import DATA_WORD
import Char
import Monad
import Exception
import Char
import Monad
import Exception
@@
-85,7
+86,7
@@
import Data.IORef
import Data.Char ( ord, chr )
import Data.Array.Base ( unsafeRead, unsafeWrite )
import Control.Monad ( when )
import Data.Char ( ord, chr )
import Data.Array.Base ( unsafeRead, unsafeWrite )
import Control.Monad ( when )
-import Control.Exception ( throw, throwDyn )
+import Control.Exception ( throwDyn )
import System.IO as IO
import System.IO.Unsafe ( unsafeInterleaveIO )
import System.IO.Error ( mkIOError, eofErrorType )
import System.IO as IO
import System.IO.Unsafe ( unsafeInterleaveIO )
import System.IO.Error ( mkIOError, eofErrorType )
@@
-227,8
+228,8
@@
writeBinMem (BinMem _ ix_r sz_r arr_r) fn = do
arr <- readIORef arr_r
ix <- readFastMutInt ix_r
hPutArray h arr ix
arr <- readIORef arr_r
ix <- readFastMutInt ix_r
hPutArray h arr ix
-#if __GLASGOW_HASKELL__ < 500
- -- workaround a bug in ghc 4.08's implementation of hPutBuf (it doesn't
+#if __GLASGOW_HASKELL__ <= 500
+ -- workaround a bug in old implementation of hPutBuf (it doesn't
-- set the FILEOBJ_RW_WRITTEN flag on the file object, so the file doens't
-- get flushed properly). Adding an extra '\0' doens't do any harm.
hPutChar h '\0'
-- set the FILEOBJ_RW_WRITTEN flag on the file object, so the file doens't
-- get flushed properly). Adding an extra '\0' doens't do any harm.
hPutChar h '\0'
@@
-263,7
+264,9
@@
expandBin (BinMem _ ix_r sz_r arr_r) off = do
| i <- [ 0 .. sz-1 ] ]
writeFastMutInt sz_r sz'
writeIORef arr_r arr'
| i <- [ 0 .. sz-1 ] ]
writeFastMutInt sz_r sz'
writeIORef arr_r arr'
- hPutStrLn stderr ("expanding to size: " ++ show sz')
+#ifdef DEBUG
+ hPutStrLn stderr ("Binary: expanding to size: " ++ show sz')
+#endif
return ()
expandBin (BinIO _ _ _) _ = return ()
-- no need to expand a file, we'll assume they expand by themselves.
return ()
expandBin (BinIO _ _ _) _ = return ()
-- no need to expand a file, we'll assume they expand by themselves.
@@
-294,7
+297,7
@@
getWord8 (BinMem _ ix_r sz_r arr_r) = do
ix <- readFastMutInt ix_r
sz <- readFastMutInt sz_r
when (ix >= sz) $
ix <- readFastMutInt ix_r
sz <- readFastMutInt sz_r
when (ix >= sz) $
- throw (mkIOError eofErrorType "Data.Binary.getWord8" Nothing Nothing)
+ ioError (mkIOError eofErrorType "Data.Binary.getWord8" Nothing Nothing)
arr <- readIORef arr_r
w <- unsafeRead arr ix
writeFastMutInt ix_r (ix+1)
arr <- readIORef arr_r
w <- unsafeRead arr ix
writeFastMutInt ix_r (ix+1)
@@
-688,4
+691,4
@@
instance Binary FastString where
get bh = do
j <- get bh
get bh = do
j <- get bh
- case getUserData bh of (_, _, _, arr) -> return (arr ! j)
+ case getUserData bh of (_, _, _, arr) -> return $! (arr ! j)