[project @ 2001-06-27 11:14:07 by simonmar]
authorsimonmar <unknown>
Wed, 27 Jun 2001 11:14:08 +0000 (11:14 +0000)
committersimonmar <unknown>
Wed, 27 Jun 2001 11:14:08 +0000 (11:14 +0000)
Allow multiple targets to be specified on the command line for ghc
--make and GHCi.  Also implement :a command in GHCi (untested and
undocumented so far).

ghc/compiler/compMan/CompManager.lhs
ghc/compiler/main/Main.hs

index 8c7cf64..24a53b8 100644 (file)
@@ -343,12 +343,12 @@ cmUnload state@CmState{ gmode=mode, pls=pls, pcs=pcs } dflags
 -- 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
@@ -368,9 +368,11 @@ cmLoadModule cmstate1 rootname
 
        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
@@ -888,10 +890,9 @@ downwards_closure_of_module summaries root
 
          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]
index 15ac137..1c8a11a 100644 (file)
@@ -1,6 +1,6 @@
 {-# 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
 --
@@ -309,10 +309,9 @@ beginMake fileish_args
 
        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 ()
@@ -326,9 +325,5 @@ beginInteractive fileish_args
           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