cvs commit: fptools/ghc/compiler/prelude PrelNames.lhs fptools/ghc/lib/std
PrelHandle.hsc PrelIO.hsc PrelPosix.hsc CPUTime.hsc Directory.hsc
IO.lhs Makefile Monad.lhs PrelBits.lhs PrelByteArr.lhs
PrelCError.lhs PrelCString.lhs PrelCTypes.lhs PrelCTypesISO.lhs ...
Simon Marlow
simonmar@glass.cse.ogi.edu
Fri, 18 May 2001 09:54:11 -0700
simonmar 2001/05/18 09:54:11 PDT
Modified files:
ghc/compiler/prelude PrelNames.lhs
ghc/lib/std CPUTime.hsc Directory.hsc IO.lhs Makefile
Monad.lhs PrelBits.lhs PrelByteArr.lhs
PrelCError.lhs PrelCString.lhs
PrelCTypes.lhs PrelCTypesISO.lhs
PrelConc.lhs PrelErr.lhs PrelForeign.lhs
PrelIOBase.lhs PrelInt.lhs PrelMain.lhs
PrelMarshalAlloc.lhs PrelMarshalArray.lhs
PrelMarshalError.lhs PrelMarshalUtils.lhs
PrelStorable.lhs PrelWord.lhs Prelude.lhs
System.lhs Time.hsc
ghc/lib/std/cbits HsStd.h errno.c inputReady.c progargs.c
system.c writeError.c
ghc/tests/deSugar/should_compile ds046.hs
hslibs/concurrent Concurrent.lhs
hslibs/net SocketPrim.hsc
hslibs/posix PosixIO.lhs
hslibs/posix/cbits HsPosix.h
hslibs/util Select.lhs Unique.lhs
hslibs/util/cbits selectFrom.c
Added files:
ghc/lib/std PrelHandle.hsc PrelIO.hsc PrelPosix.hsc
ghc/lib/std/cbits lockFile.c lockFile.h
ghc/tests/lib/CPUTime CPUTime001.hs CPUTime001.stdout
ghc/tests/lib/Directory currentDirectory001.hs
currentDirectory001.stdout
directory001.hs directory001.stdout
getDirectoryContents001.hs
getDirectoryContents001.stdout
getPermissions001.hs
getPermissions001.stdout
getPermissions001.stdout-mingw
ghc/tests/lib/IO IOError001.hs IOError001.stdout
IOError001.stdout-mingw Makefile
finalization001.hs finalization001.stdout
hClose001.hs hClose001.stdout
hFileSize001.hs hFileSize001.stdout
hFileSize002.hs hFileSize002.stdout
hFlush001.hs hFlush001.stdout
hGetBuffering001.hs
hGetBuffering001.stdout hGetChar001.hs
hGetChar001.stdin hGetChar001.stdout
hGetLine001.hs hGetLine001.stdout
hGetPosn001.hs hGetPosn001.in
hGetPosn001.stdout hIsEOF001.hs
hIsEOF001.stdout hIsEOF002.hs
hIsEOF002.stdout hReady001.hs hSeek001.hs
hSeek001.in hSeek001.stdout hSeek002.hs
hSeek002.stdout hSeek003.hs
hSeek003.stdout hSeek004.hs
hSeek004.stdout hSetBuffering002.hs
hSetBuffering002.stdout
hSetBuffering003.hs
hSetBuffering003.stderr
hSetBuffering003.stdout
ioeGetErrorString001.hs
ioeGetErrorString001.stdout
ioeGetFileName001.hs
ioeGetFileName001.stdout
ioeGetHandle001.hs ioeGetHandle001.stdout
isEOF001.hs isEOF001.stdout misc001.hs
misc001.stdout openFile001.hs
openFile001.stdout openFile002.hs
openFile002.stderr openFile003.hs
openFile003.stdout openFile004.hs
openFile004.stdout openFile005.hs
openFile005.stdout openFile006.hs
openFile006.stdout putStr001.hs
putStr001.stdout readwrite001.hs
readwrite001.stdout readwrite002.hs
readwrite002.stdout
ghc/tests/lib/IOExts echo001.hs echo001.stdout trace001.hs
trace001.stderr trace001.stdout
ghc/tests/lib/System Makefile exitWith001.hs
exitWith001.stdout getArgs001.hs
getArgs001.stdout getArgs001.stdout-mingw
getEnv001.hs getEnv001.stdout
system001.hs system001.stdout
ghc/tests/lib/Time time001.hs time001.stdout time002.hs
time002.stdout time003.hs time003.stdout
time004.hs time004.stdout
hslibs/lang IOExts.hsc
Removed files:
ghc/lib/std PrelHandle.lhs PrelIO.lhs
ghc/lib/std/cbits closeFile.c echoAux.c fileEOF.c
fileGetc.c fileLookAhead.c fileObject.c
fileObject.h filePosn.c filePutc.c
fileSize.c flushFile.c freeFile.c
getBufferMode.c getLock.c openFile.c
readFile.c seekFile.c setBinaryMode.c
setBuffering.c tcSetAttr.c writeFile.c
ghc/tests/io/should_run Makefile io001.hs io001.stdout
io002.hs io002.stdout io003.hs
io003.stdout io003.stdout-mingw
io004.hs io004.stdout io005.hs
io005.stdout io006.hs io006.stdout
io007.hs io007.stdout io008.hs
io008.in io008.stdout io009.hs
io009.stdout io010.hs io010.stdout
io011.hs io011.stdout io012.hs
io012.stdout io013.hs io013.in
io013.stdout io014.hs io014.stdout
io015.hs io015.stdout io016.hs
io016.stdout io017.hs io017.stdin
io017.stdout io018.hs io018.stdout
io019.hs io019.stdout io020.hs
io020.stdout io021.hs io021.stdout
io022.hs io022.stdout io023.hs
io023.stdout io024.hs io024.stdout
io025.hs io025.stdout io026.hs
io026.stdout io027.hs io027.stdout
io028.hs io028.stderr io028.stdout
io029.hs io029.stdout io030.hs
io030.stdout io031.hs io031.stdout
io032.hs io032.stderr io032.stdout
io033.hs io033.stdout io034.hs
io034.stdout io034.stdout-mingw
io035.hs io035.stdout
io035.stdout-mingw
ghc/tests/lib/should_run time001.hs time001.stdout time002.hs
time002.stdout
hslibs/lang IOExts.lhs
Log:
I/O library rewrite
-------------------
This commit replaces the old C/Haskell I/O implementation with a new
Haskell-only one using the new FFI & hsc2hs.
main points:
- lots of code deleted: we're about 3000 lines of C lighter,
but the amount of Haskell code is about the same.
- performance is ok: some operations are faster, others are
slower. There's still some tuning to do, though.
- the new library is designed to handle read/write streams
much better: a read/write stream gets a special kind of
handle internally called a "DuplexHandle", which actually
contains two separate handles, one for writing and one for
reading. The upshot is that you can do simultaneous reading
and writing to/from a socket or FIFO without any locking
problems. The effect is similar to calling socketToHandle
twice, except that finalization works properly (creating
two separate Handles could lead to the socket being closed
too early when one of the Handles is GC'd).
- hConnectTo and withHandleFor are gone (no one responded to
my mail on GHC users, but we can always bring 'em back if
necessary).
- I made a half-hearted attempt at keeping the system-specific
code in one place: see PrelPosix.hsc.
- I've rearranged the I/O tests and added lots more.
ghc/tests/lib/IO now contains Haskell 98-only IO tests,
ghc/test/lib/{IOExts, Directory, Time} now contain tests for
the relevant libraries. I haven't quite finished in here yet,
the IO tests work but the others don't yet.
- I haven't done anything about Unicode yet, but now we can
start to discuss what needs doing here. The new library
is using MutableByteArrays for its buffers because that
turned out to be a *lot* easier (and quicker) than malloc'd
buffers - I hope this won't cause trouble for unicode
translations though.
WARNING: Windows users refrain from updating until we've had a chance
to fix any issues that arise.
Testing: the basic H98 stuff has been pretty thoroughly tested, but
the new duplex handle stuff is still a little green.
Revision Changes Path
1.30 +2 -2 fptools/ghc/compiler/prelude/PrelNames.lhs
1.3 +2 -36 fptools/ghc/lib/std/CPUTime.hsc
1.11 +2 -3 fptools/ghc/lib/std/Directory.hsc
1.41 +2 -415 fptools/ghc/lib/std/IO.lhs
1.70 +10 -0 fptools/ghc/lib/std/Makefile
1.13 +38 -2 fptools/ghc/lib/std/Monad.lhs
1.4 +1 -1 fptools/ghc/lib/std/PrelBits.lhs
1.14 +1 -14 fptools/ghc/lib/std/PrelByteArr.lhs
1.8 +48 -11 fptools/ghc/lib/std/PrelCError.lhs
1.4 +12 -9 fptools/ghc/lib/std/PrelCString.lhs
1.4 +10 -2 fptools/ghc/lib/std/PrelCTypes.lhs
1.6 +10 -1 fptools/ghc/lib/std/PrelCTypesISO.lhs
1.24 +7 -1 fptools/ghc/lib/std/PrelConc.lhs
1.19 +9 -1 fptools/ghc/lib/std/PrelErr.lhs
1.19 +15 -1 fptools/ghc/lib/std/PrelForeign.lhs
1.38 +229 -356 fptools/ghc/lib/std/PrelIOBase.lhs
1.15 +3 -0 fptools/ghc/lib/std/PrelInt.lhs
1.8 +55 -5 fptools/ghc/lib/std/PrelMain.lhs
1.2 +10 -4 fptools/ghc/lib/std/PrelMarshalAlloc.lhs
1.3 +13 -3 fptools/ghc/lib/std/PrelMarshalArray.lhs
1.2 +4 -1 fptools/ghc/lib/std/PrelMarshalError.lhs
1.3 +11 -5 fptools/ghc/lib/std/PrelMarshalUtils.lhs
1.7 +5 -1 fptools/ghc/lib/std/PrelStorable.lhs
1.12 +3 -0 fptools/ghc/lib/std/PrelWord.lhs
1.26 +9 -43 fptools/ghc/lib/std/Prelude.lhs
1.30 +49 -73 fptools/ghc/lib/std/System.lhs
1.13 +2 -29 fptools/ghc/lib/std/Time.hsc
1.2 +80 -2 fptools/ghc/lib/std/cbits/HsStd.h
1.5 +3 -951 fptools/ghc/lib/std/cbits/errno.c
1.7 +16 -60 fptools/ghc/lib/std/cbits/inputReady.c
1.5 +1 -2 fptools/ghc/lib/std/cbits/progargs.c
1.12 +5 -44 fptools/ghc/lib/std/cbits/system.c
1.6 +4 -11 fptools/ghc/lib/std/cbits/writeError.c
1.4 +7 -2 fptools/ghc/tests/deSugar/should_compile/ds046.hs
1.12 +1 -1 fptools/hslibs/concurrent/Concurrent.lhs
1.3 +4 -37 fptools/hslibs/net/SocketPrim.hsc
1.14 +14 -41 fptools/hslibs/posix/PosixIO.lhs
1.2 +1 -3 fptools/hslibs/posix/cbits/HsPosix.h
1.4 +6 -10 fptools/hslibs/util/Select.lhs
1.2 +2 -3 fptools/hslibs/util/Unique.lhs
1.3 +1 -1 fptools/hslibs/util/cbits/selectFrom.c