X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Fmain%2FMain.hs;h=f7c5be72beb722ee6b91d20edfc1cc8cf9c7908b;hb=311b1cdfc9b1c311cc53482c461c18cba8885b2a;hp=971eb3500c303e296f48b2d6d8b9eb9882a175af;hpb=ee565d464248078a4f2d46f98667aa4fcdc56db4;p=ghc-hetmet.git diff --git a/compiler/main/Main.hs b/compiler/main/Main.hs index 971eb35..f7c5be7 100644 --- a/compiler/main/Main.hs +++ b/compiler/main/Main.hs @@ -18,7 +18,8 @@ import GHC ( Session, DynFlags(..), GhcMode(..), HscTarget(..), import CmdLineParser -- Implementations of the various modes (--show-iface, mkdependHS. etc.) -import MkIface ( showIface ) +import LoadIface ( showIface ) +import HscMain ( newHscEnv ) import DriverPipeline ( oneShot, compileFile ) import DriverMkDepend ( doMkDependHS ) #ifdef GHCI @@ -27,26 +28,27 @@ import InteractiveUI ( ghciWelcomeMsg, interactiveUI ) -- Various other random stuff that we need import Config ( cProjectVersion, cBooterVersion, cProjectName ) -import Packages ( dumpPackages, initPackages ) +import Packages ( dumpPackages ) import DriverPhases ( Phase(..), isSourceFilename, anyHsc, startPhase, isHaskellSrcFilename ) import StaticFlags ( staticFlags, v_Ld_inputs, parseStaticFlags ) import DynFlags ( defaultDynFlags ) import BasicTypes ( failed ) -import ErrUtils ( Message, debugTraceMsg, putMsg ) +import ErrUtils ( putMsg ) import FastString ( getFastStringTable, isZEncoded, hasZEncoding ) import Outputable import Util import Panic -- Standard Haskell libraries -import EXCEPTION ( throwDyn ) -import IO -import Directory ( doesDirectoryExist ) -import System ( getArgs, exitWith, ExitCode(..) ) -import Monad -import List -import Maybe +import Control.Exception ( throwDyn ) +import System.IO +import System.Directory ( doesDirectoryExist ) +import System.Environment +import System.Exit +import Control.Monad +import Data.List +import Data.Maybe ----------------------------------------------------------------------------- -- ToDo: @@ -147,7 +149,7 @@ main = PrintLibdir -> putStrLn (topDir dflags) ShowVersion -> showVersion ShowNumVersion -> putStrLn cProjectVersion - ShowInterface f -> showIface f + ShowInterface f -> doShowIface dflags f DoMake -> doMake session srcs DoMkDependHS -> doMkDependHS session (map fst srcs) StopBefore p -> oneShot dflags p srcs @@ -395,6 +397,15 @@ doMake sess srcs = do when (failed ok_flag) (exitWith (ExitFailure 1)) return () + +-- --------------------------------------------------------------------------- +-- --show-iface mode + +doShowIface :: DynFlags -> FilePath -> IO () +doShowIface dflags file = do + hsc_env <- newHscEnv dflags + showIface hsc_env file + -- --------------------------------------------------------------------------- -- Various banners and verbosity output.