X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=ghc%2Fcompiler%2Fghci%2FInteractiveUI.hs;h=68147c06c3b875ddca144dbc405fcbcb471dfcd8;hb=41d0a61d29cb0daccbcdbf96a339c06c5aa140a4;hp=4f16a568ac7635aa6edf84e01b933f34a21c430d;hpb=459e7bd4622ea5bb8e90511b5fc6c7d8058dbd5f;p=ghc-hetmet.git diff --git a/ghc/compiler/ghci/InteractiveUI.hs b/ghc/compiler/ghci/InteractiveUI.hs index 4f16a56..68147c0 100644 --- a/ghc/compiler/ghci/InteractiveUI.hs +++ b/ghc/compiler/ghci/InteractiveUI.hs @@ -1,5 +1,5 @@ ----------------------------------------------------------------------------- --- $Id: InteractiveUI.hs,v 1.4 2000/11/17 16:53:27 simonmar Exp $ +-- $Id: InteractiveUI.hs,v 1.53 2001/02/27 15:26:04 simonmar Exp $ -- -- GHC Interactive User Interface -- @@ -7,143 +7,294 @@ -- ----------------------------------------------------------------------------- -module InteractiveUI (interactiveUI) where +{-# OPTIONS -#include "Linker.h" #-} +module InteractiveUI ( interactiveUI, ghciWelcomeMsg ) where #include "HsVersions.h" import CompManager import CmStaticInfo +import ByteCodeLink import DriverFlags -import DriverUtil import DriverState +import DriverUtil import Linker -import Module -import Panic import Util +import Name ( Name ) +import Outputable +import Panic ( GhcException(..) ) +import Config import Exception +import Dynamic +#ifndef NO_READLINE 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), - ("quit", quit), - ("!", shellEscape) +\ ___ ___ _\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\ +\ Commands available from the prompt:\n\ +\\ +\ evaluate/run \n\ +\ :add add a module to the current set\n\ \ :cd change directory to \n\ -\ :help display this list of commands\n\ -\ :? display this list of commands\n\ +\ :help, :? display this list of commands\n\ \ :load load a module (and it dependents)\n\ -\ :reload reload the current program\n\ -\ :set ... set options\n\ +\ :module set the context for expression evaluation to \n\ +\ :reload reload the current module set\n\ +\ :set