X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=5801a3859d0fe10d6d1fb3f9651a4576f929a807;hb=dc813469cfae2d6ae2defe44bf014faf3ded2b32;hp=f75c6726eb1c369f66933f26d49562450e6e01b0;hpb=dd6f34b632c29306e56b6bdf232316af26800a4f;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index f75c672..5801a38 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,63 +1,81 @@ +{-# OPTIONS -#include "Linker.h" -#include "SchedAPI.h" #-} ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.86 2001/08/15 14:40:24 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.139 2002/12/12 13:21:46 ross Exp $ -- -- GHC Interactive User Interface -- -- (c) The GHC Team 2000 -- ----------------------------------------------------------------------------- - -{-# OPTIONS -#include "Linker.h" #-} -{-# OPTIONS -#include "SchedAPI.h" #-} -module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where +module InteractiveUI ( + interactiveUI, -- :: CmState -> [FilePath] -> [LibrarySpec] -> IO () + ghciWelcomeMsg + ) where #include "../includes/config.h" #include "HsVersions.h" -import Packages import CompManager -import HscTypes ( GhciMode(..), TyThing(..) ) -import MkIface ( ifaceTyCls ) -import ByteCodeLink +import HscTypes ( TyThing(..), HomeModInfo(hm_linkable), HomePackageTable, + isObjectLinkable ) +import HsSyn ( TyClDecl(..), ConDecl(..), Sig(..) ) +import MkIface ( ifaceTyThing ) import DriverFlags import DriverState -import DriverUtil -import Linker -import Finder ( flushPackageCache ) +import DriverUtil ( remove_spaces, handle ) +import Linker ( initLinker, showLinkerState, linkLibraries ) +import Finder ( flushFinderCache ) import Util -import Id ( isDataConWrapId, idName ) +import Id ( isRecordSelector, recordSelectorFieldLabel, + isDataConWrapId, isDataConId, idName ) import Class ( className ) -import TyCon ( tyConName ) +import TyCon ( tyConName, tyConClass_maybe, isPrimTyCon, DataConDetails(..) ) +import FieldLabel ( fieldLabelTyCon ) import SrcLoc ( isGoodSrcLoc ) -import Name ( Name, isHomePackageName, nameSrcLoc ) +import Module ( showModMsg, lookupModuleEnv ) +import Name ( Name, isHomePackageName, nameSrcLoc, nameOccName, + NamedThing(..) ) +import OccName ( isSymOcc ) +import BasicTypes ( defaultFixity, SuccessFlag(..) ) +import Packages import Outputable -import CmdLineOpts ( DynFlag(..), getDynFlags, saveDynFlags, restoreDynFlags, dopt_unset ) -import Panic ( GhcException(..) ) +import CmdLineOpts ( DynFlag(..), DynFlags(..), getDynFlags, saveDynFlags, + restoreDynFlags, dopt_unset ) +import Panic ( GhcException(..), showGhcException ) import Config #ifndef mingw32_TARGET_OS -import Posix +import System.Posix #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 IOExts + +--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 ( when ) - -import PrelGHC ( unsafeCoerce# ) +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 Foreign ( nullPtr ) -import CString ( peekCString ) +import Foreign.C.String ( CString, peekCString, withCString ) +import Data.IORef ( IORef, newIORef, readIORef, writeIORef ) + +import GHC.Posix ( setNonBlockingFD ) ----------------------------------------------------------------------------- @@ -73,6 +91,7 @@ GLOBAL_VAR(commands, builtin_commands, [(String, String -> GHCi Bool)]) builtin_commands :: [(String, String -> GHCi Bool)] builtin_commands = [ ("add", keepGoing addModule), + ("browse", keepGoing browseCmd), ("cd", keepGoing changeDirectory), ("def", keepGoing defineMacro), ("help", keepGoing help), @@ -81,7 +100,8 @@ builtin_commands = [ ("load", keepGoing loadModule), ("module", keepGoing setContext), ("reload", keepGoing reloadModule), - ("set", keepGoing setOptions), + ("set", keepGoing setCmd), + ("show", keepGoing showCmd), ("type", keepGoing typeOfExpr), ("unset", keepGoing unsetOptions), ("undef", keepGoing undefineMacro), @@ -93,28 +113,36 @@ keepGoing a str = a 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\ -\ :cd change directory to \n\ -\ :def define a command :\n\ -\ :help, :? display this list of commands\n\ -\ :info [ ...] display information about the given names, or\n\ -\ about currently loaded files if no names given\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\ -\ :set