diff options
author | Isaac Dupree <id@isaac.cedarswampstudios.org> | 2008-01-17 01:13:12 +0000 |
---|---|---|
committer | Isaac Dupree <id@isaac.cedarswampstudios.org> | 2008-01-17 01:13:12 +0000 |
commit | 206b4dec78250efef3cd927d64dc6cbc54a16c3d (patch) | |
tree | 5c922e32a60500a0935e4bf378bb0bdd7819fef0 /compiler/utils/BufWrite.hs | |
parent | 1286da96dc65faa5992a8a34c5b3bf29dfe2be04 (diff) | |
download | haskell-206b4dec78250efef3cd927d64dc6cbc54a16c3d.tar.gz |
lots of portability changes (#1405)
re-recording to avoid new conflicts was too hard, so I just put it
all in one big patch :-( (besides, some of the changes depended on
each other.) Here are what the component patches were:
Fri Dec 28 11:02:55 EST 2007 Isaac Dupree <id@isaac.cedarswampstudios.org>
* document BreakArray better
Fri Dec 28 11:39:22 EST 2007 Isaac Dupree <id@isaac.cedarswampstudios.org>
* properly ifdef BreakArray for GHCI
Fri Jan 4 13:50:41 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org>
* change ifs on __GLASGOW_HASKELL__ to account for... (#1405)
for it not being defined. I assume it being undefined implies
a compiler with relatively modern libraries but without most
unportable glasgow extensions.
Fri Jan 4 14:21:21 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org>
* MyEither-->EitherString to allow Haskell98 instance
Fri Jan 4 16:13:29 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org>
* re-portabilize Pretty, and corresponding changes
Fri Jan 4 17:19:55 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org>
* Augment FastTypes to be much more complete
Fri Jan 4 20:14:19 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org>
* use FastFunctions, cleanup FastString slightly
Fri Jan 4 21:00:22 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org>
* Massive de-"#", mostly Int# --> FastInt (#1405)
Fri Jan 4 21:02:49 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org>
* miscellaneous unnecessary-extension-removal
Sat Jan 5 19:30:13 EST 2008 Isaac Dupree <id@isaac.cedarswampstudios.org>
* add FastFunctions
Diffstat (limited to 'compiler/utils/BufWrite.hs')
-rw-r--r-- | compiler/utils/BufWrite.hs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/compiler/utils/BufWrite.hs b/compiler/utils/BufWrite.hs index d625a6e6c3..306413573f 100644 --- a/compiler/utils/BufWrite.hs +++ b/compiler/utils/BufWrite.hs @@ -23,6 +23,7 @@ module BufWrite ( #include "HsVersions.h" import FastString +import FastTypes import FastMutInt import Control.Monad ( when ) @@ -30,11 +31,6 @@ import Data.Char ( ord ) import Foreign import System.IO -import GHC.IOBase ( IO(..) ) -import GHC.Ptr ( Ptr(..) ) - -import GHC.Exts ( Int(..), Int#, Addr# ) - -- ----------------------------------------------------------------------------- data BufHandle = BufHandle {-#UNPACK#-}!(Ptr Word8) @@ -94,18 +90,18 @@ bPutFS b@(BufHandle buf r hdl) fs@(FastString _ len _ fp _) = copyBytes (buf `plusPtr` i) ptr len writeFastMutInt r (i+len) -bPutLitString :: BufHandle -> Addr# -> Int# -> IO () -bPutLitString b@(BufHandle buf r hdl) a# len# = do - let len = I# len# +bPutLitString :: BufHandle -> LitString -> FastInt -> IO () +bPutLitString b@(BufHandle buf r hdl) a len_ = a `seq` do + let len = iBox len_ i <- readFastMutInt r if (i+len) >= buf_size then do hPutBuf hdl buf i writeFastMutInt r 0 if (len >= buf_size) - then hPutBuf hdl (Ptr a#) len - else bPutLitString b a# len# + then hPutBuf hdl a len + else bPutLitString b a len_ else do - copyBytes (buf `plusPtr` i) (Ptr a#) len + copyBytes (buf `plusPtr` i) a len writeFastMutInt r (i+len) bFlush :: BufHandle -> IO () |