X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=f74285cde4f2317ad592e340704ad020cd1b159a;hb=3cf18a5382d49f5a7ecce365bbd59ebe07a407fe;hp=366a435bc82666b3857bcb126c9c0d96b032254e;hpb=fe548aebdad3520e51d92fcda6bec9d26d69aa4a;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index 366a435..f74285c 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,6 +1,6 @@ {-# 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 -- @@ -8,7 +8,7 @@ -- ----------------------------------------------------------------------------- module InteractiveUI ( - interactiveUI, -- :: CmState -> [FilePath] -> [LibrarySpec] -> IO () + interactiveUI, -- :: CmState -> [FilePath] -> IO () ghciWelcomeMsg ) where @@ -17,14 +17,13 @@ module InteractiveUI ( 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 ) @@ -46,6 +45,7 @@ import Panic hiding ( showException ) import Config #ifndef mingw32_HOST_OS +import DriverUtil( handle ) import System.Posix #if __GLASGOW_HASKELL__ > 504 hiding (getEnv) @@ -155,21 +155,14 @@ helpText = "\ \ (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 @@ -185,10 +178,10 @@ interactiveUI cmstate paths cmdline_objs = do Readline.initialize #endif - startGHCi (runGHCi paths dflags) + startGHCi (runGHCi srcs dflags) GHCiState{ progname = "", args = [], - targets = paths, + targets = srcs, cmstate = cmstate, options = [] } @@ -231,14 +224,14 @@ runGHCi paths dflags = do 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 @@ -251,7 +244,7 @@ runGHCi paths dflags = do 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