Commit 40ed1f2f authored by sof's avatar sof
Browse files

[project @ 2002-07-23 15:27:27 by sof]

mingw32/win32: tweak back to life
parent 6aae1976
......@@ -2,7 +2,7 @@
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
-- one version of 'cat'
......@@ -15,6 +15,7 @@ main = do
h <- openFile "hGetLine001.hs" ReadMode
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
......
......@@ -2,7 +2,7 @@
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
-- one version of 'cat'
......@@ -15,6 +15,7 @@ main = do
h <- openFile "hGetLine001.hs" ReadMode
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
......@@ -32,7 +33,7 @@ main = do
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
-- one version of 'cat'
......@@ -45,6 +46,7 @@ main = do
h <- openFile "hGetLine001.hs" ReadMode
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
......@@ -62,7 +64,7 @@ main = do
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
-- one version of 'cat'
......@@ -75,6 +77,7 @@ main = do
h <- openFile "hGetLine001.hs" ReadMode
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
......@@ -92,7 +95,7 @@ main = do
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
-- one version of 'cat'
......@@ -105,6 +108,7 @@ main = do
h <- openFile "hGetLine001.hs" ReadMode
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
......
......@@ -2,7 +2,7 @@
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
-- one version of 'cat'
......@@ -15,6 +15,100 @@ main = do
h <- openFile "hGetLine001.hs" ReadMode
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
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
#ifdef i386_unknown_mingw32
import GHC.Handle(hSetBinaryMode)
#endif
-- 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
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
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
#ifdef i386_unknown_mingw32
import GHC.Handle(hSetBinaryMode)
#endif
-- 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
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
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
#ifdef i386_unknown_mingw32
import GHC.Handle(hSetBinaryMode)
#endif
-- 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
#ifdef i386_unknown_mingw32
hSetBinaryMode stdout True
hSetBinaryMode h True
#endif
......@@ -28,93 +122,3 @@ main = do
hSeek h AbsoluteSeek 0
hSetBuffering h (BlockBuffering (Just 83))
loop h
-- !!! testing hGetLine
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
#endif
-- 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
#ifdef i386_unknown_mingw32
hSetBinaryMode h True
#endif
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
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
#endif
-- 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
#ifdef i386_unknown_mingw32
hSetBinaryMode h True
#endif
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
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
#endif
-- 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
#ifdef i386_unknown_mingw32
hSetBinaryMode h True
#endif
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
......@@ -10,6 +10,7 @@ import IO
main = catch loop (\e -> print e)
loop = do
hSetBuffering stdin LineBuffering
l <- hGetLine stdin
putStrLn l
loop
this line doesn't end with a newline
end of file
Action: hGetLine
Handle: {loc=<stdin>,type=readable,binary=False,buffering=block (8192)}
Handle: {loc=<stdin>,type=readable,binary=False,buffering=line}
File: <stdin>
......@@ -6,7 +6,7 @@ import IO
import Monad
import Directory (removeFile, doesFileExist)
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main = do
......@@ -17,15 +17,18 @@ main = do
f <- doesFileExist "hGetPosn001.out"
when f (removeFile "hGetPosn001.out")
hOut <- openFile "hGetPosn001.out" ReadWriteMode
#ifdef i386_unknown_mingw32
hSetBinaryMode hOut True
#endif
bof <- hGetPosn hIn
putStrLn (show bof) -- you can show HandlePosns
copy hIn hOut
hSetPosn bof
copy hIn hOut
#ifdef i386_unknown_mingw32
hSetBinaryMode hOut True
#endif
hSeek hOut AbsoluteSeek 0
#ifdef i386_unknown_mingw32
hSetBinaryMode hOut False
#endif
stuff <- hGetContents hOut
putStr stuff
......
123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
1 2 3 4 5 6 7
123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
1 2 3 4 5 6 7
{loc=hGetPosn001.in,type=readable,binary=True,buffering=block (512)} at position 0
123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
1 2 3 4 5 6 7
123456789*123456789*123456789*123456789*123456789*123456789*123456789*12
1 2 3 4 5 6 7
......@@ -2,7 +2,7 @@
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main = do
......
......@@ -5,7 +5,7 @@
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main = do
......
......@@ -5,7 +5,7 @@ module Main(main) where
import IO
import Directory ( removeFile )
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main :: IO ()
......
......@@ -5,7 +5,7 @@ module Main(main) where
import IO
import Monad ( sequence )
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
testPosns :: Handle -> BufferMode -> IO ()
......
......@@ -2,7 +2,7 @@
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main = do
......
......@@ -3,7 +3,7 @@
import IO
import Maybe
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main = do
......
......@@ -2,7 +2,7 @@
import IO
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main = do
......
......@@ -3,7 +3,7 @@
import IO
import Maybe
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main = do
......
......@@ -6,7 +6,7 @@ import IO
import Directory ( removeFile, doesFileExist )
import Monad
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
main = do
......
......@@ -4,7 +4,7 @@ import IO
import Directory (removeFile, doesFileExist)
import Monad
#ifdef i386_unknown_mingw32
import PrelHandle(hSetBinaryMode)
import GHC.Handle(hSetBinaryMode)
#endif
-- This test is weird, full marks to whoever dreamt it up!
......
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