-- the system state at the same time.
cmLoadModule :: CmState
- -> FilePath
+ -> [FilePath]
-> IO (CmState, -- new state
Bool, -- was successful
[String]) -- list of modules loaded
-cmLoadModule cmstate1 rootname
+cmLoadModule cmstate1 rootnames
= do -- version 1's are the original, before downsweep
let pls1 = pls cmstate1
let pcs1 = pcs cmstate1
showPass dflags "Chasing dependencies"
when (verb >= 1 && ghci_mode == Batch) $
- hPutStrLn stderr (progName ++ ": chasing modules from: " ++ rootname)
+ hPutStrLn stderr (showSDoc (hcat [
+ text progName, text ": chasing modules from: ",
+ hcat (punctuate comma (map text rootnames))]))
- (mg2unsorted, a_root_is_Main) <- downsweep [rootname] mg1
+ (mg2unsorted, a_root_is_Main) <- downsweep rootnames mg1
let mg2unsorted_names = map name_of_summary mg2unsorted
-- reachable_from follows source as well as normal imports
res = simple_transitive_closure (map toEdge summaries) [root]
in
- --trace (showSDoc (text "DC of mod" <+> ppr root
- -- <+> text "=" <+> ppr res)) (
+-- trace (showSDoc (text "DC of mod" <+> ppr root
+-- <+> text "=" <+> ppr res)) $
res
- --)
-- Calculate transitive closures from a set of roots given an adjacency list
simple_transitive_closure :: Eq a => [(a,[a])] -> [a] -> [a]
{-# OPTIONS -fno-warn-incomplete-patterns #-}
-----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.74 2001/06/18 21:45:49 sof Exp $
+-- $Id: Main.hs,v 1.75 2001/06/27 11:14:08 simonmar Exp $
--
-- GHC Driver program
--
case mods of
[] -> throwDyn (UsageError "no input files")
- [mod] -> do state <- cmInit Batch
- cmLoadModule state mod
+ mod -> do state <- cmInit Batch
+ cmLoadModule state mods
return ()
- _ -> throwDyn (UsageError "only one module allowed with --make")
beginInteractive :: [String] -> IO ()
libs = map Left objs ++ map Right minus_ls
state <- cmInit Interactive
- case mods of
- [] -> interactiveUI state Nothing libs
- [mod] -> interactiveUI state (Just mod) libs
- _ -> throwDyn (UsageError
- "only one module allowed with --interactive")
+ interactiveUI state mods libs
#endif