X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=257c219adf5120f127014b9712c9ab41e8520204;hb=8a45d6bb5426552fc6993fc4a1f391d0f3c77b8d;hp=87d2ae927d5055a487ea4eb1c79147927b8fa9fb;hpb=e8d5235bc17366e81afbb2fe25ee8cb43c408f82;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index 87d2ae9..257c219 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,76 +1,83 @@ -{-# OPTIONS -#include "Linker.h" -#include "SchedAPI.h" #-} +{-# OPTIONS -#include "Linker.h" #-} ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.115 2002/02/13 15:56:18 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.158 2003/08/27 12:29:21 simonmar Exp $ -- -- GHC Interactive User Interface -- -- (c) The GHC Team 2000 -- ----------------------------------------------------------------------------- -module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where +module InteractiveUI ( + interactiveUI, -- :: CmState -> [FilePath] -> IO () + ghciWelcomeMsg + ) where #include "../includes/config.h" #include "HsVersions.h" -import Packages - import CompManager -import CmTypes ( Linkable, isObjectLinkable, ModSummary(..) ) -import CmLink ( findModuleLinkable_maybe ) - -import HscTypes ( TyThing(..), showModMsg, InteractiveContext(..) ) +import HscTypes ( TyThing(..), HomeModInfo(hm_linkable), HomePackageTable, + isObjectLinkable, GhciMode(..) ) import HsSyn ( TyClDecl(..), ConDecl(..), Sig(..) ) import MkIface ( ifaceTyThing ) import DriverFlags import DriverState -import DriverUtil ( handle, remove_spaces ) -import Linker -import Finder ( flushPackageCache ) +import DriverUtil ( remove_spaces ) +import Linker ( showLinkerState, linkPackages ) import Util -import Id ( isRecordSelector, recordSelectorFieldLabel, - isDataConWrapId, isDataConId, idName ) +import IdInfo ( GlobalIdDetails(..) ) +import Id ( isImplicitId, idName, globalIdDetails ) import Class ( className ) import TyCon ( tyConName, tyConClass_maybe, isPrimTyCon, DataConDetails(..) ) +import DataCon ( dataConName ) import FieldLabel ( fieldLabelTyCon ) import SrcLoc ( isGoodSrcLoc ) -import Module ( moduleName ) -import NameEnv ( nameEnvElts ) +import Module ( showModMsg, lookupModuleEnv ) import Name ( Name, isHomePackageName, nameSrcLoc, nameOccName, NamedThing(..) ) import OccName ( isSymOcc ) -import BasicTypes ( defaultFixity ) +import BasicTypes ( defaultFixity, SuccessFlag(..) ) +import Packages import Outputable import CmdLineOpts ( DynFlag(..), DynFlags(..), getDynFlags, saveDynFlags, restoreDynFlags, dopt_unset ) -import Panic ( GhcException(..), showGhcException ) +import Panic hiding ( showException ) import Config -#ifndef mingw32_TARGET_OS -import Posix +#ifndef mingw32_HOST_OS +import DriverUtil( handle ) +import System.Posix +#if __GLASGOW_HASKELL__ > 504 + hiding (getEnv) +#endif #endif -import Exception -import Dynamic #if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS -import Readline +import Control.Concurrent ( yield ) -- Used in readline loop +import System.Console.Readline as Readline #endif -import Concurrent -import IOExts -import SystemExts + +--import SystemExts + +import Control.Exception as Exception +import Data.Dynamic +import Control.Concurrent import Numeric -import List -import System -import CPUTime -import Directory -import IO -import Char -import Monad +import Data.List +import System.Cmd +import System.CPUTime +import System.Environment +import System.Directory +import System.IO as IO +import Data.Char +import Control.Monad as Monad + +import GHC.Exts ( unsafeCoerce# ) -import GlaExts ( unsafeCoerce# ) +import Data.IORef ( IORef, newIORef, readIORef, writeIORef ) -import Foreign ( nullPtr ) -import CString ( peekCString ) +import System.Posix.Internals ( setNonBlockingFD ) ----------------------------------------------------------------------------- @@ -85,14 +92,14 @@ GLOBAL_VAR(commands, builtin_commands, [(String, String -> GHCi Bool)]) builtin_commands :: [(String, String -> GHCi Bool)] builtin_commands = [ - ("add", keepGoing addModule), + ("add", keepGoingPaths addModule), ("browse", keepGoing browseCmd), ("cd", keepGoing changeDirectory), ("def", keepGoing defineMacro), ("help", keepGoing help), ("?", keepGoing help), ("info", keepGoing info), - ("load", keepGoing loadModule), + ("load", keepGoingPaths loadModule), ("module", keepGoing setContext), ("reload", keepGoing reloadModule), ("set", keepGoing setCmd), @@ -106,37 +113,41 @@ builtin_commands = [ keepGoing :: (String -> GHCi ()) -> (String -> GHCi Bool) keepGoing a str = a str >> return False +keepGoingPaths :: ([FilePath] -> GHCi ()) -> (String -> GHCi Bool) +keepGoingPaths a str = a (toArgs str) >> return False + shortHelpText = "use :? for help.\n" +-- NOTE: spaces at the end of each line to workaround CPP/string gap bug. helpText = "\ \ Commands available from the prompt:\n\ -\\ -\ evaluate/run \n\ -\ :add ... add module(s) to the current target set\n\ -\ :browse [*] display the names defined by \n\ -\ :cd change directory to \n\ -\ :def define a command :\n\ -\ :help, :? display this list of commands\n\ -\ :info [ ...] display information about the given names\n\ -\ :load ... load module(s) and their dependents\n\ -\ :module set the context for expression evaluation to \n\ -\ :reload reload the current module set\n\ \\n\ -\ :set