{-# OPTIONS -#include "Linker.h" #-}
-----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.152 2003/05/07 08:29:48 simonpj Exp $
+-- $Id: InteractiveUI.hs,v 1.156 2003/07/02 19:41:43 ross Exp $
--
-- GHC Interactive User Interface
--
--
-----------------------------------------------------------------------------
module InteractiveUI (
- interactiveUI, -- :: CmState -> [FilePath] -> [LibrarySpec] -> IO ()
+ interactiveUI, -- :: CmState -> [FilePath] -> IO ()
ghciWelcomeMsg
) where
import CompManager
import HscTypes ( TyThing(..), HomeModInfo(hm_linkable), HomePackageTable,
- isObjectLinkable )
+ isObjectLinkable, GhciMode(..) )
import HsSyn ( TyClDecl(..), ConDecl(..), Sig(..) )
import MkIface ( ifaceTyThing )
import DriverFlags
import DriverState
-import DriverUtil ( remove_spaces, handle )
-import Linker ( initLinker, showLinkerState, linkLibraries,
- linkPackages )
+import DriverUtil ( remove_spaces )
+import Linker ( showLinkerState, linkPackages )
import Util
import IdInfo ( GlobalIdDetails(..) )
import Id ( isImplicitId, idName, globalIdDetails )
import Config
#ifndef mingw32_HOST_OS
+import DriverUtil( handle )
import System.Posix
#if __GLASGOW_HASKELL__ > 504
hiding (getEnv)
\ (eg. -v2, -fglasgow-exts, etc.)\n\
\"
-interactiveUI :: CmState -> [FilePath] -> [FilePath] -> IO ()
-interactiveUI cmstate paths cmdline_objs = do
- hFlush stdout
- hSetBuffering stdout NoBuffering
-
+interactiveUI :: [FilePath] -> IO ()
+interactiveUI srcs = do
dflags <- getDynFlags
- initLinker
+ cmstate <- cmInit Interactive;
- -- link packages requested explicitly on the command-line
- expl <- readIORef v_ExplicitPackages
- linkPackages dflags expl
-
- -- link libraries from the command-line
- linkLibraries dflags cmdline_objs
+ hFlush stdout
+ hSetBuffering stdout NoBuffering
-- Initialise buffering for the *interpreted* I/O system
cmstate <- initInterpBuffering cmstate dflags
Readline.initialize
#endif
- startGHCi (runGHCi paths dflags)
+ startGHCi (runGHCi srcs dflags)
GHCiState{ progname = "<interactive>",
args = [],
- targets = paths,
+ targets = srcs,
cmstate = cmstate,
options = [] }
Left e -> return ()
Right hdl -> fileLoop hdl False
- -- perform a :load for files given on the GHCi command line
+ -- Perform a :load for files given on the GHCi command line
when (not (null paths)) $
ghciHandle showException $
loadModule paths
-- enter the interactive loop
#if defined(mingw32_HOST_OS)
- -- always show prompt, since hIsTerminalDevice returns True for Consoles
+ -- Always show prompt, since hIsTerminalDevice returns True for Consoles
-- only, which we may or may not be running under (cf. Emacs sub-shells.)
interactiveLoop True
#else
interactiveLoop is_tty = do
- -- ignore ^C exceptions caught here
+ -- Ignore ^C exceptions caught here
ghciHandleDyn (\e -> case e of
Interrupted -> ghciUnblock (interactiveLoop is_tty)
_other -> return ()) $ do