[project @ 1998-11-11 17:40:07 by sof]
authorsof <unknown>
Wed, 11 Nov 1998 17:40:16 +0000 (17:40 +0000)
committersof <unknown>
Wed, 11 Nov 1998 17:40:16 +0000 (17:40 +0000)
Fixed endian bug that struck when outputting on non-buffered handles

ghc/lib/std/IO.lhs
ghc/lib/std/PrelHandle.lhs
ghc/lib/std/cbits/fileLookAhead.lc
ghc/lib/std/cbits/filePutc.lc
ghc/lib/std/cbits/stgio.h

index 0baa75a..5c8c9fb 100644 (file)
@@ -329,7 +329,7 @@ hPutChar :: Handle -> Char -> IO ()
 hPutChar handle c = do
     handle_  <- wantWriteableHandle "hPutChar" handle
     let fo = haFO__ handle_
-    rc       <- mayBlock fo (_ccall_ filePutc fo (ord c))   -- ConcHask: UNSAFE, may block.
+    rc       <- mayBlock fo (_ccall_ filePutc fo c)   -- ConcHask: UNSAFE, may block.
     writeHandle handle handle_
     if rc == 0
      then return ()
@@ -472,7 +472,7 @@ writeChars :: Addr -> String -> IO ()
 #endif
 writeChars fo "" = return ()
 writeChars fo (c:cs) = do
-  rc <- mayBlock fo (_ccall_ filePutc fo (ord c))   -- ConcHask: UNSAFE, may block.
+  rc <- mayBlock fo (_ccall_ filePutc fo c)   -- ConcHask: UNSAFE, may block.
   if rc == 0 
    then writeChars fo cs
    else constructErrorAndFail "writeChars"
index 6d7a6c9..91ae3df 100644 (file)
@@ -791,7 +791,7 @@ pushback. (For unbuffered channels, the (default) push-back limit is
 hUngetChar :: Handle -> Char -> IO ()
 hUngetChar handle c = do
     handle_ <- wantReadableHandle "hLookAhead" handle
-    rc      <- _ccall_ ungetChar (haFO__ handle_) (ord c)  -- ConcHask: SAFE, won't block
+    rc      <- _ccall_ ungetChar (haFO__ handle_) c  -- ConcHask: SAFE, won't block
     writeHandle handle handle_
     if rc == (-1)
      then constructErrorAndFail "hUngetChar"
index d6bb13b..9be19ce 100644 (file)
@@ -35,7 +35,7 @@ StgForeignObj ptr;
          return c;
     }
 
-    rc = ungetChar(ptr,c);
+    rc = ungetChar(ptr,(char)c);
     if ( rc < 0 ) {
        return rc;
     } else {
@@ -46,7 +46,7 @@ StgForeignObj ptr;
 StgInt
 ungetChar(ptr,c)
 StgForeignObj ptr;
-StgInt c;
+StgChar c;
 {
   IOFileObject* fo = (IOFileObject*)ptr;
   int rc = 0, sz = 0;
index b914cc6..a6ebf3d 100644 (file)
@@ -14,7 +14,7 @@
 StgInt
 filePutc(ptr, c)
 StgForeignObj ptr;
-StgInt c;
+StgChar c;
 {
     IOFileObject* fo = (IOFileObject*)ptr;
     int rc = 0;
index 1a2071f..2bce94b 100644 (file)
@@ -53,7 +53,7 @@ StgInt        fileGetc PROTO((StgForeignObj));
 
 /* fileLookAhead.lc */
 StgInt fileLookAhead PROTO((StgForeignObj));
-StgInt ungetChar PROTO((StgForeignObj,StgInt));
+StgInt ungetChar PROTO((StgForeignObj,StgChar));
 
 /* fileObject.lc */
 void    setBufFlags PROTO((StgForeignObj, StgInt));
@@ -81,7 +81,7 @@ StgInt        getFilePosn PROTO((StgForeignObj));
 StgInt setFilePosn PROTO((StgForeignObj, StgInt));
 
 /* filePutc.lc */
-StgInt filePutc    PROTO((StgForeignObj, StgInt));
+StgInt filePutc    PROTO((StgForeignObj, StgChar));
 
 /* fileSize.lc */
 StgInt fileSize    PROTO((StgForeignObj, StgByteArray));