X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fmain%2FMain.hs;h=46aec68b04607dbbec3beee436bb9d3817121125;hb=8fbe28ca67a6c07575aee35bfade43e967ad792e;hp=dbbb12fb515fc1b6815cf7c72f7b1733503b5c23;hpb=a37ef0a9233735fffa72a4ccccf6345198623a21;p=ghc-hetmet.git diff --git a/ghc/compiler/main/Main.hs b/ghc/compiler/main/Main.hs index dbbb12f..46aec68 100644 --- a/ghc/compiler/main/Main.hs +++ b/ghc/compiler/main/Main.hs @@ -1,6 +1,6 @@ {-# OPTIONS -W -fno-warn-incomplete-patterns #-} ----------------------------------------------------------------------------- --- $Id: Main.hs,v 1.21 2000/11/14 16:28:38 simonmar Exp $ +-- $Id: Main.hs,v 1.28 2000/11/20 16:37:42 sewardj Exp $ -- -- GHC Driver program -- @@ -16,11 +16,16 @@ module Main (main) where #include "HsVersions.h" import CompManager +import Interpreter +#ifdef GHCI +import InteractiveUI +#endif import DriverPipeline import DriverState import DriverFlags import DriverMkDepend import DriverUtil +import Panic import DriverPhases ( Phase(..) ) import CmdLineOpts ( HscLang(..), DynFlags(..), v_Static_hsc_opts ) import Module ( mkModuleName ) @@ -29,7 +34,6 @@ import Finder ( initFinder ) import CmStaticInfo import Config import Util -import Panic import Concurrent #ifndef mingw32_TARGET_OS @@ -68,6 +72,7 @@ import Maybe -- reading the package configuration file is too slow -- -H, -K, -Rghc-timing -- hi-diffs +-- -ddump-all doesn't do anything ----------------------------------------------------------------------------- -- Differences vs. old driver: @@ -109,9 +114,6 @@ main = installHandler sigINT sig_handler Nothing #endif - pgm <- getProgName - writeIORef v_Prog_name pgm - argv <- getArgs -- grab any -B options from the command line first @@ -198,6 +200,7 @@ main = stgToDo = stg_todo, hscLang = lang, -- leave out hscOutName for now + hscOutName = panic "Main.main:hscOutName not set", flags = [] } -- the rest of the arguments are "dynamic" @@ -210,6 +213,12 @@ main = -- complain about any unknown flags mapM unknownFlagErr [ f | f@('-':_) <- srcs ] + -- save the flag state, because this could be modified by OPTIONS + -- pragmas during the compilation, and we'll need to restore it + -- before starting the next compilation. + saved_driver_state <- readIORef v_Driver_state + writeIORef v_InitDriverState saved_driver_state + -- get the -v flag verb <- readIORef v_Verbose @@ -244,11 +253,6 @@ main = if null srcs then throwDyn (UsageError "no input files") else do - -- save the flag state, because this could be modified by OPTIONS - -- pragmas during the compilation, and we'll need to restore it - -- before starting the next compilation. - saved_driver_state <- readIORef v_Driver_state - let compileFile (src, phases) = do writeIORef v_Driver_state saved_driver_state writeIORef v_DynFlags init_dyn_flags @@ -274,31 +278,20 @@ beginMake :: PackageConfigInfo -> [String] -> IO () beginMake pkg_details mods = do case mods of [] -> throwDyn (UsageError "no input files") - [mod] -> do state <- cmInit pkg_details - cmLoadModule state (mkModuleName mod) + [mod] -> do state <- cmInit pkg_details Batch + cmLoadModule state mod return () _ -> throwDyn (UsageError "only one module allowed with --make") +#ifndef GHCI +beginInteractive = throwDyn (OtherError "not build for interactive use") +#else beginInteractive pkg_details mods - = do case mods of - [] -> return () - [mod] -> do state <- cmInit pkg_details - cmLoadModule state (mkModuleName mod) - return () - _ -> throwDyn (UsageError + = do state <- cmInit pkg_details Interactive + case mods of + [] -> return () + [mod] -> do cmLoadModule state mod; return () + _ -> throwDyn (UsageError "only one module allowed with --interactive") - interactiveUI - -interactiveUI :: IO () -interactiveUI = do - hPutStr stdout ghciWelcomeMsg - throwDyn (OtherError "GHCi not implemented yet") - -ghciWelcomeMsg = "\ -\ _____ __ __ ____ ------------------------------------------------\n\ -\(| || || (| |) GHCi: GHC Interactive, version 5.00 \n\ -\|| __ ||___|| || () For Haskell 98. \n\ -\|| |) ||---|| || // http://www.haskell.org/ghc \n\ -\|| || || || || // Bug reports to: glasgow-haskell-bugs@haskell.org\n\ -\(|___|| || || (|__|) (| ________________________________________________\n" - + interactiveUI state +#endif