A recent patch to System.IO introduced a cyclic dependency on Foreign.C.Error,
and also inadvertently dragged along System.Posix.Internals which has
non-H'98 layout, causing many build problems. The solution for now
is to #ifndef __NHC__ all of the recent the openTempFile additions,
and mark them non-portable once again. (I also took the opportunity
to note a number of other non-portable functions in their Haddock
comments.)
hIsReadable, hIsWritable, -- :: Handle -> IO Bool
hIsSeekable, -- :: Handle -> IO Bool
hIsReadable, hIsWritable, -- :: Handle -> IO Bool
hIsSeekable, -- :: Handle -> IO Bool
- -- ** Terminal operations
+ -- ** Terminal operations (not portable: ghc/hugs only)
#if !defined(__NHC__)
hIsTerminalDevice, -- :: Handle -> IO Bool
#if !defined(__NHC__)
hIsTerminalDevice, -- :: Handle -> IO Bool
hGetEcho, -- :: Handle -> IO Bool
#endif
hGetEcho, -- :: Handle -> IO Bool
#endif
- -- ** Showing handle state
+ -- ** Showing handle state (not portable: ghc only)
#ifdef __GLASGOW_HASKELL__
hShow, -- :: Handle -> IO String
#ifdef __GLASGOW_HASKELL__
hShow, -- :: Handle -> IO String
hGetBufNonBlocking, -- :: Handle -> Ptr a -> Int -> IO Int
#endif
hGetBufNonBlocking, -- :: Handle -> Ptr a -> Int -> IO Int
#endif
+ -- * Temporary files (not portable: ghc/hugs only)
openTempFile,
openBinaryTempFile,
openTempFile,
openBinaryTempFile,
import Data.Bits
import Data.List
import Data.Maybe
import Foreign.C.Error
import Foreign.C.String
import System.Posix.Internals
import Data.Bits
import Data.List
import Data.Maybe
import Foreign.C.Error
import Foreign.C.String
import System.Posix.Internals
#ifdef __GLASGOW_HASKELL__
import GHC.Exception as ExceptionBase hiding (catch)
#ifdef __GLASGOW_HASKELL__
import GHC.Exception as ExceptionBase hiding (catch)
hSetBinaryMode _ _ = return ()
#endif
hSetBinaryMode _ _ = return ()
#endif
-- | The function creates a temporary file in ReadWrite mode.
-- The created file isn\'t deleted automatically, so you need to delete it manually.
openTempFile :: FilePath -- ^ Directory in which to create the file
-- | The function creates a temporary file in ReadWrite mode.
-- The created file isn\'t deleted automatically, so you need to delete it manually.
openTempFile :: FilePath -- ^ Directory in which to create the file
write_flags = output_flags .|. o_WRONLY
rw_flags = output_flags .|. o_RDWR
append_flags = write_flags .|. o_APPEND
write_flags = output_flags .|. o_WRONLY
rw_flags = output_flags .|. o_RDWR
append_flags = write_flags .|. o_APPEND
-- $locking
-- Implementations should enforce as far as possible, at least locally to the
-- $locking
-- Implementations should enforce as far as possible, at least locally to the