Avoid the use of Posix when compiling for target i386-unknown-mingw32
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.68 2001/05/23 10:26:14 simonmar Exp $
+-- $Id: InteractiveUI.hs,v 1.69 2001/05/28 03:17:03 sof Exp $
--
-- GHC Interactive User Interface
--
--
-- GHC Interactive User Interface
--
import Panic ( GhcException(..) )
import Config
import Panic ( GhcException(..) )
import Config
-import CForeign
-import Foreign
-
+#ifndef mingw32_TARGET_OS
import Exception
import Dynamic
#if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS
import Exception
import Dynamic
#if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS
import Monad ( when )
import PrelGHC ( unsafeCoerce# )
import Monad ( when )
import PrelGHC ( unsafeCoerce# )
+import Foreign ( nullPtr )
+import CString ( peekCString )
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
dflags <- getDynFlags
(cmstate, maybe_hval)
dflags <- getDynFlags
(cmstate, maybe_hval)
- <- cmCompileExpr cmstate dflags "IO.hFlush IO.stderr"
+ <- cmCompileExpr cmstate dflags "IO.hFlush PrelHandle.stderr"
case maybe_hval of
Just hval -> writeIORef flush_stderr (unsafeCoerce# hval :: IO ())
_ -> panic "interactiveUI:stderr"
(cmstate, maybe_hval)
case maybe_hval of
Just hval -> writeIORef flush_stderr (unsafeCoerce# hval :: IO ())
_ -> panic "interactiveUI:stderr"
(cmstate, maybe_hval)
- <- cmCompileExpr cmstate dflags "IO.hFlush IO.stdout"
+ <- cmCompileExpr cmstate dflags "IO.hFlush PrelHandle.stdout"
case maybe_hval of
Just hval -> writeIORef flush_stdout (unsafeCoerce# hval :: IO ())
_ -> panic "interactiveUI:stdout"
case maybe_hval of
Just hval -> writeIORef flush_stdout (unsafeCoerce# hval :: IO ())
_ -> panic "interactiveUI:stdout"
- -- replace the current argv/argc with ["<interactive>"].
- interactive_str <- newCString "<interactive>"
- poke prog_argc_label 1 -- sets argc to 1
- argv <- peek prog_argv_label
- poke argv interactive_str -- sets argv[0] to point to "<interactive>"
-
(unGHCi runGHCi) GHCiState{ target = mod,
cmstate = cmstate,
options = [] }
return ()
(unGHCi runGHCi) GHCiState{ target = mod,
cmstate = cmstate,
options = [] }
return ()
-foreign label "prog_argv" prog_argv_label :: Ptr (Ptr (Ptr CChar))
-foreign label "prog_argc" prog_argc_label :: Ptr CInt
runGHCi :: GHCi ()
runGHCi = do
runGHCi :: GHCi ()
runGHCi = do
checkPerms :: String -> IO Bool
checkPerms name =
handle (\_ -> return False) $ do
checkPerms :: String -> IO Bool
checkPerms name =
handle (\_ -> return False) $ do
+#ifdef mingw32_TARGET_OS
+ doesFileExist name
+#else
st <- getFileStatus name
me <- getRealUserID
if fileOwner st /= me then do
st <- getFileStatus name
me <- getRealUserID
if fileOwner st /= me then do
" is writable by someone else, IGNORING!"
return False
else return True
" is writable by someone else, IGNORING!"
return False
else return True
fileLoop :: Handle -> Bool -> GHCi ()
fileLoop hdl prompt = do
fileLoop :: Handle -> Bool -> GHCi ()
fileLoop hdl prompt = do