X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=a2225ff0a4f252ee87b5d8c8ce48f2a3bb19bebe;hb=c137d2829415beb3daac2878d4e2d3008f13efc8;hp=f63e8d3edf246137921b17ef43053ab7c643de8b;hpb=dc63be7829b52ecbe2b4e7d4946f3f8ea19d3d05;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index f63e8d3..a2225ff 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.38 2001/02/09 15:39:39 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.88 2001/08/15 15:39:59 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -7,30 +7,42 @@ -- ----------------------------------------------------------------------------- -module InteractiveUI (interactiveUI) where +{-# OPTIONS -#include "Linker.h" #-} +{-# OPTIONS -#include "SchedAPI.h" #-} +module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where +#include "../includes/config.h" #include "HsVersions.h" +import Packages import CompManager -import CmStaticInfo +import HscTypes ( GhciMode(..), TyThing(..) ) +import MkIface ( ifaceTyCls ) import ByteCodeLink import DriverFlags import DriverState import DriverUtil -import Type import Linker -import Finder -import Module -import Outputable +import Finder ( flushPackageCache ) import Util -import PprType {- instance Outputable Type; do not delete -} +import Id ( isRecordSelector, isDataConWrapId, idName ) +import Class ( className ) +import TyCon ( tyConName ) +import SrcLoc ( isGoodSrcLoc ) +import Name ( Name, isHomePackageName, nameSrcLoc ) +import Outputable +import CmdLineOpts ( DynFlag(..), getDynFlags, saveDynFlags, restoreDynFlags, dopt_unset ) import Panic ( GhcException(..) ) import Config +#ifndef mingw32_TARGET_OS +import Posix +#endif + import Exception import Dynamic -#ifndef NO_READLINE -import Readline +#if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS +import Readline #endif import IOExts @@ -41,30 +53,38 @@ import CPUTime import Directory import IO import Char -import Monad ( when ) +import Monad ( when ) +import PrelGHC ( unsafeCoerce# ) +import Foreign ( nullPtr ) +import CString ( peekCString ) ----------------------------------------------------------------------------- ghciWelcomeMsg = "\ -\ ___ ___ _ \n\ -\ / _ \\ /\\ /\\/ __(_) GHC Interactive, version " ++ cProjectVersion ++ ", For Haskell 98. \n\ -\ / /_\\// /_/ / / | | http://www.haskell.org/ghc \n\ -\/ /_\\\\/ __ / /___| | Bug reports to: glasgow-haskell-bugs@haskell.org \n\ +\ ___ ___ _\n\ +\ / _ \\ /\\ /\\/ __(_)\n\ +\ / /_\\// /_/ / / | | GHC Interactive, version " ++ cProjectVersion ++ ", for Haskell 98.\n\ +\/ /_\\\\/ __ / /___| | http://www.haskell.org/ghc/\n\ \\\____/\\/ /_/\\____/|_| Type :? for help.\n" -commands :: [(String, String -> GHCi Bool)] -commands = [ +GLOBAL_VAR(commands, builtin_commands, [(String, String -> GHCi Bool)]) + +builtin_commands :: [(String, String -> GHCi Bool)] +builtin_commands = [ ("add", keepGoing addModule), ("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), ("type", keepGoing typeOfExpr), ("unset", keepGoing unsetOptions), + ("undef", keepGoing undefineMacro), ("quit", quit) ] @@ -75,98 +95,111 @@ shortHelpText = "use :? for help.\n" helpText = "\ \ Commands available from the prompt:\n\ -\\ -\ evaluate \n\ -\ :add add a module to the current set\n\ -\ :cd change directory to \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