X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=38b24854cf67149a9b94593ac27a95aa351ce76c;hb=423d477bfecd490de1449c59325c8776f91d7aac;hp=14208e137fe0f478982c3a1f01878b71f7704a93;hpb=b3e4cb91c4386c4d1456b896da1abb964f2124a6;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index 14208e1..38b2485 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,58 +1,54 @@ -{-# OPTIONS -#include "Linker.h" -#include "SchedAPI.h" #-} +{-# OPTIONS -#include "Linker.h" #-} ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.133 2002/09/06 14:35:44 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.173 2004/08/13 13:06:42 simonmar Exp $ -- -- GHC Interactive User Interface -- --- (c) The GHC Team 2000 +-- (c) The GHC Team 2004 -- ----------------------------------------------------------------------------- module InteractiveUI ( - interactiveUI, -- :: CmState -> [FilePath] -> [LibrarySpec] -> IO () - LibrarySpec(..), + interactiveUI, -- :: CmState -> [FilePath] -> IO () ghciWelcomeMsg ) where -#include "../includes/config.h" +#include "../includes/ghcconfig.h" #include "HsVersions.h" -import Packages - import CompManager -import CmTypes ( Linkable, isObjectLinkable, ModSummary(..) ) -import CmLink ( findModuleLinkable_maybe ) - -import HscTypes ( TyThing(..), showModMsg, InteractiveContext(..) ) -import HsSyn ( TyClDecl(..), ConDecl(..), Sig(..) ) -import MkIface ( ifaceTyThing ) +import HscTypes ( TyThing(..), HomeModInfo(hm_linkable), HomePackageTable, + isObjectLinkable, GhciMode(..) ) +import IfaceSyn ( IfaceType, IfaceDecl(..), IfaceClassOp(..), IfaceConDecls(..), IfaceConDecl(..), + pprIfaceDeclHead, pprParendIfaceType, pprIfaceForAllPart ) +import FunDeps ( pprFundeps ) 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 Class ( className ) -import TyCon ( tyConName, tyConClass_maybe, isPrimTyCon, DataConDetails(..) ) -import FieldLabel ( fieldLabelTyCon ) -import SrcLoc ( isGoodSrcLoc ) -import Module ( moduleName ) +import Module ( showModMsg, lookupModuleEnv ) import Name ( Name, isHomePackageName, nameSrcLoc, nameOccName, NamedThing(..) ) -import OccName ( isSymOcc ) -import BasicTypes ( defaultFixity ) +import OccName ( OccName, isSymOcc, occNameUserString ) +import BasicTypes ( StrictnessMark(..), Fixity, 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 +import SrcLoc ( SrcLoc, isGoodSrcLoc ) -#ifndef mingw32_TARGET_OS +#ifndef mingw32_HOST_OS +import DriverUtil( handle ) import System.Posix +#if __GLASGOW_HASKELL__ > 504 + hiding (getEnv) +#endif #endif #if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS +import Control.Concurrent ( yield ) -- Used in readline loop import System.Console.Readline as Readline #endif @@ -64,6 +60,7 @@ import Control.Concurrent import Numeric import Data.List +import Data.Int ( Int64 ) import System.Cmd import System.CPUTime import System.Environment @@ -74,37 +71,37 @@ import Control.Monad as Monad import GHC.Exts ( unsafeCoerce# ) -import Foreign ( nullPtr ) -import Foreign.C.String ( CString, peekCString, withCString ) import Data.IORef ( IORef, newIORef, readIORef, writeIORef ) +import System.Posix.Internals ( setNonBlockingFD ) ----------------------------------------------------------------------------- -ghciWelcomeMsg = "\ -\ ___ ___ _\n\ -\ / _ \\ /\\ /\\/ __(_)\n\ -\ / /_\\// /_/ / / | | GHC Interactive, version " ++ cProjectVersion ++ ", for Haskell 98.\n\ -\/ /_\\\\/ __ / /___| | http://www.haskell.org/ghc/\n\ -\\\____/\\/ /_/\\____/|_| Type :? for help.\n" +ghciWelcomeMsg = + " ___ ___ _\n"++ + " / _ \\ /\\ /\\/ __(_)\n"++ + " / /_\\// /_/ / / | | GHC Interactive, version " ++ cProjectVersion ++ ", for Haskell 98.\n"++ + "/ /_\\\\/ __ / /___| | http://www.haskell.org/ghc/\n"++ + "\\____/\\/ /_/\\____/|_| Type :? for help.\n" 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), ("show", keepGoing showCmd), ("type", keepGoing typeOfExpr), + ("kind", keepGoing kindOfType), ("unset", keepGoing unsetOptions), ("undef", keepGoing undefineMacro), ("quit", quit) @@ -113,93 +110,76 @@ 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\ -\\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\n\ -\ :reload reload the current module set\n\ -\\n\ -\ :set