X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=99f98dcfd89d2b29b25aa55bd79c4f1c88026746;hb=8f3023cf4cac015d686672cbc91f3426357ec138;hp=fd5a9db5c6db40abc0f2e6d4c9b4c11e741b33df;hpb=dfbbfedc7e68d3095a37e4359b69eccc27e5398c;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index fd5a9db..99f98dc 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,40 +1,62 @@ +{-# OPTIONS -#include "Linker.h" -#include "SchedAPI.h" #-} ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.65 2001/05/04 14:56:53 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.117 2002/04/02 10:18:07 simonmar Exp $ -- -- GHC Interactive User Interface -- -- (c) The GHC Team 2000 -- ----------------------------------------------------------------------------- - -{-# OPTIONS -#include "Linker.h" #-} module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where #include "../includes/config.h" #include "HsVersions.h" +import Packages + import CompManager -import CmStaticInfo -import ByteCodeLink +import CmTypes ( Linkable, isObjectLinkable, ModSummary(..) ) +import CmLink ( findModuleLinkable_maybe ) + +import HscTypes ( TyThing(..), showModMsg, InteractiveContext(..) ) +import HsSyn ( TyClDecl(..), ConDecl(..), Sig(..) ) +import MkIface ( ifaceTyThing ) import DriverFlags import DriverState -import DriverUtil +import DriverUtil ( handle, remove_spaces ) import Linker import Finder ( flushPackageCache ) import Util -import Name ( Name ) +import Id ( isRecordSelector, recordSelectorFieldLabel, + isDataConWrapId, isDataConId, idName ) +import Class ( className ) +import TyCon ( tyConName, tyConClass_maybe, isPrimTyCon, DataConDetails(..) ) +import FieldLabel ( fieldLabelTyCon ) +import SrcLoc ( isGoodSrcLoc ) +import Module ( moduleName ) +import NameEnv ( nameEnvElts ) +import Name ( Name, isHomePackageName, nameSrcLoc, nameOccName, + NamedThing(..) ) +import OccName ( isSymOcc ) +import BasicTypes ( defaultFixity ) import Outputable -import CmdLineOpts ( DynFlag(..), 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 +#endif + import Exception import Dynamic #if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS import Readline #endif +import Concurrent import IOExts +import SystemExts import Numeric import List @@ -43,9 +65,10 @@ import CPUTime import Directory import IO import Char -import Monad ( when ) +import Monad + +import GlaExts ( unsafeCoerce# ) -import PrelGHC ( unsafeCoerce# ) import Foreign ( nullPtr ) import CString ( peekCString ) @@ -54,7 +77,7 @@ import CString ( peekCString ) ghciWelcomeMsg = "\ \ ___ ___ _\n\ \ / _ \\ /\\ /\\/ __(_)\n\ -\ / /_\\// /_/ / / | | GHC Interactive, version " ++ cProjectVersion ++ ", For Haskell 98.\n\ +\ / /_\\// /_/ / / | | GHC Interactive, version " ++ cProjectVersion ++ ", for Haskell 98.\n\ \/ /_\\\\/ __ / /___| | http://www.haskell.org/ghc/\n\ \\\____/\\/ /_/\\____/|_| Type :? for help.\n" @@ -63,14 +86,17 @@ 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), ("?", keepGoing help), + ("info", keepGoing info), ("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), @@ -82,118 +108,175 @@ 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\ -\ :cd change directory to \n\ -\ :def define a command :\n\ -\ :help, :? display this list of commands\n\ -\ :load load a module (and it dependents)\n\ -\ :module set the context for expression evaluation to \n\ -\ :reload reload the current module set\n\ -\ :set