X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=e64323cda51614235d75592d6f5983e89caa1ef3;hb=ee43954806848ffbe78f7cb8cf6732c2d86306d2;hp=df05c6e6c22387b13fee35dc826d707aeb8756ea;hpb=acef71564746becef2c85c310ed57dc8fdd54581;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index df05c6e..e64323c 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.5 2000/11/20 16:28:29 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.77 2001/06/18 09:09:28 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -7,154 +7,351 @@ -- ----------------------------------------------------------------------------- -module InteractiveUI (interactiveUI) where +{-# OPTIONS -#include "Linker.h" #-} +module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where +#include "../includes/config.h" #include "HsVersions.h" +import Packages import CompManager -import CmStaticInfo +import HscTypes ( GhciMode(..) ) +import ByteCodeLink import DriverFlags -import DriverUtil import DriverState +import DriverUtil import Linker -import Module -import Outputable -import Panic +import Finder ( flushPackageCache ) import Util +import Name ( Name ) +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 Readline +import Dynamic +#if HAVE_READLINE_HEADERS && HAVE_READLINE_LIBS +import Readline +#endif import IOExts +import Numeric +import List import System +import CPUTime import Directory import IO import Char +import Monad ( when ) + +import PrelGHC ( unsafeCoerce# ) +import Foreign ( nullPtr ) +import CString ( peekCString ) ----------------------------------------------------------------------------- ghciWelcomeMsg = "\ -\ _____ __ __ ____ _________________________________________________\n\ -\(| || || (| |) GHC Interactive, version 5.00 \n\ -\|| __ ||___|| || () For Haskell 98. \n\ -\|| |) ||---|| || || http://www.haskell.org/ghc \n\ -\|| || || || || (| Bug reports to: glasgow-haskell-bugs@haskell.org \n\ -\(|___|| || || (|__|) \\\\______________________________________________________\n" - -commands :: [(String, String -> GHCi ())] -commands = [ - ("cd", changeDirectory), - ("help", help), - ("?", help), - ("load", loadModule), - ("reload", reloadModule), - ("set", setOptions), - ("type", typeOfExpr), +\ ___ ___ _\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), + ("cd", keepGoing changeDirectory), + ("def", keepGoing defineMacro), + ("help", keepGoing help), + ("?", keepGoing help), + ("load", keepGoing loadModule), + ("module", keepGoing setContext), + ("reload", keepGoing reloadModule), + ("set", keepGoing setOptions), + ("type", keepGoing typeOfExpr), + ("unset", keepGoing unsetOptions), + ("undef", keepGoing undefineMacro), ("quit", quit) ] +keepGoing :: (String -> GHCi ()) -> (String -> GHCi Bool) +keepGoing a str = a str >> return False + shortHelpText = "use :? for help.\n" helpText = "\ -\ evaluate \n\ -\ :cd change directory to \n\ -\ :help display this list of commands\n\ -\ :? display this list of commands\n\ -\ :load load a module (and it dependents)\n\ -\ :reload reload the current program\n\ -\ :set ... set options\n\ -\ :type show the type of \n\ -\ :quit exit GHCi\n\ -\ :! run the shell command \n\ +\ 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 its dependents)\n\ +\ :module set the context for expression evaluation to \n\ +\ :reload reload the current module set\n\ +\ :set