[project @ 1999-12-03 18:17:29 by lewie]
[ghc-hetmet.git] / ghc / compiler / utils / StringBuffer.lhs
index 2b22939..115d36c 100644 (file)
@@ -72,7 +72,7 @@ import ST
 import Char            ( chr )
 
 -- urk!
-#include "../lib/std/cbits/error.h"
+#include "../lib/std/cbits/stgerror.h"
 
 #if __GLASGOW_HASKELL__ >= 303
 import IO              ( openFile, slurpFile )
@@ -85,7 +85,8 @@ import Addr
 #endif
 
 #if __GLASGOW_HASKELL__ < 301
-import IOBase          ( IOError(..), IOErrorType(..) )
+import IOBase          ( Handle, IOError(..), IOErrorType(..),
+                         constructErrorAndFail )
 import IOHandle                ( readHandle, writeHandle, filePtr )
 import PackBase        ( unpackCStringBA )
 #else
@@ -212,7 +213,10 @@ slurpFileExpandTabs fname = do
 
 trySlurp :: Handle -> Int -> Addr -> IO (Addr, Int)
 trySlurp handle sz_i chunk =
-#if __GLASGOW_HASKELL__ >= 303
+#if __GLASGOW_HASKELL__ == 303
+  wantReadableHandle "hGetChar" handle >>= \ handle_ ->
+  let fo = haFO__ handle_ in
+#elif __GLASGOW_HASKELL__ > 303
   wantReadableHandle "hGetChar" handle $ \ handle_ ->
   let fo = haFO__ handle_ in
 #else
@@ -276,10 +280,10 @@ reAllocMem :: Addr -> Int -> IO Addr
 reAllocMem ptr sz = do
    chunk <- _ccall_ realloc ptr sz
    if chunk == nullAddr 
-#if __GLASGOW_HASKELL__ < 303
-      then fail (userError "reAllocMem")
-#else
+#if __GLASGOW_HASKELL__ >= 400
       then fail "reAllocMem"
+#else
+      then fail (userError "reAllocMem")
 #endif
       else return chunk