Commit 30a35f3d authored by sewardj's avatar sewardj
Browse files

[project @ 2001-06-01 13:07:35 by sewardj]

Track recent changes to lib/std for mingw.  Mostly, make all seeked-on
file handles be in binary mode.
parent 4f3c6654
illegal operation
Action: hGetChar
Handle: {loc=<stdin>,type=semi-closed,buffering=block (8192)}
Handle: {loc=<stdin>,type=semi-closed,binary=False,buffering=block (8192)}
Reason: handle is closed
File: <stdin>
illegal operation
Action: hGetChar
Handle: {loc=<stdin>,type=semi-closed,buffering=block (8192)}
Handle: {loc=<stdin>,type=semi-closed,binary=False,buffering=block (8192)}
Reason: handle is closed
File: <stdin>
illegal operation
Action: hGetChar
Handle: {loc=<stdin>,type=semi-closed,buffering=block (512)}
Handle: {loc=<stdin>,type=semi-closed,binary=False,buffering=block (512)}
Reason: handle is closed
File: <stdin>
illegal operation
Action: hGetChar
Handle: {loc=<stdin>,type=semi-closed,buffering=block (512)}
Handle: {loc=<stdin>,type=semi-closed,binary=False,buffering=block (512)}
Reason: handle is closed
File: <stdin>
# -----------------------------------------------------------------------------
# $Id: Makefile,v 1.5 2001/05/31 10:32:28 sewardj Exp $
# $Id: Makefile,v 1.6 2001/06/01 13:07:36 sewardj Exp $
TOP = ../..
......@@ -17,7 +17,7 @@ hGetChar001_RUNTEST_OPTS += -i hGetChar001.stdin
openFile002_RUNTEST_OPTS += -x 1
IOError001_RUNTEST_OPTS += -i IOError001.hs -o1 IOError001.stdout-mingw
readwrite002_RUNTEST_OPTS += -i readwrite002.hs
hGetLine001_RUNTEST_OPTS += -i hGetLine001.hs
hGetLine001_RUNTEST_OPTS += -i hGetLine001.hs -o1 hGetLine001.stdout-mingw
hFileSize001_RUNTEST_OPTS += -o1 hFileSize001.stdout-mingw
hSeek004_RUNTEST_OPTS += -o1 hSeek004.stdout-mingw
......
......@@ -10,6 +10,8 @@ main = do
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
......
......@@ -10,6 +10,8 @@ main = do
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
......@@ -32,6 +34,8 @@ main = do
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
......@@ -54,6 +58,8 @@ main = do
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
......@@ -76,6 +82,8 @@ main = do
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
......
-- !!! testing hGetLine
import IO
-- one version of 'cat'
main = do
let loop h = do b <- hIsEOF h
if b then return ()
else do l <- hGetLine h; putStrLn l; loop h
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h LineBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h (BlockBuffering (Just 83))
loop h
-- !!! testing hGetLine
import IO
-- one version of 'cat'
main = do
let loop h = do b <- hIsEOF h
if b then return ()
else do l <- hGetLine h; putStrLn l; loop h
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h LineBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h (BlockBuffering (Just 83))
loop h
-- !!! testing hGetLine
import IO
-- one version of 'cat'
main = do
let loop h = do b <- hIsEOF h
if b then return ()
else do l <- hGetLine h; putStrLn l; loop h
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h LineBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h (BlockBuffering (Just 83))
loop h
-- !!! testing hGetLine
import IO
-- one version of 'cat'
main = do
let loop h = do b <- hIsEOF h
if b then return ()
else do l <- hGetLine h; putStrLn l; loop h
loop stdin
h <- openFile "hGetLine001.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h LineBuffering
loop h
hSeek h AbsoluteSeek 0
hSetBuffering h (BlockBuffering (Just 83))
loop h
......@@ -9,9 +9,11 @@ import Directory (removeFile, doesFileExist)
main = do
hIn <- openFile "hGetPosn001.in" ReadMode
hSetBinaryMode hIn True
f <- doesFileExist "hGetPosn001.out"
when f (removeFile "hGetPosn001.out")
hOut <- openFile "hGetPosn001.out" ReadWriteMode
hSetBinaryMode hOut True
bof <- hGetPosn hIn
copy hIn hOut
hSetPosn bof
......
......@@ -4,6 +4,7 @@ import IO
main = do
h <- openFile "hIsEOF002.hs" ReadMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
hSeek h SeekFromEnd 0
hIsEOF h >>= print
......@@ -38,6 +39,7 @@ main = do
hClose h
h <- openFile "hIsEOF002.out" ReadWriteMode
hSetBinaryMode h True
hSetBuffering h NoBuffering
hSeek h SeekFromEnd 0
hIsEOF h >>= print
......
......@@ -7,5 +7,6 @@ import IO
main = do
h <- openFile "hReady001.hs" ReadMode
hSetBinaryMode h True
hSeek h SeekFromEnd 0
hReady h >>= print
......@@ -4,6 +4,7 @@ import IO
main = do
h <- openFile "hSeek001.in" ReadMode
hSetBinaryMode h True
True <- hIsSeekable h
hSeek h SeekFromEnd (-1)
z <- hGetChar h
......
......@@ -7,6 +7,7 @@ import Directory ( removeFile )
main :: IO ()
main = do
hdl <- openFile "hSeek002.hs" ReadMode
hSetBinaryMode hdl True
flg <- hIsEOF hdl
print flg
hSeek hdl SeekFromEnd 0
......
......@@ -15,6 +15,7 @@ bmo_ls = [NoBuffering, LineBuffering, BlockBuffering Nothing,
main = do
hdl <- openFile "hSeek003.hs" ReadMode
hSetBinaryMode hdl True
sequence (zipWith testPosns (repeat hdl) bmo_ls)
hClose hdl
......
......@@ -4,4 +4,5 @@ import IO
main = do
h <- openFile "hSeek004.out" AppendMode
hSetBinaryMode h True
try (hSeek h AbsoluteSeek 0) >>= print
Left illegal operation
Action: hSeek
Handle: {loc=hSeek004.out,type=writable (append),buffering=block (8192)}
Handle: {loc=hSeek004.out,type=writable (append),binary=True,buffering=block (8192)}
Reason: handle is not seekable
File: hSeek004.out
Left illegal operation
Action: hSeek
Handle: {loc=hSeek004.out,type=writable (append),buffering=block (512)}
Handle: {loc=hSeek004.out,type=writable (append),binary=True,buffering=block (512)}
Reason: handle is not seekable
File: hSeek004.out
......@@ -5,6 +5,7 @@ import Maybe
main = do
h <- openFile "ioeGetErrorString001.hs" ReadMode
hSetBinaryMode h True
hSeek h SeekFromEnd 0
(hGetChar h >> return ()) `catch`
\e -> if isEOFError e
......
......@@ -4,6 +4,7 @@ import IO
main = do
h <- openFile "ioeGetFileName001.hs" ReadMode
hSetBinaryMode h True
hSeek h SeekFromEnd 0
(hGetChar h >> return ()) `catch`
\e -> if isEOFError e
......
......@@ -5,6 +5,7 @@ import Maybe
main = do
h <- openFile "ioeGetHandle001.hs" ReadMode
hSetBinaryMode h True
hSeek h SeekFromEnd 0
(hGetChar h >> return ()) `catch`
\e -> if isEOFError e && fromJust (ioeGetHandle e) == h
......
......@@ -9,6 +9,7 @@ main = do
f <- doesFileExist "readwrite001.inout"
when f (removeFile "readwrite001.inout")
hdl <- openFile "readwrite001.inout" ReadWriteMode
hSetBinaryMode hdl True
hSetBuffering hdl LineBuffering
hPutStr hdl "as"
hSeek hdl AbsoluteSeek 0
......
......@@ -11,7 +11,7 @@ main = do
f <- doesFileExist username
when f (removeFile username)
cd <- openFile username ReadWriteMode
-- hSetBinaryMode cd True
hSetBinaryMode cd True
hSetBuffering stdin NoBuffering
hSetBuffering stdout NoBuffering
hSetBuffering cd NoBuffering
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment