{-# OPTIONS -#include "Linker.h" #-}
-----------------------------------------------------------------------------
--- $Id: InteractiveUI.hs,v 1.194 2005/03/18 13:38:31 simonmar Exp $
+-- $Id: InteractiveUI.hs,v 1.195 2005/03/18 17:16:03 simonpj Exp $
--
-- GHC Interactive User Interface
--
#include "HsVersions.h"
import CompManager
-import HscTypes ( GhciMode(..) )
import IfaceSyn ( IfaceDecl(..), IfaceClassOp(..), IfaceConDecls(..),
IfaceConDecl(..), IfaceType,
pprIfaceDeclHead, pprParendIfaceType,
pprIfaceForAllPart, pprIfaceType )
import FunDeps ( pprFundeps )
-import Util ( removeSpaces )
+import Util ( removeSpaces, handle )
import Linker ( showLinkerState, linkPackages )
import Util
import Name ( Name, NamedThing(..) )
import OccName ( OccName, parenSymOcc, occNameUserString )
import BasicTypes ( StrictnessMark(..), defaultFixity, SuccessFlag(..) )
import Outputable
-import DynFlags ( DynFlags(..), DynFlag(..), dopt )
+import DynFlags
import Panic hiding ( showException )
import Config
import SrcLoc ( SrcLoc, isGoodSrcLoc )
+import StaticFlags ( opt_IgnoreDotGhci )
#ifndef mingw32_HOST_OS
import Util ( handle )
interactiveUI :: DynFlags -> [FilePath] -> Maybe String -> IO ()
interactiveUI dflags srcs maybe_expr = do
- cmstate <- cmInit Interactive dflags;
+ cmstate <- cmInit dflags;
-- HACK! If we happen to get into an infinite loop (eg the user
-- types 'let x=x in x' at the prompt), then the thread will block
runGHCi :: [FilePath] -> DynFlags -> Maybe String -> GHCi ()
runGHCi paths dflags maybe_expr = do
- read_dot_files <- io (readIORef v_Read_DotGHCi)
+ let read_dot_files = not opt_IgnoreDotGhci
when (read_dot_files) $ do
-- Read in ./.ghci.
#ifdef mingw32_HOST_OS
return True
#else
- DriverUtil.handle (\_ -> return False) $ do
+ Util.handle (\_ -> return False) $ do
st <- getFileStatus name
me <- getRealUserID
if fileOwner st /= me then do
-- perhaps did getContents which closes stdin at
-- EOF.
Right l ->
- case remove_spaces l of
+ case removeSpaces l of
"" -> fileLoop hdl prompt
l -> do quit <- runCommand l
if quit then return () else fileLoop hdl prompt
stringLoop :: [String] -> GHCi ()
stringLoop [] = return ()
stringLoop (s:ss) = do
- case remove_spaces s of
+ case removeSpaces s of
"" -> stringLoop ss
l -> do quit <- runCommand l
if quit then return () else stringLoop ss
case l of
Nothing -> return ()
Just l ->
- case remove_spaces l of
+ case removeSpaces l of
"" -> readlineLoop
l -> do
io (addHistory l)
let (plus_opts, minus_opts) = partition isPlus wds
mapM_ setOpt plus_opts
- -- now, the GHC flags
- leftovers <- io $ processStaticFlags minus_opts
-
-- then, dynamic flags
dflags <- getDynFlags
- (dflags',leftovers) <- io $ processDynamicFlags leftovers dflags
+ (dflags',leftovers) <- io $ parseDynamicFlags dflags minus_opts
setDynFlags dflags'
-- update things if the users wants more packages
import NameSet ( nameSetToList )
import Module
import ListSetOps ( minusList )
-import DynFlags ( DynFlags(..) )
+import DynFlags ( DynFlags(..), getOpts )
import BasicTypes ( SuccessFlag(..), succeeded, failed )
import Outputable
import Panic ( GhcException(..) )
import Util ( zipLazy, global )
+import StaticFlags ( v_Ld_inputs )
-- Standard libraries
import Control.Monad ( when, filterM, foldM )
; linkPackages dflags (explicitPackages (pkgState dflags))
-- (c) Link libraries from the command-line
- ; opt_l <- getStaticOpts v_Opt_l
- ; let minus_ls = [ lib | '-':'l':lib <- opt_l ]
+ ; let optl = getOpts dflags opt_l
+ ; let minus_ls = [ lib | '-':'l':lib <- optl ]
-- (d) Link .o files from the command-line
- ; lib_paths <- readIORef v_Library_paths
+ ; let lib_paths = libraryPaths dflags
; cmdline_ld_inputs <- readIORef v_Ld_inputs
; classified_ld_inputs <- mapM classifyLdInput cmdline_ld_inputs